@fougere/core 0.12.2-alpha.0 → 0.12.4-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 (126) hide show
  1. package/dist/EffectiveOperationModel.d.ts +1 -4
  2. package/dist/EffectiveOperationModel.d.ts.map +1 -1
  3. package/dist/EffectiveOperationModel.js +181 -173
  4. package/dist/EffectiveOperationModel.js.map +1 -1
  5. package/dist/FougereConfig.d.ts +5 -3
  6. package/dist/FougereConfig.d.ts.map +1 -1
  7. package/dist/FougereConfig.js +11 -13
  8. package/dist/FougereConfig.js.map +1 -1
  9. package/dist/FrondDeclaration.d.ts.map +1 -1
  10. package/dist/FrondDeclaration.js +1 -5
  11. package/dist/FrondDeclaration.js.map +1 -1
  12. package/dist/Source.js +1 -1
  13. package/dist/Source.js.map +1 -1
  14. package/dist/SourceView.d.ts +0 -2
  15. package/dist/SourceView.d.ts.map +1 -1
  16. package/dist/boot/App.d.ts +2 -4
  17. package/dist/boot/App.d.ts.map +1 -1
  18. package/dist/boot/AppLifecycle.d.ts +5 -0
  19. package/dist/boot/AppLifecycle.d.ts.map +1 -1
  20. package/dist/boot/AppLifecycle.js +19 -10
  21. package/dist/boot/AppLifecycle.js.map +1 -1
  22. package/dist/boot/AuthRuntime.d.ts +5 -12
  23. package/dist/boot/AuthRuntime.d.ts.map +1 -1
  24. package/dist/boot/AuthRuntime.js +2 -1
  25. package/dist/boot/AuthRuntime.js.map +1 -1
  26. package/dist/boot/CreateAppOptions.d.ts +0 -11
  27. package/dist/boot/CreateAppOptions.d.ts.map +1 -1
  28. package/dist/boot/Emissions.d.ts.map +1 -1
  29. package/dist/boot/Emissions.js +3 -6
  30. package/dist/boot/Emissions.js.map +1 -1
  31. package/dist/boot/Hosting.d.ts +2 -1
  32. package/dist/boot/Hosting.d.ts.map +1 -1
  33. package/dist/boot/bootstrap.d.ts.map +1 -1
  34. package/dist/boot/bootstrap.js +140 -263
  35. package/dist/boot/bootstrap.js.map +1 -1
  36. package/dist/boot/install.d.ts.map +1 -1
  37. package/dist/boot/install.js +102 -114
  38. package/dist/boot/install.js.map +1 -1
  39. package/dist/boot/relations.d.ts.map +1 -1
  40. package/dist/boot/relations.js.map +1 -1
  41. package/dist/boot/seed.d.ts.map +1 -1
  42. package/dist/boot/seed.js.map +1 -1
  43. package/dist/descriptor/Fronds.d.ts +5 -0
  44. package/dist/descriptor/Fronds.d.ts.map +1 -1
  45. package/dist/descriptor/Fronds.js +8 -0
  46. package/dist/descriptor/Fronds.js.map +1 -1
  47. package/dist/descriptor/index.d.ts +1 -0
  48. package/dist/descriptor/index.d.ts.map +1 -1
  49. package/dist/descriptor/index.js +1 -0
  50. package/dist/descriptor/index.js.map +1 -1
  51. package/dist/dispatch/InFlight.d.ts +3 -2
  52. package/dist/dispatch/InFlight.d.ts.map +1 -1
  53. package/dist/dispatch/InFlight.js +11 -1
  54. package/dist/dispatch/InFlight.js.map +1 -1
  55. package/dist/index.d.ts +2 -4
  56. package/dist/index.d.ts.map +1 -1
  57. package/dist/index.js +2 -0
  58. package/dist/index.js.map +1 -1
  59. package/dist/node.d.ts +1 -1
  60. package/dist/node.d.ts.map +1 -1
  61. package/dist/node.js +1 -1
  62. package/dist/node.js.map +1 -1
  63. package/dist/prefab/CrudConstructor.d.ts.map +1 -1
  64. package/dist/prefab/CrudConstructor.js.map +1 -1
  65. package/dist/storage/Comparison.d.ts +2 -2
  66. package/dist/storage/Comparison.d.ts.map +1 -1
  67. package/dist/storage/Comparison.js +3 -1
  68. package/dist/storage/Comparison.js.map +1 -1
  69. package/dist/wire/Emit.d.ts +0 -2
  70. package/dist/wire/Emit.d.ts.map +1 -1
  71. package/dist/wire/Emit.js +1 -1
  72. package/dist/wire/Emit.js.map +1 -1
  73. package/dist/wire/Facade.d.ts +7 -0
  74. package/dist/wire/Facade.d.ts.map +1 -1
  75. package/dist/wire/Facade.js +13 -0
  76. package/dist/wire/Facade.js.map +1 -1
  77. package/dist/wire/OperationContract.d.ts +0 -4
  78. package/dist/wire/OperationContract.d.ts.map +1 -1
  79. package/dist/wire/OperationContract.js +1 -1
  80. package/dist/wire/OperationContract.js.map +1 -1
  81. package/dist/wire/OperationsMap.d.ts +0 -3
  82. package/dist/wire/OperationsMap.d.ts.map +1 -1
  83. package/dist/wire/OperationsMap.js +0 -5
  84. package/dist/wire/OperationsMap.js.map +1 -1
  85. package/package.json +4 -4
  86. package/src/EffectiveOperationModel.ts +221 -201
  87. package/src/FougereConfig.ts +14 -16
  88. package/src/FrondDeclaration.ts +1 -7
  89. package/src/Source.ts +1 -1
  90. package/src/SourceView.ts +0 -2
  91. package/src/boot/App.ts +2 -4
  92. package/src/boot/AppLifecycle.ts +21 -10
  93. package/src/boot/AuthRuntime.ts +6 -13
  94. package/src/boot/CreateAppOptions.ts +0 -11
  95. package/src/boot/Emissions.ts +3 -7
  96. package/src/boot/Hosting.ts +2 -1
  97. package/src/boot/bootstrap.ts +168 -300
  98. package/src/boot/install.ts +120 -146
  99. package/src/boot/relations.ts +3 -8
  100. package/src/boot/seed.ts +2 -4
  101. package/src/descriptor/Fronds.ts +10 -0
  102. package/src/descriptor/index.ts +1 -0
  103. package/src/dispatch/InFlight.ts +16 -2
  104. package/src/index.ts +2 -4
  105. package/src/node.ts +1 -1
  106. package/src/prefab/CrudConstructor.ts +0 -11
  107. package/src/storage/Comparison.ts +7 -4
  108. package/src/wire/Emit.ts +1 -1
  109. package/src/wire/Facade.ts +17 -10
  110. package/src/wire/OperationContract.ts +1 -1
  111. package/src/wire/OperationsMap.ts +0 -10
  112. package/dist/boot/AuthConfig.d.ts +0 -14
  113. package/dist/boot/AuthConfig.d.ts.map +0 -1
  114. package/dist/boot/AuthConfig.js +0 -2
  115. package/dist/boot/AuthConfig.js.map +0 -1
  116. package/dist/boot/AuthContext.d.ts +0 -12
  117. package/dist/boot/AuthContext.d.ts.map +0 -1
  118. package/dist/boot/AuthContext.js +0 -2
  119. package/dist/boot/AuthContext.js.map +0 -1
  120. package/dist/storage/ComparisonName.d.ts +0 -3
  121. package/dist/storage/ComparisonName.d.ts.map +0 -1
  122. package/dist/storage/ComparisonName.js +0 -2
  123. package/dist/storage/ComparisonName.js.map +0 -1
  124. package/src/boot/AuthConfig.ts +0 -14
  125. package/src/boot/AuthContext.ts +0 -12
  126. package/src/storage/ComparisonName.ts +0 -3
@@ -1,19 +1,12 @@
1
- import type { SchemaView } from '@fougere/schema';
2
- import type { Storage } from '../storage/Storage.js';
3
-
4
- /**
5
- * Runtime returned by an auth provider's create(config, ctx) function.
6
- * The core mounts this on the App and the HTTP layer (Nuxt module / router) uses it.
7
- */
1
+ /** What an auth extension registers under {@link AUTH} once it has risen. */
8
2
  export interface AuthRuntime {
9
- /** Entities used by the provider, including any defaults it filled in. */
10
- entities: Record<string, SchemaView>;
11
- /** Per-entity ORMs the provider built for itself. */
12
- storages: Record<string, Storage>;
13
- /** Web Standard handler that processes /auth/* requests. */
3
+ /** Web Standard handler that processes `/auth/*` requests. */
14
4
  handler: (request: Request) => Promise<Response>;
15
5
  /** Programmatic API exposed by the provider (getSession, signOut, ...). */
16
6
  api: Record<string, unknown>;
17
- /** Effective mount path (echoes config.basePath or the provider's default). */
7
+ /** Effective mount path. */
18
8
  basePath: string;
19
9
  }
10
+
11
+ /** The container key an auth provider registers its runtime under. */
12
+ export const AUTH = 'AuthRuntime';
@@ -6,8 +6,6 @@ import type { StorageFactory } from '../storage/StorageFactory.js';
6
6
  import type { Constraint } from '../Constraint.js';
7
7
  import type { Transport } from '../wire/Transport.js';
8
8
  import type { Extension } from './Extension.js';
9
- import type { AuthConfig } from './AuthConfig.js';
10
- import type { DispatchObserver } from '../dispatch/DispatchObserver.js';
11
9
  import type { App } from './App.js';
12
10
 
13
11
  /** Options for createApp(). */
@@ -86,13 +84,4 @@ export interface CreateAppOptions {
86
84
  adapters?: Record<string, boolean | undefined>;
87
85
  /** Carries an announced fact out of this process — a broker, a queue, a log. */
88
86
  onEmit?: (fact: string, payload: unknown) => void | Promise<void>;
89
- /** Passive observers of every dispatch transition. */
90
- dispatchObservers?: readonly DispatchObserver[];
91
- /**
92
- * Storage handle to expose to the auth provider via AuthContext.db.
93
- * Required when `auth` is set.
94
- */
95
- db?: unknown;
96
- /** Auth declaration to wire into the app at boot. */
97
- auth?: AuthConfig;
98
87
  }
@@ -1,4 +1,5 @@
1
1
  import { applyCreate, dotted, lowerFirst, type SchemaView } from '@fougere/schema';
2
+ import { addressOf, facadeKeyOf } from '../wire/Facade.js';
2
3
  import type { Container } from '@fougere/container';
3
4
  import { validationErrorsOf } from '../wire/FougereError.js';
4
5
  import { awaitKeyOf, emitKeyOf, factsAnnouncedBy, factsAwaitedBy } from '../wire/Emit.js';
@@ -368,12 +369,7 @@ export class Emissions {
368
369
  }
369
370
  }
370
371
 
371
- /**
372
- * The container key a declared CLASS NAME answers under — `RedactHandler` → `redactHandler`,
373
- * the same key `facadeKeyOf` builds from an address.
374
- */
372
+ /** The container key a declared CLASS NAME answers under — `RedactHandler` → `redactHandler`. */
375
373
  function facadeOf(declared: string): string {
376
- const key = lowerFirst(declared);
377
-
378
- return key.endsWith('Handler') ? key : `${key}Handler`;
374
+ return facadeKeyOf(addressOf(declared));
379
375
  }
@@ -2,6 +2,7 @@ import type { SchemaView } from '@fougere/schema';
2
2
  import type { Constraint } from '../Constraint.js';
3
3
  import type { Peer } from './Peer.js';
4
4
  import type { Journal } from '../dispatch/Journal.js';
5
+ import type { Storage } from '../storage/Storage.js';
5
6
 
6
7
  /**
7
8
  * Where an entity's rows are hosted, and what the host keeps — what a `ref()` asks the boot.
@@ -17,7 +18,7 @@ export interface Hosting {
17
18
  * Resolved through the frond that owns it, never the asking frond's scope: a scope sees its
18
19
  * parent and not its siblings, so a target of another frond was answered by nothing.
19
20
  */
20
- storageOf(entity: string): unknown | undefined;
21
+ storageOf(entity: string): Storage | undefined;
21
22
  /** Every entity of every frond — a row is named from wherever its namer was declared. */
22
23
  entities(): ReadonlyMap<string, SchemaView>;
23
24
  /**