@firebase/data-connect 0.4.0 → 0.5.0-canary.ba0bc39bb
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +62 -8
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +63 -10
- package/dist/index.esm.js.map +1 -1
- package/dist/index.node.cjs.js +62 -8
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/internal.d.ts +31 -4
- package/dist/node-esm/index.node.esm.js +63 -10
- package/dist/node-esm/index.node.esm.js.map +1 -1
- package/dist/node-esm/src/api/index.d.ts +1 -1
- package/dist/node-esm/src/core/query/queryOptions.d.ts +3 -0
- package/dist/node-esm/src/util/validateArgs.d.ts +28 -4
- package/dist/private.d.ts +6 -0
- package/dist/public.d.ts +4 -0
- package/dist/src/api/index.d.ts +1 -1
- package/dist/src/core/query/queryOptions.d.ts +3 -0
- package/dist/src/util/validateArgs.d.ts +28 -4
- package/package.json +7 -7
package/dist/internal.d.ts
CHANGED
|
@@ -342,6 +342,9 @@ export declare function executeMutation<Data, Variables>(mutationRef: MutationRe
|
|
|
342
342
|
*/
|
|
343
343
|
export declare function executeQuery<Data, Variables>(queryRef: QueryRef<Data, Variables>, options?: ExecuteQueryOptions): QueryPromise<Data, Variables>;
|
|
344
344
|
|
|
345
|
+
/**
|
|
346
|
+
* Options for executing a query.
|
|
347
|
+
*/
|
|
345
348
|
export declare interface ExecuteQueryOptions {
|
|
346
349
|
fetchPolicy: QueryFetchPolicy;
|
|
347
350
|
}
|
|
@@ -512,6 +515,7 @@ export declare interface OpResult<Data> {
|
|
|
512
515
|
declare interface ParsedArgs<Variables> {
|
|
513
516
|
dc: DataConnect;
|
|
514
517
|
vars: Variables;
|
|
518
|
+
options?: ExecuteQueryOptions;
|
|
515
519
|
}
|
|
516
520
|
|
|
517
521
|
/**
|
|
@@ -726,16 +730,39 @@ export declare interface TransportOptions {
|
|
|
726
730
|
}
|
|
727
731
|
|
|
728
732
|
/**
|
|
729
|
-
* The generated SDK will allow the user to pass in either the
|
|
730
|
-
*
|
|
733
|
+
* The generated SDK will allow the user to pass in either the variables or the data connect instance
|
|
734
|
+
* with the variables. This function validates the variables and returns back the DataConnect instance
|
|
735
|
+
* and variables based on the arguments passed in.
|
|
736
|
+
*
|
|
737
|
+
* Generated SDKs generated from versions 3.2.0 and lower of the Data Connect emulator binary are
|
|
738
|
+
* NOT concerned with options, and will use this function to validate arguments.
|
|
739
|
+
*
|
|
731
740
|
* @param connectorConfig
|
|
732
741
|
* @param dcOrVars
|
|
733
742
|
* @param vars
|
|
734
|
-
* @param
|
|
743
|
+
* @param variablesRequired
|
|
735
744
|
* @returns {DataConnect} and {Variables} instance
|
|
736
745
|
* @internal
|
|
737
746
|
*/
|
|
738
|
-
export declare function validateArgs<Variables extends object>(connectorConfig: ConnectorConfig, dcOrVars?: DataConnect | Variables, vars?: Variables,
|
|
747
|
+
export declare function validateArgs<Variables extends object>(connectorConfig: ConnectorConfig, dcOrVars?: DataConnect | Variables, vars?: Variables, variablesRequired?: boolean): ParsedArgs<Variables>;
|
|
748
|
+
|
|
749
|
+
/**
|
|
750
|
+
* The generated SDK will allow the user to pass in either the variables or the data connect instance
|
|
751
|
+
* with the variables, and/or options. This function validates the variables and returns back the
|
|
752
|
+
* DataConnect instance and variables, and potentially options, based on the arguments passed in.
|
|
753
|
+
*
|
|
754
|
+
* Generated SDKs generated from versions 3.2.0 and higher of the Data Connect emulator binary are
|
|
755
|
+
* in fact concerned with options, and will use this function to validate arguments.
|
|
756
|
+
*
|
|
757
|
+
* @param connectorConfig
|
|
758
|
+
* @param dcOrVarsOrOptions
|
|
759
|
+
* @param varsOrOptions
|
|
760
|
+
* @param variablesRequired
|
|
761
|
+
* @param options
|
|
762
|
+
* @returns {DataConnect} and {Variables} instance, and optionally {ExecuteQueryOptions}
|
|
763
|
+
* @internal
|
|
764
|
+
*/
|
|
765
|
+
export declare function validateArgsWithOptions<Variables extends object>(connectorConfig: ConnectorConfig, dcOrVarsOrOptions?: DataConnect | Variables | ExecuteQueryOptions, varsOrOptions?: Variables | ExecuteQueryOptions, options?: ExecuteQueryOptions, hasVars?: boolean, variablesRequired?: boolean): ParsedArgs<Variables>;
|
|
739
766
|
|
|
740
767
|
/**
|
|
741
768
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FirebaseError, isCloudWorkstation, generateSHA256Hash, pingServer
|
|
1
|
+
import { FirebaseError, isCloudWorkstation, generateSHA256Hash, pingServer } from '@firebase/util';
|
|
2
2
|
import { Logger } from '@firebase/logger';
|
|
3
3
|
import { _isFirebaseServerApp, _removeServiceInstance, getApp, _getProvider, _registerComponent, registerVersion, SDK_VERSION as SDK_VERSION$1 } from '@firebase/app';
|
|
4
4
|
import { Component } from '@firebase/component';
|
|
@@ -236,7 +236,7 @@ function getErrorMessage(obj) {
|
|
|
236
236
|
}
|
|
237
237
|
|
|
238
238
|
const name = "@firebase/data-connect";
|
|
239
|
-
const version = "0.
|
|
239
|
+
const version = "0.5.0-canary.ba0bc39bb";
|
|
240
240
|
|
|
241
241
|
/**
|
|
242
242
|
* @license
|
|
@@ -1714,7 +1714,6 @@ function connectDataConnectEmulator(dc, host, port, sslEnabled = false) {
|
|
|
1714
1714
|
// Workaround to get cookies in Firebase Studio
|
|
1715
1715
|
if (isCloudWorkstation(host)) {
|
|
1716
1716
|
void pingServer(`https://${host}${port ? `:${port}` : ''}`);
|
|
1717
|
-
updateEmulatorBanner('Data Connect', true);
|
|
1718
1717
|
}
|
|
1719
1718
|
dc.enableEmulator({ host, port, sslEnabled });
|
|
1720
1719
|
}
|
|
@@ -1948,19 +1947,25 @@ function toQueryRef(serializedRef) {
|
|
|
1948
1947
|
* limitations under the License.
|
|
1949
1948
|
*/
|
|
1950
1949
|
/**
|
|
1951
|
-
* The generated SDK will allow the user to pass in either the
|
|
1952
|
-
*
|
|
1950
|
+
* The generated SDK will allow the user to pass in either the variables or the data connect instance
|
|
1951
|
+
* with the variables. This function validates the variables and returns back the DataConnect instance
|
|
1952
|
+
* and variables based on the arguments passed in.
|
|
1953
|
+
*
|
|
1954
|
+
* Generated SDKs generated from versions 3.2.0 and lower of the Data Connect emulator binary are
|
|
1955
|
+
* NOT concerned with options, and will use this function to validate arguments.
|
|
1956
|
+
*
|
|
1953
1957
|
* @param connectorConfig
|
|
1954
1958
|
* @param dcOrVars
|
|
1955
1959
|
* @param vars
|
|
1956
|
-
* @param
|
|
1960
|
+
* @param variablesRequired
|
|
1957
1961
|
* @returns {DataConnect} and {Variables} instance
|
|
1958
1962
|
* @internal
|
|
1959
1963
|
*/
|
|
1960
|
-
function validateArgs(connectorConfig, dcOrVars, vars,
|
|
1964
|
+
function validateArgs(connectorConfig, dcOrVars, vars, variablesRequired) {
|
|
1961
1965
|
let dcInstance;
|
|
1962
1966
|
let realVars;
|
|
1963
|
-
|
|
1967
|
+
const dcFirstArg = dcOrVars && 'enableEmulator' in dcOrVars;
|
|
1968
|
+
if (dcFirstArg) {
|
|
1964
1969
|
dcInstance = dcOrVars;
|
|
1965
1970
|
realVars = vars;
|
|
1966
1971
|
}
|
|
@@ -1968,11 +1973,59 @@ function validateArgs(connectorConfig, dcOrVars, vars, validateVars) {
|
|
|
1968
1973
|
dcInstance = getDataConnect(connectorConfig);
|
|
1969
1974
|
realVars = dcOrVars;
|
|
1970
1975
|
}
|
|
1971
|
-
if (!dcInstance || (!realVars &&
|
|
1976
|
+
if (!dcInstance || (!realVars && variablesRequired)) {
|
|
1972
1977
|
throw new DataConnectError(Code.INVALID_ARGUMENT, 'Variables required.');
|
|
1973
1978
|
}
|
|
1974
1979
|
return { dc: dcInstance, vars: realVars };
|
|
1975
1980
|
}
|
|
1981
|
+
/**
|
|
1982
|
+
* The generated SDK will allow the user to pass in either the variables or the data connect instance
|
|
1983
|
+
* with the variables, and/or options. This function validates the variables and returns back the
|
|
1984
|
+
* DataConnect instance and variables, and potentially options, based on the arguments passed in.
|
|
1985
|
+
*
|
|
1986
|
+
* Generated SDKs generated from versions 3.2.0 and higher of the Data Connect emulator binary are
|
|
1987
|
+
* in fact concerned with options, and will use this function to validate arguments.
|
|
1988
|
+
*
|
|
1989
|
+
* @param connectorConfig
|
|
1990
|
+
* @param dcOrVarsOrOptions
|
|
1991
|
+
* @param varsOrOptions
|
|
1992
|
+
* @param variablesRequired
|
|
1993
|
+
* @param options
|
|
1994
|
+
* @returns {DataConnect} and {Variables} instance, and optionally {ExecuteQueryOptions}
|
|
1995
|
+
* @internal
|
|
1996
|
+
*/
|
|
1997
|
+
function validateArgsWithOptions(connectorConfig, dcOrVarsOrOptions, varsOrOptions, options, hasVars, variablesRequired) {
|
|
1998
|
+
let dcInstance;
|
|
1999
|
+
let realVars;
|
|
2000
|
+
let realOptions;
|
|
2001
|
+
const dcFirstArg = dcOrVarsOrOptions && 'enableEmulator' in dcOrVarsOrOptions;
|
|
2002
|
+
if (dcFirstArg) {
|
|
2003
|
+
dcInstance = dcOrVarsOrOptions;
|
|
2004
|
+
if (hasVars) {
|
|
2005
|
+
realVars = varsOrOptions;
|
|
2006
|
+
realOptions = options;
|
|
2007
|
+
}
|
|
2008
|
+
else {
|
|
2009
|
+
realVars = undefined;
|
|
2010
|
+
realOptions = varsOrOptions;
|
|
2011
|
+
}
|
|
2012
|
+
}
|
|
2013
|
+
else {
|
|
2014
|
+
dcInstance = getDataConnect(connectorConfig);
|
|
2015
|
+
if (hasVars) {
|
|
2016
|
+
realVars = dcOrVarsOrOptions;
|
|
2017
|
+
realOptions = varsOrOptions;
|
|
2018
|
+
}
|
|
2019
|
+
else {
|
|
2020
|
+
realVars = undefined;
|
|
2021
|
+
realOptions = dcOrVarsOrOptions;
|
|
2022
|
+
}
|
|
2023
|
+
}
|
|
2024
|
+
if (!dcInstance || (!realVars && variablesRequired)) {
|
|
2025
|
+
throw new DataConnectError(Code.INVALID_ARGUMENT, 'Variables required.');
|
|
2026
|
+
}
|
|
2027
|
+
return { dc: dcInstance, vars: realVars, options: realOptions };
|
|
2028
|
+
}
|
|
1976
2029
|
|
|
1977
2030
|
/**
|
|
1978
2031
|
* @license
|
|
@@ -2050,5 +2103,5 @@ function subscribe(queryRefOrSerializedResult, observerOrOnNext, onError, onComp
|
|
|
2050
2103
|
initializeFetch(fetch);
|
|
2051
2104
|
registerDataConnect('node');
|
|
2052
2105
|
|
|
2053
|
-
export { CallerSdkTypeEnum, Code, DataConnect, DataConnectError, DataConnectOperationError, MUTATION_STR, MutationManager, QUERY_STR, QueryFetchPolicy, SOURCE_CACHE, SOURCE_SERVER, StorageType, areTransportOptionsEqual, connectDataConnectEmulator, executeMutation, executeQuery, getDataConnect, makeMemoryCacheProvider, mutationRef, parseOptions, queryRef, setLogLevel, subscribe, terminate, toQueryRef, validateArgs, validateDCOptions };
|
|
2106
|
+
export { CallerSdkTypeEnum, Code, DataConnect, DataConnectError, DataConnectOperationError, MUTATION_STR, MutationManager, QUERY_STR, QueryFetchPolicy, SOURCE_CACHE, SOURCE_SERVER, StorageType, areTransportOptionsEqual, connectDataConnectEmulator, executeMutation, executeQuery, getDataConnect, makeMemoryCacheProvider, mutationRef, parseOptions, queryRef, setLogLevel, subscribe, terminate, toQueryRef, validateArgs, validateArgsWithOptions, validateDCOptions };
|
|
2054
2107
|
//# sourceMappingURL=index.node.esm.js.map
|