@firebase/data-connect 0.1.1 → 0.1.2

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 (57) hide show
  1. package/dist/index.cjs.js +1108 -1108
  2. package/dist/index.cjs.js.map +1 -1
  3. package/dist/index.esm2017.js +1108 -1108
  4. package/dist/index.esm2017.js.map +1 -1
  5. package/dist/index.node.cjs.js +1123 -1123
  6. package/dist/index.node.cjs.js.map +1 -1
  7. package/dist/node-esm/index.node.esm.js +1123 -1123
  8. package/dist/node-esm/index.node.esm.js.map +1 -1
  9. package/dist/node-esm/src/api/DataConnect.d.ts +108 -108
  10. package/dist/node-esm/src/api/Mutation.d.ts +61 -61
  11. package/dist/node-esm/src/api/Reference.d.ts +51 -51
  12. package/dist/node-esm/src/api/index.d.ts +23 -23
  13. package/dist/node-esm/src/api/query.d.ts +96 -96
  14. package/dist/node-esm/src/api.browser.d.ts +34 -34
  15. package/dist/node-esm/src/api.node.d.ts +17 -17
  16. package/dist/node-esm/src/core/AppCheckTokenProvider.d.ts +30 -30
  17. package/dist/node-esm/src/core/FirebaseAuthProvider.d.ts +34 -34
  18. package/dist/node-esm/src/core/QueryManager.d.ts +36 -36
  19. package/dist/node-esm/src/core/error.d.ts +51 -51
  20. package/dist/node-esm/src/core/version.d.ts +23 -23
  21. package/dist/node-esm/src/index.d.ts +29 -29
  22. package/dist/node-esm/src/index.node.d.ts +18 -18
  23. package/dist/node-esm/src/logger.d.ts +20 -20
  24. package/dist/node-esm/src/network/fetch.d.ts +21 -21
  25. package/dist/node-esm/src/network/index.d.ts +17 -17
  26. package/dist/node-esm/src/network/transport/index.d.ts +43 -43
  27. package/dist/node-esm/src/network/transport/rest.d.ts +58 -58
  28. package/dist/node-esm/src/register.d.ts +1 -1
  29. package/dist/node-esm/src/util/encoder.d.ts +19 -19
  30. package/dist/node-esm/src/util/map.d.ts +17 -17
  31. package/dist/node-esm/src/util/url.d.ts +19 -19
  32. package/dist/node-esm/src/util/validateArgs.d.ts +33 -33
  33. package/dist/src/api/DataConnect.d.ts +108 -108
  34. package/dist/src/api/Mutation.d.ts +61 -61
  35. package/dist/src/api/Reference.d.ts +51 -51
  36. package/dist/src/api/index.d.ts +23 -23
  37. package/dist/src/api/query.d.ts +96 -96
  38. package/dist/src/api.browser.d.ts +34 -34
  39. package/dist/src/api.node.d.ts +17 -17
  40. package/dist/src/core/AppCheckTokenProvider.d.ts +30 -30
  41. package/dist/src/core/FirebaseAuthProvider.d.ts +34 -34
  42. package/dist/src/core/QueryManager.d.ts +36 -36
  43. package/dist/src/core/error.d.ts +51 -51
  44. package/dist/src/core/version.d.ts +23 -23
  45. package/dist/src/index.d.ts +29 -29
  46. package/dist/src/index.node.d.ts +18 -18
  47. package/dist/src/logger.d.ts +20 -20
  48. package/dist/src/network/fetch.d.ts +21 -21
  49. package/dist/src/network/index.d.ts +17 -17
  50. package/dist/src/network/transport/index.d.ts +43 -43
  51. package/dist/src/network/transport/rest.d.ts +58 -58
  52. package/dist/src/register.d.ts +1 -1
  53. package/dist/src/util/encoder.d.ts +19 -19
  54. package/dist/src/util/map.d.ts +17 -17
  55. package/dist/src/util/url.d.ts +19 -19
  56. package/dist/src/util/validateArgs.d.ts +33 -33
  57. package/package.json +7 -7
@@ -1,108 +1,108 @@
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 } from '@firebase/app-check-interop-types';
19
- import { FirebaseAuthInternalName } from '@firebase/auth-interop-types';
20
- import { Provider } from '@firebase/component';
21
- import { QueryManager } from '../core/QueryManager';
22
- import { MutationManager } from './Mutation';
23
- /**
24
- * Connector Config for calling Data Connect backend.
25
- */
26
- export interface ConnectorConfig {
27
- location: string;
28
- connector: string;
29
- service: string;
30
- }
31
- /**
32
- * Options to connect to emulator
33
- */
34
- export interface TransportOptions {
35
- host: string;
36
- sslEnabled?: boolean;
37
- port?: number;
38
- }
39
- /**
40
- *
41
- * @param fullHost
42
- * @returns TransportOptions
43
- * @internal
44
- */
45
- export declare function parseOptions(fullHost: string): TransportOptions;
46
- /**
47
- * DataConnectOptions including project id
48
- */
49
- export interface DataConnectOptions extends ConnectorConfig {
50
- projectId: string;
51
- }
52
- /**
53
- * Class representing Firebase Data Connect
54
- */
55
- export declare class DataConnect {
56
- readonly app: FirebaseApp;
57
- private readonly dataConnectOptions;
58
- private readonly _authProvider;
59
- private readonly _appCheckProvider;
60
- _queryManager: QueryManager;
61
- _mutationManager: MutationManager;
62
- isEmulator: boolean;
63
- _initialized: boolean;
64
- private _transport;
65
- private _transportClass;
66
- private _transportOptions?;
67
- private _authTokenProvider?;
68
- _isUsingGeneratedSdk: boolean;
69
- private _appCheckTokenProvider?;
70
- constructor(app: FirebaseApp, dataConnectOptions: DataConnectOptions, _authProvider: Provider<FirebaseAuthInternalName>, _appCheckProvider: Provider<AppCheckInternalComponentName>);
71
- _useGeneratedSdk(): void;
72
- _delete(): Promise<void>;
73
- getSettings(): ConnectorConfig;
74
- setInitialized(): void;
75
- enableEmulator(transportOptions: TransportOptions): void;
76
- }
77
- /**
78
- * Connect to the DataConnect Emulator
79
- * @param dc Data Connect instance
80
- * @param host host of emulator server
81
- * @param port port of emulator server
82
- * @param sslEnabled use https
83
- */
84
- export declare function connectDataConnectEmulator(dc: DataConnect, host: string, port?: number, sslEnabled?: boolean): void;
85
- /**
86
- * Initialize DataConnect instance
87
- * @param options ConnectorConfig
88
- */
89
- export declare function getDataConnect(options: ConnectorConfig): DataConnect;
90
- /**
91
- * Initialize DataConnect instance
92
- * @param app FirebaseApp to initialize to.
93
- * @param options ConnectorConfig
94
- */
95
- export declare function getDataConnect(app: FirebaseApp, options: ConnectorConfig): DataConnect;
96
- /**
97
- *
98
- * @param dcOptions
99
- * @returns {void}
100
- * @internal
101
- */
102
- export declare function validateDCOptions(dcOptions: ConnectorConfig): boolean;
103
- /**
104
- * Delete DataConnect instance
105
- * @param dataConnect DataConnect instance
106
- * @returns
107
- */
108
- export declare function terminate(dataConnect: DataConnect): Promise<void>;
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 } from '@firebase/app-check-interop-types';
19
+ import { FirebaseAuthInternalName } from '@firebase/auth-interop-types';
20
+ import { Provider } from '@firebase/component';
21
+ import { QueryManager } from '../core/QueryManager';
22
+ import { MutationManager } from './Mutation';
23
+ /**
24
+ * Connector Config for calling Data Connect backend.
25
+ */
26
+ export interface ConnectorConfig {
27
+ location: string;
28
+ connector: string;
29
+ service: string;
30
+ }
31
+ /**
32
+ * Options to connect to emulator
33
+ */
34
+ export interface TransportOptions {
35
+ host: string;
36
+ sslEnabled?: boolean;
37
+ port?: number;
38
+ }
39
+ /**
40
+ *
41
+ * @param fullHost
42
+ * @returns TransportOptions
43
+ * @internal
44
+ */
45
+ export declare function parseOptions(fullHost: string): TransportOptions;
46
+ /**
47
+ * DataConnectOptions including project id
48
+ */
49
+ export interface DataConnectOptions extends ConnectorConfig {
50
+ projectId: string;
51
+ }
52
+ /**
53
+ * Class representing Firebase Data Connect
54
+ */
55
+ export declare class DataConnect {
56
+ readonly app: FirebaseApp;
57
+ private readonly dataConnectOptions;
58
+ private readonly _authProvider;
59
+ private readonly _appCheckProvider;
60
+ _queryManager: QueryManager;
61
+ _mutationManager: MutationManager;
62
+ isEmulator: boolean;
63
+ _initialized: boolean;
64
+ private _transport;
65
+ private _transportClass;
66
+ private _transportOptions?;
67
+ private _authTokenProvider?;
68
+ _isUsingGeneratedSdk: boolean;
69
+ private _appCheckTokenProvider?;
70
+ constructor(app: FirebaseApp, dataConnectOptions: DataConnectOptions, _authProvider: Provider<FirebaseAuthInternalName>, _appCheckProvider: Provider<AppCheckInternalComponentName>);
71
+ _useGeneratedSdk(): void;
72
+ _delete(): Promise<void>;
73
+ getSettings(): ConnectorConfig;
74
+ setInitialized(): void;
75
+ enableEmulator(transportOptions: TransportOptions): void;
76
+ }
77
+ /**
78
+ * Connect to the DataConnect Emulator
79
+ * @param dc Data Connect instance
80
+ * @param host host of emulator server
81
+ * @param port port of emulator server
82
+ * @param sslEnabled use https
83
+ */
84
+ export declare function connectDataConnectEmulator(dc: DataConnect, host: string, port?: number, sslEnabled?: boolean): void;
85
+ /**
86
+ * Initialize DataConnect instance
87
+ * @param options ConnectorConfig
88
+ */
89
+ export declare function getDataConnect(options: ConnectorConfig): DataConnect;
90
+ /**
91
+ * Initialize DataConnect instance
92
+ * @param app FirebaseApp to initialize to.
93
+ * @param options ConnectorConfig
94
+ */
95
+ export declare function getDataConnect(app: FirebaseApp, options: ConnectorConfig): DataConnect;
96
+ /**
97
+ *
98
+ * @param dcOptions
99
+ * @returns {void}
100
+ * @internal
101
+ */
102
+ export declare function validateDCOptions(dcOptions: ConnectorConfig): boolean;
103
+ /**
104
+ * Delete DataConnect instance
105
+ * @param dataConnect DataConnect instance
106
+ * @returns
107
+ */
108
+ export declare function terminate(dataConnect: DataConnect): Promise<void>;
@@ -1,61 +1,61 @@
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 { DataConnectTransport } from '../network/transport';
18
- import { DataConnect } from './DataConnect';
19
- import { DataConnectResult, MUTATION_STR, OperationRef } from './Reference';
20
- export interface MutationRef<Data, Variables> extends OperationRef<Data, Variables> {
21
- refType: typeof MUTATION_STR;
22
- }
23
- /**
24
- * Creates a `MutationRef`
25
- * @param dcInstance Data Connect instance
26
- * @param mutationName name of mutation
27
- */
28
- export declare function mutationRef<Data>(dcInstance: DataConnect, mutationName: string): MutationRef<Data, undefined>;
29
- /**
30
- *
31
- * @param dcInstance Data Connect instance
32
- * @param mutationName name of mutation
33
- * @param variables variables to send with mutation
34
- */
35
- export declare function mutationRef<Data, Variables>(dcInstance: DataConnect, mutationName: string, variables: Variables): MutationRef<Data, Variables>;
36
- /**
37
- * @internal
38
- */
39
- export declare class MutationManager {
40
- private _transport;
41
- private _inflight;
42
- constructor(_transport: DataConnectTransport);
43
- executeMutation<Data, Variables>(mutationRef: MutationRef<Data, Variables>): MutationPromise<Data, Variables>;
44
- }
45
- /**
46
- * Mutation Result from `executeMutation`
47
- */
48
- export interface MutationResult<Data, Variables> extends DataConnectResult<Data, Variables> {
49
- ref: MutationRef<Data, Variables>;
50
- }
51
- /**
52
- * Mutation return value from `executeMutation`
53
- */
54
- export interface MutationPromise<Data, Variables> extends PromiseLike<MutationResult<Data, Variables>> {
55
- }
56
- /**
57
- * Execute Mutation
58
- * @param mutationRef mutation to execute
59
- * @returns `MutationRef`
60
- */
61
- export declare function executeMutation<Data, Variables>(mutationRef: MutationRef<Data, Variables>): MutationPromise<Data, Variables>;
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 { DataConnectTransport } from '../network/transport';
18
+ import { DataConnect } from './DataConnect';
19
+ import { DataConnectResult, MUTATION_STR, OperationRef } from './Reference';
20
+ export interface MutationRef<Data, Variables> extends OperationRef<Data, Variables> {
21
+ refType: typeof MUTATION_STR;
22
+ }
23
+ /**
24
+ * Creates a `MutationRef`
25
+ * @param dcInstance Data Connect instance
26
+ * @param mutationName name of mutation
27
+ */
28
+ export declare function mutationRef<Data>(dcInstance: DataConnect, mutationName: string): MutationRef<Data, undefined>;
29
+ /**
30
+ *
31
+ * @param dcInstance Data Connect instance
32
+ * @param mutationName name of mutation
33
+ * @param variables variables to send with mutation
34
+ */
35
+ export declare function mutationRef<Data, Variables>(dcInstance: DataConnect, mutationName: string, variables: Variables): MutationRef<Data, Variables>;
36
+ /**
37
+ * @internal
38
+ */
39
+ export declare class MutationManager {
40
+ private _transport;
41
+ private _inflight;
42
+ constructor(_transport: DataConnectTransport);
43
+ executeMutation<Data, Variables>(mutationRef: MutationRef<Data, Variables>): MutationPromise<Data, Variables>;
44
+ }
45
+ /**
46
+ * Mutation Result from `executeMutation`
47
+ */
48
+ export interface MutationResult<Data, Variables> extends DataConnectResult<Data, Variables> {
49
+ ref: MutationRef<Data, Variables>;
50
+ }
51
+ /**
52
+ * Mutation return value from `executeMutation`
53
+ */
54
+ export interface MutationPromise<Data, Variables> extends PromiseLike<MutationResult<Data, Variables>> {
55
+ }
56
+ /**
57
+ * Execute Mutation
58
+ * @param mutationRef mutation to execute
59
+ * @returns `MutationRef`
60
+ */
61
+ export declare function executeMutation<Data, Variables>(mutationRef: MutationRef<Data, Variables>): MutationPromise<Data, Variables>;
@@ -1,51 +1,51 @@
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 { DataConnect, DataConnectOptions } from './DataConnect';
18
- export declare const QUERY_STR = "query";
19
- export declare const MUTATION_STR = "mutation";
20
- export declare type ReferenceType = typeof QUERY_STR | typeof MUTATION_STR;
21
- export declare const SOURCE_SERVER = "SERVER";
22
- export declare const SOURCE_CACHE = "CACHE";
23
- export declare type DataSource = typeof SOURCE_CACHE | typeof SOURCE_SERVER;
24
- export interface OpResult<Data> {
25
- data: Data;
26
- source: DataSource;
27
- fetchTime: string;
28
- }
29
- export interface OperationRef<_Data, Variables> {
30
- name: string;
31
- variables: Variables;
32
- refType: ReferenceType;
33
- dataConnect: DataConnect;
34
- }
35
- export interface DataConnectResult<Data, Variables> extends OpResult<Data> {
36
- ref: OperationRef<Data, Variables>;
37
- }
38
- /**
39
- * Serialized RefInfo as a result of `QueryResult.toJSON().refInfo`
40
- */
41
- export interface RefInfo<Variables> {
42
- name: string;
43
- variables: Variables;
44
- connectorConfig: DataConnectOptions;
45
- }
46
- /**
47
- * Serialized Ref as a result of `QueryResult.toJSON()`
48
- */
49
- export interface SerializedRef<Data, Variables> extends OpResult<Data> {
50
- refInfo: RefInfo<Variables>;
51
- }
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 { DataConnect, DataConnectOptions } from './DataConnect';
18
+ export declare const QUERY_STR = "query";
19
+ export declare const MUTATION_STR = "mutation";
20
+ export type ReferenceType = typeof QUERY_STR | typeof MUTATION_STR;
21
+ export declare const SOURCE_SERVER = "SERVER";
22
+ export declare const SOURCE_CACHE = "CACHE";
23
+ export type DataSource = typeof SOURCE_CACHE | typeof SOURCE_SERVER;
24
+ export interface OpResult<Data> {
25
+ data: Data;
26
+ source: DataSource;
27
+ fetchTime: string;
28
+ }
29
+ export interface OperationRef<_Data, Variables> {
30
+ name: string;
31
+ variables: Variables;
32
+ refType: ReferenceType;
33
+ dataConnect: DataConnect;
34
+ }
35
+ export interface DataConnectResult<Data, Variables> extends OpResult<Data> {
36
+ ref: OperationRef<Data, Variables>;
37
+ }
38
+ /**
39
+ * Serialized RefInfo as a result of `QueryResult.toJSON().refInfo`
40
+ */
41
+ export interface RefInfo<Variables> {
42
+ name: string;
43
+ variables: Variables;
44
+ connectorConfig: DataConnectOptions;
45
+ }
46
+ /**
47
+ * Serialized Ref as a result of `QueryResult.toJSON()`
48
+ */
49
+ export interface SerializedRef<Data, Variables> extends OpResult<Data> {
50
+ refInfo: RefInfo<Variables>;
51
+ }
@@ -1,23 +1,23 @@
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 * from './DataConnect';
19
- export * from './Reference';
20
- export * from './Mutation';
21
- export * from './query';
22
- export { setLogLevel } from '../logger';
23
- export { validateArgs } from '../util/validateArgs';
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 * from './DataConnect';
19
+ export * from './Reference';
20
+ export * from './Mutation';
21
+ export * from './query';
22
+ export { setLogLevel } from '../logger';
23
+ export { validateArgs } from '../util/validateArgs';