@firebase/data-connect 0.4.0 → 0.5.0
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 +4 -4
package/dist/index.node.cjs.js
CHANGED
|
@@ -240,7 +240,7 @@ function getErrorMessage(obj) {
|
|
|
240
240
|
}
|
|
241
241
|
|
|
242
242
|
const name = "@firebase/data-connect";
|
|
243
|
-
const version = "0.
|
|
243
|
+
const version = "0.5.0";
|
|
244
244
|
|
|
245
245
|
/**
|
|
246
246
|
* @license
|
|
@@ -1718,7 +1718,6 @@ function connectDataConnectEmulator(dc, host, port, sslEnabled = false) {
|
|
|
1718
1718
|
// Workaround to get cookies in Firebase Studio
|
|
1719
1719
|
if (util.isCloudWorkstation(host)) {
|
|
1720
1720
|
void util.pingServer(`https://${host}${port ? `:${port}` : ''}`);
|
|
1721
|
-
util.updateEmulatorBanner('Data Connect', true);
|
|
1722
1721
|
}
|
|
1723
1722
|
dc.enableEmulator({ host, port, sslEnabled });
|
|
1724
1723
|
}
|
|
@@ -1952,19 +1951,25 @@ function toQueryRef(serializedRef) {
|
|
|
1952
1951
|
* limitations under the License.
|
|
1953
1952
|
*/
|
|
1954
1953
|
/**
|
|
1955
|
-
* The generated SDK will allow the user to pass in either the
|
|
1956
|
-
*
|
|
1954
|
+
* The generated SDK will allow the user to pass in either the variables or the data connect instance
|
|
1955
|
+
* with the variables. This function validates the variables and returns back the DataConnect instance
|
|
1956
|
+
* and variables based on the arguments passed in.
|
|
1957
|
+
*
|
|
1958
|
+
* Generated SDKs generated from versions 3.2.0 and lower of the Data Connect emulator binary are
|
|
1959
|
+
* NOT concerned with options, and will use this function to validate arguments.
|
|
1960
|
+
*
|
|
1957
1961
|
* @param connectorConfig
|
|
1958
1962
|
* @param dcOrVars
|
|
1959
1963
|
* @param vars
|
|
1960
|
-
* @param
|
|
1964
|
+
* @param variablesRequired
|
|
1961
1965
|
* @returns {DataConnect} and {Variables} instance
|
|
1962
1966
|
* @internal
|
|
1963
1967
|
*/
|
|
1964
|
-
function validateArgs(connectorConfig, dcOrVars, vars,
|
|
1968
|
+
function validateArgs(connectorConfig, dcOrVars, vars, variablesRequired) {
|
|
1965
1969
|
let dcInstance;
|
|
1966
1970
|
let realVars;
|
|
1967
|
-
|
|
1971
|
+
const dcFirstArg = dcOrVars && 'enableEmulator' in dcOrVars;
|
|
1972
|
+
if (dcFirstArg) {
|
|
1968
1973
|
dcInstance = dcOrVars;
|
|
1969
1974
|
realVars = vars;
|
|
1970
1975
|
}
|
|
@@ -1972,11 +1977,59 @@ function validateArgs(connectorConfig, dcOrVars, vars, validateVars) {
|
|
|
1972
1977
|
dcInstance = getDataConnect(connectorConfig);
|
|
1973
1978
|
realVars = dcOrVars;
|
|
1974
1979
|
}
|
|
1975
|
-
if (!dcInstance || (!realVars &&
|
|
1980
|
+
if (!dcInstance || (!realVars && variablesRequired)) {
|
|
1976
1981
|
throw new DataConnectError(Code.INVALID_ARGUMENT, 'Variables required.');
|
|
1977
1982
|
}
|
|
1978
1983
|
return { dc: dcInstance, vars: realVars };
|
|
1979
1984
|
}
|
|
1985
|
+
/**
|
|
1986
|
+
* The generated SDK will allow the user to pass in either the variables or the data connect instance
|
|
1987
|
+
* with the variables, and/or options. This function validates the variables and returns back the
|
|
1988
|
+
* DataConnect instance and variables, and potentially options, based on the arguments passed in.
|
|
1989
|
+
*
|
|
1990
|
+
* Generated SDKs generated from versions 3.2.0 and higher of the Data Connect emulator binary are
|
|
1991
|
+
* in fact concerned with options, and will use this function to validate arguments.
|
|
1992
|
+
*
|
|
1993
|
+
* @param connectorConfig
|
|
1994
|
+
* @param dcOrVarsOrOptions
|
|
1995
|
+
* @param varsOrOptions
|
|
1996
|
+
* @param variablesRequired
|
|
1997
|
+
* @param options
|
|
1998
|
+
* @returns {DataConnect} and {Variables} instance, and optionally {ExecuteQueryOptions}
|
|
1999
|
+
* @internal
|
|
2000
|
+
*/
|
|
2001
|
+
function validateArgsWithOptions(connectorConfig, dcOrVarsOrOptions, varsOrOptions, options, hasVars, variablesRequired) {
|
|
2002
|
+
let dcInstance;
|
|
2003
|
+
let realVars;
|
|
2004
|
+
let realOptions;
|
|
2005
|
+
const dcFirstArg = dcOrVarsOrOptions && 'enableEmulator' in dcOrVarsOrOptions;
|
|
2006
|
+
if (dcFirstArg) {
|
|
2007
|
+
dcInstance = dcOrVarsOrOptions;
|
|
2008
|
+
if (hasVars) {
|
|
2009
|
+
realVars = varsOrOptions;
|
|
2010
|
+
realOptions = options;
|
|
2011
|
+
}
|
|
2012
|
+
else {
|
|
2013
|
+
realVars = undefined;
|
|
2014
|
+
realOptions = varsOrOptions;
|
|
2015
|
+
}
|
|
2016
|
+
}
|
|
2017
|
+
else {
|
|
2018
|
+
dcInstance = getDataConnect(connectorConfig);
|
|
2019
|
+
if (hasVars) {
|
|
2020
|
+
realVars = dcOrVarsOrOptions;
|
|
2021
|
+
realOptions = varsOrOptions;
|
|
2022
|
+
}
|
|
2023
|
+
else {
|
|
2024
|
+
realVars = undefined;
|
|
2025
|
+
realOptions = dcOrVarsOrOptions;
|
|
2026
|
+
}
|
|
2027
|
+
}
|
|
2028
|
+
if (!dcInstance || (!realVars && variablesRequired)) {
|
|
2029
|
+
throw new DataConnectError(Code.INVALID_ARGUMENT, 'Variables required.');
|
|
2030
|
+
}
|
|
2031
|
+
return { dc: dcInstance, vars: realVars, options: realOptions };
|
|
2032
|
+
}
|
|
1980
2033
|
|
|
1981
2034
|
/**
|
|
1982
2035
|
* @license
|
|
@@ -2080,5 +2133,6 @@ exports.subscribe = subscribe;
|
|
|
2080
2133
|
exports.terminate = terminate;
|
|
2081
2134
|
exports.toQueryRef = toQueryRef;
|
|
2082
2135
|
exports.validateArgs = validateArgs;
|
|
2136
|
+
exports.validateArgsWithOptions = validateArgsWithOptions;
|
|
2083
2137
|
exports.validateDCOptions = validateDCOptions;
|
|
2084
2138
|
//# sourceMappingURL=index.node.cjs.js.map
|