@firebase/database-compat 0.1.1-2021823172527 → 0.1.2-canary.1048c4f2d

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 (39) hide show
  1. package/CHANGELOG.md +19 -8
  2. package/dist/database-compat/src/index.d.ts +0 -9
  3. package/dist/database-compat/src/index.node.d.ts +0 -53
  4. package/dist/database-compat/src/index.standalone.d.ts +52 -0
  5. package/dist/index.esm2017.js +5 -6
  6. package/dist/index.esm2017.js.map +1 -1
  7. package/dist/index.esm5.js +2 -3
  8. package/dist/index.esm5.js.map +1 -1
  9. package/dist/index.js +10 -77
  10. package/dist/index.js.map +1 -1
  11. package/dist/index.standalone.js +18731 -0
  12. package/dist/index.standalone.js.map +1 -0
  13. package/package.json +30 -9
  14. package/standalone/package.json +7 -0
  15. package/.eslintrc.js +0 -64
  16. package/karma.conf.js +0 -34
  17. package/rollup.config.js +0 -125
  18. package/src/api/Database.ts +0 -123
  19. package/src/api/Reference.ts +0 -790
  20. package/src/api/TransactionResult.ts +0 -34
  21. package/src/api/internal.ts +0 -91
  22. package/src/api/onDisconnect.ts +0 -112
  23. package/src/index.node.ts +0 -142
  24. package/src/index.ts +0 -88
  25. package/src/util/util.ts +0 -25
  26. package/src/util/validation.ts +0 -59
  27. package/test/browser/crawler_support.test.ts +0 -206
  28. package/test/database.test.ts +0 -306
  29. package/test/datasnapshot.test.ts +0 -249
  30. package/test/helpers/events.ts +0 -258
  31. package/test/helpers/util.ts +0 -177
  32. package/test/info.test.ts +0 -222
  33. package/test/order.test.ts +0 -592
  34. package/test/order_by.test.ts +0 -530
  35. package/test/promise.test.ts +0 -261
  36. package/test/query.test.ts +0 -4670
  37. package/test/servervalues.test.ts +0 -152
  38. package/test/transaction.test.ts +0 -1534
  39. package/tsconfig.json +0 -11
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firebase/database-compat",
3
- "version": "0.1.1-2021823172527",
3
+ "version": "0.1.2-canary.1048c4f2d",
4
4
  "description": "The Realtime Database component of the Firebase JS SDK.",
5
5
  "author": "Firebase <firebase-support@google.com> (https://firebase.google.com/)",
6
6
  "main": "dist/index.js",
@@ -9,6 +9,19 @@
9
9
  "esm5": "dist/index.esm5.js",
10
10
  "license": "Apache-2.0",
11
11
  "typings": "dist/database-compat/src/index.d.ts",
12
+ "files": [
13
+ "dist",
14
+ "standalone/package.json"
15
+ ],
16
+ "exports": {
17
+ ".": {
18
+ "node": "./dist/index.js",
19
+ "default": "./dist/index.esm2017.js"
20
+ },
21
+ "./standalone": {
22
+ "node": "./dist/index.standalone.js"
23
+ }
24
+ },
12
25
  "scripts": {
13
26
  "lint": "eslint -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'",
14
27
  "lint:fix": "eslint --fix -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'",
@@ -24,17 +37,25 @@
24
37
  "add-compat-overloads": "ts-node-script ../../scripts/build/create-overloads.ts -i ../database/dist/public.d.ts -o dist/database-compat/src/index.d.ts -a -r Database:types.FirebaseDatabase -r Query:types.Query -r DatabaseReference:types.Reference -r FirebaseApp:FirebaseAppCompat --moduleToEnhance @firebase/database"
25
38
  },
26
39
  "peerDependencies": {
27
- "@firebase/app-compat": "0.1.2-2021823172527"
40
+ "@firebase/app-compat": "0.1.5-canary.1048c4f2d"
28
41
  },
29
42
  "dependencies": {
30
- "@firebase/database": "0.12.1-2021823172527",
31
- "@firebase/database-types": "0.9.1-2021823172527",
32
- "@firebase/logger": "0.2.6",
33
- "@firebase/util": "1.3.1-2021823172527",
34
- "@firebase/component": "0.5.7-2021823172527",
43
+ "@firebase/database": "0.12.2-canary.1048c4f2d",
44
+ "@firebase/database-types": "0.9.1-canary.1048c4f2d",
45
+ "@firebase/logger": "0.3.0-canary.1048c4f2d",
46
+ "@firebase/util": "1.4.0-canary.1048c4f2d",
47
+ "@firebase/component": "0.5.7-canary.1048c4f2d",
35
48
  "tslib": "^2.1.0"
36
49
  },
37
50
  "devDependencies": {
38
- "@firebase/app-compat": "0.1.2-2021823172527"
51
+ "@firebase/app-compat": "0.1.5-canary.1048c4f2d"
52
+ },
53
+ "repository": {
54
+ "directory": "packages/database-compat",
55
+ "type": "git",
56
+ "url": "https://github.com/firebase/firebase-js-sdk.git"
57
+ },
58
+ "bugs": {
59
+ "url": "https://github.com/firebase/firebase-js-sdk/issues"
39
60
  }
40
- }
61
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "@firebase/database-compat/standalone",
3
+ "description": "The entry point for sharing code with Admin SDK",
4
+ "main": "../dist/index.standalone.js",
5
+ "typings": "../dist/database-compat/src/index.standalone.d.ts",
6
+ "private": true
7
+ }
package/.eslintrc.js DELETED
@@ -1,64 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2020 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
-
18
- module.exports = {
19
- extends: '../../config/.eslintrc.js',
20
- parserOptions: {
21
- project: 'tsconfig.json',
22
- // to make vscode-eslint work with monorepo
23
- // https://github.com/typescript-eslint/typescript-eslint/issues/251#issuecomment-463943250
24
- tsconfigRootDir: __dirname
25
- },
26
- rules: {
27
- '@typescript-eslint/no-unused-vars': 'off',
28
- '@typescript-eslint/no-floating-promises': 'off',
29
- '@typescript-eslint/explicit-function-return-type': 'off',
30
- 'no-restricted-properties': 'off',
31
- 'no-restricted-globals': 'off',
32
- 'no-throw-literal': 'off',
33
- 'id-blacklist': 'off',
34
- 'import/order': [
35
- 'error',
36
- {
37
- 'groups': [
38
- 'builtin',
39
- 'external',
40
- 'internal',
41
- 'parent',
42
- 'sibling',
43
- 'index'
44
- ],
45
- 'newlines-between': 'always',
46
- 'alphabetize': { 'order': 'asc', 'caseInsensitive': true }
47
- }
48
- ]
49
- },
50
- overrides: [
51
- {
52
- files: ['**/*.d.ts'],
53
- rules: {
54
- '@typescript-eslint/no-explicit-any': 'off'
55
- }
56
- },
57
- {
58
- files: ['scripts/*.ts'],
59
- rules: {
60
- 'import/no-extraneous-dependencies': 'off'
61
- }
62
- }
63
- ]
64
- };
package/karma.conf.js DELETED
@@ -1,34 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2017 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
-
18
- const karmaBase = require('../../config/karma.base');
19
-
20
- const files = [`test/**/*.test.ts`];
21
-
22
- module.exports = function (config) {
23
- const karmaConfig = Object.assign({}, karmaBase, {
24
- // files to load into karma
25
- files: files,
26
- // frameworks to use
27
- // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
28
- frameworks: ['mocha']
29
- });
30
-
31
- config.set(karmaConfig);
32
- };
33
-
34
- module.exports.files = files;
package/rollup.config.js DELETED
@@ -1,125 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2021 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
-
18
- import json from '@rollup/plugin-json';
19
- import typescriptPlugin from 'rollup-plugin-typescript2';
20
- import typescript from 'typescript';
21
-
22
- import pkg from './package.json';
23
-
24
- const deps = Object.keys(
25
- Object.assign({}, pkg.peerDependencies, pkg.dependencies)
26
- );
27
-
28
- function onWarn(warning, defaultWarn) {
29
- if (warning.code === 'CIRCULAR_DEPENDENCY') {
30
- throw new Error(warning);
31
- }
32
- defaultWarn(warning);
33
- }
34
-
35
- /**
36
- * ES5 Builds
37
- */
38
- const es5BuildPlugins = [
39
- typescriptPlugin({
40
- typescript,
41
- abortOnError: false
42
- }),
43
- json()
44
- ];
45
-
46
- const es5Builds = [
47
- /**
48
- * Node.js Build
49
- */
50
- {
51
- input: 'src/index.node.ts',
52
- output: [
53
- {
54
- file: pkg.main,
55
- format: 'cjs',
56
- sourcemap: true
57
- }
58
- ],
59
- plugins: es5BuildPlugins,
60
- treeshake: {
61
- moduleSideEffects: false
62
- },
63
- external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)),
64
- onwarn: onWarn
65
- },
66
- /**
67
- * Browser Builds
68
- */
69
- {
70
- input: 'src/index.ts',
71
- output: [
72
- {
73
- file: pkg.esm5,
74
- format: 'es',
75
- sourcemap: true
76
- }
77
- ],
78
- plugins: es5BuildPlugins,
79
- treeshake: {
80
- moduleSideEffects: false
81
- },
82
- external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)),
83
- onwarn: onWarn
84
- }
85
- ];
86
-
87
- /**
88
- * ES2017 Builds
89
- */
90
- const es2017BuildPlugins = [
91
- typescriptPlugin({
92
- typescript,
93
- tsconfigOverride: {
94
- compilerOptions: {
95
- target: 'es2017'
96
- }
97
- },
98
- abortOnError: false
99
- }),
100
- json({ preferConst: true })
101
- ];
102
-
103
- const es2017Builds = [
104
- /**
105
- * Browser Build
106
- */
107
- {
108
- input: 'src/index.ts',
109
- output: [
110
- {
111
- file: pkg.browser,
112
- format: 'es',
113
- sourcemap: true
114
- }
115
- ],
116
- plugins: es2017BuildPlugins,
117
- treeshake: {
118
- moduleSideEffects: false
119
- },
120
- external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)),
121
- onwarn: onWarn
122
- }
123
- ];
124
-
125
- export default [...es5Builds, ...es2017Builds];
@@ -1,123 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2017 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
- // eslint-disable-next-line import/no-extraneous-dependencies
18
-
19
- import { FirebaseApp } from '@firebase/app-types';
20
- import { FirebaseService } from '@firebase/app-types/private';
21
- import {
22
- goOnline,
23
- connectDatabaseEmulator,
24
- goOffline,
25
- ref,
26
- refFromURL,
27
- increment,
28
- serverTimestamp,
29
- Database as ModularDatabase
30
- } from '@firebase/database';
31
- import {
32
- validateArgCount,
33
- Compat,
34
- EmulatorMockTokenOptions
35
- } from '@firebase/util';
36
-
37
-
38
- import { Reference } from './Reference';
39
-
40
- /**
41
- * Class representing a firebase database.
42
- */
43
- export class Database implements FirebaseService, Compat<ModularDatabase> {
44
- static readonly ServerValue = {
45
- TIMESTAMP: serverTimestamp(),
46
- increment: (delta: number) => increment(delta)
47
- };
48
-
49
- /**
50
- * The constructor should not be called by users of our public API.
51
- */
52
- constructor(readonly _delegate: ModularDatabase, readonly app: FirebaseApp) {}
53
-
54
- INTERNAL = {
55
- delete: () => this._delegate._delete()
56
- };
57
-
58
- /**
59
- * Modify this instance to communicate with the Realtime Database emulator.
60
- *
61
- * <p>Note: This method must be called before performing any other operation.
62
- *
63
- * @param host - the emulator host (ex: localhost)
64
- * @param port - the emulator port (ex: 8080)
65
- * @param options.mockUserToken - the mock auth token to use for unit testing Security Rules
66
- */
67
- useEmulator(
68
- host: string,
69
- port: number,
70
- options: {
71
- mockUserToken?: EmulatorMockTokenOptions;
72
- } = {}
73
- ): void {
74
- connectDatabaseEmulator(this._delegate, host, port, options);
75
- }
76
-
77
- /**
78
- * Returns a reference to the root or to the path specified in the provided
79
- * argument.
80
- *
81
- * @param path - The relative string path or an existing Reference to a database
82
- * location.
83
- * @throws If a Reference is provided, throws if it does not belong to the
84
- * same project.
85
- * @returns Firebase reference.
86
- */
87
- ref(path?: string): Reference;
88
- ref(path?: Reference): Reference;
89
- ref(path?: string | Reference): Reference {
90
- validateArgCount('database.ref', 0, 1, arguments.length);
91
- if (path instanceof Reference) {
92
- const childRef = refFromURL(this._delegate, path.toString());
93
- return new Reference(this, childRef);
94
- } else {
95
- const childRef = ref(this._delegate, path);
96
- return new Reference(this, childRef);
97
- }
98
- }
99
-
100
- /**
101
- * Returns a reference to the root or the path specified in url.
102
- * We throw a exception if the url is not in the same domain as the
103
- * current repo.
104
- * @returns Firebase reference.
105
- */
106
- refFromURL(url: string): Reference {
107
- const apiName = 'database.refFromURL';
108
- validateArgCount(apiName, 1, 1, arguments.length);
109
- const childRef = refFromURL(this._delegate, url);
110
- return new Reference(this, childRef);
111
- }
112
-
113
- // Make individual repo go offline.
114
- goOffline(): void {
115
- validateArgCount('database.goOffline', 0, 0, arguments.length);
116
- return goOffline(this._delegate);
117
- }
118
-
119
- goOnline(): void {
120
- validateArgCount('database.goOnline', 0, 0, arguments.length);
121
- return goOnline(this._delegate);
122
- }
123
- }