Skip to content

Bundles as free functions #4006

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 49 commits into from
Nov 9, 2020
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
d3a3697
Rolls a node app building bundles.
wu-hui Oct 16, 2020
2b2dce8
Build bundle files for given list of project IDs.
wu-hui Oct 16, 2020
6d8020a
Build the bundle json map and save it for integration tests.
wu-hui Oct 16, 2020
2a5c796
Add emulator_settings.ts to gulp
wu-hui Oct 16, 2020
a31b115
Move bundle.test.ts to api/
wu-hui Oct 16, 2020
0ebd413
Bundles passes all tests and expose in classic API
wu-hui Oct 18, 2020
ee1ea5d
Add CI project ID to bundles.
wu-hui Oct 19, 2020
64e82db
Merge branch 'wuandy/Bundles' into wuandy/BundleIntegrationTests
wu-hui Oct 20, 2020
8cc3d8e
Merge branch 'wuandy/BundleIntegrationTests' into wuandy/MoveBundleTe…
wu-hui Oct 20, 2020
4fa0c08
Adhoc string replacement and length re-calculation
wu-hui Oct 22, 2020
f1086b0
Fix lint errors.
wu-hui Oct 22, 2020
9d0d0a5
Delete old changes from make node app
wu-hui Oct 23, 2020
7fda4c4
Address comments
wu-hui Oct 25, 2020
e3bf958
Update yarn.lock for release (#3998)
hsubox76 Oct 26, 2020
086d478
Manually prepares the bundle strings.
wu-hui Oct 27, 2020
f6dcd42
Update API
wu-hui Oct 27, 2020
8fe001b
Update config.ts
wu-hui Oct 28, 2020
6f06d84
Use Chrome for karma debugging (#4007)
schmidt-sebastian Oct 28, 2020
5999824
Merge branch 'wuandy/Bundles' into wuandy/BundleFreeFunctions
wu-hui Oct 29, 2020
973cdfa
Cache emulator between runs (#3956)
samtstern Oct 29, 2020
0c602aa
Remote Config Modularization (#3975)
Feiyang1 Oct 29, 2020
7e3846b
Remove AuthErrorCode from core export (#4013)
sam-gc Oct 29, 2020
7cd9eb3
Update config.ts to remove bundles
wu-hui Oct 29, 2020
de5237f
adds a root changelog (#4009)
dimitropoulos Oct 29, 2020
1cdd3ab
Update dependency typescript to v4.0.5 (#3846)
renovate[bot] Oct 29, 2020
a7991f4
Update dependency karma-firefox-launcher to v2 (#3987)
renovate[bot] Oct 29, 2020
3f6f5e4
Update dependency google-closure-library to v20200830 (#3765)
renovate[bot] Oct 29, 2020
f68ce24
exclude remote config exp packages in changeset (#4014)
Feiyang1 Oct 29, 2020
54a46f8
Set 1s timeout for onBackgroundMessage Hook (#3780)
zwu52 Oct 29, 2020
2ac31a1
A whole bunch of things to bring auth (compat) to parity (#3970)
sam-gc Oct 29, 2020
6ef39d4
Add withFunctionsTriggersDisabled method to rules-unit-testing (#3928)
samtstern Oct 30, 2020
bddca6b
Update integration tests to use free functions
wu-hui Nov 2, 2020
a74a1d1
Functions compat package (#3739)
hsubox76 Nov 3, 2020
830d948
Add free functions to exports
wu-hui Nov 3, 2020
d7c6d62
Fix to avoid false failures on changeset checker (#4012)
hsubox76 Nov 3, 2020
007ddd1
Add changeset for Firestore (#4030)
schmidt-sebastian Nov 3, 2020
ced4e02
Merge branch 'master' into release
hsubox76 Nov 3, 2020
8697166
Update functions-compat dep version and fix changeset script error (#…
hsubox76 Nov 3, 2020
81a777f
Merge branch 'master' into release
hsubox76 Nov 3, 2020
ac4bf09
Update integration tests. Minified tests fail.
wu-hui Nov 4, 2020
39847b8
Bump node memory limit for all test CI (#4035)
hsubox76 Nov 4, 2020
9d424f5
Compat Layer for Firestore (#4003)
schmidt-sebastian Nov 4, 2020
14d023d
Rename all public API types to PublicX (#4039)
schmidt-sebastian Nov 5, 2020
c47ba31
Update all non-major dependencies (#3953)
renovate[bot] Nov 5, 2020
fc358f6
Version Packages (#4033)
google-oss-bot Nov 5, 2020
996004f
Merge branch 'release'
hsubox76 Nov 5, 2020
f9dc50e
Set up Storage modularization (#3499)
hsubox76 Nov 6, 2020
8cb3c23
Merge branch 'master' into wuandy/BundleFreeFunctions
wu-hui Nov 6, 2020
462efdc
Free functions removed from exp database.ts
wu-hui Nov 6, 2020
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
16 changes: 10 additions & 6 deletions packages/firebase/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8279,18 +8279,22 @@ declare namespace firebase.firestore {
*/
terminate(): Promise<void>;

loadBundle(
bundleData: ArrayBuffer | ReadableStream<ArrayBuffer> | string
): LoadBundleTask;

namedQuery(name: string): Promise<Query<DocumentData> | null>;

/**
* @hidden
*/
INTERNAL: { delete: () => Promise<void> };
}

export function loadBundle(
db: Firestore,
bundleData: ArrayBuffer | ReadableStream<ArrayBuffer> | string
): LoadBundleTask;

export function namedQuery(
db: Firestore,
name: string
): Promise<Query<DocumentData> | null>;

export interface LoadBundleTask {
onProgress(
next?: (progress: LoadBundleTaskProgress) => any,
Expand Down
16 changes: 10 additions & 6 deletions packages/firestore-types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,19 @@ export class FirebaseFirestore {

terminate(): Promise<void>;

loadBundle(
bundleData: ArrayBuffer | ReadableStream<ArrayBuffer> | string
): LoadBundleTask;

namedQuery(name: string): Promise<Query<DocumentData> | null>;

INTERNAL: { delete: () => Promise<void> };
}

export function loadBundle(
db: FirebaseFirestore,
bundleData: ArrayBuffer | ReadableStream<ArrayBuffer> | string
): LoadBundleTask;

export function namedQuery(
db: FirebaseFirestore,
name: string
): Promise<Query<DocumentData> | null>;

export interface LoadBundleTask {
onProgress(
next?: (progress: LoadBundleTaskProgress) => any,
Expand Down
52 changes: 29 additions & 23 deletions packages/firestore/src/api/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -443,29 +443,6 @@ export class Firestore
}
}

loadBundle(
bundleData: ArrayBuffer | ReadableStream<Uint8Array> | string
): LoadBundleTask {
ensureFirestoreConfigured(this);
const resultTask = new LoadBundleTask();
// eslint-disable-next-line @typescript-eslint/no-floating-promises
firestoreClientLoadBundle(this._firestoreClient!, bundleData, resultTask);
return resultTask;
}

namedQuery(name: string): Promise<PublicQuery | null> {
ensureFirestoreConfigured(this);
return firestoreClientGetNamedQuery(this._firestoreClient!, name).then(
namedQuery => {
if (!namedQuery) {
return null;
}

return new Query(namedQuery.query, this, null);
}
);
}

private static databaseIdFromApp(app: FirebaseApp): DatabaseId {
if (!contains(app.options, 'projectId')) {
throw new FirestoreError(
Expand Down Expand Up @@ -603,6 +580,35 @@ export function setLogLevel(level: PublicLogLevel): void {
setClientLogLevel(level);
}

export function loadBundle(
db: Firestore,
bundleData: ArrayBuffer | ReadableStream<Uint8Array> | string
): LoadBundleTask {
const resultTask = new LoadBundleTask();
// eslint-disable-next-line @typescript-eslint/no-floating-promises
firestoreClientLoadBundle(
ensureFirestoreConfigured(db),
bundleData,
resultTask
);
return resultTask;
}

export function namedQuery(
db: Firestore,
name: string
): Promise<PublicQuery | null> {
return firestoreClientGetNamedQuery(ensureFirestoreConfigured(db), name).then(
namedQuery => {
if (!namedQuery) {
return null;
}

return new Query(namedQuery.query, db, null);
}
);
}

/**
* A reference to a transaction.
*/
Expand Down
4 changes: 4 additions & 0 deletions packages/firestore/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ import {
QuerySnapshot,
Transaction,
WriteBatch,
loadBundle,
namedQuery,
setLogLevel
} from './api/database';
import { Blob } from './api/blob';
Expand All @@ -54,6 +56,8 @@ const firestoreNamespace = {
FieldPath,
FieldValue,
setLogLevel,
loadBundle,
namedQuery,
CACHE_SIZE_UNLIMITED
};

Expand Down