contentful-import 10.4.0 → 10.5.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/README.md +17 -1
- package/dist/index.js +205 -136
- package/dist/index.mjs +205 -136
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -4517,34 +4517,6 @@ var createBaseEach_default = createBaseEach;
|
|
|
4517
4517
|
var baseEach = createBaseEach_default(baseForOwn_default);
|
|
4518
4518
|
var baseEach_default = baseEach;
|
|
4519
4519
|
|
|
4520
|
-
// node_modules/lodash-es/defaults.js
|
|
4521
|
-
var objectProto18 = Object.prototype;
|
|
4522
|
-
var hasOwnProperty15 = objectProto18.hasOwnProperty;
|
|
4523
|
-
var defaults = baseRest_default(function(object, sources) {
|
|
4524
|
-
object = Object(object);
|
|
4525
|
-
var index = -1;
|
|
4526
|
-
var length = sources.length;
|
|
4527
|
-
var guard = length > 2 ? sources[2] : void 0;
|
|
4528
|
-
if (guard && isIterateeCall_default(sources[0], sources[1], guard)) {
|
|
4529
|
-
length = 1;
|
|
4530
|
-
}
|
|
4531
|
-
while (++index < length) {
|
|
4532
|
-
var source = sources[index];
|
|
4533
|
-
var props = keysIn_default(source);
|
|
4534
|
-
var propsIndex = -1;
|
|
4535
|
-
var propsLength = props.length;
|
|
4536
|
-
while (++propsIndex < propsLength) {
|
|
4537
|
-
var key = props[propsIndex];
|
|
4538
|
-
var value = object[key];
|
|
4539
|
-
if (value === void 0 || eq_default(value, objectProto18[key]) && !hasOwnProperty15.call(object, key)) {
|
|
4540
|
-
object[key] = source[key];
|
|
4541
|
-
}
|
|
4542
|
-
}
|
|
4543
|
-
}
|
|
4544
|
-
return object;
|
|
4545
|
-
});
|
|
4546
|
-
var defaults_default = defaults;
|
|
4547
|
-
|
|
4548
4520
|
// node_modules/lodash-es/last.js
|
|
4549
4521
|
function last(array) {
|
|
4550
4522
|
var length = array == null ? 0 : array.length;
|
|
@@ -4625,10 +4597,10 @@ function map(collection, iteratee) {
|
|
|
4625
4597
|
var map_default = map;
|
|
4626
4598
|
|
|
4627
4599
|
// node_modules/lodash-es/_baseHas.js
|
|
4628
|
-
var
|
|
4629
|
-
var
|
|
4600
|
+
var objectProto18 = Object.prototype;
|
|
4601
|
+
var hasOwnProperty15 = objectProto18.hasOwnProperty;
|
|
4630
4602
|
function baseHas(object, key) {
|
|
4631
|
-
return object != null &&
|
|
4603
|
+
return object != null && hasOwnProperty15.call(object, key);
|
|
4632
4604
|
}
|
|
4633
4605
|
var baseHas_default = baseHas;
|
|
4634
4606
|
|
|
@@ -4682,8 +4654,8 @@ function negate(predicate) {
|
|
|
4682
4654
|
var negate_default = negate;
|
|
4683
4655
|
|
|
4684
4656
|
// node_modules/lodash-es/_baseUnset.js
|
|
4685
|
-
var
|
|
4686
|
-
var
|
|
4657
|
+
var objectProto19 = Object.prototype;
|
|
4658
|
+
var hasOwnProperty16 = objectProto19.hasOwnProperty;
|
|
4687
4659
|
function baseUnset(object, path) {
|
|
4688
4660
|
path = castPath_default(path, object);
|
|
4689
4661
|
var index = -1, length = path.length;
|
|
@@ -4692,7 +4664,7 @@ function baseUnset(object, path) {
|
|
|
4692
4664
|
}
|
|
4693
4665
|
while (++index < length) {
|
|
4694
4666
|
var key = toKey_default(path[index]);
|
|
4695
|
-
if (key === "__proto__" && !
|
|
4667
|
+
if (key === "__proto__" && !hasOwnProperty16.call(object, "__proto__")) {
|
|
4696
4668
|
return false;
|
|
4697
4669
|
}
|
|
4698
4670
|
if ((key === "constructor" || key === "prototype") && index < length - 1) {
|
|
@@ -4855,7 +4827,7 @@ var startCase = createCompounder_default(function(result, word, index) {
|
|
|
4855
4827
|
var startCase_default = startCase;
|
|
4856
4828
|
|
|
4857
4829
|
// lib/index.ts
|
|
4858
|
-
var
|
|
4830
|
+
var import_logging14 = __toESM(require_logging());
|
|
4859
4831
|
var import_listr4 = __toESM(require_listr());
|
|
4860
4832
|
import PQueue from "p-queue";
|
|
4861
4833
|
|
|
@@ -4889,17 +4861,17 @@ import Promise3 from "bluebird";
|
|
|
4889
4861
|
|
|
4890
4862
|
// lib/utils/publish-exo-entities.ts
|
|
4891
4863
|
var import_logging2 = __toESM(require_logging());
|
|
4892
|
-
function filterExoEntitiesToPublish(
|
|
4864
|
+
function filterExoEntitiesToPublish(entities2, sourceEntities) {
|
|
4893
4865
|
const entityIdsToPublish = new Set(
|
|
4894
4866
|
sourceEntities.filter((entity) => entity.sys.publishedVersion).map((entity) => entity.sys.id)
|
|
4895
4867
|
);
|
|
4896
|
-
return
|
|
4868
|
+
return entities2.filter((entity) => entityIdsToPublish.has(entity.sys.id));
|
|
4897
4869
|
}
|
|
4898
|
-
function filterExoEntitiesToUnpublish(
|
|
4870
|
+
function filterExoEntitiesToUnpublish(entities2, sourceEntities) {
|
|
4899
4871
|
const entityIdsPublishedInSource = new Set(
|
|
4900
4872
|
sourceEntities.filter((entity) => entity.sys.publishedVersion).map((entity) => entity.sys.id)
|
|
4901
4873
|
);
|
|
4902
|
-
return
|
|
4874
|
+
return entities2.filter((entity) => entity.sys.publishedVersion && !entityIdsPublishedInSource.has(entity.sys.id));
|
|
4903
4875
|
}
|
|
4904
4876
|
async function publishExoEntity(type, entity, publish) {
|
|
4905
4877
|
try {
|
|
@@ -4961,6 +4933,17 @@ function isExoEntitlementError(err) {
|
|
|
4961
4933
|
return false;
|
|
4962
4934
|
}
|
|
4963
4935
|
}
|
|
4936
|
+
function isTimelineEntitlementError(err) {
|
|
4937
|
+
if (!(err instanceof Error)) {
|
|
4938
|
+
return false;
|
|
4939
|
+
}
|
|
4940
|
+
try {
|
|
4941
|
+
const parsed = JSON.parse(err.message);
|
|
4942
|
+
return parsed?.status === 403 && parsed?.details?.reasons === "Timeline is not enabled for this organization";
|
|
4943
|
+
} catch {
|
|
4944
|
+
return false;
|
|
4945
|
+
}
|
|
4946
|
+
}
|
|
4964
4947
|
var EXO_M1_FEATURE = "exoM1";
|
|
4965
4948
|
async function spaceHasExoM1Entitlement(client, spaceId) {
|
|
4966
4949
|
try {
|
|
@@ -4987,7 +4970,8 @@ var CURSOR_QUERY_METHODS = {
|
|
|
4987
4970
|
experienceTemplates: { name: "experience templates", namespace: "experienceTemplate" },
|
|
4988
4971
|
experienceFragments: { name: "experience fragments", namespace: "experienceFragment" },
|
|
4989
4972
|
dataAssemblies: { name: "data assemblies", namespace: "dataAssembly" },
|
|
4990
|
-
experiences: { name: "experiences", namespace: "experience" }
|
|
4973
|
+
experiences: { name: "experiences", namespace: "experience" },
|
|
4974
|
+
releases: { name: "releases", namespace: "release" }
|
|
4991
4975
|
};
|
|
4992
4976
|
var ENTITY_METHODS = {
|
|
4993
4977
|
contentTypes: { name: "content types", ns: "contentType" },
|
|
@@ -5090,11 +5074,26 @@ async function cursorPaginatedQuery({ client, spaceId, environmentId, type, requ
|
|
|
5090
5074
|
const allItems = [];
|
|
5091
5075
|
do {
|
|
5092
5076
|
const items = await requestQueue.add(async () => {
|
|
5093
|
-
|
|
5094
|
-
|
|
5095
|
-
|
|
5096
|
-
|
|
5097
|
-
|
|
5077
|
+
let response;
|
|
5078
|
+
if (type === "releases") {
|
|
5079
|
+
response = await client.release.query({
|
|
5080
|
+
environmentId,
|
|
5081
|
+
spaceId,
|
|
5082
|
+
query: {
|
|
5083
|
+
"metadata.annotations.Contentful:Timeline.type[nin]": "Staging,Hidden",
|
|
5084
|
+
"sys.schemaVersion": "Release.v2",
|
|
5085
|
+
"sys.status[in]": "active",
|
|
5086
|
+
limit: BATCH_SIZE_LIMIT,
|
|
5087
|
+
...pageNext && { pageNext }
|
|
5088
|
+
}
|
|
5089
|
+
});
|
|
5090
|
+
} else {
|
|
5091
|
+
response = await client[namespace].getMany({
|
|
5092
|
+
spaceId,
|
|
5093
|
+
environmentId,
|
|
5094
|
+
query: { limit: BATCH_SIZE_LIMIT, ...pageNext && { pageNext } }
|
|
5095
|
+
});
|
|
5096
|
+
}
|
|
5098
5097
|
totalFetched += response.items.length;
|
|
5099
5098
|
import_logging3.logEmitter.emit("info", `Fetched ${totalFetched} ${entityTypeName}`);
|
|
5100
5099
|
pageNext = response.pages?.next;
|
|
@@ -5111,6 +5110,8 @@ async function cursorPaginatedQueryOrWarn(params) {
|
|
|
5111
5110
|
const { name: entityTypeName } = CURSOR_QUERY_METHODS[params.type];
|
|
5112
5111
|
if (isExoEntitlementError(err)) {
|
|
5113
5112
|
import_logging3.logEmitter.emit("error", new Error(`Skipping ${entityTypeName} import: Experience Orchestration (ExO) is not enabled for this space`));
|
|
5113
|
+
} else if (isTimelineEntitlementError(err)) {
|
|
5114
|
+
import_logging3.logEmitter.emit("error", new Error(`Skipping ${entityTypeName} import: Timeline (Releases) is not enabled for this organization`));
|
|
5114
5115
|
} else {
|
|
5115
5116
|
import_logging3.logEmitter.emit("error", err instanceof Error ? err : new Error(String(err)));
|
|
5116
5117
|
}
|
|
@@ -5140,7 +5141,8 @@ async function getDestinationData({
|
|
|
5140
5141
|
experienceFragments: [],
|
|
5141
5142
|
dataAssemblies: [],
|
|
5142
5143
|
designTokens: [],
|
|
5143
|
-
webhooks: []
|
|
5144
|
+
webhooks: [],
|
|
5145
|
+
releases: []
|
|
5144
5146
|
};
|
|
5145
5147
|
sourceData = {
|
|
5146
5148
|
...result,
|
|
@@ -5201,6 +5203,7 @@ async function getDestinationData({
|
|
|
5201
5203
|
requestQueue
|
|
5202
5204
|
});
|
|
5203
5205
|
}
|
|
5206
|
+
result.releases = cursorPaginatedQueryOrWarn({ client, spaceId, environmentId, type: "releases", requestQueue });
|
|
5204
5207
|
if (includeExperienceOrchestration && client) {
|
|
5205
5208
|
const sourceHasDesignTokens = Boolean(sourceData.designTokens?.length);
|
|
5206
5209
|
const sourceHasComponents = Boolean(sourceData.components?.length);
|
|
@@ -5238,7 +5241,7 @@ async function getDestinationData({
|
|
|
5238
5241
|
}
|
|
5239
5242
|
|
|
5240
5243
|
// lib/tasks/push-to-space/push-to-space.ts
|
|
5241
|
-
var
|
|
5244
|
+
var import_logging12 = __toESM(require_logging());
|
|
5242
5245
|
var import_listr2 = __toESM(require_listr());
|
|
5243
5246
|
import Listr from "listr";
|
|
5244
5247
|
import verboseRenderer from "listr-verbose-renderer";
|
|
@@ -5340,14 +5343,14 @@ async function processAssets({
|
|
|
5340
5343
|
// lib/tasks/push-to-space/creation.ts
|
|
5341
5344
|
var import_get_entity_name2 = __toESM(require_get_entity_name());
|
|
5342
5345
|
var import_logging5 = __toESM(require_logging());
|
|
5343
|
-
function createEntities({ context, entities, destinationEntitiesById, skipUpdates, requestQueue }) {
|
|
5344
|
-
return createEntitiesWithConcurrency({ context, entities, destinationEntitiesById, skipUpdates, requestQueue });
|
|
5346
|
+
function createEntities({ context, entities: entities2, destinationEntitiesById, skipUpdates, requestQueue }) {
|
|
5347
|
+
return createEntitiesWithConcurrency({ context, entities: entities2, destinationEntitiesById, skipUpdates, requestQueue });
|
|
5345
5348
|
}
|
|
5346
|
-
function createLocales({ context, entities, destinationEntitiesById, requestQueue }) {
|
|
5347
|
-
return createEntitiesInSequence({ context, entities, destinationEntitiesById, requestQueue });
|
|
5349
|
+
function createLocales({ context, entities: entities2, destinationEntitiesById, requestQueue }) {
|
|
5350
|
+
return createEntitiesInSequence({ context, entities: entities2, destinationEntitiesById, requestQueue });
|
|
5348
5351
|
}
|
|
5349
|
-
async function createEntitiesWithConcurrency({ context, entities, destinationEntitiesById, skipUpdates, requestQueue }) {
|
|
5350
|
-
const pendingCreatedEntities =
|
|
5352
|
+
async function createEntitiesWithConcurrency({ context, entities: entities2, destinationEntitiesById, skipUpdates, requestQueue }) {
|
|
5353
|
+
const pendingCreatedEntities = entities2.map((entity) => {
|
|
5351
5354
|
const destinationEntity = getDestinationEntityForSourceEntity(destinationEntitiesById, entity.transformed);
|
|
5352
5355
|
const updateOperation = skipUpdates ? "skip" : "update";
|
|
5353
5356
|
const operation = destinationEntity ? updateOperation : "create";
|
|
@@ -5368,9 +5371,9 @@ async function createEntitiesWithConcurrency({ context, entities, destinationEnt
|
|
|
5368
5371
|
const createdEntities = await Promise.all(pendingCreatedEntities);
|
|
5369
5372
|
return createdEntities.filter((entity) => entity);
|
|
5370
5373
|
}
|
|
5371
|
-
async function createEntitiesInSequence({ context, entities, destinationEntitiesById, requestQueue }) {
|
|
5374
|
+
async function createEntitiesInSequence({ context, entities: entities2, destinationEntitiesById, requestQueue }) {
|
|
5372
5375
|
const createdEntities = [];
|
|
5373
|
-
for (const entity of
|
|
5376
|
+
for (const entity of entities2) {
|
|
5374
5377
|
const destinationEntity = getDestinationEntityForSourceEntity(destinationEntitiesById, entity.transformed);
|
|
5375
5378
|
const operation = destinationEntity ? "update" : "create";
|
|
5376
5379
|
try {
|
|
@@ -5389,8 +5392,8 @@ async function createEntitiesInSequence({ context, entities, destinationEntities
|
|
|
5389
5392
|
}
|
|
5390
5393
|
return createdEntities;
|
|
5391
5394
|
}
|
|
5392
|
-
async function createEntries({ context, entities, destinationEntitiesById, skipUpdates, requestQueue }) {
|
|
5393
|
-
const createdEntries = await Promise.all(
|
|
5395
|
+
async function createEntries({ context, entities: entities2, destinationEntitiesById, skipUpdates, requestQueue }) {
|
|
5396
|
+
const createdEntries = await Promise.all(entities2.map((entry) => {
|
|
5394
5397
|
return createEntry({ entry, context, destinationEntitiesById, skipUpdates, requestQueue });
|
|
5395
5398
|
}));
|
|
5396
5399
|
return createdEntries.filter((entry) => entry);
|
|
@@ -5645,27 +5648,27 @@ function archiveEntity(client, spaceId, environmentId, entity) {
|
|
|
5645
5648
|
}
|
|
5646
5649
|
throw new Error(`archiveEntity: unsupported type "${type}"`);
|
|
5647
5650
|
}
|
|
5648
|
-
async function publishEntities({ entities, client, spaceId, environmentId, requestQueue, localePublishing }) {
|
|
5649
|
-
if (
|
|
5651
|
+
async function publishEntities({ entities: entities2, client, spaceId, environmentId, requestQueue, localePublishing }) {
|
|
5652
|
+
if (entities2.length === 0) {
|
|
5650
5653
|
import_logging7.logEmitter.emit("info", "Skipping publishing since zero valid entities passed");
|
|
5651
5654
|
return [];
|
|
5652
5655
|
}
|
|
5653
|
-
const entity =
|
|
5656
|
+
const entity = entities2[0];
|
|
5654
5657
|
const type = entity.sys.type || "unknown type";
|
|
5655
|
-
import_logging7.logEmitter.emit("info", `Publishing ${
|
|
5656
|
-
const result = await runQueue(
|
|
5658
|
+
import_logging7.logEmitter.emit("info", `Publishing ${entities2.length} ${type}s`);
|
|
5659
|
+
const result = await runQueue(entities2, [], client, spaceId, environmentId, requestQueue, localePublishing);
|
|
5657
5660
|
import_logging7.logEmitter.emit("info", `Successfully published ${result.length} ${type}s`);
|
|
5658
5661
|
return result;
|
|
5659
5662
|
}
|
|
5660
|
-
async function archiveEntities({ entities, client, spaceId, environmentId, requestQueue }) {
|
|
5661
|
-
if (
|
|
5663
|
+
async function archiveEntities({ entities: entities2, client, spaceId, environmentId, requestQueue }) {
|
|
5664
|
+
if (entities2.length === 0) {
|
|
5662
5665
|
import_logging7.logEmitter.emit("info", "Skipping archiving since zero valid entities passed");
|
|
5663
5666
|
return [];
|
|
5664
5667
|
}
|
|
5665
|
-
const entity =
|
|
5668
|
+
const entity = entities2[0];
|
|
5666
5669
|
const type = entity.sys.type || "unknown type";
|
|
5667
|
-
import_logging7.logEmitter.emit("info", `Archiving ${
|
|
5668
|
-
const pendingArchivedEntities =
|
|
5670
|
+
import_logging7.logEmitter.emit("info", `Archiving ${entities2.length} ${type}s`);
|
|
5671
|
+
const pendingArchivedEntities = entities2.map((entity2) => {
|
|
5669
5672
|
return requestQueue.add(async () => {
|
|
5670
5673
|
try {
|
|
5671
5674
|
const archivedEntity = await archiveEntity(client, spaceId, environmentId, entity2);
|
|
@@ -5753,6 +5756,55 @@ async function runQueue(queue, result = [], client, spaceId, environmentId, requ
|
|
|
5753
5756
|
return result;
|
|
5754
5757
|
}
|
|
5755
5758
|
|
|
5759
|
+
// lib/tasks/push-to-space/releases.ts
|
|
5760
|
+
var import_logging8 = __toESM(require_logging());
|
|
5761
|
+
function partitionReleasesBySchemaVersion(releases2) {
|
|
5762
|
+
return {
|
|
5763
|
+
supported: releases2.filter((release) => release.transformed.sys.schemaVersion === "Release.v2"),
|
|
5764
|
+
unsupported: releases2.filter((release) => release.transformed.sys.schemaVersion !== "Release.v2")
|
|
5765
|
+
};
|
|
5766
|
+
}
|
|
5767
|
+
function logUnsupportedRelease(release) {
|
|
5768
|
+
import_logging8.logEmitter.emit("error", new Error(
|
|
5769
|
+
`Skipping Release "${release.transformed.sys.id}": only Release.v2 ("Releases") is supported, got schemaVersion "${release.transformed.sys.schemaVersion}"`
|
|
5770
|
+
));
|
|
5771
|
+
}
|
|
5772
|
+
function buildReleaseCreatePayload(release) {
|
|
5773
|
+
const { id: _sourceId, ...sourceSysWithoutId } = release.transformed.sys;
|
|
5774
|
+
return {
|
|
5775
|
+
...release.transformed,
|
|
5776
|
+
entities: release.transformed.entities,
|
|
5777
|
+
sys: { ...sourceSysWithoutId, type: "Release", schemaVersion: "Release.v2" }
|
|
5778
|
+
};
|
|
5779
|
+
}
|
|
5780
|
+
function buildReleaseUpdatePayload(release) {
|
|
5781
|
+
return {
|
|
5782
|
+
...release.transformed,
|
|
5783
|
+
entities: release.transformed.entities,
|
|
5784
|
+
sys: { type: "Release", schemaVersion: "Release.v2" }
|
|
5785
|
+
};
|
|
5786
|
+
}
|
|
5787
|
+
async function importRelease(release, existing, context) {
|
|
5788
|
+
const { client, spaceId, environmentId } = context;
|
|
5789
|
+
try {
|
|
5790
|
+
if (existing) {
|
|
5791
|
+
const result2 = await client.release.update(
|
|
5792
|
+
{ spaceId, environmentId, releaseId: existing.sys.id, version: existing.sys.version },
|
|
5793
|
+
buildReleaseUpdatePayload(release)
|
|
5794
|
+
);
|
|
5795
|
+
import_logging8.logEmitter.emit("info", `UPDATE Release ${existing.sys.id}`);
|
|
5796
|
+
return result2;
|
|
5797
|
+
}
|
|
5798
|
+
const result = await client.release.create({ spaceId, environmentId }, buildReleaseCreatePayload(release));
|
|
5799
|
+
import_logging8.logEmitter.emit("info", `CREATE Release ${result.sys.id}`);
|
|
5800
|
+
return result;
|
|
5801
|
+
} catch (err) {
|
|
5802
|
+
err.entity = release.transformed;
|
|
5803
|
+
import_logging8.logEmitter.emit("error", err);
|
|
5804
|
+
return null;
|
|
5805
|
+
}
|
|
5806
|
+
}
|
|
5807
|
+
|
|
5756
5808
|
// lib/utils/graphql-schema-backoff.ts
|
|
5757
5809
|
var GRAPHQL_SCHEMA_STALE_DELAYS_MS = [500, 1500, 6e3];
|
|
5758
5810
|
function isGraphQLSchemaStaleError(err) {
|
|
@@ -5879,18 +5931,18 @@ function sortExperienceFragments(experienceFragments) {
|
|
|
5879
5931
|
}
|
|
5880
5932
|
|
|
5881
5933
|
// lib/utils/sort-or-report.ts
|
|
5882
|
-
var
|
|
5934
|
+
var import_logging9 = __toESM(require_logging());
|
|
5883
5935
|
function sortOrReport(sortFn) {
|
|
5884
5936
|
try {
|
|
5885
5937
|
return sortFn();
|
|
5886
5938
|
} catch (err) {
|
|
5887
|
-
|
|
5939
|
+
import_logging9.logEmitter.emit("error", err);
|
|
5888
5940
|
throw err;
|
|
5889
5941
|
}
|
|
5890
5942
|
}
|
|
5891
5943
|
|
|
5892
5944
|
// lib/utils/import-exo-folders.ts
|
|
5893
|
-
var
|
|
5945
|
+
var import_logging10 = __toESM(require_logging());
|
|
5894
5946
|
var FOLDER_CONCEPT_PREFIX = "contentful.folder-";
|
|
5895
5947
|
var PARENT_FOLDER_GROUP_IDS = {
|
|
5896
5948
|
designToken: "contentful.folder-group-designToken",
|
|
@@ -5907,8 +5959,8 @@ var ENTITY_TYPE_TO_PARENT_GROUP_ID = {
|
|
|
5907
5959
|
experiences: PARENT_FOLDER_GROUP_IDS.experience
|
|
5908
5960
|
};
|
|
5909
5961
|
function getSourceSpaceId(sourceEntities) {
|
|
5910
|
-
for (const
|
|
5911
|
-
for (const entity of
|
|
5962
|
+
for (const entities2 of Object.values(sourceEntities)) {
|
|
5963
|
+
for (const entity of entities2 ?? []) {
|
|
5912
5964
|
const spaceId = entity.sys?.space?.sys?.id;
|
|
5913
5965
|
if (spaceId) return spaceId;
|
|
5914
5966
|
}
|
|
@@ -5960,7 +6012,7 @@ async function createOrPatchChildConcepts(client, organizationId, destinationSpa
|
|
|
5960
6012
|
existing = await client.concept.get({ organizationId, conceptId: destConceptId });
|
|
5961
6013
|
} catch (err) {
|
|
5962
6014
|
if (err?.name !== "NotFound") {
|
|
5963
|
-
|
|
6015
|
+
import_logging10.logEmitter.emit("warning", `Could not fetch destination child concept ${destConceptId}: ${err?.message ?? err}`);
|
|
5964
6016
|
}
|
|
5965
6017
|
}
|
|
5966
6018
|
if (!existing) {
|
|
@@ -5970,9 +6022,9 @@ async function createOrPatchChildConcepts(client, organizationId, destinationSpa
|
|
|
5970
6022
|
// @ts-expect-error - CMA.js type needs to be updated to be aware of purpose: 'internal'
|
|
5971
6023
|
{ purpose: "internal", prefLabel, metadata: { spaces: [spaceLink] } }
|
|
5972
6024
|
);
|
|
5973
|
-
|
|
6025
|
+
import_logging10.logEmitter.emit("info", `Created child folder concept ${destConceptId}`);
|
|
5974
6026
|
} catch (err) {
|
|
5975
|
-
|
|
6027
|
+
import_logging10.logEmitter.emit("error", `Failed to create child folder concept ${destConceptId}: ${err?.message ?? err}`);
|
|
5976
6028
|
}
|
|
5977
6029
|
} else {
|
|
5978
6030
|
const patches = [];
|
|
@@ -5986,9 +6038,9 @@ async function createOrPatchChildConcepts(client, organizationId, destinationSpa
|
|
|
5986
6038
|
{ organizationId, conceptId: destConceptId, version: existing.sys.version },
|
|
5987
6039
|
patches
|
|
5988
6040
|
);
|
|
5989
|
-
|
|
6041
|
+
import_logging10.logEmitter.emit("info", `Patched child folder concept ${destConceptId} (${patches.map((p) => p.path).join(", ")})`);
|
|
5990
6042
|
} catch (err) {
|
|
5991
|
-
|
|
6043
|
+
import_logging10.logEmitter.emit("error", `Failed to patch child folder concept ${destConceptId}: ${err?.message ?? err}`);
|
|
5992
6044
|
}
|
|
5993
6045
|
}
|
|
5994
6046
|
}
|
|
@@ -6006,14 +6058,14 @@ async function linkChildConceptsToParentGroups(client, organizationId, childConc
|
|
|
6006
6058
|
[{ op: "add", path: "/concepts/-", value: { sys: { type: "Link", linkType: "TaxonomyConcept", id: destConceptId } } }]
|
|
6007
6059
|
);
|
|
6008
6060
|
parentGroups.set(parentGroupId, updated);
|
|
6009
|
-
|
|
6061
|
+
import_logging10.logEmitter.emit("info", `Linked child concept ${destConceptId} to parent group ${parentGroupId}`);
|
|
6010
6062
|
} catch (err) {
|
|
6011
|
-
|
|
6063
|
+
import_logging10.logEmitter.emit("error", `Failed to link child concept ${destConceptId} to parent group ${parentGroupId}: ${err?.message ?? err}`);
|
|
6012
6064
|
}
|
|
6013
6065
|
}
|
|
6014
6066
|
}
|
|
6015
|
-
function rewriteEntityFolderConcepts(
|
|
6016
|
-
for (const entity of
|
|
6067
|
+
function rewriteEntityFolderConcepts(entities2, childConceptMap) {
|
|
6068
|
+
for (const entity of entities2) {
|
|
6017
6069
|
if (!entity.metadata?.concepts) continue;
|
|
6018
6070
|
entity.metadata.concepts = entity.metadata.concepts.map((link) => {
|
|
6019
6071
|
const entry = childConceptMap.get(link.sys.id);
|
|
@@ -6030,17 +6082,17 @@ async function importExoFolders({
|
|
|
6030
6082
|
}) {
|
|
6031
6083
|
const sourceSpaceId = getSourceSpaceId(sourceEntities);
|
|
6032
6084
|
if (sourceSpaceId === destinationSpaceId) {
|
|
6033
|
-
|
|
6085
|
+
import_logging10.logEmitter.emit("info", "Source and destination space are the same \u2014 skipping ExO folder import");
|
|
6034
6086
|
return;
|
|
6035
6087
|
}
|
|
6036
6088
|
const parentGroups = await ensureParentFolderGroupsExist(client, organizationId);
|
|
6037
6089
|
if (parentGroups.size === 0) {
|
|
6038
|
-
|
|
6090
|
+
import_logging10.logEmitter.emit("warn", "One or more Experience Orchestration folder group concept schemes are missing in the destination organization. Please create them before importing.");
|
|
6039
6091
|
return;
|
|
6040
6092
|
}
|
|
6041
6093
|
const childConceptMap = deriveChildConceptMap(sourceEntities, destinationSpaceId);
|
|
6042
6094
|
if (childConceptMap.size === 0) return;
|
|
6043
|
-
|
|
6095
|
+
import_logging10.logEmitter.emit("info", `Importing ${childConceptMap.size} ExO folder concept(s) into destination space ${destinationSpaceId}`);
|
|
6044
6096
|
await createOrPatchChildConcepts(client, organizationId, destinationSpaceId, childConceptMap);
|
|
6045
6097
|
await linkChildConceptsToParentGroups(client, organizationId, childConceptMap, parentGroups);
|
|
6046
6098
|
const allEntities = [
|
|
@@ -6106,7 +6158,7 @@ function buildLocalePublishPlan(sourceEntities, destinationLocaleCodes, { destin
|
|
|
6106
6158
|
}
|
|
6107
6159
|
|
|
6108
6160
|
// lib/utils/destination-locales.ts
|
|
6109
|
-
var
|
|
6161
|
+
var import_logging11 = __toESM(require_logging());
|
|
6110
6162
|
var cache = /* @__PURE__ */ new WeakMap();
|
|
6111
6163
|
function getDestinationLocaleCodes({ client, spaceId, environmentId, requestQueue }) {
|
|
6112
6164
|
let byEnvironment = cache.get(client);
|
|
@@ -6118,7 +6170,7 @@ function getDestinationLocaleCodes({ client, spaceId, environmentId, requestQueu
|
|
|
6118
6170
|
let localeCodes = byEnvironment.get(key);
|
|
6119
6171
|
if (!localeCodes) {
|
|
6120
6172
|
localeCodes = batchedPageQuery({ client, spaceId, environmentId, type: "locales", requestQueue }).then((items) => items.map((locale) => locale.code)).catch((err) => {
|
|
6121
|
-
|
|
6173
|
+
import_logging11.logEmitter.emit("warning", `Could not read the locales of the destination environment, falling back to publishing all locales: ${err.message}`);
|
|
6122
6174
|
return null;
|
|
6123
6175
|
});
|
|
6124
6176
|
byEnvironment.set(key, localeCodes);
|
|
@@ -6137,7 +6189,7 @@ async function withGraphQLSchemaBackoff(fn) {
|
|
|
6137
6189
|
throw err;
|
|
6138
6190
|
}
|
|
6139
6191
|
const delay = GRAPHQL_SCHEMA_STALE_DELAYS_MS[attempt];
|
|
6140
|
-
|
|
6192
|
+
import_logging12.logEmitter.emit("warning", `DataAssembly GraphQL schema not yet current, retrying in ${delay}ms (attempt ${attempt + 1}/${GRAPHQL_SCHEMA_STALE_DELAYS_MS.length})`);
|
|
6141
6193
|
await new Promise((resolve2) => setTimeout(resolve2, delay));
|
|
6142
6194
|
lastErr = err;
|
|
6143
6195
|
}
|
|
@@ -6188,15 +6240,15 @@ function pushToSpace({
|
|
|
6188
6240
|
...sourceData.experienceFragments || []
|
|
6189
6241
|
].some((parent2) => (parent2.optimizationVariants || []).some(isRealOptimizationVariant));
|
|
6190
6242
|
if (includeExperienceOrchestration && !skipExoVariants && hasOptimizationVariants) {
|
|
6191
|
-
|
|
6243
|
+
import_logging12.logEmitter.emit("warning", "Optimization Variants are imported with new destination IDs and can be duplicated by re-imports. Set skipExoVariants to true to skip them.");
|
|
6192
6244
|
}
|
|
6193
6245
|
listrOptions = listrOptions || {
|
|
6194
6246
|
renderer: verboseRenderer
|
|
6195
6247
|
};
|
|
6196
6248
|
const destinationDataById = {};
|
|
6197
|
-
for (const [entityType,
|
|
6249
|
+
for (const [entityType, entities2] of Object.entries(destinationData)) {
|
|
6198
6250
|
const entitiesById = /* @__PURE__ */ new Map();
|
|
6199
|
-
for (const entity of
|
|
6251
|
+
for (const entity of entities2) {
|
|
6200
6252
|
entitiesById.set(entity.sys.id, entity);
|
|
6201
6253
|
}
|
|
6202
6254
|
destinationDataById[entityType] = entitiesById;
|
|
@@ -6285,7 +6337,7 @@ function pushToSpace({
|
|
|
6285
6337
|
const ctEditorInterface = await requestQueue.add(
|
|
6286
6338
|
() => client.editorInterface.get({ spaceId, environmentId, contentTypeId: contentType.sys.id })
|
|
6287
6339
|
);
|
|
6288
|
-
|
|
6340
|
+
import_logging12.logEmitter.emit("info", `Fetched editor interface for ${contentType.name}`);
|
|
6289
6341
|
const updatedData = {
|
|
6290
6342
|
...ctEditorInterface,
|
|
6291
6343
|
controls: editorInterface.controls,
|
|
@@ -6303,7 +6355,7 @@ function pushToSpace({
|
|
|
6303
6355
|
return updatedEditorInterface;
|
|
6304
6356
|
} catch (err) {
|
|
6305
6357
|
err.entity = editorInterface;
|
|
6306
|
-
|
|
6358
|
+
import_logging12.logEmitter.emit("error", err);
|
|
6307
6359
|
return null;
|
|
6308
6360
|
}
|
|
6309
6361
|
});
|
|
@@ -6321,7 +6373,7 @@ function pushToSpace({
|
|
|
6321
6373
|
for (const file of Object.values(asset.transformed.fields.file)) {
|
|
6322
6374
|
allPendingUploads.push(requestQueue.add(async () => {
|
|
6323
6375
|
try {
|
|
6324
|
-
|
|
6376
|
+
import_logging12.logEmitter.emit("info", `Uploading Asset file ${file.upload}`);
|
|
6325
6377
|
const assetStream = await getAssetStreamForURL(file.upload, assetsDirectory);
|
|
6326
6378
|
const upload = await client.upload.create(
|
|
6327
6379
|
{ spaceId, environmentId },
|
|
@@ -6337,7 +6389,7 @@ function pushToSpace({
|
|
|
6337
6389
|
};
|
|
6338
6390
|
return upload;
|
|
6339
6391
|
} catch (err) {
|
|
6340
|
-
|
|
6392
|
+
import_logging12.logEmitter.emit("error", err);
|
|
6341
6393
|
}
|
|
6342
6394
|
}));
|
|
6343
6395
|
}
|
|
@@ -6483,7 +6535,7 @@ function pushToSpace({
|
|
|
6483
6535
|
}
|
|
6484
6536
|
});
|
|
6485
6537
|
} catch (error) {
|
|
6486
|
-
|
|
6538
|
+
import_logging12.logEmitter.emit("warning", `Unable to create Experience Orchestration (ExO) folders, error: ${error}`);
|
|
6487
6539
|
}
|
|
6488
6540
|
}),
|
|
6489
6541
|
skip: () => !includeExperienceOrchestration
|
|
@@ -6501,19 +6553,19 @@ function pushToSpace({
|
|
|
6501
6553
|
{ spaceId, environmentId, dataAssemblyId: entity.sys.id },
|
|
6502
6554
|
payload
|
|
6503
6555
|
));
|
|
6504
|
-
|
|
6556
|
+
import_logging12.logEmitter.emit("info", `UPDATE DataAssembly ${entity.sys.id}`);
|
|
6505
6557
|
} else {
|
|
6506
6558
|
const payload = { ...omitSys(entity), sys: buildDataAssemblySys(entity, 0) };
|
|
6507
6559
|
result = await withGraphQLSchemaBackoff(() => client.dataAssembly.update(
|
|
6508
6560
|
{ spaceId, environmentId, dataAssemblyId: entity.sys.id },
|
|
6509
6561
|
payload
|
|
6510
6562
|
));
|
|
6511
|
-
|
|
6563
|
+
import_logging12.logEmitter.emit("info", `CREATE DataAssembly ${entity.sys.id}`);
|
|
6512
6564
|
}
|
|
6513
6565
|
return result;
|
|
6514
6566
|
} catch (err) {
|
|
6515
6567
|
err.entity = entity;
|
|
6516
|
-
|
|
6568
|
+
import_logging12.logEmitter.emit("error", err);
|
|
6517
6569
|
return null;
|
|
6518
6570
|
}
|
|
6519
6571
|
}));
|
|
@@ -6543,17 +6595,17 @@ function pushToSpace({
|
|
|
6543
6595
|
if (existing) {
|
|
6544
6596
|
const payload = { ...entity, sys: { id: entity.sys.id, type: "DesignToken", version: existing.sys.version } };
|
|
6545
6597
|
const result = await client.designToken.upsert({ spaceId, environmentId, designTokenId: entity.sys.id }, payload);
|
|
6546
|
-
|
|
6598
|
+
import_logging12.logEmitter.emit("info", `UPDATE DesignToken ${entity.sys.id}`);
|
|
6547
6599
|
return result;
|
|
6548
6600
|
} else {
|
|
6549
6601
|
const payload = { ...omitSys(entity), sys: { id: entity.sys.id, type: "DesignToken" } };
|
|
6550
6602
|
const result = await client.designToken.upsert({ spaceId, environmentId, designTokenId: entity.sys.id }, payload);
|
|
6551
|
-
|
|
6603
|
+
import_logging12.logEmitter.emit("info", `CREATE DesignToken ${entity.sys.id}`);
|
|
6552
6604
|
return result;
|
|
6553
6605
|
}
|
|
6554
6606
|
} catch (err) {
|
|
6555
6607
|
err.entity = entity;
|
|
6556
|
-
|
|
6608
|
+
import_logging12.logEmitter.emit("error", err);
|
|
6557
6609
|
return null;
|
|
6558
6610
|
}
|
|
6559
6611
|
}));
|
|
@@ -6572,17 +6624,17 @@ function pushToSpace({
|
|
|
6572
6624
|
if (existing) {
|
|
6573
6625
|
const payload = { ...entity, sys: { id: entity.sys.id, type: "Component", version: existing.sys.version } };
|
|
6574
6626
|
const result = await client.component.upsert({ spaceId, environmentId, componentId: entity.sys.id }, payload);
|
|
6575
|
-
|
|
6627
|
+
import_logging12.logEmitter.emit("info", `UPDATE Component ${entity.sys.id}`);
|
|
6576
6628
|
results.push(result);
|
|
6577
6629
|
} else {
|
|
6578
6630
|
const payload = { ...omitSys(entity), sys: { id: entity.sys.id, type: "Component" } };
|
|
6579
6631
|
const result = await client.component.upsert({ spaceId, environmentId, componentId: entity.sys.id }, payload);
|
|
6580
|
-
|
|
6632
|
+
import_logging12.logEmitter.emit("info", `CREATE Component ${entity.sys.id}`);
|
|
6581
6633
|
results.push(result);
|
|
6582
6634
|
}
|
|
6583
6635
|
} catch (err) {
|
|
6584
6636
|
err.entity = entity;
|
|
6585
|
-
|
|
6637
|
+
import_logging12.logEmitter.emit("error", err);
|
|
6586
6638
|
}
|
|
6587
6639
|
}
|
|
6588
6640
|
ctx.data.components = results;
|
|
@@ -6614,17 +6666,17 @@ function pushToSpace({
|
|
|
6614
6666
|
if (existing) {
|
|
6615
6667
|
const payload = { ...entity, sys: { id: entity.sys.id, type: "ExperienceTemplate", version: existing.sys.version } };
|
|
6616
6668
|
const result = await client.experienceTemplate.upsert({ spaceId, environmentId, experienceTemplateId: entity.sys.id }, payload);
|
|
6617
|
-
|
|
6669
|
+
import_logging12.logEmitter.emit("info", `UPDATE ExperienceTemplate ${entity.sys.id}`);
|
|
6618
6670
|
return result;
|
|
6619
6671
|
} else {
|
|
6620
6672
|
const payload = { ...omitSys(entity), sys: { id: entity.sys.id, type: "ExperienceTemplate" } };
|
|
6621
6673
|
const result = await client.experienceTemplate.upsert({ spaceId, environmentId, experienceTemplateId: entity.sys.id }, payload);
|
|
6622
|
-
|
|
6674
|
+
import_logging12.logEmitter.emit("info", `CREATE ExperienceTemplate ${entity.sys.id}`);
|
|
6623
6675
|
return result;
|
|
6624
6676
|
}
|
|
6625
6677
|
} catch (err) {
|
|
6626
6678
|
err.entity = entity;
|
|
6627
|
-
|
|
6679
|
+
import_logging12.logEmitter.emit("error", err);
|
|
6628
6680
|
return null;
|
|
6629
6681
|
}
|
|
6630
6682
|
}));
|
|
@@ -6656,17 +6708,17 @@ function pushToSpace({
|
|
|
6656
6708
|
if (existing) {
|
|
6657
6709
|
const payload = { ...omitSysAndOptimizationVariants(entity), sys: { id: entity.sys.id, type: "ExperienceFragment", version: existing.sys.version } };
|
|
6658
6710
|
const result = await client.experienceFragment.upsert({ spaceId, environmentId, experienceFragmentId: entity.sys.id }, payload);
|
|
6659
|
-
|
|
6711
|
+
import_logging12.logEmitter.emit("info", `UPDATE ExperienceFragment ${entity.sys.id}`);
|
|
6660
6712
|
results.push(result);
|
|
6661
6713
|
} else {
|
|
6662
6714
|
const payload = { ...omitSysAndOptimizationVariants(entity), component: entity.sys.component, sys: { id: entity.sys.id, type: "ExperienceFragment" } };
|
|
6663
6715
|
const result = await client.experienceFragment.upsert({ spaceId, environmentId, experienceFragmentId: entity.sys.id }, payload);
|
|
6664
|
-
|
|
6716
|
+
import_logging12.logEmitter.emit("info", `CREATE ExperienceFragment ${entity.sys.id}`);
|
|
6665
6717
|
results.push(result);
|
|
6666
6718
|
}
|
|
6667
6719
|
} catch (err) {
|
|
6668
6720
|
err.entity = entity;
|
|
6669
|
-
|
|
6721
|
+
import_logging12.logEmitter.emit("error", err);
|
|
6670
6722
|
}
|
|
6671
6723
|
}
|
|
6672
6724
|
ctx.data.experienceFragments = results;
|
|
@@ -6698,17 +6750,17 @@ function pushToSpace({
|
|
|
6698
6750
|
if (existing) {
|
|
6699
6751
|
const payload = { ...omitSysAndOptimizationVariants(entity), sys: { id: entity.sys.id, type: "Experience", version: existing.sys.version } };
|
|
6700
6752
|
const result = await client.experience.upsert({ spaceId, environmentId, experienceId: entity.sys.id }, payload);
|
|
6701
|
-
|
|
6753
|
+
import_logging12.logEmitter.emit("info", `UPDATE Experience ${entity.sys.id}`);
|
|
6702
6754
|
return result;
|
|
6703
6755
|
} else {
|
|
6704
6756
|
const payload = { ...omitSysAndOptimizationVariants(entity), experienceTemplate: entity.sys.experienceTemplate, sys: { id: entity.sys.id, type: "Experience" } };
|
|
6705
6757
|
const result = await client.experience.upsert({ spaceId, environmentId, experienceId: entity.sys.id }, payload);
|
|
6706
|
-
|
|
6758
|
+
import_logging12.logEmitter.emit("info", `CREATE Experience ${entity.sys.id}`);
|
|
6707
6759
|
return result;
|
|
6708
6760
|
}
|
|
6709
6761
|
} catch (err) {
|
|
6710
6762
|
err.entity = entity;
|
|
6711
|
-
|
|
6763
|
+
import_logging12.logEmitter.emit("error", err);
|
|
6712
6764
|
return null;
|
|
6713
6765
|
}
|
|
6714
6766
|
}));
|
|
@@ -6872,6 +6924,18 @@ function pushToSpace({
|
|
|
6872
6924
|
));
|
|
6873
6925
|
}),
|
|
6874
6926
|
skip: () => !includeExperienceOrchestration || skipContentPublishing || !(sourceData.dataAssemblies || []).length
|
|
6927
|
+
},
|
|
6928
|
+
{
|
|
6929
|
+
title: "Importing Releases",
|
|
6930
|
+
task: (0, import_listr2.wrapTask)(async (ctx) => {
|
|
6931
|
+
const { supported: v2Releases, unsupported: v1Releases } = partitionReleasesBySchemaVersion(sourceData.releases || []);
|
|
6932
|
+
v1Releases.forEach(logUnsupportedRelease);
|
|
6933
|
+
const results = await Promise.all(v2Releases.map(
|
|
6934
|
+
(release) => importRelease(release, destinationDataById.releases?.get(release.transformed.sys.id), { client, spaceId, environmentId })
|
|
6935
|
+
));
|
|
6936
|
+
ctx.data.releases = results.filter(Boolean);
|
|
6937
|
+
}),
|
|
6938
|
+
skip: () => !(sourceData.releases || []).length
|
|
6875
6939
|
}
|
|
6876
6940
|
], listrOptions);
|
|
6877
6941
|
}
|
|
@@ -6911,24 +6975,24 @@ async function importVariantsForParents({
|
|
|
6911
6975
|
try {
|
|
6912
6976
|
const payload = { ...omitVariantSys(variant), [parentRefField]: variant.sys[parentRefField] };
|
|
6913
6977
|
const result = await ns.create({ spaceId, environmentId, [idParam]: parent2.sys.id }, payload);
|
|
6914
|
-
|
|
6978
|
+
import_logging12.logEmitter.emit("info", `CREATE ${label} ${result.sys.variant} (parent ${parent2.sys.id})`);
|
|
6915
6979
|
created.push({ ...result, sys: { ...result.sys, publishedVersion: variant.sys.publishedVersion, archivedVersion: variant.sys.archivedVersion } });
|
|
6916
6980
|
} catch (err) {
|
|
6917
6981
|
err.entity = variant;
|
|
6918
|
-
|
|
6982
|
+
import_logging12.logEmitter.emit("error", err);
|
|
6919
6983
|
}
|
|
6920
6984
|
}
|
|
6921
6985
|
return { parentId: parent2.sys.id, created };
|
|
6922
6986
|
}));
|
|
6923
6987
|
}
|
|
6924
|
-
function archiveEntities2({ entities, sourceEntities, client, spaceId, environmentId, requestQueue }) {
|
|
6988
|
+
function archiveEntities2({ entities: entities2, sourceEntities, client, spaceId, environmentId, requestQueue }) {
|
|
6925
6989
|
const entityIdsToArchive = sourceEntities.filter(({ original }) => original.sys.archivedVersion).map(({ original }) => original.sys.id);
|
|
6926
|
-
const entitiesToArchive =
|
|
6990
|
+
const entitiesToArchive = entities2.filter((entity) => entityIdsToArchive.indexOf(entity.sys.id) !== -1);
|
|
6927
6991
|
return archiveEntities({ entities: entitiesToArchive, client, spaceId, environmentId, requestQueue });
|
|
6928
6992
|
}
|
|
6929
|
-
async function publishEntities2({ entities, sourceEntities, client, spaceId, environmentId, requestQueue, destinationEntitiesById }) {
|
|
6993
|
+
async function publishEntities2({ entities: entities2, sourceEntities, client, spaceId, environmentId, requestQueue, destinationEntitiesById }) {
|
|
6930
6994
|
const entityIdsToPublish = sourceEntities.filter(({ original }) => original.sys.publishedVersion).map(({ original }) => original.sys.id);
|
|
6931
|
-
let entitiesToPublish =
|
|
6995
|
+
let entitiesToPublish = entities2.filter((entity) => entityIdsToPublish.indexOf(entity.sys.id) !== -1);
|
|
6932
6996
|
const publishAllLocales = () => publishEntities({ entities: entitiesToPublish, client, spaceId, environmentId, requestQueue });
|
|
6933
6997
|
const hasFieldStatus = sourceEntities.some(({ original }) => original.sys.fieldStatus);
|
|
6934
6998
|
if (!hasFieldStatus) {
|
|
@@ -6949,7 +7013,7 @@ async function publishEntities2({ entities, sourceEntities, client, spaceId, env
|
|
|
6949
7013
|
if (!localePublishing.skippedEntityIds.has(entity.sys.id)) {
|
|
6950
7014
|
return true;
|
|
6951
7015
|
}
|
|
6952
|
-
|
|
7016
|
+
import_logging12.logEmitter.emit("warning", `Not publishing ${entity.sys.type} ${entity.sys.id} because none of the locales it was published for exist in the destination environment`);
|
|
6953
7017
|
return false;
|
|
6954
7018
|
});
|
|
6955
7019
|
}
|
|
@@ -6970,6 +7034,7 @@ __export(transformers_exports, {
|
|
|
6970
7034
|
contentTypes: () => contentTypes,
|
|
6971
7035
|
entries: () => entries,
|
|
6972
7036
|
locales: () => locales,
|
|
7037
|
+
releases: () => releases,
|
|
6973
7038
|
tags: () => tags,
|
|
6974
7039
|
webhooks: () => webhooks
|
|
6975
7040
|
});
|
|
@@ -7025,6 +7090,9 @@ function removeMetadataTags(entity, tagsEnabled = false) {
|
|
|
7025
7090
|
}
|
|
7026
7091
|
return entity;
|
|
7027
7092
|
}
|
|
7093
|
+
function releases(release) {
|
|
7094
|
+
return release;
|
|
7095
|
+
}
|
|
7028
7096
|
|
|
7029
7097
|
// lib/utils/sort-entries.ts
|
|
7030
7098
|
function sortEntries(entries2) {
|
|
@@ -7274,24 +7342,24 @@ function upgradeExoResources(resources) {
|
|
|
7274
7342
|
}
|
|
7275
7343
|
|
|
7276
7344
|
// lib/transform/transform-space.ts
|
|
7277
|
-
var
|
|
7345
|
+
var entities = [
|
|
7278
7346
|
"contentTypes",
|
|
7279
7347
|
"entries",
|
|
7280
7348
|
"assets",
|
|
7281
7349
|
"locales",
|
|
7282
7350
|
"webhooks",
|
|
7283
|
-
"tags"
|
|
7351
|
+
"tags",
|
|
7352
|
+
"releases"
|
|
7284
7353
|
];
|
|
7285
|
-
function transform_space_default(sourceData, destinationData
|
|
7286
|
-
const transformers = defaults_default(customTransformers, transformers_exports);
|
|
7354
|
+
function transform_space_default(sourceData, destinationData) {
|
|
7287
7355
|
const baseSpaceData = upgradeExoResources(omit_default(sourceData, ...entities));
|
|
7288
7356
|
sourceData.locales = sortLocales(sourceData.locales);
|
|
7289
7357
|
const tagsEnabled = !!destinationData.tags;
|
|
7290
7358
|
return entities.reduce((transformedSpaceData, type) => {
|
|
7291
|
-
const sortedEntities = type === "tags" ? sourceData[type] ?? [] : sortEntries(sourceData[type] ?? []);
|
|
7359
|
+
const sortedEntities = type === "tags" || type === "releases" ? sourceData[type] ?? [] : sortEntries(sourceData[type] ?? []);
|
|
7292
7360
|
const transformedEntities = sortedEntities.map((entity) => ({
|
|
7293
7361
|
original: entity,
|
|
7294
|
-
transformed:
|
|
7362
|
+
transformed: transformers_exports[type](entity, destinationData[type], tagsEnabled)
|
|
7295
7363
|
}));
|
|
7296
7364
|
transformedSpaceData[type] = transformedEntities;
|
|
7297
7365
|
return transformedSpaceData;
|
|
@@ -7381,13 +7449,13 @@ var attachEntityName = (details, payload) => {
|
|
|
7381
7449
|
});
|
|
7382
7450
|
};
|
|
7383
7451
|
var countInvalidEntities = (validationData) => {
|
|
7384
|
-
const entityCount = validationData.reduce((
|
|
7385
|
-
if (!
|
|
7386
|
-
|
|
7452
|
+
const entityCount = validationData.reduce((entities2, currentDetail) => {
|
|
7453
|
+
if (!entities2[currentDetail.path[0]]) {
|
|
7454
|
+
entities2[currentDetail.path[0]] = 1;
|
|
7387
7455
|
} else {
|
|
7388
|
-
|
|
7456
|
+
entities2[currentDetail.path[0]]++;
|
|
7389
7457
|
}
|
|
7390
|
-
return
|
|
7458
|
+
return entities2;
|
|
7391
7459
|
}, {});
|
|
7392
7460
|
return Object.keys(entityCount).map((key) => `${key}:${entityCount[key]}`);
|
|
7393
7461
|
};
|
|
@@ -7490,7 +7558,8 @@ var SUPPORTED_ENTITY_TYPES = [
|
|
|
7490
7558
|
"experienceTemplates",
|
|
7491
7559
|
"dataAssemblies",
|
|
7492
7560
|
"experienceFragments",
|
|
7493
|
-
"experiences"
|
|
7561
|
+
"experiences",
|
|
7562
|
+
"releases"
|
|
7494
7563
|
];
|
|
7495
7564
|
async function parseOptions(params) {
|
|
7496
7565
|
const defaultOptions = {
|
|
@@ -7582,7 +7651,7 @@ async function parseOptions(params) {
|
|
|
7582
7651
|
}
|
|
7583
7652
|
|
|
7584
7653
|
// lib/utils/display-error-log.ts
|
|
7585
|
-
var
|
|
7654
|
+
var import_logging13 = __toESM(require_logging());
|
|
7586
7655
|
import { format as format2, parseISO } from "date-fns";
|
|
7587
7656
|
function displayErrorLog(errorLog) {
|
|
7588
7657
|
if (errorLog.length) {
|
|
@@ -7598,7 +7667,7 @@ function displayErrorLog(errorLog) {
|
|
|
7598
7667
|
|
|
7599
7668
|
The following ${count.errors} errors and ${count.warnings} warnings occurred:
|
|
7600
7669
|
`);
|
|
7601
|
-
errorLog.map((logMessage) => `${format2(parseISO(logMessage.ts), "HH:mm:ss")} - ${(0,
|
|
7670
|
+
errorLog.map((logMessage) => `${format2(parseISO(logMessage.ts), "HH:mm:ss")} - ${(0, import_logging13.formatLogMessageOneLine)(logMessage)}`).map((logMessage) => console.log(logMessage));
|
|
7602
7671
|
return;
|
|
7603
7672
|
}
|
|
7604
7673
|
console.log("No errors or warnings occurred");
|
|
@@ -7630,7 +7699,7 @@ async function runContentfulImport(params) {
|
|
|
7630
7699
|
intervalCap: options.rateLimit,
|
|
7631
7700
|
carryoverConcurrencyCount: true
|
|
7632
7701
|
});
|
|
7633
|
-
(0,
|
|
7702
|
+
(0, import_logging14.setupLogging)(log);
|
|
7634
7703
|
const infoTable = new Table(tableOptions);
|
|
7635
7704
|
infoTable.push([{ colSpan: 2, content: "The following entities are going to be imported:" }]);
|
|
7636
7705
|
Object.keys(options.content).forEach((type) => {
|
|
@@ -7757,7 +7826,7 @@ async function runContentfulImport(params) {
|
|
|
7757
7826
|
const displayLog = log.filter((logMessage) => logMessage.level !== "info");
|
|
7758
7827
|
displayErrorLog(displayLog);
|
|
7759
7828
|
if (errorLog.length) {
|
|
7760
|
-
return (0,
|
|
7829
|
+
return (0, import_logging14.writeErrorLogFile)(options.errorLogFile, errorLog).then(() => {
|
|
7761
7830
|
const multiError = new ContentfulMultiError("Errors occurred");
|
|
7762
7831
|
multiError.name = "ContentfulMultiError";
|
|
7763
7832
|
multiError.errors = errorLog;
|