@cloudpdf/contract 3.0.0-next.1 → 3.0.0-next.3

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.
package/dist/index.js CHANGED
@@ -14,6 +14,14 @@ import {
14
14
  var sha256Hex = /^[0-9a-f]{64}$/i;
15
15
  var docIdPattern = /^[A-Za-z0-9_-]+$/;
16
16
  var tenantIdPattern = /^[A-Za-z0-9_-]+$/;
17
+ var originPattern = /^https?:\/\/(\*\.)?[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?)*(:\d{1,5})?$/;
18
+ var originPatternArray = z.array(
19
+ z.string().max(262).regex(
20
+ originPattern,
21
+ "must be a web origin like https://example.com (optionally one leading *. wildcard label, optional port, no path)"
22
+ )
23
+ ).min(1).max(32);
24
+ var shareTokenPattern = /^shr_[A-Za-z0-9_-]{24}$/;
17
25
  var adminWirePaths = {
18
26
  tenants: "/v1/tenants",
19
27
  tenant: (tenantId) => `/v1/tenants/${encodeURIComponent(tenantId)}`,
@@ -21,16 +29,28 @@ var adminWirePaths = {
21
29
  documentsInit: (tenantId) => `/v1/tenants/${encodeURIComponent(tenantId)}/documents/init`,
22
30
  document: (tenantId, docId) => `/v1/tenants/${encodeURIComponent(tenantId)}/documents/${encodeURIComponent(docId)}`,
23
31
  documentCommit: (tenantId, docId) => `/v1/tenants/${encodeURIComponent(tenantId)}/documents/${encodeURIComponent(docId)}/commit`,
24
- documentUploadDirect: (tenantId, docId) => `/v1/tenants/${encodeURIComponent(tenantId)}/documents/${encodeURIComponent(docId)}/upload-direct`,
32
+ documentUploadProxy: (tenantId, docId) => `/v1/tenants/${encodeURIComponent(tenantId)}/documents/${encodeURIComponent(docId)}/upload-proxy`,
25
33
  documentDownload: (tenantId, docId) => `/v1/tenants/${encodeURIComponent(tenantId)}/documents/${encodeURIComponent(docId)}/download`,
26
34
  /** The warmed dashboard-tile artifact. Returns 404 while `pending`/`locked`. */
27
35
  documentThumbnail: (tenantId, docId) => `/v1/tenants/${encodeURIComponent(tenantId)}/documents/${encodeURIComponent(docId)}/thumbnail`,
28
36
  tokenIssue: (tenantId) => `/v1/tenants/${encodeURIComponent(tenantId)}/tokens`,
29
37
  tokenRevoke: (tenantId, jti) => `/v1/tenants/${encodeURIComponent(tenantId)}/tokens/${encodeURIComponent(jti)}/revoke`,
38
+ shares: (tenantId) => `/v1/tenants/${encodeURIComponent(tenantId)}/shares`,
39
+ share: (tenantId, shareId) => `/v1/tenants/${encodeURIComponent(tenantId)}/shares/${encodeURIComponent(shareId)}`,
40
+ tenantUsage: (tenantId) => `/v1/tenants/${encodeURIComponent(tenantId)}/usage`,
41
+ tenantSuspend: (tenantId) => `/v1/tenants/${encodeURIComponent(tenantId)}/suspend`,
42
+ tenantResume: (tenantId) => `/v1/tenants/${encodeURIComponent(tenantId)}/resume`,
43
+ /**
44
+ * The public share-session exchange. Deliberately outside any tenant
45
+ * subtree: the caller holds only a share token and does not know the
46
+ * tenant — the grant row resolves it server-side.
47
+ */
48
+ shareSessions: "/v1/share-sessions",
30
49
  /** Deployment-global singletons: API-token only, no tenant context. */
31
50
  deploymentLicenseStatus: "/v1/deployment/license/status"
32
51
  };
33
52
  var DedupModeSchema = z.enum(["always-create", "reuse-existing"]);
53
+ var UploadPreferenceSchema = z.enum(["auto", "presigned", "proxy"]);
34
54
  var DocumentStateSchema = z.enum(["pending", "ready", "failed", "deleting"]);
35
55
  var AdminDocumentRecordSchema = z.object({
36
56
  id: z.string(),
@@ -55,7 +75,8 @@ var AdminDocumentInitRequestSchema = z.object({
55
75
  idempotencyKey: z.string().optional(),
56
76
  dedupMode: DedupModeSchema.optional(),
57
77
  docId: z.string().regex(docIdPattern).optional(),
58
- uploadTtlSec: z.number().finite().min(60).max(3600).optional()
78
+ uploadTtlSec: z.number().finite().min(60).max(3600).optional(),
79
+ uploadPreference: UploadPreferenceSchema.optional()
59
80
  });
60
81
  var AdminPresignedUploadSchema = z.object({
61
82
  url: z.string(),
@@ -70,7 +91,7 @@ var AdminInitUploadSchema = z.discriminatedUnion("kind", [
70
91
  key: z.string()
71
92
  }),
72
93
  z.object({
73
- kind: z.literal("direct"),
94
+ kind: z.literal("proxy"),
74
95
  url: z.string(),
75
96
  key: z.string()
76
97
  })
@@ -116,7 +137,7 @@ var AdminDocumentListResponseSchema = z.object({
116
137
  */
117
138
  nextCursor: z.string().nullable().optional()
118
139
  });
119
- var AdminUploadDirectResponseSchema = z.object({
140
+ var AdminUploadProxyResponseSchema = z.object({
120
141
  sha256: z.string().regex(sha256Hex)
121
142
  });
122
143
  var AdminErrorPayloadSchema = z.object({
@@ -163,6 +184,13 @@ var AdminTenantRecordSchema = z.object({
163
184
  name: z.string(),
164
185
  /** True when the namespace materialized on first use rather than via explicit create. */
165
186
  autoProvisioned: z.boolean(),
187
+ /**
188
+ * `suspended` tenants fail closed: every tenant JWT, doc JWT, and
189
+ * share exchange is refused until resume. The API token is exempt —
190
+ * the operator must be able to inspect, resume, or delete a
191
+ * suspended tenant. Optional because older servers omit it.
192
+ */
193
+ status: z.enum(["active", "suspended"]).optional(),
166
194
  createdAt: z.number()
167
195
  });
168
196
  var AdminTenantCreateRequestSchema = z.object({
@@ -192,7 +220,8 @@ var adminTenantScopes = [
192
220
  "docs.read",
193
221
  "docs.delete",
194
222
  "tokens.issue-doc",
195
- "tokens.revoke"
223
+ "tokens.revoke",
224
+ "shares.manage"
196
225
  ];
197
226
  var AdminTokenIssueDocRequestSchema = z.object({
198
227
  kind: z.literal("doc"),
@@ -210,6 +239,14 @@ var AdminTokenIssueDocRequestSchema = z.object({
210
239
  displayName: z.string().max(256).optional(),
211
240
  groupId: z.string().max(256).optional(),
212
241
  groups: z.array(z.string().max(256)).max(64).optional(),
242
+ /**
243
+ * Origin lock: web origins (scheme + host, optional port; one leading
244
+ * `*.` wildcard label allowed) the minted token may be presented
245
+ * from. Enforced on every engine request that carries a browser
246
+ * `Origin` header — hotlink prevention, not DRM: non-browser callers
247
+ * are governed by the token itself.
248
+ */
249
+ origins: originPatternArray.optional(),
213
250
  /** Token lifetime in seconds. */
214
251
  expiresIn: z.number().int().min(60).max(60 * 60 * 24 * 90)
215
252
  });
@@ -230,10 +267,111 @@ var AdminTokenIssueResponseSchema = z.object({
230
267
  /** Unix seconds. */
231
268
  expiresAt: z.number()
232
269
  });
270
+ var ShareGrantRecordSchema = z.object({
271
+ /** Grant id; doubles as the public share token (`shr_…`). */
272
+ id: z.string(),
273
+ tenantId: z.string(),
274
+ docId: z.string(),
275
+ layerName: z.string(),
276
+ /** Doc capabilities the exchanged session carries. */
277
+ scope: z.array(z.string()),
278
+ /** Origin allowlist; null means any origin. */
279
+ origins: z.array(z.string()).nullable(),
280
+ /** True when a passphrase is required at exchange. The passphrase itself is never returned. */
281
+ passwordProtected: z.boolean(),
282
+ /** Lifetime of each exchanged session token, in seconds. */
283
+ sessionTtlSeconds: z.number(),
284
+ /** Paused grants refuse exchange (404) but keep their configuration. */
285
+ disabled: z.boolean(),
286
+ /** Unix epoch ms after which exchange returns 410; null = no expiry. */
287
+ expiresAt: z.number().nullable(),
288
+ /** Total successful exchanges — a dashboard convenience, not the usage meter. */
289
+ exchangeCount: z.number(),
290
+ lastExchangedAt: z.number().nullable(),
291
+ createdBy: z.string(),
292
+ createdAt: z.number(),
293
+ updatedAt: z.number()
294
+ });
295
+ var ShareGrantCreateRequestSchema = z.object({
296
+ docId: z.string().regex(docIdPattern),
297
+ layerName: z.string().min(1).max(256).optional(),
298
+ /**
299
+ * Doc capability scopes the exchanged session will carry. Validated
300
+ * server-side against the engine's scope vocabulary, same as
301
+ * `tokens.issue`.
302
+ */
303
+ scope: z.array(z.string().min(1).max(128)).min(1).max(64),
304
+ /** Origin allowlist; omit to allow any origin. */
305
+ origins: originPatternArray.optional(),
306
+ /** Optional passphrase gate, checked at exchange. Stored as a hash; never returned. */
307
+ password: z.string().min(1).max(1024).optional(),
308
+ /** Lifetime of exchanged session tokens. Default 600. */
309
+ sessionTtlSeconds: z.number().int().min(60).max(60 * 60).optional(),
310
+ /** Unix epoch ms after which the grant stops exchanging; omit for no expiry. */
311
+ expiresAt: z.number().int().positive().optional()
312
+ });
313
+ var ShareGrantUpdateRequestSchema = z.object({
314
+ scope: z.array(z.string().min(1).max(128)).min(1).max(64).optional(),
315
+ origins: originPatternArray.nullable().optional(),
316
+ password: z.string().min(1).max(1024).nullable().optional(),
317
+ sessionTtlSeconds: z.number().int().min(60).max(60 * 60).optional(),
318
+ disabled: z.boolean().optional(),
319
+ expiresAt: z.number().int().positive().nullable().optional()
320
+ });
321
+ var ShareGrantResponseSchema = z.object({
322
+ share: ShareGrantRecordSchema
323
+ });
324
+ var ShareGrantListQuerySchema = z.object({
325
+ limit: z.coerce.number().int().min(1).max(ADMIN_DOCUMENT_LIST_MAX_LIMIT).default(ADMIN_DOCUMENT_LIST_DEFAULT_LIMIT),
326
+ cursor: z.string().min(1).optional(),
327
+ /** Filter to one document's grants. */
328
+ docId: z.string().regex(docIdPattern).optional()
329
+ });
330
+ var ShareGrantListResponseSchema = z.object({
331
+ shares: z.array(ShareGrantRecordSchema),
332
+ /** Opaque cursor for the next page; `null` on the last page. */
333
+ nextCursor: z.string().nullable().optional()
334
+ });
335
+ var AdminTenantShareParamsSchema = z.object({
336
+ tenantId: z.string().regex(tenantIdPattern),
337
+ shareId: z.string().regex(shareTokenPattern)
338
+ });
339
+ var ShareExchangeRequestSchema = z.object({
340
+ shareToken: z.string().regex(shareTokenPattern),
341
+ /** Required when the grant is passphrase-protected (422 otherwise). */
342
+ password: z.string().min(1).max(1024).optional()
343
+ });
344
+ var ShareSessionResponseSchema = z.object({
345
+ /** A doc-scoped session JWT carrying the grant's capabilities and origin lock. */
346
+ token: z.string(),
347
+ docId: z.string(),
348
+ layerName: z.string(),
349
+ /** Unix seconds when the session token expires; exchange again for a fresh one. */
350
+ expiresAt: z.number()
351
+ });
352
+ var TenantUsageQuerySchema = z.object({
353
+ /** UTC month to report, `YYYY-MM`. Defaults to the current month. */
354
+ period: z.string().regex(/^\d{4}-(0[1-9]|1[0-2])$/).optional()
355
+ });
356
+ var TenantUsageResponseSchema = z.object({
357
+ tenantId: z.string(),
358
+ periodStart: z.string(),
359
+ periodEnd: z.string(),
360
+ metrics: z.object({
361
+ "pdf.views": z.number(),
362
+ "pdf.uploads": z.number(),
363
+ "storage.bytes": z.number()
364
+ })
365
+ });
366
+ var TenantSuspendRequestSchema = z.object({
367
+ /** Optional operator reason, written to the security-events trail. */
368
+ reason: z.string().max(1024).optional()
369
+ });
233
370
  var adminCredentials = ["api-token", "tenant-jwt", "doc-jwt"];
234
371
  var adminOperations = {
235
372
  "tenants.create": {
236
373
  operationId: "tenants.create",
374
+ title: "Create tenant",
237
375
  summary: "Create a tenant, or confirm it already exists \u2014 ensure-style, idempotent.",
238
376
  method: "POST",
239
377
  path: adminWirePaths.tenants,
@@ -247,6 +385,7 @@ var adminOperations = {
247
385
  },
248
386
  "tenants.list": {
249
387
  operationId: "tenants.list",
388
+ title: "List tenants",
250
389
  summary: "List tenants, newest first, cursor-paginated.",
251
390
  method: "GET",
252
391
  path: adminWirePaths.tenants,
@@ -260,6 +399,7 @@ var adminOperations = {
260
399
  },
261
400
  "tenants.get": {
262
401
  operationId: "tenants.get",
402
+ title: "Get tenant",
263
403
  summary: "Fetch one tenant record.",
264
404
  method: "GET",
265
405
  path: "/v1/tenants/:tenantId",
@@ -273,6 +413,7 @@ var adminOperations = {
273
413
  },
274
414
  "tenants.delete": {
275
415
  operationId: "tenants.delete",
416
+ title: "Delete tenant",
276
417
  summary: "Delete a tenant and everything under it.",
277
418
  method: "DELETE",
278
419
  path: "/v1/tenants/:tenantId",
@@ -287,6 +428,7 @@ var adminOperations = {
287
428
  },
288
429
  "documents.init": {
289
430
  operationId: "documents.init",
431
+ title: "Initialize upload",
290
432
  summary: "Begin an upload: create (or resume/dedupe) a pending document and issue upload access.",
291
433
  method: "POST",
292
434
  path: "/v1/tenants/:tenantId/documents/init",
@@ -301,6 +443,7 @@ var adminOperations = {
301
443
  },
302
444
  "documents.commit": {
303
445
  operationId: "documents.commit",
446
+ title: "Commit upload",
304
447
  summary: "Finish an upload: verify the SHA-256 and promote the document to ready.",
305
448
  method: "POST",
306
449
  path: "/v1/tenants/:tenantId/documents/:id/commit",
@@ -314,24 +457,28 @@ var adminOperations = {
314
457
  404: { contentType: "application/json", schema: AdminErrorPayloadSchema }
315
458
  }
316
459
  },
317
- "documents.uploadDirect": {
318
- operationId: "documents.uploadDirect",
319
- summary: "Upload the PDF bytes through the origin instead of a presigned URL.",
460
+ "documents.uploadProxy": {
461
+ operationId: "documents.uploadProxy",
462
+ title: "Upload document through the origin",
463
+ summary: "Upload a bounded PDF through the API when the initialized transfer kind is proxy.",
320
464
  method: "POST",
321
- path: "/v1/tenants/:tenantId/documents/:id/upload-direct",
465
+ path: "/v1/tenants/:tenantId/documents/:id/upload-proxy",
322
466
  credentials: ["api-token", "tenant-jwt"],
323
467
  scope: ["docs.create"],
324
468
  params: AdminTenantDocParamsSchema,
325
469
  body: {
326
- contentType: ["application/pdf", "application/octet-stream", "multipart/form-data"]
470
+ contentType: "multipart/form-data"
327
471
  },
328
472
  responses: {
329
- 200: { contentType: "application/json", schema: AdminUploadDirectResponseSchema },
330
- 400: { contentType: "application/json", schema: AdminErrorPayloadSchema }
331
- }
473
+ 200: { contentType: "application/json", schema: AdminUploadProxyResponseSchema },
474
+ 400: { contentType: "application/json", schema: AdminErrorPayloadSchema },
475
+ 409: { contentType: "application/json", schema: AdminErrorPayloadSchema }
476
+ },
477
+ notes: "This bounded origin-mediated fallback must only be used after documents.init returns upload.kind=proxy. Auto mode prefers a presigned object-store PUT whenever available."
332
478
  },
333
479
  "documents.list": {
334
480
  operationId: "documents.list",
481
+ title: "List documents",
335
482
  summary: "List documents in the tenant, newest first, cursor-paginated.",
336
483
  method: "GET",
337
484
  path: "/v1/tenants/:tenantId/documents",
@@ -346,6 +493,7 @@ var adminOperations = {
346
493
  },
347
494
  "documents.get": {
348
495
  operationId: "documents.get",
496
+ title: "Get document",
349
497
  summary: "Fetch one document record.",
350
498
  method: "GET",
351
499
  path: "/v1/tenants/:tenantId/documents/:id",
@@ -360,6 +508,7 @@ var adminOperations = {
360
508
  },
361
509
  "documents.download": {
362
510
  operationId: "documents.download",
511
+ title: "Download document",
363
512
  summary: "Download the stored base PDF bytes.",
364
513
  method: "GET",
365
514
  path: "/v1/tenants/:tenantId/documents/:id/download",
@@ -374,6 +523,7 @@ var adminOperations = {
374
523
  },
375
524
  "documents.delete": {
376
525
  operationId: "documents.delete",
526
+ title: "Delete document",
377
527
  summary: "Delete a document and its stored artifacts.",
378
528
  method: "DELETE",
379
529
  path: "/v1/tenants/:tenantId/documents/:id",
@@ -388,6 +538,7 @@ var adminOperations = {
388
538
  },
389
539
  "documents.thumbnail": {
390
540
  operationId: "documents.thumbnail",
541
+ title: "Get thumbnail",
391
542
  summary: "Fetch the warmed dashboard-tile render for a document.",
392
543
  method: "GET",
393
544
  path: "/v1/tenants/:tenantId/documents/:id/thumbnail",
@@ -401,6 +552,7 @@ var adminOperations = {
401
552
  },
402
553
  "deployment.licenseStatus": {
403
554
  operationId: "deployment.licenseStatus",
555
+ title: "License status",
404
556
  summary: "License decision plus usage-reporting and meter snapshots for this deployment.",
405
557
  method: "GET",
406
558
  path: adminWirePaths.deploymentLicenseStatus,
@@ -412,6 +564,7 @@ var adminOperations = {
412
564
  },
413
565
  "tokens.issue": {
414
566
  operationId: "tokens.issue",
567
+ title: "Issue token",
415
568
  summary: "Mint a delegated JWT: a doc token, or (API token only) a tenant token.",
416
569
  method: "POST",
417
570
  path: "/v1/tenants/:tenantId/tokens",
@@ -429,6 +582,7 @@ var adminOperations = {
429
582
  },
430
583
  "tokens.revoke": {
431
584
  operationId: "tokens.revoke",
585
+ title: "Revoke token",
432
586
  summary: "Revoke a token by jti; live sessions drop on their next heartbeat.",
433
587
  method: "POST",
434
588
  path: "/v1/tenants/:tenantId/tokens/:jti/revoke",
@@ -445,6 +599,153 @@ var adminOperations = {
445
599
  400: { contentType: "application/json", schema: AdminErrorPayloadSchema }
446
600
  },
447
601
  notes: "Mounted only when the deployment enables token revocation."
602
+ },
603
+ "tenants.usage": {
604
+ operationId: "tenants.usage",
605
+ title: "Tenant usage",
606
+ summary: "Per-tenant usage facts (views, uploads, stored bytes) for one UTC month.",
607
+ method: "GET",
608
+ path: "/v1/tenants/:tenantId/usage",
609
+ credentials: ["api-token", "tenant-jwt"],
610
+ scope: ["docs.read"],
611
+ params: AdminTenantParamsSchema,
612
+ query: TenantUsageQuerySchema,
613
+ responses: {
614
+ 200: { contentType: "application/json", schema: TenantUsageResponseSchema },
615
+ 400: { contentType: "application/json", schema: AdminErrorPayloadSchema },
616
+ 404: { contentType: "application/json", schema: AdminErrorPayloadSchema }
617
+ },
618
+ notes: "Facts only \u2014 no limits or billing state. Views count share exchanges plus authorized /v1/access grants, deduplicated across the two."
619
+ },
620
+ "tenants.suspend": {
621
+ operationId: "tenants.suspend",
622
+ title: "Suspend tenant",
623
+ summary: "Fail the tenant closed: refuse every tenant JWT, doc JWT, and share exchange.",
624
+ method: "POST",
625
+ path: "/v1/tenants/:tenantId/suspend",
626
+ credentials: ["api-token"],
627
+ scope: [],
628
+ params: AdminTenantParamsSchema,
629
+ body: {
630
+ contentType: "application/json",
631
+ schema: TenantSuspendRequestSchema,
632
+ required: false
633
+ },
634
+ responses: {
635
+ 204: {},
636
+ 404: { contentType: "application/json", schema: AdminErrorPayloadSchema }
637
+ },
638
+ notes: "Instantly reversible with resume. The API token is exempt, so a suspended tenant can still be inspected, exported, resumed, or deleted."
639
+ },
640
+ "tenants.resume": {
641
+ operationId: "tenants.resume",
642
+ title: "Resume tenant",
643
+ summary: "Lift a suspension; credentials for the tenant verify again.",
644
+ method: "POST",
645
+ path: "/v1/tenants/:tenantId/resume",
646
+ credentials: ["api-token"],
647
+ scope: [],
648
+ params: AdminTenantParamsSchema,
649
+ responses: {
650
+ 204: {},
651
+ 404: { contentType: "application/json", schema: AdminErrorPayloadSchema }
652
+ }
653
+ },
654
+ "shares.create": {
655
+ operationId: "shares.create",
656
+ title: "Create share",
657
+ summary: "Create a standing share grant for one document \u2014 the no-backend embed credential.",
658
+ method: "POST",
659
+ path: "/v1/tenants/:tenantId/shares",
660
+ credentials: ["api-token", "tenant-jwt"],
661
+ scope: ["shares.manage"],
662
+ params: AdminTenantParamsSchema,
663
+ body: { contentType: "application/json", schema: ShareGrantCreateRequestSchema },
664
+ responses: {
665
+ 200: { contentType: "application/json", schema: ShareGrantResponseSchema },
666
+ 400: { contentType: "application/json", schema: AdminErrorPayloadSchema },
667
+ 403: { contentType: "application/json", schema: AdminErrorPayloadSchema },
668
+ 404: { contentType: "application/json", schema: AdminErrorPayloadSchema }
669
+ },
670
+ notes: "The returned share id IS the public share token. Mounted only when the deployment can sign (HS256 mode) \u2014 exchange mints session JWTs, so grants exist only where minting does."
671
+ },
672
+ "shares.list": {
673
+ operationId: "shares.list",
674
+ title: "List shares",
675
+ summary: "List share grants in the tenant, newest first, cursor-paginated.",
676
+ method: "GET",
677
+ path: "/v1/tenants/:tenantId/shares",
678
+ credentials: ["api-token", "tenant-jwt"],
679
+ scope: ["shares.manage"],
680
+ params: AdminTenantParamsSchema,
681
+ query: ShareGrantListQuerySchema,
682
+ responses: {
683
+ 200: { contentType: "application/json", schema: ShareGrantListResponseSchema },
684
+ 400: { contentType: "application/json", schema: AdminErrorPayloadSchema }
685
+ }
686
+ },
687
+ "shares.get": {
688
+ operationId: "shares.get",
689
+ title: "Get share",
690
+ summary: "Fetch one share grant.",
691
+ method: "GET",
692
+ path: "/v1/tenants/:tenantId/shares/:shareId",
693
+ credentials: ["api-token", "tenant-jwt"],
694
+ scope: ["shares.manage"],
695
+ params: AdminTenantShareParamsSchema,
696
+ responses: {
697
+ 200: { contentType: "application/json", schema: ShareGrantResponseSchema },
698
+ 404: { contentType: "application/json", schema: AdminErrorPayloadSchema }
699
+ }
700
+ },
701
+ "shares.update": {
702
+ operationId: "shares.update",
703
+ title: "Update share",
704
+ summary: "Edit a grant in place \u2014 every embedded copy of the token follows the row.",
705
+ method: "PATCH",
706
+ path: "/v1/tenants/:tenantId/shares/:shareId",
707
+ credentials: ["api-token", "tenant-jwt"],
708
+ scope: ["shares.manage"],
709
+ params: AdminTenantShareParamsSchema,
710
+ body: { contentType: "application/json", schema: ShareGrantUpdateRequestSchema },
711
+ responses: {
712
+ 200: { contentType: "application/json", schema: ShareGrantResponseSchema },
713
+ 400: { contentType: "application/json", schema: AdminErrorPayloadSchema },
714
+ 404: { contentType: "application/json", schema: AdminErrorPayloadSchema }
715
+ }
716
+ },
717
+ "shares.delete": {
718
+ operationId: "shares.delete",
719
+ title: "Revoke share",
720
+ summary: "Delete a grant; exchange stops immediately, live sessions lapse at their exp.",
721
+ method: "DELETE",
722
+ path: "/v1/tenants/:tenantId/shares/:shareId",
723
+ credentials: ["api-token", "tenant-jwt"],
724
+ scope: ["shares.manage"],
725
+ params: AdminTenantShareParamsSchema,
726
+ responses: {
727
+ 204: {},
728
+ 404: { contentType: "application/json", schema: AdminErrorPayloadSchema }
729
+ }
730
+ },
731
+ "shares.exchange": {
732
+ operationId: "shares.exchange",
733
+ title: "Exchange share token",
734
+ summary: "Trade a public share token for a short-lived document session JWT.",
735
+ method: "POST",
736
+ path: adminWirePaths.shareSessions,
737
+ credentials: [],
738
+ scope: [],
739
+ body: { contentType: "application/json", schema: ShareExchangeRequestSchema },
740
+ responses: {
741
+ 200: { contentType: "application/json", schema: ShareSessionResponseSchema },
742
+ 400: { contentType: "application/json", schema: AdminErrorPayloadSchema },
743
+ 403: { contentType: "application/json", schema: AdminErrorPayloadSchema },
744
+ 404: { contentType: "application/json", schema: AdminErrorPayloadSchema },
745
+ 410: { contentType: "application/json", schema: AdminErrorPayloadSchema },
746
+ 422: { contentType: "application/json", schema: AdminErrorPayloadSchema }
747
+ },
748
+ notes: "Unauthenticated, but requires a browser Origin header, checked against the grant allowlist. Unknown, revoked, and disabled tokens are indistinguishable (404). Passphrase-protected grants return 422 SharePasswordRequired until `password` is supplied. Mounted only when the deployment can sign (HS256 mode)."
448
749
  }
449
750
  };
450
751
  var DocIdParamsSchema = z.object({
@@ -473,6 +774,7 @@ var MutationResponseSchema = z.object({ meta: MutationMetaSchema }).passthrough(
473
774
  var docOperations = {
474
775
  "doc.head": {
475
776
  operationId: "doc.head",
777
+ title: "Open document",
476
778
  summary: "Open a document and return its head (versions, page count, security).",
477
779
  method: "GET",
478
780
  path: wireTemplates.docHead,
@@ -488,6 +790,7 @@ var docOperations = {
488
790
  },
489
791
  "doc.manifest": {
490
792
  operationId: "doc.manifest",
793
+ title: "Get manifest",
491
794
  summary: "Full layer manifest at the layer's current version.",
492
795
  method: "GET",
493
796
  path: wireTemplates.layerManifest,
@@ -503,6 +806,7 @@ var docOperations = {
503
806
  },
504
807
  "doc.metadata.get": {
505
808
  operationId: "doc.metadata.get",
809
+ title: "Get metadata",
506
810
  summary: "Document metadata (PDF info dictionary view) for a layer.",
507
811
  method: "GET",
508
812
  path: wireTemplates.layerMetadata,
@@ -518,6 +822,7 @@ var docOperations = {
518
822
  },
519
823
  "doc.render": {
520
824
  operationId: "doc.render",
825
+ title: "Render page",
521
826
  summary: "Render one page as an image at the current layer version.",
522
827
  method: "GET",
523
828
  path: wireTemplates.layerRenderPage,
@@ -534,6 +839,7 @@ var docOperations = {
534
839
  },
535
840
  "doc.text": {
536
841
  operationId: "doc.text",
842
+ title: "Extract page text",
537
843
  summary: "Extracted text content for one page.",
538
844
  method: "GET",
539
845
  path: wireTemplates.layerTextPage,
@@ -549,6 +855,7 @@ var docOperations = {
549
855
  },
550
856
  "doc.annotations.list": {
551
857
  operationId: "doc.annotations.list",
858
+ title: "List annotations",
552
859
  summary: "One page's annotations at the current layer version.",
553
860
  method: "GET",
554
861
  path: wireTemplates.layerAnnotationItems,
@@ -564,6 +871,7 @@ var docOperations = {
564
871
  },
565
872
  "doc.annotations.create": {
566
873
  operationId: "doc.annotations.create",
874
+ title: "Create annotation",
567
875
  summary: "Create an annotation on a page.",
568
876
  method: "POST",
569
877
  path: wireTemplates.layerAnnotationItems,
@@ -582,6 +890,7 @@ var docOperations = {
582
890
  },
583
891
  "doc.annotations.update": {
584
892
  operationId: "doc.annotations.update",
893
+ title: "Update annotation",
585
894
  summary: "Update one annotation by key.",
586
895
  method: "PATCH",
587
896
  path: wireTemplates.layerAnnotationItem,
@@ -599,6 +908,7 @@ var docOperations = {
599
908
  },
600
909
  "doc.annotations.delete": {
601
910
  operationId: "doc.annotations.delete",
911
+ title: "Delete annotation",
602
912
  summary: "Delete one annotation by key.",
603
913
  method: "DELETE",
604
914
  path: wireTemplates.layerAnnotationItem,
@@ -614,6 +924,7 @@ var docOperations = {
614
924
  },
615
925
  "doc.forms.get": {
616
926
  operationId: "doc.forms.get",
927
+ title: "Get form snapshot",
617
928
  summary: "Reconciled form snapshot: fields, widgets, values.",
618
929
  method: "GET",
619
930
  path: wireTemplates.layerForm,
@@ -629,6 +940,7 @@ var docOperations = {
629
940
  },
630
941
  "doc.forms.setValue": {
631
942
  operationId: "doc.forms.setValue",
943
+ title: "Set form value",
632
944
  summary: "Set one form field's value.",
633
945
  method: "POST",
634
946
  path: wireTemplates.layerFormFieldValue,
@@ -646,6 +958,7 @@ var docOperations = {
646
958
  },
647
959
  "doc.forms.reset": {
648
960
  operationId: "doc.forms.reset",
961
+ title: "Reset form field",
649
962
  summary: "Reset one form field to its default value.",
650
963
  method: "POST",
651
964
  path: wireTemplates.layerFormFieldReset,
@@ -661,6 +974,7 @@ var docOperations = {
661
974
  },
662
975
  "doc.forms.exportData": {
663
976
  operationId: "doc.forms.exportData",
977
+ title: "Export form data",
664
978
  summary: "Export form data as FDF or XFDF.",
665
979
  method: "GET",
666
980
  path: wireTemplates.layerFormData,
@@ -677,6 +991,7 @@ var docOperations = {
677
991
  },
678
992
  "doc.forms.importData": {
679
993
  operationId: "doc.forms.importData",
994
+ title: "Import form data",
680
995
  summary: "Import form data (FDF/XFDF), filling matching fields.",
681
996
  method: "POST",
682
997
  path: wireTemplates.layerFormData,
@@ -694,6 +1009,7 @@ var docOperations = {
694
1009
  },
695
1010
  "doc.pages.move": {
696
1011
  operationId: "doc.pages.move",
1012
+ title: "Move pages",
697
1013
  summary: "Reorder pages.",
698
1014
  method: "POST",
699
1015
  path: wireTemplates.layerPagesMove,
@@ -711,6 +1027,7 @@ var docOperations = {
711
1027
  },
712
1028
  "doc.pages.rotate": {
713
1029
  operationId: "doc.pages.rotate",
1030
+ title: "Rotate pages",
714
1031
  summary: "Set absolute rotation on pages.",
715
1032
  method: "POST",
716
1033
  path: wireTemplates.layerPagesRotate,
@@ -728,6 +1045,7 @@ var docOperations = {
728
1045
  },
729
1046
  "doc.pages.delete": {
730
1047
  operationId: "doc.pages.delete",
1048
+ title: "Delete pages",
731
1049
  summary: "Delete pages.",
732
1050
  method: "POST",
733
1051
  path: wireTemplates.layerPagesDelete,
@@ -745,6 +1063,7 @@ var docOperations = {
745
1063
  },
746
1064
  "doc.pages.flatten": {
747
1065
  operationId: "doc.pages.flatten",
1066
+ title: "Flatten pages",
748
1067
  summary: "Flatten annotations and form fields into page content.",
749
1068
  method: "POST",
750
1069
  path: wireTemplates.layerPagesFlatten,
@@ -762,6 +1081,7 @@ var docOperations = {
762
1081
  },
763
1082
  "doc.redactions.apply": {
764
1083
  operationId: "doc.redactions.apply",
1084
+ title: "Apply redactions",
765
1085
  summary: "Apply pending redactions, permanently removing content.",
766
1086
  method: "POST",
767
1087
  path: wireTemplates.layerRedactionsApply,
@@ -779,6 +1099,7 @@ var docOperations = {
779
1099
  },
780
1100
  "doc.download": {
781
1101
  operationId: "doc.download",
1102
+ title: "Download PDF",
782
1103
  summary: "Download the layer's current PDF (base plus layer edits).",
783
1104
  method: "GET",
784
1105
  path: wireTemplates.layerDownload,
@@ -794,6 +1115,19 @@ var docOperations = {
794
1115
  }
795
1116
  };
796
1117
  var allOperations = { ...adminOperations, ...docOperations };
1118
+ var docsGroups = {
1119
+ deployment: { title: "Deployment" },
1120
+ tenants: { title: "Tenants" },
1121
+ documents: { title: "Tenant documents" },
1122
+ tokens: { title: "Tokens" },
1123
+ shares: { title: "Shares" },
1124
+ doc: { title: "Document operations", slug: "document-operations" },
1125
+ "doc.annotations": { title: "Annotations" },
1126
+ "doc.forms": { title: "Forms" },
1127
+ "doc.metadata": { title: "Metadata" },
1128
+ "doc.pages": { title: "Pages" },
1129
+ "doc.redactions": { title: "Redactions" }
1130
+ };
797
1131
  export {
798
1132
  ADMIN_DOCUMENT_LIST_DEFAULT_LIMIT,
799
1133
  ADMIN_DOCUMENT_LIST_MAX_LIMIT,
@@ -818,13 +1152,14 @@ export {
818
1152
  AdminTenantParamsSchema,
819
1153
  AdminTenantRecordSchema,
820
1154
  AdminTenantResponseSchema,
1155
+ AdminTenantShareParamsSchema,
821
1156
  AdminThumbnailUnavailablePayloadSchema,
822
1157
  AdminTokenIssueDocRequestSchema,
823
1158
  AdminTokenIssueRequestSchema,
824
1159
  AdminTokenIssueResponseSchema,
825
1160
  AdminTokenIssueTenantRequestSchema,
826
1161
  AdminTokenRevokeRequestSchema,
827
- AdminUploadDirectResponseSchema,
1162
+ AdminUploadProxyResponseSchema,
828
1163
  DedupModeSchema,
829
1164
  DocAnnotationParamsSchema,
830
1165
  DocFieldParamsSchema,
@@ -832,12 +1167,25 @@ export {
832
1167
  DocLayerParamsSchema,
833
1168
  DocPageParamsSchema,
834
1169
  DocumentStateSchema,
1170
+ ShareExchangeRequestSchema,
1171
+ ShareGrantCreateRequestSchema,
1172
+ ShareGrantListQuerySchema,
1173
+ ShareGrantListResponseSchema,
1174
+ ShareGrantRecordSchema,
1175
+ ShareGrantResponseSchema,
1176
+ ShareGrantUpdateRequestSchema,
1177
+ ShareSessionResponseSchema,
1178
+ TenantSuspendRequestSchema,
1179
+ TenantUsageQuerySchema,
1180
+ TenantUsageResponseSchema,
1181
+ UploadPreferenceSchema,
835
1182
  adminCredentials,
836
1183
  adminOperations,
837
1184
  adminTenantScopes,
838
1185
  adminWirePaths,
839
1186
  allOperations,
840
1187
  docOperations,
1188
+ docsGroups,
841
1189
  documentPasswordHeader
842
1190
  };
843
1191
  //# sourceMappingURL=index.js.map