primitive-admin 1.0.60 → 1.0.62

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 (310) 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 +29 -14
  4. package/dist/bin/primitive.js.map +1 -1
  5. package/dist/src/commands/admins.js +22 -8
  6. package/dist/src/commands/admins.js.map +1 -1
  7. package/dist/src/commands/analytics.js +96 -16
  8. package/dist/src/commands/analytics.js.map +1 -1
  9. package/dist/src/commands/apps.js +49 -188
  10. package/dist/src/commands/apps.js.map +1 -1
  11. package/dist/src/commands/blob-buckets.js +50 -155
  12. package/dist/src/commands/blob-buckets.js.map +1 -1
  13. package/dist/src/commands/collection-type-configs.js +14 -100
  14. package/dist/src/commands/collection-type-configs.js.map +1 -1
  15. package/dist/src/commands/collections.js +47 -8
  16. package/dist/src/commands/collections.js.map +1 -1
  17. package/dist/src/commands/config.d.ts +46 -0
  18. package/dist/src/commands/config.js +479 -0
  19. package/dist/src/commands/config.js.map +1 -0
  20. package/dist/src/commands/connections.d.ts +2 -0
  21. package/dist/src/commands/connections.js +100 -0
  22. package/dist/src/commands/connections.js.map +1 -0
  23. package/dist/src/commands/cron-triggers.js +84 -176
  24. package/dist/src/commands/cron-triggers.js.map +1 -1
  25. package/dist/src/commands/database-type-configs.d.ts +2 -0
  26. package/dist/src/commands/database-type-configs.js +171 -0
  27. package/dist/src/commands/database-type-configs.js.map +1 -0
  28. package/dist/src/commands/database-types.js +4 -4
  29. package/dist/src/commands/database-types.js.map +1 -1
  30. package/dist/src/commands/databases.d.ts +63 -0
  31. package/dist/src/commands/databases.js +649 -87
  32. package/dist/src/commands/databases.js.map +1 -1
  33. package/dist/src/commands/documents.js +869 -12
  34. package/dist/src/commands/documents.js.map +1 -1
  35. package/dist/src/commands/email-templates.js +18 -125
  36. package/dist/src/commands/email-templates.js.map +1 -1
  37. package/dist/src/commands/env.d.ts +12 -1
  38. package/dist/src/commands/env.js +98 -25
  39. package/dist/src/commands/env.js.map +1 -1
  40. package/dist/src/commands/feature-flags.d.ts +14 -0
  41. package/dist/src/commands/feature-flags.js +116 -0
  42. package/dist/src/commands/feature-flags.js.map +1 -0
  43. package/dist/src/commands/group-type-configs.js +14 -109
  44. package/dist/src/commands/group-type-configs.js.map +1 -1
  45. package/dist/src/commands/init.d.ts +9 -1
  46. package/dist/src/commands/init.js +1058 -279
  47. package/dist/src/commands/init.js.map +1 -1
  48. package/dist/src/commands/integrations.js +136 -421
  49. package/dist/src/commands/integrations.js.map +1 -1
  50. package/dist/src/commands/metadata-category-configs.d.ts +12 -0
  51. package/dist/src/commands/metadata-category-configs.js +112 -0
  52. package/dist/src/commands/metadata-category-configs.js.map +1 -0
  53. package/dist/src/commands/metadata.js +33 -141
  54. package/dist/src/commands/metadata.js.map +1 -1
  55. package/dist/src/commands/prompts.js +206 -563
  56. package/dist/src/commands/prompts.js.map +1 -1
  57. package/dist/src/commands/rule-sets.d.ts +1 -1
  58. package/dist/src/commands/rule-sets.js +16 -132
  59. package/dist/src/commands/rule-sets.js.map +1 -1
  60. package/dist/src/commands/scripts.js +67 -234
  61. package/dist/src/commands/scripts.js.map +1 -1
  62. package/dist/src/commands/sessions.d.ts +2 -0
  63. package/dist/src/commands/sessions.js +75 -0
  64. package/dist/src/commands/sessions.js.map +1 -0
  65. package/dist/src/commands/skill.js +2 -2
  66. package/dist/src/commands/skill.js.map +1 -1
  67. package/dist/src/commands/sync-app-settings.d.ts +113 -70
  68. package/dist/src/commands/sync-app-settings.js +193 -242
  69. package/dist/src/commands/sync-app-settings.js.map +1 -1
  70. package/dist/src/commands/sync.d.ts +1932 -49
  71. package/dist/src/commands/sync.js +9584 -1725
  72. package/dist/src/commands/sync.js.map +1 -1
  73. package/dist/src/commands/tokens.js +8 -2
  74. package/dist/src/commands/tokens.js.map +1 -1
  75. package/dist/src/commands/users.js +92 -1
  76. package/dist/src/commands/users.js.map +1 -1
  77. package/dist/src/commands/vars.js +44 -58
  78. package/dist/src/commands/vars.js.map +1 -1
  79. package/dist/src/commands/webhooks.js +318 -156
  80. package/dist/src/commands/webhooks.js.map +1 -1
  81. package/dist/src/commands/workflows.d.ts +49 -12
  82. package/dist/src/commands/workflows.js +652 -1043
  83. package/dist/src/commands/workflows.js.map +1 -1
  84. package/dist/src/lib/access-rule-display.d.ts +21 -0
  85. package/dist/src/lib/access-rule-display.js +34 -0
  86. package/dist/src/lib/access-rule-display.js.map +1 -0
  87. package/dist/src/lib/api-client.d.ts +630 -61
  88. package/dist/src/lib/api-client.js +676 -116
  89. package/dist/src/lib/api-client.js.map +1 -1
  90. package/dist/src/lib/app-settings-descriptor.d.ts +180 -25
  91. package/dist/src/lib/app-settings-descriptor.js +403 -82
  92. package/dist/src/lib/app-settings-descriptor.js.map +1 -1
  93. package/dist/src/lib/canonical-json.d.ts +12 -0
  94. package/dist/src/lib/canonical-json.js +35 -0
  95. package/dist/src/lib/canonical-json.js.map +1 -0
  96. package/dist/src/lib/cli-manifest.d.ts +8 -0
  97. package/dist/src/lib/cli-manifest.js +1 -0
  98. package/dist/src/lib/cli-manifest.js.map +1 -1
  99. package/dist/src/lib/codegen-shared/generatedFiles.d.ts +6 -2
  100. package/dist/src/lib/codegen-shared/generatedFiles.js +9 -2
  101. package/dist/src/lib/codegen-shared/generatedFiles.js.map +1 -1
  102. package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.d.ts +6 -6
  103. package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.js +8 -8
  104. package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.js.map +1 -1
  105. package/dist/src/lib/config-object-descriptor.d.ts +127 -0
  106. package/dist/src/lib/config-object-descriptor.js +658 -0
  107. package/dist/src/lib/config-object-descriptor.js.map +1 -0
  108. package/dist/src/lib/config-payload.d.ts +85 -0
  109. package/dist/src/lib/config-payload.js +116 -0
  110. package/dist/src/lib/config-payload.js.map +1 -0
  111. package/dist/src/lib/config-surface.d.ts +130 -0
  112. package/dist/src/lib/config-surface.js +300 -0
  113. package/dist/src/lib/config-surface.js.map +1 -0
  114. package/dist/src/lib/credentials-store.d.ts +10 -0
  115. package/dist/src/lib/credentials-store.js +23 -0
  116. package/dist/src/lib/credentials-store.js.map +1 -1
  117. package/dist/src/lib/data-input.d.ts +23 -0
  118. package/dist/src/lib/data-input.js +50 -0
  119. package/dist/src/lib/data-input.js.map +1 -0
  120. package/dist/src/lib/db-codegen/dbTemplates.js +1 -1
  121. package/dist/src/lib/db-codegen/dbTemplates.js.map +1 -1
  122. package/dist/src/lib/db-codegen/dbTypeIR.d.ts +1 -1
  123. package/dist/src/lib/env-resolver-core.d.ts +147 -0
  124. package/dist/src/lib/env-resolver-core.js +265 -0
  125. package/dist/src/lib/env-resolver-core.js.map +1 -0
  126. package/dist/src/lib/env-resolver.d.ts +28 -6
  127. package/dist/src/lib/env-resolver.js +44 -32
  128. package/dist/src/lib/env-resolver.js.map +1 -1
  129. package/dist/src/lib/generated-allowlist.js +13 -0
  130. package/dist/src/lib/generated-allowlist.js.map +1 -1
  131. package/dist/src/lib/generated-config-surfaces.d.ts +682 -0
  132. package/dist/src/lib/generated-config-surfaces.js +4058 -0
  133. package/dist/src/lib/generated-config-surfaces.js.map +1 -0
  134. package/dist/src/lib/generated-template-lint.d.ts +212 -0
  135. package/dist/src/lib/generated-template-lint.js +624 -0
  136. package/dist/src/lib/generated-template-lint.js.map +1 -0
  137. package/dist/src/lib/init-adopt.d.ts +16 -0
  138. package/dist/src/lib/init-adopt.js +34 -0
  139. package/dist/src/lib/init-adopt.js.map +1 -0
  140. package/dist/src/lib/init-assets.d.ts +39 -0
  141. package/dist/src/lib/init-assets.js +97 -0
  142. package/dist/src/lib/init-assets.js.map +1 -0
  143. package/dist/src/lib/init-config.d.ts +44 -5
  144. package/dist/src/lib/init-config.js +80 -7
  145. package/dist/src/lib/init-config.js.map +1 -1
  146. package/dist/src/lib/init-ios-links.d.ts +50 -0
  147. package/dist/src/lib/init-ios-links.js +153 -0
  148. package/dist/src/lib/init-ios-links.js.map +1 -0
  149. package/dist/src/lib/init-plan.d.ts +80 -0
  150. package/dist/src/lib/init-plan.js +95 -0
  151. package/dist/src/lib/init-plan.js.map +1 -0
  152. package/dist/src/lib/init-production-env.d.ts +48 -0
  153. package/dist/src/lib/init-production-env.js +59 -0
  154. package/dist/src/lib/init-production-env.js.map +1 -0
  155. package/dist/src/lib/init-schema.d.ts +74 -0
  156. package/dist/src/lib/init-schema.js +358 -0
  157. package/dist/src/lib/init-schema.js.map +1 -0
  158. package/dist/src/lib/init-xcode.d.ts +33 -0
  159. package/dist/src/lib/init-xcode.js +114 -0
  160. package/dist/src/lib/init-xcode.js.map +1 -0
  161. package/dist/src/lib/integration-request-config.d.ts +30 -0
  162. package/dist/src/lib/integration-request-config.js +145 -0
  163. package/dist/src/lib/integration-request-config.js.map +1 -0
  164. package/dist/src/lib/local-state.d.ts +55 -0
  165. package/dist/src/lib/local-state.js +167 -0
  166. package/dist/src/lib/local-state.js.map +1 -0
  167. package/dist/src/lib/log-inspection.d.ts +568 -0
  168. package/dist/src/lib/log-inspection.js +639 -0
  169. package/dist/src/lib/log-inspection.js.map +1 -0
  170. package/dist/src/lib/migration-nag.d.ts +2 -2
  171. package/dist/src/lib/migration-nag.js +3 -3
  172. package/dist/src/lib/object-status-filter.d.ts +22 -0
  173. package/dist/src/lib/object-status-filter.js +45 -0
  174. package/dist/src/lib/object-status-filter.js.map +1 -0
  175. package/dist/src/lib/output.d.ts +24 -1
  176. package/dist/src/lib/output.js +42 -1
  177. package/dist/src/lib/output.js.map +1 -1
  178. package/dist/src/lib/package-manager.d.ts +140 -0
  179. package/dist/src/lib/package-manager.js +305 -0
  180. package/dist/src/lib/package-manager.js.map +1 -0
  181. package/dist/src/lib/paginate.d.ts +50 -0
  182. package/dist/src/lib/paginate.js +53 -0
  183. package/dist/src/lib/paginate.js.map +1 -1
  184. package/dist/src/lib/platform-owned.d.ts +29 -3
  185. package/dist/src/lib/platform-owned.js +42 -3
  186. package/dist/src/lib/platform-owned.js.map +1 -1
  187. package/dist/src/lib/project-config.js +13 -5
  188. package/dist/src/lib/project-config.js.map +1 -1
  189. package/dist/src/lib/query-operators.d.ts +1 -1
  190. package/dist/src/lib/query-operators.js +1 -1
  191. package/dist/src/lib/record-filter.d.ts +18 -0
  192. package/dist/src/lib/record-filter.js +55 -0
  193. package/dist/src/lib/record-filter.js.map +1 -0
  194. package/dist/src/lib/resolve-init-dev-port.d.ts +56 -0
  195. package/dist/src/lib/resolve-init-dev-port.js +55 -0
  196. package/dist/src/lib/resolve-init-dev-port.js.map +1 -0
  197. package/dist/src/lib/resolve-init-server.d.ts +64 -0
  198. package/dist/src/lib/resolve-init-server.js +77 -0
  199. package/dist/src/lib/resolve-init-server.js.map +1 -0
  200. package/dist/src/lib/resolve-platform.d.ts +43 -14
  201. package/dist/src/lib/resolve-platform.js +74 -12
  202. package/dist/src/lib/resolve-platform.js.map +1 -1
  203. package/dist/src/lib/run-status.d.ts +19 -0
  204. package/dist/src/lib/run-status.generated.d.ts +39 -0
  205. package/dist/src/lib/run-status.generated.js +66 -0
  206. package/dist/src/lib/run-status.generated.js.map +1 -0
  207. package/dist/src/lib/run-status.js +19 -0
  208. package/dist/src/lib/run-status.js.map +1 -0
  209. package/dist/src/lib/server-text-normalization.d.ts +51 -0
  210. package/dist/src/lib/server-text-normalization.js +90 -0
  211. package/dist/src/lib/server-text-normalization.js.map +1 -0
  212. package/dist/src/lib/server-url.d.ts +22 -0
  213. package/dist/src/lib/server-url.js +33 -0
  214. package/dist/src/lib/server-url.js.map +1 -0
  215. package/dist/src/lib/signing-secret-status.d.ts +81 -0
  216. package/dist/src/lib/signing-secret-status.js +116 -0
  217. package/dist/src/lib/signing-secret-status.js.map +1 -0
  218. package/dist/src/lib/skill-installer.d.ts +4 -2
  219. package/dist/src/lib/skill-installer.js +143 -12
  220. package/dist/src/lib/skill-installer.js.map +1 -1
  221. package/dist/src/lib/snapshots.d.ts +2 -2
  222. package/dist/src/lib/snapshots.js +2 -2
  223. package/dist/src/lib/swift-codegen/dbGenerator.d.ts +15 -2
  224. package/dist/src/lib/swift-codegen/dbGenerator.js +250 -18
  225. package/dist/src/lib/swift-codegen/dbGenerator.js.map +1 -1
  226. package/dist/src/lib/swift-codegen/generator.d.ts +11 -2
  227. package/dist/src/lib/swift-codegen/generator.js +181 -7
  228. package/dist/src/lib/swift-codegen/generator.js.map +1 -1
  229. package/dist/src/lib/swift-codegen/siblingSymbols.d.ts +7 -3
  230. package/dist/src/lib/swift-codegen/siblingSymbols.js +4 -1
  231. package/dist/src/lib/swift-codegen/siblingSymbols.js.map +1 -1
  232. package/dist/src/lib/sync-dir-selector.d.ts +21 -0
  233. package/dist/src/lib/sync-dir-selector.js +30 -0
  234. package/dist/src/lib/sync-dir-selector.js.map +1 -0
  235. package/dist/src/lib/sync-paths.d.ts +39 -0
  236. package/dist/src/lib/sync-paths.js +70 -2
  237. package/dist/src/lib/sync-paths.js.map +1 -1
  238. package/dist/src/lib/sync-resource-types.d.ts +138 -31
  239. package/dist/src/lib/sync-resource-types.js +241 -47
  240. package/dist/src/lib/sync-resource-types.js.map +1 -1
  241. package/dist/src/lib/sync-selectors.d.ts +95 -0
  242. package/dist/src/lib/sync-selectors.js +228 -0
  243. package/dist/src/lib/sync-selectors.js.map +1 -0
  244. package/dist/src/lib/template.d.ts +62 -4
  245. package/dist/src/lib/template.js +147 -39
  246. package/dist/src/lib/template.js.map +1 -1
  247. package/dist/src/lib/test-case-keys.d.ts +29 -0
  248. package/dist/src/lib/test-case-keys.js +55 -0
  249. package/dist/src/lib/test-case-keys.js.map +1 -0
  250. package/dist/src/lib/test-case-variables.d.ts +15 -0
  251. package/dist/src/lib/test-case-variables.js +29 -0
  252. package/dist/src/lib/test-case-variables.js.map +1 -0
  253. package/dist/src/lib/toml-database-config.d.ts +4 -4
  254. package/dist/src/lib/toml-database-config.js +27 -34
  255. package/dist/src/lib/toml-database-config.js.map +1 -1
  256. package/dist/src/lib/toml-metadata-config.d.ts +9 -5
  257. package/dist/src/lib/toml-metadata-config.js +40 -45
  258. package/dist/src/lib/toml-metadata-config.js.map +1 -1
  259. package/dist/src/lib/toml-native-form.d.ts +1 -1
  260. package/dist/src/lib/toml-native-form.js +1 -1
  261. package/dist/src/lib/toml-params-validator.d.ts +1 -1
  262. package/dist/src/lib/toml-params-validator.js +1 -1
  263. package/dist/src/lib/toml-scalar-edit.d.ts +43 -0
  264. package/dist/src/lib/toml-scalar-edit.js +283 -0
  265. package/dist/src/lib/toml-scalar-edit.js.map +1 -0
  266. package/dist/src/lib/user-selector.d.ts +24 -0
  267. package/dist/src/lib/user-selector.js +33 -0
  268. package/dist/src/lib/user-selector.js.map +1 -0
  269. package/dist/src/lib/version-check.d.ts +25 -0
  270. package/dist/src/lib/version-check.js +77 -8
  271. package/dist/src/lib/version-check.js.map +1 -1
  272. package/dist/src/lib/watch.d.ts +121 -0
  273. package/dist/src/lib/watch.js +169 -0
  274. package/dist/src/lib/watch.js.map +1 -0
  275. package/dist/src/lib/workflow-apply.d.ts +69 -45
  276. package/dist/src/lib/workflow-apply.js +99 -72
  277. package/dist/src/lib/workflow-apply.js.map +1 -1
  278. package/dist/src/lib/workflow-codegen/generator.js +4 -4
  279. package/dist/src/lib/workflow-codegen/generator.js.map +1 -1
  280. package/dist/src/lib/workflow-codegen/invokerIR.d.ts +11 -0
  281. package/dist/src/lib/workflow-codegen/invokerIR.js +5 -0
  282. package/dist/src/lib/workflow-codegen/invokerIR.js.map +1 -1
  283. package/dist/src/lib/workflow-config-apply.d.ts +70 -0
  284. package/dist/src/lib/workflow-config-apply.js +137 -0
  285. package/dist/src/lib/workflow-config-apply.js.map +1 -0
  286. package/dist/src/lib/workflow-config-sidecar.d.ts +63 -0
  287. package/dist/src/lib/workflow-config-sidecar.js +96 -0
  288. package/dist/src/lib/workflow-config-sidecar.js.map +1 -0
  289. package/dist/src/lib/workflow-defaults.d.ts +29 -0
  290. package/dist/src/lib/workflow-defaults.js +41 -0
  291. package/dist/src/lib/workflow-defaults.js.map +1 -0
  292. package/dist/src/lib/workflow-fragments.d.ts +23 -0
  293. package/dist/src/lib/workflow-fragments.js +229 -8
  294. package/dist/src/lib/workflow-fragments.js.map +1 -1
  295. package/dist/src/lib/workflow-include-preserve.d.ts +76 -0
  296. package/dist/src/lib/workflow-include-preserve.js +286 -0
  297. package/dist/src/lib/workflow-include-preserve.js.map +1 -0
  298. package/dist/src/lib/workflow-payload.d.ts +31 -20
  299. package/dist/src/lib/workflow-payload.js +100 -93
  300. package/dist/src/lib/workflow-payload.js.map +1 -1
  301. package/dist/src/lib/workflow-toml-validator.d.ts +80 -3
  302. package/dist/src/lib/workflow-toml-validator.js +231 -3
  303. package/dist/src/lib/workflow-toml-validator.js.map +1 -1
  304. package/dist/src/types/index.d.ts +78 -22
  305. package/dist/src/validators.d.ts +7 -7
  306. package/dist/src/validators.js +6 -6
  307. package/package.json +11 -6
  308. package/dist/src/commands/settings.d.ts +0 -15
  309. package/dist/src/commands/settings.js +0 -102
  310. package/dist/src/commands/settings.js.map +0 -1
@@ -1,3 +1,21 @@
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
+ }
1
19
  export declare class ApiError extends Error {
2
20
  statusCode: number;
3
21
  code?: string;
@@ -262,6 +280,85 @@ interface AnalyticsEventsGroupedResponse {
262
280
  rows: AnalyticsGroupedRow[];
263
281
  _timing: AnalyticsTiming;
264
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
+ * 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
+ }
265
362
  interface AnalyticsIntegrationMetric {
266
363
  integrationKey: string;
267
364
  invocations: number;
@@ -302,7 +399,7 @@ interface TopPromptsResponse {
302
399
  _timing: AnalyticsTiming;
303
400
  }
304
401
  /**
305
- * 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
306
403
  * DatabaseDO expects (`databases-controller.ts`): `{ op, modelName, id, data }`.
307
404
  * `data` is required for `save`/`patch` and omitted for `delete`.
308
405
  */
@@ -311,7 +408,48 @@ export interface DatabaseBatchOperation {
311
408
  modelName: string;
312
409
  id: string;
313
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>;
314
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;
315
453
  export declare class ApiClient {
316
454
  private credentials;
317
455
  constructor();
@@ -360,6 +498,27 @@ export declare class ApiClient {
360
498
  nextCursor?: string | null;
361
499
  }>;
362
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>;
363
522
  updateUserRole(appId: string, userId: string, role: "admin" | "member"): Promise<any>;
364
523
  transferOwnership(appId: string, newOwnerEmail: string): Promise<void>;
365
524
  transferAdminOwnership(appId: string, adminId: string): Promise<any>;
@@ -379,6 +538,9 @@ export declare class ApiClient {
379
538
  cursor?: string;
380
539
  }): Promise<{
381
540
  items: any[];
541
+ nextCursor?: string;
542
+ hasMore?: boolean;
543
+ /** @deprecated Alias of `nextCursor` (#1316). */
382
544
  cursor?: string;
383
545
  }>;
384
546
  createInvitation(appId: string, data: {
@@ -405,9 +567,11 @@ export declare class ApiClient {
405
567
  type?: string;
406
568
  email?: string;
407
569
  limit?: number;
570
+ cursor?: string;
408
571
  }): Promise<{
409
572
  grants: any[];
410
573
  nextCursor?: string | null;
574
+ hasMore?: boolean;
411
575
  }>;
412
576
  revokeDeferredGrant(appId: string, deferredId: string, type: string): Promise<any>;
413
577
  listIntegrations(appId: string, params?: {
@@ -418,10 +582,27 @@ export declare class ApiClient {
418
582
  items: any[];
419
583
  nextCursor?: string | null;
420
584
  }>;
421
- getIntegration(appId: string, integrationId: string): Promise<any>;
422
- createIntegration(appId: string, payload: any): Promise<any>;
423
- updateIntegration(appId: string, integrationId: string, payload: any, expectedModifiedAt?: string): Promise<any>;
424
- 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>;
425
606
  testIntegration(appId: string, integrationId: string, payload: any): Promise<any>;
426
607
  listIntegrationLogs(appId: string, integrationId: string, params?: {
427
608
  limit?: number;
@@ -433,14 +614,6 @@ export declare class ApiClient {
433
614
  listWorkflowRunIntegrationLogs(appId: string, runId: string, params?: {
434
615
  limit?: number;
435
616
  }): Promise<any[]>;
436
- listIntegrationSecrets(appId: string, integrationId: string, params?: {
437
- limit?: number;
438
- }): Promise<any[]>;
439
- addIntegrationSecret(appId: string, integrationId: string, payload: {
440
- secretData: any;
441
- secretSummary?: string;
442
- }): Promise<any>;
443
- archiveIntegrationSecret(appId: string, integrationId: string, secretId: string): Promise<any>;
444
617
  listAppSecrets(appId: string): Promise<any[]>;
445
618
  createAppSecret(appId: string, payload: {
446
619
  key: string;
@@ -475,14 +648,77 @@ export declare class ApiClient {
475
648
  getWebhook(appId: string, webhookId: string): Promise<any>;
476
649
  createWebhook(appId: string, payload: any): Promise<any>;
477
650
  updateWebhook(appId: string, webhookId: string, payload: any, expectedModifiedAt?: string): Promise<any>;
478
- 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>;
479
670
  rotateWebhookSecret(appId: string, webhookId: string, payload: {
480
671
  signingSecret: string;
481
672
  }): Promise<any>;
482
673
  listWebhookEvents(appId: string, webhookId: string, params?: {
483
674
  limit?: number;
484
- }): 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
+ }>;
683
+ /**
684
+ * List the live connections the server believes exist for exactly one of a
685
+ * document, user, or database. Read-only inspection over admin-api. Rows are
686
+ * per-connection-×-subscription bindings, so `connectionId` is not unique
687
+ * across rows. `params` on a database-subscription row is caller-defined
688
+ * bound CEL input — typed `unknown`.
689
+ */
690
+ listConnections(appId: string, selector: {
691
+ documentId?: string;
692
+ userId?: string;
693
+ databaseId?: string;
694
+ }, params?: {
695
+ limit?: number;
696
+ cursor?: string;
697
+ }): Promise<{
698
+ items: unknown[];
699
+ nextCursor?: string | null;
700
+ }>;
701
+ listSessions(appId: string, userId: string, params?: {
702
+ limit?: number;
703
+ cursor?: string;
704
+ }): Promise<{
705
+ items: unknown[];
706
+ nextCursor?: string | null;
707
+ }>;
485
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>;
486
722
  listLocks(appId: string): Promise<{
487
723
  locks: any[];
488
724
  }>;
@@ -495,9 +731,17 @@ export declare class ApiClient {
495
731
  getCronTrigger(appId: string, triggerId: string): Promise<any>;
496
732
  createCronTrigger(appId: string, payload: any): Promise<any>;
497
733
  updateCronTrigger(appId: string, triggerId: string, payload: any): Promise<any>;
498
- deleteCronTrigger(appId: string, triggerId: string): Promise<any>;
499
- pauseCronTrigger(appId: string, triggerId: string): Promise<any>;
500
- 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>;
501
745
  testCronTrigger(appId: string, triggerId: string): Promise<any>;
502
746
  listIterations(appId: string): Promise<{
503
747
  items: any[];
@@ -538,6 +782,16 @@ export declare class ApiClient {
538
782
  category: string;
539
783
  deleted: boolean;
540
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
+ }>;
541
795
  listPrompts(appId: string, params?: {
542
796
  status?: string;
543
797
  limit?: number;
@@ -549,7 +803,13 @@ export declare class ApiClient {
549
803
  getPrompt(appId: string, promptId: string): Promise<any>;
550
804
  createPrompt(appId: string, payload: any): Promise<any>;
551
805
  updatePrompt(appId: string, promptId: string, payload: any, expectedModifiedAt?: string): Promise<any>;
552
- 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>;
553
813
  executePrompt(appId: string, promptId: string, payload: {
554
814
  variables: Record<string, any>;
555
815
  modelOverride?: string;
@@ -596,7 +856,21 @@ export declare class ApiClient {
596
856
  * workflows pick up the new body on their next run with no fan-out. The
597
857
  * config name is unique per script, so we mint a timestamped name.
598
858
  */
599
- 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>;
600
874
  /**
601
875
  * Delete a script header (cascades its configs). `force` overrides the
602
876
  * server's guard against deleting a script that an active workflow still
@@ -613,12 +887,22 @@ export declare class ApiClient {
613
887
  activeConfigId: string | null;
614
888
  activeConfigName: string | null;
615
889
  }>;
616
- 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<{
617
899
  items: any[];
900
+ nextCursor?: string;
618
901
  }>;
619
902
  getTestCase(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, testCaseId: string): Promise<any>;
620
903
  createTestCase(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, payload: {
621
904
  name: string;
905
+ description?: string | null;
622
906
  inputVariables: Record<string, any>;
623
907
  expectedOutputPattern?: string;
624
908
  expectedOutputContains?: string[];
@@ -626,9 +910,12 @@ export declare class ApiClient {
626
910
  configId?: string;
627
911
  evaluatorPromptId?: string;
628
912
  evaluatorConfigId?: string;
913
+ /** The sidecar's file name — the case's identity (#2896). */
914
+ key?: string;
629
915
  }): Promise<any>;
630
916
  updateTestCase(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, testCaseId: string, payload: {
631
917
  name?: string;
918
+ description?: string | null;
632
919
  inputVariables?: Record<string, any>;
633
920
  expectedOutputPattern?: string | null;
634
921
  expectedOutputContains?: string[] | null;
@@ -636,6 +923,8 @@ export declare class ApiClient {
636
923
  configId?: string | null;
637
924
  evaluatorPromptId?: string | null;
638
925
  evaluatorConfigId?: string | null;
926
+ /** The sidecar's file name, on a create-or-rename backfill (#2896). */
927
+ key?: string;
639
928
  }): Promise<any>;
640
929
  deleteTestCase(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, testCaseId: string): Promise<void>;
641
930
  listTestCaseAttachments(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, testCaseId: string): Promise<{
@@ -691,9 +980,26 @@ export declare class ApiClient {
691
980
  getWorkflow(appId: string, workflowId: string): Promise<any>;
692
981
  createWorkflow(appId: string, payload: any): Promise<any>;
693
982
  updateWorkflow(appId: string, workflowId: string, payload: any, expectedModifiedAt?: string): Promise<any>;
694
- 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>;
695
1002
  updateWorkflowDraft(appId: string, workflowId: string, payload: any): Promise<any>;
696
- publishWorkflow(appId: string, workflowId: string): Promise<any>;
697
1003
  previewWorkflow(appId: string, workflowId: string, payload: {
698
1004
  rootInput?: object;
699
1005
  meta?: object;
@@ -714,21 +1020,47 @@ export declare class ApiClient {
714
1020
  limit?: number;
715
1021
  cursor?: string;
716
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;
717
1051
  }): Promise<{
718
1052
  items: any[];
1053
+ hasMore?: boolean;
1054
+ nextCursor?: string | null;
1055
+ /** @deprecated Alias of `nextCursor` (#1316). */
719
1056
  cursor?: string | null;
1057
+ /** #2237 — index rows examined; filtered reads only, `undefined` if unknown. */
1058
+ scanned?: number;
720
1059
  }>;
721
1060
  getWorkflowRunStatus(appId: string, workflowId: string, runId: string): Promise<any>;
722
1061
  getWorkflowStepRuns(appId: string, workflowId: string, runId: string): Promise<{
723
1062
  items: any[];
724
1063
  }>;
725
- getWorkflowAnalytics(appId: string, params?: {
726
- windowDays?: number;
727
- }): Promise<any>;
728
- getTopWorkflows(appId: string, params?: {
729
- windowDays?: number;
730
- limit?: number;
731
- }): Promise<any>;
732
1064
  listWorkflowConfigs(appId: string, workflowId: string): Promise<{
733
1065
  items: any[];
734
1066
  }>;
@@ -791,6 +1123,11 @@ export declare class ApiClient {
791
1123
  windowDays?: number;
792
1124
  [key: string]: any;
793
1125
  }): Promise<AnalyticsEventsGroupedResponse>;
1126
+ getAnalyticsErrorsGroups(appId: string, params?: {
1127
+ windowDays?: number;
1128
+ limit?: number;
1129
+ [key: string]: any;
1130
+ }): Promise<AnalyticsErrorsGroupsResponse>;
794
1131
  getAnalyticsTopWorkflows(appId: string, params?: {
795
1132
  windowDays?: number;
796
1133
  limit?: number;
@@ -836,28 +1173,6 @@ export declare class ApiClient {
836
1173
  createIntegrationCatalogItem(payload: any): Promise<any>;
837
1174
  updateIntegrationCatalogItem(catalogId: string, payload: any): Promise<any>;
838
1175
  deleteIntegrationCatalogItem(catalogId: string): Promise<void>;
839
- listLlmModels(provider?: string): Promise<{
840
- models: Array<{
841
- id: string;
842
- name: string;
843
- context_length?: number;
844
- pricing?: any;
845
- }>;
846
- defaultModel?: string;
847
- cachedAt?: string;
848
- }>;
849
- generatePrompt(payload: {
850
- description: string;
851
- generateOutputSchema?: boolean;
852
- }): Promise<any>;
853
- generateEvaluator(payload: {
854
- appId: string;
855
- promptId: string;
856
- }): Promise<any>;
857
- generateWorkflowEvaluator(payload: {
858
- appId: string;
859
- workflowId: string;
860
- }): Promise<any>;
861
1176
  startBatchTests(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, payload?: {
862
1177
  comparisonGroup?: string;
863
1178
  overrideConfigId?: string;
@@ -898,11 +1213,20 @@ export declare class ApiClient {
898
1213
  templates: EmailTemplateSummary[];
899
1214
  }>;
900
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
+ */
901
1225
  upsertEmailTemplate(appId: string, emailType: string, payload: {
902
1226
  subject: string;
903
1227
  htmlBody: string;
904
1228
  textBody: string;
905
- }): Promise<EmailTemplateUpsertResult>;
1229
+ }, expectedModifiedAt?: string): Promise<EmailTemplateUpsertResult>;
906
1230
  deleteEmailTemplate(appId: string, emailType: string): Promise<{
907
1231
  success: boolean;
908
1232
  }>;
@@ -952,7 +1276,21 @@ export declare class ApiClient {
952
1276
  success: boolean;
953
1277
  message: string;
954
1278
  }>;
955
- 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[]>;
956
1294
  createDatabase(appId: string, data: {
957
1295
  title: string;
958
1296
  databaseType?: string;
@@ -987,12 +1325,69 @@ export declare class ApiClient {
987
1325
  revokeDatabasePermission(appId: string, databaseId: string, userId: string): Promise<any>;
988
1326
  listDatabaseModels(appId: string, databaseId: string): Promise<any>;
989
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
+ */
990
1336
  queryDatabaseRecords(appId: string, databaseId: string, modelName: string, queryOptions?: {
991
1337
  filter?: Record<string, any>;
992
1338
  limit?: number;
993
1339
  cursor?: string;
994
- }): 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>;
995
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
+ */
996
1391
  executeDatabaseOperation(appId: string, databaseId: string, operationName: string, data?: {
997
1392
  params?: Record<string, any>;
998
1393
  limit?: number;
@@ -1056,6 +1451,8 @@ export declare class ApiClient {
1056
1451
  timestamps?: Record<string, any> | null;
1057
1452
  schema?: string | null;
1058
1453
  metadataManifest?: any;
1454
+ }, options?: {
1455
+ dryRun?: boolean;
1059
1456
  }): Promise<any>;
1060
1457
  updateDatabaseTypeConfig(appId: string, databaseType: string, data: {
1061
1458
  ruleSetId?: string | null;
@@ -1068,6 +1465,12 @@ export declare class ApiClient {
1068
1465
  pendingOpDeletes?: string[];
1069
1466
  finalOpNames?: string[];
1070
1467
  metadataManifest?: any;
1468
+ pendingOpUpdates?: Array<{
1469
+ name: string;
1470
+ access?: string | null;
1471
+ params?: Record<string, any> | null;
1472
+ }>;
1473
+ pendingOpUpserts?: Array<Record<string, any>>;
1071
1474
  }, expectedModifiedAt?: string, options?: {
1072
1475
  dryRun?: boolean;
1073
1476
  acceptWarnings?: boolean;
@@ -1095,10 +1498,12 @@ export declare class ApiClient {
1095
1498
  dryRun?: boolean;
1096
1499
  schemaOverride?: string | null;
1097
1500
  defaultAccess?: string | null;
1501
+ metadataManifestOverride?: Record<string, any> | null;
1098
1502
  }): Promise<any>;
1099
1503
  updateDatabaseTypeOperation(appId: string, databaseType: string, name: string, data: Record<string, any>, expectedModifiedAt?: string, options?: {
1100
1504
  dryRun?: boolean;
1101
1505
  schemaOverride?: string | null;
1506
+ metadataManifestOverride?: Record<string, any> | null;
1102
1507
  }): Promise<any>;
1103
1508
  deleteDatabaseTypeOperation(appId: string, databaseType: string, name: string): Promise<any>;
1104
1509
  listDatabaseTypeSubscriptions(appId: string, databaseType: string): Promise<any[]>;
@@ -1115,7 +1520,7 @@ export declare class ApiClient {
1115
1520
  params?: Record<string, any> | null;
1116
1521
  status?: string;
1117
1522
  }): Promise<any>;
1118
- 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>;
1119
1524
  deleteDatabaseTypeSubscription(appId: string, databaseType: string, subscriptionKey: string): Promise<any>;
1120
1525
  listGroups(appId: string, params?: {
1121
1526
  type?: string;
@@ -1123,6 +1528,9 @@ export declare class ApiClient {
1123
1528
  cursor?: string;
1124
1529
  }): Promise<{
1125
1530
  items: any[];
1531
+ nextCursor?: string;
1532
+ hasMore?: boolean;
1533
+ /** @deprecated Alias of `nextCursor` (#1316). */
1126
1534
  cursor?: string;
1127
1535
  }>;
1128
1536
  createGroup(appId: string, data: {
@@ -1141,6 +1549,9 @@ export declare class ApiClient {
1141
1549
  include?: "profiles";
1142
1550
  }): Promise<{
1143
1551
  items: any[];
1552
+ nextCursor?: string;
1553
+ hasMore?: boolean;
1554
+ /** @deprecated Alias of `nextCursor` (#1316). */
1144
1555
  cursor?: string;
1145
1556
  }>;
1146
1557
  addGroupMember(appId: string, groupType: string, groupId: string, data: {
@@ -1241,7 +1652,9 @@ export declare class ApiClient {
1241
1652
  writeRule?: string | null;
1242
1653
  description?: string | null;
1243
1654
  metadataManifest?: unknown;
1244
- }): Promise<any>;
1655
+ },
1656
+ /** Optimistic-concurrency token; see `upsertEmailTemplate` (#2731 B10). */
1657
+ expectedModifiedAt?: string): Promise<any>;
1245
1658
  /**
1246
1659
  * Delete a metadata category config (issue #1426, admin-gated route shipped
1247
1660
  * in #1364). Orphan semantics: the config row is hard-deleted; any stored
@@ -1299,6 +1712,119 @@ export declare class ApiClient {
1299
1712
  }>;
1300
1713
  importDocumentState(appId: string, documentId: string, stateBase64: string): Promise<any>;
1301
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
+ }>;
1302
1828
  createDocument(appId: string, data: {
1303
1829
  title: string;
1304
1830
  documentId?: string;
@@ -1307,9 +1833,22 @@ export declare class ApiClient {
1307
1833
  }): Promise<any>;
1308
1834
  listDocumentPermissions(appId: string, documentId: string): Promise<any[]>;
1309
1835
  grantDocumentPermission(appId: string, documentId: string, permissions: Array<{
1310
- userId: string;
1836
+ userId?: string;
1837
+ email?: string;
1311
1838
  permission: string;
1312
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>;
1313
1852
  getDocumentLinkAccess(appId: string, documentId: string): Promise<any>;
1314
1853
  setDocumentLinkAccess(appId: string, documentId: string, level: "reader" | "read-write"): Promise<any>;
1315
1854
  clearDocumentLinkAccess(appId: string, documentId: string): Promise<any>;
@@ -1323,10 +1862,36 @@ export declare class ApiClient {
1323
1862
  }): Promise<any>;
1324
1863
  listDocumentAliases(appId: string, documentId: string): Promise<any[]>;
1325
1864
  setDocumentAlias(appId: string, aliasScope: string, aliasKey: string, documentId: string, ownerUserId?: string, mustNotExist?: boolean): Promise<any>;
1326
- 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
+ }>;
1327
1881
  listAdminDocuments(appId: string, userId: string): Promise<any[]>;
1328
- saveDatabaseRecord(appId: string, databaseId: string, modelName: string, id: string, data: any): Promise<any>;
1329
- 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>;
1330
1895
  deleteDatabaseRecord(appId: string, databaseId: string, modelName: string, id: string): Promise<any>;
1331
1896
  batchDeleteDatabaseRecords(appId: string, databaseId: string, operations: {
1332
1897
  op: "delete";
@@ -1351,6 +1916,9 @@ export declare class ApiClient {
1351
1916
  limit?: number;
1352
1917
  }): Promise<{
1353
1918
  items: any[];
1919
+ nextCursor?: string;
1920
+ hasMore?: boolean;
1921
+ /** @deprecated Alias of `nextCursor` (#1316). */
1354
1922
  cursor?: string;
1355
1923
  }>;
1356
1924
  uploadBucketBlob(appId: string, bucketIdOrKey: string, data: Buffer, meta: {
@@ -1362,6 +1930,7 @@ export declare class ApiClient {
1362
1930
  deleteBucketBlob(appId: string, bucketIdOrKey: string, blobId: string): Promise<any>;
1363
1931
  deleteBucketBlobs(appId: string, bucketIdOrKey: string, blobIds: string[]): Promise<any>;
1364
1932
  getBucketBlobSignedUrl(appId: string, bucketIdOrKey: string, blobId: string, expiresInSeconds?: number): Promise<any>;
1933
+ getBucketBlobMetadata(appId: string, bucketIdOrKey: string, blobId: string): Promise<BlobInfo>;
1365
1934
  }
1366
1935
  export declare const apiClient: ApiClient;
1367
1936
  export {};