@snaptrude/plugin-core 0.3.0 → 0.5.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 (266) hide show
  1. package/AGENTS.md +130 -48
  2. package/CHANGELOG.md +111 -0
  3. package/api-manifest.full.json +3999 -0
  4. package/api-manifest.json +3845 -0
  5. package/dist/api/core/buildings.d.ts +427 -0
  6. package/dist/api/core/buildings.d.ts.map +1 -0
  7. package/dist/api/core/comment/index.d.ts +230 -0
  8. package/dist/api/core/comment/index.d.ts.map +1 -0
  9. package/dist/api/core/geom/create/index.d.ts +247 -0
  10. package/dist/api/core/geom/create/index.d.ts.map +1 -0
  11. package/dist/api/core/geom/delete/index.d.ts +72 -0
  12. package/dist/api/core/geom/delete/index.d.ts.map +1 -0
  13. package/dist/api/core/geom/index.d.ts +24 -23
  14. package/dist/api/core/geom/index.d.ts.map +1 -1
  15. package/dist/api/core/geom/query/arc.d.ts +169 -0
  16. package/dist/api/core/geom/query/arc.d.ts.map +1 -0
  17. package/dist/api/core/geom/query/brep.d.ts +402 -0
  18. package/dist/api/core/geom/query/brep.d.ts.map +1 -0
  19. package/dist/api/core/geom/query/circle.d.ts +378 -0
  20. package/dist/api/core/geom/query/circle.d.ts.map +1 -0
  21. package/dist/api/core/geom/query/contour.d.ts +450 -0
  22. package/dist/api/core/geom/query/contour.d.ts.map +1 -0
  23. package/dist/api/core/geom/query/curve.d.ts +918 -0
  24. package/dist/api/core/geom/query/curve.d.ts.map +1 -0
  25. package/dist/api/core/geom/query/edge.d.ts +128 -0
  26. package/dist/api/core/geom/query/edge.d.ts.map +1 -0
  27. package/dist/api/core/geom/query/face.d.ts +363 -0
  28. package/dist/api/core/geom/query/face.d.ts.map +1 -0
  29. package/dist/api/core/geom/query/halfedge.d.ts +206 -0
  30. package/dist/api/core/geom/query/halfedge.d.ts.map +1 -0
  31. package/dist/api/core/geom/query/index.d.ts +61 -0
  32. package/dist/api/core/geom/query/index.d.ts.map +1 -0
  33. package/dist/api/core/geom/query/profile.d.ts +410 -0
  34. package/dist/api/core/geom/query/profile.d.ts.map +1 -0
  35. package/dist/api/core/geom/query/vertex.d.ts +187 -0
  36. package/dist/api/core/geom/query/vertex.d.ts.map +1 -0
  37. package/dist/api/core/geom/update/contour.d.ts +272 -0
  38. package/dist/api/core/geom/update/contour.d.ts.map +1 -0
  39. package/dist/api/core/geom/update/curve.d.ts +180 -0
  40. package/dist/api/core/geom/update/curve.d.ts.map +1 -0
  41. package/dist/api/core/geom/update/index.d.ts +27 -0
  42. package/dist/api/core/geom/update/index.d.ts.map +1 -0
  43. package/dist/api/core/geom/update/profile.d.ts +329 -0
  44. package/dist/api/core/geom/update/profile.d.ts.map +1 -0
  45. package/dist/api/core/groups.d.ts +485 -0
  46. package/dist/api/core/groups.d.ts.map +1 -0
  47. package/dist/api/core/history/index.d.ts +78 -0
  48. package/dist/api/core/history/index.d.ts.map +1 -0
  49. package/dist/api/core/index.d.ts +46 -1
  50. package/dist/api/core/index.d.ts.map +1 -1
  51. package/dist/api/core/layers.d.ts +402 -0
  52. package/dist/api/core/layers.d.ts.map +1 -0
  53. package/dist/api/core/math/quat.d.ts +111 -128
  54. package/dist/api/core/math/quat.d.ts.map +1 -1
  55. package/dist/api/core/math/vec3.d.ts +120 -102
  56. package/dist/api/core/math/vec3.d.ts.map +1 -1
  57. package/dist/api/core/project/index.d.ts +399 -0
  58. package/dist/api/core/project/index.d.ts.map +1 -0
  59. package/dist/api/core/tags.d.ts +755 -0
  60. package/dist/api/core/tags.d.ts.map +1 -0
  61. package/dist/api/core/units/index.d.ts +175 -0
  62. package/dist/api/core/units/index.d.ts.map +1 -0
  63. package/dist/api/core/zoom/index.d.ts +45 -0
  64. package/dist/api/core/zoom/index.d.ts.map +1 -0
  65. package/dist/api/design/boolean/index.d.ts +168 -0
  66. package/dist/api/design/boolean/index.d.ts.map +1 -0
  67. package/dist/api/design/create/index.d.ts +828 -0
  68. package/dist/api/design/create/index.d.ts.map +1 -0
  69. package/dist/api/design/delete/index.d.ts +63 -0
  70. package/dist/api/design/delete/index.d.ts.map +1 -0
  71. package/dist/api/design/doors/index.d.ts +268 -0
  72. package/dist/api/design/doors/index.d.ts.map +1 -0
  73. package/dist/api/design/edit/index.d.ts +49 -0
  74. package/dist/api/design/edit/index.d.ts.map +1 -0
  75. package/dist/api/design/erase/index.d.ts +160 -0
  76. package/dist/api/design/erase/index.d.ts.map +1 -0
  77. package/dist/api/design/furniture/index.d.ts +123 -0
  78. package/dist/api/design/furniture/index.d.ts.map +1 -0
  79. package/dist/api/design/index.d.ts +153 -0
  80. package/dist/api/design/index.d.ts.map +1 -0
  81. package/dist/api/design/lock.d.ts +41 -0
  82. package/dist/api/design/lock.d.ts.map +1 -0
  83. package/dist/api/design/materials/index.d.ts +297 -0
  84. package/dist/api/design/materials/index.d.ts.map +1 -0
  85. package/dist/api/design/query/geometry/index.d.ts +140 -0
  86. package/dist/api/design/query/geometry/index.d.ts.map +1 -0
  87. package/dist/api/design/query/index.d.ts +1011 -0
  88. package/dist/api/design/query/index.d.ts.map +1 -0
  89. package/dist/api/design/query/spaces.d.ts +221 -0
  90. package/dist/api/design/query/spaces.d.ts.map +1 -0
  91. package/dist/api/design/selection/index.d.ts +138 -0
  92. package/dist/api/design/selection/index.d.ts.map +1 -0
  93. package/dist/api/design/shared.d.ts +38 -0
  94. package/dist/api/design/shared.d.ts.map +1 -0
  95. package/dist/api/design/transform/index.d.ts +87 -0
  96. package/dist/api/design/transform/index.d.ts.map +1 -0
  97. package/dist/api/design/update/index.d.ts +178 -0
  98. package/dist/api/design/update/index.d.ts.map +1 -0
  99. package/dist/api/design/windows/index.d.ts +189 -0
  100. package/dist/api/design/windows/index.d.ts.map +1 -0
  101. package/dist/api/entity/buildableEnvelope.d.ts +261 -0
  102. package/dist/api/entity/buildableEnvelope.d.ts.map +1 -0
  103. package/dist/api/entity/department.d.ts +0 -98
  104. package/dist/api/entity/department.d.ts.map +1 -1
  105. package/dist/api/entity/index.d.ts +9 -9
  106. package/dist/api/entity/index.d.ts.map +1 -1
  107. package/dist/api/entity/referenceLine.d.ts +49 -106
  108. package/dist/api/entity/referenceLine.d.ts.map +1 -1
  109. package/dist/api/entity/space.d.ts +482 -249
  110. package/dist/api/entity/space.d.ts.map +1 -1
  111. package/dist/api/entity/story.d.ts +49 -39
  112. package/dist/api/entity/story.d.ts.map +1 -1
  113. package/dist/api/index.d.ts +17 -12
  114. package/dist/api/index.d.ts.map +1 -1
  115. package/dist/api/presentation/aiInspiration.d.ts +440 -0
  116. package/dist/api/presentation/aiInspiration.d.ts.map +1 -0
  117. package/dist/api/presentation/diagrams.d.ts +81 -0
  118. package/dist/api/presentation/diagrams.d.ts.map +1 -0
  119. package/dist/api/presentation/import.d.ts +113 -0
  120. package/dist/api/presentation/import.d.ts.map +1 -0
  121. package/dist/api/presentation/index.d.ts +46 -0
  122. package/dist/api/presentation/index.d.ts.map +1 -0
  123. package/dist/api/presentation/sheets.d.ts +176 -0
  124. package/dist/api/presentation/sheets.d.ts.map +1 -0
  125. package/dist/api/presentation/views.d.ts +296 -0
  126. package/dist/api/presentation/views.d.ts.map +1 -0
  127. package/dist/api/program/adjacency.d.ts +155 -0
  128. package/dist/api/program/adjacency.d.ts.map +1 -0
  129. package/dist/api/program/areas.d.ts +360 -0
  130. package/dist/api/program/areas.d.ts.map +1 -0
  131. package/dist/api/program/classification.d.ts +135 -0
  132. package/dist/api/program/classification.d.ts.map +1 -0
  133. package/dist/api/program/cores.d.ts +174 -0
  134. package/dist/api/program/cores.d.ts.map +1 -0
  135. package/dist/api/program/departments.d.ts +431 -0
  136. package/dist/api/program/departments.d.ts.map +1 -0
  137. package/dist/api/program/index.d.ts +69 -0
  138. package/dist/api/program/index.d.ts.map +1 -0
  139. package/dist/api/program/layout.d.ts +63 -0
  140. package/dist/api/program/layout.d.ts.map +1 -0
  141. package/dist/api/program/metrics.d.ts +108 -0
  142. package/dist/api/program/metrics.d.ts.map +1 -0
  143. package/dist/api/program/site.d.ts +367 -0
  144. package/dist/api/program/site.d.ts.map +1 -0
  145. package/dist/api/program/spreadsheet.d.ts +2041 -0
  146. package/dist/api/program/spreadsheet.d.ts.map +1 -0
  147. package/dist/handles.d.ts +138 -0
  148. package/dist/handles.d.ts.map +1 -0
  149. package/dist/host-utils.d.ts +7 -5
  150. package/dist/host-utils.d.ts.map +1 -1
  151. package/dist/index.cjs +4001 -904
  152. package/dist/index.cjs.map +1 -1
  153. package/dist/index.d.ts +1 -0
  154. package/dist/index.d.ts.map +1 -1
  155. package/dist/index.js +3392 -870
  156. package/dist/index.js.map +1 -1
  157. package/package.json +6 -2
  158. package/scripts/generate-manifest.mjs +193 -0
  159. package/scripts/generate-manifest.test.mjs +193 -0
  160. package/src/api/core/buildings.ts +485 -0
  161. package/src/api/core/comment/index.ts +258 -0
  162. package/src/api/core/geom/create/index.ts +293 -0
  163. package/src/api/core/geom/delete/index.ts +78 -0
  164. package/src/api/core/geom/index.ts +24 -23
  165. package/src/api/core/geom/query/arc.ts +169 -0
  166. package/src/api/core/geom/query/brep.ts +444 -0
  167. package/src/api/core/geom/query/circle.ts +404 -0
  168. package/src/api/core/geom/query/contour.ts +540 -0
  169. package/src/api/core/geom/query/curve.ts +1078 -0
  170. package/src/api/core/geom/query/edge.ts +130 -0
  171. package/src/api/core/geom/query/face.ts +403 -0
  172. package/src/api/core/geom/query/halfedge.ts +210 -0
  173. package/src/api/core/geom/query/index.ts +63 -0
  174. package/src/api/core/geom/query/profile.ts +473 -0
  175. package/src/api/core/geom/query/vertex.ts +205 -0
  176. package/src/api/core/geom/update/contour.ts +315 -0
  177. package/src/api/core/geom/update/curve.ts +209 -0
  178. package/src/api/core/geom/update/index.ts +29 -0
  179. package/src/api/core/geom/update/profile.ts +377 -0
  180. package/src/api/core/groups.ts +521 -0
  181. package/src/api/core/history/index.ts +84 -0
  182. package/src/api/core/index.ts +46 -1
  183. package/src/api/core/layers.ts +333 -0
  184. package/src/api/core/math/quat.ts +112 -235
  185. package/src/api/core/math/vec3.ts +124 -159
  186. package/src/api/core/project/index.ts +418 -0
  187. package/src/api/core/tags.ts +808 -0
  188. package/src/api/core/units/index.ts +164 -0
  189. package/src/api/core/zoom/index.ts +47 -0
  190. package/src/api/design/boolean/index.ts +179 -0
  191. package/src/api/design/create/index.ts +886 -0
  192. package/src/api/design/delete/index.ts +67 -0
  193. package/src/api/design/doors/index.ts +285 -0
  194. package/src/api/design/edit/index.ts +54 -0
  195. package/src/api/design/erase/index.ts +151 -0
  196. package/src/api/design/furniture/index.ts +130 -0
  197. package/src/api/design/index.ts +162 -0
  198. package/src/api/design/lock.ts +42 -0
  199. package/src/api/design/materials/index.ts +301 -0
  200. package/src/api/design/query/geometry/index.ts +166 -0
  201. package/src/api/design/query/index.ts +937 -0
  202. package/src/api/design/query/spaces.ts +132 -0
  203. package/src/api/design/selection/index.ts +144 -0
  204. package/src/api/design/shared.ts +40 -0
  205. package/src/api/design/transform/index.ts +93 -0
  206. package/src/api/design/update/index.ts +117 -0
  207. package/src/api/design/windows/index.ts +207 -0
  208. package/src/api/entity/buildableEnvelope.ts +318 -0
  209. package/src/api/entity/department.ts +0 -113
  210. package/src/api/entity/index.ts +9 -9
  211. package/src/api/entity/referenceLine.ts +50 -38
  212. package/src/api/entity/space.ts +285 -226
  213. package/src/api/entity/story.ts +53 -42
  214. package/src/api/index.ts +17 -12
  215. package/src/api/presentation/aiInspiration.ts +362 -0
  216. package/src/api/presentation/diagrams.ts +84 -0
  217. package/src/api/presentation/import.ts +112 -0
  218. package/src/api/presentation/index.ts +48 -0
  219. package/src/api/presentation/sheets.ts +198 -0
  220. package/src/api/presentation/views.ts +303 -0
  221. package/src/api/program/adjacency.ts +164 -0
  222. package/src/api/program/areas.ts +335 -0
  223. package/src/api/program/classification.ts +138 -0
  224. package/src/api/program/cores.ts +171 -0
  225. package/src/api/program/departments.ts +465 -0
  226. package/src/api/program/index.ts +71 -0
  227. package/src/api/program/layout.ts +68 -0
  228. package/src/api/program/metrics.ts +120 -0
  229. package/src/api/program/site.ts +326 -0
  230. package/src/api/program/spreadsheet.ts +2075 -0
  231. package/src/handles.ts +148 -0
  232. package/src/host-utils.ts +10 -6
  233. package/src/index.ts +1 -0
  234. package/dist/api/core/geom/arc.d.ts +0 -81
  235. package/dist/api/core/geom/arc.d.ts.map +0 -1
  236. package/dist/api/core/geom/curve.d.ts +0 -70
  237. package/dist/api/core/geom/curve.d.ts.map +0 -1
  238. package/dist/api/core/geom/line.d.ts +0 -56
  239. package/dist/api/core/geom/line.d.ts.map +0 -1
  240. package/dist/api/core/geom/profile.d.ts +0 -121
  241. package/dist/api/core/geom/profile.d.ts.map +0 -1
  242. package/dist/api/tools/copy.d.ts +0 -59
  243. package/dist/api/tools/copy.d.ts.map +0 -1
  244. package/dist/api/tools/index.d.ts +0 -33
  245. package/dist/api/tools/index.d.ts.map +0 -1
  246. package/dist/api/tools/material.d.ts +0 -51
  247. package/dist/api/tools/material.d.ts.map +0 -1
  248. package/dist/api/tools/offset.d.ts +0 -43
  249. package/dist/api/tools/offset.d.ts.map +0 -1
  250. package/dist/api/tools/selection.d.ts +0 -48
  251. package/dist/api/tools/selection.d.ts.map +0 -1
  252. package/dist/api/tools/transform.d.ts +0 -114
  253. package/dist/api/tools/transform.d.ts.map +0 -1
  254. package/dist/api/units/index.d.ts +0 -163
  255. package/dist/api/units/index.d.ts.map +0 -1
  256. package/src/api/core/geom/arc.ts +0 -70
  257. package/src/api/core/geom/curve.ts +0 -41
  258. package/src/api/core/geom/line.ts +0 -53
  259. package/src/api/core/geom/profile.ts +0 -94
  260. package/src/api/tools/copy.ts +0 -55
  261. package/src/api/tools/index.ts +0 -39
  262. package/src/api/tools/material.ts +0 -49
  263. package/src/api/tools/offset.ts +0 -43
  264. package/src/api/tools/selection.ts +0 -51
  265. package/src/api/tools/transform.ts +0 -117
  266. package/src/api/units/index.ts +0 -163
@@ -0,0 +1,808 @@
1
+ import * as z from "zod"
2
+ import { PluginApiReturn } from "../../types"
3
+ import { ComponentHandle } from "../../handles"
4
+
5
+ /**
6
+ * Tags — read and edit the tag catalog and its assignments.
7
+ *
8
+ * A **tag** is a colored label that lives in a **category**; a space carries at
9
+ * most one tag per category. This namespace is the catalog + assignment surface:
10
+ * the categories and tags themselves, which components carry which tags, and the
11
+ * assign/unassign operations. Tags attach to **Mass and Floor spaces only**.
12
+ *
13
+ * **Reserved sentinels.** The built-in **`DEPARTMENT`** category is owned by the
14
+ * program layer — it and the tags inside it are read-only here; create/update/
15
+ * delete reject it and direct you to {@linkcode PluginProgramApi}`.departments`.
16
+ * Every category also has a built-in **`DEFAULT`** tag that cannot be deleted;
17
+ * unassigning resets a component's category slot back to `DEFAULT` (a component
18
+ * is never left with a blank slot).
19
+ *
20
+ * Reads return plain records and never throw for a miss (`get*` return `null`,
21
+ * `list*` return `[]`). Ids are stable public strings.
22
+ *
23
+ * Sub-namespace members typed as optional (`?`) are **authored ahead of the
24
+ * host** — declared so plugins and codegen can see the shape, but kept out of the
25
+ * discovery manifest until the host lands them (at which point they are promoted
26
+ * to required `abstract` members).
27
+ *
28
+ * Accessed via `snaptrude.core.tags`.
29
+ */
30
+ export abstract class PluginCoreTagsApi {
31
+ constructor() {}
32
+
33
+ /**
34
+ * List the tag categories.
35
+ *
36
+ * @returns A {@linkcode PluginCoreTagsListCategoriesResult} with a `categories`
37
+ * array (empty when there are none), including the reserved `DEPARTMENT`
38
+ * category.
39
+ *
40
+ * @examplePrompt List all the tag categories
41
+ * @examplePrompt What tag categories do I have?
42
+ * @examplePrompt Show every category and its tags
43
+ *
44
+ * # Example
45
+ * ```ts
46
+ * const { categories } = await snaptrude.core.tags.listCategories()
47
+ * for (const c of categories) console.log(c.name, c.tagIds.length)
48
+ * ```
49
+ */
50
+ public abstract listCategories(): PluginApiReturn<PluginCoreTagsListCategoriesResult>
51
+
52
+ /**
53
+ * Get a single tag category by id.
54
+ *
55
+ * @param categoryId - The id of the category to read.
56
+ * @returns The matching {@linkcode PluginCoreTagCategory}, or `null` if no
57
+ * category has that id.
58
+ *
59
+ * @examplePrompt Get the tag category with id cat_3
60
+ * @examplePrompt Look up a category by its id
61
+ * @examplePrompt Which tags are in this category?
62
+ *
63
+ * # Example
64
+ * ```ts
65
+ * const category = await snaptrude.core.tags.getCategory("cat_3")
66
+ * if (category) console.log(category.name, category.tagIds)
67
+ * ```
68
+ */
69
+ public abstract getCategory(
70
+ categoryId: string,
71
+ ): PluginApiReturn<PluginCoreTagsGetCategoryResult>
72
+
73
+ /**
74
+ * List tags, optionally within one category.
75
+ *
76
+ * @param categoryId - Optional category filter; omit to list every tag.
77
+ * @returns A {@linkcode PluginCoreTagsListResult} with a `tags` array (empty
78
+ * when there are none).
79
+ *
80
+ * @examplePrompt List every tag in the project
81
+ * @examplePrompt Show the tags in category cat_3
82
+ * @examplePrompt What tags are available?
83
+ *
84
+ * # Example
85
+ * ```ts
86
+ * const { tags } = await snaptrude.core.tags.list("cat_3")
87
+ * for (const t of tags) console.log(t.name, t.color)
88
+ * ```
89
+ */
90
+ public abstract list(
91
+ categoryId?: string,
92
+ ): PluginApiReturn<PluginCoreTagsListResult>
93
+
94
+ /**
95
+ * Get a single tag by id.
96
+ *
97
+ * @param tagId - The id of the tag to read.
98
+ * @returns The matching {@linkcode PluginCoreTag}, or `null` if no tag has that
99
+ * id.
100
+ *
101
+ * @examplePrompt Get the tag with id tag_9
102
+ * @examplePrompt Look up a single tag by its id
103
+ * @examplePrompt What color is this tag?
104
+ *
105
+ * # Example
106
+ * ```ts
107
+ * const tag = await snaptrude.core.tags.get("tag_9")
108
+ * if (tag) console.log(tag.name, tag.color)
109
+ * ```
110
+ */
111
+ public abstract get(
112
+ tagId: string,
113
+ ): PluginApiReturn<PluginCoreTagsGetResult>
114
+
115
+ /**
116
+ * List the tags carried by a component.
117
+ *
118
+ * Returns one entry per category the component is tagged in, each carrying the
119
+ * category and tag names and the tag color.
120
+ *
121
+ * @param componentId - The `Component.id` to read.
122
+ * @returns A {@linkcode PluginCoreTagsGetTagsForComponentResult} with a `tags`
123
+ * array (empty when the component has none or does not exist).
124
+ *
125
+ * @examplePrompt What tags does this space have?
126
+ * @examplePrompt List the tags on component cmp_42
127
+ * @examplePrompt Show the labels applied to this room
128
+ *
129
+ * # Example
130
+ * ```ts
131
+ * const { tags } = await snaptrude.core.tags.getTagsForComponent("cmp_42")
132
+ * for (const t of tags) console.log(t.categoryName, t.tagName)
133
+ * ```
134
+ */
135
+ public abstract getTagsForComponent(
136
+ componentId: ComponentHandle,
137
+ ): PluginApiReturn<PluginCoreTagsGetTagsForComponentResult>
138
+
139
+ /**
140
+ * List the components carrying a given tag or category.
141
+ *
142
+ * Provide **exactly one** of `tagId` (components with that specific tag) or
143
+ * `categoryId` (components carrying any non-default tag in that category). With
144
+ * `categoryId`, pass `untagged: true` to instead return the components that have
145
+ * **no** non-default tag in that category. `untagged` is valid only alongside
146
+ * `categoryId`.
147
+ *
148
+ * @param filter - A {@linkcode PluginCoreTagsListComponentsArgs} filter with
149
+ * exactly one of `tagId`, `categoryId`, plus optional `untagged` (with
150
+ * `categoryId`).
151
+ * @returns A {@linkcode PluginCoreTagsListComponentsResult} with a
152
+ * `componentIds` array (empty when none match).
153
+ *
154
+ * @examplePrompt Which spaces have the tag tag_9?
155
+ * @examplePrompt List every component tagged in category cat_3
156
+ * @examplePrompt Which spaces are untagged in the Occupancy category?
157
+ *
158
+ * # Example
159
+ * ```ts
160
+ * const { componentIds } = await snaptrude.core.tags.listComponents({ tagId: "tag_9" })
161
+ * console.log(`${componentIds.length} components`)
162
+ * ```
163
+ */
164
+ public abstract listComponents(
165
+ filter: { tagId?: string; categoryId?: string; untagged?: boolean },
166
+ ): PluginApiReturn<PluginCoreTagsListComponentsResult>
167
+
168
+ /**
169
+ * Create a new tag category.
170
+ *
171
+ * @param name - Display name of the new category.
172
+ * @returns The new {@linkcode PluginCoreTagCategory}.
173
+ * @throws If the name collides with the reserved `DEPARTMENT` category, or the
174
+ * category could not be created.
175
+ *
176
+ * @examplePrompt Create a tag category called Fire Rating
177
+ * @examplePrompt Add a new category named Zone
178
+ * @examplePrompt Make a category for occupancy type
179
+ *
180
+ * # Example
181
+ * ```ts
182
+ * const category = await snaptrude.core.tags.createCategory("Fire Rating")
183
+ * ```
184
+ */
185
+ public abstract createCategory(
186
+ name: string,
187
+ ): PluginApiReturn<PluginCoreTagsCreateCategoryResult>
188
+
189
+ /**
190
+ * Rename a tag category.
191
+ *
192
+ * @param categoryId - The id of the category to rename.
193
+ * @param name - The category's new display name.
194
+ * @returns The updated {@linkcode PluginCoreTagCategory}.
195
+ * @throws If no category has the given id, or it is the reserved `DEPARTMENT`
196
+ * category.
197
+ *
198
+ * @examplePrompt Rename category cat_3 to Occupancy
199
+ * @examplePrompt Change the name of this tag category
200
+ * @examplePrompt Update the Zone category's name
201
+ *
202
+ * # Example
203
+ * ```ts
204
+ * const category = await snaptrude.core.tags.updateCategory("cat_3", "Occupancy")
205
+ * ```
206
+ */
207
+ public abstract updateCategory(
208
+ categoryId: string,
209
+ name: string,
210
+ ): PluginApiReturn<PluginCoreTagsUpdateCategoryResult>
211
+
212
+ /**
213
+ * Delete a tag category and all its tags.
214
+ *
215
+ * **Non-undoable.** Every component tagged in this category is reset to the
216
+ * category's `DEFAULT`; the result reports how many tags were removed and how
217
+ * many components were reset.
218
+ *
219
+ * @param categoryId - The id of the category to delete.
220
+ * @returns The impact counts (`deletedTagCount`, `resetComponentCount`).
221
+ * @throws If no category has the given id, or it is the reserved `DEPARTMENT`
222
+ * category.
223
+ *
224
+ * @examplePrompt Delete the Zone tag category
225
+ * @examplePrompt Remove category cat_3 and all its tags
226
+ * @examplePrompt Delete this category
227
+ *
228
+ * # Example
229
+ * ```ts
230
+ * const { deletedTagCount } = await snaptrude.core.tags.deleteCategory("cat_3")
231
+ * ```
232
+ */
233
+ public abstract deleteCategory(
234
+ categoryId: string,
235
+ ): PluginApiReturn<PluginCoreTagsDeleteCategoryResult>
236
+
237
+ /**
238
+ * Create a new tag in a category.
239
+ *
240
+ * @param categoryId - The category the new tag belongs to.
241
+ * @param name - Display name of the new tag.
242
+ * @param color - Optional CSS hex color string (auto-assigned if omitted).
243
+ * @returns The new {@linkcode PluginCoreTag}.
244
+ * @throws If no category has the given id, or it is the reserved `DEPARTMENT`
245
+ * category.
246
+ *
247
+ * @examplePrompt Add a tag called 2-hour to the Fire Rating category
248
+ * @examplePrompt Create a red High Priority tag in category cat_3
249
+ * @examplePrompt Make a new tag named Retail
250
+ *
251
+ * # Example
252
+ * ```ts
253
+ * const tag = await snaptrude.core.tags.create("cat_3", "Retail", "#b5e1dc")
254
+ * ```
255
+ */
256
+ public abstract create(
257
+ categoryId: string,
258
+ name: string,
259
+ color?: string,
260
+ ): PluginApiReturn<PluginCoreTagsCreateResult>
261
+
262
+ /**
263
+ * Update a tag's name and/or color.
264
+ *
265
+ * A **sparse** update: omitted fields are left unchanged.
266
+ *
267
+ * @param tagId - The id of the tag to update.
268
+ * @param options - Any of `name`, `color`; omitted fields are left unchanged.
269
+ * @returns The updated {@linkcode PluginCoreTag}.
270
+ * @throws If no tag has the given id, or it belongs to the reserved
271
+ * `DEPARTMENT` category.
272
+ *
273
+ * @examplePrompt Rename tag tag_9 to Retail
274
+ * @examplePrompt Change this tag's color to #ff8800
275
+ * @examplePrompt Recolor the High Priority tag
276
+ *
277
+ * # Example
278
+ * ```ts
279
+ * const tag = await snaptrude.core.tags.update("tag_9", { name: "Retail" })
280
+ * ```
281
+ */
282
+ public abstract update(
283
+ tagId: string,
284
+ options?: { name?: string; color?: string },
285
+ ): PluginApiReturn<PluginCoreTagsUpdateResult>
286
+
287
+ /**
288
+ * Delete a tag.
289
+ *
290
+ * **Non-undoable.** Every component carrying this tag is reset to its
291
+ * category's `DEFAULT`; the result reports how many components were reset. The
292
+ * built-in `DEFAULT` tag of a category cannot be deleted.
293
+ *
294
+ * @param tagId - The id of the tag to delete.
295
+ * @returns The impact count (`resetComponentCount`).
296
+ * @throws If no tag has the given id, it is a `DEFAULT` tag, or it belongs to
297
+ * the reserved `DEPARTMENT` category.
298
+ *
299
+ * @examplePrompt Delete the Retail tag
300
+ * @examplePrompt Remove tag tag_9
301
+ * @examplePrompt Delete this label
302
+ *
303
+ * # Example
304
+ * ```ts
305
+ * const { resetComponentCount } = await snaptrude.core.tags.delete("tag_9")
306
+ * ```
307
+ */
308
+ public abstract delete(
309
+ tagId: string,
310
+ ): PluginApiReturn<PluginCoreTagsDeleteResult>
311
+
312
+ /**
313
+ * Assign a tag to components, creating the category and tag if needed.
314
+ *
315
+ * Resolves `tagName` within the category named `categoryName`: if the category
316
+ * or the tag does not exist yet it is created, otherwise the existing one is
317
+ * reused. The resolved tag is then applied to each taggable component (Mass/Floor
318
+ * spaces) — resolve-or-create and assign are **one atomic, undoable action**.
319
+ * Because a component carries one tag per category, this replaces any existing
320
+ * tag from that category. Components that are locked, not taggable, or not found
321
+ * are returned in `skipped` with a reason — never silently dropped. Rejects the
322
+ * reserved `DEPARTMENT` category.
323
+ *
324
+ * @param componentIds - The components to tag (at least one).
325
+ * @param categoryName - The tag category; created if it does not exist (not
326
+ * `DEPARTMENT`).
327
+ * @param tagName - The tag within the category; created if it does not exist,
328
+ * else reused.
329
+ * @returns A {@linkcode PluginCoreTagsAssignResult} — the resolved
330
+ * `categoryId`/`tagId`, whether each was created, and the `assigned`/`skipped`
331
+ * split.
332
+ * @throws If `categoryName` is the reserved `DEPARTMENT` category.
333
+ *
334
+ * @examplePrompt Tag the selected spaces as Retail in the Zone category
335
+ * @examplePrompt Tag these rooms High Priority, creating the tag if it doesn't exist
336
+ * @examplePrompt Put cmp_1 and cmp_2 in Zone / Retail
337
+ *
338
+ * # Example
339
+ * ```ts
340
+ * const { tagId, tagCreated, assigned } = await snaptrude.core.tags.assign(
341
+ * ["cmp_1", "cmp_2"],
342
+ * "Zone",
343
+ * "Retail",
344
+ * )
345
+ * ```
346
+ */
347
+ public abstract assign(
348
+ componentIds: ComponentHandle[],
349
+ categoryName: string,
350
+ tagName: string,
351
+ ): PluginApiReturn<PluginCoreTagsAssignResult>
352
+
353
+ /**
354
+ * Clear a category's tag from components.
355
+ *
356
+ * Resets each component's slot for the given category back to `DEFAULT` (a
357
+ * component always has a `DEFAULT` — the field is never blanked). Components
358
+ * that are locked, not taggable, or not found are returned in `skipped`.
359
+ *
360
+ * @param categoryId - The category slot to reset to default.
361
+ * @param componentIds - The components to clear (at least one).
362
+ * @returns A {@linkcode PluginCoreAssignOutcome} splitting `assigned` (reset to
363
+ * default) from `skipped`.
364
+ * @throws If no category has the given id.
365
+ *
366
+ * @examplePrompt Remove the Occupancy tag from the selected spaces
367
+ * @examplePrompt Clear category cat_3 on components cmp_1 and cmp_2
368
+ * @examplePrompt Untag these rooms in the Zone category
369
+ *
370
+ * # Example
371
+ * ```ts
372
+ * await snaptrude.core.tags.unassign("cat_3", ["cmp_1", "cmp_2"])
373
+ * ```
374
+ */
375
+ public abstract unassign(
376
+ categoryId: string,
377
+ componentIds: ComponentHandle[],
378
+ ): PluginApiReturn<PluginCoreTagsUnassignResult>
379
+ }
380
+
381
+ /**
382
+ * A tag category — a named slot that holds a set of mutually-exclusive tags.
383
+ *
384
+ * | Property | Type | Description |
385
+ * |---|---|---|
386
+ * | `id` | `string` | Stable public category id |
387
+ * | `name` | `string` | Display name |
388
+ * | `tagIds` | `string[]` | Ids of the tags in this category |
389
+ */
390
+ export const PluginCoreTagCategory = z.object({
391
+ id: z.string(),
392
+ name: z.string(),
393
+ tagIds: z.array(z.string()),
394
+ })
395
+ export type PluginCoreTagCategory = z.infer<typeof PluginCoreTagCategory>
396
+
397
+ /**
398
+ * A tag — a colored label within a category.
399
+ *
400
+ * | Property | Type | Description |
401
+ * |---|---|---|
402
+ * | `id` | `string` | Stable public tag id |
403
+ * | `categoryId` | `string` | The id of the category this tag belongs to |
404
+ * | `name` | `string` | Display name |
405
+ * | `color` | `string` | CSS hex color string (e.g. `"#b5e1dc"`) |
406
+ */
407
+ export const PluginCoreTag = z.object({
408
+ id: z.string(),
409
+ categoryId: z.string(),
410
+ name: z.string(),
411
+ color: z.string(),
412
+ })
413
+ export type PluginCoreTag = z.infer<typeof PluginCoreTag>
414
+
415
+ /**
416
+ * A tag as carried by a component — the category and tag names resolved for
417
+ * display.
418
+ *
419
+ * | Property | Type | Description |
420
+ * |---|---|---|
421
+ * | `categoryId` | `string` | The category's id |
422
+ * | `categoryName` | `string` | The category's display name |
423
+ * | `tagId` | `string` | The tag's id |
424
+ * | `tagName` | `string` | The tag's display name |
425
+ * | `color` | `string` | The tag's CSS hex color string |
426
+ */
427
+ export const PluginCoreComponentTag = z.object({
428
+ categoryId: z.string(),
429
+ categoryName: z.string(),
430
+ tagId: z.string(),
431
+ tagName: z.string(),
432
+ color: z.string(),
433
+ })
434
+ export type PluginCoreComponentTag = z.infer<typeof PluginCoreComponentTag>
435
+
436
+ /**
437
+ * The outcome of an assign/unassign — which components changed and which were
438
+ * skipped (with a reason).
439
+ *
440
+ * | Property | Type | Description |
441
+ * |---|---|---|
442
+ * | `assigned` | `string[]` | Ids of the components that were changed |
443
+ * | `skipped` | `{ id: string; reason: "locked" \| "not-taggable" \| "not-found" }[]` | Components that were not changed, each with a reason |
444
+ */
445
+ export const PluginCoreAssignOutcome = z.object({
446
+ assigned: z.array(z.string()),
447
+ skipped: z.array(
448
+ z.object({
449
+ id: z.string(),
450
+ reason: z.enum(["locked", "not-taggable", "not-found"]),
451
+ }),
452
+ ),
453
+ })
454
+ export type PluginCoreAssignOutcome = z.infer<typeof PluginCoreAssignOutcome>
455
+
456
+ /**
457
+ * Result of {@linkcode PluginCoreTagsApi.listCategories}.
458
+ *
459
+ * | Property | Type | Description |
460
+ * |---|---|---|
461
+ * | `categories` | {@linkcode PluginCoreTagCategory}`[]` | Every tag category (including the reserved `DEPARTMENT`) |
462
+ */
463
+ export const PluginCoreTagsListCategoriesResult = z.object({
464
+ categories: z.array(PluginCoreTagCategory),
465
+ })
466
+ export type PluginCoreTagsListCategoriesResult = z.infer<
467
+ typeof PluginCoreTagsListCategoriesResult
468
+ >
469
+
470
+ /**
471
+ * Arguments for {@linkcode PluginCoreTagsApi.getCategory}.
472
+ *
473
+ * | Property | Type | Description |
474
+ * |---|---|---|
475
+ * | `categoryId` | `string` | The id of the category to read |
476
+ */
477
+ export const PluginCoreTagsGetCategoryArgs = z.object({
478
+ categoryId: z.string(),
479
+ })
480
+ export type PluginCoreTagsGetCategoryArgs = z.infer<
481
+ typeof PluginCoreTagsGetCategoryArgs
482
+ >
483
+
484
+ /**
485
+ * Result of {@linkcode PluginCoreTagsApi.getCategory} — the category, or `null`
486
+ * when no category has the given id.
487
+ */
488
+ export const PluginCoreTagsGetCategoryResult = PluginCoreTagCategory.nullable()
489
+ export type PluginCoreTagsGetCategoryResult = z.infer<
490
+ typeof PluginCoreTagsGetCategoryResult
491
+ >
492
+
493
+ /**
494
+ * Arguments for {@linkcode PluginCoreTagsApi.list}.
495
+ *
496
+ * | Property | Type | Description |
497
+ * |---|---|---|
498
+ * | `categoryId` | `string \| undefined` | Optional category filter; omit to list every tag |
499
+ */
500
+ export const PluginCoreTagsListArgs = z.object({
501
+ categoryId: z.string().optional(),
502
+ })
503
+ export type PluginCoreTagsListArgs = z.infer<typeof PluginCoreTagsListArgs>
504
+
505
+ /**
506
+ * Result of {@linkcode PluginCoreTagsApi.list}.
507
+ *
508
+ * | Property | Type | Description |
509
+ * |---|---|---|
510
+ * | `tags` | {@linkcode PluginCoreTag}`[]` | The matching tags (empty when none) |
511
+ */
512
+ export const PluginCoreTagsListResult = z.object({
513
+ tags: z.array(PluginCoreTag),
514
+ })
515
+ export type PluginCoreTagsListResult = z.infer<typeof PluginCoreTagsListResult>
516
+
517
+ /**
518
+ * Arguments for {@linkcode PluginCoreTagsApi.get}.
519
+ *
520
+ * | Property | Type | Description |
521
+ * |---|---|---|
522
+ * | `tagId` | `string` | The id of the tag to read |
523
+ */
524
+ export const PluginCoreTagsGetArgs = z.object({
525
+ tagId: z.string(),
526
+ })
527
+ export type PluginCoreTagsGetArgs = z.infer<typeof PluginCoreTagsGetArgs>
528
+
529
+ /**
530
+ * Result of {@linkcode PluginCoreTagsApi.get} — the tag, or `null` when no tag
531
+ * has the given id.
532
+ */
533
+ export const PluginCoreTagsGetResult = PluginCoreTag.nullable()
534
+ export type PluginCoreTagsGetResult = z.infer<typeof PluginCoreTagsGetResult>
535
+
536
+ /**
537
+ * Arguments for {@linkcode PluginCoreTagsApi.getTagsForComponent}.
538
+ *
539
+ * | Property | Type | Description |
540
+ * |---|---|---|
541
+ * | `componentId` | `ComponentHandle` | The `Component.id` to read |
542
+ */
543
+ export const PluginCoreTagsGetTagsForComponentArgs = z.object({
544
+ componentId: ComponentHandle,
545
+ })
546
+ export type PluginCoreTagsGetTagsForComponentArgs = z.infer<
547
+ typeof PluginCoreTagsGetTagsForComponentArgs
548
+ >
549
+
550
+ /**
551
+ * Result of {@linkcode PluginCoreTagsApi.getTagsForComponent}.
552
+ *
553
+ * | Property | Type | Description |
554
+ * |---|---|---|
555
+ * | `tags` | {@linkcode PluginCoreComponentTag}`[]` | The component's tags, one per tagged category (empty when none) |
556
+ */
557
+ export const PluginCoreTagsGetTagsForComponentResult = z.object({
558
+ tags: z.array(PluginCoreComponentTag),
559
+ })
560
+ export type PluginCoreTagsGetTagsForComponentResult = z.infer<
561
+ typeof PluginCoreTagsGetTagsForComponentResult
562
+ >
563
+
564
+ /**
565
+ * Arguments for {@linkcode PluginCoreTagsApi.listComponents}. Provide exactly one
566
+ * of `tagId`, `categoryId`. `untagged` is valid only with `categoryId`.
567
+ *
568
+ * | Property | Type | Description |
569
+ * |---|---|---|
570
+ * | `tagId` | `string \| undefined` | Components carrying this specific tag |
571
+ * | `categoryId` | `string \| undefined` | Components carrying any non-default tag in this category |
572
+ * | `untagged` | `boolean \| undefined` | With `categoryId`, return components with **no** non-default tag in that category instead |
573
+ */
574
+ export const PluginCoreTagsListComponentsArgs = z
575
+ .object({
576
+ tagId: z.string().optional(),
577
+ categoryId: z.string().optional(),
578
+ untagged: z.boolean().optional(),
579
+ })
580
+ .refine((v) => (v.tagId == null) !== (v.categoryId == null), {
581
+ message: "Provide exactly one of tagId or categoryId",
582
+ })
583
+ .refine((v) => v.untagged == null || v.categoryId != null, {
584
+ message: "untagged is valid only together with categoryId",
585
+ })
586
+ export type PluginCoreTagsListComponentsArgs = z.infer<
587
+ typeof PluginCoreTagsListComponentsArgs
588
+ >
589
+
590
+ /**
591
+ * Result of {@linkcode PluginCoreTagsApi.listComponents}.
592
+ *
593
+ * | Property | Type | Description |
594
+ * |---|---|---|
595
+ * | `componentIds` | `ComponentHandle[]` | Ids of the matching components (empty when none) |
596
+ */
597
+ export const PluginCoreTagsListComponentsResult = z.object({
598
+ componentIds: z.array(ComponentHandle),
599
+ })
600
+ export type PluginCoreTagsListComponentsResult = z.infer<
601
+ typeof PluginCoreTagsListComponentsResult
602
+ >
603
+
604
+ /**
605
+ * Arguments for {@linkcode PluginCoreTagsApi.createCategory}.
606
+ *
607
+ * | Property | Type | Description |
608
+ * |---|---|---|
609
+ * | `name` | `string` | Display name of the new category |
610
+ */
611
+ export const PluginCoreTagsCreateCategoryArgs = z.object({
612
+ name: z.string(),
613
+ })
614
+ export type PluginCoreTagsCreateCategoryArgs = z.infer<
615
+ typeof PluginCoreTagsCreateCategoryArgs
616
+ >
617
+
618
+ /** Result of {@linkcode PluginCoreTagsApi.createCategory} — the new category. */
619
+ export const PluginCoreTagsCreateCategoryResult = PluginCoreTagCategory
620
+ export type PluginCoreTagsCreateCategoryResult = z.infer<
621
+ typeof PluginCoreTagsCreateCategoryResult
622
+ >
623
+
624
+ /**
625
+ * Arguments for {@linkcode PluginCoreTagsApi.updateCategory}.
626
+ *
627
+ * | Property | Type | Description |
628
+ * |---|---|---|
629
+ * | `categoryId` | `string` | The id of the category to rename |
630
+ * | `name` | `string` | The category's new display name |
631
+ */
632
+ export const PluginCoreTagsUpdateCategoryArgs = z.object({
633
+ categoryId: z.string(),
634
+ name: z.string(),
635
+ })
636
+ export type PluginCoreTagsUpdateCategoryArgs = z.infer<
637
+ typeof PluginCoreTagsUpdateCategoryArgs
638
+ >
639
+
640
+ /** Result of {@linkcode PluginCoreTagsApi.updateCategory} — the updated category. */
641
+ export const PluginCoreTagsUpdateCategoryResult = PluginCoreTagCategory
642
+ export type PluginCoreTagsUpdateCategoryResult = z.infer<
643
+ typeof PluginCoreTagsUpdateCategoryResult
644
+ >
645
+
646
+ /**
647
+ * Arguments for {@linkcode PluginCoreTagsApi.deleteCategory}.
648
+ *
649
+ * | Property | Type | Description |
650
+ * |---|---|---|
651
+ * | `categoryId` | `string` | The id of the category to delete |
652
+ */
653
+ export const PluginCoreTagsDeleteCategoryArgs = z.object({
654
+ categoryId: z.string(),
655
+ })
656
+ export type PluginCoreTagsDeleteCategoryArgs = z.infer<
657
+ typeof PluginCoreTagsDeleteCategoryArgs
658
+ >
659
+
660
+ /**
661
+ * Result of {@linkcode PluginCoreTagsApi.deleteCategory} — the impact of the
662
+ * (non-undoable) delete.
663
+ *
664
+ * | Property | Type | Description |
665
+ * |---|---|---|
666
+ * | `deletedTagCount` | `number` | Number of tags removed with the category |
667
+ * | `resetComponentCount` | `number` | Number of components reset to their default |
668
+ */
669
+ export const PluginCoreTagsDeleteCategoryResult = z.object({
670
+ deletedTagCount: z.number().int(),
671
+ resetComponentCount: z.number().int(),
672
+ })
673
+ export type PluginCoreTagsDeleteCategoryResult = z.infer<
674
+ typeof PluginCoreTagsDeleteCategoryResult
675
+ >
676
+
677
+ /**
678
+ * Arguments for {@linkcode PluginCoreTagsApi.create}.
679
+ *
680
+ * | Property | Type | Description |
681
+ * |---|---|---|
682
+ * | `categoryId` | `string` | The category the new tag belongs to |
683
+ * | `name` | `string` | Display name of the new tag |
684
+ * | `color` | `string \| undefined` | CSS hex color string (auto-assigned if omitted) |
685
+ */
686
+ export const PluginCoreTagsCreateArgs = z.object({
687
+ categoryId: z.string(),
688
+ name: z.string(),
689
+ color: z.string().optional(),
690
+ })
691
+ export type PluginCoreTagsCreateArgs = z.infer<typeof PluginCoreTagsCreateArgs>
692
+
693
+ /** Result of {@linkcode PluginCoreTagsApi.create} — the new tag. */
694
+ export const PluginCoreTagsCreateResult = PluginCoreTag
695
+ export type PluginCoreTagsCreateResult = z.infer<
696
+ typeof PluginCoreTagsCreateResult
697
+ >
698
+
699
+ /**
700
+ * Arguments for {@linkcode PluginCoreTagsApi.update}. Sparse — only the provided
701
+ * fields are changed.
702
+ *
703
+ * | Property | Type | Description |
704
+ * |---|---|---|
705
+ * | `tagId` | `string` | The id of the tag to update |
706
+ * | `name` | `string \| undefined` | New display name (unchanged if omitted) |
707
+ * | `color` | `string \| undefined` | New CSS hex color (unchanged if omitted) |
708
+ */
709
+ export const PluginCoreTagsUpdateArgs = z.object({
710
+ tagId: z.string(),
711
+ name: z.string().optional(),
712
+ color: z.string().optional(),
713
+ })
714
+ export type PluginCoreTagsUpdateArgs = z.infer<typeof PluginCoreTagsUpdateArgs>
715
+
716
+ /** Result of {@linkcode PluginCoreTagsApi.update} — the updated tag. */
717
+ export const PluginCoreTagsUpdateResult = PluginCoreTag
718
+ export type PluginCoreTagsUpdateResult = z.infer<
719
+ typeof PluginCoreTagsUpdateResult
720
+ >
721
+
722
+ /**
723
+ * Arguments for {@linkcode PluginCoreTagsApi.delete}.
724
+ *
725
+ * | Property | Type | Description |
726
+ * |---|---|---|
727
+ * | `tagId` | `string` | The id of the tag to delete |
728
+ */
729
+ export const PluginCoreTagsDeleteArgs = z.object({
730
+ tagId: z.string(),
731
+ })
732
+ export type PluginCoreTagsDeleteArgs = z.infer<typeof PluginCoreTagsDeleteArgs>
733
+
734
+ /**
735
+ * Result of {@linkcode PluginCoreTagsApi.delete} — the impact of the
736
+ * (non-undoable) delete.
737
+ *
738
+ * | Property | Type | Description |
739
+ * |---|---|---|
740
+ * | `resetComponentCount` | `number` | Number of components reset to their category default |
741
+ */
742
+ export const PluginCoreTagsDeleteResult = z.object({
743
+ resetComponentCount: z.number().int(),
744
+ })
745
+ export type PluginCoreTagsDeleteResult = z.infer<
746
+ typeof PluginCoreTagsDeleteResult
747
+ >
748
+
749
+ /**
750
+ * Arguments for {@linkcode PluginCoreTagsApi.assign}.
751
+ *
752
+ * | Property | Type | Description |
753
+ * |---|---|---|
754
+ * | `componentIds` | `ComponentHandle[]` | The components to tag (at least one) |
755
+ * | `categoryName` | `string` | The tag category; created if it does not exist (not `DEPARTMENT`) |
756
+ * | `tagName` | `string` | The tag within the category; created if it does not exist, else reused |
757
+ */
758
+ export const PluginCoreTagsAssignArgs = z.object({
759
+ componentIds: z.array(ComponentHandle).min(1),
760
+ categoryName: z.string(),
761
+ tagName: z.string(),
762
+ })
763
+ export type PluginCoreTagsAssignArgs = z.infer<typeof PluginCoreTagsAssignArgs>
764
+
765
+ /**
766
+ * Result of {@linkcode PluginCoreTagsApi.assign} — the resolved category/tag, what
767
+ * was created, and the assign outcome.
768
+ *
769
+ * | Property | Type | Description |
770
+ * |---|---|---|
771
+ * | `categoryId` | `string` | Id of the resolved (or newly created) category |
772
+ * | `tagId` | `string` | Id of the resolved (or newly created) tag |
773
+ * | `categoryCreated` | `boolean` | Whether the category was created by this call |
774
+ * | `tagCreated` | `boolean` | Whether the tag was created by this call |
775
+ * | `assigned` | `string[]` | Ids of the components that were tagged |
776
+ * | `skipped` | `{ id: string; reason: "locked" \| "not-taggable" \| "not-found" }[]` | Components not tagged, each with a reason |
777
+ */
778
+ export const PluginCoreTagsAssignResult = PluginCoreAssignOutcome.extend({
779
+ categoryId: z.string(),
780
+ tagId: z.string(),
781
+ categoryCreated: z.boolean(),
782
+ tagCreated: z.boolean(),
783
+ })
784
+ export type PluginCoreTagsAssignResult = z.infer<
785
+ typeof PluginCoreTagsAssignResult
786
+ >
787
+
788
+ /**
789
+ * Arguments for {@linkcode PluginCoreTagsApi.unassign}.
790
+ *
791
+ * | Property | Type | Description |
792
+ * |---|---|---|
793
+ * | `categoryId` | `string` | The category slot to reset to default |
794
+ * | `componentIds` | `ComponentHandle[]` | The components to clear (at least one) |
795
+ */
796
+ export const PluginCoreTagsUnassignArgs = z.object({
797
+ categoryId: z.string(),
798
+ componentIds: z.array(ComponentHandle).min(1),
799
+ })
800
+ export type PluginCoreTagsUnassignArgs = z.infer<
801
+ typeof PluginCoreTagsUnassignArgs
802
+ >
803
+
804
+ /** Result of {@linkcode PluginCoreTagsApi.unassign} — the unassign outcome. */
805
+ export const PluginCoreTagsUnassignResult = PluginCoreAssignOutcome
806
+ export type PluginCoreTagsUnassignResult = z.infer<
807
+ typeof PluginCoreTagsUnassignResult
808
+ >