@aj-shadow/z-abs-corelayer-client 0.0.0-aj-beta.221

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.
Files changed (52) hide show
  1. package/.gitattributes +26 -0
  2. package/LICENSE.txt +96 -0
  3. package/README.md +5 -0
  4. package/npm-shrinkwrap.json +13 -0
  5. package/package.json +10 -0
  6. package/project/client/_build/Bundle-CoreLayer-client.bld +28 -0
  7. package/project/client/_build/Client-CoreLayer-client-jsx.bld +10 -0
  8. package/project/client/_build/Client-CoreLayer-client.bld +10 -0
  9. package/project/client/_build/Client-css-CoreLayer-bundle.bld +9 -0
  10. package/project/client/_build/z-abs-corelayer-client.prj +36 -0
  11. package/project/client/actions/action-client.js +19 -0
  12. package/project/client/actions/action-dialog-file.js +31 -0
  13. package/project/client/communication/action.js +59 -0
  14. package/project/client/communication/core-protocol/decoder.js +412 -0
  15. package/project/client/communication/core-protocol/encoder.js +553 -0
  16. package/project/client/communication/core-protocol/pooled-buffers.js +51 -0
  17. package/project/client/communication/core-protocol/pooled-decoder.js +396 -0
  18. package/project/client/communication/core-protocol/pooled-encoder.js +505 -0
  19. package/project/client/communication/data-action-multi.js +11 -0
  20. package/project/client/communication/data-action.js +37 -0
  21. package/project/client/communication/data-config.js +36 -0
  22. package/project/client/communication/data-fetcher-thread.js +46 -0
  23. package/project/client/communication/data-fetcher.js +58 -0
  24. package/project/client/communication/messages/messages-c-to-s/message-persistent-init-request.js +16 -0
  25. package/project/client/communication/messages/messages-client/message-realtime-closed.js +12 -0
  26. package/project/client/communication/messages/messages-client/message-realtime-error.js +12 -0
  27. package/project/client/communication/messages/messages-client/message-realtime-open.js +12 -0
  28. package/project/client/communication/realtime-action.js +42 -0
  29. package/project/client/communication/subscription-action.js +21 -0
  30. package/project/client/components/helper-tab.js +40 -0
  31. package/project/client/components/not-found.jsx +38 -0
  32. package/project/client/css/not-found.css +9 -0
  33. package/project/client/react-component/context.js +26 -0
  34. package/project/client/react-component/react-component-base.js +225 -0
  35. package/project/client/react-component/react-component-realtime-renderer.js +86 -0
  36. package/project/client/react-component/react-component-realtime.js +200 -0
  37. package/project/client/react-component/react-component-store.js +62 -0
  38. package/project/client/state/state-updater.js +389 -0
  39. package/project/client/state/verbose.js +28 -0
  40. package/project/client/store/store-base-data.js +136 -0
  41. package/project/client/store/store-base-realtime-worker-thread.js +26 -0
  42. package/project/client/store/store-base-realtime.js +265 -0
  43. package/project/client/store/store-base.js +217 -0
  44. package/project/client/stores/client-store.js +25 -0
  45. package/project/client/stores/dialog-file-store.js +86 -0
  46. package/project/client/worker/worker-main-core-protocol.js +47 -0
  47. package/project/client/worker/worker-main-websocket.js +64 -0
  48. package/project/client/worker/worker-main.js +86 -0
  49. package/project/client/worker/worker-thread-core-protocol.js +74 -0
  50. package/project/client/worker/worker-thread-websocket.js +83 -0
  51. package/project/client/worker/worker-thread.js +71 -0
  52. package/project/z-abs-corelayer-client.tree +61 -0
@@ -0,0 +1,412 @@
1
+
2
+ 'use strict';
3
+
4
+
5
+ class Decoder {
6
+ static GuidSize = 16;
7
+ static guidLookup = [48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102];
8
+ static textDecoder = new TextDecoder();
9
+
10
+ constructor(textCache, buffer) {
11
+ this.textCache = textCache;
12
+ this.dataView = buffer ? (buffer instanceof ArrayBuffer ? new DataView(buffer) : new DataView(buffer.buffer, buffer.byteOffset)) : null;
13
+ this.offset = 0;
14
+ this.buffer = null;
15
+ this.buffers = [];
16
+ }
17
+
18
+ inc(i) {
19
+ this.offset += i;
20
+ }
21
+
22
+ guidSize() {
23
+ return Decoder.GuidSize;
24
+ }
25
+
26
+ clear() {
27
+ this.dataView = null;
28
+ this.offset = 0;
29
+ this.buffer = null;
30
+ this.buffers = [];
31
+ }
32
+
33
+ add(buffer) {
34
+ if(buffer) {
35
+ this.buffers.push(buffer);
36
+ }
37
+ }
38
+
39
+ parse(jsonFunc) {
40
+ try {
41
+ const data = JSON.parse(this.buffer, jsonFunc);
42
+ this.clear();
43
+ return data;
44
+ }
45
+ catch(err) {
46
+ return null;
47
+ }
48
+ }
49
+
50
+ has(size) {
51
+ if(!this.dataView) {
52
+ if(0 !== this.buffers.length) {
53
+ this.buffer = this.buffers.shift();
54
+ if(this.buffer instanceof ArrayBuffer) {
55
+ this.dataView = new DataView(this.buffer);
56
+ }
57
+ else {
58
+ this.dataView = new DataView(this.buffer.buffer, this.buffer.byteOffset, this.buffer.byteLength);
59
+ }
60
+ }
61
+ else {
62
+ return false;
63
+ }
64
+ }
65
+ return size <= this.dataView.byteLength - this.offset;
66
+ }
67
+
68
+ got() {
69
+ if(this.dataView.byteLength === this.offset) {
70
+ this.dataView = null;
71
+ this.offset = 0;
72
+ this.buffer = null;
73
+ }
74
+ }
75
+
76
+ calculateDynamicBytes() {
77
+ const size = this.dataView.getUint8(this.offset);
78
+ if(size <= 253) {
79
+ return 1;
80
+ }
81
+ else if(size <= 65535) {
82
+ return 3;
83
+ }
84
+ else {
85
+ return 5;
86
+ }
87
+ }
88
+
89
+ getDynamicBytes() {
90
+ const size = this.getUint8();
91
+ if(size <= 253) {
92
+ return size;
93
+ }
94
+ if(254 === size) {
95
+ return this.getUint16();
96
+ }
97
+ else if(255 === size) {
98
+ return this.getUint32();
99
+ }
100
+ }
101
+
102
+ getInt8() {
103
+ const value = this.dataView.getInt8(this.offset);
104
+ this.offset += 1;
105
+ return value;
106
+ }
107
+
108
+ getInt16() {
109
+ const value = this.dataView.getInt16(this.offset);
110
+ this.offset += 2;
111
+ return value;
112
+ }
113
+
114
+ getInt32() {
115
+ const value = this.dataView.getInt32(this.offset);
116
+ this.offset += 4;
117
+ return value;
118
+ }
119
+
120
+ getBigInt64() {
121
+ const value = this.dataView.getBigInt64(this.offset);
122
+ this.offset += 8;
123
+ return value;
124
+ }
125
+
126
+ getUint1_0(ready) {
127
+ const value = this.dataView.getUint8(this.offset);
128
+ if(ready) {
129
+ this.offset += 1;
130
+ }
131
+ return (0x1 & (value >> 7));
132
+ }
133
+
134
+ getUint1_1(ready) {
135
+ const value = this.dataView.getUint8(this.offset);
136
+ if(ready) {
137
+ this.offset += 1;
138
+ }
139
+ return (0x1 & (value >> 6));
140
+ }
141
+
142
+ getUint1_2(ready) {
143
+ const value = this.dataView.getUint8(this.offset);
144
+ if(ready) {
145
+ this.offset += 1;
146
+ }
147
+ return (0x1 & (value >> 5));
148
+ }
149
+
150
+ getUint1_3(ready) {
151
+ const value = this.dataView.getUint8(this.offset);
152
+ if(ready) {
153
+ this.offset += 1;
154
+ }
155
+ return (0x1 & (value >> 4));
156
+ }
157
+
158
+ getUint1_4(ready) {
159
+ const value = this.dataView.getUint8(this.offset);
160
+ if(ready) {
161
+ this.offset += 1;
162
+ }
163
+ return (0x1 & (value >> 3));
164
+ }
165
+
166
+ getUint1_5(ready) {
167
+ const value = this.dataView.getUint8(this.offset);
168
+ if(ready) {
169
+ this.offset += 1;
170
+ }
171
+ return (0x1 & (value >> 2));
172
+ }
173
+
174
+ getUint1_6(ready) {
175
+ const value = this.dataView.getUint8(this.offset);
176
+ if(ready) {
177
+ this.offset += 1;
178
+ }
179
+ return (0x1 & (value >> 1));
180
+ }
181
+
182
+ getUint1_7(ready) {
183
+ const value = this.dataView.getUint8(this.offset);
184
+ if(ready) {
185
+ this.offset += 1;
186
+ }
187
+ return (0x1 & value);
188
+ }
189
+
190
+ getUint2_0(ready) {
191
+ const value = this.dataView.getUint8(this.offset);
192
+ if(ready) {
193
+ this.offset += 1;
194
+ }
195
+ return (0x3 & (value >> 6));
196
+ }
197
+
198
+ getUint2_1(ready) {
199
+ const value = this.dataView.getUint8(this.offset);
200
+ if(ready) {
201
+ this.offset += 1;
202
+ }
203
+ return (0x3 & (value >> 4));
204
+ }
205
+
206
+ getUint2_2(ready) {
207
+ const value = this.dataView.getUint8(this.offset);
208
+ if(ready) {
209
+ this.offset += 1;
210
+ }
211
+ return (0x3 & (value >> 2));
212
+ }
213
+
214
+ getUint2_3(ready) {
215
+ const value = this.dataView.getUint8(this.offset);
216
+ if(ready) {
217
+ this.offset += 1;
218
+ }
219
+ return (0x3 & value);
220
+ }
221
+
222
+ getUint4_0(ready) {
223
+ const value = this.dataView.getUint8(this.offset);
224
+ if(ready) {
225
+ this.offset += 1;
226
+ }
227
+ return (0xf & (value >> 4));
228
+ }
229
+
230
+ getUint4_1() {
231
+ const value = this.dataView.getUint8(this.offset);
232
+ this.offset += 1;
233
+ return 0xf & value;
234
+ }
235
+
236
+ getUint8() {
237
+ const value = this.dataView.getUint8(this.offset);
238
+ this.offset += 1;
239
+ return value;
240
+ }
241
+
242
+ getUint16() {
243
+ const value = this.dataView.getUint16(this.offset);
244
+ this.offset += 2;
245
+ return value;
246
+ }
247
+
248
+ getUint32() {
249
+ const value = this.dataView.getUint32(this.offset);
250
+ this.offset += 4;
251
+ return value;
252
+ }
253
+
254
+ getBigUint64() {
255
+ const value = this.dataView.getBigUint64(this.offset);
256
+ this.offset += 8;
257
+ return value;
258
+ }
259
+
260
+ getFloat32() {
261
+ const value = this.dataView.getFloat32(this.offset);
262
+ this.offset += 4;
263
+ return value;
264
+ }
265
+
266
+ getFloat64() {
267
+ const value = this.dataView.getFloat64(this.offset);
268
+ this.offset += 8;
269
+ return value;
270
+ }
271
+
272
+ getBool1_0(ready) {
273
+ return !!this.getUint1_0(ready);
274
+ }
275
+
276
+ getBool1_1(ready) {
277
+ return !!this.getUint1_1(ready);
278
+ }
279
+
280
+ getBool1_2(ready) {
281
+ return !!this.getUint1_2(ready);
282
+ }
283
+
284
+ getBool1_3(ready) {
285
+ return !!this.getUint1_3(ready);
286
+ }
287
+
288
+ getBool1_4(ready) {
289
+ return !!this.getUint1_4(ready);
290
+ }
291
+
292
+ getBool1_5(ready) {
293
+ return !!this.getUint1_5(ready);
294
+ }
295
+
296
+ getBool1_6(ready) {
297
+ return !!this.getUint1_6(ready);
298
+ }
299
+
300
+ getBool1_7(ready) {
301
+ return !!this.getUint1_7(ready);
302
+ }
303
+
304
+ getCt() {
305
+ const value = this.getInt16();
306
+ return value;
307
+ }
308
+
309
+ getCtString() {
310
+ const valueCt = this.getCt();
311
+ return this.textCache.getText(valueCt);
312
+ }
313
+
314
+ getCtStringArray() {
315
+ const strings = [];
316
+ const nbrStrings = this.getUint16();
317
+ for(let i = 0; i < nbrStrings; ++i) {
318
+ const valueCt = this.getCt();
319
+ strings.push(this.textCache.getText(valueCt));
320
+ }
321
+ return strings;
322
+ }
323
+
324
+ getSizedString(size) {
325
+ if(0 === size) {
326
+ return '';
327
+ }
328
+ else {
329
+ const buffer = this.getSizedBinary(size);
330
+ const string = Decoder.textDecoder.decode(buffer);
331
+ return string;
332
+ }
333
+ }
334
+
335
+ getString() {
336
+ const size = this.getDynamicBytes();
337
+ return this.getSizedString(size);
338
+ }
339
+
340
+ getStringArray() {
341
+ const size = this.getDynamicBytes();
342
+ const strings = [];
343
+ for(let i = 0; i < size; ++i) {
344
+ strings.push(this.getString());
345
+ }
346
+ return strings;
347
+ }
348
+
349
+ getSizedBinary(size) {
350
+ if(0 === size) {
351
+ return new Uint8Array(0);
352
+ }
353
+ else {
354
+ const array = new Uint8Array(this.dataView.buffer.slice(this.dataView.byteOffset + this.offset, this.dataView.byteOffset + this.offset + size));
355
+ this.offset += size;
356
+ return array;
357
+ }
358
+ }
359
+
360
+ getBinary() {
361
+ const size = this.getDynamicBytes();
362
+ return this.getSizedBinary(size);
363
+ }
364
+
365
+ getUint8Array(size) {
366
+ if(undefined === size) {
367
+ size = this.getUint16(this.offset);
368
+ }
369
+ return this.getSizedBinary(size);
370
+ }
371
+
372
+ getGuid() {
373
+ const r = new Array(36);
374
+ r[8] = 45;
375
+ r[13] = 45;
376
+ r[18] = 45;
377
+ r[23] = 45;
378
+ for(let i = 0; i < 8; i+=2) {
379
+ r[i] = Decoder.guidLookup[this.getUint4_0()];
380
+ r[i+1] = Decoder.guidLookup[this.getUint4_1(true)];
381
+ }
382
+ for(let i = 9; i < 13; i+=2) {
383
+ r[i] = Decoder.guidLookup[this.getUint4_0()];
384
+ r[i+1] = Decoder.guidLookup[this.getUint4_1(true)];
385
+ }
386
+ for(let i = 14; i < 18; i+=2) {
387
+ r[i] = Decoder.guidLookup[this.getUint4_0()];
388
+ r[i+1] = Decoder.guidLookup[this.getUint4_1(true)];
389
+ }
390
+ for(let i = 19; i < 23; i+=2) {
391
+ r[i] = Decoder.guidLookup[this.getUint4_0()];
392
+ r[i+1] = Decoder.guidLookup[this.getUint4_1(true)];
393
+ }
394
+ for(let i = 24; i < 36; i+=2) {
395
+ r[i] = Decoder.guidLookup[this.getUint4_0()];
396
+ r[i+1] = Decoder.guidLookup[this.getUint4_1(true)];
397
+ }
398
+ return String.fromCharCode(...r);
399
+ }
400
+
401
+ getGuidArray() {
402
+ const size = this.getDynamicBytes();
403
+ const guids = [];
404
+ for(let i = 0; i < size; ++i) {
405
+ guids.push(this.getGuid());
406
+ }
407
+ return guids;
408
+ }
409
+ }
410
+
411
+
412
+ module.exports = Decoder;