ankka-console 0.10.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/dist/client/control-plane.d.ts +87 -1
  2. package/dist/client/control-plane.js +201 -1
  3. package/dist/client/schemas.d.ts +1835 -0
  4. package/dist/client/schemas.js +595 -0
  5. package/dist/context.d.ts +98 -0
  6. package/dist/context.js +73 -0
  7. package/dist/extensions/render.d.ts +2 -0
  8. package/dist/extensions/render.js +5 -0
  9. package/dist/extensions/types.d.ts +1 -1
  10. package/dist/extensions/types.js +29 -0
  11. package/dist/fonts/inter-latin-ext-wght-normal.woff2 +0 -0
  12. package/dist/fonts/inter-latin-wght-normal.woff2 +0 -0
  13. package/dist/index.d.ts +9 -2
  14. package/dist/index.js +7 -1
  15. package/dist/routes/auth.sign-out.js +8 -3
  16. package/dist/routes/front.d.ts +62 -2
  17. package/dist/routes/front.js +45 -10
  18. package/dist/routes/logs.d.ts +92 -0
  19. package/dist/routes/logs.js +15 -14
  20. package/dist/routes/machines.d.ts +78 -0
  21. package/dist/routes/machines.js +78 -0
  22. package/dist/routes/members.js +11 -8
  23. package/dist/routes/organization-new.js +7 -4
  24. package/dist/routes/organization.d.ts +29 -1
  25. package/dist/routes/organization.js +38 -9
  26. package/dist/routes/project-new.js +8 -4
  27. package/dist/routes/project.d.ts +347 -2
  28. package/dist/routes/project.js +182 -9
  29. package/dist/routes/service-apply.d.ts +5 -2
  30. package/dist/routes/service-apply.js +17 -14
  31. package/dist/routes/service-history.d.ts +32 -0
  32. package/dist/routes/service-history.js +82 -0
  33. package/dist/routes/service-topology.d.ts +210 -0
  34. package/dist/routes/service-topology.js +54 -0
  35. package/dist/routes/service.d.ts +91 -10
  36. package/dist/routes/service.js +87 -23
  37. package/dist/routes/stream.service.js +18 -1
  38. package/dist/routes/tokens.js +8 -6
  39. package/dist/routes.js +3 -0
  40. package/dist/runtime.d.ts +3 -1
  41. package/dist/runtime.js +1 -0
  42. package/dist/styles.css +2 -481
  43. package/dist/testing/fake-control-plane.d.ts +334 -1
  44. package/dist/testing/fake-control-plane.js +1194 -15
  45. package/dist/testing/index.d.ts +1 -1
  46. package/dist/testing/scenarios.js +6 -0
  47. package/dist/theme.css +66 -0
  48. package/dist/ui/console.d.ts +19 -6
  49. package/dist/ui/console.js +9 -2
  50. package/dist/ui/errors.js +7 -5
  51. package/dist/ui/grants.d.ts +3 -0
  52. package/dist/ui/grants.js +13 -0
  53. package/dist/ui/hosting.d.ts +11 -0
  54. package/dist/ui/hosting.js +20 -0
  55. package/dist/ui/primitives/button.d.ts +11 -0
  56. package/dist/ui/primitives/button.js +21 -0
  57. package/dist/ui/primitives/select.d.ts +10 -0
  58. package/dist/ui/primitives/select.js +4 -0
  59. package/dist/ui/primitives/switch.d.ts +9 -0
  60. package/dist/ui/primitives/switch.js +4 -0
  61. package/dist/ui/shape.d.ts +4 -0
  62. package/dist/ui/shape.js +36 -0
  63. package/dist/ui/shell.d.ts +76 -0
  64. package/dist/ui/shell.js +114 -0
  65. package/dist/ui/tokens.d.ts +82 -0
  66. package/dist/ui/tokens.js +172 -0
  67. package/dist/ui/topology/Graph.d.ts +13 -0
  68. package/dist/ui/topology/Graph.js +56 -0
  69. package/dist/ui/topology/Table.d.ts +10 -0
  70. package/dist/ui/topology/Table.js +14 -0
  71. package/dist/ui/topology/layout.d.ts +113 -0
  72. package/dist/ui/topology/layout.js +177 -0
  73. package/dist/ui/use-stream.d.ts +251 -1
  74. package/dist/ui/use-stream.js +11 -1
  75. package/package.json +11 -3
@@ -44,6 +44,30 @@ export const whoamiSchema = z.object({
44
44
  platformAdmin: z.boolean().default(false),
45
45
  organizations: z.array(organizationMembershipSchema).default([]),
46
46
  });
47
+ /** The installation's cloud: its provider, account and location, and its key for an owner alone. */
48
+ export const cloudInstallationSchema = z.object({
49
+ provider: z.string(),
50
+ account: z.string(),
51
+ location: z.string(),
52
+ kmsKey: optional(z.string()),
53
+ });
54
+ /** Where the installation keeps its secrets, and how long the record of reads is kept (feature 038). */
55
+ export const installationSecretsSchema = z.object({
56
+ backend: z.string(),
57
+ recordRetention: z.string(),
58
+ auditLog: z.string().default("unknown"),
59
+ });
60
+ /**
61
+ * `GET /installation`: the platform's version, and its cloud when it names a provider; and its
62
+ * backups (feature 041); and where it keeps its secrets (feature 038).
63
+ */
64
+ export const installationSchema = z.object({
65
+ platformVersion: z.string(),
66
+ cloud: optional(cloudInstallationSchema),
67
+ // Lazily: its schema is with the other backup schemas, below.
68
+ backups: optional(z.lazy(() => installationStatusSchema)),
69
+ secrets: optional(installationSecretsSchema),
70
+ });
47
71
  export const quotaSchema = z.object({
48
72
  projects: optional(z.number().int()),
49
73
  services: optional(z.number().int()),
@@ -90,6 +114,40 @@ export const projectSummarySchema = z.object({
90
114
  services: z.number().int(),
91
115
  registry: optional(registrySummarySchema),
92
116
  });
117
+ export const mountStatusSchema = z.object({
118
+ path: z.string(),
119
+ service: z.string(),
120
+ state: z.string().default(""),
121
+ });
122
+ /** One name in a move of a service's secrets to Secret Manager, and how the two compare. */
123
+ export const secretMoveNameSchema = z.object({ name: z.string(), state: z.string() });
124
+ /** What a move of a service's secrets did when its instance started; names and states, never a value. */
125
+ export const secretMoveReportSchema = z.object({
126
+ phase: z.string(),
127
+ outcome: z.string(),
128
+ names: z.array(secretMoveNameSchema).default([]),
129
+ detail: optional(z.string()),
130
+ });
131
+ /** Where a service's instance keeps its secrets, and what a move of them did. */
132
+ export const secretStoreReportSchema = z.object({
133
+ backend: z.string(),
134
+ keyRead: z.boolean(),
135
+ move: optional(secretMoveReportSchema),
136
+ });
137
+ /** A DNS record a member creates at their provider; the platform writes none. */
138
+ export const dnsRecordSchema = z.object({
139
+ name: z.string(),
140
+ kind: z.string(),
141
+ value: z.string(),
142
+ });
143
+ /** One custom hostname of a service: where it stands, and the record that points it at the installation. */
144
+ export const customHostnameSchema = z.object({
145
+ hostname: z.string(),
146
+ state: z.string().default("pending"),
147
+ reason: optional(z.string()),
148
+ record: optional(dnsRecordSchema),
149
+ note: optional(z.string()),
150
+ });
93
151
  export const serviceStatusSchema = z.object({
94
152
  name: z.string(),
95
153
  projectId: z.string(),
@@ -107,6 +165,51 @@ export const serviceStatusSchema = z.object({
107
165
  paused: z.boolean().default(false),
108
166
  hosting: z.string().default("embedded"),
109
167
  protocol: optional(z.string()),
168
+ mounts: z.array(mountStatusSchema).default([]),
169
+ callers: z.array(z.string()).default([]),
170
+ processPort: optional(z.number().int()),
171
+ broker: optional(z.string()),
172
+ /** Topics the service's components use that its project does not declare; absent when not read. */
173
+ undeclaredTopics: optional(z.array(z.string())),
174
+ /** Where the service keeps its secrets, and what a move of them did, from its instances; absent when not read. */
175
+ secretStore: optional(secretStoreReportSchema),
176
+ /** Each side the service takes on a declared topic with a contract, checked against it; absent when not read. */
177
+ topicChecks: optional(z.array(z.lazy(() => topicCheckSchema))),
178
+ /** Each topic source of the service with how far behind it is, from its instances; absent when not read. */
179
+ topicSources: optional(z.array(z.lazy(() => topicSourceReportSchema))),
180
+ /** What a member should know and need not act on, worked out from the project's declarations now. */
181
+ warnings: optional(z.array(z.lazy(() => serviceWarningSchema))),
182
+ objectStorage: optional(z.string()),
183
+ bucket: optional(z.string()),
184
+ bucketAddress: optional(z.string()),
185
+ /** Which store the bucket is in, `garage` or `gcs`, as the operator reported it. */
186
+ objectStore: optional(z.string()),
187
+ /** The bucket's location, in Google Cloud Storage. */
188
+ bucketLocation: optional(z.string()),
189
+ /** How many days the bucket keeps a deleted object, in Google Cloud Storage. */
190
+ softDeleteDays: optional(z.number().int()),
191
+ /** Where a move of the bucket from Garage is, as a phrase; its detail is in `detail`. */
192
+ storageMove: optional(z.string()),
193
+ /** The project database cluster the service is on, when a member switched it to a restore. */
194
+ databaseCluster: optional(z.string()),
195
+ /** `mounted` when the service's instances read their project's grants (feature 040). */
196
+ grants: optional(z.string()),
197
+ /** Each other project's topic the service uses, and whether that project grants it; absent when not read. */
198
+ crossProjectTopics: optional(z.array(z.lazy(() => crossProjectTopicSchema))),
199
+ /** Names under domains the project's owner brings, served beside the derived hostname. */
200
+ customHostnames: z.array(customHostnameSchema).default([]),
201
+ /** The TXT record that proves the project controls a name it brings; on a read of one service. */
202
+ proofRecord: optional(dnsRecordSchema),
203
+ });
204
+ /** `POST /services/{project}/{name}/storage/move`: how long the service's writes may be paused. */
205
+ export const storageMoveRequestSchema = z.object({ writePauseBound: optional(z.string()) });
206
+ /** `PUT /projects/{id}/location`. */
207
+ export const setProjectLocationSchema = z.object({ location: z.string() });
208
+ export const crossProjectTopicSchema = z.object({
209
+ project: z.string(),
210
+ topic: z.string(),
211
+ right: z.string(),
212
+ status: z.string(),
110
213
  });
111
214
  export const historyActorSchema = z.object({
112
215
  subject: z.string(),
@@ -118,7 +221,18 @@ export const historyEntrySchema = z.object({
118
221
  generation: z.number().int(),
119
222
  actor: optional(historyActorSchema),
120
223
  at: optional(z.string()),
224
+ /** On an entry that recorded a descriptor: its image, and a digest two such entries share exactly when the descriptors are the same. */
225
+ image: optional(z.string()),
226
+ digest: optional(z.string()),
227
+ /** On a custom hostname's entry: the name it added or removed. */
228
+ hostname: optional(z.string()),
229
+ /** On a rollback: the generation whose descriptor was applied again. */
230
+ rolledBackTo: optional(z.number().int()),
231
+ /** What else the entry says: for a switch, which cluster the service left and which it is on. */
232
+ detail: optional(z.string()),
121
233
  });
234
+ export const rollbackRequestSchema = z.object({ generation: optional(z.number().int()) });
235
+ export const rolledBackSchema = z.object({ rolledBackTo: z.number().int(), status: serviceStatusSchema });
122
236
  export const instanceLogsSchema = z.object({
123
237
  instance: z.string(),
124
238
  output: z.string(),
@@ -127,6 +241,65 @@ export const instanceLogsSchema = z.object({
127
241
  export const logsResponseSchema = z.object({
128
242
  instances: z.array(instanceLogsSchema),
129
243
  });
244
+ // ── Topology ──────────────────────────────────────────────────────────────
245
+ export const topologyHandlerSchema = z.object({
246
+ name: z.string(),
247
+ type: z.string(),
248
+ streaming: optional(z.boolean()),
249
+ });
250
+ export const topologyNodeSchema = z.object({
251
+ id: z.string(),
252
+ kind: z.string(),
253
+ layer: z.number().int(),
254
+ platform: z.boolean(),
255
+ handlers: z.array(topologyHandlerSchema),
256
+ });
257
+ export const declaredEdgeSchema = z.object({ from: z.string(), to: z.string(), kind: z.string() });
258
+ export const callPairSchema = z.object({
259
+ caller: z.string(),
260
+ callee: z.string(),
261
+ handled: z.object({ ok: z.number(), refused: z.number(), failed: z.number() }),
262
+ unanswered: z.object({ timedOut: z.number(), undelivered: z.number() }),
263
+ durationMillis: z.object({ p50: z.number(), p99: z.number(), max: z.number(), bucketed: z.boolean().default(true) }),
264
+ streaming: z.boolean().default(false),
265
+ histogram: z.array(z.number()).default([]),
266
+ });
267
+ export const callEdgeSchema = z.object({ from: z.string(), to: z.string(), pairs: z.array(callPairSchema) });
268
+ export const topologyWindowSchema = z.object({
269
+ seconds: z.number(),
270
+ since: z.string(),
271
+ calls: z.number(),
272
+ unanswered: z.number().default(0),
273
+ });
274
+ export const instanceTopologyDocumentSchema = z.object({
275
+ service: z.object({ name: z.string(), runtime: z.string(), instance: z.string(), startedAt: z.string() }),
276
+ window: topologyWindowSchema,
277
+ nodes: z.array(topologyNodeSchema),
278
+ declared: z.array(declaredEdgeSchema),
279
+ calls: z.array(callEdgeSchema),
280
+ });
281
+ export const instanceStatusSchema = z.enum(["ok", "unreachable", "unsupported", "failed"]);
282
+ export const instanceTopologySchema = z.object({
283
+ pod: z.string(),
284
+ status: instanceStatusSchema,
285
+ problem: optional(z.string()),
286
+ runtime: optional(z.string()),
287
+ readAt: optional(z.string()),
288
+ });
289
+ export const topologyDifferenceSchema = z.object({ node: z.string(), presentOn: z.array(z.string()) });
290
+ /** `GET /services/{projectId}/{name}/topology`: every instance's topology, merged. */
291
+ export const serviceTopologySchema = z.object({
292
+ service: z.string(),
293
+ running: z.number().int(),
294
+ contributing: z.number().int(),
295
+ partial: z.boolean(),
296
+ instances: z.array(instanceTopologySchema),
297
+ window: topologyWindowSchema,
298
+ nodes: z.array(topologyNodeSchema),
299
+ declared: z.array(declaredEdgeSchema),
300
+ calls: z.array(callEdgeSchema),
301
+ differences: z.array(topologyDifferenceSchema),
302
+ });
130
303
  export const memberSummarySchema = z.object({
131
304
  subject: z.string(),
132
305
  role: roleSchema,
@@ -186,11 +359,397 @@ export const setRegistrySchema = z.object({
186
359
  username: z.string(),
187
360
  password: z.string(),
188
361
  });
362
+ /** `PUT /projects/{id}/secrets/{name}`: entries merged into a project secret. */
363
+ export const setProjectSecretSchema = z.object({
364
+ entries: z.record(z.string(), z.string()),
365
+ });
366
+ /** A contract as declared on a topic: its name and the fingerprint of its schema document. */
367
+ export const contractSchema = z.object({
368
+ name: z.string(),
369
+ fingerprint: z.string(),
370
+ });
371
+ /** One side of a declared topic as a running service states it, against the declared contract. */
372
+ export const topicCheckSchema = z.object({
373
+ topic: optional(z.string()),
374
+ service: z.string(),
375
+ component: z.string(),
376
+ direction: z.string(),
377
+ stated: optional(z.string()),
378
+ state: z.string(),
379
+ });
380
+ /**
381
+ * `PUT /projects/{id}/topics/{name}`: the partitions a declared topic has, whether the broker keeps
382
+ * only the last message under each key, and the contract it carries with its schema document; and
383
+ * how long it keeps, how it is cleaned and how many copies it has, each in the words a member types.
384
+ * A new topic needs its partitions and takes every setting left out from the installation; a topic
385
+ * already declared keeps what is left out. `removes` restates what a change that removes messages
386
+ * removes, in the control plane's own words.
387
+ */
388
+ export const topicDeclarationRequestSchema = z.object({
389
+ partitions: optional(z.number().int()),
390
+ compacted: z.boolean().default(false),
391
+ contract: optional(z.object({ name: z.string(), schema: z.unknown() })),
392
+ retention: optional(z.string()),
393
+ retentionSize: optional(z.string()),
394
+ cleanup: optional(z.string()),
395
+ tombstoneWindow: optional(z.string()),
396
+ minCompactionLag: optional(z.string()),
397
+ maxCompactionLag: optional(z.string()),
398
+ copies: optional(z.number().int()),
399
+ minInSync: optional(z.number().int()),
400
+ removes: optional(z.string()),
401
+ });
402
+ /** A declared topic's every setting in words, and the ones the installation supplied. */
403
+ export const topicSettingsViewSchema = z.object({
404
+ retention: z.string(),
405
+ retentionSize: z.string(),
406
+ cleanup: z.string(),
407
+ tombstoneWindow: z.string(),
408
+ minCompactionLag: z.string(),
409
+ maxCompactionLag: z.string(),
410
+ copies: optional(z.number().int()),
411
+ minInSync: optional(z.number().int()),
412
+ defaulted: z.array(z.string()).default([]),
413
+ });
414
+ /** A topic a project declares, and how far the platform has got with it. */
415
+ export const projectTopicSchema = z.object({
416
+ name: z.string(),
417
+ partitions: z.number().int(),
418
+ phase: optional(z.string()),
419
+ detail: optional(z.string()),
420
+ compacted: z.boolean().default(false),
421
+ contract: optional(contractSchema),
422
+ checks: z.array(topicCheckSchema).default([]),
423
+ settings: optional(topicSettingsViewSchema),
424
+ /** How many copies the broker holds, as the operator last saw. */
425
+ copiesHeld: optional(z.number().int()),
426
+ /** How many broker nodes the installation's broker has. */
427
+ brokerNodes: optional(z.number().int()),
428
+ });
429
+ /** One setting a declaration changed, from what to what. */
430
+ export const settingChangeSchema = z.object({
431
+ setting: z.string(),
432
+ from: z.string(),
433
+ to: z.string(),
434
+ });
435
+ /** Where a partition begins on the broker, and when that message was published. */
436
+ export const partitionGapReportSchema = z.object({
437
+ partition: z.number().int(),
438
+ beginning: z.number().int(),
439
+ earliestRetained: optional(z.string()),
440
+ });
441
+ /** What a topic source's topic no longer holds, per partition, and whether earlier messages are gone. */
442
+ export const retentionGapReportSchema = z.object({
443
+ partitions: z.array(partitionGapReportSchema),
444
+ compacted: z.boolean().default(false),
445
+ gone: z.boolean().default(false),
446
+ readAt: optional(z.string()),
447
+ });
448
+ /** Something about a service a member should know: a view over a topic that keeps too little. */
449
+ export const serviceWarningSchema = z.object({
450
+ kind: z.string(),
451
+ component: z.string(),
452
+ topic: z.string(),
453
+ message: z.string(),
454
+ });
455
+ /**
456
+ * A topic source as a service's instances report it: what reads which topic under which group, the
457
+ * declared broker and contract it states, `lag` (messages past the last one handled, as of the last
458
+ * poll) and `failing` (the reason of the change being delivered again, until one succeeds).
459
+ */
460
+ export const topicSourceReportSchema = z.object({
461
+ kind: z.string(),
462
+ component: z.string(),
463
+ topic: z.string(),
464
+ group: z.string(),
465
+ start: z.string(),
466
+ version: z.number().int(),
467
+ recordedVersion: optional(z.number().int()),
468
+ behind: z.boolean().default(false),
469
+ broker: optional(z.string()),
470
+ contract: optional(z.string()),
471
+ lag: optional(z.number().int()),
472
+ failing: optional(z.string()),
473
+ /** What the broker still holds of the topic, per partition. */
474
+ gap: optional(retentionGapReportSchema),
475
+ });
476
+ /** `PUT /projects/{id}/brokers/{name}`: a broker declared beside the installation's, and how it is reached. */
477
+ export const brokerDeclarationRequestSchema = z.object({
478
+ bootstrap: z.string(),
479
+ shape: z.string(),
480
+ secret: z.string(),
481
+ });
482
+ /** A broker a project declares, as listed: where it is, the shape of its credential, and the project secret holding it. */
483
+ export const projectBrokerSchema = z.object({
484
+ name: z.string(),
485
+ bootstrap: z.string(),
486
+ shape: z.string(),
487
+ secret: z.string(),
488
+ declaredAt: optional(z.string()),
489
+ });
490
+ /** A project secret as the control plane lists it: entries' names, never a value. */
491
+ export const projectSecretSummarySchema = z.object({
492
+ name: z.string(),
493
+ entries: z.array(z.string()),
494
+ setAt: optional(z.string()),
495
+ setBy: optional(z.string()),
496
+ });
497
+ /** The record of one read, keep or removal of a service secret: never its value. */
498
+ export const readRecordSchema = z.object({
499
+ at: z.string(),
500
+ project: z.string(),
501
+ service: z.string(),
502
+ hosting: z.string(),
503
+ name: z.string(),
504
+ operation: z.string(),
505
+ outcome: z.string(),
506
+ backend: z.string(),
507
+ traceId: optional(z.string()),
508
+ spanId: optional(z.string()),
509
+ component: optional(z.string()),
510
+ componentKind: optional(z.string()),
511
+ latestSkipped: z.boolean().default(false),
512
+ });
513
+ /** The record of a project's secret reads, newest first, as an owner reads it. */
514
+ export const secretReadsPageSchema = z.object({ records: z.array(readRecordSchema).default([]) });
515
+ // ── Backups and recovery (feature 041) ──────────────────────────────────────
516
+ /** One line of history's backups: `phase` is `backing up`, `failing` or `not backed up`. */
517
+ export const backupLineSchema = z.object({
518
+ line: z.string(),
519
+ cluster: z.string(),
520
+ phase: z.string(),
521
+ lastBaseBackup: optional(z.string()),
522
+ firstRestorable: optional(z.string()),
523
+ lastRestorable: optional(z.string()),
524
+ archiveLagSeconds: optional(z.number()),
525
+ failing: optional(z.string()),
526
+ copiedAt: optional(z.string()),
527
+ });
528
+ export const projectDatabaseSchema = z.object({
529
+ cluster: z.string(),
530
+ instances: z.number().int(),
531
+ readyInstances: z.number().int(),
532
+ primary: optional(z.string()),
533
+ synchronous: z.boolean().default(false),
534
+ writesWaitingOn: optional(z.string()),
535
+ });
536
+ /** One of the project's database clusters: `live`, a `restore`, or `left` once every service has left it. */
537
+ export const projectClusterSchema = z.object({
538
+ name: z.string(),
539
+ line: z.string(),
540
+ phase: z.string(),
541
+ services: z.array(z.string()).default([]),
542
+ since: optional(z.string()),
543
+ leftAt: optional(z.string()),
544
+ });
545
+ /** What one service's database holds in a restore or a rehearsal; secrets by name only. */
546
+ export const serviceVerificationSchema = z.object({
547
+ name: z.string(),
548
+ present: z.boolean(),
549
+ journalRows: z.number().int().default(0),
550
+ stateRows: z.number().int().default(0),
551
+ offsetRows: z.number().int().default(0),
552
+ timerRows: z.number().int().default(0),
553
+ highestSequence: z.number().int().default(0),
554
+ changedSecrets: z.array(z.string()).default([]),
555
+ });
556
+ /** A topic past a restore's moment: messages newer than it, and how many of them a group has read. */
557
+ export const topicDivergenceSchema = z.object({
558
+ topic: z.string(),
559
+ group: optional(z.string()),
560
+ after: z.number().int().default(0),
561
+ read: optional(z.number().int()),
562
+ services: z.array(z.string()).default([]),
563
+ });
564
+ /** A restore: `Restoring`, `Verified`, `Failed` or `InUse`, with what each service's database holds. */
565
+ export const restoreViewSchema = z.object({
566
+ name: z.string(),
567
+ line: z.string(),
568
+ moment: z.string(),
569
+ phase: z.string(),
570
+ requestedBy: optional(z.string()),
571
+ requestedAt: optional(z.string()),
572
+ reachedAt: optional(z.string()),
573
+ services: z.array(serviceVerificationSchema).default([]),
574
+ detail: optional(z.string()),
575
+ broker: z.array(topicDivergenceSchema).default([]),
576
+ notAsked: z.array(z.string()).default([]),
577
+ note: optional(z.string()),
578
+ });
579
+ /** A rehearsal: `Running`, `Completed`, `Failed` or `NotRemoved`, and how long it took. */
580
+ export const rehearsalViewSchema = z.object({
581
+ name: z.string(),
582
+ line: z.string(),
583
+ moment: z.string(),
584
+ outcome: z.string(),
585
+ requestedBy: optional(z.string()),
586
+ requestedAt: optional(z.string()),
587
+ elapsedSeconds: optional(z.number().int()),
588
+ detail: optional(z.string()),
589
+ services: z.array(serviceVerificationSchema).default([]),
590
+ });
591
+ export const projectStatusSchema = z.object({
592
+ id: z.string(),
593
+ backedUp: z.boolean(),
594
+ target: z.string(),
595
+ lines: z.array(backupLineSchema).default([]),
596
+ database: optional(projectDatabaseSchema),
597
+ detail: optional(z.string()),
598
+ clusters: z.array(projectClusterSchema).default([]),
599
+ restores: z.array(restoreViewSchema).default([]),
600
+ rehearsal: optional(rehearsalViewSchema),
601
+ });
602
+ export const secondaryStoreSchema = z.object({
603
+ lastCompleted: optional(z.string()),
604
+ lastFailed: optional(z.string()),
605
+ failure: optional(z.string()),
606
+ buckets: optional(z.number().int()),
607
+ deletedObjects: optional(z.number().int()),
608
+ });
609
+ export const installationStatusSchema = z.object({
610
+ backupTarget: z.string(),
611
+ retentionDays: z.number().int(),
612
+ copyRequired: z.boolean(),
613
+ sharesFailureDomain: z.boolean(),
614
+ encryption: z.string(),
615
+ controlPlane: optional(backupLineSchema),
616
+ notBackedUp: optional(z.string()),
617
+ secondaryStore: optional(secondaryStoreSchema),
618
+ });
619
+ export const serviceDifferenceSchema = z.object({
620
+ project: z.string(),
621
+ service: z.string(),
622
+ recordedGeneration: optional(z.number().int()),
623
+ clusterGeneration: optional(z.number().int()),
624
+ recordedImage: optional(z.string()),
625
+ clusterImage: optional(z.string()),
626
+ });
627
+ /** Whether the control plane is held after its own database was restored, and what differs. */
628
+ export const restoreHoldStatusSchema = z.object({
629
+ held: z.boolean(),
630
+ restoredAt: optional(z.string()),
631
+ targetTime: optional(z.string()),
632
+ releasedAt: optional(z.string()),
633
+ releasedBy: optional(z.string()),
634
+ services: z.array(serviceDifferenceSchema).default([]),
635
+ topics: z.array(z.string()).default([]),
636
+ unknownProjects: z.array(z.string()).default([]),
637
+ reconciled: z.array(z.string()).default([]),
638
+ });
639
+ /** `POST /projects/{id}/restores`: the moment, and the line when services are on more than one. */
640
+ export const restoreRequestSchema = z.object({ moment: z.string(), line: optional(z.string()) });
641
+ /** `POST /services/{p}/{n}/switch`: the cluster to move the service to. */
642
+ export const switchRequestSchema = z.object({ cluster: z.string() });
643
+ /** `POST /projects/{id}/rehearsals`: both may be left out, for the latest restorable moment. */
644
+ export const rehearsalRequestSchema = z.object({ moment: optional(z.string()), line: optional(z.string()) });
645
+ export const credentialReissuedSchema = z.object({ project: z.string(), generation: z.number().int() });
646
+ /** What a project asks of its database, whole. */
647
+ export const databaseSettingSchema = z.object({
648
+ replicas: z.number().int().default(0),
649
+ synchronous: z.boolean().default(false),
650
+ retentionDays: optional(z.number().int()),
651
+ rehearse: optional(z.string()),
652
+ });
653
+ /**
654
+ * Who did what to a project: to its database, or to the topic `topic` names, with each setting it
655
+ * changed (feature 043).
656
+ */
657
+ export const projectHistoryViewSchema = z.object({
658
+ kind: z.string(),
659
+ by: optional(z.string()),
660
+ at: optional(z.string()),
661
+ detail: optional(z.string()),
662
+ topic: optional(z.string()),
663
+ changes: z.array(settingChangeSchema).default([]),
664
+ });
665
+ // ── Grants and machines (feature 040) ───────────────────────────────────────
666
+ /** What a grant opens: one route, one gRPC method, one topic with one right, or the erasure. */
667
+ export const grantTargetSchema = z.object({
668
+ kind: z.string(),
669
+ service: optional(z.string()),
670
+ method: optional(z.string()),
671
+ path: optional(z.string()),
672
+ topic: optional(z.string()),
673
+ right: optional(z.string()),
674
+ decrypt: z.boolean().default(false),
675
+ });
676
+ /** Who did something to a grant, and when. */
677
+ export const grantActSchema = z.object({
678
+ by: optional(z.string()),
679
+ at: optional(z.string()),
680
+ });
681
+ export const grantRequestSchema = z.object({
682
+ grantee: z.string(),
683
+ target: grantTargetSchema,
684
+ });
685
+ /** A grant as its project lists it; `effect` is `in effect`, or why not. */
686
+ export const grantDetailSchema = z.object({
687
+ id: z.string(),
688
+ grantee: z.string(),
689
+ target: grantTargetSchema,
690
+ state: z.string(),
691
+ effect: z.string(),
692
+ granted: grantActSchema,
693
+ answered: optional(grantActSchema),
694
+ ended: optional(grantActSchema),
695
+ });
696
+ export const grantChangeRecordSchema = z.object({
697
+ change: z.string(),
698
+ by: optional(z.string()),
699
+ at: optional(z.string()),
700
+ });
701
+ export const topicSettingsSchema = z.object({
702
+ partitions: z.number().int(),
703
+ compacted: z.boolean().default(false),
704
+ retention: optional(z.string()),
705
+ copies: optional(z.number().int()),
706
+ });
707
+ /** A grant as its grantee's side records it. */
708
+ export const receivedGrantDetailSchema = z.object({
709
+ id: z.string(),
710
+ grantingProject: z.string(),
711
+ grantingOrganization: z.string(),
712
+ grantee: z.string(),
713
+ target: grantTargetSchema,
714
+ state: z.string(),
715
+ changes: z.array(grantChangeRecordSchema).default([]),
716
+ topic: optional(topicSettingsSchema),
717
+ });
718
+ export const machineRegistrationSchema = z.object({ name: z.string() });
719
+ /** A machine just registered: its secret, shown this once. */
720
+ export const machineRegisteredSchema = z.object({
721
+ name: z.string(),
722
+ clientId: z.string(),
723
+ clientSecret: z.string(),
724
+ tokenUrl: z.string(),
725
+ brokerBootstrap: optional(z.string()),
726
+ });
727
+ export const byteRatesRequestSchema = z.object({
728
+ produceBytesPerSecond: z.number().int(),
729
+ consumeBytesPerSecond: z.number().int(),
730
+ requestPercentage: z.number().int(),
731
+ });
732
+ export const machineSummarySchema = z.object({
733
+ name: z.string(),
734
+ clientId: z.string(),
735
+ registeredBy: optional(z.string()),
736
+ registeredAt: optional(z.string()),
737
+ byteRates: optional(byteRatesRequestSchema),
738
+ });
739
+ export const tokenResponseSchema = z.object({
740
+ access_token: z.string(),
741
+ token_type: z.string(),
742
+ expires_in: z.number().int(),
743
+ });
744
+ export const jsonWebKeySetSchema = z.object({
745
+ keys: z.array(z.object({ kty: z.string(), use: z.string(), alg: z.string(), kid: z.string(), n: z.string(), e: z.string() })),
746
+ });
189
747
  /** Every schema by the Scala type's name, as the fixture files name them. */
190
748
  export const schemasByType = {
191
749
  AuthDiscovery: authDiscoverySchema,
192
750
  OrganizationMembership: organizationMembershipSchema,
193
751
  Whoami: whoamiSchema,
752
+ Installation: installationSchema,
194
753
  Quota: quotaSchema,
195
754
  Usage: usageSchema,
196
755
  OrganizationDetail: organizationDetailSchema,
@@ -198,11 +757,19 @@ export const schemasByType = {
198
757
  RegistrySummary: registrySummarySchema,
199
758
  ProjectDetail: projectDetailSchema,
200
759
  ProjectSummary: projectSummarySchema,
760
+ MountStatus: mountStatusSchema,
201
761
  ServiceStatus: serviceStatusSchema,
202
762
  HistoryActor: historyActorSchema,
203
763
  HistoryEntry: historyEntrySchema,
764
+ RollbackRequest: rollbackRequestSchema,
765
+ StorageMoveRequest: storageMoveRequestSchema,
766
+ SetProjectLocation: setProjectLocationSchema,
767
+ RolledBack: rolledBackSchema,
204
768
  InstanceLogs: instanceLogsSchema,
205
769
  LogsResponse: logsResponseSchema,
770
+ InstanceTopologyDocument: instanceTopologyDocumentSchema,
771
+ InstanceTopology: instanceTopologySchema,
772
+ ServiceTopology: serviceTopologySchema,
206
773
  MemberSummary: memberSummarySchema,
207
774
  InvitationSummary: invitationSummarySchema,
208
775
  MembersResponse: membersResponseSchema,
@@ -218,4 +785,32 @@ export const schemasByType = {
218
785
  Repair: repairSchema,
219
786
  CreateDeployToken: createDeployTokenSchema,
220
787
  SetRegistry: setRegistrySchema,
788
+ SetProjectSecret: setProjectSecretSchema,
789
+ ProjectSecretSummary: projectSecretSummarySchema,
790
+ TopicDeclarationRequest: topicDeclarationRequestSchema,
791
+ ProjectTopic: projectTopicSchema,
792
+ Contract: contractSchema,
793
+ BrokerDeclarationRequest: brokerDeclarationRequestSchema,
794
+ ProjectBroker: projectBrokerSchema,
795
+ SecretReadsPage: secretReadsPageSchema,
796
+ ProjectStatus: projectStatusSchema,
797
+ InstallationStatus: installationStatusSchema,
798
+ RestoreRequest: restoreRequestSchema,
799
+ RestoreView: restoreViewSchema,
800
+ SwitchRequest: switchRequestSchema,
801
+ ProjectHistoryView: projectHistoryViewSchema,
802
+ DatabaseSetting: databaseSettingSchema,
803
+ RehearsalRequest: rehearsalRequestSchema,
804
+ RehearsalView: rehearsalViewSchema,
805
+ RestoreHoldStatus: restoreHoldStatusSchema,
806
+ CredentialReissued: credentialReissuedSchema,
807
+ GrantRequest: grantRequestSchema,
808
+ GrantDetail: grantDetailSchema,
809
+ ReceivedGrantDetail: receivedGrantDetailSchema,
810
+ MachineRegistration: machineRegistrationSchema,
811
+ MachineRegistered: machineRegisteredSchema,
812
+ MachineSummary: machineSummarySchema,
813
+ ByteRatesRequest: byteRatesRequestSchema,
814
+ TokenResponse: tokenResponseSchema,
815
+ JsonWebKeySet: jsonWebKeySetSchema,
221
816
  };