@antelopejs/dms-mailing 0.8.0 → 0.9.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/README.md +41 -43
- package/dist/automation/email-event-trigger.d.ts +2 -2
- package/dist/automation/send-template-action.d.ts +11 -3
- package/dist/automation/send-template-action.js +1 -1
- package/dist/automation/send-template-action.js.map +1 -1
- package/dist/data/body.d.ts +2 -1
- package/dist/data/body.js +2 -1
- package/dist/data/body.js.map +1 -1
- package/dist/data/read-only-routes.d.ts +4 -4
- package/dist/data/sends-table.d.ts +4 -4
- package/dist/data/suppressions-table.d.ts +4 -4
- package/dist/data/templates-table.d.ts +35 -12
- package/dist/data/templates-table.js +29 -24
- package/dist/data/templates-table.js.map +1 -1
- package/dist/data-types/categories-type.d.ts +1 -2
- package/dist/data-types/categories-type.js +3 -5
- package/dist/data-types/categories-type.js.map +1 -1
- package/dist/data-types/category-type.d.ts +1 -2
- package/dist/data-types/category-type.js +3 -5
- package/dist/data-types/category-type.js.map +1 -1
- package/dist/db/models/send-events.model.d.ts +7 -5
- package/dist/db/models/sends.model.d.ts +7 -5
- package/dist/db/models/sends.model.js.map +1 -1
- package/dist/db/models/settings.model.d.ts +7 -5
- package/dist/db/models/suppressions.model.d.ts +7 -5
- package/dist/db/models/template-versions.model.d.ts +7 -5
- package/dist/db/models/template-versions.model.js +4 -3
- package/dist/db/models/template-versions.model.js.map +1 -1
- package/dist/db/models/templates.model.d.ts +7 -5
- package/dist/db/models/webhook-status.model.d.ts +7 -5
- package/dist/db/tables/templates.table.js.map +1 -1
- package/dist/engine/changes.js +8 -19
- package/dist/engine/changes.js.map +1 -1
- package/dist/engine/conditions.d.ts +2 -1
- package/dist/engine/conditions.js +3 -2
- package/dist/engine/conditions.js.map +1 -1
- package/dist/engine/coverage.d.ts +2 -1
- package/dist/engine/coverage.js.map +1 -1
- package/dist/engine/formats.d.ts +4 -6
- package/dist/engine/formats.js +17 -3
- package/dist/engine/formats.js.map +1 -1
- package/dist/engine/paths.d.ts +4 -2
- package/dist/engine/paths.js +15 -3
- package/dist/engine/paths.js.map +1 -1
- package/dist/engine/plain-text.js +2 -4
- package/dist/engine/plain-text.js.map +1 -1
- package/dist/engine/resolve.d.ts +2 -1
- package/dist/engine/resolve.js +1 -1
- package/dist/engine/resolve.js.map +1 -1
- package/dist/engine/system-variables.d.ts +2 -1
- package/dist/engine/system-variables.js.map +1 -1
- package/dist/engine/tokens.d.ts +2 -1
- package/dist/engine/tokens.js.map +1 -1
- package/dist/hooks/tenant-export.js +10 -9
- package/dist/hooks/tenant-export.js.map +1 -1
- package/dist/pages/templates.js +3 -1
- package/dist/pages/templates.js.map +1 -1
- package/dist/routes/events.js +4 -2
- package/dist/routes/events.js.map +1 -1
- package/dist/routes/index.d.ts +1 -0
- package/dist/routes/index.js +1 -0
- package/dist/routes/index.js.map +1 -1
- package/dist/routes/metrics.js +27 -28
- package/dist/routes/metrics.js.map +1 -1
- package/dist/routes/period.js +5 -5
- package/dist/routes/period.js.map +1 -1
- package/dist/routes/sends.js +3 -4
- package/dist/routes/sends.js.map +1 -1
- package/dist/routes/settings.d.ts +1 -1
- package/dist/routes/settings.js +12 -10
- package/dist/routes/settings.js.map +1 -1
- package/dist/routes/suppressions.js +9 -6
- package/dist/routes/suppressions.js.map +1 -1
- package/dist/routes/template-content.d.ts +27 -0
- package/dist/routes/template-content.js +3 -0
- package/dist/routes/template-content.js.map +1 -0
- package/dist/routes/templates.d.ts +7 -30
- package/dist/routes/templates.js +3 -2
- package/dist/routes/templates.js.map +1 -1
- package/dist/routes/zod-json.d.ts +3 -0
- package/dist/routes/zod-json.js +21 -0
- package/dist/routes/zod-json.js.map +1 -0
- package/dist/services/attention.js +14 -7
- package/dist/services/attention.js.map +1 -1
- package/dist/services/catalog.js +4 -2
- package/dist/services/catalog.js.map +1 -1
- package/dist/services/declaration-error.d.ts +1 -1
- package/dist/services/declaration-error.js.map +1 -1
- package/dist/services/declarations.js +4 -1
- package/dist/services/declarations.js.map +1 -1
- package/dist/services/events.js +3 -1
- package/dist/services/events.js.map +1 -1
- package/dist/services/metrics.js +2 -5
- package/dist/services/metrics.js.map +1 -1
- package/dist/services/send.js +3 -4
- package/dist/services/send.js.map +1 -1
- package/dist/services/settings.d.ts +4 -2
- package/dist/services/settings.js +5 -4
- package/dist/services/settings.js.map +1 -1
- package/dist/services/starters.d.ts +3 -2
- package/dist/services/starters.js +1 -1
- package/dist/services/starters.js.map +1 -1
- package/dist/services/templates.d.ts +2 -1
- package/dist/services/templates.js +5 -5
- package/dist/services/templates.js.map +1 -1
- package/dist/services/webhook-status.d.ts +2 -2
- package/dist/services/webhook-status.js +6 -4
- package/dist/services/webhook-status.js.map +1 -1
- package/dist/types/json.d.ts +1 -0
- package/dist/types/json.js +3 -0
- package/dist/types/json.js.map +1 -0
- package/dist/types/settings.d.ts +2 -2
- package/dist/validation/declarations.schema.d.ts +28 -28
- package/dist/validation/declarations.schema.js +4 -3
- package/dist/validation/declarations.schema.js.map +1 -1
- package/dist/validation/guards.d.ts +0 -1
- package/dist/validation/guards.js +0 -4
- package/dist/validation/guards.js.map +1 -1
- package/dist/validation/json.d.ts +5 -0
- package/dist/validation/json.js +54 -0
- package/dist/validation/json.js.map +1 -0
- package/dist/validation/json.schema.d.ts +2 -0
- package/dist/validation/json.schema.js +9 -0
- package/dist/validation/json.schema.js.map +1 -0
- package/dist/validation/templates.schema.d.ts +25 -24
- package/dist/validation/templates.schema.js +4 -3
- package/dist/validation/templates.schema.js.map +1 -1
- package/frontend-vue/package.json +1 -1
- package/frontend-vue/pnpm-lock.yaml +44 -4
- package/package.json +16 -15
- package/skills/dms-mailing/SKILL.md +3 -3
- package/src/automation/email-event-trigger.ts +2 -2
- package/src/automation/send-template-action.ts +33 -14
- package/src/data/body.ts +5 -2
- package/src/data/templates-table.ts +46 -52
- package/src/data-types/categories-type.ts +2 -2
- package/src/data-types/category-type.ts +2 -2
- package/src/db/models/sends.model.ts +2 -2
- package/src/db/models/template-versions.model.ts +5 -3
- package/src/db/tables/templates.table.ts +1 -1
- package/src/engine/changes.ts +11 -29
- package/src/engine/conditions.ts +12 -4
- package/src/engine/coverage.ts +2 -1
- package/src/engine/formats.ts +31 -17
- package/src/engine/paths.ts +39 -6
- package/src/engine/plain-text.ts +2 -4
- package/src/engine/resolve.ts +12 -4
- package/src/engine/system-variables.ts +2 -1
- package/src/engine/tokens.ts +2 -1
- package/src/hooks/tenant-export.ts +11 -13
- package/src/pages/templates.ts +3 -1
- package/src/routes/events.ts +7 -4
- package/src/routes/index.ts +1 -0
- package/src/routes/metrics.ts +30 -30
- package/src/routes/period.ts +5 -5
- package/src/routes/sends.ts +13 -8
- package/src/routes/settings.ts +15 -10
- package/src/routes/suppressions.ts +12 -8
- package/src/routes/template-content.ts +45 -0
- package/src/routes/templates.ts +11 -44
- package/src/routes/zod-json.ts +28 -0
- package/src/services/attention.ts +16 -15
- package/src/services/catalog.ts +4 -8
- package/src/services/declaration-error.ts +1 -1
- package/src/services/declarations.ts +4 -1
- package/src/services/events.ts +4 -2
- package/src/services/metrics.ts +3 -5
- package/src/services/send.ts +3 -6
- package/src/services/settings.ts +17 -16
- package/src/services/starters.ts +8 -4
- package/src/services/templates.ts +16 -9
- package/src/services/webhook-status.ts +13 -8
- package/src/types/json.ts +1 -0
- package/src/types/settings.ts +2 -2
- package/src/validation/declarations.schema.ts +4 -3
- package/src/validation/guards.ts +0 -8
- package/src/validation/json.schema.ts +7 -0
- package/src/validation/json.ts +66 -0
- package/src/validation/templates.schema.ts +7 -3
|
@@ -37,18 +37,19 @@ export declare const templateDeclarationSchema: z.ZodObject<{
|
|
|
37
37
|
type: z.ZodEnum<["string", "text", "number", "money", "date", "url", "boolean", "array"]>;
|
|
38
38
|
required: z.ZodBoolean;
|
|
39
39
|
}, "strip", z.ZodTypeAny, {
|
|
40
|
+
type: "string" | "number" | "boolean" | "text" | "date" | "array" | "url" | "money";
|
|
40
41
|
path: string;
|
|
41
|
-
type: "string" | "number" | "boolean" | "date" | "array" | "url" | "money" | "text";
|
|
42
42
|
required: boolean;
|
|
43
43
|
}, {
|
|
44
|
+
type: "string" | "number" | "boolean" | "text" | "date" | "array" | "url" | "money";
|
|
44
45
|
path: string;
|
|
45
|
-
type: "string" | "number" | "boolean" | "date" | "array" | "url" | "money" | "text";
|
|
46
46
|
required: boolean;
|
|
47
47
|
}>, "many">>;
|
|
48
|
-
testData: z.ZodDefault<z.
|
|
48
|
+
testData: z.ZodDefault<z.ZodEffects<z.ZodUnknown, import("@antelopejs/interface-dms-mailing").JsonObject, unknown>>;
|
|
49
49
|
author: z.ZodOptional<z.ZodString>;
|
|
50
50
|
}, "strip", z.ZodTypeAny, {
|
|
51
51
|
name: Record<string, string>;
|
|
52
|
+
category: string;
|
|
52
53
|
content: {
|
|
53
54
|
locales: Record<string, {
|
|
54
55
|
subject: string;
|
|
@@ -57,14 +58,13 @@ export declare const templateDeclarationSchema: z.ZodObject<{
|
|
|
57
58
|
}>;
|
|
58
59
|
};
|
|
59
60
|
tenantId: string;
|
|
60
|
-
category: string;
|
|
61
61
|
slug: string;
|
|
62
62
|
variables: {
|
|
63
|
+
type: "string" | "number" | "boolean" | "text" | "date" | "array" | "url" | "money";
|
|
63
64
|
path: string;
|
|
64
|
-
type: "string" | "number" | "boolean" | "date" | "array" | "url" | "money" | "text";
|
|
65
65
|
required: boolean;
|
|
66
66
|
}[];
|
|
67
|
-
testData:
|
|
67
|
+
testData: import("@antelopejs/interface-dms-mailing").JsonObject;
|
|
68
68
|
author?: string | undefined;
|
|
69
69
|
}, {
|
|
70
70
|
name: Record<string, string>;
|
|
@@ -79,11 +79,11 @@ export declare const templateDeclarationSchema: z.ZodObject<{
|
|
|
79
79
|
slug: string;
|
|
80
80
|
category?: string | undefined;
|
|
81
81
|
variables?: {
|
|
82
|
+
type: "string" | "number" | "boolean" | "text" | "date" | "array" | "url" | "money";
|
|
82
83
|
path: string;
|
|
83
|
-
type: "string" | "number" | "boolean" | "date" | "array" | "url" | "money" | "text";
|
|
84
84
|
required: boolean;
|
|
85
85
|
}[] | undefined;
|
|
86
|
-
testData?:
|
|
86
|
+
testData?: unknown;
|
|
87
87
|
author?: string | undefined;
|
|
88
88
|
}>;
|
|
89
89
|
export type ParsedTemplateDeclaration = z.infer<typeof templateDeclarationSchema>;
|
|
@@ -137,7 +137,7 @@ declare const importedSendSchema: z.ZodObject<{
|
|
|
137
137
|
}>]>;
|
|
138
138
|
sentAt: z.ZodDate;
|
|
139
139
|
locale: z.ZodOptional<z.ZodString>;
|
|
140
|
-
variables: z.ZodDefault<z.
|
|
140
|
+
variables: z.ZodDefault<z.ZodEffects<z.ZodUnknown, import("@antelopejs/interface-dms-mailing").JsonObject, unknown>>;
|
|
141
141
|
provider: z.ZodOptional<z.ZodString>;
|
|
142
142
|
providerMessageId: z.ZodOptional<z.ZodString>;
|
|
143
143
|
source: z.ZodOptional<z.ZodString>;
|
|
@@ -145,15 +145,15 @@ declare const importedSendSchema: z.ZodObject<{
|
|
|
145
145
|
events: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
146
146
|
type: z.ZodEnum<[import("@antelopejs/interface-dms-mailing").SendEventType, ...import("@antelopejs/interface-dms-mailing").SendEventType[]]>;
|
|
147
147
|
at: z.ZodDate;
|
|
148
|
-
details: z.ZodOptional<z.
|
|
148
|
+
details: z.ZodOptional<z.ZodEffects<z.ZodUnknown, import("@antelopejs/interface-dms-mailing").JsonObject, unknown>>;
|
|
149
149
|
}, "strip", z.ZodTypeAny, {
|
|
150
150
|
at: Date;
|
|
151
151
|
type: import("@antelopejs/interface-dms-mailing").SendEventType;
|
|
152
|
-
details?:
|
|
152
|
+
details?: import("@antelopejs/interface-dms-mailing").JsonObject | undefined;
|
|
153
153
|
}, {
|
|
154
154
|
at: Date;
|
|
155
155
|
type: import("@antelopejs/interface-dms-mailing").SendEventType;
|
|
156
|
-
details?:
|
|
156
|
+
details?: unknown;
|
|
157
157
|
}>, "many">>;
|
|
158
158
|
}, "strip", z.ZodTypeAny, {
|
|
159
159
|
to: string | {
|
|
@@ -162,11 +162,11 @@ declare const importedSendSchema: z.ZodObject<{
|
|
|
162
162
|
};
|
|
163
163
|
templateSlug: string;
|
|
164
164
|
isTest: boolean;
|
|
165
|
-
variables:
|
|
165
|
+
variables: import("@antelopejs/interface-dms-mailing").JsonObject;
|
|
166
166
|
events: {
|
|
167
167
|
at: Date;
|
|
168
168
|
type: import("@antelopejs/interface-dms-mailing").SendEventType;
|
|
169
|
-
details?:
|
|
169
|
+
details?: import("@antelopejs/interface-dms-mailing").JsonObject | undefined;
|
|
170
170
|
}[];
|
|
171
171
|
importId: string;
|
|
172
172
|
sentAt: Date;
|
|
@@ -187,11 +187,11 @@ declare const importedSendSchema: z.ZodObject<{
|
|
|
187
187
|
locale?: string | undefined;
|
|
188
188
|
providerMessageId?: string | undefined;
|
|
189
189
|
isTest?: boolean | undefined;
|
|
190
|
-
variables?:
|
|
190
|
+
variables?: unknown;
|
|
191
191
|
events?: {
|
|
192
192
|
at: Date;
|
|
193
193
|
type: import("@antelopejs/interface-dms-mailing").SendEventType;
|
|
194
|
-
details?:
|
|
194
|
+
details?: unknown;
|
|
195
195
|
}[] | undefined;
|
|
196
196
|
}>;
|
|
197
197
|
export type ParsedImportedSend = z.infer<typeof importedSendSchema>;
|
|
@@ -212,7 +212,7 @@ export declare const sendImportSchema: z.ZodObject<{
|
|
|
212
212
|
}>]>;
|
|
213
213
|
sentAt: z.ZodDate;
|
|
214
214
|
locale: z.ZodOptional<z.ZodString>;
|
|
215
|
-
variables: z.ZodDefault<z.
|
|
215
|
+
variables: z.ZodDefault<z.ZodEffects<z.ZodUnknown, import("@antelopejs/interface-dms-mailing").JsonObject, unknown>>;
|
|
216
216
|
provider: z.ZodOptional<z.ZodString>;
|
|
217
217
|
providerMessageId: z.ZodOptional<z.ZodString>;
|
|
218
218
|
source: z.ZodOptional<z.ZodString>;
|
|
@@ -220,15 +220,15 @@ export declare const sendImportSchema: z.ZodObject<{
|
|
|
220
220
|
events: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
221
221
|
type: z.ZodEnum<[import("@antelopejs/interface-dms-mailing").SendEventType, ...import("@antelopejs/interface-dms-mailing").SendEventType[]]>;
|
|
222
222
|
at: z.ZodDate;
|
|
223
|
-
details: z.ZodOptional<z.
|
|
223
|
+
details: z.ZodOptional<z.ZodEffects<z.ZodUnknown, import("@antelopejs/interface-dms-mailing").JsonObject, unknown>>;
|
|
224
224
|
}, "strip", z.ZodTypeAny, {
|
|
225
225
|
at: Date;
|
|
226
226
|
type: import("@antelopejs/interface-dms-mailing").SendEventType;
|
|
227
|
-
details?:
|
|
227
|
+
details?: import("@antelopejs/interface-dms-mailing").JsonObject | undefined;
|
|
228
228
|
}, {
|
|
229
229
|
at: Date;
|
|
230
230
|
type: import("@antelopejs/interface-dms-mailing").SendEventType;
|
|
231
|
-
details?:
|
|
231
|
+
details?: unknown;
|
|
232
232
|
}>, "many">>;
|
|
233
233
|
}, "strip", z.ZodTypeAny, {
|
|
234
234
|
to: string | {
|
|
@@ -237,11 +237,11 @@ export declare const sendImportSchema: z.ZodObject<{
|
|
|
237
237
|
};
|
|
238
238
|
templateSlug: string;
|
|
239
239
|
isTest: boolean;
|
|
240
|
-
variables:
|
|
240
|
+
variables: import("@antelopejs/interface-dms-mailing").JsonObject;
|
|
241
241
|
events: {
|
|
242
242
|
at: Date;
|
|
243
243
|
type: import("@antelopejs/interface-dms-mailing").SendEventType;
|
|
244
|
-
details?:
|
|
244
|
+
details?: import("@antelopejs/interface-dms-mailing").JsonObject | undefined;
|
|
245
245
|
}[];
|
|
246
246
|
importId: string;
|
|
247
247
|
sentAt: Date;
|
|
@@ -262,11 +262,11 @@ export declare const sendImportSchema: z.ZodObject<{
|
|
|
262
262
|
locale?: string | undefined;
|
|
263
263
|
providerMessageId?: string | undefined;
|
|
264
264
|
isTest?: boolean | undefined;
|
|
265
|
-
variables?:
|
|
265
|
+
variables?: unknown;
|
|
266
266
|
events?: {
|
|
267
267
|
at: Date;
|
|
268
268
|
type: import("@antelopejs/interface-dms-mailing").SendEventType;
|
|
269
|
-
details?:
|
|
269
|
+
details?: unknown;
|
|
270
270
|
}[] | undefined;
|
|
271
271
|
}>, "many">;
|
|
272
272
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -278,11 +278,11 @@ export declare const sendImportSchema: z.ZodObject<{
|
|
|
278
278
|
};
|
|
279
279
|
templateSlug: string;
|
|
280
280
|
isTest: boolean;
|
|
281
|
-
variables:
|
|
281
|
+
variables: import("@antelopejs/interface-dms-mailing").JsonObject;
|
|
282
282
|
events: {
|
|
283
283
|
at: Date;
|
|
284
284
|
type: import("@antelopejs/interface-dms-mailing").SendEventType;
|
|
285
|
-
details?:
|
|
285
|
+
details?: import("@antelopejs/interface-dms-mailing").JsonObject | undefined;
|
|
286
286
|
}[];
|
|
287
287
|
importId: string;
|
|
288
288
|
sentAt: Date;
|
|
@@ -306,11 +306,11 @@ export declare const sendImportSchema: z.ZodObject<{
|
|
|
306
306
|
locale?: string | undefined;
|
|
307
307
|
providerMessageId?: string | undefined;
|
|
308
308
|
isTest?: boolean | undefined;
|
|
309
|
-
variables?:
|
|
309
|
+
variables?: unknown;
|
|
310
310
|
events?: {
|
|
311
311
|
at: Date;
|
|
312
312
|
type: import("@antelopejs/interface-dms-mailing").SendEventType;
|
|
313
|
-
details?:
|
|
313
|
+
details?: unknown;
|
|
314
314
|
}[] | undefined;
|
|
315
315
|
}[];
|
|
316
316
|
}>;
|
|
@@ -7,6 +7,7 @@ const constants_1 = require("../constants");
|
|
|
7
7
|
const send_event_type_schema_1 = require("./send-event-type.schema");
|
|
8
8
|
const settings_schema_1 = require("./settings.schema");
|
|
9
9
|
const templates_schema_1 = require("./templates.schema");
|
|
10
|
+
const json_schema_1 = require("./json.schema");
|
|
10
11
|
const MAX_AUTHOR_LENGTH = constants_1.MAX_NAME_LENGTH;
|
|
11
12
|
const MAX_IMPORT_ID_LENGTH = 200;
|
|
12
13
|
const tenantIdSchema = zod_1.z.string().trim().min(1);
|
|
@@ -22,7 +23,7 @@ exports.templateDeclarationSchema = zod_1.z.object({
|
|
|
22
23
|
category: zod_1.z.string().trim().default(""),
|
|
23
24
|
content: templates_schema_1.templateContentSchema,
|
|
24
25
|
variables: templates_schema_1.variableListSchema.default([]),
|
|
25
|
-
testData:
|
|
26
|
+
testData: json_schema_1.jsonObjectSchema.default({}),
|
|
26
27
|
author: zod_1.z.string().trim().min(1).max(MAX_AUTHOR_LENGTH).optional(),
|
|
27
28
|
});
|
|
28
29
|
exports.categoryDeclarationSchema = settings_schema_1.categorySchema.extend({
|
|
@@ -46,7 +47,7 @@ const recipientSchema = zod_1.z.union([
|
|
|
46
47
|
const importedEventSchema = zod_1.z.object({
|
|
47
48
|
type: send_event_type_schema_1.sendEventTypeSchema,
|
|
48
49
|
at: zod_1.z.coerce.date(),
|
|
49
|
-
details:
|
|
50
|
+
details: json_schema_1.jsonObjectSchema.optional(),
|
|
50
51
|
});
|
|
51
52
|
const importedSendSchema = zod_1.z.object({
|
|
52
53
|
importId: zod_1.z.string().trim().min(1).max(MAX_IMPORT_ID_LENGTH),
|
|
@@ -54,7 +55,7 @@ const importedSendSchema = zod_1.z.object({
|
|
|
54
55
|
to: recipientSchema,
|
|
55
56
|
sentAt: zod_1.z.coerce.date(),
|
|
56
57
|
locale: zod_1.z.string().trim().min(1).optional(),
|
|
57
|
-
variables:
|
|
58
|
+
variables: json_schema_1.jsonObjectSchema.default({}),
|
|
58
59
|
provider: zod_1.z.string().optional(),
|
|
59
60
|
providerMessageId: zod_1.z.string().optional(),
|
|
60
61
|
source: zod_1.z.string().optional(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"declarations.schema.js","sourceRoot":"","sources":["../../src/validation/declarations.schema.ts"],"names":[],"mappings":";;;AAAA,6EAAmF;AACnF,6BAAwB;AACxB,4CAA+C;AAC/C,qEAA+D;AAC/D,uDAAmE;AACnE,yDAI4B;
|
|
1
|
+
{"version":3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;IACxB,EAAE,EAAE,eAAe;IACnB,MAAM,EAAE,OAAC,CAAC,MAAM,CAAC,IAAI,EAAE;IACvB,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IAC3C,SAAS,EAAE,8BAAgB,CAAC,OAAO,CAAC,EAAE,CAAC;IACvC,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC/B,iBAAiB,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACxC,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,MAAM,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;IAClC,MAAM,EAAE,OAAC,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;CACjD,CAAC,CAAC;AAIU,QAAA,gBAAgB,GAAG,OAAC,CAAC,MAAM,CAAC;IACvC,QAAQ,EAAE,cAAc;IACxB,KAAK,EAAE,OAAC,CAAC,KAAK,CAAC,kBAAkB,CAAC;CACnC,CAAC,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
export declare function isText(value: unknown): value is string;
|
|
2
|
-
export declare function isJsonObject(value: unknown): value is Record<string, unknown>;
|
|
3
2
|
export declare function isObject(value: unknown): value is Record<string, unknown>;
|
|
4
3
|
export declare function isNumber(value: unknown): value is number;
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isText = isText;
|
|
4
|
-
exports.isJsonObject = isJsonObject;
|
|
5
4
|
exports.isObject = isObject;
|
|
6
5
|
exports.isNumber = isNumber;
|
|
7
6
|
function isText(value) {
|
|
8
7
|
return typeof value === "string";
|
|
9
8
|
}
|
|
10
|
-
function isJsonObject(value) {
|
|
11
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
12
|
-
}
|
|
13
9
|
function isObject(value) {
|
|
14
10
|
return typeof value === "object" && value !== null;
|
|
15
11
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guards.js","sourceRoot":"","sources":["../../src/validation/guards.ts"],"names":[],"mappings":";;AACA,wBAEC;AAMD,
|
|
1
|
+
{"version":3,"file":"guards.js","sourceRoot":"","sources":["../../src/validation/guards.ts"],"names":[],"mappings":";;AACA,wBAEC;AAMD,4BAEC;AAGD,4BAEC;AAfD,SAAgB,MAAM,CAAC,KAAc;IACnC,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC;AACnC,CAAC;AAMD,SAAgB,QAAQ,CAAC,KAAc;IACrC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC;AACrD,CAAC;AAGD,SAAgB,QAAQ,CAAC,KAAc;IACrC,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC;AACnC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { JsonObject, JsonValue } from "../types/json";
|
|
2
|
+
export declare function isJsonValue(value: unknown): value is JsonValue;
|
|
3
|
+
export declare function isJsonObject(value: unknown): value is JsonObject;
|
|
4
|
+
export declare function parseJson(text: string): JsonValue;
|
|
5
|
+
export declare function parseJsonObject(text: string): JsonObject;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isJsonValue = isJsonValue;
|
|
4
|
+
exports.isJsonObject = isJsonObject;
|
|
5
|
+
exports.parseJson = parseJson;
|
|
6
|
+
exports.parseJsonObject = parseJsonObject;
|
|
7
|
+
const guards_1 = require("./guards");
|
|
8
|
+
function isJsonValue(value) {
|
|
9
|
+
const stack = [{ visit: value }];
|
|
10
|
+
const ancestors = new Set();
|
|
11
|
+
for (let step = stack.pop(); step; step = stack.pop()) {
|
|
12
|
+
if ("leave" in step) {
|
|
13
|
+
ancestors.delete(step.leave);
|
|
14
|
+
continue;
|
|
15
|
+
}
|
|
16
|
+
const item = step.visit;
|
|
17
|
+
if (item === null ||
|
|
18
|
+
(0, guards_1.isText)(item) ||
|
|
19
|
+
(0, guards_1.isNumber)(item) ||
|
|
20
|
+
typeof item === "boolean")
|
|
21
|
+
continue;
|
|
22
|
+
if (typeof item !== "object" || ancestors.has(item))
|
|
23
|
+
return false;
|
|
24
|
+
const prototype = Object.getPrototypeOf(item);
|
|
25
|
+
if (!Array.isArray(item) &&
|
|
26
|
+
prototype !== Object.prototype &&
|
|
27
|
+
prototype !== null)
|
|
28
|
+
return false;
|
|
29
|
+
ancestors.add(item);
|
|
30
|
+
stack.push({ leave: item });
|
|
31
|
+
for (const child of Object.values(item))
|
|
32
|
+
stack.push({ visit: child });
|
|
33
|
+
}
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
function isJsonObject(value) {
|
|
37
|
+
return (typeof value === "object" &&
|
|
38
|
+
value !== null &&
|
|
39
|
+
!Array.isArray(value) &&
|
|
40
|
+
isJsonValue(value));
|
|
41
|
+
}
|
|
42
|
+
function parseJson(text) {
|
|
43
|
+
const parsed = JSON.parse(text);
|
|
44
|
+
if (!isJsonValue(parsed))
|
|
45
|
+
throw new TypeError("expected JSON data");
|
|
46
|
+
return parsed;
|
|
47
|
+
}
|
|
48
|
+
function parseJsonObject(text) {
|
|
49
|
+
const parsed = parseJson(text);
|
|
50
|
+
if (!(0, guards_1.isObject)(parsed) || Array.isArray(parsed))
|
|
51
|
+
throw new TypeError("expected a JSON object");
|
|
52
|
+
return parsed;
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=json.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json.js","sourceRoot":"","sources":["../../src/validation/json.ts"],"names":[],"mappings":";;AAWA,kCA6BC;AAGD,oCAOC;AAGD,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CAAC;AAGD,SAAgB,YAAY,CAAC,KAAc;IACzC,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QACrB,WAAW,CAAC,KAAK,CAAC,CACnB,CAAC;AACJ,CAAC;AAGD,SAAgB,SAAS,CAAC,IAAY;IACpC,MAAM,MAAM,GAAY,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACzC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC;QAAE,MAAM,IAAI,SAAS,CAAC,oBAAoB,CAAC,CAAC;IACpE,OAAO,MAAM,CAAC;AAChB,CAAC;AAGD,SAAgB,eAAe,CAAC,IAAY;IAC1C,MAAM,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;IAC/B,IAAI,CAAC,IAAA,iBAAQ,EAAC,MAAM,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;QAC5C,MAAM,IAAI,SAAS,CAAC,wBAAwB,CAAC,CAAC;IAChD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.jsonObjectSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const json_1 = require("./json");
|
|
6
|
+
exports.jsonObjectSchema = zod_1.z
|
|
7
|
+
.unknown()
|
|
8
|
+
.refine(json_1.isJsonObject, "expected a JSON object");
|
|
9
|
+
//# sourceMappingURL=json.schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json.schema.js","sourceRoot":"","sources":["../../src/validation/json.schema.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,iCAAsC;AAGzB,QAAA,gBAAgB,GAAG,OAAC;KAC9B,OAAO,EAAE;KACT,MAAM,CAAC,mBAAY,EAAE,wBAAwB,CAAC,CAAC"}
|
|
@@ -95,12 +95,12 @@ export declare const variableSchema: z.ZodObject<{
|
|
|
95
95
|
type: z.ZodEnum<["string", "text", "number", "money", "date", "url", "boolean", "array"]>;
|
|
96
96
|
required: z.ZodBoolean;
|
|
97
97
|
}, "strip", z.ZodTypeAny, {
|
|
98
|
+
type: "string" | "number" | "boolean" | "text" | "date" | "array" | "url" | "money";
|
|
98
99
|
path: string;
|
|
99
|
-
type: "string" | "number" | "boolean" | "date" | "array" | "url" | "money" | "text";
|
|
100
100
|
required: boolean;
|
|
101
101
|
}, {
|
|
102
|
+
type: "string" | "number" | "boolean" | "text" | "date" | "array" | "url" | "money";
|
|
102
103
|
path: string;
|
|
103
|
-
type: "string" | "number" | "boolean" | "date" | "array" | "url" | "money" | "text";
|
|
104
104
|
required: boolean;
|
|
105
105
|
}>;
|
|
106
106
|
export declare const variableListSchema: z.ZodArray<z.ZodObject<{
|
|
@@ -108,12 +108,12 @@ export declare const variableListSchema: z.ZodArray<z.ZodObject<{
|
|
|
108
108
|
type: z.ZodEnum<["string", "text", "number", "money", "date", "url", "boolean", "array"]>;
|
|
109
109
|
required: z.ZodBoolean;
|
|
110
110
|
}, "strip", z.ZodTypeAny, {
|
|
111
|
+
type: "string" | "number" | "boolean" | "text" | "date" | "array" | "url" | "money";
|
|
111
112
|
path: string;
|
|
112
|
-
type: "string" | "number" | "boolean" | "date" | "array" | "url" | "money" | "text";
|
|
113
113
|
required: boolean;
|
|
114
114
|
}, {
|
|
115
|
+
type: "string" | "number" | "boolean" | "text" | "date" | "array" | "url" | "money";
|
|
115
116
|
path: string;
|
|
116
|
-
type: "string" | "number" | "boolean" | "date" | "array" | "url" | "money" | "text";
|
|
117
117
|
required: boolean;
|
|
118
118
|
}>, "many">;
|
|
119
119
|
export declare const variablesSchema: z.ZodObject<{
|
|
@@ -122,26 +122,26 @@ export declare const variablesSchema: z.ZodObject<{
|
|
|
122
122
|
type: z.ZodEnum<["string", "text", "number", "money", "date", "url", "boolean", "array"]>;
|
|
123
123
|
required: z.ZodBoolean;
|
|
124
124
|
}, "strip", z.ZodTypeAny, {
|
|
125
|
+
type: "string" | "number" | "boolean" | "text" | "date" | "array" | "url" | "money";
|
|
125
126
|
path: string;
|
|
126
|
-
type: "string" | "number" | "boolean" | "date" | "array" | "url" | "money" | "text";
|
|
127
127
|
required: boolean;
|
|
128
128
|
}, {
|
|
129
|
+
type: "string" | "number" | "boolean" | "text" | "date" | "array" | "url" | "money";
|
|
129
130
|
path: string;
|
|
130
|
-
type: "string" | "number" | "boolean" | "date" | "array" | "url" | "money" | "text";
|
|
131
131
|
required: boolean;
|
|
132
132
|
}>, "many">;
|
|
133
133
|
revision: z.ZodOptional<z.ZodNumber>;
|
|
134
134
|
}, "strip", z.ZodTypeAny, {
|
|
135
135
|
variables: {
|
|
136
|
+
type: "string" | "number" | "boolean" | "text" | "date" | "array" | "url" | "money";
|
|
136
137
|
path: string;
|
|
137
|
-
type: "string" | "number" | "boolean" | "date" | "array" | "url" | "money" | "text";
|
|
138
138
|
required: boolean;
|
|
139
139
|
}[];
|
|
140
140
|
revision?: number | undefined;
|
|
141
141
|
}, {
|
|
142
142
|
variables: {
|
|
143
|
+
type: "string" | "number" | "boolean" | "text" | "date" | "array" | "url" | "money";
|
|
143
144
|
path: string;
|
|
144
|
-
type: "string" | "number" | "boolean" | "date" | "array" | "url" | "money" | "text";
|
|
145
145
|
required: boolean;
|
|
146
146
|
}[];
|
|
147
147
|
revision?: number | undefined;
|
|
@@ -179,12 +179,12 @@ export declare const saveContentSchema: z.ZodObject<{
|
|
|
179
179
|
type: z.ZodEnum<["string", "text", "number", "money", "date", "url", "boolean", "array"]>;
|
|
180
180
|
required: z.ZodBoolean;
|
|
181
181
|
}, "strip", z.ZodTypeAny, {
|
|
182
|
+
type: "string" | "number" | "boolean" | "text" | "date" | "array" | "url" | "money";
|
|
182
183
|
path: string;
|
|
183
|
-
type: "string" | "number" | "boolean" | "date" | "array" | "url" | "money" | "text";
|
|
184
184
|
required: boolean;
|
|
185
185
|
}, {
|
|
186
|
+
type: "string" | "number" | "boolean" | "text" | "date" | "array" | "url" | "money";
|
|
186
187
|
path: string;
|
|
187
|
-
type: "string" | "number" | "boolean" | "date" | "array" | "url" | "money" | "text";
|
|
188
188
|
required: boolean;
|
|
189
189
|
}>, "many">>;
|
|
190
190
|
revision: z.ZodOptional<z.ZodNumber>;
|
|
@@ -198,8 +198,8 @@ export declare const saveContentSchema: z.ZodObject<{
|
|
|
198
198
|
};
|
|
199
199
|
revision?: number | undefined;
|
|
200
200
|
variables?: {
|
|
201
|
+
type: "string" | "number" | "boolean" | "text" | "date" | "array" | "url" | "money";
|
|
201
202
|
path: string;
|
|
202
|
-
type: "string" | "number" | "boolean" | "date" | "array" | "url" | "money" | "text";
|
|
203
203
|
required: boolean;
|
|
204
204
|
}[] | undefined;
|
|
205
205
|
}, {
|
|
@@ -212,17 +212,17 @@ export declare const saveContentSchema: z.ZodObject<{
|
|
|
212
212
|
};
|
|
213
213
|
revision?: number | undefined;
|
|
214
214
|
variables?: {
|
|
215
|
+
type: "string" | "number" | "boolean" | "text" | "date" | "array" | "url" | "money";
|
|
215
216
|
path: string;
|
|
216
|
-
type: "string" | "number" | "boolean" | "date" | "array" | "url" | "money" | "text";
|
|
217
217
|
required: boolean;
|
|
218
218
|
}[] | undefined;
|
|
219
219
|
}>;
|
|
220
220
|
export declare const testDataSchema: z.ZodObject<{
|
|
221
|
-
data: z.
|
|
221
|
+
data: z.ZodEffects<z.ZodUnknown, import("@antelopejs/interface-dms-mailing").JsonObject, unknown>;
|
|
222
222
|
}, "strip", z.ZodTypeAny, {
|
|
223
|
-
data:
|
|
223
|
+
data: import("@antelopejs/interface-dms-mailing").JsonObject;
|
|
224
224
|
}, {
|
|
225
|
-
data
|
|
225
|
+
data?: unknown;
|
|
226
226
|
}>;
|
|
227
227
|
export declare const previewVersionSchema: z.ZodUnion<[z.ZodLiteral<"draft">, z.ZodLiteral<"published">, z.ZodNumber]>;
|
|
228
228
|
export declare const previewSchema: z.ZodObject<{
|
|
@@ -255,9 +255,10 @@ export declare const previewSchema: z.ZodObject<{
|
|
|
255
255
|
blocks: unknown[];
|
|
256
256
|
}>;
|
|
257
257
|
}>>;
|
|
258
|
-
data: z.ZodOptional<z.
|
|
258
|
+
data: z.ZodOptional<z.ZodEffects<z.ZodUnknown, import("@antelopejs/interface-dms-mailing").JsonObject, unknown>>;
|
|
259
259
|
}, "strip", z.ZodTypeAny, {
|
|
260
260
|
version?: number | "draft" | "published" | undefined;
|
|
261
|
+
data?: import("@antelopejs/interface-dms-mailing").JsonObject | undefined;
|
|
261
262
|
content?: {
|
|
262
263
|
locales: Record<string, {
|
|
263
264
|
subject: string;
|
|
@@ -265,10 +266,10 @@ export declare const previewSchema: z.ZodObject<{
|
|
|
265
266
|
blocks: Block[];
|
|
266
267
|
}>;
|
|
267
268
|
} | undefined;
|
|
268
|
-
data?: Record<string, unknown> | undefined;
|
|
269
269
|
locale?: string | undefined;
|
|
270
270
|
}, {
|
|
271
271
|
version?: number | "draft" | "published" | undefined;
|
|
272
|
+
data?: unknown;
|
|
272
273
|
content?: {
|
|
273
274
|
locales: Record<string, {
|
|
274
275
|
subject: string;
|
|
@@ -276,20 +277,19 @@ export declare const previewSchema: z.ZodObject<{
|
|
|
276
277
|
blocks: unknown[];
|
|
277
278
|
}>;
|
|
278
279
|
} | undefined;
|
|
279
|
-
data?: Record<string, unknown> | undefined;
|
|
280
280
|
locale?: string | undefined;
|
|
281
281
|
}>;
|
|
282
282
|
export declare const realSendSchema: z.ZodObject<{
|
|
283
283
|
to: z.ZodArray<z.ZodString, "many">;
|
|
284
284
|
locale: z.ZodOptional<z.ZodString>;
|
|
285
|
-
data: z.ZodOptional<z.
|
|
285
|
+
data: z.ZodOptional<z.ZodEffects<z.ZodUnknown, import("@antelopejs/interface-dms-mailing").JsonObject, unknown>>;
|
|
286
286
|
}, "strip", z.ZodTypeAny, {
|
|
287
287
|
to: string[];
|
|
288
|
-
data?:
|
|
288
|
+
data?: import("@antelopejs/interface-dms-mailing").JsonObject | undefined;
|
|
289
289
|
locale?: string | undefined;
|
|
290
290
|
}, {
|
|
291
291
|
to: string[];
|
|
292
|
-
data?:
|
|
292
|
+
data?: unknown;
|
|
293
293
|
locale?: string | undefined;
|
|
294
294
|
}>;
|
|
295
295
|
export declare const testSendSchema: z.ZodObject<{
|
|
@@ -322,12 +322,13 @@ export declare const testSendSchema: z.ZodObject<{
|
|
|
322
322
|
blocks: unknown[];
|
|
323
323
|
}>;
|
|
324
324
|
}>>;
|
|
325
|
-
data: z.ZodOptional<z.
|
|
325
|
+
data: z.ZodOptional<z.ZodEffects<z.ZodUnknown, import("@antelopejs/interface-dms-mailing").JsonObject, unknown>>;
|
|
326
326
|
} & {
|
|
327
327
|
to: z.ZodArray<z.ZodString, "many">;
|
|
328
328
|
}, "strip", z.ZodTypeAny, {
|
|
329
329
|
to: string[];
|
|
330
330
|
version?: number | "draft" | "published" | undefined;
|
|
331
|
+
data?: import("@antelopejs/interface-dms-mailing").JsonObject | undefined;
|
|
331
332
|
content?: {
|
|
332
333
|
locales: Record<string, {
|
|
333
334
|
subject: string;
|
|
@@ -335,11 +336,11 @@ export declare const testSendSchema: z.ZodObject<{
|
|
|
335
336
|
blocks: Block[];
|
|
336
337
|
}>;
|
|
337
338
|
} | undefined;
|
|
338
|
-
data?: Record<string, unknown> | undefined;
|
|
339
339
|
locale?: string | undefined;
|
|
340
340
|
}, {
|
|
341
341
|
to: string[];
|
|
342
342
|
version?: number | "draft" | "published" | undefined;
|
|
343
|
+
data?: unknown;
|
|
343
344
|
content?: {
|
|
344
345
|
locales: Record<string, {
|
|
345
346
|
subject: string;
|
|
@@ -347,7 +348,6 @@ export declare const testSendSchema: z.ZodObject<{
|
|
|
347
348
|
blocks: unknown[];
|
|
348
349
|
}>;
|
|
349
350
|
} | undefined;
|
|
350
|
-
data?: Record<string, unknown> | undefined;
|
|
351
351
|
locale?: string | undefined;
|
|
352
352
|
}>;
|
|
353
353
|
export declare const templateDetailsSchema: z.ZodObject<{
|
|
@@ -363,6 +363,7 @@ export declare const templateDetailsSchema: z.ZodObject<{
|
|
|
363
363
|
category?: string | null | undefined;
|
|
364
364
|
slug?: string | undefined;
|
|
365
365
|
}>;
|
|
366
|
+
export type TemplateDetails = z.infer<typeof templateDetailsSchema>;
|
|
366
367
|
export declare const duplicateSchema: z.ZodObject<{
|
|
367
368
|
slug: z.ZodString;
|
|
368
369
|
name: z.ZodString;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.replayFailedSchema = exports.replaySchema = exports.duplicateSchema = exports.templateDetailsSchema = exports.testSendSchema = exports.realSendSchema = exports.previewSchema = exports.previewVersionSchema = exports.testDataSchema = exports.saveContentSchema = exports.variablesSchema = exports.variableListSchema = exports.variableSchema = exports.versionNumberSchema = exports.restoreVersionSchema = exports.publishSchema = exports.draftRevisionSchema = exports.templateContentSchema = exports.localeContentSchema = exports.blockSchema = exports.conditionSchema = exports.createTemplateSchema = exports.slugSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const constants_1 = require("../constants");
|
|
6
|
+
const json_schema_1 = require("./json.schema");
|
|
6
7
|
const MIN_HEADING_SIZE = 12;
|
|
7
8
|
const MAX_HEADING_SIZE = 48;
|
|
8
9
|
const MAX_TEST_RECIPIENT_COUNT = 5;
|
|
@@ -119,7 +120,7 @@ exports.saveContentSchema = zod_1.z.object({
|
|
|
119
120
|
variables: exports.variableListSchema.optional(),
|
|
120
121
|
revision: exports.draftRevisionSchema,
|
|
121
122
|
});
|
|
122
|
-
exports.testDataSchema = zod_1.z.object({ data:
|
|
123
|
+
exports.testDataSchema = zod_1.z.object({ data: json_schema_1.jsonObjectSchema });
|
|
123
124
|
exports.previewVersionSchema = zod_1.z.union([
|
|
124
125
|
zod_1.z.literal("draft"),
|
|
125
126
|
zod_1.z.literal("published"),
|
|
@@ -129,12 +130,12 @@ exports.previewSchema = zod_1.z.object({
|
|
|
129
130
|
locale: zod_1.z.string().min(1).optional(),
|
|
130
131
|
version: exports.previewVersionSchema.optional(),
|
|
131
132
|
content: exports.templateContentSchema.optional(),
|
|
132
|
-
data:
|
|
133
|
+
data: json_schema_1.jsonObjectSchema.optional(),
|
|
133
134
|
});
|
|
134
135
|
exports.realSendSchema = zod_1.z.object({
|
|
135
136
|
to: zod_1.z.array(zod_1.z.string().email()).min(1).max(MAX_TEST_RECIPIENT_COUNT),
|
|
136
137
|
locale: zod_1.z.string().min(1).optional(),
|
|
137
|
-
data:
|
|
138
|
+
data: json_schema_1.jsonObjectSchema.optional(),
|
|
138
139
|
});
|
|
139
140
|
exports.testSendSchema = exports.previewSchema.extend({
|
|
140
141
|
to: zod_1.z.array(zod_1.z.string().email()).min(1).max(MAX_TEST_RECIPIENT_COUNT),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.schema.js","sourceRoot":"","sources":["../../src/validation/templates.schema.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,4CAA8E;
|
|
1
|
+
{"version":3,"file":"templates.schema.js","sourceRoot":"","sources":["../../src/validation/templates.schema.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,4CAA8E;AAE9E,+CAAiD;AAEjD,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAC5B,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAC5B,MAAM,wBAAwB,GAAG,CAAC,CAAC;AAEtB,QAAA,UAAU,GAAG,OAAC;KACxB,MAAM,EAAE;KACR,IAAI,EAAE;KACN,GAAG,CAAC,CAAC,CAAC;KACN,GAAG,CAAC,2BAAe,CAAC;KACpB,KAAK,CAAC,wBAAY,CAAC,CAAC;AAEV,QAAA,oBAAoB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC3C,IAAI,EAAE,kBAAU;IAChB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,C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