@snaptrude/plugin-core 0.0.0-dev-20260708130115 → 0.0.0-dev-20260827135706

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 (261) hide show
  1. package/CHANGELOG.md +152 -1
  2. package/api-manifest.json +3620 -276
  3. package/dist/api/analysis/daylight.d.ts +603 -0
  4. package/dist/api/analysis/daylight.d.ts.map +1 -0
  5. package/dist/api/analysis/heatmaps.d.ts +658 -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 +59 -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/solar.d.ts +249 -0
  14. package/dist/api/analysis/solar.d.ts.map +1 -0
  15. package/dist/api/analysis/sunlightHours.d.ts +208 -0
  16. package/dist/api/analysis/sunlightHours.d.ts.map +1 -0
  17. package/dist/api/analysis/sunpath.d.ts +80 -0
  18. package/dist/api/analysis/sunpath.d.ts.map +1 -0
  19. package/dist/api/analysis/weather.d.ts +193 -0
  20. package/dist/api/analysis/weather.d.ts.map +1 -0
  21. package/dist/api/core/camera/index.d.ts +261 -0
  22. package/dist/api/core/camera/index.d.ts.map +1 -0
  23. package/dist/api/core/comment/index.d.ts +105 -2
  24. package/dist/api/core/comment/index.d.ts.map +1 -1
  25. package/dist/api/core/geom/create/index.d.ts +840 -14
  26. package/dist/api/core/geom/create/index.d.ts.map +1 -1
  27. package/dist/api/core/geom/delete/index.d.ts +8 -2
  28. package/dist/api/core/geom/delete/index.d.ts.map +1 -1
  29. package/dist/api/core/geom/query/arc.d.ts +5 -5
  30. package/dist/api/core/geom/query/brep.d.ts +130 -18
  31. package/dist/api/core/geom/query/brep.d.ts.map +1 -1
  32. package/dist/api/core/geom/query/circle.d.ts +18 -18
  33. package/dist/api/core/geom/query/contour.d.ts +20 -20
  34. package/dist/api/core/geom/query/curve.d.ts +49 -49
  35. package/dist/api/core/geom/query/edge.d.ts +5 -5
  36. package/dist/api/core/geom/query/face.d.ts +16 -16
  37. package/dist/api/core/geom/query/halfedge.d.ts +8 -8
  38. package/dist/api/core/geom/query/profile.d.ts +19 -19
  39. package/dist/api/core/geom/query/vertex.d.ts +8 -8
  40. package/dist/api/core/geom/update/contour.d.ts +14 -14
  41. package/dist/api/core/geom/update/curve.d.ts +7 -7
  42. package/dist/api/core/geom/update/profile.d.ts +16 -16
  43. package/dist/api/core/handles/index.d.ts +210 -0
  44. package/dist/api/core/handles/index.d.ts.map +1 -0
  45. package/dist/api/core/index.d.ts +34 -0
  46. package/dist/api/core/index.d.ts.map +1 -1
  47. package/dist/api/core/io/export/index.d.ts +134 -0
  48. package/dist/api/core/io/export/index.d.ts.map +1 -0
  49. package/dist/api/core/io/import/index.d.ts +453 -0
  50. package/dist/api/core/io/import/index.d.ts.map +1 -0
  51. package/dist/api/core/io/index.d.ts +40 -0
  52. package/dist/api/core/io/index.d.ts.map +1 -0
  53. package/dist/api/core/io/job/index.d.ts +139 -0
  54. package/dist/api/core/io/job/index.d.ts.map +1 -0
  55. package/dist/api/core/io/query/index.d.ts +74 -0
  56. package/dist/api/core/io/query/index.d.ts.map +1 -0
  57. package/dist/api/core/io/terrain/index.d.ts +341 -0
  58. package/dist/api/core/io/terrain/index.d.ts.map +1 -0
  59. package/dist/api/core/io/underlay/index.d.ts +805 -0
  60. package/dist/api/core/io/underlay/index.d.ts.map +1 -0
  61. package/dist/api/core/layers.d.ts +7 -7
  62. package/dist/api/core/mode/index.d.ts +99 -0
  63. package/dist/api/core/mode/index.d.ts.map +1 -0
  64. package/dist/api/core/project/index.d.ts +68 -1
  65. package/dist/api/core/project/index.d.ts.map +1 -1
  66. package/dist/api/core/proposals/index.d.ts +531 -0
  67. package/dist/api/core/proposals/index.d.ts.map +1 -0
  68. package/dist/api/core/storeys/index.d.ts +265 -0
  69. package/dist/api/core/storeys/index.d.ts.map +1 -0
  70. package/dist/api/core/tags.d.ts +24 -0
  71. package/dist/api/core/tags.d.ts.map +1 -1
  72. package/dist/api/core/user.d.ts +44 -0
  73. package/dist/api/core/user.d.ts.map +1 -0
  74. package/dist/api/core/zoom/index.d.ts +4 -0
  75. package/dist/api/core/zoom/index.d.ts.map +1 -1
  76. package/dist/api/design/boolean/index.d.ts +4 -4
  77. package/dist/api/design/create/index.d.ts +568 -45
  78. package/dist/api/design/create/index.d.ts.map +1 -1
  79. package/dist/api/design/delete/index.d.ts +3 -0
  80. package/dist/api/design/delete/index.d.ts.map +1 -1
  81. package/dist/api/design/doors/index.d.ts +195 -0
  82. package/dist/api/design/doors/index.d.ts.map +1 -1
  83. package/dist/api/design/edit/index.d.ts +1 -1
  84. package/dist/api/design/erase/index.d.ts +2 -2
  85. package/dist/api/design/family.d.ts +349 -0
  86. package/dist/api/design/family.d.ts.map +1 -0
  87. package/dist/api/design/furniture/index.d.ts +181 -8
  88. package/dist/api/design/furniture/index.d.ts.map +1 -1
  89. package/dist/api/design/index.d.ts +98 -0
  90. package/dist/api/design/index.d.ts.map +1 -1
  91. package/dist/api/design/lock.d.ts +26 -0
  92. package/dist/api/design/lock.d.ts.map +1 -1
  93. package/dist/api/design/materials/index.d.ts +270 -16
  94. package/dist/api/design/materials/index.d.ts.map +1 -1
  95. package/dist/api/design/query/geometry/index.d.ts +112 -0
  96. package/dist/api/design/query/geometry/index.d.ts.map +1 -1
  97. package/dist/api/design/query/index.d.ts +282 -11
  98. package/dist/api/design/query/index.d.ts.map +1 -1
  99. package/dist/api/design/query/referenceLines.d.ts +45 -0
  100. package/dist/api/design/query/referenceLines.d.ts.map +1 -0
  101. package/dist/api/design/query/spaces.d.ts +181 -8
  102. package/dist/api/design/query/spaces.d.ts.map +1 -1
  103. package/dist/api/design/selection/index.d.ts +144 -0
  104. package/dist/api/design/selection/index.d.ts.map +1 -1
  105. package/dist/api/design/transform/index.d.ts +172 -10
  106. package/dist/api/design/transform/index.d.ts.map +1 -1
  107. package/dist/api/design/types/index.d.ts +181 -0
  108. package/dist/api/design/types/index.d.ts.map +1 -0
  109. package/dist/api/design/update/index.d.ts +553 -2
  110. package/dist/api/design/update/index.d.ts.map +1 -1
  111. package/dist/api/design/visibility.d.ts +126 -0
  112. package/dist/api/design/visibility.d.ts.map +1 -0
  113. package/dist/api/design/windows/index.d.ts +113 -2
  114. package/dist/api/design/windows/index.d.ts.map +1 -1
  115. package/dist/api/entity/buildableEnvelope.d.ts +4 -0
  116. package/dist/api/entity/buildableEnvelope.d.ts.map +1 -1
  117. package/dist/api/entity/referenceLine.d.ts +10 -2
  118. package/dist/api/entity/referenceLine.d.ts.map +1 -1
  119. package/dist/api/entity/space.d.ts +21 -21
  120. package/dist/api/entity/story.d.ts +242 -15
  121. package/dist/api/entity/story.d.ts.map +1 -1
  122. package/dist/api/index.d.ts +10 -0
  123. package/dist/api/index.d.ts.map +1 -1
  124. package/dist/api/presentation/aiInspiration.d.ts +25 -25
  125. package/dist/api/presentation/annotate.d.ts +467 -0
  126. package/dist/api/presentation/annotate.d.ts.map +1 -0
  127. package/dist/api/presentation/diagrams.d.ts +111 -8
  128. package/dist/api/presentation/diagrams.d.ts.map +1 -1
  129. package/dist/api/presentation/export.d.ts +108 -0
  130. package/dist/api/presentation/export.d.ts.map +1 -0
  131. package/dist/api/presentation/import.d.ts +55 -4
  132. package/dist/api/presentation/import.d.ts.map +1 -1
  133. package/dist/api/presentation/index.d.ts +58 -1
  134. package/dist/api/presentation/index.d.ts.map +1 -1
  135. package/dist/api/presentation/placedViews.d.ts +1139 -0
  136. package/dist/api/presentation/placedViews.d.ts.map +1 -0
  137. package/dist/api/presentation/shapes.d.ts +481 -0
  138. package/dist/api/presentation/shapes.d.ts.map +1 -0
  139. package/dist/api/presentation/sheets.d.ts +452 -13
  140. package/dist/api/presentation/sheets.d.ts.map +1 -1
  141. package/dist/api/presentation/slideshow.d.ts +125 -0
  142. package/dist/api/presentation/slideshow.d.ts.map +1 -0
  143. package/dist/api/presentation/tables.d.ts +81 -0
  144. package/dist/api/presentation/tables.d.ts.map +1 -0
  145. package/dist/api/presentation/views.d.ts +367 -7
  146. package/dist/api/presentation/views.d.ts.map +1 -1
  147. package/dist/api/program/areas.d.ts +102 -12
  148. package/dist/api/program/areas.d.ts.map +1 -1
  149. package/dist/api/program/cores.d.ts +3 -99
  150. package/dist/api/program/cores.d.ts.map +1 -1
  151. package/dist/api/program/index.d.ts +7 -15
  152. package/dist/api/program/index.d.ts.map +1 -1
  153. package/dist/api/program/layout.d.ts +346 -11
  154. package/dist/api/program/layout.d.ts.map +1 -1
  155. package/dist/api/program/site.d.ts +469 -13
  156. package/dist/api/program/site.d.ts.map +1 -1
  157. package/dist/api/program/spreadsheet.d.ts +365 -41
  158. package/dist/api/program/spreadsheet.d.ts.map +1 -1
  159. package/dist/api/workspace/index.d.ts +505 -0
  160. package/dist/api/workspace/index.d.ts.map +1 -0
  161. package/dist/errors/codes.d.ts +34 -0
  162. package/dist/errors/codes.d.ts.map +1 -0
  163. package/dist/errors/envelope.d.ts +56 -0
  164. package/dist/errors/envelope.d.ts.map +1 -0
  165. package/dist/errors/index.d.ts +6 -0
  166. package/dist/errors/index.d.ts.map +1 -0
  167. package/dist/errors/plugin-error.d.ts +69 -0
  168. package/dist/errors/plugin-error.d.ts.map +1 -0
  169. package/dist/handles.d.ts +97 -25
  170. package/dist/handles.d.ts.map +1 -1
  171. package/dist/host-utils.d.ts +4 -0
  172. package/dist/host-utils.d.ts.map +1 -1
  173. package/dist/index.cjs +4582 -1422
  174. package/dist/index.cjs.map +1 -1
  175. package/dist/index.d.ts +1 -0
  176. package/dist/index.d.ts.map +1 -1
  177. package/dist/index.js +4171 -1411
  178. package/dist/index.js.map +1 -1
  179. package/package.json +4 -2
  180. package/scripts/generate-manifest.mjs +45 -0
  181. package/scripts/generate-manifest.test.mjs +103 -4
  182. package/src/api/analysis/daylight.ts +470 -0
  183. package/src/api/analysis/heatmaps.ts +683 -0
  184. package/src/api/analysis/illuminance.ts +155 -0
  185. package/src/api/analysis/index.ts +61 -0
  186. package/src/api/analysis/shadows.ts +183 -0
  187. package/src/api/analysis/solar.ts +237 -0
  188. package/src/api/analysis/sunlightHours.ts +211 -0
  189. package/src/api/analysis/sunpath.ts +83 -0
  190. package/src/api/analysis/weather.ts +179 -0
  191. package/src/api/core/camera/index.ts +268 -0
  192. package/src/api/core/comment/index.ts +120 -2
  193. package/src/api/core/geom/create/index.ts +912 -1
  194. package/src/api/core/geom/delete/index.ts +6 -0
  195. package/src/api/core/geom/query/brep.ts +119 -0
  196. package/src/api/core/handles/index.ts +233 -0
  197. package/src/api/core/index.ts +34 -0
  198. package/src/api/core/io/export/index.ts +126 -0
  199. package/src/api/core/io/import/index.ts +496 -0
  200. package/src/api/core/io/index.ts +42 -0
  201. package/src/api/core/io/job/index.ts +140 -0
  202. package/src/api/core/io/query/index.ts +71 -0
  203. package/src/api/core/io/terrain/index.ts +360 -0
  204. package/src/api/core/io/underlay/index.ts +705 -0
  205. package/src/api/core/mode/index.ts +96 -0
  206. package/src/api/core/project/index.ts +62 -1
  207. package/src/api/core/proposals/index.ts +569 -0
  208. package/src/api/core/storeys/index.ts +294 -0
  209. package/src/api/core/tags.ts +27 -0
  210. package/src/api/core/user.ts +46 -0
  211. package/src/api/core/zoom/index.ts +4 -0
  212. package/src/api/design/create/index.ts +670 -30
  213. package/src/api/design/delete/index.ts +3 -0
  214. package/src/api/design/doors/index.ts +208 -0
  215. package/src/api/design/erase/index.ts +1 -1
  216. package/src/api/design/family.ts +388 -0
  217. package/src/api/design/furniture/index.ts +197 -8
  218. package/src/api/design/index.ts +102 -0
  219. package/src/api/design/lock.ts +27 -0
  220. package/src/api/design/materials/index.ts +334 -27
  221. package/src/api/design/query/geometry/index.ts +125 -3
  222. package/src/api/design/query/index.ts +217 -7
  223. package/src/api/design/query/referenceLines.ts +52 -0
  224. package/src/api/design/query/spaces.ts +143 -0
  225. package/src/api/design/selection/index.ts +129 -0
  226. package/src/api/design/transform/index.ts +170 -9
  227. package/src/api/design/types/index.ts +156 -0
  228. package/src/api/design/update/index.ts +631 -3
  229. package/src/api/design/visibility.ts +143 -0
  230. package/src/api/design/windows/index.ts +128 -2
  231. package/src/api/entity/buildableEnvelope.ts +4 -0
  232. package/src/api/entity/referenceLine.ts +8 -0
  233. package/src/api/entity/story.ts +259 -15
  234. package/src/api/index.ts +10 -0
  235. package/src/api/presentation/annotate.ts +385 -0
  236. package/src/api/presentation/diagrams.ts +118 -8
  237. package/src/api/presentation/export.ts +108 -0
  238. package/src/api/presentation/import.ts +51 -4
  239. package/src/api/presentation/index.ts +66 -1
  240. package/src/api/presentation/placedViews.ts +1120 -0
  241. package/src/api/presentation/shapes.ts +274 -0
  242. package/src/api/presentation/sheets.ts +400 -13
  243. package/src/api/presentation/slideshow.ts +134 -0
  244. package/src/api/presentation/tables.ts +84 -0
  245. package/src/api/presentation/views.ts +376 -8
  246. package/src/api/program/areas.ts +88 -15
  247. package/src/api/program/cores.ts +3 -91
  248. package/src/api/program/index.ts +7 -15
  249. package/src/api/program/layout.ts +365 -11
  250. package/src/api/program/site.ts +435 -13
  251. package/src/api/program/spreadsheet.ts +376 -35
  252. package/src/api/workspace/index.ts +563 -0
  253. package/src/errors/codes.ts +136 -0
  254. package/src/errors/envelope.ts +75 -0
  255. package/src/errors/index.ts +21 -0
  256. package/src/errors/plugin-error.ts +134 -0
  257. package/src/handles.ts +123 -13
  258. package/src/host-utils.ts +4 -0
  259. package/src/index.ts +1 -0
  260. package/test/errors.test.mjs +184 -0
  261. package/tsconfig.json +7 -2
@@ -0,0 +1,453 @@
1
+ import * as z from "zod";
2
+ import { PluginApiReturn } from "../../../../types";
3
+ import { Vec3Handle, UnderlayHandle, TerrainHandle, ImportJobHandle, ComponentHandle } from "../../../../handles";
4
+ /**
5
+ * A file `source` accepted by every importer: an `https://` URL or a `data:`
6
+ * URL (base64). Validated for shape at the boundary — other schemes (`http:`,
7
+ * `blob:`, `file:`) are rejected, since the host page (HTTPS) cannot fetch them.
8
+ */
9
+ export declare const ImportSource: z.ZodString;
10
+ /**
11
+ * File import — bring external files into the Snaptrude **scene**.
12
+ *
13
+ * `core.io.import.*` ingests images, PDFs, CAD drawings, 3D models, and site
14
+ * terrain and commits them to the model as traceable underlays, placed geometry,
15
+ * or topography. It is the scene counterpart to `presentation.import.*` (which
16
+ * drops assets on the Present canvas, not the model).
17
+ *
18
+ * ## The `source` argument
19
+ * Every file importer takes a single `source` **string** — either an `https://`
20
+ * URL or a `data:` URL (base64). A plugin worker cannot hand a browser `File`
21
+ * across the boundary, so the host fetches `source` and rebuilds the `File`
22
+ * itself. Both forms go through the same path.
23
+ *
24
+ * ## Return values
25
+ * - `image` / `pdf` / `cadJson` → an {@linkcode UnderlayHandle} (a placed 2D
26
+ * reference plane; drive it with `core.io.underlay.*`).
27
+ * - `dwg` → an {@linkcode ImportJobHandle} — DWG conversion is a long server job,
28
+ * so `dwg` returns immediately and you poll it with `core.io.job.*`.
29
+ * - `model` → a {@linkcode ComponentHandle} (a placed 3D component).
30
+ * - `terrain` → a {@linkcode TerrainHandle} (the project's single site terrain).
31
+ *
32
+ * Every importer **throws** on failure (bad source, unsupported format, engine
33
+ * error). Accessed via `snaptrude.core.io.import`.
34
+ */
35
+ export declare abstract class PluginCoreIoImportApi {
36
+ constructor();
37
+ /**
38
+ * Import a raster image as a scene **underlay** — a flat, textured reference
39
+ * plane placed on a storey that you can trace over.
40
+ *
41
+ * Supported formats: PNG, JPG/JPEG, BMP. The image is placed on the target
42
+ * storey's "Image" layer at ~50% opacity by default.
43
+ *
44
+ * To place the image on a **Present-mode sheet** instead of the scene, use
45
+ * `presentation.import.image`.
46
+ *
47
+ * The plane is placed at the storey origin (the engine's import placement);
48
+ * there is no placement parameter — calibrate size with
49
+ * {@link PluginCoreIoUnderlayApi.setScale} after import.
50
+ *
51
+ * @param source - The image to import: an `https://` URL or a `data:` URL.
52
+ * @param storey - Target storey number. Defaults to the active storey.
53
+ * @param scale - Initial uniform scale factor applied to the plane. Calibrate
54
+ * precisely afterwards with {@link PluginCoreIoUnderlayApi.setScale}.
55
+ * @param opacity - Plane opacity, `0`..`1` (default ~`0.5`).
56
+ * @param label - A name for the created underlay.
57
+ * @returns the created {@linkcode UnderlayHandle}.
58
+ * @throws if writes are disabled, the source can't be loaded, the format is
59
+ * unsupported, or the engine fails to place the plane.
60
+ *
61
+ * @examplePrompt Import this floor plan image onto the ground floor to trace over
62
+ * @examplePrompt Drop this survey PNG in as a reference underlay at 30% opacity
63
+ * @examplePrompt Add a site plan image on storey 2
64
+ * @examplePrompt Bring in a sketch to trace, faded to half opacity
65
+ *
66
+ * # Example
67
+ * ```ts
68
+ * // Place a floor plan on storey 1, then calibrate it to a real-world size.
69
+ * const plan = await snaptrude.core.io.import.image(
70
+ * "https://example.com/floorplan.png",
71
+ * 1, // storey
72
+ * undefined, // scale
73
+ * 0.4, // opacity
74
+ * "Ground floor plan",
75
+ * )
76
+ * // Make the plan's longest side exactly 40 project-units:
77
+ * await snaptrude.core.io.underlay.setScale(plan, { planSize: 40 })
78
+ * ```
79
+ */
80
+ abstract image(source: string, storey?: number, scale?: number, opacity?: number, label?: string): PluginApiReturn<UnderlayHandle>;
81
+ /**
82
+ * Import one page of a PDF as a scene **underlay** (a traceable reference plane).
83
+ *
84
+ * One PDF per storey, one page per call. To bring in several pages, call once
85
+ * per page onto different storeys.
86
+ *
87
+ * @param source - The PDF to import: an `https://` URL or a `data:` URL.
88
+ * @param storey - Target storey number. Defaults to the active storey.
89
+ * @param page - 1-based page number to import (multi-page PDFs). Default `1`.
90
+ * @param scale - A drawing-scale **label** that sizes the page in real-world
91
+ * units, matching the project's unit mode: metric `"1:10"`..`"1:1000"` (e.g.
92
+ * `"1:100"`) or imperial `` `1/8" = 1'` `` / `` `1" = 10'` ``. Must be a valid
93
+ * label for the current unit mode (invalid → throws). Defaults to `"1:100"`
94
+ * in metric projects and `` `1" = 1'` `` in imperial projects. Re-calibrate
95
+ * afterwards with {@link PluginCoreIoUnderlayApi.setScale}.
96
+ * @param opacity - Plane opacity, `0`..`1` (default ~`0.5`).
97
+ * @returns the created {@linkcode UnderlayHandle}.
98
+ * @throws if writes are disabled, the source can't be loaded, the storey
99
+ * already has a PDF, the page is out of range, the scale label is invalid for
100
+ * the unit mode, or the engine fails.
101
+ *
102
+ * @examplePrompt Import page 1 of this PDF floor plan onto storey 1
103
+ * @examplePrompt Bring in the second page of this PDF as an underlay at 1:50
104
+ * @examplePrompt Add this PDF plan to the ground floor to trace over
105
+ * @examplePrompt Place page 3 of the drawing set on storey 3
106
+ *
107
+ * # Example
108
+ * ```ts
109
+ * const sheet = await snaptrude.core.io.import.pdf(
110
+ * "https://example.com/plans.pdf",
111
+ * 1, // storey
112
+ * 2, // page
113
+ * "1:100", // drawing scale
114
+ * )
115
+ * ```
116
+ */
117
+ abstract pdf(source: string, storey?: number, page?: number, scale?: string, opacity?: number): PluginApiReturn<UnderlayHandle>;
118
+ /**
119
+ * Import a **DWG** CAD drawing as a scene underlay. `.dwg` only (no DXF).
120
+ *
121
+ * DWG conversion runs on a server and can take minutes, so this **starts a job
122
+ * and returns immediately** with an {@linkcode ImportJobHandle}. One CAD
123
+ * import runs at a time: starting a second while one is in flight throws —
124
+ * poll the first job to completion first. Poll it with
125
+ * {@link PluginCoreIoJobApi.isComplete} / {@link PluginCoreIoJobApi.getStatus}, then call
126
+ * {@link PluginCoreIoJobApi.getResult} to get the placed {@linkcode UnderlayHandle}.
127
+ * For CAD you already have parsed as JSON, use {@link PluginCoreIoImportApi.cadJson}
128
+ * (synchronous, no server round-trip).
129
+ *
130
+ * All CAD layers are imported (there is no layer filter).
131
+ *
132
+ * @param source - The `.dwg` file: an `https://` URL or a `data:` URL.
133
+ * @param storey - Target storey number. Defaults to the active storey.
134
+ * @returns an {@linkcode ImportJobHandle} to poll via `core.io.job.*`.
135
+ * @throws if writes are disabled or the upload cannot be started. (Conversion
136
+ * failures surface later via {@link PluginCoreIoJobApi.getError}.)
137
+ *
138
+ * @examplePrompt Import this DWG floor plan onto storey 1
139
+ * @examplePrompt Bring in a CAD drawing as an underlay and tell me when it's ready
140
+ * @examplePrompt Start importing this CAD file onto the ground floor
141
+ *
142
+ * # Example
143
+ * ```ts
144
+ * const job = await snaptrude.core.io.import.dwg("https://example.com/plan.dwg", 1)
145
+ * // Poll until the server-side conversion finishes — always with a timeout
146
+ * // (a UI-cancelled import stays "processing" forever).
147
+ * const deadline = Date.now() + 5 * 60_000
148
+ * while (!(await snaptrude.core.io.job.isComplete(job))) {
149
+ * if (Date.now() > deadline) throw new Error("DWG import timed out")
150
+ * await new Promise((r) => setTimeout(r, 2000))
151
+ * }
152
+ * // The DWG lands as a CAD underlay. CAD scaling isn't supported; manage it
153
+ * // (list / fade / delete) via core.io.underlay.*.
154
+ * const cad = await snaptrude.core.io.job.getResult(job)
155
+ * if (cad) console.log("DWG imported as CAD underlay:", cad)
156
+ * ```
157
+ */
158
+ abstract dwg(source: string, storey?: number): PluginApiReturn<ImportJobHandle>;
159
+ /**
160
+ * Sketch a CAD underlay from **already-parsed CAD JSON** — synchronous, with no
161
+ * server round-trip. Use this when you hold parsed CAD data (e.g. produced by
162
+ * your own converter); use {@link PluginCoreIoImportApi.dwg} for raw `.dwg`
163
+ * files.
164
+ *
165
+ * All layers in the JSON are sketched (there is no layer filter), at the
166
+ * drawing's own coordinates.
167
+ *
168
+ * @param cad - The parsed CAD data: `{ unit, geometry: [...] }` describing the
169
+ * drawing's lines/arcs/layers.
170
+ * @param storey - Target storey number. Defaults to the active storey.
171
+ * @returns the created {@linkcode UnderlayHandle}.
172
+ * @throws if writes are disabled, the JSON yields no drawable geometry, or the
173
+ * drawing is out of bounds.
174
+ *
175
+ * @examplePrompt Sketch this parsed CAD JSON onto the active storey
176
+ * @examplePrompt Draw these CAD curves as an underlay on storey 2
177
+ * @examplePrompt Create a CAD sketch from this geometry data
178
+ * @examplePrompt Import my converted CAD JSON onto the ground floor
179
+ *
180
+ * # Example
181
+ * ```ts
182
+ * const cad = await snaptrude.core.io.import.cadJson(
183
+ * { unit: "mm", geometry: [{ type: "line", layer: "WALLS", ... }] },
184
+ * 1,
185
+ * )
186
+ * ```
187
+ */
188
+ abstract cadJson(cad: CadJsonInput, storey?: number): PluginApiReturn<UnderlayHandle>;
189
+ /**
190
+ * Import a **3D model** file and place it in the scene as a component.
191
+ *
192
+ * Supported formats: SketchUp (`.skp`), FBX (`.fbx`), OBJ (`.obj`), 3DS
193
+ * (`.3ds`), and zipped bundles (`.zip`). The file is converted on the server,
194
+ * then placed. `.glb`/`.gltf`/`.ifc`/`.stl` and Rhino/Revit are not supported.
195
+ *
196
+ * The model is placed at its source dimensions (interpreted in the file's own
197
+ * units); there is no import-time scale override.
198
+ *
199
+ * Unlike `dwg`, this call **waits for the server conversion**: a large model
200
+ * may exceed the 60-second call cap and reject at the API boundary while the
201
+ * import still completes in the background (the model then appears without a
202
+ * handle being returned — re-query the scene to find it). Keep sources small.
203
+ *
204
+ * @param source - The model file: an `https://` URL or a `data:` URL.
205
+ * @param storey - Target storey number. Defaults to the active storey.
206
+ * @param format - The file's format. Inferred from `source` when omitted.
207
+ * @param position - Where to place the model. Defaults to the storey origin.
208
+ * @param label - A name for the placed component.
209
+ * @returns the placed {@linkcode ComponentHandle}.
210
+ * @throws if writes are disabled, the source can't be loaded, the format is
211
+ * unsupported, conversion/placement fails, or the converted model cannot be
212
+ * found in the library after upload.
213
+ *
214
+ * @examplePrompt Import this SketchUp model onto storey 1
215
+ * @examplePrompt Bring in this OBJ file and place it at the origin
216
+ * @examplePrompt Add this 3D model to the ground floor
217
+ *
218
+ * # Example
219
+ * ```ts
220
+ * const model = await snaptrude.core.io.import.model(
221
+ * "https://example.com/tree.skp",
222
+ * 1, // storey
223
+ * "skp",
224
+ * )
225
+ * ```
226
+ */
227
+ abstract model(source: string, storey?: number, format?: ModelFormat, position?: Vec3Handle, label?: string): PluginApiReturn<ComponentHandle>;
228
+ /**
229
+ * Import **site terrain** for a location — Mapbox topography (elevation +
230
+ * satellite/streets imagery, optional neighborhood buildings and parcels).
231
+ *
232
+ * One terrain per project (a singleton). `width`/`length` describe the
233
+ * real-world extent of the area to load **in metres** (regardless of the
234
+ * project's unit mode); the host converts them to the right map zoom
235
+ * internally — you do not pass a zoom level.
236
+ *
237
+ * @param lat - Site latitude (degrees), `-90`..`90`.
238
+ * @param lng - Site longitude (degrees), `-180`..`180`.
239
+ * @param width - East–west extent of the area to load, in metres.
240
+ * @param length - North–south extent of the area to load, in metres.
241
+ * @param elevation - Include DEM elevation (a real terrain surface). Default `true`.
242
+ * @param satellite - Drape satellite imagery. Default `true`.
243
+ * @param neighborhood - Include surrounding context buildings. Default `false`.
244
+ * @param parcels - Include site parcel boundaries. Default `false`.
245
+ * @returns the created {@linkcode TerrainHandle}.
246
+ * @throws if writes are disabled, a terrain already exists, or the map/mesh
247
+ * generation fails.
248
+ *
249
+ * @examplePrompt Import the site terrain for this location, about 500m across
250
+ * @examplePrompt Load the topography at 40.7128, -74.0060 for a 300 by 300 meter site
251
+ * @examplePrompt Bring in satellite terrain for the site with the surrounding buildings
252
+ * @examplePrompt Add site elevation for a 1km by 1km area at these coordinates
253
+ *
254
+ * # Example
255
+ * ```ts
256
+ * // 300m × 300m site with elevation + satellite imagery.
257
+ * const terrain = await snaptrude.core.io.import.terrain(
258
+ * 40.7128, // lat
259
+ * -74.006, // lng
260
+ * 300, // width (metres)
261
+ * 300, // length (metres)
262
+ * true, // elevation
263
+ * true, // satellite
264
+ * )
265
+ * ```
266
+ */
267
+ abstract terrain(lat: number, lng: number, width: number, length: number, elevation?: boolean, satellite?: boolean, neighborhood?: boolean, parcels?: boolean): PluginApiReturn<TerrainHandle>;
268
+ /**
269
+ * Import an **EPW weather file** into the project's weather catalog.
270
+ *
271
+ * Uploads an EnergyPlus Weather (`.epw`) file and registers it as the
272
+ * project's site weather, returning its catalog `weatherFileId` — the same id
273
+ * {@link PluginAnalysisWeatherApi.getSeries}, `program.site.getWeather`, and a
274
+ * daylight run's provenance report. Uploading a user file makes the site's
275
+ * `selectionMethod` `"user-upload"`, overriding nearest-station resolution.
276
+ *
277
+ * **Mutating**: this writes project state and is subject to the plugin
278
+ * write-gate — it throws when plugin writes are disabled. Unlike the file
279
+ * underlay/model importers it returns no scene handle (a weather file is not
280
+ * a scene object), only the catalog `{ weatherFileId, label }`.
281
+ *
282
+ * @param source - The `.epw` file to import: an `https://` URL or a `data:` URL.
283
+ * @returns A {@linkcode PluginImportEpwResult} — the catalog `weatherFileId`
284
+ * and a human-readable `label` (the station/file name).
285
+ * @throws if writes are disabled, the source can't be loaded, or the file is
286
+ * not a valid EPW.
287
+ *
288
+ * @examplePrompt Import this EPW weather file for the site
289
+ * @examplePrompt Upload a custom weather file for the daylight analysis
290
+ * @examplePrompt Use this .epw as the project's weather source
291
+ *
292
+ * # Example
293
+ * ```ts
294
+ * const { weatherFileId, label } = await snaptrude.core.io.import.epw(
295
+ * "https://example.com/Chicago-OHare.epw",
296
+ * )
297
+ * console.log(`Weather set to ${label} (${weatherFileId})`)
298
+ * ```
299
+ */
300
+ abstract epw(source: string): PluginApiReturn<PluginImportEpwResult>;
301
+ }
302
+ /**
303
+ * Supported 3D model import formats. `.glb`/`.gltf`/`.ifc`/`.stl` and Rhino/Revit
304
+ * are intentionally excluded (no in-app import path).
305
+ */
306
+ export declare const ModelFormat: z.ZodEnum<{
307
+ skp: "skp";
308
+ fbx: "fbx";
309
+ obj: "obj";
310
+ "3ds": "3ds";
311
+ zip: "zip";
312
+ }>;
313
+ export type ModelFormat = z.infer<typeof ModelFormat>;
314
+ /**
315
+ * Parsed CAD JSON accepted by {@link PluginCoreIoImportApi.cadJson}. `unit` sets
316
+ * the drawing's length unit; `geometry` is the array of CAD entities (lines,
317
+ * polylines, arcs, circles), each tagged with its CAD `layer`. Additional fields
318
+ * are passed through untouched.
319
+ */
320
+ export declare const CadJsonInput: z.ZodObject<{
321
+ unit: z.ZodOptional<z.ZodString>;
322
+ geometry: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
323
+ }, z.core.$loose>;
324
+ export type CadJsonInput = z.infer<typeof CadJsonInput>;
325
+ /**
326
+ * Arguments for {@link PluginCoreIoImportApi.image}.
327
+ *
328
+ * | Property | Type | Description |
329
+ * |---|---|---|
330
+ * | `source` | `string` | Image `https://` URL or `data:` URL (png/jpg/jpeg/bmp) |
331
+ * | `storey` | `number`? | Target storey (default: active) |
332
+ * | `scale` | `number`? | Initial uniform scale |
333
+ * | `opacity` | `number`? | `0`..`1` (default ~`0.5`) |
334
+ * | `label` | `string`? | Name for the underlay |
335
+ */
336
+ export declare const PluginImportImageArgs: z.ZodObject<{
337
+ source: z.ZodString;
338
+ storey: z.ZodOptional<z.ZodNumber>;
339
+ scale: z.ZodOptional<z.ZodNumber>;
340
+ opacity: z.ZodOptional<z.ZodNumber>;
341
+ label: z.ZodOptional<z.ZodString>;
342
+ }, z.core.$strip>;
343
+ export type PluginImportImageArgs = z.infer<typeof PluginImportImageArgs>;
344
+ /**
345
+ * Arguments for {@link PluginCoreIoImportApi.pdf}.
346
+ *
347
+ * | Property | Type | Description |
348
+ * |---|---|---|
349
+ * | `source` | `string` | PDF `https://` URL or `data:` URL |
350
+ * | `storey` | `number`? | Target storey (default: active) |
351
+ * | `page` | `number`? | 1-based page (default `1`) |
352
+ * | `scale` | `string`? | Drawing-scale label, e.g. `"1:100"` |
353
+ * | `opacity` | `number`? | `0`..`1` (default ~`0.5`) |
354
+ */
355
+ export declare const PluginImportPdfArgs: z.ZodObject<{
356
+ source: z.ZodString;
357
+ storey: z.ZodOptional<z.ZodNumber>;
358
+ page: z.ZodOptional<z.ZodNumber>;
359
+ scale: z.ZodOptional<z.ZodString>;
360
+ opacity: z.ZodOptional<z.ZodNumber>;
361
+ }, z.core.$strip>;
362
+ export type PluginImportPdfArgs = z.infer<typeof PluginImportPdfArgs>;
363
+ /** Arguments for {@link PluginCoreIoImportApi.dwg}. */
364
+ export declare const PluginImportDwgArgs: z.ZodObject<{
365
+ source: z.ZodString;
366
+ storey: z.ZodOptional<z.ZodNumber>;
367
+ }, z.core.$strip>;
368
+ export type PluginImportDwgArgs = z.infer<typeof PluginImportDwgArgs>;
369
+ /** Arguments for {@link PluginCoreIoImportApi.cadJson}. */
370
+ export declare const PluginImportCadJsonArgs: z.ZodObject<{
371
+ cad: z.ZodObject<{
372
+ unit: z.ZodOptional<z.ZodString>;
373
+ geometry: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
374
+ }, z.core.$loose>;
375
+ storey: z.ZodOptional<z.ZodNumber>;
376
+ }, z.core.$strip>;
377
+ export type PluginImportCadJsonArgs = z.infer<typeof PluginImportCadJsonArgs>;
378
+ /**
379
+ * Arguments for {@link PluginCoreIoImportApi.model}.
380
+ *
381
+ * | Property | Type | Description |
382
+ * |---|---|---|
383
+ * | `source` | `string` | Model `https://` URL or `data:` URL |
384
+ * | `storey` | `number`? | Target storey (default: active) |
385
+ * | `format` | {@link ModelFormat}? | File format (inferred when omitted) |
386
+ * | `position` | {@link Vec3Handle}? | Placement (default: storey origin) |
387
+ * | `label` | `string`? | Name for the component |
388
+ */
389
+ export declare const PluginImportModelArgs: z.ZodObject<{
390
+ source: z.ZodString;
391
+ storey: z.ZodOptional<z.ZodNumber>;
392
+ format: z.ZodOptional<z.ZodEnum<{
393
+ skp: "skp";
394
+ fbx: "fbx";
395
+ obj: "obj";
396
+ "3ds": "3ds";
397
+ zip: "zip";
398
+ }>>;
399
+ position: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodString>, z.ZodTransform<import("../../../..").Handle<"vec3">, string>>>;
400
+ label: z.ZodOptional<z.ZodString>;
401
+ }, z.core.$strip>;
402
+ export type PluginImportModelArgs = z.infer<typeof PluginImportModelArgs>;
403
+ /**
404
+ * Arguments for {@link PluginCoreIoImportApi.terrain}.
405
+ *
406
+ * | Property | Type | Description |
407
+ * |---|---|---|
408
+ * | `lat` | `number` | Latitude (degrees), `-90`..`90` |
409
+ * | `lng` | `number` | Longitude (degrees), `-180`..`180` |
410
+ * | `width` | `number` | East–west extent, metres |
411
+ * | `length` | `number` | North–south extent, metres |
412
+ * | `elevation` | `boolean`? | Include DEM elevation (default `true`) |
413
+ * | `satellite` | `boolean`? | Drape satellite imagery (default `true`) |
414
+ * | `neighborhood` | `boolean`? | Include context buildings (default `false`) |
415
+ * | `parcels` | `boolean`? | Include parcel boundaries (default `false`) |
416
+ */
417
+ export declare const PluginImportTerrainArgs: z.ZodObject<{
418
+ lat: z.ZodNumber;
419
+ lng: z.ZodNumber;
420
+ width: z.ZodNumber;
421
+ length: z.ZodNumber;
422
+ elevation: z.ZodOptional<z.ZodBoolean>;
423
+ satellite: z.ZodOptional<z.ZodBoolean>;
424
+ neighborhood: z.ZodOptional<z.ZodBoolean>;
425
+ parcels: z.ZodOptional<z.ZodBoolean>;
426
+ }, z.core.$strip>;
427
+ export type PluginImportTerrainArgs = z.infer<typeof PluginImportTerrainArgs>;
428
+ /**
429
+ * Arguments for {@link PluginCoreIoImportApi.epw}.
430
+ *
431
+ * | Property | Type | Description |
432
+ * |---|---|---|
433
+ * | `source` | `string` | EPW `https://` URL or `data:` URL |
434
+ */
435
+ export declare const PluginImportEpwArgs: z.ZodObject<{
436
+ source: z.ZodString;
437
+ }, z.core.$strip>;
438
+ export type PluginImportEpwArgs = z.infer<typeof PluginImportEpwArgs>;
439
+ /**
440
+ * Result of {@link PluginCoreIoImportApi.epw} — the imported weather file's
441
+ * catalog entry.
442
+ *
443
+ * | Property | Type | Description |
444
+ * |---|---|---|
445
+ * | `weatherFileId` | `string` | Catalog id (same key as `analysis.weather`'s `weatherFileId`) |
446
+ * | `label` | `string` | Human-readable name (station / file name) |
447
+ */
448
+ export declare const PluginImportEpwResult: z.ZodObject<{
449
+ weatherFileId: z.ZodString;
450
+ label: z.ZodString;
451
+ }, z.core.$strip>;
452
+ export type PluginImportEpwResult = z.infer<typeof PluginImportEpwResult>;
453
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/api/core/io/import/index.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,40 @@
1
+ import { PluginCoreIoImportApi } from "./import";
2
+ import { PluginCoreIoJobApi } from "./job";
3
+ import { PluginCoreIoUnderlayApi } from "./underlay";
4
+ import { PluginCoreIoTerrainApi } from "./terrain";
5
+ import { PluginCoreIoQueryApi } from "./query";
6
+ import { PluginCoreIoExportApi } from "./export";
7
+ /**
8
+ * I/O — bring external files into the project and manage what was imported.
9
+ *
10
+ * - {@linkcode PluginCoreIoApi.import} — import images, PDFs, CAD, 3D models, terrain
11
+ * - {@linkcode PluginCoreIoApi.query} — read source metadata before importing (pdf pages, cad layers)
12
+ * - {@linkcode PluginCoreIoApi.job} — poll long-running async imports (e.g. DWG)
13
+ * - {@linkcode PluginCoreIoApi.underlay} — inspect/scale/opacity/delete placed underlays
14
+ * - {@linkcode PluginCoreIoApi.terrain} — inspect/edit the site terrain (datum, layers, delete)
15
+ * - {@linkcode PluginCoreIoApi.export} — serialize the model to glb/obj (base64 bytes)
16
+ *
17
+ * Accessed via `snaptrude.core.io`.
18
+ */
19
+ export declare abstract class PluginCoreIoApi {
20
+ /** Import external files into the scene. See {@linkcode PluginCoreIoImportApi}. */
21
+ abstract import: PluginCoreIoImportApi;
22
+ /** Read source metadata before import. See {@linkcode PluginCoreIoQueryApi}. */
23
+ abstract query: PluginCoreIoQueryApi;
24
+ /** Poll long-running import jobs. See {@linkcode PluginCoreIoJobApi}. */
25
+ abstract job: PluginCoreIoJobApi;
26
+ /** Inspect and edit placed underlays. See {@linkcode PluginCoreIoUnderlayApi}. */
27
+ abstract underlay: PluginCoreIoUnderlayApi;
28
+ /** Inspect and manage the site terrain. See {@linkcode PluginCoreIoTerrainApi}. */
29
+ abstract terrain: PluginCoreIoTerrainApi;
30
+ /** Serialize the model to a downloadable 3D file. See {@linkcode PluginCoreIoExportApi}. */
31
+ abstract export: PluginCoreIoExportApi;
32
+ constructor();
33
+ }
34
+ export * from "./import";
35
+ export * from "./job";
36
+ export * from "./underlay";
37
+ export * from "./terrain";
38
+ export * from "./query";
39
+ export * from "./export";
40
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/api/core/io/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAA;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAA;AACpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAA;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAC9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAA;AAEhD;;;;;;;;;;;GAWG;AACH,8BAAsB,eAAe;IACnC,mFAAmF;IACnF,SAAgB,MAAM,EAAE,qBAAqB,CAAA;IAC7C,gFAAgF;IAChF,SAAgB,KAAK,EAAE,oBAAoB,CAAA;IAC3C,yEAAyE;IACzE,SAAgB,GAAG,EAAE,kBAAkB,CAAA;IACvC,kFAAkF;IAClF,SAAgB,QAAQ,EAAE,uBAAuB,CAAA;IACjD,mFAAmF;IACnF,SAAgB,OAAO,EAAE,sBAAsB,CAAA;IAC/C,4FAA4F;IAC5F,SAAgB,MAAM,EAAE,qBAAqB,CAAA;;CAG9C;AAED,cAAc,UAAU,CAAA;AACxB,cAAc,OAAO,CAAA;AACrB,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA;AACzB,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA"}
@@ -0,0 +1,139 @@
1
+ import * as z from "zod";
2
+ import { PluginApiReturn } from "../../../../types";
3
+ import { ImportJobHandle, UnderlayHandle } from "../../../../handles";
4
+ /**
5
+ * Import jobs — poll a long-running asynchronous import.
6
+ *
7
+ * Some imports run on a server and take a while (today: `core.io.import.dwg`,
8
+ * whose DWG → Snaptrude conversion can take minutes). Those importers return an
9
+ * {@linkcode ImportJobHandle} immediately instead of blocking; you drive the job
10
+ * to completion here:
11
+ *
12
+ * 1. poll {@link PluginCoreIoJobApi.isComplete} (or read {@link PluginCoreIoJobApi.getStatus}),
13
+ * 2. once complete, call {@link PluginCoreIoJobApi.getResult} for the placed handle,
14
+ * 3. or read {@link PluginCoreIoJobApi.getError} if it failed.
15
+ *
16
+ * **Always poll with a timeout.** If the import is cancelled from the app UI
17
+ * (or the tab reloads mid-conversion), the job never reaches a terminal state
18
+ * and `getStatus` keeps returning `"processing"` — an unbounded poll loop would
19
+ * spin forever. Give up after a few minutes and surface that to the user.
20
+ *
21
+ * Accessed via `snaptrude.core.io.job`.
22
+ */
23
+ export declare abstract class PluginCoreIoJobApi {
24
+ constructor();
25
+ /**
26
+ * Read a job's current status: `"pending"` (queued), `"processing"` (running),
27
+ * `"complete"` (result ready), or `"failed"`.
28
+ *
29
+ * Limitation: a job cancelled from the app UI never turns `"failed"` — it
30
+ * stays `"processing"` indefinitely. Bound your poll loop with a timeout.
31
+ *
32
+ * @param job - The import job to inspect.
33
+ * @returns the {@linkcode ImportJobStatus}.
34
+ * @throws {@link HandleInvalidError} if the job handle is unknown.
35
+ *
36
+ * @examplePrompt What's the status of my DWG import?
37
+ * @examplePrompt Is the CAD import still processing?
38
+ * @examplePrompt Check where the import job is up to
39
+ * @examplePrompt Did the import job fail?
40
+ *
41
+ * # Example
42
+ * ```ts
43
+ * const job = await snaptrude.core.io.import.dwg(url, 1)
44
+ * console.log(await snaptrude.core.io.job.getStatus(job)) // "processing"
45
+ * ```
46
+ */
47
+ abstract getStatus(job: ImportJobHandle): PluginApiReturn<ImportJobStatus>;
48
+ /**
49
+ * Whether the job has finished successfully (status is `"complete"` and a
50
+ * result is ready). Returns `false` while pending/processing and on failure.
51
+ *
52
+ * @param job - The import job to inspect.
53
+ * @throws {@link HandleInvalidError} if the job handle is unknown.
54
+ *
55
+ * @examplePrompt Is the DWG import done yet?
56
+ * @examplePrompt Has the CAD import finished?
57
+ * @examplePrompt Tell me when the import job completes
58
+ * @examplePrompt Is my import ready?
59
+ *
60
+ * # Example
61
+ * ```ts
62
+ * const job = await snaptrude.core.io.import.dwg(url, 1)
63
+ * const deadline = Date.now() + 5 * 60_000 // cap the poll — see getStatus limitation
64
+ * while (!(await snaptrude.core.io.job.isComplete(job))) {
65
+ * if (Date.now() > deadline) throw new Error("DWG import timed out")
66
+ * await new Promise((r) => setTimeout(r, 2000))
67
+ * }
68
+ * ```
69
+ */
70
+ abstract isComplete(job: ImportJobHandle): PluginApiReturn<boolean>;
71
+ /**
72
+ * The imported result once the job is complete — the placed
73
+ * {@linkcode UnderlayHandle}. Returns `null` while the job is still
74
+ * pending/processing or if it failed (check {@link PluginCoreIoJobApi.getError}).
75
+ *
76
+ * @param job - The completed import job.
77
+ * @throws {@link HandleInvalidError} if the job handle is unknown.
78
+ *
79
+ * @examplePrompt Get the underlay from my finished DWG import
80
+ * @examplePrompt Give me the result of the CAD import job
81
+ * @examplePrompt Fetch the imported CAD sketch once it's ready
82
+ * @examplePrompt Return the handle for the completed import
83
+ *
84
+ * # Example
85
+ * ```ts
86
+ * const job = await snaptrude.core.io.import.dwg(url, 1)
87
+ * const deadline = Date.now() + 5 * 60_000
88
+ * while (!(await snaptrude.core.io.job.isComplete(job))) {
89
+ * if (Date.now() > deadline) throw new Error("DWG import timed out")
90
+ * await new Promise((r) => setTimeout(r, 2000))
91
+ * }
92
+ * // DWG results are CAD underlays (CAD scaling isn't supported); manage them
93
+ * // via core.io.underlay.* (list / setOpacity / delete).
94
+ * const cad = await snaptrude.core.io.job.getResult(job)
95
+ * if (cad) console.log("import complete:", cad)
96
+ * ```
97
+ */
98
+ abstract getResult(job: ImportJobHandle): PluginApiReturn<UnderlayHandle | null>;
99
+ /**
100
+ * The failure message if the job's status is `"failed"`; otherwise `null`.
101
+ *
102
+ * @param job - The import job to inspect.
103
+ * @throws {@link HandleInvalidError} if the job handle is unknown.
104
+ *
105
+ * @examplePrompt Why did my DWG import fail?
106
+ * @examplePrompt What went wrong with the CAD import?
107
+ * @examplePrompt Show the error from the failed import job
108
+ * @examplePrompt Did the import error out, and why?
109
+ *
110
+ * # Example
111
+ * ```ts
112
+ * const job = await snaptrude.core.io.import.dwg(url, 1)
113
+ * if ((await snaptrude.core.io.job.getStatus(job)) === "failed") {
114
+ * console.error(await snaptrude.core.io.job.getError(job))
115
+ * }
116
+ * ```
117
+ */
118
+ abstract getError(job: ImportJobHandle): PluginApiReturn<string | null>;
119
+ }
120
+ /** Lifecycle status of an asynchronous import job. */
121
+ export declare const ImportJobStatus: z.ZodEnum<{
122
+ pending: "pending";
123
+ processing: "processing";
124
+ complete: "complete";
125
+ failed: "failed";
126
+ }>;
127
+ export type ImportJobStatus = z.infer<typeof ImportJobStatus>;
128
+ /**
129
+ * Arguments for the `core.io.job.*` readers.
130
+ *
131
+ * | Property | Type | Description |
132
+ * |---|---|---|
133
+ * | `job` | {@link ImportJobHandle} | The import job to inspect |
134
+ */
135
+ export declare const PluginImportJobArgs: z.ZodObject<{
136
+ job: z.ZodPipe<z.ZodString, z.ZodTransform<ImportJobHandle, string>>;
137
+ }, z.core.$strip>;
138
+ export type PluginImportJobArgs = z.infer<typeof PluginImportJobArgs>;
139
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/api/core/io/job/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAErE;;;;;;;;;;;;;;;;;;GAkBG;AACH,8BAAsB,kBAAkB;;IAGtC;;;;;;;;;;;;;;;;;;;;;OAqBG;aACa,SAAS,CAAC,GAAG,EAAE,eAAe,GAAG,eAAe,CAAC,eAAe,CAAC;IAEjF;;;;;;;;;;;;;;;;;;;;;OAqBG;aACa,UAAU,CAAC,GAAG,EAAE,eAAe,GAAG,eAAe,CAAC,OAAO,CAAC;IAE1E;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;aACa,SAAS,CAAC,GAAG,EAAE,eAAe,GAAG,eAAe,CAAC,cAAc,GAAG,IAAI,CAAC;IAEvF;;;;;;;;;;;;;;;;;;OAkBG;aACa,QAAQ,CAAC,GAAG,EAAE,eAAe,GAAG,eAAe,CAAC,MAAM,GAAG,IAAI,CAAC;CAC/E;AAED,sDAAsD;AACtD,eAAO,MAAM,eAAe;;;;;EAA0D,CAAA;AACtF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAA;AAE7D;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB;;iBAE9B,CAAA;AACF,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA"}