@bleedingdev/modern-js-bff-core 3.9.0-ultramodern.2 → 3.9.0-ultramodern.20

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 (60) hide show
  1. package/dist/cjs/client/generateClient.js +67 -138
  2. package/dist/cjs/index.js +24 -114
  3. package/dist/cjs/router/index.js +7 -5
  4. package/dist/cjs/utils/index.js +11 -21
  5. package/dist/esm/client/generateClient.mjs +65 -139
  6. package/dist/esm/index.mjs +1 -5
  7. package/dist/esm/router/index.mjs +7 -5
  8. package/dist/esm/utils/index.mjs +0 -1
  9. package/dist/esm-node/client/generateClient.mjs +65 -139
  10. package/dist/esm-node/index.mjs +1 -5
  11. package/dist/esm-node/router/index.mjs +7 -5
  12. package/dist/esm-node/utils/index.mjs +0 -1
  13. package/dist/types/client/generateClient.d.ts +24 -1
  14. package/dist/types/index.d.ts +1 -5
  15. package/dist/types/utils/index.d.ts +0 -1
  16. package/package.json +10 -19
  17. package/dist/cjs/adapter-kit/index.js +0 -144
  18. package/dist/cjs/adapter-kit/parity-scenarios/cross-project-denial.js +0 -55
  19. package/dist/cjs/adapter-kit/parity-scenarios/envelope.js +0 -128
  20. package/dist/cjs/adapter-kit/parity-scenarios/operation-context.js +0 -152
  21. package/dist/cjs/adapter-kit/parity-scenarios/schema.js +0 -109
  22. package/dist/cjs/adapter-kit/parity-scenarios/shared.js +0 -71
  23. package/dist/cjs/adapter-kit/parity.js +0 -204
  24. package/dist/cjs/security/crossProjectPolicy.js +0 -309
  25. package/dist/cjs/security/operationContracts.js +0 -183
  26. package/dist/cjs/security/resolveCrossProjectPolicy.js +0 -65
  27. package/dist/cjs/utils/alias.js +0 -112
  28. package/dist/esm/adapter-kit/index.mjs +0 -79
  29. package/dist/esm/adapter-kit/parity-scenarios/cross-project-denial.mjs +0 -17
  30. package/dist/esm/adapter-kit/parity-scenarios/envelope.mjs +0 -90
  31. package/dist/esm/adapter-kit/parity-scenarios/operation-context.mjs +0 -111
  32. package/dist/esm/adapter-kit/parity-scenarios/schema.mjs +0 -71
  33. package/dist/esm/adapter-kit/parity-scenarios/shared.mjs +0 -21
  34. package/dist/esm/adapter-kit/parity.mjs +0 -148
  35. package/dist/esm/security/crossProjectPolicy.mjs +0 -259
  36. package/dist/esm/security/operationContracts.mjs +0 -127
  37. package/dist/esm/security/resolveCrossProjectPolicy.mjs +0 -27
  38. package/dist/esm/utils/alias.mjs +0 -57
  39. package/dist/esm-node/adapter-kit/index.mjs +0 -80
  40. package/dist/esm-node/adapter-kit/parity-scenarios/cross-project-denial.mjs +0 -18
  41. package/dist/esm-node/adapter-kit/parity-scenarios/envelope.mjs +0 -91
  42. package/dist/esm-node/adapter-kit/parity-scenarios/operation-context.mjs +0 -112
  43. package/dist/esm-node/adapter-kit/parity-scenarios/schema.mjs +0 -72
  44. package/dist/esm-node/adapter-kit/parity-scenarios/shared.mjs +0 -22
  45. package/dist/esm-node/adapter-kit/parity.mjs +0 -149
  46. package/dist/esm-node/security/crossProjectPolicy.mjs +0 -260
  47. package/dist/esm-node/security/operationContracts.mjs +0 -130
  48. package/dist/esm-node/security/resolveCrossProjectPolicy.mjs +0 -28
  49. package/dist/esm-node/utils/alias.mjs +0 -58
  50. package/dist/types/adapter-kit/index.d.ts +0 -90
  51. package/dist/types/adapter-kit/parity-scenarios/cross-project-denial.d.ts +0 -2
  52. package/dist/types/adapter-kit/parity-scenarios/envelope.d.ts +0 -2
  53. package/dist/types/adapter-kit/parity-scenarios/operation-context.d.ts +0 -3
  54. package/dist/types/adapter-kit/parity-scenarios/schema.d.ts +0 -2
  55. package/dist/types/adapter-kit/parity-scenarios/shared.d.ts +0 -32
  56. package/dist/types/adapter-kit/parity.d.ts +0 -43
  57. package/dist/types/security/crossProjectPolicy.d.ts +0 -110
  58. package/dist/types/security/operationContracts.d.ts +0 -84
  59. package/dist/types/security/resolveCrossProjectPolicy.d.ts +0 -39
  60. package/dist/types/utils/alias.d.ts +0 -7
@@ -28,28 +28,25 @@ var __webpack_require__ = {};
28
28
  var __webpack_exports__ = {};
29
29
  __webpack_require__.r(__webpack_exports__);
30
30
  __webpack_require__.d(__webpack_exports__, {
31
+ ClientCodegenError: ()=>ClientCodegenError,
31
32
  INNER_CLIENT_REQUEST_CREATOR: ()=>INNER_CLIENT_REQUEST_CREATOR,
32
33
  generateClient: ()=>generateClient
33
34
  });
35
+ const external_node_url_namespaceObject = require("node:url");
34
36
  const external_path_namespaceObject = require("path");
35
37
  const index_js_namespaceObject = require("../router/index.js");
36
- const operationContracts_js_namespaceObject = require("../security/operationContracts.js");
37
38
  const external_result_js_namespaceObject = require("./result.js");
38
- const getPackageInfo = (appDir)=>{
39
- try {
40
- const packageJsonPath = external_path_namespaceObject.resolve(appDir, './package.json');
41
- const packageJson = require(packageJsonPath);
42
- return {
43
- name: packageJson.name,
44
- version: packageJson.version
45
- };
46
- } catch (error) {
47
- return {};
39
+ class ClientCodegenError extends Error {
40
+ constructor(plugin, cause){
41
+ super(`BFF client code-generation plugin failed: ${plugin}`, {
42
+ cause
43
+ });
44
+ this.name = 'ClientCodegenError';
48
45
  }
49
- };
46
+ }
50
47
  const INNER_CLIENT_REQUEST_CREATOR = '@modern-js/plugin-bff/client';
51
- const generateClient = async ({ appDir, resourcePath, apiDir, lambdaDir, prefix, port, target, requestCreator, fetcher, requireResolve = require.resolve, httpMethodDecider, domain, requestId })=>{
52
- requestCreator = requestCreator || INNER_CLIENT_REQUEST_CREATOR;
48
+ const generateClient = async (options)=>{
49
+ const { appDir, resourcePath, apiDir, lambdaDir, prefix, port, target, fetcher, requireResolve = require.resolve, httpMethodDecider, domain, requestId, clientCodegenPlugin } = options;
53
50
  const apiRouter = new index_js_namespaceObject.ApiRouter({
54
51
  appDir,
55
52
  apiDir,
@@ -59,136 +56,68 @@ const generateClient = async ({ appDir, resourcePath, apiDir, lambdaDir, prefix,
59
56
  });
60
57
  const handlerInfos = await apiRouter.getSingleModuleHandlers(resourcePath);
61
58
  if (!handlerInfos) return (0, external_result_js_namespaceObject.Err)(`generate client error: Cannot require module ${resourcePath}`);
62
- const normalizedRequestId = requestId || 'default';
63
- const operationVersion = (0, operationContracts_js_namespaceObject.deriveOperationVersion)(getPackageInfo(appDir).version);
64
- const operationContracts = (0, operationContracts_js_namespaceObject.buildOperationContractMap)({
65
- handlers: handlerInfos,
66
- requestId: normalizedRequestId,
67
- operationVersion
68
- });
69
- const operationEntries = handlerInfos.map((handlerInfo)=>{
70
- const upperHttpMethod = handlerInfo.httpMethod.toUpperCase();
71
- const contract = operationContracts[`${upperHttpMethod}:${handlerInfo.routePath}`];
72
- return {
73
- name: handlerInfo.name,
74
- httpMethod: upperHttpMethod,
75
- routePath: handlerInfo.routePath,
76
- schemaHash: contract?.schemaHash ?? ''
77
- };
78
- }).sort((a, b)=>{
79
- const keyA = `${a.routePath}:${a.httpMethod}:${a.name}`;
80
- const keyB = `${b.routePath}:${b.httpMethod}:${b.name}`;
81
- return keyA.localeCompare(keyB);
82
- });
83
- const schemaHash = (0, operationContracts_js_namespaceObject.createOperationSchemaHash)(operationEntries, normalizedRequestId);
84
- let hasUploadHandler = false;
85
- let handlersCode = '';
86
- for (const handlerInfo of handlerInfos){
87
- const { name, httpMethod, routePath, action } = handlerInfo;
88
- let exportStatement = `var ${name} =`;
89
- if ('default' === name.toLowerCase()) exportStatement = 'default';
90
- const upperHttpMethod = httpMethod.toUpperCase();
91
- const operationSchemaHash = operationContracts[`${upperHttpMethod}:${routePath}`]?.schemaHash ?? '';
92
- const operationContext = {
93
- operationId: name,
94
- routePath,
95
- method: upperHttpMethod,
96
- schemaHash: operationSchemaHash,
97
- operationVersion
98
- };
99
- if ('upload' === action) {
100
- hasUploadHandler = true;
101
- const uploadOptions = {
102
- path: routePath,
103
- ...domain ? {
104
- domain
105
- } : {},
106
- ...requestId ? {
107
- requestId
108
- } : {},
109
- ...requestId ? {
110
- operationContext
111
- } : {}
59
+ const draft = {
60
+ requestCreator: options.requestCreator || INNER_CLIENT_REQUEST_CREATOR,
61
+ imports: fetcher ? [
62
+ `import { fetch } from ${JSON.stringify(fetcher)};`
63
+ ] : [],
64
+ statements: [],
65
+ handlers: handlerInfos.map((handlerInfo)=>{
66
+ const optionProperties = [
67
+ `path: ${JSON.stringify(handlerInfo.routePath)}`
68
+ ];
69
+ if ('upload' !== handlerInfo.action) {
70
+ const portExpression = 'server' === target ? `process.env.PORT || ${String(port)}` : String(port);
71
+ optionProperties.push(`method: ${JSON.stringify(handlerInfo.httpMethod.toUpperCase())}`, `port: ${portExpression}`, `httpMethodDecider: ${JSON.stringify(httpMethodDecider || 'functionName')}`);
72
+ }
73
+ if (domain) optionProperties.push(`domain: ${JSON.stringify(domain)}`);
74
+ if (fetcher && 'upload' !== handlerInfo.action) optionProperties.push('fetch');
75
+ if (requestId) optionProperties.push(`requestId: ${JSON.stringify(requestId)}`);
76
+ return {
77
+ handlerInfo,
78
+ optionProperties
112
79
  };
113
- handlersCode += `export ${exportStatement} createUploader(${JSON.stringify(uploadOptions)});
114
- `;
115
- continue;
116
- }
117
- const portExpression = 'server' === target ? `process.env.PORT || ${String(port)}` : String(port);
118
- const requestOptionProperties = [
119
- `path: ${JSON.stringify(routePath)}`,
120
- `method: ${JSON.stringify(upperHttpMethod)}`,
121
- `port: ${portExpression}`,
122
- `httpMethodDecider: ${JSON.stringify(httpMethodDecider ? httpMethodDecider : 'functionName')}`
123
- ];
124
- if (domain) requestOptionProperties.push(`domain: ${JSON.stringify(domain)}`);
125
- if (fetcher) requestOptionProperties.push('fetch');
126
- if (requestId) requestOptionProperties.push(`requestId: ${JSON.stringify(requestId)}`);
127
- requestOptionProperties.push(`operationContext: ${JSON.stringify(operationContext)}`);
128
- handlersCode += `export ${exportStatement} createRequest({ ${requestOptionProperties.join(', ')} });
129
- `;
80
+ })
81
+ };
82
+ if (clientCodegenPlugin) try {
83
+ const specifier = clientCodegenPlugin.startsWith('.') ? external_path_namespaceObject.resolve(appDir, clientCodegenPlugin) : clientCodegenPlugin;
84
+ const resolved = requireResolve(specifier, {
85
+ paths: [
86
+ appDir
87
+ ]
88
+ });
89
+ const extension = await import((0, external_node_url_namespaceObject.pathToFileURL)(resolved).href);
90
+ const modifyClient = extension.modifyClient ?? extension.default?.modifyClient;
91
+ if ('function' != typeof modifyClient) throw new TypeError('The module must export a modifyClient function.');
92
+ await modifyClient(draft, {
93
+ options,
94
+ handlerInfos
95
+ });
96
+ } catch (cause) {
97
+ throw new ClientCodegenError(clientCodegenPlugin, cause);
130
98
  }
131
- const serializedRequestCreator = JSON.stringify(requestCreator);
132
- const serializedFetcher = fetcher ? JSON.stringify(fetcher) : void 0;
133
- const namedRequestImports = `createRequest${hasUploadHandler ? ', createUploader' : ''}`;
134
- const importCode = requestId ? `import * as requestRuntime from ${serializedRequestCreator};
135
- const { ${namedRequestImports} } = requestRuntime;
136
- ${serializedFetcher ? `import { fetch } from ${serializedFetcher};\n` : ''}` : `import { ${namedRequestImports} } from ${serializedRequestCreator};
137
- ${serializedFetcher ? `import { fetch } from ${serializedFetcher};\n` : ''}`;
138
- const bootstrapCode = requestId ? `export const initProducerClient = (options = {}) => {
139
- const configure = requestRuntime.configure;
140
- if (typeof configure !== 'function') {
141
- console.warn('[modernjs] Compatibility request creator path does not expose configure(); use default @modern-js/create-request or migrate the compatibility path.');
142
- return undefined;
143
- }
144
- const defaultSecureOptions = {
145
- requestId: ${JSON.stringify(requestId)},
146
- requireEnvelope: true,
147
- identityBinding: {
148
- enabled: true,
149
- strict: true,
150
- },
151
- operationContract: {
152
- enabled: true,
153
- strict: true,
154
- requireSchemaHash: true,
155
- requireOperationVersion: true,
156
- },
157
- };
158
- return configure({
159
- ...defaultSecureOptions,
160
- ...options,
161
- identityBinding: {
162
- ...defaultSecureOptions.identityBinding,
163
- ...(options && options.identityBinding ? options.identityBinding : {}),
164
- },
165
- operationContract: {
166
- ...defaultSecureOptions.operationContract,
167
- ...(options && options.operationContract ? options.operationContract : {}),
168
- },
169
- });
170
- };
171
- ` : '';
172
- const manifestCode = `export const operationVersion = ${String(operationVersion)};
173
- export const operationSchemaHash = '${schemaHash}';
174
- export const operationManifest = ${JSON.stringify({
175
- operationVersion,
176
- schemaHash,
177
- operations: operationEntries
178
- }, null, 2)};
179
- `;
180
- const generatedParts = [
181
- importCode.trimEnd(),
182
- bootstrapCode.trimEnd(),
183
- manifestCode.trimEnd(),
184
- handlersCode.trimEnd()
185
- ].filter(Boolean);
186
- return (0, external_result_js_namespaceObject.Ok)(`${generatedParts.join('\n\n')}
187
- `);
99
+ const hasUploadHandler = handlerInfos.some((info)=>'upload' === info.action);
100
+ const requestImports = `createRequest${hasUploadHandler ? ', createUploader' : ''}`;
101
+ const importCode = [
102
+ `import { ${requestImports} } from ${JSON.stringify(draft.requestCreator)};`,
103
+ ...draft.imports
104
+ ].join('\n');
105
+ const handlersCode = draft.handlers.map(({ handlerInfo, optionProperties })=>{
106
+ const exportStatement = 'default' === handlerInfo.name.toLowerCase() ? 'default' : `var ${handlerInfo.name} =`;
107
+ const creator = 'upload' === handlerInfo.action ? 'createUploader' : 'createRequest';
108
+ return `export ${exportStatement} ${creator}({ ${optionProperties.join(', ')} });`;
109
+ }).join('\n');
110
+ return (0, external_result_js_namespaceObject.Ok)(`${[
111
+ importCode,
112
+ ...draft.statements,
113
+ handlersCode
114
+ ].filter(Boolean).join('\n\n')}\n`);
188
115
  };
116
+ exports.ClientCodegenError = __webpack_exports__.ClientCodegenError;
189
117
  exports.INNER_CLIENT_REQUEST_CREATOR = __webpack_exports__.INNER_CLIENT_REQUEST_CREATOR;
190
118
  exports.generateClient = __webpack_exports__.generateClient;
191
119
  for(var __rspack_i in __webpack_exports__)if (-1 === [
120
+ "ClientCodegenError",
192
121
  "INNER_CLIENT_REQUEST_CREATOR",
193
122
  "generateClient"
194
123
  ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
package/dist/cjs/index.js CHANGED
@@ -1,8 +1,5 @@
1
1
  "use strict";
2
2
  var __webpack_modules__ = {
3
- "./adapter-kit" (module) {
4
- module.exports = require("./adapter-kit/index.js");
5
- },
6
3
  "./api" (module) {
7
4
  module.exports = require("./api.js");
8
5
  },
@@ -18,15 +15,6 @@ var __webpack_modules__ = {
18
15
  "./router" (module) {
19
16
  module.exports = require("./router/index.js");
20
17
  },
21
- "./security/crossProjectPolicy" (module) {
22
- module.exports = require("./security/crossProjectPolicy.js");
23
- },
24
- "./security/operationContracts" (module) {
25
- module.exports = require("./security/operationContracts.js");
26
- },
27
- "./security/resolveCrossProjectPolicy" (module) {
28
- module.exports = require("./security/resolveCrossProjectPolicy.js");
29
- },
30
18
  "./types" (module) {
31
19
  module.exports = require("./types.js");
32
20
  },
@@ -81,148 +69,74 @@ function __webpack_require__(moduleId) {
81
69
  var __webpack_exports__ = {};
82
70
  (()=>{
83
71
  __webpack_require__.r(__webpack_exports__);
84
- var _adapter_kit__rspack_import_0 = __webpack_require__("./adapter-kit");
85
- var __rspack_reexport = {};
86
- for(const __rspack_import_key in _adapter_kit__rspack_import_0)if ([
87
- "HttpError",
88
- "registerPaths",
89
- "createStorage",
90
- "isWithMetaHandler",
91
- "default",
92
- "HANDLER_WITH_META",
93
- "ValidationError",
94
- "getRelativeRuntimePath",
95
- "INPUT_PARAMS_DECIDER",
96
- "isInputParamsDeciderHandler",
97
- "Api"
98
- ].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_adapter_kit__rspack_import_0[__rspack_import_key];
99
- __webpack_require__.d(__webpack_exports__, __rspack_reexport);
100
- var _api__rspack_import_1 = __webpack_require__("./api");
101
- var _client__rspack_import_2 = __webpack_require__("./client");
102
- var __rspack_reexport = {};
103
- for(const __rspack_import_key in _client__rspack_import_2)if ([
104
- "HttpError",
105
- "registerPaths",
106
- "createStorage",
107
- "isWithMetaHandler",
108
- "default",
109
- "HANDLER_WITH_META",
110
- "ValidationError",
111
- "getRelativeRuntimePath",
112
- "INPUT_PARAMS_DECIDER",
113
- "isInputParamsDeciderHandler",
114
- "Api"
115
- ].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_client__rspack_import_2[__rspack_import_key];
116
- __webpack_require__.d(__webpack_exports__, __rspack_reexport);
117
- var _errors_http__rspack_import_3 = __webpack_require__("./errors/http");
118
- var _operators_http__rspack_import_4 = __webpack_require__("./operators/http");
119
- var __rspack_reexport = {};
120
- for(const __rspack_import_key in _operators_http__rspack_import_4)if ([
121
- "HttpError",
122
- "registerPaths",
123
- "createStorage",
124
- "isWithMetaHandler",
125
- "default",
126
- "HANDLER_WITH_META",
127
- "ValidationError",
128
- "getRelativeRuntimePath",
129
- "INPUT_PARAMS_DECIDER",
130
- "isInputParamsDeciderHandler",
131
- "Api"
132
- ].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_operators_http__rspack_import_4[__rspack_import_key];
133
- __webpack_require__.d(__webpack_exports__, __rspack_reexport);
134
- var _router__rspack_import_5 = __webpack_require__("./router");
135
- var __rspack_reexport = {};
136
- for(const __rspack_import_key in _router__rspack_import_5)if ([
137
- "HttpError",
138
- "registerPaths",
139
- "createStorage",
140
- "isWithMetaHandler",
141
- "default",
142
- "HANDLER_WITH_META",
143
- "ValidationError",
144
- "getRelativeRuntimePath",
145
- "INPUT_PARAMS_DECIDER",
146
- "isInputParamsDeciderHandler",
147
- "Api"
148
- ].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_router__rspack_import_5[__rspack_import_key];
149
- __webpack_require__.d(__webpack_exports__, __rspack_reexport);
150
- var _security_crossProjectPolicy__rspack_import_6 = __webpack_require__("./security/crossProjectPolicy");
72
+ var _api__rspack_import_0 = __webpack_require__("./api");
73
+ var _client__rspack_import_1 = __webpack_require__("./client");
151
74
  var __rspack_reexport = {};
152
- for(const __rspack_import_key in _security_crossProjectPolicy__rspack_import_6)if ([
75
+ for(const __rspack_import_key in _client__rspack_import_1)if ([
153
76
  "HttpError",
154
- "registerPaths",
155
77
  "createStorage",
156
78
  "isWithMetaHandler",
157
79
  "default",
158
80
  "HANDLER_WITH_META",
159
81
  "ValidationError",
160
- "getRelativeRuntimePath",
161
82
  "INPUT_PARAMS_DECIDER",
162
83
  "isInputParamsDeciderHandler",
163
84
  "Api"
164
- ].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_security_crossProjectPolicy__rspack_import_6[__rspack_import_key];
85
+ ].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_client__rspack_import_1[__rspack_import_key];
165
86
  __webpack_require__.d(__webpack_exports__, __rspack_reexport);
166
- var _security_operationContracts__rspack_import_7 = __webpack_require__("./security/operationContracts");
87
+ var _errors_http__rspack_import_2 = __webpack_require__("./errors/http");
88
+ var _operators_http__rspack_import_3 = __webpack_require__("./operators/http");
167
89
  var __rspack_reexport = {};
168
- for(const __rspack_import_key in _security_operationContracts__rspack_import_7)if ([
90
+ for(const __rspack_import_key in _operators_http__rspack_import_3)if ([
169
91
  "HttpError",
170
- "registerPaths",
171
92
  "createStorage",
172
93
  "isWithMetaHandler",
173
94
  "default",
174
95
  "HANDLER_WITH_META",
175
96
  "ValidationError",
176
- "getRelativeRuntimePath",
177
97
  "INPUT_PARAMS_DECIDER",
178
98
  "isInputParamsDeciderHandler",
179
99
  "Api"
180
- ].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_security_operationContracts__rspack_import_7[__rspack_import_key];
100
+ ].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_operators_http__rspack_import_3[__rspack_import_key];
181
101
  __webpack_require__.d(__webpack_exports__, __rspack_reexport);
182
- var _security_resolveCrossProjectPolicy__rspack_import_8 = __webpack_require__("./security/resolveCrossProjectPolicy");
102
+ var _router__rspack_import_4 = __webpack_require__("./router");
183
103
  var __rspack_reexport = {};
184
- for(const __rspack_import_key in _security_resolveCrossProjectPolicy__rspack_import_8)if ([
104
+ for(const __rspack_import_key in _router__rspack_import_4)if ([
185
105
  "HttpError",
186
- "registerPaths",
187
106
  "createStorage",
188
107
  "isWithMetaHandler",
189
108
  "default",
190
109
  "HANDLER_WITH_META",
191
110
  "ValidationError",
192
- "getRelativeRuntimePath",
193
111
  "INPUT_PARAMS_DECIDER",
194
112
  "isInputParamsDeciderHandler",
195
113
  "Api"
196
- ].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_security_resolveCrossProjectPolicy__rspack_import_8[__rspack_import_key];
114
+ ].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_router__rspack_import_4[__rspack_import_key];
197
115
  __webpack_require__.d(__webpack_exports__, __rspack_reexport);
198
- var _types__rspack_import_9 = __webpack_require__("./types");
116
+ var _types__rspack_import_5 = __webpack_require__("./types");
199
117
  var __rspack_reexport = {};
200
- for(const __rspack_import_key in _types__rspack_import_9)if ([
118
+ for(const __rspack_import_key in _types__rspack_import_5)if ([
201
119
  "HttpError",
202
- "registerPaths",
203
120
  "createStorage",
204
121
  "isWithMetaHandler",
205
122
  "default",
206
123
  "HANDLER_WITH_META",
207
124
  "ValidationError",
208
- "getRelativeRuntimePath",
209
125
  "INPUT_PARAMS_DECIDER",
210
126
  "isInputParamsDeciderHandler",
211
127
  "Api"
212
- ].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_types__rspack_import_9[__rspack_import_key];
128
+ ].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_types__rspack_import_5[__rspack_import_key];
213
129
  __webpack_require__.d(__webpack_exports__, __rspack_reexport);
214
- var _utils__rspack_import_10 = __webpack_require__("./utils?637c");
130
+ var _utils__rspack_import_6 = __webpack_require__("./utils?637c");
215
131
  __webpack_require__.d(__webpack_exports__, {
216
- Api: ()=>_api__rspack_import_1.Api,
217
- HANDLER_WITH_META: ()=>_utils__rspack_import_10.HANDLER_WITH_META,
218
- HttpError: ()=>_errors_http__rspack_import_3.HttpError,
219
- INPUT_PARAMS_DECIDER: ()=>_utils__rspack_import_10.INPUT_PARAMS_DECIDER,
220
- ValidationError: ()=>_errors_http__rspack_import_3.ValidationError,
221
- createStorage: ()=>_utils__rspack_import_10.createStorage,
222
- getRelativeRuntimePath: ()=>_utils__rspack_import_10.getRelativeRuntimePath,
223
- isInputParamsDeciderHandler: ()=>_utils__rspack_import_10.isInputParamsDeciderHandler,
224
- isWithMetaHandler: ()=>_utils__rspack_import_10.isWithMetaHandler,
225
- registerPaths: ()=>_utils__rspack_import_10.registerPaths
132
+ Api: ()=>_api__rspack_import_0.Api,
133
+ HANDLER_WITH_META: ()=>_utils__rspack_import_6.HANDLER_WITH_META,
134
+ HttpError: ()=>_errors_http__rspack_import_2.HttpError,
135
+ INPUT_PARAMS_DECIDER: ()=>_utils__rspack_import_6.INPUT_PARAMS_DECIDER,
136
+ ValidationError: ()=>_errors_http__rspack_import_2.ValidationError,
137
+ createStorage: ()=>_utils__rspack_import_6.createStorage,
138
+ isInputParamsDeciderHandler: ()=>_utils__rspack_import_6.isInputParamsDeciderHandler,
139
+ isWithMetaHandler: ()=>_utils__rspack_import_6.isWithMetaHandler
226
140
  });
227
141
  })();
228
142
  exports.Api = __webpack_exports__.Api;
@@ -231,10 +145,8 @@ exports.HttpError = __webpack_exports__.HttpError;
231
145
  exports.INPUT_PARAMS_DECIDER = __webpack_exports__.INPUT_PARAMS_DECIDER;
232
146
  exports.ValidationError = __webpack_exports__.ValidationError;
233
147
  exports.createStorage = __webpack_exports__.createStorage;
234
- exports.getRelativeRuntimePath = __webpack_exports__.getRelativeRuntimePath;
235
148
  exports.isInputParamsDeciderHandler = __webpack_exports__.isInputParamsDeciderHandler;
236
149
  exports.isWithMetaHandler = __webpack_exports__.isWithMetaHandler;
237
- exports.registerPaths = __webpack_exports__.registerPaths;
238
150
  for(var __rspack_i in __webpack_exports__)if (-1 === [
239
151
  "Api",
240
152
  "HANDLER_WITH_META",
@@ -242,10 +154,8 @@ for(var __rspack_i in __webpack_exports__)if (-1 === [
242
154
  "INPUT_PARAMS_DECIDER",
243
155
  "ValidationError",
244
156
  "createStorage",
245
- "getRelativeRuntimePath",
246
157
  "isInputParamsDeciderHandler",
247
- "isWithMetaHandler",
248
- "registerPaths"
158
+ "isWithMetaHandler"
249
159
  ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
250
160
  Object.defineProperty(exports, '__esModule', {
251
161
  value: true
@@ -174,10 +174,11 @@ var __webpack_exports__ = {};
174
174
  if ('test' !== process.env.NODE_ENV) _modern_js_utils__rspack_import_0.logger.warn(`Only api handlers are allowd to be exported, please remove the function ${originHandlerName} from exports`);
175
175
  return null;
176
176
  }
177
+ } else {
178
+ if (!handler) return null;
179
+ if ('function' == typeof handler && handler.length > 0) return _types__rspack_import_3.HttpMethod.Post;
180
+ return _types__rspack_import_3.HttpMethod.Get;
177
181
  }
178
- if (!handler) return null;
179
- if ('function' == typeof handler && handler.length > 0) return _types__rspack_import_3.HttpMethod.Post;
180
- return _types__rspack_import_3.HttpMethod.Get;
181
182
  }
182
183
  getAction(handler) {
183
184
  if (handler) {
@@ -226,9 +227,10 @@ var __webpack_exports__ = {};
226
227
  cause: err
227
228
  });
228
229
  throw error;
230
+ } else {
231
+ console.error(`Failed to load BFF module '${filename}':`, err);
232
+ return null;
229
233
  }
230
- console.error(`Failed to load BFF module '${filename}':`, err);
231
- return null;
232
234
  }
233
235
  }
234
236
  getHandlerInfos(moduleInfos) {
@@ -1,8 +1,5 @@
1
1
  "use strict";
2
2
  var __webpack_modules__ = {
3
- "./alias" (module) {
4
- module.exports = require("./alias.js");
5
- },
6
3
  "./debug" (module) {
7
4
  module.exports = require("./debug.js");
8
5
  },
@@ -63,37 +60,30 @@ function __webpack_require__(moduleId) {
63
60
  var __webpack_exports__ = {};
64
61
  (()=>{
65
62
  __webpack_require__.r(__webpack_exports__);
66
- var _alias__rspack_import_0 = __webpack_require__("./alias");
67
- var __rspack_reexport = {};
68
- for(const __rspack_import_key in _alias__rspack_import_0)if ([
69
- "debug",
70
- "default"
71
- ].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_alias__rspack_import_0[__rspack_import_key];
72
- __webpack_require__.d(__webpack_exports__, __rspack_reexport);
73
- var _debug__rspack_import_1 = __webpack_require__("./debug");
74
- var _meta__rspack_import_2 = __webpack_require__("./meta");
63
+ var _debug__rspack_import_0 = __webpack_require__("./debug");
64
+ var _meta__rspack_import_1 = __webpack_require__("./meta");
75
65
  var __rspack_reexport = {};
76
- for(const __rspack_import_key in _meta__rspack_import_2)if ([
66
+ for(const __rspack_import_key in _meta__rspack_import_1)if ([
77
67
  "debug",
78
68
  "default"
79
- ].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_meta__rspack_import_2[__rspack_import_key];
69
+ ].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_meta__rspack_import_1[__rspack_import_key];
80
70
  __webpack_require__.d(__webpack_exports__, __rspack_reexport);
81
- var _storage__rspack_import_3 = __webpack_require__("./storage");
71
+ var _storage__rspack_import_2 = __webpack_require__("./storage");
82
72
  var __rspack_reexport = {};
83
- for(const __rspack_import_key in _storage__rspack_import_3)if ([
73
+ for(const __rspack_import_key in _storage__rspack_import_2)if ([
84
74
  "debug",
85
75
  "default"
86
- ].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_storage__rspack_import_3[__rspack_import_key];
76
+ ].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_storage__rspack_import_2[__rspack_import_key];
87
77
  __webpack_require__.d(__webpack_exports__, __rspack_reexport);
88
- var _validate__rspack_import_4 = __webpack_require__("./validate");
78
+ var _validate__rspack_import_3 = __webpack_require__("./validate");
89
79
  var __rspack_reexport = {};
90
- for(const __rspack_import_key in _validate__rspack_import_4)if ([
80
+ for(const __rspack_import_key in _validate__rspack_import_3)if ([
91
81
  "debug",
92
82
  "default"
93
- ].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_validate__rspack_import_4[__rspack_import_key];
83
+ ].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_validate__rspack_import_3[__rspack_import_key];
94
84
  __webpack_require__.d(__webpack_exports__, __rspack_reexport);
95
85
  __webpack_require__.d(__webpack_exports__, {
96
- debug: ()=>_debug__rspack_import_1.debug
86
+ debug: ()=>_debug__rspack_import_0.debug
97
87
  });
98
88
  })();
99
89
  exports.debug = __webpack_exports__.debug;