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,1814 @@
1
+ import { type ListEnvelope } from "./paginate.js";
2
+ /**
3
+ * Metadata for a single bucket blob, as returned by the metadata endpoint
4
+ * `GET blob-buckets/:bucketId/blobs/:blobId/metadata`. Mirrors the published
5
+ * JS client's `BlobInfo` shape.
6
+ */
7
+ export interface BlobInfo {
8
+ blobId: string;
9
+ bucketId: string;
10
+ filename: string | null;
11
+ contentType: string | null;
12
+ numBytes: number;
13
+ sha256: string | null;
14
+ tags: string[];
15
+ createdBy: string | null;
16
+ uploaded?: string | null;
17
+ etag?: string | null;
18
+ }
19
+ export declare class ApiError extends Error {
20
+ statusCode: number;
21
+ code?: string;
22
+ /**
23
+ * Structured `details` payload from `corsErrorResponse`.
24
+ *
25
+ * The server's error envelope can emit `details` as either:
26
+ * - an array of validation issues (e.g. `[{ path, message }, ...]`) —
27
+ * this is what most legacy endpoints produce, and what sync.ts walks
28
+ * via `Array.isArray(err.details)` / `for (const detail of ...)`.
29
+ * - a record of structured offender fields (e.g. `{ refs, operations,
30
+ * opCount, line, column, ... }`) — emitted by the issue #666 schema
31
+ * gate and consumed by the typed exception subclasses below.
32
+ *
33
+ * Callers must narrow before use: `Array.isArray(err.details)` for the
34
+ * legacy shape, otherwise treat as `Record<string, any>`.
35
+ */
36
+ details?: unknown[] | Record<string, any>;
37
+ constructor(message: string, statusCode: number, code?: string, details?: unknown[] | Record<string, any>);
38
+ }
39
+ export declare class ConflictError extends ApiError {
40
+ serverModifiedAt: string;
41
+ expectedModifiedAt: string;
42
+ constructor(message: string, serverModifiedAt: string, expectedModifiedAt: string, details?: Record<string, any>);
43
+ }
44
+ /**
45
+ * Parsed shape of a non-OK HTTP response body.
46
+ *
47
+ * The server's standard error envelope (corsErrorResponse, `src/utils.ts:348`)
48
+ * writes the message to `error`. A handful of bespoke endpoints (ConflictError,
49
+ * integrations proxy) use `message`. This helper reads both fields so all CLI
50
+ * call sites surface the real server message instead of `HTTP <status>`.
51
+ *
52
+ * `htmlNotFound` is set when the body looks like an HTML 404 page (typically
53
+ * served when an API path is wrong); callers can use it to throw a clearer
54
+ * "API endpoint not found" message regardless of the original status code.
55
+ *
56
+ * `details` can be either an array (legacy validation-issue list) or a
57
+ * structured record (issue #666 schema gate); the schema-feature errors
58
+ * below need the record shape, while the legacy `for (const detail of ...)`
59
+ * walkers in sync.ts assume the array shape.
60
+ */
61
+ export interface ParsedErrorResponse {
62
+ message: string;
63
+ code?: string;
64
+ details?: unknown[] | Record<string, any>;
65
+ /** True when the response body is an HTML error page (e.g. wrong API path). */
66
+ htmlNotFound?: boolean;
67
+ /** Raw parsed JSON envelope (or `undefined` for non-JSON bodies). */
68
+ raw?: any;
69
+ }
70
+ /**
71
+ * Extract a human-readable error message + structured fields from a non-OK
72
+ * HTTP response body. Single source of truth used by every error-handler call
73
+ * site in this file (see issue #684).
74
+ */
75
+ export declare function parseErrorResponse(response: {
76
+ status: number;
77
+ }, text: string, path?: string): ParsedErrorResponse;
78
+ /**
79
+ * Typed exception classes for the database-schema feature (issue #666).
80
+ * Each maps 1:1 to a server `code` value emitted from the op-edit or
81
+ * schema-edit gate. They all extend ApiError so existing catch-all paths
82
+ * continue to work; specialized catch blocks can branch on `instanceof`.
83
+ *
84
+ * Per round-2 addendum A1, `details` is always preserved so callers can
85
+ * extract structured offender lists (refs[], operations[], etc.).
86
+ */
87
+ export declare class SchemaRequiredError extends ApiError {
88
+ constructor(message: string, details?: Record<string, any>);
89
+ }
90
+ export declare class OperationRefError extends ApiError {
91
+ constructor(message: string, details?: Record<string, any>);
92
+ get refs(): Array<{
93
+ ref: string;
94
+ location: string;
95
+ }>;
96
+ }
97
+ export declare class SchemaBreaksOpsError extends ApiError {
98
+ constructor(message: string, details?: Record<string, any>);
99
+ get operations(): Array<{
100
+ operation: string;
101
+ refs: Array<{
102
+ ref: string;
103
+ location: string;
104
+ }>;
105
+ }>;
106
+ }
107
+ export declare class SchemaHasUncheckableOpsError extends ApiError {
108
+ constructor(message: string, details?: Record<string, any>);
109
+ get operations(): Array<{
110
+ operation: string;
111
+ locations: string[];
112
+ }>;
113
+ }
114
+ export declare class TomlParseError extends ApiError {
115
+ constructor(message: string, details?: Record<string, any>);
116
+ get line(): number | undefined;
117
+ get column(): number | undefined;
118
+ }
119
+ export declare class OpsExistError extends ApiError {
120
+ constructor(message: string, details?: Record<string, any>);
121
+ get opCount(): number;
122
+ }
123
+ interface EmailTemplateSummary {
124
+ emailType: string;
125
+ label: string;
126
+ description: string;
127
+ hasOverride: boolean;
128
+ modifiedAt: string | null;
129
+ }
130
+ interface EmailTemplateDetail {
131
+ emailType: string;
132
+ label: string;
133
+ description: string;
134
+ hasOverride: boolean;
135
+ override: {
136
+ templateId: string;
137
+ subject: string;
138
+ htmlBody: string;
139
+ textBody: string;
140
+ createdAt: string;
141
+ modifiedAt: string;
142
+ } | null;
143
+ default: {
144
+ subject: string;
145
+ htmlBody: string;
146
+ textBody: string;
147
+ };
148
+ variables: {
149
+ name: string;
150
+ required: boolean;
151
+ description: string;
152
+ }[];
153
+ }
154
+ interface EmailTemplateUpsertResult {
155
+ emailType: string;
156
+ templateId: string;
157
+ subject: string;
158
+ htmlBody: string;
159
+ textBody: string;
160
+ createdAt: string;
161
+ modifiedAt: string;
162
+ warnings: string[];
163
+ }
164
+ interface AnalyticsTiming {
165
+ total_ms: number;
166
+ wae_queries: number[];
167
+ }
168
+ interface AnalyticsMetricResponse {
169
+ value: number;
170
+ previous: number;
171
+ deltaPct: number;
172
+ _timing: AnalyticsTiming;
173
+ }
174
+ interface AnalyticsGrowthResponse {
175
+ window_days: number;
176
+ retained_users: number;
177
+ new_users: number;
178
+ reactivated_users: number;
179
+ churned_users: number;
180
+ current_active: number;
181
+ previous_active: number;
182
+ deltaPct: number;
183
+ _timing: AnalyticsTiming;
184
+ }
185
+ interface AnalyticsDailyActivePoint {
186
+ day_ts: number;
187
+ day_label: string;
188
+ active_users: number;
189
+ }
190
+ interface AnalyticsDailyActiveResponse {
191
+ window_days: number;
192
+ rows: AnalyticsDailyActivePoint[];
193
+ _timing: AnalyticsTiming;
194
+ }
195
+ interface AnalyticsCohortRow {
196
+ signup_week: number;
197
+ signup_week_label: string;
198
+ cohort_size: number;
199
+ retention: (number | null)[];
200
+ }
201
+ interface AnalyticsCohortResponse {
202
+ weeks: number[];
203
+ rows: AnalyticsCohortRow[];
204
+ averages: (number | null)[];
205
+ _timing: AnalyticsTiming;
206
+ }
207
+ interface AnalyticsUserSummary {
208
+ userUlid: string;
209
+ email: string | null;
210
+ name: string | null;
211
+ firstSeen: string;
212
+ lastSeen: string;
213
+ eventCount: number;
214
+ }
215
+ interface AnalyticsTopUsersResponse {
216
+ windowDays: number;
217
+ limit: number;
218
+ results: AnalyticsUserSummary[];
219
+ _timing: AnalyticsTiming;
220
+ }
221
+ interface AnalyticsUserSearchResponse {
222
+ query: string;
223
+ limit: number;
224
+ results: AnalyticsUserSummary[];
225
+ }
226
+ interface AnalyticsUserDetailResponse {
227
+ user: {
228
+ user_ulid: string;
229
+ email: string | null;
230
+ name: string | null;
231
+ };
232
+ stats: {
233
+ first_seen: string | null;
234
+ last_active: string | null;
235
+ total_events: number;
236
+ days_active: number;
237
+ };
238
+ events_by_action: Array<{
239
+ action: string;
240
+ event_count: number;
241
+ last_occurred: string;
242
+ }>;
243
+ events_by_feature: Array<{
244
+ feature: string;
245
+ event_count: number;
246
+ pct: number;
247
+ }>;
248
+ _timing: AnalyticsTiming;
249
+ }
250
+ interface AnalyticsUserSnapshotResponse {
251
+ snapshot: {
252
+ timestamp: string;
253
+ values: unknown;
254
+ } | null;
255
+ _timing: AnalyticsTiming;
256
+ }
257
+ interface AnalyticsEventRow {
258
+ timestamp: string;
259
+ user_ulid: string;
260
+ action: string;
261
+ feature: string;
262
+ route: string;
263
+ country: string;
264
+ }
265
+ interface AnalyticsEventsResponse {
266
+ page: number;
267
+ page_size: number;
268
+ total_rows: number;
269
+ rows: AnalyticsEventRow[];
270
+ _timing: AnalyticsTiming;
271
+ }
272
+ interface AnalyticsGroupedRow {
273
+ group_value: string;
274
+ raw_group_value: string;
275
+ events: number;
276
+ unique_users: number;
277
+ }
278
+ interface AnalyticsEventsGroupedResponse {
279
+ group_by: string;
280
+ rows: AnalyticsGroupedRow[];
281
+ _timing: AnalyticsTiming;
282
+ }
283
+ interface AnalyticsErrorGroupExemplar {
284
+ message: string;
285
+ action: string;
286
+ scope_key: string;
287
+ step_id: string | null;
288
+ run_id: string | null;
289
+ at: string;
290
+ }
291
+ interface AnalyticsErrorGroupRow {
292
+ fingerprint: string;
293
+ normalized_title: string;
294
+ source: string;
295
+ status_class: string;
296
+ total: number;
297
+ daily: Array<{
298
+ day: string;
299
+ count: number;
300
+ }>;
301
+ /** First/last occurrence in the window (ISO-8601). */
302
+ first_seen: string | null;
303
+ last_seen: string | null;
304
+ /** A raw sample of the failure, or null when no sampled row carried one
305
+ * (events written before the exemplar shipped, or a starved group). */
306
+ exemplar: AnalyticsErrorGroupExemplar | null;
307
+ }
308
+ interface AnalyticsErrorsGroupsResponse {
309
+ window_days: number;
310
+ rows: AnalyticsErrorGroupRow[];
311
+ _timing: AnalyticsTiming;
312
+ }
313
+ /**
314
+ * Body accepted by integration create and update (#2631).
315
+ *
316
+ * `accessRule` is the CEL expression gating who may invoke the integration
317
+ * through the proxy. The server REQUIRES it on create; on update, `null` or
318
+ * `""` clears it, and a cleared rule denies every non-admin call.
319
+ */
320
+ export interface IntegrationWritePayload {
321
+ integrationKey?: string;
322
+ displayName?: string;
323
+ description?: string | null;
324
+ requestConfig?: any;
325
+ timeoutMs?: number;
326
+ status?: string;
327
+ accessRule?: string | null;
328
+ }
329
+ /**
330
+ * Integration detail response. `accessRule` is only on the detail — the list
331
+ * summary does not carry it (#2631).
332
+ */
333
+ export interface IntegrationDetail {
334
+ integrationId: string;
335
+ integrationKey: string;
336
+ displayName?: string;
337
+ description?: string | null;
338
+ status?: string;
339
+ timeoutMs?: number;
340
+ requestConfig?: any;
341
+ accessRule?: string | null;
342
+ modifiedAt?: string;
343
+ [key: string]: any;
344
+ }
345
+ interface AnalyticsIntegrationMetric {
346
+ integrationKey: string;
347
+ invocations: number;
348
+ errorRate: number;
349
+ medianDurationMs: number;
350
+ p95DurationMs: number;
351
+ }
352
+ interface AnalyticsIntegrationMetricsResponse {
353
+ windowDays: number;
354
+ integrations: AnalyticsIntegrationMetric[];
355
+ _timing: AnalyticsTiming;
356
+ }
357
+ interface WorkflowAnalyticsSummary {
358
+ workflowKey: string;
359
+ runs: number;
360
+ successRate: number;
361
+ medianDurationMs: number;
362
+ p95: number;
363
+ totalTokens: number;
364
+ }
365
+ interface TopWorkflowsResponse {
366
+ windowDays: number;
367
+ limit: number;
368
+ workflows: WorkflowAnalyticsSummary[];
369
+ _timing: AnalyticsTiming;
370
+ }
371
+ interface PromptAnalyticsSummary {
372
+ promptKey: string;
373
+ executions: number;
374
+ medianDurationMs: number;
375
+ p95DurationMs: number;
376
+ totalTokens: number;
377
+ }
378
+ interface TopPromptsResponse {
379
+ windowDays: number;
380
+ limit: number;
381
+ prompts: PromptAnalyticsSummary[];
382
+ _timing: AnalyticsTiming;
383
+ }
384
+ /**
385
+ * One operation in a `records/batch` request. Mirrors the wire shape the
386
+ * DatabaseDO expects (`databases-controller.ts`): `{ op, modelName, id, data }`.
387
+ * `data` is required for `save`/`patch` and omitted for `delete`.
388
+ */
389
+ export interface DatabaseBatchOperation {
390
+ op: "save" | "patch" | "delete";
391
+ modelName: string;
392
+ id: string;
393
+ data?: any;
394
+ /**
395
+ * Strict create: the DatabaseDO fails the op with a 409 `ALREADY_EXISTS` when
396
+ * the id is already present, instead of `save`'s upsert merge. Checked inside
397
+ * the batch transaction, so under `atomic` it rolls the whole batch back.
398
+ */
399
+ ifNotExists?: boolean;
400
+ /**
401
+ * Per-op guard evaluated inside the batch transaction — a mismatch is a 409
402
+ * `CONDITION_NOT_MET`, and under `atomic` it rolls the whole batch back. This
403
+ * is what the documents surface calls a `precondition`.
404
+ */
405
+ condition?: Record<string, any>;
406
+ }
407
+ /**
408
+ * Normalize a `databases operations execute` result to the CLI's one list
409
+ * envelope — but only when the result is a Durable Object query page
410
+ * (issue #2440).
411
+ *
412
+ * A registered operation is a list only sometimes. Of the shapes the server's
413
+ * operation dispatch can return, exactly two carry a top-level `data` array: a
414
+ * bare `query` and a `pipeline` whose `returnField` names a query step. A
415
+ * `count` (`{ count }`), an `aggregate` (`{ result }`), a mutation
416
+ * (`{ results }`), an `applyToQuery` (`{ matched, affected, failed, … }`) and a
417
+ * `returnField: "all"` pipeline (`{ steps: { … } }`) do not, so blanket
418
+ * normalization would corrupt them. This helper therefore tests the shape
419
+ * first and passes everything else through byte-for-byte — including the
420
+ * nested steps of a `returnField: "all"` pipeline, which are operation-defined
421
+ * objects the CLI must not reach into.
422
+ *
423
+ * Deliberately narrow, not a general-purpose predicate: the contract is
424
+ * specifically "an operations-execute result may be a DO query page".
425
+ * `executeDatabaseOperation()` is the only caller.
426
+ *
427
+ * The conversion itself is delegated to `normalizeCliListEnvelope()` so cursor
428
+ * handling, `prevCursor` dropping and `hasMore` derivation have exactly one
429
+ * implementation. That helper throws on an unrecognized shape — correct when
430
+ * the payload is supposed to be a list, wrong here, where the payload is the
431
+ * caller's own result — which is why the shape test has to run first. `_timing`
432
+ * (`--timing`) is re-attached afterwards, since it rides alongside the envelope
433
+ * rather than inside it.
434
+ */
435
+ export declare function normalizeDatabaseOperationResult(raw: unknown): unknown;
436
+ export declare class ApiClient {
437
+ private credentials;
438
+ constructor();
439
+ private ensureAuthenticated;
440
+ private refreshToken;
441
+ request<T = any>(path: string, options?: RequestInit): Promise<T>;
442
+ get<T = any>(path: string, params?: Record<string, any>): Promise<T>;
443
+ post<T = any>(path: string, body?: any): Promise<T>;
444
+ put<T = any>(path: string, body?: any): Promise<T>;
445
+ patch<T = any>(path: string, body?: any): Promise<T>;
446
+ delete<T = any>(path: string): Promise<T>;
447
+ listApps(): Promise<{
448
+ apps: Array<{
449
+ id: string;
450
+ name: string;
451
+ role?: string;
452
+ }>;
453
+ }>;
454
+ createApp(data: {
455
+ name: string;
456
+ initialAdminEmail?: string;
457
+ }): Promise<any>;
458
+ getApp(appId: string): Promise<{
459
+ id: string;
460
+ name: string;
461
+ }>;
462
+ deleteApp(appId: string): Promise<void>;
463
+ getAppSettings(appId: string): Promise<any>;
464
+ updateAppSettings(appId: string, settings: any): Promise<any>;
465
+ addUserByEmail(appId: string, data: {
466
+ email: string;
467
+ role?: string;
468
+ }): Promise<any>;
469
+ mintTestJwt(appId: string, userId: string, role?: string): Promise<any>;
470
+ rebuildUserSearchText(appId: string): Promise<{
471
+ count: number;
472
+ }>;
473
+ listUsers(appId: string, params?: {
474
+ name?: string;
475
+ email?: string;
476
+ userId?: string;
477
+ limit?: number;
478
+ cursor?: string;
479
+ }): Promise<{
480
+ items: any[];
481
+ nextCursor?: string | null;
482
+ }>;
483
+ removeUser(appId: string, userId: string): Promise<void>;
484
+ updateUserRole(appId: string, userId: string, role: "admin" | "member"): Promise<any>;
485
+ transferOwnership(appId: string, newOwnerEmail: string): Promise<void>;
486
+ transferAdminOwnership(appId: string, adminId: string): Promise<any>;
487
+ listAppAdmins(appId: string): Promise<any[]>;
488
+ addAppAdmin(appId: string, data: {
489
+ adminEmail: string;
490
+ role?: string;
491
+ sendEmail?: boolean;
492
+ loginUrl?: string;
493
+ }): Promise<any>;
494
+ removeAppAdmin(appId: string, adminId: string): Promise<any>;
495
+ listAppAdminInvitations(appId: string): Promise<any[]>;
496
+ deleteAppAdminInvitation(appId: string, invitationId: string): Promise<any>;
497
+ transferDocumentOwnership(appId: string, documentId: string, newOwnerId: string): Promise<void>;
498
+ listInvitations(appId: string, params?: {
499
+ limit?: number;
500
+ cursor?: string;
501
+ }): Promise<{
502
+ items: any[];
503
+ nextCursor?: string;
504
+ hasMore?: boolean;
505
+ /** @deprecated Alias of `nextCursor` (#1316). */
506
+ cursor?: string;
507
+ }>;
508
+ createInvitation(appId: string, data: {
509
+ email: string;
510
+ role: "admin" | "member";
511
+ expiresInDays?: number;
512
+ sendEmail?: boolean;
513
+ note?: string;
514
+ }): Promise<any>;
515
+ deleteInvitation(appId: string, invitationId: string): Promise<void>;
516
+ listWaitlist(appId: string): Promise<any[]>;
517
+ inviteWaitlistEntry(appId: string, waitlistId: string, options?: {
518
+ sendEmail?: boolean;
519
+ signupUrl?: string;
520
+ }): Promise<any>;
521
+ bulkInviteWaitlist(appId: string, payload: {
522
+ waitlistIds?: string[];
523
+ count?: number;
524
+ sendEmail?: boolean;
525
+ signupUrl?: string;
526
+ }): Promise<any>;
527
+ removeWaitlistEntry(appId: string, waitlistId: string): Promise<void>;
528
+ listDeferredGrants(appId: string, params?: {
529
+ type?: string;
530
+ email?: string;
531
+ limit?: number;
532
+ cursor?: string;
533
+ }): Promise<{
534
+ grants: any[];
535
+ nextCursor?: string | null;
536
+ hasMore?: boolean;
537
+ }>;
538
+ revokeDeferredGrant(appId: string, deferredId: string, type: string): Promise<any>;
539
+ listIntegrations(appId: string, params?: {
540
+ status?: string;
541
+ cursor?: string;
542
+ limit?: number;
543
+ }): Promise<{
544
+ items: any[];
545
+ nextCursor?: string | null;
546
+ }>;
547
+ /** Integration detail (#2631: `accessRule` is on the detail, not the list summary). */
548
+ getIntegration(appId: string, integrationId: string): Promise<IntegrationDetail>;
549
+ createIntegration(appId: string, payload: IntegrationWritePayload): Promise<any>;
550
+ updateIntegration(appId: string, integrationId: string, payload: IntegrationWritePayload, expectedModifiedAt?: string): Promise<any>;
551
+ deleteIntegration(appId: string, integrationId: string, hard?: boolean): Promise<void>;
552
+ testIntegration(appId: string, integrationId: string, payload: any): Promise<any>;
553
+ listIntegrationLogs(appId: string, integrationId: string, params?: {
554
+ limit?: number;
555
+ status?: string;
556
+ from?: string;
557
+ to?: string;
558
+ source?: "user" | "admin" | "test" | "workflow";
559
+ }): Promise<any[]>;
560
+ listWorkflowRunIntegrationLogs(appId: string, runId: string, params?: {
561
+ limit?: number;
562
+ }): Promise<any[]>;
563
+ listAppSecrets(appId: string): Promise<any[]>;
564
+ createAppSecret(appId: string, payload: {
565
+ key: string;
566
+ value: string;
567
+ summary?: string;
568
+ }): Promise<any>;
569
+ updateAppSecret(appId: string, secretId: string, payload: {
570
+ value?: string;
571
+ summary?: string;
572
+ }): Promise<any>;
573
+ upsertAppSecret(appId: string, key: string, payload: {
574
+ value: string;
575
+ summary?: string;
576
+ }): Promise<any>;
577
+ deleteAppSecret(appId: string, secretId: string): Promise<any>;
578
+ listAppConfigVars(appId: string): Promise<any[]>;
579
+ upsertAppConfigVar(appId: string, key: string, payload: {
580
+ value: string;
581
+ summary?: string;
582
+ }, expectedModifiedAt?: string, options?: {
583
+ expectNotExists?: boolean;
584
+ }): Promise<any>;
585
+ deleteAppConfigVar(appId: string, key: string, expectedModifiedAt?: string): Promise<any>;
586
+ listWebhooks(appId: string, params?: {
587
+ status?: string;
588
+ cursor?: string;
589
+ limit?: number;
590
+ }): Promise<{
591
+ items: any[];
592
+ nextCursor?: string | null;
593
+ }>;
594
+ getWebhook(appId: string, webhookId: string): Promise<any>;
595
+ createWebhook(appId: string, payload: any): Promise<any>;
596
+ updateWebhook(appId: string, webhookId: string, payload: any, expectedModifiedAt?: string): Promise<any>;
597
+ /**
598
+ * Delete a webhook. Archives it by default; `hard` hard-deletes the row
599
+ * instead (#2232), which is what frees a slot under the per-app webhook cap
600
+ * and releases the webhook key for reuse. Same `?hard=true` verb the admin
601
+ * integrations delete uses.
602
+ */
603
+ deleteWebhook(appId: string, webhookId: string, options?: {
604
+ hard?: boolean;
605
+ }): Promise<void>;
606
+ rotateWebhookSecret(appId: string, webhookId: string, payload: {
607
+ signingSecret: string;
608
+ }): Promise<any>;
609
+ listWebhookEvents(appId: string, webhookId: string, params?: {
610
+ limit?: number;
611
+ cursor?: string;
612
+ }): Promise<{
613
+ items: any[];
614
+ hasMore?: boolean;
615
+ nextCursor?: string | null;
616
+ /** @deprecated Alias of `nextCursor` (#1316). */
617
+ cursor?: string | null;
618
+ }>;
619
+ /**
620
+ * List the live connections the server believes exist for exactly one of a
621
+ * document, user, or database. Read-only inspection over admin-api. Rows are
622
+ * per-connection-×-subscription bindings, so `connectionId` is not unique
623
+ * across rows. `params` on a database-subscription row is caller-defined
624
+ * bound CEL input — typed `unknown`.
625
+ */
626
+ listConnections(appId: string, selector: {
627
+ documentId?: string;
628
+ userId?: string;
629
+ databaseId?: string;
630
+ }, params?: {
631
+ limit?: number;
632
+ cursor?: string;
633
+ }): Promise<{
634
+ items: unknown[];
635
+ nextCursor?: string | null;
636
+ }>;
637
+ listSessions(appId: string, userId: string, params?: {
638
+ limit?: number;
639
+ cursor?: string;
640
+ }): Promise<{
641
+ items: unknown[];
642
+ nextCursor?: string | null;
643
+ }>;
644
+ testWebhook(appId: string, webhookId: string, payload?: any): Promise<any>;
645
+ /**
646
+ * Run a webhook's configured verifier over headers and a body captured from
647
+ * a real delivery, and report whether that signature checks out (#2445).
648
+ *
649
+ * `headers` is sent as ordered `[name, value]` pairs so a capture carrying a
650
+ * field name on more than one line survives the round trip. Nothing is
651
+ * delivered: no delivery record, no workflow run.
652
+ */
653
+ verifyWebhook(appId: string, webhookId: string, payload: {
654
+ headers: Array<[string, string]>;
655
+ rawBody?: string;
656
+ bodyBase64?: string;
657
+ }): Promise<any>;
658
+ listLocks(appId: string): Promise<{
659
+ locks: any[];
660
+ }>;
661
+ getLockStatus(appId: string, key: string): Promise<any>;
662
+ acquireLock(appId: string, key: string, ttlMs: number): Promise<any>;
663
+ releaseLock(appId: string, key: string, handleId: string): Promise<any>;
664
+ listCronTriggers(appId: string): Promise<{
665
+ items: any[];
666
+ }>;
667
+ getCronTrigger(appId: string, triggerId: string): Promise<any>;
668
+ createCronTrigger(appId: string, payload: any): Promise<any>;
669
+ updateCronTrigger(appId: string, triggerId: string, payload: any): Promise<any>;
670
+ deleteCronTrigger(appId: string, triggerId: string): Promise<any>;
671
+ pauseCronTrigger(appId: string, triggerId: string): Promise<any>;
672
+ resumeCronTrigger(appId: string, triggerId: string): Promise<any>;
673
+ testCronTrigger(appId: string, triggerId: string): Promise<any>;
674
+ listIterations(appId: string): Promise<{
675
+ items: any[];
676
+ }>;
677
+ getIteration(appId: string, iterationName: string): Promise<any>;
678
+ resetIteration(appId: string, iterationName: string): Promise<any>;
679
+ readResourceMetadata(appId: string, resourceType: string, resourceId: string, category: string): Promise<any>;
680
+ writeResourceMetadata(appId: string, resourceType: string, resourceId: string, category: string, data: Record<string, any>): Promise<any>;
681
+ batchReadResourceMetadata(appId: string, requests: Array<{
682
+ resourceType: string;
683
+ resourceId: string;
684
+ categories: string[];
685
+ }>): Promise<{
686
+ results: any[];
687
+ }>;
688
+ /**
689
+ * List every stored metadata category on one resource (issue #1402 — debug
690
+ * tooling). The CLI authenticates as a console admin, so the app-level
691
+ * owner/admin bypass returns every category regardless of its readRule.
692
+ */
693
+ listResourceMetadata(appId: string, resourceType: string, resourceId: string): Promise<{
694
+ resourceType: string;
695
+ resourceId: string;
696
+ categories: Array<{
697
+ category: string;
698
+ data: Record<string, any>;
699
+ schemaVersion: number | null;
700
+ }>;
701
+ }>;
702
+ /**
703
+ * Delete one resource's metadata for one category (issue #1402 — debug
704
+ * tooling). Idempotent: deleting an absent item succeeds with
705
+ * `deleted: false` rather than a 404.
706
+ */
707
+ deleteResourceMetadata(appId: string, resourceType: string, resourceId: string, category: string): Promise<{
708
+ resourceType: string;
709
+ resourceId: string;
710
+ category: string;
711
+ deleted: boolean;
712
+ }>;
713
+ /**
714
+ * Reverse-resolve a resource by a category's unique metadata value (issue
715
+ * #2137). A miss is a success with `resourceId: null`, never an error. The
716
+ * CLI authenticates as a console admin, so the app-level owner/admin bypass
717
+ * skips readRule evaluation.
718
+ */
719
+ resolveResourceMetadata(appId: string, resourceType: string, category: string, key: string, value: string): Promise<{
720
+ resourceId: string | null;
721
+ resourceType?: string;
722
+ }>;
723
+ listPrompts(appId: string, params?: {
724
+ status?: string;
725
+ limit?: number;
726
+ cursor?: string;
727
+ }): Promise<{
728
+ items: any[];
729
+ nextCursor?: string | null;
730
+ }>;
731
+ getPrompt(appId: string, promptId: string): Promise<any>;
732
+ createPrompt(appId: string, payload: any): Promise<any>;
733
+ updatePrompt(appId: string, promptId: string, payload: any, expectedModifiedAt?: string): Promise<any>;
734
+ deletePrompt(appId: string, promptId: string, hard?: boolean): Promise<void>;
735
+ executePrompt(appId: string, promptId: string, payload: {
736
+ variables: Record<string, any>;
737
+ modelOverride?: string;
738
+ configId?: string;
739
+ }): Promise<any>;
740
+ previewPrompt(appId: string, promptId: string, payload: {
741
+ variables: Record<string, any>;
742
+ configId?: string;
743
+ }): Promise<any>;
744
+ listPromptConfigs(appId: string, promptId: string): Promise<{
745
+ items: any[];
746
+ }>;
747
+ getPromptConfig(appId: string, promptId: string, configId: string): Promise<any>;
748
+ createPromptConfig(appId: string, promptId: string, payload: any): Promise<any>;
749
+ updatePromptConfig(appId: string, promptId: string, configId: string, payload: any): Promise<any>;
750
+ activatePromptConfig(appId: string, promptId: string, configId: string): Promise<any>;
751
+ duplicatePromptConfig(appId: string, promptId: string, configId: string, payload?: {
752
+ configName?: string;
753
+ description?: string;
754
+ }): Promise<any>;
755
+ listScripts(appId: string): Promise<{
756
+ items: any[];
757
+ }>;
758
+ getScript(appId: string, scriptId: string): Promise<any>;
759
+ /**
760
+ * List a script's versioned configs (the `ScriptConfig` rows). Each config
761
+ * is a distinct block version: `configId` is the stable version selector,
762
+ * `contentHash` is its content identity, and `status` reports whether it is
763
+ * `active`/`draft`/`archived`. The script header's `activeConfigId` names
764
+ * the live version. Used by `scripts configs list` and by the script test
765
+ * commands to run against a specific pinned version.
766
+ */
767
+ listScriptConfigs(appId: string, scriptId: string): Promise<{
768
+ items: any[];
769
+ }>;
770
+ createScript(appId: string, payload: {
771
+ name: string;
772
+ body: string;
773
+ description?: string;
774
+ }): Promise<any>;
775
+ /**
776
+ * Push a new body for an existing script by creating a new `ScriptConfig`
777
+ * and activating it (the prompt-model "edit → activate" flow). Referencing
778
+ * workflows pick up the new body on their next run with no fan-out. The
779
+ * config name is unique per script, so we mint a timestamped name.
780
+ */
781
+ pushScriptBody(appId: string, scriptId: string, body: string): Promise<any>;
782
+ /**
783
+ * Delete a script header (cascades its configs). `force` overrides the
784
+ * server's guard against deleting a script that an active workflow still
785
+ * references by name — without it the server answers 409.
786
+ */
787
+ deleteScript(appId: string, scriptId: string, force?: boolean): Promise<void>;
788
+ getPromptSchema(appId: string, promptId: string): Promise<{
789
+ promptId: string;
790
+ promptKey: string;
791
+ displayName: string;
792
+ inputSchema: any;
793
+ inputVariables: string[];
794
+ outputSchema: any;
795
+ activeConfigId: string | null;
796
+ activeConfigName: string | null;
797
+ }>;
798
+ listTestCases(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string): Promise<{
799
+ items: any[];
800
+ }>;
801
+ getTestCase(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, testCaseId: string): Promise<any>;
802
+ createTestCase(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, payload: {
803
+ name: string;
804
+ inputVariables: Record<string, any>;
805
+ expectedOutputPattern?: string;
806
+ expectedOutputContains?: string[];
807
+ expectedJsonSubset?: Record<string, any>;
808
+ configId?: string;
809
+ evaluatorPromptId?: string;
810
+ evaluatorConfigId?: string;
811
+ }): Promise<any>;
812
+ updateTestCase(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, testCaseId: string, payload: {
813
+ name?: string;
814
+ inputVariables?: Record<string, any>;
815
+ expectedOutputPattern?: string | null;
816
+ expectedOutputContains?: string[] | null;
817
+ expectedJsonSubset?: Record<string, any> | null;
818
+ configId?: string | null;
819
+ evaluatorPromptId?: string | null;
820
+ evaluatorConfigId?: string | null;
821
+ }): Promise<any>;
822
+ deleteTestCase(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, testCaseId: string): Promise<void>;
823
+ listTestCaseAttachments(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, testCaseId: string): Promise<{
824
+ attachments: Array<{
825
+ filename: string;
826
+ contentType: string;
827
+ size: number;
828
+ r2Key: string;
829
+ }>;
830
+ }>;
831
+ uploadTestCaseAttachment(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, testCaseId: string, filename: string, data: Buffer, contentType: string): Promise<{
832
+ success: boolean;
833
+ attachment: {
834
+ filename: string;
835
+ contentType: string;
836
+ size: number;
837
+ r2Key: string;
838
+ };
839
+ }>;
840
+ downloadTestCaseAttachment(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, testCaseId: string, filename: string): Promise<{
841
+ data: Buffer;
842
+ contentType: string;
843
+ }>;
844
+ deleteTestCaseAttachment(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, testCaseId: string, filename: string): Promise<{
845
+ success: boolean;
846
+ deleted: boolean;
847
+ }>;
848
+ executeBlockTest(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, payload: {
849
+ variables?: Record<string, any>;
850
+ testCaseId?: string;
851
+ configId?: string;
852
+ comparisonGroup?: string;
853
+ }): Promise<any>;
854
+ runAllTestCases(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, payload?: {
855
+ overrideConfigId?: string;
856
+ comparisonGroup?: string;
857
+ testCaseIds?: string[];
858
+ }): Promise<any>;
859
+ listTestRuns(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, params?: {
860
+ limit?: number;
861
+ comparisonGroup?: string;
862
+ }): Promise<{
863
+ items: any[];
864
+ }>;
865
+ listWorkflows(appId: string, params?: {
866
+ status?: string;
867
+ limit?: number;
868
+ cursor?: string;
869
+ }): Promise<{
870
+ items: any[];
871
+ nextCursor?: string | null;
872
+ }>;
873
+ getWorkflow(appId: string, workflowId: string): Promise<any>;
874
+ createWorkflow(appId: string, payload: any): Promise<any>;
875
+ updateWorkflow(appId: string, workflowId: string, payload: any, expectedModifiedAt?: string): Promise<any>;
876
+ deleteWorkflow(appId: string, workflowId: string): Promise<void>;
877
+ /**
878
+ * #2645 criterion 9 — the operational toggle. Deliberately NOT the config
879
+ * PATCH: `sync push` owns every configuration field, and taking a workflow
880
+ * out of service must not touch one, or an operator's action would show up as
881
+ * drift against the repo. Same route shape as `cron-triggers pause|resume`.
882
+ */
883
+ disableWorkflow(appId: string, workflowId: string): Promise<any>;
884
+ enableWorkflow(appId: string, workflowId: string): Promise<any>;
885
+ updateWorkflowDraft(appId: string, workflowId: string, payload: any): Promise<any>;
886
+ publishWorkflow(appId: string, workflowId: string): Promise<any>;
887
+ previewWorkflow(appId: string, workflowId: string, payload: {
888
+ rootInput?: object;
889
+ meta?: object;
890
+ configId?: string;
891
+ useDraft?: boolean;
892
+ preferActive?: boolean;
893
+ }): Promise<{
894
+ instanceId: string;
895
+ usingDraft?: boolean;
896
+ source?: "config" | "active" | "draft" | null;
897
+ configName?: string | null;
898
+ configId?: string | null;
899
+ warning?: string;
900
+ }>;
901
+ getPreviewStatus(appId: string, workflowId: string, instanceId: string): Promise<any>;
902
+ listWorkflowRuns(appId: string, workflowId: string, params?: {
903
+ status?: string;
904
+ limit?: number;
905
+ cursor?: string;
906
+ forward?: boolean;
907
+ follow?: boolean;
908
+ after?: string;
909
+ }): Promise<{
910
+ items: any[];
911
+ hasMore?: boolean;
912
+ nextCursor?: string | null;
913
+ /** @deprecated Alias of `nextCursor` (#1316). */
914
+ cursor?: string | null;
915
+ /** #1969 — opaque follow checkpoint; present on `follow=true` responses. */
916
+ resumeAfter?: string;
917
+ /**
918
+ * #2237 — index rows the server examined for this request. Filtered reads
919
+ * only, and only on a server new enough to report it; `undefined`
920
+ * otherwise, which callers must treat as "unknown", not zero.
921
+ */
922
+ scanned?: number;
923
+ }>;
924
+ /**
925
+ * Workflow runs started by one app user, across every workflow (#1967).
926
+ * Backed by `GET /admin/api/apps/{appId}/users/{userId}/workflow-runs`,
927
+ * which resolves the app user before querying the `runsByUser` index.
928
+ */
929
+ listUserWorkflowRuns(appId: string, userId: string, params?: {
930
+ status?: string;
931
+ limit?: number;
932
+ cursor?: string;
933
+ forward?: boolean;
934
+ workflowId?: string;
935
+ }): Promise<{
936
+ items: any[];
937
+ hasMore?: boolean;
938
+ nextCursor?: string | null;
939
+ /** @deprecated Alias of `nextCursor` (#1316). */
940
+ cursor?: string | null;
941
+ /** #2237 — index rows examined; filtered reads only, `undefined` if unknown. */
942
+ scanned?: number;
943
+ }>;
944
+ getWorkflowRunStatus(appId: string, workflowId: string, runId: string): Promise<any>;
945
+ getWorkflowStepRuns(appId: string, workflowId: string, runId: string): Promise<{
946
+ items: any[];
947
+ }>;
948
+ getWorkflowAnalytics(appId: string, params?: {
949
+ windowDays?: number;
950
+ }): Promise<any>;
951
+ getTopWorkflows(appId: string, params?: {
952
+ windowDays?: number;
953
+ limit?: number;
954
+ }): Promise<any>;
955
+ listWorkflowConfigs(appId: string, workflowId: string): Promise<{
956
+ items: any[];
957
+ }>;
958
+ getWorkflowConfig(appId: string, workflowId: string, configId: string): Promise<any>;
959
+ createWorkflowConfig(appId: string, workflowId: string, payload: {
960
+ configName: string;
961
+ description?: string;
962
+ steps: any[];
963
+ expressions?: {
964
+ cel?: Record<string, string>;
965
+ };
966
+ }): Promise<any>;
967
+ updateWorkflowConfig(appId: string, workflowId: string, configId: string, payload: {
968
+ configName?: string;
969
+ description?: string;
970
+ steps?: any[];
971
+ status?: string;
972
+ expressions?: {
973
+ cel?: Record<string, string>;
974
+ };
975
+ }): Promise<any>;
976
+ archiveWorkflowConfig(appId: string, workflowId: string, configId: string): Promise<any>;
977
+ activateWorkflowConfig(appId: string, workflowId: string, configId: string): Promise<any>;
978
+ duplicateWorkflowConfig(appId: string, workflowId: string, configId: string, payload?: {
979
+ configName?: string;
980
+ }): Promise<any>;
981
+ getAnalyticsTopUsers(appId: string, params?: {
982
+ windowDays?: number;
983
+ limit?: number;
984
+ }): Promise<AnalyticsTopUsersResponse>;
985
+ getAnalyticsIntegrationMetrics(appId: string, params?: {
986
+ windowDays?: number;
987
+ }): Promise<AnalyticsIntegrationMetricsResponse>;
988
+ getAnalyticsOverviewDau(appId: string): Promise<AnalyticsMetricResponse>;
989
+ getAnalyticsOverviewWau(appId: string): Promise<AnalyticsMetricResponse>;
990
+ getAnalyticsOverviewMau(appId: string): Promise<AnalyticsMetricResponse>;
991
+ getAnalyticsOverviewGrowth(appId: string, params?: {
992
+ windowDays?: number;
993
+ }): Promise<AnalyticsGrowthResponse>;
994
+ getAnalyticsDailyActive(appId: string, params?: {
995
+ windowDays?: number;
996
+ }): Promise<AnalyticsDailyActiveResponse>;
997
+ getAnalyticsRollingActive(appId: string, params?: {
998
+ windowDays?: number;
999
+ }): Promise<AnalyticsDailyActiveResponse>;
1000
+ getAnalyticsCohortRetention(appId: string): Promise<AnalyticsCohortResponse>;
1001
+ getAnalyticsUserSearch(appId: string, params: {
1002
+ q: string;
1003
+ limit?: number;
1004
+ }): Promise<AnalyticsUserSearchResponse>;
1005
+ getAnalyticsUserDetail(appId: string, userUlid: string): Promise<AnalyticsUserDetailResponse>;
1006
+ getAnalyticsUserSnapshot(appId: string, userUlid: string): Promise<AnalyticsUserSnapshotResponse>;
1007
+ getAnalyticsEvents(appId: string, params?: {
1008
+ windowDays?: number;
1009
+ page?: number;
1010
+ [key: string]: any;
1011
+ }): Promise<AnalyticsEventsResponse>;
1012
+ getAnalyticsEventsGrouped(appId: string, params?: {
1013
+ groupBy?: string;
1014
+ windowDays?: number;
1015
+ [key: string]: any;
1016
+ }): Promise<AnalyticsEventsGroupedResponse>;
1017
+ getAnalyticsErrorsGroups(appId: string, params?: {
1018
+ windowDays?: number;
1019
+ limit?: number;
1020
+ [key: string]: any;
1021
+ }): Promise<AnalyticsErrorsGroupsResponse>;
1022
+ getAnalyticsTopWorkflows(appId: string, params?: {
1023
+ windowDays?: number;
1024
+ limit?: number;
1025
+ }): Promise<TopWorkflowsResponse>;
1026
+ getAnalyticsTopPrompts(appId: string, params?: {
1027
+ windowDays?: number;
1028
+ limit?: number;
1029
+ }): Promise<TopPromptsResponse>;
1030
+ listAllAdmins(params?: {
1031
+ limit?: number;
1032
+ cursor?: string;
1033
+ }): Promise<any>;
1034
+ searchAdminByEmail(email: string): Promise<any>;
1035
+ getAdminApps(email: string): Promise<any>;
1036
+ updateAdminSettings(adminId: string, data: {
1037
+ appCreationLimit?: number;
1038
+ disabled?: boolean;
1039
+ role?: "admin" | "super-admin";
1040
+ }): Promise<any>;
1041
+ reindexAdmin(adminId: string): Promise<void>;
1042
+ listAllAdminInvitations(): Promise<any[]>;
1043
+ createGlobalAdminInvitation(data: {
1044
+ email: string;
1045
+ appCreationLimit?: number;
1046
+ expiresInDays?: number;
1047
+ }): Promise<any>;
1048
+ deleteGlobalAdminInvitation(invitationId: string): Promise<void>;
1049
+ listPromptCatalog(params?: {
1050
+ status?: string;
1051
+ limit?: number;
1052
+ cursor?: string;
1053
+ }): Promise<any>;
1054
+ getPromptCatalogItem(catalogId: string): Promise<any>;
1055
+ createPromptCatalogItem(payload: any): Promise<any>;
1056
+ updatePromptCatalogItem(catalogId: string, payload: any): Promise<any>;
1057
+ deletePromptCatalogItem(catalogId: string): Promise<void>;
1058
+ listIntegrationCatalog(params?: {
1059
+ status?: string;
1060
+ limit?: number;
1061
+ cursor?: string;
1062
+ }): Promise<any>;
1063
+ getIntegrationCatalogItem(catalogId: string): Promise<any>;
1064
+ createIntegrationCatalogItem(payload: any): Promise<any>;
1065
+ updateIntegrationCatalogItem(catalogId: string, payload: any): Promise<any>;
1066
+ deleteIntegrationCatalogItem(catalogId: string): Promise<void>;
1067
+ listLlmModels(provider?: string): Promise<{
1068
+ models: Array<{
1069
+ id: string;
1070
+ name: string;
1071
+ context_length?: number;
1072
+ pricing?: any;
1073
+ }>;
1074
+ defaultModel?: string;
1075
+ cachedAt?: string;
1076
+ }>;
1077
+ generatePrompt(payload: {
1078
+ description: string;
1079
+ generateOutputSchema?: boolean;
1080
+ }): Promise<any>;
1081
+ generateEvaluator(payload: {
1082
+ appId: string;
1083
+ promptId: string;
1084
+ }): Promise<any>;
1085
+ generateWorkflowEvaluator(payload: {
1086
+ appId: string;
1087
+ workflowId: string;
1088
+ }): Promise<any>;
1089
+ startBatchTests(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, payload?: {
1090
+ comparisonGroup?: string;
1091
+ overrideConfigId?: string;
1092
+ testCaseIds?: string[];
1093
+ }): Promise<{
1094
+ batchId: string;
1095
+ totalTests: number;
1096
+ instanceIds: string[];
1097
+ errors?: any[];
1098
+ }>;
1099
+ getBatchTestStatus(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, batchId: string): Promise<{
1100
+ status: string;
1101
+ batchId: string;
1102
+ completed: number;
1103
+ passed: number;
1104
+ failed: number;
1105
+ results: Array<{
1106
+ testCaseId: string;
1107
+ runId: string;
1108
+ status: string;
1109
+ verificationPassed: boolean;
1110
+ durationMs?: number;
1111
+ verificationDetails?: any;
1112
+ startedAt?: string;
1113
+ endedAt?: string;
1114
+ }>;
1115
+ }>;
1116
+ cancelBatchTests(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, batchId: string, instanceIds: string[]): Promise<{
1117
+ batchId: string;
1118
+ terminated: string[];
1119
+ errors?: any[];
1120
+ }>;
1121
+ getComparisonGroup(appId: string, group: string): Promise<{
1122
+ comparisonGroup: string;
1123
+ runs: any[];
1124
+ }>;
1125
+ listEmailTemplates(appId: string): Promise<{
1126
+ templates: EmailTemplateSummary[];
1127
+ }>;
1128
+ getEmailTemplate(appId: string, emailType: string): Promise<EmailTemplateDetail>;
1129
+ upsertEmailTemplate(appId: string, emailType: string, payload: {
1130
+ subject: string;
1131
+ htmlBody: string;
1132
+ textBody: string;
1133
+ }): Promise<EmailTemplateUpsertResult>;
1134
+ deleteEmailTemplate(appId: string, emailType: string): Promise<{
1135
+ success: boolean;
1136
+ }>;
1137
+ testEmailTemplate(appId: string, emailType: string, payload?: {
1138
+ subject: string;
1139
+ htmlBody: string;
1140
+ textBody: string;
1141
+ }): Promise<{
1142
+ success: boolean;
1143
+ sentTo: string;
1144
+ error?: string;
1145
+ }>;
1146
+ createToken(appId: string, data: {
1147
+ name: string;
1148
+ ttl?: string;
1149
+ userId?: string;
1150
+ }): Promise<{
1151
+ token: string;
1152
+ tokenId: string;
1153
+ name: string;
1154
+ expiresAt: string | null;
1155
+ createdAt: string;
1156
+ warning: string;
1157
+ }>;
1158
+ listTokens(appId: string, params?: {
1159
+ userId?: string;
1160
+ }): Promise<Array<{
1161
+ tokenId: string;
1162
+ name: string;
1163
+ userId: string;
1164
+ expiresAt: string | null;
1165
+ lastUsedAt: string | null;
1166
+ createdAt: string;
1167
+ createdBy: string;
1168
+ }>>;
1169
+ getToken(appId: string, tokenId: string): Promise<{
1170
+ tokenId: string;
1171
+ name: string;
1172
+ userId: string;
1173
+ expiresAt: string | null;
1174
+ lastUsedAt: string | null;
1175
+ createdAt: string;
1176
+ createdBy: string;
1177
+ revokedAt: string | null;
1178
+ }>;
1179
+ revokeToken(appId: string, tokenId: string): Promise<{
1180
+ success: boolean;
1181
+ message: string;
1182
+ }>;
1183
+ /**
1184
+ * List an app's databases, following the cursor to the end.
1185
+ *
1186
+ * The endpoint returns the `{ items, hasMore, nextCursor }` envelope and
1187
+ * caps a page at 100 (#1958), so `databases list` needs the follow-up pages
1188
+ * to show every database. `paginateAll` carries the repeat-cursor and
1189
+ * max-page guards, so a server that hands out a non-advancing cursor fails
1190
+ * loudly instead of looping forever.
1191
+ *
1192
+ * `options.owner` narrows the result to the databases that user created; the
1193
+ * server resolves it through the `databasesByCreator` index (#1965).
1194
+ */
1195
+ listDatabases(appId: string, options?: {
1196
+ owner?: string;
1197
+ }): Promise<any[]>;
1198
+ createDatabase(appId: string, data: {
1199
+ title: string;
1200
+ databaseType?: string;
1201
+ metadata?: Record<string, any> | string;
1202
+ initialMetadata?: Record<string, Record<string, unknown>>;
1203
+ }): Promise<any>;
1204
+ getDatabase(appId: string, databaseId: string): Promise<any>;
1205
+ updateDatabase(appId: string, databaseId: string, data: Record<string, any>): Promise<any>;
1206
+ deleteDatabase(appId: string, databaseId: string): Promise<void>;
1207
+ /**
1208
+ * Read a database's CEL context dict.
1209
+ *
1210
+ * The HTTP path stays `/metadata` because the wire field name is still
1211
+ * `metadata`; only the client/CLI-facing helper names were reframed.
1212
+ */
1213
+ getDatabaseCelContext(appId: string, databaseId: string): Promise<any>;
1214
+ /** Update a database's CEL context dict (merge with existing). */
1215
+ updateDatabaseCelContext(appId: string, databaseId: string, celContext: Record<string, any>): Promise<any>;
1216
+ /** @deprecated Use {@link getDatabaseCelContext} instead. */
1217
+ getDatabaseMetadata(appId: string, databaseId: string): Promise<any>;
1218
+ /** @deprecated Use {@link updateDatabaseCelContext} instead. */
1219
+ updateDatabaseMetadata(appId: string, databaseId: string, metadata: Record<string, any>): Promise<any>;
1220
+ listDatabasePermissions(appId: string, databaseId: string): Promise<any[]>;
1221
+ addDatabaseManager(appId: string, databaseId: string, userId: string): Promise<any>;
1222
+ removeDatabaseManager(appId: string, databaseId: string, userId: string): Promise<any>;
1223
+ /** @deprecated Use {@link addDatabaseManager} instead. */
1224
+ grantDatabasePermission(appId: string, databaseId: string, data: {
1225
+ userId: string;
1226
+ permission: "manager";
1227
+ }): Promise<any>;
1228
+ /** @deprecated Use {@link removeDatabaseManager} instead. */
1229
+ revokeDatabasePermission(appId: string, databaseId: string, userId: string): Promise<any>;
1230
+ listDatabaseModels(appId: string, databaseId: string): Promise<any>;
1231
+ describeDatabaseModel(appId: string, databaseId: string, modelName: string): Promise<any>;
1232
+ /**
1233
+ * Query records in a database model. The Durable Object answers with its own
1234
+ * `{ data, hasMore, nextCursor?, prevCursor? }` envelope; that wire shape is
1235
+ * shared with the JS client, the Swift client and web-admin, so the CLI
1236
+ * normalizes it at its own boundary instead (issue #2357) and hands callers
1237
+ * the same `{ items, hasMore, nextCursor? }` envelope as
1238
+ * {@link queryDocumentRecords}.
1239
+ */
1240
+ queryDatabaseRecords(appId: string, databaseId: string, modelName: string, queryOptions?: {
1241
+ filter?: Record<string, any>;
1242
+ limit?: number;
1243
+ cursor?: string;
1244
+ }): Promise<ListEnvelope>;
1245
+ countDatabaseRecords(appId: string, databaseId: string, modelName: string, filter?: Record<string, any>): Promise<{
1246
+ count: number;
1247
+ }>;
1248
+ aggregateDatabaseRecords(appId: string, databaseId: string, modelName: string, options: {
1249
+ operations: {
1250
+ type: string;
1251
+ field?: string;
1252
+ }[];
1253
+ groupBy: (string | {
1254
+ field: string;
1255
+ contains: string;
1256
+ })[];
1257
+ filter?: Record<string, any>;
1258
+ }): Promise<{
1259
+ result: unknown;
1260
+ }>;
1261
+ /**
1262
+ * Upsert one record via `records/save`: creates the record when the id is
1263
+ * new, and merges the supplied fields into it when it already exists (the DO
1264
+ * writes with `ON CONFLICT … json_patch`, so fields you leave out survive).
1265
+ * `patchDatabaseRecord` is the same merge but requires the record to exist.
1266
+ *
1267
+ * `id` is optional: when omitted the body carries no `id`, which the
1268
+ * DatabaseDO only accepts alongside an `upsertOn` field — callers that want a
1269
+ * plain create must supply an id themselves (`databases records save` mints a
1270
+ * ULID, matching the CSV import path).
1271
+ *
1272
+ * Returns the endpoint's flat `{ success, id, appliedFields }` — not the
1273
+ * saved record.
1274
+ */
1275
+ saveDatabaseRecord(appId: string, databaseId: string, modelName: string, id: string | undefined, data: any): Promise<any>;
1276
+ /**
1277
+ * Merge the supplied fields into an existing record via `records/patch`.
1278
+ *
1279
+ * Fields absent from `data` are left as they are. Unlike `saveDatabaseRecord`
1280
+ * the record must already exist — the DatabaseDO answers 404 for an unknown
1281
+ * id rather than creating one. Returns the flat
1282
+ * `{ success, id, appliedFields }`.
1283
+ */
1284
+ patchDatabaseRecord(appId: string, databaseId: string, modelName: string, id: string, data: any): Promise<any>;
1285
+ listDatabaseOperations(appId: string, databaseId: string): Promise<any[]>;
1286
+ /**
1287
+ * Execute a registered operation and, when the result is a query page,
1288
+ * normalize it to the CLI's one list envelope (issue #2440).
1289
+ *
1290
+ * The registered operation decides the response shape, so the normalization
1291
+ * is conditional — see {@link normalizeDatabaseOperationResult}. Everything
1292
+ * else (a `count`, an `aggregate`, a mutation, a `returnField: "all"`
1293
+ * pipeline) is returned exactly as the server sent it.
1294
+ */
1295
+ executeDatabaseOperation(appId: string, databaseId: string, operationName: string, data?: {
1296
+ params?: Record<string, any>;
1297
+ limit?: number;
1298
+ cursor?: string;
1299
+ direction?: number;
1300
+ }, token?: string, options?: {
1301
+ timing?: boolean;
1302
+ }): Promise<any>;
1303
+ /**
1304
+ * Execute a registered batch (bulk) database operation. Posts a chunk of
1305
+ * items to the canonical `operations/:name/batch` endpoint (the same one the
1306
+ * client library's `executeBatch` uses — NOT the deprecated `import-bulk`
1307
+ * alias). Used by `databases import-csv`.
1308
+ *
1309
+ * @returns `{ imported, failed }` — DO-level write outcome counts. Per-item
1310
+ * validation/access failures abort the whole chunk with a 4xx (thrown).
1311
+ */
1312
+ executeBatch(appId: string, databaseId: string, operationName: string, batch: Array<{
1313
+ params: Record<string, any>;
1314
+ }>): Promise<{
1315
+ imported: number;
1316
+ failed: number;
1317
+ }>;
1318
+ /**
1319
+ * Make a request using a specific JWT token instead of the CLI's credentials.
1320
+ * Used for executing operations as a different user.
1321
+ */
1322
+ requestWithToken<T = any>(path: string, token: string, options?: RequestInit): Promise<T>;
1323
+ listDatabaseIndexes(appId: string, databaseId: string, modelName?: string): Promise<any>;
1324
+ registerDatabaseIndex(appId: string, databaseId: string, data: {
1325
+ modelName: string;
1326
+ fieldName: string;
1327
+ fieldType: string;
1328
+ unique?: boolean;
1329
+ }): Promise<any>;
1330
+ dropDatabaseIndex(appId: string, databaseId: string, data: {
1331
+ modelName: string;
1332
+ fieldName: string;
1333
+ }): Promise<any>;
1334
+ /**
1335
+ * Issue #974: back-provision an existing database instance's schema-declared
1336
+ * unique indexes by reading its type schema and registering any declared-but-
1337
+ * missing unique index. Idempotent.
1338
+ */
1339
+ reindexDatabaseFromSchema(appId: string, databaseId: string): Promise<{
1340
+ ok: boolean;
1341
+ registered: number;
1342
+ skipped?: boolean;
1343
+ reason?: string;
1344
+ databaseType?: string;
1345
+ }>;
1346
+ listDatabaseTypeConfigs(appId: string): Promise<any[]>;
1347
+ getDatabaseTypeConfig(appId: string, databaseType: string): Promise<any>;
1348
+ createDatabaseTypeConfig(appId: string, data: {
1349
+ databaseType: string;
1350
+ ruleSetId?: string | null;
1351
+ triggers?: Record<string, any> | null;
1352
+ metadataAccess?: string | null;
1353
+ defaultAccess?: string | null;
1354
+ autoPopulatedFields?: Record<string, any> | null;
1355
+ timestamps?: Record<string, any> | null;
1356
+ schema?: string | null;
1357
+ metadataManifest?: any;
1358
+ }, options?: {
1359
+ dryRun?: boolean;
1360
+ }): Promise<any>;
1361
+ updateDatabaseTypeConfig(appId: string, databaseType: string, data: {
1362
+ ruleSetId?: string | null;
1363
+ triggers?: Record<string, any> | null;
1364
+ metadataAccess?: string | null;
1365
+ defaultAccess?: string | null;
1366
+ autoPopulatedFields?: Record<string, any> | null;
1367
+ timestamps?: Record<string, any> | null;
1368
+ schema?: string | null;
1369
+ pendingOpDeletes?: string[];
1370
+ finalOpNames?: string[];
1371
+ metadataManifest?: any;
1372
+ pendingOpUpdates?: Array<{
1373
+ name: string;
1374
+ access?: string | null;
1375
+ params?: Record<string, any> | null;
1376
+ }>;
1377
+ }, expectedModifiedAt?: string, options?: {
1378
+ dryRun?: boolean;
1379
+ acceptWarnings?: boolean;
1380
+ }): Promise<any>;
1381
+ deleteDatabaseTypeConfig(appId: string, databaseType: string, options?: {
1382
+ force?: boolean;
1383
+ }): Promise<any>;
1384
+ /**
1385
+ * Issue #666 Phase 3: ask the server to scaffold a TOML schema from
1386
+ * existing ops + DO field introspection. Read-only — does NOT persist.
1387
+ */
1388
+ scaffoldDatabaseTypeSchema(appId: string, databaseType: string): Promise<{
1389
+ schema: string;
1390
+ }>;
1391
+ listDatabaseTypeOperations(appId: string, databaseType: string): Promise<any[]>;
1392
+ getDatabaseTypeOperation(appId: string, databaseType: string, name: string): Promise<any>;
1393
+ createDatabaseTypeOperation(appId: string, databaseType: string, data: {
1394
+ name: string;
1395
+ type: string;
1396
+ modelName: string;
1397
+ access?: string | null;
1398
+ definition: Record<string, any>;
1399
+ params?: Record<string, any> | null;
1400
+ }, options?: {
1401
+ dryRun?: boolean;
1402
+ schemaOverride?: string | null;
1403
+ defaultAccess?: string | null;
1404
+ metadataManifestOverride?: Record<string, any> | null;
1405
+ }): Promise<any>;
1406
+ updateDatabaseTypeOperation(appId: string, databaseType: string, name: string, data: Record<string, any>, expectedModifiedAt?: string, options?: {
1407
+ dryRun?: boolean;
1408
+ schemaOverride?: string | null;
1409
+ metadataManifestOverride?: Record<string, any> | null;
1410
+ }): Promise<any>;
1411
+ deleteDatabaseTypeOperation(appId: string, databaseType: string, name: string): Promise<any>;
1412
+ listDatabaseTypeSubscriptions(appId: string, databaseType: string): Promise<any[]>;
1413
+ getDatabaseTypeSubscription(appId: string, databaseType: string, subscriptionKey: string): Promise<any>;
1414
+ createDatabaseTypeSubscription(appId: string, databaseType: string, data: {
1415
+ subscriptionKey: string;
1416
+ displayName: string;
1417
+ modelName: string;
1418
+ filter: string;
1419
+ access: string;
1420
+ description?: string | null;
1421
+ select?: string[] | null;
1422
+ emit?: string[] | null;
1423
+ params?: Record<string, any> | null;
1424
+ status?: string;
1425
+ }): Promise<any>;
1426
+ updateDatabaseTypeSubscription(appId: string, databaseType: string, subscriptionKey: string, data: Record<string, any>): Promise<any>;
1427
+ deleteDatabaseTypeSubscription(appId: string, databaseType: string, subscriptionKey: string): Promise<any>;
1428
+ listGroups(appId: string, params?: {
1429
+ type?: string;
1430
+ limit?: number;
1431
+ cursor?: string;
1432
+ }): Promise<{
1433
+ items: any[];
1434
+ nextCursor?: string;
1435
+ hasMore?: boolean;
1436
+ /** @deprecated Alias of `nextCursor` (#1316). */
1437
+ cursor?: string;
1438
+ }>;
1439
+ createGroup(appId: string, data: {
1440
+ groupType: string;
1441
+ groupId?: string;
1442
+ name: string;
1443
+ description?: string;
1444
+ }): Promise<any>;
1445
+ getGroup(appId: string, groupType: string, groupId: string): Promise<any>;
1446
+ updateGroup(appId: string, groupType: string, groupId: string, data: {
1447
+ name?: string;
1448
+ description?: string;
1449
+ }): Promise<any>;
1450
+ deleteGroup(appId: string, groupType: string, groupId: string): Promise<any>;
1451
+ listGroupMembers(appId: string, groupType: string, groupId: string, options?: {
1452
+ include?: "profiles";
1453
+ }): Promise<{
1454
+ items: any[];
1455
+ nextCursor?: string;
1456
+ hasMore?: boolean;
1457
+ /** @deprecated Alias of `nextCursor` (#1316). */
1458
+ cursor?: string;
1459
+ }>;
1460
+ addGroupMember(appId: string, groupType: string, groupId: string, data: {
1461
+ userId: string;
1462
+ }): Promise<any>;
1463
+ removeGroupMember(appId: string, groupType: string, groupId: string, userId: string): Promise<any>;
1464
+ listGroupDocuments(appId: string, groupType: string, groupId: string): Promise<any[]>;
1465
+ listUserMemberships(appId: string, userId: string): Promise<any[]>;
1466
+ listDocumentGroupPermissions(appId: string, documentId: string): Promise<any[]>;
1467
+ grantDocumentGroupPermission(appId: string, documentId: string, data: {
1468
+ groupType: string;
1469
+ groupId: string;
1470
+ permission: string;
1471
+ }): Promise<any>;
1472
+ revokeDocumentGroupPermission(appId: string, documentId: string, groupType: string, groupId: string): Promise<any>;
1473
+ listCollections(appId: string, params?: {
1474
+ limit?: number;
1475
+ cursor?: string;
1476
+ }): Promise<{
1477
+ items: any[];
1478
+ nextCursor?: string | null;
1479
+ }>;
1480
+ listAllCollections(appId: string, params?: {
1481
+ limit?: number;
1482
+ cursor?: string;
1483
+ }): Promise<{
1484
+ items: any[];
1485
+ nextCursor?: string | null;
1486
+ }>;
1487
+ createCollection(appId: string, data: {
1488
+ name: string;
1489
+ description?: string;
1490
+ initialMetadata?: Record<string, Record<string, unknown>>;
1491
+ }): Promise<any>;
1492
+ getCollection(appId: string, collectionId: string): Promise<any>;
1493
+ updateCollection(appId: string, collectionId: string, data: {
1494
+ name?: string;
1495
+ description?: string;
1496
+ }): Promise<any>;
1497
+ deleteCollection(appId: string, collectionId: string): Promise<any>;
1498
+ listCollectionDocuments(appId: string, collectionId: string, params?: {
1499
+ limit?: number;
1500
+ cursor?: string;
1501
+ }): Promise<{
1502
+ items: any[];
1503
+ nextCursor?: string | null;
1504
+ }>;
1505
+ addCollectionDocument(appId: string, collectionId: string, data: {
1506
+ documentId: string;
1507
+ }): Promise<any>;
1508
+ removeCollectionDocument(appId: string, collectionId: string, documentId: string): Promise<any>;
1509
+ listCollectionsForDocument(appId: string, documentId: string, params?: {
1510
+ limit?: number;
1511
+ cursor?: string;
1512
+ }): Promise<{
1513
+ items: any[];
1514
+ nextCursor?: string | null;
1515
+ }>;
1516
+ getCollectionAccess(appId: string, collectionId: string): Promise<any>;
1517
+ grantCollectionGroupPermission(appId: string, collectionId: string, data: {
1518
+ groupType: string;
1519
+ groupId: string;
1520
+ permission: string;
1521
+ }): Promise<any>;
1522
+ revokeCollectionGroupPermission(appId: string, collectionId: string, groupType: string, groupId: string): Promise<any>;
1523
+ addCollectionMember(appId: string, collectionId: string, data: {
1524
+ userId: string;
1525
+ permission: string;
1526
+ }): Promise<any>;
1527
+ removeCollectionMember(appId: string, collectionId: string, userId: string): Promise<any>;
1528
+ listCollectionTypeConfigs(appId: string): Promise<any[]>;
1529
+ getCollectionTypeConfig(appId: string, collectionType: string): Promise<any>;
1530
+ createCollectionTypeConfig(appId: string, data: {
1531
+ collectionType: string;
1532
+ ruleSetId?: string;
1533
+ metadataManifest?: any;
1534
+ }): Promise<any>;
1535
+ updateCollectionTypeConfig(appId: string, collectionType: string, data: {
1536
+ ruleSetId?: string | null;
1537
+ metadataManifest?: any;
1538
+ }, expectedModifiedAt?: string): Promise<any>;
1539
+ deleteCollectionTypeConfig(appId: string, collectionType: string): Promise<any>;
1540
+ /**
1541
+ * List all metadata category configs for an app. The route returns
1542
+ * `{ configs: [...] }`; unwrap to a bare array to match the other
1543
+ * `list*Configs` helpers.
1544
+ */
1545
+ listMetadataCategoryConfigs(appId: string): Promise<any[]>;
1546
+ getMetadataCategoryConfig(appId: string, resourceType: string, category: string): Promise<any>;
1547
+ /**
1548
+ * Create or replace a metadata category config (idempotent upsert via the
1549
+ * path-addressed PUT route). `resourceType` / `category` identify the config;
1550
+ * the body carries `schema` / `readRule` / `writeRule` / `description`.
1551
+ */
1552
+ upsertMetadataCategoryConfig(appId: string, resourceType: string, category: string, data: {
1553
+ schema: unknown;
1554
+ readRule?: string | null;
1555
+ writeRule?: string | null;
1556
+ description?: string | null;
1557
+ metadataManifest?: unknown;
1558
+ }): Promise<any>;
1559
+ /**
1560
+ * Delete a metadata category config (issue #1426, admin-gated route shipped
1561
+ * in #1364). Orphan semantics: the config row is hard-deleted; any stored
1562
+ * `ResourceMetadata` value rows for the category are left behind and become
1563
+ * unreachable (no query path from a category to its values). Delete the
1564
+ * values first if you need them gone — an orphaned value row can't be
1565
+ * removed through any surface once its config is gone. Returns
1566
+ * `{ resourceType, category, deleted }`; a missing config is a 404.
1567
+ */
1568
+ deleteMetadataCategoryConfig(appId: string, resourceType: string, category: string): Promise<{
1569
+ resourceType: string;
1570
+ category: string;
1571
+ deleted: boolean;
1572
+ }>;
1573
+ listRuleSets(appId: string, params?: {
1574
+ resourceType?: string;
1575
+ }): Promise<any[]>;
1576
+ createRuleSet(appId: string, data: {
1577
+ name: string;
1578
+ resourceType: string;
1579
+ rules: Record<string, any>;
1580
+ description?: string;
1581
+ }): Promise<any>;
1582
+ getRuleSet(appId: string, ruleSetId: string): Promise<any>;
1583
+ updateRuleSet(appId: string, ruleSetId: string, data: {
1584
+ name?: string;
1585
+ description?: string;
1586
+ rules?: Record<string, any>;
1587
+ }, expectedModifiedAt?: string): Promise<any>;
1588
+ deleteRuleSet(appId: string, ruleSetId: string): Promise<any>;
1589
+ getRuleSetSchema(appId: string): Promise<any>;
1590
+ getRuleSetResourceTypes(appId: string): Promise<{
1591
+ resourceTypes: string[];
1592
+ }>;
1593
+ testRuleSet(appId: string, ruleSetId: string, data: any): Promise<any>;
1594
+ debugRuleSet(appId: string, data: any): Promise<any>;
1595
+ listGroupTypeConfigs(appId: string): Promise<any[]>;
1596
+ getGroupTypeConfig(appId: string, groupType: string): Promise<any>;
1597
+ createGroupTypeConfig(appId: string, data: {
1598
+ groupType: string;
1599
+ ruleSetId?: string;
1600
+ autoAddCreator?: boolean;
1601
+ metadataManifest?: any;
1602
+ }): Promise<any>;
1603
+ updateGroupTypeConfig(appId: string, groupType: string, data: {
1604
+ ruleSetId?: string | null;
1605
+ autoAddCreator?: boolean;
1606
+ metadataManifest?: any;
1607
+ }, expectedModifiedAt?: string): Promise<any>;
1608
+ deleteGroupTypeConfig(appId: string, groupType: string): Promise<any>;
1609
+ exportDocumentState(appId: string, documentId: string): Promise<{
1610
+ state: string;
1611
+ byteLength: number;
1612
+ documentId: string;
1613
+ }>;
1614
+ importDocumentState(appId: string, documentId: string, stateBase64: string): Promise<any>;
1615
+ getDocument(appId: string, documentId: string): Promise<any>;
1616
+ /**
1617
+ * Introspect a document's Yjs schema (model names, per-model fields and
1618
+ * indexes). Backs `documents records models` and `documents records
1619
+ * describe`. Reuses the existing `GET documents/:id/schema` endpoint.
1620
+ */
1621
+ getDocumentSchema(appId: string, documentId: string): Promise<any>;
1622
+ /**
1623
+ * Query records in a document model (issue #1964 Phase 3). Reuses the
1624
+ * server-side `GET documents/:id/records/:model` endpoint, which runs
1625
+ * through the caller's document permission (reader+) or the app-admin arm.
1626
+ * Returns the unified `{ items, hasMore, nextCursor? }` envelope. The cursor
1627
+ * is an opaque token — feed `nextCursor` back as `cursor` for the next page.
1628
+ * The server also dual-emits a deprecated `cursor` alias (#1316); the
1629
+ * normalizer drops it so CLI output is already on `nextCursor` when #1982
1630
+ * removes it.
1631
+ */
1632
+ queryDocumentRecords(appId: string, documentId: string, modelName: string, queryOptions?: {
1633
+ filter?: Record<string, any>;
1634
+ limit?: number;
1635
+ cursor?: string;
1636
+ }): Promise<ListEnvelope>;
1637
+ /**
1638
+ * Count records in a document model (issue #1964 Phase 3). Returns `{ count }`.
1639
+ */
1640
+ countDocumentRecords(appId: string, documentId: string, modelName: string, queryOptions?: {
1641
+ filter?: Record<string, any>;
1642
+ }): Promise<{
1643
+ count: number;
1644
+ }>;
1645
+ /**
1646
+ * Aggregate records in a document model (issue #2437) — the documents twin
1647
+ * of {@link aggregateDatabaseRecords}. `POST documents/:id/records/:model/aggregate`
1648
+ * with `{ options: { operations, groupBy?, filter? } }`, answering `{ result }`
1649
+ * in the same shape as the database endpoint.
1650
+ *
1651
+ * `groupBy` takes plain field names only: StringSet facet grouping and
1652
+ * `{ field, contains }` membership grouping are database-only, which is why
1653
+ * this signature is narrower than the databases one.
1654
+ */
1655
+ aggregateDocumentRecords(appId: string, documentId: string, modelName: string, options: {
1656
+ operations: {
1657
+ type: string;
1658
+ field?: string;
1659
+ }[];
1660
+ groupBy?: string[];
1661
+ filter?: Record<string, any>;
1662
+ }): Promise<{
1663
+ result: unknown;
1664
+ }>;
1665
+ /**
1666
+ * Fetch platform-vocabulary document statistics (issue #1964 Phase 3):
1667
+ * record/model/blob counts, approximate size, and last-modified timestamp.
1668
+ */
1669
+ getDocumentStats(appId: string, documentId: string): Promise<any>;
1670
+ /**
1671
+ * Create or replace a record in a document model (issue #1964 Phase 4).
1672
+ * `POST documents/:id/records/:model` with `{ id, data, options? }` —
1673
+ * server-side write through the document facade (Yjs-first, CRDT-safe,
1674
+ * broadcasts to connected clients). Requires read-write+ on the document
1675
+ * or the app-admin arm. Returns `{ record }`.
1676
+ */
1677
+ saveDocumentRecord(appId: string, documentId: string, modelName: string, body: {
1678
+ id: string;
1679
+ data: Record<string, unknown>;
1680
+ options?: Record<string, unknown>;
1681
+ }): Promise<{
1682
+ record: unknown;
1683
+ }>;
1684
+ /**
1685
+ * Merge fields into an existing record (issue #1964 Phase 4).
1686
+ * `PATCH documents/:id/records/:model/:recordId` with `{ data, options? }`.
1687
+ * Returns `{ record }`.
1688
+ */
1689
+ patchDocumentRecord(appId: string, documentId: string, modelName: string, recordId: string, body: {
1690
+ data: Record<string, unknown>;
1691
+ options?: Record<string, unknown>;
1692
+ }): Promise<{
1693
+ record: unknown;
1694
+ }>;
1695
+ /**
1696
+ * Delete a record from a document model (issue #1964 Phase 4).
1697
+ * `DELETE documents/:id/records/:model/:recordId`. A missing record id is
1698
+ * a silent no-op per the facade contract. Returns `{ deleted: true }`.
1699
+ */
1700
+ deleteDocumentRecord(appId: string, documentId: string, modelName: string, recordId: string): Promise<{
1701
+ deleted: boolean;
1702
+ }>;
1703
+ /**
1704
+ * Apply an ordered multi-model create/patch/delete blob atomically (issue
1705
+ * #1964 Phase 4, wrapping the #1517 `bulkUpdate` facade). All-or-nothing:
1706
+ * a validation failure commits nothing. Returns the facade's
1707
+ * `{ applied, added, updated, deleted }`.
1708
+ */
1709
+ bulkDocumentRecords(appId: string, documentId: string, operations: Array<Record<string, unknown>>): Promise<{
1710
+ applied: number;
1711
+ added: Array<{
1712
+ model: string;
1713
+ id: string;
1714
+ }>;
1715
+ updated: Array<{
1716
+ model: string;
1717
+ id: string;
1718
+ }>;
1719
+ deleted: number;
1720
+ }>;
1721
+ createDocument(appId: string, data: {
1722
+ title: string;
1723
+ documentId?: string;
1724
+ tags?: string[];
1725
+ createdBy?: string;
1726
+ }): Promise<any>;
1727
+ listDocumentPermissions(appId: string, documentId: string): Promise<any[]>;
1728
+ grantDocumentPermission(appId: string, documentId: string, permissions: Array<{
1729
+ userId?: string;
1730
+ email?: string;
1731
+ permission: string;
1732
+ }>): Promise<any>;
1733
+ /**
1734
+ * Revoke a user's permission on a document. Mirrors the published client's
1735
+ * `documents.removePermission` wire behavior (`src/client/api/documentsApi.ts`):
1736
+ * a userId targets the path route `DELETE .../permissions/:userId`, while an
1737
+ * email targets the query-param route `DELETE .../permissions?email=...`
1738
+ * (unified email removal, #452). This duplication of the client's wire shape
1739
+ * is deliberate and parity-tested (issue #1964 amendment 8).
1740
+ */
1741
+ revokeDocumentPermission(appId: string, documentId: string, target: {
1742
+ userId?: string;
1743
+ email?: string;
1744
+ }): Promise<any>;
1745
+ getDocumentLinkAccess(appId: string, documentId: string): Promise<any>;
1746
+ setDocumentLinkAccess(appId: string, documentId: string, level: "reader" | "read-write"): Promise<any>;
1747
+ clearDocumentLinkAccess(appId: string, documentId: string): Promise<any>;
1748
+ listDocumentInvitations(appId: string, documentId: string): Promise<any[]>;
1749
+ listDocumentBlobs(appId: string, documentId: string): Promise<any[]>;
1750
+ downloadBlob(appId: string, documentId: string, blobId: string): Promise<Buffer>;
1751
+ uploadBlob(appId: string, documentId: string, blobId: string, data: Buffer, meta: {
1752
+ filename: string;
1753
+ contentType: string;
1754
+ sha256: string;
1755
+ }): Promise<any>;
1756
+ listDocumentAliases(appId: string, documentId: string): Promise<any[]>;
1757
+ setDocumentAlias(appId: string, aliasScope: string, aliasKey: string, documentId: string, ownerUserId?: string, mustNotExist?: boolean): Promise<any>;
1758
+ findUserByEmail(appId: string, email: string): Promise<any | null>;
1759
+ listAdminDocuments(appId: string, userId: string): Promise<any[]>;
1760
+ /**
1761
+ * Apply an ordered batch of record operations via `records/batch`.
1762
+ *
1763
+ * `atomic` (default off, matching the DatabaseDO) makes the whole batch
1764
+ * all-or-nothing: the DO rolls every write back at the first failed
1765
+ * operation and answers with that operation's status. `databases records
1766
+ * bulk` sends `atomic: true` so it matches the documents twin's
1767
+ * all-or-nothing contract (#2437); the CSV/import paths keep the default
1768
+ * partial-success behavior.
1769
+ */
1770
+ batchDatabaseRecords(appId: string, databaseId: string, operations: DatabaseBatchOperation[], options?: {
1771
+ atomic?: boolean;
1772
+ }): Promise<any>;
1773
+ deleteDatabaseRecord(appId: string, databaseId: string, modelName: string, id: string): Promise<any>;
1774
+ batchDeleteDatabaseRecords(appId: string, databaseId: string, operations: {
1775
+ op: "delete";
1776
+ modelName: string;
1777
+ id: string;
1778
+ }[]): Promise<any>;
1779
+ listDatabaseUniqueConstraints(appId: string, databaseId: string): Promise<any[]>;
1780
+ registerDatabaseUniqueConstraint(appId: string, databaseId: string, constraint: {
1781
+ modelName: string;
1782
+ constraintName: string;
1783
+ fields: string[];
1784
+ }): Promise<any>;
1785
+ listBlobBuckets(appId: string): Promise<{
1786
+ items: any[];
1787
+ }>;
1788
+ createBlobBucket(appId: string, payload: any): Promise<any>;
1789
+ getBlobBucket(appId: string, bucketIdOrKey: string): Promise<any>;
1790
+ updateBlobBucket(appId: string, bucketIdOrKey: string, payload: any): Promise<any>;
1791
+ deleteBlobBucket(appId: string, bucketIdOrKey: string): Promise<any>;
1792
+ listBucketBlobs(appId: string, bucketIdOrKey: string, params?: {
1793
+ cursor?: string;
1794
+ limit?: number;
1795
+ }): Promise<{
1796
+ items: any[];
1797
+ nextCursor?: string;
1798
+ hasMore?: boolean;
1799
+ /** @deprecated Alias of `nextCursor` (#1316). */
1800
+ cursor?: string;
1801
+ }>;
1802
+ uploadBucketBlob(appId: string, bucketIdOrKey: string, data: Buffer, meta: {
1803
+ filename: string;
1804
+ contentType: string;
1805
+ tags?: string[];
1806
+ }): Promise<any>;
1807
+ downloadBucketBlob(appId: string, bucketIdOrKey: string, blobId: string): Promise<Buffer>;
1808
+ deleteBucketBlob(appId: string, bucketIdOrKey: string, blobId: string): Promise<any>;
1809
+ deleteBucketBlobs(appId: string, bucketIdOrKey: string, blobIds: string[]): Promise<any>;
1810
+ getBucketBlobSignedUrl(appId: string, bucketIdOrKey: string, blobId: string, expiresInSeconds?: number): Promise<any>;
1811
+ getBucketBlobMetadata(appId: string, bucketIdOrKey: string, blobId: string): Promise<BlobInfo>;
1812
+ }
1813
+ export declare const apiClient: ApiClient;
1814
+ export {};