@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
|
@@ -69,56 +69,4 @@ export function computeBindingPlan(params, collectorTypeNames) {
|
|
|
69
69
|
};
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
|
-
/**
|
|
73
|
-
* Resolve handler arguments from a BindingPlan + InvocationContext.
|
|
74
|
-
*/
|
|
75
|
-
export async function resolveArgs(plan, ctx, resolveCollector) {
|
|
76
|
-
const args = [];
|
|
77
|
-
for (const binding of plan) {
|
|
78
|
-
switch (binding.source.kind) {
|
|
79
|
-
case 'collector': {
|
|
80
|
-
const collector = resolveCollector?.(binding.source.typeName);
|
|
81
|
-
args.push(collector ? await collector.collect(ctx) : undefined);
|
|
82
|
-
break;
|
|
83
|
-
}
|
|
84
|
-
case 'context': {
|
|
85
|
-
args.push(ctx);
|
|
86
|
-
break;
|
|
87
|
-
}
|
|
88
|
-
case 'param': {
|
|
89
|
-
// `null` is a value, not a miss. Nullish coalescing used to make an explicit
|
|
90
|
-
// nullable path/GraphQL argument fall through to query (or become undefined),
|
|
91
|
-
// collapsing `T | null` into `T | undefined`. Only undefined means absent.
|
|
92
|
-
const fromParams = ctx.params[binding.source.name];
|
|
93
|
-
let val = fromParams === undefined
|
|
94
|
-
? ctx.query[binding.source.name]
|
|
95
|
-
: fromParams;
|
|
96
|
-
if (val != null && binding.source.coerce === 'number')
|
|
97
|
-
val = Number(val);
|
|
98
|
-
if (val != null && binding.source.coerce === 'boolean')
|
|
99
|
-
val = val === 'true' || val === '1' || val === true;
|
|
100
|
-
args.push(val);
|
|
101
|
-
break;
|
|
102
|
-
}
|
|
103
|
-
case 'fact': {
|
|
104
|
-
// A fact IS the payload — the whole of what happened, never a piece of it.
|
|
105
|
-
// Identical to `body` today, and deliberately not sharing its branch: the two
|
|
106
|
-
// agree by coincidence, not by rule, and the day `body` learns to look up a
|
|
107
|
-
// value by parameter name a subscriber would receive ONE FIELD of the fact it
|
|
108
|
-
// subscribed to. Splitting it costs nothing and removes that trap.
|
|
109
|
-
args.push(ctx.body);
|
|
110
|
-
break;
|
|
111
|
-
}
|
|
112
|
-
case 'body': {
|
|
113
|
-
args.push(ctx.body);
|
|
114
|
-
break;
|
|
115
|
-
}
|
|
116
|
-
case 'query': {
|
|
117
|
-
args.push(ctx.query);
|
|
118
|
-
break;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
return args;
|
|
123
|
-
}
|
|
124
72
|
//# sourceMappingURL=binding.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"binding.js","sourceRoot":"","sources":["../../src/wire/binding.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AA6B7C,iDAAiD;AAEjD,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;AAE5D,SAAS,WAAW,CAAC,QAAgB;IACnC,IAAI,QAAQ,KAAK,QAAQ;QAAE,OAAO,QAAQ,CAAC;IAC3C,IAAI,QAAQ,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC7C,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,iDAAiD;AAEjD;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAChC,MAAe,EACf,kBAA+B;IAE/B,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;QAC1B,MAAM,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;QACjC,8EAA8E;QAC9E,iFAAiF;QACjF,mFAAmF;QACnF,MAAM,OAAO,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC;QAErC,oFAAoF;QACpF,qFAAqF;QACrF,iCAAiC;QACjC,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,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AE,KAAK,CAAC,IAAI;YAChB,MAAM,EAAE,EAAE,IAAI,EAAE,MAAe,EAAE;YACjC,QAAQ,EAAE,KAAK,CAAC,QAAQ,IAAI,KAAK;SAClC,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/wire/call.d.ts
CHANGED
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { type SchemaDescriptor } from '@fougere/schema';
|
|
10
10
|
import type { InvocationContext } from '../contract/Invocation.js';
|
|
11
|
-
import type { App } from '../boot/types.js';
|
|
12
11
|
/** Target of a call — which façade operation, wherever it lives. */
|
|
13
12
|
export interface FrondCall {
|
|
14
13
|
/** Frond name, when the caller knows it. Routing hint only. */
|
|
@@ -173,8 +172,9 @@ export interface TopologyReport {
|
|
|
173
172
|
* only where one is consumed.
|
|
174
173
|
*/
|
|
175
174
|
export declare function assertIdentityCard(value: unknown, source: string): IdentityCard;
|
|
175
|
+
/** A façade as the runtime holds it: op names to functions, nothing typed about them. */
|
|
176
176
|
/**
|
|
177
|
-
* The door built in front of a handler — the framework's second port, after `
|
|
177
|
+
* The door built in front of a handler — the framework's second port, after `Storage`.
|
|
178
178
|
*
|
|
179
179
|
* `Facade<PostHandler>` is what a neighbouring frond injects. It names what ARRIVES
|
|
180
180
|
* rather than what is written: never the handler (nobody injects it, and its methods take
|
|
@@ -211,42 +211,4 @@ export declare function facadeKeyOf(entityName: string, surface?: string): strin
|
|
|
211
211
|
* audience.
|
|
212
212
|
*/
|
|
213
213
|
export declare function contractsKeyOf(entityName: string, surface?: string): string;
|
|
214
|
-
/**
|
|
215
|
-
* Serialize what the app hosts, for one audience. Served on `rpc.discover`,
|
|
216
|
-
* cached by callers.
|
|
217
|
-
*
|
|
218
|
-
* Hosting means answering: an entity with no façade declares no operation, so
|
|
219
|
-
* it is not among the DOORS — publishing its shape would hand an anonymous caller
|
|
220
|
-
* the structure of tables it can never reach (the auth tables, typically), and
|
|
221
|
-
* `fougere sync` would rebuild a schema with nothing to call on it.
|
|
222
|
-
*
|
|
223
|
-
* `facts` is the one thing that shape-without-a-door rule does not cover, and the
|
|
224
|
-
* reason is the opposite of a leak: an entity nobody exposed is silent, whereas a
|
|
225
|
-
* fact was explicitly declared to leave.
|
|
226
|
-
*
|
|
227
|
-
* `surface` makes that sentence audience-aware rather than app-wide: a door
|
|
228
|
-
* answers with what IT serves. Nothing falls back to the full façade — under a
|
|
229
|
-
* named surface, an entity with no façade of its own is simply not there.
|
|
230
|
-
*/
|
|
231
|
-
export declare function identityCardOf(app: App, surface?: string): IdentityCard;
|
|
232
|
-
/**
|
|
233
|
-
* Build the local runner — the reference realization of Transport.
|
|
234
|
-
*
|
|
235
|
-
* Resolves strictly from the app's own container: a call that lands here is
|
|
236
|
-
* judged here. A miss is a typed NOT_FOUND, never a forward to another remote.
|
|
237
|
-
*/
|
|
238
|
-
export declare function createLocalRunner(app: App, surface?: string): Transport;
|
|
239
|
-
/**
|
|
240
|
-
* Build the app runner — same judgment, but resolution follows the app's
|
|
241
|
-
* topology: local façades and remote doublures alike. This is the runner
|
|
242
|
-
* an app's own entry points (browser endpoint, bridges) stand on.
|
|
243
|
-
*
|
|
244
|
-
* `surface` is the audience this runner serves, and it belongs to the DOOR that
|
|
245
|
-
* builds the runner, never to the call: a caller cannot name its own audience
|
|
246
|
-
* any more than it can name its own identity (`state` is stamped server-side
|
|
247
|
-
* for the same reason). Reaching the admin door IS the proof. So `FrondCall`
|
|
248
|
-
* gains nothing and the wire format gains nothing — a remote frond's audience
|
|
249
|
-
* is simply which URL `remotes:` points at.
|
|
250
|
-
*/
|
|
251
|
-
export declare function createAppRunner(app: App, surface?: string): Transport;
|
|
252
214
|
//# sourceMappingURL=call.d.ts.map
|
package/dist/wire/call.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"call.d.ts","sourceRoot":"","sources":["../../src/wire/call.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EA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AAM,CAAC;IACf,MAAM,EAAE,cAAc,EAAE,CAAC;IACzB,KAAK,EAAE,IAAI,EAAE,CAAC;CACf;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,YAAY,CAS/E;AAYD,yFAAyF;AAEzF;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,MAAM,CAAC,CAAC,IAAI;KACrB,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,KAAK,EAAE,KAAK,MAAM,CAAC,GACtD,CAAC,UAAU,CAAC,EAAE,iBAAiB,KAAK,CAAC,GACrC,KAAK;CACV,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAExE;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAE3E"}
|
package/dist/wire/call.js
CHANGED
|
@@ -1,15 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Call contract — a frond call is a value.
|
|
3
|
-
*
|
|
4
|
-
* (frond, entity, op, invocation) → result, or a thrown FougereError.
|
|
5
|
-
* A transport is a function that executes this call elsewhere; the local
|
|
6
|
-
* runner below is the reference realization. Transports move the value,
|
|
7
|
-
* they never reshape it.
|
|
8
|
-
*/
|
|
9
|
-
import { Card } from '@fougere/schema';
|
|
10
|
-
import { factsAnnouncedBy } from '../emit.js';
|
|
11
1
|
import { FougereError, ErrorCode } from './errors.js';
|
|
12
|
-
import { createTransportEntry } from '../entry/TransportEntry.js';
|
|
13
2
|
/** Reserved namespace — calls the runner answers itself, never a façade. */
|
|
14
3
|
/**
|
|
15
4
|
* What a receiver accepts before it stops reading a body.
|
|
@@ -81,118 +70,4 @@ export function facadeKeyOf(entityName, surface) {
|
|
|
81
70
|
export function contractsKeyOf(entityName, surface) {
|
|
82
71
|
return `${facadeKeyOf(entityName, surface)}:contracts`;
|
|
83
72
|
}
|
|
84
|
-
/**
|
|
85
|
-
* Serialize what the app hosts, for one audience. Served on `rpc.discover`,
|
|
86
|
-
* cached by callers.
|
|
87
|
-
*
|
|
88
|
-
* Hosting means answering: an entity with no façade declares no operation, so
|
|
89
|
-
* it is not among the DOORS — publishing its shape would hand an anonymous caller
|
|
90
|
-
* the structure of tables it can never reach (the auth tables, typically), and
|
|
91
|
-
* `fougere sync` would rebuild a schema with nothing to call on it.
|
|
92
|
-
*
|
|
93
|
-
* `facts` is the one thing that shape-without-a-door rule does not cover, and the
|
|
94
|
-
* reason is the opposite of a leak: an entity nobody exposed is silent, whereas a
|
|
95
|
-
* fact was explicitly declared to leave.
|
|
96
|
-
*
|
|
97
|
-
* `surface` makes that sentence audience-aware rather than app-wide: a door
|
|
98
|
-
* answers with what IT serves. Nothing falls back to the full façade — under a
|
|
99
|
-
* named surface, an entity with no façade of its own is simply not there.
|
|
100
|
-
*/
|
|
101
|
-
export function identityCardOf(app, surface) {
|
|
102
|
-
const declared = app.fronds.schemas();
|
|
103
|
-
return {
|
|
104
|
-
fronds: app.fronds.map((frond) => {
|
|
105
|
-
// What the frond answers to, not what it stores. This walked `frond.entities`, so a
|
|
106
|
-
// handler carrying no entity — a health check, a search across shapes — was built,
|
|
107
|
-
// served, and absent from the card: `sync` could not generate its door and a remote
|
|
108
|
-
// consumer had no way to know it existed. The boot has said "pointing at nothing is
|
|
109
|
-
// legal" since handlers became the subject; the card had not caught up.
|
|
110
|
-
const byEntity = new Map(frond.entities.map((entity) => [entity.name, entity]));
|
|
111
|
-
const addresses = [...new Set([
|
|
112
|
-
...frond.entities.map((entity) => entity.name),
|
|
113
|
-
...frond.handlers.map((handler) => handler.address),
|
|
114
|
-
])];
|
|
115
|
-
return {
|
|
116
|
-
name: frond.name,
|
|
117
|
-
doors: addresses.flatMap((address) => {
|
|
118
|
-
const ops = facadeOps(app, address, surface);
|
|
119
|
-
if (ops.length === 0)
|
|
120
|
-
return [];
|
|
121
|
-
const entity = byEntity.get(address);
|
|
122
|
-
return [{
|
|
123
|
-
name: address,
|
|
124
|
-
ops,
|
|
125
|
-
// Absent when nothing of that name is stored. A door is still a door.
|
|
126
|
-
...(entity ? { schema: Card.fromSchema(entity.entityClass, address).descriptor } : {}),
|
|
127
|
-
}];
|
|
128
|
-
}),
|
|
129
|
-
/**
|
|
130
|
-
* What leaves on its own — the same list on every surface, deliberately.
|
|
131
|
-
*
|
|
132
|
-
* A door has an audience; a fact does not. `Emit<T>` names a subject and *the
|
|
133
|
-
* number of readers is not the emitter's business* (`emit.ts`), so narrowing this
|
|
134
|
-
* by `surface` would invent an axis the primitive refuses. The consequence is
|
|
135
|
-
* stated rather than hidden: a fact's SHAPE is readable by anyone who can read the
|
|
136
|
-
* card at all. What must not be published must not be announced.
|
|
137
|
-
*/
|
|
138
|
-
facts: factsAnnouncedBy(frond.handlers).map((name) => {
|
|
139
|
-
const entityClass = declared.get(name);
|
|
140
|
-
return { name, ...(entityClass ? { schema: Card.fromSchema(entityClass, name).descriptor } : {}) };
|
|
141
|
-
}),
|
|
142
|
-
};
|
|
143
|
-
}),
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
function facadeOps(app, entityName, surface) {
|
|
147
|
-
let facade;
|
|
148
|
-
try {
|
|
149
|
-
facade = app.container.resolve(facadeKeyOf(entityName, surface));
|
|
150
|
-
}
|
|
151
|
-
catch {
|
|
152
|
-
return [];
|
|
153
|
-
}
|
|
154
|
-
// The façade is the list of names; the model is the resolved terms.
|
|
155
|
-
const effective = app.operationsFor(entityName, surface);
|
|
156
|
-
if (!effective) {
|
|
157
|
-
throw new Error(`Facade '${facadeKeyOf(entityName, surface)}' exists without an effective operation table.`);
|
|
158
|
-
}
|
|
159
|
-
return Object.keys(facade).map((name) => {
|
|
160
|
-
const contract = effective.get(name);
|
|
161
|
-
if (!contract) {
|
|
162
|
-
throw new Error(`Facade '${facadeKeyOf(entityName, surface)}' serves '${name}' without an effective contract.`);
|
|
163
|
-
}
|
|
164
|
-
return {
|
|
165
|
-
name,
|
|
166
|
-
...(contract?.description && { description: contract.description }),
|
|
167
|
-
...(contract?.input && { input: Card.fromSchema(contract.input, name).descriptor }),
|
|
168
|
-
...(contract?.output && { output: Card.fromSchema(contract.output, name).descriptor }),
|
|
169
|
-
...(contract?.cardinality && { cardinality: contract.cardinality }),
|
|
170
|
-
kind: contract.kind,
|
|
171
|
-
};
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* Build the local runner — the reference realization of Transport.
|
|
176
|
-
*
|
|
177
|
-
* Resolves strictly from the app's own container: a call that lands here is
|
|
178
|
-
* judged here. A miss is a typed NOT_FOUND, never a forward to another remote.
|
|
179
|
-
*/
|
|
180
|
-
export function createLocalRunner(app, surface) {
|
|
181
|
-
return createTransportEntry(app.local, surface);
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* Build the app runner — same judgment, but resolution follows the app's
|
|
185
|
-
* topology: local façades and remote doublures alike. This is the runner
|
|
186
|
-
* an app's own entry points (browser endpoint, bridges) stand on.
|
|
187
|
-
*
|
|
188
|
-
* `surface` is the audience this runner serves, and it belongs to the DOOR that
|
|
189
|
-
* builds the runner, never to the call: a caller cannot name its own audience
|
|
190
|
-
* any more than it can name its own identity (`state` is stamped server-side
|
|
191
|
-
* for the same reason). Reaching the admin door IS the proof. So `FrondCall`
|
|
192
|
-
* gains nothing and the wire format gains nothing — a remote frond's audience
|
|
193
|
-
* is simply which URL `remotes:` points at.
|
|
194
|
-
*/
|
|
195
|
-
export function createAppRunner(app, surface) {
|
|
196
|
-
return createTransportEntry(app, surface);
|
|
197
|
-
}
|
|
198
73
|
//# sourceMappingURL=call.js.map
|
package/dist/wire/call.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"call.js","sourceRoot":"","sources":["../../src/wire/call.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"call.js","sourceRoot":"","sources":["../../src/wire/call.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAetD,4EAA4E;AAC5E;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,GAAG,IAAI,CAAC;AAE1C,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,CAAC;AAqIhC;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAc,EAAE,MAAc;IAC/D,MAAM,IAAI,GAAG,KAAiC,CAAC;IAC/C,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;IACrE,IAAI,CAAC,MAAM;QAAE,MAAM,WAAW,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;IAC1D,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;YAAE,MAAM,WAAW,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAAC;QAChG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC;YAAE,MAAM,WAAW,CAAC,MAAM,EAAE,UAAU,KAAK,CAAC,IAAI,4BAA4B,CAAC,CAAC;IAC/G,CAAC;IACD,OAAO,IAAoB,CAAC;AAC9B,CAAC;AAED,SAAS,WAAW,CAAC,MAAc,EAAE,IAAY;IAC/C,OAAO,IAAI,YAAY,CAAC;QACtB,IAAI,EAAE,SAAS,CAAC,cAAc;QAC9B,OAAO,EACL,GAAG,MAAM,uCAAuC,IAAI,KAAK;cACvD,mGAAmG;cACnG,+FAA+F;KACpG,CAAC,CAAC;AACL,CAAC;AAwBD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,WAAW,CAAC,UAAkB,EAAE,OAAgB;IAC9D,OAAO,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,IAAI,UAAU,SAAS,CAAC,CAAC,CAAC,GAAG,UAAU,SAAS,CAAC;AAC9E,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAAC,UAAkB,EAAE,OAAgB;IACjE,OAAO,GAAG,WAAW,CAAC,UAAU,EAAE,OAAO,CAAC,YAAY,CAAC;AACzD,CAAC"}
|
package/dist/wire/operation.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { SchemaView } from '@fougere/schema';
|
|
2
|
-
import type { BindingPlan } from '
|
|
3
|
-
import type {
|
|
4
|
-
import type { ParsedMethod, ParsedType, ParsedParam } from '../scan/handler-parser.js';
|
|
2
|
+
import type { BindingPlan } from './binding.js';
|
|
3
|
+
import type { Signature, TypeRef, Param } from './signature.js';
|
|
5
4
|
/**
|
|
6
5
|
* The contract of one operation — everything the façade needs to serve a call.
|
|
7
6
|
*
|
|
@@ -44,7 +43,7 @@ export interface OperationContract {
|
|
|
44
43
|
* private material: a prefab fills it too, from signatures it wrote itself. `binding`
|
|
45
44
|
* still wins on where an argument comes from.
|
|
46
45
|
*/
|
|
47
|
-
signature?:
|
|
46
|
+
signature?: Signature;
|
|
48
47
|
}
|
|
49
48
|
/**
|
|
50
49
|
* Read an op's cardinality off its parsed return type.
|
|
@@ -53,10 +52,10 @@ export interface OperationContract {
|
|
|
53
52
|
* `Array<T>`, so it must be recognised BEFORE the array test or a page would read as
|
|
54
53
|
* a plain list and lose its `total`/`hasMore`.
|
|
55
54
|
*/
|
|
56
|
-
export declare function cardinalityOf(type:
|
|
55
|
+
export declare function cardinalityOf(type: TypeRef | undefined): OperationContract['cardinality'];
|
|
57
56
|
/** Map of operation name → its contract. */
|
|
58
57
|
export type OperationsMap = Map<string, OperationContract>;
|
|
59
|
-
export type {
|
|
58
|
+
export type { TypeRef, Param };
|
|
60
59
|
export type OperationKind = 'query' | 'command';
|
|
61
60
|
/** The convention's evidence, including both sides when a composed name contradicts itself. */
|
|
62
61
|
export interface OperationKindInference {
|
|
@@ -88,29 +87,4 @@ export declare function isReadOp(name: string): boolean;
|
|
|
88
87
|
export declare function resolveIsReadOp(name: string, overrides?: Record<string, {
|
|
89
88
|
kind?: OperationKind;
|
|
90
89
|
}>): boolean;
|
|
91
|
-
/**
|
|
92
|
-
* The contract of every operation a handler serves — the three producers, merged once.
|
|
93
|
-
*
|
|
94
|
-
* This lived inline in `buildFacade`, which made the façade the only thing that could
|
|
95
|
-
* answer "what is this op's contract, really?". Anything else asking — a checker, a
|
|
96
|
-
* client generator, a descriptor — had to redo the merge, and a second opinion that
|
|
97
|
-
* drifts reports nothing wrong while looking at the wrong thing.
|
|
98
|
-
*
|
|
99
|
-
* The order is a claim about authority, not a convenience:
|
|
100
|
-
*
|
|
101
|
-
* 1. a prefab DECLARES what it built (`Crud(E).__ops`) — runtime, so it survives a
|
|
102
|
-
* scan that resolved nothing;
|
|
103
|
-
* 2. the scan DERIVES from source — a method written in this very file is the
|
|
104
|
-
* author's own word and beats everything; a method it merely READ on a base
|
|
105
|
-
* class is a guess about someone else's code, and yields to that code's own
|
|
106
|
-
* declaration;
|
|
107
|
-
* 3. `frond.config.ts` STATES — the most explicit statement, made by whoever
|
|
108
|
-
* assembles the app, and the only answer for an op inherited from an installed
|
|
109
|
-
* base class the workspace-only scan cannot see. Merged per key, so stating a
|
|
110
|
-
* `binding` alone does not erase an `input` the scan found.
|
|
111
|
-
*
|
|
112
|
-
* Pure: no container, no instance, no disk. The binding plan is resolved here, so
|
|
113
|
-
* nothing downstream ever meets an AST.
|
|
114
|
-
*/
|
|
115
|
-
export declare function resolveContracts(handler: Pick<HandlerEntry, 'ctor' | 'operations'>, overrides: FrondDescriptor['operationsOverrides'], collectorTypeNames: Set<string>): OperationsMap;
|
|
116
90
|
//# sourceMappingURL=operation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operation.d.ts","sourceRoot":"","sources":["../../src/wire/operation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"operation.d.ts","sourceRoot":"","sources":["../../src/wire/operation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEhE;;;;;;;GAOG;AACH,MAAM,WAAW,iBAAiB;IAChC,iFAAiF;IACjF,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,gCAAgC;IAChC,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,0DAA0D;IAC1D,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;;;;;;;OAWG;IACH,WAAW,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;IACzD;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,OAAO,GAAG,SAAS,GAAG,iBAAiB,CAAC,aAAa,CAAC,CAQzF;AAKD,4CAA4C;AAC5C,MAAM,MAAM,aAAa,GAAG,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAE3D,YAAY,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;AAQ/B,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,SAAS,CAAC;AAEhD,+FAA+F;AAC/F,MAAM,WAAW,sBAAsB;IACrC,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B;AA2BD,oFAAoF;AACpF,wBAAgB,UAAU,IAAI;IAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,CAEnE;AAYD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,sBAAsB,CA4BvE;AAED,qFAAqF;AACrF,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,EACZ,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,IAAI,CAAC,EAAE,aAAa,CAAA;CAAE,CAAC,GACnD,aAAa,GAAG,SAAS,CAE3B;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE9C;AAED,sFAAsF;AACtF,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,IAAI,CAAC,EAAE,aAAa,CAAA;CAAE,CAAC,GACnD,OAAO,CAET"}
|
package/dist/wire/operation.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { computeBindingPlan } from '../boot/binding.js';
|
|
2
1
|
/**
|
|
3
2
|
* Read an op's cardinality off its parsed return type.
|
|
4
3
|
*
|
|
@@ -114,54 +113,4 @@ function requireOperationKind(name, overrides) {
|
|
|
114
113
|
throw new Error(`Cannot infer operation kind from '${name}'. `
|
|
115
114
|
+ `Declare operations.${name}.kind as 'query' or 'command' in frond.config.ts.`);
|
|
116
115
|
}
|
|
117
|
-
/**
|
|
118
|
-
* The contract of every operation a handler serves — the three producers, merged once.
|
|
119
|
-
*
|
|
120
|
-
* This lived inline in `buildFacade`, which made the façade the only thing that could
|
|
121
|
-
* answer "what is this op's contract, really?". Anything else asking — a checker, a
|
|
122
|
-
* client generator, a descriptor — had to redo the merge, and a second opinion that
|
|
123
|
-
* drifts reports nothing wrong while looking at the wrong thing.
|
|
124
|
-
*
|
|
125
|
-
* The order is a claim about authority, not a convenience:
|
|
126
|
-
*
|
|
127
|
-
* 1. a prefab DECLARES what it built (`Crud(E).__ops`) — runtime, so it survives a
|
|
128
|
-
* scan that resolved nothing;
|
|
129
|
-
* 2. the scan DERIVES from source — a method written in this very file is the
|
|
130
|
-
* author's own word and beats everything; a method it merely READ on a base
|
|
131
|
-
* class is a guess about someone else's code, and yields to that code's own
|
|
132
|
-
* declaration;
|
|
133
|
-
* 3. `frond.config.ts` STATES — the most explicit statement, made by whoever
|
|
134
|
-
* assembles the app, and the only answer for an op inherited from an installed
|
|
135
|
-
* base class the workspace-only scan cannot see. Merged per key, so stating a
|
|
136
|
-
* `binding` alone does not erase an `input` the scan found.
|
|
137
|
-
*
|
|
138
|
-
* Pure: no container, no instance, no disk. The binding plan is resolved here, so
|
|
139
|
-
* nothing downstream ever meets an AST.
|
|
140
|
-
*/
|
|
141
|
-
export function resolveContracts(handler, overrides, collectorTypeNames) {
|
|
142
|
-
const declared = handler.ctor.__ops ?? {};
|
|
143
|
-
const contracts = new Map(Object.entries(declared));
|
|
144
|
-
for (const [opName, scanned] of handler.operations) {
|
|
145
|
-
if (scanned.signature?.inherited && opName in declared)
|
|
146
|
-
continue;
|
|
147
|
-
contracts.set(opName, {
|
|
148
|
-
...scanned,
|
|
149
|
-
binding: scanned.binding
|
|
150
|
-
?? (scanned.signature ? computeBindingPlan(scanned.signature.params, collectorTypeNames) : undefined),
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
for (const [opName, override] of Object.entries(overrides ?? {})) {
|
|
154
|
-
const { input, output, binding, description } = override;
|
|
155
|
-
if (input === undefined && output === undefined && binding === undefined && description === undefined)
|
|
156
|
-
continue;
|
|
157
|
-
contracts.set(opName, {
|
|
158
|
-
...contracts.get(opName),
|
|
159
|
-
...(input !== undefined && { input }),
|
|
160
|
-
...(output !== undefined && { output }),
|
|
161
|
-
...(binding !== undefined && { binding }),
|
|
162
|
-
...(description !== undefined && { description }),
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
return contracts;
|
|
166
|
-
}
|
|
167
116
|
//# sourceMappingURL=operation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operation.js","sourceRoot":"","sources":["../../src/wire/operation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"operation.js","sourceRoot":"","sources":["../../src/wire/operation.ts"],"names":[],"mappings":"AAiDA;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,IAAyB;IACrD,IAAI,CAAC,IAAI;QAAE,OAAO,SAAS,CAAC;IAC5B,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAClE,IAAI,CAAC,KAAK;QAAE,OAAO,MAAM,CAAC;IAC1B,IAAI,KAAK,CAAC,IAAI,KAAK,YAAY;QAAE,OAAO,MAAM,CAAC;IAC/C,IAAI,KAAK,CAAC,KAAK;QAAE,OAAO,MAAM,CAAC;IAC/B,IAAI,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC;QAAE,OAAO,MAAM,CAAC;IACrD,OAAO,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;AAC7D,CAAC;AAED,iFAAiF;AACjF,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC;AAsB1G;;;;GAIG;AACH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C,IAAI,KAAK;UAC5C,sBAAsB,IAAI,mDAAmD,CAChF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A method's signature, as a contract is built from it — the shape, never the reading.
|
|
3
|
+
*
|
|
4
|
+
* The scan derives one from source; `frond.config.ts` states one. Neither owns the shape.
|
|
5
|
+
*/
|
|
6
|
+
/** A type reference — primitives, entities, arrays, generics. */
|
|
7
|
+
export interface TypeRef {
|
|
8
|
+
/** Raw type text as written in source (e.g. 'Pagination<Post>'). */
|
|
9
|
+
raw: string;
|
|
10
|
+
/** Base type name (e.g. 'Pagination', 'string', 'Post'). */
|
|
11
|
+
name: string;
|
|
12
|
+
/** Whether this is an array (T[] or Array<T>) — true at any depth. */
|
|
13
|
+
array?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* How MANY array levels: `string[]` is 1, `string[][]` is 2. `array` only ever said
|
|
16
|
+
* "at least one", which sufficed while one level meant one thing. It stopped sufficing
|
|
17
|
+
* when a presenter method started taking the page — there the outer level IS the page
|
|
18
|
+
* and what remains is the field, so telling `string[]` from `string[][]` is telling a
|
|
19
|
+
* computed string from a computed list.
|
|
20
|
+
*/
|
|
21
|
+
arrayDepth?: number;
|
|
22
|
+
/** Generic type arguments (e.g. for Pagination<Post> → [{ name: 'Post' }]). */
|
|
23
|
+
generics?: TypeRef[];
|
|
24
|
+
/** Whether `null` belongs to the type. */
|
|
25
|
+
nullable?: boolean;
|
|
26
|
+
/** Whether absence (`undefined` or `void`) belongs to the type. */
|
|
27
|
+
undefined?: boolean;
|
|
28
|
+
/** Whether this is a Promise wrapper (unwrapped in output). */
|
|
29
|
+
promise?: boolean;
|
|
30
|
+
}
|
|
31
|
+
/** One parameter of a signature. */
|
|
32
|
+
export interface Param {
|
|
33
|
+
name: string;
|
|
34
|
+
type: TypeRef;
|
|
35
|
+
optional?: boolean;
|
|
36
|
+
}
|
|
37
|
+
/** A method signature. */
|
|
38
|
+
export interface Signature {
|
|
39
|
+
name: string;
|
|
40
|
+
params: Param[];
|
|
41
|
+
returnType?: TypeRef;
|
|
42
|
+
/**
|
|
43
|
+
* Came from a base class, not from the file being scanned. What a prefab
|
|
44
|
+
* handler declares about its own ops beats this — the scan reads a signature
|
|
45
|
+
* and guesses, the builder knows.
|
|
46
|
+
*/
|
|
47
|
+
inherited?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* The operation in words — the first sentence of the method's doc comment.
|
|
50
|
+
*
|
|
51
|
+
* Not a new thing to write: handlers already carry it (`/** Judge: the author,
|
|
52
|
+
* a draft… */`), the AST already holds it, and nothing read it. A caller that
|
|
53
|
+
* discovers an operation over the wire has its name and its schema; what the
|
|
54
|
+
* operation is FOR lived only in the source.
|
|
55
|
+
*/
|
|
56
|
+
description?: string;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=signature.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signature.d.ts","sourceRoot":"","sources":["../../src/wire/signature.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,iEAAiE;AACjE,MAAM,WAAW,OAAO;IACtB,oEAAoE;IACpE,GAAG,EAAE,MAAM,CAAC;IACZ,4DAA4D;IAC5D,IAAI,EAAE,MAAM,CAAC;IACb,sEAAsE;IACtE,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;IACrB,0CAA0C;IAC1C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,mEAAmE;IACnE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,+DAA+D;IAC/D,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,oCAAoC;AACpC,MAAM,WAAW,KAAK;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,0BAA0B;AAC1B,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signature.js","sourceRoot":"","sources":["../../src/wire/signature.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fougere/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0-alpha.0",
|
|
4
4
|
"description": "The core — scan, call contract, façades, remote stand-ins.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fougere",
|
|
@@ -56,8 +56,8 @@
|
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"@typescript/typescript6": "^6.0.2",
|
|
58
58
|
"dequal": "^2.0.3",
|
|
59
|
-
"@fougere/container": "0.
|
|
60
|
-
"@fougere/schema": "0.
|
|
59
|
+
"@fougere/container": "0.6.0-alpha.0",
|
|
60
|
+
"@fougere/schema": "0.6.0-alpha.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@types/node": "^22.0.0"
|
package/src/boot/Emissions.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { emitKeyOf, factsAnnouncedBy } from '../emit.js';
|
|
|
5
5
|
import { ambient } from '#ambient';
|
|
6
6
|
import { EMPTY_INVOCATION } from '../contract/Invocation.js';
|
|
7
7
|
import type { Logger } from '../builtins/logger.js';
|
|
8
|
-
import type { Fronds } from '../
|
|
8
|
+
import type { Fronds } from '../descriptor/Fronds.js';
|
|
9
9
|
import type { OperationsMap } from '../wire/operation.js';
|
|
10
10
|
|
|
11
11
|
/** A door and the op on it that accepts a fact. */
|
|
@@ -183,7 +183,7 @@ export class Emissions {
|
|
|
183
183
|
* The announcement realizes the fact's own `lifecycle.create` — a `created()` stamped,
|
|
184
184
|
* an id generated, a default applied.
|
|
185
185
|
*
|
|
186
|
-
* `applyCreate` (`schema/src/axis/lifecycle/apply.ts`) is where the split is realized:
|
|
186
|
+
* `applyCreate` (`schema/src/schema/axis/lifecycle/apply.ts`) is where the split is realized:
|
|
187
187
|
* the judge never fills a hole, the STORAGE does, at the point of persistence. A fact has no storage, so nobody did — the judge declared an
|
|
188
188
|
* absent `created()` legal and omitted it, and a subscriber received a value missing a
|
|
189
189
|
* field its own type promises. Announcing is a fact's point of persistence.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { lowerFirst, type Fields } from '@fougere/schema';
|
|
2
2
|
import type { Container } from '@fougere/container';
|
|
3
3
|
import type { AppMiddleware } from '../wire/middleware.js';
|
|
4
|
-
import type { CollectorResolver } from '
|
|
4
|
+
import type { CollectorResolver } from '../dispatch/ArgumentResolver.js';
|
|
5
5
|
import { collectorKeyOf } from '../prefab/collector.js';
|
|
6
6
|
import { presenterKeyOf } from '../prefab/presenter.js';
|
|
7
7
|
import { repositoryKeyOf } from '../prefab/repository.js';
|
|
@@ -11,7 +11,7 @@ import type { EffectiveOperation, EffectiveOperationsMap } from '../effective-op
|
|
|
11
11
|
import type { InvocationContext } from '../contract/Invocation.js';
|
|
12
12
|
import type { Emissions } from './Emissions.js';
|
|
13
13
|
import type { Logger } from '../builtins/logger.js';
|
|
14
|
-
import type { EntityEntry, HandlerEntry, PresenterEntry } from '../
|
|
14
|
+
import type { EntityEntry, HandlerEntry, PresenterEntry } from '../descriptor/frond.js';
|
|
15
15
|
import { InputValidator } from '../dispatch/InputValidator.js';
|
|
16
16
|
import { ArgumentResolver } from '../dispatch/ArgumentResolver.js';
|
|
17
17
|
import { OperationExecutor } from '../dispatch/OperationExecutor.js';
|
|
@@ -106,7 +106,7 @@ export class HandlerFacade {
|
|
|
106
106
|
if (this.inheritsCrud(handler) && !entity) {
|
|
107
107
|
// An installed Crud subject may be absent from the local scan.
|
|
108
108
|
wiring.log.debug(`${handler.ctor.name} extends Crud() and no scanned entity is named `
|
|
109
|
-
+ `'${this.subjectOf(handler)}' — installed entity, or a missing one: no
|
|
109
|
+
+ `'${this.subjectOf(handler)}' — installed entity, or a missing one: no storage will be injected`);
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
|
package/src/boot/auth.ts
CHANGED
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
* the contract between core and an `@fougere/auth-*` package.
|
|
4
4
|
*/
|
|
5
5
|
import type { SchemaView } from '@fougere/schema';
|
|
6
|
-
import type {
|
|
6
|
+
import type { Storage, StorageFactory } from '../storage.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Lazy auth declaration written in fougere.config.ts.
|
|
10
10
|
*
|
|
11
11
|
* Each @fougere/auth-* package exports a factory (e.g. `betterAuth(opts)`) that
|
|
12
12
|
* returns this shape. The `create()` method is called once at boot with the
|
|
13
|
-
* resolved db +
|
|
13
|
+
* resolved db + storageFactory, so the provider can wire its engine through Fougere.
|
|
14
14
|
*/
|
|
15
15
|
export interface AuthConfig {
|
|
16
16
|
/** Build the runtime — invoked by createApp at boot with the resolved storage handles. */
|
|
@@ -29,8 +29,8 @@ export interface AuthConfig {
|
|
|
29
29
|
export interface AuthContext {
|
|
30
30
|
/** Storage handle (Kysely DB instance, Prisma client, etc.) — opaque to core. */
|
|
31
31
|
db: unknown;
|
|
32
|
-
/** Per-entity
|
|
33
|
-
|
|
32
|
+
/** Per-entity storage factory — auth provider uses this to back its adapter. */
|
|
33
|
+
storageFactory: StorageFactory;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
/**
|
|
@@ -43,9 +43,9 @@ export interface AuthRuntime {
|
|
|
43
43
|
/**
|
|
44
44
|
* Per-entity ORMs the provider built for itself. Exposed so app code can
|
|
45
45
|
* query auth tables (e.g. list active sessions for a user) without rebuilding
|
|
46
|
-
* the same
|
|
46
|
+
* the same Storage.
|
|
47
47
|
*/
|
|
48
|
-
|
|
48
|
+
storages: Record<string, Storage>;
|
|
49
49
|
/** Web Standard handler that processes /auth/* requests. */
|
|
50
50
|
handler: (request: Request) => Promise<Response>;
|
|
51
51
|
/** Programmatic API exposed by the provider (getSession, signOut, ...). */
|