@contentstack/cli-migration 1.3.14 → 1.4.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
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.
|
|
24
|
+
@contentstack/cli-migration/1.4.0 darwin-arm64 node-v20.8.0
|
|
25
25
|
$ csdx --help [COMMAND]
|
|
26
26
|
USAGE
|
|
27
27
|
$ csdx COMMAND
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentstack/cli-migration",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"author": "@contentstack",
|
|
5
5
|
"bugs": "https://github.com/contentstack/cli/issues",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@contentstack/cli-command": "~1.2.
|
|
8
|
-
"@contentstack/cli-utilities": "~1.5.
|
|
7
|
+
"@contentstack/cli-command": "~1.2.15",
|
|
8
|
+
"@contentstack/cli-utilities": "~1.5.5",
|
|
9
9
|
"async": "^3.2.4",
|
|
10
10
|
"callsites": "^3.1.0",
|
|
11
11
|
"cardinal": "^2.1.1",
|
|
@@ -38,10 +38,12 @@ class ContentType extends Base {
|
|
|
38
38
|
* @param {Object} opts Optional: Content type fields definition
|
|
39
39
|
* @returns {Field} instance of Field
|
|
40
40
|
* @example
|
|
41
|
-
* module.exports = {
|
|
42
|
-
* const blog =
|
|
43
|
-
*
|
|
44
|
-
*
|
|
41
|
+
* module.exports = ({migration}) => {
|
|
42
|
+
* const blog = migration
|
|
43
|
+
* .createContentType('blog')
|
|
44
|
+
* .title('blog title')
|
|
45
|
+
* .description('blog 1')
|
|
46
|
+
* blog.createField('title').display_name('Title').data_type('text').mandatory(true);
|
|
45
47
|
* }
|
|
46
48
|
*/
|
|
47
49
|
createContentType(id, opts = {}) {
|
|
@@ -114,10 +116,8 @@ class ContentType extends Base {
|
|
|
114
116
|
* @param {Object} opts Optional: Content type fields definition
|
|
115
117
|
* @returns {Field} instance of Field
|
|
116
118
|
* @example
|
|
117
|
-
* module.exports = {
|
|
118
|
-
* const blog =
|
|
119
|
-
* title: 'blog'
|
|
120
|
-
* });
|
|
119
|
+
* module.exports = ({migration}) => {
|
|
120
|
+
* const blog = migration.editContentType('blog');
|
|
121
121
|
* blog.description('Changed description');
|
|
122
122
|
* }
|
|
123
123
|
*/
|
package/src/modules/fields.js
CHANGED
|
@@ -16,6 +16,8 @@ const {
|
|
|
16
16
|
field_metadata,
|
|
17
17
|
reference_to,
|
|
18
18
|
actions: _actions,
|
|
19
|
+
taxonomies,
|
|
20
|
+
multiple,
|
|
19
21
|
} = constants;
|
|
20
22
|
|
|
21
23
|
// Base class
|
|
@@ -52,11 +54,24 @@ class Field extends Base {
|
|
|
52
54
|
* module.exports =({ migration })=> {
|
|
53
55
|
* const blog = migration.editContentType('blog');
|
|
54
56
|
*
|
|
55
|
-
* blog.createField('author')
|
|
57
|
+
* blog.createField('author')
|
|
56
58
|
* .display_name('Author')
|
|
57
59
|
* .data_type('text')
|
|
58
60
|
* .mandatory(false);
|
|
59
61
|
* };
|
|
62
|
+
*
|
|
63
|
+
* Create a taxonomy field
|
|
64
|
+
*
|
|
65
|
+
* module.exports =({ migration })=> {
|
|
66
|
+
* const blog = migration.editContentType('blog');
|
|
67
|
+
*
|
|
68
|
+
* blog.createField('taxonomies')
|
|
69
|
+
* .display_name('Taxonomy1')
|
|
70
|
+
* .data_type('taxonomy')
|
|
71
|
+
* .taxonomies([{ "taxonomy_uid": "test_taxonomy1", "max_terms": 2, "mandatory": false}])
|
|
72
|
+
* .multiple(true)
|
|
73
|
+
* .mandatory(false);
|
|
74
|
+
* };
|
|
60
75
|
*/
|
|
61
76
|
createField(field, opts) {
|
|
62
77
|
this.updateContentTypeSchema(field);
|
|
@@ -227,6 +242,26 @@ class Field extends Base {
|
|
|
227
242
|
return this;
|
|
228
243
|
}
|
|
229
244
|
|
|
245
|
+
/**
|
|
246
|
+
* The 'taxonomies' property should contain at least one taxonomy object
|
|
247
|
+
* @param {string | string[]} value list of taxonomies.
|
|
248
|
+
* @returns {Field} current instance of field object to chain further methods.
|
|
249
|
+
*/
|
|
250
|
+
taxonomies(value) {
|
|
251
|
+
this.buildSchema(taxonomies, this.field, value);
|
|
252
|
+
return this;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
*
|
|
257
|
+
* @param {boolean} value set true if field is multiple
|
|
258
|
+
* @returns {Field} current instance of field object to chain further methods.
|
|
259
|
+
*/
|
|
260
|
+
multiple(value) {
|
|
261
|
+
this.buildSchema(multiple, this.field, value);
|
|
262
|
+
return this;
|
|
263
|
+
}
|
|
264
|
+
|
|
230
265
|
/**
|
|
231
266
|
*
|
|
232
267
|
* @param {boolean} value set true if refer to multiple content types
|
package/src/utils/constants.js
CHANGED
|
@@ -21,6 +21,8 @@ exports.unique = 'unique';
|
|
|
21
21
|
exports.display_name = 'display_name';
|
|
22
22
|
exports.reference_to = 'reference_to';
|
|
23
23
|
exports.field_metadata = 'field_metadata';
|
|
24
|
+
exports.taxonomies = 'taxonomies';
|
|
25
|
+
exports.multiple = 'multiple';
|
|
24
26
|
|
|
25
27
|
exports.actions = {
|
|
26
28
|
CUSTOM_TASK: 'CUSTOM_TASK',
|