@fougere/defaults 0.17.4-alpha.0 → 0.19.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/README.md +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/storage/DeclaredStorage.d.ts +2 -2
- package/dist/storage/DeclaredStorage.d.ts.map +1 -1
- package/dist/storage/ResolvedStorage.d.ts.map +1 -1
- package/dist/storage/ResolvedStorage.js +5 -19
- package/dist/storage/ResolvedStorage.js.map +1 -1
- package/dist/storage/{Placement.d.ts → SourceEntities.d.ts} +2 -2
- package/dist/storage/SourceEntities.d.ts.map +1 -0
- package/dist/storage/SourceEntities.js +2 -0
- package/dist/storage/SourceEntities.js.map +1 -0
- package/dist/transport/RemoteTransport.d.ts +4 -0
- package/dist/transport/RemoteTransport.d.ts.map +1 -0
- package/dist/transport/RemoteTransport.js +8 -0
- package/dist/transport/RemoteTransport.js.map +1 -0
- package/package.json +8 -8
- package/src/index.ts +3 -2
- package/src/storage/DeclaredStorage.ts +2 -2
- package/src/storage/ResolvedStorage.ts +7 -28
- package/src/storage/{Placement.ts → SourceEntities.ts} +1 -1
- package/src/transport/RemoteTransport.ts +9 -0
- package/dist/storage/Placement.d.ts.map +0 -1
- package/dist/storage/Placement.js +0 -2
- package/dist/storage/Placement.js.map +0 -1
package/README.md
CHANGED
|
@@ -12,4 +12,4 @@ pnpm add @fougere/defaults
|
|
|
12
12
|
|
|
13
13
|
Part of [Fougere](https://github.com/chok/fougere) — one schema, a gradient from
|
|
14
14
|
monolith to distributed, the same user code.
|
|
15
|
-
Reference documentation: [the site](https://fougere.dev/)
|
|
15
|
+
Reference documentation: [the site](https://fougere.dev/).
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/** @fougere/defaults — the conventional boot, declared once. */
|
|
2
2
|
import { type App, type CreateAppOptions } from '@fougere/core';
|
|
3
|
+
export { remoteTransport } from './transport/RemoteTransport.js';
|
|
3
4
|
export { declaresStorage } from './storage/DeclaredStorage.js';
|
|
4
5
|
export { layerOf, resolveStorage, storageFrom } from './storage/ResolvedStorage.js';
|
|
5
6
|
export type { DbConfig } from './storage/DbConfig.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,OAAO,EAAa,KAAK,GAAG,EAAE,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAO3E,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AACpF,YAAY,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,YAAY,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAEpE,MAAM,WAAW,cAAc;IAC7B,wEAAwE;IACxE,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,gDAAgD;IAChD,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB;;;OAGG;IACH,UAAU,CAAC,EAAE,gBAAgB,CAAC,YAAY,CAAC,CAAC;IAC5C;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;GAGG;AACH,wBAAsB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,cAAmB,GAAG,OAAO,CAAC,GAAG,CAAC,CAmBnF"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,OAAO,EAAa,KAAK,GAAG,EAAE,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAO3E,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AACpF,YAAY,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,YAAY,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAEpE,MAAM,WAAW,cAAc;IAC7B,wEAAwE;IACxE,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,gDAAgD;IAChD,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB;;;OAGG;IACH,UAAU,CAAC,EAAE,gBAAgB,CAAC,YAAY,CAAC,CAAC;IAC5C;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;GAGG;AACH,wBAAsB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,cAAmB,GAAG,OAAO,CAAC,GAAG,CAAC,CAmBnF"}
|
package/dist/index.js
CHANGED
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
import { migrating } from '@fougere/core';
|
|
3
3
|
import { boot } from '@fougere/compiler';
|
|
4
4
|
import { loadConfig, remotesOf } from '@fougere/core/node';
|
|
5
|
-
import { createHttpTransport } from '@fougere/transport-http';
|
|
6
5
|
import { resolveStorage } from './storage/ResolvedStorage.js';
|
|
6
|
+
import { remoteTransport } from './transport/RemoteTransport.js';
|
|
7
|
+
export { remoteTransport } from './transport/RemoteTransport.js';
|
|
7
8
|
export { declaresStorage } from './storage/DeclaredStorage.js';
|
|
8
9
|
export { layerOf, resolveStorage, storageFrom } from './storage/ResolvedStorage.js';
|
|
9
10
|
/**
|
|
@@ -23,7 +24,7 @@ export async function bootApp(root, opts = {}) {
|
|
|
23
24
|
only: opts.only ?? opts.fronds,
|
|
24
25
|
// `{}` and never undefined: `boot` reads the config's own `fronds:` when handed nothing.
|
|
25
26
|
remotes: useRemotes ? elsewhere : {},
|
|
26
|
-
remoteTransport: useRemotes ?
|
|
27
|
+
remoteTransport: useRemotes ? await remoteTransport() : undefined,
|
|
27
28
|
// One resolver, one place that knows a storage package.
|
|
28
29
|
db: (cfg) => (storage = resolveStorage(cfg.db, cfg.sources, root)),
|
|
29
30
|
extensions: [...(opts.migrates ? [migrating((app) => storage?.migrate?.(app))] : []), ...(opts.extensions ?? [])],
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,OAAO,EAAE,SAAS,EAAmC,MAAM,eAAe,CAAC;AAC3E,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,OAAO,EAAE,SAAS,EAAmC,MAAM,eAAe,CAAC;AAC3E,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE3D,OAAO,EAAE,cAAc,EAAwB,MAAM,8BAA8B,CAAC;AACpF,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEjE,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAsBpF;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,IAAY,EAAE,IAAI,GAAmB,EAAE;IACnE,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,IAAI,CAAC,CAAC;IACtC,2FAA2F;IAC3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@fougere/core';
|
|
2
2
|
import type { DbConfig } from './DbConfig.js';
|
|
3
|
-
import type {
|
|
3
|
+
import type { SourceEntities } from './SourceEntities.js';
|
|
4
4
|
/** Does this config ask for persistence at all? */
|
|
5
5
|
export declare function declaresStorage(dbConf: DbConfig): boolean;
|
|
6
6
|
export interface DeclaredStorage {
|
|
7
7
|
/** The default source — where an entity no placement names lands. */
|
|
8
8
|
db: Source;
|
|
9
9
|
/** The other places. Absent means one source, the way it always was. */
|
|
10
|
-
sources?: Record<string,
|
|
10
|
+
sources?: Record<string, SourceEntities>;
|
|
11
11
|
}
|
|
12
12
|
//# sourceMappingURL=DeclaredStorage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeclaredStorage.d.ts","sourceRoot":"","sources":["../../src/storage/DeclaredStorage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"DeclaredStorage.d.ts","sourceRoot":"","sources":["../../src/storage/DeclaredStorage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,mDAAmD;AACnD,wBAAgB,eAAe,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO,CAIzD;AAED,MAAM,WAAW,eAAe;IAC9B,qEAAqE;IACrE,EAAE,EAAE,MAAM,CAAC;IACX,wEAAwE;IACxE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;CAC1C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResolvedStorage.d.ts","sourceRoot":"","sources":["../../src/storage/ResolvedStorage.ts"],"names":[],"mappings":"AAAA,OAAO,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"ResolvedStorage.d.ts","sourceRoot":"","sources":["../../src/storage/ResolvedStorage.ts"],"names":[],"mappings":"AAAA,OAAO,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAIzC,OAAO,EAAiC,KAAK,UAAU,EAAe,MAAM,eAAe,CAAC;AAG5F,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,MAAM,WAAW,eAAe;IAC9B,iGAAiG;IACjG,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,GAAG,CAAC,GAAG,SAAS,CAAC;IACjE;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,MAAM,CAAC;IAC1C;;;OAGG;IACH,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC;IACnC,8DAA8D;IAC9D,OAAO,CAAC,EAAE,MAAM,MAAM,EAAE,CAAC;IACzB,mFAAmF;IACnF,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC;IACxC,kGAAkG;IAClG,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,KAAK,OAAO,CAAC;IAC/D,0FAA0F;IAC1F,UAAU,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,cAAc,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,GAAG,KAAK,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;IACvH;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC/C,0FAA0F;IAC1F,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC1C,0FAA0F;IAC1F,KAAK,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAE7B;AAED,8BAA8B;AAC9B,wBAAgB,cAAc,CAC5B,MAAM,EAAE,QAAQ,EAChB,OAAO,CAAC,EAAE,aAAa;AACvB;;;;;;;;GAQG;AACH,IAAI,CAAC,EAAE,MAAM,GACZ,eAAe,CAgBjB;AAoCD,iFAAiF;AACjF,wBAAgB,WAAW,CAAC,QAAQ,EAAE,eAAe,GAAG,eAAe,CAqFtE;AAED;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,eAAe;IAE5C,cAAc,YAlMU,GAAG,QAAQ,MAAM,KAAK,GAAG;IAmMjD,QAAQ,gBA9Lc,MAAM,KAAK,MAAM;IA+LvC,SAAS,YAtLU,MAAM,KAAK,OAAO;IAuLrC,QAAQ,YArLU,MAAM,cAAc,UAAU,KAAK,OAAO;IAsL5D,UAAU,EAAwB,KAAK;IACvC,OAAO,SA9KO,GAAG,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC;EAgL1C"}
|
|
@@ -1,24 +1,10 @@
|
|
|
1
1
|
import '@fougere/adapter-sql/sqlite';
|
|
2
|
-
import { Fronds } from '@fougere/core';
|
|
3
2
|
import { lowerFirst } from '@fougere/core/contract';
|
|
4
3
|
import { existsSync } from 'node:fs';
|
|
5
4
|
import { isAbsolute, resolve } from 'node:path';
|
|
6
|
-
import { Logger, Sources } from '@fougere/core';
|
|
5
|
+
import { Logger, Sources, sourceViewOf } from '@fougere/core';
|
|
7
6
|
import { createMemorySource } from '@fougere/adapter-memory';
|
|
8
7
|
import { declaresStorage } from './DeclaredStorage.js';
|
|
9
|
-
/** The app as ONE source sees it. */
|
|
10
|
-
function viewOf(app, holds) {
|
|
11
|
-
const typed = app;
|
|
12
|
-
const fronds = typed.fronds
|
|
13
|
-
.map((frond) => ({ ...frond, entities: frond.entities.filter((entry) => holds(entry.name)) }))
|
|
14
|
-
.filter((frond) => frond.entities.length > 0);
|
|
15
|
-
return {
|
|
16
|
-
fronds,
|
|
17
|
-
// Lifted, because this function reads its app structurally on purpose — a caller
|
|
18
|
-
// may hand it a shape that is app-LIKE, and the question is still the same one.
|
|
19
|
-
elsewhere: Fronds.hosting(typed.fronds).entityNames().filter((name) => !holds(name)),
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
8
|
/** Resolve the data layer. */
|
|
23
9
|
export function resolveStorage(dbConf, sources,
|
|
24
10
|
/**
|
|
@@ -126,9 +112,9 @@ export function storageFrom(declared) {
|
|
|
126
112
|
// which is what makes a cross-source `ref()` a miss rather than a constraint against a
|
|
127
113
|
// stranger. What a pass DOES is the source's own: it knows its engine, this does not.
|
|
128
114
|
migrate: async (app) => {
|
|
129
|
-
const said = [await base.migrate?.(
|
|
115
|
+
const said = [await base.migrate?.(sourceViewOf(app.fronds, (name) => !home.has(lowerFirst(name))))];
|
|
130
116
|
for (const [name, engine] of engines) {
|
|
131
|
-
said.push(await engine.migrate?.(
|
|
117
|
+
said.push(await engine.migrate?.(sourceViewOf(app.fronds, (e) => home.get(lowerFirst(e)) === name)));
|
|
132
118
|
}
|
|
133
119
|
const reports = said.filter((report) => Boolean(report));
|
|
134
120
|
return reports.length > 0 ? reports.join('\n') : undefined;
|
|
@@ -136,9 +122,9 @@ export function storageFrom(declared) {
|
|
|
136
122
|
// The same partition `migrate` writes through, read — so what the boot refuses is exactly
|
|
137
123
|
// what the command would create. A named source says its name; the default one needs none.
|
|
138
124
|
pending: async (app) => {
|
|
139
|
-
const lines = [...(await base.pending?.(
|
|
125
|
+
const lines = [...(await base.pending?.(sourceViewOf(app.fronds, (name) => !home.has(lowerFirst(name)))) ?? [])];
|
|
140
126
|
for (const [name, engine] of engines) {
|
|
141
|
-
const behind = await engine.pending?.(
|
|
127
|
+
const behind = await engine.pending?.(sourceViewOf(app.fronds, (e) => home.get(lowerFirst(e)) === name)) ?? [];
|
|
142
128
|
lines.push(...behind.map((line) => `${name}: ${line}`));
|
|
143
129
|
}
|
|
144
130
|
return lines;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResolvedStorage.js","sourceRoot":"","sources":["../../src/storage/ResolvedStorage.ts"],"names":[],"mappings":"AAAA,OAAO,6BAA6B,CAAC;AAErC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"ResolvedStorage.js","sourceRoot":"","sources":["../../src/storage/ResolvedStorage.ts"],"names":[],"mappings":"AAAA,OAAO,6BAA6B,CAAC;AAErC,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,EAAgC,MAAM,eAAe,CAAC;AAC5F,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAwCvD,8BAA8B;AAC9B,MAAM,UAAU,cAAc,CAC5B,MAAgB,EAChB,OAAuB;AACvB;;;;;;;;GAQG;AACH,IAAa;IAEb,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,EAAE,CAAC;QAC7B,IAAI,MAAM,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,6EAA6E,CAAC,CAAC;QAE1G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M,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC;YAC7E,MAAM,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC;QACvB,CAAC;KACF,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,OAAO,CAAC,OAAwB;IAC9C,OAAO;QACL,cAAc,EAAE,OAAO,CAAC,cAAc;QACtC,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,UAAU,EAAE,OAAO,CAAC,UAAmB;QACvC,OAAO,EAAE,OAAO,CAAC,OAAO;KACzB,CAAC;AACJ,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Source } from '@fougere/core';
|
|
2
2
|
/** One source: what realizes it, and the entities that live there. */
|
|
3
|
-
export interface
|
|
3
|
+
export interface SourceEntities {
|
|
4
4
|
source: Source;
|
|
5
5
|
entities: string[];
|
|
6
6
|
}
|
|
7
|
-
//# sourceMappingURL=
|
|
7
|
+
//# sourceMappingURL=SourceEntities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SourceEntities.d.ts","sourceRoot":"","sources":["../../src/storage/SourceEntities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,eAAe,CAAC;AAE5C,sEAAsE;AACtE,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SourceEntities.js","sourceRoot":"","sources":["../../src/storage/SourceEntities.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type Transport } from '@fougere/core';
|
|
2
|
+
/** How a call reaches a frond `fronds:` places at an address — HTTP, signed when the deployment gave a key. */
|
|
3
|
+
export declare function remoteTransport(): Promise<(url: string) => Transport>;
|
|
4
|
+
//# sourceMappingURL=RemoteTransport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RemoteTransport.d.ts","sourceRoot":"","sources":["../../src/transport/RemoteTransport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC;AAGhE,+GAA+G;AAC/G,wBAAsB,eAAe,IAAI,OAAO,CAAC,CAAC,GAAG,EAAE,MAAM,KAAK,SAAS,CAAC,CAI3E"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { identityFromEnv } from '@fougere/core';
|
|
2
|
+
import { createHttpTransport } from '@fougere/transport-http';
|
|
3
|
+
/** How a call reaches a frond `fronds:` places at an address — HTTP, signed when the deployment gave a key. */
|
|
4
|
+
export async function remoteTransport() {
|
|
5
|
+
const { sign } = await identityFromEnv();
|
|
6
|
+
return (url) => createHttpTransport(url, sign ? { sign } : {});
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=RemoteTransport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RemoteTransport.js","sourceRoot":"","sources":["../../src/transport/RemoteTransport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAkB,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D,+GAA+G;AAC/G,MAAM,CAAC,KAAK,UAAU,eAAe;IACnC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,eAAe,EAAE,CAAC;IAEzC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,mBAAmB,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AACjE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fougere/defaults",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0-alpha.0",
|
|
4
4
|
"description": "The conventional boot of a Fougere app — the one place storage is wired.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fougere",
|
|
@@ -29,18 +29,18 @@
|
|
|
29
29
|
"src"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@fougere/core": "0.
|
|
33
|
-
"@fougere/adapter-sql": "0.
|
|
34
|
-
"@fougere/transport-http": "0.
|
|
35
|
-
"@fougere/container": "0.
|
|
36
|
-
"@fougere/compiler": "0.
|
|
37
|
-
"@fougere/adapter-memory": "0.
|
|
32
|
+
"@fougere/core": "0.19.0-alpha.0",
|
|
33
|
+
"@fougere/adapter-sql": "0.19.0-alpha.0",
|
|
34
|
+
"@fougere/transport-http": "0.19.0-alpha.0",
|
|
35
|
+
"@fougere/container": "0.19.0-alpha.0",
|
|
36
|
+
"@fougere/compiler": "0.19.0-alpha.0",
|
|
37
|
+
"@fougere/adapter-memory": "0.19.0-alpha.0"
|
|
38
38
|
},
|
|
39
39
|
"publishConfig": {
|
|
40
40
|
"access": "public"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@fougere/schema": "0.
|
|
43
|
+
"@fougere/schema": "0.19.0-alpha.0",
|
|
44
44
|
"kysely": "^0.28.17",
|
|
45
45
|
"better-sqlite3": "^13.0.3",
|
|
46
46
|
"@types/better-sqlite3": "^7.6.13"
|
package/src/index.ts
CHANGED
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
import { migrating, type App, type CreateAppOptions } from '@fougere/core';
|
|
3
3
|
import { boot } from '@fougere/compiler';
|
|
4
4
|
import { loadConfig, remotesOf } from '@fougere/core/node';
|
|
5
|
-
import { createHttpTransport } from '@fougere/transport-http';
|
|
6
5
|
import { type DbConfig } from './storage/DbConfig.js';
|
|
7
6
|
import { resolveStorage, type ResolvedStorage } from './storage/ResolvedStorage.js';
|
|
7
|
+
import { remoteTransport } from './transport/RemoteTransport.js';
|
|
8
8
|
|
|
9
|
+
export { remoteTransport } from './transport/RemoteTransport.js';
|
|
9
10
|
export { declaresStorage } from './storage/DeclaredStorage.js';
|
|
10
11
|
export { layerOf, resolveStorage, storageFrom } from './storage/ResolvedStorage.js';
|
|
11
12
|
export type { DbConfig } from './storage/DbConfig.js';
|
|
@@ -47,7 +48,7 @@ export async function bootApp(root: string, opts: BootAppOptions = {}): Promise<
|
|
|
47
48
|
only: opts.only ?? opts.fronds,
|
|
48
49
|
// `{}` and never undefined: `boot` reads the config's own `fronds:` when handed nothing.
|
|
49
50
|
remotes: useRemotes ? elsewhere : {},
|
|
50
|
-
remoteTransport: useRemotes ?
|
|
51
|
+
remoteTransport: useRemotes ? await remoteTransport() : undefined,
|
|
51
52
|
// One resolver, one place that knows a storage package.
|
|
52
53
|
db: (cfg) => (storage = resolveStorage(cfg.db as DbConfig, (cfg as { sources?: unknown }).sources as never, root)),
|
|
53
54
|
extensions: [...(opts.migrates ? [migrating((app) => storage?.migrate?.(app))] : []), ...(opts.extensions ?? [])],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Source } from '@fougere/core';
|
|
2
2
|
import type { DbConfig } from './DbConfig.js';
|
|
3
|
-
import type {
|
|
3
|
+
import type { SourceEntities } from './SourceEntities.js';
|
|
4
4
|
|
|
5
5
|
/** Does this config ask for persistence at all? */
|
|
6
6
|
export function declaresStorage(dbConf: DbConfig): boolean {
|
|
@@ -13,5 +13,5 @@ export interface DeclaredStorage {
|
|
|
13
13
|
/** The default source — where an entity no placement names lands. */
|
|
14
14
|
db: Source;
|
|
15
15
|
/** The other places. Absent means one source, the way it always was. */
|
|
16
|
-
sources?: Record<string,
|
|
16
|
+
sources?: Record<string, SourceEntities>;
|
|
17
17
|
}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import '@fougere/adapter-sql/sqlite';
|
|
2
2
|
import type { App } from '@fougere/core';
|
|
3
|
-
import { Fronds, type FrondDescriptor } from '@fougere/core';
|
|
4
3
|
import { lowerFirst } from '@fougere/core/contract';
|
|
5
4
|
import { existsSync } from 'node:fs';
|
|
6
5
|
import { isAbsolute, resolve } from 'node:path';
|
|
7
|
-
import { Logger, Sources, type Constraint, type Source
|
|
6
|
+
import { Logger, Sources, sourceViewOf, type Constraint, type Source } from '@fougere/core';
|
|
8
7
|
import { createMemorySource } from '@fougere/adapter-memory';
|
|
9
8
|
import { declaresStorage } from './DeclaredStorage.js';
|
|
10
9
|
import type { DbConfig } from './DbConfig.js';
|
|
11
10
|
import type { SourcesConfig } from './SourcesConfig.js';
|
|
12
|
-
import type {
|
|
11
|
+
import type { SourceEntities } from './SourceEntities.js';
|
|
13
12
|
import type { DeclaredStorage } from './DeclaredStorage.js';
|
|
14
13
|
|
|
15
14
|
export interface ResolvedStorage {
|
|
@@ -46,26 +45,6 @@ export interface ResolvedStorage {
|
|
|
46
45
|
/** Raw synchronous handle, when the engine exposes one. */
|
|
47
46
|
}
|
|
48
47
|
|
|
49
|
-
/** The app as ONE source sees it. */
|
|
50
|
-
function viewOf(
|
|
51
|
-
app: App,
|
|
52
|
-
holds: (name: string) => boolean,
|
|
53
|
-
): SourceView {
|
|
54
|
-
const typed = app as unknown as {
|
|
55
|
-
fronds: { name: string; entities: { name: string }[] }[];
|
|
56
|
-
};
|
|
57
|
-
const fronds = typed.fronds
|
|
58
|
-
.map((frond) => ({ ...frond, entities: frond.entities.filter((entry) => holds(entry.name)) }))
|
|
59
|
-
.filter((frond) => frond.entities.length > 0);
|
|
60
|
-
|
|
61
|
-
return {
|
|
62
|
-
fronds,
|
|
63
|
-
// Lifted, because this function reads its app structurally on purpose — a caller
|
|
64
|
-
// may hand it a shape that is app-LIKE, and the question is still the same one.
|
|
65
|
-
elsewhere: Fronds.hosting(typed.fronds as FrondDescriptor[]).entityNames().filter((name) => !holds(name)),
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
|
|
69
48
|
/** Resolve the data layer. */
|
|
70
49
|
export function resolveStorage(
|
|
71
50
|
dbConf: DbConfig,
|
|
@@ -87,7 +66,7 @@ export function resolveStorage(
|
|
|
87
66
|
return storageFrom({ db: createMemorySource() });
|
|
88
67
|
}
|
|
89
68
|
|
|
90
|
-
const named: Record<string,
|
|
69
|
+
const named: Record<string, SourceEntities> = {};
|
|
91
70
|
for (const [name, conf] of Object.entries(sources ?? {})) {
|
|
92
71
|
named[name] = { source: built(conf, `sources.${name}`, root), entities: conf.entities };
|
|
93
72
|
}
|
|
@@ -192,9 +171,9 @@ export function storageFrom(declared: DeclaredStorage): ResolvedStorage {
|
|
|
192
171
|
// which is what makes a cross-source `ref()` a miss rather than a constraint against a
|
|
193
172
|
// stranger. What a pass DOES is the source's own: it knows its engine, this does not.
|
|
194
173
|
migrate: async (app) => {
|
|
195
|
-
const said = [await base.migrate?.(
|
|
174
|
+
const said = [await base.migrate?.(sourceViewOf(app.fronds, (name) => !home.has(lowerFirst(name))))];
|
|
196
175
|
for (const [name, engine] of engines) {
|
|
197
|
-
said.push(await engine.migrate?.(
|
|
176
|
+
said.push(await engine.migrate?.(sourceViewOf(app.fronds, (e) => home.get(lowerFirst(e)) === name)));
|
|
198
177
|
}
|
|
199
178
|
const reports = said.filter((report): report is string => Boolean(report));
|
|
200
179
|
|
|
@@ -203,9 +182,9 @@ export function storageFrom(declared: DeclaredStorage): ResolvedStorage {
|
|
|
203
182
|
// The same partition `migrate` writes through, read — so what the boot refuses is exactly
|
|
204
183
|
// what the command would create. A named source says its name; the default one needs none.
|
|
205
184
|
pending: async (app) => {
|
|
206
|
-
const lines = [...(await base.pending?.(
|
|
185
|
+
const lines = [...(await base.pending?.(sourceViewOf(app.fronds, (name) => !home.has(lowerFirst(name)))) ?? [])];
|
|
207
186
|
for (const [name, engine] of engines) {
|
|
208
|
-
const behind = await engine.pending?.(
|
|
187
|
+
const behind = await engine.pending?.(sourceViewOf(app.fronds, (e) => home.get(lowerFirst(e)) === name)) ?? [];
|
|
209
188
|
lines.push(...behind.map((line) => `${name}: ${line}`));
|
|
210
189
|
}
|
|
211
190
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { identityFromEnv, type Transport } from '@fougere/core';
|
|
2
|
+
import { createHttpTransport } from '@fougere/transport-http';
|
|
3
|
+
|
|
4
|
+
/** How a call reaches a frond `fronds:` places at an address — HTTP, signed when the deployment gave a key. */
|
|
5
|
+
export async function remoteTransport(): Promise<(url: string) => Transport> {
|
|
6
|
+
const { sign } = await identityFromEnv();
|
|
7
|
+
|
|
8
|
+
return (url) => createHttpTransport(url, sign ? { sign } : {});
|
|
9
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Placement.d.ts","sourceRoot":"","sources":["../../src/storage/Placement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,eAAe,CAAC;AAE5C,sEAAsE;AACtE,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Placement.js","sourceRoot":"","sources":["../../src/storage/Placement.ts"],"names":[],"mappings":""}
|