@firebase/data-connect 0.0.2-dataconnect-preview.877f8b7d0 → 0.0.3-canary.beaa4dffb

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 +304 -54
  2. package/dist/index.cjs.js.map +1 -1
  3. package/dist/index.esm2017.js +303 -53
  4. package/dist/index.esm2017.js.map +1 -1
  5. package/dist/index.esm5.js +323 -52
  6. package/dist/index.esm5.js.map +1 -1
  7. package/dist/index.node.cjs.js +324 -53
  8. package/dist/index.node.cjs.js.map +1 -1
  9. package/dist/internal.d.ts +186 -41
  10. package/dist/node-esm/index.node.esm.js +303 -53
  11. package/dist/node-esm/index.node.esm.js.map +1 -1
  12. package/dist/node-esm/src/api/DataConnect.d.ts +47 -3
  13. package/dist/node-esm/src/api/Mutation.d.ts +26 -1
  14. package/dist/node-esm/src/api/Reference.d.ts +6 -0
  15. package/dist/node-esm/src/api/index.d.ts +1 -0
  16. package/dist/node-esm/src/api/query.d.ts +51 -1
  17. package/dist/node-esm/src/api.browser.d.ts +12 -7
  18. package/dist/node-esm/src/core/AppCheckTokenProvider.d.ts +30 -0
  19. package/dist/node-esm/src/core/FirebaseAuthProvider.d.ts +1 -1
  20. package/dist/node-esm/src/core/QueryManager.d.ts +1 -1
  21. package/dist/node-esm/src/core/error.d.ts +2 -1
  22. package/dist/node-esm/src/network/fetch.d.ts +1 -1
  23. package/dist/node-esm/src/network/transport/index.d.ts +8 -10
  24. package/dist/node-esm/src/network/transport/rest.d.ts +24 -10
  25. package/dist/node-esm/src/util/validateArgs.d.ts +33 -0
  26. package/dist/private.d.ts +152 -59
  27. package/dist/public.d.ts +133 -50
  28. package/dist/src/api/DataConnect.d.ts +47 -3
  29. package/dist/src/api/Mutation.d.ts +26 -1
  30. package/dist/src/api/Reference.d.ts +6 -0
  31. package/dist/src/api/index.d.ts +1 -0
  32. package/dist/src/api/query.d.ts +51 -1
  33. package/dist/src/api.browser.d.ts +12 -7
  34. package/dist/src/core/AppCheckTokenProvider.d.ts +30 -0
  35. package/dist/src/core/FirebaseAuthProvider.d.ts +1 -1
  36. package/dist/src/core/QueryManager.d.ts +1 -1
  37. package/dist/src/core/error.d.ts +2 -1
  38. package/dist/src/network/fetch.d.ts +1 -1
  39. package/dist/src/network/transport/index.d.ts +8 -10
  40. package/dist/src/network/transport/rest.d.ts +24 -10
  41. package/dist/src/util/validateArgs.d.ts +33 -0
  42. package/package.json +11 -7
@@ -15,11 +15,15 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  import { DataConnectOptions, TransportOptions } from '../../api/DataConnect';
18
+ import { AppCheckTokenProvider } from '../../core/AppCheckTokenProvider';
18
19
  import { AuthTokenProvider } from '../../core/FirebaseAuthProvider';
19
20
  import { DataConnectTransport } from '.';
20
21
  export declare class RESTTransport implements DataConnectTransport {
21
22
  private apiKey?;
23
+ private appId?;
22
24
  private authProvider?;
25
+ private appCheckProvider?;
26
+ private _isUsingGen;
23
27
  private _host;
24
28
  private _port;
25
29
  private _location;
@@ -28,17 +32,27 @@ export declare class RESTTransport implements DataConnectTransport {
28
32
  private _project;
29
33
  private _serviceName;
30
34
  private _accessToken;
31
- private _authInitialized;
32
- constructor(options: DataConnectOptions, apiKey?: string | undefined, authProvider?: AuthTokenProvider | undefined, transportOptions?: TransportOptions | undefined);
35
+ private _appCheckToken;
36
+ private _lastToken;
37
+ constructor(options: DataConnectOptions, apiKey?: string | undefined, appId?: string, authProvider?: AuthTokenProvider | undefined, appCheckProvider?: AppCheckTokenProvider | undefined, transportOptions?: TransportOptions | undefined, _isUsingGen?: boolean);
33
38
  get endpointUrl(): string;
34
39
  useEmulator(host: string, port?: number, isSecure?: boolean): void;
35
40
  onTokenChanged(newToken: string | null): void;
36
- getWithAuth(): Promise<string>;
37
- invokeQuery: <T, U = unknown>(queryName: string, body: U) => {
38
- then: any;
39
- };
40
- invokeMutation: <T, U = unknown>(mutationName: string, body: U) => {
41
- then: any;
42
- cancel: () => void;
43
- };
41
+ getWithAuth(forceToken?: boolean): Promise<string>;
42
+ _setLastToken(lastToken: string | null): void;
43
+ withRetry<T>(promiseFactory: () => Promise<{
44
+ data: T;
45
+ errors: Error[];
46
+ }>, retry?: boolean): Promise<{
47
+ data: T;
48
+ errors: Error[];
49
+ }>;
50
+ invokeQuery: <T, U>(queryName: string, body?: U) => PromiseLike<{
51
+ data: T;
52
+ errors: Error[];
53
+ }>;
54
+ invokeMutation: <T, U>(queryName: string, body?: U) => PromiseLike<{
55
+ data: T;
56
+ errors: Error[];
57
+ }>;
44
58
  }
@@ -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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firebase/data-connect",
3
- "version": "0.0.2-dataconnect-preview.877f8b7d0",
3
+ "version": "0.0.3-canary.beaa4dffb",
4
4
  "description": "",
5
5
  "author": "Firebase <firebase-support@google.com> (https://firebase.google.com/)",
6
6
  "main": "dist/index.node.cjs.js",
@@ -35,9 +35,10 @@
35
35
  "dev": "rollup -c -w",
36
36
  "test": "run-p --npm-path npm test:emulator",
37
37
  "test:ci": "node ../../scripts/run_tests_in_ci.js -s test:emulator",
38
- "test:all": "npm run test:node",
38
+ "test:all": "run-p --npm-path npm lint test:unit",
39
39
  "test:browser": "karma start --single-run",
40
40
  "test:node": "TS_NODE_FILES=true TS_NODE_CACHE=NO TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha 'test/{,!(browser)/**/}*.test.ts' --file src/index.node.ts --config ../../config/mocharc.node.js",
41
+ "test:unit": "TS_NODE_FILES=true TS_NODE_CACHE=NO TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha 'test/unit/**/*.test.ts' --file src/index.node.ts --config ../../config/mocharc.node.js",
41
42
  "test:emulator": "ts-node --compiler-options='{\"module\":\"commonjs\"}' ../../scripts/emulator-testing/dataconnect-test-runner.ts",
42
43
  "api-report": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' ts-node ../../repo-scripts/prune-dts/extract-public-api.ts --package data-connect --packageRoot . --typescriptDts ./dist/src/index.d.ts --rollupDts ./dist/private.d.ts --untrimmedRollupDts ./dist/internal.d.ts --publicDts ./dist/public.d.ts && yarn api-report:api-json",
43
44
  "api-report:api-json": "rm -rf temp && api-extractor run --local --verbose",
@@ -45,15 +46,18 @@
45
46
  "typings:public": "node ../../scripts/build/use_typings.js ./dist/public.d.ts"
46
47
  },
47
48
  "license": "Apache-2.0",
49
+ "peerDependencies": {
50
+ "@firebase/app": "0.10.11-canary.beaa4dffb"
51
+ },
48
52
  "dependencies": {
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
+ "@firebase/auth-interop-types": "0.2.3-canary.beaa4dffb",
54
+ "@firebase/component": "0.6.9-canary.beaa4dffb",
55
+ "@firebase/logger": "0.4.2-canary.beaa4dffb",
56
+ "@firebase/util": "1.10.0-canary.beaa4dffb",
53
57
  "tslib": "^2.1.0"
54
58
  },
55
59
  "devDependencies": {
56
- "@firebase/app": "0.10.3-dataconnect-preview.877f8b7d0",
60
+ "@firebase/app": "0.10.11-canary.beaa4dffb",
57
61
  "rollup": "2.79.1",
58
62
  "rollup-plugin-typescript2": "0.31.2",
59
63
  "typescript": "4.7.4"