@uniformdev/cli 20.57.2-alpha.23 → 20.57.2-alpha.24

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.
@@ -1,4 +1,4 @@
1
- import { C as CLIConfiguration, E as EntityTypes } from './index-DlNAs61A.mjs';
1
+ import { C as CLIConfiguration, E as EntityTypes } from './index-B-KaB0aa.mjs';
2
2
 
3
3
  type UniformConfigAllOptions = {
4
4
  /**
@@ -21,13 +21,17 @@ type EntityFilterCriteriaConfig = {
21
21
  };
22
22
  type EntityFilterInclude = {
23
23
  /** If set, only entities matching the criteria will be synced. Cannot be combined with `exclude`. */
24
- include: EntityFilterCriteriaConfig;
24
+ include: {
25
+ filters: EntityFilterCriteriaConfig;
26
+ };
25
27
  exclude?: never;
26
28
  };
27
29
  type EntityFilterExclude = {
28
30
  include?: never;
29
31
  /** If set, entities matching the criteria will be excluded from sync. Cannot be combined with `include`. */
30
- exclude: EntityFilterCriteriaConfig;
32
+ exclude: {
33
+ filters: EntityFilterCriteriaConfig;
34
+ };
31
35
  };
32
36
  type EntityFilterNone = {
33
37
  include?: never;
package/dist/index.d.mts CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- export { C as CLIConfiguration } from './index-DlNAs61A.mjs';
2
+ export { C as CLIConfiguration } from './index-B-KaB0aa.mjs';
package/dist/index.mjs CHANGED
@@ -566,16 +566,18 @@ function resolveEntityFilter(entityConfig, operation) {
566
566
  const directional = entityConfig?.[operation];
567
567
  const resolvedInclude = directional?.include ?? entityConfig?.include;
568
568
  const resolvedExclude = directional?.exclude ?? entityConfig?.exclude;
569
- const hasInclude = hasCriteria(resolvedInclude);
570
- const hasExclude = hasCriteria(resolvedExclude);
569
+ const includeFilters = resolvedInclude?.filters;
570
+ const excludeFilters = resolvedExclude?.filters;
571
+ const hasInclude = hasCriteria(includeFilters);
572
+ const hasExclude = hasCriteria(excludeFilters);
571
573
  if (hasInclude && hasExclude) {
572
574
  const includeSource = directional?.include ? `${operation}.include` : "include";
573
575
  const excludeSource = directional?.exclude ? `${operation}.exclude` : "exclude";
574
576
  throw new Error(
575
- `Entity filter for '${operation}' resolved both ${includeSource} and ${excludeSource}. Use one or the other. If a top-level filter conflicts with a per-direction filter, set the unwanted direction to { type: 'ids', match: [] } to clear it.`
577
+ `Entity filter for '${operation}' resolved both ${includeSource} and ${excludeSource}. Use one or the other. If a top-level filter conflicts with a per-direction filter, set the unwanted direction to { filters: { type: 'ids', match: [] } } to clear it.`
576
578
  );
577
579
  }
578
- return createEntityFilter(resolvedInclude, resolvedExclude);
580
+ return createEntityFilter(includeFilters, excludeFilters);
579
581
  }
580
582
  function createEntityFilter(include, exclude) {
581
583
  const normalizedInclude = normalizeCriteria(include);
@@ -603,6 +605,7 @@ var VALID_FILTER_TYPES = ["ids", "nameContains"];
603
605
  var VALID_FILTER_FIELDS = ["include", "exclude"];
604
606
  var VALID_DIRECTION_KEYS = ["pull", "push"];
605
607
  var VALID_ENTITY_CONFIG_KEYS = /* @__PURE__ */ new Set([...VALID_DIRECTION_KEYS, ...VALID_FILTER_FIELDS]);
608
+ var VALID_FILTER_BLOCK_KEYS = ["filters"];
606
609
  function validateEntityConfig(entityConfig, operation) {
607
610
  const validKeysLabel = [...VALID_ENTITY_CONFIG_KEYS].join(", ");
608
611
  for (const key of Object.keys(entityConfig)) {
@@ -624,28 +627,55 @@ function validateEntityConfig(entityConfig, operation) {
624
627
  }
625
628
  }
626
629
  for (const field of VALID_FILTER_FIELDS) {
627
- validateFilterValue(entityConfig[field], field);
630
+ validateFilterBlock(entityConfig[field], field);
628
631
  }
629
632
  if (directional && typeof directional === "object") {
630
633
  for (const field of VALID_FILTER_FIELDS) {
631
- validateFilterValue(directional[field], `${operation}.${field}`);
634
+ validateFilterBlock(directional[field], `${operation}.${field}`);
632
635
  }
633
636
  }
634
637
  }
635
- function validateFilterValue(value, label) {
638
+ function validateFilterBlock(value, label) {
636
639
  if (value === void 0 || value === null) {
637
640
  return;
638
641
  }
639
642
  if (typeof value === "string") {
640
643
  throw new Error(
641
- `"${label}" must be an object like { type: 'nameContains', match: '${value}' }, not a plain string.`
644
+ `"${label}" must be an object like { filters: { type: 'nameContains', match: '${value}' } }, not a plain string.`
642
645
  );
643
646
  }
644
647
  if (Array.isArray(value)) {
645
- throw new Error(`"${label}" must be an object like { type: 'ids', match: [...] }, not a plain array.`);
648
+ throw new Error(
649
+ `"${label}" must be an object like { filters: { type: 'ids', match: [...] } }, not a plain array.`
650
+ );
646
651
  }
647
652
  if (typeof value !== "object") {
648
- throw new Error(`"${label}" must be an object with "type" and "match" fields, but got ${typeof value}.`);
653
+ throw new Error(`"${label}" must be an object with a "filters" field, but got ${typeof value}.`);
654
+ }
655
+ const block = value;
656
+ if ("type" in block && "match" in block) {
657
+ throw new Error(
658
+ `"${label}" has "type" and "match" at the top level. Wrap them in a "filters" key: { filters: { type: '${block.type}', match: ... } }.`
659
+ );
660
+ }
661
+ const validBlockKeysLabel = VALID_FILTER_BLOCK_KEYS.join(", ");
662
+ for (const key of Object.keys(block)) {
663
+ if (!VALID_FILTER_BLOCK_KEYS.includes(key)) {
664
+ throw new Error(`Unknown key "${key}" in ${label}. Valid keys are: ${validBlockKeysLabel}.`);
665
+ }
666
+ }
667
+ if (block.filters !== void 0) {
668
+ validateFilterCriteria(block.filters, `${label}.filters`);
669
+ }
670
+ }
671
+ function validateFilterCriteria(value, label) {
672
+ if (value === void 0 || value === null) {
673
+ return;
674
+ }
675
+ if (typeof value !== "object" || Array.isArray(value)) {
676
+ throw new Error(
677
+ `${label} must be an object like { type: 'ids', match: [...] }, but got ${typeof value}.`
678
+ );
649
679
  }
650
680
  const criteria = value;
651
681
  if (!criteria.type) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/cli",
3
- "version": "20.57.2-alpha.23+75d5946be1",
3
+ "version": "20.57.2-alpha.24+b45bd27ec0",
4
4
  "description": "Uniform command line interface tool",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./cli.js",
@@ -28,13 +28,13 @@
28
28
  "dependencies": {
29
29
  "@inquirer/prompts": "^7.10.1",
30
30
  "@thi.ng/mime": "^2.2.23",
31
- "@uniformdev/assets": "20.57.2-alpha.23+75d5946be1",
32
- "@uniformdev/canvas": "20.57.2-alpha.23+75d5946be1",
33
- "@uniformdev/context": "20.57.2-alpha.23+75d5946be1",
34
- "@uniformdev/files": "20.57.2-alpha.23+75d5946be1",
35
- "@uniformdev/project-map": "20.57.2-alpha.23+75d5946be1",
36
- "@uniformdev/redirect": "20.57.2-alpha.23+75d5946be1",
37
- "@uniformdev/richtext": "20.57.2-alpha.23+75d5946be1",
31
+ "@uniformdev/assets": "20.57.2-alpha.24+b45bd27ec0",
32
+ "@uniformdev/canvas": "20.57.2-alpha.24+b45bd27ec0",
33
+ "@uniformdev/context": "20.57.2-alpha.24+b45bd27ec0",
34
+ "@uniformdev/files": "20.57.2-alpha.24+b45bd27ec0",
35
+ "@uniformdev/project-map": "20.57.2-alpha.24+b45bd27ec0",
36
+ "@uniformdev/redirect": "20.57.2-alpha.24+b45bd27ec0",
37
+ "@uniformdev/richtext": "20.57.2-alpha.24+b45bd27ec0",
38
38
  "call-bind": "^1.0.2",
39
39
  "colorette": "2.0.20",
40
40
  "cosmiconfig": "9.0.0",
@@ -81,5 +81,5 @@
81
81
  "publishConfig": {
82
82
  "access": "public"
83
83
  },
84
- "gitHead": "75d5946be1860adc22df527dd84b2d553dd61f54"
84
+ "gitHead": "b45bd27ec09cbc11c81b4abea2579548c5a57ed1"
85
85
  }