@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
|
@@ -1,546 +1,57 @@
|
|
|
1
|
-
|
|
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 = (index, decorator) => (target, key) => decorator(target, key, index);
|
|
12
|
-
|
|
13
|
-
// runtime/subsystems/auth/protocols/oauth-state-store.ts
|
|
14
|
-
var OAuthStateError = class extends Error {
|
|
15
|
-
constructor(message, reason) {
|
|
16
|
-
super(message);
|
|
17
|
-
this.reason = reason;
|
|
18
|
-
this.name = "OAuthStateError";
|
|
19
|
-
}
|
|
20
|
-
reason;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
// runtime/subsystems/token-key.ts
|
|
24
|
-
var PKG = "@pattern-stack/codegen";
|
|
25
|
-
var tokenKey = (area, name) => `${PKG}.${area}.${name}`;
|
|
26
|
-
|
|
27
|
-
// runtime/subsystems/auth/auth.tokens.ts
|
|
28
|
-
var ENCRYPTION_KEY = Symbol.for(tokenKey("auth", "encryption-key"));
|
|
29
|
-
var OAUTH_STATE_STORE = Symbol.for(tokenKey("auth", "oauth-state-store"));
|
|
30
|
-
var AUTH_CONNECTION_READER = Symbol.for(tokenKey("auth", "connection-reader"));
|
|
31
|
-
var AUTH_CONNECTION_TOKEN_WRITER = Symbol.for(tokenKey("auth", "connection-token-writer"));
|
|
32
|
-
var AUTH_CONNECTION_GRANT_SINK = Symbol.for(tokenKey("auth", "connection-grant-sink"));
|
|
33
|
-
var AUTH_USER_CONTEXT = Symbol.for(tokenKey("auth", "user-context"));
|
|
34
|
-
var STRATEGY_REGISTRY = Symbol.for(tokenKey("auth", "strategy-registry"));
|
|
35
|
-
var AUTH_OPTIONS = Symbol.for(tokenKey("auth", "options"));
|
|
36
|
-
|
|
37
|
-
// runtime/subsystems/auth/runtime/connection-broken.error.ts
|
|
38
|
-
var ConnectionBrokenError = class extends Error {
|
|
39
|
-
constructor(connectionId, errorCode, errorDescription) {
|
|
40
|
-
super(
|
|
41
|
-
`Connection ${connectionId} broken: ${errorCode} - ${errorDescription}`
|
|
42
|
-
);
|
|
43
|
-
this.connectionId = connectionId;
|
|
44
|
-
this.errorCode = errorCode;
|
|
45
|
-
this.errorDescription = errorDescription;
|
|
46
|
-
this.name = "ConnectionBrokenError";
|
|
47
|
-
}
|
|
48
|
-
connectionId;
|
|
49
|
-
errorCode;
|
|
50
|
-
errorDescription;
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
// runtime/subsystems/auth/runtime/oauth2-refresh.strategy.ts
|
|
54
|
-
var REFRESH_SAFETY_MS = 5 * 60 * 1e3;
|
|
55
|
-
var OAuth2RefreshStrategy = class {
|
|
56
|
-
connectionReader;
|
|
57
|
-
tokenWriter;
|
|
58
|
-
fetchImpl;
|
|
59
|
-
now;
|
|
60
|
-
constructor(opts) {
|
|
61
|
-
this.connectionReader = opts.connectionReader;
|
|
62
|
-
this.tokenWriter = opts.tokenWriter;
|
|
63
|
-
this.fetchImpl = opts.fetch ?? fetch;
|
|
64
|
-
this.now = opts.now ?? Date.now;
|
|
65
|
-
}
|
|
66
|
-
async resolve(connectionId, opts = {}) {
|
|
67
|
-
const connection = await this.connectionReader.findByIdDecrypted(connectionId);
|
|
68
|
-
if (!connection) {
|
|
69
|
-
throw new Error(`Connection ${connectionId} not found`);
|
|
70
|
-
}
|
|
71
|
-
if (connection.provider !== this.provider) {
|
|
72
|
-
throw new Error(
|
|
73
|
-
`${this.constructor.name} called for non-${this.provider} connection ${connectionId} (provider=${connection.provider})`
|
|
74
|
-
);
|
|
75
|
-
}
|
|
76
|
-
const needsRefresh = opts.forceRefresh || this.isExpiring(connection.expiresAt) || !connection.accessToken;
|
|
77
|
-
if (!needsRefresh) {
|
|
78
|
-
return this.buildCredentials(connection.accessToken, connection);
|
|
79
|
-
}
|
|
80
|
-
if (!connection.refreshToken) {
|
|
81
|
-
throw new ConnectionBrokenError(
|
|
82
|
-
connectionId,
|
|
83
|
-
"no_refresh_token",
|
|
84
|
-
"Connection has no refresh token; user must reconnect"
|
|
85
|
-
);
|
|
86
|
-
}
|
|
87
|
-
const { parsed, raw } = await this.executeRefresh(
|
|
88
|
-
connectionId,
|
|
89
|
-
connection.refreshToken
|
|
90
|
-
);
|
|
91
|
-
const newExpiresAt = new Date(
|
|
92
|
-
this.now() + (parsed.expiresInSec ?? this.defaultExpiresInSec) * 1e3
|
|
93
|
-
);
|
|
94
|
-
await this.tokenWriter.persistRefresh({
|
|
95
|
-
connectionId,
|
|
96
|
-
accessToken: parsed.accessToken,
|
|
97
|
-
refreshToken: parsed.refreshToken ?? void 0,
|
|
98
|
-
expiresAt: newExpiresAt
|
|
99
|
-
});
|
|
100
|
-
return this.buildCredentials(parsed.accessToken, connection, raw);
|
|
101
|
-
}
|
|
102
|
-
async executeRefresh(connectionId, refreshToken) {
|
|
103
|
-
const body = new URLSearchParams({
|
|
104
|
-
grant_type: "refresh_token",
|
|
105
|
-
refresh_token: refreshToken,
|
|
106
|
-
...this.refreshBodyExtras()
|
|
107
|
-
});
|
|
108
|
-
const response = await this.fetchImpl(this.tokenEndpoint(), {
|
|
109
|
-
method: "POST",
|
|
110
|
-
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
|
111
|
-
body: body.toString()
|
|
112
|
-
});
|
|
113
|
-
if (!response.ok) {
|
|
114
|
-
const err = await safeJson(response);
|
|
115
|
-
if (response.status === 400 && (err.error === "invalid_grant" || err.error === "invalid_token")) {
|
|
116
|
-
throw new ConnectionBrokenError(
|
|
117
|
-
connectionId,
|
|
118
|
-
err.error ?? "invalid_grant",
|
|
119
|
-
err.error_description ?? err.message ?? "refresh token rejected"
|
|
120
|
-
);
|
|
121
|
-
}
|
|
122
|
-
throw new Error(
|
|
123
|
-
`${this.provider} token refresh failed: ${response.status} ${err.error ?? ""} ${err.error_description ?? err.message ?? ""}`.trim()
|
|
124
|
-
);
|
|
125
|
-
}
|
|
126
|
-
const raw = await response.json();
|
|
127
|
-
return { parsed: this.parseRefreshResponse(raw), raw };
|
|
128
|
-
}
|
|
129
|
-
isExpiring(expiresAt) {
|
|
130
|
-
if (!expiresAt) return true;
|
|
131
|
-
return expiresAt.getTime() - this.now() < REFRESH_SAFETY_MS;
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
async function safeJson(response) {
|
|
135
|
-
try {
|
|
136
|
-
return await response.clone().json();
|
|
137
|
-
} catch {
|
|
138
|
-
return {};
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
// runtime/subsystems/auth/runtime/session-expired.error.ts
|
|
143
|
-
var SessionExpiredError = class extends Error {
|
|
144
|
-
/** Duck-type marker — works across package boundaries where `instanceof` fails. */
|
|
145
|
-
isSessionExpired = true;
|
|
146
|
-
constructor(message = "Access token rejected by provider") {
|
|
147
|
-
super(message);
|
|
148
|
-
this.name = "SessionExpiredError";
|
|
149
|
-
}
|
|
150
|
-
};
|
|
151
|
-
function isSessionExpiredError(err) {
|
|
152
|
-
if (err instanceof SessionExpiredError) return true;
|
|
153
|
-
if (err !== null && typeof err === "object" && "isSessionExpired" in err) {
|
|
154
|
-
return err.isSessionExpired === true;
|
|
155
|
-
}
|
|
156
|
-
return false;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
// runtime/subsystems/auth/runtime/with-auth-retry.ts
|
|
160
|
-
async function withAuthRetry(authStrategy, connectionId, op, options = {}) {
|
|
161
|
-
const classify = options.isSessionExpired ?? isSessionExpiredError;
|
|
162
|
-
let creds = await authStrategy.resolve(connectionId);
|
|
163
|
-
try {
|
|
164
|
-
return await op(creds);
|
|
165
|
-
} catch (e) {
|
|
166
|
-
if (!classify(e)) throw e;
|
|
167
|
-
creds = await authStrategy.resolve(connectionId, { forceRefresh: true });
|
|
168
|
-
return op(creds);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
// runtime/subsystems/auth/auth-oauth-state.schema.ts
|
|
173
|
-
import { pgTable, text, timestamp } from "drizzle-orm/pg-core";
|
|
174
|
-
var authOAuthState = pgTable("auth_oauth_state", {
|
|
175
|
-
state: text("state").primaryKey(),
|
|
176
|
-
userId: text("user_id").notNull(),
|
|
177
|
-
redirect: text("redirect"),
|
|
178
|
-
expiresAt: timestamp("expires_at", { withTimezone: true }).notNull()
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
// runtime/subsystems/auth/backends/encryption-key/env.ts
|
|
182
|
-
import { createCipheriv, createDecipheriv, randomBytes } from "crypto";
|
|
183
|
-
var ALGO = "aes-256-gcm";
|
|
184
|
-
var NONCE_BYTES = 12;
|
|
185
|
-
var TAG_BYTES = 16;
|
|
186
|
-
var KEY_BYTES = 32;
|
|
187
|
-
var EnvEncryptionKey = class {
|
|
188
|
-
key;
|
|
189
|
-
constructor(opts = {}) {
|
|
190
|
-
const env = opts.env ?? process.env;
|
|
191
|
-
const envVar = opts.envVar ?? "INTEGRATION_TOKEN_ENCRYPTION_KEY";
|
|
192
|
-
const raw = env[envVar];
|
|
193
|
-
if (!raw) {
|
|
194
|
-
throw new Error(
|
|
195
|
-
`EnvEncryptionKey: ${envVar} is not set. Generate with: openssl rand -base64 32`
|
|
196
|
-
);
|
|
197
|
-
}
|
|
198
|
-
const decoded = Buffer.from(raw, "base64");
|
|
199
|
-
if (decoded.length !== KEY_BYTES) {
|
|
200
|
-
throw new Error(
|
|
201
|
-
`EnvEncryptionKey: ${envVar} must decode to ${KEY_BYTES} bytes (got ${decoded.length}). Use: openssl rand -base64 32`
|
|
202
|
-
);
|
|
203
|
-
}
|
|
204
|
-
this.key = decoded;
|
|
205
|
-
}
|
|
206
|
-
async encrypt(plaintext) {
|
|
207
|
-
const nonce = randomBytes(NONCE_BYTES);
|
|
208
|
-
const cipher = createCipheriv(ALGO, this.key, nonce);
|
|
209
|
-
const ciphertext = Buffer.concat([
|
|
210
|
-
cipher.update(plaintext, "utf8"),
|
|
211
|
-
cipher.final()
|
|
212
|
-
]);
|
|
213
|
-
const authTag = cipher.getAuthTag();
|
|
214
|
-
return Buffer.concat([nonce, ciphertext, authTag]).toString("base64");
|
|
215
|
-
}
|
|
216
|
-
async decrypt(ciphertext) {
|
|
217
|
-
const buf = Buffer.from(ciphertext, "base64");
|
|
218
|
-
if (buf.length < NONCE_BYTES + TAG_BYTES) {
|
|
219
|
-
throw new Error("EnvEncryptionKey: ciphertext too short");
|
|
220
|
-
}
|
|
221
|
-
const nonce = buf.subarray(0, NONCE_BYTES);
|
|
222
|
-
const authTag = buf.subarray(buf.length - TAG_BYTES);
|
|
223
|
-
const body = buf.subarray(NONCE_BYTES, buf.length - TAG_BYTES);
|
|
224
|
-
const decipher = createDecipheriv(ALGO, this.key, nonce);
|
|
225
|
-
decipher.setAuthTag(authTag);
|
|
226
|
-
const plain = Buffer.concat([decipher.update(body), decipher.final()]);
|
|
227
|
-
return plain.toString("utf8");
|
|
228
|
-
}
|
|
229
|
-
};
|
|
230
|
-
|
|
231
|
-
// runtime/subsystems/auth/backends/state-store.memory-backend.ts
|
|
232
|
-
import { randomBytes as randomBytes2 } from "crypto";
|
|
233
|
-
var MemoryOAuthStateStore = class {
|
|
234
|
-
store = /* @__PURE__ */ new Map();
|
|
235
|
-
ttlMs;
|
|
236
|
-
now;
|
|
237
|
-
generateToken;
|
|
238
|
-
constructor(opts = {}) {
|
|
239
|
-
this.ttlMs = opts.ttlMs ?? 10 * 60 * 1e3;
|
|
240
|
-
this.now = opts.now ?? (() => Date.now());
|
|
241
|
-
this.generateToken = opts.generateToken ?? (() => randomBytes2(32).toString("base64url"));
|
|
242
|
-
}
|
|
243
|
-
async generate(record) {
|
|
244
|
-
const state = this.generateToken();
|
|
245
|
-
this.store.set(state, {
|
|
246
|
-
record: { ...record },
|
|
247
|
-
expiresAt: this.now() + this.ttlMs
|
|
248
|
-
});
|
|
249
|
-
return state;
|
|
250
|
-
}
|
|
251
|
-
async consume(state) {
|
|
252
|
-
const slot = this.store.get(state);
|
|
253
|
-
if (!slot) {
|
|
254
|
-
throw new OAuthStateError(
|
|
255
|
-
`OAuth state token unknown or already consumed`,
|
|
256
|
-
"missing"
|
|
257
|
-
);
|
|
258
|
-
}
|
|
259
|
-
this.store.delete(state);
|
|
260
|
-
if (slot.expiresAt <= this.now()) {
|
|
261
|
-
throw new OAuthStateError(`OAuth state token expired`, "expired");
|
|
262
|
-
}
|
|
263
|
-
return slot.record;
|
|
264
|
-
}
|
|
265
|
-
};
|
|
266
|
-
|
|
267
|
-
// runtime/subsystems/auth/backends/state-store.drizzle-backend.ts
|
|
268
|
-
import { randomBytes as randomBytes3 } from "crypto";
|
|
269
|
-
import { eq } from "drizzle-orm";
|
|
270
|
-
var DrizzleOAuthStateStore = class {
|
|
271
|
-
constructor(db, opts = {}) {
|
|
272
|
-
this.db = db;
|
|
273
|
-
this.ttlMs = opts.ttlMs ?? 10 * 60 * 1e3;
|
|
274
|
-
this.now = opts.now ?? (() => Date.now());
|
|
275
|
-
this.generateToken = opts.generateToken ?? (() => randomBytes3(32).toString("base64url"));
|
|
276
|
-
}
|
|
277
|
-
db;
|
|
278
|
-
ttlMs;
|
|
279
|
-
now;
|
|
280
|
-
generateToken;
|
|
281
|
-
async generate(record) {
|
|
282
|
-
const state = this.generateToken();
|
|
283
|
-
const expiresAt = new Date(this.now() + this.ttlMs);
|
|
284
|
-
await this.db.insert(authOAuthState).values({
|
|
285
|
-
state,
|
|
286
|
-
userId: record.userId,
|
|
287
|
-
redirect: record.redirect ?? null,
|
|
288
|
-
expiresAt
|
|
289
|
-
});
|
|
290
|
-
return state;
|
|
291
|
-
}
|
|
292
|
-
async consume(state) {
|
|
293
|
-
const rows = await this.db.delete(authOAuthState).where(eq(authOAuthState.state, state)).returning();
|
|
294
|
-
const row = rows[0];
|
|
295
|
-
if (!row) {
|
|
296
|
-
throw new OAuthStateError(
|
|
297
|
-
`OAuth state token unknown or already consumed`,
|
|
298
|
-
"missing"
|
|
299
|
-
);
|
|
300
|
-
}
|
|
301
|
-
if (row.expiresAt.getTime() <= this.now()) {
|
|
302
|
-
throw new OAuthStateError(`OAuth state token expired`, "expired");
|
|
303
|
-
}
|
|
304
|
-
return {
|
|
305
|
-
userId: row.userId,
|
|
306
|
-
redirect: row.redirect ?? void 0
|
|
307
|
-
};
|
|
308
|
-
}
|
|
309
|
-
};
|
|
310
|
-
|
|
311
|
-
// runtime/subsystems/auth/controllers/auth.controller.ts
|
|
1
|
+
import "../../../chunk-7C3FOSDI.js";
|
|
312
2
|
import {
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
await this.grantSink.createOrUpdateFromOAuthGrant({
|
|
366
|
-
userId,
|
|
367
|
-
provider: slug,
|
|
368
|
-
accessToken: tokens.accessToken,
|
|
369
|
-
refreshToken: tokens.refreshToken,
|
|
370
|
-
expiresAt: tokens.expiresAt,
|
|
371
|
-
scope: tokens.scope,
|
|
372
|
-
externalAccountId: tokens.externalAccountId,
|
|
373
|
-
providerMetadata: tokens.providerMetadata
|
|
374
|
-
});
|
|
375
|
-
return res.redirect(
|
|
376
|
-
HttpStatus.FOUND,
|
|
377
|
-
redirect ?? `/settings/connections?connected=${encodeURIComponent(slug)}`
|
|
378
|
-
);
|
|
379
|
-
}
|
|
380
|
-
requireStrategy(slug) {
|
|
381
|
-
const strategy = this.registry.get(slug);
|
|
382
|
-
if (!strategy) {
|
|
383
|
-
throw new HttpException(
|
|
384
|
-
`Unknown provider '${slug}'`,
|
|
385
|
-
HttpStatus.NOT_FOUND
|
|
386
|
-
);
|
|
387
|
-
}
|
|
388
|
-
return strategy;
|
|
389
|
-
}
|
|
390
|
-
redirectUriFor(slug) {
|
|
391
|
-
const base = this.options.redirectUriBase;
|
|
392
|
-
if (!base) {
|
|
393
|
-
throw new Error(
|
|
394
|
-
`AuthModule.forRoot: redirectUriBase is required when AuthController is enabled`
|
|
395
|
-
);
|
|
396
|
-
}
|
|
397
|
-
const trimmed = base.replace(/\/+$/, "");
|
|
398
|
-
return `${trimmed}/auth/${encodeURIComponent(slug)}/callback`;
|
|
399
|
-
}
|
|
400
|
-
};
|
|
401
|
-
__decorateClass([
|
|
402
|
-
Get(":provider/connect"),
|
|
403
|
-
__decorateParam(0, Param("provider")),
|
|
404
|
-
__decorateParam(1, Query("redirect")),
|
|
405
|
-
__decorateParam(2, Req()),
|
|
406
|
-
__decorateParam(3, Res())
|
|
407
|
-
], AuthController.prototype, "connect", 1);
|
|
408
|
-
__decorateClass([
|
|
409
|
-
Get(":provider/callback"),
|
|
410
|
-
__decorateParam(0, Param("provider")),
|
|
411
|
-
__decorateParam(1, Query("code")),
|
|
412
|
-
__decorateParam(2, Query("state")),
|
|
413
|
-
__decorateParam(3, Res())
|
|
414
|
-
], AuthController.prototype, "callback", 1);
|
|
415
|
-
AuthController = __decorateClass([
|
|
416
|
-
Controller("auth"),
|
|
417
|
-
__decorateParam(0, Inject(STRATEGY_REGISTRY)),
|
|
418
|
-
__decorateParam(1, Inject(AUTH_USER_CONTEXT)),
|
|
419
|
-
__decorateParam(2, Inject(OAUTH_STATE_STORE)),
|
|
420
|
-
__decorateParam(3, Inject(AUTH_CONNECTION_GRANT_SINK)),
|
|
421
|
-
__decorateParam(4, Inject(AUTH_OPTIONS))
|
|
422
|
-
], AuthController);
|
|
423
|
-
|
|
424
|
-
// runtime/base-classes/tenant-context.ts
|
|
425
|
-
import { AsyncLocalStorage } from "async_hooks";
|
|
426
|
-
var als = new AsyncLocalStorage();
|
|
427
|
-
function withRequester(ctx, fn) {
|
|
428
|
-
return als.run(ctx, fn);
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
// runtime/subsystems/auth/middleware/requester-context.ts
|
|
432
|
-
async function resolveRequesterContext(userContext, req) {
|
|
433
|
-
if (typeof userContext.resolveRequester === "function") {
|
|
434
|
-
const ctx = await userContext.resolveRequester(req);
|
|
435
|
-
return ctx?.userId ? ctx : void 0;
|
|
436
|
-
}
|
|
437
|
-
const userId = await userContext.getCurrentUserId(req);
|
|
438
|
-
return userId ? { userId, organizationId: null } : void 0;
|
|
439
|
-
}
|
|
440
|
-
function makeRequesterContextMiddleware(userContext, options = {}) {
|
|
441
|
-
const onUnresolved = options.onUnresolved ?? "unscoped";
|
|
442
|
-
return (req, _res, next) => {
|
|
443
|
-
resolveRequesterContext(userContext, req).then(
|
|
444
|
-
(ctx) => {
|
|
445
|
-
if (!ctx) {
|
|
446
|
-
next();
|
|
447
|
-
return;
|
|
448
|
-
}
|
|
449
|
-
withRequester(ctx, async () => {
|
|
450
|
-
next();
|
|
451
|
-
});
|
|
452
|
-
},
|
|
453
|
-
(err) => {
|
|
454
|
-
if (onUnresolved === "reject") {
|
|
455
|
-
next(err);
|
|
456
|
-
return;
|
|
457
|
-
}
|
|
458
|
-
next();
|
|
459
|
-
}
|
|
460
|
-
);
|
|
461
|
-
};
|
|
462
|
-
}
|
|
463
|
-
function installRequesterContext(app, options = {}) {
|
|
464
|
-
const userContext = app.get(AUTH_USER_CONTEXT, {
|
|
465
|
-
strict: false
|
|
466
|
-
});
|
|
467
|
-
if (!userContext) {
|
|
468
|
-
console.warn(
|
|
469
|
-
"[auth] installRequesterContext: AUTH_USER_CONTEXT is not bound \u2014 request scoping NOT installed. Provide an IUserContext under AUTH_USER_CONTEXT in your AppModule to enable ambient tenant scoping."
|
|
470
|
-
);
|
|
471
|
-
return;
|
|
472
|
-
}
|
|
473
|
-
app.use(makeRequesterContextMiddleware(userContext, options));
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
// runtime/subsystems/auth/auth.module.ts
|
|
477
|
-
import { Module } from "@nestjs/common";
|
|
478
|
-
|
|
479
|
-
// runtime/constants/tokens.ts
|
|
480
|
-
var DRIZZLE = "DRIZZLE";
|
|
481
|
-
|
|
482
|
-
// runtime/subsystems/auth/auth.module.ts
|
|
483
|
-
function resolveEncryptionKeyProvider(choice) {
|
|
484
|
-
if (choice === "env") {
|
|
485
|
-
return { provide: ENCRYPTION_KEY, useClass: EnvEncryptionKey };
|
|
486
|
-
}
|
|
487
|
-
return { provide: ENCRYPTION_KEY, ...choice };
|
|
488
|
-
}
|
|
489
|
-
function resolveOAuthStateStoreProvider(choice) {
|
|
490
|
-
if (choice === "memory") {
|
|
491
|
-
return { provide: OAUTH_STATE_STORE, useClass: MemoryOAuthStateStore };
|
|
492
|
-
}
|
|
493
|
-
if (choice === "drizzle") {
|
|
494
|
-
return {
|
|
495
|
-
provide: OAUTH_STATE_STORE,
|
|
496
|
-
useFactory: (db) => {
|
|
497
|
-
if (!db) {
|
|
498
|
-
throw new Error(
|
|
499
|
-
"AuthModule.forRoot: oauthStateStore: 'drizzle' selected but DRIZZLE provider is not available. Ensure DatabaseModule (or another provider exposing DRIZZLE) is imported before AuthModule.forRoot."
|
|
500
|
-
);
|
|
501
|
-
}
|
|
502
|
-
return new DrizzleOAuthStateStore(db);
|
|
503
|
-
},
|
|
504
|
-
inject: [{ token: DRIZZLE, optional: true }]
|
|
505
|
-
};
|
|
506
|
-
}
|
|
507
|
-
return { provide: OAUTH_STATE_STORE, ...choice };
|
|
508
|
-
}
|
|
509
|
-
var AuthModule = class {
|
|
510
|
-
static forRoot(options = {}) {
|
|
511
|
-
const resolved = {
|
|
512
|
-
encryptionKey: options.encryptionKey ?? "env",
|
|
513
|
-
oauthStateStore: options.oauthStateStore ?? "memory",
|
|
514
|
-
enableController: options.enableController ?? false,
|
|
515
|
-
redirectUriBase: options.redirectUriBase
|
|
516
|
-
};
|
|
517
|
-
if (resolved.enableController && !resolved.redirectUriBase) {
|
|
518
|
-
throw new Error(
|
|
519
|
-
"AuthModule.forRoot: redirectUriBase is required when enableController: true"
|
|
520
|
-
);
|
|
521
|
-
}
|
|
522
|
-
const encryptionKeyProvider = resolveEncryptionKeyProvider(
|
|
523
|
-
resolved.encryptionKey
|
|
524
|
-
);
|
|
525
|
-
const oauthStateStoreProvider = resolveOAuthStateStoreProvider(
|
|
526
|
-
resolved.oauthStateStore
|
|
527
|
-
);
|
|
528
|
-
const optionsProvider = {
|
|
529
|
-
provide: AUTH_OPTIONS,
|
|
530
|
-
useValue: resolved
|
|
531
|
-
};
|
|
532
|
-
return {
|
|
533
|
-
module: AuthModule,
|
|
534
|
-
global: true,
|
|
535
|
-
providers: [encryptionKeyProvider, oauthStateStoreProvider, optionsProvider],
|
|
536
|
-
controllers: resolved.enableController ? [AuthController] : [],
|
|
537
|
-
exports: [ENCRYPTION_KEY, OAUTH_STATE_STORE, AUTH_OPTIONS]
|
|
538
|
-
};
|
|
539
|
-
}
|
|
540
|
-
};
|
|
541
|
-
AuthModule = __decorateClass([
|
|
542
|
-
Module({})
|
|
543
|
-
], AuthModule);
|
|
3
|
+
OAuth2RefreshStrategy
|
|
4
|
+
} from "../../../chunk-M6QLSLPO.js";
|
|
5
|
+
import {
|
|
6
|
+
ConnectionBrokenError
|
|
7
|
+
} from "../../../chunk-2N4UG4VD.js";
|
|
8
|
+
import {
|
|
9
|
+
withAuthRetry
|
|
10
|
+
} from "../../../chunk-WL67FZGF.js";
|
|
11
|
+
import {
|
|
12
|
+
SessionExpiredError,
|
|
13
|
+
isSessionExpiredError
|
|
14
|
+
} from "../../../chunk-7RELQJIN.js";
|
|
15
|
+
import {
|
|
16
|
+
installRequesterContext,
|
|
17
|
+
makeRequesterContextMiddleware,
|
|
18
|
+
resolveRequesterContext
|
|
19
|
+
} from "../../../chunk-OSQRXVG2.js";
|
|
20
|
+
import {
|
|
21
|
+
AuthModule
|
|
22
|
+
} from "../../../chunk-7LKAMLV4.js";
|
|
23
|
+
import {
|
|
24
|
+
EnvEncryptionKey
|
|
25
|
+
} from "../../../chunk-IP4OO26U.js";
|
|
26
|
+
import {
|
|
27
|
+
DrizzleOAuthStateStore
|
|
28
|
+
} from "../../../chunk-N5OTOWTP.js";
|
|
29
|
+
import {
|
|
30
|
+
MemoryOAuthStateStore
|
|
31
|
+
} from "../../../chunk-QLTJSCE6.js";
|
|
32
|
+
import {
|
|
33
|
+
OAuthStateError
|
|
34
|
+
} from "../../../chunk-BPARRK6F.js";
|
|
35
|
+
import {
|
|
36
|
+
AuthController
|
|
37
|
+
} from "../../../chunk-SZVPIHWE.js";
|
|
38
|
+
import {
|
|
39
|
+
AUTH_CONNECTION_GRANT_SINK,
|
|
40
|
+
AUTH_CONNECTION_READER,
|
|
41
|
+
AUTH_CONNECTION_TOKEN_WRITER,
|
|
42
|
+
AUTH_OPTIONS,
|
|
43
|
+
AUTH_USER_CONTEXT,
|
|
44
|
+
ENCRYPTION_KEY,
|
|
45
|
+
OAUTH_STATE_STORE,
|
|
46
|
+
STRATEGY_REGISTRY
|
|
47
|
+
} from "../../../chunk-6XY6ZMMD.js";
|
|
48
|
+
import {
|
|
49
|
+
authOAuthState
|
|
50
|
+
} from "../../../chunk-NPFPZ2HO.js";
|
|
51
|
+
import "../../../chunk-GYGNEQSC.js";
|
|
52
|
+
import "../../../chunk-ZUKFQL6E.js";
|
|
53
|
+
import "../../../chunk-U64T4YZE.js";
|
|
54
|
+
import "../../../chunk-2E224ZSN.js";
|
|
544
55
|
export {
|
|
545
56
|
AUTH_CONNECTION_GRANT_SINK,
|
|
546
57
|
AUTH_CONNECTION_READER,
|