@astram/engine 0.6.0 → 0.8.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/adapters/mariadb-audit-sink.d.ts +10 -1
- package/dist/adapters/mariadb-audit-sink.d.ts.map +1 -1
- package/dist/adapters/mariadb-audit-sink.js +8 -1
- package/dist/decorators/object-type.decorator.d.ts +10 -0
- package/dist/decorators/object-type.decorator.d.ts.map +1 -1
- package/dist/decorators/object-type.decorator.js +5 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -10
- package/dist/module/engine.module.d.ts +8 -0
- package/dist/module/engine.module.d.ts.map +1 -1
- package/dist/module/engine.module.js +7 -4
- package/dist/pipe/context.d.ts +8 -0
- package/dist/pipe/context.d.ts.map +1 -1
- package/dist/pipe/filter-sql.d.ts +66 -0
- package/dist/pipe/filter-sql.d.ts.map +1 -0
- package/dist/pipe/filter-sql.js +266 -0
- package/dist/pipe/record-engine.d.ts +34 -1
- package/dist/pipe/record-engine.d.ts.map +1 -1
- package/dist/pipe/record-engine.js +256 -87
- package/dist/pipe/records-service.d.ts +19 -1
- package/dist/pipe/records-service.d.ts.map +1 -1
- package/dist/pipe/records-service.js +32 -0
- package/dist/pipe/stages/audit.d.ts.map +1 -1
- package/dist/pipe/stages/audit.js +8 -1
- package/dist/pipe/stages/fetch-record.d.ts +11 -1
- package/dist/pipe/stages/fetch-record.d.ts.map +1 -1
- package/dist/pipe/stages/fetch-record.js +18 -9
- package/dist/pipe/stages/permission-gate.d.ts +8 -0
- package/dist/pipe/stages/permission-gate.d.ts.map +1 -1
- package/dist/pipe/stages/permission-gate.js +15 -9
- package/dist/pipe/stages/validate.d.ts +6 -0
- package/dist/pipe/stages/validate.d.ts.map +1 -1
- package/dist/pipe/stages/validate.js +22 -8
- package/dist/registry.d.ts +38 -2
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +128 -2
- package/dist/types.d.ts +133 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +17 -1
- package/package.json +2 -2
package/dist/types.d.ts
CHANGED
|
@@ -164,6 +164,22 @@ export type ReadScope = {
|
|
|
164
164
|
export type ReadScopeCreateMode = 'walled' | 'unscoped';
|
|
165
165
|
/** The token a `subtreeSubquery` template uses for the engine-expanded subtree id list. */
|
|
166
166
|
export declare const READ_SCOPE_NODES_TOKEN = ":nodes";
|
|
167
|
+
/** The marker every {@link FRAMEWORK_SCHEMA} token starts with (leftover detection). */
|
|
168
|
+
export declare const FRAMEWORK_SCHEMA_TOKEN_MARKER = "{{framework_schema:";
|
|
169
|
+
/**
|
|
170
|
+
* Placeholder tokens for the four framework databases (configurable-framework-db, ADR-0037).
|
|
171
|
+
* A framework object type declares `@ObjectType({ schema: FRAMEWORK_SCHEMA.app })` (and may use
|
|
172
|
+
* the tokens inside `readScope.subquerySql`) so object files never read env at import time. The
|
|
173
|
+
* engine replaces each token with the resolved name (`<namespace>_app`, ...) at registration via
|
|
174
|
+
* `resolveObjectTypeSchema`; a token left unresolved fails registration (fail closed) and never
|
|
175
|
+
* reaches SQL. Token text contains no backtick and is never a valid database name.
|
|
176
|
+
*/
|
|
177
|
+
export declare const FRAMEWORK_SCHEMA: Readonly<{
|
|
178
|
+
readonly app: "{{framework_schema:app}}";
|
|
179
|
+
readonly identity: "{{framework_schema:identity}}";
|
|
180
|
+
readonly authz: "{{framework_schema:authz}}";
|
|
181
|
+
readonly audit: "{{framework_schema:audit}}";
|
|
182
|
+
}>;
|
|
167
183
|
/** Primary-key strategy for a registered table. */
|
|
168
184
|
export type PkStrategy = {
|
|
169
185
|
readonly kind: 'uuid';
|
|
@@ -191,7 +207,11 @@ export interface ObjectType {
|
|
|
191
207
|
readonly typeKey: string;
|
|
192
208
|
/** Physical table name. */
|
|
193
209
|
readonly table: string;
|
|
194
|
-
/**
|
|
210
|
+
/**
|
|
211
|
+
* Schema/database the table lives in, or a {@link FRAMEWORK_SCHEMA} token resolved at
|
|
212
|
+
* registration. Absent ⇒ the table name is unqualified and resolves against the pool's
|
|
213
|
+
* default database (the `database` of the engine's `db` config).
|
|
214
|
+
*/
|
|
195
215
|
readonly schema?: string;
|
|
196
216
|
readonly primaryKey: PkStrategy;
|
|
197
217
|
readonly fields: readonly FieldSpec[];
|
|
@@ -212,6 +232,19 @@ export interface ObjectType {
|
|
|
212
232
|
* still applies).
|
|
213
233
|
*/
|
|
214
234
|
readonly readScope?: ReadScope;
|
|
235
|
+
/**
|
|
236
|
+
* OPTIONAL extra actions beyond CRUD (ADR-0038), e.g. `['activate']`. Each is a
|
|
237
|
+
* permission-key segment (`SEGMENT_FORMAT`, at most 64 characters), unique, never `*` or
|
|
238
|
+
* `access`, and never a CRUD name unless `crudActions` is `false`. Validated at boot; read
|
|
239
|
+
* through `effectiveActions(reg)`.
|
|
240
|
+
*/
|
|
241
|
+
readonly actions?: readonly string[];
|
|
242
|
+
/**
|
|
243
|
+
* OPTIONAL, default `true`: the type's vocabulary starts with `read, create, update, delete`.
|
|
244
|
+
* `false` is for authority-only types (never CRUD'd through the engine): the vocabulary is
|
|
245
|
+
* exactly `actions`, which must then be non-empty (ADR-0038).
|
|
246
|
+
*/
|
|
247
|
+
readonly crudActions?: boolean;
|
|
215
248
|
}
|
|
216
249
|
/** Input to a create/update — field keys → values (+ optional junction refs). */
|
|
217
250
|
export interface RecordInput {
|
|
@@ -244,6 +277,41 @@ export interface SearchQuery {
|
|
|
244
277
|
/** The search term — bound as `%term%` per field (wildcards escaped). */
|
|
245
278
|
readonly term: string;
|
|
246
279
|
}
|
|
280
|
+
/**
|
|
281
|
+
* The `list()` filter operators (list-query-operators SPEC v2 §10). Exactly these keys; no
|
|
282
|
+
* `ne`/`not_in`/`contains` (follow-up spec). Operator × type: `eq`/`in` on every type but
|
|
283
|
+
* `json`; `gt|gte|lt|lte|between` on `string`, `number`, `uuid`, `timestamp`; `isNull` /
|
|
284
|
+
* `isNotNull` on every type.
|
|
285
|
+
*/
|
|
286
|
+
export type FilterOperator = 'eq' | 'in' | 'gt' | 'gte' | 'lt' | 'lte' | 'between' | 'isNull' | 'isNotNull';
|
|
287
|
+
/** A filter operand before coercion (coerced per field type like a write; `?`-bound). */
|
|
288
|
+
export type FilterScalar = string | number | boolean | Date | null;
|
|
289
|
+
/**
|
|
290
|
+
* One `where` entry: a scalar (equality; `null` ⇒ `IS NULL`) or exactly ONE operator object.
|
|
291
|
+
* An unknown operator, several operators in one object, or a malformed operand throws
|
|
292
|
+
* (never degrades to "no filter").
|
|
293
|
+
*/
|
|
294
|
+
export type FilterValue = FilterScalar | {
|
|
295
|
+
readonly eq: FilterScalar;
|
|
296
|
+
} | {
|
|
297
|
+
readonly in: readonly FilterScalar[];
|
|
298
|
+
} | {
|
|
299
|
+
readonly gt: FilterScalar;
|
|
300
|
+
} | {
|
|
301
|
+
readonly gte: FilterScalar;
|
|
302
|
+
} | {
|
|
303
|
+
readonly lt: FilterScalar;
|
|
304
|
+
} | {
|
|
305
|
+
readonly lte: FilterScalar;
|
|
306
|
+
} | {
|
|
307
|
+
readonly between: readonly [FilterScalar, FilterScalar];
|
|
308
|
+
} | {
|
|
309
|
+
readonly isNull: true;
|
|
310
|
+
} | {
|
|
311
|
+
readonly isNotNull: true;
|
|
312
|
+
};
|
|
313
|
+
/** A list `where`: registered field KEY → filter value, ANDed in object key order. */
|
|
314
|
+
export type WhereClause = Readonly<Record<string, FilterValue>>;
|
|
247
315
|
/**
|
|
248
316
|
* A list query — tenant-scoped filtering + simple paging, plus optional search
|
|
249
317
|
* (LIKE across fields) and sort (ORDER BY). All field references are registered
|
|
@@ -252,8 +320,8 @@ export interface SearchQuery {
|
|
|
252
320
|
export interface ListQuery {
|
|
253
321
|
readonly limit?: number;
|
|
254
322
|
readonly offset?: number;
|
|
255
|
-
/**
|
|
256
|
-
readonly where?:
|
|
323
|
+
/** Filters on registered field keys: scalar equality or one operator (`FilterValue`). */
|
|
324
|
+
readonly where?: WhereClause;
|
|
257
325
|
/** Free-text LIKE search across named field keys (ANDed with `where` + tenant). */
|
|
258
326
|
readonly search?: SearchQuery;
|
|
259
327
|
/**
|
|
@@ -270,6 +338,42 @@ export interface RecordPage {
|
|
|
270
338
|
readonly rows: readonly RecordView[];
|
|
271
339
|
readonly total: number;
|
|
272
340
|
}
|
|
341
|
+
/**
|
|
342
|
+
* An `aggregate()` function (list-query-operators SPEC v2 §10): `count` (no field ⇒ `COUNT(*)`),
|
|
343
|
+
* `sum`/`avg` on `number` fields, `min`/`max` on `string`, `number`, `uuid`, `timestamp`.
|
|
344
|
+
*/
|
|
345
|
+
export type AggregateFn = 'count' | 'sum' | 'min' | 'max' | 'avg';
|
|
346
|
+
/** One measure: `fn` over a registered field KEY, returned under `as` (`^[a-z_][a-z0-9_]{0,63}$`). */
|
|
347
|
+
export interface AggregateMeasure {
|
|
348
|
+
readonly fn: AggregateFn;
|
|
349
|
+
readonly field?: string;
|
|
350
|
+
readonly as: string;
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* An aggregate over exactly the rows `list()` would return for the same `where`/`search`
|
|
354
|
+
* (shared read WHERE, Shield #8). `groupBy` ≤ 3 non-json field keys; 1..10 `measures`;
|
|
355
|
+
* `limit` caps the number of groups (default 100, max 1000).
|
|
356
|
+
*/
|
|
357
|
+
export interface AggregateQuery {
|
|
358
|
+
readonly where?: WhereClause;
|
|
359
|
+
readonly search?: SearchQuery;
|
|
360
|
+
readonly groupBy?: readonly string[];
|
|
361
|
+
readonly measures: readonly AggregateMeasure[];
|
|
362
|
+
readonly limit?: number;
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* One group: `key` maps each `groupBy` field key to its value (`{}` when ungrouped); `values`
|
|
366
|
+
* maps each measure alias to its result. `count`/`sum`/`avg` are numbers (or `null`); `min`/`max`
|
|
367
|
+
* keep the column's value (`string` for string/uuid, `Date` for timestamp, `number`) or `null`.
|
|
368
|
+
*/
|
|
369
|
+
export interface AggregateGroup {
|
|
370
|
+
readonly key: Readonly<Record<string, unknown>>;
|
|
371
|
+
readonly values: Readonly<Record<string, number | string | Date | null>>;
|
|
372
|
+
}
|
|
373
|
+
/** Ungrouped ⇒ exactly one group; grouped with zero rows ⇒ `groups: []`. Ordered by group keys. */
|
|
374
|
+
export interface AggregateResult {
|
|
375
|
+
readonly groups: readonly AggregateGroup[];
|
|
376
|
+
}
|
|
273
377
|
/**
|
|
274
378
|
* The ONLY data-access surface a feature is given. Every method flows through the
|
|
275
379
|
* full pipe (permission gate + audit are mandatory). No pool, query runner, or
|
|
@@ -306,6 +410,32 @@ export interface RecordEngine {
|
|
|
306
410
|
* outside one it throws `EngineUnavailableError` (a lock released at once serialises nothing).
|
|
307
411
|
*/
|
|
308
412
|
lockForUpdate(typeKey: string, id: RecordId, actor: Principal): Promise<void>;
|
|
413
|
+
/**
|
|
414
|
+
* Record-level decision for one declared action, with no write (custom object actions,
|
|
415
|
+
* ADR-0038). Resolves on allow, throws on deny; returns no row data and writes no audit row.
|
|
416
|
+
* An `action` outside the type's declared vocabulary throws `RegistrationError` before any SQL
|
|
417
|
+
* or decision. Then the type pre-gate, the tenant-scoped fetch (`whereById`; `FOR UPDATE` inside
|
|
418
|
+
* `transaction(fn)`, plain `SELECT` outside) and the record-level `decide()` on the row's facts
|
|
419
|
+
* and tenant. Missing and foreign rows give the same `AuthorizationDeniedError`
|
|
420
|
+
* (`no_record_permit`); a decision throw is `EngineUnavailableError`. A deny does not make an
|
|
421
|
+
* open transaction rollback-only.
|
|
422
|
+
*/
|
|
423
|
+
authorize(typeKey: string, id: RecordId, action: string, actor: Principal): Promise<void>;
|
|
424
|
+
/**
|
|
425
|
+
* Aggregate (count/sum/avg/min/max, optional groupBy) over exactly the rows `list()` returns
|
|
426
|
+
* for the same `where`/`search`: gated as object-type `read` like `list`, then one SELECT with
|
|
427
|
+
* the list's read WHERE. Read-only; writes no audit row.
|
|
428
|
+
*/
|
|
429
|
+
aggregate(typeKey: string, query: AggregateQuery, actor: Principal): Promise<AggregateResult>;
|
|
430
|
+
/**
|
|
431
|
+
* Create 1..500 records all-or-nothing in ONE transaction: each row runs the full single-row
|
|
432
|
+
* `create` pipe (gate, derive, validate, write, junction-sync, create wall, audit), in order.
|
|
433
|
+
* The first failing row throws and the whole batch rolls back; inside `transaction(fn)` it
|
|
434
|
+
* joins the outer one. Each row's audit event carries the call's `batchId` and its 0-based
|
|
435
|
+
* `batchIndex`. An empty, non-array or over-cap `inputs` throws `ValidationError('inputs')`
|
|
436
|
+
* before any transaction opens. Returns the ids in input order.
|
|
437
|
+
*/
|
|
438
|
+
createMany(typeKey: string, inputs: readonly RecordInput[], actor: Principal): Promise<RecordId[]>;
|
|
309
439
|
}
|
|
310
440
|
export type { Principal };
|
|
311
441
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/D,iFAAiF;AACjF,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,WAAW,GAAG,MAAM,CAAC;AAExF,qDAAqD;AACrD,MAAM,WAAW,SAAS;IACxB,yEAAyE;IACzE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,2DAA2D;IAC3D,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,mEAAmE;IACnE,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,aAAa,CAAC;IACjC;;;;;;OAMG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,YAAY,CAAC;IAC7B;;;;;;OAMG;IACH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M,EAAE,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1F;;;;OAIG;IACH,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAC9F;;;;;;;OAOG;IACH,UAAU,CACR,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,SAAS,WAAW,EAAE,EAC9B,KAAK,EAAE,SAAS,GACf,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;CACxB;AAED,YAAY,EAAE,SAAS,EAAE,CAAC"}
|
package/dist/types.js
CHANGED
|
@@ -13,6 +13,22 @@
|
|
|
13
13
|
* surface.
|
|
14
14
|
*/
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.READ_SCOPE_NODES_TOKEN = void 0;
|
|
16
|
+
exports.FRAMEWORK_SCHEMA = exports.FRAMEWORK_SCHEMA_TOKEN_MARKER = exports.READ_SCOPE_NODES_TOKEN = void 0;
|
|
17
17
|
/** The token a `subtreeSubquery` template uses for the engine-expanded subtree id list. */
|
|
18
18
|
exports.READ_SCOPE_NODES_TOKEN = ':nodes';
|
|
19
|
+
/** The marker every {@link FRAMEWORK_SCHEMA} token starts with (leftover detection). */
|
|
20
|
+
exports.FRAMEWORK_SCHEMA_TOKEN_MARKER = '{{framework_schema:';
|
|
21
|
+
/**
|
|
22
|
+
* Placeholder tokens for the four framework databases (configurable-framework-db, ADR-0037).
|
|
23
|
+
* A framework object type declares `@ObjectType({ schema: FRAMEWORK_SCHEMA.app })` (and may use
|
|
24
|
+
* the tokens inside `readScope.subquerySql`) so object files never read env at import time. The
|
|
25
|
+
* engine replaces each token with the resolved name (`<namespace>_app`, ...) at registration via
|
|
26
|
+
* `resolveObjectTypeSchema`; a token left unresolved fails registration (fail closed) and never
|
|
27
|
+
* reaches SQL. Token text contains no backtick and is never a valid database name.
|
|
28
|
+
*/
|
|
29
|
+
exports.FRAMEWORK_SCHEMA = Object.freeze({
|
|
30
|
+
app: '{{framework_schema:app}}',
|
|
31
|
+
identity: '{{framework_schema:identity}}',
|
|
32
|
+
authz: '{{framework_schema:authz}}',
|
|
33
|
+
audit: '{{framework_schema:audit}}',
|
|
34
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astram/engine",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Astram framework — the paved road. ONE unbypassable write pipe (resolve-schema → permission gate → derive-write-context → validate → compute → write → junction-sync → audit → emit-event) over real physical tables, that every feature's CRUD flows through. Feature code receives ONLY the RecordEngine facade — never a raw pool/DataSource/QueryRunner (the physical wall). Security-gate + audit are mandatory stages. Missing capability → a typed CapabilityNotSupportedError (the gap-flag STOP). Builds on @astram/core (metadata contract, decide(), audit) + @astram/guard (decision authority).",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"mariadb": "^3.5.4",
|
|
35
|
-
"@astram/core": "1.
|
|
35
|
+
"@astram/core": "1.7.0"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"@nestjs/common": "^11",
|