@depup/firebase__data-connect 0.4.0-depup.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/README.md +31 -0
  2. package/changes.json +10 -0
  3. package/dist/index.cjs.js +2069 -0
  4. package/dist/index.cjs.js.map +1 -0
  5. package/dist/index.esm.js +2039 -0
  6. package/dist/index.esm.js.map +1 -0
  7. package/dist/index.node.cjs.js +2084 -0
  8. package/dist/index.node.cjs.js.map +1 -0
  9. package/dist/internal.d.ts +748 -0
  10. package/dist/node-esm/index.node.esm.js +2054 -0
  11. package/dist/node-esm/index.node.esm.js.map +1 -0
  12. package/dist/node-esm/package.json +1 -0
  13. package/dist/node-esm/src/api/DataConnect.d.ts +159 -0
  14. package/dist/node-esm/src/api/Mutation.d.ts +61 -0
  15. package/dist/node-esm/src/api/Reference.d.ts +53 -0
  16. package/dist/node-esm/src/api/index.d.ts +25 -0
  17. package/dist/node-esm/src/api/query.d.ts +71 -0
  18. package/dist/node-esm/src/api.browser.d.ts +18 -0
  19. package/dist/node-esm/src/api.node.d.ts +18 -0
  20. package/dist/node-esm/src/cache/Cache.d.ts +53 -0
  21. package/dist/node-esm/src/cache/CacheProvider.d.ts +25 -0
  22. package/dist/node-esm/src/cache/EntityDataObject.d.ts +37 -0
  23. package/dist/node-esm/src/cache/EntityNode.d.ts +56 -0
  24. package/dist/node-esm/src/cache/ImpactedQueryRefsAccumulator.d.ts +23 -0
  25. package/dist/node-esm/src/cache/InMemoryCacheProvider.d.ts +30 -0
  26. package/dist/node-esm/src/cache/ResultTree.d.ts +42 -0
  27. package/dist/node-esm/src/cache/ResultTreeProcessor.d.ts +40 -0
  28. package/dist/node-esm/src/cache/cacheUtils.d.ts +20 -0
  29. package/dist/node-esm/src/core/AppCheckTokenProvider.d.ts +31 -0
  30. package/dist/node-esm/src/core/FirebaseAuthProvider.d.ts +36 -0
  31. package/dist/node-esm/src/core/error.d.ts +53 -0
  32. package/dist/node-esm/src/core/query/QueryManager.d.ts +47 -0
  33. package/dist/node-esm/src/core/query/queryOptions.d.ts +25 -0
  34. package/dist/node-esm/src/core/query/subscribe.d.ts +67 -0
  35. package/dist/node-esm/src/core/version.d.ts +23 -0
  36. package/dist/node-esm/src/index.d.ts +29 -0
  37. package/dist/node-esm/src/index.node.d.ts +18 -0
  38. package/dist/node-esm/src/logger.d.ts +20 -0
  39. package/dist/node-esm/src/network/fetch.d.ts +24 -0
  40. package/dist/node-esm/src/network/index.d.ts +17 -0
  41. package/dist/node-esm/src/network/transport/index.d.ts +81 -0
  42. package/dist/node-esm/src/network/transport/rest.d.ts +49 -0
  43. package/dist/node-esm/src/register.d.ts +1 -0
  44. package/dist/node-esm/src/util/encoder.d.ts +22 -0
  45. package/dist/node-esm/src/util/map.d.ts +17 -0
  46. package/dist/node-esm/src/util/url.d.ts +20 -0
  47. package/dist/node-esm/src/util/validateArgs.d.ts +33 -0
  48. package/dist/private.d.ts +655 -0
  49. package/dist/public.d.ts +350 -0
  50. package/dist/src/api/DataConnect.d.ts +159 -0
  51. package/dist/src/api/Mutation.d.ts +61 -0
  52. package/dist/src/api/Reference.d.ts +53 -0
  53. package/dist/src/api/index.d.ts +25 -0
  54. package/dist/src/api/query.d.ts +71 -0
  55. package/dist/src/api.browser.d.ts +18 -0
  56. package/dist/src/api.node.d.ts +18 -0
  57. package/dist/src/cache/Cache.d.ts +53 -0
  58. package/dist/src/cache/CacheProvider.d.ts +25 -0
  59. package/dist/src/cache/EntityDataObject.d.ts +37 -0
  60. package/dist/src/cache/EntityNode.d.ts +56 -0
  61. package/dist/src/cache/ImpactedQueryRefsAccumulator.d.ts +23 -0
  62. package/dist/src/cache/InMemoryCacheProvider.d.ts +30 -0
  63. package/dist/src/cache/ResultTree.d.ts +42 -0
  64. package/dist/src/cache/ResultTreeProcessor.d.ts +40 -0
  65. package/dist/src/cache/cacheUtils.d.ts +20 -0
  66. package/dist/src/core/AppCheckTokenProvider.d.ts +31 -0
  67. package/dist/src/core/FirebaseAuthProvider.d.ts +36 -0
  68. package/dist/src/core/error.d.ts +53 -0
  69. package/dist/src/core/query/QueryManager.d.ts +47 -0
  70. package/dist/src/core/query/queryOptions.d.ts +25 -0
  71. package/dist/src/core/query/subscribe.d.ts +67 -0
  72. package/dist/src/core/version.d.ts +23 -0
  73. package/dist/src/index.d.ts +29 -0
  74. package/dist/src/index.node.d.ts +18 -0
  75. package/dist/src/logger.d.ts +20 -0
  76. package/dist/src/network/fetch.d.ts +24 -0
  77. package/dist/src/network/index.d.ts +17 -0
  78. package/dist/src/network/transport/index.d.ts +81 -0
  79. package/dist/src/network/transport/rest.d.ts +49 -0
  80. package/dist/src/register.d.ts +1 -0
  81. package/dist/src/tsdoc-metadata.json +11 -0
  82. package/dist/src/util/encoder.d.ts +22 -0
  83. package/dist/src/util/map.d.ts +17 -0
  84. package/dist/src/util/url.d.ts +20 -0
  85. package/dist/src/util/validateArgs.d.ts +33 -0
  86. package/package.json +99 -0
@@ -0,0 +1,53 @@
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 { Extensions } from '../network';
18
+ import { DataConnect, DataConnectOptions } from './DataConnect';
19
+ export declare const QUERY_STR = "query";
20
+ export declare const MUTATION_STR = "mutation";
21
+ export type ReferenceType = typeof QUERY_STR | typeof MUTATION_STR;
22
+ export declare const SOURCE_SERVER = "SERVER";
23
+ export declare const SOURCE_CACHE = "CACHE";
24
+ export type DataSource = typeof SOURCE_CACHE | typeof SOURCE_SERVER;
25
+ export interface OpResult<Data> {
26
+ data: Data;
27
+ source: DataSource;
28
+ fetchTime: string;
29
+ extensions?: Extensions;
30
+ }
31
+ export interface OperationRef<_Data, Variables> {
32
+ name: string;
33
+ variables: Variables;
34
+ refType: ReferenceType;
35
+ dataConnect: DataConnect;
36
+ }
37
+ export interface DataConnectResult<Data, Variables> extends OpResult<Data> {
38
+ ref: OperationRef<Data, Variables>;
39
+ }
40
+ /**
41
+ * Serialized RefInfo as a result of `QueryResult.toJSON().refInfo`
42
+ */
43
+ export interface RefInfo<Variables> {
44
+ name: string;
45
+ variables: Variables;
46
+ connectorConfig: DataConnectOptions;
47
+ }
48
+ /**
49
+ * Serialized Ref as a result of `QueryResult.toJSON()`
50
+ */
51
+ export interface SerializedRef<Data, Variables> extends OpResult<Data> {
52
+ refInfo: RefInfo<Variables>;
53
+ }
@@ -0,0 +1,25 @@
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
+ export * from '../network';
18
+ export { ExecuteQueryOptions, QueryFetchPolicy } from '../core/query/queryOptions';
19
+ export { CacheSettings, validateDCOptions, ConnectorConfig, DataConnect, DataConnectOptions, DataConnectSettings, StorageType, TransportOptions, areTransportOptionsEqual, connectDataConnectEmulator, getDataConnect, parseOptions, terminate } from './DataConnect';
20
+ export * from './Reference';
21
+ export * from './Mutation';
22
+ export * from './query';
23
+ export { setLogLevel } from '../logger';
24
+ export { validateArgs } from '../util/validateArgs';
25
+ export { DataConnectErrorCode, Code, DataConnectError, DataConnectOperationError, DataConnectOperationFailureResponse, DataConnectOperationFailureResponseErrorInfo } from '../core/error';
@@ -0,0 +1,71 @@
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 { ExecuteQueryOptions } from '../core/query/queryOptions';
18
+ import { DataConnectExtensionWithMaxAge } from '../network/transport';
19
+ import { DataConnect } from './DataConnect';
20
+ import { OperationRef, QUERY_STR, DataConnectResult, SerializedRef } from './Reference';
21
+ /**
22
+ * QueryRef object
23
+ */
24
+ export interface QueryRef<Data, Variables> extends OperationRef<Data, Variables> {
25
+ refType: typeof QUERY_STR;
26
+ }
27
+ /** @internal */
28
+ export type InternalQueryResult<Data, Variables> = QueryResult<Data, Variables> & Omit<DataConnectResult<Data, Variables>, 'extensions'> & {
29
+ extensions?: {
30
+ dataConnect?: DataConnectExtensionWithMaxAge[];
31
+ };
32
+ };
33
+ /**
34
+ * Result of `executeQuery`
35
+ */
36
+ export interface QueryResult<Data, Variables> extends DataConnectResult<Data, Variables> {
37
+ ref: QueryRef<Data, Variables>;
38
+ toJSON: () => SerializedRef<Data, Variables>;
39
+ }
40
+ /**
41
+ * Promise returned from `executeQuery`
42
+ */
43
+ export interface QueryPromise<Data, Variables> extends Promise<QueryResult<Data, Variables>> {
44
+ }
45
+ /**
46
+ * Execute Query
47
+ * @param queryRef query to execute.
48
+ * @returns `QueryPromise`
49
+ */
50
+ export declare function executeQuery<Data, Variables>(queryRef: QueryRef<Data, Variables>, options?: ExecuteQueryOptions): QueryPromise<Data, Variables>;
51
+ /**
52
+ * Execute Query
53
+ * @param dcInstance Data Connect instance to use.
54
+ * @param queryName Query to execute
55
+ * @returns `QueryRef`
56
+ */
57
+ export declare function queryRef<Data>(dcInstance: DataConnect, queryName: string): QueryRef<Data, undefined>;
58
+ /**
59
+ * Execute Query
60
+ * @param dcInstance Data Connect instance to use.
61
+ * @param queryName Query to execute
62
+ * @param variables Variables to execute with
63
+ * @returns `QueryRef`
64
+ */
65
+ export declare function queryRef<Data, Variables>(dcInstance: DataConnect, queryName: string, variables: Variables): QueryRef<Data, Variables>;
66
+ /**
67
+ * Converts serialized ref to query ref
68
+ * @param serializedRef ref to convert to `QueryRef`
69
+ * @returns `QueryRef`
70
+ */
71
+ export declare function toQueryRef<Data, Variables>(serializedRef: SerializedRef<Data, Variables>): QueryRef<Data, Variables>;
@@ -0,0 +1,18 @@
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
+ export * from './core/query/subscribe';
18
+ export { makeMemoryCacheProvider, CacheProvider } from './api/DataConnect';
@@ -0,0 +1,18 @@
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
+ export * from './core/query/subscribe';
18
+ export { makeMemoryCacheProvider, CacheProvider } from './api/DataConnect';
@@ -0,0 +1,53 @@
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 { CacheProvider, CacheSettings, type ConnectorConfig } from '../api/DataConnect';
18
+ import { type AuthTokenProvider } from '../core/FirebaseAuthProvider';
19
+ import { InternalCacheProvider } from './CacheProvider';
20
+ import { InMemoryCacheProvider } from './InMemoryCacheProvider';
21
+ import { ResultTree } from './ResultTree';
22
+ export declare const Memory = "memory";
23
+ export type DataConnectStorage = typeof Memory;
24
+ /**
25
+ * ServerValues
26
+ */
27
+ export interface ServerValues extends Record<string, unknown> {
28
+ maxAge?: number;
29
+ }
30
+ export declare class DataConnectCache {
31
+ private authProvider;
32
+ private projectId;
33
+ private connectorConfig;
34
+ private host;
35
+ cacheSettings: CacheSettings;
36
+ private cacheProvider;
37
+ private uid;
38
+ constructor(authProvider: AuthTokenProvider, projectId: string, connectorConfig: ConnectorConfig, host: string, cacheSettings: CacheSettings);
39
+ initialize(): Promise<void>;
40
+ getIdentifier(uid: string | null): Promise<string>;
41
+ initializeNewProviders(identifier: string): InternalCacheProvider;
42
+ containsResultTree(queryId: string): Promise<boolean>;
43
+ getResultTree(queryId: string): Promise<ResultTree | undefined>;
44
+ getResultJSON(queryId: string): Promise<Record<string, unknown>>;
45
+ update(queryId: string, serverValues: ServerValues, entityIds: Record<string, unknown>): Promise<string[]>;
46
+ }
47
+ export declare class MemoryStub implements CacheProvider<'MEMORY'> {
48
+ type: 'MEMORY';
49
+ /**
50
+ * @internal
51
+ */
52
+ initialize(cacheId: string): InMemoryCacheProvider;
53
+ }
@@ -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
+ import { EntityDataObject } from './EntityDataObject';
18
+ import { ResultTree } from './ResultTree';
19
+ export interface InternalCacheProvider {
20
+ getEntityData(globalId: string): Promise<EntityDataObject>;
21
+ updateEntityData(entityData: EntityDataObject): Promise<void>;
22
+ getResultTree(queryId: string): Promise<ResultTree | undefined>;
23
+ setResultTree(queryId: string, resultTree: ResultTree): Promise<void>;
24
+ close(): void;
25
+ }
@@ -0,0 +1,37 @@
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 type FDCScalarValue = string | number | boolean | undefined | null | Record<string, unknown> | FDCScalarValue[];
18
+ export interface EntityDataObjectJson {
19
+ map: {
20
+ [key: string]: FDCScalarValue;
21
+ };
22
+ referencedFrom: string[];
23
+ globalID: string;
24
+ }
25
+ export declare class EntityDataObject {
26
+ readonly globalID: string;
27
+ getServerValue(key: string): unknown;
28
+ private serverValues;
29
+ private referencedFrom;
30
+ constructor(globalID: string);
31
+ getServerValues(): {
32
+ [key: string]: FDCScalarValue;
33
+ };
34
+ toJSON(): EntityDataObjectJson;
35
+ static fromJSON(json: EntityDataObjectJson): EntityDataObject;
36
+ updateServerValue(key: string, value: FDCScalarValue, requestedFrom: string): string[];
37
+ }
@@ -0,0 +1,56 @@
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 { InternalCacheProvider } from './CacheProvider';
18
+ import { EntityDataObject, EntityDataObjectJson, FDCScalarValue } from './EntityDataObject';
19
+ import { ImpactedQueryRefsAccumulator } from './ImpactedQueryRefsAccumulator';
20
+ export declare const GLOBAL_ID_KEY = "_id";
21
+ export declare const OBJECT_LISTS_KEY = "_objectLists";
22
+ export declare const REFERENCES_KEY = "_references";
23
+ export declare const SCALARS_KEY = "_scalars";
24
+ export declare const ENTITY_DATA_KEYS_KEY = "_entity_data_keys";
25
+ export declare class EntityNode {
26
+ entityData?: EntityDataObject;
27
+ scalars: Record<string, FDCScalarValue>;
28
+ references: {
29
+ [key: string]: EntityNode;
30
+ };
31
+ objectLists: {
32
+ [key: string]: EntityNode[];
33
+ };
34
+ globalId?: string;
35
+ entityDataKeys: Set<string>;
36
+ loadData(queryId: string, values: FDCScalarValue, entityIds: Record<string, unknown> | undefined, acc: ImpactedQueryRefsAccumulator, cacheProvider: InternalCacheProvider): Promise<void>;
37
+ toJSON(mode: EncodingMode): Record<string, unknown>;
38
+ static fromJson(obj: DehydratedStubDataObject): EntityNode;
39
+ }
40
+ export interface DehydratedStubDataObject {
41
+ backingData?: EntityDataObjectJson;
42
+ globalID?: string;
43
+ scalars: {
44
+ [key: string]: FDCScalarValue;
45
+ };
46
+ references: {
47
+ [key: string]: DehydratedStubDataObject;
48
+ };
49
+ objectLists: {
50
+ [key: string]: DehydratedStubDataObject[];
51
+ };
52
+ }
53
+ export declare enum EncodingMode {
54
+ hydrated = 0,
55
+ dehydrated = 1
56
+ }
@@ -0,0 +1,23 @@
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 class ImpactedQueryRefsAccumulator {
18
+ private queryId;
19
+ impacted: Set<string>;
20
+ constructor(queryId: string);
21
+ add(impacted: string[]): void;
22
+ consumeEvents(): string[];
23
+ }
@@ -0,0 +1,30 @@
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 { InternalCacheProvider } from './CacheProvider';
18
+ import { EntityDataObject } from './EntityDataObject';
19
+ import { ResultTree } from './ResultTree';
20
+ export declare class InMemoryCacheProvider implements InternalCacheProvider {
21
+ private _keyId;
22
+ private edos;
23
+ private resultTrees;
24
+ constructor(_keyId: string);
25
+ setResultTree(queryId: string, rt: ResultTree): Promise<void>;
26
+ getResultTree(queryId: string): Promise<ResultTree | undefined>;
27
+ updateEntityData(entityData: EntityDataObject): Promise<void>;
28
+ getEntityData(globalId: string): Promise<EntityDataObject>;
29
+ close(): Promise<void>;
30
+ }
@@ -0,0 +1,42 @@
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 { EntityNode, DehydratedStubDataObject } from './EntityNode';
18
+ export declare class ResultTree {
19
+ private rootStub;
20
+ private maxAge;
21
+ readonly cachedAt: Date;
22
+ private _lastAccessed;
23
+ /**
24
+ * Create a {@link ResultTree} from a dehydrated JSON object.
25
+ * @param value The dehydrated JSON object.
26
+ * @returns The {@link ResultTree}.
27
+ */
28
+ static fromJson(value: DehydratedResultTreeJson): ResultTree;
29
+ constructor(rootStub: EntityNode, maxAge: number, cachedAt: Date, _lastAccessed: Date);
30
+ isStale(): boolean;
31
+ updateMaxAge(maxAgeInSeconds: number): void;
32
+ updateAccessed(): void;
33
+ get lastAccessed(): Date;
34
+ getRootStub(): EntityNode;
35
+ }
36
+ interface DehydratedResultTreeJson {
37
+ rootStub: DehydratedStubDataObject;
38
+ maxAge: number;
39
+ cachedAt: Date;
40
+ lastAccessed: Date;
41
+ }
42
+ export {};
@@ -0,0 +1,40 @@
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 { InternalCacheProvider } from './CacheProvider';
18
+ import { EntityNode } from './EntityNode';
19
+ interface DehydratedResults {
20
+ entityNode: EntityNode;
21
+ impacted: string[];
22
+ }
23
+ export declare class ResultTreeProcessor {
24
+ /**
25
+ * Hydrate the EntityNode into a JSON object so that it can be returned to the user.
26
+ * @param rootStubObject
27
+ * @returns {string}
28
+ */
29
+ hydrateResults(rootStubObject: EntityNode): Record<string, unknown>;
30
+ /**
31
+ * Dehydrate results so that they can be stored in the cache.
32
+ * @param json
33
+ * @param entityIds
34
+ * @param cacheProvider
35
+ * @param queryId
36
+ * @returns {Promise<DehydratedResults>}
37
+ */
38
+ dehydrateResults(json: Record<string, unknown>, entityIds: Record<string, unknown>, cacheProvider: InternalCacheProvider, queryId: string): Promise<DehydratedResults>;
39
+ }
40
+ export {};
@@ -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;
@@ -0,0 +1,31 @@
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 { FirebaseApp } from '@firebase/app';
18
+ import { AppCheckInternalComponentName, AppCheckTokenListener, AppCheckTokenResult } from '@firebase/app-check-interop-types';
19
+ import { Provider } from '@firebase/component';
20
+ /**
21
+ * @internal
22
+ * Abstraction around AppCheck's token fetching capabilities.
23
+ */
24
+ export declare class AppCheckTokenProvider {
25
+ private appCheckProvider?;
26
+ private appCheck?;
27
+ private serverAppAppCheckToken?;
28
+ constructor(app: FirebaseApp, appCheckProvider?: Provider<AppCheckInternalComponentName> | undefined);
29
+ getToken(): Promise<AppCheckTokenResult | null>;
30
+ addTokenChangeListener(listener: AppCheckTokenListener): void;
31
+ }
@@ -0,0 +1,36 @@
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 { FirebaseOptions } from '@firebase/app-types';
18
+ import { FirebaseAuthInternal, FirebaseAuthInternalName, FirebaseAuthTokenData } from '@firebase/auth-interop-types';
19
+ import { Provider } from '@firebase/component';
20
+ export interface AuthTokenProvider {
21
+ getToken(forceRefresh: boolean): Promise<FirebaseAuthTokenData | null>;
22
+ addTokenChangeListener(listener: AuthTokenListener): void;
23
+ getAuth(): FirebaseAuthInternal;
24
+ }
25
+ export type AuthTokenListener = (token: string | null) => void;
26
+ export declare class FirebaseAuthProvider implements AuthTokenProvider {
27
+ private _appName;
28
+ private _options;
29
+ private _authProvider;
30
+ private _auth;
31
+ constructor(_appName: string, _options: FirebaseOptions, _authProvider: Provider<FirebaseAuthInternalName>);
32
+ getAuth(): FirebaseAuthInternal;
33
+ getToken(forceRefresh: boolean): Promise<FirebaseAuthTokenData | null>;
34
+ addTokenChangeListener(listener: AuthTokenListener): void;
35
+ removeTokenChangeListener(listener: (token: string | null) => void): void;
36
+ }
@@ -0,0 +1,53 @@
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 { FirebaseError } from '@firebase/util';
18
+ export type DataConnectErrorCode = 'other' | 'already-initialized' | 'not-initialized' | 'not-supported' | 'invalid-argument' | 'partial-error' | 'unauthorized';
19
+ export type Code = DataConnectErrorCode;
20
+ export declare const Code: {
21
+ OTHER: DataConnectErrorCode;
22
+ ALREADY_INITIALIZED: DataConnectErrorCode;
23
+ NOT_INITIALIZED: DataConnectErrorCode;
24
+ NOT_SUPPORTED: DataConnectErrorCode;
25
+ INVALID_ARGUMENT: DataConnectErrorCode;
26
+ PARTIAL_ERROR: DataConnectErrorCode;
27
+ UNAUTHORIZED: DataConnectErrorCode;
28
+ };
29
+ /** An error returned by a DataConnect operation. */
30
+ export declare class DataConnectError extends FirebaseError {
31
+ /** @internal */
32
+ readonly name: string;
33
+ constructor(code: Code, message: string);
34
+ /** @internal */
35
+ toString(): string;
36
+ }
37
+ /** An error returned by a DataConnect operation. */
38
+ export declare class DataConnectOperationError extends DataConnectError {
39
+ /** @internal */
40
+ readonly name: string;
41
+ /** The response received from the backend. */
42
+ readonly response: DataConnectOperationFailureResponse;
43
+ /** @hideconstructor */
44
+ constructor(message: string, response: DataConnectOperationFailureResponse);
45
+ }
46
+ export interface DataConnectOperationFailureResponse {
47
+ readonly data?: Record<string, unknown> | null;
48
+ readonly errors: DataConnectOperationFailureResponseErrorInfo[];
49
+ }
50
+ export interface DataConnectOperationFailureResponseErrorInfo {
51
+ readonly message: string;
52
+ readonly path: Array<string | number>;
53
+ }