@firebase/data-connect 0.3.12 → 0.4.0-canary.78384d32c

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.
Files changed (64) hide show
  1. package/dist/index.cjs.js +1012 -210
  2. package/dist/index.cjs.js.map +1 -1
  3. package/dist/index.esm.js +1011 -212
  4. package/dist/index.esm.js.map +1 -1
  5. package/dist/index.node.cjs.js +960 -158
  6. package/dist/index.node.cjs.js.map +1 -1
  7. package/dist/internal.d.ts +311 -25
  8. package/dist/node-esm/index.node.esm.js +959 -160
  9. package/dist/node-esm/index.node.esm.js.map +1 -1
  10. package/dist/node-esm/src/api/DataConnect.d.ts +44 -3
  11. package/dist/node-esm/src/api/Reference.d.ts +2 -0
  12. package/dist/node-esm/src/api/index.d.ts +2 -1
  13. package/dist/node-esm/src/api/query.d.ts +9 -26
  14. package/dist/node-esm/src/api.browser.d.ts +2 -18
  15. package/dist/node-esm/src/api.node.d.ts +2 -1
  16. package/dist/node-esm/src/cache/Cache.d.ts +53 -0
  17. package/dist/node-esm/src/cache/CacheProvider.d.ts +25 -0
  18. package/dist/node-esm/src/cache/EntityDataObject.d.ts +37 -0
  19. package/dist/node-esm/src/cache/EntityNode.d.ts +56 -0
  20. package/dist/node-esm/src/cache/ImpactedQueryRefsAccumulator.d.ts +23 -0
  21. package/dist/node-esm/src/cache/InMemoryCacheProvider.d.ts +30 -0
  22. package/dist/node-esm/src/cache/ResultTree.d.ts +42 -0
  23. package/dist/node-esm/src/cache/ResultTreeProcessor.d.ts +40 -0
  24. package/dist/node-esm/src/cache/cacheUtils.d.ts +20 -0
  25. package/dist/node-esm/src/core/FirebaseAuthProvider.d.ts +3 -1
  26. package/dist/node-esm/src/core/query/QueryManager.d.ts +47 -0
  27. package/dist/node-esm/src/core/query/queryOptions.d.ts +25 -0
  28. package/dist/node-esm/src/core/query/subscribe.d.ts +67 -0
  29. package/dist/node-esm/src/network/fetch.d.ts +2 -5
  30. package/dist/node-esm/src/network/index.d.ts +1 -1
  31. package/dist/node-esm/src/network/transport/index.d.ts +37 -8
  32. package/dist/node-esm/src/network/transport/rest.d.ts +5 -17
  33. package/dist/node-esm/src/util/encoder.d.ts +4 -1
  34. package/dist/node-esm/src/util/url.d.ts +1 -0
  35. package/dist/private.d.ts +278 -17
  36. package/dist/public.d.ts +77 -3
  37. package/dist/src/api/DataConnect.d.ts +44 -3
  38. package/dist/src/api/Reference.d.ts +2 -0
  39. package/dist/src/api/index.d.ts +2 -1
  40. package/dist/src/api/query.d.ts +9 -26
  41. package/dist/src/api.browser.d.ts +2 -18
  42. package/dist/src/api.node.d.ts +2 -1
  43. package/dist/src/cache/Cache.d.ts +53 -0
  44. package/dist/src/cache/CacheProvider.d.ts +25 -0
  45. package/dist/src/cache/EntityDataObject.d.ts +37 -0
  46. package/dist/src/cache/EntityNode.d.ts +56 -0
  47. package/dist/src/cache/ImpactedQueryRefsAccumulator.d.ts +23 -0
  48. package/dist/src/cache/InMemoryCacheProvider.d.ts +30 -0
  49. package/dist/src/cache/ResultTree.d.ts +42 -0
  50. package/dist/src/cache/ResultTreeProcessor.d.ts +40 -0
  51. package/dist/src/cache/cacheUtils.d.ts +20 -0
  52. package/dist/src/core/FirebaseAuthProvider.d.ts +3 -1
  53. package/dist/src/core/query/QueryManager.d.ts +47 -0
  54. package/dist/src/core/query/queryOptions.d.ts +25 -0
  55. package/dist/src/core/query/subscribe.d.ts +67 -0
  56. package/dist/src/network/fetch.d.ts +2 -5
  57. package/dist/src/network/index.d.ts +1 -1
  58. package/dist/src/network/transport/index.d.ts +37 -8
  59. package/dist/src/network/transport/rest.d.ts +5 -17
  60. package/dist/src/util/encoder.d.ts +4 -1
  61. package/dist/src/util/url.d.ts +1 -0
  62. package/package.json +7 -7
  63. package/dist/node-esm/src/core/QueryManager.d.ts +0 -45
  64. package/dist/src/core/QueryManager.d.ts +0 -45
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { OpResult } from '../api/Reference';
18
+ import { DataConnectExtension } from '../network';
19
+ export declare function parseEntityIds<T>(result: OpResult<T>): Record<string, unknown>;
20
+ export declare function populatePath(path: Array<string | number>, toUpdate: Record<string | number, unknown>, extension: DataConnectExtension): void;
@@ -15,11 +15,12 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  import { FirebaseOptions } from '@firebase/app-types';
18
- import { FirebaseAuthInternalName, FirebaseAuthTokenData } from '@firebase/auth-interop-types';
18
+ import { FirebaseAuthInternal, FirebaseAuthInternalName, FirebaseAuthTokenData } from '@firebase/auth-interop-types';
19
19
  import { Provider } from '@firebase/component';
20
20
  export interface AuthTokenProvider {
21
21
  getToken(forceRefresh: boolean): Promise<FirebaseAuthTokenData | null>;
22
22
  addTokenChangeListener(listener: AuthTokenListener): void;
23
+ getAuth(): FirebaseAuthInternal;
23
24
  }
24
25
  export type AuthTokenListener = (token: string | null) => void;
25
26
  export declare class FirebaseAuthProvider implements AuthTokenProvider {
@@ -28,6 +29,7 @@ export declare class FirebaseAuthProvider implements AuthTokenProvider {
28
29
  private _authProvider;
29
30
  private _auth;
30
31
  constructor(_appName: string, _options: FirebaseOptions, _authProvider: Provider<FirebaseAuthInternalName>);
32
+ getAuth(): FirebaseAuthInternal;
31
33
  getToken(forceRefresh: boolean): Promise<FirebaseAuthTokenData | null>;
32
34
  addTokenChangeListener(listener: AuthTokenListener): void;
33
35
  removeTokenChangeListener(listener: (token: string | null) => void): void;
@@ -0,0 +1,47 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2024 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { type DataConnect } from '../../api/DataConnect';
18
+ import { QueryRef, QueryResult } from '../../api/query';
19
+ import { SerializedRef, DataSource } from '../../api/Reference';
20
+ import { DataConnectCache } from '../../cache/Cache';
21
+ import { DataConnectTransport } from '../../network';
22
+ import { DataConnectExtensionWithMaxAge } from '../../network/transport';
23
+ import { OnCompleteSubscription, OnErrorSubscription, OnResultSubscription } from './subscribe';
24
+ export declare function getRefSerializer<Data, Variables>(queryRef: QueryRef<Data, Variables>, data: Data, source: DataSource, fetchTime: string): () => SerializedRef<Data, Variables>;
25
+ export declare class QueryManager {
26
+ private transport;
27
+ private dc;
28
+ private cache?;
29
+ preferCacheResults<Data, Variables>(queryRef: QueryRef<Data, Variables>, allowStale?: boolean): Promise<QueryResult<Data, Variables>>;
30
+ private callbacks;
31
+ private subscriptionCache;
32
+ constructor(transport: DataConnectTransport, dc: DataConnect, cache?: DataConnectCache | undefined);
33
+ private queue;
34
+ waitForQueuedWrites(): Promise<void>;
35
+ updateSSR<Data, Variables>(updatedData: QueryResult<Data, Variables>): void;
36
+ updateCache<Data, Variables>(result: QueryResult<Data, Variables>, extensions?: DataConnectExtensionWithMaxAge[]): Promise<string[]>;
37
+ addSubscription<Data, Variables>(queryRef: QueryRef<Data, Variables>, onResultCallback: OnResultSubscription<Data, Variables>, onCompleteCallback?: OnCompleteSubscription, onErrorCallback?: OnErrorSubscription, initialCache?: QueryResult<Data, Variables>): () => void;
38
+ fetchServerResults<Data, Variables>(queryRef: QueryRef<Data, Variables>): Promise<QueryResult<Data, Variables>>;
39
+ fetchCacheResults<Data, Variables>(queryRef: QueryRef<Data, Variables>, allowStale?: boolean): Promise<QueryResult<Data, Variables>>;
40
+ publishErrorToSubscribers(key: string, err: unknown): void;
41
+ getFromResultTreeCache<Data, Variables>(queryRef: QueryRef<Data, Variables>, allowStale?: boolean): Promise<QueryResult<Data, Variables> | null>;
42
+ getFromSubscriberCache<Data, Variables>(queryRef: QueryRef<Data, Variables>): Promise<QueryResult<Data, Variables> | undefined>;
43
+ publishDataToSubscribers(key: string, queryResult: QueryResult<unknown, unknown>): void;
44
+ publishCacheResultsToSubscribers(impactedQueries: string[], fetchTime: string): Promise<void>;
45
+ enableEmulator(host: string, port: number): void;
46
+ }
47
+ export declare function getMaxAgeFromExtensions(extensions: DataConnectExtensionWithMaxAge[] | undefined): number | undefined;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ export declare const QueryFetchPolicy: {
18
+ readonly PREFER_CACHE: "PREFER_CACHE";
19
+ readonly CACHE_ONLY: "CACHE_ONLY";
20
+ readonly SERVER_ONLY: "SERVER_ONLY";
21
+ };
22
+ export type QueryFetchPolicy = (typeof QueryFetchPolicy)[keyof typeof QueryFetchPolicy];
23
+ export interface ExecuteQueryOptions {
24
+ fetchPolicy: QueryFetchPolicy;
25
+ }
@@ -0,0 +1,67 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { QueryRef, QueryResult } from '../../api/query';
18
+ import { SerializedRef } from '../../api/Reference';
19
+ import { DataConnectError } from '../error';
20
+ /**
21
+ * `OnCompleteSubscription`
22
+ */
23
+ export type OnCompleteSubscription = () => void;
24
+ /**
25
+ * Representation of full observer options in `subscribe`
26
+ */
27
+ export interface SubscriptionOptions<Data, Variables> {
28
+ onNext?: OnResultSubscription<Data, Variables>;
29
+ onErr?: OnErrorSubscription;
30
+ onComplete?: OnCompleteSubscription;
31
+ }
32
+ /**
33
+ * Signature for `OnResultSubscription` for `subscribe`
34
+ */
35
+ export type OnResultSubscription<Data, Variables> = (res: QueryResult<Data, Variables>) => void;
36
+ /**
37
+ * Signature for `OnErrorSubscription` for `subscribe`
38
+ */
39
+ export type OnErrorSubscription = (err?: DataConnectError) => void;
40
+ /**
41
+ * Signature for unsubscribe from `subscribe`
42
+ */
43
+ export type QueryUnsubscribe = () => void;
44
+ /**
45
+ * Representation of user provided subscription options.
46
+ */
47
+ export interface DataConnectSubscription<Data, Variables> {
48
+ userCallback: OnResultSubscription<Data, Variables>;
49
+ errCallback?: (e?: DataConnectError) => void;
50
+ unsubscribe: () => void;
51
+ }
52
+ /**
53
+ * Subscribe to a `QueryRef`
54
+ * @param queryRefOrSerializedResult query ref or serialized result.
55
+ * @param observer observer object to use for subscribing.
56
+ * @returns `SubscriptionOptions`
57
+ */
58
+ export declare function subscribe<Data, Variables>(queryRefOrSerializedResult: QueryRef<Data, Variables> | SerializedRef<Data, Variables>, observer: SubscriptionOptions<Data, Variables>): QueryUnsubscribe;
59
+ /**
60
+ * Subscribe to a `QueryRef`
61
+ * @param queryRefOrSerializedResult query ref or serialized result.
62
+ * @param onNext Callback to call when result comes back.
63
+ * @param onError Callback to call when error gets thrown.
64
+ * @param onComplete Called when subscription completes.
65
+ * @returns `SubscriptionOptions`
66
+ */
67
+ export declare function subscribe<Data, Variables>(queryRefOrSerializedResult: QueryRef<Data, Variables> | SerializedRef<Data, Variables>, onNext: OnResultSubscription<Data, Variables>, onError?: OnErrorSubscription, onComplete?: OnCompleteSubscription): QueryUnsubscribe;
@@ -14,14 +14,11 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
- import { CallerSdkType } from './transport';
17
+ import { CallerSdkType, DataConnectResponse } from './transport';
18
18
  export declare function initializeFetch(fetchImpl: typeof fetch): void;
19
19
  export interface DataConnectFetchBody<T> {
20
20
  name: string;
21
21
  operationName: string;
22
22
  variables: T;
23
23
  }
24
- export declare function dcFetch<T, U>(url: string, body: DataConnectFetchBody<U>, { signal }: AbortController, appId: string | null | undefined, accessToken: string | null, appCheckToken: string | null | undefined, _isUsingGen: boolean, _callerSdkType: CallerSdkType, _isUsingEmulator: boolean): Promise<{
25
- data: T;
26
- errors: Error[];
27
- }>;
24
+ export declare function dcFetch<T, U>(url: string, body: DataConnectFetchBody<U>, { signal }: AbortController, appId: string | null | undefined, accessToken: string | null, appCheckToken: string | null | undefined, _isUsingGen: boolean, _callerSdkType: CallerSdkType, _isUsingEmulator: boolean): Promise<DataConnectResponse<T>>;
@@ -14,4 +14,4 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
- export * from './transport';
17
+ export { CallerSdkType, CallerSdkTypeEnum, DataConnectTransport, DataConnectEntityArray, DataConnectSingleEntity, DataConnectExtension, Extensions, TransportClass } from './transport';
@@ -30,18 +30,47 @@ export declare const CallerSdkTypeEnum: {
30
30
  readonly TanstackAngularCore: "TanstackAngularCore";
31
31
  readonly GeneratedAngular: "GeneratedAngular";
32
32
  };
33
+ export interface DataConnectEntityArray {
34
+ entityIds: string[];
35
+ }
36
+ export interface DataConnectSingleEntity {
37
+ entityId: string;
38
+ }
39
+ export type DataConnectExtension = {
40
+ path: Array<string | number>;
41
+ } & (DataConnectEntityArray | DataConnectSingleEntity);
42
+ /** @internal */
43
+ export interface DataConnectMaxAge {
44
+ maxAge: string;
45
+ }
46
+ /** @internal */
47
+ export type DataConnectExtensionWithMaxAge = {
48
+ path: Array<string | number>;
49
+ } & (DataConnectEntityArray | DataConnectSingleEntity | DataConnectMaxAge);
50
+ export interface Extensions {
51
+ dataConnect?: DataConnectExtension[];
52
+ }
53
+ /** @internal */
54
+ export interface ExtensionsWithMaxAge {
55
+ dataConnect?: DataConnectExtensionWithMaxAge[];
56
+ }
57
+ export interface DataConnectResponse<T> {
58
+ data: T;
59
+ errors: Error[];
60
+ extensions: Extensions;
61
+ }
62
+ /** @internal */
63
+ export interface DataConnectResponseWithMaxAge<T> {
64
+ data: T;
65
+ errors: Error[];
66
+ extensions: ExtensionsWithMaxAge;
67
+ }
33
68
  /**
34
69
  * @internal
35
70
  */
36
71
  export interface DataConnectTransport {
37
- invokeQuery<T, U>(queryName: string, body?: U): Promise<{
38
- data: T;
39
- errors: Error[];
40
- }>;
41
- invokeMutation<T, U>(queryName: string, body?: U): Promise<{
42
- data: T;
43
- errors: Error[];
44
- }>;
72
+ invokeQuery<T, U>(queryName: string, body?: U): Promise<DataConnectResponseWithMaxAge<T>>;
73
+ invokeMutation<T, U>(queryName: string, body?: U): Promise<DataConnectResponse<T>>;
45
74
  useEmulator(host: string, port?: number, sslEnabled?: boolean): void;
46
75
  onTokenChanged: (token: string | null) => void;
47
76
  _setCallerSdkType(callerSdkType: CallerSdkType): void;
@@ -17,7 +17,7 @@
17
17
  import { DataConnectOptions, TransportOptions } from '../../api/DataConnect';
18
18
  import { AppCheckTokenProvider } from '../../core/AppCheckTokenProvider';
19
19
  import { AuthTokenProvider } from '../../core/FirebaseAuthProvider';
20
- import { CallerSdkType, DataConnectTransport } from '.';
20
+ import { CallerSdkType, DataConnectResponse, DataConnectTransport } from '.';
21
21
  export declare class RESTTransport implements DataConnectTransport {
22
22
  private apiKey?;
23
23
  private appId?;
@@ -36,26 +36,14 @@ export declare class RESTTransport implements DataConnectTransport {
36
36
  private _appCheckToken;
37
37
  private _lastToken;
38
38
  private _isUsingEmulator;
39
- constructor(options: DataConnectOptions, apiKey?: string | undefined, appId?: string | undefined, authProvider?: AuthTokenProvider | undefined, appCheckProvider?: AppCheckTokenProvider | undefined, transportOptions?: TransportOptions | undefined, _isUsingGen?: boolean, _callerSdkType?: CallerSdkType);
39
+ constructor(options: DataConnectOptions, apiKey?: string | undefined, appId?: (string | null) | undefined, authProvider?: AuthTokenProvider | undefined, appCheckProvider?: AppCheckTokenProvider | undefined, transportOptions?: TransportOptions | undefined, _isUsingGen?: boolean, _callerSdkType?: CallerSdkType);
40
40
  get endpointUrl(): string;
41
41
  useEmulator(host: string, port?: number, isSecure?: boolean): void;
42
42
  onTokenChanged(newToken: string | null): void;
43
43
  getWithAuth(forceToken?: boolean): Promise<string | null>;
44
44
  _setLastToken(lastToken: string | null): void;
45
- withRetry<T>(promiseFactory: () => Promise<{
46
- data: T;
47
- errors: Error[];
48
- }>, retry?: boolean): Promise<{
49
- data: T;
50
- errors: Error[];
51
- }>;
52
- invokeQuery: <T, U>(queryName: string, body?: U) => Promise<{
53
- data: T;
54
- errors: Error[];
55
- }>;
56
- invokeMutation: <T, U>(queryName: string, body?: U) => Promise<{
57
- data: T;
58
- errors: Error[];
59
- }>;
45
+ withRetry<T>(promiseFactory: () => Promise<DataConnectResponse<T>>, retry?: boolean): Promise<DataConnectResponse<T>>;
46
+ invokeQuery: <T, U>(queryName: string, body?: U) => Promise<DataConnectResponse<T>>;
47
+ invokeMutation: <T, U>(queryName: string, body?: U) => Promise<DataConnectResponse<T>>;
60
48
  _setCallerSdkType(callerSdkType: CallerSdkType): void;
61
49
  }
@@ -14,6 +14,9 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
- export type HmacImpl = (obj: unknown) => string;
17
+ export type HmacImpl = (obj: Record<string, unknown>) => string;
18
18
  export declare let encoderImpl: HmacImpl;
19
+ export type DecodeHmacImpl = (s: string) => Record<string, unknown>;
20
+ export declare let decoderImpl: DecodeHmacImpl;
19
21
  export declare function setEncoder(encoder: HmacImpl): void;
22
+ export declare function setDecoder(decoder: DecodeHmacImpl): void;
@@ -15,5 +15,6 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  import { DataConnectOptions, TransportOptions } from '../api/DataConnect';
18
+ export declare const PROD_HOST = "firebasedataconnect.googleapis.com";
18
19
  export declare function urlBuilder(projectConfig: DataConnectOptions, transportOptions: TransportOptions): string;
19
20
  export declare function addToken(url: string, apiKey?: string): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firebase/data-connect",
3
- "version": "0.3.12",
3
+ "version": "0.4.0-canary.78384d32c",
4
4
  "description": "",
5
5
  "author": "Firebase <firebase-support@google.com> (https://firebase.google.com/)",
6
6
  "main": "dist/index.node.cjs.js",
@@ -45,17 +45,17 @@
45
45
  },
46
46
  "license": "Apache-2.0",
47
47
  "peerDependencies": {
48
- "@firebase/app": "0.x"
48
+ "@firebase/app": "0.14.9-canary.78384d32c"
49
49
  },
50
50
  "dependencies": {
51
- "@firebase/auth-interop-types": "0.2.4",
52
- "@firebase/component": "0.7.0",
53
- "@firebase/logger": "0.5.0",
54
- "@firebase/util": "1.13.0",
51
+ "@firebase/auth-interop-types": "0.2.4-canary.78384d32c",
52
+ "@firebase/component": "0.7.1-canary.78384d32c",
53
+ "@firebase/logger": "0.5.0-canary.78384d32c",
54
+ "@firebase/util": "1.14.0-canary.78384d32c",
55
55
  "tslib": "^2.1.0"
56
56
  },
57
57
  "devDependencies": {
58
- "@firebase/app": "0.14.6",
58
+ "@firebase/app": "0.14.9-canary.78384d32c",
59
59
  "rollup": "2.79.2",
60
60
  "rollup-plugin-typescript2": "0.36.0",
61
61
  "typescript": "5.5.4"
@@ -1,45 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2024 Google LLC
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
- import { OnCompleteSubscription, OnErrorSubscription, OnResultSubscription, QueryPromise, QueryRef } from '../api/query';
18
- import { OperationRef, OpResult } from '../api/Reference';
19
- import { DataConnectTransport } from '../network';
20
- import { DataConnectError } from './error';
21
- /**
22
- * Representation of user provided subscription options.
23
- */
24
- interface DataConnectSubscription<Data, Variables> {
25
- userCallback: OnResultSubscription<Data, Variables>;
26
- errCallback?: (e?: DataConnectError) => void;
27
- onCompleteCallback?: () => void;
28
- unsubscribe: () => void;
29
- }
30
- interface TrackedQuery<Data, Variables> {
31
- ref: Omit<OperationRef<Data, Variables>, 'dataConnect'>;
32
- subscriptions: Array<DataConnectSubscription<Data, Variables>>;
33
- currentCache: OpResult<Data> | null;
34
- lastError: DataConnectError | null;
35
- }
36
- export declare class QueryManager {
37
- private transport;
38
- _queries: Map<string, TrackedQuery<unknown, unknown>>;
39
- constructor(transport: DataConnectTransport);
40
- track<Data, Variables>(queryName: string, variables: Variables, initialCache?: OpResult<Data>): TrackedQuery<Data, Variables>;
41
- addSubscription<Data, Variables>(queryRef: OperationRef<Data, Variables>, onResultCallback: OnResultSubscription<Data, Variables>, onCompleteCallback?: OnCompleteSubscription, onErrorCallback?: OnErrorSubscription, initialCache?: OpResult<Data>): () => void;
42
- executeQuery<Data, Variables>(queryRef: QueryRef<Data, Variables>): QueryPromise<Data, Variables>;
43
- enableEmulator(host: string, port: number): void;
44
- }
45
- export {};
@@ -1,45 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2024 Google LLC
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
- import { OnCompleteSubscription, OnErrorSubscription, OnResultSubscription, QueryPromise, QueryRef } from '../api/query';
18
- import { OperationRef, OpResult } from '../api/Reference';
19
- import { DataConnectTransport } from '../network';
20
- import { DataConnectError } from './error';
21
- /**
22
- * Representation of user provided subscription options.
23
- */
24
- interface DataConnectSubscription<Data, Variables> {
25
- userCallback: OnResultSubscription<Data, Variables>;
26
- errCallback?: (e?: DataConnectError) => void;
27
- onCompleteCallback?: () => void;
28
- unsubscribe: () => void;
29
- }
30
- interface TrackedQuery<Data, Variables> {
31
- ref: Omit<OperationRef<Data, Variables>, 'dataConnect'>;
32
- subscriptions: Array<DataConnectSubscription<Data, Variables>>;
33
- currentCache: OpResult<Data> | null;
34
- lastError: DataConnectError | null;
35
- }
36
- export declare class QueryManager {
37
- private transport;
38
- _queries: Map<string, TrackedQuery<unknown, unknown>>;
39
- constructor(transport: DataConnectTransport);
40
- track<Data, Variables>(queryName: string, variables: Variables, initialCache?: OpResult<Data>): TrackedQuery<Data, Variables>;
41
- addSubscription<Data, Variables>(queryRef: OperationRef<Data, Variables>, onResultCallback: OnResultSubscription<Data, Variables>, onCompleteCallback?: OnCompleteSubscription, onErrorCallback?: OnErrorSubscription, initialCache?: OpResult<Data>): () => void;
42
- executeQuery<Data, Variables>(queryRef: QueryRef<Data, Variables>): QueryPromise<Data, Variables>;
43
- enableEmulator(host: string, port: number): void;
44
- }
45
- export {};