swoop-common 2.2.3 → 2.2.6

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 (25) hide show
  1. package/README.md +225 -225
  2. package/dist/api/generated/core/exports.d.ts +0 -1
  3. package/dist/api/generated/core/index.d.ts +0 -2
  4. package/dist/api/generated/core/index.js +0 -1
  5. package/dist/api/generated/core/models/SortQueryParam.d.ts +1 -1
  6. package/dist/api/generated/core/models/SwooperPersonalInfo.d.ts +4 -4
  7. package/dist/api/generated/core/services/ComponentService.d.ts +5 -5
  8. package/dist/api/generated/core/services/ComponentService.js +19 -17
  9. package/dist/api/generated/core/services/CoreService.d.ts +25 -34
  10. package/dist/api/generated/core/services/CoreService.js +99 -127
  11. package/dist/api/generated/core/services/ItineraryService.d.ts +2 -2
  12. package/dist/api/generated/core/services/ItineraryService.js +22 -22
  13. package/dist/api/generated/core/services/RegionService.d.ts +4 -4
  14. package/dist/api/generated/core/services/RegionService.js +8 -9
  15. package/dist/api/generated/core/services/SnapshotService.d.ts +9 -7
  16. package/dist/api/generated/core/services/SnapshotService.js +20 -22
  17. package/dist/api/generated/core/services/SwooperService.d.ts +4 -3
  18. package/dist/api/generated/core/services/SwooperService.js +12 -13
  19. package/dist/api/generated/core/services/TemplateService.d.ts +3 -3
  20. package/dist/api/generated/core/services/TemplateService.js +18 -20
  21. package/package.json +60 -60
  22. package/dist/api/generated/core/models/B64StringQueryParam.d.ts +0 -4
  23. package/dist/api/generated/core/models/B64StringQueryParam.js +0 -1
  24. package/dist/api/generated/core/services/AuditService.d.ts +0 -13
  25. package/dist/api/generated/core/services/AuditService.js +0 -28
package/README.md CHANGED
@@ -1,225 +1,225 @@
1
- # Swoop Library
2
-
3
- This library is used for rendering **Swoop itinerary templates**.
4
- It provides tools for defining **custom field types**, registering **custom components**,
5
- rendering templates from a **MasterSchema**, and includes SDKs for all related services.
6
- It supports both input mode (for creating templates) and presentation mode (for rendering them for end users).
7
- The schema system is stage-aware, enabling precise control over what data is editable or displayed at which stage.
8
-
9
- > Note: This package is intended for internal use only.
10
-
11
- ---
12
-
13
- # Swoop Library
14
-
15
- ## Initialization
16
-
17
- Before using the Swoop Library, you must initialize it with service URLs:
18
-
19
- ```ts
20
- import { init } from "swoop-common";
21
-
22
- init({
23
- coreServiceUrl: "https://your.core.service",
24
- swoopServiceForwardUrl: "https://your.forward.service",
25
- });
26
- ```
27
-
28
- ## Service Interfaces
29
-
30
- The library provides three primary service interfaces to interact with backend systems:
31
-
32
- - **SwoopService** — Interfaces with the Swoop API.
33
- - **CoreService** — For core service.
34
-
35
- These interfaces offer convenient methods to work seamlessly with the underlying services required by the itinerary system.
36
-
37
- ## StyledFormView
38
-
39
- The `StyledFormView` component is the entry point for rendering a full itinerary template. It handles schema parsing and renderer injection based on mode and form stage.
40
-
41
- ```tsx
42
- import { StyledFormView } from "your-form-library";
43
-
44
- <StyledFormView
45
- initialData={/* object */}
46
- schema={/* MasterSchema */}
47
- onChange={(val) => console.log(val)}
48
- pool="FORM"
49
- readonly={false}
50
- stage="Inst"
51
- />;
52
- ```
53
-
54
- ### Props
55
-
56
- | Name | Type | Description |
57
- | ----------- | -------------------- | ------------------------------------------------------------------ |
58
- | initialData | `any` | Initial values for the template. Should not be updated frequently. |
59
- | schema | `MasterSchema` | Template definition object. |
60
- | onChange | `(val: any) => void` | Callback with updated data. |
61
- | pool | `ComponentPool` | `"FORM"` or `"PRESENTATION"` depending on context. |
62
- | readonly | `boolean` | Disables inputs if true (only relevant in FORM pool). |
63
- | stage | `Stage` | Controls which data segment is being rendered. |
64
-
65
- ### Stages
66
-
67
- The template system is divided into stages:
68
-
69
- - **Stage.Comp** – Data stored on the root component, often static (e.g. metadata, titles). Does not include any dynamic or time-based fields.
70
- - **Stage.Inst** – Instance-specific data (e.g. timings, localized notes). This is the most common stage for editable fields.
71
- - **Stage.User** – Data unique to individual users (e.g. room number).
72
-
73
- Each stage builds on the one before it. For example, `Stage.User` includes everything from `Stage.Comp` and `Stage.Inst`. Fields are editable based on the current stage. If a value is defined in two stages, the lower stage will take priority.
74
-
75
- ---
76
-
77
- ## Custom Components
78
-
79
- Custom components define how individual fields render. These can behave like typical form inputs or be used for display-only formatting in the `PRESENTATION` pool.
80
-
81
- ### Example
82
-
83
- ```tsx
84
- const FormExample: React.FC<Props> = ({
85
- text,
86
- onChange,
87
- getError,
88
- label,
89
- enabled,
90
- }) => {
91
- const [val, setVal] = useState(text);
92
- const error = getError ? getError("example")?.message : undefined;
93
- const onChangeDebounced = useMemo(() => debounce(onChange, 300), [onChange]);
94
-
95
- const update = (value: string) => {
96
- setVal(value);
97
- onChangeDebounced(value);
98
- };
99
-
100
- return (
101
- <Paper
102
- sx={{
103
- display: "flex",
104
- flexDirection: "column",
105
- gap: 1,
106
- p: 2,
107
- background: "#CBC3E3",
108
- mb: 1,
109
- }}
110
- >
111
- {!enabled && "THIS IS DISABLED"}
112
- <Typography variant="h6">{label}</Typography>
113
- <TextField
114
- label="Example label"
115
- value={val}
116
- onChange={(e) => update(e.target.value)}
117
- error={!!error}
118
- helperText={error}
119
- disabled={!enabled}
120
- />
121
- </Paper>
122
- );
123
- };
124
-
125
- const FormRendererExample: React.FC<ControlProps> = ({
126
- data,
127
- handleChange,
128
- path,
129
- label,
130
- enabled,
131
- }) => {
132
- const getError = useLocalErrors(path);
133
- return (
134
- <FormExample
135
- text={data as string}
136
- onChange={(val) => handleChange(path, val)}
137
- getError={getError}
138
- label={label}
139
- enabled={enabled}
140
- />
141
- );
142
- };
143
-
144
- registerComponent("example", FormRendererExample, ComponentPool.FORM);
145
- registerComponent("example", FormRendererExample, ComponentPool.PRESENTATION);
146
- ```
147
-
148
- > Important: You **cannot register two components with the same name within the same pool**. You _can_ register the same component name across different pools (e.g., `"example"` in both `"FORM"` and `"PRESENTATION"`).
149
-
150
- ### Presentation Pool
151
-
152
- The `PRESENTATION` pool is more than just read-only. It is designed for **customer-facing output**, rendering fields in a clean, non-form-like layout for readability and professionalism.
153
-
154
- ---
155
-
156
- ## Custom Types
157
-
158
- Custom field types define what kinds of fields can be used when **building a template**. These appear in the template builder UI as selectable field types and control how data is validated and configured.
159
-
160
- ### Syntax
161
-
162
- ```ts
163
- registerType(
164
- "typeId", // Unique type string
165
- "Display Name", // Name shown in template builder
166
- schema, // JSON Schema defining the data structure
167
- optionsSchema, // JSON Schema defining configuration data structure
168
- requiredOptions // boolean: must the options be filled?
169
- );
170
- ```
171
-
172
- ### Example
173
-
174
- ```ts
175
- registerType(
176
- "enum",
177
- "Dropdown",
178
- { type: "array" },
179
- {
180
- type: "object",
181
- title: "Dropdown Options",
182
- properties: {
183
- enumValues: {
184
- title: "Dropdown Values",
185
- type: "array",
186
- items: { type: "string" },
187
- },
188
- },
189
- },
190
- true
191
- );
192
- ```
193
-
194
- This type defines a dropdown field where the values are defined via the `enumValues` property in the template configuration.
195
-
196
- ### Custom Option Editors
197
-
198
- If you want to render a **custom options block** (i.e., how the field type's options are displayed in the template editor), you must do the following:
199
-
200
- 1. In the top-level `optionsSchema` of the type, define `"x-type": "yourTypeName"`
201
- 2. Create and register a custom component with the name `"yourTypeName"` in the `"FORM"` pool.
202
-
203
- This component will then be used to render the configuration UI for that field type.
204
-
205
- ---
206
-
207
- ## File Locations
208
-
209
- - **Custom components** must be placed in `src/renderers`. They may be nested within subfolders. All files inside `renderers/` will be automatically imported in the correct order.
210
- - **Custom types** must be added to `src/default_registration/fields_base.tsx`.
211
-
212
- No manual import wiring is required beyond placing the file in the correct folder.
213
-
214
- ---
215
-
216
- ## Publishing to NPM
217
-
218
- To publish a new version of the package:
219
-
220
- ```bash
221
- npm run build # Compile the package
222
- npm version patch # Bump the patch version (or use minor/major as needed)
223
- npm adduser # Log in to NPM (if not already)
224
- npm publish # Publish the package
225
- ```
1
+ .# Swoop Library
2
+
3
+ This library is used for rendering **Swoop itinerary templates**.
4
+ It provides tools for defining **custom field types**, registering **custom components**,
5
+ rendering templates from a **MasterSchema**, and includes SDKs for all related services.
6
+ It supports both input mode (for creating templates) and presentation mode (for rendering them for end users).
7
+ The schema system is stage-aware, enabling precise control over what data is editable or displayed at which stage.
8
+
9
+ > Note: This package is intended for internal use only.
10
+
11
+ ---
12
+
13
+ # Swoop Library
14
+
15
+ ## Initialization
16
+
17
+ Before using the Swoop Library, you must initialize it with service URLs:
18
+
19
+ ```ts
20
+ import { init } from "swoop-common";
21
+
22
+ init({
23
+ coreServiceUrl: "https://your.core.service",
24
+ swoopServiceForwardUrl: "https://your.forward.service",
25
+ });
26
+ ```
27
+
28
+ ## Service Interfaces
29
+
30
+ The library provides three primary service interfaces to interact with backend systems:
31
+
32
+ - **SwoopService** — Interfaces with the Swoop API.
33
+ - **CoreService** — For core service.
34
+
35
+ These interfaces offer convenient methods to work seamlessly with the underlying services required by the itinerary system.
36
+
37
+ ## StyledFormView
38
+
39
+ The `StyledFormView` component is the entry point for rendering a full itinerary template. It handles schema parsing and renderer injection based on mode and form stage.
40
+
41
+ ```tsx
42
+ import { StyledFormView } from "your-form-library";
43
+
44
+ <StyledFormView
45
+ initialData={/* object */}
46
+ schema={/* MasterSchema */}
47
+ onChange={(val) => console.log(val)}
48
+ pool="FORM"
49
+ readonly={false}
50
+ stage="Inst"
51
+ />;
52
+ ```
53
+
54
+ ### Props
55
+
56
+ | Name | Type | Description |
57
+ | ----------- | -------------------- | ------------------------------------------------------------------ |
58
+ | initialData | `any` | Initial values for the template. Should not be updated frequently. |
59
+ | schema | `MasterSchema` | Template definition object. |
60
+ | onChange | `(val: any) => void` | Callback with updated data. |
61
+ | pool | `ComponentPool` | `"FORM"` or `"PRESENTATION"` depending on context. |
62
+ | readonly | `boolean` | Disables inputs if true (only relevant in FORM pool). |
63
+ | stage | `Stage` | Controls which data segment is being rendered. |
64
+
65
+ ### Stages
66
+
67
+ The template system is divided into stages:
68
+
69
+ - **Stage.Comp** – Data stored on the root component, often static (e.g. metadata, titles). Does not include any dynamic or time-based fields.
70
+ - **Stage.Inst** – Instance-specific data (e.g. timings, localized notes). This is the most common stage for editable fields.
71
+ - **Stage.User** – Data unique to individual users (e.g. room number).
72
+
73
+ Each stage builds on the one before it. For example, `Stage.User` includes everything from `Stage.Comp` and `Stage.Inst`. Fields are editable based on the current stage. If a value is defined in two stages, the lower stage will take priority.
74
+
75
+ ---
76
+
77
+ ## Custom Components
78
+
79
+ Custom components define how individual fields render. These can behave like typical form inputs or be used for display-only formatting in the `PRESENTATION` pool.
80
+
81
+ ### Example
82
+
83
+ ```tsx
84
+ const FormExample: React.FC<Props> = ({
85
+ text,
86
+ onChange,
87
+ getError,
88
+ label,
89
+ enabled,
90
+ }) => {
91
+ const [val, setVal] = useState(text);
92
+ const error = getError ? getError("example")?.message : undefined;
93
+ const onChangeDebounced = useMemo(() => debounce(onChange, 300), [onChange]);
94
+
95
+ const update = (value: string) => {
96
+ setVal(value);
97
+ onChangeDebounced(value);
98
+ };
99
+
100
+ return (
101
+ <Paper
102
+ sx={{
103
+ display: "flex",
104
+ flexDirection: "column",
105
+ gap: 1,
106
+ p: 2,
107
+ background: "#CBC3E3",
108
+ mb: 1,
109
+ }}
110
+ >
111
+ {!enabled && "THIS IS DISABLED"}
112
+ <Typography variant="h6">{label}</Typography>
113
+ <TextField
114
+ label="Example label"
115
+ value={val}
116
+ onChange={(e) => update(e.target.value)}
117
+ error={!!error}
118
+ helperText={error}
119
+ disabled={!enabled}
120
+ />
121
+ </Paper>
122
+ );
123
+ };
124
+
125
+ const FormRendererExample: React.FC<ControlProps> = ({
126
+ data,
127
+ handleChange,
128
+ path,
129
+ label,
130
+ enabled,
131
+ }) => {
132
+ const getError = useLocalErrors(path);
133
+ return (
134
+ <FormExample
135
+ text={data as string}
136
+ onChange={(val) => handleChange(path, val)}
137
+ getError={getError}
138
+ label={label}
139
+ enabled={enabled}
140
+ />
141
+ );
142
+ };
143
+
144
+ registerComponent("example", FormRendererExample, ComponentPool.FORM);
145
+ registerComponent("example", FormRendererExample, ComponentPool.PRESENTATION);
146
+ ```
147
+
148
+ > Important: You **cannot register two components with the same name within the same pool**. You _can_ register the same component name across different pools (e.g., `"example"` in both `"FORM"` and `"PRESENTATION"`).
149
+
150
+ ### Presentation Pool
151
+
152
+ The `PRESENTATION` pool is more than just read-only. It is designed for **customer-facing output**, rendering fields in a clean, non-form-like layout for readability and professionalism.
153
+
154
+ ---
155
+
156
+ ## Custom Types
157
+
158
+ Custom field types define what kinds of fields can be used when **building a template**. These appear in the template builder UI as selectable field types and control how data is validated and configured.
159
+
160
+ ### Syntax
161
+
162
+ ```ts
163
+ registerType(
164
+ "typeId", // Unique type string
165
+ "Display Name", // Name shown in template builder
166
+ schema, // JSON Schema defining the data structure
167
+ optionsSchema, // JSON Schema defining configuration data structure
168
+ requiredOptions // boolean: must the options be filled?
169
+ );
170
+ ```
171
+
172
+ ### Example
173
+
174
+ ```ts
175
+ registerType(
176
+ "enum",
177
+ "Dropdown",
178
+ { type: "array" },
179
+ {
180
+ type: "object",
181
+ title: "Dropdown Options",
182
+ properties: {
183
+ enumValues: {
184
+ title: "Dropdown Values",
185
+ type: "array",
186
+ items: { type: "string" },
187
+ },
188
+ },
189
+ },
190
+ true
191
+ );
192
+ ```
193
+
194
+ This type defines a dropdown field where the values are defined via the `enumValues` property in the template configuration.
195
+
196
+ ### Custom Option Editors
197
+
198
+ If you want to render a **custom options block** (i.e., how the field type's options are displayed in the template editor), you must do the following:
199
+
200
+ 1. In the top-level `optionsSchema` of the type, define `"x-type": "yourTypeName"`
201
+ 2. Create and register a custom component with the name `"yourTypeName"` in the `"FORM"` pool.
202
+
203
+ This component will then be used to render the configuration UI for that field type.
204
+
205
+ ---
206
+
207
+ ## File Locations
208
+
209
+ - **Custom components** must be placed in `src/renderers`. They may be nested within subfolders. All files inside `renderers/` will be automatically imported in the correct order.
210
+ - **Custom types** must be added to `src/default_registration/fields_base.tsx`.
211
+
212
+ No manual import wiring is required beyond placing the file in the correct folder.
213
+
214
+ ---
215
+
216
+ ## Publishing to NPM
217
+
218
+ To publish a new version of the package:
219
+
220
+ ```bash
221
+ npm run build # Compile the package
222
+ npm version patch # Bump the patch version (or use minor/major as needed)
223
+ npm adduser # Log in to NPM (if not already)
224
+ npm publish # Publish the package
225
+ ```
@@ -3,7 +3,6 @@ export { CancelablePromise, CancelError } from './index';
3
3
  export type { Amendment } from './index';
4
4
  export type { AssignedPassenger } from './index';
5
5
  export type { AssignedTravellerGroup } from './index';
6
- export type { B64StringQueryParam } from './index';
7
6
  export { BookingStatus } from './index';
8
7
  export type { Branches } from './index';
9
8
  export type { BranchId } from './index';
@@ -5,7 +5,6 @@ export type { OpenAPIConfig } from './core/OpenAPI';
5
5
  export type { Amendment } from './models/Amendment';
6
6
  export type { AssignedPassenger } from './models/AssignedPassenger';
7
7
  export type { AssignedTravellerGroup } from './models/AssignedTravellerGroup';
8
- export type { B64StringQueryParam } from './models/B64StringQueryParam';
9
8
  export { BookingStatus } from './models/BookingStatus';
10
9
  export type { Branches } from './models/Branches';
11
10
  export type { BranchId } from './models/BranchId';
@@ -97,7 +96,6 @@ export { UrgencyCTA } from './models/UrgencyCTA';
97
96
  export type { UserComponentInstanceField } from './models/UserComponentInstanceField';
98
97
  export type { ValidationSchemas } from './models/ValidationSchemas';
99
98
  export type { VersionPathParam } from './models/VersionPathParam';
100
- export { AuditService } from './services/AuditService';
101
99
  export { ComponentService } from './services/ComponentService';
102
100
  export { CoreService } from './services/CoreService';
103
101
  export { ItineraryService } from './services/ItineraryService';
@@ -13,7 +13,6 @@ export { Meals } from './models/Meals';
13
13
  export { OrderQueryParam } from './models/OrderQueryParam';
14
14
  export { OrgId } from './models/OrgId';
15
15
  export { UrgencyCTA } from './models/UrgencyCTA';
16
- export { AuditService } from './services/AuditService';
17
16
  export { ComponentService } from './services/ComponentService';
18
17
  export { CoreService } from './services/CoreService';
19
18
  export { ItineraryService } from './services/ItineraryService';
@@ -1,4 +1,4 @@
1
1
  /**
2
2
  * List of fields to sort by, this requires the order query param
3
3
  */
4
- export type SortQueryParam = any[];
4
+ export type SortQueryParam = Array<string>;
@@ -1,7 +1,7 @@
1
1
  import type { SwooperHighlights } from './SwooperHighlights';
2
2
  export type SwooperPersonalInfo = {
3
- highlights?: SwooperHighlights;
4
- interests?: Array<string>;
5
- dayToDay?: string;
6
- startedInTravel?: number;
3
+ highlights: SwooperHighlights;
4
+ interests: Array<string>;
5
+ dayToDay: string;
6
+ startedInTravel: number;
7
7
  };
@@ -15,12 +15,12 @@ export declare class ComponentService {
15
15
  * @param sort List of fields to sort by, this requires the order query param
16
16
  * @param search The search strings to apply to the on query parameter values
17
17
  * @param on The fields to apply the search to, the list follows the order and length of the search values in the search query
18
- * @returns any The list of all component given the parameters used
18
+ * @returns any Paginated response of components
19
19
  * @throws ApiError
20
20
  */
21
- static componentList(page?: number, limit?: number, order?: 'asc' | 'desc', sort?: any[], search?: Array<string>, on?: Array<string>): CancelablePromise<{
22
- data?: Array<DTOComponentRead>;
21
+ static componentList(page?: number, limit?: number, order?: 'asc' | 'desc', sort?: Array<string>, search?: Array<string>, on?: Array<string>): CancelablePromise<{
23
22
  pagination?: Pagination;
23
+ data?: Array<DTOComponentRead>;
24
24
  }>;
25
25
  /**
26
26
  * Create a Component
@@ -69,8 +69,8 @@ export declare class ComponentService {
69
69
  * Directly update component state. This does not create a new revision
70
70
  * @param componentId Id of a component
71
71
  * @param state The publishing state of the component
72
- * @returns any OK
72
+ * @returns DTOComponentRead When the state was updated successfully
73
73
  * @throws ApiError
74
74
  */
75
- static componentStateUpdate(componentId: ComponentId, state: ComponentState): CancelablePromise<any>;
75
+ static componentStateUpdate(componentId: ComponentId, state: ComponentState): CancelablePromise<DTOComponentRead>;
76
76
  }
@@ -10,7 +10,7 @@ export class ComponentService {
10
10
  * @param sort List of fields to sort by, this requires the order query param
11
11
  * @param search The search strings to apply to the on query parameter values
12
12
  * @param on The fields to apply the search to, the list follows the order and length of the search values in the search query
13
- * @returns any The list of all component given the parameters used
13
+ * @returns any Paginated response of components
14
14
  * @throws ApiError
15
15
  */
16
16
  static componentList(page, limit, order, sort, search, on) {
@@ -26,10 +26,9 @@ export class ComponentService {
26
26
  'on': on,
27
27
  },
28
28
  errors: {
29
- 400: `If the filter options or query parameters contain invalid values`,
30
- 401: `Unauthorized - Missing or invalid Authorization header`,
31
- 403: `Forbidden - The client is authenticated but not authorized to access this resource`,
32
- 500: `When an internal server error occurs when listing all related component`,
29
+ 400: `If the payload is malformed`,
30
+ 401: `When the client is not authorised`,
31
+ 500: `When an unexpected error occurs`,
33
32
  },
34
33
  });
35
34
  }
@@ -69,9 +68,10 @@ export class ComponentService {
69
68
  'componentId': componentId,
70
69
  },
71
70
  errors: {
72
- 401: `Missing or invalid Authorization header`,
73
- 403: `The client is authenticated but not authorized to access this resource`,
74
- 404: `If a resource is not found`,
71
+ 400: `If the payload is malformed`,
72
+ 401: `Unauthorized - Missing or invalid Authorization header`,
73
+ 403: `Forbidden - The client is authenticated but not authorized to access this resource`,
74
+ 404: `If a resource does not exist`,
75
75
  500: `Internal Server Error`,
76
76
  },
77
77
  });
@@ -97,8 +97,8 @@ export class ComponentService {
97
97
  400: `If the payload is malformed`,
98
98
  401: `Unauthorized - Missing or invalid Authorization header`,
99
99
  403: `Forbidden - The client is authenticated but not authorized to access this resource`,
100
- 404: `When the component id to create a new revision from is not found`,
101
- 500: `When an internal server error occurs updating a component as a new revision`,
100
+ 404: `If a resource does not exist`,
101
+ 500: `Internal Server Error`,
102
102
  },
103
103
  });
104
104
  }
@@ -123,8 +123,8 @@ export class ComponentService {
123
123
  400: `If the payload is malformed`,
124
124
  401: `Unauthorized - Missing or invalid Authorization header`,
125
125
  403: `Forbidden - The client is authenticated but not authorized to access this resource`,
126
- 404: `When the component id to update is not found`,
127
- 500: `When an internal server error occurs updating a component`,
126
+ 404: `If a resource does not exist`,
127
+ 500: `Internal Server Error`,
128
128
  },
129
129
  });
130
130
  }
@@ -143,11 +143,11 @@ export class ComponentService {
143
143
  'componentId': componentId,
144
144
  },
145
145
  errors: {
146
- 400: `When the component doesn't exist in the first place, or when a before hook fails before deleting the item`,
146
+ 400: `If the payload is malformed`,
147
147
  401: `Unauthorized - Missing or invalid Authorization header`,
148
148
  403: `Forbidden - The client is authenticated but not authorized to access this resource`,
149
- 404: `Not Found`,
150
- 500: `When the component fails to delete due to an internal server error`,
149
+ 404: `If a resource does not exist`,
150
+ 500: `Internal Server Error`,
151
151
  },
152
152
  });
153
153
  }
@@ -156,7 +156,7 @@ export class ComponentService {
156
156
  * Directly update component state. This does not create a new revision
157
157
  * @param componentId Id of a component
158
158
  * @param state The publishing state of the component
159
- * @returns any OK
159
+ * @returns DTOComponentRead When the state was updated successfully
160
160
  * @throws ApiError
161
161
  */
162
162
  static componentStateUpdate(componentId, state) {
@@ -170,9 +170,11 @@ export class ComponentService {
170
170
  'state': state,
171
171
  },
172
172
  errors: {
173
+ 400: `If the payload is malformed`,
173
174
  401: `Unauthorized - Missing or invalid Authorization header`,
174
175
  403: `Forbidden - The client is authenticated but not authorized to access this resource`,
175
- 404: `Not Found`,
176
+ 404: `If a resource does not exist`,
177
+ 500: `Internal Server Error`,
176
178
  },
177
179
  });
178
180
  }