firebase-admin 12.4.0 → 12.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 +4 -0
- 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 +2 -2
- 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 +2 -2
- 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 +1 -1
- 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 +1 -1
- package/lib/data-connect/data-connect-api-client-internal.d.ts +32 -0
- package/lib/data-connect/data-connect-api-client-internal.js +182 -0
- package/lib/data-connect/data-connect-api.d.ts +52 -0
- package/lib/data-connect/data-connect-api.js +19 -0
- package/lib/data-connect/data-connect.d.ts +59 -0
- package/lib/data-connect/data-connect.js +87 -0
- package/lib/data-connect/index.d.ts +61 -0
- package/lib/data-connect/index.js +71 -0
- package/lib/database/database-namespace.d.ts +1 -1
- package/lib/database/database-namespace.js +1 -1
- package/lib/database/database.d.ts +1 -1
- package/lib/database/database.js +1 -1
- package/lib/database/index.d.ts +1 -1
- package/lib/database/index.js +1 -1
- package/lib/default-namespace.d.ts +1 -1
- package/lib/default-namespace.js +1 -1
- package/lib/esm/data-connect/index.js +4 -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 +1 -1
- package/lib/firestore/firestore-namespace.js +1 -1
- package/lib/firestore/index.d.ts +1 -1
- package/lib/firestore/index.js +1 -1
- 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 +1 -1
- package/lib/machine-learning/index.js +1 -1
- package/lib/machine-learning/machine-learning-api-client.d.ts +1 -1
- package/lib/machine-learning/machine-learning-api-client.js +1 -1
- package/lib/machine-learning/machine-learning-namespace.d.ts +1 -1
- 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 -1
- package/lib/machine-learning/machine-learning.js +1 -1
- 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 +5 -5
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- package/lib/remote-config/condition-evaluator-internal.js +103 -2
- package/lib/remote-config/index.d.ts +2 -2
- package/lib/remote-config/index.js +3 -2
- package/lib/remote-config/internal/value-impl.d.ts +1 -1
- package/lib/remote-config/internal/value-impl.js +1 -1
- package/lib/remote-config/remote-config-api-client-internal.d.ts +1 -1
- package/lib/remote-config/remote-config-api-client-internal.js +1 -1
- package/lib/remote-config/remote-config-api.d.ts +111 -3
- package/lib/remote-config/remote-config-api.js +78 -2
- 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 +1 -1
- package/lib/remote-config/remote-config.js +1 -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 +3 -3
- package/lib/utils/jwt.js +6 -5
- package/lib/utils/validator.d.ts +1 -1
- package/lib/utils/validator.js +1 -1
- package/package.json +9 -1
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/*! firebase-admin v12.6.0 */
|
|
2
|
+
"use strict";
|
|
3
|
+
/*!
|
|
4
|
+
* @license
|
|
5
|
+
* Copyright 2024 Google Inc.
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.FirebaseDataConnectError = exports.DATA_CONNECT_ERROR_CODE_MAPPING = exports.DataConnectApiClient = void 0;
|
|
21
|
+
const api_request_1 = require("../utils/api-request");
|
|
22
|
+
const error_1 = require("../utils/error");
|
|
23
|
+
const utils = require("../utils/index");
|
|
24
|
+
const validator = require("../utils/validator");
|
|
25
|
+
// Data Connect backend constants
|
|
26
|
+
const DATA_CONNECT_HOST = 'https://firebasedataconnect.googleapis.com';
|
|
27
|
+
const DATA_CONNECT_API_URL_FORMAT = '{host}/v1alpha/projects/{projectId}/locations/{locationId}/services/{serviceId}:{endpointId}';
|
|
28
|
+
const EXECUTE_GRAPH_QL_ENDPOINT = 'executeGraphql';
|
|
29
|
+
const EXECUTE_GRAPH_QL_READ_ENDPOINT = 'executeGraphqlRead';
|
|
30
|
+
const DATA_CONNECT_CONFIG_HEADERS = {
|
|
31
|
+
'X-Firebase-Client': `fire-admin-node/${utils.getSdkVersion()}`
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Class that facilitates sending requests to the Firebase Data Connect backend API.
|
|
35
|
+
*
|
|
36
|
+
* @internal
|
|
37
|
+
*/
|
|
38
|
+
class DataConnectApiClient {
|
|
39
|
+
constructor(connectorConfig, app) {
|
|
40
|
+
this.connectorConfig = connectorConfig;
|
|
41
|
+
this.app = app;
|
|
42
|
+
if (!validator.isNonNullObject(app) || !('options' in app)) {
|
|
43
|
+
throw new FirebaseDataConnectError(exports.DATA_CONNECT_ERROR_CODE_MAPPING.INVALID_ARGUMENT, 'First argument passed to getDataConnect() must be a valid Firebase app instance.');
|
|
44
|
+
}
|
|
45
|
+
this.httpClient = new api_request_1.AuthorizedHttpClient(app);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Execute arbitrary GraphQL, including both read and write queries
|
|
49
|
+
*
|
|
50
|
+
* @param query - The GraphQL string to be executed.
|
|
51
|
+
* @param options - GraphQL Options
|
|
52
|
+
* @returns A promise that fulfills with a `ExecuteGraphqlResponse`.
|
|
53
|
+
*/
|
|
54
|
+
async executeGraphql(query, options) {
|
|
55
|
+
return this.executeGraphqlHelper(query, EXECUTE_GRAPH_QL_ENDPOINT, options);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Execute arbitrary read-only GraphQL queries
|
|
59
|
+
*
|
|
60
|
+
* @param query - The GraphQL (read-only) string to be executed.
|
|
61
|
+
* @param options - GraphQL Options
|
|
62
|
+
* @returns A promise that fulfills with a `ExecuteGraphqlResponse`.
|
|
63
|
+
* @throws FirebaseDataConnectError
|
|
64
|
+
*/
|
|
65
|
+
async executeGraphqlRead(query, options) {
|
|
66
|
+
return this.executeGraphqlHelper(query, EXECUTE_GRAPH_QL_READ_ENDPOINT, options);
|
|
67
|
+
}
|
|
68
|
+
async executeGraphqlHelper(query, endpoint, options) {
|
|
69
|
+
if (!validator.isNonEmptyString(query)) {
|
|
70
|
+
throw new FirebaseDataConnectError(exports.DATA_CONNECT_ERROR_CODE_MAPPING.INVALID_ARGUMENT, '`query` must be a non-empty string.');
|
|
71
|
+
}
|
|
72
|
+
if (typeof options !== 'undefined') {
|
|
73
|
+
if (!validator.isNonNullObject(options)) {
|
|
74
|
+
throw new FirebaseDataConnectError(exports.DATA_CONNECT_ERROR_CODE_MAPPING.INVALID_ARGUMENT, 'GraphqlOptions must be a non-null object');
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
const host = (process.env.DATA_CONNECT_EMULATOR_HOST || DATA_CONNECT_HOST);
|
|
78
|
+
const data = {
|
|
79
|
+
query,
|
|
80
|
+
...(options?.variables && { variables: options?.variables }),
|
|
81
|
+
...(options?.operationName && { operationName: options?.operationName }),
|
|
82
|
+
};
|
|
83
|
+
return this.getUrl(host, this.connectorConfig.location, this.connectorConfig.serviceId, endpoint)
|
|
84
|
+
.then(async (url) => {
|
|
85
|
+
const request = {
|
|
86
|
+
method: 'POST',
|
|
87
|
+
url,
|
|
88
|
+
headers: DATA_CONNECT_CONFIG_HEADERS,
|
|
89
|
+
data,
|
|
90
|
+
};
|
|
91
|
+
const resp = await this.httpClient.send(request);
|
|
92
|
+
if (resp.data.errors && validator.isNonEmptyArray(resp.data.errors)) {
|
|
93
|
+
const allMessages = resp.data.errors.map((error) => error.message).join(' ');
|
|
94
|
+
throw new FirebaseDataConnectError(exports.DATA_CONNECT_ERROR_CODE_MAPPING.QUERY_ERROR, allMessages);
|
|
95
|
+
}
|
|
96
|
+
return Promise.resolve({
|
|
97
|
+
data: resp.data.data,
|
|
98
|
+
});
|
|
99
|
+
})
|
|
100
|
+
.then((resp) => {
|
|
101
|
+
return resp;
|
|
102
|
+
})
|
|
103
|
+
.catch((err) => {
|
|
104
|
+
throw this.toFirebaseError(err);
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
async getUrl(host, locationId, serviceId, endpointId) {
|
|
108
|
+
return this.getProjectId()
|
|
109
|
+
.then((projectId) => {
|
|
110
|
+
const urlParams = {
|
|
111
|
+
host,
|
|
112
|
+
projectId,
|
|
113
|
+
locationId,
|
|
114
|
+
serviceId,
|
|
115
|
+
endpointId
|
|
116
|
+
};
|
|
117
|
+
const baseUrl = utils.formatString(DATA_CONNECT_API_URL_FORMAT, urlParams);
|
|
118
|
+
return utils.formatString(baseUrl);
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
getProjectId() {
|
|
122
|
+
if (this.projectId) {
|
|
123
|
+
return Promise.resolve(this.projectId);
|
|
124
|
+
}
|
|
125
|
+
return utils.findProjectId(this.app)
|
|
126
|
+
.then((projectId) => {
|
|
127
|
+
if (!validator.isNonEmptyString(projectId)) {
|
|
128
|
+
throw new FirebaseDataConnectError(exports.DATA_CONNECT_ERROR_CODE_MAPPING.UNKNOWN, 'Failed to determine project ID. Initialize the '
|
|
129
|
+
+ 'SDK with service account credentials or set project ID as an app option. '
|
|
130
|
+
+ 'Alternatively, set the GOOGLE_CLOUD_PROJECT environment variable.');
|
|
131
|
+
}
|
|
132
|
+
this.projectId = projectId;
|
|
133
|
+
return projectId;
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
toFirebaseError(err) {
|
|
137
|
+
if (err instanceof error_1.PrefixedFirebaseError) {
|
|
138
|
+
return err;
|
|
139
|
+
}
|
|
140
|
+
const response = err.response;
|
|
141
|
+
if (!response.isJson()) {
|
|
142
|
+
return new FirebaseDataConnectError(exports.DATA_CONNECT_ERROR_CODE_MAPPING.UNKNOWN, `Unexpected response with status: ${response.status} and body: ${response.text}`);
|
|
143
|
+
}
|
|
144
|
+
const error = response.data.error || {};
|
|
145
|
+
let code = exports.DATA_CONNECT_ERROR_CODE_MAPPING.UNKNOWN;
|
|
146
|
+
if (error.status && error.status in exports.DATA_CONNECT_ERROR_CODE_MAPPING) {
|
|
147
|
+
code = exports.DATA_CONNECT_ERROR_CODE_MAPPING[error.status];
|
|
148
|
+
}
|
|
149
|
+
const message = error.message || `Unknown server error: ${response.text}`;
|
|
150
|
+
return new FirebaseDataConnectError(code, message);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
exports.DataConnectApiClient = DataConnectApiClient;
|
|
154
|
+
exports.DATA_CONNECT_ERROR_CODE_MAPPING = {
|
|
155
|
+
ABORTED: 'aborted',
|
|
156
|
+
INVALID_ARGUMENT: 'invalid-argument',
|
|
157
|
+
INVALID_CREDENTIAL: 'invalid-credential',
|
|
158
|
+
INTERNAL: 'internal-error',
|
|
159
|
+
PERMISSION_DENIED: 'permission-denied',
|
|
160
|
+
UNAUTHENTICATED: 'unauthenticated',
|
|
161
|
+
NOT_FOUND: 'not-found',
|
|
162
|
+
UNKNOWN: 'unknown-error',
|
|
163
|
+
QUERY_ERROR: 'query-error',
|
|
164
|
+
};
|
|
165
|
+
/**
|
|
166
|
+
* Firebase Data Connect error code structure. This extends PrefixedFirebaseError.
|
|
167
|
+
*
|
|
168
|
+
* @param code - The error code.
|
|
169
|
+
* @param message - The error message.
|
|
170
|
+
* @constructor
|
|
171
|
+
*/
|
|
172
|
+
class FirebaseDataConnectError extends error_1.PrefixedFirebaseError {
|
|
173
|
+
constructor(code, message) {
|
|
174
|
+
super('data-connect', code, message);
|
|
175
|
+
/* tslint:disable:max-line-length */
|
|
176
|
+
// Set the prototype explicitly. See the following link for more details:
|
|
177
|
+
// https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work
|
|
178
|
+
/* tslint:enable:max-line-length */
|
|
179
|
+
this.__proto__ = FirebaseDataConnectError.prototype;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
exports.FirebaseDataConnectError = FirebaseDataConnectError;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/*! firebase-admin v12.6.0 */
|
|
2
|
+
/*!
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright 2024 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
|
+
/**
|
|
19
|
+
* Interface representing a Data Connect connector configuration.
|
|
20
|
+
*/
|
|
21
|
+
export interface ConnectorConfig {
|
|
22
|
+
/**
|
|
23
|
+
* Location ID of the Data Connect service.
|
|
24
|
+
*/
|
|
25
|
+
location: string;
|
|
26
|
+
/**
|
|
27
|
+
* Service ID of the Data Connect service.
|
|
28
|
+
*/
|
|
29
|
+
serviceId: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Interface representing GraphQL response.
|
|
33
|
+
*/
|
|
34
|
+
export interface ExecuteGraphqlResponse<GraphqlResponse> {
|
|
35
|
+
/**
|
|
36
|
+
* Data payload of the GraphQL response.
|
|
37
|
+
*/
|
|
38
|
+
data: GraphqlResponse;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Interface representing GraphQL options.
|
|
42
|
+
*/
|
|
43
|
+
export interface GraphqlOptions<Variables> {
|
|
44
|
+
/**
|
|
45
|
+
* Values for GraphQL variables provided in this query or mutation.
|
|
46
|
+
*/
|
|
47
|
+
variables?: Variables;
|
|
48
|
+
/**
|
|
49
|
+
* The name of the GraphQL operation. Required only if `query` contains multiple operations.
|
|
50
|
+
*/
|
|
51
|
+
operationName?: string;
|
|
52
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*! firebase-admin v12.6.0 */
|
|
2
|
+
"use strict";
|
|
3
|
+
/*!
|
|
4
|
+
* @license
|
|
5
|
+
* Copyright 2024 Google Inc.
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/*! firebase-admin v12.6.0 */
|
|
2
|
+
/*!
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright 2024 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
|
+
import { App } from '../app';
|
|
19
|
+
import { ConnectorConfig, ExecuteGraphqlResponse, GraphqlOptions } from './data-connect-api';
|
|
20
|
+
export declare class DataConnectService {
|
|
21
|
+
private readonly appInternal;
|
|
22
|
+
private dataConnectInstances;
|
|
23
|
+
constructor(app: App);
|
|
24
|
+
getDataConnect(connectorConfig: ConnectorConfig): DataConnect;
|
|
25
|
+
/**
|
|
26
|
+
* Returns the app associated with this `DataConnectService` instance.
|
|
27
|
+
*
|
|
28
|
+
* @returns The app associated with this `DataConnectService` instance.
|
|
29
|
+
*/
|
|
30
|
+
get app(): App;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The Firebase `DataConnect` service interface.
|
|
34
|
+
*/
|
|
35
|
+
export declare class DataConnect {
|
|
36
|
+
readonly connectorConfig: ConnectorConfig;
|
|
37
|
+
readonly app: App;
|
|
38
|
+
private readonly client;
|
|
39
|
+
/**
|
|
40
|
+
* Execute an arbitrary GraphQL query or mutation
|
|
41
|
+
*
|
|
42
|
+
* @param query - The GraphQL query or mutation.
|
|
43
|
+
* @param options - Optional {@link GraphqlOptions} when executing a GraphQL query or mutation.
|
|
44
|
+
*
|
|
45
|
+
* @returns A promise that fulfills with a `ExecuteGraphqlResponse`.
|
|
46
|
+
* @beta
|
|
47
|
+
*/
|
|
48
|
+
executeGraphql<GraphqlResponse, Variables>(query: string, options?: GraphqlOptions<Variables>): Promise<ExecuteGraphqlResponse<GraphqlResponse>>;
|
|
49
|
+
/**
|
|
50
|
+
* Execute an arbitrary read-only GraphQL query
|
|
51
|
+
*
|
|
52
|
+
* @param query - The GraphQL read-only query.
|
|
53
|
+
* @param options - Optional {@link GraphqlOptions} when executing a read-only GraphQL query.
|
|
54
|
+
*
|
|
55
|
+
* @returns A promise that fulfills with a `ExecuteGraphqlResponse`.
|
|
56
|
+
* @beta
|
|
57
|
+
*/
|
|
58
|
+
executeGraphqlRead<GraphqlResponse, Variables>(query: string, options?: GraphqlOptions<Variables>): Promise<ExecuteGraphqlResponse<GraphqlResponse>>;
|
|
59
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/*! firebase-admin v12.6.0 */
|
|
2
|
+
"use strict";
|
|
3
|
+
/*!
|
|
4
|
+
* @license
|
|
5
|
+
* Copyright 2024 Google Inc.
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.DataConnect = exports.DataConnectService = void 0;
|
|
21
|
+
const data_connect_api_client_internal_1 = require("./data-connect-api-client-internal");
|
|
22
|
+
class DataConnectService {
|
|
23
|
+
constructor(app) {
|
|
24
|
+
this.dataConnectInstances = new Map();
|
|
25
|
+
this.appInternal = app;
|
|
26
|
+
}
|
|
27
|
+
getDataConnect(connectorConfig) {
|
|
28
|
+
const id = `${connectorConfig.location}-${connectorConfig.serviceId}`;
|
|
29
|
+
const dc = this.dataConnectInstances.get(id);
|
|
30
|
+
if (typeof dc !== 'undefined') {
|
|
31
|
+
return dc;
|
|
32
|
+
}
|
|
33
|
+
const newInstance = new DataConnect(connectorConfig, this.appInternal);
|
|
34
|
+
this.dataConnectInstances.set(id, newInstance);
|
|
35
|
+
return newInstance;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Returns the app associated with this `DataConnectService` instance.
|
|
39
|
+
*
|
|
40
|
+
* @returns The app associated with this `DataConnectService` instance.
|
|
41
|
+
*/
|
|
42
|
+
get app() {
|
|
43
|
+
return this.appInternal;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.DataConnectService = DataConnectService;
|
|
47
|
+
/**
|
|
48
|
+
* The Firebase `DataConnect` service interface.
|
|
49
|
+
*/
|
|
50
|
+
class DataConnect {
|
|
51
|
+
/**
|
|
52
|
+
* @param connectorConfig - The connector configuration.
|
|
53
|
+
* @param app - The app for this `DataConnect` service.
|
|
54
|
+
* @constructor
|
|
55
|
+
* @internal
|
|
56
|
+
*/
|
|
57
|
+
constructor(connectorConfig, app) {
|
|
58
|
+
this.connectorConfig = connectorConfig;
|
|
59
|
+
this.app = app;
|
|
60
|
+
this.client = new data_connect_api_client_internal_1.DataConnectApiClient(connectorConfig, app);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Execute an arbitrary GraphQL query or mutation
|
|
64
|
+
*
|
|
65
|
+
* @param query - The GraphQL query or mutation.
|
|
66
|
+
* @param options - Optional {@link GraphqlOptions} when executing a GraphQL query or mutation.
|
|
67
|
+
*
|
|
68
|
+
* @returns A promise that fulfills with a `ExecuteGraphqlResponse`.
|
|
69
|
+
* @beta
|
|
70
|
+
*/
|
|
71
|
+
executeGraphql(query, options) {
|
|
72
|
+
return this.client.executeGraphql(query, options);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Execute an arbitrary read-only GraphQL query
|
|
76
|
+
*
|
|
77
|
+
* @param query - The GraphQL read-only query.
|
|
78
|
+
* @param options - Optional {@link GraphqlOptions} when executing a read-only GraphQL query.
|
|
79
|
+
*
|
|
80
|
+
* @returns A promise that fulfills with a `ExecuteGraphqlResponse`.
|
|
81
|
+
* @beta
|
|
82
|
+
*/
|
|
83
|
+
executeGraphqlRead(query, options) {
|
|
84
|
+
return this.client.executeGraphqlRead(query, options);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
exports.DataConnect = DataConnect;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/*! firebase-admin v12.6.0 */
|
|
2
|
+
/*!
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright 2024 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
|
+
/**
|
|
19
|
+
* Firebase Data Connect service.
|
|
20
|
+
*
|
|
21
|
+
* @packageDocumentation
|
|
22
|
+
*/
|
|
23
|
+
import { App } from '../app';
|
|
24
|
+
import { DataConnect } from './data-connect';
|
|
25
|
+
import { ConnectorConfig } from './data-connect-api';
|
|
26
|
+
export { GraphqlOptions, ExecuteGraphqlResponse, ConnectorConfig, } from './data-connect-api';
|
|
27
|
+
export { DataConnect, } from './data-connect';
|
|
28
|
+
/**
|
|
29
|
+
* Gets the {@link DataConnect} service with the provided connector configuration
|
|
30
|
+
* for the default app or a given app.
|
|
31
|
+
*
|
|
32
|
+
* `getDataConnect(connectorConfig)` can be called with no app argument to access the default
|
|
33
|
+
* app's `DataConnect` service or as `getDataConnect(connectorConfig, app)` to access the
|
|
34
|
+
* `DataConnect` service associated with a specific app.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```javascript
|
|
38
|
+
* const connectorConfig: ConnectorConfig = {
|
|
39
|
+
* location: 'us-west2',
|
|
40
|
+
* serviceId: 'my-service',
|
|
41
|
+
* };
|
|
42
|
+
*
|
|
43
|
+
* // Get the `DataConnect` service for the default app
|
|
44
|
+
* const defaultDataConnect = getDataConnect(connectorConfig);
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```javascript
|
|
49
|
+
* // Get the `DataConnect` service for a given app
|
|
50
|
+
* const otherDataConnect = getDataConnect(connectorConfig, otherApp);
|
|
51
|
+
* ```
|
|
52
|
+
*
|
|
53
|
+
* @param connectorConfig - Connector configuration for the `DataConnect` service.
|
|
54
|
+
*
|
|
55
|
+
* @param app - Optional app for which to return the `DataConnect` service.
|
|
56
|
+
* If not provided, the default `DataConnect` service is returned.
|
|
57
|
+
*
|
|
58
|
+
* @returns The default `DataConnect` service with the provided connector configuration
|
|
59
|
+
* if no app is provided, or the `DataConnect` service associated with the provided app.
|
|
60
|
+
*/
|
|
61
|
+
export declare function getDataConnect(connectorConfig: ConnectorConfig, app?: App): DataConnect;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/*! firebase-admin v12.6.0 */
|
|
2
|
+
"use strict";
|
|
3
|
+
/*!
|
|
4
|
+
* @license
|
|
5
|
+
* Copyright 2024 Google Inc.
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.getDataConnect = exports.DataConnect = void 0;
|
|
21
|
+
/**
|
|
22
|
+
* Firebase Data Connect service.
|
|
23
|
+
*
|
|
24
|
+
* @packageDocumentation
|
|
25
|
+
*/
|
|
26
|
+
const app_1 = require("../app");
|
|
27
|
+
const data_connect_1 = require("./data-connect");
|
|
28
|
+
var data_connect_2 = require("./data-connect");
|
|
29
|
+
Object.defineProperty(exports, "DataConnect", { enumerable: true, get: function () { return data_connect_2.DataConnect; } });
|
|
30
|
+
/**
|
|
31
|
+
* Gets the {@link DataConnect} service with the provided connector configuration
|
|
32
|
+
* for the default app or a given app.
|
|
33
|
+
*
|
|
34
|
+
* `getDataConnect(connectorConfig)` can be called with no app argument to access the default
|
|
35
|
+
* app's `DataConnect` service or as `getDataConnect(connectorConfig, app)` to access the
|
|
36
|
+
* `DataConnect` service associated with a specific app.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```javascript
|
|
40
|
+
* const connectorConfig: ConnectorConfig = {
|
|
41
|
+
* location: 'us-west2',
|
|
42
|
+
* serviceId: 'my-service',
|
|
43
|
+
* };
|
|
44
|
+
*
|
|
45
|
+
* // Get the `DataConnect` service for the default app
|
|
46
|
+
* const defaultDataConnect = getDataConnect(connectorConfig);
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```javascript
|
|
51
|
+
* // Get the `DataConnect` service for a given app
|
|
52
|
+
* const otherDataConnect = getDataConnect(connectorConfig, otherApp);
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* @param connectorConfig - Connector configuration for the `DataConnect` service.
|
|
56
|
+
*
|
|
57
|
+
* @param app - Optional app for which to return the `DataConnect` service.
|
|
58
|
+
* If not provided, the default `DataConnect` service is returned.
|
|
59
|
+
*
|
|
60
|
+
* @returns The default `DataConnect` service with the provided connector configuration
|
|
61
|
+
* if no app is provided, or the `DataConnect` service associated with the provided app.
|
|
62
|
+
*/
|
|
63
|
+
function getDataConnect(connectorConfig, app) {
|
|
64
|
+
if (typeof app === 'undefined') {
|
|
65
|
+
app = (0, app_1.getApp)();
|
|
66
|
+
}
|
|
67
|
+
const firebaseApp = app;
|
|
68
|
+
const dataConnectService = firebaseApp.getOrInitService('dataConnect', (app) => new data_connect_1.DataConnectService(app));
|
|
69
|
+
return dataConnectService.getDataConnect(connectorConfig);
|
|
70
|
+
}
|
|
71
|
+
exports.getDataConnect = getDataConnect;
|
package/lib/database/database.js
CHANGED
package/lib/database/index.d.ts
CHANGED
package/lib/database/index.js
CHANGED
package/lib/default-namespace.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import mod from "../../remote-config/index.js";
|
|
2
2
|
|
|
3
|
+
export const CustomSignalOperator = mod.CustomSignalOperator;
|
|
3
4
|
export const PercentConditionOperator = mod.PercentConditionOperator;
|
|
4
5
|
export const RemoteConfig = mod.RemoteConfig;
|
|
5
6
|
export const getRemoteConfig = mod.getRemoteConfig;
|
package/lib/eventarc/eventarc.js
CHANGED
package/lib/eventarc/index.d.ts
CHANGED