@firebase/installations 0.5.16 → 0.6.0
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/CHANGELOG.md +12 -0
- package/dist/esm/index.esm.js +49 -49
- package/dist/esm/index.esm.js.map +1 -1
- package/dist/esm/index.esm2017.js +42 -42
- package/dist/esm/index.esm2017.js.map +1 -1
- package/dist/index.cjs.js +49 -49
- package/dist/index.cjs.js.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @firebase/installations
|
|
2
2
|
|
|
3
|
+
## 0.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`1625f7a95`](https://github.com/firebase/firebase-js-sdk/commit/1625f7a95cc3ffb666845db0a8044329be74b5be) [#6799](https://github.com/firebase/firebase-js-sdk/pull/6799) - Update TypeScript version to 4.7.4.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`c20633ed3`](https://github.com/firebase/firebase-js-sdk/commit/c20633ed35056cbadc9d65d9ceddf4e28d1ea666), [`1625f7a95`](https://github.com/firebase/firebase-js-sdk/commit/1625f7a95cc3ffb666845db0a8044329be74b5be)]:
|
|
12
|
+
- @firebase/util@1.8.0
|
|
13
|
+
- @firebase/component@0.6.0
|
|
14
|
+
|
|
3
15
|
## 0.5.16
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/esm/index.esm.js
CHANGED
|
@@ -5,7 +5,7 @@ import { ErrorFactory, FirebaseError } from '@firebase/util';
|
|
|
5
5
|
import { openDB } from 'idb';
|
|
6
6
|
|
|
7
7
|
var name = "@firebase/installations";
|
|
8
|
-
var version = "0.
|
|
8
|
+
var version = "0.6.0";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* @license
|
|
@@ -24,7 +24,7 @@ var version = "0.5.16";
|
|
|
24
24
|
* limitations under the License.
|
|
25
25
|
*/
|
|
26
26
|
var PENDING_TIMEOUT_MS = 10000;
|
|
27
|
-
var PACKAGE_VERSION = "w:"
|
|
27
|
+
var PACKAGE_VERSION = "w:".concat(version);
|
|
28
28
|
var INTERNAL_AUTH_VERSION = 'FIS_v2';
|
|
29
29
|
var INSTALLATIONS_API_URL = 'https://firebaseinstallations.googleapis.com/v1';
|
|
30
30
|
var TOKEN_EXPIRATION_BUFFER = 60 * 60 * 1000; // One hour
|
|
@@ -49,18 +49,18 @@ var SERVICE_NAME = 'Installations';
|
|
|
49
49
|
*/
|
|
50
50
|
var _a;
|
|
51
51
|
var ERROR_DESCRIPTION_MAP = (_a = {},
|
|
52
|
-
_a["missing-app-config-values" /* MISSING_APP_CONFIG_VALUES */] = 'Missing App configuration value: "{$valueName}"',
|
|
53
|
-
_a["not-registered" /* NOT_REGISTERED */] = 'Firebase Installation is not registered.',
|
|
54
|
-
_a["installation-not-found" /* INSTALLATION_NOT_FOUND */] = 'Firebase Installation not found.',
|
|
55
|
-
_a["request-failed" /* REQUEST_FAILED */] = '{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',
|
|
56
|
-
_a["app-offline" /* APP_OFFLINE */] = 'Could not process request. Application offline.',
|
|
57
|
-
_a["delete-pending-registration" /* DELETE_PENDING_REGISTRATION */] = "Can't delete installation while there is a pending registration request.",
|
|
52
|
+
_a["missing-app-config-values" /* ErrorCode.MISSING_APP_CONFIG_VALUES */] = 'Missing App configuration value: "{$valueName}"',
|
|
53
|
+
_a["not-registered" /* ErrorCode.NOT_REGISTERED */] = 'Firebase Installation is not registered.',
|
|
54
|
+
_a["installation-not-found" /* ErrorCode.INSTALLATION_NOT_FOUND */] = 'Firebase Installation not found.',
|
|
55
|
+
_a["request-failed" /* ErrorCode.REQUEST_FAILED */] = '{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',
|
|
56
|
+
_a["app-offline" /* ErrorCode.APP_OFFLINE */] = 'Could not process request. Application offline.',
|
|
57
|
+
_a["delete-pending-registration" /* ErrorCode.DELETE_PENDING_REGISTRATION */] = "Can't delete installation while there is a pending registration request.",
|
|
58
58
|
_a);
|
|
59
59
|
var ERROR_FACTORY = new ErrorFactory(SERVICE, SERVICE_NAME, ERROR_DESCRIPTION_MAP);
|
|
60
60
|
/** Returns true if error is a FirebaseError that is based on an error from the server. */
|
|
61
61
|
function isServerError(error) {
|
|
62
62
|
return (error instanceof FirebaseError &&
|
|
63
|
-
error.code.includes("request-failed" /* REQUEST_FAILED */));
|
|
63
|
+
error.code.includes("request-failed" /* ErrorCode.REQUEST_FAILED */));
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
/**
|
|
@@ -81,12 +81,12 @@ function isServerError(error) {
|
|
|
81
81
|
*/
|
|
82
82
|
function getInstallationsEndpoint(_a) {
|
|
83
83
|
var projectId = _a.projectId;
|
|
84
|
-
return INSTALLATIONS_API_URL
|
|
84
|
+
return "".concat(INSTALLATIONS_API_URL, "/projects/").concat(projectId, "/installations");
|
|
85
85
|
}
|
|
86
86
|
function extractAuthTokenInfoFromResponse(response) {
|
|
87
87
|
return {
|
|
88
88
|
token: response.token,
|
|
89
|
-
requestStatus: 2 /* COMPLETED */,
|
|
89
|
+
requestStatus: 2 /* RequestStatus.COMPLETED */,
|
|
90
90
|
expiresIn: getExpiresInFromResponseExpiresIn(response.expiresIn),
|
|
91
91
|
creationTime: Date.now()
|
|
92
92
|
};
|
|
@@ -100,7 +100,7 @@ function getErrorFromResponse(requestName, response) {
|
|
|
100
100
|
case 1:
|
|
101
101
|
responseJson = _a.sent();
|
|
102
102
|
errorData = responseJson.error;
|
|
103
|
-
return [2 /*return*/, ERROR_FACTORY.create("request-failed" /* REQUEST_FAILED */, {
|
|
103
|
+
return [2 /*return*/, ERROR_FACTORY.create("request-failed" /* ErrorCode.REQUEST_FAILED */, {
|
|
104
104
|
requestName: requestName,
|
|
105
105
|
serverCode: errorData.code,
|
|
106
106
|
serverMessage: errorData.message,
|
|
@@ -151,7 +151,7 @@ function getExpiresInFromResponseExpiresIn(responseExpiresIn) {
|
|
|
151
151
|
return Number(responseExpiresIn.replace('s', '000'));
|
|
152
152
|
}
|
|
153
153
|
function getAuthorizationHeader(refreshToken) {
|
|
154
|
-
return INTERNAL_AUTH_VERSION
|
|
154
|
+
return "".concat(INTERNAL_AUTH_VERSION, " ").concat(refreshToken);
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
/**
|
|
@@ -212,7 +212,7 @@ function createInstallationRequest(_a, _b) {
|
|
|
212
212
|
responseValue = _c.sent();
|
|
213
213
|
registeredInstallationEntry = {
|
|
214
214
|
fid: responseValue.fid || fid,
|
|
215
|
-
registrationStatus: 2 /* COMPLETED */,
|
|
215
|
+
registrationStatus: 2 /* RequestStatus.COMPLETED */,
|
|
216
216
|
refreshToken: responseValue.refreshToken,
|
|
217
217
|
authToken: extractAuthTokenInfoFromResponse(responseValue.authToken)
|
|
218
218
|
};
|
|
@@ -264,7 +264,7 @@ function sleep(ms) {
|
|
|
264
264
|
* limitations under the License.
|
|
265
265
|
*/
|
|
266
266
|
function bufferToBase64UrlSafe(array) {
|
|
267
|
-
var b64 = btoa(String.fromCharCode.apply(String, __spreadArray([], __read(array))));
|
|
267
|
+
var b64 = btoa(String.fromCharCode.apply(String, __spreadArray([], __read(array), false)));
|
|
268
268
|
return b64.replace(/\+/g, '-').replace(/\//g, '_');
|
|
269
269
|
}
|
|
270
270
|
|
|
@@ -333,7 +333,7 @@ function encode(fidByteArray) {
|
|
|
333
333
|
*/
|
|
334
334
|
/** Returns a string key that can be used to identify the app. */
|
|
335
335
|
function getKey(appConfig) {
|
|
336
|
-
return appConfig.appName
|
|
336
|
+
return "".concat(appConfig.appName, "!").concat(appConfig.appId);
|
|
337
337
|
}
|
|
338
338
|
|
|
339
339
|
/**
|
|
@@ -621,7 +621,7 @@ function getInstallationEntry(installations) {
|
|
|
621
621
|
function updateOrCreateInstallationEntry(oldEntry) {
|
|
622
622
|
var entry = oldEntry || {
|
|
623
623
|
fid: generateFid(),
|
|
624
|
-
registrationStatus: 0 /* NOT_STARTED */
|
|
624
|
+
registrationStatus: 0 /* RequestStatus.NOT_STARTED */
|
|
625
625
|
};
|
|
626
626
|
return clearTimedOutRequest(entry);
|
|
627
627
|
}
|
|
@@ -633,10 +633,10 @@ function updateOrCreateInstallationEntry(oldEntry) {
|
|
|
633
633
|
* to be registered.
|
|
634
634
|
*/
|
|
635
635
|
function triggerRegistrationIfNecessary(installations, installationEntry) {
|
|
636
|
-
if (installationEntry.registrationStatus === 0 /* NOT_STARTED */) {
|
|
636
|
+
if (installationEntry.registrationStatus === 0 /* RequestStatus.NOT_STARTED */) {
|
|
637
637
|
if (!navigator.onLine) {
|
|
638
638
|
// Registration required but app is offline.
|
|
639
|
-
var registrationPromiseWithError = Promise.reject(ERROR_FACTORY.create("app-offline" /* APP_OFFLINE */));
|
|
639
|
+
var registrationPromiseWithError = Promise.reject(ERROR_FACTORY.create("app-offline" /* ErrorCode.APP_OFFLINE */));
|
|
640
640
|
return {
|
|
641
641
|
installationEntry: installationEntry,
|
|
642
642
|
registrationPromise: registrationPromiseWithError
|
|
@@ -645,13 +645,13 @@ function triggerRegistrationIfNecessary(installations, installationEntry) {
|
|
|
645
645
|
// Try registering. Change status to IN_PROGRESS.
|
|
646
646
|
var inProgressEntry = {
|
|
647
647
|
fid: installationEntry.fid,
|
|
648
|
-
registrationStatus: 1 /* IN_PROGRESS */,
|
|
648
|
+
registrationStatus: 1 /* RequestStatus.IN_PROGRESS */,
|
|
649
649
|
registrationTime: Date.now()
|
|
650
650
|
};
|
|
651
651
|
var registrationPromise = registerInstallation(installations, inProgressEntry);
|
|
652
652
|
return { installationEntry: inProgressEntry, registrationPromise: registrationPromise };
|
|
653
653
|
}
|
|
654
|
-
else if (installationEntry.registrationStatus === 1 /* IN_PROGRESS */) {
|
|
654
|
+
else if (installationEntry.registrationStatus === 1 /* RequestStatus.IN_PROGRESS */) {
|
|
655
655
|
return {
|
|
656
656
|
installationEntry: installationEntry,
|
|
657
657
|
registrationPromise: waitUntilFidRegistration(installations)
|
|
@@ -688,7 +688,7 @@ function registerInstallation(installations, installationEntry) {
|
|
|
688
688
|
// Registration failed. Set FID as not registered.
|
|
689
689
|
return [4 /*yield*/, set(installations.appConfig, {
|
|
690
690
|
fid: installationEntry.fid,
|
|
691
|
-
registrationStatus: 0 /* NOT_STARTED */
|
|
691
|
+
registrationStatus: 0 /* RequestStatus.NOT_STARTED */
|
|
692
692
|
})];
|
|
693
693
|
case 5:
|
|
694
694
|
// Registration failed. Set FID as not registered.
|
|
@@ -711,7 +711,7 @@ function waitUntilFidRegistration(installations) {
|
|
|
711
711
|
entry = _b.sent();
|
|
712
712
|
_b.label = 2;
|
|
713
713
|
case 2:
|
|
714
|
-
if (!(entry.registrationStatus === 1 /* IN_PROGRESS */)) return [3 /*break*/, 5];
|
|
714
|
+
if (!(entry.registrationStatus === 1 /* RequestStatus.IN_PROGRESS */)) return [3 /*break*/, 5];
|
|
715
715
|
// createInstallation request still in progress.
|
|
716
716
|
return [4 /*yield*/, sleep(100)];
|
|
717
717
|
case 3:
|
|
@@ -722,7 +722,7 @@ function waitUntilFidRegistration(installations) {
|
|
|
722
722
|
entry = _b.sent();
|
|
723
723
|
return [3 /*break*/, 2];
|
|
724
724
|
case 5:
|
|
725
|
-
if (!(entry.registrationStatus === 0 /* NOT_STARTED */)) return [3 /*break*/, 7];
|
|
725
|
+
if (!(entry.registrationStatus === 0 /* RequestStatus.NOT_STARTED */)) return [3 /*break*/, 7];
|
|
726
726
|
return [4 /*yield*/, getInstallationEntry(installations)];
|
|
727
727
|
case 6:
|
|
728
728
|
_a = _b.sent(), installationEntry = _a.installationEntry, registrationPromise = _a.registrationPromise;
|
|
@@ -749,7 +749,7 @@ function waitUntilFidRegistration(installations) {
|
|
|
749
749
|
function updateInstallationRequest(appConfig) {
|
|
750
750
|
return update(appConfig, function (oldEntry) {
|
|
751
751
|
if (!oldEntry) {
|
|
752
|
-
throw ERROR_FACTORY.create("installation-not-found" /* INSTALLATION_NOT_FOUND */);
|
|
752
|
+
throw ERROR_FACTORY.create("installation-not-found" /* ErrorCode.INSTALLATION_NOT_FOUND */);
|
|
753
753
|
}
|
|
754
754
|
return clearTimedOutRequest(oldEntry);
|
|
755
755
|
});
|
|
@@ -758,13 +758,13 @@ function clearTimedOutRequest(entry) {
|
|
|
758
758
|
if (hasInstallationRequestTimedOut(entry)) {
|
|
759
759
|
return {
|
|
760
760
|
fid: entry.fid,
|
|
761
|
-
registrationStatus: 0 /* NOT_STARTED */
|
|
761
|
+
registrationStatus: 0 /* RequestStatus.NOT_STARTED */
|
|
762
762
|
};
|
|
763
763
|
}
|
|
764
764
|
return entry;
|
|
765
765
|
}
|
|
766
766
|
function hasInstallationRequestTimedOut(installationEntry) {
|
|
767
|
-
return (installationEntry.registrationStatus === 1 /* IN_PROGRESS */ &&
|
|
767
|
+
return (installationEntry.registrationStatus === 1 /* RequestStatus.IN_PROGRESS */ &&
|
|
768
768
|
installationEntry.registrationTime + PENDING_TIMEOUT_MS < Date.now());
|
|
769
769
|
}
|
|
770
770
|
|
|
@@ -833,7 +833,7 @@ function generateAuthTokenRequest(_a, installationEntry) {
|
|
|
833
833
|
}
|
|
834
834
|
function getGenerateAuthTokenEndpoint(appConfig, _a) {
|
|
835
835
|
var fid = _a.fid;
|
|
836
|
-
return getInstallationsEndpoint(appConfig)
|
|
836
|
+
return "".concat(getInstallationsEndpoint(appConfig), "/").concat(fid, "/authTokens:generate");
|
|
837
837
|
}
|
|
838
838
|
|
|
839
839
|
/**
|
|
@@ -866,14 +866,14 @@ function refreshAuthToken(installations, forceRefresh) {
|
|
|
866
866
|
switch (_b.label) {
|
|
867
867
|
case 0: return [4 /*yield*/, update(installations.appConfig, function (oldEntry) {
|
|
868
868
|
if (!isEntryRegistered(oldEntry)) {
|
|
869
|
-
throw ERROR_FACTORY.create("not-registered" /* NOT_REGISTERED */);
|
|
869
|
+
throw ERROR_FACTORY.create("not-registered" /* ErrorCode.NOT_REGISTERED */);
|
|
870
870
|
}
|
|
871
871
|
var oldAuthToken = oldEntry.authToken;
|
|
872
872
|
if (!forceRefresh && isAuthTokenValid(oldAuthToken)) {
|
|
873
873
|
// There is a valid token in the DB.
|
|
874
874
|
return oldEntry;
|
|
875
875
|
}
|
|
876
|
-
else if (oldAuthToken.requestStatus === 1 /* IN_PROGRESS */) {
|
|
876
|
+
else if (oldAuthToken.requestStatus === 1 /* RequestStatus.IN_PROGRESS */) {
|
|
877
877
|
// There already is a token request in progress.
|
|
878
878
|
tokenPromise = waitUntilAuthTokenRequest(installations, forceRefresh);
|
|
879
879
|
return oldEntry;
|
|
@@ -881,7 +881,7 @@ function refreshAuthToken(installations, forceRefresh) {
|
|
|
881
881
|
else {
|
|
882
882
|
// No token or token expired.
|
|
883
883
|
if (!navigator.onLine) {
|
|
884
|
-
throw ERROR_FACTORY.create("app-offline" /* APP_OFFLINE */);
|
|
884
|
+
throw ERROR_FACTORY.create("app-offline" /* ErrorCode.APP_OFFLINE */);
|
|
885
885
|
}
|
|
886
886
|
var inProgressEntry = makeAuthTokenRequestInProgressEntry(oldEntry);
|
|
887
887
|
tokenPromise = fetchAuthTokenFromServer(installations, inProgressEntry);
|
|
@@ -921,7 +921,7 @@ function waitUntilAuthTokenRequest(installations, forceRefresh) {
|
|
|
921
921
|
entry = _a.sent();
|
|
922
922
|
_a.label = 2;
|
|
923
923
|
case 2:
|
|
924
|
-
if (!(entry.authToken.requestStatus === 1 /* IN_PROGRESS */)) return [3 /*break*/, 5];
|
|
924
|
+
if (!(entry.authToken.requestStatus === 1 /* RequestStatus.IN_PROGRESS */)) return [3 /*break*/, 5];
|
|
925
925
|
// generateAuthToken still in progress.
|
|
926
926
|
return [4 /*yield*/, sleep(100)];
|
|
927
927
|
case 3:
|
|
@@ -933,7 +933,7 @@ function waitUntilAuthTokenRequest(installations, forceRefresh) {
|
|
|
933
933
|
return [3 /*break*/, 2];
|
|
934
934
|
case 5:
|
|
935
935
|
authToken = entry.authToken;
|
|
936
|
-
if (authToken.requestStatus === 0 /* NOT_STARTED */) {
|
|
936
|
+
if (authToken.requestStatus === 0 /* RequestStatus.NOT_STARTED */) {
|
|
937
937
|
// The request timed out or failed in a different call. Try again.
|
|
938
938
|
return [2 /*return*/, refreshAuthToken(installations, forceRefresh)];
|
|
939
939
|
}
|
|
@@ -955,11 +955,11 @@ function waitUntilAuthTokenRequest(installations, forceRefresh) {
|
|
|
955
955
|
function updateAuthTokenRequest(appConfig) {
|
|
956
956
|
return update(appConfig, function (oldEntry) {
|
|
957
957
|
if (!isEntryRegistered(oldEntry)) {
|
|
958
|
-
throw ERROR_FACTORY.create("not-registered" /* NOT_REGISTERED */);
|
|
958
|
+
throw ERROR_FACTORY.create("not-registered" /* ErrorCode.NOT_REGISTERED */);
|
|
959
959
|
}
|
|
960
960
|
var oldAuthToken = oldEntry.authToken;
|
|
961
961
|
if (hasAuthTokenRequestTimedOut(oldAuthToken)) {
|
|
962
|
-
return __assign(__assign({}, oldEntry), { authToken: { requestStatus: 0 /* NOT_STARTED */ } });
|
|
962
|
+
return __assign(__assign({}, oldEntry), { authToken: { requestStatus: 0 /* RequestStatus.NOT_STARTED */ } });
|
|
963
963
|
}
|
|
964
964
|
return oldEntry;
|
|
965
965
|
});
|
|
@@ -992,7 +992,7 @@ function fetchAuthTokenFromServer(installations, installationEntry) {
|
|
|
992
992
|
_a.sent();
|
|
993
993
|
return [3 /*break*/, 7];
|
|
994
994
|
case 5:
|
|
995
|
-
updatedInstallationEntry = __assign(__assign({}, installationEntry), { authToken: { requestStatus: 0 /* NOT_STARTED */ } });
|
|
995
|
+
updatedInstallationEntry = __assign(__assign({}, installationEntry), { authToken: { requestStatus: 0 /* RequestStatus.NOT_STARTED */ } });
|
|
996
996
|
return [4 /*yield*/, set(installations.appConfig, updatedInstallationEntry)];
|
|
997
997
|
case 6:
|
|
998
998
|
_a.sent();
|
|
@@ -1005,10 +1005,10 @@ function fetchAuthTokenFromServer(installations, installationEntry) {
|
|
|
1005
1005
|
}
|
|
1006
1006
|
function isEntryRegistered(installationEntry) {
|
|
1007
1007
|
return (installationEntry !== undefined &&
|
|
1008
|
-
installationEntry.registrationStatus === 2 /* COMPLETED */);
|
|
1008
|
+
installationEntry.registrationStatus === 2 /* RequestStatus.COMPLETED */);
|
|
1009
1009
|
}
|
|
1010
1010
|
function isAuthTokenValid(authToken) {
|
|
1011
|
-
return (authToken.requestStatus === 2 /* COMPLETED */ &&
|
|
1011
|
+
return (authToken.requestStatus === 2 /* RequestStatus.COMPLETED */ &&
|
|
1012
1012
|
!isAuthTokenExpired(authToken));
|
|
1013
1013
|
}
|
|
1014
1014
|
function isAuthTokenExpired(authToken) {
|
|
@@ -1019,13 +1019,13 @@ function isAuthTokenExpired(authToken) {
|
|
|
1019
1019
|
/** Returns an updated InstallationEntry with an InProgressAuthToken. */
|
|
1020
1020
|
function makeAuthTokenRequestInProgressEntry(oldEntry) {
|
|
1021
1021
|
var inProgressAuthToken = {
|
|
1022
|
-
requestStatus: 1 /* IN_PROGRESS */,
|
|
1022
|
+
requestStatus: 1 /* RequestStatus.IN_PROGRESS */,
|
|
1023
1023
|
requestTime: Date.now()
|
|
1024
1024
|
};
|
|
1025
1025
|
return __assign(__assign({}, oldEntry), { authToken: inProgressAuthToken });
|
|
1026
1026
|
}
|
|
1027
1027
|
function hasAuthTokenRequestTimedOut(authToken) {
|
|
1028
|
-
return (authToken.requestStatus === 1 /* IN_PROGRESS */ &&
|
|
1028
|
+
return (authToken.requestStatus === 1 /* RequestStatus.IN_PROGRESS */ &&
|
|
1029
1029
|
authToken.requestTime + PENDING_TIMEOUT_MS < Date.now());
|
|
1030
1030
|
}
|
|
1031
1031
|
|
|
@@ -1181,7 +1181,7 @@ function deleteInstallationRequest(appConfig, installationEntry) {
|
|
|
1181
1181
|
}
|
|
1182
1182
|
function getDeleteEndpoint(appConfig, _a) {
|
|
1183
1183
|
var fid = _a.fid;
|
|
1184
|
-
return getInstallationsEndpoint(appConfig)
|
|
1184
|
+
return "".concat(getInstallationsEndpoint(appConfig), "/").concat(fid);
|
|
1185
1185
|
}
|
|
1186
1186
|
|
|
1187
1187
|
/**
|
|
@@ -1214,7 +1214,7 @@ function deleteInstallations(installations) {
|
|
|
1214
1214
|
case 0:
|
|
1215
1215
|
appConfig = installations.appConfig;
|
|
1216
1216
|
return [4 /*yield*/, update(appConfig, function (oldEntry) {
|
|
1217
|
-
if (oldEntry && oldEntry.registrationStatus === 0 /* NOT_STARTED */) {
|
|
1217
|
+
if (oldEntry && oldEntry.registrationStatus === 0 /* RequestStatus.NOT_STARTED */) {
|
|
1218
1218
|
// Delete the unregistered entry without sending a deleteInstallation request.
|
|
1219
1219
|
return undefined;
|
|
1220
1220
|
}
|
|
@@ -1223,13 +1223,13 @@ function deleteInstallations(installations) {
|
|
|
1223
1223
|
case 1:
|
|
1224
1224
|
entry = _a.sent();
|
|
1225
1225
|
if (!entry) return [3 /*break*/, 6];
|
|
1226
|
-
if (!(entry.registrationStatus === 1 /* IN_PROGRESS */)) return [3 /*break*/, 2];
|
|
1226
|
+
if (!(entry.registrationStatus === 1 /* RequestStatus.IN_PROGRESS */)) return [3 /*break*/, 2];
|
|
1227
1227
|
// Can't delete while trying to register.
|
|
1228
|
-
throw ERROR_FACTORY.create("delete-pending-registration" /* DELETE_PENDING_REGISTRATION */);
|
|
1228
|
+
throw ERROR_FACTORY.create("delete-pending-registration" /* ErrorCode.DELETE_PENDING_REGISTRATION */);
|
|
1229
1229
|
case 2:
|
|
1230
|
-
if (!(entry.registrationStatus === 2 /* COMPLETED */)) return [3 /*break*/, 6];
|
|
1230
|
+
if (!(entry.registrationStatus === 2 /* RequestStatus.COMPLETED */)) return [3 /*break*/, 6];
|
|
1231
1231
|
if (!!navigator.onLine) return [3 /*break*/, 3];
|
|
1232
|
-
throw ERROR_FACTORY.create("app-offline" /* APP_OFFLINE */);
|
|
1232
|
+
throw ERROR_FACTORY.create("app-offline" /* ErrorCode.APP_OFFLINE */);
|
|
1233
1233
|
case 3: return [4 /*yield*/, deleteInstallationRequest(appConfig, entry)];
|
|
1234
1234
|
case 4:
|
|
1235
1235
|
_a.sent();
|
|
@@ -1358,7 +1358,7 @@ function extractAppConfig(app) {
|
|
|
1358
1358
|
};
|
|
1359
1359
|
}
|
|
1360
1360
|
function getMissingValueError(valueName) {
|
|
1361
|
-
return ERROR_FACTORY.create("missing-app-config-values" /* MISSING_APP_CONFIG_VALUES */, {
|
|
1361
|
+
return ERROR_FACTORY.create("missing-app-config-values" /* ErrorCode.MISSING_APP_CONFIG_VALUES */, {
|
|
1362
1362
|
valueName: valueName
|
|
1363
1363
|
});
|
|
1364
1364
|
}
|
|
@@ -1405,8 +1405,8 @@ var internalFactory = function (container) {
|
|
|
1405
1405
|
return installationsInternal;
|
|
1406
1406
|
};
|
|
1407
1407
|
function registerInstallations() {
|
|
1408
|
-
_registerComponent(new Component(INSTALLATIONS_NAME, publicFactory, "PUBLIC" /* PUBLIC */));
|
|
1409
|
-
_registerComponent(new Component(INSTALLATIONS_NAME_INTERNAL, internalFactory, "PRIVATE" /* PRIVATE */));
|
|
1408
|
+
_registerComponent(new Component(INSTALLATIONS_NAME, publicFactory, "PUBLIC" /* ComponentType.PUBLIC */));
|
|
1409
|
+
_registerComponent(new Component(INSTALLATIONS_NAME_INTERNAL, internalFactory, "PRIVATE" /* ComponentType.PRIVATE */));
|
|
1410
1410
|
}
|
|
1411
1411
|
|
|
1412
1412
|
/**
|