@snaptrude/plugin-core 0.0.5 → 0.0.7

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 (63) hide show
  1. package/dist/api/core/geom/arc.d.ts +50 -1
  2. package/dist/api/core/geom/arc.d.ts.map +1 -1
  3. package/dist/api/core/geom/curve.d.ts +26 -1
  4. package/dist/api/core/geom/curve.d.ts.map +1 -1
  5. package/dist/api/core/geom/index.d.ts +16 -0
  6. package/dist/api/core/geom/index.d.ts.map +1 -1
  7. package/dist/api/core/geom/line.d.ts +35 -1
  8. package/dist/api/core/geom/line.d.ts.map +1 -1
  9. package/dist/api/core/geom/profile.d.ts +66 -2
  10. package/dist/api/core/geom/profile.d.ts.map +1 -1
  11. package/dist/api/core/index.d.ts +8 -0
  12. package/dist/api/core/index.d.ts.map +1 -1
  13. package/dist/api/core/math/index.d.ts +8 -0
  14. package/dist/api/core/math/index.d.ts.map +1 -1
  15. package/dist/api/core/math/quat.d.ts +156 -15
  16. package/dist/api/core/math/quat.d.ts.map +1 -1
  17. package/dist/api/core/math/vec3.d.ts +131 -14
  18. package/dist/api/core/math/vec3.d.ts.map +1 -1
  19. package/dist/api/entity/index.d.ts +13 -0
  20. package/dist/api/entity/index.d.ts.map +1 -1
  21. package/dist/api/entity/referenceLine.d.ts +259 -0
  22. package/dist/api/entity/referenceLine.d.ts.map +1 -0
  23. package/dist/api/entity/space.d.ts +467 -7
  24. package/dist/api/entity/space.d.ts.map +1 -1
  25. package/dist/api/entity/story.d.ts +166 -0
  26. package/dist/api/entity/story.d.ts.map +1 -1
  27. package/dist/api/index.d.ts +14 -0
  28. package/dist/api/index.d.ts.map +1 -1
  29. package/dist/api/tools/index.d.ts +8 -0
  30. package/dist/api/tools/index.d.ts.map +1 -1
  31. package/dist/api/tools/selection.d.ts +37 -0
  32. package/dist/api/tools/selection.d.ts.map +1 -1
  33. package/dist/api/tools/transform.d.ts +82 -0
  34. package/dist/api/tools/transform.d.ts.map +1 -1
  35. package/dist/api/units/index.d.ts +81 -13
  36. package/dist/api/units/index.d.ts.map +1 -1
  37. package/dist/index.cjs +547 -126
  38. package/dist/index.cjs.map +1 -1
  39. package/dist/index.js +533 -126
  40. package/dist/index.js.map +1 -1
  41. package/dist/types.d.ts +8 -1
  42. package/dist/types.d.ts.map +1 -1
  43. package/package.json +2 -2
  44. package/src/api/core/geom/arc.ts +50 -1
  45. package/src/api/core/geom/curve.ts +26 -1
  46. package/src/api/core/geom/index.ts +16 -0
  47. package/src/api/core/geom/line.ts +35 -1
  48. package/src/api/core/geom/profile.ts +66 -2
  49. package/src/api/core/index.ts +8 -0
  50. package/src/api/core/math/index.ts +8 -0
  51. package/src/api/core/math/quat.ts +156 -15
  52. package/src/api/core/math/vec3.ts +131 -14
  53. package/src/api/entity/index.ts +13 -0
  54. package/src/api/entity/referenceLine.ts +215 -0
  55. package/src/api/entity/space.ts +447 -11
  56. package/src/api/entity/story.ts +166 -0
  57. package/src/api/index.ts +14 -0
  58. package/src/api/tools/index.ts +8 -0
  59. package/src/api/tools/selection.ts +37 -0
  60. package/src/api/tools/transform.ts +82 -0
  61. package/src/api/units/index.ts +81 -13
  62. package/src/types.ts +8 -1
  63. package/tsup.config.ts +0 -1
@@ -4,32 +4,209 @@ import { PVec3 } from "../core/math/vec3"
4
4
  import { PQuat } from "../core/math/quat"
5
5
  import { PProfile } from "../core/geom/profile"
6
6
 
7
+ /**
8
+ * Space (room/mass) management — create, query, and delete spaces.
9
+ *
10
+ * A **space** is a 3D volume representing a room or mass in the
11
+ * Snaptrude scene. Spaces live on a particular story and carry
12
+ * properties such as name, area, department, and room type.
13
+ *
14
+ * All methods are **host API calls** that return Promises and support
15
+ * undo/redo via Snaptrude's command system.
16
+ *
17
+ * Accessed via `snaptrude.entity.space`.
18
+ */
7
19
  export abstract class PluginSpaceApi {
8
20
  constructor() {}
9
21
 
22
+ /**
23
+ * Create a rectangular (box) space.
24
+ *
25
+ * Generates an axis-aligned box with the given dimensions at the
26
+ * specified position. The created space is automatically assigned
27
+ * to the active story and a default department.
28
+ *
29
+ * @param args - An object containing:
30
+ * - {@linkcode PluginSpaceCreateRectangularArgs.position args.position} — Origin
31
+ * position as a {@linkcode PVec3} in Babylon units
32
+ * - {@linkcode PluginSpaceCreateRectangularArgs.dimensions args.dimensions} — Box
33
+ * dimensions `{ width, height, depth }` in Babylon units
34
+ * @returns A {@linkcode PluginSpaceCreateRectangularResult} with the `spaceId`
35
+ * of the created space
36
+ * @throws If space creation fails
37
+ *
38
+ * # Example
39
+ * ```ts
40
+ * const { vec3 } = snaptrude.core.math
41
+ *
42
+ * const { spaceId } = await snaptrude.entity.space.createRectangular({
43
+ * position: vec3.new(0, 0, 0),
44
+ * dimensions: { width: 5, height: 3, depth: 4 },
45
+ * })
46
+ * ```
47
+ */
10
48
  public abstract createRectangular({
11
49
  position,
12
50
  dimensions,
13
51
  }: PluginSpaceCreateRectangularArgs): PluginApiReturn<PluginSpaceCreateRectangularResult>
14
52
 
53
+ /**
54
+ * Create a space by extruding a 2D profile.
55
+ *
56
+ * The {@linkcode PluginSpaceCreateFromProfileArgs.profile profile} is extruded
57
+ * upward (along the Y axis) by {@linkcode PluginSpaceCreateFromProfileArgs.extrudeHeight
58
+ * extrudeHeight}, then offset by {@linkcode PluginSpaceCreateFromProfileArgs.position
59
+ * position}. The created space is automatically assigned to the active story
60
+ * and a default department.
61
+ *
62
+ * Use {@linkcode PluginProfileApi.fromLinePoints} to quickly build a profile
63
+ * from a list of points.
64
+ *
65
+ * @param args - An object containing:
66
+ * - {@linkcode PluginSpaceCreateFromProfileArgs.profile args.profile} — A closed
67
+ * {@linkcode PProfile} defining the floor shape
68
+ * - {@linkcode PluginSpaceCreateFromProfileArgs.extrudeHeight args.extrudeHeight} —
69
+ * Extrusion height in Babylon units
70
+ * - {@linkcode PluginSpaceCreateFromProfileArgs.position args.position} — Offset
71
+ * position as a {@linkcode PVec3} in Babylon units
72
+ * @returns A {@linkcode PluginSpaceCreateFromProfileResult} with the `spaceId`
73
+ * of the created space
74
+ * @throws If the profile is invalid or mesh creation fails
75
+ *
76
+ * # Example
77
+ * ```ts
78
+ * const { vec3 } = snaptrude.core.math
79
+ *
80
+ * const profile = await snaptrude.core.geom.profile.fromLinePoints({
81
+ * points: [
82
+ * vec3.new(0, 0, 0),
83
+ * vec3.new(10, 0, 0),
84
+ * vec3.new(10, 0, 8),
85
+ * vec3.new(0, 0, 8),
86
+ * ],
87
+ * })
88
+ *
89
+ * const { spaceId } = await snaptrude.entity.space.createFromProfile({
90
+ * profile,
91
+ * extrudeHeight: 3,
92
+ * position: vec3.new(0, 0, 0),
93
+ * })
94
+ * ```
95
+ */
15
96
  public abstract createFromProfile({
16
97
  profile,
17
98
  extrudeHeight,
18
99
  position,
19
100
  }: PluginSpaceCreateFromProfileArgs): PluginApiReturn<PluginSpaceCreateFromProfileResult>
20
101
 
102
+ /**
103
+ * Get the IDs of all spaces in the current project.
104
+ *
105
+ * Returns every space (mass that is not a building) across all stories.
106
+ * Use the returned IDs with {@linkcode PluginSpaceApi.get} to query
107
+ * individual space properties.
108
+ *
109
+ * @returns A {@linkcode PluginSpaceGetAllResult} with a `spacesIds` array
110
+ *
111
+ * # Example
112
+ * ```ts
113
+ * const { spacesIds } = await snaptrude.entity.space.getAll()
114
+ * console.log(`Project has ${spacesIds.length} spaces`)
115
+ * ```
116
+ */
21
117
  public abstract getAll(): PluginApiReturn<PluginSpaceGetAllResult>
22
118
 
119
+ /**
120
+ * Get properties of a space by its ID.
121
+ *
122
+ * Only the properties listed in {@linkcode PluginSpaceGetArgs.properties
123
+ * args.properties} are returned — unlisted properties will be `undefined`
124
+ * in the result.
125
+ *
126
+ * @param args - An object containing:
127
+ * - {@linkcode PluginSpaceGetArgs.spaceId args.spaceId} — The unique space ID
128
+ * (as returned by creation methods or {@linkcode PluginSpaceApi.getAll})
129
+ * - {@linkcode PluginSpaceGetArgs.properties args.properties} — Array of property
130
+ * names to retrieve. See {@linkcode PluginSpaceGetProperty} for available values.
131
+ * @returns A partial {@linkcode PluginSpaceGetResult} containing only the requested
132
+ * properties
133
+ * @throws If the space does not exist or the component is not a space/mass
134
+ *
135
+ * # Example
136
+ * ```ts
137
+ * const info = await snaptrude.entity.space.get({
138
+ * spaceId: "some-space-id",
139
+ * properties: ["name", "area", "position"],
140
+ * })
141
+ * console.log(info.name, info.area, info.position)
142
+ * ```
143
+ */
23
144
  public abstract get({
24
145
  spaceId,
25
146
  properties,
26
147
  }: PluginSpaceGetArgs): PluginApiReturn<PluginSpaceGetResult>
27
148
 
28
- public abstract deleteById({
149
+ /**
150
+ * Delete a space by its ID.
151
+ *
152
+ * Permanently removes the space and its associated mesh from the scene.
153
+ * This operation is undoable via Snaptrude's command system.
154
+ *
155
+ * @param args - An object containing:
156
+ * - {@linkcode PluginSpaceDeleteArgs.spaceId args.spaceId} — The unique space ID
157
+ * to delete
158
+ * @throws If the space does not exist or the component is not a space/mass
159
+ *
160
+ * # Example
161
+ * ```ts
162
+ * await snaptrude.entity.space.delete({ spaceId: "some-space-id" })
163
+ * ```
164
+ */
165
+ public abstract delete({
29
166
  spaceId,
30
- }: PluginSpaceDeleteByIdArgs): PluginApiReturn<PluginSpaceDeleteByIdResult>
167
+ }: PluginSpaceDeleteArgs): PluginApiReturn<PluginSpaceDeleteResult>
168
+
169
+ /**
170
+ * Update properties of a space by its ID.
171
+ *
172
+ * Only the properties provided in {@linkcode PluginSpaceUpdateArgs.properties
173
+ * args.properties} will be updated — omitted properties remain unchanged.
174
+ * This operation is undoable via Snaptrude's command system.
175
+ *
176
+ * @param args - An object containing:
177
+ * - {@linkcode PluginSpaceUpdateArgs.spaceId args.spaceId} — The unique space ID
178
+ * to update
179
+ * - {@linkcode PluginSpaceUpdateArgs.properties args.properties} — Key/value pairs
180
+ * of properties to update. See {@linkcode PluginSpaceUpdateArgs} for supported fields.
181
+ * @returns A {@linkcode PluginSpaceUpdateResult} echoing back the `spaceId` and
182
+ * the updated property values
183
+ * @throws If the space does not exist or the component is not a space/mass
184
+ *
185
+ * # Example
186
+ * ```ts
187
+ * const result = await snaptrude.entity.space.update({
188
+ * spaceId: "some-space-id",
189
+ * properties: {
190
+ * room_type: "Kitchen",
191
+ * massType: "Room",
192
+ * departmentId: "CORE",
193
+ * },
194
+ * })
195
+ * ```
196
+ */
197
+ public abstract update(
198
+ args: PluginSpaceUpdateArgs
199
+ ): PluginApiReturn<PluginSpaceUpdateResult>
31
200
  }
32
201
 
202
+ /**
203
+ * Arguments for {@linkcode PluginSpaceApi.createRectangular}.
204
+ *
205
+ * | Property | Type | Description |
206
+ * |---|---|---|
207
+ * | `position` | {@linkcode PVec3} | Origin position in Babylon units |
208
+ * | `dimensions` | `{ width, height, depth }` | Box dimensions in Babylon units |
209
+ */
33
210
  export const PluginSpaceCreateRectangularArgs = z.object({
34
211
  position: PVec3,
35
212
  dimensions: z.object({
@@ -39,41 +216,131 @@ export const PluginSpaceCreateRectangularArgs = z.object({
39
216
  }),
40
217
  })
41
218
 
42
- export type PluginSpaceCreateRectangularArgs = z.infer<typeof PluginSpaceCreateRectangularArgs>
219
+ export type PluginSpaceCreateRectangularArgs = z.infer<
220
+ typeof PluginSpaceCreateRectangularArgs
221
+ >
43
222
 
223
+ /**
224
+ * Result of {@linkcode PluginSpaceApi.createRectangular}.
225
+ *
226
+ * | Property | Type | Description |
227
+ * |---|---|---|
228
+ * | `spaceId` | `string` | Unique ID of the created space |
229
+ */
44
230
  export const PluginSpaceCreateRectangularResult = z.object({
45
231
  spaceId: z.string(),
46
232
  })
47
233
 
48
- export type PluginSpaceCreateRectangularResult = z.infer<typeof PluginSpaceCreateRectangularResult>
234
+ export type PluginSpaceCreateRectangularResult = z.infer<
235
+ typeof PluginSpaceCreateRectangularResult
236
+ >
49
237
 
238
+ /**
239
+ * Arguments for {@linkcode PluginSpaceApi.createFromProfile}.
240
+ *
241
+ * | Property | Type | Description |
242
+ * |---|---|---|
243
+ * | `profile` | {@linkcode PProfile} | Closed 2D profile defining the floor shape |
244
+ * | `extrudeHeight` | `number` | Extrusion height in Babylon units |
245
+ * | `position` | {@linkcode PVec3} | Offset position in Babylon units |
246
+ */
50
247
  export const PluginSpaceCreateFromProfileArgs = z.object({
51
248
  profile: PProfile,
52
249
  extrudeHeight: z.number(),
53
250
  position: PVec3,
54
251
  })
55
252
 
56
- export type PluginSpaceCreateFromProfileArgs = z.infer<typeof PluginSpaceCreateFromProfileArgs>
253
+ export type PluginSpaceCreateFromProfileArgs = z.infer<
254
+ typeof PluginSpaceCreateFromProfileArgs
255
+ >
57
256
 
257
+ /**
258
+ * Result of {@linkcode PluginSpaceApi.createFromProfile}.
259
+ *
260
+ * | Property | Type | Description |
261
+ * |---|---|---|
262
+ * | `spaceId` | `string` | Unique ID of the created space |
263
+ */
58
264
  export const PluginSpaceCreateFromProfileResult = z.object({
59
265
  spaceId: z.string(),
60
266
  })
61
267
 
62
- export type PluginSpaceCreateFromProfileResult = z.infer<typeof PluginSpaceCreateFromProfileResult>
268
+ export type PluginSpaceCreateFromProfileResult = z.infer<
269
+ typeof PluginSpaceCreateFromProfileResult
270
+ >
63
271
 
272
+ /**
273
+ * Available properties that can be queried on a space.
274
+ *
275
+ * **Basic:**
276
+ * | Value | Return Type | Description |
277
+ * |---|---|---|
278
+ * | `"id"` | `string` | Unique space identifier |
279
+ * | `"type"` | `string` | Component type |
280
+ * | `"room_type"` | `string` | Room type classification |
281
+ * | `"name"` | `string` | Display name of the space |
282
+ *
283
+ * **Derived from parametric data:**
284
+ * | Value | Return Type | Description |
285
+ * |---|---|---|
286
+ * | `"area"` | `number` | Bottom face area (from `areas_bottomFace`) |
287
+ * | `"breadth"` | `number` | Breadth dimension |
288
+ * | `"depth"` | `number` | Depth dimension |
289
+ * | `"height"` | `number` | Height dimension |
290
+ * | `"massType"` | `string \| null` | Mass type classification |
291
+ * | `"spaceType"` | `string \| null` | Space type classification (Room, Balcony, etc.) |
292
+ * | `"storey"` | `number \| null` | Story the space belongs to |
293
+ * | `"departmentId"` | `string \| null` | Assigned department ID |
294
+ * | `"departmentName"` | `string` | Assigned department name |
295
+ * | `"departmentColor"` | `string` | Assigned department color (hex/CSS) |
296
+ *
297
+ * **Derived from mesh:**
298
+ * | Value | Return Type | Description |
299
+ * |---|---|---|
300
+ * | `"position"` | {@linkcode PVec3} | Local position relative to parent |
301
+ * | `"absolutePosition"` | {@linkcode PVec3} | Absolute position in the scene |
302
+ * | `"rotation"` | {@linkcode PVec3} | Euler rotation angles (radians) |
303
+ * | `"rotationQuaternion"` | {@linkcode PQuat} \| `null` | Quaternion rotation, or `null` if unset |
304
+ *
305
+ * **Derived from brep:**
306
+ * | Value | Return Type | Description |
307
+ * |---|---|---|
308
+ * | `"planPoints"` | {@linkcode PVec3}`[]` | Bottom outer profile points in world space with `y = 0` (2D plan). No closing duplicate point. |
309
+ */
64
310
  export const PluginSpaceGetProperty = z.enum([
311
+ // Basic
65
312
  "id",
66
313
  "type",
67
314
  "room_type",
68
315
  "name",
316
+ // Derived from parametric data
69
317
  "area",
70
- "department",
318
+ "breadth",
319
+ "depth",
320
+ "height",
321
+ "massType",
322
+ "spaceType",
323
+ "storey",
324
+ "departmentId",
325
+ "departmentName",
326
+ "departmentColor",
327
+ // Derived from mesh
71
328
  "position",
72
329
  "absolutePosition",
73
330
  "rotation",
74
331
  "rotationQuaternion",
332
+ // Derived from brep
333
+ "planPoints",
75
334
  ])
76
335
 
336
+ /**
337
+ * Arguments for {@linkcode PluginSpaceApi.get}.
338
+ *
339
+ * | Property | Type | Description |
340
+ * |---|---|---|
341
+ * | `spaceId` | `string` | The space ID to query |
342
+ * | `properties` | {@linkcode PluginSpaceGetProperty}`[]` | Properties to retrieve |
343
+ */
77
344
  export const PluginSpaceGetArgs = z.object({
78
345
  spaceId: z.string(),
79
346
  properties: z.array(PluginSpaceGetProperty),
@@ -81,33 +348,202 @@ export const PluginSpaceGetArgs = z.object({
81
348
 
82
349
  export type PluginSpaceGetArgs = z.infer<typeof PluginSpaceGetArgs>
83
350
 
351
+ /**
352
+ * Supported space type values.
353
+ *
354
+ * Mirrors the internal `SpaceType` enum from `spaceType.types.ts`.
355
+ *
356
+ * | Value | Description |
357
+ * |---|---|
358
+ * | `"Room"` | Standard room |
359
+ * | `"Program Block"` | Program/department block |
360
+ * | `"Balcony"` | Balcony space |
361
+ * | `"Road"` | Road |
362
+ * | `"Garden"` | Garden area |
363
+ * | `"Deck"` | Deck |
364
+ * | `"Pool"` | Pool |
365
+ * | `"Walkway"` | Walkway |
366
+ */
367
+ export const PluginSpaceType = z.enum([
368
+ "Room",
369
+ "Program Block",
370
+ "Balcony",
371
+ "Road",
372
+ "Garden",
373
+ "Deck",
374
+ "Pool",
375
+ "Walkway",
376
+ ])
377
+
378
+ /**
379
+ * Result of {@linkcode PluginSpaceApi.get}.
380
+ *
381
+ * A partial object — only the properties that were requested in
382
+ * {@linkcode PluginSpaceGetArgs.properties} will be present.
383
+ */
84
384
  export const PluginSpaceGetResult = z
85
385
  .object({
386
+ // Basic
86
387
  id: z.string(),
87
388
  type: z.string(),
88
389
  room_type: z.string(),
89
390
  name: z.string(),
391
+ // Derived from parametric data
90
392
  area: z.number(),
91
- department: z.string(),
393
+ breadth: z.number(),
394
+ depth: z.number(),
395
+ height: z.number(),
396
+ massType: z.string().nullable(),
397
+ spaceType: PluginSpaceType.nullable(),
398
+ storey: z.number().nullable(),
399
+ departmentId: z.string().nullable(),
400
+ departmentName: z.string(),
401
+ departmentColor: z.string(),
402
+ // Derived from mesh
92
403
  position: PVec3,
93
404
  absolutePosition: PVec3,
94
405
  rotation: PVec3,
95
406
  rotationQuaternion: PQuat.nullable(),
407
+ // Derived from brep
408
+ planPoints: z.array(PVec3),
96
409
  })
97
410
  .partial()
98
411
 
99
412
  export type PluginSpaceGetResult = z.infer<typeof PluginSpaceGetResult>
100
413
 
414
+ /**
415
+ * Result of {@linkcode PluginSpaceApi.getAll}.
416
+ *
417
+ * | Property | Type | Description |
418
+ * |---|---|---|
419
+ * | `spacesIds` | `string[]` | IDs of all spaces in the project |
420
+ */
101
421
  export const PluginSpaceGetAllResult = z.object({
102
422
  spacesIds: z.array(z.string()),
103
423
  })
104
424
 
105
425
  export type PluginSpaceGetAllResult = z.infer<typeof PluginSpaceGetAllResult>
106
426
 
107
- export const PluginSpaceDeleteByIdArgs = z.object({
427
+ /**
428
+ * Arguments for {@linkcode PluginSpaceApi.delete}.
429
+ *
430
+ * | Property | Type | Description |
431
+ * |---|---|---|
432
+ * | `spaceId` | `string` | The space ID to delete |
433
+ */
434
+ export const PluginSpaceDeleteArgs = z.object({
435
+ spaceId: z.string(),
436
+ })
437
+
438
+ export type PluginSpaceDeleteArgs = z.infer<typeof PluginSpaceDeleteArgs>
439
+
440
+ /** Result type for {@linkcode PluginSpaceApi.delete} — returns nothing on success. */
441
+ export type PluginSpaceDeleteResult = void
442
+
443
+ /**
444
+ * Supported mass type values for {@linkcode PluginSpaceUpdateArgs.properties.massType}.
445
+ *
446
+ * Mirrors the internal `MASS_TYPES` enum.
447
+ *
448
+ * | Value | Description |
449
+ * |---|---|
450
+ * | `"Plinth"` | Plinth mass |
451
+ * | `"Void"` | Void/cut-out |
452
+ * | `"Pergola"` | Pergola structure |
453
+ * | `"Furniture"` | Furniture element |
454
+ * | `"Facade element"` | Facade element |
455
+ * | `"Generic mass"` | Generic mass |
456
+ * | `"Room"` | Room (default for spaces) |
457
+ * | `"Department"` | Department block |
458
+ * | `"Building"` | Building envelope |
459
+ * | `"Revit Import"` | Imported from Revit |
460
+ * | `"Mass"` | Generic mass type |
461
+ * | `"Site"` | Site object |
462
+ */
463
+ export const PluginMassType = z.enum([
464
+ "Plinth",
465
+ "Void",
466
+ "Pergola",
467
+ "Furniture",
468
+ "Facade element",
469
+ "Generic mass",
470
+ "Room",
471
+ "Department",
472
+ "Building",
473
+ "Revit Import",
474
+ "Mass",
475
+ "Site",
476
+ ])
477
+
478
+ /**
479
+ * Well-known (built-in) department IDs.
480
+ *
481
+ * | Value | Department |
482
+ * |---|---|
483
+ * | `"DEFAULT"` | Default department |
484
+ * | `"SITE"` | Site department |
485
+ * | `"ENVELOPE"` | Envelope department |
486
+ * | `"CORE"` | Core department |
487
+ */
488
+ export const PluginWellKnownDepartmentId = z.enum([
489
+ "DEFAULT",
490
+ "SITE",
491
+ "ENVELOPE",
492
+ "CORE",
493
+ ])
494
+
495
+ /**
496
+ * Accepted department ID values — either a {@linkcode PluginWellKnownDepartmentId}
497
+ * or a UUID string for custom (user-created) departments.
498
+ */
499
+ export const PluginDepartmentId = z.union([
500
+ PluginWellKnownDepartmentId,
501
+ z.uuid(),
502
+ ])
503
+
504
+ /**
505
+ * Arguments for {@linkcode PluginSpaceApi.update}.
506
+ *
507
+ * | Property | Type | Description |
508
+ * |---|---|---|
509
+ * | `spaceId` | `string` | The space ID to update |
510
+ * | `properties` | `object` | Key/value pairs of properties to update (all optional) |
511
+ * | `properties.room_type` | `string?` | New room type label |
512
+ * | `properties.massType` | {@linkcode PluginMassType}`?` | New mass type |
513
+ * | `properties.departmentId` | {@linkcode PluginDepartmentId}`?` | New department ID |
514
+ */
515
+ export const PluginSpaceUpdateArgs = z.object({
108
516
  spaceId: z.string(),
517
+ properties: z.object({
518
+ room_type: z.string().optional(),
519
+ massType: PluginMassType.optional(),
520
+ spaceType: PluginSpaceType.optional(),
521
+ departmentId: PluginDepartmentId.optional(),
522
+ }),
109
523
  })
110
524
 
111
- export type PluginSpaceDeleteByIdArgs = z.infer<typeof PluginSpaceDeleteByIdArgs>
525
+ export type PluginSpaceUpdateArgs = z.infer<typeof PluginSpaceUpdateArgs>
526
+
527
+ /**
528
+ * Result of {@linkcode PluginSpaceApi.update}.
529
+ *
530
+ * Echoes back the `spaceId` and the values of properties that were updated.
531
+ * Properties that were not included in the update request will be `undefined`.
532
+ *
533
+ * | Property | Type | Description |
534
+ * |---|---|---|
535
+ * | `spaceId` | `string` | The space ID that was updated |
536
+ * | `room_type` | `string?` | Updated room type (if changed) |
537
+ * | `massType` | `string?` | Updated mass type (if changed) |
538
+ * | `spaceType` | `string?` | Updated space type (if changed) |
539
+ * | `departmentId` | `string \| null?` | Updated department ID (if changed) |
540
+ */
541
+ export const PluginSpaceUpdateResult = z.object({
542
+ spaceId: z.string(),
543
+ room_type: z.string().optional(),
544
+ massType: z.string().optional(),
545
+ spaceType: z.string().optional(),
546
+ departmentId: z.string().nullable().optional(),
547
+ })
112
548
 
113
- export type PluginSpaceDeleteByIdResult = void
549
+ export type PluginSpaceUpdateResult = z.infer<typeof PluginSpaceUpdateResult>