@adminiumjs/manifest 0.3.64 → 0.3.66

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.
@@ -0,0 +1,144 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ /**
3
+ * LANDING: THE ADD-ON BLOCK'S `landing` WORD.
4
+ *
5
+ * A landing pages add-on names which of its own tables hold its pages and its
6
+ * funnels:
7
+ *
8
+ * ```json
9
+ * "addOn": { "landing": { "pages": "pages", "funnels": "funnels" } }
10
+ * ```
11
+ *
12
+ * (`addOn.pages` is another word: the add-on's own staff screens.)
13
+ *
14
+ * The engine draws every live page for a stranger (no add-on code runs for
15
+ * one) and reads the funnels' steps, so each table must have the columns the
16
+ * engine reads, by these names and of these kinds ({@link LANDING_COLUMNS}),
17
+ * and a numbered key (a funnel's step and a page's link name a page by it).
18
+ * Staff write both tables through the add-on's screens, so roles and grants
19
+ * may write them; the engine seals the columns that publish a page (its
20
+ * state, its published copy and when it was published) in its own write
21
+ * service. No public entry of the add-on opens either table: strangers are
22
+ * served by the engine alone.
23
+ *
24
+ * A package declares one stranger's door: `landing` beside `forms` or `chat`
25
+ * is refused, since each door is vouched for, and its rows kept, per package.
26
+ *
27
+ * Pure: no I/O, and nothing imported from the manifest's own schema file, so
28
+ * that file may import this one.
29
+ */
30
+ import { z } from 'zod';
31
+ import { contractColumnIssues, contractColumns } from './forms.js';
32
+ import { refSchema } from './refs.js';
33
+ /** The block: the add-on's own tables, by ref. Both are required. */
34
+ export const addOnLandingSchema = z
35
+ .object({
36
+ pages: refSchema,
37
+ funnels: refSchema,
38
+ })
39
+ .strict();
40
+ export const LANDING_PARTS = ['pages', 'funnels'];
41
+ /** The category a package that declares landing pages is filed under. */
42
+ export const LANDING_CATEGORY = 'marketing';
43
+ /** Where a page stands: being written, served to strangers, or switched off. */
44
+ export const LANDING_STATES = ['draft', 'live', 'off'];
45
+ /** The longest a page's slug is (the landing slug rule in `@adminium/add-on-contracts/landing`). */
46
+ export const LANDING_SLUG_MAX = 80;
47
+ /** The most steps one funnel has. */
48
+ export const LANDING_FUNNEL_STEPS_MAX = 8;
49
+ const { text, moment, json, choice } = contractColumns;
50
+ /**
51
+ * The columns each part has, which the engine reads (and, for a page's
52
+ * publish columns, seals) by these names. A table may have more of its own,
53
+ * each nullable, with a default, decided by a rule, or a moment its role
54
+ * stamps (`created_at`, `updated_at`): nothing else the engine writes fills it.
55
+ */
56
+ export const LANDING_COLUMNS = {
57
+ pages: {
58
+ /** Staff's own name for the page, never shown to a stranger. */
59
+ name: text(200),
60
+ /** The last part of its address (`/x/pages/<slug>`). */
61
+ slug: text(LANDING_SLUG_MAX),
62
+ state: choice(LANDING_STATES),
63
+ /** The one language the page is written in. */
64
+ language: text(10),
65
+ /** The page document staff are working on; it may carry the assistant's marks. */
66
+ draft: json(),
67
+ /** The page document frozen at publish: strangers are served only this, and it never carries a mark. */
68
+ published: json(true),
69
+ /** When the published copy was written, set by the engine. */
70
+ published_at: moment(true),
71
+ updated_at: moment(),
72
+ },
73
+ funnels: {
74
+ name: text(200),
75
+ /** `[{ "kind": "page" | "form", "key": "…" }]`, at most eight, each naming a row by its key. */
76
+ steps: json(),
77
+ /** The rule picked by hand as what happens after the funnel. */
78
+ rule_id: text(64, true),
79
+ },
80
+ };
81
+ /**
82
+ * Whether Adminium writes a column on every create by its role: a moment
83
+ * (a time or a date) whose role is `created_at` or `updated_at` is stamped
84
+ * with the moment its row is made, and an `updated_at` again at each change,
85
+ * through every door (the kit's writes included). A role on any other type
86
+ * stamps nothing.
87
+ */
88
+ function stampedByRole(column) {
89
+ return (column.role === 'created_at' || column.role === 'updated_at') && (column.type === 'timestamptz' || column.type === 'date');
90
+ }
91
+ /** Everything wrong with an add-on's landing block, against its own tables and entries. */
92
+ export function landingBlockIssues(block, m) {
93
+ const out = [];
94
+ const tables = new Map(m.tables.map((table, t) => [table.ref, { table, t }]));
95
+ const at = (...rest) => ['addOn', 'landing', ...rest];
96
+ if (!m.categories.includes(LANDING_CATEGORY))
97
+ out.push({ path: ['categories'], message: `an add-on that declares landing pages is filed under the "${LANDING_CATEGORY}" category` });
98
+ // Each door is vouched for, and its rows kept, per package: one package with two would mix them.
99
+ if (m.forms === true)
100
+ out.push({ path: at(), message: 'an add-on declares landing pages or forms, not both: each is a package of its own' });
101
+ if (m.chat === true)
102
+ out.push({ path: at(), message: 'an add-on declares landing pages or chat, not both: each is a package of its own' });
103
+ const seen = new Map();
104
+ for (const part of LANDING_PARTS) {
105
+ const ref = block[part];
106
+ const other = seen.get(ref);
107
+ if (other !== undefined)
108
+ out.push({ path: at(part), message: `"${ref}" holds the ${other} already: each part of landing is a table of its own` });
109
+ seen.set(ref, part);
110
+ }
111
+ for (const part of LANDING_PARTS) {
112
+ const ref = block[part];
113
+ const found = tables.get(ref);
114
+ if (found === undefined) {
115
+ out.push({ path: at(part), message: `"${ref}" is not one of this add-on's tables` });
116
+ continue;
117
+ }
118
+ const { table, t } = found;
119
+ const contract = LANDING_COLUMNS[part];
120
+ out.push(...contractColumnIssues(table, t, `the ${part}`, contract, (to) => block[to]));
121
+ // A numbered key: a funnel's step and a page's link name a row by it.
122
+ const k = table.columns.findIndex((column) => column.role === 'pk');
123
+ const key = table.columns[k];
124
+ if (key === undefined)
125
+ out.push({ path: at(part), message: `"${ref}" holds the ${part}, so its rows are numbered: give it an int key (role "pk")` });
126
+ else if (key.type !== 'int' && key.type !== 'bigint')
127
+ out.push({ path: ['requiredSchema', 'tables', t, 'columns', k, 'type'], message: `"${ref}" holds the ${part}, so its rows are numbered: its key "${key.ref}" is an int or a bigint, not ${key.type}` });
128
+ // Every other column is one a write may leave out: nothing the engine writes fills it, but for a moment it stamps.
129
+ table.columns.forEach((column, c) => {
130
+ if (contract[column.ref] !== undefined || column.role === 'pk' || column.nullable === true || column.default !== undefined || m.decided?.(ref, column.ref) === true)
131
+ return;
132
+ if (stampedByRole(column))
133
+ return;
134
+ out.push({ path: ['requiredSchema', 'tables', t, 'columns', c], message: `"${ref}" holds the ${part}, and Adminium never fills "${column.ref}": make it nullable or give it a default` });
135
+ });
136
+ // The engine serves a stranger a live page and nothing else: no public entry of the add-on opens a landing table.
137
+ (m.publicAccess ?? []).forEach((entry, e) => {
138
+ if (entry.table === ref)
139
+ out.push({ path: ['publicAccess', e, 'table'], message: `"${ref}" holds the ${part}, which Adminium alone serves to strangers: no public entry opens it` });
140
+ });
141
+ }
142
+ return out;
143
+ }
144
+ //# sourceMappingURL=landing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"landing.js","sourceRoot":"","sources":["../src/landing.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAA6C,MAAM,YAAY,CAAC;AAC9G,OAAO,EAAE,SAAS,EAAuB,MAAM,WAAW,CAAC;AAE3D,qEAAqE;AACrE,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC;KAChC,MAAM,CAAC;IACN,KAAK,EAAE,SAAS;IAChB,OAAO,EAAE,SAAS;CACnB,CAAC;KACD,MAAM,EAAE,CAAC;AAKZ,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,OAAO,EAAE,SAAS,CAA2C,CAAC;AAE5F,yEAAyE;AACzE,MAAM,CAAC,MAAM,gBAAgB,GAAG,WAAW,CAAC;AAK5C,gFAAgF;AAChF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAU,CAAC;AAChE,oGAAoG;AACpG,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AACnC,qCAAqC;AACrC,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC;AAE1C,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,eAAe,CAAC;AAEvD;;;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KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAClC,IAAI,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,SAAS,IAAI,MAAM,CAAC,IAAI,KAAK,IAAI,IAAI,MAAM,CAAC,QAAQ,KAAK,IAAI,IAAI,MAAM,CAAC,OAAO,KAAK,SAAS,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,KAAK,IAAI;gBAAE,OAAO;YAC5K,IAAI,aAAa,CAAC,MAAM,CAAC;gBAAE,OAAO;YAClC,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,gBAAgB,EAAE,QAAQ,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,GAAG,eAAe,IAAI,+BAA+B,MAAM,CAAC,GAAG,0CAA0C,EAAE,CAAC,CAAC;QAC5L,CAAC,CAAC,CAAC;QAEH,kHAAkH;QAClH,CAAC,CAAC,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE;YAC1C,IAAI,KAAK,CAAC,KAAK,KAAK,GAAG;gBAAE,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,cAAc,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,IAAI,GAAG,eAAe,IAAI,sEAAsE,EAAE,CAAC,CAAC;QACvL,CAAC,CAAC,CAAC;IACL,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,87 @@
1
+ /**
2
+ * LEADS: THE ADD-ON BLOCK'S `leads` WORD.
3
+ *
4
+ * An add-on that finds companies and people (it declares `addOn.sources` and
5
+ * provides `lead-source`) names the two of its own tables the engine keeps
6
+ * what was found in:
7
+ *
8
+ * ```json
9
+ * "addOn": { "leads": { "foundPeople": "found_people", "fieldSources": "field_sources" } }
10
+ * ```
11
+ *
12
+ * - `foundPeople`: one row per person a source found and Adminium stored in
13
+ * an app's people table: which row, which company, which source, when, the
14
+ * purpose they are kept for, by when they must be told and when they were,
15
+ * and the pages a source saw their address on;
16
+ * - `fieldSources`: one row per field a source filled on a record: which
17
+ * table, row and column, which source, when, and a hash of the value it
18
+ * wrote (a field's note shows only while the value still hashes the same).
19
+ *
20
+ * Each table must have the columns the engine reads and writes, by these
21
+ * names and of these kinds ({@link LEADS_COLUMNS}), and a numbered key.
22
+ * Adminium alone writes both: no role of the add-on, no app's grant and no
23
+ * step writes them, and no public entry opens them. Staff read them (the
24
+ * add-on's pages list the people found). Staff write the add-on's one
25
+ * settings row ({@link LEADS_SETTINGS_COLUMNS}), which the engine reads.
26
+ *
27
+ * No column here is JSON but the purpose's words: a found person's pages are
28
+ * one https address per line. A found person's address is kept on their row
29
+ * (`email`): the add-on's tell mail reads its recipient from it.
30
+ *
31
+ * Pure: no I/O, and nothing imported from the manifest's own schema file, so
32
+ * that file may import this one.
33
+ */
34
+ import { z } from 'zod';
35
+ import { type ContractColumn, type FormsAddOnShape, type FormsTableShape } from './forms.js';
36
+ import { type ReferenceIssue } from './refs.js';
37
+ /** The block: the add-on's own tables, by ref. Both are required. */
38
+ export declare const addOnLeadsSchema: z.ZodObject<{
39
+ foundPeople: z.ZodString;
40
+ fieldSources: z.ZodString;
41
+ }, z.core.$strict>;
42
+ export type AddOnLeads = z.infer<typeof addOnLeadsSchema>;
43
+ /** The two parts a leads block names. */
44
+ export type LeadsPart = keyof AddOnLeads;
45
+ export declare const LEADS_PARTS: readonly ["foundPeople", "fieldSources"];
46
+ /** The category a package that declares leads is filed under. */
47
+ export declare const LEADS_CATEGORY = "marketing";
48
+ /** What one column of a leads table, or of its settings table, must be. */
49
+ export type LeadsColumn = ContractColumn<LeadsPart>;
50
+ /** Where a found person stands: waiting to be told, told, the mail failed, or they objected. */
51
+ export declare const FOUND_PERSON_STATES: readonly ["waiting", "told", "failed", "objected"];
52
+ /** The longest list of a found person's pages, one https address per line. */
53
+ export declare const FOUND_PERSON_PAGES_MAX = 4000;
54
+ /** The longest address a found person is kept with. */
55
+ export declare const FOUND_PERSON_EMAIL_MAX = 320;
56
+ /** The longest purpose a found person is kept for, as copied when they are stored. */
57
+ export declare const FOUND_PERSON_PURPOSE_MAX = 500;
58
+ /** The years a found person is kept by default, and the range the owner may set. */
59
+ export declare const LEADS_KEEP_YEARS_DEFAULT = 3;
60
+ export declare const LEADS_KEEP_YEARS_MIN = 1;
61
+ export declare const LEADS_KEEP_YEARS_MAX = 10;
62
+ /** The columns of a field's source that name one field: no two rows name the same. */
63
+ export declare const FIELD_SOURCE_KEY: readonly ["table_ref", "row_key", "column_name"];
64
+ /**
65
+ * The columns each part has, which the engine reads and writes by these
66
+ * names. A table may have more of its own; each other column is one an
67
+ * insert may leave out, as Adminium alone writes both. A column not marked
68
+ * nullable is always written, so it may not be nullable either.
69
+ */
70
+ export declare const LEADS_COLUMNS: Readonly<Record<LeadsPart, Readonly<Record<string, LeadsColumn>>>>;
71
+ /**
72
+ * The columns of the add-on's one settings row (`addOn.settingsTable`) the
73
+ * engine reads. Staff write them. A `json` column takes no default, so it is
74
+ * nullable: the engine reads an empty one as nothing set.
75
+ */
76
+ export declare const LEADS_SETTINGS_COLUMNS: Readonly<Record<string, LeadsColumn>>;
77
+ /** A table of the add-on, with the unique sets it declares. */
78
+ export type LeadsTableShape = FormsTableShape & {
79
+ unique?: readonly (readonly string[])[] | undefined;
80
+ };
81
+ /** What the checks read of the add-on beside its leads block. */
82
+ export interface LeadsAddOnShape extends Omit<FormsAddOnShape, 'tables'> {
83
+ tables: readonly LeadsTableShape[];
84
+ }
85
+ /** Everything wrong with an add-on's leads block, against its own tables, settings table, roles, entries and steps. */
86
+ export declare function leadsBlockIssues(block: AddOnLeads, m: LeadsAddOnShape): ReferenceIssue[];
87
+ //# sourceMappingURL=leads.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,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C;AAEF;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAOxE,CAAC;AAKF,+DAA+D;AAC/D,MAAM,MAAM,eAAe,GAAG,eAAe,GAAG;IAAE,MAAM,CAAC,EAAE,SAAS,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,GAAG,SAAS,CAAA;CAAE,CAAC;AAExG,iEAAiE;AACjE,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAAC,eAAe,EAAE,QAAQ,CAAC;IACtE,MAAM,EAAE,SAAS,eAAe,EAAE,CAAC;CACpC;AAED,uHAAuH;AACvH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,UAAU,EAAE,CAAC,EAAE,eAAe,GAAG,cAAc,EAAE,CA4DxF"}
package/dist/leads.js ADDED
@@ -0,0 +1,243 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ /**
3
+ * LEADS: THE ADD-ON BLOCK'S `leads` WORD.
4
+ *
5
+ * An add-on that finds companies and people (it declares `addOn.sources` and
6
+ * provides `lead-source`) names the two of its own tables the engine keeps
7
+ * what was found in:
8
+ *
9
+ * ```json
10
+ * "addOn": { "leads": { "foundPeople": "found_people", "fieldSources": "field_sources" } }
11
+ * ```
12
+ *
13
+ * - `foundPeople`: one row per person a source found and Adminium stored in
14
+ * an app's people table: which row, which company, which source, when, the
15
+ * purpose they are kept for, by when they must be told and when they were,
16
+ * and the pages a source saw their address on;
17
+ * - `fieldSources`: one row per field a source filled on a record: which
18
+ * table, row and column, which source, when, and a hash of the value it
19
+ * wrote (a field's note shows only while the value still hashes the same).
20
+ *
21
+ * Each table must have the columns the engine reads and writes, by these
22
+ * names and of these kinds ({@link LEADS_COLUMNS}), and a numbered key.
23
+ * Adminium alone writes both: no role of the add-on, no app's grant and no
24
+ * step writes them, and no public entry opens them. Staff read them (the
25
+ * add-on's pages list the people found). Staff write the add-on's one
26
+ * settings row ({@link LEADS_SETTINGS_COLUMNS}), which the engine reads.
27
+ *
28
+ * No column here is JSON but the purpose's words: a found person's pages are
29
+ * one https address per line. A found person's address is kept on their row
30
+ * (`email`): the add-on's tell mail reads its recipient from it.
31
+ *
32
+ * Pure: no I/O, and nothing imported from the manifest's own schema file, so
33
+ * that file may import this one.
34
+ */
35
+ import { z } from 'zod';
36
+ import { contractColumns, describeContractColumn } from './forms.js';
37
+ import { refSchema } from './refs.js';
38
+ /** The block: the add-on's own tables, by ref. Both are required. */
39
+ export const addOnLeadsSchema = z
40
+ .object({
41
+ foundPeople: refSchema,
42
+ fieldSources: refSchema,
43
+ })
44
+ .strict();
45
+ export const LEADS_PARTS = ['foundPeople', 'fieldSources'];
46
+ /** The category a package that declares leads is filed under. */
47
+ export const LEADS_CATEGORY = 'marketing';
48
+ /** Where a found person stands: waiting to be told, told, the mail failed, or they objected. */
49
+ export const FOUND_PERSON_STATES = ['waiting', 'told', 'failed', 'objected'];
50
+ /** The longest list of a found person's pages, one https address per line. */
51
+ export const FOUND_PERSON_PAGES_MAX = 4000;
52
+ /** The longest address a found person is kept with. */
53
+ export const FOUND_PERSON_EMAIL_MAX = 320;
54
+ /** The longest purpose a found person is kept for, as copied when they are stored. */
55
+ export const FOUND_PERSON_PURPOSE_MAX = 500;
56
+ /** The years a found person is kept by default, and the range the owner may set. */
57
+ export const LEADS_KEEP_YEARS_DEFAULT = 3;
58
+ export const LEADS_KEEP_YEARS_MIN = 1;
59
+ export const LEADS_KEEP_YEARS_MAX = 10;
60
+ /** The columns of a field's source that name one field: no two rows name the same. */
61
+ export const FIELD_SOURCE_KEY = ['table_ref', 'row_key', 'column_name'];
62
+ const { text, moment, date, json, whole, bool, choice } = contractColumns;
63
+ /**
64
+ * The columns each part has, which the engine reads and writes by these
65
+ * names. A table may have more of its own; each other column is one an
66
+ * insert may leave out, as Adminium alone writes both. A column not marked
67
+ * nullable is always written, so it may not be nullable either.
68
+ */
69
+ export const LEADS_COLUMNS = {
70
+ foundPeople: {
71
+ /** The people row the person was stored as: its table (`<app>:<table>`) and key. */
72
+ person_table: text(64),
73
+ person_key: text(200),
74
+ /** The company row they were found at, when there is one. */
75
+ company_table: text(64, true),
76
+ company_key: text(200, true),
77
+ /** The source id that found them (`addOn.sources[].id`). */
78
+ source: text(32),
79
+ found_at: moment(),
80
+ /** The purpose they are kept for, copied from the add-on's settings when they were stored. */
81
+ purpose: text(FOUND_PERSON_PURPOSE_MAX),
82
+ /** The day they must be told by, and when they were. */
83
+ tell_by: date(),
84
+ told_at: moment(true),
85
+ /** The outbox row of the mail that tells them. */
86
+ outbox_id: text(64, true),
87
+ state: choice(FOUND_PERSON_STATES),
88
+ /** The pages a source saw their address on, one https address per line. */
89
+ source_pages: text(FOUND_PERSON_PAGES_MAX, true),
90
+ /**
91
+ * Their address as found: where the tell mail goes (the add-on's outbox
92
+ * reads its recipient from here). Personal, so it is found, downloaded
93
+ * and erased with the row.
94
+ */
95
+ email: text(FOUND_PERSON_EMAIL_MAX, true),
96
+ },
97
+ fieldSources: {
98
+ /** The record's table (`<app>:<table>`), its key, and the column filled. */
99
+ table_ref: text(64),
100
+ row_key: text(200),
101
+ column_name: text(64),
102
+ source: text(32),
103
+ found_at: moment(),
104
+ /** The sha-256, in hex, of the value written, as the record page reads it (text, trimmed). */
105
+ value_hash: text(64),
106
+ },
107
+ };
108
+ /**
109
+ * The columns of the add-on's one settings row (`addOn.settingsTable`) the
110
+ * engine reads. Staff write them. A `json` column takes no default, so it is
111
+ * nullable: the engine reads an empty one as nothing set.
112
+ */
113
+ export const LEADS_SETTINGS_COLUMNS = {
114
+ /** Whether people are found and stored at all. */
115
+ people_on: bool(),
116
+ /** Why found people are kept, as Words: one plain sentence per language, no links. */
117
+ purpose: json(true),
118
+ /** How many years a found person is kept (1 to 10). */
119
+ keep_years: whole(),
120
+ };
121
+ /** The actions on a table no grant gives on a table only Adminium writes. */
122
+ const WRITES = ['create', 'update', 'import'];
123
+ /** Everything wrong with an add-on's leads block, against its own tables, settings table, roles, entries and steps. */
124
+ export function leadsBlockIssues(block, m) {
125
+ const out = [];
126
+ const tables = new Map(m.tables.map((table, t) => [table.ref, { table, t }]));
127
+ const at = (...rest) => ['addOn', 'leads', ...rest];
128
+ if (!m.categories.includes(LEADS_CATEGORY))
129
+ out.push({ path: ['categories'], message: `an add-on that declares leads is filed under the "${LEADS_CATEGORY}" category` });
130
+ if (block.foundPeople === block.fieldSources)
131
+ out.push({ path: at('fieldSources'), message: `"${block.fieldSources}" holds the people found already: each part of leads is a table of its own` });
132
+ for (const part of LEADS_PARTS) {
133
+ const ref = block[part];
134
+ const found = tables.get(ref);
135
+ if (found === undefined) {
136
+ out.push({ path: at(part), message: `"${ref}" is not one of this add-on's tables` });
137
+ continue;
138
+ }
139
+ const { table, t } = found;
140
+ const contract = LEADS_COLUMNS[part];
141
+ const what = part === 'foundPeople' ? 'the people found' : "the fields' sources";
142
+ out.push(...columnIssues(table, t, what, contract));
143
+ // A numbered key: the engine's own increment.
144
+ const k = table.columns.findIndex((column) => column.role === 'pk');
145
+ const key = table.columns[k];
146
+ if (key === undefined)
147
+ out.push({ path: at(part), message: `"${ref}" holds ${what}, so its rows are numbered: give it an int key (role "pk")` });
148
+ else if (key.type !== 'int' && key.type !== 'bigint')
149
+ out.push({ path: ['requiredSchema', 'tables', t, 'columns', k, 'type'], message: `"${ref}" holds ${what}, so its rows are numbered: its key "${key.ref}" is an int or a bigint, not ${key.type}` });
150
+ // A field is named once: the engine replaces its source when it fills the field again.
151
+ if (part === 'fieldSources') {
152
+ const want = [...FIELD_SOURCE_KEY].sort().join('\u0000');
153
+ if (!(table.unique ?? []).some((set) => [...set].sort().join('\u0000') === want)) {
154
+ out.push({ path: ['requiredSchema', 'tables', t, 'unique'], message: `"${ref}" names each field once: make ${FIELD_SOURCE_KEY.map((name) => `"${name}"`).join(', ')} a unique set` });
155
+ }
156
+ }
157
+ // Strangers never reach what was found about people.
158
+ (m.publicAccess ?? []).forEach((entry, e) => {
159
+ if (entry.table === ref)
160
+ out.push({ path: ['publicAccess', e, 'table'], message: `"${ref}" holds ${what}, which Adminium alone writes: no public entry opens it` });
161
+ });
162
+ // A table only Adminium writes: every other column is one its insert may leave out.
163
+ table.columns.forEach((column, c) => {
164
+ if (contract[column.ref] !== undefined || column.role === 'pk' || column.nullable === true || column.default !== undefined || m.decided?.(ref, column.ref) === true)
165
+ return;
166
+ out.push({ path: ['requiredSchema', 'tables', t, 'columns', c], message: `"${ref}" is written by Adminium alone, which never fills "${column.ref}": make it nullable or give it a default` });
167
+ });
168
+ out.push(...onlyAdminiumWrites(ref, t, what, m));
169
+ }
170
+ // The settings the engine reads: whether people are found, why they are kept, and for how long.
171
+ const settings = m.settingsTable === undefined ? undefined : tables.get(m.settingsTable);
172
+ if (m.settingsTable === undefined) {
173
+ out.push({ path: ['addOn', 'settingsTable'], message: 'an add-on that declares leads keeps whether people are found, why and for how long in a one-row settings table: name it in addOn.settingsTable' });
174
+ }
175
+ else if (settings !== undefined) {
176
+ out.push(...columnIssues(settings.table, settings.t, 'the settings of what is found', LEADS_SETTINGS_COLUMNS));
177
+ const c = settings.table.columns.findIndex((column) => column.ref === 'keep_years');
178
+ const keep = settings.table.columns[c]?.default;
179
+ if (c >= 0 && keep !== undefined && (typeof keep !== 'number' || !Number.isInteger(keep) || keep < LEADS_KEEP_YEARS_MIN || keep > LEADS_KEEP_YEARS_MAX)) {
180
+ out.push({ path: ['requiredSchema', 'tables', settings.t, 'columns', c, 'default'], message: `"${settings.table.ref}.keep_years" is a number of years from ${String(LEADS_KEEP_YEARS_MIN)} to ${String(LEADS_KEEP_YEARS_MAX)} (${String(LEADS_KEEP_YEARS_DEFAULT)} by default)` });
181
+ }
182
+ }
183
+ return out;
184
+ }
185
+ /** Each column a contract names, on one table: there, of its kind, its values, its width and its emptiness. */
186
+ function columnIssues(table, t, holds, contract) {
187
+ const out = [];
188
+ const ref = table.ref;
189
+ for (const [name, want] of Object.entries(contract)) {
190
+ const c = table.columns.findIndex((column) => column.ref === name);
191
+ const column = table.columns[c];
192
+ if (column === undefined) {
193
+ out.push({ path: ['requiredSchema', 'tables', t, 'columns'], message: `"${ref}" holds ${holds}, so it has a column "${name}" (${describeContractColumn(want)})` });
194
+ continue;
195
+ }
196
+ const say = (message, ...rest) => out.push({ path: ['requiredSchema', 'tables', t, 'columns', c, ...rest], message: `"${ref}.${name}" ${message}` });
197
+ if (!want.types.includes(column.type)) {
198
+ say(`is read and written by Adminium as ${describeContractColumn(want)}, not ${column.type}`, 'type');
199
+ continue;
200
+ }
201
+ if (want.nullable === true && column.nullable !== true)
202
+ say('is written empty until there is something to put in it: make it nullable', 'nullable');
203
+ if (want.nullable !== true && column.nullable === true)
204
+ say('always holds a value, which Adminium reads: make it not nullable', 'nullable');
205
+ if (want.atLeast !== undefined && column.maxLength !== undefined && column.maxLength < want.atLeast)
206
+ say(`takes up to ${String(want.atLeast)} characters: leave out maxLength, or make it at least that`, 'maxLength');
207
+ if (want.values !== undefined) {
208
+ const values = new Set(column.enum ?? []);
209
+ if (values.size !== want.values.length || !want.values.every((value) => values.has(value)))
210
+ say(`takes exactly ${want.values.map((value) => `"${value}"`).join(', ')}`, 'enum');
211
+ }
212
+ }
213
+ return out;
214
+ }
215
+ /**
216
+ * Nothing of the add-on writes a table only Adminium writes: no role's
217
+ * create, update or import, no app's grant beyond reading, no step (and no
218
+ * public entry). Staff read them.
219
+ */
220
+ function onlyAdminiumWrites(ref, t, what, m) {
221
+ const out = [];
222
+ const why = `${what} are written by Adminium alone`;
223
+ const roles = m.roles ?? [];
224
+ roles.forEach((role, r) => {
225
+ const from = role.cloneFrom === undefined ? undefined : roles.find((other) => other.key === role.cloneFrom);
226
+ const grants = new Set([...(from?.permissions ?? []), ...(role.permissions ?? [])]);
227
+ for (const action of WRITES) {
228
+ if (grants.has(`table:@${ref}:${action}`) || grants.has(`table:@*:${action}`)) {
229
+ out.push({ path: ['roles', r, 'permissions'], message: `"${role.key}" may ${action} "${ref}", and ${why}: a role reads them` });
230
+ }
231
+ }
232
+ });
233
+ (m.tables[t]?.appGrants?.actions ?? []).forEach((action, a) => {
234
+ if (action !== 'read')
235
+ out.push({ path: ['requiredSchema', 'tables', t, 'appGrants', 'actions', a], message: `${why}: an app's role may only read "${ref}"` });
236
+ });
237
+ (m.steps ?? []).forEach((step, s) => {
238
+ if (step.writes.table === ref)
239
+ out.push({ path: ['addOn', 'steps', s, 'writes', 'table'], message: `${why}: the step "${step.key}" may not write a row of "${ref}"` });
240
+ });
241
+ return out;
242
+ }
243
+ //# sourceMappingURL=leads.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"leads.js","sourceRoot":"","sources":["../src/leads.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAmE,MAAM,YAAY,CAAC;AACtI,OAAO,EAAE,SAAS,EAAuB,MAAM,WAAW,CAAC;AAE3D,qEAAqE;AACrE,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC;KAC9B,MAAM,CAAC;IACN,WAAW,EAAE,SAAS;IACtB,YAAY,EAAE,SAAS;CACxB,CAAC;KACD,MAAM,EAAE,CAAC;AAKZ,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,aAAa,EAAE,cAAc,CAAyC,CAAC;AAEnG,iEAAiE;AACjE,MAAM,CAAC,MAAM,cAAc,GAAG,WAAW,CAAC;AAK1C,gGAAgG;AAChG,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,CAAU,CAAC;AACtF,8EAA8E;AAC9E,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,CAAC;AAC3C,uDAAuD;AACvD,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,CAAC;AAC1C,sFAAsF;AACtF,MAAM,CAAC,MAAM,w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KAAK,GAAG;YAAE,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,GAAG,GAAG,eAAe,IAAI,CAAC,GAAG,6BAA6B,GAAG,GAAG,EAAE,CAAC,CAAC;IACzK,CAAC,CAAC,CAAC;IACH,OAAO,GAAG,CAAC;AACb,CAAC"}
package/dist/people.d.ts CHANGED
@@ -49,7 +49,10 @@
49
49
  * as existing customers. `{column, carryFrom: {table, column}}` also names
50
50
  * the mark of the row a person is made from (a claimed enquiry's), copied
51
51
  * in the save that makes them;
52
- * - `carry`: what an app update carries over once (see `carrySchema`).
52
+ * - `carry`: what an app update carries over once (see `carrySchema`);
53
+ * - `lead` (a `companies` entry only): where a found company's details go —
54
+ * its number, website, phone, address, activity, about, and the staff
55
+ * member who owns it — each a column of the table (see `leadSchema`).
53
56
  *
54
57
  * The consent column is not the outbox's `recipient.optIn`: that is a switch
55
58
  * for service mail (a reminder), and the two may differ.
@@ -137,6 +140,34 @@ declare const carrySchema: z.ZodUnion<readonly [z.ZodObject<{
137
140
  }, z.core.$strict>;
138
141
  }, z.core.$strict>]>;
139
142
  export type PeopleCarry = z.infer<typeof carrySchema>;
143
+ /**
144
+ * Where a company's details go, on a `companies` entry: the columns a found
145
+ * company is added with, or a company is filled in with. Every key is
146
+ * optional; each names a text column with a width (a value is cut to it),
147
+ * `country` one exactly 2 wide (ISO 3166-1 alpha-2 only), and `owner` a
148
+ * column that holds a staff member (`rules.staff`), set to whoever adds it.
149
+ */
150
+ export declare const leadSchema: z.ZodObject<{
151
+ number: z.ZodOptional<z.ZodString>;
152
+ website: z.ZodOptional<z.ZodString>;
153
+ phone: z.ZodOptional<z.ZodString>;
154
+ address: z.ZodOptional<z.ZodObject<{
155
+ lines: z.ZodOptional<z.ZodString>;
156
+ town: z.ZodOptional<z.ZodString>;
157
+ region: z.ZodOptional<z.ZodString>;
158
+ postalCode: z.ZodOptional<z.ZodString>;
159
+ country: z.ZodOptional<z.ZodString>;
160
+ }, z.core.$strict>>;
161
+ activity: z.ZodOptional<z.ZodString>;
162
+ about: z.ZodOptional<z.ZodString>;
163
+ owner: z.ZodOptional<z.ZodString>;
164
+ }, z.core.$strict>;
165
+ export type PeopleLead = z.infer<typeof leadSchema>;
166
+ /** The text columns a lead names, each with where it is written in the entry. */
167
+ export declare function leadTextColumns(lead: PeopleLead): {
168
+ column: string;
169
+ path: string[];
170
+ }[];
140
171
  /** An app's link column, as `table.column`. */
141
172
  export declare const LINK_PATH: RegExp;
142
173
  /**
@@ -225,6 +256,21 @@ export declare const peopleEntrySchema: z.ZodObject<{
225
256
  latest: z.ZodString;
226
257
  }, z.core.$strict>;
227
258
  }, z.core.$strict>]>>>;
259
+ lead: z.ZodOptional<z.ZodObject<{
260
+ number: z.ZodOptional<z.ZodString>;
261
+ website: z.ZodOptional<z.ZodString>;
262
+ phone: z.ZodOptional<z.ZodString>;
263
+ address: z.ZodOptional<z.ZodObject<{
264
+ lines: z.ZodOptional<z.ZodString>;
265
+ town: z.ZodOptional<z.ZodString>;
266
+ region: z.ZodOptional<z.ZodString>;
267
+ postalCode: z.ZodOptional<z.ZodString>;
268
+ country: z.ZodOptional<z.ZodString>;
269
+ }, z.core.$strict>>;
270
+ activity: z.ZodOptional<z.ZodString>;
271
+ about: z.ZodOptional<z.ZodString>;
272
+ owner: z.ZodOptional<z.ZodString>;
273
+ }, z.core.$strict>>;
228
274
  }, z.core.$strict>;
229
275
  export type PeopleEntry = z.infer<typeof peopleEntrySchema>;
230
276
  /** The opt-out mark's column, however the entry writes it. */
@@ -282,6 +328,21 @@ export declare const peopleSchema: z.ZodArray<z.ZodObject<{
282
328
  latest: z.ZodString;
283
329
  }, z.core.$strict>;
284
330
  }, z.core.$strict>]>>>;
331
+ lead: z.ZodOptional<z.ZodObject<{
332
+ number: z.ZodOptional<z.ZodString>;
333
+ website: z.ZodOptional<z.ZodString>;
334
+ phone: z.ZodOptional<z.ZodString>;
335
+ address: z.ZodOptional<z.ZodObject<{
336
+ lines: z.ZodOptional<z.ZodString>;
337
+ town: z.ZodOptional<z.ZodString>;
338
+ region: z.ZodOptional<z.ZodString>;
339
+ postalCode: z.ZodOptional<z.ZodString>;
340
+ country: z.ZodOptional<z.ZodString>;
341
+ }, z.core.$strict>>;
342
+ activity: z.ZodOptional<z.ZodString>;
343
+ about: z.ZodOptional<z.ZodString>;
344
+ owner: z.ZodOptional<z.ZodString>;
345
+ }, z.core.$strict>>;
285
346
  }, z.core.$strict>>;
286
347
  export type People = z.infer<typeof peopleSchema>;
287
348
  /** What the checks read of a column. */
@@ -289,6 +350,7 @@ interface PeopleColumn {
289
350
  ref: string;
290
351
  type: string;
291
352
  references?: string | undefined;
353
+ maxLength?: number | undefined;
292
354
  rules?: {
293
355
  stamp?: {
294
356
  strict?: true | undefined;
@@ -297,6 +359,7 @@ interface PeopleColumn {
297
359
  addOn: string;
298
360
  table: string;
299
361
  } | undefined;
362
+ staff?: true | undefined;
300
363
  } | undefined;
301
364
  }
302
365
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"people.d.ts","sourceRoot":"","sources":["../src/people.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgEG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAA6B,KAAK,cAAc,EAAE,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AAE5F,iCAAiC;AACjC,eAAO,MAAM,YAAY,kCAAmC,CAAC;AAC7D,0DAA0D;AAC1D,eAAO,MAAM,gBAAgB,oCAAqC,CAAC;AACnE,8DAA8D;AAC9D,eAAO,MAAM,kBAAkB,oBAAoB,CAAC;AACpD;;;;;GAKG;AACH,eAAO,MAAM,UAAU,gDAAiD,CAAC;AACzE,2EAA2E;AAC3E,eAAO,MAAM,UAAU,I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