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.js
CHANGED
|
@@ -4550,34 +4550,6 @@ var createBaseEach_default = createBaseEach;
|
|
|
4550
4550
|
var baseEach = createBaseEach_default(baseForOwn_default);
|
|
4551
4551
|
var baseEach_default = baseEach;
|
|
4552
4552
|
|
|
4553
|
-
// node_modules/lodash-es/defaults.js
|
|
4554
|
-
var objectProto18 = Object.prototype;
|
|
4555
|
-
var hasOwnProperty15 = objectProto18.hasOwnProperty;
|
|
4556
|
-
var defaults = baseRest_default(function(object, sources) {
|
|
4557
|
-
object = Object(object);
|
|
4558
|
-
var index = -1;
|
|
4559
|
-
var length = sources.length;
|
|
4560
|
-
var guard = length > 2 ? sources[2] : void 0;
|
|
4561
|
-
if (guard && isIterateeCall_default(sources[0], sources[1], guard)) {
|
|
4562
|
-
length = 1;
|
|
4563
|
-
}
|
|
4564
|
-
while (++index < length) {
|
|
4565
|
-
var source = sources[index];
|
|
4566
|
-
var props = keysIn_default(source);
|
|
4567
|
-
var propsIndex = -1;
|
|
4568
|
-
var propsLength = props.length;
|
|
4569
|
-
while (++propsIndex < propsLength) {
|
|
4570
|
-
var key = props[propsIndex];
|
|
4571
|
-
var value = object[key];
|
|
4572
|
-
if (value === void 0 || eq_default(value, objectProto18[key]) && !hasOwnProperty15.call(object, key)) {
|
|
4573
|
-
object[key] = source[key];
|
|
4574
|
-
}
|
|
4575
|
-
}
|
|
4576
|
-
}
|
|
4577
|
-
return object;
|
|
4578
|
-
});
|
|
4579
|
-
var defaults_default = defaults;
|
|
4580
|
-
|
|
4581
4553
|
// node_modules/lodash-es/last.js
|
|
4582
4554
|
function last(array) {
|
|
4583
4555
|
var length = array == null ? 0 : array.length;
|
|
@@ -4658,10 +4630,10 @@ function map(collection, iteratee) {
|
|
|
4658
4630
|
var map_default = map;
|
|
4659
4631
|
|
|
4660
4632
|
// node_modules/lodash-es/_baseHas.js
|
|
4661
|
-
var
|
|
4662
|
-
var
|
|
4633
|
+
var objectProto18 = Object.prototype;
|
|
4634
|
+
var hasOwnProperty15 = objectProto18.hasOwnProperty;
|
|
4663
4635
|
function baseHas(object, key) {
|
|
4664
|
-
return object != null &&
|
|
4636
|
+
return object != null && hasOwnProperty15.call(object, key);
|
|
4665
4637
|
}
|
|
4666
4638
|
var baseHas_default = baseHas;
|
|
4667
4639
|
|
|
@@ -4715,8 +4687,8 @@ function negate(predicate) {
|
|
|
4715
4687
|
var negate_default = negate;
|
|
4716
4688
|
|
|
4717
4689
|
// node_modules/lodash-es/_baseUnset.js
|
|
4718
|
-
var
|
|
4719
|
-
var
|
|
4690
|
+
var objectProto19 = Object.prototype;
|
|
4691
|
+
var hasOwnProperty16 = objectProto19.hasOwnProperty;
|
|
4720
4692
|
function baseUnset(object, path) {
|
|
4721
4693
|
path = castPath_default(path, object);
|
|
4722
4694
|
var index = -1, length = path.length;
|
|
@@ -4725,7 +4697,7 @@ function baseUnset(object, path) {
|
|
|
4725
4697
|
}
|
|
4726
4698
|
while (++index < length) {
|
|
4727
4699
|
var key = toKey_default(path[index]);
|
|
4728
|
-
if (key === "__proto__" && !
|
|
4700
|
+
if (key === "__proto__" && !hasOwnProperty16.call(object, "__proto__")) {
|
|
4729
4701
|
return false;
|
|
4730
4702
|
}
|
|
4731
4703
|
if ((key === "constructor" || key === "prototype") && index < length - 1) {
|
|
@@ -4889,7 +4861,7 @@ var startCase_default = startCase;
|
|
|
4889
4861
|
|
|
4890
4862
|
// lib/index.ts
|
|
4891
4863
|
var import_p_queue = __toESM(require("p-queue"));
|
|
4892
|
-
var
|
|
4864
|
+
var import_logging14 = __toESM(require_logging());
|
|
4893
4865
|
var import_listr4 = __toESM(require_listr());
|
|
4894
4866
|
|
|
4895
4867
|
// lib/tasks/init-client.ts
|
|
@@ -4922,17 +4894,17 @@ var import_logging3 = __toESM(require_logging());
|
|
|
4922
4894
|
|
|
4923
4895
|
// lib/utils/publish-exo-entities.ts
|
|
4924
4896
|
var import_logging2 = __toESM(require_logging());
|
|
4925
|
-
function filterExoEntitiesToPublish(
|
|
4897
|
+
function filterExoEntitiesToPublish(entities2, sourceEntities) {
|
|
4926
4898
|
const entityIdsToPublish = new Set(
|
|
4927
4899
|
sourceEntities.filter((entity) => entity.sys.publishedVersion).map((entity) => entity.sys.id)
|
|
4928
4900
|
);
|
|
4929
|
-
return
|
|
4901
|
+
return entities2.filter((entity) => entityIdsToPublish.has(entity.sys.id));
|
|
4930
4902
|
}
|
|
4931
|
-
function filterExoEntitiesToUnpublish(
|
|
4903
|
+
function filterExoEntitiesToUnpublish(entities2, sourceEntities) {
|
|
4932
4904
|
const entityIdsPublishedInSource = new Set(
|
|
4933
4905
|
sourceEntities.filter((entity) => entity.sys.publishedVersion).map((entity) => entity.sys.id)
|
|
4934
4906
|
);
|
|
4935
|
-
return
|
|
4907
|
+
return entities2.filter((entity) => entity.sys.publishedVersion && !entityIdsPublishedInSource.has(entity.sys.id));
|
|
4936
4908
|
}
|
|
4937
4909
|
async function publishExoEntity(type, entity, publish) {
|
|
4938
4910
|
try {
|
|
@@ -4994,6 +4966,17 @@ function isExoEntitlementError(err) {
|
|
|
4994
4966
|
return false;
|
|
4995
4967
|
}
|
|
4996
4968
|
}
|
|
4969
|
+
function isTimelineEntitlementError(err) {
|
|
4970
|
+
if (!(err instanceof Error)) {
|
|
4971
|
+
return false;
|
|
4972
|
+
}
|
|
4973
|
+
try {
|
|
4974
|
+
const parsed = JSON.parse(err.message);
|
|
4975
|
+
return parsed?.status === 403 && parsed?.details?.reasons === "Timeline is not enabled for this organization";
|
|
4976
|
+
} catch {
|
|
4977
|
+
return false;
|
|
4978
|
+
}
|
|
4979
|
+
}
|
|
4997
4980
|
var EXO_M1_FEATURE = "exoM1";
|
|
4998
4981
|
async function spaceHasExoM1Entitlement(client, spaceId) {
|
|
4999
4982
|
try {
|
|
@@ -5020,7 +5003,8 @@ var CURSOR_QUERY_METHODS = {
|
|
|
5020
5003
|
experienceTemplates: { name: "experience templates", namespace: "experienceTemplate" },
|
|
5021
5004
|
experienceFragments: { name: "experience fragments", namespace: "experienceFragment" },
|
|
5022
5005
|
dataAssemblies: { name: "data assemblies", namespace: "dataAssembly" },
|
|
5023
|
-
experiences: { name: "experiences", namespace: "experience" }
|
|
5006
|
+
experiences: { name: "experiences", namespace: "experience" },
|
|
5007
|
+
releases: { name: "releases", namespace: "release" }
|
|
5024
5008
|
};
|
|
5025
5009
|
var ENTITY_METHODS = {
|
|
5026
5010
|
contentTypes: { name: "content types", ns: "contentType" },
|
|
@@ -5123,11 +5107,26 @@ async function cursorPaginatedQuery({ client, spaceId, environmentId, type, requ
|
|
|
5123
5107
|
const allItems = [];
|
|
5124
5108
|
do {
|
|
5125
5109
|
const items = await requestQueue.add(async () => {
|
|
5126
|
-
|
|
5127
|
-
|
|
5128
|
-
|
|
5129
|
-
|
|
5130
|
-
|
|
5110
|
+
let response;
|
|
5111
|
+
if (type === "releases") {
|
|
5112
|
+
response = await client.release.query({
|
|
5113
|
+
environmentId,
|
|
5114
|
+
spaceId,
|
|
5115
|
+
query: {
|
|
5116
|
+
"metadata.annotations.Contentful:Timeline.type[nin]": "Staging,Hidden",
|
|
5117
|
+
"sys.schemaVersion": "Release.v2",
|
|
5118
|
+
"sys.status[in]": "active",
|
|
5119
|
+
limit: BATCH_SIZE_LIMIT,
|
|
5120
|
+
...pageNext && { pageNext }
|
|
5121
|
+
}
|
|
5122
|
+
});
|
|
5123
|
+
} else {
|
|
5124
|
+
response = await client[namespace].getMany({
|
|
5125
|
+
spaceId,
|
|
5126
|
+
environmentId,
|
|
5127
|
+
query: { limit: BATCH_SIZE_LIMIT, ...pageNext && { pageNext } }
|
|
5128
|
+
});
|
|
5129
|
+
}
|
|
5131
5130
|
totalFetched += response.items.length;
|
|
5132
5131
|
import_logging3.logEmitter.emit("info", `Fetched ${totalFetched} ${entityTypeName}`);
|
|
5133
5132
|
pageNext = response.pages?.next;
|
|
@@ -5144,6 +5143,8 @@ async function cursorPaginatedQueryOrWarn(params) {
|
|
|
5144
5143
|
const { name: entityTypeName } = CURSOR_QUERY_METHODS[params.type];
|
|
5145
5144
|
if (isExoEntitlementError(err)) {
|
|
5146
5145
|
import_logging3.logEmitter.emit("error", new Error(`Skipping ${entityTypeName} import: Experience Orchestration (ExO) is not enabled for this space`));
|
|
5146
|
+
} else if (isTimelineEntitlementError(err)) {
|
|
5147
|
+
import_logging3.logEmitter.emit("error", new Error(`Skipping ${entityTypeName} import: Timeline (Releases) is not enabled for this organization`));
|
|
5147
5148
|
} else {
|
|
5148
5149
|
import_logging3.logEmitter.emit("error", err instanceof Error ? err : new Error(String(err)));
|
|
5149
5150
|
}
|
|
@@ -5173,7 +5174,8 @@ async function getDestinationData({
|
|
|
5173
5174
|
experienceFragments: [],
|
|
5174
5175
|
dataAssemblies: [],
|
|
5175
5176
|
designTokens: [],
|
|
5176
|
-
webhooks: []
|
|
5177
|
+
webhooks: [],
|
|
5178
|
+
releases: []
|
|
5177
5179
|
};
|
|
5178
5180
|
sourceData = {
|
|
5179
5181
|
...result,
|
|
@@ -5234,6 +5236,7 @@ async function getDestinationData({
|
|
|
5234
5236
|
requestQueue
|
|
5235
5237
|
});
|
|
5236
5238
|
}
|
|
5239
|
+
result.releases = cursorPaginatedQueryOrWarn({ client, spaceId, environmentId, type: "releases", requestQueue });
|
|
5237
5240
|
if (includeExperienceOrchestration && client) {
|
|
5238
5241
|
const sourceHasDesignTokens = Boolean(sourceData.designTokens?.length);
|
|
5239
5242
|
const sourceHasComponents = Boolean(sourceData.components?.length);
|
|
@@ -5273,7 +5276,7 @@ async function getDestinationData({
|
|
|
5273
5276
|
// lib/tasks/push-to-space/push-to-space.ts
|
|
5274
5277
|
var import_listr = __toESM(require("listr"));
|
|
5275
5278
|
var import_listr_verbose_renderer = __toESM(require("listr-verbose-renderer"));
|
|
5276
|
-
var
|
|
5279
|
+
var import_logging12 = __toESM(require_logging());
|
|
5277
5280
|
var import_listr2 = __toESM(require_listr());
|
|
5278
5281
|
|
|
5279
5282
|
// lib/tasks/push-to-space/assets.ts
|
|
@@ -5373,14 +5376,14 @@ async function processAssets({
|
|
|
5373
5376
|
// lib/tasks/push-to-space/creation.ts
|
|
5374
5377
|
var import_get_entity_name2 = __toESM(require_get_entity_name());
|
|
5375
5378
|
var import_logging5 = __toESM(require_logging());
|
|
5376
|
-
function createEntities({ context, entities, destinationEntitiesById, skipUpdates, requestQueue }) {
|
|
5377
|
-
return createEntitiesWithConcurrency({ context, entities, destinationEntitiesById, skipUpdates, requestQueue });
|
|
5379
|
+
function createEntities({ context, entities: entities2, destinationEntitiesById, skipUpdates, requestQueue }) {
|
|
5380
|
+
return createEntitiesWithConcurrency({ context, entities: entities2, destinationEntitiesById, skipUpdates, requestQueue });
|
|
5378
5381
|
}
|
|
5379
|
-
function createLocales({ context, entities, destinationEntitiesById, requestQueue }) {
|
|
5380
|
-
return createEntitiesInSequence({ context, entities, destinationEntitiesById, requestQueue });
|
|
5382
|
+
function createLocales({ context, entities: entities2, destinationEntitiesById, requestQueue }) {
|
|
5383
|
+
return createEntitiesInSequence({ context, entities: entities2, destinationEntitiesById, requestQueue });
|
|
5381
5384
|
}
|
|
5382
|
-
async function createEntitiesWithConcurrency({ context, entities, destinationEntitiesById, skipUpdates, requestQueue }) {
|
|
5383
|
-
const pendingCreatedEntities =
|
|
5385
|
+
async function createEntitiesWithConcurrency({ context, entities: entities2, destinationEntitiesById, skipUpdates, requestQueue }) {
|
|
5386
|
+
const pendingCreatedEntities = entities2.map((entity) => {
|
|
5384
5387
|
const destinationEntity = getDestinationEntityForSourceEntity(destinationEntitiesById, entity.transformed);
|
|
5385
5388
|
const updateOperation = skipUpdates ? "skip" : "update";
|
|
5386
5389
|
const operation = destinationEntity ? updateOperation : "create";
|
|
@@ -5401,9 +5404,9 @@ async function createEntitiesWithConcurrency({ context, entities, destinationEnt
|
|
|
5401
5404
|
const createdEntities = await Promise.all(pendingCreatedEntities);
|
|
5402
5405
|
return createdEntities.filter((entity) => entity);
|
|
5403
5406
|
}
|
|
5404
|
-
async function createEntitiesInSequence({ context, entities, destinationEntitiesById, requestQueue }) {
|
|
5407
|
+
async function createEntitiesInSequence({ context, entities: entities2, destinationEntitiesById, requestQueue }) {
|
|
5405
5408
|
const createdEntities = [];
|
|
5406
|
-
for (const entity of
|
|
5409
|
+
for (const entity of entities2) {
|
|
5407
5410
|
const destinationEntity = getDestinationEntityForSourceEntity(destinationEntitiesById, entity.transformed);
|
|
5408
5411
|
const operation = destinationEntity ? "update" : "create";
|
|
5409
5412
|
try {
|
|
@@ -5422,8 +5425,8 @@ async function createEntitiesInSequence({ context, entities, destinationEntities
|
|
|
5422
5425
|
}
|
|
5423
5426
|
return createdEntities;
|
|
5424
5427
|
}
|
|
5425
|
-
async function createEntries({ context, entities, destinationEntitiesById, skipUpdates, requestQueue }) {
|
|
5426
|
-
const createdEntries = await Promise.all(
|
|
5428
|
+
async function createEntries({ context, entities: entities2, destinationEntitiesById, skipUpdates, requestQueue }) {
|
|
5429
|
+
const createdEntries = await Promise.all(entities2.map((entry) => {
|
|
5427
5430
|
return createEntry({ entry, context, destinationEntitiesById, skipUpdates, requestQueue });
|
|
5428
5431
|
}));
|
|
5429
5432
|
return createdEntries.filter((entry) => entry);
|
|
@@ -5678,27 +5681,27 @@ function archiveEntity(client, spaceId, environmentId, entity) {
|
|
|
5678
5681
|
}
|
|
5679
5682
|
throw new Error(`archiveEntity: unsupported type "${type}"`);
|
|
5680
5683
|
}
|
|
5681
|
-
async function publishEntities({ entities, client, spaceId, environmentId, requestQueue, localePublishing }) {
|
|
5682
|
-
if (
|
|
5684
|
+
async function publishEntities({ entities: entities2, client, spaceId, environmentId, requestQueue, localePublishing }) {
|
|
5685
|
+
if (entities2.length === 0) {
|
|
5683
5686
|
import_logging7.logEmitter.emit("info", "Skipping publishing since zero valid entities passed");
|
|
5684
5687
|
return [];
|
|
5685
5688
|
}
|
|
5686
|
-
const entity =
|
|
5689
|
+
const entity = entities2[0];
|
|
5687
5690
|
const type = entity.sys.type || "unknown type";
|
|
5688
|
-
import_logging7.logEmitter.emit("info", `Publishing ${
|
|
5689
|
-
const result = await runQueue(
|
|
5691
|
+
import_logging7.logEmitter.emit("info", `Publishing ${entities2.length} ${type}s`);
|
|
5692
|
+
const result = await runQueue(entities2, [], client, spaceId, environmentId, requestQueue, localePublishing);
|
|
5690
5693
|
import_logging7.logEmitter.emit("info", `Successfully published ${result.length} ${type}s`);
|
|
5691
5694
|
return result;
|
|
5692
5695
|
}
|
|
5693
|
-
async function archiveEntities({ entities, client, spaceId, environmentId, requestQueue }) {
|
|
5694
|
-
if (
|
|
5696
|
+
async function archiveEntities({ entities: entities2, client, spaceId, environmentId, requestQueue }) {
|
|
5697
|
+
if (entities2.length === 0) {
|
|
5695
5698
|
import_logging7.logEmitter.emit("info", "Skipping archiving since zero valid entities passed");
|
|
5696
5699
|
return [];
|
|
5697
5700
|
}
|
|
5698
|
-
const entity =
|
|
5701
|
+
const entity = entities2[0];
|
|
5699
5702
|
const type = entity.sys.type || "unknown type";
|
|
5700
|
-
import_logging7.logEmitter.emit("info", `Archiving ${
|
|
5701
|
-
const pendingArchivedEntities =
|
|
5703
|
+
import_logging7.logEmitter.emit("info", `Archiving ${entities2.length} ${type}s`);
|
|
5704
|
+
const pendingArchivedEntities = entities2.map((entity2) => {
|
|
5702
5705
|
return requestQueue.add(async () => {
|
|
5703
5706
|
try {
|
|
5704
5707
|
const archivedEntity = await archiveEntity(client, spaceId, environmentId, entity2);
|
|
@@ -5786,6 +5789,55 @@ async function runQueue(queue, result = [], client, spaceId, environmentId, requ
|
|
|
5786
5789
|
return result;
|
|
5787
5790
|
}
|
|
5788
5791
|
|
|
5792
|
+
// lib/tasks/push-to-space/releases.ts
|
|
5793
|
+
var import_logging8 = __toESM(require_logging());
|
|
5794
|
+
function partitionReleasesBySchemaVersion(releases2) {
|
|
5795
|
+
return {
|
|
5796
|
+
supported: releases2.filter((release) => release.transformed.sys.schemaVersion === "Release.v2"),
|
|
5797
|
+
unsupported: releases2.filter((release) => release.transformed.sys.schemaVersion !== "Release.v2")
|
|
5798
|
+
};
|
|
5799
|
+
}
|
|
5800
|
+
function logUnsupportedRelease(release) {
|
|
5801
|
+
import_logging8.logEmitter.emit("error", new Error(
|
|
5802
|
+
`Skipping Release "${release.transformed.sys.id}": only Release.v2 ("Releases") is supported, got schemaVersion "${release.transformed.sys.schemaVersion}"`
|
|
5803
|
+
));
|
|
5804
|
+
}
|
|
5805
|
+
function buildReleaseCreatePayload(release) {
|
|
5806
|
+
const { id: _sourceId, ...sourceSysWithoutId } = release.transformed.sys;
|
|
5807
|
+
return {
|
|
5808
|
+
...release.transformed,
|
|
5809
|
+
entities: release.transformed.entities,
|
|
5810
|
+
sys: { ...sourceSysWithoutId, type: "Release", schemaVersion: "Release.v2" }
|
|
5811
|
+
};
|
|
5812
|
+
}
|
|
5813
|
+
function buildReleaseUpdatePayload(release) {
|
|
5814
|
+
return {
|
|
5815
|
+
...release.transformed,
|
|
5816
|
+
entities: release.transformed.entities,
|
|
5817
|
+
sys: { type: "Release", schemaVersion: "Release.v2" }
|
|
5818
|
+
};
|
|
5819
|
+
}
|
|
5820
|
+
async function importRelease(release, existing, context) {
|
|
5821
|
+
const { client, spaceId, environmentId } = context;
|
|
5822
|
+
try {
|
|
5823
|
+
if (existing) {
|
|
5824
|
+
const result2 = await client.release.update(
|
|
5825
|
+
{ spaceId, environmentId, releaseId: existing.sys.id, version: existing.sys.version },
|
|
5826
|
+
buildReleaseUpdatePayload(release)
|
|
5827
|
+
);
|
|
5828
|
+
import_logging8.logEmitter.emit("info", `UPDATE Release ${existing.sys.id}`);
|
|
5829
|
+
return result2;
|
|
5830
|
+
}
|
|
5831
|
+
const result = await client.release.create({ spaceId, environmentId }, buildReleaseCreatePayload(release));
|
|
5832
|
+
import_logging8.logEmitter.emit("info", `CREATE Release ${result.sys.id}`);
|
|
5833
|
+
return result;
|
|
5834
|
+
} catch (err) {
|
|
5835
|
+
err.entity = release.transformed;
|
|
5836
|
+
import_logging8.logEmitter.emit("error", err);
|
|
5837
|
+
return null;
|
|
5838
|
+
}
|
|
5839
|
+
}
|
|
5840
|
+
|
|
5789
5841
|
// lib/utils/graphql-schema-backoff.ts
|
|
5790
5842
|
var GRAPHQL_SCHEMA_STALE_DELAYS_MS = [500, 1500, 6e3];
|
|
5791
5843
|
function isGraphQLSchemaStaleError(err) {
|
|
@@ -5912,18 +5964,18 @@ function sortExperienceFragments(experienceFragments) {
|
|
|
5912
5964
|
}
|
|
5913
5965
|
|
|
5914
5966
|
// lib/utils/sort-or-report.ts
|
|
5915
|
-
var
|
|
5967
|
+
var import_logging9 = __toESM(require_logging());
|
|
5916
5968
|
function sortOrReport(sortFn) {
|
|
5917
5969
|
try {
|
|
5918
5970
|
return sortFn();
|
|
5919
5971
|
} catch (err) {
|
|
5920
|
-
|
|
5972
|
+
import_logging9.logEmitter.emit("error", err);
|
|
5921
5973
|
throw err;
|
|
5922
5974
|
}
|
|
5923
5975
|
}
|
|
5924
5976
|
|
|
5925
5977
|
// lib/utils/import-exo-folders.ts
|
|
5926
|
-
var
|
|
5978
|
+
var import_logging10 = __toESM(require_logging());
|
|
5927
5979
|
var FOLDER_CONCEPT_PREFIX = "contentful.folder-";
|
|
5928
5980
|
var PARENT_FOLDER_GROUP_IDS = {
|
|
5929
5981
|
designToken: "contentful.folder-group-designToken",
|
|
@@ -5940,8 +5992,8 @@ var ENTITY_TYPE_TO_PARENT_GROUP_ID = {
|
|
|
5940
5992
|
experiences: PARENT_FOLDER_GROUP_IDS.experience
|
|
5941
5993
|
};
|
|
5942
5994
|
function getSourceSpaceId(sourceEntities) {
|
|
5943
|
-
for (const
|
|
5944
|
-
for (const entity of
|
|
5995
|
+
for (const entities2 of Object.values(sourceEntities)) {
|
|
5996
|
+
for (const entity of entities2 ?? []) {
|
|
5945
5997
|
const spaceId = entity.sys?.space?.sys?.id;
|
|
5946
5998
|
if (spaceId) return spaceId;
|
|
5947
5999
|
}
|
|
@@ -5993,7 +6045,7 @@ async function createOrPatchChildConcepts(client, organizationId, destinationSpa
|
|
|
5993
6045
|
existing = await client.concept.get({ organizationId, conceptId: destConceptId });
|
|
5994
6046
|
} catch (err) {
|
|
5995
6047
|
if (err?.name !== "NotFound") {
|
|
5996
|
-
|
|
6048
|
+
import_logging10.logEmitter.emit("warning", `Could not fetch destination child concept ${destConceptId}: ${err?.message ?? err}`);
|
|
5997
6049
|
}
|
|
5998
6050
|
}
|
|
5999
6051
|
if (!existing) {
|
|
@@ -6003,9 +6055,9 @@ async function createOrPatchChildConcepts(client, organizationId, destinationSpa
|
|
|
6003
6055
|
// @ts-expect-error - CMA.js type needs to be updated to be aware of purpose: 'internal'
|
|
6004
6056
|
{ purpose: "internal", prefLabel, metadata: { spaces: [spaceLink] } }
|
|
6005
6057
|
);
|
|
6006
|
-
|
|
6058
|
+
import_logging10.logEmitter.emit("info", `Created child folder concept ${destConceptId}`);
|
|
6007
6059
|
} catch (err) {
|
|
6008
|
-
|
|
6060
|
+
import_logging10.logEmitter.emit("error", `Failed to create child folder concept ${destConceptId}: ${err?.message ?? err}`);
|
|
6009
6061
|
}
|
|
6010
6062
|
} else {
|
|
6011
6063
|
const patches = [];
|
|
@@ -6019,9 +6071,9 @@ async function createOrPatchChildConcepts(client, organizationId, destinationSpa
|
|
|
6019
6071
|
{ organizationId, conceptId: destConceptId, version: existing.sys.version },
|
|
6020
6072
|
patches
|
|
6021
6073
|
);
|
|
6022
|
-
|
|
6074
|
+
import_logging10.logEmitter.emit("info", `Patched child folder concept ${destConceptId} (${patches.map((p) => p.path).join(", ")})`);
|
|
6023
6075
|
} catch (err) {
|
|
6024
|
-
|
|
6076
|
+
import_logging10.logEmitter.emit("error", `Failed to patch child folder concept ${destConceptId}: ${err?.message ?? err}`);
|
|
6025
6077
|
}
|
|
6026
6078
|
}
|
|
6027
6079
|
}
|
|
@@ -6039,14 +6091,14 @@ async function linkChildConceptsToParentGroups(client, organizationId, childConc
|
|
|
6039
6091
|
[{ op: "add", path: "/concepts/-", value: { sys: { type: "Link", linkType: "TaxonomyConcept", id: destConceptId } } }]
|
|
6040
6092
|
);
|
|
6041
6093
|
parentGroups.set(parentGroupId, updated);
|
|
6042
|
-
|
|
6094
|
+
import_logging10.logEmitter.emit("info", `Linked child concept ${destConceptId} to parent group ${parentGroupId}`);
|
|
6043
6095
|
} catch (err) {
|
|
6044
|
-
|
|
6096
|
+
import_logging10.logEmitter.emit("error", `Failed to link child concept ${destConceptId} to parent group ${parentGroupId}: ${err?.message ?? err}`);
|
|
6045
6097
|
}
|
|
6046
6098
|
}
|
|
6047
6099
|
}
|
|
6048
|
-
function rewriteEntityFolderConcepts(
|
|
6049
|
-
for (const entity of
|
|
6100
|
+
function rewriteEntityFolderConcepts(entities2, childConceptMap) {
|
|
6101
|
+
for (const entity of entities2) {
|
|
6050
6102
|
if (!entity.metadata?.concepts) continue;
|
|
6051
6103
|
entity.metadata.concepts = entity.metadata.concepts.map((link) => {
|
|
6052
6104
|
const entry = childConceptMap.get(link.sys.id);
|
|
@@ -6063,17 +6115,17 @@ async function importExoFolders({
|
|
|
6063
6115
|
}) {
|
|
6064
6116
|
const sourceSpaceId = getSourceSpaceId(sourceEntities);
|
|
6065
6117
|
if (sourceSpaceId === destinationSpaceId) {
|
|
6066
|
-
|
|
6118
|
+
import_logging10.logEmitter.emit("info", "Source and destination space are the same \u2014 skipping ExO folder import");
|
|
6067
6119
|
return;
|
|
6068
6120
|
}
|
|
6069
6121
|
const parentGroups = await ensureParentFolderGroupsExist(client, organizationId);
|
|
6070
6122
|
if (parentGroups.size === 0) {
|
|
6071
|
-
|
|
6123
|
+
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.");
|
|
6072
6124
|
return;
|
|
6073
6125
|
}
|
|
6074
6126
|
const childConceptMap = deriveChildConceptMap(sourceEntities, destinationSpaceId);
|
|
6075
6127
|
if (childConceptMap.size === 0) return;
|
|
6076
|
-
|
|
6128
|
+
import_logging10.logEmitter.emit("info", `Importing ${childConceptMap.size} ExO folder concept(s) into destination space ${destinationSpaceId}`);
|
|
6077
6129
|
await createOrPatchChildConcepts(client, organizationId, destinationSpaceId, childConceptMap);
|
|
6078
6130
|
await linkChildConceptsToParentGroups(client, organizationId, childConceptMap, parentGroups);
|
|
6079
6131
|
const allEntities = [
|
|
@@ -6139,7 +6191,7 @@ function buildLocalePublishPlan(sourceEntities, destinationLocaleCodes, { destin
|
|
|
6139
6191
|
}
|
|
6140
6192
|
|
|
6141
6193
|
// lib/utils/destination-locales.ts
|
|
6142
|
-
var
|
|
6194
|
+
var import_logging11 = __toESM(require_logging());
|
|
6143
6195
|
var cache = /* @__PURE__ */ new WeakMap();
|
|
6144
6196
|
function getDestinationLocaleCodes({ client, spaceId, environmentId, requestQueue }) {
|
|
6145
6197
|
let byEnvironment = cache.get(client);
|
|
@@ -6151,7 +6203,7 @@ function getDestinationLocaleCodes({ client, spaceId, environmentId, requestQueu
|
|
|
6151
6203
|
let localeCodes = byEnvironment.get(key);
|
|
6152
6204
|
if (!localeCodes) {
|
|
6153
6205
|
localeCodes = batchedPageQuery({ client, spaceId, environmentId, type: "locales", requestQueue }).then((items) => items.map((locale) => locale.code)).catch((err) => {
|
|
6154
|
-
|
|
6206
|
+
import_logging11.logEmitter.emit("warning", `Could not read the locales of the destination environment, falling back to publishing all locales: ${err.message}`);
|
|
6155
6207
|
return null;
|
|
6156
6208
|
});
|
|
6157
6209
|
byEnvironment.set(key, localeCodes);
|
|
@@ -6170,7 +6222,7 @@ async function withGraphQLSchemaBackoff(fn) {
|
|
|
6170
6222
|
throw err;
|
|
6171
6223
|
}
|
|
6172
6224
|
const delay = GRAPHQL_SCHEMA_STALE_DELAYS_MS[attempt];
|
|
6173
|
-
|
|
6225
|
+
import_logging12.logEmitter.emit("warning", `DataAssembly GraphQL schema not yet current, retrying in ${delay}ms (attempt ${attempt + 1}/${GRAPHQL_SCHEMA_STALE_DELAYS_MS.length})`);
|
|
6174
6226
|
await new Promise((resolve2) => setTimeout(resolve2, delay));
|
|
6175
6227
|
lastErr = err;
|
|
6176
6228
|
}
|
|
@@ -6221,15 +6273,15 @@ function pushToSpace({
|
|
|
6221
6273
|
...sourceData.experienceFragments || []
|
|
6222
6274
|
].some((parent2) => (parent2.optimizationVariants || []).some(isRealOptimizationVariant));
|
|
6223
6275
|
if (includeExperienceOrchestration && !skipExoVariants && hasOptimizationVariants) {
|
|
6224
|
-
|
|
6276
|
+
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.");
|
|
6225
6277
|
}
|
|
6226
6278
|
listrOptions = listrOptions || {
|
|
6227
6279
|
renderer: import_listr_verbose_renderer.default
|
|
6228
6280
|
};
|
|
6229
6281
|
const destinationDataById = {};
|
|
6230
|
-
for (const [entityType,
|
|
6282
|
+
for (const [entityType, entities2] of Object.entries(destinationData)) {
|
|
6231
6283
|
const entitiesById = /* @__PURE__ */ new Map();
|
|
6232
|
-
for (const entity of
|
|
6284
|
+
for (const entity of entities2) {
|
|
6233
6285
|
entitiesById.set(entity.sys.id, entity);
|
|
6234
6286
|
}
|
|
6235
6287
|
destinationDataById[entityType] = entitiesById;
|
|
@@ -6318,7 +6370,7 @@ function pushToSpace({
|
|
|
6318
6370
|
const ctEditorInterface = await requestQueue.add(
|
|
6319
6371
|
() => client.editorInterface.get({ spaceId, environmentId, contentTypeId: contentType.sys.id })
|
|
6320
6372
|
);
|
|
6321
|
-
|
|
6373
|
+
import_logging12.logEmitter.emit("info", `Fetched editor interface for ${contentType.name}`);
|
|
6322
6374
|
const updatedData = {
|
|
6323
6375
|
...ctEditorInterface,
|
|
6324
6376
|
controls: editorInterface.controls,
|
|
@@ -6336,7 +6388,7 @@ function pushToSpace({
|
|
|
6336
6388
|
return updatedEditorInterface;
|
|
6337
6389
|
} catch (err) {
|
|
6338
6390
|
err.entity = editorInterface;
|
|
6339
|
-
|
|
6391
|
+
import_logging12.logEmitter.emit("error", err);
|
|
6340
6392
|
return null;
|
|
6341
6393
|
}
|
|
6342
6394
|
});
|
|
@@ -6354,7 +6406,7 @@ function pushToSpace({
|
|
|
6354
6406
|
for (const file of Object.values(asset.transformed.fields.file)) {
|
|
6355
6407
|
allPendingUploads.push(requestQueue.add(async () => {
|
|
6356
6408
|
try {
|
|
6357
|
-
|
|
6409
|
+
import_logging12.logEmitter.emit("info", `Uploading Asset file ${file.upload}`);
|
|
6358
6410
|
const assetStream = await getAssetStreamForURL(file.upload, assetsDirectory);
|
|
6359
6411
|
const upload = await client.upload.create(
|
|
6360
6412
|
{ spaceId, environmentId },
|
|
@@ -6370,7 +6422,7 @@ function pushToSpace({
|
|
|
6370
6422
|
};
|
|
6371
6423
|
return upload;
|
|
6372
6424
|
} catch (err) {
|
|
6373
|
-
|
|
6425
|
+
import_logging12.logEmitter.emit("error", err);
|
|
6374
6426
|
}
|
|
6375
6427
|
}));
|
|
6376
6428
|
}
|
|
@@ -6516,7 +6568,7 @@ function pushToSpace({
|
|
|
6516
6568
|
}
|
|
6517
6569
|
});
|
|
6518
6570
|
} catch (error) {
|
|
6519
|
-
|
|
6571
|
+
import_logging12.logEmitter.emit("warning", `Unable to create Experience Orchestration (ExO) folders, error: ${error}`);
|
|
6520
6572
|
}
|
|
6521
6573
|
}),
|
|
6522
6574
|
skip: () => !includeExperienceOrchestration
|
|
@@ -6534,19 +6586,19 @@ function pushToSpace({
|
|
|
6534
6586
|
{ spaceId, environmentId, dataAssemblyId: entity.sys.id },
|
|
6535
6587
|
payload
|
|
6536
6588
|
));
|
|
6537
|
-
|
|
6589
|
+
import_logging12.logEmitter.emit("info", `UPDATE DataAssembly ${entity.sys.id}`);
|
|
6538
6590
|
} else {
|
|
6539
6591
|
const payload = { ...omitSys(entity), sys: buildDataAssemblySys(entity, 0) };
|
|
6540
6592
|
result = await withGraphQLSchemaBackoff(() => client.dataAssembly.update(
|
|
6541
6593
|
{ spaceId, environmentId, dataAssemblyId: entity.sys.id },
|
|
6542
6594
|
payload
|
|
6543
6595
|
));
|
|
6544
|
-
|
|
6596
|
+
import_logging12.logEmitter.emit("info", `CREATE DataAssembly ${entity.sys.id}`);
|
|
6545
6597
|
}
|
|
6546
6598
|
return result;
|
|
6547
6599
|
} catch (err) {
|
|
6548
6600
|
err.entity = entity;
|
|
6549
|
-
|
|
6601
|
+
import_logging12.logEmitter.emit("error", err);
|
|
6550
6602
|
return null;
|
|
6551
6603
|
}
|
|
6552
6604
|
}));
|
|
@@ -6576,17 +6628,17 @@ function pushToSpace({
|
|
|
6576
6628
|
if (existing) {
|
|
6577
6629
|
const payload = { ...entity, sys: { id: entity.sys.id, type: "DesignToken", version: existing.sys.version } };
|
|
6578
6630
|
const result = await client.designToken.upsert({ spaceId, environmentId, designTokenId: entity.sys.id }, payload);
|
|
6579
|
-
|
|
6631
|
+
import_logging12.logEmitter.emit("info", `UPDATE DesignToken ${entity.sys.id}`);
|
|
6580
6632
|
return result;
|
|
6581
6633
|
} else {
|
|
6582
6634
|
const payload = { ...omitSys(entity), sys: { id: entity.sys.id, type: "DesignToken" } };
|
|
6583
6635
|
const result = await client.designToken.upsert({ spaceId, environmentId, designTokenId: entity.sys.id }, payload);
|
|
6584
|
-
|
|
6636
|
+
import_logging12.logEmitter.emit("info", `CREATE DesignToken ${entity.sys.id}`);
|
|
6585
6637
|
return result;
|
|
6586
6638
|
}
|
|
6587
6639
|
} catch (err) {
|
|
6588
6640
|
err.entity = entity;
|
|
6589
|
-
|
|
6641
|
+
import_logging12.logEmitter.emit("error", err);
|
|
6590
6642
|
return null;
|
|
6591
6643
|
}
|
|
6592
6644
|
}));
|
|
@@ -6605,17 +6657,17 @@ function pushToSpace({
|
|
|
6605
6657
|
if (existing) {
|
|
6606
6658
|
const payload = { ...entity, sys: { id: entity.sys.id, type: "Component", version: existing.sys.version } };
|
|
6607
6659
|
const result = await client.component.upsert({ spaceId, environmentId, componentId: entity.sys.id }, payload);
|
|
6608
|
-
|
|
6660
|
+
import_logging12.logEmitter.emit("info", `UPDATE Component ${entity.sys.id}`);
|
|
6609
6661
|
results.push(result);
|
|
6610
6662
|
} else {
|
|
6611
6663
|
const payload = { ...omitSys(entity), sys: { id: entity.sys.id, type: "Component" } };
|
|
6612
6664
|
const result = await client.component.upsert({ spaceId, environmentId, componentId: entity.sys.id }, payload);
|
|
6613
|
-
|
|
6665
|
+
import_logging12.logEmitter.emit("info", `CREATE Component ${entity.sys.id}`);
|
|
6614
6666
|
results.push(result);
|
|
6615
6667
|
}
|
|
6616
6668
|
} catch (err) {
|
|
6617
6669
|
err.entity = entity;
|
|
6618
|
-
|
|
6670
|
+
import_logging12.logEmitter.emit("error", err);
|
|
6619
6671
|
}
|
|
6620
6672
|
}
|
|
6621
6673
|
ctx.data.components = results;
|
|
@@ -6647,17 +6699,17 @@ function pushToSpace({
|
|
|
6647
6699
|
if (existing) {
|
|
6648
6700
|
const payload = { ...entity, sys: { id: entity.sys.id, type: "ExperienceTemplate", version: existing.sys.version } };
|
|
6649
6701
|
const result = await client.experienceTemplate.upsert({ spaceId, environmentId, experienceTemplateId: entity.sys.id }, payload);
|
|
6650
|
-
|
|
6702
|
+
import_logging12.logEmitter.emit("info", `UPDATE ExperienceTemplate ${entity.sys.id}`);
|
|
6651
6703
|
return result;
|
|
6652
6704
|
} else {
|
|
6653
6705
|
const payload = { ...omitSys(entity), sys: { id: entity.sys.id, type: "ExperienceTemplate" } };
|
|
6654
6706
|
const result = await client.experienceTemplate.upsert({ spaceId, environmentId, experienceTemplateId: entity.sys.id }, payload);
|
|
6655
|
-
|
|
6707
|
+
import_logging12.logEmitter.emit("info", `CREATE ExperienceTemplate ${entity.sys.id}`);
|
|
6656
6708
|
return result;
|
|
6657
6709
|
}
|
|
6658
6710
|
} catch (err) {
|
|
6659
6711
|
err.entity = entity;
|
|
6660
|
-
|
|
6712
|
+
import_logging12.logEmitter.emit("error", err);
|
|
6661
6713
|
return null;
|
|
6662
6714
|
}
|
|
6663
6715
|
}));
|
|
@@ -6689,17 +6741,17 @@ function pushToSpace({
|
|
|
6689
6741
|
if (existing) {
|
|
6690
6742
|
const payload = { ...omitSysAndOptimizationVariants(entity), sys: { id: entity.sys.id, type: "ExperienceFragment", version: existing.sys.version } };
|
|
6691
6743
|
const result = await client.experienceFragment.upsert({ spaceId, environmentId, experienceFragmentId: entity.sys.id }, payload);
|
|
6692
|
-
|
|
6744
|
+
import_logging12.logEmitter.emit("info", `UPDATE ExperienceFragment ${entity.sys.id}`);
|
|
6693
6745
|
results.push(result);
|
|
6694
6746
|
} else {
|
|
6695
6747
|
const payload = { ...omitSysAndOptimizationVariants(entity), component: entity.sys.component, sys: { id: entity.sys.id, type: "ExperienceFragment" } };
|
|
6696
6748
|
const result = await client.experienceFragment.upsert({ spaceId, environmentId, experienceFragmentId: entity.sys.id }, payload);
|
|
6697
|
-
|
|
6749
|
+
import_logging12.logEmitter.emit("info", `CREATE ExperienceFragment ${entity.sys.id}`);
|
|
6698
6750
|
results.push(result);
|
|
6699
6751
|
}
|
|
6700
6752
|
} catch (err) {
|
|
6701
6753
|
err.entity = entity;
|
|
6702
|
-
|
|
6754
|
+
import_logging12.logEmitter.emit("error", err);
|
|
6703
6755
|
}
|
|
6704
6756
|
}
|
|
6705
6757
|
ctx.data.experienceFragments = results;
|
|
@@ -6731,17 +6783,17 @@ function pushToSpace({
|
|
|
6731
6783
|
if (existing) {
|
|
6732
6784
|
const payload = { ...omitSysAndOptimizationVariants(entity), sys: { id: entity.sys.id, type: "Experience", version: existing.sys.version } };
|
|
6733
6785
|
const result = await client.experience.upsert({ spaceId, environmentId, experienceId: entity.sys.id }, payload);
|
|
6734
|
-
|
|
6786
|
+
import_logging12.logEmitter.emit("info", `UPDATE Experience ${entity.sys.id}`);
|
|
6735
6787
|
return result;
|
|
6736
6788
|
} else {
|
|
6737
6789
|
const payload = { ...omitSysAndOptimizationVariants(entity), experienceTemplate: entity.sys.experienceTemplate, sys: { id: entity.sys.id, type: "Experience" } };
|
|
6738
6790
|
const result = await client.experience.upsert({ spaceId, environmentId, experienceId: entity.sys.id }, payload);
|
|
6739
|
-
|
|
6791
|
+
import_logging12.logEmitter.emit("info", `CREATE Experience ${entity.sys.id}`);
|
|
6740
6792
|
return result;
|
|
6741
6793
|
}
|
|
6742
6794
|
} catch (err) {
|
|
6743
6795
|
err.entity = entity;
|
|
6744
|
-
|
|
6796
|
+
import_logging12.logEmitter.emit("error", err);
|
|
6745
6797
|
return null;
|
|
6746
6798
|
}
|
|
6747
6799
|
}));
|
|
@@ -6905,6 +6957,18 @@ function pushToSpace({
|
|
|
6905
6957
|
));
|
|
6906
6958
|
}),
|
|
6907
6959
|
skip: () => !includeExperienceOrchestration || skipContentPublishing || !(sourceData.dataAssemblies || []).length
|
|
6960
|
+
},
|
|
6961
|
+
{
|
|
6962
|
+
title: "Importing Releases",
|
|
6963
|
+
task: (0, import_listr2.wrapTask)(async (ctx) => {
|
|
6964
|
+
const { supported: v2Releases, unsupported: v1Releases } = partitionReleasesBySchemaVersion(sourceData.releases || []);
|
|
6965
|
+
v1Releases.forEach(logUnsupportedRelease);
|
|
6966
|
+
const results = await Promise.all(v2Releases.map(
|
|
6967
|
+
(release) => importRelease(release, destinationDataById.releases?.get(release.transformed.sys.id), { client, spaceId, environmentId })
|
|
6968
|
+
));
|
|
6969
|
+
ctx.data.releases = results.filter(Boolean);
|
|
6970
|
+
}),
|
|
6971
|
+
skip: () => !(sourceData.releases || []).length
|
|
6908
6972
|
}
|
|
6909
6973
|
], listrOptions);
|
|
6910
6974
|
}
|
|
@@ -6944,24 +7008,24 @@ async function importVariantsForParents({
|
|
|
6944
7008
|
try {
|
|
6945
7009
|
const payload = { ...omitVariantSys(variant), [parentRefField]: variant.sys[parentRefField] };
|
|
6946
7010
|
const result = await ns.create({ spaceId, environmentId, [idParam]: parent2.sys.id }, payload);
|
|
6947
|
-
|
|
7011
|
+
import_logging12.logEmitter.emit("info", `CREATE ${label} ${result.sys.variant} (parent ${parent2.sys.id})`);
|
|
6948
7012
|
created.push({ ...result, sys: { ...result.sys, publishedVersion: variant.sys.publishedVersion, archivedVersion: variant.sys.archivedVersion } });
|
|
6949
7013
|
} catch (err) {
|
|
6950
7014
|
err.entity = variant;
|
|
6951
|
-
|
|
7015
|
+
import_logging12.logEmitter.emit("error", err);
|
|
6952
7016
|
}
|
|
6953
7017
|
}
|
|
6954
7018
|
return { parentId: parent2.sys.id, created };
|
|
6955
7019
|
}));
|
|
6956
7020
|
}
|
|
6957
|
-
function archiveEntities2({ entities, sourceEntities, client, spaceId, environmentId, requestQueue }) {
|
|
7021
|
+
function archiveEntities2({ entities: entities2, sourceEntities, client, spaceId, environmentId, requestQueue }) {
|
|
6958
7022
|
const entityIdsToArchive = sourceEntities.filter(({ original }) => original.sys.archivedVersion).map(({ original }) => original.sys.id);
|
|
6959
|
-
const entitiesToArchive =
|
|
7023
|
+
const entitiesToArchive = entities2.filter((entity) => entityIdsToArchive.indexOf(entity.sys.id) !== -1);
|
|
6960
7024
|
return archiveEntities({ entities: entitiesToArchive, client, spaceId, environmentId, requestQueue });
|
|
6961
7025
|
}
|
|
6962
|
-
async function publishEntities2({ entities, sourceEntities, client, spaceId, environmentId, requestQueue, destinationEntitiesById }) {
|
|
7026
|
+
async function publishEntities2({ entities: entities2, sourceEntities, client, spaceId, environmentId, requestQueue, destinationEntitiesById }) {
|
|
6963
7027
|
const entityIdsToPublish = sourceEntities.filter(({ original }) => original.sys.publishedVersion).map(({ original }) => original.sys.id);
|
|
6964
|
-
let entitiesToPublish =
|
|
7028
|
+
let entitiesToPublish = entities2.filter((entity) => entityIdsToPublish.indexOf(entity.sys.id) !== -1);
|
|
6965
7029
|
const publishAllLocales = () => publishEntities({ entities: entitiesToPublish, client, spaceId, environmentId, requestQueue });
|
|
6966
7030
|
const hasFieldStatus = sourceEntities.some(({ original }) => original.sys.fieldStatus);
|
|
6967
7031
|
if (!hasFieldStatus) {
|
|
@@ -6982,7 +7046,7 @@ async function publishEntities2({ entities, sourceEntities, client, spaceId, env
|
|
|
6982
7046
|
if (!localePublishing.skippedEntityIds.has(entity.sys.id)) {
|
|
6983
7047
|
return true;
|
|
6984
7048
|
}
|
|
6985
|
-
|
|
7049
|
+
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`);
|
|
6986
7050
|
return false;
|
|
6987
7051
|
});
|
|
6988
7052
|
}
|
|
@@ -7003,6 +7067,7 @@ __export(transformers_exports, {
|
|
|
7003
7067
|
contentTypes: () => contentTypes,
|
|
7004
7068
|
entries: () => entries,
|
|
7005
7069
|
locales: () => locales,
|
|
7070
|
+
releases: () => releases,
|
|
7006
7071
|
tags: () => tags,
|
|
7007
7072
|
webhooks: () => webhooks
|
|
7008
7073
|
});
|
|
@@ -7058,6 +7123,9 @@ function removeMetadataTags(entity, tagsEnabled = false) {
|
|
|
7058
7123
|
}
|
|
7059
7124
|
return entity;
|
|
7060
7125
|
}
|
|
7126
|
+
function releases(release) {
|
|
7127
|
+
return release;
|
|
7128
|
+
}
|
|
7061
7129
|
|
|
7062
7130
|
// lib/utils/sort-entries.ts
|
|
7063
7131
|
function sortEntries(entries2) {
|
|
@@ -7307,24 +7375,24 @@ function upgradeExoResources(resources) {
|
|
|
7307
7375
|
}
|
|
7308
7376
|
|
|
7309
7377
|
// lib/transform/transform-space.ts
|
|
7310
|
-
var
|
|
7378
|
+
var entities = [
|
|
7311
7379
|
"contentTypes",
|
|
7312
7380
|
"entries",
|
|
7313
7381
|
"assets",
|
|
7314
7382
|
"locales",
|
|
7315
7383
|
"webhooks",
|
|
7316
|
-
"tags"
|
|
7384
|
+
"tags",
|
|
7385
|
+
"releases"
|
|
7317
7386
|
];
|
|
7318
|
-
function transform_space_default(sourceData, destinationData
|
|
7319
|
-
const transformers = defaults_default(customTransformers, transformers_exports);
|
|
7387
|
+
function transform_space_default(sourceData, destinationData) {
|
|
7320
7388
|
const baseSpaceData = upgradeExoResources(omit_default(sourceData, ...entities));
|
|
7321
7389
|
sourceData.locales = sortLocales(sourceData.locales);
|
|
7322
7390
|
const tagsEnabled = !!destinationData.tags;
|
|
7323
7391
|
return entities.reduce((transformedSpaceData, type) => {
|
|
7324
|
-
const sortedEntities = type === "tags" ? sourceData[type] ?? [] : sortEntries(sourceData[type] ?? []);
|
|
7392
|
+
const sortedEntities = type === "tags" || type === "releases" ? sourceData[type] ?? [] : sortEntries(sourceData[type] ?? []);
|
|
7325
7393
|
const transformedEntities = sortedEntities.map((entity) => ({
|
|
7326
7394
|
original: entity,
|
|
7327
|
-
transformed:
|
|
7395
|
+
transformed: transformers_exports[type](entity, destinationData[type], tagsEnabled)
|
|
7328
7396
|
}));
|
|
7329
7397
|
transformedSpaceData[type] = transformedEntities;
|
|
7330
7398
|
return transformedSpaceData;
|
|
@@ -7414,13 +7482,13 @@ var attachEntityName = (details, payload) => {
|
|
|
7414
7482
|
});
|
|
7415
7483
|
};
|
|
7416
7484
|
var countInvalidEntities = (validationData) => {
|
|
7417
|
-
const entityCount = validationData.reduce((
|
|
7418
|
-
if (!
|
|
7419
|
-
|
|
7485
|
+
const entityCount = validationData.reduce((entities2, currentDetail) => {
|
|
7486
|
+
if (!entities2[currentDetail.path[0]]) {
|
|
7487
|
+
entities2[currentDetail.path[0]] = 1;
|
|
7420
7488
|
} else {
|
|
7421
|
-
|
|
7489
|
+
entities2[currentDetail.path[0]]++;
|
|
7422
7490
|
}
|
|
7423
|
-
return
|
|
7491
|
+
return entities2;
|
|
7424
7492
|
}, {});
|
|
7425
7493
|
return Object.keys(entityCount).map((key) => `${key}:${entityCount[key]}`);
|
|
7426
7494
|
};
|
|
@@ -7526,7 +7594,8 @@ var SUPPORTED_ENTITY_TYPES = [
|
|
|
7526
7594
|
"experienceTemplates",
|
|
7527
7595
|
"dataAssemblies",
|
|
7528
7596
|
"experienceFragments",
|
|
7529
|
-
"experiences"
|
|
7597
|
+
"experiences",
|
|
7598
|
+
"releases"
|
|
7530
7599
|
];
|
|
7531
7600
|
async function parseOptions(params) {
|
|
7532
7601
|
const defaultOptions = {
|
|
@@ -7619,7 +7688,7 @@ async function parseOptions(params) {
|
|
|
7619
7688
|
|
|
7620
7689
|
// lib/utils/display-error-log.ts
|
|
7621
7690
|
var import_date_fns2 = require("date-fns");
|
|
7622
|
-
var
|
|
7691
|
+
var import_logging13 = __toESM(require_logging());
|
|
7623
7692
|
function displayErrorLog(errorLog) {
|
|
7624
7693
|
if (errorLog.length) {
|
|
7625
7694
|
const count = errorLog.reduce((count2, curr) => {
|
|
@@ -7634,7 +7703,7 @@ function displayErrorLog(errorLog) {
|
|
|
7634
7703
|
|
|
7635
7704
|
The following ${count.errors} errors and ${count.warnings} warnings occurred:
|
|
7636
7705
|
`);
|
|
7637
|
-
errorLog.map((logMessage) => `${(0, import_date_fns2.format)((0, import_date_fns2.parseISO)(logMessage.ts), "HH:mm:ss")} - ${(0,
|
|
7706
|
+
errorLog.map((logMessage) => `${(0, import_date_fns2.format)((0, import_date_fns2.parseISO)(logMessage.ts), "HH:mm:ss")} - ${(0, import_logging13.formatLogMessageOneLine)(logMessage)}`).map((logMessage) => console.log(logMessage));
|
|
7638
7707
|
return;
|
|
7639
7708
|
}
|
|
7640
7709
|
console.log("No errors or warnings occurred");
|
|
@@ -7666,7 +7735,7 @@ async function runContentfulImport(params) {
|
|
|
7666
7735
|
intervalCap: options.rateLimit,
|
|
7667
7736
|
carryoverConcurrencyCount: true
|
|
7668
7737
|
});
|
|
7669
|
-
(0,
|
|
7738
|
+
(0, import_logging14.setupLogging)(log);
|
|
7670
7739
|
const infoTable = new import_cli_table3.default(tableOptions);
|
|
7671
7740
|
infoTable.push([{ colSpan: 2, content: "The following entities are going to be imported:" }]);
|
|
7672
7741
|
Object.keys(options.content).forEach((type) => {
|
|
@@ -7793,7 +7862,7 @@ async function runContentfulImport(params) {
|
|
|
7793
7862
|
const displayLog = log.filter((logMessage) => logMessage.level !== "info");
|
|
7794
7863
|
displayErrorLog(displayLog);
|
|
7795
7864
|
if (errorLog.length) {
|
|
7796
|
-
return (0,
|
|
7865
|
+
return (0, import_logging14.writeErrorLogFile)(options.errorLogFile, errorLog).then(() => {
|
|
7797
7866
|
const multiError = new ContentfulMultiError("Errors occurred");
|
|
7798
7867
|
multiError.name = "ContentfulMultiError";
|
|
7799
7868
|
multiError.errors = errorLog;
|