@fougere/app 0.7.0-alpha.0 → 0.8.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.js +9 -3
- package/dist/boot.js.map +1 -1
- package/package.json +11 -11
- package/src/boot.ts +10 -3
package/dist/boot.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Fougere server bootstrap — single entry point for an app's lifecycle, whatever hosts it. */
|
|
2
|
-
import { createApp, identityFromEnv, Logger, migrating, seeding } from '@fougere/core';
|
|
2
|
+
import { applyConfig, createApp, identityFromEnv, Logger, migrating, seeding } from '@fougere/core';
|
|
3
3
|
import { scanProject, loadCascadedConfig, setModuleLoader, frondAliases, resolveConventions } from '@fougere/core/node';
|
|
4
4
|
import { createContainer } from '@fougere/container';
|
|
5
5
|
import { createMemoryStorage } from '@fougere/adapter-memory';
|
|
@@ -74,6 +74,11 @@ async function boot() {
|
|
|
74
74
|
// and where there is no file a second read finds nothing and says nothing.
|
|
75
75
|
const fileConfig = _config.config
|
|
76
76
|
?? (await loadCascadedConfig(root, configRoot));
|
|
77
|
+
// What a re-read config changes in a running process — the same call `boot()` makes in
|
|
78
|
+
// core, and the only place `logLevel:` takes effect. Without it a web host read the key
|
|
79
|
+
// and did nothing with it: the file said `debug` and the threshold stayed where the
|
|
80
|
+
// module had left it.
|
|
81
|
+
applyConfig(fileConfig);
|
|
77
82
|
const conventions = resolveConventions(fileConfig.conventions);
|
|
78
83
|
// `frondAliases` reads a directory listing, so it is asked only when the loader it
|
|
79
84
|
// feeds is going to exist at all.
|
|
@@ -85,7 +90,7 @@ async function boot() {
|
|
|
85
90
|
let storage = _config.storage;
|
|
86
91
|
if (!storage) {
|
|
87
92
|
const { resolveStorage } = await import('@fougere/defaults');
|
|
88
|
-
storage = resolveStorage(fileConfig.db, fileConfig.sources);
|
|
93
|
+
storage = resolveStorage(fileConfig.db, fileConfig.sources, root);
|
|
89
94
|
log.debug(storage.storageFactory ? 'auto-resolving storage from config.db' : 'no db declared — falling back to in-memory storage');
|
|
90
95
|
}
|
|
91
96
|
// The storage's two halves, kept together: its ascent is an extension, its connection
|
|
@@ -124,6 +129,7 @@ async function boot() {
|
|
|
124
129
|
storageFactory,
|
|
125
130
|
sourceOf: storage.sourceOf,
|
|
126
131
|
transacts: storage.transacts,
|
|
132
|
+
enforces: storage.enforces,
|
|
127
133
|
transacted: storage.transacted,
|
|
128
134
|
db: storage.db,
|
|
129
135
|
auth: fileConfig.auth,
|
|
@@ -135,7 +141,7 @@ async function boot() {
|
|
|
135
141
|
// The slot is declared even when this host resolved no storage — a host that resolved
|
|
136
142
|
// its own (the Nitro plugin does, for its bundler) then REPLACES this member in place
|
|
137
143
|
// instead of adding one after the seeds, which is rows before tables.
|
|
138
|
-
migrating(storageMigrate),
|
|
144
|
+
migrating(storageMigrate, (message) => log.warn(message)),
|
|
139
145
|
seeding((message) => log.info(`[seed]${message}`)),
|
|
140
146
|
...(_config.extensions ?? []),
|
|
141
147
|
],
|
package/dist/boot.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boot.js","sourceRoot":"","sources":["../src/boot.ts"],"names":[],"mappings":"AAEA,+FAA+F;AAC/F,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"boot.js","sourceRoot":"","sources":["../src/boot.ts"],"names":[],"mappings":"AAEA,+FAA+F;AAC/F,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACpG,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,eAAe,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAExH,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EA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ACtE,SAAS,CAAC,cAAc,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACzD,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,OAAO,EAAE,CAAC,CAAC;YAClD,GAAG,CAAC,OAAO,CAAC,UAAU,IAAI,EAAE,CAAC;SAC9B;QACD,iFAAiF;QACjF,kFAAkF;QAClF,2CAA2C;QAC3C,SAAS,EAAE,OAAO,CAAC,KAAK;KACzB,CAAC,CAAC;IAEH,GAAG,CAAC,IAAI,CAAC,WAAW,GAAG,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,kBAAkB,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,YAAY,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,GAAG,CAAC,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAEhH,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.8.0-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",
|
|
@@ -42,24 +42,24 @@
|
|
|
42
42
|
],
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"jiti": "^2.6.1",
|
|
45
|
-
"@fougere/
|
|
46
|
-
"@fougere/
|
|
47
|
-
"@fougere/
|
|
48
|
-
"@fougere/
|
|
49
|
-
"@fougere/
|
|
50
|
-
"@fougere/
|
|
51
|
-
"@fougere/adapter-memory": "0.
|
|
52
|
-
"@fougere/
|
|
45
|
+
"@fougere/schema": "0.8.0-alpha.0",
|
|
46
|
+
"@fougere/defaults": "0.8.0-alpha.0",
|
|
47
|
+
"@fougere/core": "0.8.0-alpha.0",
|
|
48
|
+
"@fougere/transport-http": "0.8.0-alpha.0",
|
|
49
|
+
"@fougere/container": "0.8.0-alpha.0",
|
|
50
|
+
"@fougere/http": "0.8.0-alpha.0",
|
|
51
|
+
"@fougere/adapter-memory": "0.8.0-alpha.0",
|
|
52
|
+
"@fougere/adapter-rest": "0.8.0-alpha.0"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"vitest": "^4.1.0",
|
|
56
|
-
"@fougere/adapter-graphql": "0.
|
|
56
|
+
"@fougere/adapter-graphql": "0.8.0-alpha.0"
|
|
57
57
|
},
|
|
58
58
|
"publishConfig": {
|
|
59
59
|
"access": "public"
|
|
60
60
|
},
|
|
61
61
|
"peerDependencies": {
|
|
62
|
-
"@fougere/adapter-graphql": "0.
|
|
62
|
+
"@fougere/adapter-graphql": "0.8.0-alpha.0"
|
|
63
63
|
},
|
|
64
64
|
"peerDependenciesMeta": {
|
|
65
65
|
"@fougere/adapter-graphql": {
|
package/src/boot.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Role } from '@fougere/schema';
|
|
2
2
|
import { Lifecycle } from '@fougere/schema';
|
|
3
3
|
/** Fougere server bootstrap — single entry point for an app's lifecycle, whatever hosts it. */
|
|
4
|
-
import { createApp, identityFromEnv, Logger, migrating, seeding } from '@fougere/core';
|
|
4
|
+
import { applyConfig, createApp, identityFromEnv, Logger, migrating, seeding } from '@fougere/core';
|
|
5
5
|
import { scanProject, loadCascadedConfig, setModuleLoader, frondAliases, resolveConventions } from '@fougere/core/node';
|
|
6
6
|
import type { Extension } from '@fougere/core';
|
|
7
7
|
import { createContainer } from '@fougere/container';
|
|
@@ -114,6 +114,12 @@ async function boot(): Promise<App> {
|
|
|
114
114
|
// and where there is no file a second read finds nothing and says nothing.
|
|
115
115
|
const fileConfig: FougereConfig = (_config.config as FougereConfig | undefined)
|
|
116
116
|
?? (await loadCascadedConfig(root, configRoot));
|
|
117
|
+
// What a re-read config changes in a running process — the same call `boot()` makes in
|
|
118
|
+
// core, and the only place `logLevel:` takes effect. Without it a web host read the key
|
|
119
|
+
// and did nothing with it: the file said `debug` and the threshold stayed where the
|
|
120
|
+
// module had left it.
|
|
121
|
+
applyConfig(fileConfig);
|
|
122
|
+
|
|
117
123
|
const conventions = resolveConventions(fileConfig.conventions);
|
|
118
124
|
// `frondAliases` reads a directory listing, so it is asked only when the loader it
|
|
119
125
|
// feeds is going to exist at all.
|
|
@@ -125,7 +131,7 @@ async function boot(): Promise<App> {
|
|
|
125
131
|
let storage = _config.storage;
|
|
126
132
|
if (!storage) {
|
|
127
133
|
const { resolveStorage } = await import('@fougere/defaults');
|
|
128
|
-
storage = resolveStorage(fileConfig.db as never, (fileConfig as { sources?: unknown }).sources as never);
|
|
134
|
+
storage = resolveStorage(fileConfig.db as never, (fileConfig as { sources?: unknown }).sources as never, root);
|
|
129
135
|
log.debug(storage.storageFactory ? 'auto-resolving storage from config.db' : 'no db declared — falling back to in-memory storage');
|
|
130
136
|
}
|
|
131
137
|
// The storage's two halves, kept together: its ascent is an extension, its connection
|
|
@@ -166,6 +172,7 @@ async function boot(): Promise<App> {
|
|
|
166
172
|
storageFactory,
|
|
167
173
|
sourceOf: storage.sourceOf,
|
|
168
174
|
transacts: storage.transacts,
|
|
175
|
+
enforces: storage.enforces,
|
|
169
176
|
transacted: storage.transacted as never,
|
|
170
177
|
db: storage.db,
|
|
171
178
|
auth: fileConfig.auth,
|
|
@@ -177,7 +184,7 @@ async function boot(): Promise<App> {
|
|
|
177
184
|
// The slot is declared even when this host resolved no storage — a host that resolved
|
|
178
185
|
// its own (the Nitro plugin does, for its bundler) then REPLACES this member in place
|
|
179
186
|
// instead of adding one after the seeds, which is rows before tables.
|
|
180
|
-
migrating(storageMigrate),
|
|
187
|
+
migrating(storageMigrate, (message) => log.warn(message)),
|
|
181
188
|
seeding((message) => log.info(`[seed]${message}`)),
|
|
182
189
|
...(_config.extensions ?? []),
|
|
183
190
|
],
|