@fougere/defaults 0.18.0-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 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/) (en/fr).
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';
@@ -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 ? (url) => createHttpTransport(url) : undefined,
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;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D,OAAO,EAAE,cAAc,EAAwB,MAAM,8BAA8B,CAAC;AAEpF,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;IAC3F,sFAAsF;IACtF,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,C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EAAE;QACpC,eAAe,EAAE,UAAU,CAAC,CAAC,CAAC,MAAM,eAAe,EAAE,CAAC,CAAC,CAAC,SAAS;QACjE,wDAAwD;QACxD,EAAE,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,OAAO,GAAG,cAAc,CAAC,GAAG,CAAC,EAAc,EAAG,GAA6B,CAAC,OAAgB,EAAE,IAAI,CAAC,CAAC;QAClH,UAAU,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,IAAI,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC;KAClH,CAAC,CAAC;AACL,CAAC"}
@@ -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.18.0-alpha.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.18.0-alpha.0",
33
- "@fougere/adapter-sql": "0.18.0-alpha.0",
34
- "@fougere/transport-http": "0.18.0-alpha.0",
35
- "@fougere/container": "0.18.0-alpha.0",
36
- "@fougere/compiler": "0.18.0-alpha.0",
37
- "@fougere/adapter-memory": "0.18.0-alpha.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.18.0-alpha.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 ? (url) => createHttpTransport(url) : undefined,
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 ?? [])],
@@ -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
+ }