Deployed the page to Github Pages.

This commit is contained in:
Batuhan Berk Başoğlu 2024-11-03 21:30:09 -05:00
parent 1d79754e93
commit 2c89899458
Signed by: batuhan-basoglu
SSH key fingerprint: SHA256:kEsnuHX+qbwhxSAXPUQ4ox535wFHu/hIRaa53FzxRpo
62797 changed files with 6551425 additions and 15279 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1 @@
{"type":"module"}

View file

@ -0,0 +1,34 @@
/**
* @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.
*/
import { OnCompleteSubscription, OnErrorSubscription, OnResultSubscription, QueryRef, QueryUnsubscribe, SubscriptionOptions } from './api/query';
import { SerializedRef } from './api/Reference';
/**
* Subscribe to a `QueryRef`
* @param queryRefOrSerializedResult query ref or serialized result.
* @param observer observer object to use for subscribing.
* @returns `SubscriptionOptions`
*/
export declare function subscribe<Data, Variables>(queryRefOrSerializedResult: QueryRef<Data, Variables> | SerializedRef<Data, Variables>, observer: SubscriptionOptions<Data, Variables>): QueryUnsubscribe;
/**
* Subscribe to a `QueryRef`
* @param queryRefOrSerializedResult query ref or serialized result.
* @param onNext Callback to call when result comes back.
* @param onError Callback to call when error gets thrown.
* @param onComplete Called when subscription completes.
* @returns `SubscriptionOptions`
*/
export declare function subscribe<Data, Variables>(queryRefOrSerializedResult: QueryRef<Data, Variables> | SerializedRef<Data, Variables>, onNext: OnResultSubscription<Data, Variables>, onError?: OnErrorSubscription, onComplete?: OnCompleteSubscription): QueryUnsubscribe;

View file

@ -0,0 +1,17 @@
/**
* @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.
*/
export { subscribe } from './api.browser';

View file

@ -0,0 +1,108 @@
/**
* @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.
*/
import { FirebaseApp } from '@firebase/app';
import { AppCheckInternalComponentName } from '@firebase/app-check-interop-types';
import { FirebaseAuthInternalName } from '@firebase/auth-interop-types';
import { Provider } from '@firebase/component';
import { QueryManager } from '../core/QueryManager';
import { MutationManager } from './Mutation';
/**
* Connector Config for calling Data Connect backend.
*/
export interface ConnectorConfig {
location: string;
connector: string;
service: string;
}
/**
* Options to connect to emulator
*/
export interface TransportOptions {
host: string;
sslEnabled?: boolean;
port?: number;
}
/**
*
* @param fullHost
* @returns TransportOptions
* @internal
*/
export declare function parseOptions(fullHost: string): TransportOptions;
/**
* DataConnectOptions including project id
*/
export interface DataConnectOptions extends ConnectorConfig {
projectId: string;
}
/**
* Class representing Firebase Data Connect
*/
export declare class DataConnect {
readonly app: FirebaseApp;
private readonly dataConnectOptions;
private readonly _authProvider;
private readonly _appCheckProvider;
_queryManager: QueryManager;
_mutationManager: MutationManager;
isEmulator: boolean;
_initialized: boolean;
private _transport;
private _transportClass;
private _transportOptions?;
private _authTokenProvider?;
_isUsingGeneratedSdk: boolean;
private _appCheckTokenProvider?;
constructor(app: FirebaseApp, dataConnectOptions: DataConnectOptions, _authProvider: Provider<FirebaseAuthInternalName>, _appCheckProvider: Provider<AppCheckInternalComponentName>);
_useGeneratedSdk(): void;
_delete(): Promise<void>;
getSettings(): ConnectorConfig;
setInitialized(): void;
enableEmulator(transportOptions: TransportOptions): void;
}
/**
* Connect to the DataConnect Emulator
* @param dc Data Connect instance
* @param host host of emulator server
* @param port port of emulator server
* @param sslEnabled use https
*/
export declare function connectDataConnectEmulator(dc: DataConnect, host: string, port?: number, sslEnabled?: boolean): void;
/**
* Initialize DataConnect instance
* @param options ConnectorConfig
*/
export declare function getDataConnect(options: ConnectorConfig): DataConnect;
/**
* Initialize DataConnect instance
* @param app FirebaseApp to initialize to.
* @param options ConnectorConfig
*/
export declare function getDataConnect(app: FirebaseApp, options: ConnectorConfig): DataConnect;
/**
*
* @param dcOptions
* @returns {void}
* @internal
*/
export declare function validateDCOptions(dcOptions: ConnectorConfig): boolean;
/**
* Delete DataConnect instance
* @param dataConnect DataConnect instance
* @returns
*/
export declare function terminate(dataConnect: DataConnect): Promise<void>;

View file

@ -0,0 +1,61 @@
/**
* @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.
*/
import { DataConnectTransport } from '../network/transport';
import { DataConnect } from './DataConnect';
import { DataConnectResult, MUTATION_STR, OperationRef } from './Reference';
export interface MutationRef<Data, Variables> extends OperationRef<Data, Variables> {
refType: typeof MUTATION_STR;
}
/**
* Creates a `MutationRef`
* @param dcInstance Data Connect instance
* @param mutationName name of mutation
*/
export declare function mutationRef<Data>(dcInstance: DataConnect, mutationName: string): MutationRef<Data, undefined>;
/**
*
* @param dcInstance Data Connect instance
* @param mutationName name of mutation
* @param variables variables to send with mutation
*/
export declare function mutationRef<Data, Variables>(dcInstance: DataConnect, mutationName: string, variables: Variables): MutationRef<Data, Variables>;
/**
* @internal
*/
export declare class MutationManager {
private _transport;
private _inflight;
constructor(_transport: DataConnectTransport);
executeMutation<Data, Variables>(mutationRef: MutationRef<Data, Variables>): MutationPromise<Data, Variables>;
}
/**
* Mutation Result from `executeMutation`
*/
export interface MutationResult<Data, Variables> extends DataConnectResult<Data, Variables> {
ref: MutationRef<Data, Variables>;
}
/**
* Mutation return value from `executeMutation`
*/
export interface MutationPromise<Data, Variables> extends PromiseLike<MutationResult<Data, Variables>> {
}
/**
* Execute Mutation
* @param mutationRef mutation to execute
* @returns `MutationRef`
*/
export declare function executeMutation<Data, Variables>(mutationRef: MutationRef<Data, Variables>): MutationPromise<Data, Variables>;

View file

@ -0,0 +1,51 @@
/**
* @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.
*/
import { DataConnect, DataConnectOptions } from './DataConnect';
export declare const QUERY_STR = "query";
export declare const MUTATION_STR = "mutation";
export declare type ReferenceType = typeof QUERY_STR | typeof MUTATION_STR;
export declare const SOURCE_SERVER = "SERVER";
export declare const SOURCE_CACHE = "CACHE";
export declare type DataSource = typeof SOURCE_CACHE | typeof SOURCE_SERVER;
export interface OpResult<Data> {
data: Data;
source: DataSource;
fetchTime: string;
}
export interface OperationRef<_Data, Variables> {
name: string;
variables: Variables;
refType: ReferenceType;
dataConnect: DataConnect;
}
export interface DataConnectResult<Data, Variables> extends OpResult<Data> {
ref: OperationRef<Data, Variables>;
}
/**
* Serialized RefInfo as a result of `QueryResult.toJSON().refInfo`
*/
export interface RefInfo<Variables> {
name: string;
variables: Variables;
connectorConfig: DataConnectOptions;
}
/**
* Serialized Ref as a result of `QueryResult.toJSON()`
*/
export interface SerializedRef<Data, Variables> extends OpResult<Data> {
refInfo: RefInfo<Variables>;
}

View file

@ -0,0 +1,23 @@
/**
* @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.
*/
export * from '../network';
export * from './DataConnect';
export * from './Reference';
export * from './Mutation';
export * from './query';
export { setLogLevel } from '../logger';
export { validateArgs } from '../util/validateArgs';

View file

@ -0,0 +1,96 @@
/**
* @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.
*/
import { DataConnectError } from '../core/error';
import { DataConnect } from './DataConnect';
import { OperationRef, QUERY_STR, DataConnectResult, SerializedRef } from './Reference';
/**
* Signature for `OnResultSubscription` for `subscribe`
*/
export declare type OnResultSubscription<Data, Variables> = (res: QueryResult<Data, Variables>) => void;
/**
* Signature for `OnErrorSubscription` for `subscribe`
*/
export declare type OnErrorSubscription = (err?: DataConnectError) => void;
/**
* Signature for unsubscribe from `subscribe`
*/
export declare type QueryUnsubscribe = () => void;
/**
* Representation of user provided subscription options.
*/
export interface DataConnectSubscription<Data, Variables> {
userCallback: OnResultSubscription<Data, Variables>;
errCallback?: (e?: DataConnectError) => void;
unsubscribe: () => void;
}
/**
* QueryRef object
*/
export interface QueryRef<Data, Variables> extends OperationRef<Data, Variables> {
refType: typeof QUERY_STR;
}
/**
* Result of `executeQuery`
*/
export interface QueryResult<Data, Variables> extends DataConnectResult<Data, Variables> {
ref: QueryRef<Data, Variables>;
toJSON: () => SerializedRef<Data, Variables>;
}
/**
* Promise returned from `executeQuery`
*/
export interface QueryPromise<Data, Variables> extends PromiseLike<QueryResult<Data, Variables>> {
}
/**
* Execute Query
* @param queryRef query to execute.
* @returns `QueryPromise`
*/
export declare function executeQuery<Data, Variables>(queryRef: QueryRef<Data, Variables>): QueryPromise<Data, Variables>;
/**
* Execute Query
* @param dcInstance Data Connect instance to use.
* @param queryName Query to execute
* @returns `QueryRef`
*/
export declare function queryRef<Data>(dcInstance: DataConnect, queryName: string): QueryRef<Data, undefined>;
/**
* Execute Query
* @param dcInstance Data Connect instance to use.
* @param queryName Query to execute
* @param variables Variables to execute with
* @returns `QueryRef`
*/
export declare function queryRef<Data, Variables>(dcInstance: DataConnect, queryName: string, variables: Variables): QueryRef<Data, Variables>;
/**
* Converts serialized ref to query ref
* @param serializedRef ref to convert to `QueryRef`
* @returns `QueryRef`
*/
export declare function toQueryRef<Data, Variables>(serializedRef: SerializedRef<Data, Variables>): QueryRef<Data, Variables>;
/**
* `OnCompleteSubscription`
*/
export declare type OnCompleteSubscription = () => void;
/**
* Representation of full observer options in `subscribe`
*/
export interface SubscriptionOptions<Data, Variables> {
onNext?: OnResultSubscription<Data, Variables>;
onErr?: OnErrorSubscription;
onComplete?: OnCompleteSubscription;
}

View file

@ -0,0 +1,30 @@
/**
* @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.
*/
import { AppCheckInternalComponentName, AppCheckTokenListener, AppCheckTokenResult } from '@firebase/app-check-interop-types';
import { Provider } from '@firebase/component';
/**
* @internal
* Abstraction around AppCheck's token fetching capabilities.
*/
export declare class AppCheckTokenProvider {
private appName_;
private appCheckProvider?;
private appCheck?;
constructor(appName_: string, appCheckProvider?: Provider<AppCheckInternalComponentName>);
getToken(forceRefresh?: boolean): Promise<AppCheckTokenResult>;
addTokenChangeListener(listener: AppCheckTokenListener): void;
}

View file

@ -0,0 +1,34 @@
/**
* @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.
*/
import { FirebaseOptions } from '@firebase/app-types';
import { FirebaseAuthInternalName, FirebaseAuthTokenData } from '@firebase/auth-interop-types';
import { Provider } from '@firebase/component';
export interface AuthTokenProvider {
getToken(forceRefresh: boolean): Promise<FirebaseAuthTokenData | null>;
addTokenChangeListener(listener: AuthTokenListener): void;
}
export declare type AuthTokenListener = (token: string | null) => void;
export declare class FirebaseAuthProvider implements AuthTokenProvider {
private _appName;
private _options;
private _authProvider;
private _auth;
constructor(_appName: string, _options: FirebaseOptions, _authProvider: Provider<FirebaseAuthInternalName>);
getToken(forceRefresh: boolean): Promise<FirebaseAuthTokenData | null>;
addTokenChangeListener(listener: AuthTokenListener): void;
removeTokenChangeListener(listener: (token: string | null) => void): void;
}

View file

@ -0,0 +1,36 @@
/**
* @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.
*/
import { DataConnectSubscription, OnErrorSubscription, OnResultSubscription, QueryPromise, QueryRef } from '../api/query';
import { OperationRef, OpResult } from '../api/Reference';
import { DataConnectTransport } from '../network';
import { DataConnectError } from './error';
interface TrackedQuery<Data, Variables> {
ref: Omit<OperationRef<Data, Variables>, 'dataConnect'>;
subscriptions: Array<DataConnectSubscription<Data, Variables>>;
currentCache: OpResult<Data> | null;
lastError: DataConnectError | null;
}
export declare class QueryManager {
private transport;
_queries: Map<string, TrackedQuery<unknown, unknown>>;
constructor(transport: DataConnectTransport);
track<Data, Variables>(queryName: string, variables: Variables, initialCache?: OpResult<Data>): TrackedQuery<Data, Variables>;
addSubscription<Data, Variables>(queryRef: OperationRef<Data, Variables>, onResultCallback: OnResultSubscription<Data, Variables>, onErrorCallback?: OnErrorSubscription, initialCache?: OpResult<Data>): () => void;
executeQuery<Data, Variables>(queryRef: QueryRef<Data, Variables>): QueryPromise<Data, Variables>;
enableEmulator(host: string, port: number): void;
}
export {};

View file

@ -0,0 +1,51 @@
/**
* @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.
*/
import { FirebaseError } from '@firebase/util';
export declare type DataConnectErrorCode = 'other' | 'already-initialized' | 'not-initialized' | 'not-supported' | 'invalid-argument' | 'partial-error' | 'unauthorized';
export declare type Code = DataConnectErrorCode;
export declare const Code: {
OTHER: DataConnectErrorCode;
ALREADY_INITIALIZED: DataConnectErrorCode;
NOT_INITIALIZED: DataConnectErrorCode;
NOT_SUPPORTED: DataConnectErrorCode;
INVALID_ARGUMENT: DataConnectErrorCode;
PARTIAL_ERROR: DataConnectErrorCode;
UNAUTHORIZED: DataConnectErrorCode;
};
/** An error returned by a DataConnect operation. */
export declare class DataConnectError extends FirebaseError {
/**
* The backend error code associated with this error.
*/
readonly code: DataConnectErrorCode;
/**
* A custom error description.
*/
readonly message: string;
/** The stack of the error. */
readonly stack?: string;
/** @hideconstructor */
constructor(
/**
* The backend error code associated with this error.
*/
code: DataConnectErrorCode,
/**
* A custom error description.
*/
message: string);
}

View file

@ -0,0 +1,23 @@
/**
* @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.
*/
/** The semver (www.semver.org) version of the SDK. */
export declare let SDK_VERSION: string;
/**
* SDK_VERSION should be set before any database instance is created
* @internal
*/
export declare function setSDKVersion(version: string): void;

View file

@ -0,0 +1,29 @@
/**
* Firebase Data Connect
*
* @packageDocumentation
*/
/**
* @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.
*/
import { DataConnect } from './api/DataConnect';
export * from './api';
export * from './api.browser';
declare module '@firebase/component' {
interface NameServiceMapping {
'data-connect': DataConnect;
}
}

View file

@ -0,0 +1,18 @@
/**
* @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.
*/
export * from './api';
export * from './api.node';

View file

@ -0,0 +1,20 @@
/**
* @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.
*/
import { LogLevelString } from '@firebase/logger';
export declare function setLogLevel(logLevel: LogLevelString): void;
export declare function logDebug(msg: string): void;
export declare function logError(msg: string): void;

View file

@ -0,0 +1,21 @@
/**
* @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.
*/
export declare function initializeFetch(fetchImpl: typeof fetch): void;
export declare function dcFetch<T, U>(url: string, body: U, { signal }: AbortController, appId: string | null, accessToken: string | null, appCheckToken: string | null, _isUsingGen: boolean): Promise<{
data: T;
errors: Error[];
}>;

View file

@ -0,0 +1,17 @@
/**
* @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.
*/
export * from './transport';

View file

@ -0,0 +1,43 @@
/**
* @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.
*/
import { DataConnectOptions, TransportOptions } from '../../api/DataConnect';
import { AppCheckTokenProvider } from '../../core/AppCheckTokenProvider';
import { AuthTokenProvider } from '../../core/FirebaseAuthProvider';
/**
* @internal
*/
export interface DataConnectTransport {
invokeQuery<T, U>(queryName: string, body?: U): PromiseLike<{
data: T;
errors: Error[];
}>;
invokeMutation<T, U>(queryName: string, body?: U): PromiseLike<{
data: T;
errors: Error[];
}>;
useEmulator(host: string, port?: number, sslEnabled?: boolean): void;
onTokenChanged: (token: string | null) => void;
}
export interface CancellableOperation<T> extends PromiseLike<{
data: T;
}> {
cancel: () => void;
}
/**
* @internal
*/
export declare type TransportClass = new (options: DataConnectOptions, apiKey?: string, appId?: string, authProvider?: AuthTokenProvider, appCheckProvider?: AppCheckTokenProvider, transportOptions?: TransportOptions, _isUsingGen?: boolean) => DataConnectTransport;

View file

@ -0,0 +1,58 @@
/**
* @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.
*/
import { DataConnectOptions, TransportOptions } from '../../api/DataConnect';
import { AppCheckTokenProvider } from '../../core/AppCheckTokenProvider';
import { AuthTokenProvider } from '../../core/FirebaseAuthProvider';
import { DataConnectTransport } from '.';
export declare class RESTTransport implements DataConnectTransport {
private apiKey?;
private appId?;
private authProvider?;
private appCheckProvider?;
private _isUsingGen;
private _host;
private _port;
private _location;
private _connectorName;
private _secure;
private _project;
private _serviceName;
private _accessToken;
private _appCheckToken;
private _lastToken;
constructor(options: DataConnectOptions, apiKey?: string | undefined, appId?: string, authProvider?: AuthTokenProvider | undefined, appCheckProvider?: AppCheckTokenProvider | undefined, transportOptions?: TransportOptions | undefined, _isUsingGen?: boolean);
get endpointUrl(): string;
useEmulator(host: string, port?: number, isSecure?: boolean): void;
onTokenChanged(newToken: string | null): void;
getWithAuth(forceToken?: boolean): Promise<string>;
_setLastToken(lastToken: string | null): void;
withRetry<T>(promiseFactory: () => Promise<{
data: T;
errors: Error[];
}>, retry?: boolean): Promise<{
data: T;
errors: Error[];
}>;
invokeQuery: <T, U>(queryName: string, body?: U) => PromiseLike<{
data: T;
errors: Error[];
}>;
invokeMutation: <T, U>(queryName: string, body?: U) => PromiseLike<{
data: T;
errors: Error[];
}>;
}

View file

@ -0,0 +1 @@
export declare function registerDataConnect(variant?: string): void;

View file

@ -0,0 +1,19 @@
/**
* @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.
*/
export declare type HmacImpl = (obj: unknown) => string;
export declare let encoderImpl: HmacImpl;
export declare function setEncoder(encoder: HmacImpl): void;

View file

@ -0,0 +1,17 @@
/**
* @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.
*/
export declare function setIfNotExists<T>(map: Map<string, T>, key: string, val: T): void;

View file

@ -0,0 +1,19 @@
/**
* @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.
*/
import { DataConnectOptions, TransportOptions } from '../api/DataConnect';
export declare function urlBuilder(projectConfig: DataConnectOptions, transportOptions: TransportOptions): string;
export declare function addToken(url: string, apiKey?: string): string;

View file

@ -0,0 +1,33 @@
/**
* @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.
*/
import { ConnectorConfig, DataConnect } from '../api/DataConnect';
interface ParsedArgs<Variables> {
dc: DataConnect;
vars: Variables;
}
/**
* The generated SDK will allow the user to pass in either the variable or the data connect instance with the variable,
* and this function validates the variables and returns back the DataConnect instance and variables based on the arguments passed in.
* @param connectorConfig
* @param dcOrVars
* @param vars
* @param validateVars
* @returns {DataConnect} and {Variables} instance
* @internal
*/
export declare function validateArgs<Variables extends object>(connectorConfig: ConnectorConfig, dcOrVars?: DataConnect | Variables, vars?: Variables, validateVars?: boolean): ParsedArgs<Variables>;
export {};