@digipair/skill-mongodb 0.70.4 → 0.71.3

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/index.cjs.js CHANGED
@@ -18,7 +18,7 @@ let MongoDBService = class MongoDBService {
18
18
  }
19
19
  async find(params, _pins, context) {
20
20
  const { client = context.privates.CLIENT_MONGODB, options = {}, collection, filter } = params;
21
- const clientInstance = await engine.executePinsList(client, context);
21
+ const clientInstance = await engine.executePinsList(client, context, `${context.__PATH__}.client`);
22
22
  const instance = clientInstance.database.collection(collection);
23
23
  const values = await instance.find(filter, options).toArray();
24
24
  await clientInstance.client.close();
@@ -26,7 +26,7 @@ let MongoDBService = class MongoDBService {
26
26
  }
27
27
  async findOne(params, _pins, context) {
28
28
  const { client = context.privates.CLIENT_MONGODB, options = {}, collection, filter } = params;
29
- const clientInstance = await engine.executePinsList(client, context);
29
+ const clientInstance = await engine.executePinsList(client, context, `${context.__PATH__}.client`);
30
30
  const instance = clientInstance.database.collection(collection);
31
31
  const value = await instance.findOne(filter, options);
32
32
  await clientInstance.client.close();
@@ -34,7 +34,7 @@ let MongoDBService = class MongoDBService {
34
34
  }
35
35
  async findById(params, _pins, context) {
36
36
  const { client = context.privates.CLIENT_MONGODB, options = {}, collection, id } = params;
37
- const clientInstance = await engine.executePinsList(client, context);
37
+ const clientInstance = await engine.executePinsList(client, context, `${context.__PATH__}.client`);
38
38
  const instance = clientInstance.database.collection(collection);
39
39
  const value = await instance.findOne({
40
40
  _id: new mongodb.ObjectId(id)
@@ -44,7 +44,7 @@ let MongoDBService = class MongoDBService {
44
44
  }
45
45
  async insertOne(params, _pins, context) {
46
46
  const { client = context.privates.CLIENT_MONGODB, options = {}, collection, document } = params;
47
- const clientInstance = await engine.executePinsList(client, context);
47
+ const clientInstance = await engine.executePinsList(client, context, `${context.__PATH__}.client`);
48
48
  const instance = clientInstance.database.collection(collection);
49
49
  const value = await instance.insertOne(document, options);
50
50
  await clientInstance.client.close();
@@ -52,7 +52,7 @@ let MongoDBService = class MongoDBService {
52
52
  }
53
53
  async updateOne(params, _pins, context) {
54
54
  const { client = context.privates.CLIENT_MONGODB, options = {}, collection, filter, update } = params;
55
- const clientInstance = await engine.executePinsList(client, context);
55
+ const clientInstance = await engine.executePinsList(client, context, `${context.__PATH__}.client`);
56
56
  const instance = clientInstance.database.collection(collection);
57
57
  const value = await instance.updateOne(filter, update, options);
58
58
  await clientInstance.client.close();
@@ -60,7 +60,7 @@ let MongoDBService = class MongoDBService {
60
60
  }
61
61
  async updateById(params, _pins, context) {
62
62
  const { client = context.privates.CLIENT_MONGODB, options = {}, id, collection, update } = params;
63
- const clientInstance = await engine.executePinsList(client, context);
63
+ const clientInstance = await engine.executePinsList(client, context, `${context.__PATH__}.client`);
64
64
  const instance = clientInstance.database.collection(collection);
65
65
  const value = await instance.updateOne({
66
66
  _id: new mongodb.ObjectId(id)
package/index.esm.js CHANGED
@@ -23941,14 +23941,14 @@ function indent(str, spaces) {
23941
23941
  var match = parseIdentifier(input, i1, namePart) || namePart && parseAdditionalSymbol(input, i1) || maybeSpace && parseSpaces(input, i1);
23942
23942
  // match is required
23943
23943
  if (!match) {
23944
- return nextMatch = nextMatch1, tokens = tokens1, i = i1, {
23944
+ return tokens = tokens1, nextMatch = nextMatch1, i = i1, {
23945
23945
  v: nextMatch1
23946
23946
  };
23947
23947
  }
23948
23948
  var token = match.token, offset = match.offset;
23949
23949
  i1 += offset;
23950
23950
  if (token === " ") {
23951
- return nextMatch = nextMatch1, tokens = tokens1, i = i1, "continue";
23951
+ return tokens = tokens1, nextMatch = nextMatch1, i = i1, "continue";
23952
23952
  }
23953
23953
  tokens1 = _to_consumable_array$a(tokens1).concat([
23954
23954
  token
@@ -23967,7 +23967,7 @@ function indent(str, spaces) {
23967
23967
  if (contextKeys.some(function(el) {
23968
23968
  return el.startsWith(name);
23969
23969
  })) {
23970
- return nextMatch = nextMatch1, tokens = tokens1, i = i1, "continue";
23970
+ return tokens = tokens1, nextMatch = nextMatch1, i = i1, "continue";
23971
23971
  }
23972
23972
  if (dateTimeIdentifiers.some(function(el) {
23973
23973
  return el === name;
@@ -23986,9 +23986,9 @@ function indent(str, spaces) {
23986
23986
  if (dateTimeIdentifiers.some(function(el) {
23987
23987
  return el.startsWith(name);
23988
23988
  })) {
23989
- return nextMatch = nextMatch1, tokens = tokens1, i = i1, "continue";
23989
+ return tokens = tokens1, nextMatch = nextMatch1, i = i1, "continue";
23990
23990
  }
23991
- return nextMatch = nextMatch1, tokens = tokens1, i = i1, {
23991
+ return tokens = tokens1, nextMatch = nextMatch1, i = i1, {
23992
23992
  v: nextMatch1
23993
23993
  };
23994
23994
  };
@@ -27877,7 +27877,8 @@ var _globalInstance___DIGIPAIR_CONFIG__;
27877
27877
  const _config = globalInstance.__DIGIPAIR_CONFIG__ = (_globalInstance___DIGIPAIR_CONFIG__ = globalInstance.__DIGIPAIR_CONFIG__) != null ? _globalInstance___DIGIPAIR_CONFIG__ : {
27878
27878
  LIBRARIES: {},
27879
27879
  BASE_URL: 'https://cdn.jsdelivr.net/npm',
27880
- ALIAS: []
27880
+ ALIAS: [],
27881
+ LOGGER: (level, path, message, context, data)=>{}
27881
27882
  };
27882
27883
  const isRemoteVersion = /^https?:\/\/[^\s/$.?#].[^\s]*$/;
27883
27884
  const isPinsSettings = (value)=>{
@@ -27918,6 +27919,7 @@ const applyTemplate = (value, context)=>{
27918
27919
  };
27919
27920
  const executePins = async (settingsOrigin, context = {})=>{
27920
27921
  var _settings_conditions, _settings_conditions1;
27922
+ _config.LOGGER('INFO', context.__PATH__, 'execute:start', context);
27921
27923
  let settings = preparePinsSettings(settingsOrigin, context);
27922
27924
  const alias = _config.ALIAS.find((alias)=>settings.library.split(':')[0] === alias.name);
27923
27925
  const config = context.config || {};
@@ -27975,9 +27977,11 @@ const executePins = async (settingsOrigin, context = {})=>{
27975
27977
  if (!pins) {
27976
27978
  throw new Error(`Element ${settings.element} not found in library ${settings.library}`);
27977
27979
  }
27978
- return await pins(settings.properties, settings.pins, context);
27980
+ const result = await pins(settings.properties, settings.pins, context);
27981
+ _config.LOGGER('INFO', context.__PATH__, 'execute:end', context, result);
27982
+ return result;
27979
27983
  };
27980
- const executePinsList = async (pinsSettingsList, context)=>{
27984
+ const executePinsList = async (pinsSettingsList, context, path = 'root')=>{
27981
27985
  let previous = {};
27982
27986
  for(let i = 0; i < pinsSettingsList.length; i++){
27983
27987
  const settings = pinsSettingsList[i];
@@ -27987,7 +27991,8 @@ const executePinsList = async (pinsSettingsList, context)=>{
27987
27991
  parent: {
27988
27992
  previous: context.previous,
27989
27993
  parent: context.parent
27990
- }
27994
+ },
27995
+ __PATH__: `${path}[${i}]`
27991
27996
  }));
27992
27997
  } catch (error) {
27993
27998
  if (error === 'DIGIPAIR_CONDITIONS_IF_FALSE') {
@@ -159759,7 +159764,7 @@ let MongoDBService = class MongoDBService {
159759
159764
  }
159760
159765
  async find(params, _pins, context) {
159761
159766
  const { client = context.privates.CLIENT_MONGODB, options = {}, collection, filter } = params;
159762
- const clientInstance = await executePinsList(client, context);
159767
+ const clientInstance = await executePinsList(client, context, `${context.__PATH__}.client`);
159763
159768
  const instance = clientInstance.database.collection(collection);
159764
159769
  const values = await instance.find(filter, options).toArray();
159765
159770
  await clientInstance.client.close();
@@ -159767,7 +159772,7 @@ let MongoDBService = class MongoDBService {
159767
159772
  }
159768
159773
  async findOne(params, _pins, context) {
159769
159774
  const { client = context.privates.CLIENT_MONGODB, options = {}, collection, filter } = params;
159770
- const clientInstance = await executePinsList(client, context);
159775
+ const clientInstance = await executePinsList(client, context, `${context.__PATH__}.client`);
159771
159776
  const instance = clientInstance.database.collection(collection);
159772
159777
  const value = await instance.findOne(filter, options);
159773
159778
  await clientInstance.client.close();
@@ -159775,7 +159780,7 @@ let MongoDBService = class MongoDBService {
159775
159780
  }
159776
159781
  async findById(params, _pins, context) {
159777
159782
  const { client = context.privates.CLIENT_MONGODB, options = {}, collection, id } = params;
159778
- const clientInstance = await executePinsList(client, context);
159783
+ const clientInstance = await executePinsList(client, context, `${context.__PATH__}.client`);
159779
159784
  const instance = clientInstance.database.collection(collection);
159780
159785
  const value = await instance.findOne({
159781
159786
  _id: new lib$2.ObjectId(id)
@@ -159785,7 +159790,7 @@ let MongoDBService = class MongoDBService {
159785
159790
  }
159786
159791
  async insertOne(params, _pins, context) {
159787
159792
  const { client = context.privates.CLIENT_MONGODB, options = {}, collection, document } = params;
159788
- const clientInstance = await executePinsList(client, context);
159793
+ const clientInstance = await executePinsList(client, context, `${context.__PATH__}.client`);
159789
159794
  const instance = clientInstance.database.collection(collection);
159790
159795
  const value = await instance.insertOne(document, options);
159791
159796
  await clientInstance.client.close();
@@ -159793,7 +159798,7 @@ let MongoDBService = class MongoDBService {
159793
159798
  }
159794
159799
  async updateOne(params, _pins, context) {
159795
159800
  const { client = context.privates.CLIENT_MONGODB, options = {}, collection, filter, update } = params;
159796
- const clientInstance = await executePinsList(client, context);
159801
+ const clientInstance = await executePinsList(client, context, `${context.__PATH__}.client`);
159797
159802
  const instance = clientInstance.database.collection(collection);
159798
159803
  const value = await instance.updateOne(filter, update, options);
159799
159804
  await clientInstance.client.close();
@@ -159801,7 +159806,7 @@ let MongoDBService = class MongoDBService {
159801
159806
  }
159802
159807
  async updateById(params, _pins, context) {
159803
159808
  const { client = context.privates.CLIENT_MONGODB, options = {}, id, collection, update } = params;
159804
- const clientInstance = await executePinsList(client, context);
159809
+ const clientInstance = await executePinsList(client, context, `${context.__PATH__}.client`);
159805
159810
  const instance = clientInstance.database.collection(collection);
159806
159811
  const value = await instance.updateOne({
159807
159812
  _id: new lib$2.ObjectId(id)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digipair/skill-mongodb",
3
- "version": "0.70.4",
3
+ "version": "0.71.3",
4
4
  "dependencies": {
5
5
  "mongodb": "^6.10.0"
6
6
  },