@snaptrude/plugin-core 0.6.0 → 0.7.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 (83) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/api-manifest.full.json +511 -10
  3. package/api-manifest.json +529 -4
  4. package/dist/api/core/index.d.ts +5 -0
  5. package/dist/api/core/index.d.ts.map +1 -1
  6. package/dist/api/core/proposals/index.d.ts +475 -0
  7. package/dist/api/core/proposals/index.d.ts.map +1 -0
  8. package/dist/api/design/create/index.d.ts +209 -0
  9. package/dist/api/design/create/index.d.ts.map +1 -1
  10. package/dist/api/design/doors/index.d.ts +159 -0
  11. package/dist/api/design/doors/index.d.ts.map +1 -1
  12. package/dist/api/design/furniture/index.d.ts +34 -5
  13. package/dist/api/design/furniture/index.d.ts.map +1 -1
  14. package/dist/api/design/index.d.ts +83 -0
  15. package/dist/api/design/index.d.ts.map +1 -1
  16. package/dist/api/design/lock.d.ts +26 -0
  17. package/dist/api/design/lock.d.ts.map +1 -1
  18. package/dist/api/design/materials/index.d.ts +159 -2
  19. package/dist/api/design/materials/index.d.ts.map +1 -1
  20. package/dist/api/design/query/index.d.ts +115 -5
  21. package/dist/api/design/query/index.d.ts.map +1 -1
  22. package/dist/api/design/selection/index.d.ts +2 -2
  23. package/dist/api/design/transform/index.d.ts +83 -2
  24. package/dist/api/design/transform/index.d.ts.map +1 -1
  25. package/dist/api/design/update/index.d.ts +168 -0
  26. package/dist/api/design/update/index.d.ts.map +1 -1
  27. package/dist/api/design/windows/index.d.ts +113 -2
  28. package/dist/api/design/windows/index.d.ts.map +1 -1
  29. package/dist/api/entity/story.d.ts +101 -7
  30. package/dist/api/entity/story.d.ts.map +1 -1
  31. package/dist/api/presentation/import.d.ts +49 -4
  32. package/dist/api/presentation/import.d.ts.map +1 -1
  33. package/dist/api/presentation/views.d.ts +210 -5
  34. package/dist/api/presentation/views.d.ts.map +1 -1
  35. package/dist/api/program/areas.d.ts +42 -12
  36. package/dist/api/program/areas.d.ts.map +1 -1
  37. package/dist/api/program/index.d.ts +3 -11
  38. package/dist/api/program/index.d.ts.map +1 -1
  39. package/dist/api/program/layout.d.ts +186 -11
  40. package/dist/api/program/layout.d.ts.map +1 -1
  41. package/dist/errors/codes.d.ts +34 -0
  42. package/dist/errors/codes.d.ts.map +1 -0
  43. package/dist/errors/envelope.d.ts +56 -0
  44. package/dist/errors/envelope.d.ts.map +1 -0
  45. package/dist/errors/index.d.ts +6 -0
  46. package/dist/errors/index.d.ts.map +1 -0
  47. package/dist/errors/plugin-error.d.ts +69 -0
  48. package/dist/errors/plugin-error.d.ts.map +1 -0
  49. package/dist/host-utils.d.ts +4 -0
  50. package/dist/host-utils.d.ts.map +1 -1
  51. package/dist/index.cjs +1624 -1028
  52. package/dist/index.cjs.map +1 -1
  53. package/dist/index.d.ts +1 -0
  54. package/dist/index.d.ts.map +1 -1
  55. package/dist/index.js +1546 -1025
  56. package/dist/index.js.map +1 -1
  57. package/package.json +2 -1
  58. package/scripts/generate-manifest.test.mjs +77 -0
  59. package/src/api/core/index.ts +5 -0
  60. package/src/api/core/proposals/index.ts +509 -0
  61. package/src/api/design/create/index.ts +249 -0
  62. package/src/api/design/doors/index.ts +168 -0
  63. package/src/api/design/furniture/index.ts +36 -5
  64. package/src/api/design/index.ts +87 -0
  65. package/src/api/design/lock.ts +27 -0
  66. package/src/api/design/materials/index.ts +182 -2
  67. package/src/api/design/query/index.ts +81 -0
  68. package/src/api/design/transform/index.ts +74 -2
  69. package/src/api/design/update/index.ts +167 -0
  70. package/src/api/design/windows/index.ts +128 -2
  71. package/src/api/entity/story.ts +105 -7
  72. package/src/api/presentation/import.ts +45 -4
  73. package/src/api/presentation/views.ts +221 -5
  74. package/src/api/program/areas.ts +34 -12
  75. package/src/api/program/index.ts +3 -11
  76. package/src/api/program/layout.ts +195 -11
  77. package/src/errors/codes.ts +136 -0
  78. package/src/errors/envelope.ts +75 -0
  79. package/src/errors/index.ts +21 -0
  80. package/src/errors/plugin-error.ts +134 -0
  81. package/src/host-utils.ts +4 -0
  82. package/src/index.ts +1 -0
  83. package/test/errors.test.mjs +184 -0
@@ -10,6 +10,7 @@ import { PluginCoreBuildingsApi } from "./buildings";
10
10
  import { PluginCoreLayersApi } from "./layers";
11
11
  import { PluginCoreTagsApi } from "./tags";
12
12
  import { PluginCoreIoApi } from "./io";
13
+ import { PluginCoreProposalsApi } from "./proposals";
13
14
  /**
14
15
  * Core primitives and infrastructure used across the plugin API.
15
16
  *
@@ -25,6 +26,7 @@ import { PluginCoreIoApi } from "./io";
25
26
  * - {@linkcode PluginCoreApi.layers} — Read & toggle storey drawing/reference layers
26
27
  * - {@linkcode PluginCoreApi.tags} — Tag catalog + assignment
27
28
  * - {@linkcode PluginCoreApi.io} — Import files (image/pdf/cad/model/terrain), poll jobs, manage underlays
29
+ * - {@linkcode PluginCoreApi.proposals} — Design options: read, create, rename, switch, delete
28
30
  */
29
31
  export declare abstract class PluginCoreApi {
30
32
  /** Vector and quaternion math utilities. See {@linkcode PluginMathApi}. */
@@ -51,6 +53,8 @@ export declare abstract class PluginCoreApi {
51
53
  abstract tags: PluginCoreTagsApi;
52
54
  /** I/O — file import, import jobs, and underlay management. See {@linkcode PluginCoreIoApi}. */
53
55
  abstract io: PluginCoreIoApi;
56
+ /** Proposals — design options: read, create, rename, switch, delete. See {@linkcode PluginCoreProposalsApi}. */
57
+ abstract proposals: PluginCoreProposalsApi;
54
58
  constructor();
55
59
  }
56
60
  export * from "./math";
@@ -65,4 +69,5 @@ export * from "./buildings";
65
69
  export * from "./layers";
66
70
  export * from "./tags";
67
71
  export * from "./io";
72
+ export * from "./proposals";
68
73
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAA;AACtC,OAAO,EAAE,aAAa,EAAE,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A;IACzC,wEAAwE;IACxE,SAAgB,KAAK,EAAE,cAAc,CAAA;IACrC,2DAA2D;IAC3D,SAAgB,IAAI,EAAE,aAAa,CAAA;IACnC,yEAAyE;IACzE,SAAgB,OAAO,EAAE,gBAAgB,CAAA;IACzC,qFAAqF;IACrF,SAAgB,OAAO,EAAE,gBAAgB,CAAA;IACzC,qFAAqF;IACrF,SAAgB,MAAM,EAAE,mBAAmB,CAAA;IAC3C,mGAAmG;IACnG,SAAgB,SAAS,EAAE,sBAAsB,CAAA;IACjD,mGAAmG;IACnG,SAAgB,MAAM,EAAE,mBAAmB,CAAA;IAC3C,0EAA0E;IAC1E,SAAgB,IAAI,EAAE,iBAAiB,CAAA;IACvC,gGAAgG;IAChG,SAAgB,EAAE,EAAE,eAAe,CAAA;IACnC,gHAAgH;IAChH,SAAgB,SAAS,EAAE,sBAAsB,CAAA;;CAGlD;AAED,cAAc,QAAQ,CAAA;AACtB,cAAc,QAAQ,CAAA;AACtB,cAAc,WAAW,CAAA;AACzB,cAAc,SAAS,CAAA;AACvB,cAAc,QAAQ,CAAA;AACtB,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,cAAc,aAAa,CAAA;AAC3B,cAAc,UAAU,CAAA;AACxB,cAAc,QAAQ,CAAA;AACtB,cAAc,MAAM,CAAA;AACpB,cAAc,aAAa,CAAA"}
@@ -0,0 +1,475 @@
1
+ import * as z from "zod";
2
+ import { PluginApiReturn } from "../../../types";
3
+ import { ComponentHandle } from "../../../handles";
4
+ /**
5
+ * Proposals — read and edit the project's design options ("proposals").
6
+ *
7
+ * A **proposal** is a design option: one of several variants of the same
8
+ * project. Each proposal owns a set of buckets (a bucket == a drawing layer),
9
+ * and switching the active proposal shows/hides the buckets it owns. Proposals
10
+ * are **infrastructure**, not design — they own the buckets/layers geometry
11
+ * lives in — so they sit under `core`, not `design` (constitution §2A).
12
+ *
13
+ * Reads return plain records and never throw for a missing proposal (`get` and
14
+ * `getActive` return `null`, `list` / `listForComponent` return an empty list,
15
+ * `isActive` returns `false`). Ids are stable public strings.
16
+ *
17
+ * On legacy / no-proposal projects the scoping predicates degrade gracefully:
18
+ * `getActive` returns `null` and the reads return empty.
19
+ *
20
+ * Proposal writes are **not undoable** — create / rename / setActive / delete
21
+ * persist directly and bypass the undo stack; a `core.history.undo` will not
22
+ * reverse them. Each proposal keeps its own isolated undo stack for the
23
+ * geometry edits made inside it.
24
+ *
25
+ * Accessed via `snaptrude.core.proposals`.
26
+ */
27
+ export declare abstract class PluginCoreProposalsApi {
28
+ constructor();
29
+ /**
30
+ * List the design options (proposals) in the active project.
31
+ *
32
+ * @returns A {@linkcode PluginCoreProposalsListResult} with a `proposals`
33
+ * array (empty on a legacy / no-proposal project).
34
+ *
35
+ * @examplePrompt List all the design options in this project
36
+ * @examplePrompt How many proposals does this project have?
37
+ * @examplePrompt Show every design variant with its name
38
+ *
39
+ * # Example
40
+ * ```ts
41
+ * const { proposals } = await snaptrude.core.proposals.list()
42
+ * for (const p of proposals) console.log(p.id, p.name, p.isActive)
43
+ * ```
44
+ */
45
+ abstract list(): PluginApiReturn<PluginCoreProposalsListResult>;
46
+ /**
47
+ * Get a single proposal by id.
48
+ *
49
+ * @param proposalId - The id of the proposal to read.
50
+ * @returns The matching {@linkcode PluginCoreProposalRef}, or `null` if no
51
+ * proposal has that id.
52
+ *
53
+ * @examplePrompt Get the proposal with id prop_1
54
+ * @examplePrompt Look up a single design option by its id
55
+ * @examplePrompt Which buckets belong to proposal prop_2?
56
+ *
57
+ * # Example
58
+ * ```ts
59
+ * const proposal = await snaptrude.core.proposals.get("prop_1")
60
+ * if (proposal) console.log(proposal.name, proposal.bucketIds)
61
+ * ```
62
+ */
63
+ abstract get(proposalId: string): PluginApiReturn<PluginCoreProposalsGetResult>;
64
+ /**
65
+ * Get the active proposal.
66
+ *
67
+ * The active proposal is the design option currently shown and edited.
68
+ * Honors a present-mode capture override: while a present-mode capture is in
69
+ * flight this returns the captured proposal, not the redux-active one. Paired
70
+ * with {@linkcode PluginCoreProposalsApi.setActive}.
71
+ *
72
+ * @returns The active {@linkcode PluginCoreProposalRef}, or `null` on a legacy
73
+ * / no-proposal project where nothing is active.
74
+ *
75
+ * @examplePrompt Which design option is active?
76
+ * @examplePrompt Get the current proposal
77
+ * @examplePrompt What proposal am I working in?
78
+ *
79
+ * # Example
80
+ * ```ts
81
+ * const active = await snaptrude.core.proposals.getActive()
82
+ * if (active) console.log(active.id, active.name)
83
+ * ```
84
+ */
85
+ abstract getActive(): PluginApiReturn<PluginCoreProposalsGetActiveResult>;
86
+ /**
87
+ * List the proposals a component belongs to.
88
+ *
89
+ * Returns **every** proposal whose buckets include the component — a bucket
90
+ * can be shared across proposals, so a component may appear in more than one.
91
+ *
92
+ * @param component - The component to look up.
93
+ * @returns A {@linkcode PluginCoreProposalsListForComponentResult} with a
94
+ * `proposals` array (empty when the component is out of scope or the project
95
+ * has no proposals).
96
+ *
97
+ * @examplePrompt Which design options is this component part of?
98
+ * @examplePrompt List the proposals that contain this wall
99
+ * @examplePrompt Is this element shared across multiple design variants?
100
+ *
101
+ * # Example
102
+ * ```ts
103
+ * const { proposals } = await snaptrude.core.proposals.listForComponent(wall)
104
+ * console.log(`shared across ${proposals.length} proposals`)
105
+ * ```
106
+ */
107
+ abstract listForComponent(component: ComponentHandle): PluginApiReturn<PluginCoreProposalsListForComponentResult>;
108
+ /**
109
+ * Test whether a proposal is the active one.
110
+ *
111
+ * @param proposalId - The id of the proposal to test.
112
+ * @returns `true` if it is the active proposal, otherwise `false` (including
113
+ * when no proposal has that id).
114
+ *
115
+ * @examplePrompt Is proposal prop_2 the active one?
116
+ * @examplePrompt Check whether this design option is currently shown
117
+ * @examplePrompt Am I working in proposal prop_1?
118
+ *
119
+ * # Example
120
+ * ```ts
121
+ * if (await snaptrude.core.proposals.isActive("prop_1")) {
122
+ * console.log("prop_1 is active")
123
+ * }
124
+ * ```
125
+ */
126
+ abstract isActive(proposalId: string): PluginApiReturn<boolean>;
127
+ /**
128
+ * Create a new design option (proposal).
129
+ *
130
+ * **Pro-gated** (creating proposals requires a Pro plan, matching the UI) and
131
+ * **not undoable**. Creates a bare proposal with a single empty default
132
+ * bucket — it does **not** carry forward the current proposal's layers, views,
133
+ * or targets. The name is capped at 24 characters.
134
+ *
135
+ * @param name - Display name of the new proposal (capped at 24 chars).
136
+ * @returns The new proposal's id (read the full record back with
137
+ * {@linkcode PluginCoreProposalsApi.get}).
138
+ * @throws If the caller is not on a Pro plan, or the proposal could not be
139
+ * created.
140
+ *
141
+ * @examplePrompt Create a design option called Scheme B
142
+ * @examplePrompt Add a new proposal named Option 2
143
+ * @examplePrompt Make a fresh design variant to explore
144
+ *
145
+ * # Example
146
+ * ```ts
147
+ * const { id } = await snaptrude.core.proposals.create("Scheme B")
148
+ * ```
149
+ */
150
+ abstract create(name: string): PluginApiReturn<PluginCoreProposalsCreateResult>;
151
+ /**
152
+ * Rename a proposal.
153
+ *
154
+ * **Not undoable.** The name is capped at 24 characters.
155
+ *
156
+ * @param proposalId - The id of the proposal to rename.
157
+ * @param name - The new display name (capped at 24 chars).
158
+ * @returns The updated {@linkcode PluginCoreProposalRef}.
159
+ * @throws If no proposal has the given id, or the name is empty / duplicates
160
+ * another proposal.
161
+ *
162
+ * @examplePrompt Rename proposal prop_1 to Final Scheme
163
+ * @examplePrompt Change the name of this design option
164
+ * @examplePrompt Call proposal prop_2 "Option A"
165
+ *
166
+ * # Example
167
+ * ```ts
168
+ * const proposal = await snaptrude.core.proposals.rename("prop_1", "Final Scheme")
169
+ * ```
170
+ */
171
+ abstract rename(proposalId: string, name: string): PluginApiReturn<PluginCoreProposalsRenameResult>;
172
+ /**
173
+ * Switch the active proposal.
174
+ *
175
+ * A **heavy scene switch** and **not undoable**. Switching clears the current
176
+ * selection, resets AI / streaming state, cancels proposal-scoped operations,
177
+ * retoggles bucket visibility to the new proposal's owned set, restores its
178
+ * per-proposal site/FSI settings, and realigns the views panel. After the
179
+ * switch, **writes** are guarded to the new active proposal (edits targeting
180
+ * components outside it are rejected), but **list reads are NOT
181
+ * proposal-filtered** — `design.query.list*` and similar reads stay
182
+ * project-wide; filter their results via
183
+ * {@linkcode PluginCoreProposalsApi.listForComponent} if you need
184
+ * proposal-scoped sets.
185
+ *
186
+ * **Blocked while an in-canvas agent run is in flight** — throws
187
+ * `PROPOSAL_SWITCH_BLOCKED` if a canvas-agent run is active (matching the UI's
188
+ * hard block), because a switch would cancel the in-flight run.
189
+ *
190
+ * @param proposalId - The id of the proposal to activate.
191
+ * @returns The id of the now-active proposal.
192
+ * @throws `PROPOSAL_SWITCH_BLOCKED` while a canvas-agent run is in flight; or
193
+ * if no proposal has the given id.
194
+ *
195
+ * @examplePrompt Switch to proposal prop_2
196
+ * @examplePrompt Make Scheme B the active design option
197
+ * @examplePrompt Show me the other proposal
198
+ *
199
+ * # Example
200
+ * ```ts
201
+ * await snaptrude.core.proposals.setActive("prop_2")
202
+ * ```
203
+ */
204
+ abstract setActive(proposalId: string): PluginApiReturn<PluginCoreProposalsSetActiveResult>;
205
+ /**
206
+ * Delete a proposal.
207
+ *
208
+ * **DANGEROUS AND IRREVERSIBLE — not undoable.** You must choose **exactly
209
+ * one** explicit disposition (mirroring the product's delete dialog):
210
+ *
211
+ * - `{ deleteObjects: true }` — delete the proposal AND **permanently
212
+ * destroy the geometry** in its exclusive buckets. Buckets shared with
213
+ * other proposals are never destroyed.
214
+ * - `{ targetProposalId }` — transfer **all** of this proposal's buckets to
215
+ * another proposal first (keeping the geometry alive), then delete the
216
+ * emptied proposal — "merge and remove". The target must be a
217
+ * **different** proposal.
218
+ *
219
+ * A bare `delete(proposalId)` is **rejected**: there is no safe default —
220
+ * without a disposition the engine would drop the proposal's bucket records
221
+ * while leaving their components orphaned. Passing both dispositions at once
222
+ * is also rejected as ambiguous.
223
+ *
224
+ * It is **server-validated**: the backend refuses the delete (throws) if a
225
+ * collaborator is active in that proposal, and the check times out after
226
+ * ~10s. The project's **last remaining proposal cannot be deleted**. If the
227
+ * proposal is active, the host switches away first.
228
+ *
229
+ * @param proposalId - The id of the proposal to delete.
230
+ * @param options - Exactly one disposition: `{ deleteObjects: true }`
231
+ * (destroy exclusive-bucket geometry) or `{ targetProposalId }` (transfer
232
+ * buckets to that proposal, then delete).
233
+ * @returns Confirmation that the proposal was deleted.
234
+ * @throws If no disposition (or both) is given, `targetProposalId` equals
235
+ * `proposalId`, no proposal has the given id, it is the only proposal, a
236
+ * collaborator lock refuses the delete, or the server validation times out.
237
+ *
238
+ * @examplePrompt Delete proposal prop_2 and everything in it
239
+ * @examplePrompt Remove this design option and destroy its geometry
240
+ * @examplePrompt Merge prop_2's layers into prop_1 and delete prop_2
241
+ *
242
+ * # Example
243
+ * ```ts
244
+ * // destroy the proposal and its exclusive geometry
245
+ * await snaptrude.core.proposals.delete("prop_2", { deleteObjects: true })
246
+ * // …or keep the geometry by transferring its buckets to prop_1 first
247
+ * await snaptrude.core.proposals.delete("prop_2", { targetProposalId: "prop_1" })
248
+ * ```
249
+ */
250
+ abstract delete(proposalId: string, options: {
251
+ deleteObjects: true;
252
+ targetProposalId?: never;
253
+ } | {
254
+ deleteObjects?: false;
255
+ targetProposalId: string;
256
+ }): PluginApiReturn<PluginCoreProposalsDeleteResult>;
257
+ }
258
+ /**
259
+ * A design option (proposal) in the active project.
260
+ *
261
+ * | Property | Type | Description |
262
+ * |---|---|---|
263
+ * | `id` | `string` | Stable public proposal id (e.g. `"prop_1"`) |
264
+ * | `name` | `string` | Display name (≤ 24 chars) |
265
+ * | `isActive` | `boolean` | Whether this is the active proposal |
266
+ * | `defaultBucketId` | `string` | Id of the proposal's default bucket (cannot be unshared) |
267
+ * | `bucketIds` | `string[]` | Ids of every bucket (layer) the proposal owns |
268
+ * | `createdAt` | `string` | ISO creation timestamp |
269
+ * | `createdBy` | `string` | User id of the creator |
270
+ */
271
+ export declare const PluginCoreProposalRef: z.ZodObject<{
272
+ id: z.ZodString;
273
+ name: z.ZodString;
274
+ isActive: z.ZodBoolean;
275
+ defaultBucketId: z.ZodString;
276
+ bucketIds: z.ZodArray<z.ZodString>;
277
+ createdAt: z.ZodString;
278
+ createdBy: z.ZodString;
279
+ }, z.core.$strip>;
280
+ export type PluginCoreProposalRef = z.infer<typeof PluginCoreProposalRef>;
281
+ /**
282
+ * Result of {@linkcode PluginCoreProposalsApi.list}.
283
+ *
284
+ * | Property | Type | Description |
285
+ * |---|---|---|
286
+ * | `proposals` | {@linkcode PluginCoreProposalRef}`[]` | Every proposal in the active project |
287
+ */
288
+ export declare const PluginCoreProposalsListResult: z.ZodObject<{
289
+ proposals: z.ZodArray<z.ZodObject<{
290
+ id: z.ZodString;
291
+ name: z.ZodString;
292
+ isActive: z.ZodBoolean;
293
+ defaultBucketId: z.ZodString;
294
+ bucketIds: z.ZodArray<z.ZodString>;
295
+ createdAt: z.ZodString;
296
+ createdBy: z.ZodString;
297
+ }, z.core.$strip>>;
298
+ }, z.core.$strip>;
299
+ export type PluginCoreProposalsListResult = z.infer<typeof PluginCoreProposalsListResult>;
300
+ /**
301
+ * Arguments for {@linkcode PluginCoreProposalsApi.get} /
302
+ * {@linkcode PluginCoreProposalsApi.isActive}.
303
+ *
304
+ * | Property | Type | Description |
305
+ * |---|---|---|
306
+ * | `proposalId` | `string` | The id of the proposal |
307
+ */
308
+ export declare const PluginCoreProposalsGetArgs: z.ZodObject<{
309
+ proposalId: z.ZodString;
310
+ }, z.core.$strip>;
311
+ export type PluginCoreProposalsGetArgs = z.infer<typeof PluginCoreProposalsGetArgs>;
312
+ /**
313
+ * Result of {@linkcode PluginCoreProposalsApi.get} — the proposal, or `null`
314
+ * when no proposal has the given id.
315
+ */
316
+ export declare const PluginCoreProposalsGetResult: z.ZodNullable<z.ZodObject<{
317
+ id: z.ZodString;
318
+ name: z.ZodString;
319
+ isActive: z.ZodBoolean;
320
+ defaultBucketId: z.ZodString;
321
+ bucketIds: z.ZodArray<z.ZodString>;
322
+ createdAt: z.ZodString;
323
+ createdBy: z.ZodString;
324
+ }, z.core.$strip>>;
325
+ export type PluginCoreProposalsGetResult = z.infer<typeof PluginCoreProposalsGetResult>;
326
+ /**
327
+ * Result of {@linkcode PluginCoreProposalsApi.getActive} — the active proposal,
328
+ * or `null` when nothing is active (legacy / no-proposal project).
329
+ */
330
+ export declare const PluginCoreProposalsGetActiveResult: z.ZodNullable<z.ZodObject<{
331
+ id: z.ZodString;
332
+ name: z.ZodString;
333
+ isActive: z.ZodBoolean;
334
+ defaultBucketId: z.ZodString;
335
+ bucketIds: z.ZodArray<z.ZodString>;
336
+ createdAt: z.ZodString;
337
+ createdBy: z.ZodString;
338
+ }, z.core.$strip>>;
339
+ export type PluginCoreProposalsGetActiveResult = z.infer<typeof PluginCoreProposalsGetActiveResult>;
340
+ /**
341
+ * Arguments for {@linkcode PluginCoreProposalsApi.listForComponent}.
342
+ *
343
+ * | Property | Type | Description |
344
+ * |---|---|---|
345
+ * | `component` | {@linkcode ComponentHandle} | The component to look up |
346
+ */
347
+ export declare const PluginCoreProposalsListForComponentArgs: z.ZodObject<{
348
+ component: z.ZodPipe<z.ZodString, z.ZodTransform<ComponentHandle, string>>;
349
+ }, z.core.$strip>;
350
+ export type PluginCoreProposalsListForComponentArgs = z.infer<typeof PluginCoreProposalsListForComponentArgs>;
351
+ /**
352
+ * Result of {@linkcode PluginCoreProposalsApi.listForComponent} — the proposals
353
+ * the component belongs to (empty when out of scope or none). Same shape as
354
+ * {@linkcode PluginCoreProposalsListResult}.
355
+ */
356
+ export declare const PluginCoreProposalsListForComponentResult: z.ZodObject<{
357
+ proposals: z.ZodArray<z.ZodObject<{
358
+ id: z.ZodString;
359
+ name: z.ZodString;
360
+ isActive: z.ZodBoolean;
361
+ defaultBucketId: z.ZodString;
362
+ bucketIds: z.ZodArray<z.ZodString>;
363
+ createdAt: z.ZodString;
364
+ createdBy: z.ZodString;
365
+ }, z.core.$strip>>;
366
+ }, z.core.$strip>;
367
+ export type PluginCoreProposalsListForComponentResult = z.infer<typeof PluginCoreProposalsListForComponentResult>;
368
+ /**
369
+ * Arguments for {@linkcode PluginCoreProposalsApi.isActive}. Alias of
370
+ * {@linkcode PluginCoreProposalsGetArgs}.
371
+ */
372
+ export declare const PluginCoreProposalsIsActiveArgs: z.ZodObject<{
373
+ proposalId: z.ZodString;
374
+ }, z.core.$strip>;
375
+ export type PluginCoreProposalsIsActiveArgs = z.infer<typeof PluginCoreProposalsIsActiveArgs>;
376
+ /**
377
+ * Arguments for {@linkcode PluginCoreProposalsApi.create}.
378
+ *
379
+ * | Property | Type | Description |
380
+ * |---|---|---|
381
+ * | `name` | `string` | Display name of the new proposal (capped at 24 chars) |
382
+ */
383
+ export declare const PluginCoreProposalsCreateArgs: z.ZodObject<{
384
+ name: z.ZodString;
385
+ }, z.core.$strip>;
386
+ export type PluginCoreProposalsCreateArgs = z.infer<typeof PluginCoreProposalsCreateArgs>;
387
+ /**
388
+ * Result of {@linkcode PluginCoreProposalsApi.create} — the id of the new
389
+ * proposal.
390
+ *
391
+ * | Property | Type | Description |
392
+ * |---|---|---|
393
+ * | `id` | `string` | The id of the newly created proposal |
394
+ */
395
+ export declare const PluginCoreProposalsCreateResult: z.ZodObject<{
396
+ id: z.ZodString;
397
+ }, z.core.$strip>;
398
+ export type PluginCoreProposalsCreateResult = z.infer<typeof PluginCoreProposalsCreateResult>;
399
+ /**
400
+ * Arguments for {@linkcode PluginCoreProposalsApi.rename}.
401
+ *
402
+ * | Property | Type | Description |
403
+ * |---|---|---|
404
+ * | `proposalId` | `string` | The id of the proposal to rename |
405
+ * | `name` | `string` | The new display name (capped at 24 chars) |
406
+ */
407
+ export declare const PluginCoreProposalsRenameArgs: z.ZodObject<{
408
+ proposalId: z.ZodString;
409
+ name: z.ZodString;
410
+ }, z.core.$strip>;
411
+ export type PluginCoreProposalsRenameArgs = z.infer<typeof PluginCoreProposalsRenameArgs>;
412
+ /** Result of {@linkcode PluginCoreProposalsApi.rename} — the updated record. */
413
+ export declare const PluginCoreProposalsRenameResult: z.ZodObject<{
414
+ id: z.ZodString;
415
+ name: z.ZodString;
416
+ isActive: z.ZodBoolean;
417
+ defaultBucketId: z.ZodString;
418
+ bucketIds: z.ZodArray<z.ZodString>;
419
+ createdAt: z.ZodString;
420
+ createdBy: z.ZodString;
421
+ }, z.core.$strip>;
422
+ export type PluginCoreProposalsRenameResult = z.infer<typeof PluginCoreProposalsRenameResult>;
423
+ /**
424
+ * Arguments for {@linkcode PluginCoreProposalsApi.setActive}.
425
+ *
426
+ * | Property | Type | Description |
427
+ * |---|---|---|
428
+ * | `proposalId` | `string` | The id of the proposal to activate |
429
+ */
430
+ export declare const PluginCoreProposalsSetActiveArgs: z.ZodObject<{
431
+ proposalId: z.ZodString;
432
+ }, z.core.$strip>;
433
+ export type PluginCoreProposalsSetActiveArgs = z.infer<typeof PluginCoreProposalsSetActiveArgs>;
434
+ /**
435
+ * Result of {@linkcode PluginCoreProposalsApi.setActive} — the now-active
436
+ * proposal's id.
437
+ *
438
+ * | Property | Type | Description |
439
+ * |---|---|---|
440
+ * | `id` | `string` | The id of the now-active proposal |
441
+ */
442
+ export declare const PluginCoreProposalsSetActiveResult: z.ZodObject<{
443
+ id: z.ZodString;
444
+ }, z.core.$strip>;
445
+ export type PluginCoreProposalsSetActiveResult = z.infer<typeof PluginCoreProposalsSetActiveResult>;
446
+ /**
447
+ * Arguments for {@linkcode PluginCoreProposalsApi.delete}. Exactly one
448
+ * disposition is required: `deleteObjects: true` XOR `targetProposalId` (a
449
+ * **different** proposal). A bare delete with neither is rejected.
450
+ *
451
+ * | Property | Type | Description |
452
+ * |---|---|---|
453
+ * | `proposalId` | `string` | The id of the proposal to delete |
454
+ * | `deleteObjects` | `true \| undefined` | Destroy the geometry in exclusive buckets (mutually exclusive with `targetProposalId`) |
455
+ * | `targetProposalId` | `string \| undefined` | Transfer this proposal's buckets here before deleting (must differ from `proposalId`) |
456
+ */
457
+ export declare const PluginCoreProposalsDeleteArgs: z.ZodObject<{
458
+ proposalId: z.ZodString;
459
+ deleteObjects: z.ZodOptional<z.ZodBoolean>;
460
+ targetProposalId: z.ZodOptional<z.ZodString>;
461
+ }, z.core.$strip>;
462
+ export type PluginCoreProposalsDeleteArgs = z.infer<typeof PluginCoreProposalsDeleteArgs>;
463
+ /**
464
+ * Result of {@linkcode PluginCoreProposalsApi.delete} — confirmation that the
465
+ * proposal was deleted.
466
+ *
467
+ * | Property | Type | Description |
468
+ * |---|---|---|
469
+ * | `deleted` | `true` | Always `true` on success |
470
+ */
471
+ export declare const PluginCoreProposalsDeleteResult: z.ZodObject<{
472
+ deleted: z.ZodLiteral<true>;
473
+ }, z.core.$strip>;
474
+ export type PluginCoreProposalsDeleteResult = z.infer<typeof PluginCoreProposalsDeleteResult>;
475
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/api/core/proposals/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAElD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,8BAAsB,sBAAsB;;IAG1C;;;;;;;;;;;;;;;OAeG;aACa,IAAI,IAAI,eAAe,CAAC,6BAA6B,CAAC;IAEtE;;;;;;;;;;;;;;;;OAgBG;aACa,GAAG,CACjB,UAAU,EAAE,MAAM,GACjB,eAAe,CAAC,4BAA4B,CAAC;IAEhD;;;;;;;;;;;;;;;;;;;;OAoBG;aACa,SAAS,IAAI,eAAe,CAAC,kCAAkC,CAAC;IAEhF;;;;;;;;;;;;;;;;;;;;OAoBG;aACa,gBAAgB,CAC9B,SAAS,EAAE,eAAe,GACzB,eAAe,CAAC,yCAAyC,CAAC;IAE7D;;;;;;;;;;;;;;;;;OAiBG;aACa,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,eAAe,CAAC,OAA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