@adminiumjs/manifest 0.3.0-rc.4 → 0.3.1

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 (67) hide show
  1. package/dist/add-ons.d.ts +63 -0
  2. package/dist/add-ons.d.ts.map +1 -0
  3. package/dist/add-ons.js +100 -0
  4. package/dist/add-ons.js.map +1 -0
  5. package/dist/booking.d.ts +100 -0
  6. package/dist/booking.d.ts.map +1 -0
  7. package/dist/booking.js +237 -0
  8. package/dist/booking.js.map +1 -0
  9. package/dist/documents.d.ts +100 -0
  10. package/dist/documents.d.ts.map +1 -0
  11. package/dist/documents.js +148 -0
  12. package/dist/documents.js.map +1 -0
  13. package/dist/formula.d.ts +124 -0
  14. package/dist/formula.d.ts.map +1 -0
  15. package/dist/formula.js +428 -0
  16. package/dist/formula.js.map +1 -0
  17. package/dist/index.d.ts +14 -3
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.js +14 -3
  20. package/dist/index.js.map +1 -1
  21. package/dist/outbox.d.ts +543 -0
  22. package/dist/outbox.d.ts.map +1 -0
  23. package/dist/outbox.js +559 -0
  24. package/dist/outbox.js.map +1 -0
  25. package/dist/page-calendar.d.ts +42 -0
  26. package/dist/page-calendar.d.ts.map +1 -0
  27. package/dist/page-calendar.js +95 -0
  28. package/dist/page-calendar.js.map +1 -0
  29. package/dist/plan-model.d.ts +1 -1
  30. package/dist/plan-model.d.ts.map +1 -1
  31. package/dist/public-access.d.ts +208 -0
  32. package/dist/public-access.d.ts.map +1 -0
  33. package/dist/public-access.js +681 -0
  34. package/dist/public-access.js.map +1 -0
  35. package/dist/refs.d.ts +91 -0
  36. package/dist/refs.d.ts.map +1 -0
  37. package/dist/refs.js +82 -0
  38. package/dist/refs.js.map +1 -0
  39. package/dist/roles.d.ts +44 -0
  40. package/dist/roles.d.ts.map +1 -0
  41. package/dist/roles.js +75 -0
  42. package/dist/roles.js.map +1 -0
  43. package/dist/sample.d.ts +150 -2
  44. package/dist/sample.d.ts.map +1 -1
  45. package/dist/sample.js +101 -3
  46. package/dist/sample.js.map +1 -1
  47. package/dist/schema.d.ts +3464 -151
  48. package/dist/schema.d.ts.map +1 -1
  49. package/dist/schema.js +681 -143
  50. package/dist/schema.js.map +1 -1
  51. package/dist/semver.d.ts +28 -0
  52. package/dist/semver.d.ts.map +1 -0
  53. package/dist/semver.js +85 -0
  54. package/dist/semver.js.map +1 -0
  55. package/dist/shapes.d.ts +97 -0
  56. package/dist/shapes.d.ts.map +1 -0
  57. package/dist/shapes.js +190 -0
  58. package/dist/shapes.js.map +1 -0
  59. package/dist/states.d.ts +134 -0
  60. package/dist/states.d.ts.map +1 -0
  61. package/dist/states.js +244 -0
  62. package/dist/states.js.map +1 -0
  63. package/dist/validate.d.ts +14 -0
  64. package/dist/validate.d.ts.map +1 -1
  65. package/dist/validate.js +29 -2
  66. package/dist/validate.js.map +1 -1
  67. package/package.json +2 -2
@@ -0,0 +1,42 @@
1
+ /**
2
+ * A calendar page's columns: `config.calendar` on a `page-calendar` page.
3
+ *
4
+ * Left to itself Adminium plots a calendar by the first date of the table it
5
+ * reads and titles it with the table's display column — on a table of
6
+ * appointments that also keeps a first visit's date of birth, every visit
7
+ * landed on a birthday. An app says which columns instead:
8
+ *
9
+ * ```json
10
+ * "config": { "calendar": { "start": "starts_at", "title": "patient_id.name", "category": "visit_type_id" } }
11
+ * ```
12
+ *
13
+ * - `start` (required) and `end`: a `date` or `timestamptz` column of the
14
+ * page's table;
15
+ * - `title`: a column of the page's table, or `<fk column>.<column>` — a
16
+ * column of the table that foreign key points at (the patient's name);
17
+ * - `category`: a column of the page's table, what the rows are coloured and
18
+ * filtered by.
19
+ *
20
+ * Every name is the app's own (a column ref), checked here against
21
+ * `requiredSchema`, so an app's CI refuses a typo long before an install.
22
+ * Without it, a table with a booking rule is plotted by the booking's `start`.
23
+ */
24
+ import { z } from 'zod';
25
+ import { type ColumnShape, type ReferenceIssue, type TableIndex } from './refs.js';
26
+ export declare const pageCalendarSchema: z.ZodObject<{
27
+ start: z.ZodString;
28
+ end: z.ZodOptional<z.ZodString>;
29
+ title: z.ZodOptional<z.ZodString>;
30
+ category: z.ZodOptional<z.ZodString>;
31
+ }, z.core.$strict>;
32
+ export type PageCalendar = z.infer<typeof pageCalendarSchema>;
33
+ /** What the check reads of a page. */
34
+ interface PageShape {
35
+ template: string;
36
+ bindings?: Readonly<Record<string, string>> | undefined;
37
+ config?: Readonly<Record<string, unknown>> | undefined;
38
+ }
39
+ /** Every problem with the pages' `config.calendar`, against the app's own tables. */
40
+ export declare function pageCalendarIssues<C extends ColumnShape>(pages: readonly PageShape[], index: TableIndex<C>): ReferenceIssue[];
41
+ export {};
42
+ //# sourceMappingURL=page-calendar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"page-calendar.d.ts","sourceRoot":"","sources":["../src/page-calendar.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAa,KAAK,WAAW,EAAE,KAAK,cAAc,EAAE,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AAK9F,eAAO,MAAM,kBAAkB;;;;;kBAOpB,CAAC;AACZ,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAI9D,sCAAsC;AACtC,UAAU,SAAS;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,SAAS,CAAC;IACxD,MAAM,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;CACxD;AAQD,qFAAqF;AACrF,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,WAAW,EAAE,KAAK,EAAE,SAAS,SAAS,EAAE,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,cAAc,EAAE,CA0C7H"}
@@ -0,0 +1,95 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ /**
3
+ * A calendar page's columns: `config.calendar` on a `page-calendar` page.
4
+ *
5
+ * Left to itself Adminium plots a calendar by the first date of the table it
6
+ * reads and titles it with the table's display column — on a table of
7
+ * appointments that also keeps a first visit's date of birth, every visit
8
+ * landed on a birthday. An app says which columns instead:
9
+ *
10
+ * ```json
11
+ * "config": { "calendar": { "start": "starts_at", "title": "patient_id.name", "category": "visit_type_id" } }
12
+ * ```
13
+ *
14
+ * - `start` (required) and `end`: a `date` or `timestamptz` column of the
15
+ * page's table;
16
+ * - `title`: a column of the page's table, or `<fk column>.<column>` — a
17
+ * column of the table that foreign key points at (the patient's name);
18
+ * - `category`: a column of the page's table, what the rows are coloured and
19
+ * filtered by.
20
+ *
21
+ * Every name is the app's own (a column ref), checked here against
22
+ * `requiredSchema`, so an app's CI refuses a typo long before an install.
23
+ * Without it, a table with a booking rule is plotted by the booking's `start`.
24
+ */
25
+ import { z } from 'zod';
26
+ import { refSchema } from './refs.js';
27
+ /** `patient_id.name`: a column of the table a foreign key points at. */
28
+ const titleSchema = z.string().regex(/^[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)?$/, 'a column, or <fk column>.<column>');
29
+ export const pageCalendarSchema = z
30
+ .object({
31
+ start: refSchema,
32
+ end: refSchema.optional(),
33
+ title: titleSchema.optional(),
34
+ category: refSchema.optional(),
35
+ })
36
+ .strict();
37
+ const DATE_TYPES = ['date', 'timestamptz'];
38
+ /** The table a page reads: its one binding, or the one keyed `rows`. */
39
+ function pageTable(page) {
40
+ const entries = Object.values(page.bindings ?? {});
41
+ return entries.length === 1 ? entries[0] : page.bindings?.['rows'];
42
+ }
43
+ /** Every problem with the pages' `config.calendar`, against the app's own tables. */
44
+ export function pageCalendarIssues(pages, index) {
45
+ const out = [];
46
+ pages.forEach((page, p) => {
47
+ const raw = page.config?.['calendar'];
48
+ if (raw === undefined)
49
+ return;
50
+ const at = (...rest) => ['pages', p, 'config', 'calendar', ...rest];
51
+ const parsed = pageCalendarSchema.safeParse(raw);
52
+ if (!parsed.success) {
53
+ for (const issue of parsed.error.issues)
54
+ out.push({ path: at(...issue.path.map((key) => (typeof key === 'symbol' ? String(key) : key))), message: issue.message });
55
+ return;
56
+ }
57
+ if (page.template !== 'page-calendar') {
58
+ out.push({ path: at(), message: `only a page-calendar plots by named columns, not a ${page.template}` });
59
+ return;
60
+ }
61
+ const table = pageTable(page);
62
+ if (table === undefined || index.table(table) === undefined) {
63
+ out.push({ path: at(), message: 'a calendar names its columns on a page bound to a table of the app' });
64
+ return;
65
+ }
66
+ const calendar = parsed.data;
67
+ for (const key of ['start', 'end']) {
68
+ const name = calendar[key];
69
+ if (name === undefined)
70
+ continue;
71
+ const column = index.column(table, name);
72
+ if (column === undefined)
73
+ out.push({ path: at(key), message: `"${table}" has no column "${name}"` });
74
+ else if (!DATE_TYPES.includes(column.type))
75
+ out.push({ path: at(key), message: `"${table}.${name}" is not a date or a timestamptz` });
76
+ }
77
+ if (calendar.category !== undefined && !index.has(table, calendar.category)) {
78
+ out.push({ path: at('category'), message: `"${table}" has no column "${calendar.category}"` });
79
+ }
80
+ if (calendar.title !== undefined) {
81
+ const [own, through] = calendar.title.split('.');
82
+ const column = index.column(table, own);
83
+ if (column === undefined)
84
+ out.push({ path: at('title'), message: `"${table}" has no column "${own}"` });
85
+ else if (through !== undefined) {
86
+ if (column.type !== 'fk' || column.references === undefined)
87
+ out.push({ path: at('title'), message: `"${table}.${own}" is not a foreign key` });
88
+ else if (!index.has(column.references, through))
89
+ out.push({ path: at('title'), message: `"${column.references}" has no column "${through}"` });
90
+ }
91
+ }
92
+ });
93
+ return out;
94
+ }
95
+ //# sourceMappingURL=page-calendar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"page-calendar.js","sourceRoot":"","sources":["../src/page-calendar.ts"],"names":[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AE,CAAC,CAAC;iBACnG,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;gBAC/B,IAAI,MAAM,CAAC,IAAI,KAAK,IAAI,IAAI,MAAM,CAAC,UAAU,KAAK,SAAS;oBAAE,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,IAAI,KAAK,IAAI,GAAG,wBAAwB,EAAE,CAAC,CAAC;qBAC3I,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,UAAU,EAAE,OAAO,CAAC;oBAAE,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,IAAI,MAAM,CAAC,UAAU,oBAAoB,OAAO,GAAG,EAAE,CAAC,CAAC;YACjJ,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;IACH,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -79,7 +79,7 @@ export interface PlannedReference {
79
79
  }
80
80
  /** A reason the plan cannot be applied, phrased for a person. */
81
81
  export interface PlanProblem {
82
- code: 'UNRESOLVED_REFERENCE' | 'COLUMN_TYPE_CONFLICT' | 'COLUMNS_REQUIRED' | 'RESERVED_TABLE' | 'FOREIGN_TABLE' | 'TABLE_TAKEN' | 'IDENTIFIER_TOO_LONG' | 'PREFIX_COLLISION' | 'PAGE_SLUG_TAKEN' | 'PAGE_FORM_INVALID' | 'ROLE_INVALID';
82
+ code: 'UNRESOLVED_REFERENCE' | 'COLUMN_TYPE_CONFLICT' | 'COLUMNS_REQUIRED' | 'RESERVED_TABLE' | 'FOREIGN_TABLE' | 'TABLE_TAKEN' | 'IDENTIFIER_TOO_LONG' | 'PREFIX_COLLISION' | 'PAGE_SLUG_TAKEN' | 'PAGE_FORM_INVALID' | 'ROLE_INVALID' | 'EMAIL_TEMPLATE_INVALID' | 'SHAPE_MISMATCH' | 'SHAPE_UNKNOWN';
83
83
  message: string;
84
84
  table: string;
85
85
  column?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"plan-model.d.ts","sourceRoot":"","sources":["../src/plan-model.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,8DAA8D;AAC9D,MAAM,WAAW,eAAe;IAC9B,kEAAkE;IAClE,MAAM,EAAE,SAAS;QACf,GAAG,EAAE,MAAM,CAAC;QACZ,OAAO,EAAE,SAAS,kBAAkB,EAAE,CAAC;KACxC,EAAE,CAAC;IACJ;;;;;OAKG;IACH,OAAO,CAAC,EAAE,UAAU,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAC;CACvD;AAED;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,kFAAkF;IAClF,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,gFAAgF;IAChF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4CAA4C;IAC5C,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,mFAAmF;IACnF,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,kFAAkF;IAClF,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAChC;AAED,qCAAqC;AACrC,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE7C,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,0EAA0E;IAC1E,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,0FAA0F;IAC1F,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,WAAW,CAAC;IACpB,OAAO,EAAE,aAAa,EAAE,CAAC;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ACd,KAAK,EAAE,UAAU,CAAC;IAClB,MAAM,EAAE,kBAAkB,CAAC;IAC3B,iDAAiD;IACjD,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,+DAA+D;IAC/D,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,oEAAoE;IACpE,gBAAgB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,gDAAgD;IAChD,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC;;;OAGG;IACH,OAAO,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC;IAC3B,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,sDAAsD;IACtD,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,aAAa,GAAG,aAAa,GAAG,kBAAkB,CAAA;KAAE,EAAE,CAAC;CAC3F"}
@@ -0,0 +1,208 @@
1
+ /**
2
+ * `publicAccess` — what the app's public screens may do with one table, and
3
+ * `publicKeys`, the browser keys beyond the one every app gets.
4
+ *
5
+ * An entry is served through a browser key the install creates: `customer`
6
+ * (the default, the app's public side) or one named in `publicKeys`. `GET`
7
+ * reads, `POST` creates; `PATCH` only behind a claim, on a narrow writable
8
+ * list. `availability` answers free or full per slot and never a row.
9
+ *
10
+ * CLAIMS. An entry with `claim` is the key's IDENTITY: proving you know a
11
+ * row's details (a mobile and a date of birth) opens a session on that row.
12
+ * An entry with `claimedBy` is a child of that identity: it reaches only the
13
+ * rows whose column holds the claimed row's key. `verify: 'email-code'` adds a
14
+ * second step, a code emailed to the row's own address, which raises the
15
+ * session from `lookup` to `verified`; an entry that says `level: 'verified'`
16
+ * refuses a session that has not taken it.
17
+ *
18
+ * Two more ways to claim. `verify: 'email-link'`: the person types only
19
+ * their address and Adminium emails a one-use link (and a code for another
20
+ * device); the session opens at `verified` from the link, and a typed
21
+ * address alone opens nothing. `by: 'token'`: an unguessable code in a
22
+ * column opens that one row, with no email at all (a handover page shared by
23
+ * link) — on a key of its own, since a key has one identity.
24
+ *
25
+ * An entry with `visibleWith` reaches a child's rows only where the parent
26
+ * entry reaches the parent row: a draft's lines stay as hidden as the draft.
27
+ */
28
+ import { z } from 'zod';
29
+ import { type ReferenceIssue, type TableIndex } from './refs.js';
30
+ /** The key every entry uses unless it names another. */
31
+ export declare const CUSTOMER_KEY = "customer";
32
+ export declare const claimSchema: z.ZodUnion<readonly [z.ZodObject<{
33
+ match: z.ZodArray<z.ZodString>;
34
+ verify: z.ZodOptional<z.ZodLiteral<"email-code">>;
35
+ email: z.ZodOptional<z.ZodString>;
36
+ }, z.core.$strict>, z.ZodObject<{
37
+ verify: z.ZodLiteral<"email-link">;
38
+ email: z.ZodString;
39
+ }, z.core.$strict>, z.ZodObject<{
40
+ by: z.ZodLiteral<"token">;
41
+ column: z.ZodString;
42
+ expires: z.ZodOptional<z.ZodString>;
43
+ stopped: z.ZodOptional<z.ZodString>;
44
+ }, z.core.$strict>]>;
45
+ export type Claim = z.infer<typeof claimSchema>;
46
+ /** How an identity entry claims: by details, by an emailed link, or by a token. */
47
+ export declare function claimKind(claim: Claim): 'lookup' | 'link' | 'token';
48
+ export declare const publicAccessSchema: z.ZodObject<{
49
+ table: z.ZodString;
50
+ kind: z.ZodOptional<z.ZodEnum<{
51
+ records: "records";
52
+ availability: "availability";
53
+ }>>;
54
+ methods: z.ZodArray<z.ZodEnum<{
55
+ GET: "GET";
56
+ POST: "POST";
57
+ PATCH: "PATCH";
58
+ }>>;
59
+ select: z.ZodOptional<z.ZodArray<z.ZodString>>;
60
+ writable: z.ZodOptional<z.ZodArray<z.ZodString>>;
61
+ filters: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
62
+ column: z.ZodString;
63
+ op: z.ZodEnum<{
64
+ in: "in";
65
+ eq: "eq";
66
+ neq: "neq";
67
+ gte: "gte";
68
+ lte: "lte";
69
+ }>;
70
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>]>;
71
+ }, z.core.$strict>, z.ZodUnion<readonly [z.ZodObject<{
72
+ column: z.ZodString;
73
+ op: z.ZodLiteral<"today">;
74
+ }, z.core.$strict>, z.ZodObject<{
75
+ column: z.ZodString;
76
+ op: z.ZodLiteral<"from-today">;
77
+ days: z.ZodOptional<z.ZodNumber>;
78
+ }, z.core.$strict>]>]>>>;
79
+ defaults: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
80
+ claim: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
81
+ match: z.ZodArray<z.ZodString>;
82
+ verify: z.ZodOptional<z.ZodLiteral<"email-code">>;
83
+ email: z.ZodOptional<z.ZodString>;
84
+ }, z.core.$strict>, z.ZodObject<{
85
+ verify: z.ZodLiteral<"email-link">;
86
+ email: z.ZodString;
87
+ }, z.core.$strict>, z.ZodObject<{
88
+ by: z.ZodLiteral<"token">;
89
+ column: z.ZodString;
90
+ expires: z.ZodOptional<z.ZodString>;
91
+ stopped: z.ZodOptional<z.ZodString>;
92
+ }, z.core.$strict>]>>;
93
+ claimedBy: z.ZodOptional<z.ZodObject<{
94
+ table: z.ZodString;
95
+ column: z.ZodString;
96
+ optional: z.ZodOptional<z.ZodLiteral<true>>;
97
+ }, z.core.$strict>>;
98
+ level: z.ZodOptional<z.ZodEnum<{
99
+ lookup: "lookup";
100
+ verified: "verified";
101
+ }>>;
102
+ visibleWith: z.ZodOptional<z.ZodObject<{
103
+ table: z.ZodString;
104
+ via: z.ZodString;
105
+ }, z.core.$strict>>;
106
+ files: z.ZodOptional<z.ZodArray<z.ZodString>>;
107
+ documents: z.ZodOptional<z.ZodArray<z.ZodString>>;
108
+ sensitive: z.ZodOptional<z.ZodBoolean>;
109
+ reason: z.ZodOptional<z.ZodString>;
110
+ onClaim: z.ZodOptional<z.ZodObject<{
111
+ clear: z.ZodArray<z.ZodString>;
112
+ }, z.core.$strict>>;
113
+ writableValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>>;
114
+ requires: z.ZodOptional<z.ZodArray<z.ZodString>>;
115
+ writableWhen: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodArray<z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodNull]>>, z.ZodLiteral<"from-now">, z.ZodLiteral<"from-today">, z.ZodLiteral<"before-today">, z.ZodObject<{
116
+ within: z.ZodNumber;
117
+ }, z.core.$strict>]>>>;
118
+ humanCheck: z.ZodOptional<z.ZodLiteral<true>>;
119
+ rank: z.ZodOptional<z.ZodObject<{
120
+ orderBy: z.ZodString;
121
+ where: z.ZodOptional<z.ZodObject<{
122
+ column: z.ZodString;
123
+ eq: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
124
+ }, z.core.$strict>>;
125
+ }, z.core.$strict>>;
126
+ maxOpen: z.ZodOptional<z.ZodObject<{
127
+ column: z.ZodString;
128
+ values: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
129
+ n: z.ZodNumber;
130
+ upcoming: z.ZodOptional<z.ZodString>;
131
+ }, z.core.$strict>>;
132
+ anonymous: z.ZodOptional<z.ZodObject<{
133
+ perValue: z.ZodOptional<z.ZodObject<{
134
+ columns: z.ZodArray<z.ZodString>;
135
+ n: z.ZodNumber;
136
+ }, z.core.$strict>>;
137
+ perKeyHour: z.ZodOptional<z.ZodNumber>;
138
+ plainText: z.ZodOptional<z.ZodArray<z.ZodString>>;
139
+ }, z.core.$strict>>;
140
+ requireSetting: z.ZodOptional<z.ZodArray<z.ZodObject<{
141
+ table: z.ZodString;
142
+ column: z.ZodString;
143
+ when: z.ZodOptional<z.ZodLiteral<"anonymous">>;
144
+ }, z.core.$strict>>>;
145
+ key: z.ZodOptional<z.ZodString>;
146
+ confirm: z.ZodOptional<z.ZodObject<{
147
+ template: z.ZodEnum<{
148
+ "booking-confirmation": "booking-confirmation";
149
+ }>;
150
+ to: z.ZodString;
151
+ code: z.ZodOptional<z.ZodString>;
152
+ when: z.ZodOptional<z.ZodString>;
153
+ party: z.ZodOptional<z.ZodString>;
154
+ name: z.ZodOptional<z.ZodString>;
155
+ venue: z.ZodOptional<z.ZodObject<{
156
+ table: z.ZodString;
157
+ name: z.ZodOptional<z.ZodString>;
158
+ address: z.ZodOptional<z.ZodString>;
159
+ phone: z.ZodOptional<z.ZodString>;
160
+ }, z.core.$strict>>;
161
+ link: z.ZodOptional<z.ZodString>;
162
+ }, z.core.$strict>>;
163
+ }, z.core.$strict>;
164
+ export type PublicAccess = z.infer<typeof publicAccessSchema>;
165
+ /**
166
+ * A browser key besides `customer`. It is never published to the app's public
167
+ * side: the staff side hands it only to someone signed in with `role`, and
168
+ * every request on it must carry that person's staff session too — a token
169
+ * copied out of the page opens nothing on its own. `enabledBy` switches it
170
+ * off with a bool in the settings row.
171
+ */
172
+ export declare const publicKeySchema: z.ZodObject<{
173
+ requiresStaff: z.ZodOptional<z.ZodObject<{
174
+ role: z.ZodString;
175
+ }, z.core.$strict>>;
176
+ enabledBy: z.ZodOptional<z.ZodObject<{
177
+ table: z.ZodString;
178
+ column: z.ZodString;
179
+ }, z.core.$strict>>;
180
+ }, z.core.$strict>;
181
+ export declare const publicKeysSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
182
+ requiresStaff: z.ZodOptional<z.ZodObject<{
183
+ role: z.ZodString;
184
+ }, z.core.$strict>>;
185
+ enabledBy: z.ZodOptional<z.ZodObject<{
186
+ table: z.ZodString;
187
+ column: z.ZodString;
188
+ }, z.core.$strict>>;
189
+ }, z.core.$strict>>;
190
+ export type PublicKey = z.infer<typeof publicKeySchema>;
191
+ interface PublicAccessContext {
192
+ index: TableIndex;
193
+ /** Columns Adminium decides on a table: a browser may never write them. */
194
+ decided: (table: string) => ReadonlySet<string>;
195
+ /** Whether the table carries a capacity or a booking rule to answer availability from. */
196
+ answersAvailability: (table: string) => boolean;
197
+ publicKeys: Readonly<Record<string, PublicKey>> | undefined;
198
+ roles: readonly {
199
+ key: string;
200
+ screensOnly?: boolean | undefined;
201
+ cloneFrom?: string | undefined;
202
+ permissions?: readonly string[] | undefined;
203
+ }[];
204
+ }
205
+ /** Everything in `publicAccess` and `publicKeys` that names something undeclared, or breaks a rule. */
206
+ export declare function publicAccessIssues(entries: readonly PublicAccess[], ctx: PublicAccessContext): ReferenceIssue[];
207
+ export {};
208
+ //# sourceMappingURL=public-access.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public-access.d.ts","sourceRoot":"","sources":["../src/public-access.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAKL,KAAK,cAAc,EACnB,KAAK,UAAU,EAChB,MAAM,WAAW,CAAC;AAEnB,wDAAwD;AACxD,eAAO,MAAM,YAAY,aAAa,CAAC;AAmDvC,eAAO,MAAM,WAAW;;;;;;;;;;;;oBAAkE,CAAC;AAC3F,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEhD,mFAAmF;AACnF,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAInE;AASD,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAkHpB,CAAC;AACZ,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D;;;;;;GAMG;A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