@napp/dti-server 4.0.1 → 4.0.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.
package/action.d.ts CHANGED
@@ -1,20 +1,15 @@
1
1
  import { DtiAction } from "@napp/dti-core";
2
2
  import { IContext, IMiddleware } from "./common";
3
- export declare abstract class DtiServerAction<RESULT, PARAM> {
4
- abstract meta: DtiAction<RESULT, PARAM>;
5
- abstract action(param: PARAM, ctx: IContext): Promise<RESULT>;
6
- before(): Array<IMiddleware>;
7
- validation(param: PARAM): void;
8
- }
9
- export interface ODtiServerActionFactory<RESULT, PARAM> {
3
+ export interface ODtiServerAction<RESULT, PARAM> {
10
4
  action: (param: PARAM, ctx: IContext) => Promise<RESULT>;
11
5
  before?: Array<IMiddleware>;
12
6
  }
13
- export declare class DtiServerActionFactory<RESULT, PARAM> extends DtiServerAction<RESULT, PARAM> {
7
+ export declare class DtiServerAction<RESULT, PARAM> {
14
8
  meta: DtiAction<RESULT, PARAM>;
15
9
  private opt;
16
10
  private constructor();
17
- before(): Array<IMiddleware>;
18
11
  action(param: PARAM, ctx: IContext): Promise<RESULT>;
19
- static factory<RESULT, PARAM>(meta: DtiAction<RESULT, PARAM>, opt: ODtiServerActionFactory<RESULT, PARAM>): DtiServerActionFactory<RESULT, PARAM>;
12
+ before(): Array<IMiddleware>;
13
+ validation(param: PARAM): void;
14
+ static factory<RESULT, PARAM>(meta: DtiAction<RESULT, PARAM>, opt: ODtiServerAction<RESULT, PARAM>): DtiServerAction<RESULT, PARAM>;
20
15
  }
package/action.js CHANGED
@@ -1,29 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DtiServerActionFactory = exports.DtiServerAction = void 0;
3
+ exports.DtiServerAction = void 0;
4
4
  class DtiServerAction {
5
- before() {
6
- return [];
7
- }
8
- validation(param) {
9
- this.meta.validate(param);
10
- }
11
- }
12
- exports.DtiServerAction = DtiServerAction;
13
- class DtiServerActionFactory extends DtiServerAction {
14
5
  constructor(meta, opt) {
15
- super();
16
6
  this.meta = meta;
17
7
  this.opt = opt;
18
8
  }
9
+ action(param, ctx) {
10
+ return this.opt.action(param, ctx);
11
+ }
19
12
  before() {
20
13
  return this.opt.before || [];
21
14
  }
22
- action(param, ctx) {
23
- return this.opt.action(param, ctx);
15
+ validation(param) {
16
+ this.meta.validate(param);
24
17
  }
25
18
  static factory(meta, opt) {
26
- return new DtiServerActionFactory(meta, opt);
19
+ return new DtiServerAction(meta, opt);
27
20
  }
28
21
  }
29
- exports.DtiServerActionFactory = DtiServerActionFactory;
22
+ exports.DtiServerAction = DtiServerAction;
package/package.json CHANGED
@@ -1,7 +1,11 @@
1
1
  {
2
2
  "name": "@napp/dti-server",
3
- "version": "4.0.1",
3
+ "version": "4.0.2",
4
4
  "description": "data transaction interface server library",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/napp-core/dti.git"
8
+ },
5
9
  "types": "index.d.ts",
6
10
  "main": "index.js",
7
11
  "keywords": [
@@ -12,7 +16,7 @@
12
16
  "author": "Farcek <farcek@gmail.com>",
13
17
  "license": "ISC",
14
18
  "dependencies": {
15
- "@napp/dti-core": "4.0.1",
19
+ "@napp/dti-core": "4.0.2",
16
20
  "base64url": "latest"
17
21
  }
18
22
  }
package/server.d.ts CHANGED
@@ -1,15 +1,12 @@
1
1
  import { DtiRoute } from "@napp/dti-core";
2
2
  import { DtiServerAction } from "./action";
3
3
  import { OSetupParam } from "./common";
4
- export interface ODtiServer {
5
- }
6
4
  export interface IRawActionBuilder {
7
5
  (expressRoute: any): void;
8
6
  }
9
7
  export declare class DtiServer {
10
8
  private root;
11
- private opt;
12
- constructor(root: DtiRoute, opt: ODtiServer);
9
+ constructor(root: DtiRoute);
13
10
  private _actions;
14
11
  private _raws;
15
12
  register(...actions: DtiServerAction<any, any>[]): this;
package/server.js CHANGED
@@ -4,9 +4,8 @@ exports.DtiServer = void 0;
4
4
  const dti_core_1 = require("@napp/dti-core");
5
5
  const route_1 = require("./route");
6
6
  class DtiServer {
7
- constructor(root, opt) {
7
+ constructor(root) {
8
8
  this.root = root;
9
- this.opt = opt;
10
9
  this._actions = new Map();
11
10
  this._raws = new Map();
12
11
  }