primitive-admin 1.1.0-alpha.6 → 1.1.0-alpha.61

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 (387) hide show
  1. package/README.md +389 -71
  2. package/assets/skill/skills/primitive-platform/SKILL.md +670 -0
  3. package/dist/bin/primitive.d.ts +2 -0
  4. package/dist/bin/primitive.js +287 -17
  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 +138 -19
  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 +554 -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 +27 -80
  14. package/dist/src/commands/apps.js.map +1 -1
  15. package/dist/src/commands/auth.d.ts +2 -0
  16. package/dist/src/commands/auth.js +177 -7
  17. package/dist/src/commands/auth.js.map +1 -1
  18. package/dist/src/commands/blob-buckets.d.ts +2 -0
  19. package/dist/src/commands/blob-buckets.js +330 -0
  20. package/dist/src/commands/blob-buckets.js.map +1 -0
  21. package/dist/src/commands/catalog.d.ts +2 -0
  22. package/dist/src/commands/catalog.js +37 -38
  23. package/dist/src/commands/catalog.js.map +1 -1
  24. package/dist/src/commands/collection-type-configs.d.ts +2 -0
  25. package/dist/src/commands/collection-type-configs.js +92 -0
  26. package/dist/src/commands/collection-type-configs.js.map +1 -0
  27. package/dist/src/commands/collections.d.ts +2 -0
  28. package/dist/src/commands/collections.js +526 -0
  29. package/dist/src/commands/collections.js.map +1 -0
  30. package/dist/src/commands/comparisons.d.ts +2 -0
  31. package/dist/src/commands/comparisons.js +6 -6
  32. package/dist/src/commands/comparisons.js.map +1 -1
  33. package/dist/src/commands/config.d.ts +35 -0
  34. package/dist/src/commands/config.js +437 -0
  35. package/dist/src/commands/config.js.map +1 -0
  36. package/dist/src/commands/connections.d.ts +2 -0
  37. package/dist/src/commands/connections.js +100 -0
  38. package/dist/src/commands/connections.js.map +1 -0
  39. package/dist/src/commands/cron-triggers.d.ts +2 -0
  40. package/dist/src/commands/cron-triggers.js +204 -0
  41. package/dist/src/commands/cron-triggers.js.map +1 -0
  42. package/dist/src/commands/database-types.d.ts +2 -0
  43. package/dist/src/commands/database-types.js +171 -0
  44. package/dist/src/commands/database-types.js.map +1 -0
  45. package/dist/src/commands/databases.d.ts +65 -0
  46. package/dist/src/commands/databases.js +2153 -96
  47. package/dist/src/commands/databases.js.map +1 -1
  48. package/dist/src/commands/documents.d.ts +2 -0
  49. package/dist/src/commands/documents.js +1230 -19
  50. package/dist/src/commands/documents.js.map +1 -1
  51. package/dist/src/commands/email-templates.d.ts +2 -0
  52. package/dist/src/commands/email-templates.js +174 -0
  53. package/dist/src/commands/email-templates.js.map +1 -0
  54. package/dist/src/commands/env.d.ts +12 -0
  55. package/dist/src/commands/env.js +260 -0
  56. package/dist/src/commands/env.js.map +1 -0
  57. package/dist/src/commands/group-type-configs.d.ts +2 -0
  58. package/dist/src/commands/group-type-configs.js +86 -0
  59. package/dist/src/commands/group-type-configs.js.map +1 -0
  60. package/dist/src/commands/groups.d.ts +2 -0
  61. package/dist/src/commands/groups.js +38 -99
  62. package/dist/src/commands/groups.js.map +1 -1
  63. package/dist/src/commands/guides.d.ts +223 -0
  64. package/dist/src/commands/guides.js +617 -65
  65. package/dist/src/commands/guides.js.map +1 -1
  66. package/dist/src/commands/init.d.ts +17 -0
  67. package/dist/src/commands/init.js +964 -202
  68. package/dist/src/commands/init.js.map +1 -1
  69. package/dist/src/commands/integrations.d.ts +2 -0
  70. package/dist/src/commands/integrations.js +484 -205
  71. package/dist/src/commands/integrations.js.map +1 -1
  72. package/dist/src/commands/llm.d.ts +2 -0
  73. package/dist/src/commands/llm.js +13 -8
  74. package/dist/src/commands/llm.js.map +1 -1
  75. package/dist/src/commands/locks.d.ts +8 -0
  76. package/dist/src/commands/locks.js +160 -0
  77. package/dist/src/commands/locks.js.map +1 -0
  78. package/dist/src/commands/metadata.d.ts +2 -0
  79. package/dist/src/commands/metadata.js +406 -0
  80. package/dist/src/commands/metadata.js.map +1 -0
  81. package/dist/src/commands/prompts.d.ts +2 -0
  82. package/dist/src/commands/prompts.js +135 -355
  83. package/dist/src/commands/prompts.js.map +1 -1
  84. package/dist/src/commands/rule-sets.d.ts +3 -0
  85. package/dist/src/commands/rule-sets.js +271 -0
  86. package/dist/src/commands/rule-sets.js.map +1 -0
  87. package/dist/src/commands/scripts.d.ts +20 -0
  88. package/dist/src/commands/scripts.js +739 -0
  89. package/dist/src/commands/scripts.js.map +1 -0
  90. package/dist/src/commands/secrets.d.ts +2 -0
  91. package/dist/src/commands/secrets.js +108 -0
  92. package/dist/src/commands/secrets.js.map +1 -0
  93. package/dist/src/commands/sessions.d.ts +2 -0
  94. package/dist/src/commands/sessions.js +75 -0
  95. package/dist/src/commands/sessions.js.map +1 -0
  96. package/dist/src/commands/settings.d.ts +18 -0
  97. package/dist/src/commands/settings.js +54 -0
  98. package/dist/src/commands/settings.js.map +1 -0
  99. package/dist/src/commands/skill.d.ts +2 -0
  100. package/dist/src/commands/skill.js +29 -0
  101. package/dist/src/commands/skill.js.map +1 -0
  102. package/dist/src/commands/sync-app-settings.d.ts +125 -0
  103. package/dist/src/commands/sync-app-settings.js +380 -0
  104. package/dist/src/commands/sync-app-settings.js.map +1 -0
  105. package/dist/src/commands/sync.d.ts +958 -0
  106. package/dist/src/commands/sync.js +8954 -812
  107. package/dist/src/commands/sync.js.map +1 -1
  108. package/dist/src/commands/tokens.d.ts +2 -0
  109. package/dist/src/commands/tokens.js +130 -21
  110. package/dist/src/commands/tokens.js.map +1 -1
  111. package/dist/src/commands/users.d.ts +2 -0
  112. package/dist/src/commands/users.js +440 -22
  113. package/dist/src/commands/users.js.map +1 -1
  114. package/dist/src/commands/vars.d.ts +8 -0
  115. package/dist/src/commands/vars.js +96 -0
  116. package/dist/src/commands/vars.js.map +1 -0
  117. package/dist/src/commands/waitlist.d.ts +2 -0
  118. package/dist/src/commands/waitlist.js +10 -10
  119. package/dist/src/commands/waitlist.js.map +1 -1
  120. package/dist/src/commands/webhooks.d.ts +2 -0
  121. package/dist/src/commands/webhooks.js +442 -0
  122. package/dist/src/commands/webhooks.js.map +1 -0
  123. package/dist/src/commands/workflows.d.ts +94 -0
  124. package/dist/src/commands/workflows.js +1581 -448
  125. package/dist/src/commands/workflows.js.map +1 -1
  126. package/dist/src/lib/api-client.d.ts +1814 -0
  127. package/dist/src/lib/api-client.js +1655 -103
  128. package/dist/src/lib/api-client.js.map +1 -1
  129. package/dist/src/lib/app-settings-descriptor.d.ts +130 -0
  130. package/dist/src/lib/app-settings-descriptor.js +262 -0
  131. package/dist/src/lib/app-settings-descriptor.js.map +1 -0
  132. package/dist/src/lib/auth-flow.d.ts +8 -0
  133. package/dist/src/lib/batch.d.ts +26 -0
  134. package/dist/src/lib/batch.js +32 -0
  135. package/dist/src/lib/batch.js.map +1 -0
  136. package/dist/src/lib/block-layout.d.ts +160 -0
  137. package/dist/src/lib/block-layout.js +451 -0
  138. package/dist/src/lib/block-layout.js.map +1 -0
  139. package/dist/src/lib/canonical-json.d.ts +12 -0
  140. package/dist/src/lib/canonical-json.js +35 -0
  141. package/dist/src/lib/canonical-json.js.map +1 -0
  142. package/dist/src/lib/channel.d.ts +30 -0
  143. package/dist/src/lib/channel.js +68 -0
  144. package/dist/src/lib/channel.js.map +1 -0
  145. package/dist/src/lib/cli-manifest.d.ts +68 -0
  146. package/dist/src/lib/cli-manifest.js +71 -0
  147. package/dist/src/lib/cli-manifest.js.map +1 -0
  148. package/dist/src/lib/codegen-shared/generatedFiles.d.ts +97 -0
  149. package/dist/src/lib/codegen-shared/generatedFiles.js +184 -0
  150. package/dist/src/lib/codegen-shared/generatedFiles.js.map +1 -0
  151. package/dist/src/lib/codegen-shared/prettierStable.d.ts +262 -0
  152. package/dist/src/lib/codegen-shared/prettierStable.js +610 -0
  153. package/dist/src/lib/codegen-shared/prettierStable.js.map +1 -0
  154. package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.d.ts +68 -0
  155. package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.js +168 -0
  156. package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.js.map +1 -0
  157. package/dist/src/lib/config-object-descriptor.d.ts +108 -0
  158. package/dist/src/lib/config-object-descriptor.js +607 -0
  159. package/dist/src/lib/config-object-descriptor.js.map +1 -0
  160. package/dist/src/lib/config-payload.d.ts +85 -0
  161. package/dist/src/lib/config-payload.js +105 -0
  162. package/dist/src/lib/config-payload.js.map +1 -0
  163. package/dist/src/lib/config-surface.d.ts +93 -0
  164. package/dist/src/lib/config-surface.js +178 -0
  165. package/dist/src/lib/config-surface.js.map +1 -0
  166. package/dist/src/lib/config-toml.d.ts +10 -0
  167. package/dist/src/lib/config-toml.js +42 -0
  168. package/dist/src/lib/config-toml.js.map +1 -0
  169. package/dist/src/lib/config.d.ts +53 -0
  170. package/dist/src/lib/config.js +92 -53
  171. package/dist/src/lib/config.js.map +1 -1
  172. package/dist/src/lib/confirm-prompt.d.ts +83 -0
  173. package/dist/src/lib/confirm-prompt.js +110 -0
  174. package/dist/src/lib/confirm-prompt.js.map +1 -0
  175. package/dist/src/lib/constants.d.ts +11 -0
  176. package/dist/src/lib/constants.js +12 -0
  177. package/dist/src/lib/constants.js.map +1 -0
  178. package/dist/src/lib/crash-handlers.d.ts +20 -0
  179. package/dist/src/lib/crash-handlers.js +49 -0
  180. package/dist/src/lib/crash-handlers.js.map +1 -0
  181. package/dist/src/lib/credentials-store.d.ts +89 -0
  182. package/dist/src/lib/credentials-store.js +330 -0
  183. package/dist/src/lib/credentials-store.js.map +1 -0
  184. package/dist/src/lib/csv.d.ts +47 -0
  185. package/dist/src/lib/csv.js +172 -0
  186. package/dist/src/lib/csv.js.map +1 -0
  187. package/dist/src/lib/data-input.d.ts +23 -0
  188. package/dist/src/lib/data-input.js +50 -0
  189. package/dist/src/lib/data-input.js.map +1 -0
  190. package/dist/src/lib/db-codegen/dbFingerprint.d.ts +10 -0
  191. package/dist/src/lib/db-codegen/dbFingerprint.js +17 -0
  192. package/dist/src/lib/db-codegen/dbFingerprint.js.map +1 -0
  193. package/dist/src/lib/db-codegen/dbGenerator.d.ts +67 -0
  194. package/dist/src/lib/db-codegen/dbGenerator.js +170 -0
  195. package/dist/src/lib/db-codegen/dbGenerator.js.map +1 -0
  196. package/dist/src/lib/db-codegen/dbNaming.d.ts +87 -0
  197. package/dist/src/lib/db-codegen/dbNaming.js +180 -0
  198. package/dist/src/lib/db-codegen/dbNaming.js.map +1 -0
  199. package/dist/src/lib/db-codegen/dbTemplates.d.ts +272 -0
  200. package/dist/src/lib/db-codegen/dbTemplates.js +480 -0
  201. package/dist/src/lib/db-codegen/dbTemplates.js.map +1 -0
  202. package/dist/src/lib/db-codegen/dbTsTypes.d.ts +73 -0
  203. package/dist/src/lib/db-codegen/dbTsTypes.js +139 -0
  204. package/dist/src/lib/db-codegen/dbTsTypes.js.map +1 -0
  205. package/dist/src/lib/db-codegen/dbTypeIR.d.ts +146 -0
  206. package/dist/src/lib/db-codegen/dbTypeIR.js +517 -0
  207. package/dist/src/lib/db-codegen/dbTypeIR.js.map +1 -0
  208. package/dist/src/lib/db-codegen/generated-operation-def-descriptor.d.ts +112 -0
  209. package/dist/src/lib/db-codegen/generated-operation-def-descriptor.js +211 -0
  210. package/dist/src/lib/db-codegen/generated-operation-def-descriptor.js.map +1 -0
  211. package/dist/src/lib/env-resolver.d.ts +62 -0
  212. package/dist/src/lib/env-resolver.js +121 -0
  213. package/dist/src/lib/env-resolver.js.map +1 -0
  214. package/dist/src/lib/fetch.d.ts +5 -0
  215. package/dist/src/lib/generated-allowlist.d.ts +28 -0
  216. package/dist/src/lib/generated-allowlist.js +266 -0
  217. package/dist/src/lib/generated-allowlist.js.map +1 -0
  218. package/dist/src/lib/generated-config-surfaces.d.ts +578 -0
  219. package/dist/src/lib/generated-config-surfaces.js +3630 -0
  220. package/dist/src/lib/generated-config-surfaces.js.map +1 -0
  221. package/dist/src/lib/generated-template-lint.d.ts +206 -0
  222. package/dist/src/lib/generated-template-lint.js +589 -0
  223. package/dist/src/lib/generated-template-lint.js.map +1 -0
  224. package/dist/src/lib/generated-workflow-model-fields.d.ts +20 -0
  225. package/dist/src/lib/generated-workflow-model-fields.js +53 -0
  226. package/dist/src/lib/generated-workflow-model-fields.js.map +1 -0
  227. package/dist/src/lib/google-client-secret-status.d.ts +35 -0
  228. package/dist/src/lib/google-client-secret-status.js +56 -0
  229. package/dist/src/lib/google-client-secret-status.js.map +1 -0
  230. package/dist/src/lib/init-config.d.ts +81 -0
  231. package/dist/src/lib/init-config.js +149 -0
  232. package/dist/src/lib/init-config.js.map +1 -0
  233. package/dist/src/lib/log-inspection.d.ts +568 -0
  234. package/dist/src/lib/log-inspection.js +639 -0
  235. package/dist/src/lib/log-inspection.js.map +1 -0
  236. package/dist/src/lib/migration-nag.d.ts +49 -0
  237. package/dist/src/lib/migration-nag.js +163 -0
  238. package/dist/src/lib/migration-nag.js.map +1 -0
  239. package/dist/src/lib/output.d.ts +109 -0
  240. package/dist/src/lib/output.js +191 -8
  241. package/dist/src/lib/output.js.map +1 -1
  242. package/dist/src/lib/package-manager.d.ts +140 -0
  243. package/dist/src/lib/package-manager.js +305 -0
  244. package/dist/src/lib/package-manager.js.map +1 -0
  245. package/dist/src/lib/paginate.d.ts +83 -0
  246. package/dist/src/lib/paginate.js +95 -0
  247. package/dist/src/lib/paginate.js.map +1 -0
  248. package/dist/src/lib/platform-owned.d.ts +51 -0
  249. package/dist/src/lib/platform-owned.js +64 -0
  250. package/dist/src/lib/platform-owned.js.map +1 -0
  251. package/dist/src/lib/project-config.d.ts +97 -0
  252. package/dist/src/lib/project-config.js +219 -0
  253. package/dist/src/lib/project-config.js.map +1 -0
  254. package/dist/src/lib/query-operators.d.ts +43 -0
  255. package/dist/src/lib/query-operators.js +80 -0
  256. package/dist/src/lib/query-operators.js.map +1 -0
  257. package/dist/src/lib/record-filter.d.ts +18 -0
  258. package/dist/src/lib/record-filter.js +55 -0
  259. package/dist/src/lib/record-filter.js.map +1 -0
  260. package/dist/src/lib/refresh-admin-credentials.d.ts +65 -0
  261. package/dist/src/lib/refresh-admin-credentials.js +103 -0
  262. package/dist/src/lib/refresh-admin-credentials.js.map +1 -0
  263. package/dist/src/lib/resolve-init-dev-port.d.ts +56 -0
  264. package/dist/src/lib/resolve-init-dev-port.js +55 -0
  265. package/dist/src/lib/resolve-init-dev-port.js.map +1 -0
  266. package/dist/src/lib/resolve-init-server.d.ts +71 -0
  267. package/dist/src/lib/resolve-init-server.js +94 -0
  268. package/dist/src/lib/resolve-init-server.js.map +1 -0
  269. package/dist/src/lib/resolve-platform.d.ts +45 -0
  270. package/dist/src/lib/resolve-platform.js +43 -0
  271. package/dist/src/lib/resolve-platform.js.map +1 -0
  272. package/dist/src/lib/run-status.d.ts +19 -0
  273. package/dist/src/lib/run-status.generated.d.ts +39 -0
  274. package/dist/src/lib/run-status.generated.js +66 -0
  275. package/dist/src/lib/run-status.generated.js.map +1 -0
  276. package/dist/src/lib/run-status.js +19 -0
  277. package/dist/src/lib/run-status.js.map +1 -0
  278. package/dist/src/lib/signing-secret-status.d.ts +81 -0
  279. package/dist/src/lib/signing-secret-status.js +116 -0
  280. package/dist/src/lib/signing-secret-status.js.map +1 -0
  281. package/dist/src/lib/skill-installer.d.ts +25 -0
  282. package/dist/src/lib/skill-installer.js +266 -0
  283. package/dist/src/lib/skill-installer.js.map +1 -0
  284. package/dist/src/lib/snapshots.d.ts +99 -0
  285. package/dist/src/lib/snapshots.js +357 -0
  286. package/dist/src/lib/snapshots.js.map +1 -0
  287. package/dist/src/lib/swift-codegen/dbGenerator.d.ts +100 -0
  288. package/dist/src/lib/swift-codegen/dbGenerator.js +682 -0
  289. package/dist/src/lib/swift-codegen/dbGenerator.js.map +1 -0
  290. package/dist/src/lib/swift-codegen/dbSwiftTypes.d.ts +42 -0
  291. package/dist/src/lib/swift-codegen/dbSwiftTypes.js +100 -0
  292. package/dist/src/lib/swift-codegen/dbSwiftTypes.js.map +1 -0
  293. package/dist/src/lib/swift-codegen/generator.d.ts +85 -0
  294. package/dist/src/lib/swift-codegen/generator.js +266 -0
  295. package/dist/src/lib/swift-codegen/generator.js.map +1 -0
  296. package/dist/src/lib/swift-codegen/schemaToSwift.d.ts +72 -0
  297. package/dist/src/lib/swift-codegen/schemaToSwift.js +644 -0
  298. package/dist/src/lib/swift-codegen/schemaToSwift.js.map +1 -0
  299. package/dist/src/lib/swift-codegen/siblingSymbols.d.ts +90 -0
  300. package/dist/src/lib/swift-codegen/siblingSymbols.js +152 -0
  301. package/dist/src/lib/swift-codegen/siblingSymbols.js.map +1 -0
  302. package/dist/src/lib/swift-codegen/swiftNaming.d.ts +85 -0
  303. package/dist/src/lib/swift-codegen/swiftNaming.js +198 -0
  304. package/dist/src/lib/swift-codegen/swiftNaming.js.map +1 -0
  305. package/dist/src/lib/sync-paths.d.ts +72 -0
  306. package/dist/src/lib/sync-paths.js +130 -0
  307. package/dist/src/lib/sync-paths.js.map +1 -0
  308. package/dist/src/lib/sync-resource-types.d.ts +445 -0
  309. package/dist/src/lib/sync-resource-types.js +812 -0
  310. package/dist/src/lib/sync-resource-types.js.map +1 -0
  311. package/dist/src/lib/sync-selectors.d.ts +95 -0
  312. package/dist/src/lib/sync-selectors.js +228 -0
  313. package/dist/src/lib/sync-selectors.js.map +1 -0
  314. package/dist/src/lib/template.d.ts +121 -0
  315. package/dist/src/lib/template.js +447 -67
  316. package/dist/src/lib/template.js.map +1 -1
  317. package/dist/src/lib/token-inject.d.ts +56 -0
  318. package/dist/src/lib/token-inject.js +204 -0
  319. package/dist/src/lib/token-inject.js.map +1 -0
  320. package/dist/src/lib/toml-database-config.d.ts +123 -0
  321. package/dist/src/lib/toml-database-config.js +527 -0
  322. package/dist/src/lib/toml-database-config.js.map +1 -0
  323. package/dist/src/lib/toml-metadata-config.d.ts +151 -0
  324. package/dist/src/lib/toml-metadata-config.js +476 -0
  325. package/dist/src/lib/toml-metadata-config.js.map +1 -0
  326. package/dist/src/lib/toml-native-form.d.ts +46 -0
  327. package/dist/src/lib/toml-native-form.js +78 -0
  328. package/dist/src/lib/toml-native-form.js.map +1 -0
  329. package/dist/src/lib/toml-params-validator.d.ts +129 -0
  330. package/dist/src/lib/toml-params-validator.js +298 -0
  331. package/dist/src/lib/toml-params-validator.js.map +1 -0
  332. package/dist/src/lib/toml-scalar-edit.d.ts +43 -0
  333. package/dist/src/lib/toml-scalar-edit.js +283 -0
  334. package/dist/src/lib/toml-scalar-edit.js.map +1 -0
  335. package/dist/src/lib/user-selector.d.ts +24 -0
  336. package/dist/src/lib/user-selector.js +33 -0
  337. package/dist/src/lib/user-selector.js.map +1 -0
  338. package/dist/src/lib/version-check.d.ts +35 -0
  339. package/dist/src/lib/version-check.js +241 -0
  340. package/dist/src/lib/version-check.js.map +1 -0
  341. package/dist/src/lib/watch.d.ts +121 -0
  342. package/dist/src/lib/watch.js +169 -0
  343. package/dist/src/lib/watch.js.map +1 -0
  344. package/dist/src/lib/workflow-apply.d.ts +51 -0
  345. package/dist/src/lib/workflow-apply.js +89 -0
  346. package/dist/src/lib/workflow-apply.js.map +1 -0
  347. package/dist/src/lib/workflow-codegen/generated-schema-descriptor.d.ts +129 -0
  348. package/dist/src/lib/workflow-codegen/generated-schema-descriptor.js +269 -0
  349. package/dist/src/lib/workflow-codegen/generated-schema-descriptor.js.map +1 -0
  350. package/dist/src/lib/workflow-codegen/generator.d.ts +96 -0
  351. package/dist/src/lib/workflow-codegen/generator.js +361 -0
  352. package/dist/src/lib/workflow-codegen/generator.js.map +1 -0
  353. package/dist/src/lib/workflow-codegen/invokerIR.d.ts +83 -0
  354. package/dist/src/lib/workflow-codegen/invokerIR.js +71 -0
  355. package/dist/src/lib/workflow-codegen/invokerIR.js.map +1 -0
  356. package/dist/src/lib/workflow-codegen/naming.d.ts +33 -0
  357. package/dist/src/lib/workflow-codegen/naming.js +81 -0
  358. package/dist/src/lib/workflow-codegen/naming.js.map +1 -0
  359. package/dist/src/lib/workflow-codegen/schemaToTs.d.ts +80 -0
  360. package/dist/src/lib/workflow-codegen/schemaToTs.js +303 -0
  361. package/dist/src/lib/workflow-codegen/schemaToTs.js.map +1 -0
  362. package/dist/src/lib/workflow-config-apply.d.ts +70 -0
  363. package/dist/src/lib/workflow-config-apply.js +137 -0
  364. package/dist/src/lib/workflow-config-apply.js.map +1 -0
  365. package/dist/src/lib/workflow-config-sidecar.d.ts +63 -0
  366. package/dist/src/lib/workflow-config-sidecar.js +96 -0
  367. package/dist/src/lib/workflow-config-sidecar.js.map +1 -0
  368. package/dist/src/lib/workflow-field-descriptor.d.ts +91 -0
  369. package/dist/src/lib/workflow-field-descriptor.js +153 -0
  370. package/dist/src/lib/workflow-field-descriptor.js.map +1 -0
  371. package/dist/src/lib/workflow-fragments.d.ts +64 -0
  372. package/dist/src/lib/workflow-fragments.js +342 -0
  373. package/dist/src/lib/workflow-fragments.js.map +1 -0
  374. package/dist/src/lib/workflow-include-preserve.d.ts +71 -0
  375. package/dist/src/lib/workflow-include-preserve.js +153 -0
  376. package/dist/src/lib/workflow-include-preserve.js.map +1 -0
  377. package/dist/src/lib/workflow-payload.d.ts +86 -0
  378. package/dist/src/lib/workflow-payload.js +168 -0
  379. package/dist/src/lib/workflow-payload.js.map +1 -0
  380. package/dist/src/lib/workflow-toml-validator.d.ts +199 -0
  381. package/dist/src/lib/workflow-toml-validator.js +754 -0
  382. package/dist/src/lib/workflow-toml-validator.js.map +1 -0
  383. package/dist/src/types/index.d.ts +533 -0
  384. package/dist/src/validators.d.ts +65 -0
  385. package/dist/src/validators.js +64 -0
  386. package/dist/src/validators.js.map +1 -0
  387. package/package.json +32 -6
@@ -0,0 +1,85 @@
1
+ /**
2
+ * Definition-driven TOML ↔ payload projection (issue #2644).
3
+ *
4
+ * Every configuration object used to restate its field surface twice inside the
5
+ * CLI — once in a pull serializer and once in a push payload literal — so a
6
+ * field added to one and not the other simply disappeared, and a pull → push
7
+ * cycle cleared it server-side. These two functions replace both halves: the
8
+ * FIELD LIST comes from the vendored definition, and only the handful of fields
9
+ * whose shape or presence semantics are genuinely their own carry a producer.
10
+ *
11
+ * `projectRecordToToml` is the pull half, `buildPayloadFromToml` the push half.
12
+ * They read the same `ConfigTable`, so they cannot disagree about which fields
13
+ * exist — which is the whole point.
14
+ */
15
+ import { writableFieldNames, type ConfigField, type ConfigTable } from "./generated-config-surfaces.js";
16
+ export type PushMode = "create" | "update";
17
+ /**
18
+ * Per-field value producer for the PULL half: the value to write under the
19
+ * field's `tomlKey`, or `undefined` to omit the key. Registered only for fields
20
+ * whose emitted shape is their own (a parsed JSON blob, a derived default);
21
+ * every other field follows its declared `emit`.
22
+ */
23
+ export type PullValue = (record: any, field: ConfigField) => any;
24
+ /**
25
+ * Per-field value producer for the PUSH half. `value` is the raw TOML value
26
+ * under the field's `tomlKey`. Registered only for fields whose presence
27
+ * semantics are their own — most importantly the TOML-owned fields that send
28
+ * `?? null` so removing a line CLEARS the value server-side (#1567) rather than
29
+ * leaving a stale one live.
30
+ */
31
+ export type PushValue = (value: any, mode: PushMode, tomlTable: any) => any;
32
+ /**
33
+ * Project a server record onto its TOML table, using the definition's field
34
+ * list and `emit` semantics.
35
+ *
36
+ * `emit: "always"` writes the value as-is (an `undefined` is dropped by the
37
+ * TOML serializer). `emit: "whenSet"` omits an unset value — `isEmptyForEmit`
38
+ * is #1033's shared rule, where an empty array/object counts as unset while
39
+ * `false` and `0` never do — so a fresh pull does not write noisy empty keys
40
+ * (and `sync diff` does not report a difference that is not there).
41
+ *
42
+ * A field WITH a producer skips that emptiness rule: the producer decides, and
43
+ * says "omit" by returning `undefined` or `null` (TOML has no null). This is
44
+ * what the workflow serializer has always done, and it is load-bearing — the
45
+ * empty JSON Schema `{}` is a real, distinct value ("accepts anything"), so a
46
+ * generic "an empty object is unset" would drop it on pull and the next push
47
+ * would clear it server-side.
48
+ */
49
+ export declare function projectRecordToToml(table: ConfigTable, record: any, values?: Record<string, PullValue>): Record<string, any>;
50
+ /**
51
+ * Build the create/update body's field half from a parsed TOML table.
52
+ *
53
+ * Only fields the definition says the server accepts in `mode` are included, so
54
+ * an immutable key (`ttlTier`) or a field the create handler assigns itself
55
+ * (`state`) is never sent — the definition is what records that, not a comment
56
+ * at the call site. A field with no producer is a scalar passthrough: the TOML
57
+ * value is forwarded as-is, and a truly-absent key is `undefined`, which
58
+ * `JSON.stringify` drops so the stored value stands.
59
+ */
60
+ export declare function buildPayloadFromToml(table: ConfigTable, tomlTable: any, { mode, values }: {
61
+ mode: PushMode;
62
+ values?: Record<string, PushValue>;
63
+ }): Record<string, any>;
64
+ /**
65
+ * Build the create/update body from an entity ALREADY in wire shape.
66
+ *
67
+ * The structured objects parse their TOML into an entity first — resolving a
68
+ * `ruleSetName` to the id the server wants, defaulting `autoAddCreator`,
69
+ * re-serializing the `[models.*]` blocks into the stored `schema` string — and
70
+ * only then build the body. `buildPayloadFromToml` reads TOML keys; this reads
71
+ * wire field names, so the same definition drives both without either of them
72
+ * restating the field list.
73
+ */
74
+ export declare function projectEntityToPayload(table: ConfigTable, entity: any, { mode, values }: {
75
+ mode: PushMode;
76
+ values?: Record<string, PushValue>;
77
+ }): Record<string, any>;
78
+ /**
79
+ * A TOML-owned field: send value-or-`null` so removing the line from the file
80
+ * clears it server-side (#1567). Shared because six objects need exactly this
81
+ * for `description`, and stating it once is the point of the epic.
82
+ */
83
+ export declare const tomlOwned: PushValue;
84
+ /** The field names `mode` accepts — re-exported so callers need one import. */
85
+ export { writableFieldNames };
@@ -0,0 +1,105 @@
1
+ /**
2
+ * Definition-driven TOML ↔ payload projection (issue #2644).
3
+ *
4
+ * Every configuration object used to restate its field surface twice inside the
5
+ * CLI — once in a pull serializer and once in a push payload literal — so a
6
+ * field added to one and not the other simply disappeared, and a pull → push
7
+ * cycle cleared it server-side. These two functions replace both halves: the
8
+ * FIELD LIST comes from the vendored definition, and only the handful of fields
9
+ * whose shape or presence semantics are genuinely their own carry a producer.
10
+ *
11
+ * `projectRecordToToml` is the pull half, `buildPayloadFromToml` the push half.
12
+ * They read the same `ConfigTable`, so they cannot disagree about which fields
13
+ * exist — which is the whole point.
14
+ */
15
+ import { isEmptyForEmit, writableFieldNames, } from "./generated-config-surfaces.js";
16
+ /**
17
+ * Project a server record onto its TOML table, using the definition's field
18
+ * list and `emit` semantics.
19
+ *
20
+ * `emit: "always"` writes the value as-is (an `undefined` is dropped by the
21
+ * TOML serializer). `emit: "whenSet"` omits an unset value — `isEmptyForEmit`
22
+ * is #1033's shared rule, where an empty array/object counts as unset while
23
+ * `false` and `0` never do — so a fresh pull does not write noisy empty keys
24
+ * (and `sync diff` does not report a difference that is not there).
25
+ *
26
+ * A field WITH a producer skips that emptiness rule: the producer decides, and
27
+ * says "omit" by returning `undefined` or `null` (TOML has no null). This is
28
+ * what the workflow serializer has always done, and it is load-bearing — the
29
+ * empty JSON Schema `{}` is a real, distinct value ("accepts anything"), so a
30
+ * generic "an empty object is unset" would drop it on pull and the next push
31
+ * would clear it server-side.
32
+ */
33
+ export function projectRecordToToml(table, record, values = {}) {
34
+ const out = {};
35
+ for (const field of table.fields) {
36
+ const produce = values[field.field];
37
+ const value = produce ? produce(record, field) : record?.[field.field];
38
+ if (produce) {
39
+ if (value === undefined || value === null)
40
+ continue;
41
+ }
42
+ else if (field.emit === "whenSet" && isEmptyForEmit(value, field.type)) {
43
+ continue;
44
+ }
45
+ if (value === undefined)
46
+ continue;
47
+ out[field.tomlKey] = value;
48
+ }
49
+ return out;
50
+ }
51
+ /**
52
+ * Build the create/update body's field half from a parsed TOML table.
53
+ *
54
+ * Only fields the definition says the server accepts in `mode` are included, so
55
+ * an immutable key (`ttlTier`) or a field the create handler assigns itself
56
+ * (`state`) is never sent — the definition is what records that, not a comment
57
+ * at the call site. A field with no producer is a scalar passthrough: the TOML
58
+ * value is forwarded as-is, and a truly-absent key is `undefined`, which
59
+ * `JSON.stringify` drops so the stored value stands.
60
+ */
61
+ export function buildPayloadFromToml(table, tomlTable, { mode, values = {} }) {
62
+ const source = tomlTable && typeof tomlTable === "object" ? tomlTable : {};
63
+ const payload = {};
64
+ for (const field of table.fields) {
65
+ if (!field.writableOn.includes(mode))
66
+ continue;
67
+ const produce = values[field.field];
68
+ payload[field.field] = produce
69
+ ? produce(source[field.tomlKey], mode, source)
70
+ : source[field.tomlKey];
71
+ }
72
+ return payload;
73
+ }
74
+ /**
75
+ * Build the create/update body from an entity ALREADY in wire shape.
76
+ *
77
+ * The structured objects parse their TOML into an entity first — resolving a
78
+ * `ruleSetName` to the id the server wants, defaulting `autoAddCreator`,
79
+ * re-serializing the `[models.*]` blocks into the stored `schema` string — and
80
+ * only then build the body. `buildPayloadFromToml` reads TOML keys; this reads
81
+ * wire field names, so the same definition drives both without either of them
82
+ * restating the field list.
83
+ */
84
+ export function projectEntityToPayload(table, entity, { mode, values = {} }) {
85
+ const source = entity && typeof entity === "object" ? entity : {};
86
+ const payload = {};
87
+ for (const field of table.fields) {
88
+ if (!field.writableOn.includes(mode))
89
+ continue;
90
+ const produce = values[field.field];
91
+ payload[field.field] = produce
92
+ ? produce(source[field.field], mode, source)
93
+ : source[field.field];
94
+ }
95
+ return payload;
96
+ }
97
+ /**
98
+ * A TOML-owned field: send value-or-`null` so removing the line from the file
99
+ * clears it server-side (#1567). Shared because six objects need exactly this
100
+ * for `description`, and stating it once is the point of the epic.
101
+ */
102
+ export const tomlOwned = (value) => value ?? null;
103
+ /** The field names `mode` accepts — re-exported so callers need one import. */
104
+ export { writableFieldNames };
105
+ //# sourceMappingURL=config-payload.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-payload.js","sourceRoot":"","sources":["../../../src/lib/config-payload.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EACL,cAAc,EACd,kBAAkB,GAGnB,MAAM,gCAAgC,CAAC;AAqBxC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM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644).
3
+ *
4
+ * Everything here reads the committed, build-time-vendored artifact
5
+ * `generated-config-surfaces.ts` — the CLI never imports server `src/` at
6
+ * runtime. This module is the small amount of CLI-side wiring on top: table
7
+ * lookup that fails loudly, and the two unrecognized-key behaviors the design
8
+ * gate settled (2026-08-12):
9
+ *
10
+ * - `sync push` REJECTS any TOML key a definition does not recognize, so a
11
+ * mistyped key fails locally instead of being silently dropped.
12
+ * - `sync pull` WARNS about any server key this CLI version does not know and
13
+ * does NOT write it to the file. Writing it through would set a trap: the
14
+ * next push would reject the key it had just written. A version-gap round
15
+ * trip is therefore loud-and-lossy — push omits what it does not know, so
16
+ * the server keeps its stored values — never silently destructive.
17
+ */
18
+ import { type ConfigObjectSurface, type ConfigTable } from "./generated-config-surfaces.js";
19
+ /** A surface by label. Throws rather than silently skipping checks. */
20
+ export declare function requireConfigSurface(label: string): ConfigObjectSurface;
21
+ /** A table by label and TOML path. Throws rather than silently skipping checks. */
22
+ export declare function requireConfigTable(label: string, tomlPath: readonly string[]): ConfigTable;
23
+ /** The `[workflow]` table — the first migrated object (#2644 phase 1). */
24
+ export declare const WORKFLOW_TABLE: ConfigTable;
25
+ export declare const PROMPT_TABLE: ConfigTable;
26
+ export declare const PROMPT_CONFIG_TABLE: ConfigTable;
27
+ export declare const INTEGRATION_TABLE: ConfigTable;
28
+ export declare const WEBHOOK_TABLE: ConfigTable;
29
+ export declare const CRON_TRIGGER_TABLE: ConfigTable;
30
+ export declare const BLOB_BUCKET_TABLE: ConfigTable;
31
+ export declare const EMAIL_TEMPLATE_TABLE: ConfigTable;
32
+ export declare const DATABASE_TYPE_TABLE: ConfigTable;
33
+ export declare const RULE_SET_TABLE: ConfigTable;
34
+ export declare const GROUP_TYPE_CONFIG_TABLE: ConfigTable;
35
+ export declare const COLLECTION_TYPE_CONFIG_TABLE: ConfigTable;
36
+ export declare const METADATA_CATEGORY_CONFIG_TABLE: ConfigTable;
37
+ /**
38
+ * The `[test]` table of a `<key>.tests/*.toml` sidecar (#2644 phase 3).
39
+ *
40
+ * Test cases are a registered surface but NOT a `SYNC_RESOURCE_TYPES`
41
+ * directory, so the preflight that crosses the registry with that table never
42
+ * reaches them. Resolved here so the sidecar files get the same
43
+ * unrecognized-key posture as every per-entity file: push rejects a key the
44
+ * definition does not know, pull names a server key this CLI cannot manage.
45
+ */
46
+ export declare const TEST_CASE_TABLE: ConfigTable;
47
+ /** The `test-case` surface itself, for the sidecars' document-shape check. */
48
+ export declare const TEST_CASE_SURFACE: ConfigObjectSurface;
49
+ /**
50
+ * TOML keys in `table` that the definition does not recognize.
51
+ *
52
+ * `sync push` turns these into a hard error naming each key, for every migrated
53
+ * type — today's workflow posture (`validateWorkflowToml`'s misnest detector),
54
+ * generalized to whole tables and every configuration object.
55
+ */
56
+ export declare function findUnknownTomlKeys(tomlTable: unknown, table: ConfigTable): string[];
57
+ /**
58
+ * Server-response keys this CLI version does not recognize — a newer server
59
+ * returning a field the vendored definition has never heard of.
60
+ */
61
+ export declare function findUnknownServerKeys(payload: unknown, table: ConfigTable): string[];
62
+ /**
63
+ * The `sync pull` warning for keys this CLI version cannot manage. Names the
64
+ * file and every key, and says what to do — nothing is dropped without a
65
+ * message (#2644 criterion 6).
66
+ */
67
+ export declare function unrecognizedPullKeysMessage(file: string, tomlPath: readonly string[], keys: readonly string[]): string;
68
+ /**
69
+ * Name the server keys this CLI version does not recognize, without writing
70
+ * them (#2644 criterion 6). No logger means no warning — the caller decides
71
+ * where the message goes.
72
+ */
73
+ export declare function warnUnrecognizedServerKeys(record: unknown, table: ConfigTable, file: string, logger?: (message: string) => void): void;
74
+ /**
75
+ * Top-level TOML keys in `tomlData` the object's definition does not declare —
76
+ * a typo'd table header (`[integraton]`), a table from a newer CLI, or a stray
77
+ * section. Rejected by `sync push` for the same reason an unrecognized key
78
+ * inside a table is: silently ignoring it made the file push as though the
79
+ * table it meant to write were empty, which CLEARED the TOML-owned fields
80
+ * server-side.
81
+ */
82
+ export declare function findUnknownDocumentKeys(tomlData: unknown, surface: ConfigObjectSurface): string[];
83
+ /** Field tables present in the wrong shape — `[configs]` for `[[configs]]`. */
84
+ export declare function findMisshapenTables(tomlData: unknown, surface: ConfigObjectSurface): Array<{
85
+ key: string;
86
+ expected: "table" | "array of tables";
87
+ }>;
88
+ /** The `sync push` error for unrecognized top-level TOML tables. */
89
+ export declare function unrecognizedPushTablesMessage(file: string, keys: readonly string[]): string;
90
+ /** The `sync push` error for a field table written with the wrong array markers. */
91
+ export declare function misshapenTableMessage(file: string, key: string, expected: "table" | "array of tables"): string;
92
+ /** The `sync push` error for unrecognized TOML keys. */
93
+ export declare function unrecognizedPushKeysMessage(file: string, tomlPath: readonly string[], keys: readonly string[]): string;
@@ -0,0 +1,178 @@
1
+ /**
2
+ * The CLI's view of the configuration-object definitions (issue #2644).
3
+ *
4
+ * Everything here reads the committed, build-time-vendored artifact
5
+ * `generated-config-surfaces.ts` — the CLI never imports server `src/` at
6
+ * runtime. This module is the small amount of CLI-side wiring on top: table
7
+ * lookup that fails loudly, and the two unrecognized-key behaviors the design
8
+ * gate settled (2026-08-12):
9
+ *
10
+ * - `sync push` REJECTS any TOML key a definition does not recognize, so a
11
+ * mistyped key fails locally instead of being silently dropped.
12
+ * - `sync pull` WARNS about any server key this CLI version does not know and
13
+ * does NOT write it to the file. Writing it through would set a trap: the
14
+ * next push would reject the key it had just written. A version-gap round
15
+ * trip is therefore loud-and-lossy — push omits what it does not know, so
16
+ * the server keeps its stored values — never silently destructive.
17
+ */
18
+ import { GENERATED_CONFIG_MODEL_FIELDS, acceptedTomlKeys, findMisshapenTomlTables, findUnknownTomlDocumentKeys, getConfigSurface, getConfigTable, recognizedResponseKeys, } from "./generated-config-surfaces.js";
19
+ /** A surface by label. Throws rather than silently skipping checks. */
20
+ export function requireConfigSurface(label) {
21
+ const surface = getConfigSurface(label);
22
+ if (!surface) {
23
+ throw new Error(`config-surface: no definition for "${label}". ` +
24
+ "Run `node cli/scripts/gen-config-surfaces.mjs`.");
25
+ }
26
+ return surface;
27
+ }
28
+ /** A table by label and TOML path. Throws rather than silently skipping checks. */
29
+ export function requireConfigTable(label, tomlPath) {
30
+ const table = getConfigTable(label, tomlPath);
31
+ if (!table) {
32
+ throw new Error(`config-surface: no definition for "${label}" [${tomlPath.join(".")}]. ` +
33
+ "Run `node cli/scripts/gen-config-surfaces.mjs`.");
34
+ }
35
+ return table;
36
+ }
37
+ /** The `[workflow]` table — the first migrated object (#2644 phase 1). */
38
+ export const WORKFLOW_TABLE = requireConfigTable("workflow", ["workflow"]);
39
+ // The six flat per-entity objects (#2644 phase 2). Resolved once, at module
40
+ // load, so a missing or misspelled definition fails immediately and loudly
41
+ // rather than at the moment someone runs a pull.
42
+ export const PROMPT_TABLE = requireConfigTable("prompt", ["prompt"]);
43
+ export const PROMPT_CONFIG_TABLE = requireConfigTable("prompt", ["configs"]);
44
+ export const INTEGRATION_TABLE = requireConfigTable("integration", [
45
+ "integration",
46
+ ]);
47
+ export const WEBHOOK_TABLE = requireConfigTable("webhook", ["webhook"]);
48
+ export const CRON_TRIGGER_TABLE = requireConfigTable("cron-trigger", [
49
+ "cronTrigger",
50
+ ]);
51
+ export const BLOB_BUCKET_TABLE = requireConfigTable("blob-bucket", ["bucket"]);
52
+ export const EMAIL_TEMPLATE_TABLE = requireConfigTable("email-template", [
53
+ "template",
54
+ ]);
55
+ // The five structured objects (#2644 phase 3). Their authored sub-trees —
56
+ // `[rules]`, `[models.*]`, `[triggers]`, the `[metadata]` manifest — keep the
57
+ // validators that already own them; these tables are the scalar surface.
58
+ export const DATABASE_TYPE_TABLE = requireConfigTable("database-type", ["type"]);
59
+ export const RULE_SET_TABLE = requireConfigTable("rule-set", ["ruleSet"]);
60
+ export const GROUP_TYPE_CONFIG_TABLE = requireConfigTable("group-type-config", [
61
+ "groupTypeConfig",
62
+ ]);
63
+ export const COLLECTION_TYPE_CONFIG_TABLE = requireConfigTable("collection-type-config", ["collectionTypeConfig"]);
64
+ export const METADATA_CATEGORY_CONFIG_TABLE = requireConfigTable("metadata-category-config", ["metadataCategoryConfig"]);
65
+ /**
66
+ * The `[test]` table of a `<key>.tests/*.toml` sidecar (#2644 phase 3).
67
+ *
68
+ * Test cases are a registered surface but NOT a `SYNC_RESOURCE_TYPES`
69
+ * directory, so the preflight that crosses the registry with that table never
70
+ * reaches them. Resolved here so the sidecar files get the same
71
+ * unrecognized-key posture as every per-entity file: push rejects a key the
72
+ * definition does not know, pull names a server key this CLI cannot manage.
73
+ */
74
+ export const TEST_CASE_TABLE = requireConfigTable("test-case", ["test"]);
75
+ /** The `test-case` surface itself, for the sidecars' document-shape check. */
76
+ export const TEST_CASE_SURFACE = requireConfigSurface("test-case");
77
+ /**
78
+ * TOML keys in `table` that the definition does not recognize.
79
+ *
80
+ * `sync push` turns these into a hard error naming each key, for every migrated
81
+ * type — today's workflow posture (`validateWorkflowToml`'s misnest detector),
82
+ * generalized to whole tables and every configuration object.
83
+ */
84
+ export function findUnknownTomlKeys(tomlTable, table) {
85
+ if (!tomlTable || typeof tomlTable !== "object" || Array.isArray(tomlTable)) {
86
+ return [];
87
+ }
88
+ const known = acceptedTomlKeys(table);
89
+ return Object.keys(tomlTable)
90
+ .filter((key) => !known.has(key))
91
+ .sort();
92
+ }
93
+ /**
94
+ * Server-response keys this CLI version does not recognize — a newer server
95
+ * returning a field the vendored definition has never heard of.
96
+ */
97
+ export function findUnknownServerKeys(payload, table) {
98
+ if (!payload || typeof payload !== "object" || Array.isArray(payload)) {
99
+ return [];
100
+ }
101
+ const modelFields = GENERATED_CONFIG_MODEL_FIELDS[table.model];
102
+ if (!modelFields) {
103
+ // Degrading to an empty anchor would turn every model field the server
104
+ // returns into a false "this CLI does not recognize it" warning on every
105
+ // pull. Fail the way `requireConfigTable` does instead.
106
+ throw new Error(`config-surface: no models.yaml field list for "${table.model}". ` +
107
+ "Run `node cli/scripts/gen-config-surfaces.mjs`.");
108
+ }
109
+ const known = recognizedResponseKeys(table, modelFields);
110
+ return Object.keys(payload)
111
+ .filter((key) => !known.has(key))
112
+ .sort();
113
+ }
114
+ /**
115
+ * The `sync pull` warning for keys this CLI version cannot manage. Names the
116
+ * file and every key, and says what to do — nothing is dropped without a
117
+ * message (#2644 criterion 6).
118
+ */
119
+ export function unrecognizedPullKeysMessage(file, tomlPath, keys) {
120
+ const prefix = tomlPath.join(".");
121
+ const named = keys.map((k) => `${prefix}.${k}`).join(", ");
122
+ return (`sync pull: ${file}: ${keys.length} key${keys.length === 1 ? "" : "s"} ` +
123
+ `this CLI version does not recognize: ${named}. ` +
124
+ "They were not written to the file — upgrade the CLI " +
125
+ "(npm i -g primitive-admin@latest) to manage them.");
126
+ }
127
+ /**
128
+ * Name the server keys this CLI version does not recognize, without writing
129
+ * them (#2644 criterion 6). No logger means no warning — the caller decides
130
+ * where the message goes.
131
+ */
132
+ export function warnUnrecognizedServerKeys(record, table, file, logger) {
133
+ if (!logger)
134
+ return;
135
+ const unknown = findUnknownServerKeys(record, table);
136
+ if (unknown.length === 0)
137
+ return;
138
+ logger(unrecognizedPullKeysMessage(file, table.tomlPath, unknown));
139
+ }
140
+ /**
141
+ * Top-level TOML keys in `tomlData` the object's definition does not declare —
142
+ * a typo'd table header (`[integraton]`), a table from a newer CLI, or a stray
143
+ * section. Rejected by `sync push` for the same reason an unrecognized key
144
+ * inside a table is: silently ignoring it made the file push as though the
145
+ * table it meant to write were empty, which CLEARED the TOML-owned fields
146
+ * server-side.
147
+ */
148
+ export function findUnknownDocumentKeys(tomlData, surface) {
149
+ return findUnknownTomlDocumentKeys(surface, tomlData);
150
+ }
151
+ /** Field tables present in the wrong shape — `[configs]` for `[[configs]]`. */
152
+ export function findMisshapenTables(tomlData, surface) {
153
+ return findMisshapenTomlTables(surface, tomlData);
154
+ }
155
+ /** The `sync push` error for unrecognized top-level TOML tables. */
156
+ export function unrecognizedPushTablesMessage(file, keys) {
157
+ const named = keys.map((k) => `[${k}]`).join(", ");
158
+ return (`${file}: unrecognized top-level table${keys.length === 1 ? "" : "s"}: ` +
159
+ `${named}. Check the spelling against the tables this file type accepts, ` +
160
+ "or upgrade the CLI if the server is newer than this one.");
161
+ }
162
+ /** The `sync push` error for a field table written with the wrong array markers. */
163
+ export function misshapenTableMessage(file, key, expected) {
164
+ return expected === "array of tables"
165
+ ? `${file}: \`${key}\` must be an array of tables — write \`[[${key}]]\`, ` +
166
+ "one header per entry."
167
+ : `${file}: \`${key}\` must be a table — write \`[${key}]\`, not an ` +
168
+ "array of tables.";
169
+ }
170
+ /** The `sync push` error for unrecognized TOML keys. */
171
+ export function unrecognizedPushKeysMessage(file, tomlPath, keys) {
172
+ const prefix = tomlPath.join(".");
173
+ const named = keys.map((k) => `${prefix}.${k}`).join(", ");
174
+ return (`${file}: unrecognized key${keys.length === 1 ? "" : "s"} in ` +
175
+ `[${prefix}]: ${named}. Remove ${keys.length === 1 ? "it" : "them"} or ` +
176
+ "upgrade the CLI if the server is newer than this one.");
177
+ }
178
+ //# sourceMappingURL=config-surface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-surface.js","sourceRoot":"","sources":["../../../src/lib/config-surface.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EACL,6BAA6B,EAC7B,gBAAgB,EAChB,uBAAuB,EACvB,2BAA2B,EAC3B,gBAAgB,EAChB,cAAc,EACd,sBAAsB,GAGvB,MAAM,gCAAgC,CAAC;AAExC,uEAAuE;AACvE,MAAM,UAAU,oBAAoB,CAAC,KAAa;IAChD,MAAM,OAAO,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;IACxC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CACb,sCAAsC,KAAK,KAAK;YAC9C,iDAAiD,CACpD,CAAC;IACJ,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,mFAAmF;AACnF,MAAM,UAAU,kBAAkB,CAChC,KAAa,EACb,QAA2B;IAE3B,MAAM,KAAK,GAAG,cAAc,CAAC,KAAK,EAA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,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,MAAM,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3D,OAAO,CACL,GAAG,IAAI,qBAAqB,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,MAAM;QAC9D,IAAI,MAAM,MAAM,KAAK,YAAY,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,MAAM;QACxE,uDAAuD,CACxD,CAAC;AACJ,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Parse a TOML source string with a TOML 1.0-compliant parser.
3
+ * Accepts heterogeneous inline arrays that the old `@iarna` rejected.
4
+ */
5
+ export declare function parseConfigToml(content: string): Record<string, any>;
6
+ /**
7
+ * Serialize a config object to TOML with a TOML 1.0-compliant serializer.
8
+ * Emits heterogeneous arrays natively instead of falling back to a JSON string.
9
+ */
10
+ export declare function stringifyConfigToml(data: any): string;
@@ -0,0 +1,42 @@
1
+ /**
2
+ * The CLI's single TOML wrapper. Every TOML parse/stringify in the CLI routes
3
+ * through here — config files (database-type configs, workflows, collection-type
4
+ * configs, v2 block configs) and non-config files alike (app.toml, prompts,
5
+ * integrations, cron triggers, webhooks, rule-sets, codegen, ...).
6
+ *
7
+ * Config files can carry **heterogeneous arrays**: a settings-gated pipeline
8
+ * produces a CEL step-reference string next to a filter object, e.g.
9
+ * `"$and" = ["$steps.settings.first.peerVisible", { status = "approved" }]`.
10
+ * TOML 1.0.0 permits heterogeneous arrays; the previous library `@iarna`
11
+ * targeted TOML 0.5 and threw on them in **both** directions (`stringify` and
12
+ * `parse`). `smol-toml` is TOML 1.0-compliant and round-trips them, so #1450
13
+ * swapped the config paths and #1464 finished the migration — moving every
14
+ * remaining site here and removing `@iarna` entirely. Keeping one library
15
+ * means one set of parser semantics to reason about.
16
+ *
17
+ * Behavioral notes for the smol-toml swap (measured against `@iarna@2.2.5`):
18
+ * every divergence is a loud error, never silent value drift. smol throws on
19
+ * integers beyond 2^53 (`@iarna` returned a BigInt that then broke
20
+ * `JSON.stringify` on push), rejects control characters in comments (TOML 1.0
21
+ * ban), and throws on stringifying an array containing `null` (`@iarna`
22
+ * silently dropped it). `null`/`undefined` data-loss guards live in
23
+ * `canEmitNative` (`toml-database-config.ts`), not here. `smol` re-emits with
24
+ * slightly different formatting (`[]` not `[ ]`, no array-of-tables indent) —
25
+ * a one-time reformat on the next `pull`.
26
+ */
27
+ import * as smolToml from "smol-toml";
28
+ /**
29
+ * Parse a TOML source string with a TOML 1.0-compliant parser.
30
+ * Accepts heterogeneous inline arrays that the old `@iarna` rejected.
31
+ */
32
+ export function parseConfigToml(content) {
33
+ return smolToml.parse(content);
34
+ }
35
+ /**
36
+ * Serialize a config object to TOML with a TOML 1.0-compliant serializer.
37
+ * Emits heterogeneous arrays natively instead of falling back to a JSON string.
38
+ */
39
+ export function stringifyConfigToml(data) {
40
+ return smolToml.stringify(data);
41
+ }
42
+ //# sourceMappingURL=config-toml.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-toml.js","sourceRoot":"","sources":["../../../src/lib/config-toml.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,KAAK,QAAQ,MAAM,WAAW,CAAC;AAEtC;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,OAAe;IAC7C,OAAO,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAwB,CAAC;AACxD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAS;IAC3C,OAAO,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;AAClC,CAAC"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Thin compatibility shim over the new project-scoped config system.
3
+ *
4
+ * Historically the CLI had one global credentials file at
5
+ * ~/.primitive/credentials.json and a handful of helpers here. After the
6
+ * project-config overhaul (issue #373) credentials live per-environment
7
+ * inside `<projectRoot>/.primitive/credentials.json` when a
8
+ * .primitive/config.json is in scope, and fall back to the legacy global
9
+ * file otherwise.
10
+ *
11
+ * The rest of the CLI continues to import from this module, so we keep
12
+ * the original public API (loadCredentials, saveCredentials, etc.) and
13
+ * just delegate to the new stores.
14
+ */
15
+ import type { Credentials } from "../types/index.js";
16
+ export declare function loadCredentials(): Credentials | null;
17
+ export declare function saveCredentials(credentials: Credentials): void;
18
+ export declare function clearCredentials(): void;
19
+ export declare function isTokenExpired(credentials: Credentials): boolean;
20
+ export declare function isTokenExpiringSoon(credentials: Credentials): boolean;
21
+ export declare function setCurrentApp(appId: string, appName?: string): void;
22
+ export declare function clearCurrentApp(): void;
23
+ export declare function getCurrentAppId(): string | undefined;
24
+ export declare function resolveAppId(appId: string | undefined, options: {
25
+ app?: string;
26
+ }): string;
27
+ /**
28
+ * Returns the API base URL for the active environment (project mode) or
29
+ * the serverUrl saved in the legacy credentials file.
30
+ */
31
+ export declare function getServerUrl(): string;
32
+ /**
33
+ * Resolves the API base URL to authenticate against, used by `primitive login`
34
+ * (issue #1343).
35
+ *
36
+ * Unlike getServerUrl(), this must work *before* any credentials exist (first
37
+ * login), so it never falls back to the stored credentials' serverUrl:
38
+ *
39
+ * - Project mode → the active environment's `apiUrl` (canonical). Lets
40
+ * getCurrentEnvironment() throw on an unresolvable env (ambiguous/unknown
41
+ * --env) so the caller can fail loudly instead of silently targeting prod.
42
+ * - Legacy mode (no .primitive/config.json) → DEFAULT_SERVER_URL, which
43
+ * honors the PRIMITIVE_SERVER_URL escape hatch (constants.ts).
44
+ *
45
+ * The trailing slash is stripped so callers can build `${url}/admin/api/...`.
46
+ */
47
+ export declare function getConfiguredServerUrl(): string;
48
+ /**
49
+ * Exposed so commands can check whether there's a pre-project-config
50
+ * credentials file at ~/.primitive/credentials.json (used by migration
51
+ * prompts).
52
+ */
53
+ export declare function legacyCredentialsExist(): boolean;