@selvajs/selva 4.20.1-beta.0 → 4.20.1-beta.2

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 (243) hide show
  1. package/build/adapter-node.js +1 -1
  2. package/build/client/_app/immutable/assets/{0.CqMxMIbm.css → 0.2jDm0bqh.css} +1 -1
  3. package/build/client/_app/immutable/assets/0.2jDm0bqh.css.br +0 -0
  4. package/build/client/_app/immutable/assets/0.2jDm0bqh.css.gz +0 -0
  5. package/build/client/_app/immutable/chunks/{CDkfHL-P.js → BDYCH-_Q.js} +1 -1
  6. package/build/client/_app/immutable/chunks/BDYCH-_Q.js.br +0 -0
  7. package/build/client/_app/immutable/chunks/BDYCH-_Q.js.gz +0 -0
  8. package/build/client/_app/immutable/chunks/{DkB5TkAO.js → D-SwRD80.js} +4 -4
  9. package/build/client/_app/immutable/chunks/D-SwRD80.js.br +0 -0
  10. package/build/client/_app/immutable/chunks/D-SwRD80.js.gz +0 -0
  11. package/build/client/_app/immutable/chunks/Dvq2vJj6.js +1 -0
  12. package/build/client/_app/immutable/chunks/Dvq2vJj6.js.br +1 -0
  13. package/build/client/_app/immutable/chunks/Dvq2vJj6.js.gz +0 -0
  14. package/build/client/_app/immutable/chunks/{CEJB5MhK.js → DzxE3j6C.js} +1 -1
  15. package/build/client/_app/immutable/chunks/DzxE3j6C.js.br +0 -0
  16. package/build/client/_app/immutable/chunks/DzxE3j6C.js.gz +0 -0
  17. package/build/client/_app/immutable/chunks/{B9o4N7Mf.js → qi43d-TM.js} +1 -1
  18. package/build/client/_app/immutable/chunks/qi43d-TM.js.br +0 -0
  19. package/build/client/_app/immutable/chunks/qi43d-TM.js.gz +0 -0
  20. package/build/client/_app/immutable/chunks/zJ-SFdYZ.js +1 -0
  21. package/build/client/_app/immutable/chunks/zJ-SFdYZ.js.br +0 -0
  22. package/build/client/_app/immutable/chunks/zJ-SFdYZ.js.gz +0 -0
  23. package/build/client/_app/immutable/entry/{app.BOj9G5jx.js → app.hg2qyLJU.js} +2 -2
  24. package/build/client/_app/immutable/entry/app.hg2qyLJU.js.br +0 -0
  25. package/build/client/_app/immutable/entry/app.hg2qyLJU.js.gz +0 -0
  26. package/build/client/_app/immutable/nodes/{2.CERUnqD5.js → 2.CUNbzjI_.js} +1 -1
  27. package/build/client/_app/immutable/nodes/2.CUNbzjI_.js.br +0 -0
  28. package/build/client/_app/immutable/nodes/2.CUNbzjI_.js.gz +0 -0
  29. package/build/client/_app/immutable/nodes/{20.BqTJQD3B.js → 20.9OIre0ah.js} +1 -1
  30. package/build/client/_app/immutable/nodes/20.9OIre0ah.js.br +0 -0
  31. package/build/client/_app/immutable/nodes/20.9OIre0ah.js.gz +0 -0
  32. package/build/client/_app/immutable/nodes/21.gGT7QEb1.js +1 -0
  33. package/build/client/_app/immutable/nodes/21.gGT7QEb1.js.br +1 -0
  34. package/build/client/_app/immutable/nodes/21.gGT7QEb1.js.gz +0 -0
  35. package/build/client/_app/immutable/nodes/{30.Bz0cB9UL.js → 30.BBuL_XNB.js} +2 -2
  36. package/build/client/_app/immutable/nodes/30.BBuL_XNB.js.br +0 -0
  37. package/build/client/_app/immutable/nodes/30.BBuL_XNB.js.gz +0 -0
  38. package/build/client/_app/immutable/nodes/35.De6sleaH.js +5 -0
  39. package/build/client/_app/immutable/nodes/35.De6sleaH.js.br +0 -0
  40. package/build/client/_app/immutable/nodes/35.De6sleaH.js.gz +0 -0
  41. package/build/client/_app/immutable/nodes/{5.Cw-wybBi.js → 5.DmA9lTA-.js} +1 -1
  42. package/build/client/_app/immutable/nodes/5.DmA9lTA-.js.br +1 -0
  43. package/build/client/_app/immutable/nodes/5.DmA9lTA-.js.gz +0 -0
  44. package/build/client/_app/immutable/nodes/{6.BiVPgDTL.js → 6.D6WLqCgl.js} +1 -1
  45. package/build/client/_app/immutable/nodes/6.D6WLqCgl.js.br +0 -0
  46. package/build/client/_app/immutable/nodes/6.D6WLqCgl.js.gz +0 -0
  47. package/build/client/_app/immutable/nodes/{7.BUhgSp_A.js → 7.CNuRjkv2.js} +1 -1
  48. package/build/client/_app/immutable/nodes/7.CNuRjkv2.js.br +0 -0
  49. package/build/client/_app/immutable/nodes/7.CNuRjkv2.js.gz +0 -0
  50. package/build/client/_app/version.json +1 -1
  51. package/build/client/_app/version.json.br +0 -0
  52. package/build/client/_app/version.json.gz +0 -0
  53. package/build/runtime-meta.json +1 -1
  54. package/build/server/.vite/manifest.json +107 -88
  55. package/build/server/_app/immutable/assets/{_layout.CqMxMIbm.css → _layout.2jDm0bqh.css} +1 -1
  56. package/build/server/chunks/SettingsMenu.js +1 -1
  57. package/build/server/chunks/{abort-CNJ8Sn4g.js → abort-Bfrdupaj.js} +10 -3
  58. package/build/server/chunks/{abort-CNJ8Sn4g.js.map → abort-Bfrdupaj.js.map} +1 -1
  59. package/build/server/chunks/access.js +608 -150
  60. package/build/server/chunks/access.js.map +1 -1
  61. package/build/server/chunks/access2.server.js +2 -2
  62. package/build/server/chunks/api-errors.js +1 -1
  63. package/build/server/chunks/api.js +66 -18
  64. package/build/server/chunks/api.js.map +1 -1
  65. package/build/server/chunks/auth-bootstrap.server.js +1 -1
  66. package/build/server/chunks/boot.server.js +12 -702
  67. package/build/server/chunks/boot.server.js.map +1 -1
  68. package/build/server/chunks/bootHealth.server.js.map +1 -1
  69. package/build/server/chunks/compute.js +1 -1
  70. package/build/server/chunks/computeLimits.js +1 -1
  71. package/build/server/chunks/computeRateLimit.server.js +1 -1
  72. package/build/server/chunks/context.js +9 -43
  73. package/build/server/chunks/context.js.map +1 -1
  74. package/build/server/chunks/create-project.js +2 -2
  75. package/build/server/chunks/delete-with-blobs.js +1 -1
  76. package/build/server/chunks/engine.server.js +2 -16
  77. package/build/server/chunks/engine.server.js.map +1 -1
  78. package/build/server/chunks/handlers.js +13 -29
  79. package/build/server/chunks/handlers.js.map +1 -1
  80. package/build/server/chunks/http.js +93 -6
  81. package/build/server/chunks/http.js.map +1 -1
  82. package/build/server/chunks/instance.js +3 -3
  83. package/build/server/chunks/instanceAdmins.server.js +1 -1
  84. package/build/server/chunks/internal.js +1 -1
  85. package/build/server/chunks/limits.js +71 -0
  86. package/build/server/chunks/limits.js.map +1 -0
  87. package/build/server/chunks/ops.js +1 -1
  88. package/build/server/chunks/package.js +1 -1
  89. package/build/server/chunks/package.js.map +1 -1
  90. package/build/server/chunks/permissions.server.js +1 -1
  91. package/build/server/chunks/presets.server.js +1 -1
  92. package/build/server/chunks/previous-key.js +18 -2
  93. package/build/server/chunks/previous-key.js.map +1 -1
  94. package/build/server/chunks/providers.server.js +775 -422
  95. package/build/server/chunks/providers.server.js.map +1 -1
  96. package/build/server/chunks/registry.js +4 -1
  97. package/build/server/chunks/registry.js.map +1 -1
  98. package/build/server/chunks/remote-definition.js +1 -1
  99. package/build/server/chunks/safe-url.js +1 -1
  100. package/build/server/chunks/schema.js.map +1 -1
  101. package/build/server/chunks/schemas.js +12 -61
  102. package/build/server/chunks/schemas.js.map +1 -1
  103. package/build/server/chunks/schemas2.js +80 -0
  104. package/build/server/chunks/schemas2.js.map +1 -0
  105. package/build/server/chunks/server-config-write.js +3 -8
  106. package/build/server/chunks/server-config-write.js.map +1 -1
  107. package/build/server/chunks/signInMaxAge.server.js +1 -1
  108. package/build/server/chunks/solve.server.js +10 -3
  109. package/build/server/chunks/solve.server.js.map +1 -1
  110. package/build/server/chunks/sveltekit.js +4 -4
  111. package/build/server/chunks/token2.server.js +1 -1
  112. package/build/server/chunks/tokens.js +2 -2
  113. package/build/server/chunks/types.js +9 -4
  114. package/build/server/chunks/types.js.map +1 -1
  115. package/build/server/chunks/types2.js +1 -2
  116. package/build/server/chunks/types2.js.map +1 -1
  117. package/build/server/chunks/visibility.js +1 -1
  118. package/build/server/chunks/visibility.js.map +1 -1
  119. package/build/server/entries/endpoints/api/admin/orgs/_id_/_server.ts.js +3 -3
  120. package/build/server/entries/endpoints/api/admin/orgs/_server.ts.js +6 -5
  121. package/build/server/entries/endpoints/api/admin/orgs/_server.ts.js.map +1 -1
  122. package/build/server/entries/endpoints/api/admin/projects/_id_/_server.ts.js +2 -2
  123. package/build/server/entries/endpoints/api/admin/projects/_id_/grants/_grantId_/_server.ts.js +1 -1
  124. package/build/server/entries/endpoints/api/admin/projects/_id_/grants/_server.ts.js +1 -1
  125. package/build/server/entries/endpoints/api/admin/projects/_server.ts.js +1 -1
  126. package/build/server/entries/endpoints/api/admin/system/health/_server.ts.js +1 -1
  127. package/build/server/entries/endpoints/api/admin/system/update/_server.ts.js +1 -1
  128. package/build/server/entries/endpoints/api/admin/users/_id_/_server.ts.js +2 -2
  129. package/build/server/entries/endpoints/api/admin/users/_id_/disable/_server.ts.js +2 -2
  130. package/build/server/entries/endpoints/api/admin/users/_server.ts.js +2 -2
  131. package/build/server/entries/endpoints/api/files/_...path_/_server.ts.js +2 -1
  132. package/build/server/entries/endpoints/api/files/_...path_/_server.ts.js.map +1 -1
  133. package/build/server/entries/endpoints/api/v1/compute/schema/_server.ts.js +1 -1
  134. package/build/server/entries/endpoints/api/v1/definitions/_guid_/_server.ts.js +2 -2
  135. package/build/server/entries/endpoints/api/v1/definitions/_guid_/image/_server.ts.js +2 -2
  136. package/build/server/entries/endpoints/api/v1/definitions/_guid_/publish/_server.ts.js +2 -2
  137. package/build/server/entries/endpoints/api/v1/definitions/_guid_/schema/_server.ts.js +2 -2
  138. package/build/server/entries/endpoints/api/v1/definitions/_guid_/share-links/_linkId_/_server.ts.js +2 -2
  139. package/build/server/entries/endpoints/api/v1/definitions/_guid_/share-links/_server.ts.js +2 -2
  140. package/build/server/entries/endpoints/api/v1/definitions/_guid_/solve/_server.ts.js +2 -2
  141. package/build/server/entries/endpoints/api/v1/definitions/_guid_/versions/_server.ts.js +2 -2
  142. package/build/server/entries/endpoints/api/v1/definitions/_guid_/versions/_versionId_/_server.ts.js +2 -2
  143. package/build/server/entries/endpoints/api/v1/definitions/_guid_/versions/_versionId_/schema/_server.ts.js +2 -2
  144. package/build/server/entries/endpoints/api/v1/definitions/_server.ts.js +1 -1
  145. package/build/server/entries/endpoints/api/v1/me/_server.ts.js +1 -1
  146. package/build/server/entries/endpoints/api/v1/me/starred/_guid_/_server.ts.js +1 -1
  147. package/build/server/entries/endpoints/api/v1/me/token/_server.ts.js +1 -1
  148. package/build/server/entries/endpoints/api/v1/orgs/_orgId_/_server.ts.js +1 -1
  149. package/build/server/entries/endpoints/api/v1/orgs/_orgId_/assets/_kind_/_server.ts.js +1 -1
  150. package/build/server/entries/endpoints/api/v1/orgs/_orgId_/compute/_server.ts.js +1 -1
  151. package/build/server/entries/endpoints/api/v1/orgs/_orgId_/invites/_id_/_server.ts.js +1 -1
  152. package/build/server/entries/endpoints/api/v1/orgs/_orgId_/invites/_id_/resend/_server.ts.js +1 -1
  153. package/build/server/entries/endpoints/api/v1/orgs/_orgId_/invites/_server.ts.js +1 -1
  154. package/build/server/entries/endpoints/api/v1/orgs/_orgId_/members/_server.ts.js +1 -1
  155. package/build/server/entries/endpoints/api/v1/orgs/_orgId_/members/_userId_/_server.ts.js +1 -1
  156. package/build/server/entries/endpoints/api/v1/orgs/_orgId_/tokens/_server.ts.js +1 -1
  157. package/build/server/entries/endpoints/api/v1/orgs/_orgId_/tokens/_tokenId_/_server.ts.js +1 -1
  158. package/build/server/entries/endpoints/api/v1/projects/_id_/_server.ts.js +2 -2
  159. package/build/server/entries/endpoints/api/v1/projects/_id_/members/_server.ts.js +2 -2
  160. package/build/server/entries/endpoints/api/v1/projects/_id_/members/_userId_/_server.ts.js +2 -2
  161. package/build/server/entries/endpoints/api/v1/projects/_id_/reclaim/_server.ts.js +2 -2
  162. package/build/server/entries/endpoints/api/v1/projects/_server.ts.js +1 -1
  163. package/build/server/entries/endpoints/api/v1/solve/_solveId_/cancel/_server.ts.js +1 -1
  164. package/build/server/entries/endpoints/api/v1/solve-events/_server.ts.js +1 -1
  165. package/build/server/entries/endpoints/docs/api/openapi.yaml/_server.ts.js +1 -1
  166. package/build/server/entries/endpoints/mcp/_server.ts.js +5 -4
  167. package/build/server/entries/endpoints/mcp/_server.ts.js.map +1 -1
  168. package/build/server/entries/hooks.server.js +3 -92
  169. package/build/server/entries/hooks.server.js.map +1 -1
  170. package/build/server/entries/pages/accept-invite/_page.server.ts.js +27 -6
  171. package/build/server/entries/pages/accept-invite/_page.server.ts.js.map +1 -1
  172. package/build/server/entries/pages/admin/_page.server.ts.js +1 -1
  173. package/build/server/entries/pages/admin/organizations/_page.server.ts.js +1 -1
  174. package/build/server/entries/pages/admin/projects/_id_/_page.server.ts.js +1 -1
  175. package/build/server/entries/pages/admin/projects/_page.server.ts.js +1 -1
  176. package/build/server/entries/pages/admin/system/_page.server.ts.js +2 -2
  177. package/build/server/entries/pages/admin/users/_page.server.ts.js +1 -1
  178. package/build/server/entries/pages/library/_guid_/_page.server.ts.js +1 -1
  179. package/build/server/entries/pages/library/_guid_/_page.svelte.js +10 -8
  180. package/build/server/entries/pages/library/_guid_/_page.svelte.js.map +1 -1
  181. package/build/server/entries/pages/oauth/authorize/_page.server.ts.js +1 -1
  182. package/build/server/entries/pages/projects/_layout.server.ts.js +1 -1
  183. package/build/server/entries/pages/projects/_page.server.ts.js +2 -2
  184. package/build/server/entries/pages/setup/_page.server.ts.js +1 -1
  185. package/build/server/entries/pages/team/compute/_page.server.ts.js +1 -1
  186. package/build/server/entries/pages/team/members/_page.server.ts.js +1 -1
  187. package/build/server/entries/pages/team/members/_page.svelte.js +2 -2
  188. package/build/server/entries/pages/team/members/_page.svelte.js.map +1 -1
  189. package/build/server/entries/pages/team/projects/_page.server.ts.js +1 -1
  190. package/build/server/entries/pages/team/settings/_page.server.ts.js +1 -1
  191. package/build/server/entries/pages/team/shares/_page.server.ts.js +1 -1
  192. package/build/server/manifest-full.js +1 -1
  193. package/build/server/manifest.js +1 -1
  194. package/build/server/nodes/0.js +2 -2
  195. package/build/server/nodes/2.js +1 -1
  196. package/build/server/nodes/20.js +1 -1
  197. package/build/server/nodes/21.js +1 -1
  198. package/build/server/nodes/30.js +1 -1
  199. package/build/server/nodes/35.js +1 -1
  200. package/build/server/nodes/5.js +1 -1
  201. package/build/server/nodes/6.js +1 -1
  202. package/build/server/nodes/7.js +1 -1
  203. package/build/server/server.js +1 -1
  204. package/package.json +10 -10
  205. package/build/client/_app/immutable/assets/0.CqMxMIbm.css.br +0 -0
  206. package/build/client/_app/immutable/assets/0.CqMxMIbm.css.gz +0 -0
  207. package/build/client/_app/immutable/chunks/B9o4N7Mf.js.br +0 -0
  208. package/build/client/_app/immutable/chunks/B9o4N7Mf.js.gz +0 -0
  209. package/build/client/_app/immutable/chunks/CDkfHL-P.js.br +0 -0
  210. package/build/client/_app/immutable/chunks/CDkfHL-P.js.gz +0 -0
  211. package/build/client/_app/immutable/chunks/CEJB5MhK.js.br +0 -0
  212. package/build/client/_app/immutable/chunks/CEJB5MhK.js.gz +0 -0
  213. package/build/client/_app/immutable/chunks/CmSGJYdN.js +0 -1
  214. package/build/client/_app/immutable/chunks/CmSGJYdN.js.br +0 -1
  215. package/build/client/_app/immutable/chunks/CmSGJYdN.js.gz +0 -0
  216. package/build/client/_app/immutable/chunks/DkB5TkAO.js.br +0 -0
  217. package/build/client/_app/immutable/chunks/DkB5TkAO.js.gz +0 -0
  218. package/build/client/_app/immutable/chunks/I4bYfY0F.js +0 -1
  219. package/build/client/_app/immutable/chunks/I4bYfY0F.js.br +0 -0
  220. package/build/client/_app/immutable/chunks/I4bYfY0F.js.gz +0 -0
  221. package/build/client/_app/immutable/entry/app.BOj9G5jx.js.br +0 -0
  222. package/build/client/_app/immutable/entry/app.BOj9G5jx.js.gz +0 -0
  223. package/build/client/_app/immutable/nodes/2.CERUnqD5.js.br +0 -0
  224. package/build/client/_app/immutable/nodes/2.CERUnqD5.js.gz +0 -0
  225. package/build/client/_app/immutable/nodes/20.BqTJQD3B.js.br +0 -0
  226. package/build/client/_app/immutable/nodes/20.BqTJQD3B.js.gz +0 -0
  227. package/build/client/_app/immutable/nodes/21.DeRwDjP4.js +0 -1
  228. package/build/client/_app/immutable/nodes/21.DeRwDjP4.js.br +0 -0
  229. package/build/client/_app/immutable/nodes/21.DeRwDjP4.js.gz +0 -0
  230. package/build/client/_app/immutable/nodes/30.Bz0cB9UL.js.br +0 -0
  231. package/build/client/_app/immutable/nodes/30.Bz0cB9UL.js.gz +0 -0
  232. package/build/client/_app/immutable/nodes/35.DFkalFgm.js +0 -5
  233. package/build/client/_app/immutable/nodes/35.DFkalFgm.js.br +0 -0
  234. package/build/client/_app/immutable/nodes/35.DFkalFgm.js.gz +0 -0
  235. package/build/client/_app/immutable/nodes/5.Cw-wybBi.js.br +0 -0
  236. package/build/client/_app/immutable/nodes/5.Cw-wybBi.js.gz +0 -0
  237. package/build/client/_app/immutable/nodes/6.BiVPgDTL.js.br +0 -0
  238. package/build/client/_app/immutable/nodes/6.BiVPgDTL.js.gz +0 -0
  239. package/build/client/_app/immutable/nodes/7.BUhgSp_A.js.br +0 -0
  240. package/build/client/_app/immutable/nodes/7.BUhgSp_A.js.gz +0 -0
  241. /package/build/client/_app/immutable/nodes/{0.146jEGn4.js → 0.CYdyv5To.js} +0 -0
  242. /package/build/client/_app/immutable/nodes/{0.146jEGn4.js.br → 0.CYdyv5To.js.br} +0 -0
  243. /package/build/client/_app/immutable/nodes/{0.146jEGn4.js.gz → 0.CYdyv5To.js.gz} +0 -0
@@ -1,4 +1,4 @@
1
- import { c as AddProjectMemberBodySchema, d as CreateProjectBodySchema, f as OrgComputePatchBodySchema, g as UpdateProjectMemberBodySchema, h as UpdateProjectBodySchema, l as CreateApiTokenBodySchema, m as UpdateOrgMemberBodySchema, p as SolveBodySchema, u as CreateInviteBodySchema } from "./api.js";
1
+ import { _ as UpdateOrgMemberBodySchema, c as AddProjectMemberBodySchema, d as CreateProjectBodySchema, f as CreateShareLinkBodySchema, g as UpdateDefinitionBodySchema, h as SolveBodySchema, l as CreateApiTokenBodySchema, m as PublishVersionBodySchema, p as OrgComputePatchBodySchema, u as CreateInviteBodySchema, v as UpdateProjectBodySchema, y as UpdateProjectMemberBodySchema } from "./api.js";
2
2
  // src/lib/server/api/v1/registry.ts
3
3
  /**
4
4
  * The v1 contract as data: one entry per method+path, naming its body validator,
@@ -154,6 +154,7 @@ var V1_ENDPOINTS = [
154
154
  scope: "write",
155
155
  summary: "Update definition metadata.",
156
156
  response: "empty",
157
+ requestBody: UpdateDefinitionBodySchema,
157
158
  errors: [400, 404]
158
159
  },
159
160
  {
@@ -244,6 +245,7 @@ var V1_ENDPOINTS = [
244
245
  scope: "upload",
245
246
  summary: "Promote a version to live.",
246
247
  response: "object",
248
+ requestBody: PublishVersionBodySchema,
247
249
  errors: [400, 404]
248
250
  },
249
251
  {
@@ -275,6 +277,7 @@ var V1_ENDPOINTS = [
275
277
  summary: "Create a share link. The raw token is returned once and never again.",
276
278
  response: "object",
277
279
  status: 201,
280
+ requestBody: CreateShareLinkBodySchema,
278
281
  errors: [400, 404]
279
282
  },
280
283
  {
@@ -1 +1 @@
1
- {"version":3,"file":"registry.js","names":[],"sources":["../../../src/lib/server/api/v1/registry.ts"],"sourcesContent":["/**\n * The v1 contract as data: one entry per method+path, naming its body validator,\n * response shape, and whether it's public or internal.\n *\n * Both the OpenAPI generator and the conformance test read this file. The test\n * walks `routes/api/v1/**` against this table and fails if either side has an\n * entry the other doesn't — a route with no registry entry is undocumented, a\n * registry entry with no route is a spec promising something that 404s.\n *\n * Request schemas are Zod values imported from `@selvajs/server/api`, not\n * transcribed, so a renamed field changes the spec on the next generate\n * instead of silently disagreeing with the validator.\n */\n\nimport {\n\ttype Endpoint,\n\ttype HttpMethod,\n\tSolveBodySchema,\n\tCreateProjectBodySchema,\n\tUpdateProjectBodySchema,\n\tAddProjectMemberBodySchema,\n\tUpdateProjectMemberBodySchema,\n\tCreateInviteBodySchema,\n\tUpdateOrgMemberBodySchema,\n\tOrgComputePatchBodySchema,\n\tCreateApiTokenBodySchema\n} from '@selvajs/server/api';\n\nexport type { Endpoint, HttpMethod };\n\nconst solveErrors = [400, 401, 404, 429, 503];\n\nexport const V1_ENDPOINTS: Endpoint[] = [\n\t{\n\t\tmethod: 'GET',\n\t\tpath: '/openapi.json',\n\t\tscope: 'read',\n\t\tsummary: 'This document, as JSON.',\n\t\tresponse: 'object'\n\t},\n\n\t// ==========================================================================\n\t// Me\n\t// ==========================================================================\n\t{\n\t\tmethod: 'GET',\n\t\tpath: '/me',\n\t\tscope: 'read',\n\t\tsummary:\n\t\t\t'The calling identity, its acting org, its effective permissions, and for a token its id, scopes and expiry.',\n\t\tresponse: 'object',\n\t\treturns:\n\t\t\t'`apiToken: { id, scopes, expiresAt }` is present only when the caller is an API token. `capabilities.createProjects` says whether `POST /projects` would accept this caller, narrowed to the key; `orgPermissions` is the owner’s and is not.'\n\t},\n\t// Every key may call it, whatever its scopes; `read` is the action every key holds.\n\t{\n\t\tmethod: 'DELETE',\n\t\tpath: '/me/token',\n\t\tscope: 'read',\n\t\tsummary:\n\t\t\t'Revoke the API token that sent this request. A key can revoke itself and nothing else; a browser session gets 400.',\n\t\tresponse: 'empty',\n\t\terrors: [400, 503]\n\t},\n\t{\n\t\tmethod: 'PUT',\n\t\tpath: '/me/starred/{guid}',\n\t\tscope: 'write',\n\t\tsummary: 'Star a definition. Idempotent.',\n\t\tresponse: 'empty',\n\t\terrors: [404]\n\t},\n\t{\n\t\tmethod: 'DELETE',\n\t\tpath: '/me/starred/{guid}',\n\t\tscope: 'write',\n\t\tsummary: 'Unstar a definition. Idempotent.',\n\t\tresponse: 'empty'\n\t},\n\n\t// ==========================================================================\n\t// Definitions\n\t// ==========================================================================\n\t{\n\t\tmethod: 'GET',\n\t\tpath: '/definitions',\n\t\tscope: 'read',\n\t\tsummary: 'List definitions the caller can see.',\n\t\tresponse: 'collection',\n\t\treturns:\n\t\t\t'Each item has `sourceDocumentId`: the Grasshopper document GUID the definition was last uploaded from, or null.',\n\t\tquery: [\n\t\t\t{ name: 'projectId', description: 'Restrict to one project.' },\n\t\t\t{ name: 'status', description: 'One of `draft`, `published`, `archived`.' },\n\t\t\t{\n\t\t\t\tname: 'documentId',\n\t\t\t\tdescription:\n\t\t\t\t\t'A Grasshopper document GUID. Returns only definitions last uploaded from that document which the caller can upload a new version of. Not a GUID: 400.'\n\t\t\t}\n\t\t],\n\t\terrors: [400]\n\t},\n\t{\n\t\tmethod: 'POST',\n\t\tpath: '/definitions',\n\t\tscope: 'upload',\n\t\tidempotent: true,\n\t\tsummary: 'Create a definition from a Grasshopper file.',\n\t\tresponse: 'object',\n\t\tstatus: 201,\n\t\tmultipart: [\n\t\t\t{ field: 'file', required: true, description: 'The `.gh` or `.ghx` file.' },\n\t\t\t{ field: 'projectId', required: true, description: 'Owning project.' },\n\t\t\t{ field: 'displayName', required: true, description: 'Human-readable name.' },\n\t\t\t{ field: 'description', required: false, description: 'Long description.' },\n\t\t\t{ field: 'category', required: false, description: 'Grouping label.' },\n\t\t\t{ field: 'tags', required: false, description: 'Comma-separated tags.' },\n\t\t\t{ field: 'image', required: false, description: 'Cover image.' },\n\t\t\t{ field: 'computeServerId', required: false, description: 'Pin to a compute server.' }\n\t\t],\n\t\terrors: [400, 403, 422, 503]\n\t},\n\t{\n\t\tmethod: 'GET',\n\t\tpath: '/definitions/{guid}',\n\t\tscope: 'read',\n\t\tsummary: 'Definition record plus its live and draft version summaries.',\n\t\tresponse: 'object',\n\t\treturns:\n\t\t\t'`canEdit` is true when the caller can upload a version and make one live; for an API token that includes its scopes. `sourceDocumentId` is the Grasshopper document GUID it was last uploaded from, or null.',\n\t\terrors: [404]\n\t},\n\t{\n\t\tmethod: 'PATCH',\n\t\tpath: '/definitions/{guid}',\n\t\tscope: 'write',\n\t\tsummary: 'Update definition metadata.',\n\t\tresponse: 'empty',\n\t\terrors: [400, 404]\n\t},\n\t{\n\t\tmethod: 'DELETE',\n\t\tpath: '/definitions/{guid}',\n\t\tscope: 'write',\n\t\tsummary: 'Soft-delete a definition.',\n\t\tresponse: 'empty',\n\t\terrors: [404]\n\t},\n\t{\n\t\tmethod: 'POST',\n\t\tpath: '/definitions/{guid}/solve',\n\t\tscope: 'solve',\n\t\tidempotent: true,\n\t\tsummary: 'Solve a definition. The primary action of the API.',\n\t\tresponse: 'object',\n\t\trequestBody: SolveBodySchema,\n\t\terrors: solveErrors\n\t},\n\t{\n\t\tmethod: 'GET',\n\t\tpath: '/definitions/{guid}/schema',\n\t\tscope: 'read',\n\t\tsummary: \"The live version's UI schema. 404 when nothing is published.\",\n\t\tresponse: 'object',\n\t\terrors: [404]\n\t},\n\t{\n\t\tmethod: 'GET',\n\t\tpath: '/definitions/{guid}/versions',\n\t\tscope: 'read',\n\t\tsummary: 'List versions, newest first.',\n\t\tresponse: 'collection',\n\t\terrors: [404]\n\t},\n\t{\n\t\tmethod: 'POST',\n\t\tpath: '/definitions/{guid}/versions',\n\t\tscope: 'upload',\n\t\tidempotent: true,\n\t\tsummary: 'Upload a new version.',\n\t\tresponse: 'object',\n\t\tstatus: 201,\n\t\tmultipart: [\n\t\t\t{ field: 'file', required: true, description: 'The `.gh` or `.ghx` file.' },\n\t\t\t{ field: 'changeNote', required: false, description: 'Truncated to 1000 characters.' }\n\t\t],\n\t\terrors: [400, 404, 422, 503]\n\t},\n\t{\n\t\tmethod: 'GET',\n\t\tpath: '/definitions/{guid}/versions/{versionId}',\n\t\tscope: 'read',\n\t\tsummary: 'One version, without its cached schema.',\n\t\tresponse: 'object',\n\t\terrors: [404]\n\t},\n\t{\n\t\tmethod: 'DELETE',\n\t\tpath: '/definitions/{guid}/versions/{versionId}',\n\t\tscope: 'write',\n\t\tsummary: 'Delete a version. 409 when it is the live or draft pointer.',\n\t\tresponse: 'empty',\n\t\terrors: [404, 409]\n\t},\n\t{\n\t\tmethod: 'GET',\n\t\tpath: '/definitions/{guid}/versions/{versionId}/schema',\n\t\tscope: 'read',\n\t\tsummary: \"That version's cached UI schema. No compute round-trip.\",\n\t\tresponse: 'object',\n\t\terrors: [404]\n\t},\n\t{\n\t\tmethod: 'POST',\n\t\tpath: '/definitions/{guid}/publish',\n\t\tscope: 'upload',\n\t\tsummary: 'Promote a version to live.',\n\t\tresponse: 'object',\n\t\terrors: [400, 404]\n\t},\n\t{\n\t\tmethod: 'POST',\n\t\tpath: '/definitions/{guid}/image',\n\t\tscope: 'write',\n\t\tsummary: 'Upload a cover image.',\n\t\tresponse: 'object',\n\t\tmultipart: [{ field: 'image', required: true, description: 'PNG, JPEG, WebP or GIF.' }],\n\t\terrors: [400, 404]\n\t},\n\t{\n\t\tmethod: 'GET',\n\t\tpath: '/definitions/{guid}/share-links',\n\t\tscope: 'read',\n\t\tsummary: 'List share links. 404 when sharing is disabled on the instance.',\n\t\tresponse: 'collection',\n\t\terrors: [404]\n\t},\n\t{\n\t\tmethod: 'POST',\n\t\tpath: '/definitions/{guid}/share-links',\n\t\tscope: 'write',\n\t\tidempotent: true,\n\t\tsummary: 'Create a share link. The raw token is returned once and never again.',\n\t\tresponse: 'object',\n\t\tstatus: 201,\n\t\terrors: [400, 404]\n\t},\n\t{\n\t\tmethod: 'DELETE',\n\t\tpath: '/definitions/{guid}/share-links/{linkId}',\n\t\tscope: 'write',\n\t\tsummary: 'Revoke a share link.',\n\t\tresponse: 'empty',\n\t\terrors: [404]\n\t},\n\n\t// ==========================================================================\n\t// Projects\n\t// ==========================================================================\n\t{\n\t\tmethod: 'GET',\n\t\tpath: '/projects',\n\t\tscope: 'read',\n\t\tsummary: 'List projects the caller can view.',\n\t\tresponse: 'collection',\n\t\treturns:\n\t\t\t'Each item has `canCreateDefinitions`: whether `POST /definitions` would accept this project from the caller, scopes included for an API token.'\n\t},\n\t{\n\t\tmethod: 'POST',\n\t\tpath: '/projects',\n\t\tscope: 'create_projects',\n\t\tidempotent: true,\n\t\tsummary:\n\t\t\t'Create a project. A key with `create_projects` but not `write` may create private projects only, with `autoJoinOnUpload` off.',\n\t\tresponse: 'object',\n\t\tstatus: 201,\n\t\trequestBody: CreateProjectBodySchema,\n\t\terrors: [400, 403, 409]\n\t},\n\t{\n\t\tmethod: 'GET',\n\t\tpath: '/projects/{id}',\n\t\tscope: 'read',\n\t\tsummary: \"Project record plus the caller's effective role and capabilities.\",\n\t\tresponse: 'object',\n\t\terrors: [404]\n\t},\n\t{\n\t\tmethod: 'PATCH',\n\t\tpath: '/projects/{id}',\n\t\tscope: 'write',\n\t\tsummary: 'Update project settings. Owner-only.',\n\t\tresponse: 'empty',\n\t\trequestBody: UpdateProjectBodySchema,\n\t\terrors: [400, 403, 404, 409]\n\t},\n\t{\n\t\tmethod: 'DELETE',\n\t\tpath: '/projects/{id}',\n\t\tscope: 'write',\n\t\tsummary: 'Delete a project.',\n\t\tresponse: 'empty',\n\t\terrors: [403, 404]\n\t},\n\t{\n\t\tmethod: 'GET',\n\t\tpath: '/projects/{id}/members',\n\t\tscope: 'read',\n\t\tsummary: 'List project members.',\n\t\tresponse: 'collection',\n\t\terrors: [403, 404]\n\t},\n\t{\n\t\tmethod: 'POST',\n\t\tpath: '/projects/{id}/members',\n\t\tscope: 'write',\n\t\tsummary: 'Add a member. The target must already belong to the org.',\n\t\tresponse: 'object',\n\t\tstatus: 201,\n\t\trequestBody: AddProjectMemberBodySchema,\n\t\terrors: [400, 403, 404]\n\t},\n\t{\n\t\tmethod: 'PATCH',\n\t\tpath: '/projects/{id}/members/{userId}',\n\t\tscope: 'write',\n\t\tsummary: 'Change a member role.',\n\t\tresponse: 'empty',\n\t\trequestBody: UpdateProjectMemberBodySchema,\n\t\terrors: [400, 403, 404, 409]\n\t},\n\t{\n\t\tmethod: 'DELETE',\n\t\tpath: '/projects/{id}/members/{userId}',\n\t\tscope: 'write',\n\t\tsummary: 'Remove a member. Idempotent.',\n\t\tresponse: 'empty',\n\t\tquery: [\n\t\t\t{\n\t\t\t\tname: 'confirm',\n\t\t\t\tdescription: 'Set to `true` to remove a co-owner; without it the call returns 409.'\n\t\t\t}\n\t\t],\n\t\terrors: [403, 404, 409]\n\t},\n\t{\n\t\tmethod: 'POST',\n\t\tpath: '/projects/{id}/reclaim',\n\t\tscope: 'write',\n\t\tsummary: 'Claim ownership of an unowned project.',\n\t\tresponse: 'object',\n\t\tstatus: 201,\n\t\terrors: [403, 404, 409]\n\t},\n\n\t// ==========================================================================\n\t// Orgs\n\t// ==========================================================================\n\t{\n\t\tmethod: 'GET',\n\t\tpath: '/orgs/{orgId}',\n\t\tscope: 'read',\n\t\tsummary: \"Org record. The org must be the caller's acting org.\",\n\t\tresponse: 'object',\n\t\terrors: [403, 404]\n\t},\n\t{\n\t\tmethod: 'GET',\n\t\tpath: '/orgs/{orgId}/members',\n\t\tscope: 'read',\n\t\tsummary: 'List org members.',\n\t\tresponse: 'collection',\n\t\terrors: [403]\n\t},\n\t{\n\t\tmethod: 'PATCH',\n\t\tpath: '/orgs/{orgId}/members/{userId}',\n\t\tscope: 'write',\n\t\tsummary: 'Change an org role or permission set. The sole owner cannot be demoted.',\n\t\tresponse: 'empty',\n\t\trequestBody: UpdateOrgMemberBodySchema,\n\t\terrors: [400, 403, 404, 409]\n\t},\n\t{\n\t\tmethod: 'DELETE',\n\t\tpath: '/orgs/{orgId}/members/{userId}',\n\t\tscope: 'write',\n\t\tsummary: 'Remove an org member. The sole owner cannot be removed.',\n\t\tresponse: 'empty',\n\t\terrors: [403, 404, 409]\n\t},\n\t{\n\t\tmethod: 'GET',\n\t\tpath: '/orgs/{orgId}/invites',\n\t\tscope: 'read',\n\t\tsummary: 'List pending invites.',\n\t\tresponse: 'collection',\n\t\terrors: [403]\n\t},\n\t{\n\t\tmethod: 'POST',\n\t\tpath: '/orgs/{orgId}/invites',\n\t\tscope: 'write',\n\t\tsummary: 'Invite someone to the org. The accept URL is returned once.',\n\t\tresponse: 'object',\n\t\tstatus: 201,\n\t\trequestBody: CreateInviteBodySchema,\n\t\terrors: [400, 403, 409]\n\t},\n\t{\n\t\tmethod: 'DELETE',\n\t\tpath: '/orgs/{orgId}/invites/{id}',\n\t\tscope: 'write',\n\t\tsummary: 'Revoke an invite.',\n\t\tresponse: 'empty',\n\t\terrors: [403, 404]\n\t},\n\t{\n\t\tmethod: 'POST',\n\t\tpath: '/orgs/{orgId}/invites/{id}/resend',\n\t\tscope: 'write',\n\t\tsummary:\n\t\t\t'Re-send an invite. Issues a replacement and revokes the original, so the previous link stops working.',\n\t\tresponse: 'object',\n\t\tstatus: 201,\n\t\terrors: [403, 404, 409]\n\t},\n\t// Internal and session-only: a key can never manage keys.\n\t{\n\t\tmethod: 'GET',\n\t\tpath: '/orgs/{orgId}/tokens',\n\t\tscope: 'read',\n\t\tsummary: 'Your API tokens in this org, revoked and expired included.',\n\t\tinternal: true,\n\t\tresponse: 'collection',\n\t\tquery: [\n\t\t\t{ name: 'all', description: \"`true` for every member's tokens. Needs `manage_org_members`.\" }\n\t\t],\n\t\terrors: [403, 503]\n\t},\n\t{\n\t\tmethod: 'POST',\n\t\tpath: '/orgs/{orgId}/tokens',\n\t\tscope: 'write',\n\t\tsummary: 'Create an API token acting as you. The raw key is returned once, as `secret`.',\n\t\tinternal: true,\n\t\tresponse: 'object',\n\t\tstatus: 201,\n\t\trequestBody: CreateApiTokenBodySchema,\n\t\terrors: [400, 403, 503]\n\t},\n\t{\n\t\tmethod: 'DELETE',\n\t\tpath: '/orgs/{orgId}/tokens/{tokenId}',\n\t\tscope: 'write',\n\t\tsummary: 'Revoke an API token: your own, or any in the org with `manage_org_members`.',\n\t\tinternal: true,\n\t\tresponse: 'empty',\n\t\terrors: [403, 404, 503]\n\t},\n\t{\n\t\tmethod: 'GET',\n\t\tpath: '/orgs/{orgId}/compute',\n\t\tscope: 'read',\n\t\tsummary: 'Org compute-server overrides and the shared catalog.',\n\t\tinternal: true,\n\t\tresponse: 'object',\n\t\terrors: [403]\n\t},\n\t{\n\t\tmethod: 'PATCH',\n\t\tpath: '/orgs/{orgId}/compute',\n\t\tscope: 'write',\n\t\tsummary: 'Replace the org compute-server overrides.',\n\t\tinternal: true,\n\t\tresponse: 'empty',\n\t\trequestBody: OrgComputePatchBodySchema,\n\t\terrors: [400, 403]\n\t},\n\t{\n\t\tmethod: 'POST',\n\t\tpath: '/orgs/{orgId}/assets/{kind}',\n\t\tscope: 'write',\n\t\tsummary: 'Upload an org branding asset.',\n\t\tinternal: true,\n\t\tresponse: 'object',\n\t\tmultipart: [{ field: 'image', required: true, description: 'PNG, JPEG, WebP, GIF or SVG.' }],\n\t\terrors: [400, 403, 404]\n\t},\n\t{\n\t\tmethod: 'DELETE',\n\t\tpath: '/orgs/{orgId}/assets/{kind}',\n\t\tscope: 'write',\n\t\tsummary: 'Remove an org branding asset.',\n\t\tinternal: true,\n\t\tresponse: 'empty',\n\t\terrors: [403, 404]\n\t},\n\n\t// ==========================================================================\n\t// Compute\n\t// ==========================================================================\n\t//\n\t// Internal: accepts a remote `definitionUrl` and the anonymous share-token\n\t// flow, neither part of the public contract. Public callers solve through\n\t// `/definitions/{guid}/solve`.\n\t{\n\t\tmethod: 'POST',\n\t\tpath: '/compute',\n\t\tscope: 'solve',\n\t\tsummary: 'Generic solve, including remote definition URLs and share-token access.',\n\t\tinternal: true,\n\t\tresponse: 'object',\n\t\terrors: solveErrors\n\t},\n\t{\n\t\tmethod: 'POST',\n\t\tpath: '/compute/schema',\n\t\tscope: 'upload',\n\t\tsummary: 'Extract UI schemas from an uploaded file before it becomes a definition.',\n\t\tinternal: true,\n\t\tresponse: 'object',\n\t\tmultipart: [{ field: 'file', required: true, description: 'The `.gh` or `.ghx` file.' }],\n\t\tquery: [\n\t\t\t{ name: 'projectId', description: 'Project the file will belong to.' },\n\t\t\t{ name: 'computeServerId', description: 'Pin to a compute server.' }\n\t\t],\n\t\terrors: [400, 403, 422, 503]\n\t},\n\n\t// ==========================================================================\n\t// Live solve events\n\t// ==========================================================================\n\t//\n\t// Internal: the browser's live channel and the plugin's callback into it. Both\n\t// are shaped by the Selva plugin and web app, not by the public contract.\n\t{\n\t\tmethod: 'GET',\n\t\tpath: '/solve-events',\n\t\tscope: 'read',\n\t\tsummary: \"The tab's live event stream (SSE). Solves that name its `streamId` report here.\",\n\t\tinternal: true,\n\t\tresponse: 'object',\n\t\tquery: [{ name: 'streamId', description: 'Minted by the tab, 16-64 URL-safe characters.' }],\n\t\terrors: [400, 401, 409]\n\t},\n\t{\n\t\tmethod: 'POST',\n\t\tpath: '/solve-events/{solveId}',\n\t\tscope: 'write',\n\t\tsummary: \"The plugin's callback from inside a Compute solve. The reply carries `abort`.\",\n\t\tinternal: true,\n\t\tresponse: 'object',\n\t\terrors: [400, 401, 410]\n\t},\n\t{\n\t\tmethod: 'POST',\n\t\tpath: '/solve/{solveId}/cancel',\n\t\tscope: 'solve',\n\t\tsummary: 'Ask a running solve to abort. Cooperative: it stops at the next component.',\n\t\tinternal: true,\n\t\tresponse: 'empty',\n\t\terrors: [401, 404]\n\t}\n];\n\n/** `/definitions/{guid}` → the SvelteKit directory form `definitions/[guid]`. */\nexport function toRoutePath(openApiPath: string): string {\n\treturn openApiPath.replace(/^\\//, '').replace(/\\{(\\w+)\\}/g, '[$1]');\n}\n\nexport function endpointKey(method: HttpMethod, path: string): string {\n\treturn `${method} ${path}`;\n}\n"],"mappings":";;;;;;;;;;;;;;;AA8BA,IAAM,cAAc;CAAC;CAAK;CAAK;CAAK;CAAK;AAAG;AAE5C,IAAa,eAA2B;CACvC;EACC,QAAQ;EACR,MAAM;EACN,OAAO;EACP,SAAS;EACT,UAAU;CACX;CAKA;EACC,QAAQ;EACR,MAAM;EACN,OAAO;EACP,SACC;EACD,UAAU;EACV,SACC;CACF;CAEA;EACC,QAAQ;EACR,MAAM;EACN,OAAO;EACP,SACC;EACD,UAAU;EACV,QAAQ,CAAC,KAAK,GAAG;CAClB;CACA;EACC,QAAQ;EACR,MAAM;EACN,OAAO;EACP,SAAS;EACT,UAAU;EACV,QAAQ,CAAC,GAAG;CACb;CACA;EACC,QAAQ;EACR,MAAM;EACN,OAAO;EACP,SAAS;EACT,UAAU;CACX;CAKA;EACC,QAAQ;EACR,MAAM;EACN,OAAO;EACP,SAAS;EACT,UAAU;EACV,SACC;EACD,OAAO;GACN;IAAE,MAAM;IAAa,aAAa;GAA2B;GAC7D;I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T,UAAU;EACV,UAAU;EACV,WAAW,CAAC;GAAE,OAAO;GAAS,UAAU;GAAM,aAAa;EAA+B,CAAC;EAC3F,QAAQ;GAAC;GAAK;GAAK;EAAG;CACvB;CACA;EACC,QAAQ;EACR,MAAM;EACN,OAAO;EACP,SAAS;EACT,UAAU;EACV,UAAU;EACV,QAAQ,CAAC,KAAK,GAAG;CAClB;CASA;EACC,QAAQ;EACR,MAAM;EACN,OAAO;EACP,SAAS;EACT,UAAU;EACV,UAAU;EACV,QAAQ;CACT;CACA;EACC,QAAQ;EACR,MAAM;EACN,OAAO;EACP,SAAS;EACT,UAAU;EACV,UAAU;EACV,WAAW,CAAC;GAAE,OAAO;GAAQ,UAAU;GAAM,aAAa;EAA4B,CAAC;EACvF,OAAO,CACN;GAAE,MAAM;GAAa,aAAa;EAAmC,GACrE;GAAE,MAAM;GAAmB,aAAa;EAA2B,CACpE;EACA,QAAQ;GAAC;GAAK;GAAK;GAAK;EAAG;CAC5B;CAQA;EACC,QAAQ;EACR,MAAM;EACN,OAAO;EACP,SAAS;EACT,UAAU;EACV,UAAU;EACV,OAAO,CAAC;GAAE,MAAM;GAAY,aAAa;EAAgD,CAAC;EAC1F,QAAQ;GAAC;GAAK;GAAK;EAAG;CACvB;CACA;EACC,QAAQ;EACR,MAAM;EACN,OAAO;EACP,SAAS;EACT,UAAU;EACV,UAAU;EACV,QAAQ;GAAC;GAAK;GAAK;EAAG;CACvB;CACA;EACC,QAAQ;EACR,MAAM;EACN,OAAO;EACP,SAAS;EACT,UAAU;EACV,UAAU;EACV,QAAQ,CAAC,KAAK,GAAG;CAClB;AACD"}
1
+ {"version":3,"file":"registry.js","names":[],"sources":["../../../src/lib/server/api/v1/registry.ts"],"sourcesContent":["/**\n * The v1 contract as data: one entry per method+path, naming its body validator,\n * response shape, and whether it's public or internal.\n *\n * Both the OpenAPI generator and the conformance test read this file. The test\n * walks `routes/api/v1/**` against this table and fails if either side has an\n * entry the other doesn't — a route with no registry entry is undocumented, a\n * registry entry with no route is a spec promising something that 404s.\n *\n * Request schemas are Zod values imported from `@selvajs/server/api`, not\n * transcribed, so a renamed field changes the spec on the next generate\n * instead of silently disagreeing with the validator.\n */\n\nimport {\n\ttype Endpoint,\n\ttype HttpMethod,\n\tSolveBodySchema,\n\tUpdateDefinitionBodySchema,\n\tPublishVersionBodySchema,\n\tCreateShareLinkBodySchema,\n\tCreateProjectBodySchema,\n\tUpdateProjectBodySchema,\n\tAddProjectMemberBodySchema,\n\tUpdateProjectMemberBodySchema,\n\tCreateInviteBodySchema,\n\tUpdateOrgMemberBodySchema,\n\tOrgComputePatchBodySchema,\n\tCreateApiTokenBodySchema\n} from '@selvajs/server/api';\n\nexport type { Endpoint, HttpMethod };\n\nconst solveErrors = [400, 401, 404, 429, 503];\n\nexport const V1_ENDPOINTS: Endpoint[] = [\n\t{\n\t\tmethod: 'GET',\n\t\tpath: '/openapi.json',\n\t\tscope: 'read',\n\t\tsummary: 'This document, as JSON.',\n\t\tresponse: 'object'\n\t},\n\n\t// ==========================================================================\n\t// Me\n\t// ==========================================================================\n\t{\n\t\tmethod: 'GET',\n\t\tpath: '/me',\n\t\tscope: 'read',\n\t\tsummary:\n\t\t\t'The calling identity, its acting org, its effective permissions, and for a token its id, scopes and expiry.',\n\t\tresponse: 'object',\n\t\treturns:\n\t\t\t'`apiToken: { id, scopes, expiresAt }` is present only when the caller is an API token. `capabilities.createProjects` says whether `POST /projects` would accept this caller, narrowed to the key; `orgPermissions` is the owner’s and is not.'\n\t},\n\t// Every key may call it, whatever its scopes; `read` is the action every key holds.\n\t{\n\t\tmethod: 'DELETE',\n\t\tpath: '/me/token',\n\t\tscope: 'read',\n\t\tsummary:\n\t\t\t'Revoke the API token that sent this request. A key can revoke itself and nothing else; a browser session gets 400.',\n\t\tresponse: 'empty',\n\t\terrors: [400, 503]\n\t},\n\t{\n\t\tmethod: 'PUT',\n\t\tpath: '/me/starred/{guid}',\n\t\tscope: 'write',\n\t\tsummary: 'Star a definition. Idempotent.',\n\t\tresponse: 'empty',\n\t\terrors: [404]\n\t},\n\t{\n\t\tmethod: 'DELETE',\n\t\tpath: '/me/starred/{guid}',\n\t\tscope: 'write',\n\t\tsummary: 'Unstar a definition. Idempotent.',\n\t\tresponse: 'empty'\n\t},\n\n\t// ==========================================================================\n\t// Definitions\n\t// ==========================================================================\n\t{\n\t\tmethod: 'GET',\n\t\tpath: '/definitions',\n\t\tscope: 'read',\n\t\tsummary: 'List definitions the caller can see.',\n\t\tresponse: 'collection',\n\t\treturns:\n\t\t\t'Each item has `sourceDocumentId`: the Grasshopper document GUID the definition was last uploaded from, or null.',\n\t\tquery: [\n\t\t\t{ name: 'projectId', description: 'Restrict to one project.' },\n\t\t\t{ name: 'status', description: 'One of `draft`, `published`, `archived`.' },\n\t\t\t{\n\t\t\t\tname: 'documentId',\n\t\t\t\tdescription:\n\t\t\t\t\t'A Grasshopper document GUID. Returns only definitions last uploaded from that document which the caller can upload a new version of. Not a GUID: 400.'\n\t\t\t}\n\t\t],\n\t\terrors: [400]\n\t},\n\t{\n\t\tmethod: 'POST',\n\t\tpath: '/definitions',\n\t\tscope: 'upload',\n\t\tidempotent: true,\n\t\tsummary: 'Create a definition from a Grasshopper file.',\n\t\tresponse: 'object',\n\t\tstatus: 201,\n\t\tmultipart: [\n\t\t\t{ field: 'file', required: true, description: 'The `.gh` or `.ghx` file.' },\n\t\t\t{ field: 'projectId', required: true, description: 'Owning project.' },\n\t\t\t{ field: 'displayName', required: true, description: 'Human-readable name.' },\n\t\t\t{ field: 'description', required: false, description: 'Long description.' },\n\t\t\t{ field: 'category', required: false, description: 'Grouping label.' },\n\t\t\t{ field: 'tags', required: false, description: 'Comma-separated tags.' },\n\t\t\t{ field: 'image', required: false, description: 'Cover image.' },\n\t\t\t{ field: 'computeServerId', required: false, description: 'Pin to a compute server.' }\n\t\t],\n\t\terrors: [400, 403, 422, 503]\n\t},\n\t{\n\t\tmethod: 'GET',\n\t\tpath: '/definitions/{guid}',\n\t\tscope: 'read',\n\t\tsummary: 'Definition record plus its live and draft version summaries.',\n\t\tresponse: 'object',\n\t\treturns:\n\t\t\t'`canEdit` is true when the caller can upload a version and make one live; for an API token that includes its scopes. `sourceDocumentId` is the Grasshopper document GUID it was last uploaded from, or null.',\n\t\terrors: [404]\n\t},\n\t{\n\t\tmethod: 'PATCH',\n\t\tpath: '/definitions/{guid}',\n\t\tscope: 'write',\n\t\tsummary: 'Update definition metadata.',\n\t\tresponse: 'empty',\n\t\trequestBody: UpdateDefinitionBodySchema,\n\t\terrors: [400, 404]\n\t},\n\t{\n\t\tmethod: 'DELETE',\n\t\tpath: '/definitions/{guid}',\n\t\tscope: 'write',\n\t\tsummary: 'Soft-delete a definition.',\n\t\tresponse: 'empty',\n\t\terrors: [404]\n\t},\n\t{\n\t\tmethod: 'POST',\n\t\tpath: '/definitions/{guid}/solve',\n\t\tscope: 'solve',\n\t\tidempotent: true,\n\t\tsummary: 'Solve a definition. The primary action of the API.',\n\t\tresponse: 'object',\n\t\trequestBody: SolveBodySchema,\n\t\terrors: solveErrors\n\t},\n\t{\n\t\tmethod: 'GET',\n\t\tpath: '/definitions/{guid}/schema',\n\t\tscope: 'read',\n\t\tsummary: \"The live version's UI schema. 404 when nothing is published.\",\n\t\tresponse: 'object',\n\t\terrors: [404]\n\t},\n\t{\n\t\tmethod: 'GET',\n\t\tpath: '/definitions/{guid}/versions',\n\t\tscope: 'read',\n\t\tsummary: 'List versions, newest first.',\n\t\tresponse: 'collection',\n\t\terrors: [404]\n\t},\n\t{\n\t\tmethod: 'POST',\n\t\tpath: '/definitions/{guid}/versions',\n\t\tscope: 'upload',\n\t\tidempotent: true,\n\t\tsummary: 'Upload a new version.',\n\t\tresponse: 'object',\n\t\tstatus: 201,\n\t\tmultipart: [\n\t\t\t{ field: 'file', required: true, description: 'The `.gh` or `.ghx` file.' },\n\t\t\t{ field: 'changeNote', required: false, description: 'Truncated to 1000 characters.' }\n\t\t],\n\t\terrors: [400, 404, 422, 503]\n\t},\n\t{\n\t\tmethod: 'GET',\n\t\tpath: '/definitions/{guid}/versions/{versionId}',\n\t\tscope: 'read',\n\t\tsummary: 'One version, without its cached schema.',\n\t\tresponse: 'object',\n\t\terrors: [404]\n\t},\n\t{\n\t\tmethod: 'DELETE',\n\t\tpath: '/definitions/{guid}/versions/{versionId}',\n\t\tscope: 'write',\n\t\tsummary: 'Delete a version. 409 when it is the live or draft pointer.',\n\t\tresponse: 'empty',\n\t\terrors: [404, 409]\n\t},\n\t{\n\t\tmethod: 'GET',\n\t\tpath: '/definitions/{guid}/versions/{versionId}/schema',\n\t\tscope: 'read',\n\t\tsummary: \"That version's cached UI schema. No compute round-trip.\",\n\t\tresponse: 'object',\n\t\terrors: [404]\n\t},\n\t{\n\t\tmethod: 'POST',\n\t\tpath: '/definitions/{guid}/publish',\n\t\tscope: 'upload',\n\t\tsummary: 'Promote a version to live.',\n\t\tresponse: 'object',\n\t\trequestBody: PublishVersionBodySchema,\n\t\terrors: [400, 404]\n\t},\n\t{\n\t\tmethod: 'POST',\n\t\tpath: '/definitions/{guid}/image',\n\t\tscope: 'write',\n\t\tsummary: 'Upload a cover image.',\n\t\tresponse: 'object',\n\t\tmultipart: [{ field: 'image', required: true, description: 'PNG, JPEG, WebP or GIF.' }],\n\t\terrors: [400, 404]\n\t},\n\t{\n\t\tmethod: 'GET',\n\t\tpath: '/definitions/{guid}/share-links',\n\t\tscope: 'read',\n\t\tsummary: 'List share links. 404 when sharing is disabled on the instance.',\n\t\tresponse: 'collection',\n\t\terrors: [404]\n\t},\n\t{\n\t\tmethod: 'POST',\n\t\tpath: '/definitions/{guid}/share-links',\n\t\tscope: 'write',\n\t\tidempotent: true,\n\t\tsummary: 'Create a share link. The raw token is returned once and never again.',\n\t\tresponse: 'object',\n\t\tstatus: 201,\n\t\trequestBody: CreateShareLinkBodySchema,\n\t\terrors: [400, 404]\n\t},\n\t{\n\t\tmethod: 'DELETE',\n\t\tpath: '/definitions/{guid}/share-links/{linkId}',\n\t\tscope: 'write',\n\t\tsummary: 'Revoke a share link.',\n\t\tresponse: 'empty',\n\t\terrors: [404]\n\t},\n\n\t// ==========================================================================\n\t// Projects\n\t// ==========================================================================\n\t{\n\t\tmethod: 'GET',\n\t\tpath: '/projects',\n\t\tscope: 'read',\n\t\tsummary: 'List projects the caller can view.',\n\t\tresponse: 'collection',\n\t\treturns:\n\t\t\t'Each item has `canCreateDefinitions`: whether `POST /definitions` would accept this project from the caller, scopes included for an API token.'\n\t},\n\t{\n\t\tmethod: 'POST',\n\t\tpath: '/projects',\n\t\tscope: 'create_projects',\n\t\tidempotent: true,\n\t\tsummary:\n\t\t\t'Create a project. A key with `create_projects` but not `write` may create private projects only, with `autoJoinOnUpload` off.',\n\t\tresponse: 'object',\n\t\tstatus: 201,\n\t\trequestBody: CreateProjectBodySchema,\n\t\terrors: [400, 403, 409]\n\t},\n\t{\n\t\tmethod: 'GET',\n\t\tpath: '/projects/{id}',\n\t\tscope: 'read',\n\t\tsummary: \"Project record plus the caller's effective role and capabilities.\",\n\t\tresponse: 'object',\n\t\terrors: [404]\n\t},\n\t{\n\t\tmethod: 'PATCH',\n\t\tpath: '/projects/{id}',\n\t\tscope: 'write',\n\t\tsummary: 'Update project settings. Owner-only.',\n\t\tresponse: 'empty',\n\t\trequestBody: UpdateProjectBodySchema,\n\t\terrors: [400, 403, 404, 409]\n\t},\n\t{\n\t\tmethod: 'DELETE',\n\t\tpath: '/projects/{id}',\n\t\tscope: 'write',\n\t\tsummary: 'Delete a project.',\n\t\tresponse: 'empty',\n\t\terrors: [403, 404]\n\t},\n\t{\n\t\tmethod: 'GET',\n\t\tpath: '/projects/{id}/members',\n\t\tscope: 'read',\n\t\tsummary: 'List project members.',\n\t\tresponse: 'collection',\n\t\terrors: [403, 404]\n\t},\n\t{\n\t\tmethod: 'POST',\n\t\tpath: '/projects/{id}/members',\n\t\tscope: 'write',\n\t\tsummary: 'Add a member. The target must already belong to the org.',\n\t\tresponse: 'object',\n\t\tstatus: 201,\n\t\trequestBody: AddProjectMemberBodySchema,\n\t\terrors: [400, 403, 404]\n\t},\n\t{\n\t\tmethod: 'PATCH',\n\t\tpath: '/projects/{id}/members/{userId}',\n\t\tscope: 'write',\n\t\tsummary: 'Change a member role.',\n\t\tresponse: 'empty',\n\t\trequestBody: UpdateProjectMemberBodySchema,\n\t\terrors: [400, 403, 404, 409]\n\t},\n\t{\n\t\tmethod: 'DELETE',\n\t\tpath: '/projects/{id}/members/{userId}',\n\t\tscope: 'write',\n\t\tsummary: 'Remove a member. Idempotent.',\n\t\tresponse: 'empty',\n\t\tquery: [\n\t\t\t{\n\t\t\t\tname: 'confirm',\n\t\t\t\tdescription: 'Set to `true` to remove a co-owner; without it the call returns 409.'\n\t\t\t}\n\t\t],\n\t\terrors: [403, 404, 409]\n\t},\n\t{\n\t\tmethod: 'POST',\n\t\tpath: '/projects/{id}/reclaim',\n\t\tscope: 'write',\n\t\tsummary: 'Claim ownership of an unowned project.',\n\t\tresponse: 'object',\n\t\tstatus: 201,\n\t\terrors: [403, 404, 409]\n\t},\n\n\t// ==========================================================================\n\t// Orgs\n\t// ==========================================================================\n\t{\n\t\tmethod: 'GET',\n\t\tpath: '/orgs/{orgId}',\n\t\tscope: 'read',\n\t\tsummary: \"Org record. The org must be the caller's acting org.\",\n\t\tresponse: 'object',\n\t\terrors: [403, 404]\n\t},\n\t{\n\t\tmethod: 'GET',\n\t\tpath: '/orgs/{orgId}/members',\n\t\tscope: 'read',\n\t\tsummary: 'List org members.',\n\t\tresponse: 'collection',\n\t\terrors: [403]\n\t},\n\t{\n\t\tmethod: 'PATCH',\n\t\tpath: '/orgs/{orgId}/members/{userId}',\n\t\tscope: 'write',\n\t\tsummary: 'Change an org role or permission set. The sole owner cannot be demoted.',\n\t\tresponse: 'empty',\n\t\trequestBody: UpdateOrgMemberBodySchema,\n\t\terrors: [400, 403, 404, 409]\n\t},\n\t{\n\t\tmethod: 'DELETE',\n\t\tpath: '/orgs/{orgId}/members/{userId}',\n\t\tscope: 'write',\n\t\tsummary: 'Remove an org member. The sole owner cannot be removed.',\n\t\tresponse: 'empty',\n\t\terrors: [403, 404, 409]\n\t},\n\t{\n\t\tmethod: 'GET',\n\t\tpath: '/orgs/{orgId}/invites',\n\t\tscope: 'read',\n\t\tsummary: 'List pending invites.',\n\t\tresponse: 'collection',\n\t\terrors: [403]\n\t},\n\t{\n\t\tmethod: 'POST',\n\t\tpath: '/orgs/{orgId}/invites',\n\t\tscope: 'write',\n\t\tsummary: 'Invite someone to the org. The accept URL is returned once.',\n\t\tresponse: 'object',\n\t\tstatus: 201,\n\t\trequestBody: CreateInviteBodySchema,\n\t\terrors: [400, 403, 409]\n\t},\n\t{\n\t\tmethod: 'DELETE',\n\t\tpath: '/orgs/{orgId}/invites/{id}',\n\t\tscope: 'write',\n\t\tsummary: 'Revoke an invite.',\n\t\tresponse: 'empty',\n\t\terrors: [403, 404]\n\t},\n\t{\n\t\tmethod: 'POST',\n\t\tpath: '/orgs/{orgId}/invites/{id}/resend',\n\t\tscope: 'write',\n\t\tsummary:\n\t\t\t'Re-send an invite. Issues a replacement and revokes the original, so the previous link stops working.',\n\t\tresponse: 'object',\n\t\tstatus: 201,\n\t\terrors: [403, 404, 409]\n\t},\n\t// Internal and session-only: a key can never manage keys.\n\t{\n\t\tmethod: 'GET',\n\t\tpath: '/orgs/{orgId}/tokens',\n\t\tscope: 'read',\n\t\tsummary: 'Your API tokens in this org, revoked and expired included.',\n\t\tinternal: true,\n\t\tresponse: 'collection',\n\t\tquery: [\n\t\t\t{ name: 'all', description: \"`true` for every member's tokens. Needs `manage_org_members`.\" }\n\t\t],\n\t\terrors: [403, 503]\n\t},\n\t{\n\t\tmethod: 'POST',\n\t\tpath: '/orgs/{orgId}/tokens',\n\t\tscope: 'write',\n\t\tsummary: 'Create an API token acting as you. The raw key is returned once, as `secret`.',\n\t\tinternal: true,\n\t\tresponse: 'object',\n\t\tstatus: 201,\n\t\trequestBody: CreateApiTokenBodySchema,\n\t\terrors: [400, 403, 503]\n\t},\n\t{\n\t\tmethod: 'DELETE',\n\t\tpath: '/orgs/{orgId}/tokens/{tokenId}',\n\t\tscope: 'write',\n\t\tsummary: 'Revoke an API token: your own, or any in the org with `manage_org_members`.',\n\t\tinternal: true,\n\t\tresponse: 'empty',\n\t\terrors: [403, 404, 503]\n\t},\n\t{\n\t\tmethod: 'GET',\n\t\tpath: '/orgs/{orgId}/compute',\n\t\tscope: 'read',\n\t\tsummary: 'Org compute-server overrides and the shared catalog.',\n\t\tinternal: true,\n\t\tresponse: 'object',\n\t\terrors: [403]\n\t},\n\t{\n\t\tmethod: 'PATCH',\n\t\tpath: '/orgs/{orgId}/compute',\n\t\tscope: 'write',\n\t\tsummary: 'Replace the org compute-server overrides.',\n\t\tinternal: true,\n\t\tresponse: 'empty',\n\t\trequestBody: OrgComputePatchBodySchema,\n\t\terrors: [400, 403]\n\t},\n\t{\n\t\tmethod: 'POST',\n\t\tpath: '/orgs/{orgId}/assets/{kind}',\n\t\tscope: 'write',\n\t\tsummary: 'Upload an org branding asset.',\n\t\tinternal: true,\n\t\tresponse: 'object',\n\t\tmultipart: [{ field: 'image', required: true, description: 'PNG, JPEG, WebP, GIF or SVG.' }],\n\t\terrors: [400, 403, 404]\n\t},\n\t{\n\t\tmethod: 'DELETE',\n\t\tpath: '/orgs/{orgId}/assets/{kind}',\n\t\tscope: 'write',\n\t\tsummary: 'Remove an org branding asset.',\n\t\tinternal: true,\n\t\tresponse: 'empty',\n\t\terrors: [403, 404]\n\t},\n\n\t// ==========================================================================\n\t// Compute\n\t// ==========================================================================\n\t//\n\t// Internal: accepts a remote `definitionUrl` and the anonymous share-token\n\t// flow, neither part of the public contract. Public callers solve through\n\t// `/definitions/{guid}/solve`.\n\t{\n\t\tmethod: 'POST',\n\t\tpath: '/compute',\n\t\tscope: 'solve',\n\t\tsummary: 'Generic solve, including remote definition URLs and share-token access.',\n\t\tinternal: true,\n\t\tresponse: 'object',\n\t\terrors: solveErrors\n\t},\n\t{\n\t\tmethod: 'POST',\n\t\tpath: '/compute/schema',\n\t\tscope: 'upload',\n\t\tsummary: 'Extract UI schemas from an uploaded file before it becomes a definition.',\n\t\tinternal: true,\n\t\tresponse: 'object',\n\t\tmultipart: [{ field: 'file', required: true, description: 'The `.gh` or `.ghx` file.' }],\n\t\tquery: [\n\t\t\t{ name: 'projectId', description: 'Project the file will belong to.' },\n\t\t\t{ name: 'computeServerId', description: 'Pin to a compute server.' }\n\t\t],\n\t\terrors: [400, 403, 422, 503]\n\t},\n\n\t// ==========================================================================\n\t// Live solve events\n\t// ==========================================================================\n\t//\n\t// Internal: the browser's live channel and the plugin's callback into it. Both\n\t// are shaped by the Selva plugin and web app, not by the public contract.\n\t{\n\t\tmethod: 'GET',\n\t\tpath: '/solve-events',\n\t\tscope: 'read',\n\t\tsummary: \"The tab's live event stream (SSE). Solves that name its `streamId` report here.\",\n\t\tinternal: true,\n\t\tresponse: 'object',\n\t\tquery: [{ name: 'streamId', description: 'Minted by the tab, 16-64 URL-safe characters.' }],\n\t\terrors: [400, 401, 409]\n\t},\n\t{\n\t\tmethod: 'POST',\n\t\tpath: '/solve-events/{solveId}',\n\t\tscope: 'write',\n\t\tsummary: \"The plugin's callback from inside a Compute solve. The reply carries `abort`.\",\n\t\tinternal: true,\n\t\tresponse: 'object',\n\t\terrors: [400, 401, 410]\n\t},\n\t{\n\t\tmethod: 'POST',\n\t\tpath: '/solve/{solveId}/cancel',\n\t\tscope: 'solve',\n\t\tsummary: 'Ask a running solve to abort. Cooperative: it stops at the next component.',\n\t\tinternal: true,\n\t\tresponse: 'empty',\n\t\terrors: [401, 404]\n\t}\n];\n\n/** `/definitions/{guid}` → the SvelteKit directory form `definitions/[guid]`. */\nexport function toRoutePath(openApiPath: string): string {\n\treturn openApiPath.replace(/^\\//, '').replace(/\\{(\\w+)\\}/g, '[$1]');\n}\n\nexport function endpointKey(method: HttpMethod, path: string): string {\n\treturn `${method} ${path}`;\n}\n"],"mappings":";;;;;;;;;;;;;;;AAiCA,IAA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AAQ;EACR,MAAM;EACN,OAAO;EACP,SAAS;EACT,UAAU;EACV,UAAU;EACV,OAAO,CAAC;GAAE,MAAM;GAAY,aAAa;EAAgD,CAAC;EAC1F,QAAQ;GAAC;GAAK;GAAK;EAAG;CACvB;CACA;EACC,QAAQ;EACR,MAAM;EACN,OAAO;EACP,SAAS;EACT,UAAU;EACV,UAAU;EACV,QAAQ;GAAC;GAAK;GAAK;EAAG;CACvB;CACA;EACC,QAAQ;EACR,MAAM;EACN,OAAO;EACP,SAAS;EACT,UAAU;EACV,UAAU;EACV,QAAQ,CAAC,KAAK,GAAG;CAClB;AACD"}
@@ -1,4 +1,4 @@
1
- import { z as NoopLogger } from "./access.js";
1
+ import { B as NoopLogger } from "./access.js";
2
2
  import { t as assertSafeRemoteDefinitionUrl } from "./safe-url.js";
3
3
  // ../server/src/compute/remote-definition.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { z as NoopLogger } from "./access.js";
1
+ import { B as NoopLogger } from "./access.js";
2
2
  import { lookup } from "node:dns/promises";
3
3
  import { isIP } from "node:net";
4
4
  // ../server/src/compute/safe-url.ts
@@ -1 +1 @@
1
- {"version":3,"file":"schema.js","names":[],"sources":["../../../../schemas/src/generated/schema.ts"],"sourcesContent":["/* eslint-disable */\n/**\n * This file was automatically generated from packages/schemas/ui-schema.json.\n * DO NOT MODIFY IT BY HAND. Instead, modify the source JSON Schema file\n * and run `pnpm generate` at the repo root to regenerate it.\n */\n\nexport type ParamType =\n\t| 'number'\n\t| 'integer'\n\t| 'boolean'\n\t| 'text'\n\t| 'valueList'\n\t| 'dynamicValueList'\n\t| 'file'\n\t| 'color'\n\t| 'generic'\n\t| 'geometry'\n\t| 'point'\n\t| 'line'\n\t| 'plane';\nexport type InputNumberLayoutItem = LayoutItemBase & {\n\ttype: 'input';\n\twidgetType: 'number';\n\tconfig?: NumberWidgetConfig;\n\t[k: string]: unknown | undefined;\n};\nexport type InputTextLayoutItem = LayoutItemBase & {\n\ttype: 'input';\n\twidgetType: 'text';\n\tconfig?: TextWidgetConfig;\n\t[k: string]: unknown | undefined;\n};\nexport type InputDropdownLayoutItem = LayoutItemBase & {\n\ttype: 'input';\n\twidgetType: 'dropdown';\n\tconfig: DropdownWidgetConfig;\n\t[k: string]: unknown | undefined;\n};\nexport type InputDynamicValueListLayoutItem = LayoutItemBase & {\n\ttype: 'input';\n\twidgetType: 'dynamicValueList';\n\tconfig?: DynamicValueListWidgetConfig;\n\t[k: string]: unknown | undefined;\n};\nexport type InputCheckboxLayoutItem = LayoutItemBase & {\n\ttype: 'input';\n\twidgetType: 'checkbox';\n\tconfig?: CheckboxWidgetConfig;\n\t[k: string]: unknown | undefined;\n};\nexport type InputFileLayoutItem = LayoutItemBase & {\n\ttype: 'input';\n\twidgetType: 'file';\n\tconfig?: FileInputWidgetConfig;\n\t[k: string]: unknown | undefined;\n};\nexport type InputColorLayoutItem = LayoutItemBase & {\n\ttype: 'input';\n\twidgetType: 'color';\n\tconfig?: ColorWidgetConfig;\n\t[k: string]: unknown | undefined;\n};\nexport type OutputTextLayoutItem = LayoutItemBase & {\n\ttype: 'output';\n\twidgetType: 'text';\n\t[k: string]: unknown | undefined;\n};\nexport type OutputNumberLayoutItem = LayoutItemBase & {\n\ttype: 'output';\n\twidgetType: 'number';\n\t[k: string]: unknown | undefined;\n};\nexport type OutputFileLayoutItem = LayoutItemBase & {\n\ttype: 'output';\n\twidgetType: 'file';\n\tconfig?: FileWidgetConfig;\n\t[k: string]: unknown | undefined;\n};\nexport type OutputChartLayoutItem = LayoutItemBase & {\n\ttype: 'output';\n\twidgetType: 'chart';\n\tconfig?: ChartWidgetConfig;\n\t[k: string]: unknown | undefined;\n};\nexport type OutputImageLayoutItem = LayoutItemBase & {\n\ttype: 'output';\n\twidgetType: 'image';\n\tconfig?: ImageWidgetConfig;\n\t[k: string]: unknown | undefined;\n};\nexport type OutputDynamicValueListLayoutItem = LayoutItemBase & {\n\ttype: 'output';\n\twidgetType: 'dynamicValueList';\n\tconfig: DynamicValueListOutputConfig;\n\t[k: string]: unknown | undefined;\n};\nexport type LayoutItem =\n\t| InputNumberLayoutItem\n\t| InputTextLayoutItem\n\t| InputDropdownLayoutItem\n\t| InputDynamicValueListLayoutItem\n\t| InputCheckboxLayoutItem\n\t| InputFileLayoutItem\n\t| InputColorLayoutItem\n\t| OutputTextLayoutItem\n\t| OutputNumberLayoutItem\n\t| OutputFileLayoutItem\n\t| OutputChartLayoutItem\n\t| OutputImageLayoutItem\n\t| OutputDynamicValueListLayoutItem\n\t| LineBreakLayoutItem;\nexport type LayoutConfig = TabbedLayoutConfig | FlatLayoutConfig;\nexport type InputStructure = 'item' | 'list' | 'tree';\n\n/**\n * Schema definitions for Selva UI configuration\n */\nexport interface SelvaUISchema {\n\t[k: string]: unknown | undefined;\n}\nexport interface VisibilityRule {\n\t/**\n\t * Parameter ID to watch for changes\n\t */\n\tparamId: string;\n\t/**\n\t * Comparison operator. 'contains', 'containsAny', 'isEmpty', 'isNotEmpty' apply to array-valued params (e.g., checklist value lists).\n\t */\n\toperator:\n\t\t| 'equals'\n\t\t| 'notEquals'\n\t\t| 'greaterThan'\n\t\t| 'lessThan'\n\t\t| 'greaterThanOrEqual'\n\t\t| 'lessThanOrEqual'\n\t\t| 'in'\n\t\t| 'notIn'\n\t\t| 'between'\n\t\t| 'matches'\n\t\t| 'contains'\n\t\t| 'containsAny'\n\t\t| 'isEmpty'\n\t\t| 'isNotEmpty';\n\t/**\n\t * Value to compare against (used for equals, notEquals, greaterThan, lessThan, greaterThanOrEqual, lessThanOrEqual)\n\t */\n\tvalue?: {\n\t\t[k: string]: unknown | undefined;\n\t};\n\t/**\n\t * Array of values (used for 'in', 'notIn' operators, or [min, max] for 'between')\n\t */\n\tvalues?: unknown[];\n}\nexport interface VisibilityCondition {\n\t/**\n\t * Evaluation mode: 'all' = AND (all rules must pass), 'any' = OR (at least one rule must pass)\n\t */\n\tmode?: 'all' | 'any';\n\t/**\n\t * List of rules to evaluate\n\t *\n\t * @minItems 1\n\t */\n\trules: [VisibilityRule, ...VisibilityRule[]];\n\t/**\n\t * Action to apply when condition is met: 'show' makes visible and enabled, 'hide' removes from view, 'disable' makes visible but greyed out and non-interactive\n\t */\n\taction?: 'show' | 'hide' | 'disable';\n\t/**\n\t * Default value to set for the parameter when condition is met. The value should be compatible with the parameter type (number, string, boolean, etc.)\n\t */\n\tdefaultValue?: {\n\t\t[k: string]: unknown | undefined;\n\t};\n}\nexport interface GroupVisibilityCondition {\n\t/**\n\t * Evaluation mode: 'all' = AND (all rules must pass), 'any' = OR (at least one rule must pass)\n\t */\n\tmode?: 'all' | 'any';\n\t/**\n\t * List of rules to evaluate\n\t *\n\t * @minItems 1\n\t */\n\trules: [VisibilityRule, ...VisibilityRule[]];\n\t/**\n\t * Action to apply when condition is met: 'show' makes group visible, 'hide' removes group from view\n\t */\n\taction?: 'show' | 'hide';\n}\nexport interface NumberWidgetConfig {\n\tminimum?: number;\n\tmaximum?: number;\n\tstepSize?: number;\n\tplaceholder?: string;\n\trenderAsSlider?: boolean;\n\t/**\n\t * Never show the min/max hint. Without it, a number box shows the hint beside its label while focused; sliders never show it.\n\t */\n\thideRange?: boolean;\n}\nexport interface TextWidgetConfig {\n\tplaceholder?: string;\n\trequired?: boolean;\n\t/**\n\t * Maximum character length for text input\n\t */\n\tmaxLength?: number;\n\t/**\n\t * Regex pattern for validation (e.g., email, phone)\n\t */\n\tpattern?: string;\n\t/**\n\t * Custom error message shown when pattern validation fails\n\t */\n\tcustomErrorMessage?: string;\n}\nexport interface OptionMedia {\n\t/**\n\t * Asset holding the option's icon (an OptionAsset with d).\n\t */\n\ticon?: string;\n\t/**\n\t * Asset holding the option's thumbnail (an OptionAsset with img).\n\t */\n\timage?: string;\n\t/**\n\t * Iconify name the icon was picked as (e.g. 'lucide:house'), so the builder can reopen the picker on it. Never rendered.\n\t */\n\ticonName?: string;\n}\nexport interface OptionAsset {\n\t/**\n\t * SVG path data on a 24x24 grid, drawn as a stroke (width 2, round caps and joins, no fill). Rendered as a path's d attribute, never as markup.\n\t */\n\td?: string;\n\t/**\n\t * Thumbnail as a base64 data URI. Only WebP, JPEG and PNG are accepted.\n\t */\n\timg?: string;\n\t/**\n\t * Thumbnail width in pixels\n\t */\n\tw?: number;\n\t/**\n\t * Thumbnail height in pixels\n\t */\n\th?: number;\n}\nexport interface DropdownWidgetConfig {\n\t/**\n\t * Key-value pairs for dropdown options\n\t */\n\toptions: {\n\t\t[k: string]: string | undefined;\n\t};\n\trequired?: boolean;\n\t/**\n\t * How to render the value list. 'dropdown' = single-select dropdown (value: string). 'checklist' = multi-select checkboxes (value: string[]); requires list access on the connected parameter. 'segmented' = single-select button row, shown as a dropdown when there are too many options to fit. 'tiles' = single-select grid of thumbnails.\n\t */\n\tdisplayAs?: 'dropdown' | 'checklist' | 'segmented' | 'tiles';\n\t/**\n\t * Icon and thumbnail per option, keyed by option name. Grasshopper owns options; this map is the author's and survives a re-sync.\n\t */\n\toptionMedia?: {\n\t\t[k: string]: OptionMedia | undefined;\n\t};\n}\nexport interface DynamicValueListWidgetConfig {\n\t/**\n\t * Author-provided seed list (name -> value). Shown until computed options replace it. Empty/absent means the input is empty until the first solve produces options.\n\t */\n\tdefaultOptions?: {\n\t\t[k: string]: string | undefined;\n\t};\n\t/**\n\t * What to render when there are no options yet (no defaultOptions and no computed options): 'hide' removes the field from view, 'show-empty' shows a disabled 'no options yet' control.\n\t */\n\temptyBehavior?: 'hide' | 'show-empty';\n\t/**\n\t * How to render the value list. 'dropdown' = single-select (value: string). 'checklist' = multi-select (value: string[]). 'segmented' = single-select button row, shown as a dropdown when there are too many options to fit. 'tiles' = single-select grid of thumbnails.\n\t */\n\tdisplayAs?: 'dropdown' | 'checklist' | 'segmented' | 'tiles';\n\t/**\n\t * Icon and thumbnail per option, keyed by option name. Names without an entry show text only.\n\t */\n\toptionMedia?: {\n\t\t[k: string]: OptionMedia | undefined;\n\t};\n}\nexport interface DynamicValueListOutputConfig {\n\t/**\n\t * The backend parameter's GUID (paramId) of the DynamicValueList input that this output's computed options populate.\n\t */\n\ttargetInputId: string;\n}\nexport interface CheckboxWidgetConfig {\n\t/**\n\t * 'checkbox' = a toggle whose value is sent with every solve. 'button' = a trigger: a press solves once with true, then the input goes back to false. A button holds no value in the form, so presets and value updates skip it.\n\t */\n\tdisplayAs?: 'checkbox' | 'button';\n}\nexport interface FileWidgetConfig {\n\tbuttonLabel?: string;\n\t/**\n\t * File format hint (e.g., '3dm') for setting download extension\n\t */\n\tfileFormat?: string;\n}\nexport interface FileInputWidgetConfig {\n\t/**\n\t * List of accepted file extensions (e.g., ['.3dm', '.step'])\n\t */\n\tacceptedFormats?: string[];\n\t/**\n\t * Which mode is active by default when both are allowed\n\t */\n\tdefaultInputMode?: 'upload' | 'url';\n\t/**\n\t * Which input modes the end user can choose from. If omitted, both are allowed.\n\t */\n\tallowedInputModes?: ('upload' | 'url')[];\n}\nexport interface ColorWidgetConfig {}\nexport interface LayoutItemBase {\n\t/**\n\t * Unique identifier for this layout item in the UI tree (not the parameter ID)\n\t */\n\tid: string;\n\t/**\n\t * References the backend parameter's GUID (Data Source)\n\t */\n\tparamId: string;\n\tdisplayName?: string;\n\tdescription?: string;\n\torder?: number;\n\tspan?: number;\n\t/**\n\t * Base visibility (static). If false, item is always hidden regardless of conditions.\n\t */\n\tvisible?: boolean;\n\tvisibilityCondition?: VisibilityCondition;\n\tsource?: InputSource;\n\t[k: string]: unknown | undefined;\n}\nexport interface InputSource {\n\t/**\n\t * Which data provider supplies the value. 'user' = the person types it into the form. 'client' = a browser app (e.g. a measurement/producer tool) fills it in before the form runs, not the person. 'server' = looked up on the server from your data when the definition solves; never shown in the form.\n\t */\n\tkind: 'user' | 'client' | 'server';\n\t/**\n\t * The address the host resolves to fill this input — opaque to Selva, interpreted by the host per 'kind'. For 'client' it names WHICH producer app supplies the value (e.g. 'line-app', 'file-upload') so the host pre-routes to it; for 'server' it names WHAT to fetch (e.g. 'capture.geometry') for the host's resolver. Keys need not be unique: the same producer/fetch may fill several inputs. Ignored for kind='user'.\n\t */\n\tkey?: string;\n\t/**\n\t * How a client-sourced input appears in the form (only meaningful when kind='client'). Omitted = 'hidden': the value is prefilled silently and the input does not appear. 'slot' = Selva reserves the input's grid cell and lets the host render its own element there; Selva draws nothing itself and never interprets that element.\n\t */\n\tclient?: {\n\t\t/**\n\t\t * 'hidden' = no UI; the producer app prefills the value and the input does not appear. 'slot' = the host renders a custom element (e.g. an 'Edit JSON' button) in this input's place, referencing the producer named by 'key'.\n\t\t */\n\t\tpresentation?: 'hidden' | 'slot';\n\t};\n}\nexport interface ChartWidgetConfig {}\nexport interface ImageWidgetConfig {\n\t/**\n\t * Show a download button on the image viewer\n\t */\n\tallowDownload?: boolean;\n\t/**\n\t * Show a fullscreen toggle button on the image viewer\n\t */\n\tallowFullscreen?: boolean;\n\t/**\n\t * Optional background color shown behind the image (hex string, e.g. '#ffffff')\n\t */\n\tbackgroundColor?: string;\n}\nexport interface LineBreakLayoutItem {\n\t/**\n\t * Unique identifier for this layout item in the UI tree\n\t */\n\tid: string;\n\ttype: 'linebreak';\n}\nexport interface GroupConfig {\n\tid: string;\n\tlabel: string;\n\tdescription?: string;\n\torder?: number;\n\tcollapsed?: boolean;\n\tcolumns?: number;\n\titems: LayoutItem[];\n\tvisibilityCondition?: GroupVisibilityCondition;\n}\nexport interface TabConfig {\n\tid: string;\n\tlabel: string;\n\ticon?: string;\n\torder?: number;\n\tgroups: GroupConfig[];\n\t/**\n\t * Horizontal region where this tab should be positioned in multi-column layouts\n\t */\n\tposition?: 'left' | 'center' | 'right';\n\t/**\n\t * Base visibility (static). If false, the tab is always hidden. A tab whose groups are all hidden is hidden too.\n\t */\n\tvisible?: boolean;\n}\nexport interface TabbedLayoutConfig {\n\ttype: 'tabbed';\n\tgap?: number;\n\ttabs: TabConfig[];\n}\nexport interface FlatLayoutConfig {\n\ttype: 'flat';\n\tgap?: number;\n\tgroups: GroupConfig[];\n}\nexport interface SchemaInput {\n\t/**\n\t * Backend-specific parameter identifier (e.g. a Grasshopper InstanceGuid)\n\t */\n\tid: string;\n\tnickname: string;\n\tparamType: ParamType;\n\tdescription?: string;\n\tdefault?: unknown;\n\t/**\n\t * Data access mode: 'item' = single value, 'list' = flat list, 'tree' = branching data tree. Defaults to 'item'.\n\t */\n\tinputStructure?: 'item' | 'list' | 'tree';\n}\nexport interface SchemaOutput {\n\t/**\n\t * Backend-specific parameter identifier (e.g. a Grasshopper InstanceGuid)\n\t */\n\tid: string;\n\tnickname: string;\n\tdescription?: string;\n\t/**\n\t * Output display type\n\t */\n\ttype: 'text' | 'number' | 'file' | 'chart' | 'dynamicValueList';\n\t/**\n\t * For 'dynamicValueList' outputs: the instance GUID (paramId) of the DynamicValueList input that this output's computed options populate.\n\t */\n\ttargetInputId?: string;\n}\nexport interface ViewerOptions {\n\t/**\n\t * If true, the plugin streams display meshes to its local web preview, which then shows the 3D viewer. Selva ignores it.\n\t */\n\tenableLocal?: boolean;\n\t/**\n\t * If true, Selva draws the display meshes in the Rhino.Compute response and shows the 3D viewer. The plugin's local preview ignores it.\n\t */\n\tenableRemote?: boolean;\n\t/**\n\t * Background color for the 3D viewer as hex string (e.g., '#ffffff')\n\t */\n\tbackgroundColor?: string;\n\t/**\n\t * The viewer look a definition opens in. A viewer can still switch look from its display menu.\n\t */\n\tlook?:\n\t\t'technical' | 'studio' | 'showcase' | 'arctic' | 'xray' | 'lineart' | 'wireframe' | 'night';\n}\nexport interface LocalOptions {\n\t/**\n\t * If true, geometry picked in the Rhino viewport follows the Rhino objects it came from: editing or moving one re-solves with its new shape, deleting one drops it. If false, a pick is a snapshot.\n\t */\n\ttrackPickedObjects?: boolean;\n}\nexport interface UISchema {\n\tid: string;\n\tname: string;\n\tdescription?: string;\n\t/**\n\t * Grasshopper document file name (e.g., 'myfile.gh')\n\t */\n\tprojectFileName?: string;\n\t/**\n\t * Grasshopper document unique identifier (GUID)\n\t */\n\tdocumentId?: string;\n\t/**\n\t * Version of Selva plugin that created/last modified this schema\n\t */\n\tpluginVersion?: string;\n\t/**\n\t * Tags for the Selva library (e.g., ['architecture', 'facade']). Selva copies them into the definition when it is uploaded; after that the definition's own tags win. At most MAX_TAGS, none containing a comma.\n\t */\n\ttags?: string[];\n\t/**\n\t * Category for the Selva library (e.g., 'architecture', 'structural'). Selva copies it into the definition when it is uploaded; after that the definition's own category wins. At most MAX_CATEGORY_LENGTH characters.\n\t */\n\tcategory?: string;\n\t/**\n\t * User or organization who created the schema\n\t */\n\tauthor?: string;\n\t/**\n\t * Organization/company name\n\t */\n\torganization?: string;\n\t/**\n\t * Semantic version of the schema format (MAJOR.MINOR.PATCH)\n\t */\n\tschemaVersion: string;\n\t/**\n\t * Minimum plugin version required to load this schema\n\t */\n\tminPluginVersion?: string;\n\tcreated?: string;\n\t/**\n\t * Last modification timestamp\n\t */\n\tlastModified?: string;\n\tviewerOptions?: ViewerOptions1;\n\tlocalOptions?: LocalOptions;\n\t/**\n\t * If true, changes trigger immediate solving. If false, user must press Calculate button.\n\t */\n\tinstanceSolve?: boolean;\n\tinputs: SchemaInput[];\n\t/**\n\t * All output components (print, bake, file download)\n\t */\n\toutputs: SchemaOutput[];\n\tlayout: LayoutConfig;\n\t/**\n\t * Icons and thumbnails referenced by optionMedia, keyed by a hash of their content so a shared one is stored once.\n\t */\n\tassets?: {\n\t\t[k: string]: OptionAsset | undefined;\n\t};\n}\n/**\n * Configuration for the 3D viewer\n */\nexport interface ViewerOptions1 {\n\t/**\n\t * If true, the plugin streams display meshes to its local web preview, which then shows the 3D viewer. Selva ignores it.\n\t */\n\tenableLocal?: boolean;\n\t/**\n\t * If true, Selva draws the display meshes in the Rhino.Compute response and shows the 3D viewer. The plugin's local preview ignores it.\n\t */\n\tenableRemote?: boolean;\n\t/**\n\t * Background color for the 3D viewer as hex string (e.g., '#ffffff')\n\t */\n\tbackgroundColor?: string;\n\t/**\n\t * The viewer look a definition opens in. A viewer can still switch look from its display menu.\n\t */\n\tlook?:\n\t\t'technical' | 'studio' | 'showcase' | 'arctic' | 'xray' | 'lineart' | 'wireframe' | 'night';\n}\n\n// ============================================================================\n// CONSTANTS (from schema)\n// ============================================================================\n\nexport const ACCEPTED_FILE_FORMATS = [\n\t'.3dm',\n\t'.stp',\n\t'.step',\n\t'.fbx',\n\t'.obj',\n\t'.dxf',\n\t'.stl'\n] as const;\nexport const MAX_TAGS = 5 as const;\nexport const MAX_CATEGORY_LENGTH = 40 as const;\n\n/** Current UISchema format version (from ui-schema.json's schemaVersion default). */\nexport const UI_SCHEMA_VERSION = '2.19.0';\n\n// ============================================================================\n// TYPE ALIASES AND GUARDS (derived from the LayoutItem union)\n// ============================================================================\n\nexport type InputLayoutItem =\n\t| InputNumberLayoutItem\n\t| InputTextLayoutItem\n\t| InputDropdownLayoutItem\n\t| InputDynamicValueListLayoutItem\n\t| InputCheckboxLayoutItem\n\t| InputFileLayoutItem\n\t| InputColorLayoutItem;\nexport type OutputLayoutItem =\n\t| OutputTextLayoutItem\n\t| OutputNumberLayoutItem\n\t| OutputFileLayoutItem\n\t| OutputChartLayoutItem\n\t| OutputImageLayoutItem\n\t| OutputDynamicValueListLayoutItem;\nexport type SupportedTypes = string | number | boolean | string[];\n\nexport function isInputLayoutItem(item: LayoutItem): item is InputLayoutItem {\n\treturn item.type === 'input';\n}\n\nexport function isOutputLayoutItem(item: LayoutItem): item is OutputLayoutItem {\n\treturn item.type === 'output';\n}\n\nexport function isLineBreakLayoutItem(item: LayoutItem): item is LineBreakLayoutItem {\n\treturn item.type === 'linebreak';\n}\n\nexport function isNumberWidget(item: LayoutItem): item is InputNumberLayoutItem {\n\treturn item.type === 'input' && item.widgetType === 'number';\n}\n\nexport function isTextWidget(item: LayoutItem): item is InputTextLayoutItem {\n\treturn item.type === 'input' && item.widgetType === 'text';\n}\n\nexport function isDropdownWidget(item: LayoutItem): item is InputDropdownLayoutItem {\n\treturn item.type === 'input' && item.widgetType === 'dropdown';\n}\n\nexport function isDynamicValueListWidget(\n\titem: LayoutItem\n): item is InputDynamicValueListLayoutItem {\n\treturn item.type === 'input' && item.widgetType === 'dynamicValueList';\n}\n\nexport function isCheckboxWidget(item: LayoutItem): item is InputCheckboxLayoutItem {\n\treturn item.type === 'input' && item.widgetType === 'checkbox';\n}\n\nexport function isFileWidget(item: LayoutItem): item is InputFileLayoutItem {\n\treturn item.type === 'input' && item.widgetType === 'file';\n}\n\nexport function isColorWidget(item: LayoutItem): item is InputColorLayoutItem {\n\treturn item.type === 'input' && item.widgetType === 'color';\n}\n\nexport function isTextOutputWidget(item: LayoutItem): item is OutputTextLayoutItem {\n\treturn item.type === 'output' && item.widgetType === 'text';\n}\n\nexport function isNumberOutputWidget(item: LayoutItem): item is OutputNumberLayoutItem {\n\treturn item.type === 'output' && item.widgetType === 'number';\n}\n\nexport function isFileOutputWidget(item: LayoutItem): item is OutputFileLayoutItem {\n\treturn item.type === 'output' && item.widgetType === 'file';\n}\n\nexport function isChartOutputWidget(item: LayoutItem): item is OutputChartLayoutItem {\n\treturn item.type === 'output' && item.widgetType === 'chart';\n}\n\nexport function isImageOutputWidget(item: LayoutItem): item is OutputImageLayoutItem {\n\treturn item.type === 'output' && item.widgetType === 'image';\n}\n\nexport function isDynamicValueListOutputWidget(\n\titem: LayoutItem\n): item is OutputDynamicValueListLayoutItem {\n\treturn item.type === 'output' && item.widgetType === 'dynamicValueList';\n}\n"],"mappings":";;AAukBA,IAAa,oBAAoB;AAmCjC,SAAgB,eAAe,MAAiD;CAC/E,OAAO,KAAK,SAAS,WAAW,KAAK,eAAe;AACrD;AAEA,SAAgB,aAAa,MAA+C;CAC3E,OAAO,KAAK,SAAS,WAAW,KAAK,eAAe;AACrD;AAEA,SAAgB,iBAAiB,MAAmD;CACnF,OAAO,KAAK,SAAS,WAAW,KAAK,eAAe;AACrD;AAEA,SAAgB,yBACf,MAC0C;CAC1C,OAAO,KAAK,SAAS,WAAW,KAAK,eAAe;AACrD;AAEA,SAAgB,iBAAiB,MAAmD;CACnF,OAAO,KAAK,SAAS,WAAW,KAAK,eAAe;AACrD;AAEA,SAAgB,aAAa,MAA+C;CAC3E,OAAO,KAAK,SAAS,WAAW,KAAK,eAAe;AACrD;AAEA,SAAgB,cAAc,MAAgD;CAC7E,OAAO,KAAK,SAAS,WAAW,KAAK,eAAe;AACrD"}
1
+ {"version":3,"file":"schema.js","names":[],"sources":["../../../../schemas/src/generated/schema.ts"],"sourcesContent":["/* eslint-disable */\n/**\n * This file was automatically generated from packages/schemas/ui-schema.json.\n * DO NOT MODIFY IT BY HAND. Instead, modify the source JSON Schema file\n * and run `pnpm generate` at the repo root to regenerate it.\n */\n\nexport type ParamType =\n\t| 'number'\n\t| 'integer'\n\t| 'boolean'\n\t| 'text'\n\t| 'valueList'\n\t| 'dynamicValueList'\n\t| 'file'\n\t| 'color'\n\t| 'generic'\n\t| 'geometry'\n\t| 'point'\n\t| 'line'\n\t| 'plane';\nexport type InputNumberLayoutItem = LayoutItemBase & {\n\ttype: 'input';\n\twidgetType: 'number';\n\tconfig?: NumberWidgetConfig;\n\t[k: string]: unknown | undefined;\n};\nexport type InputTextLayoutItem = LayoutItemBase & {\n\ttype: 'input';\n\twidgetType: 'text';\n\tconfig?: TextWidgetConfig;\n\t[k: string]: unknown | undefined;\n};\nexport type InputDropdownLayoutItem = LayoutItemBase & {\n\ttype: 'input';\n\twidgetType: 'dropdown';\n\tconfig: DropdownWidgetConfig;\n\t[k: string]: unknown | undefined;\n};\nexport type InputDynamicValueListLayoutItem = LayoutItemBase & {\n\ttype: 'input';\n\twidgetType: 'dynamicValueList';\n\tconfig?: DynamicValueListWidgetConfig;\n\t[k: string]: unknown | undefined;\n};\nexport type InputCheckboxLayoutItem = LayoutItemBase & {\n\ttype: 'input';\n\twidgetType: 'checkbox';\n\tconfig?: CheckboxWidgetConfig;\n\t[k: string]: unknown | undefined;\n};\nexport type InputFileLayoutItem = LayoutItemBase & {\n\ttype: 'input';\n\twidgetType: 'file';\n\tconfig?: FileInputWidgetConfig;\n\t[k: string]: unknown | undefined;\n};\nexport type InputColorLayoutItem = LayoutItemBase & {\n\ttype: 'input';\n\twidgetType: 'color';\n\tconfig?: ColorWidgetConfig;\n\t[k: string]: unknown | undefined;\n};\nexport type OutputTextLayoutItem = LayoutItemBase & {\n\ttype: 'output';\n\twidgetType: 'text';\n\t[k: string]: unknown | undefined;\n};\nexport type OutputNumberLayoutItem = LayoutItemBase & {\n\ttype: 'output';\n\twidgetType: 'number';\n\t[k: string]: unknown | undefined;\n};\nexport type OutputFileLayoutItem = LayoutItemBase & {\n\ttype: 'output';\n\twidgetType: 'file';\n\tconfig?: FileWidgetConfig;\n\t[k: string]: unknown | undefined;\n};\nexport type OutputChartLayoutItem = LayoutItemBase & {\n\ttype: 'output';\n\twidgetType: 'chart';\n\tconfig?: ChartWidgetConfig;\n\t[k: string]: unknown | undefined;\n};\nexport type OutputImageLayoutItem = LayoutItemBase & {\n\ttype: 'output';\n\twidgetType: 'image';\n\tconfig?: ImageWidgetConfig;\n\t[k: string]: unknown | undefined;\n};\nexport type OutputDynamicValueListLayoutItem = LayoutItemBase & {\n\ttype: 'output';\n\twidgetType: 'dynamicValueList';\n\tconfig: DynamicValueListOutputConfig;\n\t[k: string]: unknown | undefined;\n};\nexport type LayoutItem =\n\t| InputNumberLayoutItem\n\t| InputTextLayoutItem\n\t| InputDropdownLayoutItem\n\t| InputDynamicValueListLayoutItem\n\t| InputCheckboxLayoutItem\n\t| InputFileLayoutItem\n\t| InputColorLayoutItem\n\t| OutputTextLayoutItem\n\t| OutputNumberLayoutItem\n\t| OutputFileLayoutItem\n\t| OutputChartLayoutItem\n\t| OutputImageLayoutItem\n\t| OutputDynamicValueListLayoutItem\n\t| LineBreakLayoutItem;\nexport type LayoutConfig = TabbedLayoutConfig | FlatLayoutConfig;\nexport type InputStructure = 'item' | 'list' | 'tree';\n\n/**\n * Schema definitions for Selva UI configuration\n */\nexport interface SelvaUISchema {\n\t[k: string]: unknown | undefined;\n}\nexport interface VisibilityRule {\n\t/**\n\t * Parameter ID to watch for changes\n\t */\n\tparamId: string;\n\t/**\n\t * Comparison operator. 'contains', 'containsAny', 'isEmpty', 'isNotEmpty' apply to array-valued params (e.g., checklist value lists).\n\t */\n\toperator:\n\t\t| 'equals'\n\t\t| 'notEquals'\n\t\t| 'greaterThan'\n\t\t| 'lessThan'\n\t\t| 'greaterThanOrEqual'\n\t\t| 'lessThanOrEqual'\n\t\t| 'in'\n\t\t| 'notIn'\n\t\t| 'between'\n\t\t| 'matches'\n\t\t| 'contains'\n\t\t| 'containsAny'\n\t\t| 'isEmpty'\n\t\t| 'isNotEmpty';\n\t/**\n\t * Value to compare against (used for equals, notEquals, greaterThan, lessThan, greaterThanOrEqual, lessThanOrEqual)\n\t */\n\tvalue?: {\n\t\t[k: string]: unknown | undefined;\n\t};\n\t/**\n\t * Array of values (used for 'in', 'notIn' operators, or [min, max] for 'between')\n\t */\n\tvalues?: unknown[];\n}\nexport interface VisibilityCondition {\n\t/**\n\t * Evaluation mode: 'all' = AND (all rules must pass), 'any' = OR (at least one rule must pass)\n\t */\n\tmode?: 'all' | 'any';\n\t/**\n\t * List of rules to evaluate\n\t *\n\t * @minItems 1\n\t */\n\trules: [VisibilityRule, ...VisibilityRule[]];\n\t/**\n\t * Action to apply when condition is met: 'show' makes visible and enabled, 'hide' removes from view, 'disable' makes visible but greyed out and non-interactive\n\t */\n\taction?: 'show' | 'hide' | 'disable';\n\t/**\n\t * Default value to set for the parameter when condition is met. The value should be compatible with the parameter type (number, string, boolean, etc.)\n\t */\n\tdefaultValue?: {\n\t\t[k: string]: unknown | undefined;\n\t};\n}\nexport interface GroupVisibilityCondition {\n\t/**\n\t * Evaluation mode: 'all' = AND (all rules must pass), 'any' = OR (at least one rule must pass)\n\t */\n\tmode?: 'all' | 'any';\n\t/**\n\t * List of rules to evaluate\n\t *\n\t * @minItems 1\n\t */\n\trules: [VisibilityRule, ...VisibilityRule[]];\n\t/**\n\t * Action to apply when condition is met: 'show' makes group visible, 'hide' removes group from view\n\t */\n\taction?: 'show' | 'hide';\n}\nexport interface NumberWidgetConfig {\n\tminimum?: number;\n\tmaximum?: number;\n\tstepSize?: number;\n\tplaceholder?: string;\n\trenderAsSlider?: boolean;\n\t/**\n\t * Never show the min/max hint. Without it, a number box shows the hint beside its label while focused; sliders never show it.\n\t */\n\thideRange?: boolean;\n}\nexport interface TextWidgetConfig {\n\tplaceholder?: string;\n\trequired?: boolean;\n\t/**\n\t * Maximum character length for text input\n\t */\n\tmaxLength?: number;\n\t/**\n\t * Regex pattern for validation (e.g., email, phone)\n\t */\n\tpattern?: string;\n\t/**\n\t * Custom error message shown when pattern validation fails\n\t */\n\tcustomErrorMessage?: string;\n}\nexport interface OptionMedia {\n\t/**\n\t * Asset holding the option's icon (an OptionAsset with d).\n\t */\n\ticon?: string;\n\t/**\n\t * Asset holding the option's thumbnail (an OptionAsset with img).\n\t */\n\timage?: string;\n\t/**\n\t * Iconify name the icon was picked as (e.g. 'lucide:house'), so the builder can reopen the picker on it. Never rendered.\n\t */\n\ticonName?: string;\n}\nexport interface OptionAsset {\n\t/**\n\t * SVG path data on a 24x24 grid, drawn as a stroke (width 2, round caps and joins, no fill). Rendered as a path's d attribute, never as markup.\n\t */\n\td?: string;\n\t/**\n\t * Thumbnail as a base64 data URI. Only WebP, JPEG and PNG are accepted.\n\t */\n\timg?: string;\n\t/**\n\t * Thumbnail width in pixels\n\t */\n\tw?: number;\n\t/**\n\t * Thumbnail height in pixels\n\t */\n\th?: number;\n}\nexport interface DropdownWidgetConfig {\n\t/**\n\t * Key-value pairs for dropdown options\n\t */\n\toptions: {\n\t\t[k: string]: string | undefined;\n\t};\n\trequired?: boolean;\n\t/**\n\t * How to render the value list. 'dropdown' = single-select dropdown (value: string). 'checklist' = multi-select checkboxes (value: string[]); requires list access on the connected parameter. 'segmented' = single-select button row, shown as a dropdown when there are too many options to fit. 'tiles' = single-select grid of thumbnails.\n\t */\n\tdisplayAs?: 'dropdown' | 'checklist' | 'segmented' | 'tiles';\n\t/**\n\t * Icon and thumbnail per option, keyed by option name. Grasshopper owns options; this map is the author's and survives a re-sync.\n\t */\n\toptionMedia?: {\n\t\t[k: string]: OptionMedia | undefined;\n\t};\n}\nexport interface DynamicValueListWidgetConfig {\n\t/**\n\t * Author-provided seed list (name -> value). Shown until computed options replace it. Empty/absent means the input is empty until the first solve produces options.\n\t */\n\tdefaultOptions?: {\n\t\t[k: string]: string | undefined;\n\t};\n\t/**\n\t * What to render when there are no options yet (no defaultOptions and no computed options): 'hide' removes the field from view, 'show-empty' shows a disabled 'no options yet' control.\n\t */\n\temptyBehavior?: 'hide' | 'show-empty';\n\t/**\n\t * How to render the value list. 'dropdown' = single-select (value: string). 'checklist' = multi-select (value: string[]). 'segmented' = single-select button row, shown as a dropdown when there are too many options to fit. 'tiles' = single-select grid of thumbnails.\n\t */\n\tdisplayAs?: 'dropdown' | 'checklist' | 'segmented' | 'tiles';\n\t/**\n\t * Icon and thumbnail per option, keyed by option name. Names without an entry show text only.\n\t */\n\toptionMedia?: {\n\t\t[k: string]: OptionMedia | undefined;\n\t};\n}\nexport interface DynamicValueListOutputConfig {\n\t/**\n\t * The backend parameter's GUID (paramId) of the DynamicValueList input that this output's computed options populate.\n\t */\n\ttargetInputId: string;\n}\nexport interface CheckboxWidgetConfig {\n\t/**\n\t * 'checkbox' = a toggle whose value is sent with every solve. 'button' = a trigger: a press solves once with true, then the input goes back to false. A button holds no value in the form, so presets and value updates skip it.\n\t */\n\tdisplayAs?: 'checkbox' | 'button';\n}\nexport interface FileWidgetConfig {\n\tbuttonLabel?: string;\n\t/**\n\t * File format hint (e.g., '3dm') for setting download extension\n\t */\n\tfileFormat?: string;\n}\nexport interface FileInputWidgetConfig {\n\t/**\n\t * List of accepted file extensions (e.g., ['.3dm', '.step'])\n\t */\n\tacceptedFormats?: string[];\n\t/**\n\t * Which mode is active by default when both are allowed\n\t */\n\tdefaultInputMode?: 'upload' | 'url';\n\t/**\n\t * Which input modes the end user can choose from. If omitted, both are allowed.\n\t */\n\tallowedInputModes?: ('upload' | 'url')[];\n}\nexport interface ColorWidgetConfig {}\nexport interface LayoutItemBase {\n\t/**\n\t * Unique identifier for this layout item in the UI tree (not the parameter ID)\n\t */\n\tid: string;\n\t/**\n\t * References the backend parameter's GUID (Data Source)\n\t */\n\tparamId: string;\n\tdisplayName?: string;\n\tdescription?: string;\n\torder?: number;\n\tspan?: number;\n\t/**\n\t * Base visibility (static). If false, item is always hidden regardless of conditions.\n\t */\n\tvisible?: boolean;\n\tvisibilityCondition?: VisibilityCondition;\n\tsource?: InputSource;\n\t[k: string]: unknown | undefined;\n}\nexport interface InputSource {\n\t/**\n\t * Which data provider supplies the value. 'user' = the person types it into the form. 'client' = a browser app (e.g. a measurement/producer tool) fills it in before the form runs, not the person. 'server' = reserved for a server-side lookup that no host performs yet: the input solves with its default, a solve that posts a value for it is refused, and it is never shown in the form.\n\t */\n\tkind: 'user' | 'client' | 'server';\n\t/**\n\t * The address the host resolves to fill this input — opaque to Selva, interpreted by the host per 'kind'. For 'client' it names WHICH producer app supplies the value (e.g. 'line-app', 'file-upload') so the host pre-routes to it; for 'server' it names WHAT a resolver would fetch (e.g. 'capture.geometry'). Keys need not be unique: the same producer/fetch may fill several inputs. Ignored for kind='user'.\n\t */\n\tkey?: string;\n\t/**\n\t * How a client-sourced input appears in the form (only meaningful when kind='client'). Omitted = 'hidden': the value is prefilled silently and the input does not appear. 'slot' = Selva reserves the input's grid cell and lets the host render its own element there; Selva draws nothing itself and never interprets that element.\n\t */\n\tclient?: {\n\t\t/**\n\t\t * 'hidden' = no UI; the producer app prefills the value and the input does not appear. 'slot' = the host renders a custom element (e.g. an 'Edit JSON' button) in this input's place, referencing the producer named by 'key'.\n\t\t */\n\t\tpresentation?: 'hidden' | 'slot';\n\t};\n}\nexport interface ChartWidgetConfig {}\nexport interface ImageWidgetConfig {\n\t/**\n\t * Show a download button on the image viewer\n\t */\n\tallowDownload?: boolean;\n\t/**\n\t * Show a fullscreen toggle button on the image viewer\n\t */\n\tallowFullscreen?: boolean;\n\t/**\n\t * Optional background color shown behind the image (hex string, e.g. '#ffffff')\n\t */\n\tbackgroundColor?: string;\n}\nexport interface LineBreakLayoutItem {\n\t/**\n\t * Unique identifier for this layout item in the UI tree\n\t */\n\tid: string;\n\ttype: 'linebreak';\n}\nexport interface GroupConfig {\n\tid: string;\n\tlabel: string;\n\tdescription?: string;\n\torder?: number;\n\tcollapsed?: boolean;\n\tcolumns?: number;\n\titems: LayoutItem[];\n\tvisibilityCondition?: GroupVisibilityCondition;\n}\nexport interface TabConfig {\n\tid: string;\n\tlabel: string;\n\ticon?: string;\n\torder?: number;\n\tgroups: GroupConfig[];\n\t/**\n\t * Horizontal region where this tab should be positioned in multi-column layouts\n\t */\n\tposition?: 'left' | 'center' | 'right';\n\t/**\n\t * Base visibility (static). If false, the tab is always hidden. A tab whose groups are all hidden is hidden too.\n\t */\n\tvisible?: boolean;\n}\nexport interface TabbedLayoutConfig {\n\ttype: 'tabbed';\n\tgap?: number;\n\ttabs: TabConfig[];\n}\nexport interface FlatLayoutConfig {\n\ttype: 'flat';\n\tgap?: number;\n\tgroups: GroupConfig[];\n}\nexport interface SchemaInput {\n\t/**\n\t * Backend-specific parameter identifier (e.g. a Grasshopper InstanceGuid)\n\t */\n\tid: string;\n\tnickname: string;\n\tparamType: ParamType;\n\tdescription?: string;\n\tdefault?: unknown;\n\t/**\n\t * Data access mode: 'item' = single value, 'list' = flat list, 'tree' = branching data tree. Defaults to 'item'.\n\t */\n\tinputStructure?: 'item' | 'list' | 'tree';\n}\nexport interface SchemaOutput {\n\t/**\n\t * Backend-specific parameter identifier (e.g. a Grasshopper InstanceGuid)\n\t */\n\tid: string;\n\tnickname: string;\n\tdescription?: string;\n\t/**\n\t * Output display type\n\t */\n\ttype: 'text' | 'number' | 'file' | 'chart' | 'dynamicValueList';\n\t/**\n\t * For 'dynamicValueList' outputs: the instance GUID (paramId) of the DynamicValueList input that this output's computed options populate.\n\t */\n\ttargetInputId?: string;\n}\nexport interface ViewerOptions {\n\t/**\n\t * If true, the plugin streams display meshes to its local web preview, which then shows the 3D viewer. Selva ignores it.\n\t */\n\tenableLocal?: boolean;\n\t/**\n\t * If true, Selva draws the display meshes in the Rhino.Compute response and shows the 3D viewer. The plugin's local preview ignores it.\n\t */\n\tenableRemote?: boolean;\n\t/**\n\t * Background color for the 3D viewer as hex string (e.g., '#ffffff')\n\t */\n\tbackgroundColor?: string;\n\t/**\n\t * The viewer look a definition opens in. A viewer can still switch look from its display menu.\n\t */\n\tlook?:\n\t\t'technical' | 'studio' | 'showcase' | 'arctic' | 'xray' | 'lineart' | 'wireframe' | 'night';\n}\nexport interface LocalOptions {\n\t/**\n\t * If true, geometry picked in the Rhino viewport follows the Rhino objects it came from: editing or moving one re-solves with its new shape, deleting one drops it. If false, a pick is a snapshot.\n\t */\n\ttrackPickedObjects?: boolean;\n}\nexport interface UISchema {\n\tid: string;\n\tname: string;\n\tdescription?: string;\n\t/**\n\t * Grasshopper document file name (e.g., 'myfile.gh')\n\t */\n\tprojectFileName?: string;\n\t/**\n\t * Grasshopper document unique identifier (GUID)\n\t */\n\tdocumentId?: string;\n\t/**\n\t * Version of Selva plugin that created/last modified this schema\n\t */\n\tpluginVersion?: string;\n\t/**\n\t * Tags for the Selva library (e.g., ['architecture', 'facade']). Selva copies them into the definition when it is uploaded; after that the definition's own tags win. At most MAX_TAGS, none containing a comma.\n\t */\n\ttags?: string[];\n\t/**\n\t * Category for the Selva library (e.g., 'architecture', 'structural'). Selva copies it into the definition when it is uploaded; after that the definition's own category wins. At most MAX_CATEGORY_LENGTH characters.\n\t */\n\tcategory?: string;\n\t/**\n\t * User or organization who created the schema\n\t */\n\tauthor?: string;\n\t/**\n\t * Organization/company name\n\t */\n\torganization?: string;\n\t/**\n\t * Semantic version of the schema format (MAJOR.MINOR.PATCH)\n\t */\n\tschemaVersion: string;\n\t/**\n\t * Minimum plugin version required to load this schema\n\t */\n\tminPluginVersion?: string;\n\tcreated?: string;\n\t/**\n\t * Last modification timestamp\n\t */\n\tlastModified?: string;\n\tviewerOptions?: ViewerOptions1;\n\tlocalOptions?: LocalOptions;\n\t/**\n\t * If true, changes trigger immediate solving. If false, user must press Calculate button.\n\t */\n\tinstanceSolve?: boolean;\n\tinputs: SchemaInput[];\n\t/**\n\t * All output components (print, bake, file download)\n\t */\n\toutputs: SchemaOutput[];\n\tlayout: LayoutConfig;\n\t/**\n\t * Icons and thumbnails referenced by optionMedia, keyed by a hash of their content so a shared one is stored once.\n\t */\n\tassets?: {\n\t\t[k: string]: OptionAsset | undefined;\n\t};\n}\n/**\n * Configuration for the 3D viewer\n */\nexport interface ViewerOptions1 {\n\t/**\n\t * If true, the plugin streams display meshes to its local web preview, which then shows the 3D viewer. Selva ignores it.\n\t */\n\tenableLocal?: boolean;\n\t/**\n\t * If true, Selva draws the display meshes in the Rhino.Compute response and shows the 3D viewer. The plugin's local preview ignores it.\n\t */\n\tenableRemote?: boolean;\n\t/**\n\t * Background color for the 3D viewer as hex string (e.g., '#ffffff')\n\t */\n\tbackgroundColor?: string;\n\t/**\n\t * The viewer look a definition opens in. A viewer can still switch look from its display menu.\n\t */\n\tlook?:\n\t\t'technical' | 'studio' | 'showcase' | 'arctic' | 'xray' | 'lineart' | 'wireframe' | 'night';\n}\n\n// ============================================================================\n// CONSTANTS (from schema)\n// ============================================================================\n\nexport const ACCEPTED_FILE_FORMATS = [\n\t'.3dm',\n\t'.stp',\n\t'.step',\n\t'.fbx',\n\t'.obj',\n\t'.dxf',\n\t'.stl'\n] as const;\nexport const MAX_TAGS = 5 as const;\nexport const MAX_CATEGORY_LENGTH = 40 as const;\n\n/** Current UISchema format version (from ui-schema.json's schemaVersion default). */\nexport const UI_SCHEMA_VERSION = '2.19.0';\n\n// ============================================================================\n// TYPE ALIASES AND GUARDS (derived from the LayoutItem union)\n// ============================================================================\n\nexport type InputLayoutItem =\n\t| InputNumberLayoutItem\n\t| InputTextLayoutItem\n\t| InputDropdownLayoutItem\n\t| InputDynamicValueListLayoutItem\n\t| InputCheckboxLayoutItem\n\t| InputFileLayoutItem\n\t| InputColorLayoutItem;\nexport type OutputLayoutItem =\n\t| OutputTextLayoutItem\n\t| OutputNumberLayoutItem\n\t| OutputFileLayoutItem\n\t| OutputChartLayoutItem\n\t| OutputImageLayoutItem\n\t| OutputDynamicValueListLayoutItem;\nexport type SupportedTypes = string | number | boolean | string[];\n\nexport function isInputLayoutItem(item: LayoutItem): item is InputLayoutItem {\n\treturn item.type === 'input';\n}\n\nexport function isOutputLayoutItem(item: LayoutItem): item is OutputLayoutItem {\n\treturn item.type === 'output';\n}\n\nexport function isLineBreakLayoutItem(item: LayoutItem): item is LineBreakLayoutItem {\n\treturn item.type === 'linebreak';\n}\n\nexport function isNumberWidget(item: LayoutItem): item is InputNumberLayoutItem {\n\treturn item.type === 'input' && item.widgetType === 'number';\n}\n\nexport function isTextWidget(item: LayoutItem): item is InputTextLayoutItem {\n\treturn item.type === 'input' && item.widgetType === 'text';\n}\n\nexport function isDropdownWidget(item: LayoutItem): item is InputDropdownLayoutItem {\n\treturn item.type === 'input' && item.widgetType === 'dropdown';\n}\n\nexport function isDynamicValueListWidget(\n\titem: LayoutItem\n): item is InputDynamicValueListLayoutItem {\n\treturn item.type === 'input' && item.widgetType === 'dynamicValueList';\n}\n\nexport function isCheckboxWidget(item: LayoutItem): item is InputCheckboxLayoutItem {\n\treturn item.type === 'input' && item.widgetType === 'checkbox';\n}\n\nexport function isFileWidget(item: LayoutItem): item is InputFileLayoutItem {\n\treturn item.type === 'input' && item.widgetType === 'file';\n}\n\nexport function isColorWidget(item: LayoutItem): item is InputColorLayoutItem {\n\treturn item.type === 'input' && item.widgetType === 'color';\n}\n\nexport function isTextOutputWidget(item: LayoutItem): item is OutputTextLayoutItem {\n\treturn item.type === 'output' && item.widgetType === 'text';\n}\n\nexport function isNumberOutputWidget(item: LayoutItem): item is OutputNumberLayoutItem {\n\treturn item.type === 'output' && item.widgetType === 'number';\n}\n\nexport function isFileOutputWidget(item: LayoutItem): item is OutputFileLayoutItem {\n\treturn item.type === 'output' && item.widgetType === 'file';\n}\n\nexport function isChartOutputWidget(item: LayoutItem): item is OutputChartLayoutItem {\n\treturn item.type === 'output' && item.widgetType === 'chart';\n}\n\nexport function isImageOutputWidget(item: LayoutItem): item is OutputImageLayoutItem {\n\treturn item.type === 'output' && item.widgetType === 'image';\n}\n\nexport function isDynamicValueListOutputWidget(\n\titem: LayoutItem\n): item is OutputDynamicValueListLayoutItem {\n\treturn item.type === 'output' && item.widgetType === 'dynamicValueList';\n}\n"],"mappings":";;AAukBA,IAAa,oBAAoB;AAmCjC,SAAgB,eAAe,MAAiD;CAC/E,OAAO,KAAK,SAAS,WAAW,KAAK,eAAe;AACrD;AAEA,SAAgB,aAAa,MAA+C;CAC3E,OAAO,KAAK,SAAS,WAAW,KAAK,eAAe;AACrD;AAEA,SAAgB,iBAAiB,MAAmD;CACnF,OAAO,KAAK,SAAS,WAAW,KAAK,eAAe;AACrD;AAEA,SAAgB,yBACf,MAC0C;CAC1C,OAAO,KAAK,SAAS,WAAW,KAAK,eAAe;AACrD;AAEA,SAAgB,iBAAiB,MAAmD;CACnF,OAAO,KAAK,SAAS,WAAW,KAAK,eAAe;AACrD;AAEA,SAAgB,aAAa,MAA+C;CAC3E,OAAO,KAAK,SAAS,WAAW,KAAK,eAAe;AACrD;AAEA,SAAgB,cAAc,MAAgD;CAC7E,OAAO,KAAK,SAAS,WAAW,KAAK,eAAe;AACrD"}
@@ -1,66 +1,17 @@
1
1
  import { z } from "zod";
2
- var RESERVED_SLUG_SET = /* @__PURE__ */ new Set([
3
- "o",
4
- "api",
5
- "admin",
6
- "auth",
7
- "login",
8
- "logout",
9
- "setup",
10
- "team",
11
- "library",
12
- "projects",
13
- "accept-invite",
14
- "docs",
15
- "mcp",
16
- "oauth"
17
- ]);
18
- /**
19
- * Coerces an arbitrary name into a slug candidate. Does not guarantee a valid
20
- * slug — an all-symbols name yields `''`, and reserved words pass through
21
- * untouched — run the result through `SlugSchema` where validity matters.
22
- */
23
- function slugify(name) {
24
- return name.normalize("NFKD").replace(/\p{M}/gu, "").trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").slice(0, 63).replace(/^-+|-+$/g, "");
25
- }
26
- /** A slug for an org named without a slug of its own. Always passes `SlugSchema`. */
27
- function orgSlugFromName(name, fallback = "default") {
28
- const slug = slugify(name);
29
- if (slug.length < 3) return fallback;
30
- return RESERVED_SLUG_SET.has(slug) ? `${slug}-org` : slug;
2
+ // ../platform/src/definitions/schemas.ts
3
+ var UUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
4
+ var GuidSchema = z.string().toLowerCase().regex(UUID_REGEX, "Invalid GUID format");
5
+ /** A Grasshopper document GUID as stores keep and compare it (lowercase), or null for anything else. */
6
+ function toSourceDocumentId(value) {
7
+ return typeof value === "string" && UUID_REGEX.test(value) ? value.toLowerCase() : null;
31
8
  }
32
- /** Lowercase alphanumeric with internal hyphens, 3–63 chars, not a reserved word. */
33
- var SlugSchema = z.string().min(3, "Slug must be at least 3 characters").max(63, "Slug must be at most 63 characters").regex(/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/, "Slug must be lowercase alphanumeric with hyphens (no leading or trailing hyphen)").refine((s) => !RESERVED_SLUG_SET.has(s), { message: "Slug is reserved and cannot be used" });
34
- var OrgRoleSchema = z.enum([
35
- "owner",
36
- "admin",
37
- "member"
38
- ]);
39
- /** Kinds of org-scoped branding asset. Adding a kind is a single entry here — path, upload route, store, and UI are all generic over it. */
40
- var OrgAssetKindSchema = z.enum(["logo", "favicon"]);
41
- var ALL_ORG_ASSET_KINDS = OrgAssetKindSchema.options;
42
- /** Org-scope permissions. A user may hold different sets in different orgs. */
43
- var OrgPermissionSchema = z.enum([
44
- "manage_org_members",
45
- "manage_org_compute",
46
- "manage_definitions",
47
- "manage_projects"
9
+ var DefinitionStatusSchema = z.enum([
10
+ "draft",
11
+ "published",
12
+ "archived"
48
13
  ]);
49
- var ALL_ORG_PERMISSIONS = OrgPermissionSchema.options;
50
- /** Governance perms — never grantable to `member`. */
51
- var OWNER_ADMIN_ONLY_PERMISSIONS = ["manage_org_members", "manage_org_compute"];
52
- var MEMBER_ASSIGNABLE_PERMISSIONS = ALL_ORG_PERMISSIONS.filter((p) => !OWNER_ADMIN_ONLY_PERMISSIONS.includes(p));
53
- /** Applied when adding a member without an explicit permissions list. */
54
- var DEFAULT_ORG_PERMISSIONS = {
55
- owner: [...ALL_ORG_PERMISSIONS],
56
- admin: [...ALL_ORG_PERMISSIONS],
57
- member: []
58
- };
59
- var CreateOrgSchema = z.object({
60
- name: z.string().trim().min(1, "Organization name is required").max(128),
61
- slug: SlugSchema
62
- });
63
- var UpdateOrgSchema = CreateOrgSchema.partial();
64
- export { MEMBER_ASSIGNABLE_PERMISSIONS as a, OrgPermissionSchema as c, orgSlugFromName as d, slugify as f, DEFAULT_ORG_PERMISSIONS as i, OrgRoleSchema as l, ALL_ORG_PERMISSIONS as n, OWNER_ADMIN_ONLY_PERMISSIONS as o, CreateOrgSchema as r, OrgAssetKindSchema as s, ALL_ORG_ASSET_KINDS as t, UpdateOrgSchema as u };
14
+ var DefinitionChannelSchema = z.enum(["live", "draft"]);
15
+ export { toSourceDocumentId as a, UUID_REGEX as i, DefinitionStatusSchema as n, GuidSchema as r, DefinitionChannelSchema as t };
65
16
 
66
17
  //# sourceMappingURL=schemas.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.js","names":[],"sources":["../../../../platform/src/organizations/schemas.ts"],"sourcesContent":["import { z } from 'zod';\n\n/**\n * Top-level path segments a tenant slug must never equal, so a slug can never\n * shadow (or be shadowed by) a route. `o` is reserved for `/o/{slug}/` even though\n * the length gate below already makes a 1-char slug impossible.\n * `reserved-slugs.test.ts` in the selva app holds this to the route tree.\n */\nexport const RESERVED_SLUGS: readonly string[] = [\n\t'o',\n\t'api',\n\t'admin',\n\t'auth',\n\t'login',\n\t'logout',\n\t'setup',\n\t'team',\n\t'library',\n\t'projects',\n\t'accept-invite',\n\t'docs',\n\t'mcp',\n\t'oauth'\n];\n\nconst RESERVED_SLUG_SET = new Set(RESERVED_SLUGS);\n\n/**\n * Coerces an arbitrary name into a slug candidate. Does not guarantee a valid\n * slug — an all-symbols name yields `''`, and reserved words pass through\n * untouched — run the result through `SlugSchema` where validity matters.\n */\nexport function slugify(name: string): string {\n\treturn name\n\t\t.normalize('NFKD')\n\t\t.replace(/\\p{M}/gu, '')\n\t\t.trim()\n\t\t.toLowerCase()\n\t\t.replace(/[^a-z0-9]+/g, '-')\n\t\t.slice(0, 63)\n\t\t.replace(/^-+|-+$/g, '');\n}\n\n/** A slug for an org named without a slug of its own. Always passes `SlugSchema`. */\nexport function orgSlugFromName(name: string, fallback = 'default'): string {\n\tconst slug = slugify(name);\n\tif (slug.length < 3) return fallback;\n\treturn RESERVED_SLUG_SET.has(slug) ? `${slug}-org` : slug;\n}\n\n/** Lowercase alphanumeric with internal hyphens, 3–63 chars, not a reserved word. */\nexport const SlugSchema = z\n\t.string()\n\t.min(3, 'Slug must be at least 3 characters')\n\t.max(63, 'Slug must be at most 63 characters')\n\t.regex(\n\t\t/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/,\n\t\t'Slug must be lowercase alphanumeric with hyphens (no leading or trailing hyphen)'\n\t)\n\t.refine((s) => !RESERVED_SLUG_SET.has(s), {\n\t\tmessage: 'Slug is reserved and cannot be used'\n\t});\n\nexport const OrgRoleSchema = z.enum(['owner', 'admin', 'member']);\nexport type OrgRole = z.infer<typeof OrgRoleSchema>;\n\n/** Kinds of org-scoped branding asset. Adding a kind is a single entry here — path, upload route, store, and UI are all generic over it. */\nexport const OrgAssetKindSchema = z.enum(['logo', 'favicon']);\nexport type OrgAssetKind = z.infer<typeof OrgAssetKindSchema>;\n\nexport const ALL_ORG_ASSET_KINDS: readonly OrgAssetKind[] = OrgAssetKindSchema.options;\n\n/** Org-scope permissions. A user may hold different sets in different orgs. */\nexport const OrgPermissionSchema = z.enum([\n\t'manage_org_members',\n\t'manage_org_compute',\n\t'manage_definitions',\n\t'manage_projects'\n]);\nexport type OrgPermission = z.infer<typeof OrgPermissionSchema>;\n\nexport const ALL_ORG_PERMISSIONS: readonly OrgPermission[] = OrgPermissionSchema.options;\n\n/** Governance perms — never grantable to `member`. */\nexport const OWNER_ADMIN_ONLY_PERMISSIONS: readonly OrgPermission[] = [\n\t'manage_org_members',\n\t'manage_org_compute'\n];\n\nexport const MEMBER_ASSIGNABLE_PERMISSIONS: readonly OrgPermission[] = ALL_ORG_PERMISSIONS.filter(\n\t(p) => !OWNER_ADMIN_ONLY_PERMISSIONS.includes(p)\n);\n\n/** Applied when adding a member without an explicit permissions list. */\nexport const DEFAULT_ORG_PERMISSIONS: Record<OrgRole, readonly OrgPermission[]> = {\n\towner: [...ALL_ORG_PERMISSIONS],\n\tadmin: [...ALL_ORG_PERMISSIONS],\n\tmember: []\n};\n\nexport const CreateOrgSchema = z.object({\n\tname: z.string().trim().min(1, 'Organization name is required').max(128),\n\tslug: SlugSchema\n});\n\nexport const UpdateOrgSchema = CreateOrgSchema.partial();\n\nexport type CreateOrgInput = z.infer<typeof CreateOrgSchema>;\nexport type UpdateOrgInput = z.infer<typeof UpdateOrgSchema>;\n"],"mappings":";AAyBA,IAAM,oCAAoB,IAAI,IAAI;CAhBjC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AAGiC,CAAc;;;;;;AAOhD,SAAgB,QAAQ,MAAsB;CAC7C,OAAO,KACL,UAAU,MAAM,CAAC,CACjB,QAAQ,WAAW,EAAE,CAAC,CACtB,KAAK,CAAC,CACN,YAAY,CAAC,CACb,QAAQ,eAAe,GAAG,CAAC,CAC3B,MAAM,GAAG,EAAE,CAAC,CACZ,QAAQ,YAAY,EAAE;AACzB;;AAGA,SAAgB,gBAAgB,MAAc,WAAW,WAAmB;CAC3E,MAAM,OAAO,QAAQ,IAAI;CACzB,IAAI,KAAK,SAAS,GAAG,OAAO;CAC5B,OAAO,kBAAkB,IAAI,IAAI,IAAI,GAAG,KAAK,QAAQ;AACtD;;AAGA,IAAa,aAAa,EACxB,OAAO,CAAC,CACR,IAAI,GAAG,oCAAoC,CAAC,CAC5C,IAAI,IAAI,oCAAoC,CAAC,CAC7C,MACA,mCACA,kFACD,CAAC,CACA,QAAQ,MAAM,CAAC,kBAAkB,IAAI,CAAC,GAAG,EACzC,SAAS,sCACV,CAAC;AAEF,IAAa,gBAAgB,EAAE,KAAK;CAAC;CAAS;CAAS;AAAQ,CAAC;;AAIhE,IAAa,qBAAqB,EAAE,KAAK,CAAC,QAAQ,SAAS,CAAC;AAG5D,IAAa,sBAA+C,mBAAmB;;AAG/E,IAAa,sBAAsB,EAAE,KAAK;CACzC;CACA;CACA;CACA;AACD,CAAC;AAGD,IAAa,sBAAgD,oBAAoB;;AAGjF,IAAa,+BAAyD,CACrE,sBACA,oBACD;AAEA,IAAa,gCAA0D,oBAAoB,QACzF,MAAM,CAAC,6BAA6B,SAAS,CAAC,CAChD;;AAGA,IAAa,0BAAqE;CACjF,OAAO,CAAC,GAAG,mBAAmB;CAC9B,OAAO,CAAC,GAAG,mBAAmB;CAC9B,QAAQ,CAAC;AACV;AAEA,IAAa,kBAAkB,EAAE,OAAO;CACvC,MAAM,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,GAAG,+BAA+B,CAAC,CAAC,IAAI,GAAG;CACvE,MAAM;AACP,CAAC;AAED,IAAa,kBAAkB,gBAAgB,QAAQ"}
1
+ {"version":3,"file":"schemas.js","names":[],"sources":["../../../../platform/src/definitions/schemas.ts"],"sourcesContent":["import { z } from 'zod';\n\nexport const UUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\n\n// Load-bearing beyond format: the stores index plain objects by guid, so this\n// regex is what keeps `__proto__` and `constructor` out of a key position.\n// Relaxing it to a looser string re-opens prototype pollution in every store\n// that does `config.definitions[guid]`.\n//\n// Lowercases because local keys by raw string while Postgres compares `uuid`\n// columns case-insensitively, so one GUID in two cases is two records on local.\nexport const GuidSchema = z.string().toLowerCase().regex(UUID_REGEX, 'Invalid GUID format');\n\n/** A Grasshopper document GUID as stores keep and compare it (lowercase), or null for anything else. */\nexport function toSourceDocumentId(value: unknown): string | null {\n\treturn typeof value === 'string' && UUID_REGEX.test(value) ? value.toLowerCase() : null;\n}\n\n// Leaves out `pending`, which `DefinitionStatus` adds: the create path writes it while\n// the first blob upload is in flight, and a client must never set it through an update.\nexport const DefinitionStatusSchema = z.enum(['draft', 'published', 'archived']);\n\nexport const DefinitionChannelSchema = z.enum(['live', 'draft']);\n"],"mappings":";;AAEA,IAAa,aAAa;AAS1B,IAAa,aAAa,EAAE,OAAO,CAAC,CAAC,YAAY,CAAC,CAAC,MAAM,YAAY,qBAAqB;;AAG1F,SAAgB,mBAAmB,OAA+B;CACjE,OAAO,OAAO,UAAU,YAAY,WAAW,KAAK,KAAK,IAAI,MAAM,YAAY,IAAI;AACpF;AAIA,IAAa,yBAAyB,EAAE,KAAK;CAAC;CAAS;CAAa;AAAU,CAAC;AAE/E,IAAa,0BAA0B,EAAE,KAAK,CAAC,QAAQ,OAAO,CAAC"}
@@ -0,0 +1,80 @@
1
+ import { z } from "zod";
2
+ var RESERVED_SLUG_SET = /* @__PURE__ */ new Set([
3
+ "o",
4
+ "api",
5
+ "admin",
6
+ "auth",
7
+ "login",
8
+ "logout",
9
+ "setup",
10
+ "team",
11
+ "library",
12
+ "projects",
13
+ "accept-invite",
14
+ "docs",
15
+ "mcp",
16
+ "oauth"
17
+ ]);
18
+ var LATIN_FOLDS = {
19
+ ß: "ss",
20
+ æ: "ae",
21
+ œ: "oe",
22
+ ø: "o",
23
+ ł: "l",
24
+ đ: "d",
25
+ þ: "th"
26
+ };
27
+ var LATIN_FOLD_CHARS = new RegExp(`[${Object.keys(LATIN_FOLDS).join("")}]`, "g");
28
+ /**
29
+ * Coerces an arbitrary name into a slug candidate. Does not guarantee a valid
30
+ * slug — an all-symbols name yields `''`, and reserved words pass through
31
+ * untouched — run the result through `SlugSchema` where validity matters.
32
+ */
33
+ function slugify(name) {
34
+ return name.normalize("NFKD").replace(/\p{M}/gu, "").trim().toLowerCase().replace(LATIN_FOLD_CHARS, (c) => LATIN_FOLDS[c] ?? c).replace(/[^a-z0-9]+/g, "-").slice(0, 63).replace(/^-+|-+$/g, "");
35
+ }
36
+ /**
37
+ * A slug for an org named without a slug of its own. Always passes `SlugSchema`;
38
+ * throws if `fallback` doesn't.
39
+ */
40
+ function orgSlugFromName(name, fallback = "default") {
41
+ if (!SlugSchema.safeParse(fallback).success) throw new Error(`Invalid fallback slug: ${JSON.stringify(fallback)}`);
42
+ const slug = slugify(name);
43
+ if (slug.length < 3) return fallback;
44
+ return RESERVED_SLUG_SET.has(slug) ? `${slug}-org` : slug;
45
+ }
46
+ /** Lowercase alphanumeric with internal hyphens, 3–63 chars, not a reserved word. */
47
+ var SlugSchema = z.string().min(3, "Slug must be at least 3 characters").max(63, "Slug must be at most 63 characters").regex(/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/, "Slug must be lowercase alphanumeric with hyphens (no leading or trailing hyphen)").refine((s) => !RESERVED_SLUG_SET.has(s), { message: "Slug is reserved and cannot be used" });
48
+ var OrgRoleSchema = z.enum([
49
+ "owner",
50
+ "admin",
51
+ "member"
52
+ ]);
53
+ /** Kinds of org-scoped branding asset. Adding a kind is a single entry here — path, upload route, store, and UI are all generic over it. */
54
+ var OrgAssetKindSchema = z.enum(["logo", "favicon"]);
55
+ var ALL_ORG_ASSET_KINDS = OrgAssetKindSchema.options;
56
+ /** Org-scope permissions. A user may hold different sets in different orgs. */
57
+ var OrgPermissionSchema = z.enum([
58
+ "manage_org_members",
59
+ "manage_org_compute",
60
+ "manage_definitions",
61
+ "manage_projects"
62
+ ]);
63
+ var ALL_ORG_PERMISSIONS = OrgPermissionSchema.options;
64
+ /** Governance perms — never grantable to `member`. */
65
+ var OWNER_ADMIN_ONLY_PERMISSIONS = ["manage_org_members", "manage_org_compute"];
66
+ var MEMBER_ASSIGNABLE_PERMISSIONS = ALL_ORG_PERMISSIONS.filter((p) => !OWNER_ADMIN_ONLY_PERMISSIONS.includes(p));
67
+ /** Applied when adding a member without an explicit permissions list. */
68
+ var DEFAULT_ORG_PERMISSIONS = {
69
+ owner: [...ALL_ORG_PERMISSIONS],
70
+ admin: [...ALL_ORG_PERMISSIONS],
71
+ member: []
72
+ };
73
+ var CreateOrgSchema = z.object({
74
+ name: z.string().trim().min(1, "Organization name is required").max(128).refine((s) => /[^\s\p{Cf}]/u.test(s), "Organization name is required"),
75
+ slug: SlugSchema
76
+ });
77
+ var UpdateOrgSchema = CreateOrgSchema.partial();
78
+ export { MEMBER_ASSIGNABLE_PERMISSIONS as a, OrgPermissionSchema as c, orgSlugFromName as d, slugify as f, DEFAULT_ORG_PERMISSIONS as i, OrgRoleSchema as l, ALL_ORG_PERMISSIONS as n, OWNER_ADMIN_ONLY_PERMISSIONS as o, CreateOrgSchema as r, OrgAssetKindSchema as s, ALL_ORG_ASSET_KINDS as t, UpdateOrgSchema as u };
79
+
80
+ //# sourceMappingURL=schemas2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas2.js","names":[],"sources":["../../../../platform/src/organizations/schemas.ts"],"sourcesContent":["import { z } from 'zod';\n\n/**\n * Top-level path segments a tenant slug must never equal, so a slug can never\n * shadow (or be shadowed by) a route. `o` is reserved for `/o/{slug}/` even though\n * the length gate below already makes a 1-char slug impossible.\n * `reserved-slugs.test.ts` in the selva app holds this to the route tree.\n */\nexport const RESERVED_SLUGS: readonly string[] = [\n\t'o',\n\t'api',\n\t'admin',\n\t'auth',\n\t'login',\n\t'logout',\n\t'setup',\n\t'team',\n\t'library',\n\t'projects',\n\t'accept-invite',\n\t'docs',\n\t'mcp',\n\t'oauth'\n];\n\nconst RESERVED_SLUG_SET = new Set(RESERVED_SLUGS);\n\n// Latin letters NFKD leaves whole, so stripping marks can't fold them.\nconst LATIN_FOLDS: Record<string, string> = {\n\tß: 'ss',\n\tæ: 'ae',\n\tœ: 'oe',\n\tø: 'o',\n\tł: 'l',\n\tđ: 'd',\n\tþ: 'th'\n};\nconst LATIN_FOLD_CHARS = new RegExp(`[${Object.keys(LATIN_FOLDS).join('')}]`, 'g');\n\n/**\n * Coerces an arbitrary name into a slug candidate. Does not guarantee a valid\n * slug — an all-symbols name yields `''`, and reserved words pass through\n * untouched — run the result through `SlugSchema` where validity matters.\n */\nexport function slugify(name: string): string {\n\treturn name\n\t\t.normalize('NFKD')\n\t\t.replace(/\\p{M}/gu, '')\n\t\t.trim()\n\t\t.toLowerCase()\n\t\t.replace(LATIN_FOLD_CHARS, (c) => LATIN_FOLDS[c] ?? c)\n\t\t.replace(/[^a-z0-9]+/g, '-')\n\t\t.slice(0, 63)\n\t\t.replace(/^-+|-+$/g, '');\n}\n\n/**\n * A slug for an org named without a slug of its own. Always passes `SlugSchema`;\n * throws if `fallback` doesn't.\n */\nexport function orgSlugFromName(name: string, fallback = 'default'): string {\n\tif (!SlugSchema.safeParse(fallback).success) {\n\t\tthrow new Error(`Invalid fallback slug: ${JSON.stringify(fallback)}`);\n\t}\n\tconst slug = slugify(name);\n\tif (slug.length < 3) return fallback;\n\treturn RESERVED_SLUG_SET.has(slug) ? `${slug}-org` : slug;\n}\n\n/** Lowercase alphanumeric with internal hyphens, 3–63 chars, not a reserved word. */\nexport const SlugSchema = z\n\t.string()\n\t.min(3, 'Slug must be at least 3 characters')\n\t.max(63, 'Slug must be at most 63 characters')\n\t.regex(\n\t\t/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/,\n\t\t'Slug must be lowercase alphanumeric with hyphens (no leading or trailing hyphen)'\n\t)\n\t.refine((s) => !RESERVED_SLUG_SET.has(s), {\n\t\tmessage: 'Slug is reserved and cannot be used'\n\t});\n\nexport const OrgRoleSchema = z.enum(['owner', 'admin', 'member']);\nexport type OrgRole = z.infer<typeof OrgRoleSchema>;\n\n/** Kinds of org-scoped branding asset. Adding a kind is a single entry here — path, upload route, store, and UI are all generic over it. */\nexport const OrgAssetKindSchema = z.enum(['logo', 'favicon']);\nexport type OrgAssetKind = z.infer<typeof OrgAssetKindSchema>;\n\nexport const ALL_ORG_ASSET_KINDS: readonly OrgAssetKind[] = OrgAssetKindSchema.options;\n\n/** Org-scope permissions. A user may hold different sets in different orgs. */\nexport const OrgPermissionSchema = z.enum([\n\t'manage_org_members',\n\t'manage_org_compute',\n\t'manage_definitions',\n\t'manage_projects'\n]);\nexport type OrgPermission = z.infer<typeof OrgPermissionSchema>;\n\nexport const ALL_ORG_PERMISSIONS: readonly OrgPermission[] = OrgPermissionSchema.options;\n\n/** Governance perms — never grantable to `member`. */\nexport const OWNER_ADMIN_ONLY_PERMISSIONS: readonly OrgPermission[] = [\n\t'manage_org_members',\n\t'manage_org_compute'\n];\n\nexport const MEMBER_ASSIGNABLE_PERMISSIONS: readonly OrgPermission[] = ALL_ORG_PERMISSIONS.filter(\n\t(p) => !OWNER_ADMIN_ONLY_PERMISSIONS.includes(p)\n);\n\n/** Applied when adding a member without an explicit permissions list. */\nexport const DEFAULT_ORG_PERMISSIONS: Record<OrgRole, readonly OrgPermission[]> = {\n\towner: [...ALL_ORG_PERMISSIONS],\n\tadmin: [...ALL_ORG_PERMISSIONS],\n\tmember: []\n};\n\nexport const CreateOrgSchema = z.object({\n\tname: z\n\t\t.string()\n\t\t.trim()\n\t\t.min(1, 'Organization name is required')\n\t\t.max(128)\n\t\t// `trim()` leaves zero-width characters (format class), which render as nothing.\n\t\t.refine((s) => /[^\\s\\p{Cf}]/u.test(s), 'Organization name is required'),\n\tslug: SlugSchema\n});\n\nexport const UpdateOrgSchema = CreateOrgSchema.partial();\n\nexport type CreateOrgInput = z.infer<typeof CreateOrgSchema>;\nexport type UpdateOrgInput = z.infer<typeof UpdateOrgSchema>;\n"],"mappings":";AAyBA,IAAM,oCAAoB,IAAI,IAAI;CA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sB,EAAE,KAAK;CACzC;CACA;CACA;CACA;AACD,CAAC;AAGD,IAAa,sBAAgD,oBAAoB;;AAGjF,IAAa,+BAAyD,CACrE,sBACA,oBACD;AAEA,IAAa,gCAA0D,oBAAoB,QACzF,MAAM,CAAC,6BAA6B,SAAS,CAAC,CAChD;;AAGA,IAAa,0BAAqE;CACjF,OAAO,CAAC,GAAG,mBAAmB;CAC9B,OAAO,CAAC,GAAG,mBAAmB;CAC9B,QAAQ,CAAC;AACV;AAEA,IAAa,kBAAkB,EAAE,OAAO;CACvC,MAAM,EACJ,OAAO,CAAC,CACR,KAAK,CAAC,CACN,IAAI,GAAG,+BAA+B,CAAC,CACvC,IAAI,GAAG,CAAC,CAER,QAAQ,MAAM,eAAe,KAAK,CAAC,GAAG,+BAA+B;CACvE,MAAM;AACP,CAAC;AAED,IAAa,kBAAkB,gBAAgB,QAAQ"}
@@ -1,5 +1,6 @@
1
- import { M as isEncryptedSecret, V as GuidSchema } from "./providers.server.js";
2
- import { A as apiError, k as ApiErrorCode } from "./access.js";
1
+ import { R as isEncryptedSecret } from "./providers.server.js";
2
+ import { A as apiError, it as trimTrailing, k as ApiErrorCode } from "./access.js";
3
+ import { r as GuidSchema } from "./schemas.js";
3
4
  import { n as isLinkLocalUrl } from "./safe-url.js";
4
5
  // ../server/src/compute/evict-changed-servers.ts
5
6
  /**
@@ -16,12 +17,6 @@ function evictChangedServers(prev, next, evict) {
16
17
  if (before && (before.serverUrl !== after.serverUrl || before.apiKey !== after.apiKey)) evict(after.id);
17
18
  }
18
19
  }
19
- // ../server/src/compute/trim.ts
20
- function trimTrailing(s, ch) {
21
- let end = s.length;
22
- while (end > 0 && s[end - 1] === ch) end--;
23
- return s.slice(0, end);
24
- }
25
20
  // ../server/src/compute/server-config-write.ts
26
21
  /**
27
22
  * Shared write-path rules for compute server config.
@@ -1 +1 @@
1
- {"version":3,"file":"server-config-write.js","names":[],"sources":["../../../../server/src/compute/evict-changed-servers.ts","../../../../server/src/compute/trim.ts","../../../../server/src/compute/server-config-write.ts"],"sourcesContent":["/**\n * A warm compute client caches on server `id`, so a rotated `serverUrl`/`apiKey`\n * keeps the same cache key with stale connection details — it never ages out on\n * its own. The config-write path has to evict explicitly.\n *\n * The eviction sink is a parameter rather than an import: which cache holds the\n * warm clients is the host's decision, and importing one would drag a whole\n * solve engine into every consumer that only wants the diff.\n */\n\n/** The connection-identifying fields — a change in either makes the warm client stale. */\nexport interface ServerConnection {\n\tid: string;\n\tserverUrl: string;\n\tapiKey?: string;\n}\n\n/**\n * Drop the warm client for every server that was removed or whose connection\n * details changed. `prev` and `next` are the scoped server sets before and\n * after the write; unchanged servers are left alone.\n */\nexport function evictChangedServers(\n\tprev: readonly ServerConnection[],\n\tnext: readonly ServerConnection[],\n\tevict: (id: string) => void\n): void {\n\tconst nextById = new Map(next.map((s) => [s.id, s]));\n\n\t// Removed: no longer in `next`.\n\tfor (const before of prev) {\n\t\tif (!nextById.has(before.id)) evict(before.id);\n\t}\n\n\t// Rotated: same id, different URL or key.\n\tconst prevById = new Map(prev.map((s) => [s.id, s]));\n\tfor (const after of next) {\n\t\tconst before = prevById.get(after.id);\n\t\tif (before && (before.serverUrl !== after.serverUrl || before.apiKey !== after.apiKey)) {\n\t\t\tevict(after.id);\n\t\t}\n\t}\n}\n","// Not `s.replace(/x+$/, '')`: that regex backtracks quadratically on a long\n// run of `x` that isn't at the end, and these strings come from config.\nexport function trimTrailing(s: string, ch: string): string {\n\tlet end = s.length;\n\twhile (end > 0 && s[end - 1] === ch) end--;\n\treturn s.slice(0, end);\n}\n","/**\n * Shared write-path rules for compute server config.\n *\n * Two routes accept a server set: `/api/admin/compute` (platform scope,\n * `manage_compute`) and `/api/v1/orgs/{orgId}/compute` (org scope,\n * `manage_org_compute`). They differ in who may call them, what extra fields\n * they carry (`sharedWith` vs `ownerOrgId`), and how they validate the default\n * selection — but the field validation and the apiKey merge below must behave\n * identically in both, so they live here rather than in either handler.\n *\n * The apiKey merge is why this file exists: if the two copies disagree, a\n * stored credential silently gets cleared or leaked, and nothing fails at\n * build time.\n */\n\nimport { GuidSchema } from '@selvajs/platform';\nimport { isEncryptedSecret } from '@selvajs/platform/computeServer';\nimport { isLinkLocalUrl } from './safe-url.js';\nimport { apiError, ApiErrorCode } from '../api/errors.js';\nimport { trimTrailing } from './trim.js';\n\n/**\n * A stored `serverUrl` is fetched server-side on every status probe, every\n * purge/shutdown action, and every solve, so an unfiltered one is an SSRF\n * primitive handed to whoever holds `manage_compute`. Two rules:\n *\n * - Scheme allowlist: `http`/`https`. `file:`, `gopher:` and friends are never\n * a Rhino.Compute endpoint.\n * - Link-local (`169.254.0.0/16`) is refused. That range carries the cloud\n * metadata service at `169.254.169.254`, which hands out the host's own IAM\n * credentials to anything running on the box.\n *\n * **Loopback and RFC1918 are deliberately allowed.** Running compute on\n * `localhost:6500` or a LAN box is the ordinary self-hosted layout, not an\n * attack — most deployments reach their compute server over exactly those\n * addresses. Blocking them by default would break those instances on upgrade\n * and push every operator toward an opt-out flag, and a guard that everyone\n * disables protects nobody. So the check is narrowed to the range where no\n * legitimate compute server ever lives.\n *\n * What this does not stop: a privileged admin pointing the app at an internal\n * host to probe it. That is a real but much weaker concern than credential\n * theft, it needs `manage_compute` already, and it is inseparable from the\n * legitimate case. Revisit if `manage_org_compute` is ever delegated widely on\n * a multi-tenant instance.\n *\n * `isLinkLocalUrl` is reused rather than hand-rolled because a string compare\n * against `169.254.169.254` misses the encodings that reach the same address:\n * `http://2852039166/`, `http://0xa9fea9fe/`, `http://0251.0376.0251.0376/`.\n */\nfunction assertUsableServerUrl(serverUrl: string): void {\n\tlet parsed: URL;\n\ttry {\n\t\tparsed = new URL(serverUrl);\n\t} catch {\n\t\tapiError(400, ApiErrorCode.VALIDATION_FAILED, `Invalid serverUrl: ${serverUrl}`);\n\t}\n\tif (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') {\n\t\tapiError(400, ApiErrorCode.VALIDATION_FAILED, `serverUrl must use http or https: ${serverUrl}`);\n\t}\n\tif (isLinkLocalUrl(serverUrl)) {\n\t\tapiError(\n\t\t\t400,\n\t\t\tApiErrorCode.VALIDATION_FAILED,\n\t\t\t`serverUrl points at the link-local range, which carries the cloud metadata service: ${serverUrl}`\n\t\t);\n\t}\n}\n\n/** The fields every incoming server carries, whatever its scope. */\nexport interface IncomingServerBase {\n\tid: string;\n\tlabel: string;\n\tserverUrl: string;\n\t/**\n\t * `undefined` → preserve the stored key; `null` → clear it;\n\t * non-empty string → replace it. See {@link resolveApiKey}.\n\t */\n\tapiKey?: string | null;\n}\n\n/**\n * Validates the scope-independent fields of every submitted server. Throws the\n * first failure as a 400; scope-specific fields (`sharedWith`, `ownerOrgId`)\n * are the caller's business.\n */\nexport function validateIncomingServers(servers: readonly IncomingServerBase[]): void {\n\tconst seen = new Set<string>();\n\tfor (const s of servers) {\n\t\tif (!s.id || typeof s.id !== 'string')\n\t\t\tapiError(400, ApiErrorCode.VALIDATION_FAILED, 'Each server needs an id');\n\t\tif (!GuidSchema.safeParse(s.id).success)\n\t\t\tapiError(400, ApiErrorCode.VALIDATION_FAILED, `Server id must be a UUID: ${s.id}`);\n\t\tif (seen.has(s.id))\n\t\t\tapiError(400, ApiErrorCode.VALIDATION_FAILED, `Server id appears more than once: ${s.id}`);\n\t\tseen.add(s.id);\n\t\tif (!s.label || typeof s.label !== 'string')\n\t\t\tapiError(400, ApiErrorCode.VALIDATION_FAILED, 'Each server needs a label');\n\t\tif (!s.serverUrl || typeof s.serverUrl !== 'string')\n\t\t\tapiError(400, ApiErrorCode.VALIDATION_FAILED, 'Each server needs a serverUrl');\n\t\tassertUsableServerUrl(s.serverUrl);\n\t\tif (s.apiKey !== undefined && s.apiKey !== null && typeof s.apiKey !== 'string')\n\t\t\tapiError(400, ApiErrorCode.VALIDATION_FAILED, 'apiKey must be a string, null, or omitted');\n\t\t// Clients never receive stored keys, so an envelope here is someone else's\n\t\t// ciphertext being replayed against a URL they control.\n\t\tif (s.apiKey && isEncryptedSecret(s.apiKey))\n\t\t\tapiError(400, ApiErrorCode.VALIDATION_FAILED, 'apiKey must be a plaintext key');\n\t}\n}\n\n/**\n * A key that failed to decrypt reads as `hasApiKey` with no `apiKey`. Saving with\n * the field omitted would write `undefined` over the ciphertext, destroying the\n * key the logs tell the operator to recover by restoring `SELVA_AT_REST_KEY`.\n * Replacing or clearing it is a decision, so those pass.\n */\nexport function assertStoredKeysReadable(\n\tincoming: readonly Pick<IncomingServerBase, 'id' | 'apiKey'>[],\n\tstored: readonly { id: string; apiKey?: string; hasApiKey?: boolean }[]\n): void {\n\tconst unreadable = new Set(stored.filter((s) => s.hasApiKey && !s.apiKey).map((s) => s.id));\n\tfor (const s of incoming) {\n\t\tif (unreadable.has(s.id) && (s.apiKey === undefined || s.apiKey === '')) {\n\t\t\tapiError(\n\t\t\t\t409,\n\t\t\t\tApiErrorCode.CONFLICT,\n\t\t\t\t`The stored key for server ${s.id} cannot be decrypted. Restore the original SELVA_AT_REST_KEY, or re-enter the key.`\n\t\t\t);\n\t\t}\n\t}\n}\n\n/**\n * An omitted key is kept, so without this check anyone who may save the config\n * could point a server at their own host and have the next solve send them the\n * stored key, which they never saw. Moving a server needs the key re-entered or\n * cleared.\n */\nexport function assertKeyNotRetargeted(\n\tincoming: readonly Pick<IncomingServerBase, 'id' | 'serverUrl' | 'apiKey'>[],\n\tstored: readonly { id: string; serverUrl: string; apiKey?: string; hasApiKey?: boolean }[]\n): void {\n\tconst byId = new Map(stored.map((s) => [s.id, s]));\n\tfor (const s of incoming) {\n\t\tconst prev = byId.get(s.id);\n\t\tif (!prev || !(prev.hasApiKey || prev.apiKey)) continue;\n\t\tif (s.apiKey === null || (typeof s.apiKey === 'string' && s.apiKey !== '')) continue;\n\t\tif (sameServerUrl(prev.serverUrl, s.serverUrl)) continue;\n\t\tapiError(\n\t\t\t409,\n\t\t\tApiErrorCode.CONFLICT,\n\t\t\t`Server ${s.id} has a new URL. Re-enter its API key, or clear it, to save.`\n\t\t);\n\t}\n}\n\nfunction sameServerUrl(a: string, b: string): boolean {\n\tconst normalize = (u: string) => {\n\t\ttry {\n\t\t\treturn trimTrailing(new URL(u.trim()).href, '/');\n\t\t} catch {\n\t\t\treturn trimTrailing(u.trim(), '/');\n\t\t}\n\t};\n\treturn normalize(a) === normalize(b);\n}\n\n/**\n * The UI never receives stored keys — it sends back `hasApiKey` and omits the\n * field for servers the operator didn't touch. So \"omitted\" cannot mean \"clear\":\n * it has to preserve, or every save through the settings form would wipe the\n * keys of every server the operator left alone. Clearing is explicit (`null`);\n * an empty string is treated as \"not provided\" since that's what an untouched\n * password input submits.\n */\nexport function resolveApiKey(\n\tsubmitted: string | null | undefined,\n\tstoredKey: string | undefined\n): string | undefined {\n\tif (submitted === null) return undefined;\n\treturn submitted ? submitted : storedKey;\n}\n\n/**\n * Builds the id → stored-key lookup the merge reads. The caller passes only the\n * servers in its own scope, so one scope's write can never resolve a key from\n * another's rows.\n */\nexport function storedKeysById(\n\tscopedServers: readonly { id: string; apiKey?: string }[]\n): Map<string, string | undefined> {\n\treturn new Map(scopedServers.map((s) => [s.id, s.apiKey]));\n}\n"],"mappings":";;;;;;;;;AAsBA,SAAgB,oBACf,MACA,MACA,OACO;CACP,MAAM,WAAW,IAAI,IAAI,KAAK,KAAK,MAAM,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;CAGnD,KAAK,MAAM,UAAU,MACpB,IAAI,CAAC,SAAS,IAAI,OAAO,EAAE,GAAG,MAAM,OAAO,EAAE;CAI9C,MAAM,WAAW,IAAI,IAAI,KAAK,KAAK,MAAM,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;CACnD,KAAK,MAAM,SAAS,MAAM;EACzB,MAAM,SAAS,SAAS,IAAI,MAAM,EAAE;EACpC,IAAI,WAAW,OAAO,cAAc,MAAM,aAAa,OAAO,WAAW,MAAM,SAC9E,MAAM,MAAM,EAAE;CAEhB;AACD;;ACxCA,SAAgB,aAAa,GAAW,IAAoB;CAC3D,IAAI,MAAM,EAAE;CACZ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CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AAC1D"}
1
+ {"version":3,"file":"server-config-write.js","names":[],"sources":["../../../../server/src/compute/evict-changed-servers.ts","../../../../server/src/compute/server-config-write.ts"],"sourcesContent":["/**\n * A warm compute client caches on server `id`, so a rotated `serverUrl`/`apiKey`\n * keeps the same cache key with stale connection details — it never ages out on\n * its own. The config-write path has to evict explicitly.\n *\n * The eviction sink is a parameter rather than an import: which cache holds the\n * warm clients is the host's decision, and importing one would drag a whole\n * solve engine into every consumer that only wants the diff.\n */\n\n/** The connection-identifying fields — a change in either makes the warm client stale. */\nexport interface ServerConnection {\n\tid: string;\n\tserverUrl: string;\n\tapiKey?: string;\n}\n\n/**\n * Drop the warm client for every server that was removed or whose connection\n * details changed. `prev` and `next` are the scoped server sets before and\n * after the write; unchanged servers are left alone.\n */\nexport function evictChangedServers(\n\tprev: readonly ServerConnection[],\n\tnext: readonly ServerConnection[],\n\tevict: (id: string) => void\n): void {\n\tconst nextById = new Map(next.map((s) => [s.id, s]));\n\n\t// Removed: no longer in `next`.\n\tfor (const before of prev) {\n\t\tif (!nextById.has(before.id)) evict(before.id);\n\t}\n\n\t// Rotated: same id, different URL or key.\n\tconst prevById = new Map(prev.map((s) => [s.id, s]));\n\tfor (const after of next) {\n\t\tconst before = prevById.get(after.id);\n\t\tif (before && (before.serverUrl !== after.serverUrl || before.apiKey !== after.apiKey)) {\n\t\t\tevict(after.id);\n\t\t}\n\t}\n}\n","/**\n * Shared write-path rules for compute server config.\n *\n * Two routes accept a server set: `/api/admin/compute` (platform scope,\n * `manage_compute`) and `/api/v1/orgs/{orgId}/compute` (org scope,\n * `manage_org_compute`). They differ in who may call them, what extra fields\n * they carry (`sharedWith` vs `ownerOrgId`), and how they validate the default\n * selection — but the field validation and the apiKey merge below must behave\n * identically in both, so they live here rather than in either handler.\n *\n * The apiKey merge is why this file exists: if the two copies disagree, a\n * stored credential silently gets cleared or leaked, and nothing fails at\n * build time.\n */\n\nimport { GuidSchema, trimTrailing } from '@selvajs/platform';\nimport { isEncryptedSecret } from '@selvajs/platform/computeServer';\nimport { isLinkLocalUrl } from './safe-url.js';\nimport { apiError, ApiErrorCode } from '../api/errors.js';\n\n/**\n * A stored `serverUrl` is fetched server-side on every status probe, every\n * purge/shutdown action, and every solve, so an unfiltered one is an SSRF\n * primitive handed to whoever holds `manage_compute`. Two rules:\n *\n * - Scheme allowlist: `http`/`https`. `file:`, `gopher:` and friends are never\n * a Rhino.Compute endpoint.\n * - Link-local (`169.254.0.0/16`) is refused. That range carries the cloud\n * metadata service at `169.254.169.254`, which hands out the host's own IAM\n * credentials to anything running on the box.\n *\n * **Loopback and RFC1918 are deliberately allowed.** Running compute on\n * `localhost:6500` or a LAN box is the ordinary self-hosted layout, not an\n * attack — most deployments reach their compute server over exactly those\n * addresses. Blocking them by default would break those instances on upgrade\n * and push every operator toward an opt-out flag, and a guard that everyone\n * disables protects nobody. So the check is narrowed to the range where no\n * legitimate compute server ever lives.\n *\n * What this does not stop: a privileged admin pointing the app at an internal\n * host to probe it. That is a real but much weaker concern than credential\n * theft, it needs `manage_compute` already, and it is inseparable from the\n * legitimate case. Revisit if `manage_org_compute` is ever delegated widely on\n * a multi-tenant instance.\n *\n * `isLinkLocalUrl` is reused rather than hand-rolled because a string compare\n * against `169.254.169.254` misses the encodings that reach the same address:\n * `http://2852039166/`, `http://0xa9fea9fe/`, `http://0251.0376.0251.0376/`.\n */\nfunction assertUsableServerUrl(serverUrl: string): void {\n\tlet parsed: URL;\n\ttry {\n\t\tparsed = new URL(serverUrl);\n\t} catch {\n\t\tapiError(400, ApiErrorCode.VALIDATION_FAILED, `Invalid serverUrl: ${serverUrl}`);\n\t}\n\tif (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') {\n\t\tapiError(400, ApiErrorCode.VALIDATION_FAILED, `serverUrl must use http or https: ${serverUrl}`);\n\t}\n\tif (isLinkLocalUrl(serverUrl)) {\n\t\tapiError(\n\t\t\t400,\n\t\t\tApiErrorCode.VALIDATION_FAILED,\n\t\t\t`serverUrl points at the link-local range, which carries the cloud metadata service: ${serverUrl}`\n\t\t);\n\t}\n}\n\n/** The fields every incoming server carries, whatever its scope. */\nexport interface IncomingServerBase {\n\tid: string;\n\tlabel: string;\n\tserverUrl: string;\n\t/**\n\t * `undefined` → preserve the stored key; `null` → clear it;\n\t * non-empty string → replace it. See {@link resolveApiKey}.\n\t */\n\tapiKey?: string | null;\n}\n\n/**\n * Validates the scope-independent fields of every submitted server. Throws the\n * first failure as a 400; scope-specific fields (`sharedWith`, `ownerOrgId`)\n * are the caller's business.\n */\nexport function validateIncomingServers(servers: readonly IncomingServerBase[]): void {\n\tconst seen = new Set<string>();\n\tfor (const s of servers) {\n\t\tif (!s.id || typeof s.id !== 'string')\n\t\t\tapiError(400, ApiErrorCode.VALIDATION_FAILED, 'Each server needs an id');\n\t\tif (!GuidSchema.safeParse(s.id).success)\n\t\t\tapiError(400, ApiErrorCode.VALIDATION_FAILED, `Server id must be a UUID: ${s.id}`);\n\t\tif (seen.has(s.id))\n\t\t\tapiError(400, ApiErrorCode.VALIDATION_FAILED, `Server id appears more than once: ${s.id}`);\n\t\tseen.add(s.id);\n\t\tif (!s.label || typeof s.label !== 'string')\n\t\t\tapiError(400, ApiErrorCode.VALIDATION_FAILED, 'Each server needs a label');\n\t\tif (!s.serverUrl || typeof s.serverUrl !== 'string')\n\t\t\tapiError(400, ApiErrorCode.VALIDATION_FAILED, 'Each server needs a serverUrl');\n\t\tassertUsableServerUrl(s.serverUrl);\n\t\tif (s.apiKey !== undefined && s.apiKey !== null && typeof s.apiKey !== 'string')\n\t\t\tapiError(400, ApiErrorCode.VALIDATION_FAILED, 'apiKey must be a string, null, or omitted');\n\t\t// Clients never receive stored keys, so an envelope here is someone else's\n\t\t// ciphertext being replayed against a URL they control.\n\t\tif (s.apiKey && isEncryptedSecret(s.apiKey))\n\t\t\tapiError(400, ApiErrorCode.VALIDATION_FAILED, 'apiKey must be a plaintext key');\n\t}\n}\n\n/**\n * A key that failed to decrypt reads as `hasApiKey` with no `apiKey`. Saving with\n * the field omitted would write `undefined` over the ciphertext, destroying the\n * key the logs tell the operator to recover by restoring `SELVA_AT_REST_KEY`.\n * Replacing or clearing it is a decision, so those pass.\n */\nexport function assertStoredKeysReadable(\n\tincoming: readonly Pick<IncomingServerBase, 'id' | 'apiKey'>[],\n\tstored: readonly { id: string; apiKey?: string; hasApiKey?: boolean }[]\n): void {\n\tconst unreadable = new Set(stored.filter((s) => s.hasApiKey && !s.apiKey).map((s) => s.id));\n\tfor (const s of incoming) {\n\t\tif (unreadable.has(s.id) && (s.apiKey === undefined || s.apiKey === '')) {\n\t\t\tapiError(\n\t\t\t\t409,\n\t\t\t\tApiErrorCode.CONFLICT,\n\t\t\t\t`The stored key for server ${s.id} cannot be decrypted. Restore the original SELVA_AT_REST_KEY, or re-enter the key.`\n\t\t\t);\n\t\t}\n\t}\n}\n\n/**\n * An omitted key is kept, so without this check anyone who may save the config\n * could point a server at their own host and have the next solve send them the\n * stored key, which they never saw. Moving a server needs the key re-entered or\n * cleared.\n */\nexport function assertKeyNotRetargeted(\n\tincoming: readonly Pick<IncomingServerBase, 'id' | 'serverUrl' | 'apiKey'>[],\n\tstored: readonly { id: string; serverUrl: string; apiKey?: string; hasApiKey?: boolean }[]\n): void {\n\tconst byId = new Map(stored.map((s) => [s.id, s]));\n\tfor (const s of incoming) {\n\t\tconst prev = byId.get(s.id);\n\t\tif (!prev || !(prev.hasApiKey || prev.apiKey)) continue;\n\t\tif (s.apiKey === null || (typeof s.apiKey === 'string' && s.apiKey !== '')) continue;\n\t\tif (sameServerUrl(prev.serverUrl, s.serverUrl)) continue;\n\t\tapiError(\n\t\t\t409,\n\t\t\tApiErrorCode.CONFLICT,\n\t\t\t`Server ${s.id} has a new URL. Re-enter its API key, or clear it, to save.`\n\t\t);\n\t}\n}\n\nfunction sameServerUrl(a: string, b: string): boolean {\n\tconst normalize = (u: string) => {\n\t\ttry {\n\t\t\treturn trimTrailing(new URL(u.trim()).href, '/');\n\t\t} catch {\n\t\t\treturn trimTrailing(u.trim(), '/');\n\t\t}\n\t};\n\treturn normalize(a) === normalize(b);\n}\n\n/**\n * The UI never receives stored keys — it sends back `hasApiKey` and omits the\n * field for servers the operator didn't touch. So \"omitted\" cannot mean \"clear\":\n * it has to preserve, or every save through the settings form would wipe the\n * keys of every server the operator left alone. Clearing is explicit (`null`);\n * an empty string is treated as \"not provided\" since that's what an untouched\n * password input submits.\n */\nexport function resolveApiKey(\n\tsubmitted: string | null | undefined,\n\tstoredKey: string | undefined\n): string | undefined {\n\tif (submitted === null) return undefined;\n\treturn submitted ? submitted : storedKey;\n}\n\n/**\n * Builds the id → stored-key lookup the merge reads. The caller passes only the\n * servers in its own scope, so one scope's write can never resolve a key from\n * another's rows.\n */\nexport function storedKeysById(\n\tscopedServers: readonly { id: string; apiKey?: string }[]\n): Map<string, string | undefined> {\n\treturn new Map(scopedServers.map((s) => [s.id, s.apiKey]));\n}\n"],"mappings":";;;;;;;;;;AAsBA,SAAgB,oBACf,MACA,MACA,OACO;CACP,MAAM,WAAW,IAAI,IAAI,KAAK,KAAK,MAAM,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;CAGnD,KAAK,MAAM,UAAU,MACpB,IAAI,CAAC,SAAS,IAAI,OAAO,EAAE,GAAG,MAAM,OAAO,EAAE;CAI9C,MAAM,WAAW,IAAI,IAAI,KAAK,KAAK,MAAM,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;CACnD,KAAK,MAAM,SAAS,MAAM;EACzB,MAAM,SAAS,SAAS,IAAI,MAAM,EAAE;EACpC,IAAI,WAAW,OAAO,cAAc,MAAM,aAAa,OAAO,WAAW,MAAM,SAC9E,MAAM,MAAM,EAAE;CAEhB;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACOA,SAAS,sBAAsB,WAAyB;CACvD,IAAI;CACJ,IAAI;EACH,SAAS,IAAI,IAAI,SAAS;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K,MAAM,KAAK,UACf,IAAI,WAAW,IAAI,EAAE,EAAE,MAAM,EAAE,WAAW,KAAA,KAAa,EAAE,WAAW,KACnE,SACC,KACA,aAAa,UACb,6BAA6B,EAAE,GAAG,mFACnC;AAGH;;;;;;;AAQA,SAAgB,uBACf,UACA,QACO;CACP,MAAM,OAAO,IAAI,IAAI,OAAO,KAAK,MAAM,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;CACjD,KAAK,MAAM,KAAK,UAAU;EACzB,MAAM,OAAO,KAAK,IAAI,EAAE,EAAE;EAC1B,IAAI,CAAC,QAAQ,EAAE,KAAK,aAAa,KAAK,SAAS;EAC/C,IAAI,EAAE,WAAW,QAAS,OAAO,EAAE,WAAW,YAAY,EAAE,WAAW,IAAK;EAC5E,IAAI,cAAc,KAAK,WAAW,EAAE,SAAS,GAAG;EAChD,SACC,KACA,aAAa,UACb,UAAU,EAAE,GAAG,4DAChB;CACD;AACD;AAEA,SAAS,cAAc,GAAW,GAAoB;CACrD,MAAM,aAAa,MAAc;EAChC,IAAI;GACH,OAAO,aAAa,IAAI,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,MAAM,GAAG;EAChD,QAAQ;GACP,OAAO,aAAa,EAAE,KAAK,GAAG,GAAG;EAClC;CACD;CACA,OAAO,UAAU,CAAC,MAAM,UAAU,CAAC;AACpC;;;;;;;;;AAUA,SAAgB,cACf,WACA,WACqB;CACrB,IAAI,cAAc,MAAM,OAAO,KAAA;CAC/B,OAAO,YAAY,YAAY;AAChC;;;;;;AAOA,SAAgB,eACf,eACkC;CAClC,OAAO,IAAI,IAAI,cAAc,KAAK,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AAC1D"}
@@ -1,6 +1,6 @@
1
1
  import { r as getAuthProvider } from "./providers.server.js";
2
2
  import { n as env } from "./previous-key.js";
3
- import { a as resolveSignInMaxAgeMs, o as signInIsStale } from "./http.js";
3
+ import { o as resolveSignInMaxAgeMs, s as signInIsStale } from "./http.js";
4
4
  import { a as destroySession, s as getSessionToken } from "./admin-auth.server.js";
5
5
  import { redirect } from "@sveltejs/kit";
6
6
  // src/lib/server/signInMaxAge.server.ts