effect-app 4.0.0-beta.25 → 4.0.0-beta.250
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1131 -0
- package/dist/Array.d.ts +3 -2
- package/dist/Array.d.ts.map +1 -1
- package/dist/Array.js +4 -4
- package/dist/Chunk.d.ts +1 -1
- package/dist/Chunk.d.ts.map +1 -1
- package/dist/Config/SecretURL.d.ts +4 -2
- package/dist/Config/SecretURL.d.ts.map +1 -1
- package/dist/Config/SecretURL.js +3 -6
- package/dist/Config/internal/configSecretURL.d.ts +1 -1
- package/dist/Config/internal/configSecretURL.d.ts.map +1 -1
- package/dist/Config/internal/configSecretURL.js +2 -2
- package/dist/Config.d.ts +7 -0
- package/dist/Config.d.ts.map +1 -0
- package/dist/Config.js +6 -0
- package/dist/ConfigProvider.d.ts +39 -0
- package/dist/ConfigProvider.d.ts.map +1 -0
- package/dist/ConfigProvider.js +42 -0
- package/dist/Context.d.ts +42 -0
- package/dist/Context.d.ts.map +1 -0
- package/dist/Context.js +67 -0
- package/dist/Effect.d.ts +13 -12
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +5 -8
- package/dist/Emailer.d.ts +51 -0
- package/dist/Emailer.d.ts.map +1 -0
- package/dist/Emailer.js +7 -0
- package/dist/Function.d.ts +1 -1
- package/dist/Function.d.ts.map +1 -1
- package/dist/Inputify.type.d.ts +1 -1
- package/dist/Layer.d.ts +11 -7
- package/dist/Layer.d.ts.map +1 -1
- package/dist/Layer.js +3 -2
- package/dist/Model/Repository/Registry.d.ts +21 -0
- package/dist/Model/Repository/Registry.d.ts.map +1 -0
- package/dist/Model/Repository/Registry.js +18 -0
- package/dist/Model/Repository/ext.d.ts +60 -0
- package/dist/Model/Repository/ext.d.ts.map +1 -0
- package/dist/Model/Repository/ext.js +122 -0
- package/dist/Model/Repository/internal/internal.d.ts +62 -0
- package/dist/Model/Repository/internal/internal.d.ts.map +1 -0
- package/dist/Model/Repository/internal/internal.js +398 -0
- package/dist/Model/Repository/legacy.d.ts +21 -0
- package/dist/Model/Repository/legacy.d.ts.map +1 -0
- package/dist/Model/Repository/legacy.js +2 -0
- package/dist/Model/Repository/makeRepo.d.ts +53 -0
- package/dist/Model/Repository/makeRepo.d.ts.map +1 -0
- package/dist/Model/Repository/makeRepo.js +27 -0
- package/dist/Model/Repository/service.d.ts +97 -0
- package/dist/Model/Repository/service.d.ts.map +1 -0
- package/dist/Model/Repository/service.js +2 -0
- package/dist/Model/Repository/validation.d.ts +71 -0
- package/dist/Model/Repository/validation.d.ts.map +1 -0
- package/dist/Model/Repository/validation.js +32 -0
- package/dist/Model/Repository.d.ts +7 -0
- package/dist/Model/Repository.d.ts.map +1 -0
- package/dist/Model/Repository.js +7 -0
- package/dist/Model/dsl.d.ts +33 -0
- package/dist/Model/dsl.d.ts.map +1 -0
- package/dist/Model/dsl.js +43 -0
- package/dist/Model/filter/filterApi.d.ts +30 -0
- package/dist/Model/filter/filterApi.d.ts.map +1 -0
- package/dist/Model/filter/filterApi.js +2 -0
- package/dist/Model/filter/types/errors.d.ts +29 -0
- package/dist/Model/filter/types/errors.d.ts.map +1 -0
- package/dist/Model/filter/types/errors.js +2 -0
- package/dist/Model/filter/types/fields.d.ts +15 -0
- package/dist/Model/filter/types/fields.d.ts.map +1 -0
- package/dist/Model/filter/types/fields.js +2 -0
- package/dist/Model/filter/types/path/common.d.ts +316 -0
- package/dist/Model/filter/types/path/common.d.ts.map +1 -0
- package/dist/Model/filter/types/path/common.js +2 -0
- package/dist/Model/filter/types/path/eager.d.ts +95 -0
- package/dist/Model/filter/types/path/eager.d.ts.map +1 -0
- package/dist/Model/filter/types/path/eager.js +31 -0
- package/dist/Model/filter/types/path/index.d.ts +4 -0
- package/dist/Model/filter/types/path/index.d.ts.map +1 -0
- package/dist/Model/filter/types/path/index.js +3 -0
- package/dist/Model/filter/types/utils.d.ts +79 -0
- package/dist/Model/filter/types/utils.d.ts.map +1 -0
- package/dist/Model/filter/types/utils.js +2 -0
- package/dist/Model/filter/types/validator.d.ts +30 -0
- package/dist/Model/filter/types/validator.d.ts.map +1 -0
- package/dist/Model/filter/types/validator.js +2 -0
- package/dist/Model/filter/types.d.ts +5 -0
- package/dist/Model/filter/types.d.ts.map +1 -0
- package/dist/Model/filter/types.js +7 -0
- package/dist/Model/query/dsl.d.ts +446 -0
- package/dist/Model/query/dsl.d.ts.map +1 -0
- package/dist/Model/query/dsl.js +342 -0
- package/dist/Model/query/new-kid-interpreter.d.ts +136 -0
- package/dist/Model/query/new-kid-interpreter.d.ts.map +1 -0
- package/dist/Model/query/new-kid-interpreter.js +336 -0
- package/dist/Model/query.d.ts +15 -0
- package/dist/Model/query.d.ts.map +1 -0
- package/dist/Model/query.js +3 -0
- package/dist/Model.d.ts +5 -0
- package/dist/Model.d.ts.map +1 -0
- package/dist/Model.js +5 -0
- package/dist/NonEmptySet.d.ts +4 -2
- package/dist/NonEmptySet.d.ts.map +1 -1
- package/dist/NonEmptySet.js +2 -2
- package/dist/Option.d.ts +2 -1
- package/dist/Option.d.ts.map +1 -1
- package/dist/Option.js +3 -1
- package/dist/Pure.d.ts +8 -6
- package/dist/Pure.d.ts.map +1 -1
- package/dist/Pure.js +17 -14
- package/dist/QueueMaker.d.ts +13 -0
- package/dist/QueueMaker.d.ts.map +1 -0
- package/dist/QueueMaker.js +4 -0
- package/dist/RequestContext.d.ts +103 -0
- package/dist/RequestContext.d.ts.map +1 -0
- package/dist/RequestContext.js +49 -0
- package/dist/Schema/Class.d.ts +66 -20
- package/dist/Schema/Class.d.ts.map +1 -1
- package/dist/Schema/Class.js +192 -23
- package/dist/Schema/FastCheck.d.ts +1 -1
- package/dist/Schema/FastCheck.d.ts.map +1 -1
- package/dist/Schema/Methods.d.ts +1 -1
- package/dist/Schema/SchemaParser.d.ts +5 -0
- package/dist/Schema/SchemaParser.d.ts.map +1 -0
- package/dist/Schema/SchemaParser.js +6 -0
- package/dist/Schema/SpecialJsonSchema.d.ts +34 -0
- package/dist/Schema/SpecialJsonSchema.d.ts.map +1 -0
- package/dist/Schema/SpecialJsonSchema.js +118 -0
- package/dist/Schema/SpecialOpenApi.d.ts +32 -0
- package/dist/Schema/SpecialOpenApi.d.ts.map +1 -0
- package/dist/Schema/SpecialOpenApi.js +123 -0
- package/dist/Schema/brand.d.ts +5 -3
- package/dist/Schema/brand.d.ts.map +1 -1
- package/dist/Schema/brand.js +3 -1
- package/dist/Schema/email.d.ts +1 -1
- package/dist/Schema/email.d.ts.map +1 -1
- package/dist/Schema/email.js +7 -4
- package/dist/Schema/ext.d.ts +339 -56
- package/dist/Schema/ext.d.ts.map +1 -1
- package/dist/Schema/ext.js +358 -53
- package/dist/Schema/moreStrings.d.ts +108 -26
- package/dist/Schema/moreStrings.d.ts.map +1 -1
- package/dist/Schema/moreStrings.js +45 -16
- package/dist/Schema/numbers.d.ts +55 -15
- package/dist/Schema/numbers.d.ts.map +1 -1
- package/dist/Schema/numbers.js +60 -12
- package/dist/Schema/phoneNumber.d.ts +1 -1
- package/dist/Schema/phoneNumber.d.ts.map +1 -1
- package/dist/Schema/phoneNumber.js +6 -3
- package/dist/Schema/schema.d.ts +1 -1
- package/dist/Schema/strings.d.ts +5 -5
- package/dist/Schema/strings.d.ts.map +1 -1
- package/dist/Schema/strings.js +1 -5
- package/dist/Schema.d.ts +214 -8
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +190 -11
- package/dist/Set.d.ts +5 -2
- package/dist/Set.d.ts.map +1 -1
- package/dist/Set.js +3 -2
- package/dist/Store.d.ts +166 -0
- package/dist/Store.d.ts.map +1 -0
- package/dist/Store.js +117 -0
- package/dist/TypeTest.d.ts +1 -1
- package/dist/Types.d.ts +1 -1
- package/dist/Widen.type.d.ts +1 -1
- package/dist/_ext/Array.d.ts +2 -2
- package/dist/_ext/Array.d.ts.map +1 -1
- package/dist/_ext/Array.js +4 -2
- package/dist/_ext/date.d.ts +1 -1
- package/dist/_ext/misc.d.ts +5 -2
- package/dist/_ext/misc.d.ts.map +1 -1
- package/dist/_ext/misc.js +4 -2
- package/dist/_ext/ord.ext.d.ts +3 -2
- package/dist/_ext/ord.ext.d.ts.map +1 -1
- package/dist/_ext/ord.ext.js +2 -2
- package/dist/builtin.d.ts +1 -1
- package/dist/builtin.d.ts.map +1 -1
- package/dist/client/InvalidationKeys.d.ts +29 -0
- package/dist/client/InvalidationKeys.d.ts.map +1 -0
- package/dist/client/InvalidationKeys.js +33 -0
- package/dist/client/apiClientFactory.d.ts +20 -32
- package/dist/client/apiClientFactory.d.ts.map +1 -1
- package/dist/client/apiClientFactory.js +104 -34
- package/dist/client/clientFor.d.ts +53 -19
- package/dist/client/clientFor.d.ts.map +1 -1
- package/dist/client/clientFor.js +9 -1
- package/dist/client/errors.d.ts +49 -25
- package/dist/client/errors.d.ts.map +1 -1
- package/dist/client/errors.js +43 -17
- package/dist/client/makeClient.d.ts +495 -33
- package/dist/client/makeClient.d.ts.map +1 -1
- package/dist/client/makeClient.js +66 -24
- package/dist/client.d.ts +6 -5
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +2 -1
- package/dist/faker.d.ts +1 -1
- package/dist/faker.d.ts.map +1 -1
- package/dist/http/Request.d.ts +2 -2
- package/dist/http/Request.d.ts.map +1 -1
- package/dist/http/Request.js +2 -2
- package/dist/http/internal/lib.d.ts +1 -1
- package/dist/http.d.ts +1 -1
- package/dist/ids.d.ts +40 -12
- package/dist/ids.d.ts.map +1 -1
- package/dist/ids.js +25 -3
- package/dist/index.d.ts +7 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -8
- package/dist/logger.d.ts +1 -1
- package/dist/middleware.d.ts +14 -8
- package/dist/middleware.d.ts.map +1 -1
- package/dist/middleware.js +14 -8
- package/dist/rpc/Invalidation.d.ts +420 -0
- package/dist/rpc/Invalidation.d.ts.map +1 -0
- package/dist/rpc/Invalidation.js +168 -0
- package/dist/rpc/MiddlewareMaker.d.ts +12 -8
- package/dist/rpc/MiddlewareMaker.d.ts.map +1 -1
- package/dist/rpc/MiddlewareMaker.js +59 -38
- package/dist/rpc/RpcContextMap.d.ts +4 -4
- package/dist/rpc/RpcContextMap.d.ts.map +1 -1
- package/dist/rpc/RpcContextMap.js +4 -4
- package/dist/rpc/RpcMiddleware.d.ts +15 -11
- package/dist/rpc/RpcMiddleware.d.ts.map +1 -1
- package/dist/rpc/RpcMiddleware.js +1 -1
- package/dist/rpc.d.ts +2 -2
- package/dist/rpc.d.ts.map +1 -1
- package/dist/rpc.js +2 -2
- package/dist/runtime.d.ts +19 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +40 -0
- package/dist/toast.d.ts +51 -0
- package/dist/toast.d.ts.map +1 -0
- package/dist/toast.js +34 -0
- package/dist/transform.d.ts +2 -2
- package/dist/transform.d.ts.map +1 -1
- package/dist/transform.js +4 -5
- package/dist/utils/effectify.d.ts +2 -2
- package/dist/utils/effectify.d.ts.map +1 -1
- package/dist/utils/effectify.js +2 -2
- package/dist/utils/extend.d.ts +1 -1
- package/dist/utils/extend.d.ts.map +1 -1
- package/dist/utils/gen.d.ts +5 -5
- package/dist/utils/gen.d.ts.map +1 -1
- package/dist/utils/logLevel.d.ts +3 -3
- package/dist/utils/logLevel.d.ts.map +1 -1
- package/dist/utils/logger.d.ts +5 -4
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +4 -4
- package/dist/utils.d.ts +40 -45
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +19 -27
- package/dist/validation/validators.d.ts +1 -1
- package/dist/validation/validators.d.ts.map +1 -1
- package/dist/validation.d.ts +1 -1
- package/dist/validation.d.ts.map +1 -1
- package/dist/withToast.d.ts +30 -0
- package/dist/withToast.d.ts.map +1 -0
- package/dist/withToast.js +64 -0
- package/package.json +158 -24
- package/src/Array.ts +3 -3
- package/src/Config/SecretURL.ts +5 -2
- package/src/Config/internal/configSecretURL.ts +1 -1
- package/src/Config.ts +14 -0
- package/src/ConfigProvider.ts +48 -0
- package/src/{ServiceMap.ts → Context.ts} +56 -63
- package/src/Effect.ts +12 -14
- package/src/Emailer.ts +51 -0
- package/src/Layer.ts +10 -6
- package/src/Model/Repository/Registry.ts +34 -0
- package/src/Model/Repository/ext.ts +375 -0
- package/src/Model/Repository/internal/internal.ts +692 -0
- package/src/Model/Repository/legacy.ts +29 -0
- package/src/Model/Repository/makeRepo.ts +144 -0
- package/src/Model/Repository/service.ts +639 -0
- package/src/Model/Repository/validation.ts +31 -0
- package/src/Model/Repository.ts +6 -0
- package/src/Model/dsl.ts +129 -0
- package/src/Model/filter/filterApi.ts +60 -0
- package/src/Model/filter/types/errors.ts +47 -0
- package/src/Model/filter/types/fields.ts +50 -0
- package/src/Model/filter/types/path/common.ts +404 -0
- package/src/Model/filter/types/path/eager.ts +297 -0
- package/src/Model/filter/types/path/index.ts +4 -0
- package/src/Model/filter/types/utils.ts +128 -0
- package/src/Model/filter/types/validator.ts +46 -0
- package/src/Model/filter/types.ts +6 -0
- package/src/Model/query/dsl.ts +2546 -0
- package/src/Model/query/new-kid-interpreter.ts +484 -0
- package/src/Model/query.ts +13 -0
- package/src/Model.ts +4 -0
- package/src/NonEmptySet.ts +3 -1
- package/src/Option.ts +2 -0
- package/src/Pure.ts +21 -19
- package/src/QueueMaker.ts +19 -0
- package/src/RequestContext.ts +62 -0
- package/src/Schema/Class.ts +274 -64
- package/src/Schema/SchemaParser.ts +12 -0
- package/src/Schema/SpecialJsonSchema.ts +139 -0
- package/src/Schema/SpecialOpenApi.ts +130 -0
- package/src/Schema/brand.ts +22 -2
- package/src/Schema/email.ts +7 -2
- package/src/Schema/ext.ts +443 -88
- package/src/Schema/moreStrings.ts +93 -37
- package/src/Schema/numbers.ts +64 -16
- package/src/Schema/phoneNumber.ts +5 -1
- package/src/Schema/strings.ts +4 -8
- package/src/Schema.ts +374 -10
- package/src/Set.ts +5 -1
- package/src/Store.ts +273 -0
- package/src/_ext/Array.ts +3 -1
- package/src/_ext/misc.ts +4 -1
- package/src/_ext/ord.ext.ts +2 -1
- package/src/client/InvalidationKeys.ts +50 -0
- package/src/client/apiClientFactory.ts +230 -131
- package/src/client/clientFor.ts +102 -31
- package/src/client/errors.ts +52 -26
- package/src/client/makeClient.ts +592 -71
- package/src/client.ts +5 -4
- package/src/http/Request.ts +1 -1
- package/src/ids.ts +25 -3
- package/src/index.ts +7 -10
- package/src/middleware.ts +13 -9
- package/src/rpc/Invalidation.ts +261 -0
- package/src/rpc/MiddlewareMaker.ts +83 -75
- package/src/rpc/README.md +2 -2
- package/src/rpc/RpcContextMap.ts +6 -5
- package/src/rpc/RpcMiddleware.ts +18 -12
- package/src/rpc.ts +1 -1
- package/src/runtime.ts +56 -0
- package/src/toast.ts +54 -0
- package/src/transform.ts +3 -3
- package/src/utils/effectify.ts +1 -1
- package/src/utils/gen.ts +8 -8
- package/src/utils/logLevel.ts +1 -1
- package/src/utils/logger.ts +4 -3
- package/src/utils.ts +62 -139
- package/src/withToast.ts +133 -0
- package/test/dist/rpc-dynamic-middleware.test.d.ts.map +1 -0
- package/test/dist/rpc.test.d.ts.map +1 -1
- package/test/dist/secretURL.test.d.ts.map +1 -0
- package/test/dist/special.test.d.ts.map +1 -0
- package/test/dist/stream-error.types.d.ts +2 -0
- package/test/dist/stream-error.types.d.ts.map +1 -0
- package/test/dist/stream-error.types.js +27 -0
- package/test/moreStrings.test.ts +1 -1
- package/test/rpc.test.ts +46 -6
- package/test/schema.test.ts +459 -30
- package/test/secretURL.test.ts +160 -0
- package/test/special.test.ts +1026 -0
- package/test/utils.test.ts +7 -7
- package/tsconfig.base.json +6 -5
- package/tsconfig.json +2 -1
- package/tsconfig.json.bak +2 -2
- package/tsconfig.src.json +29 -29
- package/tsconfig.test.json +2 -2
- package/dist/Operations.d.ts +0 -123
- package/dist/Operations.d.ts.map +0 -1
- package/dist/Operations.js +0 -29
- package/dist/ServiceMap.d.ts +0 -44
- package/dist/ServiceMap.d.ts.map +0 -1
- package/dist/ServiceMap.js +0 -91
- package/eslint.config.mjs +0 -26
- package/src/Operations.ts +0 -55
package/package.json
CHANGED
|
@@ -1,31 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "effect-app",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.250",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@tsconfig/strictest": "^2.0.8",
|
|
8
8
|
"date-fns": "^4.1.0",
|
|
9
|
-
"nanoid": "^5.1.
|
|
9
|
+
"nanoid": "^5.1.11",
|
|
10
10
|
"path-parser": "^6.1.0",
|
|
11
11
|
"query-string": "^9.3.1",
|
|
12
12
|
"ts-pattern": "^5.9.0",
|
|
13
13
|
"ts-toolbelt": "^9.6.0",
|
|
14
|
-
"uuid": "^
|
|
15
|
-
"validator": "^13.15.
|
|
14
|
+
"uuid": "^14.0.0",
|
|
15
|
+
"validator": "^13.15.35"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@faker-js/faker": "^8.4.1",
|
|
19
|
-
"@types/node": "25.
|
|
19
|
+
"@types/node": "25.6.0",
|
|
20
20
|
"@types/uuid": "^11.0.0",
|
|
21
21
|
"@types/validator": "^13.15.10",
|
|
22
|
-
"fast-check": "~4.
|
|
23
|
-
"typescript": "~
|
|
24
|
-
"vitest": "^4.
|
|
25
|
-
"@effect-app/eslint-shared-config": "0.5.7-beta.2"
|
|
22
|
+
"fast-check": "~4.7.0",
|
|
23
|
+
"typescript": "~6.0.3",
|
|
24
|
+
"vitest": "^4.1.5"
|
|
26
25
|
},
|
|
27
26
|
"peerDependencies": {
|
|
28
|
-
"effect": "^4.0.0-beta.
|
|
27
|
+
"effect": "^4.0.0-beta.70"
|
|
29
28
|
},
|
|
30
29
|
"typesVersions": {
|
|
31
30
|
"*": {
|
|
@@ -47,14 +46,30 @@
|
|
|
47
46
|
"types": "./dist/Chunk.d.ts",
|
|
48
47
|
"default": "./dist/Chunk.js"
|
|
49
48
|
},
|
|
49
|
+
"./Config": {
|
|
50
|
+
"types": "./dist/Config.d.ts",
|
|
51
|
+
"default": "./dist/Config.js"
|
|
52
|
+
},
|
|
50
53
|
"./Config/SecretURL": {
|
|
51
54
|
"types": "./dist/Config/SecretURL.d.ts",
|
|
52
55
|
"default": "./dist/Config/SecretURL.js"
|
|
53
56
|
},
|
|
57
|
+
"./ConfigProvider": {
|
|
58
|
+
"types": "./dist/ConfigProvider.d.ts",
|
|
59
|
+
"default": "./dist/ConfigProvider.js"
|
|
60
|
+
},
|
|
61
|
+
"./Context": {
|
|
62
|
+
"types": "./dist/Context.d.ts",
|
|
63
|
+
"default": "./dist/Context.js"
|
|
64
|
+
},
|
|
54
65
|
"./Effect": {
|
|
55
66
|
"types": "./dist/Effect.d.ts",
|
|
56
67
|
"default": "./dist/Effect.js"
|
|
57
68
|
},
|
|
69
|
+
"./Emailer": {
|
|
70
|
+
"types": "./dist/Emailer.d.ts",
|
|
71
|
+
"default": "./dist/Emailer.js"
|
|
72
|
+
},
|
|
58
73
|
"./Function": {
|
|
59
74
|
"types": "./dist/Function.d.ts",
|
|
60
75
|
"default": "./dist/Function.js"
|
|
@@ -67,14 +82,94 @@
|
|
|
67
82
|
"types": "./dist/Layer.d.ts",
|
|
68
83
|
"default": "./dist/Layer.js"
|
|
69
84
|
},
|
|
85
|
+
"./Model": {
|
|
86
|
+
"types": "./dist/Model.d.ts",
|
|
87
|
+
"default": "./dist/Model.js"
|
|
88
|
+
},
|
|
89
|
+
"./Model/Repository": {
|
|
90
|
+
"types": "./dist/Model/Repository.d.ts",
|
|
91
|
+
"default": "./dist/Model/Repository.js"
|
|
92
|
+
},
|
|
93
|
+
"./Model/Repository/Registry": {
|
|
94
|
+
"types": "./dist/Model/Repository/Registry.d.ts",
|
|
95
|
+
"default": "./dist/Model/Repository/Registry.js"
|
|
96
|
+
},
|
|
97
|
+
"./Model/Repository/ext": {
|
|
98
|
+
"types": "./dist/Model/Repository/ext.d.ts",
|
|
99
|
+
"default": "./dist/Model/Repository/ext.js"
|
|
100
|
+
},
|
|
101
|
+
"./Model/Repository/legacy": {
|
|
102
|
+
"types": "./dist/Model/Repository/legacy.d.ts",
|
|
103
|
+
"default": "./dist/Model/Repository/legacy.js"
|
|
104
|
+
},
|
|
105
|
+
"./Model/Repository/makeRepo": {
|
|
106
|
+
"types": "./dist/Model/Repository/makeRepo.d.ts",
|
|
107
|
+
"default": "./dist/Model/Repository/makeRepo.js"
|
|
108
|
+
},
|
|
109
|
+
"./Model/Repository/service": {
|
|
110
|
+
"types": "./dist/Model/Repository/service.d.ts",
|
|
111
|
+
"default": "./dist/Model/Repository/service.js"
|
|
112
|
+
},
|
|
113
|
+
"./Model/Repository/validation": {
|
|
114
|
+
"types": "./dist/Model/Repository/validation.d.ts",
|
|
115
|
+
"default": "./dist/Model/Repository/validation.js"
|
|
116
|
+
},
|
|
117
|
+
"./Model/dsl": {
|
|
118
|
+
"types": "./dist/Model/dsl.d.ts",
|
|
119
|
+
"default": "./dist/Model/dsl.js"
|
|
120
|
+
},
|
|
121
|
+
"./Model/filter/filterApi": {
|
|
122
|
+
"types": "./dist/Model/filter/filterApi.d.ts",
|
|
123
|
+
"default": "./dist/Model/filter/filterApi.js"
|
|
124
|
+
},
|
|
125
|
+
"./Model/filter/types": {
|
|
126
|
+
"types": "./dist/Model/filter/types.d.ts",
|
|
127
|
+
"default": "./dist/Model/filter/types.js"
|
|
128
|
+
},
|
|
129
|
+
"./Model/filter/types/errors": {
|
|
130
|
+
"types": "./dist/Model/filter/types/errors.d.ts",
|
|
131
|
+
"default": "./dist/Model/filter/types/errors.js"
|
|
132
|
+
},
|
|
133
|
+
"./Model/filter/types/fields": {
|
|
134
|
+
"types": "./dist/Model/filter/types/fields.d.ts",
|
|
135
|
+
"default": "./dist/Model/filter/types/fields.js"
|
|
136
|
+
},
|
|
137
|
+
"./Model/filter/types/path/common": {
|
|
138
|
+
"types": "./dist/Model/filter/types/path/common.d.ts",
|
|
139
|
+
"default": "./dist/Model/filter/types/path/common.js"
|
|
140
|
+
},
|
|
141
|
+
"./Model/filter/types/path/eager": {
|
|
142
|
+
"types": "./dist/Model/filter/types/path/eager.d.ts",
|
|
143
|
+
"default": "./dist/Model/filter/types/path/eager.js"
|
|
144
|
+
},
|
|
145
|
+
"./Model/filter/types/path/index": {
|
|
146
|
+
"types": "./dist/Model/filter/types/path/index.d.ts",
|
|
147
|
+
"default": "./dist/Model/filter/types/path/index.js"
|
|
148
|
+
},
|
|
149
|
+
"./Model/filter/types/utils": {
|
|
150
|
+
"types": "./dist/Model/filter/types/utils.d.ts",
|
|
151
|
+
"default": "./dist/Model/filter/types/utils.js"
|
|
152
|
+
},
|
|
153
|
+
"./Model/filter/types/validator": {
|
|
154
|
+
"types": "./dist/Model/filter/types/validator.d.ts",
|
|
155
|
+
"default": "./dist/Model/filter/types/validator.js"
|
|
156
|
+
},
|
|
157
|
+
"./Model/query": {
|
|
158
|
+
"types": "./dist/Model/query.d.ts",
|
|
159
|
+
"default": "./dist/Model/query.js"
|
|
160
|
+
},
|
|
161
|
+
"./Model/query/dsl": {
|
|
162
|
+
"types": "./dist/Model/query/dsl.d.ts",
|
|
163
|
+
"default": "./dist/Model/query/dsl.js"
|
|
164
|
+
},
|
|
165
|
+
"./Model/query/new-kid-interpreter": {
|
|
166
|
+
"types": "./dist/Model/query/new-kid-interpreter.d.ts",
|
|
167
|
+
"default": "./dist/Model/query/new-kid-interpreter.js"
|
|
168
|
+
},
|
|
70
169
|
"./NonEmptySet": {
|
|
71
170
|
"types": "./dist/NonEmptySet.d.ts",
|
|
72
171
|
"default": "./dist/NonEmptySet.js"
|
|
73
172
|
},
|
|
74
|
-
"./Operations": {
|
|
75
|
-
"types": "./dist/Operations.d.ts",
|
|
76
|
-
"default": "./dist/Operations.js"
|
|
77
|
-
},
|
|
78
173
|
"./Option": {
|
|
79
174
|
"types": "./dist/Option.d.ts",
|
|
80
175
|
"default": "./dist/Option.js"
|
|
@@ -83,6 +178,14 @@
|
|
|
83
178
|
"types": "./dist/Pure.d.ts",
|
|
84
179
|
"default": "./dist/Pure.js"
|
|
85
180
|
},
|
|
181
|
+
"./QueueMaker": {
|
|
182
|
+
"types": "./dist/QueueMaker.d.ts",
|
|
183
|
+
"default": "./dist/QueueMaker.js"
|
|
184
|
+
},
|
|
185
|
+
"./RequestContext": {
|
|
186
|
+
"types": "./dist/RequestContext.d.ts",
|
|
187
|
+
"default": "./dist/RequestContext.js"
|
|
188
|
+
},
|
|
86
189
|
"./Schema": {
|
|
87
190
|
"types": "./dist/Schema.d.ts",
|
|
88
191
|
"default": "./dist/Schema.js"
|
|
@@ -99,6 +202,18 @@
|
|
|
99
202
|
"types": "./dist/Schema/Methods.d.ts",
|
|
100
203
|
"default": "./dist/Schema/Methods.js"
|
|
101
204
|
},
|
|
205
|
+
"./Schema/SchemaParser": {
|
|
206
|
+
"types": "./dist/Schema/SchemaParser.d.ts",
|
|
207
|
+
"default": "./dist/Schema/SchemaParser.js"
|
|
208
|
+
},
|
|
209
|
+
"./Schema/SpecialJsonSchema": {
|
|
210
|
+
"types": "./dist/Schema/SpecialJsonSchema.d.ts",
|
|
211
|
+
"default": "./dist/Schema/SpecialJsonSchema.js"
|
|
212
|
+
},
|
|
213
|
+
"./Schema/SpecialOpenApi": {
|
|
214
|
+
"types": "./dist/Schema/SpecialOpenApi.d.ts",
|
|
215
|
+
"default": "./dist/Schema/SpecialOpenApi.js"
|
|
216
|
+
},
|
|
102
217
|
"./Schema/brand": {
|
|
103
218
|
"types": "./dist/Schema/brand.d.ts",
|
|
104
219
|
"default": "./dist/Schema/brand.js"
|
|
@@ -131,14 +246,14 @@
|
|
|
131
246
|
"types": "./dist/Schema/strings.d.ts",
|
|
132
247
|
"default": "./dist/Schema/strings.js"
|
|
133
248
|
},
|
|
134
|
-
"./ServiceMap": {
|
|
135
|
-
"types": "./dist/ServiceMap.d.ts",
|
|
136
|
-
"default": "./dist/ServiceMap.js"
|
|
137
|
-
},
|
|
138
249
|
"./Set": {
|
|
139
250
|
"types": "./dist/Set.d.ts",
|
|
140
251
|
"default": "./dist/Set.js"
|
|
141
252
|
},
|
|
253
|
+
"./Store": {
|
|
254
|
+
"types": "./dist/Store.d.ts",
|
|
255
|
+
"default": "./dist/Store.js"
|
|
256
|
+
},
|
|
142
257
|
"./TypeTest": {
|
|
143
258
|
"types": "./dist/TypeTest.d.ts",
|
|
144
259
|
"default": "./dist/TypeTest.js"
|
|
@@ -175,6 +290,10 @@
|
|
|
175
290
|
"types": "./dist/client.d.ts",
|
|
176
291
|
"default": "./dist/client.js"
|
|
177
292
|
},
|
|
293
|
+
"./client/InvalidationKeys": {
|
|
294
|
+
"types": "./dist/client/InvalidationKeys.d.ts",
|
|
295
|
+
"default": "./dist/client/InvalidationKeys.js"
|
|
296
|
+
},
|
|
178
297
|
"./client/apiClientFactory": {
|
|
179
298
|
"types": "./dist/client/apiClientFactory.d.ts",
|
|
180
299
|
"default": "./dist/client/apiClientFactory.js"
|
|
@@ -219,6 +338,10 @@
|
|
|
219
338
|
"types": "./dist/rpc.d.ts",
|
|
220
339
|
"default": "./dist/rpc.js"
|
|
221
340
|
},
|
|
341
|
+
"./rpc/Invalidation": {
|
|
342
|
+
"types": "./dist/rpc/Invalidation.d.ts",
|
|
343
|
+
"default": "./dist/rpc/Invalidation.js"
|
|
344
|
+
},
|
|
222
345
|
"./rpc/MiddlewareMaker": {
|
|
223
346
|
"types": "./dist/rpc/MiddlewareMaker.d.ts",
|
|
224
347
|
"default": "./dist/rpc/MiddlewareMaker.js"
|
|
@@ -231,6 +354,14 @@
|
|
|
231
354
|
"types": "./dist/rpc/RpcMiddleware.d.ts",
|
|
232
355
|
"default": "./dist/rpc/RpcMiddleware.js"
|
|
233
356
|
},
|
|
357
|
+
"./runtime": {
|
|
358
|
+
"types": "./dist/runtime.d.ts",
|
|
359
|
+
"default": "./dist/runtime.js"
|
|
360
|
+
},
|
|
361
|
+
"./toast": {
|
|
362
|
+
"types": "./dist/toast.d.ts",
|
|
363
|
+
"default": "./dist/toast.js"
|
|
364
|
+
},
|
|
234
365
|
"./transform": {
|
|
235
366
|
"types": "./dist/transform.d.ts",
|
|
236
367
|
"default": "./dist/transform.js"
|
|
@@ -266,6 +397,10 @@
|
|
|
266
397
|
"./validation/validators": {
|
|
267
398
|
"types": "./dist/validation/validators.d.ts",
|
|
268
399
|
"default": "./dist/validation/validators.js"
|
|
400
|
+
},
|
|
401
|
+
"./withToast": {
|
|
402
|
+
"types": "./dist/withToast.d.ts",
|
|
403
|
+
"default": "./dist/withToast.js"
|
|
269
404
|
}
|
|
270
405
|
},
|
|
271
406
|
"gitHead": "bd8e27eea3eff97db8739d577d67e7336c078d28",
|
|
@@ -280,20 +415,19 @@
|
|
|
280
415
|
"scripts": {
|
|
281
416
|
"watch": "pnpm build:tsc -w",
|
|
282
417
|
"build:tsc": "pnpm clean-dist && effect-app-cli packagejson && pnpm check",
|
|
283
|
-
"check": "
|
|
418
|
+
"check": "tsgo --build",
|
|
284
419
|
"build:tsc-src": "pnpm clean-dist && effect-app-cli packagejson tsc --build ./tsconfig.src.json",
|
|
285
420
|
"build:src": "pnpm build:tsc-src",
|
|
286
421
|
"build": "pnpm build:tsc",
|
|
287
|
-
"watch2": "pnpm clean-dist && NODE_OPTIONS=--max-old-space-size=6144
|
|
422
|
+
"watch2": "pnpm clean-dist && NODE_OPTIONS=--max-old-space-size=6144 tsgo -w",
|
|
288
423
|
"clean": "rm -rf dist",
|
|
289
424
|
"clean-dist": "sh ../../scripts/clean-dist.sh",
|
|
290
425
|
"circular": "pnpm circular:src && pnpm circular:dist",
|
|
291
426
|
"circular:src": "madge --circular --ts-config ./tsconfig.json --extensions ts ./src",
|
|
292
427
|
"circular:dist": "madge --circular --extensions js ./dist",
|
|
293
|
-
"compile": "NODE_OPTIONS=--max-old-space-size=6144
|
|
294
|
-
"lint": "
|
|
295
|
-
"lint
|
|
296
|
-
"lint-fix": "pnpm lint --fix",
|
|
428
|
+
"compile": "NODE_OPTIONS=--max-old-space-size=6144 tsgo --noEmit",
|
|
429
|
+
"lint": "oxlint --type-aware ./src && pnpm exec dprint check --config ../../dprint.jsonc .",
|
|
430
|
+
"lint-fix": "oxlint --type-aware --fix ./src && pnpm exec dprint fmt --config ../../dprint.jsonc .",
|
|
297
431
|
"test": "vitest",
|
|
298
432
|
"test:run": "pnpm run test run --passWithNoTests",
|
|
299
433
|
"testsuite": "pnpm lint && pnpm circular && pnpm run test:run",
|
package/src/Array.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Chunk, Effect } from "effect"
|
|
2
1
|
import type { NonEmptyArray, NonEmptyReadonlyArray } from "effect/Array"
|
|
3
2
|
import * as Array from "effect/Array"
|
|
4
|
-
import * as
|
|
3
|
+
import * as Chunk from "effect/Chunk"
|
|
4
|
+
import * as Effect from "effect/Effect"
|
|
5
5
|
import { dual, type Predicate } from "./Function.js"
|
|
6
6
|
import * as Option from "./Option.js"
|
|
7
7
|
|
|
@@ -104,7 +104,7 @@ export function chunk_<T>(items_: Iterable<T>, size: number) {
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
export function forEachEffectNA<A, R, E, B>(as: NonEmptyReadonlyArray<A>, f: (a: A) => Effect.Effect<B, E, R>) {
|
|
107
|
-
return Effect.map(
|
|
107
|
+
return Effect.map(Effect.forEach(as, f), (_) => Option.getOrNull(toNonEmptyArray(_)))
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
export * from "effect/Array"
|
package/src/Config/SecretURL.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @since 1.0.0
|
|
3
3
|
*/
|
|
4
|
-
import { Config, type Equal, type Redacted } from "effect"
|
|
5
4
|
import type * as Chunk from "effect/Chunk"
|
|
5
|
+
import * as Config from "effect/Config"
|
|
6
|
+
import type * as Equal from "effect/Equal"
|
|
7
|
+
import type * as Redacted from "effect/Redacted"
|
|
6
8
|
import * as internal from "./internal/configSecretURL.js"
|
|
7
9
|
|
|
8
10
|
// /**
|
|
@@ -21,6 +23,7 @@ import * as internal from "./internal/configSecretURL.js"
|
|
|
21
23
|
* @since 1.0.0
|
|
22
24
|
* @category models
|
|
23
25
|
*/
|
|
26
|
+
// eslint-disable-next-line import/namespace
|
|
24
27
|
export interface SecretURL extends Redacted.Redacted, Equal.Equal {
|
|
25
28
|
/** @internal */
|
|
26
29
|
readonly raw: Array<number>
|
|
@@ -73,5 +76,5 @@ export const value: (self: SecretURL) => string = internal.value
|
|
|
73
76
|
export const unsafeWipe: (self: SecretURL) => void = internal.unsafeWipe
|
|
74
77
|
|
|
75
78
|
export const secretURL = (name?: string): Config.Config<SecretURL> => {
|
|
76
|
-
return Config.map(Config.
|
|
79
|
+
return Config.map(Config.nonEmptyString(name), fromString)
|
|
77
80
|
}
|
package/src/Config.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type Config, make } from "effect/Config"
|
|
2
|
+
import { dual } from "effect/Function"
|
|
3
|
+
|
|
4
|
+
import * as ConfigProvider from "./ConfigProvider.js"
|
|
5
|
+
|
|
6
|
+
export const nested: {
|
|
7
|
+
(name: string): <A>(self: Config<A>) => Config<A>
|
|
8
|
+
<A>(self: Config<A>, name: string): Config<A>
|
|
9
|
+
} = dual(
|
|
10
|
+
2,
|
|
11
|
+
<A>(self: Config<A>, name: string): Config<A> => make((provider) => self.parse(ConfigProvider.nested(provider, name)))
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
export * from "effect/Config"
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type ConfigProvider, make, type Path } from "effect/ConfigProvider"
|
|
2
|
+
import { dual } from "effect/Function"
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Scopes a provider so that all lookups are prefixed with the given path
|
|
6
|
+
* segments.
|
|
7
|
+
*
|
|
8
|
+
* When to use:
|
|
9
|
+
* - Namespacing config under a prefix like `"app"` or `"database"`.
|
|
10
|
+
* - Reusing the same provider shape for multiple sub-configs.
|
|
11
|
+
*
|
|
12
|
+
* Accepts a single string or a full `Path` array. The prefix is prepended
|
|
13
|
+
* *after* any `mapInput` transformation runs, so ordering matters when
|
|
14
|
+
* composing with {@link mapInput} or {@link constantCase}.
|
|
15
|
+
*
|
|
16
|
+
* Supports both data-last and data-first calling conventions.
|
|
17
|
+
*
|
|
18
|
+
* **Example** (Nesting under a prefix)
|
|
19
|
+
*
|
|
20
|
+
* ```ts
|
|
21
|
+
* import * as ConfigProvider from "effect/ConfigProvider"
|
|
22
|
+
*
|
|
23
|
+
* const provider = ConfigProvider.fromEnv({
|
|
24
|
+
* env: { APP_HOST: "localhost", APP_PORT: "3000" }
|
|
25
|
+
* })
|
|
26
|
+
*
|
|
27
|
+
* // Lookups for ["HOST"] now resolve to ["APP", "HOST"]
|
|
28
|
+
* const scoped = ConfigProvider.nested(provider, "APP")
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @see {@link mapInput} – for arbitrary path transformations
|
|
32
|
+
*
|
|
33
|
+
* @category Combinators
|
|
34
|
+
* @since 4.0.0
|
|
35
|
+
*/
|
|
36
|
+
export const nested: {
|
|
37
|
+
(prefix: string | Path): (self: ConfigProvider) => ConfigProvider
|
|
38
|
+
(self: ConfigProvider, prefix: string | Path): ConfigProvider
|
|
39
|
+
} = dual(
|
|
40
|
+
2,
|
|
41
|
+
(self: ConfigProvider, prefix: string | Path): ConfigProvider => {
|
|
42
|
+
let path: Path = typeof prefix === "string" ? [prefix] : prefix
|
|
43
|
+
if (self.mapInput) path = self.mapInput(path)
|
|
44
|
+
return make(self.get, self.mapInput, self.prefix ? [...self.prefix, ...path] : path)
|
|
45
|
+
}
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
export * from "effect/ConfigProvider"
|
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
|
|
3
|
-
* We're doing the long way around here with assignTag, TagBase & TagBaseTagged,
|
|
4
|
-
* because there's a typescript compiler issue where it will complain about Equal.symbol, and Hash.symbol not being accessible.
|
|
5
|
-
* https://github.com/microsoft/TypeScript/issues/52644
|
|
6
|
-
*/
|
|
2
|
+
/* eslint-disable import/namespace */
|
|
7
3
|
|
|
8
|
-
import
|
|
9
|
-
import * as
|
|
10
|
-
import
|
|
4
|
+
import * as CTX from "effect/Context"
|
|
5
|
+
import type * as Effect from "effect/Effect"
|
|
6
|
+
import * as Layer from "effect/Layer"
|
|
7
|
+
import type * as Scope from "effect/Scope"
|
|
8
|
+
import type * as Types from "effect/Types"
|
|
11
9
|
|
|
12
|
-
export * from "effect/
|
|
10
|
+
export * from "effect/Context"
|
|
13
11
|
|
|
14
|
-
export interface Opaque<Self extends object, in out Shape extends object>
|
|
15
|
-
extends ServiceMap.Key<Self, Self>, Yieldable<Opaque<Self, Shape>, Self, never, Self>
|
|
16
|
-
{
|
|
12
|
+
export interface Opaque<Self extends object, in out Shape extends object> extends CTX.Key<Self, Self> {
|
|
17
13
|
of(this: void, self: Shape): Self
|
|
18
|
-
|
|
14
|
+
context(self: Shape): CTX.Context<Self>
|
|
19
15
|
// a version that leverages the Shape -> Self conversion
|
|
20
16
|
toLayer: <E, R>(
|
|
21
17
|
eff: Effect.Effect<Shape, E, R>
|
|
@@ -25,11 +21,11 @@ export interface Opaque<Self extends object, in out Shape extends object>
|
|
|
25
21
|
}
|
|
26
22
|
|
|
27
23
|
// export interface OpaqueMake<Self extends object, in out Shape extends object, E, R>
|
|
28
|
-
// extends
|
|
24
|
+
// extends CTX.Service<Self, Self>
|
|
29
25
|
// {
|
|
30
26
|
// // temp while sorting out https://github.com/Effect-TS/effect-smol/pull/1534
|
|
31
27
|
// of(self: Shape): Self
|
|
32
|
-
//
|
|
28
|
+
// contextMap2(self: Shape): CTX.Context<Self>
|
|
33
29
|
// // a version that leverages the Shape -> Self conversion
|
|
34
30
|
// toLayer: {
|
|
35
31
|
// <E, R>(
|
|
@@ -44,7 +40,7 @@ export function assignTag<Identifier extends object, Shape extends object = Iden
|
|
|
44
40
|
creationError?: Error
|
|
45
41
|
) {
|
|
46
42
|
return <S extends object>(cls: S): S & Opaque<Identifier, Shape> => {
|
|
47
|
-
const tag =
|
|
43
|
+
const tag = CTX.Service<Identifier, Shape>(key)
|
|
48
44
|
let fields = tag
|
|
49
45
|
if (Reflect.ownKeys(cls).includes("key")) {
|
|
50
46
|
const { key, ...rest } = tag
|
|
@@ -67,54 +63,51 @@ export function assignTag<Identifier extends object, Shape extends object = Iden
|
|
|
67
63
|
}
|
|
68
64
|
}
|
|
69
65
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
: Effect.Effect<Type[k], never, Self>
|
|
81
|
-
}
|
|
82
|
-
: {}
|
|
66
|
+
/** Accessor for a service method that returns a plain value. Wraps via `useSync`. */
|
|
67
|
+
export const accessFn = <
|
|
68
|
+
Self extends object,
|
|
69
|
+
Shape extends Record<PropertyKey, any>,
|
|
70
|
+
K extends keyof Shape
|
|
71
|
+
>(
|
|
72
|
+
Tag: Opaque<Self, Shape>,
|
|
73
|
+
key: K
|
|
74
|
+
): Shape[K] extends (...args: [...infer Args]) => infer A ? (...args: Readonly<Args>) => Effect.Effect<A, never, Self>
|
|
75
|
+
: never => ((...args: Array<any>) => Tag.useSync((s: any) => s[key](...args))) as any
|
|
83
76
|
|
|
84
|
-
/**
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
77
|
+
/** Accessor for a service method that returns an Effect. Delegates via `use`. */
|
|
78
|
+
export const accessEffectFn = <
|
|
79
|
+
Self extends object,
|
|
80
|
+
Shape extends Record<PropertyKey, any>,
|
|
81
|
+
K extends keyof Shape
|
|
82
|
+
>(
|
|
83
|
+
Tag: Opaque<Self, Shape>,
|
|
84
|
+
key: K
|
|
85
|
+
): Shape[K] extends (...args: [...infer Args]) => Effect.Effect<infer A, infer E, infer R>
|
|
86
|
+
? (...args: Readonly<Args>) => Effect.Effect<A, E, Self | R>
|
|
87
|
+
: never => ((...args: Array<any>) => Tag.use((s: any) => s[key](...args))) as any
|
|
88
|
+
|
|
89
|
+
/** Accessor for a service property (constant). Wraps via `useSync`. */
|
|
90
|
+
export const accessCn = <
|
|
91
|
+
Self extends object,
|
|
92
|
+
Shape extends Record<PropertyKey, any>,
|
|
93
|
+
K extends keyof Shape
|
|
94
|
+
>(
|
|
95
|
+
Tag: Opaque<Self, Shape>,
|
|
96
|
+
key: K
|
|
97
|
+
): Effect.Effect<Shape[K], never, Self> => Tag.useSync((s) => s[key])
|
|
98
|
+
|
|
99
|
+
/** Accessor for a service property that is an Effect. Delegates via `use`. */
|
|
100
|
+
export const accessEffectCn = <
|
|
101
|
+
Self extends object,
|
|
102
|
+
Shape extends Record<PropertyKey, any>,
|
|
103
|
+
K extends keyof Shape
|
|
104
|
+
>(
|
|
105
|
+
Tag: Opaque<Self, Shape>,
|
|
106
|
+
key: K
|
|
107
|
+
): Shape[K] extends Effect.Effect<infer A, infer E, infer R> ? Effect.Effect<A, E, Self | R>
|
|
108
|
+
: never => Tag.use((s: any) => s[key]) as any
|
|
116
109
|
|
|
117
|
-
export const TypeId = "~
|
|
110
|
+
export const TypeId = "~Context.Opaque"
|
|
118
111
|
|
|
119
112
|
// export function Opaque<const Key extends string>(key: Key) {
|
|
120
113
|
// return <Identifier extends object, Shape extends object>() => {
|
|
@@ -179,7 +172,7 @@ export const Opaque: {
|
|
|
179
172
|
>
|
|
180
173
|
& { readonly make: Make }
|
|
181
174
|
} = () => (id: string, options: any) => {
|
|
182
|
-
const svc =
|
|
175
|
+
const svc = CTX.Service()(id, options) as any
|
|
183
176
|
return Object.assign(svc, {
|
|
184
177
|
toLayer: (eff: Effect.Effect<any, any, any>) => {
|
|
185
178
|
return Layer.effect(svc, eff)
|
package/src/Effect.ts
CHANGED
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
/* eslint-disable prefer-destructuring */
|
|
3
3
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
4
4
|
|
|
5
|
-
import { Effect, Option, Ref, type ServiceMap } from "effect"
|
|
6
5
|
import * as Def from "effect/Deferred"
|
|
7
|
-
import * as
|
|
6
|
+
import * as Effect from "effect/Effect"
|
|
7
|
+
import * as Option from "effect/Option"
|
|
8
|
+
import * as Ref from "effect/Ref"
|
|
8
9
|
import type { Scope } from "effect/Scope"
|
|
9
10
|
import type { Semaphore } from "effect/Semaphore"
|
|
11
|
+
import type * as Context from "./Context.js"
|
|
10
12
|
import { curry } from "./Function.js"
|
|
11
13
|
import { typedKeysOf } from "./utils.js"
|
|
12
14
|
|
|
@@ -111,15 +113,11 @@ export function modifyWithPermitWithEffect<A>(ref: Ref.Ref<A>, semaphore: Semaph
|
|
|
111
113
|
)
|
|
112
114
|
}
|
|
113
115
|
|
|
114
|
-
export function joinAll<E, A>(fibers: Iterable<Fiber.Fiber<A, E>>): Effect.Effect<readonly A[], E> {
|
|
115
|
-
return Fiber.joinAll(fibers) as any
|
|
116
|
-
}
|
|
117
|
-
|
|
118
116
|
type ServiceA<T> = T extends Effect.Effect<infer S, any, any> ? S
|
|
119
|
-
: T extends
|
|
117
|
+
: T extends Context.Service<any, infer S> ? S
|
|
120
118
|
: never
|
|
121
119
|
type ServiceR<T> = T extends Effect.Effect<any, any, infer R> ? R
|
|
122
|
-
: T extends
|
|
120
|
+
: T extends Context.Service<infer I, any> ? I
|
|
123
121
|
: never
|
|
124
122
|
type ServiceE<T> = T extends Effect.Effect<any, infer E, any> ? E : never
|
|
125
123
|
// type Values<T> = T extends { [s: string]: infer S } ? ServiceA<S> : never
|
|
@@ -140,29 +138,29 @@ type ValuesE<T> = T extends { [s: string]: infer S } ? ServiceE<S> : never
|
|
|
140
138
|
* const b = a({ str: "" }) // valid, but shouldn't be!
|
|
141
139
|
* ```
|
|
142
140
|
*/
|
|
141
|
+
// eslint-disable-next-line import/namespace
|
|
143
142
|
export interface EffectUnunified<R, E, A> extends Effect.Effect<R, E, A> {}
|
|
144
143
|
|
|
145
144
|
export type LowerFirst<S extends PropertyKey> = S extends `${infer First}${infer Rest}` ? `${Lowercase<First>}${Rest}`
|
|
146
145
|
: S
|
|
147
|
-
export type LowerServices<T extends Record<string,
|
|
146
|
+
export type LowerServices<T extends Record<string, Context.Service<any, any> | Effect.Effect<any, any, any>>> = {
|
|
148
147
|
[key in keyof T as LowerFirst<key>]: ServiceA<T[key]>
|
|
149
148
|
}
|
|
150
149
|
|
|
151
|
-
export function allLower<T extends Record<string,
|
|
150
|
+
export function allLower<T extends Record<string, Context.Service<any, any> | Effect.Effect<any, any, any>>>(
|
|
152
151
|
services: T
|
|
153
152
|
) {
|
|
154
153
|
return Effect.all(
|
|
155
154
|
typedKeysOf(services).reduce((prev, cur) => {
|
|
156
155
|
const svc = services[cur]!
|
|
157
|
-
prev[((cur as string)[0]!.toLowerCase() + (cur as string).slice(1)) as unknown as LowerFirst<typeof cur>] =
|
|
158
|
-
"asEffect" in svc ? svc.asEffect() : svc
|
|
156
|
+
prev[((cur as string)[0]!.toLowerCase() + (cur as string).slice(1)) as unknown as LowerFirst<typeof cur>] = svc
|
|
159
157
|
return prev
|
|
160
158
|
}, {} as any),
|
|
161
159
|
{ concurrency: "inherit" }
|
|
162
160
|
) as any as Effect.Effect<LowerServices<T>, ValuesE<T>, ValuesR<T>>
|
|
163
161
|
}
|
|
164
162
|
|
|
165
|
-
export function allLowerWith<T extends Record<string,
|
|
163
|
+
export function allLowerWith<T extends Record<string, Context.Service<any, any> | Effect.Effect<any, any, any>>, A>(
|
|
166
164
|
services: T,
|
|
167
165
|
fn: (services: LowerServices<T>) => A
|
|
168
166
|
) {
|
|
@@ -170,7 +168,7 @@ export function allLowerWith<T extends Record<string, ServiceMap.Service<any, an
|
|
|
170
168
|
}
|
|
171
169
|
|
|
172
170
|
export function allLowerWithEffect<
|
|
173
|
-
T extends Record<string,
|
|
171
|
+
T extends Record<string, Context.Service<any, any> | Effect.Effect<any, any, any>>,
|
|
174
172
|
R,
|
|
175
173
|
E,
|
|
176
174
|
A
|