@geekmidas/constructs 10.0.0-alpha.154 → 10.0.0-alpha.156
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.
- package/README.md +23 -0
- package/dist/{Construct-DorKS0Ua.cjs → Construct-B8yWxGlR.cjs} +2 -2
- package/dist/{Construct-DorKS0Ua.cjs.map → Construct-B8yWxGlR.cjs.map} +1 -1
- package/dist/{Construct-DySlwh8o.d.mts → Construct-BMk_CRSD.d.mts} +2 -2
- package/dist/{Construct-DySlwh8o.d.mts.map → Construct-BMk_CRSD.d.mts.map} +1 -1
- package/dist/{Construct-CGuc_Ijk.mjs → Construct-CRV3RN2U.mjs} +11 -2
- package/dist/{Construct-CGuc_Ijk.mjs.map → Construct-CRV3RN2U.mjs.map} +1 -1
- package/dist/{Cron-D8mB_cPX.d.mts → Cron-D6Y7BBt3.d.mts} +5 -5
- package/dist/{Cron-D8mB_cPX.d.mts.map → Cron-D6Y7BBt3.d.mts.map} +1 -1
- package/dist/{CronBuilder-Cmajva3g.d.mts → CronBuilder-4BZhkChG.d.mts} +5 -5
- package/dist/{CronBuilder-Cmajva3g.d.mts.map → CronBuilder-4BZhkChG.d.mts.map} +1 -1
- package/dist/{CronBuilder-B_NSP-Y5.cjs → CronBuilder-B4DYaEjl.cjs} +4 -4
- package/dist/{CronBuilder-B_NSP-Y5.cjs.map → CronBuilder-B4DYaEjl.cjs.map} +1 -1
- package/dist/{CronBuilder-BJ5LoadF.mjs → CronBuilder-CukJuL3b.mjs} +3 -3
- package/dist/{CronBuilder-BJ5LoadF.mjs.map → CronBuilder-CukJuL3b.mjs.map} +1 -1
- package/dist/{Endpoint-BbHh3Qoc.d.mts → Endpoint-BUoDD96P.d.mts} +5 -5
- package/dist/{Endpoint-BbHh3Qoc.d.mts.map → Endpoint-BUoDD96P.d.mts.map} +1 -1
- package/dist/{Endpoint-sUOU7uLx.mjs → Endpoint-BuKHHVZc.mjs} +3 -3
- package/dist/{Endpoint-sUOU7uLx.mjs.map → Endpoint-BuKHHVZc.mjs.map} +1 -1
- package/dist/{Endpoint-52z1P0Ue.cjs → Endpoint-D2ckHqIx.cjs} +3 -3
- package/dist/{Endpoint-52z1P0Ue.cjs.map → Endpoint-D2ckHqIx.cjs.map} +1 -1
- package/dist/{EndpointFactory-qcLzi4f-.d.mts → EndpointFactory-BbVOeryo.d.mts} +5 -5
- package/dist/{EndpointFactory-qcLzi4f-.d.mts.map → EndpointFactory-BbVOeryo.d.mts.map} +1 -1
- package/dist/{EndpointFactory-Bzi9Sl7r.mjs → EndpointFactory-BsJUlUyL.mjs} +4 -4
- package/dist/{EndpointFactory-Bzi9Sl7r.mjs.map → EndpointFactory-BsJUlUyL.mjs.map} +1 -1
- package/dist/{EndpointFactory-Cf_Cs1ym.cjs → EndpointFactory-c4tHjQKM.cjs} +5 -5
- package/dist/{EndpointFactory-Cf_Cs1ym.cjs.map → EndpointFactory-c4tHjQKM.cjs.map} +1 -1
- package/dist/{Function-DfMzTGS4.d.mts → Function-BKReud5p.d.mts} +3 -3
- package/dist/{Function-DfMzTGS4.d.mts.map → Function-BKReud5p.d.mts.map} +1 -1
- package/dist/{HonoEndpointAdaptor-DR3j7S35.mjs → HonoEndpointAdaptor-BC7CZ7Cr.mjs} +7 -6
- package/dist/HonoEndpointAdaptor-BC7CZ7Cr.mjs.map +1 -0
- package/dist/{HonoEndpointAdaptor-BXBdb2Bt.cjs → HonoEndpointAdaptor-BGEW1Tu8.cjs} +9 -8
- package/dist/HonoEndpointAdaptor-BGEW1Tu8.cjs.map +1 -0
- package/dist/{ObjectSubscriberBuilder-Cv8C7yS1.d.mts → ObjectSubscriberBuilder-DfzXQEKW.d.mts} +4 -4
- package/dist/{ObjectSubscriberBuilder-Cv8C7yS1.d.mts.map → ObjectSubscriberBuilder-DfzXQEKW.d.mts.map} +1 -1
- package/dist/ObjectSubscriberBuilder-LWkey_oq.d.cts.map +1 -1
- package/dist/{ProcessorBuilder-CwfP-M33.d.mts → ProcessorBuilder-D4oYvZeG.d.mts} +2 -2
- package/dist/{ProcessorBuilder-CwfP-M33.d.mts.map → ProcessorBuilder-D4oYvZeG.d.mts.map} +1 -1
- package/dist/{Queue-u8w8_HpE.mjs → Queue-0FpvxdOa.mjs} +2 -2
- package/dist/{Queue-u8w8_HpE.mjs.map → Queue-0FpvxdOa.mjs.map} +1 -1
- package/dist/{Queue-BnK3UH8r.d.mts → Queue-B8HGg439.d.mts} +3 -3
- package/dist/{Queue-BnK3UH8r.d.mts.map → Queue-B8HGg439.d.mts.map} +1 -1
- package/dist/{Queue-D4Iaidrs.cjs → Queue-DZpV13LN.cjs} +2 -2
- package/dist/{Queue-D4Iaidrs.cjs.map → Queue-DZpV13LN.cjs.map} +1 -1
- package/dist/{QueueBuilder-2wP5lEC8.mjs → QueueBuilder-Bmyay_Di.mjs} +2 -2
- package/dist/{QueueBuilder-2wP5lEC8.mjs.map → QueueBuilder-Bmyay_Di.mjs.map} +1 -1
- package/dist/{QueueBuilder-DmwFtLzQ.d.mts → QueueBuilder-CVS_qPuo.d.mts} +2 -2
- package/dist/{QueueBuilder-DmwFtLzQ.d.mts.map → QueueBuilder-CVS_qPuo.d.mts.map} +1 -1
- package/dist/{QueueBuilder-BxsZ9o5z.cjs → QueueBuilder-FXkSDah1.cjs} +2 -2
- package/dist/{QueueBuilder-BxsZ9o5z.cjs.map → QueueBuilder-FXkSDah1.cjs.map} +1 -1
- package/dist/{Subscriber-CW_Dl-YR.d.mts → Subscriber-CtQXhcL7.d.mts} +3 -3
- package/dist/{Subscriber-CW_Dl-YR.d.mts.map → Subscriber-CtQXhcL7.d.mts.map} +1 -1
- package/dist/{SubscriberBuilder-CWzKwX1p.cjs → SubscriberBuilder-Bfn-iDSk.cjs} +4 -3
- package/dist/SubscriberBuilder-Bfn-iDSk.cjs.map +1 -0
- package/dist/{SubscriberBuilder-BL_GTcwh.mjs → SubscriberBuilder-CxG1OOug.mjs} +4 -3
- package/dist/SubscriberBuilder-CxG1OOug.mjs.map +1 -0
- package/dist/{Topic-DN2gYJ-p.mjs → Topic-DoEdDgh7.mjs} +2 -2
- package/dist/{Topic-DN2gYJ-p.mjs.map → Topic-DoEdDgh7.mjs.map} +1 -1
- package/dist/{Topic-Dp9Q7Lj2.cjs → Topic-t5GhqaeT.cjs} +2 -2
- package/dist/{Topic-Dp9Q7Lj2.cjs.map → Topic-t5GhqaeT.cjs.map} +1 -1
- package/dist/adaptors/aws.cjs +28 -16
- package/dist/adaptors/aws.cjs.map +1 -1
- package/dist/adaptors/aws.d.cts +141 -0
- package/dist/adaptors/aws.d.cts.map +1 -1
- package/dist/adaptors/aws.d.mts +147 -6
- package/dist/adaptors/aws.d.mts.map +1 -1
- package/dist/adaptors/aws.mjs +21 -15
- package/dist/adaptors/aws.mjs.map +1 -1
- package/dist/adaptors/hono.cjs +1 -1
- package/dist/adaptors/hono.d.mts +2 -2
- package/dist/adaptors/hono.mjs +1 -1
- package/dist/adaptors/testing.cjs +230 -14
- package/dist/adaptors/testing.cjs.map +1 -1
- package/dist/adaptors/testing.d.cts +81 -2
- package/dist/adaptors/testing.d.cts.map +1 -1
- package/dist/adaptors/testing.d.mts +89 -10
- package/dist/adaptors/testing.d.mts.map +1 -1
- package/dist/adaptors/testing.mjs +221 -12
- package/dist/adaptors/testing.mjs.map +1 -1
- package/dist/apigateway-Dyjy_JwI.mjs +329 -0
- package/dist/apigateway-Dyjy_JwI.mjs.map +1 -0
- package/dist/apigateway-zHDoMwlI.cjs +370 -0
- package/dist/apigateway-zHDoMwlI.cjs.map +1 -0
- package/dist/auth-BqWz2JxC.d.cts.map +1 -1
- package/dist/auth-DnB9H9KL.d.mts.map +1 -1
- package/dist/auth.cjs +7 -21
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.mjs +6 -20
- package/dist/auth.mjs.map +1 -1
- package/dist/{cache-e3tfMQ9g.d.mts → cache-CCHcO9Oo.d.mts} +2 -2
- package/dist/cache-CCHcO9Oo.d.mts.map +1 -0
- package/dist/cache-CQjMNPrC.d.cts.map +1 -1
- package/dist/cache.cjs +3 -19
- package/dist/cache.cjs.map +1 -1
- package/dist/cache.d.mts +1 -1
- package/dist/cache.mjs +2 -18
- package/dist/cache.mjs.map +1 -1
- package/dist/crons/index.cjs +4 -3
- package/dist/crons/index.cjs.map +1 -1
- package/dist/crons/index.d.cts.map +1 -1
- package/dist/crons/index.d.mts +2 -2
- package/dist/crons/index.d.mts.map +1 -1
- package/dist/crons/index.mjs +4 -3
- package/dist/crons/index.mjs.map +1 -1
- package/dist/database/kysely.cjs +1 -1
- package/dist/database/kysely.d.mts +1 -1
- package/dist/email.cjs +4 -16
- package/dist/email.cjs.map +1 -1
- package/dist/email.d.cts.map +1 -1
- package/dist/email.d.mts.map +1 -1
- package/dist/email.mjs +2 -14
- package/dist/email.mjs.map +1 -1
- package/dist/endpoints/index.cjs +4 -4
- package/dist/endpoints/index.d.cts +1 -1
- package/dist/endpoints/index.d.cts.map +1 -1
- package/dist/endpoints/index.d.mts +4 -4
- package/dist/endpoints/index.d.mts.map +1 -1
- package/dist/endpoints/index.mjs +4 -4
- package/dist/file-server.cjs +1 -1
- package/dist/file-server.d.mts +1 -1
- package/dist/file-server.mjs +1 -1
- package/dist/functions/index.cjs +1 -1
- package/dist/functions/index.d.mts +2 -2
- package/dist/functions/index.mjs +1 -1
- package/dist/{functions-BvIDQKAA.mjs → functions-BF039DT8.mjs} +2 -2
- package/dist/{functions-BvIDQKAA.mjs.map → functions-BF039DT8.mjs.map} +1 -1
- package/dist/{functions-DLF6-IK8.cjs → functions-BqAq_0xQ.cjs} +3 -3
- package/dist/{functions-DLF6-IK8.cjs.map → functions-BqAq_0xQ.cjs.map} +1 -1
- package/dist/{inbox-CjxpLVkH.d.mts → inbox-YOdxlyfj.d.mts} +2 -2
- package/dist/{inbox-CjxpLVkH.d.mts.map → inbox-YOdxlyfj.d.mts.map} +1 -1
- package/dist/inbox.cjs +1 -1
- package/dist/inbox.d.mts +1 -1
- package/dist/inbox.mjs +1 -1
- package/dist/{index-DCkDQkwj.d.mts → index-BoQ3-M-K.d.mts} +4 -4
- package/dist/{index-DCkDQkwj.d.mts.map → index-BoQ3-M-K.d.mts.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{kysely-CukArHJ0.cjs → kysely-CeoQdAkg.cjs} +2 -2
- package/dist/{kysely-CukArHJ0.cjs.map → kysely-CeoQdAkg.cjs.map} +1 -1
- package/dist/{kysely-DE4kADWD.d.mts → kysely-De5rAC-E.d.mts} +2 -2
- package/dist/{kysely-DE4kADWD.d.mts.map → kysely-De5rAC-E.d.mts.map} +1 -1
- package/dist/optionalPeers-D7Wt6dnF.mjs +140 -0
- package/dist/optionalPeers-D7Wt6dnF.mjs.map +1 -0
- package/dist/optionalPeers-DuNQXXe1.cjs +223 -0
- package/dist/optionalPeers-DuNQXXe1.cjs.map +1 -0
- package/dist/origins-C7T9covD.cjs +24 -0
- package/dist/origins-C7T9covD.cjs.map +1 -0
- package/dist/origins-CX6Ot7ax.mjs +19 -0
- package/dist/origins-CX6Ot7ax.mjs.map +1 -0
- package/dist/{pattern-QFaUIr77.cjs → pattern-HnNOPhE2.cjs} +2 -2
- package/dist/{pattern-QFaUIr77.cjs.map → pattern-HnNOPhE2.cjs.map} +1 -1
- package/dist/{pattern-C1CEcglD.mjs → pattern-YSqfAhXm.mjs} +2 -2
- package/dist/{pattern-C1CEcglD.mjs.map → pattern-YSqfAhXm.mjs.map} +1 -1
- package/dist/privateAddress-Bg5fUsbp.mjs +21 -0
- package/dist/privateAddress-Bg5fUsbp.mjs.map +1 -0
- package/dist/privateAddress-CqGyuFHn.cjs +26 -0
- package/dist/privateAddress-CqGyuFHn.cjs.map +1 -0
- package/dist/processors/index.cjs +1 -1
- package/dist/processors/index.d.mts +1 -1
- package/dist/processors/index.mjs +1 -1
- package/dist/queue/index.cjs +2 -2
- package/dist/queue/index.d.mts +2 -2
- package/dist/queue/index.mjs +2 -2
- package/dist/{readRequestBody-BTIl3k-D.mjs → readRequestBody-BmKnPl0a.mjs} +26 -4
- package/dist/readRequestBody-BmKnPl0a.mjs.map +1 -0
- package/dist/{readRequestBody-Dej_L3c4.cjs → readRequestBody-CN9GVdeE.cjs} +26 -4
- package/dist/readRequestBody-CN9GVdeE.cjs.map +1 -0
- package/dist/{requestLogger-BZcXwdBs.cjs → requestLogger-CnoYd-Ah.cjs} +4 -63
- package/dist/requestLogger-CnoYd-Ah.cjs.map +1 -0
- package/dist/{requestLogger-pA4gi3E1.mjs → requestLogger-D2JS7pPM.mjs} +3 -56
- package/dist/requestLogger-D2JS7pPM.mjs.map +1 -0
- package/dist/rest-api.cjs +1 -1
- package/dist/rest-api.d.mts +2 -2
- package/dist/rest-api.mjs +1 -1
- package/dist/{rolldown-runtime-y5ARvAq5.cjs → rolldown-runtime-Ctb5zv51.cjs} +15 -0
- package/dist/{runSubscriber-DyHWp_Lf.mjs → runSubscriber-HEqXkin1.mjs} +3 -2
- package/dist/runSubscriber-HEqXkin1.mjs.map +1 -0
- package/dist/{runSubscriber-CC_2C9F2.cjs → runSubscriber-sVJfLA0-.cjs} +3 -2
- package/dist/runSubscriber-sVJfLA0-.cjs.map +1 -0
- package/dist/subscribers/index.cjs +6 -6
- package/dist/subscribers/index.cjs.map +1 -1
- package/dist/subscribers/index.d.cts +1 -1
- package/dist/subscribers/index.d.mts +3 -3
- package/dist/subscribers/index.mjs +3 -3
- package/dist/subscribers/index.mjs.map +1 -1
- package/dist/topic/index.cjs +1 -1
- package/dist/topic/index.d.mts +1 -1
- package/dist/topic/index.mjs +1 -1
- package/dist/websocket-api-BvKS9x-l.mjs +1711 -0
- package/dist/websocket-api-BvKS9x-l.mjs.map +1 -0
- package/dist/websocket-api-C3dWKNxO.d.cts +1181 -0
- package/dist/websocket-api-C3dWKNxO.d.cts.map +1 -0
- package/dist/websocket-api-CAQA_QOE.cjs +1890 -0
- package/dist/websocket-api-CAQA_QOE.cjs.map +1 -0
- package/dist/websocket-api-CDAxOTQZ.d.mts +1181 -0
- package/dist/websocket-api-CDAxOTQZ.d.mts.map +1 -0
- package/dist/websocket-api.cjs +31 -1121
- package/dist/websocket-api.d.cts +2 -699
- package/dist/websocket-api.d.mts +2 -699
- package/dist/websocket-api.mjs +2 -1102
- package/dist/worker.cjs +4 -4
- package/dist/worker.d.mts +9 -9
- package/dist/worker.mjs +4 -4
- package/package.json +41 -31
- package/dist/HonoEndpointAdaptor-BXBdb2Bt.cjs.map +0 -1
- package/dist/HonoEndpointAdaptor-DR3j7S35.mjs.map +0 -1
- package/dist/SubscriberBuilder-BL_GTcwh.mjs.map +0 -1
- package/dist/SubscriberBuilder-CWzKwX1p.cjs.map +0 -1
- package/dist/cache-e3tfMQ9g.d.mts.map +0 -1
- package/dist/readRequestBody-BTIl3k-D.mjs.map +0 -1
- package/dist/readRequestBody-Dej_L3c4.cjs.map +0 -1
- package/dist/requestLogger-BZcXwdBs.cjs.map +0 -1
- package/dist/requestLogger-pA4gi3E1.mjs.map +0 -1
- package/dist/runSubscriber-CC_2C9F2.cjs.map +0 -1
- package/dist/runSubscriber-DyHWp_Lf.mjs.map +0 -1
- package/dist/websocket-api.cjs.map +0 -1
- package/dist/websocket-api.d.cts.map +0 -1
- package/dist/websocket-api.d.mts.map +0 -1
- package/dist/websocket-api.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -1239,6 +1239,29 @@ const envVars = await endpoint.getEnvironment();
|
|
|
1239
1239
|
- [@geekmidas/client](../client) - Type-safe client for consuming endpoints
|
|
1240
1240
|
- [@geekmidas/cli](../cli) - CLI tools for building and deploying
|
|
1241
1241
|
|
|
1242
|
+
## Optional peers
|
|
1243
|
+
|
|
1244
|
+
<!-- optional-peers:start -->
|
|
1245
|
+
|
|
1246
|
+
<!-- Generated by `node scripts/check-optional-peers.mjs --write-docs`; CI fails when it drifts. -->
|
|
1247
|
+
|
|
1248
|
+
Each of these entries imports an optional peer when it loads, so using it means installing that peer:
|
|
1249
|
+
|
|
1250
|
+
| Entry | Install |
|
|
1251
|
+
| --- | --- |
|
|
1252
|
+
| `@geekmidas/constructs/aws` | `@middy/core` |
|
|
1253
|
+
| `@geekmidas/constructs/database/kysely` | `kysely`, `pg` |
|
|
1254
|
+
| `@geekmidas/constructs/encryption/kms` | `@aws-sdk/client-kms` |
|
|
1255
|
+
| `@geekmidas/constructs/file-server` | `@geekmidas/storage` |
|
|
1256
|
+
| `@geekmidas/constructs/hono` | `hono` |
|
|
1257
|
+
| `@geekmidas/constructs/inbox` | `@geekmidas/emailkit`, `@geekmidas/storage` |
|
|
1258
|
+
| `@geekmidas/constructs/object-storage` | `@geekmidas/storage` |
|
|
1259
|
+
| `@geekmidas/constructs/testing` | `@geekmidas/testkit`, `hono`, `kysely`, `msw`, `pg` |
|
|
1260
|
+
|
|
1261
|
+
No other entry imports an optional peer when it loads. `@aws-sdk/client-apigatewaymanagementapi`, `@aws-sdk/client-dynamodb`, `@geekmidas/audit`, `@geekmidas/cache`, `@geekmidas/db`, `@geekmidas/rate-limit`, `@geekmidas/telescope`, `@types/aws-lambda`, `better-auth`, `ioredis`, `ws` are loaded only when a feature that uses one runs (an `import()` inside a `try`, whose error names the package to install), or named only in types.
|
|
1262
|
+
|
|
1263
|
+
<!-- optional-peers:end -->
|
|
1264
|
+
|
|
1242
1265
|
## License
|
|
1243
1266
|
|
|
1244
1267
|
MIT
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_rolldown_runtime = require("./rolldown-runtime-
|
|
1
|
+
const require_rolldown_runtime = require("./rolldown-runtime-Ctb5zv51.cjs");
|
|
2
2
|
let _geekmidas_envkit_sniffer = require("@geekmidas/envkit/sniffer");
|
|
3
3
|
//#region ../../node_modules/.pnpm/lodash.compact@3.0.1/node_modules/lodash.compact/index.js
|
|
4
4
|
var require_lodash_compact = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports, module) => {
|
|
@@ -224,4 +224,4 @@ Object.defineProperty(exports, "snifferContext", {
|
|
|
224
224
|
}
|
|
225
225
|
});
|
|
226
226
|
|
|
227
|
-
//# sourceMappingURL=Construct-
|
|
227
|
+
//# sourceMappingURL=Construct-B8yWxGlR.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Construct-DorKS0Ua.cjs","names":["compact","SnifferEnvironmentParser","sniffWithFireAndForget"],"sources":["../../../node_modules/.pnpm/lodash.compact@3.0.1/node_modules/lodash.compact/index.js","../src/Construct.ts"],"sourcesContent":["/**\n * lodash 3.0.1 (Custom Build) <https://lodash.com/>\n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>\n * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>\n * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license <https://lodash.com/license>\n */\n\n/**\n * Creates an array with all falsey values removed. The values `false`, `null`,\n * `0`, `\"\"`, `undefined`, and `NaN` are falsey.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to compact.\n * @returns {Array} Returns the new array of filtered values.\n * @example\n *\n * _.compact([0, 1, false, 2, '', 3]);\n * // => [1, 2, 3]\n */\nfunction compact(array) {\n var index = -1,\n length = array ? array.length : 0,\n resIndex = 0,\n result = [];\n\n while (++index < length) {\n var value = array[index];\n if (value) {\n result[resIndex++] = value;\n }\n }\n return result;\n}\n\nmodule.exports = compact;\n","import type { AuditStorage } from '@geekmidas/audit';\nimport {\n\tSnifferEnvironmentParser,\n\ttype SniffResult,\n\tsniffWithFireAndForget,\n} from '@geekmidas/envkit/sniffer';\nimport type { Logger } from '@geekmidas/logger';\nimport type { Service, ServiceContext } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport compact from 'lodash.compact';\nimport type { TopicEvent } from './publisher';\n\n// Cache for service environment variables to handle singleton services\n// Stores both the full list and the optional subset so the same sniff result\n// can satisfy both getEnvironment() and getEnvironment({ markOptional: true }).\nconst serviceEnvCache = new Map<\n\tService,\n\t{ envVars: string[]; optionalEnvVars: string[] }\n>();\n\n/**\n * Noop context for environment sniffing.\n * Used when calling service.register() to detect env vars without a real request.\n * Returns dummy values since services should only use context in instance methods,\n * not during registration.\n */\nconst snifferContext: ServiceContext = {\n\tgetLogger() {\n\t\t// Return a noop logger for sniffing - services shouldn't log during registration\n\t\treturn {\n\t\t\tdebug: () => {},\n\t\t\tinfo: () => {},\n\t\t\twarn: () => {},\n\t\t\terror: () => {},\n\t\t\tchild: () => snifferContext.getLogger(),\n\t\t} as unknown as Logger;\n\t},\n\tgetRequestId() {\n\t\treturn 'sniffer-context';\n\t},\n\tgetRequestStartTime() {\n\t\treturn Date.now();\n\t},\n\thasContext() {\n\t\treturn false;\n\t},\n\tgetUser() {\n\t\treturn undefined;\n\t},\n};\n\nexport abstract class Construct<\n\tTLogger extends Logger = Logger,\n\tOutSchema extends StandardSchemaV1 | undefined = undefined,\n\tTServices extends Service[] = [],\n\tTAuditStorageServiceName extends string = string,\n\tTAuditStorage extends AuditStorage | undefined = undefined,\n\tTDatabaseServiceName extends string = string,\n\tTDatabase = unknown,\n> {\n\t/** Database service for this construct (used by Endpoint for RLS/audit context) */\n\tpublic databaseService?: Service<TDatabaseServiceName, TDatabase>;\n\n\t/**\n\t * The deploy unit that runs this, by construct id.\n\t *\n\t * What an endpoint's `surface` is to it, and for the same reason: something\n\t * has to say which process a runnable belongs to, and until this existed the\n\t * only thing that said so was the directory its file sat in. Set by the\n\t * factory it was built from — `worker.crons`, `api.get(…)` — so it is\n\t * carried rather than configured.\n\t *\n\t * Undefined for a construct built from a free-standing builder, which is\n\t * still how `c`, `s` and `f` work.\n\t */\n\tpublic owner?: string;\n\n\tconstructor(\n\t\tpublic readonly type: ConstructType,\n\t\tpublic readonly logger: TLogger,\n\t\tpublic readonly services: TServices,\n\t\t/**\n\t\t * What this construct publishes once its handler succeeds — each event\n\t\t * bound to its own topic, so a construct publishes to as many as it names.\n\t\t */\n\t\tpublic readonly events: TopicEvent[] = [],\n\t\tpublic outputSchema?: OutSchema,\n\t\tpublic readonly timeout?: number,\n\t\tpublic readonly memorySize?: number,\n\t\tpublic readonly auditorStorageService?: Service<\n\t\t\tTAuditStorageServiceName,\n\t\t\tTAuditStorage\n\t\t>,\n\t\t/**\n\t\t * The constructs this one declared an edge to, by id.\n\t\t *\n\t\t * What the manifest records. `services` is the same information in the\n\t\t * form a handler runs with — clients, keyed by name — and an id cannot be\n\t\t * recovered from one of those reliably, so both are kept.\n\t\t *\n\t\t * Last in the list because every other parameter is positional and already\n\t\t * spoken for; a new one anywhere else silently rebinds existing callers.\n\t\t */\n\t\tpublic readonly constructs: string[] = [],\n\t) {}\n\n\t/**\n\t * Returns an array of environment variable names required by this construct's services.\n\t * This is determined by running a \"sniffer\" EnvironmentParser through each service's\n\t * register method to track which environment variables are accessed.\n\t *\n\t * Results are cached per service class to handle singleton patterns where\n\t * subsequent register() calls may short-circuit and not access env vars.\n\t *\n\t * @param markOptional - When true, optional vars (those accessed via `.optional()` or\n\t * `.default()`) are suffixed with `?` in the returned array (e.g. `'PORT?'`).\n\t * @returns Promise that resolves to array of environment variable names, sorted alphabetically\n\t *\n\t * @example\n\t * ```typescript\n\t * const endpoint = e\n\t * .services([databaseService, authService])\n\t * .get('/users')\n\t * .handle(async () => []);\n\t *\n\t * await endpoint.getEnvironment(); // ['AUTH_SECRET', 'DATABASE_URL']\n\t * await endpoint.getEnvironment({ markOptional: true }); // ['AUTH_SECRET', 'DATABASE_URL', 'PORT?']\n\t * ```\n\t */\n\tasync getEnvironment(\n\t\topts: { markOptional?: boolean } = {},\n\t): Promise<string[]> {\n\t\tconst { markOptional = false } = opts;\n\t\tconst envVars = new Set<string>();\n\t\tconst optionalVars = new Set<string>();\n\t\tconst services: Service[] = compact([\n\t\t\t...this.services,\n\t\t\t// Each topic an event names is a dependency like any other.\n\t\t\t...this.events.map(({ topic }) => topic),\n\t\t\tthis.auditorStorageService,\n\t\t\tthis.databaseService,\n\t\t]);\n\n\t\ttry {\n\t\t\tfor (const service of services) {\n\t\t\t\t// Check cache first - handles singleton services that short-circuit\n\t\t\t\tif (serviceEnvCache.has(service)) {\n\t\t\t\t\tconst cached = serviceEnvCache.get(service)!;\n\t\t\t\t\tcached.envVars.forEach((v) => envVars.add(v));\n\t\t\t\t\tcached.optionalEnvVars.forEach((v) => optionalVars.add(v));\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t// Use sniffService to properly handle all error scenarios\n\t\t\t\tconst result = await sniffService(service);\n\n\t\t\t\t// Log any issues for debugging\n\t\t\t\tif (result.error) {\n\t\t\t\t\tthis.logger.warn(\n\t\t\t\t\t\t{ error: result.error.message, service: service.serviceName },\n\t\t\t\t\t\t'Service threw error during env sniffing (env vars still captured)',\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tif (result.unhandledRejections.length > 0) {\n\t\t\t\t\tthis.logger.warn(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\terrors: result.unhandledRejections.map((e) => e.message),\n\t\t\t\t\t\t\tservice: service.serviceName,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t'Fire-and-forget rejections during env sniffing (suppressed)',\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// Cache and collect env vars (both required and optional)\n\t\t\t\tserviceEnvCache.set(service, {\n\t\t\t\t\tenvVars: result.envVars,\n\t\t\t\t\toptionalEnvVars: result.optionalEnvVars,\n\t\t\t\t});\n\t\t\t\tresult.envVars.forEach((v) => envVars.add(v));\n\t\t\t\tresult.optionalEnvVars.forEach((v) => optionalVars.add(v));\n\t\t\t}\n\n\t\t\tconst sorted = Array.from(envVars).sort();\n\t\t\tif (!markOptional || optionalVars.size === 0) return sorted;\n\t\t\treturn sorted.map((v) => (optionalVars.has(v) ? `${v}?` : v));\n\t\t} catch (error) {\n\t\t\tthis.logger.error(\n\t\t\t\t{ err: error },\n\t\t\t\t'Error determining environment variables for construct',\n\t\t\t);\n\n\t\t\treturn [];\n\t\t}\n\t}\n}\n\nexport enum ConstructType {\n\tCron = 'dev.geekmidas.function.cron',\n\tEndpoint = 'dev.geekmidas.function.endpoint',\n\tFunction = 'dev.geekmidas.function.function',\n\tSubscriber = 'dev.geekmidas.function.subscriber',\n\tQueue = 'dev.geekmidas.function.queue',\n\tTopic = 'dev.geekmidas.resource.topic',\n\tProcessor = 'dev.geekmidas.function.processor',\n}\n\n/**\n * Utility to test sniffing a service for environment variables.\n * Useful for debugging services that throw errors during sniffing.\n *\n * @example\n * ```typescript\n * import { sniffService } from '@geekmidas/constructs';\n * import { authService } from './services/AuthService';\n *\n * const result = await sniffService(authService);\n * console.log('Env vars:', result.envVars);\n * console.log('Error:', result.error);\n * ```\n */\nexport async function sniffService(service: Service): Promise<SniffResult> {\n\tconst sniffer = new SnifferEnvironmentParser();\n\n\treturn sniffWithFireAndForget(sniffer, () =>\n\t\tservice.register({\n\t\t\tenvParser: sniffer as any,\n\t\t\tcontext: snifferContext,\n\t\t}),\n\t);\n}\n\n// Export for testing\nexport { snifferContext };\n"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;CAuBA,SAAS,QAAQ,OAAO;EACtB,IAAI,QAAQ,IACR,SAAS,QAAQ,MAAM,SAAS,GAChC,WAAW,GACX,SAAS,CAAC;EAEd,OAAO,EAAE,QAAQ,QAAQ;GACvB,IAAI,QAAQ,MAAM;GAClB,IAAI,OACF,OAAO,cAAc;EAEzB;EACA,OAAO;CACT;CAEA,OAAO,UAAU;;;;;ACvBjB,MAAM,kCAAkB,IAAI,IAG1B;;;;;;;AAQF,MAAM,iBAAiC;CACtC,YAAY;EAEX,OAAO;GACN,aAAa,CAAC;GACd,YAAY,CAAC;GACb,YAAY,CAAC;GACb,aAAa,CAAC;GACd,aAAa,eAAe,UAAU;EACvC;CACD;CACA,eAAe;EACd,OAAO;CACR;CACA,sBAAsB;EACrB,OAAO,KAAK,IAAI;CACjB;CACA,aAAa;EACZ,OA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I,SAAS;KAC5B,SAAS,OAAO;KAChB,iBAAiB,OAAO;IACzB,CAAC;IACD,OAAO,QAAQ,SAAS,MAAM,QAAQ,IAAI,CAAC,CAAC;IAC5C,OAAO,gBAAgB,SAAS,MAAM,aAAa,IAAI,CAAC,CAAC;GAC1D;GAEA,MAAM,SAAS,MAAM,KAAK,OAAO,CAAC,CAAC,KAAK;GACxC,IAAI,CAAC,gBAAgB,aAAa,SAAS,GAAG,OAAO;GACrD,OAAO,OAAO,KAAK,MAAO,aAAa,IAAI,CAAC,IAAI,GAAG,EAAE,KAAK,CAAE;EAC7D,SAAS,OAAO;GACf,KAAK,OAAO,MACX,EAAE,KAAK,MAAM,GACb,uDACD;GAEA,OAAO,CAAC;EACT;CACD;AACD;AAEA,IAAY,gBAAL,yBAAA,eAAA;CACN,cAAA,UAAA;CACA,cAAA,cAAA;CACA,cAAA,cAAA;CACA,cAAA,gBAAA;CACA,cAAA,WAAA;CACA,cAAA,WAAA;CACA,cAAA,eAAA;;AACD,EAAA,CAAA,CAAA;;;;;;;;;;;;;;;AAgBA,eAAsB,aAAa,SAAwC;CAC1E,MAAM,UAAU,IAAIC,0BAAAA,yBAAyB;CAE7C,QAAA,GAAOC,0BAAAA,uBAAAA,CAAuB,eAC7B,QAAQ,SAAS;EAChB,WAAW;EACX,SAAS;CACV,CAAC,CACF;AACD"}
|
|
1
|
+
{"version":3,"file":"Construct-B8yWxGlR.cjs","names":["compact","SnifferEnvironmentParser","sniffWithFireAndForget"],"sources":["../../../node_modules/.pnpm/lodash.compact@3.0.1/node_modules/lodash.compact/index.js","../src/Construct.ts"],"sourcesContent":["/**\n * lodash 3.0.1 (Custom Build) <https://lodash.com/>\n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>\n * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>\n * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license <https://lodash.com/license>\n */\n\n/**\n * Creates an array with all falsey values removed. The values `false`, `null`,\n * `0`, `\"\"`, `undefined`, and `NaN` are falsey.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to compact.\n * @returns {Array} Returns the new array of filtered values.\n * @example\n *\n * _.compact([0, 1, false, 2, '', 3]);\n * // => [1, 2, 3]\n */\nfunction compact(array) {\n var index = -1,\n length = array ? array.length : 0,\n resIndex = 0,\n result = [];\n\n while (++index < length) {\n var value = array[index];\n if (value) {\n result[resIndex++] = value;\n }\n }\n return result;\n}\n\nmodule.exports = compact;\n","import type { AuditStorage } from '@geekmidas/audit';\nimport {\n\tSnifferEnvironmentParser,\n\ttype SniffResult,\n\tsniffWithFireAndForget,\n} from '@geekmidas/envkit/sniffer';\nimport type { Logger } from '@geekmidas/logger';\nimport type { Service, ServiceContext } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport compact from 'lodash.compact';\nimport type { TopicEvent } from './publisher';\n\n// Cache for service environment variables to handle singleton services\n// Stores both the full list and the optional subset so the same sniff result\n// can satisfy both getEnvironment() and getEnvironment({ markOptional: true }).\nconst serviceEnvCache = new Map<\n\tService,\n\t{ envVars: string[]; optionalEnvVars: string[] }\n>();\n\n/**\n * Noop context for environment sniffing.\n * Used when calling service.register() to detect env vars without a real request.\n * Returns dummy values since services should only use context in instance methods,\n * not during registration.\n */\nconst snifferContext: ServiceContext = {\n\tgetLogger() {\n\t\t// Return a noop logger for sniffing - services shouldn't log during registration\n\t\treturn {\n\t\t\tdebug: () => {},\n\t\t\tinfo: () => {},\n\t\t\twarn: () => {},\n\t\t\terror: () => {},\n\t\t\tchild: () => snifferContext.getLogger(),\n\t\t} as unknown as Logger;\n\t},\n\tgetRequestId() {\n\t\treturn 'sniffer-context';\n\t},\n\tgetRequestStartTime() {\n\t\treturn Date.now();\n\t},\n\thasContext() {\n\t\treturn false;\n\t},\n\tgetUser() {\n\t\treturn undefined;\n\t},\n};\n\nexport abstract class Construct<\n\tTLogger extends Logger = Logger,\n\tOutSchema extends StandardSchemaV1 | undefined = undefined,\n\tTServices extends Service[] = [],\n\tTAuditStorageServiceName extends string = string,\n\tTAuditStorage extends AuditStorage | undefined = undefined,\n\tTDatabaseServiceName extends string = string,\n\tTDatabase = unknown,\n> {\n\t/** Database service for this construct (used by Endpoint for RLS/audit context) */\n\tpublic databaseService?: Service<TDatabaseServiceName, TDatabase>;\n\n\t/**\n\t * The deploy unit that runs this, by construct id.\n\t *\n\t * What an endpoint's `surface` is to it, and for the same reason: something\n\t * has to say which process a runnable belongs to, and until this existed the\n\t * only thing that said so was the directory its file sat in. Set by the\n\t * factory it was built from — `worker.crons`, `api.get(…)` — so it is\n\t * carried rather than configured.\n\t *\n\t * Undefined for a construct built from a free-standing builder, which is\n\t * still how `c`, `s` and `f` work.\n\t */\n\tpublic owner?: string;\n\n\tconstructor(\n\t\tpublic readonly type: ConstructType,\n\t\tpublic readonly logger: TLogger,\n\t\tpublic readonly services: TServices,\n\t\t/**\n\t\t * What this construct publishes once its handler succeeds — each event\n\t\t * bound to its own topic, so a construct publishes to as many as it names.\n\t\t */\n\t\tpublic readonly events: TopicEvent[] = [],\n\t\tpublic outputSchema?: OutSchema,\n\t\tpublic readonly timeout?: number,\n\t\tpublic readonly memorySize?: number,\n\t\tpublic readonly auditorStorageService?: Service<\n\t\t\tTAuditStorageServiceName,\n\t\t\tTAuditStorage\n\t\t>,\n\t\t/**\n\t\t * The constructs this one declared an edge to, by id.\n\t\t *\n\t\t * What the manifest records. `services` is the same information in the\n\t\t * form a handler runs with — clients, keyed by name — and an id cannot be\n\t\t * recovered from one of those reliably, so both are kept.\n\t\t *\n\t\t * Last in the list because every other parameter is positional and already\n\t\t * spoken for; a new one anywhere else silently rebinds existing callers.\n\t\t */\n\t\tpublic readonly constructs: string[] = [],\n\t) {}\n\n\t/**\n\t * Returns an array of environment variable names required by this construct's services.\n\t * This is determined by running a \"sniffer\" EnvironmentParser through each service's\n\t * register method to track which environment variables are accessed.\n\t *\n\t * Results are cached per service class to handle singleton patterns where\n\t * subsequent register() calls may short-circuit and not access env vars.\n\t *\n\t * @param markOptional - When true, optional vars (those accessed via `.optional()` or\n\t * `.default()`) are suffixed with `?` in the returned array (e.g. `'PORT?'`).\n\t * @returns Promise that resolves to array of environment variable names, sorted alphabetically\n\t *\n\t * @example\n\t * ```typescript\n\t * const endpoint = e\n\t * .services([databaseService, authService])\n\t * .get('/users')\n\t * .handle(async () => []);\n\t *\n\t * await endpoint.getEnvironment(); // ['AUTH_SECRET', 'DATABASE_URL']\n\t * await endpoint.getEnvironment({ markOptional: true }); // ['AUTH_SECRET', 'DATABASE_URL', 'PORT?']\n\t * ```\n\t */\n\tasync getEnvironment(\n\t\topts: { markOptional?: boolean } = {},\n\t): Promise<string[]> {\n\t\tconst { markOptional = false } = opts;\n\t\tconst envVars = new Set<string>();\n\t\tconst optionalVars = new Set<string>();\n\t\tconst services: Service[] = compact([\n\t\t\t...this.services,\n\t\t\t// Each topic an event names is a dependency like any other.\n\t\t\t...this.events.map(({ topic }) => topic),\n\t\t\tthis.auditorStorageService,\n\t\t\tthis.databaseService,\n\t\t]);\n\n\t\ttry {\n\t\t\tfor (const service of services) {\n\t\t\t\t// Check cache first - handles singleton services that short-circuit\n\t\t\t\tif (serviceEnvCache.has(service)) {\n\t\t\t\t\tconst cached = serviceEnvCache.get(service)!;\n\t\t\t\t\tcached.envVars.forEach((v) => envVars.add(v));\n\t\t\t\t\tcached.optionalEnvVars.forEach((v) => optionalVars.add(v));\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t// Use sniffService to properly handle all error scenarios\n\t\t\t\tconst result = await sniffService(service);\n\n\t\t\t\t// Log any issues for debugging\n\t\t\t\tif (result.error) {\n\t\t\t\t\tthis.logger.warn(\n\t\t\t\t\t\t{ error: result.error.message, service: service.serviceName },\n\t\t\t\t\t\t'Service threw error during env sniffing (env vars still captured)',\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tif (result.unhandledRejections.length > 0) {\n\t\t\t\t\tthis.logger.warn(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\terrors: result.unhandledRejections.map((e) => e.message),\n\t\t\t\t\t\t\tservice: service.serviceName,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t'Fire-and-forget rejections during env sniffing (suppressed)',\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// Cache and collect env vars (both required and optional)\n\t\t\t\tserviceEnvCache.set(service, {\n\t\t\t\t\tenvVars: result.envVars,\n\t\t\t\t\toptionalEnvVars: result.optionalEnvVars,\n\t\t\t\t});\n\t\t\t\tresult.envVars.forEach((v) => envVars.add(v));\n\t\t\t\tresult.optionalEnvVars.forEach((v) => optionalVars.add(v));\n\t\t\t}\n\n\t\t\tconst sorted = Array.from(envVars).sort();\n\t\t\tif (!markOptional || optionalVars.size === 0) return sorted;\n\t\t\treturn sorted.map((v) => (optionalVars.has(v) ? `${v}?` : v));\n\t\t} catch (error) {\n\t\t\tthis.logger.error(\n\t\t\t\t{ err: error },\n\t\t\t\t'Error determining environment variables for construct',\n\t\t\t);\n\n\t\t\treturn [];\n\t\t}\n\t}\n}\n\nexport enum ConstructType {\n\tCron = 'dev.geekmidas.function.cron',\n\tEndpoint = 'dev.geekmidas.function.endpoint',\n\tFunction = 'dev.geekmidas.function.function',\n\tSubscriber = 'dev.geekmidas.function.subscriber',\n\tQueue = 'dev.geekmidas.function.queue',\n\tTopic = 'dev.geekmidas.resource.topic',\n\tProcessor = 'dev.geekmidas.function.processor',\n}\n\n/**\n * Utility to test sniffing a service for environment variables.\n * Useful for debugging services that throw errors during sniffing.\n *\n * @example\n * ```typescript\n * import { sniffService } from '@geekmidas/constructs';\n * import { authService } from './services/AuthService';\n *\n * const result = await sniffService(authService);\n * console.log('Env vars:', result.envVars);\n * console.log('Error:', result.error);\n * ```\n */\nexport async function sniffService(service: Service): Promise<SniffResult> {\n\tconst sniffer = new SnifferEnvironmentParser();\n\n\treturn sniffWithFireAndForget(sniffer, () =>\n\t\tservice.register({\n\t\t\tenvParser: sniffer as any,\n\t\t\tcontext: snifferContext,\n\t\t}),\n\t);\n}\n\n// Export for testing\nexport { snifferContext };\n"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;CAuBA,SAAS,QAAQ,OAAO;EACtB,IAAI,QAAQ,IACR,SAAS,QAAQ,MAAM,SAAS,GAChC,WAAW,GACX,SAAS,CAAC;EAEd,OAAO,EAAE,QAAQ,QAAQ;GACvB,IAAI,QAAQ,MAAM;GAClB,IAAI,OACF,OAAO,cAAc;EAEzB;EACA,OAAO;CACT;CAEA,OAAO,UAAU;;;;;ACvBjB,MAAM,kCAAkB,IAAI,IAG1B;;;;;;;AAQF,MAAM,iBAAiC;CACtC,YAAY;EAEX,OAAO;GACN,aAAa,CAAC;GACd,YAAY,CAAC;GACb,YAAY,CAAC;GACb,aAAa,CAAC;GACd,aAAa,eAAe,UAAU;EACvC;CACD;CACA,eAAe;EACd,OAAO;CACR;CACA,sBAAsB;EACrB,OAAO,KAAK,IAAI;CACjB;CACA,aAAa;EACZ,OAAO;CACR;CACA,UAAU,CAEV;AACD;AAEA,IAAsB,YAAtB,MAQE;CAmBgB;CACA;CACA;CAKA;CACT;CACS;CACA;CACA;CAcA;;CA1CjB;;;;;;;;;;;;;CAcA;CAEA,YACC,MACA,QACA,UAKA,SAAuC,CAAC,GACxC,cACA,SACA,YACA,uBAcA,aAAuC,CAAC,GACvC;EA1Be,KAAA,OAAA;EACA,KAAA,SAAA;EACA,KAAA,WAAA;EAKA,KAAA,SAAA;EACT,KAAA,eAAA;EACS,KAAA,UAAA;EACA,KAAA,aAAA;EACA,KAAA,wBAAA;EAcA,KAAA,aAAA;CACd;;;;;;;;;;;;;;;;;;;;;;;;CAyBH,MAAM,eACL,OAAmC,CAAC,GAChB;EACpB,MAAM,EAAE,eAAe,UAAU;EACjC,MAAM,0BAAU,IAAI,IAAY;EAChC,MAAM,+B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cAAA;CACA,cAAA,cAAA;CACA,cAAA,gBAAA;CACA,cAAA,WAAA;CACA,cAAA,WAAA;CACA,cAAA,eAAA;;AACD,EAAA,CAAA,CAAA;;;;;;;;;;;;;;;AAgBA,eAAsB,aAAa,SAAwC;CAC1E,MAAM,UAAU,IAAIC,0BAAAA,yBAAyB;CAE7C,QAAA,GAAOC,0BAAAA,uBAAAA,CAAuB,eAC7B,QAAQ,SAAS;EAChB,WAAW;EACX,SAAS;CACV,CAAC,CACF;AACD"}
|
|
@@ -3,9 +3,9 @@ import { SniffResult } from "@geekmidas/envkit/sniffer";
|
|
|
3
3
|
import { ConstructName, Declaration } from "@geekmidas/manifest";
|
|
4
4
|
import { EventPublisher, PublishableMessage } from "@geekmidas/events";
|
|
5
5
|
import { Service, ServiceContext, ServiceDiscovery } from "@geekmidas/services";
|
|
6
|
-
import { AuditStorage } from "@geekmidas/audit";
|
|
7
6
|
import { Logger } from "@geekmidas/logger";
|
|
8
7
|
import { InferStandardSchema } from "@geekmidas/schema";
|
|
8
|
+
import { AuditStorage } from "@geekmidas/audit";
|
|
9
9
|
//#region src/topic/Topic.d.ts
|
|
10
10
|
/** A topic's event contract — a map of event type → payload schema. */
|
|
11
11
|
type TopicEvents = Record<string, StandardSchemaV1>;
|
|
@@ -228,4 +228,4 @@ declare enum ConstructType {
|
|
|
228
228
|
declare function sniffService(service: Service): Promise<SniffResult>;
|
|
229
229
|
//#endregion
|
|
230
230
|
export { EventFor as a, Topic as c, TopicOptions as d, snifferContext as i, TopicEvents as l, ConstructType as n, TopicEvent as o, sniffService as r, publishConstructEvents as s, Construct as t, TopicMessage as u };
|
|
231
|
-
//# sourceMappingURL=Construct-
|
|
231
|
+
//# sourceMappingURL=Construct-BMk_CRSD.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Construct-
|
|
1
|
+
{"version":3,"file":"Construct-BMk_CRSD.d.mts","names":[],"sources":["../src/topic/Topic.ts","../src/publisher.ts","../src/Construct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;;;;;;;;;;EAAA;;;;;;;;;;;;;;;;;;;;;;;;EA0BX,eACL;IAAQ;MACN;;aAiEQ;EACX;EACA;EACA;EACA;EACA;EACA;EACA;;;;;;;;;;;;;;;;iBAiBqB,aAAa,SAAS,UAAU,QAAQ"}
|
|
@@ -7,6 +7,15 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
7
7
|
var __getProtoOf = Object.getPrototypeOf;
|
|
8
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
9
|
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
10
|
+
var __exportAll = (all, no_symbols) => {
|
|
11
|
+
let target = {};
|
|
12
|
+
for (var name in all) __defProp(target, name, {
|
|
13
|
+
get: all[name],
|
|
14
|
+
enumerable: true
|
|
15
|
+
});
|
|
16
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
17
|
+
return target;
|
|
18
|
+
};
|
|
10
19
|
var __copyProps = (to, from, except, desc) => {
|
|
11
20
|
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
12
21
|
key = keys[i];
|
|
@@ -218,6 +227,6 @@ async function sniffService(service) {
|
|
|
218
227
|
}));
|
|
219
228
|
}
|
|
220
229
|
//#endregion
|
|
221
|
-
export { __commonJSMin as a, snifferContext as i, ConstructType as n,
|
|
230
|
+
export { __commonJSMin as a, snifferContext as i, ConstructType as n, __exportAll as o, sniffService as r, __toESM as s, Construct as t };
|
|
222
231
|
|
|
223
|
-
//# sourceMappingURL=Construct-
|
|
232
|
+
//# sourceMappingURL=Construct-CRV3RN2U.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Construct-CGuc_Ijk.mjs","names":["compact"],"sources":["../../../node_modules/.pnpm/lodash.compact@3.0.1/node_modules/lodash.compact/index.js","../src/Construct.ts"],"sourcesContent":["/**\n * lodash 3.0.1 (Custom Build) <https://lodash.com/>\n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>\n * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>\n * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license <https://lodash.com/license>\n */\n\n/**\n * Creates an array with all falsey values removed. The values `false`, `null`,\n * `0`, `\"\"`, `undefined`, and `NaN` are falsey.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to compact.\n * @returns {Array} Returns the new array of filtered values.\n * @example\n *\n * _.compact([0, 1, false, 2, '', 3]);\n * // => [1, 2, 3]\n */\nfunction compact(array) {\n var index = -1,\n length = array ? array.length : 0,\n resIndex = 0,\n result = [];\n\n while (++index < length) {\n var value = array[index];\n if (value) {\n result[resIndex++] = value;\n }\n }\n return result;\n}\n\nmodule.exports = compact;\n","import type { AuditStorage } from '@geekmidas/audit';\nimport {\n\tSnifferEnvironmentParser,\n\ttype SniffResult,\n\tsniffWithFireAndForget,\n} from '@geekmidas/envkit/sniffer';\nimport type { Logger } from '@geekmidas/logger';\nimport type { Service, ServiceContext } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport compact from 'lodash.compact';\nimport type { TopicEvent } from './publisher';\n\n// Cache for service environment variables to handle singleton services\n// Stores both the full list and the optional subset so the same sniff result\n// can satisfy both getEnvironment() and getEnvironment({ markOptional: true }).\nconst serviceEnvCache = new Map<\n\tService,\n\t{ envVars: string[]; optionalEnvVars: string[] }\n>();\n\n/**\n * Noop context for environment sniffing.\n * Used when calling service.register() to detect env vars without a real request.\n * Returns dummy values since services should only use context in instance methods,\n * not during registration.\n */\nconst snifferContext: ServiceContext = {\n\tgetLogger() {\n\t\t// Return a noop logger for sniffing - services shouldn't log during registration\n\t\treturn {\n\t\t\tdebug: () => {},\n\t\t\tinfo: () => {},\n\t\t\twarn: () => {},\n\t\t\terror: () => {},\n\t\t\tchild: () => snifferContext.getLogger(),\n\t\t} as unknown as Logger;\n\t},\n\tgetRequestId() {\n\t\treturn 'sniffer-context';\n\t},\n\tgetRequestStartTime() {\n\t\treturn Date.now();\n\t},\n\thasContext() {\n\t\treturn false;\n\t},\n\tgetUser() {\n\t\treturn undefined;\n\t},\n};\n\nexport abstract class Construct<\n\tTLogger extends Logger = Logger,\n\tOutSchema extends StandardSchemaV1 | undefined = undefined,\n\tTServices extends Service[] = [],\n\tTAuditStorageServiceName extends string = string,\n\tTAuditStorage extends AuditStorage | undefined = undefined,\n\tTDatabaseServiceName extends string = string,\n\tTDatabase = unknown,\n> {\n\t/** Database service for this construct (used by Endpoint for RLS/audit context) */\n\tpublic databaseService?: Service<TDatabaseServiceName, TDatabase>;\n\n\t/**\n\t * The deploy unit that runs this, by construct id.\n\t *\n\t * What an endpoint's `surface` is to it, and for the same reason: something\n\t * has to say which process a runnable belongs to, and until this existed the\n\t * only thing that said so was the directory its file sat in. Set by the\n\t * factory it was built from — `worker.crons`, `api.get(…)` — so it is\n\t * carried rather than configured.\n\t *\n\t * Undefined for a construct built from a free-standing builder, which is\n\t * still how `c`, `s` and `f` work.\n\t */\n\tpublic owner?: string;\n\n\tconstructor(\n\t\tpublic readonly type: ConstructType,\n\t\tpublic readonly logger: TLogger,\n\t\tpublic readonly services: TServices,\n\t\t/**\n\t\t * What this construct publishes once its handler succeeds — each event\n\t\t * bound to its own topic, so a construct publishes to as many as it names.\n\t\t */\n\t\tpublic readonly events: TopicEvent[] = [],\n\t\tpublic outputSchema?: OutSchema,\n\t\tpublic readonly timeout?: number,\n\t\tpublic readonly memorySize?: number,\n\t\tpublic readonly auditorStorageService?: Service<\n\t\t\tTAuditStorageServiceName,\n\t\t\tTAuditStorage\n\t\t>,\n\t\t/**\n\t\t * The constructs this one declared an edge to, by id.\n\t\t *\n\t\t * What the manifest records. `services` is the same information in the\n\t\t * form a handler runs with — clients, keyed by name — and an id cannot be\n\t\t * recovered from one of those reliably, so both are kept.\n\t\t *\n\t\t * Last in the list because every other parameter is positional and already\n\t\t * spoken for; a new one anywhere else silently rebinds existing callers.\n\t\t */\n\t\tpublic readonly constructs: string[] = [],\n\t) {}\n\n\t/**\n\t * Returns an array of environment variable names required by this construct's services.\n\t * This is determined by running a \"sniffer\" EnvironmentParser through each service's\n\t * register method to track which environment variables are accessed.\n\t *\n\t * Results are cached per service class to handle singleton patterns where\n\t * subsequent register() calls may short-circuit and not access env vars.\n\t *\n\t * @param markOptional - When true, optional vars (those accessed via `.optional()` or\n\t * `.default()`) are suffixed with `?` in the returned array (e.g. `'PORT?'`).\n\t * @returns Promise that resolves to array of environment variable names, sorted alphabetically\n\t *\n\t * @example\n\t * ```typescript\n\t * const endpoint = e\n\t * .services([databaseService, authService])\n\t * .get('/users')\n\t * .handle(async () => []);\n\t *\n\t * await endpoint.getEnvironment(); // ['AUTH_SECRET', 'DATABASE_URL']\n\t * await endpoint.getEnvironment({ markOptional: true }); // ['AUTH_SECRET', 'DATABASE_URL', 'PORT?']\n\t * ```\n\t */\n\tasync getEnvironment(\n\t\topts: { markOptional?: boolean } = {},\n\t): Promise<string[]> {\n\t\tconst { markOptional = false } = opts;\n\t\tconst envVars = new Set<string>();\n\t\tconst optionalVars = new Set<string>();\n\t\tconst services: Service[] = compact([\n\t\t\t...this.services,\n\t\t\t// Each topic an event names is a dependency like any other.\n\t\t\t...this.events.map(({ topic }) => topic),\n\t\t\tthis.auditorStorageService,\n\t\t\tthis.databaseService,\n\t\t]);\n\n\t\ttry {\n\t\t\tfor (const service of services) {\n\t\t\t\t// Check cache first - handles singleton services that short-circuit\n\t\t\t\tif (serviceEnvCache.has(service)) {\n\t\t\t\t\tconst cached = serviceEnvCache.get(service)!;\n\t\t\t\t\tcached.envVars.forEach((v) => envVars.add(v));\n\t\t\t\t\tcached.optionalEnvVars.forEach((v) => optionalVars.add(v));\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t// Use sniffService to properly handle all error scenarios\n\t\t\t\tconst result = await sniffService(service);\n\n\t\t\t\t// Log any issues for debugging\n\t\t\t\tif (result.error) {\n\t\t\t\t\tthis.logger.warn(\n\t\t\t\t\t\t{ error: result.error.message, service: service.serviceName },\n\t\t\t\t\t\t'Service threw error during env sniffing (env vars still captured)',\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tif (result.unhandledRejections.length > 0) {\n\t\t\t\t\tthis.logger.warn(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\terrors: result.unhandledRejections.map((e) => e.message),\n\t\t\t\t\t\t\tservice: service.serviceName,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t'Fire-and-forget rejections during env sniffing (suppressed)',\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// Cache and collect env vars (both required and optional)\n\t\t\t\tserviceEnvCache.set(service, {\n\t\t\t\t\tenvVars: result.envVars,\n\t\t\t\t\toptionalEnvVars: result.optionalEnvVars,\n\t\t\t\t});\n\t\t\t\tresult.envVars.forEach((v) => envVars.add(v));\n\t\t\t\tresult.optionalEnvVars.forEach((v) => optionalVars.add(v));\n\t\t\t}\n\n\t\t\tconst sorted = Array.from(envVars).sort();\n\t\t\tif (!markOptional || optionalVars.size === 0) return sorted;\n\t\t\treturn sorted.map((v) => (optionalVars.has(v) ? `${v}?` : v));\n\t\t} catch (error) {\n\t\t\tthis.logger.error(\n\t\t\t\t{ err: error },\n\t\t\t\t'Error determining environment variables for construct',\n\t\t\t);\n\n\t\t\treturn [];\n\t\t}\n\t}\n}\n\nexport enum ConstructType {\n\tCron = 'dev.geekmidas.function.cron',\n\tEndpoint = 'dev.geekmidas.function.endpoint',\n\tFunction = 'dev.geekmidas.function.function',\n\tSubscriber = 'dev.geekmidas.function.subscriber',\n\tQueue = 'dev.geekmidas.function.queue',\n\tTopic = 'dev.geekmidas.resource.topic',\n\tProcessor = 'dev.geekmidas.function.processor',\n}\n\n/**\n * Utility to test sniffing a service for environment variables.\n * Useful for debugging services that throw errors during sniffing.\n *\n * @example\n * ```typescript\n * import { sniffService } from '@geekmidas/constructs';\n * import { authService } from './services/AuthService';\n *\n * const result = await sniffService(authService);\n * console.log('Env vars:', result.envVars);\n * console.log('Error:', result.error);\n * ```\n */\nexport async function sniffService(service: Service): Promise<SniffResult> {\n\tconst sniffer = new SnifferEnvironmentParser();\n\n\treturn sniffWithFireAndForget(sniffer, () =>\n\t\tservice.register({\n\t\t\tenvParser: sniffer as any,\n\t\t\tcontext: snifferContext,\n\t\t}),\n\t);\n}\n\n// Export for testing\nexport { snifferContext };\n"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuBA,SAAS,QAAQ,OAAO;EACtB,IAAI,QAAQ,IACR,SAAS,QAAQ,MAAM,SAAS,GAChC,WAAW,GACX,SAAS,CAAC;EAEd,OAAO,EAAE,QAAQ,QAAQ;GACvB,IAAI,QAAQ,MAAM;GAClB,IAAI,OACF,OAAO,cAAc;EAEzB;EACA,OAAO;CACT;CAEA,OAAO,UAAU;;ACvBjB,MAAM,kCAAkB,IAAI,IAG1B;;;;;;;AAQF,MAAM,iBAAiC;CACtC,YAAY;EAEX,OAAO;GACN,aAAa,CAAC;GACd,YAAY,CAAC;GACb,YAAY,CAAC;GACb,aAAa,CAAC;GACd,aAAa,eAAe,UAAU;EACvC;CACD;CACA,eAAe;EACd,OAAO;CACR;CACA,sBAAsB;EACrB,OAAO,KAAK,IAAI;CACjB;CACA,aAAa;EACZ,OAAO;CACR;CACA,UAAU,CAEV;AACD;AAEA,IAAsB,YAAtB,MAQE;CAmBgB;CACA;CACA;CAKA;CACT;CACS;CACA;CACA;CAcA;;CA1CjB;;;;;;;;;;;;;CAcA;CAEA,YACC,MACA,QACA,UAKA,SAAuC,CAAC,GACxC,cACA,SACA,YACA,uBAcA,aAAuC,CAAC,GACvC;EA1Be,KAAA,OAAA;EACA,KAAA,SAAA;EACA,KAAA,WAAA;EAK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OAAO;GACrD,OAAO,OAAO,KAAK,MAAO,aAAa,IAAI,CAAC,IAAI,GAAG,EAAE,KAAK,CAAE;EAC7D,SAAS,OAAO;GACf,KAAK,OAAO,MACX,EAAE,KAAK,MAAM,GACb,uDACD;GAEA,OAAO,CAAC;EACT;CACD;AACD;AAEA,IAAY,gBAAL,yBAAA,eAAA;CACN,cAAA,UAAA;CACA,cAAA,cAAA;CACA,cAAA,cAAA;CACA,cAAA,gBAAA;CACA,cAAA,WAAA;CACA,cAAA,WAAA;CACA,cAAA,eAAA;;AACD,EAAA,CAAA,CAAA;;;;;;;;;;;;;;;AAgBA,eAAsB,aAAa,SAAwC;CAC1E,MAAM,UAAU,IAAI,yBAAyB;CAE7C,OAAO,uBAAuB,eAC7B,QAAQ,SAAS;EAChB,WAAW;EACX,SAAS;CACV,CAAC,CACF;AACD"}
|
|
1
|
+
{"version":3,"file":"Construct-CRV3RN2U.mjs","names":["compact"],"sources":["../../../node_modules/.pnpm/lodash.compact@3.0.1/node_modules/lodash.compact/index.js","../src/Construct.ts"],"sourcesContent":["/**\n * lodash 3.0.1 (Custom Build) <https://lodash.com/>\n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>\n * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>\n * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license <https://lodash.com/license>\n */\n\n/**\n * Creates an array with all falsey values removed. The values `false`, `null`,\n * `0`, `\"\"`, `undefined`, and `NaN` are falsey.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to compact.\n * @returns {Array} Returns the new array of filtered values.\n * @example\n *\n * _.compact([0, 1, false, 2, '', 3]);\n * // => [1, 2, 3]\n */\nfunction compact(array) {\n var index = -1,\n length = array ? array.length : 0,\n resIndex = 0,\n result = [];\n\n while (++index < length) {\n var value = array[index];\n if (value) {\n result[resIndex++] = value;\n }\n }\n return result;\n}\n\nmodule.exports = compact;\n","import type { AuditStorage } from '@geekmidas/audit';\nimport {\n\tSnifferEnvironmentParser,\n\ttype SniffResult,\n\tsniffWithFireAndForget,\n} from '@geekmidas/envkit/sniffer';\nimport type { Logger } from '@geekmidas/logger';\nimport type { Service, ServiceContext } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport compact from 'lodash.compact';\nimport type { TopicEvent } from './publisher';\n\n// Cache for service environment variables to handle singleton services\n// Stores both the full list and the optional subset so the same sniff result\n// can satisfy both getEnvironment() and getEnvironment({ markOptional: true }).\nconst serviceEnvCache = new Map<\n\tService,\n\t{ envVars: string[]; optionalEnvVars: string[] }\n>();\n\n/**\n * Noop context for environment sniffing.\n * Used when calling service.register() to detect env vars without a real request.\n * Returns dummy values since services should only use context in instance methods,\n * not during registration.\n */\nconst snifferContext: ServiceContext = {\n\tgetLogger() {\n\t\t// Return a noop logger for sniffing - services shouldn't log during registration\n\t\treturn {\n\t\t\tdebug: () => {},\n\t\t\tinfo: () => {},\n\t\t\twarn: () => {},\n\t\t\terror: () => {},\n\t\t\tchild: () => snifferContext.getLogger(),\n\t\t} as unknown as Logger;\n\t},\n\tgetRequestId() {\n\t\treturn 'sniffer-context';\n\t},\n\tgetRequestStartTime() {\n\t\treturn Date.now();\n\t},\n\thasContext() {\n\t\treturn false;\n\t},\n\tgetUser() {\n\t\treturn undefined;\n\t},\n};\n\nexport abstract class Construct<\n\tTLogger extends Logger = Logger,\n\tOutSchema extends StandardSchemaV1 | undefined = undefined,\n\tTServices extends Service[] = [],\n\tTAuditStorageServiceName extends string = string,\n\tTAuditStorage extends AuditStorage | undefined = undefined,\n\tTDatabaseServiceName extends string = string,\n\tTDatabase = unknown,\n> {\n\t/** Database service for this construct (used by Endpoint for RLS/audit context) */\n\tpublic databaseService?: Service<TDatabaseServiceName, TDatabase>;\n\n\t/**\n\t * The deploy unit that runs this, by construct id.\n\t *\n\t * What an endpoint's `surface` is to it, and for the same reason: something\n\t * has to say which process a runnable belongs to, and until this existed the\n\t * only thing that said so was the directory its file sat in. Set by the\n\t * factory it was built from — `worker.crons`, `api.get(…)` — so it is\n\t * carried rather than configured.\n\t *\n\t * Undefined for a construct built from a free-standing builder, which is\n\t * still how `c`, `s` and `f` work.\n\t */\n\tpublic owner?: string;\n\n\tconstructor(\n\t\tpublic readonly type: ConstructType,\n\t\tpublic readonly logger: TLogger,\n\t\tpublic readonly services: TServices,\n\t\t/**\n\t\t * What this construct publishes once its handler succeeds — each event\n\t\t * bound to its own topic, so a construct publishes to as many as it names.\n\t\t */\n\t\tpublic readonly events: TopicEvent[] = [],\n\t\tpublic outputSchema?: OutSchema,\n\t\tpublic readonly timeout?: number,\n\t\tpublic readonly memorySize?: number,\n\t\tpublic readonly auditorStorageService?: Service<\n\t\t\tTAuditStorageServiceName,\n\t\t\tTAuditStorage\n\t\t>,\n\t\t/**\n\t\t * The constructs this one declared an edge to, by id.\n\t\t *\n\t\t * What the manifest records. `services` is the same information in the\n\t\t * form a handler runs with — clients, keyed by name — and an id cannot be\n\t\t * recovered from one of those reliably, so both are kept.\n\t\t *\n\t\t * Last in the list because every other parameter is positional and already\n\t\t * spoken for; a new one anywhere else silently rebinds existing callers.\n\t\t */\n\t\tpublic readonly constructs: string[] = [],\n\t) {}\n\n\t/**\n\t * Returns an array of environment variable names required by this construct's services.\n\t * This is determined by running a \"sniffer\" EnvironmentParser through each service's\n\t * register method to track which environment variables are accessed.\n\t *\n\t * Results are cached per service class to handle singleton patterns where\n\t * subsequent register() calls may short-circuit and not access env vars.\n\t *\n\t * @param markOptional - When true, optional vars (those accessed via `.optional()` or\n\t * `.default()`) are suffixed with `?` in the returned array (e.g. `'PORT?'`).\n\t * @returns Promise that resolves to array of environment variable names, sorted alphabetically\n\t *\n\t * @example\n\t * ```typescript\n\t * const endpoint = e\n\t * .services([databaseService, authService])\n\t * .get('/users')\n\t * .handle(async () => []);\n\t *\n\t * await endpoint.getEnvironment(); // ['AUTH_SECRET', 'DATABASE_URL']\n\t * await endpoint.getEnvironment({ markOptional: true }); // ['AUTH_SECRET', 'DATABASE_URL', 'PORT?']\n\t * ```\n\t */\n\tasync getEnvironment(\n\t\topts: { markOptional?: boolean } = {},\n\t): Promise<string[]> {\n\t\tconst { markOptional = false } = opts;\n\t\tconst envVars = new Set<string>();\n\t\tconst optionalVars = new Set<string>();\n\t\tconst services: Service[] = compact([\n\t\t\t...this.services,\n\t\t\t// Each topic an event names is a dependency like any other.\n\t\t\t...this.events.map(({ topic }) => topic),\n\t\t\tthis.auditorStorageService,\n\t\t\tthis.databaseService,\n\t\t]);\n\n\t\ttry {\n\t\t\tfor (const service of services) {\n\t\t\t\t// Check cache first - handles singleton services that short-circuit\n\t\t\t\tif (serviceEnvCache.has(service)) {\n\t\t\t\t\tconst cached = serviceEnvCache.get(service)!;\n\t\t\t\t\tcached.envVars.forEach((v) => envVars.add(v));\n\t\t\t\t\tcached.optionalEnvVars.forEach((v) => optionalVars.add(v));\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t// Use sniffService to properly handle all error scenarios\n\t\t\t\tconst result = await sniffService(service);\n\n\t\t\t\t// Log any issues for debugging\n\t\t\t\tif (result.error) {\n\t\t\t\t\tthis.logger.warn(\n\t\t\t\t\t\t{ error: result.error.message, service: service.serviceName },\n\t\t\t\t\t\t'Service threw error during env sniffing (env vars still captured)',\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tif (result.unhandledRejections.length > 0) {\n\t\t\t\t\tthis.logger.warn(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\terrors: result.unhandledRejections.map((e) => e.message),\n\t\t\t\t\t\t\tservice: service.serviceName,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t'Fire-and-forget rejections during env sniffing (suppressed)',\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// Cache and collect env vars (both required and optional)\n\t\t\t\tserviceEnvCache.set(service, {\n\t\t\t\t\tenvVars: result.envVars,\n\t\t\t\t\toptionalEnvVars: result.optionalEnvVars,\n\t\t\t\t});\n\t\t\t\tresult.envVars.forEach((v) => envVars.add(v));\n\t\t\t\tresult.optionalEnvVars.forEach((v) => optionalVars.add(v));\n\t\t\t}\n\n\t\t\tconst sorted = Array.from(envVars).sort();\n\t\t\tif (!markOptional || optionalVars.size === 0) return sorted;\n\t\t\treturn sorted.map((v) => (optionalVars.has(v) ? `${v}?` : v));\n\t\t} catch (error) {\n\t\t\tthis.logger.error(\n\t\t\t\t{ err: error },\n\t\t\t\t'Error determining environment variables for construct',\n\t\t\t);\n\n\t\t\treturn [];\n\t\t}\n\t}\n}\n\nexport enum ConstructType {\n\tCron = 'dev.geekmidas.function.cron',\n\tEndpoint = 'dev.geekmidas.function.endpoint',\n\tFunction = 'dev.geekmidas.function.function',\n\tSubscriber = 'dev.geekmidas.function.subscriber',\n\tQueue = 'dev.geekmidas.function.queue',\n\tTopic = 'dev.geekmidas.resource.topic',\n\tProcessor = 'dev.geekmidas.function.processor',\n}\n\n/**\n * Utility to test sniffing a service for environment variables.\n * Useful for debugging services that throw errors during sniffing.\n *\n * @example\n * ```typescript\n * import { sniffService } from '@geekmidas/constructs';\n * import { authService } from './services/AuthService';\n *\n * const result = await sniffService(authService);\n * console.log('Env vars:', result.envVars);\n * console.log('Error:', result.error);\n * ```\n */\nexport async function sniffService(service: Service): Promise<SniffResult> {\n\tconst sniffer = new SnifferEnvironmentParser();\n\n\treturn sniffWithFireAndForget(sniffer, () =>\n\t\tservice.register({\n\t\t\tenvParser: sniffer as any,\n\t\t\tcontext: snifferContext,\n\t\t}),\n\t);\n}\n\n// Export for testing\nexport { snifferContext };\n"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuBA,SAAS,QAAQ,OAAO;EACtB,IAAI,QAAQ,IACR,SAAS,QAAQ,MAAM,SAAS,GAChC,WAAW,GACX,SAAS,CAAC;EAEd,OA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|
|
1
1
|
import { n as StandardSchemaV1 } from "./index-DdRjYhiJ.mjs";
|
|
2
|
-
import { o as TopicEvent } from "./Construct-
|
|
3
|
-
import { i as FunctionHandler, n as Function } from "./Function-
|
|
4
|
-
import "./index-
|
|
2
|
+
import { o as TopicEvent } from "./Construct-BMk_CRSD.mjs";
|
|
3
|
+
import { i as FunctionHandler, n as Function } from "./Function-BKReud5p.mjs";
|
|
4
|
+
import "./index-BoQ3-M-K.mjs";
|
|
5
5
|
import { Service } from "@geekmidas/services";
|
|
6
|
-
import { AuditableAction } from "@geekmidas/audit";
|
|
7
6
|
import { Logger } from "@geekmidas/logger";
|
|
8
7
|
import { ComposableStandardSchema } from "@geekmidas/schema";
|
|
8
|
+
import { AuditableAction } from "@geekmidas/audit";
|
|
9
9
|
//#region src/crons/Cron.d.ts
|
|
10
10
|
declare class Cron<TInput extends ComposableStandardSchema | undefined = undefined, TServices extends Service[] = [], TLogger extends Logger = Logger, OutSchema extends StandardSchemaV1 | undefined = undefined, TDatabase = undefined, TDatabaseServiceName extends string = string> extends Function<TInput, TServices, TLogger, OutSchema, undefined, string, TDatabase, TDatabaseServiceName, AuditableAction<string, unknown>, FunctionHandler<TInput, TServices, TLogger, OutSchema, TDatabase>> {
|
|
11
11
|
protected _schedule?: ScheduleExpression | undefined;
|
|
@@ -42,4 +42,4 @@ type CronExpression = `cron(${CronMinute} ${CronHour} ${CronDay} ${CronMonth} ${
|
|
|
42
42
|
type ScheduleExpression = RateExpression | CronExpression;
|
|
43
43
|
//#endregion
|
|
44
44
|
export { ScheduleExpression as i, CronExpression as n, RateExpression as r, Cron as t };
|
|
45
|
-
//# sourceMappingURL=Cron-
|
|
45
|
+
//# sourceMappingURL=Cron-D6Y7BBt3.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Cron-
|
|
1
|
+
{"version":3,"file":"Cron-D6Y7BBt3.d.mts","names":[],"sources":["../src/crons/Cron.ts"],"mappings":";;;;;;;;;cAUa,KACZ,eAAe,kDACf,kBAAkB,gBAClB,gBAAgB,SAAS,QACzB,kBAAkB,0CAClB,uBACA,sDACS,SACT,QACA,WACA,SACA,8BAGA,WACA,sBACA,kCACA,gBAAgB,QAAQ,WAAW,SAAS,WAAW;YA0B5C,YAAY;;;;;;;;;;;;EAbvB,gBAAgB;SAET,OAAO,WAAW,OAAO;EAQhC,YACC,IAAI,gBAAgB,QAAQ,WAAW,SAAS,WAAW,YAC3D,kBACU,YAAY,gCACtB,QAAQ,QACR,eAAe,WACf,WAAU,WACV,SAAS,SAET;;EAAA,SAAQ,cACR,qBACA,kBAAkB,QAAQ,sBAAsB,YAKhD;;;;;EAAA;MAkBG,YAAY;;KAKL;KAEP;KAUA;KAUA;KAUA;KAqBA;KAiBO,yBACH,cAAc,YAAY,WAAW,aAAa;KAE/C,qBAAqB,iBAAiB"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { n as StandardSchemaV1 } from "./index-DdRjYhiJ.mjs";
|
|
2
|
-
import { a as EventFor, c as Topic } from "./Construct-
|
|
3
|
-
import { i as FunctionHandler } from "./Function-
|
|
2
|
+
import { a as EventFor, c as Topic } from "./Construct-BMk_CRSD.mjs";
|
|
3
|
+
import { i as FunctionHandler } from "./Function-BKReud5p.mjs";
|
|
4
4
|
import { c as ServicesOf, r as Consumable } from "./construct-interface-CSA9VeWM.mjs";
|
|
5
|
-
import { t as FunctionBuilder } from "./index-
|
|
6
|
-
import { i as ScheduleExpression, t as Cron } from "./Cron-
|
|
5
|
+
import { t as FunctionBuilder } from "./index-BoQ3-M-K.mjs";
|
|
6
|
+
import { i as ScheduleExpression, t as Cron } from "./Cron-D6Y7BBt3.mjs";
|
|
7
7
|
import { Service } from "@geekmidas/services";
|
|
8
8
|
import { Logger } from "@geekmidas/logger";
|
|
9
9
|
import { ComposableStandardSchema, InferStandardSchema } from "@geekmidas/schema";
|
|
@@ -44,4 +44,4 @@ declare class CronBuilder<TInput extends ComposableStandardSchema, TServices ext
|
|
|
44
44
|
}
|
|
45
45
|
//#endregion
|
|
46
46
|
export { CronBuilder as t };
|
|
47
|
-
//# sourceMappingURL=CronBuilder-
|
|
47
|
+
//# sourceMappingURL=CronBuilder-4BZhkChG.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CronBuilder-
|
|
1
|
+
{"version":3,"file":"CronBuilder-4BZhkChG.d.mts","names":[],"sources":["../src/crons/CronBuilder.ts"],"mappings":";;;;;;;;;;cAuBa,YACZ,eAAe,0BACf,kBAAkB,WAClB,gBAAgB,SAAS,QACzB,kBAAkB,0CAClB,uBACA,sDACS,gBACT,QACA,WACA,WACA,4BAGA,WACA;UAEQ;EAER;EAIS,WAAW;EAIpB,SACC,aAAa,qBACX,YACF,QACA,WACA,SACA,WACA,WACA;EAKQ,MAAM,UAAU,0BACxB,QAAQ,IACN,YACF,GACA,WACA,SACA,WACA,WACA;EAcQ,OAAO,UAAU,kBACzB,QAAQ,IACN,YACF,QACA,WACA,SACA,GACA,WACA;;;;;;;;;;;;EAyBQ,gBAAgB,mBAAmB,cAC3C,YAAY,IACV,YACF,YACI,cAAc,WAAW,KAC7B,SACA,WACA,WACA;EA2BQ,SAAS,UAAU,WAC3B,UAAU,IACR,YACF,YACI,cAAc,IAClB,SACA,WACA,WACA;EAiBQ,OAAO,UAAU,QACzB,QAAQ,IACN,YACF,QACA,WACA,GACA,WACA,WACA;;;;;;EAmBQ,MAAM,eAAe,iBAC7B,OAAO,QACP,OAAO,SAAS,QAAQ,oBAAoB,cAC1C,YACF,YACI,WAAW,oBACf,SACA,WACA,WACA;;;;;EAgBQ,SAAS,GAAG,sBACpB,QAAQ,WAAW,OAAO,KAAK,QAAQ,OAAO,KAC5C,YAAY,QAAQ,WAAW,SAAS,WAAW,GAAG;EA8BhD,OACR,IAAI,gBAAgB,QAAQ,WAAW,SAAS,WAAW,aACzD,KACF,QACA,WACA,SACA,WACA,WACA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const require_rolldown_runtime = require("./rolldown-runtime-
|
|
2
|
-
require("./Construct-
|
|
1
|
+
const require_rolldown_runtime = require("./rolldown-runtime-Ctb5zv51.cjs");
|
|
2
|
+
require("./Construct-B8yWxGlR.cjs");
|
|
3
3
|
const require_construct_interface = require("./construct-interface.cjs");
|
|
4
|
-
const require_functions = require("./functions-
|
|
4
|
+
const require_functions = require("./functions-BqAq_0xQ.cjs");
|
|
5
5
|
const require_clone = require("./clone-UGJpvQnL.cjs");
|
|
6
6
|
//#region src/crons/Cron.ts
|
|
7
7
|
var import_lodash_uniqby = /* @__PURE__ */ require_rolldown_runtime.__toESM(require_functions.require_lodash_uniqby(), 1);
|
|
@@ -118,4 +118,4 @@ Object.defineProperty(exports, "CronBuilder", {
|
|
|
118
118
|
}
|
|
119
119
|
});
|
|
120
120
|
|
|
121
|
-
//# sourceMappingURL=CronBuilder-
|
|
121
|
+
//# sourceMappingURL=CronBuilder-B4DYaEjl.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CronBuilder-B_NSP-Y5.cjs","names":["Function","FunctionBuilder","cloneWith","servicesOf","uniqBy","idsOf","serviceOf","databaseEdges"],"sources":["../src/crons/Cron.ts","../src/crons/CronBuilder.ts"],"sourcesContent":["import type { AuditableAction } from '@geekmidas/audit';\nimport type { EventPublisher } from '@geekmidas/events';\nimport type { Logger } from '@geekmidas/logger';\nimport type { ComposableStandardSchema } from '@geekmidas/schema';\nimport type { Service } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport { ConstructType } from '../Construct';\nimport { Function, type FunctionHandler } from '../functions';\nimport type { TopicEvent } from '../publisher';\n\nexport class Cron<\n\tTInput extends ComposableStandardSchema | undefined = undefined,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tOutSchema extends StandardSchemaV1 | undefined = undefined,\n\tTDatabase = undefined,\n\tTDatabaseServiceName extends string = string,\n> extends Function<\n\tTInput,\n\tTServices,\n\tTLogger,\n\tOutSchema,\n\tundefined,\n\tstring,\n\tTDatabase,\n\tTDatabaseServiceName,\n\tAuditableAction<string, unknown>,\n\tFunctionHandler<TInput, TServices, TLogger, OutSchema, TDatabase>\n> {\n\t/**\n\t * Where this cron's schedule lives when a server runs it.\n\t *\n\t * Carried from the worker that built it, which declared it once with\n\t * `.database(db)`. Unread on AWS, where the schedule is an EventBridge rule\n\t * and nothing in this process fires anything.\n\t *\n\t * A service rather than the construct, because what reads it is service\n\t * discovery in the generated server — which registers services, and failed\n\t * on the construct with `service.register is not a function`.\n\t */\n\tscheduleStore?: Service<string, unknown>;\n\n\tstatic isCron(obj: any): obj is Cron<any, any, any, any> {\n\t\treturn Boolean(\n\t\t\tobj &&\n\t\t\t\t(obj as Function).__IS_FUNCTION__ === true &&\n\t\t\t\tobj.type === ConstructType.Cron,\n\t\t);\n\t}\n\n\tconstructor(\n\t\tfn: FunctionHandler<TInput, TServices, TLogger, OutSchema, TDatabase>,\n\t\ttimeout?: number,\n\t\tprotected _schedule?: ScheduleExpression,\n\t\tinput?: TInput,\n\t\toutputSchema?: OutSchema,\n\t\tservices: TServices = [] as unknown as TServices,\n\t\tlogger?: TLogger,\n\t\t/** What it publishes once it has run, each to its own topic. */\n\t\tevents: TopicEvent[] = [],\n\t\tmemorySize?: number,\n\t\tdatabaseService?: Service<TDatabaseServiceName, TDatabase>,\n\t\t/**\n\t\t * The construct ids `.dependsOn()` named — last, so no existing positional\n\t\t * argument moves.\n\t\t */\n\t\tconstructs: string[] = [],\n\t) {\n\t\tsuper(\n\t\t\tfn,\n\t\t\ttimeout,\n\t\t\tConstructType.Cron,\n\t\t\tinput,\n\t\t\toutputSchema,\n\t\t\tservices,\n\t\t\tlogger,\n\t\t\tevents,\n\t\t\tmemorySize,\n\t\t\tundefined, // auditorStorageService\n\t\t\tdatabaseService,\n\t\t\tconstructs,\n\t\t);\n\t}\n\n\tget schedule(): ScheduleExpression | undefined {\n\t\treturn this._schedule;\n\t}\n}\n\nexport type RateExpression = `rate(${string})`;\n\ntype CronMinute =\n\t| '*'\n\t| number\n\t| `${number}`\n\t| `${number}-${number}`\n\t| `${number}/${number}`\n\t| `*/${number}`\n\t| `${number},${number}`\n\t| string; // Allow more complex patterns\n\ntype CronHour =\n\t| '*'\n\t| number\n\t| `${number}`\n\t| `${number}-${number}`\n\t| `${number}/${number}`\n\t| `*/${number}`\n\t| `${number},${number}`\n\t| string; // Allow more complex patterns\n\ntype CronDay =\n\t| '*'\n\t| number\n\t| `${number}`\n\t| `${number}-${number}`\n\t| `${number}/${number}`\n\t| `*/${number}`\n\t| `${number},${number}`\n\t| string; // Allow more complex patterns\n\ntype CronMonth =\n\t| '*'\n\t| number\n\t| `${number}`\n\t| `${number}-${number}`\n\t| `${number}/${number}`\n\t| `*/${number}`\n\t| 'JAN'\n\t| 'FEB'\n\t| 'MAR'\n\t| 'APR'\n\t| 'MAY'\n\t| 'JUN'\n\t| 'JUL'\n\t| 'AUG'\n\t| 'SEP'\n\t| 'OCT'\n\t| 'NOV'\n\t| 'DEC'\n\t| string; // Allow more complex patterns\n\ntype CronWeekday =\n\t| '*'\n\t| number\n\t| `${number}`\n\t| `${number}-${number}`\n\t| `${number}/${number}`\n\t| `*/${number}`\n\t| 'SUN'\n\t| 'MON'\n\t| 'TUE'\n\t| 'WED'\n\t| 'THU'\n\t| 'FRI'\n\t| 'SAT'\n\t| `${string}-${string}` // Allow patterns like MON-FRI\n\t| string; // Allow more complex patterns\n\nexport type CronExpression =\n\t`cron(${CronMinute} ${CronHour} ${CronDay} ${CronMonth} ${CronWeekday})`;\n\nexport type ScheduleExpression = RateExpression | CronExpression;\n","import type { Logger } from '@geekmidas/logger';\nimport type {\n\tComposableStandardSchema,\n\tInferStandardSchema,\n} from '@geekmidas/schema';\nimport type { Service } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport uniqBy from 'lodash.uniqby';\nimport { ConstructType } from '../Construct';\nimport { cloneWith } from '../clone';\nimport {\n\ttype Consumable,\n\tdatabaseEdges,\n\tidsOf,\n\ttype ServicesOf,\n\tserviceOf,\n\tservicesOf,\n} from '../construct-interface';\nimport { FunctionBuilder, type FunctionHandler } from '../functions';\nimport type { EventFor } from '../publisher';\nimport type { Topic } from '../topic/Topic';\nimport { Cron, type ScheduleExpression } from './Cron';\n\nexport class CronBuilder<\n\tTInput extends ComposableStandardSchema,\n\tTServices extends Service[],\n\tTLogger extends Logger = Logger,\n\tOutSchema extends StandardSchemaV1 | undefined = undefined,\n\tTDatabase = undefined,\n\tTDatabaseServiceName extends string = string,\n> extends FunctionBuilder<\n\tTInput,\n\tOutSchema,\n\tTServices,\n\tTLogger,\n\tundefined,\n\tstring,\n\tTDatabase,\n\tTDatabaseServiceName\n> {\n\tprivate _schedule?: ScheduleExpression;\n\n\tconstructor() {\n\t\tsuper(ConstructType.Cron);\n\t}\n\n\toverride memorySize(memorySize: number): this {\n\t\treturn cloneWith(this, { _memorySize: memorySize });\n\t}\n\n\tschedule(\n\t\t_expression: ScheduleExpression,\n\t): CronBuilder<\n\t\tTInput,\n\t\tTServices,\n\t\tTLogger,\n\t\tOutSchema,\n\t\tTDatabase,\n\t\tTDatabaseServiceName\n\t> {\n\t\treturn cloneWith(this, { _schedule: _expression });\n\t}\n\n\toverride input<T extends ComposableStandardSchema>(\n\t\tschema: T,\n\t): CronBuilder<\n\t\tT,\n\t\tTServices,\n\t\tTLogger,\n\t\tOutSchema,\n\t\tTDatabase,\n\t\tTDatabaseServiceName\n\t> {\n\t\treturn cloneWith(this, {\n\t\t\tinputSchema: schema as unknown as TInput,\n\t\t}) as unknown as CronBuilder<\n\t\t\tT,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tOutSchema,\n\t\t\tTDatabase,\n\t\t\tTDatabaseServiceName\n\t\t>;\n\t}\n\n\toverride output<T extends StandardSchemaV1>(\n\t\tschema: T,\n\t): CronBuilder<\n\t\tTInput,\n\t\tTServices,\n\t\tTLogger,\n\t\tT,\n\t\tTDatabase,\n\t\tTDatabaseServiceName\n\t> {\n\t\treturn cloneWith(this, {\n\t\t\toutputSchema: schema as unknown as OutSchema,\n\t\t}) as unknown as CronBuilder<\n\t\t\tTInput,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tT,\n\t\t\tTDatabase,\n\t\t\tTDatabaseServiceName\n\t\t>;\n\t}\n\n\t/**\n\t * Depend on constructs — a database, a bucket, a mail sender, a queue, a\n\t * topic.\n\t *\n\t * It records the edge and dissolves each construct's client into the\n\t * handler's service record under the construct's own id, so\n\t * `.dependsOn([uploads])` is what makes `services.uploads` exist and type.\n\t *\n\t * Constructs only. A `Service` does not match the shape, which is what keeps\n\t * env sniffing confined to `.services()` and the explicit lift.\n\t */\n\toverride dependsOn<const T extends readonly Consumable[]>(\n\t\tconstructs: T,\n\t): CronBuilder<\n\t\tTInput,\n\t\t[...TServices, ...ServicesOf<T>],\n\t\tTLogger,\n\t\tOutSchema,\n\t\tTDatabase,\n\t\tTDatabaseServiceName\n\t> {\n\t\t// Both halves of the edge, from one call and one clone: the services the\n\t\t// handler runs with, and the ids the manifest records. Recording them\n\t\t// separately is what let them drift apart.\n\t\t//\n\t\t// `servicesOf` is the half that validates, so it runs first — recording\n\t\t// ids ahead of it left a caught `NotAConstruct` with `undefined` already\n\t\t// on a `string[]`.\n\t\tconst services = servicesOf(constructs) as unknown as Service[];\n\n\t\treturn cloneWith(this, {\n\t\t\t_services: uniqBy(\n\t\t\t\t[...this._services, ...services],\n\t\t\t\t(s: Service) => s.serviceName,\n\t\t\t),\n\t\t\t_constructs: idsOf(constructs, this._constructs),\n\t\t}) as unknown as CronBuilder<\n\t\t\tTInput,\n\t\t\t[...TServices, ...ServicesOf<T>],\n\t\t\tTLogger,\n\t\t\tOutSchema,\n\t\t\tTDatabase,\n\t\t\tTDatabaseServiceName\n\t\t>;\n\t}\n\n\toverride services<T extends Service[]>(\n\t\tservices: T,\n\t): CronBuilder<\n\t\tTInput,\n\t\t[...TServices, ...T],\n\t\tTLogger,\n\t\tOutSchema,\n\t\tTDatabase,\n\t\tTDatabaseServiceName\n\t> {\n\t\treturn cloneWith(this, {\n\t\t\t_services: uniqBy(\n\t\t\t\t[...this._services, ...services],\n\t\t\t\t(s) => s.serviceName,\n\t\t\t) as TServices,\n\t\t}) as unknown as CronBuilder<\n\t\t\tTInput,\n\t\t\t[...TServices, ...T],\n\t\t\tTLogger,\n\t\t\tOutSchema,\n\t\t\tTDatabase,\n\t\t\tTDatabaseServiceName\n\t\t>;\n\t}\n\n\toverride logger<T extends Logger>(\n\t\tlogger: T,\n\t): CronBuilder<\n\t\tTInput,\n\t\tTServices,\n\t\tT,\n\t\tOutSchema,\n\t\tTDatabase,\n\t\tTDatabaseServiceName\n\t> {\n\t\treturn cloneWith(this, {\n\t\t\t_logger: logger as unknown as TLogger,\n\t\t}) as unknown as CronBuilder<\n\t\t\tTInput,\n\t\t\tTServices,\n\t\t\tT,\n\t\t\tOutSchema,\n\t\t\tTDatabase,\n\t\t\tTDatabaseServiceName\n\t\t>;\n\t}\n\n\t/**\n\t * Publish `event` to `topic` each time the cron has run successfully —\n\t * repeatable, to as many topics as it names. The topic becomes a dependency\n\t * as with `.dependsOn([topic])`, so `services.<topic>` is there too.\n\t */\n\toverride event<TTopic extends Topic<any, any>>(\n\t\ttopic: TTopic,\n\t\tevent: EventFor<TTopic, InferStandardSchema<OutSchema>>,\n\t): CronBuilder<\n\t\tTInput,\n\t\t[...TServices, TTopic['service']],\n\t\tTLogger,\n\t\tOutSchema,\n\t\tTDatabase,\n\t\tTDatabaseServiceName\n\t> {\n\t\treturn this.withEvent(topic, event as never) as unknown as CronBuilder<\n\t\t\tTInput,\n\t\t\t[...TServices, TTopic['service']],\n\t\t\tTLogger,\n\t\t\tOutSchema,\n\t\t\tTDatabase,\n\t\t\tTDatabaseServiceName\n\t\t>;\n\t}\n\n\t/**\n\t * Set the database service for this cron job.\n\t * The database will be available in the handler context as `db`.\n\t */\n\toverride database<T, TName extends string>(\n\t\tsource: Consumable<TName, T> | Service<TName, T>,\n\t): CronBuilder<TInput, TServices, TLogger, OutSchema, T, TName> {\n\t\tconst service = serviceOf(source);\n\n\t\treturn cloneWith(this, {\n\t\t\t_databaseService: service as unknown as Service<\n\t\t\t\tTDatabaseServiceName,\n\t\t\t\tTDatabase\n\t\t\t>,\n\t\t\t// The edge, as `.dependsOn()` records one — see EndpointFactory —\n\t\t\t// in place of the one a previous `.database()` added, which is how a\n\t\t\t// worker's default database is overridden rather than added to.\n\t\t\t...databaseEdges(\n\t\t\t\t{\n\t\t\t\t\tconstructs: this._constructs,\n\t\t\t\t\tedge: this._databaseEdge,\n\t\t\t\t\tservice: this._databaseService as Service | undefined,\n\t\t\t\t\tservices: this._services,\n\t\t\t\t},\n\t\t\t\tsource,\n\t\t\t),\n\t\t}) as unknown as CronBuilder<\n\t\t\tTInput,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tOutSchema,\n\t\t\tT,\n\t\t\tTName\n\t\t>;\n\t}\n\n\toverride handle(\n\t\tfn: FunctionHandler<TInput, TServices, TLogger, OutSchema, TDatabase>,\n\t): Cron<\n\t\tTInput,\n\t\tTServices,\n\t\tTLogger,\n\t\tOutSchema,\n\t\tTDatabase,\n\t\tTDatabaseServiceName\n\t> {\n\t\tconst cron = new Cron(\n\t\t\tfn,\n\t\t\tthis._timeout,\n\t\t\tthis._schedule,\n\t\t\tthis.inputSchema,\n\t\t\tthis.outputSchema,\n\t\t\tthis._services,\n\t\t\tthis._logger,\n\t\t\tthis._events,\n\t\t\tthis._memorySize,\n\t\t\tthis._databaseService,\n\t\t\tthis._constructs,\n\t\t);\n\n\t\t// Which process runs it. Carried from the factory rather than inferred\n\t\t// from the directory the file happens to sit in.\n\t\tcron.owner = this._owner;\n\n\t\t// And where that process keeps the schedule, when a server is what runs\n\t\t// it. Declared once on the worker rather than repeated per cron.\n\t\tcron.scheduleStore = this._scheduleStore\n\t\t\t? serviceOf(this._scheduleStore as Consumable<string, unknown>)\n\t\t\t: undefined;\n\n\t\t// No reset. `.handle()` reads this builder and leaves it alone, so a\n\t\t// configured base — `const fn = f.logger(log).timeout(60_000)` — keeps\n\t\t// its configuration for every construct built from it. The reset that\n\t\t// used to be here wiped the base on first use, which made a base usable\n\t\t// exactly once, and quietly reverted the logger to the default.\n\n\t\treturn cron;\n\t}\n}\n"],"mappings":";;;;;;;AAUA,IAAa,OAAb,cAOUA,kBAAAA,SAWR;CAyBU;;;;;;;;;;;;CAbX;CAEA,OAAO,OAAO,KAA2C;EACxD,OAAO,QACN,OACE,IAAiB,oBAAoB,QACtC,IAAI,SAAA,6BACN;CACD;CAEA,YACC,IACA,SACA,WACA,OACA,cACA,WAAsB,CAAC,GACvB,QAEA,SAAuB,CAAC,GACxB,YACA,iBAKA,aAAuB,CAAC,GACvB;EACD,MACC,IACA,SAAA,+BAEA,OACA,cACA,UACA,QACA,QACA,YACA,KAAA,GACA,iBACA,UACD;EA5BU,KAAA,YAAA;CA6BX;CAEA,IAAI,WAA2C;EAC9C,OAAO,KAAK;CACb;AACD;;;AChEA,IAAa,cAAb,cAOUC,kBAAAA,gBASR;CACD;CAEA,cAAc;EACb,MAAA,6BAAwB;CACzB;CAEA,WAAoB,YAA0B;EAC7C,OAAOC,cAAAA,UAAU,MAAM,EAAE,aAAa,WAAW,CAAC;CACnD;CAEA,SACC,aAQC;EACD,OAAOA,cAAAA,UAAU,MAAM,EAAE,WAAW,YAAY,CAAC;CAClD;CAEA,MACC,QAQC;EACD,OAAOA,cAAAA,UAAU,MAAM,EACtB,aAAa,OACd,CAAC;CAQF;CAEA,OACC,QAQC;EACD,OAAOA,cAAAA,UAAU,MAAM,EACtB,cAAc,OACf,CAAC;CAQF;;;;;;;;;;;;CAaA,UACC,YAQC;EAQD,MAAM,WAAWC,4BAAAA,WAAW,UAAU;EAEtC,OAAOD,cAAAA,UAAU,MAAM;GACtB,YAAA,GAAWE,qBAAAA,QAAAA,CACV,CAAC,GAAG,KAAK,WAAW,GAAG,QAAQ,IAC9B,MAAe,EAAE,WACnB;GACA,aAAaC,4BAAAA,MAAM,YAAY,KAAK,WAAW;EAChD,CAAC;CAQF;CAEA,SACC,UAQC;EACD,OAAOH,cAAAA,UAAU,MAAM,EACtB,YAAA,GAAWE,qBAAAA,QAAAA,CACV,CAAC,GAAG,KAAK,WAAW,GAAG,QAAQ,IAC9B,MAAM,EAAE,WACV,EACD,CAAC;CAQF;CAEA,OACC,QAQC;EACD,OAAOF,cAAAA,UAAU,MAAM,EACtB,SAAS,OACV,CAAC;CAQF;;;;;;CAOA,MACC,OACA,OAQC;EACD,OAAO,KAAK,UAAU,OAAO,KAAc;CAQ5C;;;;;CAMA,SACC,QAC+D;EAC/D,MAAM,UAAUI,4BAAAA,UAAU,MAAM;EAEhC,OAAOJ,cAAAA,UAAU,MAAM;GACtB,kBAAkB;GAOlB,GAAGK,4BAAAA,cACF;IACC,YAAY,KAAK;IACjB,MAAM,KAAK;IACX,SAAS,KAAK;IACd,UAAU,KAAK;GAChB,GACA,MACD;EACD,CAAC;CAQF;CAEA,OACC,IAQC;EACD,MAAM,OAAO,IAAI,KAChB,IACA,KAAK,UACL,KAAK,WACL,KAAK,aACL,KAAK,cACL,KAAK,WACL,KAAK,SACL,KAAK,SACL,KAAK,aACL,KAAK,kBACL,KAAK,WACN;EAIA,KAAK,QAAQ,KAAK;EAIlB,KAAK,gBAAgB,KAAK,iBACvBD,4BAAAA,UAAU,KAAK,cAA6C,IAC5D,KAAA;EAQH,OAAO;CACR;AACD"}
|
|
1
|
+
{"version":3,"file":"CronBuilder-B4DYaEjl.cjs","names":["Function","FunctionBuilder","cloneWith","servicesOf","uniqBy","idsOf","serviceOf","databaseEdges"],"sources":["../src/crons/Cron.ts","../src/crons/CronBuilder.ts"],"sourcesContent":["import type { AuditableAction } from '@geekmidas/audit';\nimport type { EventPublisher } from '@geekmidas/events';\nimport type { Logger } from '@geekmidas/logger';\nimport type { ComposableStandardSchema } from '@geekmidas/schema';\nimport type { Service } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport { ConstructType } from '../Construct';\nimport { Function, type FunctionHandler } from '../functions';\nimport type { TopicEvent } from '../publisher';\n\nexport class Cron<\n\tTInput extends ComposableStandardSchema | undefined = undefined,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tOutSchema extends StandardSchemaV1 | undefined = undefined,\n\tTDatabase = undefined,\n\tTDatabaseServiceName extends string = string,\n> extends Function<\n\tTInput,\n\tTServices,\n\tTLogger,\n\tOutSchema,\n\tundefined,\n\tstring,\n\tTDatabase,\n\tTDatabaseServiceName,\n\tAuditableAction<string, unknown>,\n\tFunctionHandler<TInput, TServices, TLogger, OutSchema, TDatabase>\n> {\n\t/**\n\t * Where this cron's schedule lives when a server runs it.\n\t *\n\t * Carried from the worker that built it, which declared it once with\n\t * `.database(db)`. Unread on AWS, where the schedule is an EventBridge rule\n\t * and nothing in this process fires anything.\n\t *\n\t * A service rather than the construct, because what reads it is service\n\t * discovery in the generated server — which registers services, and failed\n\t * on the construct with `service.register is not a function`.\n\t */\n\tscheduleStore?: Service<string, unknown>;\n\n\tstatic isCron(obj: any): obj is Cron<any, any, any, any> {\n\t\treturn Boolean(\n\t\t\tobj &&\n\t\t\t\t(obj as Function).__IS_FUNCTION__ === true &&\n\t\t\t\tobj.type === ConstructType.Cron,\n\t\t);\n\t}\n\n\tconstructor(\n\t\tfn: FunctionHandler<TInput, TServices, TLogger, OutSchema, TDatabase>,\n\t\ttimeout?: number,\n\t\tprotected _schedule?: ScheduleExpression,\n\t\tinput?: TInput,\n\t\toutputSchema?: OutSchema,\n\t\tservices: TServices = [] as unknown as TServices,\n\t\tlogger?: TLogger,\n\t\t/** What it publishes once it has run, each to its own topic. */\n\t\tevents: TopicEvent[] = [],\n\t\tmemorySize?: number,\n\t\tdatabaseService?: Service<TDatabaseServiceName, TDatabase>,\n\t\t/**\n\t\t * The construct ids `.dependsOn()` named — last, so no existing positional\n\t\t * argument moves.\n\t\t */\n\t\tconstructs: string[] = [],\n\t) {\n\t\tsuper(\n\t\t\tfn,\n\t\t\ttimeout,\n\t\t\tConstructType.Cron,\n\t\t\tinput,\n\t\t\toutputSchema,\n\t\t\tservices,\n\t\t\tlogger,\n\t\t\tevents,\n\t\t\tmemorySize,\n\t\t\tundefined, // auditorStorageService\n\t\t\tdatabaseService,\n\t\t\tconstructs,\n\t\t);\n\t}\n\n\tget schedule(): ScheduleExpression | undefined {\n\t\treturn this._schedule;\n\t}\n}\n\nexport type RateExpression = `rate(${string})`;\n\ntype CronMinute =\n\t| '*'\n\t| number\n\t| `${number}`\n\t| `${number}-${number}`\n\t| `${number}/${number}`\n\t| `*/${number}`\n\t| `${number},${number}`\n\t| string; // Allow more complex patterns\n\ntype CronHour =\n\t| '*'\n\t| number\n\t| `${number}`\n\t| `${number}-${number}`\n\t| `${number}/${number}`\n\t| `*/${number}`\n\t| `${number},${number}`\n\t| string; // Allow more complex patterns\n\ntype CronDay =\n\t| '*'\n\t| number\n\t| `${number}`\n\t| `${number}-${number}`\n\t| `${number}/${number}`\n\t| `*/${number}`\n\t| `${number},${number}`\n\t| string; // Allow more complex patterns\n\ntype CronMonth =\n\t| '*'\n\t| number\n\t| `${number}`\n\t| `${number}-${number}`\n\t| `${number}/${number}`\n\t| `*/${number}`\n\t| 'JAN'\n\t| 'FEB'\n\t| 'MAR'\n\t| 'APR'\n\t| 'MAY'\n\t| 'JUN'\n\t| 'JUL'\n\t| 'AUG'\n\t| 'SEP'\n\t| 'OCT'\n\t| 'NOV'\n\t| 'DEC'\n\t| string; // Allow more complex patterns\n\ntype CronWeekday =\n\t| '*'\n\t| number\n\t| `${number}`\n\t| `${number}-${number}`\n\t| `${number}/${number}`\n\t| `*/${number}`\n\t| 'SUN'\n\t| 'MON'\n\t| 'TUE'\n\t| 'WED'\n\t| 'THU'\n\t| 'FRI'\n\t| 'SAT'\n\t| `${string}-${string}` // Allow patterns like MON-FRI\n\t| string; // Allow more complex patterns\n\nexport type CronExpression =\n\t`cron(${CronMinute} ${CronHour} ${CronDay} ${CronMonth} ${CronWeekday})`;\n\nexport type ScheduleExpression = RateExpression | CronExpression;\n","import type { Logger } from '@geekmidas/logger';\nimport type {\n\tComposableStandardSchema,\n\tInferStandardSchema,\n} from '@geekmidas/schema';\nimport type { Service } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport uniqBy from 'lodash.uniqby';\nimport { ConstructType } from '../Construct';\nimport { cloneWith } from '../clone';\nimport {\n\ttype Consumable,\n\tdatabaseEdges,\n\tidsOf,\n\ttype ServicesOf,\n\tserviceOf,\n\tservicesOf,\n} from '../construct-interface';\nimport { FunctionBuilder, type FunctionHandler } from '../functions';\nimport type { EventFor } from '../publisher';\nimport type { Topic } from '../topic/Topic';\nimport { Cron, type ScheduleExpression } from './Cron';\n\nexport class CronBuilder<\n\tTInput extends ComposableStandardSchema,\n\tTServices extends Service[],\n\tTLogger extends Logger = Logger,\n\tOutSchema extends StandardSchemaV1 | undefined = undefined,\n\tTDatabase = undefined,\n\tTDatabaseServiceName extends string = string,\n> extends FunctionBuilder<\n\tTInput,\n\tOutSchema,\n\tTServices,\n\tTLogger,\n\tundefined,\n\tstring,\n\tTDatabase,\n\tTDatabaseServiceName\n> {\n\tprivate _schedule?: ScheduleExpression;\n\n\tconstructor() {\n\t\tsuper(ConstructType.Cron);\n\t}\n\n\toverride memorySize(memorySize: number): this {\n\t\treturn cloneWith(this, { _memorySize: memorySize });\n\t}\n\n\tschedule(\n\t\t_expression: ScheduleExpression,\n\t): CronBuilder<\n\t\tTInput,\n\t\tTServices,\n\t\tTLogger,\n\t\tOutSchema,\n\t\tTDatabase,\n\t\tTDatabaseServiceName\n\t> {\n\t\treturn cloneWith(this, { _schedule: _expression });\n\t}\n\n\toverride input<T extends ComposableStandardSchema>(\n\t\tschema: T,\n\t): CronBuilder<\n\t\tT,\n\t\tTServices,\n\t\tTLogger,\n\t\tOutSchema,\n\t\tTDatabase,\n\t\tTDatabaseServiceName\n\t> {\n\t\treturn cloneWith(this, {\n\t\t\tinputSchema: schema as unknown as TInput,\n\t\t}) as unknown as CronBuilder<\n\t\t\tT,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tOutSchema,\n\t\t\tTDatabase,\n\t\t\tTDatabaseServiceName\n\t\t>;\n\t}\n\n\toverride output<T extends StandardSchemaV1>(\n\t\tschema: T,\n\t): CronBuilder<\n\t\tTInput,\n\t\tTServices,\n\t\tTLogger,\n\t\tT,\n\t\tTDatabase,\n\t\tTDatabaseServiceName\n\t> {\n\t\treturn cloneWith(this, {\n\t\t\toutputSchema: schema as unknown as OutSchema,\n\t\t}) as unknown as CronBuilder<\n\t\t\tTInput,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tT,\n\t\t\tTDatabase,\n\t\t\tTDatabaseServiceName\n\t\t>;\n\t}\n\n\t/**\n\t * Depend on constructs — a database, a bucket, a mail sender, a queue, a\n\t * topic.\n\t *\n\t * It records the edge and dissolves each construct's client into the\n\t * handler's service record under the construct's own id, so\n\t * `.dependsOn([uploads])` is what makes `services.uploads` exist and type.\n\t *\n\t * Constructs only. A `Service` does not match the shape, which is what keeps\n\t * env sniffing confined to `.services()` and the explicit lift.\n\t */\n\toverride dependsOn<const T extends readonly Consumable[]>(\n\t\tconstructs: T,\n\t): CronBuilder<\n\t\tTInput,\n\t\t[...TServices, ...ServicesOf<T>],\n\t\tTLogger,\n\t\tOutSchema,\n\t\tTDatabase,\n\t\tTDatabaseServiceName\n\t> {\n\t\t// Both halves of the edge, from one call and one clone: the services the\n\t\t// handler runs with, and the ids the manifest records. Recording them\n\t\t// separately is what let them drift apart.\n\t\t//\n\t\t// `servicesOf` is the half that validates, so it runs first — recording\n\t\t// ids ahead of it left a caught `NotAConstruct` with `undefined` already\n\t\t// on a `string[]`.\n\t\tconst services = servicesOf(constructs) as unknown as Service[];\n\n\t\treturn cloneWith(this, {\n\t\t\t_services: uniqBy(\n\t\t\t\t[...this._services, ...services],\n\t\t\t\t(s: Service) => s.serviceName,\n\t\t\t),\n\t\t\t_constructs: idsOf(constructs, this._constructs),\n\t\t}) as unknown as CronBuilder<\n\t\t\tTInput,\n\t\t\t[...TServices, ...ServicesOf<T>],\n\t\t\tTLogger,\n\t\t\tOutSchema,\n\t\t\tTDatabase,\n\t\t\tTDatabaseServiceName\n\t\t>;\n\t}\n\n\toverride services<T extends Service[]>(\n\t\tservices: T,\n\t): CronBuilder<\n\t\tTInput,\n\t\t[...TServices, ...T],\n\t\tTLogger,\n\t\tOutSchema,\n\t\tTDatabase,\n\t\tTDatabaseServiceName\n\t> {\n\t\treturn cloneWith(this, {\n\t\t\t_services: uniqBy(\n\t\t\t\t[...this._services, ...services],\n\t\t\t\t(s) => s.serviceName,\n\t\t\t) as TServices,\n\t\t}) as unknown as CronBuilder<\n\t\t\tTInput,\n\t\t\t[...TServices, ...T],\n\t\t\tTLogger,\n\t\t\tOutSchema,\n\t\t\tTDatabase,\n\t\t\tTDatabaseServiceName\n\t\t>;\n\t}\n\n\toverride logger<T extends Logger>(\n\t\tlogger: T,\n\t): CronBuilder<\n\t\tTInput,\n\t\tTServices,\n\t\tT,\n\t\tOutSchema,\n\t\tTDatabase,\n\t\tTDatabaseServiceName\n\t> {\n\t\treturn cloneWith(this, {\n\t\t\t_logger: logger as unknown as TLogger,\n\t\t}) as unknown as CronBuilder<\n\t\t\tTInput,\n\t\t\tTServices,\n\t\t\tT,\n\t\t\tOutSchema,\n\t\t\tTDatabase,\n\t\t\tTDatabaseServiceName\n\t\t>;\n\t}\n\n\t/**\n\t * Publish `event` to `topic` each time the cron has run successfully —\n\t * repeatable, to as many topics as it names. The topic becomes a dependency\n\t * as with `.dependsOn([topic])`, so `services.<topic>` is there too.\n\t */\n\toverride event<TTopic extends Topic<any, any>>(\n\t\ttopic: TTopic,\n\t\tevent: EventFor<TTopic, InferStandardSchema<OutSchema>>,\n\t): CronBuilder<\n\t\tTInput,\n\t\t[...TServices, TTopic['service']],\n\t\tTLogger,\n\t\tOutSchema,\n\t\tTDatabase,\n\t\tTDatabaseServiceName\n\t> {\n\t\treturn this.withEvent(topic, event as never) as unknown as CronBuilder<\n\t\t\tTInput,\n\t\t\t[...TServices, TTopic['service']],\n\t\t\tTLogger,\n\t\t\tOutSchema,\n\t\t\tTDatabase,\n\t\t\tTDatabaseServiceName\n\t\t>;\n\t}\n\n\t/**\n\t * Set the database service for this cron job.\n\t * The database will be available in the handler context as `db`.\n\t */\n\toverride database<T, TName extends string>(\n\t\tsource: Consumable<TName, T> | Service<TName, T>,\n\t): CronBuilder<TInput, TServices, TLogger, OutSchema, T, TName> {\n\t\tconst service = serviceOf(source);\n\n\t\treturn cloneWith(this, {\n\t\t\t_databaseService: service as unknown as Service<\n\t\t\t\tTDatabaseServiceName,\n\t\t\t\tTDatabase\n\t\t\t>,\n\t\t\t// The edge, as `.dependsOn()` records one — see EndpointFactory —\n\t\t\t// in place of the one a previous `.database()` added, which is how a\n\t\t\t// worker's default database is overridden rather than added to.\n\t\t\t...databaseEdges(\n\t\t\t\t{\n\t\t\t\t\tconstructs: this._constructs,\n\t\t\t\t\tedge: this._databaseEdge,\n\t\t\t\t\tservice: this._databaseService as Service | undefined,\n\t\t\t\t\tservices: this._services,\n\t\t\t\t},\n\t\t\t\tsource,\n\t\t\t),\n\t\t}) as unknown as CronBuilder<\n\t\t\tTInput,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tOutSchema,\n\t\t\tT,\n\t\t\tTName\n\t\t>;\n\t}\n\n\toverride handle(\n\t\tfn: FunctionHandler<TInput, TServices, TLogger, OutSchema, TDatabase>,\n\t): Cron<\n\t\tTInput,\n\t\tTServices,\n\t\tTLogger,\n\t\tOutSchema,\n\t\tTDatabase,\n\t\tTDatabaseServiceName\n\t> {\n\t\tconst cron = new Cron(\n\t\t\tfn,\n\t\t\tthis._timeout,\n\t\t\tthis._schedule,\n\t\t\tthis.inputSchema,\n\t\t\tthis.outputSchema,\n\t\t\tthis._services,\n\t\t\tthis._logger,\n\t\t\tthis._events,\n\t\t\tthis._memorySize,\n\t\t\tthis._databaseService,\n\t\t\tthis._constructs,\n\t\t);\n\n\t\t// Which process runs it. Carried from the factory rather than inferred\n\t\t// from the directory the file happens to sit in.\n\t\tcron.owner = this._owner;\n\n\t\t// And where that process keeps the schedule, when a server is what runs\n\t\t// it. Declared once on the worker rather than repeated per cron.\n\t\tcron.scheduleStore = this._scheduleStore\n\t\t\t? serviceOf(this._scheduleStore as Consumable<string, unknown>)\n\t\t\t: undefined;\n\n\t\t// No reset. `.handle()` reads this builder and leaves it alone, so a\n\t\t// configured base — `const fn = f.logger(log).timeout(60_000)` — keeps\n\t\t// its configuration for every construct built from it. The reset that\n\t\t// used to be here wiped the base on first use, which made a base usable\n\t\t// exactly once, and quietly reverted the logger to the default.\n\n\t\treturn cron;\n\t}\n}\n"],"mappings":";;;;;;;AAUA,IAAa,OAAb,cAOUA,kBAAAA,SAWR;CAyBU;;;;;;;;;;;;CAbX;CAEA,OAAO,OAAO,KAA2C;EACxD,OAAO,QACN,OACE,IAAiB,oBAAoB,QACtC,IAAI,SAAA,6BACN;CACD;CAEA,YACC,IACA,SACA,WACA,OACA,cACA,WAAsB,CAAC,GACvB,QAEA,SAAuB,CAAC,GACxB,YACA,iBAKA,aAAuB,CAAC,GACvB;EACD,MACC,IACA,SAAA,+BAEA,OACA,cACA,UACA,QACA,QACA,YACA,KAAA,GACA,iBACA,UACD;EA5BU,KAAA,YAAA;CA6BX;CAEA,IAAI,WAA2C;EAC9C,OAAO,KAAK;CACb;AACD;;;AChEA,IAAa,cAAb,cAOUC,kBAAAA,gBASR;CACD;CAEA,cAAc;EACb,MAAA,6BAAwB;CACzB;CAEA,WAAoB,YAA0B;EAC7C,OAAOC,cAAAA,UAAU,MAAM,EAAE,aAAa,WAAW,CAAC;CACnD;CAEA,SACC,aAQC;EACD,OAAOA,cAAAA,UAAU,MAAM,EAAE,WAAW,YAAY,CAAC;CAClD;CAEA,MACC,QAQC;EACD,OAAOA,cAAA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
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { s as __toESM } from "./Construct-CRV3RN2U.mjs";
|
|
2
2
|
import { databaseEdges, idsOf, serviceOf, servicesOf } from "./construct-interface.mjs";
|
|
3
|
-
import { n as Function, o as require_lodash_uniqby, t as FunctionBuilder } from "./functions-
|
|
3
|
+
import { n as Function, o as require_lodash_uniqby, t as FunctionBuilder } from "./functions-BF039DT8.mjs";
|
|
4
4
|
import { t as cloneWith } from "./clone-EKNovYHu.mjs";
|
|
5
5
|
//#region src/crons/Cron.ts
|
|
6
6
|
var import_lodash_uniqby = /* @__PURE__ */ __toESM(require_lodash_uniqby(), 1);
|
|
@@ -106,4 +106,4 @@ var CronBuilder = class extends FunctionBuilder {
|
|
|
106
106
|
//#endregion
|
|
107
107
|
export { Cron as n, CronBuilder as t };
|
|
108
108
|
|
|
109
|
-
//# sourceMappingURL=CronBuilder-
|
|
109
|
+
//# sourceMappingURL=CronBuilder-CukJuL3b.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CronBuilder-BJ5LoadF.mjs","names":["uniqBy"],"sources":["../src/crons/Cron.ts","../src/crons/CronBuilder.ts"],"sourcesContent":["import type { AuditableAction } from '@geekmidas/audit';\nimport type { EventPublisher } from '@geekmidas/events';\nimport type { Logger } from '@geekmidas/logger';\nimport type { ComposableStandardSchema } from '@geekmidas/schema';\nimport type { Service } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport { ConstructType } from '../Construct';\nimport { Function, type FunctionHandler } from '../functions';\nimport type { TopicEvent } from '../publisher';\n\nexport class Cron<\n\tTInput extends ComposableStandardSchema | undefined = undefined,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tOutSchema extends StandardSchemaV1 | undefined = undefined,\n\tTDatabase = undefined,\n\tTDatabaseServiceName extends string = string,\n> extends Function<\n\tTInput,\n\tTServices,\n\tTLogger,\n\tOutSchema,\n\tundefined,\n\tstring,\n\tTDatabase,\n\tTDatabaseServiceName,\n\tAuditableAction<string, unknown>,\n\tFunctionHandler<TInput, TServices, TLogger, OutSchema, TDatabase>\n> {\n\t/**\n\t * Where this cron's schedule lives when a server runs it.\n\t *\n\t * Carried from the worker that built it, which declared it once with\n\t * `.database(db)`. Unread on AWS, where the schedule is an EventBridge rule\n\t * and nothing in this process fires anything.\n\t *\n\t * A service rather than the construct, because what reads it is service\n\t * discovery in the generated server — which registers services, and failed\n\t * on the construct with `service.register is not a function`.\n\t */\n\tscheduleStore?: Service<string, unknown>;\n\n\tstatic isCron(obj: any): obj is Cron<any, any, any, any> {\n\t\treturn Boolean(\n\t\t\tobj &&\n\t\t\t\t(obj as Function).__IS_FUNCTION__ === true &&\n\t\t\t\tobj.type === ConstructType.Cron,\n\t\t);\n\t}\n\n\tconstructor(\n\t\tfn: FunctionHandler<TInput, TServices, TLogger, OutSchema, TDatabase>,\n\t\ttimeout?: number,\n\t\tprotected _schedule?: ScheduleExpression,\n\t\tinput?: TInput,\n\t\toutputSchema?: OutSchema,\n\t\tservices: TServices = [] as unknown as TServices,\n\t\tlogger?: TLogger,\n\t\t/** What it publishes once it has run, each to its own topic. */\n\t\tevents: TopicEvent[] = [],\n\t\tmemorySize?: number,\n\t\tdatabaseService?: Service<TDatabaseServiceName, TDatabase>,\n\t\t/**\n\t\t * The construct ids `.dependsOn()` named — last, so no existing positional\n\t\t * argument moves.\n\t\t */\n\t\tconstructs: string[] = [],\n\t) {\n\t\tsuper(\n\t\t\tfn,\n\t\t\ttimeout,\n\t\t\tConstructType.Cron,\n\t\t\tinput,\n\t\t\toutputSchema,\n\t\t\tservices,\n\t\t\tlogger,\n\t\t\tevents,\n\t\t\tmemorySize,\n\t\t\tundefined, // auditorStorageService\n\t\t\tdatabaseService,\n\t\t\tconstructs,\n\t\t);\n\t}\n\n\tget schedule(): ScheduleExpression | undefined {\n\t\treturn this._schedule;\n\t}\n}\n\nexport type RateExpression = `rate(${string})`;\n\ntype CronMinute =\n\t| '*'\n\t| number\n\t| `${number}`\n\t| `${number}-${number}`\n\t| `${number}/${number}`\n\t| `*/${number}`\n\t| `${number},${number}`\n\t| string; // Allow more complex patterns\n\ntype CronHour =\n\t| '*'\n\t| number\n\t| `${number}`\n\t| `${number}-${number}`\n\t| `${number}/${number}`\n\t| `*/${number}`\n\t| `${number},${number}`\n\t| string; // Allow more complex patterns\n\ntype CronDay =\n\t| '*'\n\t| number\n\t| `${number}`\n\t| `${number}-${number}`\n\t| `${number}/${number}`\n\t| `*/${number}`\n\t| `${number},${number}`\n\t| string; // Allow more complex patterns\n\ntype CronMonth =\n\t| '*'\n\t| number\n\t| `${number}`\n\t| `${number}-${number}`\n\t| `${number}/${number}`\n\t| `*/${number}`\n\t| 'JAN'\n\t| 'FEB'\n\t| 'MAR'\n\t| 'APR'\n\t| 'MAY'\n\t| 'JUN'\n\t| 'JUL'\n\t| 'AUG'\n\t| 'SEP'\n\t| 'OCT'\n\t| 'NOV'\n\t| 'DEC'\n\t| string; // Allow more complex patterns\n\ntype CronWeekday =\n\t| '*'\n\t| number\n\t| `${number}`\n\t| `${number}-${number}`\n\t| `${number}/${number}`\n\t| `*/${number}`\n\t| 'SUN'\n\t| 'MON'\n\t| 'TUE'\n\t| 'WED'\n\t| 'THU'\n\t| 'FRI'\n\t| 'SAT'\n\t| `${string}-${string}` // Allow patterns like MON-FRI\n\t| string; // Allow more complex patterns\n\nexport type CronExpression =\n\t`cron(${CronMinute} ${CronHour} ${CronDay} ${CronMonth} ${CronWeekday})`;\n\nexport type ScheduleExpression = RateExpression | CronExpression;\n","import type { Logger } from '@geekmidas/logger';\nimport type {\n\tComposableStandardSchema,\n\tInferStandardSchema,\n} from '@geekmidas/schema';\nimport type { Service } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport uniqBy from 'lodash.uniqby';\nimport { ConstructType } from '../Construct';\nimport { cloneWith } from '../clone';\nimport {\n\ttype Consumable,\n\tdatabaseEdges,\n\tidsOf,\n\ttype ServicesOf,\n\tserviceOf,\n\tservicesOf,\n} from '../construct-interface';\nimport { FunctionBuilder, type FunctionHandler } from '../functions';\nimport type { EventFor } from '../publisher';\nimport type { Topic } from '../topic/Topic';\nimport { Cron, type ScheduleExpression } from './Cron';\n\nexport class CronBuilder<\n\tTInput extends ComposableStandardSchema,\n\tTServices extends Service[],\n\tTLogger extends Logger = Logger,\n\tOutSchema extends StandardSchemaV1 | undefined = undefined,\n\tTDatabase = undefined,\n\tTDatabaseServiceName extends string = string,\n> extends FunctionBuilder<\n\tTInput,\n\tOutSchema,\n\tTServices,\n\tTLogger,\n\tundefined,\n\tstring,\n\tTDatabase,\n\tTDatabaseServiceName\n> {\n\tprivate _schedule?: ScheduleExpression;\n\n\tconstructor() {\n\t\tsuper(ConstructType.Cron);\n\t}\n\n\toverride memorySize(memorySize: number): this {\n\t\treturn cloneWith(this, { _memorySize: memorySize });\n\t}\n\n\tschedule(\n\t\t_expression: ScheduleExpression,\n\t): CronBuilder<\n\t\tTInput,\n\t\tTServices,\n\t\tTLogger,\n\t\tOutSchema,\n\t\tTDatabase,\n\t\tTDatabaseServiceName\n\t> {\n\t\treturn cloneWith(this, { _schedule: _expression });\n\t}\n\n\toverride input<T extends ComposableStandardSchema>(\n\t\tschema: T,\n\t): CronBuilder<\n\t\tT,\n\t\tTServices,\n\t\tTLogger,\n\t\tOutSchema,\n\t\tTDatabase,\n\t\tTDatabaseServiceName\n\t> {\n\t\treturn cloneWith(this, {\n\t\t\tinputSchema: schema as unknown as TInput,\n\t\t}) as unknown as CronBuilder<\n\t\t\tT,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tOutSchema,\n\t\t\tTDatabase,\n\t\t\tTDatabaseServiceName\n\t\t>;\n\t}\n\n\toverride output<T extends StandardSchemaV1>(\n\t\tschema: T,\n\t): CronBuilder<\n\t\tTInput,\n\t\tTServices,\n\t\tTLogger,\n\t\tT,\n\t\tTDatabase,\n\t\tTDatabaseServiceName\n\t> {\n\t\treturn cloneWith(this, {\n\t\t\toutputSchema: schema as unknown as OutSchema,\n\t\t}) as unknown as CronBuilder<\n\t\t\tTInput,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tT,\n\t\t\tTDatabase,\n\t\t\tTDatabaseServiceName\n\t\t>;\n\t}\n\n\t/**\n\t * Depend on constructs — a database, a bucket, a mail sender, a queue, a\n\t * topic.\n\t *\n\t * It records the edge and dissolves each construct's client into the\n\t * handler's service record under the construct's own id, so\n\t * `.dependsOn([uploads])` is what makes `services.uploads` exist and type.\n\t *\n\t * Constructs only. A `Service` does not match the shape, which is what keeps\n\t * env sniffing confined to `.services()` and the explicit lift.\n\t */\n\toverride dependsOn<const T extends readonly Consumable[]>(\n\t\tconstructs: T,\n\t): CronBuilder<\n\t\tTInput,\n\t\t[...TServices, ...ServicesOf<T>],\n\t\tTLogger,\n\t\tOutSchema,\n\t\tTDatabase,\n\t\tTDatabaseServiceName\n\t> {\n\t\t// Both halves of the edge, from one call and one clone: the services the\n\t\t// handler runs with, and the ids the manifest records. Recording them\n\t\t// separately is what let them drift apart.\n\t\t//\n\t\t// `servicesOf` is the half that validates, so it runs first — recording\n\t\t// ids ahead of it left a caught `NotAConstruct` with `undefined` already\n\t\t// on a `string[]`.\n\t\tconst services = servicesOf(constructs) as unknown as Service[];\n\n\t\treturn cloneWith(this, {\n\t\t\t_services: uniqBy(\n\t\t\t\t[...this._services, ...services],\n\t\t\t\t(s: Service) => s.serviceName,\n\t\t\t),\n\t\t\t_constructs: idsOf(constructs, this._constructs),\n\t\t}) as unknown as CronBuilder<\n\t\t\tTInput,\n\t\t\t[...TServices, ...ServicesOf<T>],\n\t\t\tTLogger,\n\t\t\tOutSchema,\n\t\t\tTDatabase,\n\t\t\tTDatabaseServiceName\n\t\t>;\n\t}\n\n\toverride services<T extends Service[]>(\n\t\tservices: T,\n\t): CronBuilder<\n\t\tTInput,\n\t\t[...TServices, ...T],\n\t\tTLogger,\n\t\tOutSchema,\n\t\tTDatabase,\n\t\tTDatabaseServiceName\n\t> {\n\t\treturn cloneWith(this, {\n\t\t\t_services: uniqBy(\n\t\t\t\t[...this._services, ...services],\n\t\t\t\t(s) => s.serviceName,\n\t\t\t) as TServices,\n\t\t}) as unknown as CronBuilder<\n\t\t\tTInput,\n\t\t\t[...TServices, ...T],\n\t\t\tTLogger,\n\t\t\tOutSchema,\n\t\t\tTDatabase,\n\t\t\tTDatabaseServiceName\n\t\t>;\n\t}\n\n\toverride logger<T extends Logger>(\n\t\tlogger: T,\n\t): CronBuilder<\n\t\tTInput,\n\t\tTServices,\n\t\tT,\n\t\tOutSchema,\n\t\tTDatabase,\n\t\tTDatabaseServiceName\n\t> {\n\t\treturn cloneWith(this, {\n\t\t\t_logger: logger as unknown as TLogger,\n\t\t}) as unknown as CronBuilder<\n\t\t\tTInput,\n\t\t\tTServices,\n\t\t\tT,\n\t\t\tOutSchema,\n\t\t\tTDatabase,\n\t\t\tTDatabaseServiceName\n\t\t>;\n\t}\n\n\t/**\n\t * Publish `event` to `topic` each time the cron has run successfully —\n\t * repeatable, to as many topics as it names. The topic becomes a dependency\n\t * as with `.dependsOn([topic])`, so `services.<topic>` is there too.\n\t */\n\toverride event<TTopic extends Topic<any, any>>(\n\t\ttopic: TTopic,\n\t\tevent: EventFor<TTopic, InferStandardSchema<OutSchema>>,\n\t): CronBuilder<\n\t\tTInput,\n\t\t[...TServices, TTopic['service']],\n\t\tTLogger,\n\t\tOutSchema,\n\t\tTDatabase,\n\t\tTDatabaseServiceName\n\t> {\n\t\treturn this.withEvent(topic, event as never) as unknown as CronBuilder<\n\t\t\tTInput,\n\t\t\t[...TServices, TTopic['service']],\n\t\t\tTLogger,\n\t\t\tOutSchema,\n\t\t\tTDatabase,\n\t\t\tTDatabaseServiceName\n\t\t>;\n\t}\n\n\t/**\n\t * Set the database service for this cron job.\n\t * The database will be available in the handler context as `db`.\n\t */\n\toverride database<T, TName extends string>(\n\t\tsource: Consumable<TName, T> | Service<TName, T>,\n\t): CronBuilder<TInput, TServices, TLogger, OutSchema, T, TName> {\n\t\tconst service = serviceOf(source);\n\n\t\treturn cloneWith(this, {\n\t\t\t_databaseService: service as unknown as Service<\n\t\t\t\tTDatabaseServiceName,\n\t\t\t\tTDatabase\n\t\t\t>,\n\t\t\t// The edge, as `.dependsOn()` records one — see EndpointFactory —\n\t\t\t// in place of the one a previous `.database()` added, which is how a\n\t\t\t// worker's default database is overridden rather than added to.\n\t\t\t...databaseEdges(\n\t\t\t\t{\n\t\t\t\t\tconstructs: this._constructs,\n\t\t\t\t\tedge: this._databaseEdge,\n\t\t\t\t\tservice: this._databaseService as Service | undefined,\n\t\t\t\t\tservices: this._services,\n\t\t\t\t},\n\t\t\t\tsource,\n\t\t\t),\n\t\t}) as unknown as CronBuilder<\n\t\t\tTInput,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tOutSchema,\n\t\t\tT,\n\t\t\tTName\n\t\t>;\n\t}\n\n\toverride handle(\n\t\tfn: FunctionHandler<TInput, TServices, TLogger, OutSchema, TDatabase>,\n\t): Cron<\n\t\tTInput,\n\t\tTServices,\n\t\tTLogger,\n\t\tOutSchema,\n\t\tTDatabase,\n\t\tTDatabaseServiceName\n\t> {\n\t\tconst cron = new Cron(\n\t\t\tfn,\n\t\t\tthis._timeout,\n\t\t\tthis._schedule,\n\t\t\tthis.inputSchema,\n\t\t\tthis.outputSchema,\n\t\t\tthis._services,\n\t\t\tthis._logger,\n\t\t\tthis._events,\n\t\t\tthis._memorySize,\n\t\t\tthis._databaseService,\n\t\t\tthis._constructs,\n\t\t);\n\n\t\t// Which process runs it. Carried from the factory rather than inferred\n\t\t// from the directory the file happens to sit in.\n\t\tcron.owner = this._owner;\n\n\t\t// And where that process keeps the schedule, when a server is what runs\n\t\t// it. Declared once on the worker rather than repeated per cron.\n\t\tcron.scheduleStore = this._scheduleStore\n\t\t\t? serviceOf(this._scheduleStore as Consumable<string, unknown>)\n\t\t\t: undefined;\n\n\t\t// No reset. `.handle()` reads this builder and leaves it alone, so a\n\t\t// configured base — `const fn = f.logger(log).timeout(60_000)` — keeps\n\t\t// its configuration for every construct built from it. The reset that\n\t\t// used to be here wiped the base on first use, which made a base usable\n\t\t// exactly once, and quietly reverted the logger to the default.\n\n\t\treturn cron;\n\t}\n}\n"],"mappings":";;;;;;AAUA,IAAa,OAAb,cAOU,SAWR;CAyBU;;;;;;;;;;;;CAbX;CAEA,OAAO,OAAO,KAA2C;EACxD,OAAO,QACN,OACE,IAAiB,oBAAoB,QACtC,IAAI,SAAA,6BACN;CACD;CAEA,YACC,IACA,SACA,WACA,OACA,cACA,WAAsB,CAAC,GACvB,QAEA,SAAuB,CAAC,GACxB,YACA,iBAKA,aAAuB,CAAC,GACvB;EACD,MACC,IACA,SAAA,+BAEA,OACA,cACA,UACA,QACA,QACA,YACA,KAAA,GACA,iBACA,UACD;EA5BU,KAAA,YAAA;CA6BX;CAEA,IAAI,WAA2C;EAC9C,OAAO,KAAK;CACb;AACD;;;AChEA,IAAa,cAAb,cAOU,gBASR;CACD;CAEA,cAAc;EACb,MAAA,6BAAwB;CACzB;CAEA,WAAoB,YAA0B;EAC7C,OAAO,UAAU,MAAM,EAAE,aAAa,WAAW,CAAC;CACnD;CAEA,SACC,aAQC;EACD,OAAO,UAAU,MAAM,EAAE,WAAW,YAAY,CAAC;CAClD;CAEA,MACC,QAQC;EACD,OAAO,UAAU,MAAM,EACtB,aAAa,OACd,CAAC;CAQF;CAEA,OACC,QAQC;EACD,OAAO,UAAU,MAAM,EACtB,cAAc,OACf,CAAC;CAQF;;;;;;;;;;;;CAaA,UACC,YAQC;EAQD,MAAM,WAAW,WAAW,UAAU;EAEtC,OAAO,UAAU,MAAM;GACtB,YAAA,GAAWA,qBAAAA,QAAAA,CACV,CAAC,GAAG,KAAK,WAAW,GAAG,QAAQ,IAC9B,MAAe,EAAE,WACnB;GACA,aAAa,MAAM,YAAY,KAAK,WAAW;EAChD,CAAC;CAQF;CAEA,SACC,UAQC;EACD,OAAO,UAAU,MAAM,EACtB,YAAA,GAAWA,qBAAAA,QAAAA,CACV,CAAC,GAAG,KAAK,WAAW,GAAG,QAAQ,IAC9B,MAAM,EAAE,WACV,EACD,CAAC;CAQF;CAEA,OACC,QAQC;EACD,OAAO,UAAU,MAAM,EACtB,SAAS,OACV,CAAC;CAQF;;;;;;CAOA,MACC,OACA,OAQC;EACD,OAAO,KAAK,UAAU,OAAO,KAAc;CAQ5C;;;;;CAMA,SACC,QAC+D;EAC/D,MAAM,UAAU,UAAU,MAAM;EAEhC,OAAO,UAAU,MAAM;GACtB,kBAAkB;GAOlB,GAAG,cACF;IACC,YAAY,KAAK;IACjB,MAAM,KAAK;IACX,SAAS,KAAK;IACd,UAAU,KAAK;GAChB,GACA,MACD;EACD,CAAC;CAQF;CAEA,OACC,IAQC;EACD,MAAM,OAAO,IAAI,KAChB,IACA,KAAK,UACL,KAAK,WACL,KAAK,aACL,KAAK,cACL,KAAK,WACL,KAAK,SACL,KAAK,SACL,KAAK,aACL,KAAK,kBACL,KAAK,WACN;EAIA,KAAK,QAAQ,KAAK;EAIlB,KAAK,gBAAgB,KAAK,iBACvB,UAAU,KAAK,cAA6C,IAC5D,KAAA;EAQH,OAAO;CACR;AACD"}
|
|
1
|
+
{"version":3,"file":"CronBuilder-CukJuL3b.mjs","names":["uniqBy"],"sources":["../src/crons/Cron.ts","../src/crons/CronBuilder.ts"],"sourcesContent":["import type { AuditableAction } from '@geekmidas/audit';\nimport type { EventPublisher } from '@geekmidas/events';\nimport type { Logger } from '@geekmidas/logger';\nimport type { ComposableStandardSchema } from '@geekmidas/schema';\nimport type { Service } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport { ConstructType } from '../Construct';\nimport { Function, type FunctionHandler } from '../functions';\nimport type { TopicEvent } from '../publisher';\n\nexport class Cron<\n\tTInput extends ComposableStandardSchema | undefined = undefined,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tOutSchema extends StandardSchemaV1 | undefined = undefined,\n\tTDatabase = undefined,\n\tTDatabaseServiceName extends string = string,\n> extends Function<\n\tTInput,\n\tTServices,\n\tTLogger,\n\tOutSchema,\n\tundefined,\n\tstring,\n\tTDatabase,\n\tTDatabaseServiceName,\n\tAuditableAction<string, unknown>,\n\tFunctionHandler<TInput, TServices, TLogger, OutSchema, TDatabase>\n> {\n\t/**\n\t * Where this cron's schedule lives when a server runs it.\n\t *\n\t * Carried from the worker that built it, which declared it once with\n\t * `.database(db)`. Unread on AWS, where the schedule is an EventBridge rule\n\t * and nothing in this process fires anything.\n\t *\n\t * A service rather than the construct, because what reads it is service\n\t * discovery in the generated server — which registers services, and failed\n\t * on the construct with `service.register is not a function`.\n\t */\n\tscheduleStore?: Service<string, unknown>;\n\n\tstatic isCron(obj: any): obj is Cron<any, any, any, any> {\n\t\treturn Boolean(\n\t\t\tobj &&\n\t\t\t\t(obj as Function).__IS_FUNCTION__ === true &&\n\t\t\t\tobj.type === ConstructType.Cron,\n\t\t);\n\t}\n\n\tconstructor(\n\t\tfn: FunctionHandler<TInput, TServices, TLogger, OutSchema, TDatabase>,\n\t\ttimeout?: number,\n\t\tprotected _schedule?: ScheduleExpression,\n\t\tinput?: TInput,\n\t\toutputSchema?: OutSchema,\n\t\tservices: TServices = [] as unknown as TServices,\n\t\tlogger?: TLogger,\n\t\t/** What it publishes once it has run, each to its own topic. */\n\t\tevents: TopicEvent[] = [],\n\t\tmemorySize?: number,\n\t\tdatabaseService?: Service<TDatabaseServiceName, TDatabase>,\n\t\t/**\n\t\t * The construct ids `.dependsOn()` named — last, so no existing positional\n\t\t * argument moves.\n\t\t */\n\t\tconstructs: string[] = [],\n\t) {\n\t\tsuper(\n\t\t\tfn,\n\t\t\ttimeout,\n\t\t\tConstructType.Cron,\n\t\t\tinput,\n\t\t\toutputSchema,\n\t\t\tservices,\n\t\t\tlogger,\n\t\t\tevents,\n\t\t\tmemorySize,\n\t\t\tundefined, // auditorStorageService\n\t\t\tdatabaseService,\n\t\t\tconstructs,\n\t\t);\n\t}\n\n\tget schedule(): ScheduleExpression | undefined {\n\t\treturn this._schedule;\n\t}\n}\n\nexport type RateExpression = `rate(${string})`;\n\ntype CronMinute =\n\t| '*'\n\t| number\n\t| `${number}`\n\t| `${number}-${number}`\n\t| `${number}/${number}`\n\t| `*/${number}`\n\t| `${number},${number}`\n\t| string; // Allow more complex patterns\n\ntype CronHour =\n\t| '*'\n\t| number\n\t| `${number}`\n\t| `${number}-${number}`\n\t| `${number}/${number}`\n\t| `*/${number}`\n\t| `${number},${number}`\n\t| string; // Allow more complex patterns\n\ntype CronDay =\n\t| '*'\n\t| number\n\t| `${number}`\n\t| `${number}-${number}`\n\t| `${number}/${number}`\n\t| `*/${number}`\n\t| `${number},${number}`\n\t| string; // Allow more complex patterns\n\ntype CronMonth =\n\t| '*'\n\t| number\n\t| `${number}`\n\t| `${number}-${number}`\n\t| `${number}/${number}`\n\t| `*/${number}`\n\t| 'JAN'\n\t| 'FEB'\n\t| 'MAR'\n\t| 'APR'\n\t| 'MAY'\n\t| 'JUN'\n\t| 'JUL'\n\t| 'AUG'\n\t| 'SEP'\n\t| 'OCT'\n\t| 'NOV'\n\t| 'DEC'\n\t| string; // Allow more complex patterns\n\ntype CronWeekday =\n\t| '*'\n\t| number\n\t| `${number}`\n\t| `${number}-${number}`\n\t| `${number}/${number}`\n\t| `*/${number}`\n\t| 'SUN'\n\t| 'MON'\n\t| 'TUE'\n\t| 'WED'\n\t| 'THU'\n\t| 'FRI'\n\t| 'SAT'\n\t| `${string}-${string}` // Allow patterns like MON-FRI\n\t| string; // Allow more complex patterns\n\nexport type CronExpression =\n\t`cron(${CronMinute} ${CronHour} ${CronDay} ${CronMonth} ${CronWeekday})`;\n\nexport type ScheduleExpression = RateExpression | CronExpression;\n","import type { Logger } from '@geekmidas/logger';\nimport type {\n\tComposableStandardSchema,\n\tInferStandardSchema,\n} from '@geekmidas/schema';\nimport type { Service } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport uniqBy from 'lodash.uniqby';\nimport { ConstructType } from '../Construct';\nimport { cloneWith } from '../clone';\nimport {\n\ttype Consumable,\n\tdatabaseEdges,\n\tidsOf,\n\ttype ServicesOf,\n\tserviceOf,\n\tservicesOf,\n} from '../construct-interface';\nimport { FunctionBuilder, type FunctionHandler } from '../functions';\nimport type { EventFor } from '../publisher';\nimport type { Topic } from '../topic/Topic';\nimport { Cron, type ScheduleExpression } from './Cron';\n\nexport class CronBuilder<\n\tTInput extends ComposableStandardSchema,\n\tTServices extends Service[],\n\tTLogger extends Logger = Logger,\n\tOutSchema extends StandardSchemaV1 | undefined = undefined,\n\tTDatabase = undefined,\n\tTDatabaseServiceName extends string = string,\n> extends FunctionBuilder<\n\tTInput,\n\tOutSchema,\n\tTServices,\n\tTLogger,\n\tundefined,\n\tstring,\n\tTDatabase,\n\tTDatabaseServiceName\n> {\n\tprivate _schedule?: ScheduleExpression;\n\n\tconstructor() {\n\t\tsuper(ConstructType.Cron);\n\t}\n\n\toverride memorySize(memorySize: number): this {\n\t\treturn cloneWith(this, { _memorySize: memorySize });\n\t}\n\n\tschedule(\n\t\t_expression: ScheduleExpression,\n\t): CronBuilder<\n\t\tTInput,\n\t\tTServices,\n\t\tTLogger,\n\t\tOutSchema,\n\t\tTDatabase,\n\t\tTDatabaseServiceName\n\t> {\n\t\treturn cloneWith(this, { _schedule: _expression });\n\t}\n\n\toverride input<T extends ComposableStandardSchema>(\n\t\tschema: T,\n\t): CronBuilder<\n\t\tT,\n\t\tTServices,\n\t\tTLogger,\n\t\tOutSchema,\n\t\tTDatabase,\n\t\tTDatabaseServiceName\n\t> {\n\t\treturn cloneWith(this, {\n\t\t\tinputSchema: schema as unknown as TInput,\n\t\t}) as unknown as CronBuilder<\n\t\t\tT,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tOutSchema,\n\t\t\tTDatabase,\n\t\t\tTDatabaseServiceName\n\t\t>;\n\t}\n\n\toverride output<T extends StandardSchemaV1>(\n\t\tschema: T,\n\t): CronBuilder<\n\t\tTInput,\n\t\tTServices,\n\t\tTLogger,\n\t\tT,\n\t\tTDatabase,\n\t\tTDatabaseServiceName\n\t> {\n\t\treturn cloneWith(this, {\n\t\t\toutputSchema: schema as unknown as OutSchema,\n\t\t}) as unknown as CronBuilder<\n\t\t\tTInput,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tT,\n\t\t\tTDatabase,\n\t\t\tTDatabaseServiceName\n\t\t>;\n\t}\n\n\t/**\n\t * Depend on constructs — a database, a bucket, a mail sender, a queue, a\n\t * topic.\n\t *\n\t * It records the edge and dissolves each construct's client into the\n\t * handler's service record under the construct's own id, so\n\t * `.dependsOn([uploads])` is what makes `services.uploads` exist and type.\n\t *\n\t * Constructs only. A `Service` does not match the shape, which is what keeps\n\t * env sniffing confined to `.services()` and the explicit lift.\n\t */\n\toverride dependsOn<const T extends readonly Consumable[]>(\n\t\tconstructs: T,\n\t): CronBuilder<\n\t\tTInput,\n\t\t[...TServices, ...ServicesOf<T>],\n\t\tTLogger,\n\t\tOutSchema,\n\t\tTDatabase,\n\t\tTDatabaseServiceName\n\t> {\n\t\t// Both halves of the edge, from one call and one clone: the services the\n\t\t// handler runs with, and the ids the manifest records. Recording them\n\t\t// separately is what let them drift apart.\n\t\t//\n\t\t// `servicesOf` is the half that validates, so it runs first — recording\n\t\t// ids ahead of it left a caught `NotAConstruct` with `undefined` already\n\t\t// on a `string[]`.\n\t\tconst services = servicesOf(constructs) as unknown as Service[];\n\n\t\treturn cloneWith(this, {\n\t\t\t_services: uniqBy(\n\t\t\t\t[...this._services, ...services],\n\t\t\t\t(s: Service) => s.serviceName,\n\t\t\t),\n\t\t\t_constructs: idsOf(constructs, this._constructs),\n\t\t}) as unknown as CronBuilder<\n\t\t\tTInput,\n\t\t\t[...TServices, ...ServicesOf<T>],\n\t\t\tTLogger,\n\t\t\tOutSchema,\n\t\t\tTDatabase,\n\t\t\tTDatabaseServiceName\n\t\t>;\n\t}\n\n\toverride services<T extends Service[]>(\n\t\tservices: T,\n\t): CronBuilder<\n\t\tTInput,\n\t\t[...TServices, ...T],\n\t\tTLogger,\n\t\tOutSchema,\n\t\tTDatabase,\n\t\tTDatabaseServiceName\n\t> {\n\t\treturn cloneWith(this, {\n\t\t\t_services: uniqBy(\n\t\t\t\t[...this._services, ...services],\n\t\t\t\t(s) => s.serviceName,\n\t\t\t) as TServices,\n\t\t}) as unknown as CronBuilder<\n\t\t\tTInput,\n\t\t\t[...TServices, ...T],\n\t\t\tTLogger,\n\t\t\tOutSchema,\n\t\t\tTDatabase,\n\t\t\tTDatabaseServiceName\n\t\t>;\n\t}\n\n\toverride logger<T extends Logger>(\n\t\tlogger: T,\n\t): CronBuilder<\n\t\tTInput,\n\t\tTServices,\n\t\tT,\n\t\tOutSchema,\n\t\tTDatabase,\n\t\tTDatabaseServiceName\n\t> {\n\t\treturn cloneWith(this, {\n\t\t\t_logger: logger as unknown as TLogger,\n\t\t}) as unknown as CronBuilder<\n\t\t\tTInput,\n\t\t\tTServices,\n\t\t\tT,\n\t\t\tOutSchema,\n\t\t\tTDatabase,\n\t\t\tTDatabaseServiceName\n\t\t>;\n\t}\n\n\t/**\n\t * Publish `event` to `topic` each time the cron has run successfully —\n\t * repeatable, to as many topics as it names. The topic becomes a dependency\n\t * as with `.dependsOn([topic])`, so `services.<topic>` is there too.\n\t */\n\toverride event<TTopic extends Topic<any, any>>(\n\t\ttopic: TTopic,\n\t\tevent: EventFor<TTopic, InferStandardSchema<OutSchema>>,\n\t): CronBuilder<\n\t\tTInput,\n\t\t[...TServices, TTopic['service']],\n\t\tTLogger,\n\t\tOutSchema,\n\t\tTDatabase,\n\t\tTDatabaseServiceName\n\t> {\n\t\treturn this.withEvent(topic, event as never) as unknown as CronBuilder<\n\t\t\tTInput,\n\t\t\t[...TServices, TTopic['service']],\n\t\t\tTLogger,\n\t\t\tOutSchema,\n\t\t\tTDatabase,\n\t\t\tTDatabaseServiceName\n\t\t>;\n\t}\n\n\t/**\n\t * Set the database service for this cron job.\n\t * The database will be available in the handler context as `db`.\n\t */\n\toverride database<T, TName extends string>(\n\t\tsource: Consumable<TName, T> | Service<TName, T>,\n\t): CronBuilder<TInput, TServices, TLogger, OutSchema, T, TName> {\n\t\tconst service = serviceOf(source);\n\n\t\treturn cloneWith(this, {\n\t\t\t_databaseService: service as unknown as Service<\n\t\t\t\tTDatabaseServiceName,\n\t\t\t\tTDatabase\n\t\t\t>,\n\t\t\t// The edge, as `.dependsOn()` records one — see EndpointFactory —\n\t\t\t// in place of the one a previous `.database()` added, which is how a\n\t\t\t// worker's default database is overridden rather than added to.\n\t\t\t...databaseEdges(\n\t\t\t\t{\n\t\t\t\t\tconstructs: this._constructs,\n\t\t\t\t\tedge: this._databaseEdge,\n\t\t\t\t\tservice: this._databaseService as Service | undefined,\n\t\t\t\t\tservices: this._services,\n\t\t\t\t},\n\t\t\t\tsource,\n\t\t\t),\n\t\t}) as unknown as CronBuilder<\n\t\t\tTInput,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tOutSchema,\n\t\t\tT,\n\t\t\tTName\n\t\t>;\n\t}\n\n\toverride handle(\n\t\tfn: FunctionHandler<TInput, TServices, TLogger, OutSchema, TDatabase>,\n\t): Cron<\n\t\tTInput,\n\t\tTServices,\n\t\tTLogger,\n\t\tOutSchema,\n\t\tTDatabase,\n\t\tTDatabaseServiceName\n\t> {\n\t\tconst cron = new Cron(\n\t\t\tfn,\n\t\t\tthis._timeout,\n\t\t\tthis._schedule,\n\t\t\tthis.inputSchema,\n\t\t\tthis.outputSchema,\n\t\t\tthis._services,\n\t\t\tthis._logger,\n\t\t\tthis._events,\n\t\t\tthis._memorySize,\n\t\t\tthis._databaseService,\n\t\t\tthis._constructs,\n\t\t);\n\n\t\t// Which process runs it. Carried from the factory rather than inferred\n\t\t// from the directory the file happens to sit in.\n\t\tcron.owner = this._owner;\n\n\t\t// And where that process keeps the schedule, when a server is what runs\n\t\t// it. Declared once on the worker rather than repeated per cron.\n\t\tcron.scheduleStore = this._scheduleStore\n\t\t\t? serviceOf(this._scheduleStore as Consumable<string, unknown>)\n\t\t\t: undefined;\n\n\t\t// No reset. `.handle()` reads this builder and leaves it alone, so a\n\t\t// configured base — `const fn = f.logger(log).timeout(60_000)` — keeps\n\t\t// its configuration for every construct built from it. The reset that\n\t\t// used to be here wiped the base on first use, which made a base usable\n\t\t// exactly once, and quietly reverted the logger to the default.\n\n\t\treturn cron;\n\t}\n}\n"],"mappings":";;;;;;AAUA,IAAa,OAAb,cAOU,SAWR;CAyBU;;;;;;;;;;;;CAbX;CAEA,OAAO,OAAO,KAA2C;EACxD,OAAO,QACN,OACE,IAAiB,oBAAoB,QACtC,IAAI,SAAA,6BACN;CACD;CAEA,YACC,IACA,SACA,WACA,OACA,cACA,WAAsB,CAAC,GACvB,QAEA,SAAuB,CAAC,GACxB,YACA,iBAKA,aAAuB,CAAC,GACvB;EACD,MACC,IACA,SAAA,+BAEA,OACA,cACA,UACA,QACA,QACA,YACA,KAAA,GACA,iBACA,UACD;EA5BU,KAAA,YAAA;CA6BX;CAEA,IAAI,WAA2C;EAC9C,OAAO,KAAK;CACb;AACD;;;AChEA,IAAa,cAAb,cAOU,gBASR;CACD;CAEA,cAAc;EACb,MAAA,6BAAwB;CACzB;CAEA,WAAoB,YAA0B;EAC7C,OAAO,UAAU,MAAM,EAAE,aAAa,WAAW,CAAC;CACnD;CAEA,SACC,aAQC;EACD,OAAO,UAAU,MAAM,EAAE,WAAW,YAAY,CAAC;CAClD;CAEA,MACC,QAQC;EACD,OAAO,UAAU,MAAM,EACtB,aAAa,OACd,CAAC;CAQF;CAEA,OACC,QAQC;EACD,OAAO,UAAU,MAAM,EACtB,cAAc,OACf,CAAC;CAQF;;;;;;;;;;;;CAaA,UACC,YAQC;EAQD,MAAM,WAAW,WAAW,UAAU;EAEtC,OAAO,UAAU,MAAM;GACtB,YAAA,GAAWA,qBAAAA,QAAAA,CACV,CAAC,GAAG,KAAK,WAAW,GAAG,QAAQ,IAC9B,MAAe,EAAE,WACnB;GACA,aAAa,MAAM,YAAY,KAAK,WAAW;EAChD,CAAC;CAQF;CAEA,SACC,UAQC;EACD,OAAO,UAAU,MAAM,EACtB,YAAA,GAAWA,qBAAAA,QAAAA,CACV,CAAC,GAAG,KAAK,WAAW,GAAG,QAAQ,IAC9B,MAAM,EAAE,WACV,EACD,CAAC;CAQF;CAEA,OACC,QAQC;EACD,OAAO,UAAU,MAAM,EACtB,SAAS,OACV,CAAC;CAQF;;;;;;CAOA,MACC,OACA,OAQC;EACD,OAAO,KAAK,UAAU,OAAO,KAAc;CAQ5C;;;;;CAMA,SACC,QAC+D;EAC/D,MAAM,UAAU,UAAU,MAAM;EAEhC,OAAO,UAAU,MAAM;GACtB,kBAAkB;GAOlB,GAAG,cACF;IACC,YAAY,KAAK;IACjB,MAAM,KAAK;IACX,SAAS,KAAK;IACd,UAAU,KAAK;GAChB,GACA,MACD;EACD,CAAC;CAQF;CAEA,OACC,IAQC;EACD,MAAM,OAAO,IAAI,KAChB,IACA,KAAK,UACL,KAAK,WACL,KAAK,aACL,KAAK,cACL,KAAK,WACL,KAAK,SACL,KAAK,SACL,KAAK,aACL,KAAK,kBACL,KAAK,WACN;EAIA,KAAK,QAAQ,KAAK;EAIlB,KAAK,gBAAgB,KAAK,iBACvB,UAAU,KAAK,cAA6C,IAC5D,KAAA;EAQH,OAAO;CACR;AACD"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { n as StandardSchemaV1 } from "./index-DdRjYhiJ.mjs";
|
|
2
|
-
import { o as TopicEvent } from "./Construct-
|
|
3
|
-
import { i as FunctionHandler, n as Function } from "./Function-
|
|
2
|
+
import { o as TopicEvent } from "./Construct-BMk_CRSD.mjs";
|
|
3
|
+
import { i as FunctionHandler, n as Function } from "./Function-BKReud5p.mjs";
|
|
4
4
|
import { t as Authenticator } from "./construct-interface-CSA9VeWM.mjs";
|
|
5
|
-
import "./index-
|
|
5
|
+
import "./index-BoQ3-M-K.mjs";
|
|
6
6
|
import { n as LowerHttpMethod, t as HttpMethod } from "./types-DMuSQeLL.mjs";
|
|
7
7
|
import { t as EndpointTelemetry } from "./telemetry-CObow3Dn.mjs";
|
|
8
8
|
import { i as AuthSession } from "./auth-DnB9H9KL.mjs";
|
|
9
9
|
import { Service, ServiceRecord } from "@geekmidas/services";
|
|
10
10
|
import { ComponentCollector, OpenApiSchemaOptions } from "@geekmidas/schema/openapi";
|
|
11
11
|
import { EnvironmentParser } from "@geekmidas/envkit";
|
|
12
|
-
import { AuditActor, AuditStorage, AuditableAction, Auditor, ExtractAuditPayload, ExtractAuditType } from "@geekmidas/audit";
|
|
13
12
|
import { Logger } from "@geekmidas/logger";
|
|
14
13
|
import { InferComposableStandardSchema, InferStandardSchema, InferStandardSchemaInput } from "@geekmidas/schema";
|
|
14
|
+
import { AuditActor, AuditStorage, AuditableAction, Auditor, ExtractAuditPayload, ExtractAuditType } from "@geekmidas/audit";
|
|
15
15
|
import { RateLimitConfig } from "@geekmidas/rate-limit";
|
|
16
16
|
import { OpenAPIV3_1 } from "openapi-types";
|
|
17
17
|
//#region src/endpoints/Authorizer.d.ts
|
|
@@ -923,4 +923,4 @@ type EndpointStatus = SuccessStatus | RedirectStatus;
|
|
|
923
923
|
type EndpointOutput<T> = T extends Endpoint<any, any, any, infer OutSchema, any, any, any, any> ? InferStandardSchema<OutSchema> : never;
|
|
924
924
|
//#endregion
|
|
925
925
|
export { SecurityScheme as A, ActorExtractor as C, BuiltInSecuritySchemeId as D, BUILT_IN_SECURITY_SCHEMES as E, getSecurityScheme as M, isBuiltInSecurityScheme as N, OAuthFlow as O, RlsContextExtractor as S, Authorizer as T, SessionAuth as _, EndpointContext as a, RlsConfig as b, EndpointSchemas as c, HeaderFn as d, RedirectStatus as f, NoAuthenticator as g, SuccessStatus as h, Endpoint as i, createAuthorizer as j, OAuthFlows as k, EndpointStatus as l, SessionFn as m, ConvertRouteParams as n, EndpointHandler as o, ResponseBuilder as p, CookieFn as r, EndpointOutput as s, AuthorizeFn as t, EndpointSurface as u, RLS_BYPASS as v, MappedAudit as w, RlsContext as x, RlsBypass as y };
|
|
926
|
-
//# sourceMappingURL=Endpoint-
|
|
926
|
+
//# sourceMappingURL=Endpoint-BUoDD96P.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Endpoint-
|
|
1
|
+
{"version":3,"file":"Endpoint-BUoDD96P.d.mts","names":[],"sources":["../src/endpoints/Authorizer.ts","../src/endpoints/audit.ts","../src/endpoints/rls.ts","../src/endpoints/sessionAuth.ts","../src/endpoints/Endpoint.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;UAIiB;;EAEhB;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA,QAAQ;;EAER;;GAEC;;;;;UAMe;EAChB,WAAW;EACX,WAAW;EACX,oBAAoB;EACpB,oBAAoB;;UAGJ;EAChB;EACA;EACA;EACA,QAAQ;;;;;;cAOI;;aAEX;aACA;aACA;aACA;;;aAGA;aACA;aACA;;;aAGA;aACA;aACA;aACA;;;aAGA;aACA;aACA;;;aAGA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;;;;KAKU,uCAAuC;;;;UAKlC;;;;EAIhB;;;;EAIA,iBAAiB;;;;;EAKjB;;;;;EAKA;;;;;EAKA,WAAW;;;;;iBAMI,iBACf,cACA,UAAU,KAAK,sBACb;;;;iBAUa,wBACf,eACE,QAAQ;;;;iBAOK,kBACf,cACA,gBAAgB,eAAe,kBAC7B;;;;;;;;;;UC3Hc,YAChB,qBAAqB,kCACrB,gBAAgB,8BAChB,cAAc,iBAAiB,gBAAgB,iBAAiB;;EAGhE,MAAM;;EAEN,UACC,UAAU,gBAAgB,mBACvB,oBAAoB,uBAEnB,oBAAoB,cAAc;;EAEvC,QACC,UAAU,gBAAgB,mBACvB,oBAAoB;;EAIxB,YACC,UAAU,gBAAgB,mBACvB,oBAAoB,gCAEV;;EAEd;;;;;;;;;KAUW,eACX,k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;;KA+BL,gBACX,eAAe,yCACf,kBAAkB,gBAClB,gBAAgB,SAAS,QACzB,kBAAkB,0CAClB,oBACA,uBACA,2BACA,qBAAqB,mCAAmC,qCAKxD,KAAK,gBACJ,QACA,WACA,SACA,UACA,cACA,WACA,gBAED,UAAU,oBACN,kBAAkB,mBAQlB,yBAAyB,aACzB,qBAAqB,yBAAyB,cAC9C,QACE,yBAAyB,aACzB,qBAAqB,yBAAyB,yBAIhD,gCACA,mBACA,QAAQ;;;;aAKD;;EAEX;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;;;;;aAOW;;EAEX;;EAEA;;EAEA;;EAEA;;EAEA;;;KAIW,iBAAiB,gBAAgB;KAEjC,eAAe,KAC1B,UAAU,8BAA8B,iCACrC,oBAAoB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "./Construct-
|
|
1
|
+
import "./Construct-CRV3RN2U.mjs";
|
|
2
2
|
import { t as identifyUser } from "./tracing-Bbj1uoFJ.mjs";
|
|
3
|
-
import { n as Function } from "./functions-
|
|
3
|
+
import { n as Function } from "./functions-BF039DT8.mjs";
|
|
4
4
|
import { convertSchemaWithComponents, convertStandardSchemaToJsonSchema } from "@geekmidas/schema/conversion";
|
|
5
5
|
import { buildOpenApiSchema } from "@geekmidas/schema/openapi";
|
|
6
6
|
//#region src/endpoints/sessionAuth.ts
|
|
@@ -549,4 +549,4 @@ let RedirectStatus = /* @__PURE__ */ function(RedirectStatus) {
|
|
|
549
549
|
//#endregion
|
|
550
550
|
export { NoAuthenticator as a, SuccessStatus as i, RedirectStatus as n, ResponseBuilder as r, Endpoint as t };
|
|
551
551
|
|
|
552
|
-
//# sourceMappingURL=Endpoint-
|
|
552
|
+
//# sourceMappingURL=Endpoint-BuKHHVZc.mjs.map
|