@beignet/core 0.0.1 → 0.0.2

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 (274) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +149 -4
  3. package/dist/application/index.d.ts +93 -9
  4. package/dist/application/index.d.ts.map +1 -1
  5. package/dist/application/index.js +11 -11
  6. package/dist/application/index.js.map +1 -1
  7. package/dist/client/client.d.ts +73 -12
  8. package/dist/client/client.d.ts.map +1 -1
  9. package/dist/client/client.js +37 -12
  10. package/dist/client/client.js.map +1 -1
  11. package/dist/client/index.d.ts +12 -0
  12. package/dist/client/index.d.ts.map +1 -1
  13. package/dist/client/index.js +6 -0
  14. package/dist/client/index.js.map +1 -1
  15. package/dist/client/types.d.ts +69 -8
  16. package/dist/client/types.d.ts.map +1 -1
  17. package/dist/config/index.d.ts +84 -0
  18. package/dist/config/index.d.ts.map +1 -1
  19. package/dist/config/index.js +36 -0
  20. package/dist/config/index.js.map +1 -1
  21. package/dist/contracts/contract-builder.d.ts +49 -22
  22. package/dist/contracts/contract-builder.d.ts.map +1 -1
  23. package/dist/contracts/contract-builder.js +48 -21
  24. package/dist/contracts/contract-builder.js.map +1 -1
  25. package/dist/contracts/contract-group.d.ts +35 -19
  26. package/dist/contracts/contract-group.d.ts.map +1 -1
  27. package/dist/contracts/contract-group.js +35 -19
  28. package/dist/contracts/contract-group.js.map +1 -1
  29. package/dist/contracts/contract-like.d.ts +4 -4
  30. package/dist/contracts/contract-like.d.ts.map +1 -1
  31. package/dist/contracts/contract-like.js +2 -1
  32. package/dist/contracts/contract-like.js.map +1 -1
  33. package/dist/contracts/index.d.ts +28 -0
  34. package/dist/contracts/index.d.ts.map +1 -1
  35. package/dist/contracts/index.js +12 -0
  36. package/dist/contracts/index.js.map +1 -1
  37. package/dist/contracts/openapi-meta.d.ts +8 -8
  38. package/dist/contracts/openapi-meta.d.ts.map +1 -1
  39. package/dist/contracts/path-template.d.ts +27 -0
  40. package/dist/contracts/path-template.d.ts.map +1 -1
  41. package/dist/contracts/path-template.js +6 -0
  42. package/dist/contracts/path-template.js.map +1 -1
  43. package/dist/contracts/types.d.ts +104 -10
  44. package/dist/contracts/types.d.ts.map +1 -1
  45. package/dist/contracts/types.js +15 -0
  46. package/dist/contracts/types.js.map +1 -1
  47. package/dist/contracts/utils.d.ts +6 -0
  48. package/dist/contracts/utils.d.ts.map +1 -1
  49. package/dist/contracts/utils.js +6 -0
  50. package/dist/contracts/utils.js.map +1 -1
  51. package/dist/domain/entity.d.ts +22 -11
  52. package/dist/domain/entity.d.ts.map +1 -1
  53. package/dist/domain/entity.js +5 -1
  54. package/dist/domain/entity.js.map +1 -1
  55. package/dist/domain/events.d.ts +5 -2
  56. package/dist/domain/events.d.ts.map +1 -1
  57. package/dist/domain/events.js +4 -1
  58. package/dist/domain/events.js.map +1 -1
  59. package/dist/domain/value-object.d.ts +19 -9
  60. package/dist/domain/value-object.d.ts.map +1 -1
  61. package/dist/domain/value-object.js +5 -1
  62. package/dist/domain/value-object.js.map +1 -1
  63. package/dist/errors/catalog.d.ts +40 -16
  64. package/dist/errors/catalog.d.ts.map +1 -1
  65. package/dist/errors/catalog.js +18 -7
  66. package/dist/errors/catalog.js.map +1 -1
  67. package/dist/errors/response.d.ts +16 -4
  68. package/dist/errors/response.d.ts.map +1 -1
  69. package/dist/errors/response.js +3 -3
  70. package/dist/errors/response.js.map +1 -1
  71. package/dist/errors/validation.d.ts +10 -1
  72. package/dist/errors/validation.d.ts.map +1 -1
  73. package/dist/errors/validation.js +3 -0
  74. package/dist/errors/validation.js.map +1 -1
  75. package/dist/events/index.d.ts +133 -0
  76. package/dist/events/index.d.ts.map +1 -1
  77. package/dist/events/index.js +30 -0
  78. package/dist/events/index.js.map +1 -1
  79. package/dist/idempotency/index.d.ts +355 -0
  80. package/dist/idempotency/index.d.ts.map +1 -0
  81. package/dist/idempotency/index.js +360 -0
  82. package/dist/idempotency/index.js.map +1 -0
  83. package/dist/jobs/index.d.ts +110 -0
  84. package/dist/jobs/index.d.ts.map +1 -1
  85. package/dist/jobs/index.js +22 -0
  86. package/dist/jobs/index.js.map +1 -1
  87. package/dist/mail/index.d.ts +149 -0
  88. package/dist/mail/index.d.ts.map +1 -1
  89. package/dist/mail/index.js +30 -0
  90. package/dist/mail/index.js.map +1 -1
  91. package/dist/notifications/index.d.ts +369 -0
  92. package/dist/notifications/index.d.ts.map +1 -0
  93. package/dist/notifications/index.js +310 -0
  94. package/dist/notifications/index.js.map +1 -0
  95. package/dist/openapi/index.d.ts +132 -16
  96. package/dist/openapi/index.d.ts.map +1 -1
  97. package/dist/openapi/index.js +1 -1
  98. package/dist/openapi/index.js.map +1 -1
  99. package/dist/outbox/index.d.ts +469 -0
  100. package/dist/outbox/index.d.ts.map +1 -0
  101. package/dist/outbox/index.js +482 -0
  102. package/dist/outbox/index.js.map +1 -0
  103. package/dist/pagination/index.d.ts +166 -0
  104. package/dist/pagination/index.d.ts.map +1 -0
  105. package/dist/pagination/index.js +96 -0
  106. package/dist/pagination/index.js.map +1 -0
  107. package/dist/ports/audit.d.ts +271 -0
  108. package/dist/ports/audit.d.ts.map +1 -1
  109. package/dist/ports/audit.js +128 -0
  110. package/dist/ports/audit.js.map +1 -1
  111. package/dist/ports/auth.d.ts +70 -0
  112. package/dist/ports/auth.d.ts.map +1 -1
  113. package/dist/ports/auth.js +30 -0
  114. package/dist/ports/auth.js.map +1 -1
  115. package/dist/ports/cache.d.ts +41 -0
  116. package/dist/ports/cache.d.ts.map +1 -1
  117. package/dist/ports/cache.js +10 -0
  118. package/dist/ports/cache.js.map +1 -1
  119. package/dist/ports/clock.d.ts +38 -0
  120. package/dist/ports/clock.d.ts.map +1 -1
  121. package/dist/ports/clock.js +20 -0
  122. package/dist/ports/clock.js.map +1 -1
  123. package/dist/ports/id-generator.d.ts +37 -0
  124. package/dist/ports/id-generator.d.ts.map +1 -1
  125. package/dist/ports/id-generator.js +22 -0
  126. package/dist/ports/id-generator.js.map +1 -1
  127. package/dist/ports/index.d.ts +83 -0
  128. package/dist/ports/index.d.ts.map +1 -1
  129. package/dist/ports/index.js +41 -5
  130. package/dist/ports/index.js.map +1 -1
  131. package/dist/ports/logger.d.ts +56 -0
  132. package/dist/ports/logger.d.ts.map +1 -1
  133. package/dist/ports/logger.js +17 -0
  134. package/dist/ports/logger.js.map +1 -1
  135. package/dist/ports/policy.d.ts +132 -0
  136. package/dist/ports/policy.d.ts.map +1 -1
  137. package/dist/ports/policy.js +45 -0
  138. package/dist/ports/policy.js.map +1 -1
  139. package/dist/ports/rate-limit.d.ts +25 -0
  140. package/dist/ports/rate-limit.d.ts.map +1 -1
  141. package/dist/ports/rate-limit.js +10 -0
  142. package/dist/ports/rate-limit.js.map +1 -1
  143. package/dist/ports/redaction.d.ts +101 -0
  144. package/dist/ports/redaction.d.ts.map +1 -1
  145. package/dist/ports/redaction.js +59 -0
  146. package/dist/ports/redaction.js.map +1 -1
  147. package/dist/ports/storage.d.ts +100 -0
  148. package/dist/ports/storage.d.ts.map +1 -1
  149. package/dist/ports/storage.js +10 -0
  150. package/dist/ports/storage.js.map +1 -1
  151. package/dist/ports/testing.d.ts +47 -0
  152. package/dist/ports/testing.d.ts.map +1 -1
  153. package/dist/ports/testing.js +23 -0
  154. package/dist/ports/testing.js.map +1 -1
  155. package/dist/ports/unit-of-work.d.ts +60 -3
  156. package/dist/ports/unit-of-work.d.ts.map +1 -1
  157. package/dist/ports/unit-of-work.js +11 -2
  158. package/dist/ports/unit-of-work.js.map +1 -1
  159. package/dist/providers/instrumentation.d.ts +204 -0
  160. package/dist/providers/instrumentation.d.ts.map +1 -1
  161. package/dist/providers/instrumentation.js +14 -0
  162. package/dist/providers/instrumentation.js.map +1 -1
  163. package/dist/providers/provider.d.ts +14 -1
  164. package/dist/providers/provider.d.ts.map +1 -1
  165. package/dist/providers/provider.js.map +1 -1
  166. package/dist/schedules/index.d.ts +246 -0
  167. package/dist/schedules/index.d.ts.map +1 -1
  168. package/dist/schedules/index.js +27 -0
  169. package/dist/schedules/index.js.map +1 -1
  170. package/dist/server/health.d.ts +14 -5
  171. package/dist/server/health.d.ts.map +1 -1
  172. package/dist/server/health.js +5 -2
  173. package/dist/server/health.js.map +1 -1
  174. package/dist/server/hooks/auth.d.ts +57 -0
  175. package/dist/server/hooks/auth.d.ts.map +1 -1
  176. package/dist/server/hooks/auth.js.map +1 -1
  177. package/dist/server/hooks/cors.d.ts +27 -0
  178. package/dist/server/hooks/cors.d.ts.map +1 -1
  179. package/dist/server/hooks/cors.js +12 -0
  180. package/dist/server/hooks/cors.js.map +1 -1
  181. package/dist/server/hooks/errors.d.ts +15 -6
  182. package/dist/server/hooks/errors.d.ts.map +1 -1
  183. package/dist/server/hooks/errors.js.map +1 -1
  184. package/dist/server/hooks/index.d.ts +3 -0
  185. package/dist/server/hooks/index.d.ts.map +1 -1
  186. package/dist/server/hooks/index.js +3 -0
  187. package/dist/server/hooks/index.js.map +1 -1
  188. package/dist/server/hooks/logging.d.ts +36 -0
  189. package/dist/server/hooks/logging.d.ts.map +1 -1
  190. package/dist/server/hooks/logging.js +6 -0
  191. package/dist/server/hooks/logging.js.map +1 -1
  192. package/dist/server/hooks/rate-limit.d.ts +33 -0
  193. package/dist/server/hooks/rate-limit.d.ts.map +1 -1
  194. package/dist/server/hooks/rate-limit.js +11 -0
  195. package/dist/server/hooks/rate-limit.js.map +1 -1
  196. package/dist/server/http.d.ts +170 -0
  197. package/dist/server/http.d.ts.map +1 -1
  198. package/dist/server/index.d.ts +18 -0
  199. package/dist/server/index.d.ts.map +1 -1
  200. package/dist/server/index.js +6 -0
  201. package/dist/server/index.js.map +1 -1
  202. package/dist/server/openapi.d.ts +5 -3
  203. package/dist/server/openapi.d.ts.map +1 -1
  204. package/dist/server/openapi.js +4 -2
  205. package/dist/server/openapi.js.map +1 -1
  206. package/dist/server/providers/loadProviderConfig.d.ts +9 -0
  207. package/dist/server/providers/loadProviderConfig.d.ts.map +1 -1
  208. package/dist/server/providers/loadProviderConfig.js +9 -0
  209. package/dist/server/providers/loadProviderConfig.js.map +1 -1
  210. package/dist/server/server.d.ts +107 -8
  211. package/dist/server/server.d.ts.map +1 -1
  212. package/dist/server/server.js +27 -7
  213. package/dist/server/server.js.map +1 -1
  214. package/dist/testing/index.d.ts +167 -0
  215. package/dist/testing/index.d.ts.map +1 -0
  216. package/dist/testing/index.js +119 -0
  217. package/dist/testing/index.js.map +1 -0
  218. package/package.json +21 -1
  219. package/src/application/index.ts +85 -22
  220. package/src/client/client.ts +73 -12
  221. package/src/client/index.ts +12 -0
  222. package/src/client/types.ts +70 -9
  223. package/src/config/index.ts +86 -0
  224. package/src/contracts/contract-builder.ts +49 -22
  225. package/src/contracts/contract-group.ts +35 -19
  226. package/src/contracts/contract-like.ts +4 -4
  227. package/src/contracts/index.ts +28 -1
  228. package/src/contracts/openapi-meta.ts +8 -8
  229. package/src/contracts/path-template.ts +27 -0
  230. package/src/contracts/types.ts +111 -10
  231. package/src/contracts/utils.ts +6 -0
  232. package/src/domain/entity.ts +22 -11
  233. package/src/domain/events.ts +5 -2
  234. package/src/domain/value-object.ts +19 -9
  235. package/src/errors/catalog.ts +40 -16
  236. package/src/errors/response.ts +16 -4
  237. package/src/errors/validation.ts +10 -1
  238. package/src/events/index.ts +134 -0
  239. package/src/idempotency/index.ts +767 -0
  240. package/src/jobs/index.ts +111 -0
  241. package/src/mail/index.ts +149 -0
  242. package/src/notifications/index.ts +771 -0
  243. package/src/openapi/index.ts +133 -16
  244. package/src/outbox/index.ts +1024 -0
  245. package/src/pagination/index.ts +278 -0
  246. package/src/ports/audit.ts +271 -0
  247. package/src/ports/auth.ts +70 -0
  248. package/src/ports/cache.ts +41 -0
  249. package/src/ports/clock.ts +38 -0
  250. package/src/ports/id-generator.ts +37 -0
  251. package/src/ports/index.ts +106 -11
  252. package/src/ports/logger.ts +56 -0
  253. package/src/ports/policy.ts +133 -0
  254. package/src/ports/rate-limit.ts +25 -0
  255. package/src/ports/redaction.ts +101 -0
  256. package/src/ports/storage.ts +100 -0
  257. package/src/ports/testing.ts +47 -0
  258. package/src/ports/unit-of-work.ts +60 -3
  259. package/src/providers/instrumentation.ts +204 -0
  260. package/src/providers/provider.ts +14 -1
  261. package/src/schedules/index.ts +247 -0
  262. package/src/server/health.ts +14 -5
  263. package/src/server/hooks/auth.ts +58 -0
  264. package/src/server/hooks/cors.ts +27 -0
  265. package/src/server/hooks/errors.ts +15 -6
  266. package/src/server/hooks/index.ts +3 -0
  267. package/src/server/hooks/logging.ts +36 -0
  268. package/src/server/hooks/rate-limit.ts +33 -0
  269. package/src/server/http.ts +170 -1
  270. package/src/server/index.ts +18 -1
  271. package/src/server/openapi.ts +5 -3
  272. package/src/server/providers/loadProviderConfig.ts +9 -0
  273. package/src/server/server.ts +107 -9
  274. package/src/testing/index.ts +337 -0
@@ -1,23 +1,93 @@
1
+ /**
2
+ * Minimal request shape consumed by Beignet auth ports.
3
+ *
4
+ * Framework adapters can pass richer request objects, but auth providers should
5
+ * only rely on headers and the optional raw platform request unless they
6
+ * declare a more specific `RequestLike` type.
7
+ */
1
8
  export interface AuthRequestLike {
9
+ /**
10
+ * Request headers used for cookies, bearer tokens, API keys, or provider
11
+ * specific auth data.
12
+ */
2
13
  headers: Headers;
14
+ /**
15
+ * Raw platform request, when the runtime has one available.
16
+ */
3
17
  raw?: Request;
4
18
  }
19
+ /**
20
+ * Normalized authenticated session returned by an `AuthPort`.
21
+ *
22
+ * `user` is the app/provider user object. `session` can carry provider-specific
23
+ * session state such as cookie session metadata or token claims.
24
+ */
5
25
  export interface AuthSession<User = unknown, Session = unknown> {
6
26
  user: User;
7
27
  session?: Session;
8
28
  }
29
+ /**
30
+ * Error thrown by auth helpers when a route or workflow requires a user but no
31
+ * authenticated user is available.
32
+ */
9
33
  export declare class AuthUnauthorizedError extends Error {
10
34
  readonly code = "UNAUTHORIZED";
11
35
  constructor(message?: string);
12
36
  }
37
+ /**
38
+ * App-facing authentication port.
39
+ *
40
+ * Implement this with a provider adapter such as Better Auth, a custom session
41
+ * lookup, or a test fake. The port identifies the current user; it does not
42
+ * decide whether that user may perform a business action. Keep authorization in
43
+ * policies or use cases.
44
+ */
13
45
  export interface AuthPort<User = unknown, Session = unknown, RequestLike extends AuthRequestLike = AuthRequestLike> {
46
+ /**
47
+ * Return the current session, or `null` when the request is unauthenticated.
48
+ */
14
49
  getSession(req: RequestLike): Promise<AuthSession<User, Session> | null>;
50
+ /**
51
+ * Return the current user, or `null` when unauthenticated.
52
+ */
15
53
  getUser(req: RequestLike): Promise<User | null>;
54
+ /**
55
+ * Return the current user or throw `AuthUnauthorizedError`.
56
+ */
16
57
  requireUser(req: RequestLike): Promise<User>;
17
58
  }
18
59
  type MaybePromise<T> = T | Promise<T>;
60
+ /**
61
+ * Request-aware factory for a static auth session.
62
+ */
19
63
  export type StaticAuthSessionFactory<User, Session, RequestLike extends AuthRequestLike> = (req: RequestLike) => MaybePromise<AuthSession<User, Session> | null>;
64
+ /**
65
+ * Create an auth port from a fixed session or request-aware session factory.
66
+ *
67
+ * This is useful for tests, examples, and simple apps. Production apps usually
68
+ * use a provider-backed auth port that verifies cookies, tokens, or sessions.
69
+ *
70
+ * @example
71
+ * ```ts
72
+ * const auth = createStaticAuth({
73
+ * user: { id: "user_1", name: "Ada" },
74
+ * });
75
+ * ```
76
+ *
77
+ * @param session - Fixed session, `null`, or a function that resolves a session
78
+ * from the request.
79
+ * @returns An `AuthPort` implementation backed by the provided session source.
80
+ */
20
81
  export declare function createStaticAuth<User, Session = unknown, RequestLike extends AuthRequestLike = AuthRequestLike>(session: AuthSession<User, Session> | null | StaticAuthSessionFactory<User, Session, RequestLike>): AuthPort<User, Session, RequestLike>;
82
+ /**
83
+ * Create an auth port that always treats requests as unauthenticated.
84
+ *
85
+ * Use this in tests or examples where auth is intentionally absent. It is not a
86
+ * security boundary; it simply returns `null` from `getSession`/`getUser` and
87
+ * throws from `requireUser`.
88
+ *
89
+ * @returns An `AuthPort` with no active session.
90
+ */
21
91
  export declare function createAnonymousAuth<User = unknown, Session = unknown, RequestLike extends AuthRequestLike = AuthRequestLike>(): AuthPort<User, Session, RequestLike>;
22
92
  export {};
23
93
  //# sourceMappingURL=auth.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/ports/auth.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED,MAAM,WAAW,WAAW,CAAC,IAAI,GAAG,OAAO,EAAE,OAAO,GAAG,OAAO;IAC5D,IAAI,EAAE,IAAI,CAAC;IACX,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,QAAQ,CAAC,IAAI,kBAAkB;gBAEnB,OAAO,SAAiB;CAIrC;AAED,MAAM,WAAW,QAAQ,CACvB,IAAI,GAAG,OAAO,EACd,OAAO,GAAG,OAAO,EACjB,WAAW,SAAS,eAAe,GAAG,eAAe;IAErD,UAAU,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC;IACzE,OAAO,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;IAChD,WAAW,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9C;AAED,KAAK,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;AAEtC,MAAM,MAAM,wBAAwB,CAClC,IAAI,EACJ,OAAO,EACP,WAAW,SAAS,eAAe,IACjC,CAAC,GAAG,EAAE,WAAW,KAAK,YAAY,CAAC,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC;AAE1E,wBAAgB,gBAAgB,CAC9B,IA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I,CAAC,CAAC;IAChD;;OAEG;IACH,WAAW,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9C;AAED,KAAK,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;AAEtC;;GAEG;AACH,MAAM,MAAM,wBAAwB,CAClC,IAAI,EACJ,OAAO,EACP,WAAW,SAAS,eAAe,IACjC,CAAC,GAAG,EAAE,WAAW,KAAK,YAAY,CAAC,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC;AAE1E;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EACJ,OAAO,GAAG,OAAO,EACjB,WAAW,SAAS,eAAe,GAAG,eAAe,EAErD,OAAO,EACH,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,GAC1B,IAAI,GACJ,wBAAwB,CAAC,IAAI,EAAE,OAAO,EAAE,WAAW,CAAC,GACvD,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,WAAW,CAAC,CAqBtC;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,GAAG,OAAO,EACd,OAAO,GAAG,OAAO,EACjB,WAAW,SAAS,eAAe,GAAG,eAAe,KAClD,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,WAAW,CAAC,CAExC"}
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Error thrown by auth helpers when a route or workflow requires a user but no
3
+ * authenticated user is available.
4
+ */
1
5
  export class AuthUnauthorizedError extends Error {
2
6
  code = "UNAUTHORIZED";
3
7
  constructor(message = "Unauthorized") {
@@ -5,6 +9,23 @@ export class AuthUnauthorizedError extends Error {
5
9
  this.name = "AuthUnauthorizedError";
6
10
  }
7
11
  }
12
+ /**
13
+ * Create an auth port from a fixed session or request-aware session factory.
14
+ *
15
+ * This is useful for tests, examples, and simple apps. Production apps usually
16
+ * use a provider-backed auth port that verifies cookies, tokens, or sessions.
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * const auth = createStaticAuth({
21
+ * user: { id: "user_1", name: "Ada" },
22
+ * });
23
+ * ```
24
+ *
25
+ * @param session - Fixed session, `null`, or a function that resolves a session
26
+ * from the request.
27
+ * @returns An `AuthPort` implementation backed by the provided session source.
28
+ */
8
29
  export function createStaticAuth(session) {
9
30
  async function resolveSession(req) {
10
31
  return typeof session === "function" ? session(req) : session;
@@ -25,6 +46,15 @@ export function createStaticAuth(session) {
25
46
  },
26
47
  };
27
48
  }
49
+ /**
50
+ * Create an auth port that always treats requests as unauthenticated.
51
+ *
52
+ * Use this in tests or examples where auth is intentionally absent. It is not a
53
+ * security boundary; it simply returns `null` from `getSession`/`getUser` and
54
+ * throws from `requireUser`.
55
+ *
56
+ * @returns An `AuthPort` with no active session.
57
+ */
28
58
  export function createAnonymousAuth() {
29
59
  return createStaticAuth(null);
30
60
  }
@@ -1 +1 @@
1
- {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/ports/auth.ts"],"names":[],"mappings":"AAUA,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IACrC,IAAI,GAAG,cAAc,CAAC;IAE/B,YAAY,OAAO,GAAG,cAAc;QAClC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;IACtC,CAAC;CACF;AAoBD,MAAM,UAAU,gBAAgB,CAK9B,OAGwD;IAExD,KAAK,UAAU,cAAc,CAAC,GAAgB;QAC5C,OAAO,OAAO,OAAO,KAAK,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;IAChE,CAAC;IAED,OAAO;QACL,KAAK,CAAC,UAAU,CAAC,GAAG;YAClB,OAAO,cAAc,CAAC,GAAG,CAAC,CAAC;QAC7B,CAAC;QACD,KAAK,CAAC,OAAO,CAAC,GAAG;YACf,OAAO,CAAC,MAAM,cAAc,CAA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MAAM,cAAc,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,IAAI,IAAI,CAAC;YACvD,IAAI,CAAC,IAAI,EAAE,CAAC;gBACV,MAAM,IAAI,qBAAqB,EAAE,CAAC;YACpC,CAAC;YAED,OAAO,IAAI,CAAC;QACd,CAAC;KACF,CAAC;AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB;IAKjC,OAAO,gBAAgB,CAA6B,IAAI,CAAC,CAAC;AAC5D,CAAC"}
@@ -1,15 +1,56 @@
1
+ /**
2
+ * Options for storing a cache value.
3
+ */
1
4
  export interface CacheSetOptions {
2
5
  /**
3
6
  * Time-to-live in seconds. Omit this for a value that does not expire.
4
7
  */
5
8
  ttlSeconds?: number;
6
9
  }
10
+ /**
11
+ * App-facing string cache port.
12
+ *
13
+ * Values are intentionally strings so adapters can map cleanly to Redis,
14
+ * Upstash, and other key/value stores. Serialize structured values at the app
15
+ * boundary.
16
+ */
7
17
  export interface CachePort {
18
+ /**
19
+ * Return a fresh value for `key`, or `null` when missing or expired.
20
+ */
8
21
  get(key: string): Promise<string | null>;
22
+ /**
23
+ * Store a string value.
24
+ */
9
25
  set(key: string, value: string, options?: CacheSetOptions): Promise<void>;
26
+ /**
27
+ * Delete a cache key.
28
+ *
29
+ * @returns `true` when the key existed.
30
+ */
10
31
  delete(key: string): Promise<boolean>;
32
+ /**
33
+ * Return whether a fresh value exists for `key`.
34
+ */
11
35
  has(key: string): Promise<boolean>;
36
+ /**
37
+ * Return a cached value or compute, store, and return a new value.
38
+ *
39
+ * Implementations are not required to provide single-flight behavior. If
40
+ * concurrent cache fills matter, choose an adapter that documents that
41
+ * guarantee or protect the factory at the application layer.
42
+ */
12
43
  remember(key: string, factory: () => Promise<string>, options?: CacheSetOptions): Promise<string>;
13
44
  }
45
+ /**
46
+ * Create an in-memory cache for tests, examples, and single-process
47
+ * development.
48
+ *
49
+ * This adapter is not durable or distributed. Values are lost when the process
50
+ * exits and are not shared across workers, regions, or serverless invocations.
51
+ *
52
+ * @param initialValues - Optional initial string values without TTL.
53
+ * @returns A cache port backed by a local `Map`.
54
+ */
14
55
  export declare function createMemoryCache(initialValues?: Record<string, string>): CachePort;
15
56
  //# sourceMappingURL=cache.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../src/ports/cache.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,SAAS;IACxB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACzC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1E,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACtC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACnC,QAAQ,CACN,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,EAC9B,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,MAAM,CAAC,CAAC;CACpB;AAuBD,wBAAgB,iBAAiB,CAC/B,aAAa,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,GACzC,SAAS,CAmDX"}
1
+ {"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../src/ports/cache.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,SAAS;IACxB;;OAEG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACzC;;OAEG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1E;;;;OAIG;IACH,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACtC;;OAEG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACnC;;;;;;OAMG;IACH,QAAQ,CACN,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,EAC9B,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,MAAM,CAAC,CAAC;CACpB;AAuBD;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAC/B,aAAa,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,GACzC,SAAS,CAmDX"}
@@ -10,6 +10,16 @@ function resolveExpiresAt(options) {
10
10
  function isExpired(entry) {
11
11
  return entry.expiresAt != null && entry.expiresAt <= Date.now();
12
12
  }
13
+ /**
14
+ * Create an in-memory cache for tests, examples, and single-process
15
+ * development.
16
+ *
17
+ * This adapter is not durable or distributed. Values are lost when the process
18
+ * exits and are not shared across workers, regions, or serverless invocations.
19
+ *
20
+ * @param initialValues - Optional initial string values without TTL.
21
+ * @returns A cache port backed by a local `Map`.
22
+ */
13
23
  export function createMemoryCache(initialValues = {}) {
14
24
  const values = new Map(Object.entries(initialValues).map(([key, value]) => [
15
25
  key,
@@ -1 +1 @@
1
- {"version":3,"file":"cache.js","sourceRoot":"","sources":["../../src/ports/cache.ts"],"names":[],"mappings":"AAwBA,SAAS,gBAAgB,CAAC,OAAoC;IAC5D,IAAI,OAAO,EAAE,UAAU,IAAI,IAAI,EAAE,CAAC;QAChC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,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,GAAG,EAAE,OAAO,EAAE,OAAO;YAClC,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACpC,IAAI,MAAM,IAAI,IAAI,EAAE,CAAC;gBACnB,OAAO,MAAM,CAAC;YAChB,CAAC;YAED,MAAM,KAAK,GAAG,MAAM,OAAO,EAAE,CAAC;YAC9B,MAAM,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;YACrC,OAAO,KAAK,CAAC;QACf,CAAC;KACF,CAAC;IAEF,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -1,10 +1,48 @@
1
+ /**
2
+ * App-facing time source.
3
+ *
4
+ * Use this port anywhere deterministic time matters, such as use-case tests,
5
+ * scheduled work, idempotency windows, or audit timestamps.
6
+ */
1
7
  export interface ClockPort {
8
+ /**
9
+ * Return the current time according to this clock.
10
+ */
2
11
  now(): Date;
3
12
  }
13
+ /**
14
+ * Mutable clock implementation used by tests.
15
+ */
4
16
  export interface FrozenClockPort extends ClockPort {
17
+ /**
18
+ * Replace the current time.
19
+ */
5
20
  setNow(value: Date | string | number): void;
21
+ /**
22
+ * Move the current time forward by the given number of milliseconds.
23
+ */
6
24
  advance(milliseconds: number): void;
7
25
  }
26
+ /**
27
+ * Create a clock backed by `new Date()`.
28
+ *
29
+ * Use this as the default production `ClockPort` when the app does not need a
30
+ * provider-specific time source.
31
+ *
32
+ * @returns A clock that reads the current system time.
33
+ */
8
34
  export declare function createSystemClock(): ClockPort;
35
+ /**
36
+ * Create a mutable clock for deterministic tests.
37
+ *
38
+ * @example
39
+ * ```ts
40
+ * const clock = createFrozenClock("2026-01-01T00:00:00.000Z");
41
+ * clock.advance(1000);
42
+ * ```
43
+ *
44
+ * @param initial - Initial time for the clock. Defaults to Unix epoch.
45
+ * @returns A clock whose time can be replaced or advanced.
46
+ */
9
47
  export declare function createFrozenClock(initial?: Date | string | number): FrozenClockPort;
10
48
  //# sourceMappingURL=clock.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"clock.d.ts","sourceRoot":"","sources":["../../src/ports/clock.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IACxB,GAAG,IAAI,IAAI,CAAC;CACb;AAED,MAAM,WAAW,eAAgB,SAAQ,SAAS;IAChD,MAAM,CAAC,KAAK,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAC5C,OAAO,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CACrC;AAMD,wBAAgB,iBAAiB,IAAI,SAAS,CAI7C;AAED,wBAAgB,iBAAiB,CAC/B,OAAO,GAAE,IAAI,GAAG,MAAM,GAAG,MAAoB,GAC5C,eAAe,CAYjB"}
1
+ {"version":3,"file":"clock.d.ts","sourceRoot":"","sources":["../../src/ports/clock.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,SAAS;IACxB;;OAEG;IACH,GAAG,IAAI,IAAI,CAAC;CACb;AAED;;GAEG;AACH,MAAM,WAAW,eAAgB,SAAQ,SAAS;IAChD;;OAEG;IACH,MAAM,CAAC,KAAK,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAC5C;;OAEG;IACH,OAAO,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CACrC;AAMD;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,IAAI,SAAS,CAI7C;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,GAAE,IAAI,GAAG,MAAM,GAAG,MAAoB,GAC5C,eAAe,CAYjB"}
@@ -1,11 +1,31 @@
1
1
  function toDate(value) {
2
2
  return value instanceof Date ? new Date(value.getTime()) : new Date(value);
3
3
  }
4
+ /**
5
+ * Create a clock backed by `new Date()`.
6
+ *
7
+ * Use this as the default production `ClockPort` when the app does not need a
8
+ * provider-specific time source.
9
+ *
10
+ * @returns A clock that reads the current system time.
11
+ */
4
12
  export function createSystemClock() {
5
13
  return {
6
14
  now: () => new Date(),
7
15
  };
8
16
  }
17
+ /**
18
+ * Create a mutable clock for deterministic tests.
19
+ *
20
+ * @example
21
+ * ```ts
22
+ * const clock = createFrozenClock("2026-01-01T00:00:00.000Z");
23
+ * clock.advance(1000);
24
+ * ```
25
+ *
26
+ * @param initial - Initial time for the clock. Defaults to Unix epoch.
27
+ * @returns A clock whose time can be replaced or advanced.
28
+ */
9
29
  export function createFrozenClock(initial = new Date(0)) {
10
30
  let current = toDate(initial);
11
31
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"clock.js","sourceRoot":"","sources":["../../src/ports/clock.ts"],"names":[],"mappings":"AASA,SAAS,MAAM,CAAC,KAA6B;IAC3C,OAAO,KAAK,YAAY,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC;AAC7E,CAAC;AAED,MAAM,UAAU,iBAAiB;IAC/B,OAAO;QACL,GAAG,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE;KACtB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,iBAAiB,CAC/B,UAAkC,IAAI,IAAI,CAAC,CAAC,CAAC;IAE7C,IAAI,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;IAE9B,OAAO;QACL,GAAG,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QACtC,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE;YAChB,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAC1B,CAAC;QACD,OAAO,EAAE,CAAC,YAAY,EAAE,EAAE;YACxB,OAAO,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,YAAY,CAAC,CAAC;QACvD,CAAC;KACF,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"clock.js","sourceRoot":"","sources":["../../src/ports/clock.ts"],"names":[],"mappings":"AA2BA,SAAS,MAAM,CAAC,KAA6B;IAC3C,OAAO,KAAK,YAAY,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC;AAC7E,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB;IAC/B,OAAO;QACL,GAAG,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE;KACtB,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,iBAAiB,CAC/B,UAAkC,IAAI,IAAI,CAAC,CAAC,CAAC;IAE7C,IAAI,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;IAE9B,OAAO;QACL,GAAG,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QACtC,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE;YAChB,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAC1B,CAAC;QACD,OAAO,EAAE,CAAC,YAAY,EAAE,EAAE;YACxB,OAAO,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,YAAY,CAAC,CAAC;QACvD,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -1,10 +1,47 @@
1
+ /**
2
+ * App-facing ID generation port.
3
+ *
4
+ * Use this when deterministic IDs matter in use-case tests or when production
5
+ * infrastructure owns ID generation.
6
+ */
1
7
  export interface IdGeneratorPort {
8
+ /**
9
+ * Return the next ID.
10
+ */
2
11
  nextId(): string;
3
12
  }
13
+ /**
14
+ * Mutable sequential ID generator used by tests and simple examples.
15
+ */
4
16
  export interface SequenceIdGeneratorPort extends IdGeneratorPort {
17
+ /**
18
+ * Reset the next sequence value.
19
+ */
5
20
  reset(next?: number): void;
6
21
  }
22
+ /**
23
+ * Create an ID generator backed by `globalThis.crypto.randomUUID()`.
24
+ *
25
+ * The factory itself does not read from `crypto`; the returned generator's
26
+ * `nextId()` method throws if the current runtime does not expose
27
+ * `globalThis.crypto.randomUUID()`.
28
+ *
29
+ * @returns An ID generator that returns UUID strings from `nextId()`.
30
+ */
7
31
  export declare function createUuidIdGenerator(): IdGeneratorPort;
32
+ /**
33
+ * Create a deterministic sequence ID generator for tests and examples.
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * const ids = createSequenceIdGenerator({ prefix: "post", start: 10 });
38
+ * ids.nextId(); // "post_10"
39
+ * ids.nextId(); // "post_11"
40
+ * ```
41
+ *
42
+ * @param options - Optional ID prefix and starting sequence number.
43
+ * @returns A mutable sequence ID generator.
44
+ */
8
45
  export declare function createSequenceIdGenerator(options?: {
9
46
  prefix?: string;
10
47
  start?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"id-generator.d.ts","sourceRoot":"","sources":["../../src/ports/id-generator.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,MAAM,IAAI,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,uBAAwB,SAAQ,eAAe;IAC9D,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED,wBAAgB,qBAAqB,IAAI,eAAe,CAYvD;AAED,wBAAgB,yBAAyB,CACvC,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAO,GAChD,uBAAuB,CAWzB"}
1
+ {"version":3,"file":"id-generator.d.ts","sourceRoot":"","sources":["../../src/ports/id-generator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,MAAM,IAAI,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAwB,SAAQ,eAAe;IAC9D;;OAEG;IACH,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,IAAI,eAAe,CAYvD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAO,GAChD,uBAAuB,CAWzB"}
@@ -1,3 +1,12 @@
1
+ /**
2
+ * Create an ID generator backed by `globalThis.crypto.randomUUID()`.
3
+ *
4
+ * The factory itself does not read from `crypto`; the returned generator's
5
+ * `nextId()` method throws if the current runtime does not expose
6
+ * `globalThis.crypto.randomUUID()`.
7
+ *
8
+ * @returns An ID generator that returns UUID strings from `nextId()`.
9
+ */
1
10
  export function createUuidIdGenerator() {
2
11
  return {
3
12
  nextId: () => {
@@ -8,6 +17,19 @@ export function createUuidIdGenerator() {
8
17
  },
9
18
  };
10
19
  }
20
+ /**
21
+ * Create a deterministic sequence ID generator for tests and examples.
22
+ *
23
+ * @example
24
+ * ```ts
25
+ * const ids = createSequenceIdGenerator({ prefix: "post", start: 10 });
26
+ * ids.nextId(); // "post_10"
27
+ * ids.nextId(); // "post_11"
28
+ * ```
29
+ *
30
+ * @param options - Optional ID prefix and starting sequence number.
31
+ * @returns A mutable sequence ID generator.
32
+ */
11
33
  export function createSequenceIdGenerator(options = {}) {
12
34
  const prefix = options.prefix ?? "id";
13
35
  const start = options.start ?? 1;
@@ -1 +1 @@
1
- {"version":3,"file":"id-generator.js","sourceRoot":"","sources":["../../src/ports/id-generator.ts"],"names":[],"mappings":"AAQA,MAAM,UAAU,qBAAqB;IACnC,OAAO;QACL,MAAM,EAAE,GAAG,EAAE;YACX,IAAI,OAAO,UAAU,CAAC,MAAM,EAAE,UAAU,KAAK,UAAU,EAAE,CAAC;gBACxD,MAAM,IAAI,KAAK,CACb,kHAAkH,CACnH,CAAC;YACJ,CAAC;Y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E,EAAE;YACvB,IAAI,GAAG,KAAK,CAAC;QACf,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -10,6 +10,8 @@
10
10
  * - `EventBusPort` – interface for event bus implementations
11
11
  * - `JobDispatcherPort` – interface for job dispatch implementations
12
12
  * - `UnitOfWorkPort` – interface for app-owned transaction boundaries
13
+ * - `OutboxPort` – interface for durable event/job delivery storage
14
+ * - `IdempotencyPort` – interface for retry-safe command/key storage
13
15
  * - `AuthPort` – interface for request authentication implementations
14
16
  * - `AuditLogPort` – interface for audit/activity log implementations
15
17
  * - `ClockPort` – interface for deterministic time
@@ -21,7 +23,10 @@
21
23
  * - `StoragePort` – interface for object/file storage implementations
22
24
  *
23
25
  * Dedicated framework areas own their capability-specific APIs:
26
+ * - `@beignet/core/idempotency` owns idempotency helpers and test adapters
24
27
  * - `@beignet/core/mail` owns `MailerPort` and mail test adapters
28
+ * - `@beignet/core/notifications` owns notification helpers and test adapters
29
+ * - `@beignet/core/outbox` owns durable outbox helpers and test adapters
25
30
  * - `@beignet/core/schedules` owns scheduled task definitions and runners
26
31
  */
27
32
  /**
@@ -73,26 +78,104 @@ export declare function definePorts<P extends AnyPorts>(ports: P): P;
73
78
  export interface PortsContext<P extends AnyPorts = AnyPorts> {
74
79
  ports: P;
75
80
  }
81
+ /**
82
+ * Idempotency port exports.
83
+ */
84
+ export type { IdempotencyCompleteInput, IdempotencyFailInput, IdempotencyPort, IdempotencyReservation, IdempotencyReserveInput, } from "../idempotency";
85
+ /**
86
+ * Notification port exports.
87
+ */
88
+ export type { MemoryNotificationDelivery, MemoryNotificationPort, NotificationChannelResult, NotificationPort, SendNotificationOptions, SendNotificationResult, } from "../notifications";
89
+ /**
90
+ * Transactional outbox port exports.
91
+ */
92
+ export type { ClaimedOutboxMessage, OutboxClaimBatchOptions, OutboxEnqueueInput, OutboxMarkDeliveredInput, OutboxMarkFailedInput, OutboxMessage, OutboxMessageKind, OutboxMessageStatus, OutboxPort, } from "../outbox";
93
+ /**
94
+ * Audit log port exports.
95
+ */
76
96
  export type { ActivityActor, ActivityActorType, ActivityMetadata, ActivityMetadataValue, ActivityResource, ActivityTenant, AuditLogEntry, AuditLogEntryInput, AuditLogOptions, AuditLogPort, AuditOutcome, MemoryAuditLogPort, } from "./audit";
97
+ /**
98
+ * Audit log helper exports.
99
+ */
77
100
  export { createAnonymousActor, createMemoryAuditLog, createRedactedAuditLog, createServiceActor, createSystemActor, createTenant, createUserActor, normalizeAuditLogEntry, redactAuditLogEntry, } from "./audit";
101
+ /**
102
+ * Auth port exports.
103
+ */
78
104
  export type { AuthPort, AuthRequestLike, AuthSession, StaticAuthSessionFactory, } from "./auth";
105
+ /**
106
+ * Auth helper exports.
107
+ */
79
108
  export { AuthUnauthorizedError, createAnonymousAuth, createStaticAuth, } from "./auth";
109
+ /**
110
+ * Ports builder exports.
111
+ */
80
112
  export { createPortsBuilder, type PortsBuilder, type PortsOf, } from "./builder";
113
+ /**
114
+ * Cache port exports.
115
+ */
81
116
  export type { CachePort, CacheSetOptions } from "./cache";
117
+ /**
118
+ * Cache helper exports.
119
+ */
82
120
  export { createMemoryCache } from "./cache";
121
+ /**
122
+ * Clock port exports.
123
+ */
83
124
  export type { ClockPort, FrozenClockPort } from "./clock";
125
+ /**
126
+ * Clock helper exports.
127
+ */
84
128
  export { createFrozenClock, createSystemClock } from "./clock";
129
+ /**
130
+ * Event bus and job dispatcher port exports.
131
+ */
85
132
  export type { DomainEventDef, EventBusPort, InferEventPayload, InferJobPayload, JobDef, JobDispatcherPort, } from "./events";
133
+ /**
134
+ * ID generator port exports.
135
+ */
86
136
  export type { IdGeneratorPort, SequenceIdGeneratorPort } from "./id-generator";
137
+ /**
138
+ * ID generator helper exports.
139
+ */
87
140
  export { createSequenceIdGenerator, createUuidIdGenerator, } from "./id-generator";
141
+ /**
142
+ * Logger port exports.
143
+ */
88
144
  export type { LoggerPort, LogLevel, MemoryLogEntry, MemoryLoggerPort, } from "./logger";
145
+ /**
146
+ * Logger helper exports.
147
+ */
89
148
  export { createMemoryLogger, createNoopLogger } from "./logger";
149
+ /**
150
+ * Policy and authorization gate type exports.
151
+ */
90
152
  export type { BoundGate, CreateGateOptions, GateAllowedDecision, GateDecision, GateDeniedDecision, GateDenyHandler, GatePolicyResult, GatePort, PolicyContextFromDefinitions, PolicyDefinition, PolicyMapFromDefinitions, PolicyResolver, PolicySubjectArgs, } from "./policy";
153
+ /**
154
+ * Policy and authorization gate helper exports.
155
+ */
91
156
  export { allow, createGate, definePolicy, deny, GateAuthorizationError, } from "./policy";
157
+ /**
158
+ * Rate limit port exports.
159
+ */
92
160
  export type { RateLimitHitOptions, RateLimitPort, RateLimitResult, } from "./rate-limit";
161
+ /**
162
+ * Rate limit helper exports.
163
+ */
93
164
  export { createMemoryRateLimiter } from "./rate-limit";
165
+ /**
166
+ * Redaction helper exports.
167
+ */
94
168
  export { createRedactor, DEFAULT_CIRCULAR_VALUE, DEFAULT_REDACTED_VALUE, DEFAULT_SENSITIVE_KEY_TERMS, DEFAULT_SENSITIVE_KEYS, DEFAULT_TRUNCATED_VALUE, isSensitiveKey, type RedactableHeaders, type RedactionDecisionContext, type RedactionOptions, type Redactor, redactHeaders, redactValue, } from "./redaction";
169
+ /**
170
+ * Storage port exports.
171
+ */
95
172
  export type { MemoryStorageOptions, StorageBody, StorageMetadata, StorageObject, StorageObjectBody, StoragePort, StoragePutOptions, StorageVisibility, } from "./storage";
173
+ /**
174
+ * Storage helper exports.
175
+ */
96
176
  export { createMemoryStorage } from "./storage";
177
+ /**
178
+ * Unit of Work port exports.
179
+ */
97
180
  export { type BufferedDomainEventRecorder, createDomainEventRecorder, createNoopUnitOfWork, type DomainEventRecorderPort, type NoopUnitOfWorkOptions, type RecordedDomainEvent, type UnitOfWorkCallback, type UnitOfWorkPort, } from "./unit-of-work";
98
181
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ports/index.ts"],"names":[],"mappings":"AAA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O,EACL,KAAK,2BAA2B,EAChC,yBAAyB,EACzB,oBAAoB,EACpB,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,cAAc,GACpB,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ports/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH;;;;;;GAMG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,QAAQ,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAE3D;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,YAAY,CAAC,CAAC,SAAS,QAAQ,GAAG,QAAQ;IACzD,KAAK,EAAE,CAAC,CAAC;CACV;AAED;;GAEG;AACH,YAAY,EACV,wBAAwB,EACxB,oBAAoB,EACpB,eAAe,EACf,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,gBAAgB,CAAC;AACxB;;GAEG;AACH,YAAY,EACV,0BAA0B,EAC1B,sBAAsB,EACtB,yBAAyB,EACzB,gBAAgB,EAChB,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,kBAAkB,CAAC;AAC1B;;GAEG;AACH,YAAY,EACV,oBAAoB,EACpB,uBAAuB,EACvB,kBAAkB,EAClB,wBAAwB,EACxB,qBAAqB,EACrB,aAAa,EACb,iBAAiB,EACjB,mBAAmB,EACnB,UAAU,GACX,MAAM,WAAW,CAAC;AACnB;;GAEG;AACH,YAAY,EACV,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,qBAAqB,EACrB,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,kBAAkB,EAClB,eAAe,EACf,YAAY,EACZ,YAAY,EACZ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;GAEG;AACH,YAAY,EACV,SAAS,EACT,iBAAiB,EACjB,mBAAmB,EACnB,YAAY,EACZ,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,QAAQ,EACR,4BAA4B,EAC5B,gBAAgB,EAChB,wBAAwB,EACxB,cAAc,EACd,iBAAiB,GAClB,MAAM,UAAU,CAAC;AAClB;;GAEG;AACH,OAAO,EACL,KAAK,EACL,UAAU,EACV,YAAY,EACZ,IAAI,EACJ,sBAAsB,GACvB,MAAM,UAAU,CAAC;AAClB;;GAEG;AACH,YAAY,EACV,mBAAmB,EACnB,aAAa,EACb,eAAe,GAChB,MAAM,cAAc,CAAC;AACtB;;GAEG;AACH,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvD;;GAEG;AACH,OAAO,EACL,cAAc,EACd,sBAAsB,EACtB,sBAAsB,EACtB,2BAA2B,EAC3B,sBAAsB,EACtB,uBAAuB,EACvB,cAAc,EACd,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAC7B,KAAK,gBAAgB,EACrB,KAAK,QAAQ,EACb,aAAa,EACb,WAAW,GACZ,MAAM,aAAa,CAAC;AACrB;;GAEG;AACH,YAAY,EACV,oBAAoB,EACpB,WAAW,EACX,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,WAAW,CAAC;AACnB;;GAEG;AACH,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAChD;;GAEG;AACH,OAAO,EACL,KAAK,2BAA2B,EAChC,yBAAyB,EACzB,oBAAoB,EACpB,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,cAAc,GACpB,MAAM,gBAAgB,CAAC"}
@@ -10,6 +10,8 @@
10
10
  * - `EventBusPort` – interface for event bus implementations
11
11
  * - `JobDispatcherPort` – interface for job dispatch implementations
12
12
  * - `UnitOfWorkPort` – interface for app-owned transaction boundaries
13
+ * - `OutboxPort` – interface for durable event/job delivery storage
14
+ * - `IdempotencyPort` – interface for retry-safe command/key storage
13
15
  * - `AuthPort` – interface for request authentication implementations
14
16
  * - `AuditLogPort` – interface for audit/activity log implementations
15
17
  * - `ClockPort` – interface for deterministic time
@@ -21,7 +23,10 @@
21
23
  * - `StoragePort` – interface for object/file storage implementations
22
24
  *
23
25
  * Dedicated framework areas own their capability-specific APIs:
26
+ * - `@beignet/core/idempotency` owns idempotency helpers and test adapters
24
27
  * - `@beignet/core/mail` owns `MailerPort` and mail test adapters
28
+ * - `@beignet/core/notifications` owns notification helpers and test adapters
29
+ * - `@beignet/core/outbox` owns durable outbox helpers and test adapters
25
30
  * - `@beignet/core/schedules` owns scheduled task definitions and runners
26
31
  */
27
32
  /**
@@ -47,21 +52,52 @@
47
52
  export function definePorts(ports) {
48
53
  return ports;
49
54
  }
55
+ /**
56
+ * Audit log helper exports.
57
+ */
50
58
  export { createAnonymousActor, createMemoryAuditLog, createRedactedAuditLog, createServiceActor, createSystemActor, createTenant, createUserActor, normalizeAuditLogEntry, redactAuditLogEntry, } from "./audit";
59
+ /**
60
+ * Auth helper exports.
61
+ */
51
62
  export { AuthUnauthorizedError, createAnonymousAuth, createStaticAuth, } from "./auth";
52
- // Ports builder exports
63
+ /**
64
+ * Ports builder exports.
65
+ */
53
66
  export { createPortsBuilder, } from "./builder";
54
- // Cache port exports
67
+ /**
68
+ * Cache helper exports.
69
+ */
55
70
  export { createMemoryCache } from "./cache";
71
+ /**
72
+ * Clock helper exports.
73
+ */
56
74
  export { createFrozenClock, createSystemClock } from "./clock";
75
+ /**
76
+ * ID generator helper exports.
77
+ */
57
78
  export { createSequenceIdGenerator, createUuidIdGenerator, } from "./id-generator";
79
+ /**
80
+ * Logger helper exports.
81
+ */
58
82
  export { createMemoryLogger, createNoopLogger } from "./logger";
83
+ /**
84
+ * Policy and authorization gate helper exports.
85
+ */
59
86
  export { allow, createGate, definePolicy, deny, GateAuthorizationError, } from "./policy";
60
- // Rate limit port exports
87
+ /**
88
+ * Rate limit helper exports.
89
+ */
61
90
  export { createMemoryRateLimiter } from "./rate-limit";
62
- // Redaction exports
91
+ /**
92
+ * Redaction helper exports.
93
+ */
63
94
  export { createRedactor, DEFAULT_CIRCULAR_VALUE, DEFAULT_REDACTED_VALUE, DEFAULT_SENSITIVE_KEY_TERMS, DEFAULT_SENSITIVE_KEYS, DEFAULT_TRUNCATED_VALUE, isSensitiveKey, redactHeaders, redactValue, } from "./redaction";
95
+ /**
96
+ * Storage helper exports.
97
+ */
64
98
  export { createMemoryStorage } from "./storage";
65
- // Unit of Work exports
99
+ /**
100
+ * Unit of Work port exports.
101
+ */
66
102
  export { createDomainEventRecorder, createNoopUnitOfWork, } from "./unit-of-work";
67
103
  //# sourceMappingURL=index.js.map