lemon-core 4.2.7 → 5.0.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/README.md +128 -2
- package/dist/common/lemon-error.d.ts +34 -0
- package/dist/common/lemon-error.js +52 -0
- package/dist/common/lemon-error.js.map +1 -0
- package/dist/controllers/general-api-controller.d.ts +7 -0
- package/dist/controllers/general-api-controller.js +7 -0
- package/dist/controllers/general-api-controller.js.map +1 -1
- package/dist/cores/api/api-service.js +10 -43
- package/dist/cores/api/api-service.js.map +1 -1
- package/dist/cores/aws/aws-kms-service.d.ts +13 -5
- package/dist/cores/aws/aws-kms-service.js +23 -9
- package/dist/cores/aws/aws-kms-service.js.map +1 -1
- package/dist/cores/aws/aws-s3-service.d.ts +30 -4
- package/dist/cores/aws/aws-s3-service.js +35 -15
- package/dist/cores/aws/aws-s3-service.js.map +1 -1
- package/dist/cores/aws/aws-sns-service.js +59 -9
- package/dist/cores/aws/aws-sns-service.js.map +1 -1
- package/dist/cores/aws/aws-sqs-service.d.ts +1 -1
- package/dist/cores/aws/aws-sqs-service.js +54 -12
- package/dist/cores/aws/aws-sqs-service.js.map +1 -1
- package/dist/cores/cache/cache-service.d.ts +10 -9
- package/dist/cores/cache/cache-service.js +9 -346
- package/dist/cores/cache/cache-service.js.map +1 -1
- package/dist/cores/config/config-service.d.ts +3 -15
- package/dist/cores/config/config-service.js +5 -34
- package/dist/cores/config/config-service.js.map +1 -1
- package/dist/cores/dynamo/dynamo-query-service.js +42 -2
- package/dist/cores/dynamo/dynamo-query-service.js.map +1 -1
- package/dist/cores/dynamo/dynamo-scan-service.js +42 -2
- package/dist/cores/dynamo/dynamo-scan-service.js.map +1 -1
- package/dist/cores/dynamo/dynamo-service.d.ts +45 -14
- package/dist/cores/dynamo/dynamo-service.js +48 -21
- package/dist/cores/dynamo/dynamo-service.js.map +1 -1
- package/dist/cores/dynamo/tools/expressions.js +32 -22
- package/dist/cores/dynamo/tools/expressions.js.map +1 -1
- package/dist/cores/dynamo/tools/lang.d.ts +30 -0
- package/dist/cores/dynamo/tools/lang.js +75 -0
- package/dist/cores/dynamo/tools/lang.js.map +1 -0
- package/dist/cores/dynamo/tools/query.js +20 -21
- package/dist/cores/dynamo/tools/query.js.map +1 -1
- package/dist/cores/dynamo/tools/scan.js +15 -16
- package/dist/cores/dynamo/tools/scan.js.map +1 -1
- package/dist/cores/dynamo/tools/serializer.js +40 -38
- package/dist/cores/dynamo/tools/serializer.js.map +1 -1
- package/dist/cores/dynamo/tools/utils.d.ts +6 -2
- package/dist/cores/dynamo/tools/utils.js +11 -8
- package/dist/cores/dynamo/tools/utils.js.map +1 -1
- package/dist/cores/elastic/elastic6-query-service.d.ts +1 -104
- package/dist/cores/elastic/elastic6-query-service.js +15 -489
- package/dist/cores/elastic/elastic6-query-service.js.map +1 -1
- package/dist/cores/elastic/elastic6-service.d.ts +1 -482
- package/dist/cores/elastic/elastic6-service.js +15 -1153
- package/dist/cores/elastic/elastic6-service.js.map +1 -1
- package/dist/cores/elastic/index.d.ts +2 -2
- package/dist/cores/elastic/index.js +3 -2
- package/dist/cores/elastic/index.js.map +1 -1
- package/dist/cores/elastic/os2-query-service.d.ts +104 -0
- package/dist/cores/elastic/os2-query-service.js +495 -0
- package/dist/cores/elastic/os2-query-service.js.map +1 -0
- package/dist/cores/elastic/os2-service.d.ts +372 -0
- package/dist/cores/elastic/os2-service.js +943 -0
- package/dist/cores/elastic/os2-service.js.map +1 -0
- package/dist/cores/index.d.ts +6 -1
- package/dist/cores/index.js +9 -2
- package/dist/cores/index.js.map +1 -1
- package/dist/cores/lambda/index.js +2 -1
- package/dist/cores/lambda/index.js.map +1 -1
- package/dist/cores/lambda/lambda-cron-handler.d.ts +1 -0
- package/dist/cores/lambda/lambda-cron-handler.js +5 -1
- package/dist/cores/lambda/lambda-cron-handler.js.map +1 -1
- package/dist/cores/lambda/lambda-dynamo-stream-handler.d.ts +5 -4
- package/dist/cores/lambda/lambda-dynamo-stream-handler.js +18 -5
- package/dist/cores/lambda/lambda-dynamo-stream-handler.js.map +1 -1
- package/dist/cores/lambda/lambda-handler.d.ts +22 -2
- package/dist/cores/lambda/lambda-handler.js +85 -23
- package/dist/cores/lambda/lambda-handler.js.map +1 -1
- package/dist/cores/lambda/lambda-sns-handler.d.ts +1 -0
- package/dist/cores/lambda/lambda-sns-handler.js +5 -0
- package/dist/cores/lambda/lambda-sns-handler.js.map +1 -1
- package/dist/cores/lambda/lambda-sqs-handler.d.ts +1 -0
- package/dist/cores/lambda/lambda-sqs-handler.js +20 -5
- package/dist/cores/lambda/lambda-sqs-handler.js.map +1 -1
- package/dist/cores/lambda/lambda-web-handler.d.ts +10 -0
- package/dist/cores/lambda/lambda-web-handler.js +107 -41
- package/dist/cores/lambda/lambda-web-handler.js.map +1 -1
- package/dist/cores/protocol/aws-lambda-helper.js +58 -11
- package/dist/cores/protocol/aws-lambda-helper.js.map +1 -1
- package/dist/cores/protocol/index.js +3 -0
- package/dist/cores/protocol/index.js.map +1 -1
- package/dist/cores/protocol/protocol-service.d.ts +26 -5
- package/dist/cores/protocol/protocol-service.js +42 -12
- package/dist/cores/protocol/protocol-service.js.map +1 -1
- package/dist/cores/protocol/protocol-sign.d.ts +72 -0
- package/dist/cores/protocol/protocol-sign.js +194 -0
- package/dist/cores/protocol/protocol-sign.js.map +1 -0
- package/dist/cores/storage/index.d.ts +0 -1
- package/dist/cores/storage/index.js +0 -1
- package/dist/cores/storage/index.js.map +1 -1
- package/dist/cores/storage/model-fields.d.ts +7 -0
- package/dist/cores/storage/model-fields.js +21 -0
- package/dist/cores/storage/model-fields.js.map +1 -0
- package/dist/cores/storage/model-manager.d.ts +3 -2
- package/dist/cores/storage/model-manager.js +7 -3
- package/dist/cores/storage/model-manager.js.map +1 -1
- package/dist/engine/builder.js +20 -2
- package/dist/engine/builder.js.map +1 -1
- package/dist/engine/engine.d.ts +2 -2
- package/dist/engine/engine.js +4 -4
- package/dist/engine/engine.js.map +1 -1
- package/dist/engine/utilities.d.ts +11 -12
- package/dist/engine/utilities.js +30 -82
- package/dist/engine/utilities.js.map +1 -1
- package/dist/environ.d.ts +0 -6
- package/dist/environ.js +1 -12
- package/dist/environ.js.map +1 -1
- package/dist/esm/index.mjs +140 -0
- package/dist/esm/testing.mjs +12 -0
- package/dist/extended/abstract-service.d.ts +48 -139
- package/dist/extended/abstract-service.js +46 -382
- package/dist/extended/abstract-service.js.map +1 -1
- package/dist/extended/cores/abstract-controllers.d.ts +170 -0
- package/dist/extended/cores/abstract-controllers.js +533 -0
- package/dist/extended/cores/abstract-controllers.js.map +1 -0
- package/dist/extended/cores/abstract-rest-apis.d.ts +142 -0
- package/dist/extended/cores/abstract-rest-apis.js +203 -0
- package/dist/extended/cores/abstract-rest-apis.js.map +1 -0
- package/dist/extended/cores/abstract-services.d.ts +771 -0
- package/dist/extended/cores/abstract-services.js +2042 -0
- package/dist/extended/cores/abstract-services.js.map +1 -0
- package/dist/extended/cores/browser-cache.d.ts +2 -0
- package/dist/extended/cores/browser-cache.js +34 -0
- package/dist/extended/cores/browser-cache.js.map +1 -0
- package/dist/extended/cores/commons.d.ts +20 -0
- package/dist/extended/cores/commons.js +31 -0
- package/dist/extended/cores/commons.js.map +1 -0
- package/dist/extended/cores/index.d.ts +15 -0
- package/dist/extended/cores/index.js +32 -0
- package/dist/extended/cores/index.js.map +1 -0
- package/dist/extended/cores/types.d.ts +14 -0
- package/dist/extended/cores/types.js +31 -0
- package/dist/extended/cores/types.js.map +1 -0
- package/dist/helpers/helpers.d.ts +10 -5
- package/dist/helpers/helpers.js +46 -58
- package/dist/helpers/helpers.js.map +1 -1
- package/dist/helpers/types.d.ts +22 -10
- package/dist/index.d.ts +4 -0
- package/dist/index.js +12 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/http-fetch.d.ts +54 -0
- package/dist/lib/http-fetch.js +133 -0
- package/dist/lib/http-fetch.js.map +1 -0
- package/dist/lib/lazy.d.ts +22 -0
- package/dist/lib/lazy.js +54 -0
- package/dist/lib/lazy.js.map +1 -0
- package/dist/lib/perf.d.ts +35 -0
- package/dist/lib/perf.js +52 -0
- package/dist/lib/perf.js.map +1 -0
- package/dist/tools/tools.d.ts +15 -3
- package/dist/tools/tools.js +21 -4
- package/dist/tools/tools.js.map +1 -1
- package/package.json +96 -39
- package/dist/cores/storage/redis-storage-service.d.ts +0 -183
- package/dist/cores/storage/redis-storage-service.js +0 -377
- package/dist/cores/storage/redis-storage-service.js.map +0 -1
- package/dist/generated/field-registry.d.ts +0 -10
- package/dist/generated/field-registry.js +0 -17
- package/dist/generated/field-registry.js.map +0 -1
|
@@ -1,482 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import elasticsearch from '@elastic/elasticsearch';
|
|
3
|
-
import $hangul from './hangul-service';
|
|
4
|
-
export { elasticsearch, $hangul };
|
|
5
|
-
export type SearchType = 'query_then_fetch' | 'dfs_query_then_fetch';
|
|
6
|
-
export interface SearchResponse<T = any> {
|
|
7
|
-
total: number;
|
|
8
|
-
list: Array<T>;
|
|
9
|
-
last: Array<T>;
|
|
10
|
-
aggregations: T;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* options for construction.
|
|
14
|
-
*/
|
|
15
|
-
export interface ElasticOption {
|
|
16
|
-
/**
|
|
17
|
-
* endpoint url of ES6
|
|
18
|
-
*/
|
|
19
|
-
endpoint: string;
|
|
20
|
-
/**
|
|
21
|
-
* index-name
|
|
22
|
-
*/
|
|
23
|
-
indexName: string;
|
|
24
|
-
/**
|
|
25
|
-
* document type (default as `_doc` in ES6)
|
|
26
|
-
* - it must be `_doc` since ES6.x
|
|
27
|
-
*/
|
|
28
|
-
docType?: string;
|
|
29
|
-
/**
|
|
30
|
-
* id-name (optional if time-seriese)
|
|
31
|
-
*/
|
|
32
|
-
idName?: string;
|
|
33
|
-
/**
|
|
34
|
-
* is TIMESERIES data?
|
|
35
|
-
*/
|
|
36
|
-
timeSeries?: boolean;
|
|
37
|
-
/**
|
|
38
|
-
* (optional) version of engine.
|
|
39
|
-
* - (default) 6.8
|
|
40
|
-
*/
|
|
41
|
-
version?: string;
|
|
42
|
-
/**
|
|
43
|
-
* fields to provide autocomplete(Search-as-You-Type) feature
|
|
44
|
-
*/
|
|
45
|
-
autocompleteFields?: string[] | null;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* common type of item
|
|
49
|
-
*/
|
|
50
|
-
export interface ElasticItem {
|
|
51
|
-
_id?: string;
|
|
52
|
-
_version?: number;
|
|
53
|
-
_score?: number;
|
|
54
|
-
/**
|
|
55
|
-
* only has simple string or number (and in arrays)
|
|
56
|
-
*/
|
|
57
|
-
[key: string]: string | string[] | number | number[] | undefined;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* options for retrying searchAll
|
|
61
|
-
*/
|
|
62
|
-
export interface RetryOptions {
|
|
63
|
-
/** do retry? (default true) */
|
|
64
|
-
do?: boolean;
|
|
65
|
-
/** retry after t msec (default 5000ms) */
|
|
66
|
-
t?: number;
|
|
67
|
-
/** maximum Retries (default 3 times) */
|
|
68
|
-
maxRetries?: number;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* parameters for searchAll
|
|
72
|
-
*/
|
|
73
|
-
interface ElasticSearchAllParams {
|
|
74
|
-
/** search-type */
|
|
75
|
-
searchType?: SearchType;
|
|
76
|
-
/** limit (default -1) */
|
|
77
|
-
limit?: number;
|
|
78
|
-
/** options for retrying (default true)*/
|
|
79
|
-
retryOptions?: RetryOptions;
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* type of search-engine type
|
|
83
|
-
*/
|
|
84
|
-
export type EngineType = 'os' | 'es';
|
|
85
|
-
/**
|
|
86
|
-
* parsed version with major and minor version numbers.
|
|
87
|
-
*/
|
|
88
|
-
export interface ParsedVersion {
|
|
89
|
-
/** search-engine type */
|
|
90
|
-
engine?: EngineType;
|
|
91
|
-
/** major version */
|
|
92
|
-
major: number;
|
|
93
|
-
/** minor version */
|
|
94
|
-
minor: number;
|
|
95
|
-
/** patch version */
|
|
96
|
-
patch: number;
|
|
97
|
-
/** pre-release label (e.g., 'alpha', 'beta') */
|
|
98
|
-
prerelease?: string;
|
|
99
|
-
/** build metadata */
|
|
100
|
-
build?: string;
|
|
101
|
-
}
|
|
102
|
-
/** ****************************************************************************************************************
|
|
103
|
-
* Elastic Index Service
|
|
104
|
-
** ****************************************************************************************************************/
|
|
105
|
-
/**
|
|
106
|
-
* abstarct class: `ElasticIndexService`
|
|
107
|
-
* - abstract class for basic Elasticsearch CRUD operations
|
|
108
|
-
* - common operations that are shared across different versions.
|
|
109
|
-
* TODO - support `Elastic` and `OpenSearch`
|
|
110
|
-
*/
|
|
111
|
-
export declare abstract class ElasticIndexService<T extends ElasticItem = any> {
|
|
112
|
-
protected _options: ElasticOption;
|
|
113
|
-
readonly _client: elasticsearch.Client;
|
|
114
|
-
/**
|
|
115
|
-
* simple instance maker.
|
|
116
|
-
*
|
|
117
|
-
* ```js
|
|
118
|
-
* const { client } = ElasticIndexService.instance(endpoint);
|
|
119
|
-
* ```
|
|
120
|
-
*
|
|
121
|
-
* @param endpoint service-url
|
|
122
|
-
* @see https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/16.x/configuration.html
|
|
123
|
-
*/
|
|
124
|
-
static instance(endpoint: string): {
|
|
125
|
-
client: elasticsearch.Client;
|
|
126
|
-
};
|
|
127
|
-
/**
|
|
128
|
-
* default constuctor w/ options.
|
|
129
|
-
* @param options { endpoint, indexName } is required.
|
|
130
|
-
*/
|
|
131
|
-
constructor(options: ElasticOption);
|
|
132
|
-
/**
|
|
133
|
-
* get the client instance.
|
|
134
|
-
*/
|
|
135
|
-
get client(): elasticsearch.Client;
|
|
136
|
-
/**
|
|
137
|
-
* get the current options.
|
|
138
|
-
*/
|
|
139
|
-
get options(): ElasticOption;
|
|
140
|
-
/**
|
|
141
|
-
* get the version from options
|
|
142
|
-
*/
|
|
143
|
-
get version(): number;
|
|
144
|
-
/**
|
|
145
|
-
* say hello
|
|
146
|
-
*/
|
|
147
|
-
abstract hello(): string;
|
|
148
|
-
/**
|
|
149
|
-
* save an item
|
|
150
|
-
* @param id - item id
|
|
151
|
-
* @param item - item to save
|
|
152
|
-
* @param type - document type
|
|
153
|
-
*/
|
|
154
|
-
abstract saveItem(id: string, item: T, type?: string): Promise<T>;
|
|
155
|
-
/**
|
|
156
|
-
* push item for time-series data
|
|
157
|
-
* @param item - item to push
|
|
158
|
-
* @param type - document type
|
|
159
|
-
*/
|
|
160
|
-
abstract pushItem(item: T, type?: string): Promise<T>;
|
|
161
|
-
/**
|
|
162
|
-
* read item with projections
|
|
163
|
-
* @param id - item id
|
|
164
|
-
* @param views - projections
|
|
165
|
-
*/
|
|
166
|
-
abstract readItem(id: string, views?: string[] | object): Promise<T>;
|
|
167
|
-
/**
|
|
168
|
-
* delete an item by id
|
|
169
|
-
* @param id - item id
|
|
170
|
-
*/
|
|
171
|
-
abstract deleteItem(id: string): Promise<T>;
|
|
172
|
-
/**
|
|
173
|
-
* update an item
|
|
174
|
-
* @param id - item id
|
|
175
|
-
* @param item - item to update
|
|
176
|
-
* @param increments - fields to increment
|
|
177
|
-
*/
|
|
178
|
-
abstract updateItem(id: string, item: T | null, increments?: any, options?: {
|
|
179
|
-
maxRetries?: number;
|
|
180
|
-
}): Promise<T>;
|
|
181
|
-
/**
|
|
182
|
-
* search raw results using a query body
|
|
183
|
-
* @param body - search query
|
|
184
|
-
* @param searchType - type of search
|
|
185
|
-
*/
|
|
186
|
-
abstract searchRaw<T extends object = any>(body: any, searchType?: string): Promise<T>;
|
|
187
|
-
/**
|
|
188
|
-
* search and return formatted response
|
|
189
|
-
* @param body - search query
|
|
190
|
-
* @param searchType - type of search
|
|
191
|
-
*/
|
|
192
|
-
abstract search(body: any, searchType?: string): Promise<any>;
|
|
193
|
-
}
|
|
194
|
-
/** ****************************************************************************************************************
|
|
195
|
-
* Elastic6Service
|
|
196
|
-
** ****************************************************************************************************************/
|
|
197
|
-
export interface Elastic6Option extends ElasticOption {
|
|
198
|
-
}
|
|
199
|
-
export interface Elastic6Item extends ElasticItem {
|
|
200
|
-
}
|
|
201
|
-
/**
|
|
202
|
-
* class: `Elastic6Service`
|
|
203
|
-
* - extends `ElasticIndexService` and adds version-specific implementation
|
|
204
|
-
*/
|
|
205
|
-
export declare class Elastic6Service<T extends ElasticItem = any> extends ElasticIndexService {
|
|
206
|
-
static readonly DECOMPOSED_FIELD = "_decomposed";
|
|
207
|
-
static readonly QWERTY_FIELD = "_qwerty";
|
|
208
|
-
/**
|
|
209
|
-
* default constuctor w/ options.
|
|
210
|
-
* @param options { endpoint, indexName } is required.
|
|
211
|
-
*/
|
|
212
|
-
constructor(options: Elastic6Option);
|
|
213
|
-
/**
|
|
214
|
-
* say hello of identity.
|
|
215
|
-
*/
|
|
216
|
-
hello: () => string;
|
|
217
|
-
/**
|
|
218
|
-
* get isOldES6
|
|
219
|
-
* - used when setting doctype
|
|
220
|
-
* - used when verifying mismatched error and results of search
|
|
221
|
-
*/
|
|
222
|
-
get isOldES6(): boolean;
|
|
223
|
-
/**
|
|
224
|
-
* get isOldES71
|
|
225
|
-
* - used when verifying mismatched error
|
|
226
|
-
*/
|
|
227
|
-
get isOldES71(): boolean;
|
|
228
|
-
/**
|
|
229
|
-
* get isLatestOS2
|
|
230
|
-
* - used when verifying results of search
|
|
231
|
-
*/
|
|
232
|
-
get isLatestOS2(): boolean;
|
|
233
|
-
/**
|
|
234
|
-
* get the parsedVersion
|
|
235
|
-
*/
|
|
236
|
-
get parsedVersion(): ParsedVersion;
|
|
237
|
-
/**
|
|
238
|
-
* get the root version from client
|
|
239
|
-
*
|
|
240
|
-
* @protected only for internal test.
|
|
241
|
-
*/
|
|
242
|
-
protected getVersion(options?: {
|
|
243
|
-
dump?: boolean;
|
|
244
|
-
}): Promise<ParsedVersion>;
|
|
245
|
-
/**
|
|
246
|
-
* check whether the service version matches the version provided in the options.
|
|
247
|
-
*
|
|
248
|
-
* @protected only for internal test.
|
|
249
|
-
*/
|
|
250
|
-
protected executeSelfTest(): Promise<{
|
|
251
|
-
isEqual: boolean;
|
|
252
|
-
optionVersion: ParsedVersion;
|
|
253
|
-
rootVersion: ParsedVersion;
|
|
254
|
-
}>;
|
|
255
|
-
/**
|
|
256
|
-
* parse version according to Semantic Versioning (SemVer) rules.
|
|
257
|
-
*
|
|
258
|
-
* @param version The version string to parse (e.g., "1.2.3", "1.2.3-alpha.1", "1.2.3+build.001").
|
|
259
|
-
* @param options Optional configuration for throwable behavior.
|
|
260
|
-
* @returns A ParsedVersion object or null if parsing fails and throwable is false.
|
|
261
|
-
*/
|
|
262
|
-
parseVersion(version: string, options?: {
|
|
263
|
-
throwable?: boolean;
|
|
264
|
-
}): ParsedVersion;
|
|
265
|
-
/**
|
|
266
|
-
* save info to a JSON file.
|
|
267
|
-
* @param info - The information to be saved
|
|
268
|
-
* @param filePath - The file path where should be saved.
|
|
269
|
-
*/
|
|
270
|
-
private saveInfoToFile;
|
|
271
|
-
/**
|
|
272
|
-
* list of index
|
|
273
|
-
*/
|
|
274
|
-
listIndices(): Promise<{
|
|
275
|
-
list: {
|
|
276
|
-
pri: number;
|
|
277
|
-
rep: number;
|
|
278
|
-
docsCount: number;
|
|
279
|
-
docsDeleted: number;
|
|
280
|
-
health: string;
|
|
281
|
-
index: string;
|
|
282
|
-
status: string;
|
|
283
|
-
uuid: string;
|
|
284
|
-
priStoreSize: string;
|
|
285
|
-
storeSize: string;
|
|
286
|
-
}[];
|
|
287
|
-
}>;
|
|
288
|
-
/**
|
|
289
|
-
* get mapping of an index
|
|
290
|
-
* @param indexName - name of the index
|
|
291
|
-
*/
|
|
292
|
-
getIndexMapping(): Promise<any>;
|
|
293
|
-
/**
|
|
294
|
-
* find the index by name
|
|
295
|
-
* @param indexName - name of the index
|
|
296
|
-
*/
|
|
297
|
-
findIndex(indexName?: string): Promise<{
|
|
298
|
-
pri: number;
|
|
299
|
-
rep: number;
|
|
300
|
-
docsCount: number;
|
|
301
|
-
docsDeleted: number;
|
|
302
|
-
health: string;
|
|
303
|
-
index: string;
|
|
304
|
-
status: string;
|
|
305
|
-
uuid: string;
|
|
306
|
-
priStoreSize: string;
|
|
307
|
-
storeSize: string;
|
|
308
|
-
}>;
|
|
309
|
-
/**
|
|
310
|
-
* create index by name
|
|
311
|
-
* @param settings - creating settings
|
|
312
|
-
*/
|
|
313
|
-
createIndex(settings?: any): Promise<{
|
|
314
|
-
status: any;
|
|
315
|
-
index: string;
|
|
316
|
-
acknowledged: any;
|
|
317
|
-
}>;
|
|
318
|
-
/**
|
|
319
|
-
* destroy search index
|
|
320
|
-
*/
|
|
321
|
-
destroyIndex(): Promise<{
|
|
322
|
-
status: any;
|
|
323
|
-
index: string;
|
|
324
|
-
acknowledged: any;
|
|
325
|
-
}>;
|
|
326
|
-
/**
|
|
327
|
-
* refresh search index - refresh index to make all items searchable
|
|
328
|
-
*/
|
|
329
|
-
refreshIndex(): Promise<any>;
|
|
330
|
-
/**
|
|
331
|
-
* flush search index - force store changes into search index immediately
|
|
332
|
-
*/
|
|
333
|
-
flushIndex(): Promise<any>;
|
|
334
|
-
/**
|
|
335
|
-
* describe `settings` and `mappings` of index.
|
|
336
|
-
*/
|
|
337
|
-
describe(): Promise<{
|
|
338
|
-
settings: any;
|
|
339
|
-
mappings: any;
|
|
340
|
-
}>;
|
|
341
|
-
/**
|
|
342
|
-
* save single item
|
|
343
|
-
*
|
|
344
|
-
* @param id - id
|
|
345
|
-
* @param item - item to save
|
|
346
|
-
* @param type - document type (default: doc-type given at construction time)
|
|
347
|
-
*/
|
|
348
|
-
saveItem(id: string, item: T, type?: string): Promise<T>;
|
|
349
|
-
/**
|
|
350
|
-
* push item for time-series data.
|
|
351
|
-
*
|
|
352
|
-
* @param item - item to push
|
|
353
|
-
* @param type - document type (default: doc-type given at construction time)
|
|
354
|
-
*/
|
|
355
|
-
pushItem(item: T, type?: string): Promise<T>;
|
|
356
|
-
/**
|
|
357
|
-
* read item with projections
|
|
358
|
-
*
|
|
359
|
-
* @param id - item-id
|
|
360
|
-
* @param views - projections
|
|
361
|
-
*/
|
|
362
|
-
readItem(id: string, views?: string[] | object): Promise<T>;
|
|
363
|
-
/**
|
|
364
|
-
* delete item with projections
|
|
365
|
-
*
|
|
366
|
-
* @param id - item-id
|
|
367
|
-
*/
|
|
368
|
-
deleteItem(id: string): Promise<T>;
|
|
369
|
-
/**
|
|
370
|
-
* update item (throw if not exist)
|
|
371
|
-
* `update table set a=1, b=b+2 where id='a1'`
|
|
372
|
-
* 0. no of `a1` -> 1,2 (created)
|
|
373
|
-
* 1. a,b := 10,20 -> 11,22
|
|
374
|
-
* 2. a,b := 10,null -> 11,2 (upsert)
|
|
375
|
-
* 3. a,b := null,20 -> 1,22
|
|
376
|
-
*
|
|
377
|
-
* @param id - item-id
|
|
378
|
-
* @param item - item to update
|
|
379
|
-
* @param increments - item to increase
|
|
380
|
-
* @param options - (optional) request option of client.
|
|
381
|
-
*/
|
|
382
|
-
updateItem(id: string, item: T | null, increments?: Incrementable, options?: {
|
|
383
|
-
maxRetries?: number;
|
|
384
|
-
}): Promise<T>;
|
|
385
|
-
/**
|
|
386
|
-
* run search and get the raw response.
|
|
387
|
-
* @param body - Elasticsearch Query DSL that defines the search request (e.g., size, query, filters).
|
|
388
|
-
* @param searchType - type of search (e.g., 'query_then_fetch', 'dfs_query_then_fetch').
|
|
389
|
-
*/
|
|
390
|
-
searchRaw<T extends object = any>(body: SearchBody, searchType?: SearchType): Promise<T>;
|
|
391
|
-
/**
|
|
392
|
-
* run search, and get the formatmted response.
|
|
393
|
-
* @param body - Elasticsearch Query DSL that defines the search request (e.g., size, query, filters).
|
|
394
|
-
* @param searchType - type of search (e.g., 'query_then_fetch', 'dfs_query_then_fetch').
|
|
395
|
-
*
|
|
396
|
-
*/
|
|
397
|
-
search(body: SearchBody, searchType?: SearchType): Promise<SearchResponse>;
|
|
398
|
-
/**
|
|
399
|
-
* search all until limit (-1 means no-limit)
|
|
400
|
-
* @param body - Elasticsearch Query DSL that defines the search request (e.g., size, query, filters).
|
|
401
|
-
* @param params - parameters including search type, limit, and retry options.
|
|
402
|
-
*/
|
|
403
|
-
searchAll<T>(body: SearchBody, params?: ElasticSearchAllParams): Promise<T[]>;
|
|
404
|
-
/**
|
|
405
|
-
* create async generator that yields items queried until last
|
|
406
|
-
*
|
|
407
|
-
* @param body - Elasticsearch Query DSL that defines the search request (e.g., size, query, filters).
|
|
408
|
-
* @param params - parameters including search type, limit, and retry options.
|
|
409
|
-
*/
|
|
410
|
-
generateSearchResult(body: SearchBody, params?: ElasticSearchAllParams): AsyncGenerator<any[], void, unknown>;
|
|
411
|
-
/**
|
|
412
|
-
* prepare default setting
|
|
413
|
-
* - migrated from engine-v2.
|
|
414
|
-
*
|
|
415
|
-
* @param docType document type name
|
|
416
|
-
* @param idName id-name
|
|
417
|
-
* @param shards number of shards (default 4)
|
|
418
|
-
* @param replicas number of replicas (default 1)
|
|
419
|
-
* @param timeSeries flag of TIMESERIES (default false)
|
|
420
|
-
*/
|
|
421
|
-
static prepareSettings(params: {
|
|
422
|
-
docType: string;
|
|
423
|
-
idName: string;
|
|
424
|
-
version?: string;
|
|
425
|
-
timeSeries?: boolean;
|
|
426
|
-
shards?: number;
|
|
427
|
-
replicas?: number;
|
|
428
|
-
}): any;
|
|
429
|
-
/**
|
|
430
|
-
* generate autocomplete fields into the item body to be indexed
|
|
431
|
-
* @param body item body to be saved into ES6 index
|
|
432
|
-
* @private
|
|
433
|
-
*/
|
|
434
|
-
protected popullateAutocompleteFields<T = any>(body: T): T;
|
|
435
|
-
}
|
|
436
|
-
interface ErrorReasonDetail<T = any> {
|
|
437
|
-
status: number;
|
|
438
|
-
type: string;
|
|
439
|
-
reason?: string;
|
|
440
|
-
cause?: T;
|
|
441
|
-
}
|
|
442
|
-
interface ErrorReason {
|
|
443
|
-
status: number;
|
|
444
|
-
message: string;
|
|
445
|
-
reason: ErrorReasonDetail;
|
|
446
|
-
}
|
|
447
|
-
/**
|
|
448
|
-
* error samples
|
|
449
|
-
*/
|
|
450
|
-
export declare const $ERROR: {
|
|
451
|
-
asJson: (e: any) => any;
|
|
452
|
-
throwAsJson: (e: any) => never;
|
|
453
|
-
parseMeta: <T extends {
|
|
454
|
-
type?: string;
|
|
455
|
-
value?: any;
|
|
456
|
-
error?: string;
|
|
457
|
-
list?: any[];
|
|
458
|
-
[key: string]: any;
|
|
459
|
-
}>(meta: any) => T;
|
|
460
|
-
asError: (e: any) => ErrorReason;
|
|
461
|
-
handler: (name: string, cb?: (e: Error, E?: ErrorReason) => any) => (e: any) => any;
|
|
462
|
-
};
|
|
463
|
-
/** ****************************************************************************************************************
|
|
464
|
-
* Dummy Elastic6 Service
|
|
465
|
-
** ****************************************************************************************************************/
|
|
466
|
-
/**
|
|
467
|
-
* class: `DummyElastic6Service`
|
|
468
|
-
* - service in-memory dummy data
|
|
469
|
-
*/
|
|
470
|
-
export declare class DummyElastic6Service<T extends GeneralItem> extends Elastic6Service<T> {
|
|
471
|
-
constructor(dataFile: string, options: ElasticOption);
|
|
472
|
-
private buffer;
|
|
473
|
-
load(data: T[]): void;
|
|
474
|
-
/**
|
|
475
|
-
* say hello()
|
|
476
|
-
*/
|
|
477
|
-
hello: () => string;
|
|
478
|
-
readItem(id: string): Promise<T>;
|
|
479
|
-
saveItem(id: string, item: T): Promise<T>;
|
|
480
|
-
deleteItem(id: string, sort?: string | number): Promise<T>;
|
|
481
|
-
updateItem(id: string, updates: T, increments?: Incrementable): Promise<T>;
|
|
482
|
-
}
|
|
1
|
+
export * from './os2-service';
|