@firebase/installations 0.5.2-canary.61604979c → 0.5.2-canary.dbfe09e9d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{index.esm.js → esm/index.esm.js} +1 -1
- package/dist/esm/index.esm.js.map +1 -0
- package/dist/{index.esm2017.js → esm/index.esm2017.js} +1 -1
- package/dist/esm/index.esm2017.js.map +1 -0
- package/dist/esm/package.json +1 -0
- package/dist/esm/src/api/delete-installations.d.ts +24 -0
- package/dist/esm/src/api/delete-installations.test.d.ts +17 -0
- package/dist/esm/src/api/get-id.d.ts +25 -0
- package/dist/esm/src/api/get-id.test.d.ts +17 -0
- package/dist/esm/src/api/get-installations.d.ts +26 -0
- package/dist/esm/src/api/get-token.d.ts +26 -0
- package/dist/esm/src/api/get-token.test.d.ts +17 -0
- package/dist/esm/src/api/index.d.ts +21 -0
- package/dist/esm/src/api/on-id-change.d.ts +39 -0
- package/dist/esm/src/api/on-id-change.test.d.ts +17 -0
- package/dist/esm/src/functions/common.d.ts +38 -0
- package/dist/esm/src/functions/common.test.d.ts +17 -0
- package/dist/esm/src/functions/config.d.ts +17 -0
- package/dist/esm/src/functions/create-installation-request.d.ts +19 -0
- package/dist/esm/src/functions/create-installation-request.test.d.ts +17 -0
- package/dist/esm/src/functions/delete-installation-request.d.ts +19 -0
- package/dist/esm/src/functions/delete-installation-request.test.d.ts +17 -0
- package/dist/esm/src/functions/generate-auth-token-request.d.ts +19 -0
- package/dist/esm/src/functions/generate-auth-token-request.test.d.ts +17 -0
- package/dist/esm/src/helpers/buffer-to-base64-url-safe.d.ts +17 -0
- package/dist/esm/src/helpers/buffer-to-base64-url-safe.test.d.ts +17 -0
- package/dist/esm/src/helpers/extract-app-config.d.ts +19 -0
- package/dist/esm/src/helpers/extract-app-config.test.d.ts +17 -0
- package/dist/esm/src/helpers/fid-changed.d.ts +25 -0
- package/dist/esm/src/helpers/fid-changed.test.d.ts +17 -0
- package/dist/esm/src/helpers/generate-fid.d.ts +23 -0
- package/dist/esm/src/helpers/generate-fid.test.d.ts +17 -0
- package/dist/esm/src/helpers/get-installation-entry.d.ts +28 -0
- package/dist/esm/src/helpers/get-installation-entry.test.d.ts +17 -0
- package/dist/esm/src/helpers/idb-manager.d.ts +32 -0
- package/dist/esm/src/helpers/idb-manager.test.d.ts +17 -0
- package/dist/esm/src/helpers/refresh-auth-token.d.ts +25 -0
- package/dist/esm/src/helpers/refresh-auth-token.test.d.ts +17 -0
- package/dist/esm/src/index.d.ts +7 -0
- package/dist/esm/src/interfaces/api-response.d.ts +31 -0
- package/dist/esm/src/interfaces/installation-entry.d.ts +85 -0
- package/dist/esm/src/interfaces/installation-impl.d.ts +29 -0
- package/dist/esm/src/interfaces/public-types.d.ts +50 -0
- package/dist/esm/src/testing/compare-headers.d.ts +21 -0
- package/dist/esm/src/testing/compare-headers.test.d.ts +17 -0
- package/dist/esm/src/testing/fake-generators.d.ts +21 -0
- package/dist/esm/src/testing/setup.d.ts +17 -0
- package/dist/esm/src/util/constants.d.ts +23 -0
- package/dist/esm/src/util/errors.d.ts +46 -0
- package/dist/esm/src/util/get-key.d.ts +19 -0
- package/dist/esm/src/util/sleep.d.ts +18 -0
- package/dist/esm/src/util/sleep.test.d.ts +17 -0
- package/dist/index.cjs.js +1 -1
- package/package.json +16 -9
- package/dist/index.esm.js.map +0 -1
- package/dist/index.esm2017.js.map +0 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2019 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import '../testing/setup';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2019 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { FirebaseError } from '@firebase/util';
|
|
18
|
+
import { GenerateAuthTokenResponse } from '../interfaces/api-response';
|
|
19
|
+
import { CompletedAuthToken, RegisteredInstallationEntry } from '../interfaces/installation-entry';
|
|
20
|
+
import { AppConfig } from '../interfaces/installation-impl';
|
|
21
|
+
export declare function getInstallationsEndpoint({ projectId }: AppConfig): string;
|
|
22
|
+
export declare function extractAuthTokenInfoFromResponse(response: GenerateAuthTokenResponse): CompletedAuthToken;
|
|
23
|
+
export declare function getErrorFromResponse(requestName: string, response: Response): Promise<FirebaseError>;
|
|
24
|
+
export declare function getHeaders({ apiKey }: AppConfig): Headers;
|
|
25
|
+
export declare function getHeadersWithAuth(appConfig: AppConfig, { refreshToken }: RegisteredInstallationEntry): Headers;
|
|
26
|
+
export interface ErrorResponse {
|
|
27
|
+
error: {
|
|
28
|
+
code: number;
|
|
29
|
+
message: string;
|
|
30
|
+
status: string;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Calls the passed in fetch wrapper and returns the response.
|
|
35
|
+
* If the returned response has a status of 5xx, re-runs the function once and
|
|
36
|
+
* returns the response.
|
|
37
|
+
*/
|
|
38
|
+
export declare function retryIfServerError(fn: () => Promise<Response>): Promise<Response>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2019 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import '../testing/setup';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2020 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
export declare function registerInstallations(): void;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2019 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { InProgressInstallationEntry, RegisteredInstallationEntry } from '../interfaces/installation-entry';
|
|
18
|
+
import { AppConfig } from '../interfaces/installation-impl';
|
|
19
|
+
export declare function createInstallationRequest(appConfig: AppConfig, { fid }: InProgressInstallationEntry): Promise<RegisteredInstallationEntry>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2019 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import '../testing/setup';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2019 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { AppConfig } from '../interfaces/installation-impl';
|
|
18
|
+
import { RegisteredInstallationEntry } from '../interfaces/installation-entry';
|
|
19
|
+
export declare function deleteInstallationRequest(appConfig: AppConfig, installationEntry: RegisteredInstallationEntry): Promise<void>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2019 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import '../testing/setup';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2019 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { CompletedAuthToken, RegisteredInstallationEntry } from '../interfaces/installation-entry';
|
|
18
|
+
import { FirebaseInstallationsImpl } from '../interfaces/installation-impl';
|
|
19
|
+
export declare function generateAuthTokenRequest({ appConfig, platformLoggerProvider }: FirebaseInstallationsImpl, installationEntry: RegisteredInstallationEntry): Promise<CompletedAuthToken>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2019 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import '../testing/setup';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2019 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
export declare function bufferToBase64UrlSafe(array: Uint8Array): string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2019 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import '../testing/setup';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2019 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { FirebaseApp } from '@firebase/app';
|
|
18
|
+
import { AppConfig } from '../interfaces/installation-impl';
|
|
19
|
+
export declare function extractAppConfig(app: FirebaseApp): AppConfig;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2019 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import '../testing/setup';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2019 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { AppConfig } from '../interfaces/installation-impl';
|
|
18
|
+
import { IdChangeCallbackFn } from '../api';
|
|
19
|
+
/**
|
|
20
|
+
* Calls the onIdChange callbacks with the new FID value, and broadcasts the
|
|
21
|
+
* change to other tabs.
|
|
22
|
+
*/
|
|
23
|
+
export declare function fidChanged(appConfig: AppConfig, fid: string): void;
|
|
24
|
+
export declare function addCallback(appConfig: AppConfig, callback: IdChangeCallbackFn): void;
|
|
25
|
+
export declare function removeCallback(appConfig: AppConfig, callback: IdChangeCallbackFn): void;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2019 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import '../testing/setup';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2019 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
export declare const VALID_FID_PATTERN: RegExp;
|
|
18
|
+
export declare const INVALID_FID = "";
|
|
19
|
+
/**
|
|
20
|
+
* Generates a new FID using random values from Web Crypto API.
|
|
21
|
+
* Returns an empty string if FID generation fails for any reason.
|
|
22
|
+
*/
|
|
23
|
+
export declare function generateFid(): string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2019 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import '../testing/setup';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2019 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { AppConfig } from '../interfaces/installation-impl';
|
|
18
|
+
import { InstallationEntry, RegisteredInstallationEntry } from '../interfaces/installation-entry';
|
|
19
|
+
export interface InstallationEntryWithRegistrationPromise {
|
|
20
|
+
installationEntry: InstallationEntry;
|
|
21
|
+
/** Exist iff the installationEntry is not registered. */
|
|
22
|
+
registrationPromise?: Promise<RegisteredInstallationEntry>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Updates and returns the InstallationEntry from the database.
|
|
26
|
+
* Also triggers a registration request if it is necessary and possible.
|
|
27
|
+
*/
|
|
28
|
+
export declare function getInstallationEntry(appConfig: AppConfig): Promise<InstallationEntryWithRegistrationPromise>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2019 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import '../testing/setup';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2019 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { AppConfig } from '../interfaces/installation-impl';
|
|
18
|
+
import { InstallationEntry } from '../interfaces/installation-entry';
|
|
19
|
+
/** Gets record(s) from the objectStore that match the given key. */
|
|
20
|
+
export declare function get(appConfig: AppConfig): Promise<InstallationEntry | undefined>;
|
|
21
|
+
/** Assigns or overwrites the record for the given key with the given value. */
|
|
22
|
+
export declare function set<ValueType extends InstallationEntry>(appConfig: AppConfig, value: ValueType): Promise<ValueType>;
|
|
23
|
+
/** Removes record(s) from the objectStore that match the given key. */
|
|
24
|
+
export declare function remove(appConfig: AppConfig): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Atomically updates a record with the result of updateFn, which gets
|
|
27
|
+
* called with the current value. If newValue is undefined, the record is
|
|
28
|
+
* deleted instead.
|
|
29
|
+
* @return Updated value
|
|
30
|
+
*/
|
|
31
|
+
export declare function update<ValueType extends InstallationEntry | undefined>(appConfig: AppConfig, updateFn: (previousValue: InstallationEntry | undefined) => ValueType): Promise<ValueType>;
|
|
32
|
+
export declare function clear(): Promise<void>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2019 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import '../testing/setup';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2019 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { FirebaseInstallationsImpl } from '../interfaces/installation-impl';
|
|
18
|
+
import { CompletedAuthToken } from '../interfaces/installation-entry';
|
|
19
|
+
/**
|
|
20
|
+
* Returns a valid authentication token for the installation. Generates a new
|
|
21
|
+
* token if one doesn't exist, is expired or about to expire.
|
|
22
|
+
*
|
|
23
|
+
* Should only be called if the Firebase Installation is registered.
|
|
24
|
+
*/
|
|
25
|
+
export declare function refreshAuthToken(installations: FirebaseInstallationsImpl, forceRefresh?: boolean): Promise<CompletedAuthToken>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2019 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import '../testing/setup';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2019 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
export interface CreateInstallationResponse {
|
|
18
|
+
readonly refreshToken: string;
|
|
19
|
+
readonly authToken: GenerateAuthTokenResponse;
|
|
20
|
+
readonly fid?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface GenerateAuthTokenResponse {
|
|
23
|
+
readonly token: string;
|
|
24
|
+
/**
|
|
25
|
+
* Encoded as a string with the suffix 's' (indicating seconds), preceded by
|
|
26
|
+
* the number of seconds.
|
|
27
|
+
*
|
|
28
|
+
* Example: "604800s".
|
|
29
|
+
*/
|
|
30
|
+
readonly expiresIn: string;
|
|
31
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2019 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
/** Status of a server request. */
|
|
18
|
+
export declare const enum RequestStatus {
|
|
19
|
+
NOT_STARTED = 0,
|
|
20
|
+
IN_PROGRESS = 1,
|
|
21
|
+
COMPLETED = 2
|
|
22
|
+
}
|
|
23
|
+
export interface NotStartedAuthToken {
|
|
24
|
+
readonly requestStatus: RequestStatus.NOT_STARTED;
|
|
25
|
+
}
|
|
26
|
+
export interface InProgressAuthToken {
|
|
27
|
+
readonly requestStatus: RequestStatus.IN_PROGRESS;
|
|
28
|
+
/**
|
|
29
|
+
* Unix timestamp when the current generateAuthRequest was initiated.
|
|
30
|
+
* Used for figuring out how long the request status has been IN_PROGRESS.
|
|
31
|
+
*/
|
|
32
|
+
readonly requestTime: number;
|
|
33
|
+
}
|
|
34
|
+
export interface CompletedAuthToken {
|
|
35
|
+
readonly requestStatus: RequestStatus.COMPLETED;
|
|
36
|
+
/**
|
|
37
|
+
* Firebase Installations Authentication Token.
|
|
38
|
+
* Only exists if requestStatus is COMPLETED.
|
|
39
|
+
*/
|
|
40
|
+
readonly token: string;
|
|
41
|
+
/**
|
|
42
|
+
* Unix timestamp when Authentication Token was created.
|
|
43
|
+
* Only exists if requestStatus is COMPLETED.
|
|
44
|
+
*/
|
|
45
|
+
readonly creationTime: number;
|
|
46
|
+
/**
|
|
47
|
+
* Authentication Token time to live duration in milliseconds.
|
|
48
|
+
* Only exists if requestStatus is COMPLETED.
|
|
49
|
+
*/
|
|
50
|
+
readonly expiresIn: number;
|
|
51
|
+
}
|
|
52
|
+
export declare type AuthToken = NotStartedAuthToken | InProgressAuthToken | CompletedAuthToken;
|
|
53
|
+
export interface UnregisteredInstallationEntry {
|
|
54
|
+
/** Status of the Firebase Installation registration on the server. */
|
|
55
|
+
readonly registrationStatus: RequestStatus.NOT_STARTED;
|
|
56
|
+
/** Firebase Installation ID */
|
|
57
|
+
readonly fid: string;
|
|
58
|
+
}
|
|
59
|
+
export interface InProgressInstallationEntry {
|
|
60
|
+
/** Status of the Firebase Installation registration on the server. */
|
|
61
|
+
readonly registrationStatus: RequestStatus.IN_PROGRESS;
|
|
62
|
+
/**
|
|
63
|
+
* Unix timestamp that shows the time when the current createInstallation
|
|
64
|
+
* request was initiated.
|
|
65
|
+
* Used for figuring out how long the registration status has been PENDING.
|
|
66
|
+
*/
|
|
67
|
+
readonly registrationTime: number;
|
|
68
|
+
/** Firebase Installation ID */
|
|
69
|
+
readonly fid: string;
|
|
70
|
+
}
|
|
71
|
+
export interface RegisteredInstallationEntry {
|
|
72
|
+
/** Status of the Firebase Installation registration on the server. */
|
|
73
|
+
readonly registrationStatus: RequestStatus.COMPLETED;
|
|
74
|
+
/** Firebase Installation ID */
|
|
75
|
+
readonly fid: string;
|
|
76
|
+
/**
|
|
77
|
+
* Refresh Token returned from the server.
|
|
78
|
+
* Used for authenticating generateAuthToken requests.
|
|
79
|
+
*/
|
|
80
|
+
readonly refreshToken: string;
|
|
81
|
+
/** Firebase Installation Authentication Token. */
|
|
82
|
+
readonly authToken: AuthToken;
|
|
83
|
+
}
|
|
84
|
+
/** Firebase Installation ID and related data in the database. */
|
|
85
|
+
export declare type InstallationEntry = UnregisteredInstallationEntry | InProgressInstallationEntry | RegisteredInstallationEntry;
|