@dra2020/baseclient 1.0.14 → 1.0.17

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 (97) hide show
  1. package/README.md +5 -16
  2. package/dist/all/all.d.ts +2 -18
  3. package/dist/baseclient.js +1309 -173
  4. package/dist/baseclient.js.map +1 -1
  5. package/dist/filterexpr/filterexpr.d.ts +3 -0
  6. package/dist/fsm/fsm.d.ts +1 -0
  7. package/dist/geo/all.d.ts +2 -0
  8. package/dist/geo/geo.d.ts +67 -0
  9. package/dist/geo/vfeature.d.ts +4 -0
  10. package/dist/ot-js/otsession.d.ts +3 -0
  11. package/dist/poly/union.d.ts +1 -0
  12. package/docs/filterexpr.md +22 -0
  13. package/lib/all/all.ts +2 -22
  14. package/lib/filterexpr/filterexpr.ts +79 -5
  15. package/lib/fsm/fsm.ts +12 -2
  16. package/lib/geo/all.ts +2 -0
  17. package/lib/geo/geo.ts +452 -0
  18. package/lib/geo/vfeature.ts +34 -0
  19. package/lib/ot-js/otsession.ts +4 -1
  20. package/lib/poly/hash.ts +1 -1
  21. package/lib/poly/polybin.ts +5 -4
  22. package/lib/poly/polypack.ts +16 -4
  23. package/lib/poly/topo.ts +26 -41
  24. package/lib/poly/union.ts +17 -0
  25. package/package.json +9 -10
  26. package/dist/all/allclient.d.ts +0 -18
  27. package/dist/base.js +0 -33010
  28. package/dist/base.js.map +0 -1
  29. package/dist/dbabstract/all.d.ts +0 -1
  30. package/dist/dbabstract/db.d.ts +0 -83
  31. package/dist/dbdynamo/all.d.ts +0 -1
  32. package/dist/dbdynamo/dbdynamo.d.ts +0 -190
  33. package/dist/fsmfile/all.d.ts +0 -1
  34. package/dist/fsmfile/fsmfile.d.ts +0 -47
  35. package/dist/jsonstream/all.d.ts +0 -1
  36. package/dist/jsonstream/jsonstream.d.ts +0 -130
  37. package/dist/lambda/all.d.ts +0 -1
  38. package/dist/lambda/env.d.ts +0 -10
  39. package/dist/lambda/lambda.d.ts +0 -18
  40. package/dist/logserver/all.d.ts +0 -5
  41. package/dist/logserver/log.d.ts +0 -11
  42. package/dist/logserver/logaccum.d.ts +0 -154
  43. package/dist/logserver/logblob.d.ts +0 -24
  44. package/dist/logserver/logconcat.d.ts +0 -55
  45. package/dist/logserver/logkey.d.ts +0 -28
  46. package/dist/memsqs/all.d.ts +0 -4
  47. package/dist/memsqs/client.d.ts +0 -13
  48. package/dist/memsqs/loopback.d.ts +0 -11
  49. package/dist/memsqs/orderedlist.d.ts +0 -19
  50. package/dist/memsqs/queue.d.ts +0 -84
  51. package/dist/memsqs/server.d.ts +0 -37
  52. package/dist/storage/all.d.ts +0 -4
  53. package/dist/storage/datablob.d.ts +0 -9
  54. package/dist/storage/env.d.ts +0 -10
  55. package/dist/storage/splitsblob.d.ts +0 -13
  56. package/dist/storage/storage.d.ts +0 -166
  57. package/dist/storages3/all.d.ts +0 -1
  58. package/dist/storages3/s3.d.ts +0 -62
  59. package/docs/dbabstract.md +0 -2
  60. package/docs/dbdynamo.md +0 -2
  61. package/docs/fsmfile.md +0 -2
  62. package/docs/jsonstream.md +0 -44
  63. package/docs/lambda.md +0 -2
  64. package/docs/logserver.md +0 -2
  65. package/docs/storage.md +0 -2
  66. package/docs/storages3.md +0 -2
  67. package/lib/all/allclient.ts +0 -19
  68. package/lib/dbabstract/all.ts +0 -1
  69. package/lib/dbabstract/db.ts +0 -246
  70. package/lib/dbdynamo/all.ts +0 -1
  71. package/lib/dbdynamo/dbdynamo.ts +0 -1551
  72. package/lib/fsmfile/all.ts +0 -1
  73. package/lib/fsmfile/fsmfile.ts +0 -236
  74. package/lib/jsonstream/all.ts +0 -1
  75. package/lib/jsonstream/jsonstream.ts +0 -940
  76. package/lib/lambda/all.ts +0 -1
  77. package/lib/lambda/env.ts +0 -13
  78. package/lib/lambda/lambda.ts +0 -120
  79. package/lib/logserver/all.ts +0 -5
  80. package/lib/logserver/log.ts +0 -565
  81. package/lib/logserver/logaccum.ts +0 -1445
  82. package/lib/logserver/logblob.ts +0 -84
  83. package/lib/logserver/logconcat.ts +0 -313
  84. package/lib/logserver/logkey.ts +0 -125
  85. package/lib/memsqs/all.ts +0 -4
  86. package/lib/memsqs/client.ts +0 -268
  87. package/lib/memsqs/loopback.ts +0 -64
  88. package/lib/memsqs/orderedlist.ts +0 -74
  89. package/lib/memsqs/queue.ts +0 -395
  90. package/lib/memsqs/server.ts +0 -262
  91. package/lib/storage/all.ts +0 -4
  92. package/lib/storage/datablob.ts +0 -36
  93. package/lib/storage/env.ts +0 -14
  94. package/lib/storage/splitsblob.ts +0 -63
  95. package/lib/storage/storage.ts +0 -604
  96. package/lib/storages3/all.ts +0 -1
  97. package/lib/storages3/s3.ts +0 -576
@@ -1,246 +0,0 @@
1
- // Shared libraries
2
- import * as LogAbstract from '../logabstract/all';
3
- import * as Context from '../context/all';
4
- import * as Storage from '../storage/all';
5
- import * as FSM from '../fsm/all';
6
-
7
- // Custom DB state codes
8
- export const FSM_CREATING: number = FSM.FSM_CUSTOM1;
9
- export const FSM_NEEDRELEASE: number = FSM.FSM_CUSTOM2;
10
- export const FSM_RELEASING: number = FSM.FSM_CUSTOM3;
11
- export const FSM_READING: number = FSM.FSM_CUSTOM4;
12
-
13
- type CollectionIndex = { [key: string]: DBCollection };
14
-
15
- export interface DBEnvironment
16
- {
17
- context: Context.IContext;
18
- log: LogAbstract.ILog;
19
- fsmManager: FSM.FsmManager;
20
- storageManager: Storage.StorageManager;
21
- }
22
-
23
- export function fromCompactSchema(c: any): any
24
- {
25
- let s: any = [];
26
-
27
- if (c && !Array.isArray(c))
28
- {
29
- for (let p in c) if (c.hasOwnProperty(p))
30
- s.push({ AttributeName: p, AttributeType: c[p] });
31
- }
32
- else
33
- s = c;
34
- return s;
35
- }
36
-
37
- export function fromCompactKey(c: any): any
38
- {
39
- let s: any = [];
40
-
41
- if (c && !Array.isArray(c))
42
- {
43
- for (let p in c) if (c.hasOwnProperty(p))
44
- s.push({ AttributeName: p, KeyType: c[p] });
45
- }
46
- else
47
- s = c;
48
- return s;
49
- }
50
-
51
- function findHash(c: any): string
52
- {
53
- let h: string = null;
54
-
55
- Object.keys(c).forEach((k: string) => { if (c[k] === 'HASH') h = k } );
56
- while (h && h.length < 3)
57
- h = `_${h}`;
58
- return h;
59
- }
60
-
61
- export function fromCompactIndex(c: any): any
62
- {
63
- return { KeySchema: fromCompactKey(c), IndexName: findHash(c) };
64
- }
65
-
66
- export function toCompactSchema(s: any): any
67
- {
68
- let c: any = {};
69
-
70
- if (s && Array.isArray(s))
71
- {
72
- for (let i: number = 0; i < s.length; i++)
73
- c[s[i].AttributeName] = s[i].AttributeType;
74
- }
75
- else
76
- c = s;
77
-
78
- return c;
79
- }
80
-
81
- export class DBClient extends FSM.Fsm
82
- {
83
- constructor(env: DBEnvironment)
84
- {
85
- super(env);
86
- }
87
-
88
- get env(): DBEnvironment { return this._env as DBEnvironment; }
89
-
90
- createCollection(name: string, options: any): DBCollection { return new DBCollection(this.env, this, name, options); }
91
- createStream(col: DBCollection): FSM.FsmArray { return null; }
92
- closeStream(col: DBCollection): void {}
93
- createUpdate(col: DBCollection, query: any, values: any): DBUpdate { return new DBUpdate(this.env, col, query, values); }
94
- createUnset(col: DBCollection, query: any, values: any): DBUnset { return new DBUnset(this.env, col, query, values); }
95
- createDelete(col: DBCollection, query: any): DBDelete { return new DBDelete(this.env, col, query); }
96
- createFind(col: DBCollection, filter: any): DBFind { return new DBFind(this.env, col, filter); }
97
- createQuery(col: DBCollection, filter: any): DBQuery { return new DBQuery(this.env, col, filter); }
98
- createIndex(col: DBCollection, uid: string): DBIndex { return new DBIndex(this.env, col, uid); }
99
- createClose(): DBClose { return new DBClose(this.env, this); }
100
-
101
- close(): void
102
- {
103
- if (this.state == FSM.FSM_DONE)
104
- this.setState(FSM_NEEDRELEASE);
105
- }
106
- }
107
-
108
- export class DBCollection extends FSM.Fsm
109
- {
110
- name: string;
111
- options: any;
112
- col: any;
113
- client: DBClient;
114
-
115
- constructor(env: DBEnvironment, client: DBClient, name: string, options: any)
116
- {
117
- super(env);
118
- this.waitOn(client);
119
- this.client = client;
120
- this.name = name;
121
- this.options = options;
122
- this.col = null;
123
- }
124
- }
125
-
126
- export class DBUpdate extends FSM.Fsm
127
- {
128
- col: DBCollection;
129
- query: any;
130
- values: any;
131
- result: any;
132
-
133
- constructor(env: DBEnvironment, col: DBCollection, query: any, values: any)
134
- {
135
- super(env);
136
- this.waitOn(col);
137
- this.col = col;
138
- this.query = query;
139
- this.values = values;
140
- this.result = undefined;
141
- }
142
- }
143
-
144
- export class DBUnset extends FSM.Fsm
145
- {
146
- col: DBCollection;
147
- query: any;
148
- values: any;
149
- result: any;
150
-
151
- constructor(env: DBEnvironment, col: DBCollection, query: any, values: any)
152
- {
153
- super(env);
154
- this.waitOn(col);
155
- this.col = col;
156
- this.query = query;
157
- this.values = values;
158
- this.result = undefined;
159
- }
160
- }
161
-
162
- export class DBDelete extends FSM.Fsm
163
- {
164
- col: DBCollection;
165
- query: any;
166
- result: any;
167
-
168
- constructor(env: DBEnvironment, col: DBCollection, query: any)
169
- {
170
- super(env);
171
- this.waitOn(col);
172
- this.col = col;
173
- this.query = query;
174
- this.result = null;
175
- }
176
- }
177
-
178
- export class DBFind extends FSM.Fsm
179
- {
180
- col: DBCollection;
181
- filter: any;
182
- result: any;
183
-
184
- constructor(env: DBEnvironment, col: DBCollection, filter: any)
185
- {
186
- super(env);
187
- this.waitOn(col);
188
- this.col = col;
189
- this.filter = filter;
190
- this.result = null;
191
- }
192
- }
193
-
194
- export class DBQuery extends FSM.Fsm
195
- {
196
- col: DBCollection;
197
- filter: any;
198
- fsmResult: FSM.FsmArray;
199
-
200
- constructor(env: DBEnvironment, col: DBCollection, filter: any)
201
- {
202
- super(env);
203
- this.waitOn(col);
204
- this.col = col;
205
- this.filter = filter;
206
- this.fsmResult = new FSM.FsmArray(env);;
207
- }
208
-
209
- get result(): any[] { return this.fsmResult.a }
210
- }
211
-
212
- export class DBIndex extends FSM.Fsm
213
- {
214
- col: DBCollection;
215
- uid: string;
216
-
217
- constructor(env: DBEnvironment, col: DBCollection, uid: string)
218
- {
219
- super(env);
220
- this.waitOn(col);
221
- this.col = col;
222
- this.uid = uid;
223
- }
224
- }
225
-
226
- export class DBClose extends FSM.Fsm
227
- {
228
- client: DBClient;
229
-
230
- constructor(env: DBEnvironment, client: DBClient)
231
- {
232
- super(env);
233
- this.client = client;
234
- }
235
-
236
- tick(): void
237
- {
238
- if (this.ready && this.isDependentError)
239
- this.setState(FSM.FSM_ERROR);
240
- else if (this.ready && this.state == FSM.FSM_STARTING)
241
- {
242
- this.client.close();
243
- this.setState(FSM.FSM_DONE);
244
- }
245
- }
246
- }
@@ -1 +0,0 @@
1
- export * from './dbdynamo';