lemon-core 4.3.0 → 5.0.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.
Files changed (167) hide show
  1. package/README.md +127 -2
  2. package/dist/common/lemon-error.d.ts +34 -0
  3. package/dist/common/lemon-error.js +52 -0
  4. package/dist/common/lemon-error.js.map +1 -0
  5. package/dist/controllers/general-api-controller.d.ts +7 -0
  6. package/dist/controllers/general-api-controller.js +7 -0
  7. package/dist/controllers/general-api-controller.js.map +1 -1
  8. package/dist/cores/api/api-service.js +10 -43
  9. package/dist/cores/api/api-service.js.map +1 -1
  10. package/dist/cores/aws/aws-kms-service.d.ts +13 -5
  11. package/dist/cores/aws/aws-kms-service.js +23 -9
  12. package/dist/cores/aws/aws-kms-service.js.map +1 -1
  13. package/dist/cores/aws/aws-s3-service.d.ts +30 -4
  14. package/dist/cores/aws/aws-s3-service.js +35 -15
  15. package/dist/cores/aws/aws-s3-service.js.map +1 -1
  16. package/dist/cores/aws/aws-sns-service.js +59 -9
  17. package/dist/cores/aws/aws-sns-service.js.map +1 -1
  18. package/dist/cores/aws/aws-sqs-service.d.ts +1 -1
  19. package/dist/cores/aws/aws-sqs-service.js +54 -12
  20. package/dist/cores/aws/aws-sqs-service.js.map +1 -1
  21. package/dist/cores/cache/cache-service.d.ts +10 -9
  22. package/dist/cores/cache/cache-service.js +9 -346
  23. package/dist/cores/cache/cache-service.js.map +1 -1
  24. package/dist/cores/config/config-service.d.ts +3 -15
  25. package/dist/cores/config/config-service.js +5 -34
  26. package/dist/cores/config/config-service.js.map +1 -1
  27. package/dist/cores/dynamo/dynamo-query-service.js +42 -2
  28. package/dist/cores/dynamo/dynamo-query-service.js.map +1 -1
  29. package/dist/cores/dynamo/dynamo-scan-service.js +42 -2
  30. package/dist/cores/dynamo/dynamo-scan-service.js.map +1 -1
  31. package/dist/cores/dynamo/dynamo-service.d.ts +45 -14
  32. package/dist/cores/dynamo/dynamo-service.js +48 -21
  33. package/dist/cores/dynamo/dynamo-service.js.map +1 -1
  34. package/dist/cores/dynamo/tools/expressions.js +32 -22
  35. package/dist/cores/dynamo/tools/expressions.js.map +1 -1
  36. package/dist/cores/dynamo/tools/lang.d.ts +30 -0
  37. package/dist/cores/dynamo/tools/lang.js +75 -0
  38. package/dist/cores/dynamo/tools/lang.js.map +1 -0
  39. package/dist/cores/dynamo/tools/query.js +20 -21
  40. package/dist/cores/dynamo/tools/query.js.map +1 -1
  41. package/dist/cores/dynamo/tools/scan.js +15 -16
  42. package/dist/cores/dynamo/tools/scan.js.map +1 -1
  43. package/dist/cores/dynamo/tools/serializer.js +40 -38
  44. package/dist/cores/dynamo/tools/serializer.js.map +1 -1
  45. package/dist/cores/dynamo/tools/utils.d.ts +6 -2
  46. package/dist/cores/dynamo/tools/utils.js +11 -8
  47. package/dist/cores/dynamo/tools/utils.js.map +1 -1
  48. package/dist/cores/elastic/elastic6-query-service.d.ts +1 -104
  49. package/dist/cores/elastic/elastic6-query-service.js +15 -489
  50. package/dist/cores/elastic/elastic6-query-service.js.map +1 -1
  51. package/dist/cores/elastic/elastic6-service.d.ts +1 -482
  52. package/dist/cores/elastic/elastic6-service.js +15 -1153
  53. package/dist/cores/elastic/elastic6-service.js.map +1 -1
  54. package/dist/cores/elastic/index.d.ts +2 -2
  55. package/dist/cores/elastic/index.js +3 -2
  56. package/dist/cores/elastic/index.js.map +1 -1
  57. package/dist/cores/elastic/os2-query-service.d.ts +104 -0
  58. package/dist/cores/elastic/os2-query-service.js +495 -0
  59. package/dist/cores/elastic/os2-query-service.js.map +1 -0
  60. package/dist/cores/elastic/os2-service.d.ts +372 -0
  61. package/dist/cores/elastic/os2-service.js +943 -0
  62. package/dist/cores/elastic/os2-service.js.map +1 -0
  63. package/dist/cores/index.d.ts +6 -1
  64. package/dist/cores/index.js +9 -2
  65. package/dist/cores/index.js.map +1 -1
  66. package/dist/cores/lambda/index.js +2 -1
  67. package/dist/cores/lambda/index.js.map +1 -1
  68. package/dist/cores/lambda/lambda-cron-handler.d.ts +1 -0
  69. package/dist/cores/lambda/lambda-cron-handler.js +5 -1
  70. package/dist/cores/lambda/lambda-cron-handler.js.map +1 -1
  71. package/dist/cores/lambda/lambda-dynamo-stream-handler.d.ts +5 -4
  72. package/dist/cores/lambda/lambda-dynamo-stream-handler.js +18 -5
  73. package/dist/cores/lambda/lambda-dynamo-stream-handler.js.map +1 -1
  74. package/dist/cores/lambda/lambda-handler.d.ts +22 -2
  75. package/dist/cores/lambda/lambda-handler.js +85 -23
  76. package/dist/cores/lambda/lambda-handler.js.map +1 -1
  77. package/dist/cores/lambda/lambda-sns-handler.d.ts +1 -0
  78. package/dist/cores/lambda/lambda-sns-handler.js +5 -0
  79. package/dist/cores/lambda/lambda-sns-handler.js.map +1 -1
  80. package/dist/cores/lambda/lambda-sqs-handler.d.ts +1 -0
  81. package/dist/cores/lambda/lambda-sqs-handler.js +20 -5
  82. package/dist/cores/lambda/lambda-sqs-handler.js.map +1 -1
  83. package/dist/cores/lambda/lambda-web-handler.d.ts +10 -0
  84. package/dist/cores/lambda/lambda-web-handler.js +107 -41
  85. package/dist/cores/lambda/lambda-web-handler.js.map +1 -1
  86. package/dist/cores/protocol/aws-lambda-helper.js +58 -11
  87. package/dist/cores/protocol/aws-lambda-helper.js.map +1 -1
  88. package/dist/cores/protocol/index.js +3 -0
  89. package/dist/cores/protocol/index.js.map +1 -1
  90. package/dist/cores/protocol/protocol-service.d.ts +26 -5
  91. package/dist/cores/protocol/protocol-service.js +42 -12
  92. package/dist/cores/protocol/protocol-service.js.map +1 -1
  93. package/dist/cores/protocol/protocol-sign.d.ts +72 -0
  94. package/dist/cores/protocol/protocol-sign.js +194 -0
  95. package/dist/cores/protocol/protocol-sign.js.map +1 -0
  96. package/dist/cores/storage/index.d.ts +0 -1
  97. package/dist/cores/storage/index.js +0 -1
  98. package/dist/cores/storage/index.js.map +1 -1
  99. package/dist/cores/storage/model-fields.d.ts +7 -0
  100. package/dist/cores/storage/model-fields.js +21 -0
  101. package/dist/cores/storage/model-fields.js.map +1 -0
  102. package/dist/cores/storage/model-manager.d.ts +5 -2
  103. package/dist/cores/storage/model-manager.js +11 -3
  104. package/dist/cores/storage/model-manager.js.map +1 -1
  105. package/dist/engine/builder.js +20 -2
  106. package/dist/engine/builder.js.map +1 -1
  107. package/dist/engine/engine.d.ts +2 -2
  108. package/dist/engine/engine.js +5 -5
  109. package/dist/engine/engine.js.map +1 -1
  110. package/dist/engine/utilities.d.ts +20 -12
  111. package/dist/engine/utilities.js +57 -86
  112. package/dist/engine/utilities.js.map +1 -1
  113. package/dist/environ.d.ts +0 -6
  114. package/dist/environ.js +1 -12
  115. package/dist/environ.js.map +1 -1
  116. package/dist/esm/index.mjs +141 -0
  117. package/dist/esm/testing.mjs +12 -0
  118. package/dist/extended/abstract-service.d.ts +48 -139
  119. package/dist/extended/abstract-service.js +46 -382
  120. package/dist/extended/abstract-service.js.map +1 -1
  121. package/dist/extended/cores/abstract-controllers.d.ts +25 -0
  122. package/dist/extended/cores/abstract-controllers.js +77 -7
  123. package/dist/extended/cores/abstract-controllers.js.map +1 -1
  124. package/dist/extended/cores/abstract-rest-apis.d.ts +2 -1
  125. package/dist/extended/cores/abstract-rest-apis.js +2 -1
  126. package/dist/extended/cores/abstract-rest-apis.js.map +1 -1
  127. package/dist/extended/cores/abstract-services.d.ts +48 -87
  128. package/dist/extended/cores/abstract-services.js +121 -248
  129. package/dist/extended/cores/abstract-services.js.map +1 -1
  130. package/dist/extended/cores/commons.d.ts +4 -113
  131. package/dist/extended/cores/commons.js +26 -180
  132. package/dist/extended/cores/commons.js.map +1 -1
  133. package/dist/extended/cores/fields-admin.d.ts +91 -0
  134. package/dist/extended/cores/fields-admin.js +142 -0
  135. package/dist/extended/cores/fields-admin.js.map +1 -0
  136. package/dist/extended/cores/index.d.ts +2 -0
  137. package/dist/extended/cores/index.js +2 -0
  138. package/dist/extended/cores/index.js.map +1 -1
  139. package/dist/extended/cores/types.d.ts +3 -225
  140. package/dist/extended/cores/types.js +28 -0
  141. package/dist/extended/cores/types.js.map +1 -1
  142. package/dist/helpers/helpers.d.ts +10 -5
  143. package/dist/helpers/helpers.js +46 -58
  144. package/dist/helpers/helpers.js.map +1 -1
  145. package/dist/helpers/types.d.ts +22 -10
  146. package/dist/index.d.ts +1 -5
  147. package/dist/index.js +8 -14
  148. package/dist/index.js.map +1 -1
  149. package/dist/lib/http-fetch.d.ts +54 -0
  150. package/dist/lib/http-fetch.js +133 -0
  151. package/dist/lib/http-fetch.js.map +1 -0
  152. package/dist/lib/lazy.d.ts +22 -0
  153. package/dist/lib/lazy.js +54 -0
  154. package/dist/lib/lazy.js.map +1 -0
  155. package/dist/lib/perf.d.ts +35 -0
  156. package/dist/lib/perf.js +52 -0
  157. package/dist/lib/perf.js.map +1 -0
  158. package/dist/tools/tools.d.ts +15 -3
  159. package/dist/tools/tools.js +21 -4
  160. package/dist/tools/tools.js.map +1 -1
  161. package/package.json +96 -39
  162. package/dist/cores/storage/redis-storage-service.d.ts +0 -183
  163. package/dist/cores/storage/redis-storage-service.js +0 -377
  164. package/dist/cores/storage/redis-storage-service.js.map +0 -1
  165. package/dist/generated/field-registry.d.ts +0 -12
  166. package/dist/generated/field-registry.js +0 -21
  167. package/dist/generated/field-registry.js.map +0 -1
@@ -1,482 +1 @@
1
- import { GeneralItem, Incrementable, SearchBody } from 'lemon-model';
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';