Skip to content

Commit 4980d39

Browse files
authored
Merge 5c0662e into 7818176
2 parents 7818176 + 5c0662e commit 4980d39

File tree

120 files changed

+2922
-3567
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+2922
-3567
lines changed

common/api-review/storage.api.md

Lines changed: 89 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { EmulatorMockTokenOptions } from '@firebase/util';
1010
import { FirebaseApp } from '@firebase/app';
1111
import { FirebaseAuthInternalName } from '@firebase/auth-interop-types';
1212
import { FirebaseError } from '@firebase/util';
13-
import { _FirebaseService } from '@firebase/app';
13+
import { _FirebaseService } from '@firebase/app-exp';
1414
import { NextFn } from '@firebase/util';
1515
import { Provider } from '@firebase/component';
1616
import { Subscribe } from '@firebase/util';
@@ -21,6 +21,11 @@ export function connectStorageEmulator(storage: FirebaseStorage, host: string, p
2121
mockUserToken?: EmulatorMockTokenOptions | string;
2222
}): void;
2323

24+
// Warning: (ae-forgotten-export) The symbol "StringData" needs to be exported by the entry point index.d.ts
25+
//
26+
// @internal (undocumented)
27+
export function _dataFromString(format: StringFormat, stringData: string): StringData;
28+
2429
// @public
2530
export function deleteObject(ref: StorageReference): Promise<void>;
2631

@@ -51,6 +56,55 @@ export interface FirebaseStorageError extends FirebaseError {
5156
serverResponse: string | null;
5257
}
5358

59+
// @public
60+
export class _FirebaseStorageImpl implements FirebaseStorage {
61+
constructor(
62+
app: FirebaseApp, _authProvider: Provider<FirebaseAuthInternalName>,
63+
_appCheckProvider: Provider<AppCheckInternalComponentName>,
64+
_pool: ConnectionPool, _url?: string | undefined, _firebaseVersion?: string | undefined);
65+
readonly app: FirebaseApp;
66+
// @internal (undocumented)
67+
readonly _appCheckProvider: Provider<AppCheckInternalComponentName>;
68+
// (undocumented)
69+
protected readonly _appId: string | null;
70+
// (undocumented)
71+
readonly _authProvider: Provider<FirebaseAuthInternalName>;
72+
// Warning: (ae-incompatible-release-tags) The symbol "_bucket" is marked as @public, but its signature references "Location" which is marked as @internal
73+
//
74+
// (undocumented)
75+
_bucket: _Location | null;
76+
_delete(): Promise<void>;
77+
// (undocumented)
78+
readonly _firebaseVersion?: string | undefined;
79+
// (undocumented)
80+
_getAppCheckToken(): Promise<string | null>;
81+
// (undocumented)
82+
_getAuthToken(): Promise<string | null>;
83+
// (undocumented)
84+
get host(): string;
85+
set host(host: string);
86+
// Warning: (ae-forgotten-export) The symbol "RequestInfo" needs to be exported by the entry point index.d.ts
87+
// Warning: (ae-forgotten-export) The symbol "Request" needs to be exported by the entry point index.d.ts
88+
//
89+
// (undocumented)
90+
_makeRequest<T>(requestInfo: RequestInfo_2<T>, authToken: string | null, appCheckToken: string | null): Request_2<T>;
91+
// (undocumented)
92+
makeRequestWithTokens<T>(requestInfo: RequestInfo_2<T>): Promise<Request_2<T>>;
93+
// Warning: (ae-incompatible-release-tags) The symbol "_makeStorageReference" is marked as @public, but its signature references "Location" which is marked as @internal
94+
// Warning: (ae-incompatible-release-tags) The symbol "_makeStorageReference" is marked as @public, but its signature references "Reference" which is marked as @internal
95+
_makeStorageReference(loc: _Location): _Reference;
96+
get maxOperationRetryTime(): number;
97+
set maxOperationRetryTime(time: number);
98+
get maxUploadRetryTime(): number;
99+
set maxUploadRetryTime(time: number);
100+
// Warning: (ae-forgotten-export) The symbol "ConnectionPool" needs to be exported by the entry point index.d.ts
101+
//
102+
// @internal (undocumented)
103+
readonly _pool: ConnectionPool;
104+
// (undocumented)
105+
readonly _url?: string | undefined;
106+
}
107+
54108
// @public
55109
export interface FullMetadata extends UploadMetadata {
56110
bucket: string;
@@ -77,6 +131,14 @@ export function getMetadata(ref: StorageReference): Promise<FullMetadata>;
77131
// @public
78132
export function getStorage(app?: FirebaseApp, bucketUrl?: string): FirebaseStorage;
79133

134+
// Warning: (ae-forgotten-export) The symbol "FirebaseStorageError" needs to be exported by the entry point index.d.ts
135+
//
136+
// @internal (undocumented)
137+
export function _invalidArgument(message: string): FirebaseStorageError_2;
138+
139+
// @internal (undocumented)
140+
export function _invalidRootOperation(name: string): FirebaseStorageError_2;
141+
80142
// @public
81143
export function list(ref: StorageReference, options?: ListOptions): Promise<ListResult>;
82144

@@ -123,18 +185,17 @@ export function ref(storageOrRef: FirebaseStorage | StorageReference, path?: str
123185

124186
// @internal
125187
export class _Reference {
126-
// Warning: (ae-forgotten-export) The symbol "FirebaseStorageImpl" needs to be exported by the entry point index.d.ts
127-
constructor(_service: FirebaseStorageImpl, location: string | _Location);
188+
constructor(_service: _FirebaseStorageImpl, location: string | _Location);
128189
get bucket(): string;
129190
get fullPath(): string;
130191
// (undocumented)
131192
_location: _Location;
132193
get name(): string;
133194
// (undocumented)
134-
protected _newRef(service: FirebaseStorageImpl, location: _Location): _Reference;
195+
protected _newRef(service: _FirebaseStorageImpl, location: _Location): _Reference;
135196
get parent(): _Reference | null;
136197
get root(): _Reference;
137-
get storage(): FirebaseStorageImpl;
198+
get storage(): _FirebaseStorageImpl;
138199
_throwIfRoot(name: string): void;
139200
// @override
140201
toString(): string;
@@ -187,9 +248,29 @@ export const StringFormat: {
187248
// @public
188249
export type TaskEvent = 'state_changed';
189250

251+
// @public
252+
export type _TaskEvent = string;
253+
254+
// @public
255+
export const _TaskEvent: {
256+
STATE_CHANGED: string;
257+
};
258+
190259
// @public
191260
export type TaskState = 'running' | 'paused' | 'success' | 'canceled' | 'error';
192261

262+
// @public
263+
export type _TaskState = typeof _TaskState[keyof typeof _TaskState];
264+
265+
// @public
266+
export const _TaskState: {
267+
readonly RUNNING: "running";
268+
readonly PAUSED: "paused";
269+
readonly SUCCESS: "success";
270+
readonly CANCELED: "canceled";
271+
readonly ERROR: "error";
272+
};
273+
193274
// @public
194275
export function updateMetadata(ref: StorageReference, metadata: SettableMetadata): Promise<FullMetadata>;
195276

@@ -232,21 +313,15 @@ export class _UploadTask {
232313
catch<T>(onRejected: (p1: FirebaseStorageError_2) => T | Promise<T>): Promise<T>;
233314
// Warning: (ae-forgotten-export) The symbol "Metadata" needs to be exported by the entry point index.d.ts
234315
_metadata: Metadata | null;
235-
// Warning: (ae-forgotten-export) The symbol "TaskEvent" needs to be exported by the entry point index.d.ts
236-
// Warning: (ae-forgotten-export) The symbol "StorageObserver" needs to be exported by the entry point index.d.ts
237-
// Warning: (ae-forgotten-export) The symbol "ErrorFn" needs to be exported by the entry point index.d.ts
238-
// Warning: (ae-forgotten-export) The symbol "CompleteFn" needs to be exported by the entry point index.d.ts
239316
// Warning: (ae-forgotten-export) The symbol "Unsubscribe" needs to be exported by the entry point index.d.ts
240317
// Warning: (ae-forgotten-export) The symbol "Subscribe" needs to be exported by the entry point index.d.ts
241-
on(type: TaskEvent_2, nextOrObserver?: StorageObserver_2<UploadTaskSnapshot_2> | ((a: UploadTaskSnapshot_2) => unknown), error?: ErrorFn, completed?: CompleteFn_2): Unsubscribe_2 | Subscribe_2<UploadTaskSnapshot_2>;
318+
on(type: _TaskEvent, nextOrObserver?: StorageObserver<UploadTaskSnapshot> | null | ((snapshot: UploadTaskSnapshot) => unknown), error?: ((a: FirebaseStorageError_2) => unknown) | null, completed?: Unsubscribe_2 | null): Unsubscribe_2 | Subscribe_2<UploadTaskSnapshot>;
242319
pause(): boolean;
243320
resume(): boolean;
244-
// Warning: (ae-forgotten-export) The symbol "UploadTaskSnapshot" needs to be exported by the entry point index.d.ts
245-
get snapshot(): UploadTaskSnapshot_2;
321+
get snapshot(): UploadTaskSnapshot;
246322
// Warning: (ae-forgotten-export) The symbol "InternalTaskState" needs to be exported by the entry point index.d.ts
247323
_state: InternalTaskState;
248-
// Warning: (ae-forgotten-export) The symbol "FirebaseStorageError" needs to be exported by the entry point index.d.ts
249-
then<U>(onFulfilled?: ((value: UploadTaskSnapshot_2) => U | Promise<U>) | null, onRejected?: ((error: FirebaseStorageError_2) => U | Promise<U>) | null): Promise<U>;
324+
then<U>(onFulfilled?: ((value: UploadTaskSnapshot) => U | Promise<U>) | null, onRejected?: ((error: FirebaseStorageError_2) => U | Promise<U>) | null): Promise<U>;
250325
_transferred: number;
251326
}
252327

packages-exp/app-exp/src/constants.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { name as appCheckName } from '../../../packages-exp/app-check-exp/packag
2424
import { name as authName } from '../../../packages-exp/auth-exp/package.json';
2525
import { name as authCompatName } from '../../../packages-exp/auth-compat-exp/package.json';
2626
import { name as databaseName } from '../../../packages/database/package.json';
27-
import { name as databaseCompatName } from '../../../packages/database/compat/package.json';
27+
import { name as databaseCompatName } from '../../../packages/database-compat/package.json';
2828
import { name as functionsName } from '../../../packages-exp/functions-exp/package.json';
2929
import { name as functionsCompatName } from '../../../packages-exp/functions-compat/package.json';
3030
import { name as installationsName } from '../../../packages-exp/installations-exp/package.json';
@@ -36,7 +36,7 @@ import { name as performanceCompatName } from '../../../packages-exp/performance
3636
import { name as remoteConfigName } from '../../../packages-exp/remote-config-exp/package.json';
3737
import { name as remoteConfigCompatName } from '../../../packages-exp/remote-config-compat/package.json';
3838
import { name as storageName } from '../../../packages/storage/package.json';
39-
import { name as storageCompatName } from '../../../packages/storage/compat/package.json';
39+
import { name as storageCompatName } from '../../../packages/storage-compat/package.json';
4040
import { name as firestoreName } from '../../../packages/firestore/package.json';
4141
import { name as firestoreCompatName } from '../../../packages/firestore/compat/package.json';
4242
import { name as packageName } from '../../../packages-exp/firebase-exp/package.json';

packages/database-compat/.eslintrc.js

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
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+
};

packages/database-compat/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# @firebase/database-compat
2+
3+
This is the compatibility layer for the Firebase Realtime Database component of the Firebase JS SDK.
4+
5+
**This package is not intended for direct usage, and should only be used via the officially supported [firebase](https://www.npmjs.com/package/firebase) package.**
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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;

packages/database-compat/package.json

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"name": "@firebase/database-compat",
3+
"version": "0.0.900",
4+
"description": "The Realtime Database component of the Firebase JS SDK.",
5+
"author": "Firebase <[email protected]> (https://firebase.google.com/)",
6+
"main": "dist/index.js",
7+
"browser": "dist/index.esm2017.js",
8+
"module": "dist/index.esm2017.js",
9+
"esm5": "dist/index.esm5.js",
10+
"license": "Apache-2.0",
11+
"typings": "dist/database-compat/src/index.d.ts",
12+
"scripts": {
13+
"lint": "eslint -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'",
14+
"lint:fix": "eslint --fix -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'",
15+
"prettier": "prettier --write '*.js' '*.ts' '@(src|test)/**/*.ts'",
16+
"build": "rollup -c rollup.config.js",
17+
"build:release": "yarn build && yarn add-compat-overloads",
18+
"build:deps": "lerna run --scope @firebase/database-compat --include-dependencies build",
19+
"dev": "rollup -c -w",
20+
"test": "run-p lint test:browser test:node",
21+
"test:ci": "node ../../scripts/run_tests_in_ci.js -s test",
22+
"test:browser": "karma start --single-run",
23+
"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",
24+
"add-compat-overloads": "ts-node-script ../../scripts/exp/create-overloads.ts -i ../database/dist/public.d.ts -o dist/database-compat/src/index.d.ts -a -r FirebaseDatabase:types.FirebaseDatabase -r Query:types.Query -r Reference:types.Reference -r FirebaseApp:FirebaseAppCompat --moduleToEnhance @firebase/database"
25+
},
26+
"peerDependencies": {
27+
"@firebase/app-compat": "0.x"
28+
},
29+
"dependencies": {
30+
"@firebase/database": "0.11.0",
31+
"@firebase/database-types": "0.8.0",
32+
"@firebase/logger": "0.2.6",
33+
"@firebase/util": "1.3.0",
34+
"@firebase/component": "0.5.6",
35+
"tslib": "^2.1.0"
36+
}
37+
}

0 commit comments

Comments
 (0)