ti2 1.0.69 → 1.0.71

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/cache.js CHANGED
@@ -42,6 +42,7 @@ const getOrExec = async ({
42
42
  ttl,
43
43
  fn,
44
44
  fnParams,
45
+ forceRefresh,
45
46
  }) => {
46
47
  const key = (() => {
47
48
  if (!keyParam) {
@@ -52,8 +53,11 @@ const getOrExec = async ({
52
53
  }
53
54
  return keyParam;
54
55
  })();
55
- let value = await get({ pluginName, key });
56
- if (value !== null) return value;
56
+ let value;
57
+ if (!forceRefresh) {
58
+ value = await get({ pluginName, key });
59
+ if (value !== null) return value;
60
+ }
57
61
  value = await fn(...fnParams);
58
62
  await save({
59
63
  pluginName,
@@ -70,7 +74,7 @@ const drop = async ({
70
74
  fn,
71
75
  fnParams,
72
76
  }) => {
73
- const key = `${pluginName}:${(() => {
77
+ let key = `${pluginName}:${(() => {
74
78
  if (!keyParam) {
75
79
  return hash({ fn, fnParams });
76
80
  }
@@ -179,6 +179,7 @@ const $bookingsAvailabilityCalendar = plugins => async ({
179
179
  },
180
180
  }));
181
181
  assert(userAppKeys, 'could not find the app key');
182
+ assert(app.availabilityCalendar, `availabilityCalendar is not available for ${appKey}`);
182
183
  const token = await userAppKeys.token;
183
184
  return app.availabilityCalendar({
184
185
  axios,
@@ -369,6 +370,7 @@ const getCreateBookingFields = plugins => async (req, res, next) => {
369
370
  const {
370
371
  axios,
371
372
  params: { appKey, userId, hint },
373
+ query,
372
374
  body: payload,
373
375
  } = req;
374
376
  try {
@@ -388,6 +390,7 @@ const getCreateBookingFields = plugins => async (req, res, next) => {
388
390
  axios,
389
391
  token,
390
392
  payload,
393
+ query,
391
394
  typeDefsAndQueries,
392
395
  });
393
396
  return res.json(results);
package/index.js CHANGED
@@ -80,10 +80,10 @@ module.exports = async ({
80
80
  });
81
81
  const pluginInstance = await new Plugin({
82
82
  cache: {
83
- drop: args => cache.getOrExec({ ...args, pluginName }),
84
- get: args => cache.getOrExec({ ...args, pluginName }),
83
+ drop: args => cache.drop({ ...args, pluginName }),
84
+ get: args => cache.get({ ...args, pluginName }),
85
85
  getOrExec: args => cache.getOrExec({ ...args, pluginName }),
86
- save: args => cache.getOrExec({ ...args, pluginName }),
86
+ save: args => cache.save({ ...args, pluginName }),
87
87
  },
88
88
  events: ti2Events,
89
89
  name: pluginName,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ti2",
3
- "version": "1.0.69",
3
+ "version": "1.0.71",
4
4
  "description": "Tourist Industry Exchange (TI2)",
5
5
  "main": "index.js",
6
6
  "scripts": {