litedbmodel 2.0.1 → 2.1.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/decorators.d.ts.map +1 -1
- package/dist/decorators.js +44 -24
- package/dist/decorators.js.map +1 -1
- package/dist/drivers/mysql.d.ts.map +1 -1
- package/dist/drivers/mysql.js +6 -0
- package/dist/drivers/mysql.js.map +1 -1
- package/dist/drivers/postgres.d.ts.map +1 -1
- package/dist/drivers/postgres.js +7 -0
- package/dist/drivers/postgres.js.map +1 -1
- package/dist/drivers/sqlite.d.ts +2 -0
- package/dist/drivers/sqlite.d.ts.map +1 -1
- package/dist/drivers/sqlite.js +37 -2
- package/dist/drivers/sqlite.js.map +1 -1
- package/dist/scp/authoring.d.ts +66 -3
- package/dist/scp/authoring.d.ts.map +1 -1
- package/dist/scp/authoring.js +194 -5
- package/dist/scp/authoring.js.map +1 -1
- package/dist/scp/catalog.d.ts +6 -2
- package/dist/scp/catalog.d.ts.map +1 -1
- package/dist/scp/catalog.js +17 -2
- package/dist/scp/catalog.js.map +1 -1
- package/dist/scp/codegen.d.ts +132 -26
- package/dist/scp/codegen.d.ts.map +1 -1
- package/dist/scp/codegen.js +546 -35
- package/dist/scp/codegen.js.map +1 -1
- package/dist/scp/coltype.d.ts +124 -0
- package/dist/scp/coltype.d.ts.map +1 -0
- package/dist/scp/coltype.js +408 -0
- package/dist/scp/coltype.js.map +1 -0
- package/dist/scp/dialect.d.ts +12 -3
- package/dist/scp/dialect.d.ts.map +1 -1
- package/dist/scp/dialect.js +12 -3
- package/dist/scp/dialect.js.map +1 -1
- package/dist/scp/fragment/assemble.d.ts.map +1 -1
- package/dist/scp/fragment/assemble.js +10 -2
- package/dist/scp/fragment/assemble.js.map +1 -1
- package/dist/scp/fragment/compile-pg.js +4 -4
- package/dist/scp/guard.d.ts +1 -1
- package/dist/scp/guard.d.ts.map +1 -1
- package/dist/scp/guard.js +6 -0
- package/dist/scp/guard.js.map +1 -1
- package/dist/scp/index.cjs +10003 -4917
- package/dist/scp/index.d.ts +8 -5
- package/dist/scp/index.d.ts.map +1 -1
- package/dist/scp/index.js +35 -9
- package/dist/scp/index.js.map +1 -1
- package/dist/scp/index.mjs +1343 -213
- package/dist/scp/makesql/authoring-compile.d.ts.map +1 -1
- package/dist/scp/makesql/authoring-compile.js +11 -0
- package/dist/scp/makesql/authoring-compile.js.map +1 -1
- package/dist/scp/makesql/compile-select.d.ts +8 -1
- package/dist/scp/makesql/compile-select.d.ts.map +1 -1
- package/dist/scp/makesql/compile-select.js +1 -1
- package/dist/scp/makesql/compile-select.js.map +1 -1
- package/dist/scp/makesql/index.d.ts +2 -3
- package/dist/scp/makesql/index.d.ts.map +1 -1
- package/dist/scp/makesql/index.js +6 -6
- package/dist/scp/makesql/index.js.map +1 -1
- package/dist/scp/makesql/json-batch.d.ts.map +1 -1
- package/dist/scp/makesql/json-batch.js +6 -1
- package/dist/scp/makesql/json-batch.js.map +1 -1
- package/dist/scp/makesql/outtype.d.ts +99 -0
- package/dist/scp/makesql/outtype.d.ts.map +1 -0
- package/dist/scp/makesql/outtype.js +328 -0
- package/dist/scp/makesql/outtype.js.map +1 -0
- package/dist/scp/makesql/pool-executor.d.ts +70 -0
- package/dist/scp/makesql/pool-executor.d.ts.map +1 -1
- package/dist/scp/makesql/pool-executor.js +73 -5
- package/dist/scp/makesql/pool-executor.js.map +1 -1
- package/dist/scp/makesql/static-bundle.d.ts +41 -30
- package/dist/scp/makesql/static-bundle.d.ts.map +1 -1
- package/dist/scp/makesql/static-bundle.js +351 -131
- package/dist/scp/makesql/static-bundle.js.map +1 -1
- package/dist/scp/makesql/tx.d.ts +1 -1
- package/dist/scp/makesql/tx.d.ts.map +1 -1
- package/dist/scp/makesql/tx.js +48 -3
- package/dist/scp/makesql/tx.js.map +1 -1
- package/dist/scp/makesql/writeouttype.d.ts +65 -0
- package/dist/scp/makesql/writeouttype.d.ts.map +1 -0
- package/dist/scp/makesql/writeouttype.js +194 -0
- package/dist/scp/makesql/writeouttype.js.map +1 -0
- package/dist/scp/relation.d.ts +15 -1
- package/dist/scp/relation.d.ts.map +1 -1
- package/dist/scp/relation.js +61 -2
- package/dist/scp/relation.js.map +1 -1
- package/dist/scp/runtime.d.ts +17 -5
- package/dist/scp/runtime.d.ts.map +1 -1
- package/dist/scp/runtime.js +55 -14
- package/dist/scp/runtime.js.map +1 -1
- package/docs/BENCHMARK.md +58 -56
- package/docs/benchmark-chart.svg +166 -166
- package/docs/proposal/litedbmodel-v2-scp-architecture.md +51 -0
- package/package.json +8 -2
- package/dist/scp/makesql/ir.d.ts +0 -42
- package/dist/scp/makesql/ir.d.ts.map +0 -1
- package/dist/scp/makesql/ir.js +0 -66
- package/dist/scp/makesql/ir.js.map +0 -1
package/dist/scp/makesql/ir.d.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* litedbmodel v2 SCP — build a bc `ComponentGraphIR` whose single body node is a
|
|
3
|
-
* `makeSQL` componentRef, so a query rides bc's `runBehavior` (composition / value-eval
|
|
4
|
-
* / plan / envelope come free). The `makeSQL` ports are bc Expression IR: `sql` and
|
|
5
|
-
* `skip` are simple literals/refs; `params` is an `{ arr: [...] }` of Expression IR
|
|
6
|
-
* nodes (each a bound-value literal, an input ref, or a nested-`makeSQL` `{ obj: … }`).
|
|
7
|
-
*
|
|
8
|
-
* The bundle is pure JSON (multi-language ready). The handler (see `handler.ts`)
|
|
9
|
-
* assembles + binds + executes. bc validates the envelope and evaluates the ports.
|
|
10
|
-
*/
|
|
11
|
-
import type { ComponentGraphIR } from 'behavior-contracts';
|
|
12
|
-
import { type MakeSQL, type SqlParam, isMakeSQL } from './makesql';
|
|
13
|
-
/** Wrap a bound SQL value as a bc Expression IR literal node.
|
|
14
|
-
*
|
|
15
|
-
* bc's Expression IR represents ints as `{int:"…"}` and rejects bare `Date`/arrays.
|
|
16
|
-
* SQL bound values are opaque to bc, so we pass them as an inert `{lit}` marker that
|
|
17
|
-
* the handler unwraps — but since bc has no `lit` op, we instead carry the raw params
|
|
18
|
-
* OUT-OF-BAND: the IR references `input.params` by ref and the caller supplies the
|
|
19
|
-
* assembled params in the input scope. This keeps values byte-exact (no bc coercion).
|
|
20
|
-
*/
|
|
21
|
-
/**
|
|
22
|
-
* Build the single-`makeSQL` component IR + the input scope for a pre-assembled query.
|
|
23
|
-
*
|
|
24
|
-
* We keep SQL bound values OUT of bc's numeric/format coercion by binding them through
|
|
25
|
-
* the input scope: the `params` port is `{ ref: ["__sqlParams"] }` and the caller
|
|
26
|
-
* passes `{ __sqlParams: <the params array>, __sql: <text>, __skip: <bool> }` as input.
|
|
27
|
-
* bc evaluates the refs (returning the values verbatim), then hands them to the
|
|
28
|
-
* `makeSQL` handler, which assembles + binds + executes.
|
|
29
|
-
*/
|
|
30
|
-
export declare function makeSqlComponentIR(entry?: string): ComponentGraphIR;
|
|
31
|
-
/** The input scope for {@link makeSqlComponentIR}, from a compiled `makeSQL` bundle. */
|
|
32
|
-
export declare function makeSqlInput(node: MakeSQL): Record<string, unknown>;
|
|
33
|
-
/**
|
|
34
|
-
* bc's `evaluateExpression` rejects bare arrays / non-plain values as expressions, and
|
|
35
|
-
* the input scope is validated loosely (refs just read it). Because our params ride the
|
|
36
|
-
* scope as a plain `ref`, bc returns them verbatim (arrays, Dates, nested makeSQL
|
|
37
|
-
* objects) with NO coercion — exactly what the handler needs. `isMakeSQL` /
|
|
38
|
-
* `SqlParam` re-exported for callers building nested params.
|
|
39
|
-
*/
|
|
40
|
-
export { isMakeSQL };
|
|
41
|
-
export type { SqlParam };
|
|
42
|
-
//# sourceMappingURL=ir.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ir.d.ts","sourceRoot":"","sources":["../../../src/scp/makesql/ir.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAa,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAW,KAAK,OAAO,EAAE,KAAK,QAAQ,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE5E;;;;;;;GAOG;AAEH;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,SAAU,GAAG,gBAAgB,CAsBpE;AAED,wFAAwF;AACxF,wBAAgB,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAMnE;AAED;;;;;;GAMG;AACH,OAAO,EAAE,SAAS,EAAE,CAAC;AACrB,YAAY,EAAE,QAAQ,EAAE,CAAC"}
|
package/dist/scp/makesql/ir.js
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* litedbmodel v2 SCP — build a bc `ComponentGraphIR` whose single body node is a
|
|
4
|
-
* `makeSQL` componentRef, so a query rides bc's `runBehavior` (composition / value-eval
|
|
5
|
-
* / plan / envelope come free). The `makeSQL` ports are bc Expression IR: `sql` and
|
|
6
|
-
* `skip` are simple literals/refs; `params` is an `{ arr: [...] }` of Expression IR
|
|
7
|
-
* nodes (each a bound-value literal, an input ref, or a nested-`makeSQL` `{ obj: … }`).
|
|
8
|
-
*
|
|
9
|
-
* The bundle is pure JSON (multi-language ready). The handler (see `handler.ts`)
|
|
10
|
-
* assembles + binds + executes. bc validates the envelope and evaluates the ports.
|
|
11
|
-
*/
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.isMakeSQL = void 0;
|
|
14
|
-
exports.makeSqlComponentIR = makeSqlComponentIR;
|
|
15
|
-
exports.makeSqlInput = makeSqlInput;
|
|
16
|
-
const makesql_1 = require("./makesql");
|
|
17
|
-
Object.defineProperty(exports, "isMakeSQL", { enumerable: true, get: function () { return makesql_1.isMakeSQL; } });
|
|
18
|
-
/** Wrap a bound SQL value as a bc Expression IR literal node.
|
|
19
|
-
*
|
|
20
|
-
* bc's Expression IR represents ints as `{int:"…"}` and rejects bare `Date`/arrays.
|
|
21
|
-
* SQL bound values are opaque to bc, so we pass them as an inert `{lit}` marker that
|
|
22
|
-
* the handler unwraps — but since bc has no `lit` op, we instead carry the raw params
|
|
23
|
-
* OUT-OF-BAND: the IR references `input.params` by ref and the caller supplies the
|
|
24
|
-
* assembled params in the input scope. This keeps values byte-exact (no bc coercion).
|
|
25
|
-
*/
|
|
26
|
-
/**
|
|
27
|
-
* Build the single-`makeSQL` component IR + the input scope for a pre-assembled query.
|
|
28
|
-
*
|
|
29
|
-
* We keep SQL bound values OUT of bc's numeric/format coercion by binding them through
|
|
30
|
-
* the input scope: the `params` port is `{ ref: ["__sqlParams"] }` and the caller
|
|
31
|
-
* passes `{ __sqlParams: <the params array>, __sql: <text>, __skip: <bool> }` as input.
|
|
32
|
-
* bc evaluates the refs (returning the values verbatim), then hands them to the
|
|
33
|
-
* `makeSQL` handler, which assembles + binds + executes.
|
|
34
|
-
*/
|
|
35
|
-
function makeSqlComponentIR(entry = 'Query') {
|
|
36
|
-
const component = {
|
|
37
|
-
name: entry,
|
|
38
|
-
inputPorts: {
|
|
39
|
-
__sql: { type: 'string', required: true },
|
|
40
|
-
__sqlParams: { type: 'arr' },
|
|
41
|
-
__skip: { type: 'bool' },
|
|
42
|
-
},
|
|
43
|
-
body: [
|
|
44
|
-
{
|
|
45
|
-
id: 'q',
|
|
46
|
-
component: makesql_1.MAKESQL,
|
|
47
|
-
ports: {
|
|
48
|
-
sql: { ref: ['__sql'] },
|
|
49
|
-
params: { ref: ['__sqlParams'] },
|
|
50
|
-
skip: { ref: ['__skip'] },
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
],
|
|
54
|
-
output: { ref: ['q'] },
|
|
55
|
-
};
|
|
56
|
-
return { irVersion: 1, exprVersion: 2, components: [component] };
|
|
57
|
-
}
|
|
58
|
-
/** The input scope for {@link makeSqlComponentIR}, from a compiled `makeSQL` bundle. */
|
|
59
|
-
function makeSqlInput(node) {
|
|
60
|
-
return {
|
|
61
|
-
__sql: node.sql,
|
|
62
|
-
__sqlParams: node.params,
|
|
63
|
-
__skip: node.skip === true,
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
//# sourceMappingURL=ir.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ir.js","sourceRoot":"","sources":["../../../src/scp/makesql/ir.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAuBH,gDAsBC;AAGD,oCAMC;AAnDD,uCAA4E;AA4DnE,0FA5DsC,mBAAS,OA4DtC;AA1DlB;;;;;;;GAOG;AAEH;;;;;;;;GAQG;AACH,SAAgB,kBAAkB,CAAC,KAAK,GAAG,OAAO;IAChD,MAAM,SAAS,GAAc;QAC3B,IAAI,EAAE,KAAK;QACX,UAAU,EAAE;YACV,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE;YACzC,WAAW,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE;YAC5B,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;SACzB;QACD,IAAI,EAAE;YACJ;gBACE,EAAE,EAAE,GAAG;gBACP,SAAS,EAAE,iBAAO;gBAClB,KAAK,EAAE;oBACL,GAAG,EAAE,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,EAAE;oBACvB,MAAM,EAAE,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,EAAE;oBAChC,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE;iBAC1B;aACF;SACF;QACD,MAAM,EAAE,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE;KACvB,CAAC;IACF,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC;AACnE,CAAC;AAED,wFAAwF;AACxF,SAAgB,YAAY,CAAC,IAAa;IACxC,OAAO;QACL,KAAK,EAAE,IAAI,CAAC,GAAG;QACf,WAAW,EAAE,IAAI,CAAC,MAAM;QACxB,MAAM,EAAE,IAAI,CAAC,IAAI,KAAK,IAAI;KAC3B,CAAC;AACJ,CAAC"}
|