@firebase/data-connect 0.0.1-dataconnect-preview.81ee5169c → 0.0.2-dataconnect-preview.877f8b7d0
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 +123 -139
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm2017.js +122 -138
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +125 -141
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +74 -70
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/internal.d.ts +30 -37
- package/dist/node-esm/index.node.esm.js +74 -70
- package/dist/node-esm/index.node.esm.js.map +1 -1
- package/dist/node-esm/src/api/DataConnect.d.ts +6 -12
- package/dist/node-esm/src/api/Mutation.d.ts +8 -8
- package/dist/node-esm/src/api/Reference.d.ts +3 -3
- package/dist/node-esm/src/api/query.d.ts +2 -2
- 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 +30 -37
- package/dist/public.d.ts +13 -28
- package/dist/src/api/DataConnect.d.ts +6 -12
- package/dist/src/api/Mutation.d.ts +8 -8
- package/dist/src/api/Reference.d.ts +3 -3
- package/dist/src/api/query.d.ts +2 -2
- 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
package/dist/private.d.ts
CHANGED
|
@@ -36,16 +36,16 @@ export declare interface ConnectorConfig {
|
|
|
36
36
|
export declare class DataConnect {
|
|
37
37
|
readonly app: FirebaseApp;
|
|
38
38
|
private readonly dataConnectOptions;
|
|
39
|
-
private readonly
|
|
39
|
+
private readonly _authProvider;
|
|
40
40
|
_queryManager: QueryManager;
|
|
41
41
|
_mutationManager: MutationManager;
|
|
42
42
|
isEmulator: boolean;
|
|
43
43
|
initialized: boolean;
|
|
44
44
|
private _transport;
|
|
45
|
-
private
|
|
46
|
-
private
|
|
47
|
-
private
|
|
48
|
-
constructor(app: FirebaseApp, dataConnectOptions: DataConnectOptions,
|
|
45
|
+
private _transportClass;
|
|
46
|
+
private _transportOptions?;
|
|
47
|
+
private _authTokenProvider?;
|
|
48
|
+
constructor(app: FirebaseApp, dataConnectOptions: DataConnectOptions, _authProvider: Provider<FirebaseAuthInternalName>);
|
|
49
49
|
_delete(): Promise<void>;
|
|
50
50
|
getSettings(): ConnectorConfig;
|
|
51
51
|
setInitialized(): void;
|
|
@@ -114,11 +114,11 @@ export declare function executeQuery<Data, Variables>(queryRef: QueryRef<Data, V
|
|
|
114
114
|
export declare const FIREBASE_DATA_CONNECT_EMULATOR_HOST_VAR = "FIREBASE_DATA_CONNECT_EMULATOR_HOST";
|
|
115
115
|
|
|
116
116
|
export declare class FirebaseAuthProvider implements AuthTokenProvider {
|
|
117
|
-
private
|
|
118
|
-
private
|
|
119
|
-
private
|
|
120
|
-
private
|
|
121
|
-
constructor(
|
|
117
|
+
private _appName;
|
|
118
|
+
private _options;
|
|
119
|
+
private _authProvider;
|
|
120
|
+
private _auth;
|
|
121
|
+
constructor(_appName: string, _options: FirebaseOptions, _authProvider: Provider<FirebaseAuthInternalName>);
|
|
122
122
|
getToken(forceRefresh: boolean): Promise<FirebaseAuthTokenData | null>;
|
|
123
123
|
addTokenChangeListener(listener: AuthTokenListener): void;
|
|
124
124
|
removeTokenChangeListener(listener: (token: string | null) => void): void;
|
|
@@ -128,23 +128,25 @@ export declare function getDataConnect(options: ConnectorConfig): DataConnect;
|
|
|
128
128
|
|
|
129
129
|
export declare function getDataConnect(app: FirebaseApp, options: ConnectorConfig): DataConnect;
|
|
130
130
|
|
|
131
|
+
export declare const MUTATION_STR = "mutation";
|
|
132
|
+
|
|
131
133
|
export declare class MutationManager {
|
|
132
|
-
private
|
|
134
|
+
private _transport;
|
|
133
135
|
private _inflight;
|
|
134
|
-
constructor(
|
|
135
|
-
executeMutation<
|
|
136
|
+
constructor(_transport: DataConnectTransport);
|
|
137
|
+
executeMutation<Data, Variables>(mutationRef: MutationRef<Data, Variables>): MutationPromise<Data, Variables>;
|
|
136
138
|
}
|
|
137
139
|
|
|
138
140
|
export declare interface MutationPromise<Data, Variables> extends PromiseLike<MutationResult<Data, Variables>> {
|
|
139
141
|
}
|
|
140
142
|
|
|
141
|
-
export declare interface MutationRef<
|
|
142
|
-
refType: typeof
|
|
143
|
+
export declare interface MutationRef<Data, Variables> extends OperationRef<Data, Variables> {
|
|
144
|
+
refType: typeof MUTATION_STR;
|
|
143
145
|
}
|
|
144
146
|
|
|
145
|
-
export declare function mutationRef<
|
|
147
|
+
export declare function mutationRef<Data>(dcInstance: DataConnect, queryName: string): MutationRef<Data, undefined>;
|
|
146
148
|
|
|
147
|
-
export declare function mutationRef<
|
|
149
|
+
export declare function mutationRef<Data, Variables>(dcInstance: DataConnect, mutationName: string, variables: Variables): MutationRef<Data, Variables>;
|
|
148
150
|
|
|
149
151
|
export declare interface MutationResponse<T> extends CancellableOperation<T> {
|
|
150
152
|
}
|
|
@@ -153,8 +155,6 @@ export declare interface MutationResult<Data, Variables> extends DataConnectResu
|
|
|
153
155
|
ref: MutationRef<Data, Variables>;
|
|
154
156
|
}
|
|
155
157
|
|
|
156
|
-
export declare const MutationStr = "mutation";
|
|
157
|
-
|
|
158
158
|
export declare type OnCompleteSubscription = () => void;
|
|
159
159
|
|
|
160
160
|
export declare type OnErrorSubscription = (err?: DataConnectError) => void;
|
|
@@ -176,20 +176,15 @@ export declare interface OpResult<Data> {
|
|
|
176
176
|
|
|
177
177
|
/* Excluded from this release type: parseOptions */
|
|
178
178
|
|
|
179
|
-
export declare
|
|
180
|
-
location: string;
|
|
181
|
-
connector: string;
|
|
182
|
-
service: string;
|
|
183
|
-
projectId: string;
|
|
184
|
-
}
|
|
179
|
+
export declare const QUERY_STR = "query";
|
|
185
180
|
|
|
186
181
|
declare class QueryManager {
|
|
187
182
|
private transport;
|
|
188
183
|
_queries: Map<string, TrackedQuery<unknown, unknown>>;
|
|
189
184
|
constructor(transport: DataConnectTransport);
|
|
190
|
-
track<
|
|
191
|
-
addSubscription<
|
|
192
|
-
executeQuery<
|
|
185
|
+
track<Data, Variables>(queryName: string, variables: Variables, initialCache?: OpResult<Data>): TrackedQuery<unknown, unknown>;
|
|
186
|
+
addSubscription<Data, Variables>(queryRef: OperationRef<Data, Variables>, onResultCallback: OnResultSubscription<Data, Variables>, onErrorCallback?: OnErrorSubscription, initialCache?: OpResult<Data>): () => void;
|
|
187
|
+
executeQuery<Data, Variables>(queryRef: QueryRef<Data, Variables>): QueryPromise<Data, Variables>;
|
|
193
188
|
enableEmulator(host: string, port: number): void;
|
|
194
189
|
}
|
|
195
190
|
|
|
@@ -197,7 +192,7 @@ export declare interface QueryPromise<Data, Variables> extends PromiseLike<Query
|
|
|
197
192
|
}
|
|
198
193
|
|
|
199
194
|
export declare interface QueryRef<Data, Variables> extends OperationRef<Data, Variables> {
|
|
200
|
-
refType: typeof
|
|
195
|
+
refType: typeof QUERY_STR;
|
|
201
196
|
}
|
|
202
197
|
|
|
203
198
|
export declare function queryRef<Data>(dcInstance: DataConnect, queryName: string): QueryRef<Data, undefined>;
|
|
@@ -212,11 +207,9 @@ export declare interface QueryResult<Data, Variables> extends DataConnectResult<
|
|
|
212
207
|
toJSON: () => SerializedRef<Data, Variables>;
|
|
213
208
|
}
|
|
214
209
|
|
|
215
|
-
export declare const QueryStr = "query";
|
|
216
|
-
|
|
217
210
|
export declare type QueryUnsubscribe = () => void;
|
|
218
211
|
|
|
219
|
-
export declare type ReferenceType = typeof
|
|
212
|
+
export declare type ReferenceType = typeof QUERY_STR | typeof MUTATION_STR;
|
|
220
213
|
|
|
221
214
|
export declare interface RefInfo<Variables> {
|
|
222
215
|
name: string;
|
|
@@ -258,14 +251,14 @@ export declare interface SubscriptionOptions<Data, Variables> {
|
|
|
258
251
|
onComplete?: OnCompleteSubscription;
|
|
259
252
|
}
|
|
260
253
|
|
|
261
|
-
export declare function terminate(dataConnect: DataConnect): void
|
|
254
|
+
export declare function terminate(dataConnect: DataConnect): Promise<void>;
|
|
262
255
|
|
|
263
256
|
export declare function toQueryRef<Data, Variables>(serializedRef: SerializedRef<Data, Variables>): QueryRef<unknown, Variables>;
|
|
264
257
|
|
|
265
|
-
declare interface TrackedQuery<
|
|
266
|
-
ref: Omit<OperationRef<
|
|
267
|
-
subscriptions: Array<DataConnectSubscription<
|
|
268
|
-
currentCache: OpResult<
|
|
258
|
+
declare interface TrackedQuery<Data, Variables> {
|
|
259
|
+
ref: Omit<OperationRef<Data, Variables>, 'dataConnect'>;
|
|
260
|
+
subscriptions: Array<DataConnectSubscription<Data, Variables>>;
|
|
261
|
+
currentCache: OpResult<Data> | null;
|
|
269
262
|
lastError: DataConnectError | null;
|
|
270
263
|
}
|
|
271
264
|
|
package/dist/public.d.ts
CHANGED
|
@@ -30,13 +30,9 @@ export declare interface ConnectorConfig {
|
|
|
30
30
|
export declare class DataConnect {
|
|
31
31
|
readonly app: FirebaseApp;
|
|
32
32
|
private readonly dataConnectOptions;
|
|
33
|
-
private readonly authProvider;
|
|
34
33
|
isEmulator: boolean;
|
|
35
34
|
initialized: boolean;
|
|
36
|
-
|
|
37
|
-
private transportOptions?;
|
|
38
|
-
private authTokenProvider?;
|
|
39
|
-
constructor(app: FirebaseApp, dataConnectOptions: DataConnectOptions, authProvider: Provider<FirebaseAuthInternalName>);
|
|
35
|
+
constructor(app: FirebaseApp, dataConnectOptions: DataConnectOptions, _authProvider: Provider<FirebaseAuthInternalName>);
|
|
40
36
|
getSettings(): ConnectorConfig;
|
|
41
37
|
setInitialized(): void;
|
|
42
38
|
enableEmulator(transportOptions: TransportOptions): void;
|
|
@@ -69,35 +65,30 @@ export declare function executeMutation<Data, Variables>(mutationRef: MutationRe
|
|
|
69
65
|
export declare function executeQuery<Data, Variables>(queryRef: QueryRef<Data, Variables>): QueryPromise<Data, Variables>;
|
|
70
66
|
export declare const FIREBASE_DATA_CONNECT_EMULATOR_HOST_VAR = "FIREBASE_DATA_CONNECT_EMULATOR_HOST";
|
|
71
67
|
export declare class FirebaseAuthProvider implements AuthTokenProvider {
|
|
72
|
-
|
|
73
|
-
private options;
|
|
74
|
-
private authProvider_;
|
|
75
|
-
private auth_;
|
|
76
|
-
constructor(appName: string, options: FirebaseOptions, authProvider_: Provider<FirebaseAuthInternalName>);
|
|
68
|
+
constructor(_appName: string, _options: FirebaseOptions, _authProvider: Provider<FirebaseAuthInternalName>);
|
|
77
69
|
getToken(forceRefresh: boolean): Promise<FirebaseAuthTokenData | null>;
|
|
78
70
|
addTokenChangeListener(listener: AuthTokenListener): void;
|
|
79
71
|
removeTokenChangeListener(listener: (token: string | null) => void): void;
|
|
80
72
|
}
|
|
81
73
|
export declare function getDataConnect(options: ConnectorConfig): DataConnect;
|
|
82
74
|
export declare function getDataConnect(app: FirebaseApp, options: ConnectorConfig): DataConnect;
|
|
75
|
+
export declare const MUTATION_STR = "mutation";
|
|
83
76
|
export declare class MutationManager {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
executeMutation<Response, Variables>(mutationRef: MutationRef<Response, Variables>): MutationPromise<Response, Variables>;
|
|
77
|
+
constructor(_transport: DataConnectTransport);
|
|
78
|
+
executeMutation<Data, Variables>(mutationRef: MutationRef<Data, Variables>): MutationPromise<Data, Variables>;
|
|
87
79
|
}
|
|
88
80
|
export declare interface MutationPromise<Data, Variables> extends PromiseLike<MutationResult<Data, Variables>> {
|
|
89
81
|
}
|
|
90
|
-
export declare interface MutationRef<
|
|
91
|
-
refType: typeof
|
|
82
|
+
export declare interface MutationRef<Data, Variables> extends OperationRef<Data, Variables> {
|
|
83
|
+
refType: typeof MUTATION_STR;
|
|
92
84
|
}
|
|
93
|
-
export declare function mutationRef<
|
|
94
|
-
export declare function mutationRef<
|
|
85
|
+
export declare function mutationRef<Data>(dcInstance: DataConnect, queryName: string): MutationRef<Data, undefined>;
|
|
86
|
+
export declare function mutationRef<Data, Variables>(dcInstance: DataConnect, mutationName: string, variables: Variables): MutationRef<Data, Variables>;
|
|
95
87
|
export declare interface MutationResponse<T> extends CancellableOperation<T> {
|
|
96
88
|
}
|
|
97
89
|
export declare interface MutationResult<Data, Variables> extends DataConnectResult<Data, Variables> {
|
|
98
90
|
ref: MutationRef<Data, Variables>;
|
|
99
91
|
}
|
|
100
|
-
export declare const MutationStr = "mutation";
|
|
101
92
|
export declare type OnCompleteSubscription = () => void;
|
|
102
93
|
export declare type OnErrorSubscription = (err?: FirebaseError) => void;
|
|
103
94
|
export declare type OnResultSubscription<Data, Variables> = (res: QueryResult<Data, Variables>) => void;
|
|
@@ -113,16 +104,11 @@ export declare interface OpResult<Data> {
|
|
|
113
104
|
fetchTime: string;
|
|
114
105
|
}
|
|
115
106
|
/* Excluded from this release type: parseOptions */
|
|
116
|
-
export declare
|
|
117
|
-
location: string;
|
|
118
|
-
connector: string;
|
|
119
|
-
service: string;
|
|
120
|
-
projectId: string;
|
|
121
|
-
}
|
|
107
|
+
export declare const QUERY_STR = "query";
|
|
122
108
|
export declare interface QueryPromise<Data, Variables> extends PromiseLike<QueryResult<Data, Variables>> {
|
|
123
109
|
}
|
|
124
110
|
export declare interface QueryRef<Data, Variables> extends OperationRef<Data, Variables> {
|
|
125
|
-
refType: typeof
|
|
111
|
+
refType: typeof QUERY_STR;
|
|
126
112
|
}
|
|
127
113
|
export declare function queryRef<Data>(dcInstance: DataConnect, queryName: string): QueryRef<Data, undefined>;
|
|
128
114
|
export declare function queryRef<Data, Variables>(dcInstance: DataConnect, queryName: string, variables: Variables): QueryRef<Data, Variables>;
|
|
@@ -132,9 +118,8 @@ export declare interface QueryResult<Data, Variables> extends DataConnectResult<
|
|
|
132
118
|
ref: QueryRef<Data, Variables>;
|
|
133
119
|
toJSON: () => SerializedRef<Data, Variables>;
|
|
134
120
|
}
|
|
135
|
-
export declare const QueryStr = "query";
|
|
136
121
|
export declare type QueryUnsubscribe = () => void;
|
|
137
|
-
export declare type ReferenceType = typeof
|
|
122
|
+
export declare type ReferenceType = typeof QUERY_STR | typeof MUTATION_STR;
|
|
138
123
|
export declare interface RefInfo<Variables> {
|
|
139
124
|
name: string;
|
|
140
125
|
variables: Variables;
|
|
@@ -166,7 +151,7 @@ export declare interface SubscriptionOptions<Data, Variables> {
|
|
|
166
151
|
onErr?: OnErrorSubscription;
|
|
167
152
|
onComplete?: OnCompleteSubscription;
|
|
168
153
|
}
|
|
169
|
-
export declare function terminate(dataConnect: DataConnect): void
|
|
154
|
+
export declare function terminate(dataConnect: DataConnect): Promise<void>;
|
|
170
155
|
export declare function toQueryRef<Data, Variables>(serializedRef: SerializedRef<Data, Variables>): QueryRef<unknown, Variables>;
|
|
171
156
|
export declare type TransportClass = new (options: DataConnectOptions, apiKey?: string, authProvider?: AuthTokenProvider, transportOptions?: TransportOptions) => DataConnectTransport;
|
|
172
157
|
export declare interface TransportOptions {
|
|
@@ -19,12 +19,6 @@ import { FirebaseAuthInternalName } from '@firebase/auth-interop-types';
|
|
|
19
19
|
import { Provider } from '@firebase/component';
|
|
20
20
|
import { QueryManager } from '../core/QueryManager';
|
|
21
21
|
import { MutationManager } from './Mutation';
|
|
22
|
-
export interface ProjectOptions {
|
|
23
|
-
location: string;
|
|
24
|
-
connector: string;
|
|
25
|
-
service: string;
|
|
26
|
-
projectId: string;
|
|
27
|
-
}
|
|
28
22
|
export interface ConnectorConfig {
|
|
29
23
|
location: string;
|
|
30
24
|
connector: string;
|
|
@@ -49,16 +43,16 @@ export interface DataConnectOptions extends ConnectorConfig {
|
|
|
49
43
|
export declare class DataConnect {
|
|
50
44
|
readonly app: FirebaseApp;
|
|
51
45
|
private readonly dataConnectOptions;
|
|
52
|
-
private readonly
|
|
46
|
+
private readonly _authProvider;
|
|
53
47
|
_queryManager: QueryManager;
|
|
54
48
|
_mutationManager: MutationManager;
|
|
55
49
|
isEmulator: boolean;
|
|
56
50
|
initialized: boolean;
|
|
57
51
|
private _transport;
|
|
58
|
-
private
|
|
59
|
-
private
|
|
60
|
-
private
|
|
61
|
-
constructor(app: FirebaseApp, dataConnectOptions: DataConnectOptions,
|
|
52
|
+
private _transportClass;
|
|
53
|
+
private _transportOptions?;
|
|
54
|
+
private _authTokenProvider?;
|
|
55
|
+
constructor(app: FirebaseApp, dataConnectOptions: DataConnectOptions, _authProvider: Provider<FirebaseAuthInternalName>);
|
|
62
56
|
_delete(): Promise<void>;
|
|
63
57
|
getSettings(): ConnectorConfig;
|
|
64
58
|
setInitialized(): void;
|
|
@@ -67,4 +61,4 @@ export declare class DataConnect {
|
|
|
67
61
|
export declare function connectDataConnectEmulator(dc: DataConnect, host: string, port?: number, sslEnabled?: boolean): void;
|
|
68
62
|
export declare function getDataConnect(options: ConnectorConfig): DataConnect;
|
|
69
63
|
export declare function getDataConnect(app: FirebaseApp, options: ConnectorConfig): DataConnect;
|
|
70
|
-
export declare function terminate(dataConnect: DataConnect): void
|
|
64
|
+
export declare function terminate(dataConnect: DataConnect): Promise<void>;
|
|
@@ -16,17 +16,17 @@
|
|
|
16
16
|
*/
|
|
17
17
|
import { DataConnectTransport } from '../network/transport';
|
|
18
18
|
import { DataConnect } from './DataConnect';
|
|
19
|
-
import { DataConnectResult,
|
|
20
|
-
export interface MutationRef<
|
|
21
|
-
refType: typeof
|
|
19
|
+
import { DataConnectResult, MUTATION_STR, OperationRef } from './Reference';
|
|
20
|
+
export interface MutationRef<Data, Variables> extends OperationRef<Data, Variables> {
|
|
21
|
+
refType: typeof MUTATION_STR;
|
|
22
22
|
}
|
|
23
|
-
export declare function mutationRef<
|
|
24
|
-
export declare function mutationRef<
|
|
23
|
+
export declare function mutationRef<Data>(dcInstance: DataConnect, queryName: string): MutationRef<Data, undefined>;
|
|
24
|
+
export declare function mutationRef<Data, Variables>(dcInstance: DataConnect, mutationName: string, variables: Variables): MutationRef<Data, Variables>;
|
|
25
25
|
export declare class MutationManager {
|
|
26
|
-
private
|
|
26
|
+
private _transport;
|
|
27
27
|
private _inflight;
|
|
28
|
-
constructor(
|
|
29
|
-
executeMutation<
|
|
28
|
+
constructor(_transport: DataConnectTransport);
|
|
29
|
+
executeMutation<Data, Variables>(mutationRef: MutationRef<Data, Variables>): MutationPromise<Data, Variables>;
|
|
30
30
|
}
|
|
31
31
|
export interface MutationResult<Data, Variables> extends DataConnectResult<Data, Variables> {
|
|
32
32
|
ref: MutationRef<Data, Variables>;
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
import { DataConnect, DataConnectOptions } from './DataConnect';
|
|
18
|
-
export declare const
|
|
19
|
-
export declare const
|
|
20
|
-
export declare type ReferenceType = typeof
|
|
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
21
|
export declare const SOURCE_SERVER = "SERVER";
|
|
22
22
|
export declare const SOURCE_CACHE = "CACHE";
|
|
23
23
|
export declare type DataSource = typeof SOURCE_CACHE | typeof SOURCE_SERVER;
|
package/dist/src/api/query.d.ts
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
import { DataConnectError } from '../core/error';
|
|
18
18
|
import { DataConnect } from './DataConnect';
|
|
19
|
-
import { OperationRef,
|
|
19
|
+
import { OperationRef, QUERY_STR, DataConnectResult, SerializedRef } from './Reference';
|
|
20
20
|
export declare type OnResultSubscription<Data, Variables> = (res: QueryResult<Data, Variables>) => void;
|
|
21
21
|
export declare type OnErrorSubscription = (err?: DataConnectError) => void;
|
|
22
22
|
export declare type QueryUnsubscribe = () => void;
|
|
@@ -26,7 +26,7 @@ export interface DataConnectSubscription<Data, Variables> {
|
|
|
26
26
|
unsubscribe: () => void;
|
|
27
27
|
}
|
|
28
28
|
export interface QueryRef<Data, Variables> extends OperationRef<Data, Variables> {
|
|
29
|
-
refType: typeof
|
|
29
|
+
refType: typeof QUERY_STR;
|
|
30
30
|
}
|
|
31
31
|
export interface QueryResult<Data, Variables> extends DataConnectResult<Data, Variables> {
|
|
32
32
|
ref: QueryRef<Data, Variables>;
|
|
@@ -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
|
}
|
package/dist/src/util/url.d.ts
CHANGED
|
@@ -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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@firebase/data-connect",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2-dataconnect-preview.877f8b7d0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "Firebase <firebase-support@google.com> (https://firebase.google.com/)",
|
|
6
6
|
"main": "dist/index.node.cjs.js",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"prettier": "prettier --write '*.js' '*.ts' '@(src|test)/**/*.ts'",
|
|
34
34
|
"build:deps": "lerna run --scope @firebase/'{app,data-connect}' --include-dependencies build",
|
|
35
35
|
"dev": "rollup -c -w",
|
|
36
|
-
"test": "run-p --npm-path npm
|
|
36
|
+
"test": "run-p --npm-path npm test:emulator",
|
|
37
37
|
"test:ci": "node ../../scripts/run_tests_in_ci.js -s test:emulator",
|
|
38
38
|
"test:all": "npm run test:node",
|
|
39
39
|
"test:browser": "karma start --single-run",
|
|
@@ -46,14 +46,14 @@
|
|
|
46
46
|
},
|
|
47
47
|
"license": "Apache-2.0",
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@firebase/auth-interop-types": "0.2.
|
|
50
|
-
"@firebase/component": "0.6.
|
|
51
|
-
"@firebase/logger": "0.4.
|
|
52
|
-
"@firebase/util": "1.9.
|
|
49
|
+
"@firebase/auth-interop-types": "0.2.3-dataconnect-preview.877f8b7d0",
|
|
50
|
+
"@firebase/component": "0.6.7-dataconnect-preview.877f8b7d0",
|
|
51
|
+
"@firebase/logger": "0.4.2-dataconnect-preview.877f8b7d0",
|
|
52
|
+
"@firebase/util": "1.9.6-dataconnect-preview.877f8b7d0",
|
|
53
53
|
"tslib": "^2.1.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@firebase/app": "0.10.
|
|
56
|
+
"@firebase/app": "0.10.3-dataconnect-preview.877f8b7d0",
|
|
57
57
|
"rollup": "2.79.1",
|
|
58
58
|
"rollup-plugin-typescript2": "0.31.2",
|
|
59
59
|
"typescript": "4.7.4"
|
|
@@ -1,22 +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 { ReferenceType } from '../src';
|
|
18
|
-
export interface SeedInfo {
|
|
19
|
-
type: ReferenceType;
|
|
20
|
-
name: string;
|
|
21
|
-
}
|
|
22
|
-
export declare function setupQueries(schema: string, seedInfoArray: SeedInfo[], skipSchema?: boolean): Promise<import("node-fetch").Response>;
|
|
@@ -1,17 +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
|
-
export {};
|
|
@@ -1,26 +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 { ConnectorConfig } from '../src';
|
|
18
|
-
export declare const USE_EMULATOR = true;
|
|
19
|
-
export declare const EMULATOR_PORT: string | undefined;
|
|
20
|
-
export declare const CONNECTOR_NAME = "c";
|
|
21
|
-
export declare const LOCATION_NAME = "l";
|
|
22
|
-
export declare const SERVICE_NAME = "l";
|
|
23
|
-
export declare const PROJECT_ID = "p";
|
|
24
|
-
export declare function getConnectionConfig(): ConnectorConfig;
|
|
25
|
-
export declare const app: import("@firebase/app").FirebaseApp;
|
|
26
|
-
export declare function initDatabase(): import("../src").DataConnect;
|
|
@@ -1,22 +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 { ReferenceType } from '../src';
|
|
18
|
-
export interface SeedInfo {
|
|
19
|
-
type: ReferenceType;
|
|
20
|
-
name: string;
|
|
21
|
-
}
|
|
22
|
-
export declare function setupQueries(schema: string, seedInfoArray: SeedInfo[], skipSchema?: boolean): Promise<import("node-fetch").Response>;
|
|
@@ -1,17 +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
|
-
export {};
|
package/dist/test/util.d.ts
DELETED
|
@@ -1,26 +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 { ConnectorConfig } from '../src';
|
|
18
|
-
export declare const USE_EMULATOR = true;
|
|
19
|
-
export declare const EMULATOR_PORT: string | undefined;
|
|
20
|
-
export declare const CONNECTOR_NAME = "c";
|
|
21
|
-
export declare const LOCATION_NAME = "l";
|
|
22
|
-
export declare const SERVICE_NAME = "l";
|
|
23
|
-
export declare const PROJECT_ID = "p";
|
|
24
|
-
export declare function getConnectionConfig(): ConnectorConfig;
|
|
25
|
-
export declare const app: import("@firebase/app").FirebaseApp;
|
|
26
|
-
export declare function initDatabase(): import("../src").DataConnect;
|