@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,146 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/ban-types */
|
|
2
|
+
import type { FieldValues } from "../fields.js"
|
|
3
|
+
import type { BrowserNativeObject, Primitive } from "../utils.js"
|
|
4
|
+
|
|
5
|
+
import type { ArrayKey, IsTuple, TupleKeys } from "./common.js"
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Helper type for recursively constructing paths through a type.
|
|
9
|
+
* See {@link Path}
|
|
10
|
+
*/
|
|
11
|
+
type PathImpl<K extends string | number, V> = V extends
|
|
12
|
+
| Primitive
|
|
13
|
+
| BrowserNativeObject ? `${K}`
|
|
14
|
+
: `${K}` | `${K}.${Path<V>}`
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Type which eagerly collects all paths through a type
|
|
18
|
+
* @typeParam T - type which should be introspected
|
|
19
|
+
* @example
|
|
20
|
+
* ```
|
|
21
|
+
* Path<{foo: {bar: string}}> = 'foo' | 'foo.bar'
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export type Path<T> = T extends ReadonlyArray<infer V> ? IsTuple<T> extends true ? {
|
|
25
|
+
[K in TupleKeys<T>]-?: PathImpl<K & string, T[K]>
|
|
26
|
+
}[TupleKeys<T>]
|
|
27
|
+
: PathImpl<ArrayKey, V>
|
|
28
|
+
: {
|
|
29
|
+
[K in keyof T]-?: PathImpl<K & string, T[K]>
|
|
30
|
+
}[keyof T]
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* See {@link Path}
|
|
34
|
+
*/
|
|
35
|
+
export type FieldPath<TFieldValues extends FieldValues> = Path<TFieldValues>
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Helper type for recursively constructing paths through a type.
|
|
39
|
+
* See {@link ArrayPath}
|
|
40
|
+
*/
|
|
41
|
+
type ArrayPathImpl<K extends string | number, V> = V extends
|
|
42
|
+
| Primitive
|
|
43
|
+
| BrowserNativeObject ? never
|
|
44
|
+
: V extends ReadonlyArray<infer U> ? U extends Primitive | BrowserNativeObject ? never
|
|
45
|
+
: `${K}` | `${K}.${ArrayPath<V>}`
|
|
46
|
+
: `${K}.${ArrayPath<V>}`
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Type which eagerly collects all paths through a type which point to an array
|
|
50
|
+
* type.
|
|
51
|
+
* @typeParam T - type which should be introspected
|
|
52
|
+
* @example
|
|
53
|
+
* ```
|
|
54
|
+
* Path<{foo: {bar: string[], baz: number[]}}> = 'foo.bar' | 'foo.baz'
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
export type ArrayPath<T> = T extends ReadonlyArray<infer V> ? IsTuple<T> extends true ? {
|
|
58
|
+
[K in TupleKeys<T>]-?: ArrayPathImpl<K & string, T[K]>
|
|
59
|
+
}[TupleKeys<T>]
|
|
60
|
+
: ArrayPathImpl<ArrayKey, V>
|
|
61
|
+
: {
|
|
62
|
+
[K in keyof T]-?: ArrayPathImpl<K & string, T[K]>
|
|
63
|
+
}[keyof T]
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* See {@link ArrayPath}
|
|
67
|
+
*/
|
|
68
|
+
export type FieldArrayPath<TFieldValues extends FieldValues> = ArrayPath<TFieldValues>
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Type to evaluate the type which the given path points to.
|
|
72
|
+
* @typeParam T - deeply nested type which is indexed by the path
|
|
73
|
+
* @typeParam P - path into the deeply nested type
|
|
74
|
+
* @example
|
|
75
|
+
* ```
|
|
76
|
+
* PathValue<{foo: {bar: string}}, 'foo.bar'> = string
|
|
77
|
+
* PathValue<[number, string], '1'> = string
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
export type PathValue<T, P extends Path<T> | ArrayPath<T>> = T extends any
|
|
81
|
+
? P extends `${infer K}.${infer R}` ? K extends keyof T ? R extends Path<T[K]> ? PathValue<T[K], R>
|
|
82
|
+
: never
|
|
83
|
+
: K extends `${ArrayKey}` ? T extends ReadonlyArray<infer V> ? PathValue<V, R & Path<V>>
|
|
84
|
+
: never
|
|
85
|
+
: never
|
|
86
|
+
: P extends keyof T ? T[P]
|
|
87
|
+
: P extends `${ArrayKey}` ? T extends ReadonlyArray<infer V> ? V
|
|
88
|
+
: never
|
|
89
|
+
: never
|
|
90
|
+
: never
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* See {@link PathValue}
|
|
94
|
+
*/
|
|
95
|
+
export type FieldPathValue<
|
|
96
|
+
TFieldValues extends FieldValues,
|
|
97
|
+
TFieldPath extends FieldPath<TFieldValues>
|
|
98
|
+
> = PathValue<TFieldValues, TFieldPath>
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* See {@link PathValue}
|
|
102
|
+
*/
|
|
103
|
+
export type FieldArrayPathValue<
|
|
104
|
+
TFieldValues extends FieldValues,
|
|
105
|
+
TFieldArrayPath extends FieldArrayPath<TFieldValues>
|
|
106
|
+
> = PathValue<TFieldValues, TFieldArrayPath>
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Type to evaluate the type which the given paths point to.
|
|
110
|
+
* @typeParam TFieldValues - field values which are indexed by the paths
|
|
111
|
+
* @typeParam TPath - paths into the deeply nested field values
|
|
112
|
+
* @example
|
|
113
|
+
* ```
|
|
114
|
+
* FieldPathValues<{foo: {bar: string}}, ['foo', 'foo.bar']>
|
|
115
|
+
* = [{bar: string}, string]
|
|
116
|
+
* ```
|
|
117
|
+
*/
|
|
118
|
+
export type FieldPathValues<
|
|
119
|
+
TFieldValues extends FieldValues,
|
|
120
|
+
TPath extends FieldPath<TFieldValues>[] | readonly FieldPath<TFieldValues>[]
|
|
121
|
+
> =
|
|
122
|
+
& {}
|
|
123
|
+
& {
|
|
124
|
+
[K in keyof TPath]: FieldPathValue<
|
|
125
|
+
TFieldValues,
|
|
126
|
+
TPath[K] & FieldPath<TFieldValues>
|
|
127
|
+
>
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Type which eagerly collects all paths through a fieldType that matches a give type
|
|
132
|
+
* @typeParam TFieldValues - field values which are indexed by the paths
|
|
133
|
+
* @typeParam TValue - the value you want to match into each type
|
|
134
|
+
* @example
|
|
135
|
+
* ```typescript
|
|
136
|
+
* FieldPathByValue<{foo: {bar: number}, baz: number, bar: string}, number>
|
|
137
|
+
* = 'foo.bar' | 'baz'
|
|
138
|
+
* ```
|
|
139
|
+
*/
|
|
140
|
+
export type FieldPathByValue<TFieldValues extends FieldValues, TValue> = {
|
|
141
|
+
[Key in FieldPath<TFieldValues>]: FieldPathValue<
|
|
142
|
+
TFieldValues,
|
|
143
|
+
Key
|
|
144
|
+
> extends TValue ? Key
|
|
145
|
+
: never
|
|
146
|
+
}[FieldPath<TFieldValues>]
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Re-export public API */
|
|
2
|
+
|
|
3
|
+
export { PathString } from "./common.js"
|
|
4
|
+
export {
|
|
5
|
+
ArrayPath,
|
|
6
|
+
FieldArrayPath,
|
|
7
|
+
FieldArrayPathValue,
|
|
8
|
+
FieldPath,
|
|
9
|
+
FieldPathByValue,
|
|
10
|
+
FieldPathValue,
|
|
11
|
+
FieldPathValues,
|
|
12
|
+
Path,
|
|
13
|
+
PathValue
|
|
14
|
+
} from "./eager.js"
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
declare const $NestedValue: unique symbol
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated to be removed in the next major version
|
|
5
|
+
*/
|
|
6
|
+
export type NestedValue<TValue extends object = object> = {
|
|
7
|
+
[$NestedValue]: never
|
|
8
|
+
} & TValue
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated to be removed in the next major version
|
|
12
|
+
*/
|
|
13
|
+
export type UnpackNestedValue<T> = T extends NestedValue<infer U> ? U
|
|
14
|
+
: T extends Date | FileList | File | Blob ? T
|
|
15
|
+
: T extends object ? { [K in keyof T]: UnpackNestedValue<T[K]> }
|
|
16
|
+
: T
|
|
17
|
+
|
|
18
|
+
/*
|
|
19
|
+
Projects that React Hook Form installed don't include the DOM library need these interfaces to compile.
|
|
20
|
+
React Native applications is no DOM available. The JavaScript runtime is ES6/ES2015 only.
|
|
21
|
+
These definitions allow such projects to compile with only --lib ES6.
|
|
22
|
+
|
|
23
|
+
Warning: all of these interfaces are empty.
|
|
24
|
+
If you want type definitions for various properties, you need to add `--lib DOM` (via command line or tsconfig.json).
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
export type Noop = () => void
|
|
28
|
+
|
|
29
|
+
interface File extends Blob {
|
|
30
|
+
readonly lastModified: number
|
|
31
|
+
readonly name: string
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
interface FileList {
|
|
35
|
+
readonly length: number
|
|
36
|
+
item(index: number): File | null
|
|
37
|
+
[index: number]: File
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export type Primitive =
|
|
41
|
+
| null
|
|
42
|
+
| undefined
|
|
43
|
+
| string
|
|
44
|
+
| number
|
|
45
|
+
| boolean
|
|
46
|
+
| symbol
|
|
47
|
+
| bigint
|
|
48
|
+
|
|
49
|
+
export type BrowserNativeObject = Date | FileList | File
|
|
50
|
+
|
|
51
|
+
export type EmptyObject = { [K in string | number]: never }
|
|
52
|
+
|
|
53
|
+
export type NonUndefined<T> = T extends undefined ? never : T
|
|
54
|
+
|
|
55
|
+
export type LiteralUnion<T extends U, U extends Primitive> =
|
|
56
|
+
| T
|
|
57
|
+
| (U & { _?: never })
|
|
58
|
+
|
|
59
|
+
export type DeepPartial<T> = T extends BrowserNativeObject | NestedValue ? T
|
|
60
|
+
: { [K in keyof T]?: DeepPartial<T[K]> }
|
|
61
|
+
|
|
62
|
+
export type DeepPartialSkipArrayKey<T> = T extends
|
|
63
|
+
| BrowserNativeObject
|
|
64
|
+
| NestedValue ? T
|
|
65
|
+
: T extends ReadonlyArray<any> ? { [K in keyof T]: DeepPartialSkipArrayKey<T[K]> }
|
|
66
|
+
: { [K in keyof T]?: DeepPartialSkipArrayKey<T[K]> }
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Checks whether the type is any
|
|
70
|
+
* See {@link https://stackoverflow.com/a/49928360/3406963}
|
|
71
|
+
* @typeParam T - type which may be any
|
|
72
|
+
* ```
|
|
73
|
+
* IsAny<any> = true
|
|
74
|
+
* IsAny<string> = false
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
export type IsAny<T> = 0 extends 1 & T ? true : false
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Checks whether the type is never
|
|
81
|
+
* @typeParam T - type which may be never
|
|
82
|
+
* ```
|
|
83
|
+
* IsAny<never> = true
|
|
84
|
+
* IsAny<string> = false
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
export type IsNever<T> = [T] extends [never] ? true : false
|
|
88
|
+
|
|
89
|
+
export type DeepMap<T, TValue> = IsAny<T> extends true ? any
|
|
90
|
+
: T extends BrowserNativeObject | NestedValue ? TValue
|
|
91
|
+
: T extends object ? { [K in keyof T]: DeepMap<NonUndefined<T[K]>, TValue> }
|
|
92
|
+
: TValue
|
|
93
|
+
|
|
94
|
+
export type IsFlatObject<T extends object> = Extract<
|
|
95
|
+
Exclude<T[keyof T], NestedValue | Date | FileList>,
|
|
96
|
+
any[] | object
|
|
97
|
+
> extends never ? true
|
|
98
|
+
: false
|
|
99
|
+
|
|
100
|
+
export type Merge<A, B> = {
|
|
101
|
+
[K in keyof A | keyof B]?: K extends keyof A & keyof B ? [A[K], B[K]] extends [object, object] ? Merge<A[K], B[K]>
|
|
102
|
+
: A[K] | B[K]
|
|
103
|
+
: K extends keyof A ? A[K]
|
|
104
|
+
: K extends keyof B ? B[K]
|
|
105
|
+
: never
|
|
106
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { Message } from "./errors.js"
|
|
2
|
+
import type { FieldValues, InternalFieldName } from "./fields.js"
|
|
3
|
+
import type { FieldPath, FieldPathValue } from "./path/index.js"
|
|
4
|
+
|
|
5
|
+
export type ValidationValue = boolean | number | string | RegExp
|
|
6
|
+
|
|
7
|
+
export type ValidationRule<
|
|
8
|
+
TValidationValue extends ValidationValue = ValidationValue
|
|
9
|
+
> = TValidationValue | ValidationValueMessage<TValidationValue>
|
|
10
|
+
|
|
11
|
+
export type ValidationValueMessage<
|
|
12
|
+
TValidationValue extends ValidationValue = ValidationValue
|
|
13
|
+
> = {
|
|
14
|
+
value: TValidationValue
|
|
15
|
+
message: Message
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export type ValidateResult = Message | Message[] | boolean | undefined
|
|
19
|
+
|
|
20
|
+
export type Validate<TFieldValue> = (
|
|
21
|
+
value: TFieldValue
|
|
22
|
+
) => ValidateResult | Promise<ValidateResult>
|
|
23
|
+
|
|
24
|
+
export type RegisterOptions<
|
|
25
|
+
TFieldValues extends FieldValues = FieldValues,
|
|
26
|
+
TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>
|
|
27
|
+
> = Partial<{
|
|
28
|
+
required: Message | ValidationRule<boolean>
|
|
29
|
+
min: ValidationRule<number | string>
|
|
30
|
+
max: ValidationRule<number | string>
|
|
31
|
+
maxLength: ValidationRule<number>
|
|
32
|
+
minLength: ValidationRule<number>
|
|
33
|
+
pattern: ValidationRule<RegExp>
|
|
34
|
+
validate:
|
|
35
|
+
| Validate<FieldPathValue<TFieldValues, TFieldName>>
|
|
36
|
+
| Record<string, Validate<FieldPathValue<TFieldValues, TFieldName>>>
|
|
37
|
+
valueAsNumber: boolean
|
|
38
|
+
valueAsDate: boolean
|
|
39
|
+
value: FieldPathValue<TFieldValues, TFieldName>
|
|
40
|
+
setValueAs: (value: any) => any
|
|
41
|
+
shouldUnregister?: boolean
|
|
42
|
+
onChange?: (event: any) => void
|
|
43
|
+
onBlur?: (event: any) => void
|
|
44
|
+
disabled: boolean
|
|
45
|
+
deps: InternalFieldName | InternalFieldName[]
|
|
46
|
+
}>
|
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
import type { Where } from "../services/Store.js"
|
|
2
|
+
import type { FieldValues } from "./filter/types/fields.js"
|
|
3
|
+
import type { FieldPath, FieldPathValue } from "./filter/types/path/eager.js"
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* the function defaults to "eq", but has additional properties for notEq, in and notIn
|
|
7
|
+
*/
|
|
8
|
+
export interface WhereFilter<TFieldValues extends FieldValues> extends ReturnType<typeof makeWhereFilter_<TFieldValues>> {}
|
|
9
|
+
export function makeWhereFilter<TFieldValues extends FieldValues>() {
|
|
10
|
+
const f = makeWhereFilter_<TFieldValues>()
|
|
11
|
+
return f as WhereFilter<TFieldValues>
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function makeHelpers<TFieldValues extends FieldValues>() {
|
|
15
|
+
const helpers = makeHelpers_<TFieldValues>()
|
|
16
|
+
return helpers as WhereHelpers<TFieldValues>
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface WhereHelpers<TFieldValues extends FieldValues> extends ReturnType<typeof makeHelpers_<TFieldValues>> {}
|
|
20
|
+
|
|
21
|
+
function makeHelpers_<TFieldValues extends FieldValues>() {
|
|
22
|
+
type Paths = FieldPath<TFieldValues>
|
|
23
|
+
type Value<TFieldName extends Paths> = FieldPathValue<TFieldValues, TFieldName>
|
|
24
|
+
|
|
25
|
+
return {
|
|
26
|
+
in<TFieldName extends Paths, V extends Value<TFieldName>>(
|
|
27
|
+
this: void,
|
|
28
|
+
path: TFieldName,
|
|
29
|
+
value: readonly V[]
|
|
30
|
+
) {
|
|
31
|
+
return { key: path, value, t: "in" as const }
|
|
32
|
+
},
|
|
33
|
+
notIn<TFieldName extends Paths, V extends Value<TFieldName>>(
|
|
34
|
+
this: void,
|
|
35
|
+
path: TFieldName,
|
|
36
|
+
value: readonly V[]
|
|
37
|
+
) {
|
|
38
|
+
return { key: path, value, t: "not-in" as const }
|
|
39
|
+
},
|
|
40
|
+
eq<TFieldName extends Paths, V extends Value<TFieldName>>(
|
|
41
|
+
this: void,
|
|
42
|
+
path: TFieldName,
|
|
43
|
+
value: V
|
|
44
|
+
) {
|
|
45
|
+
return { key: path, value, t: "eq" as const }
|
|
46
|
+
},
|
|
47
|
+
notEq<TFieldName extends Paths, V extends Value<TFieldName>>(
|
|
48
|
+
this: void,
|
|
49
|
+
path: TFieldName,
|
|
50
|
+
value: V
|
|
51
|
+
) {
|
|
52
|
+
return { key: path, value, t: "not-eq" as const }
|
|
53
|
+
}
|
|
54
|
+
} satisfies Record<string, (...args: any[]) => Where>
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function makeWhereFilter_<TFieldValues extends FieldValues>() {
|
|
58
|
+
const helpers = makeHelpers<TFieldValues>()
|
|
59
|
+
const f = Object.assign(helpers.eq, helpers)
|
|
60
|
+
return f
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
export type WhereValue<
|
|
66
|
+
T extends "eq" | "not-eq" | "starts-with" | "ends-with" | "includes" | "contains" | "not-contains",
|
|
67
|
+
A, // extends SupportedValues,
|
|
68
|
+
V extends A = A
|
|
69
|
+
> = { t: T; v: V }
|
|
70
|
+
type SupportedValues = string | boolean | number | null
|
|
71
|
+
|
|
72
|
+
export type WhereIn<T extends "in" | "not-in", V, Values extends readonly V[] = readonly V[]> = {
|
|
73
|
+
t: T
|
|
74
|
+
v: Values
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* @tsplus fluent Iterable $contains
|
|
79
|
+
*/
|
|
80
|
+
export function $contains<A extends SupportedValues, V extends A>(
|
|
81
|
+
_: readonly A[],
|
|
82
|
+
v: V
|
|
83
|
+
): WhereValue<"contains", A, V> {
|
|
84
|
+
return $$contains(v)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* @tsplus fluent Iterable $notContains
|
|
89
|
+
*/
|
|
90
|
+
export function $notContains<A extends SupportedValues, V extends A>(
|
|
91
|
+
_: readonly A[],
|
|
92
|
+
v: V
|
|
93
|
+
): WhereValue<"not-contains", A, V> {
|
|
94
|
+
return $$notContains(v)
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* @tsplus fluent string $in
|
|
99
|
+
* @tsplus fluent boolean $in
|
|
100
|
+
* @tsplus fluent number $in
|
|
101
|
+
*/
|
|
102
|
+
export function $in<A extends SupportedValues, Values extends readonly A[]>(
|
|
103
|
+
_: A,
|
|
104
|
+
...v: Values
|
|
105
|
+
): WhereIn<"in", A, Values> {
|
|
106
|
+
return $$in(v)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* @tsplus fluent string $notIn
|
|
111
|
+
* @tsplus fluent boolean $notIn
|
|
112
|
+
* @tsplus fluent number $notIn
|
|
113
|
+
*/
|
|
114
|
+
export function $notIn<A extends SupportedValues, Values extends readonly A[]>(
|
|
115
|
+
_: A,
|
|
116
|
+
...v: Values
|
|
117
|
+
): WhereIn<"not-in", A, Values> {
|
|
118
|
+
return $$notIn(v)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* @tsplus fluent string $is
|
|
123
|
+
* @tsplus fluent boolean $is
|
|
124
|
+
* @tsplus fluent number $is
|
|
125
|
+
* @tsplus fluent Object $is
|
|
126
|
+
*/
|
|
127
|
+
export function $is<A, V extends A>(_: A, v: V): WhereValue<"eq", A, V> {
|
|
128
|
+
return $$is(v)
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* @tsplus fluent string $isnt
|
|
132
|
+
* @tsplus fluent boolean $isnt
|
|
133
|
+
* @tsplus fluent number $isnt
|
|
134
|
+
* @tsplus fluent Object $isnt
|
|
135
|
+
*/
|
|
136
|
+
export function $isnt<A, V extends A>(_: A, v: V): WhereValue<"not-eq", A, V> {
|
|
137
|
+
return $$isnt(v)
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function $is__<V extends A, A>(v: V) {
|
|
141
|
+
return (_: A) => $is(_, v)
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function $isnt__<V extends A, A>(v: V) {
|
|
145
|
+
return (_: A) => $isnt(_, v)
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
function $in__<A extends SupportedValues, Values extends readonly A[]>(
|
|
150
|
+
...v: Values
|
|
151
|
+
) {
|
|
152
|
+
return (_: A) => $in(_, ...v)
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function $notIn__<A extends SupportedValues, Values extends readonly A[]>(
|
|
156
|
+
...v: Values
|
|
157
|
+
) {
|
|
158
|
+
return (_: A) => $notIn(_, ...v)
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// function $contains__<A extends SupportedValues, V extends A>(
|
|
162
|
+
// v: V
|
|
163
|
+
// ) {
|
|
164
|
+
// return (_: readonly A[]) => $contains(_, v)
|
|
165
|
+
// }
|
|
166
|
+
|
|
167
|
+
// function $notContains__<A extends SupportedValues, V extends A>(
|
|
168
|
+
// v: V
|
|
169
|
+
// ) {
|
|
170
|
+
// return (_: readonly A[]) => $notContains(_, v)
|
|
171
|
+
// }
|
|
172
|
+
|
|
173
|
+
export const Filters = {
|
|
174
|
+
$is: $is__,
|
|
175
|
+
$isnt: $isnt__,
|
|
176
|
+
$in: $in__,
|
|
177
|
+
$notIn: $notIn__,
|
|
178
|
+
// $contains: $contains__,
|
|
179
|
+
// $notContains: $notContains__,
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* @tsplus fluent string $startsWith
|
|
184
|
+
*/
|
|
185
|
+
export function $startsWith<A extends string, V extends A>(_: A, v: V): WhereValue<"starts-with", A, V> {
|
|
186
|
+
return $$startsWith(v)
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* @tsplus fluent string $endsWith
|
|
191
|
+
*/
|
|
192
|
+
export function $endsWith<A extends string, V extends A>(_: A, v: V): WhereValue<"ends-with", A, V> {
|
|
193
|
+
return $$endsWith(v)
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* @tsplus fluent string $includes
|
|
198
|
+
*/
|
|
199
|
+
export function $includes<A extends string, V extends A>(_: A, v: V): WhereValue<"includes", A, V> {
|
|
200
|
+
return $$includes(v)
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
function $$in<L extends readonly any[]>(v: L) {
|
|
204
|
+
return { t: "in" as const, v }
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
function $$notIn<L extends readonly any[]>(v: L) {
|
|
208
|
+
return { t: "not-in" as const, v }
|
|
209
|
+
}
|
|
210
|
+
function $$is<A>(v: A) {
|
|
211
|
+
return { t: "eq" as const, v }
|
|
212
|
+
}
|
|
213
|
+
function $$isnt<A>(v: A) {
|
|
214
|
+
return { t: "not-eq" as const, v }
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
// containsAny, containsAll?
|
|
218
|
+
function $$contains<A>(v: A) {
|
|
219
|
+
return { t: "contains" as const, v }
|
|
220
|
+
}
|
|
221
|
+
function $$notContains<A>(v: A) {
|
|
222
|
+
return { t: "not-contains" as const, v }
|
|
223
|
+
}
|
|
224
|
+
function $$includes<A extends string>(v: A) {
|
|
225
|
+
return { t: "includes" as const, v }
|
|
226
|
+
}
|
|
227
|
+
function $$startsWith<A extends string>(v: A) {
|
|
228
|
+
return { t: "starts-with" as const, v }
|
|
229
|
+
}
|
|
230
|
+
function $$endsWith<A extends string>(v: A) {
|
|
231
|
+
return { t: "ends-with" as const, v }
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
type ValueType<V> = {
|
|
235
|
+
t: "in" | "not-in"
|
|
236
|
+
v: readonly V[]
|
|
237
|
+
} | { t: "eq" | "not-eq"; v: V }
|
|
238
|
+
|
|
239
|
+
type TType<T> = T extends ValueType<any> ? T["t"] : never
|
|
240
|
+
type VType<T> = T extends ValueType<any> ? T["v"] : never
|
|
241
|
+
|
|
242
|
+
function f(p: string, b: any) {
|
|
243
|
+
if (typeof b === "function") b = b(undefined)
|
|
244
|
+
const obj = typeof b === "object" && b !== null
|
|
245
|
+
return makeFilter(p, obj ? b.v : b, obj ? b.t ?? "eq" : "eq");
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
function makeFilter<T extends "in" | "not-in" | "eq" | "not-eq">(path: string, value: any, t: T) {
|
|
249
|
+
return { key: path, t, value }
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
type FIL<S, K extends string, T extends "in" | "not-in" | "eq" | "not-eq", V> = {
|
|
253
|
+
key: K
|
|
254
|
+
t: T
|
|
255
|
+
value: V
|
|
256
|
+
readonly S: S
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
export function makeFilters<T extends FieldValues>() {
|
|
261
|
+
type Paths = FieldPath<T>
|
|
262
|
+
type Value<TFieldName extends Paths> = FieldPathValue<T, TFieldName>
|
|
263
|
+
|
|
264
|
+
function test<
|
|
265
|
+
TFieldName extends Paths,
|
|
266
|
+
A extends Value<TFieldName>,
|
|
267
|
+
Val
|
|
268
|
+
>(
|
|
269
|
+
path: TFieldName,
|
|
270
|
+
value: (v: A) => Val
|
|
271
|
+
): FIL<T, string, TType<Val>, VType<Val>>
|
|
272
|
+
function test<
|
|
273
|
+
TFieldName extends Paths,
|
|
274
|
+
A extends Value<TFieldName>
|
|
275
|
+
>(
|
|
276
|
+
path: TFieldName,
|
|
277
|
+
value: A
|
|
278
|
+
): FIL<T, string, "eq", A>
|
|
279
|
+
function test(p: string, v: any) {
|
|
280
|
+
return f(p, v) as any
|
|
281
|
+
}
|
|
282
|
+
return test
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
// export function makeFilter<TFieldValues extends FieldValues>() {
|
|
288
|
+
// const f = makeFilter_<TFieldValues>()
|
|
289
|
+
// return f as WhereFilterHelper<TFieldValues>
|
|
290
|
+
// }
|
|
291
|
+
|
|
292
|
+
// export interface WhereFilterHelper<TFieldValues extends FieldValues> extends ReturnType<typeof makeFilter_<TFieldValues>> {}
|
|
293
|
+
|
|
294
|
+
// function makeFilter_<TFieldValues extends FieldValues>() {
|
|
295
|
+
// function eq<TFieldName extends FieldPath<TFieldValues>, V extends FieldPathValue<TFieldValues, TFieldName>>(
|
|
296
|
+
// path: TFieldName,
|
|
297
|
+
// value: V
|
|
298
|
+
// ) {
|
|
299
|
+
// return { key: path, value, t: "eq" as const }
|
|
300
|
+
// }
|
|
301
|
+
// const f = Object.assign(eq satisfies (...args: any[]) => Where, {
|
|
302
|
+
// in<TFieldName extends FieldPath<TFieldValues>, V extends FieldPathValue<TFieldValues, TFieldName>>(
|
|
303
|
+
// path: TFieldName,
|
|
304
|
+
// value: readonly V[]
|
|
305
|
+
// ) {
|
|
306
|
+
// return { key: path, value, t: "in" as const }
|
|
307
|
+
// },
|
|
308
|
+
// notIn<TFieldName extends FieldPath<TFieldValues>, V extends FieldPathValue<TFieldValues, TFieldName>>(
|
|
309
|
+
// path: TFieldName,
|
|
310
|
+
// value: readonly V[]
|
|
311
|
+
// ) {
|
|
312
|
+
// return { key: path, value, t: "not-in" as const }
|
|
313
|
+
// },
|
|
314
|
+
// eq,
|
|
315
|
+
// notEq<TFieldName extends FieldPath<TFieldValues>, V extends FieldPathValue<TFieldValues, TFieldName>>(
|
|
316
|
+
// path: TFieldName,
|
|
317
|
+
// value: V
|
|
318
|
+
// ) {
|
|
319
|
+
// return { key: path, value, t: "not-eq" as const }
|
|
320
|
+
// }
|
|
321
|
+
// } satisfies Record<string, (...args: any[]) => Where>)
|
|
322
|
+
// return f
|
|
323
|
+
// }
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @tsplus fluent effect/io/Effect instrument
|
|
3
|
+
*/
|
|
4
|
+
export function instr<R, E, A>(self: Effect<R, E, A>, name: string, properties?: Record<string, string>) {
|
|
5
|
+
return self
|
|
6
|
+
.tap(() => Effect.logDebug(`instrumented`).logAnnotate("properties", (properties || {}).$$.pretty))
|
|
7
|
+
.withSpan(name)
|
|
8
|
+
// trackMetric(name, time, properties))
|
|
9
|
+
}
|