@dereekb/firebase 13.11.16 → 13.11.18

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.
@@ -44,15 +44,15 @@
44
44
  return result;
45
45
  }
46
46
 
47
- function _array_like_to_array$3(arr, len) {
47
+ function _array_like_to_array$5(arr, len) {
48
48
  if (len == null || len > arr.length) len = arr.length;
49
49
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
50
50
  return arr2;
51
51
  }
52
- function _array_with_holes$1(arr) {
52
+ function _array_with_holes$2(arr) {
53
53
  if (Array.isArray(arr)) return arr;
54
54
  }
55
- function _iterable_to_array_limit$1(arr, i) {
55
+ function _iterable_to_array_limit$2(arr, i) {
56
56
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
57
57
  if (_i == null) return;
58
58
  var _arr = [];
@@ -76,19 +76,19 @@ function _iterable_to_array_limit$1(arr, i) {
76
76
  }
77
77
  return _arr;
78
78
  }
79
- function _non_iterable_rest$1() {
79
+ function _non_iterable_rest$2() {
80
80
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
81
81
  }
82
- function _sliced_to_array$1(arr, i) {
83
- return _array_with_holes$1(arr) || _iterable_to_array_limit$1(arr, i) || _unsupported_iterable_to_array$3(arr, i) || _non_iterable_rest$1();
82
+ function _sliced_to_array$2(arr, i) {
83
+ return _array_with_holes$2(arr) || _iterable_to_array_limit$2(arr, i) || _unsupported_iterable_to_array$5(arr, i) || _non_iterable_rest$2();
84
84
  }
85
- function _unsupported_iterable_to_array$3(o, minLen) {
85
+ function _unsupported_iterable_to_array$5(o, minLen) {
86
86
  if (!o) return;
87
- if (typeof o === "string") return _array_like_to_array$3(o, minLen);
87
+ if (typeof o === "string") return _array_like_to_array$5(o, minLen);
88
88
  var n = Object.prototype.toString.call(o).slice(8, -1);
89
89
  if (n === "Object" && o.constructor) n = o.constructor.name;
90
90
  if (n === "Map" || n === "Set") return Array.from(n);
91
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$3(o, minLen);
91
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$5(o, minLen);
92
92
  }
93
93
  var TAG_LINE_REGEX = /^@([A-Za-z_]\w*)\s*(.*)$/;
94
94
  var TYPE_ANNOTATION_REGEX = /^\{([^}]*)\}\s*(.*)$/;
@@ -153,7 +153,7 @@ var LINE_PREFIX_REGEX = /^(\s*\*?\s?)(.*)$/;
153
153
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
154
154
  try {
155
155
  for(var _iterator = lines.entries()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
156
- var _step_value = _sliced_to_array$1(_step.value, 2), i = _step_value[0], line = _step_value[1];
156
+ var _step_value = _sliced_to_array$2(_step.value, 2), i = _step_value[0], line = _step_value[1];
157
157
  if (TAG_LINE_REGEX.test(line.text)) {
158
158
  firstTagIndex = i;
159
159
  break;
@@ -389,30 +389,30 @@ var LINE_PREFIX_REGEX = /^(\s*\*?\s?)(.*)$/;
389
389
  };
390
390
  }
391
391
 
392
- function _array_like_to_array$2(arr, len) {
392
+ function _array_like_to_array$4(arr, len) {
393
393
  if (len == null || len > arr.length) len = arr.length;
394
394
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
395
395
  return arr2;
396
396
  }
397
- function _array_without_holes$1(arr) {
398
- if (Array.isArray(arr)) return _array_like_to_array$2(arr);
397
+ function _array_without_holes$2(arr) {
398
+ if (Array.isArray(arr)) return _array_like_to_array$4(arr);
399
399
  }
400
- function _iterable_to_array$1(iter) {
400
+ function _iterable_to_array$2(iter) {
401
401
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
402
402
  }
403
- function _non_iterable_spread$1() {
403
+ function _non_iterable_spread$2() {
404
404
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
405
405
  }
406
- function _to_consumable_array$1(arr) {
407
- return _array_without_holes$1(arr) || _iterable_to_array$1(arr) || _unsupported_iterable_to_array$2(arr) || _non_iterable_spread$1();
406
+ function _to_consumable_array$2(arr) {
407
+ return _array_without_holes$2(arr) || _iterable_to_array$2(arr) || _unsupported_iterable_to_array$4(arr) || _non_iterable_spread$2();
408
408
  }
409
- function _unsupported_iterable_to_array$2(o, minLen) {
409
+ function _unsupported_iterable_to_array$4(o, minLen) {
410
410
  if (!o) return;
411
- if (typeof o === "string") return _array_like_to_array$2(o, minLen);
411
+ if (typeof o === "string") return _array_like_to_array$4(o, minLen);
412
412
  var n = Object.prototype.toString.call(o).slice(8, -1);
413
413
  if (n === "Object" && o.constructor) n = o.constructor.name;
414
414
  if (n === "Map" || n === "Set") return Array.from(n);
415
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$2(o, minLen);
415
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$4(o, minLen);
416
416
  }
417
417
  /**
418
418
  * Module that publishes the `@dereekb/firebase` Firestore constraint factories (`where`, `orderBy`, etc.).
@@ -458,7 +458,7 @@ function _unsupported_iterable_to_array$2(o, minLen) {
458
458
  * Combined list of every Firestore constraint factory exported from `@dereekb/firebase`. Used
459
459
  * by the body-coherence rule to ensure a tagged factory body contains at least one constraint
460
460
  * call of any kind (index-affecting or pagination) before warning that the marker is orphaned.
461
- */ var DEFAULT_CONSTRAINT_FACTORY_NAMES = _to_consumable_array$1(DEFAULT_INDEX_AFFECTING_CONSTRAINT_NAMES).concat(_to_consumable_array$1(DEFAULT_PAGINATION_CONSTRAINT_NAMES));
461
+ */ var DEFAULT_CONSTRAINT_FACTORY_NAMES = _to_consumable_array$2(DEFAULT_INDEX_AFFECTING_CONSTRAINT_NAMES).concat(_to_consumable_array$2(DEFAULT_PAGINATION_CONSTRAINT_NAMES));
462
462
  /**
463
463
  * Creates an empty {@link ImportRegistry}.
464
464
  *
@@ -590,30 +590,30 @@ function _unsupported_iterable_to_array$2(o, minLen) {
590
590
  return result;
591
591
  }
592
592
 
593
- function _array_like_to_array$1(arr, len) {
593
+ function _array_like_to_array$3(arr, len) {
594
594
  if (len == null || len > arr.length) len = arr.length;
595
595
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
596
596
  return arr2;
597
597
  }
598
- function _array_without_holes(arr) {
599
- if (Array.isArray(arr)) return _array_like_to_array$1(arr);
598
+ function _array_without_holes$1(arr) {
599
+ if (Array.isArray(arr)) return _array_like_to_array$3(arr);
600
600
  }
601
- function _iterable_to_array(iter) {
601
+ function _iterable_to_array$1(iter) {
602
602
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
603
603
  }
604
- function _non_iterable_spread() {
604
+ function _non_iterable_spread$1() {
605
605
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
606
606
  }
607
- function _to_consumable_array(arr) {
608
- return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array$1(arr) || _non_iterable_spread();
607
+ function _to_consumable_array$1(arr) {
608
+ return _array_without_holes$1(arr) || _iterable_to_array$1(arr) || _unsupported_iterable_to_array$3(arr) || _non_iterable_spread$1();
609
609
  }
610
- function _unsupported_iterable_to_array$1(o, minLen) {
610
+ function _unsupported_iterable_to_array$3(o, minLen) {
611
611
  if (!o) return;
612
- if (typeof o === "string") return _array_like_to_array$1(o, minLen);
612
+ if (typeof o === "string") return _array_like_to_array$3(o, minLen);
613
613
  var n = Object.prototype.toString.call(o).slice(8, -1);
614
614
  if (n === "Object" && o.constructor) n = o.constructor.name;
615
615
  if (n === "Map" || n === "Set") return Array.from(n);
616
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$1(o, minLen);
616
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$3(o, minLen);
617
617
  }
618
618
  /**
619
619
  * ESLint rule that forbids inline `@dereekb/firebase` Firestore constraint factory calls
@@ -671,7 +671,7 @@ function _unsupported_iterable_to_array$1(o, minLen) {
671
671
  var options = (_context_options_ = context.options[0]) !== null && _context_options_ !== void 0 ? _context_options_ : {};
672
672
  var sourceCode = context.sourceCode;
673
673
  var baseNames = (_options_constraintNames = options.constraintNames) !== null && _options_constraintNames !== void 0 ? _options_constraintNames : DEFAULT_INDEX_AFFECTING_CONSTRAINT_NAMES;
674
- var constraintNames = new Set(_to_consumable_array(baseNames).concat(_to_consumable_array((_options_additionalConstraintNames = options.additionalConstraintNames) !== null && _options_additionalConstraintNames !== void 0 ? _options_additionalConstraintNames : [])));
674
+ var constraintNames = new Set(_to_consumable_array$1(baseNames).concat(_to_consumable_array$1((_options_additionalConstraintNames = options.additionalConstraintNames) !== null && _options_additionalConstraintNames !== void 0 ? _options_additionalConstraintNames : [])));
675
675
  var allowedSources = new Set((_options_allowedImportSources = options.allowedImportSources) !== null && _options_allowedImportSources !== void 0 ? _options_allowedImportSources : [
676
676
  FIREBASE_MODULE
677
677
  ]);
@@ -941,15 +941,15 @@ var DEFAULT_STRIPPABLE_SUFFIXES = [
941
941
  }
942
942
  };
943
943
 
944
- function _array_like_to_array(arr, len) {
944
+ function _array_like_to_array$2(arr, len) {
945
945
  if (len == null || len > arr.length) len = arr.length;
946
946
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
947
947
  return arr2;
948
948
  }
949
- function _array_with_holes(arr) {
949
+ function _array_with_holes$1(arr) {
950
950
  if (Array.isArray(arr)) return arr;
951
951
  }
952
- function _iterable_to_array_limit(arr, i) {
952
+ function _iterable_to_array_limit$1(arr, i) {
953
953
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
954
954
  if (_i == null) return;
955
955
  var _arr = [];
@@ -973,19 +973,19 @@ function _iterable_to_array_limit(arr, i) {
973
973
  }
974
974
  return _arr;
975
975
  }
976
- function _non_iterable_rest() {
976
+ function _non_iterable_rest$1() {
977
977
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
978
978
  }
979
- function _sliced_to_array(arr, i) {
980
- return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
979
+ function _sliced_to_array$1(arr, i) {
980
+ return _array_with_holes$1(arr) || _iterable_to_array_limit$1(arr, i) || _unsupported_iterable_to_array$2(arr, i) || _non_iterable_rest$1();
981
981
  }
982
- function _unsupported_iterable_to_array(o, minLen) {
982
+ function _unsupported_iterable_to_array$2(o, minLen) {
983
983
  if (!o) return;
984
- if (typeof o === "string") return _array_like_to_array(o, minLen);
984
+ if (typeof o === "string") return _array_like_to_array$2(o, minLen);
985
985
  var n = Object.prototype.toString.call(o).slice(8, -1);
986
986
  if (n === "Object" && o.constructor) n = o.constructor.name;
987
987
  if (n === "Map" || n === "Set") return Array.from(n);
988
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
988
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$2(o, minLen);
989
989
  }
990
990
  /**
991
991
  * Shared helpers for the `@dbx<Family>` companion-tag ESLint rules. Mirrors the
@@ -1268,7 +1268,7 @@ function emitUnknownCompanions(groups, knownSuffixes, emit) {
1268
1268
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
1269
1269
  try {
1270
1270
  for(var _iterator = groups.entries()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
1271
- var _step_value = _sliced_to_array(_step.value, 2), suffix = _step_value[0], instances = _step_value[1];
1271
+ var _step_value = _sliced_to_array$1(_step.value, 2), suffix = _step_value[0], instances = _step_value[1];
1272
1272
  if (knownSuffixes.has(suffix)) continue;
1273
1273
  var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
1274
1274
  try {
@@ -2255,6 +2255,876 @@ function _type_of(obj) {
2255
2255
  }
2256
2256
  };
2257
2257
 
2258
+ function _array_like_to_array$1(arr, len) {
2259
+ if (len == null || len > arr.length) len = arr.length;
2260
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
2261
+ return arr2;
2262
+ }
2263
+ function _array_without_holes(arr) {
2264
+ if (Array.isArray(arr)) return _array_like_to_array$1(arr);
2265
+ }
2266
+ function _iterable_to_array(iter) {
2267
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
2268
+ }
2269
+ function _non_iterable_spread() {
2270
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2271
+ }
2272
+ function _to_consumable_array(arr) {
2273
+ return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array$1(arr) || _non_iterable_spread();
2274
+ }
2275
+ function _unsupported_iterable_to_array$1(o, minLen) {
2276
+ if (!o) return;
2277
+ if (typeof o === "string") return _array_like_to_array$1(o, minLen);
2278
+ var n = Object.prototype.toString.call(o).slice(8, -1);
2279
+ if (n === "Object" && o.constructor) n = o.constructor.name;
2280
+ if (n === "Map" || n === "Set") return Array.from(n);
2281
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$1(o, minLen);
2282
+ }
2283
+ /**
2284
+ * ESLint rule that warns when an `@dereekb/firebase` field-path-narrowing constraint factory
2285
+ * (`where`, `orderBy`) is called without a generic type argument. Without `<Model>`, the
2286
+ * overload falls back to a plain `FieldPathOrStringPath`, so field-name typos and renamed
2287
+ * fields silently compile.
2288
+ *
2289
+ * The expected form is `where<Model>('field', '==', value)` / `orderBy<Model>('field')` so
2290
+ * the field path is constrained to `StringKeyPropertyKeys<Model>`.
2291
+ *
2292
+ * Not auto-fixable: the rule cannot safely infer the correct model type from the surrounding
2293
+ * function signature in an ESLint autofix.
2294
+ */ var FIREBASE_REQUIRE_FIRESTORE_CONSTRAINT_TYPE_PARAMETER_RULE = {
2295
+ meta: {
2296
+ type: 'suggestion',
2297
+ fixable: undefined,
2298
+ docs: {
2299
+ description: 'Require a generic type argument on `@dereekb/firebase` field-path-narrowing Firestore constraint factories (`where`, `orderBy`) so TypeScript verifies the field path against the model.',
2300
+ recommended: true
2301
+ },
2302
+ messages: {
2303
+ missingTypeParameter: '`{{name}}(...)` is missing a generic type parameter. Use `{{name}}<Model>(...)` so TypeScript can verify the field path against the model.'
2304
+ },
2305
+ schema: [
2306
+ {
2307
+ type: 'object',
2308
+ additionalProperties: false,
2309
+ properties: {
2310
+ constraintNames: {
2311
+ type: 'array',
2312
+ items: {
2313
+ type: 'string'
2314
+ }
2315
+ },
2316
+ additionalConstraintNames: {
2317
+ type: 'array',
2318
+ items: {
2319
+ type: 'string'
2320
+ }
2321
+ },
2322
+ allowedImportSources: {
2323
+ type: 'array',
2324
+ items: {
2325
+ type: 'string'
2326
+ }
2327
+ }
2328
+ }
2329
+ }
2330
+ ]
2331
+ },
2332
+ create: function create(context) {
2333
+ var _context_options_, _options_constraintNames, _options_additionalConstraintNames, _options_allowedImportSources;
2334
+ var options = (_context_options_ = context.options[0]) !== null && _context_options_ !== void 0 ? _context_options_ : {};
2335
+ var baseNames = (_options_constraintNames = options.constraintNames) !== null && _options_constraintNames !== void 0 ? _options_constraintNames : DEFAULT_INDEX_AFFECTING_CONSTRAINT_NAMES;
2336
+ var constraintNames = new Set(_to_consumable_array(baseNames).concat(_to_consumable_array((_options_additionalConstraintNames = options.additionalConstraintNames) !== null && _options_additionalConstraintNames !== void 0 ? _options_additionalConstraintNames : [])));
2337
+ var allowedSources = new Set((_options_allowedImportSources = options.allowedImportSources) !== null && _options_allowedImportSources !== void 0 ? _options_allowedImportSources : [
2338
+ FIREBASE_MODULE
2339
+ ]);
2340
+ var registry = createImportRegistry();
2341
+ function isTrackedConstraintCall(node) {
2342
+ var _node_callee;
2343
+ var result = null;
2344
+ if (((_node_callee = node.callee) === null || _node_callee === void 0 ? void 0 : _node_callee.type) === 'Identifier') {
2345
+ var localName = node.callee.name;
2346
+ var source = registry.localToSource.get(localName);
2347
+ if (source && allowedSources.has(source) && isImportedFrom(registry, localName, source)) {
2348
+ var _registry_localToImported_get;
2349
+ var importedName = (_registry_localToImported_get = registry.localToImported.get(localName)) !== null && _registry_localToImported_get !== void 0 ? _registry_localToImported_get : localName;
2350
+ if (constraintNames.has(importedName)) {
2351
+ result = importedName;
2352
+ }
2353
+ }
2354
+ }
2355
+ return result;
2356
+ }
2357
+ function hasTypeArgument(node) {
2358
+ var _node_typeArguments;
2359
+ var args = (_node_typeArguments = node.typeArguments) !== null && _node_typeArguments !== void 0 ? _node_typeArguments : node.typeParameters;
2360
+ return Boolean(args && Array.isArray(args.params) && args.params.length > 0);
2361
+ }
2362
+ return {
2363
+ ImportDeclaration: function ImportDeclaration(node) {
2364
+ return trackImportDeclaration(registry, node);
2365
+ },
2366
+ CallExpression: function CallExpression(node) {
2367
+ var name = isTrackedConstraintCall(node);
2368
+ if (name && !hasTypeArgument(node)) {
2369
+ context.report({
2370
+ node: node.callee,
2371
+ messageId: 'missingTypeParameter',
2372
+ data: {
2373
+ name: name
2374
+ }
2375
+ });
2376
+ }
2377
+ }
2378
+ };
2379
+ }
2380
+ };
2381
+
2382
+ function _array_like_to_array(arr, len) {
2383
+ if (len == null || len > arr.length) len = arr.length;
2384
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
2385
+ return arr2;
2386
+ }
2387
+ function _array_with_holes(arr) {
2388
+ if (Array.isArray(arr)) return arr;
2389
+ }
2390
+ function _iterable_to_array_limit(arr, i) {
2391
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
2392
+ if (_i == null) return;
2393
+ var _arr = [];
2394
+ var _n = true;
2395
+ var _d = false;
2396
+ var _s, _e;
2397
+ try {
2398
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
2399
+ _arr.push(_s.value);
2400
+ if (i && _arr.length === i) break;
2401
+ }
2402
+ } catch (err) {
2403
+ _d = true;
2404
+ _e = err;
2405
+ } finally{
2406
+ try {
2407
+ if (!_n && _i["return"] != null) _i["return"]();
2408
+ } finally{
2409
+ if (_d) throw _e;
2410
+ }
2411
+ }
2412
+ return _arr;
2413
+ }
2414
+ function _non_iterable_rest() {
2415
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2416
+ }
2417
+ function _sliced_to_array(arr, i) {
2418
+ return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
2419
+ }
2420
+ function _unsupported_iterable_to_array(o, minLen) {
2421
+ if (!o) return;
2422
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
2423
+ var n = Object.prototype.toString.call(o).slice(8, -1);
2424
+ if (n === "Object" && o.constructor) n = o.constructor.name;
2425
+ if (n === "Map" || n === "Set") return Array.from(n);
2426
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
2427
+ }
2428
+ /**
2429
+ * Type-reference name that triggers this rule. Variables whose declared type is
2430
+ * `ModelFirebaseCrudFunctionConfigMap<ConfigType, Identity>` will have their
2431
+ * initializer validated against the structure of `ConfigType`.
2432
+ */ var MODEL_FIREBASE_CRUD_FUNCTION_CONFIG_MAP_TYPE_NAME = 'ModelFirebaseCrudFunctionConfigMap';
2433
+ /**
2434
+ * CRUD verb names supported by `ModelFirebaseCrudFunctionConfigMap`. Mirrors the
2435
+ * `create | read | update | delete | query` verbs in the type definition at
2436
+ * `packages/firebase/src/lib/client/function/model.function.factory.ts`.
2437
+ */ var DEFAULT_CRUD_VERB_NAMES = [
2438
+ 'create',
2439
+ 'read',
2440
+ 'update',
2441
+ 'delete',
2442
+ 'query'
2443
+ ];
2444
+ /**
2445
+ * Unwraps `TSAsExpression` and `TSTypeAssertion` wrappers so the rule can see
2446
+ * through type-system escape hatches like `'update:_,resync' as any` or
2447
+ * `'update:_' as const`. These casts are common in real CRUD configs when the
2448
+ * compiler's template-literal union for verb:specifier combinations exceeds
2449
+ * the type checker's combinatorial budget — the whole point of this rule is
2450
+ * to do the structural check that TypeScript gave up on.
2451
+ *
2452
+ * @param node - The AST node to unwrap.
2453
+ * @returns The innermost wrapped expression, or `node` when no cast is present.
2454
+ */ function unwrapTypeAssertion(node) {
2455
+ var current = node;
2456
+ while(current && (current.type === 'TSAsExpression' || current.type === 'TSTypeAssertion') && current.expression){
2457
+ current = current.expression;
2458
+ }
2459
+ return current;
2460
+ }
2461
+ function propertyKeyName(key) {
2462
+ var result = null;
2463
+ if (key) {
2464
+ if (key.type === 'Identifier') {
2465
+ result = key.name;
2466
+ } else if (key.type === 'Literal' && typeof key.value === 'string') {
2467
+ result = key.value;
2468
+ }
2469
+ }
2470
+ return result;
2471
+ }
2472
+ function typeReferenceTypeName(node) {
2473
+ var _node_typeName;
2474
+ var result = null;
2475
+ if ((node === null || node === void 0 ? void 0 : node.type) === 'TSTypeReference' && ((_node_typeName = node.typeName) === null || _node_typeName === void 0 ? void 0 : _node_typeName.type) === 'Identifier') {
2476
+ result = node.typeName.name;
2477
+ }
2478
+ return result;
2479
+ }
2480
+ function typeArgumentNodes(node) {
2481
+ var _node_typeArguments;
2482
+ var args = (_node_typeArguments = node.typeArguments) !== null && _node_typeArguments !== void 0 ? _node_typeArguments : node.typeParameters;
2483
+ return args && Array.isArray(args.params) ? args.params : [];
2484
+ }
2485
+ function findTypeAliasDeclaration(program, name) {
2486
+ var result = null;
2487
+ if (program && Array.isArray(program.body)) {
2488
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
2489
+ try {
2490
+ for(var _iterator = program.body[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
2491
+ var statement = _step.value;
2492
+ var _statement_declaration, _candidate_id;
2493
+ if (result) break;
2494
+ var candidate = null;
2495
+ if ((statement === null || statement === void 0 ? void 0 : statement.type) === 'TSTypeAliasDeclaration') {
2496
+ candidate = statement;
2497
+ } else if ((statement === null || statement === void 0 ? void 0 : statement.type) === 'ExportNamedDeclaration' && ((_statement_declaration = statement.declaration) === null || _statement_declaration === void 0 ? void 0 : _statement_declaration.type) === 'TSTypeAliasDeclaration') {
2498
+ candidate = statement.declaration;
2499
+ }
2500
+ if ((candidate === null || candidate === void 0 ? void 0 : (_candidate_id = candidate.id) === null || _candidate_id === void 0 ? void 0 : _candidate_id.type) === 'Identifier' && candidate.id.name === name) {
2501
+ result = candidate;
2502
+ }
2503
+ }
2504
+ } catch (err) {
2505
+ _didIteratorError = true;
2506
+ _iteratorError = err;
2507
+ } finally{
2508
+ try {
2509
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
2510
+ _iterator.return();
2511
+ }
2512
+ } finally{
2513
+ if (_didIteratorError) {
2514
+ throw _iteratorError;
2515
+ }
2516
+ }
2517
+ }
2518
+ }
2519
+ return result;
2520
+ }
2521
+ function extractVerbShape(verbKey, verbValueNode) {
2522
+ var specifiers = null;
2523
+ if ((verbValueNode === null || verbValueNode === void 0 ? void 0 : verbValueNode.type) === 'TSTypeLiteral' && Array.isArray(verbValueNode.members)) {
2524
+ specifiers = new Set();
2525
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
2526
+ try {
2527
+ for(var _iterator = verbValueNode.members[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
2528
+ var inner = _step.value;
2529
+ if ((inner === null || inner === void 0 ? void 0 : inner.type) === 'TSPropertySignature') {
2530
+ var specName = propertyKeyName(inner.key);
2531
+ if (specName) {
2532
+ specifiers.add(specName);
2533
+ }
2534
+ }
2535
+ }
2536
+ } catch (err) {
2537
+ _didIteratorError = true;
2538
+ _iteratorError = err;
2539
+ } finally{
2540
+ try {
2541
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
2542
+ _iterator.return();
2543
+ }
2544
+ } finally{
2545
+ if (_didIteratorError) {
2546
+ throw _iteratorError;
2547
+ }
2548
+ }
2549
+ }
2550
+ }
2551
+ return {
2552
+ verb: verbKey,
2553
+ specifiers: specifiers
2554
+ };
2555
+ }
2556
+ function extractModelShape(input) {
2557
+ var typeName = input.typeName, modelKey = input.modelKey, modelAnnotation = input.modelAnnotation, verbNames = input.verbNames, context = input.context;
2558
+ var verbs = new Map();
2559
+ if ((modelAnnotation === null || modelAnnotation === void 0 ? void 0 : modelAnnotation.type) === 'TSTypeLiteral' && Array.isArray(modelAnnotation.members)) {
2560
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
2561
+ try {
2562
+ for(var _iterator = modelAnnotation.members[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
2563
+ var verbMember = _step.value;
2564
+ var _verbMember_typeAnnotation;
2565
+ if ((verbMember === null || verbMember === void 0 ? void 0 : verbMember.type) !== 'TSPropertySignature') continue;
2566
+ var verbName = propertyKeyName(verbMember.key);
2567
+ if (!verbName) continue;
2568
+ if (!verbNames.has(verbName)) {
2569
+ context.report({
2570
+ node: verbMember,
2571
+ messageId: 'unsupportedVerbInType',
2572
+ data: {
2573
+ key: modelKey,
2574
+ verb: verbName,
2575
+ typeName: typeName
2576
+ }
2577
+ });
2578
+ continue;
2579
+ }
2580
+ var verbValue = (_verbMember_typeAnnotation = verbMember.typeAnnotation) === null || _verbMember_typeAnnotation === void 0 ? void 0 : _verbMember_typeAnnotation.typeAnnotation;
2581
+ verbs.set(verbName, extractVerbShape(verbName, verbValue));
2582
+ }
2583
+ } catch (err) {
2584
+ _didIteratorError = true;
2585
+ _iteratorError = err;
2586
+ } finally{
2587
+ try {
2588
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
2589
+ _iterator.return();
2590
+ }
2591
+ } finally{
2592
+ if (_didIteratorError) {
2593
+ throw _iteratorError;
2594
+ }
2595
+ }
2596
+ }
2597
+ }
2598
+ return {
2599
+ key: modelKey,
2600
+ disabled: false,
2601
+ verbs: verbs
2602
+ };
2603
+ }
2604
+ function extractExpectedConfigShape(input) {
2605
+ var typeName = input.typeName, typeAlias = input.typeAlias, verbNames = input.verbNames, context = input.context;
2606
+ var result = null;
2607
+ var typeAnnotation = typeAlias.typeAnnotation;
2608
+ if ((typeAnnotation === null || typeAnnotation === void 0 ? void 0 : typeAnnotation.type) !== 'TSTypeLiteral' || !Array.isArray(typeAnnotation.members)) {
2609
+ context.report({
2610
+ node: typeAlias,
2611
+ messageId: 'expectedTypeLiteral',
2612
+ data: {
2613
+ name: typeName
2614
+ }
2615
+ });
2616
+ } else {
2617
+ var models = new Map();
2618
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
2619
+ try {
2620
+ for(var _iterator = typeAnnotation.members[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
2621
+ var member = _step.value;
2622
+ var _member_typeAnnotation;
2623
+ if ((member === null || member === void 0 ? void 0 : member.type) !== 'TSPropertySignature') continue;
2624
+ var modelKey = propertyKeyName(member.key);
2625
+ if (!modelKey) continue;
2626
+ var modelAnnotation = (_member_typeAnnotation = member.typeAnnotation) === null || _member_typeAnnotation === void 0 ? void 0 : _member_typeAnnotation.typeAnnotation;
2627
+ if ((modelAnnotation === null || modelAnnotation === void 0 ? void 0 : modelAnnotation.type) === 'TSNullKeyword') {
2628
+ models.set(modelKey, {
2629
+ key: modelKey,
2630
+ disabled: true,
2631
+ verbs: new Map()
2632
+ });
2633
+ } else if ((modelAnnotation === null || modelAnnotation === void 0 ? void 0 : modelAnnotation.type) === 'TSTypeLiteral') {
2634
+ models.set(modelKey, extractModelShape({
2635
+ typeName: typeName,
2636
+ modelKey: modelKey,
2637
+ modelAnnotation: modelAnnotation,
2638
+ verbNames: verbNames,
2639
+ context: context
2640
+ }));
2641
+ } else {
2642
+ context.report({
2643
+ node: member,
2644
+ messageId: 'unsupportedConfigShape',
2645
+ data: {
2646
+ key: modelKey,
2647
+ typeName: typeName
2648
+ }
2649
+ });
2650
+ }
2651
+ }
2652
+ } catch (err) {
2653
+ _didIteratorError = true;
2654
+ _iteratorError = err;
2655
+ } finally{
2656
+ try {
2657
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
2658
+ _iterator.return();
2659
+ }
2660
+ } finally{
2661
+ if (_didIteratorError) {
2662
+ throw _iteratorError;
2663
+ }
2664
+ }
2665
+ }
2666
+ result = {
2667
+ typeName: typeName,
2668
+ models: models
2669
+ };
2670
+ }
2671
+ return result;
2672
+ }
2673
+ function parseEntryString(value) {
2674
+ var colonIndex = value.indexOf(':');
2675
+ var verb = colonIndex === -1 ? value : value.slice(0, colonIndex);
2676
+ var hasSpecifiersPortion = colonIndex !== -1;
2677
+ var specifiersCsv = hasSpecifiersPortion ? value.slice(colonIndex + 1) : '';
2678
+ return {
2679
+ entry: value,
2680
+ verb: verb,
2681
+ hasSpecifiersPortion: hasSpecifiersPortion,
2682
+ specifiersCsv: specifiersCsv
2683
+ };
2684
+ }
2685
+ function validateSpecifierList(input) {
2686
+ var element = input.element, modelKey = input.modelKey, verb = input.verb, specifiersCsv = input.specifiersCsv, expectedSpecifiers = input.expectedSpecifiers, typeName = input.typeName, context = input.context;
2687
+ var actualSpecifiers = new Set();
2688
+ var rawSpecifiers = specifiersCsv.split(',').map(function(s) {
2689
+ return s.trim();
2690
+ });
2691
+ var specifierError = false;
2692
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
2693
+ try {
2694
+ for(var _iterator = rawSpecifiers[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
2695
+ var specifier = _step.value;
2696
+ if (specifier === '') {
2697
+ context.report({
2698
+ node: element,
2699
+ messageId: 'emptySpecifierInEntry',
2700
+ data: {
2701
+ key: modelKey,
2702
+ verb: verb
2703
+ }
2704
+ });
2705
+ specifierError = true;
2706
+ continue;
2707
+ }
2708
+ if (actualSpecifiers.has(specifier)) {
2709
+ context.report({
2710
+ node: element,
2711
+ messageId: 'duplicateSpecifierInEntry',
2712
+ data: {
2713
+ key: modelKey,
2714
+ verb: verb,
2715
+ specifier: specifier
2716
+ }
2717
+ });
2718
+ specifierError = true;
2719
+ continue;
2720
+ }
2721
+ actualSpecifiers.add(specifier);
2722
+ if (!expectedSpecifiers.has(specifier)) {
2723
+ context.report({
2724
+ node: element,
2725
+ messageId: 'unknownSpecifier',
2726
+ data: {
2727
+ key: modelKey,
2728
+ verb: verb,
2729
+ specifier: specifier,
2730
+ typeName: typeName
2731
+ }
2732
+ });
2733
+ specifierError = true;
2734
+ }
2735
+ }
2736
+ } catch (err) {
2737
+ _didIteratorError = true;
2738
+ _iteratorError = err;
2739
+ } finally{
2740
+ try {
2741
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
2742
+ _iterator.return();
2743
+ }
2744
+ } finally{
2745
+ if (_didIteratorError) {
2746
+ throw _iteratorError;
2747
+ }
2748
+ }
2749
+ }
2750
+ if (!specifierError) {
2751
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
2752
+ try {
2753
+ for(var _iterator1 = expectedSpecifiers[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
2754
+ var expected = _step1.value;
2755
+ if (!actualSpecifiers.has(expected)) {
2756
+ context.report({
2757
+ node: element,
2758
+ messageId: 'missingSpecifier',
2759
+ data: {
2760
+ key: modelKey,
2761
+ verb: verb,
2762
+ specifier: expected
2763
+ }
2764
+ });
2765
+ }
2766
+ }
2767
+ } catch (err) {
2768
+ _didIteratorError1 = true;
2769
+ _iteratorError1 = err;
2770
+ } finally{
2771
+ try {
2772
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
2773
+ _iterator1.return();
2774
+ }
2775
+ } finally{
2776
+ if (_didIteratorError1) {
2777
+ throw _iteratorError1;
2778
+ }
2779
+ }
2780
+ }
2781
+ }
2782
+ }
2783
+ function validateEntry(input) {
2784
+ var element = input.element, modelKey = input.modelKey, expectedModel = input.expectedModel, typeName = input.typeName, seenVerbs = input.seenVerbs, context = input.context;
2785
+ var unwrapped = unwrapTypeAssertion(element);
2786
+ if (unwrapped.type !== 'Literal' || typeof unwrapped.value !== 'string') {
2787
+ context.report({
2788
+ node: element,
2789
+ messageId: 'expectedStringArray',
2790
+ data: {
2791
+ key: modelKey
2792
+ }
2793
+ });
2794
+ return;
2795
+ }
2796
+ var parsed = parseEntryString(unwrapped.value);
2797
+ var expectedVerb = expectedModel.verbs.get(parsed.verb);
2798
+ if (!expectedVerb) {
2799
+ context.report({
2800
+ node: element,
2801
+ messageId: 'unknownVerbInEntry',
2802
+ data: {
2803
+ key: modelKey,
2804
+ verb: parsed.verb,
2805
+ entry: parsed.entry,
2806
+ typeName: typeName
2807
+ }
2808
+ });
2809
+ return;
2810
+ }
2811
+ if (seenVerbs.has(parsed.verb)) {
2812
+ context.report({
2813
+ node: element,
2814
+ messageId: 'duplicateVerbInEntry',
2815
+ data: {
2816
+ key: modelKey,
2817
+ verb: parsed.verb
2818
+ }
2819
+ });
2820
+ return;
2821
+ }
2822
+ seenVerbs.add(parsed.verb);
2823
+ if (expectedVerb.specifiers == null) {
2824
+ if (parsed.hasSpecifiersPortion) {
2825
+ context.report({
2826
+ node: element,
2827
+ messageId: 'unexpectedSpecifiersForVerb',
2828
+ data: {
2829
+ key: modelKey,
2830
+ verb: parsed.verb,
2831
+ entry: parsed.entry
2832
+ }
2833
+ });
2834
+ }
2835
+ return;
2836
+ }
2837
+ if (!parsed.hasSpecifiersPortion) {
2838
+ context.report({
2839
+ node: element,
2840
+ messageId: 'missingSpecifiersForVerb',
2841
+ data: {
2842
+ key: modelKey,
2843
+ verb: parsed.verb,
2844
+ entry: parsed.entry
2845
+ }
2846
+ });
2847
+ return;
2848
+ }
2849
+ validateSpecifierList({
2850
+ element: element,
2851
+ modelKey: modelKey,
2852
+ verb: parsed.verb,
2853
+ specifiersCsv: parsed.specifiersCsv,
2854
+ expectedSpecifiers: expectedVerb.specifiers,
2855
+ typeName: typeName,
2856
+ context: context
2857
+ });
2858
+ }
2859
+ function validateModelEntry(input) {
2860
+ var modelKey = input.modelKey, expectedModel = input.expectedModel, valueNode = input.valueNode, typeName = input.typeName, context = input.context;
2861
+ var unwrapped = unwrapTypeAssertion(valueNode);
2862
+ if ((unwrapped === null || unwrapped === void 0 ? void 0 : unwrapped.type) !== 'ArrayExpression' || !Array.isArray(unwrapped.elements)) {
2863
+ context.report({
2864
+ node: valueNode,
2865
+ messageId: 'expectedStringArray',
2866
+ data: {
2867
+ key: modelKey
2868
+ }
2869
+ });
2870
+ return;
2871
+ }
2872
+ var seenVerbs = new Set();
2873
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
2874
+ try {
2875
+ for(var _iterator = unwrapped.elements[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
2876
+ var element = _step.value;
2877
+ if (element == null) continue;
2878
+ validateEntry({
2879
+ element: element,
2880
+ modelKey: modelKey,
2881
+ expectedModel: expectedModel,
2882
+ typeName: typeName,
2883
+ seenVerbs: seenVerbs,
2884
+ context: context
2885
+ });
2886
+ }
2887
+ } catch (err) {
2888
+ _didIteratorError = true;
2889
+ _iteratorError = err;
2890
+ } finally{
2891
+ try {
2892
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
2893
+ _iterator.return();
2894
+ }
2895
+ } finally{
2896
+ if (_didIteratorError) {
2897
+ throw _iteratorError;
2898
+ }
2899
+ }
2900
+ }
2901
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
2902
+ try {
2903
+ for(var _iterator1 = expectedModel.verbs.keys()[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
2904
+ var expectedVerbName = _step1.value;
2905
+ if (!seenVerbs.has(expectedVerbName)) {
2906
+ context.report({
2907
+ node: valueNode,
2908
+ messageId: 'missingVerb',
2909
+ data: {
2910
+ key: modelKey,
2911
+ verb: expectedVerbName,
2912
+ typeName: typeName
2913
+ }
2914
+ });
2915
+ }
2916
+ }
2917
+ } catch (err) {
2918
+ _didIteratorError1 = true;
2919
+ _iteratorError1 = err;
2920
+ } finally{
2921
+ try {
2922
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
2923
+ _iterator1.return();
2924
+ }
2925
+ } finally{
2926
+ if (_didIteratorError1) {
2927
+ throw _iteratorError1;
2928
+ }
2929
+ }
2930
+ }
2931
+ }
2932
+ /**
2933
+ * ESLint rule that verifies every `ModelFirebaseCrudFunctionConfigMap<ConfigType, ...>`
2934
+ * variable initializer is structurally complete against its companion `ConfigType`
2935
+ * defined in the same file.
2936
+ *
2937
+ * The rule walks the type alias for `ConfigType` (e.g., `NotificationBoxModelCrudFunctionsConfig`),
2938
+ * builds the expected set of model keys, verbs, and specifiers, and then compares it
2939
+ * against the object-literal initializer of the variable. Each mismatch — missing model
2940
+ * key, missing verb, missing specifier, disabled-but-present key, etc. — is reported as
2941
+ * an error so the const stays in sync with its companion type even when the TypeScript
2942
+ * mapped-type enforcement decays in larger codebases.
2943
+ *
2944
+ * Same-file resolution only: the companion type must be declared in the same source
2945
+ * file as the const (matching the convention in `notification.api.ts`, `oidcmodel.api.ts`,
2946
+ * `storagefile.api.ts`). When the type cannot be located, the rule reports
2947
+ * `configTypeNotFound`.
2948
+ */ var FIREBASE_REQUIRE_COMPLETE_CRUD_FUNCTION_CONFIG_MAP_RULE = {
2949
+ meta: {
2950
+ type: 'problem',
2951
+ fixable: undefined,
2952
+ docs: {
2953
+ description: 'Require that a `ModelFirebaseCrudFunctionConfigMap<ConfigType, Identity>` initializer matches the model keys, verbs, and specifiers declared by its companion `ConfigType` defined in the same file.',
2954
+ recommended: true
2955
+ },
2956
+ messages: {
2957
+ configTypeNotFound: 'Companion type "{{name}}" not found in the same file. Define the *CrudFunctionsConfig type alongside the const so the rule can verify it.',
2958
+ expectedTypeLiteral: 'Companion type "{{name}}" must be an inline type literal (object type) so the rule can verify it.',
2959
+ expectedObjectLiteral: 'CRUD config map initializer must be an inline object literal so the rule can verify it.',
2960
+ expectedStringArray: 'CRUD entry for "{{key}}" must be an array of string literals.',
2961
+ missingModelKey: 'CRUD config is missing model key "{{key}}". The type "{{typeName}}" declares it as enabled (not null).',
2962
+ disabledModelKeyPresent: 'Model key "{{key}}" is disabled (null) in "{{typeName}}" and must not appear in the CRUD config.',
2963
+ unknownModelKey: 'Model key "{{key}}" is not declared in "{{typeName}}".',
2964
+ missingVerb: 'CRUD entry for "{{key}}" is missing verb "{{verb}}" declared in "{{typeName}}".',
2965
+ unknownVerbInEntry: 'CRUD entry "{{entry}}" for "{{key}}" uses verb "{{verb}}" which is not declared in "{{typeName}}".',
2966
+ duplicateVerbInEntry: 'CRUD entry for "{{key}}" declares verb "{{verb}}" more than once.',
2967
+ missingSpecifier: 'CRUD entry for "{{key}}.{{verb}}" is missing specifier "{{specifier}}".',
2968
+ unknownSpecifier: 'CRUD entry for "{{key}}.{{verb}}" declares specifier "{{specifier}}" which is not in "{{typeName}}".',
2969
+ duplicateSpecifierInEntry: 'CRUD entry for "{{key}}.{{verb}}" declares specifier "{{specifier}}" more than once.',
2970
+ emptySpecifierInEntry: 'CRUD entry for "{{key}}.{{verb}}" contains an empty specifier (check for stray commas).',
2971
+ missingSpecifiersForVerb: 'CRUD entry "{{entry}}" for "{{key}}.{{verb}}" is missing its specifier list (expected `{{verb}}:<specifier>,...`).',
2972
+ unexpectedSpecifiersForVerb: 'CRUD entry "{{entry}}" for "{{key}}.{{verb}}" includes specifiers but the type declares the verb without any.',
2973
+ unsupportedConfigShape: 'Property "{{key}}" in "{{typeName}}" has an unsupported shape. Expected null or an object type with verbs.',
2974
+ unsupportedVerbInType: 'Verb "{{verb}}" on "{{key}}" in "{{typeName}}" is not a recognized CRUD verb. Expected one of: create, read, update, delete, query.'
2975
+ },
2976
+ schema: [
2977
+ {
2978
+ type: 'object',
2979
+ additionalProperties: false,
2980
+ properties: {
2981
+ typeName: {
2982
+ type: 'string'
2983
+ },
2984
+ verbNames: {
2985
+ type: 'array',
2986
+ items: {
2987
+ type: 'string'
2988
+ }
2989
+ }
2990
+ }
2991
+ }
2992
+ ]
2993
+ },
2994
+ create: function create(context) {
2995
+ var _context_options_, _options_typeName, _options_verbNames;
2996
+ var options = (_context_options_ = context.options[0]) !== null && _context_options_ !== void 0 ? _context_options_ : {};
2997
+ var triggerTypeName = (_options_typeName = options.typeName) !== null && _options_typeName !== void 0 ? _options_typeName : MODEL_FIREBASE_CRUD_FUNCTION_CONFIG_MAP_TYPE_NAME;
2998
+ var verbNames = new Set((_options_verbNames = options.verbNames) !== null && _options_verbNames !== void 0 ? _options_verbNames : DEFAULT_CRUD_VERB_NAMES);
2999
+ var programNode = null;
3000
+ return {
3001
+ Program: function Program(node) {
3002
+ programNode = node;
3003
+ },
3004
+ VariableDeclarator: function VariableDeclarator(node) {
3005
+ var _node_id_typeAnnotation, _node_id;
3006
+ var typeAnnotation = (_node_id = node.id) === null || _node_id === void 0 ? void 0 : (_node_id_typeAnnotation = _node_id.typeAnnotation) === null || _node_id_typeAnnotation === void 0 ? void 0 : _node_id_typeAnnotation.typeAnnotation;
3007
+ if (typeReferenceTypeName(typeAnnotation) !== triggerTypeName) return;
3008
+ var typeArgs = typeArgumentNodes(typeAnnotation);
3009
+ var configTypeArg = typeArgs[0];
3010
+ var configTypeName = typeReferenceTypeName(configTypeArg);
3011
+ if (!configTypeName) return;
3012
+ if (!programNode) return;
3013
+ var typeAlias = findTypeAliasDeclaration(programNode, configTypeName);
3014
+ if (!typeAlias) {
3015
+ context.report({
3016
+ node: configTypeArg,
3017
+ messageId: 'configTypeNotFound',
3018
+ data: {
3019
+ name: configTypeName
3020
+ }
3021
+ });
3022
+ return;
3023
+ }
3024
+ var expected = extractExpectedConfigShape({
3025
+ typeName: configTypeName,
3026
+ typeAlias: typeAlias,
3027
+ verbNames: verbNames,
3028
+ context: context
3029
+ });
3030
+ if (!expected) return;
3031
+ var initializer = node.init ? unwrapTypeAssertion(node.init) : null;
3032
+ if ((initializer === null || initializer === void 0 ? void 0 : initializer.type) !== 'ObjectExpression' || !Array.isArray(initializer.properties)) {
3033
+ var _node_init;
3034
+ context.report({
3035
+ node: (_node_init = node.init) !== null && _node_init !== void 0 ? _node_init : node,
3036
+ messageId: 'expectedObjectLiteral'
3037
+ });
3038
+ return;
3039
+ }
3040
+ var seenKeys = new Set();
3041
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
3042
+ try {
3043
+ for(var _iterator = initializer.properties[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
3044
+ var property = _step.value;
3045
+ if ((property === null || property === void 0 ? void 0 : property.type) !== 'Property') continue;
3046
+ var modelKey = propertyKeyName(property.key);
3047
+ if (!modelKey) continue;
3048
+ seenKeys.add(modelKey);
3049
+ var expectedModel = expected.models.get(modelKey);
3050
+ if (!expectedModel) {
3051
+ context.report({
3052
+ node: property.key,
3053
+ messageId: 'unknownModelKey',
3054
+ data: {
3055
+ key: modelKey,
3056
+ typeName: configTypeName
3057
+ }
3058
+ });
3059
+ continue;
3060
+ }
3061
+ if (expectedModel.disabled) {
3062
+ context.report({
3063
+ node: property.key,
3064
+ messageId: 'disabledModelKeyPresent',
3065
+ data: {
3066
+ key: modelKey,
3067
+ typeName: configTypeName
3068
+ }
3069
+ });
3070
+ continue;
3071
+ }
3072
+ validateModelEntry({
3073
+ modelKey: modelKey,
3074
+ expectedModel: expectedModel,
3075
+ valueNode: property.value,
3076
+ typeName: configTypeName,
3077
+ context: context
3078
+ });
3079
+ }
3080
+ } catch (err) {
3081
+ _didIteratorError = true;
3082
+ _iteratorError = err;
3083
+ } finally{
3084
+ try {
3085
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
3086
+ _iterator.return();
3087
+ }
3088
+ } finally{
3089
+ if (_didIteratorError) {
3090
+ throw _iteratorError;
3091
+ }
3092
+ }
3093
+ }
3094
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
3095
+ try {
3096
+ for(var _iterator1 = expected.models[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
3097
+ var _step_value = _sliced_to_array(_step1.value, 2), expectedKey = _step_value[0], expectedModel1 = _step_value[1];
3098
+ if (!expectedModel1.disabled && !seenKeys.has(expectedKey)) {
3099
+ context.report({
3100
+ node: initializer,
3101
+ messageId: 'missingModelKey',
3102
+ data: {
3103
+ key: expectedKey,
3104
+ typeName: configTypeName
3105
+ }
3106
+ });
3107
+ }
3108
+ }
3109
+ } catch (err) {
3110
+ _didIteratorError1 = true;
3111
+ _iteratorError1 = err;
3112
+ } finally{
3113
+ try {
3114
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
3115
+ _iterator1.return();
3116
+ }
3117
+ } finally{
3118
+ if (_didIteratorError1) {
3119
+ throw _iteratorError1;
3120
+ }
3121
+ }
3122
+ }
3123
+ }
3124
+ };
3125
+ }
3126
+ };
3127
+
2258
3128
  /**
2259
3129
  * ESLint plugin for `@dereekb/firebase` rules.
2260
3130
  *
@@ -2265,7 +3135,9 @@ function _type_of(obj) {
2265
3135
  'require-tagged-firestore-constraints': FIREBASE_REQUIRE_TAGGED_FIRESTORE_CONSTRAINTS_RULE,
2266
3136
  'require-dbx-model-firebase-index-query-suffix': FIREBASE_REQUIRE_DBX_MODEL_FIREBASE_INDEX_QUERY_SUFFIX_RULE,
2267
3137
  'require-dbx-model-firebase-index-companion-tags': FIREBASE_REQUIRE_DBX_MODEL_FIREBASE_INDEX_COMPANION_TAGS_RULE,
2268
- 'require-dbx-model-firebase-index-valid-dispatcher': FIREBASE_REQUIRE_DBX_MODEL_FIREBASE_INDEX_VALID_DISPATCHER_RULE
3138
+ 'require-dbx-model-firebase-index-valid-dispatcher': FIREBASE_REQUIRE_DBX_MODEL_FIREBASE_INDEX_VALID_DISPATCHER_RULE,
3139
+ 'require-firestore-constraint-type-parameter': FIREBASE_REQUIRE_FIRESTORE_CONSTRAINT_TYPE_PARAMETER_RULE,
3140
+ 'require-complete-crud-function-config-map': FIREBASE_REQUIRE_COMPLETE_CRUD_FUNCTION_CONFIG_MAP_RULE
2269
3141
  }
2270
3142
  };
2271
3143
  /**
@@ -2274,4 +3146,4 @@ function _type_of(obj) {
2274
3146
  * @dbxAllowConstantName
2275
3147
  */ var firebaseESLintPlugin = FIREBASE_ESLINT_PLUGIN;
2276
3148
 
2277
- export { DBX_MODEL_FIREBASE_INDEX_MARKER, DEFAULT_CONSTRAINT_FACTORY_NAMES, DEFAULT_INDEX_AFFECTING_CONSTRAINT_NAMES, DEFAULT_PAGINATION_CONSTRAINT_NAMES, FIREBASE_ESLINT_PLUGIN, FIREBASE_MODULE, FIREBASE_REQUIRE_DBX_MODEL_FIREBASE_INDEX_COMPANION_TAGS_RULE, FIREBASE_REQUIRE_DBX_MODEL_FIREBASE_INDEX_QUERY_SUFFIX_RULE, FIREBASE_REQUIRE_DBX_MODEL_FIREBASE_INDEX_VALID_DISPATCHER_RULE, FIREBASE_REQUIRE_TAGGED_FIRESTORE_CONSTRAINTS_RULE, QUERY_SUFFIX, firebaseESLintPlugin };
3149
+ export { DBX_MODEL_FIREBASE_INDEX_MARKER, DEFAULT_CONSTRAINT_FACTORY_NAMES, DEFAULT_CRUD_VERB_NAMES, DEFAULT_INDEX_AFFECTING_CONSTRAINT_NAMES, DEFAULT_PAGINATION_CONSTRAINT_NAMES, FIREBASE_ESLINT_PLUGIN, FIREBASE_MODULE, FIREBASE_REQUIRE_COMPLETE_CRUD_FUNCTION_CONFIG_MAP_RULE, FIREBASE_REQUIRE_DBX_MODEL_FIREBASE_INDEX_COMPANION_TAGS_RULE, FIREBASE_REQUIRE_DBX_MODEL_FIREBASE_INDEX_QUERY_SUFFIX_RULE, FIREBASE_REQUIRE_DBX_MODEL_FIREBASE_INDEX_VALID_DISPATCHER_RULE, FIREBASE_REQUIRE_FIRESTORE_CONSTRAINT_TYPE_PARAMETER_RULE, FIREBASE_REQUIRE_TAGGED_FIRESTORE_CONSTRAINTS_RULE, MODEL_FIREBASE_CRUD_FUNCTION_CONFIG_MAP_TYPE_NAME, QUERY_SUFFIX, firebaseESLintPlugin };