@geekmidas/constructs 10.0.0-alpha.40 → 10.0.0-alpha.42

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 (196) hide show
  1. package/dist/{Cron-CMEGfRs8.d.cts → Cron-DI3nKoic.d.cts} +3 -2
  2. package/dist/Cron-DI3nKoic.d.cts.map +1 -0
  3. package/dist/{Cron-D6X4-xjB.d.mts → Cron-uYAHPnp7.d.mts} +3 -2
  4. package/dist/Cron-uYAHPnp7.d.mts.map +1 -0
  5. package/dist/{CronBuilder-DB35T5dL.cjs → CronBuilder-BoHzlWU_.cjs} +8 -3
  6. package/dist/CronBuilder-BoHzlWU_.cjs.map +1 -0
  7. package/dist/{CronBuilder-Dv0IlZs0.mjs → CronBuilder-CCgt0wCE.mjs} +9 -4
  8. package/dist/CronBuilder-CCgt0wCE.mjs.map +1 -0
  9. package/dist/{CronBuilder-O_gvButp.d.mts → CronBuilder-DaSUm2Na.d.mts} +5 -4
  10. package/dist/CronBuilder-DaSUm2Na.d.mts.map +1 -0
  11. package/dist/{CronBuilder-CEK7aOqD.d.cts → CronBuilder-g1lZLWyG.d.cts} +5 -4
  12. package/dist/CronBuilder-g1lZLWyG.d.cts.map +1 -0
  13. package/dist/{Endpoint-CQAeh1Rh.mjs → Endpoint-BDgmfml0.mjs} +2 -2
  14. package/dist/{Endpoint-CQAeh1Rh.mjs.map → Endpoint-BDgmfml0.mjs.map} +1 -1
  15. package/dist/{Endpoint-Dp5AKIXl.d.cts → Endpoint-BkzU6nn1.d.cts} +5 -4
  16. package/dist/Endpoint-BkzU6nn1.d.cts.map +1 -0
  17. package/dist/{Endpoint-DtI7heFm.d.mts → Endpoint-BpboleFh.d.mts} +5 -4
  18. package/dist/Endpoint-BpboleFh.d.mts.map +1 -0
  19. package/dist/{Endpoint-D1L9qu5C.cjs → Endpoint-wSCHSnqb.cjs} +2 -2
  20. package/dist/{Endpoint-D1L9qu5C.cjs.map → Endpoint-wSCHSnqb.cjs.map} +1 -1
  21. package/dist/{EndpointFactory-FeFRmlDZ.d.cts → EndpointFactory-BZZOleQT.d.cts} +4 -4
  22. package/dist/{EndpointFactory-CgMDvERK.d.mts.map → EndpointFactory-BZZOleQT.d.cts.map} +1 -1
  23. package/dist/{EndpointFactory-BBdNeaGJ.mjs → EndpointFactory-C9G2pz86.mjs} +3 -3
  24. package/dist/{EndpointFactory-BBdNeaGJ.mjs.map → EndpointFactory-C9G2pz86.mjs.map} +1 -1
  25. package/dist/{EndpointFactory-CgMDvERK.d.mts → EndpointFactory-DnNlYflU.d.mts} +4 -4
  26. package/dist/{EndpointFactory-FeFRmlDZ.d.cts.map → EndpointFactory-DnNlYflU.d.mts.map} +1 -1
  27. package/dist/{EndpointFactory-BZOCOaK6.cjs → EndpointFactory-G1g1kiqC.cjs} +3 -3
  28. package/dist/{EndpointFactory-BZOCOaK6.cjs.map → EndpointFactory-G1g1kiqC.cjs.map} +1 -1
  29. package/dist/Function-DuqGcbOI.d.mts +76 -0
  30. package/dist/Function-DuqGcbOI.d.mts.map +1 -0
  31. package/dist/Function-Pu-1kKZz.d.cts +76 -0
  32. package/dist/Function-Pu-1kKZz.d.cts.map +1 -0
  33. package/dist/{HonoEndpointAdaptor-Cq99r9H7.cjs → HonoEndpointAdaptor-CBoSm3TM.cjs} +3 -3
  34. package/dist/{HonoEndpointAdaptor-Cq99r9H7.cjs.map → HonoEndpointAdaptor-CBoSm3TM.cjs.map} +1 -1
  35. package/dist/{HonoEndpointAdaptor-Aui-x9Lg.mjs → HonoEndpointAdaptor-DL_fCB9O.mjs} +3 -3
  36. package/dist/{HonoEndpointAdaptor-Aui-x9Lg.mjs.map → HonoEndpointAdaptor-DL_fCB9O.mjs.map} +1 -1
  37. package/dist/{Queue-Ckmudcm8.cjs → Queue-D5jcw0mu.cjs} +6 -2
  38. package/dist/Queue-D5jcw0mu.cjs.map +1 -0
  39. package/dist/{Queue-YmvN2vEP.d.mts → Queue-DlsHRzUp.d.mts} +22 -10
  40. package/dist/Queue-DlsHRzUp.d.mts.map +1 -0
  41. package/dist/{Queue-CpQIGB_2.d.cts → Queue-HPyi0e1i.d.cts} +22 -10
  42. package/dist/Queue-HPyi0e1i.d.cts.map +1 -0
  43. package/dist/{Queue-C1uDgjxt.mjs → Queue-hwPN-t31.mjs} +6 -2
  44. package/dist/Queue-hwPN-t31.mjs.map +1 -0
  45. package/dist/{QueueBuilder-CJNcv4dy.cjs → QueueBuilder-BFQn3OzZ.cjs} +27 -4
  46. package/dist/QueueBuilder-BFQn3OzZ.cjs.map +1 -0
  47. package/dist/{QueueBuilder-XuPKZwKH.mjs → QueueBuilder-DCuYdjMw.mjs} +28 -5
  48. package/dist/QueueBuilder-DCuYdjMw.mjs.map +1 -0
  49. package/dist/{QueueBuilder-XEnnOWGe.d.cts → QueueBuilder-OSi6LkV9.d.cts} +24 -11
  50. package/dist/QueueBuilder-OSi6LkV9.d.cts.map +1 -0
  51. package/dist/{QueueBuilder-CM0WUxfw.d.mts → QueueBuilder-QHsnVt1P.d.mts} +24 -11
  52. package/dist/QueueBuilder-QHsnVt1P.d.mts.map +1 -0
  53. package/dist/{Subscriber-B91YSkZt.d.cts → Subscriber-Bpp02cGr.d.cts} +20 -9
  54. package/dist/Subscriber-Bpp02cGr.d.cts.map +1 -0
  55. package/dist/{Subscriber-BjHYe5hK.d.mts → Subscriber-CtN9R48-.d.mts} +20 -9
  56. package/dist/Subscriber-CtN9R48-.d.mts.map +1 -0
  57. package/dist/{SubscriberBuilder-Duk028pD.cjs → SubscriberBuilder-C2PwqwIl.cjs} +31 -3
  58. package/dist/SubscriberBuilder-C2PwqwIl.cjs.map +1 -0
  59. package/dist/{SubscriberBuilder-BhMphk4z.d.mts → SubscriberBuilder-CuCMFpYW.d.mts} +23 -11
  60. package/dist/SubscriberBuilder-CuCMFpYW.d.mts.map +1 -0
  61. package/dist/{SubscriberBuilder-DzQUWE08.mjs → SubscriberBuilder-DMFk_Ap1.mjs} +32 -4
  62. package/dist/SubscriberBuilder-DMFk_Ap1.mjs.map +1 -0
  63. package/dist/{SubscriberBuilder-BSpQX1JT.d.cts → SubscriberBuilder-g3fAVWgs.d.cts} +23 -11
  64. package/dist/SubscriberBuilder-g3fAVWgs.d.cts.map +1 -0
  65. package/dist/adaptors/aws.cjs +20 -4
  66. package/dist/adaptors/aws.cjs.map +1 -1
  67. package/dist/adaptors/aws.d.cts +17 -13
  68. package/dist/adaptors/aws.d.cts.map +1 -1
  69. package/dist/adaptors/aws.d.mts +17 -13
  70. package/dist/adaptors/aws.d.mts.map +1 -1
  71. package/dist/adaptors/aws.mjs +20 -4
  72. package/dist/adaptors/aws.mjs.map +1 -1
  73. package/dist/adaptors/hono.cjs +1 -1
  74. package/dist/adaptors/hono.d.cts +1 -1
  75. package/dist/adaptors/hono.d.mts +1 -1
  76. package/dist/adaptors/hono.mjs +1 -1
  77. package/dist/adaptors/testing.cjs +170 -13
  78. package/dist/adaptors/testing.cjs.map +1 -1
  79. package/dist/adaptors/testing.d.cts +38 -21
  80. package/dist/adaptors/testing.d.cts.map +1 -1
  81. package/dist/adaptors/testing.d.mts +38 -21
  82. package/dist/adaptors/testing.d.mts.map +1 -1
  83. package/dist/adaptors/testing.mjs +170 -13
  84. package/dist/adaptors/testing.mjs.map +1 -1
  85. package/dist/{auth-CMwml9QN.d.mts → auth-3OAmK42n.d.cts} +4 -4
  86. package/dist/{auth-CMwml9QN.d.mts.map → auth-3OAmK42n.d.cts.map} +1 -1
  87. package/dist/{auth-rVRDjIw_.d.cts → auth-BWbiewHa.d.mts} +4 -4
  88. package/dist/{auth-rVRDjIw_.d.cts.map → auth-BWbiewHa.d.mts.map} +1 -1
  89. package/dist/auth.d.cts +1 -1
  90. package/dist/auth.d.mts +1 -1
  91. package/dist/{cache-C9a_hVCc.d.cts → cache-CXh6GIgb.d.mts} +3 -3
  92. package/dist/{cache-C9a_hVCc.d.cts.map → cache-CXh6GIgb.d.mts.map} +1 -1
  93. package/dist/{cache-CeTMI8LR.d.mts → cache-DnGDGly3.d.cts} +3 -3
  94. package/dist/{cache-CeTMI8LR.d.mts.map → cache-DnGDGly3.d.cts.map} +1 -1
  95. package/dist/cache.d.cts +1 -1
  96. package/dist/cache.d.mts +1 -1
  97. package/dist/{construct-interface-_3zgxzXl.d.mts → construct-interface-B1AfqRl4.d.cts} +25 -3
  98. package/dist/{construct-interface-_3zgxzXl.d.mts.map → construct-interface-B1AfqRl4.d.cts.map} +1 -1
  99. package/dist/{construct-interface-_xi4BPN8.d.cts → construct-interface-DluK3_da.d.mts} +25 -3
  100. package/dist/{construct-interface-_xi4BPN8.d.cts.map → construct-interface-DluK3_da.d.mts.map} +1 -1
  101. package/dist/construct-interface.cjs +26 -0
  102. package/dist/construct-interface.cjs.map +1 -1
  103. package/dist/construct-interface.d.cts +2 -2
  104. package/dist/construct-interface.d.mts +2 -2
  105. package/dist/construct-interface.mjs +26 -1
  106. package/dist/construct-interface.mjs.map +1 -1
  107. package/dist/credential.d.cts +1 -1
  108. package/dist/credential.d.mts +1 -1
  109. package/dist/crons/index.cjs +1 -1
  110. package/dist/crons/index.d.cts +2 -2
  111. package/dist/crons/index.d.mts +2 -2
  112. package/dist/crons/index.mjs +1 -1
  113. package/dist/database/kysely.d.cts +1 -1
  114. package/dist/database/kysely.d.mts +1 -1
  115. package/dist/email.d.cts +1 -1
  116. package/dist/email.d.mts +1 -1
  117. package/dist/endpoints/index.cjs +3 -3
  118. package/dist/endpoints/index.d.cts +2 -2
  119. package/dist/endpoints/index.d.mts +2 -2
  120. package/dist/endpoints/index.mjs +3 -3
  121. package/dist/{external-api-DS3mujT5.d.mts → external-api-CWY9orcO.d.mts} +2 -2
  122. package/dist/{external-api-DS3mujT5.d.mts.map → external-api-CWY9orcO.d.mts.map} +1 -1
  123. package/dist/{external-api-LBfE-q3g.d.cts → external-api-D-5WB-sr.d.cts} +2 -2
  124. package/dist/{external-api-LBfE-q3g.d.cts.map → external-api-D-5WB-sr.d.cts.map} +1 -1
  125. package/dist/external-api.d.cts +1 -1
  126. package/dist/external-api.d.mts +1 -1
  127. package/dist/file-server.d.cts +1 -1
  128. package/dist/file-server.d.mts +1 -1
  129. package/dist/functions/index.cjs +1 -1
  130. package/dist/functions/index.d.cts +2 -1
  131. package/dist/functions/index.d.mts +2 -1
  132. package/dist/functions/index.mjs +1 -1
  133. package/dist/{functions-ZH60FE7H.cjs → functions-CbP5ZKma.cjs} +15 -3
  134. package/dist/functions-CbP5ZKma.cjs.map +1 -0
  135. package/dist/{functions-DCIfCRR-.mjs → functions-Di6n5ltG.mjs} +16 -4
  136. package/dist/{functions-DCIfCRR-.mjs.map → functions-Di6n5ltG.mjs.map} +1 -1
  137. package/dist/{index-B0kxstwf.d.cts → index-BuzRvKOQ.d.cts} +9 -71
  138. package/dist/index-BuzRvKOQ.d.cts.map +1 -0
  139. package/dist/{index-CjVEjOw0.d.mts → index-CTkKOer4.d.mts} +9 -71
  140. package/dist/index-CTkKOer4.d.mts.map +1 -0
  141. package/dist/{kysely-BJ8IQ_1P.d.mts → kysely-Bqov3fwv.d.mts} +3 -3
  142. package/dist/{kysely-BJ8IQ_1P.d.mts.map → kysely-Bqov3fwv.d.mts.map} +1 -1
  143. package/dist/{kysely-DVF8wOT4.d.cts → kysely-DTnkZsub.d.cts} +3 -3
  144. package/dist/{kysely-DVF8wOT4.d.cts.map → kysely-DTnkZsub.d.cts.map} +1 -1
  145. package/dist/mobile-app.d.cts +1 -1
  146. package/dist/mobile-app.d.mts +1 -1
  147. package/dist/object-storage.d.cts +1 -1
  148. package/dist/object-storage.d.mts +1 -1
  149. package/dist/queue/index.cjs +2 -2
  150. package/dist/queue/index.d.cts +2 -2
  151. package/dist/queue/index.d.mts +2 -2
  152. package/dist/queue/index.mjs +2 -2
  153. package/dist/rest-api.cjs +1 -1
  154. package/dist/rest-api.d.cts +3 -3
  155. package/dist/rest-api.d.mts +3 -3
  156. package/dist/rest-api.mjs +1 -1
  157. package/dist/site.d.cts +1 -1
  158. package/dist/site.d.mts +1 -1
  159. package/dist/subscribers/index.cjs +1 -1
  160. package/dist/subscribers/index.d.cts +2 -2
  161. package/dist/subscribers/index.d.mts +2 -2
  162. package/dist/subscribers/index.mjs +1 -1
  163. package/dist/worker.cjs +26 -10
  164. package/dist/worker.cjs.map +1 -1
  165. package/dist/worker.d.cts +38 -22
  166. package/dist/worker.d.cts.map +1 -1
  167. package/dist/worker.d.mts +38 -22
  168. package/dist/worker.d.mts.map +1 -1
  169. package/dist/worker.mjs +26 -10
  170. package/dist/worker.mjs.map +1 -1
  171. package/package.json +31 -31
  172. package/dist/Cron-CMEGfRs8.d.cts.map +0 -1
  173. package/dist/Cron-D6X4-xjB.d.mts.map +0 -1
  174. package/dist/CronBuilder-CEK7aOqD.d.cts.map +0 -1
  175. package/dist/CronBuilder-DB35T5dL.cjs.map +0 -1
  176. package/dist/CronBuilder-Dv0IlZs0.mjs.map +0 -1
  177. package/dist/CronBuilder-O_gvButp.d.mts.map +0 -1
  178. package/dist/Endpoint-Dp5AKIXl.d.cts.map +0 -1
  179. package/dist/Endpoint-DtI7heFm.d.mts.map +0 -1
  180. package/dist/Queue-C1uDgjxt.mjs.map +0 -1
  181. package/dist/Queue-Ckmudcm8.cjs.map +0 -1
  182. package/dist/Queue-CpQIGB_2.d.cts.map +0 -1
  183. package/dist/Queue-YmvN2vEP.d.mts.map +0 -1
  184. package/dist/QueueBuilder-CJNcv4dy.cjs.map +0 -1
  185. package/dist/QueueBuilder-CM0WUxfw.d.mts.map +0 -1
  186. package/dist/QueueBuilder-XEnnOWGe.d.cts.map +0 -1
  187. package/dist/QueueBuilder-XuPKZwKH.mjs.map +0 -1
  188. package/dist/Subscriber-B91YSkZt.d.cts.map +0 -1
  189. package/dist/Subscriber-BjHYe5hK.d.mts.map +0 -1
  190. package/dist/SubscriberBuilder-BSpQX1JT.d.cts.map +0 -1
  191. package/dist/SubscriberBuilder-BhMphk4z.d.mts.map +0 -1
  192. package/dist/SubscriberBuilder-Duk028pD.cjs.map +0 -1
  193. package/dist/SubscriberBuilder-DzQUWE08.mjs.map +0 -1
  194. package/dist/functions-ZH60FE7H.cjs.map +0 -1
  195. package/dist/index-B0kxstwf.d.cts.map +0 -1
  196. package/dist/index-CjVEjOw0.d.mts.map +0 -1
@@ -1,75 +1,11 @@
1
1
  import { t as StandardSchemaV1 } from "./index-CeEtxDmK.cjs";
2
- import { a as EventFor, c as Topic, n as ConstructType, o as TopicEvent, t as Construct } from "./Construct-BQALFCh2.cjs";
3
- import { c as ServicesOf, r as Consumable } from "./construct-interface-_xi4BPN8.cjs";
2
+ import { a as EventFor, c as Topic, n as ConstructType, o as TopicEvent } from "./Construct-BQALFCh2.cjs";
3
+ import { i as FunctionHandler, n as Function } from "./Function-Pu-1kKZz.cjs";
4
+ import { c as ServicesOf, r as Consumable } from "./construct-interface-B1AfqRl4.cjs";
4
5
  import { Logger } from "@geekmidas/logger";
5
6
  import { ComposableStandardSchema, InferComposableStandardSchema, InferStandardSchema } from "@geekmidas/schema";
6
- import { Service, ServiceRecord } from "@geekmidas/services";
7
- import { AuditStorage, AuditableAction, Auditor } from "@geekmidas/audit";
8
- //#region src/functions/Function.d.ts
9
- declare class Function<TInput extends ComposableStandardSchema | undefined = undefined, TServices extends Service[] = [], TLogger extends Logger = Logger, OutSchema extends StandardSchemaV1 | undefined = undefined, TAuditStorage extends AuditStorage | undefined = undefined, TAuditStorageServiceName extends string = string, TDatabase = undefined, TDatabaseServiceName extends string = string, TAuditAction extends AuditableAction<string, unknown> = AuditableAction<string, unknown>, Fn extends FunctionHandler<TInput, TServices, TLogger, OutSchema, TDatabase, TAuditStorage, TAuditAction> = FunctionHandler<TInput, TServices, TLogger, OutSchema, TDatabase, TAuditStorage, TAuditAction>> extends Construct<TLogger, OutSchema, TServices, TAuditStorageServiceName, TAuditStorage> {
10
- readonly fn: Fn;
11
- input?: TInput | undefined;
12
- databaseService?: Service<TDatabaseServiceName, TDatabase>;
13
- __IS_FUNCTION__: boolean;
14
- static isFunction(obj: any): obj is Function<any, any, any, any, any>;
15
- /**
16
- * Validates data against a StandardSchema.
17
- *
18
- * @param schema - The StandardSchema to validate against
19
- * @param data - The data to validate
20
- * @returns Validation result with value or issues
21
- */
22
- static validate<T extends StandardSchemaV1>(schema: T, data: unknown): Promise<StandardSchemaV1.Result<unknown>> | StandardSchemaV1.Result<unknown>;
23
- /**
24
- * Parses and validates data against a schema, throwing an error if validation fails.
25
- *
26
- * @param schema - The StandardSchema to validate against
27
- * @param data - The data to parse and validate
28
- * @returns The validated data with proper typing
29
- * @throws {UnprocessableEntityError} When validation fails
30
- */
31
- static parseSchema<T extends StandardSchemaV1>(schema: T, data: unknown): Promise<InferStandardSchema<T>>;
32
- /**
33
- * Parses and validates the endpoint output against the output schema.
34
- *
35
- * @param output - The raw output data to validate
36
- * @returns The validated output data
37
- * @throws {UnprocessableEntityError} When output validation fails
38
- */
39
- parseOutput(output: unknown): Promise<InferStandardSchema<OutSchema>>;
40
- constructor(fn: Fn, timeout?: number // Default timeout of 30 seconds
41
- , type?: ConstructType, input?: TInput | undefined, outputSchema?: OutSchema, services?: TServices, logger?: TLogger,
42
- /** What it publishes once its handler succeeds, each to its own topic. */
43
- events?: TopicEvent[], memorySize?: number, auditorStorageService?: Service<TAuditStorageServiceName, TAuditStorage>, databaseService?: Service<TDatabaseServiceName, TDatabase>,
44
- /**
45
- * The construct ids `.dependsOn()` named — last, so no existing positional
46
- * argument moves.
47
- */
48
- constructs?: string[]);
49
- }
50
- type FunctionHandler<TInput extends ComposableStandardSchema | undefined = undefined, TServices extends Service[] = [], TLogger extends Logger = Logger, OutSchema extends StandardSchemaV1 | undefined = undefined, TDatabase = undefined, TAuditStorage extends AuditStorage | undefined = undefined, TAuditAction extends AuditableAction<string, unknown> = AuditableAction<string, unknown>> = (ctx: FunctionContext<TInput, TServices, TLogger, TDatabase, TAuditStorage, TAuditAction>) => OutSchema extends StandardSchemaV1 ? InferStandardSchema<OutSchema> | Promise<InferStandardSchema<OutSchema>> : any | Promise<any>;
51
- /**
52
- * Conditional type that adds `db` property only when TDatabase is configured.
53
- */
54
- type DatabaseContext<TDatabase> = TDatabase extends undefined ? {} : {
55
- db: TDatabase;
56
- };
57
- /**
58
- * Conditional auditor context - only present when audit storage is configured.
59
- */
60
- type AuditorContext<TAuditAction extends AuditableAction<string, unknown> = AuditableAction<string, unknown>, TAuditStorage = undefined> = TAuditStorage extends undefined ? {} : {
61
- /**
62
- * Auditor instance for recording audit events.
63
- * Only present when audit storage is configured on the function.
64
- */
65
- auditor: Auditor<TAuditAction>;
66
- };
67
- type FunctionContext<Input extends ComposableStandardSchema | undefined = undefined, TServices extends Service[] = [], TLogger extends Logger = Logger, TDatabase = undefined, TAuditStorage extends AuditStorage | undefined = undefined, TAuditAction extends AuditableAction<string, unknown> = AuditableAction<string, unknown>> = {
68
- services: ServiceRecord<TServices>;
69
- logger: TLogger;
70
- input: InferComposableStandardSchema<Input>;
71
- } & DatabaseContext<TDatabase> & AuditorContext<TAuditAction, TAuditStorage>;
72
- //#endregion
7
+ import { Service } from "@geekmidas/services";
8
+ import { AuditStorage, AuditableAction } from "@geekmidas/audit";
73
9
  //#region src/functions/BaseFunctionBuilder.d.ts
74
10
  declare abstract class BaseFunctionBuilder<TInput extends ComposableStandardSchema, OutSchema extends StandardSchemaV1 | undefined = undefined, TServices extends Service[] = [], TLogger extends Logger = Logger, TAuditStorage extends AuditStorage | undefined = undefined, TAuditStorageServiceName extends string = string, TDatabase = undefined, TDatabaseServiceName extends string = string> {
75
11
  type: ConstructType;
@@ -106,6 +42,8 @@ declare abstract class BaseFunctionBuilder<TInput extends ComposableStandardSche
106
42
  _events: TopicEvent[];
107
43
  protected _auditorStorage?: Service<TAuditStorageServiceName, TAuditStorage>;
108
44
  protected _databaseService?: Service<TDatabaseServiceName, TDatabase>;
45
+ /** The edge `.database()` added, so the next one can replace it. */
46
+ protected _databaseEdge?: string;
109
47
  static isStandardSchemaV1(s: unknown): s is StandardSchemaV1;
110
48
  static parseComposableStandardSchema<T extends ComposableStandardSchema | undefined>(data: unknown, schema: T): Promise<InferComposableStandardSchema<T>>;
111
49
  constructor(type?: ConstructType);
@@ -173,5 +111,5 @@ declare class FunctionBuilder<TInput extends ComposableStandardSchema, OutSchema
173
111
  handle(fn: FunctionHandler<TInput, TServices, TLogger, OutSchema, TDatabase, TAuditStorage, TAuditAction>): Function<TInput, TServices, TLogger, OutSchema, TAuditStorage, TAuditStorageServiceName, TDatabase, TDatabaseServiceName, TAuditAction, FunctionHandler<TInput, TServices, TLogger, OutSchema, TDatabase, TAuditStorage, TAuditAction>>;
174
112
  }
175
113
  //#endregion
176
- export { FunctionHandler as a, FunctionContext as i, BaseFunctionBuilder as n, Function as r, FunctionBuilder as t };
177
- //# sourceMappingURL=index-B0kxstwf.d.cts.map
114
+ export { BaseFunctionBuilder as n, FunctionBuilder as t };
115
+ //# sourceMappingURL=index-BuzRvKOQ.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-BuzRvKOQ.d.cts","names":[],"sources":["../src/functions/BaseFunctionBuilder.ts","../src/functions/FunctionBuilder.ts"],"mappings":";;;;;;;;;uBAsBsB,oBACrB,eAAe,0BACf,kBAAkB,0CAClB,kBAAkB,gBAClB,gBAAgB,SAAS,QACzB,sBAAsB,sCACtB,kDACA,uBACA;EAoFmB,MAAI;YAlFb,cAAc;YACd,eAAe;YACf;EAEH,WAAW;;;;;;;;;EASX;EACA,SAAS;;;;;;;EAQT;;;;;;;;EASA;;EAGA,SAAS;YACN,kBAAkB,QAAQ,0BAA0B;YACpD,mBAAmB,QAAQ,sBAAsB;;YAEjD;SAEH,mBAAmB,aAAa,KAAK;SAM/B,8BACZ,UAAU,sCACT,eAAe,QAAQ,IAAI,QAAQ,8BAA8B;EAkCnE,YAAmB,OAAI;WAEd,SAAS,UAAU,WAAW,UAAU;WAExC,OAAO,UAAU,QAAQ,QAAQ;EAE1C,QAAQ;WAIC,OAAO,UAAU,kBAAkB,QAAQ;WAE3C,MAAM,UAAU,0BAA0B,QA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AU,qCAAqC,gBACtD,QACA,WACA,WACA,SACA,eACA,0BACA,WACA,sBACA;;;;;EAmBQ,SAAS,GAAG,sBACpB,QAAQ,WAAW,OAAO,KAAK,QAAQ,OAAO,KAC5C,gBACF,QACA,WACA,WACA,SACA,eACA,0BACA,GACA,OACA;EAkCD,OACC,IAAI,gBACH,QACA,WACA,SACA,WACA,WACA,eACA,gBAEC,SACF,QACA,WACA,SACA,WACA,eACA,0BACA,WACA,sBACA,cACA,gBACC,QACA,WACA,SACA,WACA,WACA,eACA"}
@@ -1,75 +1,11 @@
1
1
  import { t as StandardSchemaV1 } from "./index-CeEtxDmK.mjs";
2
- import { a as EventFor, c as Topic, n as ConstructType, o as TopicEvent, t as Construct } from "./Construct-QXnl3VqT.mjs";
3
- import { c as ServicesOf, r as Consumable } from "./construct-interface-_3zgxzXl.mjs";
4
- import { Service, ServiceRecord } from "@geekmidas/services";
5
- import { AuditStorage, AuditableAction, Auditor } from "@geekmidas/audit";
2
+ import { a as EventFor, c as Topic, n as ConstructType, o as TopicEvent } from "./Construct-QXnl3VqT.mjs";
3
+ import { i as FunctionHandler, n as Function } from "./Function-DuqGcbOI.mjs";
4
+ import { c as ServicesOf, r as Consumable } from "./construct-interface-DluK3_da.mjs";
5
+ import { Service } from "@geekmidas/services";
6
+ import { AuditStorage, AuditableAction } from "@geekmidas/audit";
6
7
  import { Logger } from "@geekmidas/logger";
7
8
  import { ComposableStandardSchema, InferComposableStandardSchema, InferStandardSchema } from "@geekmidas/schema";
8
- //#region src/functions/Function.d.ts
9
- declare class Function<TInput extends ComposableStandardSchema | undefined = undefined, TServices extends Service[] = [], TLogger extends Logger = Logger, OutSchema extends StandardSchemaV1 | undefined = undefined, TAuditStorage extends AuditStorage | undefined = undefined, TAuditStorageServiceName extends string = string, TDatabase = undefined, TDatabaseServiceName extends string = string, TAuditAction extends AuditableAction<string, unknown> = AuditableAction<string, unknown>, Fn extends FunctionHandler<TInput, TServices, TLogger, OutSchema, TDatabase, TAuditStorage, TAuditAction> = FunctionHandler<TInput, TServices, TLogger, OutSchema, TDatabase, TAuditStorage, TAuditAction>> extends Construct<TLogger, OutSchema, TServices, TAuditStorageServiceName, TAuditStorage> {
10
- readonly fn: Fn;
11
- input?: TInput | undefined;
12
- databaseService?: Service<TDatabaseServiceName, TDatabase>;
13
- __IS_FUNCTION__: boolean;
14
- static isFunction(obj: any): obj is Function<any, any, any, any, any>;
15
- /**
16
- * Validates data against a StandardSchema.
17
- *
18
- * @param schema - The StandardSchema to validate against
19
- * @param data - The data to validate
20
- * @returns Validation result with value or issues
21
- */
22
- static validate<T extends StandardSchemaV1>(schema: T, data: unknown): Promise<StandardSchemaV1.Result<unknown>> | StandardSchemaV1.Result<unknown>;
23
- /**
24
- * Parses and validates data against a schema, throwing an error if validation fails.
25
- *
26
- * @param schema - The StandardSchema to validate against
27
- * @param data - The data to parse and validate
28
- * @returns The validated data with proper typing
29
- * @throws {UnprocessableEntityError} When validation fails
30
- */
31
- static parseSchema<T extends StandardSchemaV1>(schema: T, data: unknown): Promise<InferStandardSchema<T>>;
32
- /**
33
- * Parses and validates the endpoint output against the output schema.
34
- *
35
- * @param output - The raw output data to validate
36
- * @returns The validated output data
37
- * @throws {UnprocessableEntityError} When output validation fails
38
- */
39
- parseOutput(output: unknown): Promise<InferStandardSchema<OutSchema>>;
40
- constructor(fn: Fn, timeout?: number // Default timeout of 30 seconds
41
- , type?: ConstructType, input?: TInput | undefined, outputSchema?: OutSchema, services?: TServices, logger?: TLogger,
42
- /** What it publishes once its handler succeeds, each to its own topic. */
43
- events?: TopicEvent[], memorySize?: number, auditorStorageService?: Service<TAuditStorageServiceName, TAuditStorage>, databaseService?: Service<TDatabaseServiceName, TDatabase>,
44
- /**
45
- * The construct ids `.dependsOn()` named — last, so no existing positional
46
- * argument moves.
47
- */
48
- constructs?: string[]);
49
- }
50
- type FunctionHandler<TInput extends ComposableStandardSchema | undefined = undefined, TServices extends Service[] = [], TLogger extends Logger = Logger, OutSchema extends StandardSchemaV1 | undefined = undefined, TDatabase = undefined, TAuditStorage extends AuditStorage | undefined = undefined, TAuditAction extends AuditableAction<string, unknown> = AuditableAction<string, unknown>> = (ctx: FunctionContext<TInput, TServices, TLogger, TDatabase, TAuditStorage, TAuditAction>) => OutSchema extends StandardSchemaV1 ? InferStandardSchema<OutSchema> | Promise<InferStandardSchema<OutSchema>> : any | Promise<any>;
51
- /**
52
- * Conditional type that adds `db` property only when TDatabase is configured.
53
- */
54
- type DatabaseContext<TDatabase> = TDatabase extends undefined ? {} : {
55
- db: TDatabase;
56
- };
57
- /**
58
- * Conditional auditor context - only present when audit storage is configured.
59
- */
60
- type AuditorContext<TAuditAction extends AuditableAction<string, unknown> = AuditableAction<string, unknown>, TAuditStorage = undefined> = TAuditStorage extends undefined ? {} : {
61
- /**
62
- * Auditor instance for recording audit events.
63
- * Only present when audit storage is configured on the function.
64
- */
65
- auditor: Auditor<TAuditAction>;
66
- };
67
- type FunctionContext<Input extends ComposableStandardSchema | undefined = undefined, TServices extends Service[] = [], TLogger extends Logger = Logger, TDatabase = undefined, TAuditStorage extends AuditStorage | undefined = undefined, TAuditAction extends AuditableAction<string, unknown> = AuditableAction<string, unknown>> = {
68
- services: ServiceRecord<TServices>;
69
- logger: TLogger;
70
- input: InferComposableStandardSchema<Input>;
71
- } & DatabaseContext<TDatabase> & AuditorContext<TAuditAction, TAuditStorage>;
72
- //#endregion
73
9
  //#region src/functions/BaseFunctionBuilder.d.ts
74
10
  declare abstract class BaseFunctionBuilder<TInput extends ComposableStandardSchema, OutSchema extends StandardSchemaV1 | undefined = undefined, TServices extends Service[] = [], TLogger extends Logger = Logger, TAuditStorage extends AuditStorage | undefined = undefined, TAuditStorageServiceName extends string = string, TDatabase = undefined, TDatabaseServiceName extends string = string> {
75
11
  type: ConstructType;
@@ -106,6 +42,8 @@ declare abstract class BaseFunctionBuilder<TInput extends ComposableStandardSche
106
42
  _events: TopicEvent[];
107
43
  protected _auditorStorage?: Service<TAuditStorageServiceName, TAuditStorage>;
108
44
  protected _databaseService?: Service<TDatabaseServiceName, TDatabase>;
45
+ /** The edge `.database()` added, so the next one can replace it. */
46
+ protected _databaseEdge?: string;
109
47
  static isStandardSchemaV1(s: unknown): s is StandardSchemaV1;
110
48
  static parseComposableStandardSchema<T extends ComposableStandardSchema | undefined>(data: unknown, schema: T): Promise<InferComposableStandardSchema<T>>;
111
49
  constructor(type?: ConstructType);
@@ -173,5 +111,5 @@ declare class FunctionBuilder<TInput extends ComposableStandardSchema, OutSchema
173
111
  handle(fn: FunctionHandler<TInput, TServices, TLogger, OutSchema, TDatabase, TAuditStorage, TAuditAction>): Function<TInput, TServices, TLogger, OutSchema, TAuditStorage, TAuditStorageServiceName, TDatabase, TDatabaseServiceName, TAuditAction, FunctionHandler<TInput, TServices, TLogger, OutSchema, TDatabase, TAuditStorage, TAuditAction>>;
174
112
  }
175
113
  //#endregion
176
- export { FunctionHandler as a, FunctionContext as i, BaseFunctionBuilder as n, Function as r, FunctionBuilder as t };
177
- //# sourceMappingURL=index-CjVEjOw0.d.mts.map
114
+ export { BaseFunctionBuilder as n, FunctionBuilder as t };
115
+ //# sourceMappingURL=index-CTkKOer4.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-CTkKOer4.d.mts","names":[],"sources":["../src/functions/BaseFunctionBuilder.ts","../src/functions/FunctionBuilder.ts"],"mappings":";;;;;;;;;uBAsBsB,oBACrB,eAAe,0BACf,kBAAkB,0CAClB,kBAAkB,gBAClB,gBAAgB,SAAS,QACzB,sBAAsB,sCACtB,kDACA,uBACA;EAoFmB,MAAI;YAlFb,cAAc;YACd,eAAe;YACf;EAEH,WAAW;;;;;;;;;EASX;EACA,SAAS;;;;;;;EAQT;;;;;;;;EASA;;EAGA,SAAS;YACN,kBAAkB,QAAQ,0BAA0B;YACpD,mBAAmB,QAAQ,sBAAsB;;YAEjD;SAEH,mBAAmB,aAAa,KAAK;SAM/B,8BACZ,UAAU,sCACT,eAAe,QAAQ,IAAI,QAAQ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ACA,eACI,WAAW,oBACf,SACA,eACA,0BACA,WACA,sBACA;EAeQ,QAAQ,UAAU,cAAc,sBACxC,SAAS,QAAQ,OAAO,KACtB,gBACF,QACA,WACA,WACA,SACA,GACA,OACA,WACA,sBACA;;;;;EAwBD,QAAQ,UAAU,qCAAqC,gBACtD,QACA,WACA,WACA,SACA,eACA,0BACA,WACA,sBACA;;;;;EAmBQ,SAAS,GAAG,sBACpB,QAAQ,WAAW,OAAO,KAAK,QAAQ,OAAO,KAC5C,gBACF,QACA,WACA,WACA,SACA,eACA,0BACA,GACA,OACA;EAkCD,OACC,IAAI,gBACH,QACA,WACA,SACA,WACA,WACA,eACA,gBAEC,SACF,QACA,WACA,SACA,WACA,eACA,0BACA,WACA,sBACA,cACA,gBACC,QACA,WACA,SACA,WACA,WACA,eACA"}
@@ -1,5 +1,5 @@
1
- import { n as Construct } from "./construct-interface-_3zgxzXl.mjs";
2
- import { t as Cache } from "./cache-CeTMI8LR.mjs";
1
+ import { n as Construct } from "./construct-interface-DluK3_da.mjs";
2
+ import { t as Cache } from "./cache-CXh6GIgb.mjs";
3
3
  import { ConstructName, Declaration, PostgresVersion } from "@geekmidas/manifest";
4
4
  import { Kysely, KyselyConfig } from "kysely";
5
5
  import { Service } from "@geekmidas/services";
@@ -156,4 +156,4 @@ declare class KyselyDatabase<DB = unknown, TName extends string = string> implem
156
156
  type ReadOnlyDatabase<DB, TName extends string> = Omit<KyselyDatabase<DB, TName>, 'reader' | 'cache' | 'schema'>;
157
157
  //#endregion
158
158
  export { KyselyDatabaseOptions as n, ReadOnlyDatabase as r, KyselyDatabase as t };
159
- //# sourceMappingURL=kysely-BJ8IQ_1P.d.mts.map
159
+ //# sourceMappingURL=kysely-Bqov3fwv.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"kysely-BJ8IQ_1P.d.mts","names":[],"sources":["../src/database/kysely.ts"],"mappings":";;;;;;;;;;;;;;;UAwCiB,8BAA8B,KAAK;;;;;;;;EAQnD;;;;;;;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,UAAU;;;;;;;;;;;;;MAoBxB,SAAS,WAAW,aAAa,eAAe,OAAO;;;;;;;;;MAgBvD,gBAAgB,KAAK;UAaX;;;;;;;;;;;;;;;;;;;KA6DH,iBAAiB,IAAI,wBAAwB,KACxD,eAAe,IAAI"}
@@ -1,5 +1,5 @@
1
- import { n as Construct } from "./construct-interface-_xi4BPN8.cjs";
2
- import { t as Cache } from "./cache-C9a_hVCc.cjs";
1
+ import { n as Construct } from "./construct-interface-B1AfqRl4.cjs";
2
+ import { t as Cache } from "./cache-DnGDGly3.cjs";
3
3
  import { Service } from "@geekmidas/services";
4
4
  import { ConstructName, Declaration, PostgresVersion } from "@geekmidas/manifest";
5
5
  import { Kysely, KyselyConfig } from "kysely";
@@ -156,4 +156,4 @@ declare class KyselyDatabase<DB = unknown, TName extends string = string> implem
156
156
  type ReadOnlyDatabase<DB, TName extends string> = Omit<KyselyDatabase<DB, TName>, 'reader' | 'cache' | 'schema'>;
157
157
  //#endregion
158
158
  export { KyselyDatabaseOptions as n, ReadOnlyDatabase as r, KyselyDatabase as t };
159
- //# sourceMappingURL=kysely-DVF8wOT4.d.cts.map
159
+ //# sourceMappingURL=kysely-DTnkZsub.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"kysely-DVF8wOT4.d.cts","names":[],"sources":["../src/database/kysely.ts"],"mappings":";;;;;;;;;;;;;;;UAwCiB,8BAA8B,KAAK;;;;;;;;EAQnD;;;;;;;;EAQA;;;;;;;;;;;EAWA,UAAU;;;UAID;EACT;EACA;EACA;;;;;;;;;cAUY,eAAe,cAAc,0CAC9B,UAAU,OAAO,OAAO;mBAiBjB;WAfT,IAAI;WACJ,SAAS,QAAQ,aAAa,QAAQ,OAAO;;;;;mBAMrC;mBACA;mBACA;mBACA;mBACA;EAEjB,YACC,IAAI,cAAc,QACD,UAAS,uBAC1B,cAAc;EAyBf,WAAW;;;;;;;;;;;;;EAqDX,UAAU,iBAAiB,OAAO;;;;;;;;;;;;;;;;;;EAyBlC,MAAM,2BAA2B,cAChC,KAAI,cAAc,SAClB;IAAW;MACT,MAAM;;;;;;;;;EAeT,OAAO,UAAU,wBAChB,IAAI,cAAc,UAClB,UAAS,wBACP,eAAe,UAAU;;;;;;;;;;;;;MAoBxB,SAAS,WAAW,aAAa,eAAe,OAAO;;;;;;;;;MAgBvD,gBAAgB,KAAK;UAaX;;;;;;;;;;;;;;;;;;;KA6DH,iBAAiB,IAAI,wBAAwB,KACxD,eAAe,IAAI"}
1
+ {"version":3,"file":"kysely-DTnkZsub.d.cts","names":[],"sources":["../src/database/kysely.ts"],"mappings":";;;;;;;;;;;;;;;UAwCiB,8BAA8B,KAAK;;;;;;;;EAQnD;;;;;;;;EAQA;;;;;;;;;;;EAWA,UAAU;;;UAID;EACT;EACA;EACA;;;;;;;;;cAUY,eAAe,cAAc,0CAC9B,UAAU,OAAO,OAAO;mBAiBjB;WAfT,IAAI;WACJ,SAAS,QAAQ,aAAa,QAAQ,OAAO;;;;;mBAMrC;mBACA;mBACA;mBACA;mBACA;EAEjB,YACC,IAAI,cAAc,QACD,UAAS,uBAC1B,cAAc;EAyBf,WAAW;;;;;;;;;;;;;EAqDX,UAAU,iBAAiB,OAAO;;;;;;;;;;;;;;;;;;EAyBlC,MAAM,2BAA2B,cAChC,KAAI,cAAc,SAClB;IAAW;MACT,MAAM;;;;;;;;;EAeT,OAAO,UAAU,wBAChB,IAAI,cAAc,UAClB,UAAS,wBACP,eAAe,UAAU;;;;;;;;;;;;;MAoBxB,SAAS,WAAW,aAAa,eAAe,OAAO;;;;;;;;;MAgBvD,gBAAgB,KAAK;UAaX;;;;;;;;;;;;;;;;;;;KA6DH,iBAAiB,IAAI,wBAAwB,KACxD,eAAe,IAAI"}
@@ -1,4 +1,4 @@
1
- import { i as Declarable } from "./construct-interface-_xi4BPN8.cjs";
1
+ import { i as Declarable } from "./construct-interface-B1AfqRl4.cjs";
2
2
  import { ConstructName, Declaration, Dependency, MobileAppDeclaration } from "@geekmidas/manifest";
3
3
  //#region src/mobile-app.d.ts
4
4
  export interface MobileAppConfig {
@@ -1,4 +1,4 @@
1
- import { i as Declarable } from "./construct-interface-_3zgxzXl.mjs";
1
+ import { i as Declarable } from "./construct-interface-DluK3_da.mjs";
2
2
  import { ConstructName, Declaration, Dependency, MobileAppDeclaration } from "@geekmidas/manifest";
3
3
  //#region src/mobile-app.d.ts
4
4
  export interface MobileAppConfig {
@@ -1,4 +1,4 @@
1
- import { n as Construct } from "./construct-interface-_xi4BPN8.cjs";
1
+ import { n as Construct } from "./construct-interface-B1AfqRl4.cjs";
2
2
  import { Service } from "@geekmidas/services";
3
3
  import { ConstructName, Declaration } from "@geekmidas/manifest";
4
4
  import { StorageClient } from "@geekmidas/storage";
@@ -1,4 +1,4 @@
1
- import { n as Construct } from "./construct-interface-_3zgxzXl.mjs";
1
+ import { n as Construct } from "./construct-interface-DluK3_da.mjs";
2
2
  import { ConstructName, Declaration } from "@geekmidas/manifest";
3
3
  import { StorageClient } from "@geekmidas/storage";
4
4
  import { Service } from "@geekmidas/services";
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_Queue = require("../Queue-Ckmudcm8.cjs");
3
- const require_QueueBuilder = require("../QueueBuilder-CJNcv4dy.cjs");
2
+ const require_Queue = require("../Queue-D5jcw0mu.cjs");
3
+ const require_QueueBuilder = require("../QueueBuilder-BFQn3OzZ.cjs");
4
4
  exports.Queue = require_Queue.Queue;
5
5
  exports.QueueNeedsMessage = require_QueueBuilder.QueueNeedsMessage;
6
6
  exports.QueueNeedsName = require_QueueBuilder.QueueNeedsName;
@@ -1,3 +1,3 @@
1
- import { i as QueueMessage, n as QueueContext, r as QueueHandler, t as Queue } from "../Queue-CpQIGB_2.cjs";
2
- import { n as QueueNeedsMessage, r as QueueNeedsName } from "../QueueBuilder-XEnnOWGe.cjs";
1
+ import { i as QueueMessage, n as QueueContext, r as QueueHandler, t as Queue } from "../Queue-HPyi0e1i.cjs";
2
+ import { n as QueueNeedsMessage, r as QueueNeedsName } from "../QueueBuilder-OSi6LkV9.cjs";
3
3
  export { Queue, type QueueContext, type QueueHandler, type QueueMessage, QueueNeedsMessage, QueueNeedsName };
@@ -1,3 +1,3 @@
1
- import { i as QueueMessage, n as QueueContext, r as QueueHandler, t as Queue } from "../Queue-YmvN2vEP.mjs";
2
- import { n as QueueNeedsMessage, r as QueueNeedsName } from "../QueueBuilder-CM0WUxfw.mjs";
1
+ import { i as QueueMessage, n as QueueContext, r as QueueHandler, t as Queue } from "../Queue-DlsHRzUp.mjs";
2
+ import { n as QueueNeedsMessage, r as QueueNeedsName } from "../QueueBuilder-QHsnVt1P.mjs";
3
3
  export { Queue, type QueueContext, type QueueHandler, type QueueMessage, QueueNeedsMessage, QueueNeedsName };
@@ -1,3 +1,3 @@
1
- import { t as Queue } from "../Queue-C1uDgjxt.mjs";
2
- import { n as QueueNeedsMessage, r as QueueNeedsName } from "../QueueBuilder-XuPKZwKH.mjs";
1
+ import { t as Queue } from "../Queue-hwPN-t31.mjs";
2
+ import { n as QueueNeedsMessage, r as QueueNeedsName } from "../QueueBuilder-DCuYdjMw.mjs";
3
3
  export { Queue, QueueNeedsMessage, QueueNeedsName };
package/dist/rest-api.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_construct_interface = require("./construct-interface.cjs");
3
- const require_EndpointFactory = require("./EndpointFactory-BZOCOaK6.cjs");
3
+ const require_EndpointFactory = require("./EndpointFactory-G1g1kiqC.cjs");
4
4
  const require_surfaceEnv = require("./surfaceEnv-CNimK76p.cjs");
5
5
  let _geekmidas_manifest = require("@geekmidas/manifest");
6
6
  let _geekmidas_logger_console = require("@geekmidas/logger/console");
@@ -1,6 +1,6 @@
1
- import { i as Declarable, t as Authenticator } from "./construct-interface-_xi4BPN8.cjs";
2
- import { T as BuiltInSecuritySchemeId } from "./Endpoint-Dp5AKIXl.cjs";
3
- import { t as EndpointFactory } from "./EndpointFactory-FeFRmlDZ.cjs";
1
+ import { i as Declarable, t as Authenticator } from "./construct-interface-B1AfqRl4.cjs";
2
+ import { T as BuiltInSecuritySchemeId } from "./Endpoint-BkzU6nn1.cjs";
3
+ import { t as EndpointFactory } from "./EndpointFactory-BZZOleQT.cjs";
4
4
  import { EnvironmentParser } from "@geekmidas/envkit";
5
5
  import { Logger } from "@geekmidas/logger";
6
6
  import { ConstructName, Declaration, Dependency } from "@geekmidas/manifest";
@@ -1,6 +1,6 @@
1
- import { i as Declarable, t as Authenticator } from "./construct-interface-_3zgxzXl.mjs";
2
- import { T as BuiltInSecuritySchemeId } from "./Endpoint-DtI7heFm.mjs";
3
- import { t as EndpointFactory } from "./EndpointFactory-CgMDvERK.mjs";
1
+ import { i as Declarable, t as Authenticator } from "./construct-interface-DluK3_da.mjs";
2
+ import { T as BuiltInSecuritySchemeId } from "./Endpoint-BpboleFh.mjs";
3
+ import { t as EndpointFactory } from "./EndpointFactory-DnNlYflU.mjs";
4
4
  import { ConstructName, Declaration, Dependency } from "@geekmidas/manifest";
5
5
  import { EnvironmentParser } from "@geekmidas/envkit";
6
6
  import { Logger } from "@geekmidas/logger";
package/dist/rest-api.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { edgeTo } from "./construct-interface.mjs";
2
- import { o as getSecurityScheme, t as EndpointFactory } from "./EndpointFactory-BBdNeaGJ.mjs";
2
+ import { o as getSecurityScheme, t as EndpointFactory } from "./EndpointFactory-C9G2pz86.mjs";
3
3
  import { n as envParserFor } from "./surfaceEnv-wMT5QzgZ.mjs";
4
4
  import { canonicalId, provideKey } from "@geekmidas/manifest";
5
5
  import { DEFAULT_LOGGER } from "@geekmidas/logger/console";
package/dist/site.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { i as Declarable } from "./construct-interface-_xi4BPN8.cjs";
1
+ import { i as Declarable } from "./construct-interface-B1AfqRl4.cjs";
2
2
  import { ConstructName, Declaration, Dependency, SiteDeclaration } from "@geekmidas/manifest";
3
3
  //#region src/site.d.ts
4
4
  /**
package/dist/site.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { i as Declarable } from "./construct-interface-_3zgxzXl.mjs";
1
+ import { i as Declarable } from "./construct-interface-DluK3_da.mjs";
2
2
  import { ConstructName, Declaration, Dependency, SiteDeclaration } from "@geekmidas/manifest";
3
3
  //#region src/site.d.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_SubscriberBuilder = require("../SubscriberBuilder-Duk028pD.cjs");
2
+ const require_SubscriberBuilder = require("../SubscriberBuilder-C2PwqwIl.cjs");
3
3
  exports.Subscriber = require_SubscriberBuilder.Subscriber;
4
4
  exports.SubscriberBuilder = require_SubscriberBuilder.SubscriberBuilder;
@@ -1,3 +1,3 @@
1
- import { t as Subscriber } from "../Subscriber-B91YSkZt.cjs";
2
- import { t as SubscriberBuilder } from "../SubscriberBuilder-BSpQX1JT.cjs";
1
+ import { t as Subscriber } from "../Subscriber-Bpp02cGr.cjs";
2
+ import { t as SubscriberBuilder } from "../SubscriberBuilder-g3fAVWgs.cjs";
3
3
  export { Subscriber, SubscriberBuilder };
@@ -1,3 +1,3 @@
1
- import { t as Subscriber } from "../Subscriber-BjHYe5hK.mjs";
2
- import { t as SubscriberBuilder } from "../SubscriberBuilder-BhMphk4z.mjs";
1
+ import { t as Subscriber } from "../Subscriber-CtN9R48-.mjs";
2
+ import { t as SubscriberBuilder } from "../SubscriberBuilder-CuCMFpYW.mjs";
3
3
  export { Subscriber, SubscriberBuilder };
@@ -1,2 +1,2 @@
1
- import { n as Subscriber, t as SubscriberBuilder } from "../SubscriberBuilder-DzQUWE08.mjs";
1
+ import { n as Subscriber, t as SubscriberBuilder } from "../SubscriberBuilder-DMFk_Ap1.mjs";
2
2
  export { Subscriber, SubscriberBuilder };
package/dist/worker.cjs CHANGED
@@ -1,10 +1,10 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_construct_interface = require("./construct-interface.cjs");
3
- const require_functions = require("./functions-ZH60FE7H.cjs");
3
+ const require_functions = require("./functions-CbP5ZKma.cjs");
4
4
  const require_surfaceEnv = require("./surfaceEnv-CNimK76p.cjs");
5
- const require_CronBuilder = require("./CronBuilder-DB35T5dL.cjs");
6
- const require_QueueBuilder = require("./QueueBuilder-CJNcv4dy.cjs");
7
- const require_SubscriberBuilder = require("./SubscriberBuilder-Duk028pD.cjs");
5
+ const require_CronBuilder = require("./CronBuilder-BoHzlWU_.cjs");
6
+ const require_QueueBuilder = require("./QueueBuilder-BFQn3OzZ.cjs");
7
+ const require_SubscriberBuilder = require("./SubscriberBuilder-C2PwqwIl.cjs");
8
8
  let _geekmidas_manifest = require("@geekmidas/manifest");
9
9
  let _geekmidas_logger_console = require("@geekmidas/logger/console");
10
10
  //#region src/worker.ts
@@ -18,7 +18,8 @@ var Worker = class Worker {
18
18
  envParser;
19
19
  /**
20
20
  * Where this worker's schedules live, when it has crons and a server runs
21
- * them. `undefined` until `.database(…)` says.
21
+ * them — and the database everything built from it receives as `db`.
22
+ * `undefined` until `.database(…)` says.
22
23
  */
23
24
  scheduleStore;
24
25
  constructor(id, config = {}, dependencies = [], scheduleStore) {
@@ -34,7 +35,10 @@ var Worker = class Worker {
34
35
  this.scheduleStore = scheduleStore;
35
36
  }
36
37
  /**
37
- * The database this worker keeps its schedules in.
38
+ * The database this worker keeps its schedules in, and the one everything
39
+ * built from it — crons, queues, subscribers, functions — receives as `db`.
40
+ * One of them that works against another database names it with its own
41
+ * `.database(other)`, which replaces this one for that runnable alone.
38
42
  *
39
43
  * Only a server target uses it. On AWS a cron is an EventBridge rule
40
44
  * invoking a Lambda and nothing here is consulted — but a server has nothing
@@ -51,6 +55,10 @@ var Worker = class Worker {
51
55
  * @example
52
56
  * ```ts
53
57
  * export const jobs = new Worker('Jobs', { logger }).database(database);
58
+ *
59
+ * export const sweep = jobs
60
+ * .cron('rate(1 hour)')
61
+ * .handle(async ({ db }) => db.deleteFrom('sessions').execute());
54
62
  * ```
55
63
  */
56
64
  database(source) {
@@ -152,12 +160,20 @@ var Worker = class Worker {
152
160
  }
153
161
  /**
154
162
  * Stamps this worker's id onto a builder, so everything built from it says
155
- * which process runs it.
163
+ * which process runs it — and hands it the worker's database.
164
+ *
165
+ * The database goes through the builder's own `.database()` rather than
166
+ * being written into its fields, so the default is recorded exactly as an
167
+ * explicit one would be: the client the handler gets, and the edge the
168
+ * manifest reads. That is also what lets a later `.database(other)` replace
169
+ * it outright. The builder arrives already typed with this worker's
170
+ * database; this is the runtime half of that.
156
171
  */
157
172
  own(builder) {
158
- builder._owner = this.id;
159
- builder._scheduleStore = this.scheduleStore;
160
- return builder;
173
+ const owned = this.scheduleStore ? builder.database(this.scheduleStore) : builder;
174
+ owned._owner = this.id;
175
+ owned._scheduleStore = this.scheduleStore;
176
+ return owned;
161
177
  }
162
178
  declare() {
163
179
  return [{
@@ -1 +1 @@
1
- {"version":3,"file":"worker.cjs","names":["canonicalId","DEFAULT_LOGGER","envParserFor","edgeTo","CronBuilder","QueueBuilder","SubscriberBuilder","FunctionBuilder"],"sources":["../src/worker.ts"],"sourcesContent":["/**\n * A process with no port.\n *\n * `RestApi` is the process that answers HTTP. This is the one that does not —\n * the thing that runs a schedule, drains a queue, consumes a topic. Until it\n * existed, those had nowhere to say they belonged: a cron declared a schedule\n * and nothing else, and which container ran it was decided by the directory the\n * file sat in. A glob owned it.\n *\n * The cost of that shows up in the scaffolds. `gkm init --template worker` —\n * a project that is background jobs and nothing else — declared\n * `new RestApi('Api', { defaultAuthorizer: 'none', logger })`: an HTTP surface\n * with no HTTP on it, written because it was the only construct that made an\n * app exist and the only way to get a logger into the generated runtime.\n *\n * It takes no authorizer, and that is the tell that these are two constructs\n * rather than one with a flag: a `RestApi` needs one because an HTTP surface\n * can ship open by omission, and nothing reaches a worker from outside.\n *\n * ## Crons on a server target need a database\n *\n * A cron becomes an EventBridge rule on AWS and nothing here is consulted. A\n * server has nothing firing its crons but itself, and a process that schedules\n * in memory fires every job once per replica while reporting success — so the\n * schedule is kept in Postgres, and the worker says which one with\n * `.database(db)`.\n *\n * A worker with crons and no `.database(…)` schedules nothing on a server\n * target and says so at startup. That is a limitation of workers today rather\n * than a design: the store could be a cache, or something the target\n * provisions, and Postgres is what exists.\n *\n * It is not an app. A worker names the process that runs its crons and\n * subscribers, and that process is the app's server — the same one the\n * endpoints run in, minus the HTTP surface. Giving a worker a container of its\n * own made a second thing to build, deploy and keep alive for work that was\n * always going to run somewhere already. Declare as many as the shape of the\n * work wants: they are groupings, not deployments.\n *\n * @example\n * ```ts\n * // constructs/worker.ts\n * import { Worker } from '@geekmidas/constructs/worker';\n * import { logger } from './logger.js';\n *\n * export const worker = new Worker('Worker', { logger }).calls([database]);\n *\n * // crons/cleanup.ts\n * import { worker } from '@acme/constructs/worker.js';\n *\n * export const cleanup = worker\n * .cron('rate(1 day)')\n * .handle(async ({ logger }) => { … });\n * ```\n */\n\nimport type { EnvironmentParser } from '@geekmidas/envkit';\nimport type { EventPublisher } from '@geekmidas/events';\nimport type { Logger } from '@geekmidas/logger';\nimport { DEFAULT_LOGGER } from '@geekmidas/logger/console';\nimport {\n\ttype ConstructName,\n\tcanonicalId,\n\ttype Declaration,\n\ttype Dependency,\n} from '@geekmidas/manifest';\nimport type { ComposableStandardSchema } from '@geekmidas/schema';\nimport type { Service } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport {\n\ttype Consumable,\n\ttype Declarable,\n\tedgeTo,\n} from './construct-interface';\nimport type { ScheduleExpression } from './crons/Cron';\nimport { CronBuilder } from './crons/CronBuilder';\nimport { envParserFor } from './endpoints/surfaceEnv';\nimport { FunctionBuilder } from './functions/FunctionBuilder';\nimport { QueueBuilder } from './queue/QueueBuilder';\nimport { SubscriberBuilder } from './subscribers/SubscriberBuilder';\nimport type { Topic, TopicEvents } from './topic/Topic';\n\nexport interface WorkerConfig {\n\t/**\n\t * The logger everything built from this worker runs with.\n\t *\n\t * The actual logger, not a path to one — the same reason `RestApi` takes\n\t * one. Every cron and subscriber in a scaffolded project used to open with\n\t * `import { logger } from '…/constructs/logger.js'`, which is the line this\n\t * removes.\n\t */\n\tlogger?: Logger;\n\t/**\n\t * The environment parser everything built from this worker runs with.\n\t *\n\t * Defaults to `process.env` merged with the credentials `gkm dev` injected,\n\t * which is what an application's own `config/env.ts` always was.\n\t */\n\tenvParser?: EnvironmentParser<{}>;\n}\n\nexport class Worker<TName extends string = string>\n\timplements Declarable<TName>\n{\n\treadonly id: TName;\n\n\t/** Always defined — the worker's own, or the console logger. */\n\treadonly logger: Logger;\n\n\t/** Always defined, and normally the default. */\n\treadonly envParser: EnvironmentParser<{}>;\n\n\t/**\n\t * Where this worker's schedules live, when it has crons and a server runs\n\t * them. `undefined` until `.database(…)` says.\n\t */\n\treadonly scheduleStore?: Consumable<string, unknown>;\n\n\tconstructor(\n\t\tid: ConstructName<TName>,\n\t\tprivate readonly config: WorkerConfig = {},\n\t\t/** Internal: how `.calls()` carries edges into the copy it returns. */\n\t\tprivate readonly dependencies: readonly Dependency[] = [],\n\t\tscheduleStore?: Consumable<string, unknown>,\n\t) {\n\t\tconst canonical = canonicalId(id as string);\n\n\t\tthis.id = canonical as TName;\n\t\tthis.logger = config.logger ?? DEFAULT_LOGGER;\n\t\tthis.envParser = envParserFor(\n\t\t\tconfig.envParser\n\t\t\t\t? { id: canonical, envParser: config.envParser }\n\t\t\t\t: undefined,\n\t\t);\n\t\tthis.scheduleStore = scheduleStore;\n\t}\n\n\t/**\n\t * The database this worker keeps its schedules in.\n\t *\n\t * Only a server target uses it. On AWS a cron is an EventBridge rule\n\t * invoking a Lambda and nothing here is consulted — but a server has nothing\n\t * firing its crons except itself, and a process that schedules in memory\n\t * fires every job once per replica while reporting that all is well.\n\t *\n\t * So the store is declared rather than discovered. It could have been\n\t * inferred — from a database the app happens to declare, or from the events\n\t * backend when that backend is pg-boss — and both would work until an app\n\t * had two databases, or moved its events to SNS, at which point the\n\t * schedules would quietly move or stop. Naming it is one line and cannot\n\t * drift.\n\t *\n\t * @example\n\t * ```ts\n\t * export const jobs = new Worker('Jobs', { logger }).database(database);\n\t * ```\n\t */\n\tdatabase<T, TDbName extends string>(\n\t\tsource: Consumable<TDbName, T>,\n\t): Worker<TName> {\n\t\treturn new Worker<TName>(\n\t\t\tthis.id as ConstructName<TName>,\n\t\t\tthis.config,\n\t\t\t[...this.dependencies, edgeTo(source)],\n\t\t\tsource as unknown as Consumable<string, unknown>,\n\t\t);\n\t}\n\n\t/**\n\t * A scheduled runnable.\n\t *\n\t * @example `worker.cron('rate(1 day)').handle(async ({ logger }) => { … })`\n\t */\n\tcron(schedule: ScheduleExpression) {\n\t\treturn this.own(new CronBuilder().logger(this.logger)).schedule(schedule);\n\t}\n\n\t/**\n\t * A queue and its one consumer, run by this worker.\n\t *\n\t * One construct, because a queue has exactly one consumer: nothing else can\n\t * attach a second, or forget to attach the first. Producers send to it by\n\t * depending on it — `.dependsOn([emails])` makes `services.emails` the\n\t * publisher.\n\t *\n\t * @example\n\t * ```ts\n\t * export const emails = worker\n\t * .queue('Emails')\n\t * .message(z.object({ userId: z.uuid(), template: z.string() }))\n\t * .handle(async ({ messages, services }) => { … });\n\t * ```\n\t */\n\tqueue<TQueueName extends string>(name: TQueueName) {\n\t\treturn this.own(new QueueBuilder().logger(this.logger)).queue(name);\n\t}\n\n\t/**\n\t * A runnable that consumes a topic.\n\t *\n\t * Binding is not publishing: a consumer is handed the topic's event types\n\t * and no connection string it could publish with. A handler that emits\n\t * follow-up events depends on the topic it emits to —\n\t * `.dependsOn([orders])` — which is the only reason it would need one.\n\t *\n\t * @example `worker.topic(users).subscribe(['user.created']).handle(…)`\n\t */\n\ttopic<TTopicName extends string, TEvents extends TopicEvents>(\n\t\ttopic: Topic<TTopicName, TEvents>,\n\t) {\n\t\treturn this.own(new SubscriberBuilder().logger(this.logger)).topic(topic);\n\t}\n\n\t/**\n\t * Everything below builds a function — the runnable with no schedule and no\n\t * topic, invoked by something else.\n\t *\n\t * These sit on the worker rather than behind a `functions` namespace because\n\t * the namespace was a hop that said nothing: `worker.functions.input(…)`\n\t * names a collection to reach one member of it. What kind of runnable is\n\t * being built is decided by which of these is called first — a schedule\n\t * makes a cron, a topic makes a subscriber, and anything else makes a\n\t * function.\n\t */\n\tinput<T extends ComposableStandardSchema>(schema: T) {\n\t\treturn this.functions.input(schema);\n\t}\n\n\toutput<T extends StandardSchemaV1>(schema: T) {\n\t\treturn this.functions.output(schema);\n\t}\n\n\ttimeout(ms: number) {\n\t\treturn this.functions.timeout(ms);\n\t}\n\n\tmemorySize(mb: number) {\n\t\treturn this.functions.memorySize(mb);\n\t}\n\n\tdependsOn<const T extends readonly Consumable[]>(constructs: T) {\n\t\treturn this.functions.dependsOn(constructs);\n\t}\n\n\tservices<T extends Service[]>(services: T) {\n\t\treturn this.functions.services(services);\n\t}\n\n\t/**\n\t * A function with no input schema — the shortest runnable there is.\n\t *\n\t * @example `worker.handle(async ({ logger }) => { … })`\n\t */\n\thandle(\n\t\t...args: Parameters<\n\t\t\tReturnType<Worker<TName>['schemalessFunction']>['handle']\n\t\t>\n\t) {\n\t\treturn this.schemalessFunction().handle(...args);\n\t}\n\n\t/** The builder `handle` delegates to, named so its type can be referred to. */\n\tprivate schemalessFunction() {\n\t\treturn this.functions;\n\t}\n\n\t/** The function builder the delegating methods above are built on. */\n\tprivate get functions() {\n\t\treturn this.own(new FunctionBuilder().logger(this.logger));\n\t}\n\n\t/**\n\t * Resources and surfaces this worker calls.\n\t *\n\t * Not `.dependsOn()`: this records the edge that derives the worker's\n\t * environment and its access, the same distinction `RestApi.calls()` draws.\n\t */\n\tcalls(constructs: readonly Declarable[]): Worker<TName> {\n\t\treturn new Worker<TName>(\n\t\t\tthis.id as ConstructName<TName>,\n\t\t\tthis.config,\n\t\t\t[...this.dependencies, ...constructs.map(edgeTo)],\n\t\t\tthis.scheduleStore,\n\t\t);\n\t}\n\n\t/**\n\t * Stamps this worker's id onto a builder, so everything built from it says\n\t * which process runs it.\n\t */\n\tprivate own<T extends { _owner?: string; _scheduleStore?: unknown }>(\n\t\tbuilder: T,\n\t): T {\n\t\tbuilder._owner = this.id;\n\t\tbuilder._scheduleStore = this.scheduleStore;\n\n\t\treturn builder;\n\t}\n\n\tdeclare(): Declaration[] {\n\t\treturn [\n\t\t\t{\n\t\t\t\tkind: 'worker',\n\t\t\t\tid: this.id,\n\t\t\t\t...(this.dependencies.length\n\t\t\t\t\t? { dependencies: this.dependencies }\n\t\t\t\t\t: {}),\n\t\t\t\t// Nothing calls a worker, so it publishes no address.\n\t\t\t\tprovides: [],\n\t\t\t},\n\t\t];\n\t}\n}\n"],"mappings":";;;;;;;;;;AAqGA,IAAa,SAAb,MAAa,OAEb;CAiBmB;CAEA;CAlBlB;;CAGA;;CAGA;;;;;CAMA;CAEA,YACC,IACA,SAAwC,CAAC,GAEzC,eAAuD,CAAC,GACxD,eACC;EAJgB,KAAA,SAAA;EAEA,KAAA,eAAA;EAGjB,MAAM,aAAA,GAAYA,oBAAAA,YAAAA,CAAY,EAAY;EAE1C,KAAK,KAAK;EACV,KAAK,SAAS,OAAO,UAAUC,0BAAAA;EAC/B,KAAK,YAAYC,mBAAAA,aAChB,OAAO,YACJ;GAAE,IAAI;GAAW,WAAW,OAAO;EAAU,IAC7C,KAAA,CACJ;EACA,KAAK,gBAAgB;CACtB;;;;;;;;;;;;;;;;;;;;;CAsBA,SACC,QACgB;EAChB,OAAO,IAAI,OACV,KAAK,IACL,KAAK,QACL,CAAC,GAAG,KAAK,cAAcC,4BAAAA,OAAO,MAAM,CAAC,GACrC,MACD;CACD;;;;;;CAOA,KAAK,UAA8B;EAClC,OAAO,KAAK,IAAI,IAAIC,oBAAAA,YAAY,CAAC,CAAC,OAAO,KAAK,MAAM,CAAC,CAAC,CAAC,SAAS,QAAQ;CACzE;;;;;;;;;;;;;;;;;CAkBA,MAAiC,MAAkB;EAClD,OAAO,KAAK,IAAI,IAA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UAAU,CAAC;EACZ,CACD;CACD;AACD"}
1
+ {"version":3,"file":"worker.cjs","names":["canonicalId","DEFAULT_LOGGER","envParserFor","edgeTo","CronBuilder","QueueBuilder","SubscriberBuilder","FunctionBuilder"],"sources":["../src/worker.ts"],"sourcesContent":["/**\n * A process with no port.\n *\n * `RestApi` is the process that answers HTTP. This is the one that does not —\n * the thing that runs a schedule, drains a queue, consumes a topic. Until it\n * existed, those had nowhere to say they belonged: a cron declared a schedule\n * and nothing else, and which container ran it was decided by the directory the\n * file sat in. A glob owned it.\n *\n * The cost of that shows up in the scaffolds. `gkm init --template worker` —\n * a project that is background jobs and nothing else — declared\n * `new RestApi('Api', { defaultAuthorizer: 'none', logger })`: an HTTP surface\n * with no HTTP on it, written because it was the only construct that made an\n * app exist and the only way to get a logger into the generated runtime.\n *\n * It takes no authorizer, and that is the tell that these are two constructs\n * rather than one with a flag: a `RestApi` needs one because an HTTP surface\n * can ship open by omission, and nothing reaches a worker from outside.\n *\n * ## Crons on a server target need a database\n *\n * A cron becomes an EventBridge rule on AWS and nothing here is consulted. A\n * server has nothing firing its crons but itself, and a process that schedules\n * in memory fires every job once per replica while reporting success — so the\n * schedule is kept in Postgres, and the worker says which one with\n * `.database(db)`.\n *\n * A worker with crons and no `.database(…)` schedules nothing on a server\n * target and says so at startup. That is a limitation of workers today rather\n * than a design: the store could be a cache, or something the target\n * provisions, and Postgres is what exists.\n *\n * ## The database is everything's default\n *\n * The same `.database(db)` is the database every cron, queue, subscriber and\n * function built from the worker receives as `db`. The work a worker groups is\n * usually work against one database, and naming it per handler was a line\n * repeated in every file that could drift in any one of them. A runnable that\n * works against another names its own with `.database(other)`, which replaces\n * the worker's — client and manifest edge both — rather than adding to it.\n *\n * It is not an app. A worker names the process that runs its crons and\n * subscribers, and that process is the app's server — the same one the\n * endpoints run in, minus the HTTP surface. Giving a worker a container of its\n * own made a second thing to build, deploy and keep alive for work that was\n * always going to run somewhere already. Declare as many as the shape of the\n * work wants: they are groupings, not deployments.\n *\n * @example\n * ```ts\n * // constructs/worker.ts\n * import { Worker } from '@geekmidas/constructs/worker';\n * import { logger } from './logger.js';\n *\n * export const worker = new Worker('Worker', { logger }).database(database);\n *\n * // crons/cleanup.ts\n * import { worker } from '@acme/constructs/worker.js';\n *\n * export const cleanup = worker\n * .cron('rate(1 day)')\n * .handle(async ({ db, logger }) => { … });\n *\n * // queues/reports.ts — against another database than the worker's\n * export const reports = worker\n * .queue('Reports')\n * .database(analytics)\n * .message(z.object({ id: z.uuid() }))\n * .handle(async ({ messages, db }) => { … });\n * ```\n */\n\nimport type { EnvironmentParser } from '@geekmidas/envkit';\nimport type { EventPublisher } from '@geekmidas/events';\nimport type { Logger } from '@geekmidas/logger';\nimport { DEFAULT_LOGGER } from '@geekmidas/logger/console';\nimport {\n\ttype ConstructName,\n\tcanonicalId,\n\ttype Declaration,\n\ttype Dependency,\n} from '@geekmidas/manifest';\nimport type { ComposableStandardSchema } from '@geekmidas/schema';\nimport type { Service } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport {\n\ttype Consumable,\n\ttype Declarable,\n\tedgeTo,\n} from './construct-interface';\nimport type { ScheduleExpression } from './crons/Cron';\nimport { CronBuilder } from './crons/CronBuilder';\nimport { envParserFor } from './endpoints/surfaceEnv';\nimport { FunctionBuilder } from './functions/FunctionBuilder';\nimport { QueueBuilder } from './queue/QueueBuilder';\nimport { SubscriberBuilder } from './subscribers/SubscriberBuilder';\nimport type { Topic, TopicEvents } from './topic/Topic';\n\nexport interface WorkerConfig {\n\t/**\n\t * The logger everything built from this worker runs with.\n\t *\n\t * The actual logger, not a path to one — the same reason `RestApi` takes\n\t * one. Every cron and subscriber in a scaffolded project used to open with\n\t * `import { logger } from '…/constructs/logger.js'`, which is the line this\n\t * removes.\n\t */\n\tlogger?: Logger;\n\t/**\n\t * The environment parser everything built from this worker runs with.\n\t *\n\t * Defaults to `process.env` merged with the credentials `gkm dev` injected,\n\t * which is what an application's own `config/env.ts` always was.\n\t */\n\tenvParser?: EnvironmentParser<{}>;\n}\n\nexport class Worker<\n\tTName extends string = string,\n\tTDatabase = undefined,\n\tTDatabaseServiceName extends string = string,\n> implements Declarable<TName>\n{\n\treadonly id: TName;\n\n\t/** Always defined — the worker's own, or the console logger. */\n\treadonly logger: Logger;\n\n\t/** Always defined, and normally the default. */\n\treadonly envParser: EnvironmentParser<{}>;\n\n\t/**\n\t * Where this worker's schedules live, when it has crons and a server runs\n\t * them — and the database everything built from it receives as `db`.\n\t * `undefined` until `.database(…)` says.\n\t */\n\treadonly scheduleStore?: Consumable<string, unknown>;\n\n\tconstructor(\n\t\tid: ConstructName<TName>,\n\t\tprivate readonly config: WorkerConfig = {},\n\t\t/** Internal: how `.calls()` carries edges into the copy it returns. */\n\t\tprivate readonly dependencies: readonly Dependency[] = [],\n\t\tscheduleStore?: Consumable<string, unknown>,\n\t) {\n\t\tconst canonical = canonicalId(id as string);\n\n\t\tthis.id = canonical as TName;\n\t\tthis.logger = config.logger ?? DEFAULT_LOGGER;\n\t\tthis.envParser = envParserFor(\n\t\t\tconfig.envParser\n\t\t\t\t? { id: canonical, envParser: config.envParser }\n\t\t\t\t: undefined,\n\t\t);\n\t\tthis.scheduleStore = scheduleStore;\n\t}\n\n\t/**\n\t * The database this worker keeps its schedules in, and the one everything\n\t * built from it — crons, queues, subscribers, functions — receives as `db`.\n\t * One of them that works against another database names it with its own\n\t * `.database(other)`, which replaces this one for that runnable alone.\n\t *\n\t * Only a server target uses it. On AWS a cron is an EventBridge rule\n\t * invoking a Lambda and nothing here is consulted — but a server has nothing\n\t * firing its crons except itself, and a process that schedules in memory\n\t * fires every job once per replica while reporting that all is well.\n\t *\n\t * So the store is declared rather than discovered. It could have been\n\t * inferred — from a database the app happens to declare, or from the events\n\t * backend when that backend is pg-boss — and both would work until an app\n\t * had two databases, or moved its events to SNS, at which point the\n\t * schedules would quietly move or stop. Naming it is one line and cannot\n\t * drift.\n\t *\n\t * @example\n\t * ```ts\n\t * export const jobs = new Worker('Jobs', { logger }).database(database);\n\t *\n\t * export const sweep = jobs\n\t * .cron('rate(1 hour)')\n\t * .handle(async ({ db }) => db.deleteFrom('sessions').execute());\n\t * ```\n\t */\n\tdatabase<T, TDbName extends string>(\n\t\tsource: Consumable<TDbName, T>,\n\t): Worker<TName, T, TDbName> {\n\t\treturn new Worker<TName, T, TDbName>(\n\t\t\tthis.id as ConstructName<TName>,\n\t\t\tthis.config,\n\t\t\t[...this.dependencies, edgeTo(source)],\n\t\t\tsource as unknown as Consumable<string, unknown>,\n\t\t);\n\t}\n\n\t/**\n\t * A scheduled runnable.\n\t *\n\t * @example `worker.cron('rate(1 day)').handle(async ({ logger }) => { … })`\n\t */\n\tcron(schedule: ScheduleExpression) {\n\t\treturn this.own(\n\t\t\tnew CronBuilder<\n\t\t\t\tComposableStandardSchema,\n\t\t\t\tService[],\n\t\t\t\tLogger,\n\t\t\t\tundefined,\n\t\t\t\tTDatabase,\n\t\t\t\tTDatabaseServiceName\n\t\t\t>().logger(this.logger),\n\t\t).schedule(schedule);\n\t}\n\n\t/**\n\t * A queue and its one consumer, run by this worker.\n\t *\n\t * One construct, because a queue has exactly one consumer: nothing else can\n\t * attach a second, or forget to attach the first. Producers send to it by\n\t * depending on it — `.dependsOn([emails])` makes `services.emails` the\n\t * publisher.\n\t *\n\t * @example\n\t * ```ts\n\t * export const emails = worker\n\t * .queue('Emails')\n\t * .message(z.object({ userId: z.uuid(), template: z.string() }))\n\t * .handle(async ({ messages, services }) => { … });\n\t * ```\n\t */\n\tqueue<TQueueName extends string>(name: TQueueName) {\n\t\treturn this.own(\n\t\t\tnew QueueBuilder<\n\t\t\t\tstring,\n\t\t\t\tundefined,\n\t\t\t\t[],\n\t\t\t\tLogger,\n\t\t\t\tTDatabase,\n\t\t\t\tTDatabaseServiceName\n\t\t\t>().logger(this.logger),\n\t\t).queue(name);\n\t}\n\n\t/**\n\t * A runnable that consumes a topic.\n\t *\n\t * Binding is not publishing: a consumer is handed the topic's event types\n\t * and no connection string it could publish with. A handler that emits\n\t * follow-up events depends on the topic it emits to —\n\t * `.dependsOn([orders])` — which is the only reason it would need one.\n\t *\n\t * @example `worker.topic(users).subscribe(['user.created']).handle(…)`\n\t */\n\ttopic<TTopicName extends string, TEvents extends TopicEvents>(\n\t\ttopic: Topic<TTopicName, TEvents>,\n\t) {\n\t\treturn this.own(\n\t\t\tnew SubscriberBuilder<\n\t\t\t\t[],\n\t\t\t\tLogger,\n\t\t\t\tundefined,\n\t\t\t\tundefined,\n\t\t\t\t[],\n\t\t\t\tTDatabase,\n\t\t\t\tTDatabaseServiceName\n\t\t\t>().logger(this.logger),\n\t\t).topic(topic);\n\t}\n\n\t/**\n\t * Everything below builds a function — the runnable with no schedule and no\n\t * topic, invoked by something else.\n\t *\n\t * These sit on the worker rather than behind a `functions` namespace because\n\t * the namespace was a hop that said nothing: `worker.functions.input(…)`\n\t * names a collection to reach one member of it. What kind of runnable is\n\t * being built is decided by which of these is called first — a schedule\n\t * makes a cron, a topic makes a subscriber, and anything else makes a\n\t * function.\n\t */\n\tinput<T extends ComposableStandardSchema>(schema: T) {\n\t\treturn this.functions.input(schema);\n\t}\n\n\toutput<T extends StandardSchemaV1>(schema: T) {\n\t\treturn this.functions.output(schema);\n\t}\n\n\ttimeout(ms: number) {\n\t\treturn this.functions.timeout(ms);\n\t}\n\n\tmemorySize(mb: number) {\n\t\treturn this.functions.memorySize(mb);\n\t}\n\n\tdependsOn<const T extends readonly Consumable[]>(constructs: T) {\n\t\treturn this.functions.dependsOn(constructs);\n\t}\n\n\tservices<T extends Service[]>(services: T) {\n\t\treturn this.functions.services(services);\n\t}\n\n\t/**\n\t * A function with no input schema — the shortest runnable there is.\n\t *\n\t * @example `worker.handle(async ({ logger }) => { … })`\n\t */\n\thandle(\n\t\t...args: Parameters<\n\t\t\tReturnType<\n\t\t\t\tWorker<TName, TDatabase, TDatabaseServiceName>['schemalessFunction']\n\t\t\t>['handle']\n\t\t>\n\t) {\n\t\treturn this.schemalessFunction().handle(...args);\n\t}\n\n\t/** The builder `handle` delegates to, named so its type can be referred to. */\n\tprivate schemalessFunction() {\n\t\treturn this.functions;\n\t}\n\n\t/** The function builder the delegating methods above are built on. */\n\tprivate get functions() {\n\t\treturn this.own(\n\t\t\tnew FunctionBuilder<\n\t\t\t\tany,\n\t\t\t\tundefined,\n\t\t\t\t[],\n\t\t\t\tLogger,\n\t\t\t\tundefined,\n\t\t\t\tstring,\n\t\t\t\tTDatabase,\n\t\t\t\tTDatabaseServiceName\n\t\t\t>().logger(this.logger),\n\t\t);\n\t}\n\n\t/**\n\t * Resources and surfaces this worker calls.\n\t *\n\t * Not `.dependsOn()`: this records the edge that derives the worker's\n\t * environment and its access, the same distinction `RestApi.calls()` draws.\n\t */\n\tcalls(\n\t\tconstructs: readonly Declarable[],\n\t): Worker<TName, TDatabase, TDatabaseServiceName> {\n\t\treturn new Worker<TName, TDatabase, TDatabaseServiceName>(\n\t\t\tthis.id as ConstructName<TName>,\n\t\t\tthis.config,\n\t\t\t[...this.dependencies, ...constructs.map(edgeTo)],\n\t\t\tthis.scheduleStore,\n\t\t);\n\t}\n\n\t/**\n\t * Stamps this worker's id onto a builder, so everything built from it says\n\t * which process runs it — and hands it the worker's database.\n\t *\n\t * The database goes through the builder's own `.database()` rather than\n\t * being written into its fields, so the default is recorded exactly as an\n\t * explicit one would be: the client the handler gets, and the edge the\n\t * manifest reads. That is also what lets a later `.database(other)` replace\n\t * it outright. The builder arrives already typed with this worker's\n\t * database; this is the runtime half of that.\n\t */\n\tprivate own<\n\t\tT extends {\n\t\t\t_owner?: string;\n\t\t\t_scheduleStore?: unknown;\n\t\t\tdatabase(source: Consumable<string, unknown>): unknown;\n\t\t},\n\t>(builder: T): T {\n\t\tconst owned = this.scheduleStore\n\t\t\t? (builder.database(this.scheduleStore) as T)\n\t\t\t: builder;\n\n\t\towned._owner = this.id;\n\t\towned._scheduleStore = this.scheduleStore;\n\n\t\treturn owned;\n\t}\n\n\tdeclare(): Declaration[] {\n\t\treturn [\n\t\t\t{\n\t\t\t\tkind: 'worker',\n\t\t\t\tid: this.id,\n\t\t\t\t...(this.dependencies.length\n\t\t\t\t\t? { dependencies: this.dependencies }\n\t\t\t\t\t: {}),\n\t\t\t\t// Nothing calls a worker, so it publishes no address.\n\t\t\t\tprovides: [],\n\t\t\t},\n\t\t];\n\t}\n}\n"],"mappings":";;;;;;;;;;AAqHA,IAAa,SAAb,MAAa,OAKb;CAkBmB;CAEA;CAnBlB;;CAGA;;CAGA;;;;;;CAOA;CAEA,YACC,IACA,SAAwC,CAAC,GAEzC,eAAuD,CAAC,GACxD,eACC;EAJgB,KAAA,SAAA;EAEA,KAAA,eAAA;EAGjB,MAAM,aAAA,GAAYA,oBAAAA,YAAAA,CAAY,EAAY;EAE1C,KAAK,KAAK;EACV,KAAK,SAAS,OAAO,UAAUC,0BAAAA;EAC/B,KAAK,YAAYC,mBAAAA,aAChB,OAAO,YACJ;GAAE,IAAI;GAAW,WAAW,OAAO;EAAU,IAC7C,KAAA,CACJ;EACA,KAAK,gBAAgB;CACtB;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BA,SACC,QAC4B;EAC5B,OAAO,IAAI,OACV,KAAK,IACL,KAAK,QACL,CAAC,GAAG,KAAK,cAAcC,4BAAAA,OAAO,MAAM,CAAC,GACrC,MACD;CACD;;;;;;CAOA,KAAK,UAA8B;EAClC,OAAO,KAAK,IACX,IAAIC,oBAAAA,YAOF,CAAC,CAAC,OAAO,KAAK,MAAM,CACvB,CAAC,CAAC,SAAS,QAAQ;CACpB;;;;;;;;;;;;;;;;;CAkBA,MAAiC,MAAkB;EAClD,OAAO,KAAK,IACX,IAAIC,qBAAAA,aAOF,CAAC,CAAC,OAAO,KAAK,MAAM,CACvB,CAAC,CAAC,MAAM,IAAI;CACb;;;;;;;;;;;CAYA,MACC,OACC;EACD,OAAO,KAAK,IACX,IAAIC,0BAAAA,kBAQF,CAAC,CAAC,OAAO,KAAK,MAAM,CACvB,CAA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