@uniformdev/cli 20.49.5-alpha.11 → 20.49.5-alpha.14
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,27 +6,12 @@ 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 EntityConfiguration = {
|
|
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);
|
|
30
15
|
type EntityWithStateConfiguration = EntityConfiguration & Partial<StateArgs>;
|
|
31
16
|
type PublishableEntitiesConfiguration = EntityWithStateConfiguration & {
|
|
32
17
|
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-ZI3elAaF.mjs';
|
package/dist/index.mjs
CHANGED
|
@@ -558,34 +558,6 @@ 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
|
-
|
|
589
561
|
// src/sync/fileSyncEngineDataSource.ts
|
|
590
562
|
import { red } from "colorette";
|
|
591
563
|
import { existsSync as existsSync2, mkdirSync as mkdirSync2 } from "fs";
|
|
@@ -684,13 +656,9 @@ async function createFileSyncEngineDataSource({
|
|
|
684
656
|
const fullFilename = join(directory, filename);
|
|
685
657
|
try {
|
|
686
658
|
const contents = readFileToObject(fullFilename);
|
|
687
|
-
const id = selectIdentifier18(contents);
|
|
688
|
-
if (id === void 0 || id === null || Array.isArray(id) && id.length === 0) {
|
|
689
|
-
throw new Error(`File does not contain a valid identifier.`);
|
|
690
|
-
}
|
|
691
659
|
const displayName = selectDisplayName18(contents);
|
|
692
660
|
const object4 = {
|
|
693
|
-
id,
|
|
661
|
+
id: selectIdentifier18(contents),
|
|
694
662
|
displayName: Array.isArray(displayName) ? displayName[0] : displayName,
|
|
695
663
|
providerId: fullFilename,
|
|
696
664
|
object: omit(contents, ["$schema"])
|
|
@@ -805,16 +773,6 @@ function serializedDequal(foo, bar) {
|
|
|
805
773
|
|
|
806
774
|
// src/sync/syncEngine.ts
|
|
807
775
|
var syncEngineEvents = mitt();
|
|
808
|
-
var _syncObjectFilter;
|
|
809
|
-
async function withSyncEngineFilter(filter, fn) {
|
|
810
|
-
const prev = _syncObjectFilter;
|
|
811
|
-
_syncObjectFilter = filter;
|
|
812
|
-
try {
|
|
813
|
-
return await fn();
|
|
814
|
-
} finally {
|
|
815
|
-
_syncObjectFilter = prev;
|
|
816
|
-
}
|
|
817
|
-
}
|
|
818
776
|
async function syncEngine({
|
|
819
777
|
source,
|
|
820
778
|
target,
|
|
@@ -831,10 +789,8 @@ async function syncEngine({
|
|
|
831
789
|
//verbose = false,
|
|
832
790
|
}) {
|
|
833
791
|
const status = new ReactiveStatusUpdate((status2) => syncEngineEvents.emit("statusUpdate", status2));
|
|
834
|
-
const objectFilter = _syncObjectFilter;
|
|
835
792
|
const targetItems = /* @__PURE__ */ new Map();
|
|
836
793
|
const deleteTracker = /* @__PURE__ */ new Set();
|
|
837
|
-
const getFirstId = (id) => Array.isArray(id) ? id[0] : id;
|
|
838
794
|
const processDelete = async (object4) => {
|
|
839
795
|
if (deleteTracker.has(object4)) return;
|
|
840
796
|
deleteTracker.add(object4);
|
|
@@ -852,7 +808,7 @@ async function syncEngine({
|
|
|
852
808
|
} finally {
|
|
853
809
|
log2({
|
|
854
810
|
action: "delete",
|
|
855
|
-
id:
|
|
811
|
+
id: object4.id[0],
|
|
856
812
|
providerId: object4.providerId,
|
|
857
813
|
displayName: object4.displayName ?? object4.providerId,
|
|
858
814
|
whatIf,
|
|
@@ -861,9 +817,6 @@ async function syncEngine({
|
|
|
861
817
|
}
|
|
862
818
|
};
|
|
863
819
|
for await (const obj of target.objects) {
|
|
864
|
-
if (objectFilter && !objectFilter(obj)) {
|
|
865
|
-
continue;
|
|
866
|
-
}
|
|
867
820
|
status.fetched++;
|
|
868
821
|
if (Array.isArray(obj.id)) {
|
|
869
822
|
obj.id.forEach((o) => targetItems.set(o, obj));
|
|
@@ -874,9 +827,6 @@ async function syncEngine({
|
|
|
874
827
|
const actions = [];
|
|
875
828
|
let sourceHasItems = false;
|
|
876
829
|
for await (let sourceObject of source.objects) {
|
|
877
|
-
if (objectFilter && !objectFilter(sourceObject)) {
|
|
878
|
-
continue;
|
|
879
|
-
}
|
|
880
830
|
sourceHasItems = true;
|
|
881
831
|
if (onBeforeProcessObject) {
|
|
882
832
|
await onBeforeProcessObject(sourceObject);
|
|
@@ -2662,15 +2612,6 @@ var compareCompositionsOrEntriesWithoutAssetUrls = (source, target) => {
|
|
|
2662
2612
|
removeUrlsFromAssetParameters(structuredClone(target.object))
|
|
2663
2613
|
);
|
|
2664
2614
|
};
|
|
2665
|
-
var PUBLISH_TIMESTAMP_TOLERANCE_MS = 2e3;
|
|
2666
|
-
var compareCompositionsOrEntriesWithoutAssetUrlsForPublishing = (source, target) => {
|
|
2667
|
-
const sourceModified = new Date(source.object.modified).getTime();
|
|
2668
|
-
const targetModified = new Date(target.object.modified).getTime();
|
|
2669
|
-
if (sourceModified - targetModified > PUBLISH_TIMESTAMP_TOLERANCE_MS) {
|
|
2670
|
-
return false;
|
|
2671
|
-
}
|
|
2672
|
-
return compareCompositionsOrEntriesWithoutAssetUrls(source, target);
|
|
2673
|
-
};
|
|
2674
2615
|
var removeUrlFromAsset = (asset) => {
|
|
2675
2616
|
if (asset.asset.fields?.url?.value) {
|
|
2676
2617
|
asset.asset.fields.url.value = "";
|
|
@@ -4260,7 +4201,7 @@ var CompositionPublishModule = {
|
|
|
4260
4201
|
fileClient
|
|
4261
4202
|
});
|
|
4262
4203
|
},
|
|
4263
|
-
compareContents:
|
|
4204
|
+
compareContents: compareCompositionsOrEntriesWithoutAssetUrls,
|
|
4264
4205
|
onBeforeWriteObject: async (sourceObject) => {
|
|
4265
4206
|
return uploadFilesForCompositionOrEntry({
|
|
4266
4207
|
entity: sourceObject,
|
|
@@ -4715,10 +4656,7 @@ var ComponentPatternRemoveModule = {
|
|
|
4715
4656
|
};
|
|
4716
4657
|
|
|
4717
4658
|
// src/commands/canvas/commands/composition/unpublish.ts
|
|
4718
|
-
import {
|
|
4719
|
-
ApiClientError,
|
|
4720
|
-
CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE2
|
|
4721
|
-
} from "@uniformdev/canvas";
|
|
4659
|
+
import { CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE2 } from "@uniformdev/canvas";
|
|
4722
4660
|
import { diffJson as diffJson2 } from "diff";
|
|
4723
4661
|
var CompositionUnpublishModule = {
|
|
4724
4662
|
command: "unpublish [ids]",
|
|
@@ -4732,15 +4670,15 @@ var CompositionUnpublishModule = {
|
|
|
4732
4670
|
type: "string"
|
|
4733
4671
|
}).option("all", {
|
|
4734
4672
|
alias: ["a"],
|
|
4735
|
-
describe: "Un-publishes all compositions. Use
|
|
4673
|
+
describe: "Un-publishes all compositions. Use compositionId to publish one instead.",
|
|
4736
4674
|
default: false,
|
|
4737
4675
|
type: "boolean"
|
|
4738
4676
|
}).option("onlyCompositions", {
|
|
4739
|
-
describe: "Only
|
|
4677
|
+
describe: "Only publishing compositions and not patterns",
|
|
4740
4678
|
default: false,
|
|
4741
4679
|
type: "boolean"
|
|
4742
4680
|
}).option("onlyPatterns", {
|
|
4743
|
-
describe: "Only
|
|
4681
|
+
describe: "Only pulling patterns and not compositions",
|
|
4744
4682
|
default: false,
|
|
4745
4683
|
type: "boolean",
|
|
4746
4684
|
hidden: true
|
|
@@ -4763,7 +4701,7 @@ var CompositionUnpublishModule = {
|
|
|
4763
4701
|
verbose
|
|
4764
4702
|
}) => {
|
|
4765
4703
|
if (!all && !ids || all && ids) {
|
|
4766
|
-
console.error(`Specify --all or composition ID(s) to
|
|
4704
|
+
console.error(`Specify --all or composition ID(s) to publish.`);
|
|
4767
4705
|
process.exit(1);
|
|
4768
4706
|
}
|
|
4769
4707
|
const compositionIDsArray = ids ? ids.split(",").map((id) => id.trim()) : void 0;
|
|
@@ -4788,6 +4726,7 @@ var CompositionUnpublishModule = {
|
|
|
4788
4726
|
patternType,
|
|
4789
4727
|
verbose
|
|
4790
4728
|
});
|
|
4729
|
+
const actions = [];
|
|
4791
4730
|
const log2 = createPublishStatusSyncEngineConsoleLogger({ status: "unpublish" });
|
|
4792
4731
|
for await (const obj of target.objects) {
|
|
4793
4732
|
if (Array.isArray(obj.id)) {
|
|
@@ -4796,30 +4735,16 @@ var CompositionUnpublishModule = {
|
|
|
4796
4735
|
targetItems.set(obj.id, obj);
|
|
4797
4736
|
}
|
|
4798
4737
|
}
|
|
4799
|
-
const toUnpublish = [];
|
|
4800
4738
|
for await (const sourceObject of source.objects) {
|
|
4801
|
-
toUnpublish.push(sourceObject);
|
|
4802
|
-
}
|
|
4803
|
-
const actions = [];
|
|
4804
|
-
for (const sourceObject of toUnpublish) {
|
|
4805
4739
|
const id = Array.isArray(sourceObject.id) ? sourceObject.id[0] : sourceObject.id;
|
|
4806
4740
|
const targetObject = targetItems.get(id);
|
|
4807
4741
|
if (!targetObject) {
|
|
4808
|
-
console.log(`Composition ${id}
|
|
4742
|
+
console.log(`Composition ${id} was not found`);
|
|
4743
|
+
return;
|
|
4809
4744
|
}
|
|
4745
|
+
console.log(`\u{1F41B} unpublishing composition: (id: ${id})`);
|
|
4810
4746
|
if (!whatIf) {
|
|
4811
|
-
actions.push(
|
|
4812
|
-
client.removeComposition({ ...parseCompositionSerializedId(id), state: CANVAS_PUBLISHED_STATE2 }).catch((err) => {
|
|
4813
|
-
const isNotFound = err instanceof ApiClientError && err.statusCode === 404;
|
|
4814
|
-
if (isNotFound) {
|
|
4815
|
-
console.warn(
|
|
4816
|
-
`Composition ${id} was not found when unpublishing (may already be unpublished or orphaned); skipping.`
|
|
4817
|
-
);
|
|
4818
|
-
return;
|
|
4819
|
-
}
|
|
4820
|
-
throw err;
|
|
4821
|
-
})
|
|
4822
|
-
);
|
|
4747
|
+
actions.push(client.removeComposition({ compositionId: id, state: CANVAS_PUBLISHED_STATE2 }));
|
|
4823
4748
|
}
|
|
4824
4749
|
log2({
|
|
4825
4750
|
action: "update",
|
|
@@ -4827,10 +4752,9 @@ var CompositionUnpublishModule = {
|
|
|
4827
4752
|
providerId: sourceObject.providerId,
|
|
4828
4753
|
displayName: sourceObject.displayName ?? sourceObject.providerId,
|
|
4829
4754
|
whatIf,
|
|
4830
|
-
diff: () =>
|
|
4755
|
+
diff: () => diffJson2(targetObject.object, sourceObject.object)
|
|
4831
4756
|
});
|
|
4832
4757
|
}
|
|
4833
|
-
await Promise.all(actions);
|
|
4834
4758
|
}
|
|
4835
4759
|
};
|
|
4836
4760
|
|
|
@@ -4847,7 +4771,7 @@ var ComponentPatternUnpublishModule = {
|
|
|
4847
4771
|
type: "string"
|
|
4848
4772
|
}).option("all", {
|
|
4849
4773
|
alias: ["a"],
|
|
4850
|
-
describe: "Un-publishes all
|
|
4774
|
+
describe: "Un-publishes all compositions. Use compositionId to publish one instead.",
|
|
4851
4775
|
default: false,
|
|
4852
4776
|
type: "boolean"
|
|
4853
4777
|
}).option("onlyCompositions", {
|
|
@@ -5142,7 +5066,7 @@ var CompositionPatternUnpublishModule = {
|
|
|
5142
5066
|
type: "string"
|
|
5143
5067
|
}).option("all", {
|
|
5144
5068
|
alias: ["a"],
|
|
5145
|
-
describe: "Un-publishes all
|
|
5069
|
+
describe: "Un-publishes all compositions. Use compositionId to publish one instead.",
|
|
5146
5070
|
default: false,
|
|
5147
5071
|
type: "boolean"
|
|
5148
5072
|
}).option("onlyCompositions", {
|
|
@@ -6040,7 +5964,7 @@ var EntryListModule = {
|
|
|
6040
5964
|
};
|
|
6041
5965
|
|
|
6042
5966
|
// src/commands/canvas/entryEngineDataSource.ts
|
|
6043
|
-
import { ApiClientError
|
|
5967
|
+
import { ApiClientError, convertEntryToPutEntry } from "@uniformdev/canvas";
|
|
6044
5968
|
|
|
6045
5969
|
// src/commands/canvas/commands/entry/_util.ts
|
|
6046
5970
|
var selectEntryIdentifier = (e) => {
|
|
@@ -6086,7 +6010,7 @@ function createEntryEngineDataSource({
|
|
|
6086
6010
|
editions: "all"
|
|
6087
6011
|
})).entries;
|
|
6088
6012
|
} catch (error) {
|
|
6089
|
-
if (error instanceof
|
|
6013
|
+
if (error instanceof ApiClientError && error.errorMessage === "Entry not found or not published") {
|
|
6090
6014
|
return [];
|
|
6091
6015
|
}
|
|
6092
6016
|
throw error;
|
|
@@ -6121,10 +6045,10 @@ var EntryPublishModule = {
|
|
|
6121
6045
|
command: "publish [ids]",
|
|
6122
6046
|
describe: "Publishes entry(ies)",
|
|
6123
6047
|
builder: (yargs42) => withConfiguration(
|
|
6124
|
-
|
|
6125
|
-
|
|
6126
|
-
|
|
6127
|
-
|
|
6048
|
+
withDiffOptions(
|
|
6049
|
+
withApiOptions(
|
|
6050
|
+
withProjectOptions(
|
|
6051
|
+
withDiffOptions(
|
|
6128
6052
|
yargs42.positional("ids", {
|
|
6129
6053
|
describe: "Publishes entry(ies) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
|
|
6130
6054
|
type: "string"
|
|
@@ -6184,7 +6108,7 @@ var EntryPublishModule = {
|
|
|
6184
6108
|
fileClient
|
|
6185
6109
|
});
|
|
6186
6110
|
},
|
|
6187
|
-
compareContents:
|
|
6111
|
+
compareContents: compareCompositionsOrEntriesWithoutAssetUrls,
|
|
6188
6112
|
onBeforeWriteObject: async (sourceObject) => {
|
|
6189
6113
|
return uploadFilesForCompositionOrEntry({
|
|
6190
6114
|
entity: sourceObject,
|
|
@@ -6432,7 +6356,7 @@ var EntryRemoveModule = {
|
|
|
6432
6356
|
};
|
|
6433
6357
|
|
|
6434
6358
|
// src/commands/canvas/commands/entry/unpublish.ts
|
|
6435
|
-
import {
|
|
6359
|
+
import { CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE3 } from "@uniformdev/canvas";
|
|
6436
6360
|
import { diffJson as diffJson3 } from "diff";
|
|
6437
6361
|
var EntryUnpublishModule = {
|
|
6438
6362
|
command: "unpublish [ids]",
|
|
@@ -6456,7 +6380,7 @@ var EntryUnpublishModule = {
|
|
|
6456
6380
|
),
|
|
6457
6381
|
handler: async ({ apiHost, apiKey, proxy, ids, all, project: projectId, whatIf, verbose }) => {
|
|
6458
6382
|
if (!all && !ids || all && ids) {
|
|
6459
|
-
console.error(`Specify --all or entry ID(s) to
|
|
6383
|
+
console.error(`Specify --all or entry ID(s) to publish.`);
|
|
6460
6384
|
process.exit(1);
|
|
6461
6385
|
}
|
|
6462
6386
|
const entryIDsArray = ids ? ids.split(",").map((id) => id.trim()) : void 0;
|
|
@@ -6475,6 +6399,7 @@ var EntryUnpublishModule = {
|
|
|
6475
6399
|
entryIDs: entryIDsArray,
|
|
6476
6400
|
onlyEntries: true
|
|
6477
6401
|
});
|
|
6402
|
+
const actions = [];
|
|
6478
6403
|
const log2 = createPublishStatusSyncEngineConsoleLogger({ status: "unpublish" });
|
|
6479
6404
|
for await (const obj of target.objects) {
|
|
6480
6405
|
if (Array.isArray(obj.id)) {
|
|
@@ -6483,30 +6408,15 @@ var EntryUnpublishModule = {
|
|
|
6483
6408
|
targetItems.set(obj.id, obj);
|
|
6484
6409
|
}
|
|
6485
6410
|
}
|
|
6486
|
-
const toUnpublish = [];
|
|
6487
6411
|
for await (const sourceObject of source.objects) {
|
|
6488
|
-
toUnpublish.push(sourceObject);
|
|
6489
|
-
}
|
|
6490
|
-
const actions = [];
|
|
6491
|
-
for (const sourceObject of toUnpublish) {
|
|
6492
6412
|
const id = Array.isArray(sourceObject.id) ? sourceObject.id[0] : sourceObject.id;
|
|
6493
6413
|
const targetObject = targetItems.get(id);
|
|
6494
6414
|
if (!targetObject) {
|
|
6495
|
-
console.log(`Entry ${id}
|
|
6415
|
+
console.log(`Entry ${id} was not found`);
|
|
6416
|
+
return;
|
|
6496
6417
|
}
|
|
6497
6418
|
if (!whatIf) {
|
|
6498
|
-
actions.push(
|
|
6499
|
-
client.deleteEntry({ ...parseEntrySerializedId(id), state: CANVAS_PUBLISHED_STATE3 }).catch((err) => {
|
|
6500
|
-
const isNotFound = err instanceof ApiClientError3 && err.statusCode === 404;
|
|
6501
|
-
if (isNotFound) {
|
|
6502
|
-
console.warn(
|
|
6503
|
-
`Entry ${id} was not found when unpublishing (may already be unpublished or orphaned); skipping.`
|
|
6504
|
-
);
|
|
6505
|
-
return;
|
|
6506
|
-
}
|
|
6507
|
-
throw err;
|
|
6508
|
-
})
|
|
6509
|
-
);
|
|
6419
|
+
actions.push(client.deleteEntry({ entryId: id, state: CANVAS_PUBLISHED_STATE3 }));
|
|
6510
6420
|
}
|
|
6511
6421
|
log2({
|
|
6512
6422
|
action: "update",
|
|
@@ -6514,10 +6424,9 @@ var EntryUnpublishModule = {
|
|
|
6514
6424
|
providerId: sourceObject.providerId,
|
|
6515
6425
|
displayName: sourceObject.displayName ?? sourceObject.providerId,
|
|
6516
6426
|
whatIf,
|
|
6517
|
-
diff: () =>
|
|
6427
|
+
diff: () => diffJson3(targetObject.object, sourceObject.object)
|
|
6518
6428
|
});
|
|
6519
6429
|
}
|
|
6520
|
-
await Promise.all(actions);
|
|
6521
6430
|
}
|
|
6522
6431
|
};
|
|
6523
6432
|
|
|
@@ -6751,7 +6660,7 @@ var EntryPatternPublishModule = {
|
|
|
6751
6660
|
fileClient
|
|
6752
6661
|
});
|
|
6753
6662
|
},
|
|
6754
|
-
compareContents:
|
|
6663
|
+
compareContents: compareCompositionsOrEntriesWithoutAssetUrls,
|
|
6755
6664
|
onBeforeWriteObject: async (sourceObject) => {
|
|
6756
6665
|
return uploadFilesForCompositionOrEntry({
|
|
6757
6666
|
entity: sourceObject,
|
|
@@ -7004,11 +6913,11 @@ var EntryPatternRemoveModule = {
|
|
|
7004
6913
|
};
|
|
7005
6914
|
|
|
7006
6915
|
// src/commands/canvas/commands/entryPattern/unpublish.ts
|
|
7007
|
-
import {
|
|
6916
|
+
import { CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE4 } from "@uniformdev/canvas";
|
|
7008
6917
|
import { diffJson as diffJson4 } from "diff";
|
|
7009
6918
|
var EntryPatternUnpublishModule = {
|
|
7010
6919
|
command: "unpublish [ids]",
|
|
7011
|
-
describe: "Unpublish entry
|
|
6920
|
+
describe: "Unpublish an entry patterns",
|
|
7012
6921
|
builder: (yargs42) => withConfiguration(
|
|
7013
6922
|
withDebugOptions(
|
|
7014
6923
|
withApiOptions(
|
|
@@ -7028,7 +6937,7 @@ var EntryPatternUnpublishModule = {
|
|
|
7028
6937
|
),
|
|
7029
6938
|
handler: async ({ apiHost, apiKey, proxy, ids, all, project: projectId, whatIf, verbose }) => {
|
|
7030
6939
|
if (!all && !ids || all && ids) {
|
|
7031
|
-
console.error(`Specify --all or entry pattern ID(s) to
|
|
6940
|
+
console.error(`Specify --all or entry pattern ID(s) to publish.`);
|
|
7032
6941
|
process.exit(1);
|
|
7033
6942
|
}
|
|
7034
6943
|
const entryIDsArray = ids ? ids.split(",").map((id) => id.trim()) : void 0;
|
|
@@ -7047,6 +6956,7 @@ var EntryPatternUnpublishModule = {
|
|
|
7047
6956
|
entryIDs: entryIDsArray,
|
|
7048
6957
|
onlyPatterns: true
|
|
7049
6958
|
});
|
|
6959
|
+
const actions = [];
|
|
7050
6960
|
const log2 = createPublishStatusSyncEngineConsoleLogger({ status: "unpublish" });
|
|
7051
6961
|
for await (const obj of target.objects) {
|
|
7052
6962
|
if (Array.isArray(obj.id)) {
|
|
@@ -7055,30 +6965,15 @@ var EntryPatternUnpublishModule = {
|
|
|
7055
6965
|
targetItems.set(obj.id, obj);
|
|
7056
6966
|
}
|
|
7057
6967
|
}
|
|
7058
|
-
const toUnpublish = [];
|
|
7059
6968
|
for await (const sourceObject of source.objects) {
|
|
7060
|
-
toUnpublish.push(sourceObject);
|
|
7061
|
-
}
|
|
7062
|
-
const actions = [];
|
|
7063
|
-
for (const sourceObject of toUnpublish) {
|
|
7064
6969
|
const id = Array.isArray(sourceObject.id) ? sourceObject.id[0] : sourceObject.id;
|
|
7065
6970
|
const targetObject = targetItems.get(id);
|
|
7066
6971
|
if (!targetObject) {
|
|
7067
|
-
console.log(`Entry pattern ${id}
|
|
6972
|
+
console.log(`Entry pattern ${id} was not found`);
|
|
6973
|
+
return;
|
|
7068
6974
|
}
|
|
7069
6975
|
if (!whatIf) {
|
|
7070
|
-
actions.push(
|
|
7071
|
-
client.deleteEntry({ ...parseEntrySerializedId(id), state: CANVAS_PUBLISHED_STATE4 }).catch((err) => {
|
|
7072
|
-
const isNotFound = err instanceof ApiClientError4 && err.statusCode === 404;
|
|
7073
|
-
if (isNotFound) {
|
|
7074
|
-
console.warn(
|
|
7075
|
-
`Entry pattern ${id} was not found when unpublishing (may already be unpublished or orphaned); skipping.`
|
|
7076
|
-
);
|
|
7077
|
-
return;
|
|
7078
|
-
}
|
|
7079
|
-
throw err;
|
|
7080
|
-
})
|
|
7081
|
-
);
|
|
6976
|
+
actions.push(client.deleteEntry({ entryId: id, state: CANVAS_PUBLISHED_STATE4 }));
|
|
7082
6977
|
}
|
|
7083
6978
|
log2({
|
|
7084
6979
|
action: "update",
|
|
@@ -7086,10 +6981,9 @@ var EntryPatternUnpublishModule = {
|
|
|
7086
6981
|
providerId: sourceObject.providerId,
|
|
7087
6982
|
displayName: sourceObject.displayName ?? sourceObject.providerId,
|
|
7088
6983
|
whatIf,
|
|
7089
|
-
diff: () =>
|
|
6984
|
+
diff: () => diffJson4(targetObject.object, sourceObject.object)
|
|
7090
6985
|
});
|
|
7091
6986
|
}
|
|
7092
|
-
await Promise.all(actions);
|
|
7093
6987
|
}
|
|
7094
6988
|
};
|
|
7095
6989
|
|
|
@@ -9054,7 +8948,7 @@ var EnrichmentModule = {
|
|
|
9054
8948
|
import yargs23 from "yargs";
|
|
9055
8949
|
|
|
9056
8950
|
// src/commands/context/commands/manifest/get.ts
|
|
9057
|
-
import { ApiClientError as
|
|
8951
|
+
import { ApiClientError as ApiClientError2, UncachedManifestClient } from "@uniformdev/context/api";
|
|
9058
8952
|
import { gray as gray4, green as green6, red as red6 } from "colorette";
|
|
9059
8953
|
import { writeFile } from "fs";
|
|
9060
8954
|
import { exit } from "process";
|
|
@@ -9105,7 +8999,7 @@ var ManifestGetModule = {
|
|
|
9105
8999
|
}
|
|
9106
9000
|
} catch (e) {
|
|
9107
9001
|
let message;
|
|
9108
|
-
if (e instanceof
|
|
9002
|
+
if (e instanceof ApiClientError2) {
|
|
9109
9003
|
if (e.statusCode === 403) {
|
|
9110
9004
|
message = `The API key ${apiKey} did not have permissions to fetch the manifest. Ensure ${preview ? "Uniform Context > Read Drafts" : "Uniform Context > Manifest > Read"} permissions are granted.`;
|
|
9111
9005
|
}
|
|
@@ -9121,7 +9015,7 @@ var ManifestGetModule = {
|
|
|
9121
9015
|
};
|
|
9122
9016
|
|
|
9123
9017
|
// src/commands/context/commands/manifest/publish.ts
|
|
9124
|
-
import { ApiClientError as
|
|
9018
|
+
import { ApiClientError as ApiClientError3, UncachedManifestClient as UncachedManifestClient2 } from "@uniformdev/context/api";
|
|
9125
9019
|
import { gray as gray5, red as red7 } from "colorette";
|
|
9126
9020
|
import { exit as exit2 } from "process";
|
|
9127
9021
|
var ManifestPublishModule = {
|
|
@@ -9140,7 +9034,7 @@ var ManifestPublishModule = {
|
|
|
9140
9034
|
await client.publish();
|
|
9141
9035
|
} catch (e) {
|
|
9142
9036
|
let message;
|
|
9143
|
-
if (e instanceof
|
|
9037
|
+
if (e instanceof ApiClientError3) {
|
|
9144
9038
|
if (e.statusCode === 403) {
|
|
9145
9039
|
message = `The API key ${apiKey} did not have permissions to publish the manifest. Ensure Uniform Context > Manifest > Publish permissions are granted.`;
|
|
9146
9040
|
}
|
|
@@ -12754,23 +12648,19 @@ var SyncPullModule = {
|
|
|
12754
12648
|
return entityConfig2 !== void 0 && "state" in entityConfig2;
|
|
12755
12649
|
};
|
|
12756
12650
|
const entityConfig = config2.entitiesConfig?.[entityType];
|
|
12757
|
-
const entityFilter = resolveEntityFilter(entityConfig, "pull");
|
|
12758
12651
|
try {
|
|
12759
12652
|
await spinPromise(
|
|
12760
|
-
|
|
12761
|
-
|
|
12762
|
-
()
|
|
12763
|
-
|
|
12764
|
-
|
|
12765
|
-
|
|
12766
|
-
|
|
12767
|
-
|
|
12768
|
-
|
|
12769
|
-
|
|
12770
|
-
|
|
12771
|
-
allowEmptySource: config2.allowEmptySource
|
|
12772
|
-
})
|
|
12773
|
-
),
|
|
12653
|
+
module.handler({
|
|
12654
|
+
...otherParams,
|
|
12655
|
+
state: entityConfigSupportsPullState(entityConfig) ? entityConfig.state ?? 0 : 0,
|
|
12656
|
+
format: getFormat(entityType, config2),
|
|
12657
|
+
onlyCompositions: entityType === "composition" ? true : void 0,
|
|
12658
|
+
onlyPatterns: ["pattern", "componentPattern", "compositionPattern"].includes(entityType) ? true : void 0,
|
|
12659
|
+
patternType: entityType === "compositionPattern" ? "composition" : entityType === "componentPattern" ? "component" : void 0,
|
|
12660
|
+
mode: getPullMode(entityType, config2),
|
|
12661
|
+
directory: getPullFilename(entityType, config2),
|
|
12662
|
+
allowEmptySource: config2.allowEmptySource
|
|
12663
|
+
}),
|
|
12774
12664
|
{
|
|
12775
12665
|
text: `${entityType}\u2026`,
|
|
12776
12666
|
successText: entityType,
|
|
@@ -12922,24 +12812,19 @@ var SyncPushModule = {
|
|
|
12922
12812
|
);
|
|
12923
12813
|
}
|
|
12924
12814
|
for (const [entityType, module] of enabledEntities) {
|
|
12925
|
-
const entityConfig = config2.entitiesConfig?.[entityType];
|
|
12926
|
-
const entityFilter = resolveEntityFilter(entityConfig, "push");
|
|
12927
12815
|
try {
|
|
12928
12816
|
await spinPromise(
|
|
12929
|
-
|
|
12930
|
-
|
|
12931
|
-
|
|
12932
|
-
|
|
12933
|
-
|
|
12934
|
-
|
|
12935
|
-
|
|
12936
|
-
|
|
12937
|
-
|
|
12938
|
-
|
|
12939
|
-
|
|
12940
|
-
allowEmptySource: config2.allowEmptySource
|
|
12941
|
-
})
|
|
12942
|
-
),
|
|
12817
|
+
module.handler({
|
|
12818
|
+
...otherParams,
|
|
12819
|
+
state: 0,
|
|
12820
|
+
format: getFormat2(entityType, config2),
|
|
12821
|
+
onlyCompositions: entityType === "composition" ? true : void 0,
|
|
12822
|
+
onlyPatterns: ["pattern", "componentPattern", "compositionPattern"].includes(entityType) ? true : void 0,
|
|
12823
|
+
patternType: entityType === "compositionPattern" ? "composition" : entityType === "componentPattern" ? "component" : void 0,
|
|
12824
|
+
mode: getPushMode(entityType, config2),
|
|
12825
|
+
directory: getPushFilename(entityType, config2),
|
|
12826
|
+
allowEmptySource: config2.allowEmptySource
|
|
12827
|
+
}),
|
|
12943
12828
|
{
|
|
12944
12829
|
text: `${entityType}...`,
|
|
12945
12830
|
successText: entityType,
|
|
@@ -12955,19 +12840,15 @@ var SyncPushModule = {
|
|
|
12955
12840
|
}
|
|
12956
12841
|
}
|
|
12957
12842
|
if (config2.entitiesConfig?.componentPattern && config2.entitiesConfig?.componentPattern?.push?.disabled !== true && config2.entitiesConfig?.componentPattern?.publish) {
|
|
12958
|
-
const publishFilter = resolveEntityFilter(config2.entitiesConfig.componentPattern, "push");
|
|
12959
12843
|
try {
|
|
12960
12844
|
await spinPromise(
|
|
12961
|
-
|
|
12962
|
-
|
|
12963
|
-
|
|
12964
|
-
|
|
12965
|
-
|
|
12966
|
-
|
|
12967
|
-
|
|
12968
|
-
directory: getPushFilename("componentPattern", config2)
|
|
12969
|
-
})
|
|
12970
|
-
),
|
|
12845
|
+
ComponentPatternPublishModule.handler({
|
|
12846
|
+
...otherParams,
|
|
12847
|
+
patternType: "component",
|
|
12848
|
+
onlyPatterns: true,
|
|
12849
|
+
all: true,
|
|
12850
|
+
directory: getPushFilename("componentPattern", config2)
|
|
12851
|
+
}),
|
|
12971
12852
|
{
|
|
12972
12853
|
text: "publishing component patterns...",
|
|
12973
12854
|
successText: "published component patterns",
|
|
@@ -12983,19 +12864,15 @@ var SyncPushModule = {
|
|
|
12983
12864
|
}
|
|
12984
12865
|
}
|
|
12985
12866
|
if (config2.entitiesConfig?.compositionPattern && config2.entitiesConfig?.compositionPattern?.push?.disabled !== true && config2.entitiesConfig?.compositionPattern?.publish) {
|
|
12986
|
-
const publishFilter = resolveEntityFilter(config2.entitiesConfig.compositionPattern, "push");
|
|
12987
12867
|
try {
|
|
12988
12868
|
await spinPromise(
|
|
12989
|
-
|
|
12990
|
-
|
|
12991
|
-
|
|
12992
|
-
|
|
12993
|
-
|
|
12994
|
-
|
|
12995
|
-
|
|
12996
|
-
directory: getPushFilename("compositionPattern", config2)
|
|
12997
|
-
})
|
|
12998
|
-
),
|
|
12869
|
+
CompositionPatternPublishModule.handler({
|
|
12870
|
+
...otherParams,
|
|
12871
|
+
all: true,
|
|
12872
|
+
onlyPatterns: true,
|
|
12873
|
+
patternType: "composition",
|
|
12874
|
+
directory: getPushFilename("compositionPattern", config2)
|
|
12875
|
+
}),
|
|
12999
12876
|
{
|
|
13000
12877
|
text: "publishing composition patterns...",
|
|
13001
12878
|
successText: "published composition patterns",
|
|
@@ -13011,18 +12888,14 @@ var SyncPushModule = {
|
|
|
13011
12888
|
}
|
|
13012
12889
|
}
|
|
13013
12890
|
if (config2.entitiesConfig?.composition && config2.entitiesConfig?.composition?.push?.disabled !== true && config2.entitiesConfig?.composition?.publish) {
|
|
13014
|
-
const publishFilter = resolveEntityFilter(config2.entitiesConfig.composition, "push");
|
|
13015
12891
|
try {
|
|
13016
12892
|
await spinPromise(
|
|
13017
|
-
|
|
13018
|
-
|
|
13019
|
-
|
|
13020
|
-
|
|
13021
|
-
|
|
13022
|
-
|
|
13023
|
-
directory: getPushFilename("composition", config2)
|
|
13024
|
-
})
|
|
13025
|
-
),
|
|
12893
|
+
CompositionPublishModule.handler({
|
|
12894
|
+
...otherParams,
|
|
12895
|
+
all: true,
|
|
12896
|
+
onlyCompositions: true,
|
|
12897
|
+
directory: getPushFilename("composition", config2)
|
|
12898
|
+
}),
|
|
13026
12899
|
{
|
|
13027
12900
|
text: "publishing compositions...",
|
|
13028
12901
|
successText: "published compositions",
|
|
@@ -13038,17 +12911,13 @@ var SyncPushModule = {
|
|
|
13038
12911
|
}
|
|
13039
12912
|
}
|
|
13040
12913
|
if (config2.entitiesConfig?.entry && config2.entitiesConfig?.entry?.push?.disabled !== true && config2.entitiesConfig?.entry?.publish) {
|
|
13041
|
-
const publishFilter = resolveEntityFilter(config2.entitiesConfig.entry, "push");
|
|
13042
12914
|
try {
|
|
13043
12915
|
await spinPromise(
|
|
13044
|
-
|
|
13045
|
-
|
|
13046
|
-
|
|
13047
|
-
|
|
13048
|
-
|
|
13049
|
-
directory: getPushFilename("entry", config2)
|
|
13050
|
-
})
|
|
13051
|
-
),
|
|
12916
|
+
EntryPublishModule.handler({
|
|
12917
|
+
...otherParams,
|
|
12918
|
+
all: true,
|
|
12919
|
+
directory: getPushFilename("entry", config2)
|
|
12920
|
+
}),
|
|
13052
12921
|
{
|
|
13053
12922
|
text: "publishing entries...",
|
|
13054
12923
|
successText: "published entries",
|
|
@@ -13064,17 +12933,13 @@ var SyncPushModule = {
|
|
|
13064
12933
|
}
|
|
13065
12934
|
}
|
|
13066
12935
|
if (config2.entitiesConfig?.entryPattern && config2.entitiesConfig?.entryPattern?.push?.disabled !== true && config2.entitiesConfig?.entryPattern?.publish) {
|
|
13067
|
-
const publishFilter = resolveEntityFilter(config2.entitiesConfig.entryPattern, "push");
|
|
13068
12936
|
try {
|
|
13069
12937
|
await spinPromise(
|
|
13070
|
-
|
|
13071
|
-
|
|
13072
|
-
|
|
13073
|
-
|
|
13074
|
-
|
|
13075
|
-
directory: getPushFilename("entryPattern", config2)
|
|
13076
|
-
})
|
|
13077
|
-
),
|
|
12938
|
+
EntryPatternPublishModule.handler({
|
|
12939
|
+
...otherParams,
|
|
12940
|
+
all: true,
|
|
12941
|
+
directory: getPushFilename("entryPattern", config2)
|
|
12942
|
+
}),
|
|
13078
12943
|
{
|
|
13079
12944
|
text: "publishing entry patterns...",
|
|
13080
12945
|
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.14+053aa45e01",
|
|
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.14+053aa45e01",
|
|
32
|
+
"@uniformdev/canvas": "20.49.5-alpha.14+053aa45e01",
|
|
33
|
+
"@uniformdev/context": "20.49.5-alpha.14+053aa45e01",
|
|
34
|
+
"@uniformdev/files": "20.49.5-alpha.14+053aa45e01",
|
|
35
|
+
"@uniformdev/project-map": "20.49.5-alpha.14+053aa45e01",
|
|
36
|
+
"@uniformdev/redirect": "20.49.5-alpha.14+053aa45e01",
|
|
37
|
+
"@uniformdev/richtext": "20.49.5-alpha.14+053aa45e01",
|
|
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": "053aa45e010529b3dec14630d11a3dbecc4194f6"
|
|
85
85
|
}
|