primitive-admin 1.2.0-alpha.0 → 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 (412) hide show
  1. package/README.md +108 -136
  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 +12 -17
  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 +228 -566
  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/sessions.js +3 -8
  67. package/dist/src/commands/sessions.js.map +1 -1
  68. package/dist/src/commands/sync-app-settings.d.ts +36 -8
  69. package/dist/src/commands/sync-app-settings.js +109 -23
  70. package/dist/src/commands/sync-app-settings.js.map +1 -1
  71. package/dist/src/commands/sync.d.ts +436 -613
  72. package/dist/src/commands/sync.js +2604 -5977
  73. package/dist/src/commands/sync.js.map +1 -1
  74. package/dist/src/commands/tokens.js +4 -9
  75. package/dist/src/commands/tokens.js.map +1 -1
  76. package/dist/src/commands/users.js +77 -2
  77. package/dist/src/commands/users.js.map +1 -1
  78. package/dist/src/commands/workflows.d.ts +5 -83
  79. package/dist/src/commands/workflows.js +57 -2282
  80. package/dist/src/commands/workflows.js.map +1 -1
  81. package/dist/src/lib/aggregate-output.d.ts +25 -0
  82. package/dist/src/lib/aggregate-output.js +53 -0
  83. package/dist/src/lib/aggregate-output.js.map +1 -0
  84. package/dist/src/lib/api-client.d.ts +681 -581
  85. package/dist/src/lib/api-client.js +880 -851
  86. package/dist/src/lib/api-client.js.map +1 -1
  87. package/dist/src/lib/app-settings-descriptor.d.ts +47 -1
  88. package/dist/src/lib/app-settings-descriptor.js +114 -10
  89. package/dist/src/lib/app-settings-descriptor.js.map +1 -1
  90. package/dist/src/lib/auth-fixtures.d.ts +44 -0
  91. package/dist/src/lib/auth-fixtures.js +61 -0
  92. package/dist/src/lib/auth-fixtures.js.map +1 -0
  93. package/dist/src/lib/auth-flow.d.ts +41 -1
  94. package/dist/src/lib/auth-flow.js +70 -16
  95. package/dist/src/lib/auth-flow.js.map +1 -1
  96. package/dist/src/lib/block-layout.d.ts +12 -23
  97. package/dist/src/lib/block-layout.js +26 -92
  98. package/dist/src/lib/block-layout.js.map +1 -1
  99. package/dist/src/lib/block-selector.d.ts +2 -2
  100. package/dist/src/lib/block-selector.js +2 -2
  101. package/dist/src/lib/child-apps-local.d.ts +164 -0
  102. package/dist/src/lib/child-apps-local.js +258 -0
  103. package/dist/src/lib/child-apps-local.js.map +1 -0
  104. package/dist/src/lib/ci-session-request.d.ts +22 -0
  105. package/dist/src/lib/ci-session-request.js +51 -0
  106. package/dist/src/lib/ci-session-request.js.map +1 -0
  107. package/dist/src/lib/codegen-shared/generatedFiles.d.ts +10 -8
  108. package/dist/src/lib/codegen-shared/generatedFiles.js +21 -15
  109. package/dist/src/lib/codegen-shared/generatedFiles.js.map +1 -1
  110. package/dist/src/lib/codegen-shared/prettierStable.d.ts +1 -1
  111. package/dist/src/lib/codegen-shared/prettierStable.js +1 -1
  112. package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.d.ts +2 -2
  113. package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.js +2 -2
  114. package/dist/src/lib/collection-export.d.ts +76 -15
  115. package/dist/src/lib/collection-export.js +116 -23
  116. package/dist/src/lib/collection-export.js.map +1 -1
  117. package/dist/src/lib/collection-principal.d.ts +22 -0
  118. package/dist/src/lib/collection-principal.js +35 -0
  119. package/dist/src/lib/collection-principal.js.map +1 -0
  120. package/dist/src/lib/config-object-descriptor.d.ts +3 -22
  121. package/dist/src/lib/config-object-descriptor.js +56 -291
  122. package/dist/src/lib/config-object-descriptor.js.map +1 -1
  123. package/dist/src/lib/config-payload.js +2 -3
  124. package/dist/src/lib/config-payload.js.map +1 -1
  125. package/dist/src/lib/config-surface.d.ts +5 -7
  126. package/dist/src/lib/config-surface.js +18 -40
  127. package/dist/src/lib/config-surface.js.map +1 -1
  128. package/dist/src/lib/connections-list.d.ts +10 -0
  129. package/dist/src/lib/connections-list.js +18 -0
  130. package/dist/src/lib/connections-list.js.map +1 -0
  131. package/dist/src/lib/credentials-home.d.ts +58 -0
  132. package/dist/src/lib/credentials-home.js +204 -0
  133. package/dist/src/lib/credentials-home.js.map +1 -0
  134. package/dist/src/lib/credentials-lock.d.ts +88 -0
  135. package/dist/src/lib/credentials-lock.js +302 -0
  136. package/dist/src/lib/credentials-lock.js.map +1 -0
  137. package/dist/src/lib/credentials-store.d.ts +179 -24
  138. package/dist/src/lib/credentials-store.js +712 -77
  139. package/dist/src/lib/credentials-store.js.map +1 -1
  140. package/dist/src/lib/csv.d.ts +8 -9
  141. package/dist/src/lib/csv.js +3 -4
  142. package/dist/src/lib/csv.js.map +1 -1
  143. package/dist/src/lib/custodian.d.ts +8 -0
  144. package/dist/src/lib/custodian.js +18 -0
  145. package/dist/src/lib/custodian.js.map +1 -0
  146. package/dist/src/lib/db-codegen/dbGenerator.js +5 -16
  147. package/dist/src/lib/db-codegen/dbGenerator.js.map +1 -1
  148. package/dist/src/lib/db-codegen/dbNaming.d.ts +5 -13
  149. package/dist/src/lib/db-codegen/dbNaming.js +5 -17
  150. package/dist/src/lib/db-codegen/dbNaming.js.map +1 -1
  151. package/dist/src/lib/db-codegen/dbTemplates.d.ts +7 -56
  152. package/dist/src/lib/db-codegen/dbTemplates.js +25 -125
  153. package/dist/src/lib/db-codegen/dbTemplates.js.map +1 -1
  154. package/dist/src/lib/db-codegen/dbTsTypes.d.ts +2 -2
  155. package/dist/src/lib/db-codegen/dbTsTypes.js +2 -2
  156. package/dist/src/lib/db-codegen/dbTypeIR.d.ts +67 -2
  157. package/dist/src/lib/db-codegen/dbTypeIR.js +13 -2
  158. package/dist/src/lib/db-codegen/dbTypeIR.js.map +1 -1
  159. package/dist/src/lib/db3-export.d.ts +231 -0
  160. package/dist/src/lib/db3-export.js +510 -0
  161. package/dist/src/lib/db3-export.js.map +1 -0
  162. package/dist/src/lib/db3-index-output.d.ts +27 -0
  163. package/dist/src/lib/db3-index-output.js +49 -0
  164. package/dist/src/lib/db3-index-output.js.map +1 -0
  165. package/dist/src/lib/document-export-lookups.d.ts +31 -0
  166. package/dist/src/lib/document-export-lookups.js +53 -0
  167. package/dist/src/lib/document-export-lookups.js.map +1 -0
  168. package/dist/src/lib/document-export-permissions.d.ts +7 -5
  169. package/dist/src/lib/document-export-permissions.js +7 -5
  170. package/dist/src/lib/document-export-permissions.js.map +1 -1
  171. package/dist/src/lib/document-export-record-log.d.ts +57 -0
  172. package/dist/src/lib/document-export-record-log.js +215 -0
  173. package/dist/src/lib/document-export-record-log.js.map +1 -0
  174. package/dist/src/lib/document-ingest-artifact.d.ts +26 -2
  175. package/dist/src/lib/document-ingest-artifact.js +42 -8
  176. package/dist/src/lib/document-ingest-artifact.js.map +1 -1
  177. package/dist/src/lib/document-ingest-format2.d.ts +36 -0
  178. package/dist/src/lib/document-ingest-format2.js +78 -0
  179. package/dist/src/lib/document-ingest-format2.js.map +1 -0
  180. package/dist/src/lib/document-ingest-input.d.ts +9 -0
  181. package/dist/src/lib/document-ingest-input.js +28 -1
  182. package/dist/src/lib/document-ingest-input.js.map +1 -1
  183. package/dist/src/lib/document-ingest-rows.d.ts +16 -0
  184. package/dist/src/lib/document-ingest-rows.js +17 -0
  185. package/dist/src/lib/document-ingest-rows.js.map +1 -1
  186. package/dist/src/lib/document-ingest.d.ts +33 -1
  187. package/dist/src/lib/document-ingest.js +49 -0
  188. package/dist/src/lib/document-ingest.js.map +1 -1
  189. package/dist/src/lib/document-schema-rows.d.ts +42 -0
  190. package/dist/src/lib/document-schema-rows.js +53 -0
  191. package/dist/src/lib/document-schema-rows.js.map +1 -0
  192. package/dist/src/lib/env-resolver-core.d.ts +70 -2
  193. package/dist/src/lib/env-resolver-core.js +137 -20
  194. package/dist/src/lib/env-resolver-core.js.map +1 -1
  195. package/dist/src/lib/env-resolver.d.ts +14 -2
  196. package/dist/src/lib/env-resolver.js +32 -10
  197. package/dist/src/lib/env-resolver.js.map +1 -1
  198. package/dist/src/lib/function-authorize-check.d.ts +142 -0
  199. package/dist/src/lib/function-authorize-check.js +310 -0
  200. package/dist/src/lib/function-authorize-check.js.map +1 -0
  201. package/dist/src/lib/function-authorize-view.d.ts +15 -0
  202. package/dist/src/lib/function-authorize-view.js +50 -0
  203. package/dist/src/lib/function-authorize-view.js.map +1 -0
  204. package/dist/src/lib/function-bundle.d.ts +38 -18
  205. package/dist/src/lib/function-bundle.js +96 -35
  206. package/dist/src/lib/function-bundle.js.map +1 -1
  207. package/dist/src/lib/function-collect.d.ts +75 -12
  208. package/dist/src/lib/function-collect.js +427 -12
  209. package/dist/src/lib/function-collect.js.map +1 -1
  210. package/dist/src/lib/function-db-types.d.ts +29 -0
  211. package/dist/src/lib/function-db-types.js +117 -7
  212. package/dist/src/lib/function-db-types.js.map +1 -1
  213. package/dist/src/lib/function-document-types.d.ts +5 -3
  214. package/dist/src/lib/function-document-types.js +10 -14
  215. package/dist/src/lib/function-document-types.js.map +1 -1
  216. package/dist/src/lib/function-lint.d.ts +34 -0
  217. package/dist/src/lib/function-lint.js +112 -0
  218. package/dist/src/lib/function-lint.js.map +1 -0
  219. package/dist/src/lib/function-log-row.js +21 -2
  220. package/dist/src/lib/function-log-row.js.map +1 -1
  221. package/dist/src/lib/function-run.d.ts +16 -21
  222. package/dist/src/lib/function-run.js +37 -30
  223. package/dist/src/lib/function-run.js.map +1 -1
  224. package/dist/src/lib/function-schema-codegen.d.ts +1 -1
  225. package/dist/src/lib/function-schema-codegen.js +5 -5
  226. package/dist/src/lib/function-schema-codegen.js.map +1 -1
  227. package/dist/src/lib/function-source-roots.d.ts +67 -0
  228. package/dist/src/lib/function-source-roots.js +148 -0
  229. package/dist/src/lib/function-source-roots.js.map +1 -0
  230. package/dist/src/lib/function-sync.d.ts +108 -22
  231. package/dist/src/lib/function-sync.js +127 -39
  232. package/dist/src/lib/function-sync.js.map +1 -1
  233. package/dist/src/lib/function-trigger-listing.d.ts +11 -6
  234. package/dist/src/lib/function-trigger-listing.js +32 -11
  235. package/dist/src/lib/function-trigger-listing.js.map +1 -1
  236. package/dist/src/lib/function-typecheck.d.ts +37 -2
  237. package/dist/src/lib/function-typecheck.js +210 -28
  238. package/dist/src/lib/function-typecheck.js.map +1 -1
  239. package/dist/src/lib/function-versions.d.ts +2 -0
  240. package/dist/src/lib/function-versions.js +1 -0
  241. package/dist/src/lib/function-versions.js.map +1 -1
  242. package/dist/src/lib/generated-allowlist.js +0 -20
  243. package/dist/src/lib/generated-allowlist.js.map +1 -1
  244. package/dist/src/lib/generated-config-surfaces.d.ts +703 -201
  245. package/dist/src/lib/generated-config-surfaces.js +2335 -2033
  246. package/dist/src/lib/generated-config-surfaces.js.map +1 -1
  247. package/dist/src/lib/generated-sdk-types.d.ts +1 -1
  248. package/dist/src/lib/generated-sdk-types.js +1 -1
  249. package/dist/src/lib/generated-sdk-types.js.map +1 -1
  250. package/dist/src/lib/init-adopt.js +12 -3
  251. package/dist/src/lib/init-adopt.js.map +1 -1
  252. package/dist/src/lib/init-login-note.d.ts +13 -0
  253. package/dist/src/lib/init-login-note.js +22 -0
  254. package/dist/src/lib/init-login-note.js.map +1 -0
  255. package/dist/src/lib/json-value.d.ts +6 -0
  256. package/dist/src/lib/json-value.js +13 -0
  257. package/dist/src/lib/json-value.js.map +1 -0
  258. package/dist/src/lib/load-routes.d.ts +33 -0
  259. package/dist/src/lib/load-routes.js +35 -0
  260. package/dist/src/lib/load-routes.js.map +1 -0
  261. package/dist/src/lib/local-state.d.ts +38 -7
  262. package/dist/src/lib/local-state.js +172 -49
  263. package/dist/src/lib/local-state.js.map +1 -1
  264. package/dist/src/lib/local-test-cases.d.ts +5 -2
  265. package/dist/src/lib/local-test-cases.js +7 -4
  266. package/dist/src/lib/local-test-cases.js.map +1 -1
  267. package/dist/src/lib/log-inspection.d.ts +42 -4
  268. package/dist/src/lib/log-inspection.js +37 -5
  269. package/dist/src/lib/log-inspection.js.map +1 -1
  270. package/dist/src/lib/login-exchange-check.d.ts +18 -0
  271. package/dist/src/lib/login-exchange-check.js +27 -0
  272. package/dist/src/lib/login-exchange-check.js.map +1 -0
  273. package/dist/src/lib/login-scope-lines.d.ts +25 -0
  274. package/dist/src/lib/login-scope-lines.js +45 -0
  275. package/dist/src/lib/login-scope-lines.js.map +1 -0
  276. package/dist/src/lib/logout-admin-session.d.ts +2 -1
  277. package/dist/src/lib/logout-admin-session.js +7 -1
  278. package/dist/src/lib/logout-admin-session.js.map +1 -1
  279. package/dist/src/lib/object-status-filter.d.ts +9 -1
  280. package/dist/src/lib/object-status-filter.js +9 -1
  281. package/dist/src/lib/object-status-filter.js.map +1 -1
  282. package/dist/src/lib/output.js +2 -0
  283. package/dist/src/lib/output.js.map +1 -1
  284. package/dist/src/lib/paginate.d.ts +0 -5
  285. package/dist/src/lib/paginate.js +0 -5
  286. package/dist/src/lib/paginate.js.map +1 -1
  287. package/dist/src/lib/pin-refusal-hint.d.ts +12 -0
  288. package/dist/src/lib/pin-refusal-hint.js +35 -0
  289. package/dist/src/lib/pin-refusal-hint.js.map +1 -0
  290. package/dist/src/lib/primitive-env-plugin.d.ts +99 -0
  291. package/dist/src/lib/primitive-env-plugin.js +408 -0
  292. package/dist/src/lib/primitive-env-plugin.js.map +1 -0
  293. package/dist/src/lib/project-config.d.ts +7 -0
  294. package/dist/src/lib/project-config.js +22 -1
  295. package/dist/src/lib/project-config.js.map +1 -1
  296. package/dist/src/lib/project-login-apps.d.ts +8 -0
  297. package/dist/src/lib/project-login-apps.js +27 -0
  298. package/dist/src/lib/project-login-apps.js.map +1 -0
  299. package/dist/src/lib/prompt-schema-codegen.d.ts +10 -3
  300. package/dist/src/lib/prompt-schema-codegen.js +52 -11
  301. package/dist/src/lib/prompt-schema-codegen.js.map +1 -1
  302. package/dist/src/lib/pull-write.d.ts +31 -0
  303. package/dist/src/lib/pull-write.js +49 -0
  304. package/dist/src/lib/pull-write.js.map +1 -0
  305. package/dist/src/lib/push-failure-report.d.ts +45 -0
  306. package/dist/src/lib/push-failure-report.js +57 -0
  307. package/dist/src/lib/push-failure-report.js.map +1 -0
  308. package/dist/src/lib/records-verbs.d.ts +69 -0
  309. package/dist/src/lib/records-verbs.js +40 -0
  310. package/dist/src/lib/records-verbs.js.map +1 -0
  311. package/dist/src/lib/refresh-admin-credentials.d.ts +7 -0
  312. package/dist/src/lib/refresh-admin-credentials.js +16 -4
  313. package/dist/src/lib/refresh-admin-credentials.js.map +1 -1
  314. package/dist/src/lib/root-import-decision.d.ts +65 -0
  315. package/dist/src/lib/root-import-decision.js +109 -0
  316. package/dist/src/lib/root-import-decision.js.map +1 -0
  317. package/dist/src/lib/run-status.d.ts +1 -1
  318. package/dist/src/lib/run-status.generated.d.ts +2 -2
  319. package/dist/src/lib/run-status.generated.js +3 -1
  320. package/dist/src/lib/run-status.generated.js.map +1 -1
  321. package/dist/src/lib/run-status.js +1 -1
  322. package/dist/src/lib/schema-codegen/generated-schema-descriptor.d.ts +129 -0
  323. package/dist/src/lib/schema-codegen/generated-schema-descriptor.js +269 -0
  324. package/dist/src/lib/schema-codegen/generated-schema-descriptor.js.map +1 -0
  325. package/dist/src/lib/schema-codegen/naming.d.ts +35 -0
  326. package/dist/src/lib/schema-codegen/naming.js +83 -0
  327. package/dist/src/lib/schema-codegen/naming.js.map +1 -0
  328. package/dist/src/lib/schema-codegen/schemaToTs.d.ts +82 -0
  329. package/dist/src/lib/schema-codegen/schemaToTs.js +305 -0
  330. package/dist/src/lib/schema-codegen/schemaToTs.js.map +1 -0
  331. package/dist/src/lib/scope-request.d.ts +84 -0
  332. package/dist/src/lib/scope-request.js +235 -0
  333. package/dist/src/lib/scope-request.js.map +1 -0
  334. package/dist/src/lib/session-id.d.ts +9 -0
  335. package/dist/src/lib/session-id.js +28 -0
  336. package/dist/src/lib/session-id.js.map +1 -0
  337. package/dist/src/lib/snapshot-build-rows.d.ts +21 -0
  338. package/dist/src/lib/snapshot-build-rows.js +22 -0
  339. package/dist/src/lib/snapshot-build-rows.js.map +1 -1
  340. package/dist/src/lib/snapshot-build.js +8 -3
  341. package/dist/src/lib/snapshot-build.js.map +1 -1
  342. package/dist/src/lib/snapshots.d.ts +17 -1
  343. package/dist/src/lib/snapshots.js +50 -2
  344. package/dist/src/lib/snapshots.js.map +1 -1
  345. package/dist/src/lib/swift-codegen/agentGenerator.d.ts +6 -2
  346. package/dist/src/lib/swift-codegen/agentGenerator.js +57 -5
  347. package/dist/src/lib/swift-codegen/agentGenerator.js.map +1 -1
  348. package/dist/src/lib/swift-codegen/banners.d.ts +34 -7
  349. package/dist/src/lib/swift-codegen/banners.js +37 -7
  350. package/dist/src/lib/swift-codegen/banners.js.map +1 -1
  351. package/dist/src/lib/swift-codegen/dbGenerator.d.ts +4 -3
  352. package/dist/src/lib/swift-codegen/dbGenerator.js +14 -117
  353. package/dist/src/lib/swift-codegen/dbGenerator.js.map +1 -1
  354. package/dist/src/lib/swift-codegen/functionGenerator.d.ts +3 -3
  355. package/dist/src/lib/swift-codegen/functionGenerator.js +23 -18
  356. package/dist/src/lib/swift-codegen/functionGenerator.js.map +1 -1
  357. package/dist/src/lib/swift-codegen/generator.d.ts +5 -5
  358. package/dist/src/lib/swift-codegen/generator.js +35 -40
  359. package/dist/src/lib/swift-codegen/generator.js.map +1 -1
  360. package/dist/src/lib/swift-codegen/schemaToSwift.d.ts +3 -3
  361. package/dist/src/lib/swift-codegen/schemaToSwift.js +4 -4
  362. package/dist/src/lib/swift-codegen/schemaToSwift.js.map +1 -1
  363. package/dist/src/lib/swift-codegen/swiftKeys.d.ts +19 -0
  364. package/dist/src/lib/swift-codegen/swiftKeys.js +31 -0
  365. package/dist/src/lib/swift-codegen/swiftKeys.js.map +1 -0
  366. package/dist/src/lib/sync-paths.d.ts +35 -0
  367. package/dist/src/lib/sync-paths.js +57 -5
  368. package/dist/src/lib/sync-paths.js.map +1 -1
  369. package/dist/src/lib/sync-resource-types.d.ts +26 -26
  370. package/dist/src/lib/sync-resource-types.js +61 -189
  371. package/dist/src/lib/sync-resource-types.js.map +1 -1
  372. package/dist/src/lib/sync-selectors.d.ts +5 -1
  373. package/dist/src/lib/sync-selectors.js +23 -13
  374. package/dist/src/lib/sync-selectors.js.map +1 -1
  375. package/dist/src/lib/test-case-file-names.d.ts +3 -5
  376. package/dist/src/lib/test-case-file-names.js +3 -5
  377. package/dist/src/lib/test-case-file-names.js.map +1 -1
  378. package/dist/src/lib/toml-database-config.d.ts +15 -75
  379. package/dist/src/lib/toml-database-config.js +17 -306
  380. package/dist/src/lib/toml-database-config.js.map +1 -1
  381. package/dist/src/lib/transient-retry.d.ts +43 -0
  382. package/dist/src/lib/transient-retry.js +94 -0
  383. package/dist/src/lib/transient-retry.js.map +1 -0
  384. package/dist/src/lib/vars-override.d.ts +105 -0
  385. package/dist/src/lib/vars-override.js +143 -0
  386. package/dist/src/lib/vars-override.js.map +1 -0
  387. package/dist/src/lib/webhook-capture.d.ts +43 -0
  388. package/dist/src/lib/webhook-capture.js +91 -0
  389. package/dist/src/lib/webhook-capture.js.map +1 -0
  390. package/dist/src/lib/webhook-deliver.d.ts +18 -20
  391. package/dist/src/lib/webhook-deliver.js +34 -89
  392. package/dist/src/lib/webhook-deliver.js.map +1 -1
  393. package/dist/src/lib/webhook-test-run.d.ts +32 -0
  394. package/dist/src/lib/webhook-test-run.js +108 -0
  395. package/dist/src/lib/webhook-test-run.js.map +1 -0
  396. package/dist/src/lib/workflow-codegen/generator.d.ts +7 -7
  397. package/dist/src/lib/workflow-codegen/generator.js +16 -23
  398. package/dist/src/lib/workflow-codegen/generator.js.map +1 -1
  399. package/dist/src/lib/workflow-codegen/invokerIR.d.ts +6 -12
  400. package/dist/src/lib/workflow-codegen/invokerIR.js +4 -5
  401. package/dist/src/lib/workflow-codegen/invokerIR.js.map +1 -1
  402. package/dist/src/lib/workflow-toml-validator.d.ts +2 -0
  403. package/dist/src/lib/workflow-toml-validator.js +28 -1
  404. package/dist/src/lib/workflow-toml-validator.js.map +1 -1
  405. package/dist/src/types/index.d.ts +30 -37
  406. package/dist/src/validators.d.ts +7 -55
  407. package/dist/src/validators.js +7 -53
  408. package/dist/src/validators.js.map +1 -1
  409. package/dist/src/vite.d.ts +17 -0
  410. package/dist/src/vite.js +18 -0
  411. package/dist/src/vite.js.map +1 -0
  412. package/package.json +20 -12
@@ -0,0 +1,269 @@
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 function isType(value, type) {
51
+ if (type === "array")
52
+ return Array.isArray(value);
53
+ if (type === "object")
54
+ return !!value && typeof value === "object" && !Array.isArray(value);
55
+ if (type === "string")
56
+ return typeof value === "string";
57
+ if (type === "number")
58
+ return typeof value === "number" && !Number.isNaN(value);
59
+ if (type === "integer")
60
+ return Number.isInteger(value);
61
+ if (type === "boolean")
62
+ return typeof value === "boolean";
63
+ if (type === "null")
64
+ return value === null;
65
+ // Unknown type name: nothing to enforce, so treat as a match (the validator
66
+ // must not reject a value against a keyword it does not model).
67
+ return true;
68
+ }
69
+ const EMPTY_DESCRIPTOR = {
70
+ isUnion: false,
71
+ singularType: null,
72
+ types: [],
73
+ enumValues: null,
74
+ object: null,
75
+ array: null,
76
+ oneOf: null,
77
+ };
78
+ /**
79
+ * Sibling constraint keywords that make a `oneOf` node a MIXED schema rather
80
+ * than a clean tagged union (#1511). A clean discriminated union carries only
81
+ * the `oneOf` keyword (plus annotations like `description`/`title`); it never
82
+ * combines with a top-level `type`/`properties`/`required`/`additionalProperties`/
83
+ * `items`/`enum`. When any of these co-occur with `oneOf`, the validator's
84
+ * branch-select would early-return and skip those sibling constraints, silently
85
+ * loosening validation. So a mixed node is NOT treated as a clean tagged union.
86
+ */
87
+ const ONEOF_SIBLING_CONSTRAINT_KEYS = [
88
+ "type",
89
+ "properties",
90
+ "required",
91
+ "additionalProperties",
92
+ "items",
93
+ "enum",
94
+ ];
95
+ function hasOneOfSiblingConstraints(schema) {
96
+ return ONEOF_SIBLING_CONSTRAINT_KEYS.some((k) => Object.prototype.hasOwnProperty.call(schema, k));
97
+ }
98
+ /**
99
+ * A discriminator tag must be a comparable scalar (string/number/boolean) so
100
+ * the validator's strict-`===` branch-select can match it against a JSON-parsed
101
+ * value (#1511). An object/array literal is structurally identical after a JSON
102
+ * round-trip but never the same reference, so it would always "match no case".
103
+ * Restricting the auto-detected discriminator to scalars keeps a non-scalar tag
104
+ * from being treated as a (never-matchable) discriminator.
105
+ */
106
+ function isScalarDiscriminatorLiteral(value) {
107
+ return (typeof value === "string" ||
108
+ typeof value === "number" ||
109
+ typeof value === "boolean");
110
+ }
111
+ /**
112
+ * Interpret a `oneOf`/`anyOf` node as a discriminated (tagged) union (#1511).
113
+ *
114
+ * The tagged-union interpretation is scoped to a clearly-intended tagged union:
115
+ * EVERY member must be `type: "object"`. Anything else (a mixed/scalar `oneOf`)
116
+ * returns `null` and is ignored downstream, exactly as before.
117
+ *
118
+ * Within that scope:
119
+ * - `anyOf` is not supported in v1 → `invalid` (codegen error suggests `oneOf`);
120
+ * - a `oneOf` with fewer than 2 members → `invalid`;
121
+ * - the discriminator is auto-detected: the single property present in EVERY
122
+ * member as a single-literal `enum` whose literal is a comparable scalar
123
+ * (string/number/boolean), with distinct literals across members (a
124
+ * non-scalar literal is not a candidate — see `isScalarDiscriminatorLiteral`);
125
+ * - zero or more-than-one candidate discriminator → `invalid` (ambiguity).
126
+ *
127
+ * Pure and dependency-free so the CLI can vendor a byte-for-byte copy.
128
+ */
129
+ function describeOneOf(schema) {
130
+ const rawOneOf = Array.isArray(schema.oneOf) ? schema.oneOf : null;
131
+ const rawAnyOf = Array.isArray(schema.anyOf) ? schema.anyOf : null;
132
+ // `oneOf` takes precedence; only one keyword is interpreted per node.
133
+ const keyword = rawOneOf
134
+ ? "oneOf"
135
+ : rawAnyOf
136
+ ? "anyOf"
137
+ : null;
138
+ const members = rawOneOf ?? rawAnyOf;
139
+ if (!keyword || !members)
140
+ return null;
141
+ // Scope to a clearly-intended tagged union: every member is `type: "object"`.
142
+ // A member that is not a plain object type means this is NOT a tagged union;
143
+ // leave it to the existing ignore-and-render-`unknown` path (backward compat).
144
+ const allObjects = members.length >= 1 &&
145
+ members.every((m) => !!m &&
146
+ typeof m === "object" &&
147
+ !Array.isArray(m) &&
148
+ m.type === "object");
149
+ if (!allObjects)
150
+ return null;
151
+ // `anyOf` is not supported in v1 (resolved Fork 1 = oneOf only). An all-object
152
+ // `anyOf` that looks like a tagged union gets a clear error suggesting oneOf.
153
+ if (keyword === "anyOf") {
154
+ return {
155
+ kind: "invalid",
156
+ reason: "anyOf is not supported for discriminated unions (issue #1511). Use oneOf instead.",
157
+ };
158
+ }
159
+ if (members.length < 2) {
160
+ return {
161
+ kind: "invalid",
162
+ reason: "A discriminated-union oneOf needs at least 2 object members (issue #1511).",
163
+ };
164
+ }
165
+ // For each member, collect its single-literal-enum properties → { name: literal }.
166
+ // The literal must be a comparable scalar (string/number/boolean): the
167
+ // validator branch-selects with strict `===`, so a non-scalar tag (object or
168
+ // array) on a JSON-parsed value is never the same reference as the schema
169
+ // literal and would always "match no case". Restricting the auto-detected
170
+ // discriminator to scalars means a non-scalar tag is not a candidate, so the
171
+ // union routes through the normal not-a-tagged-union path (below) instead of
172
+ // being accepted as a union that can never validate.
173
+ const memberLiteralProps = members.map((m) => {
174
+ const map = new Map();
175
+ const props = m.properties;
176
+ if (props && typeof props === "object" && !Array.isArray(props)) {
177
+ for (const [name, sub] of Object.entries(props)) {
178
+ if (sub &&
179
+ typeof sub === "object" &&
180
+ Array.isArray(sub.enum) &&
181
+ sub.enum.length === 1 &&
182
+ isScalarDiscriminatorLiteral(sub.enum[0])) {
183
+ map.set(name, sub.enum[0]);
184
+ }
185
+ }
186
+ }
187
+ return map;
188
+ });
189
+ // A candidate discriminator is present as a single-literal enum in EVERY
190
+ // member, with distinct literals across members (so a value's tag selects
191
+ // exactly one branch).
192
+ const candidates = [];
193
+ for (const name of memberLiteralProps[0].keys()) {
194
+ if (!memberLiteralProps.every((mp) => mp.has(name)))
195
+ continue;
196
+ const literals = memberLiteralProps.map((mp) => mp.get(name));
197
+ const distinct = new Set(literals.map((l) => JSON.stringify(l)));
198
+ if (distinct.size === literals.length)
199
+ candidates.push(name);
200
+ }
201
+ if (candidates.length !== 1) {
202
+ return {
203
+ kind: "invalid",
204
+ reason: candidates.length === 0
205
+ ? "No discriminator found for the oneOf tagged union (issue #1511): every member must share exactly one property declared as a distinct single-literal enum."
206
+ : `Ambiguous discriminator for the oneOf tagged union (issue #1511): multiple candidate properties (${candidates.join(", ")}). Exactly one is required.`,
207
+ };
208
+ }
209
+ // A clean tagged union carries ONLY `oneOf`. If it co-occurs with sibling
210
+ // top-level constraints (`type`, `properties`, `required`,
211
+ // `additionalProperties`, `items`, `enum`), it is a MIXED schema, not a clean
212
+ // tagged union: the validator's branch-select would early-return and skip
213
+ // those siblings, loosening validation. Reject-mixed keeps all three
214
+ // consumers fail-closed — the validator falls through to the normal
215
+ // type/object gates (still enforcing the siblings, exactly as before #1511),
216
+ // codegen throws this `reason`, and the request guard flags `unsupported-oneof`.
217
+ if (hasOneOfSiblingConstraints(schema)) {
218
+ return {
219
+ kind: "invalid",
220
+ reason: "A discriminated-union oneOf must be the only top-level constraint (issue #1511): it cannot be combined with sibling type/properties/required/additionalProperties/items/enum. Move the shared constraints into each member instead.",
221
+ };
222
+ }
223
+ const discriminant = candidates[0];
224
+ return {
225
+ kind: "valid",
226
+ discriminant,
227
+ members: members.map((m, i) => ({
228
+ discriminantValue: memberLiteralProps[i].get(discriminant),
229
+ schema: m,
230
+ })),
231
+ };
232
+ }
233
+ /**
234
+ * Interpret a parsed schema node. A non-object schema (null, array, scalar)
235
+ * enforces nothing → the empty descriptor.
236
+ */
237
+ export function describeSchema(schema) {
238
+ if (!schema || typeof schema !== "object" || Array.isArray(schema)) {
239
+ return EMPTY_DESCRIPTOR;
240
+ }
241
+ const typeSpec = schema.type;
242
+ const isUnion = Array.isArray(typeSpec);
243
+ const singularType = typeof typeSpec === "string" ? typeSpec : null;
244
+ // Mirror the validator's normalization exactly: an array stays an array; a
245
+ // truthy non-array becomes `[typeSpec]`; anything falsy is `[]`.
246
+ const types = isUnion ? typeSpec : typeSpec ? [typeSpec] : [];
247
+ const enumValues = Array.isArray(schema.enum)
248
+ ? schema.enum
249
+ : null;
250
+ const props = schema.properties;
251
+ const object = singularType === "object" &&
252
+ props &&
253
+ typeof props === "object" &&
254
+ !Array.isArray(props)
255
+ ? {
256
+ properties: props,
257
+ required: Array.isArray(schema.required)
258
+ ? schema.required
259
+ : [],
260
+ additionalPropertiesClosed: schema.additionalProperties === false,
261
+ }
262
+ : null;
263
+ const array = singularType === "array" && schema.items
264
+ ? { items: schema.items }
265
+ : null;
266
+ const oneOf = describeOneOf(schema);
267
+ return { isUnion, singularType, types, enumValues, object, array, oneOf };
268
+ }
269
+ //# sourceMappingURL=generated-schema-descriptor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated-schema-descriptor.js","sourceRoot":"","sources":["../../../../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KAAK;QACL,OAAO,KAAK,KAAK,QAAQ;QACzB,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QACnB,CAAC,CAAC;YACE,UAAU,EAAE,KAA4B;YACxC,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAE,MAAc,CAAC,QAAQ,CAAC;gBAC/C,CAAC,CAAE,MAAc,CAAC,QAAQ;gBAC1B,CAAC,CAAC,EAAE;YACN,0BAA0B,EACvB,MAAc,CAAC,oBAAoB,KAAK,KAAK;SACjD;QACH,CAAC,CAAC,IAAI,CAAC;IAEX,MAAM,KAAK,GACT,YAAY,KAAK,OAAO,IAAK,MAAc,CAAC,KAAK;QAC/C,CAAC,CAAC,EAAE,KAAK,EAAG,MAAc,CAAC,KAAK,EAAE;QAClC,CAAC,CAAC,IAAI,CAAC;IAEX,MAAM,KAAK,GAAG,aAAa,CAAC,MAA6B,CAAC,CAAC;IAE3D,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;AAC5E,CAAC"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Identifier-naming helpers for the schema codegens (issue #1442, written for
3
+ * `workflows codegen`; `functions codegen` and the prompt codegen read them
4
+ * since #3190 retired it).
5
+ *
6
+ * Keys resolve case-insensitively server-side and may contain
7
+ * characters that aren't valid TS identifiers (`.`, `-`). Only the emitted
8
+ * identifiers are sanitized — the runtime call always passes the ORIGINAL key
9
+ * string.
10
+ *
11
+ * Type names: `pascalCase(key) + "Input" | "Output"` (reuses `pascalCase` from
12
+ * the database codegen so the two commands share one PascalCase rule).
13
+ * Factory property: a camelCase form of the key.
14
+ */
15
+ /**
16
+ * `create-checkout-session` / `createCheckoutSession` → `CreateCheckoutSession`.
17
+ * A digit-leading key (`123-job` → `_123Job`) is prefixed with `_` so the
18
+ * emitted type name is a valid TS identifier.
19
+ */
20
+ export declare function workflowTypeBaseName(key: string): string;
21
+ /** PascalCase base + `Input` (e.g. `CreateCheckoutSessionInput`). */
22
+ export declare function workflowInputTypeName(key: string): string;
23
+ /** PascalCase base + `Output` (e.g. `CreateCheckoutSessionOutput`). */
24
+ export declare function workflowOutputTypeName(key: string): string;
25
+ /**
26
+ * camelCase factory function name for a workflow key: PascalCase, then lowercase
27
+ * the first character (`create-checkout-session` → `createCheckoutSession`,
28
+ * `refresh-sheet` → `refreshSheet`). Used as the top-level exported factory
29
+ * function name in the per-workflow generated file, so it must be a legal
30
+ * function identifier: a digit-leading key (`123-job` → `_123Job`) is
31
+ * underscore-prefixed, and a key that lands on a JS reserved word (`delete`,
32
+ * `new`, `import`) is underscore-suffixed (`delete_`). Only the emitted
33
+ * identifier changes; the runtime call still passes the ORIGINAL key string.
34
+ */
35
+ export declare function workflowFactoryName(key: string): string;
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Identifier-naming helpers for the schema codegens (issue #1442, written for
3
+ * `workflows codegen`; `functions codegen` and the prompt codegen read them
4
+ * since #3190 retired it).
5
+ *
6
+ * Keys resolve case-insensitively server-side and may contain
7
+ * characters that aren't valid TS identifiers (`.`, `-`). Only the emitted
8
+ * identifiers are sanitized — the runtime call always passes the ORIGINAL key
9
+ * string.
10
+ *
11
+ * Type names: `pascalCase(key) + "Input" | "Output"` (reuses `pascalCase` from
12
+ * the database codegen so the two commands share one PascalCase rule).
13
+ * Factory property: a camelCase form of the key.
14
+ */
15
+ import { pascalCase } from "../db-codegen/dbNaming.js";
16
+ /**
17
+ * Ensure an identifier is a valid TS identifier start. The server accepts
18
+ * workflow keys matching `^[a-z0-9][a-z0-9-_]{2,}$`, so a digit-leading key
19
+ * like `123-job` PascalCases to `123Job` — not a legal TS type name or
20
+ * unquoted object property, since identifiers can't start with a digit.
21
+ * Prefix an underscore in that case (`123Job` → `_123Job`). Only the emitted
22
+ * identifier changes; the runtime call still passes the ORIGINAL key string.
23
+ */
24
+ function ensureValidIdentifierStart(name) {
25
+ const first = name.charAt(0);
26
+ if (first >= "0" && first <= "9") {
27
+ return `_${name}`;
28
+ }
29
+ return name;
30
+ }
31
+ /**
32
+ * `create-checkout-session` / `createCheckoutSession` → `CreateCheckoutSession`.
33
+ * A digit-leading key (`123-job` → `_123Job`) is prefixed with `_` so the
34
+ * emitted type name is a valid TS identifier.
35
+ */
36
+ export function workflowTypeBaseName(key) {
37
+ return ensureValidIdentifierStart(pascalCase(key));
38
+ }
39
+ /** PascalCase base + `Input` (e.g. `CreateCheckoutSessionInput`). */
40
+ export function workflowInputTypeName(key) {
41
+ return `${workflowTypeBaseName(key)}Input`;
42
+ }
43
+ /** PascalCase base + `Output` (e.g. `CreateCheckoutSessionOutput`). */
44
+ export function workflowOutputTypeName(key) {
45
+ return `${workflowTypeBaseName(key)}Output`;
46
+ }
47
+ /**
48
+ * Reserved words that cannot be used as a bare `function <name>` declaration.
49
+ * The per-workflow factory is now a top-level exported function (not an
50
+ * object-literal property), so a key that camelCases to one of these must be
51
+ * escaped or `export function delete(client) {}` is a syntax error. Covers ES
52
+ * reserved words plus the strict-mode/future set — a workflow key resolves case
53
+ * -insensitively and matches `^[a-z0-9][a-z0-9-_]{2,}$`, so only the lowercase
54
+ * single-word forms can actually collide.
55
+ */
56
+ const RESERVED_WORDS = new Set([
57
+ "break", "case", "catch", "class", "const", "continue", "debugger",
58
+ "default", "delete", "do", "else", "enum", "export", "extends", "false",
59
+ "finally", "for", "function", "if", "import", "in", "instanceof", "new",
60
+ "null", "return", "super", "switch", "this", "throw", "true", "try",
61
+ "typeof", "var", "void", "while", "with", "yield", "let", "static",
62
+ "implements", "interface", "package", "private", "protected", "public",
63
+ "await",
64
+ ]);
65
+ /**
66
+ * camelCase factory function name for a workflow key: PascalCase, then lowercase
67
+ * the first character (`create-checkout-session` → `createCheckoutSession`,
68
+ * `refresh-sheet` → `refreshSheet`). Used as the top-level exported factory
69
+ * function name in the per-workflow generated file, so it must be a legal
70
+ * function identifier: a digit-leading key (`123-job` → `_123Job`) is
71
+ * underscore-prefixed, and a key that lands on a JS reserved word (`delete`,
72
+ * `new`, `import`) is underscore-suffixed (`delete_`). Only the emitted
73
+ * identifier changes; the runtime call still passes the ORIGINAL key string.
74
+ */
75
+ export function workflowFactoryName(key) {
76
+ const pascal = pascalCase(key);
77
+ if (pascal.length === 0)
78
+ return pascal;
79
+ const camel = pascal.charAt(0).toLowerCase() + pascal.slice(1);
80
+ const safeStart = ensureValidIdentifierStart(camel);
81
+ return RESERVED_WORDS.has(safeStart) ? `${safeStart}_` : safeStart;
82
+ }
83
+ //# sourceMappingURL=naming.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"naming.js","sourceRoot":"","sources":["../../../../src/lib/schema-codegen/naming.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAEvD;;;;;;;GAOG;AACH,SAAS,0BAA0B,CAAC,IAAY;IAC9C,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAC7B,IAAI,KAAK,IAAI,GAAG,IAAI,KAAK,IAAI,GAAG,EAAE,CAAC;QACjC,OAAO,IAAI,IAAI,EAAE,CAAC;IACpB,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,GAAW;IAC9C,OAAO,0BAA0B,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;AACrD,CAAC;AAED,qEAAqE;AACrE,MAAM,UAAU,qBAAqB,CAAC,GAAW;IAC/C,OAAO,GAAG,oBAAoB,CAAC,GAAG,CAAC,OAAO,CAAC;AAC7C,CAAC;AAED,uEAAuE;AACvE,MAAM,UAAU,sBAAsB,CAAC,GAAW;IAChD,OAAO,GAAG,oBAAoB,CAAC,GAAG,CAAC,QAAQ,CAAC;AAC9C,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC;IAC7B,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU;IAClE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO;IACvE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK;IACvE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK;IACnE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ;IAClE,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ;IACtE,OAAO;CACR,CAAC,CAAC;AAEH;;;;;;;;;GASG;AACH,MAAM,UAAU,mBAAmB,CAAC,GAAW;IAC7C,MAAM,MAAM,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;IAC/B,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,MAAM,CAAC;IACvC,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC/D,MAAM,SAAS,GAAG,0BAA0B,CAAC,KAAK,CAAC,CAAC;IACpD,OAAO,cAAc,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC;AACrE,CAAC"}
@@ -0,0 +1,82 @@
1
+ /**
2
+ * JSON-Schema → TypeScript converter shared by `functions codegen` and the
3
+ * prompt codegen (issue #1442, written for `workflows codegen`, which #3190
4
+ * retired).
5
+ *
6
+ * An `inputSchema`/`outputSchema` is real JSON Schema. This converter
7
+ * types only the subset the server's validator descends into — and it reads
8
+ * that interpretation from the SAME descriptor the server validator consumes,
9
+ * vendored into the CLI as `generated-schema-descriptor.ts` (a byte copy of
10
+ * `src/function-runs/schema-descriptor.ts`, kept fresh by
11
+ * `cli/scripts/gen-schema-descriptor.mjs` + its drift guard). So the
12
+ * generated type and the runtime validation can never disagree on:
13
+ *
14
+ * - `type` single scalar (`string`/`number`/`integer`/`boolean`/`null`) →
15
+ * the mapped TS scalar.
16
+ * - `type` array-union — only when every member is a scalar/`null` → a TS
17
+ * union. A union that contains `object` or `array` renders `unknown`,
18
+ * because the server only walks `properties`/`items` for the bare string
19
+ * `"object"`/`"array"` — a union is never descended, so a precise-looking
20
+ * type would over-promise.
21
+ * - `enum` → a scalar-literal union, intersected with the declared `type`
22
+ * first (the server gates on `type` before checking `enum`).
23
+ * - `type: "object"` with `properties` → a nested object type; `required[]`
24
+ * drives `name:` vs `name?:`. An OPEN object (no `additionalProperties:
25
+ * false`) also emits `[key: string]: unknown` so extra keys the runtime
26
+ * validator accepts don't hit TS excess-property errors; a CLOSED object
27
+ * (`additionalProperties: false`) omits the index signature.
28
+ * - `type: "array"` with `items` → `T[]`.
29
+ * - `oneOf` whose members are ALL `type: "object"` → a discriminated
30
+ * (tagged) union: the `|`-union of member object types, keyed by an
31
+ * auto-detected single-literal-`enum` discriminator (#1511). A defective
32
+ * all-object tagged union (no/ambiguous discriminator, <2 members) or an
33
+ * all-object `anyOf` (unsupported in v1) is a STRICT codegen error, not a
34
+ * silent `unknown` (Fork 3, resolved by the maintainer).
35
+ *
36
+ * Everything else the server ignores (`$ref`, `allOf`, `format`,
37
+ * `patternProperties`, numeric constraints, tuple `items`, and a `oneOf`/`anyOf`
38
+ * whose members are NOT all objects) renders `unknown`.
39
+ *
40
+ * Errors are NOT swallowed here — a malformed schema fails upstream at parse
41
+ * time, and a defective tagged union throws — this walker otherwise returns
42
+ * `unknown` for anything it does not recognize.
43
+ *
44
+ * FORMATTING CONTRACT (#1565): the types emitted here must be a fixed point of
45
+ * Prettier's DEFAULT config, since `workflows codegen --check` byte-compares
46
+ * the emission against disk. Long unions therefore render through
47
+ * `codegen-shared/prettierStable.ts` (which reproduces Prettier's width
48
+ * decision) instead of being joined with `" | "`. There is no Prettier
49
+ * dependency and no automated round-trip test, so verify any change to these
50
+ * shapes by hand — see that module's header.
51
+ */
52
+ import { type TypeNode } from "../codegen-shared/prettierStable.js";
53
+ /**
54
+ * Convert a parsed JSON Schema node to a TypeScript type expression. Object
55
+ * types render multi-line (2-space indent per level); everything else renders
56
+ * on a single line unless it is too wide for Prettier's default print width
57
+ * (#1565). `indent` is the current indentation depth.
58
+ */
59
+ export declare function schemaToTsType(schema: any, indent?: number): string;
60
+ /**
61
+ * `schemaToTsType` as a wrappable node — the emitters print it at the position
62
+ * it actually occupies so long unions/objects wrap exactly as Prettier would
63
+ * (#1565). See `codegen-shared/prettierStable.ts`.
64
+ */
65
+ export declare function schemaToTypeNode(schema: any): TypeNode;
66
+ /**
67
+ * True when the schema REJECTS an empty object `{}` — i.e. the client's
68
+ * `rootInput: options.input ?? {}` fallback would fail validation, so `input`
69
+ * must be a compile-time-required option (issue #1442, P4). Derived from the
70
+ * shared descriptor so it matches the server validator exactly:
71
+ *
72
+ * - a valid top-level discriminated-union (`oneOf`): the runtime always
73
+ * requires the discriminator present, so `{}` matches no case;
74
+ * - a declared top-level `type` that `{}` does not satisfy (anything but
75
+ * `object`, e.g. `string`/`array`, or a union with no `object` arm);
76
+ * - a top-level `enum` (a fresh `{}` is never an enum member);
77
+ * - `type: "object"` with a non-empty `required[]` (a missing required key).
78
+ *
79
+ * An all-optional object schema, or a schema with no top-level constraints,
80
+ * accepts `{}` → `input` is optional.
81
+ */
82
+ export declare function schemaRejectsEmptyObject(schema: any): boolean;