1 | /*! firebase-admin v10.0.0 */
|
2 | /*!
|
3 | * @license
|
4 | * Copyright 2017 Google Inc.
|
5 | *
|
6 | * Licensed under the Apache License, Version 2.0 (the "License");
|
7 | * you may not use this file except in compliance with the License.
|
8 | * You may obtain a copy of the License at
|
9 | *
|
10 | * http://www.apache.org/licenses/LICENSE-2.0
|
11 | *
|
12 | * Unless required by applicable law or agreed to in writing, software
|
13 | * distributed under the License is distributed on an "AS IS" BASIS,
|
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15 | * See the License for the specific language governing permissions and
|
16 | * limitations under the License.
|
17 | */
|
18 | /// <reference types="node" />
|
19 | import { App } from '../app/index';
|
20 | export declare function getSdkVersion(): string;
|
21 | /**
|
22 | * Renames properties on an object given a mapping from old to new property names.
|
23 | *
|
24 | * For example, this can be used to map underscore_cased properties to camelCase.
|
25 | *
|
26 | * @param obj - The object whose properties to rename.
|
27 | * @param keyMap - The mapping from old to new property names.
|
28 | */
|
29 | export declare function renameProperties(obj: {
|
30 | [key: string]: any;
|
31 | }, keyMap: {
|
32 | [key: string]: string;
|
33 | }): void;
|
34 | /**
|
35 | * Defines a new read-only property directly on an object and returns the object.
|
36 | *
|
37 | * @param obj - The object on which to define the property.
|
38 | * @param prop - The name of the property to be defined or modified.
|
39 | * @param value - The value associated with the property.
|
40 | */
|
41 | export declare function addReadonlyGetter(obj: object, prop: string, value: any): void;
|
42 | /**
|
43 | * Returns the Google Cloud project ID associated with a Firebase app, if it's explicitly
|
44 | * specified in either the Firebase app options, credentials or the local environment.
|
45 | * Otherwise returns null.
|
46 | *
|
47 | * @param app - A Firebase app to get the project ID from.
|
48 | *
|
49 | * @returns A project ID string or null.
|
50 | */
|
51 | export declare function getExplicitProjectId(app: App): string | null;
|
52 | /**
|
53 | * Determines the Google Cloud project ID associated with a Firebase app. This method
|
54 | * first checks if a project ID is explicitly specified in either the Firebase app options,
|
55 | * credentials or the local environment in that order. If no explicit project ID is
|
56 | * configured, but the SDK has been initialized with ComputeEngineCredentials, this
|
57 | * method attempts to discover the project ID from the local metadata service.
|
58 | *
|
59 | * @param app - A Firebase app to get the project ID from.
|
60 | *
|
61 | * @returns A project ID string or null.
|
62 | */
|
63 | export declare function findProjectId(app: App): Promise<string | null>;
|
64 | /**
|
65 | * Encodes data using web-safe-base64.
|
66 | *
|
67 | * @param data - The raw data byte input.
|
68 | * @returns The base64-encoded result.
|
69 | */
|
70 | export declare function toWebSafeBase64(data: Buffer): string;
|
71 | /**
|
72 | * Formats a string of form 'project/{projectId}/{api}' and replaces
|
73 | * with corresponding arguments {projectId: '1234', api: 'resource'}
|
74 | * and returns output: 'project/1234/resource'.
|
75 | *
|
76 | * @param str - The original string where the param need to be
|
77 | * replaced.
|
78 | * @param params - The optional parameters to replace in the
|
79 | * string.
|
80 | * @returns The resulting formatted string.
|
81 | */
|
82 | export declare function formatString(str: string, params?: object): string;
|
83 | /**
|
84 | * Generates the update mask for the provided object.
|
85 | * Note this will ignore the last key with value undefined.
|
86 | *
|
87 | * @param obj - The object to generate the update mask for.
|
88 | * @param terminalPaths - The optional map of keys for maximum paths to traverse.
|
89 | * Nested objects beyond that path will be ignored. This is useful for
|
90 | * keys with variable object values.
|
91 | * @param root - The path so far.
|
92 | * @returns The computed update mask list.
|
93 | */
|
94 | export declare function generateUpdateMask(obj: any, terminalPaths?: string[], root?: string): string[];
|
95 | /**
|
96 | * Transforms milliseconds to a protobuf Duration type string.
|
97 | * Returns the duration in seconds with up to nine fractional
|
98 | * digits, terminated by 's'. Example: "3 seconds 0 nano seconds as 3s,
|
99 | * 3 seconds 1 nano seconds as 3.000000001s".
|
100 | *
|
101 | * @param milliseconds - The duration in milliseconds.
|
102 | * @returns The resulting formatted string in seconds with up to nine fractional
|
103 | * digits, terminated by 's'.
|
104 | */
|
105 | export declare function transformMillisecondsToSecondsString(milliseconds: number): string;
|