@embedpdf/engine-core 3.0.0-next.14 → 3.0.0-next.16
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/AnnotationList-DcyhF2kU.d.cts +27691 -0
- package/dist/AnnotationList-DcyhF2kU.d.ts +27691 -0
- package/dist/Change-Ct-dB8D5.cjs +1133 -0
- package/dist/Change-Ct-dB8D5.cjs.map +1 -0
- package/dist/Change-tMR34hTU.js +978 -0
- package/dist/Change-tMR34hTU.js.map +1 -0
- package/dist/DocumentRenderService-9IjSQEIU.cjs +121 -0
- package/dist/DocumentRenderService-9IjSQEIU.cjs.map +1 -0
- package/dist/DocumentRenderService-DFrZ9wfW.js +86 -0
- package/dist/DocumentRenderService-DFrZ9wfW.js.map +1 -0
- package/dist/{DocumentSecurityService-Ca6EK3-3.d.ts → DocumentSecurityService-D2zA4NKi.d.cts} +100 -112
- package/dist/{DocumentSecurityService-CIx1MT0T.d.cts → DocumentSecurityService-YJV9df8P.d.ts} +100 -112
- package/dist/LocalDocumentHandle-D02FMm-Z.cjs +53 -0
- package/dist/LocalDocumentHandle-D02FMm-Z.cjs.map +1 -0
- package/dist/LocalDocumentHandle-DAPdaOt_.js +30 -0
- package/dist/LocalDocumentHandle-DAPdaOt_.js.map +1 -0
- package/dist/LocalEngine-DBt2-GWF.d.ts +1649 -0
- package/dist/LocalEngine-IA9zh3Jh.d.cts +1649 -0
- package/dist/PageInsertBlankInput-CXHAM7l6.cjs +17 -0
- package/dist/PageInsertBlankInput-CXHAM7l6.cjs.map +1 -0
- package/dist/PageInsertBlankInput-DhVYVJ_S.js +12 -0
- package/dist/PageInsertBlankInput-DhVYVJ_S.js.map +1 -0
- package/dist/authority-BFp6XM04.cjs +2997 -0
- package/dist/authority-BFp6XM04.cjs.map +1 -0
- package/dist/authority-PuxpGFhJ.js +2506 -0
- package/dist/authority-PuxpGFhJ.js.map +1 -0
- package/dist/builders-DV62HA3I.js +165 -0
- package/dist/builders-DV62HA3I.js.map +1 -0
- package/dist/builders-DgTAj_tP.cjs +188 -0
- package/dist/builders-DgTAj_tP.cjs.map +1 -0
- package/dist/calibrate-DJbi1wuK.cjs +3012 -0
- package/dist/calibrate-DJbi1wuK.cjs.map +1 -0
- package/dist/calibrate-nQFgCuki.js +2461 -0
- package/dist/calibrate-nQFgCuki.js.map +1 -0
- package/dist/charmap-Cprti1ta.js +239 -0
- package/dist/charmap-Cprti1ta.js.map +1 -0
- package/dist/charmap-aYlefQP9.cjs +304 -0
- package/dist/charmap-aYlefQP9.cjs.map +1 -0
- package/dist/conformance.cjs +18146 -5258
- package/dist/conformance.cjs.map +1 -1
- package/dist/conformance.d.cts +1024 -170
- package/dist/conformance.d.ts +1024 -170
- package/dist/conformance.js +18148 -5309
- package/dist/conformance.js.map +1 -1
- package/dist/format-Bp3QFSH1.cjs +574 -0
- package/dist/format-Bp3QFSH1.cjs.map +1 -0
- package/dist/format-Dgg428Kb.js +461 -0
- package/dist/format-Dgg428Kb.js.map +1 -0
- package/dist/index.cjs +342 -116
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +14 -5
- package/dist/pageRefs-B3ur7Ckm.cjs +51 -0
- package/dist/pageRefs-B3ur7Ckm.cjs.map +1 -0
- package/dist/pageRefs-DkbuxSCV.js +40 -0
- package/dist/pageRefs-DkbuxSCV.js.map +1 -0
- package/dist/public.cjs +59 -0
- package/dist/public.d.cts +5 -0
- package/dist/public.d.ts +5 -0
- package/dist/public.js +9 -0
- package/dist/resolveAnnotationDraft-7Ke4nV7F.cjs +3646 -0
- package/dist/resolveAnnotationDraft-7Ke4nV7F.cjs.map +1 -0
- package/dist/resolveAnnotationDraft-CUpf0SMh.js +3167 -0
- package/dist/resolveAnnotationDraft-CUpf0SMh.js.map +1 -0
- package/dist/{resolver-inAVzsWt.js → resolver-BBggAxQc.js} +298 -145
- package/dist/resolver-BBggAxQc.js.map +1 -0
- package/dist/{resolver-CYVNV4hn.cjs → resolver-BWSWSF6R.cjs} +351 -144
- package/dist/resolver-BWSWSF6R.cjs.map +1 -0
- package/dist/runtime-BaDKjxiu.d.ts +1959 -0
- package/dist/runtime-CWEuiwbk.d.cts +1959 -0
- package/dist/runtime.cjs +986 -297
- package/dist/runtime.cjs.map +1 -1
- package/dist/runtime.d.cts +5 -1372
- package/dist/runtime.d.ts +5 -1372
- package/dist/runtime.js +634 -179
- package/dist/runtime.js.map +1 -1
- package/dist/schema-6S2VmlAj.js +2087 -0
- package/dist/schema-6S2VmlAj.js.map +1 -0
- package/dist/schema-miH6tWQC.cjs +3046 -0
- package/dist/schema-miH6tWQC.cjs.map +1 -0
- package/dist/schemas-BE2QGOit.js +1851 -0
- package/dist/schemas-BE2QGOit.js.map +1 -0
- package/dist/schemas-DljJR9ut.cjs +2798 -0
- package/dist/schemas-DljJR9ut.cjs.map +1 -0
- package/dist/subtype-CG4WpIRj.js +129 -0
- package/dist/subtype-CG4WpIRj.js.map +1 -0
- package/dist/subtype-aDt5TFmK.cjs +158 -0
- package/dist/subtype-aDt5TFmK.cjs.map +1 -0
- package/dist/validation.cjs +578 -0
- package/dist/validation.cjs.map +1 -0
- package/dist/validation.d.cts +174 -0
- package/dist/validation.d.ts +174 -0
- package/dist/validation.js +571 -0
- package/dist/validation.js.map +1 -0
- package/dist/value-BFS1R8ek.cjs +435 -0
- package/dist/value-BFS1R8ek.cjs.map +1 -0
- package/dist/value-Dhc8eYcx.js +340 -0
- package/dist/value-Dhc8eYcx.js.map +1 -0
- package/dist/viewport-CHG9qQUb.cjs +671 -0
- package/dist/viewport-CHG9qQUb.cjs.map +1 -0
- package/dist/viewport-DQR5LyX3.js +540 -0
- package/dist/viewport-DQR5LyX3.js.map +1 -0
- package/dist/wire.cjs +1242 -420
- package/dist/wire.cjs.map +1 -1
- package/dist/wire.d.cts +14840 -830
- package/dist/wire.d.ts +14840 -830
- package/dist/wire.js +985 -261
- package/dist/wire.js.map +1 -1
- package/package.json +10 -1
- package/dist/AbortError-DwuHPK_I.js +0 -27
- package/dist/AbortError-DwuHPK_I.js.map +0 -1
- package/dist/AbortError-P0RU0Mgg.cjs +0 -38
- package/dist/AbortError-P0RU0Mgg.cjs.map +0 -1
- package/dist/AnnotationListSnapshot-D9R5n2Kf.d.cts +0 -7101
- package/dist/AnnotationListSnapshot-D9R5n2Kf.d.ts +0 -7101
- package/dist/Engine-EWWHhEIi.d.ts +0 -1277
- package/dist/Engine-FNaAEjfb.d.cts +0 -1277
- package/dist/derive-BbsDk_Kz.cjs +0 -880
- package/dist/derive-BbsDk_Kz.cjs.map +0 -1
- package/dist/derive-DAFJolWu.js +0 -647
- package/dist/derive-DAFJolWu.js.map +0 -1
- package/dist/format-Bbphf4zR.js +0 -435
- package/dist/format-Bbphf4zR.js.map +0 -1
- package/dist/format-D_epWlob.cjs +0 -518
- package/dist/format-D_epWlob.cjs.map +0 -1
- package/dist/resolver-CYVNV4hn.cjs.map +0 -1
- package/dist/resolver-inAVzsWt.js.map +0 -1
- package/dist/schemas-CFQGvWiu.js +0 -3243
- package/dist/schemas-CFQGvWiu.js.map +0 -1
- package/dist/schemas-D0g6tKa9.cjs +0 -4694
- package/dist/schemas-D0g6tKa9.cjs.map +0 -1
- package/dist/viewport-BWeNHZmb.cjs +0 -3503
- package/dist/viewport-BWeNHZmb.cjs.map +0 -1
- package/dist/viewport-CvMcadfQ.js +0 -3072
- package/dist/viewport-CvMcadfQ.js.map +0 -1
package/dist/wire.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { f as toPageRef, i as encodeFieldRefKey, r as decodeFieldRefKey, u as encodePageKey } from "./format-Dgg428Kb.js";
|
|
2
|
+
import { D as decodeAnnotKey, O as encodeAnnotKey, r as checkCapability, t as checkAnyCapability } from "./resolver-BBggAxQc.js";
|
|
3
|
+
import { c as toBase64, s as fromBase64, u as appearanceModesOf } from "./charmap-Cprti1ta.js";
|
|
4
|
+
import { $ as PolylineDTOSchema, $t as PolygonIntentSchema, A as UnderlineDTOSchema, An as InkIntentSchema, At as AppearanceResourceKeysSchema, B as StampDTOSchema, Bn as WidgetCheckStyleSchema, Bt as CaretPatchSchema, Cn as AnnotationRefSchema, Ct as FileAttachmentIconSchema, D as UnsupportedDTOSchema, Dn as DrawnBorderStyleSchema, Dt as AttachmentSchema, E as FormFieldRefSchema, En as ColorSchema, Et as AttachmentRefSchema, F as TextPatchSchema, Fn as StandardFontSchema, Ft as CircleDTOSchema, G as SquigglyDraftSchema, Gn as PagePointSchema, Gt as PageMeasurementViewportListSchema, H as StampPatchSchema, Hn as InkListSchema, Ht as LineDimensionCaptionSchema, I as NoteIconSchema, In as StrikeoutIntentSchema, It as CircleDraftSchema, J as SquareDraftSchema, Jn as PdfQuadSchema, Jt as PdfForeignMeasureSchema, K as SquigglyPatchSchema, Kn as PageQuadSchema, Kt as PageMeasurementViewportSchema, L as StrikeoutDTOSchema, Ln as TextAlignmentSchema, Lt as CirclePatchSchema, M as UnderlinePatchSchema, Mn as LineEndingsSchema, Mt as ImageResourceKeysSchema, N as TextDTOSchema, Nn as PointSchema, Nt as ResourceKeySchema, O as UnsupportedDraftSchema, On as FreeTextIntentSchema, Ot as WireAttachmentFileSchema, P as TextDraftSchema, Pn as RectSchema, Pt as SourceResourceKeysSchema, Q as PopupPatchSchema, Qn as PageRefSchema, Qt as PdfNumberFormatSchema, R as StrikeoutDraftSchema, Rn as VerticalAlignmentSchema, Rt as CaretDTOSchema, S as WidgetAppearanceSchema, Sn as AnnotationBorderStyleSchema, St as FileAttachmentPatchSchema, T as WidgetPatchSchema, Tn as CaretIntentSchema, Tt as AttachmentFileInfoSchema, U as StampFitSchema, Un as LinePointsSchema, Ut as LineIntentSchema, V as StampDraftSchema, Vn as CalloutLineSchema, Vt as LineCaptionPatchSchema, W as SquigglyDTOSchema, Wn as PageBoxSchema, Wt as LineLeaderSchema, X as PopupDTOSchema, Xn as PdfRotationSchema, Xt as PdfMeasureWriteSchema, Y as SquarePatchSchema, Yn as PdfRectSchema, Yt as PdfMeasureSchema, Z as PopupDraftSchema, Zn as PdfSizeSchema, Zt as PdfMeasurementSchema, _ as AnnotationSchema, _n as PdfPageActionsSchema, _t as FreeTextDTOSchema, a as FormFieldPatchSchema, an as DocumentActionsSnapshotSchema, at as LinkDTOSchema, b as annotationPatchSchemaOf, bn as PdfLinkTargetWritableSchema, bt as FileAttachmentDTOSchema, c as FormKindSchema, cn as FileWidgetActionsPatchSchema, ct as LineDTOSchema, d as FormWidgetSchema, dn as PdfActionTreeSchema, dt as InkDTOSchema, en as PolylineIntentSchema, et as PolylineDraftSchema, f as ToggleFieldWidgetSchema, fn as PdfActionTypeSchema, ft as InkDraftSchema, g as AnnotationPatchSchema, gn as PdfFieldActionsSchema, gt as HighlightPatchSchema, h as AnnotationDraftSchema, hn as PdfAnnotationActionsSchema, ht as HighlightDraftSchema, i as FormFieldOptionSchema, in as IsoDateTimeSchema, it as PolygonPatchSchema, j as UnderlineDraftSchema, jn as LineEndingSchema, jt as FileResourceKeysSchema, k as UnsupportedPatchSchema, kn as FreeTextIntentWriteSchema, kt as AnnotationResourceKeysSchema, l as FormSnapshotSchema, ln as PdfActionNodeSchema, lt as LineDraftSchema, m as ANNOTATION_KINDS, mn as PdfActionWriteSchema, mt as HighlightDTOSchema, n as FormFieldDraftSchema, nn as ShapeDimensionCaptionSchema, nt as PolygonDTOSchema, o as FormFieldValueSchema, on as FieldActionsPatchSchema, ot as LinkDraftSchema, p as WidgetPlacementSchema, pn as PdfActionWireComponents, pt as InkPatchSchema, q as SquareDTOSchema, qn as PdfPointSchema, qt as PageScaleInputSchema, r as FormFieldOptionInputSchema, rn as DateInputSchema, rt as PolygonDraftSchema, sn as FieldScriptWriteSchema, st as LinkPatchSchema, t as FormFieldDTOSchema, tn as ShapeCaptionPatchSchema, tt as PolylinePatchSchema, u as FormValueEntrySchema, un as PdfActionTargetRefSchema, ut as LinePatchSchema, vn as WidgetActionsPatchSchema, vt as FreeTextDraftSchema, w as WidgetDTOSchema, wn as BlendModeSchema, wt as AttachmentFileBaseSchema, xn as PdfDestinationSchema, xt as FileAttachmentDraftSchema, y as KIND_BY_SUBTYPE, yn as PdfLinkTargetSchema, yt as FreeTextPatchSchema, z as StrikeoutPatchSchema, zn as WidgetBorderStyleSchema, zt as CaretDraftSchema } from "./schema-6S2VmlAj.js";
|
|
5
|
+
import { $ as FormCalculationsReorderBodySchema, $t as PageInsertBlankSpecSchema, A as BundleLimitsSchema, An as SignaturePreparedWireSchema, At as MetadataUpdateResultSchema, B as DocumentManifestSchema, Bn as OutlineItemDraftSchema, Bt as OutlineMoveResultSchema, C as AttachmentCreateResultSchema, Cn as SearchSnippetSchema, Ct as FormWidgetsReorderResultSchema, D as AttachmentRestoreResultSchema, Dn as SignatureCompleteResultSchema, Dt as LayerScopesSchema, E as AttachmentMutationMetaSchema, En as SignatureCompleteBodySchema, Et as LayerAnalysisQuerySchema, F as CustomMetadataPatchSchema, Fn as analyzeInputFromQuery, Ft as ObjectNumberReservationRequestSchema, G as DocumentVersionSchema, Gn as PAGE_PRINT_FAMILIES, Gt as OutlineUpdateResultSchema, H as DocumentProtectionSchema, Hn as OutlineItemSchema, Ht as OutlineOrderSchema, I as CustomMetadataSchema, In as decodePrepared, It as ObjectNumberReservationResponseSchema, J as EditSessionAccessSchema, Jn as pagePictureOf, Jt as PageDeleteResultSchema, K as DocumentVersionsSchema, Kn as PAGE_PRINT_TIERS, Kt as OutlineWireComponents, L as CustomMetadataUpdateResultSchema, Ln as encodePrepared, Lt as OpenDocumentResponseSchema, M as CacheDeltaSchema, Mn as SignatureSnapshotSchema, Mt as MutationMetaSchema, N as CachePinsSchema, Nn as VersionAnalysisQuerySchema, Nt as NamedPageEntrySchema, O as AttachmentWireComponents, On as SignatureDTOSchema, Ot as ManifestPageSchema, P as ChangeAnalysisSchema, Pn as WidgetAppearancesQuerySchema, Pt as ObjectNumberRangeSchema, Q as FieldPositionSchema, Qt as PageGeometrySnapshotSchema, R as DigestAlgorithmSchema, Rn as pagePictureQuerySchema, Rt as OutlineCreateResultSchema, S as AppearanceOutcomeSchema, Sn as SearchSliceSchema, St as FormWidgetsReorderBodySchema, T as AttachmentListSchema, Tn as SignatureCancelResultSchema, Tt as IdentitySchema, U as DocumentSecurityStateSchema, Un as OutlineItemRefSchema, Ut as OutlinePositionSchema, V as DocumentMetadataSchema, Vn as OutlineItemPatchSchema, Vt as OutlineMutationMetaSchema, W as DocumentVersionRefSchema, Wn as PAGE_PICTURES, Wt as OutlineRestoreResultSchema, X as EngineErrorPayloadSchema, Xn as pageRenderFamilyOf, Xt as PageFlattenInputSchema, Y as EditSessionStatusSchema, Yn as pagePrintTierOf, Yt as PageExtractInputSchema, Z as FieldLockSpecSchema, Zt as PageFlattenResultSchema, _ as AnnotationReorderBodySchema, _n as RedactionApplyResultSchema, _t as FormWidgetDeleteResultSchema, a as AnnotationAppearancesQuerySchema, an as PageNetworkRenderFormatSchema, at as FormFieldUpdateResultSchema, b as AnnotationWireComponents, bn as SearchQuerySchema, bt as FormWidgetUpdateBodySchema, c as AnnotationExportSelectionSchema, cn as PageRemoveNameInputSchema, ct as FormImportResultSchema, d as AnnotationImportBodySchema, dn as PageRestoreResultSchema, dt as FormResetBodySchema, en as PageInsertResultSchema, et as FormCalculationsReorderResultSchema, f as AnnotationImportOptionsSchema, fn as PageRotateResultSchema, ft as FormResetResultSchema, g as AnnotationPositionSchema, gn as PdfSaveModeSchema, gt as FormValuesImportResultSchema, h as AnnotationListSchema, hn as PdfRevisionSchema, ht as FormValuesImportOptionsSchema, i as AnnotationAppearanceExportInputSchema, in as PageNameResultSchema, it as FormFieldDeleteResultSchema, j as ByteRangeSchema, jn as SignatureSeedValueSchema, jt as ModificationLevelSchema, k as BaseVersionInfoSchema, kn as SignaturePrepareBodySchema, kt as MetadataPatchSchema, l as AnnotationFlattenInputSchema, ln as PageRenderQuerySchemas, lt as FormMutationMetaSchema, m as AnnotationListMutationMetaSchema, mn as PageTextSnapshotSchema, mt as FormValuesImportBodySchema, n as AccessResponseSchema, nn as PageListSnapshotSchema, nt as FormExportSelectionSchema, o as AnnotationCreateResultSchema, on as PagePositionSchema, ot as FormImportBodySchema, p as AnnotationImportResultSchema, pn as PageScaleResultSchema, pt as FormSetValueResultSchema, q as DocumentWireComponents, qn as PAGE_RENDER_FAMILIES, qt as PageBoxesSchema, r as AnnotationAppearanceBatchSchema, rn as PageNameInputSchema, rt as FormFieldCreateResultSchema, s as AnnotationDeleteResultSchema, sn as PagePrintQuerySchemas, st as FormImportOptionsSchema, t as AccessRequestSchema, tn as PageLayoutSchema, tt as FormExportRequestSchema, u as AnnotationFlattenResultSchema, un as PageReorderResultSchema, ut as FormRepairResultSchema, v as AnnotationReorderResultSchema, vn as RedactionApplyScopeSchema, vt as FormWidgetLinkResultSchema, w as AttachmentDeleteResultSchema, wn as SignatureAppearanceBodySchema, wt as FormWireComponents, x as AnnotationsExportRequestSchema, xn as SearchRequestSchema, xt as FormWidgetUpdateResultSchema, y as AnnotationUpdateResultSchema, yn as SearchMatchSchema, yt as FormWidgetRestoreResultSchema, z as DocumentHeadSchema, zn as DocumentOutlineSchema, zt as OutlineDeleteResultSchema } from "./schemas-BE2QGOit.js";
|
|
3
6
|
import { z } from "zod";
|
|
4
7
|
//#region src/forms/submission.ts
|
|
5
8
|
const FormSubmissionEntrySchema = z.object({
|
|
@@ -29,11 +32,11 @@ const FormSubmissionRequestSchema = z.object({
|
|
|
29
32
|
"hover",
|
|
30
33
|
"lifecycle"
|
|
31
34
|
]),
|
|
32
|
-
|
|
35
|
+
sentAt: IsoDateTimeSchema
|
|
33
36
|
});
|
|
34
37
|
const FormSubmissionReceiptSchema = z.object({
|
|
35
38
|
submissionId: z.string().min(1),
|
|
36
|
-
receivedAt:
|
|
39
|
+
receivedAt: IsoDateTimeSchema
|
|
37
40
|
});
|
|
38
41
|
//#endregion
|
|
39
42
|
//#region src/wire/token.ts
|
|
@@ -114,9 +117,38 @@ const AnnotationTokenSchema = { fields: ["annotationVersion"] };
|
|
|
114
117
|
/** Doc-level bulk annotations listing pin (plural, vs the per-page
|
|
115
118
|
* `annotationVersion` token above). */
|
|
116
119
|
const AnnotationsAllTokenSchema = { fields: ["annotationsVersion"] };
|
|
120
|
+
/** The form (`form@`): its fields, widget rows and calculation order. */
|
|
121
|
+
const FormTokenSchema = { fields: ["formsVersion"] };
|
|
122
|
+
/**
|
|
123
|
+
* `doc.annotations.export` leaf: the annotation and layout pins (the bundle
|
|
124
|
+
* carries each page's position and box, which only the layout pin covers)
|
|
125
|
+
* and the selection, canonical so one selection is one URL.
|
|
126
|
+
*/
|
|
127
|
+
const AnnotationsExportTokenSchema = {
|
|
128
|
+
fields: [
|
|
129
|
+
"annotationsVersion",
|
|
130
|
+
"include",
|
|
131
|
+
"layoutVersion",
|
|
132
|
+
"selection"
|
|
133
|
+
],
|
|
134
|
+
maxLength: 4096
|
|
135
|
+
};
|
|
136
|
+
const FormExportTokenSchema = {
|
|
137
|
+
fields: [
|
|
138
|
+
"formsVersion",
|
|
139
|
+
"layoutVersion",
|
|
140
|
+
"selection"
|
|
141
|
+
],
|
|
142
|
+
maxLength: 4096
|
|
143
|
+
};
|
|
117
144
|
const ActionsTokenSchema = { fields: ["actionsVersion"] };
|
|
118
145
|
const AttachmentsTokenSchema = { fields: ["attachmentsVersion"] };
|
|
119
146
|
/**
|
|
147
|
+
* The outline leaf: its own pin and the layout pin. The outline is read in
|
|
148
|
+
* page space, so a page delete or a box change moves what it reads.
|
|
149
|
+
*/
|
|
150
|
+
const OutlineTokenSchema = { fields: ["layoutVersion", "outlineVersion"] };
|
|
151
|
+
/**
|
|
120
152
|
* Layer signature analysis: the working copy judged against the base,
|
|
121
153
|
* pinned by `docVersion`; `since.signature` XOR `since.revision`; `level`
|
|
122
154
|
* only in exploratory mode.
|
|
@@ -140,12 +172,13 @@ const DownloadTokenSchema = {
|
|
|
140
172
|
* dotted path here and a matching branch in `PageImageOptionsWireSchema`.
|
|
141
173
|
* No encoder/decoder code changes.
|
|
142
174
|
*
|
|
143
|
-
* `includeAnnotations` is
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
175
|
+
* What a picture draws (`includeAnnotations`, `includeFormFields`) is not a
|
|
176
|
+
* token field: it's the picture's family, which is its path
|
|
177
|
+
* (`PAGE_RENDER_FAMILIES`). Each family needs its own rights and depends on
|
|
178
|
+
* its own planes, and a CDN grant is a path prefix. The pins are: every
|
|
179
|
+
* family's `contentVersion`, and `annotationVersion` and `widgetVersion` in
|
|
180
|
+
* the families that draw annotations and form fields; each family's query
|
|
181
|
+
* schema refuses the others.
|
|
149
182
|
*/
|
|
150
183
|
const RenderTokenSchema = {
|
|
151
184
|
fields: [
|
|
@@ -156,13 +189,14 @@ const RenderTokenSchema = {
|
|
|
156
189
|
"quality",
|
|
157
190
|
"rotation",
|
|
158
191
|
"target.kind",
|
|
159
|
-
"target.rect.
|
|
160
|
-
"target.rect.
|
|
161
|
-
"target.rect.
|
|
162
|
-
"target.rect.
|
|
192
|
+
"target.rect.height",
|
|
193
|
+
"target.rect.width",
|
|
194
|
+
"target.rect.x",
|
|
195
|
+
"target.rect.y",
|
|
163
196
|
"viewport.kind",
|
|
164
197
|
"viewport.scale",
|
|
165
|
-
"viewport.width"
|
|
198
|
+
"viewport.width",
|
|
199
|
+
"widgetVersion"
|
|
166
200
|
],
|
|
167
201
|
maxLength: 512
|
|
168
202
|
};
|
|
@@ -173,22 +207,22 @@ const RenderTokenSchema = {
|
|
|
173
207
|
* charset excludes free text), and the resume position. Canonical by
|
|
174
208
|
* construction: the codec sorts fields and the encoder omits every
|
|
175
209
|
* default, so equal searches produce byte-equal tokens — the property CDN
|
|
176
|
-
* cache hits live on. Mode is
|
|
210
|
+
* cache hits live on. Mode is not a field; it is the endpoint (separate
|
|
177
211
|
* permission tiers must never share cache entries).
|
|
178
212
|
*/
|
|
179
213
|
const SearchTokenSchema = {
|
|
180
214
|
fields: [
|
|
181
215
|
"epoch",
|
|
182
216
|
"format",
|
|
217
|
+
"from",
|
|
183
218
|
"ignoreWhitespace",
|
|
219
|
+
"limitMatches",
|
|
220
|
+
"limitPages",
|
|
184
221
|
"matchCase",
|
|
185
222
|
"matchDiacritics",
|
|
186
|
-
"maxMatches",
|
|
187
|
-
"maxPages",
|
|
188
223
|
"q",
|
|
189
224
|
"regex",
|
|
190
225
|
"skip",
|
|
191
|
-
"startPage",
|
|
192
226
|
"wholeWord"
|
|
193
227
|
],
|
|
194
228
|
maxLength: 2048
|
|
@@ -196,18 +230,40 @@ const SearchTokenSchema = {
|
|
|
196
230
|
/**
|
|
197
231
|
* Token for the batch annotation-appearance render endpoint. Narrower than
|
|
198
232
|
* the page render token: appearance bitmaps are sized per annotation `/Rect`
|
|
199
|
-
* so there is no target
|
|
200
|
-
* `
|
|
201
|
-
*
|
|
202
|
-
*
|
|
233
|
+
* so there is no target — only the page's `viewport` and `rotation`. Keyed by
|
|
234
|
+
* `annotationVersion` only (appearances do not depend on page base content).
|
|
235
|
+
* `modes` is present only when a request asks for fewer than every mode, as
|
|
236
|
+
* one value (`normal-down`, in the engine's mode order), so one request for
|
|
237
|
+
* every mode is one URL.
|
|
203
238
|
*/
|
|
204
239
|
const AnnotationAppearancesRenderTokenSchema = {
|
|
205
240
|
fields: [
|
|
206
241
|
"annotationVersion",
|
|
207
242
|
"format",
|
|
243
|
+
"modes",
|
|
208
244
|
"quality",
|
|
209
245
|
"rotation",
|
|
210
|
-
"
|
|
246
|
+
"viewport.kind",
|
|
247
|
+
"viewport.scale",
|
|
248
|
+
"viewport.width"
|
|
249
|
+
],
|
|
250
|
+
maxLength: 256
|
|
251
|
+
};
|
|
252
|
+
/**
|
|
253
|
+
* Token for a page's widget images (`form/pages/{p}/appearances@`): the
|
|
254
|
+
* annotation appearance token's options, keyed by the page's
|
|
255
|
+
* `widgetVersion`.
|
|
256
|
+
*/
|
|
257
|
+
const WidgetAppearancesRenderTokenSchema = {
|
|
258
|
+
fields: [
|
|
259
|
+
"format",
|
|
260
|
+
"modes",
|
|
261
|
+
"quality",
|
|
262
|
+
"rotation",
|
|
263
|
+
"viewport.kind",
|
|
264
|
+
"viewport.scale",
|
|
265
|
+
"viewport.width",
|
|
266
|
+
"widgetVersion"
|
|
211
267
|
],
|
|
212
268
|
maxLength: 256
|
|
213
269
|
};
|
|
@@ -265,8 +321,108 @@ const encodeAnnotationToken = (annotationVersion) => encodeToken(AnnotationToken
|
|
|
265
321
|
const decodeAnnotationToken = (raw) => decodePositiveInteger(decodeToken(AnnotationTokenSchema, raw).annotationVersion, "annotationVersion");
|
|
266
322
|
const encodeAnnotationsAllToken = (annotationsVersion) => encodeToken(AnnotationsAllTokenSchema, { annotationsVersion });
|
|
267
323
|
const decodeAnnotationsAllToken = (raw) => decodePositiveInteger(decodeToken(AnnotationsAllTokenSchema, raw).annotationsVersion, "annotationsVersion");
|
|
324
|
+
const encodeFormToken = (formsVersion) => encodeToken(FormTokenSchema, { formsVersion });
|
|
325
|
+
const decodeFormToken = (raw) => decodePositiveInteger(decodeToken(FormTokenSchema, raw).formsVersion, "formsVersion");
|
|
326
|
+
const encodeAnnotationsExportToken = (token) => {
|
|
327
|
+
const { selection } = token;
|
|
328
|
+
const wire = {};
|
|
329
|
+
if (selection.pages) wire.p = [...new Set(selection.pages.map((page) => page.objectNumber))].sort((left, right) => left - right);
|
|
330
|
+
if (selection.refs) {
|
|
331
|
+
const refs = /* @__PURE__ */ new Map();
|
|
332
|
+
for (const ref of selection.refs) {
|
|
333
|
+
const entry = [ref.page.objectNumber, encodeAnnotKey(ref)];
|
|
334
|
+
refs.set(JSON.stringify(entry), entry);
|
|
335
|
+
}
|
|
336
|
+
wire.r = [...refs.keys()].sort().map((key) => refs.get(key));
|
|
337
|
+
}
|
|
338
|
+
return encodeToken(AnnotationsExportTokenSchema, {
|
|
339
|
+
annotationsVersion: token.annotationsVersion,
|
|
340
|
+
layoutVersion: token.layoutVersion,
|
|
341
|
+
include: selection.include === "references" ? "references" : void 0,
|
|
342
|
+
selection: wire.p || wire.r ? encodeTokenText(JSON.stringify(wire)) : void 0
|
|
343
|
+
});
|
|
344
|
+
};
|
|
345
|
+
const decodeAnnotationsExportToken = (raw) => {
|
|
346
|
+
const query = decodeToken(AnnotationsExportTokenSchema, raw);
|
|
347
|
+
const selection = {};
|
|
348
|
+
if (query.include !== void 0) {
|
|
349
|
+
if (query.include !== "references") throw new Error(`unknown include "${query.include}"`);
|
|
350
|
+
selection.include = "references";
|
|
351
|
+
}
|
|
352
|
+
if (query.selection !== void 0) {
|
|
353
|
+
const wire = JSON.parse(decodeTokenText(query.selection));
|
|
354
|
+
const isNumber = (value) => Number.isInteger(value) && value > 0;
|
|
355
|
+
if (typeof wire !== "object" || wire === null) throw new Error("malformed export selection");
|
|
356
|
+
if (wire.p !== void 0) {
|
|
357
|
+
if (!Array.isArray(wire.p) || !wire.p.every(isNumber)) throw new Error("malformed export pages");
|
|
358
|
+
selection.pages = wire.p.map((pageObjectNumber) => toPageRef(pageObjectNumber));
|
|
359
|
+
}
|
|
360
|
+
if (wire.r !== void 0) {
|
|
361
|
+
if (!Array.isArray(wire.r)) throw new Error("malformed export refs");
|
|
362
|
+
selection.refs = wire.r.map((entry) => {
|
|
363
|
+
if (!Array.isArray(entry) || entry.length !== 2 || !isNumber(entry[0])) throw new Error("malformed export ref");
|
|
364
|
+
const ref = typeof entry[1] === "string" ? decodeAnnotKey(toPageRef(entry[0]), entry[1]) : null;
|
|
365
|
+
if (!ref) throw new Error("malformed export ref");
|
|
366
|
+
return ref;
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
return {
|
|
371
|
+
annotationsVersion: decodePositiveInteger(query.annotationsVersion, "annotationsVersion"),
|
|
372
|
+
layoutVersion: decodePositiveInteger(query.layoutVersion, "layoutVersion"),
|
|
373
|
+
selection
|
|
374
|
+
};
|
|
375
|
+
};
|
|
376
|
+
const encodeFormExportToken = (token) => {
|
|
377
|
+
const { selection } = token;
|
|
378
|
+
const wire = {};
|
|
379
|
+
if (selection.pages) wire.p = [...new Set(selection.pages.map((page) => page.objectNumber))].sort((left, right) => left - right);
|
|
380
|
+
if (selection.fields) wire.f = [...new Set(selection.fields.map(encodeFieldRefKey))].sort();
|
|
381
|
+
return encodeToken(FormExportTokenSchema, {
|
|
382
|
+
formsVersion: token.formsVersion,
|
|
383
|
+
layoutVersion: token.layoutVersion,
|
|
384
|
+
selection: wire.p || wire.f ? encodeTokenText(JSON.stringify(wire)) : void 0
|
|
385
|
+
});
|
|
386
|
+
};
|
|
387
|
+
const decodeFormExportToken = (raw) => {
|
|
388
|
+
const query = decodeToken(FormExportTokenSchema, raw);
|
|
389
|
+
const selection = {};
|
|
390
|
+
if (query.selection !== void 0) {
|
|
391
|
+
const wire = JSON.parse(decodeTokenText(query.selection));
|
|
392
|
+
if (typeof wire !== "object" || wire === null) throw new Error("malformed export selection");
|
|
393
|
+
if (wire.p !== void 0) {
|
|
394
|
+
const isNumber = (value) => Number.isInteger(value) && value > 0;
|
|
395
|
+
if (!Array.isArray(wire.p) || !wire.p.every(isNumber)) throw new Error("malformed export pages");
|
|
396
|
+
selection.pages = wire.p.map((pageObjectNumber) => toPageRef(pageObjectNumber));
|
|
397
|
+
}
|
|
398
|
+
if (wire.f !== void 0) {
|
|
399
|
+
if (!Array.isArray(wire.f)) throw new Error("malformed export fields");
|
|
400
|
+
selection.fields = wire.f.map((key) => {
|
|
401
|
+
const ref = typeof key === "string" ? decodeFieldRefKey(key) : null;
|
|
402
|
+
if (!ref) throw new Error("malformed export field");
|
|
403
|
+
return ref;
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
return {
|
|
408
|
+
formsVersion: decodePositiveInteger(query.formsVersion, "formsVersion"),
|
|
409
|
+
layoutVersion: decodePositiveInteger(query.layoutVersion, "layoutVersion"),
|
|
410
|
+
selection
|
|
411
|
+
};
|
|
412
|
+
};
|
|
268
413
|
const encodeActionsToken = (actionsVersion) => encodeToken(ActionsTokenSchema, { actionsVersion });
|
|
269
414
|
const decodeActionsToken = (raw) => decodePositiveInteger(decodeToken(ActionsTokenSchema, raw).actionsVersion, "actionsVersion");
|
|
415
|
+
const encodeOutlineToken = (token) => encodeToken(OutlineTokenSchema, {
|
|
416
|
+
layoutVersion: token.layoutVersion,
|
|
417
|
+
outlineVersion: token.outlineVersion
|
|
418
|
+
});
|
|
419
|
+
const decodeOutlineToken = (raw) => {
|
|
420
|
+
const query = decodeToken(OutlineTokenSchema, raw);
|
|
421
|
+
return {
|
|
422
|
+
outlineVersion: decodePositiveInteger(query.outlineVersion, "outlineVersion"),
|
|
423
|
+
layoutVersion: decodePositiveInteger(query.layoutVersion, "layoutVersion")
|
|
424
|
+
};
|
|
425
|
+
};
|
|
270
426
|
const encodeAttachmentsToken = (attachmentsVersion) => encodeToken(AttachmentsTokenSchema, { attachmentsVersion });
|
|
271
427
|
const decodeAttachmentsToken = (raw) => decodePositiveInteger(decodeToken(AttachmentsTokenSchema, raw).attachmentsVersion, "attachmentsVersion");
|
|
272
428
|
const encodeDownloadToken = (input) => encodeToken(DownloadTokenSchema, {
|
|
@@ -284,7 +440,7 @@ const decodeDownloadToken = (raw) => {
|
|
|
284
440
|
* Encode a render token from a flat wire-shape input. The input is the
|
|
285
441
|
* output of `flatten(...)` over an SDK `PageImageOptions`-shaped object plus
|
|
286
442
|
* cache versions. Semantic invariants (viewport-kind XOR fields, per-family
|
|
287
|
-
* pin grammar — annotatedness itself is
|
|
443
|
+
* pin grammar — annotatedness itself is path-expressed, never a token key —
|
|
288
444
|
* target rect coherence) live in the per-family render query schemas —
|
|
289
445
|
* running them here would duplicate the spec.
|
|
290
446
|
*/
|
|
@@ -301,18 +457,24 @@ const decodeRenderToken = (raw) => decodeToken(RenderTokenSchema, raw);
|
|
|
301
457
|
* plus cache versions). Semantic validation lives in
|
|
302
458
|
* `AnnotationAppearancesQuerySchema`.
|
|
303
459
|
*/
|
|
460
|
+
/** `modes` as one token value: the modes in engine order, joined by `-`. */
|
|
461
|
+
const encodeAppearanceModes = (modes) => modes.join("-");
|
|
304
462
|
const encodeAnnotationAppearancesRenderToken = (input) => encodeToken(AnnotationAppearancesRenderTokenSchema, input);
|
|
305
463
|
/** Decode an annotation-appearance render token to a flat field map. */
|
|
306
464
|
const decodeAnnotationAppearancesRenderToken = (raw) => decodeToken(AnnotationAppearancesRenderTokenSchema, raw);
|
|
465
|
+
/** Encode a widget-appearance render token, the annotation one's twin keyed by `widgetVersion`. */
|
|
466
|
+
const encodeWidgetAppearancesRenderToken = (input) => encodeToken(WidgetAppearancesRenderTokenSchema, input);
|
|
467
|
+
/** Decode a widget-appearance render token to a flat field map. */
|
|
468
|
+
const decodeWidgetAppearancesRenderToken = (raw) => decodeToken(WidgetAppearancesRenderTokenSchema, raw);
|
|
307
469
|
/**
|
|
308
|
-
* The search
|
|
470
|
+
* The search result representation this client speaks — part of the token
|
|
309
471
|
* (and therefore the versioned URL), so a response-shape change can never
|
|
310
472
|
* serve a stale CDN body to a newer client: new tokens are new cache keys,
|
|
311
|
-
* and old tokens fail decode on new servers. Deliberately
|
|
473
|
+
* and old tokens fail decode on new servers. Deliberately always encoded —
|
|
312
474
|
* an exception to the omit-defaults rule, because its entire job is to
|
|
313
475
|
* change the token bytes when the format changes.
|
|
314
476
|
*/
|
|
315
|
-
const SEARCH_RESULT_FORMAT = "
|
|
477
|
+
const SEARCH_RESULT_FORMAT = "ranges1";
|
|
316
478
|
const encodeSearchToken = (input) => {
|
|
317
479
|
const q = input.query;
|
|
318
480
|
return encodeToken(SearchTokenSchema, {
|
|
@@ -324,17 +486,17 @@ const encodeSearchToken = (input) => {
|
|
|
324
486
|
matchDiacritics: q.matchDiacritics ? true : void 0,
|
|
325
487
|
wholeWord: q.wholeWord ? true : void 0,
|
|
326
488
|
ignoreWhitespace: q.ignoreWhitespace ? true : void 0,
|
|
327
|
-
|
|
489
|
+
from: input.from,
|
|
328
490
|
skip: input.skip > 0 ? input.skip : void 0,
|
|
329
|
-
|
|
330
|
-
|
|
491
|
+
limitPages: input.limit?.pages,
|
|
492
|
+
limitMatches: input.limit?.matches
|
|
331
493
|
});
|
|
332
494
|
};
|
|
333
495
|
const decodeSearchToken = (raw) => {
|
|
334
496
|
const t = decodeToken(SearchTokenSchema, raw);
|
|
335
497
|
if (t.epoch === void 0) throw new Error("search token is missing \"epoch\"");
|
|
336
498
|
if (t.q === void 0) throw new Error("search token is missing \"q\"");
|
|
337
|
-
if (t.format !== "
|
|
499
|
+
if (t.format !== "ranges1") throw new Error(`search token has unsupported result format "${t.format ?? "legacy"}" (expected "${SEARCH_RESULT_FORMAT}")`);
|
|
338
500
|
const query = {
|
|
339
501
|
text: decodeTokenText(t.q),
|
|
340
502
|
...t.regex === "true" ? { regex: true } : {},
|
|
@@ -343,16 +505,16 @@ const decodeSearchToken = (raw) => {
|
|
|
343
505
|
...t.wholeWord === "true" ? { wholeWord: true } : {},
|
|
344
506
|
...t.ignoreWhitespace === "true" ? { ignoreWhitespace: true } : {}
|
|
345
507
|
};
|
|
346
|
-
const
|
|
347
|
-
const
|
|
508
|
+
const pages = t.limitPages === void 0 ? void 0 : decodePositiveInteger(t.limitPages, "limitPages");
|
|
509
|
+
const matches = t.limitMatches === void 0 ? void 0 : decodePositiveInteger(t.limitMatches, "limitMatches");
|
|
348
510
|
return {
|
|
349
511
|
epoch: t.epoch,
|
|
350
512
|
query,
|
|
351
|
-
...t.
|
|
513
|
+
...t.from === void 0 ? {} : { from: decodePositiveInteger(t.from, "from") },
|
|
352
514
|
skip: t.skip === void 0 ? 0 : decodePositiveInteger(t.skip, "skip"),
|
|
353
|
-
...
|
|
354
|
-
...
|
|
355
|
-
...
|
|
515
|
+
...pages !== void 0 || matches !== void 0 ? { limit: {
|
|
516
|
+
...matches !== void 0 ? { matches } : {},
|
|
517
|
+
...pages !== void 0 ? { pages } : {}
|
|
356
518
|
} } : {}
|
|
357
519
|
};
|
|
358
520
|
};
|
|
@@ -406,7 +568,7 @@ function decodePdfSaveMode(raw) {
|
|
|
406
568
|
* Single source of truth for cloud HTTP paths. Both @cloudpdf/engine and
|
|
407
569
|
* @cloudpdf/server import these so they cannot drift.
|
|
408
570
|
*
|
|
409
|
-
* **URL layout convention
|
|
571
|
+
* **URL layout convention**
|
|
410
572
|
*
|
|
411
573
|
* Each resource type lives at its own distinct path prefix. This
|
|
412
574
|
* lets prefix-matching CDNs (Bunny, Cloud CDN, Azure FD) enforce
|
|
@@ -418,28 +580,37 @@ function decodePdfSaveMode(raw) {
|
|
|
418
580
|
* /v1/docs/{id} — doc root
|
|
419
581
|
* /v1/docs/{id}/manifest@{ver} — doc-level read
|
|
420
582
|
* /v1/docs/{id}/render/pages/{N}/data@{ver} — render is its own prefix
|
|
583
|
+
* /v1/docs/{id}/render/{annotations,fields,all}/pages/{N}/data@{ver} — and each picture family
|
|
584
|
+
* /v1/docs/{id}/render/{print,print-high}/…/pages/{N}/data@{ver} — and each print tier of each
|
|
421
585
|
* /v1/docs/{id}/text/pages/{N}/data@{ver} — text is its own prefix
|
|
422
586
|
* /v1/docs/{id}/geometry/pages/{N}/data@{ver} — geometry is its own prefix
|
|
423
587
|
* /v1/docs/{id}/layers/{L}/manifest@{ver}
|
|
424
588
|
* /v1/docs/{id}/layers/{L}/metadata@{ver}
|
|
589
|
+
* /v1/docs/{id}/layers/{L}/metadata/custom@{ver} — the Info dict's own keys
|
|
425
590
|
* /v1/docs/{id}/layers/{L}/render/pages/{N}/data@{ver}
|
|
426
591
|
* /v1/docs/{id}/layers/{L}/text/pages/{N}/data@{ver}
|
|
427
592
|
* /v1/docs/{id}/layers/{L}/geometry/pages/{N}/data@{ver}
|
|
428
593
|
* /v1/docs/{id}/layers/{L}/annotations/pages/{N}/items@{ver} — collection (read)
|
|
429
594
|
* /v1/docs/{id}/layers/{L}/annotations/pages/{N}/items — collection (create)
|
|
430
595
|
* /v1/docs/{id}/layers/{L}/annotations/pages/{N}/items/{key} — member
|
|
431
|
-
* /v1/docs/{id}/layers/{L}/annotations/pages/{N}/items/
|
|
432
|
-
* /v1/docs/{id}/
|
|
433
|
-
* /v1/docs/{id}/
|
|
434
|
-
* /v1/docs/{id}/layers/{L}/
|
|
435
|
-
* /v1/docs/{id}/layers/{L}/form
|
|
596
|
+
* /v1/docs/{id}/layers/{L}/annotations/pages/{N}/items/reorder — stacking order
|
|
597
|
+
* /v1/docs/{id}/form@{ver} — the form: fields + widget rows (read)
|
|
598
|
+
* /v1/docs/{id}/form/pages/{N}/appearances@{ver} — a page's widget images (read)
|
|
599
|
+
* /v1/docs/{id}/layers/{L}/form@{ver}
|
|
600
|
+
* /v1/docs/{id}/layers/{L}/form/pages/{N}/appearances@{ver}
|
|
601
|
+
* /v1/docs/{id}/layers/{L}/form — the form, current (read)
|
|
602
|
+
* /v1/docs/{id}/layers/{L}/form/widgets/{N}/{key} — a widget's place and look (patch)
|
|
603
|
+
* /v1/docs/{id}/layers/{L}/form/widgets/{N}/reorder — the widgets' stacking order
|
|
436
604
|
* /v1/docs/{id}/layers/{L}/form/fields — field collection (create)
|
|
437
605
|
* /v1/docs/{id}/layers/{L}/form/fields/{key} — field member (read/patch/delete)
|
|
438
606
|
* /v1/docs/{id}/layers/{L}/form/fields/{key}/value — value write (fill)
|
|
439
607
|
* /v1/docs/{id}/layers/{L}/form/fields/{key}/reset — reset to /DV (fill)
|
|
440
608
|
* /v1/docs/{id}/layers/{L}/form/fields/{key}/widgets — adopt a widget (attach)
|
|
441
609
|
* /v1/docs/{id}/layers/{L}/form/fields/{key}/widgets/detach — release a widget
|
|
442
|
-
* /v1/docs/{id}/layers/{L}/form/
|
|
610
|
+
* /v1/docs/{id}/layers/{L}/form/export@{token} — form bundle export (GET)
|
|
611
|
+
* /v1/docs/{id}/layers/{L}/form/export — form bundle export by body (POST)
|
|
612
|
+
* /v1/docs/{id}/layers/{L}/form/import — design import (multipart POST)
|
|
613
|
+
* /v1/docs/{id}/layers/{L}/form/import-values — values import (multipart POST)
|
|
443
614
|
* /v1/docs/{id}/layers/{L}/form/repair — durable reconciliation
|
|
444
615
|
* /v1/docs/{id}/layers/{L}/download@{ver}
|
|
445
616
|
*
|
|
@@ -456,16 +627,21 @@ const wirePaths = {
|
|
|
456
627
|
* against the token like every layer route — the grant is
|
|
457
628
|
* layer-scoped in substance: CDN coverage, scopes, and the client's
|
|
458
629
|
* binding all carry the layer). Path-addressed so the affinity tier —
|
|
459
|
-
* the `X-CloudPDF-Doc` header derivation
|
|
630
|
+
* the `X-CloudPDF-Doc` header derivation and the chart's uri-mode
|
|
460
631
|
* regex — pins the session bootstrap to the document's pod from the
|
|
461
632
|
* very first request. Default-layer callers spell `layers/default/`,
|
|
462
633
|
* same as every other layer route.
|
|
463
634
|
*/
|
|
464
635
|
access: (docId, layerName) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/access`,
|
|
465
|
-
/** Deprecated alias (docId in the
|
|
636
|
+
/** Deprecated alias (docId in the body) — served for one prerelease
|
|
466
637
|
* cycle so pre-rename clients keep working; remove after. */
|
|
467
638
|
accessLegacy: "/v1/access",
|
|
468
639
|
/**
|
|
640
|
+
* POST `{ count }`: hand the caller's editing session `count` more object
|
|
641
|
+
* numbers at once (at most 1,000), for a large paste.
|
|
642
|
+
*/
|
|
643
|
+
objectNumbers: (docId, layerName) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/object-numbers`,
|
|
644
|
+
/**
|
|
469
645
|
* GET: open the document referenced by the doc-scoped JWT and
|
|
470
646
|
* return its `DocumentHead`. The server materialises the base
|
|
471
647
|
* PDF into its file cache and binds it to a worker the first
|
|
@@ -503,9 +679,9 @@ const wirePaths = {
|
|
|
503
679
|
*/
|
|
504
680
|
layerLayout: (docId, layerName, layoutVersion) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/layout@${encodeLayoutToken(layoutVersion)}`,
|
|
505
681
|
/**
|
|
506
|
-
* Immutable
|
|
682
|
+
* Immutable base page-geometry list (plane-scope model): the shared-URL
|
|
507
683
|
* variant a layout-inheriting layer resolves at — every visitor's page
|
|
508
|
-
* list is
|
|
684
|
+
* list is one CDN object served from the base worker session.
|
|
509
685
|
*/
|
|
510
686
|
docLayout: (docId, layoutVersion) => `/v1/docs/${encodeURIComponent(docId)}/layout@${encodeLayoutToken(layoutVersion)}`,
|
|
511
687
|
layerLayoutCurrent: (docId, layerName) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/layout`,
|
|
@@ -519,12 +695,30 @@ const wirePaths = {
|
|
|
519
695
|
*/
|
|
520
696
|
layerMetadata: (docId, layerName, metadataVersion) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/metadata@${encodeMetadataToken(metadataVersion)}`,
|
|
521
697
|
layerMetadataCurrent: (docId, layerName) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/metadata`,
|
|
522
|
-
/** Immutable
|
|
698
|
+
/** Immutable base metadata (plane-scope model): the shared-URL variant a
|
|
523
699
|
* metadata-inheriting layer resolves at. */
|
|
524
700
|
docMetadata: (docId, metadataVersion) => `/v1/docs/${encodeURIComponent(docId)}/metadata@${encodeMetadataToken(metadataVersion)}`,
|
|
701
|
+
/**
|
|
702
|
+
* GET: the Info dict's custom keys for the layer at a specific
|
|
703
|
+
* `metadataVersion` — the same version pointer as `layerMetadata`, since
|
|
704
|
+
* both halves live in one dict. Content-addressed like it.
|
|
705
|
+
*/
|
|
706
|
+
layerCustomMetadata: (docId, layerName, metadataVersion) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/metadata/custom@${encodeMetadataToken(metadataVersion)}`,
|
|
707
|
+
layerCustomMetadataCurrent: (docId, layerName) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/metadata/custom`,
|
|
708
|
+
/** Immutable base custom keys: the shared-URL twin of `layerCustomMetadata`. */
|
|
709
|
+
docCustomMetadata: (docId, metadataVersion) => `/v1/docs/${encodeURIComponent(docId)}/metadata/custom@${encodeMetadataToken(metadataVersion)}`,
|
|
710
|
+
/**
|
|
711
|
+
* GET: the layer's outline at its `outlineVersion` and `layoutVersion`
|
|
712
|
+
* (the outline is read in page space). Content-addressed: a stale pin 404s
|
|
713
|
+
* and the client refreshes its manifest.
|
|
714
|
+
*/
|
|
715
|
+
layerOutline: (docId, layerName, token) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/outline@${encodeOutlineToken(token)}`,
|
|
716
|
+
layerOutlineCurrent: (docId, layerName) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/outline`,
|
|
717
|
+
/** Immutable base outline: the shared-URL twin an outline-inheriting layer resolves at. */
|
|
718
|
+
docOutline: (docId, token) => `/v1/docs/${encodeURIComponent(docId)}/outline@${encodeOutlineToken(token)}`,
|
|
525
719
|
/** Immutable catalog-owned actions, independently pinned in the manifest. */
|
|
526
720
|
layerActions: (docId, layerName, actionsVersion) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/actions@${encodeActionsToken(actionsVersion)}`,
|
|
527
|
-
/** Immutable
|
|
721
|
+
/** Immutable base catalog actions (plane-scope model): the shared-URL
|
|
528
722
|
* variant an actions-inheriting layer resolves at. */
|
|
529
723
|
docActions: (docId, actionsVersion) => `/v1/docs/${encodeURIComponent(docId)}/actions@${encodeActionsToken(actionsVersion)}`,
|
|
530
724
|
/** Immutable layer signature snapshot (base signatures + the layer's fields + protection). */
|
|
@@ -538,7 +732,7 @@ const wirePaths = {
|
|
|
538
732
|
/** POST (JSON): install the CMS and publish the sealed bytes as the next base version. */
|
|
539
733
|
layerSignatureComplete: (docId, layerName, signingId) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/signatures/${encodeURIComponent(signingId)}/complete`,
|
|
540
734
|
/** DELETE: discard a pending signing. */
|
|
541
|
-
|
|
735
|
+
layerSignatureCancel: (docId, layerName, signingId) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/signatures/${encodeURIComponent(signingId)}`,
|
|
542
736
|
/** The document's base versions, oldest first (grows; never cached). */
|
|
543
737
|
docVersions: (docId) => `/v1/docs/${encodeURIComponent(docId)}/versions`,
|
|
544
738
|
/** Immutable: the signature snapshot of one base version. */
|
|
@@ -557,21 +751,19 @@ const wirePaths = {
|
|
|
557
751
|
layerFormFieldSignatureAppearance: (docId, layerName, fieldKey) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/form/fields/${encodeURIComponent(fieldKey)}/signature-appearance`,
|
|
558
752
|
/** POST: rewrite the document Info dict for the layer (metadata edit). */
|
|
559
753
|
layerMetadataUpdate: (docId, layerName) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/metadata`,
|
|
754
|
+
/** POST: set and remove the Info dict's custom keys for the layer. */
|
|
755
|
+
layerCustomMetadataUpdate: (docId, layerName) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/metadata/custom`,
|
|
560
756
|
/**
|
|
561
|
-
* Immutable
|
|
757
|
+
* Immutable base /EmbeddedFiles listing: the shared-URL variant an
|
|
562
758
|
* attachments-undiverged layer resolves at — every visitor's sidebar list
|
|
563
|
-
* is
|
|
759
|
+
* is one CDN object served from the base worker session.
|
|
564
760
|
*/
|
|
565
761
|
docAttachments: (docId, attachmentsVersion) => `/v1/docs/${encodeURIComponent(docId)}/attachments@${encodeAttachmentsToken(attachmentsVersion)}`,
|
|
566
|
-
/** Immutable
|
|
762
|
+
/** Immutable base decoded bytes of one embedded file (twin of
|
|
567
763
|
* `layerAttachmentFile` — same capability tier split). */
|
|
568
764
|
docAttachmentFile: (docId, key, attachmentsVersion) => `/v1/docs/${encodeURIComponent(docId)}/attachment-files/${encodeTokenText(key)}/data@${encodeAttachmentsToken(attachmentsVersion)}`,
|
|
569
765
|
/** Immutable /EmbeddedFiles listing, pinned by `attachmentsVersion`. */
|
|
570
766
|
layerAttachments: (docId, layerName, attachmentsVersion) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/attachments@${encodeAttachmentsToken(attachmentsVersion)}`,
|
|
571
|
-
/** POST: create a document-level embedded file (multipart mutation envelope). */
|
|
572
|
-
layerAttachmentsCollection: (docId, layerName) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/attachments`,
|
|
573
|
-
/** DELETE: remove a document-level embedded file by name-tree key. */
|
|
574
|
-
layerAttachmentItem: (docId, layerName, key) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/attachments/${encodeTokenText(key)}`,
|
|
575
767
|
/**
|
|
576
768
|
* Immutable decoded bytes of one document-level embedded file. Lives
|
|
577
769
|
* under its own `attachment-files` prefix — a stronger capability tier
|
|
@@ -580,14 +772,14 @@ const wirePaths = {
|
|
|
580
772
|
*/
|
|
581
773
|
layerAttachmentFile: (docId, layerName, key, attachmentsVersion) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/attachment-files/${encodeTokenText(key)}/data@${encodeAttachmentsToken(attachmentsVersion)}`,
|
|
582
774
|
/** Immutable decoded bytes of a FileAttachment annotation's embedded file. */
|
|
583
|
-
layerAnnotationFile: (docId, layerName,
|
|
775
|
+
layerAnnotationFile: (docId, layerName, page, annotKey, attachmentsVersion) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/attachment-files/pages/${encodeURIComponent(encodePageKey(page))}/items/${encodeURIComponent(annotKey)}/data@${encodeAttachmentsToken(attachmentsVersion)}`,
|
|
584
776
|
/**
|
|
585
|
-
* Immutable
|
|
777
|
+
* Immutable base bytes of a FileAttachment annotation's embedded file
|
|
586
778
|
* (plane-scope model). Depends on the `annotations` plane (the annotation
|
|
587
|
-
* exists in this view)
|
|
779
|
+
* exists in this view) and the `attachments` plane (the pin); the origin
|
|
588
780
|
* guard requires both inherited.
|
|
589
781
|
*/
|
|
590
|
-
docAnnotationFile: (docId,
|
|
782
|
+
docAnnotationFile: (docId, page, annotKey, attachmentsVersion) => `/v1/docs/${encodeURIComponent(docId)}/attachment-files/pages/${encodeURIComponent(encodePageKey(page))}/items/${encodeURIComponent(annotKey)}/data@${encodeAttachmentsToken(attachmentsVersion)}`,
|
|
591
783
|
/**
|
|
592
784
|
* GET: full plain-text extraction for a single page at a specific
|
|
593
785
|
* `contentVersion`. Content-addressed; CDN may cache forever.
|
|
@@ -595,55 +787,70 @@ const wirePaths = {
|
|
|
595
787
|
* retry walks `/head` → `/manifest@docVersion=N` to learn the new
|
|
596
788
|
* `contentVersion`.
|
|
597
789
|
*/
|
|
598
|
-
docPageText: (docId,
|
|
599
|
-
layerPageText: (docId, layerName,
|
|
600
|
-
layerPageTextCurrent: (docId, layerName,
|
|
601
|
-
docPageGeometry: (docId,
|
|
602
|
-
docPageGeometryCurrent: (docId,
|
|
603
|
-
docPageRender: (docId, pageObjectNumber, token) => `/v1/docs/${encodeURIComponent(docId)}/render/pages/${pageObjectNumber}/data@${encodeRenderToken(token)}`,
|
|
604
|
-
docPageRenderCurrent: (docId, pageObjectNumber) => `/v1/docs/${encodeURIComponent(docId)}/render/pages/${pageObjectNumber}/data`,
|
|
790
|
+
docPageText: (docId, page, contentVersion) => `/v1/docs/${encodeURIComponent(docId)}/text/pages/${encodeURIComponent(encodePageKey(page))}/data@${encodeContentToken(contentVersion)}`,
|
|
791
|
+
layerPageText: (docId, layerName, page, contentVersion) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/text/pages/${encodeURIComponent(encodePageKey(page))}/data@${encodeContentToken(contentVersion)}`,
|
|
792
|
+
layerPageTextCurrent: (docId, layerName, page) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/text/pages/${encodeURIComponent(encodePageKey(page))}/data`,
|
|
793
|
+
docPageGeometry: (docId, page, contentVersion) => `/v1/docs/${encodeURIComponent(docId)}/geometry/pages/${encodeURIComponent(encodePageKey(page))}/data@${encodeContentToken(contentVersion)}`,
|
|
794
|
+
docPageGeometryCurrent: (docId, page) => `/v1/docs/${encodeURIComponent(docId)}/geometry/pages/${encodeURIComponent(encodePageKey(page))}/data`,
|
|
605
795
|
/**
|
|
606
|
-
*
|
|
607
|
-
*
|
|
608
|
-
*
|
|
609
|
-
*
|
|
610
|
-
* identify its full plane-dependency set. Annotatedness is therefore
|
|
611
|
-
* PATH-ONLY (the token/path law): the wire token has no
|
|
612
|
-
* `includeAnnotations` key at all; the annotated family's token carries
|
|
613
|
-
* `annotationVersion`, the free family's cannot.
|
|
796
|
+
* A page picture of one family (`PAGE_RENDER_FAMILIES`). The family is a
|
|
797
|
+
* path of its own, never a token field: each depends on its own planes and
|
|
798
|
+
* needs its own rights, and an edge grant sees only prefixes. Its token
|
|
799
|
+
* carries the family's pins.
|
|
614
800
|
*/
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
layerPageGeometryCurrent: (docId, layerName, pageObjectNumber) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/geometry/pages/${pageObjectNumber}/data`,
|
|
618
|
-
layerPageRender: (docId, layerName, pageObjectNumber, token) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/render/pages/${pageObjectNumber}/data@${encodeRenderToken(token)}`,
|
|
619
|
-
layerPageRenderCurrent: (docId, layerName, pageObjectNumber) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/render/pages/${pageObjectNumber}/data`,
|
|
620
|
-
/** Layer twin of `docPageRenderAnnotated` — the grammar is uniform:
|
|
621
|
-
* annotatedness is path-only at BOTH tiers. */
|
|
622
|
-
layerPageRenderAnnotated: (docId, layerName, pageObjectNumber, token) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/render/annotated/pages/${pageObjectNumber}/data@${encodeRenderToken(token)}`,
|
|
623
|
-
layerPageRenderAnnotatedCurrent: (docId, layerName, pageObjectNumber) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/render/annotated/pages/${pageObjectNumber}/data`,
|
|
801
|
+
docPageRender: (docId, family, page, token) => `/v1/docs/${encodeURIComponent(docId)}/${PAGE_RENDER_FAMILIES[family].path}/${encodeURIComponent(encodePageKey(page))}/data@${encodeRenderToken(token)}`,
|
|
802
|
+
docPageRenderCurrent: (docId, family, page) => `/v1/docs/${encodeURIComponent(docId)}/${PAGE_RENDER_FAMILIES[family].path}/${encodeURIComponent(encodePageKey(page))}/data`,
|
|
624
803
|
/**
|
|
625
|
-
*
|
|
804
|
+
* A print picture (`PAGE_PRINT_FAMILIES`): a family printed at a tier. The
|
|
805
|
+
* tier is a right, so it is in the path like the family; the token carries
|
|
806
|
+
* the family's pins and the image format, nothing that sizes the picture.
|
|
807
|
+
*/
|
|
808
|
+
docPagePrint: (docId, tier, family, page, token) => `/v1/docs/${encodeURIComponent(docId)}/${PAGE_PRINT_FAMILIES[tier][family].path}/${encodeURIComponent(encodePageKey(page))}/data@${encodeRenderToken(token)}`,
|
|
809
|
+
docPagePrintCurrent: (docId, tier, family, page) => `/v1/docs/${encodeURIComponent(docId)}/${PAGE_PRINT_FAMILIES[tier][family].path}/${encodeURIComponent(encodePageKey(page))}/data`,
|
|
810
|
+
layerPageGeometry: (docId, layerName, page, contentVersion) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/geometry/pages/${encodeURIComponent(encodePageKey(page))}/data@${encodeContentToken(contentVersion)}`,
|
|
811
|
+
layerPageGeometryCurrent: (docId, layerName, page) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/geometry/pages/${encodeURIComponent(encodePageKey(page))}/data`,
|
|
812
|
+
layerPageRender: (docId, layerName, family, page, token) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/${PAGE_RENDER_FAMILIES[family].path}/${encodeURIComponent(encodePageKey(page))}/data@${encodeRenderToken(token)}`,
|
|
813
|
+
layerPageRenderCurrent: (docId, layerName, family, page) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/${PAGE_RENDER_FAMILIES[family].path}/${encodeURIComponent(encodePageKey(page))}/data`,
|
|
814
|
+
/** Layer twin of `docPagePrint`. */
|
|
815
|
+
layerPagePrint: (docId, layerName, tier, family, page, token) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/${PAGE_PRINT_FAMILIES[tier][family].path}/${encodeURIComponent(encodePageKey(page))}/data@${encodeRenderToken(token)}`,
|
|
816
|
+
layerPagePrintCurrent: (docId, layerName, tier, family, page) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/${PAGE_PRINT_FAMILIES[tier][family].path}/${encodeURIComponent(encodePageKey(page))}/data`,
|
|
817
|
+
/**
|
|
818
|
+
* Immutable base annotation list for a single page (plane-scope model):
|
|
626
819
|
* the shared-URL variant an annotations-inheriting layer resolves at — a
|
|
627
|
-
* base's own annotations (
|
|
628
|
-
* through every pristine layer, so 1,000 visitors' sidebars are
|
|
820
|
+
* base's own annotations (inline ones included) are simply visible
|
|
821
|
+
* through every pristine layer, so 1,000 visitors' sidebars are one CDN
|
|
629
822
|
* object served from the base worker session.
|
|
630
823
|
*/
|
|
631
|
-
docPageAnnotations: (docId,
|
|
632
|
-
/** Immutable
|
|
824
|
+
docPageAnnotations: (docId, page, annotationVersion) => `/v1/docs/${encodeURIComponent(docId)}/annotations/pages/${encodeURIComponent(encodePageKey(page))}/items@${encodeAnnotationToken(annotationVersion)}`,
|
|
825
|
+
/** Immutable base whole-document annotation listing (bulk hydration). */
|
|
633
826
|
docAnnotationsAll: (docId, annotationsVersion) => `/v1/docs/${encodeURIComponent(docId)}/annotations/items@${encodeAnnotationsAllToken(annotationsVersion)}`,
|
|
634
|
-
/** Immutable
|
|
827
|
+
/** Immutable base appearance batch (twin of
|
|
635
828
|
* `layerPageAnnotationAppearances` — same `annotations` plane gate). */
|
|
636
|
-
docPageAnnotationAppearances: (docId,
|
|
829
|
+
docPageAnnotationAppearances: (docId, page, token) => `/v1/docs/${encodeURIComponent(docId)}/annotations/pages/${encodeURIComponent(encodePageKey(page))}/appearances@${encodeAnnotationAppearancesRenderToken(token)}`,
|
|
637
830
|
/**
|
|
638
831
|
* GET: full annotation list for a single page at a specific
|
|
639
832
|
* `annotationVersion`. Same cache-control rules and 404-retry
|
|
640
833
|
* semantics as `docPageText`. The `items` suffix is the
|
|
641
834
|
* collection name — see file-level docstring.
|
|
642
835
|
*/
|
|
643
|
-
layerPageAnnotations: (docId, layerName,
|
|
644
|
-
/** Immutable
|
|
836
|
+
layerPageAnnotations: (docId, layerName, page, annotationVersion) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/annotations/pages/${encodeURIComponent(encodePageKey(page))}/items@${encodeAnnotationToken(annotationVersion)}`,
|
|
837
|
+
/** Immutable base annotation export: a bundle as multipart, needing
|
|
838
|
+
* `doc.annotate.read` and `doc.download`. */
|
|
839
|
+
docAnnotationsExport: (docId, token) => `/v1/docs/${encodeURIComponent(docId)}/annotations/export@${encodeAnnotationsExportToken(token)}`,
|
|
840
|
+
/** Immutable layer annotation export (twin of `docAnnotationsExport`). */
|
|
841
|
+
layerAnnotationsExport: (docId, layerName, token) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/annotations/export@${encodeAnnotationsExportToken(token)}`,
|
|
842
|
+
/**
|
|
843
|
+
* A layer annotation export whose selection a URL can't carry (position
|
|
844
|
+
* refs, long ref lists): a POST of the pins and the selection, not cached.
|
|
845
|
+
*/
|
|
846
|
+
layerAnnotationsExportRequest: (docId, layerName) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/annotations/export`,
|
|
847
|
+
/** A layer's changes: user actions, each its ops in one transaction, or an undo (`doc.apply`). */
|
|
848
|
+
layerChanges: (docId, layerName) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/changes`,
|
|
849
|
+
/** A bundle's annotations, created in the layer as one change (`doc.annotations.import`). */
|
|
850
|
+
layerAnnotationsImport: (docId, layerName) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/annotations/import`,
|
|
851
|
+
/** Immutable layer whole-document annotation listing (bulk hydration). */
|
|
645
852
|
layerAnnotationsAll: (docId, layerName, annotationsVersion) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/annotations/items@${encodeAnnotationsAllToken(annotationsVersion)}`,
|
|
646
|
-
layerPageAnnotationsCurrent: (docId, layerName,
|
|
853
|
+
layerPageAnnotationsCurrent: (docId, layerName, page) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/annotations/pages/${encodeURIComponent(encodePageKey(page))}/items`,
|
|
647
854
|
/**
|
|
648
855
|
* GET: batch-rendered annotation appearance bitmaps for a single page as a
|
|
649
856
|
* `multipart/form-data` body. Sibling collection of `items` under the same
|
|
@@ -654,28 +861,52 @@ const wirePaths = {
|
|
|
654
861
|
* Content-addressed via the appearance render token (`annotationVersion`
|
|
655
862
|
* plus render options like scale/format); CDN may cache forever. Appearance
|
|
656
863
|
* pixels depend only on the annotation `/AP` stream, so `contentVersion` is
|
|
657
|
-
* deliberately
|
|
864
|
+
* deliberately not part of the key.
|
|
658
865
|
*/
|
|
659
|
-
layerPageAnnotationAppearances: (docId, layerName,
|
|
660
|
-
layerPageAnnotationAppearancesCurrent: (docId, layerName,
|
|
661
|
-
layerPageAnnotationsCreate: (docId, layerName,
|
|
662
|
-
layerAnnotationByKey: (docId, layerName,
|
|
663
|
-
|
|
866
|
+
layerPageAnnotationAppearances: (docId, layerName, page, token) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/annotations/pages/${encodeURIComponent(encodePageKey(page))}/appearances@${encodeAnnotationAppearancesRenderToken(token)}`,
|
|
867
|
+
layerPageAnnotationAppearancesCurrent: (docId, layerName, page) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/annotations/pages/${encodeURIComponent(encodePageKey(page))}/appearances`,
|
|
868
|
+
layerPageAnnotationsCreate: (docId, layerName, page) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/annotations/pages/${encodeURIComponent(encodePageKey(page))}/items`,
|
|
869
|
+
layerAnnotationByKey: (docId, layerName, page, key) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/annotations/pages/${encodeURIComponent(encodePageKey(page))}/items/${encodeURIComponent(key)}`,
|
|
870
|
+
/** GET: an annotation's `appearance` resource, its drawing as a one-page
|
|
871
|
+
* PDF — a derived read (application/pdf, no-store), gated like pages/extract. */
|
|
872
|
+
layerAnnotationAppearanceResource: (docId, layerName, page, key) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/annotations/pages/${encodeURIComponent(encodePageKey(page))}/items/${encodeURIComponent(key)}/resources/appearance`,
|
|
873
|
+
layerPageAnnotationsReorder: (docId, layerName, page) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/annotations/pages/${encodeURIComponent(encodePageKey(page))}/items/reorder`,
|
|
664
874
|
/** POST: flatten a chosen set of the page's annotations into its content
|
|
665
875
|
* (a content + annotation mutation of that page). */
|
|
666
|
-
layerPageAnnotationsFlatten: (docId, layerName,
|
|
876
|
+
layerPageAnnotationsFlatten: (docId, layerName, page) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/annotations/pages/${encodeURIComponent(encodePageKey(page))}/items/flatten`,
|
|
667
877
|
/** POST: the chosen annotations' appearances as one single-page PDF — a
|
|
668
878
|
* derived read (application/pdf, no-store), gated like pages/extract. */
|
|
669
|
-
layerPageAnnotationsAppearance: (docId, layerName,
|
|
879
|
+
layerPageAnnotationsAppearance: (docId, layerName, page) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/annotations/pages/${encodeURIComponent(encodePageKey(page))}/items/appearance`,
|
|
880
|
+
/**
|
|
881
|
+
* Immutable base form: the fields, every widget row, the calculation
|
|
882
|
+
* order (`doc.forms.list()`), at the document's `formsVersion`. Needs
|
|
883
|
+
* `doc.forms.read`, under its own prefix, so the CDN signs it apart from
|
|
884
|
+
* the annotations.
|
|
885
|
+
*/
|
|
886
|
+
docForm: (docId, formsVersion) => `/v1/docs/${encodeURIComponent(docId)}/form@${encodeFormToken(formsVersion)}`,
|
|
887
|
+
/** Immutable layer form (twin of `docForm`). */
|
|
888
|
+
layerForm: (docId, layerName, formsVersion) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/form@${encodeFormToken(formsVersion)}`,
|
|
889
|
+
/** GET: the layer's form as it is now — for API callers, served `no-store`. */
|
|
890
|
+
layerFormCurrent: (docId, layerName) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/form`,
|
|
891
|
+
/**
|
|
892
|
+
* Immutable base batch of a page's widget images, every mode and state, as
|
|
893
|
+
* `multipart/form-data` (`page.forms.renderAppearances()`), keyed by the
|
|
894
|
+
* page's `widgetVersion`.
|
|
895
|
+
*/
|
|
896
|
+
docPageFormAppearances: (docId, page, token) => `/v1/docs/${encodeURIComponent(docId)}/form/pages/${encodeURIComponent(encodePageKey(page))}/appearances@${encodeWidgetAppearancesRenderToken(token)}`,
|
|
897
|
+
/** Immutable layer twin of `docPageFormAppearances`. */
|
|
898
|
+
layerPageFormAppearances: (docId, layerName, page, token) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/form/pages/${encodeURIComponent(encodePageKey(page))}/appearances@${encodeWidgetAppearancesRenderToken(token)}`,
|
|
899
|
+
layerPageFormAppearancesCurrent: (docId, layerName, page) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/form/pages/${encodeURIComponent(encodePageKey(page))}/appearances`,
|
|
670
900
|
/**
|
|
671
|
-
*
|
|
672
|
-
*
|
|
673
|
-
*
|
|
674
|
-
* no content-addressed `@version` variant: the snapshot is always served
|
|
675
|
-
* `no-store`. Mutation results carry the per-page `cacheDelta` that keeps
|
|
676
|
-
* annotation/render caches coherent when widget appearances change.
|
|
901
|
+
* PATCH: a widget's place and look (`doc.forms.updateWidget`). `key` is
|
|
902
|
+
* the widget's annotation key. Not under `form/pages/`, which the CDN
|
|
903
|
+
* signs for reads.
|
|
677
904
|
*/
|
|
678
|
-
|
|
905
|
+
/** POST: the form's calculation order (`doc.forms.reorderCalculations`). */
|
|
906
|
+
layerFormCalculationsReorder: (docId, layerName) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/form/calculations/reorder`,
|
|
907
|
+
/** POST: the stacking order of a page's widgets (`doc.forms.reorderWidgets`). */
|
|
908
|
+
layerFormWidgetsReorder: (docId, layerName, page) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/form/widgets/${encodeURIComponent(encodePageKey(page))}/reorder`,
|
|
909
|
+
layerFormWidget: (docId, layerName, page, key) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/form/widgets/${encodeURIComponent(encodePageKey(page))}/${encodeURIComponent(key)}`,
|
|
679
910
|
/** POST: create a field (optionally with styled widget placements). */
|
|
680
911
|
layerFormFields: (docId, layerName) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/form/fields`,
|
|
681
912
|
/**
|
|
@@ -686,9 +917,9 @@ const wirePaths = {
|
|
|
686
917
|
layerFormFieldByKey: (docId, layerName, fieldKey) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/form/fields/${encodeURIComponent(fieldKey)}`,
|
|
687
918
|
/** POST: replace the field's value (`{ value: FormFieldValue }`). */
|
|
688
919
|
layerFormFieldValue: (docId, layerName, fieldKey) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/form/fields/${encodeURIComponent(fieldKey)}/value`,
|
|
689
|
-
/** POST: reset
|
|
690
|
-
|
|
691
|
-
/** POST:
|
|
920
|
+
/** POST: reset fields to /DV (or clear): `{ refs? }`, the whole form without `refs`. */
|
|
921
|
+
layerFormReset: (docId, layerName) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/form/reset`,
|
|
922
|
+
/** POST: add a widget to the field, the body its placement (`WidgetPlacement`). */
|
|
692
923
|
layerFormFieldWidgets: (docId, layerName, fieldKey) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/form/fields/${encodeURIComponent(fieldKey)}/widgets`,
|
|
693
924
|
/**
|
|
694
925
|
* POST: release a widget back to the inert annotation plane
|
|
@@ -697,18 +928,21 @@ const wirePaths = {
|
|
|
697
928
|
* one codec instead of inventing a second composite key syntax.
|
|
698
929
|
*/
|
|
699
930
|
layerFormFieldWidgetsDetach: (docId, layerName, fieldKey) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/form/fields/${encodeURIComponent(fieldKey)}/widgets/detach`,
|
|
700
|
-
/**
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
*/
|
|
705
|
-
|
|
931
|
+
/** Immutable base form export: a bundle as multipart, needing `doc.forms.read` and `doc.download`. */
|
|
932
|
+
docFormExport: (docId, token) => `/v1/docs/${encodeURIComponent(docId)}/form/export@${encodeFormExportToken(token)}`,
|
|
933
|
+
/** Immutable layer form export (twin of `docFormExport`). */
|
|
934
|
+
layerFormExport: (docId, layerName, token) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/form/export@${encodeFormExportToken(token)}`,
|
|
935
|
+
/** A layer form export whose selection a URL can't carry: a POST of the pins and the selection, not cached. */
|
|
936
|
+
layerFormExportRequest: (docId, layerName) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/form/export`,
|
|
937
|
+
/** A bundle's design, created in the layer as one change (`doc.forms.import`). */
|
|
938
|
+
layerFormImport: (docId, layerName) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/form/import`,
|
|
939
|
+
/** A bundle's values, written in the layer as one change (`doc.forms.importValues`). */
|
|
940
|
+
layerFormImportValues: (docId, layerName) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/form/import-values`,
|
|
706
941
|
/** POST: durable reconciliation (`{ bakeAppearances? }`). */
|
|
707
942
|
layerFormRepair: (docId, layerName) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/form/repair`,
|
|
708
|
-
layerFormEffects: (docId, layerName) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/form/effects`,
|
|
709
943
|
/**
|
|
710
944
|
* GET: one budgeted search slice, versioned form. The token
|
|
711
|
-
* (`encodeSearchToken`)
|
|
945
|
+
* (`encodeSearchToken`) is the cache key: content epoch + query +
|
|
712
946
|
* position. Immutable; CDN may cache forever. Mode is the path — rects
|
|
713
947
|
* and full are separate resources so permission tiers never share
|
|
714
948
|
* cache entries (`'rects'` needs `doc.text.search`; `'full'` also
|
|
@@ -718,32 +952,22 @@ const wirePaths = {
|
|
|
718
952
|
layerSearchFull: (docId, layerName, token) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/search/full/data@${token}`,
|
|
719
953
|
/**
|
|
720
954
|
* GET: unversioned form — same fields as flat query params (`q` as
|
|
721
|
-
* plain text), served from the
|
|
955
|
+
* plain text), served from the current content, always `no-store`.
|
|
722
956
|
* The debug/simple-client variant; the SDK uses the versioned form.
|
|
723
957
|
*/
|
|
724
958
|
layerSearchRectsCurrent: (docId, layerName) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/search/rects/data`,
|
|
725
959
|
layerSearchFullCurrent: (docId, layerName) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/search/full/data`,
|
|
726
|
-
layerPageViewports: (docId, layerName,
|
|
727
|
-
layerPageScale: (docId, layerName,
|
|
728
|
-
|
|
729
|
-
layerPagesRotate: (docId, layerName) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/pages/rotate`,
|
|
730
|
-
layerPagesDelete: (docId, layerName) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/pages/delete`,
|
|
731
|
-
/** POST: register/rename a `/Names /Pages` entry — a page-STRUCTURE
|
|
960
|
+
layerPageViewports: (docId, layerName, page) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/pages/${encodeURIComponent(encodePageKey(page))}/viewports`,
|
|
961
|
+
layerPageScale: (docId, layerName, page) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/pages/${encodeURIComponent(encodePageKey(page))}/scale`,
|
|
962
|
+
/** POST: register/rename a `/Names /Pages` entry — a page-structure
|
|
732
963
|
* mutation (docVersion + layoutVersion advance; reads ride `/layout`). */
|
|
733
964
|
layerPagesNames: (docId, layerName) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/pages/names`,
|
|
734
965
|
/** POST: remove a `/Names /Pages` entry (the page stays). */
|
|
735
966
|
layerPagesNamesDelete: (docId, layerName) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/pages/names/delete`,
|
|
736
967
|
layerPagesFlatten: (docId, layerName) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/pages/flatten`,
|
|
737
968
|
/**
|
|
738
|
-
* POST (multipart mutation envelope): copy every page of the `source`
|
|
739
|
-
* resource part (a standalone PDF) in at the body's `destIndex`.
|
|
740
|
-
*/
|
|
741
|
-
layerPagesInsert: (docId, layerName) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/pages/insert`,
|
|
742
|
-
/** POST (plain JSON): create blank pages — pages.insert minus the bytes. */
|
|
743
|
-
layerPagesInsertBlank: (docId, layerName) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/pages/insert-blank`,
|
|
744
|
-
/**
|
|
745
969
|
* POST (plain JSON → `application/pdf` bytes): export the listed pages,
|
|
746
|
-
* in caller order, as a standalone PDF. A
|
|
970
|
+
* in caller order, as a standalone PDF. A read over the current layer
|
|
747
971
|
* state (gated like /download), so it is a POST only for its body —
|
|
748
972
|
* nothing mutates and no event is published.
|
|
749
973
|
*/
|
|
@@ -753,15 +977,6 @@ const wirePaths = {
|
|
|
753
977
|
layerDownload: (docId, layerName) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/download`,
|
|
754
978
|
layerDownloadVersioned: (docId, layerName, token) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/download@${encodeDownloadToken(token)}`,
|
|
755
979
|
/**
|
|
756
|
-
* Weak-annotation-sessions: pluralized in v2 so the collection
|
|
757
|
-
* lives at `/weak-annotation-sessions` and members at
|
|
758
|
-
* `/weak-annotation-sessions/{sessionId}` — REST-conventional.
|
|
759
|
-
*/
|
|
760
|
-
layerWeakAnnotationSession: (docId, layerName) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/weak-annotation-sessions`,
|
|
761
|
-
layerWeakAnnotationSessionHeartbeat: (docId, layerName, sessionId) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/weak-annotation-sessions/${encodeURIComponent(sessionId)}/heartbeat`,
|
|
762
|
-
layerWeakAnnotationSessionPages: (docId, layerName, sessionId) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/weak-annotation-sessions/${encodeURIComponent(sessionId)}/pages`,
|
|
763
|
-
layerWeakAnnotationSessionRelease: (docId, layerName, sessionId) => `/v1/docs/${encodeURIComponent(docId)}/layers/${encodeURIComponent(layerName)}/weak-annotation-sessions/${encodeURIComponent(sessionId)}`,
|
|
764
|
-
/**
|
|
765
980
|
* POST: pre-warm the doc cache + worker open before any user
|
|
766
981
|
* request lands. Body is `{ docId }`. Doc-scoped token required.
|
|
767
982
|
*/
|
|
@@ -780,29 +995,36 @@ function analysisQueryString(query) {
|
|
|
780
995
|
const wireTemplates = {
|
|
781
996
|
docHead: "/v1/docs/:docId/head",
|
|
782
997
|
layerManifest: "/v1/docs/:docId/layers/:layerName/manifest",
|
|
998
|
+
layerChanges: "/v1/docs/:docId/layers/:layerName/changes",
|
|
783
999
|
layerMetadata: "/v1/docs/:docId/layers/:layerName/metadata",
|
|
784
|
-
|
|
785
|
-
|
|
1000
|
+
layerCustomMetadata: "/v1/docs/:docId/layers/:layerName/metadata/custom",
|
|
1001
|
+
layerOutline: "/v1/docs/:docId/layers/:layerName/outline",
|
|
1002
|
+
layerAttachments: "/v1/docs/:docId/layers/:layerName/attachments",
|
|
1003
|
+
layerAttachmentFile: "/v1/docs/:docId/layers/:layerName/attachment-files/:fileKey/data",
|
|
1004
|
+
layerRenderPage: "/v1/docs/:docId/layers/:layerName/render/pages/:pageKey/data",
|
|
1005
|
+
layerTextPage: "/v1/docs/:docId/layers/:layerName/text/pages/:pageKey/data",
|
|
786
1006
|
layerAnnotationItemsAll: "/v1/docs/:docId/layers/:layerName/annotations/items",
|
|
787
|
-
layerAnnotationItems: "/v1/docs/:docId/layers/:layerName/annotations/pages/:
|
|
788
|
-
layerAnnotationItem: "/v1/docs/:docId/layers/:layerName/annotations/pages/:
|
|
789
|
-
|
|
790
|
-
|
|
1007
|
+
layerAnnotationItems: "/v1/docs/:docId/layers/:layerName/annotations/pages/:pageKey/items",
|
|
1008
|
+
layerAnnotationItem: "/v1/docs/:docId/layers/:layerName/annotations/pages/:pageKey/items/:annotKey",
|
|
1009
|
+
layerAnnotationItemsReorder: "/v1/docs/:docId/layers/:layerName/annotations/pages/:pageKey/items/reorder",
|
|
1010
|
+
layerAnnotationItemsFlatten: "/v1/docs/:docId/layers/:layerName/annotations/pages/:pageKey/items/flatten",
|
|
1011
|
+
layerAnnotationItemsAppearance: "/v1/docs/:docId/layers/:layerName/annotations/pages/:pageKey/items/appearance",
|
|
1012
|
+
layerAnnotationItemAppearanceResource: "/v1/docs/:docId/layers/:layerName/annotations/pages/:pageKey/items/:annotKey/resources/appearance",
|
|
1013
|
+
layerAnnotationItemFileResource: "/v1/docs/:docId/layers/:layerName/annotations/pages/:pageKey/items/:annotKey/resources/file",
|
|
791
1014
|
layerForm: "/v1/docs/:docId/layers/:layerName/form",
|
|
1015
|
+
layerFormWidget: "/v1/docs/:docId/layers/:layerName/form/widgets/:pageKey/:annotKey",
|
|
1016
|
+
layerFormWidgetsReorder: "/v1/docs/:docId/layers/:layerName/form/widgets/:pageKey/reorder",
|
|
1017
|
+
layerFormCalculationsReorder: "/v1/docs/:docId/layers/:layerName/form/calculations/reorder",
|
|
792
1018
|
layerFormFieldValue: "/v1/docs/:docId/layers/:layerName/form/fields/:fieldKey/value",
|
|
793
|
-
|
|
1019
|
+
layerFormReset: "/v1/docs/:docId/layers/:layerName/form/reset",
|
|
794
1020
|
layerFormFieldSignatureAppearance: "/v1/docs/:docId/layers/:layerName/form/fields/:fieldKey/signature-appearance",
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
layerPagesRotate: "/v1/docs/:docId/layers/:layerName/pages/rotate",
|
|
800
|
-
layerPagesDelete: "/v1/docs/:docId/layers/:layerName/pages/delete",
|
|
1021
|
+
layerFormImport: "/v1/docs/:docId/layers/:layerName/form/import",
|
|
1022
|
+
layerFormImportValues: "/v1/docs/:docId/layers/:layerName/form/import-values",
|
|
1023
|
+
layerPageViewports: "/v1/docs/:docId/layers/:layerName/pages/:pageKey/viewports",
|
|
1024
|
+
layerPageScale: "/v1/docs/:docId/layers/:layerName/pages/:pageKey/scale",
|
|
801
1025
|
layerPagesNames: "/v1/docs/:docId/layers/:layerName/pages/names",
|
|
802
1026
|
layerPagesNamesDelete: "/v1/docs/:docId/layers/:layerName/pages/names/delete",
|
|
803
1027
|
layerPagesFlatten: "/v1/docs/:docId/layers/:layerName/pages/flatten",
|
|
804
|
-
layerPagesInsert: "/v1/docs/:docId/layers/:layerName/pages/insert",
|
|
805
|
-
layerPagesInsertBlank: "/v1/docs/:docId/layers/:layerName/pages/insert-blank",
|
|
806
1028
|
layerPagesExtract: "/v1/docs/:docId/layers/:layerName/pages/extract",
|
|
807
1029
|
layerRedactionsApply: "/v1/docs/:docId/layers/:layerName/redactions/apply",
|
|
808
1030
|
layerDownload: "/v1/docs/:docId/layers/:layerName/download",
|
|
@@ -810,7 +1032,7 @@ const wireTemplates = {
|
|
|
810
1032
|
layerSignaturesAnalysis: "/v1/docs/:docId/layers/:layerName/signatures/analysis",
|
|
811
1033
|
layerSignaturesPrepare: "/v1/docs/:docId/layers/:layerName/signatures/prepare",
|
|
812
1034
|
layerSignatureComplete: "/v1/docs/:docId/layers/:layerName/signatures/:signingId/complete",
|
|
813
|
-
|
|
1035
|
+
layerSignatureCancel: "/v1/docs/:docId/layers/:layerName/signatures/:signingId",
|
|
814
1036
|
docVersions: "/v1/docs/:docId/versions",
|
|
815
1037
|
docVersionSignatures: "/v1/docs/:docId/versions/signatures/:sha",
|
|
816
1038
|
docVersionSignatureContents: "/v1/docs/:docId/versions/signatures/:sha/:fieldKey/contents",
|
|
@@ -821,8 +1043,45 @@ const wireTemplates = {
|
|
|
821
1043
|
};
|
|
822
1044
|
//#endregion
|
|
823
1045
|
//#region src/wire/resources.ts
|
|
1046
|
+
/** A page picture of one family, at the document's shared path. */
|
|
1047
|
+
function pageRenderResource(picture) {
|
|
1048
|
+
const { resource, path, needs } = picture;
|
|
1049
|
+
return {
|
|
1050
|
+
id: resource,
|
|
1051
|
+
pathPattern: `/v1/docs/{docId}/${path}/*/data@*`,
|
|
1052
|
+
resolvePathPattern: (docId) => `/v1/docs/${docId}/${path}/*/data@*`,
|
|
1053
|
+
pathPrefix: `/v1/docs/{docId}/${path}/`,
|
|
1054
|
+
resolvePathPrefix: (docId) => `/v1/docs/${docId}/${path}/`,
|
|
1055
|
+
requirement: requirementOf(needs),
|
|
1056
|
+
routeKind: "versioned-read",
|
|
1057
|
+
cdnCacheable: true
|
|
1058
|
+
};
|
|
1059
|
+
}
|
|
1060
|
+
/** A page picture of one family, at a layer's path. */
|
|
1061
|
+
function layerPageRenderResource(picture) {
|
|
1062
|
+
const { layerResource, path, needs } = picture;
|
|
1063
|
+
return {
|
|
1064
|
+
id: layerResource,
|
|
1065
|
+
pathPattern: `/v1/docs/{docId}/layers/{layerName}/${path}/*/data@*`,
|
|
1066
|
+
resolvePathPattern: (docId, layerName = "default") => `/v1/docs/${docId}/layers/${layerName}/${path}/*/data@*`,
|
|
1067
|
+
pathPrefix: `/v1/docs/{docId}/layers/{layerName}/${path}/`,
|
|
1068
|
+
resolvePathPrefix: (docId, layerName = "default") => `/v1/docs/${docId}/layers/${layerName}/${path}/`,
|
|
1069
|
+
requirement: requirementOf(needs),
|
|
1070
|
+
routeKind: "versioned-read",
|
|
1071
|
+
cdnCacheable: true
|
|
1072
|
+
};
|
|
1073
|
+
}
|
|
1074
|
+
function requirementOf(needs) {
|
|
1075
|
+
return needs.length === 1 ? {
|
|
1076
|
+
kind: "single",
|
|
1077
|
+
capability: needs[0]
|
|
1078
|
+
} : {
|
|
1079
|
+
kind: "all",
|
|
1080
|
+
capabilities: needs
|
|
1081
|
+
};
|
|
1082
|
+
}
|
|
824
1083
|
/**
|
|
825
|
-
* URL layout
|
|
1084
|
+
* URL layout: each resource type lives at a distinct path
|
|
826
1085
|
* prefix so prefix-matching CDNs (Bunny, Cloud CDN, Azure FD) can
|
|
827
1086
|
* enforce per-resource scope at the edge. See wire/paths.ts for the
|
|
828
1087
|
* full shape and rationale.
|
|
@@ -867,32 +1126,18 @@ const DOC_RESOURCES = {
|
|
|
867
1126
|
routeKind: "versioned-read",
|
|
868
1127
|
cdnCacheable: true
|
|
869
1128
|
},
|
|
870
|
-
"page-render":
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
},
|
|
883
|
-
"page-render-annotated": {
|
|
884
|
-
id: "page-render-annotated",
|
|
885
|
-
pathPattern: "/v1/docs/{docId}/render/annotated/pages/*/data@*",
|
|
886
|
-
resolvePathPattern: (docId) => `/v1/docs/${docId}/render/annotated/pages/*/data@*`,
|
|
887
|
-
pathPrefix: "/v1/docs/{docId}/render/annotated/pages/",
|
|
888
|
-
resolvePathPrefix: (docId) => `/v1/docs/${docId}/render/annotated/pages/`,
|
|
889
|
-
requirement: {
|
|
890
|
-
kind: "single",
|
|
891
|
-
capability: "doc.render"
|
|
892
|
-
},
|
|
893
|
-
routeKind: "versioned-read",
|
|
894
|
-
cdnCacheable: true
|
|
895
|
-
},
|
|
1129
|
+
"page-render": pageRenderResource(PAGE_RENDER_FAMILIES.pages),
|
|
1130
|
+
"page-render-annotations": pageRenderResource(PAGE_RENDER_FAMILIES.annotations),
|
|
1131
|
+
"page-render-fields": pageRenderResource(PAGE_RENDER_FAMILIES.fields),
|
|
1132
|
+
"page-render-all": pageRenderResource(PAGE_RENDER_FAMILIES.all),
|
|
1133
|
+
"page-print": pageRenderResource(PAGE_PRINT_FAMILIES.print.pages),
|
|
1134
|
+
"page-print-annotations": pageRenderResource(PAGE_PRINT_FAMILIES.print.annotations),
|
|
1135
|
+
"page-print-fields": pageRenderResource(PAGE_PRINT_FAMILIES.print.fields),
|
|
1136
|
+
"page-print-all": pageRenderResource(PAGE_PRINT_FAMILIES.print.all),
|
|
1137
|
+
"page-print-high": pageRenderResource(PAGE_PRINT_FAMILIES["print-high"].pages),
|
|
1138
|
+
"page-print-high-annotations": pageRenderResource(PAGE_PRINT_FAMILIES["print-high"].annotations),
|
|
1139
|
+
"page-print-high-fields": pageRenderResource(PAGE_PRINT_FAMILIES["print-high"].fields),
|
|
1140
|
+
"page-print-high-all": pageRenderResource(PAGE_PRINT_FAMILIES["print-high"].all),
|
|
896
1141
|
"page-annotations": {
|
|
897
1142
|
id: "page-annotations",
|
|
898
1143
|
pathPattern: "/v1/docs/{docId}/annotations/pages/*/items@*",
|
|
@@ -919,6 +1164,58 @@ const DOC_RESOURCES = {
|
|
|
919
1164
|
routeKind: "versioned-read",
|
|
920
1165
|
cdnCacheable: true
|
|
921
1166
|
},
|
|
1167
|
+
"annotations-export": {
|
|
1168
|
+
id: "annotations-export",
|
|
1169
|
+
pathPattern: "/v1/docs/{docId}/annotations/export@*",
|
|
1170
|
+
resolvePathPattern: (docId) => `/v1/docs/${docId}/annotations/export@*`,
|
|
1171
|
+
pathPrefix: "/v1/docs/{docId}/annotations/export@",
|
|
1172
|
+
resolvePathPrefix: (docId) => `/v1/docs/${docId}/annotations/export@`,
|
|
1173
|
+
requirement: {
|
|
1174
|
+
kind: "all",
|
|
1175
|
+
capabilities: ["doc.annotate.read", "doc.download"]
|
|
1176
|
+
},
|
|
1177
|
+
routeKind: "versioned-read",
|
|
1178
|
+
cdnCacheable: true
|
|
1179
|
+
},
|
|
1180
|
+
"form-export": {
|
|
1181
|
+
id: "form-export",
|
|
1182
|
+
pathPattern: "/v1/docs/{docId}/form/export@*",
|
|
1183
|
+
resolvePathPattern: (docId) => `/v1/docs/${docId}/form/export@*`,
|
|
1184
|
+
pathPrefix: "/v1/docs/{docId}/form/export@",
|
|
1185
|
+
resolvePathPrefix: (docId) => `/v1/docs/${docId}/form/export@`,
|
|
1186
|
+
requirement: {
|
|
1187
|
+
kind: "all",
|
|
1188
|
+
capabilities: ["doc.forms.read", "doc.download"]
|
|
1189
|
+
},
|
|
1190
|
+
routeKind: "versioned-read",
|
|
1191
|
+
cdnCacheable: true
|
|
1192
|
+
},
|
|
1193
|
+
form: {
|
|
1194
|
+
id: "form",
|
|
1195
|
+
pathPattern: "/v1/docs/{docId}/form@*",
|
|
1196
|
+
resolvePathPattern: (docId) => `/v1/docs/${docId}/form@*`,
|
|
1197
|
+
pathPrefix: "/v1/docs/{docId}/form@",
|
|
1198
|
+
resolvePathPrefix: (docId) => `/v1/docs/${docId}/form@`,
|
|
1199
|
+
requirement: {
|
|
1200
|
+
kind: "single",
|
|
1201
|
+
capability: "doc.forms.read"
|
|
1202
|
+
},
|
|
1203
|
+
routeKind: "versioned-read",
|
|
1204
|
+
cdnCacheable: true
|
|
1205
|
+
},
|
|
1206
|
+
"page-form": {
|
|
1207
|
+
id: "page-form",
|
|
1208
|
+
pathPattern: "/v1/docs/{docId}/form/pages/*/appearances@*",
|
|
1209
|
+
resolvePathPattern: (docId) => `/v1/docs/${docId}/form/pages/*/appearances@*`,
|
|
1210
|
+
pathPrefix: "/v1/docs/{docId}/form/pages/",
|
|
1211
|
+
resolvePathPrefix: (docId) => `/v1/docs/${docId}/form/pages/`,
|
|
1212
|
+
requirement: {
|
|
1213
|
+
kind: "single",
|
|
1214
|
+
capability: "doc.forms.read"
|
|
1215
|
+
},
|
|
1216
|
+
routeKind: "versioned-read",
|
|
1217
|
+
cdnCacheable: true
|
|
1218
|
+
},
|
|
922
1219
|
layout: {
|
|
923
1220
|
id: "layout",
|
|
924
1221
|
pathPattern: "/v1/docs/{docId}/layout@*",
|
|
@@ -945,6 +1242,19 @@ const DOC_RESOURCES = {
|
|
|
945
1242
|
routeKind: "versioned-read",
|
|
946
1243
|
cdnCacheable: true
|
|
947
1244
|
},
|
|
1245
|
+
"metadata-custom": {
|
|
1246
|
+
id: "metadata-custom",
|
|
1247
|
+
pathPattern: "/v1/docs/{docId}/metadata/custom@*",
|
|
1248
|
+
resolvePathPattern: (docId) => `/v1/docs/${docId}/metadata/custom@*`,
|
|
1249
|
+
pathPrefix: "/v1/docs/{docId}/metadata/custom@",
|
|
1250
|
+
resolvePathPrefix: (docId) => `/v1/docs/${docId}/metadata/custom@`,
|
|
1251
|
+
requirement: {
|
|
1252
|
+
kind: "single",
|
|
1253
|
+
capability: "doc.open"
|
|
1254
|
+
},
|
|
1255
|
+
routeKind: "versioned-read",
|
|
1256
|
+
cdnCacheable: true
|
|
1257
|
+
},
|
|
948
1258
|
actions: {
|
|
949
1259
|
id: "actions",
|
|
950
1260
|
pathPattern: "/v1/docs/{docId}/actions@*",
|
|
@@ -984,6 +1294,19 @@ const DOC_RESOURCES = {
|
|
|
984
1294
|
routeKind: "versioned-read",
|
|
985
1295
|
cdnCacheable: true
|
|
986
1296
|
},
|
|
1297
|
+
"layer-metadata-custom": {
|
|
1298
|
+
id: "layer-metadata-custom",
|
|
1299
|
+
pathPattern: "/v1/docs/{docId}/layers/{layerName}/metadata/custom@*",
|
|
1300
|
+
resolvePathPattern: (docId, layerName = "default") => `/v1/docs/${docId}/layers/${layerName}/metadata/custom@*`,
|
|
1301
|
+
pathPrefix: "/v1/docs/{docId}/layers/{layerName}/metadata/custom@",
|
|
1302
|
+
resolvePathPrefix: (docId, layerName = "default") => `/v1/docs/${docId}/layers/${layerName}/metadata/custom@`,
|
|
1303
|
+
requirement: {
|
|
1304
|
+
kind: "single",
|
|
1305
|
+
capability: "doc.open"
|
|
1306
|
+
},
|
|
1307
|
+
routeKind: "versioned-read",
|
|
1308
|
+
cdnCacheable: true
|
|
1309
|
+
},
|
|
987
1310
|
"layer-actions": {
|
|
988
1311
|
id: "layer-actions",
|
|
989
1312
|
pathPattern: "/v1/docs/{docId}/layers/{layerName}/actions@*",
|
|
@@ -1010,6 +1333,19 @@ const DOC_RESOURCES = {
|
|
|
1010
1333
|
routeKind: "versioned-read",
|
|
1011
1334
|
cdnCacheable: true
|
|
1012
1335
|
},
|
|
1336
|
+
outline: {
|
|
1337
|
+
id: "outline",
|
|
1338
|
+
pathPattern: "/v1/docs/{docId}/outline@*",
|
|
1339
|
+
resolvePathPattern: (docId) => `/v1/docs/${docId}/outline@*`,
|
|
1340
|
+
pathPrefix: "/v1/docs/{docId}/outline@",
|
|
1341
|
+
resolvePathPrefix: (docId) => `/v1/docs/${docId}/outline@`,
|
|
1342
|
+
requirement: {
|
|
1343
|
+
kind: "single",
|
|
1344
|
+
capability: "doc.open"
|
|
1345
|
+
},
|
|
1346
|
+
routeKind: "versioned-read",
|
|
1347
|
+
cdnCacheable: true
|
|
1348
|
+
},
|
|
1013
1349
|
"attachment-files": {
|
|
1014
1350
|
id: "attachment-files",
|
|
1015
1351
|
pathPattern: "/v1/docs/{docId}/attachment-files/*",
|
|
@@ -1036,6 +1372,19 @@ const DOC_RESOURCES = {
|
|
|
1036
1372
|
routeKind: "versioned-read",
|
|
1037
1373
|
cdnCacheable: true
|
|
1038
1374
|
},
|
|
1375
|
+
"layer-outline": {
|
|
1376
|
+
id: "layer-outline",
|
|
1377
|
+
pathPattern: "/v1/docs/{docId}/layers/{layerName}/outline@*",
|
|
1378
|
+
resolvePathPattern: (docId, layerName = "default") => `/v1/docs/${docId}/layers/${layerName}/outline@*`,
|
|
1379
|
+
pathPrefix: "/v1/docs/{docId}/layers/{layerName}/outline@",
|
|
1380
|
+
resolvePathPrefix: (docId, layerName = "default") => `/v1/docs/${docId}/layers/${layerName}/outline@`,
|
|
1381
|
+
requirement: {
|
|
1382
|
+
kind: "single",
|
|
1383
|
+
capability: "doc.open"
|
|
1384
|
+
},
|
|
1385
|
+
routeKind: "versioned-read",
|
|
1386
|
+
cdnCacheable: true
|
|
1387
|
+
},
|
|
1039
1388
|
"layer-attachment-files": {
|
|
1040
1389
|
id: "layer-attachment-files",
|
|
1041
1390
|
pathPattern: "/v1/docs/{docId}/layers/{layerName}/attachment-files/*",
|
|
@@ -1049,32 +1398,18 @@ const DOC_RESOURCES = {
|
|
|
1049
1398
|
routeKind: "versioned-read",
|
|
1050
1399
|
cdnCacheable: true
|
|
1051
1400
|
},
|
|
1052
|
-
"layer-page-render":
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
},
|
|
1065
|
-
"layer-page-render-annotated": {
|
|
1066
|
-
id: "layer-page-render-annotated",
|
|
1067
|
-
pathPattern: "/v1/docs/{docId}/layers/{layerName}/render/annotated/pages/*/data@*",
|
|
1068
|
-
resolvePathPattern: (docId, layerName = "default") => `/v1/docs/${docId}/layers/${layerName}/render/annotated/pages/*/data@*`,
|
|
1069
|
-
pathPrefix: "/v1/docs/{docId}/layers/{layerName}/render/annotated/pages/",
|
|
1070
|
-
resolvePathPrefix: (docId, layerName = "default") => `/v1/docs/${docId}/layers/${layerName}/render/annotated/pages/`,
|
|
1071
|
-
requirement: {
|
|
1072
|
-
kind: "single",
|
|
1073
|
-
capability: "doc.render"
|
|
1074
|
-
},
|
|
1075
|
-
routeKind: "versioned-read",
|
|
1076
|
-
cdnCacheable: true
|
|
1077
|
-
},
|
|
1401
|
+
"layer-page-render": layerPageRenderResource(PAGE_RENDER_FAMILIES.pages),
|
|
1402
|
+
"layer-page-render-annotations": layerPageRenderResource(PAGE_RENDER_FAMILIES.annotations),
|
|
1403
|
+
"layer-page-render-fields": layerPageRenderResource(PAGE_RENDER_FAMILIES.fields),
|
|
1404
|
+
"layer-page-render-all": layerPageRenderResource(PAGE_RENDER_FAMILIES.all),
|
|
1405
|
+
"layer-page-print": layerPageRenderResource(PAGE_PRINT_FAMILIES.print.pages),
|
|
1406
|
+
"layer-page-print-annotations": layerPageRenderResource(PAGE_PRINT_FAMILIES.print.annotations),
|
|
1407
|
+
"layer-page-print-fields": layerPageRenderResource(PAGE_PRINT_FAMILIES.print.fields),
|
|
1408
|
+
"layer-page-print-all": layerPageRenderResource(PAGE_PRINT_FAMILIES.print.all),
|
|
1409
|
+
"layer-page-print-high": layerPageRenderResource(PAGE_PRINT_FAMILIES["print-high"].pages),
|
|
1410
|
+
"layer-page-print-high-annotations": layerPageRenderResource(PAGE_PRINT_FAMILIES["print-high"].annotations),
|
|
1411
|
+
"layer-page-print-high-fields": layerPageRenderResource(PAGE_PRINT_FAMILIES["print-high"].fields),
|
|
1412
|
+
"layer-page-print-high-all": layerPageRenderResource(PAGE_PRINT_FAMILIES["print-high"].all),
|
|
1078
1413
|
"page-text": {
|
|
1079
1414
|
id: "page-text",
|
|
1080
1415
|
pathPattern: "/v1/docs/{docId}/text/pages/*/data@*",
|
|
@@ -1166,6 +1501,19 @@ const DOC_RESOURCES = {
|
|
|
1166
1501
|
routeKind: "versioned-read",
|
|
1167
1502
|
cdnCacheable: true
|
|
1168
1503
|
},
|
|
1504
|
+
"layer-annotations-export": {
|
|
1505
|
+
id: "layer-annotations-export",
|
|
1506
|
+
pathPattern: "/v1/docs/{docId}/layers/{layerName}/annotations/export@*",
|
|
1507
|
+
resolvePathPattern: (docId, layerName = "default") => `/v1/docs/${docId}/layers/${layerName}/annotations/export@*`,
|
|
1508
|
+
pathPrefix: "/v1/docs/{docId}/layers/{layerName}/annotations/export@",
|
|
1509
|
+
resolvePathPrefix: (docId, layerName = "default") => `/v1/docs/${docId}/layers/${layerName}/annotations/export@`,
|
|
1510
|
+
requirement: {
|
|
1511
|
+
kind: "all",
|
|
1512
|
+
capabilities: ["doc.annotate.read", "doc.download"]
|
|
1513
|
+
},
|
|
1514
|
+
routeKind: "versioned-read",
|
|
1515
|
+
cdnCacheable: true
|
|
1516
|
+
},
|
|
1169
1517
|
"layer-annotations-all": {
|
|
1170
1518
|
id: "layer-annotations-all",
|
|
1171
1519
|
pathPattern: "/v1/docs/{docId}/layers/{layerName}/annotations/items@*",
|
|
@@ -1179,6 +1527,45 @@ const DOC_RESOURCES = {
|
|
|
1179
1527
|
routeKind: "versioned-read",
|
|
1180
1528
|
cdnCacheable: true
|
|
1181
1529
|
},
|
|
1530
|
+
"layer-form-export": {
|
|
1531
|
+
id: "layer-form-export",
|
|
1532
|
+
pathPattern: "/v1/docs/{docId}/layers/{layerName}/form/export@*",
|
|
1533
|
+
resolvePathPattern: (docId, layerName = "default") => `/v1/docs/${docId}/layers/${layerName}/form/export@*`,
|
|
1534
|
+
pathPrefix: "/v1/docs/{docId}/layers/{layerName}/form/export@",
|
|
1535
|
+
resolvePathPrefix: (docId, layerName = "default") => `/v1/docs/${docId}/layers/${layerName}/form/export@`,
|
|
1536
|
+
requirement: {
|
|
1537
|
+
kind: "all",
|
|
1538
|
+
capabilities: ["doc.forms.read", "doc.download"]
|
|
1539
|
+
},
|
|
1540
|
+
routeKind: "versioned-read",
|
|
1541
|
+
cdnCacheable: true
|
|
1542
|
+
},
|
|
1543
|
+
"layer-form": {
|
|
1544
|
+
id: "layer-form",
|
|
1545
|
+
pathPattern: "/v1/docs/{docId}/layers/{layerName}/form@*",
|
|
1546
|
+
resolvePathPattern: (docId, layerName = "default") => `/v1/docs/${docId}/layers/${layerName}/form@*`,
|
|
1547
|
+
pathPrefix: "/v1/docs/{docId}/layers/{layerName}/form@",
|
|
1548
|
+
resolvePathPrefix: (docId, layerName = "default") => `/v1/docs/${docId}/layers/${layerName}/form@`,
|
|
1549
|
+
requirement: {
|
|
1550
|
+
kind: "single",
|
|
1551
|
+
capability: "doc.forms.read"
|
|
1552
|
+
},
|
|
1553
|
+
routeKind: "versioned-read",
|
|
1554
|
+
cdnCacheable: true
|
|
1555
|
+
},
|
|
1556
|
+
"layer-page-form": {
|
|
1557
|
+
id: "layer-page-form",
|
|
1558
|
+
pathPattern: "/v1/docs/{docId}/layers/{layerName}/form/pages/*/appearances@*",
|
|
1559
|
+
resolvePathPattern: (docId, layerName = "default") => `/v1/docs/${docId}/layers/${layerName}/form/pages/*/appearances@*`,
|
|
1560
|
+
pathPrefix: "/v1/docs/{docId}/layers/{layerName}/form/pages/",
|
|
1561
|
+
resolvePathPrefix: (docId, layerName = "default") => `/v1/docs/${docId}/layers/${layerName}/form/pages/`,
|
|
1562
|
+
requirement: {
|
|
1563
|
+
kind: "single",
|
|
1564
|
+
capability: "doc.forms.read"
|
|
1565
|
+
},
|
|
1566
|
+
routeKind: "versioned-read",
|
|
1567
|
+
cdnCacheable: true
|
|
1568
|
+
},
|
|
1182
1569
|
"download-current": {
|
|
1183
1570
|
id: "download-current",
|
|
1184
1571
|
pathPattern: "/v1/docs/{docId}/layers/{layerName}/download",
|
|
@@ -1325,15 +1712,14 @@ function checkResourceAccess(resourceId, rawScope, pdfBits) {
|
|
|
1325
1712
|
* `requirement` at the origin route, but the CDN never gets a
|
|
1326
1713
|
* credential for them.
|
|
1327
1714
|
*
|
|
1328
|
-
* The URL
|
|
1329
|
-
*
|
|
1330
|
-
*
|
|
1331
|
-
*
|
|
1332
|
-
* never text or annotations.
|
|
1715
|
+
* The URL layout gives each cacheable resource type a distinct prefix,
|
|
1716
|
+
* so prefix-matching adapters get per-resource scope enforcement at the
|
|
1717
|
+
* edge — a Bunny token signed at `/v1/docs/{id}/render/pages/` can only
|
|
1718
|
+
* authorize render bytes, never text or annotations.
|
|
1333
1719
|
*/
|
|
1334
1720
|
/**
|
|
1335
|
-
* Plane map: the planes each
|
|
1336
|
-
* layer token's edge credential covers a resource's prefix iff
|
|
1721
|
+
* Plane map: the planes each doc-level shared resource depends on. A
|
|
1722
|
+
* layer token's edge credential covers a resource's prefix iff every listed
|
|
1337
1723
|
* plane is inherited (`'base'`) in the caller's scopes — the same condition
|
|
1338
1724
|
* the origin guard enforces (origin is the truth; this grant is the
|
|
1339
1725
|
* TTL-bounded optimization). Resources absent from this map (head, manifest,
|
|
@@ -1348,17 +1734,21 @@ function checkResourceAccess(resourceId, rawScope, pdfBits) {
|
|
|
1348
1734
|
* as every edge grant.
|
|
1349
1735
|
*/
|
|
1350
1736
|
const RESOURCE_PLANES = {
|
|
1351
|
-
|
|
1737
|
+
...Object.fromEntries(PAGE_PICTURES.map((picture) => [picture.resource, picture.planes])),
|
|
1352
1738
|
"page-text": ["content"],
|
|
1353
1739
|
"page-geometry": ["content"],
|
|
1354
|
-
"page-render-annotated": ["content", "annotations"],
|
|
1355
1740
|
"page-annotations": ["annotations"],
|
|
1356
1741
|
"annotations-all": ["annotations"],
|
|
1742
|
+
form: ["forms"],
|
|
1743
|
+
"page-form": ["forms"],
|
|
1744
|
+
"annotations-export": ["annotations", "layout"],
|
|
1357
1745
|
layout: ["layout"],
|
|
1358
1746
|
metadata: ["metadata"],
|
|
1747
|
+
"metadata-custom": ["metadata"],
|
|
1359
1748
|
actions: ["actions"],
|
|
1360
1749
|
attachments: ["attachments"],
|
|
1361
|
-
"attachment-files": ["attachments"]
|
|
1750
|
+
"attachment-files": ["attachments"],
|
|
1751
|
+
outline: ["outline", "layout"]
|
|
1362
1752
|
};
|
|
1363
1753
|
function cdnCoverageForScope(rawScope, pdfBits, context) {
|
|
1364
1754
|
const out = [];
|
|
@@ -1385,11 +1775,11 @@ function cdnCoverageForScope(rawScope, pdfBits, context) {
|
|
|
1385
1775
|
* effects to attach. Used by both:
|
|
1386
1776
|
* - the @cloudpdf/engine HttpClient (to actually route requests through
|
|
1387
1777
|
* the CDN edge when an /access response says it can)
|
|
1388
|
-
* - the smoke/diagnostic inspector (to
|
|
1778
|
+
* - the smoke/diagnostic inspector (to preview what the SDK would do
|
|
1389
1779
|
* for a given path, with no network)
|
|
1390
1780
|
*
|
|
1391
1781
|
* Keeping this in engine-core means cloud-side request routing and
|
|
1392
|
-
* server-side test fixtures use the
|
|
1782
|
+
* server-side test fixtures use the same algorithm. If a regression
|
|
1393
1783
|
* sneaks in, both ends break together.
|
|
1394
1784
|
*
|
|
1395
1785
|
* Selection rules
|
|
@@ -1403,7 +1793,7 @@ function cdnCoverageForScope(rawScope, pdfBits, context) {
|
|
|
1403
1793
|
* origin — that's how scope narrowing works at the edge: the
|
|
1404
1794
|
* server only emits overrides for resources the caller's scope
|
|
1405
1795
|
* grants.
|
|
1406
|
-
* 3. Find the
|
|
1796
|
+
* 3. Find the longest-matching `signedPathPolicies` entry (its
|
|
1407
1797
|
* `pathPrefix` is a prefix of the request path). Append its
|
|
1408
1798
|
* `queryParams`. No match falls back to `signedQueryParams` if
|
|
1409
1799
|
* the adapter emitted a global token.
|
|
@@ -1464,8 +1854,8 @@ function applyCdnAccess(input) {
|
|
|
1464
1854
|
* is a (longest) prefix of `path`. Returns null when no resource
|
|
1465
1855
|
* matches — admin routes, /access, /warm fall into this bucket.
|
|
1466
1856
|
*
|
|
1467
|
-
* Each cacheable resource has a
|
|
1468
|
-
*
|
|
1857
|
+
* Each cacheable resource has a distinct prefix, so longest-match is
|
|
1858
|
+
* deterministic.
|
|
1469
1859
|
*/
|
|
1470
1860
|
function resolveResourceIdForPath(path, docId, layerName) {
|
|
1471
1861
|
let best = null;
|
|
@@ -1547,33 +1937,25 @@ function unflatten(flat) {
|
|
|
1547
1937
|
/**
|
|
1548
1938
|
* Project image render options plus cache versions into the flat wire shape
|
|
1549
1939
|
* the render token encoder consumes. The output is a generic dotted-key map
|
|
1550
|
-
* (`viewport.kind`, `target.rect.
|
|
1940
|
+
* (`viewport.kind`, `target.rect.x`, …) — the schema and codec never need
|
|
1551
1941
|
* to know about specific option fields. Adding a new render option means
|
|
1552
1942
|
* extending `PageImageOptions`, the render query schemas, and
|
|
1553
1943
|
* `RenderTokenSchema.fields`; this function does not change.
|
|
1554
1944
|
*
|
|
1555
|
-
*
|
|
1556
|
-
*
|
|
1557
|
-
*
|
|
1558
|
-
*
|
|
1559
|
-
*
|
|
1560
|
-
*
|
|
1561
|
-
* `annotationVersion` iff it chose the annotated one. Contradictory states
|
|
1562
|
-
* are unrepresentable; each family's query schema enforces its own pin
|
|
1563
|
-
* grammar structurally.
|
|
1564
|
-
*
|
|
1565
|
-
* Semantic validation (viewport-kind invariants, per-family pin presence,
|
|
1566
|
-
* rect coherence) lives in `PageRenderQuerySchema` /
|
|
1567
|
-
* `PageRenderAnnotatedQuerySchema` and runs when the resulting URL is
|
|
1568
|
-
* decoded server-side. Round-tripping (flatten → encode → decode →
|
|
1569
|
-
* unflatten → schema parse) recovers the original SDK options.
|
|
1945
|
+
* What the picture draws, and whether and at which DPI it prints, is never
|
|
1946
|
+
* in the token: the caller picks the picture's path (`PAGE_RENDER_FAMILIES`,
|
|
1947
|
+
* `PAGE_PRINT_FAMILIES`) and passes that family's pins.
|
|
1948
|
+
* Each family's query schema checks its own pins when the URL is decoded
|
|
1949
|
+
* server-side. Round-tripping (flatten → encode → decode → unflatten →
|
|
1950
|
+
* schema parse) recovers the original SDK options.
|
|
1570
1951
|
*/
|
|
1571
1952
|
function renderImageOptionsToWire(options, versions) {
|
|
1572
|
-
const { includeAnnotations:
|
|
1953
|
+
const { includeAnnotations: _inThePath, includeFormFields: _alsoInThePath, usage, viewport, ...wireOptions } = options;
|
|
1954
|
+
const sized = usage === "print" || viewport === void 0 ? {} : { viewport };
|
|
1573
1955
|
return flatten({
|
|
1574
1956
|
...wireOptions,
|
|
1575
|
-
|
|
1576
|
-
...versions
|
|
1957
|
+
...sized,
|
|
1958
|
+
...versions
|
|
1577
1959
|
});
|
|
1578
1960
|
}
|
|
1579
1961
|
/**
|
|
@@ -1584,17 +1966,20 @@ function renderImageOptionsToToken(options, versions) {
|
|
|
1584
1966
|
return encodeRenderToken(renderImageOptionsToWire(options, versions));
|
|
1585
1967
|
}
|
|
1586
1968
|
/**
|
|
1587
|
-
*
|
|
1588
|
-
*
|
|
1589
|
-
*
|
|
1969
|
+
* The worker-side `PageRenderOptions` of a parsed picture request: the
|
|
1970
|
+
* render options, and what its family draws and whether it prints (stamped
|
|
1971
|
+
* by the picture's query schema). Pure shape transform; image encoding stays
|
|
1972
|
+
* out.
|
|
1590
1973
|
*/
|
|
1591
|
-
function pageRenderOptionsFromImageOptions(options
|
|
1974
|
+
function pageRenderOptionsFromImageOptions(options) {
|
|
1592
1975
|
return {
|
|
1593
1976
|
...options.target ? { target: options.target } : {},
|
|
1594
1977
|
...options.viewport ? { viewport: options.viewport } : {},
|
|
1595
1978
|
...options.rotation !== void 0 ? { rotation: options.rotation } : {},
|
|
1596
1979
|
...options.background !== void 0 ? { background: options.background } : {},
|
|
1597
|
-
includeAnnotations
|
|
1980
|
+
includeAnnotations: options.includeAnnotations ?? false,
|
|
1981
|
+
includeFormFields: options.includeFormFields ?? false,
|
|
1982
|
+
...options.usage !== void 0 ? { usage: options.usage } : {}
|
|
1598
1983
|
};
|
|
1599
1984
|
}
|
|
1600
1985
|
/**
|
|
@@ -1603,15 +1988,33 @@ function pageRenderOptionsFromImageOptions(options, includeAnnotations) {
|
|
|
1603
1988
|
* Mirrors {@link renderImageOptionsToWire}.
|
|
1604
1989
|
*/
|
|
1605
1990
|
function annotationAppearancesImageOptionsToWire(options, versions) {
|
|
1606
|
-
return
|
|
1607
|
-
...options,
|
|
1608
|
-
annotationVersion: versions.annotationVersion
|
|
1609
|
-
});
|
|
1991
|
+
return appearancesToWire(options, { annotationVersion: versions.annotationVersion });
|
|
1610
1992
|
}
|
|
1611
1993
|
/** Convenience: build the full encoded appearance render token in one call. */
|
|
1612
1994
|
function annotationAppearancesImageOptionsToToken(options, versions) {
|
|
1613
1995
|
return encodeAnnotationAppearancesRenderToken(annotationAppearancesImageOptionsToWire(options, versions));
|
|
1614
1996
|
}
|
|
1997
|
+
/** The widget twin of {@link annotationAppearancesImageOptionsToWire}. */
|
|
1998
|
+
function widgetAppearancesImageOptionsToWire(options, versions) {
|
|
1999
|
+
return appearancesToWire(options, { widgetVersion: versions.widgetVersion });
|
|
2000
|
+
}
|
|
2001
|
+
/** The widget twin of {@link annotationAppearancesImageOptionsToToken}. */
|
|
2002
|
+
function widgetAppearancesImageOptionsToToken(options, versions) {
|
|
2003
|
+
return encodeWidgetAppearancesRenderToken(widgetAppearancesImageOptionsToWire(options, versions));
|
|
2004
|
+
}
|
|
2005
|
+
/**
|
|
2006
|
+
* Appearance options and a pin, flat. `modes` only when it asks for fewer
|
|
2007
|
+
* than every mode, as one value, so every request for all of them is one URL.
|
|
2008
|
+
*/
|
|
2009
|
+
function appearancesToWire(options, pin) {
|
|
2010
|
+
const { modes, ...rest } = options;
|
|
2011
|
+
const asked = appearanceModesOf(modes);
|
|
2012
|
+
return flatten({
|
|
2013
|
+
...rest,
|
|
2014
|
+
...asked ? { modes: encodeAppearanceModes(asked) } : {},
|
|
2015
|
+
...pin
|
|
2016
|
+
});
|
|
2017
|
+
}
|
|
1615
2018
|
/**
|
|
1616
2019
|
* Strip image-encoding fields, leaving the worker-side
|
|
1617
2020
|
* `AnnotationAppearanceRenderOptions`. Pure shape transform consumed by the
|
|
@@ -1620,12 +2023,333 @@ function annotationAppearancesImageOptionsToToken(options, versions) {
|
|
|
1620
2023
|
*/
|
|
1621
2024
|
function annotationRenderOptionsFromImageOptions(options) {
|
|
1622
2025
|
return {
|
|
1623
|
-
...options.
|
|
2026
|
+
...options.viewport ? { viewport: options.viewport } : {},
|
|
1624
2027
|
...options.rotation !== void 0 ? { rotation: options.rotation } : {},
|
|
1625
2028
|
...options.modes ? { modes: options.modes } : {}
|
|
1626
2029
|
};
|
|
1627
2030
|
}
|
|
1628
2031
|
//#endregion
|
|
1629
|
-
|
|
2032
|
+
//#region src/wire/changeSchemas.ts
|
|
2033
|
+
/**
|
|
2034
|
+
* `POST /v1/docs/{docId}/layers/{layerName}/changes`: a request's changes and
|
|
2035
|
+
* their answers. A change's bytes (a stamp's drawing, an attached file, a
|
|
2036
|
+
* signature's artwork, a PDF whose pages come in) travel as multipart parts
|
|
2037
|
+
* beside the JSON (`resource:{key}`), which names them by key where the change
|
|
2038
|
+
* takes them.
|
|
2039
|
+
*/
|
|
2040
|
+
/** An op's id for its change: 1 to 255 visible ASCII characters, as `opId` always is. */
|
|
2041
|
+
const OpIdSchema = z.string().regex(/^[\x21-\x7e]{1,255}$/);
|
|
2042
|
+
const FormFieldDisplaySchema = z.enum([
|
|
2043
|
+
"visible",
|
|
2044
|
+
"hidden",
|
|
2045
|
+
"noPrint",
|
|
2046
|
+
"noView"
|
|
2047
|
+
]);
|
|
2048
|
+
/** One op of a change, as the request sends it. */
|
|
2049
|
+
const ChangeOpWireSchema = z.discriminatedUnion("type", [
|
|
2050
|
+
z.object({
|
|
2051
|
+
type: z.literal("annotations.create"),
|
|
2052
|
+
page: PageRefSchema,
|
|
2053
|
+
data: AnnotationDraftSchema,
|
|
2054
|
+
objectNumber: z.number().int().positive().optional(),
|
|
2055
|
+
resources: AnnotationResourceKeysSchema.optional()
|
|
2056
|
+
}),
|
|
2057
|
+
z.object({
|
|
2058
|
+
type: z.literal("annotations.update"),
|
|
2059
|
+
ref: AnnotationRefSchema,
|
|
2060
|
+
patch: AnnotationPatchSchema,
|
|
2061
|
+
resources: AnnotationResourceKeysSchema.optional(),
|
|
2062
|
+
expect: AnnotationPatchSchema.optional()
|
|
2063
|
+
}),
|
|
2064
|
+
z.object({
|
|
2065
|
+
type: z.literal("annotations.delete"),
|
|
2066
|
+
ref: AnnotationRefSchema,
|
|
2067
|
+
expect: AnnotationPatchSchema.optional()
|
|
2068
|
+
}),
|
|
2069
|
+
z.object({
|
|
2070
|
+
type: z.literal("annotations.reorder"),
|
|
2071
|
+
page: PageRefSchema,
|
|
2072
|
+
refs: z.array(AnnotationRefSchema).min(1),
|
|
2073
|
+
position: AnnotationPositionSchema
|
|
2074
|
+
}),
|
|
2075
|
+
z.object({
|
|
2076
|
+
type: z.literal("forms.setValue"),
|
|
2077
|
+
field: FormFieldRefSchema,
|
|
2078
|
+
value: FormFieldValueSchema,
|
|
2079
|
+
expect: FormFieldValueSchema.optional()
|
|
2080
|
+
}),
|
|
2081
|
+
z.object({
|
|
2082
|
+
type: z.literal("forms.setDisplay"),
|
|
2083
|
+
field: FormFieldRefSchema,
|
|
2084
|
+
display: FormFieldDisplaySchema
|
|
2085
|
+
}),
|
|
2086
|
+
z.object({
|
|
2087
|
+
type: z.literal("forms.setAppearanceText"),
|
|
2088
|
+
field: FormFieldRefSchema,
|
|
2089
|
+
text: z.string()
|
|
2090
|
+
}),
|
|
2091
|
+
z.object({
|
|
2092
|
+
type: z.literal("forms.reset"),
|
|
2093
|
+
fields: z.array(FormFieldRefSchema).optional()
|
|
2094
|
+
}),
|
|
2095
|
+
z.object({
|
|
2096
|
+
type: z.literal("forms.create"),
|
|
2097
|
+
draft: FormFieldDraftSchema,
|
|
2098
|
+
objectNumber: z.number().int().positive().optional(),
|
|
2099
|
+
widgetObjectNumbers: z.array(z.number().int().positive()).optional()
|
|
2100
|
+
}),
|
|
2101
|
+
z.object({
|
|
2102
|
+
type: z.literal("forms.update"),
|
|
2103
|
+
field: FormFieldRefSchema,
|
|
2104
|
+
patch: FormFieldPatchSchema,
|
|
2105
|
+
expect: FormFieldPatchSchema.optional()
|
|
2106
|
+
}),
|
|
2107
|
+
z.object({
|
|
2108
|
+
type: z.literal("forms.delete"),
|
|
2109
|
+
field: FormFieldRefSchema,
|
|
2110
|
+
expect: FormFieldPatchSchema.optional()
|
|
2111
|
+
}),
|
|
2112
|
+
z.object({
|
|
2113
|
+
type: z.literal("forms.addWidget"),
|
|
2114
|
+
field: FormFieldRefSchema,
|
|
2115
|
+
placement: WidgetPlacementSchema,
|
|
2116
|
+
objectNumber: z.number().int().positive().optional(),
|
|
2117
|
+
splitObjectNumber: z.number().int().positive().optional()
|
|
2118
|
+
}),
|
|
2119
|
+
z.object({
|
|
2120
|
+
type: z.literal("forms.removeWidget"),
|
|
2121
|
+
field: FormFieldRefSchema,
|
|
2122
|
+
widget: AnnotationRefSchema
|
|
2123
|
+
}),
|
|
2124
|
+
z.object({
|
|
2125
|
+
type: z.literal("forms.deleteWidget"),
|
|
2126
|
+
widget: AnnotationRefSchema,
|
|
2127
|
+
expect: WidgetPatchSchema.optional()
|
|
2128
|
+
}),
|
|
2129
|
+
z.object({
|
|
2130
|
+
type: z.literal("forms.reorderCalculations"),
|
|
2131
|
+
fields: z.array(FormFieldRefSchema).min(1),
|
|
2132
|
+
position: FieldPositionSchema
|
|
2133
|
+
}),
|
|
2134
|
+
z.object({
|
|
2135
|
+
type: z.literal("forms.reorderWidgets"),
|
|
2136
|
+
page: PageRefSchema,
|
|
2137
|
+
widgets: z.array(AnnotationRefSchema).min(1),
|
|
2138
|
+
position: AnnotationPositionSchema
|
|
2139
|
+
}),
|
|
2140
|
+
z.object({
|
|
2141
|
+
type: z.literal("forms.updateWidget"),
|
|
2142
|
+
widget: AnnotationRefSchema,
|
|
2143
|
+
patch: WidgetPatchSchema,
|
|
2144
|
+
expect: WidgetPatchSchema.optional()
|
|
2145
|
+
}),
|
|
2146
|
+
z.object({
|
|
2147
|
+
type: z.literal("forms.setSignatureAppearance"),
|
|
2148
|
+
field: FormFieldRefSchema,
|
|
2149
|
+
/** The one-page PDF drawn in, as the key of its multipart part. */
|
|
2150
|
+
resources: AppearanceResourceKeysSchema
|
|
2151
|
+
}),
|
|
2152
|
+
z.object({
|
|
2153
|
+
type: z.literal("metadata.update"),
|
|
2154
|
+
patch: MetadataPatchSchema,
|
|
2155
|
+
expect: MetadataPatchSchema.optional()
|
|
2156
|
+
}),
|
|
2157
|
+
z.object({
|
|
2158
|
+
type: z.literal("metadata.updateCustom"),
|
|
2159
|
+
patch: CustomMetadataPatchSchema
|
|
2160
|
+
}),
|
|
2161
|
+
z.object({
|
|
2162
|
+
type: z.literal("outline.create"),
|
|
2163
|
+
parent: OutlineItemRefSchema.nullable(),
|
|
2164
|
+
position: OutlinePositionSchema.optional(),
|
|
2165
|
+
data: OutlineItemDraftSchema,
|
|
2166
|
+
objectNumber: z.number().int().positive().optional()
|
|
2167
|
+
}),
|
|
2168
|
+
z.object({
|
|
2169
|
+
type: z.literal("outline.update"),
|
|
2170
|
+
ref: OutlineItemRefSchema,
|
|
2171
|
+
patch: OutlineItemPatchSchema,
|
|
2172
|
+
expect: OutlineItemPatchSchema.optional()
|
|
2173
|
+
}),
|
|
2174
|
+
z.object({
|
|
2175
|
+
type: z.literal("outline.move"),
|
|
2176
|
+
refs: z.array(OutlineItemRefSchema).min(1),
|
|
2177
|
+
parent: OutlineItemRefSchema.nullable(),
|
|
2178
|
+
position: OutlinePositionSchema
|
|
2179
|
+
}),
|
|
2180
|
+
z.object({
|
|
2181
|
+
type: z.literal("outline.delete"),
|
|
2182
|
+
ref: OutlineItemRefSchema,
|
|
2183
|
+
expect: OutlineItemPatchSchema.optional()
|
|
2184
|
+
}),
|
|
2185
|
+
z.object({
|
|
2186
|
+
type: z.literal("pages.rotate"),
|
|
2187
|
+
pages: z.array(PageRefSchema).min(1),
|
|
2188
|
+
rotation: PdfRotationSchema
|
|
2189
|
+
}),
|
|
2190
|
+
z.object({
|
|
2191
|
+
type: z.literal("pages.reorder"),
|
|
2192
|
+
pages: z.array(PageRefSchema).min(1),
|
|
2193
|
+
position: PagePositionSchema
|
|
2194
|
+
}),
|
|
2195
|
+
z.object({
|
|
2196
|
+
type: z.literal("pages.delete"),
|
|
2197
|
+
pages: z.array(PageRefSchema).min(1)
|
|
2198
|
+
}),
|
|
2199
|
+
z.object({
|
|
2200
|
+
type: z.literal("pages.insertBlank"),
|
|
2201
|
+
spec: PageInsertBlankSpecSchema,
|
|
2202
|
+
position: PagePositionSchema.optional(),
|
|
2203
|
+
objectNumbers: z.array(z.number().int().positive()).optional()
|
|
2204
|
+
}),
|
|
2205
|
+
z.object({
|
|
2206
|
+
type: z.literal("pages.insert"),
|
|
2207
|
+
/** The PDF whose pages come in, as the key of its multipart part. */
|
|
2208
|
+
resources: SourceResourceKeysSchema,
|
|
2209
|
+
position: PagePositionSchema.optional()
|
|
2210
|
+
}),
|
|
2211
|
+
z.object({
|
|
2212
|
+
type: z.literal("attachments.create"),
|
|
2213
|
+
file: AttachmentFileBaseSchema,
|
|
2214
|
+
/** The file's bytes, as the key of their multipart part. */
|
|
2215
|
+
resources: FileResourceKeysSchema
|
|
2216
|
+
}),
|
|
2217
|
+
z.object({
|
|
2218
|
+
type: z.literal("attachments.delete"),
|
|
2219
|
+
ref: AttachmentRefSchema
|
|
2220
|
+
})
|
|
2221
|
+
]);
|
|
2222
|
+
/**
|
|
2223
|
+
* One change of a request: its `ops`, or `undoOf`, the undo of an earlier
|
|
2224
|
+
* change. One object with exactly one of the two, so the wire has no untagged
|
|
2225
|
+
* union (the API reference labels variants by a discriminating literal).
|
|
2226
|
+
*/
|
|
2227
|
+
const ChangeEntryWireSchema = z.object({
|
|
2228
|
+
opId: OpIdSchema,
|
|
2229
|
+
ops: z.array(ChangeOpWireSchema).optional(),
|
|
2230
|
+
undoOf: OpIdSchema.optional()
|
|
2231
|
+
}).strict().refine((entry) => entry.ops === void 0 !== (entry.undoOf === void 0), { message: "exactly one of ops or undoOf" });
|
|
2232
|
+
/** What a request may hold. */
|
|
2233
|
+
const CHANGE_REQUEST_LIMITS = {
|
|
2234
|
+
/** Changes per request. */
|
|
2235
|
+
changes: 64,
|
|
2236
|
+
/** Ops per change. */
|
|
2237
|
+
ops: 512
|
|
2238
|
+
};
|
|
2239
|
+
/** A `POST …/changes` body: the changes, applied in order, each on its own. */
|
|
2240
|
+
const ChangeRequestSchema = z.object({ changes: z.array(ChangeEntryWireSchema).min(1).max(CHANGE_REQUEST_LIMITS.changes) });
|
|
2241
|
+
/** What an item can be: an op's type, or a restore (only in an undo). */
|
|
2242
|
+
const ChangeItemTypeSchema = z.enum([
|
|
2243
|
+
...ChangeOpWireSchema.options.map((op) => op.shape.type.value),
|
|
2244
|
+
"annotations.restore",
|
|
2245
|
+
"forms.restore",
|
|
2246
|
+
"forms.restoreWidget",
|
|
2247
|
+
"outline.restore",
|
|
2248
|
+
"pages.restore",
|
|
2249
|
+
"attachments.restore"
|
|
2250
|
+
]);
|
|
2251
|
+
/** What an undo left alone, by name. */
|
|
2252
|
+
const SkippedFieldsSchema = z.array(z.string()).optional();
|
|
2253
|
+
/** An item of `type`: its verb's result, after the type and what else the item adds. */
|
|
2254
|
+
function itemOf(type, result, extra = {}) {
|
|
2255
|
+
return z.object({
|
|
2256
|
+
type: z.literal(type),
|
|
2257
|
+
...extra
|
|
2258
|
+
}).merge(result);
|
|
2259
|
+
}
|
|
2260
|
+
/**
|
|
2261
|
+
* One item of a change's result: what one op did, or that an undo left it
|
|
2262
|
+
* alone (`skipped`). Every item names itself by `type`.
|
|
2263
|
+
*/
|
|
2264
|
+
const ChangeItemSchema = z.union([
|
|
2265
|
+
z.object({
|
|
2266
|
+
type: z.literal("skipped"),
|
|
2267
|
+
/** The item it would have been. */
|
|
2268
|
+
op: ChangeItemTypeSchema,
|
|
2269
|
+
meta: MutationMetaSchema
|
|
2270
|
+
}),
|
|
2271
|
+
itemOf("annotations.create", AnnotationCreateResultSchema, { page: PageRefSchema }),
|
|
2272
|
+
itemOf("annotations.update", AnnotationUpdateResultSchema, {
|
|
2273
|
+
page: PageRefSchema,
|
|
2274
|
+
skipped: SkippedFieldsSchema
|
|
2275
|
+
}),
|
|
2276
|
+
itemOf("annotations.delete", AnnotationDeleteResultSchema, { page: PageRefSchema }),
|
|
2277
|
+
itemOf("annotations.reorder", AnnotationReorderResultSchema, { page: PageRefSchema }),
|
|
2278
|
+
z.object({
|
|
2279
|
+
type: z.literal("annotations.restore"),
|
|
2280
|
+
page: PageRefSchema,
|
|
2281
|
+
annotations: z.array(AnnotationSchema),
|
|
2282
|
+
meta: AnnotationListMutationMetaSchema
|
|
2283
|
+
}),
|
|
2284
|
+
itemOf("forms.setValue", FormSetValueResultSchema),
|
|
2285
|
+
itemOf("forms.setDisplay", FormFieldUpdateResultSchema),
|
|
2286
|
+
itemOf("forms.setAppearanceText", FormFieldUpdateResultSchema),
|
|
2287
|
+
itemOf("forms.reset", FormResetResultSchema, { skipped: SkippedFieldsSchema }),
|
|
2288
|
+
itemOf("forms.create", FormFieldCreateResultSchema),
|
|
2289
|
+
itemOf("forms.update", FormFieldUpdateResultSchema, { skipped: SkippedFieldsSchema }),
|
|
2290
|
+
itemOf("forms.delete", FormFieldDeleteResultSchema),
|
|
2291
|
+
z.object({
|
|
2292
|
+
type: z.literal("forms.restore"),
|
|
2293
|
+
field: FormFieldDTOSchema,
|
|
2294
|
+
widgets: z.array(WidgetDTOSchema),
|
|
2295
|
+
meta: FormMutationMetaSchema
|
|
2296
|
+
}),
|
|
2297
|
+
itemOf("forms.setSignatureAppearance", FormFieldUpdateResultSchema),
|
|
2298
|
+
itemOf("forms.addWidget", FormWidgetLinkResultSchema),
|
|
2299
|
+
itemOf("forms.removeWidget", FormWidgetLinkResultSchema),
|
|
2300
|
+
itemOf("forms.deleteWidget", FormWidgetDeleteResultSchema),
|
|
2301
|
+
itemOf("forms.restoreWidget", FormWidgetRestoreResultSchema),
|
|
2302
|
+
itemOf("forms.reorderWidgets", FormWidgetsReorderResultSchema),
|
|
2303
|
+
itemOf("forms.reorderCalculations", FormCalculationsReorderResultSchema),
|
|
2304
|
+
itemOf("forms.updateWidget", FormWidgetUpdateResultSchema, { skipped: SkippedFieldsSchema }),
|
|
2305
|
+
itemOf("metadata.update", MetadataUpdateResultSchema, { skipped: SkippedFieldsSchema }),
|
|
2306
|
+
itemOf("metadata.updateCustom", CustomMetadataUpdateResultSchema, { skipped: SkippedFieldsSchema }),
|
|
2307
|
+
itemOf("outline.create", OutlineCreateResultSchema),
|
|
2308
|
+
itemOf("outline.update", OutlineUpdateResultSchema, { skipped: SkippedFieldsSchema }),
|
|
2309
|
+
itemOf("outline.move", OutlineMoveResultSchema),
|
|
2310
|
+
itemOf("outline.delete", OutlineDeleteResultSchema),
|
|
2311
|
+
itemOf("outline.restore", OutlineRestoreResultSchema),
|
|
2312
|
+
itemOf("pages.rotate", PageRotateResultSchema, {
|
|
2313
|
+
pages: z.array(PageRefSchema),
|
|
2314
|
+
rotation: PdfRotationSchema
|
|
2315
|
+
}),
|
|
2316
|
+
itemOf("pages.reorder", PageReorderResultSchema),
|
|
2317
|
+
itemOf("pages.delete", PageDeleteResultSchema, { pages: z.array(PageRefSchema) }),
|
|
2318
|
+
itemOf("pages.insertBlank", PageInsertResultSchema),
|
|
2319
|
+
itemOf("pages.insert", PageInsertResultSchema),
|
|
2320
|
+
itemOf("pages.restore", PageRestoreResultSchema),
|
|
2321
|
+
itemOf("attachments.create", AttachmentCreateResultSchema),
|
|
2322
|
+
itemOf("attachments.delete", AttachmentDeleteResultSchema),
|
|
2323
|
+
itemOf("attachments.restore", AttachmentRestoreResultSchema)
|
|
2324
|
+
]);
|
|
2325
|
+
/** What a change did: one item per op (per step of an undo), and its meta. */
|
|
2326
|
+
const ChangeResultSchema = z.object({
|
|
2327
|
+
items: z.array(ChangeItemSchema),
|
|
2328
|
+
meta: MutationMetaSchema
|
|
2329
|
+
});
|
|
2330
|
+
/** One change's answer: applied with its result, or refused with the error. */
|
|
2331
|
+
const ChangeAnswerSchema = z.discriminatedUnion("status", [z.object({
|
|
2332
|
+
opId: z.string(),
|
|
2333
|
+
status: z.literal("applied"),
|
|
2334
|
+
result: ChangeResultSchema
|
|
2335
|
+
}), z.object({
|
|
2336
|
+
opId: z.string(),
|
|
2337
|
+
status: z.literal("refused"),
|
|
2338
|
+
error: EngineErrorPayloadSchema
|
|
2339
|
+
})]);
|
|
2340
|
+
/** A `POST …/changes` response: one answer per change, in order. */
|
|
2341
|
+
const ChangeResponseSchema = z.object({ changes: z.array(ChangeAnswerSchema) });
|
|
2342
|
+
/**
|
|
2343
|
+
* Stable public component names for the change wire model, so an OpenAPI
|
|
2344
|
+
* projection names an op, an item and a result once, like
|
|
2345
|
+
* `AnnotationWireComponents`.
|
|
2346
|
+
*/
|
|
2347
|
+
const ChangeWireComponents = {
|
|
2348
|
+
ChangeOp: ChangeOpWireSchema,
|
|
2349
|
+
ChangeItem: ChangeItemSchema,
|
|
2350
|
+
ChangeResult: ChangeResultSchema
|
|
2351
|
+
};
|
|
2352
|
+
//#endregion
|
|
2353
|
+
export { ANNOTATION_KINDS, AccessRequestSchema, AccessResponseSchema, ActionsTokenSchema, AnnotationAppearanceBatchSchema, AnnotationAppearanceExportInputSchema, AnnotationAppearancesQuerySchema, AnnotationAppearancesRenderTokenSchema, AnnotationBorderStyleSchema, AnnotationCreateResultSchema, AnnotationDeleteResultSchema, AnnotationDraftSchema, AnnotationExportSelectionSchema, AnnotationFlattenInputSchema, AnnotationFlattenResultSchema, AnnotationImportBodySchema, AnnotationImportOptionsSchema, AnnotationImportResultSchema, AnnotationListMutationMetaSchema, AnnotationListSchema, AnnotationPatchSchema, AnnotationPositionSchema, AnnotationRefSchema, AnnotationReorderBodySchema, AnnotationReorderResultSchema, AnnotationResourceKeysSchema, AnnotationSchema, AnnotationTokenSchema, AnnotationUpdateResultSchema, AnnotationWireComponents, AnnotationsExportRequestSchema, AppearanceOutcomeSchema, AppearanceResourceKeysSchema, AttachmentCreateResultSchema, AttachmentDeleteResultSchema, AttachmentFileBaseSchema, AttachmentFileInfoSchema, AttachmentListSchema, AttachmentMutationMetaSchema, AttachmentRefSchema, AttachmentRestoreResultSchema, AttachmentSchema, AttachmentWireComponents, BaseVersionInfoSchema, BlendModeSchema, BundleLimitsSchema, ByteRangeSchema, CHANGE_REQUEST_LIMITS, CacheDeltaSchema, CachePinsSchema, CalloutLineSchema, CaretDTOSchema, CaretDraftSchema, CaretIntentSchema, CaretPatchSchema, ChangeAnalysisSchema, ChangeAnswerSchema, ChangeEntryWireSchema, ChangeItemSchema, ChangeOpWireSchema, ChangeRequestSchema, ChangeResponseSchema, ChangeResultSchema, ChangeWireComponents, CircleDTOSchema, CircleDraftSchema, CirclePatchSchema, ColorSchema, ContentTokenSchema, CustomMetadataPatchSchema, CustomMetadataSchema, CustomMetadataUpdateResultSchema, DEFAULT_LAYER_NAME, DOC_RESOURCES, DateInputSchema, DigestAlgorithmSchema, DocTokenSchema, DocumentActionsSnapshotSchema, DocumentHeadSchema, DocumentManifestSchema, DocumentMetadataSchema, DocumentOutlineSchema, DocumentProtectionSchema, DocumentSecurityStateSchema, DocumentVersionRefSchema, DocumentVersionSchema, DocumentVersionsSchema, DocumentWireComponents, DrawnBorderStyleSchema, EditSessionAccessSchema, EditSessionStatusSchema, EngineErrorPayloadSchema, FieldActionsPatchSchema, FieldLockSpecSchema, FieldPositionSchema, FieldScriptWriteSchema, FileAttachmentDTOSchema, FileAttachmentDraftSchema, FileAttachmentIconSchema, FileAttachmentPatchSchema, FileResourceKeysSchema, FileWidgetActionsPatchSchema, FormCalculationsReorderBodySchema, FormCalculationsReorderResultSchema, FormExportRequestSchema, FormExportSelectionSchema, FormFieldCreateResultSchema, FormFieldDTOSchema, FormFieldDeleteResultSchema, FormFieldDraftSchema, FormFieldOptionInputSchema, FormFieldOptionSchema, FormFieldPatchSchema, FormFieldRefSchema, FormFieldUpdateResultSchema, FormFieldValueSchema, FormImportBodySchema, FormImportOptionsSchema, FormImportResultSchema, FormKindSchema, FormMutationMetaSchema, FormRepairResultSchema, FormResetBodySchema, FormResetResultSchema, FormSetValueResultSchema, FormSnapshotSchema, FormSubmissionEntrySchema, FormSubmissionReceiptSchema, FormSubmissionRequestSchema, FormTokenSchema, FormValueEntrySchema, FormValuesImportBodySchema, FormValuesImportOptionsSchema, FormValuesImportResultSchema, FormWidgetDeleteResultSchema, FormWidgetLinkResultSchema, FormWidgetRestoreResultSchema, FormWidgetSchema, FormWidgetUpdateBodySchema, FormWidgetUpdateResultSchema, FormWidgetsReorderBodySchema, FormWidgetsReorderResultSchema, FormWireComponents, FreeTextDTOSchema, FreeTextDraftSchema, FreeTextIntentSchema, FreeTextIntentWriteSchema, FreeTextPatchSchema, HighlightDTOSchema, HighlightDraftSchema, HighlightPatchSchema, IdentitySchema, ImageResourceKeysSchema, InkDTOSchema, InkDraftSchema, InkIntentSchema, InkListSchema, InkPatchSchema, IsoDateTimeSchema, KIND_BY_SUBTYPE, LayerAnalysisQuerySchema, LayerScopesSchema, LayoutTokenSchema, LineCaptionPatchSchema, LineDTOSchema, LineDimensionCaptionSchema, LineDraftSchema, LineEndingSchema, LineEndingsSchema, LineIntentSchema, LineLeaderSchema, LinePatchSchema, LinePointsSchema, LinkDTOSchema, LinkDraftSchema, LinkPatchSchema, ManifestPageSchema, MetadataPatchSchema, MetadataTokenSchema, MetadataUpdateResultSchema, ModificationLevelSchema, MutationMetaSchema, NamedPageEntrySchema, NoteIconSchema, ObjectNumberRangeSchema, ObjectNumberReservationRequestSchema, ObjectNumberReservationResponseSchema, OpenDocumentResponseSchema, OutlineCreateResultSchema, OutlineDeleteResultSchema, OutlineItemDraftSchema, OutlineItemPatchSchema, OutlineItemRefSchema, OutlineItemSchema, OutlineMoveResultSchema, OutlineMutationMetaSchema, OutlineOrderSchema, OutlinePositionSchema, OutlineRestoreResultSchema, OutlineUpdateResultSchema, OutlineWireComponents, PAGE_PICTURES, PAGE_PRINT_FAMILIES, PAGE_PRINT_TIERS, PAGE_RENDER_FAMILIES, PageBoxSchema, PageBoxesSchema, PageDeleteResultSchema, PageExtractInputSchema, PageFlattenInputSchema, PageFlattenResultSchema, PageGeometrySnapshotSchema, PageInsertBlankSpecSchema, PageInsertResultSchema, PageLayoutSchema, PageListSnapshotSchema, PageMeasurementViewportListSchema, PageMeasurementViewportSchema, PageNameInputSchema, PageNameResultSchema, PageNetworkRenderFormatSchema, PagePointSchema, PagePositionSchema, PagePrintQuerySchemas, PageQuadSchema, PageRefSchema, PageRemoveNameInputSchema, PageRenderQuerySchemas, PageReorderResultSchema, PageRestoreResultSchema, PageRotateResultSchema, PageScaleInputSchema, PageScaleResultSchema, PageTextSnapshotSchema, PdfActionNodeSchema, PdfActionTargetRefSchema, PdfActionTreeSchema, PdfActionTypeSchema, PdfActionWireComponents, PdfActionWriteSchema, PdfAnnotationActionsSchema, PdfDestinationSchema, PdfFieldActionsSchema, PdfForeignMeasureSchema, PdfLinkTargetSchema, PdfLinkTargetWritableSchema, PdfMeasureSchema, PdfMeasureWriteSchema, PdfMeasurementSchema, PdfNumberFormatSchema, PdfPageActionsSchema, PdfPointSchema, PdfQuadSchema, PdfRectSchema, PdfRevisionSchema, PdfRotationSchema, PdfSaveModeSchema, PdfSizeSchema, PointSchema, PolygonDTOSchema, PolygonDraftSchema, PolygonIntentSchema, PolygonPatchSchema, PolylineDTOSchema, PolylineDraftSchema, PolylineIntentSchema, PolylinePatchSchema, PopupDTOSchema, PopupDraftSchema, PopupPatchSchema, RectSchema, RedactionApplyResultSchema, RedactionApplyScopeSchema, RenderTokenSchema, ResourceKeySchema, SEARCH_RESULT_FORMAT, SearchMatchSchema, SearchQuerySchema, SearchRequestSchema, SearchSliceSchema, SearchSnippetSchema, SearchTokenSchema, ShapeCaptionPatchSchema, ShapeDimensionCaptionSchema, SignatureAppearanceBodySchema, SignatureCancelResultSchema, SignatureCompleteBodySchema, SignatureCompleteResultSchema, SignatureDTOSchema, SignaturePrepareBodySchema, SignaturePreparedWireSchema, SignatureSeedValueSchema, SignatureSnapshotSchema, SourceResourceKeysSchema, SquareDTOSchema, SquareDraftSchema, SquarePatchSchema, SquigglyDTOSchema, SquigglyDraftSchema, SquigglyPatchSchema, StampDTOSchema, StampDraftSchema, StampFitSchema, StampPatchSchema, StandardFontSchema, StrikeoutDTOSchema, StrikeoutDraftSchema, StrikeoutIntentSchema, StrikeoutPatchSchema, TextAlignmentSchema, TextDTOSchema, TextDraftSchema, TextPatchSchema, ToggleFieldWidgetSchema, UnderlineDTOSchema, UnderlineDraftSchema, UnderlinePatchSchema, UnsupportedDTOSchema, UnsupportedDraftSchema, UnsupportedPatchSchema, VersionAnalysisQuerySchema, VerticalAlignmentSchema, WidgetActionsPatchSchema, WidgetAppearanceSchema, WidgetAppearancesQuerySchema, WidgetAppearancesRenderTokenSchema, WidgetBorderStyleSchema, WidgetCheckStyleSchema, WidgetDTOSchema, WidgetPatchSchema, WidgetPlacementSchema, WireAttachmentFileSchema, analysisQueryString, analyzeInputFromQuery, annotationAppearancesImageOptionsToToken, annotationAppearancesImageOptionsToWire, annotationPatchSchemaOf, annotationRenderOptionsFromImageOptions, applyCdnAccess, cdnCoverageForScope, checkResourceAccess, decodeActionsToken, decodeAnalysisToken, decodeAnnotationAppearancesRenderToken, decodeAnnotationToken, decodeAnnotationsAllToken, decodeAnnotationsExportToken, decodeAttachmentsToken, decodeContentToken, decodeDocToken, decodeDownloadToken, decodeFormExportToken, decodeFormToken, decodeLayoutToken, decodeMetadataToken, decodeOutlineToken, decodePrepared, decodeRenderToken, decodeSearchToken, decodeToken, decodeTokenText, decodeWidgetAppearancesRenderToken, encodeActionsToken, encodeAnalysisToken, encodeAnnotationAppearancesRenderToken, encodeAnnotationToken, encodeAnnotationsAllToken, encodeAnnotationsExportToken, encodeAppearanceModes, encodeAttachmentsToken, encodeContentToken, encodeDocToken, encodeDownloadToken, encodeFormExportToken, encodeFormToken, encodeLayoutToken, encodeMetadataToken, encodeOutlineToken, encodePrepared, encodeRenderToken, encodeSearchToken, encodeToken, encodeTokenText, encodeWidgetAppearancesRenderToken, flatten, fromBase64, pagePictureOf, pagePictureQuerySchema, pagePrintTierOf, pageRenderFamilyOf, pageRenderOptionsFromImageOptions, renderImageOptionsToToken, renderImageOptionsToWire, resolveResourceIdForPath, toBase64, unflatten, widgetAppearancesImageOptionsToToken, widgetAppearancesImageOptionsToWire, wirePaths, wireTemplates };
|
|
1630
2354
|
|
|
1631
2355
|
//# sourceMappingURL=wire.js.map
|