effect-app 4.0.0-beta.32 → 4.0.0-beta.320
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 +1553 -0
- package/dist/Array.d.ts +2 -1
- package/dist/Array.d.ts.map +1 -1
- package/dist/Array.js +4 -4
- package/dist/Chunk.d.ts.map +1 -1
- package/dist/Config/SecretURL.d.ts +3 -1
- package/dist/Config/SecretURL.d.ts.map +1 -1
- package/dist/Config/SecretURL.js +3 -6
- package/dist/Config/internal/configSecretURL.d.ts.map +1 -1
- package/dist/Config/internal/configSecretURL.js +2 -2
- package/dist/Config.d.ts +2 -0
- package/dist/Config.d.ts.map +1 -0
- package/dist/Config.js +8 -0
- package/dist/ConfigProvider.d.ts +2 -0
- package/dist/ConfigProvider.d.ts.map +1 -0
- package/dist/ConfigProvider.js +6 -0
- package/dist/{ServiceMap.d.ts → Context.d.ts} +18 -20
- package/dist/Context.d.ts.map +1 -0
- package/dist/Context.js +67 -0
- package/dist/DataDependencies.d.ts +136 -0
- package/dist/DataDependencies.d.ts.map +1 -0
- package/dist/DataDependencies.js +112 -0
- package/dist/Effect.d.ts +10 -9
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +6 -9
- 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.map +1 -1
- package/dist/Layer.d.ts +10 -6
- package/dist/Layer.d.ts.map +1 -1
- package/dist/Layer.js +3 -2
- package/dist/Model/Repository/Registry.d.ts +22 -0
- package/dist/Model/Repository/Registry.d.ts.map +1 -0
- package/dist/Model/Repository/Registry.js +18 -0
- package/dist/Model/Repository/dependency.d.ts +6 -0
- package/dist/Model/Repository/dependency.d.ts.map +1 -0
- package/dist/Model/Repository/dependency.js +29 -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 +124 -0
- package/dist/Model/Repository/internal/internal.d.ts +68 -0
- package/dist/Model/Repository/internal/internal.d.ts.map +1 -0
- package/dist/Model/Repository/internal/internal.js +579 -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 +63 -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 +121 -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 +58 -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 +8 -0
- package/dist/Model/Repository.d.ts.map +1 -0
- package/dist/Model/Repository.js +8 -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 +94 -0
- package/dist/Model/filter/types/path/eager.d.ts.map +1 -0
- package/dist/Model/filter/types/path/eager.js +36 -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 +630 -0
- package/dist/Model/query/dsl.d.ts.map +1 -0
- package/dist/Model/query/dsl.js +376 -0
- package/dist/Model/query/new-kid-interpreter.d.ts +132 -0
- package/dist/Model/query/new-kid-interpreter.d.ts.map +1 -0
- package/dist/Model/query/new-kid-interpreter.js +361 -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 +6 -0
- package/dist/Model.d.ts.map +1 -0
- package/dist/Model.js +6 -0
- package/dist/NonEmptySet.d.ts +3 -1
- package/dist/NonEmptySet.d.ts.map +1 -1
- package/dist/NonEmptySet.js +2 -2
- package/dist/Option.d.ts +1 -0
- package/dist/Option.d.ts.map +1 -1
- package/dist/Option.js +3 -1
- package/dist/Pure.d.ts +7 -5
- package/dist/Pure.d.ts.map +1 -1
- package/dist/Pure.js +7 -4
- package/dist/QueueMaker.d.ts +11 -0
- package/dist/QueueMaker.d.ts.map +1 -0
- package/dist/QueueMaker.js +11 -0
- package/dist/RequestContext.d.ts +87 -0
- package/dist/RequestContext.d.ts.map +1 -0
- package/dist/RequestContext.js +45 -0
- package/dist/RequestScopedDependencies.d.ts +21 -0
- package/dist/RequestScopedDependencies.d.ts.map +1 -0
- package/dist/RequestScopedDependencies.js +16 -0
- package/dist/Schema/Class.d.ts +200 -20
- package/dist/Schema/Class.d.ts.map +1 -1
- package/dist/Schema/Class.js +268 -17
- package/dist/Schema/FastCheck.d.ts.map +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 +117 -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 +4 -2
- package/dist/Schema/brand.d.ts.map +1 -1
- package/dist/Schema/brand.js +3 -1
- package/dist/Schema/email.d.ts.map +1 -1
- package/dist/Schema/email.js +7 -4
- package/dist/Schema/ext.d.ts +336 -55
- package/dist/Schema/ext.d.ts.map +1 -1
- package/dist/Schema/ext.js +378 -55
- package/dist/Schema/moreStrings.d.ts +82 -36
- package/dist/Schema/moreStrings.d.ts.map +1 -1
- package/dist/Schema/moreStrings.js +49 -42
- package/dist/Schema/numbers.d.ts +34 -21
- package/dist/Schema/numbers.d.ts.map +1 -1
- package/dist/Schema/numbers.js +55 -12
- 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/schema.d.ts.map +1 -1
- package/dist/Schema/schema.js +2 -2
- package/dist/Schema/strings.d.ts +18 -4
- package/dist/Schema/strings.d.ts.map +1 -1
- package/dist/Schema/strings.js +1 -5
- package/dist/Schema.d.ts +222 -8
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +191 -12
- package/dist/SchemaAST.d.ts +2 -0
- package/dist/SchemaAST.d.ts.map +1 -0
- package/dist/SchemaAST.js +2 -0
- package/dist/Set.d.ts +4 -1
- package/dist/Set.d.ts.map +1 -1
- package/dist/Set.js +3 -2
- package/dist/Store.d.ts +170 -0
- package/dist/Store.d.ts.map +1 -0
- package/dist/Store.js +113 -0
- package/dist/_ext/Array.d.ts +1 -1
- package/dist/_ext/Array.d.ts.map +1 -1
- package/dist/_ext/Array.js +4 -2
- package/dist/_ext/misc.d.ts +4 -1
- package/dist/_ext/misc.d.ts.map +1 -1
- package/dist/_ext/misc.js +4 -2
- package/dist/_ext/ord.ext.d.ts +2 -1
- package/dist/_ext/ord.ext.d.ts.map +1 -1
- package/dist/_ext/ord.ext.js +2 -2
- package/dist/builtin.d.ts +2 -14
- package/dist/builtin.d.ts.map +1 -1
- package/dist/builtin.js +1 -1
- package/dist/client/InvalidationKeys.d.ts +30 -0
- package/dist/client/InvalidationKeys.d.ts.map +1 -0
- package/dist/client/InvalidationKeys.js +37 -0
- package/dist/client/apiClientFactory.d.ts +19 -31
- package/dist/client/apiClientFactory.d.ts.map +1 -1
- package/dist/client/apiClientFactory.js +155 -35
- package/dist/client/clientFor.d.ts +54 -18
- package/dist/client/clientFor.d.ts.map +1 -1
- package/dist/client/clientFor.js +9 -1
- package/dist/client/errors.d.ts +82 -27
- package/dist/client/errors.d.ts.map +1 -1
- package/dist/client/errors.js +75 -19
- package/dist/client/makeClient.d.ts +490 -34
- package/dist/client/makeClient.d.ts.map +1 -1
- package/dist/client/makeClient.js +62 -30
- package/dist/client.d.ts +2 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +3 -1
- package/dist/faker.d.ts.map +1 -1
- package/dist/http/Request.d.ts +1 -1
- package/dist/http/Request.d.ts.map +1 -1
- package/dist/http/Request.js +2 -2
- package/dist/ids.d.ts +42 -14
- package/dist/ids.d.ts.map +1 -1
- package/dist/ids.js +30 -5
- package/dist/index.d.ts +6 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -8
- package/dist/middleware.d.ts +13 -7
- package/dist/middleware.d.ts.map +1 -1
- package/dist/middleware.js +14 -8
- package/dist/rpc/Invalidation.d.ts +1124 -0
- package/dist/rpc/Invalidation.d.ts.map +1 -0
- package/dist/rpc/Invalidation.js +178 -0
- package/dist/rpc/MiddlewareMaker.d.ts +11 -7
- package/dist/rpc/MiddlewareMaker.d.ts.map +1 -1
- package/dist/rpc/MiddlewareMaker.js +59 -38
- package/dist/rpc/RpcContextMap.d.ts +3 -3
- package/dist/rpc/RpcContextMap.d.ts.map +1 -1
- package/dist/rpc/RpcContextMap.js +4 -4
- package/dist/rpc/RpcMiddleware.d.ts +14 -10
- package/dist/rpc/RpcMiddleware.d.ts.map +1 -1
- package/dist/rpc/RpcMiddleware.js +1 -1
- package/dist/rpc.d.ts +1 -1
- 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/setupRequest.d.ts +20 -0
- package/dist/setupRequest.d.ts.map +1 -0
- package/dist/setupRequest.js +72 -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 +1 -1
- package/dist/transform.d.ts.map +1 -1
- package/dist/transform.js +4 -5
- package/dist/utils/effectify.d.ts +1 -1
- package/dist/utils/effectify.d.ts.map +1 -1
- package/dist/utils/effectify.js +2 -2
- package/dist/utils/extend.d.ts.map +1 -1
- package/dist/utils/gen.d.ts +4 -4
- package/dist/utils/gen.d.ts.map +1 -1
- package/dist/utils/logLevel.d.ts +2 -2
- package/dist/utils/logLevel.d.ts.map +1 -1
- package/dist/utils/logger.d.ts +4 -3
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +4 -4
- package/dist/utils.d.ts +34 -39
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +33 -37
- package/dist/validation/validators.d.ts.map +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 +27 -251
- package/src/Array.ts +5 -5
- package/src/Chunk.ts +3 -3
- package/src/Config/SecretURL.ts +6 -3
- package/src/Config/internal/configSecretURL.ts +2 -2
- package/src/Config.ts +7 -0
- package/src/ConfigProvider.ts +5 -0
- package/src/{ServiceMap.ts → Context.ts} +56 -63
- package/src/DataDependencies.ts +171 -0
- package/src/Effect.ts +15 -17
- package/src/Emailer.ts +51 -0
- package/src/Inputify.type.ts +1 -1
- package/src/Layer.ts +11 -7
- package/src/Model/Repository/Registry.ts +35 -0
- package/src/Model/Repository/dependency.ts +32 -0
- package/src/Model/Repository/ext.ts +374 -0
- package/src/Model/Repository/internal/internal.ts +950 -0
- package/src/Model/Repository/legacy.ts +29 -0
- package/src/Model/Repository/makeRepo.ts +156 -0
- package/src/Model/Repository/service.ts +676 -0
- package/src/Model/Repository/validation.ts +31 -0
- package/src/Model/Repository.ts +7 -0
- package/src/Model/dsl.ts +129 -0
- package/src/Model/filter/filterApi.ts +78 -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 +329 -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 +3092 -0
- package/src/Model/query/new-kid-interpreter.ts +526 -0
- package/src/Model/query.ts +13 -0
- package/src/Model.ts +5 -0
- package/src/NonEmptySet.ts +6 -4
- package/src/Option.ts +2 -0
- package/src/Pure.ts +10 -7
- package/src/QueueMaker.ts +11 -0
- package/src/RequestContext.ts +48 -0
- package/src/RequestScopedDependencies.ts +45 -0
- package/src/Schema/Class.ts +648 -60
- package/src/Schema/SchemaParser.ts +12 -0
- package/src/Schema/SpecialJsonSchema.ts +137 -0
- package/src/Schema/SpecialOpenApi.ts +130 -0
- package/src/Schema/brand.ts +22 -2
- package/src/Schema/email.ts +9 -4
- package/src/Schema/ext.ts +499 -95
- package/src/Schema/moreStrings.ts +148 -69
- package/src/Schema/numbers.ts +97 -28
- package/src/Schema/phoneNumber.ts +9 -5
- package/src/Schema/schema.ts +1 -1
- package/src/Schema/strings.ts +23 -14
- package/src/Schema.ts +397 -26
- package/src/SchemaAST.ts +1 -0
- package/src/Set.ts +6 -2
- package/src/Store.ts +280 -0
- package/src/_ext/Array.ts +4 -2
- package/src/_ext/misc.ts +4 -1
- package/src/_ext/ord.ext.ts +2 -1
- package/src/builtin-json.d.ts +24 -0
- package/src/builtin.ts +16 -21
- package/src/client/InvalidationKeys.ts +55 -0
- package/src/client/apiClientFactory.ts +299 -134
- package/src/client/clientFor.ts +107 -34
- package/src/client/errors.ts +100 -29
- package/src/client/makeClient.ts +594 -80
- package/src/client.ts +6 -4
- package/src/http/Request.ts +3 -3
- package/src/http.ts +1 -1
- package/src/ids.ts +33 -6
- package/src/index.ts +20 -23
- package/src/middleware.ts +13 -9
- package/src/rpc/Invalidation.ts +278 -0
- package/src/rpc/MiddlewareMaker.ts +88 -80
- package/src/rpc/README.md +2 -2
- package/src/rpc/RpcContextMap.ts +7 -6
- package/src/rpc/RpcMiddleware.ts +19 -13
- package/src/rpc.ts +4 -4
- package/src/runtime.ts +56 -0
- package/src/setupRequest.ts +138 -0
- package/src/toast.ts +54 -0
- package/src/transform.ts +4 -4
- 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 +85 -158
- package/src/validation.ts +2 -2
- package/src/withToast.ts +133 -0
- package/test/dist/rpc.test.d.ts.map +1 -1
- package/test/dist/rpcMiddlewareContext.test.d.ts.map +1 -0
- package/test/dist/secretURL.test.d.ts.map +1 -0
- package/test/dist/special.test.d.ts.map +1 -0
- package/test/moreStrings.test.ts +2 -2
- package/test/rpc.test.ts +42 -14
- package/test/rpcMiddlewareContext.test.ts +63 -0
- package/test/schema.test.ts +514 -35
- package/test/secretURL.test.ts +160 -0
- package/test/special.test.ts +1257 -0
- package/test/utils.test.ts +7 -7
- package/tsconfig.base.json +6 -5
- package/tsconfig.json +9 -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.map +0 -1
- package/dist/ServiceMap.js +0 -91
- package/eslint.config.mjs +0 -26
- package/src/Operations.ts +0 -55
- package/tsconfig.json.bak +0 -12
package/package.json
CHANGED
|
@@ -1,31 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "effect-app",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.320",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/effect-app/libs.git",
|
|
9
|
+
"directory": "packages/effect-app"
|
|
10
|
+
},
|
|
6
11
|
"dependencies": {
|
|
7
12
|
"@tsconfig/strictest": "^2.0.8",
|
|
8
|
-
"date-fns": "^4.
|
|
9
|
-
"nanoid": "^5.1.
|
|
13
|
+
"date-fns": "^4.4.0",
|
|
14
|
+
"nanoid": "^5.1.11",
|
|
10
15
|
"path-parser": "^6.1.0",
|
|
11
|
-
"query-string": "^9.
|
|
12
|
-
"ts-pattern": "^5.9.0",
|
|
16
|
+
"query-string": "^9.4.0",
|
|
13
17
|
"ts-toolbelt": "^9.6.0",
|
|
14
|
-
"
|
|
15
|
-
"validator": "^13.15.26"
|
|
18
|
+
"validator": "^13.15.35"
|
|
16
19
|
},
|
|
17
20
|
"devDependencies": {
|
|
18
21
|
"@faker-js/faker": "^8.4.1",
|
|
19
|
-
"@types/node": "25.
|
|
20
|
-
"@types/uuid": "^11.0.0",
|
|
22
|
+
"@types/node": "25.9.1",
|
|
21
23
|
"@types/validator": "^13.15.10",
|
|
22
|
-
"fast-check": "
|
|
23
|
-
"typescript": "~
|
|
24
|
-
"vitest": "^4.
|
|
25
|
-
"@effect-app/eslint-shared-config": "0.5.7-beta.2"
|
|
24
|
+
"fast-check": "^4.9.0",
|
|
25
|
+
"typescript": "~6.0.3",
|
|
26
|
+
"vitest": "^4.1.7"
|
|
26
27
|
},
|
|
27
28
|
"peerDependencies": {
|
|
28
|
-
"effect": "^4.0.0-
|
|
29
|
+
"effect": "^4.0.0-rc.112"
|
|
29
30
|
},
|
|
30
31
|
"typesVersions": {
|
|
31
32
|
"*": {
|
|
@@ -39,233 +40,10 @@
|
|
|
39
40
|
"types": "./dist/index.d.ts",
|
|
40
41
|
"default": "./dist/index.js"
|
|
41
42
|
},
|
|
42
|
-
"./
|
|
43
|
-
|
|
44
|
-
"
|
|
45
|
-
|
|
46
|
-
"./Chunk": {
|
|
47
|
-
"types": "./dist/Chunk.d.ts",
|
|
48
|
-
"default": "./dist/Chunk.js"
|
|
49
|
-
},
|
|
50
|
-
"./Config/SecretURL": {
|
|
51
|
-
"types": "./dist/Config/SecretURL.d.ts",
|
|
52
|
-
"default": "./dist/Config/SecretURL.js"
|
|
53
|
-
},
|
|
54
|
-
"./Effect": {
|
|
55
|
-
"types": "./dist/Effect.d.ts",
|
|
56
|
-
"default": "./dist/Effect.js"
|
|
57
|
-
},
|
|
58
|
-
"./Function": {
|
|
59
|
-
"types": "./dist/Function.d.ts",
|
|
60
|
-
"default": "./dist/Function.js"
|
|
61
|
-
},
|
|
62
|
-
"./Inputify.type": {
|
|
63
|
-
"types": "./dist/Inputify.type.d.ts",
|
|
64
|
-
"default": "./dist/Inputify.type.js"
|
|
65
|
-
},
|
|
66
|
-
"./Layer": {
|
|
67
|
-
"types": "./dist/Layer.d.ts",
|
|
68
|
-
"default": "./dist/Layer.js"
|
|
69
|
-
},
|
|
70
|
-
"./NonEmptySet": {
|
|
71
|
-
"types": "./dist/NonEmptySet.d.ts",
|
|
72
|
-
"default": "./dist/NonEmptySet.js"
|
|
73
|
-
},
|
|
74
|
-
"./Operations": {
|
|
75
|
-
"types": "./dist/Operations.d.ts",
|
|
76
|
-
"default": "./dist/Operations.js"
|
|
77
|
-
},
|
|
78
|
-
"./Option": {
|
|
79
|
-
"types": "./dist/Option.d.ts",
|
|
80
|
-
"default": "./dist/Option.js"
|
|
81
|
-
},
|
|
82
|
-
"./Pure": {
|
|
83
|
-
"types": "./dist/Pure.d.ts",
|
|
84
|
-
"default": "./dist/Pure.js"
|
|
85
|
-
},
|
|
86
|
-
"./Schema": {
|
|
87
|
-
"types": "./dist/Schema.d.ts",
|
|
88
|
-
"default": "./dist/Schema.js"
|
|
89
|
-
},
|
|
90
|
-
"./Schema/Class": {
|
|
91
|
-
"types": "./dist/Schema/Class.d.ts",
|
|
92
|
-
"default": "./dist/Schema/Class.js"
|
|
93
|
-
},
|
|
94
|
-
"./Schema/FastCheck": {
|
|
95
|
-
"types": "./dist/Schema/FastCheck.d.ts",
|
|
96
|
-
"default": "./dist/Schema/FastCheck.js"
|
|
97
|
-
},
|
|
98
|
-
"./Schema/Methods": {
|
|
99
|
-
"types": "./dist/Schema/Methods.d.ts",
|
|
100
|
-
"default": "./dist/Schema/Methods.js"
|
|
101
|
-
},
|
|
102
|
-
"./Schema/brand": {
|
|
103
|
-
"types": "./dist/Schema/brand.d.ts",
|
|
104
|
-
"default": "./dist/Schema/brand.js"
|
|
105
|
-
},
|
|
106
|
-
"./Schema/email": {
|
|
107
|
-
"types": "./dist/Schema/email.d.ts",
|
|
108
|
-
"default": "./dist/Schema/email.js"
|
|
109
|
-
},
|
|
110
|
-
"./Schema/ext": {
|
|
111
|
-
"types": "./dist/Schema/ext.d.ts",
|
|
112
|
-
"default": "./dist/Schema/ext.js"
|
|
113
|
-
},
|
|
114
|
-
"./Schema/moreStrings": {
|
|
115
|
-
"types": "./dist/Schema/moreStrings.d.ts",
|
|
116
|
-
"default": "./dist/Schema/moreStrings.js"
|
|
117
|
-
},
|
|
118
|
-
"./Schema/numbers": {
|
|
119
|
-
"types": "./dist/Schema/numbers.d.ts",
|
|
120
|
-
"default": "./dist/Schema/numbers.js"
|
|
121
|
-
},
|
|
122
|
-
"./Schema/phoneNumber": {
|
|
123
|
-
"types": "./dist/Schema/phoneNumber.d.ts",
|
|
124
|
-
"default": "./dist/Schema/phoneNumber.js"
|
|
125
|
-
},
|
|
126
|
-
"./Schema/schema": {
|
|
127
|
-
"types": "./dist/Schema/schema.d.ts",
|
|
128
|
-
"default": "./dist/Schema/schema.js"
|
|
129
|
-
},
|
|
130
|
-
"./Schema/strings": {
|
|
131
|
-
"types": "./dist/Schema/strings.d.ts",
|
|
132
|
-
"default": "./dist/Schema/strings.js"
|
|
133
|
-
},
|
|
134
|
-
"./ServiceMap": {
|
|
135
|
-
"types": "./dist/ServiceMap.d.ts",
|
|
136
|
-
"default": "./dist/ServiceMap.js"
|
|
137
|
-
},
|
|
138
|
-
"./Set": {
|
|
139
|
-
"types": "./dist/Set.d.ts",
|
|
140
|
-
"default": "./dist/Set.js"
|
|
141
|
-
},
|
|
142
|
-
"./TypeTest": {
|
|
143
|
-
"types": "./dist/TypeTest.d.ts",
|
|
144
|
-
"default": "./dist/TypeTest.js"
|
|
145
|
-
},
|
|
146
|
-
"./Types": {
|
|
147
|
-
"types": "./dist/Types.d.ts",
|
|
148
|
-
"default": "./dist/Types.js"
|
|
149
|
-
},
|
|
150
|
-
"./Widen.type": {
|
|
151
|
-
"types": "./dist/Widen.type.d.ts",
|
|
152
|
-
"default": "./dist/Widen.type.js"
|
|
153
|
-
},
|
|
154
|
-
"./_ext/Array": {
|
|
155
|
-
"types": "./dist/_ext/Array.d.ts",
|
|
156
|
-
"default": "./dist/_ext/Array.js"
|
|
157
|
-
},
|
|
158
|
-
"./_ext/date": {
|
|
159
|
-
"types": "./dist/_ext/date.d.ts",
|
|
160
|
-
"default": "./dist/_ext/date.js"
|
|
161
|
-
},
|
|
162
|
-
"./_ext/misc": {
|
|
163
|
-
"types": "./dist/_ext/misc.d.ts",
|
|
164
|
-
"default": "./dist/_ext/misc.js"
|
|
165
|
-
},
|
|
166
|
-
"./_ext/ord.ext": {
|
|
167
|
-
"types": "./dist/_ext/ord.ext.d.ts",
|
|
168
|
-
"default": "./dist/_ext/ord.ext.js"
|
|
169
|
-
},
|
|
170
|
-
"./builtin": {
|
|
171
|
-
"types": "./dist/builtin.d.ts",
|
|
172
|
-
"default": "./dist/builtin.js"
|
|
173
|
-
},
|
|
174
|
-
"./client": {
|
|
175
|
-
"types": "./dist/client.d.ts",
|
|
176
|
-
"default": "./dist/client.js"
|
|
177
|
-
},
|
|
178
|
-
"./client/apiClientFactory": {
|
|
179
|
-
"types": "./dist/client/apiClientFactory.d.ts",
|
|
180
|
-
"default": "./dist/client/apiClientFactory.js"
|
|
181
|
-
},
|
|
182
|
-
"./client/clientFor": {
|
|
183
|
-
"types": "./dist/client/clientFor.d.ts",
|
|
184
|
-
"default": "./dist/client/clientFor.js"
|
|
185
|
-
},
|
|
186
|
-
"./client/errors": {
|
|
187
|
-
"types": "./dist/client/errors.d.ts",
|
|
188
|
-
"default": "./dist/client/errors.js"
|
|
189
|
-
},
|
|
190
|
-
"./client/makeClient": {
|
|
191
|
-
"types": "./dist/client/makeClient.d.ts",
|
|
192
|
-
"default": "./dist/client/makeClient.js"
|
|
193
|
-
},
|
|
194
|
-
"./faker": {
|
|
195
|
-
"types": "./dist/faker.d.ts",
|
|
196
|
-
"default": "./dist/faker.js"
|
|
197
|
-
},
|
|
198
|
-
"./http": {
|
|
199
|
-
"types": "./dist/http.d.ts",
|
|
200
|
-
"default": "./dist/http.js"
|
|
201
|
-
},
|
|
202
|
-
"./http/Request": {
|
|
203
|
-
"types": "./dist/http/Request.d.ts",
|
|
204
|
-
"default": "./dist/http/Request.js"
|
|
205
|
-
},
|
|
206
|
-
"./ids": {
|
|
207
|
-
"types": "./dist/ids.d.ts",
|
|
208
|
-
"default": "./dist/ids.js"
|
|
209
|
-
},
|
|
210
|
-
"./logger": {
|
|
211
|
-
"types": "./dist/logger.d.ts",
|
|
212
|
-
"default": "./dist/logger.js"
|
|
213
|
-
},
|
|
214
|
-
"./middleware": {
|
|
215
|
-
"types": "./dist/middleware.d.ts",
|
|
216
|
-
"default": "./dist/middleware.js"
|
|
217
|
-
},
|
|
218
|
-
"./rpc": {
|
|
219
|
-
"types": "./dist/rpc.d.ts",
|
|
220
|
-
"default": "./dist/rpc.js"
|
|
221
|
-
},
|
|
222
|
-
"./rpc/MiddlewareMaker": {
|
|
223
|
-
"types": "./dist/rpc/MiddlewareMaker.d.ts",
|
|
224
|
-
"default": "./dist/rpc/MiddlewareMaker.js"
|
|
225
|
-
},
|
|
226
|
-
"./rpc/RpcContextMap": {
|
|
227
|
-
"types": "./dist/rpc/RpcContextMap.d.ts",
|
|
228
|
-
"default": "./dist/rpc/RpcContextMap.js"
|
|
229
|
-
},
|
|
230
|
-
"./rpc/RpcMiddleware": {
|
|
231
|
-
"types": "./dist/rpc/RpcMiddleware.d.ts",
|
|
232
|
-
"default": "./dist/rpc/RpcMiddleware.js"
|
|
233
|
-
},
|
|
234
|
-
"./transform": {
|
|
235
|
-
"types": "./dist/transform.d.ts",
|
|
236
|
-
"default": "./dist/transform.js"
|
|
237
|
-
},
|
|
238
|
-
"./utils": {
|
|
239
|
-
"types": "./dist/utils.d.ts",
|
|
240
|
-
"default": "./dist/utils.js"
|
|
241
|
-
},
|
|
242
|
-
"./utils/effectify": {
|
|
243
|
-
"types": "./dist/utils/effectify.d.ts",
|
|
244
|
-
"default": "./dist/utils/effectify.js"
|
|
245
|
-
},
|
|
246
|
-
"./utils/extend": {
|
|
247
|
-
"types": "./dist/utils/extend.d.ts",
|
|
248
|
-
"default": "./dist/utils/extend.js"
|
|
249
|
-
},
|
|
250
|
-
"./utils/gen": {
|
|
251
|
-
"types": "./dist/utils/gen.d.ts",
|
|
252
|
-
"default": "./dist/utils/gen.js"
|
|
253
|
-
},
|
|
254
|
-
"./utils/logLevel": {
|
|
255
|
-
"types": "./dist/utils/logLevel.d.ts",
|
|
256
|
-
"default": "./dist/utils/logLevel.js"
|
|
257
|
-
},
|
|
258
|
-
"./utils/logger": {
|
|
259
|
-
"types": "./dist/utils/logger.d.ts",
|
|
260
|
-
"default": "./dist/utils/logger.js"
|
|
261
|
-
},
|
|
262
|
-
"./validation": {
|
|
263
|
-
"types": "./dist/validation.d.ts",
|
|
264
|
-
"default": "./dist/validation.js"
|
|
265
|
-
},
|
|
266
|
-
"./validation/validators": {
|
|
267
|
-
"types": "./dist/validation/validators.d.ts",
|
|
268
|
-
"default": "./dist/validation/validators.js"
|
|
43
|
+
"./internal/*": null,
|
|
44
|
+
"./*": {
|
|
45
|
+
"types": "./dist/*.d.ts",
|
|
46
|
+
"default": "./dist/*.js"
|
|
269
47
|
}
|
|
270
48
|
},
|
|
271
49
|
"gitHead": "bd8e27eea3eff97db8739d577d67e7336c078d28",
|
|
@@ -279,26 +57,24 @@
|
|
|
279
57
|
],
|
|
280
58
|
"scripts": {
|
|
281
59
|
"watch": "pnpm build:tsc -w",
|
|
282
|
-
"build:tsc": "pnpm clean-dist &&
|
|
283
|
-
"check": "
|
|
284
|
-
"build:tsc-src": "pnpm clean-dist &&
|
|
60
|
+
"build:tsc": "pnpm clean-dist && pnpm check && node ../../scripts/rewrite-dist-declaration-imports.mjs dist",
|
|
61
|
+
"check": "tsgo --build",
|
|
62
|
+
"build:tsc-src": "pnpm clean-dist && tsc --build ./tsconfig.src.json && node ../../scripts/rewrite-dist-declaration-imports.mjs dist",
|
|
285
63
|
"build:src": "pnpm build:tsc-src",
|
|
286
64
|
"build": "pnpm build:tsc",
|
|
287
|
-
"watch2": "pnpm clean-dist && NODE_OPTIONS=--max-old-space-size=6144
|
|
65
|
+
"watch2": "pnpm clean-dist && NODE_OPTIONS=--max-old-space-size=6144 tsgo -w",
|
|
288
66
|
"clean": "rm -rf dist",
|
|
289
67
|
"clean-dist": "sh ../../scripts/clean-dist.sh",
|
|
290
68
|
"circular": "pnpm circular:src && pnpm circular:dist",
|
|
291
69
|
"circular:src": "madge --circular --ts-config ./tsconfig.json --extensions ts ./src",
|
|
292
70
|
"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",
|
|
71
|
+
"compile": "NODE_OPTIONS=--max-old-space-size=6144 tsgo --noEmit",
|
|
72
|
+
"lint": "oxlint --type-aware ./src && pnpm exec dprint check --config ../../dprint.jsonc .",
|
|
73
|
+
"lint-fix": "oxlint --type-aware --fix ./src && pnpm exec dprint fmt --config ../../dprint.jsonc .",
|
|
297
74
|
"test": "vitest",
|
|
298
75
|
"test:run": "pnpm run test run --passWithNoTests",
|
|
299
76
|
"testsuite": "pnpm lint && pnpm circular && pnpm run test:run",
|
|
300
77
|
"ncu": "ncu",
|
|
301
|
-
"pub": "
|
|
302
|
-
"prepublish": "cp -f ./tsconfig.json ./tsconfig.json.bak && node ../../scripts/mergeTsConfig.mjs ./tsconfig.json"
|
|
78
|
+
"pub": "npm publish --access public"
|
|
303
79
|
}
|
|
304
80
|
}
|
package/src/Array.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
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
|
|
5
|
-
import
|
|
6
|
-
import
|
|
3
|
+
import * as Chunk from "effect/Chunk"
|
|
4
|
+
import * as Effect from "effect/Effect"
|
|
5
|
+
import { dual, type Predicate } from "./Function.ts"
|
|
6
|
+
import * as Option from "./Option.ts"
|
|
7
7
|
|
|
8
8
|
export const toNonEmptyArray = Option.liftPredicate(Array.isReadonlyArrayNonEmpty)
|
|
9
9
|
|
|
@@ -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/Chunk.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { pipe, type Predicate, type Refinement } from "./Function.
|
|
2
|
-
import * as Option from "./Option.
|
|
1
|
+
import { pipe, type Predicate, type Refinement } from "./Function.ts"
|
|
2
|
+
import * as Option from "./Option.ts"
|
|
3
3
|
|
|
4
4
|
import * as Chunk from "effect/Chunk"
|
|
5
5
|
import { type Equivalence } from "effect/Equivalence"
|
|
6
|
-
import * as Array from "./Array.
|
|
6
|
+
import * as Array from "./Array.ts"
|
|
7
7
|
|
|
8
8
|
export * from "effect/Chunk"
|
|
9
9
|
|
package/src/Config/SecretURL.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
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"
|
|
6
|
-
import * as
|
|
5
|
+
import * as Config from "effect/Config"
|
|
6
|
+
import type * as Equal from "effect/Equal"
|
|
7
|
+
import type * as Redacted from "effect/Redacted"
|
|
8
|
+
import * as internal from "./internal/configSecretURL.ts"
|
|
7
9
|
|
|
8
10
|
// /**
|
|
9
11
|
// * @since 1.0.0
|
|
@@ -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
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Redacted } from "effect"
|
|
2
1
|
import * as Chunk from "effect/Chunk"
|
|
3
|
-
import
|
|
2
|
+
import * as Redacted from "effect/Redacted"
|
|
3
|
+
import type * as SecretURL from "../SecretURL.ts"
|
|
4
4
|
|
|
5
5
|
/** @internal */
|
|
6
6
|
export const isSecretURL = (u: unknown): u is SecretURL.SecretURL => {
|
package/src/Config.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// `Config.nested` previously needed a local override because effect v3's `nested`
|
|
2
|
+
// did not run the provider's `mapInput`/`constantCase` over the nested namespace
|
|
3
|
+
// segment (see commit "fix Config.nested mapping"). As of effect 4.0.0-beta.84 the
|
|
4
|
+
// upstream `nested` threads the prefix through the lookup path, so the provider
|
|
5
|
+
// transform covers it — the override is obsolete and the old internals it used are
|
|
6
|
+
// gone. Re-export the native module directly.
|
|
7
|
+
export * from "effect/Config"
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// Local `nested` override removed: it existed to make the nested namespace honour the
|
|
2
|
+
// provider's `mapInput`/`constantCase` (see commit "fix Config.nested mapping"), which
|
|
3
|
+
// effect 4.0.0-beta.84 now does natively. The old override also relied on internals
|
|
4
|
+
// (`provider.get`/`mapInput`/`prefix`) that no longer exist. Re-export native directly.
|
|
5
|
+
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)
|