@open-pencil/cloud 0.17.0-beta.2 → 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 (339) hide show
  1. package/README.md +3 -2
  2. package/dist/bin/server.mjs +1 -1
  3. package/dist/bin/server.mjs.map +1 -1
  4. package/dist/bin/{ai-relay.mjs → services.mjs} +9 -9
  5. package/dist/bin/services.mjs.map +1 -0
  6. package/dist/client.d.ts +525 -66
  7. package/dist/client.d.ts.map +1 -1
  8. package/dist/client.js +1257 -654
  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 +1028 -481
  13. package/dist/contract2.js.map +1 -1
  14. package/dist/email.d.ts +1780 -31
  15. package/dist/email.d.ts.map +1 -1
  16. package/dist/email.js +3556 -325
  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 +929 -72
  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 +802 -927
  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 +7166 -3101
  32. package/dist/runtime-node.d.mts.map +1 -1
  33. package/dist/runtime-node.mjs +6 -5
  34. package/dist/runtime-node.mjs.map +1 -1
  35. package/dist/server.d.ts +6525 -2205
  36. package/dist/server.d.ts.map +1 -1
  37. package/dist/server.js +12500 -7613
  38. package/dist/server.js.map +1 -1
  39. package/dist/server.mjs +8625 -2878
  40. package/dist/server.mjs.map +1 -1
  41. package/dist/server2.mjs +101 -79
  42. package/dist/server2.mjs.map +1 -1
  43. package/package.json +27 -9
  44. package/src/admin/api/routes.ts +59 -0
  45. package/src/admin/audit/service.ts +27 -8
  46. package/src/admin/documents/service.ts +431 -0
  47. package/src/admin/errors.ts +9 -1
  48. package/src/admin/index.ts +6 -0
  49. package/src/admin/operations/service.ts +7 -0
  50. package/src/admin/reports/service.ts +153 -0
  51. package/src/admin/schema.ts +6 -0
  52. package/src/client/api.ts +28 -461
  53. package/src/client/auth/client.ts +22 -3
  54. package/src/client/auth/navigation.ts +6 -5
  55. package/src/client/billing.ts +80 -0
  56. package/src/client/community.ts +40 -0
  57. package/src/client/discovery.ts +35 -9
  58. package/src/client/documents.ts +160 -0
  59. package/src/client/index.ts +14 -7
  60. package/src/client/portal/account.ts +79 -2
  61. package/src/client/portal/administration.ts +56 -0
  62. package/src/client/portal/request.ts +2 -0
  63. package/src/client/response.ts +21 -0
  64. package/src/client/schema.ts +8 -0
  65. package/src/client/services.ts +118 -0
  66. package/src/client/sharing.ts +262 -0
  67. package/src/client/versions.ts +104 -0
  68. package/src/contract/account.ts +108 -2
  69. package/src/contract/admin/index.ts +67 -3
  70. package/src/contract/billing.ts +166 -0
  71. package/src/contract/collaboration.ts +11 -1
  72. package/src/contract/community.ts +60 -0
  73. package/src/contract/discovery.ts +83 -4
  74. package/src/contract/documents.ts +27 -0
  75. package/src/contract/entitlements.ts +12 -2
  76. package/src/contract/index.ts +114 -39
  77. package/src/contract/links.ts +57 -4
  78. package/src/contract/locale.ts +27 -0
  79. package/src/contract/portal.ts +12 -1
  80. package/src/contract/relay.ts +6 -0
  81. package/src/contract/reports.ts +42 -0
  82. package/src/contract/routes.ts +10 -0
  83. package/src/contract/services.ts +235 -0
  84. package/src/contract/sharing.ts +3 -9
  85. package/src/email/i18n.ts +174 -0
  86. package/src/email/index.ts +13 -2
  87. package/src/email/locales/ar.json +141 -0
  88. package/src/email/locales/de.json +141 -0
  89. package/src/email/locales/es.json +141 -0
  90. package/src/email/locales/fr.json +141 -0
  91. package/src/email/locales/it.json +141 -0
  92. package/src/email/locales/ja.json +141 -0
  93. package/src/email/locales/pl.json +141 -0
  94. package/src/email/locales/pt-br.json +141 -0
  95. package/src/email/locales/ru.json +141 -0
  96. package/src/email/locales/zh-cn.json +141 -0
  97. package/src/email/messages.ts +200 -0
  98. package/src/email/render.ts +138 -246
  99. package/src/email/samples.ts +115 -0
  100. package/src/email/schema.ts +79 -5
  101. package/src/email/templates/BrandEmail.vue +54 -0
  102. package/src/email/templates/DocumentBlocked.vue +45 -0
  103. package/src/email/templates/DocumentInvitation.vue +24 -0
  104. package/src/email/templates/DocumentReport.vue +32 -0
  105. package/src/email/templates/DocumentReportDecided.vue +36 -0
  106. package/src/email/templates/DocumentReportReceived.vue +18 -0
  107. package/src/email/templates/DocumentRestored.vue +24 -0
  108. package/src/email/templates/EmailChangeRequested.vue +24 -0
  109. package/src/email/templates/EmailRoot.vue +19 -0
  110. package/src/email/templates/EmailText.vue +9 -0
  111. package/src/email/templates/EmailVerification.vue +38 -0
  112. package/src/email/templates/EnrollmentNotification.vue +24 -0
  113. package/src/email/templates/EnrollmentUpdate.vue +52 -0
  114. package/src/email/templates/NewSignIn.vue +37 -0
  115. package/src/email/templates/PasswordChanged.vue +22 -0
  116. package/src/email/templates/PasswordReset.vue +23 -0
  117. package/src/email/templates/StorageLimitReached.vue +28 -0
  118. package/src/email/templates/TwoStepChanged.vue +32 -0
  119. package/src/email/templates/WaitlistConfirmation.vue +29 -0
  120. package/src/email/templates/WorkspaceInvitation.vue +28 -0
  121. package/src/email/templates/brand.ts +9 -61
  122. package/src/email/templates/localization.ts +17 -0
  123. package/src/errors/index.ts +6 -0
  124. package/src/errors/posthog.ts +80 -0
  125. package/src/global.d.ts +7 -0
  126. package/src/runtime/cloudflare/environment.ts +22 -11
  127. package/src/runtime/cloudflare/index.ts +1 -1
  128. package/src/runtime/cloudflare/logging.ts +15 -0
  129. package/src/runtime/cloudflare/maintenance.ts +31 -0
  130. package/src/runtime/cloudflare/relay/index.ts +69 -15
  131. package/src/runtime/cloudflare/tsconfig.json +2 -1
  132. package/src/runtime/cloudflare/worker.ts +46 -13
  133. package/src/runtime/node/application.ts +5 -3
  134. package/src/runtime/node/bootstrap.ts +15 -4
  135. package/src/runtime/node/cleanup.ts +20 -3
  136. package/src/runtime/node/email/transport.ts +13 -10
  137. package/src/runtime/node/entitlements/main.ts +14 -11
  138. package/src/runtime/node/index.ts +1 -1
  139. package/src/runtime/node/main.ts +1 -1
  140. package/src/runtime/node/migrate.ts +5 -1
  141. package/src/runtime/node/relay.ts +8 -2
  142. package/src/runtime/node/request-id.ts +13 -0
  143. package/src/runtime/node/server.ts +50 -16
  144. package/src/runtime/node/{ai-relay → services}/main.ts +7 -7
  145. package/src/runtime/node/{ai-relay → services}/server.ts +18 -18
  146. package/src/runtime/postgres/database.ts +20 -1
  147. package/src/runtime/posthog/errors.ts +15 -30
  148. package/src/runtime/s3/objects.ts +41 -1
  149. package/src/runtime/site/community.ts +101 -0
  150. package/src/runtime/site/server.ts +49 -6
  151. package/src/server/account/actions.ts +5 -0
  152. package/src/server/account/deletion.ts +304 -0
  153. package/src/server/account/routes.ts +281 -206
  154. package/src/server/account/terms.ts +42 -0
  155. package/src/server/account/tokens.ts +57 -0
  156. package/src/server/api/router.ts +32 -5
  157. package/src/server/api/types.ts +2 -0
  158. package/src/server/app/checks.ts +84 -0
  159. package/src/server/app/editors.ts +20 -0
  160. package/src/server/app/index.ts +128 -0
  161. package/src/server/app/indexing.ts +40 -0
  162. package/src/server/app/limiters.ts +53 -0
  163. package/src/server/app/routes.ts +114 -0
  164. package/src/server/app/services.ts +185 -0
  165. package/src/server/auth/access-control.ts +63 -0
  166. package/src/server/auth/access-tokens.ts +62 -0
  167. package/src/server/auth/adapter.ts +32 -1
  168. package/src/server/auth/email.ts +4 -1
  169. package/src/server/auth/endpoints.ts +5 -1
  170. package/src/server/auth/enrollment.ts +116 -0
  171. package/src/server/auth/factory.ts +116 -132
  172. package/src/server/auth/index.ts +10 -1
  173. package/src/server/auth/logger.ts +23 -0
  174. package/src/server/auth/mfa-assurance.ts +51 -0
  175. package/src/server/auth/passwords.ts +43 -0
  176. package/src/server/auth/session.ts +2 -0
  177. package/src/server/billing/index.ts +6 -0
  178. package/src/server/billing/routes.ts +27 -0
  179. package/src/server/billing/tokens.ts +37 -0
  180. package/src/server/cleanup/configured.ts +27 -7
  181. package/src/server/cleanup/documents.ts +165 -71
  182. package/src/server/cleanup/revisions.ts +16 -5
  183. package/src/server/cleanup/uploads.ts +8 -2
  184. package/src/server/cleanup/worker.ts +15 -3
  185. package/src/server/collaboration/relay/connection.ts +4 -3
  186. package/src/server/collaboration/relay/documents.ts +13 -10
  187. package/src/server/collaboration/relay/hub.ts +77 -122
  188. package/src/server/collaboration/relay/log.ts +5 -2
  189. package/src/server/collaboration/relay/room.ts +154 -0
  190. package/src/server/collaboration/service.ts +48 -33
  191. package/src/server/community/index.ts +2 -0
  192. package/src/server/community/routes.ts +93 -0
  193. package/src/server/community/service.ts +134 -0
  194. package/src/server/config/deployment.ts +41 -9
  195. package/src/server/config/index.ts +1 -1
  196. package/src/server/config/public.ts +11 -4
  197. package/src/server/config/schema.ts +91 -277
  198. package/src/server/config/toml/schema.ts +307 -0
  199. package/src/server/db/expressions.ts +15 -1
  200. package/src/server/db/index.ts +1 -0
  201. package/src/server/db/migrate.ts +46 -116
  202. package/src/server/db/migrations/001_accounts.ts +79 -0
  203. package/src/server/db/migrations/002_workspaces.ts +48 -0
  204. package/src/server/db/migrations/003_storage.ts +44 -0
  205. package/src/server/db/migrations/004_documents.ts +193 -0
  206. package/src/server/db/migrations/005_sharing.ts +95 -0
  207. package/src/server/db/migrations/006_operations.ts +110 -0
  208. package/src/server/db/migrations/007_trash.ts +33 -0
  209. package/src/server/db/migrations/008_terms.ts +18 -0
  210. package/src/server/db/migrations/009_access_tokens.ts +47 -0
  211. package/src/server/db/migrations/010_storage_limit_notices.ts +50 -0
  212. package/src/server/db/migrations/011_account_ids.ts +30 -0
  213. package/src/server/db/migrations/012_email_locales.ts +34 -0
  214. package/src/server/db/migrations/013_document_block_emails.ts +40 -0
  215. package/src/server/db/migrations/014_report_replies.ts +28 -0
  216. package/src/server/db/migrations/schema.ts +96 -0
  217. package/src/server/db/tables.ts +82 -4
  218. package/src/server/db/users.ts +22 -0
  219. package/src/server/documents/access.ts +66 -55
  220. package/src/server/documents/errors.ts +7 -0
  221. package/src/server/documents/images.ts +2 -1
  222. package/src/server/documents/index.ts +1 -1
  223. package/src/server/documents/limits.ts +14 -8
  224. package/src/server/documents/purge.ts +75 -0
  225. package/src/server/documents/repository.ts +2 -0
  226. package/src/server/documents/routes.ts +26 -0
  227. package/src/server/documents/service.ts +30 -406
  228. package/src/server/documents/summary.ts +1 -0
  229. package/src/server/documents/trash.ts +203 -0
  230. package/src/server/documents/uploads.ts +450 -0
  231. package/src/server/documents/versions/checkpoint.ts +2 -1
  232. package/src/server/documents/versions/history.ts +11 -7
  233. package/src/server/documents/versions/service.ts +94 -28
  234. package/src/server/email/invitations.ts +1 -0
  235. package/src/server/email/service.ts +31 -4
  236. package/src/server/email/types.ts +12 -0
  237. package/src/server/errors/index.ts +51 -16
  238. package/src/server/index.ts +52 -16
  239. package/src/server/internal/index.ts +3 -3
  240. package/src/server/internal/routes.ts +7 -10
  241. package/src/server/internal/schema.ts +1 -1
  242. package/src/server/internal/service.ts +17 -23
  243. package/src/server/invitations/budget.ts +66 -0
  244. package/src/server/invitations/index.ts +1 -0
  245. package/src/server/invitations/types.ts +5 -1
  246. package/src/server/logging.ts +76 -0
  247. package/src/server/objects/types.ts +5 -0
  248. package/src/server/pictures/service.ts +2 -1
  249. package/src/server/policy/configured.ts +9 -3
  250. package/src/server/policy/database.ts +52 -27
  251. package/src/server/policy/index.ts +2 -1
  252. package/src/server/policy/keys.ts +5 -2
  253. package/src/server/policy/policy.ts +40 -12
  254. package/src/server/policy/schema.ts +2 -2
  255. package/src/server/policy/service.ts +78 -56
  256. package/src/server/policy/static.ts +5 -5
  257. package/src/server/policy/storage.ts +33 -0
  258. package/src/server/policy/workspace.ts +41 -0
  259. package/src/server/quota/index.ts +6 -0
  260. package/src/server/quota/notices.ts +121 -0
  261. package/src/server/quota/reconcile.ts +2 -0
  262. package/src/server/quota/storage.ts +74 -31
  263. package/src/server/rate-limit/cleanup.ts +17 -5
  264. package/src/server/rate-limit/middleware.ts +6 -2
  265. package/src/server/reports/index.ts +9 -0
  266. package/src/server/reports/replies.ts +55 -0
  267. package/src/server/reports/routes.ts +39 -0
  268. package/src/server/reports/service.ts +145 -0
  269. package/src/server/services/errors.ts +7 -0
  270. package/src/server/services/index.ts +8 -0
  271. package/src/server/{ai → services}/keys.ts +11 -11
  272. package/src/server/services/routes.ts +47 -0
  273. package/src/server/{ai/service.ts → services/tokens.ts} +23 -20
  274. package/src/server/sharing/capabilities/service.ts +68 -23
  275. package/src/server/sharing/grants/service.ts +11 -18
  276. package/src/server/sharing/http.ts +4 -0
  277. package/src/server/sharing/invitations/service.ts +35 -15
  278. package/src/server/sharing/policy.ts +9 -14
  279. package/src/server/sharing/routes.ts +0 -16
  280. package/src/server/sharing/service.ts +1 -17
  281. package/src/server/validation.ts +4 -0
  282. package/src/server/workspaces/index.ts +1 -0
  283. package/src/server/workspaces/members.ts +91 -52
  284. package/src/server/workspaces/repository.ts +2 -1
  285. package/src/server/workspaces/routes.ts +4 -0
  286. package/src/{ai-relay → services}/app.ts +46 -44
  287. package/src/{ai-relay → services}/config.ts +26 -19
  288. package/src/services/db/index.ts +10 -0
  289. package/src/services/db/migrate.ts +37 -0
  290. package/src/{ai-relay/db/migrations/001_usage.ts → services/db/migrations/001_baseline.ts} +18 -7
  291. package/src/services/db/schema.ts +22 -0
  292. package/src/services/index.ts +18 -0
  293. package/src/{ai-relay → services}/metering.ts +2 -2
  294. package/src/{ai-relay → services}/usage.ts +35 -19
  295. package/dist/bin/ai-relay.mjs.map +0 -1
  296. package/src/ai-relay/db/index.ts +0 -10
  297. package/src/ai-relay/db/migrate.ts +0 -32
  298. package/src/ai-relay/db/schema.ts +0 -20
  299. package/src/ai-relay/index.ts +0 -18
  300. package/src/client/ai.ts +0 -96
  301. package/src/contract/ai.ts +0 -150
  302. package/src/email/templates/document-invitation.ts +0 -35
  303. package/src/email/templates/enrollment.ts +0 -27
  304. package/src/email/templates/layout.ts +0 -18
  305. package/src/server/ai/errors.ts +0 -7
  306. package/src/server/ai/index.ts +0 -4
  307. package/src/server/ai/routes.ts +0 -43
  308. package/src/server/app.ts +0 -379
  309. package/src/server/auth/workspace-access.ts +0 -23
  310. package/src/server/db/migrations/001_foundation.ts +0 -164
  311. package/src/server/db/migrations/002_upload_cleanup_claims.ts +0 -34
  312. package/src/server/db/migrations/003_document_cleanup_claims.ts +0 -23
  313. package/src/server/db/migrations/004_document_sharing.ts +0 -82
  314. package/src/server/db/migrations/005_document_collaboration_epoch.ts +0 -13
  315. package/src/server/db/migrations/006_invitation_continuation.ts +0 -27
  316. package/src/server/db/migrations/007_collaboration_state.ts +0 -25
  317. package/src/server/db/migrations/008_storage_reservations.ts +0 -37
  318. package/src/server/db/migrations/009_workspace_entitlements.ts +0 -22
  319. package/src/server/db/migrations/010_upload_finalization.ts +0 -22
  320. package/src/server/db/migrations/011_upload_finalization_lease.ts +0 -12
  321. package/src/server/db/migrations/012_transactional_email.ts +0 -48
  322. package/src/server/db/migrations/013_admin_enrollment.ts +0 -54
  323. package/src/server/db/migrations/014_enrollment_email_kinds.ts +0 -30
  324. package/src/server/db/migrations/015_cloud_rate_limit.ts +0 -22
  325. package/src/server/db/migrations/016_auth_schema.ts +0 -16
  326. package/src/server/db/migrations/017_authentication_email_kinds.ts +0 -32
  327. package/src/server/db/migrations/018_authentication_mfa.ts +0 -78
  328. package/src/server/db/migrations/019_better_auth_account_issuer.ts +0 -42
  329. package/src/server/db/migrations/020_workspace_invitations.ts +0 -57
  330. package/src/server/db/migrations/021_document_versions.ts +0 -66
  331. package/src/server/db/migrations/022_entitlement_external_version.ts +0 -17
  332. package/src/server/db/migrations/023_document_images.ts +0 -61
  333. package/src/server/db/migrations/024_account_activity.ts +0 -66
  334. package/src/server/db/migrations/025_table_names.ts +0 -58
  335. package/src/server/db/migrations/026_user_picture.ts +0 -30
  336. package/src/server/db/migrations/027_document_kind.ts +0 -19
  337. package/src/server/db/migrations/028_collaboration_updates.ts +0 -84
  338. package/src/server/db/migrations/helpers.ts +0 -78
  339. /package/dist/bin/{ai-relay.d.mts → services.d.mts} +0 -0
@@ -0,0 +1,166 @@
1
+ import type { Hono } from 'hono'
2
+ import type { BlankEnv, BlankInput } from 'hono/types'
3
+ import * as v from 'valibot'
4
+
5
+ import type { JSONRoute } from './routes'
6
+
7
+ /**
8
+ * The contract between Cloud, its editors, and the billing service a deployment advertises: what
9
+ * plans and credit packs it sells, and where an account buys them or manages what it has. Cloud
10
+ * only advertises the service and signs short-lived tokens for an account; the service talks to
11
+ * the payment provider, and sets the account's entitlements and credits as it is paid.
12
+ */
13
+ export const CLOUD_BILLING_CONTRACT_VERSION = '1' as const
14
+ /**
15
+ * The `aud` of the tokens Cloud signs for its billing service, with the services' signing key,
16
+ * whose public keys it publishes at `CLOUD_SERVICES_JWKS_PATH`.
17
+ */
18
+ export const CLOUD_BILLING_TOKEN_AUDIENCE = 'openpencil-billing' as const
19
+
20
+ /**
21
+ * The page of a Cloud server where the signed-in person sees their plan, buys a plan or credits,
22
+ * and manages what they pay for; editors link to it whenever the server advertises billing.
23
+ */
24
+ export const CLOUD_ACCOUNT_PLAN_PATH = '/account/plan' as const
25
+
26
+ /** Where the billing service answers, below the discovered `endpoint`. */
27
+ export const CLOUD_BILLING_API_PATHS = {
28
+ base: '/v1',
29
+ catalog: '/v1/catalog',
30
+ account: '/v1/account',
31
+ checkout: '/v1/checkout',
32
+ portal: '/v1/portal'
33
+ } as const
34
+
35
+ const urlSchema = v.pipe(v.string(), v.url())
36
+ const idSchema = v.pipe(v.string(), v.regex(/^[a-z0-9][a-z0-9-]{0,62}$/))
37
+ const centsSchema = v.pipe(v.number(), v.integer(), v.minValue(0))
38
+ const bytesSchema = v.pipe(v.number(), v.integer(), v.minValue(0))
39
+ const creditsSchema = v.pipe(v.number(), v.integer(), v.minValue(0))
40
+
41
+ export const cloudBillingDiscoverySchema = v.object({
42
+ endpoint: urlSchema,
43
+ contractVersion: v.literal(CLOUD_BILLING_CONTRACT_VERSION)
44
+ })
45
+ export type CloudBillingDiscovery = v.InferOutput<typeof cloudBillingDiscoverySchema>
46
+
47
+ export const billingTokenSchema = v.object({
48
+ token: v.pipe(v.string(), v.minLength(1)),
49
+ expiresAt: v.pipe(v.string(), v.isoTimestamp())
50
+ })
51
+ export type BillingToken = v.InferOutput<typeof billingTokenSchema>
52
+
53
+ /**
54
+ * What the billing service may rely on once a token's signature, issuer, audience, and expiry
55
+ * check. The account is the signed-in user, who buys and manages only their own plan.
56
+ */
57
+ export const billingTokenClaimsSchema = v.object({
58
+ iss: urlSchema,
59
+ aud: v.literal(CLOUD_BILLING_TOKEN_AUDIENCE),
60
+ /** The account: the Cloud user whose plan and credits these are. */
61
+ sub: v.pipe(v.string(), v.minLength(1)),
62
+ /** Where the payment provider sends receipts and invoices. */
63
+ email: v.pipe(v.string(), v.email()),
64
+ iat: v.pipe(v.number(), v.integer()),
65
+ exp: v.pipe(v.number(), v.integer())
66
+ })
67
+ export type BillingTokenClaims = v.InferOutput<typeof billingTokenClaimsSchema>
68
+
69
+ /** A plan an account subscribes to, billed every month in US dollars before tax. */
70
+ export const billingPlanSchema = v.object({
71
+ id: idSchema,
72
+ name: v.pipe(v.string(), v.minLength(1)),
73
+ monthlyPriceCents: centsSchema,
74
+ storageBytes: bytesSchema,
75
+ monthlyCredits: creditsSchema
76
+ })
77
+ export type BillingPlan = v.InferOutput<typeof billingPlanSchema>
78
+
79
+ /** Credits an account on a plan buys once, in US dollars before tax. */
80
+ export const creditPackSchema = v.object({
81
+ id: idSchema,
82
+ credits: creditsSchema,
83
+ priceCents: centsSchema,
84
+ /** How long the credits last from purchase. */
85
+ validDays: v.pipe(v.number(), v.integer(), v.minValue(1))
86
+ })
87
+ export type CreditPack = v.InferOutput<typeof creditPackSchema>
88
+
89
+ /** What the service sells; an account without a plan has its deployment's free entitlements. */
90
+ export const billingCatalogSchema = v.object({
91
+ plans: v.array(billingPlanSchema),
92
+ creditPacks: v.array(creditPackSchema)
93
+ })
94
+ export type BillingCatalog = v.InferOutput<typeof billingCatalogSchema>
95
+
96
+ /**
97
+ * The account's subscription as the payment provider holds it, or `null` without one. A
98
+ * `past_due` plan keeps its entitlements while payment is retried.
99
+ */
100
+ export const billingAccountSchema = v.object({
101
+ subscription: v.nullable(
102
+ v.object({
103
+ planId: idSchema,
104
+ status: v.picklist(['active', 'past_due']),
105
+ /** When the current period ends: the next charge, or the end of a cancelled plan. */
106
+ currentPeriodEnd: v.pipe(v.string(), v.isoTimestamp()),
107
+ /** Whether the plan ends at `currentPeriodEnd` instead of renewing. */
108
+ cancelsAtPeriodEnd: v.boolean()
109
+ })
110
+ )
111
+ })
112
+ export type BillingAccount = v.InferOutput<typeof billingAccountSchema>
113
+
114
+ /** What to buy: a plan to subscribe to, or a credit pack. */
115
+ export const checkoutRequestSchema = v.union([
116
+ v.object({ planId: idSchema }),
117
+ v.object({ creditPackId: idSchema })
118
+ ])
119
+ export type CheckoutRequest = v.InferOutput<typeof checkoutRequestSchema>
120
+
121
+ /** Where to send the person: the payment provider's checkout or account portal. */
122
+ export const billingRedirectSchema = v.object({
123
+ // Only the payment provider's own pages, never a scheme a browser would run.
124
+ url: v.pipe(urlSchema, v.regex(/^https:\/\//i, 'Billing sends people to an HTTPS page'))
125
+ })
126
+ export type BillingRedirect = v.InferOutput<typeof billingRedirectSchema>
127
+
128
+ export const billingErrorCodeSchema = v.picklist([
129
+ 'invalid_request',
130
+ 'unauthorized',
131
+ /** A credit pack for an account without a plan, or a plan it already has. */
132
+ 'not_allowed',
133
+ 'provider_unavailable'
134
+ ])
135
+ export type BillingErrorCode = v.InferOutput<typeof billingErrorCodeSchema>
136
+
137
+ /** The HTTP status billing answers each error with. */
138
+ export const BILLING_ERROR_STATUS = {
139
+ invalid_request: 400,
140
+ unauthorized: 401,
141
+ not_allowed: 409,
142
+ provider_unavailable: 502
143
+ } as const satisfies Record<BillingErrorCode, number>
144
+
145
+ export const billingErrorSchema = v.object({
146
+ error: v.object({ code: billingErrorCodeSchema, message: v.optional(v.string()) })
147
+ })
148
+ export type BillingError = v.InferOutput<typeof billingErrorSchema>
149
+
150
+ /** The billing service's routes, for a typed Hono client (`hc<CloudBillingAPI>`). */
151
+ export type CloudBillingSchema = JSONRoute<
152
+ 'get',
153
+ typeof CLOUD_BILLING_API_PATHS.catalog,
154
+ BlankInput,
155
+ BillingCatalog
156
+ > &
157
+ JSONRoute<'get', typeof CLOUD_BILLING_API_PATHS.account, BlankInput, BillingAccount> &
158
+ JSONRoute<
159
+ 'post',
160
+ typeof CLOUD_BILLING_API_PATHS.checkout,
161
+ { json: CheckoutRequest },
162
+ BillingRedirect
163
+ > &
164
+ JSONRoute<'post', typeof CLOUD_BILLING_API_PATHS.portal, BlankInput, BillingRedirect>
165
+
166
+ export type CloudBillingAPI = Hono<BlankEnv, CloudBillingSchema>
@@ -38,8 +38,18 @@ export const collaborationTicketSchema = v.object({
38
38
  roomKey: v.pipe(v.string(), v.minLength(43), v.maxLength(128)),
39
39
  principal: collaborationPrincipalSchema,
40
40
  permission: documentPermissionSchema,
41
+ /**
42
+ * Why a peer whose access would let them edit may only view: `storage-limit` when the document's
43
+ * owner holds their whole storage allowance, until they free space or their plan grows.
44
+ */
45
+ readOnly: v.optional(v.picklist(['storage-limit'])),
41
46
  roomEpoch: v.pipe(v.number(), v.integer(), v.minValue(0)),
42
47
  expiresAt: v.string(),
43
- serverEnforcedWrites: v.boolean()
48
+ serverEnforcedWrites: v.boolean(),
49
+ /**
50
+ * Whether the relay answers `RELAY_HEARTBEAT`. A relay from before it takes a ping for a
51
+ * malformed frame and turns the peer away, so editors ask only a relay that says it answers.
52
+ */
53
+ relayHeartbeat: v.optional(v.boolean(), false)
44
54
  })
45
55
  export type CollaborationTicket = v.InferOutput<typeof collaborationTicketSchema>
@@ -0,0 +1,60 @@
1
+ import * as v from 'valibot'
2
+
3
+ import { documentDownloadSchema, documentKindSchema } from './documents'
4
+
5
+ /**
6
+ * Where a community document's thumbnail is served, by its document and revision: the address
7
+ * changes with each save, so a cached copy never shows an older state.
8
+ */
9
+ export const COMMUNITY_THUMBNAIL_PATH = '/api/community/thumbnails'
10
+
11
+ export function communityThumbnailPath(documentId: string, revisionId: string): string {
12
+ return `${COMMUNITY_THUMBNAIL_PATH}/${documentId}/${revisionId}`
13
+ }
14
+
15
+ /** A version of a community document someone named, such as the release it was published for. */
16
+ export const communityVersionSchema = v.object({
17
+ id: v.pipe(v.string(), v.uuid()),
18
+ name: v.string(),
19
+ description: v.nullable(v.string()),
20
+ createdAt: v.string(),
21
+ /** Whether the document holds this version now, with nothing changed since it was named. */
22
+ current: v.boolean()
23
+ })
24
+ export type CommunityVersion = v.InferOutput<typeof communityVersionSchema>
25
+
26
+ /**
27
+ * A document in the deployment's community workspace, which anyone may open read-only: its name,
28
+ * when it last changed, its thumbnail's path on the server, and its named versions, newest first.
29
+ */
30
+ export const communityDocumentSchema = v.object({
31
+ id: v.pipe(v.string(), v.uuid()),
32
+ name: v.string(),
33
+ kind: documentKindSchema,
34
+ updatedAt: v.string(),
35
+ revisionId: v.pipe(v.string(), v.uuid()),
36
+ thumbnailPath: v.string(),
37
+ versions: v.array(communityVersionSchema)
38
+ })
39
+ export type CommunityDocument = v.InferOutput<typeof communityDocumentSchema>
40
+
41
+ /** The community workspace's documents, most recently changed first. */
42
+ export const communityDocumentsSchema = v.object({ documents: v.array(communityDocumentSchema) })
43
+ export type CommunityDocuments = v.InferOutput<typeof communityDocumentsSchema>
44
+
45
+ /** Which state of a community document to open: a named version, or else the latest. */
46
+ export const communityDownloadQuerySchema = v.object({
47
+ version: v.optional(v.pipe(v.string(), v.uuid()))
48
+ })
49
+ export type CommunityDownloadQuery = v.InferOutput<typeof communityDownloadQuerySchema>
50
+
51
+ export function parseCommunityDownloadQuery(input: unknown): CommunityDownloadQuery {
52
+ return v.parse(communityDownloadQuerySchema, input)
53
+ }
54
+
55
+ /** A community document, or one of its named versions, with where to download it. */
56
+ export const communityDownloadSchema = v.object({
57
+ document: documentDownloadSchema,
58
+ version: v.nullable(communityVersionSchema)
59
+ })
60
+ export type CommunityDownload = v.InferOutput<typeof communityDownloadSchema>
@@ -1,6 +1,7 @@
1
1
  import * as v from 'valibot'
2
2
 
3
- import { cloudAIDiscoverySchema, cloudBillingDiscoverySchema } from './ai'
3
+ import { cloudBillingDiscoverySchema } from './billing'
4
+ import { cloudServicesDiscoverySchema } from './services'
4
5
 
5
6
  export const CLOUD_PROTOCOL_VERSION = '1' as const
6
7
  export const CLOUD_DISCOVERY_PATH = '/.well-known/openpencil' as const
@@ -46,6 +47,33 @@ export type CloudCapabilities = v.InferOutput<typeof cloudCapabilitiesSchema>
46
47
  /** A released editor version, `major.minor.patch`. */
47
48
  export const cloudEditorVersionSchema = v.pipe(v.string(), v.regex(/^\d+\.\d+\.\d+$/))
48
49
 
50
+ /**
51
+ * The header desktop editors send with each request, naming their version, so a server can refuse
52
+ * an editor older than its `minimumEditorVersion`. Browser editors leave it out: the server serves
53
+ * them, and an older server's CORS rules would refuse a header they don't list.
54
+ */
55
+ export const CLOUD_EDITOR_VERSION_HEADER = 'X-OpenPencil-Editor-Version' as const
56
+
57
+ function editorVersionParts(version: string): number[] | null {
58
+ const match = /^(\d+)\.(\d+)\.(\d+)/.exec(version)
59
+ return match ? match.slice(1).map(Number) : null
60
+ }
61
+
62
+ /**
63
+ * Whether `version` is `minimum` or later, comparing `major.minor.patch` numerically; a prerelease
64
+ * counts as its release. A version that isn't one, on either side, is not at least anything.
65
+ */
66
+ export function isEditorVersionAtLeast(version: string, minimum: string): boolean {
67
+ const have = editorVersionParts(version)
68
+ const need = editorVersionParts(minimum)
69
+ if (!have || !need) return false
70
+ for (let index = 0; index < need.length; index++) {
71
+ const difference = (have[index] ?? 0) - (need[index] ?? 0)
72
+ if (difference !== 0) return difference > 0
73
+ }
74
+ return true
75
+ }
76
+
49
77
  /**
50
78
  * Whether editors offer this server to everyone, and from which editor version on. Only the
51
79
  * official server's listing is read: it turns the Cloud entry points on without an editor release,
@@ -54,6 +82,48 @@ export const cloudEditorVersionSchema = v.pipe(v.string(), v.regex(/^\d+\.\d+\.\
54
82
  export const cloudListingSchema = v.object({ minimumEditorVersion: cloudEditorVersionSchema })
55
83
  export type CloudListing = v.InferOutput<typeof cloudListingSchema>
56
84
 
85
+ const legalURLSchema = v.pipe(v.string(), v.url())
86
+
87
+ /**
88
+ * The operator's legal links, which clients show at sign-up and in account pages. A server that
89
+ * names none shows none; `requireAcceptance` means an account accepts `termsVersion` before it uses
90
+ * the server.
91
+ */
92
+ export const cloudLegalDiscoverySchema = v.object({
93
+ termsURL: v.optional(legalURLSchema),
94
+ privacyURL: v.optional(legalURLSchema),
95
+ termsVersion: v.optional(v.string()),
96
+ requireAcceptance: v.boolean(),
97
+ abuseEmail: v.optional(v.pipe(v.string(), v.email())),
98
+ minimumAge: v.optional(v.pipe(v.number(), v.integer()))
99
+ })
100
+ export type CloudLegalDiscovery = v.InferOutput<typeof cloudLegalDiscoverySchema>
101
+
102
+ /** A web address a page may link or load: `http` or `https` only, never a script or data URL. */
103
+ const webURLSchema = v.pipe(
104
+ v.string(),
105
+ v.url(),
106
+ v.check((value) => ['http:', 'https:'].includes(new URL(value).protocol))
107
+ )
108
+
109
+ /**
110
+ * How a self-hosted server names itself on its public pages: the operator's name and logo in the
111
+ * bar, and where its people get help. The official server is OpenPencil's own and names none.
112
+ */
113
+ export const cloudBrandingSchema = v.object({
114
+ name: v.optional(v.pipe(v.string(), v.trim(), v.minLength(1), v.maxLength(80))),
115
+ logoURL: v.optional(webURLSchema),
116
+ helpURL: v.optional(webURLSchema)
117
+ })
118
+ export type CloudBranding = v.InferOutput<typeof cloudBrandingSchema>
119
+
120
+ /**
121
+ * The server's community gallery: the workspace whose documents anyone may open read-only.
122
+ * Saving to it publishes, so editors never choose it for anyone and say so when it is chosen.
123
+ */
124
+ export const cloudCommunityDiscoverySchema = v.object({ workspaceId: v.pipe(v.string(), v.uuid()) })
125
+ export type CloudCommunityDiscovery = v.InferOutput<typeof cloudCommunityDiscoverySchema>
126
+
57
127
  export const cloudDiscoverySchema = v.object({
58
128
  protocolVersion: v.literal(CLOUD_PROTOCOL_VERSION),
59
129
  deployment: cloudDeploymentSchema,
@@ -64,10 +134,19 @@ export const cloudDiscoverySchema = v.object({
64
134
  authentication: cloudAuthenticationSchema,
65
135
  capabilities: cloudCapabilitiesSchema,
66
136
  listing: v.optional(cloudListingSchema),
67
- /** The AI service editors reach with Cloud-signed tokens; absent when the deployment has none. */
68
- ai: v.optional(cloudAIDiscoverySchema),
137
+ /**
138
+ * The oldest editor version the server works with. Older editors ask to be updated instead of
139
+ * connecting, and the server refuses their requests.
140
+ */
141
+ minimumEditorVersion: v.optional(cloudEditorVersionSchema),
142
+ /** The services editors reach with Cloud-signed tokens; absent when the deployment has none. */
143
+ services: v.optional(cloudServicesDiscoverySchema),
69
144
  /** Where people manage their plan and buy credits; absent when the deployment does not bill. */
70
- billing: v.optional(cloudBillingDiscoverySchema)
145
+ billing: v.optional(cloudBillingDiscoverySchema),
146
+ /** The community gallery; absent when the deployment has none. */
147
+ community: v.optional(cloudCommunityDiscoverySchema),
148
+ legal: v.optional(cloudLegalDiscoverySchema),
149
+ branding: v.optional(cloudBrandingSchema)
71
150
  })
72
151
  export type CloudDiscovery = v.InferOutput<typeof cloudDiscoverySchema>
73
152
 
@@ -12,6 +12,14 @@ export function isCloudChecksum(value: string): boolean {
12
12
  /** The most images one revision, or one request for image uploads, may name. */
13
13
  export const CLOUD_MAX_DOCUMENT_IMAGES = 10_000
14
14
 
15
+ /**
16
+ * The most a Cloud API request body may hold; a server refuses anything past it before reading
17
+ * it. Files go to the object store, never through the API, so only lists grow large: a save's
18
+ * images fit with room to spare, and a client commits image uploads, whose part lists can run
19
+ * long, in batches under half of it.
20
+ */
21
+ export const CLOUD_API_MAX_BODY_BYTES = 8 * 1024 * 1024
22
+
15
23
  /**
16
24
  * An image's name inside a `.fig` file that Cloud stores apart from it: the SHA-1 Figma names it
17
25
  * by, or an older plain name. A client leaves images under other names inside the file.
@@ -89,6 +97,25 @@ export const sharedDocumentSchema = v.object({
89
97
  })
90
98
  export type SharedDocument = v.InferOutput<typeof sharedDocumentSchema>
91
99
 
100
+ /**
101
+ * A document in Trash the person may restore: who deleted it and when, and when it goes for good.
102
+ * `canPurge` says whether they may also delete it for good before then.
103
+ */
104
+ export const trashedDocumentSchema = v.object({
105
+ id: v.pipe(v.string(), v.uuid()),
106
+ workspaceId: v.pipe(v.string(), v.uuid()),
107
+ workspaceName: v.string(),
108
+ name: v.string(),
109
+ kind: v.optional(documentKindSchema, 'design'),
110
+ deletedAt: v.string(),
111
+ deletedBy: v.nullable(v.object({ name: v.string() })),
112
+ purgeAt: v.string(),
113
+ canPurge: v.boolean()
114
+ })
115
+ export type TrashedDocument = v.InferOutput<typeof trashedDocumentSchema>
116
+
117
+ export const trashSchema = v.object({ documents: v.array(trashedDocumentSchema) })
118
+
92
119
  export const documentDownloadSchema = v.object({
93
120
  document: documentSummarySchema,
94
121
  revisionId: v.pipe(v.string(), v.uuid()),
@@ -8,8 +8,8 @@ export const workspaceEntitlementsSchema = v.object({
8
8
  guestPresence: v.boolean(),
9
9
  collaboration: v.boolean(),
10
10
  revisionHistory: v.boolean(),
11
- // Optional so editors keep reading servers released before the AI service.
12
- cloudAI: v.optional(v.boolean(), false)
11
+ // Optional so editors keep reading servers released before services.
12
+ cloudServices: v.optional(v.boolean(), false)
13
13
  }),
14
14
  limits: v.object({
15
15
  maximumFileBytes: v.pipe(v.number(), v.integer(), v.minValue(1)),
@@ -26,3 +26,13 @@ export const workspaceEntitlementsSchema = v.object({
26
26
  })
27
27
  })
28
28
  export type WorkspaceEntitlements = v.InferOutput<typeof workspaceEntitlementsSchema>
29
+
30
+ /**
31
+ * An account's own plan and the storage its workspaces hold together. A workspace reports the
32
+ * same for its owner, so the two read alike.
33
+ */
34
+ export const accountEntitlementsSchema = workspaceEntitlementsSchema
35
+ export type AccountEntitlements = WorkspaceEntitlements
36
+ export const accountEntitlementsResponseSchema = v.object({
37
+ entitlements: accountEntitlementsSchema
38
+ })
@@ -1,41 +1,86 @@
1
1
  export * from './account'
2
+ export * from './locale'
2
3
  export {
3
- AI_ERROR_STATUS,
4
- aiCatalogSchema,
5
- aiCreditBucketSchema,
6
- aiErrorCodeSchema,
7
- aiErrorSchema,
8
- aiModelSchema,
9
- aiTokenClaimsSchema,
10
- aiTokenSchema,
11
- aiUsageEntrySchema,
12
- aiUsagePageSchema,
13
- aiUsageQuerySchema,
14
- aiWalletSchema,
15
- CLOUD_AI_API_PATHS,
16
- CLOUD_AI_CONTRACT_VERSION,
17
- CLOUD_AI_JWKS_PATH,
18
- CLOUD_AI_TOKEN_AUDIENCE,
19
- cloudAIDiscoverySchema,
4
+ SERVICE_ERROR_STATUS,
5
+ serviceCatalogSchema,
6
+ creditBucketSchema,
7
+ serviceErrorCodeSchema,
8
+ serviceErrorSchema,
9
+ chatModelSchema,
10
+ servicesTokenClaimsSchema,
11
+ servicesTokenSchema,
12
+ usageEntrySchema,
13
+ usagePageSchema,
14
+ usageQuerySchema,
15
+ creditWalletSchema,
16
+ searchPricingSchema,
17
+ searchRequestSchema,
18
+ searchResultSchema,
19
+ searchResponseSchema,
20
+ MAX_SEARCH_RESULTS,
21
+ MAX_SEARCH_QUERY_LENGTH,
22
+ CLOUD_SERVICES_API_PATHS,
23
+ CLOUD_SERVICES_CONTRACT_VERSION,
24
+ CLOUD_SERVICES_JWKS_PATH,
25
+ CLOUD_SERVICES_TOKEN_AUDIENCE,
26
+ cloudServicesDiscoverySchema,
27
+ createServicesTokenSchema,
28
+ parseUsageQuery,
29
+ parseSearchRequest,
30
+ parseCreateServicesToken,
31
+ type ServiceCatalog,
32
+ type CreditBucket,
33
+ type ServiceError,
34
+ type ServiceErrorCode,
35
+ type ChatModel,
36
+ type ServicesToken,
37
+ type ServicesTokenClaims,
38
+ type UsageEntry,
39
+ type UsagePage,
40
+ type UsageQuery,
41
+ type CreditWallet,
42
+ type SearchPricing,
43
+ type SearchRequest,
44
+ type SearchRequestInput,
45
+ type SearchResult,
46
+ type SearchResponse,
47
+ type CloudServicesDiscovery,
48
+ type CreateServicesTokenInput,
49
+ type CloudServicesAPI,
50
+ type CloudServicesSchema,
51
+ sendsTokenSafely
52
+ } from './services'
53
+ export {
54
+ BILLING_ERROR_STATUS,
55
+ CLOUD_ACCOUNT_PLAN_PATH,
56
+ CLOUD_BILLING_API_PATHS,
57
+ CLOUD_BILLING_CONTRACT_VERSION,
58
+ CLOUD_BILLING_TOKEN_AUDIENCE,
59
+ billingAccountSchema,
60
+ billingCatalogSchema,
61
+ billingErrorCodeSchema,
62
+ billingErrorSchema,
63
+ billingPlanSchema,
64
+ billingRedirectSchema,
65
+ billingTokenClaimsSchema,
66
+ billingTokenSchema,
67
+ checkoutRequestSchema,
20
68
  cloudBillingDiscoverySchema,
21
- createAITokenSchema,
22
- parseAIUsageQuery,
23
- parseCreateAIToken,
24
- type AICatalog,
25
- type AICreditBucket,
26
- type AIError,
27
- type AIErrorCode,
28
- type AIModel,
29
- type AIToken,
30
- type AITokenClaims,
31
- type AIUsageEntry,
32
- type AIUsagePage,
33
- type AIUsageQuery,
34
- type AIWallet,
35
- type CloudAIDiscovery,
69
+ creditPackSchema,
70
+ type BillingAccount,
71
+ type BillingCatalog,
72
+ type BillingError,
73
+ type BillingErrorCode,
74
+ type BillingPlan,
75
+ type BillingRedirect,
76
+ type BillingToken,
77
+ type BillingTokenClaims,
78
+ type CheckoutRequest,
79
+ type CloudBillingAPI,
36
80
  type CloudBillingDiscovery,
37
- type CreateAITokenInput
38
- } from './ai'
81
+ type CloudBillingSchema,
82
+ type CreditPack
83
+ } from './billing'
39
84
  export * from './admin'
40
85
  export {
41
86
  cloudPresenceSchema,
@@ -46,27 +91,42 @@ export {
46
91
  type CollaborationTicket
47
92
  } from './collaboration'
48
93
  export * from './relay'
49
- export { workspaceEntitlementsSchema, type WorkspaceEntitlements } from './entitlements'
94
+ export {
95
+ accountEntitlementsResponseSchema,
96
+ accountEntitlementsSchema,
97
+ workspaceEntitlementsSchema,
98
+ type AccountEntitlements,
99
+ type WorkspaceEntitlements
100
+ } from './entitlements'
50
101
  export {
51
102
  CLOUD_DISCOVERY_PATH,
103
+ CLOUD_EDITOR_VERSION_HEADER,
52
104
  CLOUD_PROTOCOL_VERSION,
53
105
  cloudAuthenticationSchema,
106
+ cloudBrandingSchema,
54
107
  cloudCapabilitiesSchema,
55
108
  cloudDeploymentSchema,
109
+ cloudCommunityDiscoverySchema,
56
110
  cloudDiscoverySchema,
57
111
  cloudEditorVersionSchema,
112
+ cloudLegalDiscoverySchema,
58
113
  cloudListingSchema,
59
114
  cloudServerOrigin,
115
+ isEditorVersionAtLeast,
60
116
  parseCloudDiscovery,
61
117
  type CloudAuthentication,
118
+ type CloudBranding,
62
119
  type CloudCapabilities,
63
120
  type CloudDeployment,
121
+ type CloudCommunityDiscovery,
64
122
  type CloudDiscovery,
123
+ type CloudLegalDiscovery,
65
124
  type CloudListing
66
125
  } from './discovery'
67
126
  export {
68
127
  CLOUD_DOCUMENT_NAME_MAX_LENGTH,
69
128
  CLOUD_IMAGE_NAME_PATTERN,
129
+ CLOUD_API_MAX_BODY_BYTES,
70
130
  CLOUD_MAX_DOCUMENT_IMAGES,
71
131
  CLOUD_PROTOCOL_MAX_UPLOAD_BYTES,
72
132
  cloudActorSchema,
@@ -86,6 +146,9 @@ export {
86
146
  documentSummarySchema,
87
147
  sharedDocumentSchema,
88
148
  type SharedDocument,
149
+ trashSchema,
150
+ trashedDocumentSchema,
151
+ type TrashedDocument,
89
152
  workspaceUsageSchema,
90
153
  isCloudChecksum,
91
154
  parseCommitImageUploads,
@@ -129,12 +192,10 @@ export {
129
192
  documentShareSchema,
130
193
  invitationContinuationSchema,
131
194
  invitationPreviewSchema,
132
- lookupCloudUserSchema,
133
195
  parseAcceptDocumentInvitation,
134
196
  parseCreateInvitationContinuation,
135
197
  parseCreateDocumentInvitation,
136
198
  parseCreateDocumentShare,
137
- parseLookupCloudUser,
138
199
  parsePutDocumentGrant,
139
200
  parseRequestSharedImageLinks,
140
201
  parseResolveDocumentShare,
@@ -155,7 +216,6 @@ export {
155
216
  type DocumentShare,
156
217
  type InvitationContinuation,
157
218
  type InvitationPreview,
158
- type LookupCloudUserInput,
159
219
  type PutDocumentGrantInput,
160
220
  type RequestSharedImageLinksInput,
161
221
  type ResolveDocumentShareInput,
@@ -191,14 +251,29 @@ export {
191
251
  type WorkspaceSummary
192
252
  } from './workspaces'
193
253
  export {
254
+ CLOUD_COMMUNITY_PATH,
255
+ cloudCommunityDesktopLinkURL,
256
+ cloudCommunityPagePath,
194
257
  cloudDesktopLinkURL,
195
258
  cloudDocumentPath,
196
259
  cloudDocumentURL,
197
260
  cloudInvitationURL,
198
261
  cloudShareURL,
199
262
  parseCloudLinkPath,
263
+ cloudCommunityPath,
264
+ cloudCommunityURL,
200
265
  type CloudLinkKind,
201
266
  type CloudLinkPathKind
202
267
  } from './links'
203
- export { CLOUD_PORTAL_PAGE_ROOTS, isCloudPortalPage } from './portal'
268
+ export { CLOUD_PORTAL_COMMUNITY_PAGES, CLOUD_PORTAL_PAGE_ROOTS, isCloudPortalPage } from './portal'
204
269
  export * from './versions'
270
+ export * from './community'
271
+ export {
272
+ DOCUMENT_REPORT_DESCRIPTION_MAX,
273
+ documentReportReasonSchema,
274
+ fileDocumentReportResponseSchema,
275
+ fileDocumentReportSchema,
276
+ parseFileDocumentReport,
277
+ type DocumentReportReason,
278
+ type FileDocumentReportInput
279
+ } from './reports'