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,192 @@
|
|
|
1
|
+
import { GeneralItem, Incrementable } from './../core-types';
|
|
2
|
+
import AWS from 'aws-sdk';
|
|
3
|
+
export declare type KEY_TYPE = 'number' | 'string';
|
|
4
|
+
export interface DynamoOption {
|
|
5
|
+
tableName: string;
|
|
6
|
+
idName: string;
|
|
7
|
+
sortName?: string;
|
|
8
|
+
idType?: KEY_TYPE;
|
|
9
|
+
sortType?: KEY_TYPE;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* type `Updatable`: parameter for updateItem
|
|
13
|
+
* - update field
|
|
14
|
+
* - 'setIndex': array of [index, value] - replace elements in list field
|
|
15
|
+
* - 'removeIndex': array of indices - remove elements from list field
|
|
16
|
+
*/
|
|
17
|
+
export interface Updatable {
|
|
18
|
+
[key: string]: GeneralItem['key'] | {
|
|
19
|
+
setIndex: [number, string | number][];
|
|
20
|
+
} | {
|
|
21
|
+
removeIndex: number[];
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* class: `DynamoService`
|
|
26
|
+
* - basic CRUD service for AWS DynamoDB.
|
|
27
|
+
*/
|
|
28
|
+
export declare class DynamoService<T extends GeneralItem> {
|
|
29
|
+
protected options: DynamoOption;
|
|
30
|
+
constructor(options: DynamoOption);
|
|
31
|
+
/**
|
|
32
|
+
* say hello of identity.
|
|
33
|
+
*/
|
|
34
|
+
hello: () => string;
|
|
35
|
+
/**
|
|
36
|
+
* simple instance maker.
|
|
37
|
+
* @param region (default as `ap-northeast-2`)
|
|
38
|
+
*/
|
|
39
|
+
static instance(region?: string): {
|
|
40
|
+
dynamo: AWS.DynamoDB;
|
|
41
|
+
dynamostr: AWS.DynamoDBStreams;
|
|
42
|
+
dynamodoc: AWS.DynamoDB.DocumentClient;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* export to test..
|
|
46
|
+
*/
|
|
47
|
+
static normalize: (data: any) => any;
|
|
48
|
+
/**
|
|
49
|
+
* prepare `CreateTable` payload.
|
|
50
|
+
*
|
|
51
|
+
* @param ReadCapacityUnits
|
|
52
|
+
* @param WriteCapacityUnits
|
|
53
|
+
* @param StreamEnabled
|
|
54
|
+
*/
|
|
55
|
+
prepareCreateTable(ReadCapacityUnits?: number, WriteCapacityUnits?: number, StreamEnabled?: boolean): {
|
|
56
|
+
TableName: string;
|
|
57
|
+
KeySchema: {
|
|
58
|
+
AttributeName: string;
|
|
59
|
+
KeyType: string;
|
|
60
|
+
}[];
|
|
61
|
+
AttributeDefinitions: {
|
|
62
|
+
AttributeName: string;
|
|
63
|
+
AttributeType: any;
|
|
64
|
+
}[];
|
|
65
|
+
ProvisionedThroughput: {
|
|
66
|
+
ReadCapacityUnits: number;
|
|
67
|
+
WriteCapacityUnits: number;
|
|
68
|
+
};
|
|
69
|
+
StreamSpecification: {
|
|
70
|
+
StreamEnabled: boolean;
|
|
71
|
+
StreamViewType: string;
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* prepare `DeleteTable` payload.
|
|
76
|
+
*/
|
|
77
|
+
prepareDeleteTable(): {
|
|
78
|
+
TableName: string;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* prepare `SaveItem` payload.
|
|
82
|
+
*
|
|
83
|
+
* @param id partition-key
|
|
84
|
+
* @param item
|
|
85
|
+
*/
|
|
86
|
+
prepareSaveItem(id: string, item: T): {
|
|
87
|
+
TableName: string;
|
|
88
|
+
Item: any;
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* prepare `Key` by id + sort key.
|
|
92
|
+
*
|
|
93
|
+
* @param id partition-key
|
|
94
|
+
* @param sort sort-key
|
|
95
|
+
*/
|
|
96
|
+
prepareItemKey(id: string, sort: any): {
|
|
97
|
+
TableName: string;
|
|
98
|
+
Key: {
|
|
99
|
+
[x: string]: string;
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* prepare `UpdateItem` payload.
|
|
104
|
+
*
|
|
105
|
+
* @param id partition-key
|
|
106
|
+
* @param sort sort-key
|
|
107
|
+
* @param $update update set
|
|
108
|
+
* @param $increment increment set.
|
|
109
|
+
*/
|
|
110
|
+
prepareUpdateItem(id: string, sort: any, $update: Updatable, $increment?: Incrementable): any;
|
|
111
|
+
/**
|
|
112
|
+
* create-table
|
|
113
|
+
*
|
|
114
|
+
* @param ReadCapacityUnits
|
|
115
|
+
* @param WriteCapacityUnits
|
|
116
|
+
*/
|
|
117
|
+
createTable(ReadCapacityUnits?: number, WriteCapacityUnits?: number): Promise<import("aws-sdk/lib/request").PromiseResult<AWS.DynamoDB.CreateTableOutput, AWS.AWSError>>;
|
|
118
|
+
/**
|
|
119
|
+
* delete-table
|
|
120
|
+
*
|
|
121
|
+
*/
|
|
122
|
+
deleteTable(): Promise<import("aws-sdk/lib/request").PromiseResult<AWS.DynamoDB.DeleteTableOutput, AWS.AWSError>>;
|
|
123
|
+
/**
|
|
124
|
+
* read-item
|
|
125
|
+
* - read whole data of item.
|
|
126
|
+
*
|
|
127
|
+
* @param id
|
|
128
|
+
* @param sort
|
|
129
|
+
*/
|
|
130
|
+
readItem(id: string, sort?: string | number): Promise<T>;
|
|
131
|
+
/**
|
|
132
|
+
* save-item
|
|
133
|
+
* - save whole data with param (use update if partial save)
|
|
134
|
+
*
|
|
135
|
+
* **WARN** overwrited if exists.
|
|
136
|
+
*
|
|
137
|
+
* @param id
|
|
138
|
+
* @param item
|
|
139
|
+
*/
|
|
140
|
+
saveItem(id: string, item: T): Promise<T>;
|
|
141
|
+
/**
|
|
142
|
+
* delete-item
|
|
143
|
+
* - destroy whole data of item.
|
|
144
|
+
*
|
|
145
|
+
* @param id
|
|
146
|
+
* @param sort
|
|
147
|
+
*/
|
|
148
|
+
deleteItem(id: string, sort?: string | number): Promise<T>;
|
|
149
|
+
/**
|
|
150
|
+
* update-item (or increment-item)
|
|
151
|
+
* - update or create if not exists.
|
|
152
|
+
*
|
|
153
|
+
* @param id
|
|
154
|
+
* @param sort
|
|
155
|
+
* @param updates
|
|
156
|
+
* @param increments
|
|
157
|
+
*/
|
|
158
|
+
updateItem(id: string, sort: string | number, updates: Updatable, increments?: Incrementable): Promise<T>;
|
|
159
|
+
}
|
|
160
|
+
/** ****************************************************************************************************************
|
|
161
|
+
* Dummy Dynamo Service
|
|
162
|
+
** ****************************************************************************************************************/
|
|
163
|
+
/**
|
|
164
|
+
* class: `DummyDynamoService`
|
|
165
|
+
* - service in-memory dummy data
|
|
166
|
+
*/
|
|
167
|
+
export declare class DummyDynamoService<T extends GeneralItem> extends DynamoService<T> {
|
|
168
|
+
constructor(dataFile: string, options: DynamoOption);
|
|
169
|
+
private buffer;
|
|
170
|
+
load(data: T[]): void;
|
|
171
|
+
/**
|
|
172
|
+
* say hello()
|
|
173
|
+
*/
|
|
174
|
+
hello: () => string;
|
|
175
|
+
/**
|
|
176
|
+
* ONLY FOR DUMMY
|
|
177
|
+
* - send list of data.
|
|
178
|
+
*
|
|
179
|
+
* @param page page number starts from 1
|
|
180
|
+
* @param limit limit of count.
|
|
181
|
+
*/
|
|
182
|
+
listItems(page?: number, limit?: number): Promise<{
|
|
183
|
+
page: number;
|
|
184
|
+
limit: number;
|
|
185
|
+
total: number;
|
|
186
|
+
list: T[];
|
|
187
|
+
}>;
|
|
188
|
+
readItem(id: string, sort?: string | number): Promise<T>;
|
|
189
|
+
saveItem(id: string, item: T): Promise<T>;
|
|
190
|
+
deleteItem(id: string, sort?: string | number): Promise<T>;
|
|
191
|
+
updateItem(id: string, sort: string | number, updates: T, increments?: Incrementable): Promise<T>;
|
|
192
|
+
}
|