@uniformdev/cli 20.49.5-alpha.8 → 20.50.0
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 +1 -1
- package/dist/{index-fzc0-h1F.d.mts → index-ZI3elAaF.d.mts} +1 -16
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +150 -168
- package/package.json +9 -9
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";
|
|
@@ -801,16 +773,6 @@ function serializedDequal(foo, bar) {
|
|
|
801
773
|
|
|
802
774
|
// src/sync/syncEngine.ts
|
|
803
775
|
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
|
-
}
|
|
814
776
|
async function syncEngine({
|
|
815
777
|
source,
|
|
816
778
|
target,
|
|
@@ -827,7 +789,6 @@ async function syncEngine({
|
|
|
827
789
|
//verbose = false,
|
|
828
790
|
}) {
|
|
829
791
|
const status = new ReactiveStatusUpdate((status2) => syncEngineEvents.emit("statusUpdate", status2));
|
|
830
|
-
const objectFilter = _syncObjectFilter;
|
|
831
792
|
const targetItems = /* @__PURE__ */ new Map();
|
|
832
793
|
const deleteTracker = /* @__PURE__ */ new Set();
|
|
833
794
|
const processDelete = async (object4) => {
|
|
@@ -856,9 +817,6 @@ async function syncEngine({
|
|
|
856
817
|
}
|
|
857
818
|
};
|
|
858
819
|
for await (const obj of target.objects) {
|
|
859
|
-
if (objectFilter && !objectFilter(obj)) {
|
|
860
|
-
continue;
|
|
861
|
-
}
|
|
862
820
|
status.fetched++;
|
|
863
821
|
if (Array.isArray(obj.id)) {
|
|
864
822
|
obj.id.forEach((o) => targetItems.set(o, obj));
|
|
@@ -869,9 +827,6 @@ async function syncEngine({
|
|
|
869
827
|
const actions = [];
|
|
870
828
|
let sourceHasItems = false;
|
|
871
829
|
for await (let sourceObject of source.objects) {
|
|
872
|
-
if (objectFilter && !objectFilter(sourceObject)) {
|
|
873
|
-
continue;
|
|
874
|
-
}
|
|
875
830
|
sourceHasItems = true;
|
|
876
831
|
if (onBeforeProcessObject) {
|
|
877
832
|
await onBeforeProcessObject(sourceObject);
|
|
@@ -1169,7 +1124,7 @@ import { PostHog } from "posthog-node";
|
|
|
1169
1124
|
// package.json
|
|
1170
1125
|
var package_default = {
|
|
1171
1126
|
name: "@uniformdev/cli",
|
|
1172
|
-
version: "20.
|
|
1127
|
+
version: "20.50.0",
|
|
1173
1128
|
description: "Uniform command line interface tool",
|
|
1174
1129
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
1175
1130
|
main: "./cli.js",
|
|
@@ -2657,6 +2612,15 @@ var compareCompositionsOrEntriesWithoutAssetUrls = (source, target) => {
|
|
|
2657
2612
|
removeUrlsFromAssetParameters(structuredClone(target.object))
|
|
2658
2613
|
);
|
|
2659
2614
|
};
|
|
2615
|
+
var PUBLISH_TIMESTAMP_TOLERANCE_MS = 2e3;
|
|
2616
|
+
var compareCompositionsOrEntriesWithoutAssetUrlsForPublishing = (source, target) => {
|
|
2617
|
+
const sourceModified = new Date(source.object.modified).getTime();
|
|
2618
|
+
const targetModified = new Date(target.object.modified).getTime();
|
|
2619
|
+
if (sourceModified - targetModified > PUBLISH_TIMESTAMP_TOLERANCE_MS) {
|
|
2620
|
+
return false;
|
|
2621
|
+
}
|
|
2622
|
+
return compareCompositionsOrEntriesWithoutAssetUrls(source, target);
|
|
2623
|
+
};
|
|
2660
2624
|
var removeUrlFromAsset = (asset) => {
|
|
2661
2625
|
if (asset.asset.fields?.url?.value) {
|
|
2662
2626
|
asset.asset.fields.url.value = "";
|
|
@@ -4246,7 +4210,7 @@ var CompositionPublishModule = {
|
|
|
4246
4210
|
fileClient
|
|
4247
4211
|
});
|
|
4248
4212
|
},
|
|
4249
|
-
compareContents:
|
|
4213
|
+
compareContents: compareCompositionsOrEntriesWithoutAssetUrlsForPublishing,
|
|
4250
4214
|
onBeforeWriteObject: async (sourceObject) => {
|
|
4251
4215
|
return uploadFilesForCompositionOrEntry({
|
|
4252
4216
|
entity: sourceObject,
|
|
@@ -4701,7 +4665,10 @@ var ComponentPatternRemoveModule = {
|
|
|
4701
4665
|
};
|
|
4702
4666
|
|
|
4703
4667
|
// src/commands/canvas/commands/composition/unpublish.ts
|
|
4704
|
-
import {
|
|
4668
|
+
import {
|
|
4669
|
+
ApiClientError,
|
|
4670
|
+
CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE2
|
|
4671
|
+
} from "@uniformdev/canvas";
|
|
4705
4672
|
import { diffJson as diffJson2 } from "diff";
|
|
4706
4673
|
var CompositionUnpublishModule = {
|
|
4707
4674
|
command: "unpublish [ids]",
|
|
@@ -4715,15 +4682,15 @@ var CompositionUnpublishModule = {
|
|
|
4715
4682
|
type: "string"
|
|
4716
4683
|
}).option("all", {
|
|
4717
4684
|
alias: ["a"],
|
|
4718
|
-
describe: "Un-publishes all compositions. Use
|
|
4685
|
+
describe: "Un-publishes all compositions. Use composition ID(s) to unpublish specific one(s) instead.",
|
|
4719
4686
|
default: false,
|
|
4720
4687
|
type: "boolean"
|
|
4721
4688
|
}).option("onlyCompositions", {
|
|
4722
|
-
describe: "Only publishing compositions and not patterns",
|
|
4689
|
+
describe: "Only un-publishing compositions and not patterns",
|
|
4723
4690
|
default: false,
|
|
4724
4691
|
type: "boolean"
|
|
4725
4692
|
}).option("onlyPatterns", {
|
|
4726
|
-
describe: "Only
|
|
4693
|
+
describe: "Only un-publishing patterns and not compositions",
|
|
4727
4694
|
default: false,
|
|
4728
4695
|
type: "boolean",
|
|
4729
4696
|
hidden: true
|
|
@@ -4746,7 +4713,7 @@ var CompositionUnpublishModule = {
|
|
|
4746
4713
|
verbose
|
|
4747
4714
|
}) => {
|
|
4748
4715
|
if (!all && !ids || all && ids) {
|
|
4749
|
-
console.error(`Specify --all or composition ID(s) to
|
|
4716
|
+
console.error(`Specify --all or composition ID(s) to unpublish.`);
|
|
4750
4717
|
process.exit(1);
|
|
4751
4718
|
}
|
|
4752
4719
|
const compositionIDsArray = ids ? ids.split(",").map((id) => id.trim()) : void 0;
|
|
@@ -4771,7 +4738,6 @@ var CompositionUnpublishModule = {
|
|
|
4771
4738
|
patternType,
|
|
4772
4739
|
verbose
|
|
4773
4740
|
});
|
|
4774
|
-
const actions = [];
|
|
4775
4741
|
const log2 = createPublishStatusSyncEngineConsoleLogger({ status: "unpublish" });
|
|
4776
4742
|
for await (const obj of target.objects) {
|
|
4777
4743
|
if (Array.isArray(obj.id)) {
|
|
@@ -4780,16 +4746,30 @@ var CompositionUnpublishModule = {
|
|
|
4780
4746
|
targetItems.set(obj.id, obj);
|
|
4781
4747
|
}
|
|
4782
4748
|
}
|
|
4749
|
+
const toUnpublish = [];
|
|
4783
4750
|
for await (const sourceObject of source.objects) {
|
|
4751
|
+
toUnpublish.push(sourceObject);
|
|
4752
|
+
}
|
|
4753
|
+
const actions = [];
|
|
4754
|
+
for (const sourceObject of toUnpublish) {
|
|
4784
4755
|
const id = Array.isArray(sourceObject.id) ? sourceObject.id[0] : sourceObject.id;
|
|
4785
4756
|
const targetObject = targetItems.get(id);
|
|
4786
4757
|
if (!targetObject) {
|
|
4787
|
-
console.log(`Composition ${id}
|
|
4788
|
-
return;
|
|
4758
|
+
console.log(`Composition ${id} did not have a draft (removing published)`);
|
|
4789
4759
|
}
|
|
4790
|
-
console.log(`\u{1F41B} unpublishing composition: (id: ${id})`);
|
|
4791
4760
|
if (!whatIf) {
|
|
4792
|
-
actions.push(
|
|
4761
|
+
actions.push(
|
|
4762
|
+
client.removeComposition({ ...parseCompositionSerializedId(id), state: CANVAS_PUBLISHED_STATE2 }).catch((err) => {
|
|
4763
|
+
const isNotFound = err instanceof ApiClientError && err.statusCode === 404;
|
|
4764
|
+
if (isNotFound) {
|
|
4765
|
+
console.warn(
|
|
4766
|
+
`Composition ${id} was not found when unpublishing (may already be unpublished or orphaned); skipping.`
|
|
4767
|
+
);
|
|
4768
|
+
return;
|
|
4769
|
+
}
|
|
4770
|
+
throw err;
|
|
4771
|
+
})
|
|
4772
|
+
);
|
|
4793
4773
|
}
|
|
4794
4774
|
log2({
|
|
4795
4775
|
action: "update",
|
|
@@ -4797,9 +4777,10 @@ var CompositionUnpublishModule = {
|
|
|
4797
4777
|
providerId: sourceObject.providerId,
|
|
4798
4778
|
displayName: sourceObject.displayName ?? sourceObject.providerId,
|
|
4799
4779
|
whatIf,
|
|
4800
|
-
diff: () => diffJson2(targetObject.object, sourceObject.object)
|
|
4780
|
+
diff: () => targetObject ? diffJson2(targetObject.object, sourceObject.object) : []
|
|
4801
4781
|
});
|
|
4802
4782
|
}
|
|
4783
|
+
await Promise.all(actions);
|
|
4803
4784
|
}
|
|
4804
4785
|
};
|
|
4805
4786
|
|
|
@@ -4816,7 +4797,7 @@ var ComponentPatternUnpublishModule = {
|
|
|
4816
4797
|
type: "string"
|
|
4817
4798
|
}).option("all", {
|
|
4818
4799
|
alias: ["a"],
|
|
4819
|
-
describe: "Un-publishes all
|
|
4800
|
+
describe: "Un-publishes all component patterns. Use composition ID(s) to unpublish specific one(s) instead.",
|
|
4820
4801
|
default: false,
|
|
4821
4802
|
type: "boolean"
|
|
4822
4803
|
}).option("onlyCompositions", {
|
|
@@ -5111,7 +5092,7 @@ var CompositionPatternUnpublishModule = {
|
|
|
5111
5092
|
type: "string"
|
|
5112
5093
|
}).option("all", {
|
|
5113
5094
|
alias: ["a"],
|
|
5114
|
-
describe: "Un-publishes all
|
|
5095
|
+
describe: "Un-publishes all composition patterns. Use composition ID(s) to unpublish specific one(s) instead.",
|
|
5115
5096
|
default: false,
|
|
5116
5097
|
type: "boolean"
|
|
5117
5098
|
}).option("onlyCompositions", {
|
|
@@ -6009,7 +5990,7 @@ var EntryListModule = {
|
|
|
6009
5990
|
};
|
|
6010
5991
|
|
|
6011
5992
|
// src/commands/canvas/entryEngineDataSource.ts
|
|
6012
|
-
import { ApiClientError, convertEntryToPutEntry } from "@uniformdev/canvas";
|
|
5993
|
+
import { ApiClientError as ApiClientError2, convertEntryToPutEntry } from "@uniformdev/canvas";
|
|
6013
5994
|
|
|
6014
5995
|
// src/commands/canvas/commands/entry/_util.ts
|
|
6015
5996
|
var selectEntryIdentifier = (e) => {
|
|
@@ -6055,7 +6036,7 @@ function createEntryEngineDataSource({
|
|
|
6055
6036
|
editions: "all"
|
|
6056
6037
|
})).entries;
|
|
6057
6038
|
} catch (error) {
|
|
6058
|
-
if (error instanceof
|
|
6039
|
+
if (error instanceof ApiClientError2 && error.errorMessage === "Entry not found or not published") {
|
|
6059
6040
|
return [];
|
|
6060
6041
|
}
|
|
6061
6042
|
throw error;
|
|
@@ -6090,10 +6071,10 @@ var EntryPublishModule = {
|
|
|
6090
6071
|
command: "publish [ids]",
|
|
6091
6072
|
describe: "Publishes entry(ies)",
|
|
6092
6073
|
builder: (yargs42) => withConfiguration(
|
|
6093
|
-
|
|
6094
|
-
|
|
6095
|
-
|
|
6096
|
-
|
|
6074
|
+
withDebugOptions(
|
|
6075
|
+
withDiffOptions(
|
|
6076
|
+
withApiOptions(
|
|
6077
|
+
withProjectOptions(
|
|
6097
6078
|
yargs42.positional("ids", {
|
|
6098
6079
|
describe: "Publishes entry(ies) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
|
|
6099
6080
|
type: "string"
|
|
@@ -6153,7 +6134,7 @@ var EntryPublishModule = {
|
|
|
6153
6134
|
fileClient
|
|
6154
6135
|
});
|
|
6155
6136
|
},
|
|
6156
|
-
compareContents:
|
|
6137
|
+
compareContents: compareCompositionsOrEntriesWithoutAssetUrlsForPublishing,
|
|
6157
6138
|
onBeforeWriteObject: async (sourceObject) => {
|
|
6158
6139
|
return uploadFilesForCompositionOrEntry({
|
|
6159
6140
|
entity: sourceObject,
|
|
@@ -6401,7 +6382,7 @@ var EntryRemoveModule = {
|
|
|
6401
6382
|
};
|
|
6402
6383
|
|
|
6403
6384
|
// src/commands/canvas/commands/entry/unpublish.ts
|
|
6404
|
-
import { CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE3 } from "@uniformdev/canvas";
|
|
6385
|
+
import { ApiClientError as ApiClientError3, CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE3 } from "@uniformdev/canvas";
|
|
6405
6386
|
import { diffJson as diffJson3 } from "diff";
|
|
6406
6387
|
var EntryUnpublishModule = {
|
|
6407
6388
|
command: "unpublish [ids]",
|
|
@@ -6425,7 +6406,7 @@ var EntryUnpublishModule = {
|
|
|
6425
6406
|
),
|
|
6426
6407
|
handler: async ({ apiHost, apiKey, proxy, ids, all, project: projectId, whatIf, verbose }) => {
|
|
6427
6408
|
if (!all && !ids || all && ids) {
|
|
6428
|
-
console.error(`Specify --all or entry ID(s) to
|
|
6409
|
+
console.error(`Specify --all or entry ID(s) to unpublish.`);
|
|
6429
6410
|
process.exit(1);
|
|
6430
6411
|
}
|
|
6431
6412
|
const entryIDsArray = ids ? ids.split(",").map((id) => id.trim()) : void 0;
|
|
@@ -6444,7 +6425,6 @@ var EntryUnpublishModule = {
|
|
|
6444
6425
|
entryIDs: entryIDsArray,
|
|
6445
6426
|
onlyEntries: true
|
|
6446
6427
|
});
|
|
6447
|
-
const actions = [];
|
|
6448
6428
|
const log2 = createPublishStatusSyncEngineConsoleLogger({ status: "unpublish" });
|
|
6449
6429
|
for await (const obj of target.objects) {
|
|
6450
6430
|
if (Array.isArray(obj.id)) {
|
|
@@ -6453,15 +6433,30 @@ var EntryUnpublishModule = {
|
|
|
6453
6433
|
targetItems.set(obj.id, obj);
|
|
6454
6434
|
}
|
|
6455
6435
|
}
|
|
6436
|
+
const toUnpublish = [];
|
|
6456
6437
|
for await (const sourceObject of source.objects) {
|
|
6438
|
+
toUnpublish.push(sourceObject);
|
|
6439
|
+
}
|
|
6440
|
+
const actions = [];
|
|
6441
|
+
for (const sourceObject of toUnpublish) {
|
|
6457
6442
|
const id = Array.isArray(sourceObject.id) ? sourceObject.id[0] : sourceObject.id;
|
|
6458
6443
|
const targetObject = targetItems.get(id);
|
|
6459
6444
|
if (!targetObject) {
|
|
6460
|
-
console.log(`Entry ${id}
|
|
6461
|
-
return;
|
|
6445
|
+
console.log(`Entry ${id} did not have a draft (removing published)`);
|
|
6462
6446
|
}
|
|
6463
6447
|
if (!whatIf) {
|
|
6464
|
-
actions.push(
|
|
6448
|
+
actions.push(
|
|
6449
|
+
client.deleteEntry({ ...parseEntrySerializedId(id), state: CANVAS_PUBLISHED_STATE3 }).catch((err) => {
|
|
6450
|
+
const isNotFound = err instanceof ApiClientError3 && err.statusCode === 404;
|
|
6451
|
+
if (isNotFound) {
|
|
6452
|
+
console.warn(
|
|
6453
|
+
`Entry ${id} was not found when unpublishing (may already be unpublished or orphaned); skipping.`
|
|
6454
|
+
);
|
|
6455
|
+
return;
|
|
6456
|
+
}
|
|
6457
|
+
throw err;
|
|
6458
|
+
})
|
|
6459
|
+
);
|
|
6465
6460
|
}
|
|
6466
6461
|
log2({
|
|
6467
6462
|
action: "update",
|
|
@@ -6469,9 +6464,10 @@ var EntryUnpublishModule = {
|
|
|
6469
6464
|
providerId: sourceObject.providerId,
|
|
6470
6465
|
displayName: sourceObject.displayName ?? sourceObject.providerId,
|
|
6471
6466
|
whatIf,
|
|
6472
|
-
diff: () => diffJson3(targetObject.object, sourceObject.object)
|
|
6467
|
+
diff: () => targetObject ? diffJson3(targetObject.object, sourceObject.object) : []
|
|
6473
6468
|
});
|
|
6474
6469
|
}
|
|
6470
|
+
await Promise.all(actions);
|
|
6475
6471
|
}
|
|
6476
6472
|
};
|
|
6477
6473
|
|
|
@@ -6705,7 +6701,7 @@ var EntryPatternPublishModule = {
|
|
|
6705
6701
|
fileClient
|
|
6706
6702
|
});
|
|
6707
6703
|
},
|
|
6708
|
-
compareContents:
|
|
6704
|
+
compareContents: compareCompositionsOrEntriesWithoutAssetUrlsForPublishing,
|
|
6709
6705
|
onBeforeWriteObject: async (sourceObject) => {
|
|
6710
6706
|
return uploadFilesForCompositionOrEntry({
|
|
6711
6707
|
entity: sourceObject,
|
|
@@ -6958,11 +6954,11 @@ var EntryPatternRemoveModule = {
|
|
|
6958
6954
|
};
|
|
6959
6955
|
|
|
6960
6956
|
// src/commands/canvas/commands/entryPattern/unpublish.ts
|
|
6961
|
-
import { CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE4 } from "@uniformdev/canvas";
|
|
6957
|
+
import { ApiClientError as ApiClientError4, CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE4 } from "@uniformdev/canvas";
|
|
6962
6958
|
import { diffJson as diffJson4 } from "diff";
|
|
6963
6959
|
var EntryPatternUnpublishModule = {
|
|
6964
6960
|
command: "unpublish [ids]",
|
|
6965
|
-
describe: "Unpublish
|
|
6961
|
+
describe: "Unpublish entry pattern(s)",
|
|
6966
6962
|
builder: (yargs42) => withConfiguration(
|
|
6967
6963
|
withDebugOptions(
|
|
6968
6964
|
withApiOptions(
|
|
@@ -6982,7 +6978,7 @@ var EntryPatternUnpublishModule = {
|
|
|
6982
6978
|
),
|
|
6983
6979
|
handler: async ({ apiHost, apiKey, proxy, ids, all, project: projectId, whatIf, verbose }) => {
|
|
6984
6980
|
if (!all && !ids || all && ids) {
|
|
6985
|
-
console.error(`Specify --all or entry pattern ID(s) to
|
|
6981
|
+
console.error(`Specify --all or entry pattern ID(s) to unpublish.`);
|
|
6986
6982
|
process.exit(1);
|
|
6987
6983
|
}
|
|
6988
6984
|
const entryIDsArray = ids ? ids.split(",").map((id) => id.trim()) : void 0;
|
|
@@ -7001,7 +6997,6 @@ var EntryPatternUnpublishModule = {
|
|
|
7001
6997
|
entryIDs: entryIDsArray,
|
|
7002
6998
|
onlyPatterns: true
|
|
7003
6999
|
});
|
|
7004
|
-
const actions = [];
|
|
7005
7000
|
const log2 = createPublishStatusSyncEngineConsoleLogger({ status: "unpublish" });
|
|
7006
7001
|
for await (const obj of target.objects) {
|
|
7007
7002
|
if (Array.isArray(obj.id)) {
|
|
@@ -7010,15 +7005,30 @@ var EntryPatternUnpublishModule = {
|
|
|
7010
7005
|
targetItems.set(obj.id, obj);
|
|
7011
7006
|
}
|
|
7012
7007
|
}
|
|
7008
|
+
const toUnpublish = [];
|
|
7013
7009
|
for await (const sourceObject of source.objects) {
|
|
7010
|
+
toUnpublish.push(sourceObject);
|
|
7011
|
+
}
|
|
7012
|
+
const actions = [];
|
|
7013
|
+
for (const sourceObject of toUnpublish) {
|
|
7014
7014
|
const id = Array.isArray(sourceObject.id) ? sourceObject.id[0] : sourceObject.id;
|
|
7015
7015
|
const targetObject = targetItems.get(id);
|
|
7016
7016
|
if (!targetObject) {
|
|
7017
|
-
console.log(`Entry pattern ${id}
|
|
7018
|
-
return;
|
|
7017
|
+
console.log(`Entry pattern ${id} did not have a draft (removing published)`);
|
|
7019
7018
|
}
|
|
7020
7019
|
if (!whatIf) {
|
|
7021
|
-
actions.push(
|
|
7020
|
+
actions.push(
|
|
7021
|
+
client.deleteEntry({ ...parseEntrySerializedId(id), state: CANVAS_PUBLISHED_STATE4 }).catch((err) => {
|
|
7022
|
+
const isNotFound = err instanceof ApiClientError4 && err.statusCode === 404;
|
|
7023
|
+
if (isNotFound) {
|
|
7024
|
+
console.warn(
|
|
7025
|
+
`Entry pattern ${id} was not found when unpublishing (may already be unpublished or orphaned); skipping.`
|
|
7026
|
+
);
|
|
7027
|
+
return;
|
|
7028
|
+
}
|
|
7029
|
+
throw err;
|
|
7030
|
+
})
|
|
7031
|
+
);
|
|
7022
7032
|
}
|
|
7023
7033
|
log2({
|
|
7024
7034
|
action: "update",
|
|
@@ -7026,9 +7036,10 @@ var EntryPatternUnpublishModule = {
|
|
|
7026
7036
|
providerId: sourceObject.providerId,
|
|
7027
7037
|
displayName: sourceObject.displayName ?? sourceObject.providerId,
|
|
7028
7038
|
whatIf,
|
|
7029
|
-
diff: () => diffJson4(targetObject.object, sourceObject.object)
|
|
7039
|
+
diff: () => targetObject ? diffJson4(targetObject.object, sourceObject.object) : []
|
|
7030
7040
|
});
|
|
7031
7041
|
}
|
|
7042
|
+
await Promise.all(actions);
|
|
7032
7043
|
}
|
|
7033
7044
|
};
|
|
7034
7045
|
|
|
@@ -8993,7 +9004,7 @@ var EnrichmentModule = {
|
|
|
8993
9004
|
import yargs23 from "yargs";
|
|
8994
9005
|
|
|
8995
9006
|
// src/commands/context/commands/manifest/get.ts
|
|
8996
|
-
import { ApiClientError as
|
|
9007
|
+
import { ApiClientError as ApiClientError5, UncachedManifestClient } from "@uniformdev/context/api";
|
|
8997
9008
|
import { gray as gray4, green as green6, red as red6 } from "colorette";
|
|
8998
9009
|
import { writeFile } from "fs";
|
|
8999
9010
|
import { exit } from "process";
|
|
@@ -9044,7 +9055,7 @@ var ManifestGetModule = {
|
|
|
9044
9055
|
}
|
|
9045
9056
|
} catch (e) {
|
|
9046
9057
|
let message;
|
|
9047
|
-
if (e instanceof
|
|
9058
|
+
if (e instanceof ApiClientError5) {
|
|
9048
9059
|
if (e.statusCode === 403) {
|
|
9049
9060
|
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.`;
|
|
9050
9061
|
}
|
|
@@ -9060,7 +9071,7 @@ var ManifestGetModule = {
|
|
|
9060
9071
|
};
|
|
9061
9072
|
|
|
9062
9073
|
// src/commands/context/commands/manifest/publish.ts
|
|
9063
|
-
import { ApiClientError as
|
|
9074
|
+
import { ApiClientError as ApiClientError6, UncachedManifestClient as UncachedManifestClient2 } from "@uniformdev/context/api";
|
|
9064
9075
|
import { gray as gray5, red as red7 } from "colorette";
|
|
9065
9076
|
import { exit as exit2 } from "process";
|
|
9066
9077
|
var ManifestPublishModule = {
|
|
@@ -9079,7 +9090,7 @@ var ManifestPublishModule = {
|
|
|
9079
9090
|
await client.publish();
|
|
9080
9091
|
} catch (e) {
|
|
9081
9092
|
let message;
|
|
9082
|
-
if (e instanceof
|
|
9093
|
+
if (e instanceof ApiClientError6) {
|
|
9083
9094
|
if (e.statusCode === 403) {
|
|
9084
9095
|
message = `The API key ${apiKey} did not have permissions to publish the manifest. Ensure Uniform Context > Manifest > Publish permissions are granted.`;
|
|
9085
9096
|
}
|
|
@@ -12693,23 +12704,19 @@ var SyncPullModule = {
|
|
|
12693
12704
|
return entityConfig2 !== void 0 && "state" in entityConfig2;
|
|
12694
12705
|
};
|
|
12695
12706
|
const entityConfig = config2.entitiesConfig?.[entityType];
|
|
12696
|
-
const entityFilter = resolveEntityFilter(entityConfig, "pull");
|
|
12697
12707
|
try {
|
|
12698
12708
|
await spinPromise(
|
|
12699
|
-
|
|
12700
|
-
|
|
12701
|
-
()
|
|
12702
|
-
|
|
12703
|
-
|
|
12704
|
-
|
|
12705
|
-
|
|
12706
|
-
|
|
12707
|
-
|
|
12708
|
-
|
|
12709
|
-
|
|
12710
|
-
allowEmptySource: config2.allowEmptySource
|
|
12711
|
-
})
|
|
12712
|
-
),
|
|
12709
|
+
module.handler({
|
|
12710
|
+
...otherParams,
|
|
12711
|
+
state: entityConfigSupportsPullState(entityConfig) ? entityConfig.state ?? 0 : 0,
|
|
12712
|
+
format: getFormat(entityType, config2),
|
|
12713
|
+
onlyCompositions: entityType === "composition" ? true : void 0,
|
|
12714
|
+
onlyPatterns: ["pattern", "componentPattern", "compositionPattern"].includes(entityType) ? true : void 0,
|
|
12715
|
+
patternType: entityType === "compositionPattern" ? "composition" : entityType === "componentPattern" ? "component" : void 0,
|
|
12716
|
+
mode: getPullMode(entityType, config2),
|
|
12717
|
+
directory: getPullFilename(entityType, config2),
|
|
12718
|
+
allowEmptySource: config2.allowEmptySource
|
|
12719
|
+
}),
|
|
12713
12720
|
{
|
|
12714
12721
|
text: `${entityType}\u2026`,
|
|
12715
12722
|
successText: entityType,
|
|
@@ -12861,24 +12868,19 @@ var SyncPushModule = {
|
|
|
12861
12868
|
);
|
|
12862
12869
|
}
|
|
12863
12870
|
for (const [entityType, module] of enabledEntities) {
|
|
12864
|
-
const entityConfig = config2.entitiesConfig?.[entityType];
|
|
12865
|
-
const entityFilter = resolveEntityFilter(entityConfig, "push");
|
|
12866
12871
|
try {
|
|
12867
12872
|
await spinPromise(
|
|
12868
|
-
|
|
12869
|
-
|
|
12870
|
-
|
|
12871
|
-
|
|
12872
|
-
|
|
12873
|
-
|
|
12874
|
-
|
|
12875
|
-
|
|
12876
|
-
|
|
12877
|
-
|
|
12878
|
-
|
|
12879
|
-
allowEmptySource: config2.allowEmptySource
|
|
12880
|
-
})
|
|
12881
|
-
),
|
|
12873
|
+
module.handler({
|
|
12874
|
+
...otherParams,
|
|
12875
|
+
state: 0,
|
|
12876
|
+
format: getFormat2(entityType, config2),
|
|
12877
|
+
onlyCompositions: entityType === "composition" ? true : void 0,
|
|
12878
|
+
onlyPatterns: ["pattern", "componentPattern", "compositionPattern"].includes(entityType) ? true : void 0,
|
|
12879
|
+
patternType: entityType === "compositionPattern" ? "composition" : entityType === "componentPattern" ? "component" : void 0,
|
|
12880
|
+
mode: getPushMode(entityType, config2),
|
|
12881
|
+
directory: getPushFilename(entityType, config2),
|
|
12882
|
+
allowEmptySource: config2.allowEmptySource
|
|
12883
|
+
}),
|
|
12882
12884
|
{
|
|
12883
12885
|
text: `${entityType}...`,
|
|
12884
12886
|
successText: entityType,
|
|
@@ -12894,19 +12896,15 @@ var SyncPushModule = {
|
|
|
12894
12896
|
}
|
|
12895
12897
|
}
|
|
12896
12898
|
if (config2.entitiesConfig?.componentPattern && config2.entitiesConfig?.componentPattern?.push?.disabled !== true && config2.entitiesConfig?.componentPattern?.publish) {
|
|
12897
|
-
const publishFilter = resolveEntityFilter(config2.entitiesConfig.componentPattern, "push");
|
|
12898
12899
|
try {
|
|
12899
12900
|
await spinPromise(
|
|
12900
|
-
|
|
12901
|
-
|
|
12902
|
-
|
|
12903
|
-
|
|
12904
|
-
|
|
12905
|
-
|
|
12906
|
-
|
|
12907
|
-
directory: getPushFilename("componentPattern", config2)
|
|
12908
|
-
})
|
|
12909
|
-
),
|
|
12901
|
+
ComponentPatternPublishModule.handler({
|
|
12902
|
+
...otherParams,
|
|
12903
|
+
patternType: "component",
|
|
12904
|
+
onlyPatterns: true,
|
|
12905
|
+
all: true,
|
|
12906
|
+
directory: getPushFilename("componentPattern", config2)
|
|
12907
|
+
}),
|
|
12910
12908
|
{
|
|
12911
12909
|
text: "publishing component patterns...",
|
|
12912
12910
|
successText: "published component patterns",
|
|
@@ -12922,19 +12920,15 @@ var SyncPushModule = {
|
|
|
12922
12920
|
}
|
|
12923
12921
|
}
|
|
12924
12922
|
if (config2.entitiesConfig?.compositionPattern && config2.entitiesConfig?.compositionPattern?.push?.disabled !== true && config2.entitiesConfig?.compositionPattern?.publish) {
|
|
12925
|
-
const publishFilter = resolveEntityFilter(config2.entitiesConfig.compositionPattern, "push");
|
|
12926
12923
|
try {
|
|
12927
12924
|
await spinPromise(
|
|
12928
|
-
|
|
12929
|
-
|
|
12930
|
-
|
|
12931
|
-
|
|
12932
|
-
|
|
12933
|
-
|
|
12934
|
-
|
|
12935
|
-
directory: getPushFilename("compositionPattern", config2)
|
|
12936
|
-
})
|
|
12937
|
-
),
|
|
12925
|
+
CompositionPatternPublishModule.handler({
|
|
12926
|
+
...otherParams,
|
|
12927
|
+
all: true,
|
|
12928
|
+
onlyPatterns: true,
|
|
12929
|
+
patternType: "composition",
|
|
12930
|
+
directory: getPushFilename("compositionPattern", config2)
|
|
12931
|
+
}),
|
|
12938
12932
|
{
|
|
12939
12933
|
text: "publishing composition patterns...",
|
|
12940
12934
|
successText: "published composition patterns",
|
|
@@ -12950,18 +12944,14 @@ var SyncPushModule = {
|
|
|
12950
12944
|
}
|
|
12951
12945
|
}
|
|
12952
12946
|
if (config2.entitiesConfig?.composition && config2.entitiesConfig?.composition?.push?.disabled !== true && config2.entitiesConfig?.composition?.publish) {
|
|
12953
|
-
const publishFilter = resolveEntityFilter(config2.entitiesConfig.composition, "push");
|
|
12954
12947
|
try {
|
|
12955
12948
|
await spinPromise(
|
|
12956
|
-
|
|
12957
|
-
|
|
12958
|
-
|
|
12959
|
-
|
|
12960
|
-
|
|
12961
|
-
|
|
12962
|
-
directory: getPushFilename("composition", config2)
|
|
12963
|
-
})
|
|
12964
|
-
),
|
|
12949
|
+
CompositionPublishModule.handler({
|
|
12950
|
+
...otherParams,
|
|
12951
|
+
all: true,
|
|
12952
|
+
onlyCompositions: true,
|
|
12953
|
+
directory: getPushFilename("composition", config2)
|
|
12954
|
+
}),
|
|
12965
12955
|
{
|
|
12966
12956
|
text: "publishing compositions...",
|
|
12967
12957
|
successText: "published compositions",
|
|
@@ -12977,17 +12967,13 @@ var SyncPushModule = {
|
|
|
12977
12967
|
}
|
|
12978
12968
|
}
|
|
12979
12969
|
if (config2.entitiesConfig?.entry && config2.entitiesConfig?.entry?.push?.disabled !== true && config2.entitiesConfig?.entry?.publish) {
|
|
12980
|
-
const publishFilter = resolveEntityFilter(config2.entitiesConfig.entry, "push");
|
|
12981
12970
|
try {
|
|
12982
12971
|
await spinPromise(
|
|
12983
|
-
|
|
12984
|
-
|
|
12985
|
-
|
|
12986
|
-
|
|
12987
|
-
|
|
12988
|
-
directory: getPushFilename("entry", config2)
|
|
12989
|
-
})
|
|
12990
|
-
),
|
|
12972
|
+
EntryPublishModule.handler({
|
|
12973
|
+
...otherParams,
|
|
12974
|
+
all: true,
|
|
12975
|
+
directory: getPushFilename("entry", config2)
|
|
12976
|
+
}),
|
|
12991
12977
|
{
|
|
12992
12978
|
text: "publishing entries...",
|
|
12993
12979
|
successText: "published entries",
|
|
@@ -13003,17 +12989,13 @@ var SyncPushModule = {
|
|
|
13003
12989
|
}
|
|
13004
12990
|
}
|
|
13005
12991
|
if (config2.entitiesConfig?.entryPattern && config2.entitiesConfig?.entryPattern?.push?.disabled !== true && config2.entitiesConfig?.entryPattern?.publish) {
|
|
13006
|
-
const publishFilter = resolveEntityFilter(config2.entitiesConfig.entryPattern, "push");
|
|
13007
12992
|
try {
|
|
13008
12993
|
await spinPromise(
|
|
13009
|
-
|
|
13010
|
-
|
|
13011
|
-
|
|
13012
|
-
|
|
13013
|
-
|
|
13014
|
-
directory: getPushFilename("entryPattern", config2)
|
|
13015
|
-
})
|
|
13016
|
-
),
|
|
12994
|
+
EntryPatternPublishModule.handler({
|
|
12995
|
+
...otherParams,
|
|
12996
|
+
all: true,
|
|
12997
|
+
directory: getPushFilename("entryPattern", config2)
|
|
12998
|
+
}),
|
|
13017
12999
|
{
|
|
13018
13000
|
text: "publishing entry patterns...",
|
|
13019
13001
|
successText: "published entry patterns",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/cli",
|
|
3
|
-
"version": "20.
|
|
3
|
+
"version": "20.50.0",
|
|
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.
|
|
32
|
-
"@uniformdev/canvas": "20.
|
|
33
|
-
"@uniformdev/context": "20.
|
|
34
|
-
"@uniformdev/files": "20.
|
|
35
|
-
"@uniformdev/project-map": "20.
|
|
36
|
-
"@uniformdev/redirect": "20.
|
|
37
|
-
"@uniformdev/richtext": "20.
|
|
31
|
+
"@uniformdev/assets": "20.50.0",
|
|
32
|
+
"@uniformdev/canvas": "20.50.0",
|
|
33
|
+
"@uniformdev/context": "20.50.0",
|
|
34
|
+
"@uniformdev/files": "20.50.0",
|
|
35
|
+
"@uniformdev/project-map": "20.50.0",
|
|
36
|
+
"@uniformdev/redirect": "20.50.0",
|
|
37
|
+
"@uniformdev/richtext": "20.50.0",
|
|
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": "58f9d804c4f3e01abea765fa69202b540427e999"
|
|
85
85
|
}
|