@bleedingdev/modern-js-bff-core 3.5.0-ultramodern.98 → 3.8.1-ultramodern.1

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.
@@ -1,19 +1,5 @@
1
1
  "use strict";
2
- var __webpack_modules__ = {
3
- zod (module) {
4
- module.exports = require("zod");
5
- }
6
- };
7
- var __webpack_module_cache__ = {};
8
- function __webpack_require__(moduleId) {
9
- var cachedModule = __webpack_module_cache__[moduleId];
10
- if (void 0 !== cachedModule) return cachedModule.exports;
11
- var module = __webpack_module_cache__[moduleId] = {
12
- exports: {}
13
- };
14
- __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
15
- return module.exports;
16
- }
2
+ var __webpack_require__ = {};
17
3
  (()=>{
18
4
  __webpack_require__.d = (exports1, getters, values)=>{
19
5
  var define = (defs, kind)=>{
@@ -40,141 +26,142 @@ function __webpack_require__(moduleId) {
40
26
  };
41
27
  })();
42
28
  var __webpack_exports__ = {};
43
- (()=>{
44
- __webpack_require__.r(__webpack_exports__);
45
- __webpack_require__.d(__webpack_exports__, {
46
- DEFAULT_OPERATION_VERSION: ()=>DEFAULT_OPERATION_VERSION,
47
- buildOperationContractMap: ()=>buildOperationContractMap,
48
- createOperationContractHash: ()=>createOperationContractHash,
49
- createOperationEntries: ()=>createOperationEntries,
50
- createOperationSchemaHash: ()=>createOperationSchemaHash,
51
- deriveOperationVersion: ()=>deriveOperationVersion,
52
- serializeOperationSchemas: ()=>serializeOperationSchemas
53
- });
54
- const external_crypto_namespaceObject = require("crypto");
55
- require("reflect-metadata");
56
- const external_types_js_namespaceObject = require("../types.js");
57
- const DEFAULT_OPERATION_VERSION = 1;
58
- const deriveOperationVersion = (packageVersion)=>{
59
- if ('string' != typeof packageVersion) return DEFAULT_OPERATION_VERSION;
60
- const match = packageVersion.trim().match(/^v?(\d+)\./);
61
- if (!match) return DEFAULT_OPERATION_VERSION;
62
- const major = Number.parseInt(match[1], 10);
63
- return Number.isInteger(major) && major >= 0 ? major : DEFAULT_OPERATION_VERSION;
64
- };
65
- const stableStringify = (value)=>{
66
- if (Array.isArray(value)) return `[${value.map((item)=>stableStringify(item)).join(',')}]`;
67
- if (value && 'object' == typeof value) {
68
- const entries = Object.entries(value).filter(([, entryValue])=>void 0 !== entryValue).sort(([a], [b])=>a.localeCompare(b)).map(([key, entryValue])=>`${JSON.stringify(key)}:${stableStringify(entryValue)}`);
69
- return `{${entries.join(',')}}`;
70
- }
71
- return JSON.stringify(value) ?? 'null';
29
+ __webpack_require__.r(__webpack_exports__);
30
+ __webpack_require__.d(__webpack_exports__, {
31
+ DEFAULT_OPERATION_VERSION: ()=>DEFAULT_OPERATION_VERSION,
32
+ buildOperationContractMap: ()=>buildOperationContractMap,
33
+ createOperationContractHash: ()=>createOperationContractHash,
34
+ createOperationEntries: ()=>createOperationEntries,
35
+ createOperationSchemaHash: ()=>createOperationSchemaHash,
36
+ deriveOperationVersion: ()=>deriveOperationVersion,
37
+ serializeOperationSchemas: ()=>serializeOperationSchemas
38
+ });
39
+ const external_node_module_namespaceObject = require("node:module");
40
+ const external_crypto_namespaceObject = require("crypto");
41
+ require("reflect-metadata");
42
+ const external_types_js_namespaceObject = require("../types.js");
43
+ const DEFAULT_OPERATION_VERSION = 1;
44
+ const deriveOperationVersion = (packageVersion)=>{
45
+ if ('string' != typeof packageVersion) return DEFAULT_OPERATION_VERSION;
46
+ const match = packageVersion.trim().match(/^v?(\d+)\./);
47
+ if (!match) return DEFAULT_OPERATION_VERSION;
48
+ const major = Number.parseInt(match[1], 10);
49
+ return Number.isInteger(major) && major >= 0 ? major : DEFAULT_OPERATION_VERSION;
50
+ };
51
+ const stableStringify = (value)=>{
52
+ if (Array.isArray(value)) return `[${value.map((item)=>stableStringify(item)).join(',')}]`;
53
+ if (value && 'object' == typeof value) {
54
+ const entries = Object.entries(value).filter(([, entryValue])=>void 0 !== entryValue).sort(([a], [b])=>a.localeCompare(b)).map(([key, entryValue])=>`${JSON.stringify(key)}:${stableStringify(entryValue)}`);
55
+ return `{${entries.join(',')}}`;
56
+ }
57
+ return JSON.stringify(value) ?? 'null';
58
+ };
59
+ const sha256 = (text)=>(0, external_crypto_namespaceObject.createHash)('sha256').update(text).digest('hex');
60
+ let cachedZodToJSONSchema;
61
+ const ZOD_SPECIFIER = "zod";
62
+ const resolveZodToJSONSchema = ()=>{
63
+ if (void 0 !== cachedZodToJSONSchema) return cachedZodToJSONSchema;
64
+ try {
65
+ const load = (0, external_node_module_namespaceObject.createRequire)(__filename);
66
+ const zod = load(ZOD_SPECIFIER);
67
+ const candidate = zod?.toJSONSchema ?? zod?.z?.toJSONSchema;
68
+ cachedZodToJSONSchema = 'function' == typeof candidate ? candidate : null;
69
+ } catch {
70
+ cachedZodToJSONSchema = null;
71
+ }
72
+ return cachedZodToJSONSchema;
73
+ };
74
+ const INPUT_SCHEMA_METADATA_KEYS = [
75
+ external_types_js_namespaceObject.HttpMetadata.Data,
76
+ external_types_js_namespaceObject.HttpMetadata.Query,
77
+ external_types_js_namespaceObject.HttpMetadata.Params,
78
+ external_types_js_namespaceObject.HttpMetadata.Headers,
79
+ external_types_js_namespaceObject.HttpMetadata.Files
80
+ ];
81
+ const serializeSchema = (schema)=>{
82
+ const toJSONSchema = resolveZodToJSONSchema();
83
+ if (toJSONSchema) try {
84
+ return toJSONSchema(schema, {
85
+ io: 'input',
86
+ unrepresentable: 'any'
87
+ });
88
+ } catch {}
89
+ return {
90
+ __unserializableSchema: true
72
91
  };
73
- const sha256 = (text)=>(0, external_crypto_namespaceObject.createHash)('sha256').update(text).digest('hex');
74
- let cachedZodToJSONSchema;
75
- const resolveZodToJSONSchema = ()=>{
76
- if (void 0 !== cachedZodToJSONSchema) return cachedZodToJSONSchema;
92
+ };
93
+ const serializeOperationSchemas = (handler)=>{
94
+ if ('function' != typeof handler) return;
95
+ const serialized = {};
96
+ for (const metadataKey of INPUT_SCHEMA_METADATA_KEYS){
97
+ let schema;
77
98
  try {
78
- const zod = __webpack_require__("zod");
79
- const candidate = zod?.toJSONSchema ?? zod?.z?.toJSONSchema;
80
- cachedZodToJSONSchema = 'function' == typeof candidate ? candidate : null;
99
+ schema = Reflect.getMetadata(metadataKey, handler);
81
100
  } catch {
82
- cachedZodToJSONSchema = null;
101
+ schema = void 0;
83
102
  }
84
- return cachedZodToJSONSchema;
85
- };
86
- const INPUT_SCHEMA_METADATA_KEYS = [
87
- external_types_js_namespaceObject.HttpMetadata.Data,
88
- external_types_js_namespaceObject.HttpMetadata.Query,
89
- external_types_js_namespaceObject.HttpMetadata.Params,
90
- external_types_js_namespaceObject.HttpMetadata.Headers,
91
- external_types_js_namespaceObject.HttpMetadata.Files
92
- ];
93
- const serializeSchema = (schema)=>{
94
- const toJSONSchema = resolveZodToJSONSchema();
95
- if (toJSONSchema) try {
96
- return toJSONSchema(schema, {
97
- io: 'input',
98
- unrepresentable: 'any'
99
- });
100
- } catch {}
101
- return {
102
- __unserializableSchema: true
103
+ if (null != schema) serialized[metadataKey] = serializeSchema(schema);
104
+ }
105
+ return Object.keys(serialized).length > 0 ? serialized : void 0;
106
+ };
107
+ const createOperationContractHash = (operation, requestId)=>sha256(stableStringify({
108
+ httpMethod: String(operation.httpMethod || '').toUpperCase(),
109
+ name: operation.name,
110
+ requestId,
111
+ routePath: operation.routePath,
112
+ ...operation.schemas ? {
113
+ schemas: operation.schemas
114
+ } : {}
115
+ }));
116
+ const createOperationEntries = (handlers)=>handlers.map((item)=>({
117
+ name: item.name,
118
+ httpMethod: String(item.httpMethod || '').toUpperCase(),
119
+ routePath: item.routePath
120
+ })).sort((a, b)=>{
121
+ const keyA = `${a.routePath}:${a.httpMethod}:${a.name}`;
122
+ const keyB = `${b.routePath}:${b.httpMethod}:${b.name}`;
123
+ return keyA.localeCompare(keyB);
124
+ });
125
+ const createOperationSchemaHash = (operationEntries, requestId)=>sha256(stableStringify({
126
+ operations: [
127
+ ...operationEntries
128
+ ].map((item)=>({
129
+ hash: item.schemaHash ?? createOperationContractHash({
130
+ name: item.name,
131
+ httpMethod: item.httpMethod,
132
+ routePath: item.routePath
133
+ }, requestId)
134
+ })).sort((a, b)=>a.hash.localeCompare(b.hash)),
135
+ requestId
136
+ }));
137
+ const buildOperationContractMap = ({ handlers, requestId, operationVersion })=>{
138
+ const normalizedRequestId = 'string' == typeof requestId && requestId.trim().length > 0 ? requestId.trim() : 'default';
139
+ const normalizedOperationVersion = 'number' == typeof operationVersion && Number.isInteger(operationVersion) ? operationVersion : DEFAULT_OPERATION_VERSION;
140
+ const contracts = {};
141
+ handlers.forEach((item)=>{
142
+ const httpMethod = String(item.httpMethod || '').toUpperCase();
143
+ const schemaHash = createOperationContractHash({
144
+ name: item.name,
145
+ httpMethod,
146
+ routePath: item.routePath,
147
+ schemas: serializeOperationSchemas(item.handler)
148
+ }, normalizedRequestId);
149
+ const operationId = `${normalizedRequestId}:${item.name}`;
150
+ const contract = {
151
+ requestId: normalizedRequestId,
152
+ operationVersion: normalizedOperationVersion,
153
+ schemaHash,
154
+ method: httpMethod,
155
+ routePath: item.routePath,
156
+ operationId,
157
+ handlerName: item.name,
158
+ filename: item.filename
103
159
  };
104
- };
105
- const serializeOperationSchemas = (handler)=>{
106
- if ('function' != typeof handler) return;
107
- const serialized = {};
108
- for (const metadataKey of INPUT_SCHEMA_METADATA_KEYS){
109
- let schema;
110
- try {
111
- schema = Reflect.getMetadata(metadataKey, handler);
112
- } catch {
113
- schema = void 0;
114
- }
115
- if (null != schema) serialized[metadataKey] = serializeSchema(schema);
116
- }
117
- return Object.keys(serialized).length > 0 ? serialized : void 0;
118
- };
119
- const createOperationContractHash = (operation, requestId)=>sha256(stableStringify({
120
- httpMethod: String(operation.httpMethod || '').toUpperCase(),
121
- name: operation.name,
122
- requestId,
123
- routePath: operation.routePath,
124
- ...operation.schemas ? {
125
- schemas: operation.schemas
126
- } : {}
127
- }));
128
- const createOperationEntries = (handlers)=>handlers.map((item)=>({
129
- name: item.name,
130
- httpMethod: String(item.httpMethod || '').toUpperCase(),
131
- routePath: item.routePath
132
- })).sort((a, b)=>{
133
- const keyA = `${a.routePath}:${a.httpMethod}:${a.name}`;
134
- const keyB = `${b.routePath}:${b.httpMethod}:${b.name}`;
135
- return keyA.localeCompare(keyB);
136
- });
137
- const createOperationSchemaHash = (operationEntries, requestId)=>sha256(stableStringify({
138
- operations: [
139
- ...operationEntries
140
- ].map((item)=>({
141
- hash: item.schemaHash ?? createOperationContractHash({
142
- name: item.name,
143
- httpMethod: item.httpMethod,
144
- routePath: item.routePath
145
- }, requestId)
146
- })).sort((a, b)=>a.hash.localeCompare(b.hash)),
147
- requestId
148
- }));
149
- const buildOperationContractMap = ({ handlers, requestId, operationVersion })=>{
150
- const normalizedRequestId = 'string' == typeof requestId && requestId.trim().length > 0 ? requestId.trim() : 'default';
151
- const normalizedOperationVersion = 'number' == typeof operationVersion && Number.isInteger(operationVersion) ? operationVersion : DEFAULT_OPERATION_VERSION;
152
- const contracts = {};
153
- handlers.forEach((item)=>{
154
- const httpMethod = String(item.httpMethod || '').toUpperCase();
155
- const schemaHash = createOperationContractHash({
156
- name: item.name,
157
- httpMethod,
158
- routePath: item.routePath,
159
- schemas: serializeOperationSchemas(item.handler)
160
- }, normalizedRequestId);
161
- const operationId = `${normalizedRequestId}:${item.name}`;
162
- const contract = {
163
- requestId: normalizedRequestId,
164
- operationVersion: normalizedOperationVersion,
165
- schemaHash,
166
- method: httpMethod,
167
- routePath: item.routePath,
168
- operationId,
169
- handlerName: item.name,
170
- filename: item.filename
171
- };
172
- contracts[`${httpMethod}:${item.routePath}`] = contract;
173
- contracts[`operation:${operationId}`] = contract;
174
- });
175
- return contracts;
176
- };
177
- })();
160
+ contracts[`${httpMethod}:${item.routePath}`] = contract;
161
+ contracts[`operation:${operationId}`] = contract;
162
+ });
163
+ return contracts;
164
+ };
178
165
  exports.DEFAULT_OPERATION_VERSION = __webpack_exports__.DEFAULT_OPERATION_VERSION;
179
166
  exports.buildOperationContractMap = __webpack_exports__.buildOperationContractMap;
180
167
  exports.createOperationContractHash = __webpack_exports__.createOperationContractHash;
@@ -1,13 +1,7 @@
1
+ import { createRequire } from "node:module";
1
2
  import { createHash } from "crypto";
2
3
  import "reflect-metadata";
3
4
  import { HttpMetadata } from "../types.mjs";
4
- import { __webpack_require__ } from "../rslib-runtime.mjs";
5
- import * as __rspack_external_zod from "zod";
6
- __webpack_require__.add({
7
- 7347 (module) {
8
- module.exports = __rspack_external_zod;
9
- }
10
- });
11
5
  const DEFAULT_OPERATION_VERSION = 1;
12
6
  const deriveOperationVersion = (packageVersion)=>{
13
7
  if ('string' != typeof packageVersion) return DEFAULT_OPERATION_VERSION;
@@ -26,10 +20,12 @@ const stableStringify = (value)=>{
26
20
  };
27
21
  const sha256 = (text)=>createHash('sha256').update(text).digest('hex');
28
22
  let cachedZodToJSONSchema;
23
+ const ZOD_SPECIFIER = "zod";
29
24
  const resolveZodToJSONSchema = ()=>{
30
25
  if (void 0 !== cachedZodToJSONSchema) return cachedZodToJSONSchema;
31
26
  try {
32
- const zod = __webpack_require__(7347);
27
+ const load = createRequire('string' == typeof __filename ? __filename : import.meta.url);
28
+ const zod = load(ZOD_SPECIFIER);
33
29
  const candidate = zod?.toJSONSchema ?? zod?.z?.toJSONSchema;
34
30
  cachedZodToJSONSchema = 'function' == typeof candidate ? candidate : null;
35
31
  } catch {
@@ -1,14 +1,10 @@
1
1
  import "node:module";
2
+ import { createRequire } from "node:module";
2
3
  import { createHash } from "crypto";
3
4
  import "reflect-metadata";
4
5
  import { HttpMetadata } from "../types.mjs";
5
- import { __webpack_require__ } from "../rslib-runtime.mjs";
6
- import * as __rspack_external_zod from "zod";
7
- __webpack_require__.add({
8
- zod (module) {
9
- module.exports = __rspack_external_zod;
10
- }
11
- });
6
+ import { fileURLToPath as __rspack_fileURLToPath } from "node:url";
7
+ var __rspack_import_meta_filename__ = __rspack_fileURLToPath(import.meta.url);
12
8
  const DEFAULT_OPERATION_VERSION = 1;
13
9
  const deriveOperationVersion = (packageVersion)=>{
14
10
  if ('string' != typeof packageVersion) return DEFAULT_OPERATION_VERSION;
@@ -27,10 +23,12 @@ const stableStringify = (value)=>{
27
23
  };
28
24
  const sha256 = (text)=>createHash('sha256').update(text).digest('hex');
29
25
  let cachedZodToJSONSchema;
26
+ const ZOD_SPECIFIER = "zod";
30
27
  const resolveZodToJSONSchema = ()=>{
31
28
  if (void 0 !== cachedZodToJSONSchema) return cachedZodToJSONSchema;
32
29
  try {
33
- const zod = __webpack_require__("zod");
30
+ const load = createRequire(__rspack_import_meta_filename__);
31
+ const zod = load(ZOD_SPECIFIER);
34
32
  const candidate = zod?.toJSONSchema ?? zod?.z?.toJSONSchema;
35
33
  cachedZodToJSONSchema = 'function' == typeof candidate ? candidate : null;
36
34
  } catch {
package/package.json CHANGED
@@ -17,7 +17,7 @@
17
17
  "modern",
18
18
  "modern.js"
19
19
  ],
20
- "version": "3.5.0-ultramodern.98",
20
+ "version": "3.8.1-ultramodern.1",
21
21
  "types": "./dist/types/index.d.ts",
22
22
  "main": "./dist/cjs/index.js",
23
23
  "exports": {
@@ -31,20 +31,21 @@
31
31
  }
32
32
  },
33
33
  "dependencies": {
34
- "@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.5.0-ultramodern.98",
34
+ "@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.8.1-ultramodern.1",
35
35
  "@swc/helpers": "^0.5.23",
36
36
  "koa-compose": "^4.1.0",
37
37
  "reflect-metadata": "^0.2.2",
38
38
  "type-fest": "5.8.0"
39
39
  },
40
40
  "devDependencies": {
41
- "@modern-js/bff-runtime": "npm:@bleedingdev/modern-js-bff-runtime@3.5.0-ultramodern.98",
42
- "@modern-js/types": "npm:@bleedingdev/modern-js-types@3.5.0-ultramodern.98",
41
+ "@modern-js/bff-runtime": "npm:@bleedingdev/modern-js-bff-runtime@3.8.1-ultramodern.1",
42
+ "@modern-js/types": "npm:@bleedingdev/modern-js-types@3.8.1-ultramodern.1",
43
43
  "@rslib/core": "0.23.2",
44
44
  "@scripts/rstest-config": "2.66.0",
45
45
  "@types/koa-compose": "^3.2.9",
46
- "@types/node": "^26.1.1",
46
+ "@types/node": "^26.2.0",
47
47
  "@typescript/native-preview": "7.0.0-dev.20260707.2",
48
+ "esbuild": "^0.28.1",
48
49
  "tsconfig-paths": "^4.2.0",
49
50
  "zod": "^4.4.3"
50
51
  },
@@ -1,18 +0,0 @@
1
- var __webpack_modules__ = {};
2
- var __webpack_module_cache__ = {};
3
- function __webpack_require__(moduleId) {
4
- var cachedModule = __webpack_module_cache__[moduleId];
5
- if (void 0 !== cachedModule) return cachedModule.exports;
6
- var module = __webpack_module_cache__[moduleId] = {
7
- exports: {}
8
- };
9
- __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
10
- return module.exports;
11
- }
12
- __webpack_require__.m = __webpack_modules__;
13
- (()=>{
14
- __webpack_require__.add = function(modules) {
15
- Object.assign(__webpack_require__.m, modules);
16
- };
17
- })();
18
- export { __webpack_require__ };
@@ -1,19 +0,0 @@
1
- import "node:module";
2
- var __webpack_modules__ = {};
3
- var __webpack_module_cache__ = {};
4
- function __webpack_require__(moduleId) {
5
- var cachedModule = __webpack_module_cache__[moduleId];
6
- if (void 0 !== cachedModule) return cachedModule.exports;
7
- var module = __webpack_module_cache__[moduleId] = {
8
- exports: {}
9
- };
10
- __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
11
- return module.exports;
12
- }
13
- __webpack_require__.m = __webpack_modules__;
14
- (()=>{
15
- __webpack_require__.add = function(modules) {
16
- Object.assign(__webpack_require__.m, modules);
17
- };
18
- })();
19
- export { __webpack_require__ };