contentful-migration 4.8.1 → 4.9.2

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 (91) hide show
  1. package/CHANGELOG.md +1 -6
  2. package/README.md +237 -140
  3. package/built/lib/action/content-type-annotate.js +27 -0
  4. package/built/lib/action/content-type-annotate.js.map +1 -0
  5. package/built/lib/action/editor-layout/editor-layout-change-field-group-control.js +23 -0
  6. package/built/lib/action/editor-layout/editor-layout-change-field-group-control.js.map +1 -0
  7. package/built/lib/action/editor-layout/editor-layout-create-field-group.js +26 -0
  8. package/built/lib/action/editor-layout/editor-layout-create-field-group.js.map +1 -0
  9. package/built/lib/action/editor-layout/editor-layout-create.js +18 -0
  10. package/built/lib/action/editor-layout/editor-layout-create.js.map +1 -0
  11. package/built/lib/action/editor-layout/editor-layout-delete-field-group.js +23 -0
  12. package/built/lib/action/editor-layout/editor-layout-delete-field-group.js.map +1 -0
  13. package/built/lib/action/editor-layout/editor-layout-delete.js +21 -0
  14. package/built/lib/action/editor-layout/editor-layout-delete.js.map +1 -0
  15. package/built/lib/action/editor-layout/editor-layout-move-field.js +24 -0
  16. package/built/lib/action/editor-layout/editor-layout-move-field.js.map +1 -0
  17. package/built/lib/action/editor-layout/editor-layout-update-field-group.js +41 -0
  18. package/built/lib/action/editor-layout/editor-layout-update-field-group.js.map +1 -0
  19. package/built/lib/action/field-annotate.js +28 -0
  20. package/built/lib/action/field-annotate.js.map +1 -0
  21. package/built/lib/action/field-rename.js +4 -0
  22. package/built/lib/action/field-rename.js.map +1 -1
  23. package/built/lib/entities/content-type.js +239 -11
  24. package/built/lib/entities/content-type.js.map +1 -1
  25. package/built/lib/fetcher.js +2 -1
  26. package/built/lib/fetcher.js.map +1 -1
  27. package/built/lib/intent/base-intent.js +47 -0
  28. package/built/lib/intent/base-intent.js.map +1 -1
  29. package/built/lib/intent/composed-intent.js +51 -1
  30. package/built/lib/intent/composed-intent.js.map +1 -1
  31. package/built/lib/intent/content-type-annotate.js +57 -0
  32. package/built/lib/intent/content-type-annotate.js.map +1 -0
  33. package/built/lib/intent/editor-layout/editor-layout-change-field-group-control.js +57 -0
  34. package/built/lib/intent/editor-layout/editor-layout-change-field-group-control.js.map +1 -0
  35. package/built/lib/intent/editor-layout/editor-layout-change-field-group-id.js +59 -0
  36. package/built/lib/intent/editor-layout/editor-layout-change-field-group-id.js.map +1 -0
  37. package/built/lib/intent/editor-layout/editor-layout-create-field-group.js +54 -0
  38. package/built/lib/intent/editor-layout/editor-layout-create-field-group.js.map +1 -0
  39. package/built/lib/intent/editor-layout/editor-layout-create.js +49 -0
  40. package/built/lib/intent/editor-layout/editor-layout-create.js.map +1 -0
  41. package/built/lib/intent/editor-layout/editor-layout-delete-field-group.js +53 -0
  42. package/built/lib/intent/editor-layout/editor-layout-delete-field-group.js.map +1 -0
  43. package/built/lib/intent/editor-layout/editor-layout-delete.js +45 -0
  44. package/built/lib/intent/editor-layout/editor-layout-delete.js.map +1 -0
  45. package/built/lib/intent/editor-layout/editor-layout-invalid-method.js +38 -0
  46. package/built/lib/intent/editor-layout/editor-layout-invalid-method.js.map +1 -0
  47. package/built/lib/intent/editor-layout/editor-layout-move-field.js +81 -0
  48. package/built/lib/intent/editor-layout/editor-layout-move-field.js.map +1 -0
  49. package/built/lib/intent/editor-layout/editor-layout-update-field-group.js +57 -0
  50. package/built/lib/intent/editor-layout/editor-layout-update-field-group.js.map +1 -0
  51. package/built/lib/intent/field-annotate.js +57 -0
  52. package/built/lib/intent/field-annotate.js.map +1 -0
  53. package/built/lib/intent/index.js +23 -1
  54. package/built/lib/intent/index.js.map +1 -1
  55. package/built/lib/intent-list/index.js +4 -0
  56. package/built/lib/intent-list/index.js.map +1 -1
  57. package/built/lib/interfaces/annotation.js +86 -0
  58. package/built/lib/interfaces/annotation.js.map +1 -0
  59. package/built/lib/migration-chunks/validation/editor-layout.js +305 -0
  60. package/built/lib/migration-chunks/validation/editor-layout.js.map +1 -0
  61. package/built/lib/migration-chunks/validation/errors.js +91 -0
  62. package/built/lib/migration-chunks/validation/errors.js.map +1 -1
  63. package/built/lib/migration-chunks/validation/field.js +24 -23
  64. package/built/lib/migration-chunks/validation/field.js.map +1 -1
  65. package/built/lib/migration-chunks/validation/index.js +16 -3
  66. package/built/lib/migration-chunks/validation/index.js.map +1 -1
  67. package/built/lib/migration-parser.js +1 -1
  68. package/built/lib/migration-parser.js.map +1 -1
  69. package/built/lib/migration-steps/action-creators.js +164 -0
  70. package/built/lib/migration-steps/action-creators.js.map +1 -1
  71. package/built/lib/migration-steps/index.js +111 -3
  72. package/built/lib/migration-steps/index.js.map +1 -1
  73. package/built/lib/offline-api/index.js +13 -4
  74. package/built/lib/offline-api/index.js.map +1 -1
  75. package/built/lib/offline-api/validator/annotations.js +76 -0
  76. package/built/lib/offline-api/validator/annotations.js.map +1 -0
  77. package/built/lib/offline-api/validator/editor-interface.js +16 -0
  78. package/built/lib/offline-api/validator/editor-interface.js.map +1 -0
  79. package/built/lib/offline-api/validator/errors.js +21 -0
  80. package/built/lib/offline-api/validator/errors.js.map +1 -1
  81. package/built/lib/offline-api/validator/field-groups-count.js +34 -0
  82. package/built/lib/offline-api/validator/field-groups-count.js.map +1 -0
  83. package/built/lib/offline-api/validator/schema/editor-layout-schema.js +46 -0
  84. package/built/lib/offline-api/validator/schema/editor-layout-schema.js.map +1 -0
  85. package/built/lib/offline-api/validator/schema/schema-validation.js +42 -1
  86. package/built/lib/offline-api/validator/schema/schema-validation.js.map +1 -1
  87. package/built/lib/utils/editor-layout.js +60 -0
  88. package/built/lib/utils/editor-layout.js.map +1 -0
  89. package/docs/validation.md +104 -0
  90. package/index.d.ts +87 -0
  91. package/package.json +3 -3
package/index.d.ts CHANGED
@@ -19,6 +19,15 @@ export interface Movement {
19
19
  afterField(field: string): void
20
20
  }
21
21
 
22
+ export interface EditorLayoutMovement {
23
+ toTheTopOfFieldGroup(groupId?: string): void
24
+ toTheBottomOfFieldGroup(groupId?: string): void
25
+ beforeField(field: string): void
26
+ afterField(field: string): void
27
+ beforeFieldGroup(groupId?: string): void
28
+ afterFieldGroup(groupId?: string): void
29
+ }
30
+
22
31
  type FieldType =
23
32
  | 'Symbol'
24
33
  | 'Text'
@@ -91,6 +100,12 @@ export interface Field {
91
100
 
92
101
  /** Sets the default value for the field. */
93
102
  defaultValue(defaultValue: { [locale: string]: any }): Field
103
+
104
+ /** Set annotations associated with the field */
105
+ setAnnotations(annotationsIds: string[]): Field
106
+
107
+ /** Removes all annotaions associated with the field */
108
+ clearAnnotations(): Field
94
109
  }
95
110
 
96
111
  type LinkMimetype =
@@ -167,6 +182,11 @@ export interface ISidebarWidgetSettings {
167
182
  [setting: string]: WidgetSettingsValue
168
183
  }
169
184
 
185
+ export interface IFieldGroupWidgetSettings {
186
+ /** Instance settings for the field group widget as key-value pairs. */
187
+ [setting: string]: WidgetSettingsValue
188
+ }
189
+
170
190
  export interface ContentType {
171
191
  id: string
172
192
  instanceId: string
@@ -178,6 +198,12 @@ export interface ContentType {
178
198
  /** ID of the field to use as the display field for the content type. */
179
199
  displayField(displayField: string): ContentType
180
200
 
201
+ /** Annotations associated with the content type */
202
+ setAnnotations(annotationIds: string[]): ContentType
203
+
204
+ /** Removes all annotaions associated with the field */
205
+ clearAnnotations(): ContentType
206
+
181
207
  /** Creates a field with provided id. */
182
208
  createField(id: string, init?: IFieldOptions): Field
183
209
 
@@ -300,6 +326,67 @@ export interface ContentType {
300
326
  * Resets the sidebar of the content type to default
301
327
  */
302
328
  resetSidebarToDefault(): void
329
+
330
+ /**
331
+ * Generates the default editor layout in the editor interface related to this content type.
332
+ */
333
+ createEditorLayout(): EditorLayout
334
+
335
+ /**
336
+ * Returns the editor layout related to this content type.
337
+ */
338
+ editEditorLayout(): EditorLayout
339
+
340
+ /**
341
+ * Removes editor layout and group controls from the editor interface of this content type.
342
+ */
343
+ deleteEditorLayout(): void
344
+ }
345
+
346
+ export interface InitFieldGroupOptions {
347
+ name: string
348
+ }
349
+
350
+ export type FieldGroupUpdateFunction = (groupId: string, init?: InitFieldGroupOptions) => FieldGroup
351
+ export interface FieldGroup {
352
+ name: (name: string) => FieldGroup
353
+ /**
354
+ * Creates a field group nested to this one
355
+ */
356
+ createFieldGroup: FieldGroupUpdateFunction
357
+ }
358
+
359
+ export interface EditorLayout {
360
+ /**
361
+ * Creates a field group at the top level of editor layout
362
+ * A group control is automatically generated
363
+ */
364
+ createFieldGroup: FieldGroupUpdateFunction
365
+ /**
366
+ * Edits a field group
367
+ */
368
+ editFieldGroup: FieldGroupUpdateFunction
369
+ /**
370
+ * Changes the identifier of a field group
371
+ */
372
+ changeFieldGroupId: (currentId: string, newId: string) => void
373
+ /**
374
+ * Removes a field group from the editor layout
375
+ */
376
+ deleteFieldGroup: (groupId: string) => void
377
+ /**
378
+ * Allows movements of a field in the editor layout
379
+ */
380
+ moveField: (fieldId: string) => EditorLayoutMovement
381
+ /**
382
+ * Edits the field group control of a field group
383
+ */
384
+ changeFieldGroupControl: (
385
+ groupId: string,
386
+ widgetNameSpace: 'builtin',
387
+ widgetId: 'fieldset' | 'topLevelTab',
388
+ settings?: IFieldGroupWidgetSettings
389
+ ) => void
303
390
  }
304
391
 
305
392
  export interface IContentTypeOptions {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contentful-migration",
3
- "version": "4.8.1",
3
+ "version": "4.9.2",
4
4
  "description": "Migration tooling for contentful",
5
5
  "author": "Contentful GmbH",
6
6
  "license": "MIT",
@@ -87,7 +87,7 @@
87
87
  "eslint": "^7.7.0",
88
88
  "eslint-config-prettier": "^8.3.0",
89
89
  "eslint-plugin-import": "^2.20.2",
90
- "eslint-plugin-mocha": "^9.0.0",
90
+ "eslint-plugin-mocha": "^10.0.4",
91
91
  "eslint-plugin-node": "^11.1.0",
92
92
  "eslint-plugin-promise": "^6.0.0",
93
93
  "eslint-plugin-standard": "^5.0.0",
@@ -99,7 +99,7 @@
99
99
  "prettier": "^2.5.1",
100
100
  "rewire": "^5.0.0",
101
101
  "rimraf": "^3.0.2",
102
- "semantic-release": "^18.0.0",
102
+ "semantic-release": "^19.0.3",
103
103
  "sinon": "^12.0.0",
104
104
  "sinon-chai": "^3.5.0",
105
105
  "source-map-support": "^0.5.16",