@firebase/data-connect 0.4.0 → 0.5.0-20260317152345

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 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";
11
+ const version = "0.5.0-20260317152345";
12
12
 
13
13
  /**
14
14
  * @license
@@ -1715,7 +1715,6 @@ function connectDataConnectEmulator(dc, host, port, sslEnabled = false) {
1715
1715
  // Workaround to get cookies in Firebase Studio
1716
1716
  if (util.isCloudWorkstation(host)) {
1717
1717
  void util.pingServer(`https://${host}${port ? `:${port}` : ''}`);
1718
- util.updateEmulatorBanner('Data Connect', true);
1719
1718
  }
1720
1719
  dc.enableEmulator({ host, port, sslEnabled });
1721
1720
  }
@@ -1949,19 +1948,25 @@ function toQueryRef(serializedRef) {
1949
1948
  * limitations under the License.
1950
1949
  */
1951
1950
  /**
1952
- * The generated SDK will allow the user to pass in either the variable or the data connect instance with the variable,
1953
- * and this function validates the variables and returns back the DataConnect instance and variables based on the arguments passed in.
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
+ *
1954
1958
  * @param connectorConfig
1955
1959
  * @param dcOrVars
1956
1960
  * @param vars
1957
- * @param validateVars
1961
+ * @param variablesRequired
1958
1962
  * @returns {DataConnect} and {Variables} instance
1959
1963
  * @internal
1960
1964
  */
1961
- function validateArgs(connectorConfig, dcOrVars, vars, validateVars) {
1965
+ function validateArgs(connectorConfig, dcOrVars, vars, variablesRequired) {
1962
1966
  let dcInstance;
1963
1967
  let realVars;
1964
- if (dcOrVars && 'enableEmulator' in dcOrVars) {
1968
+ const dcFirstArg = dcOrVars && 'enableEmulator' in dcOrVars;
1969
+ if (dcFirstArg) {
1965
1970
  dcInstance = dcOrVars;
1966
1971
  realVars = vars;
1967
1972
  }
@@ -1969,11 +1974,59 @@ function validateArgs(connectorConfig, dcOrVars, vars, validateVars) {
1969
1974
  dcInstance = getDataConnect(connectorConfig);
1970
1975
  realVars = dcOrVars;
1971
1976
  }
1972
- if (!dcInstance || (!realVars && validateVars)) {
1977
+ if (!dcInstance || (!realVars && variablesRequired)) {
1973
1978
  throw new DataConnectError(Code.INVALID_ARGUMENT, 'Variables required.');
1974
1979
  }
1975
1980
  return { dc: dcInstance, vars: realVars };
1976
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
+ }
1977
2030
 
1978
2031
  /**
1979
2032
  * @license
@@ -2065,5 +2118,6 @@ exports.subscribe = subscribe;
2065
2118
  exports.terminate = terminate;
2066
2119
  exports.toQueryRef = toQueryRef;
2067
2120
  exports.validateArgs = validateArgs;
2121
+ exports.validateArgsWithOptions = validateArgsWithOptions;
2068
2122
  exports.validateDCOptions = validateDCOptions;
2069
2123
  //# sourceMappingURL=index.cjs.js.map