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.
Files changed (101) hide show
  1. package/README.md +1 -0
  2. package/dist/controllers/dummy-controller.d.ts +1 -1
  3. package/dist/controllers/dummy-controller.js +2 -2
  4. package/dist/controllers/dummy-controller.js.map +1 -1
  5. package/dist/controllers/general-api-controller.d.ts +1 -1
  6. package/dist/cores/api/api-service.d.ts +239 -0
  7. package/dist/cores/api/api-service.js +674 -0
  8. package/dist/cores/api/api-service.js.map +1 -0
  9. package/dist/cores/api/index.d.ts +10 -0
  10. package/dist/cores/api/index.js +27 -0
  11. package/dist/cores/api/index.js.map +1 -0
  12. package/dist/cores/aws/aws-kms-service.d.ts +53 -2
  13. package/dist/cores/aws/aws-kms-service.js +104 -17
  14. package/dist/cores/aws/aws-kms-service.js.map +1 -1
  15. package/dist/cores/cache/cache-service.d.ts +440 -0
  16. package/dist/cores/cache/cache-service.js +967 -0
  17. package/dist/cores/cache/cache-service.js.map +1 -0
  18. package/dist/cores/cache/index.d.ts +10 -0
  19. package/dist/cores/cache/index.js +27 -0
  20. package/dist/cores/cache/index.js.map +1 -0
  21. package/dist/cores/cache-service.d.ts +54 -18
  22. package/dist/cores/cache-service.js +37 -26
  23. package/dist/cores/cache-service.js.map +1 -1
  24. package/dist/cores/core-types.d.ts +42 -12
  25. package/dist/cores/dynamo/dynamo-query-service.d.ts +52 -0
  26. package/dist/cores/dynamo/dynamo-query-service.js +127 -0
  27. package/dist/cores/dynamo/dynamo-query-service.js.map +1 -0
  28. package/dist/cores/dynamo/dynamo-scan-service.d.ts +70 -0
  29. package/dist/cores/dynamo/dynamo-scan-service.js +164 -0
  30. package/dist/cores/dynamo/dynamo-scan-service.js.map +1 -0
  31. package/dist/cores/dynamo/dynamo-service.d.ts +192 -0
  32. package/dist/cores/dynamo/dynamo-service.js +525 -0
  33. package/dist/cores/dynamo/dynamo-service.js.map +1 -0
  34. package/dist/cores/dynamo/index.d.ts +12 -0
  35. package/dist/cores/dynamo/index.js +29 -0
  36. package/dist/cores/dynamo/index.js.map +1 -0
  37. package/dist/cores/elastic/elastic6-query-service.d.ts +104 -0
  38. package/dist/cores/elastic/elastic6-query-service.js +510 -0
  39. package/dist/cores/elastic/elastic6-query-service.js.map +1 -0
  40. package/dist/cores/elastic/elastic6-service.d.ts +273 -0
  41. package/dist/cores/elastic/elastic6-service.js +903 -0
  42. package/dist/cores/elastic/elastic6-service.js.map +1 -0
  43. package/dist/cores/elastic/hangul-service.d.ts +102 -0
  44. package/dist/cores/elastic/hangul-service.js +205 -0
  45. package/dist/cores/elastic/hangul-service.js.map +1 -0
  46. package/dist/cores/elastic/index.d.ts +12 -0
  47. package/dist/cores/elastic/index.js +29 -0
  48. package/dist/cores/elastic/index.js.map +1 -0
  49. package/dist/cores/hangul-service.d.ts +17 -3
  50. package/dist/cores/hangul-service.js +17 -8
  51. package/dist/cores/hangul-service.js.map +1 -1
  52. package/dist/cores/index.d.ts +5 -11
  53. package/dist/cores/index.js +8 -13
  54. package/dist/cores/index.js.map +1 -1
  55. package/dist/cores/lambda/lambda-dynamo-stream-handler.d.ts +2 -2
  56. package/dist/cores/lambda/lambda-web-handler.d.ts +158 -8
  57. package/dist/cores/lambda/lambda-web-handler.js +283 -77
  58. package/dist/cores/lambda/lambda-web-handler.js.map +1 -1
  59. package/dist/cores/protocol/protocol-service.d.ts +4 -0
  60. package/dist/cores/protocol/protocol-service.js +12 -7
  61. package/dist/cores/protocol/protocol-service.js.map +1 -1
  62. package/dist/cores/storage/http-storage-service.d.ts +22 -0
  63. package/dist/cores/storage/http-storage-service.js +129 -0
  64. package/dist/cores/storage/http-storage-service.js.map +1 -0
  65. package/dist/cores/storage/index.d.ts +14 -0
  66. package/dist/cores/storage/index.js +31 -0
  67. package/dist/cores/storage/index.js.map +1 -0
  68. package/dist/cores/storage/model-manager.d.ts +93 -0
  69. package/dist/cores/storage/model-manager.js +192 -0
  70. package/dist/cores/storage/model-manager.js.map +1 -0
  71. package/dist/cores/storage/proxy-storage-service.d.ts +573 -0
  72. package/dist/cores/storage/proxy-storage-service.js +913 -0
  73. package/dist/cores/storage/proxy-storage-service.js.map +1 -0
  74. package/dist/cores/storage/redis-storage-service.d.ts +183 -0
  75. package/dist/cores/storage/redis-storage-service.js +391 -0
  76. package/dist/cores/storage/redis-storage-service.js.map +1 -0
  77. package/dist/cores/storage/storage-service.d.ts +169 -0
  78. package/dist/cores/storage/storage-service.js +374 -0
  79. package/dist/cores/storage/storage-service.js.map +1 -0
  80. package/dist/cores/storage-service.d.ts +1 -1
  81. package/dist/cores/storage-service.js +2 -2
  82. package/dist/cores/storage-service.js.map +1 -1
  83. package/dist/engine/utilities.d.ts +4 -3
  84. package/dist/engine/utilities.js +6 -6
  85. package/dist/engine/utilities.js.map +1 -1
  86. package/dist/environ.d.ts +2 -2
  87. package/dist/environ.js +7 -4
  88. package/dist/environ.js.map +1 -1
  89. package/dist/extended/abstract-service.d.ts +533 -0
  90. package/dist/extended/abstract-service.js +915 -0
  91. package/dist/extended/abstract-service.js.map +1 -0
  92. package/dist/extended/index.d.ts +10 -0
  93. package/dist/extended/index.js +27 -0
  94. package/dist/extended/index.js.map +1 -0
  95. package/dist/helpers/helpers.d.ts +7 -0
  96. package/dist/helpers/helpers.js +7 -0
  97. package/dist/helpers/helpers.js.map +1 -1
  98. package/dist/index.d.ts +1 -0
  99. package/dist/index.js +3 -1
  100. package/dist/index.js.map +1 -1
  101. 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
+ }