primitive-admin 1.1.0-alpha.9 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (591) hide show
  1. package/README.md +523 -109
  2. package/assets/skill/skills/primitive-platform/SKILL.md +289 -0
  3. package/dist/bin/primitive.d.ts +2 -0
  4. package/dist/bin/primitive.js +372 -21
  5. package/dist/bin/primitive.js.map +1 -1
  6. package/dist/src/commands/admins.d.ts +2 -0
  7. package/dist/src/commands/admins.js +136 -30
  8. package/dist/src/commands/admins.js.map +1 -1
  9. package/dist/src/commands/analytics.d.ts +2 -0
  10. package/dist/src/commands/analytics.js +713 -55
  11. package/dist/src/commands/analytics.js.map +1 -1
  12. package/dist/src/commands/apps.d.ts +2 -0
  13. package/dist/src/commands/apps.js +65 -100
  14. package/dist/src/commands/apps.js.map +1 -1
  15. package/dist/src/commands/auth-sessions.d.ts +7 -0
  16. package/dist/src/commands/auth-sessions.js +144 -0
  17. package/dist/src/commands/auth-sessions.js.map +1 -0
  18. package/dist/src/commands/auth.d.ts +2 -0
  19. package/dist/src/commands/auth.js +238 -108
  20. package/dist/src/commands/auth.js.map +1 -1
  21. package/dist/src/commands/blob-buckets.d.ts +2 -0
  22. package/dist/src/commands/blob-buckets.js +331 -0
  23. package/dist/src/commands/blob-buckets.js.map +1 -0
  24. package/dist/src/commands/catalog.d.ts +2 -0
  25. package/dist/src/commands/catalog.js +63 -48
  26. package/dist/src/commands/catalog.js.map +1 -1
  27. package/dist/src/commands/collection-type-configs.d.ts +2 -0
  28. package/dist/src/commands/collection-type-configs.js +85 -0
  29. package/dist/src/commands/collection-type-configs.js.map +1 -0
  30. package/dist/src/commands/collections.d.ts +2 -0
  31. package/dist/src/commands/collections.js +1282 -0
  32. package/dist/src/commands/collections.js.map +1 -0
  33. package/dist/src/commands/comparisons.d.ts +2 -0
  34. package/dist/src/commands/comparisons.js +6 -6
  35. package/dist/src/commands/comparisons.js.map +1 -1
  36. package/dist/src/commands/config.d.ts +46 -0
  37. package/dist/src/commands/config.js +465 -0
  38. package/dist/src/commands/config.js.map +1 -0
  39. package/dist/src/commands/connections.d.ts +2 -0
  40. package/dist/src/commands/connections.js +99 -0
  41. package/dist/src/commands/connections.js.map +1 -0
  42. package/dist/src/commands/cron-triggers.d.ts +2 -0
  43. package/dist/src/commands/cron-triggers.js +266 -0
  44. package/dist/src/commands/cron-triggers.js.map +1 -0
  45. package/dist/src/commands/database-type-configs.d.ts +2 -0
  46. package/dist/src/commands/database-type-configs.js +164 -0
  47. package/dist/src/commands/database-type-configs.js.map +1 -0
  48. package/dist/src/commands/database-types.d.ts +2 -0
  49. package/dist/src/commands/database-types.js +471 -0
  50. package/dist/src/commands/database-types.js.map +1 -0
  51. package/dist/src/commands/databases.d.ts +65 -0
  52. package/dist/src/commands/databases.js +1887 -243
  53. package/dist/src/commands/databases.js.map +1 -1
  54. package/dist/src/commands/documents.d.ts +60 -0
  55. package/dist/src/commands/documents.js +2888 -22
  56. package/dist/src/commands/documents.js.map +1 -1
  57. package/dist/src/commands/email-templates.d.ts +2 -0
  58. package/dist/src/commands/email-templates.js +175 -0
  59. package/dist/src/commands/email-templates.js.map +1 -0
  60. package/dist/src/commands/env.d.ts +23 -0
  61. package/dist/src/commands/env.js +395 -0
  62. package/dist/src/commands/env.js.map +1 -0
  63. package/dist/src/commands/feature-flags.d.ts +14 -0
  64. package/dist/src/commands/feature-flags.js +117 -0
  65. package/dist/src/commands/feature-flags.js.map +1 -0
  66. package/dist/src/commands/functions.d.ts +20 -0
  67. package/dist/src/commands/functions.js +1630 -0
  68. package/dist/src/commands/functions.js.map +1 -0
  69. package/dist/src/commands/group-type-configs.d.ts +2 -0
  70. package/dist/src/commands/group-type-configs.js +87 -0
  71. package/dist/src/commands/group-type-configs.js.map +1 -0
  72. package/dist/src/commands/groups.d.ts +2 -0
  73. package/dist/src/commands/groups.js +65 -113
  74. package/dist/src/commands/groups.js.map +1 -1
  75. package/dist/src/commands/guides.d.ts +223 -0
  76. package/dist/src/commands/guides.js +627 -69
  77. package/dist/src/commands/guides.js.map +1 -1
  78. package/dist/src/commands/init.d.ts +37 -0
  79. package/dist/src/commands/init.js +1693 -208
  80. package/dist/src/commands/init.js.map +1 -1
  81. package/dist/src/commands/integrations.d.ts +2 -0
  82. package/dist/src/commands/integrations.js +428 -187
  83. package/dist/src/commands/integrations.js.map +1 -1
  84. package/dist/src/commands/llm.d.ts +2 -0
  85. package/dist/src/commands/llm.js +4 -2
  86. package/dist/src/commands/llm.js.map +1 -1
  87. package/dist/src/commands/locks.d.ts +8 -0
  88. package/dist/src/commands/locks.js +175 -0
  89. package/dist/src/commands/locks.js.map +1 -0
  90. package/dist/src/commands/metadata-category-configs.d.ts +12 -0
  91. package/dist/src/commands/metadata-category-configs.js +113 -0
  92. package/dist/src/commands/metadata-category-configs.js.map +1 -0
  93. package/dist/src/commands/metadata.d.ts +2 -0
  94. package/dist/src/commands/metadata.js +288 -0
  95. package/dist/src/commands/metadata.js.map +1 -0
  96. package/dist/src/commands/prompts.d.ts +2 -0
  97. package/dist/src/commands/prompts.js +322 -634
  98. package/dist/src/commands/prompts.js.map +1 -1
  99. package/dist/src/commands/rule-sets.d.ts +3 -0
  100. package/dist/src/commands/rule-sets.js +139 -148
  101. package/dist/src/commands/rule-sets.js.map +1 -1
  102. package/dist/src/commands/scripts.d.ts +30 -0
  103. package/dist/src/commands/scripts.js +688 -0
  104. package/dist/src/commands/scripts.js.map +1 -0
  105. package/dist/src/commands/secrets.d.ts +2 -0
  106. package/dist/src/commands/secrets.js +109 -0
  107. package/dist/src/commands/secrets.js.map +1 -0
  108. package/dist/src/commands/sessions.d.ts +2 -0
  109. package/dist/src/commands/sessions.js +76 -0
  110. package/dist/src/commands/sessions.js.map +1 -0
  111. package/dist/src/commands/skill.d.ts +2 -0
  112. package/dist/src/commands/skill.js +29 -0
  113. package/dist/src/commands/skill.js.map +1 -0
  114. package/dist/src/commands/sync-app-settings.d.ts +158 -0
  115. package/dist/src/commands/sync-app-settings.js +328 -0
  116. package/dist/src/commands/sync-app-settings.js.map +1 -0
  117. package/dist/src/commands/sync.d.ts +2670 -0
  118. package/dist/src/commands/sync.js +17144 -834
  119. package/dist/src/commands/sync.js.map +1 -1
  120. package/dist/src/commands/tokens.d.ts +2 -0
  121. package/dist/src/commands/tokens.js +132 -22
  122. package/dist/src/commands/tokens.js.map +1 -1
  123. package/dist/src/commands/users.d.ts +2 -0
  124. package/dist/src/commands/users.js +542 -24
  125. package/dist/src/commands/users.js.map +1 -1
  126. package/dist/src/commands/vars.d.ts +8 -0
  127. package/dist/src/commands/vars.js +97 -0
  128. package/dist/src/commands/vars.js.map +1 -0
  129. package/dist/src/commands/waitlist.d.ts +2 -0
  130. package/dist/src/commands/waitlist.js +12 -11
  131. package/dist/src/commands/waitlist.js.map +1 -1
  132. package/dist/src/commands/webhooks.d.ts +31 -0
  133. package/dist/src/commands/webhooks.js +633 -0
  134. package/dist/src/commands/webhooks.js.map +1 -0
  135. package/dist/src/commands/workflows.d.ts +88 -0
  136. package/dist/src/commands/workflows.js +1568 -742
  137. package/dist/src/commands/workflows.js.map +1 -1
  138. package/dist/src/lib/access-rule-display.d.ts +21 -0
  139. package/dist/src/lib/access-rule-display.js +34 -0
  140. package/dist/src/lib/access-rule-display.js.map +1 -0
  141. package/dist/src/lib/api-client.d.ts +2550 -0
  142. package/dist/src/lib/api-client.js +2503 -160
  143. package/dist/src/lib/api-client.js.map +1 -1
  144. package/dist/src/lib/app-settings-descriptor.d.ts +263 -0
  145. package/dist/src/lib/app-settings-descriptor.js +583 -0
  146. package/dist/src/lib/app-settings-descriptor.js.map +1 -0
  147. package/dist/src/lib/auth-flow.d.ts +8 -0
  148. package/dist/src/lib/batch.d.ts +26 -0
  149. package/dist/src/lib/batch.js +32 -0
  150. package/dist/src/lib/batch.js.map +1 -0
  151. package/dist/src/lib/block-layout.d.ts +160 -0
  152. package/dist/src/lib/block-layout.js +451 -0
  153. package/dist/src/lib/block-layout.js.map +1 -0
  154. package/dist/src/lib/block-selector.d.ts +58 -0
  155. package/dist/src/lib/block-selector.js +92 -0
  156. package/dist/src/lib/block-selector.js.map +1 -0
  157. package/dist/src/lib/canonical-json.d.ts +12 -0
  158. package/dist/src/lib/canonical-json.js +35 -0
  159. package/dist/src/lib/canonical-json.js.map +1 -0
  160. package/dist/src/lib/channel.d.ts +30 -0
  161. package/dist/src/lib/channel.js +68 -0
  162. package/dist/src/lib/channel.js.map +1 -0
  163. package/dist/src/lib/cli-manifest.d.ts +68 -0
  164. package/dist/src/lib/cli-manifest.js +71 -0
  165. package/dist/src/lib/cli-manifest.js.map +1 -0
  166. package/dist/src/lib/codegen-shared/generatedFiles.d.ts +101 -0
  167. package/dist/src/lib/codegen-shared/generatedFiles.js +191 -0
  168. package/dist/src/lib/codegen-shared/generatedFiles.js.map +1 -0
  169. package/dist/src/lib/codegen-shared/prettierStable.d.ts +262 -0
  170. package/dist/src/lib/codegen-shared/prettierStable.js +610 -0
  171. package/dist/src/lib/codegen-shared/prettierStable.js.map +1 -0
  172. package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.d.ts +38 -0
  173. package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.js +46 -0
  174. package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.js.map +1 -0
  175. package/dist/src/lib/collection-export.d.ts +184 -0
  176. package/dist/src/lib/collection-export.js +252 -0
  177. package/dist/src/lib/collection-export.js.map +1 -0
  178. package/dist/src/lib/config-json-field.d.ts +28 -0
  179. package/dist/src/lib/config-json-field.js +56 -0
  180. package/dist/src/lib/config-json-field.js.map +1 -0
  181. package/dist/src/lib/config-object-descriptor.d.ts +127 -0
  182. package/dist/src/lib/config-object-descriptor.js +740 -0
  183. package/dist/src/lib/config-object-descriptor.js.map +1 -0
  184. package/dist/src/lib/config-payload.d.ts +92 -0
  185. package/dist/src/lib/config-payload.js +161 -0
  186. package/dist/src/lib/config-payload.js.map +1 -0
  187. package/dist/src/lib/config-surface.d.ts +141 -0
  188. package/dist/src/lib/config-surface.js +368 -0
  189. package/dist/src/lib/config-surface.js.map +1 -0
  190. package/dist/src/lib/config-toml.d.ts +10 -0
  191. package/dist/src/lib/config-toml.js +42 -0
  192. package/dist/src/lib/config-toml.js.map +1 -0
  193. package/dist/src/lib/config.d.ts +71 -0
  194. package/dist/src/lib/config.js +71 -68
  195. package/dist/src/lib/config.js.map +1 -1
  196. package/dist/src/lib/confirm-prompt.d.ts +83 -0
  197. package/dist/src/lib/confirm-prompt.js +110 -0
  198. package/dist/src/lib/confirm-prompt.js.map +1 -0
  199. package/dist/src/lib/constants.d.ts +11 -0
  200. package/dist/src/lib/constants.js +12 -0
  201. package/dist/src/lib/constants.js.map +1 -0
  202. package/dist/src/lib/crash-handlers.d.ts +20 -0
  203. package/dist/src/lib/crash-handlers.js +49 -0
  204. package/dist/src/lib/crash-handlers.js.map +1 -0
  205. package/dist/src/lib/credentials-store.d.ts +104 -0
  206. package/dist/src/lib/credentials-store.js +336 -0
  207. package/dist/src/lib/credentials-store.js.map +1 -0
  208. package/dist/src/lib/csv.d.ts +47 -0
  209. package/dist/src/lib/csv.js +172 -0
  210. package/dist/src/lib/csv.js.map +1 -0
  211. package/dist/src/lib/data-input.d.ts +23 -0
  212. package/dist/src/lib/data-input.js +50 -0
  213. package/dist/src/lib/data-input.js.map +1 -0
  214. package/dist/src/lib/db-codegen/dbFingerprint.d.ts +10 -0
  215. package/dist/src/lib/db-codegen/dbFingerprint.js +17 -0
  216. package/dist/src/lib/db-codegen/dbFingerprint.js.map +1 -0
  217. package/dist/src/lib/db-codegen/dbGenerator.d.ts +67 -0
  218. package/dist/src/lib/db-codegen/dbGenerator.js +170 -0
  219. package/dist/src/lib/db-codegen/dbGenerator.js.map +1 -0
  220. package/dist/src/lib/db-codegen/dbNaming.d.ts +87 -0
  221. package/dist/src/lib/db-codegen/dbNaming.js +180 -0
  222. package/dist/src/lib/db-codegen/dbNaming.js.map +1 -0
  223. package/dist/src/lib/db-codegen/dbTemplates.d.ts +272 -0
  224. package/dist/src/lib/db-codegen/dbTemplates.js +480 -0
  225. package/dist/src/lib/db-codegen/dbTemplates.js.map +1 -0
  226. package/dist/src/lib/db-codegen/dbTsTypes.d.ts +73 -0
  227. package/dist/src/lib/db-codegen/dbTsTypes.js +139 -0
  228. package/dist/src/lib/db-codegen/dbTsTypes.js.map +1 -0
  229. package/dist/src/lib/db-codegen/dbTypeIR.d.ts +146 -0
  230. package/dist/src/lib/db-codegen/dbTypeIR.js +525 -0
  231. package/dist/src/lib/db-codegen/dbTypeIR.js.map +1 -0
  232. package/dist/src/lib/db-codegen/generated-operation-def-descriptor.d.ts +112 -0
  233. package/dist/src/lib/db-codegen/generated-operation-def-descriptor.js +211 -0
  234. package/dist/src/lib/db-codegen/generated-operation-def-descriptor.js.map +1 -0
  235. package/dist/src/lib/deprecation.d.ts +22 -0
  236. package/dist/src/lib/deprecation.js +43 -0
  237. package/dist/src/lib/deprecation.js.map +1 -0
  238. package/dist/src/lib/document-export-permissions.d.ts +30 -0
  239. package/dist/src/lib/document-export-permissions.js +54 -0
  240. package/dist/src/lib/document-export-permissions.js.map +1 -0
  241. package/dist/src/lib/document-ingest-artifact.d.ts +120 -0
  242. package/dist/src/lib/document-ingest-artifact.js +505 -0
  243. package/dist/src/lib/document-ingest-artifact.js.map +1 -0
  244. package/dist/src/lib/document-ingest-input.d.ts +51 -0
  245. package/dist/src/lib/document-ingest-input.js +132 -0
  246. package/dist/src/lib/document-ingest-input.js.map +1 -0
  247. package/dist/src/lib/document-ingest-rows.d.ts +137 -0
  248. package/dist/src/lib/document-ingest-rows.js +181 -0
  249. package/dist/src/lib/document-ingest-rows.js.map +1 -0
  250. package/dist/src/lib/document-ingest.d.ts +101 -0
  251. package/dist/src/lib/document-ingest.js +384 -0
  252. package/dist/src/lib/document-ingest.js.map +1 -0
  253. package/dist/src/lib/env-resolver-core.d.ts +258 -0
  254. package/dist/src/lib/env-resolver-core.js +447 -0
  255. package/dist/src/lib/env-resolver-core.js.map +1 -0
  256. package/dist/src/lib/env-resolver.d.ts +99 -0
  257. package/dist/src/lib/env-resolver.js +153 -0
  258. package/dist/src/lib/env-resolver.js.map +1 -0
  259. package/dist/src/lib/fetch.d.ts +5 -0
  260. package/dist/src/lib/function-bundle.d.ts +147 -0
  261. package/dist/src/lib/function-bundle.js +341 -0
  262. package/dist/src/lib/function-bundle.js.map +1 -0
  263. package/dist/src/lib/function-collect.d.ts +123 -0
  264. package/dist/src/lib/function-collect.js +610 -0
  265. package/dist/src/lib/function-collect.js.map +1 -0
  266. package/dist/src/lib/function-db-types.d.ts +202 -0
  267. package/dist/src/lib/function-db-types.js +870 -0
  268. package/dist/src/lib/function-db-types.js.map +1 -0
  269. package/dist/src/lib/function-document-types.d.ts +144 -0
  270. package/dist/src/lib/function-document-types.js +370 -0
  271. package/dist/src/lib/function-document-types.js.map +1 -0
  272. package/dist/src/lib/function-grants-preflight.d.ts +64 -0
  273. package/dist/src/lib/function-grants-preflight.js +105 -0
  274. package/dist/src/lib/function-grants-preflight.js.map +1 -0
  275. package/dist/src/lib/function-log-lines.d.ts +76 -0
  276. package/dist/src/lib/function-log-lines.js +160 -0
  277. package/dist/src/lib/function-log-lines.js.map +1 -0
  278. package/dist/src/lib/function-log-row.d.ts +29 -0
  279. package/dist/src/lib/function-log-row.js +73 -0
  280. package/dist/src/lib/function-log-row.js.map +1 -0
  281. package/dist/src/lib/function-log-tail.d.ts +132 -0
  282. package/dist/src/lib/function-log-tail.js +262 -0
  283. package/dist/src/lib/function-log-tail.js.map +1 -0
  284. package/dist/src/lib/function-run.d.ts +289 -0
  285. package/dist/src/lib/function-run.js +389 -0
  286. package/dist/src/lib/function-run.js.map +1 -0
  287. package/dist/src/lib/function-schema-codegen.d.ts +143 -0
  288. package/dist/src/lib/function-schema-codegen.js +420 -0
  289. package/dist/src/lib/function-schema-codegen.js.map +1 -0
  290. package/dist/src/lib/function-sync.d.ts +459 -0
  291. package/dist/src/lib/function-sync.js +1258 -0
  292. package/dist/src/lib/function-sync.js.map +1 -0
  293. package/dist/src/lib/function-trigger-listing.d.ts +27 -0
  294. package/dist/src/lib/function-trigger-listing.js +70 -0
  295. package/dist/src/lib/function-trigger-listing.js.map +1 -0
  296. package/dist/src/lib/function-typecheck.d.ts +86 -0
  297. package/dist/src/lib/function-typecheck.js +370 -0
  298. package/dist/src/lib/function-typecheck.js.map +1 -0
  299. package/dist/src/lib/function-versions.d.ts +122 -0
  300. package/dist/src/lib/function-versions.js +182 -0
  301. package/dist/src/lib/function-versions.js.map +1 -0
  302. package/dist/src/lib/generated-allowlist.d.ts +28 -0
  303. package/dist/src/lib/generated-allowlist.js +281 -0
  304. package/dist/src/lib/generated-allowlist.js.map +1 -0
  305. package/dist/src/lib/generated-config-surfaces.d.ts +2936 -0
  306. package/dist/src/lib/generated-config-surfaces.js +10569 -0
  307. package/dist/src/lib/generated-config-surfaces.js.map +1 -0
  308. package/dist/src/lib/generated-sdk-types.d.ts +12 -0
  309. package/dist/src/lib/generated-sdk-types.js +13 -0
  310. package/dist/src/lib/generated-sdk-types.js.map +1 -0
  311. package/dist/src/lib/generated-template-lint.d.ts +212 -0
  312. package/dist/src/lib/generated-template-lint.js +624 -0
  313. package/dist/src/lib/generated-template-lint.js.map +1 -0
  314. package/dist/src/lib/init-adopt.d.ts +16 -0
  315. package/dist/src/lib/init-adopt.js +34 -0
  316. package/dist/src/lib/init-adopt.js.map +1 -0
  317. package/dist/src/lib/init-assets.d.ts +39 -0
  318. package/dist/src/lib/init-assets.js +97 -0
  319. package/dist/src/lib/init-assets.js.map +1 -0
  320. package/dist/src/lib/init-client-platforms.d.ts +14 -0
  321. package/dist/src/lib/init-client-platforms.js +71 -0
  322. package/dist/src/lib/init-client-platforms.js.map +1 -0
  323. package/dist/src/lib/init-config.d.ts +98 -0
  324. package/dist/src/lib/init-config.js +186 -0
  325. package/dist/src/lib/init-config.js.map +1 -0
  326. package/dist/src/lib/init-email-redirect-uris.d.ts +37 -0
  327. package/dist/src/lib/init-email-redirect-uris.js +46 -0
  328. package/dist/src/lib/init-email-redirect-uris.js.map +1 -0
  329. package/dist/src/lib/init-ios-links.d.ts +91 -0
  330. package/dist/src/lib/init-ios-links.js +219 -0
  331. package/dist/src/lib/init-ios-links.js.map +1 -0
  332. package/dist/src/lib/init-plan.d.ts +80 -0
  333. package/dist/src/lib/init-plan.js +95 -0
  334. package/dist/src/lib/init-plan.js.map +1 -0
  335. package/dist/src/lib/init-production-env.d.ts +48 -0
  336. package/dist/src/lib/init-production-env.js +59 -0
  337. package/dist/src/lib/init-production-env.js.map +1 -0
  338. package/dist/src/lib/init-schema.d.ts +74 -0
  339. package/dist/src/lib/init-schema.js +358 -0
  340. package/dist/src/lib/init-schema.js.map +1 -0
  341. package/dist/src/lib/init-xcode.d.ts +34 -0
  342. package/dist/src/lib/init-xcode.js +138 -0
  343. package/dist/src/lib/init-xcode.js.map +1 -0
  344. package/dist/src/lib/integration-request-config.d.ts +30 -0
  345. package/dist/src/lib/integration-request-config.js +145 -0
  346. package/dist/src/lib/integration-request-config.js.map +1 -0
  347. package/dist/src/lib/integration-selector.d.ts +42 -0
  348. package/dist/src/lib/integration-selector.js +46 -0
  349. package/dist/src/lib/integration-selector.js.map +1 -0
  350. package/dist/src/lib/ios-app-id.d.ts +34 -0
  351. package/dist/src/lib/ios-app-id.js +69 -0
  352. package/dist/src/lib/ios-app-id.js.map +1 -0
  353. package/dist/src/lib/list-options.d.ts +68 -0
  354. package/dist/src/lib/list-options.js +89 -0
  355. package/dist/src/lib/list-options.js.map +1 -0
  356. package/dist/src/lib/local-state.d.ts +55 -0
  357. package/dist/src/lib/local-state.js +167 -0
  358. package/dist/src/lib/local-state.js.map +1 -0
  359. package/dist/src/lib/local-test-cases.d.ts +63 -0
  360. package/dist/src/lib/local-test-cases.js +136 -0
  361. package/dist/src/lib/local-test-cases.js.map +1 -0
  362. package/dist/src/lib/log-inspection.d.ts +715 -0
  363. package/dist/src/lib/log-inspection.js +816 -0
  364. package/dist/src/lib/log-inspection.js.map +1 -0
  365. package/dist/src/lib/logout-admin-session.d.ts +33 -0
  366. package/dist/src/lib/logout-admin-session.js +70 -0
  367. package/dist/src/lib/logout-admin-session.js.map +1 -0
  368. package/dist/src/lib/migration-nag.d.ts +49 -0
  369. package/dist/src/lib/migration-nag.js +163 -0
  370. package/dist/src/lib/migration-nag.js.map +1 -0
  371. package/dist/src/lib/object-status-filter.d.ts +22 -0
  372. package/dist/src/lib/object-status-filter.js +45 -0
  373. package/dist/src/lib/object-status-filter.js.map +1 -0
  374. package/dist/src/lib/output.d.ts +124 -0
  375. package/dist/src/lib/output.js +219 -8
  376. package/dist/src/lib/output.js.map +1 -1
  377. package/dist/src/lib/package-manager.d.ts +140 -0
  378. package/dist/src/lib/package-manager.js +305 -0
  379. package/dist/src/lib/package-manager.js.map +1 -0
  380. package/dist/src/lib/paginate.d.ts +98 -0
  381. package/dist/src/lib/paginate.js +112 -0
  382. package/dist/src/lib/paginate.js.map +1 -0
  383. package/dist/src/lib/platform-owned.d.ts +63 -0
  384. package/dist/src/lib/platform-owned.js +85 -0
  385. package/dist/src/lib/platform-owned.js.map +1 -0
  386. package/dist/src/lib/project-config.d.ts +122 -0
  387. package/dist/src/lib/project-config.js +244 -0
  388. package/dist/src/lib/project-config.js.map +1 -0
  389. package/dist/src/lib/prompt-cost-format.d.ts +11 -0
  390. package/dist/src/lib/prompt-cost-format.js +41 -0
  391. package/dist/src/lib/prompt-cost-format.js.map +1 -0
  392. package/dist/src/lib/prompt-schema-codegen.d.ts +147 -0
  393. package/dist/src/lib/prompt-schema-codegen.js +462 -0
  394. package/dist/src/lib/prompt-schema-codegen.js.map +1 -0
  395. package/dist/src/lib/query-operators.d.ts +43 -0
  396. package/dist/src/lib/query-operators.js +80 -0
  397. package/dist/src/lib/query-operators.js.map +1 -0
  398. package/dist/src/lib/record-filter.d.ts +18 -0
  399. package/dist/src/lib/record-filter.js +55 -0
  400. package/dist/src/lib/record-filter.js.map +1 -0
  401. package/dist/src/lib/refresh-admin-credentials.d.ts +73 -0
  402. package/dist/src/lib/refresh-admin-credentials.js +123 -0
  403. package/dist/src/lib/refresh-admin-credentials.js.map +1 -0
  404. package/dist/src/lib/resolve-init-dev-port.d.ts +56 -0
  405. package/dist/src/lib/resolve-init-dev-port.js +55 -0
  406. package/dist/src/lib/resolve-init-dev-port.js.map +1 -0
  407. package/dist/src/lib/resolve-init-server.d.ts +64 -0
  408. package/dist/src/lib/resolve-init-server.js +77 -0
  409. package/dist/src/lib/resolve-init-server.js.map +1 -0
  410. package/dist/src/lib/resolve-owner.d.ts +19 -0
  411. package/dist/src/lib/resolve-owner.js +20 -0
  412. package/dist/src/lib/resolve-owner.js.map +1 -0
  413. package/dist/src/lib/resolve-platform.d.ts +74 -0
  414. package/dist/src/lib/resolve-platform.js +105 -0
  415. package/dist/src/lib/resolve-platform.js.map +1 -0
  416. package/dist/src/lib/run-status.d.ts +19 -0
  417. package/dist/src/lib/run-status.generated.d.ts +39 -0
  418. package/dist/src/lib/run-status.generated.js +66 -0
  419. package/dist/src/lib/run-status.generated.js.map +1 -0
  420. package/dist/src/lib/run-status.js +19 -0
  421. package/dist/src/lib/run-status.js.map +1 -0
  422. package/dist/src/lib/server-text-normalization.d.ts +51 -0
  423. package/dist/src/lib/server-text-normalization.js +90 -0
  424. package/dist/src/lib/server-text-normalization.js.map +1 -0
  425. package/dist/src/lib/server-url.d.ts +22 -0
  426. package/dist/src/lib/server-url.js +33 -0
  427. package/dist/src/lib/server-url.js.map +1 -0
  428. package/dist/src/lib/signing-secret-status.d.ts +81 -0
  429. package/dist/src/lib/signing-secret-status.js +116 -0
  430. package/dist/src/lib/signing-secret-status.js.map +1 -0
  431. package/dist/src/lib/skill-installer.d.ts +71 -0
  432. package/dist/src/lib/skill-installer.js +441 -0
  433. package/dist/src/lib/skill-installer.js.map +1 -0
  434. package/dist/src/lib/snapshot-audit-source.d.ts +45 -0
  435. package/dist/src/lib/snapshot-audit-source.js +58 -0
  436. package/dist/src/lib/snapshot-audit-source.js.map +1 -0
  437. package/dist/src/lib/snapshot-audit-store.d.ts +52 -0
  438. package/dist/src/lib/snapshot-audit-store.js +196 -0
  439. package/dist/src/lib/snapshot-audit-store.js.map +1 -0
  440. package/dist/src/lib/snapshot-audit.d.ts +207 -0
  441. package/dist/src/lib/snapshot-audit.js +431 -0
  442. package/dist/src/lib/snapshot-audit.js.map +1 -0
  443. package/dist/src/lib/snapshot-build-rows.d.ts +60 -0
  444. package/dist/src/lib/snapshot-build-rows.js +87 -0
  445. package/dist/src/lib/snapshot-build-rows.js.map +1 -0
  446. package/dist/src/lib/snapshot-build.d.ts +50 -0
  447. package/dist/src/lib/snapshot-build.js +111 -0
  448. package/dist/src/lib/snapshot-build.js.map +1 -0
  449. package/dist/src/lib/snapshot-manifest-layout.d.ts +61 -0
  450. package/dist/src/lib/snapshot-manifest-layout.js +70 -0
  451. package/dist/src/lib/snapshot-manifest-layout.js.map +1 -0
  452. package/dist/src/lib/snapshots.d.ts +98 -0
  453. package/dist/src/lib/snapshots.js +294 -0
  454. package/dist/src/lib/snapshots.js.map +1 -0
  455. package/dist/src/lib/step-run-table.d.ts +43 -0
  456. package/dist/src/lib/step-run-table.js +129 -0
  457. package/dist/src/lib/step-run-table.js.map +1 -0
  458. package/dist/src/lib/storage-pending-retry.d.ts +26 -0
  459. package/dist/src/lib/storage-pending-retry.js +42 -0
  460. package/dist/src/lib/storage-pending-retry.js.map +1 -0
  461. package/dist/src/lib/swift-codegen/agentGenerator.d.ts +42 -0
  462. package/dist/src/lib/swift-codegen/agentGenerator.js +118 -0
  463. package/dist/src/lib/swift-codegen/agentGenerator.js.map +1 -0
  464. package/dist/src/lib/swift-codegen/banners.d.ts +24 -0
  465. package/dist/src/lib/swift-codegen/banners.js +25 -0
  466. package/dist/src/lib/swift-codegen/banners.js.map +1 -0
  467. package/dist/src/lib/swift-codegen/dbGenerator.d.ts +113 -0
  468. package/dist/src/lib/swift-codegen/dbGenerator.js +926 -0
  469. package/dist/src/lib/swift-codegen/dbGenerator.js.map +1 -0
  470. package/dist/src/lib/swift-codegen/dbSwiftTypes.d.ts +42 -0
  471. package/dist/src/lib/swift-codegen/dbSwiftTypes.js +100 -0
  472. package/dist/src/lib/swift-codegen/dbSwiftTypes.js.map +1 -0
  473. package/dist/src/lib/swift-codegen/functionGenerator.d.ts +139 -0
  474. package/dist/src/lib/swift-codegen/functionGenerator.js +462 -0
  475. package/dist/src/lib/swift-codegen/functionGenerator.js.map +1 -0
  476. package/dist/src/lib/swift-codegen/generator.d.ts +100 -0
  477. package/dist/src/lib/swift-codegen/generator.js +457 -0
  478. package/dist/src/lib/swift-codegen/generator.js.map +1 -0
  479. package/dist/src/lib/swift-codegen/schemaToSwift.d.ts +87 -0
  480. package/dist/src/lib/swift-codegen/schemaToSwift.js +661 -0
  481. package/dist/src/lib/swift-codegen/schemaToSwift.js.map +1 -0
  482. package/dist/src/lib/swift-codegen/siblingSymbols.d.ts +94 -0
  483. package/dist/src/lib/swift-codegen/siblingSymbols.js +155 -0
  484. package/dist/src/lib/swift-codegen/siblingSymbols.js.map +1 -0
  485. package/dist/src/lib/swift-codegen/swiftNaming.d.ts +85 -0
  486. package/dist/src/lib/swift-codegen/swiftNaming.js +198 -0
  487. package/dist/src/lib/swift-codegen/swiftNaming.js.map +1 -0
  488. package/dist/src/lib/sync-dir-selector.d.ts +21 -0
  489. package/dist/src/lib/sync-dir-selector.js +30 -0
  490. package/dist/src/lib/sync-dir-selector.js.map +1 -0
  491. package/dist/src/lib/sync-paths.d.ts +128 -0
  492. package/dist/src/lib/sync-paths.js +195 -0
  493. package/dist/src/lib/sync-paths.js.map +1 -0
  494. package/dist/src/lib/sync-resource-types.d.ts +563 -0
  495. package/dist/src/lib/sync-resource-types.js +1073 -0
  496. package/dist/src/lib/sync-resource-types.js.map +1 -0
  497. package/dist/src/lib/sync-selectors.d.ts +138 -0
  498. package/dist/src/lib/sync-selectors.js +289 -0
  499. package/dist/src/lib/sync-selectors.js.map +1 -0
  500. package/dist/src/lib/template.d.ts +170 -0
  501. package/dist/src/lib/template.js +484 -68
  502. package/dist/src/lib/template.js.map +1 -1
  503. package/dist/src/lib/test-case-file-names.d.ts +40 -0
  504. package/dist/src/lib/test-case-file-names.js +91 -0
  505. package/dist/src/lib/test-case-file-names.js.map +1 -0
  506. package/dist/src/lib/test-case-keys.d.ts +29 -0
  507. package/dist/src/lib/test-case-keys.js +55 -0
  508. package/dist/src/lib/test-case-keys.js.map +1 -0
  509. package/dist/src/lib/test-case-variables.d.ts +29 -0
  510. package/dist/src/lib/test-case-variables.js +71 -0
  511. package/dist/src/lib/test-case-variables.js.map +1 -0
  512. package/dist/src/lib/token-inject.d.ts +56 -0
  513. package/dist/src/lib/token-inject.js +204 -0
  514. package/dist/src/lib/token-inject.js.map +1 -0
  515. package/dist/src/lib/toml-database-config.d.ts +123 -0
  516. package/dist/src/lib/toml-database-config.js +544 -0
  517. package/dist/src/lib/toml-database-config.js.map +1 -0
  518. package/dist/src/lib/toml-metadata-config.d.ts +151 -0
  519. package/dist/src/lib/toml-metadata-config.js +476 -0
  520. package/dist/src/lib/toml-metadata-config.js.map +1 -0
  521. package/dist/src/lib/toml-native-form.d.ts +46 -0
  522. package/dist/src/lib/toml-native-form.js +78 -0
  523. package/dist/src/lib/toml-native-form.js.map +1 -0
  524. package/dist/src/lib/toml-params-validator.d.ts +129 -0
  525. package/dist/src/lib/toml-params-validator.js +298 -0
  526. package/dist/src/lib/toml-params-validator.js.map +1 -0
  527. package/dist/src/lib/toml-scalar-edit.d.ts +43 -0
  528. package/dist/src/lib/toml-scalar-edit.js +283 -0
  529. package/dist/src/lib/toml-scalar-edit.js.map +1 -0
  530. package/dist/src/lib/user-selector.d.ts +24 -0
  531. package/dist/src/lib/user-selector.js +33 -0
  532. package/dist/src/lib/user-selector.js.map +1 -0
  533. package/dist/src/lib/version-check.d.ts +35 -0
  534. package/dist/src/lib/version-check.js +241 -0
  535. package/dist/src/lib/version-check.js.map +1 -0
  536. package/dist/src/lib/watch.d.ts +121 -0
  537. package/dist/src/lib/watch.js +169 -0
  538. package/dist/src/lib/watch.js.map +1 -0
  539. package/dist/src/lib/web-url.d.ts +40 -0
  540. package/dist/src/lib/web-url.js +76 -0
  541. package/dist/src/lib/web-url.js.map +1 -0
  542. package/dist/src/lib/webhook-deliver.d.ts +209 -0
  543. package/dist/src/lib/webhook-deliver.js +519 -0
  544. package/dist/src/lib/webhook-deliver.js.map +1 -0
  545. package/dist/src/lib/workflow-apply.d.ts +110 -0
  546. package/dist/src/lib/workflow-apply.js +164 -0
  547. package/dist/src/lib/workflow-apply.js.map +1 -0
  548. package/dist/src/lib/workflow-codegen/generated-schema-descriptor.d.ts +129 -0
  549. package/dist/src/lib/workflow-codegen/generated-schema-descriptor.js +269 -0
  550. package/dist/src/lib/workflow-codegen/generated-schema-descriptor.js.map +1 -0
  551. package/dist/src/lib/workflow-codegen/generator.d.ts +96 -0
  552. package/dist/src/lib/workflow-codegen/generator.js +361 -0
  553. package/dist/src/lib/workflow-codegen/generator.js.map +1 -0
  554. package/dist/src/lib/workflow-codegen/invokerIR.d.ts +94 -0
  555. package/dist/src/lib/workflow-codegen/invokerIR.js +76 -0
  556. package/dist/src/lib/workflow-codegen/invokerIR.js.map +1 -0
  557. package/dist/src/lib/workflow-codegen/naming.d.ts +33 -0
  558. package/dist/src/lib/workflow-codegen/naming.js +81 -0
  559. package/dist/src/lib/workflow-codegen/naming.js.map +1 -0
  560. package/dist/src/lib/workflow-codegen/schemaToTs.d.ts +80 -0
  561. package/dist/src/lib/workflow-codegen/schemaToTs.js +303 -0
  562. package/dist/src/lib/workflow-codegen/schemaToTs.js.map +1 -0
  563. package/dist/src/lib/workflow-config-apply.d.ts +70 -0
  564. package/dist/src/lib/workflow-config-apply.js +137 -0
  565. package/dist/src/lib/workflow-config-apply.js.map +1 -0
  566. package/dist/src/lib/workflow-config-sidecar.d.ts +63 -0
  567. package/dist/src/lib/workflow-config-sidecar.js +96 -0
  568. package/dist/src/lib/workflow-config-sidecar.js.map +1 -0
  569. package/dist/src/lib/workflow-defaults.d.ts +29 -0
  570. package/dist/src/lib/workflow-defaults.js +41 -0
  571. package/dist/src/lib/workflow-defaults.js.map +1 -0
  572. package/dist/src/lib/workflow-fragments.d.ts +64 -0
  573. package/dist/src/lib/workflow-fragments.js +342 -0
  574. package/dist/src/lib/workflow-fragments.js.map +1 -0
  575. package/dist/src/lib/workflow-include-preserve.d.ts +76 -0
  576. package/dist/src/lib/workflow-include-preserve.js +286 -0
  577. package/dist/src/lib/workflow-include-preserve.js.map +1 -0
  578. package/dist/src/lib/workflow-payload.d.ts +98 -0
  579. package/dist/src/lib/workflow-payload.js +178 -0
  580. package/dist/src/lib/workflow-payload.js.map +1 -0
  581. package/dist/src/lib/workflow-toml-validator.d.ts +211 -0
  582. package/dist/src/lib/workflow-toml-validator.js +770 -0
  583. package/dist/src/lib/workflow-toml-validator.js.map +1 -0
  584. package/dist/src/lib/workflow-usage.d.ts +196 -0
  585. package/dist/src/lib/workflow-usage.js +310 -0
  586. package/dist/src/lib/workflow-usage.js.map +1 -0
  587. package/dist/src/types/index.d.ts +591 -0
  588. package/dist/src/validators.d.ts +65 -0
  589. package/dist/src/validators.js +64 -0
  590. package/dist/src/validators.js.map +1 -0
  591. package/package.json +34 -9
@@ -0,0 +1,610 @@
1
+ /**
2
+ * Collecting a function's query manifest at push time (#3187, project
3
+ * `server-functions` phase 5).
4
+ *
5
+ * ── Why the tree has to RUN ──────────────────────────────────────────────
6
+ *
7
+ * `defineQuery(name, { models, params, cache, run })` is a registration
8
+ * helper, and registrations are ordinary code: a name can be computed, a
9
+ * models list can come from a constant another file exports, a whole set can
10
+ * be registered in a loop. Static extraction would see none of that. So the
11
+ * manifest is collected by BUILDING the tree a second time with
12
+ * `primitive-functions` aliased to a recording stub and executing the result.
13
+ *
14
+ * ── Why it runs somewhere else ───────────────────────────────────────────
15
+ *
16
+ * D3187-SO-006. A function bundle inlines its tree-local and npm imports, so
17
+ * "execute the bundle" means "run arbitrary module scope" — with, if it ran
18
+ * inside the CLI, the developer's environment, credentials, filesystem and
19
+ * network. That is a large step up from what `config push` did before, which
20
+ * was to type-erase and bundle the same code without running it.
21
+ *
22
+ * So collection runs in a spawned child `node` with:
23
+ *
24
+ * - a SCRUBBED environment: an explicit minimal pass-through, so a token in
25
+ * the developer's shell is not readable by a project's module scope;
26
+ * - the config tree as the working directory;
27
+ * - a hard timeout, killed with `SIGKILL`, so a loop in a tree is a named
28
+ * refusal rather than a hung push;
29
+ * - its result read back over a structured pipe (a sentinel-framed line on
30
+ * stdout), so a tree that prints is not mistaken for a tree that reported.
31
+ *
32
+ * What remains is the trust a developer already extends to their own tree by
33
+ * running its build: this is npm-postinstall-equivalent, and the docs say so.
34
+ * Full network denial was considered and not taken (Node offers no reliable
35
+ * in-process cutoff), and so was static extraction (it cannot see computed
36
+ * registrations).
37
+ *
38
+ * ── What the manifest is, and is not ─────────────────────────────────────
39
+ *
40
+ * Documentation. Since #3279 function code acts as the system, so the
41
+ * manifest authorizes nothing anywhere: its one job is telling an operator
42
+ * what a version registered and what it TOUCHES — the models its code names
43
+ * and the families it reaches — through `primitive functions get`. That
44
+ * second half (schema version 2) comes from a STATIC SCAN of the built
45
+ * bundle: the direct records API names a model in a literal request argument
46
+ * with neither a registration nor `.model()` (D3279-006), so the run above
47
+ * cannot see it and the text can. A name the scan cannot resolve — a computed
48
+ * `modelName`, a `.model(variable)` — is marked `dynamicModels` rather than
49
+ * dropped, which is the difference between "names none" and "names these,
50
+ * and possibly more".
51
+ */
52
+ import * as esbuild from "esbuild";
53
+ import { spawn } from "node:child_process";
54
+ import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
55
+ import { tmpdir } from "node:os";
56
+ import { join, resolve } from "node:path";
57
+ import { PRIMITIVE_FUNCTIONS_MODULE } from "./function-bundle.js";
58
+ /** The manifest encoding, versioned with the envelope that carries it. */
59
+ export const FUNCTION_MANIFEST_SCHEMA_VERSION = 2;
60
+ /** How long a tree's module scope may run before collection gives up. */
61
+ export const COLLECT_TIMEOUT_MS = 20_000;
62
+ /** A push that cannot proceed because its manifest could not be collected. */
63
+ export class FunctionCollectError extends Error {
64
+ constructor(message) {
65
+ super(message);
66
+ this.name = "FunctionCollectError";
67
+ }
68
+ }
69
+ /**
70
+ * What the static scan reads out of a built bundle — #3279 behavior 10.
71
+ *
72
+ * Literal model names from every shape the platform surfaces name a model
73
+ * in: a `.model("…")` call on the typed handle, a `modelName: "…"` key in a
74
+ * records body or a batch entry, and a `model: "…"` key in a document records
75
+ * call. A non-literal in any of those positions sets `dynamicModels`. The
76
+ * families are the `ctx.api.<family>` namespaces and the ctx helpers
77
+ * (`ctx.db` → databases, `ctx.secret` → secrets, …), on whatever the author
78
+ * named the context parameter: the scan keys on the member access, not on
79
+ * the receiver's name.
80
+ *
81
+ * Imprecise by construction and documented as such: a name assembled at
82
+ * runtime is invisible, a name in dead code is counted, and a string that
83
+ * happens to follow `modelName:` in unrelated data is counted too. The bundle
84
+ * is unminified ES2022 (`function-bundle.ts`), which is what makes the
85
+ * literal shapes stable enough to scan.
86
+ */
87
+ /** The text of a call's argument list, from just after its `(` to the match. */
88
+ function argumentText(bundle, from) {
89
+ let depth = 1;
90
+ for (let i = from; i < bundle.length; i++) {
91
+ const ch = bundle[i];
92
+ if (ch === "(" || ch === "{" || ch === "[")
93
+ depth++;
94
+ else if (ch === ")" || ch === "}" || ch === "]") {
95
+ depth--;
96
+ if (depth === 0)
97
+ return bundle.slice(from, i);
98
+ }
99
+ }
100
+ return bundle.slice(from);
101
+ }
102
+ export function scanBundleForManifest(bundle) {
103
+ const models = new Set();
104
+ const families = new Set();
105
+ let dynamicModels = false;
106
+ // A name is recorded only when the WHOLE expression is one literal
107
+ // (CR3279-003). Matching a literal PREFIX read `"Order" + input.suffix` as
108
+ // the model `Order` and said nothing about the part it could not resolve —
109
+ // a confident wrong answer where the manifest's whole job is to distinguish
110
+ // "these models" from "and something I could not read".
111
+ const literal = /^\s*(?:"([^"\\]*)"|'([^'\\]*)'|`([^`$\\]*)`)\s*$/;
112
+ const nameOf = (rest) => {
113
+ const match = literal.exec(rest);
114
+ if (!match)
115
+ return null;
116
+ return match[1] ?? match[2] ?? match[3] ?? null;
117
+ };
118
+ // `.model(<literal>)` on a handle; anything else in the parens is dynamic.
119
+ for (const match of bundle.matchAll(/\.model\(([^)]*)\)/g)) {
120
+ const name = nameOf(match[1]);
121
+ if (name !== null)
122
+ models.add(name);
123
+ else if (match[1].trim() !== "")
124
+ dynamicModels = true;
125
+ }
126
+ // `modelName: <value>` keys, quoted or bare — a records body or a batch
127
+ // entry, wherever they sit. The SHORTHAND `{ modelName }` names the model
128
+ // just as ordinarily and carries a variable, so it is unresolvable usage
129
+ // rather than no usage (CR3279-003): without it a function whose every call
130
+ // is `body: { modelName }` reported an empty manifest and no dynamic marker.
131
+ const keyed = (text, key) => {
132
+ const pattern = new RegExp(`(?:^|[{,\\s])["']?${key}["']?\\s*:(?!:)\\s*([^,}\\n]*)`, "g");
133
+ for (const match of text.matchAll(pattern)) {
134
+ const value = match[1];
135
+ const name = nameOf(value);
136
+ if (name !== null)
137
+ models.add(name);
138
+ else if (value.trim() !== "")
139
+ dynamicModels = true;
140
+ }
141
+ const shorthand = new RegExp(`[{,]\\s*${key}\\s*(?=[,}])`, "g");
142
+ if (shorthand.test(text))
143
+ dynamicModels = true;
144
+ };
145
+ keyed(bundle, "modelName");
146
+ // `model: <value>` is the document records PATH parameter, and only that:
147
+ // the same key names a provider model in an LLM call body, so it is read
148
+ // inside the argument list of a `.documents.records.<verb>(` call alone.
149
+ for (const call of bundle.matchAll(/\.documents\.records\.[A-Za-z_$][\w$]*\(/g)) {
150
+ keyed(argumentText(bundle, call.index + call[0].length), "model");
151
+ }
152
+ // `<anything>.api.<family>` and the ctx helpers.
153
+ for (const match of bundle.matchAll(/\.api\.([A-Za-z_$][\w$]*)/g)) {
154
+ families.add(match[1]);
155
+ }
156
+ const helpers = [
157
+ [/\.db\(/, "databases"],
158
+ // #3281 — the typed document handle, a binding over documents.records.*.
159
+ [/\.doc\(/, "documents"],
160
+ [/\.integrations\.call\(/, "integrations"],
161
+ [/\.prompts\.run\(/, "prompts"],
162
+ [/\.secret\(/, "secrets"],
163
+ [/\.configVar\(/, "configVars"],
164
+ [/\.users\.send\(/, "users"],
165
+ [/\.connections\.send\(/, "connections"],
166
+ [/\.channels\.(?:authorize|publish)\(/, "channels"],
167
+ ];
168
+ for (const [pattern, family] of helpers) {
169
+ if (pattern.test(bundle))
170
+ families.add(family);
171
+ }
172
+ return {
173
+ models: [...models].sort(),
174
+ families: [...families].sort(),
175
+ dynamicModels,
176
+ };
177
+ }
178
+ /** The line prefix the child frames its result with. */
179
+ const RESULT_SENTINEL = "__PRIMITIVE_COLLECT__";
180
+ /**
181
+ * The recording stub the collect build substitutes for
182
+ * `primitive-functions`.
183
+ *
184
+ * It records what was registered and does nothing else: `defineFunction` and
185
+ * every other export are inert, so a module that calls one at import time
186
+ * neither fails nor has an effect.
187
+ */
188
+ export const COLLECT_STUB_SOURCE = `
189
+ const registry = (globalThis.__PRIMITIVE_COLLECT_REGISTRY__ ||= []);
190
+
191
+ // The default-coercion rule the SDK applies at registration (#3281,
192
+ // D3281-SO-005), spelled here too so a default the declared type cannot
193
+ // coerce is refused at PUSH — this stub is what push runs — rather than at
194
+ // the first invocation. The vendored grammar (\`coerceParamDefault\` in
195
+ // generated-config-surfaces.ts) is the same rule and re-checks the manifest.
196
+ const SCALAR_TYPES = ["string", "number", "boolean", "any"];
197
+ function coerceScalar(type, value) {
198
+ if (type === "number") {
199
+ const n = typeof value === "number" ? value : Number(value);
200
+ if (typeof value === "boolean" || value === null || value === "" || !Number.isFinite(n)) {
201
+ return { ok: false, reason: "must be a number" };
202
+ }
203
+ return { ok: true, value: n };
204
+ }
205
+ if (type === "boolean") {
206
+ if (typeof value === "boolean") return { ok: true, value };
207
+ if (value === "true") return { ok: true, value: true };
208
+ if (value === "false") return { ok: true, value: false };
209
+ return { ok: false, reason: "must be a boolean" };
210
+ }
211
+ if (type === "string") {
212
+ if (typeof value !== "string") return { ok: false, reason: "must be a string" };
213
+ return { ok: true, value };
214
+ }
215
+ return { ok: true, value };
216
+ }
217
+ function coerceDefault(spec, value) {
218
+ if (spec.type === "array") {
219
+ if (!Array.isArray(value)) return { ok: false, reason: "must be an array" };
220
+ const itemType = spec.items && spec.items.type ? String(spec.items.type) : "any";
221
+ const out = [];
222
+ for (const element of value) {
223
+ const coerced = coerceScalar(itemType, element);
224
+ if (!coerced.ok) return { ok: false, reason: "every element " + coerced.reason };
225
+ out.push(coerced.value);
226
+ }
227
+ return { ok: true, value: out };
228
+ }
229
+ return coerceScalar(spec.type === undefined ? "any" : String(spec.type), value);
230
+ }
231
+
232
+ function record(kind, name, config) {
233
+ const c = config || {};
234
+ const params = {};
235
+ for (const [key, value] of Object.entries(c.params || {})) {
236
+ const spec = value && typeof value === "object" ? value : { type: String(value) };
237
+ const entry = {};
238
+ const fail = (message) => {
239
+ throw new Error("'" + name + "': parameter '" + key + "' " + message);
240
+ };
241
+ if (spec.type !== undefined) entry.type = String(spec.type);
242
+ if (entry.type === "array") {
243
+ if (spec.items !== undefined && spec.items !== null) {
244
+ const itemType =
245
+ spec.items && typeof spec.items === "object" ? String(spec.items.type ?? "") : "";
246
+ if (!SCALAR_TYPES.includes(itemType)) {
247
+ fail("declares an \`items\` type outside " + SCALAR_TYPES.join(", ") + ".");
248
+ }
249
+ entry.items = { type: itemType };
250
+ }
251
+ if (spec.caller === true) fail("is an array bound to $caller; \`caller\` is a scalar binding.");
252
+ }
253
+ if (spec.default !== undefined) {
254
+ const coerced = coerceDefault(entry, spec.default);
255
+ if (!coerced.ok) fail("has a default that " + coerced.reason + ".");
256
+ entry.default = coerced.value;
257
+ }
258
+ if (spec.caller === true || spec === "$caller" || spec.type === "$caller") {
259
+ entry.caller = true;
260
+ }
261
+ params[String(key)] = entry;
262
+ }
263
+ const declaredCaller = Object.values(params).some((p) => p.caller === true);
264
+ registry.push({
265
+ kind,
266
+ name: String(name),
267
+ models: Array.isArray(c.models) ? c.models.map(String) : [],
268
+ params,
269
+ cache:
270
+ c.cache && typeof c.cache === "object" && Number(c.cache.ttlMs) > 0
271
+ ? { ttlMs: Number(c.cache.ttlMs) }
272
+ : null,
273
+ callerScoped: declaredCaller,
274
+ });
275
+ return async () => {
276
+ throw new Error(
277
+ "'" + name + "' was called during manifest collection; a registration's " +
278
+ "\`run\` only executes inside a real invocation."
279
+ );
280
+ };
281
+ }
282
+
283
+ // The PUBLIC surface, all of it. An ESM import of a name a module does not
284
+ // export is a build error, so a stub missing one export refuses a tree the
285
+ // sandbox would have run — collection is mandatory, so that is a valid
286
+ // function that cannot be pushed at all (CR3187-007). The constants carry the
287
+ // runtime's own values so a registration computed from one collects the same
288
+ // way it will run.
289
+ export const SDK_STUB_VERSION = "collect";
290
+ export const MAX_QUERY_CACHE_TTL_MS = 60000;
291
+ export const PMAP_DEFAULT_CONCURRENCY = 8;
292
+ export function defineQuery(name, config) { return record("query", name, config); }
293
+ export function defineMutation(name, config) { return record("mutation", name, config); }
294
+ export function defineFunction(keyOrHandler, maybeHandler) {
295
+ // The KEYED form (#3281) returns a wrapper CARRYING its key, exactly as the
296
+ // baked SDK's does. That is what push reads: the child resolves the callable
297
+ // the bootstrap would select and compares THAT key to the file's
298
+ // (D3281-SO-006). The registry entry is the child's report of what the
299
+ // module scope did; it is not what the check consults, because a keyed
300
+ // handler an entry merely imports for composition registers here too.
301
+ if (typeof keyOrHandler === "string" || maybeHandler !== undefined) {
302
+ registry.push({ kind: "function", name: String(keyOrHandler) });
303
+ const wrapped = function (...args) {
304
+ return maybeHandler(...args);
305
+ };
306
+ wrapped.functionKey = String(keyOrHandler);
307
+ return wrapped;
308
+ }
309
+ return keyOrHandler;
310
+ }
311
+ export function pMap(items, mapper) { return Promise.all((items || []).map(mapper)); }
312
+ export function ulid() { return "00000000000000000000000000"; }
313
+ export const stepPolicy = new Proxy({}, { get: () => ({}) });
314
+ // #3482 — the runtime surface, and \`assertRuntime\` is INERT here on purpose.
315
+ // Collection has no runtime: this child process exists to learn what a tree
316
+ // registers, and there is nothing for an assertion to be about. A stub that
317
+ // threw would refuse exactly the functions the assertion exists for — and the
318
+ // placement the guide teaches is module scope, which collection runs.
319
+ export function assertRuntime() {}
320
+ export class FunctionRuntimeError extends Error {
321
+ constructor(message, runtime, required) {
322
+ super(message);
323
+ this.name = "FUNCTION_RUNTIME_REFUSED";
324
+ this.runtime = runtime;
325
+ this.required = required;
326
+ }
327
+ }
328
+ export default {
329
+ SDK_STUB_VERSION,
330
+ defineFunction,
331
+ defineQuery,
332
+ defineMutation,
333
+ pMap,
334
+ ulid,
335
+ assertRuntime,
336
+ FunctionRuntimeError,
337
+ };
338
+ `;
339
+ /**
340
+ * The child's whole program: import the built bundle, report the registry and
341
+ * the key of the handler the entry EXPORTS.
342
+ *
343
+ * The module is kept rather than discarded (D3281-SO-006). Every keyed
344
+ * `defineFunction` anywhere in the import graph writes to the registry, so the
345
+ * registry alone cannot tell an entry that DECLARES a key from one that merely
346
+ * imports a keyed handler to compose with — and those are the two cases push
347
+ * has to answer differently. `handlerOf` is the bootstrap's own selection rule,
348
+ * spelled the same way here, so the callable this reports is the callable that
349
+ * would run.
350
+ *
351
+ * It is applied to the same VALUE the bootstrap applies it to, which is the
352
+ * DEFAULT EXPORT and not the module namespace (CR3281-002). The bootstrap
353
+ * binds `import entry from "./function.js"` and calls `handlerOf(entry)`, so
354
+ * for `export default { handler: defineFunction("other", …) }` it selects the
355
+ * keyed handler while `handlerOf(namespace)` selected nothing — the one shape
356
+ * where a handler keyed for another function would run and push could not see
357
+ * it. A module with no default export is one the sandbox cannot start at all
358
+ * (the loader refuses it by name), and there the namespace is still read, so
359
+ * a key declared on a named `handler` export is reported rather than lost.
360
+ */
361
+ const RUNNER_SOURCE = `
362
+ const sentinel = ${JSON.stringify(RESULT_SENTINEL)};
363
+ const target = process.argv[2];
364
+ function handlerOf(mod) {
365
+ if (typeof mod === "function") return mod;
366
+ if (mod && typeof mod.default === "function") return mod.default;
367
+ if (mod && typeof mod.handler === "function") return mod.handler;
368
+ return null;
369
+ }
370
+ (async () => {
371
+ try {
372
+ const mod = await import(target);
373
+ const registry = globalThis.__PRIMITIVE_COLLECT_REGISTRY__ || [];
374
+ // What the bootstrap's \`import entry from "./function.js"\` binds.
375
+ const entry = mod && "default" in mod ? mod.default : mod;
376
+ const exported = handlerOf(entry);
377
+ const exportedKey =
378
+ exported && typeof exported.functionKey === "string" ? exported.functionKey : null;
379
+ process.stdout.write(
380
+ sentinel + JSON.stringify({ ok: true, registry, exportedKey }) + "\\n"
381
+ );
382
+ } catch (error) {
383
+ process.stdout.write(
384
+ sentinel +
385
+ JSON.stringify({
386
+ ok: false,
387
+ error: String((error && error.message) || error),
388
+ }) +
389
+ "\\n"
390
+ );
391
+ }
392
+ process.exit(0);
393
+ })();
394
+ `;
395
+ /**
396
+ * The environment the child gets: nothing but what Node needs to start.
397
+ *
398
+ * An explicit pass-through rather than a denylist, because the interesting
399
+ * variables are the ones nobody thought to name.
400
+ */
401
+ function scrubbedEnv() {
402
+ const env = {
403
+ PATH: process.env.PATH ?? "/usr/bin:/bin",
404
+ NODE_ENV: "production",
405
+ };
406
+ // Windows needs these to resolve anything at all.
407
+ for (const key of ["SystemRoot", "TEMP", "TMP", "COMSPEC"]) {
408
+ if (process.env[key])
409
+ env[key] = process.env[key];
410
+ }
411
+ return env;
412
+ }
413
+ /**
414
+ * Build the collect bundle: the same tree, the same inlining, the recording
415
+ * stub in place of the SDK.
416
+ *
417
+ * The import boundary is not re-checked here — `buildFunctionBundle` has
418
+ * already refused an escaping tree by the time collection runs, and this build
419
+ * reads exactly the files that one did.
420
+ */
421
+ async function buildCollectBundle(options) {
422
+ const stubPlugin = {
423
+ name: "primitive-functions-collect-stub",
424
+ setup(build) {
425
+ build.onResolve({ filter: /^primitive-functions$/ }, () => ({
426
+ path: PRIMITIVE_FUNCTIONS_MODULE,
427
+ namespace: "primitive-collect-stub",
428
+ }));
429
+ build.onLoad({ filter: /.*/, namespace: "primitive-collect-stub" }, () => ({ contents: COLLECT_STUB_SOURCE, loader: "js" }));
430
+ },
431
+ };
432
+ try {
433
+ const result = await esbuild.build({
434
+ entryPoints: [options.entry],
435
+ absWorkingDir: options.treeRoot,
436
+ bundle: true,
437
+ write: false,
438
+ format: "esm",
439
+ platform: "neutral",
440
+ target: "es2022",
441
+ plugins: [stubPlugin],
442
+ logLevel: "silent",
443
+ });
444
+ const output = result.outputFiles?.[0];
445
+ if (!output) {
446
+ throw new FunctionCollectError(`function '${options.functionKey}': manifest collection produced no output`);
447
+ }
448
+ return Buffer.from(output.contents).toString("utf-8");
449
+ }
450
+ catch (error) {
451
+ if (error instanceof FunctionCollectError)
452
+ throw error;
453
+ const messages = Array.isArray(error?.errors)
454
+ ? error.errors.map((e) => ` ${e?.location?.file ?? options.entry}: ${e?.text ?? "build error"}`)
455
+ : [` ${options.entry}: ${error?.message ?? String(error)}`];
456
+ throw new FunctionCollectError(`function '${options.functionKey}': manifest collection could not build the tree:\n${messages.join("\n")}`);
457
+ }
458
+ }
459
+ /**
460
+ * Collect one function's manifest.
461
+ *
462
+ * Throws `FunctionCollectError` for every failure — a build error, a module
463
+ * that throws at import, a loop that outlives the bound, or output that is not
464
+ * the framed result — because a push whose manifest could not be collected is
465
+ * refused rather than pushed without one (D3187-SO-005: the manifest is part
466
+ * of the envelope, so "later" would mean a different version).
467
+ */
468
+ export async function collectFunctionManifest(options) {
469
+ const treeRoot = resolve(options.configDir);
470
+ const timeoutMs = options.timeoutMs ?? COLLECT_TIMEOUT_MS;
471
+ const code = await buildCollectBundle({
472
+ treeRoot,
473
+ entry: options.entry,
474
+ functionKey: options.functionKey,
475
+ });
476
+ const scratch = mkdtempSync(join(tmpdir(), "primitive-collect-"));
477
+ const bundlePath = join(scratch, "bundle.mjs");
478
+ const runnerPath = join(scratch, "runner.mjs");
479
+ writeFileSync(bundlePath, code, "utf-8");
480
+ writeFileSync(runnerPath, RUNNER_SOURCE, "utf-8");
481
+ try {
482
+ const framed = await runCollectChild({
483
+ runnerPath,
484
+ bundlePath,
485
+ treeRoot,
486
+ timeoutMs,
487
+ functionKey: options.functionKey,
488
+ });
489
+ if (!framed.ok) {
490
+ throw new FunctionCollectError(`function '${options.functionKey}': manifest collection failed while ` +
491
+ `running the tree's module scope: ${framed.error}`);
492
+ }
493
+ return manifestFrom(framed.registry ?? [], options.functionKey, scanBundleForManifest(options.bundle ?? code), framed.exportedKey ?? null);
494
+ }
495
+ finally {
496
+ rmSync(scratch, { recursive: true, force: true });
497
+ }
498
+ }
499
+ function runCollectChild(options) {
500
+ return new Promise((resolvePromise, rejectPromise) => {
501
+ const child = spawn(process.execPath, [options.runnerPath, options.bundlePath], {
502
+ cwd: options.treeRoot,
503
+ env: scrubbedEnv(),
504
+ stdio: ["ignore", "pipe", "pipe"],
505
+ });
506
+ let stdout = "";
507
+ let stderr = "";
508
+ let settled = false;
509
+ const finish = (fn) => {
510
+ if (settled)
511
+ return;
512
+ settled = true;
513
+ clearTimeout(timer);
514
+ fn();
515
+ };
516
+ const timer = setTimeout(() => {
517
+ child.kill("SIGKILL");
518
+ finish(() => rejectPromise(new FunctionCollectError(`function '${options.functionKey}': manifest collection timed out ` +
519
+ `after ${options.timeoutMs}ms. Collection runs the tree's module ` +
520
+ "scope, so a loop or a blocking call at import time stops the " +
521
+ "push rather than hanging it.")));
522
+ }, options.timeoutMs);
523
+ child.stdout.on("data", (chunk) => (stdout += String(chunk)));
524
+ child.stderr.on("data", (chunk) => (stderr += String(chunk)));
525
+ child.on("error", (error) => finish(() => rejectPromise(new FunctionCollectError(`function '${options.functionKey}': manifest collection could not ` +
526
+ `start: ${error.message}`))));
527
+ child.on("close", () => finish(() => {
528
+ const line = stdout
529
+ .split("\n")
530
+ .reverse()
531
+ .find((entry) => entry.startsWith(RESULT_SENTINEL));
532
+ if (!line) {
533
+ rejectPromise(new FunctionCollectError(`function '${options.functionKey}': manifest collection reported ` +
534
+ "no result" +
535
+ (stderr.trim() ? `: ${stderr.trim().slice(0, 500)}` : ".")));
536
+ return;
537
+ }
538
+ try {
539
+ resolvePromise(JSON.parse(line.slice(RESULT_SENTINEL.length)));
540
+ }
541
+ catch (error) {
542
+ rejectPromise(new FunctionCollectError(`function '${options.functionKey}': manifest collection reported ` +
543
+ `unreadable output: ${error.message}`));
544
+ }
545
+ }));
546
+ });
547
+ }
548
+ /** Normalize and validate what the child recorded, and merge in the scan. */
549
+ function manifestFrom(registry, functionKey, scanned, exportedKey) {
550
+ // #3281 — the key the entry's EXPORTED handler carries. The compiler holds
551
+ // the key to the TREE (an undeclared key does not compile); this holds it to
552
+ // the FILE, before any request is made, with the runtime value — a key
553
+ // computed at module scope is checked as what it evaluated to.
554
+ //
555
+ // The subject is the exported handler and nothing else (D3281-SO-006). A
556
+ // keyed handler an entry IMPORTS is registered in the same graph, so
557
+ // comparing every registration would refuse ordinary composition; accepting
558
+ // any matching registration would let a module export the wrong handler and
559
+ // run typed against another file's schemas. The callable the bootstrap would
560
+ // select is the one that answers "what did this file ship?".
561
+ //
562
+ // A null key is an unkeyed handler — there is nothing to disagree with.
563
+ if (exportedKey !== null && exportedKey !== functionKey) {
564
+ throw new FunctionCollectError(`function '${functionKey}': its entry exports defineFunction("${exportedKey}", …), ` +
565
+ `which is not this file's key. The key names functions/${functionKey}.toml, so ` +
566
+ `write defineFunction("${functionKey}", …) — or drop the key to use the unkeyed form.`);
567
+ }
568
+ const queries = [];
569
+ const seen = new Set();
570
+ for (const entry of registry) {
571
+ if (entry?.kind === "function")
572
+ continue;
573
+ const name = String(entry?.name ?? "");
574
+ if (!name) {
575
+ throw new FunctionCollectError(`function '${functionKey}': a registration has no name.`);
576
+ }
577
+ if (seen.has(name)) {
578
+ // The SDK throws on this at runtime too; refusing here means an author
579
+ // learns at push rather than at the first invocation.
580
+ throw new FunctionCollectError(`function '${functionKey}': '${name}' is registered twice. Every ` +
581
+ "registered query and mutation needs its own name.");
582
+ }
583
+ seen.add(name);
584
+ queries.push({
585
+ name,
586
+ kind: entry?.kind === "mutation" ? "mutation" : "query",
587
+ models: Array.isArray(entry?.models) ? entry.models.map(String) : [],
588
+ params: entry?.params && typeof entry.params === "object" ? entry.params : {},
589
+ cache: entry?.cache && Number(entry.cache.ttlMs) > 0
590
+ ? { ttlMs: Number(entry.cache.ttlMs) }
591
+ : null,
592
+ callerScoped: entry?.callerScoped === true,
593
+ });
594
+ }
595
+ queries.sort((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0));
596
+ // The registrations' declared models join the scanned ones: a registration
597
+ // is a statement about what a query touches, and the manifest is the union.
598
+ const models = new Set(scanned.models);
599
+ for (const query of queries)
600
+ for (const model of query.models)
601
+ models.add(model);
602
+ return {
603
+ schemaVersion: FUNCTION_MANIFEST_SCHEMA_VERSION,
604
+ queries,
605
+ models: [...models].sort(),
606
+ families: scanned.families,
607
+ dynamicModels: scanned.dynamicModels,
608
+ };
609
+ }
610
+ //# sourceMappingURL=function-collect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"function-collect.js","sourceRoot":"","sources":["../../../src/lib/function-collect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AAEH,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAElE,0EAA0E;AAC1E,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,CAAC;AAElD,yEAAyE;AACzE,MAAM,CAAC,MAAM,kBAAkB,GAA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