stratal 0.0.17 → 0.0.19
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 +8 -8
- package/dist/{base-email.provider-DypUAfWm.mjs → base-email.provider-mjynzewK.mjs} +1 -1
- package/dist/{base-email.provider-DypUAfWm.mjs.map → base-email.provider-mjynzewK.mjs.map} +1 -1
- package/dist/bin/cloudflare-workers-loader.mjs +33 -1
- package/dist/bin/cloudflare-workers-loader.mjs.map +1 -1
- package/dist/bin/quarry.mjs +169 -7
- package/dist/bin/quarry.mjs.map +1 -1
- package/dist/cache/index.d.mts +3 -2
- package/dist/cache/index.d.mts.map +1 -1
- package/dist/cache/index.mjs +3 -10
- package/dist/cache/index.mjs.map +1 -1
- package/dist/{colors-Y7WIFXs7.mjs → colors-DJaRDXoS.mjs} +1 -1
- package/dist/{colors-Y7WIFXs7.mjs.map → colors-DJaRDXoS.mjs.map} +1 -1
- package/dist/{command-B1CPgsrU.mjs → command-BgSlsS4M.mjs} +3 -3
- package/dist/command-BgSlsS4M.mjs.map +1 -0
- package/dist/{command-TnkPYWta.d.mts → command-DsQq56Lp.d.mts} +2 -2
- package/dist/{command-TnkPYWta.d.mts.map → command-DsQq56Lp.d.mts.map} +1 -1
- package/dist/config/index.d.mts +81 -37
- package/dist/config/index.d.mts.map +1 -1
- package/dist/config/index.mjs +135 -61
- package/dist/config/index.mjs.map +1 -1
- package/dist/{consumer-registry-Bymm6ff4.d.mts → consumer-registry-Doom7BEh.d.mts} +1 -1
- package/dist/{consumer-registry-Bymm6ff4.d.mts.map → consumer-registry-Doom7BEh.d.mts.map} +1 -1
- package/dist/controller.decorator-LZY9aHYG.mjs +66 -0
- package/dist/controller.decorator-LZY9aHYG.mjs.map +1 -0
- package/dist/cron/index.d.mts +4 -3
- package/dist/cron/index.d.mts.map +1 -1
- package/dist/cron/index.mjs +1 -3
- package/dist/{cron-manager-CFBamKKk.mjs → cron-manager-C30t9UZM.mjs} +29 -19
- package/dist/cron-manager-C30t9UZM.mjs.map +1 -0
- package/dist/{cron-manager-D7imGwUT.d.mts → cron-manager-RuPtFVLy.d.mts} +28 -14
- package/dist/cron-manager-RuPtFVLy.d.mts.map +1 -0
- package/dist/di/index.d.mts +2 -2
- package/dist/di/index.mjs +3 -3
- package/dist/email/index.d.mts +3 -3
- package/dist/email/index.mjs +87 -18
- package/dist/email/index.mjs.map +1 -1
- package/dist/{en-DaewN8hc.mjs → en-rHmW6vD9.mjs} +14 -31
- package/dist/en-rHmW6vD9.mjs.map +1 -0
- package/dist/env-CamWD-U1.d.mts +25 -0
- package/dist/env-CamWD-U1.d.mts.map +1 -0
- package/dist/errors/index.d.mts +2 -2
- package/dist/errors/index.mjs +2 -3
- package/dist/errors-B4pYgYON.mjs +1714 -0
- package/dist/errors-B4pYgYON.mjs.map +1 -0
- package/dist/{errors-DuAR5Wke.mjs → errors-BUyUfr2Z.mjs} +14 -7
- package/dist/errors-BUyUfr2Z.mjs.map +1 -0
- package/dist/events/index.d.mts +2 -2
- package/dist/events/index.mjs +1 -2
- package/dist/{events-CvUSgEuN.mjs → events-COKixqnG.mjs} +2 -2
- package/dist/{events-CvUSgEuN.mjs.map → events-COKixqnG.mjs.map} +1 -1
- package/dist/{gateway-context-CNOLkLUC.mjs → gateway-context-cqZ8wMoi.mjs} +4 -9
- package/dist/gateway-context-cqZ8wMoi.mjs.map +1 -0
- package/dist/guards/index.d.mts +14 -5
- package/dist/guards/index.d.mts.map +1 -1
- package/dist/guards/index.mjs +1 -1
- package/dist/{guards-DUk_Kzst.mjs → guards-DMbsAxSX.mjs} +1 -1
- package/dist/guards-DMbsAxSX.mjs.map +1 -0
- package/dist/http-method.decorator-BT3ufnz8.mjs +96 -0
- package/dist/http-method.decorator-BT3ufnz8.mjs.map +1 -0
- package/dist/i18n/index.d.mts +3 -3
- package/dist/i18n/index.mjs +3 -16
- package/dist/i18n/messages/en/index.d.mts +1 -1
- package/dist/i18n/messages/en/index.mjs +1 -1
- package/dist/i18n/utils/index.d.mts +30 -0
- package/dist/i18n/utils/index.d.mts.map +1 -0
- package/dist/i18n/utils/index.mjs +2 -0
- package/dist/i18n/validation/index.d.mts +1 -1
- package/dist/i18n/validation/index.mjs +1 -1
- package/dist/i18n.module-CI_prYFD.mjs +2340 -0
- package/dist/i18n.module-CI_prYFD.mjs.map +1 -0
- package/dist/{index-NGxg-KP_.d.mts → index-B437eK7p.d.mts} +59 -16
- package/dist/index-B437eK7p.d.mts.map +1 -0
- package/dist/{index-Dp6A5ywM.d.mts → index-CWRS7Ri3.d.mts} +1 -1
- package/dist/{index-Dp6A5ywM.d.mts.map → index-CWRS7Ri3.d.mts.map} +1 -1
- package/dist/{index-D_w_Rmtd.d.mts → index-DFhEeFfC.d.mts} +13 -30
- package/dist/{index-D_w_Rmtd.d.mts.map → index-DFhEeFfC.d.mts.map} +1 -1
- package/dist/index-DPFqRs8L.d.mts +4318 -0
- package/dist/index-DPFqRs8L.d.mts.map +1 -0
- package/dist/{index-DGRe6Yoa.d.mts → index-Dnqm9ZB6.d.mts} +5 -4
- package/dist/index-Dnqm9ZB6.d.mts.map +1 -0
- package/dist/index-SHx31sBJ.d.mts +101 -0
- package/dist/index-SHx31sBJ.d.mts.map +1 -0
- package/dist/index.d.mts +5 -3
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -20
- package/dist/{is-command-DJVI6wEJ.mjs → is-command-C6a7WTPw.mjs} +2 -2
- package/dist/{is-command-DJVI6wEJ.mjs.map → is-command-C6a7WTPw.mjs.map} +1 -1
- package/dist/{is-seeder-D5MIEcdz.mjs → is-seeder-CebjZCDn.mjs} +1 -1
- package/dist/{is-seeder-D5MIEcdz.mjs.map → is-seeder-CebjZCDn.mjs.map} +1 -1
- package/dist/logger/index.d.mts +1 -1
- package/dist/logger/index.mjs +1 -1
- package/dist/{logger-CGT91VY6.mjs → logger-V6Ms3QnQ.mjs} +63 -45
- package/dist/logger-V6Ms3QnQ.mjs.map +1 -0
- package/dist/macroable/index.d.mts +2 -0
- package/dist/macroable/index.mjs +2 -0
- package/dist/macroable-BmufBshB.mjs +122 -0
- package/dist/macroable-BmufBshB.mjs.map +1 -0
- package/dist/module/index.d.mts +3 -4
- package/dist/module/index.d.mts.map +1 -1
- package/dist/module/index.mjs +1 -10
- package/dist/module-qGE_1duv.mjs +732 -0
- package/dist/module-qGE_1duv.mjs.map +1 -0
- package/dist/openapi/index.d.mts +3 -3
- package/dist/openapi/index.mjs +2 -15
- package/dist/{openapi-tools.service-B3TxYKoQ.mjs → openapi-tools.service-CYWGuhue.mjs} +4 -1
- package/dist/{openapi-tools.service-B3TxYKoQ.mjs.map → openapi-tools.service-CYWGuhue.mjs.map} +1 -1
- package/dist/{openapi.service-DGnX3Fc4.d.mts → openapi.service-Bv_NioM9.d.mts} +9 -17
- package/dist/openapi.service-Bv_NioM9.d.mts.map +1 -0
- package/dist/quarry/index.d.mts +26 -12
- package/dist/quarry/index.d.mts.map +1 -1
- package/dist/quarry/index.mjs +4 -8
- package/dist/{quarry-registry-B2rkO-JS.mjs → quarry-registry-DFfRRkA7.mjs} +45 -40
- package/dist/quarry-registry-DFfRRkA7.mjs.map +1 -0
- package/dist/queue/index.d.mts +2 -2
- package/dist/queue/index.mjs +3 -13
- package/dist/queue/index.mjs.map +1 -1
- package/dist/{queue.module-BtI8f4Jo.mjs → queue.module-P-G-nCYz.mjs} +39 -42
- package/dist/queue.module-P-G-nCYz.mjs.map +1 -0
- package/dist/r2-storage.provider-LdzK9tfG.mjs +244 -0
- package/dist/r2-storage.provider-LdzK9tfG.mjs.map +1 -0
- package/dist/{resend.provider-bXMEkdRJ.mjs → resend.provider-bwILp0WI.mjs} +2 -4
- package/dist/{resend.provider-bXMEkdRJ.mjs.map → resend.provider-bwILp0WI.mjs.map} +1 -1
- package/dist/router/index.d.mts +2 -2
- package/dist/router/index.mjs +7 -16
- package/dist/seeder/index.d.mts +3 -4
- package/dist/seeder/index.d.mts.map +1 -1
- package/dist/seeder/index.mjs +2 -6
- package/dist/{seeder-R7RXJC35.mjs → seeder-BcqIFa2X.mjs} +5 -5
- package/dist/{seeder-R7RXJC35.mjs.map → seeder-BcqIFa2X.mjs.map} +1 -1
- package/dist/setup-CtekcwuO.mjs +37 -0
- package/dist/setup-CtekcwuO.mjs.map +1 -0
- package/dist/signed-url-COX7cCWR.mjs +74 -0
- package/dist/signed-url-COX7cCWR.mjs.map +1 -0
- package/dist/{smtp.provider-DrbHQztF.mjs → smtp.provider-B07yuARi.mjs} +2 -4
- package/dist/{smtp.provider-DrbHQztF.mjs.map → smtp.provider-B07yuARi.mjs.map} +1 -1
- package/dist/storage/index.d.mts +39 -17
- package/dist/storage/index.d.mts.map +1 -1
- package/dist/storage/index.mjs +3 -14
- package/dist/storage/providers/index.d.mts +30 -69
- package/dist/storage/providers/index.d.mts.map +1 -1
- package/dist/storage/providers/index.mjs +2 -5
- package/dist/{storage-CZKHOhci.mjs → storage-P6X4h9So.mjs} +102 -29
- package/dist/storage-P6X4h9So.mjs.map +1 -0
- package/dist/{storage-provider.interface-0IqcdhBf.d.mts → storage-provider.interface-CC1nniHk.d.mts} +20 -15
- package/dist/storage-provider.interface-CC1nniHk.d.mts.map +1 -0
- package/dist/stratal-BCiwCFN9.mjs +533 -0
- package/dist/stratal-BCiwCFN9.mjs.map +1 -0
- package/dist/{types-DahElfUw.d.mts → types-DIWemRad.d.mts} +2 -2
- package/dist/types-DIWemRad.d.mts.map +1 -0
- package/dist/{usage-generator-CVIsENuE.mjs → usage-generator-MBcRo0Q2.mjs} +2 -2
- package/dist/{usage-generator-CVIsENuE.mjs.map → usage-generator-MBcRo0Q2.mjs.map} +1 -1
- package/dist/{validation-DQTC259A.mjs → validation-Dbg3ehdP.mjs} +2 -2
- package/dist/{validation-DQTC259A.mjs.map → validation-Dbg3ehdP.mjs.map} +1 -1
- package/dist/websocket/index.d.mts +3 -3
- package/dist/websocket/index.d.mts.map +1 -1
- package/dist/websocket/index.mjs +1 -4
- package/dist/workers/index.d.mts +2 -1
- package/dist/workers/index.d.mts.map +1 -1
- package/dist/workers/index.mjs +2 -20
- package/dist/workers/index.mjs.map +1 -1
- package/package.json +41 -50
- package/dist/application-DfPtIzxF.d.mts +0 -177
- package/dist/application-DfPtIzxF.d.mts.map +0 -1
- package/dist/command-B1CPgsrU.mjs.map +0 -1
- package/dist/cron-manager-CFBamKKk.mjs.map +0 -1
- package/dist/cron-manager-D7imGwUT.d.mts.map +0 -1
- package/dist/en-DaewN8hc.mjs.map +0 -1
- package/dist/errors-DSKapqD8.mjs +0 -707
- package/dist/errors-DSKapqD8.mjs.map +0 -1
- package/dist/errors-DuAR5Wke.mjs.map +0 -1
- package/dist/gateway-context-CNOLkLUC.mjs.map +0 -1
- package/dist/guards-DUk_Kzst.mjs.map +0 -1
- package/dist/i18n.module-Dn9SrFdS.mjs +0 -1841
- package/dist/i18n.module-Dn9SrFdS.mjs.map +0 -1
- package/dist/index-BFCxSp_f.d.mts +0 -2625
- package/dist/index-BFCxSp_f.d.mts.map +0 -1
- package/dist/index-DGRe6Yoa.d.mts.map +0 -1
- package/dist/index-NGxg-KP_.d.mts.map +0 -1
- package/dist/logger-CGT91VY6.mjs.map +0 -1
- package/dist/middleware/index.d.mts +0 -2
- package/dist/middleware/index.mjs +0 -5
- package/dist/middleware-Bl-b5pkt.mjs +0 -362
- package/dist/middleware-Bl-b5pkt.mjs.map +0 -1
- package/dist/module-registry-CmjBX6ol.d.mts +0 -121
- package/dist/module-registry-CmjBX6ol.d.mts.map +0 -1
- package/dist/module-tUtyVJ5E.mjs +0 -371
- package/dist/module-tUtyVJ5E.mjs.map +0 -1
- package/dist/openapi.service-DGnX3Fc4.d.mts.map +0 -1
- package/dist/quarry-registry-B2rkO-JS.mjs.map +0 -1
- package/dist/queue.module-BtI8f4Jo.mjs.map +0 -1
- package/dist/router-context-D9R1v2Ac.mjs +0 -267
- package/dist/router-context-D9R1v2Ac.mjs.map +0 -1
- package/dist/s3-storage.provider-CttzNnDR.mjs +0 -335
- package/dist/s3-storage.provider-CttzNnDR.mjs.map +0 -1
- package/dist/storage-CZKHOhci.mjs.map +0 -1
- package/dist/storage-provider.interface-0IqcdhBf.d.mts.map +0 -1
- package/dist/stratal-D5smIU1y.mjs +0 -315
- package/dist/stratal-D5smIU1y.mjs.map +0 -1
- package/dist/types-DahElfUw.d.mts.map +0 -1
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { f as ROUTE_METADATA_KEYS } from "./errors-B4pYgYON.mjs";
|
|
2
|
+
import { p as Transient } from "./logger-V6Ms3QnQ.mjs";
|
|
3
|
+
//#region src/router/decorators/controller.decorator.ts
|
|
4
|
+
const CONTROLLER_ROUTE_KEY = ROUTE_METADATA_KEYS.CONTROLLER_ROUTE;
|
|
5
|
+
/**
|
|
6
|
+
* Base controller decorator for route registration
|
|
7
|
+
*
|
|
8
|
+
* This is the core controller decorator that handles:
|
|
9
|
+
* - Transient scope registration (request-scoped)
|
|
10
|
+
* - Route metadata storage
|
|
11
|
+
* - Controller options (tags, security schemes, hideFromDocs)
|
|
12
|
+
*
|
|
13
|
+
* @param route - Base route for this controller (e.g., '/api/v1/users')
|
|
14
|
+
* @param options - Optional configuration (tags, security schemes, hideFromDocs)
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* import { Controller } from 'stratal/router'
|
|
19
|
+
*
|
|
20
|
+
* @Controller('/api/v1/users', { tags: ['Users'] })
|
|
21
|
+
* export class UsersController implements IController {
|
|
22
|
+
* // All routes accessible
|
|
23
|
+
* }
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
function Controller(route, options) {
|
|
27
|
+
return function(target) {
|
|
28
|
+
Transient()(target);
|
|
29
|
+
Reflect.defineMetadata(CONTROLLER_ROUTE_KEY, route, target);
|
|
30
|
+
if (options) Reflect.defineMetadata(ROUTE_METADATA_KEYS.CONTROLLER_OPTIONS, options, target);
|
|
31
|
+
return target;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Get the route from controller class metadata
|
|
36
|
+
*
|
|
37
|
+
* @param target - Controller class or instance
|
|
38
|
+
* @returns Route string or undefined if not set
|
|
39
|
+
*/
|
|
40
|
+
function getControllerRoute(target) {
|
|
41
|
+
const metadataTarget = typeof target === "function" ? target : target.constructor;
|
|
42
|
+
return Reflect.getMetadata(CONTROLLER_ROUTE_KEY, metadataTarget);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Get the options from controller class metadata
|
|
46
|
+
*
|
|
47
|
+
* @param target - Controller class or instance
|
|
48
|
+
* @returns Controller options or undefined if not set
|
|
49
|
+
*/
|
|
50
|
+
function getControllerOptions(target) {
|
|
51
|
+
const metadataTarget = typeof target === "function" ? target : target.constructor;
|
|
52
|
+
return Reflect.getMetadata(ROUTE_METADATA_KEYS.CONTROLLER_OPTIONS, metadataTarget);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Get the version from controller class metadata
|
|
56
|
+
*
|
|
57
|
+
* @param target - Controller class or instance
|
|
58
|
+
* @returns Version string, array, VERSION_NEUTRAL symbol, or undefined if not set
|
|
59
|
+
*/
|
|
60
|
+
function getControllerVersion(target) {
|
|
61
|
+
return getControllerOptions(target)?.version;
|
|
62
|
+
}
|
|
63
|
+
//#endregion
|
|
64
|
+
export { getControllerVersion as i, getControllerOptions as n, getControllerRoute as r, Controller as t };
|
|
65
|
+
|
|
66
|
+
//# sourceMappingURL=controller.decorator-LZY9aHYG.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controller.decorator-LZY9aHYG.mjs","names":[],"sources":["../src/router/decorators/controller.decorator.ts"],"sourcesContent":["import { Transient } from '../../di/decorators'\nimport { type Constructor } from '../../types'\nimport { ROUTE_METADATA_KEYS } from '../constants'\nimport { type ControllerOptions } from '../types'\n\nconst CONTROLLER_ROUTE_KEY = ROUTE_METADATA_KEYS.CONTROLLER_ROUTE\n\n/**\n * Base controller decorator for route registration\n *\n * This is the core controller decorator that handles:\n * - Transient scope registration (request-scoped)\n * - Route metadata storage\n * - Controller options (tags, security schemes, hideFromDocs)\n *\n * @param route - Base route for this controller (e.g., '/api/v1/users')\n * @param options - Optional configuration (tags, security schemes, hideFromDocs)\n *\n * @example\n * ```typescript\n * import { Controller } from 'stratal/router'\n *\n * @Controller('/api/v1/users', { tags: ['Users'] })\n * export class UsersController implements IController {\n * // All routes accessible\n * }\n * ```\n */\nexport function Controller(route: string, options?: ControllerOptions) {\n return function <T extends Constructor>(target: T) {\n // Wrap @Transient (handles @injectable and scope metadata)\n Transient()(target)\n\n // Store route metadata on the class\n Reflect.defineMetadata(CONTROLLER_ROUTE_KEY, route, target)\n\n // Store options metadata if provided\n if (options) {\n Reflect.defineMetadata(ROUTE_METADATA_KEYS.CONTROLLER_OPTIONS, options, target)\n }\n\n return target\n }\n}\n\n/**\n * Get the route from controller class metadata\n *\n * @param target - Controller class or instance\n * @returns Route string or undefined if not set\n */\nexport function getControllerRoute(target: object): string | undefined {\n // Check if target is a class constructor (function) or an instance\n // If class, get metadata from it directly; if instance, get from constructor\n const metadataTarget = typeof target === 'function' ? target : (target as { constructor: object }).constructor\n return Reflect.getMetadata(CONTROLLER_ROUTE_KEY, metadataTarget) as string | undefined\n}\n\n/**\n * Get the options from controller class metadata\n *\n * @param target - Controller class or instance\n * @returns Controller options or undefined if not set\n */\nexport function getControllerOptions(target: object): ControllerOptions | undefined {\n const metadataTarget = typeof target === 'function' ? target : (target as { constructor: object }).constructor\n return Reflect.getMetadata(ROUTE_METADATA_KEYS.CONTROLLER_OPTIONS, metadataTarget) as ControllerOptions | undefined\n}\n\n/**\n * Get the version from controller class metadata\n *\n * @param target - Controller class or instance\n * @returns Version string, array, VERSION_NEUTRAL symbol, or undefined if not set\n */\nexport function getControllerVersion(target: object): ControllerOptions['version'] {\n const options = getControllerOptions(target)\n return options?.version\n}\n"],"mappings":";;;AAKA,MAAM,uBAAuB,oBAAoB;;;;;;;;;;;;;;;;;;;;;;AAuBjD,SAAgB,WAAW,OAAe,SAA6B;AACrE,QAAO,SAAiC,QAAW;AAEjD,aAAW,CAAC,OAAO;AAGnB,UAAQ,eAAe,sBAAsB,OAAO,OAAO;AAG3D,MAAI,QACF,SAAQ,eAAe,oBAAoB,oBAAoB,SAAS,OAAO;AAGjF,SAAO;;;;;;;;;AAUX,SAAgB,mBAAmB,QAAoC;CAGrE,MAAM,iBAAiB,OAAO,WAAW,aAAa,SAAU,OAAmC;AACnG,QAAO,QAAQ,YAAY,sBAAsB,eAAe;;;;;;;;AASlE,SAAgB,qBAAqB,QAA+C;CAClF,MAAM,iBAAiB,OAAO,WAAW,aAAa,SAAU,OAAmC;AACnG,QAAO,QAAQ,YAAY,oBAAoB,oBAAoB,eAAe;;;;;;;;AASpF,SAAgB,qBAAqB,QAA8C;AAEjF,QADgB,qBAAqB,OACvB,EAAE"}
|
package/dist/cron/index.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as CronJob, t as CronManager } from "../cron-manager-
|
|
1
|
+
import { d as ApplicationError } from "../index-DPFqRs8L.mjs";
|
|
2
|
+
import { n as CronJob, r as RegisteredJob, t as CronManager } from "../cron-manager-RuPtFVLy.mjs";
|
|
3
|
+
import { ScheduledController } from "@cloudflare/workers-types";
|
|
3
4
|
|
|
4
5
|
//#region src/cron/errors/cron-execution.error.d.ts
|
|
5
6
|
/**
|
|
@@ -11,5 +12,5 @@ declare class CronExecutionError extends ApplicationError {
|
|
|
11
12
|
constructor(schedule: string, failedJobsCount: number, jobNames: string);
|
|
12
13
|
}
|
|
13
14
|
//#endregion
|
|
14
|
-
export { CronExecutionError, type CronJob, CronManager };
|
|
15
|
+
export { CronExecutionError, type CronJob, CronManager, type RegisteredJob, type ScheduledController };
|
|
15
16
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/cron/errors/cron-execution.error.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/cron/errors/cron-execution.error.ts"],"mappings":";;;;;;;;;AAQA;cAAa,kBAAA,SAA2B,gBAAA;cAEtC,QAAA,UACA,eAAA,UACA,QAAA;AAAA"}
|
package/dist/cron/index.mjs
CHANGED
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
import "../
|
|
2
|
-
import "../logger-CGT91VY6.mjs";
|
|
3
|
-
import { n as CronExecutionError, t as CronManager } from "../cron-manager-CFBamKKk.mjs";
|
|
1
|
+
import { n as CronExecutionError, t as CronManager } from "../cron-manager-C30t9UZM.mjs";
|
|
4
2
|
export { CronExecutionError, CronManager };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as __decorate,
|
|
1
|
+
import { H as ApplicationError, k as ERROR_CODES } from "./errors-B4pYgYON.mjs";
|
|
2
|
+
import { a as __decorate, p as Transient } from "./logger-V6Ms3QnQ.mjs";
|
|
3
3
|
//#region src/cron/errors/cron-execution.error.ts
|
|
4
4
|
/**
|
|
5
5
|
* Error thrown when one or more cron jobs fail execution
|
|
@@ -19,51 +19,61 @@ var CronExecutionError = class extends ApplicationError {
|
|
|
19
19
|
//#region src/cron/cron-manager.ts
|
|
20
20
|
let CronManager = class CronManager {
|
|
21
21
|
/**
|
|
22
|
-
* Map of cron expressions to
|
|
22
|
+
* Map of cron expressions to registered job entries
|
|
23
23
|
* Key: Cron expression (e.g., '0 2 * * *')
|
|
24
|
-
* Value: Array of jobs
|
|
24
|
+
* Value: Array of registered jobs (class ref + schedule)
|
|
25
25
|
*/
|
|
26
26
|
jobs = /* @__PURE__ */ new Map();
|
|
27
27
|
/**
|
|
28
|
-
* Register a cron job
|
|
28
|
+
* Register a cron job class
|
|
29
29
|
*
|
|
30
30
|
* Jobs with the same schedule are grouped together and executed
|
|
31
31
|
* sequentially when the trigger fires.
|
|
32
32
|
*
|
|
33
|
-
* @param
|
|
33
|
+
* @param schedule - Cron expression (e.g., '0 2 * * *')
|
|
34
|
+
* @param jobClass - CronJob class constructor (resolved at execution time)
|
|
34
35
|
*/
|
|
35
|
-
registerJob(
|
|
36
|
-
const existing = this.jobs.get(
|
|
37
|
-
existing.push(
|
|
38
|
-
|
|
36
|
+
registerJob(schedule, jobClass) {
|
|
37
|
+
const existing = this.jobs.get(schedule) ?? [];
|
|
38
|
+
existing.push({
|
|
39
|
+
schedule,
|
|
40
|
+
jobClass
|
|
41
|
+
});
|
|
42
|
+
this.jobs.set(schedule, existing);
|
|
39
43
|
}
|
|
40
44
|
/**
|
|
41
45
|
* Execute all jobs matching the triggered cron expression
|
|
42
46
|
*
|
|
47
|
+
* Jobs are resolved from the provided request-scoped container,
|
|
48
|
+
* ensuring dependencies (e.g. database) are properly scoped.
|
|
49
|
+
*
|
|
43
50
|
* Jobs are executed sequentially. If a job fails:
|
|
44
51
|
* - Its onError() hook is called (if defined)
|
|
45
52
|
* - Execution continues with the next job
|
|
46
|
-
* - Errors are collected and
|
|
53
|
+
* - Errors are collected and thrown as CronExecutionError
|
|
47
54
|
*
|
|
48
55
|
* @param controller - Cloudflare ScheduledController
|
|
56
|
+
* @param container - Request-scoped container to resolve jobs from
|
|
49
57
|
*/
|
|
50
|
-
async executeScheduled(controller) {
|
|
58
|
+
async executeScheduled(controller, container) {
|
|
51
59
|
const { cron } = controller;
|
|
52
60
|
const matchingJobs = this.jobs.get(cron) ?? [];
|
|
53
61
|
if (matchingJobs.length === 0) return;
|
|
54
62
|
const errors = [];
|
|
55
|
-
for (const
|
|
56
|
-
const jobName =
|
|
63
|
+
for (const { jobClass } of matchingJobs) {
|
|
64
|
+
const jobName = jobClass.name;
|
|
57
65
|
try {
|
|
58
|
-
|
|
66
|
+
container.register(jobClass, jobClass);
|
|
67
|
+
await container.resolve(jobClass).execute(controller);
|
|
59
68
|
} catch (error) {
|
|
60
69
|
const err = error;
|
|
61
70
|
errors.push({
|
|
62
71
|
job: jobName,
|
|
63
72
|
error: err
|
|
64
73
|
});
|
|
65
|
-
|
|
66
|
-
|
|
74
|
+
try {
|
|
75
|
+
const job = container.resolve(jobClass);
|
|
76
|
+
if (job.onError) await job.onError(err, controller);
|
|
67
77
|
} catch {}
|
|
68
78
|
}
|
|
69
79
|
}
|
|
@@ -76,7 +86,7 @@ let CronManager = class CronManager {
|
|
|
76
86
|
* Get all registered jobs for a specific cron expression
|
|
77
87
|
*
|
|
78
88
|
* @param schedule - Cron expression
|
|
79
|
-
* @returns Array of jobs
|
|
89
|
+
* @returns Array of registered jobs, or empty array if none
|
|
80
90
|
*/
|
|
81
91
|
getJobsForSchedule(schedule) {
|
|
82
92
|
return this.jobs.get(schedule) ?? [];
|
|
@@ -104,4 +114,4 @@ CronManager = __decorate([Transient()], CronManager);
|
|
|
104
114
|
//#endregion
|
|
105
115
|
export { CronExecutionError as n, CronManager as t };
|
|
106
116
|
|
|
107
|
-
//# sourceMappingURL=cron-manager-
|
|
117
|
+
//# sourceMappingURL=cron-manager-C30t9UZM.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cron-manager-C30t9UZM.mjs","names":[],"sources":["../src/cron/errors/cron-execution.error.ts","../src/cron/cron-manager.ts"],"sourcesContent":["import { ApplicationError } from '../../errors'\nimport { ERROR_CODES } from '../../errors'\n\n/**\n * Error thrown when one or more cron jobs fail execution\n *\n * This error aggregates failures from multiple jobs that share the same schedule.\n */\nexport class CronExecutionError extends ApplicationError {\n\tconstructor(\n\t\tschedule: string,\n\t\tfailedJobsCount: number,\n\t\tjobNames: string\n\t) {\n\t\tsuper(\n\t\t\t'errors.cronExecutionFailed',\n\t\t\tERROR_CODES.SYSTEM.CRON_EXECUTION_FAILED,\n\t\t\t{\n\t\t\t\tschedule,\n\t\t\t\tcount: failedJobsCount,\n\t\t\t\tjobs: jobNames\n\t\t\t}\n\t\t)\n\t}\n}\n","import type { Container } from '../di/container'\nimport { Transient } from '../di/decorators'\nimport type { CronJob, RegisteredJob } from './cron-job'\nimport { CronExecutionError } from './errors/cron-execution.error'\n\n/**\n * Manages cron job registration and execution\n *\n * CronManager is a singleton service that:\n * - Registers cron job class references from modules\n * - Routes scheduled events to matching jobs\n * - Resolves jobs from a request-scoped container at execution time\n *\n * Jobs are grouped by their cron expression, allowing multiple jobs\n * to run on the same schedule.\n */\n@Transient()\nexport class CronManager {\n\t/**\n\t * Map of cron expressions to registered job entries\n\t * Key: Cron expression (e.g., '0 2 * * *')\n\t * Value: Array of registered jobs (class ref + schedule)\n\t */\n\tprivate jobs = new Map<string, RegisteredJob[]>()\n\n\t/**\n\t * Register a cron job class\n\t *\n\t * Jobs with the same schedule are grouped together and executed\n\t * sequentially when the trigger fires.\n\t *\n\t * @param schedule - Cron expression (e.g., '0 2 * * *')\n\t * @param jobClass - CronJob class constructor (resolved at execution time)\n\t */\n\tregisterJob(schedule: string, jobClass: RegisteredJob['jobClass']): void {\n\t\tconst existing = this.jobs.get(schedule) ?? []\n\t\texisting.push({ schedule, jobClass })\n\t\tthis.jobs.set(schedule, existing)\n\t}\n\n\t/**\n\t * Execute all jobs matching the triggered cron expression\n\t *\n\t * Jobs are resolved from the provided request-scoped container,\n\t * ensuring dependencies (e.g. database) are properly scoped.\n\t *\n\t * Jobs are executed sequentially. If a job fails:\n\t * - Its onError() hook is called (if defined)\n\t * - Execution continues with the next job\n\t * - Errors are collected and thrown as CronExecutionError\n\t *\n\t * @param controller - Cloudflare ScheduledController\n\t * @param container - Request-scoped container to resolve jobs from\n\t */\n\tasync executeScheduled(controller: ScheduledController, container: Container): Promise<void> {\n\t\tconst { cron } = controller\n\t\tconst matchingJobs = this.jobs.get(cron) ?? []\n\n\t\tif (matchingJobs.length === 0) {\n\t\t\treturn\n\t\t}\n\n\t\tconst errors: { job: string; error: Error }[] = []\n\n\t\tfor (const { jobClass } of matchingJobs) {\n\t\t\tconst jobName = jobClass.name\n\n\t\t\ttry {\n\t\t\t\t// Register the job class in the request-scoped container so its\n\t\t\t\t// dependencies are resolved from request scope (not the parent).\n\t\t\t\t// Without this, tsyringe falls through to the parent container\n\t\t\t\t// and request-scoped services (e.g. database) get stale instances.\n\t\t\t\tcontainer.register(jobClass, jobClass)\n\t\t\t\tconst job = container.resolve<CronJob>(jobClass)\n\t\t\t\tawait job.execute(controller)\n\t\t\t} catch (error) {\n\t\t\t\tconst err = error as Error\n\t\t\t\terrors.push({ job: jobName, error: err })\n\n\t\t\t\t// Try to resolve and call onError if possible\n\t\t\t\ttry {\n\t\t\t\t\tconst job = container.resolve<CronJob>(jobClass)\n\t\t\t\t\tif (job.onError) {\n\t\t\t\t\t\tawait job.onError(err, controller)\n\t\t\t\t\t}\n\t\t\t\t} catch {\n\t\t\t\t\t// If resolution or onError fails, continue\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// If any jobs failed, throw an aggregate error\n\t\t// This ensures the error is logged by ExceptionHandler\n\t\tif (errors.length > 0) {\n\t\t\tconst jobNames = errors\n\t\t\t\t.map(({ job, error }) => `${job}: ${error.message}`)\n\t\t\t\t.join('; ')\n\n\t\t\tthrow new CronExecutionError(cron, errors.length, jobNames)\n\t\t}\n\t}\n\n\t/**\n\t * Get all registered jobs for a specific cron expression\n\t *\n\t * @param schedule - Cron expression\n\t * @returns Array of registered jobs, or empty array if none\n\t */\n\tgetJobsForSchedule(schedule: string): RegisteredJob[] {\n\t\treturn this.jobs.get(schedule) ?? []\n\t}\n\n\t/**\n\t * Get all registered cron expressions\n\t *\n\t * @returns Array of unique cron expressions\n\t */\n\tgetAllSchedules(): string[] {\n\t\treturn Array.from(this.jobs.keys())\n\t}\n\n\t/**\n\t * Get total number of registered jobs across all schedules\n\t *\n\t * @returns Total job count\n\t */\n\tgetTotalJobCount(): number {\n\t\tlet count = 0\n\t\tfor (const jobs of this.jobs.values()) {\n\t\t\tcount += jobs.length\n\t\t}\n\t\treturn count\n\t}\n}\n"],"mappings":";;;;;;;;AAQA,IAAa,qBAAb,cAAwC,iBAAiB;CACxD,YACC,UACA,iBACA,UACC;AACD,QACC,8BACA,YAAY,OAAO,uBACnB;GACC;GACA,OAAO;GACP,MAAM;GACN,CACD;;;;;ACLI,IAAA,cAAA,MAAM,YAAY;;;;;;CAMxB,uBAAe,IAAI,KAA8B;;;;;;;;;;CAWjD,YAAY,UAAkB,UAA2C;EACxE,MAAM,WAAW,KAAK,KAAK,IAAI,SAAS,IAAI,EAAE;AAC9C,WAAS,KAAK;GAAE;GAAU;GAAU,CAAC;AACrC,OAAK,KAAK,IAAI,UAAU,SAAS;;;;;;;;;;;;;;;;CAiBlC,MAAM,iBAAiB,YAAiC,WAAqC;EAC5F,MAAM,EAAE,SAAS;EACjB,MAAM,eAAe,KAAK,KAAK,IAAI,KAAK,IAAI,EAAE;AAE9C,MAAI,aAAa,WAAW,EAC3B;EAGD,MAAM,SAA0C,EAAE;AAElD,OAAK,MAAM,EAAE,cAAc,cAAc;GACxC,MAAM,UAAU,SAAS;AAEzB,OAAI;AAKH,cAAU,SAAS,UAAU,SAAS;AAEtC,UADY,UAAU,QAAiB,SAC9B,CAAC,QAAQ,WAAW;YACrB,OAAO;IACf,MAAM,MAAM;AACZ,WAAO,KAAK;KAAE,KAAK;KAAS,OAAO;KAAK,CAAC;AAGzC,QAAI;KACH,MAAM,MAAM,UAAU,QAAiB,SAAS;AAChD,SAAI,IAAI,QACP,OAAM,IAAI,QAAQ,KAAK,WAAW;YAE5B;;;AAQV,MAAI,OAAO,SAAS,GAAG;GACtB,MAAM,WAAW,OACf,KAAK,EAAE,KAAK,YAAY,GAAG,IAAI,IAAI,MAAM,UAAU,CACnD,KAAK,KAAK;AAEZ,SAAM,IAAI,mBAAmB,MAAM,OAAO,QAAQ,SAAS;;;;;;;;;CAU7D,mBAAmB,UAAmC;AACrD,SAAO,KAAK,KAAK,IAAI,SAAS,IAAI,EAAE;;;;;;;CAQrC,kBAA4B;AAC3B,SAAO,MAAM,KAAK,KAAK,KAAK,MAAM,CAAC;;;;;;;CAQpC,mBAA2B;EAC1B,IAAI,QAAQ;AACZ,OAAK,MAAM,QAAQ,KAAK,KAAK,QAAQ,CACpC,UAAS,KAAK;AAEf,SAAO;;;0BAnHR,WAAW,CAAA,EAAA,YAAA"}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { Cr as Container } from "./index-DPFqRs8L.mjs";
|
|
2
|
+
import { t as Constructor } from "./types-DIWemRad.mjs";
|
|
3
|
+
|
|
1
4
|
//#region src/cron/cron-job.d.ts
|
|
2
5
|
/**
|
|
3
6
|
* Interface for cron jobs that can be registered by modules
|
|
@@ -26,6 +29,12 @@
|
|
|
26
29
|
* }
|
|
27
30
|
* ```
|
|
28
31
|
*/
|
|
32
|
+
interface RegisteredJob {
|
|
33
|
+
/** The cron schedule expression */
|
|
34
|
+
schedule: string;
|
|
35
|
+
/** The job class constructor (resolved from container at execution time) */
|
|
36
|
+
jobClass: Constructor<CronJob>;
|
|
37
|
+
}
|
|
29
38
|
interface CronJob {
|
|
30
39
|
/**
|
|
31
40
|
* Cron expression that triggers this job
|
|
@@ -45,7 +54,7 @@ interface CronJob {
|
|
|
45
54
|
/**
|
|
46
55
|
* Optional error handler for job execution failures
|
|
47
56
|
*
|
|
48
|
-
* If not provided, errors are logged via
|
|
57
|
+
* If not provided, errors are logged via ExceptionHandler
|
|
49
58
|
*
|
|
50
59
|
* @param error - Error that occurred during execution
|
|
51
60
|
* @param controller - Cloudflare ScheduledController
|
|
@@ -58,47 +67,52 @@ interface CronJob {
|
|
|
58
67
|
* Manages cron job registration and execution
|
|
59
68
|
*
|
|
60
69
|
* CronManager is a singleton service that:
|
|
61
|
-
* - Registers cron
|
|
70
|
+
* - Registers cron job class references from modules
|
|
62
71
|
* - Routes scheduled events to matching jobs
|
|
63
|
-
* -
|
|
72
|
+
* - Resolves jobs from a request-scoped container at execution time
|
|
64
73
|
*
|
|
65
74
|
* Jobs are grouped by their cron expression, allowing multiple jobs
|
|
66
75
|
* to run on the same schedule.
|
|
67
76
|
*/
|
|
68
77
|
declare class CronManager {
|
|
69
78
|
/**
|
|
70
|
-
* Map of cron expressions to
|
|
79
|
+
* Map of cron expressions to registered job entries
|
|
71
80
|
* Key: Cron expression (e.g., '0 2 * * *')
|
|
72
|
-
* Value: Array of jobs
|
|
81
|
+
* Value: Array of registered jobs (class ref + schedule)
|
|
73
82
|
*/
|
|
74
83
|
private jobs;
|
|
75
84
|
/**
|
|
76
|
-
* Register a cron job
|
|
85
|
+
* Register a cron job class
|
|
77
86
|
*
|
|
78
87
|
* Jobs with the same schedule are grouped together and executed
|
|
79
88
|
* sequentially when the trigger fires.
|
|
80
89
|
*
|
|
81
|
-
* @param
|
|
90
|
+
* @param schedule - Cron expression (e.g., '0 2 * * *')
|
|
91
|
+
* @param jobClass - CronJob class constructor (resolved at execution time)
|
|
82
92
|
*/
|
|
83
|
-
registerJob(
|
|
93
|
+
registerJob(schedule: string, jobClass: RegisteredJob['jobClass']): void;
|
|
84
94
|
/**
|
|
85
95
|
* Execute all jobs matching the triggered cron expression
|
|
86
96
|
*
|
|
97
|
+
* Jobs are resolved from the provided request-scoped container,
|
|
98
|
+
* ensuring dependencies (e.g. database) are properly scoped.
|
|
99
|
+
*
|
|
87
100
|
* Jobs are executed sequentially. If a job fails:
|
|
88
101
|
* - Its onError() hook is called (if defined)
|
|
89
102
|
* - Execution continues with the next job
|
|
90
|
-
* - Errors are collected and
|
|
103
|
+
* - Errors are collected and thrown as CronExecutionError
|
|
91
104
|
*
|
|
92
105
|
* @param controller - Cloudflare ScheduledController
|
|
106
|
+
* @param container - Request-scoped container to resolve jobs from
|
|
93
107
|
*/
|
|
94
|
-
executeScheduled(controller: ScheduledController): Promise<void>;
|
|
108
|
+
executeScheduled(controller: ScheduledController, container: Container): Promise<void>;
|
|
95
109
|
/**
|
|
96
110
|
* Get all registered jobs for a specific cron expression
|
|
97
111
|
*
|
|
98
112
|
* @param schedule - Cron expression
|
|
99
|
-
* @returns Array of jobs
|
|
113
|
+
* @returns Array of registered jobs, or empty array if none
|
|
100
114
|
*/
|
|
101
|
-
getJobsForSchedule(schedule: string):
|
|
115
|
+
getJobsForSchedule(schedule: string): RegisteredJob[];
|
|
102
116
|
/**
|
|
103
117
|
* Get all registered cron expressions
|
|
104
118
|
*
|
|
@@ -113,5 +127,5 @@ declare class CronManager {
|
|
|
113
127
|
getTotalJobCount(): number;
|
|
114
128
|
}
|
|
115
129
|
//#endregion
|
|
116
|
-
export { CronJob as n, CronManager as t };
|
|
117
|
-
//# sourceMappingURL=cron-manager-
|
|
130
|
+
export { CronJob as n, RegisteredJob as r, CronManager as t };
|
|
131
|
+
//# sourceMappingURL=cron-manager-RuPtFVLy.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cron-manager-RuPtFVLy.d.mts","names":[],"sources":["../src/cron/cron-job.ts","../src/cron/cron-manager.ts"],"mappings":";;;;;;;AA6BA;;;;;;;;;;AAOA;;;;;;;;;;;;;;UAPiB,aAAA;EAiChB;EA/BA,QAAA;EA+BS;EA7BT,QAAA,EAAU,WAAA,CAAY,OAAA;AAAA;AAAA,UAGN,OAAA;EA0BgD;;;;;AC9CjE;;ED8CiE,SAlBvD,QAAA;ECV+B;;;;;;EDkBxC,OAAA,CAAQ,UAAA,EAAY,mBAAA,GAAsB,OAAA;EC7BlC;;;;;;;;EDuCR,OAAA,EAAS,KAAA,EAAO,KAAA,EAAO,UAAA,EAAY,mBAAA,GAAsB,OAAA;AAAA;;;;;AAjC1D;;;;;;;;;cCZa,WAAA;EDmBI;;;;;EAAA,QCbR,IAAA;EDuC2B;;;;;;;;;EC5BnC,WAAA,CAAY,QAAA,UAAkB,QAAA,EAAU,aAAA;ED4BxB;;;;;;;;;;AC9CjB;;;;EAsCO,gBAAA,CAAiB,UAAA,EAAY,mBAAA,EAAqB,SAAA,EAAW,SAAA,GAAY,OAAA;EAAZ;;;;;;EAsDnE,kBAAA,CAAmB,QAAA,WAAmB,aAAA;EA1E1B;;;;;EAmFZ,eAAA,CAAA;EA/DmE;;;;;EAwEnE,gBAAA,CAAA;AAAA"}
|
package/dist/di/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { CONTAINER_TOKEN, ConditionalBindingBuilder, ConditionalBindingBuilderImpl, ConditionalBindingFallbackError, ConditionalBindingGive, ConditionalBindingUse, Container, ContainerLike, ContainerOptions, DIToken, DI_TOKENS, DependencyContainer, ExtensionDecorator, INJECT_PARAM_METADATA_KEY, InjectParam, ParamInjection, PredicateContainer, RequestScopeOperationNotAllowedError, Scope, Transient, WhenOptions, container, delay, getMethodInjections, inject, injectable, instancePerContainerCachingFactory, singleton };
|
|
1
|
+
import { Ar as instancePerContainerCachingFactory, Br as WhenOptions, Cr as Container, Dr as delay, Er as container, Fr as ConditionalBindingUse, Ir as PredicateContainer, Lr as ContainerLike, Mr as ConditionalBindingBuilder, Nr as ConditionalBindingBuilderImpl, Or as inject, Pr as ConditionalBindingGive, Rr as ExtensionDecorator, Tr as DependencyContainer, _r as DI_TOKENS, ar as containerStorage, cr as RequestScopeOperationNotAllowedError, dr as INJECT_PARAM_METADATA_KEY, fr as InjectParam, gr as DIToken, hr as CONTAINER_TOKEN, jr as singleton, kr as injectable, lr as ConditionalBindingFallbackError, mr as getMethodInjections, or as getContainer, pr as ParamInjection, sr as runWithContainer, ur as Transient, wr as ContainerOptions, zr as Scope } from "../index-DPFqRs8L.mjs";
|
|
2
|
+
export { CONTAINER_TOKEN, ConditionalBindingBuilder, ConditionalBindingBuilderImpl, ConditionalBindingFallbackError, ConditionalBindingGive, ConditionalBindingUse, Container, ContainerLike, ContainerOptions, DIToken, DI_TOKENS, DependencyContainer, ExtensionDecorator, INJECT_PARAM_METADATA_KEY, InjectParam, ParamInjection, PredicateContainer, RequestScopeOperationNotAllowedError, Scope, Transient, WhenOptions, container, containerStorage, delay, getContainer, getMethodInjections, inject, injectable, instancePerContainerCachingFactory, runWithContainer, singleton };
|
package/dist/di/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { d as
|
|
3
|
-
export { CONTAINER_TOKEN, ConditionalBindingBuilderImpl, ConditionalBindingFallbackError, Container, DI_TOKENS, INJECT_PARAM_METADATA_KEY, InjectParam, RequestScopeOperationNotAllowedError, Scope, Transient, container, delay, getMethodInjections, inject, injectable, instancePerContainerCachingFactory, singleton };
|
|
1
|
+
import { A as Scope, B as ConditionalBindingFallbackError, D as runWithContainer, E as getContainer, F as injectable, I as instancePerContainerCachingFactory, L as singleton, M as container, N as delay, P as inject, R as ConditionalBindingBuilderImpl, T as containerStorage, j as Container, z as RequestScopeOperationNotAllowedError } from "../errors-B4pYgYON.mjs";
|
|
2
|
+
import { d as CONTAINER_TOKEN, f as DI_TOKENS, g as getMethodInjections, h as InjectParam, m as INJECT_PARAM_METADATA_KEY, p as Transient } from "../logger-V6Ms3QnQ.mjs";
|
|
3
|
+
export { CONTAINER_TOKEN, ConditionalBindingBuilderImpl, ConditionalBindingFallbackError, Container, DI_TOKENS, INJECT_PARAM_METADATA_KEY, InjectParam, RequestScopeOperationNotAllowedError, Scope, Transient, container, containerStorage, delay, getContainer, getMethodInjections, inject, injectable, instancePerContainerCachingFactory, runWithContainer, singleton };
|
package/dist/email/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { o as z } from "../index-
|
|
3
|
-
import { g as QueueName, h as IQueueSender } from "../index-
|
|
1
|
+
import { d as ApplicationError, hn as DynamicModule, pn as AsyncModuleOptions } from "../index-DPFqRs8L.mjs";
|
|
2
|
+
import { o as z } from "../index-B437eK7p.mjs";
|
|
3
|
+
import { g as QueueName, h as IQueueSender } from "../index-Dnqm9ZB6.mjs";
|
|
4
4
|
import { ReactElement } from "react";
|
|
5
5
|
|
|
6
6
|
//#region src/email/email.module.d.ts
|
package/dist/email/index.mjs
CHANGED
|
@@ -1,18 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as __decorate,
|
|
3
|
-
import {
|
|
4
|
-
import "../
|
|
5
|
-
import "../
|
|
6
|
-
import "../router-context-D9R1v2Ac.mjs";
|
|
7
|
-
import "../colors-Y7WIFXs7.mjs";
|
|
8
|
-
import "../command-B1CPgsrU.mjs";
|
|
9
|
-
import "../is-command-DJVI6wEJ.mjs";
|
|
10
|
-
import "../is-seeder-D5MIEcdz.mjs";
|
|
11
|
-
import { a as withI18n, i as z } from "../validation-DQTC259A.mjs";
|
|
12
|
-
import { c as QUEUE_TOKENS } from "../queue.module-BtI8f4Jo.mjs";
|
|
1
|
+
import { H as ApplicationError, k as ERROR_CODES } from "../errors-B4pYgYON.mjs";
|
|
2
|
+
import { a as __decorate, o as __decorateParam, p as Transient, s as __decorateMetadata, u as LOGGER_TOKENS } from "../logger-V6Ms3QnQ.mjs";
|
|
3
|
+
import { C as Module } from "../module-qGE_1duv.mjs";
|
|
4
|
+
import { a as withI18n, i as z } from "../validation-Dbg3ehdP.mjs";
|
|
5
|
+
import { c as QUEUE_TOKENS } from "../queue.module-P-G-nCYz.mjs";
|
|
13
6
|
import "../queue/index.mjs";
|
|
14
|
-
import "../
|
|
15
|
-
import { l as STORAGE_TOKENS } from "../storage-CZKHOhci.mjs";
|
|
7
|
+
import { u as STORAGE_TOKENS } from "../storage-P6X4h9So.mjs";
|
|
16
8
|
import { inject } from "tsyringe";
|
|
17
9
|
import { render } from "@react-email/render";
|
|
18
10
|
//#region src/email/email.tokens.ts
|
|
@@ -26,10 +18,26 @@ import { render } from "@react-email/render";
|
|
|
26
18
|
* Email Module DI Tokens
|
|
27
19
|
*/
|
|
28
20
|
const EMAIL_TOKENS = {
|
|
21
|
+
/**
|
|
22
|
+
* Email module configuration options
|
|
23
|
+
*/
|
|
29
24
|
Options: Symbol.for("stratal:email:options"),
|
|
25
|
+
/**
|
|
26
|
+
* Main email service - facade for sending emails via queues
|
|
27
|
+
*/
|
|
30
28
|
EmailService: Symbol.for("stratal:email:service"),
|
|
29
|
+
/**
|
|
30
|
+
* Factory for creating email provider instances based on configuration
|
|
31
|
+
*/
|
|
31
32
|
EmailProviderFactory: Symbol.for("stratal:email:provider:factory"),
|
|
33
|
+
/**
|
|
34
|
+
* Email provider interface - abstracts provider implementation
|
|
35
|
+
*/
|
|
32
36
|
EmailProvider: Symbol.for("stratal:email:provider"),
|
|
37
|
+
/**
|
|
38
|
+
* Queue sender for email dispatch.
|
|
39
|
+
* Bound via EmailModule.forRoot({ queue: 'queue-name' })
|
|
40
|
+
*/
|
|
33
41
|
EmailQueue: Symbol.for("stratal:email:queue")
|
|
34
42
|
};
|
|
35
43
|
//#endregion
|
|
@@ -263,11 +271,11 @@ let EmailProviderFactory = class EmailProviderFactory {
|
|
|
263
271
|
async create() {
|
|
264
272
|
switch (this.options.provider) {
|
|
265
273
|
case "resend": {
|
|
266
|
-
const { ResendProvider } = await import("../resend.provider-
|
|
274
|
+
const { ResendProvider } = await import("../resend.provider-bwILp0WI.mjs");
|
|
267
275
|
return new ResendProvider(this.options);
|
|
268
276
|
}
|
|
269
277
|
case "smtp": {
|
|
270
|
-
const { SmtpProvider } = await import("../smtp.provider-
|
|
278
|
+
const { SmtpProvider } = await import("../smtp.provider-B07yuARi.mjs");
|
|
271
279
|
return new SmtpProvider(this.options);
|
|
272
280
|
}
|
|
273
281
|
default: throw new EmailProviderNotSupportedError(this.options.provider);
|
|
@@ -406,9 +414,21 @@ EmailModule = _EmailModule = __decorate([Module({
|
|
|
406
414
|
* Use for small files that can fit in queue message.
|
|
407
415
|
*/
|
|
408
416
|
const inlineEmailAttachmentSchema = z.object({
|
|
417
|
+
/**
|
|
418
|
+
* Filename to display for the attachment
|
|
419
|
+
*/
|
|
409
420
|
filename: z.string().min(1).max(255),
|
|
421
|
+
/**
|
|
422
|
+
* Base64 encoded content of the attachment
|
|
423
|
+
*/
|
|
410
424
|
content: z.string(),
|
|
425
|
+
/**
|
|
426
|
+
* MIME type of the attachment (e.g., 'application/pdf', 'image/png')
|
|
427
|
+
*/
|
|
411
428
|
contentType: z.string(),
|
|
429
|
+
/**
|
|
430
|
+
* Optional size of the attachment in bytes
|
|
431
|
+
*/
|
|
412
432
|
size: z.number().positive().optional()
|
|
413
433
|
});
|
|
414
434
|
/**
|
|
@@ -419,8 +439,17 @@ const inlineEmailAttachmentSchema = z.object({
|
|
|
419
439
|
* Use for large files to avoid queue message size limits.
|
|
420
440
|
*/
|
|
421
441
|
const storageEmailAttachmentSchema = z.object({
|
|
442
|
+
/**
|
|
443
|
+
* Filename to display for the attachment
|
|
444
|
+
*/
|
|
422
445
|
filename: z.string().min(1).max(255),
|
|
446
|
+
/**
|
|
447
|
+
* Path to the file in storage
|
|
448
|
+
*/
|
|
423
449
|
storageKey: z.string(),
|
|
450
|
+
/**
|
|
451
|
+
* Optional storage disk name (uses default if not provided)
|
|
452
|
+
*/
|
|
424
453
|
disk: z.string().optional()
|
|
425
454
|
});
|
|
426
455
|
/**
|
|
@@ -449,14 +478,45 @@ const emailAddressSchema = z.object({
|
|
|
449
478
|
* Ensures either html or text content is provided.
|
|
450
479
|
*/
|
|
451
480
|
const emailMessageSchema = z.object({
|
|
481
|
+
/**
|
|
482
|
+
* Recipient email address(es)
|
|
483
|
+
* Can be a single email string or array of emails
|
|
484
|
+
*/
|
|
452
485
|
to: z.union([z.string().email(), z.array(z.string().email())]),
|
|
486
|
+
/**
|
|
487
|
+
* Sender email address with optional name
|
|
488
|
+
* Falls back to default from config if not provided
|
|
489
|
+
*/
|
|
453
490
|
from: emailAddressSchema.optional(),
|
|
491
|
+
/**
|
|
492
|
+
* Email subject line
|
|
493
|
+
*/
|
|
454
494
|
subject: z.string().min(1).max(500),
|
|
495
|
+
/**
|
|
496
|
+
* HTML content of the email
|
|
497
|
+
* Either html or text must be provided
|
|
498
|
+
*/
|
|
455
499
|
html: z.string().optional(),
|
|
500
|
+
/**
|
|
501
|
+
* Plain text content of the email
|
|
502
|
+
* Either html or text must be provided
|
|
503
|
+
*/
|
|
456
504
|
text: z.string().optional(),
|
|
505
|
+
/**
|
|
506
|
+
* Reply-to email address
|
|
507
|
+
*/
|
|
457
508
|
replyTo: z.string().email().optional(),
|
|
509
|
+
/**
|
|
510
|
+
* CC recipients
|
|
511
|
+
*/
|
|
458
512
|
cc: z.array(z.string().email()).optional(),
|
|
513
|
+
/**
|
|
514
|
+
* BCC recipients
|
|
515
|
+
*/
|
|
459
516
|
bcc: z.array(z.string().email()).optional(),
|
|
517
|
+
/**
|
|
518
|
+
* Email attachments
|
|
519
|
+
*/
|
|
460
520
|
attachments: z.array(emailAttachmentSchema).optional()
|
|
461
521
|
}).refine((data) => data.html ?? data.text, withI18n("zodI18n.errors.custom.emailOrTextRequired"));
|
|
462
522
|
//#endregion
|
|
@@ -468,13 +528,22 @@ const emailMessageSchema = z.object({
|
|
|
468
528
|
* Extends the base email message with optional metadata.
|
|
469
529
|
* Uses safeExtend() because emailMessageSchema contains refinements.
|
|
470
530
|
*/
|
|
471
|
-
const sendEmailInputSchema = emailMessageSchema.safeExtend({
|
|
531
|
+
const sendEmailInputSchema = emailMessageSchema.safeExtend({
|
|
532
|
+
/**
|
|
533
|
+
* Optional metadata to include with the email
|
|
534
|
+
* Can be used for tracking, categorization, etc.
|
|
535
|
+
*/
|
|
536
|
+
metadata: z.record(z.string(), z.unknown()).optional() });
|
|
472
537
|
/**
|
|
473
538
|
* Send Batch Email Input Schema
|
|
474
539
|
*
|
|
475
540
|
* Schema for sending multiple emails in a batch
|
|
476
541
|
*/
|
|
477
|
-
const sendBatchEmailInputSchema = z.object({
|
|
542
|
+
const sendBatchEmailInputSchema = z.object({
|
|
543
|
+
/**
|
|
544
|
+
* Array of email messages to send
|
|
545
|
+
*/
|
|
546
|
+
messages: z.array(sendEmailInputSchema).min(1).max(100) });
|
|
478
547
|
//#endregion
|
|
479
548
|
export { EMAIL_TOKENS, EmailModule, EmailProviderFactory, EmailProviderNotSupportedError, EmailResendApiFailedError, EmailService, EmailSmtpConnectionFailedError, ResendApiKeyMissingError, SmtpConfigurationMissingError, SmtpHostMissingError, emailAddressSchema, emailAttachmentSchema, emailMessageSchema, inlineEmailAttachmentSchema, sendBatchEmailInputSchema, sendEmailInputSchema, storageEmailAttachmentSchema };
|
|
480
549
|
|