primitive-admin 1.2.0-alpha.1 → 1.2.0-alpha.10

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 (410) hide show
  1. package/README.md +105 -134
  2. package/assets/skill/skills/primitive-platform/SKILL.md +37 -4
  3. package/dist/bin/primitive.js +30 -35
  4. package/dist/bin/primitive.js.map +1 -1
  5. package/dist/src/commands/agent-sessions.d.ts +133 -0
  6. package/dist/src/commands/agent-sessions.js +792 -0
  7. package/dist/src/commands/agent-sessions.js.map +1 -0
  8. package/dist/src/commands/analytics.js +0 -148
  9. package/dist/src/commands/analytics.js.map +1 -1
  10. package/dist/src/commands/apps-children.d.ts +54 -0
  11. package/dist/src/commands/apps-children.js +631 -0
  12. package/dist/src/commands/apps-children.js.map +1 -0
  13. package/dist/src/commands/apps.d.ts +6 -0
  14. package/dist/src/commands/apps.js +131 -9
  15. package/dist/src/commands/apps.js.map +1 -1
  16. package/dist/src/commands/auth-sessions.d.ts +3 -3
  17. package/dist/src/commands/auth-sessions.js +117 -23
  18. package/dist/src/commands/auth-sessions.js.map +1 -1
  19. package/dist/src/commands/auth.js +460 -36
  20. package/dist/src/commands/auth.js.map +1 -1
  21. package/dist/src/commands/collections.js +316 -256
  22. package/dist/src/commands/collections.js.map +1 -1
  23. package/dist/src/commands/config.d.ts +1 -1
  24. package/dist/src/commands/config.js +60 -28
  25. package/dist/src/commands/config.js.map +1 -1
  26. package/dist/src/commands/connections.js +11 -12
  27. package/dist/src/commands/connections.js.map +1 -1
  28. package/dist/src/commands/database-type-configs.js +2 -76
  29. package/dist/src/commands/database-type-configs.js.map +1 -1
  30. package/dist/src/commands/databases.d.ts +9 -0
  31. package/dist/src/commands/databases.js +221 -457
  32. package/dist/src/commands/databases.js.map +1 -1
  33. package/dist/src/commands/db3-types.d.ts +15 -0
  34. package/dist/src/commands/db3-types.js +157 -0
  35. package/dist/src/commands/db3-types.js.map +1 -0
  36. package/dist/src/commands/db3.d.ts +12 -0
  37. package/dist/src/commands/db3.js +1052 -0
  38. package/dist/src/commands/db3.js.map +1 -0
  39. package/dist/src/commands/documents.d.ts +121 -2
  40. package/dist/src/commands/documents.js +1601 -1251
  41. package/dist/src/commands/documents.js.map +1 -1
  42. package/dist/src/commands/env.d.ts +9 -1
  43. package/dist/src/commands/env.js +164 -49
  44. package/dist/src/commands/env.js.map +1 -1
  45. package/dist/src/commands/function-trigger-commands.d.ts +28 -0
  46. package/dist/src/commands/function-trigger-commands.js +341 -0
  47. package/dist/src/commands/function-trigger-commands.js.map +1 -0
  48. package/dist/src/commands/functions.js +297 -24
  49. package/dist/src/commands/functions.js.map +1 -1
  50. package/dist/src/commands/groups.js +150 -49
  51. package/dist/src/commands/groups.js.map +1 -1
  52. package/dist/src/commands/guides.js +5 -5
  53. package/dist/src/commands/init.d.ts +7 -0
  54. package/dist/src/commands/init.js +23 -5
  55. package/dist/src/commands/init.js.map +1 -1
  56. package/dist/src/commands/integrations.js +14 -8
  57. package/dist/src/commands/integrations.js.map +1 -1
  58. package/dist/src/commands/metadata-category-configs.d.ts +2 -2
  59. package/dist/src/commands/metadata-category-configs.js +2 -2
  60. package/dist/src/commands/prompts.d.ts +7 -0
  61. package/dist/src/commands/prompts.js +48 -5
  62. package/dist/src/commands/prompts.js.map +1 -1
  63. package/dist/src/commands/scripts.d.ts +9 -17
  64. package/dist/src/commands/scripts.js +24 -479
  65. package/dist/src/commands/scripts.js.map +1 -1
  66. package/dist/src/commands/sync-app-settings.d.ts +36 -8
  67. package/dist/src/commands/sync-app-settings.js +109 -23
  68. package/dist/src/commands/sync-app-settings.js.map +1 -1
  69. package/dist/src/commands/sync.d.ts +360 -610
  70. package/dist/src/commands/sync.js +3151 -6697
  71. package/dist/src/commands/sync.js.map +1 -1
  72. package/dist/src/commands/tokens.js +3 -3
  73. package/dist/src/commands/tokens.js.map +1 -1
  74. package/dist/src/commands/users.js +77 -2
  75. package/dist/src/commands/users.js.map +1 -1
  76. package/dist/src/commands/workflows.d.ts +5 -83
  77. package/dist/src/commands/workflows.js +57 -2282
  78. package/dist/src/commands/workflows.js.map +1 -1
  79. package/dist/src/lib/aggregate-output.d.ts +25 -0
  80. package/dist/src/lib/aggregate-output.js +53 -0
  81. package/dist/src/lib/aggregate-output.js.map +1 -0
  82. package/dist/src/lib/api-client.d.ts +681 -551
  83. package/dist/src/lib/api-client.js +880 -814
  84. package/dist/src/lib/api-client.js.map +1 -1
  85. package/dist/src/lib/app-settings-descriptor.d.ts +47 -1
  86. package/dist/src/lib/app-settings-descriptor.js +114 -10
  87. package/dist/src/lib/app-settings-descriptor.js.map +1 -1
  88. package/dist/src/lib/auth-fixtures.d.ts +44 -0
  89. package/dist/src/lib/auth-fixtures.js +61 -0
  90. package/dist/src/lib/auth-fixtures.js.map +1 -0
  91. package/dist/src/lib/auth-flow.d.ts +41 -1
  92. package/dist/src/lib/auth-flow.js +70 -16
  93. package/dist/src/lib/auth-flow.js.map +1 -1
  94. package/dist/src/lib/block-layout.d.ts +12 -23
  95. package/dist/src/lib/block-layout.js +26 -92
  96. package/dist/src/lib/block-layout.js.map +1 -1
  97. package/dist/src/lib/block-selector.d.ts +2 -2
  98. package/dist/src/lib/block-selector.js +2 -2
  99. package/dist/src/lib/child-apps-local.d.ts +164 -0
  100. package/dist/src/lib/child-apps-local.js +258 -0
  101. package/dist/src/lib/child-apps-local.js.map +1 -0
  102. package/dist/src/lib/ci-session-request.d.ts +22 -0
  103. package/dist/src/lib/ci-session-request.js +51 -0
  104. package/dist/src/lib/ci-session-request.js.map +1 -0
  105. package/dist/src/lib/codegen-shared/generatedFiles.d.ts +10 -8
  106. package/dist/src/lib/codegen-shared/generatedFiles.js +21 -15
  107. package/dist/src/lib/codegen-shared/generatedFiles.js.map +1 -1
  108. package/dist/src/lib/codegen-shared/prettierStable.d.ts +1 -1
  109. package/dist/src/lib/codegen-shared/prettierStable.js +1 -1
  110. package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.d.ts +2 -2
  111. package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.js +2 -2
  112. package/dist/src/lib/collection-export.d.ts +76 -15
  113. package/dist/src/lib/collection-export.js +116 -23
  114. package/dist/src/lib/collection-export.js.map +1 -1
  115. package/dist/src/lib/collection-principal.d.ts +22 -0
  116. package/dist/src/lib/collection-principal.js +35 -0
  117. package/dist/src/lib/collection-principal.js.map +1 -0
  118. package/dist/src/lib/config-object-descriptor.d.ts +3 -22
  119. package/dist/src/lib/config-object-descriptor.js +56 -290
  120. package/dist/src/lib/config-object-descriptor.js.map +1 -1
  121. package/dist/src/lib/config-payload.js +2 -3
  122. package/dist/src/lib/config-payload.js.map +1 -1
  123. package/dist/src/lib/config-surface.d.ts +5 -7
  124. package/dist/src/lib/config-surface.js +18 -40
  125. package/dist/src/lib/config-surface.js.map +1 -1
  126. package/dist/src/lib/connections-list.d.ts +10 -0
  127. package/dist/src/lib/connections-list.js +18 -0
  128. package/dist/src/lib/connections-list.js.map +1 -0
  129. package/dist/src/lib/credentials-home.d.ts +58 -0
  130. package/dist/src/lib/credentials-home.js +204 -0
  131. package/dist/src/lib/credentials-home.js.map +1 -0
  132. package/dist/src/lib/credentials-lock.d.ts +88 -0
  133. package/dist/src/lib/credentials-lock.js +302 -0
  134. package/dist/src/lib/credentials-lock.js.map +1 -0
  135. package/dist/src/lib/credentials-store.d.ts +179 -24
  136. package/dist/src/lib/credentials-store.js +712 -77
  137. package/dist/src/lib/credentials-store.js.map +1 -1
  138. package/dist/src/lib/csv.d.ts +8 -9
  139. package/dist/src/lib/csv.js +3 -4
  140. package/dist/src/lib/csv.js.map +1 -1
  141. package/dist/src/lib/custodian.d.ts +8 -0
  142. package/dist/src/lib/custodian.js +18 -0
  143. package/dist/src/lib/custodian.js.map +1 -0
  144. package/dist/src/lib/db-codegen/dbGenerator.js +5 -16
  145. package/dist/src/lib/db-codegen/dbGenerator.js.map +1 -1
  146. package/dist/src/lib/db-codegen/dbNaming.d.ts +5 -13
  147. package/dist/src/lib/db-codegen/dbNaming.js +5 -17
  148. package/dist/src/lib/db-codegen/dbNaming.js.map +1 -1
  149. package/dist/src/lib/db-codegen/dbTemplates.d.ts +7 -56
  150. package/dist/src/lib/db-codegen/dbTemplates.js +25 -125
  151. package/dist/src/lib/db-codegen/dbTemplates.js.map +1 -1
  152. package/dist/src/lib/db-codegen/dbTsTypes.d.ts +2 -2
  153. package/dist/src/lib/db-codegen/dbTsTypes.js +2 -2
  154. package/dist/src/lib/db-codegen/dbTypeIR.d.ts +67 -2
  155. package/dist/src/lib/db-codegen/dbTypeIR.js +13 -2
  156. package/dist/src/lib/db-codegen/dbTypeIR.js.map +1 -1
  157. package/dist/src/lib/db3-export.d.ts +231 -0
  158. package/dist/src/lib/db3-export.js +510 -0
  159. package/dist/src/lib/db3-export.js.map +1 -0
  160. package/dist/src/lib/db3-index-output.d.ts +27 -0
  161. package/dist/src/lib/db3-index-output.js +49 -0
  162. package/dist/src/lib/db3-index-output.js.map +1 -0
  163. package/dist/src/lib/document-export-lookups.d.ts +31 -0
  164. package/dist/src/lib/document-export-lookups.js +53 -0
  165. package/dist/src/lib/document-export-lookups.js.map +1 -0
  166. package/dist/src/lib/document-export-permissions.d.ts +7 -5
  167. package/dist/src/lib/document-export-permissions.js +7 -5
  168. package/dist/src/lib/document-export-permissions.js.map +1 -1
  169. package/dist/src/lib/document-export-record-log.d.ts +57 -0
  170. package/dist/src/lib/document-export-record-log.js +215 -0
  171. package/dist/src/lib/document-export-record-log.js.map +1 -0
  172. package/dist/src/lib/document-ingest-artifact.d.ts +26 -2
  173. package/dist/src/lib/document-ingest-artifact.js +42 -8
  174. package/dist/src/lib/document-ingest-artifact.js.map +1 -1
  175. package/dist/src/lib/document-ingest-format2.d.ts +36 -0
  176. package/dist/src/lib/document-ingest-format2.js +78 -0
  177. package/dist/src/lib/document-ingest-format2.js.map +1 -0
  178. package/dist/src/lib/document-ingest-input.d.ts +9 -0
  179. package/dist/src/lib/document-ingest-input.js +28 -1
  180. package/dist/src/lib/document-ingest-input.js.map +1 -1
  181. package/dist/src/lib/document-ingest-rows.d.ts +16 -0
  182. package/dist/src/lib/document-ingest-rows.js +17 -0
  183. package/dist/src/lib/document-ingest-rows.js.map +1 -1
  184. package/dist/src/lib/document-ingest.d.ts +33 -1
  185. package/dist/src/lib/document-ingest.js +49 -0
  186. package/dist/src/lib/document-ingest.js.map +1 -1
  187. package/dist/src/lib/document-schema-rows.d.ts +42 -0
  188. package/dist/src/lib/document-schema-rows.js +53 -0
  189. package/dist/src/lib/document-schema-rows.js.map +1 -0
  190. package/dist/src/lib/env-resolver-core.d.ts +70 -2
  191. package/dist/src/lib/env-resolver-core.js +137 -20
  192. package/dist/src/lib/env-resolver-core.js.map +1 -1
  193. package/dist/src/lib/env-resolver.d.ts +14 -2
  194. package/dist/src/lib/env-resolver.js +32 -10
  195. package/dist/src/lib/env-resolver.js.map +1 -1
  196. package/dist/src/lib/function-authorize-check.d.ts +142 -0
  197. package/dist/src/lib/function-authorize-check.js +310 -0
  198. package/dist/src/lib/function-authorize-check.js.map +1 -0
  199. package/dist/src/lib/function-authorize-view.d.ts +15 -0
  200. package/dist/src/lib/function-authorize-view.js +50 -0
  201. package/dist/src/lib/function-authorize-view.js.map +1 -0
  202. package/dist/src/lib/function-bundle.d.ts +38 -18
  203. package/dist/src/lib/function-bundle.js +96 -35
  204. package/dist/src/lib/function-bundle.js.map +1 -1
  205. package/dist/src/lib/function-collect.d.ts +75 -12
  206. package/dist/src/lib/function-collect.js +427 -12
  207. package/dist/src/lib/function-collect.js.map +1 -1
  208. package/dist/src/lib/function-db-types.d.ts +29 -0
  209. package/dist/src/lib/function-db-types.js +117 -7
  210. package/dist/src/lib/function-db-types.js.map +1 -1
  211. package/dist/src/lib/function-document-types.d.ts +5 -3
  212. package/dist/src/lib/function-document-types.js +10 -14
  213. package/dist/src/lib/function-document-types.js.map +1 -1
  214. package/dist/src/lib/function-lint.d.ts +34 -0
  215. package/dist/src/lib/function-lint.js +112 -0
  216. package/dist/src/lib/function-lint.js.map +1 -0
  217. package/dist/src/lib/function-log-row.js +21 -2
  218. package/dist/src/lib/function-log-row.js.map +1 -1
  219. package/dist/src/lib/function-run.d.ts +16 -21
  220. package/dist/src/lib/function-run.js +37 -30
  221. package/dist/src/lib/function-run.js.map +1 -1
  222. package/dist/src/lib/function-schema-codegen.d.ts +1 -1
  223. package/dist/src/lib/function-schema-codegen.js +5 -5
  224. package/dist/src/lib/function-schema-codegen.js.map +1 -1
  225. package/dist/src/lib/function-source-roots.d.ts +67 -0
  226. package/dist/src/lib/function-source-roots.js +148 -0
  227. package/dist/src/lib/function-source-roots.js.map +1 -0
  228. package/dist/src/lib/function-sync.d.ts +108 -22
  229. package/dist/src/lib/function-sync.js +127 -39
  230. package/dist/src/lib/function-sync.js.map +1 -1
  231. package/dist/src/lib/function-trigger-listing.d.ts +11 -6
  232. package/dist/src/lib/function-trigger-listing.js +32 -11
  233. package/dist/src/lib/function-trigger-listing.js.map +1 -1
  234. package/dist/src/lib/function-typecheck.d.ts +37 -2
  235. package/dist/src/lib/function-typecheck.js +210 -28
  236. package/dist/src/lib/function-typecheck.js.map +1 -1
  237. package/dist/src/lib/function-versions.d.ts +2 -0
  238. package/dist/src/lib/function-versions.js +1 -0
  239. package/dist/src/lib/function-versions.js.map +1 -1
  240. package/dist/src/lib/generated-allowlist.js +0 -20
  241. package/dist/src/lib/generated-allowlist.js.map +1 -1
  242. package/dist/src/lib/generated-config-surfaces.d.ts +703 -203
  243. package/dist/src/lib/generated-config-surfaces.js +2270 -2014
  244. package/dist/src/lib/generated-config-surfaces.js.map +1 -1
  245. package/dist/src/lib/generated-sdk-types.d.ts +1 -1
  246. package/dist/src/lib/generated-sdk-types.js +1 -1
  247. package/dist/src/lib/generated-sdk-types.js.map +1 -1
  248. package/dist/src/lib/init-adopt.js +12 -3
  249. package/dist/src/lib/init-adopt.js.map +1 -1
  250. package/dist/src/lib/init-login-note.d.ts +13 -0
  251. package/dist/src/lib/init-login-note.js +22 -0
  252. package/dist/src/lib/init-login-note.js.map +1 -0
  253. package/dist/src/lib/json-value.d.ts +6 -0
  254. package/dist/src/lib/json-value.js +13 -0
  255. package/dist/src/lib/json-value.js.map +1 -0
  256. package/dist/src/lib/load-routes.d.ts +33 -0
  257. package/dist/src/lib/load-routes.js +35 -0
  258. package/dist/src/lib/load-routes.js.map +1 -0
  259. package/dist/src/lib/local-state.d.ts +38 -7
  260. package/dist/src/lib/local-state.js +172 -49
  261. package/dist/src/lib/local-state.js.map +1 -1
  262. package/dist/src/lib/local-test-cases.d.ts +5 -2
  263. package/dist/src/lib/local-test-cases.js +7 -4
  264. package/dist/src/lib/local-test-cases.js.map +1 -1
  265. package/dist/src/lib/log-inspection.d.ts +42 -4
  266. package/dist/src/lib/log-inspection.js +37 -5
  267. package/dist/src/lib/log-inspection.js.map +1 -1
  268. package/dist/src/lib/login-exchange-check.d.ts +18 -0
  269. package/dist/src/lib/login-exchange-check.js +27 -0
  270. package/dist/src/lib/login-exchange-check.js.map +1 -0
  271. package/dist/src/lib/login-scope-lines.d.ts +25 -0
  272. package/dist/src/lib/login-scope-lines.js +45 -0
  273. package/dist/src/lib/login-scope-lines.js.map +1 -0
  274. package/dist/src/lib/logout-admin-session.d.ts +2 -1
  275. package/dist/src/lib/logout-admin-session.js +7 -1
  276. package/dist/src/lib/logout-admin-session.js.map +1 -1
  277. package/dist/src/lib/object-status-filter.d.ts +9 -1
  278. package/dist/src/lib/object-status-filter.js +9 -1
  279. package/dist/src/lib/object-status-filter.js.map +1 -1
  280. package/dist/src/lib/output.js +2 -0
  281. package/dist/src/lib/output.js.map +1 -1
  282. package/dist/src/lib/paginate.d.ts +0 -5
  283. package/dist/src/lib/paginate.js +0 -5
  284. package/dist/src/lib/paginate.js.map +1 -1
  285. package/dist/src/lib/pin-refusal-hint.d.ts +12 -0
  286. package/dist/src/lib/pin-refusal-hint.js +35 -0
  287. package/dist/src/lib/pin-refusal-hint.js.map +1 -0
  288. package/dist/src/lib/primitive-env-plugin.d.ts +99 -0
  289. package/dist/src/lib/primitive-env-plugin.js +408 -0
  290. package/dist/src/lib/primitive-env-plugin.js.map +1 -0
  291. package/dist/src/lib/project-config.d.ts +7 -0
  292. package/dist/src/lib/project-config.js +22 -1
  293. package/dist/src/lib/project-config.js.map +1 -1
  294. package/dist/src/lib/project-login-apps.d.ts +8 -0
  295. package/dist/src/lib/project-login-apps.js +27 -0
  296. package/dist/src/lib/project-login-apps.js.map +1 -0
  297. package/dist/src/lib/prompt-schema-codegen.d.ts +10 -3
  298. package/dist/src/lib/prompt-schema-codegen.js +52 -11
  299. package/dist/src/lib/prompt-schema-codegen.js.map +1 -1
  300. package/dist/src/lib/pull-write.d.ts +31 -0
  301. package/dist/src/lib/pull-write.js +49 -0
  302. package/dist/src/lib/pull-write.js.map +1 -0
  303. package/dist/src/lib/push-failure-report.d.ts +45 -0
  304. package/dist/src/lib/push-failure-report.js +57 -0
  305. package/dist/src/lib/push-failure-report.js.map +1 -0
  306. package/dist/src/lib/records-verbs.d.ts +69 -0
  307. package/dist/src/lib/records-verbs.js +40 -0
  308. package/dist/src/lib/records-verbs.js.map +1 -0
  309. package/dist/src/lib/refresh-admin-credentials.d.ts +7 -0
  310. package/dist/src/lib/refresh-admin-credentials.js +16 -4
  311. package/dist/src/lib/refresh-admin-credentials.js.map +1 -1
  312. package/dist/src/lib/root-import-decision.d.ts +65 -0
  313. package/dist/src/lib/root-import-decision.js +109 -0
  314. package/dist/src/lib/root-import-decision.js.map +1 -0
  315. package/dist/src/lib/run-status.d.ts +1 -1
  316. package/dist/src/lib/run-status.generated.d.ts +2 -2
  317. package/dist/src/lib/run-status.generated.js +3 -1
  318. package/dist/src/lib/run-status.generated.js.map +1 -1
  319. package/dist/src/lib/run-status.js +1 -1
  320. package/dist/src/lib/schema-codegen/generated-schema-descriptor.d.ts +129 -0
  321. package/dist/src/lib/schema-codegen/generated-schema-descriptor.js +269 -0
  322. package/dist/src/lib/schema-codegen/generated-schema-descriptor.js.map +1 -0
  323. package/dist/src/lib/schema-codegen/naming.d.ts +35 -0
  324. package/dist/src/lib/schema-codegen/naming.js +83 -0
  325. package/dist/src/lib/schema-codegen/naming.js.map +1 -0
  326. package/dist/src/lib/schema-codegen/schemaToTs.d.ts +82 -0
  327. package/dist/src/lib/schema-codegen/schemaToTs.js +305 -0
  328. package/dist/src/lib/schema-codegen/schemaToTs.js.map +1 -0
  329. package/dist/src/lib/scope-request.d.ts +84 -0
  330. package/dist/src/lib/scope-request.js +235 -0
  331. package/dist/src/lib/scope-request.js.map +1 -0
  332. package/dist/src/lib/session-id.d.ts +9 -0
  333. package/dist/src/lib/session-id.js +28 -0
  334. package/dist/src/lib/session-id.js.map +1 -0
  335. package/dist/src/lib/snapshot-build-rows.d.ts +21 -0
  336. package/dist/src/lib/snapshot-build-rows.js +22 -0
  337. package/dist/src/lib/snapshot-build-rows.js.map +1 -1
  338. package/dist/src/lib/snapshot-build.js +8 -3
  339. package/dist/src/lib/snapshot-build.js.map +1 -1
  340. package/dist/src/lib/snapshots.d.ts +17 -1
  341. package/dist/src/lib/snapshots.js +50 -2
  342. package/dist/src/lib/snapshots.js.map +1 -1
  343. package/dist/src/lib/swift-codegen/agentGenerator.d.ts +6 -2
  344. package/dist/src/lib/swift-codegen/agentGenerator.js +57 -5
  345. package/dist/src/lib/swift-codegen/agentGenerator.js.map +1 -1
  346. package/dist/src/lib/swift-codegen/banners.d.ts +34 -7
  347. package/dist/src/lib/swift-codegen/banners.js +37 -7
  348. package/dist/src/lib/swift-codegen/banners.js.map +1 -1
  349. package/dist/src/lib/swift-codegen/dbGenerator.d.ts +4 -3
  350. package/dist/src/lib/swift-codegen/dbGenerator.js +14 -117
  351. package/dist/src/lib/swift-codegen/dbGenerator.js.map +1 -1
  352. package/dist/src/lib/swift-codegen/functionGenerator.d.ts +3 -3
  353. package/dist/src/lib/swift-codegen/functionGenerator.js +23 -18
  354. package/dist/src/lib/swift-codegen/functionGenerator.js.map +1 -1
  355. package/dist/src/lib/swift-codegen/generator.d.ts +5 -5
  356. package/dist/src/lib/swift-codegen/generator.js +35 -40
  357. package/dist/src/lib/swift-codegen/generator.js.map +1 -1
  358. package/dist/src/lib/swift-codegen/schemaToSwift.d.ts +3 -3
  359. package/dist/src/lib/swift-codegen/schemaToSwift.js +4 -4
  360. package/dist/src/lib/swift-codegen/schemaToSwift.js.map +1 -1
  361. package/dist/src/lib/swift-codegen/swiftKeys.d.ts +19 -0
  362. package/dist/src/lib/swift-codegen/swiftKeys.js +31 -0
  363. package/dist/src/lib/swift-codegen/swiftKeys.js.map +1 -0
  364. package/dist/src/lib/sync-paths.d.ts +35 -0
  365. package/dist/src/lib/sync-paths.js +57 -5
  366. package/dist/src/lib/sync-paths.js.map +1 -1
  367. package/dist/src/lib/sync-resource-types.d.ts +26 -26
  368. package/dist/src/lib/sync-resource-types.js +61 -189
  369. package/dist/src/lib/sync-resource-types.js.map +1 -1
  370. package/dist/src/lib/sync-selectors.d.ts +5 -1
  371. package/dist/src/lib/sync-selectors.js +23 -13
  372. package/dist/src/lib/sync-selectors.js.map +1 -1
  373. package/dist/src/lib/test-case-file-names.d.ts +3 -5
  374. package/dist/src/lib/test-case-file-names.js +3 -5
  375. package/dist/src/lib/test-case-file-names.js.map +1 -1
  376. package/dist/src/lib/toml-database-config.d.ts +15 -75
  377. package/dist/src/lib/toml-database-config.js +17 -306
  378. package/dist/src/lib/toml-database-config.js.map +1 -1
  379. package/dist/src/lib/transient-retry.d.ts +43 -0
  380. package/dist/src/lib/transient-retry.js +94 -0
  381. package/dist/src/lib/transient-retry.js.map +1 -0
  382. package/dist/src/lib/vars-override.d.ts +105 -0
  383. package/dist/src/lib/vars-override.js +143 -0
  384. package/dist/src/lib/vars-override.js.map +1 -0
  385. package/dist/src/lib/webhook-capture.d.ts +43 -0
  386. package/dist/src/lib/webhook-capture.js +91 -0
  387. package/dist/src/lib/webhook-capture.js.map +1 -0
  388. package/dist/src/lib/webhook-deliver.d.ts +18 -20
  389. package/dist/src/lib/webhook-deliver.js +34 -89
  390. package/dist/src/lib/webhook-deliver.js.map +1 -1
  391. package/dist/src/lib/webhook-test-run.d.ts +32 -0
  392. package/dist/src/lib/webhook-test-run.js +108 -0
  393. package/dist/src/lib/webhook-test-run.js.map +1 -0
  394. package/dist/src/lib/workflow-codegen/generator.d.ts +7 -7
  395. package/dist/src/lib/workflow-codegen/generator.js +16 -23
  396. package/dist/src/lib/workflow-codegen/generator.js.map +1 -1
  397. package/dist/src/lib/workflow-codegen/invokerIR.d.ts +6 -12
  398. package/dist/src/lib/workflow-codegen/invokerIR.js +4 -5
  399. package/dist/src/lib/workflow-codegen/invokerIR.js.map +1 -1
  400. package/dist/src/lib/workflow-toml-validator.d.ts +2 -0
  401. package/dist/src/lib/workflow-toml-validator.js +28 -1
  402. package/dist/src/lib/workflow-toml-validator.js.map +1 -1
  403. package/dist/src/types/index.d.ts +30 -37
  404. package/dist/src/validators.d.ts +7 -55
  405. package/dist/src/validators.js +7 -53
  406. package/dist/src/validators.js.map +1 -1
  407. package/dist/src/vite.d.ts +17 -0
  408. package/dist/src/vite.js +18 -0
  409. package/dist/src/vite.js.map +1 -0
  410. package/package.json +20 -12
@@ -53,6 +53,19 @@ export class RefreshError extends Error {
53
53
  export const SESSION_REVOKED_MESSAGE = "This session was revoked. Run 'primitive login'.";
54
54
  /** Any other refused refresh. */
55
55
  export const REFRESH_EXPIRED_MESSAGE = "Refresh token expired. Run 'primitive login'.";
56
+ /**
57
+ * The login was made before scoped sessions: the server no longer refreshes
58
+ * an unscoped CLI session, and a new login holds the default scope.
59
+ */
60
+ export const SESSION_UNSCOPED_MESSAGE = "Your login predates scoped sessions and can no longer be refreshed. Run 'primitive login' to sign in again.";
61
+ /** What to tell the developer about a refresh the server refused with `code`. */
62
+ export function refreshRefusalMessage(code) {
63
+ if (code === "SESSION_UNSCOPED")
64
+ return SESSION_UNSCOPED_MESSAGE;
65
+ if (code === "SESSION_REVOKED")
66
+ return SESSION_REVOKED_MESSAGE;
67
+ return REFRESH_EXPIRED_MESSAGE;
68
+ }
56
69
  /**
57
70
  * Exchange the stored refresh token for a fresh `accessToken`. Returns a new
58
71
  * `Credentials` object — the caller is responsible for persistence via
@@ -95,7 +108,8 @@ export async function refreshAdminCredentials(credentials) {
95
108
  }
96
109
  if (!response.ok) {
97
110
  // #3885: a refresh of a revoked session answers 401 with code
98
- // SESSION_REVOKED; say so, rather than calling the token expired.
111
+ // SESSION_REVOKED; say so, rather than calling the token expired. #3891:
112
+ // an unscoped login answers SESSION_UNSCOPED.
99
113
  let code;
100
114
  try {
101
115
  const body = (await response.json());
@@ -104,9 +118,7 @@ export async function refreshAdminCredentials(credentials) {
104
118
  catch {
105
119
  // Not JSON: no code to report.
106
120
  }
107
- throw new RefreshError(code === "SESSION_REVOKED"
108
- ? SESSION_REVOKED_MESSAGE
109
- : REFRESH_EXPIRED_MESSAGE, "unauthorized", response.status, undefined, code);
121
+ throw new RefreshError(refreshRefusalMessage(code), "unauthorized", response.status, undefined, code);
110
122
  }
111
123
  const data = (await response.json());
112
124
  const accessToken = data?.accessToken || data?.jwt;
@@ -1 +1 @@
1
- {"version":3,"file":"refresh-admin-credentials.js","sourceRoot":"","sources":["../../../src/lib/refresh-admin-credentials.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAe1C,MAAM,OAAO,YAAa,SAAQ,KAAK;IAG5B;IACA;IACA;IAEA;IANT,YACE,OAAe,EACR,IAAwB,EACxB,UAAmB,EACnB,KAAe;IACtB,8DAA8D;IACvD,IAAa;QAEpB,KAAK,CAAC,OAAO,CAAC,CAAC;QANR,SAAI,GAAJ,IAAI,CAAoB;QACxB,eAAU,GAAV,UAAU,CAAS;QACnB,UAAK,GAAL,KAAK,CAAU;QAEf,SAAI,GAAJ,IAAI,CAAS;QAGpB,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;IAC7B,CAAC;CACF;AAED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CAAC,MAAM,CAChB,CAAC;IACJ,CAAC;IAED,OAAO;QACL,GAAG,WAAW;QACd,WAAW;QACX,YAAY,EAAE,IAAI,CAAC,YAAY,IAAI,WAAW,CAAC,YAAY;QAC3D,SAAS,EACP,IAAI,CAAC,SAAS,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,WAAW,EAAE;KACrE,CAAC;AACJ,CAAC"}
@@ -0,0 +1,65 @@
1
+ /**
2
+ * What `documents import` does with a root document export, by format
3
+ * (#4195).
4
+ *
5
+ * A legacy root export is one Yjs state, MERGED into the target user's root.
6
+ * A large-document root export (format 2) cannot go anywhere: the platform no
7
+ * longer serves the format, so it is refused, naming the way across — its
8
+ * snapshot row chunks, loaded into a record-log document. A target root that
9
+ * is itself a large document is refused the same way, and so is one that is
10
+ * a record-log document (format 3, #4546): a Yjs state has nowhere to merge
11
+ * in a document made of rows. When the target user
12
+ * has no root yet, the app's `rootDocumentFormat` setting predicts the format
13
+ * the mint will produce; the root the mint actually returns is decided again
14
+ * against that prediction.
15
+ *
16
+ * Pure, so every branch is pinned without a server.
17
+ */
18
+ /**
19
+ * A root document's storage format: 1 (legacy), 2 (large document, no longer
20
+ * served) or 3 (record-log document). Only a legacy root takes a merge.
21
+ */
22
+ export type RootDocumentFormat = 1 | 2 | 3;
23
+ /** The facts a root import is decided from. */
24
+ export interface RootImportDecisionInput {
25
+ /** The format `metadata.json` records for the export. */
26
+ exportFormat: RootDocumentFormat;
27
+ /** The target user's root's format, or null when they have none yet. */
28
+ existingRootFormat: RootDocumentFormat | null;
29
+ /** The target app's `rootDocumentFormat` setting, as the server reports it. */
30
+ appSetting: unknown;
31
+ /** Whether `--overwrite` was given (or the root was minted by this run). */
32
+ overwrite: boolean;
33
+ /**
34
+ * The format the plan predicted for a root this run minted. Given only when
35
+ * re-deciding against the root the mint returned.
36
+ */
37
+ predictedFormat?: RootDocumentFormat;
38
+ /** The target user, as the operator named them, for the reasons. */
39
+ owner?: string;
40
+ /** The target user's root document id, when they have one, for the reasons. */
41
+ targetRootDocId?: string;
42
+ }
43
+ /** What to do with a root export. */
44
+ export type RootImportDecision = {
45
+ outcome: "merge";
46
+ targetFormat: RootDocumentFormat;
47
+ } | {
48
+ outcome: "skip" | "refuse";
49
+ targetFormat: RootDocumentFormat;
50
+ reason: string;
51
+ };
52
+ /** Read a format off the wire: 2 or 3 as itself, anything else legacy. */
53
+ export declare function rootDocumentFormatOf(value: unknown): RootDocumentFormat;
54
+ /**
55
+ * Decide what a root export does in the target app.
56
+ *
57
+ * - The export is a large document: `refuse`, naming the migration.
58
+ * - The target root (existing, predicted from the app's setting, or minted)
59
+ * is a large document: `refuse`.
60
+ * - A `predictedFormat` that the minted root contradicts: `refuse` — the
61
+ * setting changed while the import ran.
62
+ * - Otherwise `merge` — into an existing root only with `overwrite`,
63
+ * otherwise `skip`.
64
+ */
65
+ export declare function decideRootImport(input: RootImportDecisionInput): RootImportDecision;
@@ -0,0 +1,109 @@
1
+ /**
2
+ * What `documents import` does with a root document export, by format
3
+ * (#4195).
4
+ *
5
+ * A legacy root export is one Yjs state, MERGED into the target user's root.
6
+ * A large-document root export (format 2) cannot go anywhere: the platform no
7
+ * longer serves the format, so it is refused, naming the way across — its
8
+ * snapshot row chunks, loaded into a record-log document. A target root that
9
+ * is itself a large document is refused the same way, and so is one that is
10
+ * a record-log document (format 3, #4546): a Yjs state has nowhere to merge
11
+ * in a document made of rows. When the target user
12
+ * has no root yet, the app's `rootDocumentFormat` setting predicts the format
13
+ * the mint will produce; the root the mint actually returns is decided again
14
+ * against that prediction.
15
+ *
16
+ * Pure, so every branch is pinned without a server.
17
+ */
18
+ /** Read a format off the wire: 2 or 3 as itself, anything else legacy. */
19
+ export function rootDocumentFormatOf(value) {
20
+ const format = Number(value);
21
+ return format === 2 || format === 3 ? format : 1;
22
+ }
23
+ /** Why a large document goes nowhere, and the way across for an export. */
24
+ const NO_LONGER_SERVED = "a large document (documentFormat 2), which the platform no longer serves";
25
+ /** Why a record-log root cannot take a legacy export (#4546). */
26
+ const RECORD_LOG_ROOT = "a record-log document (documentFormat 3), which a legacy root export " +
27
+ "cannot be merged into";
28
+ const MIGRATION = "Create a record-log document and run `primitive documents ingest " +
29
+ "<document-id> --input <export-dir>` to load its row chunks. Nothing was imported " +
30
+ "for it.";
31
+ /**
32
+ * Decide what a root export does in the target app.
33
+ *
34
+ * - The export is a large document: `refuse`, naming the migration.
35
+ * - The target root (existing, predicted from the app's setting, or minted)
36
+ * is a large document: `refuse`.
37
+ * - A `predictedFormat` that the minted root contradicts: `refuse` — the
38
+ * setting changed while the import ran.
39
+ * - Otherwise `merge` — into an existing root only with `overwrite`,
40
+ * otherwise `skip`.
41
+ */
42
+ export function decideRootImport(input) {
43
+ const whose = (input.owner
44
+ ? `the root document of ${input.owner}`
45
+ : "the target user's root document") +
46
+ (input.targetRootDocId ? ` (${input.targetRootDocId})` : "");
47
+ const target = input.existingRootFormat ?? rootDocumentFormatOf(input.appSetting);
48
+ if (input.exportFormat === 2) {
49
+ return {
50
+ outcome: "refuse",
51
+ targetFormat: target,
52
+ reason: `it is a root document exported as ${NO_LONGER_SERVED}. ${MIGRATION}`,
53
+ };
54
+ }
55
+ if (input.existingRootFormat === null) {
56
+ if (target === 2) {
57
+ return {
58
+ outcome: "refuse",
59
+ targetFormat: target,
60
+ reason: `this app's rootDocumentFormat would mint ${whose} as ` +
61
+ `${NO_LONGER_SERVED}. Nothing was imported for it.`,
62
+ };
63
+ }
64
+ if (target === 3) {
65
+ return {
66
+ outcome: "refuse",
67
+ targetFormat: target,
68
+ reason: `this app's rootDocumentFormat would mint ${whose} as ` +
69
+ `${RECORD_LOG_ROOT}. Nothing was imported for it.`,
70
+ };
71
+ }
72
+ return { outcome: "merge", targetFormat: target };
73
+ }
74
+ if (input.predictedFormat !== undefined &&
75
+ input.predictedFormat !== input.existingRootFormat) {
76
+ return {
77
+ outcome: "refuse",
78
+ targetFormat: input.existingRootFormat,
79
+ reason: `${whose} came back from the server as a different format than the ` +
80
+ `app's rootDocumentFormat predicted — the setting changed while this ` +
81
+ `import ran, or a sign-in minted the root first. Nothing was imported ` +
82
+ `for it.`,
83
+ };
84
+ }
85
+ if (input.existingRootFormat === 2) {
86
+ return {
87
+ outcome: "refuse",
88
+ targetFormat: 2,
89
+ reason: `${whose} is ${NO_LONGER_SERVED}. Nothing was imported for it.`,
90
+ };
91
+ }
92
+ if (input.existingRootFormat === 3) {
93
+ return {
94
+ outcome: "refuse",
95
+ targetFormat: 3,
96
+ reason: `${whose} is ${RECORD_LOG_ROOT}. Nothing was imported for it.`,
97
+ };
98
+ }
99
+ if (!input.overwrite) {
100
+ return {
101
+ outcome: "skip",
102
+ targetFormat: 1,
103
+ reason: `${whose} already exists; use --overwrite to merge the exported ` +
104
+ `content into it`,
105
+ };
106
+ }
107
+ return { outcome: "merge", targetFormat: 1 };
108
+ }
109
+ //# sourceMappingURL=root-import-decision.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"root-import-decision.js","sourceRoot":"","sources":["../../../src/lib/root-import-decision.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAsCH,0EAA0E;AAC1E,MAAM,UAAU,oBAAoB,CAAC,KAAc;IACjD,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC7B,OAAO,MAAM,KAAK,CAAC,IAAI,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AACnD,CAAC;AAED,2EAA2E;AAC3E,MAAM,gBAAgB,GACpB,0EAA0E,CAAC;AAC7E,iEAAiE;AACjE,MAAM,eAAe,GACnB,uEAAuE;IACvE,uBAAuB,CAAC;AAC1B,MAAM,SAAS,GACb,mEAAmE;IACnE,mFAAmF;IACnF,SAAS,CAAC;AAEZ;;;;;;;;;;GAUG;AACH,MAAM,UAAU,gBAAgB,CAC9B,KAA8B;IAE9B,MAAM,KA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AAM,EACJ,GAAG,KAAK,4DAA4D;gBACpE,sEAAsE;gBACtE,uEAAuE;gBACvE,SAAS;SACZ,CAAC;IACJ,CAAC;IAED,IAAI,KAAK,CAAC,kBAAkB,KAAK,CAAC,EAAE,CAAC;QACnC,OAAO;YACL,OAAO,EAAE,QAAQ;YACjB,YAAY,EAAE,CAAC;YACf,MAAM,EAAE,GAAG,KAAK,OAAO,gBAAgB,gCAAgC;SACxE,CAAC;IACJ,CAAC;IAED,IAAI,KAAK,CAAC,kBAAkB,KAAK,CAAC,EAAE,CAAC;QACnC,OAAO;YACL,OAAO,EAAE,QAAQ;YACjB,YAAY,EAAE,CAAC;YACf,MAAM,EAAE,GAAG,KAAK,OAAO,eAAe,gCAAgC;SACvE,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC;QACrB,OAAO;YACL,OAAO,EAAE,MAAM;YACf,YAAY,EAAE,CAAC;YACf,MAAM,EACJ,GAAG,KAAK,yDAAyD;gBACjE,iBAAiB;SACpB,CAAC;IACJ,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC,EAAE,CAAC;AAC/C,CAAC"}
@@ -8,7 +8,7 @@
8
8
  * Those spellings no longer reach a client.
9
9
  *
10
10
  * #2636 — the vocabulary itself is no longer copied by hand: it is GENERATED
11
- * from the server's `src/workflows/run-status.ts` into
11
+ * from the server's `src/function-runs/run-status.ts` into
12
12
  * `run-status.generated.ts` (`pnpm gen:run-status`) and re-exported here, so a
13
13
  * future status is a one-site edit plus regeneration rather than four
14
14
  * hand-edits that a lagging copy turns into a hung poll loop. This module stays
@@ -2,7 +2,7 @@
2
2
  * GENERATED FILE — do not edit by hand.
3
3
  *
4
4
  * The canonical workflow-run status vocabulary, as the CLI sees it.
5
- * Generated from the server's `src/workflows/run-status.ts` by
5
+ * Generated from the server's `src/function-runs/run-status.ts` by
6
6
  * `scripts/gen-run-status-mirrors.mjs` (`pnpm gen:run-status`), because
7
7
  * the CLI is a separately built package and cannot import worker
8
8
  * source. A stale copy is worse than a missing feature: a poll loop whose
@@ -14,7 +14,7 @@
14
14
  * colours, help text) live in `cli/src/lib/run-status.ts`, which re-exports
15
15
  * everything below.
16
16
  */
17
- export declare const RUN_STATUSES: readonly ["queued", "running", "apply_pending", "apply_claimed", "completed", "failed", "terminated", "missing", "skipped"];
17
+ export declare const RUN_STATUSES: readonly ["queued", "running", "apply_pending", "apply_claimed", "completed", "failed", "terminated", "missing", "skipped", "denied"];
18
18
  export type RunStatus = (typeof RUN_STATUSES)[number];
19
19
  /** Comma-separated list for help text and error messages. */
20
20
  export declare const RUN_STATUS_LIST: string;
@@ -2,7 +2,7 @@
2
2
  * GENERATED FILE — do not edit by hand.
3
3
  *
4
4
  * The canonical workflow-run status vocabulary, as the CLI sees it.
5
- * Generated from the server's `src/workflows/run-status.ts` by
5
+ * Generated from the server's `src/function-runs/run-status.ts` by
6
6
  * `scripts/gen-run-status-mirrors.mjs` (`pnpm gen:run-status`), because
7
7
  * the CLI is a separately built package and cannot import worker
8
8
  * source. A stale copy is worse than a missing feature: a poll loop whose
@@ -24,6 +24,7 @@ export const RUN_STATUSES = [
24
24
  "terminated",
25
25
  "missing",
26
26
  "skipped",
27
+ "denied",
27
28
  ];
28
29
  /** Comma-separated list for help text and error messages. */
29
30
  export const RUN_STATUS_LIST = RUN_STATUSES.join(", ");
@@ -33,6 +34,7 @@ export const TERMINAL_RUN_STATUSES = new Set([
33
34
  "failed",
34
35
  "terminated",
35
36
  "skipped",
37
+ "denied",
36
38
  ]);
37
39
  /**
38
40
  * Apply-flow states: the run finished executing but is parked waiting for a
@@ -1 +1 @@
1
- {"version":3,"file":"run-status.generated.js","sourceRoot":"","sources":["../../../src/lib/run-status.generated.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,QAAQ;IACR,SAAS;IACT,eAAe;IACf,eAAe;IACf,WAAW;IACX,QAAQ;IACR,YAAY;IACZ,SAAS;IACT,SAAS;CACD,CAAC;AAIX,6DAA6D;AAC7D,MAAM,CAAC,MAAM,eAAe,GAAG,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEvD,wDAAwD;AACxD,MAAM,CAAC,MAAM,qBAAqB,GAAwB,IAAI,GAAG,CAAS;IACxE,WAAW;IACX,QAAQ;IACR,YAAY;IACZ,SAAS;CACV,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAwB,IAAI,GAAG,CAAS;IACrE,eAAe;IACf,eAAe;CAChB,CAAC,CAAC;AAEH,gFAAgF;AAChF,MAAM,CAAC,MAAM,sBAAsB,GAAwB,IAAI,GAAG,CAAS;IACzE,QAAQ;IACR,SAAS;CACV,CAAC,CAAC;AAEH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAwB,IAAI,GAAG,CAAS;IACvE,GAAG,qBAAqB;IACxB,GAAG,kBAAkB;IACrB,SAAS;CACV,CAAC,CAAC;AAEH,MAAM,UAAU,WAAW,CAAC,KAAc;IACxC,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ,IAAK,YAAkC,CAAC,QAAQ,CAAC,KAAK,CAAC,CACjF,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"run-status.generated.js","sourceRoot":"","sources":["../../../src/lib/run-status.generated.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,QAAQ;IACR,SAAS;IACT,eAAe;IACf,eAAe;IACf,WAAW;IACX,QAAQ;IACR,YAAY;IACZ,SAAS;IACT,SAAS;IACT,QAAQ;CACA,CAAC;AAIX,6DAA6D;AAC7D,MAAM,CAAC,MAAM,eAAe,GAAG,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEvD,wDAAwD;AACxD,MAAM,CAAC,MAAM,qBAAqB,GAAwB,IAAI,GAAG,CAAS;IACxE,WAAW;IACX,QAAQ;IACR,YAAY;IACZ,SAAS;IACT,QAAQ;CACT,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAwB,IAAI,GAAG,CAAS;IACrE,eAAe;IACf,eAAe;CAChB,CAAC,CAAC;AAEH,gFAAgF;AAChF,MAAM,CAAC,MAAM,sBAAsB,GAAwB,IAAI,GAAG,CAAS;IACzE,QAAQ;IACR,SAAS;CACV,CAAC,CAAC;AAEH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAwB,IAAI,GAAG,CAAS;IACvE,GAAG,qBAAqB;IACxB,GAAG,kBAAkB;IACrB,SAAS;CACV,CAAC,CAAC;AAEH,MAAM,UAAU,WAAW,CAAC,KAAc;IACxC,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ,IAAK,YAAkC,CAAC,QAAQ,CAAC,KAAK,CAAC,CACjF,CAAC;AACJ,CAAC"}
@@ -8,7 +8,7 @@
8
8
  * Those spellings no longer reach a client.
9
9
  *
10
10
  * #2636 — the vocabulary itself is no longer copied by hand: it is GENERATED
11
- * from the server's `src/workflows/run-status.ts` into
11
+ * from the server's `src/function-runs/run-status.ts` into
12
12
  * `run-status.generated.ts` (`pnpm gen:run-status`) and re-exported here, so a
13
13
  * future status is a one-site edit plus regeneration rather than four
14
14
  * hand-edits that a lagging copy turns into a hung poll loop. This module stays
@@ -0,0 +1,129 @@
1
+ /**
2
+ * GENERATED FILE — DO NOT EDIT BY HAND.
3
+ *
4
+ * Vendored byte-for-byte from the canonical server module
5
+ * `src/function-runs/schema-descriptor.ts` — the SAME interpretation the server
6
+ * validator (`validateValue`) enforces. The CLI cannot import server `src/`
7
+ * at runtime, so the CLI's schema type converters import this committed
8
+ * copy instead.
9
+ *
10
+ * Regenerate with:
11
+ * node cli/scripts/gen-schema-descriptor.mjs (runs at CLI prebuild)
12
+ *
13
+ * A CI freshness guard
14
+ * (`cli/scripts/gen-schema-descriptor.mjs --check`, also asserted by
15
+ * `cli/tests/unit/schema-codegen-descriptor-drift-guard.test.ts`) fails if
16
+ * this committed copy does not match the source — see issue #1442 / #998.
17
+ */
18
+ /**
19
+ * Canonical interpretation of the JSON-Schema subset the workflow platform
20
+ * supports (issue #1442).
21
+ *
22
+ * The server validator (`validateValue` in `schema-validation.ts`) and the CLI
23
+ * schema type converter (`schema-codegen/schemaToTs.ts`) must agree EXACTLY
24
+ * on how an `inputSchema`/`outputSchema` is interpreted —
25
+ * otherwise a generated `<Key>Input` type promises a shape the runtime does not
26
+ * enforce (or rejects a value the runtime accepts). Previously the converter
27
+ * re-derived those interpretation decisions by hand, which drifts from the
28
+ * validator over time.
29
+ *
30
+ * This module is the single source of that interpretation. Both consumers read
31
+ * from `describeSchema` + `isType`:
32
+ *
33
+ * - the type gate is checked before `enum` (a value failing `type` is
34
+ * rejected before `enum` is consulted);
35
+ * - a type UNION (`type: ["string","null"]`) never descends into
36
+ * `properties`/`items` — only the exact string types `"object"`/`"array"`
37
+ * do;
38
+ * - `integer` means `Number.isInteger`;
39
+ * - `additionalProperties` only closes an object; it is not a nested schema.
40
+ *
41
+ * It is deliberately dependency-free (no imports) so the CLI can vendor a
42
+ * byte-for-byte copy as a committed artifact via
43
+ * `cli/scripts/gen-workflow-schema-descriptor.mjs` (the #998 gen-allowlist
44
+ * pattern). A drift-guard test runs that generator in `--check` mode, so a
45
+ * change here that isn't regenerated into the CLI artifact fails CI. The CLI
46
+ * never imports server `src/` at runtime — only the build-time generator reads
47
+ * this file.
48
+ */
49
+ /** Does a value satisfy a JSON-schema `type` name? `integer` = `Number.isInteger`. */
50
+ export declare function isType(value: any, type: string): boolean;
51
+ /**
52
+ * The interpretation of a single schema node, normalized so both the validator
53
+ * and the type converter can consume it without re-reading raw schema fields.
54
+ */
55
+ export interface SchemaDescriptor {
56
+ /** True when `schema.type` is an array (a type union). */
57
+ isUnion: boolean;
58
+ /** `schema.type` when it is a single string; null for a union or absent type. */
59
+ singularType: string | null;
60
+ /**
61
+ * The declared type(s) normalized to an array. An array `type` is kept as-is;
62
+ * a single string becomes a one-element array; an absent/falsy type is `[]`
63
+ * (no type gate). Matches the validator's `allowedTypes` normalization.
64
+ */
65
+ types: string[];
66
+ /** The `enum` array when present, else null. */
67
+ enumValues: any[] | null;
68
+ /**
69
+ * Object descent info — non-null ONLY when `schema.type` is exactly the
70
+ * string `"object"` AND `properties` is a declared object (matching the
71
+ * validator's `schema.type === "object" && schema.properties` descent gate).
72
+ * A type UNION containing `"object"` never descends.
73
+ */
74
+ object: {
75
+ /** The raw `properties` map (child schemas). May be empty `{}`. */
76
+ properties: Record<string, any>;
77
+ /** The raw `required` list (unfiltered, as the validator reads it). */
78
+ required: any[];
79
+ /** True when `additionalProperties === false` (a closed object). */
80
+ additionalPropertiesClosed: boolean;
81
+ } | null;
82
+ /**
83
+ * Array descent info — non-null ONLY when `schema.type` is exactly the string
84
+ * `"array"` AND `items` is present (matching the validator's
85
+ * `schema.type === "array" && schema.items` descent gate).
86
+ */
87
+ array: {
88
+ /** The raw `items` schema (may be a tuple array the validator no-ops on). */
89
+ items: any;
90
+ } | null;
91
+ /**
92
+ * Discriminated-union (tagged-union) interpretation of a `oneOf` node (#1511).
93
+ *
94
+ * Populated ONLY when the node carries a `oneOf` (or `anyOf`) array whose
95
+ * members are ALL `type: "object"` — a clearly-intended tagged union. A
96
+ * `oneOf`/`anyOf` with any non-object member is NOT a tagged union: `oneOf`
97
+ * stays `null` here and is ignored (renders `unknown` / validates
98
+ * permissively) exactly as before, preserving backward compatibility.
99
+ *
100
+ * - `kind: "valid"` — a clean discriminated union: ≥2 object members sharing
101
+ * exactly one discriminator property declared as a single-literal `enum`
102
+ * in every member with distinct literals across members. The validator
103
+ * branch-selects by `discriminant` and validates only the matched member;
104
+ * the type converter renders the `|`-union of member object types.
105
+ * - `kind: "invalid"` — an all-object-member union that LOOKS like a tagged
106
+ * union but is defective (fewer than 2 members, no/ambiguous discriminator,
107
+ * or `anyOf` — unsupported in v1). `reason` is the codegen error message.
108
+ * The runtime validator ignores this (stays permissive); the codegen
109
+ * converter throws `reason` (Fork 3 = strict, resolved by the maintainer).
110
+ */
111
+ oneOf: {
112
+ kind: "valid";
113
+ /** The auto-detected discriminator property name. */
114
+ discriminant: string;
115
+ /** One entry per member: its discriminant literal + raw member schema. */
116
+ members: Array<{
117
+ discriminantValue: any;
118
+ schema: any;
119
+ }>;
120
+ } | {
121
+ kind: "invalid";
122
+ reason: string;
123
+ } | null;
124
+ }
125
+ /**
126
+ * Interpret a parsed schema node. A non-object schema (null, array, scalar)
127
+ * enforces nothing → the empty descriptor.
128
+ */
129
+ export declare function describeSchema(schema: any): SchemaDescriptor;