@firebase/data-connect 0.2.0-canary.2ec1c7682 → 0.2.0-canary.313faf66b
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.cjs.js +50 -9
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm2017.js +50 -10
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.node.cjs.js +50 -9
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/internal.d.ts +19 -1
- package/dist/node-esm/index.node.esm.js +50 -10
- package/dist/node-esm/index.node.esm.js.map +1 -1
- package/dist/node-esm/src/api/DataConnect.d.ts +3 -0
- package/dist/node-esm/src/network/fetch.d.ts +2 -1
- package/dist/node-esm/src/network/transport/index.d.ts +15 -1
- package/dist/node-esm/src/network/transport/rest.d.ts +4 -2
- package/dist/private.d.ts +17 -0
- package/dist/public.d.ts +13 -0
- package/dist/src/api/DataConnect.d.ts +3 -0
- package/dist/src/network/fetch.d.ts +2 -1
- package/dist/src/network/transport/index.d.ts +15 -1
- package/dist/src/network/transport/rest.d.ts +4 -2
- package/package.json +9 -9
package/dist/index.cjs.js
CHANGED
|
@@ -8,7 +8,7 @@ var util = require('@firebase/util');
|
|
|
8
8
|
var logger$1 = require('@firebase/logger');
|
|
9
9
|
|
|
10
10
|
const name = "@firebase/data-connect";
|
|
11
|
-
const version = "0.2.0-canary.
|
|
11
|
+
const version = "0.2.0-canary.313faf66b";
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* @license
|
|
@@ -443,6 +443,31 @@ function compareDates(str1, str2) {
|
|
|
443
443
|
return date1.getTime() < date2.getTime();
|
|
444
444
|
}
|
|
445
445
|
|
|
446
|
+
/**
|
|
447
|
+
* @license
|
|
448
|
+
* Copyright 2024 Google LLC
|
|
449
|
+
*
|
|
450
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
451
|
+
* you may not use this file except in compliance with the License.
|
|
452
|
+
* You may obtain a copy of the License at
|
|
453
|
+
*
|
|
454
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
455
|
+
*
|
|
456
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
457
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
458
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
459
|
+
* See the License for the specific language governing permissions and
|
|
460
|
+
* limitations under the License.
|
|
461
|
+
*/
|
|
462
|
+
const CallerSdkTypeEnum = {
|
|
463
|
+
Base: 'Base', // Core JS SDK
|
|
464
|
+
Generated: 'Generated', // Generated JS SDK
|
|
465
|
+
TanstackReactCore: 'TanstackReactCore', // Tanstack non-generated React SDK
|
|
466
|
+
GeneratedReact: 'GeneratedReact', // Tanstack non-generated Angular SDK
|
|
467
|
+
TanstackAngularCore: 'TanstackAngularCore', // Tanstack non-generated Angular SDK
|
|
468
|
+
GeneratedAngular: 'GeneratedAngular' // Generated Angular SDK
|
|
469
|
+
};
|
|
470
|
+
|
|
446
471
|
/**
|
|
447
472
|
* @license
|
|
448
473
|
* Copyright 2024 Google LLC
|
|
@@ -500,20 +525,24 @@ function addToken(url, apiKey) {
|
|
|
500
525
|
* limitations under the License.
|
|
501
526
|
*/
|
|
502
527
|
let connectFetch = globalThis.fetch;
|
|
503
|
-
function getGoogApiClientValue(_isUsingGen) {
|
|
528
|
+
function getGoogApiClientValue(_isUsingGen, _callerSdkType) {
|
|
504
529
|
let str = 'gl-js/ fire/' + SDK_VERSION;
|
|
505
|
-
if (
|
|
530
|
+
if (_callerSdkType !== CallerSdkTypeEnum.Base &&
|
|
531
|
+
_callerSdkType !== CallerSdkTypeEnum.Generated) {
|
|
532
|
+
str += ' js/' + _callerSdkType.toLowerCase();
|
|
533
|
+
}
|
|
534
|
+
else if (_isUsingGen || _callerSdkType === CallerSdkTypeEnum.Generated) {
|
|
506
535
|
str += ' js/gen';
|
|
507
536
|
}
|
|
508
537
|
return str;
|
|
509
538
|
}
|
|
510
|
-
function dcFetch(url, body, { signal }, appId, accessToken, appCheckToken, _isUsingGen) {
|
|
539
|
+
function dcFetch(url, body, { signal }, appId, accessToken, appCheckToken, _isUsingGen, _callerSdkType) {
|
|
511
540
|
if (!connectFetch) {
|
|
512
541
|
throw new DataConnectError(Code.OTHER, 'No Fetch Implementation detected!');
|
|
513
542
|
}
|
|
514
543
|
const headers = {
|
|
515
544
|
'Content-Type': 'application/json',
|
|
516
|
-
'X-Goog-Api-Client': getGoogApiClientValue(_isUsingGen)
|
|
545
|
+
'X-Goog-Api-Client': getGoogApiClientValue(_isUsingGen, _callerSdkType)
|
|
517
546
|
};
|
|
518
547
|
if (accessToken) {
|
|
519
548
|
headers['X-Firebase-Auth-Token'] = accessToken;
|
|
@@ -586,13 +615,14 @@ function getMessage(obj) {
|
|
|
586
615
|
* limitations under the License.
|
|
587
616
|
*/
|
|
588
617
|
class RESTTransport {
|
|
589
|
-
constructor(options, apiKey, appId, authProvider, appCheckProvider, transportOptions, _isUsingGen = false) {
|
|
618
|
+
constructor(options, apiKey, appId, authProvider, appCheckProvider, transportOptions, _isUsingGen = false, _callerSdkType = CallerSdkTypeEnum.Base) {
|
|
590
619
|
var _a, _b;
|
|
591
620
|
this.apiKey = apiKey;
|
|
592
621
|
this.appId = appId;
|
|
593
622
|
this.authProvider = authProvider;
|
|
594
623
|
this.appCheckProvider = appCheckProvider;
|
|
595
624
|
this._isUsingGen = _isUsingGen;
|
|
625
|
+
this._callerSdkType = _callerSdkType;
|
|
596
626
|
this._host = '';
|
|
597
627
|
this._location = 'l';
|
|
598
628
|
this._connectorName = '';
|
|
@@ -609,7 +639,7 @@ class RESTTransport {
|
|
|
609
639
|
name: `projects/${this._project}/locations/${this._location}/services/${this._serviceName}/connectors/${this._connectorName}`,
|
|
610
640
|
operationName: queryName,
|
|
611
641
|
variables: body
|
|
612
|
-
}, abortController, this.appId, this._accessToken, this._appCheckToken, this._isUsingGen));
|
|
642
|
+
}, abortController, this.appId, this._accessToken, this._appCheckToken, this._isUsingGen, this._callerSdkType));
|
|
613
643
|
return withAuth;
|
|
614
644
|
};
|
|
615
645
|
this.invokeMutation = (mutationName, body) => {
|
|
@@ -619,7 +649,7 @@ class RESTTransport {
|
|
|
619
649
|
name: `projects/${this._project}/locations/${this._location}/services/${this._serviceName}/connectors/${this._connectorName}`,
|
|
620
650
|
operationName: mutationName,
|
|
621
651
|
variables: body
|
|
622
|
-
}, abortController, this.appId, this._accessToken, this._appCheckToken, this._isUsingGen);
|
|
652
|
+
}, abortController, this.appId, this._accessToken, this._appCheckToken, this._isUsingGen, this._callerSdkType);
|
|
623
653
|
});
|
|
624
654
|
return taskResult;
|
|
625
655
|
};
|
|
@@ -720,6 +750,9 @@ class RESTTransport {
|
|
|
720
750
|
throw err;
|
|
721
751
|
});
|
|
722
752
|
}
|
|
753
|
+
_setCallerSdkType(callerSdkType) {
|
|
754
|
+
this._callerSdkType = callerSdkType;
|
|
755
|
+
}
|
|
723
756
|
}
|
|
724
757
|
|
|
725
758
|
/**
|
|
@@ -829,6 +862,7 @@ class DataConnect {
|
|
|
829
862
|
this.isEmulator = false;
|
|
830
863
|
this._initialized = false;
|
|
831
864
|
this._isUsingGeneratedSdk = false;
|
|
865
|
+
this._callerSdkType = CallerSdkTypeEnum.Base;
|
|
832
866
|
if (typeof process !== 'undefined' && process.env) {
|
|
833
867
|
const host = process.env[FIREBASE_DATA_CONNECT_EMULATOR_HOST_VAR];
|
|
834
868
|
if (host) {
|
|
@@ -844,6 +878,12 @@ class DataConnect {
|
|
|
844
878
|
this._isUsingGeneratedSdk = true;
|
|
845
879
|
}
|
|
846
880
|
}
|
|
881
|
+
_setCallerSdkType(callerSdkType) {
|
|
882
|
+
this._callerSdkType = callerSdkType;
|
|
883
|
+
if (this._initialized) {
|
|
884
|
+
this._transport._setCallerSdkType(callerSdkType);
|
|
885
|
+
}
|
|
886
|
+
}
|
|
847
887
|
_delete() {
|
|
848
888
|
app._removeServiceInstance(this.app, 'data-connect', JSON.stringify(this.getSettings()));
|
|
849
889
|
return Promise.resolve();
|
|
@@ -870,7 +910,7 @@ class DataConnect {
|
|
|
870
910
|
this._appCheckTokenProvider = new AppCheckTokenProvider(this.app, this._appCheckProvider);
|
|
871
911
|
}
|
|
872
912
|
this._initialized = true;
|
|
873
|
-
this._transport = new this._transportClass(this.dataConnectOptions, this.app.options.apiKey, this.app.options.appId, this._authTokenProvider, this._appCheckTokenProvider, undefined, this._isUsingGeneratedSdk);
|
|
913
|
+
this._transport = new this._transportClass(this.dataConnectOptions, this.app.options.apiKey, this.app.options.appId, this._authTokenProvider, this._appCheckTokenProvider, undefined, this._isUsingGeneratedSdk, this._callerSdkType);
|
|
874
914
|
if (this._transportOptions) {
|
|
875
915
|
this._transport.useEmulator(this._transportOptions.host, this._transportOptions.port, this._transportOptions.sslEnabled);
|
|
876
916
|
}
|
|
@@ -1163,6 +1203,7 @@ function subscribe(queryRefOrSerializedResult, observerOrOnNext, onError, onComp
|
|
|
1163
1203
|
*/
|
|
1164
1204
|
registerDataConnect();
|
|
1165
1205
|
|
|
1206
|
+
exports.CallerSdkTypeEnum = CallerSdkTypeEnum;
|
|
1166
1207
|
exports.DataConnect = DataConnect;
|
|
1167
1208
|
exports.MUTATION_STR = MUTATION_STR;
|
|
1168
1209
|
exports.MutationManager = MutationManager;
|
package/dist/index.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../src/core/version.ts","../src/core/AppCheckTokenProvider.ts","../src/core/error.ts","../src/logger.ts","../src/core/FirebaseAuthProvider.ts","../src/api/Reference.ts","../src/util/encoder.ts","../src/util/map.ts","../src/core/QueryManager.ts","../src/util/url.ts","../src/network/fetch.ts","../src/network/transport/rest.ts","../src/api/Mutation.ts","../src/api/DataConnect.ts","../src/register.ts","../src/api/query.ts","../src/util/validateArgs.ts","../src/api.browser.ts","../src/index.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** The semver (www.semver.org) version of the SDK. */\nexport let SDK_VERSION = '';\n\n/**\n * SDK_VERSION should be set before any database instance is created\n * @internal\n */\nexport function setSDKVersion(version: string): void {\n SDK_VERSION = version;\n}\n","/**\n * @license\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { FirebaseApp, _isFirebaseServerApp } from '@firebase/app';\nimport {\n AppCheckInternalComponentName,\n AppCheckTokenListener,\n AppCheckTokenResult,\n FirebaseAppCheckInternal\n} from '@firebase/app-check-interop-types';\nimport { Provider } from '@firebase/component';\n\n/**\n * @internal\n * Abstraction around AppCheck's token fetching capabilities.\n */\nexport class AppCheckTokenProvider {\n private appCheck?: FirebaseAppCheckInternal;\n private serverAppAppCheckToken?: string;\n constructor(\n app: FirebaseApp,\n private appCheckProvider?: Provider<AppCheckInternalComponentName>\n ) {\n if (_isFirebaseServerApp(app) && app.settings.appCheckToken) {\n this.serverAppAppCheckToken = app.settings.appCheckToken;\n }\n this.appCheck = appCheckProvider?.getImmediate({ optional: true });\n if (!this.appCheck) {\n void appCheckProvider\n ?.get()\n .then(appCheck => (this.appCheck = appCheck))\n .catch();\n }\n }\n\n getToken(): Promise<AppCheckTokenResult> {\n if (this.serverAppAppCheckToken) {\n return Promise.resolve({ token: this.serverAppAppCheckToken });\n }\n\n if (!this.appCheck) {\n return new Promise<AppCheckTokenResult>((resolve, reject) => {\n // Support delayed initialization of FirebaseAppCheck. This allows our\n // customers to initialize the RTDB SDK before initializing Firebase\n // AppCheck and ensures that all requests are authenticated if a token\n // becomes available before the timoeout below expires.\n setTimeout(() => {\n if (this.appCheck) {\n this.getToken().then(resolve, reject);\n } else {\n resolve(null);\n }\n }, 0);\n });\n }\n return this.appCheck.getToken();\n }\n\n addTokenChangeListener(listener: AppCheckTokenListener): void {\n void this.appCheckProvider\n ?.get()\n .then(appCheck => appCheck.addTokenListener(listener));\n }\n}\n","/**\n * @license\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { FirebaseError } from '@firebase/util';\n\nexport type DataConnectErrorCode =\n | 'other'\n | 'already-initialized'\n | 'not-initialized'\n | 'not-supported'\n | 'invalid-argument'\n | 'partial-error'\n | 'unauthorized';\n\nexport type Code = DataConnectErrorCode;\n\nexport const Code = {\n OTHER: 'other' as DataConnectErrorCode,\n ALREADY_INITIALIZED: 'already-initialized' as DataConnectErrorCode,\n NOT_INITIALIZED: 'not-initialized' as DataConnectErrorCode,\n NOT_SUPPORTED: 'not-supported' as DataConnectErrorCode,\n INVALID_ARGUMENT: 'invalid-argument' as DataConnectErrorCode,\n PARTIAL_ERROR: 'partial-error' as DataConnectErrorCode,\n UNAUTHORIZED: 'unauthorized' as DataConnectErrorCode\n};\n\n/** An error returned by a DataConnect operation. */\nexport class DataConnectError extends FirebaseError {\n /** The stack of the error. */\n readonly stack?: string;\n\n /** @hideconstructor */\n constructor(\n /**\n * The backend error code associated with this error.\n */\n readonly code: DataConnectErrorCode,\n /**\n * A custom error description.\n */\n readonly message: string\n ) {\n super(code, message);\n\n // HACK: We write a toString property directly because Error is not a real\n // class and so inheritance does not work correctly. We could alternatively\n // do the same \"back-door inheritance\" trick that FirebaseError does.\n this.toString = () => `${this.name}: [code=${this.code}]: ${this.message}`;\n }\n}\n","/**\n * @license\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { Logger, LogLevelString } from '@firebase/logger';\n\nimport { SDK_VERSION } from './core/version';\n\nconst logger = new Logger('@firebase/data-connect');\nexport function setLogLevel(logLevel: LogLevelString): void {\n logger.setLogLevel(logLevel);\n}\nexport function logDebug(msg: string): void {\n logger.debug(`DataConnect (${SDK_VERSION}): ${msg}`);\n}\n\nexport function logError(msg: string): void {\n logger.error(`DataConnect (${SDK_VERSION}): ${msg}`);\n}\n","/**\n * @license\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { FirebaseOptions } from '@firebase/app-types';\nimport {\n FirebaseAuthInternal,\n FirebaseAuthInternalName,\n FirebaseAuthTokenData\n} from '@firebase/auth-interop-types';\nimport { Provider } from '@firebase/component';\n\nimport { logDebug, logError } from '../logger';\n\n// @internal\nexport interface AuthTokenProvider {\n getToken(forceRefresh: boolean): Promise<FirebaseAuthTokenData | null>;\n addTokenChangeListener(listener: AuthTokenListener): void;\n}\nexport type AuthTokenListener = (token: string | null) => void;\n\n// @internal\nexport class FirebaseAuthProvider implements AuthTokenProvider {\n private _auth: FirebaseAuthInternal;\n constructor(\n private _appName: string,\n private _options: FirebaseOptions,\n private _authProvider: Provider<FirebaseAuthInternalName>\n ) {\n this._auth = _authProvider.getImmediate({ optional: true })!;\n if (!this._auth) {\n _authProvider.onInit(auth => (this._auth = auth));\n }\n }\n getToken(forceRefresh: boolean): Promise<FirebaseAuthTokenData | null> {\n if (!this._auth) {\n return new Promise((resolve, reject) => {\n setTimeout(() => {\n if (this._auth) {\n this.getToken(forceRefresh).then(resolve, reject);\n } else {\n resolve(null);\n }\n }, 0);\n });\n }\n return this._auth.getToken(forceRefresh).catch(error => {\n if (error && error.code === 'auth/token-not-initialized') {\n logDebug(\n 'Got auth/token-not-initialized error. Treating as null token.'\n );\n return null;\n } else {\n logError(\n 'Error received when attempting to retrieve token: ' +\n JSON.stringify(error)\n );\n return Promise.reject(error);\n }\n });\n }\n addTokenChangeListener(listener: AuthTokenListener): void {\n this._auth?.addAuthTokenListener(listener);\n }\n removeTokenChangeListener(listener: (token: string | null) => void): void {\n this._authProvider\n .get()\n .then(auth => auth.removeAuthTokenListener(listener))\n .catch(err => logError(err));\n }\n}\n","/**\n * @license\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { DataConnect, DataConnectOptions } from './DataConnect';\nexport const QUERY_STR = 'query';\nexport const MUTATION_STR = 'mutation';\nexport type ReferenceType = typeof QUERY_STR | typeof MUTATION_STR;\n\nexport const SOURCE_SERVER = 'SERVER';\nexport const SOURCE_CACHE = 'CACHE';\nexport type DataSource = typeof SOURCE_CACHE | typeof SOURCE_SERVER;\n\nexport interface OpResult<Data> {\n data: Data;\n source: DataSource;\n fetchTime: string;\n}\n\nexport interface OperationRef<_Data, Variables> {\n name: string;\n variables: Variables;\n refType: ReferenceType;\n dataConnect: DataConnect;\n}\n\nexport interface DataConnectResult<Data, Variables> extends OpResult<Data> {\n ref: OperationRef<Data, Variables>;\n // future metadata\n}\n\n/**\n * Serialized RefInfo as a result of `QueryResult.toJSON().refInfo`\n */\nexport interface RefInfo<Variables> {\n name: string;\n variables: Variables;\n connectorConfig: DataConnectOptions;\n}\n/**\n * Serialized Ref as a result of `QueryResult.toJSON()`\n */\nexport interface SerializedRef<Data, Variables> extends OpResult<Data> {\n refInfo: RefInfo<Variables>;\n}\n","/**\n * @license\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport type HmacImpl = (obj: unknown) => string;\nexport let encoderImpl: HmacImpl;\nexport function setEncoder(encoder: HmacImpl): void {\n encoderImpl = encoder;\n}\nsetEncoder(o => JSON.stringify(o));\n","/**\n * @license\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport function setIfNotExists<T>(\n map: Map<string, T>,\n key: string,\n val: T\n): void {\n if (!map.has(key)) {\n map.set(key, val);\n }\n}\n","/**\n * @license\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n DataConnectSubscription,\n OnErrorSubscription,\n OnResultSubscription,\n QueryPromise,\n QueryRef,\n QueryResult\n} from '../api/query';\nimport {\n OperationRef,\n QUERY_STR,\n OpResult,\n SerializedRef,\n SOURCE_SERVER,\n DataSource,\n SOURCE_CACHE\n} from '../api/Reference';\nimport { logDebug } from '../logger';\nimport { DataConnectTransport } from '../network';\nimport { encoderImpl } from '../util/encoder';\nimport { setIfNotExists } from '../util/map';\n\nimport { Code, DataConnectError } from './error';\n\ninterface TrackedQuery<Data, Variables> {\n ref: Omit<OperationRef<Data, Variables>, 'dataConnect'>;\n subscriptions: Array<DataConnectSubscription<Data, Variables>>;\n currentCache: OpResult<Data> | null;\n lastError: DataConnectError | null;\n}\n\nfunction getRefSerializer<Data, Variables>(\n queryRef: QueryRef<Data, Variables>,\n data: Data,\n source: DataSource\n) {\n return function toJSON(): SerializedRef<Data, Variables> {\n return {\n data,\n refInfo: {\n name: queryRef.name,\n variables: queryRef.variables,\n connectorConfig: {\n projectId: queryRef.dataConnect.app.options.projectId!,\n ...queryRef.dataConnect.getSettings()\n }\n },\n fetchTime: Date.now().toLocaleString(),\n source\n };\n };\n}\n\nexport class QueryManager {\n _queries: Map<string, TrackedQuery<unknown, unknown>>;\n constructor(private transport: DataConnectTransport) {\n this._queries = new Map();\n }\n track<Data, Variables>(\n queryName: string,\n variables: Variables,\n initialCache?: OpResult<Data>\n ): TrackedQuery<Data, Variables> {\n const ref: TrackedQuery<Data, Variables>['ref'] = {\n name: queryName,\n variables,\n refType: QUERY_STR\n };\n const key = encoderImpl(ref);\n const newTrackedQuery: TrackedQuery<Data, Variables> = {\n ref,\n subscriptions: [],\n currentCache: initialCache || null,\n lastError: null\n };\n // @ts-ignore\n setIfNotExists(this._queries, key, newTrackedQuery);\n return this._queries.get(key) as TrackedQuery<Data, Variables>;\n }\n addSubscription<Data, Variables>(\n queryRef: OperationRef<Data, Variables>,\n onResultCallback: OnResultSubscription<Data, Variables>,\n onErrorCallback?: OnErrorSubscription,\n initialCache?: OpResult<Data>\n ): () => void {\n const key = encoderImpl({\n name: queryRef.name,\n variables: queryRef.variables,\n refType: QUERY_STR\n });\n const trackedQuery = this._queries.get(key) as TrackedQuery<\n Data,\n Variables\n >;\n const subscription = {\n userCallback: onResultCallback,\n errCallback: onErrorCallback\n };\n const unsubscribe = (): void => {\n const trackedQuery = this._queries.get(key)!;\n trackedQuery.subscriptions = trackedQuery.subscriptions.filter(\n sub => sub !== subscription\n );\n };\n if (initialCache && trackedQuery.currentCache !== initialCache) {\n logDebug('Initial cache found. Comparing dates.');\n if (\n !trackedQuery.currentCache ||\n (trackedQuery.currentCache &&\n compareDates(\n trackedQuery.currentCache.fetchTime,\n initialCache.fetchTime\n ))\n ) {\n trackedQuery.currentCache = initialCache;\n }\n }\n if (trackedQuery.currentCache !== null) {\n const cachedData = trackedQuery.currentCache.data;\n onResultCallback({\n data: cachedData,\n source: SOURCE_CACHE,\n ref: queryRef as QueryRef<Data, Variables>,\n toJSON: getRefSerializer(\n queryRef as QueryRef<Data, Variables>,\n trackedQuery.currentCache.data,\n SOURCE_CACHE\n ),\n fetchTime: trackedQuery.currentCache.fetchTime\n });\n if (trackedQuery.lastError !== null && onErrorCallback) {\n onErrorCallback(undefined);\n }\n }\n\n trackedQuery.subscriptions.push({\n userCallback: onResultCallback,\n errCallback: onErrorCallback,\n unsubscribe\n });\n if (!trackedQuery.currentCache) {\n logDebug(\n `No cache available for query ${\n queryRef.name\n } with variables ${JSON.stringify(\n queryRef.variables\n )}. Calling executeQuery.`\n );\n const promise = this.executeQuery(queryRef as QueryRef<Data, Variables>);\n // We want to ignore the error and let subscriptions handle it\n promise.then(undefined, err => {});\n }\n return unsubscribe;\n }\n executeQuery<Data, Variables>(\n queryRef: QueryRef<Data, Variables>\n ): QueryPromise<Data, Variables> {\n if (queryRef.refType !== QUERY_STR) {\n throw new DataConnectError(\n Code.INVALID_ARGUMENT,\n `ExecuteQuery can only execute query operation`\n );\n }\n const key = encoderImpl({\n name: queryRef.name,\n variables: queryRef.variables,\n refType: QUERY_STR\n });\n const trackedQuery = this._queries.get(key)!;\n const result = this.transport.invokeQuery<Data, Variables>(\n queryRef.name,\n queryRef.variables\n );\n const newR = result.then(\n res => {\n const fetchTime = new Date().toString();\n const result: QueryResult<Data, Variables> = {\n ...res,\n source: SOURCE_SERVER,\n ref: queryRef,\n toJSON: getRefSerializer(queryRef, res.data, SOURCE_SERVER),\n fetchTime\n };\n trackedQuery.subscriptions.forEach(subscription => {\n subscription.userCallback(result);\n });\n trackedQuery.currentCache = {\n data: res.data,\n source: SOURCE_CACHE,\n fetchTime\n };\n return result;\n },\n err => {\n trackedQuery.lastError = err;\n trackedQuery.subscriptions.forEach(subscription => {\n if (subscription.errCallback) {\n subscription.errCallback(err);\n }\n });\n throw err;\n }\n );\n\n return newR;\n }\n enableEmulator(host: string, port: number): void {\n this.transport.useEmulator(host, port);\n }\n}\nfunction compareDates(str1: string, str2: string): boolean {\n const date1 = new Date(str1);\n const date2 = new Date(str2);\n return date1.getTime() < date2.getTime();\n}\n","/**\n * @license\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { DataConnectOptions, TransportOptions } from '../api/DataConnect';\nimport { Code, DataConnectError } from '../core/error';\nimport { logError } from '../logger';\n\nexport function urlBuilder(\n projectConfig: DataConnectOptions,\n transportOptions: TransportOptions\n): string {\n const { connector, location, projectId: project, service } = projectConfig;\n const { host, sslEnabled, port } = transportOptions;\n const protocol = sslEnabled ? 'https' : 'http';\n const realHost = host || `firebasedataconnect.googleapis.com`;\n let baseUrl = `${protocol}://${realHost}`;\n if (typeof port === 'number') {\n baseUrl += `:${port}`;\n } else if (typeof port !== 'undefined') {\n logError('Port type is of an invalid type');\n throw new DataConnectError(\n Code.INVALID_ARGUMENT,\n 'Incorrect type for port passed in!'\n );\n }\n return `${baseUrl}/v1beta/projects/${project}/locations/${location}/services/${service}/connectors/${connector}`;\n}\nexport function addToken(url: string, apiKey?: string): string {\n if (!apiKey) {\n return url;\n }\n const newUrl = new URL(url);\n newUrl.searchParams.append('key', apiKey);\n return newUrl.toString();\n}\n","/**\n * @license\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Code, DataConnectError } from '../core/error';\nimport { SDK_VERSION } from '../core/version';\nimport { logDebug, logError } from '../logger';\n\nlet connectFetch: typeof fetch | null = globalThis.fetch;\nexport function initializeFetch(fetchImpl: typeof fetch): void {\n connectFetch = fetchImpl;\n}\nfunction getGoogApiClientValue(_isUsingGen: boolean): string {\n let str = 'gl-js/ fire/' + SDK_VERSION;\n if (_isUsingGen) {\n str += ' js/gen';\n }\n return str;\n}\nexport interface DataConnectFetchBody<T> {\n name: string;\n operationName: string;\n variables: T;\n}\nexport function dcFetch<T, U>(\n url: string,\n body: DataConnectFetchBody<U>,\n { signal }: AbortController,\n appId: string | null,\n accessToken: string | null,\n appCheckToken: string | null,\n _isUsingGen: boolean\n): Promise<{ data: T; errors: Error[] }> {\n if (!connectFetch) {\n throw new DataConnectError(Code.OTHER, 'No Fetch Implementation detected!');\n }\n const headers: HeadersInit = {\n 'Content-Type': 'application/json',\n 'X-Goog-Api-Client': getGoogApiClientValue(_isUsingGen)\n };\n if (accessToken) {\n headers['X-Firebase-Auth-Token'] = accessToken;\n }\n if (appId) {\n headers['x-firebase-gmpid'] = appId;\n }\n if (appCheckToken) {\n headers['X-Firebase-AppCheck'] = appCheckToken;\n }\n const bodyStr = JSON.stringify(body);\n logDebug(`Making request out to ${url} with body: ${bodyStr}`);\n\n return connectFetch(url, {\n body: bodyStr,\n method: 'POST',\n headers,\n signal\n })\n .catch(err => {\n throw new DataConnectError(\n Code.OTHER,\n 'Failed to fetch: ' + JSON.stringify(err)\n );\n })\n .then(async response => {\n let jsonResponse = null;\n try {\n jsonResponse = await response.json();\n } catch (e) {\n throw new DataConnectError(Code.OTHER, JSON.stringify(e));\n }\n const message = getMessage(jsonResponse);\n if (response.status >= 400) {\n logError(\n 'Error while performing request: ' + JSON.stringify(jsonResponse)\n );\n if (response.status === 401) {\n throw new DataConnectError(Code.UNAUTHORIZED, message);\n }\n throw new DataConnectError(Code.OTHER, message);\n }\n return jsonResponse;\n })\n .then(res => {\n if (res.errors && res.errors.length) {\n const stringified = JSON.stringify(res.errors);\n logError('DataConnect error while performing request: ' + stringified);\n throw new DataConnectError(Code.OTHER, stringified);\n }\n return res;\n });\n}\ninterface MessageObject {\n message?: string;\n}\nfunction getMessage(obj: MessageObject): string {\n if ('message' in obj) {\n return obj.message;\n }\n return JSON.stringify(obj);\n}\n","/**\n * @license\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { DataConnectOptions, TransportOptions } from '../../api/DataConnect';\nimport { AppCheckTokenProvider } from '../../core/AppCheckTokenProvider';\nimport { DataConnectError, Code } from '../../core/error';\nimport { AuthTokenProvider } from '../../core/FirebaseAuthProvider';\nimport { logDebug } from '../../logger';\nimport { addToken, urlBuilder } from '../../util/url';\nimport { dcFetch } from '../fetch';\n\nimport { DataConnectTransport } from '.';\n\nexport class RESTTransport implements DataConnectTransport {\n private _host = '';\n private _port: number | undefined;\n private _location = 'l';\n private _connectorName = '';\n private _secure = true;\n private _project = 'p';\n private _serviceName: string;\n private _accessToken: string | null = null;\n private _appCheckToken: string | null = null;\n private _lastToken: string | null = null;\n constructor(\n options: DataConnectOptions,\n private apiKey?: string | undefined,\n private appId?: string,\n private authProvider?: AuthTokenProvider | undefined,\n private appCheckProvider?: AppCheckTokenProvider | undefined,\n transportOptions?: TransportOptions | undefined,\n private _isUsingGen = false\n ) {\n if (transportOptions) {\n if (typeof transportOptions.port === 'number') {\n this._port = transportOptions.port;\n }\n if (typeof transportOptions.sslEnabled !== 'undefined') {\n this._secure = transportOptions.sslEnabled;\n }\n this._host = transportOptions.host;\n }\n const { location, projectId: project, connector, service } = options;\n if (location) {\n this._location = location;\n }\n if (project) {\n this._project = project;\n }\n this._serviceName = service;\n if (!connector) {\n throw new DataConnectError(\n Code.INVALID_ARGUMENT,\n 'Connector Name required!'\n );\n }\n this._connectorName = connector;\n this.authProvider?.addTokenChangeListener(token => {\n logDebug(`New Token Available: ${token}`);\n this._accessToken = token;\n });\n this.appCheckProvider?.addTokenChangeListener(result => {\n const { token } = result;\n logDebug(`New App Check Token Available: ${token}`);\n this._appCheckToken = token;\n });\n }\n get endpointUrl(): string {\n return urlBuilder(\n {\n connector: this._connectorName,\n location: this._location,\n projectId: this._project,\n service: this._serviceName\n },\n { host: this._host, sslEnabled: this._secure, port: this._port }\n );\n }\n useEmulator(host: string, port?: number, isSecure?: boolean): void {\n this._host = host;\n if (typeof port === 'number') {\n this._port = port;\n }\n if (typeof isSecure !== 'undefined') {\n this._secure = isSecure;\n }\n }\n onTokenChanged(newToken: string | null): void {\n this._accessToken = newToken;\n }\n\n async getWithAuth(forceToken = false): Promise<string> {\n let starterPromise: Promise<string | null> = new Promise(resolve =>\n resolve(this._accessToken)\n );\n if (this.appCheckProvider) {\n this._appCheckToken = (await this.appCheckProvider.getToken())?.token;\n }\n if (this.authProvider) {\n starterPromise = this.authProvider\n .getToken(/*forceToken=*/ forceToken)\n .then(data => {\n if (!data) {\n return null;\n }\n this._accessToken = data.accessToken;\n return this._accessToken;\n });\n } else {\n starterPromise = new Promise(resolve => resolve(''));\n }\n return starterPromise;\n }\n\n _setLastToken(lastToken: string | null): void {\n this._lastToken = lastToken;\n }\n\n withRetry<T>(\n promiseFactory: () => Promise<{ data: T; errors: Error[] }>,\n retry = false\n ): Promise<{ data: T; errors: Error[] }> {\n let isNewToken = false;\n return this.getWithAuth(retry)\n .then(res => {\n isNewToken = this._lastToken !== res;\n this._lastToken = res;\n return res;\n })\n .then(promiseFactory)\n .catch(err => {\n // Only retry if the result is unauthorized and the last token isn't the same as the new one.\n if (\n 'code' in err &&\n err.code === Code.UNAUTHORIZED &&\n !retry &&\n isNewToken\n ) {\n logDebug('Retrying due to unauthorized');\n return this.withRetry(promiseFactory, true);\n }\n throw err;\n });\n }\n\n // TODO(mtewani): Update U to include shape of body defined in line 13.\n invokeQuery: <T, U>(\n queryName: string,\n body?: U\n ) => Promise<{ data: T; errors: Error[] }> = <T, U = unknown>(\n queryName: string,\n body: U\n ) => {\n const abortController = new AbortController();\n\n // TODO(mtewani): Update to proper value\n const withAuth = this.withRetry(() =>\n dcFetch<T, U>(\n addToken(`${this.endpointUrl}:executeQuery`, this.apiKey),\n {\n name: `projects/${this._project}/locations/${this._location}/services/${this._serviceName}/connectors/${this._connectorName}`,\n operationName: queryName,\n variables: body\n },\n abortController,\n this.appId,\n this._accessToken,\n this._appCheckToken,\n this._isUsingGen\n )\n );\n return withAuth;\n };\n invokeMutation: <T, U>(\n queryName: string,\n body?: U\n ) => Promise<{ data: T; errors: Error[] }> = <T, U = unknown>(\n mutationName: string,\n body: U\n ) => {\n const abortController = new AbortController();\n const taskResult = this.withRetry(() => {\n return dcFetch<T, U>(\n addToken(`${this.endpointUrl}:executeMutation`, this.apiKey),\n {\n name: `projects/${this._project}/locations/${this._location}/services/${this._serviceName}/connectors/${this._connectorName}`,\n operationName: mutationName,\n variables: body\n },\n abortController,\n this.appId,\n this._accessToken,\n this._appCheckToken,\n this._isUsingGen\n );\n });\n return taskResult;\n };\n}\n","/**\n * @license\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { DataConnectTransport } from '../network/transport';\n\nimport { DataConnect } from './DataConnect';\nimport {\n DataConnectResult,\n MUTATION_STR,\n OperationRef,\n SOURCE_SERVER\n} from './Reference';\n\nexport interface MutationRef<Data, Variables>\n extends OperationRef<Data, Variables> {\n refType: typeof MUTATION_STR;\n}\n\n/**\n * Creates a `MutationRef`\n * @param dcInstance Data Connect instance\n * @param mutationName name of mutation\n */\nexport function mutationRef<Data>(\n dcInstance: DataConnect,\n mutationName: string\n): MutationRef<Data, undefined>;\n/**\n *\n * @param dcInstance Data Connect instance\n * @param mutationName name of mutation\n * @param variables variables to send with mutation\n */\nexport function mutationRef<Data, Variables>(\n dcInstance: DataConnect,\n mutationName: string,\n variables: Variables\n): MutationRef<Data, Variables>;\n/**\n *\n * @param dcInstance Data Connect instance\n * @param mutationName name of mutation\n * @param variables variables to send with mutation\n * @returns `MutationRef`\n */\nexport function mutationRef<Data, Variables>(\n dcInstance: DataConnect,\n mutationName: string,\n variables?: Variables\n): MutationRef<Data, Variables> {\n dcInstance.setInitialized();\n const ref: MutationRef<Data, Variables> = {\n dataConnect: dcInstance,\n name: mutationName,\n refType: MUTATION_STR,\n variables: variables as Variables\n };\n return ref;\n}\n\n/**\n * @internal\n */\nexport class MutationManager {\n private _inflight: Array<Promise<unknown>> = [];\n constructor(private _transport: DataConnectTransport) {}\n executeMutation<Data, Variables>(\n mutationRef: MutationRef<Data, Variables>\n ): MutationPromise<Data, Variables> {\n const result = this._transport.invokeMutation<Data, Variables>(\n mutationRef.name,\n mutationRef.variables\n );\n const withRefPromise = result.then(res => {\n const obj: MutationResult<Data, Variables> = {\n ...res, // Double check that the result is result.data, not just result\n source: SOURCE_SERVER,\n ref: mutationRef,\n fetchTime: Date.now().toLocaleString()\n };\n return obj;\n });\n this._inflight.push(result);\n const removePromise = (): Array<Promise<unknown>> =>\n (this._inflight = this._inflight.filter(promise => promise !== result));\n result.then(removePromise, removePromise);\n return withRefPromise;\n }\n}\n\n/**\n * Mutation Result from `executeMutation`\n */\nexport interface MutationResult<Data, Variables>\n extends DataConnectResult<Data, Variables> {\n ref: MutationRef<Data, Variables>;\n}\n/**\n * Mutation return value from `executeMutation`\n */\nexport interface MutationPromise<Data, Variables>\n extends Promise<MutationResult<Data, Variables>> {\n // reserved for special actions like cancellation\n}\n\n/**\n * Execute Mutation\n * @param mutationRef mutation to execute\n * @returns `MutationRef`\n */\nexport function executeMutation<Data, Variables>(\n mutationRef: MutationRef<Data, Variables>\n): MutationPromise<Data, Variables> {\n return mutationRef.dataConnect._mutationManager.executeMutation(mutationRef);\n}\n","/**\n * @license\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n FirebaseApp,\n _getProvider,\n _removeServiceInstance,\n getApp\n} from '@firebase/app';\nimport { AppCheckInternalComponentName } from '@firebase/app-check-interop-types';\nimport { FirebaseAuthInternalName } from '@firebase/auth-interop-types';\nimport { Provider } from '@firebase/component';\n\nimport { AppCheckTokenProvider } from '../core/AppCheckTokenProvider';\nimport { Code, DataConnectError } from '../core/error';\nimport {\n AuthTokenProvider,\n FirebaseAuthProvider\n} from '../core/FirebaseAuthProvider';\nimport { QueryManager } from '../core/QueryManager';\nimport { logDebug, logError } from '../logger';\nimport { DataConnectTransport, TransportClass } from '../network';\nimport { RESTTransport } from '../network/transport/rest';\n\nimport { MutationManager } from './Mutation';\n\n/**\n * Connector Config for calling Data Connect backend.\n */\nexport interface ConnectorConfig {\n location: string;\n connector: string;\n service: string;\n}\n\n/**\n * Options to connect to emulator\n */\nexport interface TransportOptions {\n host: string;\n sslEnabled?: boolean;\n port?: number;\n}\n\nconst FIREBASE_DATA_CONNECT_EMULATOR_HOST_VAR =\n 'FIREBASE_DATA_CONNECT_EMULATOR_HOST';\n\n/**\n *\n * @param fullHost\n * @returns TransportOptions\n * @internal\n */\nexport function parseOptions(fullHost: string): TransportOptions {\n const [protocol, hostName] = fullHost.split('://');\n const isSecure = protocol === 'https';\n const [host, portAsString] = hostName.split(':');\n const port = Number(portAsString);\n return { host, port, sslEnabled: isSecure };\n}\n/**\n * DataConnectOptions including project id\n */\nexport interface DataConnectOptions extends ConnectorConfig {\n projectId: string;\n}\n\n/**\n * Class representing Firebase Data Connect\n */\nexport class DataConnect {\n _queryManager!: QueryManager;\n _mutationManager!: MutationManager;\n isEmulator = false;\n _initialized = false;\n private _transport!: DataConnectTransport;\n private _transportClass: TransportClass | undefined;\n private _transportOptions?: TransportOptions;\n private _authTokenProvider?: AuthTokenProvider;\n _isUsingGeneratedSdk: boolean = false;\n private _appCheckTokenProvider?: AppCheckTokenProvider;\n // @internal\n constructor(\n public readonly app: FirebaseApp,\n // TODO(mtewani): Replace with _dataConnectOptions in the future\n private readonly dataConnectOptions: DataConnectOptions,\n private readonly _authProvider: Provider<FirebaseAuthInternalName>,\n private readonly _appCheckProvider: Provider<AppCheckInternalComponentName>\n ) {\n if (typeof process !== 'undefined' && process.env) {\n const host = process.env[FIREBASE_DATA_CONNECT_EMULATOR_HOST_VAR];\n if (host) {\n logDebug('Found custom host. Using emulator');\n this.isEmulator = true;\n this._transportOptions = parseOptions(host);\n }\n }\n }\n // @internal\n _useGeneratedSdk(): void {\n if (!this._isUsingGeneratedSdk) {\n this._isUsingGeneratedSdk = true;\n }\n }\n _delete(): Promise<void> {\n _removeServiceInstance(\n this.app,\n 'data-connect',\n JSON.stringify(this.getSettings())\n );\n return Promise.resolve();\n }\n\n // @internal\n getSettings(): ConnectorConfig {\n const copy = JSON.parse(JSON.stringify(this.dataConnectOptions));\n delete copy.projectId;\n return copy;\n }\n\n // @internal\n setInitialized(): void {\n if (this._initialized) {\n return;\n }\n if (this._transportClass === undefined) {\n logDebug('transportClass not provided. Defaulting to RESTTransport.');\n this._transportClass = RESTTransport;\n }\n\n if (this._authProvider) {\n this._authTokenProvider = new FirebaseAuthProvider(\n this.app.name,\n this.app.options,\n this._authProvider\n );\n }\n if (this._appCheckProvider) {\n this._appCheckTokenProvider = new AppCheckTokenProvider(\n this.app,\n this._appCheckProvider\n );\n }\n\n this._initialized = true;\n this._transport = new this._transportClass(\n this.dataConnectOptions,\n this.app.options.apiKey,\n this.app.options.appId,\n this._authTokenProvider,\n this._appCheckTokenProvider,\n undefined,\n this._isUsingGeneratedSdk\n );\n if (this._transportOptions) {\n this._transport.useEmulator(\n this._transportOptions.host,\n this._transportOptions.port,\n this._transportOptions.sslEnabled\n );\n }\n this._queryManager = new QueryManager(this._transport);\n this._mutationManager = new MutationManager(this._transport);\n }\n\n // @internal\n enableEmulator(transportOptions: TransportOptions): void {\n if (\n this._initialized &&\n !areTransportOptionsEqual(this._transportOptions, transportOptions)\n ) {\n logError('enableEmulator called after initialization');\n throw new DataConnectError(\n Code.ALREADY_INITIALIZED,\n 'DataConnect instance already initialized!'\n );\n }\n this._transportOptions = transportOptions;\n this.isEmulator = true;\n }\n}\n\n/**\n * @internal\n * @param transportOptions1\n * @param transportOptions2\n * @returns\n */\nexport function areTransportOptionsEqual(\n transportOptions1: TransportOptions,\n transportOptions2: TransportOptions\n): boolean {\n return (\n transportOptions1.host === transportOptions2.host &&\n transportOptions1.port === transportOptions2.port &&\n transportOptions1.sslEnabled === transportOptions2.sslEnabled\n );\n}\n\n/**\n * Connect to the DataConnect Emulator\n * @param dc Data Connect instance\n * @param host host of emulator server\n * @param port port of emulator server\n * @param sslEnabled use https\n */\nexport function connectDataConnectEmulator(\n dc: DataConnect,\n host: string,\n port?: number,\n sslEnabled = false\n): void {\n dc.enableEmulator({ host, port, sslEnabled });\n}\n\n/**\n * Initialize DataConnect instance\n * @param options ConnectorConfig\n */\nexport function getDataConnect(options: ConnectorConfig): DataConnect;\n/**\n * Initialize DataConnect instance\n * @param app FirebaseApp to initialize to.\n * @param options ConnectorConfig\n */\nexport function getDataConnect(\n app: FirebaseApp,\n options: ConnectorConfig\n): DataConnect;\nexport function getDataConnect(\n appOrOptions: FirebaseApp | ConnectorConfig,\n optionalOptions?: ConnectorConfig\n): DataConnect {\n let app: FirebaseApp;\n let dcOptions: ConnectorConfig;\n if ('location' in appOrOptions) {\n dcOptions = appOrOptions;\n app = getApp();\n } else {\n dcOptions = optionalOptions!;\n app = appOrOptions;\n }\n\n if (!app || Object.keys(app).length === 0) {\n app = getApp();\n }\n const provider = _getProvider(app, 'data-connect');\n const identifier = JSON.stringify(dcOptions);\n if (provider.isInitialized(identifier)) {\n const dcInstance = provider.getImmediate({ identifier });\n const options = provider.getOptions(identifier);\n const optionsValid = Object.keys(options).length > 0;\n if (optionsValid) {\n logDebug('Re-using cached instance');\n return dcInstance;\n }\n }\n validateDCOptions(dcOptions);\n\n logDebug('Creating new DataConnect instance');\n // Initialize with options.\n return provider.initialize({\n instanceIdentifier: identifier,\n options: dcOptions\n });\n}\n\n/**\n *\n * @param dcOptions\n * @returns {void}\n * @internal\n */\nexport function validateDCOptions(dcOptions: ConnectorConfig): boolean {\n const fields = ['connector', 'location', 'service'];\n if (!dcOptions) {\n throw new DataConnectError(Code.INVALID_ARGUMENT, 'DC Option Required');\n }\n fields.forEach(field => {\n if (dcOptions[field] === null || dcOptions[field] === undefined) {\n throw new DataConnectError(Code.INVALID_ARGUMENT, `${field} Required`);\n }\n });\n return true;\n}\n\n/**\n * Delete DataConnect instance\n * @param dataConnect DataConnect instance\n * @returns\n */\nexport function terminate(dataConnect: DataConnect): Promise<void> {\n return dataConnect._delete();\n // TODO(mtewani): Stop pending tasks\n}\n","/**\n * @license\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport {\n _registerComponent,\n registerVersion,\n SDK_VERSION\n} from '@firebase/app';\nimport { Component, ComponentType } from '@firebase/component';\n\nimport { name, version } from '../package.json';\nimport { setSDKVersion } from '../src/core/version';\n\nimport { DataConnect, ConnectorConfig } from './api/DataConnect';\nimport { Code, DataConnectError } from './core/error';\n\nexport function registerDataConnect(variant?: string): void {\n setSDKVersion(SDK_VERSION);\n _registerComponent(\n new Component(\n 'data-connect',\n (container, { instanceIdentifier: settings, options }) => {\n const app = container.getProvider('app').getImmediate()!;\n const authProvider = container.getProvider('auth-internal');\n const appCheckProvider = container.getProvider('app-check-internal');\n let newOpts = options as ConnectorConfig;\n if (settings) {\n newOpts = JSON.parse(settings);\n }\n if (!app.options.projectId) {\n throw new DataConnectError(\n Code.INVALID_ARGUMENT,\n 'Project ID must be provided. Did you pass in a proper projectId to initializeApp?'\n );\n }\n return new DataConnect(\n app,\n { ...newOpts, projectId: app.options.projectId! },\n authProvider,\n appCheckProvider\n );\n },\n ComponentType.PUBLIC\n ).setMultipleInstances(true)\n );\n registerVersion(name, version, variant);\n // BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation\n registerVersion(name, version, '__BUILD_TARGET__');\n}\n","/**\n * @license\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { DataConnectError } from '../core/error';\n\nimport { DataConnect, getDataConnect } from './DataConnect';\nimport {\n OperationRef,\n QUERY_STR,\n DataConnectResult,\n SerializedRef\n} from './Reference';\n\n/**\n * Signature for `OnResultSubscription` for `subscribe`\n */\nexport type OnResultSubscription<Data, Variables> = (\n res: QueryResult<Data, Variables>\n) => void;\n/**\n * Signature for `OnErrorSubscription` for `subscribe`\n */\nexport type OnErrorSubscription = (err?: DataConnectError) => void;\n/**\n * Signature for unsubscribe from `subscribe`\n */\nexport type QueryUnsubscribe = () => void;\n/**\n * Representation of user provided subscription options.\n */\nexport interface DataConnectSubscription<Data, Variables> {\n userCallback: OnResultSubscription<Data, Variables>;\n errCallback?: (e?: DataConnectError) => void;\n unsubscribe: () => void;\n}\n\n/**\n * QueryRef object\n */\nexport interface QueryRef<Data, Variables>\n extends OperationRef<Data, Variables> {\n refType: typeof QUERY_STR;\n}\n/**\n * Result of `executeQuery`\n */\nexport interface QueryResult<Data, Variables>\n extends DataConnectResult<Data, Variables> {\n ref: QueryRef<Data, Variables>;\n toJSON: () => SerializedRef<Data, Variables>;\n}\n/**\n * Promise returned from `executeQuery`\n */\nexport interface QueryPromise<Data, Variables>\n extends Promise<QueryResult<Data, Variables>> {\n // reserved for special actions like cancellation\n}\n\n/**\n * Execute Query\n * @param queryRef query to execute.\n * @returns `QueryPromise`\n */\nexport function executeQuery<Data, Variables>(\n queryRef: QueryRef<Data, Variables>\n): QueryPromise<Data, Variables> {\n return queryRef.dataConnect._queryManager.executeQuery(queryRef);\n}\n\n/**\n * Execute Query\n * @param dcInstance Data Connect instance to use.\n * @param queryName Query to execute\n * @returns `QueryRef`\n */\nexport function queryRef<Data>(\n dcInstance: DataConnect,\n queryName: string\n): QueryRef<Data, undefined>;\n/**\n * Execute Query\n * @param dcInstance Data Connect instance to use.\n * @param queryName Query to execute\n * @param variables Variables to execute with\n * @returns `QueryRef`\n */\nexport function queryRef<Data, Variables>(\n dcInstance: DataConnect,\n queryName: string,\n variables: Variables\n): QueryRef<Data, Variables>;\n/**\n * Execute Query\n * @param dcInstance Data Connect instance to use.\n * @param queryName Query to execute\n * @param variables Variables to execute with\n * @param initialCache initial cache to use for client hydration\n * @returns `QueryRef`\n */\nexport function queryRef<Data, Variables>(\n dcInstance: DataConnect,\n queryName: string,\n variables?: Variables,\n initialCache?: QueryResult<Data, Variables>\n): QueryRef<Data, Variables> {\n dcInstance.setInitialized();\n dcInstance._queryManager.track(queryName, variables, initialCache);\n return {\n dataConnect: dcInstance,\n refType: QUERY_STR,\n name: queryName,\n variables\n };\n}\n/**\n * Converts serialized ref to query ref\n * @param serializedRef ref to convert to `QueryRef`\n * @returns `QueryRef`\n */\nexport function toQueryRef<Data, Variables>(\n serializedRef: SerializedRef<Data, Variables>\n): QueryRef<Data, Variables> {\n const {\n refInfo: { name, variables, connectorConfig }\n } = serializedRef;\n return queryRef(getDataConnect(connectorConfig), name, variables);\n}\n/**\n * `OnCompleteSubscription`\n */\nexport type OnCompleteSubscription = () => void;\n/**\n * Representation of full observer options in `subscribe`\n */\nexport interface SubscriptionOptions<Data, Variables> {\n onNext?: OnResultSubscription<Data, Variables>;\n onErr?: OnErrorSubscription;\n onComplete?: OnCompleteSubscription;\n}\n","/**\n * @license\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n ConnectorConfig,\n DataConnect,\n getDataConnect\n} from '../api/DataConnect';\nimport { Code, DataConnectError } from '../core/error';\ninterface ParsedArgs<Variables> {\n dc: DataConnect;\n vars: Variables;\n}\n\n/**\n * The generated SDK will allow the user to pass in either the variable or the data connect instance with the variable,\n * and this function validates the variables and returns back the DataConnect instance and variables based on the arguments passed in.\n * @param connectorConfig\n * @param dcOrVars\n * @param vars\n * @param validateVars\n * @returns {DataConnect} and {Variables} instance\n * @internal\n */\nexport function validateArgs<Variables extends object>(\n connectorConfig: ConnectorConfig,\n dcOrVars?: DataConnect | Variables,\n vars?: Variables,\n validateVars?: boolean\n): ParsedArgs<Variables> {\n let dcInstance: DataConnect;\n let realVars: Variables;\n if (dcOrVars && 'enableEmulator' in dcOrVars) {\n dcInstance = dcOrVars as DataConnect;\n realVars = vars;\n } else {\n dcInstance = getDataConnect(connectorConfig);\n realVars = dcOrVars as Variables;\n }\n if (!dcInstance || (!realVars && validateVars)) {\n throw new DataConnectError(Code.INVALID_ARGUMENT, 'Variables required.');\n }\n return { dc: dcInstance, vars: realVars };\n}\n","/**\n * @license\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n OnCompleteSubscription,\n OnErrorSubscription,\n OnResultSubscription,\n QueryRef,\n QueryUnsubscribe,\n SubscriptionOptions,\n toQueryRef\n} from './api/query';\nimport { OpResult, SerializedRef } from './api/Reference';\nimport { DataConnectError, Code } from './core/error';\n\n/**\n * Subscribe to a `QueryRef`\n * @param queryRefOrSerializedResult query ref or serialized result.\n * @param observer observer object to use for subscribing.\n * @returns `SubscriptionOptions`\n */\nexport function subscribe<Data, Variables>(\n queryRefOrSerializedResult:\n | QueryRef<Data, Variables>\n | SerializedRef<Data, Variables>,\n observer: SubscriptionOptions<Data, Variables>\n): QueryUnsubscribe;\n/**\n * Subscribe to a `QueryRef`\n * @param queryRefOrSerializedResult query ref or serialized result.\n * @param onNext Callback to call when result comes back.\n * @param onError Callback to call when error gets thrown.\n * @param onComplete Called when subscription completes.\n * @returns `SubscriptionOptions`\n */\nexport function subscribe<Data, Variables>(\n queryRefOrSerializedResult:\n | QueryRef<Data, Variables>\n | SerializedRef<Data, Variables>,\n onNext: OnResultSubscription<Data, Variables>,\n onError?: OnErrorSubscription,\n onComplete?: OnCompleteSubscription\n): QueryUnsubscribe;\n/**\n * Subscribe to a `QueryRef`\n * @param queryRefOrSerializedResult query ref or serialized result.\n * @param observerOrOnNext observer object or next function.\n * @param onError Callback to call when error gets thrown.\n * @param onComplete Called when subscription completes.\n * @returns `SubscriptionOptions`\n */\nexport function subscribe<Data, Variables>(\n queryRefOrSerializedResult:\n | QueryRef<Data, Variables>\n | SerializedRef<Data, Variables>,\n observerOrOnNext:\n | SubscriptionOptions<Data, Variables>\n | OnResultSubscription<Data, Variables>,\n onError?: OnErrorSubscription,\n onComplete?: OnCompleteSubscription\n): QueryUnsubscribe {\n let ref: QueryRef<Data, Variables>;\n let initialCache: OpResult<Data> | undefined;\n if ('refInfo' in queryRefOrSerializedResult) {\n const serializedRef: SerializedRef<Data, Variables> =\n queryRefOrSerializedResult;\n const { data, source, fetchTime } = serializedRef;\n initialCache = {\n data,\n source,\n fetchTime\n };\n ref = toQueryRef(serializedRef);\n } else {\n ref = queryRefOrSerializedResult;\n }\n let onResult: OnResultSubscription<Data, Variables> | undefined = undefined;\n if (typeof observerOrOnNext === 'function') {\n onResult = observerOrOnNext;\n } else {\n onResult = observerOrOnNext.onNext;\n onError = observerOrOnNext.onErr;\n onComplete = observerOrOnNext.onComplete;\n }\n if (!onResult) {\n throw new DataConnectError(Code.INVALID_ARGUMENT, 'Must provide onNext');\n }\n return ref.dataConnect._queryManager.addSubscription(\n ref,\n onResult,\n onError,\n initialCache\n );\n}\n","/**\n * Firebase Data Connect\n *\n * @packageDocumentation\n */\n\n/**\n * @license\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { DataConnect } from './api/DataConnect';\nimport { registerDataConnect } from './register';\n\nexport * from './api';\nexport * from './api.browser';\n\nregisterDataConnect();\n\ndeclare module '@firebase/component' {\n interface NameServiceMapping {\n 'data-connect': DataConnect;\n }\n}\n"],"names":["app","_isFirebaseServerApp","FirebaseError","Logger","_removeServiceInstance","getApp","_getProvider","SDK_VERSION","_registerComponent","Component","registerVersion"],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;AAeG;AAEH;AACO,IAAI,WAAW,GAAG,EAAE,CAAC;AAE5B;;;AAGG;AACG,SAAU,aAAa,CAAC,OAAe,EAAA;IAC3C,WAAW,GAAG,OAAO,CAAC;AACxB;;AC1BA;;;;;;;;;;;;;;;AAeG;AAWH;;;AAGG;MACU,qBAAqB,CAAA;IAGhC,WACE,CAAAA,KAAgB,EACR,gBAA0D,EAAA;QAA1D,IAAgB,CAAA,gBAAA,GAAhB,gBAAgB,CAA0C;QAElE,IAAIC,wBAAoB,CAACD,KAAG,CAAC,IAAIA,KAAG,CAAC,QAAQ,CAAC,aAAa,EAAE;YAC3D,IAAI,CAAC,sBAAsB,GAAGA,KAAG,CAAC,QAAQ,CAAC,aAAa,CAAC;SAC1D;AACD,QAAA,IAAI,CAAC,QAAQ,GAAG,gBAAgB,KAAA,IAAA,IAAhB,gBAAgB,KAAhB,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,gBAAgB,CAAE,YAAY,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;AACnE,QAAA,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YAClB,MAAK,gBAAgB,KAAA,IAAA,IAAhB,gBAAgB,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAhB,gBAAgB,CACjB,GAAG,EAAA,CACJ,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC,CAC3C,CAAA,KAAK,EAAE,CAAA,CAAC;SACZ;KACF;IAED,QAAQ,GAAA;AACN,QAAA,IAAI,IAAI,CA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core/version.ts","../src/core/AppCheckTokenProvider.ts","../src/core/error.ts","../src/logger.ts","../src/core/FirebaseAuthProvider.ts","../src/api/Reference.ts","../src/util/encoder.ts","../src/util/map.ts","../src/core/QueryManager.ts","../src/network/transport/index.ts","../src/util/url.ts","../src/network/fetch.ts","../src/network/transport/rest.ts","../src/api/Mutation.ts","../src/api/DataConnect.ts","../src/register.ts","../src/api/query.ts","../src/util/validateArgs.ts","../src/api.browser.ts","../src/index.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** The semver (www.semver.org) version of the SDK. */\nexport let SDK_VERSION = '';\n\n/**\n * SDK_VERSION should be set before any database instance is created\n * @internal\n */\nexport function setSDKVersion(version: string): void {\n SDK_VERSION = version;\n}\n","/**\n * @license\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { FirebaseApp, _isFirebaseServerApp } from '@firebase/app';\nimport {\n AppCheckInternalComponentName,\n AppCheckTokenListener,\n AppCheckTokenResult,\n FirebaseAppCheckInternal\n} from '@firebase/app-check-interop-types';\nimport { Provider } from '@firebase/component';\n\n/**\n * @internal\n * Abstraction around AppCheck's token fetching capabilities.\n */\nexport class AppCheckTokenProvider {\n private appCheck?: FirebaseAppCheckInternal;\n private serverAppAppCheckToken?: string;\n constructor(\n app: FirebaseApp,\n private appCheckProvider?: Provider<AppCheckInternalComponentName>\n ) {\n if (_isFirebaseServerApp(app) && app.settings.appCheckToken) {\n this.serverAppAppCheckToken = app.settings.appCheckToken;\n }\n this.appCheck = appCheckProvider?.getImmediate({ optional: true });\n if (!this.appCheck) {\n void appCheckProvider\n ?.get()\n .then(appCheck => (this.appCheck = appCheck))\n .catch();\n }\n }\n\n getToken(): Promise<AppCheckTokenResult> {\n if (this.serverAppAppCheckToken) {\n return Promise.resolve({ token: this.serverAppAppCheckToken });\n }\n\n if (!this.appCheck) {\n return new Promise<AppCheckTokenResult>((resolve, reject) => {\n // Support delayed initialization of FirebaseAppCheck. This allows our\n // customers to initialize the RTDB SDK before initializing Firebase\n // AppCheck and ensures that all requests are authenticated if a token\n // becomes available before the timoeout below expires.\n setTimeout(() => {\n if (this.appCheck) {\n this.getToken().then(resolve, reject);\n } else {\n resolve(null);\n }\n }, 0);\n });\n }\n return this.appCheck.getToken();\n }\n\n addTokenChangeListener(listener: AppCheckTokenListener): void {\n void this.appCheckProvider\n ?.get()\n .then(appCheck => appCheck.addTokenListener(listener));\n }\n}\n","/**\n * @license\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { FirebaseError } from '@firebase/util';\n\nexport type DataConnectErrorCode =\n | 'other'\n | 'already-initialized'\n | 'not-initialized'\n | 'not-supported'\n | 'invalid-argument'\n | 'partial-error'\n | 'unauthorized';\n\nexport type Code = DataConnectErrorCode;\n\nexport const Code = {\n OTHER: 'other' as DataConnectErrorCode,\n ALREADY_INITIALIZED: 'already-initialized' as DataConnectErrorCode,\n NOT_INITIALIZED: 'not-initialized' as DataConnectErrorCode,\n NOT_SUPPORTED: 'not-supported' as DataConnectErrorCode,\n INVALID_ARGUMENT: 'invalid-argument' as DataConnectErrorCode,\n PARTIAL_ERROR: 'partial-error' as DataConnectErrorCode,\n UNAUTHORIZED: 'unauthorized' as DataConnectErrorCode\n};\n\n/** An error returned by a DataConnect operation. */\nexport class DataConnectError extends FirebaseError {\n /** The stack of the error. */\n readonly stack?: string;\n\n /** @hideconstructor */\n constructor(\n /**\n * The backend error code associated with this error.\n */\n readonly code: DataConnectErrorCode,\n /**\n * A custom error description.\n */\n readonly message: string\n ) {\n super(code, message);\n\n // HACK: We write a toString property directly because Error is not a real\n // class and so inheritance does not work correctly. We could alternatively\n // do the same \"back-door inheritance\" trick that FirebaseError does.\n this.toString = () => `${this.name}: [code=${this.code}]: ${this.message}`;\n }\n}\n","/**\n * @license\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { Logger, LogLevelString } from '@firebase/logger';\n\nimport { SDK_VERSION } from './core/version';\n\nconst logger = new Logger('@firebase/data-connect');\nexport function setLogLevel(logLevel: LogLevelString): void {\n logger.setLogLevel(logLevel);\n}\nexport function logDebug(msg: string): void {\n logger.debug(`DataConnect (${SDK_VERSION}): ${msg}`);\n}\n\nexport function logError(msg: string): void {\n logger.error(`DataConnect (${SDK_VERSION}): ${msg}`);\n}\n","/**\n * @license\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { FirebaseOptions } from '@firebase/app-types';\nimport {\n FirebaseAuthInternal,\n FirebaseAuthInternalName,\n FirebaseAuthTokenData\n} from '@firebase/auth-interop-types';\nimport { Provider } from '@firebase/component';\n\nimport { logDebug, logError } from '../logger';\n\n// @internal\nexport interface AuthTokenProvider {\n getToken(forceRefresh: boolean): Promise<FirebaseAuthTokenData | null>;\n addTokenChangeListener(listener: AuthTokenListener): void;\n}\nexport type AuthTokenListener = (token: string | null) => void;\n\n// @internal\nexport class FirebaseAuthProvider implements AuthTokenProvider {\n private _auth: FirebaseAuthInternal;\n constructor(\n private _appName: string,\n private _options: FirebaseOptions,\n private _authProvider: Provider<FirebaseAuthInternalName>\n ) {\n this._auth = _authProvider.getImmediate({ optional: true })!;\n if (!this._auth) {\n _authProvider.onInit(auth => (this._auth = auth));\n }\n }\n getToken(forceRefresh: boolean): Promise<FirebaseAuthTokenData | null> {\n if (!this._auth) {\n return new Promise((resolve, reject) => {\n setTimeout(() => {\n if (this._auth) {\n this.getToken(forceRefresh).then(resolve, reject);\n } else {\n resolve(null);\n }\n }, 0);\n });\n }\n return this._auth.getToken(forceRefresh).catch(error => {\n if (error && error.code === 'auth/token-not-initialized') {\n logDebug(\n 'Got auth/token-not-initialized error. Treating as null token.'\n );\n return null;\n } else {\n logError(\n 'Error received when attempting to retrieve token: ' +\n JSON.stringify(error)\n );\n return Promise.reject(error);\n }\n });\n }\n addTokenChangeListener(listener: AuthTokenListener): void {\n this._auth?.addAuthTokenListener(listener);\n }\n removeTokenChangeListener(listener: (token: string | null) => void): void {\n this._authProvider\n .get()\n .then(auth => auth.removeAuthTokenListener(listener))\n .catch(err => logError(err));\n }\n}\n","/**\n * @license\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { DataConnect, DataConnectOptions } from './DataConnect';\nexport const QUERY_STR = 'query';\nexport const MUTATION_STR = 'mutation';\nexport type ReferenceType = typeof QUERY_STR | typeof MUTATION_STR;\n\nexport const SOURCE_SERVER = 'SERVER';\nexport const SOURCE_CACHE = 'CACHE';\nexport type DataSource = typeof SOURCE_CACHE | typeof SOURCE_SERVER;\n\nexport interface OpResult<Data> {\n data: Data;\n source: DataSource;\n fetchTime: string;\n}\n\nexport interface OperationRef<_Data, Variables> {\n name: string;\n variables: Variables;\n refType: ReferenceType;\n dataConnect: DataConnect;\n}\n\nexport interface DataConnectResult<Data, Variables> extends OpResult<Data> {\n ref: OperationRef<Data, Variables>;\n // future metadata\n}\n\n/**\n * Serialized RefInfo as a result of `QueryResult.toJSON().refInfo`\n */\nexport interface RefInfo<Variables> {\n name: string;\n variables: Variables;\n connectorConfig: DataConnectOptions;\n}\n/**\n * Serialized Ref as a result of `QueryResult.toJSON()`\n */\nexport interface SerializedRef<Data, Variables> extends OpResult<Data> {\n refInfo: RefInfo<Variables>;\n}\n","/**\n * @license\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport type HmacImpl = (obj: unknown) => string;\nexport let encoderImpl: HmacImpl;\nexport function setEncoder(encoder: HmacImpl): void {\n encoderImpl = encoder;\n}\nsetEncoder(o => JSON.stringify(o));\n","/**\n * @license\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport function setIfNotExists<T>(\n map: Map<string, T>,\n key: string,\n val: T\n): void {\n if (!map.has(key)) {\n map.set(key, val);\n }\n}\n","/**\n * @license\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n DataConnectSubscription,\n OnErrorSubscription,\n OnResultSubscription,\n QueryPromise,\n QueryRef,\n QueryResult\n} from '../api/query';\nimport {\n OperationRef,\n QUERY_STR,\n OpResult,\n SerializedRef,\n SOURCE_SERVER,\n DataSource,\n SOURCE_CACHE\n} from '../api/Reference';\nimport { logDebug } from '../logger';\nimport { DataConnectTransport } from '../network';\nimport { encoderImpl } from '../util/encoder';\nimport { setIfNotExists } from '../util/map';\n\nimport { Code, DataConnectError } from './error';\n\ninterface TrackedQuery<Data, Variables> {\n ref: Omit<OperationRef<Data, Variables>, 'dataConnect'>;\n subscriptions: Array<DataConnectSubscription<Data, Variables>>;\n currentCache: OpResult<Data> | null;\n lastError: DataConnectError | null;\n}\n\nfunction getRefSerializer<Data, Variables>(\n queryRef: QueryRef<Data, Variables>,\n data: Data,\n source: DataSource\n) {\n return function toJSON(): SerializedRef<Data, Variables> {\n return {\n data,\n refInfo: {\n name: queryRef.name,\n variables: queryRef.variables,\n connectorConfig: {\n projectId: queryRef.dataConnect.app.options.projectId!,\n ...queryRef.dataConnect.getSettings()\n }\n },\n fetchTime: Date.now().toLocaleString(),\n source\n };\n };\n}\n\nexport class QueryManager {\n _queries: Map<string, TrackedQuery<unknown, unknown>>;\n constructor(private transport: DataConnectTransport) {\n this._queries = new Map();\n }\n track<Data, Variables>(\n queryName: string,\n variables: Variables,\n initialCache?: OpResult<Data>\n ): TrackedQuery<Data, Variables> {\n const ref: TrackedQuery<Data, Variables>['ref'] = {\n name: queryName,\n variables,\n refType: QUERY_STR\n };\n const key = encoderImpl(ref);\n const newTrackedQuery: TrackedQuery<Data, Variables> = {\n ref,\n subscriptions: [],\n currentCache: initialCache || null,\n lastError: null\n };\n // @ts-ignore\n setIfNotExists(this._queries, key, newTrackedQuery);\n return this._queries.get(key) as TrackedQuery<Data, Variables>;\n }\n addSubscription<Data, Variables>(\n queryRef: OperationRef<Data, Variables>,\n onResultCallback: OnResultSubscription<Data, Variables>,\n onErrorCallback?: OnErrorSubscription,\n initialCache?: OpResult<Data>\n ): () => void {\n const key = encoderImpl({\n name: queryRef.name,\n variables: queryRef.variables,\n refType: QUERY_STR\n });\n const trackedQuery = this._queries.get(key) as TrackedQuery<\n Data,\n Variables\n >;\n const subscription = {\n userCallback: onResultCallback,\n errCallback: onErrorCallback\n };\n const unsubscribe = (): void => {\n const trackedQuery = this._queries.get(key)!;\n trackedQuery.subscriptions = trackedQuery.subscriptions.filter(\n sub => sub !== subscription\n );\n };\n if (initialCache && trackedQuery.currentCache !== initialCache) {\n logDebug('Initial cache found. Comparing dates.');\n if (\n !trackedQuery.currentCache ||\n (trackedQuery.currentCache &&\n compareDates(\n trackedQuery.currentCache.fetchTime,\n initialCache.fetchTime\n ))\n ) {\n trackedQuery.currentCache = initialCache;\n }\n }\n if (trackedQuery.currentCache !== null) {\n const cachedData = trackedQuery.currentCache.data;\n onResultCallback({\n data: cachedData,\n source: SOURCE_CACHE,\n ref: queryRef as QueryRef<Data, Variables>,\n toJSON: getRefSerializer(\n queryRef as QueryRef<Data, Variables>,\n trackedQuery.currentCache.data,\n SOURCE_CACHE\n ),\n fetchTime: trackedQuery.currentCache.fetchTime\n });\n if (trackedQuery.lastError !== null && onErrorCallback) {\n onErrorCallback(undefined);\n }\n }\n\n trackedQuery.subscriptions.push({\n userCallback: onResultCallback,\n errCallback: onErrorCallback,\n unsubscribe\n });\n if (!trackedQuery.currentCache) {\n logDebug(\n `No cache available for query ${\n queryRef.name\n } with variables ${JSON.stringify(\n queryRef.variables\n )}. Calling executeQuery.`\n );\n const promise = this.executeQuery(queryRef as QueryRef<Data, Variables>);\n // We want to ignore the error and let subscriptions handle it\n promise.then(undefined, err => {});\n }\n return unsubscribe;\n }\n executeQuery<Data, Variables>(\n queryRef: QueryRef<Data, Variables>\n ): QueryPromise<Data, Variables> {\n if (queryRef.refType !== QUERY_STR) {\n throw new DataConnectError(\n Code.INVALID_ARGUMENT,\n `ExecuteQuery can only execute query operation`\n );\n }\n const key = encoderImpl({\n name: queryRef.name,\n variables: queryRef.variables,\n refType: QUERY_STR\n });\n const trackedQuery = this._queries.get(key)!;\n const result = this.transport.invokeQuery<Data, Variables>(\n queryRef.name,\n queryRef.variables\n );\n const newR = result.then(\n res => {\n const fetchTime = new Date().toString();\n const result: QueryResult<Data, Variables> = {\n ...res,\n source: SOURCE_SERVER,\n ref: queryRef,\n toJSON: getRefSerializer(queryRef, res.data, SOURCE_SERVER),\n fetchTime\n };\n trackedQuery.subscriptions.forEach(subscription => {\n subscription.userCallback(result);\n });\n trackedQuery.currentCache = {\n data: res.data,\n source: SOURCE_CACHE,\n fetchTime\n };\n return result;\n },\n err => {\n trackedQuery.lastError = err;\n trackedQuery.subscriptions.forEach(subscription => {\n if (subscription.errCallback) {\n subscription.errCallback(err);\n }\n });\n throw err;\n }\n );\n\n return newR;\n }\n enableEmulator(host: string, port: number): void {\n this.transport.useEmulator(host, port);\n }\n}\nfunction compareDates(str1: string, str2: string): boolean {\n const date1 = new Date(str1);\n const date2 = new Date(str2);\n return date1.getTime() < date2.getTime();\n}\n","/**\n * @license\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { DataConnectOptions, TransportOptions } from '../../api/DataConnect';\nimport { AppCheckTokenProvider } from '../../core/AppCheckTokenProvider';\nimport { AuthTokenProvider } from '../../core/FirebaseAuthProvider';\n\n/**\n * enum representing different flavors of the SDK used by developers\n * use the CallerSdkType for type-checking, and the CallerSdkTypeEnum for value-checking/assigning\n */\nexport type CallerSdkType =\n | 'Base' // Core JS SDK\n | 'Generated' // Generated JS SDK\n | 'TanstackReactCore' // Tanstack non-generated React SDK\n | 'GeneratedReact' // Generated React SDK\n | 'TanstackAngularCore' // Tanstack non-generated Angular SDK\n | 'GeneratedAngular'; // Generated Angular SDK\nexport const CallerSdkTypeEnum = {\n Base: 'Base', // Core JS SDK\n Generated: 'Generated', // Generated JS SDK\n TanstackReactCore: 'TanstackReactCore', // Tanstack non-generated React SDK\n GeneratedReact: 'GeneratedReact', // Tanstack non-generated Angular SDK\n TanstackAngularCore: 'TanstackAngularCore', // Tanstack non-generated Angular SDK\n GeneratedAngular: 'GeneratedAngular' // Generated Angular SDK\n} as const;\n\n/**\n * @internal\n */\nexport interface DataConnectTransport {\n invokeQuery<T, U>(\n queryName: string,\n body?: U\n ): Promise<{ data: T; errors: Error[] }>;\n invokeMutation<T, U>(\n queryName: string,\n body?: U\n ): Promise<{ data: T; errors: Error[] }>;\n useEmulator(host: string, port?: number, sslEnabled?: boolean): void;\n onTokenChanged: (token: string | null) => void;\n _setCallerSdkType(callerSdkType: CallerSdkType): void;\n}\n\n/**\n * @internal\n */\nexport type TransportClass = new (\n options: DataConnectOptions,\n apiKey?: string,\n appId?: string,\n authProvider?: AuthTokenProvider,\n appCheckProvider?: AppCheckTokenProvider,\n transportOptions?: TransportOptions,\n _isUsingGen?: boolean,\n _callerSdkType?: CallerSdkType\n) => DataConnectTransport;\n","/**\n * @license\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { DataConnectOptions, TransportOptions } from '../api/DataConnect';\nimport { Code, DataConnectError } from '../core/error';\nimport { logError } from '../logger';\n\nexport function urlBuilder(\n projectConfig: DataConnectOptions,\n transportOptions: TransportOptions\n): string {\n const { connector, location, projectId: project, service } = projectConfig;\n const { host, sslEnabled, port } = transportOptions;\n const protocol = sslEnabled ? 'https' : 'http';\n const realHost = host || `firebasedataconnect.googleapis.com`;\n let baseUrl = `${protocol}://${realHost}`;\n if (typeof port === 'number') {\n baseUrl += `:${port}`;\n } else if (typeof port !== 'undefined') {\n logError('Port type is of an invalid type');\n throw new DataConnectError(\n Code.INVALID_ARGUMENT,\n 'Incorrect type for port passed in!'\n );\n }\n return `${baseUrl}/v1beta/projects/${project}/locations/${location}/services/${service}/connectors/${connector}`;\n}\nexport function addToken(url: string, apiKey?: string): string {\n if (!apiKey) {\n return url;\n }\n const newUrl = new URL(url);\n newUrl.searchParams.append('key', apiKey);\n return newUrl.toString();\n}\n","/**\n * @license\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Code, DataConnectError } from '../core/error';\nimport { SDK_VERSION } from '../core/version';\nimport { logDebug, logError } from '../logger';\n\nimport { CallerSdkType, CallerSdkTypeEnum } from './transport';\n\nlet connectFetch: typeof fetch | null = globalThis.fetch;\nexport function initializeFetch(fetchImpl: typeof fetch): void {\n connectFetch = fetchImpl;\n}\nfunction getGoogApiClientValue(\n _isUsingGen: boolean,\n _callerSdkType: CallerSdkType\n): string {\n let str = 'gl-js/ fire/' + SDK_VERSION;\n if (\n _callerSdkType !== CallerSdkTypeEnum.Base &&\n _callerSdkType !== CallerSdkTypeEnum.Generated\n ) {\n str += ' js/' + _callerSdkType.toLowerCase();\n } else if (_isUsingGen || _callerSdkType === CallerSdkTypeEnum.Generated) {\n str += ' js/gen';\n }\n return str;\n}\nexport interface DataConnectFetchBody<T> {\n name: string;\n operationName: string;\n variables: T;\n}\nexport function dcFetch<T, U>(\n url: string,\n body: DataConnectFetchBody<U>,\n { signal }: AbortController,\n appId: string | null,\n accessToken: string | null,\n appCheckToken: string | null,\n _isUsingGen: boolean,\n _callerSdkType: CallerSdkType\n): Promise<{ data: T; errors: Error[] }> {\n if (!connectFetch) {\n throw new DataConnectError(Code.OTHER, 'No Fetch Implementation detected!');\n }\n const headers: HeadersInit = {\n 'Content-Type': 'application/json',\n 'X-Goog-Api-Client': getGoogApiClientValue(_isUsingGen, _callerSdkType)\n };\n if (accessToken) {\n headers['X-Firebase-Auth-Token'] = accessToken;\n }\n if (appId) {\n headers['x-firebase-gmpid'] = appId;\n }\n if (appCheckToken) {\n headers['X-Firebase-AppCheck'] = appCheckToken;\n }\n const bodyStr = JSON.stringify(body);\n logDebug(`Making request out to ${url} with body: ${bodyStr}`);\n\n return connectFetch(url, {\n body: bodyStr,\n method: 'POST',\n headers,\n signal\n })\n .catch(err => {\n throw new DataConnectError(\n Code.OTHER,\n 'Failed to fetch: ' + JSON.stringify(err)\n );\n })\n .then(async response => {\n let jsonResponse = null;\n try {\n jsonResponse = await response.json();\n } catch (e) {\n throw new DataConnectError(Code.OTHER, JSON.stringify(e));\n }\n const message = getMessage(jsonResponse);\n if (response.status >= 400) {\n logError(\n 'Error while performing request: ' + JSON.stringify(jsonResponse)\n );\n if (response.status === 401) {\n throw new DataConnectError(Code.UNAUTHORIZED, message);\n }\n throw new DataConnectError(Code.OTHER, message);\n }\n return jsonResponse;\n })\n .then(res => {\n if (res.errors && res.errors.length) {\n const stringified = JSON.stringify(res.errors);\n logError('DataConnect error while performing request: ' + stringified);\n throw new DataConnectError(Code.OTHER, stringified);\n }\n return res;\n });\n}\ninterface MessageObject {\n message?: string;\n}\nfunction getMessage(obj: MessageObject): string {\n if ('message' in obj) {\n return obj.message;\n }\n return JSON.stringify(obj);\n}\n","/**\n * @license\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { DataConnectOptions, TransportOptions } from '../../api/DataConnect';\nimport { AppCheckTokenProvider } from '../../core/AppCheckTokenProvider';\nimport { DataConnectError, Code } from '../../core/error';\nimport { AuthTokenProvider } from '../../core/FirebaseAuthProvider';\nimport { logDebug } from '../../logger';\nimport { addToken, urlBuilder } from '../../util/url';\nimport { dcFetch } from '../fetch';\n\nimport { CallerSdkType, CallerSdkTypeEnum, DataConnectTransport } from '.';\n\nexport class RESTTransport implements DataConnectTransport {\n private _host = '';\n private _port: number | undefined;\n private _location = 'l';\n private _connectorName = '';\n private _secure = true;\n private _project = 'p';\n private _serviceName: string;\n private _accessToken: string | null = null;\n private _appCheckToken: string | null = null;\n private _lastToken: string | null = null;\n constructor(\n options: DataConnectOptions,\n private apiKey?: string | undefined,\n private appId?: string,\n private authProvider?: AuthTokenProvider | undefined,\n private appCheckProvider?: AppCheckTokenProvider | undefined,\n transportOptions?: TransportOptions | undefined,\n private _isUsingGen = false,\n private _callerSdkType: CallerSdkType = CallerSdkTypeEnum.Base\n ) {\n if (transportOptions) {\n if (typeof transportOptions.port === 'number') {\n this._port = transportOptions.port;\n }\n if (typeof transportOptions.sslEnabled !== 'undefined') {\n this._secure = transportOptions.sslEnabled;\n }\n this._host = transportOptions.host;\n }\n const { location, projectId: project, connector, service } = options;\n if (location) {\n this._location = location;\n }\n if (project) {\n this._project = project;\n }\n this._serviceName = service;\n if (!connector) {\n throw new DataConnectError(\n Code.INVALID_ARGUMENT,\n 'Connector Name required!'\n );\n }\n this._connectorName = connector;\n this.authProvider?.addTokenChangeListener(token => {\n logDebug(`New Token Available: ${token}`);\n this._accessToken = token;\n });\n this.appCheckProvider?.addTokenChangeListener(result => {\n const { token } = result;\n logDebug(`New App Check Token Available: ${token}`);\n this._appCheckToken = token;\n });\n }\n get endpointUrl(): string {\n return urlBuilder(\n {\n connector: this._connectorName,\n location: this._location,\n projectId: this._project,\n service: this._serviceName\n },\n { host: this._host, sslEnabled: this._secure, port: this._port }\n );\n }\n useEmulator(host: string, port?: number, isSecure?: boolean): void {\n this._host = host;\n if (typeof port === 'number') {\n this._port = port;\n }\n if (typeof isSecure !== 'undefined') {\n this._secure = isSecure;\n }\n }\n onTokenChanged(newToken: string | null): void {\n this._accessToken = newToken;\n }\n\n async getWithAuth(forceToken = false): Promise<string> {\n let starterPromise: Promise<string | null> = new Promise(resolve =>\n resolve(this._accessToken)\n );\n if (this.appCheckProvider) {\n this._appCheckToken = (await this.appCheckProvider.getToken())?.token;\n }\n if (this.authProvider) {\n starterPromise = this.authProvider\n .getToken(/*forceToken=*/ forceToken)\n .then(data => {\n if (!data) {\n return null;\n }\n this._accessToken = data.accessToken;\n return this._accessToken;\n });\n } else {\n starterPromise = new Promise(resolve => resolve(''));\n }\n return starterPromise;\n }\n\n _setLastToken(lastToken: string | null): void {\n this._lastToken = lastToken;\n }\n\n withRetry<T>(\n promiseFactory: () => Promise<{ data: T; errors: Error[] }>,\n retry = false\n ): Promise<{ data: T; errors: Error[] }> {\n let isNewToken = false;\n return this.getWithAuth(retry)\n .then(res => {\n isNewToken = this._lastToken !== res;\n this._lastToken = res;\n return res;\n })\n .then(promiseFactory)\n .catch(err => {\n // Only retry if the result is unauthorized and the last token isn't the same as the new one.\n if (\n 'code' in err &&\n err.code === Code.UNAUTHORIZED &&\n !retry &&\n isNewToken\n ) {\n logDebug('Retrying due to unauthorized');\n return this.withRetry(promiseFactory, true);\n }\n throw err;\n });\n }\n\n // TODO(mtewani): Update U to include shape of body defined in line 13.\n invokeQuery: <T, U>(\n queryName: string,\n body?: U\n ) => Promise<{ data: T; errors: Error[] }> = <T, U = unknown>(\n queryName: string,\n body: U\n ) => {\n const abortController = new AbortController();\n\n // TODO(mtewani): Update to proper value\n const withAuth = this.withRetry(() =>\n dcFetch<T, U>(\n addToken(`${this.endpointUrl}:executeQuery`, this.apiKey),\n {\n name: `projects/${this._project}/locations/${this._location}/services/${this._serviceName}/connectors/${this._connectorName}`,\n operationName: queryName,\n variables: body\n },\n abortController,\n this.appId,\n this._accessToken,\n this._appCheckToken,\n this._isUsingGen,\n this._callerSdkType\n )\n );\n return withAuth;\n };\n invokeMutation: <T, U>(\n queryName: string,\n body?: U\n ) => Promise<{ data: T; errors: Error[] }> = <T, U = unknown>(\n mutationName: string,\n body: U\n ) => {\n const abortController = new AbortController();\n const taskResult = this.withRetry(() => {\n return dcFetch<T, U>(\n addToken(`${this.endpointUrl}:executeMutation`, this.apiKey),\n {\n name: `projects/${this._project}/locations/${this._location}/services/${this._serviceName}/connectors/${this._connectorName}`,\n operationName: mutationName,\n variables: body\n },\n abortController,\n this.appId,\n this._accessToken,\n this._appCheckToken,\n this._isUsingGen,\n this._callerSdkType\n );\n });\n return taskResult;\n };\n\n _setCallerSdkType(callerSdkType: CallerSdkType): void {\n this._callerSdkType = callerSdkType;\n }\n}\n","/**\n * @license\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { DataConnectTransport } from '../network/transport';\n\nimport { DataConnect } from './DataConnect';\nimport {\n DataConnectResult,\n MUTATION_STR,\n OperationRef,\n SOURCE_SERVER\n} from './Reference';\n\nexport interface MutationRef<Data, Variables>\n extends OperationRef<Data, Variables> {\n refType: typeof MUTATION_STR;\n}\n\n/**\n * Creates a `MutationRef`\n * @param dcInstance Data Connect instance\n * @param mutationName name of mutation\n */\nexport function mutationRef<Data>(\n dcInstance: DataConnect,\n mutationName: string\n): MutationRef<Data, undefined>;\n/**\n *\n * @param dcInstance Data Connect instance\n * @param mutationName name of mutation\n * @param variables variables to send with mutation\n */\nexport function mutationRef<Data, Variables>(\n dcInstance: DataConnect,\n mutationName: string,\n variables: Variables\n): MutationRef<Data, Variables>;\n/**\n *\n * @param dcInstance Data Connect instance\n * @param mutationName name of mutation\n * @param variables variables to send with mutation\n * @returns `MutationRef`\n */\nexport function mutationRef<Data, Variables>(\n dcInstance: DataConnect,\n mutationName: string,\n variables?: Variables\n): MutationRef<Data, Variables> {\n dcInstance.setInitialized();\n const ref: MutationRef<Data, Variables> = {\n dataConnect: dcInstance,\n name: mutationName,\n refType: MUTATION_STR,\n variables: variables as Variables\n };\n return ref;\n}\n\n/**\n * @internal\n */\nexport class MutationManager {\n private _inflight: Array<Promise<unknown>> = [];\n constructor(private _transport: DataConnectTransport) {}\n executeMutation<Data, Variables>(\n mutationRef: MutationRef<Data, Variables>\n ): MutationPromise<Data, Variables> {\n const result = this._transport.invokeMutation<Data, Variables>(\n mutationRef.name,\n mutationRef.variables\n );\n const withRefPromise = result.then(res => {\n const obj: MutationResult<Data, Variables> = {\n ...res, // Double check that the result is result.data, not just result\n source: SOURCE_SERVER,\n ref: mutationRef,\n fetchTime: Date.now().toLocaleString()\n };\n return obj;\n });\n this._inflight.push(result);\n const removePromise = (): Array<Promise<unknown>> =>\n (this._inflight = this._inflight.filter(promise => promise !== result));\n result.then(removePromise, removePromise);\n return withRefPromise;\n }\n}\n\n/**\n * Mutation Result from `executeMutation`\n */\nexport interface MutationResult<Data, Variables>\n extends DataConnectResult<Data, Variables> {\n ref: MutationRef<Data, Variables>;\n}\n/**\n * Mutation return value from `executeMutation`\n */\nexport interface MutationPromise<Data, Variables>\n extends Promise<MutationResult<Data, Variables>> {\n // reserved for special actions like cancellation\n}\n\n/**\n * Execute Mutation\n * @param mutationRef mutation to execute\n * @returns `MutationRef`\n */\nexport function executeMutation<Data, Variables>(\n mutationRef: MutationRef<Data, Variables>\n): MutationPromise<Data, Variables> {\n return mutationRef.dataConnect._mutationManager.executeMutation(mutationRef);\n}\n","/**\n * @license\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n FirebaseApp,\n _getProvider,\n _removeServiceInstance,\n getApp\n} from '@firebase/app';\nimport { AppCheckInternalComponentName } from '@firebase/app-check-interop-types';\nimport { FirebaseAuthInternalName } from '@firebase/auth-interop-types';\nimport { Provider } from '@firebase/component';\n\nimport { AppCheckTokenProvider } from '../core/AppCheckTokenProvider';\nimport { Code, DataConnectError } from '../core/error';\nimport {\n AuthTokenProvider,\n FirebaseAuthProvider\n} from '../core/FirebaseAuthProvider';\nimport { QueryManager } from '../core/QueryManager';\nimport { logDebug, logError } from '../logger';\nimport {\n CallerSdkType,\n CallerSdkTypeEnum,\n DataConnectTransport,\n TransportClass\n} from '../network';\nimport { RESTTransport } from '../network/transport/rest';\n\nimport { MutationManager } from './Mutation';\n\n/**\n * Connector Config for calling Data Connect backend.\n */\nexport interface ConnectorConfig {\n location: string;\n connector: string;\n service: string;\n}\n\n/**\n * Options to connect to emulator\n */\nexport interface TransportOptions {\n host: string;\n sslEnabled?: boolean;\n port?: number;\n}\n\nconst FIREBASE_DATA_CONNECT_EMULATOR_HOST_VAR =\n 'FIREBASE_DATA_CONNECT_EMULATOR_HOST';\n\n/**\n *\n * @param fullHost\n * @returns TransportOptions\n * @internal\n */\nexport function parseOptions(fullHost: string): TransportOptions {\n const [protocol, hostName] = fullHost.split('://');\n const isSecure = protocol === 'https';\n const [host, portAsString] = hostName.split(':');\n const port = Number(portAsString);\n return { host, port, sslEnabled: isSecure };\n}\n/**\n * DataConnectOptions including project id\n */\nexport interface DataConnectOptions extends ConnectorConfig {\n projectId: string;\n}\n\n/**\n * Class representing Firebase Data Connect\n */\nexport class DataConnect {\n _queryManager!: QueryManager;\n _mutationManager!: MutationManager;\n isEmulator = false;\n _initialized = false;\n private _transport!: DataConnectTransport;\n private _transportClass: TransportClass | undefined;\n private _transportOptions?: TransportOptions;\n private _authTokenProvider?: AuthTokenProvider;\n _isUsingGeneratedSdk: boolean = false;\n _callerSdkType: CallerSdkType = CallerSdkTypeEnum.Base;\n private _appCheckTokenProvider?: AppCheckTokenProvider;\n // @internal\n constructor(\n public readonly app: FirebaseApp,\n // TODO(mtewani): Replace with _dataConnectOptions in the future\n private readonly dataConnectOptions: DataConnectOptions,\n private readonly _authProvider: Provider<FirebaseAuthInternalName>,\n private readonly _appCheckProvider: Provider<AppCheckInternalComponentName>\n ) {\n if (typeof process !== 'undefined' && process.env) {\n const host = process.env[FIREBASE_DATA_CONNECT_EMULATOR_HOST_VAR];\n if (host) {\n logDebug('Found custom host. Using emulator');\n this.isEmulator = true;\n this._transportOptions = parseOptions(host);\n }\n }\n }\n // @internal\n _useGeneratedSdk(): void {\n if (!this._isUsingGeneratedSdk) {\n this._isUsingGeneratedSdk = true;\n }\n }\n _setCallerSdkType(callerSdkType: CallerSdkType): void {\n this._callerSdkType = callerSdkType;\n if (this._initialized) {\n this._transport._setCallerSdkType(callerSdkType);\n }\n }\n _delete(): Promise<void> {\n _removeServiceInstance(\n this.app,\n 'data-connect',\n JSON.stringify(this.getSettings())\n );\n return Promise.resolve();\n }\n\n // @internal\n getSettings(): ConnectorConfig {\n const copy = JSON.parse(JSON.stringify(this.dataConnectOptions));\n delete copy.projectId;\n return copy;\n }\n\n // @internal\n setInitialized(): void {\n if (this._initialized) {\n return;\n }\n if (this._transportClass === undefined) {\n logDebug('transportClass not provided. Defaulting to RESTTransport.');\n this._transportClass = RESTTransport;\n }\n\n if (this._authProvider) {\n this._authTokenProvider = new FirebaseAuthProvider(\n this.app.name,\n this.app.options,\n this._authProvider\n );\n }\n if (this._appCheckProvider) {\n this._appCheckTokenProvider = new AppCheckTokenProvider(\n this.app,\n this._appCheckProvider\n );\n }\n\n this._initialized = true;\n this._transport = new this._transportClass(\n this.dataConnectOptions,\n this.app.options.apiKey,\n this.app.options.appId,\n this._authTokenProvider,\n this._appCheckTokenProvider,\n undefined,\n this._isUsingGeneratedSdk,\n this._callerSdkType\n );\n if (this._transportOptions) {\n this._transport.useEmulator(\n this._transportOptions.host,\n this._transportOptions.port,\n this._transportOptions.sslEnabled\n );\n }\n this._queryManager = new QueryManager(this._transport);\n this._mutationManager = new MutationManager(this._transport);\n }\n\n // @internal\n enableEmulator(transportOptions: TransportOptions): void {\n if (\n this._initialized &&\n !areTransportOptionsEqual(this._transportOptions, transportOptions)\n ) {\n logError('enableEmulator called after initialization');\n throw new DataConnectError(\n Code.ALREADY_INITIALIZED,\n 'DataConnect instance already initialized!'\n );\n }\n this._transportOptions = transportOptions;\n this.isEmulator = true;\n }\n}\n\n/**\n * @internal\n * @param transportOptions1\n * @param transportOptions2\n * @returns\n */\nexport function areTransportOptionsEqual(\n transportOptions1: TransportOptions,\n transportOptions2: TransportOptions\n): boolean {\n return (\n transportOptions1.host === transportOptions2.host &&\n transportOptions1.port === transportOptions2.port &&\n transportOptions1.sslEnabled === transportOptions2.sslEnabled\n );\n}\n\n/**\n * Connect to the DataConnect Emulator\n * @param dc Data Connect instance\n * @param host host of emulator server\n * @param port port of emulator server\n * @param sslEnabled use https\n */\nexport function connectDataConnectEmulator(\n dc: DataConnect,\n host: string,\n port?: number,\n sslEnabled = false\n): void {\n dc.enableEmulator({ host, port, sslEnabled });\n}\n\n/**\n * Initialize DataConnect instance\n * @param options ConnectorConfig\n */\nexport function getDataConnect(options: ConnectorConfig): DataConnect;\n/**\n * Initialize DataConnect instance\n * @param app FirebaseApp to initialize to.\n * @param options ConnectorConfig\n */\nexport function getDataConnect(\n app: FirebaseApp,\n options: ConnectorConfig\n): DataConnect;\nexport function getDataConnect(\n appOrOptions: FirebaseApp | ConnectorConfig,\n optionalOptions?: ConnectorConfig\n): DataConnect {\n let app: FirebaseApp;\n let dcOptions: ConnectorConfig;\n if ('location' in appOrOptions) {\n dcOptions = appOrOptions;\n app = getApp();\n } else {\n dcOptions = optionalOptions!;\n app = appOrOptions;\n }\n\n if (!app || Object.keys(app).length === 0) {\n app = getApp();\n }\n const provider = _getProvider(app, 'data-connect');\n const identifier = JSON.stringify(dcOptions);\n if (provider.isInitialized(identifier)) {\n const dcInstance = provider.getImmediate({ identifier });\n const options = provider.getOptions(identifier);\n const optionsValid = Object.keys(options).length > 0;\n if (optionsValid) {\n logDebug('Re-using cached instance');\n return dcInstance;\n }\n }\n validateDCOptions(dcOptions);\n\n logDebug('Creating new DataConnect instance');\n // Initialize with options.\n return provider.initialize({\n instanceIdentifier: identifier,\n options: dcOptions\n });\n}\n\n/**\n *\n * @param dcOptions\n * @returns {void}\n * @internal\n */\nexport function validateDCOptions(dcOptions: ConnectorConfig): boolean {\n const fields = ['connector', 'location', 'service'];\n if (!dcOptions) {\n throw new DataConnectError(Code.INVALID_ARGUMENT, 'DC Option Required');\n }\n fields.forEach(field => {\n if (dcOptions[field] === null || dcOptions[field] === undefined) {\n throw new DataConnectError(Code.INVALID_ARGUMENT, `${field} Required`);\n }\n });\n return true;\n}\n\n/**\n * Delete DataConnect instance\n * @param dataConnect DataConnect instance\n * @returns\n */\nexport function terminate(dataConnect: DataConnect): Promise<void> {\n return dataConnect._delete();\n // TODO(mtewani): Stop pending tasks\n}\n","/**\n * @license\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport {\n _registerComponent,\n registerVersion,\n SDK_VERSION\n} from '@firebase/app';\nimport { Component, ComponentType } from '@firebase/component';\n\nimport { name, version } from '../package.json';\nimport { setSDKVersion } from '../src/core/version';\n\nimport { DataConnect, ConnectorConfig } from './api/DataConnect';\nimport { Code, DataConnectError } from './core/error';\n\nexport function registerDataConnect(variant?: string): void {\n setSDKVersion(SDK_VERSION);\n _registerComponent(\n new Component(\n 'data-connect',\n (container, { instanceIdentifier: settings, options }) => {\n const app = container.getProvider('app').getImmediate()!;\n const authProvider = container.getProvider('auth-internal');\n const appCheckProvider = container.getProvider('app-check-internal');\n let newOpts = options as ConnectorConfig;\n if (settings) {\n newOpts = JSON.parse(settings);\n }\n if (!app.options.projectId) {\n throw new DataConnectError(\n Code.INVALID_ARGUMENT,\n 'Project ID must be provided. Did you pass in a proper projectId to initializeApp?'\n );\n }\n return new DataConnect(\n app,\n { ...newOpts, projectId: app.options.projectId! },\n authProvider,\n appCheckProvider\n );\n },\n ComponentType.PUBLIC\n ).setMultipleInstances(true)\n );\n registerVersion(name, version, variant);\n // BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation\n registerVersion(name, version, '__BUILD_TARGET__');\n}\n","/**\n * @license\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { DataConnectError } from '../core/error';\n\nimport { DataConnect, getDataConnect } from './DataConnect';\nimport {\n OperationRef,\n QUERY_STR,\n DataConnectResult,\n SerializedRef\n} from './Reference';\n\n/**\n * Signature for `OnResultSubscription` for `subscribe`\n */\nexport type OnResultSubscription<Data, Variables> = (\n res: QueryResult<Data, Variables>\n) => void;\n/**\n * Signature for `OnErrorSubscription` for `subscribe`\n */\nexport type OnErrorSubscription = (err?: DataConnectError) => void;\n/**\n * Signature for unsubscribe from `subscribe`\n */\nexport type QueryUnsubscribe = () => void;\n/**\n * Representation of user provided subscription options.\n */\nexport interface DataConnectSubscription<Data, Variables> {\n userCallback: OnResultSubscription<Data, Variables>;\n errCallback?: (e?: DataConnectError) => void;\n unsubscribe: () => void;\n}\n\n/**\n * QueryRef object\n */\nexport interface QueryRef<Data, Variables>\n extends OperationRef<Data, Variables> {\n refType: typeof QUERY_STR;\n}\n/**\n * Result of `executeQuery`\n */\nexport interface QueryResult<Data, Variables>\n extends DataConnectResult<Data, Variables> {\n ref: QueryRef<Data, Variables>;\n toJSON: () => SerializedRef<Data, Variables>;\n}\n/**\n * Promise returned from `executeQuery`\n */\nexport interface QueryPromise<Data, Variables>\n extends Promise<QueryResult<Data, Variables>> {\n // reserved for special actions like cancellation\n}\n\n/**\n * Execute Query\n * @param queryRef query to execute.\n * @returns `QueryPromise`\n */\nexport function executeQuery<Data, Variables>(\n queryRef: QueryRef<Data, Variables>\n): QueryPromise<Data, Variables> {\n return queryRef.dataConnect._queryManager.executeQuery(queryRef);\n}\n\n/**\n * Execute Query\n * @param dcInstance Data Connect instance to use.\n * @param queryName Query to execute\n * @returns `QueryRef`\n */\nexport function queryRef<Data>(\n dcInstance: DataConnect,\n queryName: string\n): QueryRef<Data, undefined>;\n/**\n * Execute Query\n * @param dcInstance Data Connect instance to use.\n * @param queryName Query to execute\n * @param variables Variables to execute with\n * @returns `QueryRef`\n */\nexport function queryRef<Data, Variables>(\n dcInstance: DataConnect,\n queryName: string,\n variables: Variables\n): QueryRef<Data, Variables>;\n/**\n * Execute Query\n * @param dcInstance Data Connect instance to use.\n * @param queryName Query to execute\n * @param variables Variables to execute with\n * @param initialCache initial cache to use for client hydration\n * @returns `QueryRef`\n */\nexport function queryRef<Data, Variables>(\n dcInstance: DataConnect,\n queryName: string,\n variables?: Variables,\n initialCache?: QueryResult<Data, Variables>\n): QueryRef<Data, Variables> {\n dcInstance.setInitialized();\n dcInstance._queryManager.track(queryName, variables, initialCache);\n return {\n dataConnect: dcInstance,\n refType: QUERY_STR,\n name: queryName,\n variables\n };\n}\n/**\n * Converts serialized ref to query ref\n * @param serializedRef ref to convert to `QueryRef`\n * @returns `QueryRef`\n */\nexport function toQueryRef<Data, Variables>(\n serializedRef: SerializedRef<Data, Variables>\n): QueryRef<Data, Variables> {\n const {\n refInfo: { name, variables, connectorConfig }\n } = serializedRef;\n return queryRef(getDataConnect(connectorConfig), name, variables);\n}\n/**\n * `OnCompleteSubscription`\n */\nexport type OnCompleteSubscription = () => void;\n/**\n * Representation of full observer options in `subscribe`\n */\nexport interface SubscriptionOptions<Data, Variables> {\n onNext?: OnResultSubscription<Data, Variables>;\n onErr?: OnErrorSubscription;\n onComplete?: OnCompleteSubscription;\n}\n","/**\n * @license\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n ConnectorConfig,\n DataConnect,\n getDataConnect\n} from '../api/DataConnect';\nimport { Code, DataConnectError } from '../core/error';\ninterface ParsedArgs<Variables> {\n dc: DataConnect;\n vars: Variables;\n}\n\n/**\n * The generated SDK will allow the user to pass in either the variable or the data connect instance with the variable,\n * and this function validates the variables and returns back the DataConnect instance and variables based on the arguments passed in.\n * @param connectorConfig\n * @param dcOrVars\n * @param vars\n * @param validateVars\n * @returns {DataConnect} and {Variables} instance\n * @internal\n */\nexport function validateArgs<Variables extends object>(\n connectorConfig: ConnectorConfig,\n dcOrVars?: DataConnect | Variables,\n vars?: Variables,\n validateVars?: boolean\n): ParsedArgs<Variables> {\n let dcInstance: DataConnect;\n let realVars: Variables;\n if (dcOrVars && 'enableEmulator' in dcOrVars) {\n dcInstance = dcOrVars as DataConnect;\n realVars = vars;\n } else {\n dcInstance = getDataConnect(connectorConfig);\n realVars = dcOrVars as Variables;\n }\n if (!dcInstance || (!realVars && validateVars)) {\n throw new DataConnectError(Code.INVALID_ARGUMENT, 'Variables required.');\n }\n return { dc: dcInstance, vars: realVars };\n}\n","/**\n * @license\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n OnCompleteSubscription,\n OnErrorSubscription,\n OnResultSubscription,\n QueryRef,\n QueryUnsubscribe,\n SubscriptionOptions,\n toQueryRef\n} from './api/query';\nimport { OpResult, SerializedRef } from './api/Reference';\nimport { DataConnectError, Code } from './core/error';\n\n/**\n * Subscribe to a `QueryRef`\n * @param queryRefOrSerializedResult query ref or serialized result.\n * @param observer observer object to use for subscribing.\n * @returns `SubscriptionOptions`\n */\nexport function subscribe<Data, Variables>(\n queryRefOrSerializedResult:\n | QueryRef<Data, Variables>\n | SerializedRef<Data, Variables>,\n observer: SubscriptionOptions<Data, Variables>\n): QueryUnsubscribe;\n/**\n * Subscribe to a `QueryRef`\n * @param queryRefOrSerializedResult query ref or serialized result.\n * @param onNext Callback to call when result comes back.\n * @param onError Callback to call when error gets thrown.\n * @param onComplete Called when subscription completes.\n * @returns `SubscriptionOptions`\n */\nexport function subscribe<Data, Variables>(\n queryRefOrSerializedResult:\n | QueryRef<Data, Variables>\n | SerializedRef<Data, Variables>,\n onNext: OnResultSubscription<Data, Variables>,\n onError?: OnErrorSubscription,\n onComplete?: OnCompleteSubscription\n): QueryUnsubscribe;\n/**\n * Subscribe to a `QueryRef`\n * @param queryRefOrSerializedResult query ref or serialized result.\n * @param observerOrOnNext observer object or next function.\n * @param onError Callback to call when error gets thrown.\n * @param onComplete Called when subscription completes.\n * @returns `SubscriptionOptions`\n */\nexport function subscribe<Data, Variables>(\n queryRefOrSerializedResult:\n | QueryRef<Data, Variables>\n | SerializedRef<Data, Variables>,\n observerOrOnNext:\n | SubscriptionOptions<Data, Variables>\n | OnResultSubscription<Data, Variables>,\n onError?: OnErrorSubscription,\n onComplete?: OnCompleteSubscription\n): QueryUnsubscribe {\n let ref: QueryRef<Data, Variables>;\n let initialCache: OpResult<Data> | undefined;\n if ('refInfo' in queryRefOrSerializedResult) {\n const serializedRef: SerializedRef<Data, Variables> =\n queryRefOrSerializedResult;\n const { data, source, fetchTime } = serializedRef;\n initialCache = {\n data,\n source,\n fetchTime\n };\n ref = toQueryRef(serializedRef);\n } else {\n ref = queryRefOrSerializedResult;\n }\n let onResult: OnResultSubscription<Data, Variables> | undefined = undefined;\n if (typeof observerOrOnNext === 'function') {\n onResult = observerOrOnNext;\n } else {\n onResult = observerOrOnNext.onNext;\n onError = observerOrOnNext.onErr;\n onComplete = observerOrOnNext.onComplete;\n }\n if (!onResult) {\n throw new DataConnectError(Code.INVALID_ARGUMENT, 'Must provide onNext');\n }\n return ref.dataConnect._queryManager.addSubscription(\n ref,\n onResult,\n onError,\n initialCache\n );\n}\n","/**\n * Firebase Data Connect\n *\n * @packageDocumentation\n */\n\n/**\n * @license\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { DataConnect } from './api/DataConnect';\nimport { registerDataConnect } from './register';\n\nexport * from './api';\nexport * from './api.browser';\n\nregisterDataConnect();\n\ndeclare module '@firebase/component' {\n interface NameServiceMapping {\n 'data-connect': DataConnect;\n }\n}\n"],"names":["app","_isFirebaseServerApp","FirebaseError","Logger","_removeServiceInstance","getApp","_getProvider","SDK_VERSION","_registerComponent","Component","registerVersion"],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;AAeG;AAEH;AACO,IAAI,WAAW,GAAG,EAAE,CAAC;AAE5B;;;AAGG;AACG,SAAU,aAAa,CAAC,OAAe,EAAA;IAC3C,WAAW,GAAG,OAAO,CAAC;AACxB;;AC1BA;;;;;;;;;;;;;;;AAeG;AAWH;;;AAGG;MACU,qBAAqB,CAAA;IAGhC,WACE,CAAAA,KAAgB,EACR,gBAA0D,EAAA;QAA1D,IAAgB,CAAA,gBAAA,GAAhB,gBAAgB,CAA0C;QAElE,IAAIC,wBAAoB,CAACD,KAAG,CAAC,IAAIA,KAAG,CAAC,QAAQ,CAAC,aAAa,EAAE;YAC3D,IAAI,CAAC,sBAAsB,GAAGA,KAAG,CAAC,QAAQ,CAAC,aAAa,CAAC;SAC1D;AACD,QAAA,IAAI,CAAC,QAAQ,GAAG,gBAAgB,KAAA,IAAA,IAAhB,gBAAgB,KAAhB,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,gBAAgB,CAAE,YAAY,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;AACnE,QAAA,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YAClB,MAAK,gBAAgB,KAAA,IAAA,IAAhB,gBAAgB,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAhB,gBAAgB,CACjB,GAAG,EAAA,CACJ,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC,CAC3C,CAAA,KAAK,EAAE,CAAA,CAAC;SACZ;KACF;IAED,QAAQ,GAAA;AACN,QAAA,IAAI,IAAI,CAAC,sBAAsB,EAAE;AAC/B,YAAA,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,sBAAsB,EAAE,CAAC,CAAC;SAChE;AAED,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