@modern-js/bff-core 3.9.0 → 3.9.2

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.
@@ -174,10 +174,11 @@ var __webpack_exports__ = {};
174
174
  if ('test' !== process.env.NODE_ENV) _modern_js_utils__rspack_import_1.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) {
@@ -88,10 +88,11 @@ class ApiRouter {
88
88
  if ('test' !== process.env.NODE_ENV) logger.warn(`Only api handlers are allowd to be exported, please remove the function ${originHandlerName} from exports`);
89
89
  return null;
90
90
  }
91
+ } else {
92
+ if (!handler) return null;
93
+ if ('function' == typeof handler && handler.length > 0) return HttpMethod.Post;
94
+ return HttpMethod.Get;
91
95
  }
92
- if (!handler) return null;
93
- if ('function' == typeof handler && handler.length > 0) return HttpMethod.Post;
94
- return HttpMethod.Get;
95
96
  }
96
97
  getAction(handler) {
97
98
  if (handler) {
@@ -140,9 +141,10 @@ class ApiRouter {
140
141
  cause: err
141
142
  });
142
143
  throw error;
144
+ } else {
145
+ console.error(`Failed to load BFF module '${filename}':`, err);
146
+ return null;
143
147
  }
144
- console.error(`Failed to load BFF module '${filename}':`, err);
145
- return null;
146
148
  }
147
149
  }
148
150
  getHandlerInfos(moduleInfos) {
@@ -89,10 +89,11 @@ class ApiRouter {
89
89
  if ('test' !== process.env.NODE_ENV) logger.warn(`Only api handlers are allowd to be exported, please remove the function ${originHandlerName} from exports`);
90
90
  return null;
91
91
  }
92
+ } else {
93
+ if (!handler) return null;
94
+ if ('function' == typeof handler && handler.length > 0) return HttpMethod.Post;
95
+ return HttpMethod.Get;
92
96
  }
93
- if (!handler) return null;
94
- if ('function' == typeof handler && handler.length > 0) return HttpMethod.Post;
95
- return HttpMethod.Get;
96
97
  }
97
98
  getAction(handler) {
98
99
  if (handler) {
@@ -141,9 +142,10 @@ class ApiRouter {
141
142
  cause: err
142
143
  });
143
144
  throw error;
145
+ } else {
146
+ console.error(`Failed to load BFF module '${filename}':`, err);
147
+ return null;
144
148
  }
145
- console.error(`Failed to load BFF module '${filename}':`, err);
146
- return null;
147
149
  }
148
150
  }
149
151
  getHandlerInfos(moduleInfos) {
@@ -1,5 +1,5 @@
1
1
  import 'reflect-metadata';
2
- import type { ApiRunner, ArrayToObject, ExtractInputType, ExtractOuputType, MaybeAsync, Operator } from './types';
2
+ import type { ApiRunner, ArrayToObject, ExtractInputType, ExtractOuputType, MaybeAsync, Operator } from './types.js';
3
3
  export declare function Api<Operators extends Operator<any, any>[], Res extends MaybeAsync<any>>(...args: [
4
4
  ...operators: Operators,
5
5
  handler: (arg: ArrayToObject<ExtractOuputType<Operators>>) => Res
@@ -1,5 +1,5 @@
1
1
  import type { HttpMethodDecider } from '@modern-js/types';
2
- import { type Result } from './result';
2
+ import { type Result } from './result.js';
3
3
  export type GenClientResult = Result<string>;
4
4
  export type GenClientOptions = {
5
5
  resourcePath: string;
@@ -1 +1 @@
1
- export * from './generateClient';
1
+ export * from './generateClient.js';
@@ -1,8 +1,8 @@
1
- export { Api } from './api';
2
- export { HttpError, ValidationError } from './errors/http';
3
- export * from './router';
4
- export * from './types';
5
- export * from './client';
6
- export * from './operators/http';
7
- export { getRelativeRuntimePath, HANDLER_WITH_META, isWithMetaHandler, INPUT_PARAMS_DECIDER, isInputParamsDeciderHandler, createStorage, registerPaths, } from './utils';
8
- export type * from './compatible';
1
+ export { Api } from './api.js';
2
+ export { HttpError, ValidationError } from './errors/http.js';
3
+ export * from './router/index.js';
4
+ export * from './types.js';
5
+ export * from './client/index.js';
6
+ export * from './operators/http.js';
7
+ export { getRelativeRuntimePath, HANDLER_WITH_META, isWithMetaHandler, INPUT_PARAMS_DECIDER, isInputParamsDeciderHandler, createStorage, registerPaths, } from './utils/index.js';
8
+ export type * from './compatible.js';
@@ -1,5 +1,5 @@
1
1
  import type { z } from 'zod';
2
- import { HttpMethod, type Operator, ResponseMetaType } from '../types';
2
+ import { HttpMethod, type Operator, ResponseMetaType } from '../types.js';
3
3
  export interface ResponseMeta {
4
4
  type: ResponseMetaType;
5
5
  value: unknown;
@@ -1,9 +1,9 @@
1
1
  import 'reflect-metadata';
2
2
  import type { HttpMethodDecider } from '@modern-js/types';
3
- import { HttpMethod } from '../types';
4
- import type { APIHandlerInfo, ApiHandler } from './types';
5
- export * from './types';
6
- export * from './constants';
3
+ import { HttpMethod } from '../types.js';
4
+ import type { APIHandlerInfo, ApiHandler } from './types.js';
5
+ export * from './types.js';
6
+ export * from './constants.js';
7
7
  export declare class ApiRouter {
8
8
  private appDir?;
9
9
  private apiDir;
@@ -1,4 +1,4 @@
1
- import type { HttpMethod } from '../types';
1
+ import type { HttpMethod } from '../types.js';
2
2
  export type ModuleInfo = {
3
3
  filename: string;
4
4
  module: HandlerModule;
@@ -1,4 +1,4 @@
1
- import type { APIHandlerInfo } from './types';
1
+ import type { APIHandlerInfo } from './types.js';
2
2
  type MaybeAsync<I> = I | Promise<I>;
3
3
  export type NormalHandler = (...args: any[]) => any;
4
4
  export type Handler<I, O> = (input: I) => MaybeAsync<O>;
@@ -1,5 +1,5 @@
1
- export * from './storage';
2
- export * from './alias';
3
- export { debug } from './debug';
4
- export * from './meta';
5
- export * from './validate';
1
+ export * from './storage.js';
2
+ export * from './alias.js';
3
+ export { debug } from './debug.js';
4
+ export * from './meta.js';
5
+ export * from './validate.js';
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "3.9.0",
18
+ "version": "3.9.2",
19
19
  "types": "./dist/types/index.d.ts",
20
20
  "main": "./dist/cjs/index.js",
21
21
  "exports": {
@@ -33,10 +33,10 @@
33
33
  "koa-compose": "^4.1.0",
34
34
  "reflect-metadata": "^0.2.2",
35
35
  "type-fest": "2.19.0",
36
- "@modern-js/utils": "3.9.0"
36
+ "@modern-js/utils": "3.9.2"
37
37
  },
38
38
  "devDependencies": {
39
- "@rslib/core": "0.23.2",
39
+ "@rslib/core": "1.0.0",
40
40
  "@types/koa-compose": "^3.2.9",
41
41
  "@types/node": "^20",
42
42
  "ts-node": "^10.9.2",
@@ -44,8 +44,8 @@
44
44
  "typescript": "^5",
45
45
  "zod": "^3.25.76",
46
46
  "@modern-js/rslib": "2.68.10",
47
- "@modern-js/types": "3.9.0",
48
- "@scripts/rstest-config": "2.66.0"
47
+ "@scripts/rstest-config": "2.66.0",
48
+ "@modern-js/types": "3.9.2"
49
49
  },
50
50
  "peerDependencies": {
51
51
  "ts-node": "^10.9.2",