@firebase/data-connect 0.0.2-dataconnect-preview.877f8b7d0 → 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 +59 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm2017.js +59 -3
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +59 -3
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +59 -3
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/internal.d.ts +127 -8
- package/dist/node-esm/index.node.esm.js +59 -3
- package/dist/node-esm/index.node.esm.js.map +1 -1
- package/dist/node-esm/src/api/DataConnect.d.ts +33 -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/query.d.ts +50 -0
- package/dist/node-esm/src/api.browser.d.ts +12 -7
- package/dist/private.d.ts +125 -14
- package/dist/public.d.ts +125 -12
- package/dist/src/api/DataConnect.d.ts +33 -0
- package/dist/src/api/Mutation.d.ts +26 -1
- package/dist/src/api/Reference.d.ts +6 -0
- package/dist/src/api/query.d.ts +50 -0
- package/dist/src/api.browser.d.ts +12 -7
- package/package.json +6 -6
|
@@ -20,17 +20,42 @@ import { DataConnectResult, MUTATION_STR, OperationRef } from './Reference';
|
|
|
20
20
|
export interface MutationRef<Data, Variables> extends OperationRef<Data, Variables> {
|
|
21
21
|
refType: typeof MUTATION_STR;
|
|
22
22
|
}
|
|
23
|
-
|
|
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
|
+
*/
|
|
24
35
|
export declare function mutationRef<Data, Variables>(dcInstance: DataConnect, mutationName: string, variables: Variables): MutationRef<Data, Variables>;
|
|
36
|
+
/**
|
|
37
|
+
* @internal
|
|
38
|
+
*/
|
|
25
39
|
export declare class MutationManager {
|
|
26
40
|
private _transport;
|
|
27
41
|
private _inflight;
|
|
28
42
|
constructor(_transport: DataConnectTransport);
|
|
29
43
|
executeMutation<Data, Variables>(mutationRef: MutationRef<Data, Variables>): MutationPromise<Data, Variables>;
|
|
30
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Mutation Result from `executeMutation`
|
|
47
|
+
*/
|
|
31
48
|
export interface MutationResult<Data, Variables> extends DataConnectResult<Data, Variables> {
|
|
32
49
|
ref: MutationRef<Data, Variables>;
|
|
33
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Mutation return value from `executeMutation`
|
|
53
|
+
*/
|
|
34
54
|
export interface MutationPromise<Data, Variables> extends PromiseLike<MutationResult<Data, Variables>> {
|
|
35
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* Execute Mutation
|
|
58
|
+
* @param mutationRef mutation to execute
|
|
59
|
+
* @returns `MutationRef`
|
|
60
|
+
*/
|
|
36
61
|
export declare function executeMutation<Data, Variables>(mutationRef: MutationRef<Data, Variables>): MutationPromise<Data, Variables>;
|
|
@@ -35,11 +35,17 @@ export interface OperationRef<_Data, Variables> {
|
|
|
35
35
|
export interface DataConnectResult<Data, Variables> extends OpResult<Data> {
|
|
36
36
|
ref: OperationRef<Data, Variables>;
|
|
37
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Serialized RefInfo as a result of `QueryResult.toJSON().refInfo`
|
|
40
|
+
*/
|
|
38
41
|
export interface RefInfo<Variables> {
|
|
39
42
|
name: string;
|
|
40
43
|
variables: Variables;
|
|
41
44
|
connectorConfig: DataConnectOptions;
|
|
42
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* Serialized Ref as a result of `QueryResult.toJSON()`
|
|
48
|
+
*/
|
|
43
49
|
export interface SerializedRef<Data, Variables> extends OpResult<Data> {
|
|
44
50
|
refInfo: RefInfo<Variables>;
|
|
45
51
|
}
|
package/dist/src/api/query.d.ts
CHANGED
|
@@ -17,28 +17,78 @@
|
|
|
17
17
|
import { DataConnectError } from '../core/error';
|
|
18
18
|
import { DataConnect } from './DataConnect';
|
|
19
19
|
import { OperationRef, QUERY_STR, DataConnectResult, SerializedRef } from './Reference';
|
|
20
|
+
/**
|
|
21
|
+
* Signature for `OnResultSubscription` for `subscribe`
|
|
22
|
+
*/
|
|
20
23
|
export declare type OnResultSubscription<Data, Variables> = (res: QueryResult<Data, Variables>) => void;
|
|
24
|
+
/**
|
|
25
|
+
* Signature for `OnErrorSubscription` for `subscribe`
|
|
26
|
+
*/
|
|
21
27
|
export declare type OnErrorSubscription = (err?: DataConnectError) => void;
|
|
28
|
+
/**
|
|
29
|
+
* Signature for unsubscribe from `subscribe`
|
|
30
|
+
*/
|
|
22
31
|
export declare type QueryUnsubscribe = () => void;
|
|
32
|
+
/**
|
|
33
|
+
* Representation of user provided subscription options.
|
|
34
|
+
*/
|
|
23
35
|
export interface DataConnectSubscription<Data, Variables> {
|
|
24
36
|
userCallback: OnResultSubscription<Data, Variables>;
|
|
25
37
|
errCallback?: (e?: DataConnectError) => void;
|
|
26
38
|
unsubscribe: () => void;
|
|
27
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* QueryRef object
|
|
42
|
+
*/
|
|
28
43
|
export interface QueryRef<Data, Variables> extends OperationRef<Data, Variables> {
|
|
29
44
|
refType: typeof QUERY_STR;
|
|
30
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* Result of `executeQuery`
|
|
48
|
+
*/
|
|
31
49
|
export interface QueryResult<Data, Variables> extends DataConnectResult<Data, Variables> {
|
|
32
50
|
ref: QueryRef<Data, Variables>;
|
|
33
51
|
toJSON: () => SerializedRef<Data, Variables>;
|
|
34
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Promise returned from `executeQuery`
|
|
55
|
+
*/
|
|
35
56
|
export interface QueryPromise<Data, Variables> extends PromiseLike<QueryResult<Data, Variables>> {
|
|
36
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* Execute Query
|
|
60
|
+
* @param queryRef query to execute.
|
|
61
|
+
* @returns `QueryPromise`
|
|
62
|
+
*/
|
|
37
63
|
export declare function executeQuery<Data, Variables>(queryRef: QueryRef<Data, Variables>): QueryPromise<Data, Variables>;
|
|
64
|
+
/**
|
|
65
|
+
* Execute Query
|
|
66
|
+
* @param dcInstance Data Connect instance to use.
|
|
67
|
+
* @param queryName Query to execute
|
|
68
|
+
* @returns `QueryRef`
|
|
69
|
+
*/
|
|
38
70
|
export declare function queryRef<Data>(dcInstance: DataConnect, queryName: string): QueryRef<Data, undefined>;
|
|
71
|
+
/**
|
|
72
|
+
* Execute Query
|
|
73
|
+
* @param dcInstance Data Connect instance to use.
|
|
74
|
+
* @param queryName Query to execute
|
|
75
|
+
* @param variables Variables to execute with
|
|
76
|
+
* @returns `QueryRef`
|
|
77
|
+
*/
|
|
39
78
|
export declare function queryRef<Data, Variables>(dcInstance: DataConnect, queryName: string, variables: Variables): QueryRef<Data, Variables>;
|
|
79
|
+
/**
|
|
80
|
+
* Converts serialized ref to query ref
|
|
81
|
+
* @param serializedRef ref to convert to `QueryRef`
|
|
82
|
+
* @returns `QueryRef`
|
|
83
|
+
*/
|
|
40
84
|
export declare function toQueryRef<Data, Variables>(serializedRef: SerializedRef<Data, Variables>): QueryRef<unknown, Variables>;
|
|
85
|
+
/**
|
|
86
|
+
* `OnCompleteSubscription`
|
|
87
|
+
*/
|
|
41
88
|
export declare type OnCompleteSubscription = () => void;
|
|
89
|
+
/**
|
|
90
|
+
* Representation of full observer options in `subscribe`
|
|
91
|
+
*/
|
|
42
92
|
export interface SubscriptionOptions<Data, Variables> {
|
|
43
93
|
onNext?: OnResultSubscription<Data, Variables>;
|
|
44
94
|
onErr?: OnErrorSubscription;
|
|
@@ -17,13 +17,18 @@
|
|
|
17
17
|
import { OnCompleteSubscription, OnErrorSubscription, OnResultSubscription, QueryRef, QueryUnsubscribe, SubscriptionOptions } from './api/query';
|
|
18
18
|
import { SerializedRef } from './api/Reference';
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
21
|
-
* @
|
|
22
|
-
* @param
|
|
23
|
-
* @
|
|
24
|
-
* @param onErr
|
|
25
|
-
* @param initialCache
|
|
26
|
-
* @returns
|
|
20
|
+
* Subscribe to a `QueryRef`
|
|
21
|
+
* @param queryRefOrSerializedResult query ref or serialized result.
|
|
22
|
+
* @param observer observer object to use for subscribing.
|
|
23
|
+
* @returns `SubscriptionOptions`
|
|
27
24
|
*/
|
|
28
25
|
export declare function subscribe<Data, Variables>(queryRefOrSerializedResult: QueryRef<Data, Variables> | SerializedRef<Data, Variables>, observer: SubscriptionOptions<Data, Variables>): QueryUnsubscribe;
|
|
26
|
+
/**
|
|
27
|
+
* Subscribe to a `QueryRef`
|
|
28
|
+
* @param queryRefOrSerializedResult query ref or serialized result.
|
|
29
|
+
* @param onNext Callback to call when result comes back.
|
|
30
|
+
* @param onError Callback to call when error gets thrown.
|
|
31
|
+
* @param onComplete Called when subscription completes.
|
|
32
|
+
* @returns `SubscriptionOptions`
|
|
33
|
+
*/
|
|
29
34
|
export declare function subscribe<Data, Variables>(queryRefOrSerializedResult: QueryRef<Data, Variables> | SerializedRef<Data, Variables>, onNext: OnResultSubscription<Data, Variables>, onError?: OnErrorSubscription, onComplete?: OnCompleteSubscription): QueryUnsubscribe;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@firebase/data-connect",
|
|
3
|
-
"version": "0.0.2-dataconnect-preview.
|
|
3
|
+
"version": "0.0.2-dataconnect-preview.388b61c7e",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "Firebase <firebase-support@google.com> (https://firebase.google.com/)",
|
|
6
6
|
"main": "dist/index.node.cjs.js",
|
|
@@ -46,14 +46,14 @@
|
|
|
46
46
|
},
|
|
47
47
|
"license": "Apache-2.0",
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@firebase/auth-interop-types": "0.2.3-dataconnect-preview.
|
|
50
|
-
"@firebase/component": "0.6.7-dataconnect-preview.
|
|
51
|
-
"@firebase/logger": "0.4.2-dataconnect-preview.
|
|
52
|
-
"@firebase/util": "1.9.6-dataconnect-preview.
|
|
49
|
+
"@firebase/auth-interop-types": "0.2.3-dataconnect-preview.388b61c7e",
|
|
50
|
+
"@firebase/component": "0.6.7-dataconnect-preview.388b61c7e",
|
|
51
|
+
"@firebase/logger": "0.4.2-dataconnect-preview.388b61c7e",
|
|
52
|
+
"@firebase/util": "1.9.6-dataconnect-preview.388b61c7e",
|
|
53
53
|
"tslib": "^2.1.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@firebase/app": "0.10.3-dataconnect-preview.
|
|
56
|
+
"@firebase/app": "0.10.3-dataconnect-preview.388b61c7e",
|
|
57
57
|
"rollup": "2.79.1",
|
|
58
58
|
"rollup-plugin-typescript2": "0.31.2",
|
|
59
59
|
"typescript": "4.7.4"
|