@fougere/core 0.5.0-alpha.0 → 0.6.0-alpha.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/boot/Emissions.d.ts +2 -2
- package/dist/boot/Emissions.d.ts.map +1 -1
- package/dist/boot/Emissions.js +1 -1
- package/dist/boot/HandlerFacade.d.ts +1 -1
- package/dist/boot/HandlerFacade.d.ts.map +1 -1
- package/dist/boot/HandlerFacade.js +1 -1
- package/dist/boot/HandlerFacade.js.map +1 -1
- package/dist/boot/auth.d.ts +6 -6
- package/dist/boot/auth.d.ts.map +1 -1
- package/dist/boot/boot.d.ts +2 -2
- package/dist/boot/boot.d.ts.map +1 -1
- package/dist/boot/boot.js +1 -1
- package/dist/boot/boot.js.map +1 -1
- package/dist/boot/bootstrap.d.ts.map +1 -1
- package/dist/boot/bootstrap.js +47 -38
- package/dist/boot/bootstrap.js.map +1 -1
- package/dist/boot/card.d.ts +21 -0
- package/dist/boot/card.d.ts.map +1 -0
- package/dist/boot/card.js +100 -0
- package/dist/boot/card.js.map +1 -0
- package/dist/boot/frame.d.ts +3 -3
- package/dist/boot/frame.d.ts.map +1 -1
- package/dist/boot/frame.js +7 -7
- package/dist/boot/frame.js.map +1 -1
- package/dist/boot/hosted.d.ts +8 -2
- package/dist/boot/hosted.d.ts.map +1 -1
- package/dist/boot/hosted.js +10 -10
- package/dist/boot/hosted.js.map +1 -1
- package/dist/boot/ownership.d.ts +7 -5
- package/dist/boot/ownership.d.ts.map +1 -1
- package/dist/boot/ownership.js +9 -14
- package/dist/boot/ownership.js.map +1 -1
- package/dist/boot/ports.d.ts +2 -2
- package/dist/boot/ports.d.ts.map +1 -1
- package/dist/boot/ports.js +1 -1
- package/dist/boot/runner.d.ts +28 -0
- package/dist/boot/runner.d.ts.map +1 -0
- package/dist/boot/runner.js +26 -0
- package/dist/boot/runner.js.map +1 -0
- package/dist/boot/seed.d.ts +2 -2
- package/dist/boot/seed.d.ts.map +1 -1
- package/dist/boot/seed.js +5 -5
- package/dist/boot/seed.js.map +1 -1
- package/dist/boot/statement-drift.d.ts +2 -1
- package/dist/boot/statement-drift.d.ts.map +1 -1
- package/dist/boot/statement-drift.js.map +1 -1
- package/dist/boot/together.d.ts +4 -4
- package/dist/boot/together.d.ts.map +1 -1
- package/dist/boot/together.js +17 -19
- package/dist/boot/together.js.map +1 -1
- package/dist/boot/types.d.ts +12 -11
- package/dist/boot/types.d.ts.map +1 -1
- package/dist/contract/CallLog.d.ts +2 -2
- package/dist/contract/CallLog.d.ts.map +1 -1
- package/dist/contract/RouteAddress.d.ts +2 -0
- package/dist/contract/RouteAddress.d.ts.map +1 -1
- package/dist/contract/RouteAddress.js.map +1 -1
- package/dist/{scan/declare.d.ts → declare.d.ts} +3 -3
- package/dist/declare.d.ts.map +1 -0
- package/dist/{scan/declare.js → declare.js} +3 -3
- package/dist/declare.js.map +1 -0
- package/dist/{scan → descriptor}/Fronds.d.ts +6 -7
- package/dist/descriptor/Fronds.d.ts.map +1 -0
- package/dist/{scan → descriptor}/Fronds.js +6 -7
- package/dist/descriptor/Fronds.js.map +1 -0
- package/dist/{scan → descriptor}/frond.d.ts +7 -47
- package/dist/descriptor/frond.d.ts.map +1 -0
- package/dist/{scan → descriptor}/frond.js.map +1 -1
- package/dist/dispatch/ArgumentResolver.d.ts +5 -2
- package/dist/dispatch/ArgumentResolver.d.ts.map +1 -1
- package/dist/dispatch/ArgumentResolver.js +48 -3
- package/dist/dispatch/ArgumentResolver.js.map +1 -1
- package/dist/dispatch/DispatchEvent.d.ts +1 -1
- package/dist/dispatch/DispatchEvent.d.ts.map +1 -1
- package/dist/dispatch/PresenterArgumentResolver.d.ts +1 -1
- package/dist/dispatch/PresenterArgumentResolver.d.ts.map +1 -1
- package/dist/dispatch/PresenterArgumentResolver.js +1 -1
- package/dist/dispatch/Route.d.ts +1 -2
- package/dist/dispatch/Route.d.ts.map +1 -1
- package/dist/dispatch/StorageGuard.d.ts +2 -2
- package/dist/dispatch/StorageGuard.d.ts.map +1 -1
- package/dist/dispatch/StorageGuard.js +7 -7
- package/dist/dispatch/StorageGuard.js.map +1 -1
- package/dist/effective-operation.d.ts +29 -3
- package/dist/effective-operation.d.ts.map +1 -1
- package/dist/effective-operation.js +52 -1
- package/dist/effective-operation.js.map +1 -1
- package/dist/emit.d.ts +1 -1
- package/dist/frond-config.d.ts +2 -2
- package/dist/graph.d.ts +1 -1
- package/dist/graph.d.ts.map +1 -1
- package/dist/imports.d.ts +1 -1
- package/dist/imports.d.ts.map +1 -1
- package/dist/index.d.ts +15 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -6
- package/dist/index.js.map +1 -1
- package/dist/node.d.ts +2 -2
- package/dist/node.d.ts.map +1 -1
- package/dist/node.js +2 -2
- package/dist/node.js.map +1 -1
- package/dist/prefab/collector.d.ts +2 -2
- package/dist/prefab/collector.js +2 -2
- package/dist/prefab/crud.d.ts +5 -5
- package/dist/prefab/crud.d.ts.map +1 -1
- package/dist/prefab/crud.js +12 -12
- package/dist/prefab/crud.js.map +1 -1
- package/dist/prefab/mirror.d.ts +5 -5
- package/dist/prefab/mirror.d.ts.map +1 -1
- package/dist/prefab/mirror.js +5 -5
- package/dist/prefab/mirror.js.map +1 -1
- package/dist/prefab/presenter.d.ts +2 -2
- package/dist/prefab/presenter.js +2 -2
- package/dist/prefab/repository.d.ts +14 -14
- package/dist/prefab/repository.d.ts.map +1 -1
- package/dist/prefab/repository.js +19 -19
- package/dist/prefab/repository.js.map +1 -1
- package/dist/rows.d.ts +40 -0
- package/dist/rows.d.ts.map +1 -0
- package/dist/rows.js +146 -0
- package/dist/rows.js.map +1 -0
- package/dist/scan/conventions.d.ts +8 -12
- package/dist/scan/conventions.d.ts.map +1 -1
- package/dist/scan/conventions.js +0 -13
- package/dist/scan/conventions.js.map +1 -1
- package/dist/scan/emit.d.ts +1 -1
- package/dist/scan/emit.d.ts.map +1 -1
- package/dist/scan/emit.js +1 -1
- package/dist/scan/emit.js.map +1 -1
- package/dist/scan/handler-parser.d.ts +11 -56
- package/dist/scan/handler-parser.d.ts.map +1 -1
- package/dist/scan/handler-parser.js +2 -2
- package/dist/scan/handler-parser.js.map +1 -1
- package/dist/scan/result.d.ts +41 -0
- package/dist/scan/result.d.ts.map +1 -0
- package/dist/scan/result.js +2 -0
- package/dist/scan/result.js.map +1 -0
- package/dist/scan/scanner.d.ts +18 -1
- package/dist/scan/scanner.d.ts.map +1 -1
- package/dist/scan/scanner.js +34 -17
- package/dist/scan/scanner.js.map +1 -1
- package/dist/scan/statement.d.ts +1 -1
- package/dist/scan/statement.d.ts.map +1 -1
- package/dist/scan/statement.js.map +1 -1
- package/dist/{orm.d.ts → storage.d.ts} +98 -16
- package/dist/storage.d.ts.map +1 -0
- package/dist/{orm.js → storage.js} +53 -5
- package/dist/storage.js.map +1 -0
- package/dist/verify.d.ts +1 -1
- package/dist/verify.d.ts.map +1 -1
- package/dist/verify.js +2 -2
- package/dist/verify.js.map +1 -1
- package/dist/{boot → wire}/binding.d.ts +2 -10
- package/dist/wire/binding.d.ts.map +1 -0
- package/dist/{boot → wire}/binding.js +0 -52
- package/dist/wire/binding.js.map +1 -0
- package/dist/wire/call.d.ts +2 -40
- package/dist/wire/call.d.ts.map +1 -1
- package/dist/wire/call.js +0 -125
- package/dist/wire/call.js.map +1 -1
- package/dist/wire/operation.d.ts +5 -31
- package/dist/wire/operation.d.ts.map +1 -1
- package/dist/wire/operation.js +0 -51
- package/dist/wire/operation.js.map +1 -1
- package/dist/wire/signature.d.ts +58 -0
- package/dist/wire/signature.d.ts.map +1 -0
- package/dist/wire/signature.js +2 -0
- package/dist/wire/signature.js.map +1 -0
- package/package.json +3 -3
- package/src/boot/Emissions.ts +2 -2
- package/src/boot/HandlerFacade.ts +3 -3
- package/src/boot/auth.ts +6 -6
- package/src/boot/boot.ts +3 -3
- package/src/boot/bootstrap.ts +50 -39
- package/src/boot/card.ts +113 -0
- package/src/boot/frame.ts +7 -7
- package/src/boot/hosted.ts +11 -14
- package/src/boot/ownership.ts +14 -15
- package/src/boot/ports.ts +2 -2
- package/src/boot/runner.ts +34 -0
- package/src/boot/seed.ts +6 -6
- package/src/boot/statement-drift.ts +5 -4
- package/src/boot/together.ts +24 -25
- package/src/boot/types.ts +12 -11
- package/src/contract/CallLog.ts +2 -2
- package/src/contract/RouteAddress.ts +3 -0
- package/src/{scan/declare.ts → declare.ts} +5 -5
- package/src/{scan → descriptor}/Fronds.ts +6 -7
- package/src/{scan → descriptor}/frond.ts +7 -48
- package/src/dispatch/ArgumentResolver.ts +53 -7
- package/src/dispatch/DispatchEvent.ts +1 -1
- package/src/dispatch/PresenterArgumentResolver.ts +2 -2
- package/src/dispatch/Route.ts +1 -3
- package/src/dispatch/StorageGuard.ts +7 -7
- package/src/effective-operation.ts +63 -11
- package/src/emit.ts +1 -1
- package/src/frond-config.ts +2 -2
- package/src/graph.ts +1 -1
- package/src/imports.ts +1 -1
- package/src/index.ts +15 -13
- package/src/node.ts +2 -2
- package/src/prefab/collector.ts +2 -2
- package/src/prefab/crud.ts +18 -18
- package/src/prefab/mirror.ts +8 -8
- package/src/prefab/presenter.ts +2 -2
- package/src/prefab/repository.ts +32 -32
- package/src/rows.ts +155 -0
- package/src/scan/conventions.ts +0 -18
- package/src/scan/emit.ts +3 -5
- package/src/scan/handler-parser.ts +14 -67
- package/src/scan/result.ts +42 -0
- package/src/scan/scanner.ts +44 -21
- package/src/scan/statement.ts +2 -1
- package/src/{orm.ts → storage.ts} +126 -17
- package/src/verify.ts +3 -3
- package/src/{boot → wire}/binding.ts +2 -66
- package/src/wire/call.ts +1 -129
- package/src/wire/operation.ts +5 -62
- package/src/wire/signature.ts +59 -0
- package/dist/boot/binding.d.ts.map +0 -1
- package/dist/boot/binding.js.map +0 -1
- package/dist/orm.d.ts.map +0 -1
- package/dist/orm.js.map +0 -1
- package/dist/scan/Fronds.d.ts.map +0 -1
- package/dist/scan/Fronds.js.map +0 -1
- package/dist/scan/declare.d.ts.map +0 -1
- package/dist/scan/declare.js.map +0 -1
- package/dist/scan/frond.d.ts.map +0 -1
- /package/dist/{scan → descriptor}/frond.js +0 -0
package/dist/node.d.ts
CHANGED
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
* process boundary. A foreign frond reads it without reading our boot.
|
|
11
11
|
*/
|
|
12
12
|
export { boot } from './boot/boot.js';
|
|
13
|
-
export { scanProject, frondAliases } from './scan/scanner.js';
|
|
14
|
-
export { type Conventions, type ConventionsInput, DEFAULT_CONVENTIONS, resolveConventions, frondPackage, frondDirsOf, providerDirsOf,
|
|
13
|
+
export { scanProject, frondAliases, watchPathsOf } from './scan/scanner.js';
|
|
14
|
+
export { type Conventions, type ConventionsInput, DEFAULT_CONVENTIONS, resolveConventions, frondPackage, frondDirsOf, providerDirsOf, } from './scan/conventions.js';
|
|
15
15
|
export { RUNTIME_PACKAGES } from './scan/bundling.js';
|
|
16
16
|
export { emitScan, type EmitOptions } from './scan/emit.js';
|
|
17
17
|
export { emitStatement } from './scan/statement.js';
|
package/dist/node.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EACL,KAAK,WAAW,EAAE,KAAK,gBAAgB,EAAE,mBAAmB,EAC5D,kBAAkB,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,GAC9D,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAKjD,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/node.js
CHANGED
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
* process boundary. A foreign frond reads it without reading our boot.
|
|
11
11
|
*/
|
|
12
12
|
export { boot } from './boot/boot.js';
|
|
13
|
-
export { scanProject, frondAliases } from './scan/scanner.js';
|
|
14
|
-
export { DEFAULT_CONVENTIONS, resolveConventions, frondPackage, frondDirsOf, providerDirsOf,
|
|
13
|
+
export { scanProject, frondAliases, watchPathsOf } from './scan/scanner.js';
|
|
14
|
+
export { DEFAULT_CONVENTIONS, resolveConventions, frondPackage, frondDirsOf, providerDirsOf, } from './scan/conventions.js';
|
|
15
15
|
export { RUNTIME_PACKAGES } from './scan/bundling.js';
|
|
16
16
|
export { emitScan } from './scan/emit.js';
|
|
17
17
|
export { emitStatement } from './scan/statement.js';
|
package/dist/node.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.js","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"node.js","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EACoC,mBAAmB,EAC5D,kBAAkB,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,GAC9D,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAoB,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD,wFAAwF;AACxF,wFAAwF;AACxF,mCAAmC;AACnC,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
* Usage:
|
|
13
13
|
* ```ts
|
|
14
14
|
* export default class UserCollector extends Collector(User) {
|
|
15
|
-
* constructor(private
|
|
15
|
+
* constructor(private userStorage: UserStorage) { super(); }
|
|
16
16
|
*
|
|
17
17
|
* async collect(ctx: InvocationContext) {
|
|
18
|
-
* return this.
|
|
18
|
+
* return this.userStorage.findById(ctx.state.userId as string);
|
|
19
19
|
* }
|
|
20
20
|
* }
|
|
21
21
|
* ```
|
package/dist/prefab/collector.js
CHANGED
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
* Usage:
|
|
13
13
|
* ```ts
|
|
14
14
|
* export default class UserCollector extends Collector(User) {
|
|
15
|
-
* constructor(private
|
|
15
|
+
* constructor(private userStorage: UserStorage) { super(); }
|
|
16
16
|
*
|
|
17
17
|
* async collect(ctx: InvocationContext) {
|
|
18
|
-
* return this.
|
|
18
|
+
* return this.userStorage.findById(ctx.state.userId as string);
|
|
19
19
|
* }
|
|
20
20
|
* }
|
|
21
21
|
* ```
|
package/dist/prefab/crud.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Storage, ListOptions, ListResult } from '../storage.js';
|
|
2
2
|
import type { OperationContract } from '../wire/operation.js';
|
|
3
3
|
import type { EntityConstructor } from '@fougere/schema';
|
|
4
4
|
/** The five ops the mixin fabricates. */
|
|
@@ -26,7 +26,7 @@ type OutOf<V, K extends CrudOpName, T> = [
|
|
|
26
26
|
* a judged redefinition assignable.
|
|
27
27
|
*/
|
|
28
28
|
export interface CrudOps<T, V = {}> {
|
|
29
|
-
|
|
29
|
+
storage: Storage<T>;
|
|
30
30
|
list(options?: ListOptions, ...collected: never[]): Promise<ListResult<OutOf<V, 'list', T>>>;
|
|
31
31
|
findById(id: string, ...collected: never[]): Promise<OutOf<V, 'findById', T> | undefined>;
|
|
32
32
|
create(input: Partial<T>, ...collected: never[]): Promise<OutOf<V, 'create', T>>;
|
|
@@ -35,7 +35,7 @@ export interface CrudOps<T, V = {}> {
|
|
|
35
35
|
}
|
|
36
36
|
/** The prefab handler class — its ops, plus the statics the bootstrap and adapters read. */
|
|
37
37
|
export interface CrudConstructor<T, V = {}> {
|
|
38
|
-
new (
|
|
38
|
+
new (storage: Storage<T>): CrudOps<T, V>;
|
|
39
39
|
readonly __entity: unknown;
|
|
40
40
|
readonly __output: unknown;
|
|
41
41
|
readonly __opOutputs?: CrudViews;
|
|
@@ -49,10 +49,10 @@ export interface CrudConstructor<T, V = {}> {
|
|
|
49
49
|
*
|
|
50
50
|
* Crud(Post) → every op emits Post
|
|
51
51
|
* Crud(Post, { list: PostCard }) → list emits cards, the rest emit Post. Declaration
|
|
52
|
-
* only: the handler keeps its full-row
|
|
52
|
+
* only: the handler keeps its full-row storage, so a
|
|
53
53
|
* judge can still read `body`.
|
|
54
54
|
* Crud(Post, PostPublic) → every op emits PostPublic, and the bootstrap
|
|
55
|
-
* scopes the injected
|
|
55
|
+
* scopes the injected storage via .output(PostPublic) —
|
|
56
56
|
* the whole handler speaks the restricted view.
|
|
57
57
|
*/
|
|
58
58
|
export declare function Crud<E extends EntityConstructor, V extends CrudViews | EntityConstructor = {}>(entity: E, output?: V): CrudConstructor<InstanceType<E>, V>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crud.d.ts","sourceRoot":"","sources":["../../src/prefab/crud.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"crud.d.ts","sourceRoot":"","sources":["../../src/prefab/crud.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACtE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,KAAK,EAAE,iBAAiB,EAAc,MAAM,iBAAiB,CAAC;AAyFrE,yCAAyC;AACzC,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,UAAU,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE9E,kFAAkF;AAClF,MAAM,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,iBAAiB,CAAC,CAAC,CAAC;AAEvE;;;;;GAKG;AACH,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC,SAAS,UAAU,EAAE,CAAC,IAInC;IAAC,CAAC;CAAC,SAAS,CAAC,iBAAiB,CAAC,GAAG,YAAY,CAAC,CAAC,GAAG,iBAAiB,CAAC,GACnE,CAAC,SAAS,MAAM,CAAC,GAAG,CAAC,CAA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AAC,CAAC;IACzC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,CAAC;IACjC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;CACnD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,iBAAiB,EAAE,CAAC,SAAS,SAAS,GAAG,iBAAiB,GAAG,EAAE,EAC5F,MAAM,EAAE,CAAC,EACT,MAAM,CAAC,EAAE,CAAC,GACT,eAAe,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CA2BrC"}
|
package/dist/prefab/crud.js
CHANGED
|
@@ -71,7 +71,7 @@ function crudOps(entity) {
|
|
|
71
71
|
/**
|
|
72
72
|
* The mixin's single "trust me" point — the twin of `asSchemaConstructor` in @fougere/schema.
|
|
73
73
|
*
|
|
74
|
-
* The implementation returns whatever the
|
|
74
|
+
* The implementation returns whatever the storage hands back; the declaration names the view
|
|
75
75
|
* each op emits at the port. TypeScript cannot connect the two (the view is a runtime
|
|
76
76
|
* argument, the type is a generic), so one assertion states that the mixin honours what it
|
|
77
77
|
* declared — and the façade makes it true, projecting each op's result onto its view
|
|
@@ -88,10 +88,10 @@ function asCrudConstructor(impl) {
|
|
|
88
88
|
*
|
|
89
89
|
* Crud(Post) → every op emits Post
|
|
90
90
|
* Crud(Post, { list: PostCard }) → list emits cards, the rest emit Post. Declaration
|
|
91
|
-
* only: the handler keeps its full-row
|
|
91
|
+
* only: the handler keeps its full-row storage, so a
|
|
92
92
|
* judge can still read `body`.
|
|
93
93
|
* Crud(Post, PostPublic) → every op emits PostPublic, and the bootstrap
|
|
94
|
-
* scopes the injected
|
|
94
|
+
* scopes the injected storage via .output(PostPublic) —
|
|
95
95
|
* the whole handler speaks the restricted view.
|
|
96
96
|
*/
|
|
97
97
|
export function Crud(entity, output) {
|
|
@@ -100,20 +100,20 @@ export function Crud(entity, output) {
|
|
|
100
100
|
const wholeHandler = typeof output === 'function' ? output : undefined;
|
|
101
101
|
return asCrudConstructor(class CrudHandler {
|
|
102
102
|
static __entity = entity;
|
|
103
|
-
/** Handler-wide view only — a per-op map must NOT scope the
|
|
103
|
+
/** Handler-wide view only — a per-op map must NOT scope the storage the judges read. */
|
|
104
104
|
static __output = wholeHandler ?? entity;
|
|
105
105
|
static __opOutputs = perOp;
|
|
106
106
|
/** What this prefab handler declares — read by the façade, merged under the author's own methods. */
|
|
107
107
|
static __ops = crudOps(entity);
|
|
108
|
-
|
|
109
|
-
constructor(
|
|
110
|
-
this.
|
|
108
|
+
storage;
|
|
109
|
+
constructor(storage) {
|
|
110
|
+
this.storage = storage;
|
|
111
111
|
}
|
|
112
|
-
async list(options) { return this.
|
|
113
|
-
async findById(id) { return this.
|
|
114
|
-
async create(input) { return this.
|
|
115
|
-
async update(id, input) { return this.
|
|
116
|
-
async delete(id) { return this.
|
|
112
|
+
async list(options) { return this.storage.list(options); }
|
|
113
|
+
async findById(id) { return this.storage.findById(id); }
|
|
114
|
+
async create(input) { return this.storage.create(input); }
|
|
115
|
+
async update(id, input) { return this.storage.update(id, input); }
|
|
116
|
+
async delete(id) { return this.storage.delete(id); }
|
|
117
117
|
});
|
|
118
118
|
}
|
|
119
119
|
//# sourceMappingURL=crud.js.map
|
package/dist/prefab/crud.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crud.js","sourceRoot":"","sources":["../../src/prefab/crud.ts"],"names":[],"mappings":"AAIA,8EAA8E;AAC9E,MAAM,IAAI,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,OAAgB,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;AAC7F,MAAM,QAAQ,GAAG,EAAE,IAAI,EAAE,OAA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,CAAC,QAAQ,GAAG,YAAY,IAAI,MAAM,CAAC;QACzC,MAAM,CAAC,WAAW,GAAG,KAAK,CAAC;QAC3B,qGAAqG;QACrG,MAAM,CAAC,KAAK,GAAsC,OAAO,CAAC,MAAgE,CAAC,CAAC;QAE5H,OAAO,CAAa;QACpB,YAAY,OAAgB;YAC1B,IAAI,CAAC,OAAO,GAAG,OAAqB,CAAC;QACvC,CAAC;QAED,KAAK,CAAC,IAAI,CAAC,OAAqB,IAA4B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAA2B,CAAC,CAAC,CAAC;QAC1H,KAAK,CAAC,QAAQ,CAAC,EAAU,IAA4B,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QACxF,KAAK,CAAC,MAAM,CAAC,KAAiB,IAAgB,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAClF,KAAK,CAAC,MAAM,CAAC,EAAU,EAAE,KAAiB,IAAgB,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;QAClG,KAAK,CAAC,MAAM,CAAC,EAAU,IAAsB,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;KAC/E,CAAC,CAAC;AACL,CAAC"}
|
package/dist/prefab/mirror.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type EntityConstructor } from '@fougere/schema';
|
|
2
|
-
import type {
|
|
2
|
+
import type { Storage } from '../storage.js';
|
|
3
3
|
/**
|
|
4
4
|
* A paginated local copy of a source that cannot be queried directly.
|
|
5
5
|
*
|
|
@@ -8,8 +8,8 @@ import type { EntityOrm } from '../orm.js';
|
|
|
8
8
|
*
|
|
9
9
|
* ```ts
|
|
10
10
|
* export default class PartnerCatalog extends Mirror(BookCard) {
|
|
11
|
-
* constructor(
|
|
12
|
-
* super(
|
|
11
|
+
* constructor(storage: Storage<BookCard>, private catalog: Facade<CatalogHandler>) {
|
|
12
|
+
* super(storage);
|
|
13
13
|
* }
|
|
14
14
|
*
|
|
15
15
|
* async *pull(since?: Date) {
|
|
@@ -34,7 +34,7 @@ export interface Refreshed {
|
|
|
34
34
|
}
|
|
35
35
|
export interface MirrorOf<T> {
|
|
36
36
|
/** The copy's own storage — where a page lands, and where its age is read. */
|
|
37
|
-
|
|
37
|
+
storage: Storage<T>;
|
|
38
38
|
/** Pages of rows to write. The one thing a mirror's author supplies. */
|
|
39
39
|
pull(since?: Date): AsyncIterable<Partial<T>[]>;
|
|
40
40
|
/** Run one pass: read the high-water mark, pull from there, write each page. */
|
|
@@ -43,7 +43,7 @@ export interface MirrorOf<T> {
|
|
|
43
43
|
freshness(): Promise<Date | undefined>;
|
|
44
44
|
}
|
|
45
45
|
export interface MirrorConstructor<T> {
|
|
46
|
-
new (
|
|
46
|
+
new (storage: Storage<T>): MirrorOf<T>;
|
|
47
47
|
readonly __entity: unknown;
|
|
48
48
|
}
|
|
49
49
|
export declare function Mirror<E extends EntityConstructor>(shape: E): MirrorConstructor<InstanceType<E>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mirror.d.ts","sourceRoot":"","sources":["../../src/prefab/mirror.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,iBAAiB,EAAsC,MAAM,iBAAiB,CAAC;AAClH,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"mirror.d.ts","sourceRoot":"","sources":["../../src/prefab/mirror.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,iBAAiB,EAAsC,MAAM,iBAAiB,CAAC;AAClH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAE7C;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,mFAAmF;AACnF,MAAM,WAAW,SAAS;IACxB,kDAAkD;IAClD,OAAO,EAAE,MAAM,CAAC;IAChB,+EAA+E;IAC/E,KAAK,CAAC,EAAE,IAAI,CAAC;IACb,mDAAmD;IACnD,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,QAAQ,CAAC,CAAC;IACzB,8EAA8E;IAC9E,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IACpB,wEAAwE;IACxE,IAAI,CAAC,KAAK,CAAC,EAAE,IAAI,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAChD,gFAAgF;IAChF,OAAO,IAAI,OAAO,CAAC,SAAS,CAAC,CAAC;IAC9B,oFAAoF;IACpF,SAAS,IAAI,OAAO,CAAC,IAAI,GAAG,SAAS,CAAC,CAAC;CACxC;AAED,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC,KAAK,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IACvC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;CAC5B;AAED,wBAAgB,MAAM,CAAC,CAAC,SAAS,iBAAiB,EAAE,KAAK,EAAE,CAAC,GAAG,iBAAiB,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAyChG;AAED,qDAAqD;AACrD,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAO7D"}
|
package/dist/prefab/mirror.js
CHANGED
|
@@ -8,14 +8,14 @@ export function Mirror(shape) {
|
|
|
8
8
|
}
|
|
9
9
|
const age = declared;
|
|
10
10
|
class MirrorBase {
|
|
11
|
-
|
|
11
|
+
storage;
|
|
12
12
|
static __entity = shape;
|
|
13
|
-
constructor(
|
|
14
|
-
this.
|
|
13
|
+
constructor(storage) {
|
|
14
|
+
this.storage = storage;
|
|
15
15
|
}
|
|
16
16
|
/** The freshest persisted stamp; no process-local freshness state is kept. */
|
|
17
17
|
async freshness() {
|
|
18
|
-
const [newest] = await this.
|
|
18
|
+
const [newest] = await this.storage.list({ orderBy: age, order: 'desc', limit: 1 });
|
|
19
19
|
const value = newest?.[age];
|
|
20
20
|
return value instanceof Date ? value : undefined;
|
|
21
21
|
}
|
|
@@ -27,7 +27,7 @@ export function Mirror(shape) {
|
|
|
27
27
|
for await (const page of this.pull(since)) {
|
|
28
28
|
if (page.length === 0)
|
|
29
29
|
continue;
|
|
30
|
-
written += await this.
|
|
30
|
+
written += await this.storage.upsertAll(judgePage(shape, page));
|
|
31
31
|
}
|
|
32
32
|
return { written, since, ms: Date.now() - started };
|
|
33
33
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mirror.js","sourceRoot":"","sources":["../../src/prefab/mirror.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAA8D,MAAM,iBAAiB,CAAC;AAoDlH,MAAM,UAAU,MAAM,CAA8B,KAAQ;IAG1D,wEAAwE;IACxE,MAAM,QAAQ,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;IACnC,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CACb,UAAW,KAA2B,CAAC,IAAI,IAAI,GAAG,gDAAgD;YAClG,qGAAqG,CACtG,CAAC;IACJ,CAAC;IACD,MAAM,GAAG,GAAW,QAAQ,CAAC;IAE7B,MAAe,UAAU;QAGJ;QAFnB,MAAM,CAAU,QAAQ,GAAG,KAAK,CAAC;QAEjC,YAAmB,
|
|
1
|
+
{"version":3,"file":"mirror.js","sourceRoot":"","sources":["../../src/prefab/mirror.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAA8D,MAAM,iBAAiB,CAAC;AAoDlH,MAAM,UAAU,MAAM,CAA8B,KAAQ;IAG1D,wEAAwE;IACxE,MAAM,QAAQ,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;IACnC,IAAI,QAAQ,KAAK,SAA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,SAAS,CAAC,CAAC,CAAC,OAAO,OAAO,IAAI,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,eAAe,CAAC;QACxG,MAAM,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC5E,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,mBAAmB,KAAK,MAAM,GAAG,EAAE,CAAC,CAAC;IAC9D,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -9,14 +9,14 @@
|
|
|
9
9
|
* Usage:
|
|
10
10
|
* ```ts
|
|
11
11
|
* export default class PostPresenter extends Presenter(Post) {
|
|
12
|
-
* constructor(private
|
|
12
|
+
* constructor(private commentStorage: CommentStorage) { super(); }
|
|
13
13
|
*
|
|
14
14
|
* excerpt(post: Post) {
|
|
15
15
|
* return post.body.slice(0, 200);
|
|
16
16
|
* }
|
|
17
17
|
*
|
|
18
18
|
* async commentCount(post: Post) {
|
|
19
|
-
* return this.
|
|
19
|
+
* return this.commentStorage.countFor(post.id);
|
|
20
20
|
* }
|
|
21
21
|
* }
|
|
22
22
|
* ```
|
package/dist/prefab/presenter.js
CHANGED
|
@@ -9,14 +9,14 @@
|
|
|
9
9
|
* Usage:
|
|
10
10
|
* ```ts
|
|
11
11
|
* export default class PostPresenter extends Presenter(Post) {
|
|
12
|
-
* constructor(private
|
|
12
|
+
* constructor(private commentStorage: CommentStorage) { super(); }
|
|
13
13
|
*
|
|
14
14
|
* excerpt(post: Post) {
|
|
15
15
|
* return post.body.slice(0, 200);
|
|
16
16
|
* }
|
|
17
17
|
*
|
|
18
18
|
* async commentCount(post: Post) {
|
|
19
|
-
* return this.
|
|
19
|
+
* return this.commentStorage.countFor(post.id);
|
|
20
20
|
* }
|
|
21
21
|
* }
|
|
22
22
|
* ```
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { type EntityConstructor } from '@fougere/schema';
|
|
2
|
-
import type {
|
|
2
|
+
import type { Storage } from '../storage.js';
|
|
3
3
|
/**
|
|
4
4
|
* Repository(…entities) — who owns an entity's storage, and where its questions are named.
|
|
5
5
|
*
|
|
6
|
-
* **The arity decides**, which is the second reading of what `
|
|
7
|
-
* `
|
|
6
|
+
* **The arity decides**, which is the second reading of what `storage.ts` already states for
|
|
7
|
+
* `Storage` against `Together`: the arity of the unit is the whole distinction.
|
|
8
8
|
*
|
|
9
9
|
* ONE entity — the repository IS that entity's storage, with your methods added. The port's
|
|
10
10
|
* thirteen gestures are forwarded, so a handler reads `this.posts.list()` whether or not
|
|
@@ -28,13 +28,13 @@ import type { EntityOrm } from '../orm.js';
|
|
|
28
28
|
* // repositories/CommandeRepository.ts
|
|
29
29
|
* export default class CommandeRepository extends Repository(Commande, Stock) {
|
|
30
30
|
* avecLignes(id: string) {
|
|
31
|
-
* const [commandes, stock] = this.
|
|
31
|
+
* const [commandes, stock] = this.storages;
|
|
32
32
|
* …
|
|
33
33
|
* }
|
|
34
34
|
* }
|
|
35
35
|
* ```
|
|
36
36
|
*
|
|
37
|
-
* `this.
|
|
37
|
+
* `this.storages` is protected, because the whole point is that the storage stops at this file.
|
|
38
38
|
* `protected` is erased at runtime, like `abstract` on a port: a compile-time guarantee, not
|
|
39
39
|
* a barrier. The same bargain, already accepted.
|
|
40
40
|
*
|
|
@@ -46,12 +46,12 @@ import type { EntityOrm } from '../orm.js';
|
|
|
46
46
|
* frame is ASKED FOR here as anywhere else, which is what makes it declared:
|
|
47
47
|
*
|
|
48
48
|
* ```ts
|
|
49
|
-
* constructor(commandes:
|
|
49
|
+
* constructor(commandes: CommandeStorage, stock: StockStorage, private frame: Together<[Commande, Stock]>) {
|
|
50
50
|
* super(commandes, stock);
|
|
51
51
|
* }
|
|
52
52
|
* ```
|
|
53
53
|
*
|
|
54
|
-
* The
|
|
54
|
+
* The storage words come back in that line, and only there: this class IS the holder, which is
|
|
55
55
|
* the one case `boot/ownership.ts` lets name the storage it was built on.
|
|
56
56
|
*
|
|
57
57
|
* A repository is NOT a door: it has no façade, so nothing here is reachable from the wire.
|
|
@@ -59,13 +59,13 @@ import type { EntityOrm } from '../orm.js';
|
|
|
59
59
|
/**
|
|
60
60
|
* The shape a repository of ONE entity has — the port itself, plus whatever the subclass
|
|
61
61
|
* names on top. Written by an author who has not written the file: `RepositoryOf<Post>` is
|
|
62
|
-
* to `PostRepository` what `
|
|
62
|
+
* to `PostRepository` what `Storage<Post>` is to `PostStorage`, one spelling of one key, and
|
|
63
63
|
* `depKeyOf` reads both.
|
|
64
64
|
*/
|
|
65
|
-
export type RepositoryOf<T> =
|
|
65
|
+
export type RepositoryOf<T> = Storage<T>;
|
|
66
66
|
/** The single-entity form: the port, plus whatever the subclass names. */
|
|
67
67
|
export interface RepositoryConstructor<T> {
|
|
68
|
-
new (
|
|
68
|
+
new (storage: Storage<T>): Storage<T>;
|
|
69
69
|
readonly __entity: unknown;
|
|
70
70
|
}
|
|
71
71
|
/**
|
|
@@ -76,15 +76,15 @@ export interface RepositoryConstructor<T> {
|
|
|
76
76
|
* value it describes is fabricated by `many()` for an arity only known at the call.
|
|
77
77
|
*/
|
|
78
78
|
declare abstract class AggregateShape<E extends readonly EntityConstructor[]> {
|
|
79
|
-
protected
|
|
80
|
-
[K in keyof E]:
|
|
79
|
+
protected storages: {
|
|
80
|
+
[K in keyof E]: Storage<InstanceType<E[K]>>;
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
83
|
/** The tuple an aggregate holds — the readable form of {@link AggregateShape}'s member. */
|
|
84
84
|
export type AggregateOf<E extends readonly EntityConstructor[]> = {
|
|
85
|
-
[K in keyof E]:
|
|
85
|
+
[K in keyof E]: Storage<InstanceType<E[K]>>;
|
|
86
86
|
};
|
|
87
|
-
export type AggregateConstructor<E extends readonly EntityConstructor[]> = (new (...
|
|
87
|
+
export type AggregateConstructor<E extends readonly EntityConstructor[]> = (new (...storages: unknown[]) => AggregateShape<E>) & {
|
|
88
88
|
readonly __entity: unknown;
|
|
89
89
|
/** The entities this class owns. Present from two on — an owner of one owns nothing. */
|
|
90
90
|
readonly __owns: E;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repository.d.ts","sourceRoot":"","sources":["../../src/prefab/repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACrE,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"repository.d.ts","sourceRoot":"","sources":["../../src/prefab/repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACrE,OAAO,KAAK,EAAE,OAAO,EAAyC,MAAM,eAAe,CAAC;AAGpF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AAEH;;;;;GAKG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC;AAEzC,0EAA0E;AAC1E,MAAM,WAAW,qBAAqB,CAAC,CAAC;IACtC,KAAK,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACtC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;CAC5B;AAED;;;;;;GAMG;AACH,OAAO,CAAC,QAAQ,OAAO,cAAc,CAAC,CAAC,SAAS,SAAS,iBAAiB,EAAE;IAC1E,SAAS,CAAC,QAAQ,EAAE;SAAG,CAAC,IAAI,MAAM,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;KAAE,CAAC;CACrE;AAED,2FAA2F;AAC3F,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,SAAS,iBAAiB,EAAE,IAC5D;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,CAAC;AAElD,MAAM,MAAM,oBAAoB,CAAC,CAAC,SAAS,SAAS,iBAAiB,EAAE,IACrE,CAAC,KAAK,GAAG,QAAQ,EAAE,OAAO,EAAE,KAAK,cAAc,CAAC,CAAC,CAAC,CAAC,GAAG;IACpD,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,wFAAwF;IACxF,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;CACpB,CAAC;AAEJ,wBAAgB,UAAU,CAAC,CAAC,SAAS,iBAAiB,EAAE,MAAM,EAAE,CAAC,GAAG,qBAAqB,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;AAC3G,wBAAgB,UAAU,CAAC,CAAC,SAAS,SAAS,CAAC,iBAAiB,EAAE,iBAAiB,EAAE,GAAG,iBAAiB,EAAE,CAAC,EAC1G,GAAG,QAAQ,EAAE,CAAC,GACb,oBAAoB,CAAC,CAAC,CAAC,CAAC;AAwD3B,iFAAiF;AACjF,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,OAAO,GAAG,SAAS,iBAAiB,EAAE,CAEnE"}
|
|
@@ -9,24 +9,24 @@ export function Repository(...entities) {
|
|
|
9
9
|
*/
|
|
10
10
|
function one(entity) {
|
|
11
11
|
class RepositoryBase {
|
|
12
|
-
|
|
12
|
+
storage;
|
|
13
13
|
static __entity = entity;
|
|
14
|
-
constructor(
|
|
15
|
-
this.
|
|
14
|
+
constructor(storage) {
|
|
15
|
+
this.storage = storage;
|
|
16
16
|
}
|
|
17
|
-
list(options) { return this.
|
|
18
|
-
findById(id, options) { return this.
|
|
19
|
-
findBy(criteria, options) { return this.
|
|
20
|
-
findAllBy(criteria, options) { return this.
|
|
21
|
-
findByKeys(ids, options) { return this.
|
|
22
|
-
findAllByKeys(field, keys, options) { return this.
|
|
23
|
-
create(input, options) { return this.
|
|
24
|
-
upsert(input, options) { return this.
|
|
25
|
-
upsertAll(inputs, options) { return this.
|
|
26
|
-
update(id, input, options) { return this.
|
|
27
|
-
delete(id) { return this.
|
|
28
|
-
output(schema) { return this.
|
|
29
|
-
get client() { return this.
|
|
17
|
+
list(options) { return this.storage.list(options); }
|
|
18
|
+
findById(id, options) { return this.storage.findById(id, options); }
|
|
19
|
+
findBy(criteria, options) { return this.storage.findBy(criteria, options); }
|
|
20
|
+
findAllBy(criteria, options) { return this.storage.findAllBy(criteria, options); }
|
|
21
|
+
findByKeys(ids, options) { return this.storage.findByKeys(ids, options); }
|
|
22
|
+
findAllByKeys(field, keys, options) { return this.storage.findAllByKeys(field, keys, options); }
|
|
23
|
+
create(input, options) { return this.storage.create(input, options); }
|
|
24
|
+
upsert(input, options) { return this.storage.upsert(input, options); }
|
|
25
|
+
upsertAll(inputs, options) { return this.storage.upsertAll(inputs, options); }
|
|
26
|
+
update(id, input, options) { return this.storage.update(id, input, options); }
|
|
27
|
+
delete(id) { return this.storage.delete(id); }
|
|
28
|
+
output(schema) { return this.storage.output(schema); }
|
|
29
|
+
get client() { return this.storage.client; }
|
|
30
30
|
}
|
|
31
31
|
return RepositoryBase;
|
|
32
32
|
}
|
|
@@ -39,9 +39,9 @@ function many(entities) {
|
|
|
39
39
|
class AggregateBase {
|
|
40
40
|
static __entity = entities[0];
|
|
41
41
|
static __owns = entities;
|
|
42
|
-
|
|
43
|
-
constructor(...
|
|
44
|
-
this.
|
|
42
|
+
storages;
|
|
43
|
+
constructor(...storages) {
|
|
44
|
+
this.storages = storages.slice(0, entities.length);
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
return AggregateBase;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repository.js","sourceRoot":"","sources":["../../src/prefab/repository.ts"],"names":[],"mappings":"AA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IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;;IAGvD,OAAO,cAAqD,CAAC;AAC/D,CAAC;AAED;;;;GAIG;AACH,SAAS,IAAI,CAAyC,QAAW;IAC/D,MAAM,aAAa;QACjB,MAAM,CAAU,QAAQ,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;QACvC,MAAM,CAAU,MAAM,GAAG,QAAQ,CAAC;QAExB,QAAQ,CAAiB;QAEnC,YAAY,GAAG,QAAmB;YAChC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAmB,CAAC;QACvE,CAAC;;IAGH,OAAO,aAAmD,CAAC;AAC7D,CAAC;AAED,iFAAiF;AACjF,MAAM,UAAU,eAAe,CAAC,MAAc;IAC5C,OAAO,GAAG,UAAU,CAAC,MAAM,CAAC,YAAY,CAAC;AAC3C,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,OAAO,CAAC,IAAa;IACnC,OAAQ,IAA8D,EAAE,MAAM,IAAI,EAAE,CAAC;AACvF,CAAC"}
|
package/dist/rows.d.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The thirteen gestures of {@link Storage}, derived from four.
|
|
3
|
+
*
|
|
4
|
+
* A place rows live varies in ONE thing — how a row is fetched, written, dropped and
|
|
5
|
+
* enumerated. Everything above that is the same everywhere: what a page is, how a criterion
|
|
6
|
+
* matches, which stamps survive an upsert, and the two refusals a `create` owes its caller.
|
|
7
|
+
* Measured on the Map realization: 14 lines of 140 touched the store.
|
|
8
|
+
*
|
|
9
|
+
* So an adapter supplies {@link Rows} and receives a whole `StorageFactory`. It is the frame
|
|
10
|
+
* a third party writing a source needs — without it, `Sources.register` hands over a
|
|
11
|
+
* four-gesture contract and leaves the thirteen to be re-derived, which is how three
|
|
12
|
+
* divergent copies of the same store ended up in this repo's own demos.
|
|
13
|
+
*
|
|
14
|
+
* What is NOT here: `transacted`. A unit of work belongs to the engine that has one, and
|
|
15
|
+
* this frame has none — which is why a `Source` built on it leaves the key absent and a
|
|
16
|
+
* frame compensates.
|
|
17
|
+
*/
|
|
18
|
+
import { type SchemaView } from '@fougere/schema';
|
|
19
|
+
import type { StorageFactory } from './storage.js';
|
|
20
|
+
/** One row, as every realization hands it over. */
|
|
21
|
+
export type Row = Record<string, unknown>;
|
|
22
|
+
/**
|
|
23
|
+
* A keyed collection of rows — what an adapter supplies, and all of it.
|
|
24
|
+
*
|
|
25
|
+
* Async on purpose, even where a realization is not: a Map answers instantly and a directory
|
|
26
|
+
* does not, and the frame above cannot be written twice. `client` is what the port's own
|
|
27
|
+
* escape hatch exposes, `unknown` for the reason it is there.
|
|
28
|
+
*/
|
|
29
|
+
export interface Rows {
|
|
30
|
+
get(key: string): Promise<Row | undefined>;
|
|
31
|
+
has(key: string): Promise<boolean>;
|
|
32
|
+
set(key: string, row: Row): Promise<void>;
|
|
33
|
+
delete(key: string): Promise<boolean>;
|
|
34
|
+
/** Every row it holds. A realization that cannot answer this cheaply says so in its doc. */
|
|
35
|
+
all(): Promise<Row[]>;
|
|
36
|
+
/** Handed on as `Storage.client` — the Map, the directory, whatever it is. */
|
|
37
|
+
readonly client: unknown;
|
|
38
|
+
}
|
|
39
|
+
export declare function storageOver(open: (entity: SchemaView, name: string) => Rows): StorageFactory;
|
|
40
|
+
//# sourceMappingURL=rows.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rows.d.ts","sourceRoot":"","sources":["../src/rows.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAA6C,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7F,OAAO,KAAK,EAAW,cAAc,EAAE,MAAM,cAAc,CAAC;AAE5D,mDAAmD;AACnD,MAAM,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE1C;;;;;;GAMG;AACH,MAAM,WAAW,IAAI;IACnB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,GAAG,SAAS,CAAC,CAAC;IAC3C,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACnC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1C,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACtC,4FAA4F;IAC5F,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IACtB,8EAA8E;IAC9E,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CAC1B;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,GAAG,cAAc,CAiH5F"}
|