@contentstack/cli-migration 1.10.3 → 1.11.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.
Files changed (183) hide show
  1. package/README.md +2 -2
  2. package/lib/actions/action-list.d.ts +8 -0
  3. package/lib/actions/action-list.js +31 -0
  4. package/lib/actions/action-list.js.map +1 -0
  5. package/lib/actions/index.d.ts +180 -0
  6. package/lib/actions/index.js +207 -0
  7. package/lib/actions/index.js.map +1 -0
  8. package/lib/commands/cm/stacks/migration.d.ts +14 -0
  9. package/lib/commands/cm/stacks/migration.js +274 -0
  10. package/lib/commands/cm/stacks/migration.js.map +1 -0
  11. package/lib/config/api-config.d.ts +13 -0
  12. package/lib/config/api-config.js +19 -0
  13. package/lib/config/api-config.js.map +1 -0
  14. package/lib/config/default-options.d.ts +5 -0
  15. package/lib/config/default-options.js +8 -0
  16. package/lib/config/default-options.js.map +1 -0
  17. package/lib/config/index.d.ts +4 -0
  18. package/lib/config/index.js +11 -0
  19. package/lib/config/index.js.map +1 -0
  20. package/lib/config/master-locale.d.ts +7 -0
  21. package/lib/config/master-locale.js +11 -0
  22. package/lib/config/master-locale.js.map +1 -0
  23. package/lib/modules/base.d.ts +39 -0
  24. package/lib/modules/base.js +84 -0
  25. package/lib/modules/base.js.map +1 -0
  26. package/lib/modules/content-types.d.ts +61 -0
  27. package/lib/modules/content-types.js +173 -0
  28. package/lib/modules/content-types.js.map +1 -0
  29. package/lib/modules/fields.d.ts +179 -0
  30. package/lib/modules/fields.js +292 -0
  31. package/lib/modules/fields.js.map +1 -0
  32. package/lib/modules/index.d.ts +5 -0
  33. package/lib/modules/index.js +13 -0
  34. package/lib/modules/index.js.map +1 -0
  35. package/lib/modules/locale.d.ts +6 -0
  36. package/lib/modules/locale.js +27 -0
  37. package/lib/modules/locale.js.map +1 -0
  38. package/lib/modules/migration.d.ts +50 -0
  39. package/lib/modules/migration.js +109 -0
  40. package/lib/modules/migration.js.map +1 -0
  41. package/lib/modules/parser.d.ts +3 -0
  42. package/lib/modules/parser.js +93 -0
  43. package/lib/modules/parser.js.map +1 -0
  44. package/lib/services/content-types.d.ts +25 -0
  45. package/lib/services/content-types.js +302 -0
  46. package/lib/services/content-types.js.map +1 -0
  47. package/lib/services/index.d.ts +3 -0
  48. package/lib/services/index.js +9 -0
  49. package/lib/services/index.js.map +1 -0
  50. package/lib/services/locales.d.ts +6 -0
  51. package/lib/services/locales.js +68 -0
  52. package/lib/services/locales.js.map +1 -0
  53. package/lib/utils/auto-retry.d.ts +2 -0
  54. package/lib/utils/auto-retry.js +30 -0
  55. package/lib/utils/auto-retry.js.map +1 -0
  56. package/lib/utils/callsite.d.ts +2 -0
  57. package/lib/utils/callsite.js +21 -0
  58. package/lib/utils/callsite.js.map +1 -0
  59. package/lib/utils/constants.d.ts +108 -0
  60. package/lib/utils/constants.js +206 -0
  61. package/lib/utils/constants.js.map +1 -0
  62. package/lib/utils/contentstack-sdk.d.ts +7 -0
  63. package/lib/utils/contentstack-sdk.js +53 -0
  64. package/lib/utils/contentstack-sdk.js.map +1 -0
  65. package/lib/utils/error-helper.d.ts +2 -0
  66. package/lib/utils/error-helper.js +102 -0
  67. package/lib/utils/error-helper.js.map +1 -0
  68. package/lib/utils/fs-helper.d.ts +4 -0
  69. package/lib/utils/fs-helper.js +37 -0
  70. package/lib/utils/fs-helper.js.map +1 -0
  71. package/lib/utils/get-batches.d.ts +2 -0
  72. package/lib/utils/get-batches.js +8 -0
  73. package/lib/utils/get-batches.js.map +1 -0
  74. package/lib/utils/get-config.d.ts +6 -0
  75. package/lib/utils/get-config.js +11 -0
  76. package/lib/utils/get-config.js.map +1 -0
  77. package/lib/utils/group-by.d.ts +1 -0
  78. package/lib/utils/group-by.js +41 -0
  79. package/lib/utils/group-by.js.map +1 -0
  80. package/lib/utils/index.d.ts +18 -0
  81. package/lib/utils/index.js +39 -0
  82. package/lib/utils/index.js.map +1 -0
  83. package/lib/utils/logger.d.ts +4 -0
  84. package/lib/utils/logger.js +68 -0
  85. package/lib/utils/logger.js.map +1 -0
  86. package/lib/utils/map.d.ts +7 -0
  87. package/lib/utils/map.js +40 -0
  88. package/lib/utils/map.js.map +1 -0
  89. package/lib/utils/migration-logger.d.ts +7 -0
  90. package/lib/utils/migration-logger.js +26 -0
  91. package/lib/utils/migration-logger.js.map +1 -0
  92. package/lib/utils/modules.d.ts +2 -0
  93. package/lib/utils/modules.js +118 -0
  94. package/lib/utils/modules.js.map +1 -0
  95. package/lib/utils/object-helper.d.ts +1 -0
  96. package/lib/utils/object-helper.js +12 -0
  97. package/lib/utils/object-helper.js.map +1 -0
  98. package/lib/utils/request.d.ts +9 -0
  99. package/lib/utils/request.js +78 -0
  100. package/lib/utils/request.js.map +1 -0
  101. package/lib/utils/safe-promise.d.ts +2 -0
  102. package/lib/utils/safe-promise.js +6 -0
  103. package/lib/utils/safe-promise.js.map +1 -0
  104. package/lib/utils/schema-helper.d.ts +5 -0
  105. package/lib/utils/schema-helper.js +36 -0
  106. package/lib/utils/schema-helper.js.map +1 -0
  107. package/lib/utils/success-handler.d.ts +2 -0
  108. package/lib/utils/success-handler.js +12 -0
  109. package/lib/utils/success-handler.js.map +1 -0
  110. package/lib/validators/api-error.d.ts +4 -0
  111. package/lib/validators/api-error.js +17 -0
  112. package/lib/validators/api-error.js.map +1 -0
  113. package/lib/validators/base-validator.d.ts +4 -0
  114. package/lib/validators/base-validator.js +34 -0
  115. package/lib/validators/base-validator.js.map +1 -0
  116. package/lib/validators/create-content-type-validator.d.ts +7 -0
  117. package/lib/validators/create-content-type-validator.js +45 -0
  118. package/lib/validators/create-content-type-validator.js.map +1 -0
  119. package/lib/validators/edit-content-type-validator.d.ts +7 -0
  120. package/lib/validators/edit-content-type-validator.js +44 -0
  121. package/lib/validators/edit-content-type-validator.js.map +1 -0
  122. package/lib/validators/field-validator.d.ts +4 -0
  123. package/lib/validators/field-validator.js +17 -0
  124. package/lib/validators/field-validator.js.map +1 -0
  125. package/lib/validators/index.d.ts +8 -0
  126. package/lib/validators/index.js +19 -0
  127. package/lib/validators/index.js.map +1 -0
  128. package/lib/validators/migration-error.d.ts +4 -0
  129. package/lib/validators/migration-error.js +16 -0
  130. package/lib/validators/migration-error.js.map +1 -0
  131. package/lib/validators/schema-validator.d.ts +4 -0
  132. package/lib/validators/schema-validator.js +19 -0
  133. package/lib/validators/schema-validator.js.map +1 -0
  134. package/lib/validators/type-error.d.ts +5 -0
  135. package/lib/validators/type-error.js +18 -0
  136. package/lib/validators/type-error.js.map +1 -0
  137. package/oclif.manifest.json +145 -0
  138. package/package.json +21 -11
  139. package/src/actions/action-list.js +0 -32
  140. package/src/actions/index.js +0 -217
  141. package/src/commands/cm/stacks/migration.js +0 -316
  142. package/src/config/api-config.js +0 -18
  143. package/src/config/default-options.js +0 -7
  144. package/src/config/index.js +0 -7
  145. package/src/config/master-locale.js +0 -10
  146. package/src/modules/base.js +0 -95
  147. package/src/modules/content-types.js +0 -208
  148. package/src/modules/fields.js +0 -339
  149. package/src/modules/index.js +0 -8
  150. package/src/modules/locale.js +0 -33
  151. package/src/modules/migration.js +0 -112
  152. package/src/modules/parser.js +0 -105
  153. package/src/services/content-types.js +0 -317
  154. package/src/services/index.js +0 -6
  155. package/src/services/locales.js +0 -71
  156. package/src/utils/auto-retry.js +0 -32
  157. package/src/utils/callsite.js +0 -23
  158. package/src/utils/constants.js +0 -223
  159. package/src/utils/contentstack-sdk.js +0 -70
  160. package/src/utils/error-helper.js +0 -105
  161. package/src/utils/fs-helper.js +0 -29
  162. package/src/utils/get-batches.js +0 -7
  163. package/src/utils/get-config.js +0 -13
  164. package/src/utils/group-by.js +0 -38
  165. package/src/utils/index.js +0 -21
  166. package/src/utils/logger.js +0 -75
  167. package/src/utils/map.js +0 -40
  168. package/src/utils/migration-logger.js +0 -21
  169. package/src/utils/modules.js +0 -134
  170. package/src/utils/object-helper.js +0 -9
  171. package/src/utils/request.js +0 -95
  172. package/src/utils/safe-promise.js +0 -3
  173. package/src/utils/schema-helper.js +0 -35
  174. package/src/utils/success-handler.js +0 -12
  175. package/src/validators/api-error.js +0 -20
  176. package/src/validators/base-validator.js +0 -39
  177. package/src/validators/create-content-type-validator.js +0 -54
  178. package/src/validators/edit-content-type-validator.js +0 -53
  179. package/src/validators/field-validator.js +0 -21
  180. package/src/validators/index.js +0 -11
  181. package/src/validators/migration-error.js +0 -20
  182. package/src/validators/schema-validator.js +0 -23
  183. package/src/validators/type-error.js +0 -22
package/README.md CHANGED
@@ -21,7 +21,7 @@ $ npm install -g @contentstack/cli-migration
21
21
  $ csdx COMMAND
22
22
  running command...
23
23
  $ csdx (--version)
24
- @contentstack/cli-migration/1.10.3 darwin-arm64 node-v24.13.0
24
+ @contentstack/cli-migration/1.11.0 linux-x64 node-v22.22.0
25
25
  $ csdx --help [COMMAND]
26
26
  USAGE
27
27
  $ csdx COMMAND
@@ -121,7 +121,7 @@ EXAMPLES
121
121
  $ csdx cm:migration --alias --file-path <migration/script/file/path> -k <api-key>
122
122
  ```
123
123
 
124
- _See code: [src/commands/cm/stacks/migration.js](https://github.com/contentstack/cli/blob/main/packages/contentstack-migration/src/commands/cm/stacks/migration.js)_
124
+ _See code: [src/commands/cm/stacks/migration.ts](https://github.com/contentstack/cli/blob/main/packages/contentstack-migration/src/commands/cm/stacks/migration.ts)_
125
125
  <!-- commandsstop -->
126
126
 
127
127
  ### Points to remember
@@ -0,0 +1,8 @@
1
+ export default class ActionList {
2
+ typeErrors?: any;
3
+ actionList?: any[];
4
+ validators: any[];
5
+ constructor(actionList?: any[], typeErrors?: any);
6
+ addValidators(validator: any): void;
7
+ validate(): any[];
8
+ }
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /* eslint-disable no-unused-expressions */
4
+ class ActionList {
5
+ constructor(actionList, typeErrors) {
6
+ typeErrors && (this.typeErrors = typeErrors);
7
+ actionList && (this.actionList = actionList);
8
+ this.validators = [];
9
+ }
10
+ addValidators(validator) {
11
+ this.validators.push(validator);
12
+ }
13
+ validate() {
14
+ const { validators, actionList } = this;
15
+ if (!actionList) {
16
+ return [];
17
+ }
18
+ let errors = [];
19
+ for (const action of actionList) {
20
+ for (const validator of validators) {
21
+ if (validator.isApplicable(action)) {
22
+ errors = validator.validate(action);
23
+ break;
24
+ }
25
+ }
26
+ }
27
+ return errors;
28
+ }
29
+ }
30
+ exports.default = ActionList;
31
+ //# sourceMappingURL=action-list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action-list.js","sourceRoot":"","sources":["../../src/actions/action-list.ts"],"names":[],"mappings":";;AAAA,0CAA0C;AAC1C,MAAqB,UAAU;IAK7B,YAAY,UAAkB,EAAE,UAAgB;QAC9C,UAAU,IAAI,CAAC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,CAAC;QAC7C,UAAU,IAAI,CAAC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,CAAC;QAC7C,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;IACvB,CAAC;IAED,aAAa,CAAC,SAAc;QAC1B,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAClC,CAAC;IAED,QAAQ;QACN,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC;QAExC,IAAI,CAAC,UAAU,EAAE;YACf,OAAO,EAAE,CAAC;SACX;QAED,IAAI,MAAM,GAAU,EAAE,CAAC;QACvB,KAAK,MAAM,MAAM,IAAI,UAAU,EAAE;YAC/B,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE;gBAClC,IAAI,SAAS,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE;oBAClC,MAAM,GAAG,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;oBACpC,MAAM;iBACP;aACF;SACF;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAlCD,6BAkCC","sourcesContent":["/* eslint-disable no-unused-expressions */\nexport default class ActionList {\n typeErrors?: any;\n actionList?: any[];\n validators: any[];\n\n constructor(actionList?: any[], typeErrors?: any) {\n typeErrors && (this.typeErrors = typeErrors);\n actionList && (this.actionList = actionList);\n this.validators = [];\n }\n\n addValidators(validator: any): void {\n this.validators.push(validator);\n }\n\n validate(): any[] {\n const { validators, actionList } = this;\n\n if (!actionList) {\n return [];\n }\n\n let errors: any[] = [];\n for (const action of actionList) {\n for (const validator of validators) {\n if (validator.isApplicable(action)) {\n errors = validator.validate(action);\n break;\n }\n }\n }\n\n return errors;\n }\n}\n"]}
@@ -0,0 +1,180 @@
1
+ export declare const actionCreators: {
2
+ customTasks: (callsite: any, opts: any) => {
3
+ type: string;
4
+ meta: {
5
+ callsite: {
6
+ file: any;
7
+ line: any;
8
+ };
9
+ };
10
+ payload: {
11
+ options: any;
12
+ action: string;
13
+ };
14
+ };
15
+ contentType: {
16
+ create: (callsite: any, id: string, opts: any) => {
17
+ type: string;
18
+ meta: {
19
+ callsite: {
20
+ file: any;
21
+ line: any;
22
+ };
23
+ };
24
+ payload: {
25
+ contentTypeId: string;
26
+ options: any;
27
+ action: string;
28
+ };
29
+ };
30
+ edit: (callsite: any, id: string, opts: any) => {
31
+ type: string;
32
+ meta: {
33
+ callsite: {
34
+ file: any;
35
+ line: any;
36
+ };
37
+ };
38
+ payload: {
39
+ contentTypeId: string;
40
+ options: any;
41
+ action: string;
42
+ };
43
+ };
44
+ transformEntries: (callsite: any, id: string, opts: any) => {
45
+ type: string;
46
+ meta: {
47
+ callsite: {
48
+ file: any;
49
+ line: any;
50
+ };
51
+ };
52
+ payload: {
53
+ options: any;
54
+ };
55
+ };
56
+ deriveLinkedEntries: (callsite: any, id: string, opts: any) => {
57
+ type: string;
58
+ meta: {
59
+ callsite: {
60
+ file: any;
61
+ line: any;
62
+ };
63
+ };
64
+ payload: {
65
+ options: any;
66
+ };
67
+ };
68
+ transformEntriesToType: (callsite: any, id: string, opts: any) => {
69
+ type: string;
70
+ meta: {
71
+ callsite: {
72
+ file: any;
73
+ line: any;
74
+ };
75
+ };
76
+ payload: {
77
+ options: any;
78
+ };
79
+ };
80
+ typeError: (callsite: any, id: string, { typeErrors }: {
81
+ typeErrors: any;
82
+ }) => {
83
+ type: string;
84
+ meta: {
85
+ callsite: {
86
+ file: any;
87
+ line: any;
88
+ };
89
+ };
90
+ payload: {
91
+ typeErrors: any;
92
+ };
93
+ };
94
+ apiError: (callsite: any, id: string, opts: any) => {
95
+ type: string;
96
+ meta: {
97
+ callsite: {
98
+ file: any;
99
+ line: any;
100
+ };
101
+ };
102
+ payload: {
103
+ apiError: any;
104
+ };
105
+ };
106
+ fromFields: (callsite: any, id: string, opts: any) => {
107
+ type: string;
108
+ meta: {
109
+ callsite: {
110
+ file: any;
111
+ line: any;
112
+ };
113
+ };
114
+ payload: {
115
+ fromField: any;
116
+ };
117
+ };
118
+ toFields: (callsite: any, id: string, opts: any) => {
119
+ type: string;
120
+ meta: {
121
+ callsite: {
122
+ file: any;
123
+ line: any;
124
+ };
125
+ };
126
+ payload: {
127
+ toField: any;
128
+ };
129
+ };
130
+ toReferenceFields: (callsite: any, id: string, opts: any) => {
131
+ type: string;
132
+ meta: {
133
+ callsite: {
134
+ file: any;
135
+ line: any;
136
+ };
137
+ };
138
+ payload: {
139
+ toField: any;
140
+ };
141
+ };
142
+ deriveFields: (callsite: any, id: string, opts: any) => {
143
+ type: string;
144
+ meta: {
145
+ callsite: {
146
+ file: any;
147
+ line: any;
148
+ };
149
+ };
150
+ payload: {
151
+ deriveField: any;
152
+ };
153
+ };
154
+ migrationError: (callsite: any, id: string, opts: any) => {
155
+ type: string;
156
+ meta: {
157
+ callsite: {
158
+ file: any;
159
+ line: any;
160
+ };
161
+ };
162
+ payload: {
163
+ migrationError: any;
164
+ };
165
+ };
166
+ field: (callsite: any, id: string, opts: any) => {
167
+ type: string;
168
+ meta: {
169
+ callsite: {
170
+ file: any;
171
+ line: any;
172
+ };
173
+ };
174
+ payload: {
175
+ field: any;
176
+ };
177
+ };
178
+ };
179
+ };
180
+ export { default as ActionList } from './action-list';
@@ -0,0 +1,207 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ActionList = exports.actionCreators = void 0;
7
+ // Utils
8
+ const utils_1 = require("../utils");
9
+ // Properties
10
+ const { actions, validationAction } = utils_1.constants;
11
+ const { create, customTask, edit, transformEntries, deriveLinkedEntries, transformEntriesToType, typeError, apiError, schema, __migrationError, field, } = validationAction;
12
+ exports.actionCreators = {
13
+ customTasks: (callsite, opts) => {
14
+ const { CUSTOM_TASK } = actions;
15
+ return {
16
+ type: customTask,
17
+ meta: {
18
+ callsite: {
19
+ file: callsite.getFileName(),
20
+ line: callsite.getLineNumber(),
21
+ },
22
+ },
23
+ payload: {
24
+ options: opts,
25
+ action: CUSTOM_TASK,
26
+ },
27
+ };
28
+ },
29
+ contentType: {
30
+ create: (callsite, id, opts) => {
31
+ const { CREATE_CT } = actions;
32
+ return {
33
+ type: create,
34
+ meta: {
35
+ callsite: {
36
+ file: callsite.getFileName(),
37
+ line: callsite.getLineNumber(),
38
+ },
39
+ },
40
+ payload: {
41
+ contentTypeId: id,
42
+ options: opts,
43
+ action: CREATE_CT,
44
+ },
45
+ };
46
+ },
47
+ edit: (callsite, id, opts) => {
48
+ const { EDIT_CT } = actions;
49
+ return {
50
+ type: edit,
51
+ meta: {
52
+ callsite: {
53
+ file: callsite.getFileName(),
54
+ line: callsite.getLineNumber(),
55
+ },
56
+ },
57
+ payload: {
58
+ contentTypeId: id,
59
+ options: opts,
60
+ action: EDIT_CT,
61
+ },
62
+ };
63
+ },
64
+ // delete: () => { },
65
+ transformEntries: (callsite, id, opts) => {
66
+ return {
67
+ type: transformEntries,
68
+ meta: {
69
+ callsite: {
70
+ file: callsite.getFileName(),
71
+ line: callsite.getLineNumber(),
72
+ },
73
+ },
74
+ payload: {
75
+ options: opts,
76
+ },
77
+ };
78
+ },
79
+ deriveLinkedEntries: (callsite, id, opts) => {
80
+ return {
81
+ type: deriveLinkedEntries,
82
+ meta: {
83
+ callsite: {
84
+ file: callsite.getFileName(),
85
+ line: callsite.getLineNumber(),
86
+ },
87
+ },
88
+ payload: {
89
+ options: opts,
90
+ },
91
+ };
92
+ },
93
+ transformEntriesToType: (callsite, id, opts) => {
94
+ return {
95
+ type: transformEntriesToType,
96
+ meta: {
97
+ callsite: {
98
+ file: callsite.getFileName(),
99
+ line: callsite.getLineNumber(),
100
+ },
101
+ },
102
+ payload: {
103
+ options: opts,
104
+ },
105
+ };
106
+ },
107
+ typeError: (callsite, id, { typeErrors }) => {
108
+ return {
109
+ type: typeError,
110
+ meta: {
111
+ callsite: {
112
+ file: callsite.getFileName(),
113
+ line: callsite.getLineNumber(),
114
+ },
115
+ },
116
+ payload: { typeErrors },
117
+ };
118
+ },
119
+ apiError: (callsite, id, opts) => {
120
+ return {
121
+ type: apiError,
122
+ meta: {
123
+ callsite: {
124
+ file: callsite.getFileName(),
125
+ line: callsite.getLineNumber(),
126
+ },
127
+ },
128
+ payload: { apiError: opts },
129
+ };
130
+ },
131
+ fromFields: (callsite, id, opts) => {
132
+ return {
133
+ type: schema,
134
+ meta: {
135
+ callsite: {
136
+ file: callsite.getFileName(),
137
+ line: callsite.getLineNumber(),
138
+ },
139
+ },
140
+ payload: { fromField: opts.fromField },
141
+ };
142
+ },
143
+ toFields: (callsite, id, opts) => {
144
+ return {
145
+ type: schema,
146
+ meta: {
147
+ callsite: {
148
+ file: callsite.getFileName(),
149
+ line: callsite.getLineNumber(),
150
+ },
151
+ },
152
+ payload: { toField: opts.toField },
153
+ };
154
+ },
155
+ toReferenceFields: (callsite, id, opts) => {
156
+ return {
157
+ type: schema,
158
+ meta: {
159
+ callsite: {
160
+ file: callsite.getFileName(),
161
+ line: callsite.getLineNumber(),
162
+ },
163
+ },
164
+ payload: { toField: opts.toReferenceField },
165
+ };
166
+ },
167
+ deriveFields: (callsite, id, opts) => {
168
+ return {
169
+ type: schema,
170
+ meta: {
171
+ callsite: {
172
+ file: callsite.getFileName(),
173
+ line: callsite.getLineNumber(),
174
+ },
175
+ },
176
+ payload: { deriveField: opts.deriveField },
177
+ };
178
+ },
179
+ migrationError: (callsite, id, opts) => {
180
+ return {
181
+ type: __migrationError,
182
+ meta: {
183
+ callsite: {
184
+ file: callsite.getFileName(),
185
+ line: callsite.getLineNumber(),
186
+ },
187
+ },
188
+ payload: { migrationError: opts },
189
+ };
190
+ },
191
+ field: (callsite, id, opts) => {
192
+ return {
193
+ type: field,
194
+ meta: {
195
+ callsite: {
196
+ file: callsite.getFileName(),
197
+ line: callsite.getLineNumber(),
198
+ },
199
+ },
200
+ payload: { field: opts },
201
+ };
202
+ },
203
+ },
204
+ };
205
+ var action_list_1 = require("./action-list");
206
+ Object.defineProperty(exports, "ActionList", { enumerable: true, get: function () { return __importDefault(action_list_1).default; } });
207
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/actions/index.ts"],"names":[],"mappings":";;;;;;AAAA,QAAQ;AACR,oCAAqC;AACrC,aAAa;AACb,MAAM,EAAE,OAAO,EAAE,gBAAgB,EAAE,GAAG,iBAAS,CAAC;AAChD,MAAM,EACJ,MAAM,EACN,UAAU,EACV,IAAI,EACJ,gBAAgB,EAChB,mBAAmB,EACnB,sBAAsB,EACtB,SAAS,EACT,QAAQ,EACR,MAAM,EACN,gBAAgB,EAChB,KAAK,GACN,GAAG,gBAAgB,CAAC;AAER,QAAA,cAAc,GAAG;IAC5B,WAAW,EAAE,CAAC,QAAa,EAAE,IAAS,EAAE,EAAE;QACxC,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;QAChC,OAAO;YACL,IAAI,EAAE,UAAU;YAChB,IAAI,EAAE;gBACJ,QAAQ,EAAE;oBACR,IAAI,EAAE,QAAQ,CAAC,WAAW,EAAE;oBAC5B,IAAI,EAAE,QAAQ,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,EAAE;oBACJ,QAAQ,EAAE;wBACR,IAAI,EAAE,QAAQ,CAAC,WAAW,EAAE;wBAC5B,IAAI,EAAE,QAAQ,CAAC,aAAa,EAAE;qBAC/B;iBACF;gBACD,OAAO,EAAE,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE;aAC3C,CAAC;QACJ,CAAC;QACD,cAAc,EAAE,CAAC,QAAa,EAAE,EAAU,EAAE,IAAS,EAAE,EAAE;YACvD,OAAO;gBACL,IAAI,EAAE,gBAAgB;gBACtB,IAAI,EAAE;oBACJ,QAAQ,EAAE;wBACR,IAAI,EAAE,QAAQ,CAAC,WAAW,EAAE;wBAC5B,IAAI,EAAE,QAAQ,CAAC,aAAa,EAAE;qBAC/B;iBACF;gBACD,OAAO,EAAE,EAAE,cAAc,EAAE,IAAI,EAAE;aAClC,CAAC;QACJ,CAAC;QACD,KAAK,EAAE,CAAC,QAAa,EAAE,EAAU,EAAE,IAAS,EAAE,EAAE;YAC9C,OAAO;gBACL,IAAI,EAAE,KAAK;gBACX,IAAI,EAAE;oBACJ,QAAQ,EAAE;wBACR,IAAI,EAAE,QAAQ,CAAC,WAAW,EAAE;wBAC5B,IAAI,EAAE,QAAQ,CAAC,aAAa,EAAE;qBAC/B;iBACF;gBACD,OAAO,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE;aACzB,CAAC;QACJ,CAAC;KACF;CACF,CAAC;AAEF,6CAAsD;AAA7C,0HAAA,OAAO,OAAc","sourcesContent":["// Utils\nimport { constants } from '../utils';\n// Properties\nconst { actions, validationAction } = constants;\nconst {\n create,\n customTask,\n edit,\n transformEntries,\n deriveLinkedEntries,\n transformEntriesToType,\n typeError,\n apiError,\n schema,\n __migrationError,\n field,\n} = validationAction;\n\nexport const actionCreators = {\n customTasks: (callsite: any, opts: any) => {\n const { CUSTOM_TASK } = actions;\n return {\n type: customTask,\n meta: {\n callsite: {\n file: callsite.getFileName(),\n line: callsite.getLineNumber(),\n },\n },\n payload: {\n options: opts,\n action: CUSTOM_TASK,\n },\n };\n },\n contentType: {\n create: (callsite: any, id: string, opts: any) => {\n const { CREATE_CT } = actions;\n return {\n type: create,\n meta: {\n callsite: {\n file: callsite.getFileName(),\n line: callsite.getLineNumber(),\n },\n },\n payload: {\n contentTypeId: id,\n options: opts,\n action: CREATE_CT,\n },\n };\n },\n edit: (callsite: any, id: string, opts: any) => {\n const { EDIT_CT } = actions;\n\n return {\n type: edit,\n meta: {\n callsite: {\n file: callsite.getFileName(),\n line: callsite.getLineNumber(),\n },\n },\n payload: {\n contentTypeId: id,\n options: opts,\n action: EDIT_CT,\n },\n };\n },\n // delete: () => { },\n transformEntries: (callsite: any, id: string, opts: any) => {\n return {\n type: transformEntries,\n meta: {\n callsite: {\n file: callsite.getFileName(),\n line: callsite.getLineNumber(),\n },\n },\n payload: {\n options: opts,\n },\n };\n },\n deriveLinkedEntries: (callsite: any, id: string, opts: any) => {\n return {\n type: deriveLinkedEntries,\n meta: {\n callsite: {\n file: callsite.getFileName(),\n line: callsite.getLineNumber(),\n },\n },\n payload: {\n options: opts,\n },\n };\n },\n transformEntriesToType: (callsite: any, id: string, opts: any) => {\n return {\n type: transformEntriesToType,\n meta: {\n callsite: {\n file: callsite.getFileName(),\n line: callsite.getLineNumber(),\n },\n },\n payload: {\n options: opts,\n },\n };\n },\n typeError: (callsite: any, id: string, { typeErrors }: { typeErrors: any }) => {\n return {\n type: typeError,\n meta: {\n callsite: {\n file: callsite.getFileName(),\n line: callsite.getLineNumber(),\n },\n },\n payload: { typeErrors },\n };\n },\n apiError: (callsite: any, id: string, opts: any) => {\n return {\n type: apiError,\n meta: {\n callsite: {\n file: callsite.getFileName(),\n line: callsite.getLineNumber(),\n },\n },\n payload: { apiError: opts },\n };\n },\n fromFields: (callsite: any, id: string, opts: any) => {\n return {\n type: schema,\n meta: {\n callsite: {\n file: callsite.getFileName(),\n line: callsite.getLineNumber(),\n },\n },\n payload: { fromField: opts.fromField },\n };\n },\n toFields: (callsite: any, id: string, opts: any) => {\n return {\n type: schema,\n meta: {\n callsite: {\n file: callsite.getFileName(),\n line: callsite.getLineNumber(),\n },\n },\n payload: { toField: opts.toField },\n };\n },\n toReferenceFields: (callsite: any, id: string, opts: any) => {\n return {\n type: schema,\n meta: {\n callsite: {\n file: callsite.getFileName(),\n line: callsite.getLineNumber(),\n },\n },\n payload: { toField: opts.toReferenceField },\n };\n },\n deriveFields: (callsite: any, id: string, opts: any) => {\n return {\n type: schema,\n meta: {\n callsite: {\n file: callsite.getFileName(),\n line: callsite.getLineNumber(),\n },\n },\n payload: { deriveField: opts.deriveField },\n };\n },\n migrationError: (callsite: any, id: string, opts: any) => {\n return {\n type: __migrationError,\n meta: {\n callsite: {\n file: callsite.getFileName(),\n line: callsite.getLineNumber(),\n },\n },\n payload: { migrationError: opts },\n };\n },\n field: (callsite: any, id: string, opts: any) => {\n return {\n type: field,\n meta: {\n callsite: {\n file: callsite.getFileName(),\n line: callsite.getLineNumber(),\n },\n },\n payload: { field: opts },\n };\n },\n },\n};\n\nexport { default as ActionList } from './action-list';\n"]}
@@ -0,0 +1,14 @@
1
+ import { Command } from '@contentstack/cli-command';
2
+ import { FlagInput } from '@contentstack/cli-utilities';
3
+ export default class MigrationCommand extends Command {
4
+ static description: string;
5
+ static examples: string[];
6
+ static flags: FlagInput;
7
+ static aliases: string[];
8
+ static usage: string;
9
+ run(): Promise<void>;
10
+ execSingleFile(filePath: string, mapInstance: Map<string, any>): Promise<void>;
11
+ execMultiFiles(filePath: string, mapInstance: Map<string, any>): Promise<void>;
12
+ getTasks(requests: any[]): any[];
13
+ handleErrors(): void;
14
+ }