@uniformdev/cli 20.49.5-alpha.5 → 20.49.5-alpha.8
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
|
@@ -6,12 +6,27 @@ type StateArgs = {
|
|
|
6
6
|
type SyncMode = 'mirror' | 'createOrUpdate' | 'create';
|
|
7
7
|
type EntityTypes = 'aggregate' | 'asset' | 'category' | 'workflow' | 'webhook' | 'component' | 'composition' | 'contentType' | 'dataType' | 'enrichment' | 'entry' | 'entryPattern' | 'locale' | 'componentPattern' | 'compositionPattern' | 'policyDocument' | 'projectMapDefinition' | 'projectMapNode' | 'previewUrl' | 'previewViewport' | 'prompt' | 'quirk' | 'redirect' | 'signal' | 'test';
|
|
8
8
|
type SyncFileFormat = 'yaml' | 'json';
|
|
9
|
-
type
|
|
9
|
+
type EntityConfigurationBase = {
|
|
10
10
|
mode?: SyncMode;
|
|
11
11
|
directory?: string;
|
|
12
12
|
format?: SyncFileFormat;
|
|
13
13
|
disabled?: true;
|
|
14
14
|
};
|
|
15
|
+
type EntityFilterInclude = {
|
|
16
|
+
/** If set, only entities whose ID matches one of these values will be synced. Cannot be combined with `exclude`. */
|
|
17
|
+
include: string[];
|
|
18
|
+
exclude?: never;
|
|
19
|
+
};
|
|
20
|
+
type EntityFilterExclude = {
|
|
21
|
+
include?: never;
|
|
22
|
+
/** If set, entities whose ID matches one of these values will be excluded from sync. Cannot be combined with `include`. */
|
|
23
|
+
exclude: string[];
|
|
24
|
+
};
|
|
25
|
+
type EntityFilterNone = {
|
|
26
|
+
include?: never;
|
|
27
|
+
exclude?: never;
|
|
28
|
+
};
|
|
29
|
+
type EntityConfiguration = EntityConfigurationBase & (EntityFilterInclude | EntityFilterExclude | EntityFilterNone);
|
|
15
30
|
type EntityWithStateConfiguration = EntityConfiguration & Partial<StateArgs>;
|
|
16
31
|
type PublishableEntitiesConfiguration = EntityWithStateConfiguration & {
|
|
17
32
|
publish?: boolean;
|
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-fzc0-h1F.mjs';
|
package/dist/index.mjs
CHANGED
|
@@ -558,6 +558,34 @@ async function createArraySyncEngineDataSource({
|
|
|
558
558
|
};
|
|
559
559
|
}
|
|
560
560
|
|
|
561
|
+
// src/sync/entityFilter.ts
|
|
562
|
+
function resolveEntityFilter(entityConfig, operation) {
|
|
563
|
+
const directional = entityConfig?.[operation];
|
|
564
|
+
const include = directional?.include ?? entityConfig?.include;
|
|
565
|
+
const exclude = directional?.exclude ?? entityConfig?.exclude;
|
|
566
|
+
return createEntityFilter(include, exclude);
|
|
567
|
+
}
|
|
568
|
+
function createEntityFilter(include, exclude) {
|
|
569
|
+
if (include?.length && exclude?.length) {
|
|
570
|
+
throw new Error("Entity filter cannot have both `include` and `exclude` defined. Use one or the other.");
|
|
571
|
+
}
|
|
572
|
+
if (!include?.length && !exclude?.length) {
|
|
573
|
+
return void 0;
|
|
574
|
+
}
|
|
575
|
+
if (include?.length) {
|
|
576
|
+
const includeSet = new Set(include);
|
|
577
|
+
return (obj) => {
|
|
578
|
+
const ids = Array.isArray(obj.id) ? obj.id : [obj.id];
|
|
579
|
+
return ids.some((id) => includeSet.has(id));
|
|
580
|
+
};
|
|
581
|
+
}
|
|
582
|
+
const excludeSet = new Set(exclude);
|
|
583
|
+
return (obj) => {
|
|
584
|
+
const ids = Array.isArray(obj.id) ? obj.id : [obj.id];
|
|
585
|
+
return !ids.some((id) => excludeSet.has(id));
|
|
586
|
+
};
|
|
587
|
+
}
|
|
588
|
+
|
|
561
589
|
// src/sync/fileSyncEngineDataSource.ts
|
|
562
590
|
import { red } from "colorette";
|
|
563
591
|
import { existsSync as existsSync2, mkdirSync as mkdirSync2 } from "fs";
|
|
@@ -773,6 +801,16 @@ function serializedDequal(foo, bar) {
|
|
|
773
801
|
|
|
774
802
|
// src/sync/syncEngine.ts
|
|
775
803
|
var syncEngineEvents = mitt();
|
|
804
|
+
var _syncObjectFilter;
|
|
805
|
+
async function withSyncEngineFilter(filter, fn) {
|
|
806
|
+
const prev = _syncObjectFilter;
|
|
807
|
+
_syncObjectFilter = filter;
|
|
808
|
+
try {
|
|
809
|
+
return await fn();
|
|
810
|
+
} finally {
|
|
811
|
+
_syncObjectFilter = prev;
|
|
812
|
+
}
|
|
813
|
+
}
|
|
776
814
|
async function syncEngine({
|
|
777
815
|
source,
|
|
778
816
|
target,
|
|
@@ -789,6 +827,7 @@ async function syncEngine({
|
|
|
789
827
|
//verbose = false,
|
|
790
828
|
}) {
|
|
791
829
|
const status = new ReactiveStatusUpdate((status2) => syncEngineEvents.emit("statusUpdate", status2));
|
|
830
|
+
const objectFilter = _syncObjectFilter;
|
|
792
831
|
const targetItems = /* @__PURE__ */ new Map();
|
|
793
832
|
const deleteTracker = /* @__PURE__ */ new Set();
|
|
794
833
|
const processDelete = async (object4) => {
|
|
@@ -817,6 +856,9 @@ async function syncEngine({
|
|
|
817
856
|
}
|
|
818
857
|
};
|
|
819
858
|
for await (const obj of target.objects) {
|
|
859
|
+
if (objectFilter && !objectFilter(obj)) {
|
|
860
|
+
continue;
|
|
861
|
+
}
|
|
820
862
|
status.fetched++;
|
|
821
863
|
if (Array.isArray(obj.id)) {
|
|
822
864
|
obj.id.forEach((o) => targetItems.set(o, obj));
|
|
@@ -827,6 +869,9 @@ async function syncEngine({
|
|
|
827
869
|
const actions = [];
|
|
828
870
|
let sourceHasItems = false;
|
|
829
871
|
for await (let sourceObject of source.objects) {
|
|
872
|
+
if (objectFilter && !objectFilter(sourceObject)) {
|
|
873
|
+
continue;
|
|
874
|
+
}
|
|
830
875
|
sourceHasItems = true;
|
|
831
876
|
if (onBeforeProcessObject) {
|
|
832
877
|
await onBeforeProcessObject(sourceObject);
|
|
@@ -12648,19 +12693,23 @@ var SyncPullModule = {
|
|
|
12648
12693
|
return entityConfig2 !== void 0 && "state" in entityConfig2;
|
|
12649
12694
|
};
|
|
12650
12695
|
const entityConfig = config2.entitiesConfig?.[entityType];
|
|
12696
|
+
const entityFilter = resolveEntityFilter(entityConfig, "pull");
|
|
12651
12697
|
try {
|
|
12652
12698
|
await spinPromise(
|
|
12653
|
-
|
|
12654
|
-
|
|
12655
|
-
|
|
12656
|
-
|
|
12657
|
-
|
|
12658
|
-
|
|
12659
|
-
|
|
12660
|
-
|
|
12661
|
-
|
|
12662
|
-
|
|
12663
|
-
|
|
12699
|
+
withSyncEngineFilter(
|
|
12700
|
+
entityFilter,
|
|
12701
|
+
() => module.handler({
|
|
12702
|
+
...otherParams,
|
|
12703
|
+
state: entityConfigSupportsPullState(entityConfig) ? entityConfig.state ?? 0 : 0,
|
|
12704
|
+
format: getFormat(entityType, config2),
|
|
12705
|
+
onlyCompositions: entityType === "composition" ? true : void 0,
|
|
12706
|
+
onlyPatterns: ["pattern", "componentPattern", "compositionPattern"].includes(entityType) ? true : void 0,
|
|
12707
|
+
patternType: entityType === "compositionPattern" ? "composition" : entityType === "componentPattern" ? "component" : void 0,
|
|
12708
|
+
mode: getPullMode(entityType, config2),
|
|
12709
|
+
directory: getPullFilename(entityType, config2),
|
|
12710
|
+
allowEmptySource: config2.allowEmptySource
|
|
12711
|
+
})
|
|
12712
|
+
),
|
|
12664
12713
|
{
|
|
12665
12714
|
text: `${entityType}\u2026`,
|
|
12666
12715
|
successText: entityType,
|
|
@@ -12812,19 +12861,24 @@ var SyncPushModule = {
|
|
|
12812
12861
|
);
|
|
12813
12862
|
}
|
|
12814
12863
|
for (const [entityType, module] of enabledEntities) {
|
|
12864
|
+
const entityConfig = config2.entitiesConfig?.[entityType];
|
|
12865
|
+
const entityFilter = resolveEntityFilter(entityConfig, "push");
|
|
12815
12866
|
try {
|
|
12816
12867
|
await spinPromise(
|
|
12817
|
-
|
|
12818
|
-
|
|
12819
|
-
|
|
12820
|
-
|
|
12821
|
-
|
|
12822
|
-
|
|
12823
|
-
|
|
12824
|
-
|
|
12825
|
-
|
|
12826
|
-
|
|
12827
|
-
|
|
12868
|
+
withSyncEngineFilter(
|
|
12869
|
+
entityFilter,
|
|
12870
|
+
() => module.handler({
|
|
12871
|
+
...otherParams,
|
|
12872
|
+
state: 0,
|
|
12873
|
+
format: getFormat2(entityType, config2),
|
|
12874
|
+
onlyCompositions: entityType === "composition" ? true : void 0,
|
|
12875
|
+
onlyPatterns: ["pattern", "componentPattern", "compositionPattern"].includes(entityType) ? true : void 0,
|
|
12876
|
+
patternType: entityType === "compositionPattern" ? "composition" : entityType === "componentPattern" ? "component" : void 0,
|
|
12877
|
+
mode: getPushMode(entityType, config2),
|
|
12878
|
+
directory: getPushFilename(entityType, config2),
|
|
12879
|
+
allowEmptySource: config2.allowEmptySource
|
|
12880
|
+
})
|
|
12881
|
+
),
|
|
12828
12882
|
{
|
|
12829
12883
|
text: `${entityType}...`,
|
|
12830
12884
|
successText: entityType,
|
|
@@ -12840,15 +12894,19 @@ var SyncPushModule = {
|
|
|
12840
12894
|
}
|
|
12841
12895
|
}
|
|
12842
12896
|
if (config2.entitiesConfig?.componentPattern && config2.entitiesConfig?.componentPattern?.push?.disabled !== true && config2.entitiesConfig?.componentPattern?.publish) {
|
|
12897
|
+
const publishFilter = resolveEntityFilter(config2.entitiesConfig.componentPattern, "push");
|
|
12843
12898
|
try {
|
|
12844
12899
|
await spinPromise(
|
|
12845
|
-
|
|
12846
|
-
|
|
12847
|
-
|
|
12848
|
-
|
|
12849
|
-
|
|
12850
|
-
|
|
12851
|
-
|
|
12900
|
+
withSyncEngineFilter(
|
|
12901
|
+
publishFilter,
|
|
12902
|
+
() => ComponentPatternPublishModule.handler({
|
|
12903
|
+
...otherParams,
|
|
12904
|
+
patternType: "component",
|
|
12905
|
+
onlyPatterns: true,
|
|
12906
|
+
all: true,
|
|
12907
|
+
directory: getPushFilename("componentPattern", config2)
|
|
12908
|
+
})
|
|
12909
|
+
),
|
|
12852
12910
|
{
|
|
12853
12911
|
text: "publishing component patterns...",
|
|
12854
12912
|
successText: "published component patterns",
|
|
@@ -12864,15 +12922,19 @@ var SyncPushModule = {
|
|
|
12864
12922
|
}
|
|
12865
12923
|
}
|
|
12866
12924
|
if (config2.entitiesConfig?.compositionPattern && config2.entitiesConfig?.compositionPattern?.push?.disabled !== true && config2.entitiesConfig?.compositionPattern?.publish) {
|
|
12925
|
+
const publishFilter = resolveEntityFilter(config2.entitiesConfig.compositionPattern, "push");
|
|
12867
12926
|
try {
|
|
12868
12927
|
await spinPromise(
|
|
12869
|
-
|
|
12870
|
-
|
|
12871
|
-
|
|
12872
|
-
|
|
12873
|
-
|
|
12874
|
-
|
|
12875
|
-
|
|
12928
|
+
withSyncEngineFilter(
|
|
12929
|
+
publishFilter,
|
|
12930
|
+
() => CompositionPatternPublishModule.handler({
|
|
12931
|
+
...otherParams,
|
|
12932
|
+
all: true,
|
|
12933
|
+
onlyPatterns: true,
|
|
12934
|
+
patternType: "composition",
|
|
12935
|
+
directory: getPushFilename("compositionPattern", config2)
|
|
12936
|
+
})
|
|
12937
|
+
),
|
|
12876
12938
|
{
|
|
12877
12939
|
text: "publishing composition patterns...",
|
|
12878
12940
|
successText: "published composition patterns",
|
|
@@ -12888,14 +12950,18 @@ var SyncPushModule = {
|
|
|
12888
12950
|
}
|
|
12889
12951
|
}
|
|
12890
12952
|
if (config2.entitiesConfig?.composition && config2.entitiesConfig?.composition?.push?.disabled !== true && config2.entitiesConfig?.composition?.publish) {
|
|
12953
|
+
const publishFilter = resolveEntityFilter(config2.entitiesConfig.composition, "push");
|
|
12891
12954
|
try {
|
|
12892
12955
|
await spinPromise(
|
|
12893
|
-
|
|
12894
|
-
|
|
12895
|
-
|
|
12896
|
-
|
|
12897
|
-
|
|
12898
|
-
|
|
12956
|
+
withSyncEngineFilter(
|
|
12957
|
+
publishFilter,
|
|
12958
|
+
() => CompositionPublishModule.handler({
|
|
12959
|
+
...otherParams,
|
|
12960
|
+
all: true,
|
|
12961
|
+
onlyCompositions: true,
|
|
12962
|
+
directory: getPushFilename("composition", config2)
|
|
12963
|
+
})
|
|
12964
|
+
),
|
|
12899
12965
|
{
|
|
12900
12966
|
text: "publishing compositions...",
|
|
12901
12967
|
successText: "published compositions",
|
|
@@ -12911,13 +12977,17 @@ var SyncPushModule = {
|
|
|
12911
12977
|
}
|
|
12912
12978
|
}
|
|
12913
12979
|
if (config2.entitiesConfig?.entry && config2.entitiesConfig?.entry?.push?.disabled !== true && config2.entitiesConfig?.entry?.publish) {
|
|
12980
|
+
const publishFilter = resolveEntityFilter(config2.entitiesConfig.entry, "push");
|
|
12914
12981
|
try {
|
|
12915
12982
|
await spinPromise(
|
|
12916
|
-
|
|
12917
|
-
|
|
12918
|
-
|
|
12919
|
-
|
|
12920
|
-
|
|
12983
|
+
withSyncEngineFilter(
|
|
12984
|
+
publishFilter,
|
|
12985
|
+
() => EntryPublishModule.handler({
|
|
12986
|
+
...otherParams,
|
|
12987
|
+
all: true,
|
|
12988
|
+
directory: getPushFilename("entry", config2)
|
|
12989
|
+
})
|
|
12990
|
+
),
|
|
12921
12991
|
{
|
|
12922
12992
|
text: "publishing entries...",
|
|
12923
12993
|
successText: "published entries",
|
|
@@ -12933,13 +13003,17 @@ var SyncPushModule = {
|
|
|
12933
13003
|
}
|
|
12934
13004
|
}
|
|
12935
13005
|
if (config2.entitiesConfig?.entryPattern && config2.entitiesConfig?.entryPattern?.push?.disabled !== true && config2.entitiesConfig?.entryPattern?.publish) {
|
|
13006
|
+
const publishFilter = resolveEntityFilter(config2.entitiesConfig.entryPattern, "push");
|
|
12936
13007
|
try {
|
|
12937
13008
|
await spinPromise(
|
|
12938
|
-
|
|
12939
|
-
|
|
12940
|
-
|
|
12941
|
-
|
|
12942
|
-
|
|
13009
|
+
withSyncEngineFilter(
|
|
13010
|
+
publishFilter,
|
|
13011
|
+
() => EntryPatternPublishModule.handler({
|
|
13012
|
+
...otherParams,
|
|
13013
|
+
all: true,
|
|
13014
|
+
directory: getPushFilename("entryPattern", config2)
|
|
13015
|
+
})
|
|
13016
|
+
),
|
|
12943
13017
|
{
|
|
12944
13018
|
text: "publishing entry patterns...",
|
|
12945
13019
|
successText: "published entry patterns",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/cli",
|
|
3
|
-
"version": "20.49.5-alpha.
|
|
3
|
+
"version": "20.49.5-alpha.8+22d8cd29a6",
|
|
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.49.5-alpha.
|
|
32
|
-
"@uniformdev/canvas": "20.49.5-alpha.
|
|
33
|
-
"@uniformdev/context": "20.49.5-alpha.
|
|
34
|
-
"@uniformdev/files": "20.49.5-alpha.
|
|
35
|
-
"@uniformdev/project-map": "20.49.5-alpha.
|
|
36
|
-
"@uniformdev/redirect": "20.49.5-alpha.
|
|
37
|
-
"@uniformdev/richtext": "20.49.5-alpha.
|
|
31
|
+
"@uniformdev/assets": "20.49.5-alpha.8+22d8cd29a6",
|
|
32
|
+
"@uniformdev/canvas": "20.49.5-alpha.8+22d8cd29a6",
|
|
33
|
+
"@uniformdev/context": "20.49.5-alpha.8+22d8cd29a6",
|
|
34
|
+
"@uniformdev/files": "20.49.5-alpha.8+22d8cd29a6",
|
|
35
|
+
"@uniformdev/project-map": "20.49.5-alpha.8+22d8cd29a6",
|
|
36
|
+
"@uniformdev/redirect": "20.49.5-alpha.8+22d8cd29a6",
|
|
37
|
+
"@uniformdev/richtext": "20.49.5-alpha.8+22d8cd29a6",
|
|
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": "22d8cd29a63c4405db14f6ce47669b187ddc266a"
|
|
85
85
|
}
|