contentful-management 12.6.0-dev.2 → 12.6.0-dev.4

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 (66) hide show
  1. package/dist/browser/index.js +2257 -1316
  2. package/dist/browser/index.js.map +1 -1
  3. package/dist/browser/index.min.js +1 -1
  4. package/dist/browser/index.min.js.map +1 -1
  5. package/dist/cjs/index.cjs +145 -72
  6. package/dist/cjs/index.cjs.map +1 -1
  7. package/dist/esm/adapters/REST/endpoints/asset.mjs +12 -1
  8. package/dist/esm/adapters/REST/endpoints/asset.mjs.map +1 -1
  9. package/dist/esm/adapters/REST/endpoints/comment.mjs +10 -2
  10. package/dist/esm/adapters/REST/endpoints/comment.mjs.map +1 -1
  11. package/dist/esm/adapters/REST/endpoints/content-type.mjs +9 -1
  12. package/dist/esm/adapters/REST/endpoints/content-type.mjs.map +1 -1
  13. package/dist/esm/adapters/REST/endpoints/entry.mjs +12 -1
  14. package/dist/esm/adapters/REST/endpoints/entry.mjs.map +1 -1
  15. package/dist/esm/adapters/REST/endpoints/fragment.mjs +2 -2
  16. package/dist/esm/adapters/REST/endpoints/task.mjs +28 -1
  17. package/dist/esm/adapters/REST/endpoints/task.mjs.map +1 -1
  18. package/dist/esm/common-types.mjs.map +1 -1
  19. package/dist/esm/entities/ai-action-invocation.mjs.map +1 -1
  20. package/dist/esm/entities/ai-action.mjs.map +1 -1
  21. package/dist/esm/entities/comment.mjs +10 -6
  22. package/dist/esm/entities/comment.mjs.map +1 -1
  23. package/dist/esm/entities/task.mjs +10 -6
  24. package/dist/esm/entities/task.mjs.map +1 -1
  25. package/dist/esm/plain/plain-client.mjs +1 -1
  26. package/dist/types/adapters/REST/endpoints/asset.d.ts +1 -0
  27. package/dist/types/adapters/REST/endpoints/asset.js +12 -1
  28. package/dist/types/adapters/REST/endpoints/asset.js.map +1 -1
  29. package/dist/types/adapters/REST/endpoints/comment.js +10 -2
  30. package/dist/types/adapters/REST/endpoints/comment.js.map +1 -1
  31. package/dist/types/adapters/REST/endpoints/content-type.d.ts +1 -0
  32. package/dist/types/adapters/REST/endpoints/content-type.js +9 -1
  33. package/dist/types/adapters/REST/endpoints/content-type.js.map +1 -1
  34. package/dist/types/adapters/REST/endpoints/entry.d.ts +1 -0
  35. package/dist/types/adapters/REST/endpoints/entry.js +12 -1
  36. package/dist/types/adapters/REST/endpoints/entry.js.map +1 -1
  37. package/dist/types/adapters/REST/endpoints/fragment.d.ts +1 -1
  38. package/dist/types/adapters/REST/endpoints/fragment.js +2 -2
  39. package/dist/types/adapters/REST/endpoints/task.js +28 -1
  40. package/dist/types/adapters/REST/endpoints/task.js.map +1 -1
  41. package/dist/types/common-types.d.ts +25 -8
  42. package/dist/types/common-types.js.map +1 -1
  43. package/dist/types/constants/editor-interface-defaults/controls-defaults.d.ts +1 -1
  44. package/dist/types/entities/ai-action-invocation.d.ts +37 -18
  45. package/dist/types/entities/ai-action-invocation.js.map +1 -1
  46. package/dist/types/entities/ai-action.d.ts +4 -1
  47. package/dist/types/entities/ai-action.js.map +1 -1
  48. package/dist/types/entities/comment.d.ts +4 -6
  49. package/dist/types/entities/comment.js +10 -6
  50. package/dist/types/entities/comment.js.map +1 -1
  51. package/dist/types/entities/component-type.d.ts +2 -5
  52. package/dist/types/entities/data-assembly.d.ts +15 -13
  53. package/dist/types/entities/experience.d.ts +0 -6
  54. package/dist/types/entities/fragment.d.ts +3 -4
  55. package/dist/types/entities/task.d.ts +5 -3
  56. package/dist/types/entities/task.js +10 -6
  57. package/dist/types/entities/task.js.map +1 -1
  58. package/dist/types/entities/template.d.ts +1 -2
  59. package/dist/types/export-types.d.ts +7 -7
  60. package/dist/types/plain/entities/component-type.d.ts +0 -1
  61. package/dist/types/plain/entities/experience.d.ts +0 -1
  62. package/dist/types/plain/entities/fragment.d.ts +6 -7
  63. package/dist/types/plain/entities/task.d.ts +77 -8
  64. package/dist/types/plain/entities/template.d.ts +0 -1
  65. package/dist/types/plain/plain-client.js +1 -1
  66. package/package.json +2 -2
@@ -59,7 +59,6 @@ export type ComponentTypePlainClientAPI = {
59
59
  * viewports: [],
60
60
  * contentProperties: [],
61
61
  * designProperties: [],
62
- * dimensionKeyMap: { designProperties: {} },
63
62
  * });
64
63
  * ```
65
64
  */
@@ -57,7 +57,6 @@ export type ExperiencePlainClientAPI = {
57
57
  * viewports: [],
58
58
  * contentProperties: {},
59
59
  * designProperties: {},
60
- * dimensionKeyMap: { designProperties: {} },
61
60
  * });
62
61
  * ```
63
62
  */
@@ -1,5 +1,5 @@
1
1
  import type { ExoCursorPaginatedCollectionProp, GetFragmentParams, GetSpaceEnvironmentParams } from '../../common-types';
2
- import type { CreateFragmentProps, FragmentProps, FragmentQueryOptions, UpdateFragmentProps } from '../../entities/fragment';
2
+ import type { CreateFragmentProps, FragmentProps, FragmentQueryOptions, UpsertFragmentProps } from '../../entities/fragment';
3
3
  import type { OptionalDefaults } from '../wrappers/wrap';
4
4
  export type FragmentPlainClientAPI = {
5
5
  /**
@@ -56,28 +56,27 @@ export type FragmentPlainClientAPI = {
56
56
  * componentType: { sys: { type: 'Link', linkType: 'ComponentType', id: '<component_type_id>' } },
57
57
  * viewports: [],
58
58
  * designProperties: {},
59
- * dimensionKeyMap: { designProperties: {} },
60
59
  * });
61
60
  * ```
62
61
  */
63
62
  create(params: OptionalDefaults<GetSpaceEnvironmentParams>, data: CreateFragmentProps): Promise<FragmentProps>;
64
63
  /**
65
- * Updates a fragment with PUT
64
+ * Upserts a fragment (creates or updates via PUT)
66
65
  * @param params the space, environment, and fragment IDs
67
- * @param data the fragment data (including sys.version)
68
- * @returns the updated fragment
66
+ * @param data the fragment data to upsert (include sys.version for updates, omit for creates)
67
+ * @returns the upserted fragment
69
68
  * @throws if the request fails, or the space, environment, or fragment is not found
70
69
  * @internal - Experimental endpoint, subject to breaking changes without notice
71
70
  * @example
72
71
  * ```javascript
73
- * const fragment = await client.fragment.update({
72
+ * const fragment = await client.fragment.upsert({
74
73
  * spaceId: '<space_id>',
75
74
  * environmentId: '<environment_id>',
76
75
  * fragmentId: '<fragment_id>',
77
76
  * }, fragmentData);
78
77
  * ```
79
78
  */
80
- update(params: OptionalDefaults<GetFragmentParams>, data: UpdateFragmentProps): Promise<FragmentProps>;
79
+ upsert(params: OptionalDefaults<GetFragmentParams>, data: UpsertFragmentProps): Promise<FragmentProps>;
81
80
  /**
82
81
  * Deletes a fragment
83
82
  * @param params the space, environment, and fragment IDs
@@ -1,11 +1,11 @@
1
1
  import type { RawAxiosRequestHeaders } from 'axios';
2
- import type { GetTaskParams, GetEntryParams, QueryParams, CollectionProp } from '../../common-types';
2
+ import type { GetTaskParams, GetEntryParams, GetTaskParentEntityParams, QueryParams, CollectionProp } from '../../common-types';
3
3
  import type { CreateTaskParams, UpdateTaskParams, DeleteTaskParams, TaskProps, CreateTaskProps, UpdateTaskProps } from '../../entities/task';
4
4
  import type { OptionalDefaults } from '../wrappers/wrap';
5
5
  export type TaskPlainClientAPI = {
6
6
  /** Fetches a task
7
7
  *
8
- * @param params Space ID, Entry ID, Environment ID, and Task ID
8
+ * @param params Space ID, Environment ID, parent entity (or legacy Entry ID), and Task ID
9
9
  * @returns the task
10
10
  * @throws if the request fails or the task is not found
11
11
  * @example
@@ -16,12 +16,20 @@ export type TaskPlainClientAPI = {
16
16
  * environmentId: '<environment_id>',
17
17
  * taskId: '<task_id>',
18
18
  * });
19
+ *
20
+ * const experienceTask = await client.task.get({
21
+ * spaceId: '<space_id>',
22
+ * environmentId: '<environment_id>',
23
+ * parentEntityType: 'Experience',
24
+ * parentEntityId: '<experience_id>',
25
+ * taskId: '<task_id>',
26
+ * });
19
27
  * ```
20
28
  */
21
29
  get(params: OptionalDefaults<GetTaskParams>): Promise<TaskProps>;
22
- /** Fetches all tasks for a given entry
30
+ /** Fetches all tasks for a given parent entity
23
31
  *
24
- * @param params Space ID, Entry ID, Environment ID, and query parameters
32
+ * @param params Space ID, Environment ID, parent entity (or legacy Entry ID), and query parameters
25
33
  * @returns a collection of tasks
26
34
  * @throws if the request fails or the tasks are not found
27
35
  * @example
@@ -34,12 +42,22 @@ export type TaskPlainClientAPI = {
34
42
  * limit: 100,
35
43
  * }
36
44
  * });
45
+ *
46
+ * const experienceTasks = await client.task.getMany({
47
+ * spaceId: '<space_id>',
48
+ * environmentId: '<environment_id>',
49
+ * parentEntityType: 'Experience',
50
+ * parentEntityId: '<experience_id>',
51
+ * query: {
52
+ * limit: 100,
53
+ * }
54
+ * });
37
55
  * ```
38
56
  */
39
- getMany(params: OptionalDefaults<GetEntryParams & QueryParams>): Promise<CollectionProp<TaskProps>>;
57
+ getMany(params: OptionalDefaults<(GetEntryParams | GetTaskParentEntityParams) & QueryParams>): Promise<CollectionProp<TaskProps>>;
40
58
  /** Creates a task
41
59
  *
42
- * @param params Space ID, Entry ID, Environment ID
60
+ * @param params Space ID, Environment ID, and parent entity (or legacy Entry ID)
43
61
  * @param rawData the task to create
44
62
  * @returns the created task
45
63
  * @throws if the request fails or or the payload is malformed
@@ -63,12 +81,32 @@ export type TaskPlainClientAPI = {
63
81
  * }
64
82
  * }
65
83
  * );
84
+ *
85
+ * const fragmentTask = await client.task.create(
86
+ * {
87
+ * spaceId: '<space_id>',
88
+ * environmentId: '<environment_id>',
89
+ * parentEntityType: 'Fragment',
90
+ * parentEntityId: '<fragment_id>',
91
+ * },
92
+ * {
93
+ * body: "Review Translation",
94
+ * status: "active",
95
+ * assignedTo: {
96
+ * sys: {
97
+ * type: "Link",
98
+ * linkType: "User",
99
+ * id: <user_id>
100
+ * }
101
+ * }
102
+ * }
103
+ * );
66
104
  * ```
67
105
  */
68
106
  create(params: OptionalDefaults<CreateTaskParams>, rawData: CreateTaskProps, headers?: RawAxiosRequestHeaders): Promise<TaskProps>;
69
107
  /** Updates a task
70
108
  *
71
- * @param params Space ID, Entry ID, Environment ID, and Task ID
109
+ * @param params Space ID, Environment ID, parent entity (or legacy Entry ID), and Task ID
72
110
  * @param rawData the task update
73
111
  * @returns the updated task
74
112
  * @throws if the request fails, the task is not found, or the payload is malformed
@@ -93,12 +131,33 @@ export type TaskPlainClientAPI = {
93
131
  * }
94
132
  * }
95
133
  * );
134
+ *
135
+ * const templateTask = await client.task.update(
136
+ * {
137
+ * spaceId: '<space_id>',
138
+ * environmentId: '<environment_id>',
139
+ * parentEntityType: 'Template',
140
+ * parentEntityId: '<template_id>',
141
+ * taskId: '<task_id>',
142
+ * },
143
+ * {
144
+ * body: "Review Translation",
145
+ * status: "active",
146
+ * assignedTo: {
147
+ * sys: {
148
+ * type: "Link",
149
+ * linkType: "User",
150
+ * id: <user_id>
151
+ * }
152
+ * }
153
+ * }
154
+ * );
96
155
  * ```
97
156
  */
98
157
  update(params: OptionalDefaults<UpdateTaskParams>, rawData: UpdateTaskProps, headers?: RawAxiosRequestHeaders): Promise<TaskProps>;
99
158
  /** Deletes a task
100
159
  *
101
- * @param params Space ID, Entry ID, Environment ID, and Task ID
160
+ * @param params Space ID, Environment ID, parent entity (or legacy Entry ID), and Task ID
102
161
  * @throws if the request fails or the task is not found
103
162
  * @example
104
163
  * ```javascript
@@ -107,6 +166,16 @@ export type TaskPlainClientAPI = {
107
166
  * entryId: '<entry_id>',
108
167
  * environmentId: '<environment_id>',
109
168
  * taskId: '<task_id>',
169
+ * version: 1,
170
+ * });
171
+ *
172
+ * await client.task.delete({
173
+ * spaceId: '<space_id>',
174
+ * environmentId: '<environment_id>',
175
+ * parentEntityType: 'ComponentType',
176
+ * parentEntityId: '<component_type_id>',
177
+ * taskId: '<task_id>',
178
+ * version: 1,
110
179
  * });
111
180
  * ```
112
181
  */
@@ -56,7 +56,6 @@ export type TemplatePlainClientAPI = {
56
56
  * viewports: [],
57
57
  * contentProperties: [],
58
58
  * designProperties: [],
59
- * dimensionKeyMap: { designProperties: {} },
60
59
  * });
61
60
  * ```
62
61
  */
@@ -602,7 +602,7 @@ const createPlainClient = (makeRequest, defaults) => {
602
602
  getMany: wrap(wrapParams, 'Fragment', 'getMany'),
603
603
  get: wrap(wrapParams, 'Fragment', 'get'),
604
604
  create: wrap(wrapParams, 'Fragment', 'create'),
605
- update: wrap(wrapParams, 'Fragment', 'update'),
605
+ upsert: wrap(wrapParams, 'Fragment', 'upsert'),
606
606
  delete: wrap(wrapParams, 'Fragment', 'delete'),
607
607
  publish: wrap(wrapParams, 'Fragment', 'publish'),
608
608
  unpublish: wrap(wrapParams, 'Fragment', 'unpublish'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contentful-management",
3
- "version": "12.6.0-dev.2",
3
+ "version": "12.6.0-dev.4",
4
4
  "description": "Client for Contentful's Content Management API",
5
5
  "homepage": "https://www.contentful.com/developers/documentation/content-management-api/",
6
6
  "exports": {
@@ -83,7 +83,7 @@
83
83
  "@rollup/plugin-json": "^6.1.0",
84
84
  "@rollup/plugin-node-resolve": "^16.0.3",
85
85
  "@rollup/plugin-replace": "^6.0.3",
86
- "@rollup/plugin-terser": "^0.4.4",
86
+ "@rollup/plugin-terser": "^1.0.0",
87
87
  "@rollup/plugin-typescript": "^12.3.0",
88
88
  "@semantic-release/changelog": "^6.0.3",
89
89
  "@size-limit/file": "^11.1.6",