@firebase/data-connect 0.0.1-dataconnect-preview.81ee5169c → 0.0.2-dataconnect-preview.388b61c7e
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 +181 -141
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm2017.js +180 -140
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +183 -143
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +132 -72
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/internal.d.ts +156 -44
- package/dist/node-esm/index.node.esm.js +132 -72
- package/dist/node-esm/index.node.esm.js.map +1 -1
- package/dist/node-esm/src/api/DataConnect.d.ts +39 -12
- package/dist/node-esm/src/api/Mutation.d.ts +33 -8
- package/dist/node-esm/src/api/Reference.d.ts +9 -3
- package/dist/node-esm/src/api/query.d.ts +52 -2
- package/dist/node-esm/src/api.browser.d.ts +12 -7
- package/dist/node-esm/src/core/FirebaseAuthProvider.d.ts +5 -5
- package/dist/node-esm/src/core/QueryManager.d.ts +7 -7
- package/dist/node-esm/src/network/transport/rest.d.ts +13 -25
- package/dist/node-esm/src/util/url.d.ts +2 -2
- package/dist/private.d.ts +151 -47
- package/dist/public.d.ts +135 -37
- package/dist/src/api/DataConnect.d.ts +39 -12
- package/dist/src/api/Mutation.d.ts +33 -8
- package/dist/src/api/Reference.d.ts +9 -3
- package/dist/src/api/query.d.ts +52 -2
- package/dist/src/api.browser.d.ts +12 -7
- package/dist/src/core/FirebaseAuthProvider.d.ts +5 -5
- package/dist/src/core/QueryManager.d.ts +7 -7
- package/dist/src/network/transport/rest.d.ts +13 -25
- package/dist/src/util/url.d.ts +2 -2
- package/package.json +7 -7
- package/dist/node-esm/test/emulatorSeeder.d.ts +0 -22
- package/dist/node-esm/test/queries.test.d.ts +0 -17
- package/dist/node-esm/test/util.d.ts +0 -26
- package/dist/test/emulatorSeeder.d.ts +0 -22
- package/dist/test/queries.test.d.ts +0 -17
- package/dist/test/util.d.ts +0 -26
|
@@ -23,11 +23,11 @@ export interface AuthTokenProvider {
|
|
|
23
23
|
}
|
|
24
24
|
export declare type AuthTokenListener = (token: string | null) => void;
|
|
25
25
|
export declare class FirebaseAuthProvider implements AuthTokenProvider {
|
|
26
|
-
private
|
|
27
|
-
private
|
|
28
|
-
private
|
|
29
|
-
private
|
|
30
|
-
constructor(
|
|
26
|
+
private _appName;
|
|
27
|
+
private _options;
|
|
28
|
+
private _authProvider;
|
|
29
|
+
private _auth;
|
|
30
|
+
constructor(_appName: string, _options: FirebaseOptions, _authProvider: Provider<FirebaseAuthInternalName>);
|
|
31
31
|
getToken(forceRefresh: boolean): Promise<FirebaseAuthTokenData | null>;
|
|
32
32
|
addTokenChangeListener(listener: AuthTokenListener): void;
|
|
33
33
|
removeTokenChangeListener(listener: (token: string | null) => void): void;
|
|
@@ -18,19 +18,19 @@ import { DataConnectSubscription, OnErrorSubscription, OnResultSubscription, Que
|
|
|
18
18
|
import { OperationRef, OpResult } from '../api/Reference';
|
|
19
19
|
import { DataConnectTransport } from '../network';
|
|
20
20
|
import { DataConnectError } from './error';
|
|
21
|
-
interface TrackedQuery<
|
|
22
|
-
ref: Omit<OperationRef<
|
|
23
|
-
subscriptions: Array<DataConnectSubscription<
|
|
24
|
-
currentCache: OpResult<
|
|
21
|
+
interface TrackedQuery<Data, Variables> {
|
|
22
|
+
ref: Omit<OperationRef<Data, Variables>, 'dataConnect'>;
|
|
23
|
+
subscriptions: Array<DataConnectSubscription<Data, Variables>>;
|
|
24
|
+
currentCache: OpResult<Data> | null;
|
|
25
25
|
lastError: DataConnectError | null;
|
|
26
26
|
}
|
|
27
27
|
export declare class QueryManager {
|
|
28
28
|
private transport;
|
|
29
29
|
_queries: Map<string, TrackedQuery<unknown, unknown>>;
|
|
30
30
|
constructor(transport: DataConnectTransport);
|
|
31
|
-
track<
|
|
32
|
-
addSubscription<
|
|
33
|
-
executeQuery<
|
|
31
|
+
track<Data, Variables>(queryName: string, variables: Variables, initialCache?: OpResult<Data>): TrackedQuery<unknown, unknown>;
|
|
32
|
+
addSubscription<Data, Variables>(queryRef: OperationRef<Data, Variables>, onResultCallback: OnResultSubscription<Data, Variables>, onErrorCallback?: OnErrorSubscription, initialCache?: OpResult<Data>): () => void;
|
|
33
|
+
executeQuery<Data, Variables>(queryRef: QueryRef<Data, Variables>): QueryPromise<Data, Variables>;
|
|
34
34
|
enableEmulator(host: string, port: number): void;
|
|
35
35
|
}
|
|
36
36
|
export {};
|
|
@@ -14,43 +14,31 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
-
import { DataConnectTransport } from '.';
|
|
18
17
|
import { DataConnectOptions, TransportOptions } from '../../api/DataConnect';
|
|
19
18
|
import { AuthTokenProvider } from '../../core/FirebaseAuthProvider';
|
|
19
|
+
import { DataConnectTransport } from '.';
|
|
20
20
|
export declare class RESTTransport implements DataConnectTransport {
|
|
21
21
|
private apiKey?;
|
|
22
22
|
private authProvider?;
|
|
23
|
-
private
|
|
24
|
-
private
|
|
25
|
-
private
|
|
26
|
-
private
|
|
27
|
-
private
|
|
28
|
-
private
|
|
29
|
-
private
|
|
30
|
-
private
|
|
31
|
-
private
|
|
23
|
+
private _host;
|
|
24
|
+
private _port;
|
|
25
|
+
private _location;
|
|
26
|
+
private _connectorName;
|
|
27
|
+
private _secure;
|
|
28
|
+
private _project;
|
|
29
|
+
private _serviceName;
|
|
30
|
+
private _accessToken;
|
|
31
|
+
private _authInitialized;
|
|
32
32
|
constructor(options: DataConnectOptions, apiKey?: string | undefined, authProvider?: AuthTokenProvider | undefined, transportOptions?: TransportOptions | undefined);
|
|
33
33
|
get endpointUrl(): string;
|
|
34
34
|
useEmulator(host: string, port?: number, isSecure?: boolean): void;
|
|
35
35
|
onTokenChanged(newToken: string | null): void;
|
|
36
|
-
getWithAuth(): Promise<string
|
|
36
|
+
getWithAuth(): Promise<string>;
|
|
37
37
|
invokeQuery: <T, U = unknown>(queryName: string, body: U) => {
|
|
38
|
-
then:
|
|
39
|
-
data: T;
|
|
40
|
-
errors: Error[];
|
|
41
|
-
}, TResult2 = never>(onfulfilled?: ((value: {
|
|
42
|
-
data: T;
|
|
43
|
-
errors: Error[];
|
|
44
|
-
}) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined) => Promise<TResult1 | TResult2>;
|
|
38
|
+
then: any;
|
|
45
39
|
};
|
|
46
40
|
invokeMutation: <T, U = unknown>(mutationName: string, body: U) => {
|
|
47
|
-
then:
|
|
48
|
-
data: T;
|
|
49
|
-
errors: Error[];
|
|
50
|
-
}, TResult2 = never>(onfulfilled?: ((value: {
|
|
51
|
-
data: T;
|
|
52
|
-
errors: Error[];
|
|
53
|
-
}) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined) => Promise<TResult1 | TResult2>;
|
|
41
|
+
then: any;
|
|
54
42
|
cancel: () => void;
|
|
55
43
|
};
|
|
56
44
|
}
|
|
@@ -14,6 +14,6 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
-
import {
|
|
18
|
-
export declare function urlBuilder(projectConfig:
|
|
17
|
+
import { DataConnectOptions, TransportOptions } from '../api/DataConnect';
|
|
18
|
+
export declare function urlBuilder(projectConfig: DataConnectOptions, transportOptions: TransportOptions): string;
|
|
19
19
|
export declare function addToken(url: string, apiKey?: string): string;
|
package/dist/private.d.ts
CHANGED
|
@@ -25,27 +25,40 @@ 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;
|
|
39
|
-
private readonly
|
|
52
|
+
private readonly _authProvider;
|
|
40
53
|
_queryManager: QueryManager;
|
|
41
54
|
_mutationManager: MutationManager;
|
|
42
55
|
isEmulator: boolean;
|
|
43
56
|
initialized: boolean;
|
|
44
57
|
private _transport;
|
|
45
|
-
private
|
|
46
|
-
private
|
|
47
|
-
private
|
|
48
|
-
constructor(app: FirebaseApp, dataConnectOptions: DataConnectOptions,
|
|
58
|
+
private _transportClass;
|
|
59
|
+
private _transportOptions?;
|
|
60
|
+
private _authTokenProvider?;
|
|
61
|
+
constructor(app: FirebaseApp, dataConnectOptions: DataConnectOptions, _authProvider: Provider<FirebaseAuthInternalName>);
|
|
49
62
|
_delete(): Promise<void>;
|
|
50
63
|
getSettings(): ConnectorConfig;
|
|
51
64
|
setInitialized(): void;
|
|
@@ -78,6 +91,9 @@ declare class DataConnectError extends FirebaseError {
|
|
|
78
91
|
|
|
79
92
|
declare type DataConnectErrorCode = 'other' | 'already-initialized' | 'not-initialized' | 'not-supported' | 'invalid-argument' | 'partial-error';
|
|
80
93
|
|
|
94
|
+
/**
|
|
95
|
+
* DataConnectOptions including project id
|
|
96
|
+
*/
|
|
81
97
|
export declare interface DataConnectOptions extends ConnectorConfig {
|
|
82
98
|
projectId: string;
|
|
83
99
|
}
|
|
@@ -86,6 +102,9 @@ export declare interface DataConnectResult<Data, Variables> extends OpResult<Dat
|
|
|
86
102
|
ref: OperationRef<Data, Variables>;
|
|
87
103
|
}
|
|
88
104
|
|
|
105
|
+
/**
|
|
106
|
+
* Representation of user provided subscription options.
|
|
107
|
+
*/
|
|
89
108
|
export declare interface DataConnectSubscription<Data, Variables> {
|
|
90
109
|
userCallback: OnResultSubscription<Data, Variables>;
|
|
91
110
|
errCallback?: (e?: DataConnectError) => void;
|
|
@@ -107,58 +126,98 @@ export declare interface DataConnectTransport {
|
|
|
107
126
|
|
|
108
127
|
export declare type DataSource = typeof SOURCE_CACHE | typeof SOURCE_SERVER;
|
|
109
128
|
|
|
129
|
+
/**
|
|
130
|
+
* Execute Mutation
|
|
131
|
+
* @param mutationRef mutation to execute
|
|
132
|
+
* @returns `MutationRef`
|
|
133
|
+
*/
|
|
110
134
|
export declare function executeMutation<Data, Variables>(mutationRef: MutationRef<Data, Variables>): MutationPromise<Data, Variables>;
|
|
111
135
|
|
|
136
|
+
/**
|
|
137
|
+
* Execute Query
|
|
138
|
+
* @param queryRef query to execute.
|
|
139
|
+
* @returns `QueryPromise`
|
|
140
|
+
*/
|
|
112
141
|
export declare function executeQuery<Data, Variables>(queryRef: QueryRef<Data, Variables>): QueryPromise<Data, Variables>;
|
|
113
142
|
|
|
114
143
|
export declare const FIREBASE_DATA_CONNECT_EMULATOR_HOST_VAR = "FIREBASE_DATA_CONNECT_EMULATOR_HOST";
|
|
115
144
|
|
|
116
145
|
export declare class FirebaseAuthProvider implements AuthTokenProvider {
|
|
117
|
-
private
|
|
118
|
-
private
|
|
119
|
-
private
|
|
120
|
-
private
|
|
121
|
-
constructor(
|
|
146
|
+
private _appName;
|
|
147
|
+
private _options;
|
|
148
|
+
private _authProvider;
|
|
149
|
+
private _auth;
|
|
150
|
+
constructor(_appName: string, _options: FirebaseOptions, _authProvider: Provider<FirebaseAuthInternalName>);
|
|
122
151
|
getToken(forceRefresh: boolean): Promise<FirebaseAuthTokenData | null>;
|
|
123
152
|
addTokenChangeListener(listener: AuthTokenListener): void;
|
|
124
153
|
removeTokenChangeListener(listener: (token: string | null) => void): void;
|
|
125
154
|
}
|
|
126
155
|
|
|
156
|
+
/**
|
|
157
|
+
* Initialize DataConnect instance
|
|
158
|
+
* @param options ConnectorConfig
|
|
159
|
+
*/
|
|
127
160
|
export declare function getDataConnect(options: ConnectorConfig): DataConnect;
|
|
128
161
|
|
|
162
|
+
/**
|
|
163
|
+
* Initialize DataConnect instance
|
|
164
|
+
* @param app FirebaseApp to initialize to.
|
|
165
|
+
* @param options ConnectorConfig
|
|
166
|
+
*/
|
|
129
167
|
export declare function getDataConnect(app: FirebaseApp, options: ConnectorConfig): DataConnect;
|
|
130
168
|
|
|
131
|
-
export declare
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
constructor(transport: DataConnectTransport);
|
|
135
|
-
executeMutation<Response, Variables>(mutationRef: MutationRef<Response, Variables>): MutationPromise<Response, Variables>;
|
|
136
|
-
}
|
|
169
|
+
export declare const MUTATION_STR = "mutation";
|
|
170
|
+
|
|
171
|
+
/* Excluded from this release type: MutationManager */
|
|
137
172
|
|
|
173
|
+
/**
|
|
174
|
+
* Mutation return value from `executeMutation`
|
|
175
|
+
*/
|
|
138
176
|
export declare interface MutationPromise<Data, Variables> extends PromiseLike<MutationResult<Data, Variables>> {
|
|
139
177
|
}
|
|
140
178
|
|
|
141
|
-
export declare interface MutationRef<
|
|
142
|
-
refType: typeof
|
|
179
|
+
export declare interface MutationRef<Data, Variables> extends OperationRef<Data, Variables> {
|
|
180
|
+
refType: typeof MUTATION_STR;
|
|
143
181
|
}
|
|
144
182
|
|
|
145
|
-
|
|
183
|
+
/**
|
|
184
|
+
* Creates a `MutationRef`
|
|
185
|
+
* @param dcInstance Data Connect instance
|
|
186
|
+
* @param mutationName name of mutation
|
|
187
|
+
*/
|
|
188
|
+
export declare function mutationRef<Data>(dcInstance: DataConnect, mutationName: string): MutationRef<Data, undefined>;
|
|
146
189
|
|
|
147
|
-
|
|
190
|
+
/**
|
|
191
|
+
*
|
|
192
|
+
* @param dcInstance Data Connect instance
|
|
193
|
+
* @param mutationName name of mutation
|
|
194
|
+
* @param variables variables to send with mutation
|
|
195
|
+
*/
|
|
196
|
+
export declare function mutationRef<Data, Variables>(dcInstance: DataConnect, mutationName: string, variables: Variables): MutationRef<Data, Variables>;
|
|
148
197
|
|
|
149
198
|
export declare interface MutationResponse<T> extends CancellableOperation<T> {
|
|
150
199
|
}
|
|
151
200
|
|
|
201
|
+
/**
|
|
202
|
+
* Mutation Result from `executeMutation`
|
|
203
|
+
*/
|
|
152
204
|
export declare interface MutationResult<Data, Variables> extends DataConnectResult<Data, Variables> {
|
|
153
205
|
ref: MutationRef<Data, Variables>;
|
|
154
206
|
}
|
|
155
207
|
|
|
156
|
-
|
|
157
|
-
|
|
208
|
+
/**
|
|
209
|
+
* `OnCompleteSubscription`
|
|
210
|
+
*/
|
|
158
211
|
export declare type OnCompleteSubscription = () => void;
|
|
159
212
|
|
|
213
|
+
/**
|
|
214
|
+
* Signature for `OnErrorSubscription` for `subscribe`
|
|
215
|
+
*/
|
|
160
216
|
export declare type OnErrorSubscription = (err?: DataConnectError) => void;
|
|
161
217
|
|
|
218
|
+
/**
|
|
219
|
+
* Signature for `OnResultSubscription` for `subscribe`
|
|
220
|
+
*/
|
|
162
221
|
export declare type OnResultSubscription<Data, Variables> = (res: QueryResult<Data, Variables>) => void;
|
|
163
222
|
|
|
164
223
|
export declare interface OperationRef<_Data, Variables> {
|
|
@@ -176,48 +235,69 @@ export declare interface OpResult<Data> {
|
|
|
176
235
|
|
|
177
236
|
/* Excluded from this release type: parseOptions */
|
|
178
237
|
|
|
179
|
-
export declare
|
|
180
|
-
location: string;
|
|
181
|
-
connector: string;
|
|
182
|
-
service: string;
|
|
183
|
-
projectId: string;
|
|
184
|
-
}
|
|
238
|
+
export declare const QUERY_STR = "query";
|
|
185
239
|
|
|
186
240
|
declare class QueryManager {
|
|
187
241
|
private transport;
|
|
188
242
|
_queries: Map<string, TrackedQuery<unknown, unknown>>;
|
|
189
243
|
constructor(transport: DataConnectTransport);
|
|
190
|
-
track<
|
|
191
|
-
addSubscription<
|
|
192
|
-
executeQuery<
|
|
244
|
+
track<Data, Variables>(queryName: string, variables: Variables, initialCache?: OpResult<Data>): TrackedQuery<unknown, unknown>;
|
|
245
|
+
addSubscription<Data, Variables>(queryRef: OperationRef<Data, Variables>, onResultCallback: OnResultSubscription<Data, Variables>, onErrorCallback?: OnErrorSubscription, initialCache?: OpResult<Data>): () => void;
|
|
246
|
+
executeQuery<Data, Variables>(queryRef: QueryRef<Data, Variables>): QueryPromise<Data, Variables>;
|
|
193
247
|
enableEmulator(host: string, port: number): void;
|
|
194
248
|
}
|
|
195
249
|
|
|
250
|
+
/**
|
|
251
|
+
* Promise returned from `executeQuery`
|
|
252
|
+
*/
|
|
196
253
|
export declare interface QueryPromise<Data, Variables> extends PromiseLike<QueryResult<Data, Variables>> {
|
|
197
254
|
}
|
|
198
255
|
|
|
256
|
+
/**
|
|
257
|
+
* QueryRef object
|
|
258
|
+
*/
|
|
199
259
|
export declare interface QueryRef<Data, Variables> extends OperationRef<Data, Variables> {
|
|
200
|
-
refType: typeof
|
|
260
|
+
refType: typeof QUERY_STR;
|
|
201
261
|
}
|
|
202
262
|
|
|
263
|
+
/**
|
|
264
|
+
* Execute Query
|
|
265
|
+
* @param dcInstance Data Connect instance to use.
|
|
266
|
+
* @param queryName Query to execute
|
|
267
|
+
* @returns `QueryRef`
|
|
268
|
+
*/
|
|
203
269
|
export declare function queryRef<Data>(dcInstance: DataConnect, queryName: string): QueryRef<Data, undefined>;
|
|
204
270
|
|
|
271
|
+
/**
|
|
272
|
+
* Execute Query
|
|
273
|
+
* @param dcInstance Data Connect instance to use.
|
|
274
|
+
* @param queryName Query to execute
|
|
275
|
+
* @param variables Variables to execute with
|
|
276
|
+
* @returns `QueryRef`
|
|
277
|
+
*/
|
|
205
278
|
export declare function queryRef<Data, Variables>(dcInstance: DataConnect, queryName: string, variables: Variables): QueryRef<Data, Variables>;
|
|
206
279
|
|
|
207
280
|
export declare interface QueryResponse<T> extends CancellableOperation<T> {
|
|
208
281
|
}
|
|
209
282
|
|
|
283
|
+
/**
|
|
284
|
+
* Result of `executeQuery`
|
|
285
|
+
*/
|
|
210
286
|
export declare interface QueryResult<Data, Variables> extends DataConnectResult<Data, Variables> {
|
|
211
287
|
ref: QueryRef<Data, Variables>;
|
|
212
288
|
toJSON: () => SerializedRef<Data, Variables>;
|
|
213
289
|
}
|
|
214
290
|
|
|
215
|
-
|
|
216
|
-
|
|
291
|
+
/**
|
|
292
|
+
* Signature for unsubscribe from `subscribe`
|
|
293
|
+
*/
|
|
217
294
|
export declare type QueryUnsubscribe = () => void;
|
|
218
295
|
|
|
219
|
-
export declare type ReferenceType = typeof
|
|
296
|
+
export declare type ReferenceType = typeof QUERY_STR | typeof MUTATION_STR;
|
|
220
297
|
|
|
298
|
+
/**
|
|
299
|
+
* Serialized RefInfo as a result of `QueryResult.toJSON().refInfo`
|
|
300
|
+
*/
|
|
221
301
|
export declare interface RefInfo<Variables> {
|
|
222
302
|
name: string;
|
|
223
303
|
variables: Variables;
|
|
@@ -229,6 +309,9 @@ export declare interface Sender<T> {
|
|
|
229
309
|
send: () => Promise<T>;
|
|
230
310
|
}
|
|
231
311
|
|
|
312
|
+
/**
|
|
313
|
+
* Serialized Ref as a result of `QueryResult.toJSON()`
|
|
314
|
+
*/
|
|
232
315
|
export declare interface SerializedRef<Data, Variables> extends OpResult<Data> {
|
|
233
316
|
refInfo: RefInfo<Variables>;
|
|
234
317
|
}
|
|
@@ -240,37 +323,58 @@ export declare const SOURCE_CACHE = "CACHE";
|
|
|
240
323
|
export declare const SOURCE_SERVER = "SERVER";
|
|
241
324
|
|
|
242
325
|
/**
|
|
243
|
-
*
|
|
244
|
-
* @
|
|
245
|
-
* @param
|
|
246
|
-
* @
|
|
247
|
-
* @param onErr
|
|
248
|
-
* @param initialCache
|
|
249
|
-
* @returns
|
|
326
|
+
* Subscribe to a `QueryRef`
|
|
327
|
+
* @param queryRefOrSerializedResult query ref or serialized result.
|
|
328
|
+
* @param observer observer object to use for subscribing.
|
|
329
|
+
* @returns `SubscriptionOptions`
|
|
250
330
|
*/
|
|
251
331
|
export declare function subscribe<Data, Variables>(queryRefOrSerializedResult: QueryRef<Data, Variables> | SerializedRef<Data, Variables>, observer: SubscriptionOptions<Data, Variables>): QueryUnsubscribe;
|
|
252
332
|
|
|
333
|
+
/**
|
|
334
|
+
* Subscribe to a `QueryRef`
|
|
335
|
+
* @param queryRefOrSerializedResult query ref or serialized result.
|
|
336
|
+
* @param onNext Callback to call when result comes back.
|
|
337
|
+
* @param onError Callback to call when error gets thrown.
|
|
338
|
+
* @param onComplete Called when subscription completes.
|
|
339
|
+
* @returns `SubscriptionOptions`
|
|
340
|
+
*/
|
|
253
341
|
export declare function subscribe<Data, Variables>(queryRefOrSerializedResult: QueryRef<Data, Variables> | SerializedRef<Data, Variables>, onNext: OnResultSubscription<Data, Variables>, onError?: OnErrorSubscription, onComplete?: OnCompleteSubscription): QueryUnsubscribe;
|
|
254
342
|
|
|
343
|
+
/**
|
|
344
|
+
* Representation of full observer options in `subscribe`
|
|
345
|
+
*/
|
|
255
346
|
export declare interface SubscriptionOptions<Data, Variables> {
|
|
256
347
|
onNext?: OnResultSubscription<Data, Variables>;
|
|
257
348
|
onErr?: OnErrorSubscription;
|
|
258
349
|
onComplete?: OnCompleteSubscription;
|
|
259
350
|
}
|
|
260
351
|
|
|
261
|
-
|
|
352
|
+
/**
|
|
353
|
+
* Delete DataConnect instance
|
|
354
|
+
* @param dataConnect DataConnect instance
|
|
355
|
+
* @returns
|
|
356
|
+
*/
|
|
357
|
+
export declare function terminate(dataConnect: DataConnect): Promise<void>;
|
|
262
358
|
|
|
359
|
+
/**
|
|
360
|
+
* Converts serialized ref to query ref
|
|
361
|
+
* @param serializedRef ref to convert to `QueryRef`
|
|
362
|
+
* @returns `QueryRef`
|
|
363
|
+
*/
|
|
263
364
|
export declare function toQueryRef<Data, Variables>(serializedRef: SerializedRef<Data, Variables>): QueryRef<unknown, Variables>;
|
|
264
365
|
|
|
265
|
-
declare interface TrackedQuery<
|
|
266
|
-
ref: Omit<OperationRef<
|
|
267
|
-
subscriptions: Array<DataConnectSubscription<
|
|
268
|
-
currentCache: OpResult<
|
|
366
|
+
declare interface TrackedQuery<Data, Variables> {
|
|
367
|
+
ref: Omit<OperationRef<Data, Variables>, 'dataConnect'>;
|
|
368
|
+
subscriptions: Array<DataConnectSubscription<Data, Variables>>;
|
|
369
|
+
currentCache: OpResult<Data> | null;
|
|
269
370
|
lastError: DataConnectError | null;
|
|
270
371
|
}
|
|
271
372
|
|
|
272
373
|
export declare type TransportClass = new (options: DataConnectOptions, apiKey?: string, authProvider?: AuthTokenProvider, transportOptions?: TransportOptions) => DataConnectTransport;
|
|
273
374
|
|
|
375
|
+
/**
|
|
376
|
+
* Options to connect to emulator
|
|
377
|
+
*/
|
|
274
378
|
export declare interface TransportOptions {
|
|
275
379
|
host: string;
|
|
276
380
|
sslEnabled?: boolean;
|