lemon-core 3.1.1 → 3.2.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.
Files changed (112) hide show
  1. package/README.md +3 -12
  2. package/dist/controllers/dummy-controller.d.ts +1 -1
  3. package/dist/controllers/general-api-controller.d.ts +1 -1
  4. package/dist/controllers/general-api-controller.js.map +1 -1
  5. package/dist/controllers/general-controller.d.ts +1 -1
  6. package/dist/cores/aws/aws-kms-service.d.ts +1 -0
  7. package/dist/cores/aws/aws-s3-service.d.ts +11 -2
  8. package/dist/cores/aws/aws-s3-service.js +2 -1
  9. package/dist/cores/aws/aws-s3-service.js.map +1 -1
  10. package/dist/cores/aws/aws-sns-service.d.ts +2 -2
  11. package/dist/cores/aws/aws-sns-service.js +2 -2
  12. package/dist/cores/cache/cache-service.js +3 -1
  13. package/dist/cores/cache/cache-service.js.map +1 -1
  14. package/dist/cores/core-services.d.ts +1 -2
  15. package/dist/cores/core-services.js +0 -25
  16. package/dist/cores/core-services.js.map +1 -1
  17. package/dist/cores/dynamo/dynamo-query-service.d.ts +1 -1
  18. package/dist/cores/dynamo/dynamo-scan-service.d.ts +1 -1
  19. package/dist/cores/dynamo/dynamo-service.d.ts +1 -1
  20. package/dist/cores/dynamo/dynamo-service.js +2 -2
  21. package/dist/cores/dynamo/dynamo-service.js.map +1 -1
  22. package/dist/cores/elastic/elastic6-query-service.d.ts +1 -1
  23. package/dist/cores/elastic/elastic6-service.d.ts +7 -4
  24. package/dist/cores/elastic/elastic6-service.js +6 -4
  25. package/dist/cores/elastic/elastic6-service.js.map +1 -1
  26. package/dist/cores/index.d.ts +1 -1
  27. package/dist/cores/index.js +1 -1
  28. package/dist/cores/index.js.map +1 -1
  29. package/dist/cores/lambda/lambda-cron-handler.d.ts +1 -1
  30. package/dist/cores/lambda/lambda-dynamo-stream-handler.d.ts +1 -1
  31. package/dist/cores/lambda/lambda-dynamo-stream-handler.js +1 -1
  32. package/dist/cores/lambda/lambda-dynamo-stream-handler.js.map +1 -1
  33. package/dist/cores/lambda/lambda-handler.d.ts +2 -1
  34. package/dist/cores/lambda/lambda-handler.js.map +1 -1
  35. package/dist/cores/lambda/lambda-notification-handler.d.ts +1 -1
  36. package/dist/cores/lambda/lambda-sns-handler.d.ts +1 -1
  37. package/dist/cores/lambda/lambda-sqs-handler.d.ts +1 -1
  38. package/dist/cores/lambda/lambda-web-handler.d.ts +4 -2
  39. package/dist/cores/lambda/lambda-web-handler.js +19 -10
  40. package/dist/cores/lambda/lambda-web-handler.js.map +1 -1
  41. package/dist/cores/protocol/protocol-service.d.ts +1 -1
  42. package/dist/cores/storage/http-storage-service.js +2 -2
  43. package/dist/cores/storage/http-storage-service.js.map +1 -1
  44. package/dist/cores/storage/model-manager.d.ts +2 -1
  45. package/dist/cores/storage/model-manager.js +3 -3
  46. package/dist/cores/storage/model-manager.js.map +1 -1
  47. package/dist/cores/storage/proxy-storage-service.d.ts +5 -73
  48. package/dist/cores/storage/proxy-storage-service.js +13 -13
  49. package/dist/cores/storage/proxy-storage-service.js.map +1 -1
  50. package/dist/cores/storage/redis-storage-service.js +1 -1
  51. package/dist/cores/storage/redis-storage-service.js.map +1 -1
  52. package/dist/cores/storage/storage-service.d.ts +5 -17
  53. package/dist/cores/storage/storage-service.js +3 -0
  54. package/dist/cores/storage/storage-service.js.map +1 -1
  55. package/dist/engine/engine.d.ts +5 -5
  56. package/dist/engine/engine.js +4 -4
  57. package/dist/engine/engine.js.map +1 -1
  58. package/dist/engine/utilities.js +2 -2
  59. package/dist/engine/utilities.js.map +1 -1
  60. package/dist/environ.js +1 -1
  61. package/dist/environ.js.map +1 -1
  62. package/dist/extended/abstract-service.d.ts +21 -4
  63. package/dist/extended/abstract-service.js +23 -8
  64. package/dist/extended/abstract-service.js.map +1 -1
  65. package/dist/helpers/helpers.d.ts +9 -10
  66. package/dist/helpers/helpers.js +9 -2
  67. package/dist/helpers/helpers.js.map +1 -1
  68. package/dist/tools/shared.js +1 -1
  69. package/dist/tools/shared.js.map +1 -1
  70. package/package.json +31 -30
  71. package/dist/cores/api-service.d.ts +0 -239
  72. package/dist/cores/api-service.js +0 -674
  73. package/dist/cores/api-service.js.map +0 -1
  74. package/dist/cores/cache-service.d.ts +0 -424
  75. package/dist/cores/cache-service.js +0 -948
  76. package/dist/cores/cache-service.js.map +0 -1
  77. package/dist/cores/core-types.d.ts +0 -398
  78. package/dist/cores/core-types.js +0 -15
  79. package/dist/cores/core-types.js.map +0 -1
  80. package/dist/cores/dynamo-query-service.d.ts +0 -52
  81. package/dist/cores/dynamo-query-service.js +0 -127
  82. package/dist/cores/dynamo-query-service.js.map +0 -1
  83. package/dist/cores/dynamo-scan-service.d.ts +0 -70
  84. package/dist/cores/dynamo-scan-service.js +0 -164
  85. package/dist/cores/dynamo-scan-service.js.map +0 -1
  86. package/dist/cores/dynamo-service.d.ts +0 -192
  87. package/dist/cores/dynamo-service.js +0 -525
  88. package/dist/cores/dynamo-service.js.map +0 -1
  89. package/dist/cores/elastic6-query-service.d.ts +0 -104
  90. package/dist/cores/elastic6-query-service.js +0 -510
  91. package/dist/cores/elastic6-query-service.js.map +0 -1
  92. package/dist/cores/elastic6-service.d.ts +0 -273
  93. package/dist/cores/elastic6-service.js +0 -903
  94. package/dist/cores/elastic6-service.js.map +0 -1
  95. package/dist/cores/hangul-service.d.ts +0 -102
  96. package/dist/cores/hangul-service.js +0 -205
  97. package/dist/cores/hangul-service.js.map +0 -1
  98. package/dist/cores/http-storage-service.d.ts +0 -22
  99. package/dist/cores/http-storage-service.js +0 -129
  100. package/dist/cores/http-storage-service.js.map +0 -1
  101. package/dist/cores/model-manager.d.ts +0 -93
  102. package/dist/cores/model-manager.js +0 -192
  103. package/dist/cores/model-manager.js.map +0 -1
  104. package/dist/cores/proxy-storage-service.d.ts +0 -573
  105. package/dist/cores/proxy-storage-service.js +0 -913
  106. package/dist/cores/proxy-storage-service.js.map +0 -1
  107. package/dist/cores/redis-storage-service.d.ts +0 -183
  108. package/dist/cores/redis-storage-service.js +0 -391
  109. package/dist/cores/redis-storage-service.js.map +0 -1
  110. package/dist/cores/storage-service.d.ts +0 -170
  111. package/dist/cores/storage-service.js +0 -389
  112. package/dist/cores/storage-service.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lemon-core",
3
- "version": "3.1.1",
3
+ "version": "3.2.0",
4
4
  "description": "Lemon Serverless Micro-Service Platform",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -49,34 +49,36 @@
49
49
  "dependencies": {
50
50
  "@elastic/elasticsearch": "7.12",
51
51
  "@types/aws-lambda": "^8.10.62",
52
- "@types/express": "^4.17.8",
53
- "@types/ioredis": "^4.17.8",
54
- "@types/jsonwebtoken": "^8.5.0",
55
- "@types/lodash": "^4.14.180",
56
- "async": "^3.2.0",
52
+ "@types/express": "^4.17.11",
53
+ "@types/express-serve-static-core": "^4.17.19",
54
+ "@types/ioredis": "^4.28.10",
55
+ "@types/jsonwebtoken": "^8.5.9",
56
+ "@types/lodash": "^4.14.185",
57
+ "async": "^3.2.4",
57
58
  "aws-lambda": "^1.0.6",
58
59
  "aws-sdk": "2.814",
59
- "body-parser": "^1.19.0",
60
- "cookie-parser": "^1.4.5",
60
+ "body-parser": "^1.20.0",
61
+ "cookie-parser": "^1.4.6",
61
62
  "cors": "^2.8.5",
62
- "express": "^4.16.4",
63
- "ioredis": "^4.19.2",
64
- "js-yaml": "^3.14.0",
65
- "jsonwebtoken": "^8.5.1",
63
+ "express": "^4.18.1",
64
+ "ioredis": "^5.2.3",
65
+ "js-yaml": "^4.1.0",
66
+ "jsonwebtoken": "^9.0.0",
67
+ "lemon-model": "^1.0.1",
66
68
  "lodash": "^4.17.21",
67
69
  "memcached": "^2.2.2",
68
- "mime-types": "^2.1.27",
69
- "multer": "^1.4.1",
70
+ "mime-types": "^2.1.35",
71
+ "multer": "^1.4.5-lts.1",
70
72
  "node-cache": "^5.1.2",
71
- "query-string": "^6.13.1",
73
+ "query-string": "^7.1.1",
72
74
  "request": "^2.88.2",
73
- "request-ip": "^2.1.3",
74
- "source-map-support": "^0.5.19",
75
+ "request-ip": "^3.3.0",
76
+ "source-map-support": "^0.5.21",
75
77
  "ts-transformer-keys": "^0.4.3",
76
- "uuid": "^3.4.0"
78
+ "uuid": "^9.0.0"
77
79
  },
78
80
  "devDependencies": {
79
- "@types/async": "^3.2.3",
81
+ "@types/async": "^3.2.15",
80
82
  "@types/cookie-parser": "^1.4.2",
81
83
  "@types/cors": "^2.8.7",
82
84
  "@types/dotenv": "^6.1.1",
@@ -84,33 +86,32 @@
84
86
  "@types/js-yaml": "^3.12.5",
85
87
  "@types/memcached": "^2.2.6",
86
88
  "@types/mime-types": "^2.1.0",
87
- "@types/multer": "^1.4.4",
88
- "@types/request": "^2.48.5",
89
+ "@types/multer": "^1.4.7",
90
+ "@types/request": "^2.48.8",
89
91
  "@types/request-ip": "0.0.34",
90
92
  "@types/supertest": "^2.0.10",
91
- "@types/uuid": "^3.4.9",
93
+ "@types/uuid": "^8.3.4",
92
94
  "@typescript-eslint/eslint-plugin": "^5.15.0",
93
95
  "@typescript-eslint/parser": "^5.15.0",
94
96
  "codecov": "^3.7.2",
95
97
  "concurrently": "^5.3.0",
96
98
  "dotenv": "^8.2.0",
97
- "eslint": "^8.11.0",
99
+ "eslint": "^8.23.1",
98
100
  "eslint-config-prettier": "^8.5.0",
99
101
  "eslint-plugin-prettier": "^4.0.0",
100
102
  "faker": "^4.1.0",
101
103
  "gh-pages": "^2.2.0",
102
- "husky": "^2.2.0",
104
+ "husky": "^2.7.0",
103
105
  "jest": "^27.5.1",
104
- "lint-staged": "^8.1.6",
105
- "plato": "^1.7.0",
106
- "prettier": "^2.6.0",
106
+ "lint-staged": "^13.0.3",
107
+ "prettier": "^2.7.1",
107
108
  "superagent": "^5.3.1",
108
109
  "supertest": "^4.0.2",
109
- "ts-jest": "^27.1.3",
110
+ "ts-jest": "^27.1.5",
110
111
  "ts-node": "^8.10.2",
111
112
  "ttypescript": "^1.5.13",
112
- "typedoc": "^0.15.8",
113
- "typescript": "^4.6.2"
113
+ "typedoc": "^0.23.15",
114
+ "typescript": "^4.8.3"
114
115
  },
115
116
  "private": false,
116
117
  "repository": {
@@ -1,239 +0,0 @@
1
- /**
2
- * API headers.
3
- */
4
- export interface APIHeaders {
5
- [key: string]: string;
6
- }
7
- /**
8
- * class: `APIServiceClient`
9
- * - General API Request Client w/ url like `GET <endpoint>/<id>?/<cmd>?`
10
- */
11
- export interface APIServiceClient {
12
- hello(): string;
13
- doGet<T = any>(id: string, cmd?: string, param?: any, body?: any, hash?: string): Promise<T>;
14
- doPut<T = any>(id: string, cmd?: string, param?: any, body?: any, hash?: string): Promise<T>;
15
- doPost<T = any>(id: string, cmd?: string, param?: any, body?: any, hash?: string): Promise<T>;
16
- doPatch<T = any>(id: string, cmd?: string, param?: any, body?: any, hash?: string): Promise<T>;
17
- doDelete<T = any>(id: string, cmd?: string, param?: any, body?: any, hash?: string): Promise<T>;
18
- }
19
- /**
20
- * possible method.
21
- */
22
- export declare type APIHttpMethod = 'GET' | 'PUT' | 'POST' | 'PATCH' | 'DELETE';
23
- /**
24
- * class: `ApiHttpProxy`
25
- * - http proxy service.
26
- */
27
- export interface ApiHttpProxy {
28
- /**
29
- * say this service name.
30
- */
31
- hello(): string;
32
- /**
33
- * call http request via proxy server.
34
- *
35
- * url := `<host>/<path?>?<param>`
36
- *
37
- * @param method http method
38
- * @param host host name (or https://~)
39
- * @param path object id
40
- * @param param query paramters
41
- * @param body body
42
- * @param ctx context
43
- * @param hash (optional) hash value (valid only for client-side).
44
- */
45
- doProxy<T = any>(method: APIHttpMethod, host: string, path?: string, param?: any, body?: any, ctx?: any, hash?: string): Promise<T>;
46
- }
47
- /**
48
- * class: `APIProxyClient`
49
- * - proxed APIServiceClient
50
- */
51
- export declare class APIProxyClient implements APIServiceClient {
52
- protected service: APIServiceClient;
53
- constructor(service: APIServiceClient);
54
- hello: () => string;
55
- doGet<T = any>(id: string, cmd?: string, param?: any, body?: any, hash?: string): Promise<T>;
56
- doPut<T = any>(id: string, cmd?: string, param?: any, body?: any, hash?: string): Promise<T>;
57
- doPost<T = any>(id: string, cmd?: string, param?: any, body?: any, hash?: string): Promise<T>;
58
- doPatch<T = any>(id: string, cmd?: string, param?: any, body?: any, hash?: string): Promise<T>;
59
- doDelete<T = any>(id: string, cmd?: string, param?: any, body?: any, hash?: string): Promise<T>;
60
- }
61
- /**
62
- * class: `APIService`
63
- * - use internal http-proxy service due to restriction internet-face in VPC lambda.
64
- */
65
- export declare class APIService implements APIServiceClient {
66
- protected type: string;
67
- protected endpoint: string;
68
- protected headers: APIHeaders;
69
- protected client: APIServiceClient;
70
- /**
71
- * create API service.
72
- *
73
- * ```js
74
- * // basic
75
- * const api = new API('web', 'http://localhost:8081', {});
76
- * api.doGet('');
77
- *
78
- * // via python
79
- * const api = new API('residents', 'http://localhost:8113', {});
80
- * api.doGet('123'); // http GET :8113/residents/123
81
- *
82
- * // proxy server
83
- * const api = new API('web', 'http://localhost:8081', {}, null, proxy);
84
- * api.doGet('');
85
- * ```
86
- *
87
- * @param type type in endpoint
88
- * @param endpoint base endpoint (support ONLY http, https)
89
- * @param headers common headers.
90
- * @param client real api-client to use (or use proxy, or create default)
91
- * @param proxy proxy-service to use if there is no client (or use backbone server)
92
- */
93
- constructor(type: string, endpoint: string, headers?: APIHeaders, client?: APIServiceClient, proxy?: ApiHttpProxy);
94
- hello: () => string;
95
- /**
96
- * helper to make http client
97
- *
98
- * @param backbone backbone address like 'http://localhost:8081'
99
- */
100
- static buildClient(type: string, endpoint: string, headers?: APIHeaders, backbone?: string, proxy?: ApiHttpProxy): APIServiceClient;
101
- /**
102
- * make a client for sub-typed endpoint.
103
- * @param type sub-type path.
104
- */
105
- buildSubTypeClient(type: string, useRecord?: boolean, folder?: string): APIServiceClient;
106
- /**
107
- * make api recorder of this service.
108
- * @param folder base folder (default `./logs`)
109
- */
110
- buildRecorder(folder?: string): APIServiceClient;
111
- /**
112
- * class: `TypedEndpoint`
113
- * - by using common proxy, extends endpoint by type.
114
- * - endpoint := base+'/'+type.
115
- */
116
- private static ProxyServiceClient;
117
- /**
118
- * use sub-typed endpoint.
119
- * - extends as endpoint := parent.endpoint + '/' + type
120
- */
121
- static SubTypeClient: {
122
- new (parent: APIServiceClient, type: string): {
123
- readonly parent: APIServiceClient;
124
- readonly type: string;
125
- hello: () => string;
126
- asCmd: (id: string, cmd?: string) => string;
127
- doGet(id: string, cmd?: string, param?: any, body?: any, hash?: string): Promise<any>;
128
- doPut(id: string, cmd?: string, param?: any, body?: any, hash?: string): Promise<any>;
129
- doPost(id: string, cmd?: string, param?: any, body?: any, hash?: string): Promise<any>;
130
- doPatch(id: string, cmd?: string, param?: any, body?: any, hash?: string): Promise<any>;
131
- doDelete(id: string, cmd?: string, param?: any, body?: any, hash?: string): Promise<any>;
132
- };
133
- };
134
- /**
135
- * recorder of api-http-proxy client.
136
- */
137
- static ApiHttpProxyRecorder: {
138
- new (target: ApiHttpProxy, folder?: string): {
139
- readonly target: ApiHttpProxy;
140
- readonly folder: string;
141
- hello: () => string;
142
- doProxy<T = any>(method: APIHttpMethod, host: string, path?: string, param?: any, body?: any, context?: any, hash?: string): Promise<T>;
143
- };
144
- next: number;
145
- };
146
- /**
147
- * recorder of api-service client.
148
- */
149
- static APIServiceClientRecorder: {
150
- new (target: APIServiceClient, endpoint: string, folder?: string): {
151
- readonly target: APIServiceClient;
152
- readonly endpoint: string;
153
- readonly folder: string;
154
- hello: () => string;
155
- doRecord(method: APIHttpMethod, id: string, cmd?: string, param?: any, body?: any, hash?: string): Promise<any>;
156
- doGet(id: string, cmd?: string, param?: any, body?: any, hash?: string): Promise<any>;
157
- doPut(id: string, cmd?: string, param?: any, body?: any, hash?: string): Promise<any>;
158
- doPost(id: string, cmd?: string, param?: any, body?: any, hash?: string): Promise<any>;
159
- doPatch(id: string, cmd?: string, param?: any, body?: any, hash?: string): Promise<any>;
160
- doDelete(id: string, cmd?: string, param?: any, body?: any, hash?: string): Promise<any>;
161
- };
162
- next: number;
163
- };
164
- /**
165
- * GET HOST/PATH?$param
166
- */
167
- doGet: (id: string, cmd?: string, $param?: any, $body?: any, hash?: string) => Promise<any>;
168
- /**
169
- * PUT HOST/PATH?$param
170
- */
171
- doPut: (id: string, cmd?: string, $param?: any, $body?: any, hash?: string) => Promise<any>;
172
- /**
173
- * POST HOST/PATH?$param
174
- */
175
- doPost: (id: string, cmd?: string, $param?: any, $body?: any, hash?: string) => Promise<any>;
176
- /**
177
- * PATCH HOST/PATH?$param
178
- */
179
- doPatch: (id: string, cmd?: string, $param?: any, $body?: any, hash?: string) => Promise<any>;
180
- /**
181
- * DELETE HOST/PATH?$param
182
- */
183
- doDelete: (id: string, cmd?: string, $param?: any, $body?: any, hash?: string) => Promise<any>;
184
- }
185
- /**
186
- * create http-web-proxy agent which using endpoint as proxy server.
187
- *
188
- * # as cases.
189
- * as proxy agent: GET <endpoint>/<host?>/<path?>
190
- * as direct agent: GET <endpoint>/<id?>/<cmd?>
191
- *
192
- * @param name client-name
193
- * @param endpoint service url (or backbone proxy-url)
194
- * @param headers headers
195
- * @param encoder path encoder (default encodeURIComponent)
196
- * @param relayHeaderKey relay-key in headers for proxy.
197
- * @param resultKey resultKey in response
198
- */
199
- export declare const createHttpWebProxy: (name: string, endpoint: string, headers?: APIHeaders, encoder?: (name: string, path: string) => string, relayHeaderKey?: string, resultKey?: string) => ApiHttpProxy;
200
- /** ********************************************************************************************************************
201
- * MOCKS API-SERVICE
202
- ** ********************************************************************************************************************/
203
- /**
204
- * class: `MocksAPIService`
205
- * - use <mock>.json file in `./data/mocks/` instead of real http request.
206
- * - it redirect to url like `endpoint/type/id/cmd`
207
- *
208
- * ```ts
209
- * // json format
210
- * {
211
- * param: { // input format
212
- * method: string;
213
- * endpoint: string;
214
- * id?: string;
215
- * cmd?: string;
216
- * },
217
- * data: { // response data
218
- * ...
219
- * },
220
- * error?: string; // in case of error.
221
- * }
222
- * ```
223
- */
224
- export declare class MocksAPIService implements ApiHttpProxy, APIServiceClient {
225
- private $map;
226
- private type;
227
- private endpoint;
228
- constructor(type: string, endpoint: string);
229
- protected loadSync(): void;
230
- protected asPath: (id?: string, cmd?: string) => string;
231
- doProxy<T = any>(method: APIHttpMethod, type: string, path: string, param?: any, body?: any, ctx?: any, hash?: string): Promise<T>;
232
- protected na: (a: any, x: string, y: string) => string;
233
- hello: () => string;
234
- doGet<T = any>(id: string, cmd?: string, param?: any, body?: any, hash?: string): Promise<T>;
235
- doPut<T = any>(id: string, cmd?: string, param?: any, body?: any, hash?: string): Promise<T>;
236
- doPost<T = any>(id: string, cmd?: string, param?: any, body?: any, hash?: string): Promise<T>;
237
- doPatch<T = any>(id: string, cmd?: string, param?: any, body?: any, hash?: string): Promise<T>;
238
- doDelete<T = any>(id: string, cmd?: string, param?: any, body?: any, hash?: string): Promise<T>;
239
- }