summaryrefslogtreecommitdiff
path: root/frontend-old/node_modules/@firebase/data-connect
diff options
context:
space:
mode:
Diffstat (limited to 'frontend-old/node_modules/@firebase/data-connect')
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/README.md5
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/index.cjs.js1263
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/index.cjs.js.map1
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/index.esm.js1236
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/index.esm.js.map1
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/index.node.cjs.js1278
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/index.node.cjs.js.map1
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/internal.d.ts461
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/node-esm/index.node.esm.js1251
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/node-esm/index.node.esm.js.map1
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/node-esm/package.json1
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/api.browser.d.ts34
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/api.node.d.ts17
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/api/DataConnect.d.ts118
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/api/Mutation.d.ts61
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/api/Reference.d.ts51
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/api/index.d.ts24
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/api/query.d.ts96
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/core/AppCheckTokenProvider.d.ts31
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/core/FirebaseAuthProvider.d.ts34
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/core/QueryManager.d.ts36
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/core/error.d.ts53
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/core/version.d.ts23
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/index.d.ts29
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/index.node.d.ts18
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/logger.d.ts20
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/network/fetch.d.ts27
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/network/index.d.ts17
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/network/transport/index.d.ts52
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/network/transport/rest.d.ts61
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/register.d.ts1
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/util/encoder.d.ts19
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/util/map.d.ts17
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/util/url.d.ts19
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/util/validateArgs.d.ts33
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/private.d.ts393
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/public.d.ts284
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/src/api.browser.d.ts34
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/src/api.node.d.ts17
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/src/api/DataConnect.d.ts118
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/src/api/Mutation.d.ts61
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/src/api/Reference.d.ts51
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/src/api/index.d.ts24
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/src/api/query.d.ts96
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/src/core/AppCheckTokenProvider.d.ts31
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/src/core/FirebaseAuthProvider.d.ts34
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/src/core/QueryManager.d.ts36
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/src/core/error.d.ts53
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/src/core/version.d.ts23
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/src/index.d.ts29
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/src/index.node.d.ts18
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/src/logger.d.ts20
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/src/network/fetch.d.ts27
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/src/network/index.d.ts17
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/src/network/transport/index.d.ts52
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/src/network/transport/rest.d.ts61
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/src/register.d.ts1
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/src/tsdoc-metadata.json11
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/src/util/encoder.d.ts19
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/src/util/map.d.ts17
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/src/util/url.d.ts19
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/dist/src/util/validateArgs.d.ts33
-rw-r--r--frontend-old/node_modules/@firebase/data-connect/package.json78
63 files changed, 8047 insertions, 0 deletions
diff --git a/frontend-old/node_modules/@firebase/data-connect/README.md b/frontend-old/node_modules/@firebase/data-connect/README.md
new file mode 100644
index 0000000..40d6f52
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/README.md
@@ -0,0 +1,5 @@
+# Firebase Data Connect
+
+## Local Development
+
+Check `test/dataconnect.yaml` to ensure that the correct values are filled in.
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/index.cjs.js b/frontend-old/node_modules/@firebase/data-connect/dist/index.cjs.js
new file mode 100644
index 0000000..336f5cd
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/index.cjs.js
@@ -0,0 +1,1263 @@
+'use strict';
+
+Object.defineProperty(exports, '__esModule', { value: true });
+
+var app = require('@firebase/app');
+var component = require('@firebase/component');
+var util = require('@firebase/util');
+var logger$1 = require('@firebase/logger');
+
+const name = "@firebase/data-connect";
+const version = "0.3.11";
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/** The semver (www.semver.org) version of the SDK. */
+let SDK_VERSION = '';
+/**
+ * SDK_VERSION should be set before any database instance is created
+ * @internal
+ */
+function setSDKVersion(version) {
+ SDK_VERSION = version;
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @internal
+ * Abstraction around AppCheck's token fetching capabilities.
+ */
+class AppCheckTokenProvider {
+ constructor(app$1, appCheckProvider) {
+ this.appCheckProvider = appCheckProvider;
+ if (app._isFirebaseServerApp(app$1) && app$1.settings.appCheckToken) {
+ this.serverAppAppCheckToken = app$1.settings.appCheckToken;
+ }
+ this.appCheck = appCheckProvider?.getImmediate({ optional: true });
+ if (!this.appCheck) {
+ void appCheckProvider
+ ?.get()
+ .then(appCheck => (this.appCheck = appCheck))
+ .catch();
+ }
+ }
+ getToken() {
+ if (this.serverAppAppCheckToken) {
+ return Promise.resolve({ token: this.serverAppAppCheckToken });
+ }
+ if (!this.appCheck) {
+ return new Promise((resolve, reject) => {
+ // Support delayed initialization of FirebaseAppCheck. This allows our
+ // customers to initialize the RTDB SDK before initializing Firebase
+ // AppCheck and ensures that all requests are authenticated if a token
+ // becomes available before the timoeout below expires.
+ setTimeout(() => {
+ if (this.appCheck) {
+ this.getToken().then(resolve, reject);
+ }
+ else {
+ resolve(null);
+ }
+ }, 0);
+ });
+ }
+ return this.appCheck.getToken();
+ }
+ addTokenChangeListener(listener) {
+ void this.appCheckProvider
+ ?.get()
+ .then(appCheck => appCheck.addTokenListener(listener));
+ }
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+const Code = {
+ OTHER: 'other',
+ ALREADY_INITIALIZED: 'already-initialized',
+ NOT_INITIALIZED: 'not-initialized',
+ NOT_SUPPORTED: 'not-supported',
+ INVALID_ARGUMENT: 'invalid-argument',
+ PARTIAL_ERROR: 'partial-error',
+ UNAUTHORIZED: 'unauthorized'
+};
+/** An error returned by a DataConnect operation. */
+class DataConnectError extends util.FirebaseError {
+ constructor(code, message) {
+ super(code, message);
+ /** @internal */
+ this.name = 'DataConnectError';
+ // Ensure the instanceof operator works as expected on subclasses of Error.
+ // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#custom_error_types
+ // and https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html#support-for-newtarget
+ Object.setPrototypeOf(this, DataConnectError.prototype);
+ }
+ /** @internal */
+ toString() {
+ return `${this.name}[code=${this.code}]: ${this.message}`;
+ }
+}
+/** An error returned by a DataConnect operation. */
+class DataConnectOperationError extends DataConnectError {
+ /** @hideconstructor */
+ constructor(message, response) {
+ super(Code.PARTIAL_ERROR, message);
+ /** @internal */
+ this.name = 'DataConnectOperationError';
+ this.response = response;
+ }
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+const logger = new logger$1.Logger('@firebase/data-connect');
+function setLogLevel(logLevel) {
+ logger.setLogLevel(logLevel);
+}
+function logDebug(msg) {
+ logger.debug(`DataConnect (${SDK_VERSION}): ${msg}`);
+}
+function logError(msg) {
+ logger.error(`DataConnect (${SDK_VERSION}): ${msg}`);
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// @internal
+class FirebaseAuthProvider {
+ constructor(_appName, _options, _authProvider) {
+ this._appName = _appName;
+ this._options = _options;
+ this._authProvider = _authProvider;
+ this._auth = _authProvider.getImmediate({ optional: true });
+ if (!this._auth) {
+ _authProvider.onInit(auth => (this._auth = auth));
+ }
+ }
+ getToken(forceRefresh) {
+ if (!this._auth) {
+ return new Promise((resolve, reject) => {
+ setTimeout(() => {
+ if (this._auth) {
+ this.getToken(forceRefresh).then(resolve, reject);
+ }
+ else {
+ resolve(null);
+ }
+ }, 0);
+ });
+ }
+ return this._auth.getToken(forceRefresh).catch(error => {
+ if (error && error.code === 'auth/token-not-initialized') {
+ logDebug('Got auth/token-not-initialized error. Treating as null token.');
+ return null;
+ }
+ else {
+ logError('Error received when attempting to retrieve token: ' +
+ JSON.stringify(error));
+ return Promise.reject(error);
+ }
+ });
+ }
+ addTokenChangeListener(listener) {
+ this._auth?.addAuthTokenListener(listener);
+ }
+ removeTokenChangeListener(listener) {
+ this._authProvider
+ .get()
+ .then(auth => auth.removeAuthTokenListener(listener))
+ .catch(err => logError(err));
+ }
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+const QUERY_STR = 'query';
+const MUTATION_STR = 'mutation';
+const SOURCE_SERVER = 'SERVER';
+const SOURCE_CACHE = 'CACHE';
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+let encoderImpl;
+function setEncoder(encoder) {
+ encoderImpl = encoder;
+}
+setEncoder(o => JSON.stringify(o));
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+function setIfNotExists(map, key, val) {
+ if (!map.has(key)) {
+ map.set(key, val);
+ }
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+function getRefSerializer(queryRef, data, source) {
+ return function toJSON() {
+ return {
+ data,
+ refInfo: {
+ name: queryRef.name,
+ variables: queryRef.variables,
+ connectorConfig: {
+ projectId: queryRef.dataConnect.app.options.projectId,
+ ...queryRef.dataConnect.getSettings()
+ }
+ },
+ fetchTime: Date.now().toLocaleString(),
+ source
+ };
+ };
+}
+class QueryManager {
+ constructor(transport) {
+ this.transport = transport;
+ this._queries = new Map();
+ }
+ track(queryName, variables, initialCache) {
+ const ref = {
+ name: queryName,
+ variables,
+ refType: QUERY_STR
+ };
+ const key = encoderImpl(ref);
+ const newTrackedQuery = {
+ ref,
+ subscriptions: [],
+ currentCache: initialCache || null,
+ lastError: null
+ };
+ // @ts-ignore
+ setIfNotExists(this._queries, key, newTrackedQuery);
+ return this._queries.get(key);
+ }
+ addSubscription(queryRef, onResultCallback, onErrorCallback, initialCache) {
+ const key = encoderImpl({
+ name: queryRef.name,
+ variables: queryRef.variables,
+ refType: QUERY_STR
+ });
+ const trackedQuery = this._queries.get(key);
+ const subscription = {
+ userCallback: onResultCallback,
+ errCallback: onErrorCallback
+ };
+ const unsubscribe = () => {
+ const trackedQuery = this._queries.get(key);
+ trackedQuery.subscriptions = trackedQuery.subscriptions.filter(sub => sub !== subscription);
+ };
+ if (initialCache && trackedQuery.currentCache !== initialCache) {
+ logDebug('Initial cache found. Comparing dates.');
+ if (!trackedQuery.currentCache ||
+ (trackedQuery.currentCache &&
+ compareDates(trackedQuery.currentCache.fetchTime, initialCache.fetchTime))) {
+ trackedQuery.currentCache = initialCache;
+ }
+ }
+ if (trackedQuery.currentCache !== null) {
+ const cachedData = trackedQuery.currentCache.data;
+ onResultCallback({
+ data: cachedData,
+ source: SOURCE_CACHE,
+ ref: queryRef,
+ toJSON: getRefSerializer(queryRef, trackedQuery.currentCache.data, SOURCE_CACHE),
+ fetchTime: trackedQuery.currentCache.fetchTime
+ });
+ if (trackedQuery.lastError !== null && onErrorCallback) {
+ onErrorCallback(undefined);
+ }
+ }
+ trackedQuery.subscriptions.push({
+ userCallback: onResultCallback,
+ errCallback: onErrorCallback,
+ unsubscribe
+ });
+ if (!trackedQuery.currentCache) {
+ logDebug(`No cache available for query ${queryRef.name} with variables ${JSON.stringify(queryRef.variables)}. Calling executeQuery.`);
+ const promise = this.executeQuery(queryRef);
+ // We want to ignore the error and let subscriptions handle it
+ promise.then(undefined, err => { });
+ }
+ return unsubscribe;
+ }
+ executeQuery(queryRef) {
+ if (queryRef.refType !== QUERY_STR) {
+ throw new DataConnectError(Code.INVALID_ARGUMENT, `ExecuteQuery can only execute query operation`);
+ }
+ const key = encoderImpl({
+ name: queryRef.name,
+ variables: queryRef.variables,
+ refType: QUERY_STR
+ });
+ const trackedQuery = this._queries.get(key);
+ const result = this.transport.invokeQuery(queryRef.name, queryRef.variables);
+ const newR = result.then(res => {
+ const fetchTime = new Date().toString();
+ const result = {
+ ...res,
+ source: SOURCE_SERVER,
+ ref: queryRef,
+ toJSON: getRefSerializer(queryRef, res.data, SOURCE_SERVER),
+ fetchTime
+ };
+ trackedQuery.subscriptions.forEach(subscription => {
+ subscription.userCallback(result);
+ });
+ trackedQuery.currentCache = {
+ data: res.data,
+ source: SOURCE_CACHE,
+ fetchTime
+ };
+ return result;
+ }, err => {
+ trackedQuery.lastError = err;
+ trackedQuery.subscriptions.forEach(subscription => {
+ if (subscription.errCallback) {
+ subscription.errCallback(err);
+ }
+ });
+ throw err;
+ });
+ return newR;
+ }
+ enableEmulator(host, port) {
+ this.transport.useEmulator(host, port);
+ }
+}
+function compareDates(str1, str2) {
+ const date1 = new Date(str1);
+ const date2 = new Date(str2);
+ return date1.getTime() < date2.getTime();
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+const CallerSdkTypeEnum = {
+ Base: 'Base', // Core JS SDK
+ Generated: 'Generated', // Generated JS SDK
+ TanstackReactCore: 'TanstackReactCore', // Tanstack non-generated React SDK
+ GeneratedReact: 'GeneratedReact', // Tanstack non-generated Angular SDK
+ TanstackAngularCore: 'TanstackAngularCore', // Tanstack non-generated Angular SDK
+ GeneratedAngular: 'GeneratedAngular' // Generated Angular SDK
+};
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+function urlBuilder(projectConfig, transportOptions) {
+ const { connector, location, projectId: project, service } = projectConfig;
+ const { host, sslEnabled, port } = transportOptions;
+ const protocol = sslEnabled ? 'https' : 'http';
+ const realHost = host || `firebasedataconnect.googleapis.com`;
+ let baseUrl = `${protocol}://${realHost}`;
+ if (typeof port === 'number') {
+ baseUrl += `:${port}`;
+ }
+ else if (typeof port !== 'undefined') {
+ logError('Port type is of an invalid type');
+ throw new DataConnectError(Code.INVALID_ARGUMENT, 'Incorrect type for port passed in!');
+ }
+ return `${baseUrl}/v1/projects/${project}/locations/${location}/services/${service}/connectors/${connector}`;
+}
+function addToken(url, apiKey) {
+ if (!apiKey) {
+ return url;
+ }
+ const newUrl = new URL(url);
+ newUrl.searchParams.append('key', apiKey);
+ return newUrl.toString();
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+let connectFetch = globalThis.fetch;
+function getGoogApiClientValue(_isUsingGen, _callerSdkType) {
+ let str = 'gl-js/ fire/' + SDK_VERSION;
+ if (_callerSdkType !== CallerSdkTypeEnum.Base &&
+ _callerSdkType !== CallerSdkTypeEnum.Generated) {
+ str += ' js/' + _callerSdkType.toLowerCase();
+ }
+ else if (_isUsingGen || _callerSdkType === CallerSdkTypeEnum.Generated) {
+ str += ' js/gen';
+ }
+ return str;
+}
+function dcFetch(url, body, { signal }, appId, accessToken, appCheckToken, _isUsingGen, _callerSdkType, _isUsingEmulator) {
+ if (!connectFetch) {
+ throw new DataConnectError(Code.OTHER, 'No Fetch Implementation detected!');
+ }
+ const headers = {
+ 'Content-Type': 'application/json',
+ 'X-Goog-Api-Client': getGoogApiClientValue(_isUsingGen, _callerSdkType)
+ };
+ if (accessToken) {
+ headers['X-Firebase-Auth-Token'] = accessToken;
+ }
+ if (appId) {
+ headers['x-firebase-gmpid'] = appId;
+ }
+ if (appCheckToken) {
+ headers['X-Firebase-AppCheck'] = appCheckToken;
+ }
+ const bodyStr = JSON.stringify(body);
+ const fetchOptions = {
+ body: bodyStr,
+ method: 'POST',
+ headers,
+ signal
+ };
+ if (util.isCloudWorkstation(url) && _isUsingEmulator) {
+ fetchOptions.credentials = 'include';
+ }
+ return connectFetch(url, fetchOptions)
+ .catch(err => {
+ throw new DataConnectError(Code.OTHER, 'Failed to fetch: ' + JSON.stringify(err));
+ })
+ .then(async (response) => {
+ let jsonResponse = null;
+ try {
+ jsonResponse = await response.json();
+ }
+ catch (e) {
+ throw new DataConnectError(Code.OTHER, JSON.stringify(e));
+ }
+ const message = getMessage(jsonResponse);
+ if (response.status >= 400) {
+ logError('Error while performing request: ' + JSON.stringify(jsonResponse));
+ if (response.status === 401) {
+ throw new DataConnectError(Code.UNAUTHORIZED, message);
+ }
+ throw new DataConnectError(Code.OTHER, message);
+ }
+ return jsonResponse;
+ })
+ .then(res => {
+ if (res.errors && res.errors.length) {
+ const stringified = JSON.stringify(res.errors);
+ const response = {
+ errors: res.errors,
+ data: res.data
+ };
+ throw new DataConnectOperationError('DataConnect error while performing request: ' + stringified, response);
+ }
+ return res;
+ });
+}
+function getMessage(obj) {
+ if ('message' in obj) {
+ return obj.message;
+ }
+ return JSON.stringify(obj);
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+class RESTTransport {
+ constructor(options, apiKey, appId, authProvider, appCheckProvider, transportOptions, _isUsingGen = false, _callerSdkType = CallerSdkTypeEnum.Base) {
+ this.apiKey = apiKey;
+ this.appId = appId;
+ this.authProvider = authProvider;
+ this.appCheckProvider = appCheckProvider;
+ this._isUsingGen = _isUsingGen;
+ this._callerSdkType = _callerSdkType;
+ this._host = '';
+ this._location = 'l';
+ this._connectorName = '';
+ this._secure = true;
+ this._project = 'p';
+ this._accessToken = null;
+ this._appCheckToken = null;
+ this._lastToken = null;
+ this._isUsingEmulator = false;
+ // TODO(mtewani): Update U to include shape of body defined in line 13.
+ this.invokeQuery = (queryName, body) => {
+ const abortController = new AbortController();
+ // TODO(mtewani): Update to proper value
+ const withAuth = this.withRetry(() => dcFetch(addToken(`${this.endpointUrl}:executeQuery`, this.apiKey), {
+ name: `projects/${this._project}/locations/${this._location}/services/${this._serviceName}/connectors/${this._connectorName}`,
+ operationName: queryName,
+ variables: body
+ }, abortController, this.appId, this._accessToken, this._appCheckToken, this._isUsingGen, this._callerSdkType, this._isUsingEmulator));
+ return withAuth;
+ };
+ this.invokeMutation = (mutationName, body) => {
+ const abortController = new AbortController();
+ const taskResult = this.withRetry(() => {
+ return dcFetch(addToken(`${this.endpointUrl}:executeMutation`, this.apiKey), {
+ name: `projects/${this._project}/locations/${this._location}/services/${this._serviceName}/connectors/${this._connectorName}`,
+ operationName: mutationName,
+ variables: body
+ }, abortController, this.appId, this._accessToken, this._appCheckToken, this._isUsingGen, this._callerSdkType, this._isUsingEmulator);
+ });
+ return taskResult;
+ };
+ if (transportOptions) {
+ if (typeof transportOptions.port === 'number') {
+ this._port = transportOptions.port;
+ }
+ if (typeof transportOptions.sslEnabled !== 'undefined') {
+ this._secure = transportOptions.sslEnabled;
+ }
+ this._host = transportOptions.host;
+ }
+ const { location, projectId: project, connector, service } = options;
+ if (location) {
+ this._location = location;
+ }
+ if (project) {
+ this._project = project;
+ }
+ this._serviceName = service;
+ if (!connector) {
+ throw new DataConnectError(Code.INVALID_ARGUMENT, 'Connector Name required!');
+ }
+ this._connectorName = connector;
+ this.authProvider?.addTokenChangeListener(token => {
+ logDebug(`New Token Available: ${token}`);
+ this._accessToken = token;
+ });
+ this.appCheckProvider?.addTokenChangeListener(result => {
+ const { token } = result;
+ logDebug(`New App Check Token Available: ${token}`);
+ this._appCheckToken = token;
+ });
+ }
+ get endpointUrl() {
+ return urlBuilder({
+ connector: this._connectorName,
+ location: this._location,
+ projectId: this._project,
+ service: this._serviceName
+ }, { host: this._host, sslEnabled: this._secure, port: this._port });
+ }
+ useEmulator(host, port, isSecure) {
+ this._host = host;
+ this._isUsingEmulator = true;
+ if (typeof port === 'number') {
+ this._port = port;
+ }
+ if (typeof isSecure !== 'undefined') {
+ this._secure = isSecure;
+ }
+ }
+ onTokenChanged(newToken) {
+ this._accessToken = newToken;
+ }
+ async getWithAuth(forceToken = false) {
+ let starterPromise = new Promise(resolve => resolve(this._accessToken));
+ if (this.appCheckProvider) {
+ this._appCheckToken = (await this.appCheckProvider.getToken())?.token;
+ }
+ if (this.authProvider) {
+ starterPromise = this.authProvider
+ .getToken(/*forceToken=*/ forceToken)
+ .then(data => {
+ if (!data) {
+ return null;
+ }
+ this._accessToken = data.accessToken;
+ return this._accessToken;
+ });
+ }
+ else {
+ starterPromise = new Promise(resolve => resolve(''));
+ }
+ return starterPromise;
+ }
+ _setLastToken(lastToken) {
+ this._lastToken = lastToken;
+ }
+ withRetry(promiseFactory, retry = false) {
+ let isNewToken = false;
+ return this.getWithAuth(retry)
+ .then(res => {
+ isNewToken = this._lastToken !== res;
+ this._lastToken = res;
+ return res;
+ })
+ .then(promiseFactory)
+ .catch(err => {
+ // Only retry if the result is unauthorized and the last token isn't the same as the new one.
+ if ('code' in err &&
+ err.code === Code.UNAUTHORIZED &&
+ !retry &&
+ isNewToken) {
+ logDebug('Retrying due to unauthorized');
+ return this.withRetry(promiseFactory, true);
+ }
+ throw err;
+ });
+ }
+ _setCallerSdkType(callerSdkType) {
+ this._callerSdkType = callerSdkType;
+ }
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ *
+ * @param dcInstance Data Connect instance
+ * @param mutationName name of mutation
+ * @param variables variables to send with mutation
+ * @returns `MutationRef`
+ */
+function mutationRef(dcInstance, mutationName, variables) {
+ dcInstance.setInitialized();
+ const ref = {
+ dataConnect: dcInstance,
+ name: mutationName,
+ refType: MUTATION_STR,
+ variables: variables
+ };
+ return ref;
+}
+/**
+ * @internal
+ */
+class MutationManager {
+ constructor(_transport) {
+ this._transport = _transport;
+ this._inflight = [];
+ }
+ executeMutation(mutationRef) {
+ const result = this._transport.invokeMutation(mutationRef.name, mutationRef.variables);
+ const withRefPromise = result.then(res => {
+ const obj = {
+ ...res, // Double check that the result is result.data, not just result
+ source: SOURCE_SERVER,
+ ref: mutationRef,
+ fetchTime: Date.now().toLocaleString()
+ };
+ return obj;
+ });
+ this._inflight.push(result);
+ const removePromise = () => (this._inflight = this._inflight.filter(promise => promise !== result));
+ result.then(removePromise, removePromise);
+ return withRefPromise;
+ }
+}
+/**
+ * Execute Mutation
+ * @param mutationRef mutation to execute
+ * @returns `MutationRef`
+ */
+function executeMutation(mutationRef) {
+ return mutationRef.dataConnect._mutationManager.executeMutation(mutationRef);
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+const FIREBASE_DATA_CONNECT_EMULATOR_HOST_VAR = 'FIREBASE_DATA_CONNECT_EMULATOR_HOST';
+/**
+ *
+ * @param fullHost
+ * @returns TransportOptions
+ * @internal
+ */
+function parseOptions(fullHost) {
+ const [protocol, hostName] = fullHost.split('://');
+ const isSecure = protocol === 'https';
+ const [host, portAsString] = hostName.split(':');
+ const port = Number(portAsString);
+ return { host, port, sslEnabled: isSecure };
+}
+/**
+ * Class representing Firebase Data Connect
+ */
+class DataConnect {
+ // @internal
+ constructor(app,
+ // TODO(mtewani): Replace with _dataConnectOptions in the future
+ dataConnectOptions, _authProvider, _appCheckProvider) {
+ this.app = app;
+ this.dataConnectOptions = dataConnectOptions;
+ this._authProvider = _authProvider;
+ this._appCheckProvider = _appCheckProvider;
+ this.isEmulator = false;
+ this._initialized = false;
+ this._isUsingGeneratedSdk = false;
+ this._callerSdkType = CallerSdkTypeEnum.Base;
+ if (typeof process !== 'undefined' && process.env) {
+ const host = process.env[FIREBASE_DATA_CONNECT_EMULATOR_HOST_VAR];
+ if (host) {
+ logDebug('Found custom host. Using emulator');
+ this.isEmulator = true;
+ this._transportOptions = parseOptions(host);
+ }
+ }
+ }
+ // @internal
+ _useGeneratedSdk() {
+ if (!this._isUsingGeneratedSdk) {
+ this._isUsingGeneratedSdk = true;
+ }
+ }
+ _setCallerSdkType(callerSdkType) {
+ this._callerSdkType = callerSdkType;
+ if (this._initialized) {
+ this._transport._setCallerSdkType(callerSdkType);
+ }
+ }
+ _delete() {
+ app._removeServiceInstance(this.app, 'data-connect', JSON.stringify(this.getSettings()));
+ return Promise.resolve();
+ }
+ // @internal
+ getSettings() {
+ const copy = JSON.parse(JSON.stringify(this.dataConnectOptions));
+ delete copy.projectId;
+ return copy;
+ }
+ // @internal
+ setInitialized() {
+ if (this._initialized) {
+ return;
+ }
+ if (this._transportClass === undefined) {
+ logDebug('transportClass not provided. Defaulting to RESTTransport.');
+ this._transportClass = RESTTransport;
+ }
+ if (this._authProvider) {
+ this._authTokenProvider = new FirebaseAuthProvider(this.app.name, this.app.options, this._authProvider);
+ }
+ if (this._appCheckProvider) {
+ this._appCheckTokenProvider = new AppCheckTokenProvider(this.app, this._appCheckProvider);
+ }
+ this._initialized = true;
+ this._transport = new this._transportClass(this.dataConnectOptions, this.app.options.apiKey, this.app.options.appId, this._authTokenProvider, this._appCheckTokenProvider, undefined, this._isUsingGeneratedSdk, this._callerSdkType);
+ if (this._transportOptions) {
+ this._transport.useEmulator(this._transportOptions.host, this._transportOptions.port, this._transportOptions.sslEnabled);
+ }
+ this._queryManager = new QueryManager(this._transport);
+ this._mutationManager = new MutationManager(this._transport);
+ }
+ // @internal
+ enableEmulator(transportOptions) {
+ if (this._initialized &&
+ !areTransportOptionsEqual(this._transportOptions, transportOptions)) {
+ logError('enableEmulator called after initialization');
+ throw new DataConnectError(Code.ALREADY_INITIALIZED, 'DataConnect instance already initialized!');
+ }
+ this._transportOptions = transportOptions;
+ this.isEmulator = true;
+ }
+}
+/**
+ * @internal
+ * @param transportOptions1
+ * @param transportOptions2
+ * @returns
+ */
+function areTransportOptionsEqual(transportOptions1, transportOptions2) {
+ return (transportOptions1.host === transportOptions2.host &&
+ transportOptions1.port === transportOptions2.port &&
+ transportOptions1.sslEnabled === transportOptions2.sslEnabled);
+}
+/**
+ * Connect to the DataConnect Emulator
+ * @param dc Data Connect instance
+ * @param host host of emulator server
+ * @param port port of emulator server
+ * @param sslEnabled use https
+ */
+function connectDataConnectEmulator(dc, host, port, sslEnabled = false) {
+ // Workaround to get cookies in Firebase Studio
+ if (util.isCloudWorkstation(host)) {
+ void util.pingServer(`https://${host}${port ? `:${port}` : ''}`);
+ util.updateEmulatorBanner('Data Connect', true);
+ }
+ dc.enableEmulator({ host, port, sslEnabled });
+}
+function getDataConnect(appOrOptions, optionalOptions) {
+ let app$1;
+ let dcOptions;
+ if ('location' in appOrOptions) {
+ dcOptions = appOrOptions;
+ app$1 = app.getApp();
+ }
+ else {
+ dcOptions = optionalOptions;
+ app$1 = appOrOptions;
+ }
+ if (!app$1 || Object.keys(app$1).length === 0) {
+ app$1 = app.getApp();
+ }
+ const provider = app._getProvider(app$1, 'data-connect');
+ const identifier = JSON.stringify(dcOptions);
+ if (provider.isInitialized(identifier)) {
+ const dcInstance = provider.getImmediate({ identifier });
+ const options = provider.getOptions(identifier);
+ const optionsValid = Object.keys(options).length > 0;
+ if (optionsValid) {
+ logDebug('Re-using cached instance');
+ return dcInstance;
+ }
+ }
+ validateDCOptions(dcOptions);
+ logDebug('Creating new DataConnect instance');
+ // Initialize with options.
+ return provider.initialize({
+ instanceIdentifier: identifier,
+ options: dcOptions
+ });
+}
+/**
+ *
+ * @param dcOptions
+ * @returns {void}
+ * @internal
+ */
+function validateDCOptions(dcOptions) {
+ const fields = ['connector', 'location', 'service'];
+ if (!dcOptions) {
+ throw new DataConnectError(Code.INVALID_ARGUMENT, 'DC Option Required');
+ }
+ fields.forEach(field => {
+ if (dcOptions[field] === null || dcOptions[field] === undefined) {
+ throw new DataConnectError(Code.INVALID_ARGUMENT, `${field} Required`);
+ }
+ });
+ return true;
+}
+/**
+ * Delete DataConnect instance
+ * @param dataConnect DataConnect instance
+ * @returns
+ */
+function terminate(dataConnect) {
+ return dataConnect._delete();
+ // TODO(mtewani): Stop pending tasks
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+function registerDataConnect(variant) {
+ setSDKVersion(app.SDK_VERSION);
+ app._registerComponent(new component.Component('data-connect', (container, { instanceIdentifier: settings, options }) => {
+ const app = container.getProvider('app').getImmediate();
+ const authProvider = container.getProvider('auth-internal');
+ const appCheckProvider = container.getProvider('app-check-internal');
+ let newOpts = options;
+ if (settings) {
+ newOpts = JSON.parse(settings);
+ }
+ if (!app.options.projectId) {
+ throw new DataConnectError(Code.INVALID_ARGUMENT, 'Project ID must be provided. Did you pass in a proper projectId to initializeApp?');
+ }
+ return new DataConnect(app, { ...newOpts, projectId: app.options.projectId }, authProvider, appCheckProvider);
+ }, "PUBLIC" /* ComponentType.PUBLIC */).setMultipleInstances(true));
+ app.registerVersion(name, version, variant);
+ // BUILD_TARGET will be replaced by values like esm, cjs, etc during the compilation
+ app.registerVersion(name, version, 'cjs2020');
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * Execute Query
+ * @param queryRef query to execute.
+ * @returns `QueryPromise`
+ */
+function executeQuery(queryRef) {
+ return queryRef.dataConnect._queryManager.executeQuery(queryRef);
+}
+/**
+ * Execute Query
+ * @param dcInstance Data Connect instance to use.
+ * @param queryName Query to execute
+ * @param variables Variables to execute with
+ * @param initialCache initial cache to use for client hydration
+ * @returns `QueryRef`
+ */
+function queryRef(dcInstance, queryName, variables, initialCache) {
+ dcInstance.setInitialized();
+ dcInstance._queryManager.track(queryName, variables, initialCache);
+ return {
+ dataConnect: dcInstance,
+ refType: QUERY_STR,
+ name: queryName,
+ variables
+ };
+}
+/**
+ * Converts serialized ref to query ref
+ * @param serializedRef ref to convert to `QueryRef`
+ * @returns `QueryRef`
+ */
+function toQueryRef(serializedRef) {
+ const { refInfo: { name, variables, connectorConfig } } = serializedRef;
+ return queryRef(getDataConnect(connectorConfig), name, variables);
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * The generated SDK will allow the user to pass in either the variable or the data connect instance with the variable,
+ * and this function validates the variables and returns back the DataConnect instance and variables based on the arguments passed in.
+ * @param connectorConfig
+ * @param dcOrVars
+ * @param vars
+ * @param validateVars
+ * @returns {DataConnect} and {Variables} instance
+ * @internal
+ */
+function validateArgs(connectorConfig, dcOrVars, vars, validateVars) {
+ let dcInstance;
+ let realVars;
+ if (dcOrVars && 'enableEmulator' in dcOrVars) {
+ dcInstance = dcOrVars;
+ realVars = vars;
+ }
+ else {
+ dcInstance = getDataConnect(connectorConfig);
+ realVars = dcOrVars;
+ }
+ if (!dcInstance || (!realVars && validateVars)) {
+ throw new DataConnectError(Code.INVALID_ARGUMENT, 'Variables required.');
+ }
+ return { dc: dcInstance, vars: realVars };
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * Subscribe to a `QueryRef`
+ * @param queryRefOrSerializedResult query ref or serialized result.
+ * @param observerOrOnNext observer object or next function.
+ * @param onError Callback to call when error gets thrown.
+ * @param onComplete Called when subscription completes.
+ * @returns `SubscriptionOptions`
+ */
+function subscribe(queryRefOrSerializedResult, observerOrOnNext, onError, onComplete) {
+ let ref;
+ let initialCache;
+ if ('refInfo' in queryRefOrSerializedResult) {
+ const serializedRef = queryRefOrSerializedResult;
+ const { data, source, fetchTime } = serializedRef;
+ initialCache = {
+ data,
+ source,
+ fetchTime
+ };
+ ref = toQueryRef(serializedRef);
+ }
+ else {
+ ref = queryRefOrSerializedResult;
+ }
+ let onResult = undefined;
+ if (typeof observerOrOnNext === 'function') {
+ onResult = observerOrOnNext;
+ }
+ else {
+ onResult = observerOrOnNext.onNext;
+ onError = observerOrOnNext.onErr;
+ observerOrOnNext.onComplete;
+ }
+ if (!onResult) {
+ throw new DataConnectError(Code.INVALID_ARGUMENT, 'Must provide onNext');
+ }
+ return ref.dataConnect._queryManager.addSubscription(ref, onResult, onError, initialCache);
+}
+
+/**
+ * Firebase Data Connect
+ *
+ * @packageDocumentation
+ */
+registerDataConnect();
+
+exports.CallerSdkTypeEnum = CallerSdkTypeEnum;
+exports.Code = Code;
+exports.DataConnect = DataConnect;
+exports.DataConnectError = DataConnectError;
+exports.DataConnectOperationError = DataConnectOperationError;
+exports.MUTATION_STR = MUTATION_STR;
+exports.MutationManager = MutationManager;
+exports.QUERY_STR = QUERY_STR;
+exports.SOURCE_CACHE = SOURCE_CACHE;
+exports.SOURCE_SERVER = SOURCE_SERVER;
+exports.areTransportOptionsEqual = areTransportOptionsEqual;
+exports.connectDataConnectEmulator = connectDataConnectEmulator;
+exports.executeMutation = executeMutation;
+exports.executeQuery = executeQuery;
+exports.getDataConnect = getDataConnect;
+exports.mutationRef = mutationRef;
+exports.parseOptions = parseOptions;
+exports.queryRef = queryRef;
+exports.setLogLevel = setLogLevel;
+exports.subscribe = subscribe;
+exports.terminate = terminate;
+exports.toQueryRef = toQueryRef;
+exports.validateArgs = validateArgs;
+exports.validateDCOptions = validateDCOptions;
+//# sourceMappingURL=index.cjs.js.map
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/index.cjs.js.map b/frontend-old/node_modules/@firebase/data-connect/dist/index.cjs.js.map
new file mode 100644
index 0000000..35c5547
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/index.cjs.js.map
@@ -0,0 +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/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 /** @internal */\n readonly name: string = 'DataConnectError';\n\n constructor(code: Code, message: string) {\n super(code, message);\n\n // Ensure the instanceof operator works as expected on subclasses of Error.\n // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#custom_error_types\n // and https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html#support-for-newtarget\n Object.setPrototypeOf(this, DataConnectError.prototype);\n }\n\n /** @internal */\n toString(): string {\n return `${this.name}[code=${this.code}]: ${this.message}`;\n }\n}\n\n/** An error returned by a DataConnect operation. */\nexport class DataConnectOperationError extends DataConnectError {\n /** @internal */\n readonly name: string = 'DataConnectOperationError';\n\n /** The response received from the backend. */\n readonly response: DataConnectOperationFailureResponse;\n\n /** @hideconstructor */\n constructor(message: string, response: DataConnectOperationFailureResponse) {\n super(Code.PARTIAL_ERROR, message);\n this.response = response;\n }\n}\n\nexport interface DataConnectOperationFailureResponse {\n // The \"data\" provided by the backend in the response message.\n //\n // Will be `undefined` if no \"data\" was provided in the response message.\n // Otherwise, will be `null` if `null` was explicitly specified as the \"data\"\n // in the response message. Otherwise, will be the value of the \"data\"\n // specified as the \"data\" in the response message\n readonly data?: Record<string, unknown> | null;\n\n // The list of errors provided by the backend in the response message.\n readonly errors: DataConnectOperationFailureResponseErrorInfo[];\n}\n\n// Information about the error, as provided in the response from the backend.\n// See https://spec.graphql.org/draft/#sec-Errors\nexport interface DataConnectOperationFailureResponseErrorInfo {\n // The error message.\n readonly message: string;\n\n // The path of the field in the response data to which this error relates.\n // String values in this array refer to field names. Numeric values in this\n // array always satisfy `Number.isInteger()` and refer to the index in an\n // array.\n readonly path: Array<string | number>;\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}/v1/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 { isCloudWorkstation } from '@firebase/util';\n\nimport {\n Code,\n DataConnectError,\n DataConnectOperationError,\n DataConnectOperationFailureResponse\n} from '../core/error';\nimport { SDK_VERSION } from '../core/version';\nimport { 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 _isUsingEmulator: 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, _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 const fetchOptions: RequestInit = {\n body: bodyStr,\n method: 'POST',\n headers,\n signal\n };\n if (isCloudWorkstation(url) && _isUsingEmulator) {\n fetchOptions.credentials = 'include';\n }\n\n return connectFetch(url, fetchOptions)\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 const response: DataConnectOperationFailureResponse = {\n errors: res.errors,\n data: res.data\n };\n throw new DataConnectOperationError(\n 'DataConnect error while performing request: ' + stringified,\n response\n );\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 private _isUsingEmulator = false;\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 this._isUsingEmulator = true;\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 this._isUsingEmulator\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 this._isUsingEmulator\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';\nimport {\n isCloudWorkstation,\n pingServer,\n updateEmulatorBanner\n} from '@firebase/util';\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 // Workaround to get cookies in Firebase Studio\n if (isCloudWorkstation(host)) {\n void pingServer(`https://${host}${port ? `:${port}` : ''}`);\n updateEmulatorBanner('Data Connect', true);\n }\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 esm, cjs, 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","isCloudWorkstation","_removeServiceInstance","pingServer","updateEmulatorBanner","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,CA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0B,CAAC;KAClC;IACD,IAAI,QAAQ,GAAsD,SAAS,CAAC;AAC5E,IAAA,IAAI,OAAO,gBAAgB,KAAK,UAAU,EAAE;QAC1C,QAAQ,GAAG,gBAAgB,CAAC;KAC7B;SAAM;AACL,QAAA,QAAQ,GAAG,gBAAgB,CAAC,MAAM,CAAC;AACnC,QAAA,OAAO,GAAG,gBAAgB,CAAC,KAAK,CAAC;AACjC,QAAa,gBAAgB,CAAC,UAAU,CAAC;KAC1C;IACD,IAAI,CAAC,QAAQ,EAAE;QACb,MAAM,IAAI,gBAAgB,CAAC,IAAI,CAAC,gBAAgB,EAAE,qBAAqB,CAAC,CAAC;KAC1E;AACD,IAAA,OAAO,GAAG,CAAC,WAAW,CAAC,aAAa,CAAC,eAAe,CAClD,GAAG,EACH,QAAQ,EACR,OAAO,EACP,YAAY,CACb,CAAC;AACJ;;AC3GA;;;;AAIG;AAwBH,mBAAmB,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/index.esm.js b/frontend-old/node_modules/@firebase/data-connect/dist/index.esm.js
new file mode 100644
index 0000000..f7fe54c
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/index.esm.js
@@ -0,0 +1,1236 @@
+import { _isFirebaseServerApp, _removeServiceInstance, getApp, _getProvider, _registerComponent, registerVersion, SDK_VERSION as SDK_VERSION$1 } from '@firebase/app';
+import { Component } from '@firebase/component';
+import { FirebaseError, isCloudWorkstation, pingServer, updateEmulatorBanner } from '@firebase/util';
+import { Logger } from '@firebase/logger';
+
+const name = "@firebase/data-connect";
+const version = "0.3.11";
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/** The semver (www.semver.org) version of the SDK. */
+let SDK_VERSION = '';
+/**
+ * SDK_VERSION should be set before any database instance is created
+ * @internal
+ */
+function setSDKVersion(version) {
+ SDK_VERSION = version;
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @internal
+ * Abstraction around AppCheck's token fetching capabilities.
+ */
+class AppCheckTokenProvider {
+ constructor(app, appCheckProvider) {
+ this.appCheckProvider = appCheckProvider;
+ if (_isFirebaseServerApp(app) && app.settings.appCheckToken) {
+ this.serverAppAppCheckToken = app.settings.appCheckToken;
+ }
+ this.appCheck = appCheckProvider?.getImmediate({ optional: true });
+ if (!this.appCheck) {
+ void appCheckProvider
+ ?.get()
+ .then(appCheck => (this.appCheck = appCheck))
+ .catch();
+ }
+ }
+ getToken() {
+ if (this.serverAppAppCheckToken) {
+ return Promise.resolve({ token: this.serverAppAppCheckToken });
+ }
+ if (!this.appCheck) {
+ return new Promise((resolve, reject) => {
+ // Support delayed initialization of FirebaseAppCheck. This allows our
+ // customers to initialize the RTDB SDK before initializing Firebase
+ // AppCheck and ensures that all requests are authenticated if a token
+ // becomes available before the timoeout below expires.
+ setTimeout(() => {
+ if (this.appCheck) {
+ this.getToken().then(resolve, reject);
+ }
+ else {
+ resolve(null);
+ }
+ }, 0);
+ });
+ }
+ return this.appCheck.getToken();
+ }
+ addTokenChangeListener(listener) {
+ void this.appCheckProvider
+ ?.get()
+ .then(appCheck => appCheck.addTokenListener(listener));
+ }
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+const Code = {
+ OTHER: 'other',
+ ALREADY_INITIALIZED: 'already-initialized',
+ NOT_INITIALIZED: 'not-initialized',
+ NOT_SUPPORTED: 'not-supported',
+ INVALID_ARGUMENT: 'invalid-argument',
+ PARTIAL_ERROR: 'partial-error',
+ UNAUTHORIZED: 'unauthorized'
+};
+/** An error returned by a DataConnect operation. */
+class DataConnectError extends FirebaseError {
+ constructor(code, message) {
+ super(code, message);
+ /** @internal */
+ this.name = 'DataConnectError';
+ // Ensure the instanceof operator works as expected on subclasses of Error.
+ // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#custom_error_types
+ // and https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html#support-for-newtarget
+ Object.setPrototypeOf(this, DataConnectError.prototype);
+ }
+ /** @internal */
+ toString() {
+ return `${this.name}[code=${this.code}]: ${this.message}`;
+ }
+}
+/** An error returned by a DataConnect operation. */
+class DataConnectOperationError extends DataConnectError {
+ /** @hideconstructor */
+ constructor(message, response) {
+ super(Code.PARTIAL_ERROR, message);
+ /** @internal */
+ this.name = 'DataConnectOperationError';
+ this.response = response;
+ }
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+const logger = new Logger('@firebase/data-connect');
+function setLogLevel(logLevel) {
+ logger.setLogLevel(logLevel);
+}
+function logDebug(msg) {
+ logger.debug(`DataConnect (${SDK_VERSION}): ${msg}`);
+}
+function logError(msg) {
+ logger.error(`DataConnect (${SDK_VERSION}): ${msg}`);
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// @internal
+class FirebaseAuthProvider {
+ constructor(_appName, _options, _authProvider) {
+ this._appName = _appName;
+ this._options = _options;
+ this._authProvider = _authProvider;
+ this._auth = _authProvider.getImmediate({ optional: true });
+ if (!this._auth) {
+ _authProvider.onInit(auth => (this._auth = auth));
+ }
+ }
+ getToken(forceRefresh) {
+ if (!this._auth) {
+ return new Promise((resolve, reject) => {
+ setTimeout(() => {
+ if (this._auth) {
+ this.getToken(forceRefresh).then(resolve, reject);
+ }
+ else {
+ resolve(null);
+ }
+ }, 0);
+ });
+ }
+ return this._auth.getToken(forceRefresh).catch(error => {
+ if (error && error.code === 'auth/token-not-initialized') {
+ logDebug('Got auth/token-not-initialized error. Treating as null token.');
+ return null;
+ }
+ else {
+ logError('Error received when attempting to retrieve token: ' +
+ JSON.stringify(error));
+ return Promise.reject(error);
+ }
+ });
+ }
+ addTokenChangeListener(listener) {
+ this._auth?.addAuthTokenListener(listener);
+ }
+ removeTokenChangeListener(listener) {
+ this._authProvider
+ .get()
+ .then(auth => auth.removeAuthTokenListener(listener))
+ .catch(err => logError(err));
+ }
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+const QUERY_STR = 'query';
+const MUTATION_STR = 'mutation';
+const SOURCE_SERVER = 'SERVER';
+const SOURCE_CACHE = 'CACHE';
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+let encoderImpl;
+function setEncoder(encoder) {
+ encoderImpl = encoder;
+}
+setEncoder(o => JSON.stringify(o));
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+function setIfNotExists(map, key, val) {
+ if (!map.has(key)) {
+ map.set(key, val);
+ }
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+function getRefSerializer(queryRef, data, source) {
+ return function toJSON() {
+ return {
+ data,
+ refInfo: {
+ name: queryRef.name,
+ variables: queryRef.variables,
+ connectorConfig: {
+ projectId: queryRef.dataConnect.app.options.projectId,
+ ...queryRef.dataConnect.getSettings()
+ }
+ },
+ fetchTime: Date.now().toLocaleString(),
+ source
+ };
+ };
+}
+class QueryManager {
+ constructor(transport) {
+ this.transport = transport;
+ this._queries = new Map();
+ }
+ track(queryName, variables, initialCache) {
+ const ref = {
+ name: queryName,
+ variables,
+ refType: QUERY_STR
+ };
+ const key = encoderImpl(ref);
+ const newTrackedQuery = {
+ ref,
+ subscriptions: [],
+ currentCache: initialCache || null,
+ lastError: null
+ };
+ // @ts-ignore
+ setIfNotExists(this._queries, key, newTrackedQuery);
+ return this._queries.get(key);
+ }
+ addSubscription(queryRef, onResultCallback, onErrorCallback, initialCache) {
+ const key = encoderImpl({
+ name: queryRef.name,
+ variables: queryRef.variables,
+ refType: QUERY_STR
+ });
+ const trackedQuery = this._queries.get(key);
+ const subscription = {
+ userCallback: onResultCallback,
+ errCallback: onErrorCallback
+ };
+ const unsubscribe = () => {
+ const trackedQuery = this._queries.get(key);
+ trackedQuery.subscriptions = trackedQuery.subscriptions.filter(sub => sub !== subscription);
+ };
+ if (initialCache && trackedQuery.currentCache !== initialCache) {
+ logDebug('Initial cache found. Comparing dates.');
+ if (!trackedQuery.currentCache ||
+ (trackedQuery.currentCache &&
+ compareDates(trackedQuery.currentCache.fetchTime, initialCache.fetchTime))) {
+ trackedQuery.currentCache = initialCache;
+ }
+ }
+ if (trackedQuery.currentCache !== null) {
+ const cachedData = trackedQuery.currentCache.data;
+ onResultCallback({
+ data: cachedData,
+ source: SOURCE_CACHE,
+ ref: queryRef,
+ toJSON: getRefSerializer(queryRef, trackedQuery.currentCache.data, SOURCE_CACHE),
+ fetchTime: trackedQuery.currentCache.fetchTime
+ });
+ if (trackedQuery.lastError !== null && onErrorCallback) {
+ onErrorCallback(undefined);
+ }
+ }
+ trackedQuery.subscriptions.push({
+ userCallback: onResultCallback,
+ errCallback: onErrorCallback,
+ unsubscribe
+ });
+ if (!trackedQuery.currentCache) {
+ logDebug(`No cache available for query ${queryRef.name} with variables ${JSON.stringify(queryRef.variables)}. Calling executeQuery.`);
+ const promise = this.executeQuery(queryRef);
+ // We want to ignore the error and let subscriptions handle it
+ promise.then(undefined, err => { });
+ }
+ return unsubscribe;
+ }
+ executeQuery(queryRef) {
+ if (queryRef.refType !== QUERY_STR) {
+ throw new DataConnectError(Code.INVALID_ARGUMENT, `ExecuteQuery can only execute query operation`);
+ }
+ const key = encoderImpl({
+ name: queryRef.name,
+ variables: queryRef.variables,
+ refType: QUERY_STR
+ });
+ const trackedQuery = this._queries.get(key);
+ const result = this.transport.invokeQuery(queryRef.name, queryRef.variables);
+ const newR = result.then(res => {
+ const fetchTime = new Date().toString();
+ const result = {
+ ...res,
+ source: SOURCE_SERVER,
+ ref: queryRef,
+ toJSON: getRefSerializer(queryRef, res.data, SOURCE_SERVER),
+ fetchTime
+ };
+ trackedQuery.subscriptions.forEach(subscription => {
+ subscription.userCallback(result);
+ });
+ trackedQuery.currentCache = {
+ data: res.data,
+ source: SOURCE_CACHE,
+ fetchTime
+ };
+ return result;
+ }, err => {
+ trackedQuery.lastError = err;
+ trackedQuery.subscriptions.forEach(subscription => {
+ if (subscription.errCallback) {
+ subscription.errCallback(err);
+ }
+ });
+ throw err;
+ });
+ return newR;
+ }
+ enableEmulator(host, port) {
+ this.transport.useEmulator(host, port);
+ }
+}
+function compareDates(str1, str2) {
+ const date1 = new Date(str1);
+ const date2 = new Date(str2);
+ return date1.getTime() < date2.getTime();
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+const CallerSdkTypeEnum = {
+ Base: 'Base', // Core JS SDK
+ Generated: 'Generated', // Generated JS SDK
+ TanstackReactCore: 'TanstackReactCore', // Tanstack non-generated React SDK
+ GeneratedReact: 'GeneratedReact', // Tanstack non-generated Angular SDK
+ TanstackAngularCore: 'TanstackAngularCore', // Tanstack non-generated Angular SDK
+ GeneratedAngular: 'GeneratedAngular' // Generated Angular SDK
+};
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+function urlBuilder(projectConfig, transportOptions) {
+ const { connector, location, projectId: project, service } = projectConfig;
+ const { host, sslEnabled, port } = transportOptions;
+ const protocol = sslEnabled ? 'https' : 'http';
+ const realHost = host || `firebasedataconnect.googleapis.com`;
+ let baseUrl = `${protocol}://${realHost}`;
+ if (typeof port === 'number') {
+ baseUrl += `:${port}`;
+ }
+ else if (typeof port !== 'undefined') {
+ logError('Port type is of an invalid type');
+ throw new DataConnectError(Code.INVALID_ARGUMENT, 'Incorrect type for port passed in!');
+ }
+ return `${baseUrl}/v1/projects/${project}/locations/${location}/services/${service}/connectors/${connector}`;
+}
+function addToken(url, apiKey) {
+ if (!apiKey) {
+ return url;
+ }
+ const newUrl = new URL(url);
+ newUrl.searchParams.append('key', apiKey);
+ return newUrl.toString();
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+let connectFetch = globalThis.fetch;
+function getGoogApiClientValue(_isUsingGen, _callerSdkType) {
+ let str = 'gl-js/ fire/' + SDK_VERSION;
+ if (_callerSdkType !== CallerSdkTypeEnum.Base &&
+ _callerSdkType !== CallerSdkTypeEnum.Generated) {
+ str += ' js/' + _callerSdkType.toLowerCase();
+ }
+ else if (_isUsingGen || _callerSdkType === CallerSdkTypeEnum.Generated) {
+ str += ' js/gen';
+ }
+ return str;
+}
+function dcFetch(url, body, { signal }, appId, accessToken, appCheckToken, _isUsingGen, _callerSdkType, _isUsingEmulator) {
+ if (!connectFetch) {
+ throw new DataConnectError(Code.OTHER, 'No Fetch Implementation detected!');
+ }
+ const headers = {
+ 'Content-Type': 'application/json',
+ 'X-Goog-Api-Client': getGoogApiClientValue(_isUsingGen, _callerSdkType)
+ };
+ if (accessToken) {
+ headers['X-Firebase-Auth-Token'] = accessToken;
+ }
+ if (appId) {
+ headers['x-firebase-gmpid'] = appId;
+ }
+ if (appCheckToken) {
+ headers['X-Firebase-AppCheck'] = appCheckToken;
+ }
+ const bodyStr = JSON.stringify(body);
+ const fetchOptions = {
+ body: bodyStr,
+ method: 'POST',
+ headers,
+ signal
+ };
+ if (isCloudWorkstation(url) && _isUsingEmulator) {
+ fetchOptions.credentials = 'include';
+ }
+ return connectFetch(url, fetchOptions)
+ .catch(err => {
+ throw new DataConnectError(Code.OTHER, 'Failed to fetch: ' + JSON.stringify(err));
+ })
+ .then(async (response) => {
+ let jsonResponse = null;
+ try {
+ jsonResponse = await response.json();
+ }
+ catch (e) {
+ throw new DataConnectError(Code.OTHER, JSON.stringify(e));
+ }
+ const message = getMessage(jsonResponse);
+ if (response.status >= 400) {
+ logError('Error while performing request: ' + JSON.stringify(jsonResponse));
+ if (response.status === 401) {
+ throw new DataConnectError(Code.UNAUTHORIZED, message);
+ }
+ throw new DataConnectError(Code.OTHER, message);
+ }
+ return jsonResponse;
+ })
+ .then(res => {
+ if (res.errors && res.errors.length) {
+ const stringified = JSON.stringify(res.errors);
+ const response = {
+ errors: res.errors,
+ data: res.data
+ };
+ throw new DataConnectOperationError('DataConnect error while performing request: ' + stringified, response);
+ }
+ return res;
+ });
+}
+function getMessage(obj) {
+ if ('message' in obj) {
+ return obj.message;
+ }
+ return JSON.stringify(obj);
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+class RESTTransport {
+ constructor(options, apiKey, appId, authProvider, appCheckProvider, transportOptions, _isUsingGen = false, _callerSdkType = CallerSdkTypeEnum.Base) {
+ this.apiKey = apiKey;
+ this.appId = appId;
+ this.authProvider = authProvider;
+ this.appCheckProvider = appCheckProvider;
+ this._isUsingGen = _isUsingGen;
+ this._callerSdkType = _callerSdkType;
+ this._host = '';
+ this._location = 'l';
+ this._connectorName = '';
+ this._secure = true;
+ this._project = 'p';
+ this._accessToken = null;
+ this._appCheckToken = null;
+ this._lastToken = null;
+ this._isUsingEmulator = false;
+ // TODO(mtewani): Update U to include shape of body defined in line 13.
+ this.invokeQuery = (queryName, body) => {
+ const abortController = new AbortController();
+ // TODO(mtewani): Update to proper value
+ const withAuth = this.withRetry(() => dcFetch(addToken(`${this.endpointUrl}:executeQuery`, this.apiKey), {
+ name: `projects/${this._project}/locations/${this._location}/services/${this._serviceName}/connectors/${this._connectorName}`,
+ operationName: queryName,
+ variables: body
+ }, abortController, this.appId, this._accessToken, this._appCheckToken, this._isUsingGen, this._callerSdkType, this._isUsingEmulator));
+ return withAuth;
+ };
+ this.invokeMutation = (mutationName, body) => {
+ const abortController = new AbortController();
+ const taskResult = this.withRetry(() => {
+ return dcFetch(addToken(`${this.endpointUrl}:executeMutation`, this.apiKey), {
+ name: `projects/${this._project}/locations/${this._location}/services/${this._serviceName}/connectors/${this._connectorName}`,
+ operationName: mutationName,
+ variables: body
+ }, abortController, this.appId, this._accessToken, this._appCheckToken, this._isUsingGen, this._callerSdkType, this._isUsingEmulator);
+ });
+ return taskResult;
+ };
+ if (transportOptions) {
+ if (typeof transportOptions.port === 'number') {
+ this._port = transportOptions.port;
+ }
+ if (typeof transportOptions.sslEnabled !== 'undefined') {
+ this._secure = transportOptions.sslEnabled;
+ }
+ this._host = transportOptions.host;
+ }
+ const { location, projectId: project, connector, service } = options;
+ if (location) {
+ this._location = location;
+ }
+ if (project) {
+ this._project = project;
+ }
+ this._serviceName = service;
+ if (!connector) {
+ throw new DataConnectError(Code.INVALID_ARGUMENT, 'Connector Name required!');
+ }
+ this._connectorName = connector;
+ this.authProvider?.addTokenChangeListener(token => {
+ logDebug(`New Token Available: ${token}`);
+ this._accessToken = token;
+ });
+ this.appCheckProvider?.addTokenChangeListener(result => {
+ const { token } = result;
+ logDebug(`New App Check Token Available: ${token}`);
+ this._appCheckToken = token;
+ });
+ }
+ get endpointUrl() {
+ return urlBuilder({
+ connector: this._connectorName,
+ location: this._location,
+ projectId: this._project,
+ service: this._serviceName
+ }, { host: this._host, sslEnabled: this._secure, port: this._port });
+ }
+ useEmulator(host, port, isSecure) {
+ this._host = host;
+ this._isUsingEmulator = true;
+ if (typeof port === 'number') {
+ this._port = port;
+ }
+ if (typeof isSecure !== 'undefined') {
+ this._secure = isSecure;
+ }
+ }
+ onTokenChanged(newToken) {
+ this._accessToken = newToken;
+ }
+ async getWithAuth(forceToken = false) {
+ let starterPromise = new Promise(resolve => resolve(this._accessToken));
+ if (this.appCheckProvider) {
+ this._appCheckToken = (await this.appCheckProvider.getToken())?.token;
+ }
+ if (this.authProvider) {
+ starterPromise = this.authProvider
+ .getToken(/*forceToken=*/ forceToken)
+ .then(data => {
+ if (!data) {
+ return null;
+ }
+ this._accessToken = data.accessToken;
+ return this._accessToken;
+ });
+ }
+ else {
+ starterPromise = new Promise(resolve => resolve(''));
+ }
+ return starterPromise;
+ }
+ _setLastToken(lastToken) {
+ this._lastToken = lastToken;
+ }
+ withRetry(promiseFactory, retry = false) {
+ let isNewToken = false;
+ return this.getWithAuth(retry)
+ .then(res => {
+ isNewToken = this._lastToken !== res;
+ this._lastToken = res;
+ return res;
+ })
+ .then(promiseFactory)
+ .catch(err => {
+ // Only retry if the result is unauthorized and the last token isn't the same as the new one.
+ if ('code' in err &&
+ err.code === Code.UNAUTHORIZED &&
+ !retry &&
+ isNewToken) {
+ logDebug('Retrying due to unauthorized');
+ return this.withRetry(promiseFactory, true);
+ }
+ throw err;
+ });
+ }
+ _setCallerSdkType(callerSdkType) {
+ this._callerSdkType = callerSdkType;
+ }
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ *
+ * @param dcInstance Data Connect instance
+ * @param mutationName name of mutation
+ * @param variables variables to send with mutation
+ * @returns `MutationRef`
+ */
+function mutationRef(dcInstance, mutationName, variables) {
+ dcInstance.setInitialized();
+ const ref = {
+ dataConnect: dcInstance,
+ name: mutationName,
+ refType: MUTATION_STR,
+ variables: variables
+ };
+ return ref;
+}
+/**
+ * @internal
+ */
+class MutationManager {
+ constructor(_transport) {
+ this._transport = _transport;
+ this._inflight = [];
+ }
+ executeMutation(mutationRef) {
+ const result = this._transport.invokeMutation(mutationRef.name, mutationRef.variables);
+ const withRefPromise = result.then(res => {
+ const obj = {
+ ...res, // Double check that the result is result.data, not just result
+ source: SOURCE_SERVER,
+ ref: mutationRef,
+ fetchTime: Date.now().toLocaleString()
+ };
+ return obj;
+ });
+ this._inflight.push(result);
+ const removePromise = () => (this._inflight = this._inflight.filter(promise => promise !== result));
+ result.then(removePromise, removePromise);
+ return withRefPromise;
+ }
+}
+/**
+ * Execute Mutation
+ * @param mutationRef mutation to execute
+ * @returns `MutationRef`
+ */
+function executeMutation(mutationRef) {
+ return mutationRef.dataConnect._mutationManager.executeMutation(mutationRef);
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+const FIREBASE_DATA_CONNECT_EMULATOR_HOST_VAR = 'FIREBASE_DATA_CONNECT_EMULATOR_HOST';
+/**
+ *
+ * @param fullHost
+ * @returns TransportOptions
+ * @internal
+ */
+function parseOptions(fullHost) {
+ const [protocol, hostName] = fullHost.split('://');
+ const isSecure = protocol === 'https';
+ const [host, portAsString] = hostName.split(':');
+ const port = Number(portAsString);
+ return { host, port, sslEnabled: isSecure };
+}
+/**
+ * Class representing Firebase Data Connect
+ */
+class DataConnect {
+ // @internal
+ constructor(app,
+ // TODO(mtewani): Replace with _dataConnectOptions in the future
+ dataConnectOptions, _authProvider, _appCheckProvider) {
+ this.app = app;
+ this.dataConnectOptions = dataConnectOptions;
+ this._authProvider = _authProvider;
+ this._appCheckProvider = _appCheckProvider;
+ this.isEmulator = false;
+ this._initialized = false;
+ this._isUsingGeneratedSdk = false;
+ this._callerSdkType = CallerSdkTypeEnum.Base;
+ if (typeof process !== 'undefined' && process.env) {
+ const host = process.env[FIREBASE_DATA_CONNECT_EMULATOR_HOST_VAR];
+ if (host) {
+ logDebug('Found custom host. Using emulator');
+ this.isEmulator = true;
+ this._transportOptions = parseOptions(host);
+ }
+ }
+ }
+ // @internal
+ _useGeneratedSdk() {
+ if (!this._isUsingGeneratedSdk) {
+ this._isUsingGeneratedSdk = true;
+ }
+ }
+ _setCallerSdkType(callerSdkType) {
+ this._callerSdkType = callerSdkType;
+ if (this._initialized) {
+ this._transport._setCallerSdkType(callerSdkType);
+ }
+ }
+ _delete() {
+ _removeServiceInstance(this.app, 'data-connect', JSON.stringify(this.getSettings()));
+ return Promise.resolve();
+ }
+ // @internal
+ getSettings() {
+ const copy = JSON.parse(JSON.stringify(this.dataConnectOptions));
+ delete copy.projectId;
+ return copy;
+ }
+ // @internal
+ setInitialized() {
+ if (this._initialized) {
+ return;
+ }
+ if (this._transportClass === undefined) {
+ logDebug('transportClass not provided. Defaulting to RESTTransport.');
+ this._transportClass = RESTTransport;
+ }
+ if (this._authProvider) {
+ this._authTokenProvider = new FirebaseAuthProvider(this.app.name, this.app.options, this._authProvider);
+ }
+ if (this._appCheckProvider) {
+ this._appCheckTokenProvider = new AppCheckTokenProvider(this.app, this._appCheckProvider);
+ }
+ this._initialized = true;
+ this._transport = new this._transportClass(this.dataConnectOptions, this.app.options.apiKey, this.app.options.appId, this._authTokenProvider, this._appCheckTokenProvider, undefined, this._isUsingGeneratedSdk, this._callerSdkType);
+ if (this._transportOptions) {
+ this._transport.useEmulator(this._transportOptions.host, this._transportOptions.port, this._transportOptions.sslEnabled);
+ }
+ this._queryManager = new QueryManager(this._transport);
+ this._mutationManager = new MutationManager(this._transport);
+ }
+ // @internal
+ enableEmulator(transportOptions) {
+ if (this._initialized &&
+ !areTransportOptionsEqual(this._transportOptions, transportOptions)) {
+ logError('enableEmulator called after initialization');
+ throw new DataConnectError(Code.ALREADY_INITIALIZED, 'DataConnect instance already initialized!');
+ }
+ this._transportOptions = transportOptions;
+ this.isEmulator = true;
+ }
+}
+/**
+ * @internal
+ * @param transportOptions1
+ * @param transportOptions2
+ * @returns
+ */
+function areTransportOptionsEqual(transportOptions1, transportOptions2) {
+ return (transportOptions1.host === transportOptions2.host &&
+ transportOptions1.port === transportOptions2.port &&
+ transportOptions1.sslEnabled === transportOptions2.sslEnabled);
+}
+/**
+ * Connect to the DataConnect Emulator
+ * @param dc Data Connect instance
+ * @param host host of emulator server
+ * @param port port of emulator server
+ * @param sslEnabled use https
+ */
+function connectDataConnectEmulator(dc, host, port, sslEnabled = false) {
+ // Workaround to get cookies in Firebase Studio
+ if (isCloudWorkstation(host)) {
+ void pingServer(`https://${host}${port ? `:${port}` : ''}`);
+ updateEmulatorBanner('Data Connect', true);
+ }
+ dc.enableEmulator({ host, port, sslEnabled });
+}
+function getDataConnect(appOrOptions, optionalOptions) {
+ let app;
+ let dcOptions;
+ if ('location' in appOrOptions) {
+ dcOptions = appOrOptions;
+ app = getApp();
+ }
+ else {
+ dcOptions = optionalOptions;
+ app = appOrOptions;
+ }
+ if (!app || Object.keys(app).length === 0) {
+ app = getApp();
+ }
+ const provider = _getProvider(app, 'data-connect');
+ const identifier = JSON.stringify(dcOptions);
+ if (provider.isInitialized(identifier)) {
+ const dcInstance = provider.getImmediate({ identifier });
+ const options = provider.getOptions(identifier);
+ const optionsValid = Object.keys(options).length > 0;
+ if (optionsValid) {
+ logDebug('Re-using cached instance');
+ return dcInstance;
+ }
+ }
+ validateDCOptions(dcOptions);
+ logDebug('Creating new DataConnect instance');
+ // Initialize with options.
+ return provider.initialize({
+ instanceIdentifier: identifier,
+ options: dcOptions
+ });
+}
+/**
+ *
+ * @param dcOptions
+ * @returns {void}
+ * @internal
+ */
+function validateDCOptions(dcOptions) {
+ const fields = ['connector', 'location', 'service'];
+ if (!dcOptions) {
+ throw new DataConnectError(Code.INVALID_ARGUMENT, 'DC Option Required');
+ }
+ fields.forEach(field => {
+ if (dcOptions[field] === null || dcOptions[field] === undefined) {
+ throw new DataConnectError(Code.INVALID_ARGUMENT, `${field} Required`);
+ }
+ });
+ return true;
+}
+/**
+ * Delete DataConnect instance
+ * @param dataConnect DataConnect instance
+ * @returns
+ */
+function terminate(dataConnect) {
+ return dataConnect._delete();
+ // TODO(mtewani): Stop pending tasks
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+function registerDataConnect(variant) {
+ setSDKVersion(SDK_VERSION$1);
+ _registerComponent(new Component('data-connect', (container, { instanceIdentifier: settings, options }) => {
+ const app = container.getProvider('app').getImmediate();
+ const authProvider = container.getProvider('auth-internal');
+ const appCheckProvider = container.getProvider('app-check-internal');
+ let newOpts = options;
+ if (settings) {
+ newOpts = JSON.parse(settings);
+ }
+ if (!app.options.projectId) {
+ throw new DataConnectError(Code.INVALID_ARGUMENT, 'Project ID must be provided. Did you pass in a proper projectId to initializeApp?');
+ }
+ return new DataConnect(app, { ...newOpts, projectId: app.options.projectId }, authProvider, appCheckProvider);
+ }, "PUBLIC" /* ComponentType.PUBLIC */).setMultipleInstances(true));
+ registerVersion(name, version, variant);
+ // BUILD_TARGET will be replaced by values like esm, cjs, etc during the compilation
+ registerVersion(name, version, 'esm2020');
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * Execute Query
+ * @param queryRef query to execute.
+ * @returns `QueryPromise`
+ */
+function executeQuery(queryRef) {
+ return queryRef.dataConnect._queryManager.executeQuery(queryRef);
+}
+/**
+ * Execute Query
+ * @param dcInstance Data Connect instance to use.
+ * @param queryName Query to execute
+ * @param variables Variables to execute with
+ * @param initialCache initial cache to use for client hydration
+ * @returns `QueryRef`
+ */
+function queryRef(dcInstance, queryName, variables, initialCache) {
+ dcInstance.setInitialized();
+ dcInstance._queryManager.track(queryName, variables, initialCache);
+ return {
+ dataConnect: dcInstance,
+ refType: QUERY_STR,
+ name: queryName,
+ variables
+ };
+}
+/**
+ * Converts serialized ref to query ref
+ * @param serializedRef ref to convert to `QueryRef`
+ * @returns `QueryRef`
+ */
+function toQueryRef(serializedRef) {
+ const { refInfo: { name, variables, connectorConfig } } = serializedRef;
+ return queryRef(getDataConnect(connectorConfig), name, variables);
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * The generated SDK will allow the user to pass in either the variable or the data connect instance with the variable,
+ * and this function validates the variables and returns back the DataConnect instance and variables based on the arguments passed in.
+ * @param connectorConfig
+ * @param dcOrVars
+ * @param vars
+ * @param validateVars
+ * @returns {DataConnect} and {Variables} instance
+ * @internal
+ */
+function validateArgs(connectorConfig, dcOrVars, vars, validateVars) {
+ let dcInstance;
+ let realVars;
+ if (dcOrVars && 'enableEmulator' in dcOrVars) {
+ dcInstance = dcOrVars;
+ realVars = vars;
+ }
+ else {
+ dcInstance = getDataConnect(connectorConfig);
+ realVars = dcOrVars;
+ }
+ if (!dcInstance || (!realVars && validateVars)) {
+ throw new DataConnectError(Code.INVALID_ARGUMENT, 'Variables required.');
+ }
+ return { dc: dcInstance, vars: realVars };
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * Subscribe to a `QueryRef`
+ * @param queryRefOrSerializedResult query ref or serialized result.
+ * @param observerOrOnNext observer object or next function.
+ * @param onError Callback to call when error gets thrown.
+ * @param onComplete Called when subscription completes.
+ * @returns `SubscriptionOptions`
+ */
+function subscribe(queryRefOrSerializedResult, observerOrOnNext, onError, onComplete) {
+ let ref;
+ let initialCache;
+ if ('refInfo' in queryRefOrSerializedResult) {
+ const serializedRef = queryRefOrSerializedResult;
+ const { data, source, fetchTime } = serializedRef;
+ initialCache = {
+ data,
+ source,
+ fetchTime
+ };
+ ref = toQueryRef(serializedRef);
+ }
+ else {
+ ref = queryRefOrSerializedResult;
+ }
+ let onResult = undefined;
+ if (typeof observerOrOnNext === 'function') {
+ onResult = observerOrOnNext;
+ }
+ else {
+ onResult = observerOrOnNext.onNext;
+ onError = observerOrOnNext.onErr;
+ observerOrOnNext.onComplete;
+ }
+ if (!onResult) {
+ throw new DataConnectError(Code.INVALID_ARGUMENT, 'Must provide onNext');
+ }
+ return ref.dataConnect._queryManager.addSubscription(ref, onResult, onError, initialCache);
+}
+
+/**
+ * Firebase Data Connect
+ *
+ * @packageDocumentation
+ */
+registerDataConnect();
+
+export { CallerSdkTypeEnum, Code, DataConnect, DataConnectError, DataConnectOperationError, MUTATION_STR, MutationManager, QUERY_STR, SOURCE_CACHE, SOURCE_SERVER, areTransportOptionsEqual, connectDataConnectEmulator, executeMutation, executeQuery, getDataConnect, mutationRef, parseOptions, queryRef, setLogLevel, subscribe, terminate, toQueryRef, validateArgs, validateDCOptions };
+//# sourceMappingURL=index.esm.js.map
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/index.esm.js.map b/frontend-old/node_modules/@firebase/data-connect/dist/index.esm.js.map
new file mode 100644
index 0000000..72d1ba2
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/index.esm.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"index.esm.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/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 /** @internal */\n readonly name: string = 'DataConnectError';\n\n constructor(code: Code, message: string) {\n super(code, message);\n\n // Ensure the instanceof operator works as expected on subclasses of Error.\n // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#custom_error_types\n // and https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html#support-for-newtarget\n Object.setPrototypeOf(this, DataConnectError.prototype);\n }\n\n /** @internal */\n toString(): string {\n return `${this.name}[code=${this.code}]: ${this.message}`;\n }\n}\n\n/** An error returned by a DataConnect operation. */\nexport class DataConnectOperationError extends DataConnectError {\n /** @internal */\n readonly name: string = 'DataConnectOperationError';\n\n /** The response received from the backend. */\n readonly response: DataConnectOperationFailureResponse;\n\n /** @hideconstructor */\n constructor(message: string, response: DataConnectOperationFailureResponse) {\n super(Code.PARTIAL_ERROR, message);\n this.response = response;\n }\n}\n\nexport interface DataConnectOperationFailureResponse {\n // The \"data\" provided by the backend in the response message.\n //\n // Will be `undefined` if no \"data\" was provided in the response message.\n // Otherwise, will be `null` if `null` was explicitly specified as the \"data\"\n // in the response message. Otherwise, will be the value of the \"data\"\n // specified as the \"data\" in the response message\n readonly data?: Record<string, unknown> | null;\n\n // The list of errors provided by the backend in the response message.\n readonly errors: DataConnectOperationFailureResponseErrorInfo[];\n}\n\n// Information about the error, as provided in the response from the backend.\n// See https://spec.graphql.org/draft/#sec-Errors\nexport interface DataConnectOperationFailureResponseErrorInfo {\n // The error message.\n readonly message: string;\n\n // The path of the field in the response data to which this error relates.\n // String values in this array refer to field names. Numeric values in this\n // array always satisfy `Number.isInteger()` and refer to the index in an\n // array.\n readonly path: Array<string | number>;\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}/v1/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 { isCloudWorkstation } from '@firebase/util';\n\nimport {\n Code,\n DataConnectError,\n DataConnectOperationError,\n DataConnectOperationFailureResponse\n} from '../core/error';\nimport { SDK_VERSION } from '../core/version';\nimport { 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 _isUsingEmulator: 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, _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 const fetchOptions: RequestInit = {\n body: bodyStr,\n method: 'POST',\n headers,\n signal\n };\n if (isCloudWorkstation(url) && _isUsingEmulator) {\n fetchOptions.credentials = 'include';\n }\n\n return connectFetch(url, fetchOptions)\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 const response: DataConnectOperationFailureResponse = {\n errors: res.errors,\n data: res.data\n };\n throw new DataConnectOperationError(\n 'DataConnect error while performing request: ' + stringified,\n response\n );\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 private _isUsingEmulator = false;\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 this._isUsingEmulator = true;\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 this._isUsingEmulator\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 this._isUsingEmulator\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';\nimport {\n isCloudWorkstation,\n pingServer,\n updateEmulatorBanner\n} from '@firebase/util';\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 // Workaround to get cookies in Firebase Studio\n if (isCloudWorkstation(host)) {\n void pingServer(`https://${host}${port ? `:${port}` : ''}`);\n updateEmulatorBanner('Data Connect', true);\n }\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 esm, cjs, 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":["SDK_VERSION"],"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,CAAA,GAAgB,EACR,gBAA0D,EAAA;QAA1D,IAAgB,CAAA,gBAAA,GAAhB,gBAAgB,CAA0C;QAElE,IAAI,oBAAoB,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,aAAa,EAAE;YAC3D,I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,KAAK,UAAU,EAAE;QAC1C,QAAQ,GAAG,gBAAgB,CAAC;KAC7B;SAAM;AACL,QAAA,QAAQ,GAAG,gBAAgB,CAAC,MAAM,CAAC;AACnC,QAAA,OAAO,GAAG,gBAAgB,CAAC,KAAK,CAAC;AACjC,QAAa,gBAAgB,CAAC,UAAU,CAAC;KAC1C;IACD,IAAI,CAAC,QAAQ,EAAE;QACb,MAAM,IAAI,gBAAgB,CAAC,IAAI,CAAC,gBAAgB,EAAE,qBAAqB,CAAC,CAAC;KAC1E;AACD,IAAA,OAAO,GAAG,CAAC,WAAW,CAAC,aAAa,CAAC,eAAe,CAClD,GAAG,EACH,QAAQ,EACR,OAAO,EACP,YAAY,CACb,CAAC;AACJ;;AC3GA;;;;AAIG;AAwBH,mBAAmB,EAAE;;;;"} \ No newline at end of file
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/index.node.cjs.js b/frontend-old/node_modules/@firebase/data-connect/dist/index.node.cjs.js
new file mode 100644
index 0000000..3411206
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/index.node.cjs.js
@@ -0,0 +1,1278 @@
+'use strict';
+
+Object.defineProperty(exports, '__esModule', { value: true });
+
+var util = require('@firebase/util');
+var logger$1 = require('@firebase/logger');
+var app = require('@firebase/app');
+var component = require('@firebase/component');
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+const Code = {
+ OTHER: 'other',
+ ALREADY_INITIALIZED: 'already-initialized',
+ NOT_INITIALIZED: 'not-initialized',
+ NOT_SUPPORTED: 'not-supported',
+ INVALID_ARGUMENT: 'invalid-argument',
+ PARTIAL_ERROR: 'partial-error',
+ UNAUTHORIZED: 'unauthorized'
+};
+/** An error returned by a DataConnect operation. */
+class DataConnectError extends util.FirebaseError {
+ constructor(code, message) {
+ super(code, message);
+ /** @internal */
+ this.name = 'DataConnectError';
+ // Ensure the instanceof operator works as expected on subclasses of Error.
+ // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#custom_error_types
+ // and https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html#support-for-newtarget
+ Object.setPrototypeOf(this, DataConnectError.prototype);
+ }
+ /** @internal */
+ toString() {
+ return `${this.name}[code=${this.code}]: ${this.message}`;
+ }
+}
+/** An error returned by a DataConnect operation. */
+class DataConnectOperationError extends DataConnectError {
+ /** @hideconstructor */
+ constructor(message, response) {
+ super(Code.PARTIAL_ERROR, message);
+ /** @internal */
+ this.name = 'DataConnectOperationError';
+ this.response = response;
+ }
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/** The semver (www.semver.org) version of the SDK. */
+let SDK_VERSION = '';
+/**
+ * SDK_VERSION should be set before any database instance is created
+ * @internal
+ */
+function setSDKVersion(version) {
+ SDK_VERSION = version;
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+const logger = new logger$1.Logger('@firebase/data-connect');
+function setLogLevel(logLevel) {
+ logger.setLogLevel(logLevel);
+}
+function logDebug(msg) {
+ logger.debug(`DataConnect (${SDK_VERSION}): ${msg}`);
+}
+function logError(msg) {
+ logger.error(`DataConnect (${SDK_VERSION}): ${msg}`);
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+const CallerSdkTypeEnum = {
+ Base: 'Base', // Core JS SDK
+ Generated: 'Generated', // Generated JS SDK
+ TanstackReactCore: 'TanstackReactCore', // Tanstack non-generated React SDK
+ GeneratedReact: 'GeneratedReact', // Tanstack non-generated Angular SDK
+ TanstackAngularCore: 'TanstackAngularCore', // Tanstack non-generated Angular SDK
+ GeneratedAngular: 'GeneratedAngular' // Generated Angular SDK
+};
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+let connectFetch = globalThis.fetch;
+function initializeFetch(fetchImpl) {
+ connectFetch = fetchImpl;
+}
+function getGoogApiClientValue(_isUsingGen, _callerSdkType) {
+ let str = 'gl-js/ fire/' + SDK_VERSION;
+ if (_callerSdkType !== CallerSdkTypeEnum.Base &&
+ _callerSdkType !== CallerSdkTypeEnum.Generated) {
+ str += ' js/' + _callerSdkType.toLowerCase();
+ }
+ else if (_isUsingGen || _callerSdkType === CallerSdkTypeEnum.Generated) {
+ str += ' js/gen';
+ }
+ return str;
+}
+function dcFetch(url, body, { signal }, appId, accessToken, appCheckToken, _isUsingGen, _callerSdkType, _isUsingEmulator) {
+ if (!connectFetch) {
+ throw new DataConnectError(Code.OTHER, 'No Fetch Implementation detected!');
+ }
+ const headers = {
+ 'Content-Type': 'application/json',
+ 'X-Goog-Api-Client': getGoogApiClientValue(_isUsingGen, _callerSdkType)
+ };
+ if (accessToken) {
+ headers['X-Firebase-Auth-Token'] = accessToken;
+ }
+ if (appId) {
+ headers['x-firebase-gmpid'] = appId;
+ }
+ if (appCheckToken) {
+ headers['X-Firebase-AppCheck'] = appCheckToken;
+ }
+ const bodyStr = JSON.stringify(body);
+ const fetchOptions = {
+ body: bodyStr,
+ method: 'POST',
+ headers,
+ signal
+ };
+ if (util.isCloudWorkstation(url) && _isUsingEmulator) {
+ fetchOptions.credentials = 'include';
+ }
+ return connectFetch(url, fetchOptions)
+ .catch(err => {
+ throw new DataConnectError(Code.OTHER, 'Failed to fetch: ' + JSON.stringify(err));
+ })
+ .then(async (response) => {
+ let jsonResponse = null;
+ try {
+ jsonResponse = await response.json();
+ }
+ catch (e) {
+ throw new DataConnectError(Code.OTHER, JSON.stringify(e));
+ }
+ const message = getMessage(jsonResponse);
+ if (response.status >= 400) {
+ logError('Error while performing request: ' + JSON.stringify(jsonResponse));
+ if (response.status === 401) {
+ throw new DataConnectError(Code.UNAUTHORIZED, message);
+ }
+ throw new DataConnectError(Code.OTHER, message);
+ }
+ return jsonResponse;
+ })
+ .then(res => {
+ if (res.errors && res.errors.length) {
+ const stringified = JSON.stringify(res.errors);
+ const response = {
+ errors: res.errors,
+ data: res.data
+ };
+ throw new DataConnectOperationError('DataConnect error while performing request: ' + stringified, response);
+ }
+ return res;
+ });
+}
+function getMessage(obj) {
+ if ('message' in obj) {
+ return obj.message;
+ }
+ return JSON.stringify(obj);
+}
+
+const name = "@firebase/data-connect";
+const version = "0.3.11";
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @internal
+ * Abstraction around AppCheck's token fetching capabilities.
+ */
+class AppCheckTokenProvider {
+ constructor(app$1, appCheckProvider) {
+ this.appCheckProvider = appCheckProvider;
+ if (app._isFirebaseServerApp(app$1) && app$1.settings.appCheckToken) {
+ this.serverAppAppCheckToken = app$1.settings.appCheckToken;
+ }
+ this.appCheck = appCheckProvider?.getImmediate({ optional: true });
+ if (!this.appCheck) {
+ void appCheckProvider
+ ?.get()
+ .then(appCheck => (this.appCheck = appCheck))
+ .catch();
+ }
+ }
+ getToken() {
+ if (this.serverAppAppCheckToken) {
+ return Promise.resolve({ token: this.serverAppAppCheckToken });
+ }
+ if (!this.appCheck) {
+ return new Promise((resolve, reject) => {
+ // Support delayed initialization of FirebaseAppCheck. This allows our
+ // customers to initialize the RTDB SDK before initializing Firebase
+ // AppCheck and ensures that all requests are authenticated if a token
+ // becomes available before the timoeout below expires.
+ setTimeout(() => {
+ if (this.appCheck) {
+ this.getToken().then(resolve, reject);
+ }
+ else {
+ resolve(null);
+ }
+ }, 0);
+ });
+ }
+ return this.appCheck.getToken();
+ }
+ addTokenChangeListener(listener) {
+ void this.appCheckProvider
+ ?.get()
+ .then(appCheck => appCheck.addTokenListener(listener));
+ }
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// @internal
+class FirebaseAuthProvider {
+ constructor(_appName, _options, _authProvider) {
+ this._appName = _appName;
+ this._options = _options;
+ this._authProvider = _authProvider;
+ this._auth = _authProvider.getImmediate({ optional: true });
+ if (!this._auth) {
+ _authProvider.onInit(auth => (this._auth = auth));
+ }
+ }
+ getToken(forceRefresh) {
+ if (!this._auth) {
+ return new Promise((resolve, reject) => {
+ setTimeout(() => {
+ if (this._auth) {
+ this.getToken(forceRefresh).then(resolve, reject);
+ }
+ else {
+ resolve(null);
+ }
+ }, 0);
+ });
+ }
+ return this._auth.getToken(forceRefresh).catch(error => {
+ if (error && error.code === 'auth/token-not-initialized') {
+ logDebug('Got auth/token-not-initialized error. Treating as null token.');
+ return null;
+ }
+ else {
+ logError('Error received when attempting to retrieve token: ' +
+ JSON.stringify(error));
+ return Promise.reject(error);
+ }
+ });
+ }
+ addTokenChangeListener(listener) {
+ this._auth?.addAuthTokenListener(listener);
+ }
+ removeTokenChangeListener(listener) {
+ this._authProvider
+ .get()
+ .then(auth => auth.removeAuthTokenListener(listener))
+ .catch(err => logError(err));
+ }
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+const QUERY_STR = 'query';
+const MUTATION_STR = 'mutation';
+const SOURCE_SERVER = 'SERVER';
+const SOURCE_CACHE = 'CACHE';
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+let encoderImpl;
+function setEncoder(encoder) {
+ encoderImpl = encoder;
+}
+setEncoder(o => JSON.stringify(o));
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+function setIfNotExists(map, key, val) {
+ if (!map.has(key)) {
+ map.set(key, val);
+ }
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+function getRefSerializer(queryRef, data, source) {
+ return function toJSON() {
+ return {
+ data,
+ refInfo: {
+ name: queryRef.name,
+ variables: queryRef.variables,
+ connectorConfig: {
+ projectId: queryRef.dataConnect.app.options.projectId,
+ ...queryRef.dataConnect.getSettings()
+ }
+ },
+ fetchTime: Date.now().toLocaleString(),
+ source
+ };
+ };
+}
+class QueryManager {
+ constructor(transport) {
+ this.transport = transport;
+ this._queries = new Map();
+ }
+ track(queryName, variables, initialCache) {
+ const ref = {
+ name: queryName,
+ variables,
+ refType: QUERY_STR
+ };
+ const key = encoderImpl(ref);
+ const newTrackedQuery = {
+ ref,
+ subscriptions: [],
+ currentCache: initialCache || null,
+ lastError: null
+ };
+ // @ts-ignore
+ setIfNotExists(this._queries, key, newTrackedQuery);
+ return this._queries.get(key);
+ }
+ addSubscription(queryRef, onResultCallback, onErrorCallback, initialCache) {
+ const key = encoderImpl({
+ name: queryRef.name,
+ variables: queryRef.variables,
+ refType: QUERY_STR
+ });
+ const trackedQuery = this._queries.get(key);
+ const subscription = {
+ userCallback: onResultCallback,
+ errCallback: onErrorCallback
+ };
+ const unsubscribe = () => {
+ const trackedQuery = this._queries.get(key);
+ trackedQuery.subscriptions = trackedQuery.subscriptions.filter(sub => sub !== subscription);
+ };
+ if (initialCache && trackedQuery.currentCache !== initialCache) {
+ logDebug('Initial cache found. Comparing dates.');
+ if (!trackedQuery.currentCache ||
+ (trackedQuery.currentCache &&
+ compareDates(trackedQuery.currentCache.fetchTime, initialCache.fetchTime))) {
+ trackedQuery.currentCache = initialCache;
+ }
+ }
+ if (trackedQuery.currentCache !== null) {
+ const cachedData = trackedQuery.currentCache.data;
+ onResultCallback({
+ data: cachedData,
+ source: SOURCE_CACHE,
+ ref: queryRef,
+ toJSON: getRefSerializer(queryRef, trackedQuery.currentCache.data, SOURCE_CACHE),
+ fetchTime: trackedQuery.currentCache.fetchTime
+ });
+ if (trackedQuery.lastError !== null && onErrorCallback) {
+ onErrorCallback(undefined);
+ }
+ }
+ trackedQuery.subscriptions.push({
+ userCallback: onResultCallback,
+ errCallback: onErrorCallback,
+ unsubscribe
+ });
+ if (!trackedQuery.currentCache) {
+ logDebug(`No cache available for query ${queryRef.name} with variables ${JSON.stringify(queryRef.variables)}. Calling executeQuery.`);
+ const promise = this.executeQuery(queryRef);
+ // We want to ignore the error and let subscriptions handle it
+ promise.then(undefined, err => { });
+ }
+ return unsubscribe;
+ }
+ executeQuery(queryRef) {
+ if (queryRef.refType !== QUERY_STR) {
+ throw new DataConnectError(Code.INVALID_ARGUMENT, `ExecuteQuery can only execute query operation`);
+ }
+ const key = encoderImpl({
+ name: queryRef.name,
+ variables: queryRef.variables,
+ refType: QUERY_STR
+ });
+ const trackedQuery = this._queries.get(key);
+ const result = this.transport.invokeQuery(queryRef.name, queryRef.variables);
+ const newR = result.then(res => {
+ const fetchTime = new Date().toString();
+ const result = {
+ ...res,
+ source: SOURCE_SERVER,
+ ref: queryRef,
+ toJSON: getRefSerializer(queryRef, res.data, SOURCE_SERVER),
+ fetchTime
+ };
+ trackedQuery.subscriptions.forEach(subscription => {
+ subscription.userCallback(result);
+ });
+ trackedQuery.currentCache = {
+ data: res.data,
+ source: SOURCE_CACHE,
+ fetchTime
+ };
+ return result;
+ }, err => {
+ trackedQuery.lastError = err;
+ trackedQuery.subscriptions.forEach(subscription => {
+ if (subscription.errCallback) {
+ subscription.errCallback(err);
+ }
+ });
+ throw err;
+ });
+ return newR;
+ }
+ enableEmulator(host, port) {
+ this.transport.useEmulator(host, port);
+ }
+}
+function compareDates(str1, str2) {
+ const date1 = new Date(str1);
+ const date2 = new Date(str2);
+ return date1.getTime() < date2.getTime();
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+function urlBuilder(projectConfig, transportOptions) {
+ const { connector, location, projectId: project, service } = projectConfig;
+ const { host, sslEnabled, port } = transportOptions;
+ const protocol = sslEnabled ? 'https' : 'http';
+ const realHost = host || `firebasedataconnect.googleapis.com`;
+ let baseUrl = `${protocol}://${realHost}`;
+ if (typeof port === 'number') {
+ baseUrl += `:${port}`;
+ }
+ else if (typeof port !== 'undefined') {
+ logError('Port type is of an invalid type');
+ throw new DataConnectError(Code.INVALID_ARGUMENT, 'Incorrect type for port passed in!');
+ }
+ return `${baseUrl}/v1/projects/${project}/locations/${location}/services/${service}/connectors/${connector}`;
+}
+function addToken(url, apiKey) {
+ if (!apiKey) {
+ return url;
+ }
+ const newUrl = new URL(url);
+ newUrl.searchParams.append('key', apiKey);
+ return newUrl.toString();
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+class RESTTransport {
+ constructor(options, apiKey, appId, authProvider, appCheckProvider, transportOptions, _isUsingGen = false, _callerSdkType = CallerSdkTypeEnum.Base) {
+ this.apiKey = apiKey;
+ this.appId = appId;
+ this.authProvider = authProvider;
+ this.appCheckProvider = appCheckProvider;
+ this._isUsingGen = _isUsingGen;
+ this._callerSdkType = _callerSdkType;
+ this._host = '';
+ this._location = 'l';
+ this._connectorName = '';
+ this._secure = true;
+ this._project = 'p';
+ this._accessToken = null;
+ this._appCheckToken = null;
+ this._lastToken = null;
+ this._isUsingEmulator = false;
+ // TODO(mtewani): Update U to include shape of body defined in line 13.
+ this.invokeQuery = (queryName, body) => {
+ const abortController = new AbortController();
+ // TODO(mtewani): Update to proper value
+ const withAuth = this.withRetry(() => dcFetch(addToken(`${this.endpointUrl}:executeQuery`, this.apiKey), {
+ name: `projects/${this._project}/locations/${this._location}/services/${this._serviceName}/connectors/${this._connectorName}`,
+ operationName: queryName,
+ variables: body
+ }, abortController, this.appId, this._accessToken, this._appCheckToken, this._isUsingGen, this._callerSdkType, this._isUsingEmulator));
+ return withAuth;
+ };
+ this.invokeMutation = (mutationName, body) => {
+ const abortController = new AbortController();
+ const taskResult = this.withRetry(() => {
+ return dcFetch(addToken(`${this.endpointUrl}:executeMutation`, this.apiKey), {
+ name: `projects/${this._project}/locations/${this._location}/services/${this._serviceName}/connectors/${this._connectorName}`,
+ operationName: mutationName,
+ variables: body
+ }, abortController, this.appId, this._accessToken, this._appCheckToken, this._isUsingGen, this._callerSdkType, this._isUsingEmulator);
+ });
+ return taskResult;
+ };
+ if (transportOptions) {
+ if (typeof transportOptions.port === 'number') {
+ this._port = transportOptions.port;
+ }
+ if (typeof transportOptions.sslEnabled !== 'undefined') {
+ this._secure = transportOptions.sslEnabled;
+ }
+ this._host = transportOptions.host;
+ }
+ const { location, projectId: project, connector, service } = options;
+ if (location) {
+ this._location = location;
+ }
+ if (project) {
+ this._project = project;
+ }
+ this._serviceName = service;
+ if (!connector) {
+ throw new DataConnectError(Code.INVALID_ARGUMENT, 'Connector Name required!');
+ }
+ this._connectorName = connector;
+ this.authProvider?.addTokenChangeListener(token => {
+ logDebug(`New Token Available: ${token}`);
+ this._accessToken = token;
+ });
+ this.appCheckProvider?.addTokenChangeListener(result => {
+ const { token } = result;
+ logDebug(`New App Check Token Available: ${token}`);
+ this._appCheckToken = token;
+ });
+ }
+ get endpointUrl() {
+ return urlBuilder({
+ connector: this._connectorName,
+ location: this._location,
+ projectId: this._project,
+ service: this._serviceName
+ }, { host: this._host, sslEnabled: this._secure, port: this._port });
+ }
+ useEmulator(host, port, isSecure) {
+ this._host = host;
+ this._isUsingEmulator = true;
+ if (typeof port === 'number') {
+ this._port = port;
+ }
+ if (typeof isSecure !== 'undefined') {
+ this._secure = isSecure;
+ }
+ }
+ onTokenChanged(newToken) {
+ this._accessToken = newToken;
+ }
+ async getWithAuth(forceToken = false) {
+ let starterPromise = new Promise(resolve => resolve(this._accessToken));
+ if (this.appCheckProvider) {
+ this._appCheckToken = (await this.appCheckProvider.getToken())?.token;
+ }
+ if (this.authProvider) {
+ starterPromise = this.authProvider
+ .getToken(/*forceToken=*/ forceToken)
+ .then(data => {
+ if (!data) {
+ return null;
+ }
+ this._accessToken = data.accessToken;
+ return this._accessToken;
+ });
+ }
+ else {
+ starterPromise = new Promise(resolve => resolve(''));
+ }
+ return starterPromise;
+ }
+ _setLastToken(lastToken) {
+ this._lastToken = lastToken;
+ }
+ withRetry(promiseFactory, retry = false) {
+ let isNewToken = false;
+ return this.getWithAuth(retry)
+ .then(res => {
+ isNewToken = this._lastToken !== res;
+ this._lastToken = res;
+ return res;
+ })
+ .then(promiseFactory)
+ .catch(err => {
+ // Only retry if the result is unauthorized and the last token isn't the same as the new one.
+ if ('code' in err &&
+ err.code === Code.UNAUTHORIZED &&
+ !retry &&
+ isNewToken) {
+ logDebug('Retrying due to unauthorized');
+ return this.withRetry(promiseFactory, true);
+ }
+ throw err;
+ });
+ }
+ _setCallerSdkType(callerSdkType) {
+ this._callerSdkType = callerSdkType;
+ }
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ *
+ * @param dcInstance Data Connect instance
+ * @param mutationName name of mutation
+ * @param variables variables to send with mutation
+ * @returns `MutationRef`
+ */
+function mutationRef(dcInstance, mutationName, variables) {
+ dcInstance.setInitialized();
+ const ref = {
+ dataConnect: dcInstance,
+ name: mutationName,
+ refType: MUTATION_STR,
+ variables: variables
+ };
+ return ref;
+}
+/**
+ * @internal
+ */
+class MutationManager {
+ constructor(_transport) {
+ this._transport = _transport;
+ this._inflight = [];
+ }
+ executeMutation(mutationRef) {
+ const result = this._transport.invokeMutation(mutationRef.name, mutationRef.variables);
+ const withRefPromise = result.then(res => {
+ const obj = {
+ ...res, // Double check that the result is result.data, not just result
+ source: SOURCE_SERVER,
+ ref: mutationRef,
+ fetchTime: Date.now().toLocaleString()
+ };
+ return obj;
+ });
+ this._inflight.push(result);
+ const removePromise = () => (this._inflight = this._inflight.filter(promise => promise !== result));
+ result.then(removePromise, removePromise);
+ return withRefPromise;
+ }
+}
+/**
+ * Execute Mutation
+ * @param mutationRef mutation to execute
+ * @returns `MutationRef`
+ */
+function executeMutation(mutationRef) {
+ return mutationRef.dataConnect._mutationManager.executeMutation(mutationRef);
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+const FIREBASE_DATA_CONNECT_EMULATOR_HOST_VAR = 'FIREBASE_DATA_CONNECT_EMULATOR_HOST';
+/**
+ *
+ * @param fullHost
+ * @returns TransportOptions
+ * @internal
+ */
+function parseOptions(fullHost) {
+ const [protocol, hostName] = fullHost.split('://');
+ const isSecure = protocol === 'https';
+ const [host, portAsString] = hostName.split(':');
+ const port = Number(portAsString);
+ return { host, port, sslEnabled: isSecure };
+}
+/**
+ * Class representing Firebase Data Connect
+ */
+class DataConnect {
+ // @internal
+ constructor(app,
+ // TODO(mtewani): Replace with _dataConnectOptions in the future
+ dataConnectOptions, _authProvider, _appCheckProvider) {
+ this.app = app;
+ this.dataConnectOptions = dataConnectOptions;
+ this._authProvider = _authProvider;
+ this._appCheckProvider = _appCheckProvider;
+ this.isEmulator = false;
+ this._initialized = false;
+ this._isUsingGeneratedSdk = false;
+ this._callerSdkType = CallerSdkTypeEnum.Base;
+ if (typeof process !== 'undefined' && process.env) {
+ const host = process.env[FIREBASE_DATA_CONNECT_EMULATOR_HOST_VAR];
+ if (host) {
+ logDebug('Found custom host. Using emulator');
+ this.isEmulator = true;
+ this._transportOptions = parseOptions(host);
+ }
+ }
+ }
+ // @internal
+ _useGeneratedSdk() {
+ if (!this._isUsingGeneratedSdk) {
+ this._isUsingGeneratedSdk = true;
+ }
+ }
+ _setCallerSdkType(callerSdkType) {
+ this._callerSdkType = callerSdkType;
+ if (this._initialized) {
+ this._transport._setCallerSdkType(callerSdkType);
+ }
+ }
+ _delete() {
+ app._removeServiceInstance(this.app, 'data-connect', JSON.stringify(this.getSettings()));
+ return Promise.resolve();
+ }
+ // @internal
+ getSettings() {
+ const copy = JSON.parse(JSON.stringify(this.dataConnectOptions));
+ delete copy.projectId;
+ return copy;
+ }
+ // @internal
+ setInitialized() {
+ if (this._initialized) {
+ return;
+ }
+ if (this._transportClass === undefined) {
+ logDebug('transportClass not provided. Defaulting to RESTTransport.');
+ this._transportClass = RESTTransport;
+ }
+ if (this._authProvider) {
+ this._authTokenProvider = new FirebaseAuthProvider(this.app.name, this.app.options, this._authProvider);
+ }
+ if (this._appCheckProvider) {
+ this._appCheckTokenProvider = new AppCheckTokenProvider(this.app, this._appCheckProvider);
+ }
+ this._initialized = true;
+ this._transport = new this._transportClass(this.dataConnectOptions, this.app.options.apiKey, this.app.options.appId, this._authTokenProvider, this._appCheckTokenProvider, undefined, this._isUsingGeneratedSdk, this._callerSdkType);
+ if (this._transportOptions) {
+ this._transport.useEmulator(this._transportOptions.host, this._transportOptions.port, this._transportOptions.sslEnabled);
+ }
+ this._queryManager = new QueryManager(this._transport);
+ this._mutationManager = new MutationManager(this._transport);
+ }
+ // @internal
+ enableEmulator(transportOptions) {
+ if (this._initialized &&
+ !areTransportOptionsEqual(this._transportOptions, transportOptions)) {
+ logError('enableEmulator called after initialization');
+ throw new DataConnectError(Code.ALREADY_INITIALIZED, 'DataConnect instance already initialized!');
+ }
+ this._transportOptions = transportOptions;
+ this.isEmulator = true;
+ }
+}
+/**
+ * @internal
+ * @param transportOptions1
+ * @param transportOptions2
+ * @returns
+ */
+function areTransportOptionsEqual(transportOptions1, transportOptions2) {
+ return (transportOptions1.host === transportOptions2.host &&
+ transportOptions1.port === transportOptions2.port &&
+ transportOptions1.sslEnabled === transportOptions2.sslEnabled);
+}
+/**
+ * Connect to the DataConnect Emulator
+ * @param dc Data Connect instance
+ * @param host host of emulator server
+ * @param port port of emulator server
+ * @param sslEnabled use https
+ */
+function connectDataConnectEmulator(dc, host, port, sslEnabled = false) {
+ // Workaround to get cookies in Firebase Studio
+ if (util.isCloudWorkstation(host)) {
+ void util.pingServer(`https://${host}${port ? `:${port}` : ''}`);
+ util.updateEmulatorBanner('Data Connect', true);
+ }
+ dc.enableEmulator({ host, port, sslEnabled });
+}
+function getDataConnect(appOrOptions, optionalOptions) {
+ let app$1;
+ let dcOptions;
+ if ('location' in appOrOptions) {
+ dcOptions = appOrOptions;
+ app$1 = app.getApp();
+ }
+ else {
+ dcOptions = optionalOptions;
+ app$1 = appOrOptions;
+ }
+ if (!app$1 || Object.keys(app$1).length === 0) {
+ app$1 = app.getApp();
+ }
+ const provider = app._getProvider(app$1, 'data-connect');
+ const identifier = JSON.stringify(dcOptions);
+ if (provider.isInitialized(identifier)) {
+ const dcInstance = provider.getImmediate({ identifier });
+ const options = provider.getOptions(identifier);
+ const optionsValid = Object.keys(options).length > 0;
+ if (optionsValid) {
+ logDebug('Re-using cached instance');
+ return dcInstance;
+ }
+ }
+ validateDCOptions(dcOptions);
+ logDebug('Creating new DataConnect instance');
+ // Initialize with options.
+ return provider.initialize({
+ instanceIdentifier: identifier,
+ options: dcOptions
+ });
+}
+/**
+ *
+ * @param dcOptions
+ * @returns {void}
+ * @internal
+ */
+function validateDCOptions(dcOptions) {
+ const fields = ['connector', 'location', 'service'];
+ if (!dcOptions) {
+ throw new DataConnectError(Code.INVALID_ARGUMENT, 'DC Option Required');
+ }
+ fields.forEach(field => {
+ if (dcOptions[field] === null || dcOptions[field] === undefined) {
+ throw new DataConnectError(Code.INVALID_ARGUMENT, `${field} Required`);
+ }
+ });
+ return true;
+}
+/**
+ * Delete DataConnect instance
+ * @param dataConnect DataConnect instance
+ * @returns
+ */
+function terminate(dataConnect) {
+ return dataConnect._delete();
+ // TODO(mtewani): Stop pending tasks
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+function registerDataConnect(variant) {
+ setSDKVersion(app.SDK_VERSION);
+ app._registerComponent(new component.Component('data-connect', (container, { instanceIdentifier: settings, options }) => {
+ const app = container.getProvider('app').getImmediate();
+ const authProvider = container.getProvider('auth-internal');
+ const appCheckProvider = container.getProvider('app-check-internal');
+ let newOpts = options;
+ if (settings) {
+ newOpts = JSON.parse(settings);
+ }
+ if (!app.options.projectId) {
+ throw new DataConnectError(Code.INVALID_ARGUMENT, 'Project ID must be provided. Did you pass in a proper projectId to initializeApp?');
+ }
+ return new DataConnect(app, { ...newOpts, projectId: app.options.projectId }, authProvider, appCheckProvider);
+ }, "PUBLIC" /* ComponentType.PUBLIC */).setMultipleInstances(true));
+ app.registerVersion(name, version, variant);
+ // BUILD_TARGET will be replaced by values like esm, cjs, etc during the compilation
+ app.registerVersion(name, version, 'cjs2020');
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * Execute Query
+ * @param queryRef query to execute.
+ * @returns `QueryPromise`
+ */
+function executeQuery(queryRef) {
+ return queryRef.dataConnect._queryManager.executeQuery(queryRef);
+}
+/**
+ * Execute Query
+ * @param dcInstance Data Connect instance to use.
+ * @param queryName Query to execute
+ * @param variables Variables to execute with
+ * @param initialCache initial cache to use for client hydration
+ * @returns `QueryRef`
+ */
+function queryRef(dcInstance, queryName, variables, initialCache) {
+ dcInstance.setInitialized();
+ dcInstance._queryManager.track(queryName, variables, initialCache);
+ return {
+ dataConnect: dcInstance,
+ refType: QUERY_STR,
+ name: queryName,
+ variables
+ };
+}
+/**
+ * Converts serialized ref to query ref
+ * @param serializedRef ref to convert to `QueryRef`
+ * @returns `QueryRef`
+ */
+function toQueryRef(serializedRef) {
+ const { refInfo: { name, variables, connectorConfig } } = serializedRef;
+ return queryRef(getDataConnect(connectorConfig), name, variables);
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * The generated SDK will allow the user to pass in either the variable or the data connect instance with the variable,
+ * and this function validates the variables and returns back the DataConnect instance and variables based on the arguments passed in.
+ * @param connectorConfig
+ * @param dcOrVars
+ * @param vars
+ * @param validateVars
+ * @returns {DataConnect} and {Variables} instance
+ * @internal
+ */
+function validateArgs(connectorConfig, dcOrVars, vars, validateVars) {
+ let dcInstance;
+ let realVars;
+ if (dcOrVars && 'enableEmulator' in dcOrVars) {
+ dcInstance = dcOrVars;
+ realVars = vars;
+ }
+ else {
+ dcInstance = getDataConnect(connectorConfig);
+ realVars = dcOrVars;
+ }
+ if (!dcInstance || (!realVars && validateVars)) {
+ throw new DataConnectError(Code.INVALID_ARGUMENT, 'Variables required.');
+ }
+ return { dc: dcInstance, vars: realVars };
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * Subscribe to a `QueryRef`
+ * @param queryRefOrSerializedResult query ref or serialized result.
+ * @param observerOrOnNext observer object or next function.
+ * @param onError Callback to call when error gets thrown.
+ * @param onComplete Called when subscription completes.
+ * @returns `SubscriptionOptions`
+ */
+function subscribe(queryRefOrSerializedResult, observerOrOnNext, onError, onComplete) {
+ let ref;
+ let initialCache;
+ if ('refInfo' in queryRefOrSerializedResult) {
+ const serializedRef = queryRefOrSerializedResult;
+ const { data, source, fetchTime } = serializedRef;
+ initialCache = {
+ data,
+ source,
+ fetchTime
+ };
+ ref = toQueryRef(serializedRef);
+ }
+ else {
+ ref = queryRefOrSerializedResult;
+ }
+ let onResult = undefined;
+ if (typeof observerOrOnNext === 'function') {
+ onResult = observerOrOnNext;
+ }
+ else {
+ onResult = observerOrOnNext.onNext;
+ onError = observerOrOnNext.onErr;
+ observerOrOnNext.onComplete;
+ }
+ if (!onResult) {
+ throw new DataConnectError(Code.INVALID_ARGUMENT, 'Must provide onNext');
+ }
+ return ref.dataConnect._queryManager.addSubscription(ref, onResult, onError, initialCache);
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+initializeFetch(fetch);
+registerDataConnect('node');
+
+exports.CallerSdkTypeEnum = CallerSdkTypeEnum;
+exports.Code = Code;
+exports.DataConnect = DataConnect;
+exports.DataConnectError = DataConnectError;
+exports.DataConnectOperationError = DataConnectOperationError;
+exports.MUTATION_STR = MUTATION_STR;
+exports.MutationManager = MutationManager;
+exports.QUERY_STR = QUERY_STR;
+exports.SOURCE_CACHE = SOURCE_CACHE;
+exports.SOURCE_SERVER = SOURCE_SERVER;
+exports.areTransportOptionsEqual = areTransportOptionsEqual;
+exports.connectDataConnectEmulator = connectDataConnectEmulator;
+exports.executeMutation = executeMutation;
+exports.executeQuery = executeQuery;
+exports.getDataConnect = getDataConnect;
+exports.mutationRef = mutationRef;
+exports.parseOptions = parseOptions;
+exports.queryRef = queryRef;
+exports.setLogLevel = setLogLevel;
+exports.subscribe = subscribe;
+exports.terminate = terminate;
+exports.toQueryRef = toQueryRef;
+exports.validateArgs = validateArgs;
+exports.validateDCOptions = validateDCOptions;
+//# sourceMappingURL=index.node.cjs.js.map
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/index.node.cjs.js.map b/frontend-old/node_modules/@firebase/data-connect/dist/index.node.cjs.js.map
new file mode 100644
index 0000000..f54c0fb
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/index.node.cjs.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"index.node.cjs.js","sources":["../src/core/error.ts","../src/core/version.ts","../src/logger.ts","../src/network/transport/index.ts","../src/network/fetch.ts","../src/core/AppCheckTokenProvider.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/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.node.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\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 /** @internal */\n readonly name: string = 'DataConnectError';\n\n constructor(code: Code, message: string) {\n super(code, message);\n\n // Ensure the instanceof operator works as expected on subclasses of Error.\n // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#custom_error_types\n // and https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html#support-for-newtarget\n Object.setPrototypeOf(this, DataConnectError.prototype);\n }\n\n /** @internal */\n toString(): string {\n return `${this.name}[code=${this.code}]: ${this.message}`;\n }\n}\n\n/** An error returned by a DataConnect operation. */\nexport class DataConnectOperationError extends DataConnectError {\n /** @internal */\n readonly name: string = 'DataConnectOperationError';\n\n /** The response received from the backend. */\n readonly response: DataConnectOperationFailureResponse;\n\n /** @hideconstructor */\n constructor(message: string, response: DataConnectOperationFailureResponse) {\n super(Code.PARTIAL_ERROR, message);\n this.response = response;\n }\n}\n\nexport interface DataConnectOperationFailureResponse {\n // The \"data\" provided by the backend in the response message.\n //\n // Will be `undefined` if no \"data\" was provided in the response message.\n // Otherwise, will be `null` if `null` was explicitly specified as the \"data\"\n // in the response message. Otherwise, will be the value of the \"data\"\n // specified as the \"data\" in the response message\n readonly data?: Record<string, unknown> | null;\n\n // The list of errors provided by the backend in the response message.\n readonly errors: DataConnectOperationFailureResponseErrorInfo[];\n}\n\n// Information about the error, as provided in the response from the backend.\n// See https://spec.graphql.org/draft/#sec-Errors\nexport interface DataConnectOperationFailureResponseErrorInfo {\n // The error message.\n readonly message: string;\n\n // The path of the field in the response data to which this error relates.\n // String values in this array refer to field names. Numeric values in this\n // array always satisfy `Number.isInteger()` and refer to the index in an\n // array.\n readonly path: Array<string | number>;\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\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 */\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 { 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 { isCloudWorkstation } from '@firebase/util';\n\nimport {\n Code,\n DataConnectError,\n DataConnectOperationError,\n DataConnectOperationFailureResponse\n} from '../core/error';\nimport { SDK_VERSION } from '../core/version';\nimport { 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 _isUsingEmulator: 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, _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 const fetchOptions: RequestInit = {\n body: bodyStr,\n method: 'POST',\n headers,\n signal\n };\n if (isCloudWorkstation(url) && _isUsingEmulator) {\n fetchOptions.credentials = 'include';\n }\n\n return connectFetch(url, fetchOptions)\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 const response: DataConnectOperationFailureResponse = {\n errors: res.errors,\n data: res.data\n };\n throw new DataConnectOperationError(\n 'DataConnect error while performing request: ' + stringified,\n response\n );\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 { 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 { 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}/v1/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 { 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 private _isUsingEmulator = false;\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 this._isUsingEmulator = true;\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 this._isUsingEmulator\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 this._isUsingEmulator\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';\nimport {\n isCloudWorkstation,\n pingServer,\n updateEmulatorBanner\n} from '@firebase/util';\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 // Workaround to get cookies in Firebase Studio\n if (isCloudWorkstation(host)) {\n void pingServer(`https://${host}${port ? `:${port}` : ''}`);\n updateEmulatorBanner('Data Connect', true);\n }\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 esm, cjs, 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 * @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 { initializeFetch } from './network/fetch';\nimport { registerDataConnect } from './register';\n\nexport * from './api';\nexport * from './api.node';\ninitializeFetch(fetch);\n\nregisterDataConnect('node');\n"],"names":["FirebaseError","Logger","isCloudWorkstation","app","_isFirebaseServerApp","_removeServiceInstance","pingServer","updateEmulatorBanner","getApp","_getProvider","SDK_VERSION","_registerComponent","Component","registerVersion"],"mappings":";;;;;;;;;AAAA;;;;;;;;;;;;;;;AAeG;AAeU,MAAA,IAAI,GAAG;AAClB,IAAA,KAAK,EAAE,OAA+B;AACtC,IAAA,mBAAmB,EAAE,qBAA6C;AAClE,IAAA,eAAe,EAAE,iBAAyC;AAC1D,IAAA,aAAa,EAAE,eAAuC;AACtD,IAAA,gBAAgB,EAAE,kBAA0C;AAC5D,IAAA,aAAa,EAAE,eAAuC;AACtD,IAAA,YAAY,EAAE,cAAsC;EACpD;AAEF;AACM,MAAO,gBAAiB,SAAQA,kBAAa,CAAA;IAIjD,WAAY,CAAA,IAAU,EAAE,OAAe,EAAA;AACrC,QAAA,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;;QAHd,IAAI,CAAA,IAAA,GAAW,kBAAkB,CAAC;;;;QAQzC,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,gBAAgB,CAAC,SAAS,CAAC,CAAC;KACzD;;IAGD,QAAQ,GAAA;AACN,QAAA,OAAO,CAAG,EAAA,IAAI,CAAC,IAAI,CAAS,MAAA,EAAA,IAAI,CAAC,IAAI,CAAM,GAAA,EAAA,IAAI,CAAC,OAAO,EAAE,CAAC;KAC3D;AACF,CAAA;AAED;AACM,MAAO,yBAA0B,SAAQ,gBAAgB,CAAA;;IAQ7D,WAAY,CAAA,OAAe,EAAE,QAA6C,EAAA;AACxE,QAAA,KAAK,CAAC,IAAI,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;;QAP5B,IAAI,CAAA,IAAA,GAAW,2BAA2B,CAAC;AAQlD,QAAA,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;KAC1B;AACF;;ACzED;;;;;;;;;;;;;;;AAeG;AA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CAAC;AAEvB,mBAAmB,CAAC,MAAM,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/internal.d.ts b/frontend-old/node_modules/@firebase/data-connect/dist/internal.d.ts
new file mode 100644
index 0000000..a30e042
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/internal.d.ts
@@ -0,0 +1,461 @@
+/**
+ * Firebase Data Connect
+ *
+ * @packageDocumentation
+ */
+
+import { AppCheckInternalComponentName } from '@firebase/app-check-interop-types';
+import { AppCheckTokenListener } from '@firebase/app-check-interop-types';
+import { AppCheckTokenResult } from '@firebase/app-check-interop-types';
+import { FirebaseApp } from '@firebase/app';
+import { FirebaseAuthInternalName } from '@firebase/auth-interop-types';
+import { FirebaseAuthTokenData } from '@firebase/auth-interop-types';
+import { FirebaseError } from '@firebase/util';
+import { LogLevelString } from '@firebase/logger';
+import { Provider } from '@firebase/component';
+
+/**
+ * @internal
+ * Abstraction around AppCheck's token fetching capabilities.
+ */
+declare class AppCheckTokenProvider {
+ private appCheckProvider?;
+ private appCheck?;
+ private serverAppAppCheckToken?;
+ constructor(app: FirebaseApp, appCheckProvider?: Provider<AppCheckInternalComponentName>);
+ getToken(): Promise<AppCheckTokenResult>;
+ addTokenChangeListener(listener: AppCheckTokenListener): void;
+}
+
+/**
+ * @internal
+ * @param transportOptions1
+ * @param transportOptions2
+ * @returns
+ */
+export declare function areTransportOptionsEqual(transportOptions1: TransportOptions, transportOptions2: TransportOptions): boolean;
+
+declare type AuthTokenListener = (token: string | null) => void;
+
+declare interface AuthTokenProvider {
+ getToken(forceRefresh: boolean): Promise<FirebaseAuthTokenData | null>;
+ addTokenChangeListener(listener: AuthTokenListener): void;
+}
+
+/**
+ * enum representing different flavors of the SDK used by developers
+ * use the CallerSdkType for type-checking, and the CallerSdkTypeEnum for value-checking/assigning
+ */
+export declare type CallerSdkType = 'Base' | 'Generated' | 'TanstackReactCore' | 'GeneratedReact' | 'TanstackAngularCore' | 'GeneratedAngular';
+
+export declare const CallerSdkTypeEnum: {
+ readonly Base: "Base";
+ readonly Generated: "Generated";
+ readonly TanstackReactCore: "TanstackReactCore";
+ readonly GeneratedReact: "GeneratedReact";
+ readonly TanstackAngularCore: "TanstackAngularCore";
+ readonly GeneratedAngular: "GeneratedAngular";
+};
+
+export declare type Code = DataConnectErrorCode;
+
+export declare const Code: {
+ OTHER: DataConnectErrorCode;
+ ALREADY_INITIALIZED: DataConnectErrorCode;
+ NOT_INITIALIZED: DataConnectErrorCode;
+ NOT_SUPPORTED: DataConnectErrorCode;
+ INVALID_ARGUMENT: DataConnectErrorCode;
+ PARTIAL_ERROR: DataConnectErrorCode;
+ UNAUTHORIZED: DataConnectErrorCode;
+};
+
+/**
+ * Connect to the DataConnect Emulator
+ * @param dc Data Connect instance
+ * @param host host of emulator server
+ * @param port port of emulator server
+ * @param sslEnabled use https
+ */
+export declare function connectDataConnectEmulator(dc: DataConnect, host: string, port?: number, sslEnabled?: boolean): void;
+
+/**
+ * Connector Config for calling Data Connect backend.
+ */
+export declare interface ConnectorConfig {
+ location: string;
+ connector: string;
+ service: string;
+}
+
+/**
+ * Class representing Firebase Data Connect
+ */
+export declare class DataConnect {
+ readonly app: FirebaseApp;
+ private readonly dataConnectOptions;
+ private readonly _authProvider;
+ private readonly _appCheckProvider;
+ _queryManager: QueryManager;
+ _mutationManager: MutationManager;
+ isEmulator: boolean;
+ _initialized: boolean;
+ private _transport;
+ private _transportClass;
+ private _transportOptions?;
+ private _authTokenProvider?;
+ _isUsingGeneratedSdk: boolean;
+ _callerSdkType: CallerSdkType;
+ private _appCheckTokenProvider?;
+ constructor(app: FirebaseApp, dataConnectOptions: DataConnectOptions, _authProvider: Provider<FirebaseAuthInternalName>, _appCheckProvider: Provider<AppCheckInternalComponentName>);
+ _useGeneratedSdk(): void;
+ _setCallerSdkType(callerSdkType: CallerSdkType): void;
+ _delete(): Promise<void>;
+ getSettings(): ConnectorConfig;
+ setInitialized(): void;
+ enableEmulator(transportOptions: TransportOptions): void;
+}
+
+/** An error returned by a DataConnect operation. */
+export declare class DataConnectError extends FirebaseError {
+ /** @internal */
+ readonly name: string;
+ constructor(code: Code, message: string);
+ /** @internal */
+ toString(): string;
+}
+
+export declare type DataConnectErrorCode = 'other' | 'already-initialized' | 'not-initialized' | 'not-supported' | 'invalid-argument' | 'partial-error' | 'unauthorized';
+
+/** An error returned by a DataConnect operation. */
+export declare class DataConnectOperationError extends DataConnectError {
+ /** @internal */
+ readonly name: string;
+ /** The response received from the backend. */
+ readonly response: DataConnectOperationFailureResponse;
+ /** @hideconstructor */
+ constructor(message: string, response: DataConnectOperationFailureResponse);
+}
+
+export declare interface DataConnectOperationFailureResponse {
+ readonly data?: Record<string, unknown> | null;
+ readonly errors: DataConnectOperationFailureResponseErrorInfo[];
+}
+
+export declare interface DataConnectOperationFailureResponseErrorInfo {
+ readonly message: string;
+ readonly path: Array<string | number>;
+}
+
+/**
+ * DataConnectOptions including project id
+ */
+export declare interface DataConnectOptions extends ConnectorConfig {
+ projectId: string;
+}
+
+export declare interface DataConnectResult<Data, Variables> extends OpResult<Data> {
+ ref: OperationRef<Data, Variables>;
+}
+
+/**
+ * Representation of user provided subscription options.
+ */
+export declare interface DataConnectSubscription<Data, Variables> {
+ userCallback: OnResultSubscription<Data, Variables>;
+ errCallback?: (e?: DataConnectError) => void;
+ unsubscribe: () => void;
+}
+
+/**
+ * @internal
+ */
+export declare interface DataConnectTransport {
+ invokeQuery<T, U>(queryName: string, body?: U): Promise<{
+ data: T;
+ errors: Error[];
+ }>;
+ invokeMutation<T, U>(queryName: string, body?: U): Promise<{
+ data: T;
+ errors: Error[];
+ }>;
+ useEmulator(host: string, port?: number, sslEnabled?: boolean): void;
+ onTokenChanged: (token: string | null) => void;
+ _setCallerSdkType(callerSdkType: CallerSdkType): void;
+}
+
+export declare type DataSource = typeof SOURCE_CACHE | typeof SOURCE_SERVER;
+
+/**
+ * Execute Mutation
+ * @param mutationRef mutation to execute
+ * @returns `MutationRef`
+ */
+export declare function executeMutation<Data, Variables>(mutationRef: MutationRef<Data, Variables>): MutationPromise<Data, Variables>;
+
+/**
+ * Execute Query
+ * @param queryRef query to execute.
+ * @returns `QueryPromise`
+ */
+export declare function executeQuery<Data, Variables>(queryRef: QueryRef<Data, Variables>): QueryPromise<Data, Variables>;
+
+/**
+ * Initialize DataConnect instance
+ * @param options ConnectorConfig
+ */
+export declare function getDataConnect(options: ConnectorConfig): DataConnect;
+
+/**
+ * Initialize DataConnect instance
+ * @param app FirebaseApp to initialize to.
+ * @param options ConnectorConfig
+ */
+export declare function getDataConnect(app: FirebaseApp, options: ConnectorConfig): DataConnect;
+
+export declare const MUTATION_STR = "mutation";
+
+/**
+ * @internal
+ */
+export declare class MutationManager {
+ private _transport;
+ private _inflight;
+ constructor(_transport: DataConnectTransport);
+ executeMutation<Data, Variables>(mutationRef: MutationRef<Data, Variables>): MutationPromise<Data, Variables>;
+}
+
+/**
+ * Mutation return value from `executeMutation`
+ */
+export declare interface MutationPromise<Data, Variables> extends Promise<MutationResult<Data, Variables>> {
+}
+
+export declare interface MutationRef<Data, Variables> extends OperationRef<Data, Variables> {
+ refType: typeof MUTATION_STR;
+}
+
+/**
+ * Creates a `MutationRef`
+ * @param dcInstance Data Connect instance
+ * @param mutationName name of mutation
+ */
+export declare function mutationRef<Data>(dcInstance: DataConnect, mutationName: string): MutationRef<Data, undefined>;
+
+/**
+ *
+ * @param dcInstance Data Connect instance
+ * @param mutationName name of mutation
+ * @param variables variables to send with mutation
+ */
+export declare function mutationRef<Data, Variables>(dcInstance: DataConnect, mutationName: string, variables: Variables): MutationRef<Data, Variables>;
+
+/**
+ * Mutation Result from `executeMutation`
+ */
+export declare interface MutationResult<Data, Variables> extends DataConnectResult<Data, Variables> {
+ ref: MutationRef<Data, Variables>;
+}
+
+/**
+ * `OnCompleteSubscription`
+ */
+export declare type OnCompleteSubscription = () => void;
+
+/**
+ * Signature for `OnErrorSubscription` for `subscribe`
+ */
+export declare type OnErrorSubscription = (err?: DataConnectError) => void;
+
+/**
+ * Signature for `OnResultSubscription` for `subscribe`
+ */
+export declare type OnResultSubscription<Data, Variables> = (res: QueryResult<Data, Variables>) => void;
+
+export declare interface OperationRef<_Data, Variables> {
+ name: string;
+ variables: Variables;
+ refType: ReferenceType;
+ dataConnect: DataConnect;
+}
+
+export declare interface OpResult<Data> {
+ data: Data;
+ source: DataSource;
+ fetchTime: string;
+}
+
+declare interface ParsedArgs<Variables> {
+ dc: DataConnect;
+ vars: Variables;
+}
+
+/**
+ *
+ * @param fullHost
+ * @returns TransportOptions
+ * @internal
+ */
+export declare function parseOptions(fullHost: string): TransportOptions;
+
+export declare const QUERY_STR = "query";
+
+declare class QueryManager {
+ private transport;
+ _queries: Map<string, TrackedQuery<unknown, unknown>>;
+ constructor(transport: DataConnectTransport);
+ track<Data, Variables>(queryName: string, variables: Variables, initialCache?: OpResult<Data>): TrackedQuery<Data, Variables>;
+ addSubscription<Data, Variables>(queryRef: OperationRef<Data, Variables>, onResultCallback: OnResultSubscription<Data, Variables>, onErrorCallback?: OnErrorSubscription, initialCache?: OpResult<Data>): () => void;
+ executeQuery<Data, Variables>(queryRef: QueryRef<Data, Variables>): QueryPromise<Data, Variables>;
+ enableEmulator(host: string, port: number): void;
+}
+
+/**
+ * Promise returned from `executeQuery`
+ */
+export declare interface QueryPromise<Data, Variables> extends Promise<QueryResult<Data, Variables>> {
+}
+
+/**
+ * QueryRef object
+ */
+export declare interface QueryRef<Data, Variables> extends OperationRef<Data, Variables> {
+ refType: typeof QUERY_STR;
+}
+
+/**
+ * Execute Query
+ * @param dcInstance Data Connect instance to use.
+ * @param queryName Query to execute
+ * @returns `QueryRef`
+ */
+export declare function queryRef<Data>(dcInstance: DataConnect, queryName: string): QueryRef<Data, undefined>;
+
+/**
+ * Execute Query
+ * @param dcInstance Data Connect instance to use.
+ * @param queryName Query to execute
+ * @param variables Variables to execute with
+ * @returns `QueryRef`
+ */
+export declare function queryRef<Data, Variables>(dcInstance: DataConnect, queryName: string, variables: Variables): QueryRef<Data, Variables>;
+
+/**
+ * Result of `executeQuery`
+ */
+export declare interface QueryResult<Data, Variables> extends DataConnectResult<Data, Variables> {
+ ref: QueryRef<Data, Variables>;
+ toJSON: () => SerializedRef<Data, Variables>;
+}
+
+/**
+ * Signature for unsubscribe from `subscribe`
+ */
+export declare type QueryUnsubscribe = () => void;
+
+export declare type ReferenceType = typeof QUERY_STR | typeof MUTATION_STR;
+
+/**
+ * Serialized RefInfo as a result of `QueryResult.toJSON().refInfo`
+ */
+export declare interface RefInfo<Variables> {
+ name: string;
+ variables: Variables;
+ connectorConfig: DataConnectOptions;
+}
+
+/**
+ * Serialized Ref as a result of `QueryResult.toJSON()`
+ */
+export declare interface SerializedRef<Data, Variables> extends OpResult<Data> {
+ refInfo: RefInfo<Variables>;
+}
+
+export declare function setLogLevel(logLevel: LogLevelString): void;
+
+export declare const SOURCE_CACHE = "CACHE";
+
+export declare const SOURCE_SERVER = "SERVER";
+
+/**
+ * Subscribe to a `QueryRef`
+ * @param queryRefOrSerializedResult query ref or serialized result.
+ * @param observer observer object to use for subscribing.
+ * @returns `SubscriptionOptions`
+ */
+export declare function subscribe<Data, Variables>(queryRefOrSerializedResult: QueryRef<Data, Variables> | SerializedRef<Data, Variables>, observer: SubscriptionOptions<Data, Variables>): QueryUnsubscribe;
+
+/**
+ * Subscribe to a `QueryRef`
+ * @param queryRefOrSerializedResult query ref or serialized result.
+ * @param onNext Callback to call when result comes back.
+ * @param onError Callback to call when error gets thrown.
+ * @param onComplete Called when subscription completes.
+ * @returns `SubscriptionOptions`
+ */
+export declare function subscribe<Data, Variables>(queryRefOrSerializedResult: QueryRef<Data, Variables> | SerializedRef<Data, Variables>, onNext: OnResultSubscription<Data, Variables>, onError?: OnErrorSubscription, onComplete?: OnCompleteSubscription): QueryUnsubscribe;
+
+/**
+ * Representation of full observer options in `subscribe`
+ */
+export declare interface SubscriptionOptions<Data, Variables> {
+ onNext?: OnResultSubscription<Data, Variables>;
+ onErr?: OnErrorSubscription;
+ onComplete?: OnCompleteSubscription;
+}
+
+/**
+ * Delete DataConnect instance
+ * @param dataConnect DataConnect instance
+ * @returns
+ */
+export declare function terminate(dataConnect: DataConnect): Promise<void>;
+
+/**
+ * Converts serialized ref to query ref
+ * @param serializedRef ref to convert to `QueryRef`
+ * @returns `QueryRef`
+ */
+export declare function toQueryRef<Data, Variables>(serializedRef: SerializedRef<Data, Variables>): QueryRef<Data, Variables>;
+
+declare interface TrackedQuery<Data, Variables> {
+ ref: Omit<OperationRef<Data, Variables>, 'dataConnect'>;
+ subscriptions: Array<DataConnectSubscription<Data, Variables>>;
+ currentCache: OpResult<Data> | null;
+ lastError: DataConnectError | null;
+}
+
+/**
+ * @internal
+ */
+export declare type TransportClass = new (options: DataConnectOptions, apiKey?: string, appId?: string, authProvider?: AuthTokenProvider, appCheckProvider?: AppCheckTokenProvider, transportOptions?: TransportOptions, _isUsingGen?: boolean, _callerSdkType?: CallerSdkType) => DataConnectTransport;
+
+/**
+ * Options to connect to emulator
+ */
+export declare interface TransportOptions {
+ host: string;
+ sslEnabled?: boolean;
+ port?: number;
+}
+
+/**
+ * The generated SDK will allow the user to pass in either the variable or the data connect instance with the variable,
+ * and this function validates the variables and returns back the DataConnect instance and variables based on the arguments passed in.
+ * @param connectorConfig
+ * @param dcOrVars
+ * @param vars
+ * @param validateVars
+ * @returns {DataConnect} and {Variables} instance
+ * @internal
+ */
+export declare function validateArgs<Variables extends object>(connectorConfig: ConnectorConfig, dcOrVars?: DataConnect | Variables, vars?: Variables, validateVars?: boolean): ParsedArgs<Variables>;
+
+/**
+ *
+ * @param dcOptions
+ * @returns {void}
+ * @internal
+ */
+export declare function validateDCOptions(dcOptions: ConnectorConfig): boolean;
+
+export { }
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/index.node.esm.js b/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/index.node.esm.js
new file mode 100644
index 0000000..b911fbc
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/index.node.esm.js
@@ -0,0 +1,1251 @@
+import { FirebaseError, isCloudWorkstation, pingServer, updateEmulatorBanner } from '@firebase/util';
+import { Logger } from '@firebase/logger';
+import { _isFirebaseServerApp, _removeServiceInstance, getApp, _getProvider, _registerComponent, registerVersion, SDK_VERSION as SDK_VERSION$1 } from '@firebase/app';
+import { Component } from '@firebase/component';
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+const Code = {
+ OTHER: 'other',
+ ALREADY_INITIALIZED: 'already-initialized',
+ NOT_INITIALIZED: 'not-initialized',
+ NOT_SUPPORTED: 'not-supported',
+ INVALID_ARGUMENT: 'invalid-argument',
+ PARTIAL_ERROR: 'partial-error',
+ UNAUTHORIZED: 'unauthorized'
+};
+/** An error returned by a DataConnect operation. */
+class DataConnectError extends FirebaseError {
+ constructor(code, message) {
+ super(code, message);
+ /** @internal */
+ this.name = 'DataConnectError';
+ // Ensure the instanceof operator works as expected on subclasses of Error.
+ // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#custom_error_types
+ // and https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html#support-for-newtarget
+ Object.setPrototypeOf(this, DataConnectError.prototype);
+ }
+ /** @internal */
+ toString() {
+ return `${this.name}[code=${this.code}]: ${this.message}`;
+ }
+}
+/** An error returned by a DataConnect operation. */
+class DataConnectOperationError extends DataConnectError {
+ /** @hideconstructor */
+ constructor(message, response) {
+ super(Code.PARTIAL_ERROR, message);
+ /** @internal */
+ this.name = 'DataConnectOperationError';
+ this.response = response;
+ }
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/** The semver (www.semver.org) version of the SDK. */
+let SDK_VERSION = '';
+/**
+ * SDK_VERSION should be set before any database instance is created
+ * @internal
+ */
+function setSDKVersion(version) {
+ SDK_VERSION = version;
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+const logger = new Logger('@firebase/data-connect');
+function setLogLevel(logLevel) {
+ logger.setLogLevel(logLevel);
+}
+function logDebug(msg) {
+ logger.debug(`DataConnect (${SDK_VERSION}): ${msg}`);
+}
+function logError(msg) {
+ logger.error(`DataConnect (${SDK_VERSION}): ${msg}`);
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+const CallerSdkTypeEnum = {
+ Base: 'Base', // Core JS SDK
+ Generated: 'Generated', // Generated JS SDK
+ TanstackReactCore: 'TanstackReactCore', // Tanstack non-generated React SDK
+ GeneratedReact: 'GeneratedReact', // Tanstack non-generated Angular SDK
+ TanstackAngularCore: 'TanstackAngularCore', // Tanstack non-generated Angular SDK
+ GeneratedAngular: 'GeneratedAngular' // Generated Angular SDK
+};
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+let connectFetch = globalThis.fetch;
+function initializeFetch(fetchImpl) {
+ connectFetch = fetchImpl;
+}
+function getGoogApiClientValue(_isUsingGen, _callerSdkType) {
+ let str = 'gl-js/ fire/' + SDK_VERSION;
+ if (_callerSdkType !== CallerSdkTypeEnum.Base &&
+ _callerSdkType !== CallerSdkTypeEnum.Generated) {
+ str += ' js/' + _callerSdkType.toLowerCase();
+ }
+ else if (_isUsingGen || _callerSdkType === CallerSdkTypeEnum.Generated) {
+ str += ' js/gen';
+ }
+ return str;
+}
+function dcFetch(url, body, { signal }, appId, accessToken, appCheckToken, _isUsingGen, _callerSdkType, _isUsingEmulator) {
+ if (!connectFetch) {
+ throw new DataConnectError(Code.OTHER, 'No Fetch Implementation detected!');
+ }
+ const headers = {
+ 'Content-Type': 'application/json',
+ 'X-Goog-Api-Client': getGoogApiClientValue(_isUsingGen, _callerSdkType)
+ };
+ if (accessToken) {
+ headers['X-Firebase-Auth-Token'] = accessToken;
+ }
+ if (appId) {
+ headers['x-firebase-gmpid'] = appId;
+ }
+ if (appCheckToken) {
+ headers['X-Firebase-AppCheck'] = appCheckToken;
+ }
+ const bodyStr = JSON.stringify(body);
+ const fetchOptions = {
+ body: bodyStr,
+ method: 'POST',
+ headers,
+ signal
+ };
+ if (isCloudWorkstation(url) && _isUsingEmulator) {
+ fetchOptions.credentials = 'include';
+ }
+ return connectFetch(url, fetchOptions)
+ .catch(err => {
+ throw new DataConnectError(Code.OTHER, 'Failed to fetch: ' + JSON.stringify(err));
+ })
+ .then(async (response) => {
+ let jsonResponse = null;
+ try {
+ jsonResponse = await response.json();
+ }
+ catch (e) {
+ throw new DataConnectError(Code.OTHER, JSON.stringify(e));
+ }
+ const message = getMessage(jsonResponse);
+ if (response.status >= 400) {
+ logError('Error while performing request: ' + JSON.stringify(jsonResponse));
+ if (response.status === 401) {
+ throw new DataConnectError(Code.UNAUTHORIZED, message);
+ }
+ throw new DataConnectError(Code.OTHER, message);
+ }
+ return jsonResponse;
+ })
+ .then(res => {
+ if (res.errors && res.errors.length) {
+ const stringified = JSON.stringify(res.errors);
+ const response = {
+ errors: res.errors,
+ data: res.data
+ };
+ throw new DataConnectOperationError('DataConnect error while performing request: ' + stringified, response);
+ }
+ return res;
+ });
+}
+function getMessage(obj) {
+ if ('message' in obj) {
+ return obj.message;
+ }
+ return JSON.stringify(obj);
+}
+
+const name = "@firebase/data-connect";
+const version = "0.3.11";
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @internal
+ * Abstraction around AppCheck's token fetching capabilities.
+ */
+class AppCheckTokenProvider {
+ constructor(app, appCheckProvider) {
+ this.appCheckProvider = appCheckProvider;
+ if (_isFirebaseServerApp(app) && app.settings.appCheckToken) {
+ this.serverAppAppCheckToken = app.settings.appCheckToken;
+ }
+ this.appCheck = appCheckProvider?.getImmediate({ optional: true });
+ if (!this.appCheck) {
+ void appCheckProvider
+ ?.get()
+ .then(appCheck => (this.appCheck = appCheck))
+ .catch();
+ }
+ }
+ getToken() {
+ if (this.serverAppAppCheckToken) {
+ return Promise.resolve({ token: this.serverAppAppCheckToken });
+ }
+ if (!this.appCheck) {
+ return new Promise((resolve, reject) => {
+ // Support delayed initialization of FirebaseAppCheck. This allows our
+ // customers to initialize the RTDB SDK before initializing Firebase
+ // AppCheck and ensures that all requests are authenticated if a token
+ // becomes available before the timoeout below expires.
+ setTimeout(() => {
+ if (this.appCheck) {
+ this.getToken().then(resolve, reject);
+ }
+ else {
+ resolve(null);
+ }
+ }, 0);
+ });
+ }
+ return this.appCheck.getToken();
+ }
+ addTokenChangeListener(listener) {
+ void this.appCheckProvider
+ ?.get()
+ .then(appCheck => appCheck.addTokenListener(listener));
+ }
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// @internal
+class FirebaseAuthProvider {
+ constructor(_appName, _options, _authProvider) {
+ this._appName = _appName;
+ this._options = _options;
+ this._authProvider = _authProvider;
+ this._auth = _authProvider.getImmediate({ optional: true });
+ if (!this._auth) {
+ _authProvider.onInit(auth => (this._auth = auth));
+ }
+ }
+ getToken(forceRefresh) {
+ if (!this._auth) {
+ return new Promise((resolve, reject) => {
+ setTimeout(() => {
+ if (this._auth) {
+ this.getToken(forceRefresh).then(resolve, reject);
+ }
+ else {
+ resolve(null);
+ }
+ }, 0);
+ });
+ }
+ return this._auth.getToken(forceRefresh).catch(error => {
+ if (error && error.code === 'auth/token-not-initialized') {
+ logDebug('Got auth/token-not-initialized error. Treating as null token.');
+ return null;
+ }
+ else {
+ logError('Error received when attempting to retrieve token: ' +
+ JSON.stringify(error));
+ return Promise.reject(error);
+ }
+ });
+ }
+ addTokenChangeListener(listener) {
+ this._auth?.addAuthTokenListener(listener);
+ }
+ removeTokenChangeListener(listener) {
+ this._authProvider
+ .get()
+ .then(auth => auth.removeAuthTokenListener(listener))
+ .catch(err => logError(err));
+ }
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+const QUERY_STR = 'query';
+const MUTATION_STR = 'mutation';
+const SOURCE_SERVER = 'SERVER';
+const SOURCE_CACHE = 'CACHE';
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+let encoderImpl;
+function setEncoder(encoder) {
+ encoderImpl = encoder;
+}
+setEncoder(o => JSON.stringify(o));
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+function setIfNotExists(map, key, val) {
+ if (!map.has(key)) {
+ map.set(key, val);
+ }
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+function getRefSerializer(queryRef, data, source) {
+ return function toJSON() {
+ return {
+ data,
+ refInfo: {
+ name: queryRef.name,
+ variables: queryRef.variables,
+ connectorConfig: {
+ projectId: queryRef.dataConnect.app.options.projectId,
+ ...queryRef.dataConnect.getSettings()
+ }
+ },
+ fetchTime: Date.now().toLocaleString(),
+ source
+ };
+ };
+}
+class QueryManager {
+ constructor(transport) {
+ this.transport = transport;
+ this._queries = new Map();
+ }
+ track(queryName, variables, initialCache) {
+ const ref = {
+ name: queryName,
+ variables,
+ refType: QUERY_STR
+ };
+ const key = encoderImpl(ref);
+ const newTrackedQuery = {
+ ref,
+ subscriptions: [],
+ currentCache: initialCache || null,
+ lastError: null
+ };
+ // @ts-ignore
+ setIfNotExists(this._queries, key, newTrackedQuery);
+ return this._queries.get(key);
+ }
+ addSubscription(queryRef, onResultCallback, onErrorCallback, initialCache) {
+ const key = encoderImpl({
+ name: queryRef.name,
+ variables: queryRef.variables,
+ refType: QUERY_STR
+ });
+ const trackedQuery = this._queries.get(key);
+ const subscription = {
+ userCallback: onResultCallback,
+ errCallback: onErrorCallback
+ };
+ const unsubscribe = () => {
+ const trackedQuery = this._queries.get(key);
+ trackedQuery.subscriptions = trackedQuery.subscriptions.filter(sub => sub !== subscription);
+ };
+ if (initialCache && trackedQuery.currentCache !== initialCache) {
+ logDebug('Initial cache found. Comparing dates.');
+ if (!trackedQuery.currentCache ||
+ (trackedQuery.currentCache &&
+ compareDates(trackedQuery.currentCache.fetchTime, initialCache.fetchTime))) {
+ trackedQuery.currentCache = initialCache;
+ }
+ }
+ if (trackedQuery.currentCache !== null) {
+ const cachedData = trackedQuery.currentCache.data;
+ onResultCallback({
+ data: cachedData,
+ source: SOURCE_CACHE,
+ ref: queryRef,
+ toJSON: getRefSerializer(queryRef, trackedQuery.currentCache.data, SOURCE_CACHE),
+ fetchTime: trackedQuery.currentCache.fetchTime
+ });
+ if (trackedQuery.lastError !== null && onErrorCallback) {
+ onErrorCallback(undefined);
+ }
+ }
+ trackedQuery.subscriptions.push({
+ userCallback: onResultCallback,
+ errCallback: onErrorCallback,
+ unsubscribe
+ });
+ if (!trackedQuery.currentCache) {
+ logDebug(`No cache available for query ${queryRef.name} with variables ${JSON.stringify(queryRef.variables)}. Calling executeQuery.`);
+ const promise = this.executeQuery(queryRef);
+ // We want to ignore the error and let subscriptions handle it
+ promise.then(undefined, err => { });
+ }
+ return unsubscribe;
+ }
+ executeQuery(queryRef) {
+ if (queryRef.refType !== QUERY_STR) {
+ throw new DataConnectError(Code.INVALID_ARGUMENT, `ExecuteQuery can only execute query operation`);
+ }
+ const key = encoderImpl({
+ name: queryRef.name,
+ variables: queryRef.variables,
+ refType: QUERY_STR
+ });
+ const trackedQuery = this._queries.get(key);
+ const result = this.transport.invokeQuery(queryRef.name, queryRef.variables);
+ const newR = result.then(res => {
+ const fetchTime = new Date().toString();
+ const result = {
+ ...res,
+ source: SOURCE_SERVER,
+ ref: queryRef,
+ toJSON: getRefSerializer(queryRef, res.data, SOURCE_SERVER),
+ fetchTime
+ };
+ trackedQuery.subscriptions.forEach(subscription => {
+ subscription.userCallback(result);
+ });
+ trackedQuery.currentCache = {
+ data: res.data,
+ source: SOURCE_CACHE,
+ fetchTime
+ };
+ return result;
+ }, err => {
+ trackedQuery.lastError = err;
+ trackedQuery.subscriptions.forEach(subscription => {
+ if (subscription.errCallback) {
+ subscription.errCallback(err);
+ }
+ });
+ throw err;
+ });
+ return newR;
+ }
+ enableEmulator(host, port) {
+ this.transport.useEmulator(host, port);
+ }
+}
+function compareDates(str1, str2) {
+ const date1 = new Date(str1);
+ const date2 = new Date(str2);
+ return date1.getTime() < date2.getTime();
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+function urlBuilder(projectConfig, transportOptions) {
+ const { connector, location, projectId: project, service } = projectConfig;
+ const { host, sslEnabled, port } = transportOptions;
+ const protocol = sslEnabled ? 'https' : 'http';
+ const realHost = host || `firebasedataconnect.googleapis.com`;
+ let baseUrl = `${protocol}://${realHost}`;
+ if (typeof port === 'number') {
+ baseUrl += `:${port}`;
+ }
+ else if (typeof port !== 'undefined') {
+ logError('Port type is of an invalid type');
+ throw new DataConnectError(Code.INVALID_ARGUMENT, 'Incorrect type for port passed in!');
+ }
+ return `${baseUrl}/v1/projects/${project}/locations/${location}/services/${service}/connectors/${connector}`;
+}
+function addToken(url, apiKey) {
+ if (!apiKey) {
+ return url;
+ }
+ const newUrl = new URL(url);
+ newUrl.searchParams.append('key', apiKey);
+ return newUrl.toString();
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+class RESTTransport {
+ constructor(options, apiKey, appId, authProvider, appCheckProvider, transportOptions, _isUsingGen = false, _callerSdkType = CallerSdkTypeEnum.Base) {
+ this.apiKey = apiKey;
+ this.appId = appId;
+ this.authProvider = authProvider;
+ this.appCheckProvider = appCheckProvider;
+ this._isUsingGen = _isUsingGen;
+ this._callerSdkType = _callerSdkType;
+ this._host = '';
+ this._location = 'l';
+ this._connectorName = '';
+ this._secure = true;
+ this._project = 'p';
+ this._accessToken = null;
+ this._appCheckToken = null;
+ this._lastToken = null;
+ this._isUsingEmulator = false;
+ // TODO(mtewani): Update U to include shape of body defined in line 13.
+ this.invokeQuery = (queryName, body) => {
+ const abortController = new AbortController();
+ // TODO(mtewani): Update to proper value
+ const withAuth = this.withRetry(() => dcFetch(addToken(`${this.endpointUrl}:executeQuery`, this.apiKey), {
+ name: `projects/${this._project}/locations/${this._location}/services/${this._serviceName}/connectors/${this._connectorName}`,
+ operationName: queryName,
+ variables: body
+ }, abortController, this.appId, this._accessToken, this._appCheckToken, this._isUsingGen, this._callerSdkType, this._isUsingEmulator));
+ return withAuth;
+ };
+ this.invokeMutation = (mutationName, body) => {
+ const abortController = new AbortController();
+ const taskResult = this.withRetry(() => {
+ return dcFetch(addToken(`${this.endpointUrl}:executeMutation`, this.apiKey), {
+ name: `projects/${this._project}/locations/${this._location}/services/${this._serviceName}/connectors/${this._connectorName}`,
+ operationName: mutationName,
+ variables: body
+ }, abortController, this.appId, this._accessToken, this._appCheckToken, this._isUsingGen, this._callerSdkType, this._isUsingEmulator);
+ });
+ return taskResult;
+ };
+ if (transportOptions) {
+ if (typeof transportOptions.port === 'number') {
+ this._port = transportOptions.port;
+ }
+ if (typeof transportOptions.sslEnabled !== 'undefined') {
+ this._secure = transportOptions.sslEnabled;
+ }
+ this._host = transportOptions.host;
+ }
+ const { location, projectId: project, connector, service } = options;
+ if (location) {
+ this._location = location;
+ }
+ if (project) {
+ this._project = project;
+ }
+ this._serviceName = service;
+ if (!connector) {
+ throw new DataConnectError(Code.INVALID_ARGUMENT, 'Connector Name required!');
+ }
+ this._connectorName = connector;
+ this.authProvider?.addTokenChangeListener(token => {
+ logDebug(`New Token Available: ${token}`);
+ this._accessToken = token;
+ });
+ this.appCheckProvider?.addTokenChangeListener(result => {
+ const { token } = result;
+ logDebug(`New App Check Token Available: ${token}`);
+ this._appCheckToken = token;
+ });
+ }
+ get endpointUrl() {
+ return urlBuilder({
+ connector: this._connectorName,
+ location: this._location,
+ projectId: this._project,
+ service: this._serviceName
+ }, { host: this._host, sslEnabled: this._secure, port: this._port });
+ }
+ useEmulator(host, port, isSecure) {
+ this._host = host;
+ this._isUsingEmulator = true;
+ if (typeof port === 'number') {
+ this._port = port;
+ }
+ if (typeof isSecure !== 'undefined') {
+ this._secure = isSecure;
+ }
+ }
+ onTokenChanged(newToken) {
+ this._accessToken = newToken;
+ }
+ async getWithAuth(forceToken = false) {
+ let starterPromise = new Promise(resolve => resolve(this._accessToken));
+ if (this.appCheckProvider) {
+ this._appCheckToken = (await this.appCheckProvider.getToken())?.token;
+ }
+ if (this.authProvider) {
+ starterPromise = this.authProvider
+ .getToken(/*forceToken=*/ forceToken)
+ .then(data => {
+ if (!data) {
+ return null;
+ }
+ this._accessToken = data.accessToken;
+ return this._accessToken;
+ });
+ }
+ else {
+ starterPromise = new Promise(resolve => resolve(''));
+ }
+ return starterPromise;
+ }
+ _setLastToken(lastToken) {
+ this._lastToken = lastToken;
+ }
+ withRetry(promiseFactory, retry = false) {
+ let isNewToken = false;
+ return this.getWithAuth(retry)
+ .then(res => {
+ isNewToken = this._lastToken !== res;
+ this._lastToken = res;
+ return res;
+ })
+ .then(promiseFactory)
+ .catch(err => {
+ // Only retry if the result is unauthorized and the last token isn't the same as the new one.
+ if ('code' in err &&
+ err.code === Code.UNAUTHORIZED &&
+ !retry &&
+ isNewToken) {
+ logDebug('Retrying due to unauthorized');
+ return this.withRetry(promiseFactory, true);
+ }
+ throw err;
+ });
+ }
+ _setCallerSdkType(callerSdkType) {
+ this._callerSdkType = callerSdkType;
+ }
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ *
+ * @param dcInstance Data Connect instance
+ * @param mutationName name of mutation
+ * @param variables variables to send with mutation
+ * @returns `MutationRef`
+ */
+function mutationRef(dcInstance, mutationName, variables) {
+ dcInstance.setInitialized();
+ const ref = {
+ dataConnect: dcInstance,
+ name: mutationName,
+ refType: MUTATION_STR,
+ variables: variables
+ };
+ return ref;
+}
+/**
+ * @internal
+ */
+class MutationManager {
+ constructor(_transport) {
+ this._transport = _transport;
+ this._inflight = [];
+ }
+ executeMutation(mutationRef) {
+ const result = this._transport.invokeMutation(mutationRef.name, mutationRef.variables);
+ const withRefPromise = result.then(res => {
+ const obj = {
+ ...res, // Double check that the result is result.data, not just result
+ source: SOURCE_SERVER,
+ ref: mutationRef,
+ fetchTime: Date.now().toLocaleString()
+ };
+ return obj;
+ });
+ this._inflight.push(result);
+ const removePromise = () => (this._inflight = this._inflight.filter(promise => promise !== result));
+ result.then(removePromise, removePromise);
+ return withRefPromise;
+ }
+}
+/**
+ * Execute Mutation
+ * @param mutationRef mutation to execute
+ * @returns `MutationRef`
+ */
+function executeMutation(mutationRef) {
+ return mutationRef.dataConnect._mutationManager.executeMutation(mutationRef);
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+const FIREBASE_DATA_CONNECT_EMULATOR_HOST_VAR = 'FIREBASE_DATA_CONNECT_EMULATOR_HOST';
+/**
+ *
+ * @param fullHost
+ * @returns TransportOptions
+ * @internal
+ */
+function parseOptions(fullHost) {
+ const [protocol, hostName] = fullHost.split('://');
+ const isSecure = protocol === 'https';
+ const [host, portAsString] = hostName.split(':');
+ const port = Number(portAsString);
+ return { host, port, sslEnabled: isSecure };
+}
+/**
+ * Class representing Firebase Data Connect
+ */
+class DataConnect {
+ // @internal
+ constructor(app,
+ // TODO(mtewani): Replace with _dataConnectOptions in the future
+ dataConnectOptions, _authProvider, _appCheckProvider) {
+ this.app = app;
+ this.dataConnectOptions = dataConnectOptions;
+ this._authProvider = _authProvider;
+ this._appCheckProvider = _appCheckProvider;
+ this.isEmulator = false;
+ this._initialized = false;
+ this._isUsingGeneratedSdk = false;
+ this._callerSdkType = CallerSdkTypeEnum.Base;
+ if (typeof process !== 'undefined' && process.env) {
+ const host = process.env[FIREBASE_DATA_CONNECT_EMULATOR_HOST_VAR];
+ if (host) {
+ logDebug('Found custom host. Using emulator');
+ this.isEmulator = true;
+ this._transportOptions = parseOptions(host);
+ }
+ }
+ }
+ // @internal
+ _useGeneratedSdk() {
+ if (!this._isUsingGeneratedSdk) {
+ this._isUsingGeneratedSdk = true;
+ }
+ }
+ _setCallerSdkType(callerSdkType) {
+ this._callerSdkType = callerSdkType;
+ if (this._initialized) {
+ this._transport._setCallerSdkType(callerSdkType);
+ }
+ }
+ _delete() {
+ _removeServiceInstance(this.app, 'data-connect', JSON.stringify(this.getSettings()));
+ return Promise.resolve();
+ }
+ // @internal
+ getSettings() {
+ const copy = JSON.parse(JSON.stringify(this.dataConnectOptions));
+ delete copy.projectId;
+ return copy;
+ }
+ // @internal
+ setInitialized() {
+ if (this._initialized) {
+ return;
+ }
+ if (this._transportClass === undefined) {
+ logDebug('transportClass not provided. Defaulting to RESTTransport.');
+ this._transportClass = RESTTransport;
+ }
+ if (this._authProvider) {
+ this._authTokenProvider = new FirebaseAuthProvider(this.app.name, this.app.options, this._authProvider);
+ }
+ if (this._appCheckProvider) {
+ this._appCheckTokenProvider = new AppCheckTokenProvider(this.app, this._appCheckProvider);
+ }
+ this._initialized = true;
+ this._transport = new this._transportClass(this.dataConnectOptions, this.app.options.apiKey, this.app.options.appId, this._authTokenProvider, this._appCheckTokenProvider, undefined, this._isUsingGeneratedSdk, this._callerSdkType);
+ if (this._transportOptions) {
+ this._transport.useEmulator(this._transportOptions.host, this._transportOptions.port, this._transportOptions.sslEnabled);
+ }
+ this._queryManager = new QueryManager(this._transport);
+ this._mutationManager = new MutationManager(this._transport);
+ }
+ // @internal
+ enableEmulator(transportOptions) {
+ if (this._initialized &&
+ !areTransportOptionsEqual(this._transportOptions, transportOptions)) {
+ logError('enableEmulator called after initialization');
+ throw new DataConnectError(Code.ALREADY_INITIALIZED, 'DataConnect instance already initialized!');
+ }
+ this._transportOptions = transportOptions;
+ this.isEmulator = true;
+ }
+}
+/**
+ * @internal
+ * @param transportOptions1
+ * @param transportOptions2
+ * @returns
+ */
+function areTransportOptionsEqual(transportOptions1, transportOptions2) {
+ return (transportOptions1.host === transportOptions2.host &&
+ transportOptions1.port === transportOptions2.port &&
+ transportOptions1.sslEnabled === transportOptions2.sslEnabled);
+}
+/**
+ * Connect to the DataConnect Emulator
+ * @param dc Data Connect instance
+ * @param host host of emulator server
+ * @param port port of emulator server
+ * @param sslEnabled use https
+ */
+function connectDataConnectEmulator(dc, host, port, sslEnabled = false) {
+ // Workaround to get cookies in Firebase Studio
+ if (isCloudWorkstation(host)) {
+ void pingServer(`https://${host}${port ? `:${port}` : ''}`);
+ updateEmulatorBanner('Data Connect', true);
+ }
+ dc.enableEmulator({ host, port, sslEnabled });
+}
+function getDataConnect(appOrOptions, optionalOptions) {
+ let app;
+ let dcOptions;
+ if ('location' in appOrOptions) {
+ dcOptions = appOrOptions;
+ app = getApp();
+ }
+ else {
+ dcOptions = optionalOptions;
+ app = appOrOptions;
+ }
+ if (!app || Object.keys(app).length === 0) {
+ app = getApp();
+ }
+ const provider = _getProvider(app, 'data-connect');
+ const identifier = JSON.stringify(dcOptions);
+ if (provider.isInitialized(identifier)) {
+ const dcInstance = provider.getImmediate({ identifier });
+ const options = provider.getOptions(identifier);
+ const optionsValid = Object.keys(options).length > 0;
+ if (optionsValid) {
+ logDebug('Re-using cached instance');
+ return dcInstance;
+ }
+ }
+ validateDCOptions(dcOptions);
+ logDebug('Creating new DataConnect instance');
+ // Initialize with options.
+ return provider.initialize({
+ instanceIdentifier: identifier,
+ options: dcOptions
+ });
+}
+/**
+ *
+ * @param dcOptions
+ * @returns {void}
+ * @internal
+ */
+function validateDCOptions(dcOptions) {
+ const fields = ['connector', 'location', 'service'];
+ if (!dcOptions) {
+ throw new DataConnectError(Code.INVALID_ARGUMENT, 'DC Option Required');
+ }
+ fields.forEach(field => {
+ if (dcOptions[field] === null || dcOptions[field] === undefined) {
+ throw new DataConnectError(Code.INVALID_ARGUMENT, `${field} Required`);
+ }
+ });
+ return true;
+}
+/**
+ * Delete DataConnect instance
+ * @param dataConnect DataConnect instance
+ * @returns
+ */
+function terminate(dataConnect) {
+ return dataConnect._delete();
+ // TODO(mtewani): Stop pending tasks
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+function registerDataConnect(variant) {
+ setSDKVersion(SDK_VERSION$1);
+ _registerComponent(new Component('data-connect', (container, { instanceIdentifier: settings, options }) => {
+ const app = container.getProvider('app').getImmediate();
+ const authProvider = container.getProvider('auth-internal');
+ const appCheckProvider = container.getProvider('app-check-internal');
+ let newOpts = options;
+ if (settings) {
+ newOpts = JSON.parse(settings);
+ }
+ if (!app.options.projectId) {
+ throw new DataConnectError(Code.INVALID_ARGUMENT, 'Project ID must be provided. Did you pass in a proper projectId to initializeApp?');
+ }
+ return new DataConnect(app, { ...newOpts, projectId: app.options.projectId }, authProvider, appCheckProvider);
+ }, "PUBLIC" /* ComponentType.PUBLIC */).setMultipleInstances(true));
+ registerVersion(name, version, variant);
+ // BUILD_TARGET will be replaced by values like esm, cjs, etc during the compilation
+ registerVersion(name, version, 'esm2020');
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * Execute Query
+ * @param queryRef query to execute.
+ * @returns `QueryPromise`
+ */
+function executeQuery(queryRef) {
+ return queryRef.dataConnect._queryManager.executeQuery(queryRef);
+}
+/**
+ * Execute Query
+ * @param dcInstance Data Connect instance to use.
+ * @param queryName Query to execute
+ * @param variables Variables to execute with
+ * @param initialCache initial cache to use for client hydration
+ * @returns `QueryRef`
+ */
+function queryRef(dcInstance, queryName, variables, initialCache) {
+ dcInstance.setInitialized();
+ dcInstance._queryManager.track(queryName, variables, initialCache);
+ return {
+ dataConnect: dcInstance,
+ refType: QUERY_STR,
+ name: queryName,
+ variables
+ };
+}
+/**
+ * Converts serialized ref to query ref
+ * @param serializedRef ref to convert to `QueryRef`
+ * @returns `QueryRef`
+ */
+function toQueryRef(serializedRef) {
+ const { refInfo: { name, variables, connectorConfig } } = serializedRef;
+ return queryRef(getDataConnect(connectorConfig), name, variables);
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * The generated SDK will allow the user to pass in either the variable or the data connect instance with the variable,
+ * and this function validates the variables and returns back the DataConnect instance and variables based on the arguments passed in.
+ * @param connectorConfig
+ * @param dcOrVars
+ * @param vars
+ * @param validateVars
+ * @returns {DataConnect} and {Variables} instance
+ * @internal
+ */
+function validateArgs(connectorConfig, dcOrVars, vars, validateVars) {
+ let dcInstance;
+ let realVars;
+ if (dcOrVars && 'enableEmulator' in dcOrVars) {
+ dcInstance = dcOrVars;
+ realVars = vars;
+ }
+ else {
+ dcInstance = getDataConnect(connectorConfig);
+ realVars = dcOrVars;
+ }
+ if (!dcInstance || (!realVars && validateVars)) {
+ throw new DataConnectError(Code.INVALID_ARGUMENT, 'Variables required.');
+ }
+ return { dc: dcInstance, vars: realVars };
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * Subscribe to a `QueryRef`
+ * @param queryRefOrSerializedResult query ref or serialized result.
+ * @param observerOrOnNext observer object or next function.
+ * @param onError Callback to call when error gets thrown.
+ * @param onComplete Called when subscription completes.
+ * @returns `SubscriptionOptions`
+ */
+function subscribe(queryRefOrSerializedResult, observerOrOnNext, onError, onComplete) {
+ let ref;
+ let initialCache;
+ if ('refInfo' in queryRefOrSerializedResult) {
+ const serializedRef = queryRefOrSerializedResult;
+ const { data, source, fetchTime } = serializedRef;
+ initialCache = {
+ data,
+ source,
+ fetchTime
+ };
+ ref = toQueryRef(serializedRef);
+ }
+ else {
+ ref = queryRefOrSerializedResult;
+ }
+ let onResult = undefined;
+ if (typeof observerOrOnNext === 'function') {
+ onResult = observerOrOnNext;
+ }
+ else {
+ onResult = observerOrOnNext.onNext;
+ onError = observerOrOnNext.onErr;
+ observerOrOnNext.onComplete;
+ }
+ if (!onResult) {
+ throw new DataConnectError(Code.INVALID_ARGUMENT, 'Must provide onNext');
+ }
+ return ref.dataConnect._queryManager.addSubscription(ref, onResult, onError, initialCache);
+}
+
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+initializeFetch(fetch);
+registerDataConnect('node');
+
+export { CallerSdkTypeEnum, Code, DataConnect, DataConnectError, DataConnectOperationError, MUTATION_STR, MutationManager, QUERY_STR, SOURCE_CACHE, SOURCE_SERVER, areTransportOptionsEqual, connectDataConnectEmulator, executeMutation, executeQuery, getDataConnect, mutationRef, parseOptions, queryRef, setLogLevel, subscribe, terminate, toQueryRef, validateArgs, validateDCOptions };
+//# sourceMappingURL=index.node.esm.js.map
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/index.node.esm.js.map b/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/index.node.esm.js.map
new file mode 100644
index 0000000..f6b9ce7
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/index.node.esm.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"index.node.esm.js","sources":["../../src/core/error.ts","../../src/core/version.ts","../../src/logger.ts","../../src/network/transport/index.ts","../../src/network/fetch.ts","../../src/core/AppCheckTokenProvider.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/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.node.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\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 /** @internal */\n readonly name: string = 'DataConnectError';\n\n constructor(code: Code, message: string) {\n super(code, message);\n\n // Ensure the instanceof operator works as expected on subclasses of Error.\n // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#custom_error_types\n // and https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html#support-for-newtarget\n Object.setPrototypeOf(this, DataConnectError.prototype);\n }\n\n /** @internal */\n toString(): string {\n return `${this.name}[code=${this.code}]: ${this.message}`;\n }\n}\n\n/** An error returned by a DataConnect operation. */\nexport class DataConnectOperationError extends DataConnectError {\n /** @internal */\n readonly name: string = 'DataConnectOperationError';\n\n /** The response received from the backend. */\n readonly response: DataConnectOperationFailureResponse;\n\n /** @hideconstructor */\n constructor(message: string, response: DataConnectOperationFailureResponse) {\n super(Code.PARTIAL_ERROR, message);\n this.response = response;\n }\n}\n\nexport interface DataConnectOperationFailureResponse {\n // The \"data\" provided by the backend in the response message.\n //\n // Will be `undefined` if no \"data\" was provided in the response message.\n // Otherwise, will be `null` if `null` was explicitly specified as the \"data\"\n // in the response message. Otherwise, will be the value of the \"data\"\n // specified as the \"data\" in the response message\n readonly data?: Record<string, unknown> | null;\n\n // The list of errors provided by the backend in the response message.\n readonly errors: DataConnectOperationFailureResponseErrorInfo[];\n}\n\n// Information about the error, as provided in the response from the backend.\n// See https://spec.graphql.org/draft/#sec-Errors\nexport interface DataConnectOperationFailureResponseErrorInfo {\n // The error message.\n readonly message: string;\n\n // The path of the field in the response data to which this error relates.\n // String values in this array refer to field names. Numeric values in this\n // array always satisfy `Number.isInteger()` and refer to the index in an\n // array.\n readonly path: Array<string | number>;\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\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 */\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 { 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 { isCloudWorkstation } from '@firebase/util';\n\nimport {\n Code,\n DataConnectError,\n DataConnectOperationError,\n DataConnectOperationFailureResponse\n} from '../core/error';\nimport { SDK_VERSION } from '../core/version';\nimport { 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 _isUsingEmulator: 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, _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 const fetchOptions: RequestInit = {\n body: bodyStr,\n method: 'POST',\n headers,\n signal\n };\n if (isCloudWorkstation(url) && _isUsingEmulator) {\n fetchOptions.credentials = 'include';\n }\n\n return connectFetch(url, fetchOptions)\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 const response: DataConnectOperationFailureResponse = {\n errors: res.errors,\n data: res.data\n };\n throw new DataConnectOperationError(\n 'DataConnect error while performing request: ' + stringified,\n response\n );\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 { 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 { 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}/v1/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 { 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 private _isUsingEmulator = false;\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 this._isUsingEmulator = true;\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 this._isUsingEmulator\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 this._isUsingEmulator\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';\nimport {\n isCloudWorkstation,\n pingServer,\n updateEmulatorBanner\n} from '@firebase/util';\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 // Workaround to get cookies in Firebase Studio\n if (isCloudWorkstation(host)) {\n void pingServer(`https://${host}${port ? `:${port}` : ''}`);\n updateEmulatorBanner('Data Connect', true);\n }\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 esm, cjs, 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 * @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 { initializeFetch } from './network/fetch';\nimport { registerDataConnect } from './register';\n\nexport * from './api';\nexport * from './api.node';\ninitializeFetch(fetch);\n\nregisterDataConnect('node');\n"],"names":["SDK_VERSION"],"mappings":";;;;;AAAA;;;;;;;;;;;;;;;AAeG;AAeU,MAAA,IAAI,GAAG;AAClB,IAAA,KAAK,EAAE,OAA+B;AACtC,IAAA,mBAAmB,EAAE,qBAA6C;AAClE,IAAA,eAAe,EAAE,iBAAyC;AAC1D,IAAA,aAAa,EAAE,eAAuC;AACtD,IAAA,gBAAgB,EAAE,kBAA0C;AAC5D,IAAA,aAAa,EAAE,eAAuC;AACtD,IAAA,YAAY,EAAE,cAAsC;EACpD;AAEF;AACM,MAAO,gBAAiB,SAAQ,aAAa,CAAA;IAIjD,WAAY,CAAA,IAAU,EAAE,OAAe,EAAA;AACrC,QAAA,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;;QAHd,IAAI,CAAA,IAAA,GAAW,kBAAkB,CAAC;;;;QAQzC,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,gBAAgB,CAAC,SAAS,CAAC,CAAC;KACzD;;IAGD,QAAQ,GAAA;AACN,QAAA,OAAO,CAAG,EAAA,IAAI,CAAC,IAAI,CAAS,MAAA,EAAA,IAAI,CAAC,IAAI,CAAM,GAAA,EAAA,IAAI,CAAC,OAAO,EAAE,CAAC;KAC3D;AACF,CAAA;AAED;AACM,MAAO,yBAA0B,SAAQ,gBAAgB,CAAA;;IAQ7D,WAAY,CAAA,OAAe,EAAE,QAA6C,EAAA;AACxE,QAA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O,GAAG,CAAC,WAAW,CAAC,aAAa,CAAC,eAAe,CAClD,GAAG,EACH,QAAQ,EACR,OAAO,EACP,YAAY,CACb,CAAC;AACJ;;AC3GA;;;;;;;;;;;;;;;AAeG;AAOH,eAAe,CAAC,KAAK,CAAC,CAAC;AAEvB,mBAAmB,CAAC,MAAM,CAAC;;;;"} \ No newline at end of file
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/package.json b/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/package.json
new file mode 100644
index 0000000..7c34deb
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/package.json
@@ -0,0 +1 @@
+{"type":"module"} \ No newline at end of file
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/api.browser.d.ts b/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/api.browser.d.ts
new file mode 100644
index 0000000..ddfdad5
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/api.browser.d.ts
@@ -0,0 +1,34 @@
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { OnCompleteSubscription, OnErrorSubscription, OnResultSubscription, QueryRef, QueryUnsubscribe, SubscriptionOptions } from './api/query';
+import { SerializedRef } from './api/Reference';
+/**
+ * Subscribe to a `QueryRef`
+ * @param queryRefOrSerializedResult query ref or serialized result.
+ * @param observer observer object to use for subscribing.
+ * @returns `SubscriptionOptions`
+ */
+export declare function subscribe<Data, Variables>(queryRefOrSerializedResult: QueryRef<Data, Variables> | SerializedRef<Data, Variables>, observer: SubscriptionOptions<Data, Variables>): QueryUnsubscribe;
+/**
+ * Subscribe to a `QueryRef`
+ * @param queryRefOrSerializedResult query ref or serialized result.
+ * @param onNext Callback to call when result comes back.
+ * @param onError Callback to call when error gets thrown.
+ * @param onComplete Called when subscription completes.
+ * @returns `SubscriptionOptions`
+ */
+export declare function subscribe<Data, Variables>(queryRefOrSerializedResult: QueryRef<Data, Variables> | SerializedRef<Data, Variables>, onNext: OnResultSubscription<Data, Variables>, onError?: OnErrorSubscription, onComplete?: OnCompleteSubscription): QueryUnsubscribe;
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/api.node.d.ts b/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/api.node.d.ts
new file mode 100644
index 0000000..4bd8016
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/api.node.d.ts
@@ -0,0 +1,17 @@
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+export { subscribe } from './api.browser';
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/api/DataConnect.d.ts b/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/api/DataConnect.d.ts
new file mode 100644
index 0000000..9b20a40
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/api/DataConnect.d.ts
@@ -0,0 +1,118 @@
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { FirebaseApp } from '@firebase/app';
+import { AppCheckInternalComponentName } from '@firebase/app-check-interop-types';
+import { FirebaseAuthInternalName } from '@firebase/auth-interop-types';
+import { Provider } from '@firebase/component';
+import { QueryManager } from '../core/QueryManager';
+import { CallerSdkType } from '../network';
+import { MutationManager } from './Mutation';
+/**
+ * Connector Config for calling Data Connect backend.
+ */
+export interface ConnectorConfig {
+ location: string;
+ connector: string;
+ service: string;
+}
+/**
+ * Options to connect to emulator
+ */
+export interface TransportOptions {
+ host: string;
+ sslEnabled?: boolean;
+ port?: number;
+}
+/**
+ *
+ * @param fullHost
+ * @returns TransportOptions
+ * @internal
+ */
+export declare function parseOptions(fullHost: string): TransportOptions;
+/**
+ * DataConnectOptions including project id
+ */
+export interface DataConnectOptions extends ConnectorConfig {
+ projectId: string;
+}
+/**
+ * Class representing Firebase Data Connect
+ */
+export declare class DataConnect {
+ readonly app: FirebaseApp;
+ private readonly dataConnectOptions;
+ private readonly _authProvider;
+ private readonly _appCheckProvider;
+ _queryManager: QueryManager;
+ _mutationManager: MutationManager;
+ isEmulator: boolean;
+ _initialized: boolean;
+ private _transport;
+ private _transportClass;
+ private _transportOptions?;
+ private _authTokenProvider?;
+ _isUsingGeneratedSdk: boolean;
+ _callerSdkType: CallerSdkType;
+ private _appCheckTokenProvider?;
+ constructor(app: FirebaseApp, dataConnectOptions: DataConnectOptions, _authProvider: Provider<FirebaseAuthInternalName>, _appCheckProvider: Provider<AppCheckInternalComponentName>);
+ _useGeneratedSdk(): void;
+ _setCallerSdkType(callerSdkType: CallerSdkType): void;
+ _delete(): Promise<void>;
+ getSettings(): ConnectorConfig;
+ setInitialized(): void;
+ enableEmulator(transportOptions: TransportOptions): void;
+}
+/**
+ * @internal
+ * @param transportOptions1
+ * @param transportOptions2
+ * @returns
+ */
+export declare function areTransportOptionsEqual(transportOptions1: TransportOptions, transportOptions2: TransportOptions): boolean;
+/**
+ * Connect to the DataConnect Emulator
+ * @param dc Data Connect instance
+ * @param host host of emulator server
+ * @param port port of emulator server
+ * @param sslEnabled use https
+ */
+export declare function connectDataConnectEmulator(dc: DataConnect, host: string, port?: number, sslEnabled?: boolean): void;
+/**
+ * Initialize DataConnect instance
+ * @param options ConnectorConfig
+ */
+export declare function getDataConnect(options: ConnectorConfig): DataConnect;
+/**
+ * Initialize DataConnect instance
+ * @param app FirebaseApp to initialize to.
+ * @param options ConnectorConfig
+ */
+export declare function getDataConnect(app: FirebaseApp, options: ConnectorConfig): DataConnect;
+/**
+ *
+ * @param dcOptions
+ * @returns {void}
+ * @internal
+ */
+export declare function validateDCOptions(dcOptions: ConnectorConfig): boolean;
+/**
+ * Delete DataConnect instance
+ * @param dataConnect DataConnect instance
+ * @returns
+ */
+export declare function terminate(dataConnect: DataConnect): Promise<void>;
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/api/Mutation.d.ts b/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/api/Mutation.d.ts
new file mode 100644
index 0000000..5a9ddc3
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/api/Mutation.d.ts
@@ -0,0 +1,61 @@
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { DataConnectTransport } from '../network/transport';
+import { DataConnect } from './DataConnect';
+import { DataConnectResult, MUTATION_STR, OperationRef } from './Reference';
+export interface MutationRef<Data, Variables> extends OperationRef<Data, Variables> {
+ refType: typeof MUTATION_STR;
+}
+/**
+ * Creates a `MutationRef`
+ * @param dcInstance Data Connect instance
+ * @param mutationName name of mutation
+ */
+export declare function mutationRef<Data>(dcInstance: DataConnect, mutationName: string): MutationRef<Data, undefined>;
+/**
+ *
+ * @param dcInstance Data Connect instance
+ * @param mutationName name of mutation
+ * @param variables variables to send with mutation
+ */
+export declare function mutationRef<Data, Variables>(dcInstance: DataConnect, mutationName: string, variables: Variables): MutationRef<Data, Variables>;
+/**
+ * @internal
+ */
+export declare class MutationManager {
+ private _transport;
+ private _inflight;
+ constructor(_transport: DataConnectTransport);
+ executeMutation<Data, Variables>(mutationRef: MutationRef<Data, Variables>): MutationPromise<Data, Variables>;
+}
+/**
+ * Mutation Result from `executeMutation`
+ */
+export interface MutationResult<Data, Variables> extends DataConnectResult<Data, Variables> {
+ ref: MutationRef<Data, Variables>;
+}
+/**
+ * Mutation return value from `executeMutation`
+ */
+export interface MutationPromise<Data, Variables> extends Promise<MutationResult<Data, Variables>> {
+}
+/**
+ * Execute Mutation
+ * @param mutationRef mutation to execute
+ * @returns `MutationRef`
+ */
+export declare function executeMutation<Data, Variables>(mutationRef: MutationRef<Data, Variables>): MutationPromise<Data, Variables>;
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/api/Reference.d.ts b/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/api/Reference.d.ts
new file mode 100644
index 0000000..67549ef
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/api/Reference.d.ts
@@ -0,0 +1,51 @@
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { DataConnect, DataConnectOptions } from './DataConnect';
+export declare const QUERY_STR = "query";
+export declare const MUTATION_STR = "mutation";
+export type ReferenceType = typeof QUERY_STR | typeof MUTATION_STR;
+export declare const SOURCE_SERVER = "SERVER";
+export declare const SOURCE_CACHE = "CACHE";
+export type DataSource = typeof SOURCE_CACHE | typeof SOURCE_SERVER;
+export interface OpResult<Data> {
+ data: Data;
+ source: DataSource;
+ fetchTime: string;
+}
+export interface OperationRef<_Data, Variables> {
+ name: string;
+ variables: Variables;
+ refType: ReferenceType;
+ dataConnect: DataConnect;
+}
+export interface DataConnectResult<Data, Variables> extends OpResult<Data> {
+ ref: OperationRef<Data, Variables>;
+}
+/**
+ * Serialized RefInfo as a result of `QueryResult.toJSON().refInfo`
+ */
+export interface RefInfo<Variables> {
+ name: string;
+ variables: Variables;
+ connectorConfig: DataConnectOptions;
+}
+/**
+ * Serialized Ref as a result of `QueryResult.toJSON()`
+ */
+export interface SerializedRef<Data, Variables> extends OpResult<Data> {
+ refInfo: RefInfo<Variables>;
+}
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/api/index.d.ts b/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/api/index.d.ts
new file mode 100644
index 0000000..ceb0a89
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/api/index.d.ts
@@ -0,0 +1,24 @@
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+export * from '../network';
+export * from './DataConnect';
+export * from './Reference';
+export * from './Mutation';
+export * from './query';
+export { setLogLevel } from '../logger';
+export { validateArgs } from '../util/validateArgs';
+export { DataConnectErrorCode, Code, DataConnectError, DataConnectOperationError, DataConnectOperationFailureResponse, DataConnectOperationFailureResponseErrorInfo } from '../core/error';
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/api/query.d.ts b/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/api/query.d.ts
new file mode 100644
index 0000000..93d3863
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/api/query.d.ts
@@ -0,0 +1,96 @@
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { DataConnectError } from '../core/error';
+import { DataConnect } from './DataConnect';
+import { OperationRef, QUERY_STR, DataConnectResult, SerializedRef } from './Reference';
+/**
+ * Signature for `OnResultSubscription` for `subscribe`
+ */
+export type OnResultSubscription<Data, Variables> = (res: QueryResult<Data, Variables>) => void;
+/**
+ * Signature for `OnErrorSubscription` for `subscribe`
+ */
+export type OnErrorSubscription = (err?: DataConnectError) => void;
+/**
+ * Signature for unsubscribe from `subscribe`
+ */
+export type QueryUnsubscribe = () => void;
+/**
+ * Representation of user provided subscription options.
+ */
+export interface DataConnectSubscription<Data, Variables> {
+ userCallback: OnResultSubscription<Data, Variables>;
+ errCallback?: (e?: DataConnectError) => void;
+ unsubscribe: () => void;
+}
+/**
+ * QueryRef object
+ */
+export interface QueryRef<Data, Variables> extends OperationRef<Data, Variables> {
+ refType: typeof QUERY_STR;
+}
+/**
+ * Result of `executeQuery`
+ */
+export interface QueryResult<Data, Variables> extends DataConnectResult<Data, Variables> {
+ ref: QueryRef<Data, Variables>;
+ toJSON: () => SerializedRef<Data, Variables>;
+}
+/**
+ * Promise returned from `executeQuery`
+ */
+export interface QueryPromise<Data, Variables> extends Promise<QueryResult<Data, Variables>> {
+}
+/**
+ * Execute Query
+ * @param queryRef query to execute.
+ * @returns `QueryPromise`
+ */
+export declare function executeQuery<Data, Variables>(queryRef: QueryRef<Data, Variables>): QueryPromise<Data, Variables>;
+/**
+ * Execute Query
+ * @param dcInstance Data Connect instance to use.
+ * @param queryName Query to execute
+ * @returns `QueryRef`
+ */
+export declare function queryRef<Data>(dcInstance: DataConnect, queryName: string): QueryRef<Data, undefined>;
+/**
+ * Execute Query
+ * @param dcInstance Data Connect instance to use.
+ * @param queryName Query to execute
+ * @param variables Variables to execute with
+ * @returns `QueryRef`
+ */
+export declare function queryRef<Data, Variables>(dcInstance: DataConnect, queryName: string, variables: Variables): QueryRef<Data, Variables>;
+/**
+ * Converts serialized ref to query ref
+ * @param serializedRef ref to convert to `QueryRef`
+ * @returns `QueryRef`
+ */
+export declare function toQueryRef<Data, Variables>(serializedRef: SerializedRef<Data, Variables>): QueryRef<Data, Variables>;
+/**
+ * `OnCompleteSubscription`
+ */
+export type OnCompleteSubscription = () => void;
+/**
+ * Representation of full observer options in `subscribe`
+ */
+export interface SubscriptionOptions<Data, Variables> {
+ onNext?: OnResultSubscription<Data, Variables>;
+ onErr?: OnErrorSubscription;
+ onComplete?: OnCompleteSubscription;
+}
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/core/AppCheckTokenProvider.d.ts b/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/core/AppCheckTokenProvider.d.ts
new file mode 100644
index 0000000..aa6110c
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/core/AppCheckTokenProvider.d.ts
@@ -0,0 +1,31 @@
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { FirebaseApp } from '@firebase/app';
+import { AppCheckInternalComponentName, AppCheckTokenListener, AppCheckTokenResult } from '@firebase/app-check-interop-types';
+import { Provider } from '@firebase/component';
+/**
+ * @internal
+ * Abstraction around AppCheck's token fetching capabilities.
+ */
+export declare class AppCheckTokenProvider {
+ private appCheckProvider?;
+ private appCheck?;
+ private serverAppAppCheckToken?;
+ constructor(app: FirebaseApp, appCheckProvider?: Provider<AppCheckInternalComponentName>);
+ getToken(): Promise<AppCheckTokenResult>;
+ addTokenChangeListener(listener: AppCheckTokenListener): void;
+}
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/core/FirebaseAuthProvider.d.ts b/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/core/FirebaseAuthProvider.d.ts
new file mode 100644
index 0000000..8e05fc2
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/core/FirebaseAuthProvider.d.ts
@@ -0,0 +1,34 @@
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { FirebaseOptions } from '@firebase/app-types';
+import { FirebaseAuthInternalName, FirebaseAuthTokenData } from '@firebase/auth-interop-types';
+import { Provider } from '@firebase/component';
+export interface AuthTokenProvider {
+ getToken(forceRefresh: boolean): Promise<FirebaseAuthTokenData | null>;
+ addTokenChangeListener(listener: AuthTokenListener): void;
+}
+export type AuthTokenListener = (token: string | null) => void;
+export declare class FirebaseAuthProvider implements AuthTokenProvider {
+ private _appName;
+ private _options;
+ private _authProvider;
+ private _auth;
+ constructor(_appName: string, _options: FirebaseOptions, _authProvider: Provider<FirebaseAuthInternalName>);
+ getToken(forceRefresh: boolean): Promise<FirebaseAuthTokenData | null>;
+ addTokenChangeListener(listener: AuthTokenListener): void;
+ removeTokenChangeListener(listener: (token: string | null) => void): void;
+}
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/core/QueryManager.d.ts b/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/core/QueryManager.d.ts
new file mode 100644
index 0000000..95b7a33
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/core/QueryManager.d.ts
@@ -0,0 +1,36 @@
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { DataConnectSubscription, OnErrorSubscription, OnResultSubscription, QueryPromise, QueryRef } from '../api/query';
+import { OperationRef, OpResult } from '../api/Reference';
+import { DataConnectTransport } from '../network';
+import { DataConnectError } from './error';
+interface TrackedQuery<Data, Variables> {
+ ref: Omit<OperationRef<Data, Variables>, 'dataConnect'>;
+ subscriptions: Array<DataConnectSubscription<Data, Variables>>;
+ currentCache: OpResult<Data> | null;
+ lastError: DataConnectError | null;
+}
+export declare class QueryManager {
+ private transport;
+ _queries: Map<string, TrackedQuery<unknown, unknown>>;
+ constructor(transport: DataConnectTransport);
+ track<Data, Variables>(queryName: string, variables: Variables, initialCache?: OpResult<Data>): TrackedQuery<Data, Variables>;
+ addSubscription<Data, Variables>(queryRef: OperationRef<Data, Variables>, onResultCallback: OnResultSubscription<Data, Variables>, onErrorCallback?: OnErrorSubscription, initialCache?: OpResult<Data>): () => void;
+ executeQuery<Data, Variables>(queryRef: QueryRef<Data, Variables>): QueryPromise<Data, Variables>;
+ enableEmulator(host: string, port: number): void;
+}
+export {};
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/core/error.d.ts b/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/core/error.d.ts
new file mode 100644
index 0000000..3609a0b
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/core/error.d.ts
@@ -0,0 +1,53 @@
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { FirebaseError } from '@firebase/util';
+export type DataConnectErrorCode = 'other' | 'already-initialized' | 'not-initialized' | 'not-supported' | 'invalid-argument' | 'partial-error' | 'unauthorized';
+export type Code = DataConnectErrorCode;
+export declare const Code: {
+ OTHER: DataConnectErrorCode;
+ ALREADY_INITIALIZED: DataConnectErrorCode;
+ NOT_INITIALIZED: DataConnectErrorCode;
+ NOT_SUPPORTED: DataConnectErrorCode;
+ INVALID_ARGUMENT: DataConnectErrorCode;
+ PARTIAL_ERROR: DataConnectErrorCode;
+ UNAUTHORIZED: DataConnectErrorCode;
+};
+/** An error returned by a DataConnect operation. */
+export declare class DataConnectError extends FirebaseError {
+ /** @internal */
+ readonly name: string;
+ constructor(code: Code, message: string);
+ /** @internal */
+ toString(): string;
+}
+/** An error returned by a DataConnect operation. */
+export declare class DataConnectOperationError extends DataConnectError {
+ /** @internal */
+ readonly name: string;
+ /** The response received from the backend. */
+ readonly response: DataConnectOperationFailureResponse;
+ /** @hideconstructor */
+ constructor(message: string, response: DataConnectOperationFailureResponse);
+}
+export interface DataConnectOperationFailureResponse {
+ readonly data?: Record<string, unknown> | null;
+ readonly errors: DataConnectOperationFailureResponseErrorInfo[];
+}
+export interface DataConnectOperationFailureResponseErrorInfo {
+ readonly message: string;
+ readonly path: Array<string | number>;
+}
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/core/version.d.ts b/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/core/version.d.ts
new file mode 100644
index 0000000..76d8740
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/core/version.d.ts
@@ -0,0 +1,23 @@
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/** The semver (www.semver.org) version of the SDK. */
+export declare let SDK_VERSION: string;
+/**
+ * SDK_VERSION should be set before any database instance is created
+ * @internal
+ */
+export declare function setSDKVersion(version: string): void;
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/index.d.ts b/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/index.d.ts
new file mode 100644
index 0000000..0aa918c
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/index.d.ts
@@ -0,0 +1,29 @@
+/**
+ * Firebase Data Connect
+ *
+ * @packageDocumentation
+ */
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { DataConnect } from './api/DataConnect';
+export * from './api';
+export * from './api.browser';
+declare module '@firebase/component' {
+ interface NameServiceMapping {
+ 'data-connect': DataConnect;
+ }
+}
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/index.node.d.ts b/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/index.node.d.ts
new file mode 100644
index 0000000..f5f70a7
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/index.node.d.ts
@@ -0,0 +1,18 @@
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+export * from './api';
+export * from './api.node';
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/logger.d.ts b/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/logger.d.ts
new file mode 100644
index 0000000..3cc3fe0
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/logger.d.ts
@@ -0,0 +1,20 @@
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { LogLevelString } from '@firebase/logger';
+export declare function setLogLevel(logLevel: LogLevelString): void;
+export declare function logDebug(msg: string): void;
+export declare function logError(msg: string): void;
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/network/fetch.d.ts b/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/network/fetch.d.ts
new file mode 100644
index 0000000..80d65c2
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/network/fetch.d.ts
@@ -0,0 +1,27 @@
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { CallerSdkType } from './transport';
+export declare function initializeFetch(fetchImpl: typeof fetch): void;
+export interface DataConnectFetchBody<T> {
+ name: string;
+ operationName: string;
+ variables: T;
+}
+export declare function dcFetch<T, U>(url: string, body: DataConnectFetchBody<U>, { signal }: AbortController, appId: string | null, accessToken: string | null, appCheckToken: string | null, _isUsingGen: boolean, _callerSdkType: CallerSdkType, _isUsingEmulator: boolean): Promise<{
+ data: T;
+ errors: Error[];
+}>;
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/network/index.d.ts b/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/network/index.d.ts
new file mode 100644
index 0000000..e3afb7c
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/network/index.d.ts
@@ -0,0 +1,17 @@
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+export * from './transport';
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/network/transport/index.d.ts b/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/network/transport/index.d.ts
new file mode 100644
index 0000000..e1823db
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/network/transport/index.d.ts
@@ -0,0 +1,52 @@
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { DataConnectOptions, TransportOptions } from '../../api/DataConnect';
+import { AppCheckTokenProvider } from '../../core/AppCheckTokenProvider';
+import { AuthTokenProvider } from '../../core/FirebaseAuthProvider';
+/**
+ * enum representing different flavors of the SDK used by developers
+ * use the CallerSdkType for type-checking, and the CallerSdkTypeEnum for value-checking/assigning
+ */
+export type CallerSdkType = 'Base' | 'Generated' | 'TanstackReactCore' | 'GeneratedReact' | 'TanstackAngularCore' | 'GeneratedAngular';
+export declare const CallerSdkTypeEnum: {
+ readonly Base: "Base";
+ readonly Generated: "Generated";
+ readonly TanstackReactCore: "TanstackReactCore";
+ readonly GeneratedReact: "GeneratedReact";
+ readonly TanstackAngularCore: "TanstackAngularCore";
+ readonly GeneratedAngular: "GeneratedAngular";
+};
+/**
+ * @internal
+ */
+export interface DataConnectTransport {
+ invokeQuery<T, U>(queryName: string, body?: U): Promise<{
+ data: T;
+ errors: Error[];
+ }>;
+ invokeMutation<T, U>(queryName: string, body?: U): Promise<{
+ data: T;
+ errors: Error[];
+ }>;
+ useEmulator(host: string, port?: number, sslEnabled?: boolean): void;
+ onTokenChanged: (token: string | null) => void;
+ _setCallerSdkType(callerSdkType: CallerSdkType): void;
+}
+/**
+ * @internal
+ */
+export type TransportClass = new (options: DataConnectOptions, apiKey?: string, appId?: string, authProvider?: AuthTokenProvider, appCheckProvider?: AppCheckTokenProvider, transportOptions?: TransportOptions, _isUsingGen?: boolean, _callerSdkType?: CallerSdkType) => DataConnectTransport;
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/network/transport/rest.d.ts b/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/network/transport/rest.d.ts
new file mode 100644
index 0000000..64a8922
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/network/transport/rest.d.ts
@@ -0,0 +1,61 @@
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { DataConnectOptions, TransportOptions } from '../../api/DataConnect';
+import { AppCheckTokenProvider } from '../../core/AppCheckTokenProvider';
+import { AuthTokenProvider } from '../../core/FirebaseAuthProvider';
+import { CallerSdkType, DataConnectTransport } from '.';
+export declare class RESTTransport implements DataConnectTransport {
+ private apiKey?;
+ private appId?;
+ private authProvider?;
+ private appCheckProvider?;
+ private _isUsingGen;
+ private _callerSdkType;
+ private _host;
+ private _port;
+ private _location;
+ private _connectorName;
+ private _secure;
+ private _project;
+ private _serviceName;
+ private _accessToken;
+ private _appCheckToken;
+ private _lastToken;
+ private _isUsingEmulator;
+ constructor(options: DataConnectOptions, apiKey?: string | undefined, appId?: string, authProvider?: AuthTokenProvider | undefined, appCheckProvider?: AppCheckTokenProvider | undefined, transportOptions?: TransportOptions | undefined, _isUsingGen?: boolean, _callerSdkType?: CallerSdkType);
+ get endpointUrl(): string;
+ useEmulator(host: string, port?: number, isSecure?: boolean): void;
+ onTokenChanged(newToken: string | null): void;
+ getWithAuth(forceToken?: boolean): Promise<string>;
+ _setLastToken(lastToken: string | null): void;
+ withRetry<T>(promiseFactory: () => Promise<{
+ data: T;
+ errors: Error[];
+ }>, retry?: boolean): Promise<{
+ data: T;
+ errors: Error[];
+ }>;
+ invokeQuery: <T, U>(queryName: string, body?: U) => Promise<{
+ data: T;
+ errors: Error[];
+ }>;
+ invokeMutation: <T, U>(queryName: string, body?: U) => Promise<{
+ data: T;
+ errors: Error[];
+ }>;
+ _setCallerSdkType(callerSdkType: CallerSdkType): void;
+}
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/register.d.ts b/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/register.d.ts
new file mode 100644
index 0000000..3d26abe
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/register.d.ts
@@ -0,0 +1 @@
+export declare function registerDataConnect(variant?: string): void;
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/util/encoder.d.ts b/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/util/encoder.d.ts
new file mode 100644
index 0000000..96b56a3
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/util/encoder.d.ts
@@ -0,0 +1,19 @@
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+export type HmacImpl = (obj: unknown) => string;
+export declare let encoderImpl: HmacImpl;
+export declare function setEncoder(encoder: HmacImpl): void;
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/util/map.d.ts b/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/util/map.d.ts
new file mode 100644
index 0000000..650f671
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/util/map.d.ts
@@ -0,0 +1,17 @@
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+export declare function setIfNotExists<T>(map: Map<string, T>, key: string, val: T): void;
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/util/url.d.ts b/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/util/url.d.ts
new file mode 100644
index 0000000..4491e93
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/util/url.d.ts
@@ -0,0 +1,19 @@
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { DataConnectOptions, TransportOptions } from '../api/DataConnect';
+export declare function urlBuilder(projectConfig: DataConnectOptions, transportOptions: TransportOptions): string;
+export declare function addToken(url: string, apiKey?: string): string;
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/util/validateArgs.d.ts b/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/util/validateArgs.d.ts
new file mode 100644
index 0000000..5c31cdc
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/node-esm/src/util/validateArgs.d.ts
@@ -0,0 +1,33 @@
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { ConnectorConfig, DataConnect } from '../api/DataConnect';
+interface ParsedArgs<Variables> {
+ dc: DataConnect;
+ vars: Variables;
+}
+/**
+ * The generated SDK will allow the user to pass in either the variable or the data connect instance with the variable,
+ * and this function validates the variables and returns back the DataConnect instance and variables based on the arguments passed in.
+ * @param connectorConfig
+ * @param dcOrVars
+ * @param vars
+ * @param validateVars
+ * @returns {DataConnect} and {Variables} instance
+ * @internal
+ */
+export declare function validateArgs<Variables extends object>(connectorConfig: ConnectorConfig, dcOrVars?: DataConnect | Variables, vars?: Variables, validateVars?: boolean): ParsedArgs<Variables>;
+export {};
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/private.d.ts b/frontend-old/node_modules/@firebase/data-connect/dist/private.d.ts
new file mode 100644
index 0000000..bae046c
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/private.d.ts
@@ -0,0 +1,393 @@
+/**
+ * Firebase Data Connect
+ *
+ * @packageDocumentation
+ */
+
+import { AppCheckInternalComponentName } from '@firebase/app-check-interop-types';
+import { AppCheckTokenListener } from '@firebase/app-check-interop-types';
+import { AppCheckTokenResult } from '@firebase/app-check-interop-types';
+import { FirebaseApp } from '@firebase/app';
+import { FirebaseAuthInternalName } from '@firebase/auth-interop-types';
+import { FirebaseAuthTokenData } from '@firebase/auth-interop-types';
+import { FirebaseError } from '@firebase/util';
+import { LogLevelString } from '@firebase/logger';
+import { Provider } from '@firebase/component';
+
+/* Excluded from this release type: AppCheckTokenProvider */
+
+/* Excluded from this release type: areTransportOptionsEqual */
+
+declare type AuthTokenListener = (token: string | null) => void;
+
+declare interface AuthTokenProvider {
+ getToken(forceRefresh: boolean): Promise<FirebaseAuthTokenData | null>;
+ addTokenChangeListener(listener: AuthTokenListener): void;
+}
+
+/**
+ * enum representing different flavors of the SDK used by developers
+ * use the CallerSdkType for type-checking, and the CallerSdkTypeEnum for value-checking/assigning
+ */
+export declare type CallerSdkType = 'Base' | 'Generated' | 'TanstackReactCore' | 'GeneratedReact' | 'TanstackAngularCore' | 'GeneratedAngular';
+
+export declare const CallerSdkTypeEnum: {
+ readonly Base: "Base";
+ readonly Generated: "Generated";
+ readonly TanstackReactCore: "TanstackReactCore";
+ readonly GeneratedReact: "GeneratedReact";
+ readonly TanstackAngularCore: "TanstackAngularCore";
+ readonly GeneratedAngular: "GeneratedAngular";
+};
+
+export declare type Code = DataConnectErrorCode;
+
+export declare const Code: {
+ OTHER: DataConnectErrorCode;
+ ALREADY_INITIALIZED: DataConnectErrorCode;
+ NOT_INITIALIZED: DataConnectErrorCode;
+ NOT_SUPPORTED: DataConnectErrorCode;
+ INVALID_ARGUMENT: DataConnectErrorCode;
+ PARTIAL_ERROR: DataConnectErrorCode;
+ UNAUTHORIZED: DataConnectErrorCode;
+};
+
+/**
+ * Connect to the DataConnect Emulator
+ * @param dc Data Connect instance
+ * @param host host of emulator server
+ * @param port port of emulator server
+ * @param sslEnabled use https
+ */
+export declare function connectDataConnectEmulator(dc: DataConnect, host: string, port?: number, sslEnabled?: boolean): void;
+
+/**
+ * Connector Config for calling Data Connect backend.
+ */
+export declare interface ConnectorConfig {
+ location: string;
+ connector: string;
+ service: string;
+}
+
+/**
+ * Class representing Firebase Data Connect
+ */
+export declare class DataConnect {
+ readonly app: FirebaseApp;
+ private readonly dataConnectOptions;
+ private readonly _authProvider;
+ private readonly _appCheckProvider;
+ _queryManager: QueryManager;
+ _mutationManager: MutationManager;
+ isEmulator: boolean;
+ _initialized: boolean;
+ private _transport;
+ private _transportClass;
+ private _transportOptions?;
+ private _authTokenProvider?;
+ _isUsingGeneratedSdk: boolean;
+ _callerSdkType: CallerSdkType;
+ private _appCheckTokenProvider?;
+ constructor(app: FirebaseApp, dataConnectOptions: DataConnectOptions, _authProvider: Provider<FirebaseAuthInternalName>, _appCheckProvider: Provider<AppCheckInternalComponentName>);
+ _useGeneratedSdk(): void;
+ _setCallerSdkType(callerSdkType: CallerSdkType): void;
+ _delete(): Promise<void>;
+ getSettings(): ConnectorConfig;
+ setInitialized(): void;
+ enableEmulator(transportOptions: TransportOptions): void;
+}
+
+/** An error returned by a DataConnect operation. */
+export declare class DataConnectError extends FirebaseError {
+ /* Excluded from this release type: name */
+ constructor(code: Code, message: string);
+ /* Excluded from this release type: toString */
+}
+
+export declare type DataConnectErrorCode = 'other' | 'already-initialized' | 'not-initialized' | 'not-supported' | 'invalid-argument' | 'partial-error' | 'unauthorized';
+
+/** An error returned by a DataConnect operation. */
+export declare class DataConnectOperationError extends DataConnectError {
+ /* Excluded from this release type: name */
+ /** The response received from the backend. */
+ readonly response: DataConnectOperationFailureResponse;
+ /** @hideconstructor */
+ constructor(message: string, response: DataConnectOperationFailureResponse);
+}
+
+export declare interface DataConnectOperationFailureResponse {
+ readonly data?: Record<string, unknown> | null;
+ readonly errors: DataConnectOperationFailureResponseErrorInfo[];
+}
+
+export declare interface DataConnectOperationFailureResponseErrorInfo {
+ readonly message: string;
+ readonly path: Array<string | number>;
+}
+
+/**
+ * DataConnectOptions including project id
+ */
+export declare interface DataConnectOptions extends ConnectorConfig {
+ projectId: string;
+}
+
+export declare interface DataConnectResult<Data, Variables> extends OpResult<Data> {
+ ref: OperationRef<Data, Variables>;
+}
+
+/**
+ * Representation of user provided subscription options.
+ */
+export declare interface DataConnectSubscription<Data, Variables> {
+ userCallback: OnResultSubscription<Data, Variables>;
+ errCallback?: (e?: DataConnectError) => void;
+ unsubscribe: () => void;
+}
+
+/* Excluded from this release type: DataConnectTransport */
+
+export declare type DataSource = typeof SOURCE_CACHE | typeof SOURCE_SERVER;
+
+/**
+ * Execute Mutation
+ * @param mutationRef mutation to execute
+ * @returns `MutationRef`
+ */
+export declare function executeMutation<Data, Variables>(mutationRef: MutationRef<Data, Variables>): MutationPromise<Data, Variables>;
+
+/**
+ * Execute Query
+ * @param queryRef query to execute.
+ * @returns `QueryPromise`
+ */
+export declare function executeQuery<Data, Variables>(queryRef: QueryRef<Data, Variables>): QueryPromise<Data, Variables>;
+
+/**
+ * Initialize DataConnect instance
+ * @param options ConnectorConfig
+ */
+export declare function getDataConnect(options: ConnectorConfig): DataConnect;
+
+/**
+ * Initialize DataConnect instance
+ * @param app FirebaseApp to initialize to.
+ * @param options ConnectorConfig
+ */
+export declare function getDataConnect(app: FirebaseApp, options: ConnectorConfig): DataConnect;
+
+export declare const MUTATION_STR = "mutation";
+
+/* Excluded from this release type: MutationManager */
+
+/**
+ * Mutation return value from `executeMutation`
+ */
+export declare interface MutationPromise<Data, Variables> extends Promise<MutationResult<Data, Variables>> {
+}
+
+export declare interface MutationRef<Data, Variables> extends OperationRef<Data, Variables> {
+ refType: typeof MUTATION_STR;
+}
+
+/**
+ * Creates a `MutationRef`
+ * @param dcInstance Data Connect instance
+ * @param mutationName name of mutation
+ */
+export declare function mutationRef<Data>(dcInstance: DataConnect, mutationName: string): MutationRef<Data, undefined>;
+
+/**
+ *
+ * @param dcInstance Data Connect instance
+ * @param mutationName name of mutation
+ * @param variables variables to send with mutation
+ */
+export declare function mutationRef<Data, Variables>(dcInstance: DataConnect, mutationName: string, variables: Variables): MutationRef<Data, Variables>;
+
+/**
+ * Mutation Result from `executeMutation`
+ */
+export declare interface MutationResult<Data, Variables> extends DataConnectResult<Data, Variables> {
+ ref: MutationRef<Data, Variables>;
+}
+
+/**
+ * `OnCompleteSubscription`
+ */
+export declare type OnCompleteSubscription = () => void;
+
+/**
+ * Signature for `OnErrorSubscription` for `subscribe`
+ */
+export declare type OnErrorSubscription = (err?: DataConnectError) => void;
+
+/**
+ * Signature for `OnResultSubscription` for `subscribe`
+ */
+export declare type OnResultSubscription<Data, Variables> = (res: QueryResult<Data, Variables>) => void;
+
+export declare interface OperationRef<_Data, Variables> {
+ name: string;
+ variables: Variables;
+ refType: ReferenceType;
+ dataConnect: DataConnect;
+}
+
+export declare interface OpResult<Data> {
+ data: Data;
+ source: DataSource;
+ fetchTime: string;
+}
+
+declare interface ParsedArgs<Variables> {
+ dc: DataConnect;
+ vars: Variables;
+}
+
+/* Excluded from this release type: parseOptions */
+
+export declare const QUERY_STR = "query";
+
+declare class QueryManager {
+ private transport;
+ _queries: Map<string, TrackedQuery<unknown, unknown>>;
+ constructor(transport: DataConnectTransport);
+ track<Data, Variables>(queryName: string, variables: Variables, initialCache?: OpResult<Data>): TrackedQuery<Data, Variables>;
+ addSubscription<Data, Variables>(queryRef: OperationRef<Data, Variables>, onResultCallback: OnResultSubscription<Data, Variables>, onErrorCallback?: OnErrorSubscription, initialCache?: OpResult<Data>): () => void;
+ executeQuery<Data, Variables>(queryRef: QueryRef<Data, Variables>): QueryPromise<Data, Variables>;
+ enableEmulator(host: string, port: number): void;
+}
+
+/**
+ * Promise returned from `executeQuery`
+ */
+export declare interface QueryPromise<Data, Variables> extends Promise<QueryResult<Data, Variables>> {
+}
+
+/**
+ * QueryRef object
+ */
+export declare interface QueryRef<Data, Variables> extends OperationRef<Data, Variables> {
+ refType: typeof QUERY_STR;
+}
+
+/**
+ * Execute Query
+ * @param dcInstance Data Connect instance to use.
+ * @param queryName Query to execute
+ * @returns `QueryRef`
+ */
+export declare function queryRef<Data>(dcInstance: DataConnect, queryName: string): QueryRef<Data, undefined>;
+
+/**
+ * Execute Query
+ * @param dcInstance Data Connect instance to use.
+ * @param queryName Query to execute
+ * @param variables Variables to execute with
+ * @returns `QueryRef`
+ */
+export declare function queryRef<Data, Variables>(dcInstance: DataConnect, queryName: string, variables: Variables): QueryRef<Data, Variables>;
+
+/**
+ * Result of `executeQuery`
+ */
+export declare interface QueryResult<Data, Variables> extends DataConnectResult<Data, Variables> {
+ ref: QueryRef<Data, Variables>;
+ toJSON: () => SerializedRef<Data, Variables>;
+}
+
+/**
+ * Signature for unsubscribe from `subscribe`
+ */
+export declare type QueryUnsubscribe = () => void;
+
+export declare type ReferenceType = typeof QUERY_STR | typeof MUTATION_STR;
+
+/**
+ * Serialized RefInfo as a result of `QueryResult.toJSON().refInfo`
+ */
+export declare interface RefInfo<Variables> {
+ name: string;
+ variables: Variables;
+ connectorConfig: DataConnectOptions;
+}
+
+/**
+ * Serialized Ref as a result of `QueryResult.toJSON()`
+ */
+export declare interface SerializedRef<Data, Variables> extends OpResult<Data> {
+ refInfo: RefInfo<Variables>;
+}
+
+export declare function setLogLevel(logLevel: LogLevelString): void;
+
+export declare const SOURCE_CACHE = "CACHE";
+
+export declare const SOURCE_SERVER = "SERVER";
+
+/**
+ * Subscribe to a `QueryRef`
+ * @param queryRefOrSerializedResult query ref or serialized result.
+ * @param observer observer object to use for subscribing.
+ * @returns `SubscriptionOptions`
+ */
+export declare function subscribe<Data, Variables>(queryRefOrSerializedResult: QueryRef<Data, Variables> | SerializedRef<Data, Variables>, observer: SubscriptionOptions<Data, Variables>): QueryUnsubscribe;
+
+/**
+ * Subscribe to a `QueryRef`
+ * @param queryRefOrSerializedResult query ref or serialized result.
+ * @param onNext Callback to call when result comes back.
+ * @param onError Callback to call when error gets thrown.
+ * @param onComplete Called when subscription completes.
+ * @returns `SubscriptionOptions`
+ */
+export declare function subscribe<Data, Variables>(queryRefOrSerializedResult: QueryRef<Data, Variables> | SerializedRef<Data, Variables>, onNext: OnResultSubscription<Data, Variables>, onError?: OnErrorSubscription, onComplete?: OnCompleteSubscription): QueryUnsubscribe;
+
+/**
+ * Representation of full observer options in `subscribe`
+ */
+export declare interface SubscriptionOptions<Data, Variables> {
+ onNext?: OnResultSubscription<Data, Variables>;
+ onErr?: OnErrorSubscription;
+ onComplete?: OnCompleteSubscription;
+}
+
+/**
+ * Delete DataConnect instance
+ * @param dataConnect DataConnect instance
+ * @returns
+ */
+export declare function terminate(dataConnect: DataConnect): Promise<void>;
+
+/**
+ * Converts serialized ref to query ref
+ * @param serializedRef ref to convert to `QueryRef`
+ * @returns `QueryRef`
+ */
+export declare function toQueryRef<Data, Variables>(serializedRef: SerializedRef<Data, Variables>): QueryRef<Data, Variables>;
+
+declare interface TrackedQuery<Data, Variables> {
+ ref: Omit<OperationRef<Data, Variables>, 'dataConnect'>;
+ subscriptions: Array<DataConnectSubscription<Data, Variables>>;
+ currentCache: OpResult<Data> | null;
+ lastError: DataConnectError | null;
+}
+
+/* Excluded from this release type: TransportClass */
+
+/**
+ * Options to connect to emulator
+ */
+export declare interface TransportOptions {
+ host: string;
+ sslEnabled?: boolean;
+ port?: number;
+}
+
+/* Excluded from this release type: validateArgs */
+
+/* Excluded from this release type: validateDCOptions */
+
+export { }
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/public.d.ts b/frontend-old/node_modules/@firebase/data-connect/dist/public.d.ts
new file mode 100644
index 0000000..f4dea7a
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/public.d.ts
@@ -0,0 +1,284 @@
+/**
+ * Firebase Data Connect
+ *
+ * @packageDocumentation
+ */
+import { FirebaseApp } from '@firebase/app';
+import { AppCheckInternalComponentName } from '@firebase/app-check-interop-types';
+import { FirebaseAuthInternalName } from '@firebase/auth-interop-types';
+import { Provider } from '@firebase/component';
+import { LogLevelString } from '@firebase/logger';
+import { FirebaseError } from '@firebase/util';
+
+
+/**
+ * enum representing different flavors of the SDK used by developers
+ * use the CallerSdkType for type-checking, and the CallerSdkTypeEnum for value-checking/assigning
+ */
+export declare type CallerSdkType = 'Base' | 'Generated' | 'TanstackReactCore' | 'GeneratedReact' | 'TanstackAngularCore' | 'GeneratedAngular';
+export declare const CallerSdkTypeEnum: {
+ readonly Base: "Base";
+ readonly Generated: "Generated";
+ readonly TanstackReactCore: "TanstackReactCore";
+ readonly GeneratedReact: "GeneratedReact";
+ readonly TanstackAngularCore: "TanstackAngularCore";
+ readonly GeneratedAngular: "GeneratedAngular";
+};
+export declare type Code = DataConnectErrorCode;
+export declare const Code: {
+ OTHER: DataConnectErrorCode;
+ ALREADY_INITIALIZED: DataConnectErrorCode;
+ NOT_INITIALIZED: DataConnectErrorCode;
+ NOT_SUPPORTED: DataConnectErrorCode;
+ INVALID_ARGUMENT: DataConnectErrorCode;
+ PARTIAL_ERROR: DataConnectErrorCode;
+ UNAUTHORIZED: DataConnectErrorCode;
+};
+/**
+ * Connect to the DataConnect Emulator
+ * @param dc Data Connect instance
+ * @param host host of emulator server
+ * @param port port of emulator server
+ * @param sslEnabled use https
+ */
+export declare function connectDataConnectEmulator(dc: DataConnect, host: string, port?: number, sslEnabled?: boolean): void;
+/**
+ * Connector Config for calling Data Connect backend.
+ */
+export declare interface ConnectorConfig {
+ location: string;
+ connector: string;
+ service: string;
+}
+/**
+ * Class representing Firebase Data Connect
+ */
+export declare class DataConnect {
+ readonly app: FirebaseApp;
+ private readonly dataConnectOptions;
+ isEmulator: boolean;
+ constructor(app: FirebaseApp, dataConnectOptions: DataConnectOptions, _authProvider: Provider<FirebaseAuthInternalName>, _appCheckProvider: Provider<AppCheckInternalComponentName>);
+ getSettings(): ConnectorConfig;
+ setInitialized(): void;
+ enableEmulator(transportOptions: TransportOptions): void;
+}
+/** An error returned by a DataConnect operation. */
+export declare class DataConnectError extends FirebaseError {
+ /* Excluded from this release type: name */
+ constructor(code: Code, message: string);
+}
+export declare type DataConnectErrorCode = 'other' | 'already-initialized' | 'not-initialized' | 'not-supported' | 'invalid-argument' | 'partial-error' | 'unauthorized';
+/** An error returned by a DataConnect operation. */
+export declare class DataConnectOperationError extends DataConnectError {
+ /* Excluded from this release type: name */
+ /** The response received from the backend. */
+ readonly response: DataConnectOperationFailureResponse;
+ private constructor();
+}
+export declare interface DataConnectOperationFailureResponse {
+ readonly data?: Record<string, unknown> | null;
+ readonly errors: DataConnectOperationFailureResponseErrorInfo[];
+}
+export declare interface DataConnectOperationFailureResponseErrorInfo {
+ readonly message: string;
+ readonly path: Array<string | number>;
+}
+/**
+ * DataConnectOptions including project id
+ */
+export declare interface DataConnectOptions extends ConnectorConfig {
+ projectId: string;
+}
+export declare interface DataConnectResult<Data, Variables> extends OpResult<Data> {
+ ref: OperationRef<Data, Variables>;
+}
+/**
+ * Representation of user provided subscription options.
+ */
+export declare interface DataConnectSubscription<Data, Variables> {
+ userCallback: OnResultSubscription<Data, Variables>;
+ errCallback?: (e?: DataConnectError) => void;
+ unsubscribe: () => void;
+}
+/* Excluded from this release type: DataConnectTransport */
+export declare type DataSource = typeof SOURCE_CACHE | typeof SOURCE_SERVER;
+/**
+ * Execute Mutation
+ * @param mutationRef mutation to execute
+ * @returns `MutationRef`
+ */
+export declare function executeMutation<Data, Variables>(mutationRef: MutationRef<Data, Variables>): MutationPromise<Data, Variables>;
+/**
+ * Execute Query
+ * @param queryRef query to execute.
+ * @returns `QueryPromise`
+ */
+export declare function executeQuery<Data, Variables>(queryRef: QueryRef<Data, Variables>): QueryPromise<Data, Variables>;
+/**
+ * Initialize DataConnect instance
+ * @param options ConnectorConfig
+ */
+export declare function getDataConnect(options: ConnectorConfig): DataConnect;
+/**
+ * Initialize DataConnect instance
+ * @param app FirebaseApp to initialize to.
+ * @param options ConnectorConfig
+ */
+export declare function getDataConnect(app: FirebaseApp, options: ConnectorConfig): DataConnect;
+export declare const MUTATION_STR = "mutation";
+/* Excluded from this release type: MutationManager */
+/**
+ * Mutation return value from `executeMutation`
+ */
+export declare interface MutationPromise<Data, Variables> extends Promise<MutationResult<Data, Variables>> {
+}
+export declare interface MutationRef<Data, Variables> extends OperationRef<Data, Variables> {
+ refType: typeof MUTATION_STR;
+}
+/**
+ * Creates a `MutationRef`
+ * @param dcInstance Data Connect instance
+ * @param mutationName name of mutation
+ */
+export declare function mutationRef<Data>(dcInstance: DataConnect, mutationName: string): MutationRef<Data, undefined>;
+/**
+ *
+ * @param dcInstance Data Connect instance
+ * @param mutationName name of mutation
+ * @param variables variables to send with mutation
+ */
+export declare function mutationRef<Data, Variables>(dcInstance: DataConnect, mutationName: string, variables: Variables): MutationRef<Data, Variables>;
+/**
+ * Mutation Result from `executeMutation`
+ */
+export declare interface MutationResult<Data, Variables> extends DataConnectResult<Data, Variables> {
+ ref: MutationRef<Data, Variables>;
+}
+/**
+ * `OnCompleteSubscription`
+ */
+export declare type OnCompleteSubscription = () => void;
+/**
+ * Signature for `OnErrorSubscription` for `subscribe`
+ */
+export declare type OnErrorSubscription = (err?: DataConnectError) => void;
+/**
+ * Signature for `OnResultSubscription` for `subscribe`
+ */
+export declare type OnResultSubscription<Data, Variables> = (res: QueryResult<Data, Variables>) => void;
+export declare interface OperationRef<_Data, Variables> {
+ name: string;
+ variables: Variables;
+ refType: ReferenceType;
+ dataConnect: DataConnect;
+}
+export declare interface OpResult<Data> {
+ data: Data;
+ source: DataSource;
+ fetchTime: string;
+}
+/* Excluded from this release type: parseOptions */
+export declare const QUERY_STR = "query";
+/**
+ * Promise returned from `executeQuery`
+ */
+export declare interface QueryPromise<Data, Variables> extends Promise<QueryResult<Data, Variables>> {
+}
+/**
+ * QueryRef object
+ */
+export declare interface QueryRef<Data, Variables> extends OperationRef<Data, Variables> {
+ refType: typeof QUERY_STR;
+}
+/**
+ * Execute Query
+ * @param dcInstance Data Connect instance to use.
+ * @param queryName Query to execute
+ * @returns `QueryRef`
+ */
+export declare function queryRef<Data>(dcInstance: DataConnect, queryName: string): QueryRef<Data, undefined>;
+/**
+ * Execute Query
+ * @param dcInstance Data Connect instance to use.
+ * @param queryName Query to execute
+ * @param variables Variables to execute with
+ * @returns `QueryRef`
+ */
+export declare function queryRef<Data, Variables>(dcInstance: DataConnect, queryName: string, variables: Variables): QueryRef<Data, Variables>;
+/**
+ * Result of `executeQuery`
+ */
+export declare interface QueryResult<Data, Variables> extends DataConnectResult<Data, Variables> {
+ ref: QueryRef<Data, Variables>;
+ toJSON: () => SerializedRef<Data, Variables>;
+}
+/**
+ * Signature for unsubscribe from `subscribe`
+ */
+export declare type QueryUnsubscribe = () => void;
+export declare type ReferenceType = typeof QUERY_STR | typeof MUTATION_STR;
+/**
+ * Serialized RefInfo as a result of `QueryResult.toJSON().refInfo`
+ */
+export declare interface RefInfo<Variables> {
+ name: string;
+ variables: Variables;
+ connectorConfig: DataConnectOptions;
+}
+/**
+ * Serialized Ref as a result of `QueryResult.toJSON()`
+ */
+export declare interface SerializedRef<Data, Variables> extends OpResult<Data> {
+ refInfo: RefInfo<Variables>;
+}
+export declare function setLogLevel(logLevel: LogLevelString): void;
+export declare const SOURCE_CACHE = "CACHE";
+export declare const SOURCE_SERVER = "SERVER";
+/**
+ * Subscribe to a `QueryRef`
+ * @param queryRefOrSerializedResult query ref or serialized result.
+ * @param observer observer object to use for subscribing.
+ * @returns `SubscriptionOptions`
+ */
+export declare function subscribe<Data, Variables>(queryRefOrSerializedResult: QueryRef<Data, Variables> | SerializedRef<Data, Variables>, observer: SubscriptionOptions<Data, Variables>): QueryUnsubscribe;
+/**
+ * Subscribe to a `QueryRef`
+ * @param queryRefOrSerializedResult query ref or serialized result.
+ * @param onNext Callback to call when result comes back.
+ * @param onError Callback to call when error gets thrown.
+ * @param onComplete Called when subscription completes.
+ * @returns `SubscriptionOptions`
+ */
+export declare function subscribe<Data, Variables>(queryRefOrSerializedResult: QueryRef<Data, Variables> | SerializedRef<Data, Variables>, onNext: OnResultSubscription<Data, Variables>, onError?: OnErrorSubscription, onComplete?: OnCompleteSubscription): QueryUnsubscribe;
+/**
+ * Representation of full observer options in `subscribe`
+ */
+export declare interface SubscriptionOptions<Data, Variables> {
+ onNext?: OnResultSubscription<Data, Variables>;
+ onErr?: OnErrorSubscription;
+ onComplete?: OnCompleteSubscription;
+}
+/**
+ * Delete DataConnect instance
+ * @param dataConnect DataConnect instance
+ * @returns
+ */
+export declare function terminate(dataConnect: DataConnect): Promise<void>;
+/**
+ * Converts serialized ref to query ref
+ * @param serializedRef ref to convert to `QueryRef`
+ * @returns `QueryRef`
+ */
+export declare function toQueryRef<Data, Variables>(serializedRef: SerializedRef<Data, Variables>): QueryRef<Data, Variables>;
+/* Excluded from this release type: TransportClass */
+/**
+ * Options to connect to emulator
+ */
+export declare interface TransportOptions {
+ host: string;
+ sslEnabled?: boolean;
+ port?: number;
+}
+/* Excluded from this release type: validateArgs */
+/* Excluded from this release type: validateDCOptions */
+export {};
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/src/api.browser.d.ts b/frontend-old/node_modules/@firebase/data-connect/dist/src/api.browser.d.ts
new file mode 100644
index 0000000..ddfdad5
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/src/api.browser.d.ts
@@ -0,0 +1,34 @@
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { OnCompleteSubscription, OnErrorSubscription, OnResultSubscription, QueryRef, QueryUnsubscribe, SubscriptionOptions } from './api/query';
+import { SerializedRef } from './api/Reference';
+/**
+ * Subscribe to a `QueryRef`
+ * @param queryRefOrSerializedResult query ref or serialized result.
+ * @param observer observer object to use for subscribing.
+ * @returns `SubscriptionOptions`
+ */
+export declare function subscribe<Data, Variables>(queryRefOrSerializedResult: QueryRef<Data, Variables> | SerializedRef<Data, Variables>, observer: SubscriptionOptions<Data, Variables>): QueryUnsubscribe;
+/**
+ * Subscribe to a `QueryRef`
+ * @param queryRefOrSerializedResult query ref or serialized result.
+ * @param onNext Callback to call when result comes back.
+ * @param onError Callback to call when error gets thrown.
+ * @param onComplete Called when subscription completes.
+ * @returns `SubscriptionOptions`
+ */
+export declare function subscribe<Data, Variables>(queryRefOrSerializedResult: QueryRef<Data, Variables> | SerializedRef<Data, Variables>, onNext: OnResultSubscription<Data, Variables>, onError?: OnErrorSubscription, onComplete?: OnCompleteSubscription): QueryUnsubscribe;
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/src/api.node.d.ts b/frontend-old/node_modules/@firebase/data-connect/dist/src/api.node.d.ts
new file mode 100644
index 0000000..4bd8016
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/src/api.node.d.ts
@@ -0,0 +1,17 @@
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+export { subscribe } from './api.browser';
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/src/api/DataConnect.d.ts b/frontend-old/node_modules/@firebase/data-connect/dist/src/api/DataConnect.d.ts
new file mode 100644
index 0000000..9b20a40
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/src/api/DataConnect.d.ts
@@ -0,0 +1,118 @@
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { FirebaseApp } from '@firebase/app';
+import { AppCheckInternalComponentName } from '@firebase/app-check-interop-types';
+import { FirebaseAuthInternalName } from '@firebase/auth-interop-types';
+import { Provider } from '@firebase/component';
+import { QueryManager } from '../core/QueryManager';
+import { CallerSdkType } from '../network';
+import { MutationManager } from './Mutation';
+/**
+ * Connector Config for calling Data Connect backend.
+ */
+export interface ConnectorConfig {
+ location: string;
+ connector: string;
+ service: string;
+}
+/**
+ * Options to connect to emulator
+ */
+export interface TransportOptions {
+ host: string;
+ sslEnabled?: boolean;
+ port?: number;
+}
+/**
+ *
+ * @param fullHost
+ * @returns TransportOptions
+ * @internal
+ */
+export declare function parseOptions(fullHost: string): TransportOptions;
+/**
+ * DataConnectOptions including project id
+ */
+export interface DataConnectOptions extends ConnectorConfig {
+ projectId: string;
+}
+/**
+ * Class representing Firebase Data Connect
+ */
+export declare class DataConnect {
+ readonly app: FirebaseApp;
+ private readonly dataConnectOptions;
+ private readonly _authProvider;
+ private readonly _appCheckProvider;
+ _queryManager: QueryManager;
+ _mutationManager: MutationManager;
+ isEmulator: boolean;
+ _initialized: boolean;
+ private _transport;
+ private _transportClass;
+ private _transportOptions?;
+ private _authTokenProvider?;
+ _isUsingGeneratedSdk: boolean;
+ _callerSdkType: CallerSdkType;
+ private _appCheckTokenProvider?;
+ constructor(app: FirebaseApp, dataConnectOptions: DataConnectOptions, _authProvider: Provider<FirebaseAuthInternalName>, _appCheckProvider: Provider<AppCheckInternalComponentName>);
+ _useGeneratedSdk(): void;
+ _setCallerSdkType(callerSdkType: CallerSdkType): void;
+ _delete(): Promise<void>;
+ getSettings(): ConnectorConfig;
+ setInitialized(): void;
+ enableEmulator(transportOptions: TransportOptions): void;
+}
+/**
+ * @internal
+ * @param transportOptions1
+ * @param transportOptions2
+ * @returns
+ */
+export declare function areTransportOptionsEqual(transportOptions1: TransportOptions, transportOptions2: TransportOptions): boolean;
+/**
+ * Connect to the DataConnect Emulator
+ * @param dc Data Connect instance
+ * @param host host of emulator server
+ * @param port port of emulator server
+ * @param sslEnabled use https
+ */
+export declare function connectDataConnectEmulator(dc: DataConnect, host: string, port?: number, sslEnabled?: boolean): void;
+/**
+ * Initialize DataConnect instance
+ * @param options ConnectorConfig
+ */
+export declare function getDataConnect(options: ConnectorConfig): DataConnect;
+/**
+ * Initialize DataConnect instance
+ * @param app FirebaseApp to initialize to.
+ * @param options ConnectorConfig
+ */
+export declare function getDataConnect(app: FirebaseApp, options: ConnectorConfig): DataConnect;
+/**
+ *
+ * @param dcOptions
+ * @returns {void}
+ * @internal
+ */
+export declare function validateDCOptions(dcOptions: ConnectorConfig): boolean;
+/**
+ * Delete DataConnect instance
+ * @param dataConnect DataConnect instance
+ * @returns
+ */
+export declare function terminate(dataConnect: DataConnect): Promise<void>;
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/src/api/Mutation.d.ts b/frontend-old/node_modules/@firebase/data-connect/dist/src/api/Mutation.d.ts
new file mode 100644
index 0000000..5a9ddc3
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/src/api/Mutation.d.ts
@@ -0,0 +1,61 @@
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { DataConnectTransport } from '../network/transport';
+import { DataConnect } from './DataConnect';
+import { DataConnectResult, MUTATION_STR, OperationRef } from './Reference';
+export interface MutationRef<Data, Variables> extends OperationRef<Data, Variables> {
+ refType: typeof MUTATION_STR;
+}
+/**
+ * Creates a `MutationRef`
+ * @param dcInstance Data Connect instance
+ * @param mutationName name of mutation
+ */
+export declare function mutationRef<Data>(dcInstance: DataConnect, mutationName: string): MutationRef<Data, undefined>;
+/**
+ *
+ * @param dcInstance Data Connect instance
+ * @param mutationName name of mutation
+ * @param variables variables to send with mutation
+ */
+export declare function mutationRef<Data, Variables>(dcInstance: DataConnect, mutationName: string, variables: Variables): MutationRef<Data, Variables>;
+/**
+ * @internal
+ */
+export declare class MutationManager {
+ private _transport;
+ private _inflight;
+ constructor(_transport: DataConnectTransport);
+ executeMutation<Data, Variables>(mutationRef: MutationRef<Data, Variables>): MutationPromise<Data, Variables>;
+}
+/**
+ * Mutation Result from `executeMutation`
+ */
+export interface MutationResult<Data, Variables> extends DataConnectResult<Data, Variables> {
+ ref: MutationRef<Data, Variables>;
+}
+/**
+ * Mutation return value from `executeMutation`
+ */
+export interface MutationPromise<Data, Variables> extends Promise<MutationResult<Data, Variables>> {
+}
+/**
+ * Execute Mutation
+ * @param mutationRef mutation to execute
+ * @returns `MutationRef`
+ */
+export declare function executeMutation<Data, Variables>(mutationRef: MutationRef<Data, Variables>): MutationPromise<Data, Variables>;
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/src/api/Reference.d.ts b/frontend-old/node_modules/@firebase/data-connect/dist/src/api/Reference.d.ts
new file mode 100644
index 0000000..67549ef
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/src/api/Reference.d.ts
@@ -0,0 +1,51 @@
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { DataConnect, DataConnectOptions } from './DataConnect';
+export declare const QUERY_STR = "query";
+export declare const MUTATION_STR = "mutation";
+export type ReferenceType = typeof QUERY_STR | typeof MUTATION_STR;
+export declare const SOURCE_SERVER = "SERVER";
+export declare const SOURCE_CACHE = "CACHE";
+export type DataSource = typeof SOURCE_CACHE | typeof SOURCE_SERVER;
+export interface OpResult<Data> {
+ data: Data;
+ source: DataSource;
+ fetchTime: string;
+}
+export interface OperationRef<_Data, Variables> {
+ name: string;
+ variables: Variables;
+ refType: ReferenceType;
+ dataConnect: DataConnect;
+}
+export interface DataConnectResult<Data, Variables> extends OpResult<Data> {
+ ref: OperationRef<Data, Variables>;
+}
+/**
+ * Serialized RefInfo as a result of `QueryResult.toJSON().refInfo`
+ */
+export interface RefInfo<Variables> {
+ name: string;
+ variables: Variables;
+ connectorConfig: DataConnectOptions;
+}
+/**
+ * Serialized Ref as a result of `QueryResult.toJSON()`
+ */
+export interface SerializedRef<Data, Variables> extends OpResult<Data> {
+ refInfo: RefInfo<Variables>;
+}
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/src/api/index.d.ts b/frontend-old/node_modules/@firebase/data-connect/dist/src/api/index.d.ts
new file mode 100644
index 0000000..ceb0a89
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/src/api/index.d.ts
@@ -0,0 +1,24 @@
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+export * from '../network';
+export * from './DataConnect';
+export * from './Reference';
+export * from './Mutation';
+export * from './query';
+export { setLogLevel } from '../logger';
+export { validateArgs } from '../util/validateArgs';
+export { DataConnectErrorCode, Code, DataConnectError, DataConnectOperationError, DataConnectOperationFailureResponse, DataConnectOperationFailureResponseErrorInfo } from '../core/error';
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/src/api/query.d.ts b/frontend-old/node_modules/@firebase/data-connect/dist/src/api/query.d.ts
new file mode 100644
index 0000000..93d3863
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/src/api/query.d.ts
@@ -0,0 +1,96 @@
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { DataConnectError } from '../core/error';
+import { DataConnect } from './DataConnect';
+import { OperationRef, QUERY_STR, DataConnectResult, SerializedRef } from './Reference';
+/**
+ * Signature for `OnResultSubscription` for `subscribe`
+ */
+export type OnResultSubscription<Data, Variables> = (res: QueryResult<Data, Variables>) => void;
+/**
+ * Signature for `OnErrorSubscription` for `subscribe`
+ */
+export type OnErrorSubscription = (err?: DataConnectError) => void;
+/**
+ * Signature for unsubscribe from `subscribe`
+ */
+export type QueryUnsubscribe = () => void;
+/**
+ * Representation of user provided subscription options.
+ */
+export interface DataConnectSubscription<Data, Variables> {
+ userCallback: OnResultSubscription<Data, Variables>;
+ errCallback?: (e?: DataConnectError) => void;
+ unsubscribe: () => void;
+}
+/**
+ * QueryRef object
+ */
+export interface QueryRef<Data, Variables> extends OperationRef<Data, Variables> {
+ refType: typeof QUERY_STR;
+}
+/**
+ * Result of `executeQuery`
+ */
+export interface QueryResult<Data, Variables> extends DataConnectResult<Data, Variables> {
+ ref: QueryRef<Data, Variables>;
+ toJSON: () => SerializedRef<Data, Variables>;
+}
+/**
+ * Promise returned from `executeQuery`
+ */
+export interface QueryPromise<Data, Variables> extends Promise<QueryResult<Data, Variables>> {
+}
+/**
+ * Execute Query
+ * @param queryRef query to execute.
+ * @returns `QueryPromise`
+ */
+export declare function executeQuery<Data, Variables>(queryRef: QueryRef<Data, Variables>): QueryPromise<Data, Variables>;
+/**
+ * Execute Query
+ * @param dcInstance Data Connect instance to use.
+ * @param queryName Query to execute
+ * @returns `QueryRef`
+ */
+export declare function queryRef<Data>(dcInstance: DataConnect, queryName: string): QueryRef<Data, undefined>;
+/**
+ * Execute Query
+ * @param dcInstance Data Connect instance to use.
+ * @param queryName Query to execute
+ * @param variables Variables to execute with
+ * @returns `QueryRef`
+ */
+export declare function queryRef<Data, Variables>(dcInstance: DataConnect, queryName: string, variables: Variables): QueryRef<Data, Variables>;
+/**
+ * Converts serialized ref to query ref
+ * @param serializedRef ref to convert to `QueryRef`
+ * @returns `QueryRef`
+ */
+export declare function toQueryRef<Data, Variables>(serializedRef: SerializedRef<Data, Variables>): QueryRef<Data, Variables>;
+/**
+ * `OnCompleteSubscription`
+ */
+export type OnCompleteSubscription = () => void;
+/**
+ * Representation of full observer options in `subscribe`
+ */
+export interface SubscriptionOptions<Data, Variables> {
+ onNext?: OnResultSubscription<Data, Variables>;
+ onErr?: OnErrorSubscription;
+ onComplete?: OnCompleteSubscription;
+}
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/src/core/AppCheckTokenProvider.d.ts b/frontend-old/node_modules/@firebase/data-connect/dist/src/core/AppCheckTokenProvider.d.ts
new file mode 100644
index 0000000..aa6110c
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/src/core/AppCheckTokenProvider.d.ts
@@ -0,0 +1,31 @@
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { FirebaseApp } from '@firebase/app';
+import { AppCheckInternalComponentName, AppCheckTokenListener, AppCheckTokenResult } from '@firebase/app-check-interop-types';
+import { Provider } from '@firebase/component';
+/**
+ * @internal
+ * Abstraction around AppCheck's token fetching capabilities.
+ */
+export declare class AppCheckTokenProvider {
+ private appCheckProvider?;
+ private appCheck?;
+ private serverAppAppCheckToken?;
+ constructor(app: FirebaseApp, appCheckProvider?: Provider<AppCheckInternalComponentName>);
+ getToken(): Promise<AppCheckTokenResult>;
+ addTokenChangeListener(listener: AppCheckTokenListener): void;
+}
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/src/core/FirebaseAuthProvider.d.ts b/frontend-old/node_modules/@firebase/data-connect/dist/src/core/FirebaseAuthProvider.d.ts
new file mode 100644
index 0000000..8e05fc2
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/src/core/FirebaseAuthProvider.d.ts
@@ -0,0 +1,34 @@
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { FirebaseOptions } from '@firebase/app-types';
+import { FirebaseAuthInternalName, FirebaseAuthTokenData } from '@firebase/auth-interop-types';
+import { Provider } from '@firebase/component';
+export interface AuthTokenProvider {
+ getToken(forceRefresh: boolean): Promise<FirebaseAuthTokenData | null>;
+ addTokenChangeListener(listener: AuthTokenListener): void;
+}
+export type AuthTokenListener = (token: string | null) => void;
+export declare class FirebaseAuthProvider implements AuthTokenProvider {
+ private _appName;
+ private _options;
+ private _authProvider;
+ private _auth;
+ constructor(_appName: string, _options: FirebaseOptions, _authProvider: Provider<FirebaseAuthInternalName>);
+ getToken(forceRefresh: boolean): Promise<FirebaseAuthTokenData | null>;
+ addTokenChangeListener(listener: AuthTokenListener): void;
+ removeTokenChangeListener(listener: (token: string | null) => void): void;
+}
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/src/core/QueryManager.d.ts b/frontend-old/node_modules/@firebase/data-connect/dist/src/core/QueryManager.d.ts
new file mode 100644
index 0000000..95b7a33
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/src/core/QueryManager.d.ts
@@ -0,0 +1,36 @@
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { DataConnectSubscription, OnErrorSubscription, OnResultSubscription, QueryPromise, QueryRef } from '../api/query';
+import { OperationRef, OpResult } from '../api/Reference';
+import { DataConnectTransport } from '../network';
+import { DataConnectError } from './error';
+interface TrackedQuery<Data, Variables> {
+ ref: Omit<OperationRef<Data, Variables>, 'dataConnect'>;
+ subscriptions: Array<DataConnectSubscription<Data, Variables>>;
+ currentCache: OpResult<Data> | null;
+ lastError: DataConnectError | null;
+}
+export declare class QueryManager {
+ private transport;
+ _queries: Map<string, TrackedQuery<unknown, unknown>>;
+ constructor(transport: DataConnectTransport);
+ track<Data, Variables>(queryName: string, variables: Variables, initialCache?: OpResult<Data>): TrackedQuery<Data, Variables>;
+ addSubscription<Data, Variables>(queryRef: OperationRef<Data, Variables>, onResultCallback: OnResultSubscription<Data, Variables>, onErrorCallback?: OnErrorSubscription, initialCache?: OpResult<Data>): () => void;
+ executeQuery<Data, Variables>(queryRef: QueryRef<Data, Variables>): QueryPromise<Data, Variables>;
+ enableEmulator(host: string, port: number): void;
+}
+export {};
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/src/core/error.d.ts b/frontend-old/node_modules/@firebase/data-connect/dist/src/core/error.d.ts
new file mode 100644
index 0000000..3609a0b
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/src/core/error.d.ts
@@ -0,0 +1,53 @@
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { FirebaseError } from '@firebase/util';
+export type DataConnectErrorCode = 'other' | 'already-initialized' | 'not-initialized' | 'not-supported' | 'invalid-argument' | 'partial-error' | 'unauthorized';
+export type Code = DataConnectErrorCode;
+export declare const Code: {
+ OTHER: DataConnectErrorCode;
+ ALREADY_INITIALIZED: DataConnectErrorCode;
+ NOT_INITIALIZED: DataConnectErrorCode;
+ NOT_SUPPORTED: DataConnectErrorCode;
+ INVALID_ARGUMENT: DataConnectErrorCode;
+ PARTIAL_ERROR: DataConnectErrorCode;
+ UNAUTHORIZED: DataConnectErrorCode;
+};
+/** An error returned by a DataConnect operation. */
+export declare class DataConnectError extends FirebaseError {
+ /** @internal */
+ readonly name: string;
+ constructor(code: Code, message: string);
+ /** @internal */
+ toString(): string;
+}
+/** An error returned by a DataConnect operation. */
+export declare class DataConnectOperationError extends DataConnectError {
+ /** @internal */
+ readonly name: string;
+ /** The response received from the backend. */
+ readonly response: DataConnectOperationFailureResponse;
+ /** @hideconstructor */
+ constructor(message: string, response: DataConnectOperationFailureResponse);
+}
+export interface DataConnectOperationFailureResponse {
+ readonly data?: Record<string, unknown> | null;
+ readonly errors: DataConnectOperationFailureResponseErrorInfo[];
+}
+export interface DataConnectOperationFailureResponseErrorInfo {
+ readonly message: string;
+ readonly path: Array<string | number>;
+}
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/src/core/version.d.ts b/frontend-old/node_modules/@firebase/data-connect/dist/src/core/version.d.ts
new file mode 100644
index 0000000..76d8740
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/src/core/version.d.ts
@@ -0,0 +1,23 @@
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/** The semver (www.semver.org) version of the SDK. */
+export declare let SDK_VERSION: string;
+/**
+ * SDK_VERSION should be set before any database instance is created
+ * @internal
+ */
+export declare function setSDKVersion(version: string): void;
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/src/index.d.ts b/frontend-old/node_modules/@firebase/data-connect/dist/src/index.d.ts
new file mode 100644
index 0000000..0aa918c
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/src/index.d.ts
@@ -0,0 +1,29 @@
+/**
+ * Firebase Data Connect
+ *
+ * @packageDocumentation
+ */
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { DataConnect } from './api/DataConnect';
+export * from './api';
+export * from './api.browser';
+declare module '@firebase/component' {
+ interface NameServiceMapping {
+ 'data-connect': DataConnect;
+ }
+}
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/src/index.node.d.ts b/frontend-old/node_modules/@firebase/data-connect/dist/src/index.node.d.ts
new file mode 100644
index 0000000..f5f70a7
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/src/index.node.d.ts
@@ -0,0 +1,18 @@
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+export * from './api';
+export * from './api.node';
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/src/logger.d.ts b/frontend-old/node_modules/@firebase/data-connect/dist/src/logger.d.ts
new file mode 100644
index 0000000..3cc3fe0
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/src/logger.d.ts
@@ -0,0 +1,20 @@
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { LogLevelString } from '@firebase/logger';
+export declare function setLogLevel(logLevel: LogLevelString): void;
+export declare function logDebug(msg: string): void;
+export declare function logError(msg: string): void;
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/src/network/fetch.d.ts b/frontend-old/node_modules/@firebase/data-connect/dist/src/network/fetch.d.ts
new file mode 100644
index 0000000..80d65c2
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/src/network/fetch.d.ts
@@ -0,0 +1,27 @@
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { CallerSdkType } from './transport';
+export declare function initializeFetch(fetchImpl: typeof fetch): void;
+export interface DataConnectFetchBody<T> {
+ name: string;
+ operationName: string;
+ variables: T;
+}
+export declare function dcFetch<T, U>(url: string, body: DataConnectFetchBody<U>, { signal }: AbortController, appId: string | null, accessToken: string | null, appCheckToken: string | null, _isUsingGen: boolean, _callerSdkType: CallerSdkType, _isUsingEmulator: boolean): Promise<{
+ data: T;
+ errors: Error[];
+}>;
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/src/network/index.d.ts b/frontend-old/node_modules/@firebase/data-connect/dist/src/network/index.d.ts
new file mode 100644
index 0000000..e3afb7c
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/src/network/index.d.ts
@@ -0,0 +1,17 @@
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+export * from './transport';
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/src/network/transport/index.d.ts b/frontend-old/node_modules/@firebase/data-connect/dist/src/network/transport/index.d.ts
new file mode 100644
index 0000000..e1823db
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/src/network/transport/index.d.ts
@@ -0,0 +1,52 @@
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { DataConnectOptions, TransportOptions } from '../../api/DataConnect';
+import { AppCheckTokenProvider } from '../../core/AppCheckTokenProvider';
+import { AuthTokenProvider } from '../../core/FirebaseAuthProvider';
+/**
+ * enum representing different flavors of the SDK used by developers
+ * use the CallerSdkType for type-checking, and the CallerSdkTypeEnum for value-checking/assigning
+ */
+export type CallerSdkType = 'Base' | 'Generated' | 'TanstackReactCore' | 'GeneratedReact' | 'TanstackAngularCore' | 'GeneratedAngular';
+export declare const CallerSdkTypeEnum: {
+ readonly Base: "Base";
+ readonly Generated: "Generated";
+ readonly TanstackReactCore: "TanstackReactCore";
+ readonly GeneratedReact: "GeneratedReact";
+ readonly TanstackAngularCore: "TanstackAngularCore";
+ readonly GeneratedAngular: "GeneratedAngular";
+};
+/**
+ * @internal
+ */
+export interface DataConnectTransport {
+ invokeQuery<T, U>(queryName: string, body?: U): Promise<{
+ data: T;
+ errors: Error[];
+ }>;
+ invokeMutation<T, U>(queryName: string, body?: U): Promise<{
+ data: T;
+ errors: Error[];
+ }>;
+ useEmulator(host: string, port?: number, sslEnabled?: boolean): void;
+ onTokenChanged: (token: string | null) => void;
+ _setCallerSdkType(callerSdkType: CallerSdkType): void;
+}
+/**
+ * @internal
+ */
+export type TransportClass = new (options: DataConnectOptions, apiKey?: string, appId?: string, authProvider?: AuthTokenProvider, appCheckProvider?: AppCheckTokenProvider, transportOptions?: TransportOptions, _isUsingGen?: boolean, _callerSdkType?: CallerSdkType) => DataConnectTransport;
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/src/network/transport/rest.d.ts b/frontend-old/node_modules/@firebase/data-connect/dist/src/network/transport/rest.d.ts
new file mode 100644
index 0000000..64a8922
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/src/network/transport/rest.d.ts
@@ -0,0 +1,61 @@
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { DataConnectOptions, TransportOptions } from '../../api/DataConnect';
+import { AppCheckTokenProvider } from '../../core/AppCheckTokenProvider';
+import { AuthTokenProvider } from '../../core/FirebaseAuthProvider';
+import { CallerSdkType, DataConnectTransport } from '.';
+export declare class RESTTransport implements DataConnectTransport {
+ private apiKey?;
+ private appId?;
+ private authProvider?;
+ private appCheckProvider?;
+ private _isUsingGen;
+ private _callerSdkType;
+ private _host;
+ private _port;
+ private _location;
+ private _connectorName;
+ private _secure;
+ private _project;
+ private _serviceName;
+ private _accessToken;
+ private _appCheckToken;
+ private _lastToken;
+ private _isUsingEmulator;
+ constructor(options: DataConnectOptions, apiKey?: string | undefined, appId?: string, authProvider?: AuthTokenProvider | undefined, appCheckProvider?: AppCheckTokenProvider | undefined, transportOptions?: TransportOptions | undefined, _isUsingGen?: boolean, _callerSdkType?: CallerSdkType);
+ get endpointUrl(): string;
+ useEmulator(host: string, port?: number, isSecure?: boolean): void;
+ onTokenChanged(newToken: string | null): void;
+ getWithAuth(forceToken?: boolean): Promise<string>;
+ _setLastToken(lastToken: string | null): void;
+ withRetry<T>(promiseFactory: () => Promise<{
+ data: T;
+ errors: Error[];
+ }>, retry?: boolean): Promise<{
+ data: T;
+ errors: Error[];
+ }>;
+ invokeQuery: <T, U>(queryName: string, body?: U) => Promise<{
+ data: T;
+ errors: Error[];
+ }>;
+ invokeMutation: <T, U>(queryName: string, body?: U) => Promise<{
+ data: T;
+ errors: Error[];
+ }>;
+ _setCallerSdkType(callerSdkType: CallerSdkType): void;
+}
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/src/register.d.ts b/frontend-old/node_modules/@firebase/data-connect/dist/src/register.d.ts
new file mode 100644
index 0000000..3d26abe
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/src/register.d.ts
@@ -0,0 +1 @@
+export declare function registerDataConnect(variant?: string): void;
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/src/tsdoc-metadata.json b/frontend-old/node_modules/@firebase/data-connect/dist/src/tsdoc-metadata.json
new file mode 100644
index 0000000..6af1f6a
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/src/tsdoc-metadata.json
@@ -0,0 +1,11 @@
+// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
+// It should be published with your NPM package. It should not be tracked by Git.
+{
+ "tsdocVersion": "0.12",
+ "toolPackages": [
+ {
+ "packageName": "@microsoft/api-extractor",
+ "packageVersion": "0.1.2"
+ }
+ ]
+}
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/src/util/encoder.d.ts b/frontend-old/node_modules/@firebase/data-connect/dist/src/util/encoder.d.ts
new file mode 100644
index 0000000..96b56a3
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/src/util/encoder.d.ts
@@ -0,0 +1,19 @@
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+export type HmacImpl = (obj: unknown) => string;
+export declare let encoderImpl: HmacImpl;
+export declare function setEncoder(encoder: HmacImpl): void;
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/src/util/map.d.ts b/frontend-old/node_modules/@firebase/data-connect/dist/src/util/map.d.ts
new file mode 100644
index 0000000..650f671
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/src/util/map.d.ts
@@ -0,0 +1,17 @@
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+export declare function setIfNotExists<T>(map: Map<string, T>, key: string, val: T): void;
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/src/util/url.d.ts b/frontend-old/node_modules/@firebase/data-connect/dist/src/util/url.d.ts
new file mode 100644
index 0000000..4491e93
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/src/util/url.d.ts
@@ -0,0 +1,19 @@
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { DataConnectOptions, TransportOptions } from '../api/DataConnect';
+export declare function urlBuilder(projectConfig: DataConnectOptions, transportOptions: TransportOptions): string;
+export declare function addToken(url: string, apiKey?: string): string;
diff --git a/frontend-old/node_modules/@firebase/data-connect/dist/src/util/validateArgs.d.ts b/frontend-old/node_modules/@firebase/data-connect/dist/src/util/validateArgs.d.ts
new file mode 100644
index 0000000..5c31cdc
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/dist/src/util/validateArgs.d.ts
@@ -0,0 +1,33 @@
+/**
+ * @license
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { ConnectorConfig, DataConnect } from '../api/DataConnect';
+interface ParsedArgs<Variables> {
+ dc: DataConnect;
+ vars: Variables;
+}
+/**
+ * The generated SDK will allow the user to pass in either the variable or the data connect instance with the variable,
+ * and this function validates the variables and returns back the DataConnect instance and variables based on the arguments passed in.
+ * @param connectorConfig
+ * @param dcOrVars
+ * @param vars
+ * @param validateVars
+ * @returns {DataConnect} and {Variables} instance
+ * @internal
+ */
+export declare function validateArgs<Variables extends object>(connectorConfig: ConnectorConfig, dcOrVars?: DataConnect | Variables, vars?: Variables, validateVars?: boolean): ParsedArgs<Variables>;
+export {};
diff --git a/frontend-old/node_modules/@firebase/data-connect/package.json b/frontend-old/node_modules/@firebase/data-connect/package.json
new file mode 100644
index 0000000..c1e6b12
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/data-connect/package.json
@@ -0,0 +1,78 @@
+{
+ "name": "@firebase/data-connect",
+ "version": "0.3.11",
+ "description": "",
+ "author": "Firebase <firebase-support@google.com> (https://firebase.google.com/)",
+ "main": "dist/index.node.cjs.js",
+ "browser": "dist/index.esm.js",
+ "module": "dist/index.esm.js",
+ "exports": {
+ ".": {
+ "types": "./dist/public.d.ts",
+ "node": {
+ "import": "./dist/node-esm/index.node.esm.js",
+ "require": "./dist/index.node.cjs.js"
+ },
+ "browser": {
+ "require": "./dist/index.cjs.js",
+ "import": "./dist/index.esm.js"
+ },
+ "default": "./dist/index.esm.js"
+ },
+ "./package.json": "./package.json"
+ },
+ "files": [
+ "dist"
+ ],
+ "scripts": {
+ "lint": "eslint -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore' --fix",
+ "lint:fix": "eslint --fix -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'",
+ "build": "rollup -c rollup.config.js && yarn api-report",
+ "prettier": "prettier --write '*.js' '*.ts' '@(src|test)/**/*.ts'",
+ "build:deps": "lerna run --scope @firebase/'{app,data-connect}' --include-dependencies build",
+ "dev": "rollup -c -w",
+ "test": "run-p --npm-path npm lint test:emulator",
+ "test:ci": "node ../../scripts/run_tests_in_ci.js -s test:all",
+ "test:all": "run-p --npm-path npm lint test:browser test:node",
+ "test:browser": "karma start",
+ "test:node": "TS_NODE_FILES=true TS_NODE_CACHE=NO TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha 'test/{,!(browser)/**/}*.test.ts' --file src/index.node.ts --config ../../config/mocharc.node.js",
+ "test:unit": "TS_NODE_FILES=true TS_NODE_CACHE=NO TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha 'test/unit/**/*.test.ts' --file src/index.node.ts --config ../../config/mocharc.node.js",
+ "test:emulator": "ts-node --compiler-options='{\"module\":\"commonjs\"}' ../../scripts/emulator-testing/dataconnect-test-runner.ts",
+ "api-report": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' ts-node ../../repo-scripts/prune-dts/extract-public-api.ts --package data-connect --packageRoot . --typescriptDts ./dist/src/index.d.ts --rollupDts ./dist/private.d.ts --untrimmedRollupDts ./dist/internal.d.ts --publicDts ./dist/public.d.ts && yarn api-report:api-json",
+ "api-report:api-json": "rm -rf temp && api-extractor run --local --verbose",
+ "doc": "api-documenter markdown --input temp --output docs",
+ "typings:public": "node ../../scripts/build/use_typings.js ./dist/public.d.ts"
+ },
+ "license": "Apache-2.0",
+ "peerDependencies": {
+ "@firebase/app": "0.x"
+ },
+ "dependencies": {
+ "@firebase/auth-interop-types": "0.2.4",
+ "@firebase/component": "0.7.0",
+ "@firebase/logger": "0.5.0",
+ "@firebase/util": "1.13.0",
+ "tslib": "^2.1.0"
+ },
+ "devDependencies": {
+ "@firebase/app": "0.14.0",
+ "rollup": "2.79.2",
+ "rollup-plugin-typescript2": "0.36.0",
+ "typescript": "5.5.4"
+ },
+ "repository": {
+ "directory": "packages/data-connect",
+ "type": "git",
+ "url": "https://github.com/firebase/firebase-js-sdk.git"
+ },
+ "bugs": {
+ "url": "https://github.com/firebase/firebase-js-sdk/issues"
+ },
+ "typings": "./dist/public.d.ts",
+ "nyc": {
+ "extension": [
+ ".ts"
+ ],
+ "reportDir": "./coverage/node"
+ }
+}