hexok 1.0.0 → 2.0.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 (259) hide show
  1. package/README.md +9 -0
  2. package/dist/adapter.d.ts +18 -0
  3. package/dist/adapter.d.ts.map +1 -0
  4. package/dist/adapter.js +21 -0
  5. package/dist/adapter.js.map +1 -0
  6. package/dist/catalog.d.ts +88 -0
  7. package/dist/catalog.d.ts.map +1 -0
  8. package/dist/catalog.js +79 -0
  9. package/dist/catalog.js.map +1 -0
  10. package/dist/{core/coded-error.d.ts → coded-error.d.ts} +9 -4
  11. package/dist/coded-error.d.ts.map +1 -0
  12. package/dist/{core/coded-error.js → coded-error.js} +9 -4
  13. package/dist/coded-error.js.map +1 -0
  14. package/dist/cow-draft.d.ts.map +1 -0
  15. package/dist/cow-draft.js.map +1 -0
  16. package/dist/entity.d.ts +63 -0
  17. package/dist/entity.d.ts.map +1 -0
  18. package/dist/{domain/entity.js → entity.js} +52 -80
  19. package/dist/entity.js.map +1 -0
  20. package/dist/error-map.d.ts +22 -0
  21. package/dist/error-map.d.ts.map +1 -0
  22. package/dist/error-map.js +2 -0
  23. package/dist/error-map.js.map +1 -0
  24. package/dist/errors.d.ts +85 -0
  25. package/dist/errors.d.ts.map +1 -0
  26. package/dist/errors.js +85 -0
  27. package/dist/errors.js.map +1 -0
  28. package/dist/event-handler.d.ts +31 -0
  29. package/dist/event-handler.d.ts.map +1 -0
  30. package/dist/event-handler.js +28 -0
  31. package/dist/event-handler.js.map +1 -0
  32. package/dist/event.d.ts +37 -0
  33. package/dist/event.d.ts.map +1 -0
  34. package/dist/event.js +44 -0
  35. package/dist/event.js.map +1 -0
  36. package/dist/index.d.ts +16 -0
  37. package/dist/index.d.ts.map +1 -0
  38. package/dist/index.js +14 -0
  39. package/dist/index.js.map +1 -0
  40. package/dist/mapper.d.ts +100 -0
  41. package/dist/mapper.d.ts.map +1 -0
  42. package/dist/mapper.js +167 -0
  43. package/dist/mapper.js.map +1 -0
  44. package/dist/port.d.ts +20 -0
  45. package/dist/port.d.ts.map +1 -0
  46. package/dist/port.js +25 -0
  47. package/dist/port.js.map +1 -0
  48. package/dist/result.d.ts.map +1 -0
  49. package/dist/result.js.map +1 -0
  50. package/dist/schema.d.ts +37 -0
  51. package/dist/schema.d.ts.map +1 -0
  52. package/dist/schema.js +50 -0
  53. package/dist/schema.js.map +1 -0
  54. package/dist/{core/standard-schema.d.ts → standard-schema.d.ts} +1 -1
  55. package/dist/standard-schema.d.ts.map +1 -0
  56. package/dist/standard-schema.js.map +1 -0
  57. package/dist/use-case.d.ts +183 -0
  58. package/dist/use-case.d.ts.map +1 -0
  59. package/dist/use-case.js +221 -0
  60. package/dist/use-case.js.map +1 -0
  61. package/dist/{core/schema.d.ts → validate.d.ts} +1 -1
  62. package/dist/validate.d.ts.map +1 -0
  63. package/dist/{core/schema.js → validate.js} +1 -1
  64. package/dist/validate.js.map +1 -0
  65. package/package.json +16 -26
  66. package/dist/app/api-use-case.d.ts +0 -52
  67. package/dist/app/api-use-case.d.ts.map +0 -1
  68. package/dist/app/api-use-case.js +0 -59
  69. package/dist/app/api-use-case.js.map +0 -1
  70. package/dist/app/callable-use-case.d.ts +0 -34
  71. package/dist/app/callable-use-case.d.ts.map +0 -1
  72. package/dist/app/callable-use-case.js +0 -41
  73. package/dist/app/callable-use-case.js.map +0 -1
  74. package/dist/app/contract.d.ts +0 -46
  75. package/dist/app/contract.d.ts.map +0 -1
  76. package/dist/app/contract.js +0 -28
  77. package/dist/app/contract.js.map +0 -1
  78. package/dist/app/error-factory.d.ts +0 -9
  79. package/dist/app/error-factory.d.ts.map +0 -1
  80. package/dist/app/error-factory.js +0 -30
  81. package/dist/app/error-factory.js.map +0 -1
  82. package/dist/app/event-channel.d.ts +0 -133
  83. package/dist/app/event-channel.d.ts.map +0 -1
  84. package/dist/app/event-channel.js +0 -49
  85. package/dist/app/event-channel.js.map +0 -1
  86. package/dist/app/event-use-case.d.ts +0 -47
  87. package/dist/app/event-use-case.d.ts.map +0 -1
  88. package/dist/app/event-use-case.js +0 -54
  89. package/dist/app/event-use-case.js.map +0 -1
  90. package/dist/app/execute-ctx.d.ts +0 -92
  91. package/dist/app/execute-ctx.d.ts.map +0 -1
  92. package/dist/app/execute-ctx.js +0 -2
  93. package/dist/app/execute-ctx.js.map +0 -1
  94. package/dist/app/external-use-case.d.ts +0 -25
  95. package/dist/app/external-use-case.d.ts.map +0 -1
  96. package/dist/app/external-use-case.js +0 -25
  97. package/dist/app/external-use-case.js.map +0 -1
  98. package/dist/app/index.d.ts +0 -9
  99. package/dist/app/index.d.ts.map +0 -1
  100. package/dist/app/index.js +0 -8
  101. package/dist/app/index.js.map +0 -1
  102. package/dist/app/internal-use-case.d.ts +0 -26
  103. package/dist/app/internal-use-case.d.ts.map +0 -1
  104. package/dist/app/internal-use-case.js +0 -26
  105. package/dist/app/internal-use-case.js.map +0 -1
  106. package/dist/app/nest.d.ts +0 -9
  107. package/dist/app/nest.d.ts.map +0 -1
  108. package/dist/app/nest.js +0 -28
  109. package/dist/app/nest.js.map +0 -1
  110. package/dist/app/types.d.ts +0 -153
  111. package/dist/app/types.d.ts.map +0 -1
  112. package/dist/app/types.js +0 -17
  113. package/dist/app/types.js.map +0 -1
  114. package/dist/core/coded-error.d.ts.map +0 -1
  115. package/dist/core/coded-error.js.map +0 -1
  116. package/dist/core/error-map.d.ts +0 -21
  117. package/dist/core/error-map.d.ts.map +0 -1
  118. package/dist/core/error-map.js +0 -5
  119. package/dist/core/error-map.js.map +0 -1
  120. package/dist/core/index.d.ts +0 -6
  121. package/dist/core/index.d.ts.map +0 -1
  122. package/dist/core/index.js +0 -5
  123. package/dist/core/index.js.map +0 -1
  124. package/dist/core/result.d.ts.map +0 -1
  125. package/dist/core/result.js.map +0 -1
  126. package/dist/core/schema.d.ts.map +0 -1
  127. package/dist/core/schema.js.map +0 -1
  128. package/dist/core/standard-schema.d.ts.map +0 -1
  129. package/dist/core/standard-schema.js.map +0 -1
  130. package/dist/domain/capabilities.d.ts +0 -42
  131. package/dist/domain/capabilities.d.ts.map +0 -1
  132. package/dist/domain/capabilities.js +0 -2
  133. package/dist/domain/capabilities.js.map +0 -1
  134. package/dist/domain/catalog.d.ts +0 -46
  135. package/dist/domain/catalog.d.ts.map +0 -1
  136. package/dist/domain/catalog.js +0 -114
  137. package/dist/domain/catalog.js.map +0 -1
  138. package/dist/domain/channel.d.ts +0 -36
  139. package/dist/domain/channel.d.ts.map +0 -1
  140. package/dist/domain/channel.js +0 -2
  141. package/dist/domain/channel.js.map +0 -1
  142. package/dist/domain/cow-draft.d.ts.map +0 -1
  143. package/dist/domain/cow-draft.js.map +0 -1
  144. package/dist/domain/entity.d.ts +0 -120
  145. package/dist/domain/entity.d.ts.map +0 -1
  146. package/dist/domain/entity.js.map +0 -1
  147. package/dist/domain/envelope.d.ts +0 -59
  148. package/dist/domain/envelope.d.ts.map +0 -1
  149. package/dist/domain/envelope.js +0 -2
  150. package/dist/domain/envelope.js.map +0 -1
  151. package/dist/domain/event.d.ts +0 -44
  152. package/dist/domain/event.d.ts.map +0 -1
  153. package/dist/domain/event.js +0 -21
  154. package/dist/domain/event.js.map +0 -1
  155. package/dist/domain/index.d.ts +0 -8
  156. package/dist/domain/index.d.ts.map +0 -1
  157. package/dist/domain/index.js +0 -5
  158. package/dist/domain/index.js.map +0 -1
  159. package/dist/domain/port.d.ts +0 -45
  160. package/dist/domain/port.d.ts.map +0 -1
  161. package/dist/domain/port.js +0 -41
  162. package/dist/domain/port.js.map +0 -1
  163. package/dist/infra/adapter.d.ts +0 -22
  164. package/dist/infra/adapter.d.ts.map +0 -1
  165. package/dist/infra/adapter.js +0 -18
  166. package/dist/infra/adapter.js.map +0 -1
  167. package/dist/infra/index.d.ts +0 -3
  168. package/dist/infra/index.d.ts.map +0 -1
  169. package/dist/infra/index.js +0 -3
  170. package/dist/infra/index.js.map +0 -1
  171. package/dist/infra/mapper.d.ts +0 -48
  172. package/dist/infra/mapper.d.ts.map +0 -1
  173. package/dist/infra/mapper.js +0 -77
  174. package/dist/infra/mapper.js.map +0 -1
  175. package/dist/runtime/app.d.ts +0 -100
  176. package/dist/runtime/app.d.ts.map +0 -1
  177. package/dist/runtime/app.js +0 -292
  178. package/dist/runtime/app.js.map +0 -1
  179. package/dist/runtime/channel.d.ts +0 -34
  180. package/dist/runtime/channel.d.ts.map +0 -1
  181. package/dist/runtime/channel.js +0 -110
  182. package/dist/runtime/channel.js.map +0 -1
  183. package/dist/runtime/client.d.ts +0 -21
  184. package/dist/runtime/client.d.ts.map +0 -1
  185. package/dist/runtime/client.js +0 -2
  186. package/dist/runtime/client.js.map +0 -1
  187. package/dist/runtime/completeness.d.ts +0 -89
  188. package/dist/runtime/completeness.d.ts.map +0 -1
  189. package/dist/runtime/completeness.js +0 -2
  190. package/dist/runtime/completeness.js.map +0 -1
  191. package/dist/runtime/envelope.d.ts +0 -7
  192. package/dist/runtime/envelope.d.ts.map +0 -1
  193. package/dist/runtime/envelope.js +0 -69
  194. package/dist/runtime/envelope.js.map +0 -1
  195. package/dist/runtime/events.d.ts +0 -6
  196. package/dist/runtime/events.d.ts.map +0 -1
  197. package/dist/runtime/events.js +0 -48
  198. package/dist/runtime/events.js.map +0 -1
  199. package/dist/runtime/http-status.d.ts +0 -3
  200. package/dist/runtime/http-status.d.ts.map +0 -1
  201. package/dist/runtime/http-status.js +0 -11
  202. package/dist/runtime/http-status.js.map +0 -1
  203. package/dist/runtime/http.d.ts +0 -4
  204. package/dist/runtime/http.d.ts.map +0 -1
  205. package/dist/runtime/http.js +0 -58
  206. package/dist/runtime/http.js.map +0 -1
  207. package/dist/runtime/index.d.ts +0 -10
  208. package/dist/runtime/index.d.ts.map +0 -1
  209. package/dist/runtime/index.js +0 -6
  210. package/dist/runtime/index.js.map +0 -1
  211. package/dist/runtime/interceptor.d.ts +0 -61
  212. package/dist/runtime/interceptor.d.ts.map +0 -1
  213. package/dist/runtime/interceptor.js +0 -7
  214. package/dist/runtime/interceptor.js.map +0 -1
  215. package/dist/runtime/invoke.d.ts +0 -34
  216. package/dist/runtime/invoke.d.ts.map +0 -1
  217. package/dist/runtime/invoke.js +0 -235
  218. package/dist/runtime/invoke.js.map +0 -1
  219. package/dist/runtime/middleware.d.ts +0 -20
  220. package/dist/runtime/middleware.d.ts.map +0 -1
  221. package/dist/runtime/middleware.js +0 -2
  222. package/dist/runtime/middleware.js.map +0 -1
  223. package/dist/runtime/rpc.d.ts +0 -24
  224. package/dist/runtime/rpc.d.ts.map +0 -1
  225. package/dist/runtime/rpc.js +0 -16
  226. package/dist/runtime/rpc.js.map +0 -1
  227. package/dist/testing/app-test.d.ts +0 -77
  228. package/dist/testing/app-test.d.ts.map +0 -1
  229. package/dist/testing/app-test.js +0 -109
  230. package/dist/testing/app-test.js.map +0 -1
  231. package/dist/testing/in-memory-broker.d.ts +0 -18
  232. package/dist/testing/in-memory-broker.d.ts.map +0 -1
  233. package/dist/testing/in-memory-broker.js +0 -42
  234. package/dist/testing/in-memory-broker.js.map +0 -1
  235. package/dist/testing/in-memory-bus.d.ts +0 -19
  236. package/dist/testing/in-memory-bus.d.ts.map +0 -1
  237. package/dist/testing/in-memory-bus.js +0 -31
  238. package/dist/testing/in-memory-bus.js.map +0 -1
  239. package/dist/testing/in-memory-channel.d.ts +0 -32
  240. package/dist/testing/in-memory-channel.d.ts.map +0 -1
  241. package/dist/testing/in-memory-channel.js +0 -65
  242. package/dist/testing/in-memory-channel.js.map +0 -1
  243. package/dist/testing/in-memory-queue.d.ts +0 -24
  244. package/dist/testing/in-memory-queue.d.ts.map +0 -1
  245. package/dist/testing/in-memory-queue.js +0 -66
  246. package/dist/testing/in-memory-queue.js.map +0 -1
  247. package/dist/testing/in-memory-repository.d.ts +0 -44
  248. package/dist/testing/in-memory-repository.d.ts.map +0 -1
  249. package/dist/testing/in-memory-repository.js +0 -60
  250. package/dist/testing/in-memory-repository.js.map +0 -1
  251. package/dist/testing/index.d.ts +0 -6
  252. package/dist/testing/index.d.ts.map +0 -1
  253. package/dist/testing/index.js +0 -6
  254. package/dist/testing/index.js.map +0 -1
  255. /package/dist/{domain/cow-draft.d.ts → cow-draft.d.ts} +0 -0
  256. /package/dist/{domain/cow-draft.js → cow-draft.js} +0 -0
  257. /package/dist/{core/result.d.ts → result.d.ts} +0 -0
  258. /package/dist/{core/result.js → result.js} +0 -0
  259. /package/dist/{core/standard-schema.js → standard-schema.js} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"file":"error-factory.js","sourceRoot":"","sources":["../../src/app/error-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAIV,QAAQ,GACT,MAAM,kBAAkB,CAAC;AAG1B;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAqB,GAAM;IACvD,MAAM,SAAS,GAAG,EAA+C,CAAC;IAClE,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACpC,MAAM,GAAG,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC;QACtB,IAAI,GAAG,KAAK,SAAS;YAAE,SAAS;QAChC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,IAAc,EAAE,EAAE;YACnC,IAAI,OAAgB,CAAC;YACrB,IAAI,GAAG,CAAC,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;gBACjD,MAAM,MAAM,GAAG,QAAQ,CAAC,GAAG,CAAC,IAAwB,EAAE,IAAI,CAAC,CAAC;gBAC5D,OAAO,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;YAC5C,CAAC;iBAAM,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;gBAC9B,OAAO,GAAG,IAAI,CAAC;YACjB,CAAC;YACD,MAAM,IAAI,UAAU,CAAC;gBACnB,IAAI;gBACJ,OAAO,EAAE,GAAG,CAAC,OAAO,IAAI,IAAI;gBAC5B,GAAG,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aACpD,CAAC,CAAC;QACL,CAAC,CAAC;IACJ,CAAC;IACD,OAAO,SAA8B,CAAC;AACxC,CAAC"}
@@ -1,133 +0,0 @@
1
- import { type ErrorMap, type Infer, type Result, type StandardSchemaV1 } from '../core/index.js';
2
- import type { AnyEventCatalog, Envelope, EventCatalog, PortToken } from '../domain/index.js';
3
- import type { ErrorFactories, ResolvedPorts } from './types.js';
4
- /**
5
- * Catalog-scoped delivery policy. Join, refresh, and route are app authority.
6
- * Presence I/O is a ChannelAdapter passed to `.route()`.
7
- *
8
- * ```ts
9
- * class ClientChannel extends EventChannel {
10
- * static readonly catalog = ClientEvents
11
- * static readonly joinInput = actorSchema
12
- * async join({ input }: JoinCtx<typeof ClientChannel>) { return input }
13
- * async refresh({ session }: RefreshCtx<typeof ClientChannel>) { return session }
14
- * async route({ ctx, clients, send }: RouteCtx<typeof ClientChannel>) {
15
- * for (const { id, session } of clients) {
16
- * if (visibleTo(session, ctx)) await send(id)
17
- * }
18
- * }
19
- * }
20
- * ```
21
- */
22
- export declare abstract class EventChannel {
23
- /** Discriminator for routed channels. Do not override. */
24
- static readonly trigger: "channel";
25
- /** Catalog whose events this channel delivers. Must be a bus. */
26
- static readonly catalog: AnyEventCatalog;
27
- /** Join-claims Standard Schema. Validated before `join`. */
28
- static readonly joinInput: unknown;
29
- /** Port tokens keyed by the alias used in join, refresh, and route. */
30
- static readonly ports?: Record<string, PortToken<unknown>>;
31
- /** Declared refusals. Keys become `errors.CODE()` factories on join/refresh. */
32
- static readonly errors: ErrorMap;
33
- protected constructor();
34
- /** Admit a client and return the session to store. Typed `never` so subclasses may take `JoinCtx`. */
35
- abstract join(ctx: never): Promise<unknown>;
36
- /** Recompute a session; return `'eject'` to drop the client. Typed `never` so subclasses may take `RefreshCtx`. */
37
- abstract refresh(ctx: never): Promise<unknown>;
38
- /** Choose recipients for a catalog event via `send(id)`. Typed `never` so subclasses may take `RouteCtx`. */
39
- abstract route(ctx: never): Promise<void>;
40
- /**
41
- * Same one-liner as `if (!result.ok) throw new CodedError({ code: result.code })`.
42
- * For `validate` / custom Results. Entity methods throw themselves.
43
- */
44
- unwrap<T, E extends string>(result: Result<T, E>): T;
45
- }
46
- /** Session type returned from `join` and later passed to refresh and route. */
47
- export type ChannelSession<C> = C extends {
48
- prototype: {
49
- join: (ctx: never) => Promise<infer S>;
50
- };
51
- } ? S : unknown;
52
- type CatalogKeyOfChannel<C> = C extends {
53
- catalog: EventCatalog<infer K extends string, infer _Kind, infer _E, infer _Ctx>;
54
- } ? K : string;
55
- type CatalogCtxOfChannel<C> = C extends {
56
- catalog: EventCatalog<string, infer _Kind, infer _E, infer Ctx>;
57
- } ? Ctx : unknown;
58
- /** Argument to `EventChannel.join`. Typed from the channel class statics. */
59
- export type JoinCtx<C> = {
60
- /** Validated `static joinInput`. */
61
- input: C extends {
62
- joinInput: infer S extends StandardSchemaV1;
63
- } ? Infer<S> : unknown;
64
- /** Bound adapters from `static ports`. */
65
- ports: C extends {
66
- ports: infer P;
67
- } ? ResolvedPorts<P> : Record<string, never>;
68
- /** Factories from `static errors`. Throw `errors.FORBIDDEN()`. */
69
- errors: C extends {
70
- errors: infer E;
71
- } ? ErrorFactories<E> : ErrorFactories<never>;
72
- };
73
- /** Argument to `EventChannel.refresh`. Typed from the channel class statics. */
74
- export type RefreshCtx<C> = {
75
- /** Current session from join or the last successful refresh. */
76
- session: ChannelSession<C>;
77
- /** Bound adapters from `static ports`. */
78
- ports: C extends {
79
- ports: infer P;
80
- } ? ResolvedPorts<P> : Record<string, never>;
81
- /** Factories from `static errors`. Throw `errors.FORBIDDEN()`. */
82
- errors: C extends {
83
- errors: infer E;
84
- } ? ErrorFactories<E> : ErrorFactories<never>;
85
- };
86
- /** Argument to `EventChannel.route`. `ctx` here is catalog context, not app request context. */
87
- export type RouteCtx<C> = {
88
- /** Envelope just published on this channel's catalog. */
89
- event: Envelope<string, unknown, CatalogKeyOfChannel<C>, 'bus', CatalogCtxOfChannel<C>>;
90
- /** Catalog `ctx` from the envelope — not `ExecuteCtx.ctx`. */
91
- ctx: CatalogCtxOfChannel<C>;
92
- /** Connected clients and their sessions. */
93
- clients: ReadonlyArray<{
94
- id: string;
95
- session: ChannelSession<C>;
96
- }>;
97
- /** Bound adapters from `static ports`. */
98
- ports: C extends {
99
- ports: infer P;
100
- } ? ResolvedPorts<P> : Record<string, never>;
101
- /** Deliver the serialized event to one client id. */
102
- send: (id: string) => Promise<void>;
103
- };
104
- /** Presence handle for one catalog, from `channels` in `execute`. */
105
- export type ChannelControl<Session = unknown> = {
106
- /** Connected clients and their sessions. */
107
- list(): ReadonlyArray<{
108
- id: string;
109
- session: Session;
110
- }>;
111
- /** Drop one client by id. */
112
- eject(id: string): void;
113
- /** Drop every client whose session matches. */
114
- ejectWhere(pred: (session: Session) => boolean): void;
115
- /** Re-run `refresh` for one client. */
116
- refresh(id: string): Promise<void>;
117
- /** Re-run `refresh` for matching sessions. */
118
- refreshWhere(pred: (session: Session) => boolean): Promise<void>;
119
- /** Replace a session without running `refresh`. */
120
- update(id: string, session: Session): void;
121
- };
122
- type UnionToIntersection<U> = (U extends unknown ? (x: U) => void : never) extends (x: infer I) => void ? I : never;
123
- type ChannelHandleMap<Ch> = [Ch] extends [never] ? Record<string, never> : UnionToIntersection<Ch extends infer C ? C extends {
124
- catalog: EventCatalog<infer K extends string, infer _Kind, infer _E, infer _Ctx>;
125
- } ? {
126
- [P in K]: ChannelControl<ChannelSession<C>>;
127
- } : never : never>;
128
- /** `channels` on execute ctx, keyed by catalog key from `static channels`. */
129
- export type ChannelProps<C> = C extends {
130
- channels: readonly (infer Ch)[];
131
- } ? [Ch] extends [never] ? Record<string, never> : ChannelHandleMap<Ch> : Record<string, never>;
132
- export {};
133
- //# sourceMappingURL=event-channel.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,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AC,EAAE,CAAC;CACjC,GACG,CAAC,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,GAClB,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GACrB,gBAAgB,CAAC,EAAE,CAAC,GACtB,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC"}
@@ -1,49 +0,0 @@
1
- import { CodedError, } from '../core/index.js';
2
- /**
3
- * Catalog-scoped delivery policy. Join, refresh, and route are app authority.
4
- * Presence I/O is a ChannelAdapter passed to `.route()`.
5
- *
6
- * ```ts
7
- * class ClientChannel extends EventChannel {
8
- * static readonly catalog = ClientEvents
9
- * static readonly joinInput = actorSchema
10
- * async join({ input }: JoinCtx<typeof ClientChannel>) { return input }
11
- * async refresh({ session }: RefreshCtx<typeof ClientChannel>) { return session }
12
- * async route({ ctx, clients, send }: RouteCtx<typeof ClientChannel>) {
13
- * for (const { id, session } of clients) {
14
- * if (visibleTo(session, ctx)) await send(id)
15
- * }
16
- * }
17
- * }
18
- * ```
19
- */
20
- export class EventChannel {
21
- /** Discriminator for routed channels. Do not override. */
22
- static trigger = 'channel';
23
- /** Catalog whose events this channel delivers. Must be a bus. */
24
- static catalog;
25
- /** Join-claims Standard Schema. Validated before `join`. */
26
- static joinInput;
27
- /** Port tokens keyed by the alias used in join, refresh, and route. */
28
- static ports;
29
- /** Declared refusals. Keys become `errors.CODE()` factories on join/refresh. */
30
- static errors = {};
31
- constructor() { }
32
- /**
33
- * Same one-liner as `if (!result.ok) throw new CodedError({ code: result.code })`.
34
- * For `validate` / custom Results. Entity methods throw themselves.
35
- */
36
- unwrap(result) {
37
- if (!result.ok) {
38
- throw new CodedError({
39
- code: result.code,
40
- message: result.code,
41
- ...(result.issues !== undefined
42
- ? { data: { issues: result.issues } }
43
- : {}),
44
- });
45
- }
46
- return result.value;
47
- }
48
- }
49
- //# sourceMappingURL=event-channel.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"event-channel.js","sourceRoot":"","sources":["../../src/app/event-channel.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,GAKX,MAAM,kBAAkB,CAAC;AAS1B;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,OAAgB,YAAY;IAChC,0DAA0D;IAC1D,MAAM,CAAU,OAAO,GAAG,SAAkB,CAAC;IAC7C,iEAAiE;IACjE,MAAM,CAAU,OAAO,CAAkB;IACzC,4DAA4D;IAC5D,MAAM,CAAU,SAAS,CAAU;IACnC,uEAAuE;IACvE,MAAM,CAAU,KAAK,CAAsC;IAC3D,gFAAgF;IAChF,MAAM,CAAU,MAAM,GAAa,EAAE,CAAC;IAEtC,gBAAyB,CAAC;IAS1B;;;OAGG;IACH,MAAM,CAAsB,MAAoB;QAC9C,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;YACf,MAAM,IAAI,UAAU,CAAC;gBACnB,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,OAAO,EAAE,MAAM,CAAC,IAAI;gBACpB,GAAG,CAAC,MAAM,CAAC,MAAM,KAAK,SAAS;oBAC7B,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,EAAE;oBACrC,CAAC,CAAC,EAAE,CAAC;aACR,CAAC,CAAC;QACL,CAAC;QACD,OAAO,MAAM,CAAC,KAAK,CAAC;IACtB,CAAC"}
@@ -1,47 +0,0 @@
1
- import { type ErrorMap, type Result } from '../core/index.js';
2
- import type { AnyEventCatalog, EventClass, PortToken } from '../domain/index.js';
3
- import type { EventChannelCtor } from './types.js';
4
- /**
5
- * Event handler. Mutually exclusive with ExternalUseCase and InternalUseCase.
6
- * Queue catalogs require `static group`.
7
- *
8
- * ```ts
9
- * class NotifyOnClose extends EventUseCase {
10
- * static readonly key = 'incident.notifyOnClose'
11
- * static readonly on = IncidentClosed
12
- * static readonly catalog = DomainEvents
13
- * async execute({ event, ports }: EventCtx<typeof NotifyOnClose>) {
14
- * await ports.notifier.send(event.payload)
15
- * }
16
- * }
17
- * ```
18
- */
19
- export declare abstract class EventUseCase {
20
- /** Discriminator for `App.from` / `isEventUseCase`. Do not override. */
21
- static readonly trigger: "event";
22
- /** Handler id (`incident.notifyOnClose`). Used in completeness messages. */
23
- static readonly key: string;
24
- /** Event class this handler listens to. Required by `App.from`; must be in `catalog`. */
25
- static readonly on?: EventClass;
26
- /** Catalog that owns `on`. Required by `App.from`; bind it with `App.bind`. */
27
- static readonly catalog?: AnyEventCatalog;
28
- /** Port tokens keyed by the alias used in `execute`. */
29
- static readonly ports?: Record<string, PortToken<unknown>>;
30
- /** Consumer group for queue catalogs. Required when `catalog.kind` is `'queue'`. */
31
- static readonly group?: string;
32
- /** `static publishes = [DomainEvents] as const` — without `as const`, Events widens to EventClass. */
33
- static readonly publishes?: readonly AnyEventCatalog[];
34
- /** `static channels = [ClientChannel] as const` — without `as const`, catalog keys widen. */
35
- static readonly channels?: readonly EventChannelCtor[];
36
- /** Declared refusals. Keys become `errors.CODE()` factories on `EventCtx`. */
37
- static readonly errors: ErrorMap;
38
- protected constructor();
39
- /** Typed `never` so subclasses may take `EventCtx` (tighter `publish`). */
40
- abstract execute(ctx: never): Promise<void>;
41
- /**
42
- * Same one-liner as `if (!result.ok) throw new CodedError({ code: result.code })`.
43
- * For `validate` / custom Results. Entity methods throw themselves.
44
- */
45
- unwrap<T, E extends string>(result: Result<T, E>): T;
46
- }
47
- //# sourceMappingURL=event-use-case.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"event-use-case.d.ts","sourceRoot":"","sources":["../../src/app/event-use-case.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,QAAQ,EAAE,KAAK,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1E,OAAO,KAAK,EACV,eAAe,EACf,UAAU,EACV,SAAS,EACV,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD;;;;;;;;;;;;;;GAcG;AACH,8BAAsB,YAAY;IAChC,wEAAwE;IACxE,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAG,OAAO,CAAU;IAC3C,4EAA4E;IAC5E,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAC5B,yFAAyF;IACzF,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,UAAU,CAAC;IAChC,+EAA+E;IAC/E,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1C,wDAAwD;IACxD,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;IAC3D,oFAAoF;IACpF,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAC/B,sGAAsG;IACtG,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,eAAe,EAAE,CAAC;IACvD,6FAA6F;IAC7F,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACvD,8EAA8E;IAC9E,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAM;IAEtC,SAAS;IAET,2EAA2E;IAC3E,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC;IAE3C;;;OAGG;IACH,MAAM,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC;CAYrD"}
@@ -1,54 +0,0 @@
1
- import { CodedError } from '../core/index.js';
2
- /**
3
- * Event handler. Mutually exclusive with ExternalUseCase and InternalUseCase.
4
- * Queue catalogs require `static group`.
5
- *
6
- * ```ts
7
- * class NotifyOnClose extends EventUseCase {
8
- * static readonly key = 'incident.notifyOnClose'
9
- * static readonly on = IncidentClosed
10
- * static readonly catalog = DomainEvents
11
- * async execute({ event, ports }: EventCtx<typeof NotifyOnClose>) {
12
- * await ports.notifier.send(event.payload)
13
- * }
14
- * }
15
- * ```
16
- */
17
- export class EventUseCase {
18
- /** Discriminator for `App.from` / `isEventUseCase`. Do not override. */
19
- static trigger = 'event';
20
- /** Handler id (`incident.notifyOnClose`). Used in completeness messages. */
21
- static key;
22
- /** Event class this handler listens to. Required by `App.from`; must be in `catalog`. */
23
- static on;
24
- /** Catalog that owns `on`. Required by `App.from`; bind it with `App.bind`. */
25
- static catalog;
26
- /** Port tokens keyed by the alias used in `execute`. */
27
- static ports;
28
- /** Consumer group for queue catalogs. Required when `catalog.kind` is `'queue'`. */
29
- static group;
30
- /** `static publishes = [DomainEvents] as const` — without `as const`, Events widens to EventClass. */
31
- static publishes;
32
- /** `static channels = [ClientChannel] as const` — without `as const`, catalog keys widen. */
33
- static channels;
34
- /** Declared refusals. Keys become `errors.CODE()` factories on `EventCtx`. */
35
- static errors = {};
36
- constructor() { }
37
- /**
38
- * Same one-liner as `if (!result.ok) throw new CodedError({ code: result.code })`.
39
- * For `validate` / custom Results. Entity methods throw themselves.
40
- */
41
- unwrap(result) {
42
- if (!result.ok) {
43
- throw new CodedError({
44
- code: result.code,
45
- message: result.code,
46
- ...(result.issues !== undefined
47
- ? { data: { issues: result.issues } }
48
- : {}),
49
- });
50
- }
51
- return result.value;
52
- }
53
- }
54
- //# sourceMappingURL=event-use-case.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"event-use-case.js","sourceRoot":"","sources":["../../src/app/event-use-case.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA8B,MAAM,kBAAkB,CAAC;AAQ1E;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAgB,YAAY;IAChC,wEAAwE;IACxE,MAAM,CAAU,OAAO,GAAG,OAAgB,CAAC;IAC3C,4EAA4E;IAC5E,MAAM,CAAU,GAAG,CAAS;IAC5B,yFAAyF;IACzF,MAAM,CAAU,EAAE,CAAc;IAChC,+EAA+E;IAC/E,MAAM,CAAU,OAAO,CAAmB;IAC1C,wDAAwD;IACxD,MAAM,CAAU,KAAK,CAAsC;IAC3D,oFAAoF;IACpF,MAAM,CAAU,KAAK,CAAU;IAC/B,sGAAsG;IACtG,MAAM,CAAU,SAAS,CAA8B;IACvD,6FAA6F;IAC7F,MAAM,CAAU,QAAQ,CAA+B;IACvD,8EAA8E;IAC9E,MAAM,CAAU,MAAM,GAAa,EAAE,CAAC;IAEtC,gBAAyB,CAAC;IAK1B;;;OAGG;IACH,MAAM,CAAsB,MAAoB;QAC9C,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;YACf,MAAM,IAAI,UAAU,CAAC;gBACnB,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,OAAO,EAAE,MAAM,CAAC,IAAI;gBACpB,GAAG,CAAC,MAAM,CAAC,MAAM,KAAK,SAAS;oBAC7B,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,EAAE;oBACrC,CAAC,CAAC,EAAE,CAAC;aACR,CAAC,CAAC;QACL,CAAC;QACD,OAAO,MAAM,CAAC,KAAK,CAAC;IACtB,CAAC"}
@@ -1,92 +0,0 @@
1
- import type { Infer, Result, StandardSchemaV1 } from '../core/index.js';
2
- import type { CatalogEvents, DomainEvent, Envelope, EventCatalog, EventClass, EventPayload } from '../domain/index.js';
3
- import type { ChannelProps } from './event-channel.js';
4
- import type { CallableUseCaseCtor, ErrorFactories, ResolvedPorts } from './types.js';
5
- /**
6
- * `publish` **enqueues**. The runtime flushes only if `execute` returns.
7
- * A throw drops the queue — publish after success, not a coincidence.
8
- */
9
- export type Publish = {
10
- (event: DomainEvent): void;
11
- (envelope: Envelope): void;
12
- };
13
- type AllowedEventInstance<C> = C extends {
14
- publishes: readonly (infer Cat)[];
15
- } ? CatalogEvents<Cat> extends infer E ? [E] extends [never] ? never : InstanceType<Extract<E, EventClass>> : never : DomainEvent;
16
- /** `publish` when `static publishes` is declared — only those catalog events. */
17
- export type PublishFor<C> = (event: AllowedEventInstance<C>) => void;
18
- /** Nested callable invocation. Shares ctx, signal, and the parent publish queue. */
19
- export type Run = <U extends CallableUseCaseCtor>(useCase: U, input: Infer<U['input']>) => Promise<Infer<U['output']>>;
20
- /** Argument to `ExternalUseCase.execute` and `InternalUseCase.execute`. Typed from the subclass statics. */
21
- export type ExecuteCtx<C, Ctx = unknown> = {
22
- /** Validated `static input`. */
23
- input: C extends {
24
- input: infer S extends StandardSchemaV1;
25
- } ? Infer<S> : unknown;
26
- /** Bound adapters from `static ports`. */
27
- ports: C extends {
28
- ports: infer P;
29
- } ? ResolvedPorts<P> : Record<string, never>;
30
- /** App request context from `App.ctx` or the caller. */
31
- ctx: Ctx;
32
- /** Factories from `static errors`. Throw `errors.NOT_FOUND()`. */
33
- errors: C extends {
34
- errors: infer E;
35
- } ? ErrorFactories<E> : ErrorFactories<never>;
36
- /** Abort signal for this invocation. */
37
- signal: AbortSignal;
38
- /** Enqueue a catalog event. Flushed only if `execute` returns. */
39
- publish: C extends {
40
- publishes: readonly unknown[];
41
- } ? PublishFor<C> : Publish;
42
- /** Invoke an ExternalUseCase or InternalUseCase with the same ctx, signal, and publish queue. */
43
- run: Run;
44
- /** Presence handles for `static channels`, keyed by catalog key. */
45
- channels: ChannelProps<C>;
46
- };
47
- type EventOn<C> = C extends {
48
- on: infer E extends EventClass;
49
- } ? E : EventClass;
50
- type CatalogKeyOf<C> = C extends {
51
- catalog: EventCatalog<infer K extends string, infer _Kind, infer _E, infer _Ctx>;
52
- } ? K : string;
53
- type CatalogKindOf<C> = C extends {
54
- catalog: EventCatalog<string, infer Kind, infer _E, infer _Ctx>;
55
- } ? Kind : 'bus';
56
- type CatalogCtxOf<C> = C extends {
57
- catalog: EventCatalog<string, infer _Kind, infer _E, infer Ctx>;
58
- } ? Ctx : unknown;
59
- /** Argument to `EventUseCase.execute`. Typed from the subclass statics. */
60
- export type EventCtx<C, Ctx = unknown> = {
61
- /** Envelope for `static on`, including payload and catalog metadata. */
62
- event: Envelope<EventOn<C>['key'] extends infer N extends string ? N : string, EventPayload<EventOn<C>>, CatalogKeyOf<C>, CatalogKindOf<C>, CatalogCtxOf<C>>;
63
- /** Bound adapters from `static ports`. */
64
- ports: C extends {
65
- ports: infer P;
66
- } ? ResolvedPorts<P> : Record<string, never>;
67
- /** App request context from `App.ctx` or the caller. */
68
- ctx: Ctx;
69
- /** Factories from `static errors`. Throw `errors.NOT_FOUND()`. */
70
- errors: C extends {
71
- errors: infer E;
72
- } ? ErrorFactories<E> : ErrorFactories<never>;
73
- /** Abort signal for this invocation. */
74
- signal: AbortSignal;
75
- /** Enqueue a catalog event. Flushed only if `execute` returns. */
76
- publish: C extends {
77
- publishes: readonly unknown[];
78
- } ? PublishFor<C> : Publish;
79
- /** Invoke an ExternalUseCase or InternalUseCase with the same ctx, signal, and publish queue. */
80
- run: Run;
81
- /** Presence handles for `static channels`, keyed by catalog key. */
82
- channels: ChannelProps<C>;
83
- } & (CatalogKindOf<C> extends 'queue' ? {
84
- /** Delivery attempt, 1-based, for queue catalogs. */
85
- attempt: number;
86
- } : {
87
- /** Unset for bus catalogs. */
88
- attempt?: number;
89
- });
90
- export type Unwrap = <T, E extends string>(result: Result<T, E>) => T;
91
- export {};
92
- //# sourceMappingURL=execute-ctx.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"execute-ctx.d.ts","sourceRoot":"","sources":["../../src/app/execute-ctx.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,KAAK,EACV,aAAa,EACb,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,YAAY,EACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EACV,mBAAmB,EACnB,cA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AAM,GAAG,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=execute-ctx.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"execute-ctx.js","sourceRoot":"","sources":["../../src/app/execute-ctx.ts"],"names":[],"mappings":""}
@@ -1,25 +0,0 @@
1
- import { CallableUseCase } from './callable-use-case.js';
2
- /**
3
- * Public request/response use case. Declare static `key`, `input`, `output`,
4
- * `errors`, `ports`. Implement `execute`.
5
- *
6
- * ```ts
7
- * class CloseIncident extends ExternalUseCase {
8
- * static readonly key = 'incident.close'
9
- * static readonly input = z.object({ id: z.string() })
10
- * static readonly output = Incident.schema
11
- * static readonly errors = { NOT_FOUND: { message: 'Incident not found' } } as const
12
- * static readonly ports = { incidents: IncidentRepository }
13
- * async execute({ input, ports, errors }: ExecuteCtx<typeof CloseIncident>) {
14
- * const incident = await ports.incidents.get(input.id)
15
- * if (!incident) throw errors.NOT_FOUND()
16
- * return incident.toProps()
17
- * }
18
- * }
19
- * ```
20
- */
21
- export declare abstract class ExternalUseCase extends CallableUseCase {
22
- /** Discriminator for `App.from` / `isExternalUseCase`. Do not override. */
23
- static readonly trigger: "external";
24
- }
25
- //# sourceMappingURL=external-use-case.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"external-use-case.d.ts","sourceRoot":"","sources":["../../src/app/external-use-case.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD;;;;;;;;;;;;;;;;;;GAkBG;AACH,8BAAsB,eAAgB,SAAQ,eAAe;IAC3D,2EAA2E;IAC3E,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAG,UAAU,CAAU;CAC/C"}
@@ -1,25 +0,0 @@
1
- import { CallableUseCase } from './callable-use-case.js';
2
- /**
3
- * Public request/response use case. Declare static `key`, `input`, `output`,
4
- * `errors`, `ports`. Implement `execute`.
5
- *
6
- * ```ts
7
- * class CloseIncident extends ExternalUseCase {
8
- * static readonly key = 'incident.close'
9
- * static readonly input = z.object({ id: z.string() })
10
- * static readonly output = Incident.schema
11
- * static readonly errors = { NOT_FOUND: { message: 'Incident not found' } } as const
12
- * static readonly ports = { incidents: IncidentRepository }
13
- * async execute({ input, ports, errors }: ExecuteCtx<typeof CloseIncident>) {
14
- * const incident = await ports.incidents.get(input.id)
15
- * if (!incident) throw errors.NOT_FOUND()
16
- * return incident.toProps()
17
- * }
18
- * }
19
- * ```
20
- */
21
- export class ExternalUseCase extends CallableUseCase {
22
- /** Discriminator for `App.from` / `isExternalUseCase`. Do not override. */
23
- static trigger = 'external';
24
- }
25
- //# sourceMappingURL=external-use-case.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"external-use-case.js","sourceRoot":"","sources":["../../src/app/external-use-case.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,OAAgB,eAAgB,SAAQ,eAAe;IAC3D,2EAA2E;IAC3E,MAAM,CAAU,OAAO,GAAG,UAAmB,CAAC"}
@@ -1,9 +0,0 @@
1
- export { type CatalogEntry, type DerivedContract, deriveContract, nestByKey, type UseCaseContract, } from './contract.js';
2
- export { errorFactories } from './error-factory.js';
3
- export { type ChannelControl, type ChannelProps, type ChannelSession, EventChannel, type JoinCtx, type RefreshCtx, type RouteCtx, } from './event-channel.js';
4
- export { EventUseCase } from './event-use-case.js';
5
- export type { EventCtx, ExecuteCtx, Publish, PublishFor, Run, } from './execute-ctx.js';
6
- export { ExternalUseCase } from './external-use-case.js';
7
- export { InternalUseCase } from './internal-use-case.js';
8
- export { type AsUseCaseBag, type CallableUseCaseCtor, type CheckUseCase, type ErrorFactories, type EventChannelCtor, type EventUseCaseCtor, type ExternalUseCaseCtor, type InternalUseCaseCtor, isCallableUseCase, isEventUseCase, isExternalUseCase, isInternalUseCase, type ResolvedPorts, type UseCaseBag, type UseCaseClass, } from './types.js';
9
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/app/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,cAAc,EACd,SAAS,EACT,KAAK,eAAe,GACrB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,YAAY,EACZ,KAAK,OAAO,EACZ,KAAK,UAAU,EACf,KAAK,QAAQ,GACd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,YAAY,EACV,QAAQ,EACR,UAAU,EACV,OAAO,EACP,UAAU,EACV,GAAG,GACJ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,YAAY,GAClB,MAAM,YAAY,CAAC"}
package/dist/app/index.js DELETED
@@ -1,8 +0,0 @@
1
- export { deriveContract, nestByKey, } from './contract.js';
2
- export { errorFactories } from './error-factory.js';
3
- export { EventChannel, } from './event-channel.js';
4
- export { EventUseCase } from './event-use-case.js';
5
- export { ExternalUseCase } from './external-use-case.js';
6
- export { InternalUseCase } from './internal-use-case.js';
7
- export { isCallableUseCase, isEventUseCase, isExternalUseCase, isInternalUseCase, } from './types.js';
8
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/app/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,cAAc,EACd,SAAS,GAEV,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAIL,YAAY,GAIb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAQnD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EASL,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,iBAAiB,GAIlB,MAAM,YAAY,CAAC"}
@@ -1,26 +0,0 @@
1
- import { CallableUseCase } from './callable-use-case.js';
2
- /**
3
- * Composition-only request/response use case. Same execute shape as
4
- * ExternalUseCase. Omitted from `deriveContract`, `app.contract`, `app.local`,
5
- * and HTTP. Still in completeness. Invocable via `ctx.run`.
6
- *
7
- * ```ts
8
- * class CreateUser extends InternalUseCase {
9
- * static readonly key = 'user.create'
10
- * static readonly input = z.object({ id: z.string(), name: z.string() })
11
- * static readonly output = z.object({ id: z.string() })
12
- * static readonly errors = { USER_EXISTS: { message: 'User already exists' } } as const
13
- * static readonly ports = { users: UserRepository }
14
- * async execute({ input, ports, errors }: ExecuteCtx<typeof CreateUser>) {
15
- * if (await ports.users.getUser(input.id)) throw errors.USER_EXISTS()
16
- * await ports.users.saveUser(input)
17
- * return { id: input.id }
18
- * }
19
- * }
20
- * ```
21
- */
22
- export declare abstract class InternalUseCase extends CallableUseCase {
23
- /** Discriminator for `App.from` / `isInternalUseCase`. Do not override. */
24
- static readonly trigger: "internal";
25
- }
26
- //# sourceMappingURL=internal-use-case.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"internal-use-case.d.ts","sourceRoot":"","sources":["../../src/app/internal-use-case.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,8BAAsB,eAAgB,SAAQ,eAAe;IAC3D,2EAA2E;IAC3E,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAG,UAAU,CAAU;CAC/C"}
@@ -1,26 +0,0 @@
1
- import { CallableUseCase } from './callable-use-case.js';
2
- /**
3
- * Composition-only request/response use case. Same execute shape as
4
- * ExternalUseCase. Omitted from `deriveContract`, `app.contract`, `app.local`,
5
- * and HTTP. Still in completeness. Invocable via `ctx.run`.
6
- *
7
- * ```ts
8
- * class CreateUser extends InternalUseCase {
9
- * static readonly key = 'user.create'
10
- * static readonly input = z.object({ id: z.string(), name: z.string() })
11
- * static readonly output = z.object({ id: z.string() })
12
- * static readonly errors = { USER_EXISTS: { message: 'User already exists' } } as const
13
- * static readonly ports = { users: UserRepository }
14
- * async execute({ input, ports, errors }: ExecuteCtx<typeof CreateUser>) {
15
- * if (await ports.users.getUser(input.id)) throw errors.USER_EXISTS()
16
- * await ports.users.saveUser(input)
17
- * return { id: input.id }
18
- * }
19
- * }
20
- * ```
21
- */
22
- export class InternalUseCase extends CallableUseCase {
23
- /** Discriminator for `App.from` / `isInternalUseCase`. Do not override. */
24
- static trigger = 'internal';
25
- }
26
- //# sourceMappingURL=internal-use-case.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"internal-use-case.js","sourceRoot":"","sources":["../../src/app/internal-use-case.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,OAAgB,eAAgB,SAAQ,eAAe;IAC3D,2EAA2E;IAC3E,MAAM,CAAU,OAAO,GAAG,UAAmB,CAAC"}
@@ -1,9 +0,0 @@
1
- export type PathTo<Path extends string, V> = Path extends `${infer Head}.${infer Rest}` ? {
2
- readonly [K in Head]: PathTo<Rest, V>;
3
- } : {
4
- readonly [K in Path]: V;
5
- };
6
- export type UnionToIntersection<U> = (U extends unknown ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
7
- /** Nest dotted keys (`incident.close` → `{ incident: { close } }`). */
8
- export declare function nestByKey<V>(entries: Iterable<[string, V]>): Record<string, unknown>;
9
- //# sourceMappingURL=nest.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nest.d.ts","sourceRoot":"","sources":["../../src/app/nest.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,CAChB,IAAI,SAAS,MAAM,EACnB,CAAC,IACC,IAAI,SAAS,GAAG,MAAM,IAAI,IAAI,MAAM,IAAI,EAAE,GAC1C;IAAE,QAAQ,EAAE,CAAC,IAAI,IAAI,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;CAAE,GACzC;IAAE,QAAQ,EAAE,CAAC,IAAI,IAAI,GAAG,CAAC;CAAE,CAAC;AAEhC,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAAI,CACnC,CAAC,SAAS,OAAO,GACb,CAAC,CAAC,EAAE,CAAC,KAAK,IAAI,GACd,KAAK,CACV,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,KAAK,IAAI,GAC1B,CAAC,GACD,KAAK,CAAC;AAEV,uEAAuE;AACvE,wBAAgB,SAAS,CAAC,CAAC,EACzB,OAAO,EAAE,QAAQ,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,GAC7B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAsBzB"}
package/dist/app/nest.js DELETED
@@ -1,28 +0,0 @@
1
- /** Nest dotted keys (`incident.close` → `{ incident: { close } }`). */
2
- export function nestByKey(entries) {
3
- const root = Object.create(null);
4
- for (const [key, value] of entries) {
5
- const parts = key.split('.');
6
- let cursor = root;
7
- for (let i = 0; i < parts.length - 1; i++) {
8
- const part = parts[i];
9
- if (part === undefined)
10
- continue;
11
- const existing = cursor[part];
12
- if (existing === undefined || typeof existing !== 'object') {
13
- const next = Object.create(null);
14
- cursor[part] = next;
15
- cursor = next;
16
- }
17
- else {
18
- cursor = existing;
19
- }
20
- }
21
- const last = parts[parts.length - 1];
22
- if (last === undefined)
23
- continue;
24
- cursor[last] = value;
25
- }
26
- return root;
27
- }
28
- //# sourceMappingURL=nest.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nest.js","sourceRoot":"","sources":["../../src/app/nest.ts"],"names":[],"mappings":"AAeA,uEAAuE;AACvE,MAAM,UAAU,SAAS,CACvB,OAA8B;IAE9B,MAAM,IAAI,GAA4B,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC1D,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,OAAO,EAAE,CAAC;QACnC,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC7B,IAAI,MAAM,GAAG,IAAI,CAAC;QAClB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YAC1C,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;YACtB,IAAI,IAAI,KAAK,SAAS;gBAAE,SAAS;YACjC,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;YAC9B,IAAI,QAAQ,KAAK,SAAS,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;gBAC3D,MAAM,IAAI,GAA4B,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;gBAC1D,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;gBACpB,MAAM,GAAG,IAAI,CAAC;YAChB,CAAC;iBAAM,CAAC;gBACN,MAAM,GAAG,QAAmC,CAAC;YAC/C,CAAC;QACH,CAAC;QACD,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACrC,IAAI,IAAI,KAAK,SAAS;YAAE,SAAS;QACjC,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;IACvB,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}