@bleedingdev/modern-js-bff-effect 3.9.0-ultramodern.11 → 3.9.0-ultramodern.13

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 (51) hide show
  1. package/dist/cjs/data-platform/batch/options.js +48 -0
  2. package/dist/cjs/data-platform/batch/queue.js +48 -83
  3. package/dist/cjs/effect/entry-shape.js +4 -1
  4. package/dist/cjs/effect/handler/batch-handler.js +2 -3
  5. package/dist/cjs/effect/handler/batch.js +0 -9
  6. package/dist/cjs/effect/module.js +4 -0
  7. package/dist/cjs/effect/operation-context.js +1 -1
  8. package/dist/cjs/effect/rpcSerialization.js +0 -2
  9. package/dist/cjs/effect-client/cross-project.js +5 -8
  10. package/dist/cjs/microvertical-api.js +1 -1
  11. package/dist/esm/data-platform/batch/options.mjs +10 -0
  12. package/dist/esm/data-platform/batch/queue.mjs +48 -83
  13. package/dist/esm/effect/entry-shape-registry.mjs +2 -2
  14. package/dist/esm/effect/handler/batch-handler.mjs +3 -4
  15. package/dist/esm/effect/handler/batch.mjs +1 -7
  16. package/dist/esm/effect/module.mjs +4 -0
  17. package/dist/esm/effect/operation-context.mjs +1 -1
  18. package/dist/esm/effect/rpcSerialization.mjs +0 -2
  19. package/dist/esm/effect-client/cross-project.mjs +6 -9
  20. package/dist/esm/microvertical-api.mjs +1 -1
  21. package/dist/esm-node/data-platform/batch/options.mjs +11 -0
  22. package/dist/esm-node/data-platform/batch/queue.mjs +48 -83
  23. package/dist/esm-node/effect/entry-shape.mjs +4 -1
  24. package/dist/esm-node/effect/handler/batch-handler.mjs +3 -4
  25. package/dist/esm-node/effect/handler/batch.mjs +1 -7
  26. package/dist/esm-node/effect/module.mjs +4 -0
  27. package/dist/esm-node/effect/operation-context.mjs +1 -1
  28. package/dist/esm-node/effect/rpcSerialization.mjs +0 -2
  29. package/dist/esm-node/effect-client/cross-project.mjs +6 -9
  30. package/dist/esm-node/microvertical-api.mjs +1 -1
  31. package/dist/types/data-platform/batch/options.d.ts +7 -0
  32. package/dist/types/data-platform/batch/queue.d.ts +0 -1
  33. package/dist/types/effect/entry-shape.d.ts +2 -0
  34. package/dist/types/effect/handler/batch.d.ts +0 -1
  35. package/dist/types/effect/handler/types.d.ts +1 -1
  36. package/dist/types/effect/module.d.ts +2 -1
  37. package/dist/types/effect-client/index.d.ts +3 -3
  38. package/dist/types/microvertical-api.d.ts +4 -4
  39. package/package.json +12 -12
  40. package/src/data-platform/batch/options.ts +20 -0
  41. package/src/data-platform/batch/queue.ts +61 -89
  42. package/src/effect/entry-shape.ts +12 -0
  43. package/src/effect/handler/batch-handler.ts +6 -12
  44. package/src/effect/handler/batch.ts +0 -10
  45. package/src/effect/handler/types.ts +1 -2
  46. package/src/effect/module.ts +7 -0
  47. package/src/effect/operation-context.ts +1 -1
  48. package/src/effect/rpcSerialization.ts +0 -2
  49. package/src/effect-client/cross-project.ts +9 -14
  50. package/src/effect-client/index.ts +4 -4
  51. package/src/microvertical-api.ts +1 -1
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, getters, values)=>{
5
+ var define = (defs, kind)=>{
6
+ for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
7
+ enumerable: true,
8
+ [kind]: defs[key]
9
+ });
10
+ };
11
+ define(getters, "get");
12
+ define(values, "value");
13
+ };
14
+ })();
15
+ (()=>{
16
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
17
+ })();
18
+ (()=>{
19
+ __webpack_require__.r = (exports1)=>{
20
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
21
+ value: 'Module'
22
+ });
23
+ Object.defineProperty(exports1, '__esModule', {
24
+ value: true
25
+ });
26
+ };
27
+ })();
28
+ var __webpack_exports__ = {};
29
+ __webpack_require__.r(__webpack_exports__);
30
+ function normalizeBatchLimits(options = {}) {
31
+ return {
32
+ maxBatchSize: Math.max(1, options.maxBatchSize ?? 16),
33
+ maxBatchBytes: Math.max(1024, options.maxBatchBytes ?? 65536),
34
+ allowedMethods: new Set((void 0 !== options.allowedMethods && options.allowedMethods.length > 0 ? options.allowedMethods : [
35
+ 'GET'
36
+ ]).map((method)=>method.toUpperCase()))
37
+ };
38
+ }
39
+ __webpack_require__.d(__webpack_exports__, {
40
+ normalizeBatchLimits: ()=>normalizeBatchLimits
41
+ });
42
+ exports.normalizeBatchLimits = __webpack_exports__.normalizeBatchLimits;
43
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
44
+ "normalizeBatchLimits"
45
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
46
+ Object.defineProperty(exports, '__esModule', {
47
+ value: true
48
+ });
@@ -33,6 +33,7 @@ __webpack_require__.d(__webpack_exports__, {
33
33
  });
34
34
  const external_codec_js_namespaceObject = require("../codec.js");
35
35
  const external_types_js_namespaceObject = require("../types.js");
36
+ const external_options_js_namespaceObject = require("./options.js");
36
37
  const external_protocol_js_namespaceObject = require("./protocol.js");
37
38
  const external_request_js_namespaceObject = require("./request.js");
38
39
  const external_response_js_namespaceObject = require("./response.js");
@@ -111,7 +112,6 @@ class BatchBucketRegistry {
111
112
  if (existing) return existing;
112
113
  const next = {
113
114
  items: [],
114
- bytes: 0,
115
115
  batchId: (0, external_request_js_namespaceObject.createBatchId)(),
116
116
  sentAt: Date.now(),
117
117
  timer: null,
@@ -130,12 +130,8 @@ class BatchBucketRegistry {
130
130
  }
131
131
  function createBatchTransportQueue({ options, baseFetch, bucketRegistry }) {
132
132
  const flushIntervalMs = Math.max(0, options.flushIntervalMs ?? 8);
133
- const maxBatchSize = Math.max(1, options.maxBatchSize ?? 16);
134
- const maxBatchBytes = Math.max(1024, options.maxBatchBytes ?? 65536);
133
+ const { maxBatchSize, maxBatchBytes, allowedMethods } = (0, external_options_js_namespaceObject.normalizeBatchLimits)(options);
135
134
  const requestTimeoutMs = options.requestTimeoutMs;
136
- const allowedMethods = new Set((options.allowedMethods && options.allowedMethods.length > 0 ? options.allowedMethods : [
137
- 'GET'
138
- ]).map((method)=>method.toUpperCase()));
139
135
  const onEvent = options.onEvent;
140
136
  const buckets = bucketRegistry ?? new BatchBucketRegistry();
141
137
  const pendingByKey = new Map();
@@ -168,7 +164,6 @@ function createBatchTransportQueue({ options, baseFetch, bucketRegistry }) {
168
164
  const index = bucket.items.indexOf(request);
169
165
  if (-1 === index) return;
170
166
  bucket.items.splice(index, 1);
171
- bucket.bytes = measurePayload(bucket, bucket.items);
172
167
  if (0 === bucket.items.length && bucket.timer) {
173
168
  clearTimeout(bucket.timer);
174
169
  bucket.timer = null;
@@ -210,7 +205,11 @@ function createBatchTransportQueue({ options, baseFetch, bucketRegistry }) {
210
205
  if (!SAFE_REPLAY_METHODS.has(request.item.method)) throw new Error(`Batch result is unknown for ${request.item.method}; automatic replay is disabled (${reason}).`);
211
206
  return runSingle(request);
212
207
  };
213
- const settleAmbiguousBatchRequests = (items, reason)=>settleRequests(items, (request)=>runAfterAmbiguousBatch(request, reason));
208
+ const finishFlush = (bucketKey, bucket)=>{
209
+ bucket.flushing = false;
210
+ if (bucket.items.length > 0 && !bucket.timer) flushBucket(bucketKey);
211
+ buckets.releaseIfIdle(bucketKey, bucket);
212
+ };
214
213
  const flushBucket = async (bucketKey)=>{
215
214
  const bucket = buckets.get(bucketKey);
216
215
  if (!bucket || bucket.flushing) return;
@@ -227,7 +226,6 @@ function createBatchTransportQueue({ options, baseFetch, bucketRegistry }) {
227
226
  sentAt: bucket.sentAt
228
227
  };
229
228
  bucket.items = [];
230
- bucket.bytes = 0;
231
229
  rotatePayloadIdentity(bucket);
232
230
  const firstItem = items[0];
233
231
  if (!firstItem) {
@@ -243,14 +241,25 @@ function createBatchTransportQueue({ options, baseFetch, bucketRegistry }) {
243
241
  size: items.length,
244
242
  reason: disabledEndpoints.has(endpoint) ? 'batch-disabled' : void 0
245
243
  });
246
- await settleRequests(items, runSingle);
247
- bucket.flushing = false;
248
- if (bucket.items.length > 0 && !bucket.timer) flushBucket(bucketKey);
249
- buckets.releaseIfIdle(bucketKey, bucket);
244
+ try {
245
+ await settleRequests(items, runSingle);
246
+ } finally{
247
+ finishFlush(bucketKey, bucket);
248
+ }
250
249
  return;
251
250
  }
252
251
  const payload = createPayload(payloadIdentity, items);
253
252
  const batchId = payload.batchId;
253
+ const settleAmbiguousBatchRequests = (reason)=>{
254
+ (0, external_telemetry_js_namespaceObject.emitDataBatchTransportEvent)(onEvent, {
255
+ type: 'fallback',
256
+ endpoint,
257
+ batchId,
258
+ size: items.length,
259
+ reason
260
+ });
261
+ return settleRequests(items, (request)=>runAfterAmbiguousBatch(request, reason));
262
+ };
254
263
  (0, external_telemetry_js_namespaceObject.emitDataBatchTransportEvent)(onEvent, {
255
264
  type: 'flush',
256
265
  endpoint,
@@ -301,42 +310,13 @@ function createBatchTransportQueue({ options, baseFetch, bucketRegistry }) {
301
310
  batchId,
302
311
  reason: `batch-endpoint-unavailable-${String(response.status)}`
303
312
  });
304
- } else (0, external_telemetry_js_namespaceObject.emitDataBatchTransportEvent)(onEvent, {
305
- type: 'fallback',
306
- endpoint,
307
- batchId,
308
- size: items.length,
309
- reason: `batch-response-${String(response.status)}`
310
- });
311
- await settleAmbiguousBatchRequests(items, `batch-response-${String(response.status)}`);
312
- bucket.flushing = false;
313
+ await settleRequests(items, (request)=>runAfterAmbiguousBatch(request, `batch-response-${String(response.status)}`));
314
+ } else await settleAmbiguousBatchRequests(`batch-response-${String(response.status)}`);
313
315
  return;
314
316
  }
315
317
  const result = await runWithSignal(controller.signal, async ()=>response.json());
316
- if (!(0, external_response_js_namespaceObject.isBatchResponsePayload)(result)) {
317
- (0, external_telemetry_js_namespaceObject.emitDataBatchTransportEvent)(onEvent, {
318
- type: 'fallback',
319
- endpoint,
320
- batchId,
321
- size: items.length,
322
- reason: 'invalid-batch-response'
323
- });
324
- await settleAmbiguousBatchRequests(items, 'invalid-batch-response');
325
- bucket.flushing = false;
326
- return;
327
- }
328
- if (result.batchId !== batchId) {
329
- (0, external_telemetry_js_namespaceObject.emitDataBatchTransportEvent)(onEvent, {
330
- type: 'fallback',
331
- endpoint,
332
- batchId,
333
- size: items.length,
334
- reason: 'mismatched-batch-id'
335
- });
336
- await settleAmbiguousBatchRequests(items, 'mismatched-batch-id');
337
- bucket.flushing = false;
338
- return;
339
- }
318
+ if (!(0, external_response_js_namespaceObject.isBatchResponsePayload)(result)) return void await settleAmbiguousBatchRequests('invalid-batch-response');
319
+ if (result.batchId !== batchId) return void await settleAmbiguousBatchRequests('mismatched-batch-id');
340
320
  const itemMap = new Map();
341
321
  for (const item of result.items)itemMap.set(item.id, item);
342
322
  await settleRequests(items, async (request)=>{
@@ -360,19 +340,10 @@ function createBatchTransportQueue({ options, baseFetch, bucketRegistry }) {
360
340
  });
361
341
  return;
362
342
  }
363
- (0, external_telemetry_js_namespaceObject.emitDataBatchTransportEvent)(onEvent, {
364
- type: 'fallback',
365
- endpoint,
366
- batchId,
367
- size: items.length,
368
- reason: 'batch-transport-error'
369
- });
370
- await settleAmbiguousBatchRequests(items, 'batch-transport-error');
343
+ await settleAmbiguousBatchRequests('batch-transport-error');
371
344
  } finally{
372
345
  for (const item of items)item.abortBatchIfUnused = void 0;
373
- bucket.flushing = false;
374
- if (bucket.items.length > 0 && !bucket.timer) flushBucket(bucketKey);
375
- buckets.releaseIfIdle(bucketKey, bucket);
346
+ finishFlush(bucketKey, bucket);
376
347
  }
377
348
  };
378
349
  const pendingReadPromises = new Map();
@@ -396,7 +367,20 @@ function createBatchTransportQueue({ options, baseFetch, bucketRegistry }) {
396
367
  const sourceSignal = initDefinesSignal ? initSignal ?? void 0 : sourceRequest?.signal;
397
368
  const requestUrl = (0, external_url_js_namespaceObject.toAbsoluteUrl)(input);
398
369
  const endpoint = (0, external_url_js_namespaceObject.normalizeBatchEndpoint)(requestUrl, options.endpoint).toString();
370
+ const itemHeaders = {
371
+ ...headers
372
+ };
373
+ delete itemHeaders.authorization;
374
+ delete itemHeaders.cookie;
399
375
  return {
376
+ itemHeaders,
377
+ itemPath: `${requestUrl.pathname}${requestUrl.search}`,
378
+ bucketKey: (0, external_codec_js_namespaceObject.stableStringify)({
379
+ endpoint,
380
+ authorization: headers.authorization ?? null,
381
+ cookie: headers.cookie ?? null,
382
+ credentials
383
+ }),
400
384
  requestUrl,
401
385
  endpoint,
402
386
  method,
@@ -429,22 +413,11 @@ function createBatchTransportQueue({ options, baseFetch, bucketRegistry }) {
429
413
  batchEndpoint: request.endpoint,
430
414
  requestUrl: request.requestUrl
431
415
  })) return;
432
- const itemHeaders = {
433
- ...request.headers
434
- };
435
- delete itemHeaders.authorization;
436
- delete itemHeaders.cookie;
437
- const bucketKey = (0, external_codec_js_namespaceObject.stableStringify)({
438
- endpoint: request.endpoint,
439
- authorization: request.headers.authorization ?? null,
440
- cookie: request.headers.cookie ?? null,
441
- credentials: request.credentials
442
- });
443
416
  return (0, external_codec_js_namespaceObject.stableStringify)({
444
- bucketKey,
445
- path: `${request.requestUrl.pathname}${request.requestUrl.search}`,
417
+ bucketKey: request.bucketKey,
418
+ path: request.itemPath,
446
419
  method: request.method,
447
- headers: itemHeaders,
420
+ headers: request.itemHeaders,
448
421
  body: null
449
422
  });
450
423
  };
@@ -462,26 +435,19 @@ function createBatchTransportQueue({ options, baseFetch, bucketRegistry }) {
462
435
  const itemId = `${Date.now().toString(36)}_${nextItemId.toString(36)}_${Math.random().toString(16).slice(2, 8)}`;
463
436
  nextItemId += 1;
464
437
  const itemHeaders = {
465
- ...request.headers
438
+ ...request.itemHeaders
466
439
  };
467
- delete itemHeaders.authorization;
468
- delete itemHeaders.cookie;
469
440
  if (preparedBody.body && preparedBody.inferredContentType && !itemHeaders['content-type']) itemHeaders['content-type'] = preparedBody.inferredContentType;
470
441
  const item = {
471
442
  id: itemId,
472
- path: `${request.requestUrl.pathname}${request.requestUrl.search}`,
443
+ path: request.itemPath,
473
444
  method: request.method,
474
445
  headers: itemHeaders,
475
446
  ...preparedBody.body ? {
476
447
  body: preparedBody.body
477
448
  } : {}
478
449
  };
479
- const bucketKey = (0, external_codec_js_namespaceObject.stableStringify)({
480
- endpoint: request.endpoint,
481
- authorization: request.headers.authorization ?? null,
482
- cookie: request.headers.cookie ?? null,
483
- credentials: request.credentials
484
- });
450
+ const { bucketKey } = request;
485
451
  const key = (0, external_codec_js_namespaceObject.stableStringify)({
486
452
  bucketKey,
487
453
  path: item.path,
@@ -575,13 +541,12 @@ function createBatchTransportQueue({ options, baseFetch, bucketRegistry }) {
575
541
  }
576
542
  }
577
543
  bucket.items.push(queued);
578
- bucket.bytes = measurePayload(bucket, bucket.items);
579
544
  (0, external_telemetry_js_namespaceObject.emitDataBatchTransportEvent)(onEvent, {
580
545
  type: 'enqueue',
581
546
  endpoint: request.endpoint,
582
547
  size: bucket.items.length
583
548
  });
584
- if (bucket.items.length >= maxBatchSize || bucket.bytes >= maxBatchBytes) {
549
+ if (bucket.items.length >= maxBatchSize || measurePayload(bucket, bucket.items) >= maxBatchBytes) {
585
550
  flushBucket(bucketKey);
586
551
  return queued.promise;
587
552
  }
@@ -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:')) return createLocalValidatorAwareHandlerFactoryRegistry();
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");
@@ -32,6 +32,7 @@ __webpack_require__.d(__webpack_exports__, {
32
32
  });
33
33
  const Effect_namespaceObject = require("effect/Effect");
34
34
  const index_js_namespaceObject = require("../../data-platform/index.js");
35
+ const options_js_namespaceObject = require("../../data-platform/batch/options.js");
35
36
  const protocol_js_namespaceObject = require("../../data-platform/batch/protocol.js");
36
37
  const external_batch_js_namespaceObject = require("./batch.js");
37
38
  const external_routing_js_namespaceObject = require("./routing.js");
@@ -123,11 +124,9 @@ function createDataPlatformBatchRequestHandler(options) {
123
124
  const dataPlatformBatchOptions = options.dataPlatform?.batch;
124
125
  const batchEnabled = dataPlatformBatchOptions?.enabled !== false;
125
126
  const batchPath = (0, external_batch_js_namespaceObject.normalizeBatchPath)(dataPlatformBatchOptions?.endpoint);
126
- const batchMaxSize = Math.max(1, dataPlatformBatchOptions?.maxBatchSize ?? 16);
127
- const batchMaxBytes = Math.max(1024, dataPlatformBatchOptions?.maxBatchBytes ?? 65536);
127
+ const { maxBatchSize: batchMaxSize, maxBatchBytes: batchMaxBytes, allowedMethods: batchAllowedMethods } = (0, options_js_namespaceObject.normalizeBatchLimits)(dataPlatformBatchOptions);
128
128
  const batchConcurrency = Math.max(1, dataPlatformBatchOptions?.maxConcurrency ?? 4);
129
129
  const batchItemTimeoutMs = Math.max(0, dataPlatformBatchOptions?.requestTimeoutMs ?? 10000);
130
- const batchAllowedMethods = (0, external_batch_js_namespaceObject.normalizeBatchAllowedMethods)(dataPlatformBatchOptions?.allowedMethods);
131
130
  const envelopeHeader = options.dataPlatform?.envelopeHeader || index_js_namespaceObject.DEFAULT_DATA_ENVELOPE_HEADER;
132
131
  const normalizedEnvelopeHeader = envelopeHeader.toLowerCase();
133
132
  const handle = async (request, context)=>{
@@ -32,7 +32,6 @@ __webpack_require__.d(__webpack_exports__, {
32
32
  createBatchValidationResponse: ()=>createBatchValidationResponse,
33
33
  isBatchRequestPayload: ()=>isBatchRequestPayload,
34
34
  mapWithConcurrency: ()=>mapWithConcurrency,
35
- normalizeBatchAllowedMethods: ()=>normalizeBatchAllowedMethods,
36
35
  normalizeBatchPath: ()=>normalizeBatchPath,
37
36
  prepareJsonRequestBody: ()=>prepareJsonRequestBody,
38
37
  promiseWithTimeout: ()=>promiseWithTimeout,
@@ -48,12 +47,6 @@ function normalizeBatchPath(pathname) {
48
47
  if (!pathname.startsWith('/')) return `/${pathname}`;
49
48
  return pathname;
50
49
  }
51
- function normalizeBatchAllowedMethods(allowedMethods) {
52
- const source = Array.isArray(allowedMethods) && allowedMethods.length > 0 ? allowedMethods : [
53
- 'GET'
54
- ];
55
- return new Set(source.map((method)=>method.toUpperCase()));
56
- }
57
50
  function isBatchRequestPayload(value) {
58
51
  return (0, index_js_namespaceObject.isPlainObject)(value) && 2 === value.protocolVersion && 'string' == typeof value.batchId && 'number' == typeof value.sentAt && Array.isArray(value.items);
59
52
  }
@@ -154,7 +147,6 @@ exports.BatchItemTimeoutError = __webpack_exports__.BatchItemTimeoutError;
154
147
  exports.createBatchValidationResponse = __webpack_exports__.createBatchValidationResponse;
155
148
  exports.isBatchRequestPayload = __webpack_exports__.isBatchRequestPayload;
156
149
  exports.mapWithConcurrency = __webpack_exports__.mapWithConcurrency;
157
- exports.normalizeBatchAllowedMethods = __webpack_exports__.normalizeBatchAllowedMethods;
158
150
  exports.normalizeBatchPath = __webpack_exports__.normalizeBatchPath;
159
151
  exports.prepareJsonRequestBody = __webpack_exports__.prepareJsonRequestBody;
160
152
  exports.promiseWithTimeout = __webpack_exports__.promiseWithTimeout;
@@ -165,7 +157,6 @@ for(var __rspack_i in __webpack_exports__)if (-1 === [
165
157
  "createBatchValidationResponse",
166
158
  "isBatchRequestPayload",
167
159
  "mapWithConcurrency",
168
- "normalizeBatchAllowedMethods",
169
160
  "normalizeBatchPath",
170
161
  "prepareJsonRequestBody",
171
162
  "promiseWithTimeout",
@@ -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-adapter',
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
  }
@@ -62,14 +62,11 @@ function withCrossProjectPolicy(api, options, client) {
62
62
  const contract = observed && contracts[`${observed.method}:${observed.routePath}`];
63
63
  if (void 0 === contract) return Effect_namespaceObject.die(new Error('[BFF][Effect] Request has no matching shared operation contract.'));
64
64
  return Effect_namespaceObject.gen(function*() {
65
- const input = encodeJson({
66
- httpMethod: contract.method,
67
- name: contract.name,
68
- requestId: options.requestId,
69
- routePath: contract.routePath
70
- });
71
- const digest = yield* Effect_namespaceObject.promise(()=>globalThis.crypto.subtle.digest('SHA-256', new TextEncoder().encode(input)));
72
- const schemaHash = Array.from(new Uint8Array(digest), (value)=>value.toString(16).padStart(2, '0')).join('');
65
+ const schemaHash = yield* Effect_namespaceObject.promise(()=>(0, bff_policy_namespaceObject.digestOperationContract)({
66
+ httpMethod: contract.method,
67
+ name: contract.name,
68
+ routePath: contract.routePath
69
+ }, options.requestId));
73
70
  return request.pipe(http_namespaceObject.HttpClientRequest.setHeader(bff_policy_namespaceObject.BFF_ENVELOPE_HEADER, encodeJson({
74
71
  requestId: options.requestId
75
72
  })), http_namespaceObject.HttpClientRequest.setHeader(bff_policy_namespaceObject.BFF_OPERATION_CONTEXT_HEADER, contract.operationId), http_namespaceObject.HttpClientRequest.setHeader(bff_policy_namespaceObject.BFF_OPERATION_CONTEXT_DETAIL_HEADER, encodeJson({
@@ -66,7 +66,7 @@ const MicroVerticalOperationSourceSchema = external_effect_namespaceObject.Schem
66
66
  'client',
67
67
  'server',
68
68
  'generated-client',
69
- 'effect-adapter',
69
+ 'effect-server',
70
70
  'data-platform',
71
71
  'unknown'
72
72
  ]);
@@ -0,0 +1,10 @@
1
+ function normalizeBatchLimits(options = {}) {
2
+ return {
3
+ maxBatchSize: Math.max(1, options.maxBatchSize ?? 16),
4
+ maxBatchBytes: Math.max(1024, options.maxBatchBytes ?? 65536),
5
+ allowedMethods: new Set((void 0 !== options.allowedMethods && options.allowedMethods.length > 0 ? options.allowedMethods : [
6
+ 'GET'
7
+ ]).map((method)=>method.toUpperCase()))
8
+ };
9
+ }
10
+ export { normalizeBatchLimits };