@niscorp/moss 0.8.1 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +31 -0
- package/DOCS.md +87 -26
- package/README.md +9 -8
- package/dist/{chunk-3DCTQKPQ.cjs → chunk-E6YAYR7G.cjs} +22 -5
- package/dist/chunk-E6YAYR7G.cjs.map +1 -0
- package/dist/{chunk-TMDKNZYL.cjs → chunk-L2GHVTJW.cjs} +103 -71
- package/dist/chunk-L2GHVTJW.cjs.map +1 -0
- package/dist/{chunk-I4UOWER3.cjs → chunk-LKTS4PCD.cjs} +5 -5
- package/dist/{chunk-I4UOWER3.cjs.map → chunk-LKTS4PCD.cjs.map} +1 -1
- package/dist/{chunk-3T422CCN.js → chunk-UUOATPZ7.js} +3 -3
- package/dist/{chunk-3T422CCN.js.map → chunk-UUOATPZ7.js.map} +1 -1
- package/dist/{chunk-6XC2MD7S.js → chunk-WTWRLOPK.js} +22 -5
- package/dist/chunk-WTWRLOPK.js.map +1 -0
- package/dist/{chunk-YZILOVCR.js → chunk-Y7PRASR3.js} +49 -18
- package/dist/chunk-Y7PRASR3.js.map +1 -0
- package/dist/{document-BYAY-Qle.d.ts → document-C3aS9uiW.d.ts} +2 -1
- package/dist/{document-DAE71J27.d.cts → document-deAs7Dre.d.cts} +2 -1
- package/dist/index.cjs +17 -13
- package/dist/index.d.cts +8 -5
- package/dist/index.d.ts +8 -5
- package/dist/index.js +2 -2
- package/dist/integrations.cjs +12 -5
- package/dist/integrations.cjs.map +1 -1
- package/dist/integrations.js +12 -5
- package/dist/integrations.js.map +1 -1
- package/dist/node.cjs +7 -7
- package/dist/node.d.cts +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/node.js +3 -3
- package/dist/unverified.cjs +2 -2
- package/dist/unverified.js +1 -1
- package/dist/vite.cjs +8 -8
- package/dist/vite.d.cts +1 -1
- package/dist/vite.d.ts +1 -1
- package/dist/vite.js +3 -3
- package/package.json +12 -12
- package/dist/chunk-3DCTQKPQ.cjs.map +0 -1
- package/dist/chunk-6XC2MD7S.js.map +0 -1
- package/dist/chunk-TMDKNZYL.cjs.map +0 -1
- package/dist/chunk-YZILOVCR.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Hono } from 'hono';
|
|
2
2
|
import { Charter, VerifyReport } from '@niscorp/charter';
|
|
3
|
-
import { Shell, FetchFn, LayoutNode, ActionDefinition, CanvasConfig, ActionFragment, FunctionDefinition, FunctionHandler, RenderNode } from '@niscorp/nova';
|
|
3
|
+
import { Shell, FetchFn, LayoutNode, ActionDefinition, CanvasConfig, ActionFragment, FunctionDefinition, FunctionHandler, Reconciler, RenderNode } from '@niscorp/nova';
|
|
4
4
|
import { GenerateDsl, MapToShape, QueryResponse, ScopeBehaviors, SeedEntry, SeedMutation, ScopePolicy } from '@niscorp/vex';
|
|
5
5
|
import { Sequence } from '@niscorp/strata';
|
|
6
6
|
import { Phrasebook, PhraseKeys } from '@niscorp/nova/i18n';
|
|
@@ -63,6 +63,7 @@ type NiscApp = {
|
|
|
63
63
|
functions?: (session: FunctionSession) => WrittenFunctions;
|
|
64
64
|
onSession?: (session: FunctionSession) => void;
|
|
65
65
|
runs?: RunSink;
|
|
66
|
+
reconcilers?: Record<string, Reconciler>;
|
|
66
67
|
reactions?: readonly {
|
|
67
68
|
table: string;
|
|
68
69
|
op?: 'insert' | 'update' | 'delete';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Hono } from 'hono';
|
|
2
2
|
import { Charter, VerifyReport } from '@niscorp/charter';
|
|
3
|
-
import { Shell, FetchFn, LayoutNode, ActionDefinition, CanvasConfig, ActionFragment, FunctionDefinition, FunctionHandler, RenderNode } from '@niscorp/nova';
|
|
3
|
+
import { Shell, FetchFn, LayoutNode, ActionDefinition, CanvasConfig, ActionFragment, FunctionDefinition, FunctionHandler, Reconciler, RenderNode } from '@niscorp/nova';
|
|
4
4
|
import { GenerateDsl, MapToShape, QueryResponse, ScopeBehaviors, SeedEntry, SeedMutation, ScopePolicy } from '@niscorp/vex';
|
|
5
5
|
import { Sequence } from '@niscorp/strata';
|
|
6
6
|
import { Phrasebook, PhraseKeys } from '@niscorp/nova/i18n';
|
|
@@ -63,6 +63,7 @@ type NiscApp = {
|
|
|
63
63
|
functions?: (session: FunctionSession) => WrittenFunctions;
|
|
64
64
|
onSession?: (session: FunctionSession) => void;
|
|
65
65
|
runs?: RunSink;
|
|
66
|
+
reconcilers?: Record<string, Reconciler>;
|
|
66
67
|
reactions?: readonly {
|
|
67
68
|
table: string;
|
|
68
69
|
op?: 'insert' | 'update' | 'delete';
|
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkL2GHVTJW_cjs = require('./chunk-L2GHVTJW.cjs');
|
|
4
|
+
var chunkE6YAYR7G_cjs = require('./chunk-E6YAYR7G.cjs');
|
|
5
5
|
require('./chunk-PVZMCEBX.cjs');
|
|
6
6
|
require('./chunk-3RIWTXGI.cjs');
|
|
7
7
|
|
|
@@ -9,47 +9,51 @@ require('./chunk-3RIWTXGI.cjs');
|
|
|
9
9
|
|
|
10
10
|
Object.defineProperty(exports, "MOSS_SEQUENCE", {
|
|
11
11
|
enumerable: true,
|
|
12
|
-
get: function () { return
|
|
12
|
+
get: function () { return chunkL2GHVTJW_cjs.MOSS_SEQUENCE; }
|
|
13
13
|
});
|
|
14
14
|
Object.defineProperty(exports, "createServer", {
|
|
15
15
|
enumerable: true,
|
|
16
|
-
get: function () { return
|
|
16
|
+
get: function () { return chunkL2GHVTJW_cjs.createServer; }
|
|
17
17
|
});
|
|
18
18
|
Object.defineProperty(exports, "exportDocuments", {
|
|
19
19
|
enumerable: true,
|
|
20
|
-
get: function () { return
|
|
20
|
+
get: function () { return chunkL2GHVTJW_cjs.exportDocuments; }
|
|
21
21
|
});
|
|
22
22
|
Object.defineProperty(exports, "migrateTables", {
|
|
23
23
|
enumerable: true,
|
|
24
|
-
get: function () { return
|
|
24
|
+
get: function () { return chunkL2GHVTJW_cjs.migrateTables; }
|
|
25
25
|
});
|
|
26
26
|
Object.defineProperty(exports, "mintDevToken", {
|
|
27
27
|
enumerable: true,
|
|
28
|
-
get: function () { return
|
|
28
|
+
get: function () { return chunkL2GHVTJW_cjs.mintDevToken; }
|
|
29
29
|
});
|
|
30
30
|
Object.defineProperty(exports, "mintSession", {
|
|
31
31
|
enumerable: true,
|
|
32
|
-
get: function () { return
|
|
32
|
+
get: function () { return chunkL2GHVTJW_cjs.mintSession; }
|
|
33
33
|
});
|
|
34
34
|
Object.defineProperty(exports, "renderDocument", {
|
|
35
35
|
enumerable: true,
|
|
36
|
-
get: function () { return
|
|
36
|
+
get: function () { return chunkL2GHVTJW_cjs.renderDocument; }
|
|
37
37
|
});
|
|
38
38
|
Object.defineProperty(exports, "revokeAllFor", {
|
|
39
39
|
enumerable: true,
|
|
40
|
-
get: function () { return
|
|
40
|
+
get: function () { return chunkL2GHVTJW_cjs.revokeAllFor; }
|
|
41
41
|
});
|
|
42
42
|
Object.defineProperty(exports, "sessionCookies", {
|
|
43
43
|
enumerable: true,
|
|
44
|
-
get: function () { return
|
|
44
|
+
get: function () { return chunkL2GHVTJW_cjs.sessionCookies; }
|
|
45
|
+
});
|
|
46
|
+
Object.defineProperty(exports, "tableStatus", {
|
|
47
|
+
enumerable: true,
|
|
48
|
+
get: function () { return chunkL2GHVTJW_cjs.tableStatus; }
|
|
45
49
|
});
|
|
46
50
|
Object.defineProperty(exports, "defineApp", {
|
|
47
51
|
enumerable: true,
|
|
48
|
-
get: function () { return
|
|
52
|
+
get: function () { return chunkE6YAYR7G_cjs.defineApp; }
|
|
49
53
|
});
|
|
50
54
|
Object.defineProperty(exports, "verifyApp", {
|
|
51
55
|
enumerable: true,
|
|
52
|
-
get: function () { return
|
|
56
|
+
get: function () { return chunkE6YAYR7G_cjs.verifyApp; }
|
|
53
57
|
});
|
|
54
58
|
//# sourceMappingURL=index.cjs.map
|
|
55
59
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.d.cts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { N as NiscApp, M as MossServer, D as DocumentConfig } from './document-
|
|
2
|
-
export { a as DrawnDocument, E as ExecuteAs, F as FunctionSession, I as IdentityRecord, L as LayoutVariant, P as PageManifest, R as RunRecord, b as RunSink, c as RunTurn, S as ShellHost, d as ShellManifest, e as ShellSnapshot, f as defineApp, r as renderDocument } from './document-
|
|
1
|
+
import { N as NiscApp, M as MossServer, D as DocumentConfig } from './document-deAs7Dre.cjs';
|
|
2
|
+
export { a as DrawnDocument, E as ExecuteAs, F as FunctionSession, I as IdentityRecord, L as LayoutVariant, P as PageManifest, R as RunRecord, b as RunSink, c as RunTurn, S as ShellHost, d as ShellManifest, e as ShellSnapshot, f as defineApp, r as renderDocument } from './document-deAs7Dre.cjs';
|
|
3
3
|
import { VerifyReport } from '@niscorp/charter';
|
|
4
4
|
import { PgPool } from '@niscorp/vex';
|
|
5
5
|
import { N as NiscRuntime } from './index-CSEo7Tys.cjs';
|
|
6
6
|
export { T as Telemetry, a as TelemetrySpan } from './index-CSEo7Tys.cjs';
|
|
7
7
|
import { MigrateReport } from '@niscorp/strata/postgres';
|
|
8
|
+
import { Plan, Sequence } from '@niscorp/strata';
|
|
8
9
|
export { FunctionDefinition } from '@niscorp/nova';
|
|
9
|
-
import { Sequence } from '@niscorp/strata';
|
|
10
10
|
import { ScreenHead } from '@niscorp/nova/document';
|
|
11
11
|
import 'hono';
|
|
12
12
|
import '@niscorp/nova/i18n';
|
|
@@ -39,8 +39,11 @@ type TablesReport = MigrateReport & {
|
|
|
39
39
|
retyped: readonly string[];
|
|
40
40
|
alreadyBroken: readonly string[];
|
|
41
41
|
};
|
|
42
|
-
|
|
42
|
+
type TablesRuntime = Pick<NiscRuntime, 'pool' | 'cache' | 'session' | 'tables'>;
|
|
43
|
+
declare const tableStatus: (runtime: TablesRuntime, app: Pick<NiscApp, "features">) => Promise<Plan>;
|
|
44
|
+
declare const migrateTables: (runtime: TablesRuntime, app: Pick<NiscApp, "entries" | "features">, options?: {
|
|
43
45
|
dryRun?: boolean;
|
|
46
|
+
allowRemoval?: boolean;
|
|
44
47
|
}) => Promise<TablesReport>;
|
|
45
48
|
|
|
46
49
|
declare const MOSS_SEQUENCE: Sequence;
|
|
@@ -62,4 +65,4 @@ declare const exportDocuments: (config: Omit<DocumentConfig, "request"> & {
|
|
|
62
65
|
paths: readonly string[];
|
|
63
66
|
}) => Promise<ExportedDocument[]>;
|
|
64
67
|
|
|
65
|
-
export { DocumentConfig, type ExportedDocument, MOSS_SEQUENCE, MossServer, NiscApp, NiscRuntime, createServer, exportDocuments, migrateTables, mintDevToken, mintSession, revokeAllFor, sessionCookies, verifyApp };
|
|
68
|
+
export { DocumentConfig, type ExportedDocument, MOSS_SEQUENCE, MossServer, NiscApp, NiscRuntime, createServer, exportDocuments, migrateTables, mintDevToken, mintSession, revokeAllFor, sessionCookies, tableStatus, verifyApp };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { N as NiscApp, M as MossServer, D as DocumentConfig } from './document-
|
|
2
|
-
export { a as DrawnDocument, E as ExecuteAs, F as FunctionSession, I as IdentityRecord, L as LayoutVariant, P as PageManifest, R as RunRecord, b as RunSink, c as RunTurn, S as ShellHost, d as ShellManifest, e as ShellSnapshot, f as defineApp, r as renderDocument } from './document-
|
|
1
|
+
import { N as NiscApp, M as MossServer, D as DocumentConfig } from './document-C3aS9uiW.js';
|
|
2
|
+
export { a as DrawnDocument, E as ExecuteAs, F as FunctionSession, I as IdentityRecord, L as LayoutVariant, P as PageManifest, R as RunRecord, b as RunSink, c as RunTurn, S as ShellHost, d as ShellManifest, e as ShellSnapshot, f as defineApp, r as renderDocument } from './document-C3aS9uiW.js';
|
|
3
3
|
import { VerifyReport } from '@niscorp/charter';
|
|
4
4
|
import { PgPool } from '@niscorp/vex';
|
|
5
5
|
import { N as NiscRuntime } from './index-CSEo7Tys.js';
|
|
6
6
|
export { T as Telemetry, a as TelemetrySpan } from './index-CSEo7Tys.js';
|
|
7
7
|
import { MigrateReport } from '@niscorp/strata/postgres';
|
|
8
|
+
import { Plan, Sequence } from '@niscorp/strata';
|
|
8
9
|
export { FunctionDefinition } from '@niscorp/nova';
|
|
9
|
-
import { Sequence } from '@niscorp/strata';
|
|
10
10
|
import { ScreenHead } from '@niscorp/nova/document';
|
|
11
11
|
import 'hono';
|
|
12
12
|
import '@niscorp/nova/i18n';
|
|
@@ -39,8 +39,11 @@ type TablesReport = MigrateReport & {
|
|
|
39
39
|
retyped: readonly string[];
|
|
40
40
|
alreadyBroken: readonly string[];
|
|
41
41
|
};
|
|
42
|
-
|
|
42
|
+
type TablesRuntime = Pick<NiscRuntime, 'pool' | 'cache' | 'session' | 'tables'>;
|
|
43
|
+
declare const tableStatus: (runtime: TablesRuntime, app: Pick<NiscApp, "features">) => Promise<Plan>;
|
|
44
|
+
declare const migrateTables: (runtime: TablesRuntime, app: Pick<NiscApp, "entries" | "features">, options?: {
|
|
43
45
|
dryRun?: boolean;
|
|
46
|
+
allowRemoval?: boolean;
|
|
44
47
|
}) => Promise<TablesReport>;
|
|
45
48
|
|
|
46
49
|
declare const MOSS_SEQUENCE: Sequence;
|
|
@@ -62,4 +65,4 @@ declare const exportDocuments: (config: Omit<DocumentConfig, "request"> & {
|
|
|
62
65
|
paths: readonly string[];
|
|
63
66
|
}) => Promise<ExportedDocument[]>;
|
|
64
67
|
|
|
65
|
-
export { DocumentConfig, type ExportedDocument, MOSS_SEQUENCE, MossServer, NiscApp, NiscRuntime, createServer, exportDocuments, migrateTables, mintDevToken, mintSession, revokeAllFor, sessionCookies, verifyApp };
|
|
68
|
+
export { DocumentConfig, type ExportedDocument, MOSS_SEQUENCE, MossServer, NiscApp, NiscRuntime, createServer, exportDocuments, migrateTables, mintDevToken, mintSession, revokeAllFor, sessionCookies, tableStatus, verifyApp };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { MOSS_SEQUENCE, createServer, exportDocuments, migrateTables, mintDevToken, mintSession, renderDocument, revokeAllFor, sessionCookies } from './chunk-
|
|
2
|
-
export { defineApp, verifyApp } from './chunk-
|
|
1
|
+
export { MOSS_SEQUENCE, createServer, exportDocuments, migrateTables, mintDevToken, mintSession, renderDocument, revokeAllFor, sessionCookies, tableStatus } from './chunk-Y7PRASR3.js';
|
|
2
|
+
export { defineApp, verifyApp } from './chunk-WTWRLOPK.js';
|
|
3
3
|
import './chunk-QAHDSRPK.js';
|
|
4
4
|
import './chunk-4ZGAFZGS.js';
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
package/dist/integrations.cjs
CHANGED
|
@@ -408,6 +408,7 @@ var BundleSchema = zod.z.object({
|
|
|
408
408
|
extension: zod.z.unknown().optional()
|
|
409
409
|
}).strict();
|
|
410
410
|
var AUDIENCE = /^[a-z][a-z0-9-]*$/;
|
|
411
|
+
var VEX_ROUTE = /^\/api\/(?:[A-Za-z0-9_-]+\/)?vex$/;
|
|
411
412
|
var upgradeBundle = (payload, upgrader) => {
|
|
412
413
|
if (upgrader === void 0 || !reflect.isRecord(payload) || !reflect.isRecord(payload["actions"])) return { ok: true, payload };
|
|
413
414
|
const declared = payload["grammar"];
|
|
@@ -425,6 +426,13 @@ var upgradeBundle = (payload, upgrader) => {
|
|
|
425
426
|
};
|
|
426
427
|
}
|
|
427
428
|
};
|
|
429
|
+
var ownPathReasons = (endpoint, url, path, own) => {
|
|
430
|
+
if (path.includes("{{")) return [`${endpoint} calls "${url}", whose path is filled in when it is called: only the query, after "?", may hold a template`];
|
|
431
|
+
const resolved = new URL(path, "http://nisc.local").pathname;
|
|
432
|
+
if (resolved !== path) return [`${endpoint} calls "${url}", whose path resolves to "${resolved}": write it as it resolves, under ${own}`];
|
|
433
|
+
if (path.startsWith(`${own}hook/`)) return [`${endpoint} is under /hook/, which is the unauthenticated webhook path`];
|
|
434
|
+
return [];
|
|
435
|
+
};
|
|
428
436
|
var endpointReasons = (id, action, ctx) => {
|
|
429
437
|
const reasons = [];
|
|
430
438
|
for (const [name, endpoint] of Object.entries(action.endpoints ?? {})) {
|
|
@@ -434,13 +442,12 @@ var endpointReasons = (id, action, ctx) => {
|
|
|
434
442
|
}
|
|
435
443
|
const url = endpoint.url;
|
|
436
444
|
const own = `/integrations/${ctx.integrationId}/`;
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
}
|
|
445
|
+
const path = url.split("?")[0] ?? "";
|
|
446
|
+
if (path.startsWith(own)) {
|
|
447
|
+
reasons.push(...ownPathReasons(`action ${id}: endpoint "${name}"`, url, path, own));
|
|
441
448
|
continue;
|
|
442
449
|
}
|
|
443
|
-
if (!
|
|
450
|
+
if (!VEX_ROUTE.test(url)) {
|
|
444
451
|
reasons.push(`action ${id}: endpoint "${name}" calls "${url}" \u2014 only ${own}* or /api/*/vex`);
|
|
445
452
|
continue;
|
|
446
453
|
}
|