@adminiumjs/manifest 0.3.0-rc.3 → 0.3.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.
Files changed (57) hide show
  1. package/dist/booking.d.ts +100 -0
  2. package/dist/booking.d.ts.map +1 -0
  3. package/dist/booking.js +237 -0
  4. package/dist/booking.js.map +1 -0
  5. package/dist/index.d.ts +8 -1
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +8 -1
  8. package/dist/index.js.map +1 -1
  9. package/dist/outbox.d.ts +198 -0
  10. package/dist/outbox.d.ts.map +1 -0
  11. package/dist/outbox.js +355 -0
  12. package/dist/outbox.js.map +1 -0
  13. package/dist/page-calendar.d.ts +42 -0
  14. package/dist/page-calendar.d.ts.map +1 -0
  15. package/dist/page-calendar.js +95 -0
  16. package/dist/page-calendar.js.map +1 -0
  17. package/dist/plan-context.d.ts +51 -0
  18. package/dist/plan-context.d.ts.map +1 -0
  19. package/dist/plan-context.js +356 -0
  20. package/dist/plan-context.js.map +1 -0
  21. package/dist/plan-model.d.ts +197 -0
  22. package/dist/plan-model.d.ts.map +1 -0
  23. package/dist/plan-model.js +11 -0
  24. package/dist/plan-model.js.map +1 -0
  25. package/dist/plan-types.d.ts +12 -0
  26. package/dist/plan-types.d.ts.map +1 -0
  27. package/dist/plan-types.js +71 -0
  28. package/dist/plan-types.js.map +1 -0
  29. package/dist/plan.d.ts +9 -90
  30. package/dist/plan.d.ts.map +1 -1
  31. package/dist/plan.js +48 -1
  32. package/dist/plan.js.map +1 -1
  33. package/dist/public-access.d.ts +167 -0
  34. package/dist/public-access.d.ts.map +1 -0
  35. package/dist/public-access.js +475 -0
  36. package/dist/public-access.js.map +1 -0
  37. package/dist/refs.d.ts +74 -0
  38. package/dist/refs.d.ts.map +1 -0
  39. package/dist/refs.js +70 -0
  40. package/dist/refs.js.map +1 -0
  41. package/dist/roles.d.ts +44 -0
  42. package/dist/roles.d.ts.map +1 -0
  43. package/dist/roles.js +75 -0
  44. package/dist/roles.js.map +1 -0
  45. package/dist/sample.d.ts +200 -0
  46. package/dist/sample.d.ts.map +1 -0
  47. package/dist/sample.js +208 -0
  48. package/dist/sample.js.map +1 -0
  49. package/dist/schema.d.ts +2031 -51
  50. package/dist/schema.d.ts.map +1 -1
  51. package/dist/schema.js +559 -18
  52. package/dist/schema.js.map +1 -1
  53. package/dist/semver.d.ts +28 -0
  54. package/dist/semver.d.ts.map +1 -0
  55. package/dist/semver.js +85 -0
  56. package/dist/semver.js.map +1 -0
  57. package/package.json +2 -2
@@ -0,0 +1,71 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ /**
3
+ * Whether an existing column can hold what a manifest stores in it — shared by
4
+ * both halves of the planner.
5
+ */
6
+ /**
7
+ * The logical types an existing column may have for each declared type, on
8
+ * every engine. Deliberately generous: a column that can hold every value the
9
+ * app writes is not a conflict, whatever it is called. A foreign key is judged
10
+ * by the key it points at, which the DDL resolves, so it is never judged here.
11
+ */
12
+ const ACCEPTS = {
13
+ id: ['varchar', 'text', 'uuid'],
14
+ text: ['text', 'varchar', 'enum'],
15
+ int: ['integer', 'bigint'],
16
+ bigint: ['bigint'],
17
+ decimal: ['decimal'],
18
+ money: ['decimal'],
19
+ float: ['float', 'decimal'],
20
+ bool: ['boolean'],
21
+ enum: ['enum', 'varchar', 'text'],
22
+ json: ['json'],
23
+ date: ['date', 'timestamp', 'timestamptz'],
24
+ timestamptz: ['timestamptz', 'timestamp'],
25
+ uuid: ['uuid', 'varchar', 'text'],
26
+ blob: ['binary'],
27
+ fk: null,
28
+ };
29
+ /**
30
+ * What SQLite reports for the columns the installer itself creates there: it
31
+ * has four storage classes, so `bool` is an `integer`, `money` a `float` (REAL)
32
+ * and `json` plain `text`. Without these, an app's own table would conflict
33
+ * with the app on every SQLite reinstall.
34
+ */
35
+ const SQLITE_ALSO = {
36
+ bigint: ['integer'],
37
+ decimal: ['float'],
38
+ money: ['float'],
39
+ bool: ['integer'],
40
+ json: ['text'],
41
+ };
42
+ /**
43
+ * Why an existing column cannot hold what the manifest stores in it — its type,
44
+ * named for a person — or `null` when it can (or cannot be judged).
45
+ */
46
+ export function typeConflict(declared, existing, dialect) {
47
+ const accepts = ACCEPTS[declared.type];
48
+ const have = existing.logicalType;
49
+ if (accepts === null || have === undefined || have === 'unknown')
50
+ return null;
51
+ const also = dialect === 'sqlite' ? (SQLITE_ALSO[declared.type] ?? []) : [];
52
+ if (!accepts.includes(have) && !also.includes(have))
53
+ return have;
54
+ // A width narrower than the one the app declares. An app that declares no
55
+ // width is not judged: the installer itself keys MySQL text as varchar(255).
56
+ if (declared.type === 'text' &&
57
+ have === 'varchar' &&
58
+ typeof existing.maxLength === 'number' &&
59
+ declared.maxLength !== undefined &&
60
+ existing.maxLength < declared.maxLength) {
61
+ return `varchar(${String(existing.maxLength)})`;
62
+ }
63
+ // An enum column narrower than its longest value.
64
+ if (declared.type === 'enum' && have === 'varchar' && typeof existing.maxLength === 'number') {
65
+ const longest = Math.max(0, ...(declared.enum ?? []).map((value) => value.length));
66
+ if (existing.maxLength < longest)
67
+ return `varchar(${String(existing.maxLength)})`;
68
+ }
69
+ return null;
70
+ }
71
+ //# sourceMappingURL=plan-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plan-types.js","sourceRoot":"","sources":["../src/plan-types.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC;;;GAGG;AAKH;;;;;GAKG;AACH,MAAM,OAAO,GAAuE;IAClF,EAAE,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC;IAC/B,IAAI,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC;IACjC,GAAG,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC;IAC1B,MAAM,EAAE,CAAC,QAAQ,CAAC;IAClB,OAAO,EAAE,CAAC,SAAS,CAAC;IACpB,KAAK,EAAE,CAAC,SAAS,CAAC;IAClB,KAAK,EAAE,CAAC,OAAO,EAAE,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;IAC7E,IACE,QAAQ,CAAC,IAAI,KAAK,MAAM;QACxB,IAAI,KAAK,SAAS;QAClB,OAAO,QAAQ,CAAC,SAAS,KAAK,QAAQ;QACtC,QAAQ,CAAC,SAAS,KAAK,SAAS;QAChC,QAAQ,CAAC,SAAS,GAAG,QAAQ,CAAC,SAAS,EACvC,CAAC;QACD,OAAO,WAAW,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC;IAClD,CAAC;IACD,kDAAkD;IAClD,IAAI,QAAQ,CAAC,IAAI,KAAK,MAAM,IAAI,IAAI,KAAK,SAAS,IAAI,OAAO,QAAQ,CAAC,SAAS,KAAK,QAAQ,EAAE,CAAC;QAC7F,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,QAAQ,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;QACnF,IAAI,QAAQ,CAAC,SAAS,GAAG,OAAO;YAAE,OAAO,WAAW,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC;IACpF,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
package/dist/plan.d.ts CHANGED
@@ -46,96 +46,9 @@
46
46
  * other tables — on MySQL, which has no transactional DDL, that leaves a
47
47
  * half-installed add-on with no rollback.
48
48
  */
49
+ import type { InstallPlan, PlanContext, SchemaModelView } from './plan-model.js';
49
50
  import type { Manifest } from './schema.js';
50
- /** The existing database, as much of it as planning needs. */
51
- export interface SchemaModelView {
52
- /** Every table name that already exists, however it got there. */
53
- tables: readonly {
54
- ref: string;
55
- columns: readonly ExistingColumnView[];
56
- }[];
57
- }
58
- /**
59
- * One existing column. Only `ref` is required; the rest is what the database
60
- * reports, and a caller that does not know it leaves it out. A column that
61
- * says nothing is never treated as required.
62
- */
63
- export interface ExistingColumnView {
64
- ref: string;
65
- nullable?: boolean;
66
- /** The database fills it when an insert leaves it out (a default, a sequence). */
67
- hasDefault?: boolean;
68
- isPrimaryKey?: boolean;
69
- isGenerated?: boolean;
70
- }
71
- /** What will happen to one table. */
72
- export type TableAction = 'create' | 'reuse';
73
- export interface PlannedColumn {
74
- ref: string;
75
- type: string;
76
- /** Absent from an existing table, so the install would have to add it. */
77
- missing: boolean;
78
- }
79
- export interface PlannedTable {
80
- ref: string;
81
- action: TableAction;
82
- columns: PlannedColumn[];
83
- /**
84
- * Only on `reuse`: columns the manifest requires that the existing table does
85
- * not have. A non-empty list is a PARTIAL MATCH — the table is there but does
86
- * not carry what the add-on needs, which is a different situation from either
87
- * "create it" or "it fits", and the operator should be told which.
88
- */
89
- missingColumns: string[];
90
- }
91
- /** Where one declared foreign key ends up pointing. */
92
- export interface PlannedReference {
93
- fromTable: string;
94
- fromColumn: string;
95
- to: string;
96
- /**
97
- * `internal` — the target is another table in this manifest.
98
- * `host` — the target already exists in the database (the add-on attaching to
99
- * the host's data, which is the intended shape).
100
- * `unresolved` — the target exists nowhere, and the plan is not installable.
101
- */
102
- resolution: 'internal' | 'host' | 'unresolved';
103
- }
104
- /** A reason the plan cannot be applied, phrased for a person. */
105
- export interface PlanProblem {
106
- code: 'UNRESOLVED_REFERENCE' | 'COLUMN_TYPE_CONFLICT' | 'RESERVED_TABLE' | 'FOREIGN_TABLE';
107
- message: string;
108
- table: string;
109
- column?: string;
110
- }
111
- export interface InstallPlan {
112
- /**
113
- * The manifest key this plan is for.
114
- *
115
- * Named `addOnKey` because add-ons were the only caller when it was written,
116
- * and left named that because the wire DTOs each route builds are where a
117
- * reader meets it — `routes/apps` spells it `key` on its own reply. Renaming
118
- * it here would churn three call sites and a shipped dialog for a field only
119
- * the server reads.
120
- */
121
- addOnKey: string;
122
- version: string;
123
- /** Tables to create, in declaration order (targets before dependents). */
124
- create: PlannedTable[];
125
- /** Tables that already exist and will be reused rather than created. */
126
- reuse: PlannedTable[];
127
- references: PlannedReference[];
128
- problems: PlanProblem[];
129
- /**
130
- * `true` when there is nothing standing in the way. A plan with problems is
131
- * still RETURNED — the consent dialog has to be able to show WHY an add-on
132
- * cannot be installed here, and an exception would leave it with nothing to
133
- * render.
134
- */
135
- installable: boolean;
136
- /** No `requiredSchema` at all: install touches no data source. */
137
- touchesData: boolean;
138
- }
51
+ export type { ExistingColumnView, InstallPlan, PlannedColumn, PlannedReference, PlannedTable, PlanProblem, SchemaModelView, TableAction, } from './plan-model.js';
139
52
  /**
140
53
  * Diffs a manifest's `requiredSchema` against the database it would install
141
54
  * into. Pure: no I/O, no side effects, safe to run for a preview.
@@ -145,5 +58,11 @@ export interface InstallPlan {
145
58
  * an "add-on" cannot be installed while looking at an app's install dialog is
146
59
  * the kind of small wrongness that makes someone distrust the whole screen.
147
60
  */
148
- export declare function planInstall(manifest: Manifest, model: SchemaModelView): InstallPlan;
61
+ export declare function planInstall(manifest: Manifest, model: SchemaModelView,
62
+ /**
63
+ * What the server knows about this connection (prefix, the table record,
64
+ * other apps, the operator's answers). Absent — every add-on, and any older
65
+ * caller — the plan is exactly what it always was.
66
+ */
67
+ context?: PlanContext): InstallPlan;
149
68
  //# sourceMappingURL=plan.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../src/plan.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAiC,MAAM,aAAa,CAAC;AAE3E,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;CACL;AAED;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB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H,WAAW,EAAE,OAAO,CAAC;IACrB,kEAAkE;IAClE,WAAW,EAAE,OAAO,CAAC;CACtB;AA0BD;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,eAAe,GAAG,WAAW,CA6HnF"}
1
+ {"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../src/plan.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAGH,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EAKX,eAAe,EAChB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,QAAQ,EAAiC,MAAM,aAAa,CAAC;AAE3E,YAAY,EACV,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,WAAW,EACX,eAAe,EACf,WAAW,GACZ,MAAM,iBAAiB,CAAC;AA2BzB;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CACzB,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,eAAe;AACtB;;;;GAIG;AACH,OAAO,CAAC,EAAE,WAAW,GACpB,WAAW,CAoKb"}
package/dist/plan.js CHANGED
@@ -47,6 +47,8 @@
47
47
  * other tables — on MySQL, which has no transactional DDL, that leaves a
48
48
  * half-installed add-on with no rollback.
49
49
  */
50
+ import { planWithContext } from './plan-context.js';
51
+ import { typeConflict } from './plan-types.js';
50
52
  /**
51
53
  * Table names an add-on may never claim, whatever its manifest says.
52
54
  *
@@ -75,7 +77,15 @@ function planColumns(table, existing) {
75
77
  * an "add-on" cannot be installed while looking at an app's install dialog is
76
78
  * the kind of small wrongness that makes someone distrust the whole screen.
77
79
  */
78
- export function planInstall(manifest, model) {
80
+ export function planInstall(manifest, model,
81
+ /**
82
+ * What the server knows about this connection (prefix, the table record,
83
+ * other apps, the operator's answers). Absent — every add-on, and any older
84
+ * caller — the plan is exactly what it always was.
85
+ */
86
+ context) {
87
+ if (context !== undefined)
88
+ return planWithContext(manifest, model, context);
79
89
  const required = manifest.requiredSchema?.tables ?? [];
80
90
  const noun = manifest.kind === 'app' ? 'app' : 'add-on';
81
91
  const existingByRef = new Map(model.tables.map((t) => [t.ref, t]));
@@ -140,6 +150,43 @@ export function planInstall(manifest, model) {
140
150
  });
141
151
  }
142
152
  }
153
+ /*
154
+ * EVERY REFUSAL ON THE CHECK STEP.
155
+ *
156
+ * A reused table missing columns the app writes, and a column that exists
157
+ * with a type the app's values do not fit, used to plan as "installable" —
158
+ * the wizard showed "reuse" with Install enabled, and the install then
159
+ * refused with a bare error naming no table (the owner's own install hit
160
+ * exactly that). They are problems now, so the check step names the table
161
+ * and Install stays disabled until it is resolved.
162
+ */
163
+ // Apps only, like FOREIGN_TABLE below: an add-on reuses its HOST's tables,
164
+ // and keeps its own refusal for a host missing columns.
165
+ if (existing !== undefined && manifest.kind === 'app' && missingColumns.length > 0) {
166
+ const list = missingColumns.map((ref) => `"${ref}"`).join(', ');
167
+ problems.push({
168
+ code: 'COLUMNS_REQUIRED',
169
+ table: table.ref,
170
+ column: missingColumns[0],
171
+ message: `This database already has a "${table.ref}" table, and it is missing ${list}, which ` +
172
+ `this ${noun} writes. Add ${missingColumns.length === 1 ? 'it' : 'them'} to the table, ` +
173
+ `or install against a different database.`,
174
+ });
175
+ }
176
+ if (existing !== undefined && manifest.kind === 'app') {
177
+ for (const column of table.columns) {
178
+ const have = existing.columns.find((c) => c.ref === column.ref);
179
+ const conflict = have === undefined ? null : typeConflict(column, have, model.dialect);
180
+ if (conflict === null)
181
+ continue;
182
+ problems.push({
183
+ code: 'COLUMN_TYPE_CONFLICT',
184
+ table: table.ref,
185
+ column: column.ref,
186
+ message: `"${table.ref}.${column.ref}" already exists as ${conflict}, which cannot hold the ${column.type} values this ${noun} stores in it.`,
187
+ });
188
+ }
189
+ }
143
190
  for (const column of table.columns) {
144
191
  if (column.type !== 'fk' || column.references === undefined)
145
192
  continue;
package/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C,CAAC,IAAI,KAAK,CAAC,GAAG,IAAI,MAAM,CAAC,GAAG,+BAA+B,MAAM,gBAAgB;4BAChF,+EAA+E;4BAC/E,qCAAqC;wBACvC,CAAC,CAAC,IAAI,KAAK,CAAC,GAAG,IAAI,MAAM,CAAC,GAAG,+BAA+B,MAAM,gBAAgB;4BAChF,iFAAiF;4BACjF,sEAAsE;iBAC7E,CAAC,CAAC;YACL,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO;QACL,QAAQ,EAAE,QAAQ,CAAC,GAAG;QACtB,OAAO,EAAE,QAAQ,CAAC,OAAO;QACzB,MAAM;QACN,KAAK;QACL,UAAU;QACV,QAAQ;QACR,WAAW,EAAE,QAAQ,CAAC,MAAM,KAAK,CAAC;QAClC,WAAW,EAAE,QAAQ,CAAC,MAAM,GAAG,CAAC;KACjC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,167 @@
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
+ import { z } from 'zod';
19
+ import { type ReferenceIssue, type TableIndex } from './refs.js';
20
+ /** The key every entry uses unless it names another. */
21
+ export declare const CUSTOMER_KEY = "customer";
22
+ export declare const publicAccessSchema: z.ZodObject<{
23
+ table: z.ZodString;
24
+ kind: z.ZodOptional<z.ZodEnum<{
25
+ records: "records";
26
+ availability: "availability";
27
+ }>>;
28
+ methods: z.ZodArray<z.ZodEnum<{
29
+ GET: "GET";
30
+ POST: "POST";
31
+ PATCH: "PATCH";
32
+ }>>;
33
+ select: z.ZodOptional<z.ZodArray<z.ZodString>>;
34
+ writable: z.ZodOptional<z.ZodArray<z.ZodString>>;
35
+ filters: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
36
+ column: z.ZodString;
37
+ op: z.ZodEnum<{
38
+ in: "in";
39
+ eq: "eq";
40
+ neq: "neq";
41
+ gte: "gte";
42
+ lte: "lte";
43
+ }>;
44
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>]>;
45
+ }, z.core.$strict>, z.ZodUnion<readonly [z.ZodObject<{
46
+ column: z.ZodString;
47
+ op: z.ZodLiteral<"today">;
48
+ }, z.core.$strict>, z.ZodObject<{
49
+ column: z.ZodString;
50
+ op: z.ZodLiteral<"from-today">;
51
+ days: z.ZodOptional<z.ZodNumber>;
52
+ }, z.core.$strict>]>]>>>;
53
+ defaults: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
54
+ claim: z.ZodOptional<z.ZodObject<{
55
+ match: z.ZodArray<z.ZodString>;
56
+ verify: z.ZodOptional<z.ZodLiteral<"email-code">>;
57
+ email: z.ZodOptional<z.ZodString>;
58
+ }, z.core.$strict>>;
59
+ claimedBy: z.ZodOptional<z.ZodObject<{
60
+ table: z.ZodString;
61
+ column: z.ZodString;
62
+ optional: z.ZodOptional<z.ZodLiteral<true>>;
63
+ }, z.core.$strict>>;
64
+ level: z.ZodOptional<z.ZodEnum<{
65
+ lookup: "lookup";
66
+ verified: "verified";
67
+ }>>;
68
+ sensitive: z.ZodOptional<z.ZodBoolean>;
69
+ reason: z.ZodOptional<z.ZodString>;
70
+ onClaim: z.ZodOptional<z.ZodObject<{
71
+ clear: z.ZodArray<z.ZodString>;
72
+ }, z.core.$strict>>;
73
+ writableValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>>;
74
+ writableWhen: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>, z.ZodLiteral<"from-now">, z.ZodObject<{
75
+ within: z.ZodNumber;
76
+ }, z.core.$strict>]>>>;
77
+ humanCheck: z.ZodOptional<z.ZodLiteral<true>>;
78
+ rank: z.ZodOptional<z.ZodObject<{
79
+ orderBy: z.ZodString;
80
+ where: z.ZodOptional<z.ZodObject<{
81
+ column: z.ZodString;
82
+ eq: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
83
+ }, z.core.$strict>>;
84
+ }, z.core.$strict>>;
85
+ maxOpen: z.ZodOptional<z.ZodObject<{
86
+ column: z.ZodString;
87
+ values: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
88
+ n: z.ZodNumber;
89
+ upcoming: z.ZodOptional<z.ZodString>;
90
+ }, z.core.$strict>>;
91
+ anonymous: z.ZodOptional<z.ZodObject<{
92
+ perValue: z.ZodOptional<z.ZodObject<{
93
+ columns: z.ZodArray<z.ZodString>;
94
+ n: z.ZodNumber;
95
+ }, z.core.$strict>>;
96
+ perKeyHour: z.ZodOptional<z.ZodNumber>;
97
+ plainText: z.ZodOptional<z.ZodArray<z.ZodString>>;
98
+ }, z.core.$strict>>;
99
+ requireSetting: z.ZodOptional<z.ZodArray<z.ZodObject<{
100
+ table: z.ZodString;
101
+ column: z.ZodString;
102
+ when: z.ZodOptional<z.ZodLiteral<"anonymous">>;
103
+ }, z.core.$strict>>>;
104
+ key: z.ZodOptional<z.ZodString>;
105
+ confirm: z.ZodOptional<z.ZodObject<{
106
+ template: z.ZodEnum<{
107
+ "booking-confirmation": "booking-confirmation";
108
+ }>;
109
+ to: z.ZodString;
110
+ code: z.ZodOptional<z.ZodString>;
111
+ when: z.ZodOptional<z.ZodString>;
112
+ party: z.ZodOptional<z.ZodString>;
113
+ name: z.ZodOptional<z.ZodString>;
114
+ venue: z.ZodOptional<z.ZodObject<{
115
+ table: z.ZodString;
116
+ name: z.ZodOptional<z.ZodString>;
117
+ address: z.ZodOptional<z.ZodString>;
118
+ phone: z.ZodOptional<z.ZodString>;
119
+ }, z.core.$strict>>;
120
+ link: z.ZodOptional<z.ZodString>;
121
+ }, z.core.$strict>>;
122
+ }, z.core.$strict>;
123
+ export type PublicAccess = z.infer<typeof publicAccessSchema>;
124
+ /**
125
+ * A browser key besides `customer`. It is never published to the app's public
126
+ * side: the staff side hands it only to someone signed in with `role`, and
127
+ * every request on it must carry that person's staff session too — a token
128
+ * copied out of the page opens nothing on its own. `enabledBy` switches it
129
+ * off with a bool in the settings row.
130
+ */
131
+ export declare const publicKeySchema: z.ZodObject<{
132
+ requiresStaff: z.ZodObject<{
133
+ role: z.ZodString;
134
+ }, z.core.$strict>;
135
+ enabledBy: z.ZodOptional<z.ZodObject<{
136
+ table: z.ZodString;
137
+ column: z.ZodString;
138
+ }, z.core.$strict>>;
139
+ }, z.core.$strict>;
140
+ export declare const publicKeysSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
141
+ requiresStaff: z.ZodObject<{
142
+ role: z.ZodString;
143
+ }, z.core.$strict>;
144
+ enabledBy: z.ZodOptional<z.ZodObject<{
145
+ table: z.ZodString;
146
+ column: z.ZodString;
147
+ }, z.core.$strict>>;
148
+ }, z.core.$strict>>;
149
+ export type PublicKey = z.infer<typeof publicKeySchema>;
150
+ interface PublicAccessContext {
151
+ index: TableIndex;
152
+ /** Columns Adminium decides on a table: a browser may never write them. */
153
+ decided: (table: string) => ReadonlySet<string>;
154
+ /** Whether the table carries a capacity or a booking rule to answer availability from. */
155
+ answersAvailability: (table: string) => boolean;
156
+ publicKeys: Readonly<Record<string, PublicKey>> | undefined;
157
+ roles: readonly {
158
+ key: string;
159
+ screensOnly?: boolean | undefined;
160
+ cloneFrom?: string | undefined;
161
+ permissions?: readonly string[] | undefined;
162
+ }[];
163
+ }
164
+ /** Everything in `publicAccess` and `publicKeys` that names something undeclared, or breaks a rule. */
165
+ export declare function publicAccessIssues(entries: readonly PublicAccess[], ctx: PublicAccessContext): ReferenceIssue[];
166
+ export {};
167
+ //# 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;;;;;;;;;;;;;;;;GAgBG;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;AA+BvC,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA4GpB,CAAC;AACZ,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D;;;;;;GAMG;AACH,eAAO,MAAM,eAAe;;;;;;;;kBAKjB,CAAC;AACZ,eAAO,MAAM,gBAAgB;;;;;;;;mBAEyF,CAAC;AACvH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD,UAAU,mBAAmB;IAC3B,KAAK,EAAE,UAAU,CAAC;IAClB,2EAA2E;IAC3E,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,WAAW,CAAC,MAAM,CAAC,CAAC;IAChD,0FAA0F;IAC1F,mBA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