@shivaedev/service 0.8.0 → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/MethodProof.d.ts +1 -1
- package/dist/MethodProof.d.ts.map +1 -1
- package/dist/defineService.d.ts +5 -5
- package/dist/defineService.d.ts.map +1 -1
- package/dist/genericMethod.d.ts +8 -11
- package/dist/genericMethod.d.ts.map +1 -1
- package/dist/genericMethod.js.map +1 -1
- package/package.json +7 -7
- package/src/MethodProof.ts +5 -1
- package/src/defineService.ts +5 -5
- package/src/genericMethod.ts +9 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.8.2 - 2026-11-07
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- Preserve schema result types and decoding service requirements through generic service methods.
|
|
8
|
+
|
|
9
|
+
## 0.8.1 - 2026-11-07
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- Require Effect 4.1.1 and its matching platform packages.
|
|
14
|
+
|
|
3
15
|
## 0.8.0 - 2026-11-05
|
|
4
16
|
|
|
5
17
|
### Breaking
|
package/dist/MethodProof.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ interface ServiceMembersMustBeMethods {
|
|
|
17
17
|
type OrdinaryMethodProof<TName extends PropertyKey, TMethod, TRequirements extends RequirementRecord> = [
|
|
18
18
|
Exclude<MethodRequirements<TMethod>, RequirementsOf<TRequirements> | Scope.Scope>
|
|
19
19
|
] extends [never] ? TMethod : MethodHasUndeclaredServiceRequirements<TName, Exclude<MethodRequirements<TMethod>, RequirementsOf<TRequirements> | Scope.Scope>>;
|
|
20
|
-
type SupportedMethod<TName extends PropertyKey, TMethod, TRequirements extends RequirementRecord> = TMethod extends GenericMethodDescriptor<AnyMethod> ? TMethod : TMethod extends AnyMethod ? HasDistinctCallSignatures<TMethod> extends true ? GenericOrStructurallyOverloadedMethodsAreUnsupported : TMethod extends (...arguments_: infer TArguments) => infer TResult ? ((...arguments_: TArguments) => TResult) extends TMethod ? OrdinaryMethodProof<TName, TMethod, TRequirements> : GenericOrStructurallyOverloadedMethodsAreUnsupported : GenericOrStructurallyOverloadedMethodsAreUnsupported : ServiceMembersMustBeMethods;
|
|
20
|
+
type SupportedMethod<TName extends PropertyKey, TMethod, TRequirements extends RequirementRecord> = TMethod extends GenericMethodDescriptor<AnyMethod> ? TMethod extends GenericMethodDescriptor<infer TGenericMethod> ? [HasDistinctCallSignatures<TGenericMethod>] extends [true] ? GenericOrStructurallyOverloadedMethodsAreUnsupported : TMethod : TMethod : TMethod extends AnyMethod ? HasDistinctCallSignatures<TMethod> extends true ? GenericOrStructurallyOverloadedMethodsAreUnsupported : TMethod extends (...arguments_: infer TArguments) => infer TResult ? ((...arguments_: TArguments) => TResult) extends TMethod ? OrdinaryMethodProof<TName, TMethod, TRequirements> : GenericOrStructurallyOverloadedMethodsAreUnsupported : GenericOrStructurallyOverloadedMethodsAreUnsupported : ServiceMembersMustBeMethods;
|
|
21
21
|
export type MethodProof<TMethods extends MethodInventory, TRequirements extends RequirementRecord> = {
|
|
22
22
|
readonly [TName in keyof TMethods]: SupportedMethod<TName, TMethods[TName], TRequirements>;
|
|
23
23
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MethodProof.d.ts","sourceRoot":"","sources":["../src/MethodProof.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,KAAK,EACX,SAAS,EACT,uBAAuB,EACvB,oDAAoD,EACpD,yBAAyB,EACzB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEjF,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,uB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
|
|
|
1
1
|
import { Context, Effect, Layer } from "effect";
|
|
2
|
-
import type { GenericMethodDescriptor } from "
|
|
3
|
-
import type { InitializerProof } from "
|
|
4
|
-
import type { MethodInventory, MethodProof } from "
|
|
5
|
-
import type { RequirementProof } from "
|
|
6
|
-
import type { RequirementRecord, RequirementsOf } from "
|
|
2
|
+
import type { GenericMethodDescriptor } from "#genericMethod.ts";
|
|
3
|
+
import type { InitializerProof } from "#InitializerProof.ts";
|
|
4
|
+
import type { MethodInventory, MethodProof } from "#MethodProof.ts";
|
|
5
|
+
import type { RequirementProof } from "#RequirementProof.ts";
|
|
6
|
+
import type { RequirementRecord, RequirementsOf } from "#ServiceRequirements.ts";
|
|
7
7
|
type BoundMethod<TMethod, TRequirements> = TMethod extends (...arguments_: infer TArguments) => Effect.Effect<infer TSuccess, infer TFailure, infer TResidual> ? (...arguments_: TArguments) => Effect.Effect<TSuccess, TFailure, Exclude<TResidual, TRequirements>> : never;
|
|
8
8
|
type PublicMethod<TEntry, TRequirements> = TEntry extends GenericMethodDescriptor<infer TMethod> ? TMethod : BoundMethod<TEntry, TRequirements>;
|
|
9
9
|
type ServiceShape<TMethods extends MethodInventory, TRequirements extends RequirementRecord> = Readonly<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defineService.d.ts","sourceRoot":"","sources":["../src/defineService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAU,MAAM,QAAQ,CAAC;AACxD,OAAO,KAAK,EAAa,uBAAuB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"defineService.d.ts","sourceRoot":"","sources":["../src/defineService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAU,MAAM,QAAQ,CAAC;AACxD,OAAO,KAAK,EAAa,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sB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Aa,CAAC,CAAC,CAAC;IAClG,QAAQ,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,KAAK,QAAQ,GAAG,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,aAAa,CAAC,CAAC;IACpH,QAAQ,CAAC,QAAQ,EAAE,aAAa,GAAG,gBAAgB,CAAC,aAAa,CAAC,CAAC;CACnE;AASD,KAAK,cAAc,CAAC,WAAW,SAAS,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,IAAI,OAAO,CAAC,OAAO,CAAC,WAAW,EAAE,MAAM,CAAC,GAAG;IACzH,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,WAAW,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC;CAClE,CAAC;AAEF,wBAAgB,aAAa,CAC5B,KAAK,CAAC,WAAW,SAAS,MAAM,EAChC,KAAK,CAAC,aAAa,SAAS,iBAAiB,EAC7C,KAAK,CAAC,YAAY,SAAS,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,EACnE,KAAK,CAAC,QAAQ,SAAS,eAAe,EAEtC,UAAU,EAAE,iBAAiB,CAAC,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,QAAQ,CAAC,GAC/E,cAAc,CAAC,WAAW,EAAE,YAAY,CAAC,QAAQ,EAAE,aAAa,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE,cAAc,CAAC,aAAa,CAAC,CAAC,CAAC"}
|
package/dist/genericMethod.d.ts
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
import type { Effect } from "effect";
|
|
2
2
|
export type AnyMethod = (...arguments_: readonly never[]) => Effect.Effect<unknown, unknown, unknown>;
|
|
3
|
-
export interface GenericMethodDescriptor<TMethod extends AnyMethod> {
|
|
4
|
-
readonly _tag: "GenericMethod";
|
|
5
|
-
readonly method: TMethod;
|
|
6
|
-
}
|
|
7
|
-
type Same<TLeft, TRight> = (<TValue>() => TValue extends TLeft ? 1 : 2) extends <TValue>() => (TValue extends TRight ? 1 : 2) ? true : false;
|
|
8
3
|
export type HasDistinctCallSignatures<TMethod> = TMethod extends {
|
|
9
|
-
(...arguments_: infer TFirstArguments):
|
|
10
|
-
(...arguments_: infer TLastArguments):
|
|
11
|
-
} ?
|
|
4
|
+
(...arguments_: infer TFirstArguments): unknown;
|
|
5
|
+
(...arguments_: infer TLastArguments): unknown;
|
|
6
|
+
} ? [TFirstArguments] extends [TLastArguments] ? [TLastArguments] extends [TFirstArguments] ? false : true : true : false;
|
|
12
7
|
export interface GenericOrStructurallyOverloadedMethodsAreUnsupported {
|
|
13
8
|
readonly _serviceDefinitionError: "generic and structurally overloaded methods are unsupported";
|
|
14
9
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
export interface GenericMethodDescriptor<TMethod extends AnyMethod> {
|
|
11
|
+
readonly _tag: "GenericMethod";
|
|
12
|
+
readonly method: TMethod;
|
|
13
|
+
}
|
|
14
|
+
export declare function genericMethod<TMethod extends AnyMethod>(method: TMethod): GenericMethodDescriptor<TMethod>;
|
|
18
15
|
//# sourceMappingURL=genericMethod.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"genericMethod.d.ts","sourceRoot":"","sources":["../src/genericMethod.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,MAAM,MAAM,SAAS,GAAG,CAAC,GAAG,UAAU,EAAE,SAAS,KAAK,EAAE,KAAK,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AAEtG,MAAM,
|
|
1
|
+
{"version":3,"file":"genericMethod.d.ts","sourceRoot":"","sources":["../src/genericMethod.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,MAAM,MAAM,SAAS,GAAG,CAAC,GAAG,UAAU,EAAE,SAAS,KAAK,EAAE,KAAK,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AAEtG,MAAM,MAAM,yBAAyB,CAAC,OAAO,IAAI,OAAO,SAAS;IAChE,CAAC,GAAG,UAAU,EAAE,MAAM,eAAe,GAAG,OAAO,CAAC;IAChD,CAAC,GAAG,UAAU,EAAE,MAAM,cAAc,GAAG,OAAO,CAAC;CAC/C,GACE,CAAC,eAAe,CAAC,SAAS,CAAC,cAAc,CAAC,GACzC,CAAC,cAAc,CAAC,SAAS,CAAC,eAAe,CAAC,GACzC,KAAK,GACL,IAAI,GACL,IAAI,GACL,KAAK,CAAC;AAET,MAAM,WAAW,oDAAoD;IACpE,QAAQ,CAAC,uBAAuB,EAAE,6DAA6D,CAAC;CAChG;AAED,MAAM,WAAW,uBAAuB,CAAC,OAAO,SAAS,SAAS;IACjE,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;IAC/B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CACzB;AAED,wBAAgB,aAAa,CAAC,OAAO,SAAS,SAAS,EAAE,MAAM,EAAE,OAAO,GAAG,uBAAuB,CAAC,OAAO,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"genericMethod.js","sourceRoot":"","sources":["../src/genericMethod.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"genericMethod.js","sourceRoot":"","sources":["../src/genericMethod.ts"],"names":[],"mappings":"AAyBA,MAAM,UAAU,aAAa,CAAC,MAAiB;IAC9C,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,EAAE,CAAC;AAC1C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shivaedev/service",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.2",
|
|
4
4
|
"description": "Declared Effect services with scoped initialization and bound dependencies",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"effect"
|
|
@@ -43,17 +43,17 @@
|
|
|
43
43
|
"README.md"
|
|
44
44
|
],
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@effect/vitest": "4.1.
|
|
47
|
-
"@shivaedev/quality": "0.
|
|
48
|
-
"@shivaedev/test": "0.17.
|
|
49
|
-
"@shivaedev/test-story": "0.
|
|
46
|
+
"@effect/vitest": "4.1.1",
|
|
47
|
+
"@shivaedev/quality": "0.72.2",
|
|
48
|
+
"@shivaedev/test": "0.17.1",
|
|
49
|
+
"@shivaedev/test-story": "0.45.3",
|
|
50
50
|
"@types/node": "24.19.2",
|
|
51
|
-
"effect": "4.1.
|
|
51
|
+
"effect": "4.1.1",
|
|
52
52
|
"typescript": "7.0.2",
|
|
53
53
|
"vitest": "5.0.5"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"effect": "4.1.
|
|
56
|
+
"effect": "4.1.1"
|
|
57
57
|
},
|
|
58
58
|
"engines": {
|
|
59
59
|
"node": ">=24"
|
package/src/MethodProof.ts
CHANGED
|
@@ -37,7 +37,11 @@ type OrdinaryMethodProof<TName extends PropertyKey, TMethod, TRequirements exten
|
|
|
37
37
|
|
|
38
38
|
type SupportedMethod<TName extends PropertyKey, TMethod, TRequirements extends RequirementRecord> =
|
|
39
39
|
TMethod extends GenericMethodDescriptor<AnyMethod>
|
|
40
|
-
? TMethod
|
|
40
|
+
? TMethod extends GenericMethodDescriptor<infer TGenericMethod>
|
|
41
|
+
? [HasDistinctCallSignatures<TGenericMethod>] extends [true]
|
|
42
|
+
? GenericOrStructurallyOverloadedMethodsAreUnsupported
|
|
43
|
+
: TMethod
|
|
44
|
+
: TMethod
|
|
41
45
|
: TMethod extends AnyMethod
|
|
42
46
|
? HasDistinctCallSignatures<TMethod> extends true
|
|
43
47
|
? GenericOrStructurallyOverloadedMethodsAreUnsupported
|
package/src/defineService.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Context, Effect, Layer, Record } from "effect";
|
|
2
|
-
import type { AnyMethod, GenericMethodDescriptor } from "
|
|
3
|
-
import type { InitializerProof } from "
|
|
4
|
-
import type { MethodEntry, MethodInventory, MethodProof, MethodRecord, RuntimeMethodInventory } from "
|
|
5
|
-
import type { RequirementProof } from "
|
|
6
|
-
import type { RequirementRecord, RequirementsOf } from "
|
|
2
|
+
import type { AnyMethod, GenericMethodDescriptor } from "#genericMethod.ts";
|
|
3
|
+
import type { InitializerProof } from "#InitializerProof.ts";
|
|
4
|
+
import type { MethodEntry, MethodInventory, MethodProof, MethodRecord, RuntimeMethodInventory } from "#MethodProof.ts";
|
|
5
|
+
import type { RequirementProof } from "#RequirementProof.ts";
|
|
6
|
+
import type { RequirementRecord, RequirementsOf } from "#ServiceRequirements.ts";
|
|
7
7
|
|
|
8
8
|
type BoundMethod<TMethod, TRequirements> = TMethod extends (
|
|
9
9
|
...arguments_: infer TArguments
|
package/src/genericMethod.ts
CHANGED
|
@@ -2,19 +2,12 @@ import type { Effect } from "effect";
|
|
|
2
2
|
|
|
3
3
|
export type AnyMethod = (...arguments_: readonly never[]) => Effect.Effect<unknown, unknown, unknown>;
|
|
4
4
|
|
|
5
|
-
export interface GenericMethodDescriptor<TMethod extends AnyMethod> {
|
|
6
|
-
readonly _tag: "GenericMethod";
|
|
7
|
-
readonly method: TMethod;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
type Same<TLeft, TRight> = (<TValue>() => TValue extends TLeft ? 1 : 2) extends <TValue>() => TValue extends TRight ? 1 : 2 ? true : false;
|
|
11
|
-
|
|
12
5
|
export type HasDistinctCallSignatures<TMethod> = TMethod extends {
|
|
13
|
-
(...arguments_: infer TFirstArguments):
|
|
14
|
-
(...arguments_: infer TLastArguments):
|
|
6
|
+
(...arguments_: infer TFirstArguments): unknown;
|
|
7
|
+
(...arguments_: infer TLastArguments): unknown;
|
|
15
8
|
}
|
|
16
|
-
?
|
|
17
|
-
?
|
|
9
|
+
? [TFirstArguments] extends [TLastArguments]
|
|
10
|
+
? [TLastArguments] extends [TFirstArguments]
|
|
18
11
|
? false
|
|
19
12
|
: true
|
|
20
13
|
: true
|
|
@@ -24,10 +17,12 @@ export interface GenericOrStructurallyOverloadedMethodsAreUnsupported {
|
|
|
24
17
|
readonly _serviceDefinitionError: "generic and structurally overloaded methods are unsupported";
|
|
25
18
|
}
|
|
26
19
|
|
|
27
|
-
|
|
28
|
-
|
|
20
|
+
export interface GenericMethodDescriptor<TMethod extends AnyMethod> {
|
|
21
|
+
readonly _tag: "GenericMethod";
|
|
22
|
+
readonly method: TMethod;
|
|
23
|
+
}
|
|
29
24
|
|
|
30
|
-
export function genericMethod<TMethod extends AnyMethod>(method: TMethod):
|
|
25
|
+
export function genericMethod<TMethod extends AnyMethod>(method: TMethod): GenericMethodDescriptor<TMethod>;
|
|
31
26
|
export function genericMethod(method: AnyMethod): unknown {
|
|
32
27
|
return { _tag: "GenericMethod", method };
|
|
33
28
|
}
|