@open-pencil/cloud 0.17.0-beta.4 → 0.17.0-beta.5

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 (206) hide show
  1. package/README.md +2 -1
  2. package/dist/bin/server.mjs +1 -1
  3. package/dist/bin/server.mjs.map +1 -1
  4. package/dist/bin/services.mjs +1 -1
  5. package/dist/bin/services.mjs.map +1 -1
  6. package/dist/client.d.ts +296 -27
  7. package/dist/client.d.ts.map +1 -1
  8. package/dist/client.js +649 -295
  9. package/dist/client.js.map +1 -1
  10. package/dist/contract.d.ts +2 -2
  11. package/dist/contract.js +2 -2
  12. package/dist/contract2.js +331 -21
  13. package/dist/contract2.js.map +1 -1
  14. package/dist/email.d.ts +1773 -32
  15. package/dist/email.d.ts.map +1 -1
  16. package/dist/email.js +3478 -288
  17. package/dist/email.js.map +1 -1
  18. package/dist/errors.d.ts +2 -0
  19. package/dist/errors.js +48 -0
  20. package/dist/errors.js.map +1 -0
  21. package/dist/index.d.ts +466 -13
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index2.d.ts +35 -0
  24. package/dist/index2.d.ts.map +1 -0
  25. package/dist/listen.mjs +447 -290
  26. package/dist/listen.mjs.map +1 -1
  27. package/dist/runtime-cloudflare.d.ts +89 -0
  28. package/dist/runtime-cloudflare.d.ts.map +1 -0
  29. package/dist/runtime-cloudflare.js +15667 -0
  30. package/dist/runtime-cloudflare.js.map +1 -0
  31. package/dist/runtime-node.d.mts +2963 -294
  32. package/dist/runtime-node.d.mts.map +1 -1
  33. package/dist/server.d.ts +3473 -842
  34. package/dist/server.d.ts.map +1 -1
  35. package/dist/server.js +12187 -8244
  36. package/dist/server.js.map +1 -1
  37. package/dist/server.mjs +7739 -3548
  38. package/dist/server.mjs.map +1 -1
  39. package/dist/server2.mjs +5 -5
  40. package/dist/server2.mjs.map +1 -1
  41. package/package.json +22 -5
  42. package/src/admin/audit/service.ts +2 -2
  43. package/src/admin/documents/service.ts +76 -6
  44. package/src/admin/reports/service.ts +7 -1
  45. package/src/client/api.ts +23 -471
  46. package/src/client/auth/client.ts +22 -3
  47. package/src/client/billing.ts +80 -0
  48. package/src/client/community.ts +40 -0
  49. package/src/client/discovery.ts +35 -9
  50. package/src/client/documents.ts +160 -0
  51. package/src/client/index.ts +7 -0
  52. package/src/client/portal/account.ts +54 -2
  53. package/src/client/portal/request.ts +2 -0
  54. package/src/client/response.ts +21 -0
  55. package/src/client/schema.ts +8 -0
  56. package/src/client/services.ts +23 -18
  57. package/src/client/sharing.ts +262 -0
  58. package/src/client/versions.ts +104 -0
  59. package/src/contract/account.ts +50 -0
  60. package/src/contract/billing.ts +166 -0
  61. package/src/contract/collaboration.ts +5 -0
  62. package/src/contract/community.ts +60 -0
  63. package/src/contract/discovery.ts +63 -2
  64. package/src/contract/entitlements.ts +10 -0
  65. package/src/contract/index.ts +54 -5
  66. package/src/contract/links.ts +57 -4
  67. package/src/contract/locale.ts +27 -0
  68. package/src/contract/portal.ts +12 -1
  69. package/src/contract/routes.ts +10 -0
  70. package/src/contract/services.ts +18 -16
  71. package/src/email/i18n.ts +174 -0
  72. package/src/email/index.ts +13 -2
  73. package/src/email/locales/ar.json +141 -0
  74. package/src/email/locales/de.json +141 -0
  75. package/src/email/locales/es.json +141 -0
  76. package/src/email/locales/fr.json +141 -0
  77. package/src/email/locales/it.json +141 -0
  78. package/src/email/locales/ja.json +141 -0
  79. package/src/email/locales/pl.json +141 -0
  80. package/src/email/locales/pt-br.json +141 -0
  81. package/src/email/locales/ru.json +141 -0
  82. package/src/email/locales/zh-cn.json +141 -0
  83. package/src/email/messages.ts +200 -0
  84. package/src/email/render.ts +142 -276
  85. package/src/email/samples.ts +115 -0
  86. package/src/email/schema.ts +70 -6
  87. package/src/email/templates/BrandEmail.vue +54 -0
  88. package/src/email/templates/DocumentBlocked.vue +45 -0
  89. package/src/email/templates/DocumentInvitation.vue +24 -0
  90. package/src/email/templates/DocumentReport.vue +32 -0
  91. package/src/email/templates/DocumentReportDecided.vue +36 -0
  92. package/src/email/templates/DocumentReportReceived.vue +18 -0
  93. package/src/email/templates/DocumentRestored.vue +24 -0
  94. package/src/email/templates/EmailChangeRequested.vue +24 -0
  95. package/src/email/templates/EmailRoot.vue +19 -0
  96. package/src/email/templates/EmailText.vue +9 -0
  97. package/src/email/templates/EmailVerification.vue +38 -0
  98. package/src/email/templates/EnrollmentNotification.vue +24 -0
  99. package/src/email/templates/EnrollmentUpdate.vue +52 -0
  100. package/src/email/templates/NewSignIn.vue +37 -0
  101. package/src/email/templates/PasswordChanged.vue +22 -0
  102. package/src/email/templates/PasswordReset.vue +23 -0
  103. package/src/email/templates/StorageLimitReached.vue +28 -0
  104. package/src/email/templates/TwoStepChanged.vue +32 -0
  105. package/src/email/templates/WaitlistConfirmation.vue +29 -0
  106. package/src/email/templates/WorkspaceInvitation.vue +28 -0
  107. package/src/email/templates/brand.ts +9 -61
  108. package/src/email/templates/localization.ts +17 -0
  109. package/src/errors/index.ts +6 -0
  110. package/src/global.d.ts +7 -0
  111. package/src/runtime/cloudflare/relay/index.ts +7 -1
  112. package/src/runtime/cloudflare/tsconfig.json +2 -1
  113. package/src/runtime/cloudflare/worker.ts +8 -1
  114. package/src/runtime/node/cleanup.ts +5 -1
  115. package/src/runtime/node/email/transport.ts +13 -10
  116. package/src/runtime/node/main.ts +1 -1
  117. package/src/runtime/node/server.ts +12 -2
  118. package/src/runtime/node/services/main.ts +1 -1
  119. package/src/runtime/posthog/errors.ts +2 -1
  120. package/src/runtime/s3/objects.ts +17 -0
  121. package/src/runtime/site/community.ts +101 -0
  122. package/src/runtime/site/server.ts +17 -1
  123. package/src/server/account/deletion.ts +2 -0
  124. package/src/server/account/routes.ts +271 -240
  125. package/src/server/account/tokens.ts +57 -0
  126. package/src/server/api/router.ts +23 -0
  127. package/src/server/app/checks.ts +84 -0
  128. package/src/server/app/editors.ts +20 -0
  129. package/src/server/app/index.ts +128 -0
  130. package/src/server/app/indexing.ts +40 -0
  131. package/src/server/app/limiters.ts +53 -0
  132. package/src/server/app/routes.ts +114 -0
  133. package/src/server/app/services.ts +185 -0
  134. package/src/server/auth/access-tokens.ts +62 -0
  135. package/src/server/auth/adapter.ts +21 -1
  136. package/src/server/auth/email.ts +4 -1
  137. package/src/server/auth/enrollment.ts +116 -0
  138. package/src/server/auth/factory.ts +88 -131
  139. package/src/server/auth/logger.ts +23 -0
  140. package/src/server/auth/mfa-assurance.ts +51 -0
  141. package/src/server/auth/passwords.ts +43 -0
  142. package/src/server/auth/session.ts +2 -0
  143. package/src/server/billing/index.ts +6 -0
  144. package/src/server/billing/routes.ts +27 -0
  145. package/src/server/billing/tokens.ts +37 -0
  146. package/src/server/cleanup/configured.ts +16 -3
  147. package/src/server/cleanup/worker.ts +10 -1
  148. package/src/server/collaboration/relay/hub.ts +25 -142
  149. package/src/server/collaboration/relay/room.ts +154 -0
  150. package/src/server/collaboration/service.ts +21 -2
  151. package/src/server/community/index.ts +2 -0
  152. package/src/server/community/routes.ts +93 -0
  153. package/src/server/community/service.ts +134 -0
  154. package/src/server/config/deployment.ts +17 -5
  155. package/src/server/config/index.ts +1 -1
  156. package/src/server/config/public.ts +7 -1
  157. package/src/server/config/schema.ts +40 -292
  158. package/src/server/config/toml/schema.ts +307 -0
  159. package/src/server/db/index.ts +1 -0
  160. package/src/server/db/migrate.ts +13 -1
  161. package/src/server/db/migrations/009_access_tokens.ts +47 -0
  162. package/src/server/db/migrations/010_storage_limit_notices.ts +50 -0
  163. package/src/server/db/migrations/011_account_ids.ts +30 -0
  164. package/src/server/db/migrations/012_email_locales.ts +34 -0
  165. package/src/server/db/migrations/013_document_block_emails.ts +40 -0
  166. package/src/server/db/migrations/014_report_replies.ts +28 -0
  167. package/src/server/db/migrations/schema.ts +26 -1
  168. package/src/server/db/tables.ts +30 -1
  169. package/src/server/db/users.ts +22 -0
  170. package/src/server/documents/index.ts +1 -1
  171. package/src/server/documents/limits.ts +7 -1
  172. package/src/server/documents/service.ts +12 -402
  173. package/src/server/documents/uploads.ts +450 -0
  174. package/src/server/documents/versions/service.ts +81 -24
  175. package/src/server/email/invitations.ts +1 -0
  176. package/src/server/email/service.ts +31 -4
  177. package/src/server/email/types.ts +12 -0
  178. package/src/server/errors/index.ts +1 -9
  179. package/src/server/index.ts +12 -5
  180. package/src/server/invitations/types.ts +5 -1
  181. package/src/server/objects/types.ts +5 -0
  182. package/src/server/policy/configured.ts +9 -3
  183. package/src/server/policy/database.ts +13 -2
  184. package/src/server/policy/policy.ts +39 -12
  185. package/src/server/policy/service.ts +71 -52
  186. package/src/server/policy/storage.ts +33 -0
  187. package/src/server/quota/index.ts +6 -0
  188. package/src/server/quota/notices.ts +121 -0
  189. package/src/server/quota/storage.ts +5 -0
  190. package/src/server/rate-limit/middleware.ts +4 -0
  191. package/src/server/reports/index.ts +1 -0
  192. package/src/server/reports/replies.ts +55 -0
  193. package/src/server/reports/routes.ts +3 -1
  194. package/src/server/reports/service.ts +24 -2
  195. package/src/server/sharing/capabilities/service.ts +2 -3
  196. package/src/server/sharing/invitations/service.ts +14 -4
  197. package/src/server/validation.ts +3 -0
  198. package/src/server/workspaces/members.ts +7 -19
  199. package/src/services/app.ts +1 -3
  200. package/src/services/config.ts +1 -0
  201. package/src/services/usage.ts +6 -14
  202. package/src/email/templates/document-invitation.ts +0 -35
  203. package/src/email/templates/enrollment.ts +0 -27
  204. package/src/email/templates/layout.ts +0 -18
  205. package/src/server/app.ts +0 -453
  206. /package/src/{server/errors → errors}/posthog.ts +0 -0
package/dist/contract2.js CHANGED
@@ -98,6 +98,40 @@ const cloudPasskeySchema = v.object({
98
98
  });
99
99
  const cloudPasskeysResponseSchema = v.object({ passkeys: v.array(cloudPasskeySchema) });
100
100
  const cloudPasskeyDeleteSchema = v.object({ id: v.string() });
101
+ /**
102
+ * Personal access tokens: an account's own credentials for scripts and CI, sent as
103
+ * `Authorization: Bearer <token>`. A token acts as its account on the document API only; it never
104
+ * changes how the account is reached, makes other tokens, or reaches administration.
105
+ */
106
+ const CLOUD_ACCESS_TOKEN_PREFIX = "opc_";
107
+ const CLOUD_ACCESS_TOKEN_NAME_MAX_LENGTH = 64;
108
+ const CLOUD_ACCESS_TOKEN_MAX_DAYS = 365;
109
+ const cloudAccessTokenSchema = v.object({
110
+ id: v.string(),
111
+ name: v.string(),
112
+ /** The token's first characters, prefix included, to tell tokens apart; never the whole token. */
113
+ start: v.nullable(v.string()),
114
+ createdAt: v.string(),
115
+ expiresAt: v.nullable(v.string()),
116
+ lastUsedAt: v.nullable(v.string())
117
+ });
118
+ const cloudAccessTokensResponseSchema = v.object({ tokens: v.array(cloudAccessTokenSchema) });
119
+ const cloudAccessTokenCreateSchema = v.object({
120
+ name: v.pipe(v.string(), v.trim(), v.minLength(1), v.maxLength(64)),
121
+ expiresInDays: v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(365))
122
+ });
123
+ /** A new token, the only time the whole of it is shown. */
124
+ const cloudAccessTokenCreatedResponseSchema = v.object({
125
+ token: v.pipe(v.string(), v.startsWith(CLOUD_ACCESS_TOKEN_PREFIX)),
126
+ accessToken: cloudAccessTokenSchema
127
+ });
128
+ const cloudAccessTokenRevokeSchema = v.object({ id: v.pipe(v.string(), v.minLength(1)) });
129
+ function parseCloudAccessTokenCreate(input) {
130
+ return v.parse(cloudAccessTokenCreateSchema, input);
131
+ }
132
+ function parseCloudAccessTokenRevoke(input) {
133
+ return v.parse(cloudAccessTokenRevokeSchema, input);
134
+ }
101
135
  function parseCloudTermsAcceptance(input) {
102
136
  return v.parse(cloudTermsAcceptanceSchema, input);
103
137
  }
@@ -230,6 +264,26 @@ function parseCloudSessionRevoke(input) {
230
264
  return v.parse(cloudSessionRevokeSchema, input);
231
265
  }
232
266
  //#endregion
267
+ //#region src/contract/locale.ts
268
+ /** Whether `tag` is a well-formed BCP 47 language tag: `de`, `pt-BR`, `zh-Hant-TW`. */
269
+ function isLanguageTag(tag) {
270
+ try {
271
+ return Intl.getCanonicalLocales(tag).length === 1;
272
+ } catch {
273
+ return false;
274
+ }
275
+ }
276
+ /**
277
+ * A language as the app names it, which the server writes email in when it has that language, or
278
+ * the nearest it has, and otherwise in English.
279
+ */
280
+ const cloudLanguageTagSchema = v.pipe(v.string(), v.maxLength(35), v.check(isLanguageTag, "Not a language tag"));
281
+ /** The language an account's email is written in, as the app last said it uses. */
282
+ const cloudLocaleUpdateSchema = v.object({ locale: cloudLanguageTagSchema });
283
+ function parseCloudLocaleUpdate(input) {
284
+ return v.parse(cloudLocaleUpdateSchema, input);
285
+ }
286
+ //#endregion
233
287
  //#region src/contract/services.ts
234
288
  /**
235
289
  * The contract between editors, Cloud, and the services Cloud advertises: AI models today, and
@@ -255,13 +309,12 @@ const CLOUD_SERVICES_API_PATHS = {
255
309
  usage: "/v1/usage",
256
310
  search: "/v1/search"
257
311
  };
258
- const urlSchema = v.pipe(v.string(), v.url());
259
- const creditsSchema = v.pipe(v.number(), v.integer(), v.minValue(0));
312
+ const urlSchema$1 = v.pipe(v.string(), v.url());
313
+ const creditsSchema$1 = v.pipe(v.number(), v.integer(), v.minValue(0));
260
314
  const cloudServicesDiscoverySchema = v.object({
261
- endpoint: urlSchema,
315
+ endpoint: urlSchema$1,
262
316
  contractVersion: v.literal("1")
263
317
  });
264
- const cloudBillingDiscoverySchema = v.object({ portalURL: urlSchema });
265
318
  const createServicesTokenSchema = v.object({ workspaceId: v.pipe(v.string(), v.uuid()) });
266
319
  function parseCreateServicesToken(input) {
267
320
  return v.parse(createServicesTokenSchema, input);
@@ -272,18 +325,17 @@ const servicesTokenSchema = v.object({
272
325
  });
273
326
  /** What a service may rely on once a token's signature, issuer, audience, and expiry check. */
274
327
  const servicesTokenClaimsSchema = v.object({
275
- iss: urlSchema,
328
+ iss: urlSchema$1,
276
329
  aud: v.literal(CLOUD_SERVICES_TOKEN_AUDIENCE),
277
330
  sub: v.pipe(v.string(), v.minLength(1)),
278
331
  workspaceId: v.pipe(v.string(), v.uuid()),
279
332
  /**
280
333
  * The account whose credits the request spends: the workspace's owner, whose allowance every
281
- * workspace they own shares. Absent from tokens a Cloud from before account plans issued, which
282
- * a relay takes as the workspace's own allowance, as such a Cloud meant.
334
+ * workspace they own shares.
283
335
  */
284
- accountId: v.optional(v.pipe(v.string(), v.minLength(1))),
336
+ accountId: v.pipe(v.string(), v.minLength(1)),
285
337
  /** Credits the owner's plan grants each month; `null` when Cloud sets no allowance. */
286
- monthlyCreditAllowance: v.nullable(creditsSchema),
338
+ monthlyCreditAllowance: v.nullable(creditsSchema$1),
287
339
  iat: v.pipe(v.number(), v.integer()),
288
340
  exp: v.pipe(v.number(), v.integer())
289
341
  });
@@ -291,8 +343,8 @@ const chatModelSchema = v.object({
291
343
  id: v.pipe(v.string(), v.minLength(1)),
292
344
  label: v.pipe(v.string(), v.minLength(1)),
293
345
  /** Credits per million input and output tokens. */
294
- creditsPerMillionInputTokens: creditsSchema,
295
- creditsPerMillionOutputTokens: creditsSchema,
346
+ creditsPerMillionInputTokens: creditsSchema$1,
347
+ creditsPerMillionOutputTokens: creditsSchema$1,
296
348
  contextTokens: v.pipe(v.number(), v.integer(), v.minValue(1)),
297
349
  capabilities: v.object({
298
350
  reasoning: v.boolean(),
@@ -301,7 +353,7 @@ const chatModelSchema = v.object({
301
353
  })
302
354
  });
303
355
  /** What one web search costs; a service without search leaves it out of its catalog. */
304
- const searchPricingSchema = v.object({ creditsPerRequest: creditsSchema });
356
+ const searchPricingSchema = v.object({ creditsPerRequest: creditsSchema$1 });
305
357
  const serviceCatalogSchema = v.object({
306
358
  models: v.array(chatModelSchema),
307
359
  defaultModelID: v.pipe(v.string(), v.minLength(1)),
@@ -313,7 +365,7 @@ const creditBucketSchema = v.object({
313
365
  "purchased",
314
366
  "grant"
315
367
  ]),
316
- remaining: creditsSchema,
368
+ remaining: creditsSchema$1,
317
369
  expiresAt: v.nullable(v.pipe(v.string(), v.isoTimestamp()))
318
370
  });
319
371
  /**
@@ -322,7 +374,7 @@ const creditBucketSchema = v.object({
322
374
  */
323
375
  const creditWalletSchema = v.object({
324
376
  /** Credits left to spend; `null` when the service sets no limit. */
325
- balance: v.nullable(creditsSchema),
377
+ balance: v.nullable(creditsSchema$1),
326
378
  /** Spent first to last. */
327
379
  buckets: v.array(creditBucketSchema)
328
380
  });
@@ -336,7 +388,7 @@ const usageEntrySchema = v.object({
336
388
  ]),
337
389
  modelID: v.nullable(v.string()),
338
390
  userId: v.pipe(v.string(), v.minLength(1)),
339
- credits: creditsSchema
391
+ credits: creditsSchema$1
340
392
  });
341
393
  /** The most results one search returns. */
342
394
  const MAX_SEARCH_RESULTS = 10;
@@ -351,7 +403,7 @@ function parseSearchRequest(input) {
351
403
  }
352
404
  /** One page a search found, with the part of its text that answers the query. */
353
405
  const searchResultSchema = v.object({
354
- url: v.pipe(urlSchema, v.regex(/^https?:\/\//i, "A search result links to an HTTP(S) page")),
406
+ url: v.pipe(urlSchema$1, v.regex(/^https?:\/\//i, "A search result links to an HTTP(S) page")),
355
407
  title: v.string(),
356
408
  publishedAt: v.nullable(v.pipe(v.string(), v.isoTimestamp())),
357
409
  author: v.nullable(v.string()),
@@ -390,6 +442,125 @@ const SERVICE_ERROR_STATUS = {
390
442
  capability_unavailable: 404,
391
443
  rate_limited: 429
392
444
  };
445
+ /**
446
+ * Whether a bearer token may travel to `url`: over HTTPS, or in the clear only to a loopback
447
+ * address, for development. Only literal addresses count, since a name such as `localhost` is
448
+ * whatever the resolver answers. Services and billing tokens act as the account until they expire.
449
+ */
450
+ function sendsTokenSafely(url) {
451
+ const { protocol, hostname } = new URL(url);
452
+ if (protocol === "https:") return true;
453
+ if (protocol !== "http:") return false;
454
+ return hostname === "[::1]" || /^127(\.\d{1,3}){3}$/.test(hostname);
455
+ }
456
+ //#endregion
457
+ //#region src/contract/billing.ts
458
+ /**
459
+ * The contract between Cloud, its editors, and the billing service a deployment advertises: what
460
+ * plans and credit packs it sells, and where an account buys them or manages what it has. Cloud
461
+ * only advertises the service and signs short-lived tokens for an account; the service talks to
462
+ * the payment provider, and sets the account's entitlements and credits as it is paid.
463
+ */
464
+ const CLOUD_BILLING_CONTRACT_VERSION = "1";
465
+ /**
466
+ * The `aud` of the tokens Cloud signs for its billing service, with the services' signing key,
467
+ * whose public keys it publishes at `CLOUD_SERVICES_JWKS_PATH`.
468
+ */
469
+ const CLOUD_BILLING_TOKEN_AUDIENCE = "openpencil-billing";
470
+ /**
471
+ * The page of a Cloud server where the signed-in person sees their plan, buys a plan or credits,
472
+ * and manages what they pay for; editors link to it whenever the server advertises billing.
473
+ */
474
+ const CLOUD_ACCOUNT_PLAN_PATH = "/account/plan";
475
+ /** Where the billing service answers, below the discovered `endpoint`. */
476
+ const CLOUD_BILLING_API_PATHS = {
477
+ base: "/v1",
478
+ catalog: "/v1/catalog",
479
+ account: "/v1/account",
480
+ checkout: "/v1/checkout",
481
+ portal: "/v1/portal"
482
+ };
483
+ const urlSchema = v.pipe(v.string(), v.url());
484
+ const idSchema = v.pipe(v.string(), v.regex(/^[a-z0-9][a-z0-9-]{0,62}$/));
485
+ const centsSchema = v.pipe(v.number(), v.integer(), v.minValue(0));
486
+ const bytesSchema = v.pipe(v.number(), v.integer(), v.minValue(0));
487
+ const creditsSchema = v.pipe(v.number(), v.integer(), v.minValue(0));
488
+ const cloudBillingDiscoverySchema = v.object({
489
+ endpoint: urlSchema,
490
+ contractVersion: v.literal("1")
491
+ });
492
+ const billingTokenSchema = v.object({
493
+ token: v.pipe(v.string(), v.minLength(1)),
494
+ expiresAt: v.pipe(v.string(), v.isoTimestamp())
495
+ });
496
+ /**
497
+ * What the billing service may rely on once a token's signature, issuer, audience, and expiry
498
+ * check. The account is the signed-in user, who buys and manages only their own plan.
499
+ */
500
+ const billingTokenClaimsSchema = v.object({
501
+ iss: urlSchema,
502
+ aud: v.literal(CLOUD_BILLING_TOKEN_AUDIENCE),
503
+ /** The account: the Cloud user whose plan and credits these are. */
504
+ sub: v.pipe(v.string(), v.minLength(1)),
505
+ /** Where the payment provider sends receipts and invoices. */
506
+ email: v.pipe(v.string(), v.email()),
507
+ iat: v.pipe(v.number(), v.integer()),
508
+ exp: v.pipe(v.number(), v.integer())
509
+ });
510
+ /** A plan an account subscribes to, billed every month in US dollars before tax. */
511
+ const billingPlanSchema = v.object({
512
+ id: idSchema,
513
+ name: v.pipe(v.string(), v.minLength(1)),
514
+ monthlyPriceCents: centsSchema,
515
+ storageBytes: bytesSchema,
516
+ monthlyCredits: creditsSchema
517
+ });
518
+ /** Credits an account on a plan buys once, in US dollars before tax. */
519
+ const creditPackSchema = v.object({
520
+ id: idSchema,
521
+ credits: creditsSchema,
522
+ priceCents: centsSchema,
523
+ /** How long the credits last from purchase. */
524
+ validDays: v.pipe(v.number(), v.integer(), v.minValue(1))
525
+ });
526
+ /** What the service sells; an account without a plan has its deployment's free entitlements. */
527
+ const billingCatalogSchema = v.object({
528
+ plans: v.array(billingPlanSchema),
529
+ creditPacks: v.array(creditPackSchema)
530
+ });
531
+ /**
532
+ * The account's subscription as the payment provider holds it, or `null` without one. A
533
+ * `past_due` plan keeps its entitlements while payment is retried.
534
+ */
535
+ const billingAccountSchema = v.object({ subscription: v.nullable(v.object({
536
+ planId: idSchema,
537
+ status: v.picklist(["active", "past_due"]),
538
+ /** When the current period ends: the next charge, or the end of a cancelled plan. */
539
+ currentPeriodEnd: v.pipe(v.string(), v.isoTimestamp()),
540
+ /** Whether the plan ends at `currentPeriodEnd` instead of renewing. */
541
+ cancelsAtPeriodEnd: v.boolean()
542
+ })) });
543
+ /** What to buy: a plan to subscribe to, or a credit pack. */
544
+ const checkoutRequestSchema = v.union([v.object({ planId: idSchema }), v.object({ creditPackId: idSchema })]);
545
+ /** Where to send the person: the payment provider's checkout or account portal. */
546
+ const billingRedirectSchema = v.object({ url: v.pipe(urlSchema, v.regex(/^https:\/\//i, "Billing sends people to an HTTPS page")) });
547
+ const billingErrorCodeSchema = v.picklist([
548
+ "invalid_request",
549
+ "unauthorized",
550
+ "not_allowed",
551
+ "provider_unavailable"
552
+ ]);
553
+ /** The HTTP status billing answers each error with. */
554
+ const BILLING_ERROR_STATUS = {
555
+ invalid_request: 400,
556
+ unauthorized: 401,
557
+ not_allowed: 409,
558
+ provider_unavailable: 502
559
+ };
560
+ const billingErrorSchema = v.object({ error: v.object({
561
+ code: billingErrorCodeSchema,
562
+ message: v.optional(v.string())
563
+ }) });
393
564
  //#endregion
394
565
  //#region src/contract/documents.ts
395
566
  const CLOUD_PROTOCOL_MAX_UPLOAD_BYTES = 1073741824;
@@ -622,6 +793,11 @@ const collaborationTicketSchema = v.object({
622
793
  roomKey: v.pipe(v.string(), v.minLength(43), v.maxLength(128)),
623
794
  principal: collaborationPrincipalSchema,
624
795
  permission: documentPermissionSchema,
796
+ /**
797
+ * Why a peer whose access would let them edit may only view: `storage-limit` when the document's
798
+ * owner holds their whole storage allowance, until they free space or their plan grows.
799
+ */
800
+ readOnly: v.optional(v.picklist(["storage-limit"])),
625
801
  roomEpoch: v.pipe(v.number(), v.integer(), v.minValue(0)),
626
802
  expiresAt: v.string(),
627
803
  serverEnforcedWrites: v.boolean(),
@@ -1470,6 +1646,12 @@ const workspaceEntitlementsSchema = v.object({
1470
1646
  reservedStorageBytes: v.pipe(v.number(), v.integer(), v.minValue(0))
1471
1647
  })
1472
1648
  });
1649
+ /**
1650
+ * An account's own plan and the storage its workspaces hold together. A workspace reports the
1651
+ * same for its owner, so the two read alike.
1652
+ */
1653
+ const accountEntitlementsSchema = workspaceEntitlementsSchema;
1654
+ const accountEntitlementsResponseSchema = v.object({ entitlements: accountEntitlementsSchema });
1473
1655
  //#endregion
1474
1656
  //#region src/contract/discovery.ts
1475
1657
  const CLOUD_PROTOCOL_VERSION = "1";
@@ -1507,6 +1689,30 @@ const cloudCapabilitiesSchema = v.object({
1507
1689
  /** A released editor version, `major.minor.patch`. */
1508
1690
  const cloudEditorVersionSchema = v.pipe(v.string(), v.regex(/^\d+\.\d+\.\d+$/));
1509
1691
  /**
1692
+ * The header desktop editors send with each request, naming their version, so a server can refuse
1693
+ * an editor older than its `minimumEditorVersion`. Browser editors leave it out: the server serves
1694
+ * them, and an older server's CORS rules would refuse a header they don't list.
1695
+ */
1696
+ const CLOUD_EDITOR_VERSION_HEADER = "X-OpenPencil-Editor-Version";
1697
+ function editorVersionParts(version) {
1698
+ const match = /^(\d+)\.(\d+)\.(\d+)/.exec(version);
1699
+ return match ? match.slice(1).map(Number) : null;
1700
+ }
1701
+ /**
1702
+ * Whether `version` is `minimum` or later, comparing `major.minor.patch` numerically; a prerelease
1703
+ * counts as its release. A version that isn't one, on either side, is not at least anything.
1704
+ */
1705
+ function isEditorVersionAtLeast(version, minimum) {
1706
+ const have = editorVersionParts(version);
1707
+ const need = editorVersionParts(minimum);
1708
+ if (!have || !need) return false;
1709
+ for (let index = 0; index < need.length; index++) {
1710
+ const difference = (have[index] ?? 0) - (need[index] ?? 0);
1711
+ if (difference !== 0) return difference > 0;
1712
+ }
1713
+ return true;
1714
+ }
1715
+ /**
1510
1716
  * Whether editors offer this server to everyone, and from which editor version on. Only the
1511
1717
  * official server's listing is read: it turns the Cloud entry points on without an editor release,
1512
1718
  * and an editor older than the minimum keeps them hidden.
@@ -1526,6 +1732,22 @@ const cloudLegalDiscoverySchema = v.object({
1526
1732
  abuseEmail: v.optional(v.pipe(v.string(), v.email())),
1527
1733
  minimumAge: v.optional(v.pipe(v.number(), v.integer()))
1528
1734
  });
1735
+ /** A web address a page may link or load: `http` or `https` only, never a script or data URL. */
1736
+ const webURLSchema = v.pipe(v.string(), v.url(), v.check((value) => ["http:", "https:"].includes(new URL(value).protocol)));
1737
+ /**
1738
+ * How a self-hosted server names itself on its public pages: the operator's name and logo in the
1739
+ * bar, and where its people get help. The official server is OpenPencil's own and names none.
1740
+ */
1741
+ const cloudBrandingSchema = v.object({
1742
+ name: v.optional(v.pipe(v.string(), v.trim(), v.minLength(1), v.maxLength(80))),
1743
+ logoURL: v.optional(webURLSchema),
1744
+ helpURL: v.optional(webURLSchema)
1745
+ });
1746
+ /**
1747
+ * The server's community gallery: the workspace whose documents anyone may open read-only.
1748
+ * Saving to it publishes, so editors never choose it for anyone and say so when it is chosen.
1749
+ */
1750
+ const cloudCommunityDiscoverySchema = v.object({ workspaceId: v.pipe(v.string(), v.uuid()) });
1529
1751
  const cloudDiscoverySchema = v.object({
1530
1752
  protocolVersion: v.literal("1"),
1531
1753
  deployment: cloudDeploymentSchema,
@@ -1536,11 +1758,19 @@ const cloudDiscoverySchema = v.object({
1536
1758
  authentication: cloudAuthenticationSchema,
1537
1759
  capabilities: cloudCapabilitiesSchema,
1538
1760
  listing: v.optional(cloudListingSchema),
1761
+ /**
1762
+ * The oldest editor version the server works with. Older editors ask to be updated instead of
1763
+ * connecting, and the server refuses their requests.
1764
+ */
1765
+ minimumEditorVersion: v.optional(cloudEditorVersionSchema),
1539
1766
  /** The services editors reach with Cloud-signed tokens; absent when the deployment has none. */
1540
1767
  services: v.optional(cloudServicesDiscoverySchema),
1541
1768
  /** Where people manage their plan and buy credits; absent when the deployment does not bill. */
1542
1769
  billing: v.optional(cloudBillingDiscoverySchema),
1543
- legal: v.optional(cloudLegalDiscoverySchema)
1770
+ /** The community gallery; absent when the deployment has none. */
1771
+ community: v.optional(cloudCommunityDiscoverySchema),
1772
+ legal: v.optional(cloudLegalDiscoverySchema),
1773
+ branding: v.optional(cloudBrandingSchema)
1544
1774
  });
1545
1775
  /** The server's own address, where its editor and pages are, from its auth API's. */
1546
1776
  function cloudServerOrigin(discovery) {
@@ -1552,6 +1782,10 @@ function parseCloudDiscovery(input) {
1552
1782
  //#endregion
1553
1783
  //#region src/contract/links.ts
1554
1784
  const CLOUD_LINK_PATH = /^\/(invitations|share|documents)\/([^/]+)$/;
1785
+ /** A community document opened in the editor; `/community/:id` alone is its page. */
1786
+ const COMMUNITY_EDITOR_PATH = /^\/community\/([^/]+)\/open$/;
1787
+ /** The server's community gallery: every document in it, each with a page of its own. */
1788
+ const CLOUD_COMMUNITY_PATH = "/community";
1555
1789
  /**
1556
1790
  * A link on the server's own editor. The server is the link's own address, so the link needs
1557
1791
  * nothing else to name it; a secret travels in the fragment, so it never reaches access logs or
@@ -1582,12 +1816,31 @@ function cloudDocumentPath(documentId) {
1582
1816
  return `/documents/${encodeParam(documentId)}`;
1583
1817
  }
1584
1818
  /**
1819
+ * A document of the server's community gallery opened in the editor, `/community/:id/open`, or
1820
+ * one of its named versions with `?version=…`, which anyone opens read-only without signing in.
1821
+ */
1822
+ function cloudCommunityURL(serverURL, documentId, versionId = null) {
1823
+ return serverLink(serverURL, cloudCommunityPath(documentId), { version: versionId ?? void 0 });
1824
+ }
1825
+ function cloudCommunityPath(documentId) {
1826
+ return `${cloudCommunityPagePath(documentId)}/open`;
1827
+ }
1828
+ /** A community document's page on the server: its preview, versions, and ways to open it. */
1829
+ function cloudCommunityPagePath(documentId) {
1830
+ return `${CLOUD_COMMUNITY_PATH}/${encodeParam(documentId)}`;
1831
+ }
1832
+ /**
1585
1833
  * The kind and ID of a Cloud link's path, or null for any other path. The ID is decoded; a broken
1586
1834
  * escape such as `%E0` is no link.
1587
1835
  */
1588
1836
  function parseCloudLinkPath(pathname) {
1589
- const [, kind, id] = pathname.match(CLOUD_LINK_PATH) ?? [];
1590
- if (kind !== "invitations" && kind !== "share" && kind !== "documents" || !id) return null;
1837
+ const community = pathname.match(COMMUNITY_EDITOR_PATH);
1838
+ const [, kind, id] = community ? [
1839
+ pathname,
1840
+ "community",
1841
+ community[1]
1842
+ ] : pathname.match(CLOUD_LINK_PATH) ?? [];
1843
+ if (kind !== "invitations" && kind !== "share" && kind !== "documents" && kind !== "community" || !id) return null;
1591
1844
  try {
1592
1845
  return {
1593
1846
  kind,
@@ -1606,6 +1859,13 @@ function cloudDesktopLinkURL(kind, id, serverURL, secret) {
1606
1859
  const link = serverLink(serverURL, `/${kind}/${encodeParam(id)}`);
1607
1860
  return withFragment(withQuery("openpencil://cloud", { url: link }), secret);
1608
1861
  }
1862
+ /**
1863
+ * The desktop app's form of a community document's link, `openpencil://cloud?url=<link>`: the
1864
+ * editor's address for it, with the named version it asks for, if any. It carries no secret.
1865
+ */
1866
+ function cloudCommunityDesktopLinkURL(documentId, serverURL, versionId = null) {
1867
+ return withQuery("openpencil://cloud", { url: cloudCommunityURL(serverURL, documentId, versionId) });
1868
+ }
1609
1869
  //#endregion
1610
1870
  //#region src/contract/portal.ts
1611
1871
  /**
@@ -1620,8 +1880,14 @@ const CLOUD_PORTAL_PAGE_ROOTS = [
1620
1880
  "/account",
1621
1881
  "/admin"
1622
1882
  ];
1883
+ /**
1884
+ * The community gallery's pages, which the portal serves too: the gallery at `/community` and a
1885
+ * document's page at `/community/:id`. The editor opens a document at `/community/:id/open`.
1886
+ */
1887
+ const CLOUD_PORTAL_COMMUNITY_PAGES = ["/community", "/community/:documentId"];
1888
+ const COMMUNITY_PAGE = /^\/community(?:\/[^/]+)?\/?$/;
1623
1889
  function isCloudPortalPage(path) {
1624
- return CLOUD_PORTAL_PAGE_ROOTS.some((root) => path === root || path.startsWith(`${root}/`));
1890
+ return COMMUNITY_PAGE.test(path) || CLOUD_PORTAL_PAGE_ROOTS.some((root) => path === root || path.startsWith(`${root}/`));
1625
1891
  }
1626
1892
  //#endregion
1627
1893
  //#region src/contract/versions.ts
@@ -1685,6 +1951,50 @@ function parseDuplicateDocumentVersion(input) {
1685
1951
  return v.parse(duplicateDocumentVersionSchema, input);
1686
1952
  }
1687
1953
  //#endregion
1688
- export { CLOUD_API_MAX_BODY_BYTES, CLOUD_DISCOVERY_PATH, CLOUD_DOCUMENT_NAME_MAX_LENGTH, CLOUD_IMAGE_NAME_PATTERN, CLOUD_MAX_DOCUMENT_IMAGES, CLOUD_PICTURE_MAX_BYTES, CLOUD_PICTURE_SIZE, CLOUD_PORTAL_PAGE_ROOTS, CLOUD_PROTOCOL_MAX_UPLOAD_BYTES, CLOUD_PROTOCOL_VERSION, CLOUD_SERVICES_API_PATHS, CLOUD_SERVICES_CONTRACT_VERSION, CLOUD_SERVICES_JWKS_PATH, CLOUD_SERVICES_TOKEN_AUDIENCE, COLLAB_ACTIONS, DOCUMENT_REPORT_DESCRIPTION_MAX, DOCUMENT_VERSION_DESCRIPTION_MAX_LENGTH, DOCUMENT_VERSION_NAME_MAX_LENGTH, MAX_COLLAB_MESSAGE_BYTES, MAX_PRESENCE_NAME_LENGTH, MAX_SEARCH_QUERY_LENGTH, MAX_SEARCH_RESULTS, RELAY_CLOSE, RELAY_DOCUMENT_PARAM, RELAY_FORWARDING_BYTES, RELAY_FRAGMENT_BYTES, RELAY_HEARTBEAT, RELAY_MINIMUM_MESSAGE_BYTES, RELAY_PATH, RELAY_SERVER_PEER, SERVICE_ERROR_STATUS, acceptDocumentInvitationSchema, acceptedInvitationSchema, accountSecurityErrorCodeSchema, accountSecurityErrorResponseSchema, adminAuditEventSchema, adminAuditResponseSchema, adminEmailResponseSchema, adminErrorCodeSchema, adminErrorResponseSchema, adminMutationResponseSchema, adminOperationsResponseSchema, chatModelSchema, cloudAccountDeleteSchema, cloudAccountDeletionDocumentSchema, cloudAccountDeletionResponseSchema, cloudAccountDeletionSchema, cloudAccountDeletionWorkspaceSchema, cloudAccountMutationResponseSchema, cloudAccountSessionSchema, cloudAccountSessionsResponseSchema, cloudAccountStateSchema, cloudAccountStatusResponseSchema, cloudActorSchema, cloudAdminAuditFilterSchema, cloudAdminDocumentFilterSchema, cloudAdminDocumentSchema, cloudAdminDocumentsResponseSchema, cloudAdminEmailFilterSchema, cloudAdminReportFilterSchema, cloudAdminReportSchema, cloudAdminReportStatusSchema, cloudAdminReportsResponseSchema, cloudAdminSessionResponseSchema, cloudAdminUserDetailSchema, cloudAdminUserFilterSchema, cloudAdminUserSchema, cloudAdminUsersResponseSchema, cloudAuthenticationMethodSchema, cloudAuthenticationMethodsResponseSchema, cloudAuthenticationProviderSchema, cloudAuthenticationSchema, cloudBillingDiscoverySchema, cloudCapabilitiesSchema, cloudDeploymentSchema, cloudDesktopLinkURL, cloudDiscoverySchema, cloudDocumentPath, cloudDocumentURL, cloudEditorVersionSchema, cloudEmailChangeSchema, cloudIdentitySchema, cloudInvitationURL, cloudLegalDiscoverySchema, cloudListingSchema, cloudMFAEnableResponseSchema, cloudMFAEnableSchema, cloudMFARecoveryCodesResponseSchema, cloudMFAStatusResponseSchema, cloudMFAStatusSchema, cloudMFAVerifyResponseSchema, cloudMFAVerifySchema, cloudPasskeyDeleteSchema, cloudPasskeySchema, cloudPasskeysResponseSchema, cloudPasswordChangeSchema, cloudPersonSchema, cloudPictureResponseSchema, cloudPictureUploadSchema, cloudPresenceSchema, cloudProfileResponseSchema, cloudProfileSchema, cloudProfileUpdateSchema, cloudServerOrigin, cloudServicesDiscoverySchema, cloudSessionRevokeSchema, cloudSessionSchema, cloudShareURL, cloudSignInMethodSchema, cloudSignInSchema, cloudSignInsResponseSchema, cloudSocialLinkResponseSchema, cloudSocialLinkSchema, cloudTermsAcceptanceSchema, cloudUnlinkAuthenticationMethodSchema, cloudUserProfileSchema, collaborationPrincipalSchema, collaborationTicketSchema, commitImageUploadsSchema, commitUploadSchema, createDocumentInvitationSchema, createDocumentSchema, createDocumentShareSchema, createInvitationContinuationSchema, createRelayClientAssembler, createRelayServerAssembler, createServicesTokenSchema, createUploadSchema, createWorkspaceInvitationSchema, createWorkspaceSchema, createdWorkspaceInvitationSchema, creditBucketSchema, creditWalletSchema, decodeRelayClientFrame, decodeRelayServerFrame, decodeRoomUpdate, defaultRelayURL, documentAccessSchema, documentAccessSourceSchema, documentDownloadSchema, documentGrantSchema, documentImageDownloadSchema, documentImageLinkSchema, documentInvitationSchema, documentPermissionSchema, documentReportReasonSchema, documentShareSchema, documentSummarySchema, documentVersionDownloadSchema, documentVersionKindSchema, documentVersionResponseSchema, documentVersionSchema, documentVersionsSchema, duplicateDocumentVersionSchema, encodeRelayClientFrame, encodeRelayServerFrame, encodeSyncReply, enrollmentReviewResponseSchema, enrollmentSchema, enrollmentStatusSchema, enrollmentsResponseSchema, fileDocumentReportResponseSchema, fileDocumentReportSchema, imageUploadOfferSchema, invitationContinuationSchema, invitationPreviewSchema, isCloudChecksum, isCloudPortalPage, objectUploadSchema, parseAcceptDocumentInvitation, parseCloudAccountDelete, parseCloudDiscovery, parseCloudEmailChange, parseCloudLinkPath, parseCloudMFAEnable, parseCloudMFAVerify, parseCloudPasskeyDelete, parseCloudPasswordChange, parseCloudPictureUpload, parseCloudProfileUpdate, parseCloudSessionRevoke, parseCloudSocialLink, parseCloudTermsAcceptance, parseCloudUnlinkAuthenticationMethod, parseCommitImageUploads, parseCommitUpload, parseCreateDocument, parseCreateDocumentInvitation, parseCreateDocumentShare, parseCreateInvitationContinuation, parseCreateServicesToken, parseCreateUpload, parseCreateWorkspace, parseCreateWorkspaceInvitation, parseDuplicateDocumentVersion, parseFileDocumentReport, parsePutDocumentGrant, parseRequestImageLinks, parseRequestImageUploads, parseRequestSharedImageLinks, parseResolveDocumentShare, parseSaveDocumentVersion, parseSearchRequest, parseUpdateDocumentShare, parseUpdateDocumentVersion, parseUpdateWorkspace, parseUpdateWorkspaceMember, parseUsageQuery, presenceName, putDocumentGrantSchema, relayClientMessages, relayServerMessages, requestImageLinksSchema, requestImageUploadsSchema, requestSharedImageLinksSchema, resolveDocumentShareSchema, resolvedDocumentShareSchema, restoredDocumentSchema, saveDocumentVersionSchema, searchPricingSchema, searchRequestSchema, searchResponseSchema, searchResultSchema, serviceCatalogSchema, serviceErrorCodeSchema, serviceErrorSchema, servicesTokenClaimsSchema, servicesTokenSchema, sharedDocumentSchema, transactionalEmailAdminSchema, trashSchema, trashedDocumentSchema, updateDocumentShareSchema, updateDocumentVersionSchema, updateWorkspaceMemberSchema, updateWorkspaceSchema, usageEntrySchema, usagePageSchema, usageQuerySchema, workspaceEntitlementsSchema, workspaceInvitationSchema, workspaceListSchema, workspaceMemberSchema, workspaceMembersSchema, workspaceRoleSchema, workspaceSummarySchema, workspaceUsageSchema };
1954
+ //#region src/contract/community.ts
1955
+ /**
1956
+ * Where a community document's thumbnail is served, by its document and revision: the address
1957
+ * changes with each save, so a cached copy never shows an older state.
1958
+ */
1959
+ const COMMUNITY_THUMBNAIL_PATH = "/api/community/thumbnails";
1960
+ function communityThumbnailPath(documentId, revisionId) {
1961
+ return `${COMMUNITY_THUMBNAIL_PATH}/${documentId}/${revisionId}`;
1962
+ }
1963
+ /** A version of a community document someone named, such as the release it was published for. */
1964
+ const communityVersionSchema = v.object({
1965
+ id: v.pipe(v.string(), v.uuid()),
1966
+ name: v.string(),
1967
+ description: v.nullable(v.string()),
1968
+ createdAt: v.string(),
1969
+ /** Whether the document holds this version now, with nothing changed since it was named. */
1970
+ current: v.boolean()
1971
+ });
1972
+ /**
1973
+ * A document in the deployment's community workspace, which anyone may open read-only: its name,
1974
+ * when it last changed, its thumbnail's path on the server, and its named versions, newest first.
1975
+ */
1976
+ const communityDocumentSchema = v.object({
1977
+ id: v.pipe(v.string(), v.uuid()),
1978
+ name: v.string(),
1979
+ kind: documentKindSchema,
1980
+ updatedAt: v.string(),
1981
+ revisionId: v.pipe(v.string(), v.uuid()),
1982
+ thumbnailPath: v.string(),
1983
+ versions: v.array(communityVersionSchema)
1984
+ });
1985
+ /** The community workspace's documents, most recently changed first. */
1986
+ const communityDocumentsSchema = v.object({ documents: v.array(communityDocumentSchema) });
1987
+ /** Which state of a community document to open: a named version, or else the latest. */
1988
+ const communityDownloadQuerySchema = v.object({ version: v.optional(v.pipe(v.string(), v.uuid())) });
1989
+ function parseCommunityDownloadQuery(input) {
1990
+ return v.parse(communityDownloadQuerySchema, input);
1991
+ }
1992
+ /** A community document, or one of its named versions, with where to download it. */
1993
+ const communityDownloadSchema = v.object({
1994
+ document: documentDownloadSchema,
1995
+ version: v.nullable(communityVersionSchema)
1996
+ });
1997
+ //#endregion
1998
+ export { BILLING_ERROR_STATUS, CLOUD_ACCESS_TOKEN_MAX_DAYS, CLOUD_ACCESS_TOKEN_NAME_MAX_LENGTH, CLOUD_ACCESS_TOKEN_PREFIX, CLOUD_ACCOUNT_PLAN_PATH, CLOUD_API_MAX_BODY_BYTES, CLOUD_BILLING_API_PATHS, CLOUD_BILLING_CONTRACT_VERSION, CLOUD_BILLING_TOKEN_AUDIENCE, CLOUD_COMMUNITY_PATH, CLOUD_DISCOVERY_PATH, CLOUD_DOCUMENT_NAME_MAX_LENGTH, CLOUD_EDITOR_VERSION_HEADER, CLOUD_IMAGE_NAME_PATTERN, CLOUD_MAX_DOCUMENT_IMAGES, CLOUD_PICTURE_MAX_BYTES, CLOUD_PICTURE_SIZE, CLOUD_PORTAL_COMMUNITY_PAGES, CLOUD_PORTAL_PAGE_ROOTS, CLOUD_PROTOCOL_MAX_UPLOAD_BYTES, CLOUD_PROTOCOL_VERSION, CLOUD_SERVICES_API_PATHS, CLOUD_SERVICES_CONTRACT_VERSION, CLOUD_SERVICES_JWKS_PATH, CLOUD_SERVICES_TOKEN_AUDIENCE, COLLAB_ACTIONS, COMMUNITY_THUMBNAIL_PATH, DOCUMENT_REPORT_DESCRIPTION_MAX, DOCUMENT_VERSION_DESCRIPTION_MAX_LENGTH, DOCUMENT_VERSION_NAME_MAX_LENGTH, MAX_COLLAB_MESSAGE_BYTES, MAX_PRESENCE_NAME_LENGTH, MAX_SEARCH_QUERY_LENGTH, MAX_SEARCH_RESULTS, RELAY_CLOSE, RELAY_DOCUMENT_PARAM, RELAY_FORWARDING_BYTES, RELAY_FRAGMENT_BYTES, RELAY_HEARTBEAT, RELAY_MINIMUM_MESSAGE_BYTES, RELAY_PATH, RELAY_SERVER_PEER, SERVICE_ERROR_STATUS, acceptDocumentInvitationSchema, acceptedInvitationSchema, accountEntitlementsResponseSchema, accountEntitlementsSchema, accountSecurityErrorCodeSchema, accountSecurityErrorResponseSchema, adminAuditEventSchema, adminAuditResponseSchema, adminEmailResponseSchema, adminErrorCodeSchema, adminErrorResponseSchema, adminMutationResponseSchema, adminOperationsResponseSchema, billingAccountSchema, billingCatalogSchema, billingErrorCodeSchema, billingErrorSchema, billingPlanSchema, billingRedirectSchema, billingTokenClaimsSchema, billingTokenSchema, chatModelSchema, checkoutRequestSchema, cloudAccessTokenCreateSchema, cloudAccessTokenCreatedResponseSchema, cloudAccessTokenRevokeSchema, cloudAccessTokenSchema, cloudAccessTokensResponseSchema, cloudAccountDeleteSchema, cloudAccountDeletionDocumentSchema, cloudAccountDeletionResponseSchema, cloudAccountDeletionSchema, cloudAccountDeletionWorkspaceSchema, cloudAccountMutationResponseSchema, cloudAccountSessionSchema, cloudAccountSessionsResponseSchema, cloudAccountStateSchema, cloudAccountStatusResponseSchema, cloudActorSchema, cloudAdminAuditFilterSchema, cloudAdminDocumentFilterSchema, cloudAdminDocumentSchema, cloudAdminDocumentsResponseSchema, cloudAdminEmailFilterSchema, cloudAdminReportFilterSchema, cloudAdminReportSchema, cloudAdminReportStatusSchema, cloudAdminReportsResponseSchema, cloudAdminSessionResponseSchema, cloudAdminUserDetailSchema, cloudAdminUserFilterSchema, cloudAdminUserSchema, cloudAdminUsersResponseSchema, cloudAuthenticationMethodSchema, cloudAuthenticationMethodsResponseSchema, cloudAuthenticationProviderSchema, cloudAuthenticationSchema, cloudBillingDiscoverySchema, cloudBrandingSchema, cloudCapabilitiesSchema, cloudCommunityDesktopLinkURL, cloudCommunityDiscoverySchema, cloudCommunityPagePath, cloudCommunityPath, cloudCommunityURL, cloudDeploymentSchema, cloudDesktopLinkURL, cloudDiscoverySchema, cloudDocumentPath, cloudDocumentURL, cloudEditorVersionSchema, cloudEmailChangeSchema, cloudIdentitySchema, cloudInvitationURL, cloudLanguageTagSchema, cloudLegalDiscoverySchema, cloudListingSchema, cloudLocaleUpdateSchema, cloudMFAEnableResponseSchema, cloudMFAEnableSchema, cloudMFARecoveryCodesResponseSchema, cloudMFAStatusResponseSchema, cloudMFAStatusSchema, cloudMFAVerifyResponseSchema, cloudMFAVerifySchema, cloudPasskeyDeleteSchema, cloudPasskeySchema, cloudPasskeysResponseSchema, cloudPasswordChangeSchema, cloudPersonSchema, cloudPictureResponseSchema, cloudPictureUploadSchema, cloudPresenceSchema, cloudProfileResponseSchema, cloudProfileSchema, cloudProfileUpdateSchema, cloudServerOrigin, cloudServicesDiscoverySchema, cloudSessionRevokeSchema, cloudSessionSchema, cloudShareURL, cloudSignInMethodSchema, cloudSignInSchema, cloudSignInsResponseSchema, cloudSocialLinkResponseSchema, cloudSocialLinkSchema, cloudTermsAcceptanceSchema, cloudUnlinkAuthenticationMethodSchema, cloudUserProfileSchema, collaborationPrincipalSchema, collaborationTicketSchema, commitImageUploadsSchema, commitUploadSchema, communityDocumentSchema, communityDocumentsSchema, communityDownloadQuerySchema, communityDownloadSchema, communityThumbnailPath, communityVersionSchema, createDocumentInvitationSchema, createDocumentSchema, createDocumentShareSchema, createInvitationContinuationSchema, createRelayClientAssembler, createRelayServerAssembler, createServicesTokenSchema, createUploadSchema, createWorkspaceInvitationSchema, createWorkspaceSchema, createdWorkspaceInvitationSchema, creditBucketSchema, creditPackSchema, creditWalletSchema, decodeRelayClientFrame, decodeRelayServerFrame, decodeRoomUpdate, defaultRelayURL, documentAccessSchema, documentAccessSourceSchema, documentDownloadSchema, documentGrantSchema, documentImageDownloadSchema, documentImageLinkSchema, documentInvitationSchema, documentPermissionSchema, documentReportReasonSchema, documentShareSchema, documentSummarySchema, documentVersionDownloadSchema, documentVersionKindSchema, documentVersionResponseSchema, documentVersionSchema, documentVersionsSchema, duplicateDocumentVersionSchema, encodeRelayClientFrame, encodeRelayServerFrame, encodeSyncReply, enrollmentReviewResponseSchema, enrollmentSchema, enrollmentStatusSchema, enrollmentsResponseSchema, fileDocumentReportResponseSchema, fileDocumentReportSchema, imageUploadOfferSchema, invitationContinuationSchema, invitationPreviewSchema, isCloudChecksum, isCloudPortalPage, isEditorVersionAtLeast, objectUploadSchema, parseAcceptDocumentInvitation, parseCloudAccessTokenCreate, parseCloudAccessTokenRevoke, parseCloudAccountDelete, parseCloudDiscovery, parseCloudEmailChange, parseCloudLinkPath, parseCloudLocaleUpdate, parseCloudMFAEnable, parseCloudMFAVerify, parseCloudPasskeyDelete, parseCloudPasswordChange, parseCloudPictureUpload, parseCloudProfileUpdate, parseCloudSessionRevoke, parseCloudSocialLink, parseCloudTermsAcceptance, parseCloudUnlinkAuthenticationMethod, parseCommitImageUploads, parseCommitUpload, parseCommunityDownloadQuery, parseCreateDocument, parseCreateDocumentInvitation, parseCreateDocumentShare, parseCreateInvitationContinuation, parseCreateServicesToken, parseCreateUpload, parseCreateWorkspace, parseCreateWorkspaceInvitation, parseDuplicateDocumentVersion, parseFileDocumentReport, parsePutDocumentGrant, parseRequestImageLinks, parseRequestImageUploads, parseRequestSharedImageLinks, parseResolveDocumentShare, parseSaveDocumentVersion, parseSearchRequest, parseUpdateDocumentShare, parseUpdateDocumentVersion, parseUpdateWorkspace, parseUpdateWorkspaceMember, parseUsageQuery, presenceName, putDocumentGrantSchema, relayClientMessages, relayServerMessages, requestImageLinksSchema, requestImageUploadsSchema, requestSharedImageLinksSchema, resolveDocumentShareSchema, resolvedDocumentShareSchema, restoredDocumentSchema, saveDocumentVersionSchema, searchPricingSchema, searchRequestSchema, searchResponseSchema, searchResultSchema, sendsTokenSafely, serviceCatalogSchema, serviceErrorCodeSchema, serviceErrorSchema, servicesTokenClaimsSchema, servicesTokenSchema, sharedDocumentSchema, transactionalEmailAdminSchema, trashSchema, trashedDocumentSchema, updateDocumentShareSchema, updateDocumentVersionSchema, updateWorkspaceMemberSchema, updateWorkspaceSchema, usageEntrySchema, usagePageSchema, usageQuerySchema, workspaceEntitlementsSchema, workspaceInvitationSchema, workspaceListSchema, workspaceMemberSchema, workspaceMembersSchema, workspaceRoleSchema, workspaceSummarySchema, workspaceUsageSchema };
1689
1999
 
1690
2000
  //# sourceMappingURL=contract2.js.map