@digipair/skill-mongodb 0.70.2 → 0.71.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/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 nextMatch = nextMatch1, i = i1, tokens = tokens1, {
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 nextMatch = nextMatch1, i = i1, tokens = tokens1, "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 nextMatch = nextMatch1, i = i1, tokens = tokens1, "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 nextMatch = nextMatch1, i = i1, tokens = tokens1, "continue";
23990
23990
  }
23991
- return nextMatch = nextMatch1, tokens = tokens1, i = i1, {
23991
+ return nextMatch = nextMatch1, i = i1, tokens = tokens1, {
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 || {};
@@ -27965,6 +27967,7 @@ const executePins = async (settingsOrigin, context = {})=>{
27965
27967
  }
27966
27968
  results.push(itemResult);
27967
27969
  }
27970
+ _config.LOGGER('INFO', context.__PATH__, 'execute:end', context, results);
27968
27971
  return results;
27969
27972
  }
27970
27973
  if (typeof ((_settings_conditions1 = settings.conditions) == null ? void 0 : _settings_conditions1.if) !== 'undefined' && !settings.conditions.if) {
@@ -27977,7 +27980,7 @@ const executePins = async (settingsOrigin, context = {})=>{
27977
27980
  }
27978
27981
  return await pins(settings.properties, settings.pins, context);
27979
27982
  };
27980
- const executePinsList = async (pinsSettingsList, context)=>{
27983
+ const executePinsList = async (pinsSettingsList, context, path = 'root')=>{
27981
27984
  let previous = {};
27982
27985
  for(let i = 0; i < pinsSettingsList.length; i++){
27983
27986
  const settings = pinsSettingsList[i];
@@ -27987,7 +27990,8 @@ const executePinsList = async (pinsSettingsList, context)=>{
27987
27990
  parent: {
27988
27991
  previous: context.previous,
27989
27992
  parent: context.parent
27990
- }
27993
+ },
27994
+ __PATH__: `${path}[${i}]`
27991
27995
  }));
27992
27996
  } catch (error) {
27993
27997
  if (error === 'DIGIPAIR_CONDITIONS_IF_FALSE') {
@@ -159759,7 +159763,7 @@ let MongoDBService = class MongoDBService {
159759
159763
  }
159760
159764
  async find(params, _pins, context) {
159761
159765
  const { client = context.privates.CLIENT_MONGODB, options = {}, collection, filter } = params;
159762
- const clientInstance = await executePinsList(client, context);
159766
+ const clientInstance = await executePinsList(client, context, `${context.__PATH__}.client`);
159763
159767
  const instance = clientInstance.database.collection(collection);
159764
159768
  const values = await instance.find(filter, options).toArray();
159765
159769
  await clientInstance.client.close();
@@ -159767,7 +159771,7 @@ let MongoDBService = class MongoDBService {
159767
159771
  }
159768
159772
  async findOne(params, _pins, context) {
159769
159773
  const { client = context.privates.CLIENT_MONGODB, options = {}, collection, filter } = params;
159770
- const clientInstance = await executePinsList(client, context);
159774
+ const clientInstance = await executePinsList(client, context, `${context.__PATH__}.client`);
159771
159775
  const instance = clientInstance.database.collection(collection);
159772
159776
  const value = await instance.findOne(filter, options);
159773
159777
  await clientInstance.client.close();
@@ -159775,7 +159779,7 @@ let MongoDBService = class MongoDBService {
159775
159779
  }
159776
159780
  async findById(params, _pins, context) {
159777
159781
  const { client = context.privates.CLIENT_MONGODB, options = {}, collection, id } = params;
159778
- const clientInstance = await executePinsList(client, context);
159782
+ const clientInstance = await executePinsList(client, context, `${context.__PATH__}.client`);
159779
159783
  const instance = clientInstance.database.collection(collection);
159780
159784
  const value = await instance.findOne({
159781
159785
  _id: new lib$2.ObjectId(id)
@@ -159785,7 +159789,7 @@ let MongoDBService = class MongoDBService {
159785
159789
  }
159786
159790
  async insertOne(params, _pins, context) {
159787
159791
  const { client = context.privates.CLIENT_MONGODB, options = {}, collection, document } = params;
159788
- const clientInstance = await executePinsList(client, context);
159792
+ const clientInstance = await executePinsList(client, context, `${context.__PATH__}.client`);
159789
159793
  const instance = clientInstance.database.collection(collection);
159790
159794
  const value = await instance.insertOne(document, options);
159791
159795
  await clientInstance.client.close();
@@ -159793,7 +159797,7 @@ let MongoDBService = class MongoDBService {
159793
159797
  }
159794
159798
  async updateOne(params, _pins, context) {
159795
159799
  const { client = context.privates.CLIENT_MONGODB, options = {}, collection, filter, update } = params;
159796
- const clientInstance = await executePinsList(client, context);
159800
+ const clientInstance = await executePinsList(client, context, `${context.__PATH__}.client`);
159797
159801
  const instance = clientInstance.database.collection(collection);
159798
159802
  const value = await instance.updateOne(filter, update, options);
159799
159803
  await clientInstance.client.close();
@@ -159801,7 +159805,7 @@ let MongoDBService = class MongoDBService {
159801
159805
  }
159802
159806
  async updateById(params, _pins, context) {
159803
159807
  const { client = context.privates.CLIENT_MONGODB, options = {}, id, collection, update } = params;
159804
- const clientInstance = await executePinsList(client, context);
159808
+ const clientInstance = await executePinsList(client, context, `${context.__PATH__}.client`);
159805
159809
  const instance = clientInstance.database.collection(collection);
159806
159810
  const value = await instance.updateOne({
159807
159811
  _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.2",
3
+ "version": "0.71.2",
4
4
  "dependencies": {
5
5
  "mongodb": "^6.10.0"
6
6
  },