@napp/dti-core 4.2.2 → 4.3.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/base62.d.ts +9 -0
- package/base62.js +26 -0
- package/common.js +1 -1
- package/index.d.ts +2 -0
- package/index.js +2 -0
- package/package.json +5 -1
- package/response.d.ts +6 -0
- package/response.js +18 -0
package/base62.d.ts
ADDED
package/base62.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Base62 = void 0;
|
|
7
|
+
require("fast-text-encoding");
|
|
8
|
+
const base_x_1 = __importDefault(require("base-x"));
|
|
9
|
+
class Base62 {
|
|
10
|
+
constructor(ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789') {
|
|
11
|
+
this.utf8Encode = new TextEncoder();
|
|
12
|
+
this.utf8Decoder = new TextDecoder();
|
|
13
|
+
this.convert = (0, base_x_1.default)(ALPHABET);
|
|
14
|
+
}
|
|
15
|
+
encode(str) {
|
|
16
|
+
let bytes = this.utf8Encode.encode(str);
|
|
17
|
+
let txt = this.convert.encode(bytes);
|
|
18
|
+
return txt;
|
|
19
|
+
}
|
|
20
|
+
decode(str) {
|
|
21
|
+
let bytes = this.convert.decode(str);
|
|
22
|
+
let txt = this.utf8Decoder.decode(bytes);
|
|
23
|
+
return txt;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.Base62 = Base62;
|
package/common.js
CHANGED
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -17,3 +17,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./common"), exports);
|
|
18
18
|
__exportStar(require("./action"), exports);
|
|
19
19
|
__exportStar(require("./route"), exports);
|
|
20
|
+
__exportStar(require("./response"), exports);
|
|
21
|
+
__exportStar(require("./base62"), exports);
|
package/package.json
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@napp/dti-core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.2",
|
|
4
4
|
"description": "data transaction interface core library",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/napp-core/dti.git"
|
|
8
8
|
},
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"base-x": "latest",
|
|
11
|
+
"fast-text-encoding": "latest"
|
|
12
|
+
},
|
|
9
13
|
"types": "index.d.ts",
|
|
10
14
|
"main": "index.js",
|
|
11
15
|
"keywords": [
|
package/response.d.ts
ADDED
package/response.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.DtiRawResponse = void 0;
|
|
5
|
+
const key = Symbol.for('DtiRawResponse_key');
|
|
6
|
+
class DtiRawResponse {
|
|
7
|
+
constructor() {
|
|
8
|
+
this[_a] = key;
|
|
9
|
+
}
|
|
10
|
+
static is(obj) {
|
|
11
|
+
if (obj instanceof DtiRawResponse && obj[key] === key) {
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.DtiRawResponse = DtiRawResponse;
|
|
18
|
+
_a = key;
|