@zveltio/sdk 3.0.0-beta.127 → 3.0.0-beta.135
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/client.d.ts.map +1 -1
- package/dist/client.js +10 -3
- package/dist/extension/capabilities.d.ts +1 -2
- package/dist/extension/capabilities.d.ts.map +1 -1
- package/dist/extension/capabilities.js +0 -2
- package/dist/extension/index.d.ts +67 -71
- package/dist/extension/index.d.ts.map +1 -1
- package/dist/extension/reserved-paths.d.ts +5 -1
- package/dist/extension/reserved-paths.d.ts.map +1 -1
- package/dist/extension/reserved-paths.js +8 -1
- package/dist/sync-manager.d.ts +5 -0
- package/dist/sync-manager.d.ts.map +1 -1
- package/dist/sync-manager.js +23 -4
- package/dist/tests/client.test.js +19 -0
- package/dist/tests/reserved-paths.test.js +4 -1
- package/dist/tests/sync-manager.test.js +42 -0
- package/dist/tests/validate-manifest-forward-credentials.test.js +12 -11
- package/dist/tests/validate-manifest-routes.test.js +6 -1
- package/dist/tests/validate-sdui-data-endpoints.test.js +19 -3
- package/dist/tests/view-runtime.test.js +36 -2
- package/dist/tests/view.test.js +122 -3
- package/dist/validate/index.d.ts.map +1 -1
- package/dist/validate/index.js +181 -48
- package/dist/view/index.d.ts +22 -0
- package/dist/view/index.d.ts.map +1 -1
- package/dist/view/index.js +111 -1
- package/dist/view/runtime.d.ts +26 -0
- package/dist/view/runtime.d.ts.map +1 -1
- package/dist/view/runtime.js +60 -6
- package/dist/view/schema.d.ts.map +1 -1
- package/dist/view/schema.js +29 -5
- package/dist/view/types.generated.d.ts +17 -3
- package/dist/view/types.generated.d.ts.map +1 -1
- package/package.json +3 -2
- package/schemas/extension-manifest.schema.json +15 -26
- package/schemas/view-2.schema.json +73 -3
package/dist/validate/index.js
CHANGED
|
@@ -23,9 +23,10 @@
|
|
|
23
23
|
* - Building the Studio bundle. Too slow; pair with `zveltio extension build`
|
|
24
24
|
* which can call validate as a sub-step.
|
|
25
25
|
*/
|
|
26
|
+
import { z } from 'zod';
|
|
26
27
|
import { parseMigrationSql } from './migration-parse.js';
|
|
27
28
|
export { SHARED_MESSAGE_KEYS } from './shared-message-keys.js';
|
|
28
|
-
/** Headers the engine keeps from a worker-isolated extension unless `forwardCredentials` names them. */
|
|
29
|
+
/** Headers the engine keeps from a worker-isolated extension unless a route's `forwardCredentials` names them. */
|
|
29
30
|
const CREDENTIAL_HEADERS = ['authorization', 'cookie', 'proxy-authorization', 'x-api-key'];
|
|
30
31
|
// ─── Helpers ───────────────────────────────────────────────────────────────
|
|
31
32
|
const SEMVER_RE = /^\d+\.\d+\.\d+(?:-[A-Za-z0-9.-]+)?$/;
|
|
@@ -140,8 +141,7 @@ export function validateManifest(input) {
|
|
|
140
141
|
}
|
|
141
142
|
}
|
|
142
143
|
// Actions and jobs: the engine's manifest schema refuses the whole extension
|
|
143
|
-
// on any of these
|
|
144
|
-
// that one is left to the engine.
|
|
144
|
+
// on any of these (parity: engine tests/unit/manifest-validate-parity.test.ts).
|
|
145
145
|
const NAME = /^[a-z][a-zA-Z0-9]*$/;
|
|
146
146
|
const strings = (v) => v === undefined || (Array.isArray(v) && v.every((s) => typeof s === 'string'));
|
|
147
147
|
const isObject = (v) => !!v && typeof v === 'object' && !Array.isArray(v);
|
|
@@ -164,6 +164,8 @@ export function validateManifest(input) {
|
|
|
164
164
|
seen.add(e.name);
|
|
165
165
|
if (!isObject(e.input))
|
|
166
166
|
out.push(err(code, `"${e.name}": "input" must be a JSON Schema object`));
|
|
167
|
+
else if (!compileInput(e.input))
|
|
168
|
+
out.push(err(code, `"${e.name}": "input" is not a JSON Schema the engine can compile`));
|
|
167
169
|
for (const k of ['reads', 'writes', 'enqueues', 'calls', 'fromPublicRoutes']) {
|
|
168
170
|
if (!strings(e[k]))
|
|
169
171
|
out.push(err(code, `"${e.name}": "${k}" must be an array of names`));
|
|
@@ -179,7 +181,7 @@ export function validateManifest(input) {
|
|
|
179
181
|
const seenRoutes = new Set();
|
|
180
182
|
declaredRoutes.forEach((r, i) => {
|
|
181
183
|
const ok = isObject(r) &&
|
|
182
|
-
Object.keys(r).every((k) => ['method', 'path', 'access', 'handler'].includes(k)) &&
|
|
184
|
+
Object.keys(r).every((k) => ['method', 'path', 'access', 'handler', 'forwardCredentials'].includes(k)) &&
|
|
183
185
|
['GET', 'POST', 'PUT', 'PATCH', 'DELETE'].includes(r.method) &&
|
|
184
186
|
typeof r.path === 'string' &&
|
|
185
187
|
ROUTE_PATH.test(r.path) &&
|
|
@@ -195,6 +197,17 @@ export function validateManifest(input) {
|
|
|
195
197
|
}
|
|
196
198
|
if (isObject(r))
|
|
197
199
|
seenRoutes.add(`${r.method} ${r.path}`);
|
|
200
|
+
// The host strips these from a worker's request; a public route may ask for some back.
|
|
201
|
+
if (isObject(r) && r.forwardCredentials !== undefined) {
|
|
202
|
+
const names = r.forwardCredentials;
|
|
203
|
+
if (r.access !== 'public') {
|
|
204
|
+
out.push(err('MANIFEST_BAD_FORWARD_CREDENTIALS', `route ${r.method} ${r.path}: forwardCredentials is for a public route`));
|
|
205
|
+
}
|
|
206
|
+
if (!Array.isArray(names) ||
|
|
207
|
+
names.some((n) => typeof n !== 'string' || !CREDENTIAL_HEADERS.includes(n))) {
|
|
208
|
+
out.push(err('MANIFEST_BAD_FORWARD_CREDENTIALS', `route ${r.method} ${r.path}: forwardCredentials must list some of ${CREDENTIAL_HEADERS.join(', ')}`));
|
|
209
|
+
}
|
|
210
|
+
}
|
|
198
211
|
});
|
|
199
212
|
// Sign-in providers (ADR 0039 decision 8), each started by a declared public
|
|
200
213
|
// route: `POST` for `credentials`, `GET` for `redirect`, without parameters.
|
|
@@ -226,8 +239,7 @@ export function validateManifest(input) {
|
|
|
226
239
|
if (isObject(p) && typeof p.id === 'string')
|
|
227
240
|
providerIds.add(p.id);
|
|
228
241
|
});
|
|
229
|
-
// `publicRoutes` (deprecated) and the declared public routes: what a job
|
|
230
|
-
// `forwardCredentials` may name.
|
|
242
|
+
// `publicRoutes` (deprecated) and the declared public routes: what a job may name.
|
|
231
243
|
const publicPaths = [
|
|
232
244
|
...(Array.isArray(obj.publicRoutes) ? obj.publicRoutes : []),
|
|
233
245
|
...declaredRoutes.filter((r) => isObject(r) && r.access === 'public').map((r) => r.path),
|
|
@@ -316,8 +328,7 @@ export function validateManifest(input) {
|
|
|
316
328
|
}
|
|
317
329
|
const egress = j.egress;
|
|
318
330
|
const egressOk = egress === undefined ||
|
|
319
|
-
(Array.isArray(egress) &&
|
|
320
|
-
egress.every((e) => typeof e === 'string' && /^[a-z0-9.\-[\]:]+$/.test(e)));
|
|
331
|
+
(Array.isArray(egress) && egress.every((e) => typeof e === 'string' && isEgressEntry(e)));
|
|
321
332
|
if (!egressOk) {
|
|
322
333
|
out.push(err('MANIFEST_BAD_JOB', `job "${j.name}": "egress" lists lower-case host names or host:port, no scheme, path or wildcard`));
|
|
323
334
|
}
|
|
@@ -355,40 +366,24 @@ export function validateManifest(input) {
|
|
|
355
366
|
}
|
|
356
367
|
// ADR 0048 d1: a clock that enqueues the job, five cron fields in UTC, as the engine reads them.
|
|
357
368
|
if (j.schedule !== undefined) {
|
|
358
|
-
if (typeof j.schedule !== 'string' || !
|
|
359
|
-
out.push(err('MANIFEST_BAD_JOB', `job "${j.name}": schedule "${String(j.schedule)}" is not a five-field cron expression (minute hour day-of-month month day-of-week; *, n, a-b, a,b and /step; in UTC)`));
|
|
369
|
+
if (typeof j.schedule !== 'string' || !cronFires(j.schedule)) {
|
|
370
|
+
out.push(err('MANIFEST_BAD_JOB', `job "${j.name}": schedule "${String(j.schedule)}" is not a five-field cron expression that fires (minute hour day-of-month month day-of-week; *, n, a-b, a,b and /step; in UTC)`));
|
|
360
371
|
}
|
|
361
372
|
else if (!(Array.isArray(obj.permissions) && obj.permissions.includes('data:system'))) {
|
|
362
373
|
out.push(err('MANIFEST_BAD_JOB', `job "${j.name}": a scheduled job runs with no caller, which needs the data:system capability`));
|
|
363
374
|
}
|
|
375
|
+
else if (compileInput(j.input)?.safeParse({}).success === false) {
|
|
376
|
+
out.push(err('MANIFEST_BAD_JOB', `job "${j.name}": a scheduled job is enqueued with input {}, which its input schema must accept`));
|
|
377
|
+
}
|
|
364
378
|
}
|
|
365
379
|
const hasEgress = (Array.isArray(egress) && egress.length > 0) || (Array.isArray(slots) && slots.length > 0);
|
|
366
380
|
if (!int(j.timeoutSeconds, 1, hasEgress ? 900 : 60)) {
|
|
367
381
|
out.push(err('MANIFEST_BAD_JOB', `job "${j.name}": "timeoutSeconds" is an integer, 1-${hasEgress ? 900 : 60} (above 60 needs egress)`));
|
|
368
382
|
}
|
|
369
383
|
}
|
|
370
|
-
//
|
|
384
|
+
// v2 entry 7: keyed by a path, an approved header reached every method on it.
|
|
371
385
|
if (obj.forwardCredentials !== undefined) {
|
|
372
|
-
|
|
373
|
-
if (!fwd || typeof fwd !== 'object' || Array.isArray(fwd)) {
|
|
374
|
-
out.push(err('MANIFEST_BAD_FORWARD_CREDENTIALS', '"forwardCredentials" must map a route to headers'));
|
|
375
|
-
}
|
|
376
|
-
else {
|
|
377
|
-
for (const [route, names] of Object.entries(fwd)) {
|
|
378
|
-
if (!publicPaths.includes(route)) {
|
|
379
|
-
out.push(err('MANIFEST_BAD_FORWARD_CREDENTIALS', `forwardCredentials names "${route}", which is not a publicRoutes entry`));
|
|
380
|
-
}
|
|
381
|
-
if (!Array.isArray(names)) {
|
|
382
|
-
out.push(err('MANIFEST_BAD_FORWARD_CREDENTIALS', `forwardCredentials "${route}" must be an array of header names`));
|
|
383
|
-
continue;
|
|
384
|
-
}
|
|
385
|
-
for (const n of names) {
|
|
386
|
-
if (typeof n !== 'string' || !CREDENTIAL_HEADERS.includes(n)) {
|
|
387
|
-
out.push(err('MANIFEST_BAD_FORWARD_CREDENTIALS', `forwardCredentials "${route}": ${JSON.stringify(n)} is not one of ${CREDENTIAL_HEADERS.join(', ')}`));
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
}
|
|
386
|
+
out.push(err('MANIFEST_BAD_FORWARD_CREDENTIALS', '"forwardCredentials" moved onto the declared route: routes[].forwardCredentials'));
|
|
392
387
|
}
|
|
393
388
|
if (typeof obj.category === 'string' && !KNOWN_CATEGORIES.has(obj.category)) {
|
|
394
389
|
// A true warning — categories are open-ended in practice (e.g. the RO
|
|
@@ -540,8 +535,84 @@ function columnLevelUniqueColumns(sql) {
|
|
|
540
535
|
}
|
|
541
536
|
return out;
|
|
542
537
|
}
|
|
538
|
+
/**
|
|
539
|
+
* The SQL that runs: comments become a space and every string literal `''`, in
|
|
540
|
+
* one left-to-right pass. Chained regexes get the order wrong (`'--'` opens a
|
|
541
|
+
* "comment", a quote inside a block comment a "string") and miss `E'\''`, so a quoted `DROP COLUMN tenant_id` read as a real one.
|
|
542
|
+
* Quoted identifiers stay; a `$$…$$` body is scanned on its own (`DO $$ … $$` runs).
|
|
543
|
+
*/
|
|
544
|
+
// PostgreSQL's dolq_start / dolq_cont: ASCII letters, `_`, digits after the
|
|
545
|
+
// first, and any non-ASCII character.
|
|
546
|
+
const DOLLAR_TAG = /^\$(?:[A-Za-z_\u0080-\u{10FFFF}][A-Za-z0-9_\u0080-\u{10FFFF}]*)?\$/u;
|
|
547
|
+
function sqlCode(sql) {
|
|
548
|
+
let out = '';
|
|
549
|
+
let i = 0;
|
|
550
|
+
while (i < sql.length) {
|
|
551
|
+
const c = sql[i];
|
|
552
|
+
const dollar = c === '$' && !/[\w$]/.test(sql[i - 1] ?? '') && DOLLAR_TAG.exec(sql.slice(i));
|
|
553
|
+
if (dollar) {
|
|
554
|
+
// A `$$…$$` body may run (`DO $$ … $$`), so it is scanned on its own: a
|
|
555
|
+
// quote or `--` inside it must not swallow the SQL around it.
|
|
556
|
+
const tag = dollar[0];
|
|
557
|
+
const end = sql.indexOf(tag, i + tag.length);
|
|
558
|
+
const stop = end < 0 ? sql.length : end;
|
|
559
|
+
out += ` ${sqlCode(sql.slice(i + tag.length, stop))} `;
|
|
560
|
+
i = end < 0 ? sql.length : end + tag.length;
|
|
561
|
+
}
|
|
562
|
+
else if (sql.startsWith('--', i)) {
|
|
563
|
+
const end = sql.indexOf('\n', i);
|
|
564
|
+
i = end < 0 ? sql.length : end;
|
|
565
|
+
out += ' ';
|
|
566
|
+
}
|
|
567
|
+
else if (sql.startsWith('/*', i)) {
|
|
568
|
+
let depth = 1;
|
|
569
|
+
i += 2;
|
|
570
|
+
while (i < sql.length && depth > 0) {
|
|
571
|
+
if (sql.startsWith('/*', i)) {
|
|
572
|
+
depth++;
|
|
573
|
+
i += 2;
|
|
574
|
+
}
|
|
575
|
+
else if (sql.startsWith('*/', i)) {
|
|
576
|
+
depth--;
|
|
577
|
+
i += 2;
|
|
578
|
+
}
|
|
579
|
+
else
|
|
580
|
+
i++;
|
|
581
|
+
}
|
|
582
|
+
out += ' ';
|
|
583
|
+
}
|
|
584
|
+
else if (c === "'" ||
|
|
585
|
+
((c === 'E' || c === 'e') && sql[i + 1] === "'" && !/\w/.test(sql[i - 1] ?? ''))) {
|
|
586
|
+
const escapes = c !== "'";
|
|
587
|
+
i += escapes ? 2 : 1;
|
|
588
|
+
while (i < sql.length) {
|
|
589
|
+
if (escapes && sql[i] === '\\')
|
|
590
|
+
i += 2;
|
|
591
|
+
else if (sql[i] === "'" && sql[i + 1] === "'")
|
|
592
|
+
i += 2;
|
|
593
|
+
else if (sql[i] === "'")
|
|
594
|
+
break;
|
|
595
|
+
else
|
|
596
|
+
i++;
|
|
597
|
+
}
|
|
598
|
+
i++;
|
|
599
|
+
out += "''";
|
|
600
|
+
}
|
|
601
|
+
else if (c === '"') {
|
|
602
|
+
const end = sql.indexOf('"', i + 1);
|
|
603
|
+
const stop = end < 0 ? sql.length : end + 1;
|
|
604
|
+
out += sql.slice(i, stop);
|
|
605
|
+
i = stop;
|
|
606
|
+
}
|
|
607
|
+
else {
|
|
608
|
+
out += c;
|
|
609
|
+
i++;
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
return out;
|
|
613
|
+
}
|
|
543
614
|
function keyColumnSets(upSql) {
|
|
544
|
-
const s = upSql
|
|
615
|
+
const s = sqlCode(upSql);
|
|
545
616
|
const sets = [];
|
|
546
617
|
const add = (cols, table) => {
|
|
547
618
|
const key = cols
|
|
@@ -576,7 +647,9 @@ const bareTable = (t) => t.replace(/"/g, '').split('.').pop().toLowerCase();
|
|
|
576
647
|
* 004): a key on it is instance-wide and needs no tenant column.
|
|
577
648
|
*/
|
|
578
649
|
function tenantColumnChanges(upSql) {
|
|
579
|
-
|
|
650
|
+
// A drop that is commented out or quoted (`COMMENT ON TABLE … IS '… DROP
|
|
651
|
+
// COLUMN tenant_id'`) takes nothing out of tenancy.
|
|
652
|
+
const s = sqlCode(upSql);
|
|
580
653
|
const out = [];
|
|
581
654
|
for (const m of s.matchAll(/ALTER\s+TABLE\s+(?:IF\s+EXISTS\s+)?(?:ONLY\s+)?([\w."]+)\s[^;]*?\b(ADD|DROP)\s+COLUMN\s+(?:IF\s+(?:NOT\s+)?EXISTS\s+)?"?tenant_id"?\b/gi))
|
|
582
655
|
out.push([bareTable(m[1]), m[2].toUpperCase() === 'DROP']);
|
|
@@ -898,6 +971,12 @@ export function validateSduiSchema(input) {
|
|
|
898
971
|
collectEndpoints(schema, endpoints);
|
|
899
972
|
for (const raw of endpoints) {
|
|
900
973
|
const bare = raw.split('?')[0];
|
|
974
|
+
// A browser resolves `.` and `..` before it sends the request, so
|
|
975
|
+
// `/ext/dep/../../api/admin/users` is a call to `/api/admin/users`.
|
|
976
|
+
if (/(?:^|\/)(?:\.|%2e){1,2}(?:\/|$)/i.test(raw.split(/[?#]/)[0])) {
|
|
977
|
+
out.push(err('SDUI_ENDPOINT_DOT_SEGMENT', `endpoint "${raw}" has a "." or ".." path segment, which a browser resolves to another path. Name the route itself.`, file));
|
|
978
|
+
continue;
|
|
979
|
+
}
|
|
901
980
|
if (SDUI_SHARED_READ_ALLOWLIST.has(bare))
|
|
902
981
|
continue;
|
|
903
982
|
// A dependency's namespace is allowed (relation pickers etc.).
|
|
@@ -1016,24 +1095,78 @@ export function validateExtension(input) {
|
|
|
1016
1095
|
},
|
|
1017
1096
|
};
|
|
1018
1097
|
}
|
|
1019
|
-
/**
|
|
1020
|
-
function
|
|
1021
|
-
|
|
1098
|
+
/** The engine's `inputSchemaIssue`: the compiled schema, or null when Zod cannot compile it. */
|
|
1099
|
+
function compileInput(input) {
|
|
1100
|
+
if (!input || typeof input !== 'object' || Array.isArray(input))
|
|
1101
|
+
return null;
|
|
1102
|
+
try {
|
|
1103
|
+
return z.fromJSONSchema(input);
|
|
1104
|
+
}
|
|
1105
|
+
catch {
|
|
1106
|
+
return null;
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
/**
|
|
1110
|
+
* The engine's `parseEgress`: a host or host:port, written the way the URL
|
|
1111
|
+
* parser writes it back, or it could never match a request.
|
|
1112
|
+
*/
|
|
1113
|
+
function isEgressEntry(e) {
|
|
1114
|
+
if (!/^(\[[0-9a-f:.]+\]|[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*)(:\d{1,5})?$/.test(e))
|
|
1115
|
+
return false;
|
|
1116
|
+
try {
|
|
1117
|
+
return new URL(`http://${e}`).hostname === e.replace(/:\d{1,5}$/, '');
|
|
1118
|
+
}
|
|
1119
|
+
catch {
|
|
1120
|
+
return false;
|
|
1121
|
+
}
|
|
1122
|
+
}
|
|
1123
|
+
/** One cron field as the set it matches (the engine's `parseField`), or null. */
|
|
1124
|
+
function cronField(raw, min, max) {
|
|
1125
|
+
const out = new Set();
|
|
1126
|
+
for (const part of raw.split(',')) {
|
|
1127
|
+
const m = /^(\*|(\d+)(?:-(\d+))?)(?:\/(\d+))?$/.exec(part);
|
|
1128
|
+
if (!m)
|
|
1129
|
+
return null;
|
|
1130
|
+
const step = m[4] === undefined ? 1 : Number(m[4]);
|
|
1131
|
+
const lo = m[2] === undefined ? min : Number(m[2]);
|
|
1132
|
+
// A bare number with a step runs to the end of the range.
|
|
1133
|
+
const hi = m[3] !== undefined ? Number(m[3]) : m[2] === undefined || m[4] ? max : lo;
|
|
1134
|
+
if (step < 1 || lo < min || hi > max || lo > hi)
|
|
1135
|
+
return null;
|
|
1136
|
+
for (let v = lo; v <= hi; v += step)
|
|
1137
|
+
out.add(v);
|
|
1138
|
+
}
|
|
1139
|
+
return out;
|
|
1140
|
+
}
|
|
1141
|
+
/**
|
|
1142
|
+
* Five cron fields that fire within four years, as the engine's `nextCronRun`
|
|
1143
|
+
* reads them: day-of-month and day-of-week OR when both are restricted (do not
|
|
1144
|
+
* start with `*`), AND otherwise; 7 is Sunday.
|
|
1145
|
+
*/
|
|
1146
|
+
function cronFires(expr) {
|
|
1147
|
+
const p = expr.trim().split(/\s+/);
|
|
1148
|
+
if (p.length !== 5)
|
|
1149
|
+
return false;
|
|
1150
|
+
const [minute, hour, dom, month, dow] = [
|
|
1022
1151
|
[0, 59],
|
|
1023
1152
|
[0, 23],
|
|
1024
1153
|
[1, 31],
|
|
1025
1154
|
[1, 12],
|
|
1026
1155
|
[0, 7],
|
|
1027
|
-
];
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1156
|
+
].map(([lo, hi], i) => cronField(p[i], lo, hi));
|
|
1157
|
+
if (!minute || !hour || !dom || !month || !dow)
|
|
1158
|
+
return false;
|
|
1159
|
+
if (dow.delete(7))
|
|
1160
|
+
dow.add(0);
|
|
1161
|
+
const either = !p[2].startsWith('*') && !p[4].startsWith('*');
|
|
1162
|
+
const day = new Date();
|
|
1163
|
+
for (let i = 0; i < 366 * 4; i++, day.setUTCDate(day.getUTCDate() + 1)) {
|
|
1164
|
+
if (!month.has(day.getUTCMonth() + 1))
|
|
1165
|
+
continue;
|
|
1166
|
+
const d = dom.has(day.getUTCDate());
|
|
1167
|
+
const w = dow.has(day.getUTCDay());
|
|
1168
|
+
if (either ? d || w : d && w)
|
|
1169
|
+
return true;
|
|
1170
|
+
}
|
|
1171
|
+
return false;
|
|
1039
1172
|
}
|
package/dist/view/index.d.ts
CHANGED
|
@@ -60,6 +60,9 @@ export type ActionOutcome = {
|
|
|
60
60
|
} | {
|
|
61
61
|
kind: 'reveal';
|
|
62
62
|
value: string;
|
|
63
|
+
} | {
|
|
64
|
+
kind: 'redirect';
|
|
65
|
+
url: string;
|
|
63
66
|
} | {
|
|
64
67
|
kind: 'values';
|
|
65
68
|
values: unknown;
|
|
@@ -75,6 +78,11 @@ export interface ViewNames {
|
|
|
75
78
|
actions: Iterable<string>;
|
|
76
79
|
/** Its `dependencies` and `optionalDependencies`: their actions are `<dep>.<action>`. */
|
|
77
80
|
dependencies?: Iterable<string>;
|
|
81
|
+
/**
|
|
82
|
+
* The collections its required `dependencies` declare: a `pick` may name one
|
|
83
|
+
* (the picker reads it through the data API as the user). Nothing else may.
|
|
84
|
+
*/
|
|
85
|
+
dependencyCollections?: Iterable<string>;
|
|
78
86
|
/** The `id`s of the extension's view files; `navigate` and `open` name one. Omit to skip. */
|
|
79
87
|
views?: Iterable<string>;
|
|
80
88
|
/** The message keys a `Text` may name (its own `en.json` and the shared ones). Omit to skip. */
|
|
@@ -85,6 +93,12 @@ export interface ViewNames {
|
|
|
85
93
|
* checked. Omit to skip.
|
|
86
94
|
*/
|
|
87
95
|
fields?: ReadonlyMap<string, Iterable<string>>;
|
|
96
|
+
/**
|
|
97
|
+
* Each declared collection's fields a list may use as a `facets` entry: a
|
|
98
|
+
* boolean, or one with declared choices. A collection absent here is not
|
|
99
|
+
* checked. Omit to skip.
|
|
100
|
+
*/
|
|
101
|
+
facetFields?: ReadonlyMap<string, Iterable<string>>;
|
|
88
102
|
}
|
|
89
103
|
/**
|
|
90
104
|
* What the schema cannot see in a (valid) view: a collection or action its
|
|
@@ -93,6 +107,13 @@ export interface ViewNames {
|
|
|
93
107
|
* the extension does not ship, a field its collection does not have. (`fallback` is an inline view, not a reference.)
|
|
94
108
|
*/
|
|
95
109
|
export declare function viewNameIssues(view: unknown, names: ViewNames): ViewIssue[];
|
|
110
|
+
/**
|
|
111
|
+
* A `pick` names an input the action declares as a plain string (the record's
|
|
112
|
+
* id is a string): not a number, a list, an object or a fixed set of choices.
|
|
113
|
+
* `inputs`: each own action's declared input JSON Schema, by name; an action
|
|
114
|
+
* absent from it (a dependency's, or one with no schema) is not checked.
|
|
115
|
+
*/
|
|
116
|
+
export declare function pickIssues(view: unknown, inputs: ReadonlyMap<string, unknown>): ViewIssue[];
|
|
96
117
|
type Kind = View['type'];
|
|
97
118
|
type Of<K extends Kind> = Extract<View, {
|
|
98
119
|
type: K;
|
|
@@ -133,6 +154,7 @@ export declare const view: {
|
|
|
133
154
|
actions?: import("./types.generated.js").Buttons;
|
|
134
155
|
fallback?: View;
|
|
135
156
|
action: import("./types.generated.js").ActionName;
|
|
157
|
+
pick?: Record<string, import("./types.generated.js").Name>;
|
|
136
158
|
fields?: import("./types.generated.js").Fields;
|
|
137
159
|
sections?: Array<{
|
|
138
160
|
title?: import("./types.generated.js").Text;
|
package/dist/view/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/view/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAe,SAAS,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,KAAK,EAAgB,SAAS,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9F,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACrD,cAAc,cAAc,CAAC;AAC7B,mBAAmB,sBAAsB,CAAC;AAE1C,+EAA+E;AAC/E,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG;IAAE,IAAI,EAAE,OAAO,SAAS,CAAC;I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+38,8 @@ const CONDITION_LISTS = new Set(['filter', 'when', 'emphasisWhen', 'busyWhen']);
|
|
|
38
38
|
* - the data API takes one value per field and operator (`{"f":{"gt":1,"lt":9}}`),
|
|
39
39
|
* so a condition list that gives the same pair twice cannot be sent whole: one
|
|
40
40
|
* of the two would be dropped and the list would answer wider than written;
|
|
41
|
-
* - a button's `prompt` never names an input its
|
|
41
|
+
* - a button's `prompt` (and its `files.prompt`) never names an input its
|
|
42
|
+
* `input` already binds.
|
|
42
43
|
*/
|
|
43
44
|
function crossChecks(v, path, out) {
|
|
44
45
|
if (Array.isArray(v)) {
|
|
@@ -58,6 +59,50 @@ function crossChecks(v, path, out) {
|
|
|
58
59
|
}
|
|
59
60
|
});
|
|
60
61
|
}
|
|
62
|
+
// `pick` draws an input as a picker: on a button only an input it asks for, on neither one it sets.
|
|
63
|
+
if (isObj(v.pick)) {
|
|
64
|
+
const button = v.type !== 'form';
|
|
65
|
+
for (const name of Object.keys(v.pick)) {
|
|
66
|
+
if (isObj(v.input) && Object.hasOwn(v.input, name)) {
|
|
67
|
+
out.push({
|
|
68
|
+
path: `${path}/pick/${name}`,
|
|
69
|
+
message: 'names an input the button already sets',
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
else if (button && !(Array.isArray(v.prompt) && v.prompt.includes(name))) {
|
|
73
|
+
out.push({
|
|
74
|
+
path: `${path}/pick/${name}`,
|
|
75
|
+
message: 'names an input the button does not ask for (`prompt`)',
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if (Array.isArray(v.facets)) {
|
|
81
|
+
const all = v.facets;
|
|
82
|
+
all.forEach((f, i) => {
|
|
83
|
+
if (all.indexOf(f) !== i)
|
|
84
|
+
out.push({ path: `${path}/facets/${i}`, message: 'repeats a field' });
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
// A facet adds `field eq value`: on a field the view's `filter` already constrains it would contradict it.
|
|
88
|
+
if (Array.isArray(v.facets) && Array.isArray(v.filter)) {
|
|
89
|
+
const fixed = new Set(v.filter.map((c) => (isObj(c) ? c.field : undefined)));
|
|
90
|
+
v.facets.forEach((f, i) => {
|
|
91
|
+
if (fixed.has(f)) {
|
|
92
|
+
out.push({
|
|
93
|
+
path: `${path}/facets/${i}`,
|
|
94
|
+
message: "is a field the view's filter already constrains",
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
const filePrompt = isObj(v.files) && isObj(v.files.prompt) ? v.files.prompt.input : undefined;
|
|
100
|
+
if (typeof filePrompt === 'string' && isObj(v.input) && Object.hasOwn(v.input, filePrompt)) {
|
|
101
|
+
out.push({
|
|
102
|
+
path: `${path}/files/prompt/input`,
|
|
103
|
+
message: 'names an input the button already sets',
|
|
104
|
+
});
|
|
105
|
+
}
|
|
61
106
|
for (const [k, x] of Object.entries(v)) {
|
|
62
107
|
if (CONDITION_LISTS.has(k) && Array.isArray(x)) {
|
|
63
108
|
const seen = new Set();
|
|
@@ -92,6 +137,9 @@ export function readActionResult(result) {
|
|
|
92
137
|
if (isObj(r) && 'reveal' in r && typeof r.reveal === 'string') {
|
|
93
138
|
return { kind: 'reveal', value: r.reveal };
|
|
94
139
|
}
|
|
140
|
+
if (isObj(r) && 'redirect' in r && typeof r.redirect === 'string') {
|
|
141
|
+
return { kind: 'redirect', url: r.redirect };
|
|
142
|
+
}
|
|
95
143
|
return { kind: 'values', values: result };
|
|
96
144
|
}
|
|
97
145
|
/** Keys that name one field of the bound collection, by view kind (`*`: any). */
|
|
@@ -120,6 +168,8 @@ function fieldRefs(v) {
|
|
|
120
168
|
add(`/${k}`, v[k]);
|
|
121
169
|
fieldList(v.fields, '/fields');
|
|
122
170
|
fieldList(v.card, '/card');
|
|
171
|
+
if (Array.isArray(v.facets))
|
|
172
|
+
v.facets.forEach((f, i) => add(`/facets/${i}`, f));
|
|
123
173
|
if (Array.isArray(v.sections)) {
|
|
124
174
|
v.sections.forEach((s, i) => isObj(s) && fieldList(s.fields, `/sections/${i}/fields`));
|
|
125
175
|
}
|
|
@@ -148,9 +198,11 @@ export function viewNameIssues(view, names) {
|
|
|
148
198
|
const collections = new Set(names.collections);
|
|
149
199
|
const actions = new Set(names.actions);
|
|
150
200
|
const deps = new Set(names.dependencies ?? []);
|
|
201
|
+
const pickable = new Set([...collections, ...(names.dependencyCollections ?? [])]);
|
|
151
202
|
const views = names.views && new Set(names.views);
|
|
152
203
|
const keys = names.messageKeys && new Set(names.messageKeys);
|
|
153
204
|
const fields = names.fields && new Map([...names.fields].map(([c, f]) => [c, new Set(f)]));
|
|
205
|
+
const facetable = names.facetFields && new Map([...names.facetFields].map(([c, f]) => [c, new Set(f)]));
|
|
154
206
|
const ids = new Set();
|
|
155
207
|
const out = [];
|
|
156
208
|
const issue = (path, message) => out.push({ path, message });
|
|
@@ -180,8 +232,26 @@ export function viewNameIssues(view, names) {
|
|
|
180
232
|
issue(`${path}${at}`, `field "${f}" is not a field of "${v.collection}"`);
|
|
181
233
|
}
|
|
182
234
|
}
|
|
235
|
+
const facetOk = !valuesOnly && typeof v.collection === 'string' && facetable?.get(v.collection);
|
|
236
|
+
if (facetOk && Array.isArray(v.facets)) {
|
|
237
|
+
v.facets.forEach((f, i) => {
|
|
238
|
+
// A field the collection lacks is reported above, as every field reference.
|
|
239
|
+
if (typeof f === 'string' && known && known.has(f) && !facetOk.has(f)) {
|
|
240
|
+
issue(`${path}/facets/${i}`, `field "${f}" is neither a boolean nor a single-value field with declared choices`);
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
}
|
|
183
244
|
for (const [k, x] of Object.entries(v)) {
|
|
184
245
|
const at = `${path}/${k}`;
|
|
246
|
+
if (k === 'pick' && !valuesOnly && isObj(x)) {
|
|
247
|
+
// Input names are the caller's; each value names a collection.
|
|
248
|
+
for (const [name, c] of Object.entries(x)) {
|
|
249
|
+
if (typeof c === 'string' && !pickable.has(c)) {
|
|
250
|
+
issue(`${at}/${name}`, `collection "${c}" is declared neither by this extension nor by a required dependency`);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
continue;
|
|
254
|
+
}
|
|
185
255
|
if (k === '$selected') {
|
|
186
256
|
if (typeof x === 'string' && !panes.has(x)) {
|
|
187
257
|
issue(at, `"${x}" is not an earlier pane of an enclosing split`);
|
|
@@ -233,6 +303,46 @@ export function viewNameIssues(view, names) {
|
|
|
233
303
|
walk(view, '', new Set(), false);
|
|
234
304
|
return out;
|
|
235
305
|
}
|
|
306
|
+
/**
|
|
307
|
+
* A `pick` names an input the action declares as a plain string (the record's
|
|
308
|
+
* id is a string): not a number, a list, an object or a fixed set of choices.
|
|
309
|
+
* `inputs`: each own action's declared input JSON Schema, by name; an action
|
|
310
|
+
* absent from it (a dependency's, or one with no schema) is not checked.
|
|
311
|
+
*/
|
|
312
|
+
export function pickIssues(view, inputs) {
|
|
313
|
+
const out = [];
|
|
314
|
+
const walk = (v, path) => {
|
|
315
|
+
if (Array.isArray(v)) {
|
|
316
|
+
v.forEach((x, i) => walk(x, `${path}/${i}`));
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
if (!isObj(v))
|
|
320
|
+
return;
|
|
321
|
+
if (isObj(v.pick) && typeof v.action === 'string' && inputs.has(v.action)) {
|
|
322
|
+
const props = inputs.get(v.action)
|
|
323
|
+
?.properties;
|
|
324
|
+
for (const name of Object.keys(v.pick)) {
|
|
325
|
+
const p = props && Object.hasOwn(props, name) ? props[name] : undefined;
|
|
326
|
+
const t = isObj(p) ? p.type : undefined;
|
|
327
|
+
const text = t === 'string' ||
|
|
328
|
+
(Array.isArray(t) &&
|
|
329
|
+
t.length > 0 &&
|
|
330
|
+
t.every((x) => x === 'string' || x === 'null') &&
|
|
331
|
+
t.includes('string'));
|
|
332
|
+
if (!text || (isObj(p) && Array.isArray(p.enum))) {
|
|
333
|
+
out.push({
|
|
334
|
+
path: `${path}/pick/${name}`,
|
|
335
|
+
message: `is not a string input of action "${v.action}"`,
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
for (const [k, x] of Object.entries(v))
|
|
341
|
+
walk(x, `${path}/${k}`);
|
|
342
|
+
};
|
|
343
|
+
walk(view, '');
|
|
344
|
+
return out;
|
|
345
|
+
}
|
|
236
346
|
/** Drops `undefined` keys (`sort: cond ? 'a' : undefined`) at every depth, as the file would. */
|
|
237
347
|
const clean = (v) => JSON.parse(JSON.stringify(v));
|
|
238
348
|
const kind = (type) => (props) => clean({ type, ...props });
|
package/dist/view/runtime.d.ts
CHANGED
|
@@ -91,4 +91,30 @@ export declare function viewFields(fields: Fields | undefined, schema: readonly
|
|
|
91
91
|
export declare function fallbackFor(view: View, drawn: ReadonlySet<string>): View | null;
|
|
92
92
|
/** The engine path that runs an action: its own extension's, or `<dependency>.<action>`. */
|
|
93
93
|
export declare function actionPath(extension: string, action: string): string;
|
|
94
|
+
/** The collection a relation field points at (`m2o`, `reference`); none for any other field. */
|
|
95
|
+
export declare function relatedOf(f: SchemaField | undefined): string | null;
|
|
96
|
+
/** A facet value as the choice declares it. */
|
|
97
|
+
export type FacetValue = string | number | boolean;
|
|
98
|
+
/**
|
|
99
|
+
* A field's declared choices, in order, each as the declaration gives it (a
|
|
100
|
+
* plain value or `{ value, label }`). The engine's `enum` declares them as
|
|
101
|
+
* `options.values`; a list in `options`, or `options.choices`, is read too.
|
|
102
|
+
* Nothing for a field that declares none.
|
|
103
|
+
*/
|
|
104
|
+
export declare function declaredChoices(f: SchemaField | undefined): unknown[];
|
|
105
|
+
/**
|
|
106
|
+
* What a list's `facets` entry offers for a field: its declared choices, or
|
|
107
|
+
* `true` and `false` for a boolean; nothing for any other field.
|
|
108
|
+
*/
|
|
109
|
+
export declare function facetOptions(f: SchemaField | undefined): {
|
|
110
|
+
value: FacetValue;
|
|
111
|
+
label: string;
|
|
112
|
+
}[];
|
|
113
|
+
/**
|
|
114
|
+
* A list's `filter` with the facet values picked (field → value) added as
|
|
115
|
+
* `field eq value`. A facet on a field the filter constrains is refused by
|
|
116
|
+
* `validateView`; one that slips through is dropped, so the view's own
|
|
117
|
+
* condition always stands.
|
|
118
|
+
*/
|
|
119
|
+
export declare function withFacets(filter: Conditions | undefined, picked: Readonly<Record<string, FacetValue | undefined>>): Conditions | undefined;
|
|
94
120
|
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/view/runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EACV,MAAM,EAEN,UAAU,EACV,KAAK,EACL,MAAM,EACN,WAAW,EACX,KAAK,EAGL,IAAI,EACJ,KAAK,EACL,IAAI,EACL,MAAM,sBAAsB,CAAC;AAE9B,8EAA8E;AAC9E,MAAM,WAAW,SAAS;IACxB,sCAAsC;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,mEAAmE;IACnE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,kDAAkD;IAClD,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IACtC,0DAA0D;IAC1D,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,yCAAyC;IACzC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,2DAA2D;IAC3D,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/view/runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EACV,MAAM,EAEN,UAAU,EACV,KAAK,EACL,MAAM,EACN,WAAW,EACX,KAAK,EAGL,IAAI,EACJ,KAAK,EACL,IAAI,EACL,MAAM,sBAAsB,CAAC;AAE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