@firebase/data-connect 0.0.1-dataconnect-preview.f2ddc3d7b

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 (66) hide show
  1. package/dist/index.cjs.js +965 -0
  2. package/dist/index.cjs.js.map +1 -0
  3. package/dist/index.esm2017.js +942 -0
  4. package/dist/index.esm2017.js.map +1 -0
  5. package/dist/index.esm5.js +966 -0
  6. package/dist/index.esm5.js.map +1 -0
  7. package/dist/index.node.cjs.js +984 -0
  8. package/dist/index.node.cjs.js.map +1 -0
  9. package/dist/internal.d.ts +297 -0
  10. package/dist/node-esm/index.node.esm.js +937 -0
  11. package/dist/node-esm/index.node.esm.js.map +1 -0
  12. package/dist/node-esm/package.json +1 -0
  13. package/dist/node-esm/src/api/DataConnect.d.ts +70 -0
  14. package/dist/node-esm/src/api/Mutation.d.ts +36 -0
  15. package/dist/node-esm/src/api/Reference.d.ts +45 -0
  16. package/dist/node-esm/src/api/index.d.ts +22 -0
  17. package/dist/node-esm/src/api/query.d.ts +46 -0
  18. package/dist/node-esm/src/api.browser.d.ts +29 -0
  19. package/dist/node-esm/src/api.node.d.ts +17 -0
  20. package/dist/node-esm/src/core/FirebaseAuthProvider.d.ts +44 -0
  21. package/dist/node-esm/src/core/QueryManager.d.ts +36 -0
  22. package/dist/node-esm/src/core/error.d.ts +50 -0
  23. package/dist/node-esm/src/core/version.d.ts +23 -0
  24. package/dist/node-esm/src/index.d.ts +29 -0
  25. package/dist/node-esm/src/index.node.d.ts +18 -0
  26. package/dist/node-esm/src/logger.d.ts +20 -0
  27. package/dist/node-esm/src/network/fetch.d.ts +21 -0
  28. package/dist/node-esm/src/network/index.d.ts +17 -0
  29. package/dist/node-esm/src/network/transport/index.d.ts +45 -0
  30. package/dist/node-esm/src/network/transport/rest.d.ts +56 -0
  31. package/dist/node-esm/src/register.d.ts +1 -0
  32. package/dist/node-esm/src/util/encoder.d.ts +19 -0
  33. package/dist/node-esm/src/util/map.d.ts +17 -0
  34. package/dist/node-esm/src/util/url.d.ts +19 -0
  35. package/dist/node-esm/test/emulatorSeeder.d.ts +22 -0
  36. package/dist/node-esm/test/queries.test.d.ts +17 -0
  37. package/dist/node-esm/test/util.d.ts +26 -0
  38. package/dist/private.d.ts +291 -0
  39. package/dist/public.d.ts +187 -0
  40. package/dist/src/api/DataConnect.d.ts +70 -0
  41. package/dist/src/api/Mutation.d.ts +36 -0
  42. package/dist/src/api/Reference.d.ts +45 -0
  43. package/dist/src/api/index.d.ts +22 -0
  44. package/dist/src/api/query.d.ts +46 -0
  45. package/dist/src/api.browser.d.ts +29 -0
  46. package/dist/src/api.node.d.ts +17 -0
  47. package/dist/src/core/FirebaseAuthProvider.d.ts +44 -0
  48. package/dist/src/core/QueryManager.d.ts +36 -0
  49. package/dist/src/core/error.d.ts +50 -0
  50. package/dist/src/core/version.d.ts +23 -0
  51. package/dist/src/index.d.ts +29 -0
  52. package/dist/src/index.node.d.ts +18 -0
  53. package/dist/src/logger.d.ts +20 -0
  54. package/dist/src/network/fetch.d.ts +21 -0
  55. package/dist/src/network/index.d.ts +17 -0
  56. package/dist/src/network/transport/index.d.ts +45 -0
  57. package/dist/src/network/transport/rest.d.ts +56 -0
  58. package/dist/src/register.d.ts +1 -0
  59. package/dist/src/tsdoc-metadata.json +11 -0
  60. package/dist/src/util/encoder.d.ts +19 -0
  61. package/dist/src/util/map.d.ts +17 -0
  62. package/dist/src/util/url.d.ts +19 -0
  63. package/dist/test/emulatorSeeder.d.ts +22 -0
  64. package/dist/test/queries.test.d.ts +17 -0
  65. package/dist/test/util.d.ts +26 -0
  66. package/package.json +76 -0
@@ -0,0 +1,20 @@
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 { LogLevelString } from "@firebase/logger";
18
+ export declare function setLogLevel(logLevel: LogLevelString): void;
19
+ export declare function logDebug(msg: string): void;
20
+ export declare function logError(msg: string): void;
@@ -0,0 +1,21 @@
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 declare function initializeFetch(fetchImpl: typeof fetch): void;
18
+ export declare function dcFetch<T, U>(url: string, body: U, { signal }: AbortController, accessToken: string | null): Promise<{
19
+ data: T;
20
+ errors: Error[];
21
+ }>;
@@ -0,0 +1,17 @@
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 * from './transport';
@@ -0,0 +1,45 @@
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 { DataConnectOptions, TransportOptions } from '../../api/DataConnect';
18
+ import { AuthTokenProvider } from '../../core/FirebaseAuthProvider';
19
+ export interface DataConnectTransport {
20
+ invokeQuery<T, U>(queryName: string, body?: U): PromiseLike<{
21
+ data: T;
22
+ errors: Error[];
23
+ }>;
24
+ invokeMutation<T, U>(queryName: string, body?: U): PromiseLike<{
25
+ data: T;
26
+ errors: Error[];
27
+ }>;
28
+ useEmulator(host: string, port?: number, sslEnabled?: boolean): void;
29
+ onTokenChanged: (token: string | null) => void;
30
+ }
31
+ export interface CancellableOperation<T> extends PromiseLike<{
32
+ data: T;
33
+ }> {
34
+ cancel: () => void;
35
+ }
36
+ export interface QueryResponse<T> extends CancellableOperation<T> {
37
+ }
38
+ export interface MutationResponse<T> extends CancellableOperation<T> {
39
+ }
40
+ export interface Sender<T> {
41
+ abort: () => void;
42
+ send: () => Promise<T>;
43
+ }
44
+ export declare type TransportClass = new (options: DataConnectOptions, apiKey?: string, authProvider?: AuthTokenProvider, transportOptions?: TransportOptions) => DataConnectTransport;
45
+ export * from '../../core/FirebaseAuthProvider';
@@ -0,0 +1,56 @@
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 { DataConnectTransport } from '.';
18
+ import { DataConnectOptions, TransportOptions } from '../../api/DataConnect';
19
+ import { AuthTokenProvider } from '../../core/FirebaseAuthProvider';
20
+ export declare class RESTTransport implements DataConnectTransport {
21
+ private apiKey?;
22
+ private authProvider?;
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
+ constructor(options: DataConnectOptions, apiKey?: string | undefined, authProvider?: AuthTokenProvider | undefined, transportOptions?: TransportOptions | undefined);
33
+ get endpointUrl(): string;
34
+ useEmulator(host: string, port?: number, isSecure?: boolean): void;
35
+ onTokenChanged(newToken: string | null): void;
36
+ getWithAuth(): Promise<string | null>;
37
+ invokeQuery: <T, U = unknown>(queryName: string, body: U) => {
38
+ then: <TResult1 = {
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>;
45
+ };
46
+ invokeMutation: <T, U = unknown>(mutationName: string, body: U) => {
47
+ then: <TResult1 = {
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>;
54
+ cancel: () => void;
55
+ };
56
+ }
@@ -0,0 +1 @@
1
+ export declare function registerDataConnect(variant?: string): void;
@@ -0,0 +1,11 @@
1
+ // This file is read by tools that parse documentation comments conforming to the TSDoc standard.
2
+ // It should be published with your NPM package. It should not be tracked by Git.
3
+ {
4
+ "tsdocVersion": "0.12",
5
+ "toolPackages": [
6
+ {
7
+ "packageName": "@microsoft/api-extractor",
8
+ "packageVersion": "0.1.2"
9
+ }
10
+ ]
11
+ }
@@ -0,0 +1,19 @@
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 declare type HmacImpl = (obj: unknown) => string;
18
+ export declare let encoderImpl: HmacImpl;
19
+ export declare function setEncoder(encoder: HmacImpl): void;
@@ -0,0 +1,17 @@
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 declare function setIfNotExists<T>(map: Map<string, T>, key: string, val: T): void;
@@ -0,0 +1,19 @@
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 { ProjectOptions, TransportOptions } from '../api/DataConnect';
18
+ export declare function urlBuilder(projectConfig: ProjectOptions, transportOptions: TransportOptions): string;
19
+ export declare function addToken(url: string, apiKey?: string): string;
@@ -0,0 +1,22 @@
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>;
@@ -0,0 +1,17 @@
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 {};
@@ -0,0 +1,26 @@
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;
package/package.json ADDED
@@ -0,0 +1,76 @@
1
+ {
2
+ "name": "@firebase/data-connect",
3
+ "version": "0.0.1-dataconnect-preview.f2ddc3d7b",
4
+ "description": "",
5
+ "author": "Firebase <firebase-support@google.com> (https://firebase.google.com/)",
6
+ "main": "dist/index.node.cjs.js",
7
+ "browser": "dist/index.esm2017.js",
8
+ "module": "dist/index.esm2017.js",
9
+ "esm5": "dist/index.esm5.js",
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/public.d.ts",
13
+ "node": {
14
+ "import": "./dist/node-esm/index.node.esm.js",
15
+ "require": "./dist/index.node.cjs.js"
16
+ },
17
+ "esm5": "./dist/index.esm5.js",
18
+ "browser": {
19
+ "require": "./dist/index.cjs.js",
20
+ "import": "./dist/index.esm2017.js"
21
+ },
22
+ "default": "./dist/index.esm2017.js"
23
+ },
24
+ "./package.json": "./package.json"
25
+ },
26
+ "files": [
27
+ "dist"
28
+ ],
29
+ "scripts": {
30
+ "lint": "eslint -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore' --fix",
31
+ "lint:fix": "eslint --fix -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'",
32
+ "build": "rollup -c rollup.config.js && yarn api-report",
33
+ "prettier": "prettier --write '*.js' '*.ts' '@(src|test)/**/*.ts'",
34
+ "build:deps": "lerna run --scope @firebase/'{app,data-connect}' --include-dependencies build",
35
+ "dev": "rollup -c -w",
36
+ "test": "run-p --npm-path npm lint test:emulator",
37
+ "test:ci": "node ../../scripts/run_tests_in_ci.js -s test:emulator",
38
+ "test:all": "npm run test:node",
39
+ "test:browser": "karma start --single-run",
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:emulator": "ts-node --compiler-options='{\"module\":\"commonjs\"}' ../../scripts/emulator-testing/dataconnect-test-runner.ts",
42
+ "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
+ "api-report:api-json": "rm -rf temp && api-extractor run --local --verbose",
44
+ "doc": "api-documenter markdown --input temp --output docs",
45
+ "typings:public": "node ../../scripts/build/use_typings.js ./dist/public.d.ts"
46
+ },
47
+ "license": "Apache-2.0",
48
+ "dependencies": {
49
+ "@firebase/auth-interop-types": "0.2.2",
50
+ "@firebase/component": "0.6.6",
51
+ "@firebase/logger": "0.4.1",
52
+ "@firebase/util": "1.9.5",
53
+ "tslib": "^2.1.0"
54
+ },
55
+ "devDependencies": {
56
+ "@firebase/app": "0.10.2",
57
+ "rollup": "2.79.1",
58
+ "rollup-plugin-typescript2": "0.31.2",
59
+ "typescript": "4.7.4"
60
+ },
61
+ "repository": {
62
+ "directory": "packages/data-connect",
63
+ "type": "git",
64
+ "url": "https://github.com/firebase/firebase-js-sdk.git"
65
+ },
66
+ "bugs": {
67
+ "url": "https://github.com/firebase/firebase-js-sdk/issues"
68
+ },
69
+ "typings": "dist/src/index.d.ts",
70
+ "nyc": {
71
+ "extension": [
72
+ ".ts"
73
+ ],
74
+ "reportDir": "./coverage/node"
75
+ }
76
+ }