firebase-admin 11.11.1 → 12.1.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/README.md +2 -1
- package/lib/app/core.d.ts +1 -1
- package/lib/app/core.js +1 -1
- package/lib/app/credential-factory.d.ts +1 -1
- package/lib/app/credential-factory.js +1 -1
- package/lib/app/credential-internal.d.ts +1 -1
- package/lib/app/credential-internal.js +1 -1
- package/lib/app/credential.d.ts +1 -1
- package/lib/app/credential.js +1 -1
- package/lib/app/firebase-app.d.ts +1 -1
- package/lib/app/firebase-app.js +1 -1
- package/lib/app/firebase-namespace.d.ts +1 -1
- package/lib/app/firebase-namespace.js +1 -1
- package/lib/app/index.d.ts +1 -1
- package/lib/app/index.js +1 -1
- package/lib/app/lifecycle.d.ts +1 -1
- package/lib/app/lifecycle.js +1 -1
- package/lib/app-check/app-check-api-client-internal.d.ts +1 -1
- package/lib/app-check/app-check-api-client-internal.js +1 -1
- package/lib/app-check/app-check-api.d.ts +1 -1
- package/lib/app-check/app-check-api.js +1 -1
- package/lib/app-check/app-check-namespace.d.ts +1 -1
- package/lib/app-check/app-check-namespace.js +1 -1
- package/lib/app-check/app-check.d.ts +1 -1
- package/lib/app-check/app-check.js +1 -1
- package/lib/app-check/index.d.ts +1 -1
- package/lib/app-check/index.js +1 -1
- package/lib/app-check/token-generator.d.ts +1 -1
- package/lib/app-check/token-generator.js +1 -1
- package/lib/app-check/token-verifier.d.ts +1 -1
- package/lib/app-check/token-verifier.js +1 -1
- package/lib/auth/action-code-settings-builder.d.ts +1 -1
- package/lib/auth/action-code-settings-builder.js +1 -1
- package/lib/auth/auth-api-request.d.ts +1 -1
- package/lib/auth/auth-api-request.js +1 -1
- package/lib/auth/auth-config.d.ts +1 -1
- package/lib/auth/auth-config.js +1 -1
- package/lib/auth/auth-namespace.d.ts +1 -1
- package/lib/auth/auth-namespace.js +1 -1
- package/lib/auth/auth.d.ts +1 -1
- package/lib/auth/auth.js +1 -1
- package/lib/auth/base-auth.d.ts +1 -1
- package/lib/auth/base-auth.js +1 -1
- package/lib/auth/identifier.d.ts +1 -1
- package/lib/auth/identifier.js +1 -1
- package/lib/auth/index.d.ts +1 -1
- package/lib/auth/index.js +1 -1
- package/lib/auth/project-config-manager.d.ts +1 -1
- package/lib/auth/project-config-manager.js +1 -1
- package/lib/auth/project-config.d.ts +1 -1
- package/lib/auth/project-config.js +1 -1
- package/lib/auth/tenant-manager.d.ts +1 -1
- package/lib/auth/tenant-manager.js +1 -1
- package/lib/auth/tenant.d.ts +1 -1
- package/lib/auth/tenant.js +1 -1
- package/lib/auth/token-generator.d.ts +1 -1
- package/lib/auth/token-generator.js +1 -1
- package/lib/auth/token-verifier.d.ts +1 -1
- package/lib/auth/token-verifier.js +16 -10
- package/lib/auth/user-import-builder.d.ts +1 -1
- package/lib/auth/user-import-builder.js +1 -1
- package/lib/auth/user-record.d.ts +1 -1
- package/lib/auth/user-record.js +1 -1
- package/lib/credential/index.d.ts +1 -1
- package/lib/credential/index.js +2 -2
- package/lib/database/database-namespace.d.ts +17 -17
- package/lib/database/database-namespace.js +2 -2
- package/lib/database/database.d.ts +3 -3
- package/lib/database/database.js +1 -1
- package/lib/database/index.d.ts +5 -5
- package/lib/database/index.js +5 -5
- package/lib/default-namespace.d.ts +1 -1
- package/lib/default-namespace.js +1 -1
- package/lib/esm/firestore/index.js +3 -0
- package/lib/esm/remote-config/index.js +1 -0
- package/lib/eventarc/cloudevent.d.ts +1 -1
- package/lib/eventarc/cloudevent.js +1 -1
- package/lib/eventarc/eventarc-client-internal.d.ts +1 -1
- package/lib/eventarc/eventarc-client-internal.js +1 -1
- package/lib/eventarc/eventarc-utils.d.ts +1 -1
- package/lib/eventarc/eventarc-utils.js +1 -1
- package/lib/eventarc/eventarc.d.ts +1 -1
- package/lib/eventarc/eventarc.js +1 -1
- package/lib/eventarc/index.d.ts +1 -1
- package/lib/eventarc/index.js +1 -1
- package/lib/extensions/extensions-api-client-internal.d.ts +1 -1
- package/lib/extensions/extensions-api-client-internal.js +1 -1
- package/lib/extensions/extensions-api.d.ts +1 -1
- package/lib/extensions/extensions-api.js +1 -1
- package/lib/extensions/extensions.d.ts +1 -1
- package/lib/extensions/extensions.js +1 -1
- package/lib/extensions/index.d.ts +1 -1
- package/lib/extensions/index.js +1 -1
- package/lib/firebase-namespace-api.d.ts +1 -1
- package/lib/firebase-namespace-api.js +1 -1
- package/lib/firestore/firestore-internal.d.ts +1 -1
- package/lib/firestore/firestore-internal.js +1 -1
- package/lib/firestore/firestore-namespace.d.ts +8 -1
- package/lib/firestore/firestore-namespace.js +5 -2
- package/lib/firestore/index.d.ts +2 -2
- package/lib/firestore/index.js +5 -2
- package/lib/functions/functions-api-client-internal.d.ts +1 -1
- package/lib/functions/functions-api-client-internal.js +1 -1
- package/lib/functions/functions-api.d.ts +1 -1
- package/lib/functions/functions-api.js +1 -1
- package/lib/functions/functions.d.ts +1 -1
- package/lib/functions/functions.js +1 -1
- package/lib/functions/index.d.ts +1 -1
- package/lib/functions/index.js +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/installations/index.d.ts +1 -1
- package/lib/installations/index.js +1 -1
- package/lib/installations/installations-namespace.d.ts +1 -1
- package/lib/installations/installations-namespace.js +1 -1
- package/lib/installations/installations-request-handler.d.ts +1 -1
- package/lib/installations/installations-request-handler.js +1 -1
- package/lib/installations/installations.d.ts +1 -1
- package/lib/installations/installations.js +1 -1
- package/lib/instance-id/index.d.ts +1 -1
- package/lib/instance-id/index.js +1 -1
- package/lib/instance-id/instance-id-namespace.d.ts +1 -1
- package/lib/instance-id/instance-id-namespace.js +1 -1
- package/lib/instance-id/instance-id.d.ts +1 -1
- package/lib/instance-id/instance-id.js +1 -1
- package/lib/machine-learning/index.d.ts +2 -2
- package/lib/machine-learning/index.js +1 -1
- package/lib/machine-learning/machine-learning-api-client.d.ts +2 -11
- package/lib/machine-learning/machine-learning-api-client.js +1 -1
- package/lib/machine-learning/machine-learning-namespace.d.ts +2 -8
- package/lib/machine-learning/machine-learning-namespace.js +1 -1
- package/lib/machine-learning/machine-learning-utils.d.ts +1 -1
- package/lib/machine-learning/machine-learning-utils.js +1 -1
- package/lib/machine-learning/machine-learning.d.ts +1 -11
- package/lib/machine-learning/machine-learning.js +3 -5
- package/lib/messaging/batch-request-internal.d.ts +1 -1
- package/lib/messaging/batch-request-internal.js +1 -1
- package/lib/messaging/index.d.ts +1 -1
- package/lib/messaging/index.js +1 -1
- package/lib/messaging/messaging-api-request-internal.d.ts +1 -1
- package/lib/messaging/messaging-api-request-internal.js +1 -1
- package/lib/messaging/messaging-api.d.ts +1 -1
- package/lib/messaging/messaging-api.js +1 -1
- package/lib/messaging/messaging-errors-internal.d.ts +1 -1
- package/lib/messaging/messaging-errors-internal.js +1 -1
- package/lib/messaging/messaging-internal.d.ts +1 -1
- package/lib/messaging/messaging-internal.js +1 -1
- package/lib/messaging/messaging-namespace.d.ts +1 -1
- package/lib/messaging/messaging-namespace.js +1 -1
- package/lib/messaging/messaging.d.ts +1 -1
- package/lib/messaging/messaging.js +2 -2
- package/lib/project-management/android-app.d.ts +1 -1
- package/lib/project-management/android-app.js +1 -1
- package/lib/project-management/app-metadata.d.ts +1 -1
- package/lib/project-management/app-metadata.js +2 -2
- package/lib/project-management/index.d.ts +1 -1
- package/lib/project-management/index.js +1 -1
- package/lib/project-management/ios-app.d.ts +1 -1
- package/lib/project-management/ios-app.js +1 -1
- package/lib/project-management/project-management-api-request-internal.d.ts +1 -1
- package/lib/project-management/project-management-api-request-internal.js +1 -1
- package/lib/project-management/project-management-namespace.d.ts +1 -1
- package/lib/project-management/project-management-namespace.js +1 -1
- package/lib/project-management/project-management.d.ts +1 -1
- package/lib/project-management/project-management.js +1 -1
- package/lib/remote-config/condition-evaluator-internal.d.ts +17 -0
- package/lib/remote-config/condition-evaluator-internal.js +130 -0
- package/lib/remote-config/index.d.ts +2 -2
- package/lib/remote-config/index.js +4 -2
- package/lib/remote-config/internal/value-impl.d.ts +17 -0
- package/lib/remote-config/internal/value-impl.js +59 -0
- package/lib/remote-config/remote-config-api-client-internal.d.ts +1 -1
- package/lib/remote-config/remote-config-api-client-internal.js +41 -3
- package/lib/remote-config/remote-config-api.d.ts +310 -2
- package/lib/remote-config/remote-config-api.js +29 -1
- package/lib/remote-config/remote-config-namespace.d.ts +1 -1
- package/lib/remote-config/remote-config-namespace.js +1 -1
- package/lib/remote-config/remote-config.d.ts +11 -2
- package/lib/remote-config/remote-config.js +176 -1
- package/lib/security-rules/index.d.ts +1 -1
- package/lib/security-rules/index.js +1 -1
- package/lib/security-rules/security-rules-api-client-internal.d.ts +1 -1
- package/lib/security-rules/security-rules-api-client-internal.js +1 -1
- package/lib/security-rules/security-rules-internal.d.ts +1 -1
- package/lib/security-rules/security-rules-internal.js +1 -1
- package/lib/security-rules/security-rules-namespace.d.ts +1 -1
- package/lib/security-rules/security-rules-namespace.js +1 -1
- package/lib/security-rules/security-rules.d.ts +1 -1
- package/lib/security-rules/security-rules.js +1 -1
- package/lib/storage/index.d.ts +1 -1
- package/lib/storage/index.js +1 -1
- package/lib/storage/storage-namespace.d.ts +1 -1
- package/lib/storage/storage-namespace.js +1 -1
- package/lib/storage/storage.d.ts +1 -1
- package/lib/storage/storage.js +1 -1
- package/lib/storage/utils.d.ts +1 -1
- package/lib/storage/utils.js +1 -1
- package/lib/utils/api-request.d.ts +1 -1
- package/lib/utils/api-request.js +1 -1
- package/lib/utils/crypto-signer.d.ts +1 -1
- package/lib/utils/crypto-signer.js +1 -1
- package/lib/utils/deep-copy.d.ts +1 -1
- package/lib/utils/deep-copy.js +1 -1
- package/lib/utils/error.d.ts +1 -1
- package/lib/utils/error.js +1 -1
- package/lib/utils/index.d.ts +1 -1
- package/lib/utils/index.js +1 -1
- package/lib/utils/jwt.d.ts +1 -1
- package/lib/utils/jwt.js +2 -2
- package/lib/utils/validator.d.ts +1 -1
- package/lib/utils/validator.js +1 -1
- package/package.json +16 -14
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v12.1.0 */
|
|
2
2
|
/*!
|
|
3
3
|
* Copyright 2020 Google Inc.
|
|
4
4
|
*
|
|
@@ -28,22 +28,12 @@ export interface ListModelsResult {
|
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
30
|
* A TensorFlow Lite Model output object
|
|
31
|
-
*
|
|
32
|
-
* One of either the `gcsTfliteUri` or `automlModel` properties will be
|
|
33
|
-
* defined.
|
|
34
31
|
*/
|
|
35
32
|
export interface TFLiteModel {
|
|
36
33
|
/** The size of the model. */
|
|
37
34
|
readonly sizeBytes: number;
|
|
38
35
|
/** The URI from which the model was originally provided to Firebase. */
|
|
39
36
|
readonly gcsTfliteUri?: string;
|
|
40
|
-
/**
|
|
41
|
-
* The AutoML model reference from which the model was originally provided
|
|
42
|
-
* to Firebase.
|
|
43
|
-
*
|
|
44
|
-
* @deprecated AutoML model support will be removed in the next major version.
|
|
45
|
-
*/
|
|
46
|
-
readonly automlModel?: string;
|
|
47
37
|
}
|
|
48
38
|
/**
|
|
49
39
|
* The Firebase `MachineLearning` service interface.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v12.1.0 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* Copyright 2020 Google Inc.
|
|
@@ -317,11 +317,9 @@ class Model {
|
|
|
317
317
|
throw new machine_learning_utils_1.FirebaseMachineLearningError('invalid-server-response', `Invalid Model response: ${JSON.stringify(model)}`);
|
|
318
318
|
}
|
|
319
319
|
const tmpModel = (0, deep_copy_1.deepCopy)(model);
|
|
320
|
-
// If tflite Model is specified, it must have a source
|
|
321
|
-
// oneof {gcsTfliteUri, automlModel}
|
|
320
|
+
// If tflite Model is specified, it must have a source of {gcsTfliteUri}
|
|
322
321
|
if (model.tfliteModel &&
|
|
323
|
-
!validator.isNonEmptyString(model.tfliteModel.gcsTfliteUri)
|
|
324
|
-
!validator.isNonEmptyString(model.tfliteModel.automlModel)) {
|
|
322
|
+
!validator.isNonEmptyString(model.tfliteModel.gcsTfliteUri)) {
|
|
325
323
|
// If we have some other source, ignore the whole tfliteModel.
|
|
326
324
|
delete tmpModel.tfliteModel;
|
|
327
325
|
}
|
package/lib/messaging/index.d.ts
CHANGED
package/lib/messaging/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v12.1.0 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* @license
|
|
@@ -235,7 +235,7 @@ class Messaging {
|
|
|
235
235
|
}
|
|
236
236
|
return this.getUrlPath()
|
|
237
237
|
.then((urlPath) => {
|
|
238
|
-
const requests = copy.map((message) => {
|
|
238
|
+
const requests = copy.map(async (message) => {
|
|
239
239
|
(0, messaging_internal_1.validateMessage)(message);
|
|
240
240
|
const request = { message };
|
|
241
241
|
if (dryRun) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v12.1.0 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* Copyright 2021 Google Inc.
|
|
@@ -34,4 +34,4 @@ var AppPlatform;
|
|
|
34
34
|
* The Firebase App is associated with Android.
|
|
35
35
|
*/
|
|
36
36
|
AppPlatform["ANDROID"] = "ANDROID";
|
|
37
|
-
})(AppPlatform
|
|
37
|
+
})(AppPlatform || (exports.AppPlatform = AppPlatform = {}));
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*! firebase-admin v12.1.0 */
|
|
2
|
+
/*!
|
|
3
|
+
* Copyright 2024 Google Inc.
|
|
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 {};
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/*! firebase-admin v12.1.0 */
|
|
2
|
+
/*!
|
|
3
|
+
* Copyright 2024 Google Inc.
|
|
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
|
+
'use strict';
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.ConditionEvaluator = void 0;
|
|
20
|
+
const remote_config_api_1 = require("./remote-config-api");
|
|
21
|
+
const farmhash = require("farmhash");
|
|
22
|
+
const long = require("long");
|
|
23
|
+
/**
|
|
24
|
+
* Encapsulates condition evaluation logic to simplify organization and
|
|
25
|
+
* facilitate testing.
|
|
26
|
+
*
|
|
27
|
+
* @internal
|
|
28
|
+
*/
|
|
29
|
+
class ConditionEvaluator {
|
|
30
|
+
evaluateConditions(namedConditions, context) {
|
|
31
|
+
// The order of the conditions is significant.
|
|
32
|
+
// A JS Map preserves the order of insertion ("Iteration happens in insertion order"
|
|
33
|
+
// - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map#description).
|
|
34
|
+
const evaluatedConditions = new Map();
|
|
35
|
+
for (const namedCondition of namedConditions) {
|
|
36
|
+
evaluatedConditions.set(namedCondition.name, this.evaluateCondition(namedCondition.condition, context));
|
|
37
|
+
}
|
|
38
|
+
return evaluatedConditions;
|
|
39
|
+
}
|
|
40
|
+
evaluateCondition(condition, context, nestingLevel = 0) {
|
|
41
|
+
if (nestingLevel >= ConditionEvaluator.MAX_CONDITION_RECURSION_DEPTH) {
|
|
42
|
+
// TODO: add logging once we have a wrapped logger.
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
if (condition.orCondition) {
|
|
46
|
+
return this.evaluateOrCondition(condition.orCondition, context, nestingLevel + 1);
|
|
47
|
+
}
|
|
48
|
+
if (condition.andCondition) {
|
|
49
|
+
return this.evaluateAndCondition(condition.andCondition, context, nestingLevel + 1);
|
|
50
|
+
}
|
|
51
|
+
if (condition.true) {
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
if (condition.false) {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
if (condition.percent) {
|
|
58
|
+
return this.evaluatePercentCondition(condition.percent, context);
|
|
59
|
+
}
|
|
60
|
+
// TODO: add logging once we have a wrapped logger.
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
evaluateOrCondition(orCondition, context, nestingLevel) {
|
|
64
|
+
const subConditions = orCondition.conditions || [];
|
|
65
|
+
for (const subCondition of subConditions) {
|
|
66
|
+
// Recursive call.
|
|
67
|
+
const result = this.evaluateCondition(subCondition, context, nestingLevel + 1);
|
|
68
|
+
// Short-circuit the evaluation result for true.
|
|
69
|
+
if (result) {
|
|
70
|
+
return result;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
evaluateAndCondition(andCondition, context, nestingLevel) {
|
|
76
|
+
const subConditions = andCondition.conditions || [];
|
|
77
|
+
for (const subCondition of subConditions) {
|
|
78
|
+
// Recursive call.
|
|
79
|
+
const result = this.evaluateCondition(subCondition, context, nestingLevel + 1);
|
|
80
|
+
// Short-circuit the evaluation result for false.
|
|
81
|
+
if (!result) {
|
|
82
|
+
return result;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
evaluatePercentCondition(percentCondition, context) {
|
|
88
|
+
if (!context.randomizationId) {
|
|
89
|
+
// TODO: add logging once we have a wrapped logger.
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
// This is the entry point for processing percent condition data from the response.
|
|
93
|
+
// We're not using a proto library, so we can't assume undefined fields have
|
|
94
|
+
// default values.
|
|
95
|
+
const { seed, percentOperator, microPercent, microPercentRange } = percentCondition;
|
|
96
|
+
if (!percentOperator) {
|
|
97
|
+
// TODO: add logging once we have a wrapped logger.
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
const normalizedMicroPercent = microPercent || 0;
|
|
101
|
+
const normalizedMicroPercentUpperBound = microPercentRange?.microPercentUpperBound || 0;
|
|
102
|
+
const normalizedMicroPercentLowerBound = microPercentRange?.microPercentLowerBound || 0;
|
|
103
|
+
const seedPrefix = seed && seed.length > 0 ? `${seed}.` : '';
|
|
104
|
+
const stringToHash = `${seedPrefix}${context.randomizationId}`;
|
|
105
|
+
// Using a 64-bit long for consistency with the Remote Config fetch endpoint.
|
|
106
|
+
let hash64 = long.fromString(farmhash.fingerprint64(stringToHash));
|
|
107
|
+
// Negate the hash if its value is less than 0. We handle this manually because the
|
|
108
|
+
// Long library doesn't provided an absolute value method.
|
|
109
|
+
if (hash64.lt(0)) {
|
|
110
|
+
hash64 = hash64.negate();
|
|
111
|
+
}
|
|
112
|
+
const instanceMicroPercentile = hash64.mod(100 * 1000000);
|
|
113
|
+
switch (percentOperator) {
|
|
114
|
+
case remote_config_api_1.PercentConditionOperator.LESS_OR_EQUAL:
|
|
115
|
+
return instanceMicroPercentile.lte(normalizedMicroPercent);
|
|
116
|
+
case remote_config_api_1.PercentConditionOperator.GREATER_THAN:
|
|
117
|
+
return instanceMicroPercentile.gt(normalizedMicroPercent);
|
|
118
|
+
case remote_config_api_1.PercentConditionOperator.BETWEEN:
|
|
119
|
+
return instanceMicroPercentile.gt(normalizedMicroPercentLowerBound)
|
|
120
|
+
&& instanceMicroPercentile.lte(normalizedMicroPercentUpperBound);
|
|
121
|
+
case remote_config_api_1.PercentConditionOperator.UNKNOWN:
|
|
122
|
+
default:
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
125
|
+
// TODO: add logging once we have a wrapped logger.
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
exports.ConditionEvaluator = ConditionEvaluator;
|
|
130
|
+
ConditionEvaluator.MAX_CONDITION_RECURSION_DEPTH = 10;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v12.1.0 */
|
|
2
2
|
/*!
|
|
3
3
|
* Copyright 2020 Google Inc.
|
|
4
4
|
*
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
*/
|
|
22
22
|
import { App } from '../app';
|
|
23
23
|
import { RemoteConfig } from './remote-config';
|
|
24
|
-
export { ExplicitParameterValue, InAppDefaultValue, ListVersionsOptions, ListVersionsResult, ParameterValueType, RemoteConfigCondition, RemoteConfigParameter, RemoteConfigParameterGroup, RemoteConfigParameterValue, RemoteConfigTemplate, RemoteConfigUser, TagColor, Version, } from './remote-config-api';
|
|
24
|
+
export { AndCondition, DefaultConfig, EvaluationContext, ExplicitParameterValue, GetServerTemplateOptions, InAppDefaultValue, InitServerTemplateOptions, ListVersionsOptions, ListVersionsResult, MicroPercentRange, NamedCondition, OneOfCondition, OrCondition, ParameterValueType, PercentConditionOperator, PercentCondition, RemoteConfigCondition, RemoteConfigParameter, RemoteConfigParameterGroup, RemoteConfigParameterValue, RemoteConfigTemplate, RemoteConfigUser, ServerConfig, ServerTemplate, ServerTemplateData, ServerTemplateDataType, TagColor, Value, ValueSource, Version, } from './remote-config-api';
|
|
25
25
|
export { RemoteConfig } from './remote-config';
|
|
26
26
|
/**
|
|
27
27
|
* Gets the {@link RemoteConfig} service for the default app or a given app.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v12.1.0 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* Copyright 2020 Google Inc.
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.getRemoteConfig = exports.RemoteConfig = void 0;
|
|
19
|
+
exports.getRemoteConfig = exports.RemoteConfig = exports.PercentConditionOperator = void 0;
|
|
20
20
|
/**
|
|
21
21
|
* Firebase Remote Config.
|
|
22
22
|
*
|
|
@@ -24,6 +24,8 @@ exports.getRemoteConfig = exports.RemoteConfig = void 0;
|
|
|
24
24
|
*/
|
|
25
25
|
const app_1 = require("../app");
|
|
26
26
|
const remote_config_1 = require("./remote-config");
|
|
27
|
+
var remote_config_api_1 = require("./remote-config-api");
|
|
28
|
+
Object.defineProperty(exports, "PercentConditionOperator", { enumerable: true, get: function () { return remote_config_api_1.PercentConditionOperator; } });
|
|
27
29
|
var remote_config_2 = require("./remote-config");
|
|
28
30
|
Object.defineProperty(exports, "RemoteConfig", { enumerable: true, get: function () { return remote_config_2.RemoteConfig; } });
|
|
29
31
|
/**
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*! firebase-admin v12.1.0 */
|
|
2
|
+
/*!
|
|
3
|
+
* Copyright 2024 Google Inc.
|
|
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 {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/*! firebase-admin v12.1.0 */
|
|
2
|
+
/*!
|
|
3
|
+
* Copyright 2024 Google Inc.
|
|
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
|
+
'use strict';
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.ValueImpl = void 0;
|
|
20
|
+
/**
|
|
21
|
+
* Implements type-safe getters for parameter values.
|
|
22
|
+
*
|
|
23
|
+
* Visible for testing.
|
|
24
|
+
*
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
27
|
+
class ValueImpl {
|
|
28
|
+
constructor(source, value = ValueImpl.DEFAULT_VALUE_FOR_STRING) {
|
|
29
|
+
this.source = source;
|
|
30
|
+
this.value = value;
|
|
31
|
+
}
|
|
32
|
+
asString() {
|
|
33
|
+
return this.value;
|
|
34
|
+
}
|
|
35
|
+
asBoolean() {
|
|
36
|
+
if (this.source === 'static') {
|
|
37
|
+
return ValueImpl.DEFAULT_VALUE_FOR_BOOLEAN;
|
|
38
|
+
}
|
|
39
|
+
return ValueImpl.BOOLEAN_TRUTHY_VALUES.indexOf(this.value.toLowerCase()) >= 0;
|
|
40
|
+
}
|
|
41
|
+
asNumber() {
|
|
42
|
+
if (this.source === 'static') {
|
|
43
|
+
return ValueImpl.DEFAULT_VALUE_FOR_NUMBER;
|
|
44
|
+
}
|
|
45
|
+
const num = Number(this.value);
|
|
46
|
+
if (isNaN(num)) {
|
|
47
|
+
return ValueImpl.DEFAULT_VALUE_FOR_NUMBER;
|
|
48
|
+
}
|
|
49
|
+
return num;
|
|
50
|
+
}
|
|
51
|
+
getSource() {
|
|
52
|
+
return this.source;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.ValueImpl = ValueImpl;
|
|
56
|
+
ValueImpl.DEFAULT_VALUE_FOR_BOOLEAN = false;
|
|
57
|
+
ValueImpl.DEFAULT_VALUE_FOR_STRING = '';
|
|
58
|
+
ValueImpl.DEFAULT_VALUE_FOR_NUMBER = 0;
|
|
59
|
+
ValueImpl.BOOLEAN_TRUTHY_VALUES = ['1', 'true', 't', 'yes', 'y', 'on'];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v12.1.0 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* Copyright 2020 Google Inc.
|
|
@@ -23,7 +23,11 @@ const utils = require("../utils/index");
|
|
|
23
23
|
const validator = require("../utils/validator");
|
|
24
24
|
const deep_copy_1 = require("../utils/deep-copy");
|
|
25
25
|
// Remote Config backend constants
|
|
26
|
-
|
|
26
|
+
/**
|
|
27
|
+
* Allows the `FIREBASE_REMOTE_CONFIG_URL_BASE` environment
|
|
28
|
+
* variable to override the default API endpoint URL.
|
|
29
|
+
*/
|
|
30
|
+
const FIREBASE_REMOTE_CONFIG_URL_BASE = process.env.FIREBASE_REMOTE_CONFIG_URL_BASE || 'https://firebaseremoteconfig.googleapis.com';
|
|
27
31
|
const FIREBASE_REMOTE_CONFIG_HEADERS = {
|
|
28
32
|
'X-Firebase-Client': `fire-admin-node/${utils.getSdkVersion()}`,
|
|
29
33
|
// There is a known issue in which the ETag is not properly returned in cases where the request
|
|
@@ -151,6 +155,23 @@ class RemoteConfigApiClient {
|
|
|
151
155
|
throw this.toFirebaseError(err);
|
|
152
156
|
});
|
|
153
157
|
}
|
|
158
|
+
getServerTemplate() {
|
|
159
|
+
return this.getUrl()
|
|
160
|
+
.then((url) => {
|
|
161
|
+
const request = {
|
|
162
|
+
method: 'GET',
|
|
163
|
+
url: `${url}/namespaces/firebase-server/serverRemoteConfig`,
|
|
164
|
+
headers: FIREBASE_REMOTE_CONFIG_HEADERS
|
|
165
|
+
};
|
|
166
|
+
return this.httpClient.send(request);
|
|
167
|
+
})
|
|
168
|
+
.then((resp) => {
|
|
169
|
+
return this.toRemoteConfigServerTemplate(resp);
|
|
170
|
+
})
|
|
171
|
+
.catch((err) => {
|
|
172
|
+
throw this.toFirebaseError(err);
|
|
173
|
+
});
|
|
174
|
+
}
|
|
154
175
|
sendPutRequest(template, etag, validateOnly) {
|
|
155
176
|
let path = 'remoteConfig';
|
|
156
177
|
if (validateOnly) {
|
|
@@ -175,7 +196,7 @@ class RemoteConfigApiClient {
|
|
|
175
196
|
getUrl() {
|
|
176
197
|
return this.getProjectIdPrefix()
|
|
177
198
|
.then((projectIdPrefix) => {
|
|
178
|
-
return `${
|
|
199
|
+
return `${FIREBASE_REMOTE_CONFIG_URL_BASE}/v1/${projectIdPrefix}`;
|
|
179
200
|
});
|
|
180
201
|
}
|
|
181
202
|
getProjectIdPrefix() {
|
|
@@ -227,6 +248,23 @@ class RemoteConfigApiClient {
|
|
|
227
248
|
version: resp.data.version,
|
|
228
249
|
};
|
|
229
250
|
}
|
|
251
|
+
/**
|
|
252
|
+
* Creates a RemoteConfigServerTemplate from the API response.
|
|
253
|
+
* If provided, customEtag is used instead of the etag returned in the API response.
|
|
254
|
+
*
|
|
255
|
+
* @param {HttpResponse} resp API response object.
|
|
256
|
+
* @param {string} customEtag A custom etag to replace the etag fom the API response (Optional).
|
|
257
|
+
*/
|
|
258
|
+
toRemoteConfigServerTemplate(resp, customEtag) {
|
|
259
|
+
const etag = (typeof customEtag === 'undefined') ? resp.headers['etag'] : customEtag;
|
|
260
|
+
this.validateEtag(etag);
|
|
261
|
+
return {
|
|
262
|
+
conditions: resp.data.conditions,
|
|
263
|
+
parameters: resp.data.parameters,
|
|
264
|
+
etag,
|
|
265
|
+
version: resp.data.version,
|
|
266
|
+
};
|
|
267
|
+
}
|
|
230
268
|
/**
|
|
231
269
|
* Checks if the given RemoteConfigTemplate object is valid.
|
|
232
270
|
* The object must have valid parameters, parameter groups, conditions, and an etag.
|