contentful-management 12.4.0 → 12.6.0-dev.1

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 (70) hide show
  1. package/README.md +3 -3
  2. package/dist/browser/index.js +1081 -742
  3. package/dist/browser/index.js.map +1 -1
  4. package/dist/browser/index.min.js +1 -1
  5. package/dist/browser/index.min.js.map +1 -1
  6. package/dist/cjs/index.cjs +1073 -734
  7. package/dist/cjs/index.cjs.map +1 -1
  8. package/dist/esm/adapters/REST/endpoints/component-type.mjs +43 -3
  9. package/dist/esm/adapters/REST/endpoints/component-type.mjs.map +1 -1
  10. package/dist/esm/adapters/REST/endpoints/data-assembly.mjs +62 -0
  11. package/dist/esm/adapters/REST/endpoints/data-assembly.mjs.map +1 -0
  12. package/dist/esm/adapters/REST/endpoints/experience.mjs +52 -0
  13. package/dist/esm/adapters/REST/endpoints/experience.mjs.map +1 -0
  14. package/dist/esm/adapters/REST/endpoints/fragment.mjs +50 -0
  15. package/dist/esm/adapters/REST/endpoints/fragment.mjs.map +1 -0
  16. package/dist/esm/adapters/REST/endpoints/index.mjs +8 -0
  17. package/dist/esm/adapters/REST/endpoints/index.mjs.map +1 -1
  18. package/dist/esm/adapters/REST/endpoints/space.mjs +4 -2
  19. package/dist/esm/adapters/REST/endpoints/space.mjs.map +1 -1
  20. package/dist/esm/adapters/REST/endpoints/template.mjs +50 -0
  21. package/dist/esm/adapters/REST/endpoints/template.mjs.map +1 -0
  22. package/dist/esm/common-types.mjs.map +1 -1
  23. package/dist/esm/create-contentful-api.mjs +8 -4
  24. package/dist/esm/create-contentful-api.mjs.map +1 -1
  25. package/dist/esm/entities/space.mjs.map +1 -1
  26. package/dist/esm/plain/plain-client.mjs +44 -0
  27. package/dist/esm/plain/plain-client.mjs.map +1 -1
  28. package/dist/types/adapters/REST/endpoints/component-type.d.ts +6 -0
  29. package/dist/types/adapters/REST/endpoints/component-type.js +43 -3
  30. package/dist/types/adapters/REST/endpoints/component-type.js.map +1 -1
  31. package/dist/types/adapters/REST/endpoints/data-assembly.d.ts +10 -0
  32. package/dist/types/adapters/REST/endpoints/data-assembly.js +62 -0
  33. package/dist/types/adapters/REST/endpoints/data-assembly.js.map +1 -0
  34. package/dist/types/adapters/REST/endpoints/experience.d.ts +8 -0
  35. package/dist/types/adapters/REST/endpoints/experience.js +52 -0
  36. package/dist/types/adapters/REST/endpoints/experience.js.map +1 -0
  37. package/dist/types/adapters/REST/endpoints/fragment.d.ts +8 -0
  38. package/dist/types/adapters/REST/endpoints/fragment.js +50 -0
  39. package/dist/types/adapters/REST/endpoints/fragment.js.map +1 -0
  40. package/dist/types/adapters/REST/endpoints/index.d.ts +8 -0
  41. package/dist/types/adapters/REST/endpoints/index.js +8 -0
  42. package/dist/types/adapters/REST/endpoints/index.js.map +1 -1
  43. package/dist/types/adapters/REST/endpoints/space.js +4 -2
  44. package/dist/types/adapters/REST/endpoints/space.js.map +1 -1
  45. package/dist/types/adapters/REST/endpoints/template.d.ts +8 -0
  46. package/dist/types/adapters/REST/endpoints/template.js +50 -0
  47. package/dist/types/adapters/REST/endpoints/template.js.map +1 -0
  48. package/dist/types/common-types.d.ts +338 -9
  49. package/dist/types/common-types.js.map +1 -1
  50. package/dist/types/create-contentful-api.d.ts +4 -4
  51. package/dist/types/create-contentful-api.js +8 -4
  52. package/dist/types/create-contentful-api.js.map +1 -1
  53. package/dist/types/entities/component-type.d.ts +89 -45
  54. package/dist/types/entities/data-assembly.d.ts +119 -0
  55. package/dist/types/entities/experience.d.ts +89 -0
  56. package/dist/types/entities/fragment.d.ts +52 -0
  57. package/dist/types/entities/space.d.ts +23 -0
  58. package/dist/types/entities/space.js.map +1 -1
  59. package/dist/types/entities/template.d.ts +48 -0
  60. package/dist/types/export-types.d.ts +5 -0
  61. package/dist/types/plain/entities/component-type.d.ts +119 -7
  62. package/dist/types/plain/entities/data-assembly.d.ts +178 -0
  63. package/dist/types/plain/entities/experience.d.ts +165 -0
  64. package/dist/types/plain/entities/fragment.d.ts +134 -0
  65. package/dist/types/plain/entities/space.d.ts +10 -4
  66. package/dist/types/plain/entities/template.d.ts +139 -0
  67. package/dist/types/plain/plain-client-types.d.ts +8 -0
  68. package/dist/types/plain/plain-client.js +44 -0
  69. package/dist/types/plain/plain-client.js.map +1 -1
  70. package/package.json +1 -1
@@ -1,13 +1,13 @@
1
- import type { GetSpaceEnvironmentParams, CollectionProp } from '../../common-types';
2
- import type { ComponentTypeQueryOptions, ComponentTypeProps } from '../../entities/component-type';
1
+ import type { GetSpaceEnvironmentParams, GetComponentTypeParams, ExoCursorPaginatedCollectionProp } from '../../common-types';
2
+ import type { ComponentTypeQueryOptions, ComponentTypeProps, CreateComponentTypeProps, UpsertComponentTypeProps } from '../../entities/component-type';
3
3
  import type { OptionalDefaults } from '../wrappers/wrap';
4
4
  export type ComponentTypePlainClientAPI = {
5
5
  /**
6
6
  * Fetches all component types for a space and environment
7
7
  * @param params the space and environment IDs and query parameters
8
- * @param params.query.experienceCtId the experience component type ID
9
8
  * @param params.query.limit the maximum number of component types to return
10
- * @param params.query.skip the number of component types to skip
9
+ * @param params.query.pageNext cursor token for the next page
10
+ * @param params.query.pagePrev cursor token for the previous page
11
11
  * @returns a collection of component types
12
12
  * @throws if the request fails, or the space, environment, or experience component type is not found
13
13
  * @internal - Experimental endpoint, subject to breaking changes without notice
@@ -17,14 +17,126 @@ export type ComponentTypePlainClientAPI = {
17
17
  * spaceId: '<space_id>',
18
18
  * environmentId: '<environment_id>',
19
19
  * query: {
20
- * _experienceCtId: '<experience_ct_id>',
21
20
  * limit: 10,
22
- * skip: 0,
23
21
  * },
24
22
  * });
25
23
  * ```
26
24
  */
27
25
  getMany(params: OptionalDefaults<GetSpaceEnvironmentParams & {
28
26
  query: ComponentTypeQueryOptions;
29
- }>): Promise<CollectionProp<ComponentTypeProps>>;
27
+ }>): Promise<ExoCursorPaginatedCollectionProp<ComponentTypeProps>>;
28
+ /**
29
+ * Fetches a single component type by ID
30
+ * @param params the space, environment, and component type IDs
31
+ * @returns the component type
32
+ * @throws if the request fails, or the space, environment, or component type is not found
33
+ * @internal - Experimental endpoint, subject to breaking changes without notice
34
+ * @example
35
+ * ```javascript
36
+ * const componentType = await client.componentType.get({
37
+ * spaceId: '<space_id>',
38
+ * environmentId: '<environment_id>',
39
+ * componentTypeId: '<component_id>',
40
+ * });
41
+ * ```
42
+ */
43
+ get(params: OptionalDefaults<GetComponentTypeParams>): Promise<ComponentTypeProps>;
44
+ /**
45
+ * Creates a new component type
46
+ * @param params the space and environment IDs
47
+ * @param rawData the component type data to create
48
+ * @returns the created component type
49
+ * @throws if the request fails
50
+ * @internal - Experimental endpoint, subject to breaking changes without notice
51
+ * @example
52
+ * ```javascript
53
+ * const componentType = await client.componentType.create({
54
+ * spaceId: '<space_id>',
55
+ * environmentId: '<environment_id>',
56
+ * }, {
57
+ * name: 'My Component',
58
+ * description: 'A new component type',
59
+ * viewports: [],
60
+ * contentProperties: [],
61
+ * designProperties: [],
62
+ * dimensionKeyMap: { designProperties: {} },
63
+ * });
64
+ * ```
65
+ */
66
+ create(params: OptionalDefaults<GetSpaceEnvironmentParams>, rawData: CreateComponentTypeProps): Promise<ComponentTypeProps>;
67
+ /**
68
+ * Upserts a component type (creates or updates via PUT)
69
+ * @param params the space, environment, and component type IDs
70
+ * @param rawData the component type data to upsert (include sys.version for updates, omit for creates)
71
+ * @returns the upserted component type
72
+ * @throws if the request fails
73
+ * @internal - Experimental endpoint, subject to breaking changes without notice
74
+ * @example
75
+ * ```javascript
76
+ * const current = await client.componentType.get({ componentTypeId: '<component_id>' });
77
+ * const updated = await client.componentType.upsert({
78
+ * spaceId: '<space_id>',
79
+ * environmentId: '<environment_id>',
80
+ * componentTypeId: '<component_id>',
81
+ * }, {
82
+ * sys: { id: current.sys.id, type: 'ComponentType', version: current.sys.version },
83
+ * name: 'Updated Component',
84
+ * ...otherFields,
85
+ * });
86
+ * ```
87
+ */
88
+ upsert(params: OptionalDefaults<GetComponentTypeParams>, rawData: UpsertComponentTypeProps): Promise<ComponentTypeProps>;
89
+ /**
90
+ * Deletes a single component type
91
+ * @param params the space, environment, and component type IDs
92
+ * @throws if the request fails, or the component type is not found
93
+ * @internal - Experimental endpoint, subject to breaking changes without notice
94
+ * @example
95
+ * ```javascript
96
+ * await client.componentType.delete({
97
+ * spaceId: '<space_id>',
98
+ * environmentId: '<environment_id>',
99
+ * componentTypeId: '<component_id>',
100
+ * });
101
+ * ```
102
+ */
103
+ delete(params: OptionalDefaults<GetComponentTypeParams>): Promise<void>;
104
+ /**
105
+ * Publishes a component type
106
+ * @param params the space, environment, and component type IDs, and the version number
107
+ * @returns the published component type
108
+ * @throws if the request fails, or the component type is not found
109
+ * @internal - Experimental endpoint, subject to breaking changes without notice
110
+ * @example
111
+ * ```javascript
112
+ * const componentType = await client.componentType.publish({
113
+ * spaceId: '<space_id>',
114
+ * environmentId: '<environment_id>',
115
+ * componentTypeId: '<component_type_id>',
116
+ * version: <version>,
117
+ * });
118
+ * ```
119
+ */
120
+ publish(params: OptionalDefaults<GetComponentTypeParams & {
121
+ version: number;
122
+ }>): Promise<ComponentTypeProps>;
123
+ /**
124
+ * Unpublishes a component type
125
+ * @param params the space, environment, and component type IDs, and the version number
126
+ * @returns the unpublished component type
127
+ * @throws if the request fails, or the component type is not found
128
+ * @internal - Experimental endpoint, subject to breaking changes without notice
129
+ * @example
130
+ * ```javascript
131
+ * const componentType = await client.componentType.unpublish({
132
+ * spaceId: '<space_id>',
133
+ * environmentId: '<environment_id>',
134
+ * componentTypeId: '<component_type_id>',
135
+ * version: <version>,
136
+ * });
137
+ * ```
138
+ */
139
+ unpublish(params: OptionalDefaults<GetComponentTypeParams & {
140
+ version: number;
141
+ }>): Promise<ComponentTypeProps>;
30
142
  };
@@ -0,0 +1,178 @@
1
+ import type { RawAxiosRequestHeaders } from 'axios';
2
+ import type { GetDataAssemblyParams, GetSpaceEnvironmentParams } from '../../common-types';
3
+ import type { CreateDataAssemblyProps, DataAssemblyProps, DataAssemblyQueryOptions, UpdateDataAssemblyProps, DataAssemblyCollection } from '../../entities/data-assembly';
4
+ import type { OptionalDefaults } from '../wrappers/wrap';
5
+ export type DataAssemblyPlainClientAPI = {
6
+ /**
7
+ * Fetches all data assemblies for a space and environment
8
+ * @param params the space, environment IDs and query options (see {@link DataAssemblyQueryOptions})
9
+ * @returns a collection of data assemblies
10
+ * @throws if the request fails, or the space or environment is not found
11
+ * @internal - Experimental endpoint, subject to breaking changes without notice
12
+ * @example
13
+ * ```javascript
14
+ * const dataAssemblies = await client.dataAssembly.getMany({
15
+ * spaceId: '<space_id>',
16
+ * environmentId: '<environment_id>',
17
+ * query: {
18
+ * limit: 10,
19
+ * },
20
+ * });
21
+ * ```
22
+ */
23
+ getMany(params: OptionalDefaults<GetSpaceEnvironmentParams & {
24
+ query: DataAssemblyQueryOptions;
25
+ }>): Promise<DataAssemblyCollection>;
26
+ /**
27
+ * Fetches a single data assembly by ID
28
+ * @param params the space, environment, and data assembly IDs
29
+ * @returns the data assembly
30
+ * @throws if the request fails, or the data assembly is not found
31
+ * @internal - Experimental endpoint, subject to breaking changes without notice
32
+ * @example
33
+ * ```javascript
34
+ * const dataAssembly = await client.dataAssembly.get({
35
+ * spaceId: '<space_id>',
36
+ * environmentId: '<environment_id>',
37
+ * dataAssemblyId: '<data_assembly_id>',
38
+ * });
39
+ * ```
40
+ */
41
+ get(params: OptionalDefaults<GetDataAssemblyParams>): Promise<DataAssemblyProps>;
42
+ /**
43
+ * Creates a new data assembly
44
+ * @param params the space and environment IDs
45
+ * @param rawData the data assembly data to create
46
+ * @param headers optional custom headers
47
+ * @returns the created data assembly
48
+ * @throws if the request fails
49
+ * @internal - Experimental endpoint, subject to breaking changes without notice
50
+ * @example
51
+ * ```javascript
52
+ * const dataAssembly = await client.dataAssembly.create({
53
+ * spaceId: '<space_id>',
54
+ * environmentId: '<environment_id>',
55
+ * }, {
56
+ * sys: { type: 'DataAssembly', dataType: [] },
57
+ * metadata: { tags: [] },
58
+ * name: 'My Assembly',
59
+ * description: 'A data assembly',
60
+ * parameters: {},
61
+ * resolvers: {},
62
+ * return: {},
63
+ * });
64
+ * ```
65
+ */
66
+ create(params: OptionalDefaults<GetSpaceEnvironmentParams>, rawData: CreateDataAssemblyProps, headers?: RawAxiosRequestHeaders): Promise<DataAssemblyProps>;
67
+ /**
68
+ * Updates a data assembly with PUT
69
+ * @param params the space, environment, and data assembly IDs
70
+ * @param rawData the data assembly data to update (must include sys.version)
71
+ * @param headers optional custom headers
72
+ * @returns the updated data assembly
73
+ * @throws if the request fails, or the data assembly is not found
74
+ * @internal - Experimental endpoint, subject to breaking changes without notice
75
+ * @example
76
+ * ```javascript
77
+ * const updated = await client.dataAssembly.update(
78
+ * {
79
+ * spaceId: '<space_id>',
80
+ * environmentId: '<environment_id>',
81
+ * dataAssemblyId: '<data_assembly_id>',
82
+ * },
83
+ * { ...dataAssembly, name: 'Updated Name' },
84
+ * );
85
+ * ```
86
+ */
87
+ update(params: OptionalDefaults<GetDataAssemblyParams>, rawData: UpdateDataAssemblyProps, headers?: RawAxiosRequestHeaders): Promise<DataAssemblyProps>;
88
+ /**
89
+ * Deletes a data assembly
90
+ * @param params the space, environment, and data assembly IDs
91
+ * @returns void
92
+ * @throws if the request fails, or the data assembly is not found
93
+ * @internal - Experimental endpoint, subject to breaking changes without notice
94
+ * @example
95
+ * ```javascript
96
+ * await client.dataAssembly.delete({
97
+ * spaceId: '<space_id>',
98
+ * environmentId: '<environment_id>',
99
+ * dataAssemblyId: '<data_assembly_id>',
100
+ * });
101
+ * ```
102
+ */
103
+ delete(params: OptionalDefaults<GetDataAssemblyParams>): Promise<void>;
104
+ /**
105
+ * Publishes a data assembly
106
+ * @param params the space, environment, and data assembly IDs, and the version number
107
+ * @returns the published data assembly
108
+ * @throws if the request fails, or the data assembly is not found
109
+ * @internal - Experimental endpoint, subject to breaking changes without notice
110
+ * @example
111
+ * ```javascript
112
+ * const dataAssembly = await client.dataAssembly.publish({
113
+ * spaceId: '<space_id>',
114
+ * environmentId: '<environment_id>',
115
+ * dataAssemblyId: '<data_assembly_id>',
116
+ * version: 1,
117
+ * });
118
+ * ```
119
+ */
120
+ publish(params: OptionalDefaults<GetDataAssemblyParams & {
121
+ version: number;
122
+ }>): Promise<DataAssemblyProps>;
123
+ /**
124
+ * Unpublishes a data assembly
125
+ * @param params the space, environment, and data assembly IDs, and the version number
126
+ * @returns the unpublished data assembly
127
+ * @throws if the request fails, or the data assembly is not found
128
+ * @internal - Experimental endpoint, subject to breaking changes without notice
129
+ * @example
130
+ * ```javascript
131
+ * const dataAssembly = await client.dataAssembly.unpublish({
132
+ * spaceId: '<space_id>',
133
+ * environmentId: '<environment_id>',
134
+ * dataAssemblyId: '<data_assembly_id>',
135
+ * version: 1,
136
+ * });
137
+ * ```
138
+ */
139
+ unpublish(params: OptionalDefaults<GetDataAssemblyParams & {
140
+ version: number;
141
+ }>): Promise<DataAssemblyProps>;
142
+ /**
143
+ * Fetches all published data assemblies for a space and environment
144
+ * @param params the space, environment IDs and query options (see {@link DataAssemblyQueryOptions})
145
+ * @returns a collection of published data assemblies
146
+ * @throws if the request fails, or the space or environment is not found
147
+ * @internal - Experimental endpoint, subject to breaking changes without notice
148
+ * @example
149
+ * ```javascript
150
+ * const dataAssemblies = await client.dataAssembly.getManyPublished({
151
+ * spaceId: '<space_id>',
152
+ * environmentId: '<environment_id>',
153
+ * query: {
154
+ * limit: 10,
155
+ * },
156
+ * });
157
+ * ```
158
+ */
159
+ getManyPublished(params: OptionalDefaults<GetSpaceEnvironmentParams & {
160
+ query: DataAssemblyQueryOptions;
161
+ }>): Promise<DataAssemblyCollection>;
162
+ /**
163
+ * Fetches a single published data assembly by ID
164
+ * @param params the space, environment, and data assembly IDs
165
+ * @returns the published data assembly
166
+ * @throws if the request fails, or the data assembly is not found
167
+ * @internal - Experimental endpoint, subject to breaking changes without notice
168
+ * @example
169
+ * ```javascript
170
+ * const dataAssembly = await client.dataAssembly.getPublished({
171
+ * spaceId: '<space_id>',
172
+ * environmentId: '<environment_id>',
173
+ * dataAssemblyId: '<data_assembly_id>',
174
+ * });
175
+ * ```
176
+ */
177
+ getPublished(params: OptionalDefaults<GetDataAssemblyParams>): Promise<DataAssemblyProps>;
178
+ };
@@ -0,0 +1,165 @@
1
+ import type { ExoCursorPaginatedCollectionProp, GetSpaceEnvironmentParams, GetExperienceParams } from '../../common-types';
2
+ import type { CreateExperienceProps, UpsertExperienceProps, ExperienceLocalePublishPayload, ExperienceProps, ExperienceQueryOptions } from '../../entities/experience';
3
+ import type { OptionalDefaults } from '../wrappers/wrap';
4
+ export type ExperiencePlainClientAPI = {
5
+ /**
6
+ * Fetches all experiences for a space and environment
7
+ * @param params the space, environment IDs and query options (see {@link ExperienceQueryOptions})
8
+ * @returns a collection of experiences
9
+ * @throws if the request fails, or the space or environment is not found
10
+ * @internal - Experimental endpoint, subject to breaking changes without notice
11
+ * @example
12
+ * ```javascript
13
+ * const experiences = await client.experience.getMany({
14
+ * spaceId: '<space_id>',
15
+ * environmentId: '<environment_id>',
16
+ * query: {
17
+ * limit: 10,
18
+ * },
19
+ * });
20
+ * ```
21
+ */
22
+ getMany(params: OptionalDefaults<GetSpaceEnvironmentParams & {
23
+ query: ExperienceQueryOptions;
24
+ }>): Promise<ExoCursorPaginatedCollectionProp<ExperienceProps>>;
25
+ /**
26
+ * Fetches a single experience by ID
27
+ * @param params the space ID, environment ID, and experience ID
28
+ * @returns the experience
29
+ * @throws if the request fails, or the space, environment, or experience is not found
30
+ * @internal - Experimental endpoint, subject to breaking changes without notice
31
+ * @example
32
+ * ```javascript
33
+ * const experience = await client.experience.get({
34
+ * spaceId: '<space_id>',
35
+ * environmentId: '<environment_id>',
36
+ * experienceId: '<experience_id>',
37
+ * });
38
+ * ```
39
+ */
40
+ get(params: OptionalDefaults<GetExperienceParams>): Promise<ExperienceProps>;
41
+ /**
42
+ * Creates a new experience
43
+ * @param params the space ID and environment ID
44
+ * @param rawData the experience data to create
45
+ * @returns the created experience
46
+ * @throws if the request fails
47
+ * @internal - Experimental endpoint, subject to breaking changes without notice
48
+ * @example
49
+ * ```javascript
50
+ * const experience = await client.experience.create({
51
+ * spaceId: '<space_id>',
52
+ * environmentId: '<environment_id>',
53
+ * }, {
54
+ * name: 'My Experience',
55
+ * description: 'A new experience',
56
+ * template: { sys: { type: 'Link', linkType: 'Template', id: '<template_id>' } },
57
+ * viewports: [],
58
+ * contentProperties: {},
59
+ * designProperties: {},
60
+ * dimensionKeyMap: { designProperties: {} },
61
+ * });
62
+ * ```
63
+ */
64
+ create(params: OptionalDefaults<GetSpaceEnvironmentParams>, rawData: CreateExperienceProps): Promise<ExperienceProps>;
65
+ /**
66
+ * Upserts an experience (creates or updates via PUT)
67
+ * @param params the space ID, environment ID, and experience ID
68
+ * @param rawData the experience data to upsert (include sys.version for updates, omit for creates)
69
+ * @returns the upserted experience
70
+ * @throws if the request fails
71
+ * @internal - Experimental endpoint, subject to breaking changes without notice
72
+ * @example
73
+ * ```javascript
74
+ * const current = await client.experience.get({ experienceId: '<experience_id>' });
75
+ * const updated = await client.experience.upsert({
76
+ * spaceId: '<space_id>',
77
+ * environmentId: '<environment_id>',
78
+ * experienceId: '<experience_id>',
79
+ * }, {
80
+ * sys: { id: current.sys.id, type: 'Experience', version: current.sys.version },
81
+ * name: 'Updated Experience',
82
+ * ...otherFields,
83
+ * });
84
+ * ```
85
+ */
86
+ upsert(params: OptionalDefaults<GetExperienceParams>, rawData: UpsertExperienceProps): Promise<ExperienceProps>;
87
+ /**
88
+ * Deletes an experience
89
+ * @param params the space ID, environment ID, and experience ID
90
+ * @returns void
91
+ * @throws if the request fails, or the experience is not found
92
+ * @internal - Experimental endpoint, subject to breaking changes without notice
93
+ * @example
94
+ * ```javascript
95
+ * await client.experience.delete({
96
+ * spaceId: '<space_id>',
97
+ * environmentId: '<environment_id>',
98
+ * experienceId: '<experience_id>',
99
+ * });
100
+ * ```
101
+ */
102
+ delete(params: OptionalDefaults<GetExperienceParams>): Promise<void>;
103
+ /**
104
+ * Publishes an experience, optionally targeting specific locales.
105
+ *
106
+ * When called without a payload, the experience is fully published across all locales.
107
+ * Pass `{ add: ['en-US'] }` to publish specific locales, or `{ remove: ['de-DE'] }`
108
+ * to remove specific locales from an already-published experience.
109
+ * The payload is a union — only `add` or `remove` can be sent per request, not both.
110
+ *
111
+ * @param params the space ID, environment ID, experience ID, and the version number
112
+ * @param payload optional locale-based publish payload
113
+ * @returns the published experience
114
+ * @throws if the request fails, or the experience is not found
115
+ * @internal - Experimental endpoint, subject to breaking changes without notice
116
+ * @example
117
+ * ```javascript
118
+ * // Full publish (all locales)
119
+ * const experience = await client.experience.publish({
120
+ * spaceId: '<space_id>',
121
+ * environmentId: '<environment_id>',
122
+ * experienceId: '<experience_id>',
123
+ * version: 1,
124
+ * });
125
+ *
126
+ * // Publish specific locales
127
+ * const experience = await client.experience.publish({
128
+ * spaceId: '<space_id>',
129
+ * environmentId: '<environment_id>',
130
+ * experienceId: '<experience_id>',
131
+ * version: 1,
132
+ * }, { add: ['en-US', 'de-DE'] });
133
+ *
134
+ * // Remove specific locales from publishing
135
+ * const experience = await client.experience.publish({
136
+ * spaceId: '<space_id>',
137
+ * environmentId: '<environment_id>',
138
+ * experienceId: '<experience_id>',
139
+ * version: 1,
140
+ * }, { remove: ['de-DE'] });
141
+ * ```
142
+ */
143
+ publish(params: OptionalDefaults<GetExperienceParams & {
144
+ version: number;
145
+ }>, payload?: ExperienceLocalePublishPayload): Promise<ExperienceProps>;
146
+ /**
147
+ * Unpublishes an experience
148
+ * @param params the space ID, environment ID, experience ID, and the version number
149
+ * @returns the unpublished experience
150
+ * @throws if the request fails, or the experience is not found
151
+ * @internal - Experimental endpoint, subject to breaking changes without notice
152
+ * @example
153
+ * ```javascript
154
+ * const experience = await client.experience.unpublish({
155
+ * spaceId: '<space_id>',
156
+ * environmentId: '<environment_id>',
157
+ * experienceId: '<experience_id>',
158
+ * version: <version>,
159
+ * });
160
+ * ```
161
+ */
162
+ unpublish(params: OptionalDefaults<GetExperienceParams & {
163
+ version: number;
164
+ }>): Promise<ExperienceProps>;
165
+ };
@@ -0,0 +1,134 @@
1
+ import type { ExoCursorPaginatedCollectionProp, GetFragmentParams, GetSpaceEnvironmentParams } from '../../common-types';
2
+ import type { CreateFragmentProps, FragmentProps, FragmentQueryOptions, UpdateFragmentProps } from '../../entities/fragment';
3
+ import type { OptionalDefaults } from '../wrappers/wrap';
4
+ export type FragmentPlainClientAPI = {
5
+ /**
6
+ * Fetches all fragments for a space and environment
7
+ * @param params the space, environment IDs and query options (see {@link FragmentQueryOptions})
8
+ * @returns a collection of fragments
9
+ * @throws if the request fails, or the space or environment is not found
10
+ * @internal - Experimental endpoint, subject to breaking changes without notice
11
+ * @example
12
+ * ```javascript
13
+ * const fragments = await client.fragment.getMany({
14
+ * spaceId: '<space_id>',
15
+ * environmentId: '<environment_id>',
16
+ * query: {
17
+ * limit: 10,
18
+ * },
19
+ * });
20
+ * ```
21
+ */
22
+ getMany(params: OptionalDefaults<GetSpaceEnvironmentParams & {
23
+ query: FragmentQueryOptions;
24
+ }>): Promise<ExoCursorPaginatedCollectionProp<FragmentProps>>;
25
+ /**
26
+ * Fetches a single fragment by ID
27
+ * @param params the space, environment, and fragment IDs
28
+ * @returns the fragment
29
+ * @throws if the request fails, or the space, environment, or fragment is not found
30
+ * @internal - Experimental endpoint, subject to breaking changes without notice
31
+ * @example
32
+ * ```javascript
33
+ * const fragment = await client.fragment.get({
34
+ * spaceId: '<space_id>',
35
+ * environmentId: '<environment_id>',
36
+ * fragmentId: '<fragment_id>',
37
+ * });
38
+ * ```
39
+ */
40
+ get(params: OptionalDefaults<GetFragmentParams>): Promise<FragmentProps>;
41
+ /**
42
+ * Creates a new fragment
43
+ * @param params the space and environment IDs
44
+ * @param data the fragment data
45
+ * @returns the created fragment
46
+ * @throws if the request fails, or the space or environment is not found
47
+ * @internal - Experimental endpoint, subject to breaking changes without notice
48
+ * @example
49
+ * ```javascript
50
+ * const fragment = await client.fragment.create({
51
+ * spaceId: '<space_id>',
52
+ * environmentId: '<environment_id>',
53
+ * }, {
54
+ * name: 'My Fragment',
55
+ * description: 'A new fragment',
56
+ * componentType: { sys: { type: 'Link', linkType: 'ComponentType', id: '<component_type_id>' } },
57
+ * viewports: [],
58
+ * designProperties: {},
59
+ * dimensionKeyMap: { designProperties: {} },
60
+ * });
61
+ * ```
62
+ */
63
+ create(params: OptionalDefaults<GetSpaceEnvironmentParams>, data: CreateFragmentProps): Promise<FragmentProps>;
64
+ /**
65
+ * Updates a fragment with PUT
66
+ * @param params the space, environment, and fragment IDs
67
+ * @param data the fragment data (including sys.version)
68
+ * @returns the updated fragment
69
+ * @throws if the request fails, or the space, environment, or fragment is not found
70
+ * @internal - Experimental endpoint, subject to breaking changes without notice
71
+ * @example
72
+ * ```javascript
73
+ * const fragment = await client.fragment.update({
74
+ * spaceId: '<space_id>',
75
+ * environmentId: '<environment_id>',
76
+ * fragmentId: '<fragment_id>',
77
+ * }, fragmentData);
78
+ * ```
79
+ */
80
+ update(params: OptionalDefaults<GetFragmentParams>, data: UpdateFragmentProps): Promise<FragmentProps>;
81
+ /**
82
+ * Deletes a fragment
83
+ * @param params the space, environment, and fragment IDs
84
+ * @throws if the request fails, or the space, environment, or fragment is not found
85
+ * @internal - Experimental endpoint, subject to breaking changes without notice
86
+ * @example
87
+ * ```javascript
88
+ * await client.fragment.delete({
89
+ * spaceId: '<space_id>',
90
+ * environmentId: '<environment_id>',
91
+ * fragmentId: '<fragment_id>',
92
+ * });
93
+ * ```
94
+ */
95
+ delete(params: OptionalDefaults<GetFragmentParams>): Promise<void>;
96
+ /**
97
+ * Publishes a fragment
98
+ * @param params the space, environment, and fragment IDs, plus the current version
99
+ * @returns the published fragment
100
+ * @throws if the request fails, or the space, environment, or fragment is not found
101
+ * @internal - Experimental endpoint, subject to breaking changes without notice
102
+ * @example
103
+ * ```javascript
104
+ * const fragment = await client.fragment.publish({
105
+ * spaceId: '<space_id>',
106
+ * environmentId: '<environment_id>',
107
+ * fragmentId: '<fragment_id>',
108
+ * version: 1,
109
+ * });
110
+ * ```
111
+ */
112
+ publish(params: OptionalDefaults<GetFragmentParams & {
113
+ version: number;
114
+ }>): Promise<FragmentProps>;
115
+ /**
116
+ * Unpublishes a fragment
117
+ * @param params the space, environment, and fragment IDs, plus the current version
118
+ * @returns the unpublished fragment
119
+ * @throws if the request fails, or the space, environment, or fragment is not found
120
+ * @internal - Experimental endpoint, subject to breaking changes without notice
121
+ * @example
122
+ * ```javascript
123
+ * const fragment = await client.fragment.unpublish({
124
+ * spaceId: '<space_id>',
125
+ * environmentId: '<environment_id>',
126
+ * fragmentId: '<fragment_id>',
127
+ * version: 2,
128
+ * });
129
+ * ```
130
+ */
131
+ unpublish(params: OptionalDefaults<GetFragmentParams & {
132
+ version: number;
133
+ }>): Promise<FragmentProps>;
134
+ };
@@ -1,7 +1,7 @@
1
1
  import type { RawAxiosRequestHeaders } from 'axios';
2
2
  import type { GetSpaceParams, QueryParams, CollectionProp, CursorPaginatedCollectionProp, BasicCursorPaginationOptions, GetOrganizationParams } from '../../common-types';
3
3
  import type { OptionalDefaults } from '../wrappers/wrap';
4
- import type { SpaceProps } from '../../entities/space';
4
+ import type { SpaceIncludeParam, SpaceIncludes, SpaceProps } from '../../entities/space';
5
5
  export type SpacePlainClientAPI = {
6
6
  /**
7
7
  * Fetches a space
@@ -14,7 +14,9 @@ export type SpacePlainClientAPI = {
14
14
  * });
15
15
  * ```
16
16
  */
17
- get(params: OptionalDefaults<GetSpaceParams>): Promise<SpaceProps>;
17
+ get(params: OptionalDefaults<GetSpaceParams & SpaceIncludeParam>): Promise<SpaceProps & {
18
+ includes?: SpaceIncludes;
19
+ }>;
18
20
  /**
19
21
  * Fetches all the spaces that the logged in user has access to
20
22
  * @param params (optional) filter and pagination query parameters
@@ -31,11 +33,15 @@ export type SpacePlainClientAPI = {
31
33
  getMany(params: OptionalDefaults<{
32
34
  query?: QueryParams['query'];
33
35
  organizationId?: string;
34
- }>): Promise<CollectionProp<SpaceProps>>;
36
+ } & SpaceIncludeParam>): Promise<CollectionProp<SpaceProps> & {
37
+ includes?: SpaceIncludes;
38
+ }>;
35
39
  getMany(params: OptionalDefaults<{
36
40
  query: BasicCursorPaginationOptions;
37
41
  organizationId?: string;
38
- }>): Promise<CursorPaginatedCollectionProp<SpaceProps>>;
42
+ } & SpaceIncludeParam>): Promise<CursorPaginatedCollectionProp<SpaceProps> & {
43
+ includes?: SpaceIncludes;
44
+ }>;
39
45
  /**
40
46
  * Fetches all the spaces in the given organization
41
47
  * @param params the organization ID and query parameters