@fougere/core 0.12.2-alpha.0 → 0.12.5-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/EffectiveOperationModel.d.ts +1 -4
- package/dist/EffectiveOperationModel.d.ts.map +1 -1
- package/dist/EffectiveOperationModel.js +181 -173
- package/dist/EffectiveOperationModel.js.map +1 -1
- package/dist/FougereConfig.d.ts +2 -3
- package/dist/FougereConfig.d.ts.map +1 -1
- package/dist/FougereConfig.js +11 -13
- package/dist/FougereConfig.js.map +1 -1
- package/dist/FrondDeclaration.d.ts +5 -0
- package/dist/FrondDeclaration.d.ts.map +1 -1
- package/dist/FrondDeclaration.js +4 -5
- package/dist/FrondDeclaration.js.map +1 -1
- package/dist/FrondsStated.d.ts +4 -2
- package/dist/FrondsStated.d.ts.map +1 -1
- package/dist/FrondsStated.js.map +1 -1
- package/dist/Source.js +1 -1
- package/dist/Source.js.map +1 -1
- package/dist/SourceView.d.ts +0 -2
- package/dist/SourceView.d.ts.map +1 -1
- package/dist/StatedFrond.d.ts +3 -0
- package/dist/StatedFrond.d.ts.map +1 -1
- package/dist/StatedFrond.js +4 -0
- package/dist/StatedFrond.js.map +1 -1
- package/dist/StatedModules.d.ts +5 -2
- package/dist/StatedModules.d.ts.map +1 -1
- package/dist/StatedModules.js +11 -6
- package/dist/StatedModules.js.map +1 -1
- package/dist/boot/App.d.ts +2 -4
- package/dist/boot/App.d.ts.map +1 -1
- package/dist/boot/AppLifecycle.d.ts +8 -0
- package/dist/boot/AppLifecycle.d.ts.map +1 -1
- package/dist/boot/AppLifecycle.js +24 -10
- package/dist/boot/AppLifecycle.js.map +1 -1
- package/dist/boot/AuthRuntime.d.ts +5 -12
- package/dist/boot/AuthRuntime.d.ts.map +1 -1
- package/dist/boot/AuthRuntime.js +2 -1
- package/dist/boot/AuthRuntime.js.map +1 -1
- package/dist/boot/CreateAppOptions.d.ts +0 -11
- package/dist/boot/CreateAppOptions.d.ts.map +1 -1
- package/dist/boot/Emissions.d.ts.map +1 -1
- package/dist/boot/Emissions.js +3 -6
- package/dist/boot/Emissions.js.map +1 -1
- package/dist/boot/Extension.d.ts +6 -0
- package/dist/boot/Extension.d.ts.map +1 -1
- package/dist/boot/Hosting.d.ts +2 -1
- package/dist/boot/Hosting.d.ts.map +1 -1
- package/dist/boot/bootstrap.d.ts.map +1 -1
- package/dist/boot/bootstrap.js +149 -263
- package/dist/boot/bootstrap.js.map +1 -1
- package/dist/boot/install.d.ts +3 -0
- package/dist/boot/install.d.ts.map +1 -1
- package/dist/boot/install.js +103 -114
- package/dist/boot/install.js.map +1 -1
- package/dist/boot/nesting.d.ts.map +1 -1
- package/dist/boot/nesting.js +2 -1
- package/dist/boot/nesting.js.map +1 -1
- package/dist/boot/relations.d.ts.map +1 -1
- package/dist/boot/relations.js.map +1 -1
- package/dist/boot/remote.d.ts +2 -1
- package/dist/boot/remote.d.ts.map +1 -1
- package/dist/boot/remote.js +7 -4
- package/dist/boot/remote.js.map +1 -1
- package/dist/boot/seed.d.ts +2 -1
- package/dist/boot/seed.d.ts.map +1 -1
- package/dist/boot/seed.js +10 -29
- package/dist/boot/seed.js.map +1 -1
- package/dist/descriptor/ExtensionEntry.d.ts +4 -0
- package/dist/descriptor/ExtensionEntry.d.ts.map +1 -1
- package/dist/descriptor/ExtensionEntry.js +6 -1
- package/dist/descriptor/ExtensionEntry.js.map +1 -1
- package/dist/descriptor/FrondDescriptor.d.ts +2 -0
- package/dist/descriptor/FrondDescriptor.d.ts.map +1 -1
- package/dist/descriptor/FrondDescriptor.js +5 -0
- package/dist/descriptor/FrondDescriptor.js.map +1 -1
- package/dist/descriptor/Fronds.d.ts +5 -0
- package/dist/descriptor/Fronds.d.ts.map +1 -1
- package/dist/descriptor/Fronds.js +8 -0
- package/dist/descriptor/Fronds.js.map +1 -1
- package/dist/descriptor/index.d.ts +1 -0
- package/dist/descriptor/index.d.ts.map +1 -1
- package/dist/descriptor/index.js +1 -0
- package/dist/descriptor/index.js.map +1 -1
- package/dist/dispatch/ArgumentResolver.d.ts.map +1 -1
- package/dist/dispatch/ArgumentResolver.js +2 -1
- package/dist/dispatch/ArgumentResolver.js.map +1 -1
- package/dist/dispatch/Facade.d.ts +3 -0
- package/dist/dispatch/Facade.d.ts.map +1 -1
- package/dist/dispatch/HandlerFacade.d.ts.map +1 -1
- package/dist/dispatch/HandlerFacade.js +8 -4
- package/dist/dispatch/HandlerFacade.js.map +1 -1
- package/dist/dispatch/InFlight.d.ts +3 -2
- package/dist/dispatch/InFlight.d.ts.map +1 -1
- package/dist/dispatch/InFlight.js +11 -1
- package/dist/dispatch/InFlight.js.map +1 -1
- package/dist/index.d.ts +2 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/node.d.ts.map +1 -1
- package/dist/node.js +1 -1
- package/dist/node.js.map +1 -1
- package/dist/prefab/CrudConstructor.d.ts.map +1 -1
- package/dist/prefab/CrudConstructor.js.map +1 -1
- package/dist/prefab/collector.d.ts +6 -0
- package/dist/prefab/collector.d.ts.map +1 -1
- package/dist/prefab/collector.js +26 -1
- package/dist/prefab/collector.js.map +1 -1
- package/dist/storage/Comparison.d.ts +2 -2
- package/dist/storage/Comparison.d.ts.map +1 -1
- package/dist/storage/Comparison.js +3 -1
- package/dist/storage/Comparison.js.map +1 -1
- package/dist/storage/Storage.d.ts +3 -2
- package/dist/storage/Storage.d.ts.map +1 -1
- package/dist/storage/Storage.js +23 -10
- package/dist/storage/Storage.js.map +1 -1
- package/dist/storage/Store.d.ts.map +1 -1
- package/dist/storage/Store.js +4 -2
- package/dist/storage/Store.js.map +1 -1
- package/dist/wire/Emit.d.ts +0 -2
- package/dist/wire/Emit.d.ts.map +1 -1
- package/dist/wire/Emit.js +1 -1
- package/dist/wire/Emit.js.map +1 -1
- package/dist/wire/Facade.d.ts +7 -0
- package/dist/wire/Facade.d.ts.map +1 -1
- package/dist/wire/Facade.js +13 -0
- package/dist/wire/Facade.js.map +1 -1
- package/dist/wire/Invocation.d.ts +2 -1
- package/dist/wire/Invocation.d.ts.map +1 -1
- package/dist/wire/Invocation.js +4 -1
- package/dist/wire/Invocation.js.map +1 -1
- package/dist/wire/InvocationContext.d.ts +2 -0
- package/dist/wire/InvocationContext.d.ts.map +1 -1
- package/dist/wire/OperationContract.d.ts +0 -4
- package/dist/wire/OperationContract.d.ts.map +1 -1
- package/dist/wire/OperationContract.js +1 -1
- package/dist/wire/OperationContract.js.map +1 -1
- package/dist/wire/OperationsMap.d.ts +0 -3
- package/dist/wire/OperationsMap.d.ts.map +1 -1
- package/dist/wire/OperationsMap.js +0 -5
- package/dist/wire/OperationsMap.js.map +1 -1
- package/dist/wire/StateShape.d.ts +27 -0
- package/dist/wire/StateShape.d.ts.map +1 -0
- package/dist/wire/StateShape.js +59 -0
- package/dist/wire/StateShape.js.map +1 -0
- package/package.json +4 -4
- package/src/EffectiveOperationModel.ts +221 -201
- package/src/FougereConfig.ts +11 -16
- package/src/FrondDeclaration.ts +7 -7
- package/src/FrondsStated.ts +4 -2
- package/src/Source.ts +1 -1
- package/src/SourceView.ts +0 -2
- package/src/StatedFrond.ts +5 -0
- package/src/StatedModules.ts +17 -9
- package/src/boot/App.ts +2 -4
- package/src/boot/AppLifecycle.ts +27 -10
- package/src/boot/AuthRuntime.ts +6 -13
- package/src/boot/CreateAppOptions.ts +0 -11
- package/src/boot/Emissions.ts +3 -7
- package/src/boot/Extension.ts +6 -0
- package/src/boot/Hosting.ts +2 -1
- package/src/boot/bootstrap.ts +179 -300
- package/src/boot/install.ts +124 -146
- package/src/boot/nesting.ts +2 -1
- package/src/boot/relations.ts +3 -8
- package/src/boot/remote.ts +8 -3
- package/src/boot/seed.ts +11 -38
- package/src/descriptor/ExtensionEntry.ts +16 -1
- package/src/descriptor/FrondDescriptor.ts +7 -0
- package/src/descriptor/Fronds.ts +10 -0
- package/src/descriptor/index.ts +1 -0
- package/src/dispatch/ArgumentResolver.ts +2 -1
- package/src/dispatch/Facade.ts +3 -0
- package/src/dispatch/HandlerFacade.ts +8 -3
- package/src/dispatch/InFlight.ts +16 -2
- package/src/index.ts +2 -4
- package/src/node.ts +1 -1
- package/src/prefab/CrudConstructor.ts +0 -11
- package/src/prefab/collector.ts +29 -1
- package/src/storage/Comparison.ts +7 -4
- package/src/storage/Storage.ts +26 -12
- package/src/storage/Store.ts +4 -2
- package/src/wire/Emit.ts +1 -1
- package/src/wire/Facade.ts +17 -10
- package/src/wire/Invocation.ts +3 -1
- package/src/wire/InvocationContext.ts +2 -0
- package/src/wire/OperationContract.ts +1 -1
- package/src/wire/OperationsMap.ts +0 -10
- package/src/wire/StateShape.ts +76 -0
- package/dist/boot/AuthConfig.d.ts +0 -14
- package/dist/boot/AuthConfig.d.ts.map +0 -1
- package/dist/boot/AuthConfig.js +0 -2
- package/dist/boot/AuthConfig.js.map +0 -1
- package/dist/boot/AuthContext.d.ts +0 -12
- package/dist/boot/AuthContext.d.ts.map +0 -1
- package/dist/boot/AuthContext.js +0 -2
- package/dist/boot/AuthContext.js.map +0 -1
- package/dist/storage/ComparisonName.d.ts +0 -3
- package/dist/storage/ComparisonName.d.ts.map +0 -1
- package/dist/storage/ComparisonName.js +0 -2
- package/dist/storage/ComparisonName.js.map +0 -1
- package/src/boot/AuthConfig.ts +0 -14
- package/src/boot/AuthContext.ts +0 -12
- package/src/storage/ComparisonName.ts +0 -3
package/src/StatedModules.ts
CHANGED
|
@@ -3,13 +3,17 @@
|
|
|
3
3
|
* of your own. Reading one means importing it, which is why this lives on the node entry and
|
|
4
4
|
* never on the one a Worker runs.
|
|
5
5
|
*
|
|
6
|
-
* What a module hands back decides where it goes: a shape stating `up` or `
|
|
6
|
+
* What a module hands back decides where it goes: a shape stating `up`, `down` or `state` is an
|
|
7
7
|
* extension and rises with the app, anything else is a frond and is installed like the rest.
|
|
8
8
|
* The author of a config does not have to know which one their package exports — the same
|
|
9
9
|
* reading `extensions/` already does off a module's form.
|
|
10
|
+
*
|
|
11
|
+
* A frond the config BUILT in place — `auth: betterAuth({ … })` — is handed over the same way,
|
|
12
|
+
* with nothing to import: the config file already did.
|
|
10
13
|
*/
|
|
11
14
|
import type { Extension } from './boot/Extension.js';
|
|
12
15
|
import type { FrondDescriptor } from './descriptor/FrondDescriptor.js';
|
|
16
|
+
import { isExtension } from './descriptor/ExtensionEntry.js';
|
|
13
17
|
import { statesModule, type FrondsStated } from './FrondsStated.js';
|
|
14
18
|
import { statedFronds } from './StatedFrond.js';
|
|
15
19
|
import { getModuleLoader } from './loader.js';
|
|
@@ -21,13 +25,7 @@ function exportedBy(specifier: string): string {
|
|
|
21
25
|
return last.replace(/\.[cm]?[jt]s$/, '');
|
|
22
26
|
}
|
|
23
27
|
|
|
24
|
-
|
|
25
|
-
const shape = built as { up?: unknown; down?: unknown } | null;
|
|
26
|
-
|
|
27
|
-
return typeof shape?.up === 'function' || typeof shape?.down === 'function';
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/** What a config's module keys hand over, sorted by what each one turned out to be. */
|
|
28
|
+
/** What a config hands over as code — its module keys and the fronds it built — sorted by what each one is. */
|
|
31
29
|
export async function statedModules(
|
|
32
30
|
stated: FrondsStated | undefined,
|
|
33
31
|
): Promise<{ fronds: FrondDescriptor[]; extensions: Extension[] }> {
|
|
@@ -36,6 +34,16 @@ export async function statedModules(
|
|
|
36
34
|
const loader = getModuleLoader();
|
|
37
35
|
|
|
38
36
|
for (const entry of statedFronds(stated)) {
|
|
37
|
+
if (entry.held) {
|
|
38
|
+
if (entry.held.name !== entry.key) {
|
|
39
|
+
throw new Error(
|
|
40
|
+
`Fougere config: the entry '${entry.path}' holds the frond '${entry.held.name}'. `
|
|
41
|
+
+ `Name the entry '${entry.held.name}' — the key is how \`only:\` and an address find it.`,
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
fronds.push(entry.held);
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
39
47
|
if (!statesModule(entry.key)) continue;
|
|
40
48
|
|
|
41
49
|
const module = await loader(entry.key) as Record<string, unknown>;
|
|
@@ -50,7 +58,7 @@ export async function statedModules(
|
|
|
50
58
|
}
|
|
51
59
|
|
|
52
60
|
const built = (factory as (argument?: unknown) => unknown)(entry.value);
|
|
53
|
-
if (
|
|
61
|
+
if (isExtension(built)) extensions.push(built as Extension);
|
|
54
62
|
else fronds.push(built as FrondDescriptor);
|
|
55
63
|
}
|
|
56
64
|
|
package/src/boot/App.ts
CHANGED
|
@@ -3,10 +3,10 @@ import type { Fronds } from '../descriptor/Fronds.js';
|
|
|
3
3
|
import type { SchemaView } from '@fougere/schema';
|
|
4
4
|
import type { AppMiddleware } from '../wire/AppMiddleware.js';
|
|
5
5
|
import type { RpcAnswer } from '../wire/RpcAnswer.js';
|
|
6
|
-
import type { AuthRuntime } from './AuthRuntime.js';
|
|
7
6
|
import type { EffectiveOperationsMap } from '../EffectiveOperationsMap.js';
|
|
8
7
|
import type { DispatchObserver } from '../dispatch/DispatchObserver.js';
|
|
9
8
|
import type { DispatchPort } from '../dispatch/DispatchPort.js';
|
|
9
|
+
import type { Storage } from '../storage/Storage.js';
|
|
10
10
|
|
|
11
11
|
/** The App object returned by createApp(). */
|
|
12
12
|
export interface App extends DispatchPort {
|
|
@@ -42,7 +42,7 @@ export interface App extends DispatchPort {
|
|
|
42
42
|
* The storage an entity is backed by, resolved through its owning frond's scope — the dual of
|
|
43
43
|
* {@link facadeFor}.
|
|
44
44
|
*/
|
|
45
|
-
storageFor(entity: string):
|
|
45
|
+
storageFor<T = Record<string, unknown>>(entity: string): Storage<T> | undefined;
|
|
46
46
|
/** The presenter of an entity, resolved through its owning frond's scope. */
|
|
47
47
|
presenterFor(entity: string): unknown | undefined;
|
|
48
48
|
/** Dispose the root container. */
|
|
@@ -66,6 +66,4 @@ export interface App extends DispatchPort {
|
|
|
66
66
|
use(middleware: AppMiddleware): void;
|
|
67
67
|
/** Register an app middleware scoped to a specific entity. */
|
|
68
68
|
use(entity: string, middleware: AppMiddleware): void;
|
|
69
|
-
/** Auth runtime, present when fougere.config.ts declares `auth`. */
|
|
70
|
-
auth?: AuthRuntime;
|
|
71
69
|
}
|
package/src/boot/AppLifecycle.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { App } from './App.js';
|
|
2
2
|
import type { Extension } from './Extension.js';
|
|
3
|
+
import { StateShape } from '../wire/StateShape.js';
|
|
3
4
|
|
|
4
5
|
/** Runs application extensions up in order and down in reverse order. */
|
|
5
6
|
export class AppLifecycle {
|
|
@@ -20,23 +21,39 @@ export class AppLifecycle {
|
|
|
20
21
|
return this.members.map((extension) => extension.name);
|
|
21
22
|
}
|
|
22
23
|
|
|
24
|
+
/** Read off the members that stay, so an extension replaced by name declares nothing. */
|
|
25
|
+
state(): StateShape {
|
|
26
|
+
return StateShape.of(this.members);
|
|
27
|
+
}
|
|
28
|
+
|
|
23
29
|
async up(app: App): Promise<void> {
|
|
24
30
|
for (const extension of this.members) await extension.up?.(app);
|
|
25
31
|
}
|
|
26
32
|
|
|
27
33
|
async down(app: App): Promise<void> {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
await closeAll(
|
|
35
|
+
[...this.members].reverse().map((extension) => () => extension.down?.(app)),
|
|
36
|
+
'extension(s) refused to release',
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Every level told to close even when one refuses, the refusals leaving together in one
|
|
43
|
+
* `AggregateError` — one already carried by a level is flattened into the list.
|
|
44
|
+
*/
|
|
45
|
+
export async function closeAll(levels: readonly (() => unknown)[], refusals: string): Promise<void> {
|
|
46
|
+
const refused: unknown[] = [];
|
|
47
|
+
for (const level of levels) {
|
|
48
|
+
try {
|
|
49
|
+
await level();
|
|
50
|
+
} catch (error) {
|
|
51
|
+
if (error instanceof AggregateError) refused.push(...error.errors);
|
|
52
|
+
else refused.push(error);
|
|
38
53
|
}
|
|
39
54
|
}
|
|
55
|
+
|
|
56
|
+
if (refused.length > 0) throw new AggregateError(refused, `${refused.length} ${refusals}`);
|
|
40
57
|
}
|
|
41
58
|
|
|
42
59
|
/** The replaceable migration slot of the application lifecycle. */
|
package/src/boot/AuthRuntime.ts
CHANGED
|
@@ -1,19 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
import type { Storage } from '../storage/Storage.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Runtime returned by an auth provider's create(config, ctx) function.
|
|
6
|
-
* The core mounts this on the App and the HTTP layer (Nuxt module / router) uses it.
|
|
7
|
-
*/
|
|
1
|
+
/** What an auth extension registers under {@link AUTH} once it has risen. */
|
|
8
2
|
export interface AuthRuntime {
|
|
9
|
-
/**
|
|
10
|
-
entities: Record<string, SchemaView>;
|
|
11
|
-
/** Per-entity ORMs the provider built for itself. */
|
|
12
|
-
storages: Record<string, Storage>;
|
|
13
|
-
/** Web Standard handler that processes /auth/* requests. */
|
|
3
|
+
/** Web Standard handler that processes `/auth/*` requests. */
|
|
14
4
|
handler: (request: Request) => Promise<Response>;
|
|
15
5
|
/** Programmatic API exposed by the provider (getSession, signOut, ...). */
|
|
16
6
|
api: Record<string, unknown>;
|
|
17
|
-
/** Effective mount path
|
|
7
|
+
/** Effective mount path. */
|
|
18
8
|
basePath: string;
|
|
19
9
|
}
|
|
10
|
+
|
|
11
|
+
/** The container key an auth provider registers its runtime under. */
|
|
12
|
+
export const AUTH = 'AuthRuntime';
|
|
@@ -6,8 +6,6 @@ import type { StorageFactory } from '../storage/StorageFactory.js';
|
|
|
6
6
|
import type { Constraint } from '../Constraint.js';
|
|
7
7
|
import type { Transport } from '../wire/Transport.js';
|
|
8
8
|
import type { Extension } from './Extension.js';
|
|
9
|
-
import type { AuthConfig } from './AuthConfig.js';
|
|
10
|
-
import type { DispatchObserver } from '../dispatch/DispatchObserver.js';
|
|
11
9
|
import type { App } from './App.js';
|
|
12
10
|
|
|
13
11
|
/** Options for createApp(). */
|
|
@@ -86,13 +84,4 @@ export interface CreateAppOptions {
|
|
|
86
84
|
adapters?: Record<string, boolean | undefined>;
|
|
87
85
|
/** Carries an announced fact out of this process — a broker, a queue, a log. */
|
|
88
86
|
onEmit?: (fact: string, payload: unknown) => void | Promise<void>;
|
|
89
|
-
/** Passive observers of every dispatch transition. */
|
|
90
|
-
dispatchObservers?: readonly DispatchObserver[];
|
|
91
|
-
/**
|
|
92
|
-
* Storage handle to expose to the auth provider via AuthContext.db.
|
|
93
|
-
* Required when `auth` is set.
|
|
94
|
-
*/
|
|
95
|
-
db?: unknown;
|
|
96
|
-
/** Auth declaration to wire into the app at boot. */
|
|
97
|
-
auth?: AuthConfig;
|
|
98
87
|
}
|
package/src/boot/Emissions.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { applyCreate, dotted, lowerFirst, type SchemaView } from '@fougere/schema';
|
|
2
|
+
import { addressOf, facadeKeyOf } from '../wire/Facade.js';
|
|
2
3
|
import type { Container } from '@fougere/container';
|
|
3
4
|
import { validationErrorsOf } from '../wire/FougereError.js';
|
|
4
5
|
import { awaitKeyOf, emitKeyOf, factsAnnouncedBy, factsAwaitedBy } from '../wire/Emit.js';
|
|
@@ -368,12 +369,7 @@ export class Emissions {
|
|
|
368
369
|
}
|
|
369
370
|
}
|
|
370
371
|
|
|
371
|
-
/**
|
|
372
|
-
* The container key a declared CLASS NAME answers under — `RedactHandler` → `redactHandler`,
|
|
373
|
-
* the same key `facadeKeyOf` builds from an address.
|
|
374
|
-
*/
|
|
372
|
+
/** The container key a declared CLASS NAME answers under — `RedactHandler` → `redactHandler`. */
|
|
375
373
|
function facadeOf(declared: string): string {
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
return key.endsWith('Handler') ? key : `${key}Handler`;
|
|
374
|
+
return facadeKeyOf(addressOf(declared));
|
|
379
375
|
}
|
package/src/boot/Extension.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { App } from './App.js';
|
|
2
|
+
import type { Field } from '@fougere/schema';
|
|
2
3
|
import type { FrondDescriptor } from '../descriptor/FrondDescriptor.js';
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -15,6 +16,11 @@ export interface Extension {
|
|
|
15
16
|
* signature is the only way to ask for one.
|
|
16
17
|
*/
|
|
17
18
|
fronds?: readonly FrondDescriptor[];
|
|
19
|
+
/**
|
|
20
|
+
* The members it puts on a call's `state` — `{ user: json(User) }`. A member nobody declares
|
|
21
|
+
* is refused at the facade, and one declared twice refuses the boot.
|
|
22
|
+
*/
|
|
23
|
+
state?: Readonly<Record<string, Field>>;
|
|
18
24
|
up?(app: App): void | Promise<void>;
|
|
19
25
|
down?(app: App): void | Promise<void>;
|
|
20
26
|
}
|
package/src/boot/Hosting.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { SchemaView } from '@fougere/schema';
|
|
|
2
2
|
import type { Constraint } from '../Constraint.js';
|
|
3
3
|
import type { Peer } from './Peer.js';
|
|
4
4
|
import type { Journal } from '../dispatch/Journal.js';
|
|
5
|
+
import type { Storage } from '../storage/Storage.js';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Where an entity's rows are hosted, and what the host keeps — what a `ref()` asks the boot.
|
|
@@ -17,7 +18,7 @@ export interface Hosting {
|
|
|
17
18
|
* Resolved through the frond that owns it, never the asking frond's scope: a scope sees its
|
|
18
19
|
* parent and not its siblings, so a target of another frond was answered by nothing.
|
|
19
20
|
*/
|
|
20
|
-
storageOf(entity: string):
|
|
21
|
+
storageOf(entity: string): Storage | undefined;
|
|
21
22
|
/** Every entity of every frond — a row is named from wherever its namer was declared. */
|
|
22
23
|
entities(): ReadonlyMap<string, SchemaView>;
|
|
23
24
|
/**
|