@bleedingdev/modern-js-bff-effect 3.9.0-ultramodern.12 → 3.9.0-ultramodern.14
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/dist/cjs/effect/entry-shape.js +4 -1
- package/dist/cjs/effect/module.js +4 -0
- package/dist/cjs/effect/operation-context.js +1 -1
- package/dist/cjs/effect/rpcSerialization.js +0 -2
- package/dist/cjs/microvertical-api.js +1 -1
- package/dist/esm/effect/entry-shape-registry.mjs +2 -2
- package/dist/esm/effect/module.mjs +4 -0
- package/dist/esm/effect/operation-context.mjs +1 -1
- package/dist/esm/effect/rpcSerialization.mjs +0 -2
- package/dist/esm/microvertical-api.mjs +1 -1
- package/dist/esm-node/effect/entry-shape.mjs +4 -1
- package/dist/esm-node/effect/module.mjs +4 -0
- package/dist/esm-node/effect/operation-context.mjs +1 -1
- package/dist/esm-node/effect/rpcSerialization.mjs +0 -2
- package/dist/esm-node/microvertical-api.mjs +1 -1
- package/dist/types/effect/entry-shape.d.ts +2 -0
- package/dist/types/effect/handler/types.d.ts +1 -1
- package/dist/types/effect/module.d.ts +2 -1
- package/dist/types/effect-client/index.d.ts +3 -3
- package/dist/types/microvertical-api.d.ts +4 -4
- package/package.json +12 -12
- package/src/effect/entry-shape.ts +12 -0
- package/src/effect/handler/types.ts +1 -2
- package/src/effect/module.ts +7 -0
- package/src/effect/operation-context.ts +1 -1
- package/src/effect/rpcSerialization.ts +0 -2
- package/src/effect-client/index.ts +4 -4
- package/src/microvertical-api.ts +1 -1
|
@@ -44,7 +44,10 @@ function createLocalValidatorAwareHandlerFactoryRegistry() {
|
|
|
44
44
|
}
|
|
45
45
|
function loadNodeValidatorAwareHandlerFactoryRegistry() {
|
|
46
46
|
const moduleUrl = __rslib_import_meta_url__;
|
|
47
|
-
if ('string' != typeof moduleUrl || !moduleUrl.startsWith('file:'))
|
|
47
|
+
if ('string' != typeof moduleUrl || !moduleUrl.startsWith('file:')) {
|
|
48
|
+
if ("u" > typeof __modernjs_backend_private_capability__) return __modernjs_backend_private_capability__;
|
|
49
|
+
return createLocalValidatorAwareHandlerFactoryRegistry();
|
|
50
|
+
}
|
|
48
51
|
const moduleBuiltin = process.getBuiltinModule('node:module');
|
|
49
52
|
try {
|
|
50
53
|
return moduleBuiltin.createRequire(moduleUrl)("#effect-entry-shape-registry");
|
|
@@ -74,6 +74,10 @@ function resolveClassifiedEffectBffModuleHandler(facts, options = {}) {
|
|
|
74
74
|
if (facts.unsupportedShape) {
|
|
75
75
|
if (rejectUnsupportedEffectModuleShape(options, facts.unsupportedShape)) return null;
|
|
76
76
|
}
|
|
77
|
+
if (void 0 !== facts.module.rpc && !facts.createHandlerValidatorAware) {
|
|
78
|
+
rejectUnsupportedEffectModuleShape(options, 'unbranded RPC runtime');
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
77
81
|
if ('function' == typeof facts.createHandler) {
|
|
78
82
|
if (facts.createHandlerValidatorAware) {
|
|
79
83
|
const factory = facts.createHandler;
|
|
@@ -87,7 +87,7 @@ const createEffectOperationContext = ({ request, path, method })=>{
|
|
|
87
87
|
} : {},
|
|
88
88
|
routePath: servicePath,
|
|
89
89
|
method: (method || request.method || 'GET').toUpperCase(),
|
|
90
|
-
source: 'effect-
|
|
90
|
+
source: 'effect-server',
|
|
91
91
|
...path && path !== servicePath ? {
|
|
92
92
|
attributes: {
|
|
93
93
|
mountedPath: path
|
|
@@ -39,8 +39,6 @@ function getRpcSerializationLayer(serialization) {
|
|
|
39
39
|
return rpc_namespaceObject.RpcSerialization.layerJsonRpc();
|
|
40
40
|
case 'ndJsonRpc':
|
|
41
41
|
return rpc_namespaceObject.RpcSerialization.layerNdJsonRpc();
|
|
42
|
-
case 'msgPack':
|
|
43
|
-
return rpc_namespaceObject.RpcSerialization.layerMsgPack;
|
|
44
42
|
default:
|
|
45
43
|
return rpc_namespaceObject.RpcSerialization.layerJsonRpc();
|
|
46
44
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
import { __webpack_require__ } from "../rslib-runtime~1.mjs";
|
|
3
3
|
__webpack_require__.add({
|
|
4
|
-
|
|
4
|
+
Oz (module) {
|
|
5
5
|
const validatorAwareHandlerFactories = new WeakSet();
|
|
6
6
|
module.exports = {
|
|
7
7
|
register (factory) {
|
|
@@ -14,4 +14,4 @@ __webpack_require__.add({
|
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
|
-
__webpack_require__("
|
|
17
|
+
__webpack_require__("Oz");
|
|
@@ -42,6 +42,10 @@ function resolveClassifiedEffectBffModuleHandler(facts, options = {}) {
|
|
|
42
42
|
if (facts.unsupportedShape) {
|
|
43
43
|
if (rejectUnsupportedEffectModuleShape(options, facts.unsupportedShape)) return null;
|
|
44
44
|
}
|
|
45
|
+
if (void 0 !== facts.module.rpc && !facts.createHandlerValidatorAware) {
|
|
46
|
+
rejectUnsupportedEffectModuleShape(options, 'unbranded RPC runtime');
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
45
49
|
if ('function' == typeof facts.createHandler) {
|
|
46
50
|
if (facts.createHandlerValidatorAware) {
|
|
47
51
|
const factory = facts.createHandler;
|
|
@@ -54,7 +54,7 @@ const createEffectOperationContext = ({ request, path, method })=>{
|
|
|
54
54
|
} : {},
|
|
55
55
|
routePath: servicePath,
|
|
56
56
|
method: (method || request.method || 'GET').toUpperCase(),
|
|
57
|
-
source: 'effect-
|
|
57
|
+
source: 'effect-server',
|
|
58
58
|
...path && path !== servicePath ? {
|
|
59
59
|
attributes: {
|
|
60
60
|
mountedPath: path
|
|
@@ -7,8 +7,6 @@ function getRpcSerializationLayer(serialization) {
|
|
|
7
7
|
return RpcSerialization.layerJsonRpc();
|
|
8
8
|
case 'ndJsonRpc':
|
|
9
9
|
return RpcSerialization.layerNdJsonRpc();
|
|
10
|
-
case 'msgPack':
|
|
11
|
-
return RpcSerialization.layerMsgPack;
|
|
12
10
|
default:
|
|
13
11
|
return RpcSerialization.layerJsonRpc();
|
|
14
12
|
}
|
|
@@ -13,7 +13,10 @@ function createLocalValidatorAwareHandlerFactoryRegistry() {
|
|
|
13
13
|
}
|
|
14
14
|
function loadNodeValidatorAwareHandlerFactoryRegistry() {
|
|
15
15
|
const moduleUrl = import.meta.url;
|
|
16
|
-
if ('string' != typeof moduleUrl || !moduleUrl.startsWith('file:'))
|
|
16
|
+
if ('string' != typeof moduleUrl || !moduleUrl.startsWith('file:')) {
|
|
17
|
+
if ("u" > typeof __modernjs_backend_private_capability__) return __modernjs_backend_private_capability__;
|
|
18
|
+
return createLocalValidatorAwareHandlerFactoryRegistry();
|
|
19
|
+
}
|
|
17
20
|
const moduleBuiltin = process.getBuiltinModule('node:module');
|
|
18
21
|
try {
|
|
19
22
|
return moduleBuiltin.createRequire(moduleUrl)("#effect-entry-shape-registry");
|
|
@@ -43,6 +43,10 @@ function resolveClassifiedEffectBffModuleHandler(facts, options = {}) {
|
|
|
43
43
|
if (facts.unsupportedShape) {
|
|
44
44
|
if (rejectUnsupportedEffectModuleShape(options, facts.unsupportedShape)) return null;
|
|
45
45
|
}
|
|
46
|
+
if (void 0 !== facts.module.rpc && !facts.createHandlerValidatorAware) {
|
|
47
|
+
rejectUnsupportedEffectModuleShape(options, 'unbranded RPC runtime');
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
46
50
|
if ('function' == typeof facts.createHandler) {
|
|
47
51
|
if (facts.createHandlerValidatorAware) {
|
|
48
52
|
const factory = facts.createHandler;
|
|
@@ -55,7 +55,7 @@ const createEffectOperationContext = ({ request, path, method })=>{
|
|
|
55
55
|
} : {},
|
|
56
56
|
routePath: servicePath,
|
|
57
57
|
method: (method || request.method || 'GET').toUpperCase(),
|
|
58
|
-
source: 'effect-
|
|
58
|
+
source: 'effect-server',
|
|
59
59
|
...path && path !== servicePath ? {
|
|
60
60
|
attributes: {
|
|
61
61
|
mountedPath: path
|
|
@@ -8,8 +8,6 @@ function getRpcSerializationLayer(serialization) {
|
|
|
8
8
|
return RpcSerialization.layerJsonRpc();
|
|
9
9
|
case 'ndJsonRpc':
|
|
10
10
|
return RpcSerialization.layerNdJsonRpc();
|
|
11
|
-
case 'msgPack':
|
|
12
|
-
return RpcSerialization.layerMsgPack;
|
|
13
11
|
default:
|
|
14
12
|
return RpcSerialization.layerJsonRpc();
|
|
15
13
|
}
|
|
@@ -9,7 +9,7 @@ import type { createRpcApiHandler } from './rpc.js';
|
|
|
9
9
|
export type EffectRuntimeRequirements = Etag.Generator | FileSystem.FileSystem | HttpPlatform.HttpPlatform | HttpRouter.HttpRouter | HttpRouter.Request<'Error', unknown> | HttpRouter.Request<'GlobalError', unknown> | HttpRouter.Request<'GlobalRequires', unknown> | HttpRouter.Request<'Requires', unknown> | Path.Path;
|
|
10
10
|
export type EffectRuntimeLayer = Layer.Layer<never, never, EffectRuntimeRequirements>;
|
|
11
11
|
export declare const toEffectServiceContext: (context: unknown) => Context.Context<any>;
|
|
12
|
-
export type EffectRpcSerialization = 'json' | 'ndjson' | 'jsonRpc' | 'ndJsonRpc'
|
|
12
|
+
export type EffectRpcSerialization = 'json' | 'ndjson' | 'jsonRpc' | 'ndJsonRpc';
|
|
13
13
|
export type EffectRpcRuntimeLayer<TRpcs extends Rpc.Any = Rpc.Any> = Layer.Layer<Rpc.ToHandler<TRpcs> | Rpc.Middleware<TRpcs> | Rpc.ServicesServer<TRpcs>, unknown, never>;
|
|
14
14
|
export type EffectRpcBffDefinition<TRpcs extends Rpc.Any = Rpc.Any, TRpcLayer extends EffectRpcRuntimeLayer<TRpcs> = EffectRpcRuntimeLayer<TRpcs>> = {
|
|
15
15
|
group: RpcGroup.RpcGroup<TRpcs>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type * as EffectServiceContext from 'effect/Context';
|
|
2
|
-
import { type EffectBffOpenApiConfig, type EffectDataPlatformValidationOptions, type EffectRequestValidator } from './handler.js';
|
|
2
|
+
import { type EffectBffOpenApiConfig, type EffectDataPlatformValidationOptions, type EffectRequestValidator, type EffectRpcBffDefinition } from './handler.js';
|
|
3
3
|
import type { EffectContext } from './operation-context.js';
|
|
4
4
|
export type EffectBffRequestHandler = (request: Request, context?: EffectServiceContext.Context<any> | EffectContext) => Promise<Response> | Response;
|
|
5
5
|
export type EffectBffHandlerFactory = (options?: {
|
|
@@ -13,6 +13,7 @@ export type EffectBffHandlerFactory = (options?: {
|
|
|
13
13
|
export type EffectApiModule = {
|
|
14
14
|
api?: unknown;
|
|
15
15
|
layer?: unknown;
|
|
16
|
+
rpc?: EffectRpcBffDefinition;
|
|
16
17
|
handler?: EffectBffRequestHandler;
|
|
17
18
|
createHandler?: EffectBffHandlerFactory;
|
|
18
19
|
default?: unknown;
|
|
@@ -3,7 +3,7 @@ import * as Effect from 'effect/Effect';
|
|
|
3
3
|
import * as Layer from 'effect/Layer';
|
|
4
4
|
import { HttpClient } from 'effect/unstable/http';
|
|
5
5
|
import { HttpApi, HttpApiClient, HttpApiEndpoint, HttpApiGroup, HttpApiSchema } from 'effect/unstable/httpapi';
|
|
6
|
-
import { Rpc, RpcClient, RpcGroup, RpcSchema, RpcSerialization } from 'effect/unstable/rpc';
|
|
6
|
+
import { Rpc, RpcClient, RpcClientError, RpcGroup, RpcSchema, RpcSerialization } from 'effect/unstable/rpc';
|
|
7
7
|
import { type EffectCrossProjectClientOptions } from './cross-project.js';
|
|
8
8
|
export * as Effect from 'effect/Effect';
|
|
9
9
|
export * as Layer from 'effect/Layer';
|
|
@@ -30,7 +30,7 @@ export type EffectViewSelection<T> = {
|
|
|
30
30
|
export type EffectViewData<T, Selection> = Selection extends true ? T : Selection extends Record<string, unknown> ? {
|
|
31
31
|
[K in keyof Selection & keyof T]: EffectMaskedValue<T[K], Selection[K]>;
|
|
32
32
|
} : T;
|
|
33
|
-
export type EffectRpcSerialization = 'json' | 'ndjson' | 'jsonRpc' | 'ndJsonRpc'
|
|
33
|
+
export type EffectRpcSerialization = 'json' | 'ndjson' | 'jsonRpc' | 'ndJsonRpc';
|
|
34
34
|
declare const EffectRpcClientError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
35
35
|
readonly _tag: "EffectRpcClientError";
|
|
36
36
|
} & Readonly<A>;
|
|
@@ -50,7 +50,7 @@ export type EffectRpcClientOptions<Rpcs extends Rpc.Any, Flatten extends boolean
|
|
|
50
50
|
flatten?: Flatten;
|
|
51
51
|
serialization?: EffectRpcSerialization;
|
|
52
52
|
};
|
|
53
|
-
export type EffectRpcClientHandle<Rpcs extends Rpc.Any, Flatten extends boolean = false> = (Flatten extends true ? RpcClient.RpcClient.Flat<Rpcs,
|
|
53
|
+
export type EffectRpcClientHandle<Rpcs extends Rpc.Any, Flatten extends boolean = false> = (Flatten extends true ? RpcClient.RpcClient.Flat<Rpcs, RpcClientError.RpcClientError> : RpcClient.RpcClient<Rpcs, RpcClientError.RpcClientError>) & {
|
|
54
54
|
dispose: () => Promise<void>;
|
|
55
55
|
};
|
|
56
56
|
export declare function view<T>(): <const Selection extends EffectViewSelection<T>>(selection: Selection) => Selection;
|
|
@@ -33,13 +33,13 @@ export declare const MicroVerticalReadinessSchema: Schema.Struct<{
|
|
|
33
33
|
readonly versionSkew: Schema.Literal<"none">;
|
|
34
34
|
}>;
|
|
35
35
|
export type MicroVerticalReadiness = typeof MicroVerticalReadinessSchema.Type;
|
|
36
|
-
export declare const MicroVerticalOperationSourceSchema: Schema.Literals<readonly ["client", "server", "generated-client", "effect-
|
|
36
|
+
export declare const MicroVerticalOperationSourceSchema: Schema.Literals<readonly ["client", "server", "generated-client", "effect-server", "data-platform", "unknown"]>;
|
|
37
37
|
export type MicroVerticalOperationSource = typeof MicroVerticalOperationSourceSchema.Type;
|
|
38
38
|
export declare const MicroVerticalOperationContextSchema: Schema.Struct<{
|
|
39
39
|
readonly method: Schema.String;
|
|
40
40
|
readonly operationId: Schema.compose<Schema.String, Schema.brand<Schema.String, "MicroVerticalOperationId">>;
|
|
41
41
|
readonly routePath: Schema.String;
|
|
42
|
-
readonly source: Schema.Literals<readonly ["client", "server", "generated-client", "effect-
|
|
42
|
+
readonly source: Schema.Literals<readonly ["client", "server", "generated-client", "effect-server", "data-platform", "unknown"]>;
|
|
43
43
|
readonly traceId: Schema.optionalKey<Schema.compose<Schema.String, Schema.brand<Schema.String, "MicroVerticalTraceId">>>;
|
|
44
44
|
}>;
|
|
45
45
|
export type MicroVerticalOperationContext = typeof MicroVerticalOperationContextSchema.Type;
|
|
@@ -55,11 +55,11 @@ export declare const microVerticalOperationAttributes: (operationContext: MicroV
|
|
|
55
55
|
'modernjs.operation.id': string;
|
|
56
56
|
'modernjs.operation.method': string;
|
|
57
57
|
'modernjs.operation.route': string;
|
|
58
|
-
'modernjs.operation.source': "client" | "data-platform" | "effect-
|
|
58
|
+
'modernjs.operation.source': "client" | "data-platform" | "effect-server" | "generated-client" | "server" | "unknown";
|
|
59
59
|
} | {
|
|
60
60
|
'modernjs.operation.id': string;
|
|
61
61
|
'modernjs.operation.method': string;
|
|
62
62
|
'modernjs.operation.route': string;
|
|
63
|
-
'modernjs.operation.source': "client" | "data-platform" | "effect-
|
|
63
|
+
'modernjs.operation.source': "client" | "data-platform" | "effect-server" | "generated-client" | "server" | "unknown";
|
|
64
64
|
'modernjs.trace.id': string;
|
|
65
65
|
};
|
package/package.json
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"modern.js",
|
|
19
19
|
"ultramodern.js"
|
|
20
20
|
],
|
|
21
|
-
"version": "3.9.0-ultramodern.
|
|
21
|
+
"version": "3.9.0-ultramodern.14",
|
|
22
22
|
"files": [
|
|
23
23
|
"dist",
|
|
24
24
|
"src"
|
|
@@ -130,10 +130,10 @@
|
|
|
130
130
|
"node": ">=26.7.0"
|
|
131
131
|
},
|
|
132
132
|
"dependencies": {
|
|
133
|
-
"@modern-js/bff-core": "npm:@bleedingdev/modern-js-bff-core@3.9.0-ultramodern.
|
|
134
|
-
"@modern-js/create-request": "npm:@bleedingdev/modern-js-create-request@3.9.0-ultramodern.
|
|
135
|
-
"@modern-js/runtime-extensions": "npm:@bleedingdev/modern-js-runtime-extensions@3.9.0-ultramodern.
|
|
136
|
-
"@modern-js/server-runtime-extensions": "npm:@bleedingdev/modern-js-server-runtime-extensions@3.9.0-ultramodern.
|
|
133
|
+
"@modern-js/bff-core": "npm:@bleedingdev/modern-js-bff-core@3.9.0-ultramodern.14",
|
|
134
|
+
"@modern-js/create-request": "npm:@bleedingdev/modern-js-create-request@3.9.0-ultramodern.14",
|
|
135
|
+
"@modern-js/runtime-extensions": "npm:@bleedingdev/modern-js-runtime-extensions@3.9.0-ultramodern.14",
|
|
136
|
+
"@modern-js/server-runtime-extensions": "npm:@bleedingdev/modern-js-server-runtime-extensions@3.9.0-ultramodern.14",
|
|
137
137
|
"@opentelemetry/api": "1.9.1",
|
|
138
138
|
"@opentelemetry/api-logs": "0.222.0",
|
|
139
139
|
"@opentelemetry/resources": "2.11.0",
|
|
@@ -145,8 +145,8 @@
|
|
|
145
145
|
"@opentelemetry/semantic-conventions": "1.43.0"
|
|
146
146
|
},
|
|
147
147
|
"peerDependencies": {
|
|
148
|
-
"@effect/opentelemetry": "4.0.0-rc.
|
|
149
|
-
"effect": "4.0.0-rc.
|
|
148
|
+
"@effect/opentelemetry": "4.0.0-rc.117",
|
|
149
|
+
"effect": "4.0.0-rc.117"
|
|
150
150
|
},
|
|
151
151
|
"peerDependenciesMeta": {
|
|
152
152
|
"@effect/opentelemetry": {
|
|
@@ -157,13 +157,13 @@
|
|
|
157
157
|
}
|
|
158
158
|
},
|
|
159
159
|
"devDependencies": {
|
|
160
|
-
"@effect/opentelemetry": "4.0.0-rc.
|
|
161
|
-
"@rslib/core": "1.0.
|
|
160
|
+
"@effect/opentelemetry": "4.0.0-rc.117",
|
|
161
|
+
"@rslib/core": "1.0.2",
|
|
162
162
|
"@scripts/rstest-config": "2.66.0",
|
|
163
|
-
"@types/node": "^26.
|
|
164
|
-
"@types/react": "^19.
|
|
163
|
+
"@types/node": "^26.6.2",
|
|
164
|
+
"@types/react": "^19.3.0",
|
|
165
165
|
"@typescript/native-preview": "7.0.0-dev.20260707.2",
|
|
166
|
-
"effect": "4.0.0-rc.
|
|
166
|
+
"effect": "npm:@bleedingdev/effect@4.0.0-rc.117"
|
|
167
167
|
},
|
|
168
168
|
"sideEffects": false,
|
|
169
169
|
"publishConfig": {
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
import type { EffectRpcBffDefinition } from './handler/types';
|
|
2
|
+
|
|
1
3
|
type ValidatorAwareHandlerFactoryRegistry = {
|
|
2
4
|
register<TFactory extends Function>(factory: TFactory): TFactory;
|
|
3
5
|
is(factory: unknown): boolean;
|
|
4
6
|
};
|
|
5
7
|
|
|
8
|
+
declare const __modernjs_backend_private_capability__:
|
|
9
|
+
| ValidatorAwareHandlerFactoryRegistry
|
|
10
|
+
| undefined;
|
|
11
|
+
|
|
6
12
|
function createLocalValidatorAwareHandlerFactoryRegistry(): ValidatorAwareHandlerFactoryRegistry {
|
|
7
13
|
const factories = new WeakSet<Function>();
|
|
8
14
|
return {
|
|
@@ -19,6 +25,11 @@ function createLocalValidatorAwareHandlerFactoryRegistry(): ValidatorAwareHandle
|
|
|
19
25
|
function loadNodeValidatorAwareHandlerFactoryRegistry(): ValidatorAwareHandlerFactoryRegistry {
|
|
20
26
|
const moduleUrl = import.meta.url;
|
|
21
27
|
if (typeof moduleUrl !== 'string' || !moduleUrl.startsWith('file:')) {
|
|
28
|
+
// A verified CommonJS backend bundle has no import.meta.url. Its Node
|
|
29
|
+
// evaluator supplies the package-private registry directly.
|
|
30
|
+
if (typeof __modernjs_backend_private_capability__ !== 'undefined') {
|
|
31
|
+
return __modernjs_backend_private_capability__;
|
|
32
|
+
}
|
|
22
33
|
return createLocalValidatorAwareHandlerFactoryRegistry();
|
|
23
34
|
}
|
|
24
35
|
|
|
@@ -53,6 +64,7 @@ const validatorAwareHandlerFactoryRegistry =
|
|
|
53
64
|
type EffectBffEntryModule = {
|
|
54
65
|
api?: unknown;
|
|
55
66
|
layer?: unknown;
|
|
67
|
+
rpc?: EffectRpcBffDefinition;
|
|
56
68
|
handler?: unknown;
|
|
57
69
|
createHandler?: unknown;
|
|
58
70
|
default?: unknown;
|
package/src/effect/module.ts
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
type EffectBffOpenApiConfig,
|
|
13
13
|
type EffectDataPlatformValidationOptions,
|
|
14
14
|
type EffectRequestValidator,
|
|
15
|
+
type EffectRpcBffDefinition,
|
|
15
16
|
type EffectRuntimeLayer,
|
|
16
17
|
} from './handler';
|
|
17
18
|
import type { EffectContext } from './operation-context';
|
|
@@ -33,6 +34,7 @@ export type EffectBffHandlerFactory = (options?: {
|
|
|
33
34
|
export type EffectApiModule = {
|
|
34
35
|
api?: unknown;
|
|
35
36
|
layer?: unknown;
|
|
37
|
+
rpc?: EffectRpcBffDefinition;
|
|
36
38
|
handler?: EffectBffRequestHandler;
|
|
37
39
|
createHandler?: EffectBffHandlerFactory;
|
|
38
40
|
default?: unknown;
|
|
@@ -125,6 +127,11 @@ function resolveClassifiedEffectBffModuleHandler(
|
|
|
125
127
|
}
|
|
126
128
|
}
|
|
127
129
|
|
|
130
|
+
if (facts.module.rpc !== undefined && !facts.createHandlerValidatorAware) {
|
|
131
|
+
rejectUnsupportedEffectModuleShape(options, 'unbranded RPC runtime');
|
|
132
|
+
return null;
|
|
133
|
+
}
|
|
134
|
+
|
|
128
135
|
if (typeof facts.createHandler === 'function') {
|
|
129
136
|
if (facts.createHandlerValidatorAware) {
|
|
130
137
|
const factory = facts.createHandler as EffectBffHandlerFactory;
|
|
@@ -128,7 +128,7 @@ export const createEffectOperationContext = ({
|
|
|
128
128
|
: {}),
|
|
129
129
|
routePath: servicePath,
|
|
130
130
|
method: (method || request.method || 'GET').toUpperCase(),
|
|
131
|
-
source: 'effect-
|
|
131
|
+
source: 'effect-server',
|
|
132
132
|
...(path && path !== servicePath
|
|
133
133
|
? { attributes: { mountedPath: path } }
|
|
134
134
|
: {}),
|
|
@@ -12,8 +12,6 @@ export function getRpcSerializationLayer(
|
|
|
12
12
|
return RpcSerialization.layerJsonRpc();
|
|
13
13
|
case 'ndJsonRpc':
|
|
14
14
|
return RpcSerialization.layerNdJsonRpc();
|
|
15
|
-
case 'msgPack':
|
|
16
|
-
return RpcSerialization.layerMsgPack;
|
|
17
15
|
default:
|
|
18
16
|
return RpcSerialization.layerJsonRpc();
|
|
19
17
|
}
|
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
import {
|
|
25
25
|
Rpc,
|
|
26
26
|
RpcClient,
|
|
27
|
+
RpcClientError,
|
|
27
28
|
RpcGroup,
|
|
28
29
|
RpcSchema,
|
|
29
30
|
RpcSerialization,
|
|
@@ -106,8 +107,7 @@ export type EffectRpcSerialization =
|
|
|
106
107
|
| 'json'
|
|
107
108
|
| 'ndjson'
|
|
108
109
|
| 'jsonRpc'
|
|
109
|
-
| 'ndJsonRpc'
|
|
110
|
-
| 'msgPack';
|
|
110
|
+
| 'ndJsonRpc';
|
|
111
111
|
|
|
112
112
|
export class EffectRpcClientError extends Data.TaggedError(
|
|
113
113
|
'EffectRpcClientError',
|
|
@@ -138,8 +138,8 @@ export type EffectRpcClientHandle<
|
|
|
138
138
|
Rpcs extends Rpc.Any,
|
|
139
139
|
Flatten extends boolean = false,
|
|
140
140
|
> = (Flatten extends true
|
|
141
|
-
? RpcClient.RpcClient.Flat<Rpcs,
|
|
142
|
-
: RpcClient.RpcClient<Rpcs,
|
|
141
|
+
? RpcClient.RpcClient.Flat<Rpcs, RpcClientError.RpcClientError>
|
|
142
|
+
: RpcClient.RpcClient<Rpcs, RpcClientError.RpcClientError>) & {
|
|
143
143
|
dispose: () => Promise<void>;
|
|
144
144
|
};
|
|
145
145
|
|