@dereekb/dbx-cli 14.3.0 → 14.4.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/index.esm.js CHANGED
@@ -1,15 +1,13 @@
1
1
  import { existsSync, mkdirSync, writeFileSync, readFileSync, statSync, appendFileSync } from 'node:fs';
2
2
  import { join, dirname, resolve, sep, basename, relative, posix, isAbsolute, parse } from 'node:path';
3
- import { clientFirebaseFirestoreContextFactory, makeFirestoreCollectionGroup, addOrReplaceLimitInConstraints, CALL_MODEL_OIDC_SCOPES, CALL_MODEL_OIDC_SCOPE_FOR_CALL_TYPE, CALL_MODEL_MISSING_OIDC_SCOPE_ERROR_CODE, CALL_MODEL_OIDC_SCOPE_PREFIX, STORAGE_FILE_UPLOAD_USER_ROLE } from '@dereekb/firebase';
3
+ import { makeFirestoreCollectionGroup, addOrReplaceLimitInConstraints, CALL_MODEL_OIDC_SCOPES, CALL_MODEL_OIDC_SCOPE_FOR_CALL_TYPE, CALL_MODEL_MISSING_OIDC_SCOPE_ERROR_CODE, CALL_MODEL_OIDC_SCOPE_PREFIX, STORAGE_FILE_UPLOAD_USER_ROLE } from '@dereekb/firebase';
4
4
  export { CALL_MODEL_APP_FUNCTION_KEY } from '@dereekb/firebase';
5
5
  import { createRequire } from 'node:module';
6
- import { Firestore, getFirestore, connectFirestoreEmulator } from 'firebase/firestore';
7
- import { getApps, initializeApp, deleteApp } from 'firebase/app';
8
- import { initializeAppCheck, CustomProvider } from 'firebase/app-check';
9
- import { signInWithCustomToken, getAuth, connectAuthEmulator } from 'firebase/auth';
10
- import { expirationDetails, performAsyncTasks, compareStrings, OidcRelyingPartyError, buildAuthorizationUrl as buildAuthorizationUrl$1, parseAuthorizationRedirect, noop, generateOAuthState, MS_IN_SECOND, generatePkceMaterial, isPlainObject as isPlainObject$1, MS_IN_HOUR, asArray, buildOidcDiscoveryCandidates, unique, AUTH_TOS_SIGNED_ROLE, AUTH_ONBOARDED_ROLE, AUTH_ADMIN_ROLE, AUTH_USER_ROLE } from '@dereekb/util';
11
- import { createMemoizedJsonFileAsyncKeyedValueCache, readJsonFile, writeJsonFile, DEFAULT_JSON_FILE_CACHE_MODE, removeFile } from '@dereekb/nestjs';
6
+ import { CLIENT_FIRESTORE_DRIVER_IDENTIFIER, firebaseClientFirestoreIdentitySuggestion, inspectFirebaseClientFirestoreIdentity, fetchFirestoreSession as fetchFirestoreSession$1, DEFAULT_FIREBASE_CLIENT_EMULATOR_HOST, firebaseClientEmulatorsInUse, isFirebaseClientConfigComplete, openFirebaseUserSession, closeFirebaseUserSession, closeFirebaseUserSessionApps, FIRESTORE_SESSION_EXPIRY_BUFFER_MS, FIRESTORE_SESSION_MAX_CACHE_MS, firestoreSessionEntryExpiresAt, isFirestoreSessionExpired } from '@dereekb/oauth-resource/firebase';
7
+ export { FIRESTORE_SESSION_API_PATH } from '@dereekb/oauth-resource/firebase';
8
+ import { performAsyncTasks, compareStrings, expirationDetails, OidcRelyingPartyError, buildAuthorizationUrl as buildAuthorizationUrl$1, parseAuthorizationRedirect, noop, generateOAuthState, MS_IN_SECOND, generatePkceMaterial, isPlainObject as isPlainObject$1, MS_IN_HOUR, asArray, buildOidcDiscoveryCandidates, unique, AUTH_TOS_SIGNED_ROLE, AUTH_ONBOARDED_ROLE, AUTH_ADMIN_ROLE, AUTH_USER_ROLE } from '@dereekb/util';
12
9
  import { durationDataToMilliseconds, parseDurationString } from '@dereekb/date';
10
+ import { readJsonFile, writeJsonFile, createMemoizedJsonFileAsyncKeyedValueCache, DEFAULT_JSON_FILE_CACHE_MODE, removeFile } from '@dereekb/nestjs';
13
11
  import { homedir } from 'node:os';
14
12
  import { discoverOidcMetadata as discoverOidcMetadata$1, exchangeAuthorizationCode as exchangeAuthorizationCode$1, refreshAccessToken as refreshAccessToken$1, revokeToken as revokeToken$1, fetchUserInfo as fetchUserInfo$1, fetchSessionInfo as fetchSessionInfo$1 } from '@dereekb/util/oidc';
15
13
  import { createServer } from 'node:http';
@@ -117,7 +115,7 @@ function _inherits(subClass, superClass) {
117
115
  });
118
116
  if (superClass) _set_prototype_of(subClass, superClass);
119
117
  }
120
- function _instanceof$y(left, right) {
118
+ function _instanceof$x(left, right) {
121
119
  "@swc/helpers - instanceof";
122
120
  if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
123
121
  return !!right[Symbol.hasInstance](left);
@@ -157,7 +155,7 @@ function _object_spread$10(target) {
157
155
  }
158
156
  return target;
159
157
  }
160
- function ownKeys$I(object, enumerableOnly) {
158
+ function ownKeys$H(object, enumerableOnly) {
161
159
  var keys = Object.keys(object);
162
160
  if (Object.getOwnPropertySymbols) {
163
161
  var symbols = Object.getOwnPropertySymbols(object);
@@ -165,18 +163,18 @@ function ownKeys$I(object, enumerableOnly) {
165
163
  }
166
164
  return keys;
167
165
  }
168
- function _object_spread_props$I(target, source) {
166
+ function _object_spread_props$H(target, source) {
169
167
  source = source != null ? source : {};
170
168
  if (Object.getOwnPropertyDescriptors) Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
171
169
  else {
172
- ownKeys$I(Object(source)).forEach(function(key) {
170
+ ownKeys$H(Object(source)).forEach(function(key) {
173
171
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
174
172
  });
175
173
  }
176
174
  return target;
177
175
  }
178
176
  function _possible_constructor_return(self, call) {
179
- if (call && (_type_of$8(call) === "object" || typeof call === "function")) return call;
177
+ if (call && (_type_of$7(call) === "object" || typeof call === "function")) return call;
180
178
  return _assert_this_initialized(self);
181
179
  }
182
180
  function _set_prototype_of(o, p) {
@@ -288,7 +286,7 @@ function _ts_generator$1u(thisArg, body) {
288
286
  };
289
287
  }
290
288
  }
291
- function _type_of$8(obj) {
289
+ function _type_of$7(obj) {
292
290
  "@swc/helpers - typeof";
293
291
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
294
292
  }
@@ -420,7 +418,7 @@ var _timeoutMs = DEFAULT_CLI_HTTP_TIMEOUT_MS;
420
418
  method = (_ref = init === null || init === void 0 ? void 0 : init.method) !== null && _ref !== void 0 ? _ref : 'GET';
421
419
  if (typeof input === 'string') {
422
420
  url = input;
423
- } else if (_instanceof$y(input, URL)) {
421
+ } else if (_instanceof$x(input, URL)) {
424
422
  url = input.toString();
425
423
  } else {
426
424
  url = input.url;
@@ -434,7 +432,7 @@ var _timeoutMs = DEFAULT_CLI_HTTP_TIMEOUT_MS;
434
432
  return localController.abort();
435
433
  }, timeoutMs);
436
434
  (_timeoutHandle_unref = timeoutHandle.unref) === null || _timeoutHandle_unref === void 0 ? void 0 : _timeoutHandle_unref.call(timeoutHandle);
437
- finalInit = _object_spread_props$I(_object_spread$10({}, init), {
435
+ finalInit = _object_spread_props$H(_object_spread$10({}, init), {
438
436
  signal: localController.signal
439
437
  });
440
438
  }
@@ -621,7 +619,7 @@ function dumpResponse(data, meta) {
621
619
  result = data.map(function(item) {
622
620
  return pickFromObject(item, fields);
623
621
  });
624
- } else if (data != null && (typeof data === "undefined" ? "undefined" : _type_of$8(data)) === 'object') {
622
+ } else if (data != null && (typeof data === "undefined" ? "undefined" : _type_of$7(data)) === 'object') {
625
623
  result = pickFromObject(data, fields);
626
624
  } else {
627
625
  result = data;
@@ -630,7 +628,7 @@ function dumpResponse(data, meta) {
630
628
  }
631
629
  function pickFromObject(obj, fields) {
632
630
  var result;
633
- if (obj == null || (typeof obj === "undefined" ? "undefined" : _type_of$8(obj)) !== 'object') {
631
+ if (obj == null || (typeof obj === "undefined" ? "undefined" : _type_of$7(obj)) !== 'object') {
634
632
  result = obj;
635
633
  } else {
636
634
  var picked = {};
@@ -731,7 +729,7 @@ function stringifyEnvelope(value) {
731
729
  var result;
732
730
  if (mapped) {
733
731
  result = mapped;
734
- } else if (_instanceof$y(error, CliError)) {
732
+ } else if (_instanceof$x(error, CliError)) {
735
733
  result = _object_spread$10({
736
734
  ok: false,
737
735
  error: sanitizeString(error.message),
@@ -739,7 +737,7 @@ function stringifyEnvelope(value) {
739
737
  }, error.suggestion ? {
740
738
  suggestion: error.suggestion
741
739
  } : {});
742
- } else if (_instanceof$y(error, Error)) {
740
+ } else if (_instanceof$x(error, Error)) {
743
741
  result = {
744
742
  ok: false,
745
743
  error: sanitizeString(error.message),
@@ -823,7 +821,7 @@ function _object_spread$$(target) {
823
821
  }
824
822
  return target;
825
823
  }
826
- function ownKeys$H(object, enumerableOnly) {
824
+ function ownKeys$G(object, enumerableOnly) {
827
825
  var keys = Object.keys(object);
828
826
  if (Object.getOwnPropertySymbols) {
829
827
  var symbols = Object.getOwnPropertySymbols(object);
@@ -831,11 +829,11 @@ function ownKeys$H(object, enumerableOnly) {
831
829
  }
832
830
  return keys;
833
831
  }
834
- function _object_spread_props$H(target, source) {
832
+ function _object_spread_props$G(target, source) {
835
833
  source = source != null ? source : {};
836
834
  if (Object.getOwnPropertyDescriptors) Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
837
835
  else {
838
- ownKeys$H(Object(source)).forEach(function(key) {
836
+ ownKeys$G(Object(source)).forEach(function(key) {
839
837
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
840
838
  });
841
839
  }
@@ -943,7 +941,7 @@ function _ts_generator$1t(thisArg, body) {
943
941
  };
944
942
  }
945
943
  }
946
- function _type_of$7(obj) {
944
+ function _type_of$6(obj) {
947
945
  "@swc/helpers - typeof";
948
946
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
949
947
  }
@@ -975,7 +973,7 @@ var MAX_MODEL_ACCESS_MULTI_READ_KEYS = 50;
975
973
  2,
976
974
  requestJson({
977
975
  method: 'POST',
978
- url: "".concat(trimSlash$1(input.apiBaseUrl)).concat(CALL_MODEL_API_PATH),
976
+ url: "".concat(trimSlash(input.apiBaseUrl)).concat(CALL_MODEL_API_PATH),
979
977
  accessToken: input.accessToken,
980
978
  jsonBody: input.params,
981
979
  fetcher: input.fetcher,
@@ -1004,7 +1002,7 @@ var MAX_MODEL_ACCESS_MULTI_READ_KEYS = 50;
1004
1002
  2,
1005
1003
  requestJson({
1006
1004
  method: 'GET',
1007
- url: "".concat(trimSlash$1(input.apiBaseUrl), "/model/").concat(encodeURIComponent(input.modelType), "/get?key=").concat(encodeURIComponent(input.key)),
1005
+ url: "".concat(trimSlash(input.apiBaseUrl), "/model/").concat(encodeURIComponent(input.modelType), "/get?key=").concat(encodeURIComponent(input.key)),
1008
1006
  accessToken: input.accessToken,
1009
1007
  fetcher: input.fetcher,
1010
1008
  errorPrefix: "get ".concat(input.modelType, "/").concat(input.key, " failed")
@@ -1045,7 +1043,7 @@ var MAX_MODEL_ACCESS_MULTI_READ_KEYS = 50;
1045
1043
  2,
1046
1044
  requestJson({
1047
1045
  method: 'POST',
1048
- url: "".concat(trimSlash$1(input.apiBaseUrl), "/model/").concat(encodeURIComponent(input.modelType), "/get"),
1046
+ url: "".concat(trimSlash(input.apiBaseUrl), "/model/").concat(encodeURIComponent(input.modelType), "/get"),
1049
1047
  accessToken: input.accessToken,
1050
1048
  jsonBody: {
1051
1049
  keys: input.keys
@@ -1102,7 +1100,7 @@ var MAX_MODEL_ACCESS_MULTI_READ_KEYS = 50;
1102
1100
  chunk = _step.value;
1103
1101
  return [
1104
1102
  4,
1105
- getMultipleModelsOverHttp(_object_spread_props$H(_object_spread$$({}, input), {
1103
+ getMultipleModelsOverHttp(_object_spread_props$G(_object_spread$$({}, input), {
1106
1104
  keys: chunk
1107
1105
  }))
1108
1106
  ];
@@ -1187,8 +1185,8 @@ function requestJson(input) {
1187
1185
  _ref = _state.sent(), ok = _ref.ok, body = _ref.body, fallbackMessage = _ref.fallbackMessage;
1188
1186
  if (!ok) {
1189
1187
  throw new CliError({
1190
- message: "".concat(input.errorPrefix, ": ").concat(extractMessage$1(body, fallbackMessage, res)),
1191
- code: codeForStatus$1(res.status),
1188
+ message: "".concat(input.errorPrefix, ": ").concat(extractMessage(body, fallbackMessage, res)),
1189
+ code: codeForStatus(res.status),
1192
1190
  suggestion: res.status === 401 || res.status === 403 ? 'Run `<cli> auth login` to refresh credentials.' : undefined
1193
1191
  });
1194
1192
  }
@@ -1231,12 +1229,12 @@ function readJsonResponse(res) {
1231
1229
  });
1232
1230
  })();
1233
1231
  }
1234
- function extractMessage$1(body, fallback, res) {
1235
- var bodyMessage = (typeof body === "undefined" ? "undefined" : _type_of$7(body)) === 'object' && body && 'message' in body ? body.message : undefined;
1232
+ function extractMessage(body, fallback, res) {
1233
+ var bodyMessage = (typeof body === "undefined" ? "undefined" : _type_of$6(body)) === 'object' && body && 'message' in body ? body.message : undefined;
1236
1234
  var messageString = typeof bodyMessage === 'string' ? bodyMessage : undefined;
1237
1235
  return messageString !== null && messageString !== void 0 ? messageString : fallback || "".concat(res.status, " ").concat(res.statusText);
1238
1236
  }
1239
- function codeForStatus$1(status) {
1237
+ function codeForStatus(status) {
1240
1238
  var result;
1241
1239
  if (status === 401) {
1242
1240
  result = 'AUTH_UNAUTHORIZED';
@@ -1255,68 +1253,20 @@ function codeForStatus$1(status) {
1255
1253
  }
1256
1254
  return result;
1257
1255
  }
1258
- function trimSlash$1(url) {
1256
+ function trimSlash(url) {
1259
1257
  return url.endsWith('/') ? url.slice(0, -1) : url;
1260
1258
  }
1261
1259
 
1262
- function _define_property$$(obj, key, value) {
1263
- if (key in obj) {
1264
- Object.defineProperty(obj, key, {
1265
- value: value,
1266
- enumerable: true,
1267
- configurable: true,
1268
- writable: true
1269
- });
1270
- } else obj[key] = value;
1271
- return obj;
1272
- }
1273
- function _instanceof$x(left, right) {
1260
+ function _instanceof$w(left, right) {
1274
1261
  "@swc/helpers - instanceof";
1275
1262
  if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
1276
1263
  return !!right[Symbol.hasInstance](left);
1277
1264
  } else return left instanceof right;
1278
1265
  }
1279
- function _object_spread$_(target) {
1280
- for(var i = 1; i < arguments.length; i++){
1281
- var source = arguments[i] != null ? arguments[i] : {};
1282
- var ownKeys = Object.keys(source);
1283
- if (typeof Object.getOwnPropertySymbols === "function") {
1284
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
1285
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
1286
- }));
1287
- }
1288
- ownKeys.forEach(function(key) {
1289
- _define_property$$(target, key, source[key]);
1290
- });
1291
- }
1292
- return target;
1293
- }
1294
- function ownKeys$G(object, enumerableOnly) {
1295
- var keys = Object.keys(object);
1296
- if (Object.getOwnPropertySymbols) {
1297
- var symbols = Object.getOwnPropertySymbols(object);
1298
- keys.push.apply(keys, symbols);
1299
- }
1300
- return keys;
1301
- }
1302
- function _object_spread_props$G(target, source) {
1303
- source = source != null ? source : {};
1304
- if (Object.getOwnPropertyDescriptors) Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
1305
- else {
1306
- ownKeys$G(Object(source)).forEach(function(key) {
1307
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
1308
- });
1309
- }
1310
- return target;
1311
- }
1312
1266
  /**
1313
- * The `drivers.firestoreDriverIdentifier` a client-SDK `FirestoreContext` reports.
1314
- *
1315
- * `clientFirebaseFirestoreContextFactory` stamps this; the server's
1316
- * `googleCloudFirestoreContextFactory` stamps `@google-cloud/firestore` instead. Comparing against
1317
- * it is how {@link inspectCliFirestoreSdkIdentity} tells an admin-SDK context handed to the CLI apart
1318
- * from a genuinely broken client one.
1319
- */ var CLI_CLIENT_FIRESTORE_DRIVER_IDENTIFIER = '@firebase/firestore';
1267
+ * The `drivers.firestoreDriverIdentifier` a client-SDK `FirestoreContext` reports. See
1268
+ * {@link CLIENT_FIRESTORE_DRIVER_IDENTIFIER}.
1269
+ */ var CLI_CLIENT_FIRESTORE_DRIVER_IDENTIFIER = CLIENT_FIRESTORE_DRIVER_IDENTIFIER;
1320
1270
  /**
1321
1271
  * The doctor `detail.stage` reported when the session's Firestore handle is not a usable client-SDK
1322
1272
  * `Firestore`.
@@ -1328,54 +1278,43 @@ function _object_spread_props$G(target, source) {
1328
1278
  * `CliError` code for a Firestore handle the client SDK does not recognize as its own.
1329
1279
  */ var FIRESTORE_SDK_INSTANCE_MISMATCH_CODE = 'FIRESTORE_SDK_INSTANCE_MISMATCH';
1330
1280
  /**
1331
- * Checks that a session's Firestore handle is one THIS copy of the client SDK will accept, and
1332
- * reports where every consumer resolved the SDK from.
1281
+ * `CliError` code for a collection/document reference the SDK refused to build for a reason the
1282
+ * wiring identity check cannot explain — a bad `--parent`, or an app collection whose own
1283
+ * construction is broken.
1284
+ */ var FIRESTORE_COLLECTION_UNRESOLVABLE_CODE = 'FIRESTORE_COLLECTION_UNRESOLVABLE';
1285
+ /**
1286
+ * The CLI's name in the SDK-identity report and its suggestions.
1287
+ */ var CLI_FIRESTORE_IDENTITY_CONSUMER_NAME = '@dereekb/dbx-cli';
1288
+ /**
1289
+ * This package's own module-resolution root.
1333
1290
  *
1334
- * Exists because `collection()` refuses any non-`Firestore` first argument with one message —
1335
- * `Expected first argument to collection() to be a CollectionReference, a DocumentReference or
1336
- * FirebaseFirestore` — that names neither the model, nor the collection, nor which of the three
1337
- * distinct causes ({@link CliFirestoreSdkIdentityProblem}) produced it. Every downstream CLI built on
1338
- * `@dereekb/dbx-cli` shares that hazard, so the diagnosis belongs here rather than in an app.
1291
+ * The duplicated-SDK hypothesis is exactly "do `@dereekb/dbx-cli` and `@dereekb/firebase` see the
1292
+ * same copy of `@firebase/firestore`", so the resolution has to start from HERE — resolving from
1293
+ * `@dereekb/oauth-resource/firebase` would answer a different question.
1294
+ */ var cliRequire = createRequire(import.meta.url);
1295
+ /**
1296
+ * The CLI's operator-facing remediation for each problem, replacing the package-level default.
1339
1297
  *
1340
- * The `instanceof` test is the load-bearing one and it is deliberately NOT structural: an identity
1341
- * check across the package boundary is the only thing that can detect a duplicated
1342
- * `@firebase/firestore`, which is exactly what a structural check would hide. (Contrast
1343
- * `firestore.error.ts`, which narrows a thrown `FirebaseError` structurally — there the goal is to
1344
- * classify an error even when copies differ, so the tradeoff runs the other way.)
1298
+ * Each names a step an operator of a `@dereekb/dbx-cli`-built CLI can actually take.
1299
+ */ var CLI_FIRESTORE_SDK_IDENTITY_SUGGESTIONS = {
1300
+ 'no-firestore-handle': 'The session produced no Firestore handle, so every collection reference built from it fails. This is a wiring fault, not a rules or App Check fault — re-run with `--verbose` to see the handshake, and verify the CLI resolves ONE `@dereekb/firebase`.',
1301
+ 'foreign-firestore-instance': "The session's handle is not an instance of the loaded SDK's `Firestore`, and only one copy of `@firebase/firestore` is installed. The likeliest cause is a STALE CLI artifact running against a newer `@dereekb/*` in `node_modules` — rebuild the CLI, then re-run `doctor`."
1302
+ };
1303
+ /**
1304
+ * Checks that a session's Firestore handle is one the loaded client SDK will accept, and reports
1305
+ * where every consumer resolved the SDK from.
1306
+ *
1307
+ * The CLI wrapper over {@link inspectFirebaseClientFirestoreIdentity}: it supplies this package's own
1308
+ * `require` as the resolution root and names the CLI in the report, so `doctor`'s output is unchanged
1309
+ * by the move of the inspection core into `@dereekb/oauth-resource/firebase`.
1345
1310
  *
1346
1311
  * @param input - The session's `firestoreContext`, when one was built.
1347
1312
  * @returns The provenance + brand-check report.
1348
1313
  */ function inspectCliFirestoreSdkIdentity(input) {
1349
- var _input_firestoreContext, _input_firestoreContext_drivers, _input_firestoreContext1;
1350
- var firestore = (_input_firestoreContext = input.firestoreContext) === null || _input_firestoreContext === void 0 ? void 0 : _input_firestoreContext.firestore;
1351
- var driverIdentifier = (_input_firestoreContext1 = input.firestoreContext) === null || _input_firestoreContext1 === void 0 ? void 0 : (_input_firestoreContext_drivers = _input_firestoreContext1.drivers) === null || _input_firestoreContext_drivers === void 0 ? void 0 : _input_firestoreContext_drivers.firestoreDriverIdentifier;
1352
- var firestoreDriverIdentifier = typeof driverIdentifier === 'string' ? driverIdentifier : undefined;
1353
- var firestorePresent = firestore != null;
1354
- var firestoreIsSdkInstance = _instanceof$x(firestore, Firestore);
1355
- var firestoreConstructor = firestoreConstructorName(firestore);
1356
- var modules = resolveCliFirestoreSdkModules();
1357
- var sdkDuplicated = modules.sdkFromDbxCli.packageDir != null && modules.sdkFromDbxFirebase.packageDir != null && modules.sdkFromDbxCli.packageDir !== modules.sdkFromDbxFirebase.packageDir;
1358
- var problem;
1359
- if (!firestorePresent) {
1360
- problem = 'no-firestore-handle';
1361
- } else if (firestoreDriverIdentifier != null && firestoreDriverIdentifier !== CLI_CLIENT_FIRESTORE_DRIVER_IDENTIFIER) {
1362
- problem = 'unexpected-driver';
1363
- } else if (!firestoreIsSdkInstance) {
1364
- problem = sdkDuplicated ? 'duplicated-firestore-sdk' : 'foreign-firestore-instance';
1365
- }
1366
- return _object_spread_props$G(_object_spread$_(_object_spread_props$G(_object_spread$_({
1367
- ok: problem == null
1368
- }, problem == null ? {} : {
1369
- problem: problem
1370
- }), {
1371
- firestorePresent: firestorePresent,
1372
- firestoreIsSdkInstance: firestoreIsSdkInstance
1373
- }), firestoreConstructor == null ? {} : {
1374
- firestoreConstructor: firestoreConstructor
1375
- }, firestoreDriverIdentifier == null ? {} : {
1376
- firestoreDriverIdentifier: firestoreDriverIdentifier
1377
- }, modules), {
1378
- sdkDuplicated: sdkDuplicated
1314
+ return inspectFirebaseClientFirestoreIdentity({
1315
+ firestoreContext: input.firestoreContext,
1316
+ consumerRequire: cliRequire,
1317
+ consumerName: CLI_FIRESTORE_IDENTITY_CONSUMER_NAME
1379
1318
  });
1380
1319
  }
1381
1320
  /**
@@ -1390,32 +1329,8 @@ function _object_spread_props$G(target, source) {
1390
1329
  *
1391
1330
  * @__NO_SIDE_EFFECTS__
1392
1331
  */ function cliFirestoreSdkIdentitySuggestion(report) {
1393
- var result;
1394
- switch(report.problem){
1395
- case 'no-firestore-handle':
1396
- result = 'The session produced no Firestore handle, so every collection reference built from it fails. This is a wiring fault, not a rules or App Check fault — re-run with `--verbose` to see the handshake, and verify the CLI resolves ONE `@dereekb/firebase`.';
1397
- break;
1398
- case 'unexpected-driver':
1399
- result = 'The `FirestoreContext` reports driver "'.concat(report.firestoreDriverIdentifier, '", not "').concat(CLI_CLIENT_FIRESTORE_DRIVER_IDENTIFIER, "\". An admin-SDK context reached the client-SDK read path — build the CLI's context with `clientFirebaseFirestoreContextFactory`, not `googleCloudFirestoreContextFactory`.");
1400
- break;
1401
- case 'duplicated-firestore-sdk':
1402
- result = "Two copies of `@firebase/firestore` are loaded — `@dereekb/dbx-cli` resolves ".concat(report.sdkFromDbxCli.packageDir, ", `@dereekb/firebase` resolves ").concat(report.sdkFromDbxFirebase.packageDir, " — so the handle one minted fails the other's brand check. Dedupe the install (`npm ls @firebase/firestore`) and rebuild the CLI.");
1403
- break;
1404
- case 'foreign-firestore-instance':
1405
- var _report_firestoreConstructor;
1406
- result = "The session's handle (`".concat((_report_firestoreConstructor = report.firestoreConstructor) !== null && _report_firestoreConstructor !== void 0 ? _report_firestoreConstructor : 'unknown', "`) is not an instance of the loaded SDK's `Firestore`, and only one copy of `@firebase/firestore` is installed. The likeliest cause is a STALE CLI artifact running against a newer `@dereekb/*` in `node_modules` — rebuild the CLI, then re-run `doctor`.");
1407
- break;
1408
- default:
1409
- result = undefined;
1410
- break;
1411
- }
1412
- return result;
1332
+ return firebaseClientFirestoreIdentitySuggestion(report, CLI_FIRESTORE_SDK_IDENTITY_SUGGESTIONS, CLI_FIRESTORE_IDENTITY_CONSUMER_NAME);
1413
1333
  }
1414
- /**
1415
- * `CliError` code for a collection/document reference the SDK refused to build for a reason the
1416
- * wiring identity check cannot explain — a bad `--parent`, or an app collection whose own
1417
- * construction is broken.
1418
- */ var FIRESTORE_COLLECTION_UNRESOLVABLE_CODE = 'FIRESTORE_COLLECTION_UNRESOLVABLE';
1419
1334
  /**
1420
1335
  * Re-raises a reference-construction failure as a `CliError` that names WHAT was being built and, when
1421
1336
  * the SDK handle is at fault, WHY.
@@ -1431,10 +1346,10 @@ function _object_spread_props$G(target, source) {
1431
1346
  */ function cliFirestoreWiringError(input) {
1432
1347
  var error = input.error, operation = input.operation, modelType = input.modelType, collectionName = input.collectionName, parentKey = input.parentKey, firestoreContext = input.firestoreContext;
1433
1348
  var result;
1434
- if (_instanceof$x(error, CliError)) {
1349
+ if (_instanceof$w(error, CliError)) {
1435
1350
  result = error;
1436
1351
  } else {
1437
- var _cliFirestoreSdkIdentitySuggestion, _report_firestoreDriverIdentifier, _report_sdkFromDbxCli_version, _report_sdkFromDbxCli_packageDir;
1352
+ var _cliFirestoreSdkIdentitySuggestion, _report_firestoreDriverIdentifier, _report_sdkFromConsumer_version, _report_sdkFromConsumer_packageDir;
1438
1353
  var facts = [
1439
1354
  modelType == null ? undefined : 'model "'.concat(modelType, '"'),
1440
1355
  collectionName == null ? undefined : 'collection "'.concat(collectionName, '"'),
@@ -1445,96 +1360,15 @@ function _object_spread_props$G(target, source) {
1445
1360
  var report = inspectCliFirestoreSdkIdentity({
1446
1361
  firestoreContext: firestoreContext
1447
1362
  });
1448
- var message = "Could not ".concat(operation, " (").concat(facts.join(', '), "): ").concat(_instanceof$x(error, Error) ? error.message : String(error));
1363
+ var message = "Could not ".concat(operation, " (").concat(facts.join(', '), "): ").concat(_instanceof$w(error, Error) ? error.message : String(error));
1449
1364
  result = new CliError({
1450
1365
  message: message,
1451
1366
  code: report.ok ? FIRESTORE_COLLECTION_UNRESOLVABLE_CODE : FIRESTORE_SDK_INSTANCE_MISMATCH_CODE,
1452
- suggestion: (_cliFirestoreSdkIdentitySuggestion = cliFirestoreSdkIdentitySuggestion(report)) !== null && _cliFirestoreSdkIdentitySuggestion !== void 0 ? _cliFirestoreSdkIdentitySuggestion : 'The Firestore handle itself checked out (driver "'.concat((_report_firestoreDriverIdentifier = report.firestoreDriverIdentifier) !== null && _report_firestoreDriverIdentifier !== void 0 ? _report_firestoreDriverIdentifier : 'unknown', '", @firebase/firestore ').concat((_report_sdkFromDbxCli_version = report.sdkFromDbxCli.version) !== null && _report_sdkFromDbxCli_version !== void 0 ? _report_sdkFromDbxCli_version : 'unknown', " at ").concat((_report_sdkFromDbxCli_packageDir = report.sdkFromDbxCli.packageDir) !== null && _report_sdkFromDbxCli_packageDir !== void 0 ? _report_sdkFromDbxCli_packageDir : 'unknown', "), so the rejected argument is the path, not the SDK. Check the --parent key and the app's collection factory for this model.")
1453
- });
1454
- }
1455
- return result;
1456
- }
1457
- /**
1458
- * The handle's constructor name, when it has one.
1459
- *
1460
- * @param firestore - The candidate handle.
1461
- * @returns The constructor name, or `undefined`.
1462
- */ function firestoreConstructorName(firestore) {
1463
- var _firestore_constructor;
1464
- var name = firestore == null ? undefined : (_firestore_constructor = firestore.constructor) === null || _firestore_constructor === void 0 ? void 0 : _firestore_constructor.name;
1465
- return typeof name === 'string' ? name : undefined;
1466
- }
1467
- /**
1468
- * Resolves `@firebase/firestore` from both this package and `@dereekb/firebase`, plus the `firebase`
1469
- * umbrella version.
1470
- *
1471
- * `createRequire` rather than `import.meta.resolve` because the resolution has to be performed
1472
- * relative to ANOTHER package's location (`@dereekb/firebase`'s entry file) to answer the question
1473
- * that matters — whether the two consumers see the same copy.
1474
- *
1475
- * @returns The two module identities and the umbrella version, each degrading to an `error` field
1476
- * rather than throwing: this runs inside a diagnostic, and a failed resolution is itself a finding.
1477
- */ function resolveCliFirestoreSdkModules() {
1478
- var requireFromDbxCli = createRequire(import.meta.url);
1479
- var sdkFromDbxCli = resolveFirestoreSdkIdentity(requireFromDbxCli);
1480
- var sdkFromDbxFirebase;
1481
- try {
1482
- sdkFromDbxFirebase = resolveFirestoreSdkIdentity(createRequire(requireFromDbxCli.resolve('@dereekb/firebase')));
1483
- } catch (e) {
1484
- sdkFromDbxFirebase = {
1485
- error: _instanceof$x(e, Error) ? e.message : String(e)
1486
- };
1487
- }
1488
- var firebaseVersion;
1489
- try {
1490
- firebaseVersion = readPackageVersion(requireFromDbxCli, 'firebase/package.json');
1491
- } catch (unused) {
1492
- // the umbrella version is context for the report, not a finding on its own
1493
- firebaseVersion = undefined;
1494
- }
1495
- return _object_spread$_({
1496
- sdkFromDbxCli: sdkFromDbxCli,
1497
- sdkFromDbxFirebase: sdkFromDbxFirebase
1498
- }, firebaseVersion == null ? {} : {
1499
- firebaseVersion: firebaseVersion
1500
- });
1501
- }
1502
- /**
1503
- * Resolves `@firebase/firestore`'s package directory + version through one `require`.
1504
- *
1505
- * Resolves `package.json` rather than the package entry because the entry differs per export
1506
- * condition (`index.node.cjs.js` vs `index.node.mjs`), which would report two copies where there is
1507
- * one. The `package.json` path is condition-independent, so its directory is a stable identity.
1508
- *
1509
- * @param resolver - The `require` to resolve through.
1510
- * @returns The module identity, with `error` set when resolution failed.
1511
- */ function resolveFirestoreSdkIdentity(resolver) {
1512
- var result;
1513
- try {
1514
- var packageJsonPath = resolver.resolve('@firebase/firestore/package.json');
1515
- var version = readPackageVersion(resolver, '@firebase/firestore/package.json');
1516
- result = _object_spread$_({
1517
- packageDir: dirname(packageJsonPath)
1518
- }, version == null ? {} : {
1519
- version: version
1367
+ suggestion: (_cliFirestoreSdkIdentitySuggestion = cliFirestoreSdkIdentitySuggestion(report)) !== null && _cliFirestoreSdkIdentitySuggestion !== void 0 ? _cliFirestoreSdkIdentitySuggestion : 'The Firestore handle itself checked out (driver "'.concat((_report_firestoreDriverIdentifier = report.firestoreDriverIdentifier) !== null && _report_firestoreDriverIdentifier !== void 0 ? _report_firestoreDriverIdentifier : 'unknown', '", @firebase/firestore ').concat((_report_sdkFromConsumer_version = report.sdkFromConsumer.version) !== null && _report_sdkFromConsumer_version !== void 0 ? _report_sdkFromConsumer_version : 'unknown', " at ").concat((_report_sdkFromConsumer_packageDir = report.sdkFromConsumer.packageDir) !== null && _report_sdkFromConsumer_packageDir !== void 0 ? _report_sdkFromConsumer_packageDir : 'unknown', "), so the rejected argument is the path, not the SDK. Check the --parent key and the app's collection factory for this model.")
1520
1368
  });
1521
- } catch (e) {
1522
- result = {
1523
- error: _instanceof$x(e, Error) ? e.message : String(e)
1524
- };
1525
1369
  }
1526
1370
  return result;
1527
1371
  }
1528
- /**
1529
- * Reads a resolvable `package.json`'s `version`.
1530
- *
1531
- * @param resolver - The `require` to load through.
1532
- * @param specifier - The `package.json` specifier.
1533
- * @returns The version string, or `undefined` when absent.
1534
- */ function readPackageVersion(resolver, specifier) {
1535
- var contents = resolver(specifier);
1536
- return typeof contents.version === 'string' ? contents.version : undefined;
1537
- }
1538
1372
 
1539
1373
  function _array_like_to_array$1a(arr, len) {
1540
1374
  if (len == null || len > arr.length) len = arr.length;
@@ -1919,6 +1753,32 @@ function _async_to_generator$1r(fn) {
1919
1753
  });
1920
1754
  };
1921
1755
  }
1756
+ function _define_property$$(obj, key, value) {
1757
+ if (key in obj) {
1758
+ Object.defineProperty(obj, key, {
1759
+ value: value,
1760
+ enumerable: true,
1761
+ configurable: true,
1762
+ writable: true
1763
+ });
1764
+ } else obj[key] = value;
1765
+ return obj;
1766
+ }
1767
+ function _object_spread$_(target) {
1768
+ for(var i = 1; i < arguments.length; i++){
1769
+ var source = arguments[i] != null ? arguments[i] : {};
1770
+ var ownKeys = Object.keys(source);
1771
+ if (typeof Object.getOwnPropertySymbols === "function") {
1772
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
1773
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
1774
+ }));
1775
+ }
1776
+ ownKeys.forEach(function(key) {
1777
+ _define_property$$(target, key, source[key]);
1778
+ });
1779
+ }
1780
+ return target;
1781
+ }
1922
1782
  function _ts_generator$1r(thisArg, body) {
1923
1783
  var f, y, t, _ = {
1924
1784
  label: 0,
@@ -2018,103 +1878,69 @@ function _ts_generator$1r(thisArg, body) {
2018
1878
  };
2019
1879
  }
2020
1880
  }
2021
- function _type_of$6(obj) {
2022
- "@swc/helpers - typeof";
2023
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
2024
- }
2025
1881
  /**
2026
- * Path (relative to the API base URL) of the direct-Firestore session endpoint served by
2027
- * `@dereekb/firebase-server`'s `SessionApiController`.
1882
+ * `CliError` code raised for each {@link FirestoreSessionErrorCode}.
2028
1883
  *
2029
- * Duplicated here rather than imported so `dbx-cli` keeps no dependency on the server package —
2030
- * the same arrangement `CALL_MODEL_API_PATH` uses.
2031
- */ var FIRESTORE_SESSION_API_PATH = "/session/firestore";
1884
+ * The mapping is exhaustive rather than defaulted so a new generic code is a compile error here
1885
+ * instead of a silent `API_ERROR` in the operator's output.
1886
+ */ var CLI_FIRESTORE_SESSION_ERROR_CODES = {
1887
+ unauthorized: 'AUTH_UNAUTHORIZED',
1888
+ forbidden: 'AUTH_FORBIDDEN',
1889
+ not_found: 'NOT_FOUND',
1890
+ unavailable: 'SERVER_ERROR',
1891
+ invalid_response: 'API_ERROR',
1892
+ invalid_config: 'INVALID_ARGUMENT'
1893
+ };
1894
+ /**
1895
+ * Maps a generic session failure onto a {@link CliError}, re-attaching the CLI-flavored remediation
1896
+ * an operator can act on (`<cli> auth login --env <env>` and friends).
1897
+ *
1898
+ * @param input - The generic failure.
1899
+ * @returns The `CliError` to throw.
1900
+ */ var cliFirestoreSessionErrorFactory = function cliFirestoreSessionErrorFactory(input) {
1901
+ // the 401/403 text is CLI-specific — it names the command an operator runs to fix it, which the
1902
+ // package-level wording deliberately cannot
1903
+ var suggestion = input.code === 'unauthorized' || input.code === 'forbidden' ? 'The direct-Firestore session endpoint is admin-only and requires the `session.firestore` scope. Run `<cli> auth login` with that scope as an admin user.' : input.suggestion;
1904
+ return new CliError(_object_spread$_({
1905
+ message: input.message,
1906
+ code: CLI_FIRESTORE_SESSION_ERROR_CODES[input.code]
1907
+ }, suggestion == null ? {} : {
1908
+ suggestion: suggestion
1909
+ }));
1910
+ };
2032
1911
  /**
2033
1912
  * Fetches a direct-Firestore session from the API with the cached Bearer access token.
2034
1913
  *
2035
- * The endpoint is admin-only and additionally gated on the `session.firestore` OIDC scope, so a 403
2036
- * here usually means the logged-in user is not an admin or logged in without that scope.
1914
+ * The thin CLI wrapper over `@dereekb/oauth-resource/firebase`'s `fetchFirestoreSession`: it binds
1915
+ * the CLI's `tracedFetch` (so `--verbose` and `--timeout` apply) and the `CliError` factory.
2037
1916
  *
2038
1917
  * @param input - The API target, access token, and optional fetch override.
2039
1918
  * @returns The parsed {@link CliFirestoreSession}.
2040
1919
  * @throws {CliError} When the endpoint answers non-2xx or returns an unusable body.
2041
1920
  */ function fetchFirestoreSession(input) {
2042
1921
  return _async_to_generator$1r(function() {
2043
- var url, res, text, body, session;
2044
1922
  return _ts_generator$1r(this, function(_state) {
2045
- switch(_state.label){
2046
- case 0:
2047
- url = "".concat(trimSlash(input.apiBaseUrl)).concat(FIRESTORE_SESSION_API_PATH);
2048
- return [
2049
- 4,
2050
- tracedFetch(input.fetcher, url, {
2051
- method: 'GET',
2052
- headers: {
2053
- Accept: 'application/json',
2054
- Authorization: "Bearer ".concat(input.accessToken)
2055
- }
2056
- })
2057
- ];
2058
- case 1:
2059
- res = _state.sent();
2060
- return [
2061
- 4,
2062
- res.text()
2063
- ];
2064
- case 2:
2065
- text = _state.sent();
2066
- if (text.length > 0) {
2067
- try {
2068
- body = JSON.parse(text);
2069
- } catch (unused) {
2070
- body = text;
2071
- }
2072
- }
2073
- if (!res.ok) {
2074
- throw new CliError({
2075
- message: "firestore session request failed: ".concat(extractMessage(body, text, res)),
2076
- code: codeForStatus(res.status),
2077
- suggestion: res.status === 401 || res.status === 403 ? 'The direct-Firestore session endpoint is admin-only and requires the `session.firestore` scope. Run `<cli> auth login` with that scope as an admin user.' : 'Verify the API exposes `/session/firestore` (the firebase-server session module must be registered and `/api/session` added to the OIDC `protectedPaths`).'
2078
- });
2079
- }
2080
- session = body;
2081
- if (!(session === null || session === void 0 ? void 0 : session.customToken)) {
2082
- throw new CliError({
2083
- message: 'firestore session response did not include a customToken.',
2084
- code: 'API_ERROR',
2085
- suggestion: 'Verify the API is running a `@dereekb/firebase-server` version that serves `/session/firestore`.'
2086
- });
2087
- }
2088
- return [
2089
- 2,
2090
- session
2091
- ];
2092
- }
1923
+ return [
1924
+ 2,
1925
+ fetchFirestoreSession$1({
1926
+ apiBaseUrl: input.apiBaseUrl,
1927
+ accessToken: input.accessToken,
1928
+ fetcher: cliFirestoreSessionFetcher(input.fetcher),
1929
+ errorFactory: cliFirestoreSessionErrorFactory
1930
+ })
1931
+ ];
2093
1932
  });
2094
1933
  })();
2095
1934
  }
2096
- function extractMessage(body, fallback, res) {
2097
- var bodyMessage = (typeof body === "undefined" ? "undefined" : _type_of$6(body)) === 'object' && body && 'message' in body ? body.message : undefined;
2098
- var messageString = typeof bodyMessage === 'string' ? bodyMessage : undefined;
2099
- return messageString !== null && messageString !== void 0 ? messageString : fallback || "".concat(res.status, " ").concat(res.statusText);
2100
- }
2101
- function codeForStatus(status) {
2102
- var result;
2103
- if (status === 401) {
2104
- result = 'AUTH_UNAUTHORIZED';
2105
- } else if (status === 403) {
2106
- result = 'AUTH_FORBIDDEN';
2107
- } else if (status === 404) {
2108
- result = 'NOT_FOUND';
2109
- } else if (status >= 500) {
2110
- result = 'SERVER_ERROR';
2111
- } else {
2112
- result = 'API_ERROR';
2113
- }
2114
- return result;
2115
- }
2116
- function trimSlash(url) {
2117
- return url.endsWith('/') ? url.slice(0, -1) : url;
1935
+ /**
1936
+ * Binds the CLI's verbose-trace + `--timeout` fetch behavior onto the supplied (or global) fetch.
1937
+ *
1938
+ * @param fetcher - The underlying fetch impl, when one was injected.
1939
+ * @returns A `fetch`-shaped function carrying the CLI's tracing.
1940
+ */ function cliFirestoreSessionFetcher(fetcher) {
1941
+ return function(input, init) {
1942
+ return tracedFetch(fetcher, input, init);
1943
+ };
2118
1944
  }
2119
1945
 
2120
1946
  function _define_property$_(obj, key, value) {
@@ -2327,8 +2153,8 @@ function nonEmpty(value) {
2327
2153
  }
2328
2154
  /**
2329
2155
  * Default host used for Firebase emulator connections when a {@link CliFirebaseEmulatorsConfig}
2330
- * omits one.
2331
- */ var DEFAULT_CLI_FIREBASE_EMULATOR_HOST = 'localhost';
2156
+ * omits one. See {@link DEFAULT_FIREBASE_CLIENT_EMULATOR_HOST}.
2157
+ */ var DEFAULT_CLI_FIREBASE_EMULATOR_HOST = DEFAULT_FIREBASE_CLIENT_EMULATOR_HOST;
2332
2158
  /**
2333
2159
  * Returns true when the env carries the minimum Firebase client config needed to open a direct
2334
2160
  * Firestore session.
@@ -2336,20 +2162,12 @@ function nonEmpty(value) {
2336
2162
  * Deliberately separate from {@link isCliEnvConfigComplete}: the Firebase config is optional, and
2337
2163
  * folding it into the general completeness check would break every CLI that only uses the model API.
2338
2164
  *
2339
- * @param firebase - The env's Firebase client config, if any.
2340
- * @returns `true` when `apiKey`, `projectId`, and `appId` are all present and non-empty.
2341
- */ function isCliFirebaseConfigComplete(firebase) {
2342
- return Boolean((firebase === null || firebase === void 0 ? void 0 : firebase.apiKey) && (firebase === null || firebase === void 0 ? void 0 : firebase.projectId) && (firebase === null || firebase === void 0 ? void 0 : firebase.appId));
2343
- }
2165
+ * See {@link isFirebaseClientConfigComplete}.
2166
+ */ var isCliFirebaseConfigComplete = isFirebaseClientConfigComplete;
2344
2167
  /**
2345
- * Returns true when the env's emulator config is present and active.
2346
- *
2347
- * @param firebase - The env's Firebase client config, if any.
2348
- * @returns `true` when emulators are configured and not explicitly disabled.
2349
- */ function cliFirebaseEmulatorsInUse(firebase) {
2350
- var emulators = firebase === null || firebase === void 0 ? void 0 : firebase.emulators;
2351
- return Boolean(emulators && emulators.useEmulators !== false && (emulators.authPort != null || emulators.firestorePort != null));
2352
- }
2168
+ * Returns true when the env's emulator config is present and active. See
2169
+ * {@link firebaseClientEmulatorsInUse}.
2170
+ */ var cliFirebaseEmulatorsInUse = firebaseClientEmulatorsInUse;
2353
2171
  /**
2354
2172
  * Resolves the active env name from a flag, env var, or persisted default.
2355
2173
  *
@@ -2473,65 +2291,6 @@ function parsePort(value) {
2473
2291
  return result;
2474
2292
  }
2475
2293
 
2476
- /**
2477
- * Hard ceiling on how long a minted direct-Firestore session may be reused, regardless of what the
2478
- * API reported in `expiresAt`.
2479
- *
2480
- * One hour, because that is the Firebase ceiling the credentials themselves sit under: a custom
2481
- * token is exchangeable for one hour, and the ID token it mints lives one hour. Holding a session
2482
- * past that buys nothing — the sign-in would fail — and re-minting is one HTTP round-trip.
2483
- */ var CLI_FIRESTORE_SESSION_MAX_CACHE_MS = 60 * 60 * 1000;
2484
- /**
2485
- * Default skew/latency buffer applied when deciding whether a cached session is still usable.
2486
- */ var CLI_FIRESTORE_SESSION_EXPIRY_BUFFER_MS = 60000;
2487
- /**
2488
- * Creates a per-env direct-Firestore session cache store backed by a single JSON file.
2489
- *
2490
- * Entries are written with mode 0o600 — they hold a Firebase custom token, which is a bearer
2491
- * credential for the user it was minted for.
2492
- *
2493
- * @param input - The cache store inputs.
2494
- * @param input.firestoreSessionCachePath - Absolute path to the JSON file backing the cache.
2495
- * @returns A {@link CliFirestoreSessionCacheStore} keyed by env name.
2496
- * @__NO_SIDE_EFFECTS__
2497
- */ function createCliFirestoreSessionCacheStore(input) {
2498
- return createMemoizedJsonFileAsyncKeyedValueCache({
2499
- filePath: input.firestoreSessionCachePath
2500
- });
2501
- }
2502
- /**
2503
- * Resolves the epoch-millis instant at which a cached session stops being usable.
2504
- *
2505
- * The effective expiry is the EARLIER of the API-reported `expiresAt` and
2506
- * {@link CLI_FIRESTORE_SESSION_MAX_CACHE_MS} past the write. Taking the earlier of the two means a
2507
- * server that reports an over-long (or unparsable) window still cannot push a session past the
2508
- * Firebase credential ceiling.
2509
- *
2510
- * @param entry - The cached entry.
2511
- * @returns The effective expiry in unix epoch milliseconds.
2512
- *
2513
- * @__NO_SIDE_EFFECTS__
2514
- */ function cliFirestoreSessionEntryExpiresAt(entry) {
2515
- var ceiling = entry.cachedAt + CLI_FIRESTORE_SESSION_MAX_CACHE_MS;
2516
- var reported = Date.parse(entry.session.expiresAt);
2517
- return Number.isFinite(reported) ? Math.min(reported, ceiling) : ceiling;
2518
- }
2519
- /**
2520
- * Returns true when the cached session is at or near its effective expiry.
2521
- *
2522
- * @param entry - The cached entry (`null`/`undefined` is treated as expired).
2523
- * @param nowMs - The current time in unix epoch milliseconds. Defaults to `Date.now()`.
2524
- * @param bufferMs - Skew/latency buffer; the entry is treated as expired this far ahead of its effective expiry.
2525
- * @returns `true` when the entry is unusable, otherwise `false`.
2526
- */ function isCliFirestoreSessionExpired(entry) {
2527
- var nowMs = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : Date.now(), bufferMs = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : CLI_FIRESTORE_SESSION_EXPIRY_BUFFER_MS;
2528
- return entry == null || expirationDetails({
2529
- expiresFromDate: cliFirestoreSessionEntryExpiresAt(entry),
2530
- expiresIn: -bufferMs,
2531
- now: new Date(nowMs)
2532
- }).hasExpired();
2533
- }
2534
-
2535
2294
  function asyncGeneratorStep$1q(gen, resolve, reject, _next, _throw, key, arg) {
2536
2295
  try {
2537
2296
  var info = gen[key](arg);
@@ -2569,12 +2328,6 @@ function _define_property$Z(obj, key, value) {
2569
2328
  } else obj[key] = value;
2570
2329
  return obj;
2571
2330
  }
2572
- function _instanceof$w(left, right) {
2573
- "@swc/helpers - instanceof";
2574
- if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
2575
- return !!right[Symbol.hasInstance](left);
2576
- } else return left instanceof right;
2577
- }
2578
2331
  function _object_spread$Y(target) {
2579
2332
  for(var i = 1; i < arguments.length; i++){
2580
2333
  var source = arguments[i] != null ? arguments[i] : {};
@@ -2707,40 +2460,15 @@ function _ts_generator$1q(thisArg, body) {
2707
2460
  };
2708
2461
  }
2709
2462
  }
2710
- /**
2711
- * The Firebase app name a direct-Firestore session registers for a CLI + env pair.
2712
- *
2713
- * Deriving the name rather than tracking apps in a side registry is what makes ONE app per CLI + env
2714
- * per process a property of the code instead of a convention: {@link createCliFirestoreSessionContext}
2715
- * looks this name up in `getApps()` before initializing, so repeated session opens in one process —
2716
- * a doctor probe alongside a command's own session, an action that re-resolves the accessor — all
2717
- * share a single app, and {@link closeAllCliFirebaseApps} finds it again from the name alone.
2718
- *
2719
- * @param input - The CLI name and env name the session targets.
2720
- * @returns The Firebase app name for that pair.
2721
- * @__NO_SIDE_EFFECTS__
2722
- */ function cliFirebaseAppName(input) {
2723
- return "".concat(input.cliName, "-").concat(input.envName);
2724
- }
2725
2463
  /**
2726
2464
  * Opens a direct Firestore connection as the authenticated CLI user.
2727
2465
  *
2728
- * Steps, in a strict order:
2729
- *
2730
- * 0. When a `sessionCache` is supplied, reuse the env's cached credential envelope if it is still
2731
- * live. Sessions are cached for up to an hour (see `CLI_FIRESTORE_SESSION_MAX_CACHE_MS`), which is
2732
- * the ceiling the Firebase credentials themselves sit under. A hit skips step 1 only — the
2733
- * Firebase app is per-process, so the sign-in in step 5 always runs.
2734
- * 1. `GET <apiBaseUrl>/session/firestore` for a custom token + App Check attestation.
2735
- * 2. `initializeApp` with the env's Firebase client config.
2736
- * 3. `initializeAppCheck` with a `CustomProvider` handing back the server-minted token. **This must
2737
- * happen before any other Firebase call** — `dbx-firebase`'s provider documents the same
2738
- * constraint: "App Check must be initialized before any Firebase request goes out, otherwise
2739
- * requests are sent without an App Check token and are rejected in production." Skipped when the
2740
- * env targets emulators (which do not verify attestations) or when the API minted no token.
2741
- * 4. `getAuth` / `getFirestore`, connecting each to its emulator when configured.
2742
- * 5. `signInWithCustomToken`. The user's stored custom claims land at the top level of the exchanged
2743
- * ID token, so `request.auth.token.<claim>` reads in security rules behave exactly as in the app.
2466
+ * A thin wrapper over `openFirebaseUserSession`: it validates the env's Firebase client config with
2467
+ * the CLI's own env-var-naming remediation, then delegates. The strict step ORDER (mint → fresh app →
2468
+ * App Check FIRST → emulator wiring → sign-in) and its reasoning live with the implementation.
2469
+ *
2470
+ * The session's Firebase app is named `<cliName>::<envName>::<uid>`, so
2471
+ * {@link closeAllCliFirebaseApps} finds every app this CLI opened from the name alone.
2744
2472
  *
2745
2473
  * There is deliberately NO fallback to the HTTP model API — a failure here throws so the operator
2746
2474
  * sees it. `createFirestoreSessionDoctorCheck` is the diagnostic surface for why.
@@ -2750,7 +2478,7 @@ function _ts_generator$1q(thisArg, body) {
2750
2478
  * @throws {CliError} When the env lacks Firebase client config, or any step of the handshake fails.
2751
2479
  */ function createCliFirestoreSessionContext(input) {
2752
2480
  return _async_to_generator$1q(function() {
2753
- var _ref, _getApps_find, _firebase_emulators, _firebase_emulators1, _firebase_emulators2, cliName, envName, env, accessToken, fetcher, sessionCache, _input_refreshSession, refreshSession, firebase, cached, _tmp, liveCached, fromCache, session, _tmp1, appName, app, useEmulators, appCheckToken, expireTimeMillis, emulatorHost, auth, firestore, e;
2481
+ var cliName, envName, env, accessToken, fetcher, sessionCache, _input_refreshSession, refreshSession, firebase, session;
2754
2482
  return _ts_generator$1q(this, function(_state) {
2755
2483
  switch(_state.label){
2756
2484
  case 0:
@@ -2763,168 +2491,30 @@ function _ts_generator$1q(thisArg, body) {
2763
2491
  suggestion: "Set `firebase.apiKey`, `firebase.projectId`, and `firebase.appId` on the env (or via ".concat(cliName.replaceAll('-', '_').toUpperCase(), "_FIREBASE_* environment variables). Copy them from the app's Firebase web app config.")
2764
2492
  });
2765
2493
  }
2766
- if (!(sessionCache && !refreshSession)) return [
2767
- 3,
2768
- 2
2769
- ];
2770
- return [
2771
- 4,
2772
- sessionCache.get(envName)
2773
- ];
2774
- case 1:
2775
- _tmp = _state.sent();
2776
- return [
2777
- 3,
2778
- 3
2779
- ];
2780
- case 2:
2781
- _tmp = undefined;
2782
- _state.label = 3;
2783
- case 3:
2784
- cached = _tmp;
2785
- liveCached = isCliFirestoreSessionExpired(cached) ? undefined : cached;
2786
- fromCache = liveCached != null;
2787
- if (!((_ref = liveCached === null || liveCached === void 0 ? void 0 : liveCached.session) !== null && _ref !== void 0)) return [
2788
- 3,
2789
- 4
2790
- ];
2791
- _tmp1 = _ref;
2792
- return [
2793
- 3,
2794
- 6
2795
- ];
2796
- case 4:
2797
2494
  return [
2798
2495
  4,
2799
- fetchFirestoreSession({
2496
+ openFirebaseUserSession({
2497
+ namespace: cliName,
2498
+ scope: envName,
2499
+ firebase: firebase,
2800
2500
  apiBaseUrl: env.apiBaseUrl,
2801
2501
  accessToken: accessToken,
2802
- fetcher: fetcher
2502
+ fetcher: cliFirestoreSessionFetcher(fetcher),
2503
+ errorFactory: cliFirestoreSessionErrorFactory,
2504
+ // the CLI's cache is keyed by ENV name, not uid: one CLI process serves one user, and the env is
2505
+ // what its on-disk `~/.<cli>/.firestore-sessions.json` has always been keyed by
2506
+ credentialsCache: sessionCache,
2507
+ cacheKey: envName,
2508
+ refreshCredentials: refreshSession
2803
2509
  })
2804
2510
  ];
2805
- case 5:
2806
- _tmp1 = _state.sent();
2807
- _state.label = 6;
2808
- case 6:
2809
- session = _tmp1;
2810
- if (!(!fromCache && sessionCache)) return [
2811
- 3,
2812
- 8
2813
- ];
2814
- return [
2815
- 4,
2816
- sessionCache.set(envName, {
2817
- session: session,
2818
- cachedAt: Date.now(),
2819
- uid: session.uid
2820
- })
2821
- ];
2822
- case 7:
2823
- _state.sent();
2824
- _state.label = 8;
2825
- case 8:
2826
- appName = cliFirebaseAppName({
2827
- cliName: cliName,
2828
- envName: envName
2829
- });
2830
- app = (_getApps_find = getApps().find(function(x) {
2831
- return x.name === appName;
2832
- })) !== null && _getApps_find !== void 0 ? _getApps_find : initializeApp({
2833
- apiKey: firebase.apiKey,
2834
- authDomain: firebase.authDomain,
2835
- projectId: firebase.projectId,
2836
- appId: firebase.appId
2837
- }, appName);
2838
- useEmulators = cliFirebaseEmulatorsInUse(firebase);
2839
- // App Check must be registered on the app before any Firebase request goes out. Mirrors
2840
- // `createDbxFirebaseAppCheck`, which likewise disables App Check whenever emulators are in use.
2841
- if (session.appCheckToken && !useEmulators) {
2842
- appCheckToken = session.appCheckToken;
2843
- expireTimeMillis = expireTimeMillisFromSession(session);
2844
- initializeAppCheck(app, {
2845
- provider: new CustomProvider({
2846
- getToken: function getToken() {
2847
- return _async_to_generator$1q(function() {
2848
- return _ts_generator$1q(this, function(_state) {
2849
- return [
2850
- 2,
2851
- {
2852
- token: appCheckToken,
2853
- expireTimeMillis: expireTimeMillis
2854
- }
2855
- ];
2856
- });
2857
- })();
2858
- }
2859
- }),
2860
- // the token is minted per-session by the API; there is no local attestation to refresh against
2861
- isTokenAutoRefreshEnabled: false
2862
- });
2863
- }
2864
- emulatorHost = ((_firebase_emulators = firebase.emulators) === null || _firebase_emulators === void 0 ? void 0 : _firebase_emulators.host) || DEFAULT_CLI_FIREBASE_EMULATOR_HOST;
2865
- auth = getAuth(app);
2866
- if (useEmulators && ((_firebase_emulators1 = firebase.emulators) === null || _firebase_emulators1 === void 0 ? void 0 : _firebase_emulators1.authPort) != null) {
2867
- connectAuthEmulator(auth, "http://".concat(emulatorHost, ":").concat(firebase.emulators.authPort), {
2868
- disableWarnings: true
2869
- });
2870
- }
2871
- firestore = getFirestore(app);
2872
- if (useEmulators && ((_firebase_emulators2 = firebase.emulators) === null || _firebase_emulators2 === void 0 ? void 0 : _firebase_emulators2.firestorePort) != null) {
2873
- connectFirestoreEmulator(firestore, emulatorHost, firebase.emulators.firestorePort);
2874
- }
2875
- _state.label = 9;
2876
- case 9:
2877
- _state.trys.push([
2878
- 9,
2879
- 11,
2880
- ,
2881
- 14
2882
- ]);
2883
- return [
2884
- 4,
2885
- signInWithCustomToken(auth, session.customToken)
2886
- ];
2887
- case 10:
2888
- _state.sent();
2889
- return [
2890
- 3,
2891
- 14
2892
- ];
2893
- case 11:
2894
- e = _state.sent();
2895
- if (!(fromCache && sessionCache)) return [
2896
- 3,
2897
- 13
2898
- ];
2899
- return [
2900
- 4,
2901
- sessionCache.remove(envName)
2902
- ];
2903
- case 12:
2904
- _state.sent();
2905
- return [
2906
- 2,
2907
- createCliFirestoreSessionContext(_object_spread_props$E(_object_spread$Y({}, input), {
2908
- refreshSession: true
2909
- }))
2910
- ];
2911
- case 13:
2912
- throw new CliError({
2913
- message: "Failed to sign in with the minted custom token: ".concat(_instanceof$w(e, Error) ? e.message : String(e)),
2914
- code: 'AUTH_UNAUTHORIZED',
2915
- suggestion: 'Verify the env `firebase.projectId`/`firebase.apiKey` match the project the API mints tokens for.'
2916
- });
2917
- case 14:
2511
+ case 1:
2512
+ session = _state.sent();
2918
2513
  return [
2919
2514
  2,
2920
- {
2921
- session: session,
2922
- fromCache: fromCache,
2923
- app: app,
2924
- auth: auth,
2925
- firestore: firestore,
2926
- firestoreContext: clientFirebaseFirestoreContextFactory(firestore)
2927
- }
2515
+ _object_spread_props$E(_object_spread$Y({}, session), {
2516
+ session: session.credentials
2517
+ })
2928
2518
  ];
2929
2519
  }
2930
2520
  });
@@ -2935,15 +2525,7 @@ function _ts_generator$1q(thisArg, body) {
2935
2525
  *
2936
2526
  * Required for the CLI to EXIT. A signed-in `Auth` and a live `Firestore` both hold open handles
2937
2527
  * that keep the Node event loop alive indefinitely, so without this a command prints its result and
2938
- * then hangs forever — the process never returns to the shell. Nothing in the CLI is long-lived
2939
- * enough to want that: a session is opened for one invocation and is dead weight afterwards.
2940
- *
2941
- * `deleteApp` is the single call that covers it — it disposes every registered component, which for
2942
- * Firestore runs the same shutdown `terminate()` does, and for Auth stops the token-refresh timer.
2943
- *
2944
- * Deliberately tolerant: teardown runs in a `finally` after the command has already produced its
2945
- * output, so a failure here must not change the exit code or mask the real result. A session that
2946
- * was never opened is a no-op.
2528
+ * then hangs forever — the process never returns to the shell.
2947
2529
  *
2948
2530
  * @param session - The session context to close.
2949
2531
  */ function closeCliFirestoreSessionContext(session) {
@@ -2953,7 +2535,7 @@ function _ts_generator$1q(thisArg, body) {
2953
2535
  case 0:
2954
2536
  return [
2955
2537
  4,
2956
- closeCliFirebaseApp(session.app)
2538
+ closeFirebaseUserSession(session)
2957
2539
  ];
2958
2540
  case 1:
2959
2541
  _state.sent();
@@ -2964,85 +2546,32 @@ function _ts_generator$1q(thisArg, body) {
2964
2546
  });
2965
2547
  })();
2966
2548
  }
2967
- /**
2968
- * Deletes one Firebase app, swallowing any failure.
2969
- *
2970
- * @param app - The app to delete.
2971
- */ function closeCliFirebaseApp(app) {
2972
- return _async_to_generator$1q(function() {
2973
- return _ts_generator$1q(this, function(_state) {
2974
- switch(_state.label){
2975
- case 0:
2976
- _state.trys.push([
2977
- 0,
2978
- 2,
2979
- ,
2980
- 3
2981
- ]);
2982
- return [
2983
- 4,
2984
- deleteApp(app)
2985
- ];
2986
- case 1:
2987
- _state.sent();
2988
- return [
2989
- 3,
2990
- 3
2991
- ];
2992
- case 2:
2993
- _state.sent();
2994
- return [
2995
- 3,
2996
- 3
2997
- ];
2998
- case 3:
2999
- return [
3000
- 2
3001
- ];
3002
- }
3003
- });
3004
- })();
3005
- }
3006
2549
  /**
3007
2550
  * Deletes every still-live Firebase app this CLI opened, whether or not a session was handed back.
3008
2551
  *
3009
- * The CLI's last line of defence against a hang. `closeCliFirestoreSessionContext` covers the normal
3010
- * path, but it needs a session to be handed to it, and three cases never produce one:
2552
+ * The CLI's last line of defence against a hang. {@link closeCliFirestoreSessionContext} covers the
2553
+ * normal path, but it needs a session to be handed to it, and three cases never produce one:
3011
2554
  *
3012
- * - a handshake that fails AFTER `initializeApp` — a rejected custom token, a failed App Check
3013
- * registration — throws, so the caller that catches it has an initialized app and no session;
2555
+ * - a handshake that fails AFTER `initializeApp` — a failed App Check registration, a broken emulator
2556
+ * connection — throws, so the caller that catches it has an initialized app and no session;
3014
2557
  * - a caller that opens its own session outside the context memo (the doctor probe) owns its own
3015
2558
  * teardown, and forgetting it hangs the process;
3016
2559
  * - a {@link CliContext} orphaned mid-invocation carries the only reference to its session memo.
3017
2560
  *
3018
- * Each leaves an app whose `Firestore` and signed-in `Auth` hold the Node event loop open forever.
3019
- * `getApps()` already tracks every live app and `deleteApp` removes it from that list, so the app
3020
- * names {@link cliFirebaseAppName} derives are enough to find them again — no side registry to keep
3021
- * in sync, and idempotent by construction.
3022
- *
3023
- * Tolerant of failures for the same reason {@link closeCliFirestoreSessionContext} is: it runs after
3024
- * the result is already on stdout.
3025
- *
3026
2561
  * @param input - The function inputs.
3027
2562
  * @param input.cliName - The CLI whose apps should be closed. Apps belonging to other Firebase
3028
2563
  * consumers in the same process are left alone.
3029
2564
  * @returns Resolves once every matching app has been deleted.
3030
2565
  */ function closeAllCliFirebaseApps(input) {
3031
2566
  return _async_to_generator$1q(function() {
3032
- var prefix, apps;
3033
2567
  return _ts_generator$1q(this, function(_state) {
3034
2568
  switch(_state.label){
3035
2569
  case 0:
3036
- // every env this process opened a session for, which is normally exactly one
3037
- prefix = "".concat(input.cliName, "-");
3038
- apps = getApps().filter(function(x) {
3039
- return x.name.startsWith(prefix);
3040
- });
3041
2570
  return [
3042
2571
  4,
3043
- Promise.all(apps.map(function(app) {
3044
- return closeCliFirebaseApp(app);
3045
- }))
2572
+ closeFirebaseUserSessionApps({
2573
+ namespace: input.cliName
2574
+ })
3046
2575
  ];
3047
2576
  case 1:
3048
2577
  _state.sent();
@@ -3053,16 +2582,6 @@ function _ts_generator$1q(thisArg, body) {
3053
2582
  });
3054
2583
  })();
3055
2584
  }
3056
- /**
3057
- * Resolves the App Check token's expiry from the session envelope, falling back to a short window
3058
- * when the API returned an unparsable `expiresAt`.
3059
- *
3060
- * @param session - The session envelope returned by the API.
3061
- * @returns The epoch-millis expiry to advertise to the App Check `CustomProvider`.
3062
- */ function expireTimeMillisFromSession(session) {
3063
- var parsed = Date.parse(session.expiresAt);
3064
- return Number.isFinite(parsed) ? parsed : Date.now() + 30 * 60 * 1000;
3065
- }
3066
2585
 
3067
2586
  /**
3068
2587
  * Creates a typed module-level slot.
@@ -7904,6 +7423,43 @@ function resolveCliEnvOrThrow(input) {
7904
7423
  };
7905
7424
  }
7906
7425
 
7426
+ /**
7427
+ * Hard ceiling on how long a minted direct-Firestore session may be reused, regardless of what the
7428
+ * API reported in `expiresAt`. See {@link FIRESTORE_SESSION_MAX_CACHE_MS}.
7429
+ */ var CLI_FIRESTORE_SESSION_MAX_CACHE_MS = FIRESTORE_SESSION_MAX_CACHE_MS;
7430
+ /**
7431
+ * Default skew/latency buffer applied when deciding whether a cached session is still usable. See
7432
+ * {@link FIRESTORE_SESSION_EXPIRY_BUFFER_MS}.
7433
+ */ var CLI_FIRESTORE_SESSION_EXPIRY_BUFFER_MS = FIRESTORE_SESSION_EXPIRY_BUFFER_MS;
7434
+ /**
7435
+ * Creates a per-env direct-Firestore session cache store backed by a single JSON file.
7436
+ *
7437
+ * The file-backed half of the session cache stays HERE rather than moving to
7438
+ * `@dereekb/oauth-resource/firebase`: it depends on `@dereekb/nestjs`, and a Nest peer has no business
7439
+ * in a package whose whole point is a clean install graph. Only the expiry policy and the
7440
+ * {@link FirestoreSessionCredentialsCache} port are shared.
7441
+ *
7442
+ * Entries are written with mode 0o600 — they hold a Firebase custom token, which is a bearer
7443
+ * credential for the user it was minted for.
7444
+ *
7445
+ * @param input - The cache store inputs.
7446
+ * @param input.firestoreSessionCachePath - Absolute path to the JSON file backing the cache.
7447
+ * @returns A {@link CliFirestoreSessionCacheStore} keyed by env name.
7448
+ * @__NO_SIDE_EFFECTS__
7449
+ */ function createCliFirestoreSessionCacheStore(input) {
7450
+ return createMemoizedJsonFileAsyncKeyedValueCache({
7451
+ filePath: input.firestoreSessionCachePath
7452
+ });
7453
+ }
7454
+ /**
7455
+ * Resolves the epoch-millis instant at which a cached session stops being usable. See
7456
+ * {@link firestoreSessionEntryExpiresAt}.
7457
+ */ var cliFirestoreSessionEntryExpiresAt = firestoreSessionEntryExpiresAt;
7458
+ /**
7459
+ * Returns true when the cached session is at or near its effective expiry. See
7460
+ * {@link isFirestoreSessionExpired}.
7461
+ */ var isCliFirestoreSessionExpired = isFirestoreSessionExpired;
7462
+
7907
7463
  /**
7908
7464
  * Creates a per-env token cache store backed by a single JSON file.
7909
7465
  *
@@ -69807,4 +69363,4 @@ function printPaginatedOutput(input) {
69807
69363
  })();
69808
69364
  }
69809
69365
 
69810
- export { ACTIONS_SCAN_CONFIG_FILENAME, ACTION_ENTRY_ROLES, ACTION_ROLE_ORDER, ActionDirectiveEntry, ActionEntry, ActionInputEntry, ActionManifest, ActionOutputEntry, ActionStateEntry, ActionStoreEntry, ActionStoreMethodEntry, ActionStoreObservableEntry, ActionsScanConfig, ActionsScanSection, BUILD_DRIFT_DOCTOR_CHECK_NAME, BUILTIN_AUTH_CLAIMS, BUILTIN_AUTH_ROLES, BUILTIN_AUTH_SCOPES, CALL_MODEL_API_PATH, CALL_PASSTHROUGH_COMMAND, CLI_CLIENT_FIRESTORE_DRIVER_IDENTIFIER, CLI_DATA_CACHE_CYCLE_ERROR_CODE, CLI_DATA_CACHE_FINGERPRINT_LENGTH, CLI_DATA_CACHE_GLOBAL_OPTION_NAMES, CLI_DATA_CACHE_INDEX_FILE_NAME, CLI_DATA_CACHE_SCHEMA_VERSION, CLI_DATA_CACHE_UNSUPPORTED_VALUE_ERROR_CODE, CLI_EXIT_CODE_AUTH, CLI_EXIT_CODE_HANDLER, CLI_FIRESTORE_QUERY_DATASET_PREFIX, CLI_FIRESTORE_QUERY_DATASET_VERSION, CLI_FIRESTORE_SESSION_EXPIRY_BUFFER_MS, CLI_FIRESTORE_SESSION_MAX_CACHE_MS, CLI_FRAMEWORK_PACKAGE_PREFIX, CLI_READ_VIA_EPILOGUE, CLI_READ_VIA_VALUES, CORE_TOPICS, CORE_TOPICS_SET, CSS_UTILITIES_SCAN_CONFIG_FILENAME, CSS_UTILITY_ROLES, CSS_UTILITY_SCOPES, CliError, CssUtilitiesScanConfig, CssUtilitiesScanSection, CssUtilityDeclaration, CssUtilityEntry, CssUtilityManifest, DBX_ACTION_STATE_VALUES, DBX_DOCS_UI_EXAMPLES_SCAN_CONFIG_FILENAME, DBX_DOCS_UI_EXAMPLE_USE_KINDS, DEFAULT_ACTIONS_SCAN_OUT_PATH, DEFAULT_ACTION_COMMAND_NAME, DEFAULT_CLI_DATA_CACHE_CODEC, DEFAULT_CLI_DATA_CACHE_COMMAND_NAME, DEFAULT_CLI_DATA_CACHE_MAX_AGE_HOURS, DEFAULT_CLI_DATA_CACHE_OPTIONS, DEFAULT_CLI_FIREBASE_EMULATOR_HOST, DEFAULT_CLI_HTTP_TIMEOUT_MS, DEFAULT_CLI_OIDC_SCOPES, DEFAULT_CLI_READ_VIA, DEFAULT_CLI_REDIRECT_URI, DEFAULT_CLI_SECRET_PATTERNS, DEFAULT_CSS_UTILITIES_SCAN_OUT_PATH, DEFAULT_DBX_DOCS_UI_EXAMPLES_SCAN_OUT_PATH, DEFAULT_FILTERS_SCAN_OUT_PATH, DEFAULT_FIRESTORE_GET_COMMAND_NAME, DEFAULT_FIRESTORE_QUERIES_COMMAND_NAME, DEFAULT_FIRESTORE_QUERY_COMMAND_NAME, DEFAULT_FORGE_FIELDS_SCAN_OUT_PATH, DEFAULT_MANIFEST_HELP_DATA_FORMAT, DEFAULT_MANIFEST_HELP_MODE, DEFAULT_MANIFEST_MODEL_COMMAND_NAME, DEFAULT_MODEL_DECODE_COMMAND_NAME, DEFAULT_MODEL_INFO_COMMAND_NAME, DEFAULT_MODEL_SNAPSHOT_FIELDS_SCAN_OUT_PATH, DEFAULT_PIPES_SCAN_OUT_PATH, DEFAULT_SCAN_OUT_PATH, DEFAULT_SPECIFIER_KEY, DEFAULT_UI_COMPONENTS_SCAN_OUT_PATH, DEFAULT_UTILS_SCAN_OUT_PATH, DISABLED_CLI_DATA_CACHE_OPTIONS, DOWNSTREAM_CLUSTERS, DUMP_MERGE_MODES, DUMP_OUTPUT_MODES, DbxDocsUiExampleEntry, DbxDocsUiExampleManifest, DbxDocsUiExampleUseEntry, DbxDocsUiExamplesScanConfig, DbxDocsUiExamplesScanSection, DbxMcpConfig, EMPTY_ACTION_REGISTRY, EMPTY_AUTH_REGISTRY, EMPTY_CSS_UTILITY_REGISTRY, EMPTY_DBX_DOCS_UI_EXAMPLES_REGISTRY, EMPTY_FILTER_REGISTRY, EMPTY_FORGE_FIELD_REGISTRY, EMPTY_MODEL_SNAPSHOT_FIELD_REGISTRY, EMPTY_PIPE_REGISTRY, EMPTY_SEMANTIC_TYPE_REGISTRY, EMPTY_TOKEN_REGISTRY, EMPTY_UI_COMPONENT_REGISTRY, EMPTY_UTIL_REGISTRY, ExtractedDbxDocsUiExampleEntrySchema, ExtractedEntrySchema, ExtractedForgeFieldEntrySchema, ExtractedUiEntrySchema, FILTERS_SCAN_CONFIG_FILENAME, FILTER_KINDS, FILTER_KIND_ORDER, FIREBASE_MODELS, FIREBASE_MODEL_GROUPS, FIRESTORE_COLLECTION_UNRESOLVABLE_CODE, FIRESTORE_QUERY_PARENT_REQUIRED_CODE, FIRESTORE_QUERY_UNAVAILABLE_CODE, FIRESTORE_SDK_IDENTITY_STAGE, FIRESTORE_SDK_INSTANCE_MISMATCH_CODE, FIRESTORE_SESSION_API_PATH, FIRESTORE_SESSION_DOCTOR_CHECK_NAME, FORGE_FIELDS_SCAN_CONFIG_FILENAME, FORGE_FIELD_ARRAY_OUTPUTS, FORGE_FIELD_COMPOSITE_SUFFIXES, FORGE_FIELD_TIERS, FORGE_FIELD_WRAPPER_PATTERNS, FORM_FIELDS, FORM_TIER_ORDER, FilterDirectiveEntry, FilterEntry, FilterInputEntry, FilterManifest, FilterPatternEntry, FiltersScanConfig, FiltersScanSection, ForgeFieldEntry, ForgeFieldManifest, ForgeFieldPropertyEntry, ForgeFieldsScanConfig, ForgeFieldsScanSection, GET_COMMAND, GET_MANY_COMMAND, LOOPBACK_REDIRECT_HOSTNAMES, LOOPBACK_REDIRECT_LISTEN_FAILED_ERROR_CODE, LOOPBACK_REDIRECT_TIMEOUT_ERROR_CODE, MAX_MODEL_ACCESS_MULTI_READ_KEYS, MCP_CALL_TYPE_ABBREVIATIONS, MCP_MANIFEST_VERSION, MCP_TOOL_NAME_MAX_LENGTH, MCP_TOOL_NAME_WARN_LENGTH, MODEL_ARCHETYPES, MODEL_ARCHETYPE_ADDON_SLUGS, MODEL_ARCHETYPE_SYNC_MODES, MODEL_IS_SERVER_ONLY_CODE, MODEL_SNAPSHOT_FIELDS_SCAN_CONFIG_FILENAME, MODEL_SNAPSHOT_FIELD_KINDS, MODEL_WRITE_OIDC_SCOPES, MULTIPLE_PAGES_OUTPUT_MODES, ModelSnapshotFieldEntry, ModelSnapshotFieldManifest, ModelSnapshotFieldParamEntry, ModelSnapshotFieldsScanConfig, ModelSnapshotFieldsScanSection, PIPES_SCAN_CONFIG_FILENAME, PIPE_CATEGORIES, PIPE_CATEGORY_ORDER, PIPE_PURITIES, PROMPT_CANCELLED_ERROR_CODE, PipeArgEntry, PipeEntry, PipeManifest, PipesScanConfig, PipesScanSection, RESERVED_MODEL_FOLDERS, ROUTE_MANIFEST_VERSION, ROUTE_MODEL_LIST_TAG, ROUTE_MODEL_TAG, SCAN_CONFIG_FILENAME$1 as SCAN_CONFIG_FILENAME, SERVICE_TOKEN_REQUIRED_OIDC_SCOPES, STANDARD_GLOBAL_OPTION_NAMES, STDIN_NOT_PIPED_ERROR_CODE, SUGGESTED_CLI_LOOPBACK_REDIRECT_PORT, SemanticTypeEntry, SemanticTypeManifest, SemanticTypeScanConfig, TOKEN_ROLES, TOKEN_SOURCES, TokenDefaults, TokenEntry, TokenManifest, UI_COMPONENTS_SCAN_CONFIG_FILENAME, UI_COMPONENT_CATEGORIES, UI_COMPONENT_KINDS, UTILS_SCAN_CONFIG_FILENAME, UTIL_KINDS, UiComponentEntry, UiComponentInputEntry, UiComponentManifest, UiComponentOutputEntry, UiComponentsScanConfig, UiComponentsScanSection, UtilEntry, UtilManifest, UtilParamEntry, UtilsScanConfig, UtilsScanSection, WORKSPACE_AUTH_APPS, WORKSPACE_AUTH_CLAIMS, WORKSPACE_FACTORY_SCAN_EXCLUDE, WORKSPACE_FACTORY_SCAN_INCLUDE, abbreviateMcpCallType, appendCliErrorMapper, applyEnvVarOverrides, assertCliFirestoreQueryCanRun, assertCliFirestoreQueryParentKey, assertCliModelIsNotServerOnly, buildActionCommands, buildActionsManifest, buildAuthorizationUrl, buildCliPaths, buildCssUtilitiesManifest, buildDbxDocsUiExamplesManifest, buildDisambiguatedMcpToolName, buildDispatcherCreditByName, buildDumpFilePath, buildErrorOutput, buildFiltersManifest, buildFirestoreGetCommand, buildFirestoreQueriesCommand, buildFirestoreQueryCommand, buildFirestoreSessionDoctorReadRouting, buildForgeFieldsManifest, buildManifest, buildManifestCommands, buildMcpToolName, buildModelDecodeCommand, buildModelInfoCommand, buildModelSnapshotFieldsManifest, buildPipesManifest, buildRouteManifest, buildRouteTree, buildScanProject, buildUiComponentsManifest, buildUtilsManifest, callModelOverHttp, canonicalCliCacheJson, checkCliDataCacheArgv, clearDownstreamCatalogCache, cliBuildDriftDescription, cliCacheFingerprint, cliDataCacheKey, cliDataCacheMeta, cliDataCacheOptions, cliDataCachePathSegment, cliFirebaseAppName, cliFirebaseEmulatorsInUse, cliFirestoreAccessorFactory, cliFirestoreBinding, cliFirestoreCollectionForQuery, cliFirestoreErrorMapper, cliFirestoreQueryConstraints, cliFirestoreQueryMode, cliFirestoreQueryModeForRules, cliFirestoreSdkIdentitySuggestion, cliFirestoreSessionEntryExpiresAt, cliFirestoreWiringError, cliLifecycleRunner, cliReadResultMeta, closeAllCliFirebaseApps, closeCliFirestoreSessionContext, coerceCliReadVia, collectClassPropertiesWithInheritance, computeRelativeSpecifiers, configureCliDataCacheOptions, configureCliErrorMapper, configureCliSecretPatterns, configureOutputOptions, createActionCommand, createActionRegistry, createActionRegistryFromEntries, createAuthCommand, createAuthMiddleware, createAuthRegistryFromEntries, createCacheCommand, createCallModelCommand, createCli, createCliBuildDriftDoctorCheck, createCliContext, createCliDataCache, createCliFirestoreModels, createCliFirestoreQueryRegistry, createCliFirestoreSessionCacheStore, createCliFirestoreSessionContext, createCliTokenCacheStore, createContextSlot, createCssUtilityRegistry, createCssUtilityRegistryFromEntries, createDbxDocsUiExamplesRegistry, createDbxDocsUiExamplesRegistryFromEntries, createDoctorCommand, createEnvCommand, createFilterRegistry, createFilterRegistryFromEntries, createFirestoreSessionDoctorCheck, createForgeFieldRegistry, createForgeFieldRegistryFromEntries, createModelSnapshotFieldRegistry, createModelSnapshotFieldRegistryFromEntries, createOutputCommand, createOutputMiddleware, createPassthroughAuthMiddleware, createPipeRegistry, createPipeRegistryFromEntries, createSemanticTypeRegistry, createSemanticTypeRegistryFromEntries, createTokenRegistry, createTokenRegistryFromEntries, createUiComponentRegistry, createUiComponentRegistryFromEntries, createUtilRegistry, createUtilRegistryFromEntries, decodeFirestoreModelKey, defaultDoctorChecks, defaultGlobber, defaultReadFile, deriveOptionalFromName, describeCliFirestoreQueryMode, detectDataHelpFormat, detectHelpMode, discoverDownstreamFirebasePackages, discoverDownstreamPackages, discoverOidcMetadata, dumpTimestamp, exchangeAuthorizationCode, expandModelKeys, extractActionEntries, extractAngularInputs, extractAngularOutputs, extractAuthEntries, extractComponentRouteModelTags, extractCssUtilityEntries, extractDbxDocsUiExampleEntries, extractEntries, extractFile, extractFilterEntries, extractForgeFieldEntries, extractModelSnapshotFieldEntries, extractModels, extractPipeEntries, extractUiEntries, extractUrlParamKeys, extractUtilEntries, fetchFirestoreSession, fetchSessionInfo, fetchUserInfo, filterCliFirestoreQueries, filterReadOnlyModelScopes, findAndLoadConfig, findCliEnvDefault, findCliModelManifestEntry, flattenList, formatGeneratedTs, fromCliCacheJson, getBundledManifestsDirectory, getCliContext, getCliEnvVarName, getCliTimeoutMs, getDefaultBundledActionManifestPaths, getDefaultBundledCssUtilityManifestPaths, getDefaultBundledDbxDocsUiExamplesManifestPaths, getDefaultBundledFilterManifestPaths, getDefaultBundledForgeFieldManifestPaths, getDefaultBundledManifestPaths, getDefaultBundledModelFirebaseIndexManifestPaths, getDefaultBundledModelSnapshotFieldManifestPaths, getDefaultBundledPipeManifestPaths, getDefaultBundledTokenManifestPaths, getDefaultBundledUiManifestPaths, getDefaultBundledUtilManifestPaths, getDownstreamCatalog, getFirebaseBucketKeyedByIdModels, getFirebaseDistrictKeyedByIdModels, getFirebaseExternalIdKeyedByIdModels, getFirebaseModel, getFirebaseModelByPrefix, getFirebaseModelGroup, getFirebaseModelGroups, getFirebaseModels, getFirebaseModelsByArchetype, getFirebasePrefixCatalog, getFirebaseRegionKeyedByIdModels, getFirebaseSubcollectionsOf, getFirebaseUserKeyedByIdModels, getFirebaseUserRelatedModels, getModelArchetypeBySlug, getModelArchetypesByAxisValue, getModelArchetypesByCollectionKind, getModelArchetypesBySyncMode, getModelOverFirestore, getModelOverHttp, getMultipleModelsOverFirestore, getMultipleModelsOverHttp, getMultipleModelsOverHttpChunked, getOutputOptions, globToRegex, hasParamSegment, indentLines$1 as indentLines, inspectCliBuildDrift, inspectCliFirestoreSdkIdentity, isCliEnvConfigComplete, isCliFirebaseConfigComplete, isCliFirestoreQueryInvocable, isCliFirestoreSessionExpired, isCliVerbose, isCoreTopic, isEntryExpired, isExportedFromPackage, isStdinPositionalSentinel, isStdinSentinel, isTokenExpired, isVisibleProperty, iterateDbxCliCallModel, loadActionManifests, loadActionRegistry, loadAuthRegistry, loadCliConfig, loadCssUtilityRegistry, loadDbxDocsUiExamplesManifests, loadDbxDocsUiExamplesRegistry, loadFilterManifests, loadFilterRegistry, loadForgeFieldManifests, loadForgeFieldRegistry, loadModelFirebaseIndexManifests, loadModelFirebaseIndexRegistry, loadModelSnapshotFieldManifests, loadModelSnapshotFieldRegistry, loadOrBuildCliCachedData, loadPackageName, loadPipeManifests, loadPipeRegistry, loadRouteTree, loadScanSection, loadSemanticTypeManifests, loadSemanticTypeRegistry, loadTokenManifests, loadTokenRegistry, loadUiComponentManifests, loadUiComponentRegistry, loadUtilManifests, loadUtilRegistry, maskEnv, maskSecret, matchUrlAgainstEntries, mcpManifestKey, mergeCliConfig, mergeCliEnvWithDefault, mergeCliFirebaseConfig, mergeOutputConfig, normalizeCliCacheFilter, normalizePathname, oidcRelyingPartyErrorToCliError, openStreamingDump, openUrlInBrowser, outputError, outputResult, packageNameToSlug, parseAnnotation, parseDeclarations$1 as parseDeclarations, parseFirestoreModelIdentityArgs, parseGetArgs, parseGetManyArgs, parseLoopbackRedirectUri, parsePastedRedirect, parseRouteModelTag, parseScanArgs, pickFields, promptLine, readAllStdin, readCliArtifactPackage, readDirectiveDecorator, readEnvTokenEntry, readPropertyDescription, readSelector, readStdinTokens, readStringProperty, refreshAccessToken, renderCliFirestoreQueryEntry, renderCliFirestoreQueryList, renderDecodedKey, renderGroupedImportLines, renderModelManifestEntry, renderModelManifestFields, renderModelManifestList, renderTable, requireCliContext, requireCliFirestoreContext, requireCliFirestoreModels, requireCliFirestoreSession, resolveActiveEnvName, resolveCliDataCacheOptions, resolveCliEnv, resolveCliEnvOrThrow, resolveCliFirestoreQueryArgs, resolveCliFirestoreQueryEntry, resolveCliModel, resolveCliReadSource, resolveComponentSourceFromSources, resolveDemoClaimsPath, resolveExplicitFirebasePackages, resolveExtendsName, resolveModelArchetype, resolveOutputConfig, resolveOxfmtConfig, resolvePerModelGetKey, resolveRouteSources, revokeToken, runActionsScanCli, runCli, runCliFirestoreQuery, runCssUtilitiesScanCli, runDbxDocsUiExamplesScanCli, runFiltersScanCli, runForgeFieldsScanCli, runModelFirebaseIndexScanCli, runModelSnapshotFieldsScanCli, runPaginatedList, runPipesScanCli, runScanCli, runScanCliBase, runUiComponentsScanCli, runUtilsScanCli, sanitizeString, saveCliConfig, scanFactoryReferences, scoreCandidates, serializeActionManifest, serializeCssUtilityManifest, serializeDbxDocsUiExamplesManifest, serializeFilterManifest, serializeForgeFieldManifest, serializeManifest, serializeModelSnapshotFieldsManifest, serializePipeManifest, serializeUiComponentManifest, serializeUtilManifest, setCliContext, setCliRawArgv, setCliTimeoutMs, setCliVerbose, splitListTagText$1 as splitListTagText, splitSegments, startLoopbackRedirectCapture, stripUrlQueryAndHash, toActionEntryInfo, toCliCacheJson, toFilterEntryInfo, toFormFieldInfo, tracedFetch, truncate, tryMatchSegments, unwrapFenced, validateMcpToolName, verboseLog, withCallModelArgs, withEnv, withMultiplePages, withOutput, withServiceTokenScopes, wrapCommandHandler, wrapSyncCommandHandler, writeGeneratedTsFile };
69366
+ export { ACTIONS_SCAN_CONFIG_FILENAME, ACTION_ENTRY_ROLES, ACTION_ROLE_ORDER, ActionDirectiveEntry, ActionEntry, ActionInputEntry, ActionManifest, ActionOutputEntry, ActionStateEntry, ActionStoreEntry, ActionStoreMethodEntry, ActionStoreObservableEntry, ActionsScanConfig, ActionsScanSection, BUILD_DRIFT_DOCTOR_CHECK_NAME, BUILTIN_AUTH_CLAIMS, BUILTIN_AUTH_ROLES, BUILTIN_AUTH_SCOPES, CALL_MODEL_API_PATH, CALL_PASSTHROUGH_COMMAND, CLI_CLIENT_FIRESTORE_DRIVER_IDENTIFIER, CLI_DATA_CACHE_CYCLE_ERROR_CODE, CLI_DATA_CACHE_FINGERPRINT_LENGTH, CLI_DATA_CACHE_GLOBAL_OPTION_NAMES, CLI_DATA_CACHE_INDEX_FILE_NAME, CLI_DATA_CACHE_SCHEMA_VERSION, CLI_DATA_CACHE_UNSUPPORTED_VALUE_ERROR_CODE, CLI_EXIT_CODE_AUTH, CLI_EXIT_CODE_HANDLER, CLI_FIRESTORE_QUERY_DATASET_PREFIX, CLI_FIRESTORE_QUERY_DATASET_VERSION, CLI_FIRESTORE_SESSION_EXPIRY_BUFFER_MS, CLI_FIRESTORE_SESSION_MAX_CACHE_MS, CLI_FRAMEWORK_PACKAGE_PREFIX, CLI_READ_VIA_EPILOGUE, CLI_READ_VIA_VALUES, CORE_TOPICS, CORE_TOPICS_SET, CSS_UTILITIES_SCAN_CONFIG_FILENAME, CSS_UTILITY_ROLES, CSS_UTILITY_SCOPES, CliError, CssUtilitiesScanConfig, CssUtilitiesScanSection, CssUtilityDeclaration, CssUtilityEntry, CssUtilityManifest, DBX_ACTION_STATE_VALUES, DBX_DOCS_UI_EXAMPLES_SCAN_CONFIG_FILENAME, DBX_DOCS_UI_EXAMPLE_USE_KINDS, DEFAULT_ACTIONS_SCAN_OUT_PATH, DEFAULT_ACTION_COMMAND_NAME, DEFAULT_CLI_DATA_CACHE_CODEC, DEFAULT_CLI_DATA_CACHE_COMMAND_NAME, DEFAULT_CLI_DATA_CACHE_MAX_AGE_HOURS, DEFAULT_CLI_DATA_CACHE_OPTIONS, DEFAULT_CLI_FIREBASE_EMULATOR_HOST, DEFAULT_CLI_HTTP_TIMEOUT_MS, DEFAULT_CLI_OIDC_SCOPES, DEFAULT_CLI_READ_VIA, DEFAULT_CLI_REDIRECT_URI, DEFAULT_CLI_SECRET_PATTERNS, DEFAULT_CSS_UTILITIES_SCAN_OUT_PATH, DEFAULT_DBX_DOCS_UI_EXAMPLES_SCAN_OUT_PATH, DEFAULT_FILTERS_SCAN_OUT_PATH, DEFAULT_FIRESTORE_GET_COMMAND_NAME, DEFAULT_FIRESTORE_QUERIES_COMMAND_NAME, DEFAULT_FIRESTORE_QUERY_COMMAND_NAME, DEFAULT_FORGE_FIELDS_SCAN_OUT_PATH, DEFAULT_MANIFEST_HELP_DATA_FORMAT, DEFAULT_MANIFEST_HELP_MODE, DEFAULT_MANIFEST_MODEL_COMMAND_NAME, DEFAULT_MODEL_DECODE_COMMAND_NAME, DEFAULT_MODEL_INFO_COMMAND_NAME, DEFAULT_MODEL_SNAPSHOT_FIELDS_SCAN_OUT_PATH, DEFAULT_PIPES_SCAN_OUT_PATH, DEFAULT_SCAN_OUT_PATH, DEFAULT_SPECIFIER_KEY, DEFAULT_UI_COMPONENTS_SCAN_OUT_PATH, DEFAULT_UTILS_SCAN_OUT_PATH, DISABLED_CLI_DATA_CACHE_OPTIONS, DOWNSTREAM_CLUSTERS, DUMP_MERGE_MODES, DUMP_OUTPUT_MODES, DbxDocsUiExampleEntry, DbxDocsUiExampleManifest, DbxDocsUiExampleUseEntry, DbxDocsUiExamplesScanConfig, DbxDocsUiExamplesScanSection, DbxMcpConfig, EMPTY_ACTION_REGISTRY, EMPTY_AUTH_REGISTRY, EMPTY_CSS_UTILITY_REGISTRY, EMPTY_DBX_DOCS_UI_EXAMPLES_REGISTRY, EMPTY_FILTER_REGISTRY, EMPTY_FORGE_FIELD_REGISTRY, EMPTY_MODEL_SNAPSHOT_FIELD_REGISTRY, EMPTY_PIPE_REGISTRY, EMPTY_SEMANTIC_TYPE_REGISTRY, EMPTY_TOKEN_REGISTRY, EMPTY_UI_COMPONENT_REGISTRY, EMPTY_UTIL_REGISTRY, ExtractedDbxDocsUiExampleEntrySchema, ExtractedEntrySchema, ExtractedForgeFieldEntrySchema, ExtractedUiEntrySchema, FILTERS_SCAN_CONFIG_FILENAME, FILTER_KINDS, FILTER_KIND_ORDER, FIREBASE_MODELS, FIREBASE_MODEL_GROUPS, FIRESTORE_COLLECTION_UNRESOLVABLE_CODE, FIRESTORE_QUERY_PARENT_REQUIRED_CODE, FIRESTORE_QUERY_UNAVAILABLE_CODE, FIRESTORE_SDK_IDENTITY_STAGE, FIRESTORE_SDK_INSTANCE_MISMATCH_CODE, FIRESTORE_SESSION_DOCTOR_CHECK_NAME, FORGE_FIELDS_SCAN_CONFIG_FILENAME, FORGE_FIELD_ARRAY_OUTPUTS, FORGE_FIELD_COMPOSITE_SUFFIXES, FORGE_FIELD_TIERS, FORGE_FIELD_WRAPPER_PATTERNS, FORM_FIELDS, FORM_TIER_ORDER, FilterDirectiveEntry, FilterEntry, FilterInputEntry, FilterManifest, FilterPatternEntry, FiltersScanConfig, FiltersScanSection, ForgeFieldEntry, ForgeFieldManifest, ForgeFieldPropertyEntry, ForgeFieldsScanConfig, ForgeFieldsScanSection, GET_COMMAND, GET_MANY_COMMAND, LOOPBACK_REDIRECT_HOSTNAMES, LOOPBACK_REDIRECT_LISTEN_FAILED_ERROR_CODE, LOOPBACK_REDIRECT_TIMEOUT_ERROR_CODE, MAX_MODEL_ACCESS_MULTI_READ_KEYS, MCP_CALL_TYPE_ABBREVIATIONS, MCP_MANIFEST_VERSION, MCP_TOOL_NAME_MAX_LENGTH, MCP_TOOL_NAME_WARN_LENGTH, MODEL_ARCHETYPES, MODEL_ARCHETYPE_ADDON_SLUGS, MODEL_ARCHETYPE_SYNC_MODES, MODEL_IS_SERVER_ONLY_CODE, MODEL_SNAPSHOT_FIELDS_SCAN_CONFIG_FILENAME, MODEL_SNAPSHOT_FIELD_KINDS, MODEL_WRITE_OIDC_SCOPES, MULTIPLE_PAGES_OUTPUT_MODES, ModelSnapshotFieldEntry, ModelSnapshotFieldManifest, ModelSnapshotFieldParamEntry, ModelSnapshotFieldsScanConfig, ModelSnapshotFieldsScanSection, PIPES_SCAN_CONFIG_FILENAME, PIPE_CATEGORIES, PIPE_CATEGORY_ORDER, PIPE_PURITIES, PROMPT_CANCELLED_ERROR_CODE, PipeArgEntry, PipeEntry, PipeManifest, PipesScanConfig, PipesScanSection, RESERVED_MODEL_FOLDERS, ROUTE_MANIFEST_VERSION, ROUTE_MODEL_LIST_TAG, ROUTE_MODEL_TAG, SCAN_CONFIG_FILENAME$1 as SCAN_CONFIG_FILENAME, SERVICE_TOKEN_REQUIRED_OIDC_SCOPES, STANDARD_GLOBAL_OPTION_NAMES, STDIN_NOT_PIPED_ERROR_CODE, SUGGESTED_CLI_LOOPBACK_REDIRECT_PORT, SemanticTypeEntry, SemanticTypeManifest, SemanticTypeScanConfig, TOKEN_ROLES, TOKEN_SOURCES, TokenDefaults, TokenEntry, TokenManifest, UI_COMPONENTS_SCAN_CONFIG_FILENAME, UI_COMPONENT_CATEGORIES, UI_COMPONENT_KINDS, UTILS_SCAN_CONFIG_FILENAME, UTIL_KINDS, UiComponentEntry, UiComponentInputEntry, UiComponentManifest, UiComponentOutputEntry, UiComponentsScanConfig, UiComponentsScanSection, UtilEntry, UtilManifest, UtilParamEntry, UtilsScanConfig, UtilsScanSection, WORKSPACE_AUTH_APPS, WORKSPACE_AUTH_CLAIMS, WORKSPACE_FACTORY_SCAN_EXCLUDE, WORKSPACE_FACTORY_SCAN_INCLUDE, abbreviateMcpCallType, appendCliErrorMapper, applyEnvVarOverrides, assertCliFirestoreQueryCanRun, assertCliFirestoreQueryParentKey, assertCliModelIsNotServerOnly, buildActionCommands, buildActionsManifest, buildAuthorizationUrl, buildCliPaths, buildCssUtilitiesManifest, buildDbxDocsUiExamplesManifest, buildDisambiguatedMcpToolName, buildDispatcherCreditByName, buildDumpFilePath, buildErrorOutput, buildFiltersManifest, buildFirestoreGetCommand, buildFirestoreQueriesCommand, buildFirestoreQueryCommand, buildFirestoreSessionDoctorReadRouting, buildForgeFieldsManifest, buildManifest, buildManifestCommands, buildMcpToolName, buildModelDecodeCommand, buildModelInfoCommand, buildModelSnapshotFieldsManifest, buildPipesManifest, buildRouteManifest, buildRouteTree, buildScanProject, buildUiComponentsManifest, buildUtilsManifest, callModelOverHttp, canonicalCliCacheJson, checkCliDataCacheArgv, clearDownstreamCatalogCache, cliBuildDriftDescription, cliCacheFingerprint, cliDataCacheKey, cliDataCacheMeta, cliDataCacheOptions, cliDataCachePathSegment, cliFirebaseEmulatorsInUse, cliFirestoreAccessorFactory, cliFirestoreBinding, cliFirestoreCollectionForQuery, cliFirestoreErrorMapper, cliFirestoreQueryConstraints, cliFirestoreQueryMode, cliFirestoreQueryModeForRules, cliFirestoreSdkIdentitySuggestion, cliFirestoreSessionEntryExpiresAt, cliFirestoreSessionErrorFactory, cliFirestoreSessionFetcher, cliFirestoreWiringError, cliLifecycleRunner, cliReadResultMeta, closeAllCliFirebaseApps, closeCliFirestoreSessionContext, coerceCliReadVia, collectClassPropertiesWithInheritance, computeRelativeSpecifiers, configureCliDataCacheOptions, configureCliErrorMapper, configureCliSecretPatterns, configureOutputOptions, createActionCommand, createActionRegistry, createActionRegistryFromEntries, createAuthCommand, createAuthMiddleware, createAuthRegistryFromEntries, createCacheCommand, createCallModelCommand, createCli, createCliBuildDriftDoctorCheck, createCliContext, createCliDataCache, createCliFirestoreModels, createCliFirestoreQueryRegistry, createCliFirestoreSessionCacheStore, createCliFirestoreSessionContext, createCliTokenCacheStore, createContextSlot, createCssUtilityRegistry, createCssUtilityRegistryFromEntries, createDbxDocsUiExamplesRegistry, createDbxDocsUiExamplesRegistryFromEntries, createDoctorCommand, createEnvCommand, createFilterRegistry, createFilterRegistryFromEntries, createFirestoreSessionDoctorCheck, createForgeFieldRegistry, createForgeFieldRegistryFromEntries, createModelSnapshotFieldRegistry, createModelSnapshotFieldRegistryFromEntries, createOutputCommand, createOutputMiddleware, createPassthroughAuthMiddleware, createPipeRegistry, createPipeRegistryFromEntries, createSemanticTypeRegistry, createSemanticTypeRegistryFromEntries, createTokenRegistry, createTokenRegistryFromEntries, createUiComponentRegistry, createUiComponentRegistryFromEntries, createUtilRegistry, createUtilRegistryFromEntries, decodeFirestoreModelKey, defaultDoctorChecks, defaultGlobber, defaultReadFile, deriveOptionalFromName, describeCliFirestoreQueryMode, detectDataHelpFormat, detectHelpMode, discoverDownstreamFirebasePackages, discoverDownstreamPackages, discoverOidcMetadata, dumpTimestamp, exchangeAuthorizationCode, expandModelKeys, extractActionEntries, extractAngularInputs, extractAngularOutputs, extractAuthEntries, extractComponentRouteModelTags, extractCssUtilityEntries, extractDbxDocsUiExampleEntries, extractEntries, extractFile, extractFilterEntries, extractForgeFieldEntries, extractModelSnapshotFieldEntries, extractModels, extractPipeEntries, extractUiEntries, extractUrlParamKeys, extractUtilEntries, fetchFirestoreSession, fetchSessionInfo, fetchUserInfo, filterCliFirestoreQueries, filterReadOnlyModelScopes, findAndLoadConfig, findCliEnvDefault, findCliModelManifestEntry, flattenList, formatGeneratedTs, fromCliCacheJson, getBundledManifestsDirectory, getCliContext, getCliEnvVarName, getCliTimeoutMs, getDefaultBundledActionManifestPaths, getDefaultBundledCssUtilityManifestPaths, getDefaultBundledDbxDocsUiExamplesManifestPaths, getDefaultBundledFilterManifestPaths, getDefaultBundledForgeFieldManifestPaths, getDefaultBundledManifestPaths, getDefaultBundledModelFirebaseIndexManifestPaths, getDefaultBundledModelSnapshotFieldManifestPaths, getDefaultBundledPipeManifestPaths, getDefaultBundledTokenManifestPaths, getDefaultBundledUiManifestPaths, getDefaultBundledUtilManifestPaths, getDownstreamCatalog, getFirebaseBucketKeyedByIdModels, getFirebaseDistrictKeyedByIdModels, getFirebaseExternalIdKeyedByIdModels, getFirebaseModel, getFirebaseModelByPrefix, getFirebaseModelGroup, getFirebaseModelGroups, getFirebaseModels, getFirebaseModelsByArchetype, getFirebasePrefixCatalog, getFirebaseRegionKeyedByIdModels, getFirebaseSubcollectionsOf, getFirebaseUserKeyedByIdModels, getFirebaseUserRelatedModels, getModelArchetypeBySlug, getModelArchetypesByAxisValue, getModelArchetypesByCollectionKind, getModelArchetypesBySyncMode, getModelOverFirestore, getModelOverHttp, getMultipleModelsOverFirestore, getMultipleModelsOverHttp, getMultipleModelsOverHttpChunked, getOutputOptions, globToRegex, hasParamSegment, indentLines$1 as indentLines, inspectCliBuildDrift, inspectCliFirestoreSdkIdentity, isCliEnvConfigComplete, isCliFirebaseConfigComplete, isCliFirestoreQueryInvocable, isCliFirestoreSessionExpired, isCliVerbose, isCoreTopic, isEntryExpired, isExportedFromPackage, isStdinPositionalSentinel, isStdinSentinel, isTokenExpired, isVisibleProperty, iterateDbxCliCallModel, loadActionManifests, loadActionRegistry, loadAuthRegistry, loadCliConfig, loadCssUtilityRegistry, loadDbxDocsUiExamplesManifests, loadDbxDocsUiExamplesRegistry, loadFilterManifests, loadFilterRegistry, loadForgeFieldManifests, loadForgeFieldRegistry, loadModelFirebaseIndexManifests, loadModelFirebaseIndexRegistry, loadModelSnapshotFieldManifests, loadModelSnapshotFieldRegistry, loadOrBuildCliCachedData, loadPackageName, loadPipeManifests, loadPipeRegistry, loadRouteTree, loadScanSection, loadSemanticTypeManifests, loadSemanticTypeRegistry, loadTokenManifests, loadTokenRegistry, loadUiComponentManifests, loadUiComponentRegistry, loadUtilManifests, loadUtilRegistry, maskEnv, maskSecret, matchUrlAgainstEntries, mcpManifestKey, mergeCliConfig, mergeCliEnvWithDefault, mergeCliFirebaseConfig, mergeOutputConfig, normalizeCliCacheFilter, normalizePathname, oidcRelyingPartyErrorToCliError, openStreamingDump, openUrlInBrowser, outputError, outputResult, packageNameToSlug, parseAnnotation, parseDeclarations$1 as parseDeclarations, parseFirestoreModelIdentityArgs, parseGetArgs, parseGetManyArgs, parseLoopbackRedirectUri, parsePastedRedirect, parseRouteModelTag, parseScanArgs, pickFields, promptLine, readAllStdin, readCliArtifactPackage, readDirectiveDecorator, readEnvTokenEntry, readPropertyDescription, readSelector, readStdinTokens, readStringProperty, refreshAccessToken, renderCliFirestoreQueryEntry, renderCliFirestoreQueryList, renderDecodedKey, renderGroupedImportLines, renderModelManifestEntry, renderModelManifestFields, renderModelManifestList, renderTable, requireCliContext, requireCliFirestoreContext, requireCliFirestoreModels, requireCliFirestoreSession, resolveActiveEnvName, resolveCliDataCacheOptions, resolveCliEnv, resolveCliEnvOrThrow, resolveCliFirestoreQueryArgs, resolveCliFirestoreQueryEntry, resolveCliModel, resolveCliReadSource, resolveComponentSourceFromSources, resolveDemoClaimsPath, resolveExplicitFirebasePackages, resolveExtendsName, resolveModelArchetype, resolveOutputConfig, resolveOxfmtConfig, resolvePerModelGetKey, resolveRouteSources, revokeToken, runActionsScanCli, runCli, runCliFirestoreQuery, runCssUtilitiesScanCli, runDbxDocsUiExamplesScanCli, runFiltersScanCli, runForgeFieldsScanCli, runModelFirebaseIndexScanCli, runModelSnapshotFieldsScanCli, runPaginatedList, runPipesScanCli, runScanCli, runScanCliBase, runUiComponentsScanCli, runUtilsScanCli, sanitizeString, saveCliConfig, scanFactoryReferences, scoreCandidates, serializeActionManifest, serializeCssUtilityManifest, serializeDbxDocsUiExamplesManifest, serializeFilterManifest, serializeForgeFieldManifest, serializeManifest, serializeModelSnapshotFieldsManifest, serializePipeManifest, serializeUiComponentManifest, serializeUtilManifest, setCliContext, setCliRawArgv, setCliTimeoutMs, setCliVerbose, splitListTagText$1 as splitListTagText, splitSegments, startLoopbackRedirectCapture, stripUrlQueryAndHash, toActionEntryInfo, toCliCacheJson, toFilterEntryInfo, toFormFieldInfo, tracedFetch, truncate, tryMatchSegments, unwrapFenced, validateMcpToolName, verboseLog, withCallModelArgs, withEnv, withMultiplePages, withOutput, withServiceTokenScopes, wrapCommandHandler, wrapSyncCommandHandler, writeGeneratedTsFile };