@napp/dti-core 4.4.5 → 4.5.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
@@ -6,6 +6,7 @@ interface ODtiAction<RESULT, PARAM> {
6
6
  mode?: DtiMode;
7
7
  path?: string;
8
8
  validate?: (p: PARAM) => void;
9
+ sign?: (p: PARAM) => string;
9
10
  }
10
11
  export declare class DtiAction<RESULT, PARAM> {
11
12
  private opt;
@@ -16,6 +17,7 @@ export declare class DtiAction<RESULT, PARAM> {
16
17
  getPath(): string;
17
18
  getFullname(): string;
18
19
  validate(p: PARAM): void;
20
+ sign(p: PARAM): string;
19
21
  static define<RESULT, PARAM>(opt: ODtiAction<RESULT, PARAM>): DtiAction<RESULT, PARAM>;
20
22
  }
21
23
  export {};
package/action.js CHANGED
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DtiAction = void 0;
4
4
  const common_1 = require("./common");
5
5
  class DtiAction {
6
+ opt;
6
7
  constructor(opt) {
7
8
  this.opt = opt;
8
9
  opt.route.regAction(this);
@@ -27,6 +28,12 @@ class DtiAction {
27
28
  this.opt.validate(p);
28
29
  }
29
30
  }
31
+ sign(p) {
32
+ if (this.opt.sign) {
33
+ return this.opt.sign(p);
34
+ }
35
+ return '';
36
+ }
30
37
  static define(opt) {
31
38
  return new DtiAction(opt);
32
39
  }
package/base62.js CHANGED
@@ -6,9 +6,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.Base62 = void 0;
7
7
  const base_x_1 = __importDefault(require("base-x"));
8
8
  class Base62 {
9
+ convert;
10
+ utf8Encode = new TextEncoder();
11
+ utf8Decoder = new TextDecoder();
9
12
  constructor(ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789') {
10
- this.utf8Encode = new TextEncoder();
11
- this.utf8Decoder = new TextDecoder();
12
13
  this.convert = (0, base_x_1.default)(ALPHABET);
13
14
  }
14
15
  encode(str) {
package/esm/action.d.ts CHANGED
@@ -6,6 +6,7 @@ interface ODtiAction<RESULT, PARAM> {
6
6
  mode?: DtiMode;
7
7
  path?: string;
8
8
  validate?: (p: PARAM) => void;
9
+ sign?: (p: PARAM) => string;
9
10
  }
10
11
  export declare class DtiAction<RESULT, PARAM> {
11
12
  private opt;
@@ -16,6 +17,7 @@ export declare class DtiAction<RESULT, PARAM> {
16
17
  getPath(): string;
17
18
  getFullname(): string;
18
19
  validate(p: PARAM): void;
20
+ sign(p: PARAM): string;
19
21
  static define<RESULT, PARAM>(opt: ODtiAction<RESULT, PARAM>): DtiAction<RESULT, PARAM>;
20
22
  }
21
23
  export {};
package/esm/action.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { DtiMode } from "./common";
2
2
  export class DtiAction {
3
+ opt;
3
4
  constructor(opt) {
4
5
  this.opt = opt;
5
6
  opt.route.regAction(this);
@@ -24,6 +25,12 @@ export class DtiAction {
24
25
  this.opt.validate(p);
25
26
  }
26
27
  }
28
+ sign(p) {
29
+ if (this.opt.sign) {
30
+ return this.opt.sign(p);
31
+ }
32
+ return '';
33
+ }
27
34
  static define(opt) {
28
35
  return new DtiAction(opt);
29
36
  }
package/esm/base62.js CHANGED
@@ -1,8 +1,9 @@
1
1
  import base from 'base-x';
2
2
  export class Base62 {
3
+ convert;
4
+ utf8Encode = new TextEncoder();
5
+ utf8Decoder = new TextDecoder();
3
6
  constructor(ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789') {
4
- this.utf8Encode = new TextEncoder();
5
- this.utf8Decoder = new TextDecoder();
6
7
  this.convert = base(ALPHABET);
7
8
  }
8
9
  encode(str) {
package/esm/response.js CHANGED
@@ -1,9 +1,6 @@
1
- var _a;
2
1
  const key = Symbol.for('DtiRawResponse_key');
3
2
  export class DtiRawResponse {
4
- constructor() {
5
- this[_a] = key;
6
- }
3
+ [key] = key;
7
4
  static is(obj) {
8
5
  if (obj instanceof DtiRawResponse && obj[key] === key) {
9
6
  return true;
@@ -11,4 +8,3 @@ export class DtiRawResponse {
11
8
  return false;
12
9
  }
13
10
  }
14
- _a = key;
package/esm/route.js CHANGED
@@ -1,7 +1,12 @@
1
1
  export class DtiRoute {
2
+ name;
2
3
  constructor(name) {
3
4
  this.name = name;
4
5
  }
6
+ _parent;
7
+ _children;
8
+ _actions;
9
+ path;
5
10
  getChildroutes() {
6
11
  return this._children || [];
7
12
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@napp/dti-core",
3
- "version": "4.4.5",
3
+ "version": "4.5.2",
4
4
  "description": "data transaction interface core library",
5
5
  "repository": {
6
6
  "type": "git",
package/response.js CHANGED
@@ -1,12 +1,9 @@
1
1
  "use strict";
2
- var _a;
3
2
  Object.defineProperty(exports, "__esModule", { value: true });
4
3
  exports.DtiRawResponse = void 0;
5
4
  const key = Symbol.for('DtiRawResponse_key');
6
5
  class DtiRawResponse {
7
- constructor() {
8
- this[_a] = key;
9
- }
6
+ [key] = key;
10
7
  static is(obj) {
11
8
  if (obj instanceof DtiRawResponse && obj[key] === key) {
12
9
  return true;
@@ -15,4 +12,3 @@ class DtiRawResponse {
15
12
  }
16
13
  }
17
14
  exports.DtiRawResponse = DtiRawResponse;
18
- _a = key;
package/route.js CHANGED
@@ -2,9 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DtiRoute = void 0;
4
4
  class DtiRoute {
5
+ name;
5
6
  constructor(name) {
6
7
  this.name = name;
7
8
  }
9
+ _parent;
10
+ _children;
11
+ _actions;
12
+ path;
8
13
  getChildroutes() {
9
14
  return this._children || [];
10
15
  }
@@ -54,10 +59,10 @@ class DtiRoute {
54
59
  }
55
60
  static factory(name, opt) {
56
61
  let route = new DtiRoute(name);
57
- if (opt === null || opt === void 0 ? void 0 : opt.path) {
62
+ if (opt?.path) {
58
63
  route.path = opt.path;
59
64
  }
60
- if (opt === null || opt === void 0 ? void 0 : opt.childrens) {
65
+ if (opt?.childrens) {
61
66
  for (let r of opt.childrens) {
62
67
  route.regChildroute(r);
63
68
  }