@bleedingdev/modern-js-bff-effect 3.9.0-ultramodern.4 → 3.9.0-ultramodern.6
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/README.md +20 -4
- package/dist/cjs/{effect-client/guards.js → assembly.js} +15 -9
- package/dist/cjs/data-platform/trace.js +2 -2
- package/dist/cjs/effect/edge-dispatcher.js +7 -7
- package/dist/cjs/effect/edge.js +15 -2
- package/dist/cjs/effect/endpoint-contracts.js +3 -4
- package/dist/cjs/effect/entry-shape.js +2 -2
- package/dist/cjs/effect/generated-entry.js +57 -0
- package/dist/cjs/effect/handler/batch-handler.js +5 -4
- package/dist/cjs/effect/handler/batch.js +8 -1
- package/dist/cjs/effect/handler/definition.js +1 -21
- package/dist/cjs/effect/module.js +4 -4
- package/dist/cjs/effect/operation-context.js +7 -7
- package/dist/cjs/effect-client/cross-project.js +92 -0
- package/dist/cjs/effect-client/index.js +5 -3
- package/dist/cjs/microvertical-api.js +120 -0
- package/dist/esm/assembly.mjs +12 -0
- package/dist/esm/data-platform/trace.mjs +1 -1
- package/dist/esm/effect/edge-dispatcher.mjs +5 -5
- package/dist/esm/effect/edge.mjs +1 -0
- package/dist/esm/effect/endpoint-contracts.mjs +2 -3
- package/dist/esm/effect/entry-shape.mjs +2 -2
- package/dist/esm/effect/generated-entry.mjs +19 -0
- package/dist/esm/effect/handler/batch-handler.mjs +5 -4
- package/dist/esm/effect/handler/batch.mjs +8 -1
- package/dist/esm/effect/handler/definition.mjs +1 -21
- package/dist/esm/effect/module.mjs +4 -4
- package/dist/esm/effect/operation-context.mjs +1 -1
- package/dist/esm/effect-client/cross-project.mjs +54 -0
- package/dist/esm/effect-client/index.mjs +4 -2
- package/dist/esm/microvertical-api.mjs +67 -0
- package/dist/esm-node/assembly.mjs +13 -0
- package/dist/esm-node/data-platform/trace.mjs +1 -1
- package/dist/esm-node/effect/edge-dispatcher.mjs +5 -5
- package/dist/esm-node/effect/edge.mjs +1 -0
- package/dist/esm-node/effect/endpoint-contracts.mjs +2 -3
- package/dist/esm-node/effect/entry-shape.mjs +2 -2
- package/dist/esm-node/effect/generated-entry.mjs +20 -0
- package/dist/esm-node/effect/handler/batch-handler.mjs +5 -4
- package/dist/esm-node/effect/handler/batch.mjs +8 -1
- package/dist/esm-node/effect/handler/definition.mjs +1 -21
- package/dist/esm-node/effect/module.mjs +4 -4
- package/dist/esm-node/effect/operation-context.mjs +1 -1
- package/dist/esm-node/effect-client/cross-project.mjs +55 -0
- package/dist/esm-node/effect-client/index.mjs +4 -2
- package/dist/esm-node/microvertical-api.mjs +68 -0
- package/dist/types/assembly.d.ts +10 -0
- package/dist/types/effect/context.d.ts +1 -1
- package/dist/types/effect/edge-context.d.ts +1 -1
- package/dist/types/effect/edge-dispatcher.d.ts +2 -2
- package/dist/types/effect/edge.d.ts +1 -0
- package/dist/types/effect/endpoint-contracts.d.ts +2 -20
- package/dist/types/effect/entry-shape.d.ts +2 -2
- package/dist/types/effect/generated-entry.d.ts +7 -0
- package/dist/types/effect/handler/batch.d.ts +7 -1
- package/dist/types/effect/handler/types.d.ts +0 -15
- package/dist/types/effect/handler.d.ts +1 -1
- package/dist/types/effect/operation-context.d.ts +1 -1
- package/dist/types/effect-client/cross-project.d.ts +10 -0
- package/dist/types/effect-client/index.d.ts +4 -1
- package/dist/types/microvertical-api.d.ts +65 -0
- package/package.json +26 -13
- package/src/assembly.ts +43 -0
- package/src/data-platform/batch/queue.ts +2 -3
- package/src/data-platform/trace.ts +1 -1
- package/src/effect/edge-dispatcher.ts +7 -5
- package/src/effect/edge.ts +1 -0
- package/src/effect/endpoint-contracts.ts +3 -24
- package/src/effect/entry-shape.ts +10 -5
- package/src/effect/generated-entry.ts +36 -0
- package/src/effect/handler/batch-handler.ts +21 -16
- package/src/effect/handler/batch.ts +9 -1
- package/src/effect/handler/definition.ts +0 -44
- package/src/effect/handler/http.ts +2 -2
- package/src/effect/handler/types.ts +0 -27
- package/src/effect/handler.ts +0 -1
- package/src/effect/module.ts +4 -4
- package/src/effect/operation-context.ts +1 -1
- package/src/effect-client/cross-project.ts +109 -0
- package/src/effect-client/index.ts +13 -3
- package/src/microvertical-api.ts +102 -0
- package/dist/cjs/effect-client/batch.js +0 -73
- package/dist/cjs/effect-client/envelope.js +0 -145
- package/dist/cjs/effect-client/request-context.js +0 -64
- package/dist/cjs/effect-client/request.js +0 -66
- package/dist/cjs/effect-client/runtime.js +0 -100
- package/dist/cjs/effect-client/types.js +0 -18
- package/dist/esm/effect-client/batch.mjs +0 -35
- package/dist/esm/effect-client/envelope.mjs +0 -104
- package/dist/esm/effect-client/guards.mjs +0 -3
- package/dist/esm/effect-client/request-context.mjs +0 -23
- package/dist/esm/effect-client/request.mjs +0 -28
- package/dist/esm/effect-client/runtime.mjs +0 -62
- package/dist/esm/effect-client/types.mjs +0 -0
- package/dist/esm-node/effect-client/batch.mjs +0 -36
- package/dist/esm-node/effect-client/envelope.mjs +0 -105
- package/dist/esm-node/effect-client/guards.mjs +0 -4
- package/dist/esm-node/effect-client/request-context.mjs +0 -24
- package/dist/esm-node/effect-client/request.mjs +0 -29
- package/dist/esm-node/effect-client/runtime.mjs +0 -63
- package/dist/esm-node/effect-client/types.mjs +0 -1
- package/dist/types/effect-client/batch.d.ts +0 -2
- package/dist/types/effect-client/envelope.d.ts +0 -15
- package/dist/types/effect-client/guards.d.ts +0 -2
- package/dist/types/effect-client/request-context.d.ts +0 -3
- package/dist/types/effect-client/request.d.ts +0 -1
- package/dist/types/effect-client/runtime.d.ts +0 -5
- package/dist/types/effect-client/types.d.ts +0 -68
- package/src/effect-client/batch.ts +0 -50
- package/src/effect-client/envelope.ts +0 -238
- package/src/effect-client/guards.ts +0 -6
- package/src/effect-client/request-context.ts +0 -54
- package/src/effect-client/request.ts +0 -51
- package/src/effect-client/runtime.ts +0 -122
- package/src/effect-client/types.ts +0 -84
|
@@ -3,6 +3,7 @@ import { DEFAULT_DATA_BATCH_HEADER, DEFAULT_DATA_ENVELOPE_HEADER, decodeRequestE
|
|
|
3
3
|
import { decodeBatchBody, isBatchBody, toBatchResponseItem } from "../../data-platform/batch/protocol.mjs";
|
|
4
4
|
import { BatchItemTimeoutError, createBatchValidationResponse, isBatchRequestPayload, mapWithConcurrency, normalizeBatchAllowedMethods, normalizeBatchPath, promiseWithTimeout, toBatchItemError } from "./batch.mjs";
|
|
5
5
|
import { getMountedPrefixFromContext, removeMountedPrefixFromBatchPath } from "./routing.mjs";
|
|
6
|
+
import * as __rspack_external_effect_Effect_41060786 from "effect/Effect";
|
|
6
7
|
const HOP_BY_HOP_BATCH_ITEM_HEADERS = new Set([
|
|
7
8
|
'connection',
|
|
8
9
|
'keep-alive',
|
|
@@ -185,25 +186,25 @@ function createDataPlatformBatchRequestHandler(options) {
|
|
|
185
186
|
return toBatchResponseItem(itemId, itemResponse, 'HEAD' === itemMethod);
|
|
186
187
|
} catch (error) {
|
|
187
188
|
if (error instanceof BatchItemTimeoutError) {
|
|
188
|
-
|
|
189
|
+
__rspack_external_effect_Effect_41060786.runSync(__rspack_external_effect_Effect_41060786.logError({
|
|
189
190
|
event: 'bff.batch.item.timeout',
|
|
190
191
|
batchId: payload.batchId,
|
|
191
192
|
itemId,
|
|
192
193
|
method: itemMethod,
|
|
193
194
|
path: itemPathname,
|
|
194
195
|
errorName: error.name
|
|
195
|
-
});
|
|
196
|
+
}));
|
|
196
197
|
return toBatchItemError(itemId, 504, 'Batch item request timed out');
|
|
197
198
|
}
|
|
198
199
|
if (error instanceof Response) return toBatchResponseItem(itemId, error, 'HEAD' === itemMethod);
|
|
199
|
-
|
|
200
|
+
__rspack_external_effect_Effect_41060786.runSync(__rspack_external_effect_Effect_41060786.logError({
|
|
200
201
|
event: 'bff.batch.item.failure',
|
|
201
202
|
batchId: payload.batchId,
|
|
202
203
|
itemId,
|
|
203
204
|
method: itemMethod,
|
|
204
205
|
path: itemPathname,
|
|
205
206
|
errorName: error instanceof Error ? error.name : 'UnknownError'
|
|
206
|
-
});
|
|
207
|
+
}));
|
|
207
208
|
return toBatchItemError(itemId, 500, 'Internal Server Error');
|
|
208
209
|
} finally{
|
|
209
210
|
request.signal.removeEventListener('abort', abortFromBatchRequest);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import "node:module";
|
|
2
2
|
import { DEFAULT_DATA_BATCH_ENDPOINT, isPlainObject, normalizeMethod } from "../../data-platform/index.mjs";
|
|
3
3
|
import { encodeBatchText } from "../../data-platform/batch/protocol.mjs";
|
|
4
|
+
import * as __rspack_external_effect_Data_2b3f4efb from "effect/Data";
|
|
4
5
|
function normalizeBatchPath(pathname) {
|
|
5
6
|
if (!pathname || '/' === pathname) return DEFAULT_DATA_BATCH_ENDPOINT;
|
|
6
7
|
if (!pathname.startsWith('/')) return `/${pathname}`;
|
|
@@ -65,7 +66,13 @@ function toBatchItemError(id, status, message) {
|
|
|
65
66
|
}))
|
|
66
67
|
};
|
|
67
68
|
}
|
|
68
|
-
class BatchItemTimeoutError extends
|
|
69
|
+
class BatchItemTimeoutError extends __rspack_external_effect_Data_2b3f4efb.TaggedError('BatchItemTimeoutError') {
|
|
70
|
+
constructor(message){
|
|
71
|
+
super({
|
|
72
|
+
message
|
|
73
|
+
});
|
|
74
|
+
this.name = 'Error';
|
|
75
|
+
}
|
|
69
76
|
}
|
|
70
77
|
function promiseWithTimeout(effect, timeoutMs, onTimeout) {
|
|
71
78
|
if (timeoutMs <= 0) return effect;
|
|
@@ -21,30 +21,10 @@ function defineEffectBff(definition) {
|
|
|
21
21
|
validateRequest: options?.validateRequest
|
|
22
22
|
});
|
|
23
23
|
});
|
|
24
|
-
const client = createLoaderMaterializedClientPlaceholder();
|
|
25
24
|
return {
|
|
26
25
|
...definition,
|
|
27
|
-
createHandler
|
|
28
|
-
client
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
const LOADER_CLIENT_IGNORED_KEYS = new Set([
|
|
32
|
-
'then',
|
|
33
|
-
'catch',
|
|
34
|
-
'finally',
|
|
35
|
-
'toJSON',
|
|
36
|
-
'$$typeof'
|
|
37
|
-
]);
|
|
38
|
-
function createLoaderMaterializedClientPlaceholder() {
|
|
39
|
-
const explain = (property)=>{
|
|
40
|
-
throw new Error(`[BFF][Effect] client.${String(property)} is not available here: the typed client only exists when the API entry is imported through the "@api/index" transformed path (the BFF loader replaces it with generated client code). On the server, use HttpApiClient or call the Effect layer directly.`);
|
|
26
|
+
createHandler
|
|
41
27
|
};
|
|
42
|
-
return new Proxy(Object.create(null), {
|
|
43
|
-
get (_target, property) {
|
|
44
|
-
if ('symbol' == typeof property || LOADER_CLIENT_IGNORED_KEYS.has(property)) return;
|
|
45
|
-
return explain(property);
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
28
|
}
|
|
49
29
|
function defineEffectRpcBff(definition) {
|
|
50
30
|
const createHandler = (options)=>createRpcApiHandler({
|
|
@@ -12,7 +12,7 @@ function shareDispose(dispose) {
|
|
|
12
12
|
return disposePromise;
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function rejectUnsupportedEffectModuleShape(options, shape) {
|
|
16
16
|
options.onWarning?.(`${strictEffectApproachMessage} Rejected ${shape}.`);
|
|
17
17
|
return true;
|
|
18
18
|
}
|
|
@@ -40,8 +40,8 @@ function classifyEffectBffRuntimeEntryShape(module) {
|
|
|
40
40
|
}
|
|
41
41
|
function resolveClassifiedEffectBffModuleHandler(facts, options = {}) {
|
|
42
42
|
if (!facts) return null;
|
|
43
|
-
if (facts.
|
|
44
|
-
if (
|
|
43
|
+
if (facts.unsupportedShape) {
|
|
44
|
+
if (rejectUnsupportedEffectModuleShape(options, facts.unsupportedShape)) return null;
|
|
45
45
|
}
|
|
46
46
|
if ('function' == typeof facts.createHandler) {
|
|
47
47
|
if (facts.createHandlerValidatorAware) {
|
|
@@ -54,7 +54,7 @@ function resolveClassifiedEffectBffModuleHandler(facts, options = {}) {
|
|
|
54
54
|
return createLoadedHandler(webHandler);
|
|
55
55
|
}
|
|
56
56
|
if (void 0 === facts.api || !facts.hasRuntimeLayer) {
|
|
57
|
-
|
|
57
|
+
rejectUnsupportedEffectModuleShape(options, 'unbranded `createHandler` export');
|
|
58
58
|
return null;
|
|
59
59
|
}
|
|
60
60
|
options.onWarning?.(`${strictEffectApproachMessage} Ignored unbranded \`createHandler\` export and rebuilt the handler from its { api, layer } exports.`);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
import { BFF_LOCALE_HEADER, BFF_OPERATION_CONTEXT_DETAIL_HEADER, BFF_OPERATION_CONTEXT_HEADER, BFF_TRACEPARENT_HEADER, parseTraceparent } from "@modern-js/
|
|
2
|
+
import { BFF_LOCALE_HEADER, BFF_OPERATION_CONTEXT_DETAIL_HEADER, BFF_OPERATION_CONTEXT_HEADER, BFF_TRACEPARENT_HEADER, parseTraceparent } from "@modern-js/runtime-extensions/request-context";
|
|
3
3
|
const kEffectContextStorage = Symbol.for('modernjs.plugin-bff.effectContextStorage');
|
|
4
4
|
const readHeader = (headers, header)=>{
|
|
5
5
|
const value = headers.get(header);
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import "node:module";
|
|
2
|
+
import { BFF_ENVELOPE_HEADER, BFF_OPERATION_CONTEXT_DETAIL_HEADER, BFF_OPERATION_CONTEXT_HEADER, resolveCrossProjectRequestObservation } from "@modern-js/server-runtime-extensions/bff-policy";
|
|
3
|
+
import { HttpClient, HttpClientRequest } from "effect/unstable/http";
|
|
4
|
+
import { HttpApi } from "effect/unstable/httpapi";
|
|
5
|
+
import * as __rspack_external_effect_Effect_41060786 from "effect/Effect";
|
|
6
|
+
import * as __rspack_external_effect_Schema_6065f72d from "effect/Schema";
|
|
7
|
+
const encodeJson = __rspack_external_effect_Schema_6065f72d.encodeSync(__rspack_external_effect_Schema_6065f72d.fromJsonString(__rspack_external_effect_Schema_6065f72d.Unknown));
|
|
8
|
+
function withCrossProjectPolicy(api, options, client) {
|
|
9
|
+
const contracts = {};
|
|
10
|
+
const prefix = options.prefix.replace(/\/$/, '');
|
|
11
|
+
HttpApi.reflect(api, {
|
|
12
|
+
onGroup: ()=>{},
|
|
13
|
+
onEndpoint: ({ endpoint })=>{
|
|
14
|
+
const routePath = `${prefix}${'/' === endpoint.path ? '' : endpoint.path}` || '/';
|
|
15
|
+
const name = endpoint.identifier;
|
|
16
|
+
contracts[`${endpoint.method}:${routePath}`] = {
|
|
17
|
+
operationId: `${options.requestId}:${name}`,
|
|
18
|
+
name,
|
|
19
|
+
method: endpoint.method,
|
|
20
|
+
routePath
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
return client.pipe(HttpClient.mapRequestEffect((request)=>{
|
|
25
|
+
const observed = resolveCrossProjectRequestObservation({
|
|
26
|
+
method: request.method,
|
|
27
|
+
pathname: new URL(request.url, 'http://effect.invalid').pathname
|
|
28
|
+
}, {
|
|
29
|
+
expectedOperationContracts: contracts
|
|
30
|
+
});
|
|
31
|
+
const contract = observed && contracts[`${observed.method}:${observed.routePath}`];
|
|
32
|
+
if (void 0 === contract) return __rspack_external_effect_Effect_41060786.die(new Error('[BFF][Effect] Request has no matching shared operation contract.'));
|
|
33
|
+
return __rspack_external_effect_Effect_41060786.gen(function*() {
|
|
34
|
+
const input = encodeJson({
|
|
35
|
+
httpMethod: contract.method,
|
|
36
|
+
name: contract.name,
|
|
37
|
+
requestId: options.requestId,
|
|
38
|
+
routePath: contract.routePath
|
|
39
|
+
});
|
|
40
|
+
const digest = yield* __rspack_external_effect_Effect_41060786.promise(()=>globalThis.crypto.subtle.digest('SHA-256', new TextEncoder().encode(input)));
|
|
41
|
+
const schemaHash = Array.from(new Uint8Array(digest), (value)=>value.toString(16).padStart(2, '0')).join('');
|
|
42
|
+
return request.pipe(HttpClientRequest.setHeader(BFF_ENVELOPE_HEADER, encodeJson({
|
|
43
|
+
requestId: options.requestId
|
|
44
|
+
})), HttpClientRequest.setHeader(BFF_OPERATION_CONTEXT_HEADER, contract.operationId), HttpClientRequest.setHeader(BFF_OPERATION_CONTEXT_DETAIL_HEADER, encodeJson({
|
|
45
|
+
requestId: options.requestId,
|
|
46
|
+
operationId: contract.operationId,
|
|
47
|
+
method: contract.method,
|
|
48
|
+
routePath: contract.routePath,
|
|
49
|
+
schemaHash,
|
|
50
|
+
operationVersion: options.operationVersion
|
|
51
|
+
})));
|
|
52
|
+
});
|
|
53
|
+
}));
|
|
54
|
+
}
|
|
55
|
+
export { withCrossProjectPolicy };
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
import { createRequestContextHeaders } from "@modern-js/
|
|
2
|
+
import { createRequestContextHeaders } from "@modern-js/runtime-extensions/request-context";
|
|
3
3
|
import * as __rspack_external_effect_Effect_41060786 from "effect/Effect";
|
|
4
4
|
import * as __rspack_external_effect_Layer_69c46453 from "effect/Layer";
|
|
5
5
|
import { FetchHttpClient, HttpClient, HttpClientRequest } from "effect/unstable/http";
|
|
6
6
|
import { HttpApi, HttpApiClient, HttpApiEndpoint, HttpApiGroup, HttpApiSchema } from "effect/unstable/httpapi";
|
|
7
7
|
import { Rpc, RpcClient, RpcGroup, RpcSchema, RpcSerialization } from "effect/unstable/rpc";
|
|
8
8
|
import { getRpcSerializationLayer } from "../effect/rpcSerialization.mjs";
|
|
9
|
+
import { withCrossProjectPolicy } from "./cross-project.mjs";
|
|
9
10
|
import * as __rspack_external_effect_Schema_6065f72d from "effect/Schema";
|
|
10
11
|
import * as __rspack_external_effect_unstable_http_HttpClientError_4b9eaee6 from "effect/unstable/http/HttpClientError";
|
|
11
12
|
import * as __rspack_external_effect_Data_2b3f4efb from "effect/Data";
|
|
@@ -47,7 +48,8 @@ function makeEffectHttpApiClient(api, options) {
|
|
|
47
48
|
for (const [header, value] of Object.entries(requestContextHeaders))if (void 0 === nextRequest.headers[header.toLowerCase()]) nextRequest = HttpClientRequest.setHeader(nextRequest, header, value);
|
|
48
49
|
return nextRequest;
|
|
49
50
|
}));
|
|
50
|
-
|
|
51
|
+
const policyClient = options?.crossProject !== void 0 ? withCrossProjectPolicy(api, options.crossProject, contextClient) : contextClient;
|
|
52
|
+
return 'function' == typeof options?.transformClient ? options.transformClient(policyClient) : policyClient;
|
|
51
53
|
};
|
|
52
54
|
return HttpApiClient.make(api, {
|
|
53
55
|
baseUrl: options?.baseUrl,
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import "node:module";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
const MicroVerticalAppIdSchema = Schema.String.pipe(Schema.brand('MicroVerticalAppId'), Schema.decodeTo(Schema.String));
|
|
4
|
+
const MicroVerticalUnitIdSchema = Schema.String.pipe(Schema.brand('MicroVerticalUnitId'), Schema.decodeTo(Schema.String));
|
|
5
|
+
const MicroVerticalOperationIdSchema = Schema.String.pipe(Schema.brand('MicroVerticalOperationId'), Schema.decodeTo(Schema.String));
|
|
6
|
+
const MicroVerticalTraceIdSchema = Schema.String.pipe(Schema.brand('MicroVerticalTraceId'), Schema.decodeTo(Schema.String));
|
|
7
|
+
const MicroVerticalBuildMarkerSchema = Schema.Struct({
|
|
8
|
+
appId: MicroVerticalAppIdSchema,
|
|
9
|
+
build: Schema.String,
|
|
10
|
+
buildMarker: Schema.String,
|
|
11
|
+
deployProfile: Schema.String,
|
|
12
|
+
packageName: Schema.String,
|
|
13
|
+
sourceRevision: Schema.String,
|
|
14
|
+
surface: Schema.String,
|
|
15
|
+
unitId: MicroVerticalUnitIdSchema,
|
|
16
|
+
version: Schema.String
|
|
17
|
+
});
|
|
18
|
+
const MicroVerticalReadinessSchema = Schema.Struct({
|
|
19
|
+
checks: Schema.Struct({
|
|
20
|
+
api: Schema.Literal('ready'),
|
|
21
|
+
moduleFederation: Schema.Literal('ready'),
|
|
22
|
+
ssr: Schema.Literal('ready'),
|
|
23
|
+
translations: Schema.Literal('ready')
|
|
24
|
+
}),
|
|
25
|
+
marker: MicroVerticalBuildMarkerSchema,
|
|
26
|
+
status: Schema.Literal('ready'),
|
|
27
|
+
versionSkew: Schema.Literal('none')
|
|
28
|
+
});
|
|
29
|
+
const MicroVerticalOperationSourceSchema = Schema.Literals([
|
|
30
|
+
'client',
|
|
31
|
+
'server',
|
|
32
|
+
'generated-client',
|
|
33
|
+
'effect-adapter',
|
|
34
|
+
'data-platform',
|
|
35
|
+
'unknown'
|
|
36
|
+
]);
|
|
37
|
+
const MicroVerticalOperationContextSchema = Schema.Struct({
|
|
38
|
+
method: Schema.String,
|
|
39
|
+
operationId: MicroVerticalOperationIdSchema,
|
|
40
|
+
routePath: Schema.String,
|
|
41
|
+
source: MicroVerticalOperationSourceSchema,
|
|
42
|
+
traceId: Schema.optionalKey(MicroVerticalTraceIdSchema)
|
|
43
|
+
});
|
|
44
|
+
const createMicroVerticalOperationContext = (input)=>{
|
|
45
|
+
const context = {
|
|
46
|
+
method: input.method,
|
|
47
|
+
operationId: input.operationId,
|
|
48
|
+
routePath: input.routePath,
|
|
49
|
+
source: 'generated-client'
|
|
50
|
+
};
|
|
51
|
+
return void 0 === input.traceId ? context : {
|
|
52
|
+
...context,
|
|
53
|
+
traceId: input.traceId
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
const microVerticalOperationAttributes = (operationContext)=>{
|
|
57
|
+
const attributes = {
|
|
58
|
+
'modernjs.operation.id': operationContext.operationId,
|
|
59
|
+
'modernjs.operation.method': operationContext.method,
|
|
60
|
+
'modernjs.operation.route': operationContext.routePath,
|
|
61
|
+
'modernjs.operation.source': operationContext.source
|
|
62
|
+
};
|
|
63
|
+
return void 0 === operationContext.traceId ? attributes : {
|
|
64
|
+
...attributes,
|
|
65
|
+
'modernjs.trace.id': operationContext.traceId
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
export { MicroVerticalBuildMarkerSchema, MicroVerticalOperationContextSchema, MicroVerticalOperationSourceSchema, MicroVerticalReadinessSchema, createMicroVerticalOperationContext, microVerticalOperationAttributes };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Server-only assembly for the invariant tail of a strict Effect BFF runtime factory. */
|
|
2
|
+
import * as Layer from 'effect/Layer';
|
|
3
|
+
import type { HttpApi, HttpApiGroup } from 'effect/unstable/httpapi';
|
|
4
|
+
import type { EffectRuntimeRequirements } from './effect/handler/types.js';
|
|
5
|
+
export interface EffectBffRuntimeAssembly<ApiId extends string, Groups extends HttpApiGroup.Constraint, HandlerRequirements extends EffectRuntimeRequirements, TransportRequirements extends EffectRuntimeRequirements = never> {
|
|
6
|
+
readonly api: HttpApi.HttpApi<ApiId, Groups>;
|
|
7
|
+
readonly handlers: Layer.Layer<HttpApiGroup.ToService<ApiId, Groups>, never, HandlerRequirements>;
|
|
8
|
+
readonly transport?: Layer.Layer<never, never, TransportRequirements>;
|
|
9
|
+
}
|
|
10
|
+
export declare const assembleEffectBffRuntime: <ApiId extends string, Groups extends HttpApiGroup.Constraint, HandlerRequirements extends EffectRuntimeRequirements, TransportRequirements extends EffectRuntimeRequirements = never>({ api, handlers, transport, }: EffectBffRuntimeAssembly<ApiId, Groups, HandlerRequirements, TransportRequirements>) => import("./effect/index.js").EffectBffDefinition<HttpApi.HttpApi<ApiId, Groups>, Layer.Layer<never, never, HandlerRequirements | TransportRequirements | Exclude<import("effect/FileSystem").FileSystem, HttpApiGroup.ToService<ApiId, Groups>> | Exclude<import("effect/unstable/http/Etag").Generator, HttpApiGroup.ToService<ApiId, Groups>> | Exclude<import("effect/unstable/http/HttpPlatform").HttpPlatform, HttpApiGroup.ToService<ApiId, Groups>> | Exclude<import("effect/unstable/http/HttpRouter").HttpRouter, HttpApiGroup.ToService<ApiId, Groups>> | Exclude<import("effect/Path").Path, HttpApiGroup.ToService<ApiId, Groups>> | Exclude<HttpApiGroup.ToService<ApiId, Groups>, HttpApiGroup.ToService<ApiId, Groups>>>, import("effect/unstable/rpc/Rpc").Any> & import("./effect/index.js").EffectBffRuntime<HttpApi.HttpApi<ApiId, Groups>, Layer.Layer<never, never, HandlerRequirements | TransportRequirements | Exclude<import("effect/FileSystem").FileSystem, HttpApiGroup.ToService<ApiId, Groups>> | Exclude<import("effect/unstable/http/Etag").Generator, HttpApiGroup.ToService<ApiId, Groups>> | Exclude<import("effect/unstable/http/HttpPlatform").HttpPlatform, HttpApiGroup.ToService<ApiId, Groups>> | Exclude<import("effect/unstable/http/HttpRouter").HttpRouter, HttpApiGroup.ToService<ApiId, Groups>> | Exclude<import("effect/Path").Path, HttpApiGroup.ToService<ApiId, Groups>> | Exclude<HttpApiGroup.ToService<ApiId, Groups>, HttpApiGroup.ToService<ApiId, Groups>>>>;
|
|
@@ -2,4 +2,4 @@ import { type EffectContext } from './operation-context.js';
|
|
|
2
2
|
export { type CreateEffectOperationContextOptions, createEffectOperationContext, type EffectContext, } from './operation-context.js';
|
|
3
3
|
export declare const runWithEffectContext: <T>(context: EffectContext, cb: () => T) => T;
|
|
4
4
|
export declare const useEffectContext: () => EffectContext;
|
|
5
|
-
export declare const useOperationContext: () => import("@modern-js/
|
|
5
|
+
export declare const useOperationContext: () => import("@modern-js/runtime-extensions/request-context").OperationContext;
|
|
@@ -2,4 +2,4 @@ import { type EffectContext } from './operation-context.js';
|
|
|
2
2
|
export { type CreateEffectOperationContextOptions, createEffectOperationContext, type EffectContext, } from './operation-context.js';
|
|
3
3
|
export declare const runWithEffectContext: <T>(context: EffectContext, cb: () => T) => T;
|
|
4
4
|
export declare const useEffectContext: () => EffectContext;
|
|
5
|
-
export declare const useOperationContext: () => import("@modern-js/
|
|
5
|
+
export declare const useOperationContext: () => import("@modern-js/runtime-extensions/request-context").OperationContext;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type NormalizedCrossProjectPolicy } from '@modern-js/
|
|
1
|
+
import { type NormalizedCrossProjectPolicy } from '@modern-js/server-runtime-extensions/bff-policy';
|
|
2
2
|
import { type DispatchEffectBffRequestOptions } from './dispatch.js';
|
|
3
3
|
import type { EffectBffOpenApiConfig, EffectDataPlatformValidationOptions } from './handler.js';
|
|
4
4
|
import { type EffectApiModule, type EffectBffRequestHandler } from './module.js';
|
|
@@ -12,7 +12,7 @@ export { Cookies, Etag, FetchHttpClient, FindMyWay, Headers, HttpBody, HttpClien
|
|
|
12
12
|
export { HttpApi, HttpApiBuilder, HttpApiClient, HttpApiEndpoint, HttpApiError, HttpApiGroup, HttpApiMiddleware, HttpApiSchema, HttpApiSecurity, HttpApiTest, OpenApi, } from 'effect/unstable/httpapi';
|
|
13
13
|
export { Rpc, RpcClient, RpcClientError, RpcGroup, RpcMessage, RpcMiddleware, RpcSchema, RpcSerialization, RpcServer, RpcTest, RpcWorker, Utils, } from 'effect/unstable/rpc';
|
|
14
14
|
export { runWithEffectContext, useEffectContext, useOperationContext, } from './edge-context.js';
|
|
15
|
-
export type { EffectApiClientFromApi,
|
|
15
|
+
export type { EffectApiClientFromApi, EffectBffDefinition, EffectBffHandlerFactory, EffectBffOpenApiConfig, EffectBffRuntime, EffectDataPlatformBatchOptions, EffectDataPlatformSelectionValidationOptions, EffectDataPlatformValidationOptions, EffectRequestValidator, EffectRpcBffDefinition, EffectRpcBffHandlerFactory, EffectRpcBffHandlerOptions, EffectRpcRuntimeLayer, EffectRpcSerialization, EffectRuntimeLayer, EffectRuntimeRequirements, } from './handler.js';
|
|
16
16
|
export { createHttpApiHandler, defineEffectBff, defineEffectRpcBff, } from './handler.js';
|
|
17
17
|
export { type CreateEffectOperationContextOptions, createEffectOperationContext, type EffectContext, } from './operation-context.js';
|
|
18
18
|
export type EffectBffEdgeDispatchOptions = Omit<DispatchEffectBffRequestOptions, 'runWithEffectContext'>;
|
|
@@ -1,17 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
* cross-project contract:
|
|
4
|
-
*
|
|
5
|
-
* - the `@modern-js/plugin-bff-extensions/client-generator` package stamps
|
|
6
|
-
* each generated operation with a per-endpoint contract hash;
|
|
7
|
-
* - the `@modern-js/plugin-bff-extensions/effect-adapter` package derives the
|
|
8
|
-
* expected operation-contract map for the cross-project policy from the
|
|
9
|
-
* same endpoints.
|
|
10
|
-
*
|
|
11
|
-
* Keeping route-path normalization and the endpoint -> contract mapping in
|
|
12
|
-
* one module is what guarantees the two hashes agree.
|
|
13
|
-
*/
|
|
14
|
-
import { type OperationContractSource } from '@modern-js/bff-core';
|
|
1
|
+
/** Shared endpoint normalization and identity hashing for server policy metadata. */
|
|
2
|
+
import { type OperationContractSource } from '@modern-js/server-runtime-extensions/bff-policy/node';
|
|
15
3
|
export type EffectEndpointMeta = {
|
|
16
4
|
apiId: string;
|
|
17
5
|
groupName: string;
|
|
@@ -26,13 +14,7 @@ type HttpApiGroupLike = {
|
|
|
26
14
|
identifier?: unknown;
|
|
27
15
|
};
|
|
28
16
|
type HttpApiEndpointLike = {
|
|
29
|
-
/**
|
|
30
|
-
* effect 4.0.0-beta.98 renamed the endpoint `name` property to `identifier`,
|
|
31
|
-
* matching `HttpApiGroup`. `name` is kept as a fallback so reflection over an
|
|
32
|
-
* older Effect build does not silently degrade to the class name.
|
|
33
|
-
*/
|
|
34
17
|
identifier?: unknown;
|
|
35
|
-
name?: unknown;
|
|
36
18
|
method?: unknown;
|
|
37
19
|
path?: unknown;
|
|
38
20
|
};
|
|
@@ -5,10 +5,10 @@ type EffectBffEntryModule = {
|
|
|
5
5
|
createHandler?: unknown;
|
|
6
6
|
default?: unknown;
|
|
7
7
|
};
|
|
8
|
-
type
|
|
8
|
+
type UnsupportedEffectBffEntryShape = '`handler` export' | 'default request handler';
|
|
9
9
|
export type EffectBffEntryShapeFacts = {
|
|
10
10
|
module: EffectBffEntryModule;
|
|
11
|
-
|
|
11
|
+
unsupportedShape?: UnsupportedEffectBffEntryShape;
|
|
12
12
|
createHandler?: unknown;
|
|
13
13
|
createHandlerValidatorAware: boolean;
|
|
14
14
|
api?: unknown;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type EffectBffEdgeHandlerOptions } from './edge-dispatcher.js';
|
|
2
|
+
type OperationContracts = NonNullable<EffectBffEdgeHandlerOptions['crossProjectPolicy']>['expectedOperationContracts'];
|
|
3
|
+
export declare function createEffectBffEdgeDispatcherFactory(module: EffectBffEdgeHandlerOptions['module'], generatedOperationContracts: OperationContracts): (options?: Omit<EffectBffEdgeHandlerOptions, 'module'>) => Promise<{
|
|
4
|
+
dispatch: (request: Request, dispatchOptions?: Omit<import("./edge-dispatcher.js").EffectBffEdgeDispatchOptions, 'prefix' | 'onError'>) => Promise<Response>;
|
|
5
|
+
dispose: () => Promise<void>;
|
|
6
|
+
}>;
|
|
7
|
+
export {};
|
|
@@ -9,7 +9,13 @@ export declare function isBatchRequestPayload(value: unknown): value is ParsedBa
|
|
|
9
9
|
export declare function createBatchValidationResponse(message: string, status?: number): Response;
|
|
10
10
|
export declare function prepareJsonRequestBody(request: Request): Promise<Request | Response>;
|
|
11
11
|
export declare function toBatchItemError(id: string, status: number, message: string): DataBatchResponseItem;
|
|
12
|
-
|
|
12
|
+
declare const BatchItemTimeoutError_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 & {
|
|
13
|
+
readonly _tag: "BatchItemTimeoutError";
|
|
14
|
+
} & Readonly<A>;
|
|
15
|
+
export declare class BatchItemTimeoutError extends BatchItemTimeoutError_base<{
|
|
16
|
+
readonly message: string;
|
|
17
|
+
}> {
|
|
18
|
+
constructor(message: string);
|
|
13
19
|
}
|
|
14
20
|
export declare function promiseWithTimeout<T>(effect: Promise<T>, timeoutMs: number, onTimeout?: (error: BatchItemTimeoutError) => void): Promise<T>;
|
|
15
21
|
export declare function mapWithConcurrency<TItem, TResult>(items: readonly TItem[], concurrency: number, mapper: (item: TItem, index: number) => Promise<TResult>): Promise<TResult[]>;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { FileSystem, Path } from 'effect';
|
|
2
2
|
import * as Context from 'effect/Context';
|
|
3
|
-
import type * as EffectType from 'effect/Effect';
|
|
4
3
|
import type * as Layer from 'effect/Layer';
|
|
5
4
|
import type { Etag, HttpPlatform, HttpRouter } from 'effect/unstable/http';
|
|
6
5
|
import type { HttpApi, HttpApiClient, HttpApiGroup } from 'effect/unstable/httpapi';
|
|
@@ -23,13 +22,7 @@ export type EffectRpcBffDefinition<TRpcs extends Rpc.Any = Rpc.Any, TRpcLayer ex
|
|
|
23
22
|
disableFatalDefects?: boolean;
|
|
24
23
|
};
|
|
25
24
|
export type EffectRpcBffHandlerOptions = Pick<EffectRpcBffDefinition, 'path' | 'serialization' | 'disableTracing' | 'spanPrefix' | 'spanAttributes' | 'disableFatalDefects'>;
|
|
26
|
-
type EffectApiPromiseClient<TClient> = {
|
|
27
|
-
[GroupName in keyof TClient]: {
|
|
28
|
-
[EndpointName in keyof TClient[GroupName]]: TClient[GroupName][EndpointName] extends (...args: infer TArgs) => infer TResult ? TResult extends EffectType.Effect<unknown, unknown, unknown> ? (...args: TArgs) => Promise<Exclude<EffectType.Success<TResult>, readonly [unknown, unknown]>> : never : never;
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
25
|
export type EffectApiClientFromApi<TApi extends HttpApi.Constraint = HttpApi.Top> = TApi extends HttpApi.HttpApi<infer _ApiId, infer Groups> ? HttpApiClient.Client<Extract<Groups, HttpApiGroup.Constraint>, never, never> : never;
|
|
32
|
-
export type EffectApiPromiseClientFromApi<TApi extends HttpApi.Constraint = HttpApi.Top> = EffectApiPromiseClient<EffectApiClientFromApi<TApi>>;
|
|
33
26
|
export type EffectBffDefinition<TApi extends HttpApi.Constraint = HttpApi.Top, TLayer extends EffectRuntimeLayer = EffectRuntimeLayer, TRpcs extends Rpc.Any = Rpc.Any> = {
|
|
34
27
|
api: TApi;
|
|
35
28
|
layer: TLayer;
|
|
@@ -63,12 +56,6 @@ export type EffectDataPlatformBatchOptions = {
|
|
|
63
56
|
* Defaults to `65536` (64KiB).
|
|
64
57
|
*/
|
|
65
58
|
maxBatchBytes?: number;
|
|
66
|
-
/**
|
|
67
|
-
* Client-side micro-batch flush window in milliseconds.
|
|
68
|
-
* Server runtime ignores this value and passes it through for codegen.
|
|
69
|
-
* Defaults to `8`.
|
|
70
|
-
*/
|
|
71
|
-
flushIntervalMs?: number;
|
|
72
59
|
/**
|
|
73
60
|
* Maximum per-batch internal request concurrency.
|
|
74
61
|
* Defaults to `4`.
|
|
@@ -144,10 +131,8 @@ export type EffectBffHandlerFactory<TApi extends HttpApi.Constraint = HttpApi.To
|
|
|
144
131
|
}) => ReturnType<typeof createHttpApiHandler>;
|
|
145
132
|
export type EffectBffRuntime<TApi extends HttpApi.Constraint = HttpApi.Top, TLayer extends EffectRuntimeLayer = EffectRuntimeLayer> = {
|
|
146
133
|
createHandler: EffectBffHandlerFactory<TApi, TLayer>;
|
|
147
|
-
client: EffectApiPromiseClientFromApi<TApi>;
|
|
148
134
|
};
|
|
149
135
|
export type EffectBffOpenApiConfig = boolean | {
|
|
150
136
|
path?: string;
|
|
151
137
|
};
|
|
152
138
|
export type EffectRpcBffHandlerFactory<TRpcs extends Rpc.Any = Rpc.Any> = (options?: Partial<EffectRpcBffHandlerOptions>) => ReturnType<typeof createRpcApiHandler<TRpcs>>;
|
|
153
|
-
export {};
|
|
@@ -10,4 +10,4 @@ export { HttpApiBuilder } from 'effect/unstable/httpapi';
|
|
|
10
10
|
export * from 'effect/unstable/rpc';
|
|
11
11
|
export { defineEffectBff, defineEffectRpcBff } from './handler/definition.js';
|
|
12
12
|
export { createHttpApiHandler } from './handler/http.js';
|
|
13
|
-
export type { EffectApiClientFromApi,
|
|
13
|
+
export type { EffectApiClientFromApi, EffectBffDefinition, EffectBffHandlerFactory, EffectBffOpenApiConfig, EffectBffRuntime, EffectDataPlatformBatchOptions, EffectDataPlatformSelectionValidationOptions, EffectDataPlatformValidationOptions, EffectRequestValidator, EffectRpcBffDefinition, EffectRpcBffHandlerFactory, EffectRpcBffHandlerOptions, EffectRpcRuntimeLayer, EffectRpcSerialization, EffectRuntimeLayer, EffectRuntimeRequirements, } from './handler/types.js';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { HttpClient } from 'effect/unstable/http';
|
|
2
|
+
import { HttpApi, type HttpApiGroup } from 'effect/unstable/httpapi';
|
|
3
|
+
export interface EffectCrossProjectClientOptions {
|
|
4
|
+
requestId: string;
|
|
5
|
+
operationVersion: number;
|
|
6
|
+
/** Server mount path, independent of the API origin. */
|
|
7
|
+
prefix: string;
|
|
8
|
+
}
|
|
9
|
+
/** Native transport middleware; endpoint encoding and inference stay in Effect. */
|
|
10
|
+
export declare function withCrossProjectPolicy<Id extends string, Groups extends HttpApiGroup.Constraint>(api: HttpApi.HttpApi<Id, Groups>, options: EffectCrossProjectClientOptions, client: HttpClient.HttpClient): HttpClient.HttpClient;
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
import { type RequestContextInput } from '@modern-js/
|
|
1
|
+
import { type RequestContextInput } from '@modern-js/runtime-extensions/request-context';
|
|
2
2
|
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
6
|
import { Rpc, RpcClient, RpcGroup, RpcSchema, RpcSerialization } from 'effect/unstable/rpc';
|
|
7
|
+
import { type EffectCrossProjectClientOptions } from './cross-project.js';
|
|
7
8
|
export * as Effect from 'effect/Effect';
|
|
8
9
|
export * as Layer from 'effect/Layer';
|
|
9
10
|
export * as Schema from 'effect/Schema';
|
|
10
11
|
export * as HttpClientError from 'effect/unstable/http/HttpClientError';
|
|
12
|
+
export type { EffectCrossProjectClientOptions } from './cross-project.js';
|
|
11
13
|
export { HttpApi, HttpApiClient, HttpApiEndpoint, HttpApiGroup, HttpApiSchema, Rpc, RpcClient, RpcGroup, RpcSchema, RpcSerialization, };
|
|
12
14
|
export type EffectHttpApiClientOptions = {
|
|
15
|
+
crossProject?: EffectCrossProjectClientOptions;
|
|
13
16
|
baseUrl?: URL | string;
|
|
14
17
|
requestContext?: RequestContextInput;
|
|
15
18
|
transformClient?: (client: HttpClient.HttpClient) => HttpClient.HttpClient;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Schema } from 'effect';
|
|
2
|
+
export declare const MicroVerticalBuildMarkerSchema: Schema.Struct<{
|
|
3
|
+
readonly appId: Schema.compose<Schema.String, Schema.brand<Schema.String, "MicroVerticalAppId">>;
|
|
4
|
+
readonly build: Schema.String;
|
|
5
|
+
readonly buildMarker: Schema.String;
|
|
6
|
+
readonly deployProfile: Schema.String;
|
|
7
|
+
readonly packageName: Schema.String;
|
|
8
|
+
readonly sourceRevision: Schema.String;
|
|
9
|
+
readonly surface: Schema.String;
|
|
10
|
+
readonly unitId: Schema.compose<Schema.String, Schema.brand<Schema.String, "MicroVerticalUnitId">>;
|
|
11
|
+
readonly version: Schema.String;
|
|
12
|
+
}>;
|
|
13
|
+
export type MicroVerticalBuildMarker = typeof MicroVerticalBuildMarkerSchema.Type;
|
|
14
|
+
export declare const MicroVerticalReadinessSchema: Schema.Struct<{
|
|
15
|
+
readonly checks: Schema.Struct<{
|
|
16
|
+
readonly api: Schema.Literal<"ready">;
|
|
17
|
+
readonly moduleFederation: Schema.Literal<"ready">;
|
|
18
|
+
readonly ssr: Schema.Literal<"ready">;
|
|
19
|
+
readonly translations: Schema.Literal<"ready">;
|
|
20
|
+
}>;
|
|
21
|
+
readonly marker: Schema.Struct<{
|
|
22
|
+
readonly appId: Schema.compose<Schema.String, Schema.brand<Schema.String, "MicroVerticalAppId">>;
|
|
23
|
+
readonly build: Schema.String;
|
|
24
|
+
readonly buildMarker: Schema.String;
|
|
25
|
+
readonly deployProfile: Schema.String;
|
|
26
|
+
readonly packageName: Schema.String;
|
|
27
|
+
readonly sourceRevision: Schema.String;
|
|
28
|
+
readonly surface: Schema.String;
|
|
29
|
+
readonly unitId: Schema.compose<Schema.String, Schema.brand<Schema.String, "MicroVerticalUnitId">>;
|
|
30
|
+
readonly version: Schema.String;
|
|
31
|
+
}>;
|
|
32
|
+
readonly status: Schema.Literal<"ready">;
|
|
33
|
+
readonly versionSkew: Schema.Literal<"none">;
|
|
34
|
+
}>;
|
|
35
|
+
export type MicroVerticalReadiness = typeof MicroVerticalReadinessSchema.Type;
|
|
36
|
+
export declare const MicroVerticalOperationSourceSchema: Schema.Literals<readonly ["client", "server", "generated-client", "effect-adapter", "data-platform", "unknown"]>;
|
|
37
|
+
export type MicroVerticalOperationSource = typeof MicroVerticalOperationSourceSchema.Type;
|
|
38
|
+
export declare const MicroVerticalOperationContextSchema: Schema.Struct<{
|
|
39
|
+
readonly method: Schema.String;
|
|
40
|
+
readonly operationId: Schema.compose<Schema.String, Schema.brand<Schema.String, "MicroVerticalOperationId">>;
|
|
41
|
+
readonly routePath: Schema.String;
|
|
42
|
+
readonly source: Schema.Literals<readonly ["client", "server", "generated-client", "effect-adapter", "data-platform", "unknown"]>;
|
|
43
|
+
readonly traceId: Schema.optionalKey<Schema.compose<Schema.String, Schema.brand<Schema.String, "MicroVerticalTraceId">>>;
|
|
44
|
+
}>;
|
|
45
|
+
export type MicroVerticalOperationContext = typeof MicroVerticalOperationContextSchema.Type;
|
|
46
|
+
export declare const createMicroVerticalOperationContext: <const Method extends string, const OperationId extends string, const RoutePath extends string>(input: {
|
|
47
|
+
readonly method: Method;
|
|
48
|
+
readonly operationId: OperationId;
|
|
49
|
+
readonly routePath: RoutePath;
|
|
50
|
+
readonly traceId?: string;
|
|
51
|
+
}) => Readonly<typeof input & {
|
|
52
|
+
source: 'generated-client';
|
|
53
|
+
}>;
|
|
54
|
+
export declare const microVerticalOperationAttributes: (operationContext: MicroVerticalOperationContext) => {
|
|
55
|
+
'modernjs.operation.id': string;
|
|
56
|
+
'modernjs.operation.method': string;
|
|
57
|
+
'modernjs.operation.route': string;
|
|
58
|
+
'modernjs.operation.source': "client" | "data-platform" | "effect-adapter" | "generated-client" | "server" | "unknown";
|
|
59
|
+
} | {
|
|
60
|
+
'modernjs.operation.id': string;
|
|
61
|
+
'modernjs.operation.method': string;
|
|
62
|
+
'modernjs.operation.route': string;
|
|
63
|
+
'modernjs.operation.source': "client" | "data-platform" | "effect-adapter" | "generated-client" | "server" | "unknown";
|
|
64
|
+
'modernjs.trace.id': string;
|
|
65
|
+
};
|