@kontent-ai/migration-toolkit 3.0.1 → 3.1.1
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/core/logs/loggers.js +13 -11
- package/dist/core/logs/loggers.js.map +1 -1
- package/dist/core/models/core.models.d.ts +28 -28
- package/dist/core/models/error.models.js +2 -2
- package/dist/core/models/error.models.js.map +1 -1
- package/dist/core/models/log.models.d.ts +6 -6
- package/dist/core/models/migration.schema.d.ts +2 -2
- package/dist/core/utils/array.utils.d.ts +1 -2
- package/dist/core/utils/array.utils.js.map +1 -1
- package/dist/core/utils/confirm.utils.d.ts +9 -2
- package/dist/core/utils/confirm.utils.js +42 -4
- package/dist/core/utils/confirm.utils.js.map +1 -1
- package/dist/core/utils/error.utils.js +6 -0
- package/dist/core/utils/error.utils.js.map +1 -1
- package/dist/core/utils/external-id.utils.d.ts +2 -2
- package/dist/core/utils/global.utils.d.ts +1 -1
- package/dist/core/utils/global.utils.js +4 -4
- package/dist/core/utils/global.utils.js.map +1 -1
- package/dist/core/utils/http.utils.d.ts +1 -2
- package/dist/core/utils/http.utils.js.map +1 -1
- package/dist/core/utils/management-client-utils.d.ts +3 -3
- package/dist/core/utils/management-client-utils.js +1 -1
- package/dist/core/utils/management-client-utils.js.map +1 -1
- package/dist/core/utils/processing-utils.js +2 -2
- package/dist/core/utils/processing-utils.js.map +1 -1
- package/dist/export/export.models.d.ts +18 -18
- package/dist/import/comparers/asset-comparer.js +5 -2
- package/dist/import/comparers/asset-comparer.js.map +1 -1
- package/dist/import/context/import-context-fetcher.js.map +1 -1
- package/dist/import/import.models.d.ts +14 -14
- package/dist/import/importers/workflow-importer.d.ts +1 -1
- package/dist/import/importers/workflow-importer.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/metadata.d.ts +0 -1
- package/dist/metadata.js +1 -2
- package/dist/metadata.js.map +1 -1
- package/dist/node/cli/actions/export-action.js +13 -14
- package/dist/node/cli/actions/export-action.js.map +1 -1
- package/dist/node/cli/actions/import-action.js +13 -4
- package/dist/node/cli/actions/import-action.js.map +1 -1
- package/dist/node/cli/actions/migrate-action.js +1 -1
- package/dist/node/cli/actions/migrate-action.js.map +1 -1
- package/dist/node/cli/cli.models.d.ts +4 -4
- package/dist/toolkit/file.d.ts +4 -4
- package/dist/toolkit/migrate.d.ts +6 -6
- package/dist/translation/extraction/items-extraction.processor.d.ts +8 -8
- package/dist/translation/extraction/items-extraction.processor.js +2 -3
- package/dist/translation/extraction/items-extraction.processor.js.map +1 -1
- package/dist/translation/transforms/import-transforms.js.map +1 -1
- package/lib/core/logs/loggers.ts +13 -15
- package/lib/core/models/core.models.ts +28 -28
- package/lib/core/models/error.models.ts +2 -2
- package/lib/core/models/log.models.ts +6 -6
- package/lib/core/models/migration.schema.ts +2 -2
- package/lib/core/utils/array.utils.ts +0 -2
- package/lib/core/utils/confirm.utils.ts +70 -5
- package/lib/core/utils/error.utils.ts +6 -0
- package/lib/core/utils/external-id.utils.ts +2 -2
- package/lib/core/utils/global.utils.ts +5 -9
- package/lib/core/utils/http.utils.ts +1 -2
- package/lib/core/utils/management-client-utils.ts +13 -13
- package/lib/core/utils/processing-utils.ts +3 -3
- package/lib/export/export.models.ts +18 -18
- package/lib/import/comparers/asset-comparer.ts +6 -2
- package/lib/import/context/import-context-fetcher.ts +3 -4
- package/lib/import/import.models.ts +14 -14
- package/lib/import/importers/workflow-importer.ts +1 -2
- package/lib/index.ts +2 -1
- package/lib/metadata.ts +1 -2
- package/lib/node/cli/actions/export-action.ts +14 -14
- package/lib/node/cli/actions/import-action.ts +15 -6
- package/lib/node/cli/actions/migrate-action.ts +1 -1
- package/lib/node/cli/cli.models.ts +4 -4
- package/lib/toolkit/file.ts +4 -4
- package/lib/toolkit/migrate.ts +6 -6
- package/lib/translation/extraction/items-extraction.processor.ts +10 -11
- package/lib/translation/transforms/import-transforms.ts +1 -2
- package/package.json +23 -30
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"items-extraction.processor.js","sourceRoot":"","sources":["../../../lib/translation/extraction/items-extraction.processor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"items-extraction.processor.js","sourceRoot":"","sources":["../../../lib/translation/extraction/items-extraction.processor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,YAAY,CAAC;AAGtC,OAAO,EAAE,+BAA+B,EAAE,MAAM,iCAAiC,CAAC;AAClF,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAG5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAsBtE,MAAM,UAAU,wBAAwB;IACvC,MAAM,qCAAqC,GAAG,CAC7C,KAAiC,EACjC,UAAoC,EACD,EAAE;QACrC,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,CAChC,CAAC,YAAY,EAAE,IAAI,EAAE,EAAE;YACtB,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAwC,CAAC,iBAAiB,EAAE,WAAW,EAAE,EAAE;gBACrG,MAAM,WAAW,GAAG,UAAU,CAAC,IAAI,CAAC,aAAa,EAAE,WAAW,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;gBAEjF,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC;qBACrB,IAAI,CAAC,WAAW,EAAE,GAAG,EAAE;oBACvB,MAAM,QAAQ,GAAG,WAAW,CAAC,KAAK,IAAI,QAAQ,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;oBAE3F,2BAA2B;oBAC3B,iBAAiB,EAAE;yBACjB,cAAc,CAAC,QAAQ,CAAC;yBACxB,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE;wBACnB,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,E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oBACrD,CAAC,CAAC,CAAC;gBACL,CAAC,CAAC;qBACD,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE;oBACnB,+BAA+B,CAAC,OAAO,CAAC,KAAK,CAAC;yBAC5C,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC;yBACtB,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;wBACrB,uBAAuB,CAAC,cAAc,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;oBACtD,CAAC,CAAC,CAAC;gBACL,CAAC,CAAC,CAAC;gBAEJ,OAAO,uBAAuB,CAAC;YAChC,CAAC,EACD,kBAAkB,CAClB,CAAC;QACH,CAAC,EACD;YACC,aAAa,EAAE,IAAI,GAAG,EAAE;YACxB,cAAc,EAAE,IAAI,GAAG,EAAE;SACzB,CACD,CAAC;QAEF,OAAO;YACN,aAAa,EAAE,kBAAkB,CAAC,aAAa;YAC/C,cAAc,EAAE,kBAAkB,CAAC,cAAc;SACjD,CAAC;IACH,CAAC,CAAC;IAEF,OAAO;QACN,qCAAqC;QACrC,wCAAwC;KACxC,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import-transforms.js","sourceRoot":"","sources":["../../../lib/translation/transforms/import-transforms.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"import-transforms.js","sourceRoot":"","sources":["../../../lib/translation/transforms/import-transforms.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,8BAA8B,EAAwB,MAAM,4BAA4B,CAAC;AAEhI,OAAO,EAAE,+BAA+B,EAAE,MAAM,iCAAiC,CAAC;AAClF,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAE5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAEtE,MAAM,eAAe,GAAG,IAAI,8BAA8B,EAAE,CAAC;AAE7D;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAA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wB,CAAC,YAAY,EAAE,CAAC,QAAQ,EAAE,EAAE;QACtF,OAAO,IAAI,CAAC,aAAa,CAAC,+BAA+B,CAAC,QAAQ,CAAC,CAAC;IACrE,CAAC,CAAC,CAAC,IAAI,CAAC;IAER,gEAAgE;IAChE,YAAY,GAAG,iBAAiB,EAAE,CAAC,qBAAqB,CAAC,YAAY,EAAE,CAAC,QAAQ,EAAE,EAAE;QACnF,OAAO,IAAI,CAAC,aAAa,CAAC,gCAAgC,CAAC,QAAQ,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC,IAAI,CAAC;IAER,qEAAqE;IACrE,YAAY,GAAG,iBAAiB,EAAE,CAAC,yBAAyB,CAAC,YAAY,EAAE,CAAC,QAAQ,EAAE,EAAE;QACvF,OAAO,IAAI,CAAC,aAAa,CAAC,gCAAgC,CAAC,QAAQ,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC,IAAI,CAAC;IAER,OAAO,YAAY,CAAC;AACrB,CAAC"}
|
package/lib/core/logs/loggers.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import chalk from "chalk";
|
|
1
|
+
import chalk, { type ChalkInstance } from "chalk";
|
|
3
2
|
import { match, P } from "ts-pattern";
|
|
4
3
|
import type { Logger, LogSpinnerMessage } from "../models/log.models.js";
|
|
5
4
|
import { getCurrentEnvironment } from "../utils/global.utils.js";
|
|
@@ -28,19 +27,18 @@ const defaultNodeLogger: Logger = {
|
|
|
28
27
|
}
|
|
29
28
|
};
|
|
30
29
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
return result;
|
|
30
|
+
try {
|
|
31
|
+
return await func((data) => {
|
|
32
|
+
// remember last used prefix. This is useful as we don't have to pass prefix to every single function
|
|
33
|
+
// calling the spinner
|
|
34
|
+
if (data.prefix) {
|
|
35
|
+
spinner.prefixText = data.prefix ?? "";
|
|
36
|
+
}
|
|
37
|
+
spinner.text = getLogDataMessage(data);
|
|
38
|
+
});
|
|
39
|
+
} finally {
|
|
40
|
+
global.console.warn = originalWarn;
|
|
41
|
+
}
|
|
44
42
|
}, {});
|
|
45
43
|
},
|
|
46
44
|
};
|
|
@@ -52,28 +52,28 @@ export type LanguageVariantWorkflowState =
|
|
|
52
52
|
}
|
|
53
53
|
| undefined;
|
|
54
54
|
|
|
55
|
-
export
|
|
55
|
+
export type ItemInfo = {
|
|
56
56
|
readonly title: string;
|
|
57
57
|
readonly itemType: MapiType | MigrationItemType;
|
|
58
|
-
}
|
|
58
|
+
};
|
|
59
59
|
|
|
60
|
-
export
|
|
60
|
+
export type ErrorData = {
|
|
61
61
|
readonly message: string;
|
|
62
|
-
readonly requestData
|
|
63
|
-
readonly requestUrl
|
|
62
|
+
readonly requestData: string | undefined;
|
|
63
|
+
readonly requestUrl: string | undefined;
|
|
64
64
|
readonly isUnknownError: boolean;
|
|
65
65
|
readonly error: unknown;
|
|
66
|
-
}
|
|
66
|
+
};
|
|
67
67
|
|
|
68
|
-
export
|
|
68
|
+
export type ReferencedDataInMigrationItems = {
|
|
69
69
|
readonly itemCodenames: ReadonlySet<string>;
|
|
70
70
|
readonly assetCodenames: ReadonlySet<string>;
|
|
71
|
-
}
|
|
71
|
+
};
|
|
72
72
|
|
|
73
|
-
export
|
|
73
|
+
export type ReferencedDataInLanguageVariants = {
|
|
74
74
|
readonly itemIds: ReadonlySet<string>;
|
|
75
75
|
readonly assetIds: ReadonlySet<string>;
|
|
76
|
-
}
|
|
76
|
+
};
|
|
77
77
|
|
|
78
78
|
type DataStateInSourceEnvironmentById<T extends Readonly<ContentItemModels.ContentItem> | Readonly<AssetModels.Asset>> = {
|
|
79
79
|
readonly id: string;
|
|
@@ -96,61 +96,61 @@ export type ItemStateInSourceEnvironmentById = DataStateInSourceEnvironmentById<
|
|
|
96
96
|
|
|
97
97
|
export type AssetStateInSourceEnvironmentById = DataStateInSourceEnvironmentById<Readonly<AssetModels.Asset>>;
|
|
98
98
|
|
|
99
|
-
export
|
|
99
|
+
export type ItemStateInTargetEnvironmentByCodename = {
|
|
100
100
|
readonly state: TargetItemState;
|
|
101
101
|
readonly itemCodename: string;
|
|
102
102
|
readonly item: Readonly<ContentItemModels.ContentItem> | undefined;
|
|
103
103
|
readonly externalIdToUse: string;
|
|
104
|
-
}
|
|
104
|
+
};
|
|
105
105
|
|
|
106
|
-
export
|
|
106
|
+
export type LanguageVariantStateData = {
|
|
107
107
|
readonly languageVariant: Readonly<LanguageVariantModels.ContentItemLanguageVariant> | undefined;
|
|
108
108
|
readonly workflow: Readonly<WorkflowModels.Workflow> | undefined;
|
|
109
109
|
readonly workflowState: LanguageVariantWorkflowState;
|
|
110
|
-
}
|
|
110
|
+
};
|
|
111
111
|
|
|
112
|
-
export
|
|
112
|
+
export type LanguageVariantStateInTargetEnvironmentByCodename = {
|
|
113
113
|
readonly state: TargetItemState;
|
|
114
114
|
readonly itemCodename: string;
|
|
115
115
|
readonly languageCodename: string;
|
|
116
116
|
readonly publishedLanguageVariant: LanguageVariantStateData | undefined;
|
|
117
117
|
readonly draftLanguageVariant: LanguageVariantStateData | undefined;
|
|
118
|
-
}
|
|
118
|
+
};
|
|
119
119
|
|
|
120
|
-
export
|
|
120
|
+
export type AssetStateInTargetEnvironmentByCodename = {
|
|
121
121
|
readonly state: TargetItemState;
|
|
122
122
|
readonly assetCodename: string;
|
|
123
123
|
readonly asset: Readonly<AssetModels.Asset> | undefined;
|
|
124
124
|
readonly externalIdToUse: string;
|
|
125
|
-
}
|
|
125
|
+
};
|
|
126
126
|
|
|
127
|
-
export
|
|
127
|
+
export type PackageMetadata = {
|
|
128
128
|
readonly created: Date;
|
|
129
129
|
readonly environmentId: string;
|
|
130
130
|
readonly dataOverview: PackageDataOverview;
|
|
131
|
-
}
|
|
131
|
+
};
|
|
132
132
|
|
|
133
|
-
export
|
|
133
|
+
export type PackageDataOverview = {
|
|
134
134
|
readonly contentItemsCount: number;
|
|
135
135
|
readonly assetsCount: number;
|
|
136
|
-
}
|
|
136
|
+
};
|
|
137
137
|
|
|
138
|
-
export
|
|
138
|
+
export type FlattenedContentTypeElement = {
|
|
139
139
|
readonly codename: string;
|
|
140
140
|
readonly name: string | undefined;
|
|
141
141
|
readonly id: string;
|
|
142
142
|
readonly type: MigrationElementType;
|
|
143
143
|
readonly element: Readonly<ContentTypeElements.ContentTypeElementModel>;
|
|
144
|
-
}
|
|
144
|
+
};
|
|
145
145
|
|
|
146
|
-
export
|
|
146
|
+
export type FlattenedContentType = {
|
|
147
147
|
readonly contentTypeCodename: string;
|
|
148
148
|
readonly name: string;
|
|
149
149
|
readonly contentTypeId: string;
|
|
150
150
|
readonly elements: readonly FlattenedContentTypeElement[];
|
|
151
|
-
}
|
|
151
|
+
};
|
|
152
152
|
|
|
153
|
-
export
|
|
153
|
+
export type OriginalManagementError = {
|
|
154
154
|
readonly response?: {
|
|
155
155
|
readonly status?: number;
|
|
156
156
|
readonly config?: {
|
|
@@ -161,7 +161,7 @@ export interface OriginalManagementError {
|
|
|
161
161
|
readonly error_code?: number;
|
|
162
162
|
};
|
|
163
163
|
};
|
|
164
|
-
}
|
|
164
|
+
};
|
|
165
165
|
|
|
166
166
|
export type ItemProcessingResult<InputItem, OutputItem> =
|
|
167
167
|
| {
|
|
@@ -112,7 +112,7 @@ export class InvalidValueError extends MigrationToolkitError {
|
|
|
112
112
|
` ${chalk.gray("└─")} ID: ${chalk.dim(contentType.contentTypeId)}`,
|
|
113
113
|
"",
|
|
114
114
|
`${chalk.cyan("🔧 Element:")}`,
|
|
115
|
-
` ${chalk.gray("├─")} Name: ${chalk.yellow.bold(element.name)}`,
|
|
115
|
+
` ${chalk.gray("├─")} Name: ${chalk.yellow.bold(element.name ?? "n/a")}`,
|
|
116
116
|
` ${chalk.gray("├─")} Codename: ${chalk.yellow.bold(element.codename)}`,
|
|
117
117
|
` ${chalk.gray("├─")} Type: ${chalk.green.bold(element.type)}`,
|
|
118
118
|
` ${chalk.gray("└─")} ID: ${chalk.dim(element.id)}`,
|
|
@@ -124,7 +124,7 @@ export class InvalidValueError extends MigrationToolkitError {
|
|
|
124
124
|
"",
|
|
125
125
|
`${chalk.cyan("📦 Item version:")}`,
|
|
126
126
|
` ${chalk.gray("├─")} Workflow step codename: ${chalk.yellow.bold(exportItemVersion.workflowStepCodename)}`,
|
|
127
|
-
` ${chalk.gray("└─")} Language variant: ${chalk.yellow.bold(exportItemVersion.languageVariant.language.codename)}`,
|
|
127
|
+
` ${chalk.gray("└─")} Language variant: ${chalk.yellow.bold(exportItemVersion.languageVariant.language.codename ?? "n/a")}`,
|
|
128
128
|
"",
|
|
129
129
|
chalk.cyan("Invalid Value:"),
|
|
130
130
|
chalk.dim(getValueToDisplay()),
|
|
@@ -16,19 +16,19 @@ export type DebugType =
|
|
|
16
16
|
| MapiType
|
|
17
17
|
| MapiAction;
|
|
18
18
|
|
|
19
|
-
export
|
|
19
|
+
export type LogMessage = {
|
|
20
20
|
readonly type?: DebugType;
|
|
21
21
|
readonly message: string;
|
|
22
|
-
}
|
|
22
|
+
};
|
|
23
23
|
|
|
24
|
-
export
|
|
24
|
+
export type LogSpinnerMessage = LogMessage & {
|
|
25
25
|
readonly prefix?: string;
|
|
26
|
-
}
|
|
26
|
+
};
|
|
27
27
|
|
|
28
28
|
export type LogData = (data: LogMessage) => void;
|
|
29
29
|
export type LogSpinnerData = (data: LogSpinnerMessage) => void;
|
|
30
30
|
|
|
31
|
-
export
|
|
31
|
+
export type Logger = {
|
|
32
32
|
readonly logWithSpinnerAsync: <T>(func: (logData: LogSpinnerData) => Promise<T>) => Promise<T>;
|
|
33
33
|
readonly log: LogData;
|
|
34
|
-
}
|
|
34
|
+
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Buffer as BufferProxy } from "buffer";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
type Elements = {
|
|
5
5
|
readonly [key: string]: Element;
|
|
6
|
-
}
|
|
6
|
+
};
|
|
7
7
|
|
|
8
8
|
type UrlSlugMode = "autogenerated" | "custom";
|
|
9
9
|
type Reference = { readonly codename: string };
|
|
@@ -12,8 +12,6 @@ export function parseAsMigrationReferencesArray(value: MigrationElementValue): r
|
|
|
12
12
|
throw new MigrationToolkitError("invalidValue", `Value is not an array`);
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
export function findRequired<T>(array: readonly T[], predicate: (item: T, index: number) => boolean, errorMessage: string): T;
|
|
16
|
-
export function findRequired<T>(array: readonly T[], predicate: (item: T, index: number) => boolean, errorMessage: () => never): T;
|
|
17
15
|
export function findRequired<T>(
|
|
18
16
|
array: readonly T[],
|
|
19
17
|
predicate: (item: T, index: number) => boolean,
|
|
@@ -5,6 +5,13 @@ import { MigrationToolkitError } from "../models/error.models.js";
|
|
|
5
5
|
import type { Logger } from "../models/log.models.js";
|
|
6
6
|
import { getMigrationManagementClient, managementClientUtils } from "./management-client-utils.js";
|
|
7
7
|
|
|
8
|
+
const maxItemsShownInPreview = 20;
|
|
9
|
+
|
|
10
|
+
export type ItemPreview = {
|
|
11
|
+
readonly itemCodename: string;
|
|
12
|
+
readonly languageCodename: string;
|
|
13
|
+
};
|
|
14
|
+
|
|
8
15
|
export async function confirmExportAsync(data: {
|
|
9
16
|
readonly force: boolean;
|
|
10
17
|
readonly environmentId: string;
|
|
@@ -12,7 +19,7 @@ export async function confirmExportAsync(data: {
|
|
|
12
19
|
readonly logger: Logger;
|
|
13
20
|
readonly skipMissingReferences: boolean;
|
|
14
21
|
readonly dataToExport: {
|
|
15
|
-
readonly
|
|
22
|
+
readonly exportItems: readonly ItemPreview[];
|
|
16
23
|
};
|
|
17
24
|
}): Promise<void> {
|
|
18
25
|
const environment = await managementClientUtils(
|
|
@@ -25,7 +32,8 @@ export async function confirmExportAsync(data: {
|
|
|
25
32
|
|
|
26
33
|
const text = getConfirmText({
|
|
27
34
|
action: "export",
|
|
28
|
-
itemsCount: data.dataToExport.
|
|
35
|
+
itemsCount: data.dataToExport.exportItems.length,
|
|
36
|
+
exportItems: data.dataToExport.exportItems,
|
|
29
37
|
sourceEnvironment: environment,
|
|
30
38
|
skipMissingReferences: data.skipMissingReferences,
|
|
31
39
|
});
|
|
@@ -51,7 +59,7 @@ export async function confirmMigrateAsync(data: {
|
|
|
51
59
|
readonly skipMissingReferences: boolean;
|
|
52
60
|
readonly logger: Logger;
|
|
53
61
|
readonly dataToMigrate: {
|
|
54
|
-
readonly
|
|
62
|
+
readonly migrateItems: readonly ItemPreview[];
|
|
55
63
|
};
|
|
56
64
|
}): Promise<void> {
|
|
57
65
|
const sourceEnvironment = await managementClientUtils(
|
|
@@ -71,7 +79,8 @@ export async function confirmMigrateAsync(data: {
|
|
|
71
79
|
|
|
72
80
|
const text = getConfirmText({
|
|
73
81
|
action: "migrate",
|
|
74
|
-
itemsCount: data.dataToMigrate.
|
|
82
|
+
itemsCount: data.dataToMigrate.migrateItems.length,
|
|
83
|
+
migrateItems: data.dataToMigrate.migrateItems,
|
|
75
84
|
sourceEnvironment,
|
|
76
85
|
targetEnvironment,
|
|
77
86
|
skipMissingReferences: data.skipMissingReferences,
|
|
@@ -90,6 +99,9 @@ export async function confirmImportAsync(data: {
|
|
|
90
99
|
readonly environmentId: string;
|
|
91
100
|
readonly apiKey: string;
|
|
92
101
|
readonly logger: Logger;
|
|
102
|
+
readonly dataToImport: {
|
|
103
|
+
readonly importItems: readonly ItemPreview[];
|
|
104
|
+
};
|
|
93
105
|
}): Promise<void> {
|
|
94
106
|
const environment = await managementClientUtils(
|
|
95
107
|
getMigrationManagementClient({
|
|
@@ -102,7 +114,8 @@ export async function confirmImportAsync(data: {
|
|
|
102
114
|
const text = getConfirmText({
|
|
103
115
|
action: "import",
|
|
104
116
|
targetEnvironment: environment,
|
|
105
|
-
itemsCount:
|
|
117
|
+
itemsCount: data.dataToImport.importItems.length,
|
|
118
|
+
importItems: data.dataToImport.importItems,
|
|
106
119
|
});
|
|
107
120
|
|
|
108
121
|
await confirmAsync({
|
|
@@ -145,6 +158,9 @@ async function confirmAsync(data: {
|
|
|
145
158
|
function getConfirmText({
|
|
146
159
|
action,
|
|
147
160
|
itemsCount,
|
|
161
|
+
exportItems,
|
|
162
|
+
importItems,
|
|
163
|
+
migrateItems,
|
|
148
164
|
sourceEnvironment,
|
|
149
165
|
targetEnvironment,
|
|
150
166
|
skipMissingReferences,
|
|
@@ -152,9 +168,29 @@ function getConfirmText({
|
|
|
152
168
|
readonly action: "export" | "import" | "migrate";
|
|
153
169
|
readonly skipMissingReferences?: boolean;
|
|
154
170
|
readonly itemsCount?: number;
|
|
171
|
+
readonly exportItems?: readonly ItemPreview[];
|
|
172
|
+
readonly importItems?: readonly ItemPreview[];
|
|
173
|
+
readonly migrateItems?: readonly ItemPreview[];
|
|
155
174
|
readonly sourceEnvironment?: EnvironmentModels.EnvironmentInformationModel;
|
|
156
175
|
readonly targetEnvironment?: EnvironmentModels.EnvironmentInformationModel;
|
|
157
176
|
}): string {
|
|
177
|
+
const previewItems: readonly ItemPreview[] = match(action)
|
|
178
|
+
.returnType<readonly ItemPreview[]>()
|
|
179
|
+
.with("export", () => exportItems ?? [])
|
|
180
|
+
.with("import", () => importItems ?? [])
|
|
181
|
+
.with("migrate", () => migrateItems ?? [])
|
|
182
|
+
.exhaustive()
|
|
183
|
+
.slice(0, maxItemsShownInPreview);
|
|
184
|
+
const remainingPreviewItemsCount: number = Math.max(
|
|
185
|
+
match(action)
|
|
186
|
+
.returnType<number>()
|
|
187
|
+
.with("export", () => exportItems?.length ?? 0)
|
|
188
|
+
.with("import", () => importItems?.length ?? 0)
|
|
189
|
+
.with("migrate", () => migrateItems?.length ?? 0)
|
|
190
|
+
.exhaustive() - previewItems.length,
|
|
191
|
+
0,
|
|
192
|
+
);
|
|
193
|
+
|
|
158
194
|
const lines: readonly string[] = [
|
|
159
195
|
`\n${"=".repeat(70)}`,
|
|
160
196
|
...match(action)
|
|
@@ -191,6 +227,35 @@ function getConfirmText({
|
|
|
191
227
|
"",
|
|
192
228
|
])
|
|
193
229
|
.otherwise(() => []),
|
|
230
|
+
...match(action)
|
|
231
|
+
.returnType<readonly string[]>()
|
|
232
|
+
.with(P.union("export", "import", "migrate"), (action) => [
|
|
233
|
+
...match(previewItems.length)
|
|
234
|
+
.returnType<readonly string[]>()
|
|
235
|
+
.with(
|
|
236
|
+
P.when((count) => count > 0),
|
|
237
|
+
() => [
|
|
238
|
+
`${chalk.cyan(
|
|
239
|
+
match(action)
|
|
240
|
+
.with("export", () => "🧾 Export item codenames preview:")
|
|
241
|
+
.with("import", () => "🧾 Import item codenames preview:")
|
|
242
|
+
.with("migrate", () => "🧾 Migrate item codenames preview:")
|
|
243
|
+
.exhaustive(),
|
|
244
|
+
)}`,
|
|
245
|
+
...previewItems.map((item) => ` ${chalk.gray("├─")} ${item.itemCodename} (${item.languageCodename})`),
|
|
246
|
+
...match(remainingPreviewItemsCount)
|
|
247
|
+
.returnType<readonly string[]>()
|
|
248
|
+
.with(
|
|
249
|
+
P.when((count) => count > 0),
|
|
250
|
+
(count) => [` ${chalk.gray("└─")} and ${chalk.yellow.bold(count)} more`],
|
|
251
|
+
)
|
|
252
|
+
.otherwise(() => []),
|
|
253
|
+
"",
|
|
254
|
+
],
|
|
255
|
+
)
|
|
256
|
+
.otherwise(() => []),
|
|
257
|
+
])
|
|
258
|
+
.otherwise(() => []),
|
|
194
259
|
...match(action)
|
|
195
260
|
.returnType<readonly string[]>()
|
|
196
261
|
.with(P.union("export", "migrate"), () => [
|
|
@@ -32,6 +32,8 @@ export function extractErrorData(error: unknown): ErrorData {
|
|
|
32
32
|
isUnknownError: false,
|
|
33
33
|
error: error,
|
|
34
34
|
message: `Found '${chalk.red(error.issues.length)}' parsing errors: \n${parsingErrorsMsg}`,
|
|
35
|
+
requestData: undefined,
|
|
36
|
+
requestUrl: undefined,
|
|
35
37
|
};
|
|
36
38
|
},
|
|
37
39
|
)
|
|
@@ -42,6 +44,8 @@ export function extractErrorData(error: unknown): ErrorData {
|
|
|
42
44
|
isUnknownError: false,
|
|
43
45
|
error: error,
|
|
44
46
|
message: error.message,
|
|
47
|
+
requestData: undefined,
|
|
48
|
+
requestUrl: undefined,
|
|
45
49
|
};
|
|
46
50
|
},
|
|
47
51
|
)
|
|
@@ -50,6 +54,8 @@ export function extractErrorData(error: unknown): ErrorData {
|
|
|
50
54
|
isUnknownError: true,
|
|
51
55
|
error: error,
|
|
52
56
|
message: `Unknown error`,
|
|
57
|
+
requestData: undefined,
|
|
58
|
+
requestUrl: undefined,
|
|
53
59
|
};
|
|
54
60
|
});
|
|
55
61
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type ExternalIdGenerator = {
|
|
2
2
|
readonly assetExternalId: (codename: string) => string;
|
|
3
3
|
readonly contentItemExternalId: (codename: string) => string;
|
|
4
|
-
}
|
|
4
|
+
};
|
|
5
5
|
|
|
6
6
|
export const defaultExternalIdGenerator: ExternalIdGenerator = {
|
|
7
7
|
assetExternalId: (codename) => `asset_${codename}`,
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import { getTrackingService } from "@kontent-ai-consulting/tools-analytics";
|
|
1
|
+
import { getTrackingService, type ITrackingEventData } from "@kontent-ai-consulting/tools-analytics";
|
|
3
2
|
import { isBrowser, isNode, isWebWorker } from "browser-or-node";
|
|
4
3
|
import { format } from "bytes";
|
|
5
4
|
import { getDefaultLogger } from "../logs/loggers.js";
|
|
@@ -47,7 +46,7 @@ export async function executeWithTrackingAsync<TResult>(data: {
|
|
|
47
46
|
const trackingService = getTrackingService();
|
|
48
47
|
const logger = data.logger ?? getDefaultLogger();
|
|
49
48
|
|
|
50
|
-
const event = await
|
|
49
|
+
const event = await runWithTrackingAsync({
|
|
51
50
|
func: async () => {
|
|
52
51
|
return await trackingService.trackEventAsync(data.event);
|
|
53
52
|
},
|
|
@@ -58,7 +57,7 @@ export async function executeWithTrackingAsync<TResult>(data: {
|
|
|
58
57
|
const result = await data.func();
|
|
59
58
|
|
|
60
59
|
if (event) {
|
|
61
|
-
await
|
|
60
|
+
await runWithTrackingAsync({
|
|
62
61
|
func: async () => {
|
|
63
62
|
await trackingService.setEventResultAsync({
|
|
64
63
|
eventId: event.eventId,
|
|
@@ -72,7 +71,7 @@ export async function executeWithTrackingAsync<TResult>(data: {
|
|
|
72
71
|
return result;
|
|
73
72
|
} catch (error) {
|
|
74
73
|
if (event) {
|
|
75
|
-
await
|
|
74
|
+
await runWithTrackingAsync({
|
|
76
75
|
func: async () => {
|
|
77
76
|
await trackingService.setEventResultAsync({
|
|
78
77
|
eventId: event.eventId,
|
|
@@ -87,10 +86,7 @@ export async function executeWithTrackingAsync<TResult>(data: {
|
|
|
87
86
|
}
|
|
88
87
|
}
|
|
89
88
|
|
|
90
|
-
async function
|
|
91
|
-
readonly func: () => Promise<T>;
|
|
92
|
-
readonly logger: Logger;
|
|
93
|
-
}): Promise<T | undefined> {
|
|
89
|
+
async function runWithTrackingAsync<T>(data: { readonly func: () => Promise<T>; readonly logger: Logger }): Promise<T | undefined> {
|
|
94
90
|
try {
|
|
95
91
|
return await data.func();
|
|
96
92
|
} catch (trackingError) {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import { HttpService } from "@kontent-ai/core-sdk";
|
|
1
|
+
import { HttpService, type IRetryStrategyOptions } from "@kontent-ai/core-sdk";
|
|
3
2
|
import { match } from "ts-pattern";
|
|
4
3
|
import type { OriginalManagementError } from "../models/core.models.js";
|
|
5
4
|
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import type { IRetryStrategyOptions } from "@kontent-ai/core-sdk";
|
|
2
|
-
import
|
|
3
|
-
AssetFolderModels,
|
|
4
|
-
CollectionModels,
|
|
5
|
-
ContentTypeModels,
|
|
6
|
-
ContentTypeSnippetModels,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
import {
|
|
3
|
+
type AssetFolderModels,
|
|
4
|
+
type CollectionModels,
|
|
5
|
+
type ContentTypeModels,
|
|
6
|
+
type ContentTypeSnippetModels,
|
|
7
|
+
createManagementClient,
|
|
8
|
+
type EnvironmentModels,
|
|
9
|
+
type LanguageModels,
|
|
10
|
+
type ManagementClient,
|
|
11
|
+
type TaxonomyModels,
|
|
12
|
+
type WorkflowModels,
|
|
12
13
|
} from "@kontent-ai/management-sdk";
|
|
13
|
-
import { createManagementClient } from "@kontent-ai/management-sdk";
|
|
14
14
|
import chalk from "chalk";
|
|
15
15
|
import { coreConfig } from "../config.js";
|
|
16
16
|
import type { FlattenedContentType, FlattenedContentTypeElement } from "../models/core.models.js";
|
|
@@ -20,12 +20,12 @@ import { isNotUndefined } from "./global.utils.js";
|
|
|
20
20
|
import { defaultHttpService, defaultRetryStrategy } from "./http.utils.js";
|
|
21
21
|
import { runMapiRequestAsync } from "./run.utils.js";
|
|
22
22
|
|
|
23
|
-
export
|
|
23
|
+
export type ManagementClientConfig = {
|
|
24
24
|
readonly environmentId: string;
|
|
25
25
|
readonly apiKey: string;
|
|
26
26
|
readonly retryStrategy?: Readonly<IRetryStrategyOptions>;
|
|
27
27
|
readonly baseUrl?: string;
|
|
28
|
-
}
|
|
28
|
+
};
|
|
29
29
|
|
|
30
30
|
export function getMigrationManagementClient(config: ManagementClientConfig): Readonly<ManagementClient> {
|
|
31
31
|
return createManagementClient({
|
|
@@ -32,9 +32,9 @@ export async function processItemsAsync<InputItem, OutputItem>(data: {
|
|
|
32
32
|
const limit = pLimit(data.parallelLimit);
|
|
33
33
|
let processedItemsCount: number = 1;
|
|
34
34
|
|
|
35
|
-
const requests: readonly Promise<ItemProcessingResult<InputItem, OutputItem>>[] = data.items.map((item) =>
|
|
36
|
-
limit(() => {
|
|
37
|
-
return data
|
|
35
|
+
const requests: readonly Promise<ItemProcessingResult<InputItem, OutputItem>>[] = data.items.map(async (item) =>
|
|
36
|
+
limit(async () => {
|
|
37
|
+
return await data
|
|
38
38
|
.processAsync(item, logSpinner)
|
|
39
39
|
.then<OutputItem | "404">((output) => {
|
|
40
40
|
const itemInfo = data.itemInfo(item);
|