primitive-admin 1.0.61 → 1.0.63

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 (320) hide show
  1. package/README.md +125 -69
  2. package/assets/skill/skills/primitive-platform/SKILL.md +336 -37
  3. package/dist/bin/primitive.js +25 -14
  4. package/dist/bin/primitive.js.map +1 -1
  5. package/dist/src/commands/analytics.js +36 -16
  6. package/dist/src/commands/analytics.js.map +1 -1
  7. package/dist/src/commands/apps.js +52 -188
  8. package/dist/src/commands/apps.js.map +1 -1
  9. package/dist/src/commands/blob-buckets.js +13 -153
  10. package/dist/src/commands/blob-buckets.js.map +1 -1
  11. package/dist/src/commands/collection-type-configs.js +14 -100
  12. package/dist/src/commands/collection-type-configs.js.map +1 -1
  13. package/dist/src/commands/collections.js +47 -8
  14. package/dist/src/commands/collections.js.map +1 -1
  15. package/dist/src/commands/config.d.ts +46 -0
  16. package/dist/src/commands/config.js +479 -0
  17. package/dist/src/commands/config.js.map +1 -0
  18. package/dist/src/commands/connections.js +12 -7
  19. package/dist/src/commands/connections.js.map +1 -1
  20. package/dist/src/commands/cron-triggers.js +84 -176
  21. package/dist/src/commands/cron-triggers.js.map +1 -1
  22. package/dist/src/commands/database-type-configs.d.ts +2 -0
  23. package/dist/src/commands/database-type-configs.js +171 -0
  24. package/dist/src/commands/database-type-configs.js.map +1 -0
  25. package/dist/src/commands/database-types.js +4 -4
  26. package/dist/src/commands/database-types.js.map +1 -1
  27. package/dist/src/commands/databases.d.ts +63 -0
  28. package/dist/src/commands/databases.js +649 -87
  29. package/dist/src/commands/databases.js.map +1 -1
  30. package/dist/src/commands/documents.js +869 -12
  31. package/dist/src/commands/documents.js.map +1 -1
  32. package/dist/src/commands/email-templates.js +21 -128
  33. package/dist/src/commands/email-templates.js.map +1 -1
  34. package/dist/src/commands/env.d.ts +12 -1
  35. package/dist/src/commands/env.js +115 -26
  36. package/dist/src/commands/env.js.map +1 -1
  37. package/dist/src/commands/feature-flags.d.ts +14 -0
  38. package/dist/src/commands/feature-flags.js +116 -0
  39. package/dist/src/commands/feature-flags.js.map +1 -0
  40. package/dist/src/commands/group-type-configs.js +14 -109
  41. package/dist/src/commands/group-type-configs.js.map +1 -1
  42. package/dist/src/commands/init.d.ts +24 -1
  43. package/dist/src/commands/init.js +1194 -279
  44. package/dist/src/commands/init.js.map +1 -1
  45. package/dist/src/commands/integrations.js +166 -435
  46. package/dist/src/commands/integrations.js.map +1 -1
  47. package/dist/src/commands/metadata-category-configs.d.ts +12 -0
  48. package/dist/src/commands/metadata-category-configs.js +112 -0
  49. package/dist/src/commands/metadata-category-configs.js.map +1 -0
  50. package/dist/src/commands/metadata.js +33 -141
  51. package/dist/src/commands/metadata.js.map +1 -1
  52. package/dist/src/commands/prompts.js +206 -563
  53. package/dist/src/commands/prompts.js.map +1 -1
  54. package/dist/src/commands/rule-sets.d.ts +1 -1
  55. package/dist/src/commands/rule-sets.js +16 -132
  56. package/dist/src/commands/rule-sets.js.map +1 -1
  57. package/dist/src/commands/scripts.d.ts +10 -0
  58. package/dist/src/commands/scripts.js +203 -241
  59. package/dist/src/commands/scripts.js.map +1 -1
  60. package/dist/src/commands/sessions.js +17 -5
  61. package/dist/src/commands/sessions.js.map +1 -1
  62. package/dist/src/commands/sync-app-settings.d.ts +113 -70
  63. package/dist/src/commands/sync-app-settings.js +193 -242
  64. package/dist/src/commands/sync-app-settings.js.map +1 -1
  65. package/dist/src/commands/sync.d.ts +1904 -51
  66. package/dist/src/commands/sync.js +9468 -1790
  67. package/dist/src/commands/sync.js.map +1 -1
  68. package/dist/src/commands/tokens.js +8 -2
  69. package/dist/src/commands/tokens.js.map +1 -1
  70. package/dist/src/commands/users.js +92 -1
  71. package/dist/src/commands/users.js.map +1 -1
  72. package/dist/src/commands/vars.js +44 -58
  73. package/dist/src/commands/vars.js.map +1 -1
  74. package/dist/src/commands/webhooks.js +318 -156
  75. package/dist/src/commands/webhooks.js.map +1 -1
  76. package/dist/src/commands/workflows.d.ts +49 -12
  77. package/dist/src/commands/workflows.js +652 -1086
  78. package/dist/src/commands/workflows.js.map +1 -1
  79. package/dist/src/lib/access-rule-display.d.ts +21 -0
  80. package/dist/src/lib/access-rule-display.js +34 -0
  81. package/dist/src/lib/access-rule-display.js.map +1 -0
  82. package/dist/src/lib/api-client.d.ts +541 -61
  83. package/dist/src/lib/api-client.js +559 -102
  84. package/dist/src/lib/api-client.js.map +1 -1
  85. package/dist/src/lib/app-settings-descriptor.d.ts +180 -25
  86. package/dist/src/lib/app-settings-descriptor.js +403 -82
  87. package/dist/src/lib/app-settings-descriptor.js.map +1 -1
  88. package/dist/src/lib/canonical-json.d.ts +12 -0
  89. package/dist/src/lib/canonical-json.js +35 -0
  90. package/dist/src/lib/canonical-json.js.map +1 -0
  91. package/dist/src/lib/cli-manifest.d.ts +8 -0
  92. package/dist/src/lib/cli-manifest.js +1 -0
  93. package/dist/src/lib/cli-manifest.js.map +1 -1
  94. package/dist/src/lib/codegen-shared/generatedFiles.d.ts +6 -2
  95. package/dist/src/lib/codegen-shared/generatedFiles.js +9 -2
  96. package/dist/src/lib/codegen-shared/generatedFiles.js.map +1 -1
  97. package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.d.ts +6 -6
  98. package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.js +8 -8
  99. package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.js.map +1 -1
  100. package/dist/src/lib/config-object-descriptor.d.ts +127 -0
  101. package/dist/src/lib/config-object-descriptor.js +658 -0
  102. package/dist/src/lib/config-object-descriptor.js.map +1 -0
  103. package/dist/src/lib/config-payload.d.ts +85 -0
  104. package/dist/src/lib/config-payload.js +116 -0
  105. package/dist/src/lib/config-payload.js.map +1 -0
  106. package/dist/src/lib/config-surface.d.ts +130 -0
  107. package/dist/src/lib/config-surface.js +300 -0
  108. package/dist/src/lib/config-surface.js.map +1 -0
  109. package/dist/src/lib/credentials-store.d.ts +10 -0
  110. package/dist/src/lib/credentials-store.js +23 -0
  111. package/dist/src/lib/credentials-store.js.map +1 -1
  112. package/dist/src/lib/data-input.d.ts +23 -0
  113. package/dist/src/lib/data-input.js +50 -0
  114. package/dist/src/lib/data-input.js.map +1 -0
  115. package/dist/src/lib/db-codegen/dbTemplates.js +1 -1
  116. package/dist/src/lib/db-codegen/dbTemplates.js.map +1 -1
  117. package/dist/src/lib/db-codegen/dbTypeIR.d.ts +1 -1
  118. package/dist/src/lib/env-resolver-core.d.ts +187 -0
  119. package/dist/src/lib/env-resolver-core.js +325 -0
  120. package/dist/src/lib/env-resolver-core.js.map +1 -0
  121. package/dist/src/lib/env-resolver.d.ts +28 -6
  122. package/dist/src/lib/env-resolver.js +44 -32
  123. package/dist/src/lib/env-resolver.js.map +1 -1
  124. package/dist/src/lib/generated-allowlist.js +12 -0
  125. package/dist/src/lib/generated-allowlist.js.map +1 -1
  126. package/dist/src/lib/generated-config-surfaces.d.ts +682 -0
  127. package/dist/src/lib/generated-config-surfaces.js +4058 -0
  128. package/dist/src/lib/generated-config-surfaces.js.map +1 -0
  129. package/dist/src/lib/generated-template-lint.d.ts +212 -0
  130. package/dist/src/lib/generated-template-lint.js +624 -0
  131. package/dist/src/lib/generated-template-lint.js.map +1 -0
  132. package/dist/src/lib/init-adopt.d.ts +16 -0
  133. package/dist/src/lib/init-adopt.js +34 -0
  134. package/dist/src/lib/init-adopt.js.map +1 -0
  135. package/dist/src/lib/init-assets.d.ts +39 -0
  136. package/dist/src/lib/init-assets.js +97 -0
  137. package/dist/src/lib/init-assets.js.map +1 -0
  138. package/dist/src/lib/init-client-platforms.d.ts +14 -0
  139. package/dist/src/lib/init-client-platforms.js +71 -0
  140. package/dist/src/lib/init-client-platforms.js.map +1 -0
  141. package/dist/src/lib/init-config.d.ts +44 -5
  142. package/dist/src/lib/init-config.js +80 -7
  143. package/dist/src/lib/init-config.js.map +1 -1
  144. package/dist/src/lib/init-email-redirect-uris.d.ts +37 -0
  145. package/dist/src/lib/init-email-redirect-uris.js +46 -0
  146. package/dist/src/lib/init-email-redirect-uris.js.map +1 -0
  147. package/dist/src/lib/init-ios-links.d.ts +90 -0
  148. package/dist/src/lib/init-ios-links.js +218 -0
  149. package/dist/src/lib/init-ios-links.js.map +1 -0
  150. package/dist/src/lib/init-plan.d.ts +80 -0
  151. package/dist/src/lib/init-plan.js +95 -0
  152. package/dist/src/lib/init-plan.js.map +1 -0
  153. package/dist/src/lib/init-production-env.d.ts +48 -0
  154. package/dist/src/lib/init-production-env.js +59 -0
  155. package/dist/src/lib/init-production-env.js.map +1 -0
  156. package/dist/src/lib/init-schema.d.ts +74 -0
  157. package/dist/src/lib/init-schema.js +358 -0
  158. package/dist/src/lib/init-schema.js.map +1 -0
  159. package/dist/src/lib/init-xcode.d.ts +33 -0
  160. package/dist/src/lib/init-xcode.js +114 -0
  161. package/dist/src/lib/init-xcode.js.map +1 -0
  162. package/dist/src/lib/integration-request-config.d.ts +30 -0
  163. package/dist/src/lib/integration-request-config.js +145 -0
  164. package/dist/src/lib/integration-request-config.js.map +1 -0
  165. package/dist/src/lib/integration-selector.d.ts +42 -0
  166. package/dist/src/lib/integration-selector.js +46 -0
  167. package/dist/src/lib/integration-selector.js.map +1 -0
  168. package/dist/src/lib/local-state.d.ts +55 -0
  169. package/dist/src/lib/local-state.js +167 -0
  170. package/dist/src/lib/local-state.js.map +1 -0
  171. package/dist/src/lib/local-test-cases.d.ts +63 -0
  172. package/dist/src/lib/local-test-cases.js +135 -0
  173. package/dist/src/lib/local-test-cases.js.map +1 -0
  174. package/dist/src/lib/log-inspection.d.ts +568 -0
  175. package/dist/src/lib/log-inspection.js +639 -0
  176. package/dist/src/lib/log-inspection.js.map +1 -0
  177. package/dist/src/lib/migration-nag.d.ts +2 -2
  178. package/dist/src/lib/migration-nag.js +3 -3
  179. package/dist/src/lib/object-status-filter.d.ts +22 -0
  180. package/dist/src/lib/object-status-filter.js +45 -0
  181. package/dist/src/lib/object-status-filter.js.map +1 -0
  182. package/dist/src/lib/output.d.ts +24 -1
  183. package/dist/src/lib/output.js +42 -1
  184. package/dist/src/lib/output.js.map +1 -1
  185. package/dist/src/lib/package-manager.d.ts +140 -0
  186. package/dist/src/lib/package-manager.js +305 -0
  187. package/dist/src/lib/package-manager.js.map +1 -0
  188. package/dist/src/lib/paginate.d.ts +50 -0
  189. package/dist/src/lib/paginate.js +53 -0
  190. package/dist/src/lib/paginate.js.map +1 -1
  191. package/dist/src/lib/platform-owned.d.ts +29 -3
  192. package/dist/src/lib/platform-owned.js +42 -3
  193. package/dist/src/lib/platform-owned.js.map +1 -1
  194. package/dist/src/lib/project-config.d.ts +8 -0
  195. package/dist/src/lib/project-config.js +30 -5
  196. package/dist/src/lib/project-config.js.map +1 -1
  197. package/dist/src/lib/query-operators.d.ts +1 -1
  198. package/dist/src/lib/query-operators.js +1 -1
  199. package/dist/src/lib/record-filter.d.ts +18 -0
  200. package/dist/src/lib/record-filter.js +55 -0
  201. package/dist/src/lib/record-filter.js.map +1 -0
  202. package/dist/src/lib/resolve-init-dev-port.d.ts +56 -0
  203. package/dist/src/lib/resolve-init-dev-port.js +55 -0
  204. package/dist/src/lib/resolve-init-dev-port.js.map +1 -0
  205. package/dist/src/lib/resolve-init-server.d.ts +64 -0
  206. package/dist/src/lib/resolve-init-server.js +77 -0
  207. package/dist/src/lib/resolve-init-server.js.map +1 -0
  208. package/dist/src/lib/resolve-platform.d.ts +43 -14
  209. package/dist/src/lib/resolve-platform.js +74 -12
  210. package/dist/src/lib/resolve-platform.js.map +1 -1
  211. package/dist/src/lib/run-status.d.ts +19 -0
  212. package/dist/src/lib/run-status.generated.d.ts +39 -0
  213. package/dist/src/lib/run-status.generated.js +66 -0
  214. package/dist/src/lib/run-status.generated.js.map +1 -0
  215. package/dist/src/lib/run-status.js +19 -0
  216. package/dist/src/lib/run-status.js.map +1 -0
  217. package/dist/src/lib/server-text-normalization.d.ts +51 -0
  218. package/dist/src/lib/server-text-normalization.js +90 -0
  219. package/dist/src/lib/server-text-normalization.js.map +1 -0
  220. package/dist/src/lib/server-url.d.ts +22 -0
  221. package/dist/src/lib/server-url.js +33 -0
  222. package/dist/src/lib/server-url.js.map +1 -0
  223. package/dist/src/lib/signing-secret-status.d.ts +81 -0
  224. package/dist/src/lib/signing-secret-status.js +116 -0
  225. package/dist/src/lib/signing-secret-status.js.map +1 -0
  226. package/dist/src/lib/skill-installer.js +6 -3
  227. package/dist/src/lib/skill-installer.js.map +1 -1
  228. package/dist/src/lib/snapshots.d.ts +2 -2
  229. package/dist/src/lib/snapshots.js +2 -2
  230. package/dist/src/lib/swift-codegen/dbGenerator.d.ts +15 -2
  231. package/dist/src/lib/swift-codegen/dbGenerator.js +250 -18
  232. package/dist/src/lib/swift-codegen/dbGenerator.js.map +1 -1
  233. package/dist/src/lib/swift-codegen/generator.d.ts +11 -2
  234. package/dist/src/lib/swift-codegen/generator.js +181 -7
  235. package/dist/src/lib/swift-codegen/generator.js.map +1 -1
  236. package/dist/src/lib/swift-codegen/siblingSymbols.d.ts +7 -3
  237. package/dist/src/lib/swift-codegen/siblingSymbols.js +4 -1
  238. package/dist/src/lib/swift-codegen/siblingSymbols.js.map +1 -1
  239. package/dist/src/lib/sync-dir-selector.d.ts +21 -0
  240. package/dist/src/lib/sync-dir-selector.js +30 -0
  241. package/dist/src/lib/sync-dir-selector.js.map +1 -0
  242. package/dist/src/lib/sync-paths.d.ts +39 -0
  243. package/dist/src/lib/sync-paths.js +70 -2
  244. package/dist/src/lib/sync-paths.js.map +1 -1
  245. package/dist/src/lib/sync-resource-types.d.ts +138 -31
  246. package/dist/src/lib/sync-resource-types.js +241 -47
  247. package/dist/src/lib/sync-resource-types.js.map +1 -1
  248. package/dist/src/lib/sync-selectors.d.ts +95 -0
  249. package/dist/src/lib/sync-selectors.js +228 -0
  250. package/dist/src/lib/sync-selectors.js.map +1 -0
  251. package/dist/src/lib/template.d.ts +62 -4
  252. package/dist/src/lib/template.js +147 -39
  253. package/dist/src/lib/template.js.map +1 -1
  254. package/dist/src/lib/test-case-file-names.d.ts +40 -0
  255. package/dist/src/lib/test-case-file-names.js +91 -0
  256. package/dist/src/lib/test-case-file-names.js.map +1 -0
  257. package/dist/src/lib/test-case-keys.d.ts +29 -0
  258. package/dist/src/lib/test-case-keys.js +55 -0
  259. package/dist/src/lib/test-case-keys.js.map +1 -0
  260. package/dist/src/lib/test-case-variables.d.ts +15 -0
  261. package/dist/src/lib/test-case-variables.js +29 -0
  262. package/dist/src/lib/test-case-variables.js.map +1 -0
  263. package/dist/src/lib/toml-database-config.d.ts +4 -4
  264. package/dist/src/lib/toml-database-config.js +27 -34
  265. package/dist/src/lib/toml-database-config.js.map +1 -1
  266. package/dist/src/lib/toml-metadata-config.d.ts +9 -5
  267. package/dist/src/lib/toml-metadata-config.js +40 -45
  268. package/dist/src/lib/toml-metadata-config.js.map +1 -1
  269. package/dist/src/lib/toml-native-form.d.ts +1 -1
  270. package/dist/src/lib/toml-native-form.js +1 -1
  271. package/dist/src/lib/toml-params-validator.d.ts +1 -1
  272. package/dist/src/lib/toml-params-validator.js +1 -1
  273. package/dist/src/lib/toml-scalar-edit.d.ts +43 -0
  274. package/dist/src/lib/toml-scalar-edit.js +283 -0
  275. package/dist/src/lib/toml-scalar-edit.js.map +1 -0
  276. package/dist/src/lib/user-selector.d.ts +24 -0
  277. package/dist/src/lib/user-selector.js +33 -0
  278. package/dist/src/lib/user-selector.js.map +1 -0
  279. package/dist/src/lib/version-check.d.ts +25 -0
  280. package/dist/src/lib/version-check.js +77 -8
  281. package/dist/src/lib/version-check.js.map +1 -1
  282. package/dist/src/lib/watch.d.ts +121 -0
  283. package/dist/src/lib/watch.js +169 -0
  284. package/dist/src/lib/watch.js.map +1 -0
  285. package/dist/src/lib/web-url.d.ts +40 -0
  286. package/dist/src/lib/web-url.js +76 -0
  287. package/dist/src/lib/web-url.js.map +1 -0
  288. package/dist/src/lib/workflow-apply.d.ts +69 -45
  289. package/dist/src/lib/workflow-apply.js +99 -72
  290. package/dist/src/lib/workflow-apply.js.map +1 -1
  291. package/dist/src/lib/workflow-codegen/generator.js +4 -4
  292. package/dist/src/lib/workflow-codegen/generator.js.map +1 -1
  293. package/dist/src/lib/workflow-codegen/invokerIR.d.ts +11 -0
  294. package/dist/src/lib/workflow-codegen/invokerIR.js +5 -0
  295. package/dist/src/lib/workflow-codegen/invokerIR.js.map +1 -1
  296. package/dist/src/lib/workflow-config-apply.d.ts +70 -0
  297. package/dist/src/lib/workflow-config-apply.js +137 -0
  298. package/dist/src/lib/workflow-config-apply.js.map +1 -0
  299. package/dist/src/lib/workflow-config-sidecar.d.ts +63 -0
  300. package/dist/src/lib/workflow-config-sidecar.js +96 -0
  301. package/dist/src/lib/workflow-config-sidecar.js.map +1 -0
  302. package/dist/src/lib/workflow-defaults.d.ts +29 -0
  303. package/dist/src/lib/workflow-defaults.js +41 -0
  304. package/dist/src/lib/workflow-defaults.js.map +1 -0
  305. package/dist/src/lib/workflow-include-preserve.d.ts +76 -0
  306. package/dist/src/lib/workflow-include-preserve.js +286 -0
  307. package/dist/src/lib/workflow-include-preserve.js.map +1 -0
  308. package/dist/src/lib/workflow-payload.d.ts +31 -20
  309. package/dist/src/lib/workflow-payload.js +100 -110
  310. package/dist/src/lib/workflow-payload.js.map +1 -1
  311. package/dist/src/lib/workflow-toml-validator.d.ts +37 -16
  312. package/dist/src/lib/workflow-toml-validator.js +141 -16
  313. package/dist/src/lib/workflow-toml-validator.js.map +1 -1
  314. package/dist/src/types/index.d.ts +78 -22
  315. package/dist/src/validators.d.ts +7 -7
  316. package/dist/src/validators.js +6 -6
  317. package/package.json +11 -6
  318. package/dist/src/commands/settings.d.ts +0 -15
  319. package/dist/src/commands/settings.js +0 -102
  320. package/dist/src/commands/settings.js.map +0 -1
@@ -1,3 +1,4 @@
1
+ import { type ListEnvelope } from "./paginate.js";
1
2
  /**
2
3
  * Metadata for a single bucket blob, as returned by the metadata endpoint
3
4
  * `GET blob-buckets/:bucketId/blobs/:blobId/metadata`. Mirrors the published
@@ -279,6 +280,14 @@ interface AnalyticsEventsGroupedResponse {
279
280
  rows: AnalyticsGroupedRow[];
280
281
  _timing: AnalyticsTiming;
281
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
+ }
282
291
  interface AnalyticsErrorGroupRow {
283
292
  fingerprint: string;
284
293
  normalized_title: string;
@@ -289,12 +298,67 @@ interface AnalyticsErrorGroupRow {
289
298
  day: string;
290
299
  count: number;
291
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;
292
307
  }
293
308
  interface AnalyticsErrorsGroupsResponse {
294
309
  window_days: number;
295
310
  rows: AnalyticsErrorGroupRow[];
296
311
  _timing: AnalyticsTiming;
297
312
  }
313
+ /**
314
+ * What a `DELETE` on a status-carrying object answers (#2887, #2907).
315
+ *
316
+ * The plain call archives and `?hard=true` destroys, and the envelope says
317
+ * which happened. Four of the five methods below were declared `Promise<void>`
318
+ * while returning this at runtime, so `primitive <noun> archive --json` printed
319
+ * a value TypeScript believed did not exist. The fields are optional because
320
+ * the cron route answers the shorter `{ archived: true }` — no `success`, and
321
+ * no key — which is why the archive commands identify the object by the id the
322
+ * operator passed rather than by anything the envelope carries.
323
+ */
324
+ export interface ArchiveEnvelope {
325
+ success?: boolean;
326
+ hardDeleted?: boolean;
327
+ archived?: boolean;
328
+ [key: string]: unknown;
329
+ }
330
+ /**
331
+ * Body accepted by integration create and update (#2631).
332
+ *
333
+ * `accessRule` is the CEL expression gating who may invoke the integration
334
+ * through the proxy. The server REQUIRES it on create; on update, `null` or
335
+ * `""` clears it, and a cleared rule denies every non-admin call.
336
+ */
337
+ export interface IntegrationWritePayload {
338
+ integrationKey?: string;
339
+ displayName?: string;
340
+ description?: string | null;
341
+ requestConfig?: any;
342
+ timeoutMs?: number;
343
+ status?: string;
344
+ accessRule?: string | null;
345
+ }
346
+ /**
347
+ * Integration detail response. `accessRule` is only on the detail — the list
348
+ * summary does not carry it (#2631).
349
+ */
350
+ export interface IntegrationDetail {
351
+ integrationId: string;
352
+ integrationKey: string;
353
+ displayName?: string;
354
+ description?: string | null;
355
+ status?: string;
356
+ timeoutMs?: number;
357
+ requestConfig?: any;
358
+ accessRule?: string | null;
359
+ modifiedAt?: string;
360
+ [key: string]: any;
361
+ }
298
362
  interface AnalyticsIntegrationMetric {
299
363
  integrationKey: string;
300
364
  invocations: number;
@@ -335,7 +399,7 @@ interface TopPromptsResponse {
335
399
  _timing: AnalyticsTiming;
336
400
  }
337
401
  /**
338
- * One operation in an `admin-data/batch` request. Mirrors the wire shape the
402
+ * One operation in a `records/batch` request. Mirrors the wire shape the
339
403
  * DatabaseDO expects (`databases-controller.ts`): `{ op, modelName, id, data }`.
340
404
  * `data` is required for `save`/`patch` and omitted for `delete`.
341
405
  */
@@ -344,7 +408,48 @@ export interface DatabaseBatchOperation {
344
408
  modelName: string;
345
409
  id: string;
346
410
  data?: any;
411
+ /**
412
+ * Strict create: the DatabaseDO fails the op with a 409 `ALREADY_EXISTS` when
413
+ * the id is already present, instead of `save`'s upsert merge. Checked inside
414
+ * the batch transaction, so under `atomic` it rolls the whole batch back.
415
+ */
416
+ ifNotExists?: boolean;
417
+ /**
418
+ * Per-op guard evaluated inside the batch transaction — a mismatch is a 409
419
+ * `CONDITION_NOT_MET`, and under `atomic` it rolls the whole batch back. This
420
+ * is what the documents surface calls a `precondition`.
421
+ */
422
+ condition?: Record<string, any>;
347
423
  }
424
+ /**
425
+ * Normalize a `databases operations execute` result to the CLI's one list
426
+ * envelope — but only when the result is a Durable Object query page
427
+ * (issue #2440).
428
+ *
429
+ * A registered operation is a list only sometimes. Of the shapes the server's
430
+ * operation dispatch can return, exactly two carry a top-level `data` array: a
431
+ * bare `query` and a `pipeline` whose `returnField` names a query step. A
432
+ * `count` (`{ count }`), an `aggregate` (`{ result }`), a mutation
433
+ * (`{ results }`), an `applyToQuery` (`{ matched, affected, failed, … }`) and a
434
+ * `returnField: "all"` pipeline (`{ steps: { … } }`) do not, so blanket
435
+ * normalization would corrupt them. This helper therefore tests the shape
436
+ * first and passes everything else through byte-for-byte — including the
437
+ * nested steps of a `returnField: "all"` pipeline, which are operation-defined
438
+ * objects the CLI must not reach into.
439
+ *
440
+ * Deliberately narrow, not a general-purpose predicate: the contract is
441
+ * specifically "an operations-execute result may be a DO query page".
442
+ * `executeDatabaseOperation()` is the only caller.
443
+ *
444
+ * The conversion itself is delegated to `normalizeCliListEnvelope()` so cursor
445
+ * handling, `prevCursor` dropping and `hasMore` derivation have exactly one
446
+ * implementation. That helper throws on an unrecognized shape — correct when
447
+ * the payload is supposed to be a list, wrong here, where the payload is the
448
+ * caller's own result — which is why the shape test has to run first. `_timing`
449
+ * (`--timing`) is re-attached afterwards, since it rides alongside the envelope
450
+ * rather than inside it.
451
+ */
452
+ export declare function normalizeDatabaseOperationResult(raw: unknown): unknown;
348
453
  export declare class ApiClient {
349
454
  private credentials;
350
455
  constructor();
@@ -393,6 +498,27 @@ export declare class ApiClient {
393
498
  nextCursor?: string | null;
394
499
  }>;
395
500
  removeUser(appId: string, userId: string): Promise<void>;
501
+ /**
502
+ * #2803 — take a user's access away, or give it back. Distinct from
503
+ * `removeUser`, which detaches the membership: this blocks the person's auth
504
+ * in the app, revokes their sessions and tokens, and is reversible. Both
505
+ * routes already existed; nothing on the CLI reached them.
506
+ */
507
+ setUserAvailability(appId: string, userId: string, action: "enable" | "disable"): Promise<void>;
508
+ /**
509
+ * #2803 — the platform's feature flags. A server-owned admin toggle with a
510
+ * console but, until now, no CLI: the same "one control, both surfaces" rule
511
+ * the carrying types get.
512
+ */
513
+ listFeatureFlags(): Promise<any>;
514
+ /**
515
+ * The flag itself, not the `{ flag }` envelope the route answers with —
516
+ * `feature-flags get` prints the key, the enabled state and the per-app
517
+ * overrides, and reading them off the envelope printed a blank row.
518
+ */
519
+ getFeatureFlag(flagKey: string): Promise<any>;
520
+ /** Same envelope, same unwrap: `enable`/`disable` print the updated flag. */
521
+ setFeatureFlagEnabled(flagKey: string, enabled: boolean): Promise<any>;
396
522
  updateUserRole(appId: string, userId: string, role: "admin" | "member"): Promise<any>;
397
523
  transferOwnership(appId: string, newOwnerEmail: string): Promise<void>;
398
524
  transferAdminOwnership(appId: string, adminId: string): Promise<any>;
@@ -456,10 +582,27 @@ export declare class ApiClient {
456
582
  items: any[];
457
583
  nextCursor?: string | null;
458
584
  }>;
459
- getIntegration(appId: string, integrationId: string): Promise<any>;
460
- createIntegration(appId: string, payload: any): Promise<any>;
461
- updateIntegration(appId: string, integrationId: string, payload: any, expectedModifiedAt?: string): Promise<any>;
462
- deleteIntegration(appId: string, integrationId: string, hard?: boolean): Promise<void>;
585
+ /** Integration detail (#2631: `accessRule` is on the detail, not the list summary). */
586
+ getIntegration(appId: string, integrationId: string): Promise<IntegrationDetail>;
587
+ /**
588
+ * An integration's named configs. Test cases pin a config by NAME so the
589
+ * sidecar is portable across apps (#2769); this is the map pull and push
590
+ * resolve that name through, the same way prompts/workflows/scripts do.
591
+ */
592
+ listIntegrationConfigs(appId: string, integrationId: string): Promise<{
593
+ items: any[];
594
+ }>;
595
+ createIntegration(appId: string, payload: IntegrationWritePayload): Promise<any>;
596
+ updateIntegration(appId: string, integrationId: string, payload: IntegrationWritePayload, expectedModifiedAt?: string): Promise<any>;
597
+ /**
598
+ * Delete an integration. Archives it by default; `{ hard: true }` destroys
599
+ * the row instead, which is what `config push --prune` passes (#2803) so a
600
+ * pruned integration stops holding its key. The positional boolean is still
601
+ * accepted for the existing callers.
602
+ */
603
+ deleteIntegration(appId: string, integrationId: string, hard?: boolean | {
604
+ hard?: boolean;
605
+ }): Promise<ArchiveEnvelope>;
463
606
  testIntegration(appId: string, integrationId: string, payload: any): Promise<any>;
464
607
  listIntegrationLogs(appId: string, integrationId: string, params?: {
465
608
  limit?: number;
@@ -471,14 +614,6 @@ export declare class ApiClient {
471
614
  listWorkflowRunIntegrationLogs(appId: string, runId: string, params?: {
472
615
  limit?: number;
473
616
  }): Promise<any[]>;
474
- listIntegrationSecrets(appId: string, integrationId: string, params?: {
475
- limit?: number;
476
- }): Promise<any[]>;
477
- addIntegrationSecret(appId: string, integrationId: string, payload: {
478
- secretData: any;
479
- secretSummary?: string;
480
- }): Promise<any>;
481
- archiveIntegrationSecret(appId: string, integrationId: string, secretId: string): Promise<any>;
482
617
  listAppSecrets(appId: string): Promise<any[]>;
483
618
  createAppSecret(appId: string, payload: {
484
619
  key: string;
@@ -513,13 +648,38 @@ export declare class ApiClient {
513
648
  getWebhook(appId: string, webhookId: string): Promise<any>;
514
649
  createWebhook(appId: string, payload: any): Promise<any>;
515
650
  updateWebhook(appId: string, webhookId: string, payload: any, expectedModifiedAt?: string): Promise<any>;
516
- deleteWebhook(appId: string, webhookId: string): Promise<void>;
651
+ /**
652
+ * Delete a webhook. Archives it by default; `hard` hard-deletes the row
653
+ * instead (#2232), which is what frees a slot under the per-app webhook cap
654
+ * and releases the webhook key for reuse. Same `?hard=true` verb the admin
655
+ * integrations delete uses.
656
+ */
657
+ deleteWebhook(appId: string, webhookId: string, options?: {
658
+ hard?: boolean;
659
+ }): Promise<ArchiveEnvelope>;
660
+ /**
661
+ * #2803 — the operational verb pair for a webhook. It posts to the
662
+ * enable/disable route rather than PATCHing `status`, which is server-owned
663
+ * and refused on every configuration write path.
664
+ */
665
+ setWebhookAvailability(appId: string, webhookId: string, action: "enable" | "disable"): Promise<any>;
666
+ /** #2803 — the operational verb pair for a prompt (admin API). */
667
+ setPromptAvailability(appId: string, promptId: string, action: "enable" | "disable"): Promise<any>;
668
+ /** #2803 — the operational verb pair for an integration (admin API). */
669
+ setIntegrationAvailability(appId: string, integrationId: string, action: "enable" | "disable"): Promise<any>;
517
670
  rotateWebhookSecret(appId: string, webhookId: string, payload: {
518
671
  signingSecret: string;
519
672
  }): Promise<any>;
520
673
  listWebhookEvents(appId: string, webhookId: string, params?: {
521
674
  limit?: number;
522
- }): Promise<any>;
675
+ cursor?: string;
676
+ }): Promise<{
677
+ items: any[];
678
+ hasMore?: boolean;
679
+ nextCursor?: string | null;
680
+ /** @deprecated Alias of `nextCursor` (#1316). */
681
+ cursor?: string | null;
682
+ }>;
523
683
  /**
524
684
  * List the live connections the server believes exist for exactly one of a
525
685
  * document, user, or database. Read-only inspection over admin-api. Rows are
@@ -546,6 +706,19 @@ export declare class ApiClient {
546
706
  nextCursor?: string | null;
547
707
  }>;
548
708
  testWebhook(appId: string, webhookId: string, payload?: any): Promise<any>;
709
+ /**
710
+ * Run a webhook's configured verifier over headers and a body captured from
711
+ * a real delivery, and report whether that signature checks out (#2445).
712
+ *
713
+ * `headers` is sent as ordered `[name, value]` pairs so a capture carrying a
714
+ * field name on more than one line survives the round trip. Nothing is
715
+ * delivered: no delivery record, no workflow run.
716
+ */
717
+ verifyWebhook(appId: string, webhookId: string, payload: {
718
+ headers: Array<[string, string]>;
719
+ rawBody?: string;
720
+ bodyBase64?: string;
721
+ }): Promise<any>;
549
722
  listLocks(appId: string): Promise<{
550
723
  locks: any[];
551
724
  }>;
@@ -558,9 +731,17 @@ export declare class ApiClient {
558
731
  getCronTrigger(appId: string, triggerId: string): Promise<any>;
559
732
  createCronTrigger(appId: string, payload: any): Promise<any>;
560
733
  updateCronTrigger(appId: string, triggerId: string, payload: any): Promise<any>;
561
- deleteCronTrigger(appId: string, triggerId: string): Promise<any>;
562
- pauseCronTrigger(appId: string, triggerId: string): Promise<any>;
563
- resumeCronTrigger(appId: string, triggerId: string): Promise<any>;
734
+ /**
735
+ * Retire a cron trigger. The default soft-deletes (writes the `archived`
736
+ * tombstone); `{ hard: true }` destroys the row, which is what
737
+ * `config push --prune` passes (#2803) so a pruned trigger stops consuming
738
+ * the per-app cap and holding its key.
739
+ */
740
+ deleteCronTrigger(appId: string, triggerId: string, options?: {
741
+ hard?: boolean;
742
+ }): Promise<ArchiveEnvelope>;
743
+ disableCronTrigger(appId: string, triggerId: string): Promise<any>;
744
+ enableCronTrigger(appId: string, triggerId: string): Promise<any>;
564
745
  testCronTrigger(appId: string, triggerId: string): Promise<any>;
565
746
  listIterations(appId: string): Promise<{
566
747
  items: any[];
@@ -601,6 +782,16 @@ export declare class ApiClient {
601
782
  category: string;
602
783
  deleted: boolean;
603
784
  }>;
785
+ /**
786
+ * Reverse-resolve a resource by a category's unique metadata value (issue
787
+ * #2137). A miss is a success with `resourceId: null`, never an error. The
788
+ * CLI authenticates as a console admin, so the app-level owner/admin bypass
789
+ * skips readRule evaluation.
790
+ */
791
+ resolveResourceMetadata(appId: string, resourceType: string, category: string, key: string, value: string): Promise<{
792
+ resourceId: string | null;
793
+ resourceType?: string;
794
+ }>;
604
795
  listPrompts(appId: string, params?: {
605
796
  status?: string;
606
797
  limit?: number;
@@ -612,7 +803,13 @@ export declare class ApiClient {
612
803
  getPrompt(appId: string, promptId: string): Promise<any>;
613
804
  createPrompt(appId: string, payload: any): Promise<any>;
614
805
  updatePrompt(appId: string, promptId: string, payload: any, expectedModifiedAt?: string): Promise<any>;
615
- deletePrompt(appId: string, promptId: string, hard?: boolean): Promise<void>;
806
+ /**
807
+ * Retire a prompt, or destroy it.
808
+ *
809
+ * `hard` was always sent by both first-party clients and always ignored by
810
+ * the server; #2887 made it mean something — the plain call now archives.
811
+ */
812
+ deletePrompt(appId: string, promptId: string, hard?: boolean): Promise<ArchiveEnvelope>;
616
813
  executePrompt(appId: string, promptId: string, payload: {
617
814
  variables: Record<string, any>;
618
815
  modelOverride?: string;
@@ -659,7 +856,21 @@ export declare class ApiClient {
659
856
  * workflows pick up the new body on their next run with no fan-out. The
660
857
  * config name is unique per script, so we mint a timestamped name.
661
858
  */
662
- pushScriptBody(appId: string, scriptId: string, body: string): Promise<any>;
859
+ pushScriptBody(appId: string, scriptId: string, body: string,
860
+ /**
861
+ * The active state the caller believes holds right now (#2731 B10).
862
+ * Creating an inactive config races nothing, so the guard sits on the
863
+ * ACTIVATION step: if the active config has moved since the caller read it,
864
+ * the server rejects with a 409 instead of overwriting a concurrent script
865
+ * change. It takes BOTH halves of "what is active", because a config's body
866
+ * can be edited in place without the active id changing — the id alone
867
+ * would let such an edit through. Omitted (e.g. `--force`) means activate
868
+ * unconditionally.
869
+ */
870
+ expectedActive?: {
871
+ configId?: string;
872
+ modifiedAt?: string;
873
+ }): Promise<any>;
663
874
  /**
664
875
  * Delete a script header (cascades its configs). `force` overrides the
665
876
  * server's guard against deleting a script that an active workflow still
@@ -676,12 +887,22 @@ export declare class ApiClient {
676
887
  activeConfigId: string | null;
677
888
  activeConfigName: string | null;
678
889
  }>;
679
- listTestCases(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string): Promise<{
890
+ /**
891
+ * One page of a block's test cases. The endpoint paginates (default 50, cap
892
+ * 100) and reports `nextCursor`; callers that reconcile the sync tree must
893
+ * drain every page before deleting or classifying anything (#2769).
894
+ */
895
+ listTestCases(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, params?: {
896
+ limit?: number;
897
+ cursor?: string;
898
+ }): Promise<{
680
899
  items: any[];
900
+ nextCursor?: string;
681
901
  }>;
682
902
  getTestCase(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, testCaseId: string): Promise<any>;
683
903
  createTestCase(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, payload: {
684
904
  name: string;
905
+ description?: string | null;
685
906
  inputVariables: Record<string, any>;
686
907
  expectedOutputPattern?: string;
687
908
  expectedOutputContains?: string[];
@@ -689,9 +910,12 @@ export declare class ApiClient {
689
910
  configId?: string;
690
911
  evaluatorPromptId?: string;
691
912
  evaluatorConfigId?: string;
913
+ /** The sidecar's file name — the case's identity (#2896). */
914
+ key?: string;
692
915
  }): Promise<any>;
693
916
  updateTestCase(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, testCaseId: string, payload: {
694
917
  name?: string;
918
+ description?: string | null;
695
919
  inputVariables?: Record<string, any>;
696
920
  expectedOutputPattern?: string | null;
697
921
  expectedOutputContains?: string[] | null;
@@ -699,6 +923,8 @@ export declare class ApiClient {
699
923
  configId?: string | null;
700
924
  evaluatorPromptId?: string | null;
701
925
  evaluatorConfigId?: string | null;
926
+ /** The sidecar's file name, on a create-or-rename backfill (#2896). */
927
+ key?: string;
702
928
  }): Promise<any>;
703
929
  deleteTestCase(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, testCaseId: string): Promise<void>;
704
930
  listTestCaseAttachments(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, testCaseId: string): Promise<{
@@ -754,9 +980,26 @@ export declare class ApiClient {
754
980
  getWorkflow(appId: string, workflowId: string): Promise<any>;
755
981
  createWorkflow(appId: string, payload: any): Promise<any>;
756
982
  updateWorkflow(appId: string, workflowId: string, payload: any, expectedModifiedAt?: string): Promise<any>;
757
- deleteWorkflow(appId: string, workflowId: string): Promise<void>;
983
+ /**
984
+ * Retire a workflow, or destroy it (#2887).
985
+ *
986
+ * The plain call ARCHIVES: the definition row stays, so its runs, revisions
987
+ * and test cases keep resolving. `{ hard: true }` performs the full cascade
988
+ * and is what releases the `workflowKey` — the flag `config push --prune`
989
+ * sends, for the same reason it sends it for webhooks and integrations.
990
+ */
991
+ deleteWorkflow(appId: string, workflowId: string, options?: {
992
+ hard?: boolean;
993
+ }): Promise<ArchiveEnvelope>;
994
+ /**
995
+ * #2645 criterion 9 — the operational toggle. Deliberately NOT the config
996
+ * PATCH: `config push` owns every configuration field, and taking a workflow
997
+ * out of service must not touch one, or an operator's action would show up as
998
+ * drift against the repo. Same route shape as `cron-triggers pause|resume`.
999
+ */
1000
+ disableWorkflow(appId: string, workflowId: string): Promise<any>;
1001
+ enableWorkflow(appId: string, workflowId: string): Promise<any>;
758
1002
  updateWorkflowDraft(appId: string, workflowId: string, payload: any): Promise<any>;
759
- publishWorkflow(appId: string, workflowId: string): Promise<any>;
760
1003
  previewWorkflow(appId: string, workflowId: string, payload: {
761
1004
  rootInput?: object;
762
1005
  meta?: object;
@@ -777,23 +1020,47 @@ export declare class ApiClient {
777
1020
  limit?: number;
778
1021
  cursor?: string;
779
1022
  forward?: boolean;
1023
+ follow?: boolean;
1024
+ after?: string;
1025
+ }): Promise<{
1026
+ items: any[];
1027
+ hasMore?: boolean;
1028
+ nextCursor?: string | null;
1029
+ /** @deprecated Alias of `nextCursor` (#1316). */
1030
+ cursor?: string | null;
1031
+ /** #1969 — opaque follow checkpoint; present on `follow=true` responses. */
1032
+ resumeAfter?: string;
1033
+ /**
1034
+ * #2237 — index rows the server examined for this request. Filtered reads
1035
+ * only, and only on a server new enough to report it; `undefined`
1036
+ * otherwise, which callers must treat as "unknown", not zero.
1037
+ */
1038
+ scanned?: number;
1039
+ }>;
1040
+ /**
1041
+ * Workflow runs started by one app user, across every workflow (#1967).
1042
+ * Backed by `GET /admin/api/apps/{appId}/users/{userId}/workflow-runs`,
1043
+ * which resolves the app user before querying the `runsByUser` index.
1044
+ */
1045
+ listUserWorkflowRuns(appId: string, userId: string, params?: {
1046
+ status?: string;
1047
+ limit?: number;
1048
+ cursor?: string;
1049
+ forward?: boolean;
1050
+ workflowId?: string;
780
1051
  }): Promise<{
781
1052
  items: any[];
1053
+ hasMore?: boolean;
782
1054
  nextCursor?: string | null;
783
1055
  /** @deprecated Alias of `nextCursor` (#1316). */
784
1056
  cursor?: string | null;
1057
+ /** #2237 — index rows examined; filtered reads only, `undefined` if unknown. */
1058
+ scanned?: number;
785
1059
  }>;
786
1060
  getWorkflowRunStatus(appId: string, workflowId: string, runId: string): Promise<any>;
787
1061
  getWorkflowStepRuns(appId: string, workflowId: string, runId: string): Promise<{
788
1062
  items: any[];
789
1063
  }>;
790
- getWorkflowAnalytics(appId: string, params?: {
791
- windowDays?: number;
792
- }): Promise<any>;
793
- getTopWorkflows(appId: string, params?: {
794
- windowDays?: number;
795
- limit?: number;
796
- }): Promise<any>;
797
1064
  listWorkflowConfigs(appId: string, workflowId: string): Promise<{
798
1065
  items: any[];
799
1066
  }>;
@@ -906,28 +1173,6 @@ export declare class ApiClient {
906
1173
  createIntegrationCatalogItem(payload: any): Promise<any>;
907
1174
  updateIntegrationCatalogItem(catalogId: string, payload: any): Promise<any>;
908
1175
  deleteIntegrationCatalogItem(catalogId: string): Promise<void>;
909
- listLlmModels(provider?: string): Promise<{
910
- models: Array<{
911
- id: string;
912
- name: string;
913
- context_length?: number;
914
- pricing?: any;
915
- }>;
916
- defaultModel?: string;
917
- cachedAt?: string;
918
- }>;
919
- generatePrompt(payload: {
920
- description: string;
921
- generateOutputSchema?: boolean;
922
- }): Promise<any>;
923
- generateEvaluator(payload: {
924
- appId: string;
925
- promptId: string;
926
- }): Promise<any>;
927
- generateWorkflowEvaluator(payload: {
928
- appId: string;
929
- workflowId: string;
930
- }): Promise<any>;
931
1176
  startBatchTests(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, payload?: {
932
1177
  comparisonGroup?: string;
933
1178
  overrideConfigId?: string;
@@ -968,11 +1213,20 @@ export declare class ApiClient {
968
1213
  templates: EmailTemplateSummary[];
969
1214
  }>;
970
1215
  getEmailTemplate(appId: string, emailType: string): Promise<EmailTemplateDetail>;
1216
+ /**
1217
+ * Create or replace an email-template override.
1218
+ *
1219
+ * `expectedModifiedAt` is the optimistic-concurrency token every sibling
1220
+ * config endpoint already takes (#2731 B10). Optional and additive: when
1221
+ * omitted the write is unconditional, which is how `--force` and every
1222
+ * pre-existing caller keep working; when supplied and stale, the server
1223
+ * answers 409 rather than silently overwriting a concurrent edit.
1224
+ */
971
1225
  upsertEmailTemplate(appId: string, emailType: string, payload: {
972
1226
  subject: string;
973
1227
  htmlBody: string;
974
1228
  textBody: string;
975
- }): Promise<EmailTemplateUpsertResult>;
1229
+ }, expectedModifiedAt?: string): Promise<EmailTemplateUpsertResult>;
976
1230
  deleteEmailTemplate(appId: string, emailType: string): Promise<{
977
1231
  success: boolean;
978
1232
  }>;
@@ -1022,7 +1276,21 @@ export declare class ApiClient {
1022
1276
  success: boolean;
1023
1277
  message: string;
1024
1278
  }>;
1025
- listDatabases(appId: string): Promise<any[]>;
1279
+ /**
1280
+ * List an app's databases, following the cursor to the end.
1281
+ *
1282
+ * The endpoint returns the `{ items, hasMore, nextCursor }` envelope and
1283
+ * caps a page at 100 (#1958), so `databases list` needs the follow-up pages
1284
+ * to show every database. `paginateAll` carries the repeat-cursor and
1285
+ * max-page guards, so a server that hands out a non-advancing cursor fails
1286
+ * loudly instead of looping forever.
1287
+ *
1288
+ * `options.owner` narrows the result to the databases that user created; the
1289
+ * server resolves it through the `databasesByCreator` index (#1965).
1290
+ */
1291
+ listDatabases(appId: string, options?: {
1292
+ owner?: string;
1293
+ }): Promise<any[]>;
1026
1294
  createDatabase(appId: string, data: {
1027
1295
  title: string;
1028
1296
  databaseType?: string;
@@ -1057,12 +1325,69 @@ export declare class ApiClient {
1057
1325
  revokeDatabasePermission(appId: string, databaseId: string, userId: string): Promise<any>;
1058
1326
  listDatabaseModels(appId: string, databaseId: string): Promise<any>;
1059
1327
  describeDatabaseModel(appId: string, databaseId: string, modelName: string): Promise<any>;
1328
+ /**
1329
+ * Query records in a database model. The Durable Object answers with its own
1330
+ * `{ data, hasMore, nextCursor?, prevCursor? }` envelope; that wire shape is
1331
+ * shared with the JS client, the Swift client and web-admin, so the CLI
1332
+ * normalizes it at its own boundary instead (issue #2357) and hands callers
1333
+ * the same `{ items, hasMore, nextCursor? }` envelope as
1334
+ * {@link queryDocumentRecords}.
1335
+ */
1060
1336
  queryDatabaseRecords(appId: string, databaseId: string, modelName: string, queryOptions?: {
1061
1337
  filter?: Record<string, any>;
1062
1338
  limit?: number;
1063
1339
  cursor?: string;
1064
- }): Promise<any>;
1340
+ }): Promise<ListEnvelope>;
1341
+ countDatabaseRecords(appId: string, databaseId: string, modelName: string, filter?: Record<string, any>): Promise<{
1342
+ count: number;
1343
+ }>;
1344
+ aggregateDatabaseRecords(appId: string, databaseId: string, modelName: string, options: {
1345
+ operations: {
1346
+ type: string;
1347
+ field?: string;
1348
+ }[];
1349
+ groupBy: (string | {
1350
+ field: string;
1351
+ contains: string;
1352
+ })[];
1353
+ filter?: Record<string, any>;
1354
+ }): Promise<{
1355
+ result: unknown;
1356
+ }>;
1357
+ /**
1358
+ * Upsert one record via `records/save`: creates the record when the id is
1359
+ * new, and merges the supplied fields into it when it already exists (the DO
1360
+ * writes with `ON CONFLICT … json_patch`, so fields you leave out survive).
1361
+ * `patchDatabaseRecord` is the same merge but requires the record to exist.
1362
+ *
1363
+ * `id` is optional: when omitted the body carries no `id`, which the
1364
+ * DatabaseDO only accepts alongside an `upsertOn` field — callers that want a
1365
+ * plain create must supply an id themselves (`databases records save` mints a
1366
+ * ULID, matching the CSV import path).
1367
+ *
1368
+ * Returns the endpoint's flat `{ success, id, appliedFields }` — not the
1369
+ * saved record.
1370
+ */
1371
+ saveDatabaseRecord(appId: string, databaseId: string, modelName: string, id: string | undefined, data: any): Promise<any>;
1372
+ /**
1373
+ * Merge the supplied fields into an existing record via `records/patch`.
1374
+ *
1375
+ * Fields absent from `data` are left as they are. Unlike `saveDatabaseRecord`
1376
+ * the record must already exist — the DatabaseDO answers 404 for an unknown
1377
+ * id rather than creating one. Returns the flat
1378
+ * `{ success, id, appliedFields }`.
1379
+ */
1380
+ patchDatabaseRecord(appId: string, databaseId: string, modelName: string, id: string, data: any): Promise<any>;
1065
1381
  listDatabaseOperations(appId: string, databaseId: string): Promise<any[]>;
1382
+ /**
1383
+ * Execute a registered operation and, when the result is a query page,
1384
+ * normalize it to the CLI's one list envelope (issue #2440).
1385
+ *
1386
+ * The registered operation decides the response shape, so the normalization
1387
+ * is conditional — see {@link normalizeDatabaseOperationResult}. Everything
1388
+ * else (a `count`, an `aggregate`, a mutation, a `returnField: "all"`
1389
+ * pipeline) is returned exactly as the server sent it.
1390
+ */
1066
1391
  executeDatabaseOperation(appId: string, databaseId: string, operationName: string, data?: {
1067
1392
  params?: Record<string, any>;
1068
1393
  limit?: number;
@@ -1145,6 +1470,7 @@ export declare class ApiClient {
1145
1470
  access?: string | null;
1146
1471
  params?: Record<string, any> | null;
1147
1472
  }>;
1473
+ pendingOpUpserts?: Array<Record<string, any>>;
1148
1474
  }, expectedModifiedAt?: string, options?: {
1149
1475
  dryRun?: boolean;
1150
1476
  acceptWarnings?: boolean;
@@ -1194,7 +1520,7 @@ export declare class ApiClient {
1194
1520
  params?: Record<string, any> | null;
1195
1521
  status?: string;
1196
1522
  }): Promise<any>;
1197
- updateDatabaseTypeSubscription(appId: string, databaseType: string, subscriptionKey: string, data: Record<string, any>): Promise<any>;
1523
+ updateDatabaseTypeSubscription(appId: string, databaseType: string, subscriptionKey: string, data: Record<string, any>, expectedModifiedAt?: string): Promise<any>;
1198
1524
  deleteDatabaseTypeSubscription(appId: string, databaseType: string, subscriptionKey: string): Promise<any>;
1199
1525
  listGroups(appId: string, params?: {
1200
1526
  type?: string;
@@ -1326,7 +1652,9 @@ export declare class ApiClient {
1326
1652
  writeRule?: string | null;
1327
1653
  description?: string | null;
1328
1654
  metadataManifest?: unknown;
1329
- }): Promise<any>;
1655
+ },
1656
+ /** Optimistic-concurrency token; see `upsertEmailTemplate` (#2731 B10). */
1657
+ expectedModifiedAt?: string): Promise<any>;
1330
1658
  /**
1331
1659
  * Delete a metadata category config (issue #1426, admin-gated route shipped
1332
1660
  * in #1364). Orphan semantics: the config row is hard-deleted; any stored
@@ -1384,6 +1712,119 @@ export declare class ApiClient {
1384
1712
  }>;
1385
1713
  importDocumentState(appId: string, documentId: string, stateBase64: string): Promise<any>;
1386
1714
  getDocument(appId: string, documentId: string): Promise<any>;
1715
+ /**
1716
+ * Delete a document and everything hanging off it (#2756). The server route
1717
+ * runs the same cascade the client SDK's `documents.delete()` triggers —
1718
+ * Yjs state and update history, blob rows and objects, aliases, user/group
1719
+ * permissions, invitations, collection memberships — and returns
1720
+ * `{ success, message }`, which callers pass through under `--json`.
1721
+ */
1722
+ deleteDocument(appId: string, documentId: string): Promise<any>;
1723
+ /**
1724
+ * Introspect a document's Yjs schema (model names, per-model fields and
1725
+ * indexes). Backs `documents records models` and `documents records
1726
+ * describe`. Reuses the existing `GET documents/:id/schema` endpoint.
1727
+ */
1728
+ getDocumentSchema(appId: string, documentId: string): Promise<any>;
1729
+ /**
1730
+ * Query records in a document model (issue #1964 Phase 3). Reuses the
1731
+ * server-side `GET documents/:id/records/:model` endpoint, which runs
1732
+ * through the caller's document permission (reader+) or the app-admin arm.
1733
+ * Returns the unified `{ items, hasMore, nextCursor? }` envelope. The cursor
1734
+ * is an opaque token — feed `nextCursor` back as `cursor` for the next page.
1735
+ * The server also dual-emits a deprecated `cursor` alias (#1316); the
1736
+ * normalizer drops it so CLI output is already on `nextCursor` when #1982
1737
+ * removes it.
1738
+ */
1739
+ queryDocumentRecords(appId: string, documentId: string, modelName: string, queryOptions?: {
1740
+ filter?: Record<string, any>;
1741
+ limit?: number;
1742
+ cursor?: string;
1743
+ }): Promise<ListEnvelope>;
1744
+ /**
1745
+ * Count records in a document model (issue #1964 Phase 3). Returns `{ count }`.
1746
+ */
1747
+ countDocumentRecords(appId: string, documentId: string, modelName: string, queryOptions?: {
1748
+ filter?: Record<string, any>;
1749
+ }): Promise<{
1750
+ count: number;
1751
+ }>;
1752
+ /**
1753
+ * Aggregate records in a document model (issue #2437) — the documents twin
1754
+ * of {@link aggregateDatabaseRecords}. `POST documents/:id/records/:model/aggregate`
1755
+ * with `{ options: { operations, groupBy?, filter? } }`, answering `{ result }`
1756
+ * in the same shape as the database endpoint.
1757
+ *
1758
+ * `groupBy` takes plain field names only: StringSet facet grouping and
1759
+ * `{ field, contains }` membership grouping are database-only, which is why
1760
+ * this signature is narrower than the databases one.
1761
+ */
1762
+ aggregateDocumentRecords(appId: string, documentId: string, modelName: string, options: {
1763
+ operations: {
1764
+ type: string;
1765
+ field?: string;
1766
+ }[];
1767
+ groupBy?: string[];
1768
+ filter?: Record<string, any>;
1769
+ }): Promise<{
1770
+ result: unknown;
1771
+ }>;
1772
+ /**
1773
+ * Fetch platform-vocabulary document statistics (issue #1964 Phase 3):
1774
+ * record/model/blob counts, approximate size, and last-modified timestamp.
1775
+ */
1776
+ getDocumentStats(appId: string, documentId: string): Promise<any>;
1777
+ /**
1778
+ * Create or replace a record in a document model (issue #1964 Phase 4).
1779
+ * `POST documents/:id/records/:model` with `{ id, data, options? }` —
1780
+ * server-side write through the document facade (Yjs-first, CRDT-safe,
1781
+ * broadcasts to connected clients). Requires read-write+ on the document
1782
+ * or the app-admin arm. Returns `{ record }`.
1783
+ */
1784
+ saveDocumentRecord(appId: string, documentId: string, modelName: string, body: {
1785
+ id: string;
1786
+ data: Record<string, unknown>;
1787
+ options?: Record<string, unknown>;
1788
+ }): Promise<{
1789
+ record: unknown;
1790
+ }>;
1791
+ /**
1792
+ * Merge fields into an existing record (issue #1964 Phase 4).
1793
+ * `PATCH documents/:id/records/:model/:recordId` with `{ data, options? }`.
1794
+ * Returns `{ record }`.
1795
+ */
1796
+ patchDocumentRecord(appId: string, documentId: string, modelName: string, recordId: string, body: {
1797
+ data: Record<string, unknown>;
1798
+ options?: Record<string, unknown>;
1799
+ }): Promise<{
1800
+ record: unknown;
1801
+ }>;
1802
+ /**
1803
+ * Delete a record from a document model (issue #1964 Phase 4).
1804
+ * `DELETE documents/:id/records/:model/:recordId`. A missing record id is
1805
+ * a silent no-op per the facade contract. Returns `{ deleted: true }`.
1806
+ */
1807
+ deleteDocumentRecord(appId: string, documentId: string, modelName: string, recordId: string): Promise<{
1808
+ deleted: boolean;
1809
+ }>;
1810
+ /**
1811
+ * Apply an ordered multi-model create/patch/delete blob atomically (issue
1812
+ * #1964 Phase 4, wrapping the #1517 `bulkUpdate` facade). All-or-nothing:
1813
+ * a validation failure commits nothing. Returns the facade's
1814
+ * `{ applied, added, updated, deleted }`.
1815
+ */
1816
+ bulkDocumentRecords(appId: string, documentId: string, operations: Array<Record<string, unknown>>): Promise<{
1817
+ applied: number;
1818
+ added: Array<{
1819
+ model: string;
1820
+ id: string;
1821
+ }>;
1822
+ updated: Array<{
1823
+ model: string;
1824
+ id: string;
1825
+ }>;
1826
+ deleted: number;
1827
+ }>;
1387
1828
  createDocument(appId: string, data: {
1388
1829
  title: string;
1389
1830
  documentId?: string;
@@ -1392,9 +1833,22 @@ export declare class ApiClient {
1392
1833
  }): Promise<any>;
1393
1834
  listDocumentPermissions(appId: string, documentId: string): Promise<any[]>;
1394
1835
  grantDocumentPermission(appId: string, documentId: string, permissions: Array<{
1395
- userId: string;
1836
+ userId?: string;
1837
+ email?: string;
1396
1838
  permission: string;
1397
1839
  }>): Promise<any>;
1840
+ /**
1841
+ * Revoke a user's permission on a document. Mirrors the published client's
1842
+ * `documents.removePermission` wire behavior (`src/client/api/documentsApi.ts`):
1843
+ * a userId targets the path route `DELETE .../permissions/:userId`, while an
1844
+ * email targets the query-param route `DELETE .../permissions?email=...`
1845
+ * (unified email removal, #452). This duplication of the client's wire shape
1846
+ * is deliberate and parity-tested (issue #1964 amendment 8).
1847
+ */
1848
+ revokeDocumentPermission(appId: string, documentId: string, target: {
1849
+ userId?: string;
1850
+ email?: string;
1851
+ }): Promise<any>;
1398
1852
  getDocumentLinkAccess(appId: string, documentId: string): Promise<any>;
1399
1853
  setDocumentLinkAccess(appId: string, documentId: string, level: "reader" | "read-write"): Promise<any>;
1400
1854
  clearDocumentLinkAccess(appId: string, documentId: string): Promise<any>;
@@ -1408,10 +1862,36 @@ export declare class ApiClient {
1408
1862
  }): Promise<any>;
1409
1863
  listDocumentAliases(appId: string, documentId: string): Promise<any[]>;
1410
1864
  setDocumentAlias(appId: string, aliasScope: string, aliasKey: string, documentId: string, ownerUserId?: string, mustNotExist?: boolean): Promise<any>;
1411
- findUserByEmail(appId: string, email: string): Promise<any | null>;
1865
+ /**
1866
+ * Resolve an app user by exact email — the single email → userId lookup in
1867
+ * the CLI (issue #2763). It reads the member-accessible `users/lookup`
1868
+ * endpoint rather than the admin-only `GET /users` list, and returns the
1869
+ * server's `{ exists, user? }` envelope as-is: a 403 or a transport failure
1870
+ * rejects instead of being flattened into "no such user", which is exactly
1871
+ * how the deleted admin-list helper misreported permission problems.
1872
+ */
1873
+ lookupUserByEmail(appId: string, email: string): Promise<{
1874
+ exists: boolean;
1875
+ user?: {
1876
+ userId: string;
1877
+ name?: string;
1878
+ email?: string;
1879
+ };
1880
+ }>;
1412
1881
  listAdminDocuments(appId: string, userId: string): Promise<any[]>;
1413
- saveDatabaseRecord(appId: string, databaseId: string, modelName: string, id: string, data: any): Promise<any>;
1414
- batchDatabaseRecords(appId: string, databaseId: string, operations: DatabaseBatchOperation[]): Promise<any>;
1882
+ /**
1883
+ * Apply an ordered batch of record operations via `records/batch`.
1884
+ *
1885
+ * `atomic` (default off, matching the DatabaseDO) makes the whole batch
1886
+ * all-or-nothing: the DO rolls every write back at the first failed
1887
+ * operation and answers with that operation's status. `databases records
1888
+ * bulk` sends `atomic: true` so it matches the documents twin's
1889
+ * all-or-nothing contract (#2437); the CSV/import paths keep the default
1890
+ * partial-success behavior.
1891
+ */
1892
+ batchDatabaseRecords(appId: string, databaseId: string, operations: DatabaseBatchOperation[], options?: {
1893
+ atomic?: boolean;
1894
+ }): Promise<any>;
1415
1895
  deleteDatabaseRecord(appId: string, databaseId: string, modelName: string, id: string): Promise<any>;
1416
1896
  batchDeleteDatabaseRecords(appId: string, databaseId: string, operations: {
1417
1897
  op: "delete";