Skip to content

Commit

Permalink
Data Connect Product (#8480)
Browse files Browse the repository at this point in the history
  • Loading branch information
maneesht authored Sep 24, 2024
1 parent 47b0913 commit beaa4df
Show file tree
Hide file tree
Showing 79 changed files with 4,723 additions and 18 deletions.
7 changes: 7 additions & 0 deletions .changeset/cold-chairs-fold.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"firebase": minor
"@firebase/app": patch
"@firebase/data-connect": minor
---

Included Data Connect product.
1 change: 1 addition & 0 deletions .github/workflows/canary-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ jobs:
NPM_TOKEN_AUTH_INTEROP_TYPES: ${{secrets.NPM_TOKEN_AUTH_INTEROP_TYPES}}
NPM_TOKEN_AUTH_TYPES: ${{secrets.NPM_TOKEN_AUTH_TYPES}}
NPM_TOKEN_COMPONENT: ${{secrets.NPM_TOKEN_COMPONENT}}
NPM_TOKEN_DATA_CONNECT: ${{secrets.NPM_TOKEN_DATA_CONNECT}}
NPM_TOKEN_DATABASE: ${{secrets.NPM_TOKEN_DATABASE}}
NPM_TOKEN_DATABASE_TYPES: ${{secrets.NPM_TOKEN_DATABASE_TYPES}}
NPM_TOKEN_FIRESTORE: ${{secrets.NPM_TOKEN_FIRESTORE}}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/prerelease-manual-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ jobs:
NPM_TOKEN_AUTH_INTEROP_TYPES: ${{secrets.NPM_TOKEN_AUTH_INTEROP_TYPES}}
NPM_TOKEN_AUTH_TYPES: ${{secrets.NPM_TOKEN_AUTH_TYPES}}
NPM_TOKEN_COMPONENT: ${{secrets.NPM_TOKEN_COMPONENT}}
NPM_TOKEN_DATA_CONNECT: ${{secrets.NPM_TOKEN_DATA_CONNECT}}
NPM_TOKEN_DATABASE: ${{secrets.NPM_TOKEN_DATABASE}}
NPM_TOKEN_DATABASE_TYPES: ${{secrets.NPM_TOKEN_DATABASE_TYPES}}
NPM_TOKEN_FIRESTORE: ${{secrets.NPM_TOKEN_FIRESTORE}}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ jobs:
NPM_TOKEN_AUTH_INTEROP_TYPES: ${{secrets.NPM_TOKEN_AUTH_INTEROP_TYPES}}
NPM_TOKEN_AUTH_TYPES: ${{secrets.NPM_TOKEN_AUTH_TYPES}}
NPM_TOKEN_COMPONENT: ${{secrets.NPM_TOKEN_COMPONENT}}
NPM_TOKEN_DATA_CONNECT: ${{secrets.NPM_TOKEN_DATA_CONNECT}}
NPM_TOKEN_DATABASE: ${{secrets.NPM_TOKEN_DATABASE}}
NPM_TOKEN_DATABASE_TYPES: ${{secrets.NPM_TOKEN_DATABASE_TYPES}}
NPM_TOKEN_FIRESTORE: ${{secrets.NPM_TOKEN_FIRESTORE}}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ jobs:
NPM_TOKEN_AUTH_INTEROP_TYPES: ${{secrets.NPM_TOKEN_AUTH_INTEROP_TYPES}}
NPM_TOKEN_AUTH_TYPES: ${{secrets.NPM_TOKEN_AUTH_TYPES}}
NPM_TOKEN_COMPONENT: ${{secrets.NPM_TOKEN_COMPONENT}}
NPM_TOKEN_DATA_CONNECT: ${{secrets.NPM_TOKEN_DATA_CONNECT}}
NPM_TOKEN_DATABASE: ${{secrets.NPM_TOKEN_DATABASE}}
NPM_TOKEN_DATABASE_TYPES: ${{secrets.NPM_TOKEN_DATABASE_TYPES}}
NPM_TOKEN_FIRESTORE: ${{secrets.NPM_TOKEN_FIRESTORE}}
Expand Down
234 changes: 234 additions & 0 deletions common/api-review/data-connect.api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,234 @@
## API Report File for "@firebase/data-connect"

> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
```ts

import { AppCheckInternalComponentName } from '@firebase/app-check-interop-types';
import { FirebaseApp } from '@firebase/app';
import { FirebaseAuthInternalName } from '@firebase/auth-interop-types';
import { FirebaseError } from '@firebase/util';
import { LogLevelString } from '@firebase/logger';
import { Provider } from '@firebase/component';

// @public (undocumented)
export interface CancellableOperation<T> extends PromiseLike<{
data: T;
}> {
// (undocumented)
cancel: () => void;
}

// @public
export function connectDataConnectEmulator(dc: DataConnect, host: string, port?: number, sslEnabled?: boolean): void;

// @public
export interface ConnectorConfig {
// (undocumented)
connector: string;
// (undocumented)
location: string;
// (undocumented)
service: string;
}

// @public
export class DataConnect {
constructor(app: FirebaseApp, dataConnectOptions: DataConnectOptions, _authProvider: Provider<FirebaseAuthInternalName>, _appCheckProvider: Provider<AppCheckInternalComponentName>);
// (undocumented)
readonly app: FirebaseApp;
// (undocumented)
enableEmulator(transportOptions: TransportOptions): void;
// (undocumented)
getSettings(): ConnectorConfig;
// (undocumented)
isEmulator: boolean;
// (undocumented)
setInitialized(): void;
}

// @public
export interface DataConnectOptions extends ConnectorConfig {
// (undocumented)
projectId: string;
}

// @public (undocumented)
export interface DataConnectResult<Data, Variables> extends OpResult<Data> {
// (undocumented)
ref: OperationRef<Data, Variables>;
}

// @public
export interface DataConnectSubscription<Data, Variables> {
// (undocumented)
errCallback?: (e?: FirebaseError) => void;
// (undocumented)
unsubscribe: () => void;
// (undocumented)
userCallback: OnResultSubscription<Data, Variables>;
}

// @public (undocumented)
export type DataSource = typeof SOURCE_CACHE | typeof SOURCE_SERVER;

// @public
export function executeMutation<Data, Variables>(mutationRef: MutationRef<Data, Variables>): MutationPromise<Data, Variables>;

// @public
export function executeQuery<Data, Variables>(queryRef: QueryRef<Data, Variables>): QueryPromise<Data, Variables>;

// @public
export function getDataConnect(options: ConnectorConfig): DataConnect;

// @public
export function getDataConnect(app: FirebaseApp, options: ConnectorConfig): DataConnect;

// @public (undocumented)
export const MUTATION_STR = "mutation";

// @public
export interface MutationPromise<Data, Variables> extends PromiseLike<MutationResult<Data, Variables>> {
}

// @public (undocumented)
export interface MutationRef<Data, Variables> extends OperationRef<Data, Variables> {
// (undocumented)
refType: typeof MUTATION_STR;
}

// @public
export function mutationRef<Data>(dcInstance: DataConnect, mutationName: string): MutationRef<Data, undefined>;

// @public (undocumented)
export function mutationRef<Data, Variables>(dcInstance: DataConnect, mutationName: string, variables: Variables): MutationRef<Data, Variables>;

// @public
export interface MutationResult<Data, Variables> extends DataConnectResult<Data, Variables> {
// (undocumented)
ref: MutationRef<Data, Variables>;
}

// @public
export type OnCompleteSubscription = () => void;

// @public
export type OnErrorSubscription = (err?: FirebaseError) => void;

// @public
export type OnResultSubscription<Data, Variables> = (res: QueryResult<Data, Variables>) => void;

// @public (undocumented)
export interface OperationRef<_Data, Variables> {
// (undocumented)
dataConnect: DataConnect;
// (undocumented)
name: string;
// (undocumented)
refType: ReferenceType;
// (undocumented)
variables: Variables;
}

// @public (undocumented)
export interface OpResult<Data> {
// (undocumented)
data: Data;
// (undocumented)
fetchTime: string;
// (undocumented)
source: DataSource;
}

// @public (undocumented)
export const QUERY_STR = "query";

// @public
export interface QueryPromise<Data, Variables> extends PromiseLike<QueryResult<Data, Variables>> {
}

// @public
export interface QueryRef<Data, Variables> extends OperationRef<Data, Variables> {
// (undocumented)
refType: typeof QUERY_STR;
}

// @public
export function queryRef<Data>(dcInstance: DataConnect, queryName: string): QueryRef<Data, undefined>;

// @public
export function queryRef<Data, Variables>(dcInstance: DataConnect, queryName: string, variables: Variables): QueryRef<Data, Variables>;

// @public
export interface QueryResult<Data, Variables> extends DataConnectResult<Data, Variables> {
// (undocumented)
ref: QueryRef<Data, Variables>;
// (undocumented)
toJSON: () => SerializedRef<Data, Variables>;
}

// @public
export type QueryUnsubscribe = () => void;

// @public (undocumented)
export type ReferenceType = typeof QUERY_STR | typeof MUTATION_STR;

// @public
export interface RefInfo<Variables> {
// (undocumented)
connectorConfig: DataConnectOptions;
// (undocumented)
name: string;
// (undocumented)
variables: Variables;
}

// @public
export interface SerializedRef<Data, Variables> extends OpResult<Data> {
// (undocumented)
refInfo: RefInfo<Variables>;
}

// @public (undocumented)
export function setLogLevel(logLevel: LogLevelString): void;

// @public (undocumented)
export const SOURCE_CACHE = "CACHE";

// @public (undocumented)
export const SOURCE_SERVER = "SERVER";

// @public
export function subscribe<Data, Variables>(queryRefOrSerializedResult: QueryRef<Data, Variables> | SerializedRef<Data, Variables>, observer: SubscriptionOptions<Data, Variables>): QueryUnsubscribe;

// @public
export function subscribe<Data, Variables>(queryRefOrSerializedResult: QueryRef<Data, Variables> | SerializedRef<Data, Variables>, onNext: OnResultSubscription<Data, Variables>, onError?: OnErrorSubscription, onComplete?: OnCompleteSubscription): QueryUnsubscribe;

// @public
export interface SubscriptionOptions<Data, Variables> {
// (undocumented)
onComplete?: OnCompleteSubscription;
// (undocumented)
onErr?: OnErrorSubscription;
// (undocumented)
onNext?: OnResultSubscription<Data, Variables>;
}

// @public
export function terminate(dataConnect: DataConnect): Promise<void>;

// @public
export function toQueryRef<Data, Variables>(serializedRef: SerializedRef<Data, Variables>): QueryRef<Data, Variables>;

// @public
export interface TransportOptions {
// (undocumented)
host: string;
// (undocumented)
port?: number;
// (undocumented)
sslEnabled?: boolean;
}


```
1 change: 0 additions & 1 deletion common/api-review/firestore-lite.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -494,5 +494,4 @@ export class WriteBatch {
// @public
export function writeBatch(firestore: Firestore): WriteBatch;


```
2 changes: 2 additions & 0 deletions packages/app/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { name as appCheckName } from '../../../packages/app-check/package.json';
import { name as authName } from '../../../packages/auth/package.json';
import { name as authCompatName } from '../../../packages/auth-compat/package.json';
import { name as databaseName } from '../../../packages/database/package.json';
import { name as dataconnectName } from '../../../packages/data-connect/package.json';
import { name as databaseCompatName } from '../../../packages/database-compat/package.json';
import { name as functionsName } from '../../../packages/functions/package.json';
import { name as functionsCompatName } from '../../../packages/functions-compat/package.json';
Expand Down Expand Up @@ -59,6 +60,7 @@ export const PLATFORM_LOG_STRING = {
[authName]: 'fire-auth',
[authCompatName]: 'fire-auth-compat',
[databaseName]: 'fire-rtdb',
[dataconnectName]: 'fire-data-connect',
[databaseCompatName]: 'fire-rtdb-compat',
[functionsName]: 'fire-fn',
[functionsCompatName]: 'fire-fn-compat',
Expand Down
88 changes: 88 additions & 0 deletions packages/data-connect/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
/**
* @license
* Copyright 2024 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.eslint.json',
// to make vscode-eslint work with monorepo
// https://github.com/typescript-eslint/typescript-eslint/issues/251#issuecomment-463943250
tsconfigRootDir: __dirname
},
plugins: ['import'],
ignorePatterns: ['compat/*'],
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'
}
}
]
};
3 changes: 3 additions & 0 deletions packages/data-connect/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/
dist/
*.tgz
5 changes: 5 additions & 0 deletions packages/data-connect/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules/
rollup.config.mjs
package-lock.json
tsconfig.json
src/
Loading

0 comments on commit beaa4df

Please sign in to comment.