@papierapi/sdk 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +450 -0
- package/dist/chunk-JDUUPLUG.js +984 -0
- package/dist/chunk-JDUUPLUG.js.map +7 -0
- package/dist/client.d.ts +469 -0
- package/dist/errors.d.ts +20 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +343 -0
- package/dist/index.js.map +7 -0
- package/dist/internal/contracts/common.d.ts +108 -0
- package/dist/internal/contracts/dispatch.d.ts +979 -0
- package/dist/internal/contracts/fax.d.ts +49 -0
- package/dist/internal/contracts/index.d.ts +7 -0
- package/dist/internal/contracts/letter.d.ts +292 -0
- package/dist/internal/contracts/mcp.d.ts +395 -0
- package/dist/internal/contracts/platform.d.ts +424 -0
- package/dist/internal/contracts/rest.d.ts +1656 -0
- package/dist/operations.d.ts +1563 -0
- package/dist/operations.js +7 -0
- package/dist/operations.js.map +7 -0
- package/examples/get-dispatch.ts +13 -0
- package/package.json +68 -0
|
@@ -0,0 +1,984 @@
|
|
|
1
|
+
// ../contracts/src/common.ts
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
var CurrencySchema = z.literal("EUR");
|
|
4
|
+
var IsoDateSchema = z.iso.date();
|
|
5
|
+
var IsoDateTimeSchema = z.iso.datetime({ offset: true });
|
|
6
|
+
var IdempotencyKeySchema = z.string().min(8).max(200).regex(/^[A-Za-z0-9._:-]+$/, "Use only letters, digits, dot, underscore, colon, or dash");
|
|
7
|
+
function prefixedId(prefix) {
|
|
8
|
+
return z.string().regex(new RegExp(`^${prefix}_[0-9A-HJKMNP-TV-Z]{26}$`));
|
|
9
|
+
}
|
|
10
|
+
var OrganizationIdSchema = prefixedId("org");
|
|
11
|
+
var WorkspaceIdSchema = prefixedId("wsp");
|
|
12
|
+
var SenderProfileIdSchema = prefixedId("snd");
|
|
13
|
+
var DocumentIdSchema = prefixedId("doc");
|
|
14
|
+
var DraftIdSchema = prefixedId("drf");
|
|
15
|
+
var VerificationRunIdSchema = prefixedId("vrf");
|
|
16
|
+
var QuoteIdSchema = prefixedId("quo");
|
|
17
|
+
var ApprovalRequestIdSchema = prefixedId("aprq");
|
|
18
|
+
var ApprovalIdSchema = prefixedId("apr");
|
|
19
|
+
var DirectPaymentIdSchema = prefixedId("dpy");
|
|
20
|
+
var DispatchIdSchema = prefixedId("dsp");
|
|
21
|
+
var EventIdSchema = prefixedId("evt");
|
|
22
|
+
var WebhookEndpointIdSchema = prefixedId("whk");
|
|
23
|
+
var RequestIdSchema = prefixedId("req");
|
|
24
|
+
var MoneySchema = z.object({
|
|
25
|
+
amount_cents: z.int().min(0).max(1e7),
|
|
26
|
+
currency: CurrencySchema
|
|
27
|
+
}).strict();
|
|
28
|
+
var MetadataSchema = z.record(z.string().min(1).max(64), z.string().max(500)).refine((value) => Object.keys(value).length <= 20, "At most 20 metadata keys are allowed");
|
|
29
|
+
var NextActionSchema = z.object({
|
|
30
|
+
action: z.string().min(1).max(64),
|
|
31
|
+
method: z.enum(["GET", "POST", "PATCH", "DELETE"]).optional(),
|
|
32
|
+
href: z.string().max(2e3).optional()
|
|
33
|
+
}).strict();
|
|
34
|
+
var PaginationQuerySchema = z.object({
|
|
35
|
+
cursor: z.string().max(500).optional(),
|
|
36
|
+
limit: z.coerce.number().int().min(1).max(100).default(25)
|
|
37
|
+
}).strict();
|
|
38
|
+
var PaginatedMetaSchema = z.object({
|
|
39
|
+
next_cursor: z.string().nullable(),
|
|
40
|
+
has_more: z.boolean()
|
|
41
|
+
}).strict();
|
|
42
|
+
var Sha256Schema = z.string().regex(/^[a-f0-9]{64}$/);
|
|
43
|
+
var VerificationViolationSchema = z.object({
|
|
44
|
+
code: z.string().min(1).max(80),
|
|
45
|
+
field_path: z.string().max(300).optional(),
|
|
46
|
+
page: z.int().min(1).optional(),
|
|
47
|
+
rule: z.string().min(1).max(120),
|
|
48
|
+
message: z.string().min(1).max(1e3),
|
|
49
|
+
suggested_action: z.string().min(1).max(1e3)
|
|
50
|
+
}).strict();
|
|
51
|
+
var VerificationCheckSchema = z.object({
|
|
52
|
+
id: z.string().min(1).max(120),
|
|
53
|
+
version: z.string().min(1).max(40),
|
|
54
|
+
status: z.enum(["passed", "warning", "failed", "skipped"]),
|
|
55
|
+
rule: z.string().min(1).max(120),
|
|
56
|
+
evidence: z.record(z.string(), z.unknown()),
|
|
57
|
+
violations: z.array(VerificationViolationSchema),
|
|
58
|
+
duration_ms: z.int().min(0)
|
|
59
|
+
}).strict();
|
|
60
|
+
var VerificationSummarySchema = z.object({
|
|
61
|
+
status: z.enum(["passed", "warning", "failed"]),
|
|
62
|
+
checks: z.array(VerificationCheckSchema),
|
|
63
|
+
verifier_version: z.string()
|
|
64
|
+
}).strict();
|
|
65
|
+
|
|
66
|
+
// ../contracts/src/dispatch.ts
|
|
67
|
+
import { z as z5 } from "zod";
|
|
68
|
+
|
|
69
|
+
// ../contracts/src/fax.ts
|
|
70
|
+
import { z as z2 } from "zod";
|
|
71
|
+
var E164Schema = z2.string().regex(/^\+[1-9]\d{7,14}$/);
|
|
72
|
+
var FaxRecipientSchema = z2.object({
|
|
73
|
+
fax_number_e164: E164Schema,
|
|
74
|
+
name: z2.string().trim().min(1).max(100).optional(),
|
|
75
|
+
company: z2.string().trim().min(1).max(100).optional(),
|
|
76
|
+
recipient_reference: z2.string().max(100).optional()
|
|
77
|
+
}).strict();
|
|
78
|
+
var FaxOptionsSchema = z2.object({
|
|
79
|
+
max_attempts: z2.union([z2.literal(1), z2.literal(2), z2.literal(3)]).default(2),
|
|
80
|
+
scheduled_at: IsoDateTimeSchema.describe(
|
|
81
|
+
"Optional send time between five minutes and 30 days in the future."
|
|
82
|
+
).optional(),
|
|
83
|
+
purpose: z2.enum(["transactional", "contractual", "support", "other"]),
|
|
84
|
+
consent_reference: z2.string().max(200).optional()
|
|
85
|
+
}).strict();
|
|
86
|
+
var CreateFaxDraftSchema = z2.object({
|
|
87
|
+
sender_profile_id: SenderProfileIdSchema,
|
|
88
|
+
recipient: FaxRecipientSchema,
|
|
89
|
+
document_id: DocumentIdSchema,
|
|
90
|
+
cover: z2.object({
|
|
91
|
+
enabled: z2.boolean(),
|
|
92
|
+
subject: z2.string().max(300).optional(),
|
|
93
|
+
note: z2.string().max(4e3).optional()
|
|
94
|
+
}).strict().default({ enabled: false }),
|
|
95
|
+
options: FaxOptionsSchema,
|
|
96
|
+
metadata: MetadataSchema.default({})
|
|
97
|
+
}).strict();
|
|
98
|
+
|
|
99
|
+
// ../contracts/src/letter.ts
|
|
100
|
+
import { z as z3 } from "zod";
|
|
101
|
+
var AddressLineSchema = z3.string().trim().min(1).max(100);
|
|
102
|
+
var GermanStreetRecipientSchema = z3.object({
|
|
103
|
+
type: z3.literal("street").default("street"),
|
|
104
|
+
company: AddressLineSchema.optional(),
|
|
105
|
+
name: AddressLineSchema,
|
|
106
|
+
attention: AddressLineSchema.optional(),
|
|
107
|
+
additional_line: AddressLineSchema.optional(),
|
|
108
|
+
street: AddressLineSchema,
|
|
109
|
+
house_number: z3.string().trim().min(1).max(20),
|
|
110
|
+
postal_code: z3.string().regex(/^\d{5}$/),
|
|
111
|
+
city: AddressLineSchema,
|
|
112
|
+
country: z3.literal("DE")
|
|
113
|
+
}).strict();
|
|
114
|
+
var GermanPostBoxRecipientSchema = z3.object({
|
|
115
|
+
type: z3.literal("post_box"),
|
|
116
|
+
company: AddressLineSchema.optional(),
|
|
117
|
+
name: AddressLineSchema,
|
|
118
|
+
attention: AddressLineSchema.optional(),
|
|
119
|
+
post_box: z3.string().trim().regex(/^\d(?:[ ]?\d){3,9}$/),
|
|
120
|
+
postal_code: z3.string().regex(/^\d{5}$/),
|
|
121
|
+
city: AddressLineSchema,
|
|
122
|
+
country: z3.literal("DE")
|
|
123
|
+
}).strict();
|
|
124
|
+
var GermanPostalRecipientSchema = z3.discriminatedUnion("type", [
|
|
125
|
+
GermanStreetRecipientSchema,
|
|
126
|
+
GermanPostBoxRecipientSchema
|
|
127
|
+
]);
|
|
128
|
+
var ParagraphBlockSchema = z3.object({
|
|
129
|
+
type: z3.literal("paragraph"),
|
|
130
|
+
text: z3.string().min(1).max(2e4),
|
|
131
|
+
style: z3.enum(["normal", "emphasis"]).default("normal")
|
|
132
|
+
}).strict();
|
|
133
|
+
var HeadingBlockSchema = z3.object({
|
|
134
|
+
type: z3.literal("heading"),
|
|
135
|
+
text: z3.string().min(1).max(300),
|
|
136
|
+
level: z3.union([z3.literal(1), z3.literal(2)])
|
|
137
|
+
}).strict();
|
|
138
|
+
var ListBlockSchema = z3.object({
|
|
139
|
+
type: z3.literal("list"),
|
|
140
|
+
ordered: z3.boolean().default(false),
|
|
141
|
+
items: z3.array(z3.string().min(1).max(2e3)).min(1).max(100)
|
|
142
|
+
}).strict();
|
|
143
|
+
var TableBlockSchema = z3.object({
|
|
144
|
+
type: z3.literal("table"),
|
|
145
|
+
columns: z3.array(z3.string().min(1).max(120)).min(1).max(8),
|
|
146
|
+
rows: z3.array(z3.array(z3.string().max(1e3)).min(1).max(8)).min(1).max(100)
|
|
147
|
+
}).strict().superRefine((value, ctx) => {
|
|
148
|
+
value.rows.forEach((row, index) => {
|
|
149
|
+
if (row.length !== value.columns.length) {
|
|
150
|
+
ctx.addIssue({
|
|
151
|
+
code: "custom",
|
|
152
|
+
message: "Every table row must have the same number of cells as columns",
|
|
153
|
+
path: ["rows", index]
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
});
|
|
158
|
+
var SpacerBlockSchema = z3.object({
|
|
159
|
+
type: z3.literal("spacer"),
|
|
160
|
+
millimeters: z3.number().min(1).max(40)
|
|
161
|
+
}).strict();
|
|
162
|
+
var ClosingBlockSchema = z3.object({
|
|
163
|
+
type: z3.literal("closing"),
|
|
164
|
+
text: z3.string().min(1).max(2e3)
|
|
165
|
+
}).strict();
|
|
166
|
+
var SignaturePlaceholderSchema = z3.object({
|
|
167
|
+
type: z3.literal("signature_placeholder"),
|
|
168
|
+
height_mm: z3.number().min(5).max(40)
|
|
169
|
+
}).strict();
|
|
170
|
+
var LetterBlockSchema = z3.discriminatedUnion("type", [
|
|
171
|
+
ParagraphBlockSchema,
|
|
172
|
+
HeadingBlockSchema,
|
|
173
|
+
ListBlockSchema,
|
|
174
|
+
TableBlockSchema,
|
|
175
|
+
SpacerBlockSchema,
|
|
176
|
+
ClosingBlockSchema,
|
|
177
|
+
SignaturePlaceholderSchema
|
|
178
|
+
]);
|
|
179
|
+
var StructuredLetterContentSchema = z3.object({
|
|
180
|
+
locale: z3.enum(["de-DE", "en-DE"]).default("de-DE"),
|
|
181
|
+
date: IsoDateSchema,
|
|
182
|
+
reference_lines: z3.array(
|
|
183
|
+
z3.object({
|
|
184
|
+
label: z3.string().min(1).max(60),
|
|
185
|
+
value: z3.string().min(1).max(120)
|
|
186
|
+
}).strict()
|
|
187
|
+
).max(6).optional(),
|
|
188
|
+
subject: z3.string().trim().min(1).max(300),
|
|
189
|
+
salutation: z3.string().max(300).optional(),
|
|
190
|
+
blocks: z3.array(LetterBlockSchema).min(1).max(500),
|
|
191
|
+
closing: z3.string().max(300).optional(),
|
|
192
|
+
signatory: z3.string().max(300).optional()
|
|
193
|
+
}).strict();
|
|
194
|
+
var StructuredLetterSourceSchema = z3.object({
|
|
195
|
+
mode: z3.literal("structured"),
|
|
196
|
+
content: StructuredLetterContentSchema
|
|
197
|
+
}).strict();
|
|
198
|
+
var RawPdfSourceSchema = z3.object({
|
|
199
|
+
mode: z3.literal("raw_pdf"),
|
|
200
|
+
document_id: DocumentIdSchema
|
|
201
|
+
}).strict();
|
|
202
|
+
var LetterSourceSchema = z3.discriminatedUnion("mode", [
|
|
203
|
+
StructuredLetterSourceSchema,
|
|
204
|
+
RawPdfSourceSchema
|
|
205
|
+
]);
|
|
206
|
+
var LetterOptionsSchema = z3.object({
|
|
207
|
+
print: z3.enum(["grayscale", "color"]),
|
|
208
|
+
duplex: z3.boolean(),
|
|
209
|
+
service: z3.enum(["standard", "registered_insertion", "registered_signature"]),
|
|
210
|
+
criticality: z3.enum(["normal", "high"]).default("normal"),
|
|
211
|
+
layout_profile: z3.enum(["de_business_window_a", "de_business_window_b", "de_business_no_window"]).default("de_business_window_b")
|
|
212
|
+
}).strict();
|
|
213
|
+
var CreateLetterDraftSchema = z3.object({
|
|
214
|
+
sender_profile_id: SenderProfileIdSchema,
|
|
215
|
+
recipient: GermanPostalRecipientSchema,
|
|
216
|
+
source: LetterSourceSchema,
|
|
217
|
+
attachments: z3.array(z3.object({ document_id: DocumentIdSchema }).strict()).max(20).default([]),
|
|
218
|
+
options: LetterOptionsSchema,
|
|
219
|
+
metadata: MetadataSchema.default({})
|
|
220
|
+
}).strict();
|
|
221
|
+
|
|
222
|
+
// ../contracts/src/platform.ts
|
|
223
|
+
import { z as z4 } from "zod";
|
|
224
|
+
var ProfileLineSchema = z4.string().trim().min(1).max(120);
|
|
225
|
+
var SenderProfilePayloadSchema = z4.object({
|
|
226
|
+
name: ProfileLineSchema,
|
|
227
|
+
company: ProfileLineSchema.optional(),
|
|
228
|
+
street: ProfileLineSchema,
|
|
229
|
+
house_number: z4.string().trim().min(1).max(20),
|
|
230
|
+
postal_code: z4.string().regex(/^\d{5}$/),
|
|
231
|
+
city: ProfileLineSchema,
|
|
232
|
+
country: z4.literal("DE"),
|
|
233
|
+
email: z4.email().optional()
|
|
234
|
+
}).strict();
|
|
235
|
+
var SenderProfileUsageSchema = z4.enum(["saved", "one_off"]);
|
|
236
|
+
var CreateSenderProfileSchema = z4.object({
|
|
237
|
+
name: ProfileLineSchema,
|
|
238
|
+
sender: SenderProfilePayloadSchema,
|
|
239
|
+
attest_authorized: z4.literal(true),
|
|
240
|
+
usage: SenderProfileUsageSchema.default("saved"),
|
|
241
|
+
make_default: z4.boolean().default(false)
|
|
242
|
+
}).strict().superRefine((value, ctx) => {
|
|
243
|
+
if (value.usage === "one_off" && value.make_default) {
|
|
244
|
+
ctx.addIssue({
|
|
245
|
+
code: "custom",
|
|
246
|
+
message: "A one-off sender cannot become the default sender",
|
|
247
|
+
path: ["make_default"]
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
var UpdateSenderProfileSchema = z4.object({
|
|
252
|
+
name: ProfileLineSchema,
|
|
253
|
+
sender: SenderProfilePayloadSchema,
|
|
254
|
+
attest_authorized: z4.literal(true),
|
|
255
|
+
make_default: z4.boolean().default(false)
|
|
256
|
+
}).strict();
|
|
257
|
+
var SenderProfileSchema = z4.object({
|
|
258
|
+
id: SenderProfileIdSchema,
|
|
259
|
+
name: ProfileLineSchema,
|
|
260
|
+
status: z4.literal("verified"),
|
|
261
|
+
usage: SenderProfileUsageSchema,
|
|
262
|
+
is_default: z4.boolean(),
|
|
263
|
+
supersedes_sender_profile_id: SenderProfileIdSchema.nullable(),
|
|
264
|
+
verified_at: IsoDateTimeSchema,
|
|
265
|
+
archived_at: IsoDateTimeSchema.nullable(),
|
|
266
|
+
created_at: IsoDateTimeSchema,
|
|
267
|
+
updated_at: IsoDateTimeSchema
|
|
268
|
+
}).strict();
|
|
269
|
+
var SenderProfileVerificationStateSchema = z4.enum(["pending", "verified", "rejected"]);
|
|
270
|
+
var SenderProfileVerificationSchema = z4.object({
|
|
271
|
+
state: SenderProfileVerificationStateSchema,
|
|
272
|
+
verified_at: IsoDateTimeSchema.nullable(),
|
|
273
|
+
expires_at: IsoDateTimeSchema.nullable()
|
|
274
|
+
}).strict();
|
|
275
|
+
var ManagedSenderProfileSchema = SenderProfileSchema.extend({
|
|
276
|
+
verification: SenderProfileVerificationSchema,
|
|
277
|
+
is_selectable: z4.boolean()
|
|
278
|
+
}).strict();
|
|
279
|
+
var SelectableSenderProfileSchema = ManagedSenderProfileSchema.extend({
|
|
280
|
+
verification: SenderProfileVerificationSchema.extend({ state: z4.literal("verified") }).strict(),
|
|
281
|
+
is_selectable: z4.literal(true)
|
|
282
|
+
}).strict();
|
|
283
|
+
var EditableSenderProfileSchema = ManagedSenderProfileSchema.extend({
|
|
284
|
+
sender: SenderProfilePayloadSchema
|
|
285
|
+
}).strict();
|
|
286
|
+
var OnboardingAccountTypeSchema = z4.enum(["personal", "organization"]);
|
|
287
|
+
var CompleteOnboardingSchema = z4.object({
|
|
288
|
+
account_type: OnboardingAccountTypeSchema,
|
|
289
|
+
organization: z4.object({
|
|
290
|
+
name: z4.string().trim().min(1).max(160)
|
|
291
|
+
}).strict().optional(),
|
|
292
|
+
sender_profile: CreateSenderProfileSchema
|
|
293
|
+
}).strict().superRefine((value, context) => {
|
|
294
|
+
if (value.sender_profile.usage !== "saved") {
|
|
295
|
+
context.addIssue({
|
|
296
|
+
code: "custom",
|
|
297
|
+
message: "Onboarding requires a saved sender profile",
|
|
298
|
+
path: ["sender_profile", "usage"]
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
if (value.account_type === "organization" && value.organization === void 0) {
|
|
302
|
+
context.addIssue({
|
|
303
|
+
code: "custom",
|
|
304
|
+
message: "Organization details are required for an organization account",
|
|
305
|
+
path: ["organization"]
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
if (value.account_type === "personal" && value.organization !== void 0) {
|
|
309
|
+
context.addIssue({
|
|
310
|
+
code: "custom",
|
|
311
|
+
message: "Organization details must be omitted for a personal account",
|
|
312
|
+
path: ["organization"]
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
var GuestOnboardingSchema = z4.object({
|
|
317
|
+
email: z4.email().trim().max(254),
|
|
318
|
+
onboarding: CompleteOnboardingSchema
|
|
319
|
+
}).strict();
|
|
320
|
+
var CompleteOnboardingResultSchema = z4.object({
|
|
321
|
+
organization: z4.object({
|
|
322
|
+
id: OrganizationIdSchema,
|
|
323
|
+
account_type: OnboardingAccountTypeSchema,
|
|
324
|
+
name: z4.string().min(1).max(160),
|
|
325
|
+
plan: z4.enum(["developer", "growth", "enterprise"]),
|
|
326
|
+
status: z4.enum(["active", "suspended", "closed"]),
|
|
327
|
+
created_at: IsoDateTimeSchema
|
|
328
|
+
}).strict(),
|
|
329
|
+
membership: z4.object({ role: z4.literal("owner") }).strict(),
|
|
330
|
+
sender_profile: z4.object({
|
|
331
|
+
id: z4.string().regex(/^snd_[0-9A-HJKMNP-TV-Z]{26}$/),
|
|
332
|
+
name: z4.string().min(1).max(120),
|
|
333
|
+
status: z4.literal("verified"),
|
|
334
|
+
verified_at: IsoDateTimeSchema,
|
|
335
|
+
created_at: IsoDateTimeSchema
|
|
336
|
+
}).strict()
|
|
337
|
+
}).strict();
|
|
338
|
+
var ApiKeyScopeSchema = z4.enum([
|
|
339
|
+
"documents:write",
|
|
340
|
+
"drafts:write",
|
|
341
|
+
"drafts:read",
|
|
342
|
+
"approvals:write",
|
|
343
|
+
"dispatches:write",
|
|
344
|
+
"dispatches:read",
|
|
345
|
+
"wallet:read",
|
|
346
|
+
"wallet:write",
|
|
347
|
+
"webhooks:write"
|
|
348
|
+
]);
|
|
349
|
+
var CreateApiKeySchema = z4.object({
|
|
350
|
+
name: z4.string().trim().min(1).max(120),
|
|
351
|
+
scopes: z4.array(ApiKeyScopeSchema).min(1).max(20),
|
|
352
|
+
expires_at: z4.iso.datetime({ offset: true }).optional()
|
|
353
|
+
}).strict();
|
|
354
|
+
var CreateApprovalRequestSchema = z4.object({
|
|
355
|
+
quote_id: z4.string().regex(/^quo_[0-9A-HJKMNP-TV-Z]{26}$/),
|
|
356
|
+
expires_in_seconds: z4.int().min(300).max(86400).default(3600)
|
|
357
|
+
}).strict();
|
|
358
|
+
var CURRENT_TERMS_VERSION = "2026-07-18";
|
|
359
|
+
var CURRENT_WITHDRAWAL_NOTICE_VERSION = "2026-07-18";
|
|
360
|
+
var ImmediatePerformanceConsentSchema = z4.object({
|
|
361
|
+
requested_immediate_performance: z4.literal(true),
|
|
362
|
+
acknowledged_withdrawal_expiry_on_full_performance: z4.literal(true),
|
|
363
|
+
terms_version: z4.literal(CURRENT_TERMS_VERSION),
|
|
364
|
+
withdrawal_notice_version: z4.literal(CURRENT_WITHDRAWAL_NOTICE_VERSION)
|
|
365
|
+
}).strict();
|
|
366
|
+
var DecideApprovalSchema = z4.discriminatedUnion("decision", [
|
|
367
|
+
z4.object({
|
|
368
|
+
decision: z4.literal("approve"),
|
|
369
|
+
reason: z4.string().trim().max(1e3).optional(),
|
|
370
|
+
immediate_performance_consent: ImmediatePerformanceConsentSchema
|
|
371
|
+
}).strict(),
|
|
372
|
+
z4.object({
|
|
373
|
+
decision: z4.literal("reject"),
|
|
374
|
+
reason: z4.string().trim().max(1e3).optional()
|
|
375
|
+
}).strict()
|
|
376
|
+
]);
|
|
377
|
+
var ApprovalReferenceSchema = z4.object({
|
|
378
|
+
approval_request_id: ApprovalRequestIdSchema,
|
|
379
|
+
approval_id: ApprovalIdSchema.optional()
|
|
380
|
+
}).strict();
|
|
381
|
+
var CreateTopUpSessionSchema = z4.object({
|
|
382
|
+
amount_cents: z4.int().min(500).max(1e5),
|
|
383
|
+
success_url: z4.url(),
|
|
384
|
+
cancel_url: z4.url()
|
|
385
|
+
}).strict();
|
|
386
|
+
var CreateDirectPaymentSessionSchema = z4.object({
|
|
387
|
+
quote_id: QuoteIdSchema,
|
|
388
|
+
approval_id: ApprovalIdSchema
|
|
389
|
+
}).strict();
|
|
390
|
+
var DirectPaymentStatusSchema = z4.enum([
|
|
391
|
+
"pending",
|
|
392
|
+
"checkout_open",
|
|
393
|
+
"dispatch_created",
|
|
394
|
+
"expired",
|
|
395
|
+
"payment_failed",
|
|
396
|
+
"refund_required",
|
|
397
|
+
"refunded"
|
|
398
|
+
]);
|
|
399
|
+
var DirectPaymentSchema = z4.object({
|
|
400
|
+
id: DirectPaymentIdSchema,
|
|
401
|
+
status: DirectPaymentStatusSchema,
|
|
402
|
+
amount_cents: z4.int().min(1).max(1e7),
|
|
403
|
+
currency: CurrencySchema,
|
|
404
|
+
expires_at: IsoDateTimeSchema.nullable(),
|
|
405
|
+
checkout_url: z4.url({ protocol: /^https$/ }).nullable(),
|
|
406
|
+
dispatch_id: DispatchIdSchema.nullable()
|
|
407
|
+
}).strict();
|
|
408
|
+
var ApprovalPaymentOutcomeSchema = z4.discriminatedUnion("state", [
|
|
409
|
+
z4.object({
|
|
410
|
+
state: z4.literal("none"),
|
|
411
|
+
approval_id: ApprovalIdSchema
|
|
412
|
+
}).strict(),
|
|
413
|
+
z4.object({
|
|
414
|
+
state: z4.literal("wallet_dispatch"),
|
|
415
|
+
approval_id: ApprovalIdSchema,
|
|
416
|
+
dispatch_id: DispatchIdSchema,
|
|
417
|
+
dispatch_status: z4.string().trim().min(1).max(80)
|
|
418
|
+
}).strict(),
|
|
419
|
+
z4.object({
|
|
420
|
+
state: z4.literal("direct_payment"),
|
|
421
|
+
approval_id: ApprovalIdSchema,
|
|
422
|
+
direct_payment_id: DirectPaymentIdSchema,
|
|
423
|
+
direct_payment_status: DirectPaymentStatusSchema,
|
|
424
|
+
dispatch_id: DispatchIdSchema.nullable()
|
|
425
|
+
}).strict()
|
|
426
|
+
]);
|
|
427
|
+
var CreateOrganizationSchema = z4.object({
|
|
428
|
+
id: OrganizationIdSchema.optional(),
|
|
429
|
+
name: z4.string().trim().min(1).max(160)
|
|
430
|
+
}).strict();
|
|
431
|
+
var WebhookEventSchema = z4.enum([
|
|
432
|
+
"dispatch.*",
|
|
433
|
+
"dispatch.funds_reserved",
|
|
434
|
+
"dispatch.scheduled",
|
|
435
|
+
"dispatch.submitting",
|
|
436
|
+
"dispatch.provider_accepted",
|
|
437
|
+
"dispatch.producing",
|
|
438
|
+
"dispatch.sending",
|
|
439
|
+
"dispatch.handed_to_carrier",
|
|
440
|
+
"dispatch.delivered",
|
|
441
|
+
"dispatch.failed",
|
|
442
|
+
"dispatch.returned",
|
|
443
|
+
"dispatch.cancelled"
|
|
444
|
+
]);
|
|
445
|
+
var CreateWebhookEndpointSchema = z4.object({
|
|
446
|
+
url: z4.url({ protocol: /^https$/ }),
|
|
447
|
+
events: z4.array(WebhookEventSchema).min(1).max(20)
|
|
448
|
+
}).strict();
|
|
449
|
+
var McpSendDispatchSchema = z4.object({
|
|
450
|
+
draft_id: z4.string().regex(/^drf_[0-9A-HJKMNP-TV-Z]{26}$/),
|
|
451
|
+
quote_id: z4.string().regex(/^quo_[0-9A-HJKMNP-TV-Z]{26}$/),
|
|
452
|
+
approval_id: ApprovalIdSchema,
|
|
453
|
+
idempotency_key: IdempotencyKeySchema
|
|
454
|
+
}).strict();
|
|
455
|
+
|
|
456
|
+
// ../contracts/src/dispatch.ts
|
|
457
|
+
var ChannelSchema = z5.enum(["letter", "fax"]);
|
|
458
|
+
var ProviderNameSchema = z5.enum(["onlinebrief24", "pingen", "faxsuite", "mock"]);
|
|
459
|
+
var DraftStatusSchema = z5.enum([
|
|
460
|
+
"draft",
|
|
461
|
+
"validated",
|
|
462
|
+
"quoted",
|
|
463
|
+
"awaiting_approval",
|
|
464
|
+
"approved",
|
|
465
|
+
"cancelled"
|
|
466
|
+
]);
|
|
467
|
+
var DispatchStatusSchema = z5.enum([
|
|
468
|
+
"funds_reserved",
|
|
469
|
+
"submitting",
|
|
470
|
+
"provider_accepted",
|
|
471
|
+
"producing",
|
|
472
|
+
"sending",
|
|
473
|
+
"handed_to_carrier",
|
|
474
|
+
"delivered",
|
|
475
|
+
"failed",
|
|
476
|
+
"returned",
|
|
477
|
+
"cancellation_pending",
|
|
478
|
+
"cancelled"
|
|
479
|
+
]);
|
|
480
|
+
var DraftSchema = z5.object({
|
|
481
|
+
id: DraftIdSchema,
|
|
482
|
+
channel: ChannelSchema,
|
|
483
|
+
status: DraftStatusSchema,
|
|
484
|
+
content_sha256: Sha256Schema,
|
|
485
|
+
page_count: z5.int().min(1).max(100),
|
|
486
|
+
recipient_display: z5.string().min(1).max(200),
|
|
487
|
+
verification: VerificationSummarySchema,
|
|
488
|
+
preview_url: z5.url(),
|
|
489
|
+
preview_expires_at: IsoDateTimeSchema,
|
|
490
|
+
created_at: IsoDateTimeSchema,
|
|
491
|
+
updated_at: IsoDateTimeSchema
|
|
492
|
+
}).strict();
|
|
493
|
+
var ApprovalDraftBaseSchema = DraftSchema.omit({
|
|
494
|
+
channel: true,
|
|
495
|
+
recipient_display: true
|
|
496
|
+
});
|
|
497
|
+
var ApprovalLetterDraftSchema = ApprovalDraftBaseSchema.extend({
|
|
498
|
+
channel: z5.literal("letter"),
|
|
499
|
+
recipient: GermanPostalRecipientSchema,
|
|
500
|
+
sender: SenderProfilePayloadSchema,
|
|
501
|
+
options: LetterOptionsSchema
|
|
502
|
+
}).strict();
|
|
503
|
+
var ApprovalFaxDraftSchema = ApprovalDraftBaseSchema.extend({
|
|
504
|
+
channel: z5.literal("fax"),
|
|
505
|
+
recipient: FaxRecipientSchema,
|
|
506
|
+
sender: SenderProfilePayloadSchema,
|
|
507
|
+
options: FaxOptionsSchema
|
|
508
|
+
}).strict();
|
|
509
|
+
var ApprovalDraftSchema = z5.discriminatedUnion("channel", [
|
|
510
|
+
ApprovalLetterDraftSchema,
|
|
511
|
+
ApprovalFaxDraftSchema
|
|
512
|
+
]);
|
|
513
|
+
var QuoteSchema = z5.object({
|
|
514
|
+
id: QuoteIdSchema,
|
|
515
|
+
draft_id: DraftIdSchema,
|
|
516
|
+
subtotal_cents: z5.int().min(0),
|
|
517
|
+
vat_cents: z5.int().min(0),
|
|
518
|
+
total_cents: z5.int().min(0),
|
|
519
|
+
currency: CurrencySchema,
|
|
520
|
+
valid_until: IsoDateTimeSchema,
|
|
521
|
+
assumptions: z5.object({
|
|
522
|
+
channel: ChannelSchema,
|
|
523
|
+
country: z5.literal("DE"),
|
|
524
|
+
pages: z5.int().min(1),
|
|
525
|
+
service: z5.string()
|
|
526
|
+
}).strict()
|
|
527
|
+
}).strict();
|
|
528
|
+
var ApprovalQuoteSchema = QuoteSchema.extend({
|
|
529
|
+
provider: ProviderNameSchema
|
|
530
|
+
}).strict();
|
|
531
|
+
var CreateQuoteSchema = z5.object({}).strict();
|
|
532
|
+
var ApprovalRequestSchema = z5.object({
|
|
533
|
+
id: ApprovalRequestIdSchema,
|
|
534
|
+
draft_id: DraftIdSchema,
|
|
535
|
+
quote_id: QuoteIdSchema,
|
|
536
|
+
status: z5.enum(["pending", "approved", "rejected", "expired", "stale"]),
|
|
537
|
+
approval_url: z5.url(),
|
|
538
|
+
expires_at: IsoDateTimeSchema,
|
|
539
|
+
created_at: IsoDateTimeSchema
|
|
540
|
+
}).strict();
|
|
541
|
+
var ApprovalReviewSchema = z5.object({
|
|
542
|
+
approval: ApprovalRequestSchema,
|
|
543
|
+
decision: z5.discriminatedUnion("status", [
|
|
544
|
+
z5.object({
|
|
545
|
+
status: z5.literal("approved"),
|
|
546
|
+
approval_id: ApprovalIdSchema,
|
|
547
|
+
decided_at: IsoDateTimeSchema,
|
|
548
|
+
expires_at: IsoDateTimeSchema
|
|
549
|
+
}).strict(),
|
|
550
|
+
z5.object({
|
|
551
|
+
status: z5.literal("rejected"),
|
|
552
|
+
approval_id: z5.null(),
|
|
553
|
+
decided_at: IsoDateTimeSchema,
|
|
554
|
+
expires_at: z5.null()
|
|
555
|
+
}).strict()
|
|
556
|
+
]).nullable(),
|
|
557
|
+
draft: ApprovalDraftSchema,
|
|
558
|
+
quote: ApprovalQuoteSchema,
|
|
559
|
+
binding_sha256: Sha256Schema
|
|
560
|
+
}).strict();
|
|
561
|
+
var ApprovalDecisionSchema = z5.object({
|
|
562
|
+
decision: z5.enum(["approve", "reject"]),
|
|
563
|
+
reason: z5.string().max(1e3).optional()
|
|
564
|
+
}).strict();
|
|
565
|
+
var ApprovalSchema = z5.object({
|
|
566
|
+
id: ApprovalIdSchema,
|
|
567
|
+
request_id: ApprovalRequestIdSchema,
|
|
568
|
+
status: z5.enum(["approved", "rejected"]),
|
|
569
|
+
actor_type: z5.enum(["human", "policy"]),
|
|
570
|
+
decided_at: IsoDateTimeSchema
|
|
571
|
+
}).strict();
|
|
572
|
+
var CreateDispatchSchema = z5.object({
|
|
573
|
+
quote_id: QuoteIdSchema,
|
|
574
|
+
approval_id: ApprovalIdSchema
|
|
575
|
+
}).strict();
|
|
576
|
+
var DispatchSchema = z5.object({
|
|
577
|
+
id: DispatchIdSchema,
|
|
578
|
+
draft_id: DraftIdSchema,
|
|
579
|
+
status: DispatchStatusSchema,
|
|
580
|
+
channel: ChannelSchema,
|
|
581
|
+
amount_cents: z5.int().min(1),
|
|
582
|
+
currency: CurrencySchema,
|
|
583
|
+
scheduled_for: IsoDateTimeSchema.nullable(),
|
|
584
|
+
needs_review: z5.boolean(),
|
|
585
|
+
terminal_reason: z5.string().max(500).nullable(),
|
|
586
|
+
created_at: IsoDateTimeSchema,
|
|
587
|
+
updated_at: IsoDateTimeSchema
|
|
588
|
+
}).strict();
|
|
589
|
+
var DispatchSummaryBaseSchema = z5.object({
|
|
590
|
+
subject: z5.string().trim().min(1).max(300).nullable()
|
|
591
|
+
});
|
|
592
|
+
var DispatchLetterSummarySchema = DispatchSummaryBaseSchema.extend({
|
|
593
|
+
channel: z5.literal("letter"),
|
|
594
|
+
recipient: z5.object({
|
|
595
|
+
label: z5.string().trim().min(1).max(200),
|
|
596
|
+
city: z5.string().trim().min(1).max(100)
|
|
597
|
+
}).strict()
|
|
598
|
+
}).strict();
|
|
599
|
+
var DispatchFaxSummarySchema = DispatchSummaryBaseSchema.extend({
|
|
600
|
+
channel: z5.literal("fax"),
|
|
601
|
+
recipient: z5.object({
|
|
602
|
+
label: z5.string().trim().min(1).max(200).nullable(),
|
|
603
|
+
fax_number_e164: FaxRecipientSchema.shape.fax_number_e164
|
|
604
|
+
}).strict()
|
|
605
|
+
}).strict();
|
|
606
|
+
var DispatchSummarySchema = z5.discriminatedUnion("channel", [
|
|
607
|
+
DispatchLetterSummarySchema,
|
|
608
|
+
DispatchFaxSummarySchema
|
|
609
|
+
]);
|
|
610
|
+
var DispatchEventSchema = z5.object({
|
|
611
|
+
id: EventIdSchema,
|
|
612
|
+
dispatch_id: DispatchIdSchema,
|
|
613
|
+
sequence: z5.int().min(1),
|
|
614
|
+
type: z5.string().min(1).max(100),
|
|
615
|
+
status: DispatchStatusSchema,
|
|
616
|
+
created_at: IsoDateTimeSchema,
|
|
617
|
+
evidence: z5.record(z5.string(), z5.unknown()),
|
|
618
|
+
event_hash: Sha256Schema,
|
|
619
|
+
previous_hash: Sha256Schema.nullable()
|
|
620
|
+
}).strict();
|
|
621
|
+
var ProofBundleSchema = z5.object({
|
|
622
|
+
schema_version: z5.literal("2.0"),
|
|
623
|
+
dispatch_id: DispatchIdSchema,
|
|
624
|
+
organization_id: OrganizationIdSchema,
|
|
625
|
+
channel: ChannelSchema,
|
|
626
|
+
content: z5.object({
|
|
627
|
+
document_id: DocumentIdSchema,
|
|
628
|
+
sha256: Sha256Schema
|
|
629
|
+
}).strict(),
|
|
630
|
+
recipient: z5.object({
|
|
631
|
+
fingerprint: Sha256Schema,
|
|
632
|
+
display: z5.string().min(1).max(200)
|
|
633
|
+
}).strict(),
|
|
634
|
+
verification: z5.object({
|
|
635
|
+
id: VerificationRunIdSchema,
|
|
636
|
+
verifier_version: z5.string().min(1).max(200),
|
|
637
|
+
status: z5.enum(["passed", "warning"]),
|
|
638
|
+
content_sha256: Sha256Schema
|
|
639
|
+
}).strict(),
|
|
640
|
+
quote: z5.object({
|
|
641
|
+
id: QuoteIdSchema,
|
|
642
|
+
subtotal_cents: z5.int().min(0),
|
|
643
|
+
vat_cents: z5.int().min(0),
|
|
644
|
+
total_cents: z5.int().min(0),
|
|
645
|
+
currency: CurrencySchema,
|
|
646
|
+
catalog_version: z5.string().min(1).max(200)
|
|
647
|
+
}).strict(),
|
|
648
|
+
approval: z5.object({
|
|
649
|
+
id: ApprovalIdSchema,
|
|
650
|
+
actor_type: z5.enum(["human", "policy"]),
|
|
651
|
+
actor_id: z5.string().min(1).max(500),
|
|
652
|
+
decided_at: IsoDateTimeSchema,
|
|
653
|
+
binding_hash: Sha256Schema
|
|
654
|
+
}).strict(),
|
|
655
|
+
provider: z5.object({
|
|
656
|
+
name: ProviderNameSchema,
|
|
657
|
+
acceptance_reference_hash: Sha256Schema,
|
|
658
|
+
accepted_at: IsoDateTimeSchema
|
|
659
|
+
}).strict().nullable(),
|
|
660
|
+
status: z5.object({
|
|
661
|
+
normalized: DispatchStatusSchema,
|
|
662
|
+
observed_at: IsoDateTimeSchema
|
|
663
|
+
}).strict(),
|
|
664
|
+
event_chain: z5.object({
|
|
665
|
+
valid: z5.boolean(),
|
|
666
|
+
checked_events: z5.int().min(0),
|
|
667
|
+
head: Sha256Schema.nullable()
|
|
668
|
+
}).strict(),
|
|
669
|
+
generated_at: IsoDateTimeSchema
|
|
670
|
+
}).strict();
|
|
671
|
+
var ApiEnvelopeSchema = (schema) => z5.object({
|
|
672
|
+
request_id: RequestIdSchema,
|
|
673
|
+
data: schema,
|
|
674
|
+
next_actions: z5.array(NextActionSchema).default([])
|
|
675
|
+
}).strict();
|
|
676
|
+
var ErrorCodeSchema = z5.enum([
|
|
677
|
+
"SCHEMA_INVALID",
|
|
678
|
+
"UNAUTHENTICATED",
|
|
679
|
+
"FORBIDDEN",
|
|
680
|
+
"NOT_FOUND",
|
|
681
|
+
"ADDRESS_INVALID",
|
|
682
|
+
"FAX_NUMBER_INVALID",
|
|
683
|
+
"DOCUMENT_UNREADABLE",
|
|
684
|
+
"PDF_LAYOUT_INVALID",
|
|
685
|
+
"UNSUPPORTED_OPTION",
|
|
686
|
+
"VERIFICATION_FAILED",
|
|
687
|
+
"QUOTE_EXPIRED",
|
|
688
|
+
"APPROVAL_REQUIRED",
|
|
689
|
+
"APPROVAL_STALE",
|
|
690
|
+
"BUDGET_EXCEEDED",
|
|
691
|
+
"INSUFFICIENT_FUNDS",
|
|
692
|
+
"IDEMPOTENCY_REQUIRED",
|
|
693
|
+
"IDEMPOTENCY_CONFLICT",
|
|
694
|
+
"DISPATCH_NOT_CANCELLABLE",
|
|
695
|
+
"PROVIDER_UNAVAILABLE",
|
|
696
|
+
"PROVIDER_REJECTED",
|
|
697
|
+
"RATE_LIMITED",
|
|
698
|
+
"INTERNAL_ERROR"
|
|
699
|
+
]);
|
|
700
|
+
var ApiErrorSchema = z5.object({
|
|
701
|
+
request_id: RequestIdSchema,
|
|
702
|
+
error: z5.object({
|
|
703
|
+
code: ErrorCodeSchema,
|
|
704
|
+
message: z5.string(),
|
|
705
|
+
retryable: z5.boolean(),
|
|
706
|
+
field_path: z5.string().optional(),
|
|
707
|
+
suggested_action: z5.string(),
|
|
708
|
+
details: z5.record(z5.string(), z5.unknown()).optional()
|
|
709
|
+
}).strict()
|
|
710
|
+
}).strict();
|
|
711
|
+
|
|
712
|
+
// ../contracts/src/mcp.ts
|
|
713
|
+
import { z as z6 } from "zod";
|
|
714
|
+
var McpEmptyInputSchema = z6.object({}).strict();
|
|
715
|
+
var McpDraftReferenceSchema = z6.object({ draft_id: DraftIdSchema }).strict();
|
|
716
|
+
var McpDispatchReferenceSchema = z6.object({ dispatch_id: DispatchIdSchema }).strict();
|
|
717
|
+
var McpRequestDispatchApprovalSchema = z6.object({
|
|
718
|
+
draft_id: DraftIdSchema,
|
|
719
|
+
...CreateApprovalRequestSchema.shape
|
|
720
|
+
}).strict();
|
|
721
|
+
var McpListDispatchesInputSchema = z6.object({ limit: z6.number().int().min(1).max(100).default(25) }).strict();
|
|
722
|
+
var WalletBalanceSchema = z6.object({
|
|
723
|
+
available_cents: z6.int(),
|
|
724
|
+
reserved_cents: z6.int().min(0),
|
|
725
|
+
total_cents: z6.int(),
|
|
726
|
+
currency: z6.literal("EUR")
|
|
727
|
+
}).strict();
|
|
728
|
+
var SenderProfileSummarySchema = SelectableSenderProfileSchema;
|
|
729
|
+
var McpSenderProfilesResultSchema = z6.object({ sender_profiles: z6.array(SenderProfileSummarySchema) }).strict();
|
|
730
|
+
var McpDispatchDetailsSchema = z6.object({
|
|
731
|
+
dispatch: DispatchSchema,
|
|
732
|
+
events: z6.array(DispatchEventSchema)
|
|
733
|
+
}).strict();
|
|
734
|
+
var McpDispatchListSchema = z6.object({ dispatches: z6.array(DispatchSchema) }).strict();
|
|
735
|
+
var McpPrepareLetterForReviewSchema = CreateLetterDraftSchema.extend({
|
|
736
|
+
approval_expires_in_seconds: z6.int().min(300).max(86400).default(3600)
|
|
737
|
+
}).strict();
|
|
738
|
+
var McpPrepareFaxForReviewSchema = CreateFaxDraftSchema.extend({
|
|
739
|
+
approval_expires_in_seconds: z6.int().min(300).max(86400).default(3600)
|
|
740
|
+
}).strict();
|
|
741
|
+
var McpCoreToolNameSchema = z6.enum([
|
|
742
|
+
"list_sender_profiles",
|
|
743
|
+
"prepare_letter_for_review",
|
|
744
|
+
"prepare_fax_for_review",
|
|
745
|
+
"get_dispatch",
|
|
746
|
+
"get_dispatch_proof"
|
|
747
|
+
]);
|
|
748
|
+
var McpReviewPackageSchema = z6.object({
|
|
749
|
+
draft: DraftSchema,
|
|
750
|
+
quote: QuoteSchema,
|
|
751
|
+
approval: ApprovalRequestSchema,
|
|
752
|
+
human_action_required: z6.literal(true),
|
|
753
|
+
next_action: z6.object({
|
|
754
|
+
type: z6.literal("open_approval_url"),
|
|
755
|
+
url: z6.url(),
|
|
756
|
+
description: z6.string().min(1).max(500)
|
|
757
|
+
}).strict()
|
|
758
|
+
}).strict();
|
|
759
|
+
var McpWorkflowGuideSchema = z6.object({
|
|
760
|
+
version: z6.literal("1.0"),
|
|
761
|
+
core_tools: z6.array(McpCoreToolNameSchema).min(4).max(5),
|
|
762
|
+
recommended_letter_tool: z6.literal("prepare_letter_for_review"),
|
|
763
|
+
recommended_fax_tool: z6.literal("prepare_fax_for_review").optional(),
|
|
764
|
+
recommended_tracking_tool: z6.literal("get_dispatch"),
|
|
765
|
+
recommended_proof_tool: z6.literal("get_dispatch_proof"),
|
|
766
|
+
workflow: z6.array(z6.string().min(1)),
|
|
767
|
+
safety_invariants: z6.array(z6.string().min(1)),
|
|
768
|
+
browser_fallback_url: z6.url()
|
|
769
|
+
}).strict();
|
|
770
|
+
|
|
771
|
+
// ../contracts/src/rest.ts
|
|
772
|
+
import { z as z7 } from "zod";
|
|
773
|
+
var UploadedDocumentResultSchema = z7.object({
|
|
774
|
+
document: z7.object({
|
|
775
|
+
id: DocumentIdSchema,
|
|
776
|
+
sha256: Sha256Schema,
|
|
777
|
+
byte_size: z7.int().min(1).max(20 * 1024 * 1024),
|
|
778
|
+
page_count: z7.int().min(1).max(100),
|
|
779
|
+
created_at: IsoDateTimeSchema
|
|
780
|
+
}).strict(),
|
|
781
|
+
verification: VerificationSummarySchema
|
|
782
|
+
}).strict();
|
|
783
|
+
var DispatchListResultSchema = z7.array(DispatchSchema).max(100);
|
|
784
|
+
var DispatchEventListResultSchema = z7.array(DispatchEventSchema);
|
|
785
|
+
function defineRestOperation(operation) {
|
|
786
|
+
return {
|
|
787
|
+
...operation,
|
|
788
|
+
responseSchema: ApiEnvelopeSchema(operation.dataSchema)
|
|
789
|
+
};
|
|
790
|
+
}
|
|
791
|
+
var noPathParameters = {};
|
|
792
|
+
var noQueryParameters = {};
|
|
793
|
+
var noRequest = { kind: "none" };
|
|
794
|
+
var PapierApiRestOperations = {
|
|
795
|
+
uploadDocument: defineRestOperation({
|
|
796
|
+
operationId: "uploadDocument",
|
|
797
|
+
method: "POST",
|
|
798
|
+
path: "/v1/documents",
|
|
799
|
+
request: { kind: "pdf" },
|
|
800
|
+
pathParameters: noPathParameters,
|
|
801
|
+
queryParameters: noQueryParameters,
|
|
802
|
+
dataSchema: UploadedDocumentResultSchema,
|
|
803
|
+
requiresIdempotencyKey: false,
|
|
804
|
+
safeToRetry: false
|
|
805
|
+
}),
|
|
806
|
+
createLetterDraft: defineRestOperation({
|
|
807
|
+
operationId: "createLetterDraft",
|
|
808
|
+
method: "POST",
|
|
809
|
+
path: "/v1/drafts/letters",
|
|
810
|
+
request: { kind: "json", schema: CreateLetterDraftSchema },
|
|
811
|
+
pathParameters: noPathParameters,
|
|
812
|
+
queryParameters: noQueryParameters,
|
|
813
|
+
dataSchema: DraftSchema,
|
|
814
|
+
requiresIdempotencyKey: false,
|
|
815
|
+
safeToRetry: false
|
|
816
|
+
}),
|
|
817
|
+
createFaxDraft: defineRestOperation({
|
|
818
|
+
operationId: "createFaxDraft",
|
|
819
|
+
method: "POST",
|
|
820
|
+
path: "/v1/drafts/faxes",
|
|
821
|
+
request: { kind: "json", schema: CreateFaxDraftSchema },
|
|
822
|
+
pathParameters: noPathParameters,
|
|
823
|
+
queryParameters: noQueryParameters,
|
|
824
|
+
dataSchema: DraftSchema,
|
|
825
|
+
requiresIdempotencyKey: false,
|
|
826
|
+
safeToRetry: false
|
|
827
|
+
}),
|
|
828
|
+
getDraft: defineRestOperation({
|
|
829
|
+
operationId: "getDraft",
|
|
830
|
+
method: "GET",
|
|
831
|
+
path: "/v1/drafts/{draftId}",
|
|
832
|
+
request: noRequest,
|
|
833
|
+
pathParameters: { draftId: DraftIdSchema },
|
|
834
|
+
queryParameters: noQueryParameters,
|
|
835
|
+
dataSchema: DraftSchema,
|
|
836
|
+
requiresIdempotencyKey: false,
|
|
837
|
+
safeToRetry: true
|
|
838
|
+
}),
|
|
839
|
+
quoteDraft: defineRestOperation({
|
|
840
|
+
operationId: "quoteDraft",
|
|
841
|
+
method: "POST",
|
|
842
|
+
path: "/v1/drafts/{draftId}/quote",
|
|
843
|
+
request: noRequest,
|
|
844
|
+
pathParameters: { draftId: DraftIdSchema },
|
|
845
|
+
queryParameters: noQueryParameters,
|
|
846
|
+
dataSchema: QuoteSchema,
|
|
847
|
+
requiresIdempotencyKey: false,
|
|
848
|
+
safeToRetry: false
|
|
849
|
+
}),
|
|
850
|
+
requestApproval: defineRestOperation({
|
|
851
|
+
operationId: "requestApproval",
|
|
852
|
+
method: "POST",
|
|
853
|
+
path: "/v1/drafts/{draftId}/approval-requests",
|
|
854
|
+
request: { kind: "json", schema: CreateApprovalRequestSchema },
|
|
855
|
+
pathParameters: { draftId: DraftIdSchema },
|
|
856
|
+
queryParameters: noQueryParameters,
|
|
857
|
+
dataSchema: ApprovalRequestSchema,
|
|
858
|
+
requiresIdempotencyKey: false,
|
|
859
|
+
safeToRetry: false
|
|
860
|
+
}),
|
|
861
|
+
createDispatch: defineRestOperation({
|
|
862
|
+
operationId: "createDispatch",
|
|
863
|
+
method: "POST",
|
|
864
|
+
path: "/v1/drafts/{draftId}/dispatches",
|
|
865
|
+
request: { kind: "json", schema: CreateDispatchSchema },
|
|
866
|
+
pathParameters: { draftId: DraftIdSchema },
|
|
867
|
+
queryParameters: noQueryParameters,
|
|
868
|
+
dataSchema: DispatchSchema,
|
|
869
|
+
requiresIdempotencyKey: true,
|
|
870
|
+
safeToRetry: true
|
|
871
|
+
}),
|
|
872
|
+
createDirectPaymentSession: defineRestOperation({
|
|
873
|
+
operationId: "createDirectPaymentSession",
|
|
874
|
+
method: "POST",
|
|
875
|
+
path: "/v1/drafts/{draftId}/direct-payment-sessions",
|
|
876
|
+
request: { kind: "json", schema: CreateDirectPaymentSessionSchema },
|
|
877
|
+
pathParameters: { draftId: DraftIdSchema },
|
|
878
|
+
queryParameters: noQueryParameters,
|
|
879
|
+
dataSchema: DirectPaymentSchema,
|
|
880
|
+
requiresIdempotencyKey: true,
|
|
881
|
+
safeToRetry: true
|
|
882
|
+
}),
|
|
883
|
+
getDirectPayment: defineRestOperation({
|
|
884
|
+
operationId: "getDirectPayment",
|
|
885
|
+
method: "GET",
|
|
886
|
+
path: "/v1/direct-payments/{directPaymentId}",
|
|
887
|
+
request: noRequest,
|
|
888
|
+
pathParameters: { directPaymentId: DirectPaymentIdSchema },
|
|
889
|
+
queryParameters: noQueryParameters,
|
|
890
|
+
dataSchema: DirectPaymentSchema,
|
|
891
|
+
requiresIdempotencyKey: false,
|
|
892
|
+
safeToRetry: true
|
|
893
|
+
}),
|
|
894
|
+
listDispatches: defineRestOperation({
|
|
895
|
+
operationId: "listDispatches",
|
|
896
|
+
method: "GET",
|
|
897
|
+
path: "/v1/dispatches",
|
|
898
|
+
request: noRequest,
|
|
899
|
+
pathParameters: noPathParameters,
|
|
900
|
+
queryParameters: { limit: z7.int().min(1).max(100).default(25) },
|
|
901
|
+
dataSchema: DispatchListResultSchema,
|
|
902
|
+
requiresIdempotencyKey: false,
|
|
903
|
+
safeToRetry: true
|
|
904
|
+
}),
|
|
905
|
+
getDispatch: defineRestOperation({
|
|
906
|
+
operationId: "getDispatch",
|
|
907
|
+
method: "GET",
|
|
908
|
+
path: "/v1/dispatches/{dispatchId}",
|
|
909
|
+
request: noRequest,
|
|
910
|
+
pathParameters: { dispatchId: DispatchIdSchema },
|
|
911
|
+
queryParameters: noQueryParameters,
|
|
912
|
+
dataSchema: DispatchSchema,
|
|
913
|
+
requiresIdempotencyKey: false,
|
|
914
|
+
safeToRetry: true
|
|
915
|
+
}),
|
|
916
|
+
getDispatchSummary: defineRestOperation({
|
|
917
|
+
operationId: "getDispatchSummary",
|
|
918
|
+
method: "GET",
|
|
919
|
+
path: "/v1/dispatches/{dispatchId}/summary",
|
|
920
|
+
request: noRequest,
|
|
921
|
+
pathParameters: { dispatchId: DispatchIdSchema },
|
|
922
|
+
queryParameters: noQueryParameters,
|
|
923
|
+
dataSchema: DispatchSummarySchema,
|
|
924
|
+
requiresIdempotencyKey: false,
|
|
925
|
+
safeToRetry: true
|
|
926
|
+
}),
|
|
927
|
+
getDispatchEvents: defineRestOperation({
|
|
928
|
+
operationId: "getDispatchEvents",
|
|
929
|
+
method: "GET",
|
|
930
|
+
path: "/v1/dispatches/{dispatchId}/events",
|
|
931
|
+
request: noRequest,
|
|
932
|
+
pathParameters: { dispatchId: DispatchIdSchema },
|
|
933
|
+
queryParameters: noQueryParameters,
|
|
934
|
+
dataSchema: DispatchEventListResultSchema,
|
|
935
|
+
requiresIdempotencyKey: false,
|
|
936
|
+
safeToRetry: true
|
|
937
|
+
}),
|
|
938
|
+
getDispatchProof: defineRestOperation({
|
|
939
|
+
operationId: "getDispatchProof",
|
|
940
|
+
method: "GET",
|
|
941
|
+
path: "/v1/dispatches/{dispatchId}/proof",
|
|
942
|
+
request: noRequest,
|
|
943
|
+
pathParameters: { dispatchId: DispatchIdSchema },
|
|
944
|
+
queryParameters: noQueryParameters,
|
|
945
|
+
dataSchema: ProofBundleSchema,
|
|
946
|
+
requiresIdempotencyKey: false,
|
|
947
|
+
safeToRetry: true
|
|
948
|
+
}),
|
|
949
|
+
cancelDispatch: defineRestOperation({
|
|
950
|
+
operationId: "cancelDispatch",
|
|
951
|
+
method: "POST",
|
|
952
|
+
path: "/v1/dispatches/{dispatchId}/cancel",
|
|
953
|
+
request: noRequest,
|
|
954
|
+
pathParameters: { dispatchId: DispatchIdSchema },
|
|
955
|
+
queryParameters: noQueryParameters,
|
|
956
|
+
dataSchema: DispatchSchema,
|
|
957
|
+
requiresIdempotencyKey: false,
|
|
958
|
+
safeToRetry: false
|
|
959
|
+
}),
|
|
960
|
+
getWallet: defineRestOperation({
|
|
961
|
+
operationId: "getWallet",
|
|
962
|
+
method: "GET",
|
|
963
|
+
path: "/v1/wallet",
|
|
964
|
+
request: noRequest,
|
|
965
|
+
pathParameters: noPathParameters,
|
|
966
|
+
queryParameters: noQueryParameters,
|
|
967
|
+
dataSchema: WalletBalanceSchema,
|
|
968
|
+
requiresIdempotencyKey: false,
|
|
969
|
+
safeToRetry: true
|
|
970
|
+
})
|
|
971
|
+
};
|
|
972
|
+
|
|
973
|
+
// src/operations.ts
|
|
974
|
+
var papierApiOperations = PapierApiRestOperations;
|
|
975
|
+
|
|
976
|
+
export {
|
|
977
|
+
IdempotencyKeySchema,
|
|
978
|
+
DraftIdSchema,
|
|
979
|
+
DirectPaymentIdSchema,
|
|
980
|
+
DispatchIdSchema,
|
|
981
|
+
ApiErrorSchema,
|
|
982
|
+
papierApiOperations
|
|
983
|
+
};
|
|
984
|
+
//# sourceMappingURL=chunk-JDUUPLUG.js.map
|