@mistriwork/engine 1.0.0-rc.12 → 1.0.0-rc.13
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/server/cli/bin.js +2 -2
- package/dist/server/cli/startup.js +2 -2
- package/dist/server/cli/usage.d.ts +2 -2
- package/dist/server/cli/usage.js +2 -2
- package/dist/server/demo.js +2 -2
- package/dist/server/http/baselineHeaders.d.ts +2 -0
- package/dist/server/http/baselineHeaders.js +2 -0
- package/dist/server/http/crawlerText.d.ts +4 -1
- package/dist/server/http/crawlerText.js +4 -1
- package/dist/server/http/httpOperationRoutes.d.ts +4 -1
- package/dist/server/http/httpOperationRoutes.js +4 -1
- package/dist/server/http/reply.d.ts +1 -0
- package/dist/server/http/reply.js +1 -0
- package/dist/server/http/trust.d.ts +1 -0
- package/dist/server/http/trust.js +1 -0
- package/dist/server/product.d.ts +1 -1
- package/dist/server/recordWriteOperations.d.ts +2 -1
- package/dist/server/recordWriteOperations.js +2 -1
- package/dist/server/resourceReadHttp.d.ts +1 -0
- package/dist/server/resourceReadHttp.js +1 -0
- package/package.json +4 -1
package/dist/server/cli/bin.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* What each binary's entry does before its main, the one way: `
|
|
3
|
-
*
|
|
2
|
+
* What each binary's entry does before its main, the one way: `mistri` (packages/mistri/src/server/index.ts) and
|
|
3
|
+
* `tablewalk` (the database browser's, in its own repository) each call `runBin` with their own main, and nothing else.
|
|
4
4
|
*
|
|
5
5
|
* Two binaries, not one bin that hands a start across: a person types `npx tablewalk <db>` for the database browser
|
|
6
6
|
* and `npx @mistriwork/mistri dev` for an App, and each refuses the other's start by the other's name. Neither entry imports the
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* What every start does before its mode, whichever binary runs it: the questions answered without starting
|
|
3
3
|
* anything (`--help`, `--version`, a typo), and the process's settings the flags make (the proxies it believes,
|
|
4
|
-
* its pools). Both mains call these (packages/
|
|
5
|
-
*
|
|
4
|
+
* its pools). Both mains call these (packages/mistri/src/server/cli/mistriMain.ts here, the database browser's in
|
|
5
|
+
* its own repository), each with its own words (`Product`), and each binary runs its own
|
|
6
6
|
* main (bin.ts).
|
|
7
7
|
*/
|
|
8
8
|
import { parseClientAddressPolicy, parseTrustedProxies } from '../http/trust.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* What both command lines share about their words: the near miss a typo is told, the version, and how a usage text
|
|
3
|
-
* is read for its command and flag words. Each binary keeps its own `USAGE` (packages/
|
|
4
|
-
*
|
|
3
|
+
* is read for its command and flag words. Each binary keeps its own `USAGE` (packages/mistri/src/server/cli/usage.ts
|
|
4
|
+
* here, the database browser's in its own repository), and each is held to its own README.
|
|
5
5
|
*/
|
|
6
6
|
/** The command words a usage names (`tablewalk migrate`, `mistri check`, …), for a near miss's suggestion. */
|
|
7
7
|
export declare function commandWordsOf(usage: string, bin: string): string[];
|
package/dist/server/cli/usage.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* What both command lines share about their words: the near miss a typo is told, the version, and how a usage text
|
|
3
|
-
* is read for its command and flag words. Each binary keeps its own `USAGE` (packages/
|
|
4
|
-
*
|
|
3
|
+
* is read for its command and flag words. Each binary keeps its own `USAGE` (packages/mistri/src/server/cli/usage.ts
|
|
4
|
+
* here, the database browser's in its own repository), and each is held to its own README.
|
|
5
5
|
*/
|
|
6
6
|
/** The command words a usage names (`tablewalk migrate`, `mistri check`, …), for a near miss's suggestion. */
|
|
7
7
|
export function commandWordsOf(usage, bin) {
|
package/dist/server/demo.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Build the demo database.
|
|
3
3
|
*
|
|
4
|
-
* Lives in `src/` (not `test/`) because it ships:
|
|
4
|
+
* Lives in `src/` (not `test/`) because it ships: `--demo` builds
|
|
5
5
|
* one of these at runtime so a new install has something to walk without
|
|
6
6
|
* hunting for a database first. `test/make-demo-db.ts` re-exports it, so the
|
|
7
|
-
* suite
|
|
7
|
+
* suite keeps the path it has always used.
|
|
8
8
|
*
|
|
9
9
|
* A demo that ships as a binary file is a demo nobody can review, so this
|
|
10
10
|
* writes one from source instead. The shape is chosen to exercise the parts
|
|
@@ -17,7 +17,9 @@
|
|
|
17
17
|
*/
|
|
18
18
|
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
19
19
|
import { type ProxyRange } from './trust.js';
|
|
20
|
+
/** @public the database browser's (scripts/boundary/entries.json, "host") */
|
|
20
21
|
export declare const REFERRER_POLICY = "strict-origin-when-cross-origin";
|
|
22
|
+
/** @public the database browser's (scripts/boundary/entries.json, "host") */
|
|
21
23
|
export declare const PERMISSIONS_POLICY: string;
|
|
22
24
|
/** A year, and the names under this one: the time browsers ask of a name kept on https. */
|
|
23
25
|
export declare const STRICT_TRANSPORT = "max-age=31536000; includeSubDomains";
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { arrivedOverHttps } from './trust.js';
|
|
2
|
+
/** @public the database browser's (scripts/boundary/entries.json, "host") */
|
|
2
3
|
export const REFERRER_POLICY = 'strict-origin-when-cross-origin';
|
|
4
|
+
/** @public the database browser's (scripts/boundary/entries.json, "host") */
|
|
3
5
|
export const PERMISSIONS_POLICY = 'camera=(), microphone=(), geolocation=(), payment=(), usb=(), serial=(), bluetooth=(), hid=(), midi=(), ' +
|
|
4
6
|
'magnetometer=(), gyroscope=(), accelerometer=(), display-capture=(), browsing-topics=()';
|
|
5
7
|
/** A year, and the names under this one: the time browsers ask of a name kept on https. */
|
|
@@ -11,5 +11,8 @@ export declare const ROBOTS_PATH = "/robots.txt";
|
|
|
11
11
|
export declare function sendText(req: IncomingMessage, res: ServerResponse, status: number, type: string, body: string): true;
|
|
12
12
|
/** True when `path` is a crawler's question: answered as a GET or HEAD only. */
|
|
13
13
|
export declare function crawlerAsks(req: IncomingMessage, res: ServerResponse, path: string): boolean;
|
|
14
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* The answer of a server with nothing public: crawl nothing, list nothing. False for any other address.
|
|
16
|
+
* @public the database browser's (scripts/boundary/entries.json, "host")
|
|
17
|
+
*/
|
|
15
18
|
export declare function closedToCrawlers(req: IncomingMessage, res: ServerResponse, path: string): boolean;
|
|
@@ -20,7 +20,10 @@ export function crawlerAsks(req, res, path) {
|
|
|
20
20
|
}
|
|
21
21
|
return false;
|
|
22
22
|
}
|
|
23
|
-
/**
|
|
23
|
+
/**
|
|
24
|
+
* The answer of a server with nothing public: crawl nothing, list nothing. False for any other address.
|
|
25
|
+
* @public the database browser's (scripts/boundary/entries.json, "host")
|
|
26
|
+
*/
|
|
24
27
|
export function closedToCrawlers(req, res, path) {
|
|
25
28
|
if (path !== ROBOTS_PATH && path !== SITEMAP_PATH)
|
|
26
29
|
return false;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { PostContext } from './context.js';
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Why this request cannot try an API, or undefined when it can.
|
|
4
|
+
* @public the database browser's (scripts/boundary/entries.json, "host")
|
|
5
|
+
*/
|
|
3
6
|
export declare function operationRefusal(request: {
|
|
4
7
|
appConfigured: boolean;
|
|
5
8
|
dialect: string;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { send } from './reply.js';
|
|
2
2
|
const DESCRIBE = '/api/http/operations';
|
|
3
3
|
const TRY = '/api/http/operation';
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* Why this request cannot try an API, or undefined when it can.
|
|
6
|
+
* @public the database browser's (scripts/boundary/entries.json, "host")
|
|
7
|
+
*/
|
|
5
8
|
export function operationRefusal(request) {
|
|
6
9
|
if (request.appConfigured)
|
|
7
10
|
return { status: 403, error: 'Trying an API is part of the database browser; an application does not offer it.' };
|
|
@@ -116,6 +116,7 @@ export declare class HttpError extends Error {
|
|
|
116
116
|
* reads `.error` showed a blank message on exactly the endpoints where the
|
|
117
117
|
* message mattered most. Both are sent — the list stays the shape the view
|
|
118
118
|
* editor reads, and `error` is the first of them.
|
|
119
|
+
* @public the database browser's (scripts/boundary/entries.json, "host")
|
|
119
120
|
*/
|
|
120
121
|
export declare function refuse(res: ServerResponse, status: number, messages: string[]): void;
|
|
121
122
|
/**
|
|
@@ -330,6 +330,7 @@ export class HttpError extends Error {
|
|
|
330
330
|
* reads `.error` showed a blank message on exactly the endpoints where the
|
|
331
331
|
* message mattered most. Both are sent — the list stays the shape the view
|
|
332
332
|
* editor reads, and `error` is the first of them.
|
|
333
|
+
* @public the database browser's (scripts/boundary/entries.json, "host")
|
|
333
334
|
*/
|
|
334
335
|
export function refuse(res, status, messages) {
|
|
335
336
|
send(res, status, {
|
|
@@ -60,6 +60,7 @@ export declare function parseTrustedProxies(values: readonly string[]): {
|
|
|
60
60
|
* it is a peer whose `X-Forwarded-For` the limiter may read; with the `--auth-proxy-from` list (`Bound.identityProxies`)
|
|
61
61
|
* it is a peer whose `--auth-proxy-header` value `identityFor` believes. The two lists are never swapped: one
|
|
62
62
|
* grants a client address, the other a person.
|
|
63
|
+
* @public the database browser's (scripts/boundary/entries.json, "host")
|
|
63
64
|
*/
|
|
64
65
|
export declare function trustedProxyPeer(address: string | undefined, trusted?: readonly ProxyRange[]): boolean;
|
|
65
66
|
/** Whether a public address (MISTRI_PUBLIC_URL) is an https one: what `ServerSettings.httpsFront` is set from. */
|
|
@@ -136,6 +136,7 @@ function inRange(groups, range) {
|
|
|
136
136
|
* it is a peer whose `X-Forwarded-For` the limiter may read; with the `--auth-proxy-from` list (`Bound.identityProxies`)
|
|
137
137
|
* it is a peer whose `--auth-proxy-header` value `identityFor` believes. The two lists are never swapped: one
|
|
138
138
|
* grants a client address, the other a person.
|
|
139
|
+
* @public the database browser's (scripts/boundary/entries.json, "host")
|
|
139
140
|
*/
|
|
140
141
|
export function trustedProxyPeer(address, trusted = []) {
|
|
141
142
|
if (loopbackPeer(address))
|
package/dist/server/product.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Which product this process is: the database browser (`tablewalk`) or the App framework (`mistri`). The engine is
|
|
3
3
|
* both binaries', and what an operator sets is said in the binary's own name: `TABLEWALK_READ_POOL` for the
|
|
4
4
|
* browser, `MISTRI_READ_POOL` for an App, read by the same code here. Each main says which it is before it reads a
|
|
5
|
-
* flag (packages/
|
|
5
|
+
* flag (packages/mistri/src/server/cli/mistriMain.ts here, the database browser's main in its own repository); anything
|
|
6
6
|
* else that runs the engine — an App mounted in a host's server (`createHandler`), a test — is an App's.
|
|
7
7
|
*
|
|
8
8
|
* Only the variables both binaries read go through here. A variable one product alone reads names itself.
|
|
@@ -98,7 +98,8 @@ export declare function recordedImport(options: RecordWriteOptions, inputs: read
|
|
|
98
98
|
*/
|
|
99
99
|
export declare function recordedDelete(options: RecordWriteOptions, input: DeleteRequest, dependents?: Dependents): Promise<Recorded<DeleteResult>>;
|
|
100
100
|
/** The incoming references a deletion of `table` would change rows through:
|
|
101
|
-
* every rule but a refusal, an unreported one included.
|
|
101
|
+
* every rule but a refusal, an unreported one included.
|
|
102
|
+
* @public the database browser's (scripts/boundary/entries.json, "host") */
|
|
102
103
|
export declare function changingReferences(schema: DatabaseSchema, table: string): ForeignKey[];
|
|
103
104
|
/**
|
|
104
105
|
* A deletion's dependents read off the database's own catalog, never an
|
|
@@ -303,7 +303,8 @@ async function touchesDependents(tx, key, dependents) {
|
|
|
303
303
|
return false;
|
|
304
304
|
}
|
|
305
305
|
/** The incoming references a deletion of `table` would change rows through:
|
|
306
|
-
* every rule but a refusal, an unreported one included.
|
|
306
|
+
* every rule but a refusal, an unreported one included.
|
|
307
|
+
* @public the database browser's (scripts/boundary/entries.json, "host") */
|
|
307
308
|
export function changingReferences(schema, table) {
|
|
308
309
|
return referencesTo(schema, table).filter((fk) => !fk.declared && fk.onDelete !== 'restrict' && fk.onDelete !== 'no action');
|
|
309
310
|
}
|
|
@@ -68,6 +68,7 @@ export declare function dispatchResourceReadHttp(path: string, body: Record<stri
|
|
|
68
68
|
* The adapter picks its own style when it runs the statement; this is the
|
|
69
69
|
* copy the user reads, and it has to agree with what actually ran or the
|
|
70
70
|
* panel is teaching the wrong thing.
|
|
71
|
+
* @public the database browser's (scripts/boundary/entries.json, "host")
|
|
71
72
|
*/
|
|
72
73
|
export declare function styleFor(schema: DatabaseSchema): SqlStyle;
|
|
73
74
|
/**
|
|
@@ -561,6 +561,7 @@ async function runViewForBar(adapter, schema, view, body, app, countMode = 'exac
|
|
|
561
561
|
* The adapter picks its own style when it runs the statement; this is the
|
|
562
562
|
* copy the user reads, and it has to agree with what actually ran or the
|
|
563
563
|
* panel is teaching the wrong thing.
|
|
564
|
+
* @public the database browser's (scripts/boundary/entries.json, "host")
|
|
564
565
|
*/
|
|
565
566
|
export function styleFor(schema) {
|
|
566
567
|
if (schema.dialect === 'postgres')
|
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.13",
|
|
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": {
|
|
@@ -29,6 +29,9 @@
|
|
|
29
29
|
"./adapters/connect.js": "./dist/adapters/connect.js",
|
|
30
30
|
"./adapters/connectionBudget.js": "./dist/adapters/connectionBudget.js",
|
|
31
31
|
"./adapters/http/egress.js": "./dist/adapters/http/egress.js",
|
|
32
|
+
"./adapters/http/httpAdapter.js": "./dist/adapters/http/httpAdapter.js",
|
|
33
|
+
"./adapters/http/httpDescription.js": "./dist/adapters/http/httpDescription.js",
|
|
34
|
+
"./adapters/http/openapi.js": "./dist/adapters/http/openapi.js",
|
|
32
35
|
"./adapters/layoutRefusal.js": "./dist/adapters/layoutRefusal.js",
|
|
33
36
|
"./adapters/net/networkPolicy.js": "./dist/adapters/net/networkPolicy.js",
|
|
34
37
|
"./adapters/net/untrustedDatabase.js": "./dist/adapters/net/untrustedDatabase.js",
|