@digipair/skill-mongodb 0.129.2 → 0.130.9
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/dist/index.cjs.js +10 -0
- package/dist/index.esm.js +21 -12
- package/dist/schema.fr.json +61 -0
- package/dist/schema.json +61 -0
- package/dist/src/lib/skill-mongodb.d.ts +1 -0
- package/dist/src/lib/skill-mongodb.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -65,6 +65,14 @@ let MongoDBService = class MongoDBService {
|
|
|
65
65
|
await clientInstance.client.close();
|
|
66
66
|
return value;
|
|
67
67
|
}
|
|
68
|
+
async count(params, _pins, context) {
|
|
69
|
+
const { client = context.privates.CLIENT_MONGODB, options = {}, collection, filter } = params;
|
|
70
|
+
const clientInstance = await engine.executePinsList(client, context, `${context.__PATH__}.client`);
|
|
71
|
+
const instance = clientInstance.database.collection(collection);
|
|
72
|
+
const value = await instance.countDocuments(filter, options);
|
|
73
|
+
await clientInstance.client.close();
|
|
74
|
+
return value;
|
|
75
|
+
}
|
|
68
76
|
};
|
|
69
77
|
const database = (params, pins, context)=>new MongoDBService().database(params, pins, context);
|
|
70
78
|
const find = (params, pins, context)=>new MongoDBService().find(params, pins, context);
|
|
@@ -73,7 +81,9 @@ const findById = (params, pins, context)=>new MongoDBService().findById(params,
|
|
|
73
81
|
const insertOne = (params, pins, context)=>new MongoDBService().insertOne(params, pins, context);
|
|
74
82
|
const updateOne = (params, pins, context)=>new MongoDBService().updateOne(params, pins, context);
|
|
75
83
|
const updateById = (params, pins, context)=>new MongoDBService().updateById(params, pins, context);
|
|
84
|
+
const count = (params, pins, context)=>new MongoDBService().count(params, pins, context);
|
|
76
85
|
|
|
86
|
+
exports.count = count;
|
|
77
87
|
exports.database = database;
|
|
78
88
|
exports.find = find;
|
|
79
89
|
exports.findById = findById;
|
package/dist/index.esm.js
CHANGED
|
@@ -22858,14 +22858,14 @@ function indent(str, spaces) {
|
|
|
22858
22858
|
var match = parseIdentifier(input, i1, namePart) || namePart && parseAdditionalSymbol(input, i1) || maybeSpace && parseSpaces(input, i1);
|
|
22859
22859
|
// match is required
|
|
22860
22860
|
if (!match) {
|
|
22861
|
-
return
|
|
22861
|
+
return tokens = tokens1, nextMatch = nextMatch1, i = i1, {
|
|
22862
22862
|
v: nextMatch1
|
|
22863
22863
|
};
|
|
22864
22864
|
}
|
|
22865
22865
|
var token = match.token, offset = match.offset;
|
|
22866
22866
|
i1 += offset;
|
|
22867
22867
|
if (token === ' ') {
|
|
22868
|
-
return
|
|
22868
|
+
return tokens = tokens1, nextMatch = nextMatch1, i = i1, "continue";
|
|
22869
22869
|
}
|
|
22870
22870
|
tokens1 = _to_consumable_array$4(tokens1).concat([
|
|
22871
22871
|
token
|
|
@@ -22884,7 +22884,7 @@ function indent(str, spaces) {
|
|
|
22884
22884
|
if (contextKeys.some(function(el) {
|
|
22885
22885
|
return el.startsWith(name);
|
|
22886
22886
|
})) {
|
|
22887
|
-
return
|
|
22887
|
+
return tokens = tokens1, nextMatch = nextMatch1, i = i1, "continue";
|
|
22888
22888
|
}
|
|
22889
22889
|
if (dateTimeIdentifiers.some(function(el) {
|
|
22890
22890
|
return el === name;
|
|
@@ -22903,9 +22903,9 @@ function indent(str, spaces) {
|
|
|
22903
22903
|
if (dateTimeIdentifiers.some(function(el) {
|
|
22904
22904
|
return el.startsWith(name);
|
|
22905
22905
|
})) {
|
|
22906
|
-
return
|
|
22906
|
+
return tokens = tokens1, nextMatch = nextMatch1, i = i1, "continue";
|
|
22907
22907
|
}
|
|
22908
|
-
return
|
|
22908
|
+
return tokens = tokens1, nextMatch = nextMatch1, i = i1, {
|
|
22909
22909
|
v: nextMatch1
|
|
22910
22910
|
};
|
|
22911
22911
|
};
|
|
@@ -161109,7 +161109,7 @@ function requireAggregation_cursor () {
|
|
|
161109
161109
|
|
|
161110
161110
|
var find_cursor = {};
|
|
161111
161111
|
|
|
161112
|
-
var count = {};
|
|
161112
|
+
var count$1 = {};
|
|
161113
161113
|
|
|
161114
161114
|
function _assert_this_initialized$6(self) {
|
|
161115
161115
|
if (self === void 0) {
|
|
@@ -161195,10 +161195,10 @@ function _create_super$6(Derived) {
|
|
|
161195
161195
|
return _possible_constructor_return$6(this, result);
|
|
161196
161196
|
};
|
|
161197
161197
|
}
|
|
161198
|
-
Object.defineProperty(count, "__esModule", {
|
|
161198
|
+
Object.defineProperty(count$1, "__esModule", {
|
|
161199
161199
|
value: true
|
|
161200
161200
|
});
|
|
161201
|
-
count.CountOperation = void 0;
|
|
161201
|
+
count$1.CountOperation = void 0;
|
|
161202
161202
|
var responses_1$6 = requireResponses();
|
|
161203
161203
|
var command_1$3 = command;
|
|
161204
161204
|
var operation_1$6 = operation;
|
|
@@ -161259,7 +161259,7 @@ var operation_1$6 = operation;
|
|
|
161259
161259
|
]);
|
|
161260
161260
|
return CountOperation;
|
|
161261
161261
|
}(command_1$3.CommandOperation);
|
|
161262
|
-
count.CountOperation = CountOperation;
|
|
161262
|
+
count$1.CountOperation = CountOperation;
|
|
161263
161263
|
(0, operation_1$6.defineAspects)(CountOperation, [
|
|
161264
161264
|
operation_1$6.Aspect.READ_OPERATION,
|
|
161265
161265
|
operation_1$6.Aspect.RETRYABLE,
|
|
@@ -161854,7 +161854,7 @@ function requireFind_cursor () {
|
|
|
161854
161854
|
var responses_1 = requireResponses();
|
|
161855
161855
|
var error_1 = error$1;
|
|
161856
161856
|
var explain_1 = explain;
|
|
161857
|
-
var count_1 = count;
|
|
161857
|
+
var count_1 = count$1;
|
|
161858
161858
|
var execute_operation_1 = execute_operation;
|
|
161859
161859
|
var find_1 = find$1;
|
|
161860
161860
|
var sort_1 = sort;
|
|
@@ -164190,7 +164190,7 @@ function requireCollection () {
|
|
|
164190
164190
|
var list_indexes_cursor_1 = requireList_indexes_cursor();
|
|
164191
164191
|
var list_search_indexes_cursor_1 = requireList_search_indexes_cursor();
|
|
164192
164192
|
var error_1 = error$1;
|
|
164193
|
-
var count_1 = count;
|
|
164193
|
+
var count_1 = count$1;
|
|
164194
164194
|
var delete_1 = _delete;
|
|
164195
164195
|
var distinct_1 = distinct;
|
|
164196
164196
|
var estimated_document_count_1 = estimated_document_count;
|
|
@@ -170329,6 +170329,14 @@ let MongoDBService = class MongoDBService {
|
|
|
170329
170329
|
await clientInstance.client.close();
|
|
170330
170330
|
return value;
|
|
170331
170331
|
}
|
|
170332
|
+
async count(params, _pins, context) {
|
|
170333
|
+
const { client = context.privates.CLIENT_MONGODB, options = {}, collection, filter } = params;
|
|
170334
|
+
const clientInstance = await executePinsList(client, context, `${context.__PATH__}.client`);
|
|
170335
|
+
const instance = clientInstance.database.collection(collection);
|
|
170336
|
+
const value = await instance.countDocuments(filter, options);
|
|
170337
|
+
await clientInstance.client.close();
|
|
170338
|
+
return value;
|
|
170339
|
+
}
|
|
170332
170340
|
};
|
|
170333
170341
|
const database = (params, pins, context)=>new MongoDBService().database(params, pins, context);
|
|
170334
170342
|
const find = (params, pins, context)=>new MongoDBService().find(params, pins, context);
|
|
@@ -170337,5 +170345,6 @@ const findById = (params, pins, context)=>new MongoDBService().findById(params,
|
|
|
170337
170345
|
const insertOne = (params, pins, context)=>new MongoDBService().insertOne(params, pins, context);
|
|
170338
170346
|
const updateOne = (params, pins, context)=>new MongoDBService().updateOne(params, pins, context);
|
|
170339
170347
|
const updateById = (params, pins, context)=>new MongoDBService().updateById(params, pins, context);
|
|
170348
|
+
const count = (params, pins, context)=>new MongoDBService().count(params, pins, context);
|
|
170340
170349
|
|
|
170341
|
-
export { database, find, findById, findOne, insertOne, updateById, updateOne };
|
|
170350
|
+
export { count, database, find, findById, findOne, insertOne, updateById, updateOne };
|
package/dist/schema.fr.json
CHANGED
|
@@ -534,6 +534,67 @@
|
|
|
534
534
|
}
|
|
535
535
|
}
|
|
536
536
|
}
|
|
537
|
+
},
|
|
538
|
+
"/count": {
|
|
539
|
+
"post": {
|
|
540
|
+
"tags": ["service"],
|
|
541
|
+
"summary": "Compter les documents correspondant aux critères de recherche",
|
|
542
|
+
"parameters": [
|
|
543
|
+
{
|
|
544
|
+
"name": "client",
|
|
545
|
+
"summary": "Connection à la base de données",
|
|
546
|
+
"required": false,
|
|
547
|
+
"description": "Client de connexion à la base de données",
|
|
548
|
+
"schema": {
|
|
549
|
+
"type": "array",
|
|
550
|
+
"items": {
|
|
551
|
+
"$ref": "https://schemas.digipair.ai/pinsSettings"
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
},
|
|
555
|
+
{
|
|
556
|
+
"name": "options",
|
|
557
|
+
"summary": "Options",
|
|
558
|
+
"required": false,
|
|
559
|
+
"description": "Options de recherche",
|
|
560
|
+
"schema": {
|
|
561
|
+
"type": "object"
|
|
562
|
+
}
|
|
563
|
+
},
|
|
564
|
+
{
|
|
565
|
+
"name": "collection",
|
|
566
|
+
"summary": "Collection",
|
|
567
|
+
"required": true,
|
|
568
|
+
"description": "Nom de la collection",
|
|
569
|
+
"schema": {
|
|
570
|
+
"type": "string"
|
|
571
|
+
}
|
|
572
|
+
},
|
|
573
|
+
{
|
|
574
|
+
"name": "filter",
|
|
575
|
+
"summary": "Filtre",
|
|
576
|
+
"required": true,
|
|
577
|
+
"description": "Filtre de recherche",
|
|
578
|
+
"schema": {
|
|
579
|
+
"type": "object"
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
],
|
|
583
|
+
"x-events": [],
|
|
584
|
+
"responses": {
|
|
585
|
+
"200": {
|
|
586
|
+
"description": "Nombre de documents correspondant aux critères de recherche",
|
|
587
|
+
"content": {
|
|
588
|
+
"application/json": {
|
|
589
|
+
"schema": {
|
|
590
|
+
"type": "number",
|
|
591
|
+
"description": "Nombre de documents"
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
}
|
|
537
598
|
}
|
|
538
599
|
},
|
|
539
600
|
"components": {
|
package/dist/schema.json
CHANGED
|
@@ -534,6 +534,67 @@
|
|
|
534
534
|
}
|
|
535
535
|
}
|
|
536
536
|
}
|
|
537
|
+
},
|
|
538
|
+
"/count": {
|
|
539
|
+
"post": {
|
|
540
|
+
"tags": ["service"],
|
|
541
|
+
"summary": "Count documents matching the search criteria",
|
|
542
|
+
"parameters": [
|
|
543
|
+
{
|
|
544
|
+
"name": "client",
|
|
545
|
+
"summary": "Database connection",
|
|
546
|
+
"required": false,
|
|
547
|
+
"description": "Database connection client",
|
|
548
|
+
"schema": {
|
|
549
|
+
"type": "array",
|
|
550
|
+
"items": {
|
|
551
|
+
"$ref": "https://schemas.digipair.ai/pinsSettings"
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
},
|
|
555
|
+
{
|
|
556
|
+
"name": "options",
|
|
557
|
+
"summary": "Options",
|
|
558
|
+
"required": false,
|
|
559
|
+
"description": "Insert options",
|
|
560
|
+
"schema": {
|
|
561
|
+
"type": "object"
|
|
562
|
+
}
|
|
563
|
+
},
|
|
564
|
+
{
|
|
565
|
+
"name": "collection",
|
|
566
|
+
"summary": "Collection",
|
|
567
|
+
"required": true,
|
|
568
|
+
"description": "Name of the collection",
|
|
569
|
+
"schema": {
|
|
570
|
+
"type": "string"
|
|
571
|
+
}
|
|
572
|
+
},
|
|
573
|
+
{
|
|
574
|
+
"name": "document",
|
|
575
|
+
"summary": "Document",
|
|
576
|
+
"required": true,
|
|
577
|
+
"description": "Document to insert",
|
|
578
|
+
"schema": {
|
|
579
|
+
"type": "object"
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
],
|
|
583
|
+
"x-events": [],
|
|
584
|
+
"responses": {
|
|
585
|
+
"200": {
|
|
586
|
+
"description": "Documents count matching the search criteria",
|
|
587
|
+
"content": {
|
|
588
|
+
"application/json": {
|
|
589
|
+
"schema": {
|
|
590
|
+
"type": "number",
|
|
591
|
+
"description": "Documents count"
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
}
|
|
537
598
|
}
|
|
538
599
|
},
|
|
539
600
|
"components": {
|
|
@@ -10,4 +10,5 @@ export declare const findById: (params: any, pins: PinsSettings[], context: any)
|
|
|
10
10
|
export declare const insertOne: (params: any, pins: PinsSettings[], context: any) => Promise<any>;
|
|
11
11
|
export declare const updateOne: (params: any, pins: PinsSettings[], context: any) => Promise<any>;
|
|
12
12
|
export declare const updateById: (params: any, pins: PinsSettings[], context: any) => Promise<any>;
|
|
13
|
+
export declare const count: (params: any, pins: PinsSettings[], context: any) => Promise<any>;
|
|
13
14
|
//# sourceMappingURL=skill-mongodb.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skill-mongodb.d.ts","sourceRoot":"","sources":["../../../src/lib/skill-mongodb.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAmB,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,WAAW,EAAY,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"skill-mongodb.d.ts","sourceRoot":"","sources":["../../../src/lib/skill-mongodb.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAmB,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,WAAW,EAAY,MAAM,SAAS,CAAC;AA0GhD,eAAO,MAAM,QAAQ,GAAI,QAAQ,GAAG,EAAE,MAAM,YAAY,EAAE,EAAE,SAAS,GAAG;;;EAClB,CAAC;AACvD,eAAO,MAAM,IAAI,GAAI,QAAQ,GAAG,EAAE,MAAM,YAAY,EAAE,EAAE,SAAS,GAAG,iBAClB,CAAC;AACnD,eAAO,MAAM,OAAO,GAAI,QAAQ,GAAG,EAAE,MAAM,YAAY,EAAE,EAAE,SAAS,GAAG,iBAClB,CAAC;AACtD,eAAO,MAAM,QAAQ,GAAI,QAAQ,GAAG,EAAE,MAAM,YAAY,EAAE,EAAE,SAAS,GAAG,iBAClB,CAAC;AACvD,eAAO,MAAM,SAAS,GAAI,QAAQ,GAAG,EAAE,MAAM,YAAY,EAAE,EAAE,SAAS,GAAG,iBAClB,CAAC;AACxD,eAAO,MAAM,SAAS,GAAI,QAAQ,GAAG,EAAE,MAAM,YAAY,EAAE,EAAE,SAAS,GAAG,iBAClB,CAAC;AACxD,eAAO,MAAM,UAAU,GAAI,QAAQ,GAAG,EAAE,MAAM,YAAY,EAAE,EAAE,SAAS,GAAG,iBAClB,CAAC;AACzD,eAAO,MAAM,KAAK,GAAI,QAAQ,GAAG,EAAE,MAAM,YAAY,EAAE,EAAE,SAAS,GAAG,iBAClB,CAAC"}
|