@adminiumjs/manifest 0.3.47 → 0.3.49

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.
Files changed (71) hide show
  1. package/dist/app-requires.d.ts +66 -0
  2. package/dist/app-requires.d.ts.map +1 -0
  3. package/dist/app-requires.js +98 -0
  4. package/dist/app-requires.js.map +1 -0
  5. package/dist/automations.d.ts +346 -2
  6. package/dist/automations.d.ts.map +1 -1
  7. package/dist/automations.js +64 -7
  8. package/dist/automations.js.map +1 -1
  9. package/dist/compose.d.ts.map +1 -1
  10. package/dist/compose.js +5 -0
  11. package/dist/compose.js.map +1 -1
  12. package/dist/documents.d.ts +49 -0
  13. package/dist/documents.d.ts.map +1 -1
  14. package/dist/documents.js +41 -1
  15. package/dist/documents.js.map +1 -1
  16. package/dist/formula.js +1 -1
  17. package/dist/formula.js.map +1 -1
  18. package/dist/index.d.ts +11 -4
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +11 -4
  21. package/dist/index.js.map +1 -1
  22. package/dist/instance.d.ts +133 -0
  23. package/dist/instance.d.ts.map +1 -0
  24. package/dist/instance.js +157 -0
  25. package/dist/instance.js.map +1 -0
  26. package/dist/outbox.d.ts +79 -0
  27. package/dist/outbox.d.ts.map +1 -1
  28. package/dist/outbox.js +37 -2
  29. package/dist/outbox.js.map +1 -1
  30. package/dist/plan-context.d.ts +9 -0
  31. package/dist/plan-context.d.ts.map +1 -1
  32. package/dist/plan-context.js +74 -9
  33. package/dist/plan-context.js.map +1 -1
  34. package/dist/plan-model.d.ts +9 -2
  35. package/dist/plan-model.d.ts.map +1 -1
  36. package/dist/plan-types.d.ts.map +1 -1
  37. package/dist/plan-types.js +2 -0
  38. package/dist/plan-types.js.map +1 -1
  39. package/dist/public-access.d.ts +23 -0
  40. package/dist/public-access.d.ts.map +1 -1
  41. package/dist/public-access.js +51 -5
  42. package/dist/public-access.js.map +1 -1
  43. package/dist/refs.d.ts +12 -1
  44. package/dist/refs.d.ts.map +1 -1
  45. package/dist/refs.js +23 -2
  46. package/dist/refs.js.map +1 -1
  47. package/dist/saved-apps.d.ts +132 -0
  48. package/dist/saved-apps.d.ts.map +1 -0
  49. package/dist/saved-apps.js +215 -0
  50. package/dist/saved-apps.js.map +1 -0
  51. package/dist/saved-parts.d.ts +368 -0
  52. package/dist/saved-parts.d.ts.map +1 -0
  53. package/dist/saved-parts.js +232 -0
  54. package/dist/saved-parts.js.map +1 -0
  55. package/dist/schema.d.ts +1395 -52
  56. package/dist/schema.d.ts.map +1 -1
  57. package/dist/schema.js +131 -5
  58. package/dist/schema.js.map +1 -1
  59. package/dist/table-names.d.ts +82 -0
  60. package/dist/table-names.d.ts.map +1 -0
  61. package/dist/table-names.js +145 -0
  62. package/dist/table-names.js.map +1 -0
  63. package/dist/words.d.ts +1 -1
  64. package/dist/words.d.ts.map +1 -1
  65. package/dist/words.js +206 -0
  66. package/dist/words.js.map +1 -1
  67. package/dist/workspace-file.d.ts +115 -0
  68. package/dist/workspace-file.d.ts.map +1 -0
  69. package/dist/workspace-file.js +130 -0
  70. package/dist/workspace-file.js.map +1 -0
  71. package/package.json +2 -2
@@ -0,0 +1,133 @@
1
+ /**
2
+ * `instance` — the part of a self-made app that is the whole deployment's.
3
+ *
4
+ * A dashboard is saved with its look: the name and mark on the menu, the
5
+ * colours, which languages are on, the wording somebody changed, the system
6
+ * emails somebody edited, and a few plain settings. None of it is an app's;
7
+ * all of it is applied to the target as a whole, only when the person
8
+ * installing ticks it (off by default), and only by someone who may change
9
+ * the server's settings.
10
+ *
11
+ * What it never carries: any part of a secret setting (the mail server, the
12
+ * assistant's key), people, keys or rows. Settings are an allow-list, so a
13
+ * setting not on it is refused by name, whatever it holds.
14
+ *
15
+ * Files (the logo, the favicon) are package files, named by their path and
16
+ * their sha256, so the target uses exactly the bytes that were saved.
17
+ *
18
+ * Read here; applied by the engine under its own guards (a diff of each
19
+ * edited email with every link host, one transaction, the values it replaced
20
+ * kept for an undo).
21
+ */
22
+ import { z } from 'zod';
23
+ /** A file of the package, by its relative path, with the sha256 of its bytes. */
24
+ export declare const instanceFileSchema: z.ZodObject<{
25
+ file: z.ZodString;
26
+ sha256: z.ZodString;
27
+ }, z.core.$strict>;
28
+ /**
29
+ * The system emails Adminium sends itself, each of which a person may edit
30
+ * (the engine's `BUILTIN_EMAIL_TEMPLATE_KEYS`; a server test keeps the two
31
+ * lists the same).
32
+ */
33
+ export declare const INSTANCE_SYSTEM_EMAIL_KEYS: readonly ["password-reset", "user-invite", "notification", "document-ready", "booking-confirmation", "sign-in-code", "email-changed", "sign-in-link", "details-deleted", "payment-link", "payment-receipt", "sign-up-confirm"];
34
+ /**
35
+ * The settings `instance` may carry: plain, portable words of the business,
36
+ * none of them secret (a server test checks each against the registry).
37
+ */
38
+ export declare const INSTANCE_SETTING_KEYS: readonly ["assistant.name", "privacy.businessName", "privacy.noticeUrl", "email.postalAddress"];
39
+ export declare const instanceSchema: z.ZodObject<{
40
+ branding: z.ZodOptional<z.ZodObject<{
41
+ appName: z.ZodOptional<z.ZodString>;
42
+ showVersion: z.ZodOptional<z.ZodBoolean>;
43
+ theme: z.ZodOptional<z.ZodEnum<{
44
+ system: "system";
45
+ light: "light";
46
+ dark: "dark";
47
+ }>>;
48
+ accent: z.ZodOptional<z.ZodEnum<{
49
+ indigo: "indigo";
50
+ blue: "blue";
51
+ teal: "teal";
52
+ violet: "violet";
53
+ rose: "rose";
54
+ red: "red";
55
+ orange: "orange";
56
+ black: "black";
57
+ }>>;
58
+ density: z.ZodOptional<z.ZodEnum<{
59
+ comfortable: "comfortable";
60
+ compact: "compact";
61
+ }>>;
62
+ logo: z.ZodOptional<z.ZodObject<{
63
+ file: z.ZodString;
64
+ sha256: z.ZodString;
65
+ }, z.core.$strict>>;
66
+ favicon: z.ZodOptional<z.ZodObject<{
67
+ file: z.ZodString;
68
+ sha256: z.ZodString;
69
+ }, z.core.$strict>>;
70
+ }, z.core.$strict>>;
71
+ languages: z.ZodOptional<z.ZodObject<{
72
+ enabled: z.ZodArray<z.ZodString>;
73
+ default: z.ZodOptional<z.ZodString>;
74
+ }, z.core.$strict>>;
75
+ wording: z.ZodOptional<z.ZodArray<z.ZodObject<{
76
+ locale: z.ZodString;
77
+ namespace: z.ZodString;
78
+ key: z.ZodString;
79
+ value: z.ZodString;
80
+ }, z.core.$strict>>>;
81
+ systemEmails: z.ZodOptional<z.ZodArray<z.ZodObject<{
82
+ key: z.ZodEnum<{
83
+ notification: "notification";
84
+ "booking-confirmation": "booking-confirmation";
85
+ "password-reset": "password-reset";
86
+ "user-invite": "user-invite";
87
+ "document-ready": "document-ready";
88
+ "sign-in-code": "sign-in-code";
89
+ "email-changed": "email-changed";
90
+ "sign-in-link": "sign-in-link";
91
+ "details-deleted": "details-deleted";
92
+ "payment-link": "payment-link";
93
+ "payment-receipt": "payment-receipt";
94
+ "sign-up-confirm": "sign-up-confirm";
95
+ }>;
96
+ locale: z.ZodString;
97
+ content: z.ZodObject<{
98
+ subject: z.ZodString;
99
+ preheader: z.ZodOptional<z.ZodString>;
100
+ blocks: z.ZodArray<z.ZodObject<{
101
+ block: z.ZodString;
102
+ id: z.ZodOptional<z.ZodString>;
103
+ label: z.ZodOptional<z.ZodString>;
104
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
105
+ showWhen: z.ZodOptional<z.ZodObject<{
106
+ var: z.ZodString;
107
+ }, z.core.$strict>>;
108
+ otherwise: z.ZodOptional<z.ZodString>;
109
+ }, z.core.$strict>>;
110
+ footer: z.ZodOptional<z.ZodString>;
111
+ }, z.core.$strict>;
112
+ }, z.core.$strict>>>;
113
+ settings: z.ZodOptional<z.ZodObject<{
114
+ 'assistant.name': z.ZodOptional<z.ZodString>;
115
+ 'privacy.businessName': z.ZodOptional<z.ZodString>;
116
+ 'privacy.noticeUrl': z.ZodOptional<z.ZodURL>;
117
+ 'email.postalAddress': z.ZodOptional<z.ZodString>;
118
+ }, z.core.$strict>>;
119
+ }, z.core.$strict>;
120
+ export type InstancePart = z.infer<typeof instanceSchema>;
121
+ interface Issue {
122
+ path: (string | number)[];
123
+ message: string;
124
+ }
125
+ /** Everything wrong with an app's `instance` part that its shape alone cannot see. */
126
+ export declare function instanceIssues(m: {
127
+ publisher: {
128
+ id: string;
129
+ };
130
+ instance?: InstancePart | undefined;
131
+ }): Issue[];
132
+ export {};
133
+ //# sourceMappingURL=instance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instance.d.ts","sourceRoot":"","sources":["../src/instance.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AASxB,iFAAiF;AACjF,eAAO,MAAM,kBAAkB;;;kBASpB,CAAC;AAEZ;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,gOAa7B,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,qBAAqB,iGAAkG,CAAC;AAErI,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAgE2G,CAAC;AACvI,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAE1D,UAAU,KAAK;IACb,IAAI,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,sFAAsF;AACtF,wBAAgB,cAAc,CAAC,CAAC,EAAE;IAAE,SAAS,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;IAAC,QAAQ,CAAC,EAAE,YAAY,GAAG,SAAS,CAAA;CAAE,GAAG,KAAK,EAAE,CA2B7G"}
@@ -0,0 +1,157 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ /**
3
+ * `instance` — the part of a self-made app that is the whole deployment's.
4
+ *
5
+ * A dashboard is saved with its look: the name and mark on the menu, the
6
+ * colours, which languages are on, the wording somebody changed, the system
7
+ * emails somebody edited, and a few plain settings. None of it is an app's;
8
+ * all of it is applied to the target as a whole, only when the person
9
+ * installing ticks it (off by default), and only by someone who may change
10
+ * the server's settings.
11
+ *
12
+ * What it never carries: any part of a secret setting (the mail server, the
13
+ * assistant's key), people, keys or rows. Settings are an allow-list, so a
14
+ * setting not on it is refused by name, whatever it holds.
15
+ *
16
+ * Files (the logo, the favicon) are package files, named by their path and
17
+ * their sha256, so the target uses exactly the bytes that were saved.
18
+ *
19
+ * Read here; applied by the engine under its own guards (a diff of each
20
+ * edited email with every link host, one transaction, the values it replaced
21
+ * kept for an undo).
22
+ */
23
+ import { z } from 'zod';
24
+ import { emailContentSchema } from './outbox.js';
25
+ const LOCAL_PUBLISHER_ID = 'local';
26
+ /** A language as Adminium keeps it (`en_US`, `pt_BR`). */
27
+ const localeIdSchema = z.string().regex(/^[a-z]{2,3}(_[A-Za-z0-9]{2,8}){0,2}$/, 'a language id such as "en_US"');
28
+ /** A file of the package, by its relative path, with the sha256 of its bytes. */
29
+ export const instanceFileSchema = z
30
+ .object({
31
+ file: z
32
+ .string()
33
+ .min(1)
34
+ .max(200)
35
+ .regex(/^(?!\/)(?!.*(?:^|\/)\.\.?(?:\/|$))[A-Za-z0-9._/-]+$/, 'a file of the package, by its relative path'),
36
+ sha256: z.string().regex(/^[0-9a-f]{64}$/, 'the sha256 of the file, in lower-case hex'),
37
+ })
38
+ .strict();
39
+ /**
40
+ * The system emails Adminium sends itself, each of which a person may edit
41
+ * (the engine's `BUILTIN_EMAIL_TEMPLATE_KEYS`; a server test keeps the two
42
+ * lists the same).
43
+ */
44
+ export const INSTANCE_SYSTEM_EMAIL_KEYS = [
45
+ 'password-reset',
46
+ 'user-invite',
47
+ 'notification',
48
+ 'document-ready',
49
+ 'booking-confirmation',
50
+ 'sign-in-code',
51
+ 'email-changed',
52
+ 'sign-in-link',
53
+ 'details-deleted',
54
+ 'payment-link',
55
+ 'payment-receipt',
56
+ 'sign-up-confirm',
57
+ ];
58
+ /**
59
+ * The settings `instance` may carry: plain, portable words of the business,
60
+ * none of them secret (a server test checks each against the registry).
61
+ */
62
+ export const INSTANCE_SETTING_KEYS = ['assistant.name', 'privacy.businessName', 'privacy.noticeUrl', 'email.postalAddress'];
63
+ export const instanceSchema = z
64
+ .object({
65
+ /** The menu's name and mark, and the look everybody starts with. */
66
+ branding: z
67
+ .object({
68
+ appName: z.string().min(1).max(60).optional(),
69
+ showVersion: z.boolean().optional(),
70
+ theme: z.enum(['light', 'dark', 'system']).optional(),
71
+ accent: z.enum(['indigo', 'blue', 'teal', 'violet', 'rose', 'red', 'orange', 'black']).optional(),
72
+ density: z.enum(['comfortable', 'compact']).optional(),
73
+ logo: instanceFileSchema.optional(),
74
+ favicon: instanceFileSchema.optional(),
75
+ })
76
+ .strict()
77
+ .optional(),
78
+ /** The languages switched on, and the one everybody starts in. */
79
+ languages: z
80
+ .object({
81
+ enabled: z.array(localeIdSchema).min(1).max(40),
82
+ default: localeIdSchema.optional(),
83
+ })
84
+ .strict()
85
+ .optional(),
86
+ /** Words of the interface somebody changed: a blank value is a word left out on purpose. */
87
+ wording: z
88
+ .array(z
89
+ .object({
90
+ locale: localeIdSchema,
91
+ namespace: z.string().regex(/^[a-z][A-Za-z0-9-]{0,39}$/, 'a wording namespace'),
92
+ key: z.string().regex(/^[A-Za-z0-9_.-]{1,200}$/, 'a wording key'),
93
+ value: z.string().max(4000),
94
+ })
95
+ .strict())
96
+ .min(1)
97
+ .max(5000)
98
+ .optional(),
99
+ /** System emails somebody edited, one language each. */
100
+ systemEmails: z
101
+ .array(z
102
+ .object({
103
+ key: z.enum(INSTANCE_SYSTEM_EMAIL_KEYS),
104
+ locale: localeIdSchema,
105
+ content: emailContentSchema,
106
+ })
107
+ .strict())
108
+ .min(1)
109
+ .max(INSTANCE_SYSTEM_EMAIL_KEYS.length * 40)
110
+ .optional(),
111
+ /** Plain settings of the business, from the allow-list only. */
112
+ settings: z
113
+ .object({
114
+ 'assistant.name': z.string().min(1).max(40).optional(),
115
+ 'privacy.businessName': z.string().trim().min(1).max(120).optional(),
116
+ 'privacy.noticeUrl': z.url({ protocol: /^https$/ }).max(500).optional(),
117
+ 'email.postalAddress': z.string().trim().min(1).max(300).optional(),
118
+ })
119
+ .strict()
120
+ .optional(),
121
+ })
122
+ .strict()
123
+ .refine((instance) => Object.values(instance).some((part) => part !== undefined), { message: 'an instance part carries something' });
124
+ /** Everything wrong with an app's `instance` part that its shape alone cannot see. */
125
+ export function instanceIssues(m) {
126
+ const out = [];
127
+ const part = m.instance;
128
+ if (part === undefined)
129
+ return out;
130
+ if (m.publisher.id !== LOCAL_PUBLISHER_ID) {
131
+ out.push({ path: ['instance'], message: `"instance" is carried only by a self-made app (publisher "${LOCAL_PUBLISHER_ID}")` });
132
+ }
133
+ const languages = part.languages;
134
+ if (languages !== undefined) {
135
+ if (new Set(languages.enabled).size !== languages.enabled.length)
136
+ out.push({ path: ['instance', 'languages', 'enabled'], message: 'a language is named once' });
137
+ if (languages.default !== undefined && !languages.enabled.includes(languages.default)) {
138
+ out.push({ path: ['instance', 'languages', 'default'], message: `"${languages.default}" is not one of the languages switched on` });
139
+ }
140
+ }
141
+ const words = new Set();
142
+ (part.wording ?? []).forEach((word, w) => {
143
+ const id = `${word.locale}\u0000${word.namespace}\u0000${word.key}`;
144
+ if (words.has(id))
145
+ out.push({ path: ['instance', 'wording', w], message: `"${word.namespace}.${word.key}" in ${word.locale} is changed twice` });
146
+ words.add(id);
147
+ });
148
+ const emails = new Set();
149
+ (part.systemEmails ?? []).forEach((email, e) => {
150
+ const id = `${email.key}\u0000${email.locale}`;
151
+ if (emails.has(id))
152
+ out.push({ path: ['instance', 'systemEmails', e], message: `"${email.key}" in ${email.locale} is edited twice` });
153
+ emails.add(id);
154
+ });
155
+ return out;
156
+ }
157
+ //# sourceMappingURL=instance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instance.js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,IAAI,EAAE,CAAC,EAAE,EAAE;QACvC,MAAM,EAAE,GAAG,GAAG,IAAI,CAAC,MAAM,SAAS,IAAI,CAAC,SAAS,SAAS,IAAI,CAAC,GAAG,EAAE,CAAC;QACpE,IAAI,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;YAAE,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,UAAU,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,GAAG,QAAQ,IAAI,CAAC,MAAM,mBAAmB,EAAE,CAAC,CAAC;QACjJ,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,CAAC,CAAC,CAAC;IACH,MAAM,MAAM,GAAG,IAAI,GAAG,EAAU,CAAC;IACjC,CAAC,IAAI,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE;QAC7C,MAAM,EAAE,GAAG,GAAG,KAAK,CAAC,GAAG,SAAS,KAAK,CAAC,MAAM,EAAE,CAAC;QAC/C,IAAI,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC;YAAE,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,UAAU,EAAE,cAAc,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,KAAK,CAAC,GAAG,QAAQ,KAAK,CAAC,MAAM,kBAAkB,EAAE,CAAC,CAAC;QACtI,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACjB,CAAC,CAAC,CAAC;IACH,OAAO,GAAG,CAAC;AACb,CAAC"}
package/dist/outbox.d.ts CHANGED
@@ -846,6 +846,52 @@ export declare const outboxSchema: z.ZodObject<{
846
846
  }, z.core.$strict>]>>>;
847
847
  }, z.core.$strict>;
848
848
  export type Outbox = z.infer<typeof outboxSchema>;
849
+ /** One language of a mail: its subject, blocks and footer. */
850
+ export declare const emailContentSchema: z.ZodObject<{
851
+ subject: z.ZodString;
852
+ preheader: z.ZodOptional<z.ZodString>;
853
+ blocks: z.ZodArray<z.ZodObject<{
854
+ block: z.ZodString;
855
+ id: z.ZodOptional<z.ZodString>;
856
+ label: z.ZodOptional<z.ZodString>;
857
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
858
+ showWhen: z.ZodOptional<z.ZodObject<{
859
+ var: z.ZodString;
860
+ }, z.core.$strict>>;
861
+ otherwise: z.ZodOptional<z.ZodString>;
862
+ }, z.core.$strict>>;
863
+ footer: z.ZodOptional<z.ZodString>;
864
+ }, z.core.$strict>;
865
+ /** The marks a mail's brand may show: one of the twelve the renderer ships, or the workspace's logo (the template store's `emailMarkSchema`). */
866
+ export declare const EMAIL_BRAND_MARKS: readonly ["hexagon", "circle", "square", "triangle", "gem", "zap", "flame", "leaf", "star", "heart", "command", "box", "logo"];
867
+ /** A mail's own brand, as the template store keeps it. Its sender is checked against the configured senders when it sends. */
868
+ export declare const emailTemplateBrandSchema: z.ZodObject<{
869
+ name: z.ZodString;
870
+ mark: z.ZodEnum<{
871
+ hexagon: "hexagon";
872
+ circle: "circle";
873
+ square: "square";
874
+ triangle: "triangle";
875
+ gem: "gem";
876
+ zap: "zap";
877
+ flame: "flame";
878
+ leaf: "leaf";
879
+ star: "star";
880
+ heart: "heart";
881
+ command: "command";
882
+ box: "box";
883
+ logo: "logo";
884
+ }>;
885
+ accent: z.ZodString;
886
+ fromName: z.ZodString;
887
+ fromEmail: z.ZodString;
888
+ }, z.core.$strict>;
889
+ /** The most files one mail carries. */
890
+ export declare const EMAIL_ATTACHMENTS_MAX = 20;
891
+ /** A file of the app's package a mail carries: a relative path, never out of the package. */
892
+ export declare const emailTemplateAttachmentSchema: z.ZodObject<{
893
+ file: z.ZodString;
894
+ }, z.core.$strict>;
849
895
  export declare const emailTemplateSchema: z.ZodObject<{
850
896
  key: z.ZodString;
851
897
  name: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
@@ -854,6 +900,39 @@ export declare const emailTemplateSchema: z.ZodObject<{
854
900
  link: z.ZodString;
855
901
  optional: z.ZodOptional<z.ZodLiteral<true>>;
856
902
  }, z.core.$strict>>;
903
+ kind: z.ZodOptional<z.ZodEnum<{
904
+ template: "template";
905
+ campaign: "campaign";
906
+ }>>;
907
+ category: z.ZodOptional<z.ZodEnum<{
908
+ marketing: "marketing";
909
+ transactional: "transactional";
910
+ lifecycle: "lifecycle";
911
+ }>>;
912
+ brand: z.ZodOptional<z.ZodObject<{
913
+ name: z.ZodString;
914
+ mark: z.ZodEnum<{
915
+ hexagon: "hexagon";
916
+ circle: "circle";
917
+ square: "square";
918
+ triangle: "triangle";
919
+ gem: "gem";
920
+ zap: "zap";
921
+ flame: "flame";
922
+ leaf: "leaf";
923
+ star: "star";
924
+ heart: "heart";
925
+ command: "command";
926
+ box: "box";
927
+ logo: "logo";
928
+ }>;
929
+ accent: z.ZodString;
930
+ fromName: z.ZodString;
931
+ fromEmail: z.ZodString;
932
+ }, z.core.$strict>>;
933
+ attachments: z.ZodOptional<z.ZodArray<z.ZodObject<{
934
+ file: z.ZodString;
935
+ }, z.core.$strict>>>;
857
936
  vars: z.ZodOptional<z.ZodArray<z.ZodString>>;
858
937
  locales: z.ZodRecord<z.ZodString, z.ZodObject<{
859
938
  subject: z.ZodString;
@@ -1 +1 @@
1
- {"version":3,"file":"outbox.d.ts","sourceRoot":"","sources":["../src/outbox.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI/C,OAAO,EAAkB,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpE,OAAO,EAQL,KAAK,cAAc,EAEnB,KAAK,UAAU,EAChB,MAAM,WAAW,CAAC;AAEnB,+DAA+D;AAC/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CHANGED
@@ -414,7 +414,8 @@ const emailBlockSchema = z
414
414
  // Words nothing would ever print are a mistake, said at the install and not found in a sent mail.
415
415
  .refine((block) => block.otherwise === undefined || block.showWhen !== undefined, { message: '"otherwise" is what a block says when its "showWhen" value is missing: it needs a "showWhen"', path: ['otherwise'] })
416
416
  .refine((block) => block.otherwise === undefined || OTHERWISE_BLOCKS.includes(block.block), { message: 'only a text or a heading block can say other words ("otherwise")', path: ['otherwise'] });
417
- const emailContentSchema = z
417
+ /** One language of a mail: its subject, blocks and footer. */
418
+ export const emailContentSchema = z
418
419
  .object({
419
420
  subject: z.string().min(1).max(200),
420
421
  preheader: z.string().min(1).max(200).optional(),
@@ -432,6 +433,30 @@ const emailContentSchema = z
432
433
  const templateVariableSchema = z
433
434
  .string()
434
435
  .regex(/^(?:appName|addOn\.[a-z][a-z0-9-]*\.[A-Za-z][A-Za-z0-9_]*|[a-z_][a-z0-9_]*(?:\.[a-z_][a-z0-9_]*)*)$/, 'a variable such as patient.name or appName');
436
+ /** The marks a mail's brand may show: one of the twelve the renderer ships, or the workspace's logo (the template store's `emailMarkSchema`). */
437
+ export const EMAIL_BRAND_MARKS = ['hexagon', 'circle', 'square', 'triangle', 'gem', 'zap', 'flame', 'leaf', 'star', 'heart', 'command', 'box', 'logo'];
438
+ /** A mail's own brand, as the template store keeps it. Its sender is checked against the configured senders when it sends. */
439
+ export const emailTemplateBrandSchema = z
440
+ .object({
441
+ name: z.string().max(80),
442
+ mark: z.enum(EMAIL_BRAND_MARKS),
443
+ accent: z.string().regex(/^#[0-9a-fA-F]{6}$/, 'a six-digit hex colour'),
444
+ fromName: z.string().max(120),
445
+ fromEmail: z.string().max(320),
446
+ })
447
+ .strict();
448
+ /** The most files one mail carries. */
449
+ export const EMAIL_ATTACHMENTS_MAX = 20;
450
+ /** A file of the app's package a mail carries: a relative path, never out of the package. */
451
+ export const emailTemplateAttachmentSchema = z
452
+ .object({
453
+ file: z
454
+ .string()
455
+ .min(1)
456
+ .max(200)
457
+ .regex(/^(?!\/)(?!.*(?:^|\/)\.\.?(?:\/|$))[A-Za-z0-9._/-]+$/, 'a file of the package, by its relative path'),
458
+ })
459
+ .strict();
435
460
  export const emailTemplateSchema = z
436
461
  .object({
437
462
  /** `<app key>-<name>`: an app names only its own templates. */
@@ -457,6 +482,14 @@ export const emailTemplateSchema = z
457
482
  })
458
483
  .strict()
459
484
  .optional(),
485
+ /** A `template` an outbox or a rule sends (the default), or a `campaign` the owner sends to an audience. */
486
+ kind: z.enum(['template', 'campaign']).optional(),
487
+ /** What the mail is for: `transactional` (the default), `lifecycle` or `marketing`. */
488
+ category: z.enum(['transactional', 'lifecycle', 'marketing']).optional(),
489
+ /** The mail's own name, mark, colour and sender, in place of the workspace's. */
490
+ brand: emailTemplateBrandSchema.optional(),
491
+ /** Files of the package the mail carries, each by its path in the package (`emails/terms.pdf`). */
492
+ attachments: z.array(emailTemplateAttachmentSchema).min(1).max(EMAIL_ATTACHMENTS_MAX).optional(),
460
493
  /** The variables it reads, for the editor's list. */
461
494
  vars: z.array(templateVariableSchema).max(60).optional(),
462
495
  /** The template in each language it ships, US English always among them. */
@@ -592,7 +625,9 @@ export function outboxIssues(m, index) {
592
625
  };
593
626
  for (const rule of m.automations ?? [])
594
627
  collect(rule.graph);
595
- const unsent = [...templates].filter((key) => !byRules.has(key));
628
+ // A campaign is sent by its owner, to an audience: nothing in the app sends it.
629
+ const campaigns = new Set((m.emailTemplates ?? []).filter((template) => template.kind === 'campaign').map((template) => template.key));
630
+ const unsent = [...templates].filter((key) => !byRules.has(key) && !campaigns.has(key));
596
631
  if (unsent.length > 0)
597
632
  out.push({ path: ['emailTemplates'], message: `templates are sent through an outbox or by a rule's step, and nothing sends ${unsent.map((key) => `"${key}"`).join(', ')}: this app declares no outbox` });
598
633
  return out;