@fougere/core 0.9.0-alpha.0 → 0.9.2-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.
Files changed (99) hide show
  1. package/dist/boot/AppLifecycle.d.ts +5 -1
  2. package/dist/boot/AppLifecycle.d.ts.map +1 -1
  3. package/dist/boot/AppLifecycle.js.map +1 -1
  4. package/dist/boot/apply.d.ts +5 -1
  5. package/dist/boot/apply.d.ts.map +1 -1
  6. package/dist/boot/apply.js +5 -1
  7. package/dist/boot/apply.js.map +1 -1
  8. package/dist/boot/bootstrap.d.ts.map +1 -1
  9. package/dist/boot/bootstrap.js +21 -15
  10. package/dist/boot/bootstrap.js.map +1 -1
  11. package/dist/boot/card.d.ts.map +1 -1
  12. package/dist/boot/card.js +6 -1
  13. package/dist/boot/card.js.map +1 -1
  14. package/dist/boot/install.d.ts.map +1 -1
  15. package/dist/boot/install.js +18 -2
  16. package/dist/boot/install.js.map +1 -1
  17. package/dist/boot/ports.d.ts +23 -0
  18. package/dist/boot/ports.d.ts.map +1 -1
  19. package/dist/boot/ports.js +49 -0
  20. package/dist/boot/ports.js.map +1 -1
  21. package/dist/boot/remote.d.ts +5 -1
  22. package/dist/boot/remote.d.ts.map +1 -1
  23. package/dist/boot/remote.js.map +1 -1
  24. package/dist/boot/seed.d.ts +5 -1
  25. package/dist/boot/seed.d.ts.map +1 -1
  26. package/dist/boot/seed.js +5 -1
  27. package/dist/boot/seed.js.map +1 -1
  28. package/dist/boot/together.d.ts.map +1 -1
  29. package/dist/boot/together.js +5 -1
  30. package/dist/boot/together.js.map +1 -1
  31. package/dist/builtin/logger.d.ts +1 -2
  32. package/dist/builtin/logger.d.ts.map +1 -1
  33. package/dist/builtin/logger.js +0 -19
  34. package/dist/builtin/logger.js.map +1 -1
  35. package/dist/descriptor/frond.d.ts +5 -1
  36. package/dist/descriptor/frond.d.ts.map +1 -1
  37. package/dist/descriptor/frond.js.map +1 -1
  38. package/dist/identity.d.ts.map +1 -1
  39. package/dist/identity.js +5 -1
  40. package/dist/identity.js.map +1 -1
  41. package/dist/index.d.ts +3 -3
  42. package/dist/index.d.ts.map +1 -1
  43. package/dist/index.js +3 -2
  44. package/dist/index.js.map +1 -1
  45. package/dist/prefab/collector.d.ts +5 -1
  46. package/dist/prefab/collector.d.ts.map +1 -1
  47. package/dist/prefab/collector.js +5 -1
  48. package/dist/prefab/collector.js.map +1 -1
  49. package/dist/prefab/crud.d.ts +9 -5
  50. package/dist/prefab/crud.d.ts.map +1 -1
  51. package/dist/prefab/crud.js +9 -5
  52. package/dist/prefab/crud.js.map +1 -1
  53. package/dist/prefab/mirror.d.ts +5 -1
  54. package/dist/prefab/mirror.d.ts.map +1 -1
  55. package/dist/prefab/mirror.js.map +1 -1
  56. package/dist/prefab/presenter.d.ts +6 -2
  57. package/dist/prefab/presenter.d.ts.map +1 -1
  58. package/dist/prefab/presenter.js +6 -2
  59. package/dist/prefab/presenter.js.map +1 -1
  60. package/dist/prefab/repository.d.ts +5 -1
  61. package/dist/prefab/repository.d.ts.map +1 -1
  62. package/dist/prefab/repository.js.map +1 -1
  63. package/dist/source.d.ts +5 -1
  64. package/dist/source.d.ts.map +1 -1
  65. package/dist/source.js.map +1 -1
  66. package/dist/storage/port.d.ts +27 -1
  67. package/dist/storage/port.d.ts.map +1 -1
  68. package/dist/storage/port.js +70 -0
  69. package/dist/storage/port.js.map +1 -1
  70. package/dist/wire/emit.d.ts.map +1 -1
  71. package/dist/wire/emit.js +5 -1
  72. package/dist/wire/emit.js.map +1 -1
  73. package/dist/wire/errors.d.ts +5 -1
  74. package/dist/wire/errors.d.ts.map +1 -1
  75. package/dist/wire/errors.js +5 -1
  76. package/dist/wire/errors.js.map +1 -1
  77. package/package.json +4 -4
  78. package/src/boot/AppLifecycle.ts +5 -1
  79. package/src/boot/apply.ts +5 -1
  80. package/src/boot/bootstrap.ts +21 -15
  81. package/src/boot/card.ts +6 -1
  82. package/src/boot/install.ts +18 -3
  83. package/src/boot/ports.ts +63 -0
  84. package/src/boot/remote.ts +5 -1
  85. package/src/boot/seed.ts +5 -1
  86. package/src/boot/together.ts +5 -1
  87. package/src/builtin/logger.ts +1 -20
  88. package/src/descriptor/frond.ts +5 -1
  89. package/src/identity.ts +5 -1
  90. package/src/index.ts +4 -3
  91. package/src/prefab/collector.ts +5 -1
  92. package/src/prefab/crud.ts +9 -5
  93. package/src/prefab/mirror.ts +5 -1
  94. package/src/prefab/presenter.ts +6 -2
  95. package/src/prefab/repository.ts +5 -1
  96. package/src/source.ts +5 -1
  97. package/src/storage/port.ts +74 -1
  98. package/src/wire/emit.ts +5 -1
  99. package/src/wire/errors.ts +5 -1
package/dist/source.d.ts CHANGED
@@ -4,7 +4,11 @@ import type { StorageFactory } from './storage/port.js';
4
4
  export type Constraint = 'unique';
5
5
  /** Whether an entity asks for one, anywhere but on its key. */
6
6
  export declare function declares(schema: SchemaView, constraint: Constraint): boolean;
7
- /** A place rows live, whatever realizes it. */
7
+ /**
8
+ * A place rows live, whatever realizes it.
9
+ *
10
+ * Documented: [sources](https://fougere.dev/docs/infra/sources).
11
+ */
8
12
  export interface Source {
9
13
  storageFactory: StorageFactory;
10
14
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../src/source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAQ,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExD,2FAA2F;AAC3F,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;AAElC,+DAA+D;AAC/D,wBAAgB,QAAQ,CAAC,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,GAAG,OAAO,CAK5E;AAED,+CAA+C;AAC/C,MAAM,WAAW,MAAM;IACrB,cAAc,EAAE,cAAc,CAAC;IAC/B;;;;;;OAMG;IACH,OAAO,CAAC,CAAC,IAAI,EAA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"","sources":["../src/source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAmB,MAAM,iBAAiB,CAAC;AAMlE,+DAA+D;AAC/D,MAAM,UAAU,QAAQ,CAAC,MAAkB,EAAE,UAAsB;IACjE,IAAI,UAAU,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC1C,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC;IAEvD,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,CAAC;AACpF,CAAC;AA2CD,iFAAiF;AACjF,MAAM,cAAe,SAAQ,QAAwC;IACnE,kFAAkF;IAClF,IAAI,CAAC,IAAY,EAAE,IAAkB,EAAE,IAAa;QAClD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;CACF;AAED,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,cAAc,CACvC,QAAQ,EACR,2EAA2E,CAC5E,CAAC"}
@@ -64,8 +64,34 @@ export interface Storage<T = Record<string, unknown>> {
64
64
  delete(id: string): Promise<boolean>;
65
65
  /** Returns a scoped storage that restricts all read results to the fields of the given schema. */
66
66
  output(schema: SchemaView): Storage<T>;
67
+ }
68
+ /**
69
+ * A storage that stands in front of another — the base a wrapper extends, and the only
70
+ * thing that makes `Storage` a seam rather than a shape.
71
+ *
72
+ * Merged with the interface above, so the class carries the thirteen gestures as a TYPE
73
+ * while its prototype carries them as a FORWARD. A wrapper writes what it changes and
74
+ * nothing else:
75
+ *
76
+ * ```ts
77
+ * class Audit extends Storage {
78
+ * constructor(private inner: Storage) { super(inner); }
79
+ * async create(row) { await say(row); return this.inner.create(row); }
80
+ * }
81
+ * ```
82
+ *
83
+ * `ports: { Storage: ['Audit'] }` orders the chain when a frond declares two, which is the
84
+ * same key, the same order and the same refusals a port gets. A realization does not extend
85
+ * this: it is handed in by `storageFactory` and is the last link, so what a wrapper does not
86
+ * override reaches it through these forwards.
87
+ *
88
+ * Documented: [storage](https://fougere.dev/docs/business/storage) and
89
+ * [ports](https://fougere.dev/docs/business/ports).
90
+ */
91
+ export declare abstract class Storage<T = Record<string, unknown>> {
92
+ constructor(inner: Storage<T>);
67
93
  /** What this storage wraps — the Kysely instance for the SQL one, something else elsewhere. */
68
- readonly client: unknown;
94
+ get client(): unknown;
69
95
  }
70
96
  /**
71
97
  * Factory that creates a Storage for a given entity.
@@ -1 +1 @@
1
- {"version":3,"file":"port.d.ts","sourceRoot":"","sources":["../../src/storage/port.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE1E,gEAAgE;AAChE,MAAM,WAAW,WAAW;IAC1B,mCAAmC;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,oCAAoC;IACpC,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,0DAA0D;IAC1D,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,iDAAiD;IACjD,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,8BAA8B;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,uCAAuC;IACvC,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;IAEvB,8DAA8D;IAC9D,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC;AAED,oEAAoE;AACpE,MAAM,WAAW,UAAU,CAAC,CAAC,CAAE,SAAQ,KAAK,CAAC,CAAC,CAAC;IAC7C,oEAAoE;IACpE,KAAK,CAAC,EAAE,MAAM,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+F;IAC/F,IAAI,MAAM,IAAI,OAAO,CAAmC;CACzD;AAED;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;AAE3E,2EAA2E;AAC3E,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED,+EAA+E;AAC/E,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,GAAG,MAAM,GAAG,SAAS,CAKtG;AAKD,wEAAwE;AACxE,MAAM,WAAW,QAAQ,CAAC,CAAC,SAAS,SAAS,OAAO,EAAE,EAAE,CAAC,SAAS,SAAS,OAAO,EAAE,GAAG,EAAE;IACvF,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,QAAQ,EAAE;SAAG,CAAC,IAAI,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;KAAE,EAAE,SAAS,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CACnG;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,EAAE,SAAS,GAAE,SAAS,MAAM,EAAO,GAAG,MAAM,CAGpG;AAOD,8EAA8E;AAC9E,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG;IAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;IAAC,SAAS,EAAE,MAAM,EAAE,CAAA;CAAE,GAAG,SAAS,CAKzG"}
@@ -21,6 +21,76 @@ export function assertListOptions(options, entity, declared) {
21
21
  return;
22
22
  throw new Error(`${entity}.list(): unknown orderBy \`${orderBy}\`. ${entity} declares ${declared.join(', ')}.`);
23
23
  }
24
+ /**
25
+ * What each link of a chain stands in front of.
26
+ *
27
+ * A SYMBOL on the instance, set through a cast so it joins no declaration: `Storage` is an
28
+ * interface as well as a class, and the realizations satisfy it structurally —
29
+ * `storageOver` returns an object literal, and one more member would stop it being a
30
+ * storage. A `#private` field says the same thing and makes the class NOMINAL, which
31
+ * refuses every realization at once.
32
+ *
33
+ * On the instance and not in a `WeakMap` beside it, because `StorageGuard.guard` hands out
34
+ * `Object.create(storage)` — a new object whose prototype is the link. A symbol is found
35
+ * through that chain; a map keyed on the link is not, and the guarded object read
36
+ * `undefined`.
37
+ */
38
+ const BEHIND = Symbol('fougere.storage.behind');
39
+ const behind = (link) => link[BEHIND];
40
+ /**
41
+ * A storage that stands in front of another — the base a wrapper extends, and the only
42
+ * thing that makes `Storage` a seam rather than a shape.
43
+ *
44
+ * Merged with the interface above, so the class carries the thirteen gestures as a TYPE
45
+ * while its prototype carries them as a FORWARD. A wrapper writes what it changes and
46
+ * nothing else:
47
+ *
48
+ * ```ts
49
+ * class Audit extends Storage {
50
+ * constructor(private inner: Storage) { super(inner); }
51
+ * async create(row) { await say(row); return this.inner.create(row); }
52
+ * }
53
+ * ```
54
+ *
55
+ * `ports: { Storage: ['Audit'] }` orders the chain when a frond declares two, which is the
56
+ * same key, the same order and the same refusals a port gets. A realization does not extend
57
+ * this: it is handed in by `storageFactory` and is the last link, so what a wrapper does not
58
+ * override reaches it through these forwards.
59
+ *
60
+ * Documented: [storage](https://fougere.dev/docs/business/storage) and
61
+ * [ports](https://fougere.dev/docs/business/ports).
62
+ */
63
+ export class Storage {
64
+ constructor(inner) {
65
+ this[BEHIND] = inner;
66
+ }
67
+ list(options) { return behind(this).list(options); }
68
+ findById(id, options) { return behind(this).findById(id, options); }
69
+ findBy(criteria, options) {
70
+ return behind(this).findBy(criteria, options);
71
+ }
72
+ findAllBy(criteria, options) {
73
+ return behind(this).findAllBy(criteria, options);
74
+ }
75
+ findByKeys(ids, options) {
76
+ return behind(this).findByKeys(ids, options);
77
+ }
78
+ findAllByKeys(field, keys, options) {
79
+ return behind(this).findAllByKeys(field, keys, options);
80
+ }
81
+ create(input, options) { return behind(this).create(input, options); }
82
+ upsert(input, options) { return behind(this).upsert(input, options); }
83
+ upsertAll(inputs, options) {
84
+ return behind(this).upsertAll(inputs, options);
85
+ }
86
+ update(id, input, options) {
87
+ return behind(this).update(id, input, options);
88
+ }
89
+ delete(id) { return behind(this).delete(id); }
90
+ output(schema) { return behind(this).output(schema); }
91
+ /** What this storage wraps — the Kysely instance for the SQL one, something else elsewhere. */
92
+ get client() { return behind(this).client; }
93
+ }
24
94
  /** Container key of an entity's storage — 'reading' → 'ReadingStorage'. */
25
95
  export function storageKeyOf(entity) {
26
96
  return `${upperFirst(entity)}${HELD}`;
@@ -1 +1 @@
1
- {"version":3,"file":"port.js","sourceRoot":"","sources":["../../src/storage/port.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAmB,MAAM,iBAAiB,CAAC;AA0C1E,oCAAoC;AACpC,MAAM,gBAAgB,GAAG;IACvB,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ;CAC1E,CAAC;AAEX;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAC/B,OAA2B,EAC3B,MAAc,EACd,QAA2B;IAE3B,IAAI,CAAC,OAAO;QAAE,OAAO;IACrB,MAAM,KAAK,GAAG,IAAI,GAAG,CAAS,gBAAgB,CAAC,CAAC;IAChD,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;IACxE,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CACb,GAAG,MAAM,2BAA2B,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CA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AAI,EAAE,MAAM,GAAG,MAAM,CAE9C;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE/C;AAKD,+EAA+E;AAC/E,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAE7D;AAED,+EAA+E;AAC/E,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAE9D;AAQD,wFAAwF;AACxF,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,SAAS;IAAE,IAAI,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,EAAE,GAAG,MAAM,EAAE,CAE3F;AAED,2FAA2F;AAC3F,wBAAgB,cAAc,CAAC,QAAQ,EAAE,SAAS;IAAE,IAAI,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,EAAE,GAAG,MAAM,EAAE,CAEzF"}
package/dist/wire/emit.js CHANGED
@@ -1,4 +1,8 @@
1
- /** Announcing a fact — the half of the topology `remotes:` never covered. */
1
+ /**
2
+ * Announcing a fact — the half of the topology `remotes:` never covered.
3
+ *
4
+ * Documented: [facts](https://fougere.dev/docs/business/facts).
5
+ */
2
6
  import { lowerFirst } from '@fougere/schema';
3
7
  /** The container key of an emission — THE one place that spells the format. */
4
8
  export function emitKeyOf(fact) {
@@ -1 +1 @@
1
- {"version":3,"file":"emit.js","sourceRoot":"","sources":["../../src/wire/emit.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AA6B7C,+EAA+E;AAC/E,MAAM,UAAU,SAAS,CAAC,IAAY;IACpC,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC;AACnC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,IAAY;IACrC,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC;AACpC,CAAC;AAED,MAA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GAAG,CAAC,SAAS,CAAC;aACd,MAAM,CAAC,CAAC,IAAI,EAAkB,EAAE,CAAC,IAAI,KAAK,SAAS,CAAC,CACxD,CAAC,CAAC;AACL,CAAC"}
@@ -1,4 +1,8 @@
1
- /** The error vocabulary — what a refusal IS, independently of who hears it. */
1
+ /**
2
+ * The error vocabulary — what a refusal IS, independently of who hears it.
3
+ *
4
+ * Documented: [errors](https://fougere.dev/docs/business/errors).
5
+ */
2
6
  import type { ValidationError } from '@fougere/schema';
3
7
  /** Semantic error codes — transport-agnostic. Each bridge maps them to its own format. */
4
8
  export declare enum ErrorCode {
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/wire/errors.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAE/E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAIvD,0FAA0F;AAC1F,oBAAY,SAAS;IAEnB,iBAAiB,sBAAsB;IACvC,WAAW,gBAAgB;IAG3B,YAAY,iBAAiB;IAC7B,SAAS,cAAc;IAGvB,SAAS,cAAc;IACvB,IAAI,SAAS;IACb,QAAQ,aAAa;IACrB,MAAM,WAAW;IACjB,kBAAkB,uBAAuB;IAGzC,mBAAmB,wBAAwB;IAC3C,iBAAiB,sBAAsB;IACvC,oBAAoB,yBAAyB;IAC7C,iBAAiB,sBAAsB;IACvC,eAAe,oBAAoB;IAGnC,cAAc,mBAAmB;IACjC,eAAe,oBAAoB;IACnC,WAAW,gBAAgB;IAC3B,mBAAmB,wBAAwB;IAC3C,eAAe,oBAAoB;CACpC;AAID,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,qBAAa,Y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AAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,qBAAa,YAAa,SAAQ,KAAK;IACrC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;gBAEf,OAAO,EAAE,mBAAmB;IASxC,MAAM;;;;;;;IAUN,iEAAiE;IACjE,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,GAAG,YAAY;CAW7C;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,EAAE,GAAG,SAAS,CAWhF"}
@@ -1,4 +1,8 @@
1
- /** The error vocabulary — what a refusal IS, independently of who hears it. */
1
+ /**
2
+ * The error vocabulary — what a refusal IS, independently of who hears it.
3
+ *
4
+ * Documented: [errors](https://fougere.dev/docs/business/errors).
5
+ */
2
6
  // ── ErrorCode ──────────────────────────────────
3
7
  /** Semantic error codes — transport-agnostic. Each bridge maps them to its own format. */
4
8
  export var ErrorCode;
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/wire/errors.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAI/E,kDAAkD;AAElD,0FAA0F;AAC1F,MAAM,CAAN,IAAY,SA6BX;AA7BD,WAAY,SAAS;IACnB,QAAQ;IACR,oDAAuC,CAAA;IACvC,wCAA2B,CAAA;IAE3B,OAAO;IACP,0CAA6B,CAAA;IAC7B,oCAAuB,CAAA;IAEvB,YAAY;IACZ,oCAAuB,CAAA;IACvB,0BAAa,CAAA;IACb,kCAAqB,CAAA;IACrB,8BAAiB,CAAA;IACjB,sDAAyC,CAAA;IAEzC,SAAS;IACT,wDAA2C,CAAA;IAC3C,oDAAuC,CAAA;IACvC,0DAA6C,CAAA;IAC7C,oDAAuC,CAAA;IACv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,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS;YAC/D,SAAS,EAAE,OAAO,GAAG,CAAC,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;YACxE,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE;SAChF,CAAC,CAAC;IACL,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAc;IAC/C,IAAI,CAAC,CAAC,KAAK,YAAY,YAAY,CAAC,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,iBAAiB;QAAE,OAAO,SAAS,CAAC;IACrG,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IAC1B,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC;QAAE,OAAO,SAAS,CAAC;IAC9C,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,CAC7B,CAAC,KAAK,EAA4B,EAAE,CAClC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;WACxC,KAAK,CAAC,OAAO,CAAE,KAAyB,CAAC,IAAI,CAAC;WAC9C,OAAQ,KAAyB,CAAC,OAAO,KAAK,QAAQ,CAC5D,CAAC;IACF,OAAO,QAAQ,CAAC,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;AACnE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fougere/core",
3
- "version": "0.9.0-alpha.0",
3
+ "version": "0.9.2-alpha.0",
4
4
  "description": "The core — scan, call contract, façades, remote stand-ins.",
5
5
  "keywords": [
6
6
  "fougere",
@@ -61,12 +61,12 @@
61
61
  "dependencies": {
62
62
  "@typescript/typescript6": "^6.0.2",
63
63
  "dequal": "^2.0.3",
64
- "@fougere/schema": "0.9.0-alpha.0",
65
- "@fougere/container": "0.9.0-alpha.0"
64
+ "@fougere/container": "0.9.2-alpha.0",
65
+ "@fougere/schema": "0.9.2-alpha.0"
66
66
  },
67
67
  "devDependencies": {
68
68
  "@types/node": "^22.0.0",
69
- "@fougere/compiler": "0.9.0-alpha.0"
69
+ "@fougere/compiler": "0.9.2-alpha.0"
70
70
  },
71
71
  "publishConfig": {
72
72
  "access": "public"
@@ -1,7 +1,11 @@
1
1
  import type { App } from './types.js';
2
2
  import type { FrondDescriptor } from '../descriptor/frond.js';
3
3
 
4
- /** One process-level extension and its reversible lifecycle. */
4
+ /**
5
+ * One process-level extension and its reversible lifecycle.
6
+ *
7
+ * Documented: [lifecycle](https://fougere.dev/docs/infra/lifecycle).
8
+ */
5
9
  export interface Extension {
6
10
  name: string;
7
11
  /**
package/src/boot/apply.ts CHANGED
@@ -9,7 +9,11 @@ export interface ConfigApplication {
9
9
  pending: string[];
10
10
  }
11
11
 
12
- /** What a (re-)read config changes in a process that is already running. */
12
+ /**
13
+ * What a (re-)read config changes in a process that is already running.
14
+ *
15
+ * Documented: [lifecycle](https://fougere.dev/docs/infra/lifecycle).
16
+ */
13
17
  export function applyConfig(next: FougereConfig, inForce?: FougereConfig): ConfigApplication {
14
18
  const applied: string[] = [];
15
19
  const pending: string[] = [];
@@ -332,10 +332,6 @@ export async function createApp(options: CreateAppOptions): Promise<App> {
332
332
  // Once every door exists: what is announced here and what is listened to are both known.
333
333
  emissions.register();
334
334
 
335
- // The boot's own lines, and every line after them. Held until here because a boot
336
- // writes most of what a process logs and writes it before any door exists — so the
337
- // lines that say what this app is made of are the ones a destination would miss.
338
- // `LogLine` is core's for this reason: naming it costs no optional package.
339
335
  // Which doors carry a line, read from who SUBSCRIBED — so a third party's destination
340
336
  // is left alone by the two middlewares that observe every operation.
341
337
  for (const door of emissions.doorsFor(LOG_LINE)) {
@@ -343,17 +339,6 @@ export async function createApp(options: CreateAppOptions): Promise<App> {
343
339
  CARRIES_LINE.add(door);
344
340
  }
345
341
 
346
- if (emissions.listensTo().includes(LOG_LINE)) {
347
- const emit = container.resolve<Emit<LogLine>>(emitKeyOf(LogLine.name));
348
- // `at` is the record's own epoch, and the entity says `created()` — so the line
349
- // keeps WHEN IT WAS WRITTEN rather than when it was handed over, which for a held
350
- // boot line is a different moment.
351
- stopAnnouncing = carry.to(({ at, ...line }: LogRecord) => void emit({ ...line, at: new Date(at) }));
352
- } else {
353
- // No destination in this app: the console had them, and holding more would grow.
354
- carry.forget();
355
- }
356
-
357
342
  /** The last resort, held by the container so every resolution path shares it. */
358
343
  container.setFallback?.((name) => {
359
344
  if (!remoteRouter) return undefined;
@@ -578,6 +563,27 @@ export async function createApp(options: CreateAppOptions): Promise<App> {
578
563
  built = app;
579
564
  await appLifecycle.up(app);
580
565
 
566
+ // The boot's own lines, and every line after them. Held until here because a boot
567
+ // writes most of what a process logs and writes it before any door exists — so the
568
+ // lines that say what this app is made of are the ones a destination would miss.
569
+ // `LogLine` is core's for this reason: naming it costs no optional package.
570
+ //
571
+ // AFTER the ascent, because handing them over RESOLVES the destination, and what a
572
+ // destination an extension brought depends on is registered by that same extension's
573
+ // `up`: `calls()` registers `LogRing` and `ErrorRing` there, and `KeepHandler` asks for
574
+ // both. Resolved before the ascent, every held line died on `'LogRing' is not
575
+ // registered` — measured on `demos/observability`.
576
+ if (emissions.listensTo().includes(LOG_LINE)) {
577
+ const emit = container.resolve<Emit<LogLine>>(emitKeyOf(LogLine.name));
578
+ // `at` is the record's own epoch, and the entity says `created()` — so the line
579
+ // keeps WHEN IT WAS WRITTEN rather than when it was handed over, which for a held
580
+ // boot line is a different moment.
581
+ stopAnnouncing = carry.to(({ at, ...line }: LogRecord) => void emit({ ...line, at: new Date(at) }));
582
+ } else {
583
+ // No destination in this app: the console had them, and holding more would grow.
584
+ carry.forget();
585
+ }
586
+
581
587
  return app;
582
588
  } catch (cause) {
583
589
  // The caller cannot release what a failed boot took: it handed `onDispose` over before
package/src/boot/card.ts CHANGED
@@ -13,7 +13,12 @@ export function identityCardOf(app: App, surface?: string): IdentityCard {
13
13
  const declared = app.fronds.schemas();
14
14
 
15
15
  return {
16
- fronds: app.fronds.map((frond) => {
16
+ // What this app SERVES, never what instruments it. A frond an extension BROUGHT is a
17
+ // subscriber — `@fougere/calls` and `@fougere/observability` each bring one — and it is
18
+ // in every process that installed the extension, so two remotes then claimed the same
19
+ // door and routing refused: `Two remotes serve 'export'`. `FrondDescriptor.brought` is
20
+ // the mark `calls`' panel and `rpc.topology` already read.
21
+ fronds: app.fronds.filter((frond) => !frond.brought).map((frond) => {
17
22
  // What the frond answers to, not what it stores. This walked `frond.entities`, so a
18
23
  // handler carrying no entity — a health check, a search across shapes — was built,
19
24
  // served, and absent from the card: `sync` could not generate its door and a remote
@@ -6,7 +6,7 @@ import type { Dispatcher } from '../dispatch/Dispatcher.js';
6
6
  import type { RouteRegistry } from '../dispatch/RouteRegistry.js';
7
7
  import type { Emissions } from './Emissions.js';
8
8
  import type { EffectiveOperationsMap, EffectiveOperationModel } from '../effective-operation.js';
9
- import { nameOf } from '../descriptor/frond.js';
9
+ import { nameOf, type ProviderEntry } from '../descriptor/frond.js';
10
10
  import type { EntityEntry, FrondDescriptor, HandlerEntry } from '../descriptor/frond.js';
11
11
  import type { OperationsMap } from '../wire/operation.js';
12
12
  import type { AppMiddleware } from '../wire/middleware.js';
@@ -16,7 +16,7 @@ import { HandlerFacade } from '../dispatch/HandlerFacade.js';
16
16
  import { targetOf } from '../prefab/prefab.js';
17
17
  import { ownersOf, refuseStorageInUserCode, refuseCrudOnOwned } from './ownership.js';
18
18
  import { StorageGuard } from '../dispatch/StorageGuard.js';
19
- import { portBindings } from './ports.js';
19
+ import { portBindings, seamChains, wrapping, SEAMS } from './ports.js';
20
20
  import { facadeKeyOf, contractsKeyOf } from '../wire/call.js';
21
21
  import { inheritsCrud, subjectOf } from '../prefab/crud.js';
22
22
  import { repositoryKeyOf } from '../prefab/repository.js';
@@ -124,11 +124,22 @@ export async function installFrond(frond: FrondDescriptor, assembly: Assembly):
124
124
  for (const provider of frond.providers) {
125
125
  scope.register(nameOf(provider), provider.ctor, { deps: provider.deps });
126
126
  }
127
+ // What this frond puts in front of one of the framework's own ports. Its own, like every
128
+ // provider — a link goes where its frond goes, which is what a frond behind `remotes:`
129
+ // takes with it.
130
+ const seams = seamChains(frond.providers, options.ports);
131
+ for (const [seam, links] of seams) {
132
+ boundPorts.add(seam);
133
+ frondLog.debug(`seam ${seam} → ${links.map((one) => one.ctor.name).join(' → ')} → the realization`);
134
+ }
127
135
  // …and again under the port each one extends, so `private payment: Payment`
128
136
  // reaches the realization instead of the base class it is declared against.
129
137
  // Registered AFTER the loop above so a port key always wins over the base's
130
138
  // own registration — same precedence as a declared repository over its default.
131
139
  for (const [port, chain] of portBindings(frond.providers, (n) => scope.has(n), options.ports)) {
140
+ // A seam is bound where its realization is BUILT, not under a container key — nothing
141
+ // resolves `Storage`, and `<Entity>Storage` is what a handler asks for.
142
+ if (SEAMS.has(port)) continue;
132
143
  // Registered from the INSIDE OUT, each wrapper asking for the one it stands in front
133
144
  // of: the container resolves a dep by NAME, so wrapping is a substituted key and
134
145
  // needs nothing of the container itself. The outermost answers under the port.
@@ -168,8 +179,12 @@ export async function installFrond(frond: FrondDescriptor, assembly: Assembly):
168
179
  ? baseStorage.output(outputSchema)
169
180
  : baseStorage;
170
181
 
182
+ // The declared chain first, then the guard OUTSIDE it: the guard hands on the value
183
+ // it parsed, so a wrapper reads what the entity says a row is rather than what
184
+ // arrived. Same order the client door has held since `StorageGuard` existed.
185
+ const linked = wrapping('Storage', seams.get('Storage') ?? [], scoped, (dep) => scope.resolve(dep));
171
186
  // Storage is a way out like the client surface — see `StorageGuard`.
172
- const guarded = new StorageGuard(entity.entityClass.getFields(), entity.name).guard(scoped);
187
+ const guarded = new StorageGuard(entity.entityClass.getFields(), entity.name).guard(linked);
173
188
  scope.registerValue(key, guarded);
174
189
 
175
190
  // The default repository IS the guarded port — it already answers every gesture a
package/src/boot/ports.ts CHANGED
@@ -1,5 +1,68 @@
1
1
  import { nameOf, type ProviderEntry } from '../descriptor/frond.js';
2
2
 
3
+ /**
4
+ * The framework's own ports — a class core exports that a user class may stand in front of.
5
+ *
6
+ * They differ from a port in one way, and it decides everything else: their realization is
7
+ * HANDED IN rather than scanned (`storageFactory` builds one per entity), so a class that
8
+ * extends one can only be a wrapper.
9
+ *
10
+ * The scope is the FROND, like every other provider, and there is no key that widens it: a
11
+ * link that must be everywhere is a frond that is everywhere, which `Extension.fronds`
12
+ * already answers — `@fougere/calls` brings one into every app that installs it. A
13
+ * process-wide key would break the gradient, since a frond moved behind `remotes:` would
14
+ * silently leave the reach of a link its own code never mentioned.
15
+ *
16
+ * Documented: [ports](https://fougere.dev/docs/business/ports).
17
+ */
18
+ export const SEAMS = new Set(['Storage']);
19
+
20
+ /**
21
+ * What stands in front of each seam, outermost first — the same reading `portBindings`
22
+ * does, with no realization to find.
23
+ */
24
+ export function seamChains(
25
+ providers: ProviderEntry[],
26
+ chosen: Record<string, string | readonly string[]> | undefined,
27
+ ): Map<string, ProviderEntry[]> {
28
+ const wrappers = new Map<string, ProviderEntry[]>();
29
+ for (const provider of providers) {
30
+ const seam = (Object.getPrototypeOf(provider.ctor) as { name?: string } | null)?.name;
31
+ if (!seam || !SEAMS.has(seam)) continue;
32
+ if (!provider.deps.includes(seam)) {
33
+ throw new Error(
34
+ `[ports] ${nameOf(provider)} extends ${seam}, and a seam's realization is handed in `
35
+ + `rather than declared — so a class extending one can only stand IN FRONT of it, `
36
+ + `which it says by asking for it: constructor(private inner: ${seam}).`,
37
+ );
38
+ }
39
+ wrappers.set(seam, [...(wrappers.get(seam) ?? []), provider]);
40
+ }
41
+
42
+ const bound = new Map<string, ProviderEntry[]>();
43
+ for (const [seam, all] of wrappers) bound.set(seam, chain(seam, [], all, chosen?.[seam]));
44
+
45
+ return bound;
46
+ }
47
+
48
+ /** Put the declared chain in front of an instance the framework holds, and hand back the outermost. */
49
+ export function wrapping<T extends object>(
50
+ seam: string,
51
+ links: readonly ProviderEntry[],
52
+ inner: T,
53
+ resolve: (name: string) => unknown,
54
+ ): T {
55
+ let current = inner;
56
+ // From the INSIDE out, so each link is handed the one it stands in front of — the same
57
+ // order `install.ts` registers a port's chain in, for the same reason.
58
+ for (const link of [...links].reverse()) {
59
+ const made = link.ctor as unknown as new (...args: unknown[]) => T;
60
+ current = new made(...link.deps.map((dep) => (dep === seam ? current : resolve(dep))));
61
+ }
62
+
63
+ return current;
64
+ }
65
+
3
66
  /**
4
67
  * A port is a class something already answers under, and what answers it may be a CHAIN:
5
68
  * the realization, wrapped by whoever stands in front of it.
@@ -1,4 +1,8 @@
1
- /** Remote façade — what resolve() falls back to. */
1
+ /**
2
+ * Remote façade — what resolve() falls back to.
3
+ *
4
+ * Documented: [the gradient](https://fougere.dev/docs/infra/gradient).
5
+ */
2
6
  import type { FrondCall, Transport } from '../wire/call.js';
3
7
  import { assertIdentityCard, RPC_ENTITY } from '../wire/call.js';
4
8
  import { runMiddlewares, type AppMiddleware, type OperationContext } from '../wire/middleware.js';
package/src/boot/seed.ts CHANGED
@@ -61,7 +61,11 @@ interface SeedDoor {
61
61
  write(item: unknown): Promise<unknown>;
62
62
  }
63
63
 
64
- /** Plant a set of seeds, in the order given. */
64
+ /**
65
+ * Plant a set of seeds, in the order given.
66
+ *
67
+ * Documented: [seeds](https://fougere.dev/docs/business/seeds).
68
+ */
65
69
  export async function runSeeds(
66
70
  app: App,
67
71
  seeds: SeedEntry[],
@@ -1,4 +1,8 @@
1
- /** Building a frame — what a handler asking for `Together<[…]>` receives. */
1
+ /**
2
+ * Building a frame — what a handler asking for `Together<[…]>` receives.
3
+ *
4
+ * Documented: [together](https://fougere.dev/docs/business/together).
5
+ */
2
6
  import { ambient } from '#ambient';
3
7
  import { upperFirst, lowerFirst, type SchemaView } from '@fougere/schema';
4
8
  import type { Container } from '@fougere/container';
@@ -13,11 +13,9 @@ export interface LogRecord {
13
13
  at: number;
14
14
  }
15
15
 
16
+ /** Where a line goes once it is written — `@fougere/log` ships one, `observability` another. */
16
17
  export type LogSink = (record: LogRecord) => void;
17
18
 
18
- /** Who else takes this process's log lines, beside the console. */
19
- const sinks: LogSink[] = [];
20
-
21
19
  /**
22
20
  * Where one boot's lines wait, and where they go once they can.
23
21
  *
@@ -66,15 +64,6 @@ export class Carry {
66
64
  }
67
65
  }
68
66
 
69
- /** Take every line this process logs. Returns the way to withdraw. */
70
- export function onLog(next: LogSink): () => void {
71
- sinks.push(next);
72
- return () => {
73
- const at = sinks.indexOf(next);
74
- if (at >= 0) sinks.splice(at, 1);
75
- };
76
- }
77
-
78
67
  const LEVELS: Record<LogLevel, number> = { debug: 0, info: 1, warn: 2, error: 3, silent: 4 };
79
68
 
80
69
  /** The level, held ONCE for the process and CONSULTED at every emission. */
@@ -176,14 +165,6 @@ export class Logger {
176
165
  level: level as LogRecord['level'], name: this.name, message: msg, args, at: Date.now(),
177
166
  };
178
167
 
179
- // Beside the console, never instead of it: a forwarded line is an addition, and a
180
- // sink that throws must not cost the operator the line they were reading.
181
- for (const take of sinks) {
182
- try {
183
- take(record);
184
- } catch { /* forwarding never breaks logging */ }
185
- }
186
-
187
168
  this.carry?.push(record);
188
169
 
189
170
  // The console ALWAYS, whoever else took the line. Skipping it once a destination
@@ -1,4 +1,8 @@
1
- /** What a frond is made of — one interface per convention directory. */
1
+ /**
2
+ * What a frond is made of — one interface per convention directory.
3
+ *
4
+ * Documented: [the Frond](https://fougere.dev/docs/concepts/frond).
5
+ */
2
6
  import type { SchemaView } from '@fougere/schema';
3
7
  import type { Param, OperationContract, OperationsMap } from '../wire/operation.js';
4
8
  import type { PresenterViews } from '../prefab/presenter.js';
package/src/identity.ts CHANGED
@@ -1,4 +1,8 @@
1
- /** Who is calling — the proof, not the claim. */
1
+ /**
2
+ * Who is calling — the proof, not the claim.
3
+ *
4
+ * Documented: [identity](https://fougere.dev/docs/infra/identity).
5
+ */
2
6
  import { crypto } from '#crypto';
3
7
  import type { PublicJwk, Signer, Verifier } from './crypto/port.js';
4
8
  import { b64url, unb64url, bytesOf, textOf, unb64 } from './crypto/encoding.js';
package/src/index.ts CHANGED
@@ -63,15 +63,16 @@ export { callValueOf } from './contract.js';
63
63
  export { toHttpError } from './wire/http-error.js';
64
64
  export { toPublicError } from './contract.js';
65
65
  export { loggerMiddleware } from './wire/loggerMiddleware.js';
66
- export { Carry, Logger, setLogLevel, logLevel, envLevel, onLog, formatted } from './builtin/logger.js';
66
+ export { Carry, Logger, setLogLevel, logLevel, envLevel, formatted } from './builtin/logger.js';
67
67
  export type { LogRecord, Rendered, LogSink } from './builtin/logger.js';
68
68
  // The fact a boot announces. Its destinations are `@fougere/log`'s; the line is core's.
69
69
  export { default as LogLine, CARRIES_LINE, LOG_LINE } from './builtin/LogLine.js';
70
70
  // What a re-read config changes in a running process — and what it cannot.
71
71
  export { applyConfig } from './boot/apply.js';
72
72
  export { Config } from './builtin/config.js';
73
- export type { Storage, StorageFactory, ListOptions, ListResult, Together } from './storage/port.js';
74
- export { togetherKeyOf } from './storage/port.js';
73
+ export type { StorageFactory, ListOptions, ListResult, Together } from './storage/port.js';
74
+ // A VALUE as well as a type: it is what a wrapper extends, which is the whole of declaring one.
75
+ export { Storage, togetherKeyOf } from './storage/port.js';
75
76
  export type { Constraint, Source, SourceConfig, SourceView } from './source.js';
76
77
  export { Sources } from './source.js';
77
78
  export { storageOver } from './storage/store.js';