@firebase/data-connect 0.0.2-dataconnect-preview.877f8b7d0 → 0.0.2-dataconnect-preview.388b61c7e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +59 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm2017.js +59 -3
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +59 -3
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +59 -3
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/internal.d.ts +127 -8
- package/dist/node-esm/index.node.esm.js +59 -3
- package/dist/node-esm/index.node.esm.js.map +1 -1
- package/dist/node-esm/src/api/DataConnect.d.ts +33 -0
- package/dist/node-esm/src/api/Mutation.d.ts +26 -1
- package/dist/node-esm/src/api/Reference.d.ts +6 -0
- package/dist/node-esm/src/api/query.d.ts +50 -0
- package/dist/node-esm/src/api.browser.d.ts +12 -7
- package/dist/private.d.ts +125 -14
- package/dist/public.d.ts +125 -12
- package/dist/src/api/DataConnect.d.ts +33 -0
- package/dist/src/api/Mutation.d.ts +26 -1
- package/dist/src/api/Reference.d.ts +6 -0
- package/dist/src/api/query.d.ts +50 -0
- package/dist/src/api.browser.d.ts +12 -7
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.node.cjs.js","sources":["../src/core/error.ts","../src/core/version.ts","../src/logger.ts","../src/network/fetch.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/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\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};\n\n/** An error returned by a DataConnect operation. */\nexport class DataConnectError extends FirebaseError {\n /** The stack of the error. */\n readonly stack?: string;\n\n /** @hideconstructor */\n constructor(\n /**\n * The backend error code associated with this error.\n */\n readonly code: DataConnectErrorCode,\n /**\n * A custom error description.\n */\n readonly message: string\n ) {\n super(code, message);\n\n // HACK: We write a toString property directly because Error is not a real\n // class and so inheritance does not work correctly. We could alternatively\n // do the same \"back-door inheritance\" trick that FirebaseError does.\n this.toString = () => `${this.name}: [code=${this.code}]: ${this.message}`;\n }\n}\n","/**\n * @license\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\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) {\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 { Code, DataConnectError } from '../core/error';\nimport { logDebug, logError } from '../logger';\n\nlet connectFetch: typeof fetch | null = globalThis.fetch;\nexport function initializeFetch(fetchImpl: typeof fetch) {\n connectFetch = fetchImpl;\n}\nexport function dcFetch<T, U>(\n url: string,\n body: U,\n { signal }: AbortController,\n accessToken: string | null\n) {\n if (!connectFetch) {\n throw new DataConnectError(Code.OTHER, 'No Fetch Implementation detected!');\n }\n const headers: HeadersInit = {\n 'Content-Type': 'application/json'\n };\n if (accessToken) {\n headers['X-Firebase-Auth-Token'] = accessToken;\n }\n const bodyStr = JSON.stringify(body);\n logDebug(`Making request out to ${url} with body: ${bodyStr}`);\n return connectFetch(url, {\n body: bodyStr,\n method: 'POST',\n headers,\n signal\n }).catch(err => {\n throw new DataConnectError(Code.OTHER, \"Failed to fetch: \" + JSON.stringify(err));\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 if (response.status >= 400) {\n logError(\n 'Error while performing request: ' + JSON.stringify(jsonResponse)\n );\n throw new DataConnectError(Code.OTHER, JSON.stringify(jsonResponse));\n }\n return jsonResponse;\n })\n .then(res => {\n if (res.errors && res.errors.length) {\n const stringified = JSON.stringify(res.errors);\n logError('DataConnect error while performing request: ' + stringified);\n throw new DataConnectError(Code.OTHER, stringified);\n }\n return res as { data: T; errors: Error[] };\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';\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\nexport interface AuthTokenProvider {\n getToken(forceRefresh: boolean): Promise<FirebaseAuthTokenData | null>;\n addTokenChangeListener(listener: AuthTokenListener): void;\n}\nexport type AuthTokenListener = (token: string | null) => void;\n\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 }\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\nexport interface RefInfo<Variables> {\n name: string;\n variables: Variables;\n connectorConfig: DataConnectOptions;\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) {\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>(map: Map<string, T>, key: string, val: T): 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 { 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 ) {\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);\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 = () => {\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(\n queryRef as QueryRef<Data, Variables>\n );\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 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) {\n this.transport.useEmulator(host, port);\n }\n}\nfunction compareDates(str1: string, str2: string) {\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) {\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}/v1alpha/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 { DataConnectError, Code } from '../../core/error';\nimport { AuthTokenProvider } from '../../core/FirebaseAuthProvider';\nimport { logDebug } from '../../logger';\nimport { addToken, urlBuilder } from '../../util/url';\nimport { dcFetch } from '../fetch';\n\nimport { DataConnectTransport } from '.';\n\nexport class RESTTransport implements DataConnectTransport {\n private _host = '';\n private _port: number | undefined;\n private _location = 'l';\n private _connectorName = '';\n private _secure = true;\n private _project = 'p';\n private _serviceName: string;\n private _accessToken: string | null = null;\n private _authInitialized = false;\n constructor(\n options: DataConnectOptions,\n private apiKey?: string | undefined,\n private authProvider?: AuthTokenProvider | undefined,\n transportOptions?: TransportOptions | undefined\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 }\n get endpointUrl(): string {\n return urlBuilder(\n {\n connector: this._connectorName,\n location: this._location,\n projectId: this._project,\n service: this._serviceName\n },\n { host: this._host, sslEnabled: this._secure, port: this._port }\n );\n }\n useEmulator(host: string, port?: number, isSecure?: boolean): void {\n this._host = host;\n if (typeof port === 'number') {\n this._port = port;\n }\n if (typeof isSecure !== 'undefined') {\n this._secure = isSecure;\n }\n }\n onTokenChanged(newToken: string | null) {\n this._accessToken = newToken;\n }\n\n getWithAuth() {\n let starterPromise: Promise<string | null> = new Promise(resolve =>\n resolve(this._accessToken)\n );\n if (!this._authInitialized) {\n if (this.authProvider) {\n starterPromise = this.authProvider\n .getToken(/*forceToken=*/ false)\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 }\n return starterPromise;\n }\n\n // TODO(mtewani): Update U to include shape of body defined in line 13.\n invokeQuery = <T, U = unknown>(queryName: string, body: U) => {\n const abortController = new AbortController();\n\n // TODO(mtewani): Update to proper value\n const withAuth = this.getWithAuth().then(() => {\n return 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 } as unknown as U, // TODO(mtewani): This is a patch, fix this.\n abortController,\n this._accessToken\n );\n });\n\n return {\n then: withAuth.then.bind(withAuth)\n };\n };\n invokeMutation = <T, U = unknown>(mutationName: string, body: U) => {\n const abortController = new AbortController();\n const taskResult = this.getWithAuth().then(() => {\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 } as unknown as U,\n abortController,\n this._accessToken\n );\n });\n\n return {\n then: taskResult.then.bind(taskResult),\n // catch: taskResult.catch.bind(taskResult),\n // finally: taskResult.finally.bind(taskResult),\n cancel: () => abortController.abort()\n };\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\nexport function mutationRef<Data>(\n dcInstance: DataConnect,\n queryName: string\n): MutationRef<Data, undefined>;\nexport function mutationRef<Data, Variables>(\n dcInstance: DataConnect,\n mutationName: string,\n variables: Variables\n): MutationRef<Data, Variables>;\nexport function mutationRef<Data, Variables>(\n dcInstance: DataConnect,\n queryName: string,\n variables?: Variables\n): MutationRef<Data, Variables> {\n dcInstance.setInitialized();\n const ref: MutationRef<Data, Variables> = {\n dataConnect: dcInstance,\n name: queryName,\n refType: MUTATION_STR,\n variables: variables as Variables\n };\n return ref;\n}\n\nexport class MutationManager {\n private _inflight: Array<PromiseLike<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 = () =>\n (this._inflight = this._inflight.filter(promise => promise !== result));\n result.then(removePromise, removePromise);\n return withRefPromise;\n }\n}\n\nexport interface MutationResult<Data, Variables>\n extends DataConnectResult<Data, Variables> {\n ref: MutationRef<Data, Variables>;\n}\nexport interface MutationPromise<Data, Variables>\n extends PromiseLike<MutationResult<Data, Variables>> {\n // reserved for special actions like cancellation\n}\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 { FirebaseAuthInternalName } from '@firebase/auth-interop-types';\nimport { Provider } from '@firebase/component';\n\nimport { Code, DataConnectError } from '../core/error';\nimport {\n AuthTokenProvider,\n FirebaseAuthProvider\n} from '../core/FirebaseAuthProvider';\nimport { QueryManager } from '../core/QueryManager';\nimport { logDebug, logError } from '../logger';\nimport { DataConnectTransport, TransportClass } from '../network';\nimport { RESTTransport } from '../network/transport/rest';\n\nimport { MutationManager } from './Mutation';\n\n\nexport interface ConnectorConfig {\n location: string;\n connector: string;\n service: string;\n}\n\nexport interface TransportOptions {\n host: string;\n sslEnabled?: boolean;\n port?: number;\n}\n\nexport const 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}\nexport interface DataConnectOptions extends ConnectorConfig {\n projectId: string;\n}\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 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 ) {\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 _delete(): Promise<void> {\n _removeServiceInstance(\n this.app,\n 'data-connect',\n JSON.stringify(this.getSettings())\n );\n return Promise.resolve();\n }\n\n getSettings(): ConnectorConfig {\n const copy = JSON.parse(JSON.stringify(this.dataConnectOptions));\n delete copy.projectId;\n return copy;\n }\n\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\n this.initialized = true;\n this._transport = new this._transportClass(\n this.dataConnectOptions,\n this.app.options.apiKey,\n this._authTokenProvider\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 enableEmulator(transportOptions: TransportOptions): void {\n if (this.initialized) {\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\nexport function connectDataConnectEmulator(\n dc: DataConnect,\n host: string,\n port?: number,\n sslEnabled = false\n): void {\n dc.enableEmulator({ host, port, sslEnabled });\n}\n\nexport function getDataConnect(options: ConnectorConfig): DataConnect;\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) {\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 if (!dcOptions) {\n throw new DataConnectError(Code.INVALID_ARGUMENT, 'DC Option Required');\n }\n logDebug('Creating new DataConnect instance');\n // Initialize with options.\n return provider.initialize({\n instanceIdentifier: identifier,\n options: dcOptions\n });\n}\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';\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 let newOpts = options as ConnectorConfig;\n if (settings) {\n newOpts = JSON.parse(settings);\n }\n return new DataConnect(\n app,\n { ...newOpts, projectId: app.options.projectId! },\n authProvider\n );\n },\n ComponentType.PUBLIC\n ).setMultipleInstances(true)\n );\n registerVersion(name, version, variant);\n // BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation\n registerVersion(name, version, '__BUILD_TARGET__');\n}\n","/**\n * @license\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { DataConnectError } from '../core/error';\n\nimport { DataConnect, getDataConnect } from './DataConnect';\nimport {\n OperationRef,\n QUERY_STR,\n DataConnectResult,\n SerializedRef\n} from './Reference';\n\nexport type OnResultSubscription<Data, Variables> = (\n res: QueryResult<Data, Variables>\n) => void;\nexport type OnErrorSubscription = (err?: DataConnectError) => void;\nexport type QueryUnsubscribe = () => void;\nexport interface DataConnectSubscription<Data, Variables> {\n userCallback: OnResultSubscription<Data, Variables>;\n errCallback?: (e?: DataConnectError) => void;\n unsubscribe: () => void;\n}\nexport interface QueryRef<Data, Variables>\n extends OperationRef<Data, Variables> {\n refType: typeof QUERY_STR;\n}\nexport interface QueryResult<Data, Variables>\n extends DataConnectResult<Data, Variables> {\n ref: QueryRef<Data, Variables>;\n toJSON: () => SerializedRef<Data, Variables>;\n}\nexport interface QueryPromise<Data, Variables>\n extends PromiseLike<QueryResult<Data, Variables>> {\n // reserved for special actions like cancellation\n}\n\nexport function executeQuery<Data, Variables>(\n queryRef: QueryRef<Data, Variables>\n): QueryPromise<Data, Variables> {\n return queryRef.dataConnect._queryManager.executeQuery(queryRef);\n}\n\nexport function queryRef<Data>(\n dcInstance: DataConnect,\n queryName: string\n): QueryRef<Data, undefined>;\nexport function queryRef<Data, Variables>(\n dcInstance: DataConnect,\n queryName: string,\n variables: Variables\n): QueryRef<Data, Variables>;\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: variables as Variables\n };\n}\nexport function toQueryRef<Data, Variables>(\n serializedRef: SerializedRef<Data, Variables>\n) {\n const {\n refInfo: { name, variables, connectorConfig }\n } = serializedRef;\n return queryRef(getDataConnect(connectorConfig), name, variables);\n}\nexport type OnCompleteSubscription = () => void;\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 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 *\n * @public\n * @param queryRef\n * @param onResult\n * @param onErr\n * @param initialCache\n * @returns\n */\nexport function subscribe<Data, Variables>(\n queryRefOrSerializedResult:\n | QueryRef<Data, Variables>\n | SerializedRef<Data, Variables>,\n observer: SubscriptionOptions<Data, Variables>\n): QueryUnsubscribe;\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;\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":["__extends","FirebaseError","Logger","__awaiter","__assign","_removeServiceInstance","app","getApp","_getProvider","SDK_VERSION","_registerComponent","Component","registerVersion"],"mappings":";;;;;;;;;;AAAA;;;;;;;;;;;;;;;AAeG;AAcI,IAAM,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;CACvD,CAAC;AAEF;AACA,IAAA,gBAAA,kBAAA,UAAA,MAAA,EAAA;IAAsCA,eAAa,CAAA,gBAAA,EAAA,MAAA,CAAA,CAAA;;AAKjD,IAAA,SAAA,gBAAA;AAC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AM,EAAA,MAAA;AACN,YAAA,SAAS,EAAA,SAAA;SACV,CAAC;AACF,QAAA,GAAG,GAAG,UAAU,CAAC,aAAa,CAAC,CAAC;AACjC,KAAA;AAAM,SAAA;QACL,GAAG,GAAG,0BAA0B,CAAC;AAClC,KAAA;IACD,IAAI,QAAQ,GAAsD,SAAS,CAAC;AAC5E,IAAA,IAAI,OAAO,gBAAgB,KAAK,UAAU,EAAE;QAC1C,QAAQ,GAAG,gBAAgB,CAAC;AAC7B,KAAA;AAAM,SAAA;AACL,QAAA,QAAQ,GAAG,gBAAgB,CAAC,MAAM,CAAC;AACnC,QAAA,OAAO,GAAG,gBAAgB,CAAC,KAAK,CAAC;AACjC,QAAa,gBAAgB,CAAC,UAAU,CAAC;AAC1C,KAAA;IACD,IAAI,CAAC,QAAQ,EAAE;QACb,MAAM,IAAI,gBAAgB,CAAC,IAAI,CAAC,gBAAgB,EAAE,qBAAqB,CAAC,CAAC;AAC1E,KAAA;AACD,IAAA,OAAO,GAAG,CAAC,WAAW,CAAC,aAAa,CAAC,eAAe,CAClD,GAAG,EACH,QAAQ,EACR,OAAO,EACP,YAAY,CACb,CAAC;AACJ;;AC9FA;;;;;;;;;;;;;;;AAeG;AAOH,eAAe,CAAC,KAAK,CAAC,CAAC;AAEvB,mBAAmB,CAAC,MAAM,CAAC;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.node.cjs.js","sources":["../src/core/error.ts","../src/core/version.ts","../src/logger.ts","../src/network/fetch.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/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\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};\n\n/** An error returned by a DataConnect operation. */\nexport class DataConnectError extends FirebaseError {\n /** The stack of the error. */\n readonly stack?: string;\n\n /** @hideconstructor */\n constructor(\n /**\n * The backend error code associated with this error.\n */\n readonly code: DataConnectErrorCode,\n /**\n * A custom error description.\n */\n readonly message: string\n ) {\n super(code, message);\n\n // HACK: We write a toString property directly because Error is not a real\n // class and so inheritance does not work correctly. We could alternatively\n // do the same \"back-door inheritance\" trick that FirebaseError does.\n this.toString = () => `${this.name}: [code=${this.code}]: ${this.message}`;\n }\n}\n","/**\n * @license\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\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) {\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 { Code, DataConnectError } from '../core/error';\nimport { logDebug, logError } from '../logger';\n\nlet connectFetch: typeof fetch | null = globalThis.fetch;\nexport function initializeFetch(fetchImpl: typeof fetch) {\n connectFetch = fetchImpl;\n}\nexport function dcFetch<T, U>(\n url: string,\n body: U,\n { signal }: AbortController,\n accessToken: string | null\n) {\n if (!connectFetch) {\n throw new DataConnectError(Code.OTHER, 'No Fetch Implementation detected!');\n }\n const headers: HeadersInit = {\n 'Content-Type': 'application/json'\n };\n if (accessToken) {\n headers['X-Firebase-Auth-Token'] = accessToken;\n }\n const bodyStr = JSON.stringify(body);\n logDebug(`Making request out to ${url} with body: ${bodyStr}`);\n return connectFetch(url, {\n body: bodyStr,\n method: 'POST',\n headers,\n signal\n }).catch(err => {\n throw new DataConnectError(Code.OTHER, \"Failed to fetch: \" + JSON.stringify(err));\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 if (response.status >= 400) {\n logError(\n 'Error while performing request: ' + JSON.stringify(jsonResponse)\n );\n throw new DataConnectError(Code.OTHER, JSON.stringify(jsonResponse));\n }\n return jsonResponse;\n })\n .then(res => {\n if (res.errors && res.errors.length) {\n const stringified = JSON.stringify(res.errors);\n logError('DataConnect error while performing request: ' + stringified);\n throw new DataConnectError(Code.OTHER, stringified);\n }\n return res as { data: T; errors: Error[] };\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';\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\nexport interface AuthTokenProvider {\n getToken(forceRefresh: boolean): Promise<FirebaseAuthTokenData | null>;\n addTokenChangeListener(listener: AuthTokenListener): void;\n}\nexport type AuthTokenListener = (token: string | null) => void;\n\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 }\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) {\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>(map: Map<string, T>, key: string, val: T): 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 { 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 ) {\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);\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 = () => {\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(\n queryRef as QueryRef<Data, Variables>\n );\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 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) {\n this.transport.useEmulator(host, port);\n }\n}\nfunction compareDates(str1: string, str2: string) {\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) {\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}/v1alpha/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 { DataConnectError, Code } from '../../core/error';\nimport { AuthTokenProvider } from '../../core/FirebaseAuthProvider';\nimport { logDebug } from '../../logger';\nimport { addToken, urlBuilder } from '../../util/url';\nimport { dcFetch } from '../fetch';\n\nimport { DataConnectTransport } from '.';\n\nexport class RESTTransport implements DataConnectTransport {\n private _host = '';\n private _port: number | undefined;\n private _location = 'l';\n private _connectorName = '';\n private _secure = true;\n private _project = 'p';\n private _serviceName: string;\n private _accessToken: string | null = null;\n private _authInitialized = false;\n constructor(\n options: DataConnectOptions,\n private apiKey?: string | undefined,\n private authProvider?: AuthTokenProvider | undefined,\n transportOptions?: TransportOptions | undefined\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 }\n get endpointUrl(): string {\n return urlBuilder(\n {\n connector: this._connectorName,\n location: this._location,\n projectId: this._project,\n service: this._serviceName\n },\n { host: this._host, sslEnabled: this._secure, port: this._port }\n );\n }\n useEmulator(host: string, port?: number, isSecure?: boolean): void {\n this._host = host;\n if (typeof port === 'number') {\n this._port = port;\n }\n if (typeof isSecure !== 'undefined') {\n this._secure = isSecure;\n }\n }\n onTokenChanged(newToken: string | null) {\n this._accessToken = newToken;\n }\n\n getWithAuth() {\n let starterPromise: Promise<string | null> = new Promise(resolve =>\n resolve(this._accessToken)\n );\n if (!this._authInitialized) {\n if (this.authProvider) {\n starterPromise = this.authProvider\n .getToken(/*forceToken=*/ false)\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 }\n return starterPromise;\n }\n\n // TODO(mtewani): Update U to include shape of body defined in line 13.\n invokeQuery = <T, U = unknown>(queryName: string, body: U) => {\n const abortController = new AbortController();\n\n // TODO(mtewani): Update to proper value\n const withAuth = this.getWithAuth().then(() => {\n return 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 } as unknown as U, // TODO(mtewani): This is a patch, fix this.\n abortController,\n this._accessToken\n );\n });\n\n return {\n then: withAuth.then.bind(withAuth)\n };\n };\n invokeMutation = <T, U = unknown>(mutationName: string, body: U) => {\n const abortController = new AbortController();\n const taskResult = this.getWithAuth().then(() => {\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 } as unknown as U,\n abortController,\n this._accessToken\n );\n });\n\n return {\n then: taskResult.then.bind(taskResult),\n // catch: taskResult.catch.bind(taskResult),\n // finally: taskResult.finally.bind(taskResult),\n cancel: () => abortController.abort()\n };\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<PromiseLike<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 = () =>\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 PromiseLike<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 { FirebaseAuthInternalName } from '@firebase/auth-interop-types';\nimport { Provider } from '@firebase/component';\n\nimport { Code, DataConnectError } from '../core/error';\nimport {\n AuthTokenProvider,\n FirebaseAuthProvider\n} from '../core/FirebaseAuthProvider';\nimport { QueryManager } from '../core/QueryManager';\nimport { logDebug, logError } from '../logger';\nimport { DataConnectTransport, TransportClass } from '../network';\nimport { RESTTransport } from '../network/transport/rest';\n\nimport { MutationManager } from './Mutation';\n\n\n/**\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\nexport const 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 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 ) {\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 _delete(): Promise<void> {\n _removeServiceInstance(\n this.app,\n 'data-connect',\n JSON.stringify(this.getSettings())\n );\n return Promise.resolve();\n }\n\n getSettings(): ConnectorConfig {\n const copy = JSON.parse(JSON.stringify(this.dataConnectOptions));\n delete copy.projectId;\n return copy;\n }\n\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\n this.initialized = true;\n this._transport = new this._transportClass(\n this.dataConnectOptions,\n this.app.options.apiKey,\n this._authTokenProvider\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 enableEmulator(transportOptions: TransportOptions): void {\n if (this.initialized) {\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 * Connect to the DataConnect Emulator\n * @param dc Data Connect instance\n * @param host host of emulator server\n * @param port port of emulator server\n * @param sslEnabled use https\n */\nexport function connectDataConnectEmulator(\n dc: DataConnect,\n host: string,\n port?: number,\n sslEnabled = false\n): void {\n dc.enableEmulator({ host, port, sslEnabled });\n}\n\n/**\n * Initialize DataConnect instance\n * @param options ConnectorConfig\n */\nexport function getDataConnect(options: ConnectorConfig): DataConnect;\n/**\n * Initialize DataConnect instance\n * @param app FirebaseApp to initialize to.\n * @param options ConnectorConfig\n */\nexport function getDataConnect(\n app: FirebaseApp,\n options: ConnectorConfig\n): DataConnect;\nexport function getDataConnect(\n appOrOptions: FirebaseApp | ConnectorConfig,\n optionalOptions?: ConnectorConfig\n): DataConnect {\n let app: FirebaseApp;\n let dcOptions: ConnectorConfig;\n if ('location' in appOrOptions) {\n dcOptions = appOrOptions;\n app = getApp();\n } else {\n dcOptions = optionalOptions!;\n app = appOrOptions;\n }\n\n if (!app) {\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 if (!dcOptions) {\n throw new DataConnectError(Code.INVALID_ARGUMENT, 'DC Option Required');\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 * 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';\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 let newOpts = options as ConnectorConfig;\n if (settings) {\n newOpts = JSON.parse(settings);\n }\n return new DataConnect(\n app,\n { ...newOpts, projectId: app.options.projectId! },\n authProvider\n );\n },\n ComponentType.PUBLIC\n ).setMultipleInstances(true)\n );\n registerVersion(name, version, variant);\n // BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation\n registerVersion(name, version, '__BUILD_TARGET__');\n}\n","/**\n * @license\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { DataConnectError } from '../core/error';\n\nimport { DataConnect, getDataConnect } from './DataConnect';\nimport {\n OperationRef,\n QUERY_STR,\n DataConnectResult,\n SerializedRef\n} from './Reference';\n\n/**\n * Signature for `OnResultSubscription` for `subscribe`\n */\nexport type OnResultSubscription<Data, Variables> = (\n res: QueryResult<Data, Variables>\n) => void;\n/**\n * Signature for `OnErrorSubscription` for `subscribe`\n */\nexport type OnErrorSubscription = (err?: DataConnectError) => void;\n/**\n * Signature for unsubscribe from `subscribe`\n */\nexport type QueryUnsubscribe = () => void;\n/**\n * Representation of user provided subscription options.\n */\nexport interface DataConnectSubscription<Data, Variables> {\n userCallback: OnResultSubscription<Data, Variables>;\n errCallback?: (e?: DataConnectError) => void;\n unsubscribe: () => void;\n}\n\n/**\n * QueryRef object\n */\nexport interface QueryRef<Data, Variables>\n extends OperationRef<Data, Variables> {\n refType: typeof QUERY_STR;\n}\n/**\n * Result of `executeQuery`\n */\nexport interface QueryResult<Data, Variables>\n extends DataConnectResult<Data, Variables> {\n ref: QueryRef<Data, Variables>;\n toJSON: () => SerializedRef<Data, Variables>;\n}\n/**\n * Promise returned from `executeQuery`\n */\nexport interface QueryPromise<Data, Variables>\n extends PromiseLike<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: variables as 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) {\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 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":["__extends","FirebaseError","Logger","__awaiter","__assign","_removeServiceInstance","app","getApp","_getProvider","SDK_VERSION","_registerComponent","Component","registerVersion"],"mappings":";;;;;;;;;;AAAA;;;;;;;;;;;;;;;AAeG;AAcI,IAAM,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;CACvD,CAAC;AAEF;AACA,IAAA,gBAAA,kBAAA,UAAA,MAAA,EAAA;IAAsCA,eAAa,CAAA,gBAAA,EAAA,MAAA,CAAA,CAAA;;AAKjD,IAAA,SAAA,gBAAA;AACE;;AAEG;IACM,IAA0B;AACnC;;AAEG;IACM,OAAe,EAAA;AAR1B,QAAA,IAAA,KAAA,GAUE,MAAM,CAAA,IAAA,CAAA,IAAA,EAAA,IAAI,EAAE,OAAO,CAAC,IAMrB,IAAA,CAAA;QAZU,KAAI,CAAA,IAAA,GAAJ,IAAI,CAAsB;QAI1B,KAAO,CAAA,OAAA,GAAP,OAAO,CAAQ;;;;QAOxB,KAAI,CAAC,QAAQ,GAAG,YAAA,EAAM,OAAA,EAAG,CAAA,MAAA,CAAA,KAAI,CAAC,IAAI,EAAA,UAAA,CAAA,CAAA,MAAA,CAAW,KAAI,CAAC,IAAI,gBAAM,KAAI,CAAC,OAAO,CAAE,CAAA,EAAA,CAAC;;KAC5E;IACH,OAAC,gBAAA,CAAA;AAAD,CAtBA,CAAsCC,kBAAa,CAsBlD,CAAA;;AC7DD;;;;;;;;;;;;;;;AAeG;AAEH;AACO,IAAI,WAAW,GAAG,EAAE,CAAC;AAE5B;;;AAGG;AACG,SAAU,aAAa,CAAC,OAAe,EAAA;IAC3C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AAE;QACb,MAAM,IAAI,gBAAgB,CAAC,IAAI,CAAC,gBAAgB,EAAE,qBAAqB,CAAC,CAAC;AAC1E,KAAA;AACD,IAAA,OAAO,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;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/internal.d.ts
CHANGED
|
@@ -25,14 +25,27 @@ export declare interface CancellableOperation<T> extends PromiseLike<{
|
|
|
25
25
|
cancel: () => void;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
/**
|
|
29
|
+
* Connect to the DataConnect Emulator
|
|
30
|
+
* @param dc Data Connect instance
|
|
31
|
+
* @param host host of emulator server
|
|
32
|
+
* @param port port of emulator server
|
|
33
|
+
* @param sslEnabled use https
|
|
34
|
+
*/
|
|
28
35
|
export declare function connectDataConnectEmulator(dc: DataConnect, host: string, port?: number, sslEnabled?: boolean): void;
|
|
29
36
|
|
|
37
|
+
/**
|
|
38
|
+
* Connector Config for calling Data Connect backend.
|
|
39
|
+
*/
|
|
30
40
|
export declare interface ConnectorConfig {
|
|
31
41
|
location: string;
|
|
32
42
|
connector: string;
|
|
33
43
|
service: string;
|
|
34
44
|
}
|
|
35
45
|
|
|
46
|
+
/**
|
|
47
|
+
* Class representing Firebase Data Connect
|
|
48
|
+
*/
|
|
36
49
|
export declare class DataConnect {
|
|
37
50
|
readonly app: FirebaseApp;
|
|
38
51
|
private readonly dataConnectOptions;
|
|
@@ -78,6 +91,9 @@ declare class DataConnectError extends FirebaseError {
|
|
|
78
91
|
|
|
79
92
|
declare type DataConnectErrorCode = 'other' | 'already-initialized' | 'not-initialized' | 'not-supported' | 'invalid-argument' | 'partial-error';
|
|
80
93
|
|
|
94
|
+
/**
|
|
95
|
+
* DataConnectOptions including project id
|
|
96
|
+
*/
|
|
81
97
|
export declare interface DataConnectOptions extends ConnectorConfig {
|
|
82
98
|
projectId: string;
|
|
83
99
|
}
|
|
@@ -86,6 +102,9 @@ export declare interface DataConnectResult<Data, Variables> extends OpResult<Dat
|
|
|
86
102
|
ref: OperationRef<Data, Variables>;
|
|
87
103
|
}
|
|
88
104
|
|
|
105
|
+
/**
|
|
106
|
+
* Representation of user provided subscription options.
|
|
107
|
+
*/
|
|
89
108
|
export declare interface DataConnectSubscription<Data, Variables> {
|
|
90
109
|
userCallback: OnResultSubscription<Data, Variables>;
|
|
91
110
|
errCallback?: (e?: DataConnectError) => void;
|
|
@@ -107,8 +126,18 @@ export declare interface DataConnectTransport {
|
|
|
107
126
|
|
|
108
127
|
export declare type DataSource = typeof SOURCE_CACHE | typeof SOURCE_SERVER;
|
|
109
128
|
|
|
129
|
+
/**
|
|
130
|
+
* Execute Mutation
|
|
131
|
+
* @param mutationRef mutation to execute
|
|
132
|
+
* @returns `MutationRef`
|
|
133
|
+
*/
|
|
110
134
|
export declare function executeMutation<Data, Variables>(mutationRef: MutationRef<Data, Variables>): MutationPromise<Data, Variables>;
|
|
111
135
|
|
|
136
|
+
/**
|
|
137
|
+
* Execute Query
|
|
138
|
+
* @param queryRef query to execute.
|
|
139
|
+
* @returns `QueryPromise`
|
|
140
|
+
*/
|
|
112
141
|
export declare function executeQuery<Data, Variables>(queryRef: QueryRef<Data, Variables>): QueryPromise<Data, Variables>;
|
|
113
142
|
|
|
114
143
|
export declare const FIREBASE_DATA_CONNECT_EMULATOR_HOST_VAR = "FIREBASE_DATA_CONNECT_EMULATOR_HOST";
|
|
@@ -124,12 +153,24 @@ export declare class FirebaseAuthProvider implements AuthTokenProvider {
|
|
|
124
153
|
removeTokenChangeListener(listener: (token: string | null) => void): void;
|
|
125
154
|
}
|
|
126
155
|
|
|
156
|
+
/**
|
|
157
|
+
* Initialize DataConnect instance
|
|
158
|
+
* @param options ConnectorConfig
|
|
159
|
+
*/
|
|
127
160
|
export declare function getDataConnect(options: ConnectorConfig): DataConnect;
|
|
128
161
|
|
|
162
|
+
/**
|
|
163
|
+
* Initialize DataConnect instance
|
|
164
|
+
* @param app FirebaseApp to initialize to.
|
|
165
|
+
* @param options ConnectorConfig
|
|
166
|
+
*/
|
|
129
167
|
export declare function getDataConnect(app: FirebaseApp, options: ConnectorConfig): DataConnect;
|
|
130
168
|
|
|
131
169
|
export declare const MUTATION_STR = "mutation";
|
|
132
170
|
|
|
171
|
+
/**
|
|
172
|
+
* @internal
|
|
173
|
+
*/
|
|
133
174
|
export declare class MutationManager {
|
|
134
175
|
private _transport;
|
|
135
176
|
private _inflight;
|
|
@@ -137,6 +178,9 @@ export declare class MutationManager {
|
|
|
137
178
|
executeMutation<Data, Variables>(mutationRef: MutationRef<Data, Variables>): MutationPromise<Data, Variables>;
|
|
138
179
|
}
|
|
139
180
|
|
|
181
|
+
/**
|
|
182
|
+
* Mutation return value from `executeMutation`
|
|
183
|
+
*/
|
|
140
184
|
export declare interface MutationPromise<Data, Variables> extends PromiseLike<MutationResult<Data, Variables>> {
|
|
141
185
|
}
|
|
142
186
|
|
|
@@ -144,21 +188,44 @@ export declare interface MutationRef<Data, Variables> extends OperationRef<Data,
|
|
|
144
188
|
refType: typeof MUTATION_STR;
|
|
145
189
|
}
|
|
146
190
|
|
|
147
|
-
|
|
191
|
+
/**
|
|
192
|
+
* Creates a `MutationRef`
|
|
193
|
+
* @param dcInstance Data Connect instance
|
|
194
|
+
* @param mutationName name of mutation
|
|
195
|
+
*/
|
|
196
|
+
export declare function mutationRef<Data>(dcInstance: DataConnect, mutationName: string): MutationRef<Data, undefined>;
|
|
148
197
|
|
|
198
|
+
/**
|
|
199
|
+
*
|
|
200
|
+
* @param dcInstance Data Connect instance
|
|
201
|
+
* @param mutationName name of mutation
|
|
202
|
+
* @param variables variables to send with mutation
|
|
203
|
+
*/
|
|
149
204
|
export declare function mutationRef<Data, Variables>(dcInstance: DataConnect, mutationName: string, variables: Variables): MutationRef<Data, Variables>;
|
|
150
205
|
|
|
151
206
|
export declare interface MutationResponse<T> extends CancellableOperation<T> {
|
|
152
207
|
}
|
|
153
208
|
|
|
209
|
+
/**
|
|
210
|
+
* Mutation Result from `executeMutation`
|
|
211
|
+
*/
|
|
154
212
|
export declare interface MutationResult<Data, Variables> extends DataConnectResult<Data, Variables> {
|
|
155
213
|
ref: MutationRef<Data, Variables>;
|
|
156
214
|
}
|
|
157
215
|
|
|
216
|
+
/**
|
|
217
|
+
* `OnCompleteSubscription`
|
|
218
|
+
*/
|
|
158
219
|
export declare type OnCompleteSubscription = () => void;
|
|
159
220
|
|
|
221
|
+
/**
|
|
222
|
+
* Signature for `OnErrorSubscription` for `subscribe`
|
|
223
|
+
*/
|
|
160
224
|
export declare type OnErrorSubscription = (err?: DataConnectError) => void;
|
|
161
225
|
|
|
226
|
+
/**
|
|
227
|
+
* Signature for `OnResultSubscription` for `subscribe`
|
|
228
|
+
*/
|
|
162
229
|
export declare type OnResultSubscription<Data, Variables> = (res: QueryResult<Data, Variables>) => void;
|
|
163
230
|
|
|
164
231
|
export declare interface OperationRef<_Data, Variables> {
|
|
@@ -194,29 +261,57 @@ declare class QueryManager {
|
|
|
194
261
|
enableEmulator(host: string, port: number): void;
|
|
195
262
|
}
|
|
196
263
|
|
|
264
|
+
/**
|
|
265
|
+
* Promise returned from `executeQuery`
|
|
266
|
+
*/
|
|
197
267
|
export declare interface QueryPromise<Data, Variables> extends PromiseLike<QueryResult<Data, Variables>> {
|
|
198
268
|
}
|
|
199
269
|
|
|
270
|
+
/**
|
|
271
|
+
* QueryRef object
|
|
272
|
+
*/
|
|
200
273
|
export declare interface QueryRef<Data, Variables> extends OperationRef<Data, Variables> {
|
|
201
274
|
refType: typeof QUERY_STR;
|
|
202
275
|
}
|
|
203
276
|
|
|
277
|
+
/**
|
|
278
|
+
* Execute Query
|
|
279
|
+
* @param dcInstance Data Connect instance to use.
|
|
280
|
+
* @param queryName Query to execute
|
|
281
|
+
* @returns `QueryRef`
|
|
282
|
+
*/
|
|
204
283
|
export declare function queryRef<Data>(dcInstance: DataConnect, queryName: string): QueryRef<Data, undefined>;
|
|
205
284
|
|
|
285
|
+
/**
|
|
286
|
+
* Execute Query
|
|
287
|
+
* @param dcInstance Data Connect instance to use.
|
|
288
|
+
* @param queryName Query to execute
|
|
289
|
+
* @param variables Variables to execute with
|
|
290
|
+
* @returns `QueryRef`
|
|
291
|
+
*/
|
|
206
292
|
export declare function queryRef<Data, Variables>(dcInstance: DataConnect, queryName: string, variables: Variables): QueryRef<Data, Variables>;
|
|
207
293
|
|
|
208
294
|
export declare interface QueryResponse<T> extends CancellableOperation<T> {
|
|
209
295
|
}
|
|
210
296
|
|
|
297
|
+
/**
|
|
298
|
+
* Result of `executeQuery`
|
|
299
|
+
*/
|
|
211
300
|
export declare interface QueryResult<Data, Variables> extends DataConnectResult<Data, Variables> {
|
|
212
301
|
ref: QueryRef<Data, Variables>;
|
|
213
302
|
toJSON: () => SerializedRef<Data, Variables>;
|
|
214
303
|
}
|
|
215
304
|
|
|
305
|
+
/**
|
|
306
|
+
* Signature for unsubscribe from `subscribe`
|
|
307
|
+
*/
|
|
216
308
|
export declare type QueryUnsubscribe = () => void;
|
|
217
309
|
|
|
218
310
|
export declare type ReferenceType = typeof QUERY_STR | typeof MUTATION_STR;
|
|
219
311
|
|
|
312
|
+
/**
|
|
313
|
+
* Serialized RefInfo as a result of `QueryResult.toJSON().refInfo`
|
|
314
|
+
*/
|
|
220
315
|
export declare interface RefInfo<Variables> {
|
|
221
316
|
name: string;
|
|
222
317
|
variables: Variables;
|
|
@@ -228,6 +323,9 @@ export declare interface Sender<T> {
|
|
|
228
323
|
send: () => Promise<T>;
|
|
229
324
|
}
|
|
230
325
|
|
|
326
|
+
/**
|
|
327
|
+
* Serialized Ref as a result of `QueryResult.toJSON()`
|
|
328
|
+
*/
|
|
231
329
|
export declare interface SerializedRef<Data, Variables> extends OpResult<Data> {
|
|
232
330
|
refInfo: RefInfo<Variables>;
|
|
233
331
|
}
|
|
@@ -239,26 +337,44 @@ export declare const SOURCE_CACHE = "CACHE";
|
|
|
239
337
|
export declare const SOURCE_SERVER = "SERVER";
|
|
240
338
|
|
|
241
339
|
/**
|
|
242
|
-
*
|
|
243
|
-
* @
|
|
244
|
-
* @param
|
|
245
|
-
* @
|
|
246
|
-
* @param onErr
|
|
247
|
-
* @param initialCache
|
|
248
|
-
* @returns
|
|
340
|
+
* Subscribe to a `QueryRef`
|
|
341
|
+
* @param queryRefOrSerializedResult query ref or serialized result.
|
|
342
|
+
* @param observer observer object to use for subscribing.
|
|
343
|
+
* @returns `SubscriptionOptions`
|
|
249
344
|
*/
|
|
250
345
|
export declare function subscribe<Data, Variables>(queryRefOrSerializedResult: QueryRef<Data, Variables> | SerializedRef<Data, Variables>, observer: SubscriptionOptions<Data, Variables>): QueryUnsubscribe;
|
|
251
346
|
|
|
347
|
+
/**
|
|
348
|
+
* Subscribe to a `QueryRef`
|
|
349
|
+
* @param queryRefOrSerializedResult query ref or serialized result.
|
|
350
|
+
* @param onNext Callback to call when result comes back.
|
|
351
|
+
* @param onError Callback to call when error gets thrown.
|
|
352
|
+
* @param onComplete Called when subscription completes.
|
|
353
|
+
* @returns `SubscriptionOptions`
|
|
354
|
+
*/
|
|
252
355
|
export declare function subscribe<Data, Variables>(queryRefOrSerializedResult: QueryRef<Data, Variables> | SerializedRef<Data, Variables>, onNext: OnResultSubscription<Data, Variables>, onError?: OnErrorSubscription, onComplete?: OnCompleteSubscription): QueryUnsubscribe;
|
|
253
356
|
|
|
357
|
+
/**
|
|
358
|
+
* Representation of full observer options in `subscribe`
|
|
359
|
+
*/
|
|
254
360
|
export declare interface SubscriptionOptions<Data, Variables> {
|
|
255
361
|
onNext?: OnResultSubscription<Data, Variables>;
|
|
256
362
|
onErr?: OnErrorSubscription;
|
|
257
363
|
onComplete?: OnCompleteSubscription;
|
|
258
364
|
}
|
|
259
365
|
|
|
366
|
+
/**
|
|
367
|
+
* Delete DataConnect instance
|
|
368
|
+
* @param dataConnect DataConnect instance
|
|
369
|
+
* @returns
|
|
370
|
+
*/
|
|
260
371
|
export declare function terminate(dataConnect: DataConnect): Promise<void>;
|
|
261
372
|
|
|
373
|
+
/**
|
|
374
|
+
* Converts serialized ref to query ref
|
|
375
|
+
* @param serializedRef ref to convert to `QueryRef`
|
|
376
|
+
* @returns `QueryRef`
|
|
377
|
+
*/
|
|
262
378
|
export declare function toQueryRef<Data, Variables>(serializedRef: SerializedRef<Data, Variables>): QueryRef<unknown, Variables>;
|
|
263
379
|
|
|
264
380
|
declare interface TrackedQuery<Data, Variables> {
|
|
@@ -270,6 +386,9 @@ declare interface TrackedQuery<Data, Variables> {
|
|
|
270
386
|
|
|
271
387
|
export declare type TransportClass = new (options: DataConnectOptions, apiKey?: string, authProvider?: AuthTokenProvider, transportOptions?: TransportOptions) => DataConnectTransport;
|
|
272
388
|
|
|
389
|
+
/**
|
|
390
|
+
* Options to connect to emulator
|
|
391
|
+
*/
|
|
273
392
|
export declare interface TransportOptions {
|
|
274
393
|
host: string;
|
|
275
394
|
sslEnabled?: boolean;
|