@fougere/app 0.13.1-alpha.0 → 0.14.1-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.d.ts +10 -1
- package/dist/boot.d.ts.map +1 -1
- package/dist/boot.js +19 -8
- package/dist/boot.js.map +1 -1
- package/package.json +12 -12
- package/src/boot.ts +25 -8
package/dist/boot.d.ts
CHANGED
|
@@ -19,6 +19,12 @@ export interface FougereServerConfig {
|
|
|
19
19
|
config?: Partial<FougereConfig>;
|
|
20
20
|
/** Who performs an outgoing call, when the default cannot. */
|
|
21
21
|
remoteTransport?: (url: string) => Transport;
|
|
22
|
+
/**
|
|
23
|
+
* This process writes its own schema at boot, instead of refusing a database behind the
|
|
24
|
+
* entities. Only for a database born with the process — `path: ':memory:'` — since anything
|
|
25
|
+
* that outlives it is migrated by `fougere migrate --apply`.
|
|
26
|
+
*/
|
|
27
|
+
migrates?: boolean;
|
|
22
28
|
}
|
|
23
29
|
/**
|
|
24
30
|
* Override the data layer — only needed if you don't want the convention-driven
|
|
@@ -27,7 +33,10 @@ export interface FougereServerConfig {
|
|
|
27
33
|
export declare function configureFougere(config: FougereServerConfig): void;
|
|
28
34
|
/** Add to what is already stated, instead of replacing it. */
|
|
29
35
|
export declare function extendFougere(config: Partial<FougereServerConfig>): void;
|
|
30
|
-
/**
|
|
36
|
+
/**
|
|
37
|
+
* Get the booted Fougere app. Lazy — boots on first call, then caches what booted. A refusal is
|
|
38
|
+
* not kept: it names a command — `fougere migrate --apply` — whose effect the next call must see.
|
|
39
|
+
*/
|
|
31
40
|
export declare function useFougereApp(): Promise<App>;
|
|
32
41
|
/** Turn the ring. */
|
|
33
42
|
export declare function reloadFougere(timeoutMs?: number): Promise<App>;
|
package/dist/boot.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boot.d.ts","sourceRoot":"","sources":["../src/boot.ts"],"names":[],"mappings":"AAQA,OAAO,K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AAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IAChC,8DAA8D;IAC9D,eAAe,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,SAAS,CAAC;IAC7C;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AASD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,mBAAmB,QAG3D;AAED,8DAA8D;AAC9D,wBAAgB,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,mBAAmB,CAAC,QAGjE;AAED;;;GAGG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAAC,GAAG,CAAC,CAS5C;AAED,qBAAqB;AACrB,wBAAsB,aAAa,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAYpE"}
|
package/dist/boot.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** Fougere server bootstrap — single entry point for an app's lifecycle, whatever hosts it. */
|
|
2
2
|
import { resolve, sep } from 'node:path';
|
|
3
3
|
import { pathToFileURL } from 'node:url';
|
|
4
|
-
import { applyConfig, createApp, identityFromEnv, Logger } from '@fougere/core';
|
|
4
|
+
import { applyConfig, createApp, identityFromEnv, Logger, migrating } from '@fougere/core';
|
|
5
5
|
import { scanProject, frondAliases } from '@fougere/compiler';
|
|
6
6
|
import { resolveConventions } from '@fougere/core';
|
|
7
7
|
import { loadCascadedConfig, remotesOf, setModuleLoader, statedModules } from '@fougere/core/node';
|
|
@@ -23,10 +23,16 @@ export function extendFougere(config) {
|
|
|
23
23
|
_config = { ..._config, ...config };
|
|
24
24
|
_appPromise = null;
|
|
25
25
|
}
|
|
26
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* Get the booted Fougere app. Lazy — boots on first call, then caches what booted. A refusal is
|
|
28
|
+
* not kept: it names a command — `fougere migrate --apply` — whose effect the next call must see.
|
|
29
|
+
*/
|
|
27
30
|
export function useFougereApp() {
|
|
28
31
|
if (!_appPromise) {
|
|
29
|
-
_appPromise = boot()
|
|
32
|
+
_appPromise = boot().catch((refusal) => {
|
|
33
|
+
_appPromise = null;
|
|
34
|
+
throw refusal;
|
|
35
|
+
});
|
|
30
36
|
}
|
|
31
37
|
return _appPromise;
|
|
32
38
|
}
|
|
@@ -136,15 +142,20 @@ async function boot() {
|
|
|
136
142
|
// were left behind once, under Nuxt only.
|
|
137
143
|
...layerOf(storage),
|
|
138
144
|
adapters: fileConfig.adapters,
|
|
145
|
+
ports: fileConfig.ports,
|
|
139
146
|
remotes,
|
|
140
147
|
/** Who inherits code from whom — the tree, whole, so a refusal can name where an entry sits. */
|
|
141
148
|
under: fileConfig.fronds,
|
|
142
149
|
remoteTransport,
|
|
143
|
-
extensions: [
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
150
|
+
extensions: [
|
|
151
|
+
...(_config.migrates ? [migrating((app) => storage.migrate?.(app))] : []),
|
|
152
|
+
...stated.extensions,
|
|
153
|
+
...(_config.extensions ?? []),
|
|
154
|
+
],
|
|
155
|
+
// Opened before the container, so released after it — when THIS boot opened it. A storage
|
|
156
|
+
// the host handed in is the host's to close: a refused boot and a reload both dispose an app
|
|
157
|
+
// while the next one still holds that connection, and closing it here broke the next.
|
|
158
|
+
onDispose: _config.storage ? undefined : storage.close,
|
|
148
159
|
});
|
|
149
160
|
log.info(`ascent: ${app.extensions().join(' → ') || 'nothing declared'}`);
|
|
150
161
|
const ms = (performance.now() - bootStart).toFixed(0);
|
package/dist/boot.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boot.js","sourceRoot":"","sources":["../src/boot.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,E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AkB,EAAE,CAAC,CAAC;IAE1E,MAAM,EAAE,GAAG,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IACtD,GAAG,CAAC,IAAI,CAAC,YAAY,EAAE,QAAQ,GAAG,CAAC,MAAM,CAAC,MAAM,WAAW,CAAC,CAAC;IAE7D,OAAO,GAAG,CAAC;AACb,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fougere/app",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.1-alpha.0",
|
|
4
4
|
"description": "The host-independent half of a Fougere app: boot, call envelope, REST table, form contract.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fougere",
|
|
@@ -41,26 +41,26 @@
|
|
|
41
41
|
"src"
|
|
42
42
|
],
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@fougere/core": "0.
|
|
45
|
-
"@fougere/defaults": "0.
|
|
46
|
-
"@fougere/schema": "0.
|
|
47
|
-
"@fougere/adapter-rest": "0.
|
|
48
|
-
"@fougere/transport-http": "0.
|
|
44
|
+
"@fougere/core": "0.14.1-alpha.0",
|
|
45
|
+
"@fougere/defaults": "0.14.1-alpha.0",
|
|
46
|
+
"@fougere/schema": "0.14.1-alpha.0",
|
|
47
|
+
"@fougere/adapter-rest": "0.14.1-alpha.0",
|
|
48
|
+
"@fougere/transport-http": "0.14.1-alpha.0",
|
|
49
49
|
"jiti": "^2.6.1",
|
|
50
|
-
"@fougere/http": "0.
|
|
51
|
-
"@fougere/container": "0.
|
|
52
|
-
"@fougere/adapter-memory": "0.
|
|
53
|
-
"@fougere/compiler": "0.
|
|
50
|
+
"@fougere/http": "0.14.1-alpha.0",
|
|
51
|
+
"@fougere/container": "0.14.1-alpha.0",
|
|
52
|
+
"@fougere/adapter-memory": "0.14.1-alpha.0",
|
|
53
|
+
"@fougere/compiler": "0.14.1-alpha.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"vitest": "^4.1.0",
|
|
57
|
-
"@fougere/adapter-graphql": "0.
|
|
57
|
+
"@fougere/adapter-graphql": "0.14.1-alpha.0"
|
|
58
58
|
},
|
|
59
59
|
"publishConfig": {
|
|
60
60
|
"access": "public"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
|
-
"@fougere/adapter-graphql": "^0.
|
|
63
|
+
"@fougere/adapter-graphql": "^0.14.1-alpha.0"
|
|
64
64
|
},
|
|
65
65
|
"peerDependenciesMeta": {
|
|
66
66
|
"@fougere/adapter-graphql": {
|
package/src/boot.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** Fougere server bootstrap — single entry point for an app's lifecycle, whatever hosts it. */
|
|
2
2
|
import { resolve, sep } from 'node:path';
|
|
3
3
|
import { pathToFileURL } from 'node:url';
|
|
4
|
-
import { applyConfig, createApp, identityFromEnv, Logger } from '@fougere/core';
|
|
4
|
+
import { applyConfig, createApp, identityFromEnv, Logger, migrating } from '@fougere/core';
|
|
5
5
|
import { scanProject, frondAliases } from '@fougere/compiler';
|
|
6
6
|
import { resolveConventions } from '@fougere/core';
|
|
7
7
|
import { loadCascadedConfig, remotesOf, setModuleLoader, statedModules } from '@fougere/core/node';
|
|
@@ -30,6 +30,12 @@ export interface FougereServerConfig {
|
|
|
30
30
|
config?: Partial<FougereConfig>;
|
|
31
31
|
/** Who performs an outgoing call, when the default cannot. */
|
|
32
32
|
remoteTransport?: (url: string) => Transport;
|
|
33
|
+
/**
|
|
34
|
+
* This process writes its own schema at boot, instead of refusing a database behind the
|
|
35
|
+
* entities. Only for a database born with the process — `path: ':memory:'` — since anything
|
|
36
|
+
* that outlives it is migrated by `fougere migrate --apply`.
|
|
37
|
+
*/
|
|
38
|
+
migrates?: boolean;
|
|
33
39
|
}
|
|
34
40
|
|
|
35
41
|
// ── State ────────────────────────────────────────
|
|
@@ -54,10 +60,16 @@ export function extendFougere(config: Partial<FougereServerConfig>) {
|
|
|
54
60
|
_appPromise = null;
|
|
55
61
|
}
|
|
56
62
|
|
|
57
|
-
/**
|
|
63
|
+
/**
|
|
64
|
+
* Get the booted Fougere app. Lazy — boots on first call, then caches what booted. A refusal is
|
|
65
|
+
* not kept: it names a command — `fougere migrate --apply` — whose effect the next call must see.
|
|
66
|
+
*/
|
|
58
67
|
export function useFougereApp(): Promise<App> {
|
|
59
68
|
if (!_appPromise) {
|
|
60
|
-
_appPromise = boot()
|
|
69
|
+
_appPromise = boot().catch((refusal: unknown) => {
|
|
70
|
+
_appPromise = null;
|
|
71
|
+
throw refusal;
|
|
72
|
+
});
|
|
61
73
|
}
|
|
62
74
|
|
|
63
75
|
return _appPromise;
|
|
@@ -177,15 +189,20 @@ async function boot(): Promise<App> {
|
|
|
177
189
|
// were left behind once, under Nuxt only.
|
|
178
190
|
...layerOf(storage),
|
|
179
191
|
adapters: fileConfig.adapters,
|
|
192
|
+
ports: fileConfig.ports,
|
|
180
193
|
remotes,
|
|
181
194
|
/** Who inherits code from whom — the tree, whole, so a refusal can name where an entry sits. */
|
|
182
195
|
under: fileConfig.fronds,
|
|
183
196
|
remoteTransport,
|
|
184
|
-
extensions: [
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
197
|
+
extensions: [
|
|
198
|
+
...(_config.migrates ? [migrating((app) => storage.migrate?.(app))] : []),
|
|
199
|
+
...stated.extensions,
|
|
200
|
+
...(_config.extensions ?? []),
|
|
201
|
+
],
|
|
202
|
+
// Opened before the container, so released after it — when THIS boot opened it. A storage
|
|
203
|
+
// the host handed in is the host's to close: a refused boot and a reload both dispose an app
|
|
204
|
+
// while the next one still holds that connection, and closing it here broke the next.
|
|
205
|
+
onDispose: _config.storage ? undefined : storage.close,
|
|
189
206
|
});
|
|
190
207
|
|
|
191
208
|
log.info(`ascent: ${app.extensions().join(' → ') || 'nothing declared'}`);
|