@firebase/data-connect 0.4.0-canary.792c61671 → 0.4.0-canary.843a8d789
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 -7
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +62 -8
- package/dist/index.esm.js.map +1 -1
- package/dist/index.node.cjs.js +62 -7
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/internal.d.ts +31 -4
- package/dist/node-esm/index.node.esm.js +62 -8
- 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/index.cjs.js
CHANGED
|
@@ -8,7 +8,7 @@ var util = require('@firebase/util');
|
|
|
8
8
|
var logger$1 = require('@firebase/logger');
|
|
9
9
|
|
|
10
10
|
const name = "@firebase/data-connect";
|
|
11
|
-
const version = "0.4.0-canary.
|
|
11
|
+
const version = "0.4.0-canary.843a8d789";
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* @license
|
|
@@ -1948,19 +1948,25 @@ function toQueryRef(serializedRef) {
|
|
|
1948
1948
|
* limitations under the License.
|
|
1949
1949
|
*/
|
|
1950
1950
|
/**
|
|
1951
|
-
* The generated SDK will allow the user to pass in either the
|
|
1952
|
-
*
|
|
1951
|
+
* The generated SDK will allow the user to pass in either the variables or the data connect instance
|
|
1952
|
+
* with the variables. This function validates the variables and returns back the DataConnect instance
|
|
1953
|
+
* and variables based on the arguments passed in.
|
|
1954
|
+
*
|
|
1955
|
+
* Generated SDKs generated from versions 3.2.0 and lower of the Data Connect emulator binary are
|
|
1956
|
+
* NOT concerned with options, and will use this function to validate arguments.
|
|
1957
|
+
*
|
|
1953
1958
|
* @param connectorConfig
|
|
1954
1959
|
* @param dcOrVars
|
|
1955
1960
|
* @param vars
|
|
1956
|
-
* @param
|
|
1961
|
+
* @param variablesRequired
|
|
1957
1962
|
* @returns {DataConnect} and {Variables} instance
|
|
1958
1963
|
* @internal
|
|
1959
1964
|
*/
|
|
1960
|
-
function validateArgs(connectorConfig, dcOrVars, vars,
|
|
1965
|
+
function validateArgs(connectorConfig, dcOrVars, vars, variablesRequired) {
|
|
1961
1966
|
let dcInstance;
|
|
1962
1967
|
let realVars;
|
|
1963
|
-
|
|
1968
|
+
const dcFirstArg = dcOrVars && 'enableEmulator' in dcOrVars;
|
|
1969
|
+
if (dcFirstArg) {
|
|
1964
1970
|
dcInstance = dcOrVars;
|
|
1965
1971
|
realVars = vars;
|
|
1966
1972
|
}
|
|
@@ -1968,11 +1974,59 @@ function validateArgs(connectorConfig, dcOrVars, vars, validateVars) {
|
|
|
1968
1974
|
dcInstance = getDataConnect(connectorConfig);
|
|
1969
1975
|
realVars = dcOrVars;
|
|
1970
1976
|
}
|
|
1971
|
-
if (!dcInstance || (!realVars &&
|
|
1977
|
+
if (!dcInstance || (!realVars && variablesRequired)) {
|
|
1972
1978
|
throw new DataConnectError(Code.INVALID_ARGUMENT, 'Variables required.');
|
|
1973
1979
|
}
|
|
1974
1980
|
return { dc: dcInstance, vars: realVars };
|
|
1975
1981
|
}
|
|
1982
|
+
/**
|
|
1983
|
+
* The generated SDK will allow the user to pass in either the variables or the data connect instance
|
|
1984
|
+
* with the variables, and/or options. This function validates the variables and returns back the
|
|
1985
|
+
* DataConnect instance and variables, and potentially options, based on the arguments passed in.
|
|
1986
|
+
*
|
|
1987
|
+
* Generated SDKs generated from versions 3.2.0 and higher of the Data Connect emulator binary are
|
|
1988
|
+
* in fact concerned with options, and will use this function to validate arguments.
|
|
1989
|
+
*
|
|
1990
|
+
* @param connectorConfig
|
|
1991
|
+
* @param dcOrVarsOrOptions
|
|
1992
|
+
* @param varsOrOptions
|
|
1993
|
+
* @param variablesRequired
|
|
1994
|
+
* @param options
|
|
1995
|
+
* @returns {DataConnect} and {Variables} instance, and optionally {ExecuteQueryOptions}
|
|
1996
|
+
* @internal
|
|
1997
|
+
*/
|
|
1998
|
+
function validateArgsWithOptions(connectorConfig, dcOrVarsOrOptions, varsOrOptions, options, hasVars, variablesRequired) {
|
|
1999
|
+
let dcInstance;
|
|
2000
|
+
let realVars;
|
|
2001
|
+
let realOptions;
|
|
2002
|
+
const dcFirstArg = dcOrVarsOrOptions && 'enableEmulator' in dcOrVarsOrOptions;
|
|
2003
|
+
if (dcFirstArg) {
|
|
2004
|
+
dcInstance = dcOrVarsOrOptions;
|
|
2005
|
+
if (hasVars) {
|
|
2006
|
+
realVars = varsOrOptions;
|
|
2007
|
+
realOptions = options;
|
|
2008
|
+
}
|
|
2009
|
+
else {
|
|
2010
|
+
realVars = undefined;
|
|
2011
|
+
realOptions = varsOrOptions;
|
|
2012
|
+
}
|
|
2013
|
+
}
|
|
2014
|
+
else {
|
|
2015
|
+
dcInstance = getDataConnect(connectorConfig);
|
|
2016
|
+
if (hasVars) {
|
|
2017
|
+
realVars = dcOrVarsOrOptions;
|
|
2018
|
+
realOptions = varsOrOptions;
|
|
2019
|
+
}
|
|
2020
|
+
else {
|
|
2021
|
+
realVars = undefined;
|
|
2022
|
+
realOptions = dcOrVarsOrOptions;
|
|
2023
|
+
}
|
|
2024
|
+
}
|
|
2025
|
+
if (!dcInstance || (!realVars && variablesRequired)) {
|
|
2026
|
+
throw new DataConnectError(Code.INVALID_ARGUMENT, 'Variables required.');
|
|
2027
|
+
}
|
|
2028
|
+
return { dc: dcInstance, vars: realVars, options: realOptions };
|
|
2029
|
+
}
|
|
1976
2030
|
|
|
1977
2031
|
/**
|
|
1978
2032
|
* @license
|
|
@@ -2064,5 +2118,6 @@ exports.subscribe = subscribe;
|
|
|
2064
2118
|
exports.terminate = terminate;
|
|
2065
2119
|
exports.toQueryRef = toQueryRef;
|
|
2066
2120
|
exports.validateArgs = validateArgs;
|
|
2121
|
+
exports.validateArgsWithOptions = validateArgsWithOptions;
|
|
2067
2122
|
exports.validateDCOptions = validateDCOptions;
|
|
2068
2123
|
//# sourceMappingURL=index.cjs.js.map
|