lemon-core 3.1.0 → 3.1.1
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/README.md +1 -0
- package/dist/controllers/dummy-controller.d.ts +1 -1
- package/dist/controllers/dummy-controller.js +2 -2
- package/dist/controllers/dummy-controller.js.map +1 -1
- package/dist/controllers/general-api-controller.d.ts +1 -1
- package/dist/cores/api/api-service.d.ts +239 -0
- package/dist/cores/api/api-service.js +674 -0
- package/dist/cores/api/api-service.js.map +1 -0
- package/dist/cores/api/index.d.ts +10 -0
- package/dist/cores/api/index.js +27 -0
- package/dist/cores/api/index.js.map +1 -0
- package/dist/cores/aws/aws-kms-service.d.ts +53 -2
- package/dist/cores/aws/aws-kms-service.js +104 -17
- package/dist/cores/aws/aws-kms-service.js.map +1 -1
- package/dist/cores/cache/cache-service.d.ts +440 -0
- package/dist/cores/cache/cache-service.js +967 -0
- package/dist/cores/cache/cache-service.js.map +1 -0
- package/dist/cores/cache/index.d.ts +10 -0
- package/dist/cores/cache/index.js +27 -0
- package/dist/cores/cache/index.js.map +1 -0
- package/dist/cores/cache-service.d.ts +54 -18
- package/dist/cores/cache-service.js +37 -26
- package/dist/cores/cache-service.js.map +1 -1
- package/dist/cores/core-types.d.ts +42 -12
- package/dist/cores/dynamo/dynamo-query-service.d.ts +52 -0
- package/dist/cores/dynamo/dynamo-query-service.js +127 -0
- package/dist/cores/dynamo/dynamo-query-service.js.map +1 -0
- package/dist/cores/dynamo/dynamo-scan-service.d.ts +70 -0
- package/dist/cores/dynamo/dynamo-scan-service.js +164 -0
- package/dist/cores/dynamo/dynamo-scan-service.js.map +1 -0
- package/dist/cores/dynamo/dynamo-service.d.ts +192 -0
- package/dist/cores/dynamo/dynamo-service.js +525 -0
- package/dist/cores/dynamo/dynamo-service.js.map +1 -0
- package/dist/cores/dynamo/index.d.ts +12 -0
- package/dist/cores/dynamo/index.js +29 -0
- package/dist/cores/dynamo/index.js.map +1 -0
- package/dist/cores/elastic/elastic6-query-service.d.ts +104 -0
- package/dist/cores/elastic/elastic6-query-service.js +510 -0
- package/dist/cores/elastic/elastic6-query-service.js.map +1 -0
- package/dist/cores/elastic/elastic6-service.d.ts +273 -0
- package/dist/cores/elastic/elastic6-service.js +903 -0
- package/dist/cores/elastic/elastic6-service.js.map +1 -0
- package/dist/cores/elastic/hangul-service.d.ts +102 -0
- package/dist/cores/elastic/hangul-service.js +205 -0
- package/dist/cores/elastic/hangul-service.js.map +1 -0
- package/dist/cores/elastic/index.d.ts +12 -0
- package/dist/cores/elastic/index.js +29 -0
- package/dist/cores/elastic/index.js.map +1 -0
- package/dist/cores/hangul-service.d.ts +17 -3
- package/dist/cores/hangul-service.js +17 -8
- package/dist/cores/hangul-service.js.map +1 -1
- package/dist/cores/index.d.ts +5 -11
- package/dist/cores/index.js +8 -13
- package/dist/cores/index.js.map +1 -1
- package/dist/cores/lambda/lambda-dynamo-stream-handler.d.ts +2 -2
- package/dist/cores/lambda/lambda-web-handler.d.ts +158 -8
- package/dist/cores/lambda/lambda-web-handler.js +283 -77
- package/dist/cores/lambda/lambda-web-handler.js.map +1 -1
- package/dist/cores/protocol/protocol-service.d.ts +4 -0
- package/dist/cores/protocol/protocol-service.js +12 -7
- package/dist/cores/protocol/protocol-service.js.map +1 -1
- package/dist/cores/storage/http-storage-service.d.ts +22 -0
- package/dist/cores/storage/http-storage-service.js +129 -0
- package/dist/cores/storage/http-storage-service.js.map +1 -0
- package/dist/cores/storage/index.d.ts +14 -0
- package/dist/cores/storage/index.js +31 -0
- package/dist/cores/storage/index.js.map +1 -0
- package/dist/cores/storage/model-manager.d.ts +93 -0
- package/dist/cores/storage/model-manager.js +192 -0
- package/dist/cores/storage/model-manager.js.map +1 -0
- package/dist/cores/storage/proxy-storage-service.d.ts +573 -0
- package/dist/cores/storage/proxy-storage-service.js +913 -0
- package/dist/cores/storage/proxy-storage-service.js.map +1 -0
- package/dist/cores/storage/redis-storage-service.d.ts +183 -0
- package/dist/cores/storage/redis-storage-service.js +391 -0
- package/dist/cores/storage/redis-storage-service.js.map +1 -0
- package/dist/cores/storage/storage-service.d.ts +169 -0
- package/dist/cores/storage/storage-service.js +374 -0
- package/dist/cores/storage/storage-service.js.map +1 -0
- package/dist/cores/storage-service.d.ts +1 -1
- package/dist/cores/storage-service.js +2 -2
- package/dist/cores/storage-service.js.map +1 -1
- package/dist/engine/utilities.d.ts +4 -3
- package/dist/engine/utilities.js +6 -6
- package/dist/engine/utilities.js.map +1 -1
- package/dist/environ.d.ts +2 -2
- package/dist/environ.js +7 -4
- package/dist/environ.js.map +1 -1
- package/dist/extended/abstract-service.d.ts +533 -0
- package/dist/extended/abstract-service.js +915 -0
- package/dist/extended/abstract-service.js.map +1 -0
- package/dist/extended/index.d.ts +10 -0
- package/dist/extended/index.js +27 -0
- package/dist/extended/index.js.map +1 -0
- package/dist/helpers/helpers.d.ts +7 -0
- package/dist/helpers/helpers.js +7 -0
- package/dist/helpers/helpers.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/package.json +6 -4
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
import { GeneralItem, Incrementable, SearchBody } from '../core-types';
|
|
2
|
+
import elasticsearch from '@elastic/elasticsearch';
|
|
3
|
+
export declare type SearchType = 'query_then_fetch' | 'dfs_query_then_fetch';
|
|
4
|
+
export declare type SearchResponse = any;
|
|
5
|
+
/**
|
|
6
|
+
* options for construction.
|
|
7
|
+
*/
|
|
8
|
+
export interface Elastic6Option {
|
|
9
|
+
/**
|
|
10
|
+
* endpoint url of ES6
|
|
11
|
+
*/
|
|
12
|
+
endpoint: string;
|
|
13
|
+
/**
|
|
14
|
+
* index-name
|
|
15
|
+
*/
|
|
16
|
+
indexName: string;
|
|
17
|
+
/**
|
|
18
|
+
* document type (default as `_doc` in ES6)
|
|
19
|
+
* - it must be `_doc` since ES6.x
|
|
20
|
+
*/
|
|
21
|
+
docType?: string;
|
|
22
|
+
/**
|
|
23
|
+
* id-name (optional if time-seriese)
|
|
24
|
+
*/
|
|
25
|
+
idName?: string;
|
|
26
|
+
/**
|
|
27
|
+
* is TIMESERIES data?
|
|
28
|
+
*/
|
|
29
|
+
timeSeries?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* (optional) version of engine.
|
|
32
|
+
* - (default) 6.8
|
|
33
|
+
*/
|
|
34
|
+
version?: string;
|
|
35
|
+
/**
|
|
36
|
+
* fields to provide autocomplete(Search-as-You-Type) feature
|
|
37
|
+
*/
|
|
38
|
+
autocompleteFields?: string[];
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* common type of item
|
|
42
|
+
*/
|
|
43
|
+
export interface Elastic6Item extends GeneralItem {
|
|
44
|
+
_id?: string;
|
|
45
|
+
_version?: number;
|
|
46
|
+
_score?: number;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* class: `Elastic6Service`
|
|
50
|
+
* - basic CRUD service for Elastic Search 6
|
|
51
|
+
*/
|
|
52
|
+
export declare class Elastic6Service<T extends Elastic6Item = any> {
|
|
53
|
+
static readonly DECOMPOSED_FIELD = "_decomposed";
|
|
54
|
+
static readonly QWERTY_FIELD = "_qwerty";
|
|
55
|
+
protected _options: Elastic6Option;
|
|
56
|
+
readonly _client: elasticsearch.Client;
|
|
57
|
+
/**
|
|
58
|
+
* simple instance maker.
|
|
59
|
+
*
|
|
60
|
+
* ```js
|
|
61
|
+
* const { client } = Elastic6Service.instance(endpoint);
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
* @param endpoint service-url
|
|
65
|
+
* @param version Elasticsearch version (default: '6.8')
|
|
66
|
+
* @see https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/16.x/configuration.html
|
|
67
|
+
*/
|
|
68
|
+
static instance(endpoint: string): {
|
|
69
|
+
client: elasticsearch.Client;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* default constuctor w/ options.
|
|
73
|
+
* @param options { endpoint, indexName } is required.
|
|
74
|
+
*/
|
|
75
|
+
constructor(options: Elastic6Option);
|
|
76
|
+
/**
|
|
77
|
+
* say hello of identity.
|
|
78
|
+
*/
|
|
79
|
+
hello: () => string;
|
|
80
|
+
/**
|
|
81
|
+
* get the client instance.
|
|
82
|
+
*/
|
|
83
|
+
get client(): elasticsearch.Client;
|
|
84
|
+
/**
|
|
85
|
+
* get the current options.
|
|
86
|
+
*/
|
|
87
|
+
get options(): Elastic6Option;
|
|
88
|
+
get version(): number;
|
|
89
|
+
/**
|
|
90
|
+
* list of index
|
|
91
|
+
*/
|
|
92
|
+
listIndices(): Promise<{
|
|
93
|
+
list: {
|
|
94
|
+
pri: number;
|
|
95
|
+
rep: number;
|
|
96
|
+
docsCount: number;
|
|
97
|
+
docsDeleted: number;
|
|
98
|
+
health: string;
|
|
99
|
+
index: string;
|
|
100
|
+
status: string;
|
|
101
|
+
uuid: string;
|
|
102
|
+
priStoreSize: string;
|
|
103
|
+
storeSize: string;
|
|
104
|
+
}[];
|
|
105
|
+
}>;
|
|
106
|
+
/**
|
|
107
|
+
* find the index by name
|
|
108
|
+
*/
|
|
109
|
+
findIndex(indexName?: string): Promise<{
|
|
110
|
+
pri: number;
|
|
111
|
+
rep: number;
|
|
112
|
+
docsCount: number;
|
|
113
|
+
docsDeleted: number;
|
|
114
|
+
health: string;
|
|
115
|
+
index: string;
|
|
116
|
+
status: string;
|
|
117
|
+
uuid: string;
|
|
118
|
+
priStoreSize: string;
|
|
119
|
+
storeSize: string;
|
|
120
|
+
}>;
|
|
121
|
+
/**
|
|
122
|
+
* create index by name
|
|
123
|
+
*
|
|
124
|
+
* @param settings creating settings
|
|
125
|
+
*/
|
|
126
|
+
createIndex(settings?: any): Promise<{
|
|
127
|
+
status: any;
|
|
128
|
+
index: string;
|
|
129
|
+
acknowledged: any;
|
|
130
|
+
}>;
|
|
131
|
+
/**
|
|
132
|
+
* destroy search index
|
|
133
|
+
*/
|
|
134
|
+
destroyIndex(): Promise<{
|
|
135
|
+
status: any;
|
|
136
|
+
index: string;
|
|
137
|
+
acknowledged: any;
|
|
138
|
+
}>;
|
|
139
|
+
/**
|
|
140
|
+
* refresh search index - refresh index to make all items searchable
|
|
141
|
+
*/
|
|
142
|
+
refreshIndex(): Promise<any>;
|
|
143
|
+
/**
|
|
144
|
+
* flush search index - force store changes into search index immediately
|
|
145
|
+
*/
|
|
146
|
+
flushIndex(): Promise<any>;
|
|
147
|
+
/**
|
|
148
|
+
* describe `settings` and `mappings` of index.
|
|
149
|
+
*/
|
|
150
|
+
describe(): Promise<{
|
|
151
|
+
settings: any;
|
|
152
|
+
mappings: any;
|
|
153
|
+
}>;
|
|
154
|
+
/**
|
|
155
|
+
* save single item
|
|
156
|
+
*
|
|
157
|
+
* @param id id
|
|
158
|
+
* @param item item to save
|
|
159
|
+
* @param type document type (default: doc-type given at construction time)
|
|
160
|
+
*/
|
|
161
|
+
saveItem(id: string, item: T, type?: string): Promise<T>;
|
|
162
|
+
/**
|
|
163
|
+
* push item for time-series data.
|
|
164
|
+
*
|
|
165
|
+
* @param item item to push
|
|
166
|
+
*/
|
|
167
|
+
pushItem(item: T, type?: string): Promise<T>;
|
|
168
|
+
/**
|
|
169
|
+
* read item with projections
|
|
170
|
+
*
|
|
171
|
+
* @param id item-id
|
|
172
|
+
* @param views projections
|
|
173
|
+
*/
|
|
174
|
+
readItem(id: string, views?: string[] | object): Promise<T>;
|
|
175
|
+
/**
|
|
176
|
+
* delete item with projections
|
|
177
|
+
*
|
|
178
|
+
* @param id item-id
|
|
179
|
+
*/
|
|
180
|
+
deleteItem(id: string): Promise<T>;
|
|
181
|
+
/**
|
|
182
|
+
* update item
|
|
183
|
+
*
|
|
184
|
+
* @param id item-id
|
|
185
|
+
* @param item item to update
|
|
186
|
+
*/
|
|
187
|
+
updateItem(id: string, item: T, increments?: Incrementable): Promise<T>;
|
|
188
|
+
/**
|
|
189
|
+
* run search and get the raw response.
|
|
190
|
+
*/
|
|
191
|
+
searchRaw(body: SearchBody, searchType?: SearchType): Promise<SearchResponse>;
|
|
192
|
+
/**
|
|
193
|
+
* run search, and get the formatmted response.
|
|
194
|
+
*/
|
|
195
|
+
search(body: SearchBody, searchType?: SearchType): Promise<{
|
|
196
|
+
total: any;
|
|
197
|
+
list: any;
|
|
198
|
+
last: any;
|
|
199
|
+
aggregations: any;
|
|
200
|
+
}>;
|
|
201
|
+
/**
|
|
202
|
+
* prepare default setting
|
|
203
|
+
* - migrated from engine-v2.
|
|
204
|
+
*
|
|
205
|
+
* @param docType document type name
|
|
206
|
+
* @param idName id-name
|
|
207
|
+
* @param shards number of shards (default 4)
|
|
208
|
+
* @param replicas number of replicas (default 1)
|
|
209
|
+
* @param timeSeries flag of TIMESERIES (default false)
|
|
210
|
+
*/
|
|
211
|
+
static prepareSettings(params: {
|
|
212
|
+
docType: string;
|
|
213
|
+
idName: string;
|
|
214
|
+
version?: string;
|
|
215
|
+
timeSeries?: boolean;
|
|
216
|
+
shards?: number;
|
|
217
|
+
replicas?: number;
|
|
218
|
+
}): any;
|
|
219
|
+
/**
|
|
220
|
+
* generate autocomplete fields into the item body to be indexed
|
|
221
|
+
* @param body item body to be saved into ES6 index
|
|
222
|
+
* @private
|
|
223
|
+
*/
|
|
224
|
+
private popullateAutocompleteFields;
|
|
225
|
+
}
|
|
226
|
+
interface ErrorReasonDetail {
|
|
227
|
+
status: number;
|
|
228
|
+
type: string;
|
|
229
|
+
reason?: string;
|
|
230
|
+
cause?: any;
|
|
231
|
+
}
|
|
232
|
+
interface ErrorReason {
|
|
233
|
+
status: number;
|
|
234
|
+
message: string;
|
|
235
|
+
reason: ErrorReasonDetail;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* error samples
|
|
239
|
+
*/
|
|
240
|
+
export declare const $ERROR: {
|
|
241
|
+
asJson: (e: any) => any;
|
|
242
|
+
throwAsJson: (e: any) => never;
|
|
243
|
+
parseMeta: <T extends {
|
|
244
|
+
[key: string]: any;
|
|
245
|
+
type?: string;
|
|
246
|
+
value?: any;
|
|
247
|
+
error?: string;
|
|
248
|
+
list?: any[];
|
|
249
|
+
}>(meta: any) => T;
|
|
250
|
+
asError: (e: any) => ErrorReason;
|
|
251
|
+
handler: (name: string, cb?: (e: Error, E?: ErrorReason) => any) => (e: any) => any;
|
|
252
|
+
};
|
|
253
|
+
/** ****************************************************************************************************************
|
|
254
|
+
* Dummy Elastic6 Service
|
|
255
|
+
** ****************************************************************************************************************/
|
|
256
|
+
/**
|
|
257
|
+
* class: `DummyElastic6Service`
|
|
258
|
+
* - service in-memory dummy data
|
|
259
|
+
*/
|
|
260
|
+
export declare class DummyElastic6Service<T extends GeneralItem> extends Elastic6Service<T> {
|
|
261
|
+
constructor(dataFile: string, options: Elastic6Option);
|
|
262
|
+
private buffer;
|
|
263
|
+
load(data: T[]): void;
|
|
264
|
+
/**
|
|
265
|
+
* say hello()
|
|
266
|
+
*/
|
|
267
|
+
hello: () => string;
|
|
268
|
+
readItem(id: string): Promise<T>;
|
|
269
|
+
saveItem(id: string, item: T): Promise<T>;
|
|
270
|
+
deleteItem(id: string, sort?: string | number): Promise<T>;
|
|
271
|
+
updateItem(id: string, updates: T, increments?: Incrementable): Promise<T>;
|
|
272
|
+
}
|
|
273
|
+
export {};
|