@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.
- package/dist/add-ons.d.ts +63 -0
- package/dist/add-ons.d.ts.map +1 -0
- package/dist/add-ons.js +100 -0
- package/dist/add-ons.js.map +1 -0
- package/dist/booking.d.ts +100 -0
- package/dist/booking.d.ts.map +1 -0
- package/dist/booking.js +237 -0
- package/dist/booking.js.map +1 -0
- package/dist/documents.d.ts +100 -0
- package/dist/documents.d.ts.map +1 -0
- package/dist/documents.js +148 -0
- package/dist/documents.js.map +1 -0
- package/dist/formula.d.ts +124 -0
- package/dist/formula.d.ts.map +1 -0
- package/dist/formula.js +428 -0
- package/dist/formula.js.map +1 -0
- package/dist/index.d.ts +14 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -3
- package/dist/index.js.map +1 -1
- package/dist/outbox.d.ts +543 -0
- package/dist/outbox.d.ts.map +1 -0
- package/dist/outbox.js +559 -0
- package/dist/outbox.js.map +1 -0
- package/dist/page-calendar.d.ts +42 -0
- package/dist/page-calendar.d.ts.map +1 -0
- package/dist/page-calendar.js +95 -0
- package/dist/page-calendar.js.map +1 -0
- package/dist/plan-model.d.ts +1 -1
- package/dist/plan-model.d.ts.map +1 -1
- package/dist/public-access.d.ts +208 -0
- package/dist/public-access.d.ts.map +1 -0
- package/dist/public-access.js +681 -0
- package/dist/public-access.js.map +1 -0
- package/dist/refs.d.ts +91 -0
- package/dist/refs.d.ts.map +1 -0
- package/dist/refs.js +82 -0
- package/dist/refs.js.map +1 -0
- package/dist/roles.d.ts +44 -0
- package/dist/roles.d.ts.map +1 -0
- package/dist/roles.js +75 -0
- package/dist/roles.js.map +1 -0
- package/dist/sample.d.ts +150 -2
- package/dist/sample.d.ts.map +1 -1
- package/dist/sample.js +101 -3
- package/dist/sample.js.map +1 -1
- package/dist/schema.d.ts +3464 -151
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +681 -143
- package/dist/schema.js.map +1 -1
- package/dist/semver.d.ts +28 -0
- package/dist/semver.d.ts.map +1 -0
- package/dist/semver.js +85 -0
- package/dist/semver.js.map +1 -0
- package/dist/shapes.d.ts +97 -0
- package/dist/shapes.d.ts.map +1 -0
- package/dist/shapes.js +190 -0
- package/dist/shapes.js.map +1 -0
- package/dist/states.d.ts +134 -0
- package/dist/states.d.ts.map +1 -0
- package/dist/states.js +244 -0
- package/dist/states.js.map +1 -0
- package/dist/validate.d.ts +14 -0
- package/dist/validate.d.ts.map +1 -1
- package/dist/validate.js +29 -2
- package/dist/validate.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `addOns` — the add-ons an app needs, and the ones it works better with.
|
|
3
|
+
*
|
|
4
|
+
* ```json
|
|
5
|
+
* "addOns": {
|
|
6
|
+
* "requires": [{ "key": "invoices", "range": ">=1.1.0",
|
|
7
|
+
* "reason": { "en-US": "Proposals, invoices and receipts are made by this add-on." } }],
|
|
8
|
+
* "suggests": [{ "key": "holiday-calendars", "range": ">=1.1.0", "checked": true,
|
|
9
|
+
* "reason": { "en-US": "Marks public holidays as days off." } }],
|
|
10
|
+
* "features": [{ "id": "capacity-holidays", "label": { "en-US": "Holidays in Capacity" },
|
|
11
|
+
* "requires": ["holiday-calendars"] }]
|
|
12
|
+
* }
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* Installing the app installs (or connects) every add-on it `requires`,
|
|
16
|
+
* before its own tables; one that is missing and cannot be had refuses the
|
|
17
|
+
* install before anything is written, and an add-on an installed app
|
|
18
|
+
* requires cannot be removed. A `suggests` entry is offered with the app,
|
|
19
|
+
* ticked when `checked`. A `feature` names what stops working without its
|
|
20
|
+
* add-ons, so a page may say `"feature": "<id>"` and stay hidden until they
|
|
21
|
+
* are there.
|
|
22
|
+
*
|
|
23
|
+
* Every `range` is a semver range over the add-on's version (`>=1.1.0`,
|
|
24
|
+
* `^1.1.0`); the reasons and labels are in every language the app speaks,
|
|
25
|
+
* US English always among them.
|
|
26
|
+
*/
|
|
27
|
+
import { z } from 'zod';
|
|
28
|
+
import { type ReferenceIssue } from './refs.js';
|
|
29
|
+
export declare const addOnsSchema: z.ZodObject<{
|
|
30
|
+
requires: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
31
|
+
key: z.ZodString;
|
|
32
|
+
range: z.ZodString;
|
|
33
|
+
reason: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
34
|
+
}, z.core.$strict>>>;
|
|
35
|
+
suggests: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
36
|
+
key: z.ZodString;
|
|
37
|
+
range: z.ZodString;
|
|
38
|
+
reason: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
39
|
+
checked: z.ZodOptional<z.ZodBoolean>;
|
|
40
|
+
}, z.core.$strict>>>;
|
|
41
|
+
features: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
42
|
+
id: z.ZodString;
|
|
43
|
+
label: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
44
|
+
requires: z.ZodArray<z.ZodString>;
|
|
45
|
+
}, z.core.$strict>>>;
|
|
46
|
+
}, z.core.$strict>;
|
|
47
|
+
export type AddOnNeeds = z.infer<typeof addOnsSchema>;
|
|
48
|
+
/** The add-ons an app names at all: required first, then suggested. */
|
|
49
|
+
export declare function namedAddOns(needs: AddOnNeeds | undefined): {
|
|
50
|
+
key: string;
|
|
51
|
+
need: 'requires' | 'suggests';
|
|
52
|
+
}[];
|
|
53
|
+
/** Whether the app requires this add-on (so it is always there when the app runs). */
|
|
54
|
+
export declare function requiresAddOn(needs: AddOnNeeds | undefined, key: string): boolean;
|
|
55
|
+
/** Everything wrong with an app's `addOns` and the pages that name a feature. */
|
|
56
|
+
export declare function addOnNeedsIssues(m: {
|
|
57
|
+
key: string;
|
|
58
|
+
addOns?: AddOnNeeds | undefined;
|
|
59
|
+
pages?: readonly {
|
|
60
|
+
feature?: string | undefined;
|
|
61
|
+
}[] | undefined;
|
|
62
|
+
}): ReferenceIssue[];
|
|
63
|
+
//# sourceMappingURL=add-ons.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-ons.d.ts","sourceRoot":"","sources":["../src/add-ons.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAgB,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AAa9D,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;kBAkBd,CAAC;AACZ,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAEtD,uEAAuE;AACvE,wBAAgB,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,SAAS,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,UAAU,GAAG,UAAU,CAAA;CAAE,EAAE,CAK3G;AAED,sFAAsF;AACtF,wBAAgB,aAAa,CAAC,KAAK,EAAE,UAAU,GAAG,SAAS,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAEjF;AAED,iFAAiF;AACjF,wBAAgB,gBAAgB,CAAC,CAAC,EAAE;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;IAChC,KAAK,CAAC,EAAE,SAAS;QAAE,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE,EAAE,GAAG,SAAS,CAAC;CACjE,GAAG,cAAc,EAAE,CA6BnB"}
|
package/dist/add-ons.js
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
|
+
/**
|
|
3
|
+
* `addOns` — the add-ons an app needs, and the ones it works better with.
|
|
4
|
+
*
|
|
5
|
+
* ```json
|
|
6
|
+
* "addOns": {
|
|
7
|
+
* "requires": [{ "key": "invoices", "range": ">=1.1.0",
|
|
8
|
+
* "reason": { "en-US": "Proposals, invoices and receipts are made by this add-on." } }],
|
|
9
|
+
* "suggests": [{ "key": "holiday-calendars", "range": ">=1.1.0", "checked": true,
|
|
10
|
+
* "reason": { "en-US": "Marks public holidays as days off." } }],
|
|
11
|
+
* "features": [{ "id": "capacity-holidays", "label": { "en-US": "Holidays in Capacity" },
|
|
12
|
+
* "requires": ["holiday-calendars"] }]
|
|
13
|
+
* }
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* Installing the app installs (or connects) every add-on it `requires`,
|
|
17
|
+
* before its own tables; one that is missing and cannot be had refuses the
|
|
18
|
+
* install before anything is written, and an add-on an installed app
|
|
19
|
+
* requires cannot be removed. A `suggests` entry is offered with the app,
|
|
20
|
+
* ticked when `checked`. A `feature` names what stops working without its
|
|
21
|
+
* add-ons, so a page may say `"feature": "<id>"` and stay hidden until they
|
|
22
|
+
* are there.
|
|
23
|
+
*
|
|
24
|
+
* Every `range` is a semver range over the add-on's version (`>=1.1.0`,
|
|
25
|
+
* `^1.1.0`); the reasons and labels are in every language the app speaks,
|
|
26
|
+
* US English always among them.
|
|
27
|
+
*/
|
|
28
|
+
import { z } from 'zod';
|
|
29
|
+
import { labelsSchema } from './refs.js';
|
|
30
|
+
import { parseSemverRange } from './semver.js';
|
|
31
|
+
const addOnKeySchema = z.string().regex(/^[a-z][a-z0-9-]{1,79}$/, 'an add-on key');
|
|
32
|
+
const rangeSchema = z
|
|
33
|
+
.string()
|
|
34
|
+
.min(1)
|
|
35
|
+
.max(120)
|
|
36
|
+
.refine((range) => parseSemverRange(range) !== null, { message: 'a semver range such as ">=1.1.0" or "^1.1.0"' });
|
|
37
|
+
const needSchema = z.object({ key: addOnKeySchema, range: rangeSchema, reason: labelsSchema }).strict();
|
|
38
|
+
export const addOnsSchema = z
|
|
39
|
+
.object({
|
|
40
|
+
requires: z.array(needSchema).min(1).max(8).optional(),
|
|
41
|
+
suggests: z.array(needSchema.extend({ checked: z.boolean().optional() }).strict()).min(1).max(8).optional(),
|
|
42
|
+
features: z
|
|
43
|
+
.array(z
|
|
44
|
+
.object({
|
|
45
|
+
id: z.string().regex(/^[a-z][a-z0-9-]{0,39}$/, 'a feature id is kebab-case'),
|
|
46
|
+
label: labelsSchema,
|
|
47
|
+
requires: z.array(addOnKeySchema).min(1).max(4),
|
|
48
|
+
})
|
|
49
|
+
.strict())
|
|
50
|
+
.min(1)
|
|
51
|
+
.max(16)
|
|
52
|
+
.optional(),
|
|
53
|
+
})
|
|
54
|
+
.strict();
|
|
55
|
+
/** The add-ons an app names at all: required first, then suggested. */
|
|
56
|
+
export function namedAddOns(needs) {
|
|
57
|
+
return [
|
|
58
|
+
...(needs?.requires ?? []).map((n) => ({ key: n.key, need: 'requires' })),
|
|
59
|
+
...(needs?.suggests ?? []).map((n) => ({ key: n.key, need: 'suggests' })),
|
|
60
|
+
];
|
|
61
|
+
}
|
|
62
|
+
/** Whether the app requires this add-on (so it is always there when the app runs). */
|
|
63
|
+
export function requiresAddOn(needs, key) {
|
|
64
|
+
return (needs?.requires ?? []).some((n) => n.key === key);
|
|
65
|
+
}
|
|
66
|
+
/** Everything wrong with an app's `addOns` and the pages that name a feature. */
|
|
67
|
+
export function addOnNeedsIssues(m) {
|
|
68
|
+
const out = [];
|
|
69
|
+
const needs = m.addOns;
|
|
70
|
+
const seen = new Map();
|
|
71
|
+
for (const list of ['requires', 'suggests']) {
|
|
72
|
+
(needs?.[list] ?? []).forEach((need, i) => {
|
|
73
|
+
const at = ['addOns', list, i, 'key'];
|
|
74
|
+
if (need.key === m.key)
|
|
75
|
+
out.push({ path: at, message: 'an app does not need itself' });
|
|
76
|
+
const earlier = seen.get(need.key);
|
|
77
|
+
if (earlier !== undefined)
|
|
78
|
+
out.push({ path: at, message: `"${need.key}" is already named in ${earlier}` });
|
|
79
|
+
seen.set(need.key, list);
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
const features = new Set();
|
|
83
|
+
(needs?.features ?? []).forEach((feature, f) => {
|
|
84
|
+
if (features.has(feature.id))
|
|
85
|
+
out.push({ path: ['addOns', 'features', f, 'id'], message: `"${feature.id}" is declared twice` });
|
|
86
|
+
features.add(feature.id);
|
|
87
|
+
feature.requires.forEach((key, k) => {
|
|
88
|
+
if (!seen.has(key)) {
|
|
89
|
+
out.push({ path: ['addOns', 'features', f, 'requires', k], message: `"${key}" is neither required nor suggested by the app` });
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
(m.pages ?? []).forEach((page, p) => {
|
|
94
|
+
if (page.feature !== undefined && !features.has(page.feature)) {
|
|
95
|
+
out.push({ path: ['pages', p, 'feature'], message: `"${page.feature}" is not one of the app's addOns.features` });
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
return out;
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=add-ons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-ons.js","sourceRoot":"","sources":["../src/add-ons.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,YAAY,EAAuB,MAAM,WAAW,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,wBAAwB,EAAE,eAAe,CAAC,CAAC;AAEnF,MAAM,WAAW,GAAG,CAAC;KAClB,MAAM,EAAE;KACR,GAAG,CAAC,CAAC,CAAC;KACN,GAAG,CAAC,GAAG,CAAC;KACR,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,gBAAgB,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,EAAE,OAAO,EAAE,8CAA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,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;YAC9D,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC,EAAE,SAAS,CAAC,EAAE,OAAO,EAAE,IAAI,IAAI,CAAC,OAAO,2CAA2C,EAAE,CAAC,CAAC;QACpH,CAAC;IACH,CAAC,CAAC,CAAC;IACH,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `table.booking` — booking PEOPLE rather than tables: a row takes a resource
|
|
3
|
+
* (a clinician) for its own length, and two counted rows of one resource may
|
|
4
|
+
* never overlap.
|
|
5
|
+
*
|
|
6
|
+
* Beside `capacity`, not folded into it. Capacity adds up a party per start
|
|
7
|
+
* time; booking forbids overlap per resource, within that resource's hours,
|
|
8
|
+
* breaks and closures. They are different questions, and a table carries one
|
|
9
|
+
* or the other.
|
|
10
|
+
*
|
|
11
|
+
* Every table the rule names is the app's own, by ref. With `prefixed`
|
|
12
|
+
* install the server maps each of them — nested ones included — to the real
|
|
13
|
+
* table name.
|
|
14
|
+
*/
|
|
15
|
+
import { z } from 'zod';
|
|
16
|
+
import { type ReferenceIssue, type TableIndex, type TableShape } from './refs.js';
|
|
17
|
+
/** The weekday values an hours table's weekday enum must hold, in this order. */
|
|
18
|
+
export declare const BOOKING_WEEKDAYS: readonly ["mon", "tue", "wed", "thu", "fri", "sat", "sun"];
|
|
19
|
+
export declare const bookingSchema: z.ZodObject<{
|
|
20
|
+
start: z.ZodString;
|
|
21
|
+
minutes: z.ZodString;
|
|
22
|
+
resource: z.ZodString;
|
|
23
|
+
kind: z.ZodString;
|
|
24
|
+
countWhere: z.ZodObject<{
|
|
25
|
+
column: z.ZodString;
|
|
26
|
+
values: z.ZodArray<z.ZodString>;
|
|
27
|
+
}, z.core.$strict>;
|
|
28
|
+
eligible: z.ZodObject<{
|
|
29
|
+
table: z.ZodString;
|
|
30
|
+
resource: z.ZodString;
|
|
31
|
+
kind: z.ZodString;
|
|
32
|
+
order: z.ZodOptional<z.ZodObject<{
|
|
33
|
+
table: z.ZodString;
|
|
34
|
+
column: z.ZodString;
|
|
35
|
+
active: z.ZodOptional<z.ZodString>;
|
|
36
|
+
public: z.ZodOptional<z.ZodString>;
|
|
37
|
+
}, z.core.$strict>>;
|
|
38
|
+
}, z.core.$strict>;
|
|
39
|
+
hours: z.ZodObject<{
|
|
40
|
+
practice: z.ZodObject<{
|
|
41
|
+
weekday: z.ZodString;
|
|
42
|
+
opens: z.ZodString;
|
|
43
|
+
closes: z.ZodString;
|
|
44
|
+
breakStart: z.ZodOptional<z.ZodString>;
|
|
45
|
+
breakEnd: z.ZodOptional<z.ZodString>;
|
|
46
|
+
table: z.ZodString;
|
|
47
|
+
open: z.ZodOptional<z.ZodString>;
|
|
48
|
+
}, z.core.$strict>;
|
|
49
|
+
own: z.ZodOptional<z.ZodObject<{
|
|
50
|
+
weekday: z.ZodString;
|
|
51
|
+
opens: z.ZodString;
|
|
52
|
+
closes: z.ZodString;
|
|
53
|
+
breakStart: z.ZodOptional<z.ZodString>;
|
|
54
|
+
breakEnd: z.ZodOptional<z.ZodString>;
|
|
55
|
+
table: z.ZodString;
|
|
56
|
+
resource: z.ZodString;
|
|
57
|
+
}, z.core.$strict>>;
|
|
58
|
+
}, z.core.$strict>;
|
|
59
|
+
closures: z.ZodOptional<z.ZodObject<{
|
|
60
|
+
table: z.ZodString;
|
|
61
|
+
from: z.ZodString;
|
|
62
|
+
to: z.ZodString;
|
|
63
|
+
resource: z.ZodOptional<z.ZodString>;
|
|
64
|
+
active: z.ZodOptional<z.ZodString>;
|
|
65
|
+
}, z.core.$strict>>;
|
|
66
|
+
grid: z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
|
|
67
|
+
table: z.ZodString;
|
|
68
|
+
column: z.ZodString;
|
|
69
|
+
}, z.core.$strict>]>;
|
|
70
|
+
windowDays: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
|
|
71
|
+
table: z.ZodString;
|
|
72
|
+
column: z.ZodString;
|
|
73
|
+
}, z.core.$strict>]>>;
|
|
74
|
+
noticeMinutes: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
|
|
75
|
+
table: z.ZodString;
|
|
76
|
+
column: z.ZodString;
|
|
77
|
+
}, z.core.$strict>]>>;
|
|
78
|
+
cancel: z.ZodOptional<z.ZodObject<{
|
|
79
|
+
hours: z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
|
|
80
|
+
table: z.ZodString;
|
|
81
|
+
column: z.ZodString;
|
|
82
|
+
}, z.core.$strict>]>;
|
|
83
|
+
mode: z.ZodEnum<{
|
|
84
|
+
refuse: "refuse";
|
|
85
|
+
flag: "flag";
|
|
86
|
+
}>;
|
|
87
|
+
flag: z.ZodOptional<z.ZodString>;
|
|
88
|
+
when: z.ZodObject<{
|
|
89
|
+
column: z.ZodString;
|
|
90
|
+
to: z.ZodString;
|
|
91
|
+
}, z.core.$strict>;
|
|
92
|
+
}, z.core.$strict>>;
|
|
93
|
+
}, z.core.$strict>;
|
|
94
|
+
export type BookingRule = z.infer<typeof bookingSchema>;
|
|
95
|
+
/**
|
|
96
|
+
* Everything in a table's booking rule that names something the manifest does
|
|
97
|
+
* not declare, or a column of the wrong kind.
|
|
98
|
+
*/
|
|
99
|
+
export declare function bookingIssues(table: TableShape, rule: BookingRule, index: TableIndex, at: (...rest: (string | number)[]) => (string | number)[]): ReferenceIssue[];
|
|
100
|
+
//# sourceMappingURL=booking.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"booking.d.ts","sourceRoot":"","sources":["../src/booking.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAOL,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,UAAU,EAChB,MAAM,WAAW,CAAC;AAEnB,iFAAiF;AACjF,eAAO,MAAM,gBAAgB,4DAA6D,CAAC;AAU3F,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA4Ef,CAAC;AACZ,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAExD;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,UAAU,EACjB,IAAI,EAAE,WAAW,EACjB,KAAK,EAAE,UAAU,EACjB,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,GACxD,cAAc,EAAE,CAoIlB"}
|
package/dist/booking.js
ADDED
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
|
+
/**
|
|
3
|
+
* `table.booking` — booking PEOPLE rather than tables: a row takes a resource
|
|
4
|
+
* (a clinician) for its own length, and two counted rows of one resource may
|
|
5
|
+
* never overlap.
|
|
6
|
+
*
|
|
7
|
+
* Beside `capacity`, not folded into it. Capacity adds up a party per start
|
|
8
|
+
* time; booking forbids overlap per resource, within that resource's hours,
|
|
9
|
+
* breaks and closures. They are different questions, and a table carries one
|
|
10
|
+
* or the other.
|
|
11
|
+
*
|
|
12
|
+
* Every table the rule names is the app's own, by ref. With `prefixed`
|
|
13
|
+
* install the server maps each of them — nested ones included — to the real
|
|
14
|
+
* table name.
|
|
15
|
+
*/
|
|
16
|
+
import { z } from 'zod';
|
|
17
|
+
import { NUMERIC_TYPES, numberOrSetting, refSchema, settingRefSchema, valueFits, } from './refs.js';
|
|
18
|
+
/** The weekday values an hours table's weekday enum must hold, in this order. */
|
|
19
|
+
export const BOOKING_WEEKDAYS = ['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun'];
|
|
20
|
+
const hoursColumns = {
|
|
21
|
+
weekday: refSchema,
|
|
22
|
+
opens: refSchema,
|
|
23
|
+
closes: refSchema,
|
|
24
|
+
breakStart: refSchema.optional(),
|
|
25
|
+
breakEnd: refSchema.optional(),
|
|
26
|
+
};
|
|
27
|
+
export const bookingSchema = z
|
|
28
|
+
.object({
|
|
29
|
+
/** When the row starts: a `timestamptz`, read in the venue's zone. */
|
|
30
|
+
start: refSchema,
|
|
31
|
+
/** How long it lasts: an int column on the row (copied from the kind). */
|
|
32
|
+
minutes: refSchema,
|
|
33
|
+
/** Whose time it takes: a foreign key. Empty on a create means "anyone" — Adminium picks. */
|
|
34
|
+
resource: refSchema,
|
|
35
|
+
/** What it is: a foreign key, which decides who may be booked for it. */
|
|
36
|
+
kind: refSchema,
|
|
37
|
+
/** Only rows whose column holds one of these take time (a cancelled visit takes none). */
|
|
38
|
+
countWhere: z.object({ column: refSchema, values: z.array(z.string().min(1)).min(1) }).strict(),
|
|
39
|
+
/** Who does what: a link table of (resource, kind), and the resources' own order and switches. */
|
|
40
|
+
eligible: z
|
|
41
|
+
.object({
|
|
42
|
+
table: refSchema,
|
|
43
|
+
resource: refSchema,
|
|
44
|
+
kind: refSchema,
|
|
45
|
+
order: z
|
|
46
|
+
.object({
|
|
47
|
+
table: refSchema,
|
|
48
|
+
column: refSchema,
|
|
49
|
+
/** A resource whose column is false is never booked. */
|
|
50
|
+
active: refSchema.optional(),
|
|
51
|
+
/** A resource whose column is false is never booked through the public API. */
|
|
52
|
+
public: refSchema.optional(),
|
|
53
|
+
})
|
|
54
|
+
.strict()
|
|
55
|
+
.optional(),
|
|
56
|
+
})
|
|
57
|
+
.strict(),
|
|
58
|
+
/**
|
|
59
|
+
* Weekly hours as `HH:MM` text, one row per weekday. A resource with rows
|
|
60
|
+
* of its own follows them; one without follows the practice's.
|
|
61
|
+
*/
|
|
62
|
+
hours: z
|
|
63
|
+
.object({
|
|
64
|
+
practice: z.object({ table: refSchema, open: refSchema.optional(), ...hoursColumns }).strict(),
|
|
65
|
+
own: z.object({ table: refSchema, resource: refSchema, ...hoursColumns }).strict().optional(),
|
|
66
|
+
})
|
|
67
|
+
.strict(),
|
|
68
|
+
/** Dated closures, for everyone (resource empty) or one resource. */
|
|
69
|
+
closures: z
|
|
70
|
+
.object({
|
|
71
|
+
table: refSchema,
|
|
72
|
+
from: refSchema,
|
|
73
|
+
to: refSchema,
|
|
74
|
+
resource: refSchema.optional(),
|
|
75
|
+
active: refSchema.optional(),
|
|
76
|
+
})
|
|
77
|
+
.strict()
|
|
78
|
+
.optional(),
|
|
79
|
+
/** The minutes between bookable starts. */
|
|
80
|
+
grid: numberOrSetting,
|
|
81
|
+
/** How many working days ahead a booking may be made. */
|
|
82
|
+
windowDays: numberOrSetting.optional(),
|
|
83
|
+
/** How far ahead a public booking must be. Staff are never held to it. */
|
|
84
|
+
noticeMinutes: numberOrSetting.optional(),
|
|
85
|
+
/**
|
|
86
|
+
* A cancellation inside `hours` of the start. `refuse` turns a public
|
|
87
|
+
* one away; `flag` lets it through and sets `flag`. Staff are never refused.
|
|
88
|
+
*/
|
|
89
|
+
cancel: z
|
|
90
|
+
.object({
|
|
91
|
+
hours: numberOrSetting,
|
|
92
|
+
mode: z.enum(['refuse', 'flag']),
|
|
93
|
+
flag: refSchema.optional(),
|
|
94
|
+
when: z.object({ column: refSchema, to: z.string().min(1) }).strict(),
|
|
95
|
+
})
|
|
96
|
+
.strict()
|
|
97
|
+
.refine((c) => (c.mode === 'flag') === (c.flag !== undefined), {
|
|
98
|
+
message: 'a flag names its column, and only mode "flag" has one',
|
|
99
|
+
path: ['flag'],
|
|
100
|
+
})
|
|
101
|
+
.optional(),
|
|
102
|
+
})
|
|
103
|
+
.strict();
|
|
104
|
+
/**
|
|
105
|
+
* Everything in a table's booking rule that names something the manifest does
|
|
106
|
+
* not declare, or a column of the wrong kind.
|
|
107
|
+
*/
|
|
108
|
+
export function bookingIssues(table, rule, index, at) {
|
|
109
|
+
const out = [];
|
|
110
|
+
const here = (...rest) => at('booking', ...rest);
|
|
111
|
+
/** The column, when it exists and is one of `types`; an issue otherwise. */
|
|
112
|
+
const want = (tableRef, column, types, path, what) => {
|
|
113
|
+
if (index.table(tableRef) === undefined) {
|
|
114
|
+
out.push({ path, message: `"${tableRef}" is not a table of this app` });
|
|
115
|
+
return undefined;
|
|
116
|
+
}
|
|
117
|
+
const found = index.column(tableRef, column);
|
|
118
|
+
if (found === undefined) {
|
|
119
|
+
out.push({ path, message: `"${tableRef}" has no column "${column}"` });
|
|
120
|
+
return undefined;
|
|
121
|
+
}
|
|
122
|
+
if (!types.includes(found.type)) {
|
|
123
|
+
out.push({ path, message: `"${tableRef}.${column}" must be ${what}` });
|
|
124
|
+
return undefined;
|
|
125
|
+
}
|
|
126
|
+
return found;
|
|
127
|
+
};
|
|
128
|
+
/** A foreign key pointing at `target` (any target when omitted). */
|
|
129
|
+
const wantFk = (tableRef, column, target, path) => {
|
|
130
|
+
const found = want(tableRef, column, ['fk'], path, 'a foreign key');
|
|
131
|
+
if (found !== undefined && target !== undefined && found.references !== target) {
|
|
132
|
+
out.push({ path, message: `"${tableRef}.${column}" does not point at "${target}"` });
|
|
133
|
+
}
|
|
134
|
+
return found;
|
|
135
|
+
};
|
|
136
|
+
const setting = (value, path) => {
|
|
137
|
+
const parsed = settingRefSchema.safeParse(value);
|
|
138
|
+
if (parsed.success)
|
|
139
|
+
want(parsed.data.table, parsed.data.column, NUMERIC_TYPES, path, 'a number');
|
|
140
|
+
};
|
|
141
|
+
want(table.ref, rule.start, ['timestamptz'], here('start'), 'a timestamptz');
|
|
142
|
+
want(table.ref, rule.minutes, ['int', 'bigint'], here('minutes'), 'an int');
|
|
143
|
+
const resource = wantFk(table.ref, rule.resource, undefined, here('resource'));
|
|
144
|
+
const kind = wantFk(table.ref, rule.kind, undefined, here('kind'));
|
|
145
|
+
const resourceTable = resource?.references;
|
|
146
|
+
const kindTable = kind?.references;
|
|
147
|
+
const counted = index.column(table.ref, rule.countWhere.column);
|
|
148
|
+
if (counted === undefined) {
|
|
149
|
+
out.push({ path: here('countWhere', 'column'), message: `"${table.ref}" has no column "${rule.countWhere.column}"` });
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
for (const value of rule.countWhere.values) {
|
|
153
|
+
if (!valueFits(counted, value)) {
|
|
154
|
+
out.push({ path: here('countWhere', 'values'), message: `"${value}" is not a value of "${table.ref}.${counted.ref}"` });
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
const eligible = rule.eligible;
|
|
159
|
+
wantFk(eligible.table, eligible.resource, resourceTable, here('eligible', 'resource'));
|
|
160
|
+
wantFk(eligible.table, eligible.kind, kindTable, here('eligible', 'kind'));
|
|
161
|
+
if (eligible.order !== undefined) {
|
|
162
|
+
const order = eligible.order;
|
|
163
|
+
if (resourceTable !== undefined && order.table !== resourceTable) {
|
|
164
|
+
out.push({ path: here('eligible', 'order', 'table'), message: `the order is kept on "${resourceTable}", the table "${rule.resource}" points at` });
|
|
165
|
+
}
|
|
166
|
+
want(order.table, order.column, NUMERIC_TYPES, here('eligible', 'order', 'column'), 'a number');
|
|
167
|
+
for (const name of ['active', 'public']) {
|
|
168
|
+
const column = order[name];
|
|
169
|
+
if (column !== undefined)
|
|
170
|
+
want(order.table, column, ['bool'], here('eligible', 'order', name), 'a bool');
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
const weekday = (tableRef, column, path) => {
|
|
174
|
+
const found = want(tableRef, column, ['enum'], path, `an enum of ${BOOKING_WEEKDAYS.join(', ')}`);
|
|
175
|
+
if (found !== undefined && (found.enum ?? []).join(',') !== BOOKING_WEEKDAYS.join(',')) {
|
|
176
|
+
out.push({ path, message: `"${tableRef}.${column}" must be an enum of ${BOOKING_WEEKDAYS.join(', ')}` });
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
const times = (tableRef, hours, path) => {
|
|
180
|
+
for (const name of ['opens', 'closes', 'breakStart', 'breakEnd']) {
|
|
181
|
+
const column = hours[name];
|
|
182
|
+
if (column !== undefined)
|
|
183
|
+
want(tableRef, column, ['text'], [...path, name], 'a text column holding HH:MM');
|
|
184
|
+
}
|
|
185
|
+
if ((hours['breakStart'] === undefined) !== (hours['breakEnd'] === undefined)) {
|
|
186
|
+
out.push({ path, message: 'a break names both its start and its end' });
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
const practice = rule.hours.practice;
|
|
190
|
+
weekday(practice.table, practice.weekday, here('hours', 'practice', 'weekday'));
|
|
191
|
+
times(practice.table, practice, here('hours', 'practice'));
|
|
192
|
+
if (practice.open !== undefined)
|
|
193
|
+
want(practice.table, practice.open, ['bool'], here('hours', 'practice', 'open'), 'a bool');
|
|
194
|
+
const own = rule.hours.own;
|
|
195
|
+
if (own !== undefined) {
|
|
196
|
+
wantFk(own.table, own.resource, resourceTable, here('hours', 'own', 'resource'));
|
|
197
|
+
weekday(own.table, own.weekday, here('hours', 'own', 'weekday'));
|
|
198
|
+
times(own.table, own, here('hours', 'own'));
|
|
199
|
+
}
|
|
200
|
+
const closures = rule.closures;
|
|
201
|
+
if (closures !== undefined) {
|
|
202
|
+
want(closures.table, closures.from, ['date'], here('closures', 'from'), 'a date');
|
|
203
|
+
want(closures.table, closures.to, ['date'], here('closures', 'to'), 'a date');
|
|
204
|
+
if (closures.resource !== undefined) {
|
|
205
|
+
const column = wantFk(closures.table, closures.resource, resourceTable, here('closures', 'resource'));
|
|
206
|
+
if (column !== undefined && column.nullable !== true) {
|
|
207
|
+
out.push({ path: here('closures', 'resource'), message: `"${closures.table}.${closures.resource}" must be nullable: an empty one closes for everyone` });
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
if (closures.active !== undefined)
|
|
211
|
+
want(closures.table, closures.active, ['bool'], here('closures', 'active'), 'a bool');
|
|
212
|
+
}
|
|
213
|
+
setting(rule.grid, here('grid'));
|
|
214
|
+
if (typeof rule.grid === 'number' && rule.grid === 0)
|
|
215
|
+
out.push({ path: here('grid'), message: 'the grid is at least one minute' });
|
|
216
|
+
setting(rule.windowDays, here('windowDays'));
|
|
217
|
+
setting(rule.noticeMinutes, here('noticeMinutes'));
|
|
218
|
+
if (rule.cancel !== undefined) {
|
|
219
|
+
const cancel = rule.cancel;
|
|
220
|
+
setting(cancel.hours, here('cancel', 'hours'));
|
|
221
|
+
if (cancel.flag !== undefined)
|
|
222
|
+
want(table.ref, cancel.flag, ['bool'], here('cancel', 'flag'), 'a bool');
|
|
223
|
+
if (cancel.when.column !== rule.countWhere.column) {
|
|
224
|
+
out.push({ path: here('cancel', 'when', 'column'), message: `a cancellation is a change of "${rule.countWhere.column}", the column that decides what counts` });
|
|
225
|
+
}
|
|
226
|
+
else if (counted !== undefined) {
|
|
227
|
+
if (!valueFits(counted, cancel.when.to)) {
|
|
228
|
+
out.push({ path: here('cancel', 'when', 'to'), message: `"${cancel.when.to}" is not a value of "${table.ref}.${counted.ref}"` });
|
|
229
|
+
}
|
|
230
|
+
else if (rule.countWhere.values.includes(cancel.when.to)) {
|
|
231
|
+
out.push({ path: here('cancel', 'when', 'to'), message: `"${cancel.when.to}" still counts, so it frees no time` });
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
return out;
|
|
236
|
+
}
|
|
237
|
+
//# sourceMappingURL=booking.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"booking.js","sourceRoot":"","sources":["../src/booking.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,aAAa,EACb,eAAe,EACf,SAAS,EACT,gBAAgB,EAChB,SAAS,GAKV,MAAM,WAAW,CAAC;AAEnB,iFAAiF;AACjF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,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: which of its columns make a printed
|
|
3
|
+
* document (an invoice, a receipt, a statement), drawn by an add-on that
|
|
4
|
+
* renders documents.
|
|
5
|
+
*
|
|
6
|
+
* ```json
|
|
7
|
+
* "documents": [{
|
|
8
|
+
* "kind": "receipt", "addOn": "invoices", "table": "sales",
|
|
9
|
+
* "name": { "en-US": "Till receipt" },
|
|
10
|
+
* "mapping": {
|
|
11
|
+
* "number": { "column": "number" },
|
|
12
|
+
* "customerName": { "via": "customer_id", "column": "name" },
|
|
13
|
+
* "lines": { "collection": { "table": "sale_lines", "via": "sale_id", "orderBy": "position",
|
|
14
|
+
* "columns": { "description": "name", "qty": "qty", "amount": "amount" } } }
|
|
15
|
+
* }
|
|
16
|
+
* }]
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* A slot reads a column of the row, a column of a row a foreign key points at
|
|
20
|
+
* (`via`), or a list of child rows in order. The slots themselves are the
|
|
21
|
+
* add-on's words; Adminium checks the columns here and the slots against the
|
|
22
|
+
* add-on when the profile is made at install. A profile is the app's: made
|
|
23
|
+
* with real table names when the app is installed, removed with it.
|
|
24
|
+
*
|
|
25
|
+
* A statement is a document over one row (a client) and a period: it lists
|
|
26
|
+
* the documents and payments that point at that row, so it names them
|
|
27
|
+
* instead of one child list.
|
|
28
|
+
*/
|
|
29
|
+
import { z } from 'zod';
|
|
30
|
+
import { type ReferenceIssue, type TableIndex } from './refs.js';
|
|
31
|
+
export declare const slotMappingSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
32
|
+
column: z.ZodString;
|
|
33
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
34
|
+
via: z.ZodString;
|
|
35
|
+
column: z.ZodString;
|
|
36
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
37
|
+
collection: z.ZodObject<{
|
|
38
|
+
table: z.ZodString;
|
|
39
|
+
via: z.ZodString;
|
|
40
|
+
orderBy: z.ZodOptional<z.ZodString>;
|
|
41
|
+
columns: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
42
|
+
}, z.core.$strict>;
|
|
43
|
+
}, z.core.$strict>]>;
|
|
44
|
+
export type SlotMapping = z.infer<typeof slotMappingSchema>;
|
|
45
|
+
export declare const appDocumentSchema: z.ZodObject<{
|
|
46
|
+
kind: z.ZodString;
|
|
47
|
+
addOn: z.ZodString;
|
|
48
|
+
table: z.ZodString;
|
|
49
|
+
name: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
|
|
50
|
+
mapping: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
|
|
51
|
+
column: z.ZodString;
|
|
52
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
53
|
+
via: z.ZodString;
|
|
54
|
+
column: z.ZodString;
|
|
55
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
56
|
+
collection: z.ZodObject<{
|
|
57
|
+
table: z.ZodString;
|
|
58
|
+
via: z.ZodString;
|
|
59
|
+
orderBy: z.ZodOptional<z.ZodString>;
|
|
60
|
+
columns: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
61
|
+
}, z.core.$strict>;
|
|
62
|
+
}, z.core.$strict>]>>;
|
|
63
|
+
statement: z.ZodOptional<z.ZodObject<{
|
|
64
|
+
documents: z.ZodObject<{
|
|
65
|
+
table: z.ZodString;
|
|
66
|
+
via: z.ZodString;
|
|
67
|
+
date: z.ZodString;
|
|
68
|
+
amount: z.ZodString;
|
|
69
|
+
number: z.ZodOptional<z.ZodString>;
|
|
70
|
+
where: z.ZodOptional<z.ZodObject<{
|
|
71
|
+
column: z.ZodString;
|
|
72
|
+
in: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
73
|
+
}, z.core.$strict>>;
|
|
74
|
+
unless: z.ZodOptional<z.ZodString>;
|
|
75
|
+
}, z.core.$strict>;
|
|
76
|
+
payments: z.ZodObject<{
|
|
77
|
+
table: z.ZodString;
|
|
78
|
+
via: z.ZodString;
|
|
79
|
+
date: z.ZodString;
|
|
80
|
+
amount: z.ZodString;
|
|
81
|
+
number: z.ZodOptional<z.ZodString>;
|
|
82
|
+
where: z.ZodOptional<z.ZodObject<{
|
|
83
|
+
column: z.ZodString;
|
|
84
|
+
in: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
85
|
+
}, z.core.$strict>>;
|
|
86
|
+
unless: z.ZodOptional<z.ZodString>;
|
|
87
|
+
}, z.core.$strict>;
|
|
88
|
+
}, z.core.$strict>>;
|
|
89
|
+
feature: z.ZodOptional<z.ZodString>;
|
|
90
|
+
}, z.core.$strict>;
|
|
91
|
+
export type AppDocument = z.infer<typeof appDocumentSchema>;
|
|
92
|
+
/** Every column a mapping names, against the manifest's tables. */
|
|
93
|
+
export declare function mappingIssues(table: string, mapping: Readonly<Record<string, SlotMapping>>, index: TableIndex, at: (...rest: (string | number)[]) => (string | number)[]): ReferenceIssue[];
|
|
94
|
+
/** Everything wrong with an app's `documents` against its tables and add-on needs. */
|
|
95
|
+
export declare function appDocumentIssues(documents: readonly AppDocument[], ctx: {
|
|
96
|
+
index: TableIndex;
|
|
97
|
+
addOns: ReadonlySet<string>;
|
|
98
|
+
features: ReadonlySet<string>;
|
|
99
|
+
}): ReferenceIssue[];
|
|
100
|
+
//# sourceMappingURL=documents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"documents.d.ts","sourceRoot":"","sources":["../src/documents.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAA2B,KAAK,cAAc,EAAE,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AAI1F,eAAO,MAAM,iBAAiB;;;;;;;;;;;;oBAe5B,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAiB5D,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAWnB,CAAC;AACZ,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D,mEAAmE;AACnE,wBAAgB,aAAa,CAC3B,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,EAC9C,KAAK,EAAE,UAAU,EACjB,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,GACxD,cAAc,EAAE,CA2BlB;AAED,sFAAsF;AACtF,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,SAAS,WAAW,EAAE,EACjC,GAAG,EAAE;IAAE,KAAK,EAAE,UAAU,CAAC;IAAC,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAAC,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;CAAE,GACrF,cAAc,EAAE,CAgClB"}
|