Skip to content

Commit

Permalink
Merge 5c0662e into 7818176
Browse files Browse the repository at this point in the history
  • Loading branch information
Feiyang1 committed Aug 22, 2021
2 parents 7818176 + 5c0662e commit 4980d39
Show file tree
Hide file tree
Showing 120 changed files with 2,922 additions and 3,567 deletions.
103 changes: 89 additions & 14 deletions common/api-review/storage.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { EmulatorMockTokenOptions } from '@firebase/util';
import { FirebaseApp } from '@firebase/app';
import { FirebaseAuthInternalName } from '@firebase/auth-interop-types';
import { FirebaseError } from '@firebase/util';
import { _FirebaseService } from '@firebase/app';
import { _FirebaseService } from '@firebase/app-exp';
import { NextFn } from '@firebase/util';
import { Provider } from '@firebase/component';
import { Subscribe } from '@firebase/util';
Expand All @@ -21,6 +21,11 @@ export function connectStorageEmulator(storage: FirebaseStorage, host: string, p
mockUserToken?: EmulatorMockTokenOptions | string;
}): void;

// Warning: (ae-forgotten-export) The symbol "StringData" needs to be exported by the entry point index.d.ts
//
// @internal (undocumented)
export function _dataFromString(format: StringFormat, stringData: string): StringData;

// @public
export function deleteObject(ref: StorageReference): Promise<void>;

Expand Down Expand Up @@ -51,6 +56,55 @@ export interface FirebaseStorageError extends FirebaseError {
serverResponse: string | null;
}

// @public
export class _FirebaseStorageImpl implements FirebaseStorage {
constructor(
app: FirebaseApp, _authProvider: Provider<FirebaseAuthInternalName>,
_appCheckProvider: Provider<AppCheckInternalComponentName>,
_pool: ConnectionPool, _url?: string | undefined, _firebaseVersion?: string | undefined);
readonly app: FirebaseApp;
// @internal (undocumented)
readonly _appCheckProvider: Provider<AppCheckInternalComponentName>;
// (undocumented)
protected readonly _appId: string | null;
// (undocumented)
readonly _authProvider: Provider<FirebaseAuthInternalName>;
// Warning: (ae-incompatible-release-tags) The symbol "_bucket" is marked as @public, but its signature references "Location" which is marked as @internal
//
// (undocumented)
_bucket: _Location | null;
_delete(): Promise<void>;
// (undocumented)
readonly _firebaseVersion?: string | undefined;
// (undocumented)
_getAppCheckToken(): Promise<string | null>;
// (undocumented)
_getAuthToken(): Promise<string | null>;
// (undocumented)
get host(): string;
set host(host: string);
// Warning: (ae-forgotten-export) The symbol "RequestInfo" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "Request" needs to be exported by the entry point index.d.ts
//
// (undocumented)
_makeRequest<T>(requestInfo: RequestInfo_2<T>, authToken: string | null, appCheckToken: string | null): Request_2<T>;
// (undocumented)
makeRequestWithTokens<T>(requestInfo: RequestInfo_2<T>): Promise<Request_2<T>>;
// Warning: (ae-incompatible-release-tags) The symbol "_makeStorageReference" is marked as @public, but its signature references "Location" which is marked as @internal
// Warning: (ae-incompatible-release-tags) The symbol "_makeStorageReference" is marked as @public, but its signature references "Reference" which is marked as @internal
_makeStorageReference(loc: _Location): _Reference;
get maxOperationRetryTime(): number;
set maxOperationRetryTime(time: number);
get maxUploadRetryTime(): number;
set maxUploadRetryTime(time: number);
// Warning: (ae-forgotten-export) The symbol "ConnectionPool" needs to be exported by the entry point index.d.ts
//
// @internal (undocumented)
readonly _pool: ConnectionPool;
// (undocumented)
readonly _url?: string | undefined;
}

// @public
export interface FullMetadata extends UploadMetadata {
bucket: string;
Expand All @@ -77,6 +131,14 @@ export function getMetadata(ref: StorageReference): Promise<FullMetadata>;
// @public
export function getStorage(app?: FirebaseApp, bucketUrl?: string): FirebaseStorage;

// Warning: (ae-forgotten-export) The symbol "FirebaseStorageError" needs to be exported by the entry point index.d.ts
//
// @internal (undocumented)
export function _invalidArgument(message: string): FirebaseStorageError_2;

// @internal (undocumented)
export function _invalidRootOperation(name: string): FirebaseStorageError_2;

// @public
export function list(ref: StorageReference, options?: ListOptions): Promise<ListResult>;

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

// @internal
export class _Reference {
// Warning: (ae-forgotten-export) The symbol "FirebaseStorageImpl" needs to be exported by the entry point index.d.ts
constructor(_service: FirebaseStorageImpl, location: string | _Location);
constructor(_service: _FirebaseStorageImpl, location: string | _Location);
get bucket(): string;
get fullPath(): string;
// (undocumented)
_location: _Location;
get name(): string;
// (undocumented)
protected _newRef(service: FirebaseStorageImpl, location: _Location): _Reference;
protected _newRef(service: _FirebaseStorageImpl, location: _Location): _Reference;
get parent(): _Reference | null;
get root(): _Reference;
get storage(): FirebaseStorageImpl;
get storage(): _FirebaseStorageImpl;
_throwIfRoot(name: string): void;
// @override
toString(): string;
Expand Down Expand Up @@ -187,9 +248,29 @@ export const StringFormat: {
// @public
export type TaskEvent = 'state_changed';

// @public
export type _TaskEvent = string;

// @public
export const _TaskEvent: {
STATE_CHANGED: string;
};

// @public
export type TaskState = 'running' | 'paused' | 'success' | 'canceled' | 'error';

// @public
export type _TaskState = typeof _TaskState[keyof typeof _TaskState];

// @public
export const _TaskState: {
readonly RUNNING: "running";
readonly PAUSED: "paused";
readonly SUCCESS: "success";
readonly CANCELED: "canceled";
readonly ERROR: "error";
};

// @public
export function updateMetadata(ref: StorageReference, metadata: SettableMetadata): Promise<FullMetadata>;

Expand Down Expand Up @@ -232,21 +313,15 @@ export class _UploadTask {
catch<T>(onRejected: (p1: FirebaseStorageError_2) => T | Promise<T>): Promise<T>;
// Warning: (ae-forgotten-export) The symbol "Metadata" needs to be exported by the entry point index.d.ts
_metadata: Metadata | null;
// Warning: (ae-forgotten-export) The symbol "TaskEvent" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "StorageObserver" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "ErrorFn" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "CompleteFn" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "Unsubscribe" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "Subscribe" needs to be exported by the entry point index.d.ts
on(type: TaskEvent_2, nextOrObserver?: StorageObserver_2<UploadTaskSnapshot_2> | ((a: UploadTaskSnapshot_2) => unknown), error?: ErrorFn, completed?: CompleteFn_2): Unsubscribe_2 | Subscribe_2<UploadTaskSnapshot_2>;
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>;
pause(): boolean;
resume(): boolean;
// Warning: (ae-forgotten-export) The symbol "UploadTaskSnapshot" needs to be exported by the entry point index.d.ts
get snapshot(): UploadTaskSnapshot_2;
get snapshot(): UploadTaskSnapshot;
// Warning: (ae-forgotten-export) The symbol "InternalTaskState" needs to be exported by the entry point index.d.ts
_state: InternalTaskState;
// Warning: (ae-forgotten-export) The symbol "FirebaseStorageError" needs to be exported by the entry point index.d.ts
then<U>(onFulfilled?: ((value: UploadTaskSnapshot_2) => U | Promise<U>) | null, onRejected?: ((error: FirebaseStorageError_2) => U | Promise<U>) | null): Promise<U>;
then<U>(onFulfilled?: ((value: UploadTaskSnapshot) => U | Promise<U>) | null, onRejected?: ((error: FirebaseStorageError_2) => U | Promise<U>) | null): Promise<U>;
_transferred: number;
}

Expand Down
4 changes: 2 additions & 2 deletions packages-exp/app-exp/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { name as appCheckName } from '../../../packages-exp/app-check-exp/packag
import { name as authName } from '../../../packages-exp/auth-exp/package.json';
import { name as authCompatName } from '../../../packages-exp/auth-compat-exp/package.json';
import { name as databaseName } from '../../../packages/database/package.json';
import { name as databaseCompatName } from '../../../packages/database/compat/package.json';
import { name as databaseCompatName } from '../../../packages/database-compat/package.json';
import { name as functionsName } from '../../../packages-exp/functions-exp/package.json';
import { name as functionsCompatName } from '../../../packages-exp/functions-compat/package.json';
import { name as installationsName } from '../../../packages-exp/installations-exp/package.json';
Expand All @@ -36,7 +36,7 @@ import { name as performanceCompatName } from '../../../packages-exp/performance
import { name as remoteConfigName } from '../../../packages-exp/remote-config-exp/package.json';
import { name as remoteConfigCompatName } from '../../../packages-exp/remote-config-compat/package.json';
import { name as storageName } from '../../../packages/storage/package.json';
import { name as storageCompatName } from '../../../packages/storage/compat/package.json';
import { name as storageCompatName } from '../../../packages/storage-compat/package.json';
import { name as firestoreName } from '../../../packages/firestore/package.json';
import { name as firestoreCompatName } from '../../../packages/firestore/compat/package.json';
import { name as packageName } from '../../../packages-exp/firebase-exp/package.json';
Expand Down
64 changes: 64 additions & 0 deletions packages/database-compat/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

module.exports = {
extends: '../../config/.eslintrc.js',
parserOptions: {
project: 'tsconfig.json',
// to make vscode-eslint work with monorepo
// https://github.com/typescript-eslint/typescript-eslint/issues/251#issuecomment-463943250
tsconfigRootDir: __dirname
},
rules: {
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-floating-promises': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'no-restricted-properties': 'off',
'no-restricted-globals': 'off',
'no-throw-literal': 'off',
'id-blacklist': 'off',
'import/order': [
'error',
{
'groups': [
'builtin',
'external',
'internal',
'parent',
'sibling',
'index'
],
'newlines-between': 'always',
'alphabetize': { 'order': 'asc', 'caseInsensitive': true }
}
]
},
overrides: [
{
files: ['**/*.d.ts'],
rules: {
'@typescript-eslint/no-explicit-any': 'off'
}
},
{
files: ['scripts/*.ts'],
rules: {
'import/no-extraneous-dependencies': 'off'
}
}
]
};
5 changes: 5 additions & 0 deletions packages/database-compat/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# @firebase/database-compat

This is the compatibility layer for the Firebase Realtime Database component of the Firebase JS SDK.

**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.**
34 changes: 34 additions & 0 deletions packages/database-compat/karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

const karmaBase = require('../../config/karma.base');

const files = [`test/**/*.test.ts`];

module.exports = function (config) {
const karmaConfig = Object.assign({}, karmaBase, {
// files to load into karma
files: files,
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['mocha']
});

config.set(karmaConfig);
};

module.exports.files = files;
37 changes: 37 additions & 0 deletions packages/database-compat/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"name": "@firebase/database-compat",
"version": "0.0.900",
"description": "The Realtime Database component of the Firebase JS SDK.",
"author": "Firebase <firebase-support@google.com> (https://firebase.google.com/)",
"main": "dist/index.js",
"browser": "dist/index.esm2017.js",
"module": "dist/index.esm2017.js",
"esm5": "dist/index.esm5.js",
"license": "Apache-2.0",
"typings": "dist/database-compat/src/index.d.ts",
"scripts": {
"lint": "eslint -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'",
"lint:fix": "eslint --fix -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'",
"prettier": "prettier --write '*.js' '*.ts' '@(src|test)/**/*.ts'",
"build": "rollup -c rollup.config.js",
"build:release": "yarn build && yarn add-compat-overloads",
"build:deps": "lerna run --scope @firebase/database-compat --include-dependencies build",
"dev": "rollup -c -w",
"test": "run-p lint test:browser test:node",
"test:ci": "node ../../scripts/run_tests_in_ci.js -s test",
"test:browser": "karma start --single-run",
"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",
"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"
},
"peerDependencies": {
"@firebase/app-compat": "0.x"
},
"dependencies": {
"@firebase/database": "0.11.0",
"@firebase/database-types": "0.8.0",
"@firebase/logger": "0.2.6",
"@firebase/util": "1.3.0",
"@firebase/component": "0.5.6",
"tslib": "^2.1.0"
}
}
Loading

0 comments on commit 4980d39

Please sign in to comment.