@firebase/data-connect 0.5.0 → 0.6.0-20260408221811

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 (42) hide show
  1. package/dist/index.cjs.js +1165 -143
  2. package/dist/index.cjs.js.map +1 -1
  3. package/dist/index.esm.js +1164 -144
  4. package/dist/index.esm.js.map +1 -1
  5. package/dist/index.node.cjs.js +1231 -190
  6. package/dist/index.node.cjs.js.map +1 -1
  7. package/dist/internal.d.ts +133 -12
  8. package/dist/node-esm/index.node.esm.js +1230 -191
  9. package/dist/node-esm/index.node.esm.js.map +1 -1
  10. package/dist/node-esm/src/api/Mutation.d.ts +2 -2
  11. package/dist/node-esm/src/api/query.d.ts +1 -1
  12. package/dist/node-esm/src/core/query/QueryManager.d.ts +22 -3
  13. package/dist/node-esm/src/network/index.d.ts +1 -1
  14. package/dist/node-esm/src/network/manager.d.ts +61 -0
  15. package/dist/node-esm/src/network/{fetch.d.ts → rest/fetch.d.ts} +9 -4
  16. package/dist/node-esm/src/network/rest/index.d.ts +18 -0
  17. package/dist/node-esm/src/network/rest/restTransport.d.ts +33 -0
  18. package/dist/node-esm/src/network/stream/streamTransport.d.ts +241 -0
  19. package/dist/node-esm/src/network/stream/websocket.d.ts +90 -0
  20. package/dist/node-esm/src/network/stream/wire.d.ts +138 -0
  21. package/dist/node-esm/src/network/transport.d.ts +179 -0
  22. package/dist/node-esm/src/util/url.d.ts +3 -1
  23. package/dist/private.d.ts +29 -7
  24. package/dist/public.d.ts +3 -1
  25. package/dist/src/api/Mutation.d.ts +2 -2
  26. package/dist/src/api/query.d.ts +1 -1
  27. package/dist/src/core/query/QueryManager.d.ts +22 -3
  28. package/dist/src/network/index.d.ts +1 -1
  29. package/dist/src/network/manager.d.ts +61 -0
  30. package/dist/src/network/{fetch.d.ts → rest/fetch.d.ts} +9 -4
  31. package/dist/src/network/rest/index.d.ts +18 -0
  32. package/dist/src/network/rest/restTransport.d.ts +33 -0
  33. package/dist/src/network/stream/streamTransport.d.ts +241 -0
  34. package/dist/src/network/stream/websocket.d.ts +90 -0
  35. package/dist/src/network/stream/wire.d.ts +138 -0
  36. package/dist/src/network/transport.d.ts +179 -0
  37. package/dist/src/util/url.d.ts +3 -1
  38. package/package.json +1 -1
  39. package/dist/node-esm/src/network/transport/index.d.ts +0 -81
  40. package/dist/node-esm/src/network/transport/rest.d.ts +0 -49
  41. package/dist/src/network/transport/index.d.ts +0 -81
  42. package/dist/src/network/transport/rest.d.ts +0 -49
@@ -1,81 +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 { DataConnectOptions, TransportOptions } from '../../api/DataConnect';
18
- import { AppCheckTokenProvider } from '../../core/AppCheckTokenProvider';
19
- import { AuthTokenProvider } from '../../core/FirebaseAuthProvider';
20
- /**
21
- * enum representing different flavors of the SDK used by developers
22
- * use the CallerSdkType for type-checking, and the CallerSdkTypeEnum for value-checking/assigning
23
- */
24
- export type CallerSdkType = 'Base' | 'Generated' | 'TanstackReactCore' | 'GeneratedReact' | 'TanstackAngularCore' | 'GeneratedAngular';
25
- export declare const CallerSdkTypeEnum: {
26
- readonly Base: "Base";
27
- readonly Generated: "Generated";
28
- readonly TanstackReactCore: "TanstackReactCore";
29
- readonly GeneratedReact: "GeneratedReact";
30
- readonly TanstackAngularCore: "TanstackAngularCore";
31
- readonly GeneratedAngular: "GeneratedAngular";
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
- }
68
- /**
69
- * @internal
70
- */
71
- export interface DataConnectTransport {
72
- invokeQuery<T, U>(queryName: string, body?: U): Promise<DataConnectResponseWithMaxAge<T>>;
73
- invokeMutation<T, U>(queryName: string, body?: U): Promise<DataConnectResponse<T>>;
74
- useEmulator(host: string, port?: number, sslEnabled?: boolean): void;
75
- onTokenChanged: (token: string | null) => void;
76
- _setCallerSdkType(callerSdkType: CallerSdkType): void;
77
- }
78
- /**
79
- * @internal
80
- */
81
- export type TransportClass = new (options: DataConnectOptions, apiKey?: string, appId?: string, authProvider?: AuthTokenProvider, appCheckProvider?: AppCheckTokenProvider, transportOptions?: TransportOptions, _isUsingGen?: boolean, _callerSdkType?: CallerSdkType) => DataConnectTransport;
@@ -1,49 +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 { DataConnectOptions, TransportOptions } from '../../api/DataConnect';
18
- import { AppCheckTokenProvider } from '../../core/AppCheckTokenProvider';
19
- import { AuthTokenProvider } from '../../core/FirebaseAuthProvider';
20
- import { CallerSdkType, DataConnectResponse, DataConnectTransport } from '.';
21
- export declare class RESTTransport implements DataConnectTransport {
22
- private apiKey?;
23
- private appId?;
24
- private authProvider?;
25
- private appCheckProvider?;
26
- private _isUsingGen;
27
- private _callerSdkType;
28
- private _host;
29
- private _port;
30
- private _location;
31
- private _connectorName;
32
- private _secure;
33
- private _project;
34
- private _serviceName;
35
- private _accessToken;
36
- private _appCheckToken;
37
- private _lastToken;
38
- private _isUsingEmulator;
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
- get endpointUrl(): string;
41
- useEmulator(host: string, port?: number, isSecure?: boolean): void;
42
- onTokenChanged(newToken: string | null): void;
43
- getWithAuth(forceToken?: boolean): Promise<string | null>;
44
- _setLastToken(lastToken: string | null): void;
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>>;
48
- _setCallerSdkType(callerSdkType: CallerSdkType): void;
49
- }
@@ -1,81 +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 { DataConnectOptions, TransportOptions } from '../../api/DataConnect';
18
- import { AppCheckTokenProvider } from '../../core/AppCheckTokenProvider';
19
- import { AuthTokenProvider } from '../../core/FirebaseAuthProvider';
20
- /**
21
- * enum representing different flavors of the SDK used by developers
22
- * use the CallerSdkType for type-checking, and the CallerSdkTypeEnum for value-checking/assigning
23
- */
24
- export type CallerSdkType = 'Base' | 'Generated' | 'TanstackReactCore' | 'GeneratedReact' | 'TanstackAngularCore' | 'GeneratedAngular';
25
- export declare const CallerSdkTypeEnum: {
26
- readonly Base: "Base";
27
- readonly Generated: "Generated";
28
- readonly TanstackReactCore: "TanstackReactCore";
29
- readonly GeneratedReact: "GeneratedReact";
30
- readonly TanstackAngularCore: "TanstackAngularCore";
31
- readonly GeneratedAngular: "GeneratedAngular";
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
- }
68
- /**
69
- * @internal
70
- */
71
- export interface DataConnectTransport {
72
- invokeQuery<T, U>(queryName: string, body?: U): Promise<DataConnectResponseWithMaxAge<T>>;
73
- invokeMutation<T, U>(queryName: string, body?: U): Promise<DataConnectResponse<T>>;
74
- useEmulator(host: string, port?: number, sslEnabled?: boolean): void;
75
- onTokenChanged: (token: string | null) => void;
76
- _setCallerSdkType(callerSdkType: CallerSdkType): void;
77
- }
78
- /**
79
- * @internal
80
- */
81
- export type TransportClass = new (options: DataConnectOptions, apiKey?: string, appId?: string, authProvider?: AuthTokenProvider, appCheckProvider?: AppCheckTokenProvider, transportOptions?: TransportOptions, _isUsingGen?: boolean, _callerSdkType?: CallerSdkType) => DataConnectTransport;
@@ -1,49 +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 { DataConnectOptions, TransportOptions } from '../../api/DataConnect';
18
- import { AppCheckTokenProvider } from '../../core/AppCheckTokenProvider';
19
- import { AuthTokenProvider } from '../../core/FirebaseAuthProvider';
20
- import { CallerSdkType, DataConnectResponse, DataConnectTransport } from '.';
21
- export declare class RESTTransport implements DataConnectTransport {
22
- private apiKey?;
23
- private appId?;
24
- private authProvider?;
25
- private appCheckProvider?;
26
- private _isUsingGen;
27
- private _callerSdkType;
28
- private _host;
29
- private _port;
30
- private _location;
31
- private _connectorName;
32
- private _secure;
33
- private _project;
34
- private _serviceName;
35
- private _accessToken;
36
- private _appCheckToken;
37
- private _lastToken;
38
- private _isUsingEmulator;
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
- get endpointUrl(): string;
41
- useEmulator(host: string, port?: number, isSecure?: boolean): void;
42
- onTokenChanged(newToken: string | null): void;
43
- getWithAuth(forceToken?: boolean): Promise<string | null>;
44
- _setLastToken(lastToken: string | null): void;
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>>;
48
- _setCallerSdkType(callerSdkType: CallerSdkType): void;
49
- }