@modern-js/bff-core 2.0.0-beta.7 → 2.0.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # @modern-js/bff-core
2
2
 
3
+ ## 2.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - @modern-js/bff-runtime@2.0.1
8
+ - @modern-js/utils@2.0.1
9
+
10
+ ## 2.0.0
11
+
12
+ ### Major Changes
13
+
14
+ - dda38c9c3e: chore: v2
15
+
16
+ ### Patch Changes
17
+
18
+ - Updated dependencies [edd1cfb1af]
19
+ - Updated dependencies [dda38c9c3e]
20
+ - Updated dependencies [ffb2ed4]
21
+ - Updated dependencies [bbe4c4ab64]
22
+ - @modern-js/utils@2.0.0
23
+ - @modern-js/bff-runtime@2.0.0
24
+
3
25
  ## 2.0.0-beta.7
4
26
 
5
27
  ### Major Changes
@@ -1,6 +1,6 @@
1
1
  import { Result } from './result';
2
- export declare type GenClientResult = Result<string>;
3
- export declare type GenClientOptions = {
2
+ export type GenClientResult = Result<string>;
3
+ export type GenClientOptions = {
4
4
  resourcePath: string;
5
5
  source: string;
6
6
  apiDir: string;
@@ -1,15 +1,15 @@
1
- export declare type Err<T = unknown> = {
1
+ export type Err<T = unknown> = {
2
2
  kind: 'Err';
3
3
  value: T;
4
4
  isErr: true;
5
5
  isOk: false;
6
6
  };
7
- export declare type Ok<T = unknown> = {
7
+ export type Ok<T = unknown> = {
8
8
  kind: 'Ok';
9
9
  value: T;
10
10
  isErr: false;
11
11
  isOk: true;
12
12
  };
13
- export declare type Result<T = unknown, E = string> = Err<E> | Ok<T>;
13
+ export type Result<T = unknown, E = string> = Err<E> | Ok<T>;
14
14
  export declare const Err: <E = string>(value: E) => Err<E>;
15
15
  export declare const Ok: <T, E = string>(value: T) => Result<T, E>;
@@ -1,12 +1,12 @@
1
1
  import { HttpMethod } from '../types';
2
- export declare type ModuleInfo = {
2
+ export type ModuleInfo = {
3
3
  filename: string;
4
4
  module: HandlerModule;
5
5
  };
6
- declare type Handler = (...args: any) => any | Promise<any>;
7
- export declare type ApiHandler = Handler;
8
- export declare type HandlerModule = Record<string, ApiHandler>;
9
- export declare type APIHandlerInfo = {
6
+ type Handler = (...args: any) => any | Promise<any>;
7
+ export type ApiHandler = Handler;
8
+ export type HandlerModule = Record<string, ApiHandler>;
9
+ export type APIHandlerInfo = {
10
10
  handler: ApiHandler;
11
11
  name: string;
12
12
  httpMethod: HttpMethod;
@@ -1,7 +1,7 @@
1
1
  import { APIHandlerInfo, HandlerModule } from './types';
2
- declare type MaybeAsync<I> = I | Promise<I>;
3
- export declare type NormalHandler = (...args: any[]) => any;
4
- export declare type Handler<I, O> = (input: I) => MaybeAsync<O>;
2
+ type MaybeAsync<I> = I | Promise<I>;
3
+ export type NormalHandler = (...args: any[]) => any;
4
+ export type Handler<I, O> = (input: I) => MaybeAsync<O>;
5
5
  export declare const getFiles: (lambdaDir: string, rules: string | string[]) => string[];
6
6
  export declare const getPathFromFilename: (baseDir: string, filename: string) => string;
7
7
  export declare const isHandler: (input: any) => input is Handler<any, any>;
@@ -30,17 +30,17 @@ export declare enum HttpMethod {
30
30
  Option = "OPTION",
31
31
  Head = "HEAD",
32
32
  }
33
- export declare type InputSchemaMeata = Extract<HttpMetadata, HttpMetadata.Data | HttpMetadata.Query | HttpMetadata.Headers | HttpMetadata.Params>;
34
- export declare type ExecuteFunc<Outputs> = (helper: ExecuteHelper<Outputs>, next: () => Promise<any>) => Promise<any>;
35
- export declare type ExecuteHelper<Outputs> = {
33
+ export type InputSchemaMeata = Extract<HttpMetadata, HttpMetadata.Data | HttpMetadata.Query | HttpMetadata.Headers | HttpMetadata.Params>;
34
+ export type ExecuteFunc<Outputs> = (helper: ExecuteHelper<Outputs>, next: () => Promise<any>) => Promise<any>;
35
+ export type ExecuteHelper<Outputs> = {
36
36
  result?: any;
37
37
  inputs: Outputs;
38
38
  };
39
- export declare type MetadataHelper = {
39
+ export type MetadataHelper = {
40
40
  setMetadata: <T = any>(key: any, value: T) => void;
41
41
  getMetadata: <T = any>(key: any) => T;
42
42
  };
43
- export declare type Operator<Input = any, Output = Input> = {
43
+ export type Operator<Input = any, Output = Input> = {
44
44
  name: string;
45
45
  inputType?: Input;
46
46
  outputType?: Output;
@@ -48,11 +48,11 @@ export declare type Operator<Input = any, Output = Input> = {
48
48
  validate?: ExecuteFunc<Output>;
49
49
  execute?: ExecuteFunc<Output>;
50
50
  };
51
- export declare type MaybeAsync<T> = Promise<T> | T;
52
- export declare type ApiRunner<Input extends object | void | unknown, Output extends MaybeAsync<any>> = (...args: Input extends void ? never : [input: Input]) => Output;
53
- export declare type NonNullable<T> = Exclude<T, null | undefined>;
54
- export declare type ExtractInputType<T> = { [key in keyof T]: T[key] extends Operator<any, any> ? NonNullable<T[key]['inputType']> : void };
55
- export declare type ExtractOuputType<T> = { [key in keyof T]: T[key] extends Operator<any, any> ? NonNullable<T[key]['outputType']> : void };
56
- export declare type ArrayToObject<T, R = {}> = T extends [infer First, ...infer Rest] ? First extends PromiseLike<infer PromiseValue> ? PromiseValue : First extends object ? Merge<First, ArrayToObject<Rest, R>> : ArrayToObject<Rest, R> : R;
57
- export declare type AsyncFunction = (...args: any[]) => Promise<any>;
51
+ export type MaybeAsync<T> = Promise<T> | T;
52
+ export type ApiRunner<Input extends object | void | unknown, Output extends MaybeAsync<any>> = (...args: Input extends void ? never : [input: Input]) => Output;
53
+ export type NonNullable<T> = Exclude<T, null | undefined>;
54
+ export type ExtractInputType<T> = { [key in keyof T]: T[key] extends Operator<any, any> ? NonNullable<T[key]['inputType']> : void };
55
+ export type ExtractOuputType<T> = { [key in keyof T]: T[key] extends Operator<any, any> ? NonNullable<T[key]['outputType']> : void };
56
+ export type ArrayToObject<T, R = {}> = T extends [infer First, ...infer Rest] ? First extends PromiseLike<infer PromiseValue> ? PromiseValue : First extends object ? Merge<First, ArrayToObject<Rest, R>> : ArrayToObject<Rest, R> : R;
57
+ export type AsyncFunction = (...args: any[]) => Promise<any>;
58
58
  export declare const httpMethods: HttpMethod[];
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "2.0.0-beta.7",
14
+ "version": "2.0.1",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/types/index.d.ts",
17
17
  "main": "./dist/js/node/index.js",
@@ -30,8 +30,8 @@
30
30
  "esbuild-register": "^3.3.3",
31
31
  "koa-compose": "^4.1.0",
32
32
  "reflect-metadata": "^0.1.13",
33
- "@modern-js/bff-runtime": "2.0.0-beta.7",
34
- "@modern-js/utils": "2.0.0-beta.7"
33
+ "@modern-js/bff-runtime": "2.0.1",
34
+ "@modern-js/utils": "2.0.1"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/jest": "^27",
@@ -41,8 +41,8 @@
41
41
  "type-fest": "2.15.0",
42
42
  "typescript": "^4",
43
43
  "zod": "^3.17.3",
44
- "@scripts/build": "2.0.0-beta.7",
45
- "@scripts/jest-config": "2.0.0-beta.7"
44
+ "@scripts/build": "2.0.1",
45
+ "@scripts/jest-config": "2.0.1"
46
46
  },
47
47
  "peerDependencies": {
48
48
  "zod": "^3.17.3"