@jayfong/x-server 1.28.1 → 1.30.0

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
@@ -2,6 +2,28 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ## [1.30.0](https://github.com/jfWorks/x-server/compare/v1.29.0...v1.30.0) (2022-05-26)
6
+
7
+
8
+ ### Features
9
+
10
+ * add responseDataObfuscate ([2f1a70d](https://github.com/jfWorks/x-server/commit/2f1a70dae70c4359fbb6430ce5391f9d80ec0d17))
11
+ * client_helper ([00146d1](https://github.com/jfWorks/x-server/commit/00146d133167ba8f535bff2acef4ef33412678ba))
12
+
13
+ ## [1.29.0](https://github.com/jfWorks/x-server/compare/v1.28.2...v1.29.0) (2022-05-19)
14
+
15
+
16
+ ### Features
17
+
18
+ * jwt sign support ttl ([2e2958f](https://github.com/jfWorks/x-server/commit/2e2958f564b779838a9ca13a1b8cebc4e2a9bb59))
19
+
20
+ ### [1.28.2](https://github.com/jfWorks/x-server/compare/v1.28.1...v1.28.2) (2022-05-16)
21
+
22
+
23
+ ### Bug Fixes
24
+
25
+ * rhel-openssl-1.1.x ([c2a752a](https://github.com/jfWorks/x-server/commit/c2a752a2c06e8a1e37c3c72154d5f21d801de8a2))
26
+
5
27
  ### [1.28.1](https://github.com/jfWorks/x-server/compare/v1.28.0...v1.28.1) (2022-05-16)
6
28
 
7
29
 
@@ -136,6 +136,7 @@ class BuildUtil {
136
136
 
137
137
  await _fsExtra.default.copyFile(prismaSchemaFile, distPrismaSchemaFile);
138
138
  await _fsExtra.default.copyFile(require.resolve('@prisma/engines/libquery_engine-rhel-openssl-1.0.x.so.node'), _nodePath.default.join(distDir, 'libquery_engine-rhel-openssl-1.0.x.so.node'));
139
+ await _fsExtra.default.copyFile(require.resolve('@prisma/engines/libquery_engine-rhel-openssl-1.1.x.so.node'), _nodePath.default.join(distDir, 'libquery_engine-rhel-openssl-1.1.x.so.node'));
139
140
  } // 写入 pkg
140
141
 
141
142
 
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.XServerClientHelper = void 0;
5
+
6
+ var _vtils = require("vtils");
7
+
8
+ var _shorty = require("./utils/shorty");
9
+
10
+ class XServerClientHelper {
11
+ static processResponse(data) {
12
+ // 处理混淆
13
+ // _#
14
+ const shortyKey = String.fromCharCode(95) + String.fromCharCode(35);
15
+
16
+ if (data && typeof data === 'object' && data[shortyKey] != null) {
17
+ try {
18
+ data = JSON.parse(new _shorty.Shorty().decode(data[shortyKey]));
19
+ } catch {}
20
+ } // 处理数组打包
21
+
22
+
23
+ data = _vtils.DataPacker.unpackIfNeeded(data);
24
+ return data;
25
+ }
26
+
27
+ }
28
+
29
+ exports.XServerClientHelper = XServerClientHelper;
@@ -9,6 +9,8 @@ var _dispose = require("../services/dispose");
9
9
 
10
10
  var _http_error = require("../core/http_error");
11
11
 
12
+ var _shorty = require("../utils/shorty");
13
+
12
14
  var _validator = require("vtils/validator");
13
15
 
14
16
  class Handler {
@@ -52,6 +54,13 @@ class Handler {
52
54
 
53
55
  if (this.options.responseDataPack) {
54
56
  res = _vtils.DataPacker.packAsRawType(res);
57
+ } // 混淆返回数据
58
+
59
+
60
+ if (this.options.responseDataObfuscate) {
61
+ res = {
62
+ '_#': new _shorty.Shorty().encode(JSON.stringify(res))
63
+ };
55
64
  }
56
65
 
57
66
  return res == null ? {} : res;
@@ -17,9 +17,9 @@ class JwtService {
17
17
  this.serviceName = 'jwt';
18
18
  }
19
19
 
20
- sign(payload) {
20
+ sign(payload, ttl = this.options.ttl) {
21
21
  return _jsonwebtoken.default.sign(payload, this.options.secret, {
22
- expiresIn: (0, _date.ms)(this.options.ttl, true)
22
+ expiresIn: (0, _date.ms)(ttl, true)
23
23
  });
24
24
  }
25
25
 
@@ -0,0 +1,236 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.Shorty = void 0;
5
+
6
+ /* eslint-disable */
7
+ // @ts-nocheck
8
+ // https://github.com/enkimute/shorty.js
9
+ function ShortyRaw(tokensize) {
10
+ this.tokensize = tokensize || 10;
11
+ this.reset(true);
12
+ }
13
+
14
+ ShortyRaw.prototype.reset = function (full) {
15
+ if (full === true) {
16
+ this.nodes = [{
17
+ up: 0,
18
+ weight: 0
19
+ }];
20
+ this.nyt = 0;
21
+ this.nodecount = 0;
22
+ }
23
+
24
+ this.data = '';
25
+ this.curpos = 0;
26
+ this.bitCount = 7;
27
+ this.bitChar = 0;
28
+ };
29
+
30
+ ShortyRaw.prototype.findNode = function (x) {
31
+ for (let i = this.nodes.length - 1; i > 0; i--) if (typeof this.nodes[i].symbol != 'undefined' && this.nodes[i].symbol == x) return i;
32
+
33
+ return 0;
34
+ };
35
+
36
+ ShortyRaw.prototype.addNode = function (token) {
37
+ if (this.nodecount >= 2046) return 0;
38
+ this.nodes[++this.nodecount] = {
39
+ up: this.nyt,
40
+ symbol: token,
41
+ weight: 1
42
+ };
43
+ this.nodes[++this.nodecount] = {
44
+ up: this.nyt,
45
+ weight: 0
46
+ };
47
+ this.nodes[this.nyt].weight += 1;
48
+ this.nyt = this.nodecount;
49
+ if (this.nodes[this.nodecount - 2].up != this.nodecount - 2) this.balanceNode(this.nodes[this.nodecount - 2].up);
50
+ return this.nodecount - 2;
51
+ };
52
+
53
+ ShortyRaw.prototype.swapNode = function (a, b) {
54
+ const t = this.nodes[a].symbol;
55
+ const u = this.nodes[b].symbol;
56
+ const v = this.nodes[a].weight;
57
+ this.nodes[a].symbol = u;
58
+ this.nodes[b].symbol = t;
59
+ this.nodes[a].weight = this.nodes[b].weight;
60
+ this.nodes[b].weight = v;
61
+
62
+ for (let n = this.nodes.length - 1; n > 0; n--) if (this.nodes[n].up == a) this.nodes[n].up = b;else if (this.nodes[n].up == b) this.nodes[n].up = a;
63
+ };
64
+
65
+ ShortyRaw.prototype.balanceNode = function (node) {
66
+ while (true) {
67
+ let minnr = node;
68
+ const weight = this.nodes[node].weight;
69
+
70
+ while (minnr > 1 && this.nodes[minnr - 1].weight == weight) minnr--;
71
+
72
+ if (minnr != node && minnr != this.nodes[node].up) {
73
+ this.swapNode(minnr, node);
74
+ node = minnr;
75
+ }
76
+
77
+ this.nodes[node].weight++;
78
+ if (this.nodes[node].up == node) return;
79
+ node = this.nodes[node].up;
80
+ }
81
+ };
82
+
83
+ ShortyRaw.prototype.emitNode = function (node) {
84
+ const emit = [];
85
+
86
+ while (node != 0) {
87
+ emit.unshift(node % 2);
88
+ node = this.nodes[node].up;
89
+ }
90
+
91
+ for (let e = 0; e < emit.length; e++) this.emitBit(emit[e]);
92
+ };
93
+
94
+ ShortyRaw.prototype.emitNyt = function (token) {
95
+ this.emitNode(this.nyt);
96
+ const ll = token.length - 1;
97
+ if (this.tokensize > 8) this.emitBit(ll & 8);
98
+ if (this.tokensize > 4) this.emitBit(ll & 4);
99
+ if (this.tokensize > 2) this.emitBit(ll & 2);
100
+ if (this.tokensize > 1) this.emitBit(ll & 1);
101
+
102
+ for (let cc = 0; cc < token.length; cc++) this.emitByte(token.charCodeAt(cc));
103
+
104
+ return this.nyt;
105
+ };
106
+
107
+ ShortyRaw.prototype.readNode = function () {
108
+ if (this.nyt == 0) {
109
+ var len = (this.tokensize > 8 ? this.readBit() * 8 : 0) + (this.tokensize > 4 ? this.readBit() * 4 : 0) + (this.tokensize > 2 ? this.readBit() * 2 : 0) + (this.tokensize > 1 ? this.readBit() : 0) + 1;
110
+ var stream = '';
111
+
112
+ while (len--) stream += this.readByte();
113
+
114
+ return stream;
115
+ }
116
+
117
+ let node = 0;
118
+
119
+ while (true) {
120
+ const bit = this.readBit();
121
+ if (this.nodes[node].symbol == undefined) for (let m = 0;; m++) if (this.nodes[m].up == node && m != node && m % 2 == bit) {
122
+ node = m;
123
+ break;
124
+ }
125
+
126
+ if (this.nodes[node].symbol != undefined || this.nodes[node].weight == 0) {
127
+ if (this.nodes[node].weight) return this.nodes[node].symbol;
128
+ var len = (this.tokensize > 8 ? this.readBit() * 8 : 0) + (this.tokensize > 4 ? this.readBit() * 4 : 0) + (this.tokensize > 2 ? this.readBit() * 2 : 0) + (this.tokensize > 1 ? this.readBit() : 0) + 1;
129
+ var stream = '';
130
+
131
+ while (len--) stream += this.readByte();
132
+
133
+ return stream;
134
+ }
135
+ }
136
+ };
137
+
138
+ ShortyRaw.prototype.emitBit = function (bit) {
139
+ if (bit) this.bitChar += 1 << this.bitCount;
140
+
141
+ if (--this.bitCount < 0) {
142
+ this.data += String.fromCharCode(this.bitChar);
143
+ this.bitCount = 7;
144
+ this.bitChar = 0;
145
+ }
146
+ };
147
+
148
+ ShortyRaw.prototype.emitByte = function (byte) {
149
+ for (let i = 7; i >= 0; i--) {
150
+ this.emitBit(byte >> i & 1);
151
+ }
152
+ };
153
+
154
+ ShortyRaw.prototype.readBit = function () {
155
+ if (this.curpos == this.data.length * 8) throw 'done';
156
+ const bit = this.data.charCodeAt(this.curpos >> 3) >> (7 - this.curpos & 7) & 1;
157
+ this.curpos++;
158
+ return bit;
159
+ };
160
+
161
+ ShortyRaw.prototype.readByte = function () {
162
+ res = 0;
163
+
164
+ for (let i = 0; i < 8; i++) res += (128 >> i) * this.readBit();
165
+
166
+ return String.fromCharCode(res);
167
+ };
168
+
169
+ ShortyRaw.prototype.deflate = function (data) {
170
+ let token,
171
+ l = data.length,
172
+ i,
173
+ x;
174
+ this.reset();
175
+
176
+ for (i = 0; i < l; i++) {
177
+ token = data[i];
178
+
179
+ if (this.tokensize > 1) {
180
+ if (/[a-zA-Z]/.test(token)) while (i + 1 < l && token.length < this.tokensize && /[a-zA-Z]/.test(data[i + 1])) {
181
+ token += data[++i];
182
+ } else if (/[=\[\],\.:\"'\{\}]/.test(token)) while (i + 1 < l && token.length < this.tokensize && /[=\[\],\.:\"'\{\}]/.test(data[i + 1])) {
183
+ i++;
184
+ token += data[i];
185
+ } //joe hl patch "
186
+ }
187
+
188
+ x = this.findNode(token);
189
+
190
+ if (!x) {
191
+ this.emitNyt(token);
192
+ x = this.addNode(token);
193
+ } else {
194
+ this.emitNode(x);
195
+ this.balanceNode(x);
196
+ }
197
+ }
198
+
199
+ if (this.bitCount != 7) {
200
+ const oldlength = this.data.length;
201
+ this.emitNode(this.nyt);
202
+ if (oldlength == this.data.length) this.emitByte(0);
203
+ }
204
+
205
+ return this.data;
206
+ };
207
+
208
+ ShortyRaw.prototype.inflate = function (data) {
209
+ this.reset();
210
+ this.data = data;
211
+ let output = '';
212
+
213
+ try {
214
+ for (let i = 0; i >= 0; i++) {
215
+ const token = this.readNode();
216
+ output += token;
217
+ const node = this.findNode(token);
218
+ if (!node) this.addNode(token);else this.balanceNode(node);
219
+ }
220
+ } catch (e) {}
221
+
222
+ return output;
223
+ };
224
+
225
+ class Shorty extends ShortyRaw {
226
+ encode(data) {
227
+ return this.inflate(data);
228
+ }
229
+
230
+ decode(data) {
231
+ return this.deflate(data);
232
+ }
233
+
234
+ }
235
+
236
+ exports.Shorty = Shorty;
@@ -110,6 +110,7 @@ export class BuildUtil {
110
110
  const distPrismaSchemaFile = path.join(distDir, 'schema.prisma');
111
111
  await fs.copyFile(prismaSchemaFile, distPrismaSchemaFile);
112
112
  await fs.copyFile(require.resolve('@prisma/engines/libquery_engine-rhel-openssl-1.0.x.so.node'), path.join(distDir, 'libquery_engine-rhel-openssl-1.0.x.so.node'));
113
+ await fs.copyFile(require.resolve('@prisma/engines/libquery_engine-rhel-openssl-1.1.x.so.node'), path.join(distDir, 'libquery_engine-rhel-openssl-1.1.x.so.node'));
113
114
  } // 写入 pkg
114
115
 
115
116
 
@@ -0,0 +1,3 @@
1
+ export declare class XServerClientHelper {
2
+ static processResponse<T>(data: any): T;
3
+ }
@@ -0,0 +1,20 @@
1
+ import { DataPacker } from 'vtils';
2
+ import { Shorty } from "./utils/shorty";
3
+ export class XServerClientHelper {
4
+ static processResponse(data) {
5
+ // 处理混淆
6
+ // _#
7
+ const shortyKey = String.fromCharCode(95) + String.fromCharCode(35);
8
+
9
+ if (data && typeof data === 'object' && data[shortyKey] != null) {
10
+ try {
11
+ data = JSON.parse(new Shorty().decode(data[shortyKey]));
12
+ } catch {}
13
+ } // 处理数组打包
14
+
15
+
16
+ data = DataPacker.unpackIfNeeded(data);
17
+ return data;
18
+ }
19
+
20
+ }
@@ -1,6 +1,7 @@
1
1
  import { DataPacker } from 'vtils';
2
2
  import { DisposeService } from "../services/dispose";
3
3
  import { HttpError } from "../core/http_error";
4
+ import { Shorty } from "../utils/shorty";
4
5
  import { yup } from 'vtils/validator';
5
6
  export class Handler {
6
7
  constructor(options) {
@@ -43,6 +44,13 @@ export class Handler {
43
44
 
44
45
  if (this.options.responseDataPack) {
45
46
  res = DataPacker.packAsRawType(res);
47
+ } // 混淆返回数据
48
+
49
+
50
+ if (this.options.responseDataObfuscate) {
51
+ res = {
52
+ '_#': new Shorty().encode(JSON.stringify(res))
53
+ };
46
54
  }
47
55
 
48
56
  return res == null ? {} : res;
@@ -111,6 +111,12 @@ export declare namespace XHandler {
111
111
  * @default false
112
112
  */
113
113
  responseDataPack?: boolean;
114
+ /**
115
+ * 是否混淆返回数据
116
+ *
117
+ * @default false
118
+ */
119
+ responseDataObfuscate?: boolean;
114
120
  /**
115
121
  * 响应的 Content-Type 头
116
122
  */
@@ -10,7 +10,7 @@ export declare class JwtService implements BaseService {
10
10
  private options;
11
11
  serviceName: string;
12
12
  constructor(options: JwtServiceOptions);
13
- sign<T extends Record<string, any>>(payload: T): string;
13
+ sign<T extends Record<string, any>>(payload: T, ttl?: MsValue): string;
14
14
  verify<T extends Record<string, any>>(token: string): Promise<T>;
15
15
  verifyFromHttpHeaders<T extends Record<string, any>>(headers: IncomingHttpHeaders): Promise<T>;
16
16
  }
@@ -7,9 +7,9 @@ export class JwtService {
7
7
  this.serviceName = 'jwt';
8
8
  }
9
9
 
10
- sign(payload) {
10
+ sign(payload, ttl = this.options.ttl) {
11
11
  return jwt.sign(payload, this.options.secret, {
12
- expiresIn: ms(this.options.ttl, true)
12
+ expiresIn: ms(ttl, true)
13
13
  });
14
14
  }
15
15
 
@@ -0,0 +1,6 @@
1
+ declare function ShortyRaw(tokensize: any): void;
2
+ export declare class Shorty extends ShortyRaw {
3
+ encode(data: string): string;
4
+ decode(data: string): string;
5
+ }
6
+ export {};
@@ -0,0 +1,229 @@
1
+ /* eslint-disable */
2
+ // @ts-nocheck
3
+ // https://github.com/enkimute/shorty.js
4
+ function ShortyRaw(tokensize) {
5
+ this.tokensize = tokensize || 10;
6
+ this.reset(true);
7
+ }
8
+
9
+ ShortyRaw.prototype.reset = function (full) {
10
+ if (full === true) {
11
+ this.nodes = [{
12
+ up: 0,
13
+ weight: 0
14
+ }];
15
+ this.nyt = 0;
16
+ this.nodecount = 0;
17
+ }
18
+
19
+ this.data = '';
20
+ this.curpos = 0;
21
+ this.bitCount = 7;
22
+ this.bitChar = 0;
23
+ };
24
+
25
+ ShortyRaw.prototype.findNode = function (x) {
26
+ for (let i = this.nodes.length - 1; i > 0; i--) if (typeof this.nodes[i].symbol != 'undefined' && this.nodes[i].symbol == x) return i;
27
+
28
+ return 0;
29
+ };
30
+
31
+ ShortyRaw.prototype.addNode = function (token) {
32
+ if (this.nodecount >= 2046) return 0;
33
+ this.nodes[++this.nodecount] = {
34
+ up: this.nyt,
35
+ symbol: token,
36
+ weight: 1
37
+ };
38
+ this.nodes[++this.nodecount] = {
39
+ up: this.nyt,
40
+ weight: 0
41
+ };
42
+ this.nodes[this.nyt].weight += 1;
43
+ this.nyt = this.nodecount;
44
+ if (this.nodes[this.nodecount - 2].up != this.nodecount - 2) this.balanceNode(this.nodes[this.nodecount - 2].up);
45
+ return this.nodecount - 2;
46
+ };
47
+
48
+ ShortyRaw.prototype.swapNode = function (a, b) {
49
+ const t = this.nodes[a].symbol;
50
+ const u = this.nodes[b].symbol;
51
+ const v = this.nodes[a].weight;
52
+ this.nodes[a].symbol = u;
53
+ this.nodes[b].symbol = t;
54
+ this.nodes[a].weight = this.nodes[b].weight;
55
+ this.nodes[b].weight = v;
56
+
57
+ for (let n = this.nodes.length - 1; n > 0; n--) if (this.nodes[n].up == a) this.nodes[n].up = b;else if (this.nodes[n].up == b) this.nodes[n].up = a;
58
+ };
59
+
60
+ ShortyRaw.prototype.balanceNode = function (node) {
61
+ while (true) {
62
+ let minnr = node;
63
+ const weight = this.nodes[node].weight;
64
+
65
+ while (minnr > 1 && this.nodes[minnr - 1].weight == weight) minnr--;
66
+
67
+ if (minnr != node && minnr != this.nodes[node].up) {
68
+ this.swapNode(minnr, node);
69
+ node = minnr;
70
+ }
71
+
72
+ this.nodes[node].weight++;
73
+ if (this.nodes[node].up == node) return;
74
+ node = this.nodes[node].up;
75
+ }
76
+ };
77
+
78
+ ShortyRaw.prototype.emitNode = function (node) {
79
+ const emit = [];
80
+
81
+ while (node != 0) {
82
+ emit.unshift(node % 2);
83
+ node = this.nodes[node].up;
84
+ }
85
+
86
+ for (let e = 0; e < emit.length; e++) this.emitBit(emit[e]);
87
+ };
88
+
89
+ ShortyRaw.prototype.emitNyt = function (token) {
90
+ this.emitNode(this.nyt);
91
+ const ll = token.length - 1;
92
+ if (this.tokensize > 8) this.emitBit(ll & 8);
93
+ if (this.tokensize > 4) this.emitBit(ll & 4);
94
+ if (this.tokensize > 2) this.emitBit(ll & 2);
95
+ if (this.tokensize > 1) this.emitBit(ll & 1);
96
+
97
+ for (let cc = 0; cc < token.length; cc++) this.emitByte(token.charCodeAt(cc));
98
+
99
+ return this.nyt;
100
+ };
101
+
102
+ ShortyRaw.prototype.readNode = function () {
103
+ if (this.nyt == 0) {
104
+ var len = (this.tokensize > 8 ? this.readBit() * 8 : 0) + (this.tokensize > 4 ? this.readBit() * 4 : 0) + (this.tokensize > 2 ? this.readBit() * 2 : 0) + (this.tokensize > 1 ? this.readBit() : 0) + 1;
105
+ var stream = '';
106
+
107
+ while (len--) stream += this.readByte();
108
+
109
+ return stream;
110
+ }
111
+
112
+ let node = 0;
113
+
114
+ while (true) {
115
+ const bit = this.readBit();
116
+ if (this.nodes[node].symbol == undefined) for (let m = 0;; m++) if (this.nodes[m].up == node && m != node && m % 2 == bit) {
117
+ node = m;
118
+ break;
119
+ }
120
+
121
+ if (this.nodes[node].symbol != undefined || this.nodes[node].weight == 0) {
122
+ if (this.nodes[node].weight) return this.nodes[node].symbol;
123
+ var len = (this.tokensize > 8 ? this.readBit() * 8 : 0) + (this.tokensize > 4 ? this.readBit() * 4 : 0) + (this.tokensize > 2 ? this.readBit() * 2 : 0) + (this.tokensize > 1 ? this.readBit() : 0) + 1;
124
+ var stream = '';
125
+
126
+ while (len--) stream += this.readByte();
127
+
128
+ return stream;
129
+ }
130
+ }
131
+ };
132
+
133
+ ShortyRaw.prototype.emitBit = function (bit) {
134
+ if (bit) this.bitChar += 1 << this.bitCount;
135
+
136
+ if (--this.bitCount < 0) {
137
+ this.data += String.fromCharCode(this.bitChar);
138
+ this.bitCount = 7;
139
+ this.bitChar = 0;
140
+ }
141
+ };
142
+
143
+ ShortyRaw.prototype.emitByte = function (byte) {
144
+ for (let i = 7; i >= 0; i--) {
145
+ this.emitBit(byte >> i & 1);
146
+ }
147
+ };
148
+
149
+ ShortyRaw.prototype.readBit = function () {
150
+ if (this.curpos == this.data.length * 8) throw 'done';
151
+ const bit = this.data.charCodeAt(this.curpos >> 3) >> (7 - this.curpos & 7) & 1;
152
+ this.curpos++;
153
+ return bit;
154
+ };
155
+
156
+ ShortyRaw.prototype.readByte = function () {
157
+ res = 0;
158
+
159
+ for (let i = 0; i < 8; i++) res += (128 >> i) * this.readBit();
160
+
161
+ return String.fromCharCode(res);
162
+ };
163
+
164
+ ShortyRaw.prototype.deflate = function (data) {
165
+ let token,
166
+ l = data.length,
167
+ i,
168
+ x;
169
+ this.reset();
170
+
171
+ for (i = 0; i < l; i++) {
172
+ token = data[i];
173
+
174
+ if (this.tokensize > 1) {
175
+ if (/[a-zA-Z]/.test(token)) while (i + 1 < l && token.length < this.tokensize && /[a-zA-Z]/.test(data[i + 1])) {
176
+ token += data[++i];
177
+ } else if (/[=\[\],\.:\"'\{\}]/.test(token)) while (i + 1 < l && token.length < this.tokensize && /[=\[\],\.:\"'\{\}]/.test(data[i + 1])) {
178
+ i++;
179
+ token += data[i];
180
+ } //joe hl patch "
181
+ }
182
+
183
+ x = this.findNode(token);
184
+
185
+ if (!x) {
186
+ this.emitNyt(token);
187
+ x = this.addNode(token);
188
+ } else {
189
+ this.emitNode(x);
190
+ this.balanceNode(x);
191
+ }
192
+ }
193
+
194
+ if (this.bitCount != 7) {
195
+ const oldlength = this.data.length;
196
+ this.emitNode(this.nyt);
197
+ if (oldlength == this.data.length) this.emitByte(0);
198
+ }
199
+
200
+ return this.data;
201
+ };
202
+
203
+ ShortyRaw.prototype.inflate = function (data) {
204
+ this.reset();
205
+ this.data = data;
206
+ let output = '';
207
+
208
+ try {
209
+ for (let i = 0; i >= 0; i++) {
210
+ const token = this.readNode();
211
+ output += token;
212
+ const node = this.findNode(token);
213
+ if (!node) this.addNode(token);else this.balanceNode(node);
214
+ }
215
+ } catch (e) {}
216
+
217
+ return output;
218
+ };
219
+
220
+ export class Shorty extends ShortyRaw {
221
+ encode(data) {
222
+ return this.inflate(data);
223
+ }
224
+
225
+ decode(data) {
226
+ return this.deflate(data);
227
+ }
228
+
229
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jayfong/x-server",
3
- "version": "1.28.1",
3
+ "version": "1.30.0",
4
4
  "license": "ISC",
5
5
  "sideEffects": false,
6
6
  "main": "lib/_cjs/index.js",
@@ -16,7 +16,7 @@
16
16
  "bootstrap": "tyn --frozen-lockfile",
17
17
  "build": "haoma compile",
18
18
  "dev": "rm -rf lib && tsc -w -p ./tsconfig.build.json",
19
- "release": "tyn test && standard-version -a && tyn build && npm publish && git push --follow-tags origin master",
19
+ "release": "tyn test && standard-version -a && tyn build && npm publish && haoma run ./scripts/publish_client_helper_package.ts && git push --follow-tags origin master",
20
20
  "test": "tsc --noEmit && jest",
21
21
  "updeps": "tnpx npm-check-updates --target minor --upgrade"
22
22
  },