@restorecommerce/chassis-srv 1.7.1 → 1.7.2
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 +11 -0
- package/docs/modules/ROOT/pages/index.adoc +0 -1
- package/lib/cache/index.js +2 -2
- package/lib/cache/index.js.map +1 -1
- package/lib/command-interface/index.js +39 -39
- package/lib/command-interface/index.js.map +1 -1
- package/lib/database/index.d.ts.map +1 -1
- package/lib/database/index.js +0 -2
- package/lib/database/index.js.map +1 -1
- package/lib/database/provider/arango/base.js +49 -49
- package/lib/database/provider/arango/base.js.map +1 -1
- package/lib/database/provider/arango/common.d.ts.map +1 -1
- package/lib/database/provider/arango/common.js +40 -41
- package/lib/database/provider/arango/common.js.map +1 -1
- package/lib/database/provider/arango/graph.js +41 -41
- package/lib/database/provider/arango/graph.js.map +1 -1
- package/lib/database/provider/arango/utils.d.ts.map +1 -1
- package/lib/database/provider/arango/utils.js +46 -46
- package/lib/database/provider/arango/utils.js.map +1 -1
- package/lib/index.d.ts +0 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +0 -2
- package/lib/index.js.map +1 -1
- package/lib/microservice/server.js +11 -11
- package/lib/microservice/server.js.map +1 -1
- package/lib/microservice/transport/provider/grpc/index.js +8 -8
- package/lib/microservice/transport/provider/grpc/index.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +10 -13
- package/lib/database/provider/nedb/index.d.ts +0 -9
- package/lib/database/provider/nedb/index.d.ts.map +0 -1
- package/lib/database/provider/nedb/index.js +0 -381
- package/lib/database/provider/nedb/index.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@restorecommerce/chassis-srv",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.2",
|
|
4
4
|
"description": "Restore Commerce microservice chassis",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"author": "n-fuse GmbH",
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
"type": "module",
|
|
19
19
|
"typings": "lib/index.d.ts",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@restorecommerce/grpc-client": "^2.2.
|
|
22
|
-
"@restorecommerce/kafka-client": "^1.3.
|
|
23
|
-
"@restorecommerce/logger": "^1.3.
|
|
24
|
-
"@restorecommerce/rc-grpc-clients": "^5.1.
|
|
25
|
-
"@restorecommerce/service-config": "^1.1.
|
|
21
|
+
"@restorecommerce/grpc-client": "^2.2.11",
|
|
22
|
+
"@restorecommerce/kafka-client": "^1.3.1",
|
|
23
|
+
"@restorecommerce/logger": "^1.3.6",
|
|
24
|
+
"@restorecommerce/rc-grpc-clients": "^5.1.60",
|
|
25
|
+
"@restorecommerce/service-config": "^1.1.5",
|
|
26
26
|
"abort-controller-x": "^0.4.3",
|
|
27
27
|
"arangojs": "^9.1.0",
|
|
28
28
|
"async": "^3.2.6",
|
|
@@ -33,22 +33,19 @@
|
|
|
33
33
|
"google-protobuf": "^3.21.4",
|
|
34
34
|
"kafkajs": "^2.2.4",
|
|
35
35
|
"keyv": "^5.2.1",
|
|
36
|
-
"lodash": "^4.17.21",
|
|
37
36
|
"long": "^5.2.3",
|
|
38
37
|
"lru-cache": "^11.0.2",
|
|
39
|
-
"nedb": "^1.8.0",
|
|
40
38
|
"nice-grpc": "^2.1.10",
|
|
41
39
|
"nice-grpc-server-reflection": "^2.0.12",
|
|
42
40
|
"protobufjs": "^7.4.0",
|
|
43
|
-
"redis": "^4.7.0"
|
|
41
|
+
"redis": "^4.7.0",
|
|
42
|
+
"remeda": "^2.31.1"
|
|
44
43
|
},
|
|
45
44
|
"devDependencies": {
|
|
46
|
-
"@restorecommerce/dev": "^0.1.
|
|
45
|
+
"@restorecommerce/dev": "^0.1.1",
|
|
47
46
|
"@types/async": "^3.2.6",
|
|
48
47
|
"@types/async-retry": "^1.4.9",
|
|
49
48
|
"@types/cache-manager": "^4.0.6",
|
|
50
|
-
"@types/lodash": "^4.17.13",
|
|
51
|
-
"@types/nedb": "^1.8.16",
|
|
52
49
|
"@types/node": "^22.9.1",
|
|
53
50
|
"@typescript-eslint/parser": "^8.15.0",
|
|
54
51
|
"@vitest/coverage-v8": "^3.2.4",
|
|
@@ -76,5 +73,5 @@
|
|
|
76
73
|
"engines": {
|
|
77
74
|
"node": ">= 20.0.0"
|
|
78
75
|
},
|
|
79
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "3154bc55aeef8c8521c4042c78220dc12b25aecd"
|
|
80
77
|
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Create a new NeDB provider.
|
|
3
|
-
*
|
|
4
|
-
* @param {Object} conf NeDB configuration
|
|
5
|
-
* @param {Object} [logger] Logger
|
|
6
|
-
* @return {NedbProvider} NeDB provider
|
|
7
|
-
*/
|
|
8
|
-
export declare const create: (conf: object, logger: any) => Promise<any>;
|
|
9
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/database/provider/nedb/index.ts"],"names":[],"mappings":"AAgXA;;;;;;GAMG;AACH,eAAO,MAAM,MAAM,SAAgB,MAAM,UAAU,GAAG,KAAG,OAAO,CAAC,GAAG,CASnE,CAAC"}
|
|
@@ -1,381 +0,0 @@
|
|
|
1
|
-
import Datastore from 'nedb';
|
|
2
|
-
import * as _ from 'lodash';
|
|
3
|
-
/**
|
|
4
|
-
* Converts unsupported functions to regexp.
|
|
5
|
-
* @param {object} filter query filter
|
|
6
|
-
* @return {object} the filter querys which are not supported by nedb converted to regexp.
|
|
7
|
-
*/
|
|
8
|
-
const convertToRegexp = (filter) => {
|
|
9
|
-
const f = filter;
|
|
10
|
-
_.forEach(f, (value, key) => {
|
|
11
|
-
if (value.$startswith) {
|
|
12
|
-
f[key] = {
|
|
13
|
-
$regex: new RegExp(`^${value.$startswith}.*$`, 'i'),
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
else if (value.$endswith) {
|
|
17
|
-
f[key] = {
|
|
18
|
-
$regex: new RegExp(`^.*${value.$endswith}$`, 'i'),
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
else if (_.has(value, '$isEmpty')) {
|
|
22
|
-
f[key] = {
|
|
23
|
-
$regex: new RegExp(`^$`),
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
else if (_.has(value, '$iLike')) {
|
|
27
|
-
// neDB does not have ILIKE (LIKE with ignore case sensitive)
|
|
28
|
-
// e.g.: convert %sOrT% => to /sort/ and find all fields
|
|
29
|
-
// whose name contain the substring 'sort' using the regular expression
|
|
30
|
-
const iLikeVal = f[key].$iLike.slice(1, -1).toLowerCase();
|
|
31
|
-
// convert sort => to regexp /sort/
|
|
32
|
-
f[key] = new RegExp(iLikeVal);
|
|
33
|
-
}
|
|
34
|
-
else if (_.isObject(value)) {
|
|
35
|
-
f[key] = convertToRegexp(value);
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
return f;
|
|
39
|
-
};
|
|
40
|
-
/**
|
|
41
|
-
* Construct or operator.
|
|
42
|
-
* @param {Object} options the or statement
|
|
43
|
-
* example: { $or: [{ planet: 'Earth' }, { planet: 'Mars' }] }
|
|
44
|
-
* @param {string} name the field name the comparison is based on.
|
|
45
|
-
* @return {Object} NeDB or operator query filter.
|
|
46
|
-
*/
|
|
47
|
-
const buildOrQuery = (options, name) => {
|
|
48
|
-
let opts = options;
|
|
49
|
-
if (!_.isArray(options)) {
|
|
50
|
-
opts = [options];
|
|
51
|
-
}
|
|
52
|
-
const obj = { $or: [] };
|
|
53
|
-
opts.forEach((item) => {
|
|
54
|
-
const toInsert = {};
|
|
55
|
-
toInsert[name] = item;
|
|
56
|
-
obj.$or.push(toInsert);
|
|
57
|
-
});
|
|
58
|
-
return obj;
|
|
59
|
-
};
|
|
60
|
-
/**
|
|
61
|
-
* NeDB database provider.
|
|
62
|
-
*/
|
|
63
|
-
class NedbProvider {
|
|
64
|
-
collections;
|
|
65
|
-
/**
|
|
66
|
-
* @param {Object} collections a map, collection name mapped to store
|
|
67
|
-
*/
|
|
68
|
-
constructor(collections) {
|
|
69
|
-
this.collections = collections;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Insert documents into database.
|
|
73
|
-
*
|
|
74
|
-
* @param {String} collection Collection name
|
|
75
|
-
* @param {Object|array.Object} documents A single or multiple documents.
|
|
76
|
-
*/
|
|
77
|
-
async insert(collection, documents) {
|
|
78
|
-
const collections = this.collections;
|
|
79
|
-
if (!_.isArray(documents)) {
|
|
80
|
-
documents = [documents];
|
|
81
|
-
}
|
|
82
|
-
const docs = _.cloneDeep(documents);
|
|
83
|
-
for (const doc of docs) {
|
|
84
|
-
_.set(doc, '_id', doc.id);
|
|
85
|
-
}
|
|
86
|
-
return new Promise((resolve, reject) => {
|
|
87
|
-
collections[collection].insert(docs, (err, newdocs) => {
|
|
88
|
-
// docs
|
|
89
|
-
if (err) {
|
|
90
|
-
resolve([{
|
|
91
|
-
error: true,
|
|
92
|
-
errorMessage: err.message
|
|
93
|
-
}]);
|
|
94
|
-
}
|
|
95
|
-
else {
|
|
96
|
-
for (const newdoc of newdocs) {
|
|
97
|
-
_.unset(newdoc, '_id');
|
|
98
|
-
}
|
|
99
|
-
resolve(newdocs);
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Find documents based on filter.
|
|
106
|
-
*
|
|
107
|
-
* @param {String} collection Collection name
|
|
108
|
-
* @param {Object} filter Key, value Object
|
|
109
|
-
* @param {Object} options options.limit, options.offset
|
|
110
|
-
* @return {array.Object} A list of found documents.
|
|
111
|
-
*/
|
|
112
|
-
async find(collection, filter = {}, options = {}) {
|
|
113
|
-
const fil = convertToRegexp(filter || {});
|
|
114
|
-
let q = this.collections[collection].find(fil, options.fields);
|
|
115
|
-
if (options.offset) {
|
|
116
|
-
q = q.skip(options.offset);
|
|
117
|
-
}
|
|
118
|
-
if (options.limit) {
|
|
119
|
-
q = q.limit(options.limit);
|
|
120
|
-
}
|
|
121
|
-
if (options.sort) {
|
|
122
|
-
q = q.sort(options.sort);
|
|
123
|
-
}
|
|
124
|
-
const result = new Promise((resolve, reject) => {
|
|
125
|
-
q.exec((err, docs) => {
|
|
126
|
-
// docs
|
|
127
|
-
if (err) {
|
|
128
|
-
reject(err);
|
|
129
|
-
}
|
|
130
|
-
else {
|
|
131
|
-
_.map(docs, (doc) => {
|
|
132
|
-
if (_.isNil(doc.id)) {
|
|
133
|
-
_.set(doc, '_id', doc._id);
|
|
134
|
-
}
|
|
135
|
-
_.unset(doc, '_id');
|
|
136
|
-
});
|
|
137
|
-
resolve(docs);
|
|
138
|
-
}
|
|
139
|
-
});
|
|
140
|
-
});
|
|
141
|
-
return result;
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Find documents by id (_key).
|
|
145
|
-
*
|
|
146
|
-
* @param {String} collection Collection name
|
|
147
|
-
* @param {String|array.String} identifications A single ID or multiple IDs.
|
|
148
|
-
* @return {array.Object} A list of found documents.
|
|
149
|
-
*/
|
|
150
|
-
async findByID(collection, identifications) {
|
|
151
|
-
let ids = identifications;
|
|
152
|
-
if (!_.isArray(identifications)) {
|
|
153
|
-
ids = [identifications];
|
|
154
|
-
}
|
|
155
|
-
const q = buildOrQuery(ids, 'id');
|
|
156
|
-
const collections = this.collections;
|
|
157
|
-
const result = new Promise((resolve, reject) => {
|
|
158
|
-
collections[collection].find(q).exec((err, docs) => {
|
|
159
|
-
if (docs) {
|
|
160
|
-
const l = docs.length;
|
|
161
|
-
for (let i = 0; i < l; i += 1) {
|
|
162
|
-
_.unset(docs[i], '_id');
|
|
163
|
-
}
|
|
164
|
-
resolve(docs);
|
|
165
|
-
}
|
|
166
|
-
else if (err) {
|
|
167
|
-
reject(err);
|
|
168
|
-
}
|
|
169
|
-
});
|
|
170
|
-
});
|
|
171
|
-
return result;
|
|
172
|
-
}
|
|
173
|
-
/**
|
|
174
|
-
* Find documents by filter and updates them with document.
|
|
175
|
-
*
|
|
176
|
-
* @param {String} collection Collection name
|
|
177
|
-
* @param {Object} filter Key, value Object
|
|
178
|
-
* @param {Object} document A document patch.
|
|
179
|
-
*/
|
|
180
|
-
async update(collection, document) {
|
|
181
|
-
const collections = this.collections;
|
|
182
|
-
if (_.isArray(document)) {
|
|
183
|
-
document = document[0];
|
|
184
|
-
}
|
|
185
|
-
const obj = {
|
|
186
|
-
$set: {},
|
|
187
|
-
};
|
|
188
|
-
Object.keys(document).forEach((key) => {
|
|
189
|
-
obj.$set[key] = document[key];
|
|
190
|
-
});
|
|
191
|
-
const filter = { id: document.id }; // construct filter using document ids
|
|
192
|
-
const fil = convertToRegexp(filter || {});
|
|
193
|
-
const updatedDocs = new Promise((resolve, reject) => {
|
|
194
|
-
collections[collection].update(fil, obj, { multi: true, returnUpdatedDocs: true }, (err, numReplaced, updatedDocs) => {
|
|
195
|
-
if (err) {
|
|
196
|
-
resolve(err);
|
|
197
|
-
}
|
|
198
|
-
else {
|
|
199
|
-
resolve(updatedDocs);
|
|
200
|
-
}
|
|
201
|
-
});
|
|
202
|
-
});
|
|
203
|
-
if (_.isEmpty(updatedDocs)) {
|
|
204
|
-
// document not found for update
|
|
205
|
-
return [{
|
|
206
|
-
error: true,
|
|
207
|
-
errorMessage: 'document not found'
|
|
208
|
-
}];
|
|
209
|
-
}
|
|
210
|
-
return _.map(updatedDocs, (doc) => {
|
|
211
|
-
_.unset(doc, '_id');
|
|
212
|
-
return doc;
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
/**
|
|
216
|
-
* Find each document based on it's key and update it.
|
|
217
|
-
* If the document does not exist it will be created.
|
|
218
|
-
*
|
|
219
|
-
* @param {String} collection Collection name
|
|
220
|
-
* @param {Object|Array.Object} documents
|
|
221
|
-
*/
|
|
222
|
-
async upsert(collection, documents) {
|
|
223
|
-
const collections = this.collections;
|
|
224
|
-
let docs = _.cloneDeep(documents);
|
|
225
|
-
if (!_.isArray(docs)) {
|
|
226
|
-
docs = [docs];
|
|
227
|
-
}
|
|
228
|
-
const results = [];
|
|
229
|
-
for (const doc of docs) {
|
|
230
|
-
_.set(doc, '_id', doc.id);
|
|
231
|
-
const result = new Promise((resolve, reject) => {
|
|
232
|
-
collections[collection].update({ _id: doc._id }, doc, { upsert: true, returnUpdatedDocs: true }, (err, numReplaced, upserted) => {
|
|
233
|
-
if (err) {
|
|
234
|
-
reject(err);
|
|
235
|
-
}
|
|
236
|
-
resolve(upserted);
|
|
237
|
-
});
|
|
238
|
-
});
|
|
239
|
-
results.push(await result);
|
|
240
|
-
}
|
|
241
|
-
return _.map(results, (doc) => {
|
|
242
|
-
_.unset(doc, '_id');
|
|
243
|
-
return doc;
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
|
-
/**
|
|
247
|
-
* Delete all documents selected by filter.
|
|
248
|
-
*
|
|
249
|
-
* @param {String} collection Collection name
|
|
250
|
-
* @param {Object} filter
|
|
251
|
-
*/
|
|
252
|
-
async delete(collection, ids) {
|
|
253
|
-
const collections = this.collections;
|
|
254
|
-
let fil = {};
|
|
255
|
-
const deleteResponse = [];
|
|
256
|
-
for (const id of ids) {
|
|
257
|
-
collections[collection].find({ id }, (err, docs) => {
|
|
258
|
-
if (_.isEmpty(docs)) {
|
|
259
|
-
deleteResponse.push({
|
|
260
|
-
error: true,
|
|
261
|
-
errorMessage: 'Document not found'
|
|
262
|
-
});
|
|
263
|
-
}
|
|
264
|
-
else {
|
|
265
|
-
deleteResponse.push(docs[0]);
|
|
266
|
-
}
|
|
267
|
-
});
|
|
268
|
-
}
|
|
269
|
-
if (_.isEmpty(ids)) {
|
|
270
|
-
fil = {}; // if no ids are provided delete all documents and filter for this is {}
|
|
271
|
-
}
|
|
272
|
-
else {
|
|
273
|
-
fil = { id: { $in: ids } };
|
|
274
|
-
}
|
|
275
|
-
const numRemoved = await new Promise((resolve, reject) => {
|
|
276
|
-
collections[collection].remove(fil, { multi: true }, (err, numRemoved) => {
|
|
277
|
-
if (err) {
|
|
278
|
-
throw new Error(err);
|
|
279
|
-
}
|
|
280
|
-
else {
|
|
281
|
-
resolve(numRemoved);
|
|
282
|
-
}
|
|
283
|
-
});
|
|
284
|
-
});
|
|
285
|
-
return deleteResponse;
|
|
286
|
-
}
|
|
287
|
-
/**
|
|
288
|
-
* Count all documents selected by filter.
|
|
289
|
-
*
|
|
290
|
-
* @param {String} collection Collection name
|
|
291
|
-
* @param {Object} filter
|
|
292
|
-
*/
|
|
293
|
-
async count(collection, filter = {}) {
|
|
294
|
-
const collections = this.collections;
|
|
295
|
-
const fil = convertToRegexp(filter || {});
|
|
296
|
-
const result = new Promise((resolve, reject) => {
|
|
297
|
-
collections[collection].count(fil, (err, count) => {
|
|
298
|
-
if (err)
|
|
299
|
-
reject(err);
|
|
300
|
-
resolve(count);
|
|
301
|
-
});
|
|
302
|
-
});
|
|
303
|
-
return result;
|
|
304
|
-
}
|
|
305
|
-
/**
|
|
306
|
-
* When calling without a collection name,
|
|
307
|
-
* delete all documents in all collections in the database.
|
|
308
|
-
* When providing a collection name,
|
|
309
|
-
* delete all documents in specified collection in the database.
|
|
310
|
-
* @param [string] collection Collection name.
|
|
311
|
-
*/
|
|
312
|
-
async truncate(collection) {
|
|
313
|
-
if (_.isNil(collection)) {
|
|
314
|
-
const collections = _.keys(this.collections);
|
|
315
|
-
for (let i = 0; i < collections.length; i += 1) {
|
|
316
|
-
await this.delete(collections[i], []);
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
else {
|
|
320
|
-
await this.delete(collection, []);
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
/**
|
|
325
|
-
* Open all configured NeDB datastores.
|
|
326
|
-
* @param {Object} config
|
|
327
|
-
* example:
|
|
328
|
-
* {
|
|
329
|
-
* "provider": "nedb",
|
|
330
|
-
* "collections": {
|
|
331
|
-
* "notifications": {}
|
|
332
|
-
* }
|
|
333
|
-
* }
|
|
334
|
-
* @param {Logger} logger
|
|
335
|
-
* @return {Object} key, value map containing collection names
|
|
336
|
-
* as keys and the corresponding NeDB datastores as values.
|
|
337
|
-
*/
|
|
338
|
-
const loadDatastores = async (config, logger) => {
|
|
339
|
-
if (_.isNil(config.collections)) {
|
|
340
|
-
throw new Error('missing collection config value');
|
|
341
|
-
}
|
|
342
|
-
const collections = {};
|
|
343
|
-
const colNames = _.keys(config.collections);
|
|
344
|
-
for (let i = 0; i < colNames.length; i += 1) {
|
|
345
|
-
const name = colNames[i];
|
|
346
|
-
const conf = config.collections[name];
|
|
347
|
-
if (conf.filename) {
|
|
348
|
-
logger.verbose(`collection ${name} has filename ${conf.filename}`);
|
|
349
|
-
conf.autoload = true;
|
|
350
|
-
const load = () => {
|
|
351
|
-
return (cb) => {
|
|
352
|
-
conf.onload = cb;
|
|
353
|
-
collections[name] = new Datastore(conf);
|
|
354
|
-
};
|
|
355
|
-
};
|
|
356
|
-
await load();
|
|
357
|
-
}
|
|
358
|
-
else {
|
|
359
|
-
collections[name] = new Datastore(conf);
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
return collections;
|
|
363
|
-
};
|
|
364
|
-
/**
|
|
365
|
-
* Create a new NeDB provider.
|
|
366
|
-
*
|
|
367
|
-
* @param {Object} conf NeDB configuration
|
|
368
|
-
* @param {Object} [logger] Logger
|
|
369
|
-
* @return {NedbProvider} NeDB provider
|
|
370
|
-
*/
|
|
371
|
-
export const create = async (conf, logger) => {
|
|
372
|
-
let log = logger;
|
|
373
|
-
if (_.isNil(logger)) {
|
|
374
|
-
log = {
|
|
375
|
-
verbose: () => { },
|
|
376
|
-
};
|
|
377
|
-
}
|
|
378
|
-
const collections = await loadDatastores(conf, log);
|
|
379
|
-
return new NedbProvider(collections);
|
|
380
|
-
};
|
|
381
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3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