@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.
package/dist/defaultConfig.d.mts
CHANGED
|
@@ -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:
|
|
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:
|
|
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-
|
|
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
|
|
570
|
-
const
|
|
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(
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
614
|
+
validateFilterBlock(directional[field], `${operation}.${field}`);
|
|
632
615
|
}
|
|
633
616
|
}
|
|
634
617
|
}
|
|
635
|
-
function
|
|
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(
|
|
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
|
|
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.
|
|
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.
|
|
32
|
-
"@uniformdev/canvas": "20.57.2-alpha.
|
|
33
|
-
"@uniformdev/context": "20.57.2-alpha.
|
|
34
|
-
"@uniformdev/files": "20.57.2-alpha.
|
|
35
|
-
"@uniformdev/project-map": "20.57.2-alpha.
|
|
36
|
-
"@uniformdev/redirect": "20.57.2-alpha.
|
|
37
|
-
"@uniformdev/richtext": "20.57.2-alpha.
|
|
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": "
|
|
84
|
+
"gitHead": "6cfe36b730e744edc041607347cc10e7a8b1b5ff"
|
|
85
85
|
}
|