@hermeticacomms/sdk-node 0.0.0-stage → 0.4.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 +9 -0
- package/README.md +12 -2
- package/dist/contracts/analytics.d.ts +405 -0
- package/dist/contracts/analytics.js +77 -0
- package/dist/contracts/auth.d.ts +363 -0
- package/dist/contracts/auth.js +130 -0
- package/dist/contracts/billing.d.ts +143 -0
- package/dist/contracts/billing.js +32 -0
- package/dist/contracts/campaigns.d.ts +915 -0
- package/dist/contracts/campaigns.js +276 -0
- package/dist/contracts/common.d.ts +57 -0
- package/dist/contracts/common.js +35 -0
- package/dist/contracts/connectors.d.ts +179 -0
- package/dist/contracts/connectors.js +46 -0
- package/dist/contracts/consent.d.ts +628 -0
- package/dist/contracts/consent.js +194 -0
- package/dist/contracts/content-blocks.d.ts +165 -0
- package/dist/contracts/content-blocks.js +62 -0
- package/dist/contracts/content-library.d.ts +347 -0
- package/dist/contracts/content-library.js +52 -0
- package/dist/contracts/content.d.ts +955 -0
- package/dist/contracts/content.js +194 -0
- package/dist/contracts/delivery.d.ts +602 -0
- package/dist/contracts/delivery.js +220 -0
- package/dist/contracts/events.d.ts +514 -0
- package/dist/contracts/events.js +180 -0
- package/dist/contracts/experiments.d.ts +378 -0
- package/dist/contracts/experiments.js +140 -0
- package/dist/contracts/identity.d.ts +761 -0
- package/dist/contracts/identity.js +226 -0
- package/dist/contracts/index.d.ts +15 -0
- package/dist/contracts/index.js +15 -0
- package/dist/contracts/integrations.d.ts +445 -0
- package/dist/contracts/integrations.js +139 -0
- package/dist/contracts/leads.d.ts +733 -0
- package/dist/contracts/leads.js +125 -0
- package/dist/contracts/metrics.d.ts +465 -0
- package/dist/contracts/metrics.js +96 -0
- package/dist/contracts/outbound.d.ts +15535 -0
- package/dist/contracts/outbound.js +432 -0
- package/dist/contracts/pickers.d.ts +12 -0
- package/dist/contracts/pickers.js +20 -0
- package/dist/contracts/platform-admin.d.ts +244 -0
- package/dist/contracts/platform-admin.js +98 -0
- package/dist/contracts/postcards.d.ts +79 -0
- package/dist/contracts/postcards.js +29 -0
- package/dist/contracts/push.d.ts +530 -0
- package/dist/contracts/push.js +102 -0
- package/dist/contracts/rcs.d.ts +39 -0
- package/dist/contracts/rcs.js +19 -0
- package/dist/contracts/segments.d.ts +3187 -0
- package/dist/contracts/segments.js +421 -0
- package/dist/contracts/workflow-nodes.d.ts +2130 -0
- package/dist/contracts/workflow-nodes.js +346 -0
- package/dist/contracts/workflows.d.ts +46811 -0
- package/dist/contracts/workflows.js +350 -0
- package/dist/contracts/x10-platform.d.ts +2603 -0
- package/dist/contracts/x10-platform.js +129 -0
- package/dist/http.d.ts +30 -0
- package/dist/http.js +65 -0
- package/dist/index.d.ts +11631 -0
- package/dist/index.js +63 -0
- package/dist/platform.d.ts +163 -0
- package/dist/platform.js +40 -0
- package/dist/resources.d.ts +1338 -0
- package/dist/resources.js +56 -0
- package/dist/signature.d.ts +5 -0
- package/dist/signature.js +19 -0
- package/dist/x10.d.ts +1608 -0
- package/dist/x10.js +66 -0
- package/dist/z10.d.ts +256 -0
- package/dist/z10.js +46 -0
- package/package.json +40 -4
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const WebhookTopicDto: z.ZodObject<{
|
|
3
|
+
topic: z.ZodString;
|
|
4
|
+
category: z.ZodString;
|
|
5
|
+
description: z.ZodString;
|
|
6
|
+
schema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
7
|
+
example: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
export declare const WebhookTopicsResult: z.ZodObject<{
|
|
10
|
+
items: z.ZodArray<z.ZodObject<{
|
|
11
|
+
topic: z.ZodString;
|
|
12
|
+
category: z.ZodString;
|
|
13
|
+
description: z.ZodString;
|
|
14
|
+
schema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
15
|
+
example: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
16
|
+
}, z.core.$strip>>;
|
|
17
|
+
}, z.core.$strip>;
|
|
18
|
+
export declare const WebhookTopicParams: z.ZodObject<{
|
|
19
|
+
topic: z.ZodString;
|
|
20
|
+
}, z.core.$strip>;
|
|
21
|
+
export declare const TestFireTopicBody: z.ZodObject<{
|
|
22
|
+
topic: z.ZodString;
|
|
23
|
+
}, z.core.$strip>;
|
|
24
|
+
export declare const UsagePeriodDto: z.ZodObject<{
|
|
25
|
+
period: z.ZodString;
|
|
26
|
+
sends_email: z.ZodNumber;
|
|
27
|
+
sends_sms: z.ZodNumber;
|
|
28
|
+
sends_whatsapp: z.ZodNumber;
|
|
29
|
+
sends_push: z.ZodNumber;
|
|
30
|
+
sends_postcard: z.ZodNumber;
|
|
31
|
+
ai_tokens: z.ZodNumber;
|
|
32
|
+
}, z.core.$strip>;
|
|
33
|
+
export declare const UsageHistoryQuery: z.ZodObject<{
|
|
34
|
+
months: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
35
|
+
}, z.core.$strip>;
|
|
36
|
+
export declare const UsagePeriodParams: z.ZodObject<{
|
|
37
|
+
period: z.ZodString;
|
|
38
|
+
}, z.core.$strip>;
|
|
39
|
+
export declare const InvoiceDto: z.ZodObject<{
|
|
40
|
+
id: z.ZodString;
|
|
41
|
+
number: z.ZodNullable<z.ZodString>;
|
|
42
|
+
status: z.ZodString;
|
|
43
|
+
currency: z.ZodString;
|
|
44
|
+
amountDueMinor: z.ZodNumber;
|
|
45
|
+
amountPaidMinor: z.ZodNumber;
|
|
46
|
+
createdAt: z.ZodISODateTime;
|
|
47
|
+
hostedUrl: z.ZodNullable<z.ZodString>;
|
|
48
|
+
pdfUrl: z.ZodNullable<z.ZodString>;
|
|
49
|
+
}, z.core.$strip>;
|
|
50
|
+
export declare const AccountExportDto: z.ZodObject<{
|
|
51
|
+
id: z.ZodUUID;
|
|
52
|
+
status: z.ZodEnum<{
|
|
53
|
+
completed: "completed";
|
|
54
|
+
failed: "failed";
|
|
55
|
+
queued: "queued";
|
|
56
|
+
running: "running";
|
|
57
|
+
}>;
|
|
58
|
+
error: z.ZodNullable<z.ZodString>;
|
|
59
|
+
sizeBytes: z.ZodNullable<z.ZodNumber>;
|
|
60
|
+
datasets: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
61
|
+
createdAt: z.ZodISODateTime;
|
|
62
|
+
finishedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
63
|
+
downloadPath: z.ZodNullable<z.ZodString>;
|
|
64
|
+
options: z.ZodOptional<z.ZodObject<{
|
|
65
|
+
datasets: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
66
|
+
since: z.ZodOptional<z.ZodString>;
|
|
67
|
+
}, z.core.$strip>>;
|
|
68
|
+
}, z.core.$strip>;
|
|
69
|
+
export declare const OAuthClientBody: z.ZodObject<{
|
|
70
|
+
name: z.ZodString;
|
|
71
|
+
redirectUris: z.ZodArray<z.ZodURL>;
|
|
72
|
+
scopes: z.ZodArray<z.ZodString>;
|
|
73
|
+
public: z.ZodDefault<z.ZodBoolean>;
|
|
74
|
+
}, z.core.$strip>;
|
|
75
|
+
export declare const OAuthClientDto: z.ZodObject<{
|
|
76
|
+
id: z.ZodUUID;
|
|
77
|
+
clientId: z.ZodString;
|
|
78
|
+
name: z.ZodString;
|
|
79
|
+
redirectUris: z.ZodArray<z.ZodString>;
|
|
80
|
+
scopes: z.ZodArray<z.ZodString>;
|
|
81
|
+
isPublic: z.ZodBoolean;
|
|
82
|
+
revokedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
83
|
+
createdAt: z.ZodISODateTime;
|
|
84
|
+
}, z.core.$strip>;
|
|
85
|
+
export declare const OAuthClientCreated: z.ZodObject<{
|
|
86
|
+
id: z.ZodUUID;
|
|
87
|
+
clientId: z.ZodString;
|
|
88
|
+
name: z.ZodString;
|
|
89
|
+
redirectUris: z.ZodArray<z.ZodString>;
|
|
90
|
+
scopes: z.ZodArray<z.ZodString>;
|
|
91
|
+
isPublic: z.ZodBoolean;
|
|
92
|
+
revokedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
93
|
+
createdAt: z.ZodISODateTime;
|
|
94
|
+
clientSecret: z.ZodString;
|
|
95
|
+
}, z.core.$strip>;
|
|
96
|
+
export declare const OAuthAuthorizeParams: z.ZodObject<{
|
|
97
|
+
client_id: z.ZodString;
|
|
98
|
+
redirect_uri: z.ZodURL;
|
|
99
|
+
scope: z.ZodDefault<z.ZodString>;
|
|
100
|
+
state: z.ZodOptional<z.ZodString>;
|
|
101
|
+
code_challenge: z.ZodString;
|
|
102
|
+
code_challenge_method: z.ZodLiteral<"S256">;
|
|
103
|
+
}, z.core.$strip>;
|
|
104
|
+
export declare const OAuthAuthorizePreview: z.ZodObject<{
|
|
105
|
+
clientName: z.ZodString;
|
|
106
|
+
clientId: z.ZodString;
|
|
107
|
+
scopes: z.ZodArray<z.ZodString>;
|
|
108
|
+
redirectUri: z.ZodString;
|
|
109
|
+
}, z.core.$strip>;
|
|
110
|
+
export declare const OAuthAuthorizeResult: z.ZodObject<{
|
|
111
|
+
redirectUrl: z.ZodString;
|
|
112
|
+
}, z.core.$strip>;
|
|
113
|
+
export declare const OAuthTokenBody: z.ZodObject<{
|
|
114
|
+
grant_type: z.ZodEnum<{
|
|
115
|
+
authorization_code: "authorization_code";
|
|
116
|
+
refresh_token: "refresh_token";
|
|
117
|
+
}>;
|
|
118
|
+
client_id: z.ZodString;
|
|
119
|
+
client_secret: z.ZodOptional<z.ZodString>;
|
|
120
|
+
code: z.ZodOptional<z.ZodString>;
|
|
121
|
+
redirect_uri: z.ZodOptional<z.ZodString>;
|
|
122
|
+
code_verifier: z.ZodOptional<z.ZodString>;
|
|
123
|
+
refresh_token: z.ZodOptional<z.ZodString>;
|
|
124
|
+
}, z.core.$strip>;
|
|
125
|
+
export declare const OAuthTokenResult: z.ZodObject<{
|
|
126
|
+
access_token: z.ZodString;
|
|
127
|
+
token_type: z.ZodLiteral<"Bearer">;
|
|
128
|
+
expires_in: z.ZodNumber;
|
|
129
|
+
refresh_token: z.ZodString;
|
|
130
|
+
scope: z.ZodString;
|
|
131
|
+
}, z.core.$strip>;
|
|
132
|
+
/** RFC 8414 authorization server metadata (`/.well-known/oauth-authorization-server`). */
|
|
133
|
+
export declare const OAuthServerMetadata: z.ZodObject<{
|
|
134
|
+
issuer: z.ZodString;
|
|
135
|
+
authorization_endpoint: z.ZodString;
|
|
136
|
+
token_endpoint: z.ZodString;
|
|
137
|
+
revocation_endpoint: z.ZodString;
|
|
138
|
+
scopes_supported: z.ZodArray<z.ZodString>;
|
|
139
|
+
response_types_supported: z.ZodArray<z.ZodString>;
|
|
140
|
+
grant_types_supported: z.ZodArray<z.ZodString>;
|
|
141
|
+
code_challenge_methods_supported: z.ZodArray<z.ZodString>;
|
|
142
|
+
token_endpoint_auth_methods_supported: z.ZodArray<z.ZodString>;
|
|
143
|
+
revocation_endpoint_auth_methods_supported: z.ZodArray<z.ZodString>;
|
|
144
|
+
service_documentation: z.ZodString;
|
|
145
|
+
}, z.core.$strip>;
|
|
146
|
+
export declare const OAuthRevokeBody: z.ZodObject<{
|
|
147
|
+
token: z.ZodString;
|
|
148
|
+
client_id: z.ZodString;
|
|
149
|
+
client_secret: z.ZodOptional<z.ZodString>;
|
|
150
|
+
}, z.core.$strip>;
|
|
151
|
+
export declare const AuthorizedAppDto: z.ZodObject<{
|
|
152
|
+
clientId: z.ZodString;
|
|
153
|
+
name: z.ZodString;
|
|
154
|
+
scopes: z.ZodArray<z.ZodString>;
|
|
155
|
+
grantedBy: z.ZodUUID;
|
|
156
|
+
grantedAt: z.ZodISODateTime;
|
|
157
|
+
lastUsedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
158
|
+
}, z.core.$strip>;
|
|
159
|
+
export declare const AuthorizedAppParams: z.ZodObject<{
|
|
160
|
+
clientId: z.ZodString;
|
|
161
|
+
}, z.core.$strip>;
|
|
162
|
+
export declare const ClientLifecycleBody: z.ZodObject<{
|
|
163
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
164
|
+
}, z.core.$strip>;
|
|
165
|
+
export declare const DeleteClientBody: z.ZodObject<{
|
|
166
|
+
graceDays: z.ZodDefault<z.ZodNumber>;
|
|
167
|
+
}, z.core.$strip>;
|
|
168
|
+
/** null = no per-client cap beyond the plan. */
|
|
169
|
+
export declare const ClientModulesBody: z.ZodObject<{
|
|
170
|
+
disabled: z.ZodArray<z.ZodString>;
|
|
171
|
+
}, z.core.$strip>;
|
|
172
|
+
export declare const ClientModulesDto: z.ZodObject<{
|
|
173
|
+
modules: z.ZodArray<z.ZodObject<{
|
|
174
|
+
key: z.ZodString;
|
|
175
|
+
label: z.ZodString;
|
|
176
|
+
}, z.core.$strip>>;
|
|
177
|
+
disabled: z.ZodArray<z.ZodString>;
|
|
178
|
+
}, z.core.$strip>;
|
|
179
|
+
export declare const ClientQuotaBody: z.ZodObject<{
|
|
180
|
+
sendsEmail: z.ZodNullable<z.ZodNumber>;
|
|
181
|
+
sendsSms: z.ZodNullable<z.ZodNumber>;
|
|
182
|
+
}, z.core.$strip>;
|
|
183
|
+
export declare const ClientParams: z.ZodObject<{
|
|
184
|
+
workspaceId: z.ZodUUID;
|
|
185
|
+
}, z.core.$strip>;
|
|
186
|
+
export declare const ClientInfoDto: z.ZodObject<{
|
|
187
|
+
id: z.ZodUUID;
|
|
188
|
+
name: z.ZodString;
|
|
189
|
+
status: z.ZodEnum<{
|
|
190
|
+
active: "active";
|
|
191
|
+
paused: "paused";
|
|
192
|
+
pending_deletion: "pending_deletion";
|
|
193
|
+
}>;
|
|
194
|
+
pausedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
195
|
+
pausedReason: z.ZodNullable<z.ZodString>;
|
|
196
|
+
deleteAfter: z.ZodNullable<z.ZodISODateTime>;
|
|
197
|
+
quota: z.ZodObject<{
|
|
198
|
+
sendsEmail: z.ZodNullable<z.ZodNumber>;
|
|
199
|
+
sendsSms: z.ZodNullable<z.ZodNumber>;
|
|
200
|
+
}, z.core.$strip>;
|
|
201
|
+
usage: z.ZodObject<{
|
|
202
|
+
period: z.ZodString;
|
|
203
|
+
sends_email: z.ZodNumber;
|
|
204
|
+
sends_sms: z.ZodNumber;
|
|
205
|
+
sends_whatsapp: z.ZodNumber;
|
|
206
|
+
sends_push: z.ZodNumber;
|
|
207
|
+
sends_postcard: z.ZodNumber;
|
|
208
|
+
ai_tokens: z.ZodNumber;
|
|
209
|
+
}, z.core.$strip>;
|
|
210
|
+
reputation: z.ZodObject<{
|
|
211
|
+
sent30d: z.ZodNumber;
|
|
212
|
+
bounceRate: z.ZodNumber;
|
|
213
|
+
complaintRate: z.ZodNumber;
|
|
214
|
+
rating: z.ZodEnum<{
|
|
215
|
+
good: "good";
|
|
216
|
+
poor: "poor";
|
|
217
|
+
unknown: "unknown";
|
|
218
|
+
watch: "watch";
|
|
219
|
+
}>;
|
|
220
|
+
}, z.core.$strip>;
|
|
221
|
+
}, z.core.$strip>;
|
|
222
|
+
export type UsagePeriodDto = z.infer<typeof UsagePeriodDto>;
|
|
223
|
+
export type InvoiceDto = z.infer<typeof InvoiceDto>;
|
|
224
|
+
export type ClientQuota = z.infer<typeof ClientQuotaBody>;
|
|
225
|
+
export type WebhookTopicDto = z.infer<typeof WebhookTopicDto>;
|
|
226
|
+
export declare const ACCOUNT_EXPORT_DATASETS: readonly ['profiles', 'segments', 'campaigns', 'templates', 'workflows', 'forms', 'suppressions', 'events', 'lists'];
|
|
227
|
+
export declare const AccountExportBody: z.ZodObject<{
|
|
228
|
+
datasets: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
229
|
+
campaigns: "campaigns";
|
|
230
|
+
events: "events";
|
|
231
|
+
forms: "forms";
|
|
232
|
+
lists: "lists";
|
|
233
|
+
profiles: "profiles";
|
|
234
|
+
segments: "segments";
|
|
235
|
+
suppressions: "suppressions";
|
|
236
|
+
templates: "templates";
|
|
237
|
+
workflows: "workflows";
|
|
238
|
+
}>>>;
|
|
239
|
+
since: z.ZodOptional<z.ZodISODateTime>;
|
|
240
|
+
}, z.core.$strip>;
|
|
241
|
+
export declare const AccountExportListQuery: z.ZodObject<{
|
|
242
|
+
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
243
|
+
cursor: z.ZodOptional<z.ZodUUID>;
|
|
244
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Id, Timestamp } from './common.js';
|
|
3
|
+
// ---- webhook topic catalog ----
|
|
4
|
+
export const WebhookTopicDto = z.object({
|
|
5
|
+
topic: z.string(),
|
|
6
|
+
category: z.string(),
|
|
7
|
+
description: z.string(),
|
|
8
|
+
/** JSON Schema of `data` in the delivery envelope, derived from the example. */
|
|
9
|
+
schema: z.record(z.string(), z.unknown()),
|
|
10
|
+
example: z.record(z.string(), z.unknown()),
|
|
11
|
+
});
|
|
12
|
+
export const WebhookTopicsResult = z.object({ items: z.array(WebhookTopicDto) });
|
|
13
|
+
export const WebhookTopicParams = z.object({ topic: z.string().min(1).max(100) });
|
|
14
|
+
export const TestFireTopicBody = z.object({ topic: z.string().min(1).max(100) });
|
|
15
|
+
// ---- billing usage history ----
|
|
16
|
+
export const UsagePeriodDto = z.object({
|
|
17
|
+
period: z.string().regex(/^\d{4}-\d{2}$/),
|
|
18
|
+
sends_email: z.number().int(),
|
|
19
|
+
sends_sms: z.number().int(),
|
|
20
|
+
sends_whatsapp: z.number().int(),
|
|
21
|
+
sends_push: z.number().int(),
|
|
22
|
+
sends_postcard: z.number().int(),
|
|
23
|
+
ai_tokens: z.number().int(),
|
|
24
|
+
});
|
|
25
|
+
export const UsageHistoryQuery = z.object({ months: z.coerce.number().int().min(1).max(36).default(12) });
|
|
26
|
+
export const UsagePeriodParams = z.object({ period: z.string().regex(/^\d{4}-(0[1-9]|1[0-2])$/, 'Use a month like 2026-11') });
|
|
27
|
+
export const InvoiceDto = z.object({
|
|
28
|
+
id: z.string(), number: z.string().nullable(), status: z.string(), currency: z.string(), amountDueMinor: z.number().int(), amountPaidMinor: z.number().int(),
|
|
29
|
+
createdAt: Timestamp, hostedUrl: z.string().nullable(), pdfUrl: z.string().nullable(),
|
|
30
|
+
});
|
|
31
|
+
// ---- account export ----
|
|
32
|
+
export const AccountExportDto = z.object({
|
|
33
|
+
id: Id, status: z.enum(['queued', 'running', 'completed', 'failed']), error: z.string().nullable(), sizeBytes: z.number().int().nullable(),
|
|
34
|
+
datasets: z.record(z.string(), z.number().int()), createdAt: Timestamp, finishedAt: Timestamp.nullable(),
|
|
35
|
+
/** Authenticated GET that streams the zip; null until completed. */
|
|
36
|
+
downloadPath: z.string().nullable(),
|
|
37
|
+
/** What was asked for: dataset names (absent = all) and the since-date. */
|
|
38
|
+
options: z.object({ datasets: z.array(z.string()).optional(), since: z.string().optional() }).optional(),
|
|
39
|
+
});
|
|
40
|
+
// ---- OAuth 2.0 (authorization code + PKCE S256) ----
|
|
41
|
+
const RedirectUris = z.array(z.url().max(2048)).min(1).max(10);
|
|
42
|
+
export const OAuthClientBody = z.object({ name: z.string().trim().min(1).max(100), redirectUris: RedirectUris, scopes: z.array(z.string().min(1).max(60)).min(1).max(60), /** SPA/CLI client: no secret, PKCE only. */ public: z.boolean().default(false) });
|
|
43
|
+
export const OAuthClientDto = z.object({
|
|
44
|
+
id: Id, clientId: z.string(), name: z.string(), redirectUris: z.array(z.string()), scopes: z.array(z.string()), isPublic: z.boolean(), revokedAt: Timestamp.nullable(), createdAt: Timestamp,
|
|
45
|
+
});
|
|
46
|
+
export const OAuthClientCreated = OAuthClientDto.extend({ clientSecret: z.string() });
|
|
47
|
+
export const OAuthAuthorizeParams = z.object({
|
|
48
|
+
client_id: z.string().min(1).max(100), redirect_uri: z.url().max(2048), scope: z.string().max(1000).default(''), state: z.string().max(500).optional(),
|
|
49
|
+
code_challenge: z.string().regex(/^[A-Za-z0-9_-]{43,128}$/), code_challenge_method: z.literal('S256'),
|
|
50
|
+
});
|
|
51
|
+
export const OAuthAuthorizePreview = z.object({ clientName: z.string(), clientId: z.string(), scopes: z.array(z.string()), redirectUri: z.string() });
|
|
52
|
+
export const OAuthAuthorizeResult = z.object({ redirectUrl: z.string() });
|
|
53
|
+
// Form-encoded or JSON; RFC 6749 snake_case names.
|
|
54
|
+
export const OAuthTokenBody = z.object({
|
|
55
|
+
grant_type: z.enum(['authorization_code', 'refresh_token']),
|
|
56
|
+
client_id: z.string().min(1).max(100),
|
|
57
|
+
client_secret: z.string().max(200).optional(),
|
|
58
|
+
code: z.string().max(200).optional(),
|
|
59
|
+
redirect_uri: z.string().max(2048).optional(),
|
|
60
|
+
code_verifier: z.string().regex(/^[A-Za-z0-9._~-]{43,128}$/).optional(),
|
|
61
|
+
refresh_token: z.string().max(200).optional(),
|
|
62
|
+
});
|
|
63
|
+
export const OAuthTokenResult = z.object({
|
|
64
|
+
access_token: z.string(), token_type: z.literal('Bearer'), expires_in: z.number().int(), refresh_token: z.string(), scope: z.string(),
|
|
65
|
+
});
|
|
66
|
+
/** RFC 8414 authorization server metadata (`/.well-known/oauth-authorization-server`). */
|
|
67
|
+
export const OAuthServerMetadata = z.object({
|
|
68
|
+
issuer: z.string(), authorization_endpoint: z.string(), token_endpoint: z.string(), revocation_endpoint: z.string(),
|
|
69
|
+
scopes_supported: z.array(z.string()), response_types_supported: z.array(z.string()), grant_types_supported: z.array(z.string()),
|
|
70
|
+
code_challenge_methods_supported: z.array(z.string()), token_endpoint_auth_methods_supported: z.array(z.string()),
|
|
71
|
+
revocation_endpoint_auth_methods_supported: z.array(z.string()), service_documentation: z.string(),
|
|
72
|
+
});
|
|
73
|
+
export const OAuthRevokeBody = z.object({ token: z.string().min(1).max(200), client_id: z.string().min(1).max(100), client_secret: z.string().max(200).optional() });
|
|
74
|
+
export const AuthorizedAppDto = z.object({
|
|
75
|
+
clientId: z.string(), name: z.string(), scopes: z.array(z.string()), grantedBy: Id, grantedAt: Timestamp, lastUsedAt: Timestamp.nullable(),
|
|
76
|
+
});
|
|
77
|
+
export const AuthorizedAppParams = z.object({ clientId: z.string().min(1).max(100) });
|
|
78
|
+
// ---- agency workspace lifecycle ----
|
|
79
|
+
export const ClientLifecycleBody = z.object({ reason: z.string().trim().max(300).optional() });
|
|
80
|
+
export const DeleteClientBody = z.object({ graceDays: z.number().int().min(1).max(90).default(30) });
|
|
81
|
+
/** null = no per-client cap beyond the plan. */
|
|
82
|
+
export const ClientModulesBody = z.object({ disabled: z.array(z.string().max(40)).max(20) });
|
|
83
|
+
export const ClientModulesDto = z.object({ modules: z.array(z.object({ key: z.string(), label: z.string() })), disabled: z.array(z.string()) });
|
|
84
|
+
export const ClientQuotaBody = z.object({ sendsEmail: z.number().int().nonnegative().nullable(), sendsSms: z.number().int().nonnegative().nullable() });
|
|
85
|
+
export const ClientParams = z.object({ workspaceId: Id });
|
|
86
|
+
export const ClientInfoDto = z.object({
|
|
87
|
+
id: Id, name: z.string(), status: z.enum(['active', 'paused', 'pending_deletion']), pausedAt: Timestamp.nullable(), pausedReason: z.string().nullable(), deleteAfter: Timestamp.nullable(),
|
|
88
|
+
quota: ClientQuotaBody, usage: UsagePeriodDto,
|
|
89
|
+
reputation: z.object({ sent30d: z.number().int(), bounceRate: z.number(), complaintRate: z.number(), rating: z.enum(['good', 'watch', 'poor', 'unknown']) }),
|
|
90
|
+
});
|
|
91
|
+
export const ACCOUNT_EXPORT_DATASETS = ['profiles', 'segments', 'campaigns', 'templates', 'workflows', 'forms', 'suppressions', 'events', 'lists'];
|
|
92
|
+
export const AccountExportBody = z.object({
|
|
93
|
+
/** Empty or absent = every dataset. */
|
|
94
|
+
datasets: z.array(z.enum(ACCOUNT_EXPORT_DATASETS)).max(20).optional(),
|
|
95
|
+
/** Only rows created at or after this time. */
|
|
96
|
+
since: Timestamp.optional(),
|
|
97
|
+
});
|
|
98
|
+
export const AccountExportListQuery = z.object({ limit: z.coerce.number().int().min(1).max(100).default(25), cursor: z.uuid().optional() });
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** Postcard sizes in inches, width x height (landscape). Print vendors add their own bleed. */
|
|
3
|
+
export declare const PostcardSize: z.ZodEnum<{
|
|
4
|
+
"6x4": "6x4";
|
|
5
|
+
"9x6": "9x6";
|
|
6
|
+
}>;
|
|
7
|
+
export type PostcardSize = z.infer<typeof PostcardSize>;
|
|
8
|
+
/** Front and back are HTML with Liquid merge tags ({{ profile.firstName }}, {{ address.city }}). */
|
|
9
|
+
export declare const PostcardDesign: z.ZodObject<{
|
|
10
|
+
size: z.ZodDefault<z.ZodEnum<{
|
|
11
|
+
"6x4": "6x4";
|
|
12
|
+
"9x6": "9x6";
|
|
13
|
+
}>>;
|
|
14
|
+
front: z.ZodString;
|
|
15
|
+
back: z.ZodString;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
export type PostcardDesign = z.infer<typeof PostcardDesign>;
|
|
18
|
+
export declare const PostalAddressDto: z.ZodObject<{
|
|
19
|
+
name: z.ZodString;
|
|
20
|
+
line1: z.ZodString;
|
|
21
|
+
line2: z.ZodNullable<z.ZodString>;
|
|
22
|
+
city: z.ZodString;
|
|
23
|
+
region: z.ZodNullable<z.ZodString>;
|
|
24
|
+
postalCode: z.ZodString;
|
|
25
|
+
country: z.ZodString;
|
|
26
|
+
}, z.core.$strip>;
|
|
27
|
+
export type PostalAddressDto = z.infer<typeof PostalAddressDto>;
|
|
28
|
+
/** Proof of the saved design, or of `design` when given (the designer's unsaved edits). */
|
|
29
|
+
export declare const PostcardProofBody: z.ZodObject<{
|
|
30
|
+
profileId: z.ZodOptional<z.ZodUUID>;
|
|
31
|
+
design: z.ZodOptional<z.ZodObject<{
|
|
32
|
+
size: z.ZodDefault<z.ZodEnum<{
|
|
33
|
+
"6x4": "6x4";
|
|
34
|
+
"9x6": "9x6";
|
|
35
|
+
}>>;
|
|
36
|
+
front: z.ZodString;
|
|
37
|
+
back: z.ZodString;
|
|
38
|
+
}, z.core.$strip>>;
|
|
39
|
+
}, z.core.$strip>;
|
|
40
|
+
export declare const PostcardDesignDto: z.ZodObject<{
|
|
41
|
+
messageId: z.ZodNullable<z.ZodUUID>;
|
|
42
|
+
design: z.ZodNullable<z.ZodObject<{
|
|
43
|
+
size: z.ZodDefault<z.ZodEnum<{
|
|
44
|
+
"6x4": "6x4";
|
|
45
|
+
"9x6": "9x6";
|
|
46
|
+
}>>;
|
|
47
|
+
front: z.ZodString;
|
|
48
|
+
back: z.ZodString;
|
|
49
|
+
}, z.core.$strip>>;
|
|
50
|
+
}, z.core.$strip>;
|
|
51
|
+
/** The design rendered for one contact (or with sample values), with the address it would be mailed to. */
|
|
52
|
+
export declare const PostcardProofDto: z.ZodObject<{
|
|
53
|
+
size: z.ZodEnum<{
|
|
54
|
+
"6x4": "6x4";
|
|
55
|
+
"9x6": "9x6";
|
|
56
|
+
}>;
|
|
57
|
+
front: z.ZodString;
|
|
58
|
+
back: z.ZodString;
|
|
59
|
+
address: z.ZodNullable<z.ZodObject<{
|
|
60
|
+
name: z.ZodString;
|
|
61
|
+
line1: z.ZodString;
|
|
62
|
+
line2: z.ZodNullable<z.ZodString>;
|
|
63
|
+
city: z.ZodString;
|
|
64
|
+
region: z.ZodNullable<z.ZodString>;
|
|
65
|
+
postalCode: z.ZodString;
|
|
66
|
+
country: z.ZodString;
|
|
67
|
+
}, z.core.$strip>>;
|
|
68
|
+
skipReason: z.ZodNullable<z.ZodString>;
|
|
69
|
+
warnings: z.ZodArray<z.ZodString>;
|
|
70
|
+
}, z.core.$strip>;
|
|
71
|
+
/** Postcard campaign report: where each card is, and why people were skipped. */
|
|
72
|
+
export declare const PostcardReportDto: z.ZodObject<{
|
|
73
|
+
campaignId: z.ZodUUID;
|
|
74
|
+
byStatus: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
75
|
+
skipped: z.ZodArray<z.ZodObject<{
|
|
76
|
+
reason: z.ZodString;
|
|
77
|
+
count: z.ZodNumber;
|
|
78
|
+
}, z.core.$strip>>;
|
|
79
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Id } from './common.js';
|
|
3
|
+
/** Postcard sizes in inches, width x height (landscape). Print vendors add their own bleed. */
|
|
4
|
+
export const PostcardSize = z.enum(['6x4', '9x6']);
|
|
5
|
+
/** Front and back are HTML with Liquid merge tags ({{ profile.firstName }}, {{ address.city }}). */
|
|
6
|
+
export const PostcardDesign = z.object({
|
|
7
|
+
size: PostcardSize.default('6x4'),
|
|
8
|
+
front: z.string().trim().min(1).max(200_000),
|
|
9
|
+
back: z.string().trim().min(1).max(200_000),
|
|
10
|
+
});
|
|
11
|
+
export const PostalAddressDto = z.object({
|
|
12
|
+
name: z.string(), line1: z.string(), line2: z.string().nullable(), city: z.string(), region: z.string().nullable(), postalCode: z.string(), country: z.string(),
|
|
13
|
+
});
|
|
14
|
+
/** Proof of the saved design, or of `design` when given (the designer's unsaved edits). */
|
|
15
|
+
export const PostcardProofBody = z.object({ profileId: Id.optional(), design: PostcardDesign.optional() });
|
|
16
|
+
export const PostcardDesignDto = z.object({ messageId: Id.nullable(), design: PostcardDesign.nullable() });
|
|
17
|
+
/** The design rendered for one contact (or with sample values), with the address it would be mailed to. */
|
|
18
|
+
export const PostcardProofDto = z.object({
|
|
19
|
+
size: PostcardSize, front: z.string(), back: z.string(), address: PostalAddressDto.nullable(),
|
|
20
|
+
/** Why this contact would be skipped (no or invalid postal address); null when it would be mailed. */
|
|
21
|
+
skipReason: z.string().nullable(),
|
|
22
|
+
warnings: z.array(z.string()),
|
|
23
|
+
});
|
|
24
|
+
/** Postcard campaign report: where each card is, and why people were skipped. */
|
|
25
|
+
export const PostcardReportDto = z.object({
|
|
26
|
+
campaignId: Id,
|
|
27
|
+
byStatus: z.record(z.string(), z.number().int()),
|
|
28
|
+
skipped: z.array(z.object({ reason: z.string(), count: z.number().int() })),
|
|
29
|
+
});
|