@tbs-fitness/contract 0.3.0 → 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/README.md CHANGED
@@ -41,6 +41,17 @@ const result = createFlagSchema.safeParse(input); // The same rules as the API.
41
41
 
42
42
  Requests have two types. Clients use `*Input`, where fields with a default are optional. The backend uses `*Body`, which is the result after validation. List queries come from the URL as strings, so they have no `*Input`: use `Partial<PaginationQuery>` or `Partial<AuditLogQuery>`.
43
43
 
44
+ ## Version 0.4.0
45
+
46
+ Communication and runtime settings. Additive; consumers install `^0.4.0` explicitly.
47
+
48
+ - `/enums`: `COMMUNICATION_CHANNELS` (`EMAIL`, `SMS`), `MESSAGE_TYPES`, `DELIVERY_STATUSES` and `TEMPLATE_STATUSES`.
49
+ - New `/communication`:
50
+ - `MESSAGE_CATALOGUE`: per message type, the channels that may carry it, the default switches, and the variables its sender supplies, with the required ones.
51
+ - `templatePlaceholders`, `hasMalformedPlaceholder` and `templateProblems`, the template rules shared by the server and the admin editor.
52
+ - `createTemplateSchema`, `templateResponseSchema`, `previewTemplateSchema`, `renderedMessageSchema`, `testSendResponseSchema` and `messageTypeResponseSchema`.
53
+ - New `/app-settings`: `APP_SETTING_KEYS`, a value schema and default per key (`communication.channels` master switches, `communication.messages` per type and channel), plus `appSettingResponseSchema`, `updateAppSettingSchema` (`{ value, version }`) and `appSettingHistoryResponseSchema`.
54
+
44
55
  ## Version 0.3.0
45
56
 
46
57
  Time zones and the platform's date and time rules. Additive, but a caret range on 0.x does not cross minor versions, so consumers install `^0.3.0` explicitly.
@@ -0,0 +1,124 @@
1
+ import { z } from 'zod';
2
+ import { type MessageType } from '../enums/index.js';
3
+ /**
4
+ * Runtime settings an administrator changes without a deploy. Each key has a
5
+ * value schema here, which both the server and the admin screen use. A key
6
+ * with no saved value uses its default.
7
+ */
8
+ export declare const APP_SETTING_KEYS: readonly ["communication.channels", "communication.messages"];
9
+ export type AppSettingKey = (typeof APP_SETTING_KEYS)[number];
10
+ /** A switch per channel. */
11
+ export declare const channelSwitchesSchema: z.ZodObject<{
12
+ EMAIL: z.ZodBoolean;
13
+ SMS: z.ZodBoolean;
14
+ }, z.core.$strict>;
15
+ export type ChannelSwitches = z.output<typeof channelSwitchesSchema>;
16
+ /**
17
+ * Master switches: a channel switched off here sends nothing, whatever the
18
+ * per-message settings say.
19
+ */
20
+ export declare const communicationChannelsSettingSchema: z.ZodObject<{
21
+ EMAIL: z.ZodBoolean;
22
+ SMS: z.ZodBoolean;
23
+ }, z.core.$strict>;
24
+ /**
25
+ * Per message type and channel. A type missing from a saved value uses its
26
+ * catalogue defaults, so a newly added message type needs no data change.
27
+ */
28
+ export declare const communicationMessagesSettingSchema: z.ZodRecord<z.ZodEnum<{
29
+ "auth.otp.signup_verification": "auth.otp.signup_verification";
30
+ "auth.otp.password_reset": "auth.otp.password_reset";
31
+ "auth.password_reset_link": "auth.password_reset_link";
32
+ }> & z.core.$partial, z.ZodObject<{
33
+ EMAIL: z.ZodBoolean;
34
+ SMS: z.ZodBoolean;
35
+ }, z.core.$strict>>;
36
+ export type CommunicationMessagesSetting = z.output<typeof communicationMessagesSettingSchema>;
37
+ export declare const APP_SETTING_VALUE_SCHEMAS: {
38
+ readonly 'communication.channels': z.ZodObject<{
39
+ EMAIL: z.ZodBoolean;
40
+ SMS: z.ZodBoolean;
41
+ }, z.core.$strict>;
42
+ readonly 'communication.messages': z.ZodRecord<z.ZodEnum<{
43
+ "auth.otp.signup_verification": "auth.otp.signup_verification";
44
+ "auth.otp.password_reset": "auth.otp.password_reset";
45
+ "auth.password_reset_link": "auth.password_reset_link";
46
+ }> & z.core.$partial, z.ZodObject<{
47
+ EMAIL: z.ZodBoolean;
48
+ SMS: z.ZodBoolean;
49
+ }, z.core.$strict>>;
50
+ };
51
+ export interface AppSettingValues {
52
+ 'communication.channels': ChannelSwitches;
53
+ 'communication.messages': CommunicationMessagesSetting;
54
+ }
55
+ /** Every message type, with its catalogue defaults: the effective value with nothing saved. */
56
+ export declare function defaultMessageSettings(): Record<MessageType, ChannelSwitches>;
57
+ export declare const APP_SETTING_DEFAULTS: AppSettingValues;
58
+ export declare const appSettingKeyParamSchema: z.ZodEnum<{
59
+ "communication.channels": "communication.channels";
60
+ "communication.messages": "communication.messages";
61
+ }>;
62
+ export declare const appSettingResponseSchema: z.ZodObject<{
63
+ key: z.ZodEnum<{
64
+ "communication.channels": "communication.channels";
65
+ "communication.messages": "communication.messages";
66
+ }>;
67
+ label: z.ZodString;
68
+ description: z.ZodString;
69
+ value: z.ZodUnknown;
70
+ defaultValue: z.ZodUnknown;
71
+ version: z.ZodNumber;
72
+ updatedBy: z.ZodNullable<z.ZodUUID>;
73
+ updatedAt: z.ZodNullable<z.ZodISODateTime>;
74
+ }, z.core.$strip>;
75
+ export type AppSettingResponse = z.output<typeof appSettingResponseSchema>;
76
+ export declare const appSettingListResponseSchema: z.ZodArray<z.ZodObject<{
77
+ key: z.ZodEnum<{
78
+ "communication.channels": "communication.channels";
79
+ "communication.messages": "communication.messages";
80
+ }>;
81
+ label: z.ZodString;
82
+ description: z.ZodString;
83
+ value: z.ZodUnknown;
84
+ defaultValue: z.ZodUnknown;
85
+ version: z.ZodNumber;
86
+ updatedBy: z.ZodNullable<z.ZodUUID>;
87
+ updatedAt: z.ZodNullable<z.ZodISODateTime>;
88
+ }, z.core.$strip>>;
89
+ /**
90
+ * Replaces a setting's value. `version` must be the one last read, so a
91
+ * change made in between is not silently overwritten. The value is checked
92
+ * against the key's schema on the server.
93
+ */
94
+ export declare const updateAppSettingSchema: z.ZodObject<{
95
+ value: z.ZodUnknown;
96
+ version: z.ZodNumber;
97
+ }, z.core.$strict>;
98
+ export type UpdateAppSettingInput = z.input<typeof updateAppSettingSchema>;
99
+ export type UpdateAppSettingBody = z.output<typeof updateAppSettingSchema>;
100
+ export declare const appSettingHistoryEntrySchema: z.ZodObject<{
101
+ id: z.ZodUUID;
102
+ key: z.ZodEnum<{
103
+ "communication.channels": "communication.channels";
104
+ "communication.messages": "communication.messages";
105
+ }>;
106
+ previousValue: z.ZodUnknown;
107
+ newValue: z.ZodUnknown;
108
+ version: z.ZodNumber;
109
+ actorUserId: z.ZodUUID;
110
+ createdAt: z.ZodISODateTime;
111
+ }, z.core.$strip>;
112
+ export type AppSettingHistoryEntry = z.output<typeof appSettingHistoryEntrySchema>;
113
+ export declare const appSettingHistoryResponseSchema: z.ZodArray<z.ZodObject<{
114
+ id: z.ZodUUID;
115
+ key: z.ZodEnum<{
116
+ "communication.channels": "communication.channels";
117
+ "communication.messages": "communication.messages";
118
+ }>;
119
+ previousValue: z.ZodUnknown;
120
+ newValue: z.ZodUnknown;
121
+ version: z.ZodNumber;
122
+ actorUserId: z.ZodUUID;
123
+ createdAt: z.ZodISODateTime;
124
+ }, z.core.$strip>>;
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.appSettingHistoryResponseSchema = exports.appSettingHistoryEntrySchema = exports.updateAppSettingSchema = exports.appSettingListResponseSchema = exports.appSettingResponseSchema = exports.appSettingKeyParamSchema = exports.APP_SETTING_DEFAULTS = exports.APP_SETTING_VALUE_SCHEMAS = exports.communicationMessagesSettingSchema = exports.communicationChannelsSettingSchema = exports.channelSwitchesSchema = exports.APP_SETTING_KEYS = void 0;
4
+ exports.defaultMessageSettings = defaultMessageSettings;
5
+ const zod_1 = require("zod");
6
+ const date_time_schema_js_1 = require("../common/date-time.schema.js");
7
+ const message_catalogue_js_1 = require("../communication/message-catalogue.js");
8
+ const index_js_1 = require("../enums/index.js");
9
+ /**
10
+ * Runtime settings an administrator changes without a deploy. Each key has a
11
+ * value schema here, which both the server and the admin screen use. A key
12
+ * with no saved value uses its default.
13
+ */
14
+ exports.APP_SETTING_KEYS = [
15
+ 'communication.channels',
16
+ 'communication.messages',
17
+ ];
18
+ /** A switch per channel. */
19
+ exports.channelSwitchesSchema = zod_1.z.strictObject({
20
+ EMAIL: zod_1.z.boolean(),
21
+ SMS: zod_1.z.boolean(),
22
+ });
23
+ /**
24
+ * Master switches: a channel switched off here sends nothing, whatever the
25
+ * per-message settings say.
26
+ */
27
+ exports.communicationChannelsSettingSchema = exports.channelSwitchesSchema;
28
+ /**
29
+ * Per message type and channel. A type missing from a saved value uses its
30
+ * catalogue defaults, so a newly added message type needs no data change.
31
+ */
32
+ exports.communicationMessagesSettingSchema = zod_1.z
33
+ .partialRecord(zod_1.z.enum(index_js_1.MESSAGE_TYPES), exports.channelSwitchesSchema)
34
+ .superRefine((value, ctx) => {
35
+ for (const [type, switches] of Object.entries(value)) {
36
+ const allowed = message_catalogue_js_1.MESSAGE_CATALOGUE[type].channels;
37
+ for (const [channel, on] of Object.entries(switches ?? {})) {
38
+ if (on && !allowed.includes(channel)) {
39
+ ctx.addIssue({
40
+ code: 'custom',
41
+ path: [type, channel],
42
+ message: `${message_catalogue_js_1.MESSAGE_CATALOGUE[type].label} cannot be sent by ${channel}`,
43
+ });
44
+ }
45
+ }
46
+ }
47
+ });
48
+ exports.APP_SETTING_VALUE_SCHEMAS = {
49
+ 'communication.channels': exports.communicationChannelsSettingSchema,
50
+ 'communication.messages': exports.communicationMessagesSettingSchema,
51
+ };
52
+ /** Every message type, with its catalogue defaults: the effective value with nothing saved. */
53
+ function defaultMessageSettings() {
54
+ return Object.fromEntries(index_js_1.MESSAGE_TYPES.map((type) => [
55
+ type,
56
+ { ...message_catalogue_js_1.MESSAGE_CATALOGUE[type].defaultChannels },
57
+ ]));
58
+ }
59
+ exports.APP_SETTING_DEFAULTS = {
60
+ 'communication.channels': { EMAIL: true, SMS: true },
61
+ 'communication.messages': defaultMessageSettings(),
62
+ };
63
+ exports.appSettingKeyParamSchema = zod_1.z.enum(exports.APP_SETTING_KEYS);
64
+ exports.appSettingResponseSchema = zod_1.z.object({
65
+ key: zod_1.z.enum(exports.APP_SETTING_KEYS),
66
+ label: zod_1.z.string(),
67
+ description: zod_1.z.string(),
68
+ value: zod_1.z.unknown(),
69
+ defaultValue: zod_1.z.unknown(),
70
+ /** 0 until the setting is first saved. Send it back to update. */
71
+ version: zod_1.z.number().int(),
72
+ updatedBy: zod_1.z.uuid().nullable(),
73
+ updatedAt: date_time_schema_js_1.utcTimestampSchema.nullable(),
74
+ });
75
+ exports.appSettingListResponseSchema = zod_1.z.array(exports.appSettingResponseSchema);
76
+ /**
77
+ * Replaces a setting's value. `version` must be the one last read, so a
78
+ * change made in between is not silently overwritten. The value is checked
79
+ * against the key's schema on the server.
80
+ */
81
+ exports.updateAppSettingSchema = zod_1.z.strictObject({
82
+ value: zod_1.z.unknown(),
83
+ version: zod_1.z.number().int().min(0),
84
+ });
85
+ exports.appSettingHistoryEntrySchema = zod_1.z.object({
86
+ id: zod_1.z.uuid(),
87
+ key: zod_1.z.enum(exports.APP_SETTING_KEYS),
88
+ previousValue: zod_1.z.unknown(),
89
+ newValue: zod_1.z.unknown(),
90
+ version: zod_1.z.number().int(),
91
+ actorUserId: zod_1.z.uuid(),
92
+ createdAt: date_time_schema_js_1.utcTimestampSchema,
93
+ });
94
+ exports.appSettingHistoryResponseSchema = zod_1.z.array(exports.appSettingHistoryEntrySchema);
@@ -0,0 +1 @@
1
+ export * from './app-settings.dto.js';
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./app-settings.dto.js"), exports);
@@ -0,0 +1,2 @@
1
+ export * from './message-catalogue.js';
2
+ export * from './template.dto.js';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./message-catalogue.js"), exports);
18
+ __exportStar(require("./template.dto.js"), exports);
@@ -0,0 +1,26 @@
1
+ import type { CommunicationChannel, MessageType } from '../enums/index.js';
2
+ /**
3
+ * What the platform knows about each message type: the channels that may carry
4
+ * it, the channels switched on by default, and the variables its sender
5
+ * supplies. A template may only use supplied variables, and must use the
6
+ * required ones, so an admin can never activate a template the system cannot
7
+ * fill.
8
+ */
9
+ export interface MessageTypeDefinition {
10
+ label: string;
11
+ description: string;
12
+ channels: readonly CommunicationChannel[];
13
+ defaultChannels: Readonly<Record<CommunicationChannel, boolean>>;
14
+ /** Every variable the sender passes, with a sample value for previews. */
15
+ variables: Readonly<Record<string, {
16
+ description: string;
17
+ example: string;
18
+ }>>;
19
+ /** Variables every template for this type must use. */
20
+ requiredVariables: readonly string[];
21
+ }
22
+ export declare const MESSAGE_CATALOGUE: Readonly<Record<MessageType, MessageTypeDefinition>>;
23
+ /** The longest SMS body a template may have: four concatenated GSM-7 segments. */
24
+ export declare const MAX_SMS_LENGTH = 612;
25
+ /** One GSM-7 segment. Longer messages are split and cost more. */
26
+ export declare const SMS_SEGMENT_LENGTH = 160;
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SMS_SEGMENT_LENGTH = exports.MAX_SMS_LENGTH = exports.MESSAGE_CATALOGUE = void 0;
4
+ const OTP_VARIABLES = {
5
+ code: { description: 'The one-time code', example: '482915' },
6
+ fullName: { description: "The recipient's name", example: 'Biki Singh' },
7
+ expiresInMinutes: {
8
+ description: 'Minutes until the code expires',
9
+ example: '10',
10
+ },
11
+ appName: { description: 'The product name', example: 'TBS' },
12
+ };
13
+ exports.MESSAGE_CATALOGUE = {
14
+ 'auth.otp.signup_verification': {
15
+ label: 'Sign-up verification code',
16
+ description: 'Sent when a coach signs up, to verify their email address.',
17
+ channels: ['EMAIL', 'SMS'],
18
+ defaultChannels: { EMAIL: true, SMS: false },
19
+ variables: OTP_VARIABLES,
20
+ requiredVariables: ['code'],
21
+ },
22
+ 'auth.otp.password_reset': {
23
+ label: 'Password recovery code',
24
+ description: 'Sent when a coach asks to reset a forgotten password.',
25
+ channels: ['EMAIL', 'SMS'],
26
+ defaultChannels: { EMAIL: true, SMS: false },
27
+ variables: OTP_VARIABLES,
28
+ requiredVariables: ['code'],
29
+ },
30
+ 'auth.password_reset_link': {
31
+ label: 'Password reset link',
32
+ description: 'Sent when an administrator account requests a reset link.',
33
+ channels: ['EMAIL'],
34
+ defaultChannels: { EMAIL: true, SMS: false },
35
+ variables: {
36
+ resetUrl: {
37
+ description: 'The single-use reset link',
38
+ example: 'https://app.example.com/reset-password?token=…',
39
+ },
40
+ fullName: { description: "The recipient's name", example: 'Biki Singh' },
41
+ expiresInMinutes: {
42
+ description: 'Minutes until the link expires',
43
+ example: '30',
44
+ },
45
+ appName: { description: 'The product name', example: 'TBS' },
46
+ },
47
+ requiredVariables: ['resetUrl'],
48
+ },
49
+ };
50
+ /** The longest SMS body a template may have: four concatenated GSM-7 segments. */
51
+ exports.MAX_SMS_LENGTH = 612;
52
+ /** One GSM-7 segment. Longer messages are split and cost more. */
53
+ exports.SMS_SEGMENT_LENGTH = 160;
@@ -0,0 +1,240 @@
1
+ import { z } from 'zod';
2
+ import { type CommunicationChannel, type MessageType } from '../enums/index.js';
3
+ /** The variable names used as `{{name}}` in a piece of template text, in order, without repeats. */
4
+ export declare function templatePlaceholders(text: string): string[];
5
+ /** True when the text has a `{{` or `}}` that is not part of a valid placeholder. */
6
+ export declare function hasMalformedPlaceholder(text: string): boolean;
7
+ /** A variable a template declares. Its value is supplied when the message is sent. */
8
+ export declare const templateVariableSchema: z.ZodObject<{
9
+ name: z.ZodString;
10
+ description: z.ZodOptional<z.ZodString>;
11
+ example: z.ZodOptional<z.ZodString>;
12
+ }, z.core.$strict>;
13
+ export type TemplateVariable = z.output<typeof templateVariableSchema>;
14
+ interface TemplateShape {
15
+ messageType: MessageType;
16
+ channel: CommunicationChannel;
17
+ subject?: string | null | undefined;
18
+ bodyText: string;
19
+ bodyHtml?: string | null | undefined;
20
+ variables: {
21
+ name: string;
22
+ }[];
23
+ }
24
+ /**
25
+ * The rules every template must meet before it is saved: the declared
26
+ * variables match the placeholders exactly, every one is supplied by the
27
+ * message type, and the type's required variables are used. Shared by the
28
+ * server and the admin editor, so both report the same problems.
29
+ */
30
+ export declare function templateProblems(template: TemplateShape): {
31
+ path: string;
32
+ message: string;
33
+ }[];
34
+ /** A new draft. Saved templates are never edited; a change is a new version. */
35
+ export declare const createTemplateSchema: z.ZodObject<{
36
+ messageType: z.ZodEnum<{
37
+ "auth.otp.signup_verification": "auth.otp.signup_verification";
38
+ "auth.otp.password_reset": "auth.otp.password_reset";
39
+ "auth.password_reset_link": "auth.password_reset_link";
40
+ }>;
41
+ channel: z.ZodEnum<{
42
+ EMAIL: "EMAIL";
43
+ SMS: "SMS";
44
+ }>;
45
+ name: z.ZodPipe<z.ZodString, z.ZodString>;
46
+ subject: z.ZodOptional<z.ZodNullable<z.ZodString>>;
47
+ bodyText: z.ZodString;
48
+ bodyHtml: z.ZodOptional<z.ZodNullable<z.ZodString>>;
49
+ variables: z.ZodArray<z.ZodObject<{
50
+ name: z.ZodString;
51
+ description: z.ZodOptional<z.ZodString>;
52
+ example: z.ZodOptional<z.ZodString>;
53
+ }, z.core.$strict>>;
54
+ }, z.core.$strict>;
55
+ export type CreateTemplateInput = z.input<typeof createTemplateSchema>;
56
+ export type CreateTemplateBody = z.output<typeof createTemplateSchema>;
57
+ export declare const templateListQuerySchema: z.ZodObject<{
58
+ messageType: z.ZodOptional<z.ZodEnum<{
59
+ "auth.otp.signup_verification": "auth.otp.signup_verification";
60
+ "auth.otp.password_reset": "auth.otp.password_reset";
61
+ "auth.password_reset_link": "auth.password_reset_link";
62
+ }>>;
63
+ channel: z.ZodOptional<z.ZodEnum<{
64
+ EMAIL: "EMAIL";
65
+ SMS: "SMS";
66
+ }>>;
67
+ }, z.core.$strict>;
68
+ export type TemplateListQuery = z.output<typeof templateListQuerySchema>;
69
+ export declare const templateResponseSchema: z.ZodObject<{
70
+ id: z.ZodUUID;
71
+ messageType: z.ZodEnum<{
72
+ "auth.otp.signup_verification": "auth.otp.signup_verification";
73
+ "auth.otp.password_reset": "auth.otp.password_reset";
74
+ "auth.password_reset_link": "auth.password_reset_link";
75
+ }>;
76
+ channel: z.ZodEnum<{
77
+ EMAIL: "EMAIL";
78
+ SMS: "SMS";
79
+ }>;
80
+ version: z.ZodNumber;
81
+ name: z.ZodString;
82
+ subject: z.ZodNullable<z.ZodString>;
83
+ bodyText: z.ZodString;
84
+ bodyHtml: z.ZodNullable<z.ZodString>;
85
+ variables: z.ZodArray<z.ZodObject<{
86
+ name: z.ZodString;
87
+ description: z.ZodOptional<z.ZodString>;
88
+ example: z.ZodOptional<z.ZodString>;
89
+ }, z.core.$strip>>;
90
+ status: z.ZodEnum<{
91
+ active: "active";
92
+ draft: "draft";
93
+ archived: "archived";
94
+ }>;
95
+ createdBy: z.ZodNullable<z.ZodUUID>;
96
+ createdAt: z.ZodISODateTime;
97
+ activatedBy: z.ZodNullable<z.ZodUUID>;
98
+ activatedAt: z.ZodNullable<z.ZodISODateTime>;
99
+ }, z.core.$strip>;
100
+ export type TemplateResponse = z.output<typeof templateResponseSchema>;
101
+ export declare const templateListResponseSchema: z.ZodArray<z.ZodObject<{
102
+ id: z.ZodUUID;
103
+ messageType: z.ZodEnum<{
104
+ "auth.otp.signup_verification": "auth.otp.signup_verification";
105
+ "auth.otp.password_reset": "auth.otp.password_reset";
106
+ "auth.password_reset_link": "auth.password_reset_link";
107
+ }>;
108
+ channel: z.ZodEnum<{
109
+ EMAIL: "EMAIL";
110
+ SMS: "SMS";
111
+ }>;
112
+ version: z.ZodNumber;
113
+ name: z.ZodString;
114
+ subject: z.ZodNullable<z.ZodString>;
115
+ bodyText: z.ZodString;
116
+ bodyHtml: z.ZodNullable<z.ZodString>;
117
+ variables: z.ZodArray<z.ZodObject<{
118
+ name: z.ZodString;
119
+ description: z.ZodOptional<z.ZodString>;
120
+ example: z.ZodOptional<z.ZodString>;
121
+ }, z.core.$strip>>;
122
+ status: z.ZodEnum<{
123
+ active: "active";
124
+ draft: "draft";
125
+ archived: "archived";
126
+ }>;
127
+ createdBy: z.ZodNullable<z.ZodUUID>;
128
+ createdAt: z.ZodISODateTime;
129
+ activatedBy: z.ZodNullable<z.ZodUUID>;
130
+ activatedAt: z.ZodNullable<z.ZodISODateTime>;
131
+ }, z.core.$strip>>;
132
+ /** Renders unsaved text, or a saved version, with the catalogue's sample values. */
133
+ export declare const previewTemplateSchema: z.ZodUnion<readonly [z.ZodObject<{
134
+ templateId: z.ZodUUID;
135
+ }, z.core.$strict>, z.ZodObject<{
136
+ messageType: z.ZodEnum<{
137
+ "auth.otp.signup_verification": "auth.otp.signup_verification";
138
+ "auth.otp.password_reset": "auth.otp.password_reset";
139
+ "auth.password_reset_link": "auth.password_reset_link";
140
+ }>;
141
+ channel: z.ZodEnum<{
142
+ EMAIL: "EMAIL";
143
+ SMS: "SMS";
144
+ }>;
145
+ name: z.ZodPipe<z.ZodString, z.ZodString>;
146
+ subject: z.ZodOptional<z.ZodNullable<z.ZodString>>;
147
+ bodyText: z.ZodString;
148
+ bodyHtml: z.ZodOptional<z.ZodNullable<z.ZodString>>;
149
+ variables: z.ZodArray<z.ZodObject<{
150
+ name: z.ZodString;
151
+ description: z.ZodOptional<z.ZodString>;
152
+ example: z.ZodOptional<z.ZodString>;
153
+ }, z.core.$strict>>;
154
+ }, z.core.$strict>]>;
155
+ export type PreviewTemplateInput = z.input<typeof previewTemplateSchema>;
156
+ export type PreviewTemplateBody = z.output<typeof previewTemplateSchema>;
157
+ export declare const renderedMessageSchema: z.ZodObject<{
158
+ channel: z.ZodEnum<{
159
+ EMAIL: "EMAIL";
160
+ SMS: "SMS";
161
+ }>;
162
+ subject: z.ZodNullable<z.ZodString>;
163
+ bodyText: z.ZodString;
164
+ bodyHtml: z.ZodNullable<z.ZodString>;
165
+ smsSegments: z.ZodNullable<z.ZodNumber>;
166
+ }, z.core.$strip>;
167
+ export type RenderedMessage = z.output<typeof renderedMessageSchema>;
168
+ export declare const testSendResponseSchema: z.ZodObject<{
169
+ channel: z.ZodEnum<{
170
+ EMAIL: "EMAIL";
171
+ SMS: "SMS";
172
+ }>;
173
+ sentTo: z.ZodString;
174
+ }, z.core.$strip>;
175
+ export type TestSendResponse = z.output<typeof testSendResponseSchema>;
176
+ /** A catalogue entry, with the built-in default template for each channel. */
177
+ export declare const messageTypeResponseSchema: z.ZodObject<{
178
+ type: z.ZodEnum<{
179
+ "auth.otp.signup_verification": "auth.otp.signup_verification";
180
+ "auth.otp.password_reset": "auth.otp.password_reset";
181
+ "auth.password_reset_link": "auth.password_reset_link";
182
+ }>;
183
+ label: z.ZodString;
184
+ description: z.ZodString;
185
+ channels: z.ZodArray<z.ZodEnum<{
186
+ EMAIL: "EMAIL";
187
+ SMS: "SMS";
188
+ }>>;
189
+ variables: z.ZodArray<z.ZodObject<{
190
+ name: z.ZodString;
191
+ description: z.ZodString;
192
+ example: z.ZodString;
193
+ }, z.core.$strip>>;
194
+ requiredVariables: z.ZodArray<z.ZodString>;
195
+ defaults: z.ZodArray<z.ZodObject<{
196
+ channel: z.ZodEnum<{
197
+ EMAIL: "EMAIL";
198
+ SMS: "SMS";
199
+ }>;
200
+ subject: z.ZodNullable<z.ZodString>;
201
+ bodyText: z.ZodString;
202
+ bodyHtml: z.ZodNullable<z.ZodString>;
203
+ variables: z.ZodArray<z.ZodObject<{
204
+ name: z.ZodString;
205
+ }, z.core.$strip>>;
206
+ }, z.core.$strip>>;
207
+ }, z.core.$strip>;
208
+ export type MessageTypeResponse = z.output<typeof messageTypeResponseSchema>;
209
+ export declare const messageTypeListResponseSchema: z.ZodArray<z.ZodObject<{
210
+ type: z.ZodEnum<{
211
+ "auth.otp.signup_verification": "auth.otp.signup_verification";
212
+ "auth.otp.password_reset": "auth.otp.password_reset";
213
+ "auth.password_reset_link": "auth.password_reset_link";
214
+ }>;
215
+ label: z.ZodString;
216
+ description: z.ZodString;
217
+ channels: z.ZodArray<z.ZodEnum<{
218
+ EMAIL: "EMAIL";
219
+ SMS: "SMS";
220
+ }>>;
221
+ variables: z.ZodArray<z.ZodObject<{
222
+ name: z.ZodString;
223
+ description: z.ZodString;
224
+ example: z.ZodString;
225
+ }, z.core.$strip>>;
226
+ requiredVariables: z.ZodArray<z.ZodString>;
227
+ defaults: z.ZodArray<z.ZodObject<{
228
+ channel: z.ZodEnum<{
229
+ EMAIL: "EMAIL";
230
+ SMS: "SMS";
231
+ }>;
232
+ subject: z.ZodNullable<z.ZodString>;
233
+ bodyText: z.ZodString;
234
+ bodyHtml: z.ZodNullable<z.ZodString>;
235
+ variables: z.ZodArray<z.ZodObject<{
236
+ name: z.ZodString;
237
+ }, z.core.$strip>>;
238
+ }, z.core.$strip>>;
239
+ }, z.core.$strip>>;
240
+ export {};