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