Skip to content

Fei v9 main firestore #5319

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 47 commits into from
Aug 23, 2021
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
00d5618
compile firestore
Feiyang1 Aug 14, 2021
e072423
update typings path
Feiyang1 Aug 16, 2021
61326d0
compile firestore compat
Feiyang1 Aug 16, 2021
6d3a95c
lint compat
Feiyang1 Aug 16, 2021
fb89c68
make test work
Feiyang1 Aug 17, 2021
e9039e5
get most tests work
Feiyang1 Aug 18, 2021
b7c9e77
build
Feiyang1 Aug 18, 2021
25a9dea
remove special paths
Feiyang1 Aug 18, 2021
5bff131
update firestore-compat pkg json
Feiyang1 Aug 18, 2021
e475b43
Merge branch 'master' into fei-v9-main-firestore
Feiyang1 Aug 18, 2021
2cb9567
fix merge issues
Feiyang1 Aug 18, 2021
ae2d146
Simplify bundles
schmidt-sebastian Aug 18, 2021
0ea42e3
Prettier
schmidt-sebastian Aug 18, 2021
bfdf412
Fix Bundle compile
schmidt-sebastian Aug 18, 2021
f73c1b5
Fix build
schmidt-sebastian Aug 18, 2021
8a9eb9f
address comments
Feiyang1 Aug 18, 2021
8d637a3
console build
Feiyang1 Aug 18, 2021
30f77b9
Merge branch 'fei-v9-main-firestore' of https://github.com/firebase/f…
Feiyang1 Aug 18, 2021
0b6f1ce
Fix all tests
schmidt-sebastian Aug 18, 2021
00490a6
Prettier
schmidt-sebastian Aug 18, 2021
0408b3b
Merge branch 'fei-v9-main-firestore' of github.com:firebase/firebase-…
schmidt-sebastian Aug 18, 2021
1504240
Merge branch 'master' into fei-v9-main-firestore
Feiyang1 Aug 19, 2021
3fdb655
fix merge issues
Feiyang1 Aug 19, 2021
557d06d
Merge branch 'fei-v9-main-firestore' of https://github.com/firebase/f…
Feiyang1 Aug 19, 2021
6f4ec23
fix typo
Feiyang1 Aug 19, 2021
2dedf19
Merge branch 'master' into fei-v9-main-firestore
Feiyang1 Aug 19, 2021
95cb0e2
update paths
Feiyang1 Aug 19, 2021
8be6e79
app-exp
Feiyang1 Aug 20, 2021
070f093
fix lint
Feiyang1 Aug 20, 2021
c78cb57
correct path
Feiyang1 Aug 20, 2021
bf408d4
fix
Feiyang1 Aug 20, 2021
609419d
fix compat lint
Feiyang1 Aug 20, 2021
196d0e6
fix firestore integration
Feiyang1 Aug 20, 2021
031942a
fix workflow
Feiyang1 Aug 20, 2021
b03423b
update dep
Feiyang1 Aug 20, 2021
aa5b344
Always block on Auth (#5340)
schmidt-sebastian Aug 21, 2021
0bdf7f2
fix lint
Feiyang1 Aug 21, 2021
b417bbe
Merge branch 'fei-v9-main' into fei-v9-main-firestore
Feiyang1 Aug 22, 2021
6655e90
build firestore
Feiyang1 Aug 22, 2021
0adb499
remove memory only tests
Feiyang1 Aug 22, 2021
1b46468
fix firebase integration tests
Feiyang1 Aug 22, 2021
0b43ba7
enable more build and tests
Feiyang1 Aug 22, 2021
60b2f0a
add firestore-compat to firebase dep
Feiyang1 Aug 22, 2021
6577316
fix auth compat class
Feiyang1 Aug 22, 2021
07c6ee3
enable auth test
Feiyang1 Aug 22, 2021
8481938
auth package doc
Feiyang1 Aug 23, 2021
13339f8
Update API reports
Feiyang1 Aug 23, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions common/api-review/firestore-lite.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ export class DocumentSnapshot<T = DocumentData> {
get ref(): DocumentReference<T>;
}

export { EmulatorMockTokenOptions }

// @public
export function endAt(snapshot: DocumentSnapshot<unknown>): QueryConstraint;

Expand Down
2 changes: 2 additions & 0 deletions common/api-review/firestore.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ export class DocumentSnapshot<T = DocumentData> {
get ref(): DocumentReference<T>;
}

export { EmulatorMockTokenOptions }

// @public
export function enableIndexedDbPersistence(firestore: Firestore, persistenceSettings?: PersistenceSettings): Promise<void>;

Expand Down
101 changes: 101 additions & 0 deletions packages/firestore-compat/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
/**
* @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
},
plugins: ['import'],
rules: {
'no-console': ['error', { allow: ['warn', 'error'] }],
'@typescript-eslint/no-unused-vars': [
'error',
{
varsIgnorePattern: '^_',
args: 'none'
}
],
'import/order': [
'error',
{
'groups': [
'builtin',
'external',
'internal',
'parent',
'sibling',
'index'
],
'newlines-between': 'always',
'alphabetize': { 'order': 'asc', 'caseInsensitive': true }
}
],
'no-restricted-globals': [
'error',
{
'name': 'window',
'message': 'Use `PlatformSupport.getPlatform().window` instead.'
},
{
'name': 'document',
'message': 'Use `PlatformSupport.getPlatform().document` instead.'
}
]
},
overrides: [
{
files: ['**/*.d.ts'],
rules: {
'camelcase': 'off',
'import/no-duplicates': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': 'off'
}
},
{
files: ['**/*.test.ts', '**/test/**/*.ts'],
rules: {
'@typescript-eslint/no-explicit-any': 'error'
}
},
{
files: ['scripts/*.ts'],
rules: {
'import/no-extraneous-dependencies': 'off',
'@typescript-eslint/no-require-imports': 'off'
}
},
// TODO(firestorelite): Remove this exception when app-exp is published
{
files: ['lite/**/*.ts'],
rules: {
'import/no-extraneous-dependencies': 'off'
}
},
// TODO(firestoreexp): Remove this exception when app-exp is published
{
files: ['exp/**/*.ts'],
rules: {
'import/no-extraneous-dependencies': 'off'
}
}
]
};
24 changes: 24 additions & 0 deletions packages/firestore-compat/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# @firebase/firestore

This is the [Cloud Firestore](https://firebase.google.com/docs/firestore/) component of the
[Firebase JS SDK](https://www.npmjs.com/package/firebase).

**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.**

If you are developing a Node.js application that requires administrative access to Cloud Firestore,
use the [`@google-cloud/firestore`](https://www.npmjs.com/package/@google-cloud/firestore) Server
SDK with your developer credentials.

## Documentation

For comprehensive documentation please see the [Firebase Reference
Docs][reference-docs].

[reference-docs]: https://firebase.google.com/docs/reference/js/

## Contributing
See [Contributing to the Firebase SDK](../../CONTRIBUTING.md) for general
information about contributing to the firebase-js-sdk repo and
[Contributing to the Cloud Firestore Component](./CONTRIBUTING.md) for
details specific to the Cloud Firestore code and tests.
83 changes: 83 additions & 0 deletions packages/firestore-compat/karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/**
* @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 { argv } = require('yargs');

module.exports = function (config) {
const karmaConfig = Object.assign({}, karmaBase, {
// files to load into karma
files: getTestFiles(argv),

preprocessors: {
'test/**/*.ts': ['webpack', 'sourcemap']
},

// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['mocha'],

client: Object.assign({}, karmaBase.client, {
firestoreSettings: getFirestoreSettings(argv)
})
});

config.set(karmaConfig);
};

/**
* Gets the list of files to execute, based on existence of the
* --unit and --integration command-line arguments.
*/
function getTestFiles(argv) {
const unitTests = 'test/unit/bootstrap.ts';
const legcayIntegrationTests = 'test/integration/bootstrap.ts';
const liteIntegrationTests = 'test/lite/bootstrap.ts';
if (argv.unit) {
return [unitTests];
} else if (argv.integration) {
return [legcayIntegrationTests];
} else if (argv.lite) {
process.env.TEST_PLATFORM = 'browser_lite';
return [liteIntegrationTests];
} else {
// Note that we cannot include both the firestore-exp and the legacy SDK
// as the test runners modify the global namespace cannot be both included
// in the same bundle.
return [unitTests, legcayIntegrationTests];
}
}

/**
* If the --local argument is passed, returns a {host, ssl} FirestoreSettings
* object that point to localhost instead of production.
*/
function getFirestoreSettings(argv) {
if (argv.local) {
return {
host: 'localhost:8080',
ssl: false
};
} else {
return {
host: 'firestore.googleapis.com',
ssl: true
};
}
}

module.exports.files = getTestFiles(argv);
43 changes: 43 additions & 0 deletions packages/firestore-compat/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"name": "@firebase/firestore-compat",
"version": "0.1.0",
"description": "The Cloud Firestore component of the Firebase JS SDK.",
"author": "Firebase <[email protected]> (https://firebase.google.com/)",
"main": "dist/index.node.cjs.js",
"react-native": "dist/index.rn.js",
"browser": "dist/index.esm2017.js",
"module": "dist/index.esm2017.js",
"esm5": "dist/index.esm5.js",
"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' '@(lite|exp|src|test)/**/*.ts'",
"build": "rollup -c ./rollup.config.js",
"build:deps": "lerna run --scope @firebase/firestore-compat --include-dependencies build",
"build:release": "yarn build && yarn add-compat-overloads",
"test": "echo 'tested as part of firestore'",
"add-compat-overloads": "ts-node-script ../../scripts/exp/create-overloads.ts -i ../firestore/dist/index.d.ts -o dist/src/index.d.ts -a -r Firestore:types.FirebaseFirestore -r CollectionReference:types.CollectionReference -r DocumentReference:types.DocumentReference -r Query:types.Query -r FirebaseApp:FirebaseAppCompat --moduleToEnhance @firebase/firestore"
},
"peerDependencies": {
"@firebase/app-compat": "0.x"
},
"dependencies": {
"@firebase/component": "0.5.5",
"@firebase/firestore": "2.3.10",
"@firebase/util": "1.2.0",
"@firebase/firestore-types": "2.3.0",
"tslib": "^2.1.0"
},
"devDependencies": {
"@types/eslint": "7.2.10",
"rollup": "2.52.2",
"rollup-plugin-sourcemaps": "0.6.3",
"rollup-plugin-terser": "7.0.2",
"rollup-plugin-typescript2": "0.30.0",
"ts-node": "9.1.1",
"typescript": "4.2.2"
},
"license": "Apache-2.0",
"typings": "dist/src/index.d.ts"
}

99 changes: 99 additions & 0 deletions packages/firestore-compat/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
/**
* @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.
*/

import pkg from './package.json';
import typescriptPlugin from 'rollup-plugin-typescript2';
import typescript from 'typescript';
import json from '@rollup/plugin-json';

const util = require('../firestore/rollup.shared');

const deps = Object.keys({ ...pkg.peerDependencies, ...pkg.dependencies });

const es2017Plugins = [
typescriptPlugin({
typescript,
tsconfigOverride: {
compilerOptions: {
target: 'es2017'
}
},
transformers: [util.removeAssertTransformer]
}),
json({ preferConst: true })
];

const es5Pluging = [
typescriptPlugin({
typescript,
transformers: [util.removeAssertTransformer]
}),
json({ preferConst: true })
];

const browserBuilds = [
{
input: './src/index.ts',
output: {
file: pkg.browser,
format: 'es',
sourcemap: true
},
plugins: es2017Plugins,
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`))
},
{
input: './src/index.ts',
output: [
{
file: pkg.esm5,
format: 'es',
sourcemap: true
}
],
plugins: es5Pluging,
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`))
}
];

const nodeBuilds = [
{
input: './src/index.node.ts',
output: {
file: pkg.main,
format: 'es',
sourcemap: true
},
plugins: es2017Plugins,
external: deps
}
];

const rnBuilds = [
{
input: './src/index.rn.ts',
output: {
file: pkg['react-native'],
format: 'es',
sourcemap: true
},
plugins: es2017Plugins,
external: deps
}
]

export default [...browserBuilds, ...nodeBuilds, ...rnBuilds];
Loading