@pattern-stack/codegen 0.15.0 → 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 +111 -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/{job-orchestrator.protocol-CARhMLCO.d.ts → job-orchestrator.protocol-DubMVbm9.d.ts} +1 -1
- 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.d.ts +2 -2
- 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.d.ts +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.d.ts +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.d.ts +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.d.ts +2 -2
- 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.protocol.d.ts +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.d.ts +2 -2
- 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.d.ts +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.d.ts +2 -2
- 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.d.ts +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/event-registry.d.ts +77 -0
- package/dist/runtime/subsystems/events/event-registry.js +1 -0
- package/dist/runtime/subsystems/events/event-registry.js.map +1 -0
- 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.d.ts +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.d.ts +2 -2
- 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.d.ts +2 -2
- 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.d.ts +2 -2
- 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.d.ts +2 -2
- 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.d.ts +2 -2
- 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.d.ts +2 -2
- 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-orchestrator.protocol.d.ts +2 -2
- package/dist/runtime/subsystems/jobs/job-run-keyset-cursor.d.ts +2 -2
- 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.d.ts +2 -2
- 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.d.ts +2 -2
- 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-run-service.protocol.d.ts +2 -2
- 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.d.ts +2 -2
- 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.d.ts +2 -2
- 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.d.ts +2 -2
- 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.d.ts +2 -2
- 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.d.ts +2 -2
- 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.protocol.d.ts +2 -2
- package/dist/runtime/subsystems/observability/observability.service.d.ts +2 -2
- 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.d.ts +2 -2
- 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.d.ts +2 -2
- 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 +653 -5444
- 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-delivery-handler.ts +1 -1
- package/runtime/subsystems/bridge/bridge-outbox-drain-hook.ts +45 -22
- package/runtime/subsystems/bridge/bridge.protocol.ts +1 -1
- package/runtime/subsystems/bridge/event-flow.service.ts +1 -1
- package/runtime/subsystems/events/event-registry.ts +77 -0
- package/runtime/subsystems/events/index.ts +12 -0
- package/runtime/subsystems/jobs/job-handler.base.ts +1 -1
- package/runtime/subsystems/jobs/job-worker.ts +17 -11
|
@@ -1,704 +1,17 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __decorateClass = (decorators, target, key, kind) => {
|
|
4
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
5
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6
|
-
if (decorator = decorators[i])
|
|
7
|
-
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8
|
-
if (kind && result) __defProp(target, key, result);
|
|
9
|
-
return result;
|
|
10
|
-
};
|
|
11
|
-
var __decorateParam = (index2, decorator) => (target, key) => decorator(target, key, index2);
|
|
12
|
-
|
|
13
|
-
// runtime/subsystems/integration/integration.module.ts
|
|
14
|
-
import { Module } from "@nestjs/common";
|
|
15
|
-
|
|
16
|
-
// runtime/subsystems/integration/integration.tokens.ts
|
|
17
|
-
var INTEGRATION_CURSOR_STORE = "INTEGRATION_CURSOR_STORE";
|
|
18
|
-
var INTEGRATION_FIELD_DIFFER = "INTEGRATION_FIELD_DIFFER";
|
|
19
|
-
var INTEGRATION_RUN_RECORDER = "INTEGRATION_RUN_RECORDER";
|
|
20
|
-
var INTEGRATION_MODULE_OPTIONS = "INTEGRATION_MODULE_OPTIONS";
|
|
21
|
-
var INTEGRATION_MULTI_TENANT = "INTEGRATION_MULTI_TENANT";
|
|
22
|
-
|
|
23
|
-
// runtime/subsystems/integration/integration-cursor-store.memory-backend.ts
|
|
24
|
-
import { Injectable } from "@nestjs/common";
|
|
25
|
-
var MemoryCursorStore = class {
|
|
26
|
-
/**
|
|
27
|
-
* Subscription-id → last persisted cursor. Public so tests can inspect
|
|
28
|
-
* or pre-seed state; production callers MUST go through `get`/`put`.
|
|
29
|
-
*/
|
|
30
|
-
cursors = /* @__PURE__ */ new Map();
|
|
31
|
-
/**
|
|
32
|
-
* Seedable subscription metadata for `listAll` — the memory backend
|
|
33
|
-
* stores only `subscriptionId → cursor` in its write path, so the
|
|
34
|
-
* snapshot shape (`connectionId`, `adapter`, `domain`, `externalRef`,
|
|
35
|
-
* timestamps) has no natural source without test seeding. Tests populate
|
|
36
|
-
* this map; unseeded entries get empty-string metadata and `new Date(0)`
|
|
37
|
-
* timestamps so the shape stays stable. Production paths go through the
|
|
38
|
-
* Drizzle backend.
|
|
39
|
-
*/
|
|
40
|
-
subscriptions = /* @__PURE__ */ new Map();
|
|
41
|
-
async get(subscriptionId, _tenantId) {
|
|
42
|
-
const value = this.cursors.get(subscriptionId);
|
|
43
|
-
return value === void 0 ? null : value;
|
|
44
|
-
}
|
|
45
|
-
async put(subscriptionId, cursor, _tenantId) {
|
|
46
|
-
this.cursors.set(subscriptionId, cursor);
|
|
47
|
-
}
|
|
48
|
-
async listAll(_tenantId) {
|
|
49
|
-
const snapshots = [];
|
|
50
|
-
for (const [subscriptionId, cursor] of this.cursors.entries()) {
|
|
51
|
-
const meta = this.subscriptions.get(subscriptionId);
|
|
52
|
-
snapshots.push({
|
|
53
|
-
subscriptionId,
|
|
54
|
-
connectionId: meta?.connectionId ?? "",
|
|
55
|
-
adapter: meta?.adapter ?? "",
|
|
56
|
-
domain: meta?.domain ?? "",
|
|
57
|
-
externalRef: meta?.externalRef ?? null,
|
|
58
|
-
cursor: cursor ?? null,
|
|
59
|
-
lastIntegrationAt: meta?.lastIntegrationAt ?? null,
|
|
60
|
-
updatedAt: meta?.updatedAt ?? /* @__PURE__ */ new Date(0),
|
|
61
|
-
tenantId: null
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
return snapshots.sort(
|
|
65
|
-
(a, b) => b.updatedAt.getTime() - a.updatedAt.getTime()
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
/** Reset state. Tests call this in `beforeEach`. */
|
|
69
|
-
clear() {
|
|
70
|
-
this.cursors.clear();
|
|
71
|
-
this.subscriptions.clear();
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
MemoryCursorStore = __decorateClass([
|
|
75
|
-
Injectable()
|
|
76
|
-
], MemoryCursorStore);
|
|
77
|
-
|
|
78
|
-
// runtime/subsystems/integration/integration-run-recorder.memory-backend.ts
|
|
79
|
-
import { Injectable as Injectable2 } from "@nestjs/common";
|
|
80
|
-
|
|
81
|
-
// runtime/subsystems/integration/integration-field-diff.protocol.ts
|
|
82
|
-
import { z } from "zod";
|
|
83
|
-
var FieldDiffValueSchema = z.object({
|
|
84
|
-
from: z.unknown(),
|
|
85
|
-
to: z.unknown()
|
|
86
|
-
});
|
|
87
|
-
var FieldDiffSchema = z.record(z.string(), FieldDiffValueSchema);
|
|
88
|
-
|
|
89
|
-
// runtime/subsystems/integration/integration-run-recorder.memory-backend.ts
|
|
90
|
-
var MemoryRunRecorder = class {
|
|
91
|
-
/**
|
|
92
|
-
* All started runs keyed by id. Public so tests can inspect lifecycle
|
|
93
|
-
* transitions without poking through recording methods.
|
|
94
|
-
*/
|
|
95
|
-
runs = /* @__PURE__ */ new Map();
|
|
96
|
-
/**
|
|
97
|
-
* Items keyed by `integration_run_id`, array order matches insertion order —
|
|
98
|
-
* mirrors the timeline the `(integration_run_id, created_at)` index produces
|
|
99
|
-
* in Postgres.
|
|
100
|
-
*/
|
|
101
|
-
items = /* @__PURE__ */ new Map();
|
|
102
|
-
/**
|
|
103
|
-
* Seedable subscription metadata — tests populate this to make
|
|
104
|
-
* `listRecent` return meaningful `connectionId` values. The memory
|
|
105
|
-
* backend doesn't track subscriptions on its own (only runs + items), so
|
|
106
|
-
* this map is the intentional extension point: tests write entries for
|
|
107
|
-
* the subscription ids they use, production code never touches it.
|
|
108
|
-
*/
|
|
109
|
-
subscriptions = /* @__PURE__ */ new Map();
|
|
110
|
-
async startRun(input) {
|
|
111
|
-
const id = crypto.randomUUID();
|
|
112
|
-
this.runs.set(id, {
|
|
113
|
-
id,
|
|
114
|
-
subscriptionId: input.subscriptionId,
|
|
115
|
-
direction: input.direction,
|
|
116
|
-
action: input.action,
|
|
117
|
-
status: "running",
|
|
118
|
-
cursorBefore: input.cursorBefore ?? null,
|
|
119
|
-
cursorAfter: null,
|
|
120
|
-
recordsFound: 0,
|
|
121
|
-
recordsProcessed: 0,
|
|
122
|
-
durationMs: null,
|
|
123
|
-
error: null,
|
|
124
|
-
tenantId: input.tenantId ?? null,
|
|
125
|
-
startedAt: /* @__PURE__ */ new Date(),
|
|
126
|
-
completedAt: null
|
|
127
|
-
});
|
|
128
|
-
this.items.set(id, []);
|
|
129
|
-
return { id };
|
|
130
|
-
}
|
|
131
|
-
async recordItem(input) {
|
|
132
|
-
FieldDiffSchema.parse(input.changedFields);
|
|
133
|
-
const bucket = this.items.get(input.integrationRunId);
|
|
134
|
-
if (!bucket) {
|
|
135
|
-
throw new Error(
|
|
136
|
-
`MemoryRunRecorder.recordItem: no run started for id '${input.integrationRunId}'. Call startRun(...) first.`
|
|
137
|
-
);
|
|
138
|
-
}
|
|
139
|
-
bucket.push(input);
|
|
140
|
-
}
|
|
141
|
-
async completeRun(runId, input) {
|
|
142
|
-
const run = this.runs.get(runId);
|
|
143
|
-
if (!run) {
|
|
144
|
-
throw new Error(
|
|
145
|
-
`MemoryRunRecorder.completeRun: no run started for id '${runId}'.`
|
|
146
|
-
);
|
|
147
|
-
}
|
|
148
|
-
run.status = input.status;
|
|
149
|
-
run.recordsFound = input.recordsFound;
|
|
150
|
-
run.recordsProcessed = input.recordsProcessed;
|
|
151
|
-
run.cursorAfter = input.cursorAfter ?? null;
|
|
152
|
-
run.durationMs = input.durationMs;
|
|
153
|
-
run.error = input.error ?? null;
|
|
154
|
-
run.completedAt = /* @__PURE__ */ new Date();
|
|
155
|
-
}
|
|
156
|
-
async listRecent(limit, subscriptionId, _tenantId) {
|
|
157
|
-
const all = Array.from(this.runs.values());
|
|
158
|
-
const filtered = subscriptionId === void 0 ? all : all.filter((r) => r.subscriptionId === subscriptionId);
|
|
159
|
-
return filtered.sort((a, b) => b.startedAt.getTime() - a.startedAt.getTime()).slice(0, limit).map((r) => ({
|
|
160
|
-
id: r.id,
|
|
161
|
-
subscriptionId: r.subscriptionId,
|
|
162
|
-
// connectionId is only knowable if the test seeded subscriptions
|
|
163
|
-
// metadata; empty string otherwise. The Drizzle backend resolves
|
|
164
|
-
// it via JOIN, which is the production path.
|
|
165
|
-
connectionId: this.subscriptions.get(r.subscriptionId)?.connectionId ?? "",
|
|
166
|
-
status: r.status,
|
|
167
|
-
startedAt: r.startedAt,
|
|
168
|
-
completedAt: r.completedAt,
|
|
169
|
-
recordsProcessed: r.recordsProcessed,
|
|
170
|
-
tenantId: r.tenantId
|
|
171
|
-
}));
|
|
172
|
-
}
|
|
173
|
-
/** Reset state. Tests call this in `beforeEach`. */
|
|
174
|
-
clear() {
|
|
175
|
-
this.runs.clear();
|
|
176
|
-
this.items.clear();
|
|
177
|
-
this.subscriptions.clear();
|
|
178
|
-
}
|
|
179
|
-
// ─── test ergonomics ─────────────────────────────────────────────────
|
|
180
|
-
/** All runs for a subscription, newest first. Timeline reads. */
|
|
181
|
-
getRunsForSubscription(subscriptionId) {
|
|
182
|
-
return Array.from(this.runs.values()).filter((r) => r.subscriptionId === subscriptionId).sort((a, b) => b.startedAt.getTime() - a.startedAt.getTime());
|
|
183
|
-
}
|
|
184
|
-
/** All item rows for a run, insertion-ordered. */
|
|
185
|
-
getItemsForRun(runId) {
|
|
186
|
-
return this.items.get(runId) ?? [];
|
|
187
|
-
}
|
|
188
|
-
};
|
|
189
|
-
MemoryRunRecorder = __decorateClass([
|
|
190
|
-
Injectable2()
|
|
191
|
-
], MemoryRunRecorder);
|
|
192
|
-
|
|
193
|
-
// runtime/subsystems/integration/integration-cursor-store.drizzle-backend.ts
|
|
194
|
-
import { Inject, Injectable as Injectable3, Optional } from "@nestjs/common";
|
|
195
|
-
import { and, desc, eq } from "drizzle-orm";
|
|
196
|
-
|
|
197
|
-
// runtime/constants/tokens.ts
|
|
198
|
-
var DRIZZLE = "DRIZZLE";
|
|
199
|
-
|
|
200
|
-
// runtime/subsystems/integration/integration-audit.schema.ts
|
|
201
1
|
import {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
"outbound"
|
|
216
|
-
]);
|
|
217
|
-
var integrationRunActionEnum = pgEnum("integration_run_action", [
|
|
218
|
-
"poll",
|
|
219
|
-
"cdc",
|
|
220
|
-
"webhook",
|
|
221
|
-
"manual",
|
|
222
|
-
"writeback"
|
|
223
|
-
]);
|
|
224
|
-
var integrationRunStatusEnum = pgEnum("integration_run_status", [
|
|
225
|
-
"running",
|
|
226
|
-
"success",
|
|
227
|
-
"no_changes",
|
|
228
|
-
"failed"
|
|
229
|
-
]);
|
|
230
|
-
var integrationRunItemOperationEnum = pgEnum("integration_run_item_operation", [
|
|
231
|
-
"created",
|
|
232
|
-
"updated",
|
|
233
|
-
"deleted",
|
|
234
|
-
"noop"
|
|
235
|
-
]);
|
|
236
|
-
var integrationRunItemStatusEnum = pgEnum("integration_run_item_status", [
|
|
237
|
-
"success",
|
|
238
|
-
"failed",
|
|
239
|
-
"skipped"
|
|
240
|
-
]);
|
|
241
|
-
var integrationSubscriptions = pgTable(
|
|
242
|
-
"integration_subscriptions",
|
|
243
|
-
{
|
|
244
|
-
id: uuid("id").primaryKey().defaultRandom(),
|
|
245
|
-
connectionId: text("connection_id").notNull(),
|
|
246
|
-
adapter: text("adapter").notNull(),
|
|
247
|
-
domain: text("domain").notNull(),
|
|
248
|
-
externalRef: text("external_ref"),
|
|
249
|
-
enabled: boolean("enabled").notNull().default(true),
|
|
250
|
-
/**
|
|
251
|
-
* Per-subscription configuration bag. Strategies type it internally;
|
|
252
|
-
* e.g. polling strategies stash `{ batchSize, highWatermark }` here.
|
|
253
|
-
*/
|
|
254
|
-
config: jsonb("config").notNull().default({}).$type(),
|
|
255
|
-
/**
|
|
256
|
-
* Opaque cursor persisted by `ICursorStore.put()`. NULL until the first
|
|
257
|
-
* successful run advances it.
|
|
258
|
-
*/
|
|
259
|
-
cursor: jsonb("cursor").$type(),
|
|
260
|
-
lastIntegrationAt: timestamp("last_integration_at", { withTimezone: true }),
|
|
261
|
-
/** Runtime-enforced when `INTEGRATION_MULTI_TENANT` is true; see SYNC-6. */
|
|
262
|
-
tenantId: text("tenant_id"),
|
|
263
|
-
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
264
|
-
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
265
|
-
},
|
|
266
|
-
(t) => ({
|
|
267
|
-
/**
|
|
268
|
-
* Composite uniqueness per the epic shape. `external_ref` is nullable;
|
|
269
|
-
* Postgres treats NULLs as distinct in a UNIQUE constraint, which means
|
|
270
|
-
* two rows with the same `(connection_id, adapter, domain)` and NULL
|
|
271
|
-
* external_ref are allowed. That's intentional — a subscription with
|
|
272
|
-
* NULL external_ref covers the full domain, and duplicates there would
|
|
273
|
-
* be a consumer-layer modeling issue, not a schema concern.
|
|
274
|
-
*/
|
|
275
|
-
uqIntegrationSubscriptionTuple: uniqueIndex("uq_integration_subscriptions_tuple").on(
|
|
276
|
-
t.connectionId,
|
|
277
|
-
t.adapter,
|
|
278
|
-
t.domain,
|
|
279
|
-
t.externalRef
|
|
280
|
-
),
|
|
281
|
-
/** Scheduling query: list enabled subscriptions ordered by staleness. */
|
|
282
|
-
idxIntegrationSubscriptionsEnabledLastIntegration: index(
|
|
283
|
-
"idx_integration_subscriptions_enabled_last_integration"
|
|
284
|
-
).on(t.enabled, t.lastIntegrationAt)
|
|
285
|
-
})
|
|
286
|
-
);
|
|
287
|
-
var integrationRuns = pgTable(
|
|
288
|
-
"integration_runs",
|
|
289
|
-
{
|
|
290
|
-
id: uuid("id").primaryKey().defaultRandom(),
|
|
291
|
-
subscriptionId: uuid("subscription_id").notNull().references(() => integrationSubscriptions.id, { onDelete: "cascade" }),
|
|
292
|
-
direction: integrationRunDirectionEnum("direction").notNull(),
|
|
293
|
-
action: integrationRunActionEnum("action").notNull(),
|
|
294
|
-
status: integrationRunStatusEnum("status").notNull().default("running"),
|
|
295
|
-
recordsFound: integer("records_found").notNull().default(0),
|
|
296
|
-
recordsProcessed: integer("records_processed").notNull().default(0),
|
|
297
|
-
cursorBefore: jsonb("cursor_before").$type(),
|
|
298
|
-
cursorAfter: jsonb("cursor_after").$type(),
|
|
299
|
-
durationMs: integer("duration_ms"),
|
|
300
|
-
error: text("error"),
|
|
301
|
-
startedAt: timestamp("started_at", { withTimezone: true }).notNull().defaultNow(),
|
|
302
|
-
completedAt: timestamp("completed_at", { withTimezone: true }),
|
|
303
|
-
/** Runtime-enforced when `INTEGRATION_MULTI_TENANT` is true; see SYNC-6. */
|
|
304
|
-
tenantId: text("tenant_id")
|
|
305
|
-
},
|
|
306
|
-
(t) => ({
|
|
307
|
-
/** Timeline read: "most recent runs for this subscription". */
|
|
308
|
-
idxIntegrationRunsSubscriptionStartedAt: index(
|
|
309
|
-
"idx_integration_runs_subscription_started_at"
|
|
310
|
-
).on(t.subscriptionId, t.startedAt),
|
|
311
|
-
/** Stale-run sweeper: "runs that started > N minutes ago and are still running". */
|
|
312
|
-
idxIntegrationRunsStatusStartedAt: index("idx_integration_runs_status_started_at").on(
|
|
313
|
-
t.status,
|
|
314
|
-
t.startedAt
|
|
315
|
-
)
|
|
316
|
-
})
|
|
317
|
-
);
|
|
318
|
-
var integrationRunItems = pgTable(
|
|
319
|
-
"integration_run_items",
|
|
320
|
-
{
|
|
321
|
-
id: uuid("id").primaryKey().defaultRandom(),
|
|
322
|
-
integrationRunId: uuid("integration_run_id").notNull().references(() => integrationRuns.id, { onDelete: "cascade" }),
|
|
323
|
-
entityType: text("entity_type").notNull(),
|
|
324
|
-
externalId: text("external_id").notNull(),
|
|
325
|
-
localId: text("local_id"),
|
|
326
|
-
operation: integrationRunItemOperationEnum("operation").notNull(),
|
|
327
|
-
status: integrationRunItemStatusEnum("status").notNull(),
|
|
328
|
-
/**
|
|
329
|
-
* Structured per-field diff — ADR-0003 shape enforced by
|
|
330
|
-
* `FieldDiffSchema.parse` at the recorder service layer.
|
|
331
|
-
*
|
|
332
|
-
* Shape: `{ [fieldName]: { from: unknown, to: unknown } }`.
|
|
333
|
-
* Empty `{}` for `noop` items; `{ [field]: { from: null, to: <value> } }`
|
|
334
|
-
* for created items; `{ [field]: { from: <value>, to: null } }` for
|
|
335
|
-
* deleted items.
|
|
336
|
-
*/
|
|
337
|
-
changedFields: jsonb("changed_fields").notNull().default({}).$type(),
|
|
338
|
-
title: text("title"),
|
|
339
|
-
error: text("error"),
|
|
340
|
-
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
341
|
-
/** Runtime-enforced when `INTEGRATION_MULTI_TENANT` is true; see SYNC-6. */
|
|
342
|
-
tenantId: text("tenant_id")
|
|
343
|
-
},
|
|
344
|
-
(t) => ({
|
|
345
|
-
/** Ordered timeline within a run. */
|
|
346
|
-
idxIntegrationRunItemsRunCreatedAt: index("idx_integration_run_items_run_created_at").on(
|
|
347
|
-
t.integrationRunId,
|
|
348
|
-
t.createdAt
|
|
349
|
-
),
|
|
350
|
-
/** Per-record history: "every integration that touched opportunity/$extId". */
|
|
351
|
-
idxIntegrationRunItemsEntityExternal: index(
|
|
352
|
-
"idx_integration_run_items_entity_external"
|
|
353
|
-
).on(t.entityType, t.externalId)
|
|
354
|
-
})
|
|
355
|
-
);
|
|
356
|
-
|
|
357
|
-
// runtime/subsystems/integration/integration-errors.ts
|
|
358
|
-
var MissingTenantIdError = class extends Error {
|
|
359
|
-
name = "MissingTenantIdError";
|
|
360
|
-
constructor(operation) {
|
|
361
|
-
super(
|
|
362
|
-
`Missing tenantId for integration operation '${operation}'. IntegrationModule is configured with multiTenant: true \u2014 every call must include a non-null tenantId. Either pass the tenantId or disable multi-tenancy on the module.`
|
|
363
|
-
);
|
|
364
|
-
}
|
|
365
|
-
};
|
|
366
|
-
function assertTenantId(tenantId, options) {
|
|
367
|
-
if (!options.multiTenant) return;
|
|
368
|
-
if (tenantId === void 0 || tenantId === null) {
|
|
369
|
-
throw new MissingTenantIdError(options.operation);
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
// runtime/subsystems/integration/integration-cursor-store.drizzle-backend.ts
|
|
374
|
-
var PostgresCursorStore = class {
|
|
375
|
-
constructor(db, multiTenant) {
|
|
376
|
-
this.db = db;
|
|
377
|
-
this.multiTenant = multiTenant ?? false;
|
|
378
|
-
}
|
|
379
|
-
db;
|
|
380
|
-
multiTenant;
|
|
381
|
-
async get(subscriptionId, tenantId) {
|
|
382
|
-
const where = this.buildWhere(subscriptionId, tenantId, "cursor.get");
|
|
383
|
-
const rows = await this.db.select({ cursor: integrationSubscriptions.cursor }).from(integrationSubscriptions).where(where).limit(1);
|
|
384
|
-
if (rows.length === 0) return null;
|
|
385
|
-
return rows[0]?.cursor ?? null;
|
|
386
|
-
}
|
|
387
|
-
async put(subscriptionId, cursor, tenantId) {
|
|
388
|
-
const where = this.buildWhere(subscriptionId, tenantId, "cursor.put");
|
|
389
|
-
await this.db.update(integrationSubscriptions).set({
|
|
390
|
-
cursor,
|
|
391
|
-
lastIntegrationAt: /* @__PURE__ */ new Date(),
|
|
392
|
-
updatedAt: /* @__PURE__ */ new Date()
|
|
393
|
-
}).where(where);
|
|
394
|
-
}
|
|
395
|
-
async listAll(tenantId) {
|
|
396
|
-
assertTenantId(tenantId, {
|
|
397
|
-
multiTenant: this.multiTenant,
|
|
398
|
-
operation: "cursor.listAll"
|
|
399
|
-
});
|
|
400
|
-
const where = this.multiTenant ? eq(integrationSubscriptions.tenantId, tenantId) : void 0;
|
|
401
|
-
const rows = await this.db.select({
|
|
402
|
-
id: integrationSubscriptions.id,
|
|
403
|
-
connectionId: integrationSubscriptions.connectionId,
|
|
404
|
-
adapter: integrationSubscriptions.adapter,
|
|
405
|
-
domain: integrationSubscriptions.domain,
|
|
406
|
-
externalRef: integrationSubscriptions.externalRef,
|
|
407
|
-
cursor: integrationSubscriptions.cursor,
|
|
408
|
-
lastIntegrationAt: integrationSubscriptions.lastIntegrationAt,
|
|
409
|
-
updatedAt: integrationSubscriptions.updatedAt,
|
|
410
|
-
tenantId: integrationSubscriptions.tenantId
|
|
411
|
-
}).from(integrationSubscriptions).where(where).orderBy(desc(integrationSubscriptions.updatedAt));
|
|
412
|
-
return rows.map((row) => ({
|
|
413
|
-
subscriptionId: row.id,
|
|
414
|
-
connectionId: row.connectionId,
|
|
415
|
-
adapter: row.adapter,
|
|
416
|
-
domain: row.domain,
|
|
417
|
-
externalRef: row.externalRef,
|
|
418
|
-
cursor: row.cursor ?? null,
|
|
419
|
-
lastIntegrationAt: row.lastIntegrationAt,
|
|
420
|
-
updatedAt: row.updatedAt,
|
|
421
|
-
tenantId: row.tenantId
|
|
422
|
-
}));
|
|
423
|
-
}
|
|
424
|
-
/**
|
|
425
|
-
* Centralized WHERE clause — `get` and `put` share identical semantics.
|
|
426
|
-
* Drift here would let a caller read under one tenancy rule and write
|
|
427
|
-
* under another.
|
|
428
|
-
*/
|
|
429
|
-
buildWhere(subscriptionId, tenantId, operation) {
|
|
430
|
-
assertTenantId(tenantId, {
|
|
431
|
-
multiTenant: this.multiTenant,
|
|
432
|
-
operation
|
|
433
|
-
});
|
|
434
|
-
if (this.multiTenant) {
|
|
435
|
-
return and(
|
|
436
|
-
eq(integrationSubscriptions.id, subscriptionId),
|
|
437
|
-
eq(integrationSubscriptions.tenantId, tenantId)
|
|
438
|
-
);
|
|
439
|
-
}
|
|
440
|
-
return eq(integrationSubscriptions.id, subscriptionId);
|
|
441
|
-
}
|
|
442
|
-
};
|
|
443
|
-
PostgresCursorStore = __decorateClass([
|
|
444
|
-
Injectable3(),
|
|
445
|
-
__decorateParam(0, Inject(DRIZZLE)),
|
|
446
|
-
__decorateParam(1, Optional()),
|
|
447
|
-
__decorateParam(1, Inject(INTEGRATION_MULTI_TENANT))
|
|
448
|
-
], PostgresCursorStore);
|
|
449
|
-
|
|
450
|
-
// runtime/subsystems/integration/integration-run-recorder.drizzle-backend.ts
|
|
451
|
-
import { Inject as Inject2, Injectable as Injectable4, Optional as Optional2 } from "@nestjs/common";
|
|
452
|
-
import { and as and2, desc as desc2, eq as eq2 } from "drizzle-orm";
|
|
453
|
-
var DrizzleIntegrationRunRecorder = class {
|
|
454
|
-
constructor(db, multiTenant) {
|
|
455
|
-
this.db = db;
|
|
456
|
-
this.multiTenant = multiTenant ?? false;
|
|
457
|
-
}
|
|
458
|
-
db;
|
|
459
|
-
multiTenant;
|
|
460
|
-
async startRun(input) {
|
|
461
|
-
assertTenantId(input.tenantId, {
|
|
462
|
-
multiTenant: this.multiTenant,
|
|
463
|
-
operation: "startRun"
|
|
464
|
-
});
|
|
465
|
-
const rows = await this.db.insert(integrationRuns).values({
|
|
466
|
-
subscriptionId: input.subscriptionId,
|
|
467
|
-
direction: input.direction,
|
|
468
|
-
action: input.action,
|
|
469
|
-
status: "running",
|
|
470
|
-
cursorBefore: input.cursorBefore ?? null,
|
|
471
|
-
tenantId: input.tenantId ?? null
|
|
472
|
-
}).returning({ id: integrationRuns.id });
|
|
473
|
-
const id = rows[0]?.id;
|
|
474
|
-
if (!id) {
|
|
475
|
-
throw new Error("DrizzleIntegrationRunRecorder: INSERT RETURNING produced no id");
|
|
476
|
-
}
|
|
477
|
-
return { id };
|
|
478
|
-
}
|
|
479
|
-
async recordItem(input) {
|
|
480
|
-
assertTenantId(input.tenantId, {
|
|
481
|
-
multiTenant: this.multiTenant,
|
|
482
|
-
operation: "recordItem"
|
|
483
|
-
});
|
|
484
|
-
FieldDiffSchema.parse(input.changedFields);
|
|
485
|
-
await this.db.insert(integrationRunItems).values({
|
|
486
|
-
integrationRunId: input.integrationRunId,
|
|
487
|
-
entityType: input.entityType,
|
|
488
|
-
externalId: input.externalId,
|
|
489
|
-
localId: input.localId ?? null,
|
|
490
|
-
operation: input.operation,
|
|
491
|
-
status: input.status,
|
|
492
|
-
changedFields: input.changedFields,
|
|
493
|
-
title: input.title ?? null,
|
|
494
|
-
error: input.error ?? null,
|
|
495
|
-
tenantId: input.tenantId ?? null
|
|
496
|
-
});
|
|
497
|
-
}
|
|
498
|
-
async listRecent(limit, subscriptionId, tenantId) {
|
|
499
|
-
assertTenantId(tenantId, {
|
|
500
|
-
multiTenant: this.multiTenant,
|
|
501
|
-
operation: "listRecent"
|
|
502
|
-
});
|
|
503
|
-
const conditions = [];
|
|
504
|
-
if (subscriptionId !== void 0) {
|
|
505
|
-
conditions.push(eq2(integrationRuns.subscriptionId, subscriptionId));
|
|
506
|
-
}
|
|
507
|
-
if (this.multiTenant) {
|
|
508
|
-
conditions.push(eq2(integrationRuns.tenantId, tenantId));
|
|
509
|
-
}
|
|
510
|
-
const where = conditions.length === 0 ? void 0 : conditions.length === 1 ? conditions[0] : and2(...conditions);
|
|
511
|
-
const rows = await this.db.select({
|
|
512
|
-
id: integrationRuns.id,
|
|
513
|
-
subscriptionId: integrationRuns.subscriptionId,
|
|
514
|
-
connectionId: integrationSubscriptions.connectionId,
|
|
515
|
-
status: integrationRuns.status,
|
|
516
|
-
startedAt: integrationRuns.startedAt,
|
|
517
|
-
completedAt: integrationRuns.completedAt,
|
|
518
|
-
recordsProcessed: integrationRuns.recordsProcessed,
|
|
519
|
-
tenantId: integrationRuns.tenantId
|
|
520
|
-
}).from(integrationRuns).innerJoin(
|
|
521
|
-
integrationSubscriptions,
|
|
522
|
-
eq2(integrationRuns.subscriptionId, integrationSubscriptions.id)
|
|
523
|
-
).where(where).orderBy(desc2(integrationRuns.startedAt)).limit(limit);
|
|
524
|
-
return rows.map((row) => ({
|
|
525
|
-
id: row.id,
|
|
526
|
-
subscriptionId: row.subscriptionId,
|
|
527
|
-
connectionId: row.connectionId,
|
|
528
|
-
status: row.status,
|
|
529
|
-
startedAt: row.startedAt,
|
|
530
|
-
completedAt: row.completedAt,
|
|
531
|
-
recordsProcessed: row.recordsProcessed,
|
|
532
|
-
tenantId: row.tenantId
|
|
533
|
-
}));
|
|
534
|
-
}
|
|
535
|
-
async completeRun(runId, input) {
|
|
536
|
-
await this.db.update(integrationRuns).set({
|
|
537
|
-
status: input.status,
|
|
538
|
-
recordsFound: input.recordsFound,
|
|
539
|
-
recordsProcessed: input.recordsProcessed,
|
|
540
|
-
cursorAfter: input.cursorAfter ?? null,
|
|
541
|
-
durationMs: input.durationMs,
|
|
542
|
-
error: input.error ?? null,
|
|
543
|
-
completedAt: /* @__PURE__ */ new Date()
|
|
544
|
-
}).where(eq2(integrationRuns.id, runId));
|
|
545
|
-
}
|
|
546
|
-
};
|
|
547
|
-
DrizzleIntegrationRunRecorder = __decorateClass([
|
|
548
|
-
Injectable4(),
|
|
549
|
-
__decorateParam(0, Inject2(DRIZZLE)),
|
|
550
|
-
__decorateParam(1, Optional2()),
|
|
551
|
-
__decorateParam(1, Inject2(INTEGRATION_MULTI_TENANT))
|
|
552
|
-
], DrizzleIntegrationRunRecorder);
|
|
553
|
-
|
|
554
|
-
// runtime/subsystems/integration/deep-equal.differ.ts
|
|
555
|
-
import { Injectable as Injectable5 } from "@nestjs/common";
|
|
556
|
-
var DEFAULT_IGNORE_FIELDS = /* @__PURE__ */ new Set([
|
|
557
|
-
"id",
|
|
558
|
-
"createdAt",
|
|
559
|
-
"updatedAt",
|
|
560
|
-
"deletedAt",
|
|
561
|
-
"type",
|
|
562
|
-
"lastModifiedAt",
|
|
563
|
-
"fields",
|
|
564
|
-
"external_id",
|
|
565
|
-
"externalId",
|
|
566
|
-
"provider",
|
|
567
|
-
"provider_metadata",
|
|
568
|
-
"providerMetadata"
|
|
569
|
-
]);
|
|
570
|
-
var DeepEqualDiffer = class {
|
|
571
|
-
ignore;
|
|
572
|
-
constructor(opts = {}) {
|
|
573
|
-
if (opts.ignore && opts.ignore.length > 0) {
|
|
574
|
-
this.ignore = /* @__PURE__ */ new Set([...DEFAULT_IGNORE_FIELDS, ...opts.ignore]);
|
|
575
|
-
} else {
|
|
576
|
-
this.ignore = DEFAULT_IGNORE_FIELDS;
|
|
577
|
-
}
|
|
578
|
-
}
|
|
579
|
-
diff(existing, incoming, providerChangedFields) {
|
|
580
|
-
if (existing === null) {
|
|
581
|
-
const out2 = {};
|
|
582
|
-
for (const key of Object.keys(incoming)) {
|
|
583
|
-
if (this.ignore.has(key)) continue;
|
|
584
|
-
const value = incoming[key];
|
|
585
|
-
if (value === null || value === void 0) continue;
|
|
586
|
-
out2[key] = { from: null, to: value };
|
|
587
|
-
}
|
|
588
|
-
return Object.keys(out2).length === 0 ? "noop" : out2;
|
|
589
|
-
}
|
|
590
|
-
const candidates = /* @__PURE__ */ new Set();
|
|
591
|
-
if (providerChangedFields && providerChangedFields.length > 0) {
|
|
592
|
-
for (const key of providerChangedFields) {
|
|
593
|
-
if (!this.ignore.has(key)) candidates.add(key);
|
|
594
|
-
}
|
|
595
|
-
} else {
|
|
596
|
-
for (const key of Object.keys(incoming)) {
|
|
597
|
-
if (!this.ignore.has(key)) candidates.add(key);
|
|
598
|
-
}
|
|
599
|
-
for (const key of Object.keys(existing)) {
|
|
600
|
-
if (this.ignore.has(key)) continue;
|
|
601
|
-
if (!(key in incoming)) continue;
|
|
602
|
-
candidates.add(key);
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
const out = {};
|
|
606
|
-
for (const key of candidates) {
|
|
607
|
-
const before = existing[key];
|
|
608
|
-
const after = incoming[key];
|
|
609
|
-
if (!isEqual(before, after)) {
|
|
610
|
-
out[key] = { from: before ?? null, to: after ?? null };
|
|
611
|
-
}
|
|
612
|
-
}
|
|
613
|
-
return Object.keys(out).length === 0 ? "noop" : out;
|
|
614
|
-
}
|
|
615
|
-
};
|
|
616
|
-
DeepEqualDiffer = __decorateClass([
|
|
617
|
-
Injectable5()
|
|
618
|
-
], DeepEqualDiffer);
|
|
619
|
-
function isEqual(a, b) {
|
|
620
|
-
if (a === b) return true;
|
|
621
|
-
const na = normalize(a);
|
|
622
|
-
const nb = normalize(b);
|
|
623
|
-
if (na === nb) return true;
|
|
624
|
-
if (typeof na === "object" && typeof nb === "object" && na !== null && nb !== null) {
|
|
625
|
-
return deepEqualObject(na, nb);
|
|
626
|
-
}
|
|
627
|
-
const numericEqual = maybeNumericEqual(na, nb) || maybeNumericEqual(nb, na);
|
|
628
|
-
return numericEqual;
|
|
629
|
-
}
|
|
630
|
-
function normalize(value) {
|
|
631
|
-
if (value instanceof Date) return value.toISOString();
|
|
632
|
-
return value;
|
|
633
|
-
}
|
|
634
|
-
function maybeNumericEqual(a, b) {
|
|
635
|
-
if (typeof a !== "string" || typeof b !== "number") return false;
|
|
636
|
-
if (a.trim() === "") return false;
|
|
637
|
-
const parsed = Number(a);
|
|
638
|
-
if (!Number.isFinite(parsed)) return false;
|
|
639
|
-
return parsed === b;
|
|
640
|
-
}
|
|
641
|
-
function deepEqualObject(a, b) {
|
|
642
|
-
if (Array.isArray(a) !== Array.isArray(b)) return false;
|
|
643
|
-
const aKeys = Object.keys(a);
|
|
644
|
-
const bKeys = Object.keys(b);
|
|
645
|
-
if (aKeys.length !== bKeys.length) return false;
|
|
646
|
-
for (const key of aKeys) {
|
|
647
|
-
if (!(key in b)) return false;
|
|
648
|
-
if (!isEqual(a[key], b[key])) return false;
|
|
649
|
-
}
|
|
650
|
-
return true;
|
|
651
|
-
}
|
|
652
|
-
|
|
653
|
-
// runtime/subsystems/integration/integration.module.ts
|
|
654
|
-
var IntegrationModule = class {
|
|
655
|
-
static forRoot(options) {
|
|
656
|
-
const multiTenant = options.multiTenant ?? false;
|
|
657
|
-
const sharedProviders = [
|
|
658
|
-
{ provide: INTEGRATION_MODULE_OPTIONS, useValue: options },
|
|
659
|
-
{ provide: INTEGRATION_MULTI_TENANT, useValue: multiTenant },
|
|
660
|
-
// Default differ — consumers can override by binding a different
|
|
661
|
-
// `IFieldDiffer<T>` to `INTEGRATION_FIELD_DIFFER` in their feature module.
|
|
662
|
-
{ provide: INTEGRATION_FIELD_DIFFER, useValue: new DeepEqualDiffer() }
|
|
663
|
-
];
|
|
664
|
-
const backendProviders = options.backend === "memory" ? [
|
|
665
|
-
// Wired as singletons via `useValue` so tests can pull
|
|
666
|
-
// them out via `moduleRef.get(MemoryCursorStore)` for
|
|
667
|
-
// direct assertions. Matches JOB-4 / MemoryJobStore shape.
|
|
668
|
-
{ provide: MemoryCursorStore, useValue: new MemoryCursorStore() },
|
|
669
|
-
{
|
|
670
|
-
provide: INTEGRATION_CURSOR_STORE,
|
|
671
|
-
useExisting: MemoryCursorStore
|
|
672
|
-
},
|
|
673
|
-
{ provide: MemoryRunRecorder, useValue: new MemoryRunRecorder() },
|
|
674
|
-
{
|
|
675
|
-
provide: INTEGRATION_RUN_RECORDER,
|
|
676
|
-
useExisting: MemoryRunRecorder
|
|
677
|
-
}
|
|
678
|
-
] : [
|
|
679
|
-
// Drizzle backends — injected with DRIZZLE (provided by the
|
|
680
|
-
// consumer's DrizzleModule) + the INTEGRATION_MULTI_TENANT flag
|
|
681
|
-
// we bound above.
|
|
682
|
-
{ provide: INTEGRATION_CURSOR_STORE, useClass: PostgresCursorStore },
|
|
683
|
-
{ provide: INTEGRATION_RUN_RECORDER, useClass: DrizzleIntegrationRunRecorder }
|
|
684
|
-
];
|
|
685
|
-
return {
|
|
686
|
-
module: IntegrationModule,
|
|
687
|
-
global: true,
|
|
688
|
-
providers: [...sharedProviders, ...backendProviders],
|
|
689
|
-
exports: [
|
|
690
|
-
INTEGRATION_MODULE_OPTIONS,
|
|
691
|
-
INTEGRATION_MULTI_TENANT,
|
|
692
|
-
INTEGRATION_FIELD_DIFFER,
|
|
693
|
-
INTEGRATION_CURSOR_STORE,
|
|
694
|
-
INTEGRATION_RUN_RECORDER
|
|
695
|
-
]
|
|
696
|
-
};
|
|
697
|
-
}
|
|
698
|
-
};
|
|
699
|
-
IntegrationModule = __decorateClass([
|
|
700
|
-
Module({})
|
|
701
|
-
], IntegrationModule);
|
|
2
|
+
IntegrationModule
|
|
3
|
+
} from "../../../chunk-WEVWJKOW.js";
|
|
4
|
+
import "../../../chunk-AHV4GDYM.js";
|
|
5
|
+
import "../../../chunk-SR7F3TJY.js";
|
|
6
|
+
import "../../../chunk-EO2QPOKH.js";
|
|
7
|
+
import "../../../chunk-SQDOBLBP.js";
|
|
8
|
+
import "../../../chunk-DCCZB4UC.js";
|
|
9
|
+
import "../../../chunk-MZ6GV4YF.js";
|
|
10
|
+
import "../../../chunk-HNWZFNKP.js";
|
|
11
|
+
import "../../../chunk-36U5UGIO.js";
|
|
12
|
+
import "../../../chunk-S7C6TIIF.js";
|
|
13
|
+
import "../../../chunk-U64T4YZE.js";
|
|
14
|
+
import "../../../chunk-2E224ZSN.js";
|
|
702
15
|
export {
|
|
703
16
|
IntegrationModule
|
|
704
17
|
};
|