@snaptrude/plugin-core 0.3.0 → 0.6.0

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 (302) hide show
  1. package/AGENTS.md +130 -48
  2. package/CHANGELOG.md +163 -0
  3. package/api-manifest.full.json +5600 -0
  4. package/api-manifest.json +5502 -0
  5. package/dist/api/analysis/heatmaps.d.ts +234 -0
  6. package/dist/api/analysis/heatmaps.d.ts.map +1 -0
  7. package/dist/api/analysis/illuminance.d.ts +145 -0
  8. package/dist/api/analysis/illuminance.d.ts.map +1 -0
  9. package/dist/api/analysis/index.d.ts +44 -0
  10. package/dist/api/analysis/index.d.ts.map +1 -0
  11. package/dist/api/analysis/shadows.d.ts +165 -0
  12. package/dist/api/analysis/shadows.d.ts.map +1 -0
  13. package/dist/api/analysis/sunlightHours.d.ts +208 -0
  14. package/dist/api/analysis/sunlightHours.d.ts.map +1 -0
  15. package/dist/api/analysis/sunpath.d.ts +80 -0
  16. package/dist/api/analysis/sunpath.d.ts.map +1 -0
  17. package/dist/api/core/buildings.d.ts +427 -0
  18. package/dist/api/core/buildings.d.ts.map +1 -0
  19. package/dist/api/core/comment/index.d.ts +230 -0
  20. package/dist/api/core/comment/index.d.ts.map +1 -0
  21. package/dist/api/core/geom/create/index.d.ts +247 -0
  22. package/dist/api/core/geom/create/index.d.ts.map +1 -0
  23. package/dist/api/core/geom/delete/index.d.ts +72 -0
  24. package/dist/api/core/geom/delete/index.d.ts.map +1 -0
  25. package/dist/api/core/geom/index.d.ts +24 -23
  26. package/dist/api/core/geom/index.d.ts.map +1 -1
  27. package/dist/api/core/geom/query/arc.d.ts +169 -0
  28. package/dist/api/core/geom/query/arc.d.ts.map +1 -0
  29. package/dist/api/core/geom/query/brep.d.ts +402 -0
  30. package/dist/api/core/geom/query/brep.d.ts.map +1 -0
  31. package/dist/api/core/geom/query/circle.d.ts +378 -0
  32. package/dist/api/core/geom/query/circle.d.ts.map +1 -0
  33. package/dist/api/core/geom/query/contour.d.ts +450 -0
  34. package/dist/api/core/geom/query/contour.d.ts.map +1 -0
  35. package/dist/api/core/geom/query/curve.d.ts +918 -0
  36. package/dist/api/core/geom/query/curve.d.ts.map +1 -0
  37. package/dist/api/core/geom/query/edge.d.ts +128 -0
  38. package/dist/api/core/geom/query/edge.d.ts.map +1 -0
  39. package/dist/api/core/geom/query/face.d.ts +363 -0
  40. package/dist/api/core/geom/query/face.d.ts.map +1 -0
  41. package/dist/api/core/geom/query/halfedge.d.ts +206 -0
  42. package/dist/api/core/geom/query/halfedge.d.ts.map +1 -0
  43. package/dist/api/core/geom/query/index.d.ts +61 -0
  44. package/dist/api/core/geom/query/index.d.ts.map +1 -0
  45. package/dist/api/core/geom/query/profile.d.ts +410 -0
  46. package/dist/api/core/geom/query/profile.d.ts.map +1 -0
  47. package/dist/api/core/geom/query/vertex.d.ts +187 -0
  48. package/dist/api/core/geom/query/vertex.d.ts.map +1 -0
  49. package/dist/api/core/geom/update/contour.d.ts +272 -0
  50. package/dist/api/core/geom/update/contour.d.ts.map +1 -0
  51. package/dist/api/core/geom/update/curve.d.ts +180 -0
  52. package/dist/api/core/geom/update/curve.d.ts.map +1 -0
  53. package/dist/api/core/geom/update/index.d.ts +27 -0
  54. package/dist/api/core/geom/update/index.d.ts.map +1 -0
  55. package/dist/api/core/geom/update/profile.d.ts +329 -0
  56. package/dist/api/core/geom/update/profile.d.ts.map +1 -0
  57. package/dist/api/core/groups.d.ts +485 -0
  58. package/dist/api/core/groups.d.ts.map +1 -0
  59. package/dist/api/core/history/index.d.ts +78 -0
  60. package/dist/api/core/history/index.d.ts.map +1 -0
  61. package/dist/api/core/index.d.ts +51 -1
  62. package/dist/api/core/index.d.ts.map +1 -1
  63. package/dist/api/core/io/import/index.d.ts +392 -0
  64. package/dist/api/core/io/import/index.d.ts.map +1 -0
  65. package/dist/api/core/io/index.d.ts +35 -0
  66. package/dist/api/core/io/index.d.ts.map +1 -0
  67. package/dist/api/core/io/job/index.d.ts +139 -0
  68. package/dist/api/core/io/job/index.d.ts.map +1 -0
  69. package/dist/api/core/io/query/index.d.ts +74 -0
  70. package/dist/api/core/io/query/index.d.ts.map +1 -0
  71. package/dist/api/core/io/terrain/index.d.ts +206 -0
  72. package/dist/api/core/io/terrain/index.d.ts.map +1 -0
  73. package/dist/api/core/io/underlay/index.d.ts +286 -0
  74. package/dist/api/core/io/underlay/index.d.ts.map +1 -0
  75. package/dist/api/core/layers.d.ts +402 -0
  76. package/dist/api/core/layers.d.ts.map +1 -0
  77. package/dist/api/core/math/quat.d.ts +111 -128
  78. package/dist/api/core/math/quat.d.ts.map +1 -1
  79. package/dist/api/core/math/vec3.d.ts +120 -102
  80. package/dist/api/core/math/vec3.d.ts.map +1 -1
  81. package/dist/api/core/project/index.d.ts +399 -0
  82. package/dist/api/core/project/index.d.ts.map +1 -0
  83. package/dist/api/core/tags.d.ts +755 -0
  84. package/dist/api/core/tags.d.ts.map +1 -0
  85. package/dist/api/core/units/index.d.ts +175 -0
  86. package/dist/api/core/units/index.d.ts.map +1 -0
  87. package/dist/api/core/zoom/index.d.ts +45 -0
  88. package/dist/api/core/zoom/index.d.ts.map +1 -0
  89. package/dist/api/design/boolean/index.d.ts +168 -0
  90. package/dist/api/design/boolean/index.d.ts.map +1 -0
  91. package/dist/api/design/create/index.d.ts +837 -0
  92. package/dist/api/design/create/index.d.ts.map +1 -0
  93. package/dist/api/design/delete/index.d.ts +63 -0
  94. package/dist/api/design/delete/index.d.ts.map +1 -0
  95. package/dist/api/design/doors/index.d.ts +268 -0
  96. package/dist/api/design/doors/index.d.ts.map +1 -0
  97. package/dist/api/design/edit/index.d.ts +49 -0
  98. package/dist/api/design/edit/index.d.ts.map +1 -0
  99. package/dist/api/design/erase/index.d.ts +160 -0
  100. package/dist/api/design/erase/index.d.ts.map +1 -0
  101. package/dist/api/design/furniture/index.d.ts +123 -0
  102. package/dist/api/design/furniture/index.d.ts.map +1 -0
  103. package/dist/api/design/index.d.ts +153 -0
  104. package/dist/api/design/index.d.ts.map +1 -0
  105. package/dist/api/design/lock.d.ts +41 -0
  106. package/dist/api/design/lock.d.ts.map +1 -0
  107. package/dist/api/design/materials/index.d.ts +297 -0
  108. package/dist/api/design/materials/index.d.ts.map +1 -0
  109. package/dist/api/design/query/geometry/index.d.ts +140 -0
  110. package/dist/api/design/query/geometry/index.d.ts.map +1 -0
  111. package/dist/api/design/query/index.d.ts +1011 -0
  112. package/dist/api/design/query/index.d.ts.map +1 -0
  113. package/dist/api/design/query/spaces.d.ts +221 -0
  114. package/dist/api/design/query/spaces.d.ts.map +1 -0
  115. package/dist/api/design/selection/index.d.ts +282 -0
  116. package/dist/api/design/selection/index.d.ts.map +1 -0
  117. package/dist/api/design/shared.d.ts +38 -0
  118. package/dist/api/design/shared.d.ts.map +1 -0
  119. package/dist/api/design/transform/index.d.ts +87 -0
  120. package/dist/api/design/transform/index.d.ts.map +1 -0
  121. package/dist/api/design/update/index.d.ts +178 -0
  122. package/dist/api/design/update/index.d.ts.map +1 -0
  123. package/dist/api/design/windows/index.d.ts +189 -0
  124. package/dist/api/design/windows/index.d.ts.map +1 -0
  125. package/dist/api/entity/buildableEnvelope.d.ts +261 -0
  126. package/dist/api/entity/buildableEnvelope.d.ts.map +1 -0
  127. package/dist/api/entity/department.d.ts +0 -98
  128. package/dist/api/entity/department.d.ts.map +1 -1
  129. package/dist/api/entity/index.d.ts +9 -9
  130. package/dist/api/entity/index.d.ts.map +1 -1
  131. package/dist/api/entity/referenceLine.d.ts +49 -106
  132. package/dist/api/entity/referenceLine.d.ts.map +1 -1
  133. package/dist/api/entity/space.d.ts +484 -251
  134. package/dist/api/entity/space.d.ts.map +1 -1
  135. package/dist/api/entity/story.d.ts +49 -39
  136. package/dist/api/entity/story.d.ts.map +1 -1
  137. package/dist/api/index.d.ts +22 -12
  138. package/dist/api/index.d.ts.map +1 -1
  139. package/dist/api/presentation/aiInspiration.d.ts +440 -0
  140. package/dist/api/presentation/aiInspiration.d.ts.map +1 -0
  141. package/dist/api/presentation/diagrams.d.ts +81 -0
  142. package/dist/api/presentation/diagrams.d.ts.map +1 -0
  143. package/dist/api/presentation/import.d.ts +113 -0
  144. package/dist/api/presentation/import.d.ts.map +1 -0
  145. package/dist/api/presentation/index.d.ts +46 -0
  146. package/dist/api/presentation/index.d.ts.map +1 -0
  147. package/dist/api/presentation/sheets.d.ts +176 -0
  148. package/dist/api/presentation/sheets.d.ts.map +1 -0
  149. package/dist/api/presentation/views.d.ts +296 -0
  150. package/dist/api/presentation/views.d.ts.map +1 -0
  151. package/dist/api/program/adjacency.d.ts +155 -0
  152. package/dist/api/program/adjacency.d.ts.map +1 -0
  153. package/dist/api/program/areas.d.ts +360 -0
  154. package/dist/api/program/areas.d.ts.map +1 -0
  155. package/dist/api/program/classification.d.ts +135 -0
  156. package/dist/api/program/classification.d.ts.map +1 -0
  157. package/dist/api/program/cores.d.ts +174 -0
  158. package/dist/api/program/cores.d.ts.map +1 -0
  159. package/dist/api/program/departments.d.ts +431 -0
  160. package/dist/api/program/departments.d.ts.map +1 -0
  161. package/dist/api/program/index.d.ts +69 -0
  162. package/dist/api/program/index.d.ts.map +1 -0
  163. package/dist/api/program/layout.d.ts +63 -0
  164. package/dist/api/program/layout.d.ts.map +1 -0
  165. package/dist/api/program/metrics.d.ts +108 -0
  166. package/dist/api/program/metrics.d.ts.map +1 -0
  167. package/dist/api/program/site.d.ts +451 -0
  168. package/dist/api/program/site.d.ts.map +1 -0
  169. package/dist/api/program/spreadsheet.d.ts +2041 -0
  170. package/dist/api/program/spreadsheet.d.ts.map +1 -0
  171. package/dist/handles.d.ts +171 -0
  172. package/dist/handles.d.ts.map +1 -0
  173. package/dist/host-utils.d.ts +7 -5
  174. package/dist/host-utils.d.ts.map +1 -1
  175. package/dist/index.cjs +4344 -899
  176. package/dist/index.cjs.map +1 -1
  177. package/dist/index.d.ts +1 -0
  178. package/dist/index.d.ts.map +1 -1
  179. package/dist/index.js +3682 -865
  180. package/dist/index.js.map +1 -1
  181. package/package.json +6 -2
  182. package/scripts/generate-manifest.mjs +193 -0
  183. package/scripts/generate-manifest.test.mjs +215 -0
  184. package/src/api/analysis/heatmaps.ts +256 -0
  185. package/src/api/analysis/illuminance.ts +155 -0
  186. package/src/api/analysis/index.ts +46 -0
  187. package/src/api/analysis/shadows.ts +183 -0
  188. package/src/api/analysis/sunlightHours.ts +211 -0
  189. package/src/api/analysis/sunpath.ts +83 -0
  190. package/src/api/core/buildings.ts +485 -0
  191. package/src/api/core/comment/index.ts +258 -0
  192. package/src/api/core/geom/create/index.ts +293 -0
  193. package/src/api/core/geom/delete/index.ts +78 -0
  194. package/src/api/core/geom/index.ts +24 -23
  195. package/src/api/core/geom/query/arc.ts +169 -0
  196. package/src/api/core/geom/query/brep.ts +444 -0
  197. package/src/api/core/geom/query/circle.ts +404 -0
  198. package/src/api/core/geom/query/contour.ts +540 -0
  199. package/src/api/core/geom/query/curve.ts +1078 -0
  200. package/src/api/core/geom/query/edge.ts +130 -0
  201. package/src/api/core/geom/query/face.ts +403 -0
  202. package/src/api/core/geom/query/halfedge.ts +210 -0
  203. package/src/api/core/geom/query/index.ts +63 -0
  204. package/src/api/core/geom/query/profile.ts +473 -0
  205. package/src/api/core/geom/query/vertex.ts +205 -0
  206. package/src/api/core/geom/update/contour.ts +315 -0
  207. package/src/api/core/geom/update/curve.ts +209 -0
  208. package/src/api/core/geom/update/index.ts +29 -0
  209. package/src/api/core/geom/update/profile.ts +377 -0
  210. package/src/api/core/groups.ts +521 -0
  211. package/src/api/core/history/index.ts +84 -0
  212. package/src/api/core/index.ts +51 -1
  213. package/src/api/core/io/import/index.ts +432 -0
  214. package/src/api/core/io/index.ts +37 -0
  215. package/src/api/core/io/job/index.ts +140 -0
  216. package/src/api/core/io/query/index.ts +71 -0
  217. package/src/api/core/io/terrain/index.ts +214 -0
  218. package/src/api/core/io/underlay/index.ts +295 -0
  219. package/src/api/core/layers.ts +333 -0
  220. package/src/api/core/math/quat.ts +112 -235
  221. package/src/api/core/math/vec3.ts +124 -159
  222. package/src/api/core/project/index.ts +418 -0
  223. package/src/api/core/tags.ts +808 -0
  224. package/src/api/core/units/index.ts +164 -0
  225. package/src/api/core/zoom/index.ts +47 -0
  226. package/src/api/design/boolean/index.ts +179 -0
  227. package/src/api/design/create/index.ts +895 -0
  228. package/src/api/design/delete/index.ts +67 -0
  229. package/src/api/design/doors/index.ts +285 -0
  230. package/src/api/design/edit/index.ts +54 -0
  231. package/src/api/design/erase/index.ts +151 -0
  232. package/src/api/design/furniture/index.ts +130 -0
  233. package/src/api/design/index.ts +162 -0
  234. package/src/api/design/lock.ts +42 -0
  235. package/src/api/design/materials/index.ts +301 -0
  236. package/src/api/design/query/geometry/index.ts +166 -0
  237. package/src/api/design/query/index.ts +937 -0
  238. package/src/api/design/query/spaces.ts +132 -0
  239. package/src/api/design/selection/index.ts +273 -0
  240. package/src/api/design/shared.ts +40 -0
  241. package/src/api/design/transform/index.ts +93 -0
  242. package/src/api/design/update/index.ts +117 -0
  243. package/src/api/design/windows/index.ts +207 -0
  244. package/src/api/entity/buildableEnvelope.ts +318 -0
  245. package/src/api/entity/department.ts +0 -113
  246. package/src/api/entity/index.ts +9 -9
  247. package/src/api/entity/referenceLine.ts +50 -38
  248. package/src/api/entity/space.ts +285 -226
  249. package/src/api/entity/story.ts +53 -42
  250. package/src/api/index.ts +22 -12
  251. package/src/api/presentation/aiInspiration.ts +362 -0
  252. package/src/api/presentation/diagrams.ts +84 -0
  253. package/src/api/presentation/import.ts +112 -0
  254. package/src/api/presentation/index.ts +48 -0
  255. package/src/api/presentation/sheets.ts +198 -0
  256. package/src/api/presentation/views.ts +303 -0
  257. package/src/api/program/adjacency.ts +164 -0
  258. package/src/api/program/areas.ts +335 -0
  259. package/src/api/program/classification.ts +138 -0
  260. package/src/api/program/cores.ts +171 -0
  261. package/src/api/program/departments.ts +465 -0
  262. package/src/api/program/index.ts +71 -0
  263. package/src/api/program/layout.ts +68 -0
  264. package/src/api/program/metrics.ts +120 -0
  265. package/src/api/program/site.ts +419 -0
  266. package/src/api/program/spreadsheet.ts +2075 -0
  267. package/src/handles.ts +194 -0
  268. package/src/host-utils.ts +10 -6
  269. package/src/index.ts +1 -0
  270. package/dist/api/core/geom/arc.d.ts +0 -81
  271. package/dist/api/core/geom/arc.d.ts.map +0 -1
  272. package/dist/api/core/geom/curve.d.ts +0 -70
  273. package/dist/api/core/geom/curve.d.ts.map +0 -1
  274. package/dist/api/core/geom/line.d.ts +0 -56
  275. package/dist/api/core/geom/line.d.ts.map +0 -1
  276. package/dist/api/core/geom/profile.d.ts +0 -121
  277. package/dist/api/core/geom/profile.d.ts.map +0 -1
  278. package/dist/api/tools/copy.d.ts +0 -59
  279. package/dist/api/tools/copy.d.ts.map +0 -1
  280. package/dist/api/tools/index.d.ts +0 -33
  281. package/dist/api/tools/index.d.ts.map +0 -1
  282. package/dist/api/tools/material.d.ts +0 -51
  283. package/dist/api/tools/material.d.ts.map +0 -1
  284. package/dist/api/tools/offset.d.ts +0 -43
  285. package/dist/api/tools/offset.d.ts.map +0 -1
  286. package/dist/api/tools/selection.d.ts +0 -48
  287. package/dist/api/tools/selection.d.ts.map +0 -1
  288. package/dist/api/tools/transform.d.ts +0 -114
  289. package/dist/api/tools/transform.d.ts.map +0 -1
  290. package/dist/api/units/index.d.ts +0 -163
  291. package/dist/api/units/index.d.ts.map +0 -1
  292. package/src/api/core/geom/arc.ts +0 -70
  293. package/src/api/core/geom/curve.ts +0 -41
  294. package/src/api/core/geom/line.ts +0 -53
  295. package/src/api/core/geom/profile.ts +0 -94
  296. package/src/api/tools/copy.ts +0 -55
  297. package/src/api/tools/index.ts +0 -39
  298. package/src/api/tools/material.ts +0 -49
  299. package/src/api/tools/offset.ts +0 -43
  300. package/src/api/tools/selection.ts +0 -51
  301. package/src/api/tools/transform.ts +0 -117
  302. package/src/api/units/index.ts +0 -163
@@ -0,0 +1,67 @@
1
+ import * as z from "zod"
2
+ import { PluginApiReturn } from "../../../types"
3
+ import { ComponentHandle } from "../../../handles"
4
+ import { PluginDesignChangeResult } from "../lock"
5
+
6
+ /**
7
+ * Arguments for {@linkcode PluginDesignDeleteApi.entities}.
8
+ *
9
+ * | Property | Type | Description |
10
+ * |---|---|---|
11
+ * | `components` | {@linkcode ComponentHandle}`[]` | Entities to delete. Unknown/forged handles reject the whole call (fail-fast). |
12
+ *
13
+ * `.min(1)` is deliberately stricter than the shipped `PluginDesignLockArgs`
14
+ * (which allows an empty array) — an empty delete is a caller error, not a no-op.
15
+ *
16
+ * TRANSPORT: positional args — validated host-side as `{ components }`.
17
+ */
18
+ export const PluginDesignDeleteEntitiesArgs = z.object({
19
+ components: z.array(ComponentHandle).min(1),
20
+ })
21
+ export type PluginDesignDeleteEntitiesArgs = z.infer<typeof PluginDesignDeleteEntitiesArgs>
22
+
23
+ /**
24
+ * `snaptrude.design.delete.*` — **hard removal** of scene BIM entities.
25
+ *
26
+ * This is hard entity delete — distinct from `design.erase.edge` (a plan-level
27
+ * adjacency-edge topology op) and `design.boolean.subtract` (a CSG geometry
28
+ * delete). The constitution forbids `erase`/`clear`/`remove` as synonyms for
29
+ * `delete`; these are three separate operations.
30
+ *
31
+ * TRANSPORT: positional args per method.
32
+ */
33
+ export abstract class PluginDesignDeleteApi {
34
+ constructor() {}
35
+
36
+ /**
37
+ * Delete one or more entities. Generic hard delete (backed by the same batched,
38
+ * undoable path as `entity.space.delete`). Cascade is opinionated by the engine:
39
+ * children are removed and linked-list neighbours are fixed up — not caller-tunable
40
+ * in v1. Undoable — commits as a **single** undo entry.
41
+ *
42
+ * @param components - Entities to delete. Unknown/forged handles reject the whole call (fail-fast).
43
+ * @returns The entities that were deleted, as {@linkcode ComponentHandle}`[]`
44
+ * (echoed host-side from the resolved+deleted set — the engine returns no ids).
45
+ * Deleted handles are **stale** afterwards: re-resolving one throws `HANDLE_INVALID`.
46
+ * @throws If any supplied handle is unknown/forged (`HANDLE_INVALID`) — the whole
47
+ * call rejects before anything is deleted (all-or-nothing resolution).
48
+ *
49
+ * @examplePrompt Delete the selected objects
50
+ * @examplePrompt Remove these walls from the model
51
+ * @examplePrompt Get rid of this mass entirely
52
+ * @examplePrompt Delete all the furniture I picked
53
+ * @examplePrompt Remove the door and window I just created
54
+ *
55
+ * # Example
56
+ * ```ts
57
+ * // Hard-delete every furniture item on storey 2 (a single undo entry)
58
+ * const furniture = await snaptrude.design.query.listFurniture({ storeys: [2] })
59
+ * if (furniture.length > 0) {
60
+ * const { affected } = await snaptrude.design.delete.entities(furniture)
61
+ * }
62
+ * ```
63
+ */
64
+ public abstract entities(
65
+ components: ComponentHandle[],
66
+ ): PluginApiReturn<PluginDesignChangeResult>
67
+ }
@@ -0,0 +1,285 @@
1
+ import * as z from "zod"
2
+ import { PluginApiReturn } from "../../../types"
3
+ import { ComponentHandle } from "../../../handles"
4
+ import { PluginDesignChangeResult } from "../lock"
5
+
6
+ /**
7
+ * `snaptrude.design.doors` — door-specific reads + edits. Creation lives at
8
+ * `design.create.door`; generic reads (`listDoors`/`getHost`/`getProperties`) live at
9
+ * `design.query.*`. Door targets are {@linkcode ComponentHandle}s.
10
+ *
11
+ * `getSwingDirection` is a DERIVED read (no persisted field) — computed from the door
12
+ * mesh reflection state. `mirror` reflects the door across an axis (undoable, one
13
+ * command); `setType` is intentionally absent (the engine has no in-place re-type —
14
+ * it would require delete+recreate).
15
+ */
16
+ export abstract class PluginDesignDoorsApi {
17
+ constructor() {}
18
+
19
+ /**
20
+ * Get the type name of a door — the label that identifies which kind of door
21
+ * the instance is, as shown in its properties.
22
+ *
23
+ * @param door The door to query
24
+ * @returns The type as a `string`, or `null`
25
+ *
26
+ * @examplePrompt What type of door is this?
27
+ * @examplePrompt Tell me the door type of the selected door
28
+ * @examplePrompt Is this a single or a double door?
29
+ * @examplePrompt Check what kind of door is on this wall
30
+ *
31
+ * # Example
32
+ * ```ts
33
+ * const [door] = await snaptrude.design.query.listDoors({ isSelected: true })
34
+ * const type = await snaptrude.design.doors.getType(door)
35
+ * if (type) console.log("door type:", type)
36
+ * ```
37
+ */
38
+ public abstract getType(door: ComponentHandle): PluginApiReturn<string | null>
39
+
40
+ /**
41
+ * Get the family name of a door — the Revit or native family the door
42
+ * instance comes from.
43
+ *
44
+ * @param door The door to query
45
+ * @returns The family as a `string`, or `null`
46
+ *
47
+ * @examplePrompt Which family does this door belong to?
48
+ * @examplePrompt What's the Revit family of the selected door?
49
+ * @examplePrompt Show the family name for this door
50
+ * @examplePrompt Find out which door family the imported door uses
51
+ *
52
+ * # Example
53
+ * ```ts
54
+ * const [door] = await snaptrude.design.query.listDoors()
55
+ * const family = await snaptrude.design.doors.getFamily(door)
56
+ * if (family) console.log("family:", family)
57
+ * ```
58
+ */
59
+ public abstract getFamily(door: ComponentHandle): PluginApiReturn<string | null>
60
+
61
+ /**
62
+ * Get the width of a door — how wide its opening is along the host wall.
63
+ *
64
+ * @param door The door to query
65
+ * @returns The width as a `number`, or `null`
66
+ *
67
+ * @examplePrompt How wide is this door?
68
+ * @examplePrompt What's the width of the selected door?
69
+ * @examplePrompt Measure the width of the entrance door
70
+ * @examplePrompt Check whether this door is 900mm wide
71
+ *
72
+ * # Example
73
+ * ```ts
74
+ * const [door] = await snaptrude.design.query.listDoors({ isSelected: true })
75
+ * const width = await snaptrude.design.doors.getWidth(door)
76
+ * if (width !== null) console.log("door width:", width)
77
+ * ```
78
+ */
79
+ public abstract getWidth(door: ComponentHandle): PluginApiReturn<number | null>
80
+
81
+ /**
82
+ * Get the height of a door — how tall its opening is from base to head.
83
+ *
84
+ * @param door The door to query
85
+ * @returns The height as a `number`, or `null`
86
+ *
87
+ * @examplePrompt How tall is this door?
88
+ * @examplePrompt What's the height of the selected door?
89
+ * @examplePrompt Check the door height for this opening
90
+ * @examplePrompt Is the front door 2100mm high?
91
+ *
92
+ * # Example
93
+ * ```ts
94
+ * const [door] = await snaptrude.design.query.listDoors()
95
+ * const height = await snaptrude.design.doors.getHeight(door)
96
+ * if (height !== null) console.log("door height:", height)
97
+ * ```
98
+ */
99
+ public abstract getHeight(door: ComponentHandle): PluginApiReturn<number | null>
100
+
101
+ /**
102
+ * Get the floor a door is hosted on — the storey/level component that
103
+ * supports the door.
104
+ *
105
+ * @param door The door to query
106
+ * @returns The support floor {@linkcode ComponentHandle}, or `null`
107
+ *
108
+ * @examplePrompt Which floor is this door on?
109
+ * @examplePrompt What storey does the selected door belong to?
110
+ * @examplePrompt Find the level that hosts this door
111
+ * @examplePrompt Tell me which floor the entrance door sits on
112
+ *
113
+ * # Example
114
+ * ```ts
115
+ * const [door] = await snaptrude.design.query.listDoors({ isSelected: true })
116
+ * const floor = await snaptrude.design.doors.getSupportFloor(door)
117
+ * if (floor) {
118
+ * const props = await snaptrude.design.query.getProperties(floor)
119
+ * console.log("hosted on storey:", props.storey)
120
+ * }
121
+ * ```
122
+ */
123
+ public abstract getSupportFloor(door: ComponentHandle): PluginApiReturn<ComponentHandle | null>
124
+
125
+ /**
126
+ * Get a door's swing (hinge) handedness — whether it opens as a left-hand or
127
+ * right-hand door. Derived from the door mesh's reflection state, not a
128
+ * persisted field.
129
+ *
130
+ * @param door The door to query
131
+ * @returns `'left'` / `'right'`, or `null` if indeterminate
132
+ *
133
+ * @examplePrompt Which way does this door swing?
134
+ * @examplePrompt Is the selected door left-handed or right-handed?
135
+ * @examplePrompt Check the hinge side of this door
136
+ * @examplePrompt Does the entrance door open to the left or the right?
137
+ *
138
+ * # Example
139
+ * ```ts
140
+ * const [door] = await snaptrude.design.query.listDoors({ isSelected: true })
141
+ * const swing = await snaptrude.design.doors.getSwingDirection(door)
142
+ * if (swing) console.log("opens as a", swing, "hand door")
143
+ * ```
144
+ */
145
+ public abstract getSwingDirection(
146
+ door: ComponentHandle
147
+ ): PluginApiReturn<"left" | "right" | null>
148
+
149
+ /**
150
+ * Mirror a door across an axis, flipping its swing so it opens from the
151
+ * other side. Undoable as a single command.
152
+ *
153
+ * @param door The door to mirror
154
+ * @param axis Reflection axis (optional; default `'x'` — the swing-flip axis)
155
+ * @returns The affected door(s)
156
+ *
157
+ * @examplePrompt Flip this door's swing
158
+ * @examplePrompt Mirror the selected door
159
+ * @examplePrompt Make this door open the other way
160
+ * @examplePrompt Reverse the hinge side of the entrance door
161
+ * @examplePrompt Change the door to swing from the other side
162
+ *
163
+ * # Example
164
+ * ```ts
165
+ * // Flip the selected door's swing — axis defaults to "x" (the swing-flip
166
+ * // axis); pass "y" or "z" to reflect across a different axis
167
+ * const [door] = await snaptrude.design.query.listDoors({ isSelected: true })
168
+ * const { affected } = await snaptrude.design.doors.mirror(door)
169
+ * ```
170
+ */
171
+ public abstract mirror(
172
+ door: ComponentHandle,
173
+ axis?: PluginMirrorAxis
174
+ ): PluginApiReturn<PluginDesignChangeResult>
175
+
176
+ /**
177
+ * Set the width of one or more doors, resizing each opening and re-cutting
178
+ * the host wall. Width is in engine units; the change is undoable.
179
+ *
180
+ * @param doors The doors to resize
181
+ * @param width New width (engine units)
182
+ * @returns The affected doors
183
+ *
184
+ * @examplePrompt Make this door 900mm wide
185
+ * @examplePrompt Widen the selected doors to 1 metre
186
+ * @examplePrompt Change the door width to 3 feet
187
+ * @examplePrompt Resize all the bathroom doors to 750 wide
188
+ * @examplePrompt Narrow the entrance door a bit
189
+ *
190
+ * # Example
191
+ * ```ts
192
+ * // Resize every ground-floor door to a common width (engine units)
193
+ * const doors = await snaptrude.design.query.listDoors({ storeys: [1] })
194
+ * const { affected } = await snaptrude.design.doors.setWidth(doors, 900)
195
+ * console.log("resized", affected.length, "doors")
196
+ * ```
197
+ */
198
+ public abstract setWidth(
199
+ doors: ComponentHandle[],
200
+ width: number
201
+ ): PluginApiReturn<PluginDesignChangeResult>
202
+
203
+ /**
204
+ * Set the height of one or more doors, resizing each opening and re-cutting
205
+ * the host wall. Height is in engine units; the change is undoable.
206
+ *
207
+ * @param doors The doors to resize
208
+ * @param height New height (engine units)
209
+ * @returns The affected doors
210
+ *
211
+ * @examplePrompt Make this door 2100mm tall
212
+ * @examplePrompt Change the door height to 7 feet
213
+ * @examplePrompt Raise the selected doors to 2.4m high
214
+ * @examplePrompt Set all the doors on this storey to 2100 high
215
+ *
216
+ * # Example
217
+ * ```ts
218
+ * // setHeight takes an array — wrap a single door
219
+ * const [door] = await snaptrude.design.query.listDoors({ isSelected: true })
220
+ * await snaptrude.design.doors.setHeight([door], 2100)
221
+ * ```
222
+ */
223
+ public abstract setHeight(
224
+ doors: ComponentHandle[],
225
+ height: number
226
+ ): PluginApiReturn<PluginDesignChangeResult>
227
+ }
228
+
229
+ /**
230
+ * Arguments for the single-door read methods.
231
+ *
232
+ * | Property | Type | Description |
233
+ * |---|---|---|
234
+ * | `door` | {@linkcode ComponentHandle} | The door to query |
235
+ */
236
+ export const PluginDesignDoorArgs = z.object({
237
+ door: ComponentHandle,
238
+ })
239
+ export type PluginDesignDoorArgs = z.infer<typeof PluginDesignDoorArgs>
240
+
241
+ /** Mirror axis — tokens mirror the engine `FlipDirection` verbatim (§6.1). */
242
+ export const PluginMirrorAxis = z.enum(["x", "y", "z"])
243
+ export type PluginMirrorAxis = z.infer<typeof PluginMirrorAxis>
244
+
245
+ /**
246
+ * Arguments for {@linkcode PluginDesignDoorsApi.mirror}.
247
+ *
248
+ * | Property | Type | Description |
249
+ * |---|---|---|
250
+ * | `door` | {@linkcode ComponentHandle} | The door to mirror |
251
+ * | `axis` | {@linkcode PluginMirrorAxis} | Reflection axis (optional; default `'x'` — the swing-flip axis) |
252
+ */
253
+ export const PluginDesignDoorMirrorArgs = z.object({
254
+ door: ComponentHandle,
255
+ axis: PluginMirrorAxis.optional(),
256
+ })
257
+ export type PluginDesignDoorMirrorArgs = z.infer<typeof PluginDesignDoorMirrorArgs>
258
+
259
+ /**
260
+ * Arguments for {@linkcode PluginDesignDoorsApi.setWidth}.
261
+ *
262
+ * | Property | Type | Description |
263
+ * |---|---|---|
264
+ * | `doors` | {@linkcode ComponentHandle}`[]` | The doors to resize |
265
+ * | `width` | `number` | New width (engine units) |
266
+ */
267
+ export const PluginDesignDoorSetWidthArgs = z.object({
268
+ doors: z.array(ComponentHandle),
269
+ width: z.number(),
270
+ })
271
+ export type PluginDesignDoorSetWidthArgs = z.infer<typeof PluginDesignDoorSetWidthArgs>
272
+
273
+ /**
274
+ * Arguments for {@linkcode PluginDesignDoorsApi.setHeight}.
275
+ *
276
+ * | Property | Type | Description |
277
+ * |---|---|---|
278
+ * | `doors` | {@linkcode ComponentHandle}`[]` | The doors to resize |
279
+ * | `height` | `number` | New height (engine units) |
280
+ */
281
+ export const PluginDesignDoorSetHeightArgs = z.object({
282
+ doors: z.array(ComponentHandle),
283
+ height: z.number(),
284
+ })
285
+ export type PluginDesignDoorSetHeightArgs = z.infer<typeof PluginDesignDoorSetHeightArgs>
@@ -0,0 +1,54 @@
1
+ import * as z from "zod"
2
+ import { PluginApiReturn } from "../../../types"
3
+ import { ComponentHandle, Vec3Handle } from "../../../handles"
4
+ import { OffsetSplitOutcome } from "../shared"
5
+
6
+ /**
7
+ * STAGED (LLD Wave 2) — abstract shell only. NOT yet wired into `PluginDesignApi`
8
+ * and has no host implementation. `offsetSplit` migrates off `tools.offset` (adding
9
+ * the previously-dropped `offsetValue` to the result).
10
+ *
11
+ * `snaptrude.design.edit` — non-create geometry edits (offset-split, and later
12
+ * push-pull / topology edits). Undoable.
13
+ *
14
+ * TRANSPORT: positional args per method.
15
+ */
16
+ export abstract class PluginDesignEditApi {
17
+ constructor() {}
18
+
19
+ /**
20
+ * Offset the top profile of a component by a distance and split the face along
21
+ * the offset curve. Positive distances offset outward, negative inward.
22
+ * Single-component only (the engine rejects batches).
23
+ * @param component - The component whose top profile is offset-split.
24
+ * @param offsetDistance - Offset distance; positive = outward, negative = inward.
25
+ * @param options - Optional settings: `profilePickPoint` picks the profile when ambiguous.
26
+ * @returns {@linkcode OffsetSplitOutcome} `{ createdIds, deletedIds, offsetValue }`
27
+ *
28
+ * @examplePrompt Offset the top face of this mass inward by 2 metres and split it
29
+ * @examplePrompt Create a 1m setback border on top of the selected mass
30
+ * @examplePrompt Split the roof profile with a 500mm inward offset
31
+ * @examplePrompt Offset-split the slab's top profile outward by 3 feet
32
+ *
33
+ * # Example
34
+ * ```ts
35
+ * // Offset the top profile inward by 2 units and split the face along it
36
+ * const [mass] = await snaptrude.design.query.listMasses()
37
+ * const { createdIds, offsetValue } = await snaptrude.design.edit.offsetSplit(mass, -2)
38
+ * // offsetValue is the post-clamp distance the engine actually applied
39
+ * ```
40
+ */
41
+ public abstract offsetSplit(
42
+ component: ComponentHandle,
43
+ offsetDistance: number,
44
+ options?: { profilePickPoint?: Vec3Handle },
45
+ ): PluginApiReturn<OffsetSplitOutcome>
46
+ }
47
+
48
+ // Positional target: offsetSplit(component, offsetDistance, options?)
49
+ export const PluginDesignOffsetSplitArgs = z.object({
50
+ component: ComponentHandle,
51
+ offsetDistance: z.number(),
52
+ profilePickPoint: Vec3Handle.optional(),
53
+ })
54
+ export type PluginDesignOffsetSplitArgs = z.infer<typeof PluginDesignOffsetSplitArgs>
@@ -0,0 +1,151 @@
1
+ import * as z from "zod"
2
+ import { PluginApiReturn } from "../../../types"
3
+ import { ComponentHandle, Vec3Handle } from "../../../handles"
4
+
5
+ /**
6
+ * The erase strategies exposed to plugins. `SplitAndUnion` is *enumerable* but
7
+ * NOT committable via {@linkcode PluginDesignEraseApi.edge} (it needs an
8
+ * interactive screen-space re-pick); `SplitAndDelete` is reserved in the engine
9
+ * and intentionally omitted. Derived host-side by the engine's `decideStrategy`.
10
+ */
11
+ export const EraseStrategy = z.enum(["DirectDelete", "DirectUnion", "SplitAndUnion"])
12
+ export type EraseStrategy = z.infer<typeof EraseStrategy>
13
+
14
+ /** Default enumerated strategies — the two the scripted `edge()` can commit. */
15
+ export const DEFAULT_ERASE_STRATEGIES: readonly EraseStrategy[] = ["DirectDelete", "DirectUnion"]
16
+
17
+ /**
18
+ * A **transient** reference to one erasable edge in the current plan's
19
+ * bottom-adjacency graph.
20
+ *
21
+ * ⚠️ **Lifetime**: valid ONLY until the next geometry-modifying operation. Any
22
+ * mutation (erase, boolean, transform, create, delete, …) rebuilds the adjacency
23
+ * graph and invalidates every previously-returned ref. Passing a stale ref to
24
+ * {@linkcode PluginDesignEraseApi.edge} throws `NO_STRATEGY_FOR_PICK_INFO`.
25
+ * Always re-list after a mutation.
26
+ *
27
+ * This is a by-value record (round-trip it back to `edge()` unmodified), NOT a
28
+ * registry handle. `components` and `snapPoint` are the marshalled public forms
29
+ * of the engine's raw `mesh.uniqueId` numbers / by-value point.
30
+ */
31
+ export const ErasableEdgeRef = z.object({
32
+ /** Opaque bottom-graph edge id (engine form `"e-<n>"`). Do not mutate. Pass verbatim to {@linkcode PluginDesignEraseApi.edge}. */
33
+ id: z.string().min(1),
34
+ /** What erasing this edge would do: `DirectDelete` drops a mass; `DirectUnion` merges two adjacent masses. */
35
+ strategy: EraseStrategy,
36
+ /** Bottom-graph edge weight: `1` = external boundary edge, `>=2` = internal edge shared between components. */
37
+ edgeWeight: z.number(),
38
+ /** The components this edge is incident to — one for external (DirectDelete); two or more for internal (DirectUnion; 3+ at T-junctions where several masses share the edge). */
39
+ components: z.array(ComponentHandle),
40
+ /** A representative point on the edge (its head endpoint). Diagnostic only. */
41
+ snapPoint: Vec3Handle,
42
+ })
43
+ export type ErasableEdgeRef = z.infer<typeof ErasableEdgeRef>
44
+
45
+ /**
46
+ * Options for {@linkcode PluginDesignEraseApi.listErasableEdges}.
47
+ *
48
+ * | Property | Type | Description |
49
+ * |---|---|---|
50
+ * | `components` | {@linkcode ComponentHandle}`[]?` | Restrict to edges adjacent to at least one of these entities |
51
+ * | `strategies` | {@linkcode EraseStrategy}`[]?` | Restrict to these strategies. Default `["DirectDelete","DirectUnion"]` (hides interactive-only `SplitAndUnion`) |
52
+ *
53
+ * TRANSPORT: positional now — `listErasableEdges(options?)`; this schema is
54
+ * retained for host-side validation.
55
+ */
56
+ export const PluginDesignListErasableEdgesArgs = z.object({
57
+ components: z.array(ComponentHandle).optional(),
58
+ strategies: z.array(EraseStrategy).optional(),
59
+ })
60
+ export type PluginDesignListErasableEdgesArgs = z.infer<typeof PluginDesignListErasableEdgesArgs>
61
+
62
+ /**
63
+ * Arguments for {@linkcode PluginDesignEraseApi.edge}.
64
+ *
65
+ * TRANSPORT: positional now — `edge(edge: ErasableEdgeRef)`; this schema is
66
+ * retained for host-side validation.
67
+ */
68
+ export const PluginDesignEraseEdgeArgs = z.object({
69
+ edge: ErasableEdgeRef,
70
+ })
71
+ export type PluginDesignEraseEdgeArgs = z.infer<typeof PluginDesignEraseEdgeArgs>
72
+
73
+ /** Result of {@linkcode PluginDesignEraseApi.edge} — success sentinel; the engine yields no survivor id. */
74
+ export const PluginDesignEraseEdgeResult = z.object({ ok: z.literal(true) })
75
+ export type PluginDesignEraseEdgeResult = z.infer<typeof PluginDesignEraseEdgeResult>
76
+
77
+ /**
78
+ * `snaptrude.design.erase` — **adjacency-edge erase** (plan-level topology op).
79
+ *
80
+ * Erase is NOT delete. The erase tool operates on an **edge**, and the effect is
81
+ * derived from that edge: erasing an internal edge between two masses **unions**
82
+ * them (`DirectUnion`); erasing an external boundary edge of a single mass
83
+ * **drops** it behind the edge (`DirectDelete`). For hard entity removal use
84
+ * `design.delete.entities`; for CSG geometry delete use `design.boolean.subtract`.
85
+ *
86
+ * Two-step: {@linkcode listErasableEdges} to enumerate, then {@linkcode edge} to
87
+ * commit one ref (single undo entry). Scoped to **2D plan adjacency edges** in v1.
88
+ *
89
+ * TRANSPORT: positional args per method.
90
+ */
91
+ export abstract class PluginDesignEraseApi {
92
+ constructor() {}
93
+
94
+ /**
95
+ * Enumerate every erasable edge in the current plan's bottom-adjacency graph
96
+ * (one {@linkcode ErasableEdgeRef} per edge). Pure read — no scene mutation, no
97
+ * command, not undoable. Erase-ineligible components (locked, hidden, off-storey)
98
+ * are filtered out.
99
+ *
100
+ * ⚠️ Returned refs are **transient** — see {@linkcode ErasableEdgeRef}. Re-list
101
+ * after any geometry mutation.
102
+ *
103
+ * @param options - {@linkcode PluginDesignListErasableEdgesArgs} — optional filters (`components`, `strategies`)
104
+ * @returns The erasable edges (`[]` when none) — never `null`.
105
+ *
106
+ * @examplePrompt Which edges in my floor plan can be erased?
107
+ * @examplePrompt List the erasable edges on this storey
108
+ * @examplePrompt Show me the shared edges I could erase to merge rooms
109
+ * @examplePrompt What edges between these two spaces can be removed?
110
+ *
111
+ * # Example
112
+ * ```ts
113
+ * const edges = await snaptrude.design.erase.listErasableEdges()
114
+ * const union = edges.find((e) => e.strategy === "DirectUnion")
115
+ * if (union) await snaptrude.design.erase.edge(union)
116
+ * ```
117
+ */
118
+ public abstract listErasableEdges(
119
+ options?: PluginDesignListErasableEdgesArgs,
120
+ ): PluginApiReturn<ErasableEdgeRef[]>
121
+
122
+ /**
123
+ * Commit the erase for one edge. `DirectUnion` merges the two adjacent masses;
124
+ * `DirectDelete` drops the single mass behind the boundary edge. Single undo entry.
125
+ *
126
+ * Pass an {@linkcode ErasableEdgeRef} from {@linkcode listErasableEdges}
127
+ * unmodified. A stale ref (graph rebuilt by a prior mutation) or a `SplitAndUnion`
128
+ * edge throws.
129
+ *
130
+ * @param edge - The {@linkcode ErasableEdgeRef} to erase, from {@linkcode listErasableEdges} unmodified
131
+ * @returns `{ ok: true }` on success (the engine yields no survivor id today).
132
+ * @throws when the ref is stale, its components are all erase-ineligible, or the
133
+ * strategy is not committable via the scripted path.
134
+ *
135
+ * @examplePrompt Erase the edge between these two rooms so they merge
136
+ * @examplePrompt Remove the shared boundary between the kitchen and the dining space
137
+ * @examplePrompt Merge the two adjacent rooms by erasing their common edge
138
+ * @examplePrompt Knock through the partition line between these spaces
139
+ * @examplePrompt Erase this boundary edge from the plan
140
+ *
141
+ * # Example
142
+ * ```ts
143
+ * // Merge two adjacent rooms by erasing an internal edge they share
144
+ * const edges = await snaptrude.design.erase.listErasableEdges({ strategies: ["DirectUnion"] })
145
+ * if (edges.length > 0) {
146
+ * const { ok } = await snaptrude.design.erase.edge(edges[0])
147
+ * }
148
+ * ```
149
+ */
150
+ public abstract edge(edge: ErasableEdgeRef): PluginApiReturn<PluginDesignEraseEdgeResult>
151
+ }
@@ -0,0 +1,130 @@
1
+ import * as z from "zod"
2
+ import { PluginApiReturn } from "../../../types"
3
+
4
+ /**
5
+ * `snaptrude.design.furniture` — the placeable furniture **catalog** (a library of
6
+ * source items, NOT scene entities). Placement lives at `design.create.furniture`
7
+ * (returns a {@linkcode ComponentHandle}); reads of placed furniture live at
8
+ * `design.query.listFurniture`/`getProperties`.
9
+ *
10
+ * Catalog items are plain value records ({@linkcode PluginFurnitureCatalogItem}) keyed
11
+ * by a library id (team `_id` or general `fullName`) — not handles. Reads are async
12
+ * (network-backed) but carry no `Async` suffix (§6.6).
13
+ */
14
+ export abstract class PluginDesignFurnitureApi {
15
+ constructor() {}
16
+
17
+ /**
18
+ * List the placeable furniture catalog (team + general libraries).
19
+ * @param source Restrict to one library (optional)
20
+ * @returns The catalog as {@linkcode PluginFurnitureCatalogItem}`[]` (`[]` when empty)
21
+ *
22
+ * @examplePrompt What furniture can I place in this project?
23
+ * @examplePrompt Show me all the furniture available in the library
24
+ * @examplePrompt List the chairs and tables I can add to the model
25
+ * @examplePrompt Which furniture items are in my team's library?
26
+ * @examplePrompt Browse the furniture catalog
27
+ *
28
+ * # Example
29
+ * ```ts
30
+ * const teamItems = await snaptrude.design.furniture.listCatalog("team")
31
+ * for (const item of teamItems) console.log(item.id, item.name, item.cost)
32
+ * ```
33
+ */
34
+ public abstract listCatalog(
35
+ source?: "team" | "general"
36
+ ): PluginApiReturn<PluginFurnitureCatalogItem[]>
37
+
38
+ /**
39
+ * Get a single catalog item by its library id.
40
+ * @param id The catalog library id
41
+ * @returns The item, or `null` if no catalog item matches
42
+ *
43
+ * @examplePrompt Get the details of this furniture item from the library
44
+ * @examplePrompt Look up the catalog entry for this chair id
45
+ * @examplePrompt What is the cost of this furniture item?
46
+ * @examplePrompt Show me the family name of the sofa in the catalog
47
+ *
48
+ * # Example
49
+ * ```ts
50
+ * const [entry] = await snaptrude.design.furniture.listCatalog()
51
+ * const item = await snaptrude.design.furniture.getCatalogItem(entry.id)
52
+ * if (item) console.log(item.name, item.source, item.familyName)
53
+ * ```
54
+ */
55
+ public abstract getCatalogItem(
56
+ id: string
57
+ ): PluginApiReturn<PluginFurnitureCatalogItem | null>
58
+
59
+ /**
60
+ * Test whether a catalog item exists for the given library id.
61
+ * @param id The catalog library id
62
+ * @returns `true` if it exists, otherwise `false`
63
+ *
64
+ * @examplePrompt Is this furniture item still in the library?
65
+ * @examplePrompt Check whether a catalog item with this id exists
66
+ * @examplePrompt Does my team library have this chair?
67
+ * @examplePrompt Verify the sofa is available in the catalog before placing it
68
+ *
69
+ * # Example
70
+ * ```ts
71
+ * const [entry] = await snaptrude.design.furniture.listCatalog()
72
+ * const stillAvailable = await snaptrude.design.furniture.exists(entry.id)
73
+ * console.log(stillAvailable ? "safe to place" : "removed from library")
74
+ * ```
75
+ */
76
+ public abstract exists(id: string): PluginApiReturn<boolean>
77
+ }
78
+
79
+ /**
80
+ * A placeable furniture catalog item (value record — not a scene entity/handle).
81
+ *
82
+ * | Property | Type | Description |
83
+ * |---|---|---|
84
+ * | `id` | `string` | Library id (team `_id` or general `fullName`) — pass to `design.create.furniture` |
85
+ * | `name` | `string` | Display name |
86
+ * | `source` | `'team' \| 'general'` | Which library it came from |
87
+ * | `subType` | `string` | Sub-type (optional) |
88
+ * | `cost` | `number` | Cost (optional; team items) |
89
+ * | `familyName` | `string` | Family name (optional) |
90
+ */
91
+ export const PluginFurnitureCatalogItem = z.object({
92
+ id: z.string(),
93
+ name: z.string(),
94
+ source: z.enum(["team", "general"]),
95
+ subType: z.string().optional(),
96
+ cost: z.number().optional(),
97
+ familyName: z.string().optional(),
98
+ })
99
+ export type PluginFurnitureCatalogItem = z.infer<typeof PluginFurnitureCatalogItem>
100
+
101
+ /**
102
+ * Arguments for {@linkcode PluginDesignFurnitureApi.listCatalog}.
103
+ *
104
+ * | Property | Type | Description |
105
+ * |---|---|---|
106
+ * | `source` | `'team' \| 'general'` | Restrict to one library (optional) |
107
+ */
108
+ export const PluginDesignFurnitureListCatalogArgs = z.object({
109
+ source: z.enum(["team", "general"]).optional(),
110
+ })
111
+ export type PluginDesignFurnitureListCatalogArgs = z.infer<
112
+ typeof PluginDesignFurnitureListCatalogArgs
113
+ >
114
+
115
+ /**
116
+ * Arguments for {@linkcode PluginDesignFurnitureApi.getCatalogItem} / {@linkcode PluginDesignFurnitureApi.exists}.
117
+ *
118
+ * | Property | Type | Description |
119
+ * |---|---|---|
120
+ * | `id` | `string` | The catalog library id |
121
+ */
122
+ export const PluginDesignFurnitureGetCatalogItemArgs = z.object({
123
+ id: z.string(),
124
+ })
125
+ export type PluginDesignFurnitureGetCatalogItemArgs = z.infer<
126
+ typeof PluginDesignFurnitureGetCatalogItemArgs
127
+ >
128
+
129
+ export const PluginDesignFurnitureExistsArgs = PluginDesignFurnitureGetCatalogItemArgs
130
+ export type PluginDesignFurnitureExistsArgs = z.infer<typeof PluginDesignFurnitureExistsArgs>