@firebase/data-connect 0.0.2-dataconnect-preview.877f8b7d0 → 0.0.3-dataconnect-preview.d986d4bf2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +204 -29
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm2017.js +203 -30
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +204 -25
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +205 -24
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/internal.d.ts +159 -13
- package/dist/node-esm/index.node.esm.js +203 -30
- package/dist/node-esm/index.node.esm.js.map +1 -1
- package/dist/node-esm/src/api/DataConnect.d.ts +42 -0
- package/dist/node-esm/src/api/Mutation.d.ts +26 -1
- package/dist/node-esm/src/api/Reference.d.ts +6 -0
- package/dist/node-esm/src/api/index.d.ts +1 -0
- package/dist/node-esm/src/api/query.d.ts +51 -1
- package/dist/node-esm/src/api.browser.d.ts +12 -7
- package/dist/node-esm/src/core/FirebaseAuthProvider.d.ts +1 -1
- package/dist/node-esm/src/core/QueryManager.d.ts +1 -1
- package/dist/node-esm/src/core/error.d.ts +2 -1
- package/dist/node-esm/src/network/fetch.d.ts +1 -1
- package/dist/node-esm/src/network/transport/index.d.ts +1 -1
- package/dist/node-esm/src/network/transport/rest.d.ts +20 -9
- package/dist/node-esm/src/util/validateArgs.d.ts +33 -0
- package/dist/private.d.ts +141 -19
- package/dist/public.d.ts +130 -15
- package/dist/src/api/DataConnect.d.ts +42 -0
- package/dist/src/api/Mutation.d.ts +26 -1
- package/dist/src/api/Reference.d.ts +6 -0
- package/dist/src/api/index.d.ts +1 -0
- package/dist/src/api/query.d.ts +51 -1
- package/dist/src/api.browser.d.ts +12 -7
- package/dist/src/core/FirebaseAuthProvider.d.ts +1 -1
- package/dist/src/core/QueryManager.d.ts +1 -1
- package/dist/src/core/error.d.ts +2 -1
- package/dist/src/network/fetch.d.ts +1 -1
- package/dist/src/network/transport/index.d.ts +1 -1
- package/dist/src/network/transport/rest.d.ts +20 -9
- package/dist/src/util/validateArgs.d.ts +33 -0
- package/package.json +10 -6
|
@@ -28,7 +28,7 @@ export declare class QueryManager {
|
|
|
28
28
|
private transport;
|
|
29
29
|
_queries: Map<string, TrackedQuery<unknown, unknown>>;
|
|
30
30
|
constructor(transport: DataConnectTransport);
|
|
31
|
-
track<Data, Variables>(queryName: string, variables: Variables, initialCache?: OpResult<Data>): TrackedQuery<
|
|
31
|
+
track<Data, Variables>(queryName: string, variables: Variables, initialCache?: OpResult<Data>): TrackedQuery<Data, Variables>;
|
|
32
32
|
addSubscription<Data, Variables>(queryRef: OperationRef<Data, Variables>, onResultCallback: OnResultSubscription<Data, Variables>, onErrorCallback?: OnErrorSubscription, initialCache?: OpResult<Data>): () => void;
|
|
33
33
|
executeQuery<Data, Variables>(queryRef: QueryRef<Data, Variables>): QueryPromise<Data, Variables>;
|
|
34
34
|
enableEmulator(host: string, port: number): void;
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
import { FirebaseError } from '@firebase/util';
|
|
18
|
-
export declare type DataConnectErrorCode = 'other' | 'already-initialized' | 'not-initialized' | 'not-supported' | 'invalid-argument' | 'partial-error';
|
|
18
|
+
export declare type DataConnectErrorCode = 'other' | 'already-initialized' | 'not-initialized' | 'not-supported' | 'invalid-argument' | 'partial-error' | 'unauthorized';
|
|
19
19
|
export declare type Code = DataConnectErrorCode;
|
|
20
20
|
export declare const Code: {
|
|
21
21
|
OTHER: DataConnectErrorCode;
|
|
@@ -24,6 +24,7 @@ export declare const Code: {
|
|
|
24
24
|
NOT_SUPPORTED: DataConnectErrorCode;
|
|
25
25
|
INVALID_ARGUMENT: DataConnectErrorCode;
|
|
26
26
|
PARTIAL_ERROR: DataConnectErrorCode;
|
|
27
|
+
UNAUTHORIZED: DataConnectErrorCode;
|
|
27
28
|
};
|
|
28
29
|
/** An error returned by a DataConnect operation. */
|
|
29
30
|
export declare class DataConnectError extends FirebaseError {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
export declare function initializeFetch(fetchImpl: typeof fetch): void;
|
|
18
|
-
export declare function dcFetch<T, U>(url: string, body: U, { signal }: AbortController, accessToken: string | null): Promise<{
|
|
18
|
+
export declare function dcFetch<T, U>(url: string, body: U, { signal }: AbortController, accessToken: string | null, _isUsingGen: boolean): Promise<{
|
|
19
19
|
data: T;
|
|
20
20
|
errors: Error[];
|
|
21
21
|
}>;
|
|
@@ -41,5 +41,5 @@ export interface Sender<T> {
|
|
|
41
41
|
abort: () => void;
|
|
42
42
|
send: () => Promise<T>;
|
|
43
43
|
}
|
|
44
|
-
export declare type TransportClass = new (options: DataConnectOptions, apiKey?: string, authProvider?: AuthTokenProvider, transportOptions?: TransportOptions) => DataConnectTransport;
|
|
44
|
+
export declare type TransportClass = new (options: DataConnectOptions, apiKey?: string, authProvider?: AuthTokenProvider, transportOptions?: TransportOptions, _isUsingGen?: boolean) => DataConnectTransport;
|
|
45
45
|
export * from '../../core/FirebaseAuthProvider';
|
|
@@ -20,6 +20,7 @@ import { DataConnectTransport } from '.';
|
|
|
20
20
|
export declare class RESTTransport implements DataConnectTransport {
|
|
21
21
|
private apiKey?;
|
|
22
22
|
private authProvider?;
|
|
23
|
+
private _isUsingGen;
|
|
23
24
|
private _host;
|
|
24
25
|
private _port;
|
|
25
26
|
private _location;
|
|
@@ -29,16 +30,26 @@ export declare class RESTTransport implements DataConnectTransport {
|
|
|
29
30
|
private _serviceName;
|
|
30
31
|
private _accessToken;
|
|
31
32
|
private _authInitialized;
|
|
32
|
-
|
|
33
|
+
private _lastToken;
|
|
34
|
+
constructor(options: DataConnectOptions, apiKey?: string | undefined, authProvider?: AuthTokenProvider | undefined, transportOptions?: TransportOptions | undefined, _isUsingGen?: boolean);
|
|
33
35
|
get endpointUrl(): string;
|
|
34
36
|
useEmulator(host: string, port?: number, isSecure?: boolean): void;
|
|
35
37
|
onTokenChanged(newToken: string | null): void;
|
|
36
|
-
getWithAuth(): Promise<string>;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
getWithAuth(forceToken?: boolean): Promise<string>;
|
|
39
|
+
_setLastToken(lastToken: string | null): void;
|
|
40
|
+
withRetry<T>(promiseFactory: () => Promise<{
|
|
41
|
+
data: T;
|
|
42
|
+
errors: Error[];
|
|
43
|
+
}>, retry?: boolean): Promise<{
|
|
44
|
+
data: T;
|
|
45
|
+
errors: Error[];
|
|
46
|
+
}>;
|
|
47
|
+
invokeQuery: <T, U>(queryName: string, body?: U) => PromiseLike<{
|
|
48
|
+
data: T;
|
|
49
|
+
errors: Error[];
|
|
50
|
+
}>;
|
|
51
|
+
invokeMutation: <T, U>(queryName: string, body?: U) => PromiseLike<{
|
|
52
|
+
data: T;
|
|
53
|
+
errors: Error[];
|
|
54
|
+
}>;
|
|
44
55
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
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 { ConnectorConfig, DataConnect } from '../api/DataConnect';
|
|
18
|
+
interface ParsedArgs<Variables> {
|
|
19
|
+
dc: DataConnect;
|
|
20
|
+
vars: Variables;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The generated SDK will allow the user to pass in either the variable or the data connect instance with the variable,
|
|
24
|
+
* and this function validates the variables and returns back the DataConnect instance and variables based on the arguments passed in.
|
|
25
|
+
* @param connectorConfig
|
|
26
|
+
* @param dcOrVars
|
|
27
|
+
* @param vars
|
|
28
|
+
* @param validateVars
|
|
29
|
+
* @returns {DataConnect} and {Variables} instance
|
|
30
|
+
* @internal
|
|
31
|
+
*/
|
|
32
|
+
export declare function validateArgs<Variables extends object>(connectorConfig: ConnectorConfig, dcOrVars?: DataConnect | Variables, vars?: Variables, validateVars?: boolean): ParsedArgs<Variables>;
|
|
33
|
+
export {};
|
package/dist/private.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { FirebaseApp } from '@firebase/app';
|
|
|
8
8
|
import { FirebaseAuthInternalName } from '@firebase/auth-interop-types';
|
|
9
9
|
import { FirebaseAuthTokenData } from '@firebase/auth-interop-types';
|
|
10
10
|
import { FirebaseError } from '@firebase/util';
|
|
11
|
-
import { FirebaseOptions } from '@firebase/app';
|
|
11
|
+
import { FirebaseOptions } from '@firebase/app-types';
|
|
12
12
|
import { LogLevelString } from '@firebase/logger';
|
|
13
13
|
import { Provider } from '@firebase/component';
|
|
14
14
|
|
|
@@ -25,14 +25,27 @@ export declare interface CancellableOperation<T> extends PromiseLike<{
|
|
|
25
25
|
cancel: () => void;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
/**
|
|
29
|
+
* Connect to the DataConnect Emulator
|
|
30
|
+
* @param dc Data Connect instance
|
|
31
|
+
* @param host host of emulator server
|
|
32
|
+
* @param port port of emulator server
|
|
33
|
+
* @param sslEnabled use https
|
|
34
|
+
*/
|
|
28
35
|
export declare function connectDataConnectEmulator(dc: DataConnect, host: string, port?: number, sslEnabled?: boolean): void;
|
|
29
36
|
|
|
37
|
+
/**
|
|
38
|
+
* Connector Config for calling Data Connect backend.
|
|
39
|
+
*/
|
|
30
40
|
export declare interface ConnectorConfig {
|
|
31
41
|
location: string;
|
|
32
42
|
connector: string;
|
|
33
43
|
service: string;
|
|
34
44
|
}
|
|
35
45
|
|
|
46
|
+
/**
|
|
47
|
+
* Class representing Firebase Data Connect
|
|
48
|
+
*/
|
|
36
49
|
export declare class DataConnect {
|
|
37
50
|
readonly app: FirebaseApp;
|
|
38
51
|
private readonly dataConnectOptions;
|
|
@@ -45,7 +58,9 @@ export declare class DataConnect {
|
|
|
45
58
|
private _transportClass;
|
|
46
59
|
private _transportOptions?;
|
|
47
60
|
private _authTokenProvider?;
|
|
61
|
+
_isUsingGeneratedSdk: boolean;
|
|
48
62
|
constructor(app: FirebaseApp, dataConnectOptions: DataConnectOptions, _authProvider: Provider<FirebaseAuthInternalName>);
|
|
63
|
+
_useGeneratedSdk(): void;
|
|
49
64
|
_delete(): Promise<void>;
|
|
50
65
|
getSettings(): ConnectorConfig;
|
|
51
66
|
setInitialized(): void;
|
|
@@ -76,8 +91,11 @@ declare class DataConnectError extends FirebaseError {
|
|
|
76
91
|
message: string);
|
|
77
92
|
}
|
|
78
93
|
|
|
79
|
-
declare type DataConnectErrorCode = 'other' | 'already-initialized' | 'not-initialized' | 'not-supported' | 'invalid-argument' | 'partial-error';
|
|
94
|
+
declare type DataConnectErrorCode = 'other' | 'already-initialized' | 'not-initialized' | 'not-supported' | 'invalid-argument' | 'partial-error' | 'unauthorized';
|
|
80
95
|
|
|
96
|
+
/**
|
|
97
|
+
* DataConnectOptions including project id
|
|
98
|
+
*/
|
|
81
99
|
export declare interface DataConnectOptions extends ConnectorConfig {
|
|
82
100
|
projectId: string;
|
|
83
101
|
}
|
|
@@ -86,6 +104,9 @@ export declare interface DataConnectResult<Data, Variables> extends OpResult<Dat
|
|
|
86
104
|
ref: OperationRef<Data, Variables>;
|
|
87
105
|
}
|
|
88
106
|
|
|
107
|
+
/**
|
|
108
|
+
* Representation of user provided subscription options.
|
|
109
|
+
*/
|
|
89
110
|
export declare interface DataConnectSubscription<Data, Variables> {
|
|
90
111
|
userCallback: OnResultSubscription<Data, Variables>;
|
|
91
112
|
errCallback?: (e?: DataConnectError) => void;
|
|
@@ -107,8 +128,18 @@ export declare interface DataConnectTransport {
|
|
|
107
128
|
|
|
108
129
|
export declare type DataSource = typeof SOURCE_CACHE | typeof SOURCE_SERVER;
|
|
109
130
|
|
|
131
|
+
/**
|
|
132
|
+
* Execute Mutation
|
|
133
|
+
* @param mutationRef mutation to execute
|
|
134
|
+
* @returns `MutationRef`
|
|
135
|
+
*/
|
|
110
136
|
export declare function executeMutation<Data, Variables>(mutationRef: MutationRef<Data, Variables>): MutationPromise<Data, Variables>;
|
|
111
137
|
|
|
138
|
+
/**
|
|
139
|
+
* Execute Query
|
|
140
|
+
* @param queryRef query to execute.
|
|
141
|
+
* @returns `QueryPromise`
|
|
142
|
+
*/
|
|
112
143
|
export declare function executeQuery<Data, Variables>(queryRef: QueryRef<Data, Variables>): QueryPromise<Data, Variables>;
|
|
113
144
|
|
|
114
145
|
export declare const FIREBASE_DATA_CONNECT_EMULATOR_HOST_VAR = "FIREBASE_DATA_CONNECT_EMULATOR_HOST";
|
|
@@ -124,19 +155,26 @@ export declare class FirebaseAuthProvider implements AuthTokenProvider {
|
|
|
124
155
|
removeTokenChangeListener(listener: (token: string | null) => void): void;
|
|
125
156
|
}
|
|
126
157
|
|
|
158
|
+
/**
|
|
159
|
+
* Initialize DataConnect instance
|
|
160
|
+
* @param options ConnectorConfig
|
|
161
|
+
*/
|
|
127
162
|
export declare function getDataConnect(options: ConnectorConfig): DataConnect;
|
|
128
163
|
|
|
164
|
+
/**
|
|
165
|
+
* Initialize DataConnect instance
|
|
166
|
+
* @param app FirebaseApp to initialize to.
|
|
167
|
+
* @param options ConnectorConfig
|
|
168
|
+
*/
|
|
129
169
|
export declare function getDataConnect(app: FirebaseApp, options: ConnectorConfig): DataConnect;
|
|
130
170
|
|
|
131
171
|
export declare const MUTATION_STR = "mutation";
|
|
132
172
|
|
|
133
|
-
|
|
134
|
-
private _transport;
|
|
135
|
-
private _inflight;
|
|
136
|
-
constructor(_transport: DataConnectTransport);
|
|
137
|
-
executeMutation<Data, Variables>(mutationRef: MutationRef<Data, Variables>): MutationPromise<Data, Variables>;
|
|
138
|
-
}
|
|
173
|
+
/* Excluded from this release type: MutationManager */
|
|
139
174
|
|
|
175
|
+
/**
|
|
176
|
+
* Mutation return value from `executeMutation`
|
|
177
|
+
*/
|
|
140
178
|
export declare interface MutationPromise<Data, Variables> extends PromiseLike<MutationResult<Data, Variables>> {
|
|
141
179
|
}
|
|
142
180
|
|
|
@@ -144,21 +182,44 @@ export declare interface MutationRef<Data, Variables> extends OperationRef<Data,
|
|
|
144
182
|
refType: typeof MUTATION_STR;
|
|
145
183
|
}
|
|
146
184
|
|
|
147
|
-
|
|
185
|
+
/**
|
|
186
|
+
* Creates a `MutationRef`
|
|
187
|
+
* @param dcInstance Data Connect instance
|
|
188
|
+
* @param mutationName name of mutation
|
|
189
|
+
*/
|
|
190
|
+
export declare function mutationRef<Data>(dcInstance: DataConnect, mutationName: string): MutationRef<Data, undefined>;
|
|
148
191
|
|
|
192
|
+
/**
|
|
193
|
+
*
|
|
194
|
+
* @param dcInstance Data Connect instance
|
|
195
|
+
* @param mutationName name of mutation
|
|
196
|
+
* @param variables variables to send with mutation
|
|
197
|
+
*/
|
|
149
198
|
export declare function mutationRef<Data, Variables>(dcInstance: DataConnect, mutationName: string, variables: Variables): MutationRef<Data, Variables>;
|
|
150
199
|
|
|
151
200
|
export declare interface MutationResponse<T> extends CancellableOperation<T> {
|
|
152
201
|
}
|
|
153
202
|
|
|
203
|
+
/**
|
|
204
|
+
* Mutation Result from `executeMutation`
|
|
205
|
+
*/
|
|
154
206
|
export declare interface MutationResult<Data, Variables> extends DataConnectResult<Data, Variables> {
|
|
155
207
|
ref: MutationRef<Data, Variables>;
|
|
156
208
|
}
|
|
157
209
|
|
|
210
|
+
/**
|
|
211
|
+
* `OnCompleteSubscription`
|
|
212
|
+
*/
|
|
158
213
|
export declare type OnCompleteSubscription = () => void;
|
|
159
214
|
|
|
215
|
+
/**
|
|
216
|
+
* Signature for `OnErrorSubscription` for `subscribe`
|
|
217
|
+
*/
|
|
160
218
|
export declare type OnErrorSubscription = (err?: DataConnectError) => void;
|
|
161
219
|
|
|
220
|
+
/**
|
|
221
|
+
* Signature for `OnResultSubscription` for `subscribe`
|
|
222
|
+
*/
|
|
162
223
|
export declare type OnResultSubscription<Data, Variables> = (res: QueryResult<Data, Variables>) => void;
|
|
163
224
|
|
|
164
225
|
export declare interface OperationRef<_Data, Variables> {
|
|
@@ -174,6 +235,11 @@ export declare interface OpResult<Data> {
|
|
|
174
235
|
fetchTime: string;
|
|
175
236
|
}
|
|
176
237
|
|
|
238
|
+
declare interface ParsedArgs<Variables> {
|
|
239
|
+
dc: DataConnect;
|
|
240
|
+
vars: Variables;
|
|
241
|
+
}
|
|
242
|
+
|
|
177
243
|
/* Excluded from this release type: parseOptions */
|
|
178
244
|
|
|
179
245
|
export declare const QUERY_STR = "query";
|
|
@@ -182,35 +248,63 @@ declare class QueryManager {
|
|
|
182
248
|
private transport;
|
|
183
249
|
_queries: Map<string, TrackedQuery<unknown, unknown>>;
|
|
184
250
|
constructor(transport: DataConnectTransport);
|
|
185
|
-
track<Data, Variables>(queryName: string, variables: Variables, initialCache?: OpResult<Data>): TrackedQuery<
|
|
251
|
+
track<Data, Variables>(queryName: string, variables: Variables, initialCache?: OpResult<Data>): TrackedQuery<Data, Variables>;
|
|
186
252
|
addSubscription<Data, Variables>(queryRef: OperationRef<Data, Variables>, onResultCallback: OnResultSubscription<Data, Variables>, onErrorCallback?: OnErrorSubscription, initialCache?: OpResult<Data>): () => void;
|
|
187
253
|
executeQuery<Data, Variables>(queryRef: QueryRef<Data, Variables>): QueryPromise<Data, Variables>;
|
|
188
254
|
enableEmulator(host: string, port: number): void;
|
|
189
255
|
}
|
|
190
256
|
|
|
257
|
+
/**
|
|
258
|
+
* Promise returned from `executeQuery`
|
|
259
|
+
*/
|
|
191
260
|
export declare interface QueryPromise<Data, Variables> extends PromiseLike<QueryResult<Data, Variables>> {
|
|
192
261
|
}
|
|
193
262
|
|
|
263
|
+
/**
|
|
264
|
+
* QueryRef object
|
|
265
|
+
*/
|
|
194
266
|
export declare interface QueryRef<Data, Variables> extends OperationRef<Data, Variables> {
|
|
195
267
|
refType: typeof QUERY_STR;
|
|
196
268
|
}
|
|
197
269
|
|
|
270
|
+
/**
|
|
271
|
+
* Execute Query
|
|
272
|
+
* @param dcInstance Data Connect instance to use.
|
|
273
|
+
* @param queryName Query to execute
|
|
274
|
+
* @returns `QueryRef`
|
|
275
|
+
*/
|
|
198
276
|
export declare function queryRef<Data>(dcInstance: DataConnect, queryName: string): QueryRef<Data, undefined>;
|
|
199
277
|
|
|
278
|
+
/**
|
|
279
|
+
* Execute Query
|
|
280
|
+
* @param dcInstance Data Connect instance to use.
|
|
281
|
+
* @param queryName Query to execute
|
|
282
|
+
* @param variables Variables to execute with
|
|
283
|
+
* @returns `QueryRef`
|
|
284
|
+
*/
|
|
200
285
|
export declare function queryRef<Data, Variables>(dcInstance: DataConnect, queryName: string, variables: Variables): QueryRef<Data, Variables>;
|
|
201
286
|
|
|
202
287
|
export declare interface QueryResponse<T> extends CancellableOperation<T> {
|
|
203
288
|
}
|
|
204
289
|
|
|
290
|
+
/**
|
|
291
|
+
* Result of `executeQuery`
|
|
292
|
+
*/
|
|
205
293
|
export declare interface QueryResult<Data, Variables> extends DataConnectResult<Data, Variables> {
|
|
206
294
|
ref: QueryRef<Data, Variables>;
|
|
207
295
|
toJSON: () => SerializedRef<Data, Variables>;
|
|
208
296
|
}
|
|
209
297
|
|
|
298
|
+
/**
|
|
299
|
+
* Signature for unsubscribe from `subscribe`
|
|
300
|
+
*/
|
|
210
301
|
export declare type QueryUnsubscribe = () => void;
|
|
211
302
|
|
|
212
303
|
export declare type ReferenceType = typeof QUERY_STR | typeof MUTATION_STR;
|
|
213
304
|
|
|
305
|
+
/**
|
|
306
|
+
* Serialized RefInfo as a result of `QueryResult.toJSON().refInfo`
|
|
307
|
+
*/
|
|
214
308
|
export declare interface RefInfo<Variables> {
|
|
215
309
|
name: string;
|
|
216
310
|
variables: Variables;
|
|
@@ -222,6 +316,9 @@ export declare interface Sender<T> {
|
|
|
222
316
|
send: () => Promise<T>;
|
|
223
317
|
}
|
|
224
318
|
|
|
319
|
+
/**
|
|
320
|
+
* Serialized Ref as a result of `QueryResult.toJSON()`
|
|
321
|
+
*/
|
|
225
322
|
export declare interface SerializedRef<Data, Variables> extends OpResult<Data> {
|
|
226
323
|
refInfo: RefInfo<Variables>;
|
|
227
324
|
}
|
|
@@ -233,27 +330,45 @@ export declare const SOURCE_CACHE = "CACHE";
|
|
|
233
330
|
export declare const SOURCE_SERVER = "SERVER";
|
|
234
331
|
|
|
235
332
|
/**
|
|
236
|
-
*
|
|
237
|
-
* @
|
|
238
|
-
* @param
|
|
239
|
-
* @
|
|
240
|
-
* @param onErr
|
|
241
|
-
* @param initialCache
|
|
242
|
-
* @returns
|
|
333
|
+
* Subscribe to a `QueryRef`
|
|
334
|
+
* @param queryRefOrSerializedResult query ref or serialized result.
|
|
335
|
+
* @param observer observer object to use for subscribing.
|
|
336
|
+
* @returns `SubscriptionOptions`
|
|
243
337
|
*/
|
|
244
338
|
export declare function subscribe<Data, Variables>(queryRefOrSerializedResult: QueryRef<Data, Variables> | SerializedRef<Data, Variables>, observer: SubscriptionOptions<Data, Variables>): QueryUnsubscribe;
|
|
245
339
|
|
|
340
|
+
/**
|
|
341
|
+
* Subscribe to a `QueryRef`
|
|
342
|
+
* @param queryRefOrSerializedResult query ref or serialized result.
|
|
343
|
+
* @param onNext Callback to call when result comes back.
|
|
344
|
+
* @param onError Callback to call when error gets thrown.
|
|
345
|
+
* @param onComplete Called when subscription completes.
|
|
346
|
+
* @returns `SubscriptionOptions`
|
|
347
|
+
*/
|
|
246
348
|
export declare function subscribe<Data, Variables>(queryRefOrSerializedResult: QueryRef<Data, Variables> | SerializedRef<Data, Variables>, onNext: OnResultSubscription<Data, Variables>, onError?: OnErrorSubscription, onComplete?: OnCompleteSubscription): QueryUnsubscribe;
|
|
247
349
|
|
|
350
|
+
/**
|
|
351
|
+
* Representation of full observer options in `subscribe`
|
|
352
|
+
*/
|
|
248
353
|
export declare interface SubscriptionOptions<Data, Variables> {
|
|
249
354
|
onNext?: OnResultSubscription<Data, Variables>;
|
|
250
355
|
onErr?: OnErrorSubscription;
|
|
251
356
|
onComplete?: OnCompleteSubscription;
|
|
252
357
|
}
|
|
253
358
|
|
|
359
|
+
/**
|
|
360
|
+
* Delete DataConnect instance
|
|
361
|
+
* @param dataConnect DataConnect instance
|
|
362
|
+
* @returns
|
|
363
|
+
*/
|
|
254
364
|
export declare function terminate(dataConnect: DataConnect): Promise<void>;
|
|
255
365
|
|
|
256
|
-
|
|
366
|
+
/**
|
|
367
|
+
* Converts serialized ref to query ref
|
|
368
|
+
* @param serializedRef ref to convert to `QueryRef`
|
|
369
|
+
* @returns `QueryRef`
|
|
370
|
+
*/
|
|
371
|
+
export declare function toQueryRef<Data, Variables>(serializedRef: SerializedRef<Data, Variables>): QueryRef<Data, Variables>;
|
|
257
372
|
|
|
258
373
|
declare interface TrackedQuery<Data, Variables> {
|
|
259
374
|
ref: Omit<OperationRef<Data, Variables>, 'dataConnect'>;
|
|
@@ -262,12 +377,19 @@ declare interface TrackedQuery<Data, Variables> {
|
|
|
262
377
|
lastError: DataConnectError | null;
|
|
263
378
|
}
|
|
264
379
|
|
|
265
|
-
export declare type TransportClass = new (options: DataConnectOptions, apiKey?: string, authProvider?: AuthTokenProvider, transportOptions?: TransportOptions) => DataConnectTransport;
|
|
380
|
+
export declare type TransportClass = new (options: DataConnectOptions, apiKey?: string, authProvider?: AuthTokenProvider, transportOptions?: TransportOptions, _isUsingGen?: boolean) => DataConnectTransport;
|
|
266
381
|
|
|
382
|
+
/**
|
|
383
|
+
* Options to connect to emulator
|
|
384
|
+
*/
|
|
267
385
|
export declare interface TransportOptions {
|
|
268
386
|
host: string;
|
|
269
387
|
sslEnabled?: boolean;
|
|
270
388
|
port?: number;
|
|
271
389
|
}
|
|
272
390
|
|
|
391
|
+
/* Excluded from this release type: validateArgs */
|
|
392
|
+
|
|
393
|
+
/* Excluded from this release type: validateDCOptions */
|
|
394
|
+
|
|
273
395
|
export { }
|