@dork-labs/cloud-api 0.76.0 → 0.82.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 (53) hide show
  1. package/README.md +51 -1
  2. package/dist/billing.d.ts +26 -2
  3. package/dist/billing.d.ts.map +1 -1
  4. package/dist/billing.js +37 -0
  5. package/dist/billing.js.map +1 -1
  6. package/dist/communities.d.ts +706 -0
  7. package/dist/communities.d.ts.map +1 -0
  8. package/dist/communities.js +578 -0
  9. package/dist/communities.js.map +1 -0
  10. package/dist/connections.d.ts +3 -3
  11. package/dist/index.d.ts +1 -0
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +1 -0
  14. package/dist/index.js.map +1 -1
  15. package/dist/primitives.d.ts +49 -0
  16. package/dist/primitives.d.ts.map +1 -1
  17. package/dist/primitives.js +63 -0
  18. package/dist/primitives.js.map +1 -1
  19. package/dist/problem.d.ts +15 -0
  20. package/dist/problem.d.ts.map +1 -1
  21. package/dist/problem.js +22 -1
  22. package/dist/problem.js.map +1 -1
  23. package/dist/remote.d.ts +2 -2
  24. package/dist/routes.d.ts +43 -0
  25. package/dist/routes.d.ts.map +1 -1
  26. package/dist/routes.js +65 -0
  27. package/dist/routes.js.map +1 -1
  28. package/dist/seats.d.ts +5 -5
  29. package/fixtures/v1/billing/entitlements-communities.json +40 -0
  30. package/fixtures/v1/communities/claim-link.json +5 -0
  31. package/fixtures/v1/communities/keep-request.json +3 -0
  32. package/fixtures/v1/communities/keep.json +34 -0
  33. package/fixtures/v1/communities/list.json +161 -0
  34. package/fixtures/v1/communities/move-cancelled.json +11 -0
  35. package/fixtures/v1/communities/move-claimed.json +19 -0
  36. package/fixtures/v1/communities/move-failed.json +11 -0
  37. package/fixtures/v1/communities/move-importing.json +19 -0
  38. package/fixtures/v1/communities/move-ready.json +19 -0
  39. package/fixtures/v1/communities/move-start-request.json +7 -0
  40. package/fixtures/v1/communities/move-start.json +20 -0
  41. package/fixtures/v1/communities/moves.json +35 -0
  42. package/fixtures/v1/communities/name-check-free.json +5 -0
  43. package/fixtures/v1/communities/name-check-taken.json +5 -0
  44. package/fixtures/v1/communities/restore.json +31 -0
  45. package/fixtures/v1/communities/start-replay.json +31 -0
  46. package/fixtures/v1/communities/start-request.json +5 -0
  47. package/fixtures/v1/communities/start.json +35 -0
  48. package/fixtures/v1/index.json +24 -1
  49. package/fixtures/v1/problem/community-name-reserved.json +5 -0
  50. package/fixtures/v1/problem/community-name-taken.json +5 -0
  51. package/fixtures/v1/problem/entitlement-required-action.json +8 -0
  52. package/fixtures/v1/problem/import-too-large.json +6 -0
  53. package/package.json +3 -3
@@ -0,0 +1,706 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * The grammar every community short name obeys.
4
+ *
5
+ * A short name is the optional address alias a Community server gives a
6
+ * community beside its permanent identifier. The grammar is the Community
7
+ * server's own: lower-case ASCII letters, digits and single hyphens, starting
8
+ * with a letter and not ending with a hyphen. Published so the app can refuse a
9
+ * bad name before a request goes out. Whether a well-formed name is free, or
10
+ * reserved by the host, only the service can say
11
+ * ({@link CommunityNameCheckResponseSchema}).
12
+ *
13
+ * Lower case by grammar, like `HandleSchema`: the app folds what a person
14
+ * types before sending it, and the service refuses a mixed-case name rather
15
+ * than folding it silently.
16
+ */
17
+ export declare const CommunityShortNameSchema: z.ZodString;
18
+ /**
19
+ * Where a hosted community is in its lifecycle.
20
+ *
21
+ * Mechanism: the Community server's own lifecycle names, plus `provisioning`
22
+ * for the moment between the service accepting a start and the server
23
+ * confirming it. A community a person has not yet claimed is `pending_owner`.
24
+ * A community that no longer exists does not appear at all.
25
+ */
26
+ export declare const HostedCommunityStateSchema: z.ZodEnum<{
27
+ active: "active";
28
+ provisioning: "provisioning";
29
+ pending_owner: "pending_owner";
30
+ archived: "archived";
31
+ held: "held";
32
+ suspended: "suspended";
33
+ deletion_pending: "deletion_pending";
34
+ }>;
35
+ /** Where a hosted community is in its lifecycle. */
36
+ export type HostedCommunityState = z.infer<typeof HostedCommunityStateSchema>;
37
+ /**
38
+ * Why a hosted community is on hold.
39
+ *
40
+ * A hold makes a community read-only: people can read it and its owner can
41
+ * export it, and nothing new can be written. The reason tells the app which
42
+ * way out to offer.
43
+ *
44
+ * - `over_limit`: the account holds more than its allowance covers. Choosing
45
+ * which communities to keep, or a larger allowance, lifts it.
46
+ * - `inactive`: the service paused a community nobody has posted in for a long
47
+ * time. Restoring it lifts it, when it fits the account's allowance.
48
+ * - `host`: the host placed the hold for its own reasons. The owner cannot lift
49
+ * it from the app; the community's `notice` says who to contact.
50
+ */
51
+ export declare const HostedCommunityHoldReasonSchema: z.ZodEnum<{
52
+ inactive: "inactive";
53
+ over_limit: "over_limit";
54
+ host: "host";
55
+ }>;
56
+ /** Why a hosted community is on hold. */
57
+ export type HostedCommunityHoldReason = z.infer<typeof HostedCommunityHoldReasonSchema>;
58
+ /**
59
+ * What the service wants the owner to read about a community, in its own words.
60
+ *
61
+ * The app shows `title` and `detail` as given and, when present, a button that
62
+ * opens `actionUrl`. It is how a host hold, a suspension or a planned deletion
63
+ * is explained honestly without this contract enumerating every reason a host
64
+ * might have. A malformed link or label is dropped, like the one on `Problem`,
65
+ * so a bad link never costs the owner the notice itself.
66
+ */
67
+ export declare const HostedCommunityNoticeSchema: z.ZodObject<{
68
+ title: z.ZodString;
69
+ detail: z.ZodString;
70
+ actionUrl: z.ZodCatch<z.ZodOptional<z.ZodURL>>;
71
+ actionLabel: z.ZodCatch<z.ZodOptional<z.ZodString>>;
72
+ }, z.core.$strip>;
73
+ /**
74
+ * Whether the owner may keep this community open, and what that would cost.
75
+ *
76
+ * `wouldHold` is the preview the app shows before the owner confirms: keeping
77
+ * this community can put others on hold. The keep request echoes it back as
78
+ * `expectedHeldCommunityIds`, so a choice made against a stale preview is
79
+ * refused rather than holding a community nobody was warned about.
80
+ */
81
+ export declare const HostedCommunityKeepActionSchema: z.ZodObject<{
82
+ allowed: z.ZodBoolean;
83
+ wouldHold: z.ZodArray<z.ZodString>;
84
+ }, z.core.$strip>;
85
+ /**
86
+ * One community the caller has hosted.
87
+ *
88
+ * `limits` and `usage` are numbers, never a plan: the app says "this community
89
+ * is full" from them without knowing what the caller bought. `actions` is the
90
+ * service's answer to "what may this person do next", so the app renders a
91
+ * button only when the service will accept it and never re-derives the rule.
92
+ * A new action arrives as a new optional field of `actions`.
93
+ *
94
+ * A `held` community always says why (`hold`), and one in `deletion_pending`
95
+ * always says when (`deletionAt`). The rules run one way only: a later release
96
+ * may carry a hold into another state (a held community whose deletion has
97
+ * started, for instance), and that must still parse.
98
+ *
99
+ * `state` and `hold.reason` are tolerant: a value added in a later release
100
+ * reads as `unrecognised` rather than failing the page it arrives in.
101
+ */
102
+ export declare const HostedCommunitySchema: z.ZodObject<{
103
+ communityId: z.ZodString;
104
+ orgId: z.ZodString;
105
+ name: z.ZodString;
106
+ shortName: z.ZodNullable<z.ZodString>;
107
+ communityUrl: z.ZodURL;
108
+ state: z.ZodUnion<readonly [z.ZodEnum<{
109
+ active: "active";
110
+ provisioning: "provisioning";
111
+ pending_owner: "pending_owner";
112
+ archived: "archived";
113
+ held: "held";
114
+ suspended: "suspended";
115
+ deletion_pending: "deletion_pending";
116
+ }>, z.ZodPipe<z.ZodString, z.ZodTransform<"unrecognised", string>>]>;
117
+ hold: z.ZodNullable<z.ZodObject<{
118
+ reason: z.ZodUnion<readonly [z.ZodEnum<{
119
+ inactive: "inactive";
120
+ over_limit: "over_limit";
121
+ host: "host";
122
+ }>, z.ZodPipe<z.ZodString, z.ZodTransform<"unrecognised", string>>]>;
123
+ since: z.ZodISODateTime;
124
+ deletionNoticeAt: z.ZodNullable<z.ZodISODateTime>;
125
+ }, z.core.$strip>>;
126
+ deletionAt: z.ZodNullable<z.ZodISODateTime>;
127
+ notice: z.ZodNullable<z.ZodObject<{
128
+ title: z.ZodString;
129
+ detail: z.ZodString;
130
+ actionUrl: z.ZodCatch<z.ZodOptional<z.ZodURL>>;
131
+ actionLabel: z.ZodCatch<z.ZodOptional<z.ZodString>>;
132
+ }, z.core.$strip>>;
133
+ kept: z.ZodBoolean;
134
+ moveId: z.ZodNullable<z.ZodString>;
135
+ limits: z.ZodObject<{
136
+ maxActiveMembers: z.ZodNullable<z.ZodNumber>;
137
+ maxStorageBytes: z.ZodNullable<z.ZodNumber>;
138
+ }, z.core.$strip>;
139
+ usage: z.ZodNullable<z.ZodObject<{
140
+ activeMembers: z.ZodNumber;
141
+ storageBytes: z.ZodNumber;
142
+ measuredAt: z.ZodISODateTime;
143
+ }, z.core.$strip>>;
144
+ actions: z.ZodObject<{
145
+ claimLink: z.ZodBoolean;
146
+ keep: z.ZodObject<{
147
+ allowed: z.ZodBoolean;
148
+ wouldHold: z.ZodArray<z.ZodString>;
149
+ }, z.core.$strip>;
150
+ restore: z.ZodBoolean;
151
+ }, z.core.$strip>;
152
+ createdAt: z.ZodISODateTime;
153
+ }, z.core.$strip>;
154
+ /** One community the caller has hosted. */
155
+ export type HostedCommunity = z.infer<typeof HostedCommunitySchema>;
156
+ /**
157
+ * `GET /v1/communities` — the caller's hosted communities.
158
+ *
159
+ * Every community the caller owns or started, across every organization they
160
+ * belong to, in no particular order. The app reads it to show what the caller
161
+ * already has, to finish a claim or a move after a restart, and to offer the
162
+ * way out of a hold.
163
+ */
164
+ export declare const HostedCommunityListResponseSchema: z.ZodObject<{
165
+ items: z.ZodArray<z.ZodObject<{
166
+ communityId: z.ZodString;
167
+ orgId: z.ZodString;
168
+ name: z.ZodString;
169
+ shortName: z.ZodNullable<z.ZodString>;
170
+ communityUrl: z.ZodURL;
171
+ state: z.ZodUnion<readonly [z.ZodEnum<{
172
+ active: "active";
173
+ provisioning: "provisioning";
174
+ pending_owner: "pending_owner";
175
+ archived: "archived";
176
+ held: "held";
177
+ suspended: "suspended";
178
+ deletion_pending: "deletion_pending";
179
+ }>, z.ZodPipe<z.ZodString, z.ZodTransform<"unrecognised", string>>]>;
180
+ hold: z.ZodNullable<z.ZodObject<{
181
+ reason: z.ZodUnion<readonly [z.ZodEnum<{
182
+ inactive: "inactive";
183
+ over_limit: "over_limit";
184
+ host: "host";
185
+ }>, z.ZodPipe<z.ZodString, z.ZodTransform<"unrecognised", string>>]>;
186
+ since: z.ZodISODateTime;
187
+ deletionNoticeAt: z.ZodNullable<z.ZodISODateTime>;
188
+ }, z.core.$strip>>;
189
+ deletionAt: z.ZodNullable<z.ZodISODateTime>;
190
+ notice: z.ZodNullable<z.ZodObject<{
191
+ title: z.ZodString;
192
+ detail: z.ZodString;
193
+ actionUrl: z.ZodCatch<z.ZodOptional<z.ZodURL>>;
194
+ actionLabel: z.ZodCatch<z.ZodOptional<z.ZodString>>;
195
+ }, z.core.$strip>>;
196
+ kept: z.ZodBoolean;
197
+ moveId: z.ZodNullable<z.ZodString>;
198
+ limits: z.ZodObject<{
199
+ maxActiveMembers: z.ZodNullable<z.ZodNumber>;
200
+ maxStorageBytes: z.ZodNullable<z.ZodNumber>;
201
+ }, z.core.$strip>;
202
+ usage: z.ZodNullable<z.ZodObject<{
203
+ activeMembers: z.ZodNumber;
204
+ storageBytes: z.ZodNumber;
205
+ measuredAt: z.ZodISODateTime;
206
+ }, z.core.$strip>>;
207
+ actions: z.ZodObject<{
208
+ claimLink: z.ZodBoolean;
209
+ keep: z.ZodObject<{
210
+ allowed: z.ZodBoolean;
211
+ wouldHold: z.ZodArray<z.ZodString>;
212
+ }, z.core.$strip>;
213
+ restore: z.ZodBoolean;
214
+ }, z.core.$strip>;
215
+ createdAt: z.ZodISODateTime;
216
+ }, z.core.$strip>>;
217
+ nextCursor: z.ZodNullable<z.ZodString>;
218
+ }, z.core.$strip>;
219
+ /** A page of the caller's hosted communities. */
220
+ export type HostedCommunityListResponse = z.infer<typeof HostedCommunityListResponseSchema>;
221
+ /** `GET /v1/communities/name-check` query parameters. */
222
+ export declare const CommunityNameCheckQuerySchema: z.ZodObject<{
223
+ name: z.ZodString;
224
+ }, z.core.$strip>;
225
+ /**
226
+ * Why a well-formed short name cannot be used.
227
+ *
228
+ * Mechanism, and the same two answers the start and move routes refuse with as
229
+ * `community_name_taken` and `community_name_reserved`. `taken` includes a name
230
+ * another community used recently and that is still held back.
231
+ */
232
+ export declare const CommunityNameUnavailableReasonSchema: z.ZodEnum<{
233
+ taken: "taken";
234
+ reserved: "reserved";
235
+ }>;
236
+ /**
237
+ * `GET /v1/communities/name-check` — is this short name free right now?
238
+ *
239
+ * Advisory: it lets the start form say "That web address is taken" while a
240
+ * person types. The start and move routes check again and are the only answer
241
+ * that binds, so a name free here can still be refused a moment later.
242
+ * `reason` is null exactly when `available` is true.
243
+ */
244
+ export declare const CommunityNameCheckResponseSchema: z.ZodObject<{
245
+ name: z.ZodString;
246
+ available: z.ZodBoolean;
247
+ reason: z.ZodNullable<z.ZodEnum<{
248
+ taken: "taken";
249
+ reserved: "reserved";
250
+ }>>;
251
+ }, z.core.$strip>;
252
+ /** Whether a short name is free right now. */
253
+ export type CommunityNameCheckResponse = z.infer<typeof CommunityNameCheckResponseSchema>;
254
+ /**
255
+ * `POST /v1/communities` — start a hosted community.
256
+ *
257
+ * Idempotent on `idempotencyKey`, scoped to the caller: the same key with the
258
+ * same body returns the same community (with `replayed: true`) rather than
259
+ * starting a second one, and the same key with a different body is refused
260
+ * with `conflict`. A refusal a larger allowance would lift is
261
+ * `entitlement_required`; a short name that cannot be used is
262
+ * `community_name_taken` or `community_name_reserved`.
263
+ */
264
+ export declare const CommunityStartRequestSchema: z.ZodObject<{
265
+ idempotencyKey: z.ZodString;
266
+ name: z.ZodString;
267
+ shortName: z.ZodOptional<z.ZodString>;
268
+ orgId: z.ZodOptional<z.ZodString>;
269
+ }, z.core.$strip>;
270
+ /** Start a hosted community. */
271
+ export type CommunityStartRequest = z.infer<typeof CommunityStartRequestSchema>;
272
+ /**
273
+ * A one-time link that makes a person the owner of a new community.
274
+ *
275
+ * The link carries a single-use credential. Open it in the person's own
276
+ * browser, never log it, and never show it to anyone else. Issuing a fresh one
277
+ * revokes the last.
278
+ */
279
+ export declare const CommunityClaimLinkSchema: z.ZodObject<{
280
+ communityId: z.ZodString;
281
+ claimUrl: z.ZodURL;
282
+ expiresAt: z.ZodISODateTime;
283
+ }, z.core.$strip>;
284
+ /** A one-time owner-claim link. */
285
+ export type CommunityClaimLink = z.infer<typeof CommunityClaimLinkSchema>;
286
+ /**
287
+ * The started community.
288
+ *
289
+ * The first answer carries the claim link, and no later answer does: the link
290
+ * is a single-use credential and the service keeps no copy it could return
291
+ * again. `claim` is therefore null when `replayed` is true, and also while the
292
+ * community is still `provisioning` (the Community server has not confirmed
293
+ * it yet). In both cases the app waits for `pending_owner` in the list and
294
+ * asks `POST /v1/communities/{communityId}/claim-link` for a link.
295
+ */
296
+ export declare const CommunityStartResponseSchema: z.ZodObject<{
297
+ community: z.ZodObject<{
298
+ communityId: z.ZodString;
299
+ orgId: z.ZodString;
300
+ name: z.ZodString;
301
+ shortName: z.ZodNullable<z.ZodString>;
302
+ communityUrl: z.ZodURL;
303
+ state: z.ZodUnion<readonly [z.ZodEnum<{
304
+ active: "active";
305
+ provisioning: "provisioning";
306
+ pending_owner: "pending_owner";
307
+ archived: "archived";
308
+ held: "held";
309
+ suspended: "suspended";
310
+ deletion_pending: "deletion_pending";
311
+ }>, z.ZodPipe<z.ZodString, z.ZodTransform<"unrecognised", string>>]>;
312
+ hold: z.ZodNullable<z.ZodObject<{
313
+ reason: z.ZodUnion<readonly [z.ZodEnum<{
314
+ inactive: "inactive";
315
+ over_limit: "over_limit";
316
+ host: "host";
317
+ }>, z.ZodPipe<z.ZodString, z.ZodTransform<"unrecognised", string>>]>;
318
+ since: z.ZodISODateTime;
319
+ deletionNoticeAt: z.ZodNullable<z.ZodISODateTime>;
320
+ }, z.core.$strip>>;
321
+ deletionAt: z.ZodNullable<z.ZodISODateTime>;
322
+ notice: z.ZodNullable<z.ZodObject<{
323
+ title: z.ZodString;
324
+ detail: z.ZodString;
325
+ actionUrl: z.ZodCatch<z.ZodOptional<z.ZodURL>>;
326
+ actionLabel: z.ZodCatch<z.ZodOptional<z.ZodString>>;
327
+ }, z.core.$strip>>;
328
+ kept: z.ZodBoolean;
329
+ moveId: z.ZodNullable<z.ZodString>;
330
+ limits: z.ZodObject<{
331
+ maxActiveMembers: z.ZodNullable<z.ZodNumber>;
332
+ maxStorageBytes: z.ZodNullable<z.ZodNumber>;
333
+ }, z.core.$strip>;
334
+ usage: z.ZodNullable<z.ZodObject<{
335
+ activeMembers: z.ZodNumber;
336
+ storageBytes: z.ZodNumber;
337
+ measuredAt: z.ZodISODateTime;
338
+ }, z.core.$strip>>;
339
+ actions: z.ZodObject<{
340
+ claimLink: z.ZodBoolean;
341
+ keep: z.ZodObject<{
342
+ allowed: z.ZodBoolean;
343
+ wouldHold: z.ZodArray<z.ZodString>;
344
+ }, z.core.$strip>;
345
+ restore: z.ZodBoolean;
346
+ }, z.core.$strip>;
347
+ createdAt: z.ZodISODateTime;
348
+ }, z.core.$strip>;
349
+ claim: z.ZodNullable<z.ZodObject<{
350
+ communityId: z.ZodString;
351
+ claimUrl: z.ZodURL;
352
+ expiresAt: z.ZodISODateTime;
353
+ }, z.core.$strip>>;
354
+ replayed: z.ZodBoolean;
355
+ }, z.core.$strip>;
356
+ /** The started community. */
357
+ export type CommunityStartResponse = z.infer<typeof CommunityStartResponseSchema>;
358
+ /**
359
+ * `POST /v1/communities/{communityId}/keep` — the request.
360
+ *
361
+ * `expectedHeldCommunityIds` is the `actions.keep.wouldHold` preview the owner
362
+ * confirmed. When the service would now hold a different set, it refuses with
363
+ * `conflict` and holds nothing, so the app refreshes the list and asks again.
364
+ */
365
+ export declare const CommunityKeepRequestSchema: z.ZodObject<{
366
+ expectedHeldCommunityIds: z.ZodArray<z.ZodString>;
367
+ }, z.core.$strip>;
368
+ /** Keep this community open. */
369
+ export type CommunityKeepRequest = z.infer<typeof CommunityKeepRequestSchema>;
370
+ /**
371
+ * `POST /v1/communities/{communityId}/keep` — keep this community open.
372
+ *
373
+ * For an account that holds more communities than its allowance covers: the
374
+ * owner chooses which stay open. The answer names every other community the
375
+ * choice put on hold, which is exactly the confirmed preview. When no choice
376
+ * would make room, the refusal is `entitlement_required` with the service's
377
+ * own words and an `actionUrl`.
378
+ */
379
+ export declare const CommunityKeepResponseSchema: z.ZodObject<{
380
+ community: z.ZodObject<{
381
+ communityId: z.ZodString;
382
+ orgId: z.ZodString;
383
+ name: z.ZodString;
384
+ shortName: z.ZodNullable<z.ZodString>;
385
+ communityUrl: z.ZodURL;
386
+ state: z.ZodUnion<readonly [z.ZodEnum<{
387
+ active: "active";
388
+ provisioning: "provisioning";
389
+ pending_owner: "pending_owner";
390
+ archived: "archived";
391
+ held: "held";
392
+ suspended: "suspended";
393
+ deletion_pending: "deletion_pending";
394
+ }>, z.ZodPipe<z.ZodString, z.ZodTransform<"unrecognised", string>>]>;
395
+ hold: z.ZodNullable<z.ZodObject<{
396
+ reason: z.ZodUnion<readonly [z.ZodEnum<{
397
+ inactive: "inactive";
398
+ over_limit: "over_limit";
399
+ host: "host";
400
+ }>, z.ZodPipe<z.ZodString, z.ZodTransform<"unrecognised", string>>]>;
401
+ since: z.ZodISODateTime;
402
+ deletionNoticeAt: z.ZodNullable<z.ZodISODateTime>;
403
+ }, z.core.$strip>>;
404
+ deletionAt: z.ZodNullable<z.ZodISODateTime>;
405
+ notice: z.ZodNullable<z.ZodObject<{
406
+ title: z.ZodString;
407
+ detail: z.ZodString;
408
+ actionUrl: z.ZodCatch<z.ZodOptional<z.ZodURL>>;
409
+ actionLabel: z.ZodCatch<z.ZodOptional<z.ZodString>>;
410
+ }, z.core.$strip>>;
411
+ kept: z.ZodBoolean;
412
+ moveId: z.ZodNullable<z.ZodString>;
413
+ limits: z.ZodObject<{
414
+ maxActiveMembers: z.ZodNullable<z.ZodNumber>;
415
+ maxStorageBytes: z.ZodNullable<z.ZodNumber>;
416
+ }, z.core.$strip>;
417
+ usage: z.ZodNullable<z.ZodObject<{
418
+ activeMembers: z.ZodNumber;
419
+ storageBytes: z.ZodNumber;
420
+ measuredAt: z.ZodISODateTime;
421
+ }, z.core.$strip>>;
422
+ actions: z.ZodObject<{
423
+ claimLink: z.ZodBoolean;
424
+ keep: z.ZodObject<{
425
+ allowed: z.ZodBoolean;
426
+ wouldHold: z.ZodArray<z.ZodString>;
427
+ }, z.core.$strip>;
428
+ restore: z.ZodBoolean;
429
+ }, z.core.$strip>;
430
+ createdAt: z.ZodISODateTime;
431
+ }, z.core.$strip>;
432
+ heldCommunityIds: z.ZodArray<z.ZodString>;
433
+ }, z.core.$strip>;
434
+ /** The kept community, and every community the choice put on hold. */
435
+ export type CommunityKeepResponse = z.infer<typeof CommunityKeepResponseSchema>;
436
+ /**
437
+ * Where a move is.
438
+ *
439
+ * Mechanism: the stages of reading an owner export into a new community.
440
+ * `ready` means the history is in and the community waits for its owner to
441
+ * claim it; `claimed` means they have.
442
+ */
443
+ export declare const CommunityMoveStateSchema: z.ZodEnum<{
444
+ awaiting_upload: "awaiting_upload";
445
+ importing: "importing";
446
+ ready: "ready";
447
+ failed: "failed";
448
+ cancelled: "cancelled";
449
+ claimed: "claimed";
450
+ }>;
451
+ /** Where a move is. */
452
+ export type CommunityMoveState = z.infer<typeof CommunityMoveStateSchema>;
453
+ /**
454
+ * Why a move failed, in terms a person can act on.
455
+ *
456
+ * Mechanism, one member per thing the app says differently:
457
+ *
458
+ * - `not_owner_export`: the file is a personal export, not the owner's.
459
+ * - `archive_invalid`: the file is damaged or not a community export at all.
460
+ * - `checksum_mismatch`: a file inside the export does not match the export's
461
+ * own record of it, so the export itself is damaged. Export again.
462
+ * - `version_unsupported`: the export is from a version this host cannot read.
463
+ * - `too_large`: the export is larger than any single move may be.
464
+ * - `storage_limit_reached`: the files do not fit the community's storage limit.
465
+ * - `upload_expired`: the export did not arrive before the upload window closed.
466
+ * - `storage_unavailable`: the host could not store the files. Trying again later may work.
467
+ *
468
+ * An upload whose bytes do not match the declared size or digest is not a
469
+ * failure of the move: the upload is refused and the move stays
470
+ * `awaiting_upload` (see {@link CommunityMoveUploadSchema}). An upload window
471
+ * that closes before a matching file arrives is `upload_expired`.
472
+ */
473
+ export declare const CommunityMoveFailureCodeSchema: z.ZodEnum<{
474
+ not_owner_export: "not_owner_export";
475
+ archive_invalid: "archive_invalid";
476
+ checksum_mismatch: "checksum_mismatch";
477
+ version_unsupported: "version_unsupported";
478
+ too_large: "too_large";
479
+ storage_limit_reached: "storage_limit_reached";
480
+ upload_expired: "upload_expired";
481
+ storage_unavailable: "storage_unavailable";
482
+ }>;
483
+ /** Why a move failed. */
484
+ export type CommunityMoveFailureCode = z.infer<typeof CommunityMoveFailureCodeSchema>;
485
+ /**
486
+ * What an owner export holds, measured before anything is restored.
487
+ *
488
+ * Counts and sizes only. No channel name, file name, person or text ever
489
+ * appears here.
490
+ */
491
+ export declare const CommunityMoveReportSchema: z.ZodObject<{
492
+ channels: z.ZodNumber;
493
+ entries: z.ZodNumber;
494
+ attachments: z.ZodNumber;
495
+ historicalMembers: z.ZodNumber;
496
+ historicalAgents: z.ZodNumber;
497
+ attachmentBytes: z.ZodNumber;
498
+ countedBytes: z.ZodNumber;
499
+ }, z.core.$strip>;
500
+ /**
501
+ * One move of a community into hosting, from an owner export.
502
+ *
503
+ * A move fills a brand-new community. The old community is never touched and
504
+ * keeps running until its owner deletes it. Nothing of the new community is
505
+ * visible until the whole export is in. A failed or cancelled move removes the
506
+ * new community and everything uploaded for it, and frees its short name at
507
+ * once, so starting again with the same name works.
508
+ *
509
+ * A `failed` move always says why (`failureCode`); the rule runs one way only.
510
+ * `state` and `failureCode` are tolerant: a value added in a later release
511
+ * reads as `unrecognised` rather than failing the page it arrives in.
512
+ */
513
+ export declare const CommunityMoveSchema: z.ZodObject<{
514
+ moveId: z.ZodString;
515
+ communityId: z.ZodString;
516
+ communityUrl: z.ZodURL;
517
+ name: z.ZodString;
518
+ state: z.ZodUnion<readonly [z.ZodEnum<{
519
+ awaiting_upload: "awaiting_upload";
520
+ importing: "importing";
521
+ ready: "ready";
522
+ failed: "failed";
523
+ cancelled: "cancelled";
524
+ claimed: "claimed";
525
+ }>, z.ZodPipe<z.ZodString, z.ZodTransform<"unrecognised", string>>]>;
526
+ failureCode: z.ZodNullable<z.ZodUnion<readonly [z.ZodEnum<{
527
+ not_owner_export: "not_owner_export";
528
+ archive_invalid: "archive_invalid";
529
+ checksum_mismatch: "checksum_mismatch";
530
+ version_unsupported: "version_unsupported";
531
+ too_large: "too_large";
532
+ storage_limit_reached: "storage_limit_reached";
533
+ upload_expired: "upload_expired";
534
+ storage_unavailable: "storage_unavailable";
535
+ }>, z.ZodPipe<z.ZodString, z.ZodTransform<"unrecognised", string>>]>>;
536
+ report: z.ZodNullable<z.ZodObject<{
537
+ channels: z.ZodNumber;
538
+ entries: z.ZodNumber;
539
+ attachments: z.ZodNumber;
540
+ historicalMembers: z.ZodNumber;
541
+ historicalAgents: z.ZodNumber;
542
+ attachmentBytes: z.ZodNumber;
543
+ countedBytes: z.ZodNumber;
544
+ }, z.core.$strip>>;
545
+ pollAfterMs: z.ZodNullable<z.ZodNumber>;
546
+ updatedAt: z.ZodISODateTime;
547
+ }, z.core.$strip>;
548
+ /** One move of a community into hosting. */
549
+ export type CommunityMove = z.infer<typeof CommunityMoveSchema>;
550
+ /**
551
+ * `GET /v1/communities/moves` — the caller's moves.
552
+ *
553
+ * Every unfinished move, and every move that finished (failed, cancelled or
554
+ * claimed) within the last seven days, newest first. It is how the app shows
555
+ * a failed move to a person who closed the app while it was importing: the
556
+ * new community is gone by then, so the hosted-community list cannot.
557
+ */
558
+ export declare const CommunityMoveListResponseSchema: z.ZodObject<{
559
+ items: z.ZodArray<z.ZodObject<{
560
+ moveId: z.ZodString;
561
+ communityId: z.ZodString;
562
+ communityUrl: z.ZodURL;
563
+ name: z.ZodString;
564
+ state: z.ZodUnion<readonly [z.ZodEnum<{
565
+ awaiting_upload: "awaiting_upload";
566
+ importing: "importing";
567
+ ready: "ready";
568
+ failed: "failed";
569
+ cancelled: "cancelled";
570
+ claimed: "claimed";
571
+ }>, z.ZodPipe<z.ZodString, z.ZodTransform<"unrecognised", string>>]>;
572
+ failureCode: z.ZodNullable<z.ZodUnion<readonly [z.ZodEnum<{
573
+ not_owner_export: "not_owner_export";
574
+ archive_invalid: "archive_invalid";
575
+ checksum_mismatch: "checksum_mismatch";
576
+ version_unsupported: "version_unsupported";
577
+ too_large: "too_large";
578
+ storage_limit_reached: "storage_limit_reached";
579
+ upload_expired: "upload_expired";
580
+ storage_unavailable: "storage_unavailable";
581
+ }>, z.ZodPipe<z.ZodString, z.ZodTransform<"unrecognised", string>>]>>;
582
+ report: z.ZodNullable<z.ZodObject<{
583
+ channels: z.ZodNumber;
584
+ entries: z.ZodNumber;
585
+ attachments: z.ZodNumber;
586
+ historicalMembers: z.ZodNumber;
587
+ historicalAgents: z.ZodNumber;
588
+ attachmentBytes: z.ZodNumber;
589
+ countedBytes: z.ZodNumber;
590
+ }, z.core.$strip>>;
591
+ pollAfterMs: z.ZodNullable<z.ZodNumber>;
592
+ updatedAt: z.ZodISODateTime;
593
+ }, z.core.$strip>>;
594
+ nextCursor: z.ZodNullable<z.ZodString>;
595
+ }, z.core.$strip>;
596
+ /** A page of the caller's moves. */
597
+ export type CommunityMoveListResponse = z.infer<typeof CommunityMoveListResponseSchema>;
598
+ /**
599
+ * `POST /v1/communities/moves` — start a move.
600
+ *
601
+ * The caller names the export by size and digest before sending a byte, so a
602
+ * file too large for a move is refused with `import_too_large`, and one that
603
+ * would not fit the account with `entitlement_required`, before an upload
604
+ * starts. Idempotent on the caller's key, like a start.
605
+ */
606
+ export declare const CommunityMoveStartRequestSchema: z.ZodObject<{
607
+ idempotencyKey: z.ZodString;
608
+ name: z.ZodString;
609
+ shortName: z.ZodOptional<z.ZodString>;
610
+ orgId: z.ZodOptional<z.ZodString>;
611
+ archiveBytes: z.ZodNumber;
612
+ archiveSha256: z.ZodString;
613
+ }, z.core.$strip>;
614
+ /** Start moving a community in from an owner export. */
615
+ export type CommunityMoveStartRequest = z.infer<typeof CommunityMoveStartRequestSchema>;
616
+ /**
617
+ * The header that carries an export's digest on its upload, as lower-case hex.
618
+ *
619
+ * The Community server compares it with the bytes it received and refuses the
620
+ * upload when they differ.
621
+ */
622
+ export declare const COMMUNITY_ARCHIVE_DIGEST_HEADER: "X-Archive-SHA256";
623
+ /**
624
+ * Where to send the export file.
625
+ *
626
+ * Send the file's exact bytes with `PUT` to `url`, with `token` as a bearer
627
+ * credential, `Content-Length` set to the declared size, and the declared
628
+ * digest in the {@link COMMUNITY_ARCHIVE_DIGEST_HEADER} header. The URL is the
629
+ * Community server's own upload route, so the file goes straight to the host
630
+ * and never through the hosting service.
631
+ *
632
+ * What the Community server answers, in its own error envelope (a JSON body
633
+ * with a `code`, not this contract's `Problem`):
634
+ *
635
+ * - success: the token is spent and the move goes on to `importing`;
636
+ * - `400 IMPORT_ARCHIVE_INVALID`: the bytes did not match the declared size or
637
+ * digest. Nothing is kept, the move stays `awaiting_upload`, and the same
638
+ * token may be used again until `expiresAt`;
639
+ * - a dropped connection part-way: the same, the token still works;
640
+ * - `401`: the upload window has closed. The move is then `failed` with
641
+ * `upload_expired`, and the app starts a new move. A failed move frees its
642
+ * short name at once, so the new move can use the same one.
643
+ */
644
+ export declare const CommunityMoveUploadSchema: z.ZodObject<{
645
+ url: z.ZodURL;
646
+ token: z.ZodString;
647
+ expiresAt: z.ZodISODateTime;
648
+ maxBytes: z.ZodNumber;
649
+ }, z.core.$strip>;
650
+ /** Where and how to send the export file. */
651
+ export type CommunityMoveUpload = z.infer<typeof CommunityMoveUploadSchema>;
652
+ /**
653
+ * The started move.
654
+ *
655
+ * The first answer carries the upload target, and no later answer does: the
656
+ * token is a credential the service keeps no copy of. `upload` is therefore
657
+ * null exactly when `replayed` is true. A caller that lost it cancels the move
658
+ * and starts a new one; cancelling frees the short name at once.
659
+ */
660
+ export declare const CommunityMoveStartResponseSchema: z.ZodObject<{
661
+ move: z.ZodObject<{
662
+ moveId: z.ZodString;
663
+ communityId: z.ZodString;
664
+ communityUrl: z.ZodURL;
665
+ name: z.ZodString;
666
+ state: z.ZodUnion<readonly [z.ZodEnum<{
667
+ awaiting_upload: "awaiting_upload";
668
+ importing: "importing";
669
+ ready: "ready";
670
+ failed: "failed";
671
+ cancelled: "cancelled";
672
+ claimed: "claimed";
673
+ }>, z.ZodPipe<z.ZodString, z.ZodTransform<"unrecognised", string>>]>;
674
+ failureCode: z.ZodNullable<z.ZodUnion<readonly [z.ZodEnum<{
675
+ not_owner_export: "not_owner_export";
676
+ archive_invalid: "archive_invalid";
677
+ checksum_mismatch: "checksum_mismatch";
678
+ version_unsupported: "version_unsupported";
679
+ too_large: "too_large";
680
+ storage_limit_reached: "storage_limit_reached";
681
+ upload_expired: "upload_expired";
682
+ storage_unavailable: "storage_unavailable";
683
+ }>, z.ZodPipe<z.ZodString, z.ZodTransform<"unrecognised", string>>]>>;
684
+ report: z.ZodNullable<z.ZodObject<{
685
+ channels: z.ZodNumber;
686
+ entries: z.ZodNumber;
687
+ attachments: z.ZodNumber;
688
+ historicalMembers: z.ZodNumber;
689
+ historicalAgents: z.ZodNumber;
690
+ attachmentBytes: z.ZodNumber;
691
+ countedBytes: z.ZodNumber;
692
+ }, z.core.$strip>>;
693
+ pollAfterMs: z.ZodNullable<z.ZodNumber>;
694
+ updatedAt: z.ZodISODateTime;
695
+ }, z.core.$strip>;
696
+ upload: z.ZodNullable<z.ZodObject<{
697
+ url: z.ZodURL;
698
+ token: z.ZodString;
699
+ expiresAt: z.ZodISODateTime;
700
+ maxBytes: z.ZodNumber;
701
+ }, z.core.$strip>>;
702
+ replayed: z.ZodBoolean;
703
+ }, z.core.$strip>;
704
+ /** The started move. */
705
+ export type CommunityMoveStartResponse = z.infer<typeof CommunityMoveStartResponseSchema>;
706
+ //# sourceMappingURL=communities.d.ts.map