@pattern-stack/codegen 0.15.1 → 0.15.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +53 -0
- package/dist/chunk-24CWKBK5.js +94 -0
- package/dist/chunk-24CWKBK5.js.map +1 -0
- package/dist/chunk-2E224ZSN.js +20 -0
- package/dist/chunk-2E224ZSN.js.map +1 -0
- package/dist/chunk-2FTZLDBP.js +179 -0
- package/dist/chunk-2FTZLDBP.js.map +1 -0
- package/dist/chunk-2N4UG4VD.js +20 -0
- package/dist/chunk-2N4UG4VD.js.map +1 -0
- package/dist/chunk-2TVVBC53.js +92 -0
- package/dist/chunk-2TVVBC53.js.map +1 -0
- package/dist/chunk-2VHZ7EKC.js +37 -0
- package/dist/chunk-2VHZ7EKC.js.map +1 -0
- package/dist/chunk-32BMMV4H.js +109 -0
- package/dist/chunk-32BMMV4H.js.map +1 -0
- package/dist/chunk-32DOFN3T.js +4042 -0
- package/dist/chunk-32DOFN3T.js.map +1 -0
- package/dist/chunk-36U5UGIO.js +107 -0
- package/dist/chunk-36U5UGIO.js.map +1 -0
- package/dist/chunk-3CJFPU6Q.js +14 -0
- package/dist/chunk-3CJFPU6Q.js.map +1 -0
- package/dist/chunk-3NMCDN7L.js +90 -0
- package/dist/chunk-3NMCDN7L.js.map +1 -0
- package/dist/chunk-3SZFUTXE.js +62 -0
- package/dist/chunk-3SZFUTXE.js.map +1 -0
- package/dist/chunk-4DOJBQTP.js +117 -0
- package/dist/chunk-4DOJBQTP.js.map +1 -0
- package/dist/chunk-4JLJYWJC.js +308 -0
- package/dist/chunk-4JLJYWJC.js.map +1 -0
- package/dist/chunk-4KNXX6TI.js +29 -0
- package/dist/chunk-4KNXX6TI.js.map +1 -0
- package/dist/chunk-4LH67P4U.js +17 -0
- package/dist/chunk-4LH67P4U.js.map +1 -0
- package/dist/chunk-4MVGAMUA.js +40 -0
- package/dist/chunk-4MVGAMUA.js.map +1 -0
- package/dist/chunk-4OMHBMZJ.js +75 -0
- package/dist/chunk-4OMHBMZJ.js.map +1 -0
- package/dist/chunk-4RFHUZXU.js +635 -0
- package/dist/chunk-4RFHUZXU.js.map +1 -0
- package/dist/chunk-5A432NZJ.js +7 -0
- package/dist/chunk-5A432NZJ.js.map +1 -0
- package/dist/chunk-5Y7W3XR6.js +356 -0
- package/dist/chunk-5Y7W3XR6.js.map +1 -0
- package/dist/chunk-6DWFJNIK.js +15 -0
- package/dist/chunk-6DWFJNIK.js.map +1 -0
- package/dist/chunk-6I7ULIN6.js +15 -0
- package/dist/chunk-6I7ULIN6.js.map +1 -0
- package/dist/chunk-6XY6ZMMD.js +25 -0
- package/dist/chunk-6XY6ZMMD.js.map +1 -0
- package/dist/chunk-7B3RYX45.js +63 -0
- package/dist/chunk-7B3RYX45.js.map +1 -0
- package/dist/chunk-7C3FOSDI.js +1 -0
- package/dist/chunk-7C3FOSDI.js.map +1 -0
- package/dist/chunk-7KOW6PU6.js +59 -0
- package/dist/chunk-7KOW6PU6.js.map +1 -0
- package/dist/chunk-7LKAMLV4.js +92 -0
- package/dist/chunk-7LKAMLV4.js.map +1 -0
- package/dist/chunk-7RELQJIN.js +22 -0
- package/dist/chunk-7RELQJIN.js.map +1 -0
- package/dist/chunk-AHV4GDYM.js +63 -0
- package/dist/chunk-AHV4GDYM.js.map +1 -0
- package/dist/chunk-AQFQ4BYM.js +81 -0
- package/dist/chunk-AQFQ4BYM.js.map +1 -0
- package/dist/chunk-AS3NAZB6.js +14 -0
- package/dist/chunk-AS3NAZB6.js.map +1 -0
- package/dist/chunk-BGULBWKJ.js +88 -0
- package/dist/chunk-BGULBWKJ.js.map +1 -0
- package/dist/chunk-BIO6F7YI.js +17 -0
- package/dist/chunk-BIO6F7YI.js.map +1 -0
- package/dist/chunk-BOPZWRJK.js +36 -0
- package/dist/chunk-BOPZWRJK.js.map +1 -0
- package/dist/chunk-BPARRK6F.js +14 -0
- package/dist/chunk-BPARRK6F.js.map +1 -0
- package/dist/chunk-CO6LUM72.js +59 -0
- package/dist/chunk-CO6LUM72.js.map +1 -0
- package/dist/chunk-COGHTKXY.js +84 -0
- package/dist/chunk-COGHTKXY.js.map +1 -0
- package/dist/chunk-DCCZB4UC.js +100 -0
- package/dist/chunk-DCCZB4UC.js.map +1 -0
- package/dist/chunk-DKKFTHHI.js +53 -0
- package/dist/chunk-DKKFTHHI.js.map +1 -0
- package/dist/chunk-DV4RV2DC.js +59 -0
- package/dist/chunk-DV4RV2DC.js.map +1 -0
- package/dist/chunk-EDKJU5BO.js +11 -0
- package/dist/chunk-EDKJU5BO.js.map +1 -0
- package/dist/chunk-EO2QPOKH.js +116 -0
- package/dist/chunk-EO2QPOKH.js.map +1 -0
- package/dist/chunk-EOLLMEAH.js +155 -0
- package/dist/chunk-EOLLMEAH.js.map +1 -0
- package/dist/chunk-EWYCWP4H.js +14 -0
- package/dist/chunk-EWYCWP4H.js.map +1 -0
- package/dist/chunk-EXVDJMIY.js +33 -0
- package/dist/chunk-EXVDJMIY.js.map +1 -0
- package/dist/chunk-FASRXRX5.js +19 -0
- package/dist/chunk-FASRXRX5.js.map +1 -0
- package/dist/chunk-FI34KYZ5.js +1 -0
- package/dist/chunk-FI34KYZ5.js.map +1 -0
- package/dist/chunk-FN2PYDPP.js +1 -0
- package/dist/chunk-FN2PYDPP.js.map +1 -0
- package/dist/chunk-GM3RMJIJ.js +92 -0
- package/dist/chunk-GM3RMJIJ.js.map +1 -0
- package/dist/chunk-GYGNEQSC.js +9 -0
- package/dist/chunk-GYGNEQSC.js.map +1 -0
- package/dist/chunk-H5NH7KPE.js +21 -0
- package/dist/chunk-H5NH7KPE.js.map +1 -0
- package/dist/chunk-HNWZFNKP.js +168 -0
- package/dist/chunk-HNWZFNKP.js.map +1 -0
- package/dist/chunk-HUH73XGI.js +1 -0
- package/dist/chunk-HUH73XGI.js.map +1 -0
- package/dist/chunk-I6MG4M3F.js +201 -0
- package/dist/chunk-I6MG4M3F.js.map +1 -0
- package/dist/chunk-I6MVCB5A.js +39 -0
- package/dist/chunk-I6MVCB5A.js.map +1 -0
- package/dist/chunk-IBGER4YK.js +12 -0
- package/dist/chunk-IBGER4YK.js.map +1 -0
- package/dist/chunk-IF5I3DAA.js +92 -0
- package/dist/chunk-IF5I3DAA.js.map +1 -0
- package/dist/chunk-IP4OO26U.js +54 -0
- package/dist/chunk-IP4OO26U.js.map +1 -0
- package/dist/chunk-IWAOY6KC.js +1 -0
- package/dist/chunk-IWAOY6KC.js.map +1 -0
- package/dist/chunk-J37YWU7Y.js +19 -0
- package/dist/chunk-J37YWU7Y.js.map +1 -0
- package/dist/chunk-J6KZS54B.js +269 -0
- package/dist/chunk-J6KZS54B.js.map +1 -0
- package/dist/chunk-J6MN42LG.js +19 -0
- package/dist/chunk-J6MN42LG.js.map +1 -0
- package/dist/chunk-JRQO2IOF.js +65 -0
- package/dist/chunk-JRQO2IOF.js.map +1 -0
- package/dist/chunk-JRVNVKN6.js +212 -0
- package/dist/chunk-JRVNVKN6.js.map +1 -0
- package/dist/chunk-JWNHNUYL.js +96 -0
- package/dist/chunk-JWNHNUYL.js.map +1 -0
- package/dist/chunk-K2I6XIK5.js +122 -0
- package/dist/chunk-K2I6XIK5.js.map +1 -0
- package/dist/chunk-KMZCQASO.js +111 -0
- package/dist/chunk-KMZCQASO.js.map +1 -0
- package/dist/chunk-KVOWSC5S.js +1 -0
- package/dist/chunk-KVOWSC5S.js.map +1 -0
- package/dist/chunk-KYR3B3OW.js +79 -0
- package/dist/chunk-KYR3B3OW.js.map +1 -0
- package/dist/chunk-L3LZWWSX.js +61 -0
- package/dist/chunk-L3LZWWSX.js.map +1 -0
- package/dist/chunk-L4SDDEEU.js +1 -0
- package/dist/chunk-L4SDDEEU.js.map +1 -0
- package/dist/chunk-L6FTY45T.js +13 -0
- package/dist/chunk-L6FTY45T.js.map +1 -0
- package/dist/chunk-L7BNNRGI.js +134 -0
- package/dist/chunk-L7BNNRGI.js.map +1 -0
- package/dist/chunk-LG57S2SC.js +150 -0
- package/dist/chunk-LG57S2SC.js.map +1 -0
- package/dist/chunk-M6QLSLPO.js +97 -0
- package/dist/chunk-M6QLSLPO.js.map +1 -0
- package/dist/chunk-MZ6GV4YF.js +21 -0
- package/dist/chunk-MZ6GV4YF.js.map +1 -0
- package/dist/chunk-N5OTOWTP.js +55 -0
- package/dist/chunk-N5OTOWTP.js.map +1 -0
- package/dist/chunk-NN7XZEGF.js +14 -0
- package/dist/chunk-NN7XZEGF.js.map +1 -0
- package/dist/chunk-NPFPZ2HO.js +13 -0
- package/dist/chunk-NPFPZ2HO.js.map +1 -0
- package/dist/chunk-NXXDZ6ZF.js +42 -0
- package/dist/chunk-NXXDZ6ZF.js.map +1 -0
- package/dist/chunk-NYBCQZC7.js +11 -0
- package/dist/chunk-NYBCQZC7.js.map +1 -0
- package/dist/chunk-OFRRBC7M.js +78 -0
- package/dist/chunk-OFRRBC7M.js.map +1 -0
- package/dist/chunk-OGIZXGPY.js +222 -0
- package/dist/chunk-OGIZXGPY.js.map +1 -0
- package/dist/chunk-OKXZ63IA.js +168 -0
- package/dist/chunk-OKXZ63IA.js.map +1 -0
- package/dist/chunk-OSQRXVG2.js +58 -0
- package/dist/chunk-OSQRXVG2.js.map +1 -0
- package/dist/chunk-OTDN3OUQ.js +215 -0
- package/dist/chunk-OTDN3OUQ.js.map +1 -0
- package/dist/chunk-OZZJDRGW.js +122 -0
- package/dist/chunk-OZZJDRGW.js.map +1 -0
- package/dist/chunk-PNZSGAB2.js +114 -0
- package/dist/chunk-PNZSGAB2.js.map +1 -0
- package/dist/chunk-PRWIX6UW.js +21 -0
- package/dist/chunk-PRWIX6UW.js.map +1 -0
- package/dist/chunk-PSXUNOVU.js +7 -0
- package/dist/chunk-PSXUNOVU.js.map +1 -0
- package/dist/chunk-QLTJSCE6.js +44 -0
- package/dist/chunk-QLTJSCE6.js.map +1 -0
- package/dist/chunk-RC23QROE.js +447 -0
- package/dist/chunk-RC23QROE.js.map +1 -0
- package/dist/chunk-RFH7N6EP.js +36 -0
- package/dist/chunk-RFH7N6EP.js.map +1 -0
- package/dist/chunk-RHVN6NA7.js +134 -0
- package/dist/chunk-RHVN6NA7.js.map +1 -0
- package/dist/chunk-S7C6TIIF.js +21 -0
- package/dist/chunk-S7C6TIIF.js.map +1 -0
- package/dist/chunk-SNQ3TOWP.js +20 -0
- package/dist/chunk-SNQ3TOWP.js.map +1 -0
- package/dist/chunk-SOVM2VEK.js +14 -0
- package/dist/chunk-SOVM2VEK.js.map +1 -0
- package/dist/chunk-SQDOBLBP.js +13 -0
- package/dist/chunk-SQDOBLBP.js.map +1 -0
- package/dist/chunk-SR7F3TJY.js +130 -0
- package/dist/chunk-SR7F3TJY.js.map +1 -0
- package/dist/chunk-SZVPIHWE.js +129 -0
- package/dist/chunk-SZVPIHWE.js.map +1 -0
- package/dist/chunk-T4BIIU5E.js +89 -0
- package/dist/chunk-T4BIIU5E.js.map +1 -0
- package/dist/chunk-T6C4LFLC.js +112 -0
- package/dist/chunk-T6C4LFLC.js.map +1 -0
- package/dist/chunk-TNXH7BJS.js +48 -0
- package/dist/chunk-TNXH7BJS.js.map +1 -0
- package/dist/chunk-U64T4YZE.js +9 -0
- package/dist/chunk-U64T4YZE.js.map +1 -0
- package/dist/chunk-UQ5EHOH2.js +39 -0
- package/dist/chunk-UQ5EHOH2.js.map +1 -0
- package/dist/chunk-UTN4GBPQ.js +1 -0
- package/dist/chunk-UTN4GBPQ.js.map +1 -0
- package/dist/chunk-V4AF6DI4.js +16 -0
- package/dist/chunk-V4AF6DI4.js.map +1 -0
- package/dist/chunk-W72PRNJY.js +126 -0
- package/dist/chunk-W72PRNJY.js.map +1 -0
- package/dist/chunk-WEVWJKOW.js +81 -0
- package/dist/chunk-WEVWJKOW.js.map +1 -0
- package/dist/chunk-WL67FZGF.js +21 -0
- package/dist/chunk-WL67FZGF.js.map +1 -0
- package/dist/chunk-WPXNN6QS.js +290 -0
- package/dist/chunk-WPXNN6QS.js.map +1 -0
- package/dist/chunk-WRUUSZDJ.js +29 -0
- package/dist/chunk-WRUUSZDJ.js.map +1 -0
- package/dist/chunk-X2GMTYPA.js +50 -0
- package/dist/chunk-X2GMTYPA.js.map +1 -0
- package/dist/chunk-XCEI7NUH.js +41 -0
- package/dist/chunk-XCEI7NUH.js.map +1 -0
- package/dist/chunk-Y7GDG744.js +88 -0
- package/dist/chunk-Y7GDG744.js.map +1 -0
- package/dist/chunk-Y7RRSEOC.js +9 -0
- package/dist/chunk-Y7RRSEOC.js.map +1 -0
- package/dist/chunk-YPWODKD5.js +184 -0
- package/dist/chunk-YPWODKD5.js.map +1 -0
- package/dist/chunk-YSLTTQLC.js +25 -0
- package/dist/chunk-YSLTTQLC.js.map +1 -0
- package/dist/chunk-YTN6BKWA.js +121 -0
- package/dist/chunk-YTN6BKWA.js.map +1 -0
- package/dist/chunk-Z7PQCAVK.js +200 -0
- package/dist/chunk-Z7PQCAVK.js.map +1 -0
- package/dist/chunk-ZUKFQL6E.js +47 -0
- package/dist/chunk-ZUKFQL6E.js.map +1 -0
- package/dist/chunk-ZUMULSEQ.js +1 -0
- package/dist/chunk-ZUMULSEQ.js.map +1 -0
- package/dist/runtime/analytics/index.js +8 -41
- package/dist/runtime/analytics/index.js.map +1 -1
- package/dist/runtime/analytics/types.js +8 -41
- package/dist/runtime/analytics/types.js.map +1 -1
- package/dist/runtime/base-classes/activity-entity-repository.js +6 -312
- package/dist/runtime/base-classes/activity-entity-repository.js.map +1 -1
- package/dist/runtime/base-classes/activity-entity-service.js +6 -212
- package/dist/runtime/base-classes/activity-entity-service.js.map +1 -1
- package/dist/runtime/base-classes/base-read-use-cases.js +5 -27
- package/dist/runtime/base-classes/base-read-use-cases.js.map +1 -1
- package/dist/runtime/base-classes/base-repository.js +5 -277
- package/dist/runtime/base-classes/base-repository.js.map +1 -1
- package/dist/runtime/base-classes/base-service.js +5 -184
- package/dist/runtime/base-classes/base-service.js.map +1 -1
- package/dist/runtime/base-classes/index.js +59 -1076
- package/dist/runtime/base-classes/index.js.map +1 -1
- package/dist/runtime/base-classes/integrated-entity-repository.js +6 -486
- package/dist/runtime/base-classes/integrated-entity-repository.js.map +1 -1
- package/dist/runtime/base-classes/integrated-entity-service.js +6 -213
- package/dist/runtime/base-classes/integrated-entity-service.js.map +1 -1
- package/dist/runtime/base-classes/junction-integration-repository.js +8 -448
- package/dist/runtime/base-classes/junction-integration-repository.js.map +1 -1
- package/dist/runtime/base-classes/knowledge-entity-repository.js +6 -283
- package/dist/runtime/base-classes/knowledge-entity-repository.js.map +1 -1
- package/dist/runtime/base-classes/knowledge-entity-service.js +6 -190
- package/dist/runtime/base-classes/knowledge-entity-service.js.map +1 -1
- package/dist/runtime/base-classes/lifecycle-events.js +8 -70
- package/dist/runtime/base-classes/lifecycle-events.js.map +1 -1
- package/dist/runtime/base-classes/metadata-entity-repository.js +6 -330
- package/dist/runtime/base-classes/metadata-entity-repository.js.map +1 -1
- package/dist/runtime/base-classes/metadata-entity-service.js +6 -212
- package/dist/runtime/base-classes/metadata-entity-service.js.map +1 -1
- package/dist/runtime/base-classes/tenant-context.js +10 -36
- package/dist/runtime/base-classes/tenant-context.js.map +1 -1
- package/dist/runtime/base-classes/with-analytics.js +4 -7
- package/dist/runtime/base-classes/with-analytics.js.map +1 -1
- package/dist/runtime/constants/tokens.js +5 -3
- package/dist/runtime/constants/tokens.js.map +1 -1
- package/dist/runtime/eav-helpers.js +2 -0
- package/dist/runtime/eav-helpers.js.map +1 -1
- package/dist/runtime/pipes/zod-validation.pipe.js +3 -10
- package/dist/runtime/pipes/zod-validation.pipe.js.map +1 -1
- package/dist/runtime/shared/openapi/error-response.dto.js +5 -8
- package/dist/runtime/shared/openapi/error-response.dto.js.map +1 -1
- package/dist/runtime/shared/openapi/errors.js +5 -19
- package/dist/runtime/shared/openapi/errors.js.map +1 -1
- package/dist/runtime/shared/openapi/index.js +15 -106
- package/dist/runtime/shared/openapi/index.js.map +1 -1
- package/dist/runtime/shared/openapi/registry.js +6 -103
- package/dist/runtime/shared/openapi/registry.js.map +1 -1
- package/dist/runtime/shared/openapi/registry.tokens.js +4 -2
- package/dist/runtime/shared/openapi/registry.tokens.js.map +1 -1
- package/dist/runtime/subsystems/analytics/analytics.module.js +8 -117
- package/dist/runtime/subsystems/analytics/analytics.module.js.map +1 -1
- package/dist/runtime/subsystems/analytics/analytics.tokens.js +7 -8
- package/dist/runtime/subsystems/analytics/analytics.tokens.js.map +1 -1
- package/dist/runtime/subsystems/analytics/cube-backend.js +6 -71
- package/dist/runtime/subsystems/analytics/cube-backend.js.map +1 -1
- package/dist/runtime/subsystems/analytics/index.js +16 -117
- package/dist/runtime/subsystems/analytics/index.js.map +1 -1
- package/dist/runtime/subsystems/analytics/noop-backend.js +4 -21
- package/dist/runtime/subsystems/analytics/noop-backend.js.map +1 -1
- package/dist/runtime/subsystems/auth/auth-oauth-state.schema.js +4 -8
- package/dist/runtime/subsystems/auth/auth-oauth-state.schema.js.map +1 -1
- package/dist/runtime/subsystems/auth/auth.module.js +12 -359
- package/dist/runtime/subsystems/auth/auth.module.js.map +1 -1
- package/dist/runtime/subsystems/auth/auth.tokens.js +12 -13
- package/dist/runtime/subsystems/auth/auth.tokens.js.map +1 -1
- package/dist/runtime/subsystems/auth/backends/encryption-key/env.js +4 -49
- package/dist/runtime/subsystems/auth/backends/encryption-key/env.js.map +1 -1
- package/dist/runtime/subsystems/auth/backends/state-store.drizzle-backend.js +6 -64
- package/dist/runtime/subsystems/auth/backends/state-store.drizzle-backend.js.map +1 -1
- package/dist/runtime/subsystems/auth/backends/state-store.memory-backend.js +5 -47
- package/dist/runtime/subsystems/auth/backends/state-store.memory-backend.js.map +1 -1
- package/dist/runtime/subsystems/auth/controllers/auth.controller.js +5 -139
- package/dist/runtime/subsystems/auth/controllers/auth.controller.js.map +1 -1
- package/dist/runtime/subsystems/auth/index.js +53 -542
- package/dist/runtime/subsystems/auth/index.js.map +1 -1
- package/dist/runtime/subsystems/auth/middleware/requester-context.js +9 -65
- package/dist/runtime/subsystems/auth/middleware/requester-context.js.map +1 -1
- package/dist/runtime/subsystems/auth/protocols/oauth-state-store.js +4 -9
- package/dist/runtime/subsystems/auth/protocols/oauth-state-store.js.map +1 -1
- package/dist/runtime/subsystems/auth/runtime/connection-broken.error.js +4 -15
- package/dist/runtime/subsystems/auth/runtime/connection-broken.error.js.map +1 -1
- package/dist/runtime/subsystems/auth/runtime/oauth2-refresh.strategy.js +5 -104
- package/dist/runtime/subsystems/auth/runtime/oauth2-refresh.strategy.js.map +1 -1
- package/dist/runtime/subsystems/auth/runtime/session-expired.error.js +5 -16
- package/dist/runtime/subsystems/auth/runtime/session-expired.error.js.map +1 -1
- package/dist/runtime/subsystems/auth/runtime/with-auth-retry.js +5 -29
- package/dist/runtime/subsystems/auth/runtime/with-auth-retry.js.map +1 -1
- package/dist/runtime/subsystems/bridge/assert-tenant-id.js +5 -18
- package/dist/runtime/subsystems/bridge/assert-tenant-id.js.map +1 -1
- package/dist/runtime/subsystems/bridge/bridge-delivery-handler.js +12 -184
- package/dist/runtime/subsystems/bridge/bridge-delivery-handler.js.map +1 -1
- package/dist/runtime/subsystems/bridge/bridge-delivery.drizzle-backend.js +10 -448
- package/dist/runtime/subsystems/bridge/bridge-delivery.drizzle-backend.js.map +1 -1
- package/dist/runtime/subsystems/bridge/bridge-delivery.memory-backend.js +5 -126
- package/dist/runtime/subsystems/bridge/bridge-delivery.memory-backend.js.map +1 -1
- package/dist/runtime/subsystems/bridge/bridge-delivery.schema.js +6 -308
- package/dist/runtime/subsystems/bridge/bridge-delivery.schema.js.map +1 -1
- package/dist/runtime/subsystems/bridge/bridge-errors.js +6 -35
- package/dist/runtime/subsystems/bridge/bridge-errors.js.map +1 -1
- package/dist/runtime/subsystems/bridge/bridge-outbox-drain-hook.js +14 -606
- package/dist/runtime/subsystems/bridge/bridge-outbox-drain-hook.js.map +1 -1
- package/dist/runtime/subsystems/bridge/bridge.module.js +35 -3476
- package/dist/runtime/subsystems/bridge/bridge.module.js.map +1 -1
- package/dist/runtime/subsystems/bridge/bridge.tokens.js +9 -7
- package/dist/runtime/subsystems/bridge/bridge.tokens.js.map +1 -1
- package/dist/runtime/subsystems/bridge/event-flow.service.js +11 -137
- package/dist/runtime/subsystems/bridge/event-flow.service.js.map +1 -1
- package/dist/runtime/subsystems/bridge/generated/registry.js +4 -2
- package/dist/runtime/subsystems/bridge/generated/registry.js.map +1 -1
- package/dist/runtime/subsystems/bridge/index.js +60 -3470
- package/dist/runtime/subsystems/bridge/index.js.map +1 -1
- package/dist/runtime/subsystems/bridge/reserved-pools.js +4 -6
- package/dist/runtime/subsystems/bridge/reserved-pools.js.map +1 -1
- package/dist/runtime/subsystems/cache/cache.drizzle-backend.js +10 -133
- package/dist/runtime/subsystems/cache/cache.drizzle-backend.js.map +1 -1
- package/dist/runtime/subsystems/cache/cache.memory-backend.js +6 -101
- package/dist/runtime/subsystems/cache/cache.memory-backend.js.map +1 -1
- package/dist/runtime/subsystems/cache/cache.module.js +10 -278
- package/dist/runtime/subsystems/cache/cache.module.js.map +1 -1
- package/dist/runtime/subsystems/cache/cache.schema.js +4 -14
- package/dist/runtime/subsystems/cache/cache.schema.js.map +1 -1
- package/dist/runtime/subsystems/cache/cache.tokens.js +6 -7
- package/dist/runtime/subsystems/cache/cache.tokens.js.map +1 -1
- package/dist/runtime/subsystems/cache/index.js +20 -278
- package/dist/runtime/subsystems/cache/index.js.map +1 -1
- package/dist/runtime/subsystems/events/domain-events.schema.js +3 -72
- package/dist/runtime/subsystems/events/domain-events.schema.js.map +1 -1
- package/dist/runtime/subsystems/events/event-bus.drizzle-backend.js +9 -413
- package/dist/runtime/subsystems/events/event-bus.drizzle-backend.js.map +1 -1
- package/dist/runtime/subsystems/events/event-bus.memory-backend.js +7 -235
- package/dist/runtime/subsystems/events/event-bus.memory-backend.js.map +1 -1
- package/dist/runtime/subsystems/events/event-bus.redis-backend.js +8 -20
- package/dist/runtime/subsystems/events/event-bus.redis-backend.js.map +1 -1
- package/dist/runtime/subsystems/events/event-keyset-cursor.js +8 -30
- package/dist/runtime/subsystems/events/event-keyset-cursor.js.map +1 -1
- package/dist/runtime/subsystems/events/event-read.protocol.js +2 -0
- package/dist/runtime/subsystems/events/event-read.protocol.js.map +1 -1
- package/dist/runtime/subsystems/events/events-errors.js +4 -11
- package/dist/runtime/subsystems/events/events-errors.js.map +1 -1
- package/dist/runtime/subsystems/events/events.module.js +15 -949
- package/dist/runtime/subsystems/events/events.module.js.map +1 -1
- package/dist/runtime/subsystems/events/events.tokens.js +10 -11
- package/dist/runtime/subsystems/events/events.tokens.js.map +1 -1
- package/dist/runtime/subsystems/events/generated/bus.js +9 -240
- package/dist/runtime/subsystems/events/generated/bus.js.map +1 -1
- package/dist/runtime/subsystems/events/generated/index.js +23 -240
- package/dist/runtime/subsystems/events/generated/index.js.map +1 -1
- package/dist/runtime/subsystems/events/generated/registry.js +5 -82
- package/dist/runtime/subsystems/events/generated/registry.js.map +1 -1
- package/dist/runtime/subsystems/events/generated/schemas.js +12 -52
- package/dist/runtime/subsystems/events/generated/schemas.js.map +1 -1
- package/dist/runtime/subsystems/events/generated/types.js +1 -0
- package/dist/runtime/subsystems/events/index.js +32 -949
- package/dist/runtime/subsystems/events/index.js.map +1 -1
- package/dist/runtime/subsystems/index.js +171 -5912
- package/dist/runtime/subsystems/index.js.map +1 -1
- package/dist/runtime/subsystems/integration/build-change-source.js +6 -178
- package/dist/runtime/subsystems/integration/build-change-source.js.map +1 -1
- package/dist/runtime/subsystems/integration/deep-equal.differ.js +4 -109
- package/dist/runtime/subsystems/integration/deep-equal.differ.js.map +1 -1
- package/dist/runtime/subsystems/integration/detection-config.schema.js +11 -78
- package/dist/runtime/subsystems/integration/detection-config.schema.js.map +1 -1
- package/dist/runtime/subsystems/integration/entity-change-source-registry.memory.js +5 -30
- package/dist/runtime/subsystems/integration/entity-change-source-registry.memory.js.map +1 -1
- package/dist/runtime/subsystems/integration/entity-change-source-registry.protocol.js +4 -9
- package/dist/runtime/subsystems/integration/entity-change-source-registry.protocol.js.map +1 -1
- package/dist/runtime/subsystems/integration/execute-integration.use-case.js +6 -239
- package/dist/runtime/subsystems/integration/execute-integration.use-case.js.map +1 -1
- package/dist/runtime/subsystems/integration/incremental-read.js +5 -144
- package/dist/runtime/subsystems/integration/incremental-read.js.map +1 -1
- package/dist/runtime/subsystems/integration/index.js +83 -1352
- package/dist/runtime/subsystems/integration/index.js.map +1 -1
- package/dist/runtime/subsystems/integration/integration-audit.schema.js +10 -155
- package/dist/runtime/subsystems/integration/integration-audit.schema.js.map +1 -1
- package/dist/runtime/subsystems/integration/integration-cursor-store.drizzle-backend.js +7 -270
- package/dist/runtime/subsystems/integration/integration-cursor-store.drizzle-backend.js.map +1 -1
- package/dist/runtime/subsystems/integration/integration-cursor-store.memory-backend.js +4 -65
- package/dist/runtime/subsystems/integration/integration-cursor-store.memory-backend.js.map +1 -1
- package/dist/runtime/subsystems/integration/integration-errors.js +5 -15
- package/dist/runtime/subsystems/integration/integration-errors.js.map +1 -1
- package/dist/runtime/subsystems/integration/integration-field-diff.protocol.js +5 -7
- package/dist/runtime/subsystems/integration/integration-field-diff.protocol.js.map +1 -1
- package/dist/runtime/subsystems/integration/integration-run-recorder.drizzle-backend.js +8 -303
- package/dist/runtime/subsystems/integration/integration-run-recorder.drizzle-backend.js.map +1 -1
- package/dist/runtime/subsystems/integration/integration-run-recorder.memory-backend.js +5 -125
- package/dist/runtime/subsystems/integration/integration-run-recorder.memory-backend.js.map +1 -1
- package/dist/runtime/subsystems/integration/integration.module.js +13 -700
- package/dist/runtime/subsystems/integration/integration.module.js.map +1 -1
- package/dist/runtime/subsystems/integration/integration.tokens.js +11 -9
- package/dist/runtime/subsystems/integration/integration.tokens.js.map +1 -1
- package/dist/runtime/subsystems/integration/loopback.middleware.js +4 -16
- package/dist/runtime/subsystems/integration/loopback.middleware.js.map +1 -1
- package/dist/runtime/subsystems/integration/poll-change-source.js +4 -89
- package/dist/runtime/subsystems/integration/poll-change-source.js.map +1 -1
- package/dist/runtime/subsystems/integration/webhook-change-source.js +4 -70
- package/dist/runtime/subsystems/integration/webhook-change-source.js.map +1 -1
- package/dist/runtime/subsystems/jobs/bullmq.config.js +9 -140
- package/dist/runtime/subsystems/jobs/bullmq.config.js.map +1 -1
- package/dist/runtime/subsystems/jobs/index.js +88 -2691
- package/dist/runtime/subsystems/jobs/index.js.map +1 -1
- package/dist/runtime/subsystems/jobs/job-handler.base.js +10 -49
- package/dist/runtime/subsystems/jobs/job-handler.base.js.map +1 -1
- package/dist/runtime/subsystems/jobs/job-orchestration.schema.js +13 -152
- package/dist/runtime/subsystems/jobs/job-orchestration.schema.js.map +1 -1
- package/dist/runtime/subsystems/jobs/job-orchestrator.bullmq-backend.js +36 -699
- package/dist/runtime/subsystems/jobs/job-orchestrator.bullmq-backend.js.map +1 -1
- package/dist/runtime/subsystems/jobs/job-orchestrator.drizzle-backend.js +10 -564
- package/dist/runtime/subsystems/jobs/job-orchestrator.drizzle-backend.js.map +1 -1
- package/dist/runtime/subsystems/jobs/job-orchestrator.memory-backend.js +10 -824
- package/dist/runtime/subsystems/jobs/job-orchestrator.memory-backend.js.map +1 -1
- package/dist/runtime/subsystems/jobs/job-run-keyset-cursor.js +9 -51
- package/dist/runtime/subsystems/jobs/job-run-keyset-cursor.js.map +1 -1
- package/dist/runtime/subsystems/jobs/job-run-service.drizzle-backend.js +9 -416
- package/dist/runtime/subsystems/jobs/job-run-service.drizzle-backend.js.map +1 -1
- package/dist/runtime/subsystems/jobs/job-run-service.memory-backend.js +9 -290
- package/dist/runtime/subsystems/jobs/job-run-service.memory-backend.js.map +1 -1
- package/dist/runtime/subsystems/jobs/job-step-service.drizzle-backend.js +5 -213
- package/dist/runtime/subsystems/jobs/job-step-service.drizzle-backend.js.map +1 -1
- package/dist/runtime/subsystems/jobs/job-step-service.memory-backend.js +5 -131
- package/dist/runtime/subsystems/jobs/job-step-service.memory-backend.js.map +1 -1
- package/dist/runtime/subsystems/jobs/job-worker.bullmq-backend.js +9 -175
- package/dist/runtime/subsystems/jobs/job-worker.bullmq-backend.js.map +1 -1
- package/dist/runtime/subsystems/jobs/job-worker.js +14 -613
- package/dist/runtime/subsystems/jobs/job-worker.js.map +1 -1
- package/dist/runtime/subsystems/jobs/job-worker.module.js +23 -2647
- package/dist/runtime/subsystems/jobs/job-worker.module.js.map +1 -1
- package/dist/runtime/subsystems/jobs/jobs-domain.module.js +19 -1897
- package/dist/runtime/subsystems/jobs/jobs-domain.module.js.map +1 -1
- package/dist/runtime/subsystems/jobs/jobs-domain.tokens.js +8 -9
- package/dist/runtime/subsystems/jobs/jobs-domain.tokens.js.map +1 -1
- package/dist/runtime/subsystems/jobs/jobs-errors.js +10 -78
- package/dist/runtime/subsystems/jobs/jobs-errors.js.map +1 -1
- package/dist/runtime/subsystems/jobs/memory-job-store.js +4 -15
- package/dist/runtime/subsystems/jobs/memory-job-store.js.map +1 -1
- package/dist/runtime/subsystems/jobs/pool-config.loader.js +9 -124
- package/dist/runtime/subsystems/jobs/pool-config.loader.js.map +1 -1
- package/dist/runtime/subsystems/observability/index.js +21 -310
- package/dist/runtime/subsystems/observability/index.js.map +1 -1
- package/dist/runtime/subsystems/observability/observability-errors.js +4 -9
- package/dist/runtime/subsystems/observability/observability-errors.js.map +1 -1
- package/dist/runtime/subsystems/observability/observability.module.js +11 -300
- package/dist/runtime/subsystems/observability/observability.module.js.map +1 -1
- package/dist/runtime/subsystems/observability/observability.service.js +9 -197
- package/dist/runtime/subsystems/observability/observability.service.js.map +1 -1
- package/dist/runtime/subsystems/observability/observability.tokens.js +5 -3
- package/dist/runtime/subsystems/observability/observability.tokens.js.map +1 -1
- package/dist/runtime/subsystems/observability/reporters/bridge-metrics.reporter.js +4 -84
- package/dist/runtime/subsystems/observability/reporters/bridge-metrics.reporter.js.map +1 -1
- package/dist/runtime/subsystems/observability/reporters/index.js +5 -84
- package/dist/runtime/subsystems/observability/reporters/index.js.map +1 -1
- package/dist/runtime/subsystems/storage/index.js +15 -200
- package/dist/runtime/subsystems/storage/index.js.map +1 -1
- package/dist/runtime/subsystems/storage/storage.local-backend.js +4 -103
- package/dist/runtime/subsystems/storage/storage.local-backend.js.map +1 -1
- package/dist/runtime/subsystems/storage/storage.memory-backend.js +5 -68
- package/dist/runtime/subsystems/storage/storage.memory-backend.js.map +1 -1
- package/dist/runtime/subsystems/storage/storage.module.js +8 -200
- package/dist/runtime/subsystems/storage/storage.module.js.map +1 -1
- package/dist/runtime/subsystems/storage/storage.tokens.js +5 -6
- package/dist/runtime/subsystems/storage/storage.tokens.js.map +1 -1
- package/dist/runtime/subsystems/storage/storage.utils.js +4 -14
- package/dist/runtime/subsystems/storage/storage.utils.js.map +1 -1
- package/dist/runtime/subsystems/token-key.js +5 -3
- package/dist/runtime/subsystems/token-key.js.map +1 -1
- package/dist/src/cli/index.js +637 -5454
- package/dist/src/cli/index.js.map +1 -1
- package/dist/src/index.js +68 -4170
- package/dist/src/index.js.map +1 -1
- package/package.json +1 -1
- package/runtime/subsystems/bridge/bridge-outbox-drain-hook.ts +44 -21
- package/runtime/subsystems/jobs/job-worker.ts +17 -11
|
@@ -0,0 +1,635 @@
|
|
|
1
|
+
import {
|
|
2
|
+
MemoryJobStepService
|
|
3
|
+
} from "./chunk-PNZSGAB2.js";
|
|
4
|
+
import {
|
|
5
|
+
MemoryJobStore
|
|
6
|
+
} from "./chunk-SNQ3TOWP.js";
|
|
7
|
+
import {
|
|
8
|
+
JobCollisionError,
|
|
9
|
+
JobNotReplayableError,
|
|
10
|
+
JobTemplateFieldMissingError,
|
|
11
|
+
JobTypeNotFoundError,
|
|
12
|
+
MissingTenantIdError
|
|
13
|
+
} from "./chunk-T4BIIU5E.js";
|
|
14
|
+
import {
|
|
15
|
+
JOBS_MULTI_TENANT
|
|
16
|
+
} from "./chunk-BIO6F7YI.js";
|
|
17
|
+
import {
|
|
18
|
+
__decorateClass,
|
|
19
|
+
__decorateParam
|
|
20
|
+
} from "./chunk-2E224ZSN.js";
|
|
21
|
+
|
|
22
|
+
// runtime/subsystems/jobs/job-orchestrator.memory-backend.ts
|
|
23
|
+
import { randomUUID } from "crypto";
|
|
24
|
+
import { Inject, Injectable, Logger, Optional } from "@nestjs/common";
|
|
25
|
+
import { ModuleRef } from "@nestjs/core";
|
|
26
|
+
var QUEUED_RUN_AT = /* @__PURE__ */ new Date(864e13);
|
|
27
|
+
var TERMINAL_STATUSES = [
|
|
28
|
+
"completed",
|
|
29
|
+
"failed",
|
|
30
|
+
"timed_out",
|
|
31
|
+
"canceled"
|
|
32
|
+
];
|
|
33
|
+
var DEDUPE_EXCLUDED_STATUSES = ["canceled", "failed"];
|
|
34
|
+
var IN_FLIGHT_STATUSES = ["pending", "running"];
|
|
35
|
+
function isTerminal(status) {
|
|
36
|
+
return TERMINAL_STATUSES.includes(status);
|
|
37
|
+
}
|
|
38
|
+
function evaluateKeyTemplate(template, input) {
|
|
39
|
+
return template.replace(
|
|
40
|
+
/\{\{\s*([a-zA-Z0-9_]+)\s*\}\}/g,
|
|
41
|
+
(_m, field) => {
|
|
42
|
+
const value = input[field];
|
|
43
|
+
if (value === void 0 || value === null) {
|
|
44
|
+
throw new JobTemplateFieldMissingError(template, field);
|
|
45
|
+
}
|
|
46
|
+
return String(value);
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
var PromiseMutex = class {
|
|
51
|
+
queue = Promise.resolve();
|
|
52
|
+
async run(fn) {
|
|
53
|
+
const next = this.queue.then(() => fn());
|
|
54
|
+
this.queue = next.then(
|
|
55
|
+
() => void 0,
|
|
56
|
+
() => void 0
|
|
57
|
+
);
|
|
58
|
+
return next;
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
var MemoryJobOrchestrator = class {
|
|
62
|
+
constructor(store, stepService, multiTenant, moduleRef) {
|
|
63
|
+
this.store = store;
|
|
64
|
+
this.stepService = stepService;
|
|
65
|
+
this.multiTenant = multiTenant;
|
|
66
|
+
this.moduleRef = moduleRef;
|
|
67
|
+
}
|
|
68
|
+
store;
|
|
69
|
+
stepService;
|
|
70
|
+
multiTenant;
|
|
71
|
+
moduleRef;
|
|
72
|
+
logger = new Logger(MemoryJobOrchestrator.name);
|
|
73
|
+
mutex = new PromiseMutex();
|
|
74
|
+
handlerRegistry = /* @__PURE__ */ new Map();
|
|
75
|
+
/**
|
|
76
|
+
* `runId → dependent runId[]` — when a run with `concurrencyKey = K`
|
|
77
|
+
* blocks on an incumbent, its id is added here under the incumbent's id.
|
|
78
|
+
* On incumbent terminal transition we advance every dependent's `runAt`
|
|
79
|
+
* back to `now()` so it becomes claimable.
|
|
80
|
+
*/
|
|
81
|
+
queueBlockers = /* @__PURE__ */ new Map();
|
|
82
|
+
/**
|
|
83
|
+
* JOB-8 — mirror of the Drizzle backend's `resolveTenantId`. Returns the
|
|
84
|
+
* value to stamp on `tenant_id` / compare against in memory predicates.
|
|
85
|
+
* Off → always `null`. On + `undefined` → throw. On + `null`/string → pass.
|
|
86
|
+
*/
|
|
87
|
+
resolveTenantId(method, tenantId) {
|
|
88
|
+
if (!this.multiTenant) return null;
|
|
89
|
+
if (tenantId === void 0) throw new MissingTenantIdError(method);
|
|
90
|
+
return tenantId;
|
|
91
|
+
}
|
|
92
|
+
// ==========================================================================
|
|
93
|
+
// registerHandler — replaces Drizzle's `job` table upsert
|
|
94
|
+
// ==========================================================================
|
|
95
|
+
/**
|
|
96
|
+
* Populate the in-memory job definition row plus handler class lookup.
|
|
97
|
+
* Called by `JobWorkerModule.onModuleInit` in memory mode, or directly by
|
|
98
|
+
* unit tests that want to seed the registry without NestJS.
|
|
99
|
+
*/
|
|
100
|
+
registerHandler(type, meta, handlerClass) {
|
|
101
|
+
const concurrencyKeyTemplate = meta.concurrency?.key ?? null;
|
|
102
|
+
const dedupeKeyTemplate = meta.dedupe?.key ?? null;
|
|
103
|
+
const dedupeWindowMs = meta.dedupe?.windowMs ?? null;
|
|
104
|
+
const now = /* @__PURE__ */ new Date();
|
|
105
|
+
const def = {
|
|
106
|
+
type,
|
|
107
|
+
version: 1,
|
|
108
|
+
pool: meta.pool ?? "batch",
|
|
109
|
+
scopeEntityType: meta.scope?.entity ?? null,
|
|
110
|
+
retryPolicy: meta.retry ?? {
|
|
111
|
+
attempts: 1,
|
|
112
|
+
backoff: "fixed",
|
|
113
|
+
baseMs: 0
|
|
114
|
+
},
|
|
115
|
+
timeoutMs: meta.timeoutMs ?? null,
|
|
116
|
+
concurrencyKeyTemplate: typeof concurrencyKeyTemplate === "string" ? concurrencyKeyTemplate : null,
|
|
117
|
+
collisionMode: meta.concurrency?.collisionMode ?? "queue",
|
|
118
|
+
dedupeKeyTemplate: typeof dedupeKeyTemplate === "string" ? dedupeKeyTemplate : null,
|
|
119
|
+
dedupeWindowMs,
|
|
120
|
+
priorityDefault: 0,
|
|
121
|
+
replayFrom: meta.replayFrom ?? "last_checkpoint",
|
|
122
|
+
createdAt: now,
|
|
123
|
+
updatedAt: now
|
|
124
|
+
};
|
|
125
|
+
this.store.jobs.set(type, def);
|
|
126
|
+
this.handlerRegistry.set(type, {
|
|
127
|
+
type,
|
|
128
|
+
meta,
|
|
129
|
+
handlerClass
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
/** Test helper — look up a registered handler without exposing the map. */
|
|
133
|
+
getHandlerRegistration(type) {
|
|
134
|
+
return this.handlerRegistry.get(type);
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Boot-time upsert per `IJobOrchestrator.upsertJobRows`. Memory backend
|
|
138
|
+
* just funnels each entry through `registerHandler`. The validator is
|
|
139
|
+
* skipped entirely in memory mode (Q4 resolution 2026-04-19), so the
|
|
140
|
+
* orphaned list is always empty — there are no DB rows to compare against.
|
|
141
|
+
*/
|
|
142
|
+
async upsertJobRows(entries, poolConfig) {
|
|
143
|
+
void poolConfig;
|
|
144
|
+
for (const entry of entries) {
|
|
145
|
+
this.registerHandler(
|
|
146
|
+
entry.type,
|
|
147
|
+
entry.meta,
|
|
148
|
+
entry.handlerClass
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
return { orphaned: [] };
|
|
152
|
+
}
|
|
153
|
+
// ==========================================================================
|
|
154
|
+
// start
|
|
155
|
+
// ==========================================================================
|
|
156
|
+
async start(type, input, opts = {}, _tx) {
|
|
157
|
+
const tenantId = this.resolveTenantId("start", opts.tenantId);
|
|
158
|
+
return this.mutex.run(async () => {
|
|
159
|
+
const payload = input ?? {};
|
|
160
|
+
const definition = this.store.jobs.get(type);
|
|
161
|
+
if (!definition) throw new JobTypeNotFoundError(type);
|
|
162
|
+
if (definition.dedupeKeyTemplate && definition.dedupeWindowMs) {
|
|
163
|
+
const dedupeKey2 = evaluateKeyTemplate(
|
|
164
|
+
definition.dedupeKeyTemplate,
|
|
165
|
+
payload
|
|
166
|
+
);
|
|
167
|
+
const windowStart = Date.now() - definition.dedupeWindowMs;
|
|
168
|
+
const existing = this.findDedupeCandidate(type, dedupeKey2, windowStart);
|
|
169
|
+
if (existing) return existing;
|
|
170
|
+
}
|
|
171
|
+
let concurrencyKey = null;
|
|
172
|
+
let queueBlockedBy = null;
|
|
173
|
+
if (definition.concurrencyKeyTemplate) {
|
|
174
|
+
concurrencyKey = evaluateKeyTemplate(
|
|
175
|
+
definition.concurrencyKeyTemplate,
|
|
176
|
+
payload
|
|
177
|
+
);
|
|
178
|
+
const incumbent = this.findInFlightByConcurrencyKey(concurrencyKey);
|
|
179
|
+
if (incumbent) {
|
|
180
|
+
switch (definition.collisionMode) {
|
|
181
|
+
case "reject":
|
|
182
|
+
throw new JobCollisionError(type, concurrencyKey, incumbent);
|
|
183
|
+
case "replace":
|
|
184
|
+
this.cancelLocked(
|
|
185
|
+
incumbent.id,
|
|
186
|
+
{ cascade: true, reason: "replaced" },
|
|
187
|
+
incumbent.tenantId
|
|
188
|
+
);
|
|
189
|
+
break;
|
|
190
|
+
case "queue":
|
|
191
|
+
queueBlockedBy = incumbent.id;
|
|
192
|
+
break;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
const newId = randomUUID();
|
|
197
|
+
let rootRunId = newId;
|
|
198
|
+
if (opts.parentRunId) {
|
|
199
|
+
const parent = this.store.runs.get(opts.parentRunId);
|
|
200
|
+
if (!parent) {
|
|
201
|
+
throw new Error(
|
|
202
|
+
`parentRunId ${opts.parentRunId} does not reference an existing job_run`
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
rootRunId = parent.rootRunId;
|
|
206
|
+
}
|
|
207
|
+
const dedupeKey = definition.dedupeKeyTemplate ? evaluateKeyTemplate(definition.dedupeKeyTemplate, payload) : null;
|
|
208
|
+
const now = /* @__PURE__ */ new Date();
|
|
209
|
+
const runAt = queueBlockedBy ? QUEUED_RUN_AT : opts.runAt ?? now;
|
|
210
|
+
const row = {
|
|
211
|
+
id: newId,
|
|
212
|
+
jobType: type,
|
|
213
|
+
jobVersion: definition.version,
|
|
214
|
+
parentRunId: opts.parentRunId ?? null,
|
|
215
|
+
rootRunId,
|
|
216
|
+
parentClosePolicy: opts.parentClosePolicy ?? "terminate",
|
|
217
|
+
scopeEntityType: opts.scope?.entityType ?? null,
|
|
218
|
+
scopeEntityId: opts.scope?.entityId ?? null,
|
|
219
|
+
tenantId,
|
|
220
|
+
tags: opts.tags ?? {},
|
|
221
|
+
pool: opts.pool ?? definition.pool,
|
|
222
|
+
priority: opts.priority ?? definition.priorityDefault,
|
|
223
|
+
concurrencyKey,
|
|
224
|
+
dedupeKey,
|
|
225
|
+
status: "pending",
|
|
226
|
+
input: payload,
|
|
227
|
+
output: null,
|
|
228
|
+
error: null,
|
|
229
|
+
triggerSource: opts.triggerSource ?? "manual",
|
|
230
|
+
triggerRef: opts.triggerRef ?? null,
|
|
231
|
+
runAt,
|
|
232
|
+
startedAt: null,
|
|
233
|
+
finishedAt: null,
|
|
234
|
+
claimedAt: null,
|
|
235
|
+
attempts: 0,
|
|
236
|
+
waitKind: null,
|
|
237
|
+
resumeToken: null,
|
|
238
|
+
waitDeadline: null,
|
|
239
|
+
createdAt: now,
|
|
240
|
+
updatedAt: now
|
|
241
|
+
};
|
|
242
|
+
this.store.runs.set(newId, row);
|
|
243
|
+
if (queueBlockedBy) {
|
|
244
|
+
const list = this.queueBlockers.get(queueBlockedBy) ?? [];
|
|
245
|
+
list.push(newId);
|
|
246
|
+
this.queueBlockers.set(queueBlockedBy, list);
|
|
247
|
+
}
|
|
248
|
+
return row;
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
// ==========================================================================
|
|
252
|
+
// cancel
|
|
253
|
+
// ==========================================================================
|
|
254
|
+
async cancel(runId, opts = {}) {
|
|
255
|
+
const tenantId = this.resolveTenantId("cancel", opts.tenantId);
|
|
256
|
+
await this.mutex.run(async () => {
|
|
257
|
+
this.cancelLocked(runId, opts, tenantId);
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Internal cancel that assumes the caller already holds the mutex.
|
|
262
|
+
* Synchronous because all store ops are in-memory. Idempotent.
|
|
263
|
+
*
|
|
264
|
+
* `tenantForGate` is the already-validated tenant id (or `null`). When
|
|
265
|
+
* non-null it gates the initial cancellation to that tenant's run; the
|
|
266
|
+
* cascade step then sweeps descendants on the same `rootRunId` without
|
|
267
|
+
* re-checking — children of a tenant-gated parent always share the
|
|
268
|
+
* tenant (enforced at `start` time).
|
|
269
|
+
*/
|
|
270
|
+
cancelLocked(runId, opts, tenantForGate) {
|
|
271
|
+
const run = this.store.runs.get(runId);
|
|
272
|
+
if (!run) return;
|
|
273
|
+
if (this.multiTenant && run.tenantId !== tenantForGate) return;
|
|
274
|
+
if (isTerminal(run.status)) return;
|
|
275
|
+
const now = /* @__PURE__ */ new Date();
|
|
276
|
+
const descendants = opts.cascade === false ? [] : Array.from(this.store.runs.values()).filter(
|
|
277
|
+
(r) => r.rootRunId === run.rootRunId && r.id !== runId && !isTerminal(r.status)
|
|
278
|
+
);
|
|
279
|
+
const terminateChildren = descendants.filter(
|
|
280
|
+
(d) => d.parentClosePolicy === "terminate" /* Terminate */
|
|
281
|
+
);
|
|
282
|
+
const cancelChildren = descendants.filter(
|
|
283
|
+
(d) => d.parentClosePolicy === "cancel" /* Cancel */
|
|
284
|
+
);
|
|
285
|
+
for (const child of terminateChildren) {
|
|
286
|
+
this.transitionToCanceled(child.id, now);
|
|
287
|
+
}
|
|
288
|
+
for (const child of cancelChildren) {
|
|
289
|
+
this.transitionToCanceled(child.id, now);
|
|
290
|
+
}
|
|
291
|
+
this.transitionToCanceled(runId, now);
|
|
292
|
+
void opts.reason;
|
|
293
|
+
}
|
|
294
|
+
transitionToCanceled(runId, at) {
|
|
295
|
+
const run = this.store.runs.get(runId);
|
|
296
|
+
if (!run) return;
|
|
297
|
+
if (isTerminal(run.status)) return;
|
|
298
|
+
const next = {
|
|
299
|
+
...run,
|
|
300
|
+
status: "canceled",
|
|
301
|
+
finishedAt: at,
|
|
302
|
+
updatedAt: at
|
|
303
|
+
};
|
|
304
|
+
this.store.runs.set(runId, next);
|
|
305
|
+
this.unblockQueuedDependents(runId);
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* When `runId` transitions to a terminal state, advance every dependent
|
|
309
|
+
* `queue`-blocked run's `run_at` back to `now()` so `claimNext` picks
|
|
310
|
+
* them up.
|
|
311
|
+
*/
|
|
312
|
+
unblockQueuedDependents(runId) {
|
|
313
|
+
const dependents = this.queueBlockers.get(runId);
|
|
314
|
+
if (!dependents || dependents.length === 0) return;
|
|
315
|
+
const now = /* @__PURE__ */ new Date();
|
|
316
|
+
for (const dep of dependents) {
|
|
317
|
+
const depRun = this.store.runs.get(dep);
|
|
318
|
+
if (!depRun) continue;
|
|
319
|
+
if (depRun.status !== "pending") continue;
|
|
320
|
+
this.store.runs.set(dep, { ...depRun, runAt: now, updatedAt: now });
|
|
321
|
+
}
|
|
322
|
+
this.queueBlockers.delete(runId);
|
|
323
|
+
}
|
|
324
|
+
// ==========================================================================
|
|
325
|
+
// claimNext — consumed by JobWorker in memory mode (tests exercise directly)
|
|
326
|
+
// ==========================================================================
|
|
327
|
+
async claimNext(pool) {
|
|
328
|
+
return this.mutex.run(async () => {
|
|
329
|
+
const now = Date.now();
|
|
330
|
+
const candidates = Array.from(this.store.runs.values()).filter(
|
|
331
|
+
(r) => r.status === "pending" && r.pool === pool && r.runAt.getTime() <= now
|
|
332
|
+
);
|
|
333
|
+
if (candidates.length === 0) return null;
|
|
334
|
+
candidates.sort((a, b) => {
|
|
335
|
+
if (a.priority !== b.priority) return b.priority - a.priority;
|
|
336
|
+
return a.runAt.getTime() - b.runAt.getTime();
|
|
337
|
+
});
|
|
338
|
+
const winner = candidates[0];
|
|
339
|
+
const claimedAt = /* @__PURE__ */ new Date();
|
|
340
|
+
const next = {
|
|
341
|
+
...winner,
|
|
342
|
+
status: "running",
|
|
343
|
+
claimedAt,
|
|
344
|
+
startedAt: claimedAt,
|
|
345
|
+
updatedAt: claimedAt
|
|
346
|
+
};
|
|
347
|
+
this.store.runs.set(winner.id, next);
|
|
348
|
+
return next;
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
// ==========================================================================
|
|
352
|
+
// replay
|
|
353
|
+
// ==========================================================================
|
|
354
|
+
async replay(runId) {
|
|
355
|
+
return this.mutex.run(async () => {
|
|
356
|
+
const run = this.store.runs.get(runId);
|
|
357
|
+
if (!run) throw new Error(`replay: run ${runId} not found`);
|
|
358
|
+
if (!isTerminal(run.status)) {
|
|
359
|
+
throw new JobNotReplayableError(runId, run.status);
|
|
360
|
+
}
|
|
361
|
+
const def = this.store.jobs.get(run.jobType);
|
|
362
|
+
if (!def) throw new JobTypeNotFoundError(run.jobType);
|
|
363
|
+
const mode = def.replayFrom;
|
|
364
|
+
if (mode === "scratch") {
|
|
365
|
+
this.stepService.clearStepsForRun(runId);
|
|
366
|
+
} else {
|
|
367
|
+
this.stepService.clearIncompleteSteps(runId);
|
|
368
|
+
}
|
|
369
|
+
const now = /* @__PURE__ */ new Date();
|
|
370
|
+
const next = {
|
|
371
|
+
...run,
|
|
372
|
+
status: "pending",
|
|
373
|
+
attempts: 0,
|
|
374
|
+
runAt: now,
|
|
375
|
+
startedAt: null,
|
|
376
|
+
finishedAt: null,
|
|
377
|
+
claimedAt: null,
|
|
378
|
+
error: null,
|
|
379
|
+
output: null,
|
|
380
|
+
updatedAt: now
|
|
381
|
+
};
|
|
382
|
+
this.store.runs.set(runId, next);
|
|
383
|
+
return next;
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
// ==========================================================================
|
|
387
|
+
// tick — used by unit tests + memory-mode JobWorker
|
|
388
|
+
// ==========================================================================
|
|
389
|
+
/**
|
|
390
|
+
* Execute a single claimed run to completion, retry, or failure. Not on
|
|
391
|
+
* `IJobOrchestrator` — it's the memory equivalent of the Drizzle
|
|
392
|
+
* `JobWorker.processRun` code path. The unit tests drive it directly so
|
|
393
|
+
* they can assert memoization across ticks without spinning up a worker.
|
|
394
|
+
*/
|
|
395
|
+
async tick(runId) {
|
|
396
|
+
const run = this.store.runs.get(runId);
|
|
397
|
+
if (!run) throw new Error(`tick: run ${runId} not found`);
|
|
398
|
+
if (run.status !== "running") {
|
|
399
|
+
throw new Error(
|
|
400
|
+
`tick: run ${runId} must be 'running' (got '${run.status}')`
|
|
401
|
+
);
|
|
402
|
+
}
|
|
403
|
+
const registration = this.handlerRegistry.get(run.jobType);
|
|
404
|
+
if (!registration) {
|
|
405
|
+
await this.markFailed(run, new Error(
|
|
406
|
+
`No handler registered for jobType='${run.jobType}'`
|
|
407
|
+
), (run.attempts ?? 0) + 1);
|
|
408
|
+
return;
|
|
409
|
+
}
|
|
410
|
+
const meta = registration.meta;
|
|
411
|
+
const HandlerClass = registration.handlerClass;
|
|
412
|
+
const handler = this.moduleRef ? this.moduleRef.get(
|
|
413
|
+
HandlerClass,
|
|
414
|
+
{ strict: false }
|
|
415
|
+
) : new HandlerClass();
|
|
416
|
+
const ctx = {
|
|
417
|
+
input: run.input,
|
|
418
|
+
run,
|
|
419
|
+
step: this.makeStepFn(run),
|
|
420
|
+
spawnChild: this.makeSpawnFn(run),
|
|
421
|
+
logger: new Logger(`JobRun:${run.id}`)
|
|
422
|
+
};
|
|
423
|
+
const attemptsBefore = run.attempts ?? 0;
|
|
424
|
+
try {
|
|
425
|
+
const output = await handler.run(ctx);
|
|
426
|
+
await this.markCompleted(run, output ?? {}, attemptsBefore + 1);
|
|
427
|
+
} catch (err) {
|
|
428
|
+
const policy = meta.retry;
|
|
429
|
+
const decision = classifyError(err, policy, attemptsBefore);
|
|
430
|
+
const nextAttempts = attemptsBefore + 1;
|
|
431
|
+
if (decision === "retry" && policy) {
|
|
432
|
+
const delay = computeBackoff(policy, nextAttempts);
|
|
433
|
+
await this.rescheduleForRetry(run, err, nextAttempts, delay);
|
|
434
|
+
} else {
|
|
435
|
+
await this.markFailed(run, err, nextAttempts);
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
makeStepFn(run) {
|
|
440
|
+
return async (stepId, fn, _opts) => {
|
|
441
|
+
void _opts;
|
|
442
|
+
const existing = await this.stepService.findStep(run.id, stepId);
|
|
443
|
+
if (existing?.status === "completed") {
|
|
444
|
+
return existing.output;
|
|
445
|
+
}
|
|
446
|
+
const seq = this.nextStepSeq(run.id);
|
|
447
|
+
const startedAt = /* @__PURE__ */ new Date();
|
|
448
|
+
const nextAttempts = (existing?.attempts ?? 0) + 1;
|
|
449
|
+
await this.stepService.recordStep({
|
|
450
|
+
jobRunId: run.id,
|
|
451
|
+
stepId,
|
|
452
|
+
kind: "task",
|
|
453
|
+
seq,
|
|
454
|
+
status: "running",
|
|
455
|
+
startedAt,
|
|
456
|
+
attempts: nextAttempts
|
|
457
|
+
});
|
|
458
|
+
try {
|
|
459
|
+
const output = await fn();
|
|
460
|
+
await this.stepService.recordStep({
|
|
461
|
+
jobRunId: run.id,
|
|
462
|
+
stepId,
|
|
463
|
+
kind: "task",
|
|
464
|
+
seq,
|
|
465
|
+
status: "completed",
|
|
466
|
+
output,
|
|
467
|
+
finishedAt: /* @__PURE__ */ new Date(),
|
|
468
|
+
attempts: nextAttempts
|
|
469
|
+
});
|
|
470
|
+
return output;
|
|
471
|
+
} catch (err) {
|
|
472
|
+
await this.stepService.recordStep({
|
|
473
|
+
jobRunId: run.id,
|
|
474
|
+
stepId,
|
|
475
|
+
kind: "task",
|
|
476
|
+
seq,
|
|
477
|
+
status: "failed",
|
|
478
|
+
error: serialiseError(err, nextAttempts, false),
|
|
479
|
+
finishedAt: /* @__PURE__ */ new Date(),
|
|
480
|
+
attempts: nextAttempts
|
|
481
|
+
});
|
|
482
|
+
throw err;
|
|
483
|
+
}
|
|
484
|
+
};
|
|
485
|
+
}
|
|
486
|
+
makeSpawnFn(run) {
|
|
487
|
+
return async (type, input, opts) => {
|
|
488
|
+
return this.start(type, input, {
|
|
489
|
+
parentRunId: run.id,
|
|
490
|
+
parentClosePolicy: opts?.closePolicy,
|
|
491
|
+
runAt: opts?.runAt,
|
|
492
|
+
priority: opts?.priority,
|
|
493
|
+
tags: opts?.tags,
|
|
494
|
+
triggerSource: "parent",
|
|
495
|
+
triggerRef: run.id
|
|
496
|
+
});
|
|
497
|
+
};
|
|
498
|
+
}
|
|
499
|
+
nextStepSeq(runId) {
|
|
500
|
+
const rows = this.store.steps.get(runId);
|
|
501
|
+
if (!rows || rows.length === 0) return 1;
|
|
502
|
+
let max = 0;
|
|
503
|
+
for (const r of rows) if (r.seq > max) max = r.seq;
|
|
504
|
+
return max + 1;
|
|
505
|
+
}
|
|
506
|
+
async markCompleted(run, output, attempts) {
|
|
507
|
+
await this.mutex.run(async () => {
|
|
508
|
+
const current = this.store.runs.get(run.id);
|
|
509
|
+
if (!current || isTerminal(current.status)) return;
|
|
510
|
+
const now = /* @__PURE__ */ new Date();
|
|
511
|
+
this.store.runs.set(run.id, {
|
|
512
|
+
...current,
|
|
513
|
+
status: "completed",
|
|
514
|
+
output,
|
|
515
|
+
finishedAt: now,
|
|
516
|
+
updatedAt: now,
|
|
517
|
+
attempts
|
|
518
|
+
});
|
|
519
|
+
this.unblockQueuedDependents(run.id);
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
async markFailed(run, err, attempts) {
|
|
523
|
+
await this.mutex.run(async () => {
|
|
524
|
+
const current = this.store.runs.get(run.id);
|
|
525
|
+
if (!current || isTerminal(current.status)) return;
|
|
526
|
+
const now = /* @__PURE__ */ new Date();
|
|
527
|
+
this.store.runs.set(run.id, {
|
|
528
|
+
...current,
|
|
529
|
+
status: "failed",
|
|
530
|
+
finishedAt: now,
|
|
531
|
+
updatedAt: now,
|
|
532
|
+
attempts,
|
|
533
|
+
error: serialiseError(err, attempts, false)
|
|
534
|
+
});
|
|
535
|
+
this.unblockQueuedDependents(run.id);
|
|
536
|
+
});
|
|
537
|
+
if (run.parentClosePolicy === "terminate") {
|
|
538
|
+
try {
|
|
539
|
+
await this.cancel(run.id, {
|
|
540
|
+
cascade: true,
|
|
541
|
+
reason: "parent-failed",
|
|
542
|
+
tenantId: run.tenantId
|
|
543
|
+
});
|
|
544
|
+
} catch (cascadeErr) {
|
|
545
|
+
this.logger.warn(
|
|
546
|
+
`cascade on failed run ${run.id}: ${cascadeErr.message}`
|
|
547
|
+
);
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
async rescheduleForRetry(run, err, attempts, delayMs) {
|
|
552
|
+
await this.mutex.run(async () => {
|
|
553
|
+
const current = this.store.runs.get(run.id);
|
|
554
|
+
if (!current || isTerminal(current.status)) return;
|
|
555
|
+
const now = /* @__PURE__ */ new Date();
|
|
556
|
+
this.store.runs.set(run.id, {
|
|
557
|
+
...current,
|
|
558
|
+
status: "pending",
|
|
559
|
+
attempts,
|
|
560
|
+
runAt: new Date(Date.now() + delayMs),
|
|
561
|
+
startedAt: null,
|
|
562
|
+
claimedAt: null,
|
|
563
|
+
updatedAt: now,
|
|
564
|
+
error: serialiseError(err, attempts, true)
|
|
565
|
+
});
|
|
566
|
+
});
|
|
567
|
+
}
|
|
568
|
+
// ==========================================================================
|
|
569
|
+
// Internal queries — used by start / cancel
|
|
570
|
+
// ==========================================================================
|
|
571
|
+
findDedupeCandidate(jobType, dedupeKey, windowStartMs) {
|
|
572
|
+
let best = null;
|
|
573
|
+
for (const r of this.store.runs.values()) {
|
|
574
|
+
if (r.jobType !== jobType) continue;
|
|
575
|
+
if (r.dedupeKey !== dedupeKey) continue;
|
|
576
|
+
if (DEDUPE_EXCLUDED_STATUSES.includes(r.status)) continue;
|
|
577
|
+
if (r.createdAt.getTime() <= windowStartMs) continue;
|
|
578
|
+
if (!best || r.createdAt.getTime() > best.createdAt.getTime()) {
|
|
579
|
+
best = r;
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
return best;
|
|
583
|
+
}
|
|
584
|
+
findInFlightByConcurrencyKey(key) {
|
|
585
|
+
for (const r of this.store.runs.values()) {
|
|
586
|
+
if (r.concurrencyKey !== key) continue;
|
|
587
|
+
if (!IN_FLIGHT_STATUSES.includes(r.status)) continue;
|
|
588
|
+
return r;
|
|
589
|
+
}
|
|
590
|
+
return null;
|
|
591
|
+
}
|
|
592
|
+
};
|
|
593
|
+
MemoryJobOrchestrator = __decorateClass([
|
|
594
|
+
Injectable(),
|
|
595
|
+
__decorateParam(0, Inject(MemoryJobStore)),
|
|
596
|
+
__decorateParam(1, Inject(MemoryJobStepService)),
|
|
597
|
+
__decorateParam(2, Inject(JOBS_MULTI_TENANT)),
|
|
598
|
+
__decorateParam(3, Optional()),
|
|
599
|
+
__decorateParam(3, Inject(ModuleRef))
|
|
600
|
+
], MemoryJobOrchestrator);
|
|
601
|
+
function classifyError(err, policy, currentAttempts) {
|
|
602
|
+
if (!policy) return "fail";
|
|
603
|
+
const errObj = err;
|
|
604
|
+
const name = errObj?.name;
|
|
605
|
+
const code = errObj?.code;
|
|
606
|
+
const nonRetryable = policy.nonRetryableErrors ?? [];
|
|
607
|
+
if (nonRetryable.some((n) => n === name || n === code)) return "fail";
|
|
608
|
+
if (currentAttempts + 1 >= policy.attempts) return "fail";
|
|
609
|
+
return "retry";
|
|
610
|
+
}
|
|
611
|
+
function computeBackoff(policy, attempts) {
|
|
612
|
+
const base = Math.max(policy.baseMs, 0);
|
|
613
|
+
if (policy.backoff === "fixed") return base;
|
|
614
|
+
const exponent = Math.max(attempts - 1, 0);
|
|
615
|
+
if (exponent >= 53) return Number.MAX_SAFE_INTEGER;
|
|
616
|
+
const raw = base * Math.pow(2, exponent);
|
|
617
|
+
if (!Number.isFinite(raw) || raw >= Number.MAX_SAFE_INTEGER) {
|
|
618
|
+
return Number.MAX_SAFE_INTEGER;
|
|
619
|
+
}
|
|
620
|
+
return raw;
|
|
621
|
+
}
|
|
622
|
+
function serialiseError(err, attempt, retryable) {
|
|
623
|
+
const e = err;
|
|
624
|
+
return {
|
|
625
|
+
message: e?.message ?? String(err),
|
|
626
|
+
stack: e?.stack,
|
|
627
|
+
retryable,
|
|
628
|
+
attempt
|
|
629
|
+
};
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
export {
|
|
633
|
+
MemoryJobOrchestrator
|
|
634
|
+
};
|
|
635
|
+
//# sourceMappingURL=chunk-4RFHUZXU.js.map
|