@creatioart-js/express-storage 1.0.0 → 1.1.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.
- package/CHANGELOG.md +6 -0
- package/README.md +12 -0
- package/lib/enum/database.type.js +2 -5
- package/lib/enum/database.type.js.map +1 -1
- package/lib/enum/datastore.operator.type.js +2 -5
- package/lib/enum/datastore.operator.type.js.map +1 -1
- package/lib/enum/firestore.operator.type.js +2 -5
- package/lib/enum/firestore.operator.type.js.map +1 -1
- package/lib/index.d.ts +13 -13
- package/lib/index.js +8 -19
- package/lib/index.js.map +1 -1
- package/lib/repository/base.datastore.repository.d.ts +1 -1
- package/lib/repository/base.datastore.repository.js +40 -44
- package/lib/repository/base.datastore.repository.js.map +1 -1
- package/lib/repository/base.firestore.repository.d.ts +1 -1
- package/lib/repository/base.firestore.repository.js +43 -47
- package/lib/repository/base.firestore.repository.js.map +1 -1
- package/lib/repository/interface/iRepository.js +1 -2
- package/lib/repository/interface/iRepository.manager.repository.d.ts +1 -1
- package/lib/repository/interface/iRepository.manager.repository.js +1 -2
- package/lib/service/base.service.d.ts +1 -1
- package/lib/service/base.service.js +35 -39
- package/lib/service/base.service.js.map +1 -1
- package/lib/service/big.query.service.d.ts +1 -1
- package/lib/service/big.query.service.js +40 -44
- package/lib/service/big.query.service.js.map +1 -1
- package/lib/service/interface/ibase.service.js +1 -2
- package/lib/service/interface/ibig.query.service.js +1 -2
- package/lib/service/interface/iredis.cache.service.js +1 -2
- package/lib/service/redis.cache.service.d.ts +1 -1
- package/lib/service/redis.cache.service.js +27 -31
- package/lib/service/redis.cache.service.js.map +1 -1
- package/package.json +34 -55
|
@@ -1,44 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const express_error_1 = require("@creatioart-js/express-error");
|
|
8
|
-
const express_error_handler_1 = require("@creatioart-js/express-error-handler");
|
|
9
|
-
class BigQueryService {
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
import { ErrorHelper, ErrorStatus } from '@creatioart-js/express-core';
|
|
3
|
+
import { Logger } from '@creatioart-js/express-logging';
|
|
4
|
+
import { ErrorCode, InternalError } from '@creatioart-js/express-error';
|
|
5
|
+
import { ErrorResponse } from '@creatioart-js/express-error-handler';
|
|
6
|
+
export class BigQueryService {
|
|
10
7
|
async insertRowInBigQuery(bigqueryClient, datasetName, schema, tableName, partitionConfig, row, traceId) {
|
|
11
|
-
|
|
8
|
+
Logger().info(`Save one Rows In Big Query. Trace: ${traceId}`);
|
|
12
9
|
let response = false;
|
|
13
10
|
const rows = [row];
|
|
14
11
|
const promise = new Promise((resolve, reject) => {
|
|
15
12
|
try {
|
|
16
|
-
|
|
13
|
+
Logger().info(`Reference to ${datasetName} DataSet. Trace: ${traceId}`);
|
|
17
14
|
const datasetRef = bigqueryClient.dataset(datasetName);
|
|
18
15
|
datasetRef.get({ autoCreate: true }).then(function (data) {
|
|
19
16
|
const dataset = data[0];
|
|
20
|
-
|
|
17
|
+
Logger().info(`Reference to ${tableName} Table. Trace: ${traceId}`);
|
|
21
18
|
const tableRef = dataset.table(tableName);
|
|
22
19
|
tableRef.exists(function (errExist, exists) {
|
|
23
20
|
if (errExist) {
|
|
24
|
-
|
|
21
|
+
Logger().error(`Exist error: ${JSON.stringify(errExist)}. Trace: ${traceId}`);
|
|
25
22
|
}
|
|
26
23
|
if (exists) {
|
|
27
24
|
dataset.table(tableName).insert(rows).then(() => {
|
|
28
25
|
resolve({});
|
|
29
26
|
}).catch((inserError) => {
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
Logger().error(ErrorHelper.toErrorString(inserError, traceId));
|
|
28
|
+
Logger().error(`Exist table insert error: ${JSON.stringify(inserError)}. Trace: ${traceId}`);
|
|
32
29
|
reject(new Error());
|
|
33
30
|
});
|
|
34
31
|
}
|
|
35
32
|
else {
|
|
36
|
-
|
|
33
|
+
Logger().info(`Create a new table ${datasetName} table. Trace: ${traceId}`);
|
|
37
34
|
const options = {
|
|
38
35
|
schema,
|
|
39
36
|
};
|
|
40
37
|
if (partitionConfig !== undefined) {
|
|
41
|
-
|
|
38
|
+
Logger().info('Set Partition Table');
|
|
42
39
|
options.timePartitioning = {
|
|
43
40
|
expirationMs: partitionConfig.expirationMs,
|
|
44
41
|
field: partitionConfig.field,
|
|
@@ -50,8 +47,8 @@ class BigQueryService {
|
|
|
50
47
|
dataset.table(tableName).insert(rows).then(() => {
|
|
51
48
|
resolve({});
|
|
52
49
|
}).catch((err) => {
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
Logger().error(ErrorHelper.toErrorString(err, traceId));
|
|
51
|
+
Logger().error(`Insert in a new table error: ${JSON.stringify(err)}. Trace: ${traceId}`);
|
|
55
52
|
reject(new Error());
|
|
56
53
|
});
|
|
57
54
|
});
|
|
@@ -59,8 +56,8 @@ class BigQueryService {
|
|
|
59
56
|
});
|
|
60
57
|
})
|
|
61
58
|
.catch((datasetError) => {
|
|
62
|
-
|
|
63
|
-
|
|
59
|
+
Logger().error(ErrorHelper.toErrorString(datasetError, traceId));
|
|
60
|
+
Logger().error(`DataSet Error: ${JSON.stringify(datasetError)}. Trace: ${traceId}`);
|
|
64
61
|
if (datasetError.code === 403) {
|
|
65
62
|
resolve({
|
|
66
63
|
googleCode: datasetError.code,
|
|
@@ -73,57 +70,57 @@ class BigQueryService {
|
|
|
73
70
|
});
|
|
74
71
|
}
|
|
75
72
|
catch (error) {
|
|
76
|
-
|
|
77
|
-
|
|
73
|
+
Logger().error(ErrorHelper.toErrorString(error, traceId));
|
|
74
|
+
Logger().error(`Promise error: ${JSON.stringify(error)}. Trace: ${traceId}`);
|
|
78
75
|
reject(new Error());
|
|
79
76
|
}
|
|
80
77
|
});
|
|
81
78
|
await promise.then((promiseResponse) => {
|
|
82
79
|
if (promiseResponse.googleCode !== undefined) {
|
|
83
|
-
throw new
|
|
84
|
-
`table. Google API. Code: ${promiseResponse.googleCode}. Google API response: ${promiseResponse.googleError}`,
|
|
80
|
+
throw new ErrorResponse(new InternalError(ErrorStatus.BAD_REQUEST, `An error occurred while creating a new item in BigQuery for ${datasetName} dataset and ${tableName} ` +
|
|
81
|
+
`table. Google API. Code: ${promiseResponse.googleCode}. Google API response: ${promiseResponse.googleError}`, ErrorCode.BAD_REQUEST_CLOUD_PROCESSING_ERROR));
|
|
85
82
|
}
|
|
86
83
|
response = true;
|
|
87
84
|
}, () => {
|
|
88
85
|
response = false;
|
|
89
86
|
});
|
|
90
87
|
await promise.catch(errorCatch => {
|
|
91
|
-
|
|
88
|
+
Logger().error(ErrorHelper.toErrorString(errorCatch, traceId));
|
|
92
89
|
response = false;
|
|
93
90
|
});
|
|
94
91
|
return response;
|
|
95
92
|
}
|
|
96
93
|
async insertMultipleRowsInBigQuery(bigqueryClient, datasetName, schema, tableName, partitionConfig, rows, traceId) {
|
|
97
|
-
|
|
94
|
+
Logger().info(`Save ${rows.length} Rows In Big Query. Trace: ${traceId}`);
|
|
98
95
|
let response = false;
|
|
99
96
|
const promise = new Promise((resolve, reject) => {
|
|
100
97
|
try {
|
|
101
|
-
|
|
98
|
+
Logger().info(`Reference to ${datasetName} DataSet. Trace: ${traceId}`);
|
|
102
99
|
const datasetRef = bigqueryClient.dataset(datasetName);
|
|
103
100
|
datasetRef.get({ autoCreate: true }).then(function (data) {
|
|
104
101
|
const dataset = data[0];
|
|
105
|
-
|
|
102
|
+
Logger().info(`Reference to ${tableName} Table. Trace: ${traceId}`);
|
|
106
103
|
const tableRef = dataset.table(tableName);
|
|
107
104
|
tableRef.exists(function (errExist, exists) {
|
|
108
105
|
if (errExist) {
|
|
109
|
-
|
|
106
|
+
Logger().error(`Exist error: ${JSON.stringify(errExist)}. Trace: ${traceId}`);
|
|
110
107
|
}
|
|
111
108
|
if (exists) {
|
|
112
109
|
dataset.table(tableName).insert(rows).then(() => {
|
|
113
110
|
resolve({});
|
|
114
111
|
}).catch((inserError) => {
|
|
115
|
-
|
|
116
|
-
|
|
112
|
+
Logger().error(ErrorHelper.toErrorString(inserError, traceId));
|
|
113
|
+
Logger().error(`Exist table insert error: ${JSON.stringify(inserError)}. Trace: ${traceId}`);
|
|
117
114
|
reject(new Error());
|
|
118
115
|
});
|
|
119
116
|
}
|
|
120
117
|
else {
|
|
121
|
-
|
|
118
|
+
Logger().info(`Create a new table ${datasetName} table. Trace: ${traceId}`);
|
|
122
119
|
const options = {
|
|
123
120
|
schema,
|
|
124
121
|
};
|
|
125
122
|
if (partitionConfig !== undefined) {
|
|
126
|
-
|
|
123
|
+
Logger().info('Set Partition Table');
|
|
127
124
|
options.timePartitioning = {
|
|
128
125
|
expirationMs: partitionConfig.expirationMs,
|
|
129
126
|
field: partitionConfig.field,
|
|
@@ -135,8 +132,8 @@ class BigQueryService {
|
|
|
135
132
|
dataset.table(tableName).insert(rows).then(() => {
|
|
136
133
|
resolve({});
|
|
137
134
|
}).catch((err) => {
|
|
138
|
-
|
|
139
|
-
|
|
135
|
+
Logger().error(ErrorHelper.toErrorString(err, traceId));
|
|
136
|
+
Logger().error(`Insert in a new table error: ${JSON.stringify(err)}. Trace: ${traceId}`);
|
|
140
137
|
reject(new Error());
|
|
141
138
|
});
|
|
142
139
|
});
|
|
@@ -144,8 +141,8 @@ class BigQueryService {
|
|
|
144
141
|
});
|
|
145
142
|
})
|
|
146
143
|
.catch((datasetError) => {
|
|
147
|
-
|
|
148
|
-
|
|
144
|
+
Logger().error(ErrorHelper.toErrorString(datasetError, traceId));
|
|
145
|
+
Logger().error(`DataSet Error: ${JSON.stringify(datasetError)}. Trace: ${traceId}`);
|
|
149
146
|
if (datasetError.code === 403) {
|
|
150
147
|
resolve({
|
|
151
148
|
googleCode: datasetError.code,
|
|
@@ -158,26 +155,25 @@ class BigQueryService {
|
|
|
158
155
|
});
|
|
159
156
|
}
|
|
160
157
|
catch (error) {
|
|
161
|
-
|
|
162
|
-
|
|
158
|
+
Logger().error(ErrorHelper.toErrorString(error, traceId));
|
|
159
|
+
Logger().error(`Promise error: ${JSON.stringify(error)}. Trace: ${traceId}`);
|
|
163
160
|
reject(new Error());
|
|
164
161
|
}
|
|
165
162
|
});
|
|
166
163
|
await promise.then((promiseResponse) => {
|
|
167
164
|
if (promiseResponse.googleCode !== undefined) {
|
|
168
|
-
throw new
|
|
169
|
-
`table. Google API Code: ${promiseResponse.googleCode}. Google API response: ${promiseResponse.googleError}`,
|
|
165
|
+
throw new ErrorResponse(new InternalError(ErrorStatus.BAD_REQUEST, `An error occurred while creating a new item in BigQuery for ${datasetName} dataset and ${tableName} ` +
|
|
166
|
+
`table. Google API Code: ${promiseResponse.googleCode}. Google API response: ${promiseResponse.googleError}`, ErrorCode.BAD_REQUEST_CLOUD_PROCESSING_ERROR));
|
|
170
167
|
}
|
|
171
168
|
response = true;
|
|
172
169
|
}, () => {
|
|
173
170
|
response = false;
|
|
174
171
|
});
|
|
175
172
|
await promise.catch(errorCatch => {
|
|
176
|
-
|
|
173
|
+
Logger().error(ErrorHelper.toErrorString(errorCatch, traceId));
|
|
177
174
|
response = false;
|
|
178
175
|
});
|
|
179
176
|
return response;
|
|
180
177
|
}
|
|
181
178
|
}
|
|
182
|
-
exports.BigQueryService = BigQueryService;
|
|
183
179
|
//# sourceMappingURL=big.query.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"big.query.service.js","sourceRoot":"","sources":["../../src/service/big.query.service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"big.query.service.js","sourceRoot":"","sources":["../../src/service/big.query.service.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAE1B,OAAO,EAAC,WAAW,EAAE,WAAW,EAAC,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAC,MAAM,EAAC,MAAM,gCAAgC,CAAC;AACtD,OAAO,EAAC,SAAS,EAAE,aAAa,EAAC,MAAM,8BAA8B,CAAC;AAEtE,OAAO,EAAC,aAAa,EAAC,MAAM,sCAAsC,CAAC;AAK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;IAClB,CAAC;CACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import 'reflect-metadata';
|
|
2
|
-
import { IRedisCacheService } from './interface/iredis.cache.service';
|
|
2
|
+
import { IRedisCacheService } from './interface/iredis.cache.service.js';
|
|
3
3
|
import { RedisClientType } from 'redis';
|
|
4
4
|
export declare class RedisCacheService implements IRedisCacheService {
|
|
5
5
|
connectRetryTimeMls: number;
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const redis_1 = require("redis");
|
|
7
|
-
const express_core_1 = require("@creatioart-js/express-core");
|
|
8
|
-
class RedisCacheService {
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
import { Logger } from '@creatioart-js/express-logging';
|
|
3
|
+
import { createClient } from 'redis';
|
|
4
|
+
import { ErrorHelper } from '@creatioart-js/express-core';
|
|
5
|
+
export class RedisCacheService {
|
|
9
6
|
connectRetryTimeMls;
|
|
10
7
|
reconnecAfterMls;
|
|
11
8
|
connectAttempt;
|
|
@@ -35,7 +32,7 @@ class RedisCacheService {
|
|
|
35
32
|
try {
|
|
36
33
|
client = await this.connect(traceId);
|
|
37
34
|
if (client !== undefined) {
|
|
38
|
-
|
|
35
|
+
Logger().info(`[Cache Manager - GET] Get the element in cache by ${key} key. Trace: ${traceId}`);
|
|
39
36
|
const reply = await client.get(key);
|
|
40
37
|
if (reply !== undefined && reply !== null) {
|
|
41
38
|
response = JSON.parse(Buffer.from(reply, 'base64').toString());
|
|
@@ -43,8 +40,8 @@ class RedisCacheService {
|
|
|
43
40
|
}
|
|
44
41
|
}
|
|
45
42
|
catch (error) {
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
Logger().error(ErrorHelper.toErrorString(error, traceId));
|
|
44
|
+
Logger().error(`[Cache Manager - GET] Warn to Get the element in cache by ${key} key. Not Found. ` +
|
|
48
45
|
`Trace: ${traceId}`);
|
|
49
46
|
}
|
|
50
47
|
finally {
|
|
@@ -59,7 +56,7 @@ class RedisCacheService {
|
|
|
59
56
|
try {
|
|
60
57
|
client = await this.connect(traceId);
|
|
61
58
|
if (client !== undefined) {
|
|
62
|
-
|
|
59
|
+
Logger().info(`[Cache Manager - SET] Set the element in cache by ${key} key for the time ${timeSeg} seg. ` +
|
|
63
60
|
`Trace: ${traceId}`);
|
|
64
61
|
const value = Buffer.from(JSON.stringify(data)).toString('base64');
|
|
65
62
|
await client.set(key, value, {
|
|
@@ -68,8 +65,8 @@ class RedisCacheService {
|
|
|
68
65
|
}
|
|
69
66
|
}
|
|
70
67
|
catch (error) {
|
|
71
|
-
|
|
72
|
-
|
|
68
|
+
Logger().error(ErrorHelper.toErrorString(error, traceId));
|
|
69
|
+
Logger().error(`[Cache Manager - SET PROMISE] Unexpected error on Set the element in cache by ${key} key ` +
|
|
73
70
|
`for the time ${timeSeg} seg. Trace: ${traceId}`);
|
|
74
71
|
}
|
|
75
72
|
finally {
|
|
@@ -83,13 +80,13 @@ class RedisCacheService {
|
|
|
83
80
|
try {
|
|
84
81
|
client = await this.connect(traceId);
|
|
85
82
|
if (client !== undefined) {
|
|
86
|
-
|
|
83
|
+
Logger().info(`[Cache Manager - REMOVE] Remove the element in cache by ${key} key. Trace: ${traceId}`);
|
|
87
84
|
await client.del(key);
|
|
88
85
|
}
|
|
89
86
|
}
|
|
90
87
|
catch (error) {
|
|
91
|
-
|
|
92
|
-
|
|
88
|
+
Logger().error(ErrorHelper.toErrorString(error, traceId));
|
|
89
|
+
Logger().error(`[Cache Manager - REMOVE] Unexpected error on Remove the element in cache by ${key} key. ` +
|
|
93
90
|
`Trace: ${traceId}`);
|
|
94
91
|
}
|
|
95
92
|
finally {
|
|
@@ -99,19 +96,19 @@ class RedisCacheService {
|
|
|
99
96
|
}
|
|
100
97
|
}
|
|
101
98
|
async disconnect(client, traceId) {
|
|
102
|
-
|
|
99
|
+
Logger().info(`[Cache Manager - DISCONECT] Disconect the Redis Client. Trace: ${traceId}`);
|
|
103
100
|
try {
|
|
104
101
|
if (client !== undefined) {
|
|
105
102
|
await client.quit();
|
|
106
103
|
}
|
|
107
104
|
}
|
|
108
105
|
catch (error) {
|
|
109
|
-
|
|
110
|
-
|
|
106
|
+
Logger().error(ErrorHelper.toErrorString(error, traceId));
|
|
107
|
+
Logger().error(`[Cache Manager - DISCONECT] Error to Disconect Cache Manager Service. Trace: ${traceId}`);
|
|
111
108
|
}
|
|
112
109
|
}
|
|
113
110
|
async connect(traceId) {
|
|
114
|
-
|
|
111
|
+
Logger().info(`[Cache Manager] Conect to Cache Manager. Trace: ${traceId}`);
|
|
115
112
|
let client;
|
|
116
113
|
try {
|
|
117
114
|
const connectRetryTimeMls = this.connectRetryTimeMls;
|
|
@@ -121,7 +118,7 @@ class RedisCacheService {
|
|
|
121
118
|
const port = this.port;
|
|
122
119
|
const auth = this.auth;
|
|
123
120
|
const db = this.db;
|
|
124
|
-
client =
|
|
121
|
+
client = createClient({
|
|
125
122
|
url: `redis://${host}:${port}/${db}`,
|
|
126
123
|
password: auth,
|
|
127
124
|
socket: {
|
|
@@ -129,15 +126,15 @@ class RedisCacheService {
|
|
|
129
126
|
connectTimeout: 5000,
|
|
130
127
|
reconnectStrategy: function (options) {
|
|
131
128
|
if (options.error && (options.error.code === 'ECONNREFUSED' || options.error.code === 'NR_CLOSED')) {
|
|
132
|
-
|
|
129
|
+
Logger().warn(`[Cache Manager - CONNECT EVENT] The redis server refused the connection. ` +
|
|
133
130
|
`Retrying connection... Trace: ${traceId}`);
|
|
134
131
|
}
|
|
135
132
|
if (options.total_retry_time > connectRetryTimeMls) {
|
|
136
|
-
|
|
133
|
+
Logger().error(`[Cache Manager - CONNECT EVENT] Retry time exhausted. Trace: ${traceId}`);
|
|
137
134
|
return new Error('[Cache Manager - CONNECT EVENT] Retry time exhausted');
|
|
138
135
|
}
|
|
139
136
|
if (options.attempt > connectAttempt) {
|
|
140
|
-
|
|
137
|
+
Logger().error(`[Cache Manager - CONNECT EVENT] Retry attempt exhausted. Trace: ${traceId}`);
|
|
141
138
|
return new Error('[Cache Manager - CONNECT EVENT] Retry attempt exhausted');
|
|
142
139
|
}
|
|
143
140
|
return reconnecAfterMls;
|
|
@@ -147,12 +144,12 @@ class RedisCacheService {
|
|
|
147
144
|
client.on('connect', function () {
|
|
148
145
|
});
|
|
149
146
|
client.on('ready', function () {
|
|
150
|
-
|
|
147
|
+
Logger().info(`[Cache Manager] Connected to the Redis Cache. Trace: ${traceId}`);
|
|
151
148
|
});
|
|
152
149
|
client.on('error', function (err) {
|
|
153
150
|
if (err) {
|
|
154
|
-
|
|
155
|
-
|
|
151
|
+
Logger().error(ErrorHelper.toErrorString(err, traceId));
|
|
152
|
+
Logger().error(`[Cache Manager - CONNECT EVENT] Error to Connect the Redis Cache Manager for host on db. ` +
|
|
156
153
|
`Trace: ${traceId}`);
|
|
157
154
|
}
|
|
158
155
|
client = undefined;
|
|
@@ -160,13 +157,12 @@ class RedisCacheService {
|
|
|
160
157
|
await client.connect();
|
|
161
158
|
}
|
|
162
159
|
catch (error) {
|
|
163
|
-
|
|
164
|
-
|
|
160
|
+
Logger().error(ErrorHelper.toErrorString(error, traceId));
|
|
161
|
+
Logger().error(`[Cache Manager - CONNECT EVENT PROMISE] Error to Connect the Redis Cache Manager for ` +
|
|
165
162
|
`${this.host} host on ${this.db} db. Trace: ${traceId}`);
|
|
166
163
|
client = undefined;
|
|
167
164
|
}
|
|
168
165
|
return client;
|
|
169
166
|
}
|
|
170
167
|
}
|
|
171
|
-
exports.RedisCacheService = RedisCacheService;
|
|
172
168
|
//# sourceMappingURL=redis.cache.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"redis.cache.service.js","sourceRoot":"","sources":["../../src/service/redis.cache.service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"redis.cache.service.js","sourceRoot":"","sources":["../../src/service/redis.cache.service.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;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A2F;wBAC3F,UAAU,OAAO,EAAE,CAAC,CAAC;gBACtC,CAAC;gBAGD,MAAM,GAAG,SAAS,CAAC;YACrB,CAAC,CAAC,CAAC;YAGH,MAAM,MAAM,CAAC,OAAO,EAAE,CAAC;QAEzB,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,MAAM,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,aAAa,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;YAC1D,MAAM,EAAE,CAAC,KAAK,CAAC,uFAAuF;gBACvF,GAAG,IAAI,CAAC,IAAI,YAAY,IAAI,CAAC,EAAE,eAAe,OAAO,EAAE,CAAC,CAAC;YAGxE,MAAM,GAAG,SAAS,CAAC;QACrB,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@creatioart-js/express-storage",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "CreatioART - Core storage library package for Express framework that contains storage management class",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"package",
|
|
@@ -12,15 +12,18 @@
|
|
|
12
12
|
"datastore",
|
|
13
13
|
"firestore"
|
|
14
14
|
],
|
|
15
|
+
"homepage": "https://docs.creatioart.com/creatioart-js/express-storage",
|
|
15
16
|
"repository": {
|
|
16
17
|
"type": "git",
|
|
17
18
|
"url": "https://creatioart@dev.azure.com/creatioart/common/_git/lib-creatio-express-storage"
|
|
18
19
|
},
|
|
19
|
-
"homepage": "https://docs.creatioart.com/creatioart-js/express-storage",
|
|
20
20
|
"license": "Apache-2.0",
|
|
21
21
|
"author": "CreatioART - CreatioART Support <support@creatioart.com>",
|
|
22
|
-
"
|
|
23
|
-
"
|
|
22
|
+
"type": "module",
|
|
23
|
+
"exports": {
|
|
24
|
+
"types": "./lib/index.d.ts",
|
|
25
|
+
"default": "./lib/index.js"
|
|
26
|
+
},
|
|
24
27
|
"scripts": {
|
|
25
28
|
"build": "npm-run-all build:*",
|
|
26
29
|
"build:clean": "rimraf ./lib/",
|
|
@@ -32,16 +35,18 @@
|
|
|
32
35
|
"watch": "npm run prewatch -- -w",
|
|
33
36
|
"test": "npm-run-all test:*",
|
|
34
37
|
"test:build": "npm run build",
|
|
35
|
-
"test:clean": "rimraf
|
|
38
|
+
"test:clean": "rimraf ./coverage/",
|
|
36
39
|
"test:lint": "npx eslint ./test/** --max-warnings=0 --config=.eslintrc.json",
|
|
37
|
-
"test:start": "
|
|
40
|
+
"test:start": "cross-env NODE_OPTIONS=--experimental-vm-modules NODE_NO_WARNINGS=1 jest --config=jest.config.json --no-cache --silent",
|
|
38
41
|
"tdd": "nodemon -e ts --watch ./test --exec \"npm run test\"",
|
|
39
42
|
"prepare": "husky",
|
|
40
43
|
"prepublishOnly": "npm run build && npm run test",
|
|
41
44
|
"publish": "npm publish --access public",
|
|
42
45
|
"version": "git add -A src",
|
|
43
46
|
"postversion": "git push && git push --tags",
|
|
44
|
-
"docs": "
|
|
47
|
+
"docs": "npm-run-all docs:*",
|
|
48
|
+
"docs:visualize-imports": "npx madge --image docs/imports.svg --ts-config tsconfig.json src/index.ts",
|
|
49
|
+
"docs:typedoc-docs": "typedoc --out docs/typedoc/ src/ --tsconfig tsconfig.json"
|
|
45
50
|
},
|
|
46
51
|
"lint-staged": {
|
|
47
52
|
"*.{js,jsx,ts,tsx}": "npx eslint ./src --max-warnings=0 --config=.eslintrc.json",
|
|
@@ -54,35 +59,11 @@
|
|
|
54
59
|
"src"
|
|
55
60
|
]
|
|
56
61
|
},
|
|
57
|
-
"nyc": {
|
|
58
|
-
"branches": 100,
|
|
59
|
-
"check-coverage": false,
|
|
60
|
-
"exclude": [
|
|
61
|
-
"**/.mock/*.ts",
|
|
62
|
-
"**/*.spec.ts"
|
|
63
|
-
],
|
|
64
|
-
"extension": [
|
|
65
|
-
".ts"
|
|
66
|
-
],
|
|
67
|
-
"functions": 100,
|
|
68
|
-
"lines": 100,
|
|
69
|
-
"per-file": true,
|
|
70
|
-
"reporter": [
|
|
71
|
-
"text-summary",
|
|
72
|
-
"html"
|
|
73
|
-
],
|
|
74
|
-
"require": [
|
|
75
|
-
"ts-node/register"
|
|
76
|
-
],
|
|
77
|
-
"sourceMap": true,
|
|
78
|
-
"statements": 100
|
|
79
|
-
},
|
|
80
62
|
"dependencies": {
|
|
81
|
-
"@creatioart-js/express-core": "^1.
|
|
82
|
-
"@creatioart-js/express-error": "^1.
|
|
83
|
-
"@creatioart-js/express-error-handler": "^1.
|
|
84
|
-
"@creatioart-js/express-logging": "^1.
|
|
85
|
-
"@types/node": "^22.8.6",
|
|
63
|
+
"@creatioart-js/express-core": "^1.1.1",
|
|
64
|
+
"@creatioart-js/express-error": "^1.1.0",
|
|
65
|
+
"@creatioart-js/express-error-handler": "^1.1.0",
|
|
66
|
+
"@creatioart-js/express-logging": "^1.1.0",
|
|
86
67
|
"class-transformer": "^0.5.1",
|
|
87
68
|
"class-validator": "^0.14.1",
|
|
88
69
|
"redis": "^4.7.0",
|
|
@@ -90,34 +71,32 @@
|
|
|
90
71
|
"typedi": "0.10.0"
|
|
91
72
|
},
|
|
92
73
|
"devDependencies": {
|
|
74
|
+
"@jest/globals": "^29.7.0",
|
|
93
75
|
"@npm/types": "^2.0.0",
|
|
94
|
-
"@types/chai": "^5.0.1",
|
|
95
76
|
"@types/eslint": "<9.0.0",
|
|
96
77
|
"@types/glob": "^8.1.0",
|
|
97
|
-
"@types/
|
|
78
|
+
"@types/jest": "^29.5.14",
|
|
98
79
|
"@types/morgan": "^1.9.9",
|
|
99
|
-
"@types/
|
|
80
|
+
"@types/node": "^22.10.5",
|
|
100
81
|
"@types/validator": "^13.12.2",
|
|
101
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
102
|
-
"@typescript-eslint/parser": "^8.
|
|
103
|
-
"
|
|
104
|
-
"chai-http": "^5.1.1",
|
|
82
|
+
"@typescript-eslint/eslint-plugin": "^8.19.1",
|
|
83
|
+
"@typescript-eslint/parser": "^8.19.1",
|
|
84
|
+
"cross-env": "^7.0.3",
|
|
105
85
|
"eslint": "<9.0.0",
|
|
106
|
-
"eslint-plugin-n": "^17.
|
|
107
|
-
"eslint-plugin-promise": "^7.1
|
|
108
|
-
"husky": "^9.1.
|
|
109
|
-
"
|
|
110
|
-
"
|
|
111
|
-
"
|
|
112
|
-
"
|
|
86
|
+
"eslint-plugin-n": "^17.15.1",
|
|
87
|
+
"eslint-plugin-promise": "^7.2.1",
|
|
88
|
+
"husky": "^9.1.7",
|
|
89
|
+
"jest": "^29.7.0",
|
|
90
|
+
"lint-staged": "^15.3.0",
|
|
91
|
+
"madge": "^8.0.0",
|
|
92
|
+
"nock": "^13.5.6",
|
|
93
|
+
"nodemon": "^3.1.9",
|
|
113
94
|
"npm-run-all": "^4.1.5",
|
|
114
|
-
"
|
|
115
|
-
"
|
|
116
|
-
"sinon": "^19.0.2",
|
|
117
|
-
"sinon-chai": "^4.0.0",
|
|
95
|
+
"prettier": "^3.4.2",
|
|
96
|
+
"ts-jest": "^29.2.5",
|
|
118
97
|
"ts-node": "^10.9.2",
|
|
119
|
-
"typedoc": "^0.
|
|
120
|
-
"typescript": "^5.
|
|
98
|
+
"typedoc": "^0.27.6",
|
|
99
|
+
"typescript": "^5.7.2"
|
|
121
100
|
},
|
|
122
101
|
"engines": {
|
|
123
102
|
"node": "20.x.x"
|