@kontent-ai/migration-toolkit 1.0.1 → 1.1.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 +1 -1
- package/dist/es2022/core/index.d.ts +1 -0
- package/dist/es2022/core/index.js +1 -0
- package/dist/es2022/core/index.js.map +1 -1
- package/dist/es2022/core/models/migration.models.d.ts +35 -133
- package/dist/es2022/core/models/migration.schema.d.ts +1300 -0
- package/dist/es2022/core/models/migration.schema.js +114 -0
- package/dist/es2022/core/models/migration.schema.js.map +1 -0
- package/dist/es2022/core/utils/confirm.utils.js +3 -3
- package/dist/es2022/core/utils/confirm.utils.js.map +1 -1
- package/dist/es2022/core/utils/error.utils.js +8 -2
- package/dist/es2022/core/utils/error.utils.js.map +1 -1
- package/dist/es2022/core/utils/global.utils.d.ts +4 -1
- package/dist/es2022/core/utils/global.utils.js +1 -3
- package/dist/es2022/core/utils/global.utils.js.map +1 -1
- package/dist/es2022/export/context/export-context-fetcher.js +10 -6
- package/dist/es2022/export/context/export-context-fetcher.js.map +1 -1
- package/dist/es2022/export/export-manager.js +3 -3
- package/dist/es2022/export/export-manager.js.map +1 -1
- package/dist/es2022/import/import-manager.js.map +1 -1
- package/dist/es2022/metadata.js +2 -2
- package/dist/es2022/node/cli/actions/export-action.js +2 -2
- package/dist/es2022/node/cli/actions/export-action.js.map +1 -1
- package/dist/es2022/node/cli/actions/import-action.js +2 -2
- package/dist/es2022/node/cli/actions/import-action.js.map +1 -1
- package/dist/es2022/toolkit/file.js +3 -3
- package/dist/es2022/toolkit/file.js.map +1 -1
- package/dist/es2022/translation/transforms/export-transforms.js.map +1 -1
- package/dist/es2022/zip/zip-transformer.js +9 -6
- package/dist/es2022/zip/zip-transformer.js.map +1 -1
- package/dist/es2022/zip/zip.models.d.ts +1 -1
- package/lib/core/index.ts +1 -0
- package/lib/core/models/migration.models.ts +56 -159
- package/lib/core/models/migration.schema.ts +180 -0
- package/lib/core/utils/confirm.utils.ts +4 -4
- package/lib/core/utils/error.utils.ts +9 -6
- package/lib/core/utils/global.utils.ts +3 -3
- package/lib/export/context/export-context-fetcher.ts +9 -6
- package/lib/export/export-manager.ts +16 -20
- package/lib/import/import-manager.ts +2 -6
- package/lib/metadata.ts +2 -2
- package/lib/node/cli/actions/export-action.ts +2 -2
- package/lib/node/cli/actions/import-action.ts +2 -2
- package/lib/toolkit/file.ts +3 -9
- package/lib/translation/transforms/export-transforms.ts +1 -4
- package/lib/zip/zip-transformer.ts +25 -11
- package/lib/zip/zip.models.ts +1 -1
- package/package.json +10 -9
package/README.md
CHANGED
|
@@ -45,7 +45,7 @@ You may migrate content (items & asset) between Kontent.ai environments. For mig
|
|
|
45
45
|
[Data Ops](https://github.com/kontent-ai/data-ops) instead.
|
|
46
46
|
|
|
47
47
|
> [!CAUTION]
|
|
48
|
-
> **We recommend migrating to test / dev environments first
|
|
48
|
+
> **We recommend migrating to test / dev environments first** to ensure nothing unexpected happens..
|
|
49
49
|
|
|
50
50
|
## Configuration
|
|
51
51
|
|
|
@@ -11,5 +11,6 @@ export * from './utils/management-client-utils.js';
|
|
|
11
11
|
export * from './models/log.models.js';
|
|
12
12
|
export * from './models/core.models.js';
|
|
13
13
|
export * from './models/migration.models.js';
|
|
14
|
+
export * from './models/migration.schema.js';
|
|
14
15
|
export * from './logs/loggers.js';
|
|
15
16
|
export * from './helpers/workflow-helper.js';
|
|
@@ -11,6 +11,7 @@ export * from './utils/management-client-utils.js';
|
|
|
11
11
|
export * from './models/log.models.js';
|
|
12
12
|
export * from './models/core.models.js';
|
|
13
13
|
export * from './models/migration.models.js';
|
|
14
|
+
export * from './models/migration.schema.js';
|
|
14
15
|
export * from './logs/loggers.js';
|
|
15
16
|
export * from './helpers/workflow-helper.js';
|
|
16
17
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wBAAwB,CAAC;AACvC,cAAc,oCAAoC,CAAC;AAEnD,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAE7C,cAAc,mBAAmB,CAAC;AAClC,cAAc,8BAA8B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wBAAwB,CAAC;AACvC,cAAc,oCAAoC,CAAC;AAEnD,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAE7C,cAAc,mBAAmB,CAAC;AAClC,cAAc,8BAA8B,CAAC"}
|
|
@@ -1,136 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export interface MigrationRichTextElementValue {
|
|
4
|
-
value: string;
|
|
5
|
-
components: readonly MigrationComponent[];
|
|
6
|
-
}
|
|
7
|
-
export interface MigrationUrlSlugElementValue {
|
|
8
|
-
value: string | undefined;
|
|
9
|
-
mode: MigrationUrlSlugMode;
|
|
10
|
-
}
|
|
11
|
-
export interface MigrationComponent {
|
|
12
|
-
system: {
|
|
13
|
-
id: string;
|
|
14
|
-
type: MigrationReference;
|
|
15
|
-
};
|
|
16
|
-
elements: MigrationElements;
|
|
17
|
-
}
|
|
18
|
-
export type MigrationElementValue = string | undefined | MigrationReference[] | number | MigrationRichTextElementValue | MigrationUrlSlugElementValue;
|
|
19
|
-
export interface MigrationElement<TElementType extends MigrationElementType = MigrationElementType, TValue extends MigrationElementValue = MigrationElementValue> {
|
|
20
|
-
/**
|
|
21
|
-
* Value of the element
|
|
22
|
-
*/
|
|
23
|
-
readonly value: TValue;
|
|
24
|
-
/**
|
|
25
|
-
* Type of the element
|
|
26
|
-
*/
|
|
27
|
-
readonly type: TElementType;
|
|
28
|
-
}
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { MigrationComponentSchema, MigrationElementTypeSchema, MigrationElementValueSchema, MigrationReferenceSchema, MigrationUrlSlugElementValueSchema, MigrationUrlSlugModeSchema, MigrationRichTextElementValueSchema, MigrationElementSchema, MigrationElementsSchema, MigrationAssetDescriptionSchema, MigrationDataSchema, MigrationAssetSchema, BaseMigrationItemSchema, BaseMigrationItemVersionSchema } from './migration.schema.js';
|
|
29
3
|
export declare namespace MigrationElementModels {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
interface RichTextElement extends MigrationElement<'rich_text', MigrationRichTextElementValue | undefined> {
|
|
35
|
-
}
|
|
36
|
-
interface MultipleChoiceElement extends MigrationElement<'multiple_choice', MigrationReference[] | undefined> {
|
|
37
|
-
}
|
|
38
|
-
interface DateTimeElement extends MigrationElement<'date_time', string | undefined> {
|
|
39
|
-
}
|
|
40
|
-
interface AssetElement extends MigrationElement<'asset', MigrationReference[] | undefined> {
|
|
41
|
-
}
|
|
42
|
-
interface LinkedItemsElement extends MigrationElement<'modular_content', MigrationReference[] | undefined> {
|
|
43
|
-
}
|
|
44
|
-
interface TaxonomyElement extends MigrationElement<'taxonomy', MigrationReference[] | undefined> {
|
|
45
|
-
}
|
|
46
|
-
interface UrlSlugElement extends MigrationElement<'url_slug', MigrationUrlSlugElementValue | undefined> {
|
|
47
|
-
}
|
|
48
|
-
interface CustomElement extends MigrationElement<'custom', string | undefined> {
|
|
49
|
-
}
|
|
50
|
-
interface SubpagesElement extends MigrationElement<'subpages', MigrationReference[] | undefined> {
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
export interface MigrationElements {
|
|
54
|
-
[elementCodename: string]: MigrationElement;
|
|
55
|
-
}
|
|
56
|
-
export interface MigrationItemVersion<TElements extends MigrationElements = MigrationElements> {
|
|
57
|
-
readonly elements: TElements;
|
|
58
|
-
readonly workflow_step: MigrationReference;
|
|
59
|
-
}
|
|
60
|
-
export interface MigrationItem<TElements extends MigrationElements = MigrationElements> {
|
|
61
|
-
readonly system: {
|
|
62
|
-
/**
|
|
63
|
-
* Codename of the content item
|
|
64
|
-
*/
|
|
65
|
-
readonly codename: string;
|
|
66
|
-
/**
|
|
67
|
-
* Name of the content item
|
|
68
|
-
*/
|
|
69
|
-
readonly name: string;
|
|
70
|
-
/**
|
|
71
|
-
* Language of the language variant
|
|
72
|
-
*/
|
|
73
|
-
readonly language: MigrationReference;
|
|
74
|
-
/**
|
|
75
|
-
* Content type of the item
|
|
76
|
-
*/
|
|
77
|
-
readonly type: MigrationReference;
|
|
78
|
-
/**
|
|
79
|
-
* Collection of the item
|
|
80
|
-
*/
|
|
81
|
-
readonly collection: MigrationReference;
|
|
82
|
-
/**
|
|
83
|
-
* Workflow of the item
|
|
84
|
-
*/
|
|
85
|
-
readonly workflow: MigrationReference;
|
|
4
|
+
type MigrationElementDef<TElementType extends MigrationElementType = MigrationElementType, TValue extends MigrationElementValue = MigrationElementValue> = {
|
|
5
|
+
readonly value: TValue;
|
|
6
|
+
readonly type: TElementType;
|
|
86
7
|
};
|
|
8
|
+
export type TextElement = MigrationElementDef<'text', string | undefined>;
|
|
9
|
+
export type NumberElement = MigrationElementDef<'number', number | undefined>;
|
|
10
|
+
export type RichTextElement = MigrationElementDef<'rich_text', MigrationRichTextElementValue | undefined>;
|
|
11
|
+
export type MultipleChoiceElement = MigrationElementDef<'multiple_choice', MigrationReference[] | undefined>;
|
|
12
|
+
export type DateTimeElement = MigrationElementDef<'date_time', string | undefined>;
|
|
13
|
+
export type AssetElement = MigrationElementDef<'asset', MigrationReference[] | undefined>;
|
|
14
|
+
export type LinkedItemsElement = MigrationElementDef<'modular_content', MigrationReference[] | undefined>;
|
|
15
|
+
export type TaxonomyElement = MigrationElementDef<'taxonomy', MigrationReference[] | undefined>;
|
|
16
|
+
export type UrlSlugElement = MigrationElementDef<'url_slug', MigrationUrlSlugElementValue | undefined>;
|
|
17
|
+
export type CustomElement = MigrationElementDef<'custom', string | undefined>;
|
|
18
|
+
export type SubpagesElement = MigrationElementDef<'subpages', MigrationReference[] | undefined>;
|
|
19
|
+
export {};
|
|
20
|
+
}
|
|
21
|
+
export type MigrationReference = z.infer<typeof MigrationReferenceSchema>;
|
|
22
|
+
export type MigrationUrlSlugMode = z.infer<typeof MigrationUrlSlugModeSchema>;
|
|
23
|
+
export type MigrationElementType = z.infer<typeof MigrationElementTypeSchema>;
|
|
24
|
+
export type MigrationUrlSlugElementValue = z.infer<typeof MigrationUrlSlugElementValueSchema>;
|
|
25
|
+
export type MigrationRichTextElementValue = z.infer<typeof MigrationRichTextElementValueSchema>;
|
|
26
|
+
export type MigrationComponent = z.infer<typeof MigrationComponentSchema>;
|
|
27
|
+
export type MigrationElementValue = z.infer<typeof MigrationElementValueSchema>;
|
|
28
|
+
export type MigrationElement = z.infer<typeof MigrationElementSchema>;
|
|
29
|
+
export type MigrationElements = z.infer<typeof MigrationElementsSchema>;
|
|
30
|
+
export type MigrationAssetDescription = z.infer<typeof MigrationAssetDescriptionSchema>;
|
|
31
|
+
export type MigrationAsset = z.infer<typeof MigrationAssetSchema>;
|
|
32
|
+
export type MigrationData = z.infer<typeof MigrationDataSchema>;
|
|
33
|
+
export type MigrationItemVersion<TElements extends MigrationElements = MigrationElements> = z.infer<typeof BaseMigrationItemVersionSchema> & {
|
|
34
|
+
readonly elements: TElements;
|
|
35
|
+
};
|
|
36
|
+
export type MigrationItem<TElements extends MigrationElements = MigrationElements> = z.infer<typeof BaseMigrationItemSchema> & {
|
|
87
37
|
readonly versions: MigrationItemVersion<TElements>[];
|
|
88
|
-
}
|
|
89
|
-
export interface MigrationReference {
|
|
90
|
-
/**
|
|
91
|
-
* Codename of the referenced object
|
|
92
|
-
*/
|
|
93
|
-
readonly codename: string;
|
|
94
|
-
}
|
|
95
|
-
export interface MigrationAssetDescription {
|
|
96
|
-
readonly language: MigrationReference;
|
|
97
|
-
readonly description?: string;
|
|
98
|
-
}
|
|
99
|
-
export interface MigrationAsset {
|
|
100
|
-
/**
|
|
101
|
-
* Codename of the asset
|
|
102
|
-
*/
|
|
103
|
-
readonly codename: string;
|
|
104
|
-
/**
|
|
105
|
-
* Binary data of the asset
|
|
106
|
-
*/
|
|
107
|
-
readonly binaryData: Buffer | Blob;
|
|
108
|
-
/**
|
|
109
|
-
* Filename of the asset, will be used as a filename in Kontent.ai after importing the asset
|
|
110
|
-
*/
|
|
111
|
-
readonly filename: string;
|
|
112
|
-
/**
|
|
113
|
-
* Title of the asset
|
|
114
|
-
*/
|
|
115
|
-
readonly title: string;
|
|
116
|
-
/**
|
|
117
|
-
* Optional
|
|
118
|
-
* Collection of the asset
|
|
119
|
-
*/
|
|
120
|
-
readonly collection?: MigrationReference;
|
|
121
|
-
/**
|
|
122
|
-
* Optional.
|
|
123
|
-
* Descriptions of the assets
|
|
124
|
-
*/
|
|
125
|
-
readonly descriptions?: readonly MigrationAssetDescription[];
|
|
126
|
-
}
|
|
127
|
-
export interface MigrationData {
|
|
128
|
-
/**
|
|
129
|
-
* Array of migration items to process (export / import)
|
|
130
|
-
*/
|
|
131
|
-
readonly items: readonly MigrationItem[];
|
|
132
|
-
/**
|
|
133
|
-
* Array of migration assets to process
|
|
134
|
-
*/
|
|
135
|
-
readonly assets: readonly MigrationAsset[];
|
|
136
|
-
}
|
|
38
|
+
};
|