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

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);
@@ -601,51 +603,59 @@ function normalizeCriteria(criteria) {
601
603
  }
602
604
  var VALID_FILTER_TYPES = ["ids", "nameContains"];
603
605
  var VALID_FILTER_FIELDS = ["include", "exclude"];
604
- var VALID_DIRECTION_KEYS = ["pull", "push"];
605
- var VALID_ENTITY_CONFIG_KEYS = /* @__PURE__ */ new Set([...VALID_DIRECTION_KEYS, ...VALID_FILTER_FIELDS]);
606
+ var VALID_FILTER_BLOCK_KEYS = ["filters"];
606
607
  function validateEntityConfig(entityConfig, operation) {
607
- const validKeysLabel = [...VALID_ENTITY_CONFIG_KEYS].join(", ");
608
- for (const key of Object.keys(entityConfig)) {
609
- if (!VALID_ENTITY_CONFIG_KEYS.has(key)) {
610
- const suggestion = VALID_DIRECTION_KEYS.find((valid) => key.startsWith(valid));
611
- const hint = suggestion ? ` Did you mean "${suggestion}"?` : "";
612
- throw new Error(`Unknown entity filter key "${key}".${hint} Valid keys are: ${validKeysLabel}.`);
613
- }
614
- }
615
- const directional = entityConfig[operation];
616
- if (directional && typeof directional === "object") {
617
- const validFilterLabel = VALID_FILTER_FIELDS.join(", ");
618
- for (const key of Object.keys(directional)) {
619
- if (!VALID_FILTER_FIELDS.includes(key)) {
620
- throw new Error(
621
- `Unknown key "${key}" in ${operation} filter config. Valid keys are: ${validFilterLabel}.`
622
- );
623
- }
624
- }
625
- }
626
608
  for (const field of VALID_FILTER_FIELDS) {
627
- validateFilterValue(entityConfig[field], field);
609
+ validateFilterBlock(entityConfig[field], field);
628
610
  }
611
+ const directional = entityConfig[operation];
629
612
  if (directional && typeof directional === "object") {
630
613
  for (const field of VALID_FILTER_FIELDS) {
631
- validateFilterValue(directional[field], `${operation}.${field}`);
614
+ validateFilterBlock(directional[field], `${operation}.${field}`);
632
615
  }
633
616
  }
634
617
  }
635
- function validateFilterValue(value, label) {
618
+ function validateFilterBlock(value, label) {
636
619
  if (value === void 0 || value === null) {
637
620
  return;
638
621
  }
639
622
  if (typeof value === "string") {
640
623
  throw new Error(
641
- `"${label}" must be an object like { type: 'nameContains', match: '${value}' }, not a plain string.`
624
+ `"${label}" must be an object like { filters: { type: 'nameContains', match: '${value}' } }, not a plain string.`
642
625
  );
643
626
  }
644
627
  if (Array.isArray(value)) {
645
- throw new Error(`"${label}" must be an object like { type: 'ids', match: [...] }, not a plain array.`);
628
+ throw new Error(
629
+ `"${label}" must be an object like { filters: { type: 'ids', match: [...] } }, not a plain array.`
630
+ );
646
631
  }
647
632
  if (typeof value !== "object") {
648
- throw new Error(`"${label}" must be an object with "type" and "match" fields, but got ${typeof value}.`);
633
+ throw new Error(`"${label}" must be an object with a "filters" field, but got ${typeof value}.`);
634
+ }
635
+ const block = value;
636
+ if ("type" in block && "match" in block) {
637
+ throw new Error(
638
+ `"${label}" has "type" and "match" at the top level. Wrap them in a "filters" key: { filters: { type: '${block.type}', match: ... } }.`
639
+ );
640
+ }
641
+ const validBlockKeysLabel = VALID_FILTER_BLOCK_KEYS.join(", ");
642
+ for (const key of Object.keys(block)) {
643
+ if (!VALID_FILTER_BLOCK_KEYS.includes(key)) {
644
+ throw new Error(`Unknown key "${key}" in ${label}. Valid keys are: ${validBlockKeysLabel}.`);
645
+ }
646
+ }
647
+ if (block.filters !== void 0) {
648
+ validateFilterCriteria(block.filters, `${label}.filters`);
649
+ }
650
+ }
651
+ function validateFilterCriteria(value, label) {
652
+ if (value === void 0 || value === null) {
653
+ return;
654
+ }
655
+ if (typeof value !== "object" || Array.isArray(value)) {
656
+ throw new Error(
657
+ `${label} must be an object like { type: 'ids', match: [...] }, but got ${typeof value}.`
658
+ );
649
659
  }
650
660
  const criteria = value;
651
661
  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.25+6cfe36b730",
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.25+6cfe36b730",
32
+ "@uniformdev/canvas": "20.57.2-alpha.25+6cfe36b730",
33
+ "@uniformdev/context": "20.57.2-alpha.25+6cfe36b730",
34
+ "@uniformdev/files": "20.57.2-alpha.25+6cfe36b730",
35
+ "@uniformdev/project-map": "20.57.2-alpha.25+6cfe36b730",
36
+ "@uniformdev/redirect": "20.57.2-alpha.25+6cfe36b730",
37
+ "@uniformdev/richtext": "20.57.2-alpha.25+6cfe36b730",
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": "6cfe36b730e744edc041607347cc10e7a8b1b5ff"
85
85
  }