@famir/database 0.0.3 → 0.0.4
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 +187 -0
- package/dist/database.d.ts +0 -1
- package/dist/database.error.js.map +1 -1
- package/dist/database.functions.d.ts +16 -11
- package/dist/database.functions.js.map +1 -1
- package/dist/database.js +0 -1
- package/dist/database.js.map +1 -1
- package/dist/database.keys.d.ts +1 -1
- package/dist/database.keys.js +3 -3
- package/dist/database.keys.js.map +1 -1
- package/dist/database.schemas.js.map +1 -1
- package/dist/modules/base/redis-base.repository.d.ts +7 -7
- package/dist/modules/base/redis-base.repository.js +64 -44
- package/dist/modules/base/redis-base.repository.js.map +1 -1
- package/dist/modules/campaign/campaign.d.ts +2 -1
- package/dist/modules/campaign/campaign.functions.d.ts +4 -4
- package/dist/modules/campaign/campaign.functions.js +8 -8
- package/dist/modules/campaign/campaign.functions.js.map +1 -1
- package/dist/modules/campaign/campaign.js +1 -0
- package/dist/modules/campaign/campaign.js.map +1 -1
- package/dist/modules/campaign/campaign.models.js.map +1 -1
- package/dist/modules/campaign/campaign.schemas.d.ts +1 -0
- package/dist/modules/campaign/campaign.schemas.js +64 -110
- package/dist/modules/campaign/campaign.schemas.js.map +1 -1
- package/dist/modules/campaign/redis-campaign.repository.js +28 -12
- package/dist/modules/campaign/redis-campaign.repository.js.map +1 -1
- package/dist/modules/index.d.ts +1 -0
- package/dist/modules/index.js +1 -0
- package/dist/modules/index.js.map +1 -1
- package/dist/modules/lure/lure.functions.d.ts +2 -2
- package/dist/modules/lure/lure.functions.js +1 -1
- package/dist/modules/lure/lure.functions.js.map +1 -1
- package/dist/modules/lure/lure.js.map +1 -1
- package/dist/modules/lure/lure.models.js.map +1 -1
- package/dist/modules/lure/lure.schemas.js +13 -26
- package/dist/modules/lure/lure.schemas.js.map +1 -1
- package/dist/modules/lure/redis-lure.repository.js +19 -6
- package/dist/modules/lure/redis-lure.repository.js.map +1 -1
- package/dist/modules/message/message.functions.d.ts +4 -3
- package/dist/modules/message/message.functions.js +4 -4
- package/dist/modules/message/message.functions.js.map +1 -1
- package/dist/modules/message/message.js.map +1 -1
- package/dist/modules/message/message.models.js.map +1 -1
- package/dist/modules/message/message.schemas.js +35 -102
- package/dist/modules/message/message.schemas.js.map +1 -1
- package/dist/modules/message/redis-message.repository.js +10 -7
- package/dist/modules/message/redis-message.repository.js.map +1 -1
- package/dist/modules/proxy/proxy.functions.d.ts +2 -2
- package/dist/modules/proxy/proxy.functions.js +1 -1
- package/dist/modules/proxy/proxy.functions.js.map +1 -1
- package/dist/modules/proxy/proxy.js.map +1 -1
- package/dist/modules/proxy/proxy.models.js.map +1 -1
- package/dist/modules/proxy/proxy.schemas.js +12 -23
- package/dist/modules/proxy/proxy.schemas.js.map +1 -1
- package/dist/modules/proxy/redis-proxy.repository.js +19 -6
- package/dist/modules/proxy/redis-proxy.repository.js.map +1 -1
- package/dist/modules/redirector/redirector.functions.d.ts +1 -1
- package/dist/modules/redirector/redirector.functions.js +1 -1
- package/dist/modules/redirector/redirector.functions.js.map +1 -1
- package/dist/modules/redirector/redirector.js.map +1 -1
- package/dist/modules/redirector/redirector.models.js.map +1 -1
- package/dist/modules/redirector/redirector.schemas.js +26 -48
- package/dist/modules/redirector/redirector.schemas.js.map +1 -1
- package/dist/modules/redirector/redis-redirector.repository.js +22 -6
- package/dist/modules/redirector/redis-redirector.repository.js.map +1 -1
- package/dist/modules/session/redis-session.repository.js +15 -6
- package/dist/modules/session/redis-session.repository.js.map +1 -1
- package/dist/modules/session/session.functions.d.ts +3 -3
- package/dist/modules/session/session.functions.js +2 -2
- package/dist/modules/session/session.functions.js.map +1 -1
- package/dist/modules/session/session.js.map +1 -1
- package/dist/modules/session/session.models.js.map +1 -1
- package/dist/modules/session/session.schemas.js +21 -37
- package/dist/modules/session/session.schemas.js.map +1 -1
- package/dist/modules/target/redis-target.repository.d.ts +2 -2
- package/dist/modules/target/redis-target.repository.js +51 -30
- package/dist/modules/target/redis-target.repository.js.map +1 -1
- package/dist/modules/target/target.d.ts +2 -1
- package/dist/modules/target/target.functions.d.ts +13 -7
- package/dist/modules/target/target.functions.js +28 -21
- package/dist/modules/target/target.functions.js.map +1 -1
- package/dist/modules/target/target.js.map +1 -1
- package/dist/modules/target/target.models.d.ts +3 -1
- package/dist/modules/target/target.models.js +3 -3
- package/dist/modules/target/target.models.js.map +1 -1
- package/dist/modules/target/target.schemas.d.ts +3 -1
- package/dist/modules/target/target.schemas.js +110 -180
- package/dist/modules/target/target.schemas.js.map +1 -1
- package/dist/redis-database-connector.d.ts +1 -1
- package/dist/redis-database-connector.js +6 -6
- package/dist/redis-database-connector.js.map +1 -1
- package/dist/redis-database-manager.js +7 -2
- package/dist/redis-database-manager.js.map +1 -1
- package/dist/redis-functions.js +7 -7
- package/dist/redis-functions.js.map +1 -1
- package/package.json +7 -4
|
@@ -1,4 +1,63 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { booleanSchema, counterSchema, customIdentSchema, timestampSchema, } from '@famir/validator';
|
|
2
|
+
import { TARGET_ACCESS_LEVELS, } from './target.models.js';
|
|
3
|
+
export const targetAccessLevelSchema = {
|
|
4
|
+
type: 'string',
|
|
5
|
+
enum: [...TARGET_ACCESS_LEVELS],
|
|
6
|
+
};
|
|
7
|
+
export const targetSubSchema = {
|
|
8
|
+
type: 'string',
|
|
9
|
+
minLength: 1,
|
|
10
|
+
maxLength: 256,
|
|
11
|
+
};
|
|
12
|
+
export const targetDomainSchema = {
|
|
13
|
+
type: 'string',
|
|
14
|
+
minLength: 1,
|
|
15
|
+
maxLength: 256,
|
|
16
|
+
};
|
|
17
|
+
export const targetPortSchema = {
|
|
18
|
+
type: 'number',
|
|
19
|
+
minimum: 0,
|
|
20
|
+
maximum: 65535,
|
|
21
|
+
};
|
|
22
|
+
export const targetLabelSchema = {
|
|
23
|
+
type: 'string',
|
|
24
|
+
minLength: 3,
|
|
25
|
+
maxLength: 64,
|
|
26
|
+
};
|
|
27
|
+
export const targetLabelsSchema = {
|
|
28
|
+
type: 'array',
|
|
29
|
+
items: targetLabelSchema,
|
|
30
|
+
};
|
|
31
|
+
export const targetConnectTimeoutSchema = {
|
|
32
|
+
type: 'integer',
|
|
33
|
+
minimum: 1,
|
|
34
|
+
maximum: 60 * 1000,
|
|
35
|
+
};
|
|
36
|
+
export const targetSimpleTimeoutSchema = {
|
|
37
|
+
type: 'integer',
|
|
38
|
+
minimum: 1,
|
|
39
|
+
maximum: 300 * 1000,
|
|
40
|
+
};
|
|
41
|
+
export const targetStreamTimeoutSchema = {
|
|
42
|
+
type: 'integer',
|
|
43
|
+
minimum: 1,
|
|
44
|
+
maximum: 3600 * 1000,
|
|
45
|
+
};
|
|
46
|
+
export const targetHeadersSizeLimitSchema = {
|
|
47
|
+
type: 'integer',
|
|
48
|
+
minimum: 1,
|
|
49
|
+
maximum: 1024 * 1024,
|
|
50
|
+
};
|
|
51
|
+
export const targetBodySizeLimitSchema = {
|
|
52
|
+
type: 'integer',
|
|
53
|
+
minimum: 1,
|
|
54
|
+
maximum: 1024 * 1024 * 1024,
|
|
55
|
+
};
|
|
56
|
+
export const targetContentSchema = {
|
|
57
|
+
type: 'string',
|
|
58
|
+
minLength: 0,
|
|
59
|
+
maxLength: 10 * 1024 * 1024,
|
|
60
|
+
};
|
|
2
61
|
const rawTargetSchema = {
|
|
3
62
|
type: 'object',
|
|
4
63
|
required: [
|
|
@@ -18,48 +77,20 @@ const rawTargetSchema = {
|
|
|
18
77
|
'created_at',
|
|
19
78
|
],
|
|
20
79
|
properties: {
|
|
21
|
-
campaign_id:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
},
|
|
36
|
-
donor_domain: {
|
|
37
|
-
type: 'string',
|
|
38
|
-
},
|
|
39
|
-
donor_port: {
|
|
40
|
-
type: 'integer',
|
|
41
|
-
},
|
|
42
|
-
mirror_secure: {
|
|
43
|
-
type: 'integer',
|
|
44
|
-
},
|
|
45
|
-
mirror_sub: {
|
|
46
|
-
type: 'string',
|
|
47
|
-
},
|
|
48
|
-
mirror_domain: {
|
|
49
|
-
type: 'string',
|
|
50
|
-
},
|
|
51
|
-
mirror_port: {
|
|
52
|
-
type: 'integer',
|
|
53
|
-
},
|
|
54
|
-
is_enabled: {
|
|
55
|
-
type: 'integer',
|
|
56
|
-
},
|
|
57
|
-
message_count: {
|
|
58
|
-
type: 'integer',
|
|
59
|
-
},
|
|
60
|
-
created_at: {
|
|
61
|
-
type: 'integer',
|
|
62
|
-
},
|
|
80
|
+
campaign_id: customIdentSchema,
|
|
81
|
+
target_id: customIdentSchema,
|
|
82
|
+
access_level: targetAccessLevelSchema,
|
|
83
|
+
donor_secure: booleanSchema,
|
|
84
|
+
donor_sub: targetSubSchema,
|
|
85
|
+
donor_domain: targetDomainSchema,
|
|
86
|
+
donor_port: targetPortSchema,
|
|
87
|
+
mirror_secure: booleanSchema,
|
|
88
|
+
mirror_sub: targetSubSchema,
|
|
89
|
+
mirror_domain: targetDomainSchema,
|
|
90
|
+
mirror_port: targetPortSchema,
|
|
91
|
+
is_enabled: booleanSchema,
|
|
92
|
+
message_count: counterSchema,
|
|
93
|
+
created_at: timestampSchema,
|
|
63
94
|
},
|
|
64
95
|
additionalProperties: false,
|
|
65
96
|
};
|
|
@@ -94,151 +125,50 @@ const rawFullTargetSchema = {
|
|
|
94
125
|
'created_at',
|
|
95
126
|
],
|
|
96
127
|
properties: {
|
|
97
|
-
campaign_id:
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
},
|
|
124
|
-
mirror_domain: {
|
|
125
|
-
type: 'string',
|
|
126
|
-
},
|
|
127
|
-
mirror_port: {
|
|
128
|
-
type: 'integer',
|
|
129
|
-
},
|
|
130
|
-
labels: {
|
|
131
|
-
type: 'array',
|
|
132
|
-
items: {
|
|
133
|
-
type: 'string',
|
|
134
|
-
},
|
|
135
|
-
},
|
|
136
|
-
connect_timeout: {
|
|
137
|
-
type: 'integer',
|
|
138
|
-
},
|
|
139
|
-
simple_timeout: {
|
|
140
|
-
type: 'integer',
|
|
141
|
-
},
|
|
142
|
-
stream_timeout: {
|
|
143
|
-
type: 'integer',
|
|
144
|
-
},
|
|
145
|
-
headers_size_limit: {
|
|
146
|
-
type: 'integer',
|
|
147
|
-
},
|
|
148
|
-
body_size_limit: {
|
|
149
|
-
type: 'integer',
|
|
150
|
-
},
|
|
151
|
-
main_page: {
|
|
152
|
-
type: 'string',
|
|
153
|
-
},
|
|
154
|
-
not_found_page: {
|
|
155
|
-
type: 'string',
|
|
156
|
-
},
|
|
157
|
-
favicon_ico: {
|
|
158
|
-
type: 'string',
|
|
159
|
-
},
|
|
160
|
-
robots_txt: {
|
|
161
|
-
type: 'string',
|
|
162
|
-
},
|
|
163
|
-
sitemap_xml: {
|
|
164
|
-
type: 'string',
|
|
165
|
-
},
|
|
166
|
-
allow_websockets: {
|
|
167
|
-
type: 'number',
|
|
168
|
-
},
|
|
169
|
-
is_enabled: {
|
|
170
|
-
type: 'integer',
|
|
171
|
-
},
|
|
172
|
-
message_count: {
|
|
173
|
-
type: 'integer',
|
|
174
|
-
},
|
|
175
|
-
created_at: {
|
|
176
|
-
type: 'integer',
|
|
177
|
-
},
|
|
128
|
+
campaign_id: customIdentSchema,
|
|
129
|
+
target_id: customIdentSchema,
|
|
130
|
+
access_level: targetAccessLevelSchema,
|
|
131
|
+
donor_secure: booleanSchema,
|
|
132
|
+
donor_sub: targetSubSchema,
|
|
133
|
+
donor_domain: targetDomainSchema,
|
|
134
|
+
donor_port: targetPortSchema,
|
|
135
|
+
mirror_secure: booleanSchema,
|
|
136
|
+
mirror_sub: targetSubSchema,
|
|
137
|
+
mirror_domain: targetDomainSchema,
|
|
138
|
+
mirror_port: targetPortSchema,
|
|
139
|
+
labels: targetLabelsSchema,
|
|
140
|
+
connect_timeout: targetConnectTimeoutSchema,
|
|
141
|
+
simple_timeout: targetSimpleTimeoutSchema,
|
|
142
|
+
stream_timeout: targetStreamTimeoutSchema,
|
|
143
|
+
headers_size_limit: targetHeadersSizeLimitSchema,
|
|
144
|
+
body_size_limit: targetBodySizeLimitSchema,
|
|
145
|
+
main_page: targetContentSchema,
|
|
146
|
+
not_found_page: targetContentSchema,
|
|
147
|
+
favicon_ico: targetContentSchema,
|
|
148
|
+
robots_txt: targetContentSchema,
|
|
149
|
+
sitemap_xml: targetContentSchema,
|
|
150
|
+
allow_websockets: booleanSchema,
|
|
151
|
+
is_enabled: booleanSchema,
|
|
152
|
+
message_count: counterSchema,
|
|
153
|
+
created_at: timestampSchema,
|
|
178
154
|
},
|
|
179
155
|
additionalProperties: false,
|
|
180
156
|
};
|
|
181
|
-
export const
|
|
182
|
-
type: 'string',
|
|
183
|
-
enum: [...TARGET_ACCESS_LEVELS],
|
|
184
|
-
};
|
|
185
|
-
export const targetSubSchema = {
|
|
186
|
-
type: 'string',
|
|
187
|
-
minLength: 1,
|
|
188
|
-
maxLength: 128,
|
|
189
|
-
};
|
|
190
|
-
export const targetDomainSchema = {
|
|
191
|
-
type: 'string',
|
|
192
|
-
minLength: 1,
|
|
193
|
-
maxLength: 128,
|
|
194
|
-
};
|
|
195
|
-
export const targetPortSchema = {
|
|
196
|
-
type: 'number',
|
|
197
|
-
minimum: 0,
|
|
198
|
-
maximum: 65535,
|
|
199
|
-
};
|
|
200
|
-
export const targetLabelSchema = {
|
|
201
|
-
type: 'string',
|
|
202
|
-
minLength: 3,
|
|
203
|
-
maxLength: 64,
|
|
204
|
-
};
|
|
205
|
-
export const targetLabelsSchema = {
|
|
157
|
+
export const targetLinkSchema = {
|
|
206
158
|
type: 'array',
|
|
207
|
-
items:
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
type: 'integer',
|
|
211
|
-
minimum: 1,
|
|
212
|
-
maximum: 60 * 1000,
|
|
213
|
-
};
|
|
214
|
-
export const targetSimpleTimeoutSchema = {
|
|
215
|
-
type: 'integer',
|
|
216
|
-
minimum: 1,
|
|
217
|
-
maximum: 5 * 60 * 1000,
|
|
159
|
+
items: [customIdentSchema, customIdentSchema],
|
|
160
|
+
minItems: 2,
|
|
161
|
+
maxItems: 2,
|
|
218
162
|
};
|
|
219
|
-
export const
|
|
220
|
-
type: '
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
};
|
|
224
|
-
export const targetHeadersSizeLimitSchema = {
|
|
225
|
-
type: 'integer',
|
|
226
|
-
minimum: 1,
|
|
227
|
-
maximum: 1024 * 1024,
|
|
228
|
-
};
|
|
229
|
-
export const targetBodySizeLimitSchema = {
|
|
230
|
-
type: 'integer',
|
|
231
|
-
minimum: 1,
|
|
232
|
-
maximum: 1024 * 1024 * 1024,
|
|
233
|
-
};
|
|
234
|
-
export const targetContentSchema = {
|
|
235
|
-
type: 'string',
|
|
236
|
-
minLength: 0,
|
|
237
|
-
maxLength: 10 * 1024 * 1024,
|
|
163
|
+
export const targetHostsSchema = {
|
|
164
|
+
type: 'object',
|
|
165
|
+
required: [],
|
|
166
|
+
additionalProperties: targetLinkSchema,
|
|
238
167
|
};
|
|
239
168
|
export const targetSchemas = {
|
|
240
169
|
'database-raw-target': rawTargetSchema,
|
|
241
170
|
'database-raw-full-target': rawFullTargetSchema,
|
|
242
|
-
'database-target-
|
|
171
|
+
'database-target-link': targetLinkSchema,
|
|
172
|
+
'database-target-hosts': targetHostsSchema,
|
|
243
173
|
};
|
|
244
174
|
//# sourceMappingURL=target.schemas.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"target.schemas.js","sourceRoot":"","sources":["../../../src/modules/target/target.schemas.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"target.schemas.js","sourceRoot":"","sources":["../../../src/modules/target/target.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,eAAe,GAChB,MAAM,kBAAkB,CAAA;AAEzB,OAAO,EACL,oBAAoB,GAIrB,MAAM,oBAAoB,CAAA;AAQ3B,MAAM,CAAC,MAAM,uBAAuB,GAAsC;IACxE,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,CAAC,GAAG,oBAAoB,CAAC;CACvB,CAAA;AAQV,MAAM,CAAC,MAAM,eAAe,GAA2B;IACrD,IAAI,EAAE,QAAQ;IACd,SAAS,EAAE,CAAC;IACZ,SAAS,EAAE,GAAG;CACN,CAAA;AAQV,MAAM,CAAC,MAAM,kBAAkB,GAA2B;IACxD,IAAI,EAAE,QAAQ;IACd,SAAS,EAAE,CAAC;IACZ,SAAS,EAAE,GAAG;CACN,CAAA;AAQV,MAAM,CAAC,MAAM,gBAAgB,GAA2B;IACtD,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,KAAK;CACN,CAAA;AAQV,MAAM,CAAC,MAAM,iBAAiB,GAA2B;IACvD,IAAI,EAAE,QAAQ;IACd,SAAS,EAAE,CAAC;IACZ,SAAS,EAAE,EAAE;CACd,CAAA;AAQD,MAAM,CAAC,MAAM,kBAAkB,GAA6B;IAC1D,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,iBAAiB;CAChB,CAAA;AAQV,MAAM,CAAC,MAAM,0BAA0B,GAA2B;IAChE,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,EAAE,GAAG,IAAI;CACV,CAAA;AAQV,MAAM,CAAC,MAAM,yBAAyB,GAA2B;IAC/D,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AM,gBAAgB,GAA+B;IAC1D,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;IAC7C,QAAQ,EAAE,CAAC;IACX,QAAQ,EAAE,CAAC;CACH,CAAA;AAQV,MAAM,CAAC,MAAM,iBAAiB,GAAgC;IAC5D,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,EAAE;IACZ,oBAAoB,EAAE,gBAAgB;CAC9B,CAAA;AAQV,MAAM,CAAC,MAAM,aAAa,GAAqB;IAC7C,qBAAqB,EAAE,eAAe;IACtC,0BAA0B,EAAE,mBAAmB;IAC/C,sBAAsB,EAAE,gBAAgB;IACxC,uBAAuB,EAAE,iBAAiB;CAClC,CAAA"}
|
|
@@ -7,7 +7,7 @@ export declare class RedisDatabaseConnector implements DatabaseConnector {
|
|
|
7
7
|
protected readonly logger: Logger;
|
|
8
8
|
static register(container: DIContainer): void;
|
|
9
9
|
protected readonly options: RedisDatabaseConnectorOptions;
|
|
10
|
-
protected readonly
|
|
10
|
+
protected readonly connection: RedisDatabaseConnection;
|
|
11
11
|
constructor(config: Config<RedisDatabaseConfig>, logger: Logger);
|
|
12
12
|
getConnection<T>(): T;
|
|
13
13
|
connect(): Promise<void>;
|
|
@@ -11,18 +11,18 @@ export class RedisDatabaseConnector {
|
|
|
11
11
|
container.registerSingleton(DATABASE_CONNECTOR, (c) => new RedisDatabaseConnector(c.resolve(CONFIG), c.resolve(LOGGER)));
|
|
12
12
|
}
|
|
13
13
|
options;
|
|
14
|
-
|
|
14
|
+
connection;
|
|
15
15
|
constructor(config, logger) {
|
|
16
16
|
this.config = config;
|
|
17
17
|
this.logger = logger;
|
|
18
18
|
this.options = this.buildOptions(config.data);
|
|
19
|
-
this.
|
|
19
|
+
this.connection = createClient({
|
|
20
20
|
url: this.options.connectionUrl,
|
|
21
21
|
functions: databaseFunctions,
|
|
22
22
|
name: 'database',
|
|
23
23
|
RESP: 3,
|
|
24
24
|
});
|
|
25
|
-
this.
|
|
25
|
+
this.connection.on('error', (error) => {
|
|
26
26
|
this.logger.error(`Redis error event`, {
|
|
27
27
|
error: serializeError(error),
|
|
28
28
|
});
|
|
@@ -30,14 +30,14 @@ export class RedisDatabaseConnector {
|
|
|
30
30
|
this.logger.debug(`DatabaseConnector initialized`);
|
|
31
31
|
}
|
|
32
32
|
getConnection() {
|
|
33
|
-
return this.
|
|
33
|
+
return this.connection;
|
|
34
34
|
}
|
|
35
35
|
async connect() {
|
|
36
|
-
await this.
|
|
36
|
+
await this.connection.connect();
|
|
37
37
|
this.logger.debug(`DatabaseConnector connected`);
|
|
38
38
|
}
|
|
39
39
|
async close() {
|
|
40
|
-
await this.
|
|
40
|
+
await this.connection.close();
|
|
41
41
|
this.logger.debug(`DatabaseConnector closed`);
|
|
42
42
|
}
|
|
43
43
|
buildOptions(config) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"redis-database-connector.js","sourceRoot":"","sources":["../src/redis-database-connector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,cAAc,EAAE,MAAM,eAAe,CAAA;AAC3D,OAAO,EAAU,MAAM,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAU,MAAM,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,EACL,kBAAkB,GAKnB,MAAM,eAAe,CAAA;AAStB,MAAM,OAAO,sBAAsB;
|
|
1
|
+
{"version":3,"file":"redis-database-connector.js","sourceRoot":"","sources":["../src/redis-database-connector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,cAAc,EAAE,MAAM,eAAe,CAAA;AAC3D,OAAO,EAAU,MAAM,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAU,MAAM,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAA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E/B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAA;IAClD,CAAC;IAED,KAAK,CAAC,KAAK;QACT,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAA;QAE7B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAA;IAC/C,CAAC;IASO,YAAY,CAAC,MAA2B;QAC9C,OAAO;YACL,aAAa,EAAE,MAAM,CAAC,uBAAuB;SAC9C,CAAA;IACH,CAAC;CACF"}
|
|
@@ -17,8 +17,13 @@ export class RedisDatabaseManager {
|
|
|
17
17
|
async loadFunctions() {
|
|
18
18
|
await this.connection.FUNCTION_FLUSH();
|
|
19
19
|
for (const [name, data] of redisFunctions) {
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
try {
|
|
21
|
+
await this.connection.FUNCTION_LOAD(data);
|
|
22
|
+
this.logger.info(`Load redis functions`, { name });
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
this.logger.info(`Load redis functions error`, { name, error });
|
|
26
|
+
}
|
|
22
27
|
}
|
|
23
28
|
}
|
|
24
29
|
async cleanup() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"redis-database-manager.js","sourceRoot":"","sources":["../src/redis-database-manager.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,MAAM,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EACL,kBAAkB,EAClB,gBAAgB,GAIjB,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAOrD,MAAM,OAAO,oBAAoB;
|
|
1
|
+
{"version":3,"file":"redis-database-manager.js","sourceRoot":"","sources":["../src/redis-database-manager.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,MAAM,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EACL,kBAAkB,EAClB,gBAAgB,GAIjB,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE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