@napp/dti-core 4.4.5 → 4.5.4
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 +2 -0
- package/action.js +6 -0
- package/esm/action.d.ts +2 -0
- package/esm/action.js +7 -0
- package/esm/base62.js +3 -2
- package/esm/response.js +1 -5
- package/esm/route.js +5 -0
- package/package.json +1 -1
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
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
|
-
|
|
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