@mistriwork/engine 1.0.0-rc.14 → 1.0.0-rc.16
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/adapters/cache/cacheStore.d.ts +1 -1
- package/dist/adapters/cache/cacheStore.js +1 -1
- package/dist/server/cli/startup.js +7 -2
- package/dist/server/cli/usage.d.ts +2 -0
- package/dist/server/cli/usage.js +12 -1
- package/dist/server/clientHttp.js +20 -3
- package/dist/server/config/profile.d.ts +10 -3
- package/dist/server/config/profile.js +28 -4
- package/dist/server/connections.js +1 -1
- package/dist/server/demo.js +3 -3
- package/dist/server/http/baselineHeaders.d.ts +13 -3
- package/dist/server/http/baselineHeaders.js +6 -0
- package/dist/server/http/frontDoor.d.ts +41 -0
- package/dist/server/http/frontDoor.js +36 -0
- package/dist/server/http/rateLimit.d.ts +2 -2
- package/dist/server/http/rateLimit.js +16 -2
- package/dist/server/http/recordCompose.d.ts +3 -0
- package/dist/server/http/recordCompose.js +1 -0
- package/dist/server/http/serverCore.d.ts +2 -2
- package/dist/server/http/serverCore.js +16 -32
- package/dist/server/migrate/cli.js +8 -1
- package/dist/server/migrate/desired.js +2 -2
- package/dist/server/migrate/target.d.ts +8 -0
- package/dist/server/migrate/target.js +15 -0
- package/dist/server/seed/seed.js +46 -11
- package/dist/server/startupWarnings.js +1 -1
- package/dist/shared/appCards.d.ts +4 -0
- package/dist/shared/appCards.js +5 -0
- package/dist/shared/breakdown.js +8 -2
- package/dist/shared/computed.d.ts +16 -2
- package/dist/shared/computed.js +23 -4
- package/dist/shared/computedValue.js +23 -0
- package/dist/shared/iconWeights.js +1 -0
- package/dist/shared/listPresentations.d.ts +9 -2
- package/dist/shared/listPresentations.js +2 -0
- package/dist/shared/listQuestion.d.ts +9 -0
- package/dist/shared/listQuestion.js +18 -0
- package/dist/shared/mentionLookup.js +3 -1
- package/dist/shared/page.d.ts +8 -1
- package/dist/shared/page.js +151 -7
- package/dist/shared/pageAnatomy.js +2 -0
- package/dist/shared/pageConfig.d.ts +1 -1
- package/dist/shared/pageConfig.js +106 -19
- package/dist/shared/pageModel.d.ts +62 -5
- package/dist/shared/pagePaths.js +4 -1
- package/dist/shared/pagePlans.d.ts +4 -2
- package/dist/shared/pagePlans.js +6 -4
- package/dist/shared/recordLabel.d.ts +12 -3
- package/dist/shared/recordLabel.js +39 -18
- package/dist/shared/recordReads.d.ts +6 -30
- package/dist/shared/recordReads.js +13 -1
- package/dist/shared/rollups.d.ts +4 -4
- package/dist/shared/rollups.js +1 -1
- package/dist/shared/schema.d.ts +7 -0
- package/dist/shared/schema.js +17 -0
- package/dist/shared/servedApp.d.ts +5 -1
- package/dist/shared/viewLabels.js +22 -17
- package/package.json +3 -2
- package/schema/model.d.ts +14 -5
- package/schema/theme.d.ts +1 -1
|
@@ -355,23 +355,28 @@ export function viewPaths(schema, view, plan, style, relations) {
|
|
|
355
355
|
return named(style.concat(parts.map((part) => {
|
|
356
356
|
if ('text' in part)
|
|
357
357
|
return literal(part.text);
|
|
358
|
-
const
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
358
|
+
const one = (field) => {
|
|
359
|
+
const value = style.text(plain(at(prefix, field.path)));
|
|
360
|
+
/* A masked column says its placeholder in the name too, computed here
|
|
361
|
+
like the rest of it, so no list, picker or breadcrumb reads the value. */
|
|
362
|
+
if (field.mask?.prefix) {
|
|
363
|
+
return `CASE WHEN SUBSTR(${value}, 1, ${[...field.mask.prefix].length}) = ${literal(field.mask.prefix)} THEN ${literal(field.mask.prefix + MASK)} ELSE COALESCE(${value}, '') END`;
|
|
364
|
+
}
|
|
365
|
+
if (field.mask)
|
|
366
|
+
return `CASE WHEN ${value} IS NULL THEN '' ELSE ${literal(MASK)} END`;
|
|
367
|
+
/* A stored value said as its display rule's word, as a cell says it:
|
|
368
|
+
the words are the catalog's, held to what every engine reads alike. */
|
|
369
|
+
if (field.words) {
|
|
370
|
+
const cases = Object.entries(field.words)
|
|
371
|
+
.map(([stored, word]) => `WHEN ${literal(stored)} THEN ${literal(word)}`)
|
|
372
|
+
.join(' ');
|
|
373
|
+
return `CASE ${value} ${cases} ELSE COALESCE(${value}, '') END`;
|
|
374
|
+
}
|
|
375
|
+
return `COALESCE(${value}, '')`;
|
|
376
|
+
};
|
|
377
|
+
/* A fallback chain is its first alternative with a value: each said as it would alone, an empty text
|
|
378
|
+
counting as none, so a blank nickname gives way to the name behind it. */
|
|
379
|
+
return part.or ? `COALESCE(${[part, ...part.or].map((field) => `NULLIF(${one(field)}, '')`).join(', ')}, '')` : one(part);
|
|
375
380
|
})));
|
|
376
381
|
};
|
|
377
382
|
/* The catalog's type of what a path reads where it reads one column as it is stored, as `qualify` writes it plain:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mistriwork/engine",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.16",
|
|
4
4
|
"description": "The engine both products stand on: the adapters (SQLite, Postgres), the catalog, the query language, keyset pages, the HTTP kit and the shared rules. No React.",
|
|
5
5
|
"homepage": "https://mistriwork.dev",
|
|
6
6
|
"bugs": {
|
|
@@ -103,6 +103,7 @@
|
|
|
103
103
|
"./server/http/door.js": "./dist/server/http/door.js",
|
|
104
104
|
"./server/http/exportRoute.js": "./dist/server/http/exportRoute.js",
|
|
105
105
|
"./server/http/firstPaint.js": "./dist/server/http/firstPaint.js",
|
|
106
|
+
"./server/http/frontDoor.js": "./dist/server/http/frontDoor.js",
|
|
106
107
|
"./server/http/httpOperationRoutes.js": "./dist/server/http/httpOperationRoutes.js",
|
|
107
108
|
"./server/http/pageReads.js": "./dist/server/http/pageReads.js",
|
|
108
109
|
"./server/http/pageRoutes.js": "./dist/server/http/pageRoutes.js",
|
|
@@ -264,6 +265,6 @@
|
|
|
264
265
|
"pg": "^8.23.0"
|
|
265
266
|
},
|
|
266
267
|
"engines": {
|
|
267
|
-
"node": ">=24
|
|
268
|
+
"node": ">=24"
|
|
268
269
|
}
|
|
269
270
|
}
|
package/schema/model.d.ts
CHANGED
|
@@ -105,8 +105,9 @@ export interface CommandValueBase {
|
|
|
105
105
|
input?: string;
|
|
106
106
|
}
|
|
107
107
|
/** How a field is drawn: a slider (a bounded number or amount), cards (one or several, with icons), two buttons (a
|
|
108
|
-
yes or a no; a choice's few), a select, or radios
|
|
109
|
-
|
|
108
|
+
yes or a no; a choice's few), a select, or radios; a number as stars (`'rating'`), a text as a code the camera
|
|
109
|
+
reads (`'scan'`) or as a color with the system's picker (`'color'`). */
|
|
110
|
+
export type CommandFieldPresentation = 'slider' | 'cards' | 'buttons' | 'select' | 'radios' | 'rating' | 'scan' | 'color';
|
|
110
111
|
/** What a sensitive text keeps once its own rules have read the whole value: its last four characters, a keyed hash
|
|
111
112
|
(HMAC under the form key), nothing at all, or — for the handler alone, once, in memory — the whole value
|
|
112
113
|
(`'handler'`); whatever it keeps, the journal, the audit, events, flags, logs and the idempotency fingerprint
|
|
@@ -155,7 +156,8 @@ export type AppCommandField = (CommandValueBase & (
|
|
|
155
156
|
(`'000-00-0000'`). The value is what the mask's places hold (`123456789`), and the mask is its pattern. */
|
|
156
157
|
mask?: string; sensitive?: CommandSensitive }
|
|
157
158
|
| { type: 'richText'; minLength?: number; maxLength?: number; mentions?: CommandRichTextMentions; images?: string }
|
|
158
|
-
|
|
159
|
+
/** `outOf`: with `as: 'rating'`, the stars of its scale; the field is then a whole number from 1 to it. */
|
|
160
|
+
| { type: 'number'; min?: number; max?: number; integer?: boolean; step?: number; below?: string; above?: string; live?: CommandLiveLines; outOf?: number }
|
|
159
161
|
/** An amount of money in the App's currency (`ui.currency`), from 0 unless `min` says less, on cents unless `step` says otherwise. */
|
|
160
162
|
| { type: 'money'; min?: number; max?: number; step?: number; minor?: boolean; currency?: string; below?: string; above?: string; live?: CommandLiveLines }
|
|
161
163
|
/** `statement`: the long words a consent box stands beside (at most 2,000 characters), drawn as one paragraph. */
|
|
@@ -164,12 +166,19 @@ export type AppCommandField = (CommandValueBase & (
|
|
|
164
166
|
/** A month, `YYYY-MM`: `min` and `max` are months too. */
|
|
165
167
|
| { type: 'month'; min?: string; max?: string; below?: string; above?: string }
|
|
166
168
|
| { type: 'datetime'; min?: string; max?: string; below?: string; above?: string }
|
|
169
|
+
/** A time of day, `HH:MM` on a 24-hour clock: `min` and `max` are times too. */
|
|
170
|
+
| { type: 'time'; min?: string; max?: string; below?: string; above?: string }
|
|
167
171
|
/** One of the options; or, with `source`, one of a table's rows by its key (the options then come from the table). */
|
|
168
172
|
| { type: 'choice'; options: readonly AppCommandChoice[]; source?: CommandChoiceSource }
|
|
169
173
|
/** Several of the options: from `min` to `max` of them, and an `exclusive` option (`'none'`) stands alone. */
|
|
170
174
|
| { type: 'choices'; options: readonly AppCommandChoice[]; source?: CommandChoiceSource; min?: number; max?: number; exclusive?: readonly (string | number)[] }
|
|
171
|
-
| { type: 'reference'; from: string; by: string; labelColumn: string; query?: string }
|
|
175
|
+
| { type: 'reference'; from: string; by: string; labelColumn: string; query?: string; tree?: string }
|
|
172
176
|
| { type: 'defined'; from: string; whose?: string }
|
|
177
|
+
/** Files of the file resource `from`, from `min` (1 unless said) to `max`; `accept` the media types taken
|
|
178
|
+
(`image/*`). Each is sent as it is picked and held for the command; the value is the held files' ids. */
|
|
179
|
+
| { type: 'files'; from: string; min?: number; max: number; accept?: readonly string[] }
|
|
180
|
+
/** A signature drawn on a pad, held as a PNG of the file resource `from`; the value is the held file's id. */
|
|
181
|
+
| { type: 'signature'; from: string }
|
|
173
182
|
)) | AppCommandGroup | AppCommandLines;
|
|
174
183
|
|
|
175
184
|
/**
|
|
@@ -288,7 +297,7 @@ export interface AppCommandAction<Target extends string = string, Label extends
|
|
|
288
297
|
/** A resource action as the App serves it. */
|
|
289
298
|
export type AppAction<Target extends string = string, Label extends string | AppMessageRef = string> = AppUpdateAction<Label> | AppCommandAction<Target, Label>;
|
|
290
299
|
|
|
291
|
-
/** The authored spelling of a page and its sections — the plain data a pages/ file and
|
|
300
|
+
/** The authored spelling of a page and its sections — the plain data a pages/ file and the config file (mistri.json) hold — as the
|
|
292
301
|
page rules write it back (packages/engine/src/shared/page.ts `sectionConfig`, `pageConfig`). The App framework's types say what it
|
|
293
302
|
is: packages/mistri/schema/app.d.ts fills these shapes in with `Plain<PageSection>` and `Plain<AppPage>`, so a rule that writes a
|
|
294
303
|
section the authored types refuse does not compile, while the engine names none of the App's authoring types.
|
package/schema/theme.d.ts
CHANGED
|
@@ -567,7 +567,7 @@ interface ThemeSpecCommon {
|
|
|
567
567
|
* the theme is worn (theme-css).
|
|
568
568
|
*/
|
|
569
569
|
stylesheet?: `./${string}.css`;
|
|
570
|
-
/** The theme contract it was written to. A package says `1`; a newer one than this
|
|
570
|
+
/** The theme contract it was written to. A package says `1`; a newer one than this mistri knows is refused. */
|
|
571
571
|
contract?: 1;
|
|
572
572
|
/** Where its files are read from: a package's `import.meta.url`. Omitted, the App's directory. */
|
|
573
573
|
from?: string;
|