@effect-app/infra 0.7.0
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/.eslintrc.cjs +11 -0
- package/.jest-cache/haste-map-369fa5ca2164cc35b19159bd76147276-e7a7ff05756c055cb63be97ba8537525-314902b6271c341511f7398a50469024 +0 -0
- package/.jest-cache/haste-map-369fa5ca2164cc35b19159bd76147276-e7a7ff05756c055cb63be97ba8537525-3f072cc7afa09b6adaead0527ab9df83 +0 -0
- package/.jest-cache/haste-map-369fa5ca2164cc35b19159bd76147276-e7a7ff05756c055cb63be97ba8537525-74c3c295c110fc861b6a4c673afc3e24 +0 -0
- package/.jest-cache/haste-map-369fa5ca2164cc35b19159bd76147276-e7a7ff05756c055cb63be97ba8537525-bf6dae8cb9ea9740ceb39aefaf12716c +0 -0
- package/.jest-cache/haste-map-369fa5ca2164cc35b19159bd76147276-e7a7ff05756c055cb63be97ba8537525-cf9d1486029526079a5f68f2041dea02 +0 -0
- package/.jest-cache/haste-map-4ca41cc04e60c616a19cbb483cbf487b-e2f1f4b6d87214e3c49442fed31f310c-b4710ed9fb3d0757c4bf23045c585670 +0 -0
- package/.jest-cache/haste-map-4ca41cc04e60c616a19cbb483cbf487b-e2f1f4b6d87214e3c49442fed31f310c-ee17e5395bb1b7b36a4e2e22a6ae1449 +0 -0
- package/.jest-cache/haste-map-7dc16d7fae8c072843ed1c69eae73100-a8a4225b317477b49bca31f54559afb3-c16136699bb7f463be85273162b447c3 +0 -0
- package/.jest-cache/haste-map-9aa1e395a82e108eb49698982c574272-e2f1f4b6d87214e3c49442fed31f310c-f7435f46fc41ac5a13d06a49cae9a650 +0 -0
- package/.jest-cache/haste-map-9d206b45d610536c9ec65eec263c6964-a8a4225b317477b49bca31f54559afb3-3510506a330b44f1ae629033aac8fbb3 +0 -0
- package/.jest-cache/haste-map-a00ab30d0d656f9d3990958a54b9ccfd-87603b0fc921b26b622a5859b4c92bed-17b550b450b18840c25861aa6e835f0c +0 -0
- package/.jest-cache/haste-map-a00ab30d0d656f9d3990958a54b9ccfd-87603b0fc921b26b622a5859b4c92bed-4dc31290b1efc98335eb4c89167d75c3 +0 -0
- package/.jest-cache/haste-map-ab843cb0ffbadfd0deea4adb182c7ecd-87603b0fc921b26b622a5859b4c92bed-997106edf4bbc31567a378146180e45e +0 -0
- package/.jest-cache/haste-map-ab843cb0ffbadfd0deea4adb182c7ecd-87603b0fc921b26b622a5859b4c92bed-f0cd25414f9ed16c446940ca3aa23c1b +0 -0
- package/.jest-cache/haste-map-cf17f2edf0e949eebfdfca561816457c-e7a7ff05756c055cb63be97ba8537525-2cac07d09e6384e2d37c49714edad0ba +0 -0
- package/.jest-cache/haste-map-cf17f2edf0e949eebfdfca561816457c-e7a7ff05756c055cb63be97ba8537525-d7967c2976c5feac7161c964f0aa442f +0 -0
- package/.jest-cache/haste-map-fb1a173276d25bbff02f815600059283-938122bdc1c8836874b6585d7acb2e99-f705929cca05ce95ceaa6d520b560ce8 +0 -0
- package/.prettierignore +6 -0
- package/_cjs/_global.cjs +6 -0
- package/_cjs/_global.cjs.map +1 -0
- package/_cjs/_global.ext.cjs +6 -0
- package/_cjs/_global.ext.cjs.map +1 -0
- package/_cjs/_global.schema.cjs +5 -0
- package/_cjs/_global.schema.cjs.map +1 -0
- package/_cjs/errors.cjs +82 -0
- package/_cjs/errors.cjs.map +1 -0
- package/_cjs/ext.cjs +4 -0
- package/_cjs/ext.cjs.map +1 -0
- package/_cjs/index.cjs +6 -0
- package/_cjs/index.cjs.map +1 -0
- package/_cjs/lib/RequestContext.cjs +70 -0
- package/_cjs/lib/RequestContext.cjs.map +1 -0
- package/_cjs/lib/api/authorization.jwt.cjs +44 -0
- package/_cjs/lib/api/authorization.jwt.cjs.map +1 -0
- package/_cjs/lib/api/defaultErrorHandler.cjs +45 -0
- package/_cjs/lib/api/defaultErrorHandler.cjs.map +1 -0
- package/_cjs/lib/api/reportError.cjs +64 -0
- package/_cjs/lib/api/reportError.cjs.map +1 -0
- package/_cjs/lib/api/routing.cjs +262 -0
- package/_cjs/lib/api/routing.cjs.map +1 -0
- package/_cjs/lib/api/setupRequest.cjs +35 -0
- package/_cjs/lib/api/setupRequest.cjs.map +1 -0
- package/_cjs/lib/api/util.cjs +17 -0
- package/_cjs/lib/api/util.cjs.map +1 -0
- package/_cjs/lib/api/writeDocs.cjs +31 -0
- package/_cjs/lib/api/writeDocs.cjs.map +1 -0
- package/_cjs/lib/errorReporter.cjs +72 -0
- package/_cjs/lib/errorReporter.cjs.map +1 -0
- package/_cjs/lib/ext/Array.cjs +30 -0
- package/_cjs/lib/ext/Array.cjs.map +1 -0
- package/_cjs/lib/fileUtil.cjs +36 -0
- package/_cjs/lib/fileUtil.cjs.map +1 -0
- package/_cjs/lib/filter/types/errors.cjs +6 -0
- package/_cjs/lib/filter/types/errors.cjs.map +1 -0
- package/_cjs/lib/filter/types/fields.cjs +6 -0
- package/_cjs/lib/filter/types/fields.cjs.map +1 -0
- package/_cjs/lib/filter/types/index.cjs +61 -0
- package/_cjs/lib/filter/types/index.cjs.map +1 -0
- package/_cjs/lib/filter/types/path/common.cjs +6 -0
- package/_cjs/lib/filter/types/path/common.cjs.map +1 -0
- package/_cjs/lib/filter/types/path/eager.cjs +6 -0
- package/_cjs/lib/filter/types/path/eager.cjs.map +1 -0
- package/_cjs/lib/filter/types/path/index.cjs +8 -0
- package/_cjs/lib/filter/types/path/index.cjs.map +1 -0
- package/_cjs/lib/filter/types/utils.cjs +6 -0
- package/_cjs/lib/filter/types/utils.cjs.map +1 -0
- package/_cjs/lib/filter/types/validator.cjs +6 -0
- package/_cjs/lib/filter/types/validator.cjs.map +1 -0
- package/_cjs/lib/filter.cjs +238 -0
- package/_cjs/lib/filter.cjs.map +1 -0
- package/_cjs/lib/instrument.cjs +20 -0
- package/_cjs/lib/instrument.cjs.map +1 -0
- package/_cjs/lib/rateLimit.cjs +88 -0
- package/_cjs/lib/rateLimit.cjs.map +1 -0
- package/_cjs/services/CUPS/service.cjs +15 -0
- package/_cjs/services/CUPS/service.cjs.map +1 -0
- package/_cjs/services/CUPS.cjs +113 -0
- package/_cjs/services/CUPS.cjs.map +1 -0
- package/_cjs/services/Cache.cjs +39 -0
- package/_cjs/services/Cache.cjs.map +1 -0
- package/_cjs/services/Emailer/Sendgrid.cjs +112 -0
- package/_cjs/services/Emailer/Sendgrid.cjs.map +1 -0
- package/_cjs/services/Emailer/fake.cjs +24 -0
- package/_cjs/services/Emailer/fake.cjs.map +1 -0
- package/_cjs/services/Emailer/service.cjs +12 -0
- package/_cjs/services/Emailer/service.cjs.map +1 -0
- package/_cjs/services/Emailer.cjs +17 -0
- package/_cjs/services/Emailer.cjs.map +1 -0
- package/_cjs/services/Repository.cjs +247 -0
- package/_cjs/services/Repository.cjs.map +1 -0
- package/_cjs/services/ServiceBus.cjs +69 -0
- package/_cjs/services/ServiceBus.cjs.map +1 -0
- package/_cjs/services/Store/Cosmos.cjs +324 -0
- package/_cjs/services/Store/Cosmos.cjs.map +1 -0
- package/_cjs/services/Store/Cosmos.test.cjs +59 -0
- package/_cjs/services/Store/Cosmos.test.cjs.map +1 -0
- package/_cjs/services/Store/Disk.cjs +62 -0
- package/_cjs/services/Store/Disk.cjs.map +1 -0
- package/_cjs/services/Store/Memory.cjs +70 -0
- package/_cjs/services/Store/Memory.cjs.map +1 -0
- package/_cjs/services/Store/Redis.cjs +72 -0
- package/_cjs/services/Store/Redis.cjs.map +1 -0
- package/_cjs/services/Store/codeFilter.test.cjs +61 -0
- package/_cjs/services/Store/codeFilter.test.cjs.map +1 -0
- package/_cjs/services/Store/index.cjs +72 -0
- package/_cjs/services/Store/index.cjs.map +1 -0
- package/_cjs/services/Store/service.cjs +72 -0
- package/_cjs/services/Store/service.cjs.map +1 -0
- package/_cjs/services/Store/utils.cjs +78 -0
- package/_cjs/services/Store/utils.cjs.map +1 -0
- package/_cjs/services/Store.cjs +17 -0
- package/_cjs/services/Store.cjs.map +1 -0
- package/_cjs/services/memQueue.cjs +32 -0
- package/_cjs/services/memQueue.cjs.map +1 -0
- package/_cjs/test.arbs.cjs +32 -0
- package/_cjs/test.arbs.cjs.map +1 -0
- package/_cjs/vendor/Cache/Cache/_internal/AtomicBoolean.cjs +14 -0
- package/_cjs/vendor/Cache/Cache/_internal/AtomicBoolean.cjs.map +1 -0
- package/_cjs/vendor/Cache/Cache/_internal/AtomicNumber.cjs +29 -0
- package/_cjs/vendor/Cache/Cache/_internal/AtomicNumber.cjs.map +1 -0
- package/_cjs/vendor/Cache/Cache/_internal/AtomicReference.cjs +32 -0
- package/_cjs/vendor/Cache/Cache/_internal/AtomicReference.cjs.map +1 -0
- package/_cjs/vendor/Cache/Cache/_internal/CacheInternal.cjs +266 -0
- package/_cjs/vendor/Cache/Cache/_internal/CacheInternal.cjs.map +1 -0
- package/_cjs/vendor/Cache/Cache/_internal/CacheState.cjs +31 -0
- package/_cjs/vendor/Cache/Cache/_internal/CacheState.cjs.map +1 -0
- package/_cjs/vendor/Cache/Cache/_internal/KeySet.cjs +67 -0
- package/_cjs/vendor/Cache/Cache/_internal/KeySet.cjs.map +1 -0
- package/_cjs/vendor/Cache/Cache/_internal/MapKey.cjs +44 -0
- package/_cjs/vendor/Cache/Cache/_internal/MapKey.cjs.map +1 -0
- package/_cjs/vendor/Cache/Cache/_internal/MapValue.cjs +33 -0
- package/_cjs/vendor/Cache/Cache/_internal/MapValue.cjs.map +1 -0
- package/_cjs/vendor/Cache/Cache/definition.cjs +13 -0
- package/_cjs/vendor/Cache/Cache/definition.cjs.map +1 -0
- package/_cjs/vendor/Cache/Cache/operations/make.cjs +20 -0
- package/_cjs/vendor/Cache/Cache/operations/make.cjs.map +1 -0
- package/_cjs/vendor/Cache/Cache/operations/makeWith.cjs +23 -0
- package/_cjs/vendor/Cache/Cache/operations/makeWith.cjs.map +1 -0
- package/_cjs/vendor/Cache/Cache/operations.cjs +28 -0
- package/_cjs/vendor/Cache/Cache/operations.cjs.map +1 -0
- package/_cjs/vendor/Cache/Cache.cjs +28 -0
- package/_cjs/vendor/Cache/Cache.cjs.map +1 -0
- package/_cjs/vendor/Cache/CacheStats/definition.cjs +13 -0
- package/_cjs/vendor/Cache/CacheStats/definition.cjs.map +1 -0
- package/_cjs/vendor/Cache/CacheStats.cjs +17 -0
- package/_cjs/vendor/Cache/CacheStats.cjs.map +1 -0
- package/_cjs/vendor/Cache/EntryStats/definition.cjs +11 -0
- package/_cjs/vendor/Cache/EntryStats/definition.cjs.map +1 -0
- package/_cjs/vendor/Cache/EntryStats.cjs +17 -0
- package/_cjs/vendor/Cache/EntryStats.cjs.map +1 -0
- package/_cjs/vendor/Cache/Lookup/definition.cjs +6 -0
- package/_cjs/vendor/Cache/Lookup/definition.cjs.map +1 -0
- package/_cjs/vendor/Cache/Lookup.cjs +17 -0
- package/_cjs/vendor/Cache/Lookup.cjs.map +1 -0
- package/_cjs/vendor/Cache/index.cjs +17 -0
- package/_cjs/vendor/Cache/index.cjs.map +1 -0
- package/_src/_global.ext.ts +34 -0
- package/_src/_global.schema.ts +10 -0
- package/_src/_global.ts +14 -0
- package/_src/errors.ts +50 -0
- package/_src/ext.ts +1 -0
- package/_src/index.ts +0 -0
- package/_src/lib/RequestContext.ts +132 -0
- package/_src/lib/api/authorization.jwt.ts +52 -0
- package/_src/lib/api/defaultErrorHandler.ts +92 -0
- package/_src/lib/api/reportError.ts +50 -0
- package/_src/lib/api/routing.ts +623 -0
- package/_src/lib/api/setupRequest.ts +22 -0
- package/_src/lib/api/util.ts +14 -0
- package/_src/lib/api/writeDocs.ts +26 -0
- package/_src/lib/errorReporter.ts +63 -0
- package/_src/lib/ext/Array.ts +32 -0
- package/_src/lib/fileUtil.ts +56 -0
- package/_src/lib/filter/types/errors.ts +47 -0
- package/_src/lib/filter/types/fields.ts +50 -0
- package/_src/lib/filter/types/index.ts +5 -0
- package/_src/lib/filter/types/path/common.ts +404 -0
- package/_src/lib/filter/types/path/eager.ts +146 -0
- package/_src/lib/filter/types/path/index.ts +14 -0
- package/_src/lib/filter/types/utils.ts +106 -0
- package/_src/lib/filter/types/validator.ts +46 -0
- package/_src/lib/filter.ts +323 -0
- package/_src/lib/instrument.ts +9 -0
- package/_src/lib/rateLimit.ts +126 -0
- package/_src/services/CUPS/service.ts +16 -0
- package/_src/services/CUPS.ts +105 -0
- package/_src/services/Cache.ts +45 -0
- package/_src/services/Emailer/Sendgrid.ts +123 -0
- package/_src/services/Emailer/fake.ts +14 -0
- package/_src/services/Emailer/service.ts +33 -0
- package/_src/services/Emailer.ts +1 -0
- package/_src/services/Repository.ts +513 -0
- package/_src/services/ServiceBus.ts +111 -0
- package/_src/services/Store/Cosmos.test.ts +91 -0
- package/_src/services/Store/Cosmos.ts +545 -0
- package/_src/services/Store/Disk.ts +81 -0
- package/_src/services/Store/Memory.ts +77 -0
- package/_src/services/Store/Redis.ts +92 -0
- package/_src/services/Store/codeFilter.test.ts +74 -0
- package/_src/services/Store/index.test.ts.bak +112 -0
- package/_src/services/Store/index.ts +62 -0
- package/_src/services/Store/service.ts +174 -0
- package/_src/services/Store/utils.ts +126 -0
- package/_src/services/Store.ts +1 -0
- package/_src/services/memQueue.ts +30 -0
- package/_src/test.arbs.ts +27 -0
- package/_src/vendor/Cache/Cache/_internal/AtomicBoolean.ts +7 -0
- package/_src/vendor/Cache/Cache/_internal/AtomicNumber.ts +28 -0
- package/_src/vendor/Cache/Cache/_internal/AtomicReference.ts +30 -0
- package/_src/vendor/Cache/Cache/_internal/CacheInternal.ts +293 -0
- package/_src/vendor/Cache/Cache/_internal/CacheState.ts +56 -0
- package/_src/vendor/Cache/Cache/_internal/KeySet.ts +58 -0
- package/_src/vendor/Cache/Cache/_internal/MapKey.ts +43 -0
- package/_src/vendor/Cache/Cache/_internal/MapValue.ts +39 -0
- package/_src/vendor/Cache/Cache/definition.ts +112 -0
- package/_src/vendor/Cache/Cache/operations/make.ts +17 -0
- package/_src/vendor/Cache/Cache/operations/makeWith.ts +32 -0
- package/_src/vendor/Cache/Cache/operations.ts +4 -0
- package/_src/vendor/Cache/Cache.ts +4 -0
- package/_src/vendor/Cache/CacheStats/definition.ts +23 -0
- package/_src/vendor/Cache/CacheStats.ts +3 -0
- package/_src/vendor/Cache/EntryStats/definition.ts +19 -0
- package/_src/vendor/Cache/EntryStats.ts +3 -0
- package/_src/vendor/Cache/Lookup/definition.ts +15 -0
- package/_src/vendor/Cache/Lookup.ts +3 -0
- package/_src/vendor/Cache/global.ts.bak +23 -0
- package/_src/vendor/Cache/index.ts +4 -0
- package/dist/_global.d.ts +10 -0
- package/dist/_global.d.ts.map +1 -0
- package/dist/_global.ext.d.ts +34 -0
- package/dist/_global.ext.d.ts.map +1 -0
- package/dist/_global.ext.js +2 -0
- package/dist/_global.js +12 -0
- package/dist/_global.schema.d.ts +6 -0
- package/dist/_global.schema.d.ts.map +1 -0
- package/dist/_global.schema.js +9 -0
- package/dist/errors.d.ts +41 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +51 -0
- package/dist/ext.d.ts +2 -0
- package/dist/ext.d.ts.map +1 -0
- package/dist/ext.js +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/lib/RequestContext.d.ts +122 -0
- package/dist/lib/RequestContext.d.ts.map +1 -0
- package/dist/lib/RequestContext.js +52 -0
- package/dist/lib/api/authorization.jwt.d.ts +7 -0
- package/dist/lib/api/authorization.jwt.d.ts.map +1 -0
- package/dist/lib/api/authorization.jwt.js +32 -0
- package/dist/lib/api/defaultErrorHandler.d.ts +8 -0
- package/dist/lib/api/defaultErrorHandler.d.ts.map +1 -0
- package/dist/lib/api/defaultErrorHandler.js +37 -0
- package/dist/lib/api/reportError.d.ts +32 -0
- package/dist/lib/api/reportError.d.ts.map +1 -0
- package/dist/lib/api/reportError.js +44 -0
- package/dist/lib/api/routing.d.ts +100 -0
- package/dist/lib/api/routing.d.ts.map +1 -0
- package/dist/lib/api/routing.js +248 -0
- package/dist/lib/api/setupRequest.d.ts +13 -0
- package/dist/lib/api/setupRequest.d.ts.map +1 -0
- package/dist/lib/api/setupRequest.js +25 -0
- package/dist/lib/api/util.d.ts +3 -0
- package/dist/lib/api/util.d.ts.map +1 -0
- package/dist/lib/api/util.js +14 -0
- package/dist/lib/api/writeDocs.d.ts +3 -0
- package/dist/lib/api/writeDocs.d.ts.map +1 -0
- package/dist/lib/api/writeDocs.js +23 -0
- package/dist/lib/errorReporter.d.ts +8 -0
- package/dist/lib/errorReporter.d.ts.map +1 -0
- package/dist/lib/errorReporter.js +45 -0
- package/dist/lib/ext/Array.d.ts +19 -0
- package/dist/lib/ext/Array.d.ts.map +1 -0
- package/dist/lib/ext/Array.js +21 -0
- package/dist/lib/fileUtil.d.ts +22 -0
- package/dist/lib/fileUtil.d.ts.map +1 -0
- package/dist/lib/fileUtil.js +23 -0
- package/dist/lib/filter/types/errors.d.ts +30 -0
- package/dist/lib/filter/types/errors.d.ts.map +1 -0
- package/dist/lib/filter/types/errors.js +2 -0
- package/dist/lib/filter/types/fields.d.ts +29 -0
- package/dist/lib/filter/types/fields.d.ts.map +1 -0
- package/dist/lib/filter/types/fields.js +2 -0
- package/dist/lib/filter/types/index.d.ts +6 -0
- package/dist/lib/filter/types/index.d.ts.map +1 -0
- package/dist/lib/filter/types/index.js +6 -0
- package/dist/lib/filter/types/path/common.d.ts +316 -0
- package/dist/lib/filter/types/path/common.d.ts.map +1 -0
- package/dist/lib/filter/types/path/common.js +2 -0
- package/dist/lib/filter/types/path/eager.d.ts +95 -0
- package/dist/lib/filter/types/path/eager.d.ts.map +1 -0
- package/dist/lib/filter/types/path/eager.js +2 -0
- package/dist/lib/filter/types/path/index.d.ts +4 -0
- package/dist/lib/filter/types/path/index.d.ts.map +1 -0
- package/dist/lib/filter/types/path/index.js +4 -0
- package/dist/lib/filter/types/utils.d.ts +68 -0
- package/dist/lib/filter/types/utils.d.ts.map +1 -0
- package/dist/lib/filter/types/utils.js +2 -0
- package/dist/lib/filter/types/validator.d.ts +30 -0
- package/dist/lib/filter/types/validator.d.ts.map +1 -0
- package/dist/lib/filter/types/validator.js +2 -0
- package/dist/lib/filter.d.ts +133 -0
- package/dist/lib/filter.d.ts.map +1 -0
- package/dist/lib/filter.js +171 -0
- package/dist/lib/instrument.d.ts +7 -0
- package/dist/lib/instrument.d.ts.map +1 -0
- package/dist/lib/instrument.js +12 -0
- package/dist/lib/rateLimit.d.ts +43 -0
- package/dist/lib/rateLimit.d.ts.map +1 -0
- package/dist/lib/rateLimit.js +76 -0
- package/dist/services/CUPS/service.d.ts +19 -0
- package/dist/services/CUPS/service.d.ts.map +1 -0
- package/dist/services/CUPS/service.js +5 -0
- package/dist/services/CUPS.d.ts +10 -0
- package/dist/services/CUPS.d.ts.map +1 -0
- package/dist/services/CUPS.js +89 -0
- package/dist/services/Cache.d.ts +28 -0
- package/dist/services/Cache.d.ts.map +1 -0
- package/dist/services/Cache.js +28 -0
- package/dist/services/Emailer/Sendgrid.d.ts +180 -0
- package/dist/services/Emailer/Sendgrid.d.ts.map +1 -0
- package/dist/services/Emailer/Sendgrid.js +102 -0
- package/dist/services/Emailer/fake.d.ts +7 -0
- package/dist/services/Emailer/fake.d.ts.map +1 -0
- package/dist/services/Emailer/fake.js +15 -0
- package/dist/services/Emailer/service.d.ts +41 -0
- package/dist/services/Emailer/service.d.ts.map +1 -0
- package/dist/services/Emailer/service.js +3 -0
- package/dist/services/Emailer.d.ts +2 -0
- package/dist/services/Emailer.d.ts.map +1 -0
- package/dist/services/Emailer.js +2 -0
- package/dist/services/Repository.d.ts +300 -0
- package/dist/services/Repository.d.ts.map +1 -0
- package/dist/services/Repository.js +193 -0
- package/dist/services/ServiceBus.d.ts +26 -0
- package/dist/services/ServiceBus.d.ts.map +1 -0
- package/dist/services/ServiceBus.js +53 -0
- package/dist/services/Store/Cosmos.d.ts +56 -0
- package/dist/services/Store/Cosmos.d.ts.map +1 -0
- package/dist/services/Store/Cosmos.js +321 -0
- package/dist/services/Store/Cosmos.test.d.ts.map +1 -0
- package/dist/services/Store/Disk.d.ts +14 -0
- package/dist/services/Store/Disk.d.ts.map +1 -0
- package/dist/services/Store/Disk.js +52 -0
- package/dist/services/Store/Memory.d.ts +17 -0
- package/dist/services/Store/Memory.d.ts.map +1 -0
- package/dist/services/Store/Memory.js +60 -0
- package/dist/services/Store/Redis.d.ts +12 -0
- package/dist/services/Store/Redis.d.ts.map +1 -0
- package/dist/services/Store/Redis.js +59 -0
- package/dist/services/Store/codeFilter.test.d.ts.map +1 -0
- package/dist/services/Store/index.d.ts +10 -0
- package/dist/services/Store/index.d.ts.map +1 -0
- package/dist/services/Store/index.js +52 -0
- package/dist/services/Store/service.d.ts +113 -0
- package/dist/services/Store/service.d.ts.map +1 -0
- package/dist/services/Store/service.js +63 -0
- package/dist/services/Store/utils.d.ts +14 -0
- package/dist/services/Store/utils.d.ts.map +1 -0
- package/dist/services/Store/utils.js +103 -0
- package/dist/services/Store.d.ts +2 -0
- package/dist/services/Store.d.ts.map +1 -0
- package/dist/services/Store.js +2 -0
- package/dist/services/memQueue.d.ts +18 -0
- package/dist/services/memQueue.d.ts.map +1 -0
- package/dist/services/memQueue.js +24 -0
- package/dist/test.arbs.d.ts +13 -0
- package/dist/test.arbs.d.ts.map +1 -0
- package/dist/test.arbs.js +22 -0
- package/dist/vendor/Cache/Cache/_internal/AtomicBoolean.d.ts +5 -0
- package/dist/vendor/Cache/Cache/_internal/AtomicBoolean.d.ts.map +1 -0
- package/dist/vendor/Cache/Cache/_internal/AtomicBoolean.js +7 -0
- package/dist/vendor/Cache/Cache/_internal/AtomicNumber.d.ts +8 -0
- package/dist/vendor/Cache/Cache/_internal/AtomicNumber.d.ts.map +1 -0
- package/dist/vendor/Cache/Cache/_internal/AtomicNumber.js +22 -0
- package/dist/vendor/Cache/Cache/_internal/AtomicReference.d.ts +10 -0
- package/dist/vendor/Cache/Cache/_internal/AtomicReference.d.ts.map +1 -0
- package/dist/vendor/Cache/Cache/_internal/AtomicReference.js +25 -0
- package/dist/vendor/Cache/Cache/_internal/CacheInternal.d.ts +51 -0
- package/dist/vendor/Cache/Cache/_internal/CacheInternal.d.ts.map +1 -0
- package/dist/vendor/Cache/Cache/_internal/CacheInternal.js +253 -0
- package/dist/vendor/Cache/Cache/_internal/CacheState.d.ts +33 -0
- package/dist/vendor/Cache/Cache/_internal/CacheState.d.ts.map +1 -0
- package/dist/vendor/Cache/Cache/_internal/CacheState.js +21 -0
- package/dist/vendor/Cache/Cache/_internal/KeySet.d.ts +20 -0
- package/dist/vendor/Cache/Cache/_internal/KeySet.d.ts.map +1 -0
- package/dist/vendor/Cache/Cache/_internal/KeySet.js +61 -0
- package/dist/vendor/Cache/Cache/_internal/MapKey.d.ts +24 -0
- package/dist/vendor/Cache/Cache/_internal/MapKey.d.ts.map +1 -0
- package/dist/vendor/Cache/Cache/_internal/MapKey.js +37 -0
- package/dist/vendor/Cache/Cache/_internal/MapValue.d.ts +32 -0
- package/dist/vendor/Cache/Cache/_internal/MapValue.d.ts.map +1 -0
- package/dist/vendor/Cache/Cache/_internal/MapValue.js +24 -0
- package/dist/vendor/Cache/Cache/definition.d.ts +100 -0
- package/dist/vendor/Cache/Cache/definition.d.ts.map +1 -0
- package/dist/vendor/Cache/Cache/definition.js +5 -0
- package/dist/vendor/Cache/Cache/operations/make.d.ts +12 -0
- package/dist/vendor/Cache/Cache/operations/make.d.ts.map +1 -0
- package/dist/vendor/Cache/Cache/operations/make.js +12 -0
- package/dist/vendor/Cache/Cache/operations/makeWith.d.ts +14 -0
- package/dist/vendor/Cache/Cache/operations/makeWith.d.ts.map +1 -0
- package/dist/vendor/Cache/Cache/operations/makeWith.js +15 -0
- package/dist/vendor/Cache/Cache/operations.d.ts +3 -0
- package/dist/vendor/Cache/Cache/operations.d.ts.map +1 -0
- package/dist/vendor/Cache/Cache/operations.js +4 -0
- package/dist/vendor/Cache/Cache.d.ts +3 -0
- package/dist/vendor/Cache/Cache.d.ts.map +1 -0
- package/dist/vendor/Cache/Cache.js +4 -0
- package/dist/vendor/Cache/CacheStats/definition.d.ts +19 -0
- package/dist/vendor/Cache/CacheStats/definition.d.ts.map +1 -0
- package/dist/vendor/Cache/CacheStats/definition.js +6 -0
- package/dist/vendor/Cache/CacheStats.d.ts +2 -0
- package/dist/vendor/Cache/CacheStats.d.ts.map +1 -0
- package/dist/vendor/Cache/CacheStats.js +3 -0
- package/dist/vendor/Cache/EntryStats/definition.d.ts +17 -0
- package/dist/vendor/Cache/EntryStats/definition.d.ts.map +1 -0
- package/dist/vendor/Cache/EntryStats/definition.js +4 -0
- package/dist/vendor/Cache/EntryStats.d.ts +2 -0
- package/dist/vendor/Cache/EntryStats.d.ts.map +1 -0
- package/dist/vendor/Cache/EntryStats.js +3 -0
- package/dist/vendor/Cache/Lookup/definition.d.ts +17 -0
- package/dist/vendor/Cache/Lookup/definition.d.ts.map +1 -0
- package/dist/vendor/Cache/Lookup/definition.js +2 -0
- package/dist/vendor/Cache/Lookup.d.ts +2 -0
- package/dist/vendor/Cache/Lookup.d.ts.map +1 -0
- package/dist/vendor/Cache/Lookup.js +3 -0
- package/dist/vendor/Cache/index.d.ts +5 -0
- package/dist/vendor/Cache/index.d.ts.map +1 -0
- package/dist/vendor/Cache/index.js +5 -0
- package/package.json +756 -0
- package/tsconfig.json +107 -0
- package/tsconfig.json.bak +47 -0
- package/tsplus.config.json +6 -0
- package/types/modules.d.ts +1 -0
- package/vitest.config.ts +5 -0
- package/wallaby.cjs +1 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Cache = void 0;
|
|
7
|
+
exports.make = make;
|
|
8
|
+
exports.results = results;
|
|
9
|
+
var tracer_1 = _interopRequireWildcard(require("@effect/io/Debug"));
|
|
10
|
+
var tsplus_module_1 = _interopRequireWildcard(require("@fp-ts/data/Chunk"));
|
|
11
|
+
var tsplus_module_2 = _interopRequireWildcard(require("@effect/io/Effect"));
|
|
12
|
+
var _Cache = require("../vendor/Cache/Cache.cjs");
|
|
13
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
14
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
|
+
const fileName_1 = "packages/infra/_src/services/Cache.ts";
|
|
16
|
+
const fileName_2 = "/Users/patrickroza/Projects/effect-ts-app/libs/packages/infra/_src/services/Cache.ts";
|
|
17
|
+
const Cache = {};
|
|
18
|
+
/**
|
|
19
|
+
* @tsplus static ets/cache/CacheOps make
|
|
20
|
+
*/
|
|
21
|
+
exports.Cache = Cache;
|
|
22
|
+
function make(capacity, duration, lookup) {
|
|
23
|
+
return (0, _Cache.make)(capacity, duration, lookup, fileName_2 + ":27:15");
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* @tsplus getter ets/cache/Cache results
|
|
27
|
+
*/
|
|
28
|
+
function results(self) {
|
|
29
|
+
return tracer_1.withCallTrace(fileName_1 + ":36:10")(tsplus_module_2.sync(() => {
|
|
30
|
+
const values = [];
|
|
31
|
+
for (const [key, value] of self.cacheState.map) {
|
|
32
|
+
if (value._tag === "Complete") {
|
|
33
|
+
values.push([key, value.exit]);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return tsplus_module_1.fromIterable(values);
|
|
37
|
+
}));
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=Cache.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Cache.cjs","mappings":";;;;;;;;;;;AACA;AAAwD;AAAA;;;AAejD,MAAMA,KAAK,GAAa,EAAE;AAEjC;;;AAAA;AAGM,SAAUC,IAAI,CAClBC,QAAgB,EAChBC,QAAa,EACbC,MAA8C;EAE9C,OAAO,eAAK,EAACF,QAAQ,EAAEC,QAAQ,EAAEC,MAAM,wBAAyD;AAClG;AAEA;;;AAGM,SAAUC,OAAO,CACrBC,IAA8B;EAE9B,qDAAOC,qBAAO,MAAK;IACjB,MAAMC,MAAM,GAAqC,EAAE;IACnD,KAAK,MAAM,CAACC,GAAG,EAAEC,KAAK,CAAC,IAAMJ,IAAY,CAACK,UAA4C,CAACC,GAAG,EAAE;MAC1F,IAAIF,KAAK,CAACG,IAAI,KAAK,UAAU,EAAE;QAC7BL,MAAM,CAACM,IAAI,CAAC,CAACL,GAAG,EAAEC,KAAK,CAACK,IAAI,CAAC,CAAC;;;IAGlC,OAAOC,6BAAmBR,MAAM,CAAC;EACnC,CAAC,CAAC;AACJ","names":["Cache","make","capacity","duration","lookup","results","self","tsplus_module_2","values","key","value","cacheState","map","_tag","push","exit","tsplus_module_1"],"sourceRoot":"","sources":["../../_src/services/Cache.ts"],"sourcesContent":[null]}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.LiveSendgrid = LiveSendgrid;
|
|
7
|
+
exports.isTestAddress = isTestAddress;
|
|
8
|
+
exports.renderMessage = renderMessage;
|
|
9
|
+
var tracer_1 = _interopRequireWildcard(require("@effect/io/Debug"));
|
|
10
|
+
var tsplus_module_1 = _interopRequireWildcard(require("@effect/io/Config/Secret"));
|
|
11
|
+
var tsplus_module_2 = _interopRequireWildcard(require("@effect/io/Effect"));
|
|
12
|
+
var tsplus_module_3 = _interopRequireWildcard(require("@effect-app/core/Prelude"));
|
|
13
|
+
var tsplus_module_4 = _interopRequireWildcard(require("@effect-app/core/_ext/ord.ext"));
|
|
14
|
+
var tsplus_module_5 = _interopRequireWildcard(require("@effect-app/core/Array"));
|
|
15
|
+
var _mail = _interopRequireDefault(require("@sendgrid/mail"));
|
|
16
|
+
var _util = require("util");
|
|
17
|
+
var _service = require("./service.cjs");
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
20
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
|
+
const fileName_1 = "packages/infra/_src/services/Emailer/Sendgrid.ts";
|
|
22
|
+
const makeLiveSendgrid = ({
|
|
23
|
+
apiKey,
|
|
24
|
+
defaultFrom,
|
|
25
|
+
realMail,
|
|
26
|
+
subjectPrefix
|
|
27
|
+
}) => tracer_1.withCallTrace(fileName_1 + ":8:3")(tsplus_module_2.sync(() => {
|
|
28
|
+
_mail.default.setApiKey(tsplus_module_1.value(apiKey));
|
|
29
|
+
return {
|
|
30
|
+
sendMail(msg_) {
|
|
31
|
+
return tracer_1.withCallTrace(fileName_1 + ":13:23")(tsplus_module_2.gen(function* ($) {
|
|
32
|
+
const msg = {
|
|
33
|
+
...msg_,
|
|
34
|
+
from: msg_.from ?? defaultFrom
|
|
35
|
+
};
|
|
36
|
+
const render = renderMessage(!realMail);
|
|
37
|
+
const renderedMsg_ = render(msg);
|
|
38
|
+
const renderedMsg = {
|
|
39
|
+
...renderedMsg_,
|
|
40
|
+
subject: `${subjectPrefix}${renderedMsg_.subject}`
|
|
41
|
+
};
|
|
42
|
+
yield* $(tracer_1.withCallTrace(fileName_1 + ":19:53")(tsplus_module_2.logAnnotate("msg", (0, _util.inspect)(renderedMsg, false, 5)))(tracer_1.withCallTrace(fileName_1 + ":19:27")(tsplus_module_2.logDebug("Sending email"))));
|
|
43
|
+
const ret = yield* $(tracer_1.withCallTrace(fileName_1 + ":22:20")(tsplus_module_2.async(cb => void _mail.default.send(renderedMsg, false, (err, result) => err ? cb(tracer_1.withCallTrace(fileName_1 + ":30:31")(tsplus_module_2.fail(err))) : cb(tracer_1.withCallTrace(fileName_1 + ":31:24")(tsplus_module_2.sync(() => result)))))));
|
|
44
|
+
// const event = {
|
|
45
|
+
// name: "EmailSent",
|
|
46
|
+
// properties: {
|
|
47
|
+
// templateId: msg.templateId
|
|
48
|
+
// }
|
|
49
|
+
// }
|
|
50
|
+
// yield* $(Effect.logDebug("Tracking email event").logAnnotate("event", event.$$.pretty))
|
|
51
|
+
// const { trackEvent } = yield* $(AiContextService.access)
|
|
52
|
+
// trackEvent(event)
|
|
53
|
+
return ret;
|
|
54
|
+
}));
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
})
|
|
58
|
+
/**
|
|
59
|
+
* @tsplus static Emailer.Ops LiveSendgrid
|
|
60
|
+
*/);
|
|
61
|
+
/**
|
|
62
|
+
* @tsplus static Emailer.Ops LiveSendgrid
|
|
63
|
+
*/
|
|
64
|
+
function LiveSendgrid(config) {
|
|
65
|
+
return tsplus_module_2.toLayer(_service.Emailer)(tracer_1.withCallTrace(fileName_1 + ":55:6")(tsplus_module_2.flatMap(makeLiveSendgrid))(tsplus_module_2.config(config)));
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* @hidden
|
|
69
|
+
*/
|
|
70
|
+
function renderMessage(forceFake) {
|
|
71
|
+
let i = 0;
|
|
72
|
+
const makeId = () => i++;
|
|
73
|
+
return forceFake ? msg => ({
|
|
74
|
+
...msg,
|
|
75
|
+
to: msg.to && renderFake(msg.to, makeId),
|
|
76
|
+
cc: msg.cc && renderFake(msg.cc, makeId),
|
|
77
|
+
bcc: msg.bcc && renderFake(msg.bcc, makeId)
|
|
78
|
+
}) : msg => ({
|
|
79
|
+
...msg,
|
|
80
|
+
to: msg.to && renderFakeIfTest(msg.to, makeId),
|
|
81
|
+
cc: msg.cc && renderFakeIfTest(msg.cc, makeId),
|
|
82
|
+
bcc: msg.bcc && renderFakeIfTest(msg.bcc, makeId)
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* @hidden
|
|
87
|
+
*/
|
|
88
|
+
function isTestAddress(to) {
|
|
89
|
+
return typeof to === "string" && to.toLowerCase().endsWith(".test") || typeof to === "object" && "email" in to && to.email.toLowerCase().endsWith(".test");
|
|
90
|
+
}
|
|
91
|
+
function renderFake(addr, makeId) {
|
|
92
|
+
return {
|
|
93
|
+
name: renderMailData(addr),
|
|
94
|
+
email: `test+${makeId()}@nomizz.com`
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
const eq = tsplus_module_4.EqlContramap(tsplus_module_3.Equal.string, to => typeof to === "string" ? to.toLowerCase() : to.email.toLowerCase());
|
|
98
|
+
// TODO: should just not add any already added email address
|
|
99
|
+
// https://stackoverflow.com/a/53603076/11595834
|
|
100
|
+
function renderFakeIfTest(addr, makeId) {
|
|
101
|
+
return Array.isArray(addr) ? tsplus_module_5.iterableToArray(tsplus_module_4.uniqArray(eq)(addr.map(x => isTestAddress(x) ? renderFake(x, makeId) : x))) : isTestAddress(addr) ? renderFake(addr, makeId) : addr;
|
|
102
|
+
}
|
|
103
|
+
function renderMailData(md) {
|
|
104
|
+
if (Array.isArray(md)) {
|
|
105
|
+
return md.map(renderMailData).join(", ");
|
|
106
|
+
}
|
|
107
|
+
if (typeof md === "string") {
|
|
108
|
+
return md;
|
|
109
|
+
}
|
|
110
|
+
return md.email;
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=Sendgrid.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Sendgrid.cjs","mappings":";;;;;;;;;;;;;;AACA;AACA;AACA;AAAsC;AAAA;AAAA;;AAGtC,MAAMA,gBAAgB,GAAG,CAAC;EAAEC,MAAM;EAAEC,WAAW;EAAEC,QAAQ;EAAEC;AAAa,CAAkB,KAAIC,4CAC5FC,qBAAO,MAAK;EACVC,aAAM,CAACC,SAAS,uBAACP,MAAM,EAAO;EAE9B,OAAO;IACLQ,QAAQ,CAACC,IAA0B;MACjC,qDAAOJ,oBAAW,WAAUK,CAAC;QAC3B,MAAMC,GAAG,GAAG;UAAE,GAAGF,IAAI;UAAEG,IAAI,EAAEH,IAAI,CAACG,IAAI,IAAIX;QAAW,CAAE;QACvD,MAAMY,MAAM,GAAGC,aAAa,CAAC,CAACZ,QAAQ,CAAC;QAEvC,MAAMa,YAAY,GAAGF,MAAM,CAACF,GAAG,CAAC;QAChC,MAAMK,WAAW,GAAG;UAAE,GAAGD,YAAY;UAAEE,OAAO,EAAE,GAAGd,aAAa,GAAGY,YAAY,CAACE,OAAO;QAAE,CAAE;QAC3F,OAAOP,CAAC,CAACN,0EAA6C,KAA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S,EAA+B;EACrD,IAAIL,KAAK,CAACC,OAAO,CAACI,EAAE,CAAC,EAAE;IACrB,OAAOA,EAAE,CAACF,GAAG,CAACP,cAAc,CAAC,CAACU,IAAI,CAAC,IAAI,CAAC;;EAE1C,IAAI,OAAOD,EAAE,KAAK,QAAQ,EAAE;IAC1B,OAAOA,EAAE;;EAEX,OAAOA,EAAE,CAACZ,KAAK;AACjB","names":["makeLiveSendgrid","apiKey","defaultFrom","realMail","subjectPrefix","tracer_1","tsplus_module_2","sgMail","setApiKey","sendMail","msg_","$","msg","from","render","renderMessage","renderedMsg_","renderedMsg","subject","ret","cb","send","err","result","LiveSendgrid","config","Emailer","forceFake","i","makeId","to","renderFake","cc","bcc","renderFakeIfTest","isTestAddress","toLowerCase","endsWith","email","addr","name","renderMailData","eq","tsplus_module_4","string","Array","isArray","tsplus_module_5","map","x","md","join"],"sourceRoot":"","sources":["../../../_src/services/Emailer/Sendgrid.ts"],"sourcesContent":[null]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.FakeSendgrid = void 0;
|
|
7
|
+
var tracer_1 = _interopRequireWildcard(require("@effect/io/Debug"));
|
|
8
|
+
var tsplus_module_1 = _interopRequireWildcard(require("@effect/io/Effect"));
|
|
9
|
+
var _utils = require("@effect-app/prelude/utils");
|
|
10
|
+
var _service = require("./service.cjs");
|
|
11
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
12
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
13
|
+
const fileName_1 = "packages/infra/_src/services/Emailer/fake.ts";
|
|
14
|
+
const makeFake = tracer_1.withCallTrace(fileName_1 + ":5:4")(tsplus_module_1.map(() => ({
|
|
15
|
+
sendMail(msg) {
|
|
16
|
+
return tracer_1.withCallTrace(fileName_1 + ":7:48")(tsplus_module_1.logAnnotate("msg", (0, _utils.pretty)(msg)))(tracer_1.withCallTrace(fileName_1 + ":7:21")(tsplus_module_1.logDebug(`Fake send mail`)));
|
|
17
|
+
}
|
|
18
|
+
})))(tracer_1.withCallTrace(fileName_1 + ":4:25")(tsplus_module_1.logDebug("FAKE Emailer Service enabled")));
|
|
19
|
+
/**
|
|
20
|
+
* @tsplus static Emailer.Ops Fake
|
|
21
|
+
*/
|
|
22
|
+
const FakeSendgrid = tsplus_module_1.toLayer(_service.Emailer)(makeFake);
|
|
23
|
+
exports.FakeSendgrid = FakeSendgrid;
|
|
24
|
+
//# sourceMappingURL=fake.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fake.cjs","mappings":";;;;;;;;AAAA;AACA;AAAsC;AAAA;;AAEtC,MAAMA,QAAQ,GAAGC,gEACV,OAAgB;EACnBC,QAAQ,CAACC,GAAG;IACV,OAAOF,yEAA8C,KAAK,EAAE,iBAAM,EAACE,GAAG,CAAC,gDAAhEC,yBAAgB,gBAAgB,CAAC,EAAgC;EAC1E;CACD,CAAC,gDALaA,yBAAgB,8BAA8B,CAAC,EAK3D;AAEL;;;AAGO,MAAMC,YAAY,GAAGD,wBAAiBE,gBAAO,EAAxBN,QAAQ,CAAiB;AAAA","names":["makeFake","tracer_1","sendMail","msg","tsplus_module_1","FakeSendgrid","Emailer"],"sourceRoot":"","sources":["../../../_src/services/Emailer/fake.ts"],"sourcesContent":[null]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Emailer = void 0;
|
|
7
|
+
var tsplus_module_1 = _interopRequireWildcard(require("@fp-ts/data/Context"));
|
|
8
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
9
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
10
|
+
const Emailer = tsplus_module_1.Tag();
|
|
11
|
+
exports.Emailer = Emailer;
|
|
12
|
+
//# sourceMappingURL=service.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.cjs","mappings":";;;;;;;;;AAsBO,MAAMA,OAAO,GAAeC,mBAAG,EAAW;AAAA","names":["Emailer","tsplus_module_1"],"sourceRoot":"","sources":["../../../_src/services/Emailer/service.ts"],"sourcesContent":[null]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _service = require("./Emailer/service.cjs");
|
|
7
|
+
Object.keys(_service).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _service[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _service[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
//# sourceMappingURL=Emailer.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Emailer.cjs","mappings":";;;;;AAAA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA","names":[],"sourceRoot":"","sources":["../../_src/services/Emailer.ts"],"sourcesContent":[null]}
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.byIdAndSaveWithPure = exports.AnyPureDSL = void 0;
|
|
7
|
+
exports.collect = collect;
|
|
8
|
+
exports.filter = filter;
|
|
9
|
+
exports.filterAll = filterAll;
|
|
10
|
+
exports.get = void 0;
|
|
11
|
+
exports.handleByIdAndSaveWithPure = handleByIdAndSaveWithPure;
|
|
12
|
+
exports.ifAny = ifAny;
|
|
13
|
+
exports.ifAny_ = ifAny_;
|
|
14
|
+
exports.log = log;
|
|
15
|
+
exports.makeAllDSL = makeAllDSL;
|
|
16
|
+
exports.makeDSL = makeDSL;
|
|
17
|
+
exports.makeOneDSL = makeOneDSL;
|
|
18
|
+
exports.project = project;
|
|
19
|
+
exports.projectEffect = void 0;
|
|
20
|
+
exports.query = query;
|
|
21
|
+
exports.queryAndSavePure = queryAndSavePure;
|
|
22
|
+
exports.queryEffect = exports.queryAndSavePureEffect = void 0;
|
|
23
|
+
exports.queryOne = queryOne;
|
|
24
|
+
exports.queryOneEffect = void 0;
|
|
25
|
+
exports.saveManyWithPure = saveManyWithPure;
|
|
26
|
+
exports.saveWithPure_ = exports.saveManyWithPure_ = void 0;
|
|
27
|
+
exports.updateWith = updateWith;
|
|
28
|
+
exports.updateWithOne = updateWithOne;
|
|
29
|
+
var tracer_1 = _interopRequireWildcard(require("@effect/io/Debug"));
|
|
30
|
+
var tsplus_module_1 = _interopRequireWildcard(require("@effect-app/prelude/_ext/Pure"));
|
|
31
|
+
var tsplus_module_2 = _interopRequireWildcard(require("@effect-app/prelude/_ext/Prelude.ext"));
|
|
32
|
+
var tsplus_module_3 = _interopRequireWildcard(require("@effect/io/Effect"));
|
|
33
|
+
var tsplus_module_4 = _interopRequireWildcard(require("@fp-ts/data/Chunk"));
|
|
34
|
+
var tsplus_module_5 = _interopRequireWildcard(require("@effect-app/core/Array"));
|
|
35
|
+
var tsplus_module_6 = _interopRequireWildcard(require("@effect-app/core/Effect"));
|
|
36
|
+
var _errors = require("../errors.cjs");
|
|
37
|
+
var _Store = require("../services/Store.cjs");
|
|
38
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
39
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
40
|
+
const fileName_1 = "packages/infra/_src/services/Repository.ts";
|
|
41
|
+
const get = get_1;
|
|
42
|
+
exports.get = get;
|
|
43
|
+
const projectEffect = projectEffect_1;
|
|
44
|
+
exports.projectEffect = projectEffect;
|
|
45
|
+
const queryEffect = queryEffect_1;
|
|
46
|
+
exports.queryEffect = queryEffect;
|
|
47
|
+
const queryOneEffect = queryOneEffect_1;
|
|
48
|
+
exports.queryOneEffect = queryOneEffect;
|
|
49
|
+
const queryAndSavePureEffect = queryAndSavePureEffect_1;
|
|
50
|
+
exports.queryAndSavePureEffect = queryAndSavePureEffect;
|
|
51
|
+
const byIdAndSaveWithPure = byIdAndSaveWithPure_1;
|
|
52
|
+
exports.byIdAndSaveWithPure = byIdAndSaveWithPure;
|
|
53
|
+
const saveManyWithPure_ = saveManyWithPure_1;
|
|
54
|
+
exports.saveManyWithPure_ = saveManyWithPure_;
|
|
55
|
+
const saveWithPure_ = saveWithPure_1;
|
|
56
|
+
exports.saveWithPure_ = saveWithPure_;
|
|
57
|
+
const AnyPureDSL = {
|
|
58
|
+
get: tsplus_module_1.get(),
|
|
59
|
+
set: tsplus_module_1.set,
|
|
60
|
+
log: (...evt) => tsplus_module_1.logMany(evt)
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* @tsplus fluent Repository get
|
|
64
|
+
*/
|
|
65
|
+
exports.AnyPureDSL = AnyPureDSL;
|
|
66
|
+
function get_1(self, id) {
|
|
67
|
+
return tracer_1.withCallTrace(fileName_1 + ":53:24")(tsplus_module_3.flatMap(_ => tsplus_module_2.encaseMaybeInEffect_(_, () => new _errors.NotFoundError(self.itemType, id))))(self.find(id));
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* @tsplus fluent Repository filter
|
|
71
|
+
*/
|
|
72
|
+
function filter(self, filter) {
|
|
73
|
+
return tracer_1.withCallTrace(fileName_1 + ":66:19")(tsplus_module_3.map(_ => tsplus_module_4.filter(filter)(_)))(self.all);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* @tsplus fluent Repository filterAll
|
|
77
|
+
*/
|
|
78
|
+
function filterAll(self, map) {
|
|
79
|
+
return tracer_1.withCallTrace(fileName_1 + ":80:19")(tsplus_module_3.map(map))(self.all);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* @tsplus fluent Repository collect
|
|
83
|
+
*/
|
|
84
|
+
function collect(self, collect) {
|
|
85
|
+
return tracer_1.withCallTrace(fileName_1 + ":95:19")(tsplus_module_3.map(_ => tsplus_module_4.filterMap(collect)(_)))(self.all);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* @tsplus getter Repository log
|
|
89
|
+
*/
|
|
90
|
+
function log(_) {
|
|
91
|
+
return evt => AnyPureDSL.log(evt);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* TODO: project inside the db.
|
|
95
|
+
* @tsplus fluent Repository projectEffect
|
|
96
|
+
*/
|
|
97
|
+
function projectEffect_1(self, map) {
|
|
98
|
+
// TODO: a projection that gets sent to the db instead.
|
|
99
|
+
return tracer_1.withCallTrace(fileName_1 + ":129:14")(tsplus_module_3.flatMap(f => tracer_1.withCallTrace(fileName_1 + ":131:8")(tsplus_module_3.map(_ => tsplus_module_4.filterMap(f.collect)(_)))(f.filter ? self.utils.filter(f.filter, {
|
|
100
|
+
limit: f.limit,
|
|
101
|
+
skip: f.skip
|
|
102
|
+
}) : self.utils.all)))(map);
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* TODO: project inside the db.
|
|
106
|
+
* @tsplus fluent Repository project
|
|
107
|
+
*/
|
|
108
|
+
function project(self, map) {
|
|
109
|
+
return projectEffect_1(self, tracer_1.withCallTrace(fileName_1 + ":150:29")(tsplus_module_3.sync(() => map)));
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* @tsplus fluent Repository queryEffect
|
|
113
|
+
*/
|
|
114
|
+
function queryEffect_1(self,
|
|
115
|
+
// TODO: think about collectPM, collectE, and collect(Parsed)
|
|
116
|
+
map) {
|
|
117
|
+
return tracer_1.withCallTrace(fileName_1 + ":171:14")(tsplus_module_3.flatMap(f => tracer_1.withCallTrace(fileName_1 + ":180:8")(tsplus_module_3.map(_ => tsplus_module_4.filterMap(f.collect)(_)))(tracer_1.withCallTrace(fileName_1 + ":179:8")(tsplus_module_3.map(_ => _.map(_ => self.utils.parse(_))))(tracer_1.withCallTrace(fileName_1 + ":173:8")(tsplus_module_3.flatMap(items => tsplus_module_3.map(({
|
|
118
|
+
set
|
|
119
|
+
}) => items.map(_ => self.utils.mapReverse(_, set)))(tracer_1.withCallTrace(fileName_1 + ":175:36")(tsplus_module_3.service(_Store.ContextMap)))))(f.filter ? self.utils.filter(f.filter, {
|
|
120
|
+
limit: f.limit,
|
|
121
|
+
skip: f.skip
|
|
122
|
+
}) : self.utils.all)))))(map);
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* @tsplus fluent Repository queryOneEffect
|
|
126
|
+
*/
|
|
127
|
+
function queryOneEffect_1(self,
|
|
128
|
+
// TODO: think about collectPM, collectE, and collect(Parsed)
|
|
129
|
+
map) {
|
|
130
|
+
return tracer_1.withCallTrace(fileName_1 + ":201:14")(tsplus_module_3.flatMap(f => tracer_1.withCallTrace(fileName_1 + ":210:8")(tsplus_module_3.flatMap(_ => tracer_1.withCallTrace(fileName_1 + ":210:141")(tsplus_module_3.map(_ => _[0]))(tsplus_module_2.encaseMaybeInEffect_(tsplus_module_5.ChunkToNonEmptyReadonlyArray(tsplus_module_4.filterMap(f.collect)(_)), () => new _errors.NotFoundError(self.itemType, JSON.stringify(f.filter))))))(tracer_1.withCallTrace(fileName_1 + ":209:8")(tsplus_module_3.map(_ => _.map(_ => self.utils.parse(_))))(tracer_1.withCallTrace(fileName_1 + ":203:8")(tsplus_module_3.flatMap(items => tsplus_module_3.map(({
|
|
131
|
+
set
|
|
132
|
+
}) => items.map(_ => self.utils.mapReverse(_, set)))(tracer_1.withCallTrace(fileName_1 + ":205:36")(tsplus_module_3.service(_Store.ContextMap)))))(f.filter ? self.utils.filter(f.filter, {
|
|
133
|
+
limit: 1
|
|
134
|
+
}) : self.utils.all)))))(map);
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* @tsplus fluent Repository query
|
|
138
|
+
*/
|
|
139
|
+
function query(self,
|
|
140
|
+
// TODO: think about collectPM, collectE, and collect(Parsed)
|
|
141
|
+
map) {
|
|
142
|
+
return queryEffect_1(self, tracer_1.withCallTrace(fileName_1 + ":229:27")(tsplus_module_3.sync(() => map)));
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* @tsplus fluent Repository queryOne
|
|
146
|
+
*/
|
|
147
|
+
function queryOne(self,
|
|
148
|
+
// TODO: think about collectPM, collectE, and collect(Parsed)
|
|
149
|
+
map) {
|
|
150
|
+
return queryOneEffect_1(self, tracer_1.withCallTrace(fileName_1 + ":247:30")(tsplus_module_3.sync(() => map)));
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* @tsplus fluent Repository queryAndSavePureEffect
|
|
154
|
+
*/
|
|
155
|
+
function queryAndSavePureEffect_1(self,
|
|
156
|
+
// TODO: think about collectPM, collectE, and collect(Parsed)
|
|
157
|
+
map) {
|
|
158
|
+
return pure => tracer_1.withCallTrace(fileName_1 + ":269:8")(tsplus_module_3.flatMap(_ => saveManyWithPure_1(self, _, pure)))(queryEffect_1(self, map));
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* @tsplus fluent Repository queryAndSavePure
|
|
162
|
+
*/
|
|
163
|
+
function queryAndSavePure(self,
|
|
164
|
+
// TODO: think about collectPM, collectE, and collect(Parsed)
|
|
165
|
+
map) {
|
|
166
|
+
return queryAndSavePureEffect_1(self, tracer_1.withCallTrace(fileName_1 + ":287:38")(tsplus_module_3.sync(() => map)));
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* @tsplus getter Repository saveManyWithPure
|
|
170
|
+
*/
|
|
171
|
+
function saveManyWithPure(self) {
|
|
172
|
+
return pure => items => saveManyWithPure_1(self, items, pure);
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* @tsplus fluent Repository byIdAndSaveWithPure
|
|
176
|
+
*/
|
|
177
|
+
function byIdAndSaveWithPure_1(self, id) {
|
|
178
|
+
return pure => tracer_1.withCallTrace(fileName_1 + ":314:94")(tsplus_module_3.flatMap(item => saveWithPure_1(self, item, pure)))(get_1(self, id));
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* NOTE: it's not as composable, only useful when the request is simple, and only this part needs request args.
|
|
182
|
+
* @tsplus getter Repository handleByIdAndSaveWithPure
|
|
183
|
+
*/
|
|
184
|
+
function handleByIdAndSaveWithPure(self) {
|
|
185
|
+
return pure => (req, ctx) => byIdAndSaveWithPure_1(self, req.id)(pure(req, ctx));
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* @tsplus fluent Repository saveManyWithPure_
|
|
189
|
+
*/
|
|
190
|
+
function saveManyWithPure_1(self, items, pure) {
|
|
191
|
+
return saveAllWithEffectInt(self, tsplus_module_1.runTerm(pure, tsplus_module_5.ext_itToChunk(items)));
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* @tsplus fluent Repository saveWithPure_
|
|
195
|
+
*/
|
|
196
|
+
function saveWithPure_1(self, item, pure) {
|
|
197
|
+
return saveAllWithEffectInt(self, tracer_1.withCallTrace(fileName_1 + ":378:6")(tsplus_module_3.map(([item, events, a]) => [[item], events, a]))(tsplus_module_1.runTerm(pure, item)));
|
|
198
|
+
}
|
|
199
|
+
function saveAllWithEffectInt(self, gen) {
|
|
200
|
+
return tracer_1.withCallTrace(fileName_1 + ":397:6")(tsplus_module_3.flatMap(([items, events, a]) => tracer_1.withCallTrace(fileName_1 + ":400:12")(tsplus_module_3.map(() => a))(self.save(items, events))))(gen);
|
|
201
|
+
}
|
|
202
|
+
const anyDSL = makeDSL();
|
|
203
|
+
function makeAllDSL() {
|
|
204
|
+
const dsl = anyDSL;
|
|
205
|
+
return dsl;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* @tsplus fluent DSLExt updateWith
|
|
209
|
+
*/
|
|
210
|
+
function updateWithOne(self, upd) {
|
|
211
|
+
return self.update(_ => tracer_1.withCallTrace(fileName_1 + ":441:33")(tsplus_module_3.sync(() => upd(_))));
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* @tsplus fluent DSLExt updateWith
|
|
215
|
+
*/
|
|
216
|
+
function updateWith(self, upd) {
|
|
217
|
+
return self.update(_ => tracer_1.withCallTrace(fileName_1 + ":448:40")(tsplus_module_3.sync(() => upd(_))));
|
|
218
|
+
}
|
|
219
|
+
function makeOneDSL() {
|
|
220
|
+
return anyDSL;
|
|
221
|
+
}
|
|
222
|
+
function makeDSL() {
|
|
223
|
+
const dsl = AnyPureDSL;
|
|
224
|
+
function modify(pure) {
|
|
225
|
+
return tracer_1.withCallTrace(fileName_1 + ":468:20")(tsplus_module_3.flatMap(items => pure(items, dsl)))(dsl.get);
|
|
226
|
+
}
|
|
227
|
+
function update(pure) {
|
|
228
|
+
return tracer_1.withCallTrace(fileName_1 + ":480:20")(tsplus_module_3.flatMap(items => tracer_1.withCallTrace(fileName_1 + ":480:58")(tsplus_module_3.tap(dsl.set))(pure(items, dsl.log))))(dsl.get);
|
|
229
|
+
}
|
|
230
|
+
function withDSL(pure) {
|
|
231
|
+
return pure(AnyPureDSL);
|
|
232
|
+
}
|
|
233
|
+
return Object.assign(withDSL, {
|
|
234
|
+
modify,
|
|
235
|
+
update
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
function ifAny(fn) {
|
|
239
|
+
return items => tracer_1.withCallTrace(fileName_1 + ":505:64")(tsplus_module_6.flatMapOpt(tracer_1.withCallTrace(fileName_1 + ":505:34")(tsplus_module_3.sync(() => tsplus_module_5.CollectionToNonEmptyReadonlyArray(items))), fn));
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* @tsplus fluent Iterable ifAny
|
|
243
|
+
*/
|
|
244
|
+
function ifAny_(items, fn) {
|
|
245
|
+
return tracer_1.withCallTrace(fileName_1 + ":512:40")(tsplus_module_6.flatMapOpt(tracer_1.withCallTrace(fileName_1 + ":512:10")(tsplus_module_3.sync(() => tsplus_module_5.CollectionToNonEmptyReadonlyArray(items))), fn));
|
|
246
|
+
}
|
|
247
|
+
//# sourceMappingURL=Repository.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Repository.cjs","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;AAEA;AAAiD;AAAA;;MAqCjCA,GAAG;AAAA;MAwEHC,aAAa;AAAA;MA0CbC,WAAW;AAAA;MA8BXC,cAAc;AAAA;MAkEdC,sBAAsB;AAAA;MAsDtBC,mBAAmB;AAAA;MA2BnBC,iBAAiB;AAAA;MAyBjBC,aAAa;AAAA;AAjUtB,MAAMC,UAAU,GAA2B;EAAER,GAAG,EAAES,qBAAU;EAAEC,GAAG,qBAAU;EAAEC,GAAG,EAAE,CAAC,GAAGC,GAAU,KAAKH,wBAAaG,GAAG;AAAC,CAAE;AAE/H;;;AAAA;AAGA,eAOEC,IAA0C,EAC1CC,EAAM;EAEN,OAAOC,sEAAsBC,CAAC,IAAIC,sCAAC,EAAgB,MAAM,IAAIC,qBAAa,CAACL,IAAI,CAACM,QAAQ,EAAEL,EAAE,CAAC,CAAC,GAAvFD,IAAI,CAACO,IAAI,CAACN,EAAE,CAAC,CAA2E;AACj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AqCvD,IAAoB,EAAEqD,GAAsC;EACzH,OAAOrD,IAAI,CAACsD,MAAM,CAAEnD,CAAY,IAAID,+CAACkB,2BAAOiC,GAAG,CAAClD,CAAC,CAAC,CAAC,EAAC;AACtD;AAEM,SAAUqD,UAAU;EACxB,OAAOR,MAAM;AACf;AAEM,SAAUC,OAAO;EACrB,MAAME,GAAG,GAAyBxD,UAAU;EAE5C,SAAS8D,MAAM,CAKb1B,IAGoB;IAEpB,OAAO7B,uEAAgBoB,KAAK,IAAIS,IAAI,CAACT,KAAK,EAAE6B,GAAG,CAAC,GAAzCA,GAAG,CAAChE,GAAG,CAA0C;EAC1D;EAEA,SAASmE,MAAM,CAIbvB,IAGqB;IAErB,OAAO7B,uEAAgBoB,KAAK,IAAIpB,mEAAyBiD,GAAG,CAACtD,GAAG,GAAhCkC,IAAI,CAACT,KAAK,EAAE6B,GAAG,CAACrD,GAAG,CAAC,CAAa,GAA1DqD,GAAG,CAAChE,GAAG,CAA2D;EAC3E;EAEA,SAASuE,OAAO,CAKd3B,IAAoD;IAEpD,OAAOA,IAAI,CAACpC,UAAU,CAAQ;EAChC;EAEA,OAAOgE,MAAM,CAACC,MAAM,CAClBF,OAAO,EAAE;IACPD,MAAM;IACNH;GACD,CACF;AACH;AAKM,SAAUO,KAAK,CAAaC,EAAwD;EACxF,OAAQxC,KAAkB,IAAIpB,+CAAC6D,uJAAOzC,KAAK,EAAiB,GAAYwC,EAAE,CAAC;AAC7E;AAEA;;;AAGM,SAAUE,MAAM,CAAa1C,KAAkB,EAAEwC,EAAwD;EAC7G,sDAAOC,uJAAOzC,KAAK,EAAiB,GAAYwC,EAAE,CAAC;AACrD","names":["get","projectEffect","queryEffect","queryOneEffect","queryAndSavePureEffect","byIdAndSaveWithPure","saveManyWithPure_","saveWithPure_","AnyPureDSL","tsplus_module_1","set","log","evt","self","id","tracer_1","_","tsplus_module_2","NotFoundError","itemType","find","filter","tsplus_module_4","all","filterAll","map","collect","f","utils","limit","skip","project","projectEffect_1","tsplus_module_3","parse","items","mapReverse","ContextMap","JSON","stringify","query","queryEffect_1","queryOne","queryOneEffect_1","pure","saveManyWithPure_1","queryAndSavePure","queryAndSavePureEffect_1","saveManyWithPure","item","saveWithPure_1","get_1","handleByIdAndSaveWithPure","req","ctx","byIdAndSaveWithPure_1","saveAllWithEffectInt","events","a","gen","save","anyDSL","makeDSL","makeAllDSL","dsl","updateWithOne","upd","update","updateWith","makeOneDSL","modify","withDSL","Object","assign","ifAny","fn","tsplus_module_6","ifAny_"],"sourceRoot":"","sources":["../../_src/services/Repository.ts"],"sourcesContent":[null]}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.LiveReceiver = LiveReceiver;
|
|
7
|
+
exports.LiveSender = LiveSender;
|
|
8
|
+
exports.Sender = exports.Receiver = exports.LiveServiceBusClient = void 0;
|
|
9
|
+
exports.Subscription = Subscription;
|
|
10
|
+
exports.sendMessages = sendMessages;
|
|
11
|
+
exports.subscribe = subscribe;
|
|
12
|
+
var tracer_1 = _interopRequireWildcard(require("@effect/io/Debug"));
|
|
13
|
+
var tsplus_module_1 = _interopRequireWildcard(require("@effect/io/Effect"));
|
|
14
|
+
var tsplus_module_2 = _interopRequireWildcard(require("@fp-ts/data/Context"));
|
|
15
|
+
var tsplus_module_3 = _interopRequireWildcard(require("@effect/io/Layer"));
|
|
16
|
+
var _serviceBus = require("@azure/service-bus");
|
|
17
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
18
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
|
+
const fileName_1 = "packages/infra/_src/services/ServiceBus.ts";
|
|
20
|
+
function makeClient(url) {
|
|
21
|
+
return tracer_1.withCallTrace(fileName_1 + ":13:50")(tsplus_module_1.acquireRelease(tracer_1.withCallTrace(fileName_1 + ":13:10")(tsplus_module_1.sync(() => new _serviceBus.ServiceBusClient(url))), client => tracer_1.withCallTrace(fileName_1 + ":14:22")(tsplus_module_1.promise(() => client.close()))));
|
|
22
|
+
}
|
|
23
|
+
const Client = tsplus_module_2.Tag();
|
|
24
|
+
const LiveServiceBusClient = url => tsplus_module_3.scoped(Client)(makeClient(url));
|
|
25
|
+
exports.LiveServiceBusClient = LiveServiceBusClient;
|
|
26
|
+
function makeSender(queueName) {
|
|
27
|
+
return tracer_1.withCallTrace(fileName_1 + ":22:17")(tsplus_module_1.gen(function* ($) {
|
|
28
|
+
const serviceBusClient = yield* $(tsplus_module_1.service(Client));
|
|
29
|
+
return yield* $(tracer_1.withCallTrace(fileName_1 + ":26:62")(tsplus_module_1.acquireRelease(tracer_1.withCallTrace(fileName_1 + ":26:7")(tsplus_module_1.sync(() => serviceBusClient.createSender(queueName))), subscription => tracer_1.withCallTrace(fileName_1 + ":27:32")(tsplus_module_1.promise(() => subscription.close())))));
|
|
30
|
+
}));
|
|
31
|
+
}
|
|
32
|
+
const Sender = tsplus_module_2.Tag();
|
|
33
|
+
exports.Sender = Sender;
|
|
34
|
+
function LiveSender(queueName) {
|
|
35
|
+
return tsplus_module_3.scoped(Sender)(makeSender(queueName));
|
|
36
|
+
}
|
|
37
|
+
function makeReceiver(queueName) {
|
|
38
|
+
return tracer_1.withCallTrace(fileName_1 + ":39:17")(tsplus_module_1.gen(function* ($) {
|
|
39
|
+
const serviceBusClient = yield* $(tsplus_module_1.service(Client));
|
|
40
|
+
return yield* $(tracer_1.withCallTrace(fileName_1 + ":43:64")(tsplus_module_1.acquireRelease(tracer_1.withCallTrace(fileName_1 + ":43:7")(tsplus_module_1.sync(() => serviceBusClient.createReceiver(queueName))), r => tracer_1.withCallTrace(fileName_1 + ":44:21")(tsplus_module_1.promise(() => r.close())))));
|
|
41
|
+
}));
|
|
42
|
+
}
|
|
43
|
+
const Receiver = tsplus_module_2.Tag();
|
|
44
|
+
exports.Receiver = Receiver;
|
|
45
|
+
function LiveReceiver(queueName) {
|
|
46
|
+
return tsplus_module_3.scoped(Receiver)(makeReceiver(queueName));
|
|
47
|
+
}
|
|
48
|
+
function sendMessages(messages, options) {
|
|
49
|
+
return tracer_1.withCallTrace(fileName_1 + ":59:17")(tsplus_module_1.gen(function* ($) {
|
|
50
|
+
const s = yield* $(tsplus_module_1.service(Sender));
|
|
51
|
+
return yield* $(tracer_1.withCallTrace(fileName_1 + ":61:28")(tsplus_module_1.promise(() => s.sendMessages(messages, options))));
|
|
52
|
+
}));
|
|
53
|
+
}
|
|
54
|
+
function subscribe(hndlr) {
|
|
55
|
+
return tracer_1.withCallTrace(fileName_1 + ":66:17")(tsplus_module_1.gen(function* ($) {
|
|
56
|
+
const r = yield* $(tsplus_module_1.service(Receiver));
|
|
57
|
+
const env = yield* $(tracer_1.withCallTrace(fileName_1 + ":69:33")(tsplus_module_1.environment()));
|
|
58
|
+
yield* $(tracer_1.withCallTrace(fileName_1 + ":85:9")(tsplus_module_1.acquireRelease(tracer_1.withCallTrace(fileName_1 + ":72:7")(tsplus_module_1.sync(() => r.subscribe({
|
|
59
|
+
processError: err => tsplus_module_1.unsafeRunPromise(tracer_1.withCallTrace(fileName_1 + ":76:16")(tsplus_module_1.provideEnvironment(env))(hndlr.processError(err))).catch(console.error),
|
|
60
|
+
processMessage: msg => tsplus_module_1.unsafeRunPromise(tracer_1.withCallTrace(fileName_1 + ":81:16")(tsplus_module_1.provideEnvironment(env))(hndlr.processMessage(msg)))
|
|
61
|
+
// DO NOT CATCH ERRORS here as they should return to the queue!
|
|
62
|
+
}))), subscription => tracer_1.withCallTrace(fileName_1 + ":86:32")(tsplus_module_1.promise(() => subscription.close())))));
|
|
63
|
+
}));
|
|
64
|
+
}
|
|
65
|
+
const SubscribeTag = tsplus_module_2.Tag();
|
|
66
|
+
function Subscription(hndlr) {
|
|
67
|
+
return tsplus_module_3.scoped(SubscribeTag)(subscribe(hndlr));
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=ServiceBus.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ServiceBus.cjs","mappings":";;;;;;;;;;;;;;;AASA;AAAqD;AAAA;;AAErD,SAASA,UAAU,CAACC,GAAW;EAC7B,qDAAOC,kGAAO,MAAM,IAAIC,4BAAgB,CAACF,GAAG,CAAC,CAAC,GAC5CG,MAAM,IAAGC,8CAACH,wBAAe,MAAME,MAAM,CAACE,KAAK,EAAE,CAAC,EAC/C;AACH;AAEA,MAAMC,MAAM,GAAGC,mBAAG,EAAoB;AAC/B,MAAMC,oBAAoB,GAAIR,GAAW,IAAKS,uBAA8BH,MAAM,EAApCP,UAAU,CAACC,GAAG,CAAC,CAAsB;AAAA;AAE1F,SAASU,UAAU,CAACC,SAAiB;EACnC,qDAAOV,oBAAW,WAAUW,CAAC;IAC3B,MAAMC,gBAAgB,GAAG,OAAOD,CAAC,yBAACN,MAAM,EAAQ;IAEhD,OAAO,OAAOM,CAAC,+CACbX,iGAAO,MAAMY,gBAAgB,CAACC,YAAY,CAACH,SAAS,CAAC,CAAC,GACpDI,YAAY,IAAGX,8CAACH,wBAAe,M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MACLmB,CAAC,CAACO,SAAS,CAAC;MACVG,YAAY,EAAEC,GAAG,IACf9B,kHACsB4B,GAAG,GADzBD,KAAK,CAACE,YAAY,CAACC,GAAG,CAAC,CACG,EAEvBC,KAAK,CAACC,OAAO,CAACC,KAAK,CAAC;MACzBC,cAAc,EAAEC,GAAG,IAAGnC,iCACpBG,iFACsByB,GAAG,GADzBD,KAAK,CAACO,cAAc,CAACC,GAAG,CAAC,CACC;MAE5B;KACD,CAAC,CACH,GACCrB,YAAY,IAAGX,8CAACH,wBAAe,MAAMc,YAAY,CAACV,KAAK,EAAE,CAAC,EAC3D,EACF;EACH,CAAC,CAAC;AACJ;AAEA,MAAMgC,YAAY,GAAG9B,mBAAG,EAAgD;AAElE,SAAU+B,YAAY,CAAaV,KAAkC;EACzE,OAAOnB,uBAA+B4B,YAAY,EAA3CV,SAAS,CAACC,KAAK,CAAC,CAA4B;AACrD","names":["makeClient","url","tsplus_module_1","ServiceBusClient","client","tracer_1","close","Client","tsplus_module_2","LiveServiceBusClient","tsplus_module_3","makeSender","queueName","$","serviceBusClient","createSender","subscription","Sender","LiveSender","makeReceiver","createReceiver","r","Receiver","LiveReceiver","sendMessages","messages","options","s","subscribe","hndlr","env","processError","err","catch","console","error","processMessage","msg","SubscribeTag","Subscription"],"sourceRoot":"","sources":["../../_src/services/ServiceBus.ts"],"sourcesContent":[null]}
|