@nanobpm/urban 0.6.0 → 0.7.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/dist/runtime/core/host.d.ts +4 -0
- package/dist/runtime/core/manifest.d.ts +8 -0
- package/dist/runtime/core/modules/gateway.d.ts +2 -0
- package/dist/runtime/core/modules/gateway.js +2 -1
- package/dist/runtime/core/modules/pages.d.ts +42 -0
- package/dist/runtime/core/modules/pages.js +670 -0
- package/dist/runtime/core/modules/surfaces.js +7 -0
- package/dist/runtime/engine/nanosdk.d.ts +6 -0
- package/dist/runtime/engine/nanosdk.js +3 -0
- package/dist/runtime/index.d.ts +2 -0
- package/dist/runtime/index.js +1 -0
- package/package.json +1 -1
- package/src/runtime/core/host.ts +2 -0
- package/src/runtime/core/manifest.ts +8 -0
- package/src/runtime/core/modules/gateway.ts +2 -1
- package/src/runtime/core/modules/pages.test.ts +224 -0
- package/src/runtime/core/modules/pages.ts +705 -0
- package/src/runtime/core/modules/surfaces.ts +8 -0
- package/src/runtime/core/runtime.test.ts +4 -0
- package/src/runtime/engine/nanosdk.test.ts +18 -0
- package/src/runtime/engine/nanosdk.ts +8 -0
- package/src/runtime/index.ts +2 -0
|
@@ -99,6 +99,10 @@ export interface EngineClient {
|
|
|
99
99
|
processInstanceKey: string;
|
|
100
100
|
variables?: Record<string, unknown>;
|
|
101
101
|
}>;
|
|
102
|
+
/** Cancel a running process instance (the pages surface's row-cancel action). */
|
|
103
|
+
cancelInstance(input: {
|
|
104
|
+
processInstanceKey: string;
|
|
105
|
+
}): Promise<void>;
|
|
102
106
|
/** Publish a message for correlation. */
|
|
103
107
|
publishMessage(input: {
|
|
104
108
|
name: string;
|
|
@@ -36,6 +36,14 @@ export interface SurfaceDecl {
|
|
|
36
36
|
enabled?: boolean;
|
|
37
37
|
path?: string;
|
|
38
38
|
agent?: string;
|
|
39
|
+
/** pages surface: directory of `*.page.json` (relative to app root). Default `pages`. */
|
|
40
|
+
pagesDir?: string;
|
|
41
|
+
/** pages surface: the page served at `/`. Default `home`. */
|
|
42
|
+
homePage?: string;
|
|
43
|
+
/** pages surface: max rows a `dataGrid` fetch returns. Default 200. */
|
|
44
|
+
rowLimit?: number;
|
|
45
|
+
/** pages surface: the injected default datasource name. Default `app`. */
|
|
46
|
+
sourceName?: string;
|
|
39
47
|
}
|
|
40
48
|
export interface AppManifest {
|
|
41
49
|
$schema?: string;
|
|
@@ -47,6 +47,8 @@ export interface DataSource {
|
|
|
47
47
|
* (default "id"). */
|
|
48
48
|
table<T extends object = Row>(name: string, pk?: string): Table<T>;
|
|
49
49
|
}
|
|
50
|
+
/** Double-quote a SQL identifier (table/column), escaping embedded quotes. */
|
|
51
|
+
export declare function quoteIdent(name: string): string;
|
|
50
52
|
/** A typed gateway over a single table — the record-oriented data object a handler binds to
|
|
51
53
|
* instead of hand-writing SQL (the Delphi `TTable`/data-module idea, ADR 0029 §6). It builds
|
|
52
54
|
* parameterised SQL from a typed row object's own keys, so callers manipulate rows as records.
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
// const orders = db.table<Order>("orders"); // a typed gateway over one table
|
|
12
12
|
// await orders.insert({ id, status: "new" });
|
|
13
13
|
// const o = await orders.get(id);
|
|
14
|
-
|
|
14
|
+
/** Double-quote a SQL identifier (table/column), escaping embedded quotes. */
|
|
15
|
+
export function quoteIdent(name) {
|
|
15
16
|
return `"${name.replaceAll('"', '""')}"`;
|
|
16
17
|
}
|
|
17
18
|
/** Build a parameterised ` WHERE a = ? AND b = ?` clause from an equality map; an empty map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { AppApi, RuntimeContext } from "../context.ts";
|
|
2
|
+
import type { EngineClient } from "../host.ts";
|
|
3
|
+
import { type Route } from "../router.ts";
|
|
4
|
+
/** The subset of the datasource gateway the page runtime needs. */
|
|
5
|
+
export interface PagesDataSource {
|
|
6
|
+
query(sql: string, params?: unknown[]): Promise<Record<string, unknown>[]>;
|
|
7
|
+
schema(): Promise<{
|
|
8
|
+
name: string;
|
|
9
|
+
}[]>;
|
|
10
|
+
}
|
|
11
|
+
export interface PagesOptions {
|
|
12
|
+
/** Directory holding `*.page.json` (relative to the app root). Default `pages`. */
|
|
13
|
+
pagesDir?: string;
|
|
14
|
+
/** The page served at `/`. Default `home`. */
|
|
15
|
+
homePage?: string;
|
|
16
|
+
/** Max rows a `dataGrid` fetch returns. Default 200. */
|
|
17
|
+
rowLimit?: number;
|
|
18
|
+
/** The injected default datasource name (the alias apps bind to). Default `app`. */
|
|
19
|
+
sourceName?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface PagesDeps {
|
|
22
|
+
db: PagesDataSource;
|
|
23
|
+
engine: EngineClient;
|
|
24
|
+
/** Read a page file; injectable for tests. */
|
|
25
|
+
readPage(path: string): Promise<string>;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Build the page-runtime routes over an injected datasource + engine. Pure over its deps
|
|
29
|
+
* so it is unit-testable without a real host/server (see pages.test.ts).
|
|
30
|
+
*/
|
|
31
|
+
export declare function createPagesRoutes(opts: PagesOptions, deps: PagesDeps): Route[];
|
|
32
|
+
export interface PagesHandle {
|
|
33
|
+
readonly name: string;
|
|
34
|
+
routes: Route[];
|
|
35
|
+
describe(): Record<string, unknown>;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Mount the `pages` surface when enabled in the manifest. Binds the page runtime to the
|
|
39
|
+
* app's datasource gateway (`app.data.open(source)`), engine, and the host's file read.
|
|
40
|
+
* Returns no routes when the surface is disabled or absent.
|
|
41
|
+
*/
|
|
42
|
+
export declare function mountPages(ctx: RuntimeContext, app: AppApi): PagesHandle;
|