@bleedingdev/modern-js-bff-effect 3.9.0-ultramodern.2 → 3.9.0-ultramodern.21

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.
Files changed (142) hide show
  1. package/README.md +20 -4
  2. package/dist/cjs/assembly.js +50 -0
  3. package/dist/cjs/{effect-client/guards.js → data-platform/batch/options.js} +13 -9
  4. package/dist/cjs/data-platform/batch/queue.js +48 -83
  5. package/dist/cjs/data-platform/trace.js +2 -2
  6. package/dist/cjs/effect/context.js +28 -4
  7. package/dist/cjs/effect/edge-dispatcher.js +12 -12
  8. package/dist/cjs/effect/edge.js +36 -3
  9. package/dist/cjs/effect/endpoint-contracts.js +3 -4
  10. package/dist/cjs/effect/entry-shape.js +40 -12
  11. package/dist/cjs/effect/generated-entry.js +57 -0
  12. package/dist/cjs/effect/handler/batch-handler.js +7 -7
  13. package/dist/cjs/effect/handler/batch.js +8 -10
  14. package/dist/cjs/effect/handler/definition.js +1 -21
  15. package/dist/cjs/effect/index.js +8 -8
  16. package/dist/cjs/effect/module.js +8 -4
  17. package/dist/cjs/effect/operation-context.js +10 -14
  18. package/dist/cjs/effect/rpcSerialization.js +0 -2
  19. package/dist/cjs/effect-client/cross-project.js +89 -0
  20. package/dist/cjs/effect-client/index.js +5 -3
  21. package/dist/cjs/microvertical-api.js +120 -0
  22. package/dist/esm/assembly.mjs +12 -0
  23. package/dist/esm/data-platform/batch/options.mjs +10 -0
  24. package/dist/esm/data-platform/batch/queue.mjs +48 -83
  25. package/dist/esm/data-platform/trace.mjs +1 -1
  26. package/dist/esm/effect/context.mjs +21 -6
  27. package/dist/esm/effect/edge-dispatcher.mjs +6 -6
  28. package/dist/esm/effect/edge.mjs +3 -0
  29. package/dist/esm/effect/endpoint-contracts.mjs +2 -3
  30. package/dist/esm/effect/entry-shape-registry.mjs +2 -2
  31. package/dist/esm/effect/entry-shape.mjs +29 -6
  32. package/dist/esm/effect/generated-entry.mjs +19 -0
  33. package/dist/esm/effect/handler/batch-handler.mjs +8 -8
  34. package/dist/esm/effect/handler/batch.mjs +9 -8
  35. package/dist/esm/effect/handler/definition.mjs +1 -21
  36. package/dist/esm/effect/index.mjs +1 -1
  37. package/dist/esm/effect/module.mjs +8 -4
  38. package/dist/esm/effect/operation-context.mjs +3 -4
  39. package/dist/esm/effect/rpcSerialization.mjs +0 -2
  40. package/dist/esm/effect-client/cross-project.mjs +51 -0
  41. package/dist/esm/effect-client/index.mjs +4 -2
  42. package/dist/esm/microvertical-api.mjs +67 -0
  43. package/dist/esm-node/assembly.mjs +13 -0
  44. package/dist/esm-node/data-platform/batch/options.mjs +11 -0
  45. package/dist/esm-node/data-platform/batch/queue.mjs +48 -83
  46. package/dist/esm-node/data-platform/trace.mjs +1 -1
  47. package/dist/esm-node/effect/context.mjs +21 -6
  48. package/dist/esm-node/effect/edge-dispatcher.mjs +6 -6
  49. package/dist/esm-node/effect/edge.mjs +3 -0
  50. package/dist/esm-node/effect/endpoint-contracts.mjs +2 -3
  51. package/dist/esm-node/effect/entry-shape.mjs +29 -6
  52. package/dist/esm-node/effect/generated-entry.mjs +20 -0
  53. package/dist/esm-node/effect/handler/batch-handler.mjs +8 -8
  54. package/dist/esm-node/effect/handler/batch.mjs +9 -8
  55. package/dist/esm-node/effect/handler/definition.mjs +1 -21
  56. package/dist/esm-node/effect/index.mjs +1 -1
  57. package/dist/esm-node/effect/module.mjs +8 -4
  58. package/dist/esm-node/effect/operation-context.mjs +3 -4
  59. package/dist/esm-node/effect/rpcSerialization.mjs +0 -2
  60. package/dist/esm-node/effect-client/cross-project.mjs +52 -0
  61. package/dist/esm-node/effect-client/index.mjs +4 -2
  62. package/dist/esm-node/microvertical-api.mjs +68 -0
  63. package/dist/types/assembly.d.ts +10 -0
  64. package/dist/types/data-platform/batch/options.d.ts +7 -0
  65. package/dist/types/data-platform/batch/queue.d.ts +0 -1
  66. package/dist/types/effect/context.d.ts +15 -2
  67. package/dist/types/effect/edge-dispatcher.d.ts +3 -3
  68. package/dist/types/effect/edge.d.ts +3 -0
  69. package/dist/types/effect/endpoint-contracts.d.ts +2 -20
  70. package/dist/types/effect/entry-shape.d.ts +16 -2
  71. package/dist/types/effect/generated-entry.d.ts +7 -0
  72. package/dist/types/effect/handler/batch.d.ts +7 -2
  73. package/dist/types/effect/handler/types.d.ts +2 -17
  74. package/dist/types/effect/handler.d.ts +1 -1
  75. package/dist/types/effect/module.d.ts +2 -1
  76. package/dist/types/effect/operation-context.d.ts +1 -2
  77. package/dist/types/effect-client/cross-project.d.ts +10 -0
  78. package/dist/types/effect-client/index.d.ts +7 -4
  79. package/dist/types/microvertical-api.d.ts +65 -0
  80. package/package.json +47 -42
  81. package/src/assembly.ts +43 -0
  82. package/src/data-platform/batch/options.ts +20 -0
  83. package/src/data-platform/batch/queue.ts +63 -92
  84. package/src/data-platform/trace.ts +1 -1
  85. package/src/effect/context.ts +64 -12
  86. package/src/effect/edge-dispatcher.ts +14 -11
  87. package/src/effect/edge.ts +6 -0
  88. package/src/effect/endpoint-contracts.ts +3 -24
  89. package/src/effect/entry-shape.ts +105 -10
  90. package/src/effect/generated-entry.ts +36 -0
  91. package/src/effect/handler/batch-handler.ts +27 -28
  92. package/src/effect/handler/batch.ts +9 -13
  93. package/src/effect/handler/definition.ts +0 -45
  94. package/src/effect/handler/http.ts +2 -2
  95. package/src/effect/handler/types.ts +3 -32
  96. package/src/effect/handler.ts +0 -1
  97. package/src/effect/index.ts +1 -1
  98. package/src/effect/module.ts +11 -4
  99. package/src/effect/operation-context.ts +2 -6
  100. package/src/effect/rpcSerialization.ts +0 -2
  101. package/src/effect-client/cross-project.ts +104 -0
  102. package/src/effect-client/index.ts +17 -7
  103. package/src/microvertical-api.ts +102 -0
  104. package/dist/cjs/effect/edge-context.js +0 -61
  105. package/dist/cjs/effect-client/batch.js +0 -73
  106. package/dist/cjs/effect-client/envelope.js +0 -145
  107. package/dist/cjs/effect-client/request-context.js +0 -64
  108. package/dist/cjs/effect-client/request.js +0 -66
  109. package/dist/cjs/effect-client/runtime.js +0 -100
  110. package/dist/cjs/effect-client/types.js +0 -18
  111. package/dist/esm/effect/edge-context.mjs +0 -14
  112. package/dist/esm/effect-client/batch.mjs +0 -35
  113. package/dist/esm/effect-client/envelope.mjs +0 -104
  114. package/dist/esm/effect-client/guards.mjs +0 -3
  115. package/dist/esm/effect-client/request-context.mjs +0 -23
  116. package/dist/esm/effect-client/request.mjs +0 -28
  117. package/dist/esm/effect-client/runtime.mjs +0 -62
  118. package/dist/esm/effect-client/types.mjs +0 -0
  119. package/dist/esm-node/effect/edge-context.mjs +0 -15
  120. package/dist/esm-node/effect-client/batch.mjs +0 -36
  121. package/dist/esm-node/effect-client/envelope.mjs +0 -105
  122. package/dist/esm-node/effect-client/guards.mjs +0 -4
  123. package/dist/esm-node/effect-client/request-context.mjs +0 -24
  124. package/dist/esm-node/effect-client/request.mjs +0 -29
  125. package/dist/esm-node/effect-client/runtime.mjs +0 -63
  126. package/dist/esm-node/effect-client/types.mjs +0 -1
  127. package/dist/types/effect/edge-context.d.ts +0 -5
  128. package/dist/types/effect-client/batch.d.ts +0 -2
  129. package/dist/types/effect-client/envelope.d.ts +0 -15
  130. package/dist/types/effect-client/guards.d.ts +0 -2
  131. package/dist/types/effect-client/request-context.d.ts +0 -3
  132. package/dist/types/effect-client/request.d.ts +0 -1
  133. package/dist/types/effect-client/runtime.d.ts +0 -5
  134. package/dist/types/effect-client/types.d.ts +0 -68
  135. package/src/effect/edge-context.ts +0 -51
  136. package/src/effect-client/batch.ts +0 -50
  137. package/src/effect-client/envelope.ts +0 -238
  138. package/src/effect-client/guards.ts +0 -6
  139. package/src/effect-client/request-context.ts +0 -54
  140. package/src/effect-client/request.ts +0 -51
  141. package/src/effect-client/runtime.ts +0 -122
  142. package/src/effect-client/types.ts +0 -84
@@ -1,7 +1,6 @@
1
1
  import { type DataBatchRequestPayload, type DataBatchResponseItem } from '../../data-platform/index.js';
2
2
  export { toHeaderRecord } from '../../headers.js';
3
3
  export declare function normalizeBatchPath(pathname: string | undefined): `/${string}`;
4
- export declare function normalizeBatchAllowedMethods(allowedMethods: string[] | undefined): Set<string>;
5
4
  type ParsedBatchRequestPayload = Omit<DataBatchRequestPayload, 'items'> & {
6
5
  items: unknown[];
7
6
  };
@@ -9,7 +8,13 @@ export declare function isBatchRequestPayload(value: unknown): value is ParsedBa
9
8
  export declare function createBatchValidationResponse(message: string, status?: number): Response;
10
9
  export declare function prepareJsonRequestBody(request: Request): Promise<Request | Response>;
11
10
  export declare function toBatchItemError(id: string, status: number, message: string): DataBatchResponseItem;
12
- export declare class BatchItemTimeoutError extends Error {
11
+ 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 & {
12
+ readonly _tag: "BatchItemTimeoutError";
13
+ } & Readonly<A>;
14
+ export declare class BatchItemTimeoutError extends BatchItemTimeoutError_base<{
15
+ readonly message: string;
16
+ }> {
17
+ constructor(message: string);
13
18
  }
14
19
  export declare function promiseWithTimeout<T>(effect: Promise<T>, timeoutMs: number, onTimeout?: (error: BatchItemTimeoutError) => void): Promise<T>;
15
20
  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';
@@ -10,7 +9,7 @@ import type { createRpcApiHandler } from './rpc.js';
10
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;
11
10
  export type EffectRuntimeLayer = Layer.Layer<never, never, EffectRuntimeRequirements>;
12
11
  export declare const toEffectServiceContext: (context: unknown) => Context.Context<any>;
13
- export type EffectRpcSerialization = 'json' | 'ndjson' | 'jsonRpc' | 'ndJsonRpc' | 'msgPack';
12
+ export type EffectRpcSerialization = 'json' | 'ndjson' | 'jsonRpc' | 'ndJsonRpc';
14
13
  export type EffectRpcRuntimeLayer<TRpcs extends Rpc.Any = Rpc.Any> = Layer.Layer<Rpc.ToHandler<TRpcs> | Rpc.Middleware<TRpcs> | Rpc.ServicesServer<TRpcs>, unknown, never>;
15
14
  export type EffectRpcBffDefinition<TRpcs extends Rpc.Any = Rpc.Any, TRpcLayer extends EffectRpcRuntimeLayer<TRpcs> = EffectRpcRuntimeLayer<TRpcs>> = {
16
15
  group: RpcGroup.RpcGroup<TRpcs>;
@@ -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`.
@@ -136,7 +123,7 @@ export type EffectRequestInterceptor = (options: {
136
123
  request: Request;
137
124
  next: () => Promise<Response>;
138
125
  }) => Response | Promise<Response>;
139
- export type EffectBffHandlerFactory<TApi extends HttpApi.Constraint = HttpApi.Top, TLayer extends EffectRuntimeLayer = EffectRuntimeLayer> = (options?: {
126
+ export type EffectBffHandlerFactory<_TApi extends HttpApi.Constraint = HttpApi.Top, _TLayer extends EffectRuntimeLayer = EffectRuntimeLayer> = (options?: {
140
127
  openapi?: EffectBffOpenApiConfig;
141
128
  rpc?: Partial<EffectRpcBffHandlerOptions>;
142
129
  dataPlatform?: Partial<EffectDataPlatformValidationOptions>;
@@ -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, EffectApiPromiseClientFromApi, EffectBffDefinition, EffectBffHandlerFactory, EffectBffOpenApiConfig, EffectBffRuntime, EffectDataPlatformBatchOptions, EffectDataPlatformSelectionValidationOptions, EffectDataPlatformValidationOptions, EffectRequestValidator, EffectRpcBffDefinition, EffectRpcBffHandlerFactory, EffectRpcBffHandlerOptions, EffectRpcRuntimeLayer, EffectRpcSerialization, EffectRuntimeLayer, EffectRuntimeRequirements, } from './handler/types.js';
13
+ export type { EffectApiClientFromApi, EffectBffDefinition, EffectBffHandlerFactory, EffectBffOpenApiConfig, EffectBffRuntime, EffectDataPlatformBatchOptions, EffectDataPlatformSelectionValidationOptions, EffectDataPlatformValidationOptions, EffectRequestValidator, EffectRpcBffDefinition, EffectRpcBffHandlerFactory, EffectRpcBffHandlerOptions, EffectRpcRuntimeLayer, EffectRpcSerialization, EffectRuntimeLayer, EffectRuntimeRequirements, } from './handler/types.js';
@@ -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;
@@ -1,4 +1,4 @@
1
- import { type OperationContext } from '@modern-js/create-request';
1
+ import { type OperationContext } from '@modern-js/runtime-extensions/request-context';
2
2
  export type EffectContext = {
3
3
  request: Request;
4
4
  env: Record<string, unknown>;
@@ -10,6 +10,5 @@ export type EffectContextStorage = {
10
10
  getStore: () => EffectContext | undefined;
11
11
  run: <TResult>(value: EffectContext, cb: () => TResult) => TResult;
12
12
  };
13
- export declare const kEffectContextStorage: unique symbol;
14
13
  export type CreateEffectOperationContextOptions = Omit<EffectContext, 'operationContext'>;
15
14
  export declare const createEffectOperationContext: ({ request, path, method, }: CreateEffectOperationContextOptions) => OperationContext;
@@ -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/create-request';
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
- import { Rpc, RpcClient, RpcGroup, RpcSchema, RpcSerialization } from 'effect/unstable/rpc';
6
+ import { Rpc, RpcClient, RpcClientError, 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;
@@ -27,7 +30,7 @@ export type EffectViewSelection<T> = {
27
30
  export type EffectViewData<T, Selection> = Selection extends true ? T : Selection extends Record<string, unknown> ? {
28
31
  [K in keyof Selection & keyof T]: EffectMaskedValue<T[K], Selection[K]>;
29
32
  } : T;
30
- export type EffectRpcSerialization = 'json' | 'ndjson' | 'jsonRpc' | 'ndJsonRpc' | 'msgPack';
33
+ export type EffectRpcSerialization = 'json' | 'ndjson' | 'jsonRpc' | 'ndJsonRpc';
31
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 & {
32
35
  readonly _tag: "EffectRpcClientError";
33
36
  } & Readonly<A>;
@@ -47,7 +50,7 @@ export type EffectRpcClientOptions<Rpcs extends Rpc.Any, Flatten extends boolean
47
50
  flatten?: Flatten;
48
51
  serialization?: EffectRpcSerialization;
49
52
  };
50
- export type EffectRpcClientHandle<Rpcs extends Rpc.Any, Flatten extends boolean = false> = (Flatten extends true ? RpcClient.RpcClient.Flat<Rpcs, unknown> : RpcClient.RpcClient<Rpcs, unknown>) & {
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>) & {
51
54
  dispose: () => Promise<void>;
52
55
  };
53
56
  export declare function view<T>(): <const Selection extends EffectViewSelection<T>>(selection: Selection) => Selection;
@@ -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-server", "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-server", "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-server" | "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-server" | "generated-client" | "server" | "unknown";
64
+ 'modernjs.trace.id': string;
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.2",
21
+ "version": "3.9.0-ultramodern.21",
22
22
  "files": [
23
23
  "dist",
24
24
  "src"
@@ -35,55 +35,50 @@
35
35
  "./package.json": "./package.json",
36
36
  ".": {
37
37
  "types": "./dist/types/index.d.ts",
38
- "node": {
39
- "import": "./dist/esm-node/index.mjs",
40
- "require": "./dist/cjs/index.js"
41
- },
38
+ "node": "./dist/esm-node/index.mjs",
39
+ "import": "./dist/esm/index.mjs",
42
40
  "default": "./dist/cjs/index.js"
43
41
  },
44
42
  "./effect": {
45
43
  "types": "./dist/types/effect/index.d.ts",
46
- "node": {
47
- "import": "./dist/esm-node/effect/index.mjs",
48
- "require": "./dist/cjs/effect/index.js"
49
- },
44
+ "node": "./dist/esm-node/effect/index.mjs",
45
+ "import": "./dist/esm/effect/index.mjs",
50
46
  "default": "./dist/cjs/effect/index.js"
51
47
  },
48
+ "./context": {
49
+ "types": "./dist/types/effect/context.d.ts",
50
+ "node": "./dist/esm-node/effect/context.mjs",
51
+ "import": "./dist/esm/effect/context.mjs",
52
+ "default": "./dist/cjs/effect/context.js"
53
+ },
52
54
  "./effect-edge": {
53
55
  "types": "./dist/types/effect/edge.d.ts",
54
- "node": {
55
- "import": "./dist/esm-node/effect/edge.mjs",
56
- "require": "./dist/cjs/effect/edge.js"
57
- },
56
+ "node": "./dist/esm-node/effect/edge.mjs",
58
57
  "import": "./dist/esm/effect/edge.mjs",
59
58
  "default": "./dist/esm/effect/edge.mjs"
60
59
  },
61
60
  "./effect-client": {
62
61
  "types": "./dist/types/effect-client/index.d.ts",
63
- "node": {
64
- "import": "./dist/esm-node/effect-client/index.mjs",
65
- "require": "./dist/cjs/effect-client/index.js"
66
- },
62
+ "node": "./dist/esm-node/effect-client/index.mjs",
67
63
  "import": "./dist/esm/effect-client/index.mjs",
68
64
  "default": "./dist/esm/effect-client/index.mjs"
69
65
  },
70
- "./effect-client-runtime": {
71
- "types": "./dist/types/effect-client/runtime.d.ts",
72
- "node": {
73
- "import": "./dist/esm-node/effect-client/runtime.mjs",
74
- "require": "./dist/cjs/effect-client/runtime.js"
75
- },
76
- "import": "./dist/esm/effect-client/runtime.mjs",
77
- "default": "./dist/esm/effect-client/runtime.mjs"
66
+ "./microvertical-api": {
67
+ "types": "./dist/types/microvertical-api.d.ts",
68
+ "node": "./dist/esm-node/microvertical-api.mjs",
69
+ "import": "./dist/esm/microvertical-api.mjs",
70
+ "default": "./dist/esm/microvertical-api.mjs"
78
71
  },
79
72
  "./data-platform": {
80
73
  "types": "./dist/types/data-platform/index.d.ts",
81
- "node": {
82
- "import": "./dist/esm-node/data-platform/index.mjs",
83
- "require": "./dist/cjs/data-platform/index.js"
84
- },
74
+ "node": "./dist/esm-node/data-platform/index.mjs",
85
75
  "import": "./dist/esm/data-platform/index.mjs",
86
76
  "default": "./dist/esm/data-platform/index.mjs"
77
+ },
78
+ "./assembly": {
79
+ "types": "./dist/types/assembly.d.ts",
80
+ "node": "./dist/esm-node/assembly.mjs",
81
+ "default": "./dist/esm/assembly.mjs"
87
82
  }
88
83
  },
89
84
  "typesVersions": {
@@ -96,6 +91,10 @@
96
91
  "./dist/types/effect/index.d.ts",
97
92
  "./src/effect/index.ts"
98
93
  ],
94
+ "context": [
95
+ "./dist/types/effect/context.d.ts",
96
+ "./src/effect/context.ts"
97
+ ],
99
98
  "effect-edge": [
100
99
  "./dist/types/effect/edge.d.ts",
101
100
  "./src/effect/edge.ts"
@@ -104,13 +103,17 @@
104
103
  "./dist/types/effect-client/index.d.ts",
105
104
  "./src/effect-client/index.ts"
106
105
  ],
107
- "effect-client-runtime": [
108
- "./dist/types/effect-client/runtime.d.ts",
109
- "./src/effect-client/runtime.ts"
106
+ "microvertical-api": [
107
+ "./dist/types/microvertical-api.d.ts",
108
+ "./src/microvertical-api.ts"
110
109
  ],
111
110
  "data-platform": [
112
111
  "./dist/types/data-platform/index.d.ts",
113
112
  "./src/data-platform/index.ts"
113
+ ],
114
+ "assembly": [
115
+ "./dist/types/assembly.d.ts",
116
+ "./src/assembly.ts"
114
117
  ]
115
118
  }
116
119
  },
@@ -118,9 +121,10 @@
118
121
  "node": ">=26.7.0"
119
122
  },
120
123
  "dependencies": {
121
- "@modern-js/bff-core": "npm:@bleedingdev/modern-js-bff-core@3.9.0-ultramodern.2",
122
- "@modern-js/create-request": "npm:@bleedingdev/modern-js-create-request@3.9.0-ultramodern.2",
123
- "@modern-js/runtime-extensions": "npm:@bleedingdev/modern-js-runtime-extensions@3.9.0-ultramodern.2",
124
+ "@modern-js/bff-core": "npm:@bleedingdev/modern-js-bff-core@3.9.0-ultramodern.21",
125
+ "@modern-js/create-request": "npm:@bleedingdev/modern-js-create-request@3.9.0-ultramodern.21",
126
+ "@modern-js/runtime-extensions": "npm:@bleedingdev/modern-js-runtime-extensions@3.9.0-ultramodern.21",
127
+ "@modern-js/server-runtime-extensions": "npm:@bleedingdev/modern-js-server-runtime-extensions@3.9.0-ultramodern.21",
124
128
  "@opentelemetry/api": "1.9.1",
125
129
  "@opentelemetry/api-logs": "0.222.0",
126
130
  "@opentelemetry/resources": "2.11.0",
@@ -132,8 +136,8 @@
132
136
  "@opentelemetry/semantic-conventions": "1.43.0"
133
137
  },
134
138
  "peerDependencies": {
135
- "@effect/opentelemetry": "4.0.0-rc.112",
136
- "effect": "4.0.0-rc.112"
139
+ "@effect/opentelemetry": "4.0.0-rc.117",
140
+ "effect": "4.0.0-rc.117"
137
141
  },
138
142
  "peerDependenciesMeta": {
139
143
  "@effect/opentelemetry": {
@@ -144,13 +148,14 @@
144
148
  }
145
149
  },
146
150
  "devDependencies": {
147
- "@effect/opentelemetry": "4.0.0-rc.112",
148
- "@rslib/core": "1.0.0",
151
+ "@effect/opentelemetry": "4.0.0-rc.117",
152
+ "@rslib/core": "1.0.2",
149
153
  "@scripts/rstest-config": "2.66.0",
150
- "@types/node": "^26.4.1",
151
- "@types/react": "^19.2.18",
154
+ "@types/node": "^26.6.2",
155
+ "@types/react": "^19.3.0",
152
156
  "@typescript/native-preview": "7.0.0-dev.20260707.2",
153
- "effect": "4.0.0-rc.112"
157
+ "effect": "4.0.0-rc.117",
158
+ "esbuild": "^0.28.2"
154
159
  },
155
160
  "sideEffects": false,
156
161
  "publishConfig": {
@@ -0,0 +1,43 @@
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 { HttpApiBuilder } from 'effect/unstable/httpapi';
5
+ import { defineEffectBff } from './effect/handler/definition';
6
+ import type { EffectRuntimeRequirements } from './effect/handler/types';
7
+
8
+ export interface EffectBffRuntimeAssembly<
9
+ ApiId extends string,
10
+ Groups extends HttpApiGroup.Constraint,
11
+ HandlerRequirements extends EffectRuntimeRequirements,
12
+ TransportRequirements extends EffectRuntimeRequirements = never,
13
+ > {
14
+ readonly api: HttpApi.HttpApi<ApiId, Groups>;
15
+ readonly handlers: Layer.Layer<
16
+ HttpApiGroup.ToService<ApiId, Groups>,
17
+ never,
18
+ HandlerRequirements
19
+ >;
20
+ readonly transport?: Layer.Layer<never, never, TransportRequirements>;
21
+ }
22
+
23
+ export const assembleEffectBffRuntime = <
24
+ ApiId extends string,
25
+ Groups extends HttpApiGroup.Constraint,
26
+ HandlerRequirements extends EffectRuntimeRequirements,
27
+ TransportRequirements extends EffectRuntimeRequirements = never,
28
+ >({
29
+ api,
30
+ handlers,
31
+ transport,
32
+ }: EffectBffRuntimeAssembly<
33
+ ApiId,
34
+ Groups,
35
+ HandlerRequirements,
36
+ TransportRequirements
37
+ >) => {
38
+ const apiLayer = HttpApiBuilder.layer(api).pipe(Layer.provide(handlers));
39
+ const layer =
40
+ transport === undefined ? apiLayer : apiLayer.pipe(Layer.merge(transport));
41
+
42
+ return defineEffectBff({ api, layer });
43
+ };
@@ -0,0 +1,20 @@
1
+ import type { DataBatchTransportOptions } from '../types';
2
+
3
+ /** Wire limits and method eligibility are identical on both sides. */
4
+ export function normalizeBatchLimits(
5
+ options: Pick<
6
+ DataBatchTransportOptions,
7
+ 'maxBatchSize' | 'maxBatchBytes' | 'allowedMethods'
8
+ > = {},
9
+ ) {
10
+ return {
11
+ maxBatchSize: Math.max(1, options.maxBatchSize ?? 16),
12
+ maxBatchBytes: Math.max(1024, options.maxBatchBytes ?? 64 * 1024),
13
+ allowedMethods: new Set(
14
+ (options.allowedMethods !== undefined && options.allowedMethods.length > 0
15
+ ? options.allowedMethods
16
+ : ['GET']
17
+ ).map(method => method.toUpperCase()),
18
+ ),
19
+ };
20
+ }