@dra2020/baseclient 1.0.13 → 1.0.14

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 (185) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +37 -0
  3. package/dist/all/all.d.ts +36 -0
  4. package/dist/all/allclient.d.ts +18 -0
  5. package/dist/base.js +33010 -0
  6. package/dist/base.js.map +1 -0
  7. package/dist/baseclient.js +8991 -0
  8. package/dist/baseclient.js.map +1 -0
  9. package/dist/context/all.d.ts +1 -0
  10. package/dist/context/context.d.ts +13 -0
  11. package/dist/dbabstract/all.d.ts +1 -0
  12. package/dist/dbabstract/db.d.ts +83 -0
  13. package/dist/dbdynamo/all.d.ts +1 -0
  14. package/dist/dbdynamo/dbdynamo.d.ts +190 -0
  15. package/dist/filterexpr/all.d.ts +1 -0
  16. package/dist/filterexpr/filterexpr.d.ts +64 -0
  17. package/dist/fsm/all.d.ts +1 -0
  18. package/dist/fsm/fsm.d.ts +118 -0
  19. package/dist/fsmfile/all.d.ts +1 -0
  20. package/dist/fsmfile/fsmfile.d.ts +47 -0
  21. package/dist/jsonstream/all.d.ts +1 -0
  22. package/dist/jsonstream/jsonstream.d.ts +130 -0
  23. package/dist/lambda/all.d.ts +1 -0
  24. package/dist/lambda/env.d.ts +10 -0
  25. package/dist/lambda/lambda.d.ts +18 -0
  26. package/dist/logabstract/all.d.ts +1 -0
  27. package/dist/logabstract/log.d.ts +26 -0
  28. package/dist/logclient/all.d.ts +1 -0
  29. package/dist/logclient/log.d.ts +6 -0
  30. package/dist/logserver/all.d.ts +5 -0
  31. package/dist/logserver/log.d.ts +11 -0
  32. package/dist/logserver/logaccum.d.ts +154 -0
  33. package/dist/logserver/logblob.d.ts +24 -0
  34. package/dist/logserver/logconcat.d.ts +55 -0
  35. package/dist/logserver/logkey.d.ts +28 -0
  36. package/dist/memsqs/all.d.ts +4 -0
  37. package/dist/memsqs/client.d.ts +13 -0
  38. package/dist/memsqs/loopback.d.ts +11 -0
  39. package/dist/memsqs/orderedlist.d.ts +19 -0
  40. package/dist/memsqs/queue.d.ts +84 -0
  41. package/dist/memsqs/server.d.ts +37 -0
  42. package/dist/ot-editutil/all.d.ts +2 -0
  43. package/dist/ot-editutil/oteditutil.d.ts +14 -0
  44. package/dist/ot-editutil/otmaputil.d.ts +21 -0
  45. package/dist/ot-js/all.d.ts +9 -0
  46. package/dist/ot-js/otarray.d.ts +111 -0
  47. package/dist/ot-js/otclientengine.d.ts +38 -0
  48. package/dist/ot-js/otcomposite.d.ts +37 -0
  49. package/dist/ot-js/otcounter.d.ts +17 -0
  50. package/dist/ot-js/otengine.d.ts +22 -0
  51. package/dist/ot-js/otmap.d.ts +19 -0
  52. package/dist/ot-js/otserverengine.d.ts +38 -0
  53. package/dist/ot-js/otsession.d.ts +111 -0
  54. package/dist/ot-js/ottypes.d.ts +29 -0
  55. package/dist/poly/all.d.ts +15 -0
  56. package/dist/poly/blend.d.ts +1 -0
  57. package/dist/poly/boundbox.d.ts +16 -0
  58. package/dist/poly/cartesian.d.ts +5 -0
  59. package/dist/poly/graham-scan.d.ts +8 -0
  60. package/dist/poly/hash.d.ts +1 -0
  61. package/dist/poly/matrix.d.ts +24 -0
  62. package/dist/poly/minbound.d.ts +1 -0
  63. package/dist/poly/poly.d.ts +52 -0
  64. package/dist/poly/polybin.d.ts +5 -0
  65. package/dist/poly/polylabel.d.ts +7 -0
  66. package/dist/poly/polypack.d.ts +30 -0
  67. package/dist/poly/polyround.d.ts +1 -0
  68. package/dist/poly/polysimplify.d.ts +1 -0
  69. package/dist/poly/quad.d.ts +48 -0
  70. package/dist/poly/selfintersect.d.ts +1 -0
  71. package/dist/poly/shamos.d.ts +1 -0
  72. package/dist/poly/simplify.d.ts +2 -0
  73. package/dist/poly/topo.d.ts +46 -0
  74. package/dist/poly/union.d.ts +48 -0
  75. package/dist/storage/all.d.ts +4 -0
  76. package/dist/storage/datablob.d.ts +9 -0
  77. package/dist/storage/env.d.ts +10 -0
  78. package/dist/storage/splitsblob.d.ts +13 -0
  79. package/dist/storage/storage.d.ts +166 -0
  80. package/dist/storages3/all.d.ts +1 -0
  81. package/dist/storages3/s3.d.ts +62 -0
  82. package/dist/util/all.d.ts +5 -0
  83. package/dist/util/bintrie.d.ts +93 -0
  84. package/dist/util/countedhash.d.ts +19 -0
  85. package/dist/util/gradient.d.ts +15 -0
  86. package/dist/util/indexedarray.d.ts +15 -0
  87. package/dist/util/util.d.ts +68 -0
  88. package/docs/context.md +2 -0
  89. package/docs/dbabstract.md +2 -0
  90. package/docs/dbdynamo.md +2 -0
  91. package/docs/fsm.md +243 -0
  92. package/docs/fsmfile.md +2 -0
  93. package/docs/jsonstream.md +44 -0
  94. package/docs/lambda.md +2 -0
  95. package/docs/logabstract.md +2 -0
  96. package/docs/logclient.md +2 -0
  97. package/docs/logserver.md +2 -0
  98. package/docs/ot-editutil.md +2 -0
  99. package/docs/ot-js.md +95 -0
  100. package/docs/poly.md +103 -0
  101. package/docs/storage.md +2 -0
  102. package/docs/storages3.md +2 -0
  103. package/docs/util.md +2 -0
  104. package/lib/all/all.ts +41 -0
  105. package/lib/all/allclient.ts +19 -0
  106. package/lib/context/all.ts +1 -0
  107. package/lib/context/context.ts +82 -0
  108. package/lib/dbabstract/all.ts +1 -0
  109. package/lib/dbabstract/db.ts +246 -0
  110. package/lib/dbdynamo/all.ts +1 -0
  111. package/lib/dbdynamo/dbdynamo.ts +1551 -0
  112. package/lib/filterexpr/all.ts +1 -0
  113. package/lib/filterexpr/filterexpr.ts +625 -0
  114. package/lib/fsm/all.ts +1 -0
  115. package/lib/fsm/fsm.ts +549 -0
  116. package/lib/fsmfile/all.ts +1 -0
  117. package/lib/fsmfile/fsmfile.ts +236 -0
  118. package/lib/jsonstream/all.ts +1 -0
  119. package/lib/jsonstream/jsonstream.ts +940 -0
  120. package/lib/lambda/all.ts +1 -0
  121. package/lib/lambda/env.ts +13 -0
  122. package/lib/lambda/lambda.ts +120 -0
  123. package/lib/logabstract/all.ts +1 -0
  124. package/lib/logabstract/log.ts +55 -0
  125. package/lib/logclient/all.ts +1 -0
  126. package/lib/logclient/log.ts +105 -0
  127. package/lib/logserver/all.ts +5 -0
  128. package/lib/logserver/log.ts +565 -0
  129. package/lib/logserver/logaccum.ts +1445 -0
  130. package/lib/logserver/logblob.ts +84 -0
  131. package/lib/logserver/logconcat.ts +313 -0
  132. package/lib/logserver/logkey.ts +125 -0
  133. package/lib/memsqs/all.ts +4 -0
  134. package/lib/memsqs/client.ts +268 -0
  135. package/lib/memsqs/loopback.ts +64 -0
  136. package/lib/memsqs/orderedlist.ts +74 -0
  137. package/lib/memsqs/queue.ts +395 -0
  138. package/lib/memsqs/server.ts +262 -0
  139. package/lib/ot-editutil/all.ts +2 -0
  140. package/lib/ot-editutil/oteditutil.ts +180 -0
  141. package/lib/ot-editutil/otmaputil.ts +209 -0
  142. package/lib/ot-js/all.ts +9 -0
  143. package/lib/ot-js/otarray.ts +1168 -0
  144. package/lib/ot-js/otclientengine.ts +327 -0
  145. package/lib/ot-js/otcomposite.ts +247 -0
  146. package/lib/ot-js/otcounter.ts +145 -0
  147. package/lib/ot-js/otengine.ts +71 -0
  148. package/lib/ot-js/otmap.ts +144 -0
  149. package/lib/ot-js/otserverengine.ts +329 -0
  150. package/lib/ot-js/otsession.ts +199 -0
  151. package/lib/ot-js/ottypes.ts +98 -0
  152. package/lib/poly/all.ts +15 -0
  153. package/lib/poly/blend.ts +27 -0
  154. package/lib/poly/boundbox.ts +102 -0
  155. package/lib/poly/cartesian.ts +130 -0
  156. package/lib/poly/graham-scan.ts +401 -0
  157. package/lib/poly/hash.ts +15 -0
  158. package/lib/poly/matrix.ts +309 -0
  159. package/lib/poly/minbound.ts +211 -0
  160. package/lib/poly/poly.ts +767 -0
  161. package/lib/poly/polybin.ts +218 -0
  162. package/lib/poly/polylabel.ts +204 -0
  163. package/lib/poly/polypack.ts +458 -0
  164. package/lib/poly/polyround.ts +30 -0
  165. package/lib/poly/polysimplify.ts +24 -0
  166. package/lib/poly/quad.ts +272 -0
  167. package/lib/poly/selfintersect.ts +87 -0
  168. package/lib/poly/shamos.ts +297 -0
  169. package/lib/poly/simplify.ts +119 -0
  170. package/lib/poly/topo.ts +525 -0
  171. package/lib/poly/union.ts +371 -0
  172. package/lib/storage/all.ts +4 -0
  173. package/lib/storage/datablob.ts +36 -0
  174. package/lib/storage/env.ts +14 -0
  175. package/lib/storage/splitsblob.ts +63 -0
  176. package/lib/storage/storage.ts +604 -0
  177. package/lib/storages3/all.ts +1 -0
  178. package/lib/storages3/s3.ts +576 -0
  179. package/lib/util/all.ts +5 -0
  180. package/lib/util/bintrie.ts +603 -0
  181. package/lib/util/countedhash.ts +83 -0
  182. package/lib/util/gradient.ts +108 -0
  183. package/lib/util/indexedarray.ts +80 -0
  184. package/lib/util/util.ts +695 -0
  185. package/package.json +8 -8
@@ -0,0 +1,108 @@
1
+ interface RGB
2
+ {
3
+ r: number,
4
+ g: number,
5
+ b: number,
6
+ }
7
+
8
+ export interface Stop
9
+ {
10
+ color: string,
11
+ stop: number,
12
+ rgb?: RGB;
13
+ }
14
+
15
+ export type GradientStops = Stop[];
16
+
17
+ function parseStops(stops: GradientStops): void
18
+ {
19
+ if (stops[0].rgb) return;
20
+
21
+ stops.forEach((s) => {
22
+ if (s.rgb === undefined)
23
+ {
24
+ let r = parseInt(s.color.substr(1, 2), 16);
25
+ let g = parseInt(s.color.substr(3, 2), 16);
26
+ let b = parseInt(s.color.substr(5, 2), 16);
27
+ s.rgb = { r: r, g: g, b: b };
28
+ }
29
+ });
30
+ stops.sort();
31
+ }
32
+
33
+ function asHex(v: number): string
34
+ {
35
+ return v.toString(16).padStart(2, '0');
36
+ }
37
+
38
+ function toHexColor(r: number, g: number, b: number): string
39
+ {
40
+ return `#${asHex(r)}${asHex(g)}${asHex(b)}`;
41
+ }
42
+
43
+ export function execGradient(stops: GradientStops, value: number): string
44
+ {
45
+ parseStops(stops);
46
+ let r = stops[stops.length-1].rgb.r;
47
+ let g = stops[stops.length-1].rgb.g;
48
+ let b = stops[stops.length-1].rgb.b;
49
+ for (let i = 1; i < stops.length; i++)
50
+ {
51
+ let e = stops[i];
52
+ if (value < e.stop)
53
+ {
54
+ let s = stops[i-1];
55
+ r = s.rgb.r + Math.floor(((e.rgb.r - s.rgb.r) * (value - s.stop) / (e.stop - s.stop)));
56
+ g = s.rgb.g + Math.floor(((e.rgb.g - s.rgb.g) * (value - s.stop) / (e.stop - s.stop)));
57
+ b = s.rgb.b + Math.floor(((e.rgb.b - s.rgb.b) * (value - s.stop) / (e.stop - s.stop)));
58
+ break;
59
+ }
60
+ }
61
+ return toHexColor(r, g, b);
62
+ }
63
+
64
+ export function parseGradient(sStops: string): GradientStops
65
+ {
66
+ let stops: GradientStops = [];
67
+ let re = / ?([^ ]+) ([^ ,]+%?),?(.*)/;
68
+
69
+ if (sStops == null || sStops == '' ) return stops;
70
+
71
+ // Strip off leading CSS form if present
72
+ if (sStops.indexOf('linear-gradient') == 0)
73
+ {
74
+ let rePre = /^[^,]*, (.*)\)$/;
75
+ let a = rePre.exec(sStops);
76
+ if (a)
77
+ sStops = a[1];
78
+ }
79
+
80
+ while (sStops && sStops != '')
81
+ {
82
+ let a = re.exec(sStops);
83
+ if (a == null)
84
+ break;
85
+ let stop = a[2];
86
+ sStops = a[3];
87
+ if (a[2].indexOf('%') >= 0)
88
+ {
89
+ stop = stop.substr(0, stop.length-1);
90
+ stop = String(Number(stop) * 0.01);
91
+ }
92
+
93
+ stops.push({ color: a[1], stop: Number(stop) });
94
+ }
95
+ return stops;
96
+ }
97
+
98
+ export function asCSSGradient(stops: GradientStops): string
99
+ {
100
+ parseStops(stops);
101
+
102
+ let a: string[] = [];
103
+ stops.forEach((s) => {
104
+ let stop = s.stop >= 0.0 && s.stop <= 1.0 ? `${Math.round(s.stop*100)}%` : String(s.stop);
105
+ a.push(`${toHexColor(s.rgb.r, s.rgb.g, s.rgb.b)} ${stop}`);
106
+ });
107
+ return `linear-gradient(to right, ${a.join(', ')})`;
108
+ }
@@ -0,0 +1,80 @@
1
+ export class IndexedArray
2
+ {
3
+ o: any;
4
+ a: any[];
5
+
6
+ constructor()
7
+ {
8
+ this.o = {};
9
+ this.a = null;
10
+ }
11
+
12
+ ensure(): void
13
+ {
14
+ if (this.a === null)
15
+ {
16
+ this.a = [];
17
+ for (let p in this.o) if (this.o.hasOwnProperty(p))
18
+ this.a.push(p);
19
+ this.a.sort((a: string, b: string) => { a = a.toUpperCase(); b = b.toUpperCase(); return a < b ? -1 : (a > b ? 1 : 0); });
20
+ }
21
+ }
22
+
23
+ asArray(): any[]
24
+ {
25
+ this.ensure();
26
+ return this.a;
27
+ }
28
+
29
+ get length(): number { this.ensure(); return this.a.length; }
30
+
31
+ test(s: string): boolean
32
+ {
33
+ return !!s && this.o[s] !== undefined;
34
+ }
35
+
36
+ set(s: string): void
37
+ {
38
+ if (!!s && !this.test(s))
39
+ {
40
+ this.o[s] = true;
41
+ this.a = null;
42
+ }
43
+ }
44
+
45
+ setAll(a: string[]): void
46
+ {
47
+ if (a && a.length)
48
+ for (let i: number = 0; i < a.length; i++)
49
+ this.set(a[i]);
50
+ }
51
+
52
+ clear(s: string): void
53
+ {
54
+ if (this.test(s))
55
+ {
56
+ delete this.o[s];
57
+ this.a = null;
58
+ }
59
+ }
60
+
61
+ at(i: number): string
62
+ {
63
+ this.ensure();
64
+ if (i < 0 || i >= this.a.length)
65
+ return undefined;
66
+ return this.a[i];
67
+ }
68
+
69
+ empty(): void
70
+ {
71
+ this.o = {};
72
+ this.a = null;
73
+ }
74
+
75
+ forEach(f: (s: string) => void): void
76
+ {
77
+ for (var s in this.o) if (this.o.hasOwnProperty(s))
78
+ f(s);
79
+ }
80
+ }