@etainabl/nodejs-sdk 1.2.6 → 1.2.8

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/cjs/api.js CHANGED
@@ -284,7 +284,7 @@ exports.default = (auth, instanceOptions = {}) => {
284
284
  updateScheduledReport: factory.update(etainablApi, 'scheduled-reports'),
285
285
  createScheduledReport: factory.create(etainablApi, 'scheduled-reports'),
286
286
  removeScheduledReport: factory.remove(etainablApi, 'scheduled-reports'),
287
- sendScheduledReport: factory.customWithId(etainablApi, 'post', 'scheduled-reports', 'generate'),
287
+ sendScheduledReport: factory.customWithId(etainablApi, 'post', 'scheduled-reports', 'send'),
288
288
  // invoices
289
289
  getInvoice: factory.getWithId(etainablApi, 'invoices'),
290
290
  listInvoices: factory.list(etainablApi, 'invoices'),
@@ -48,11 +48,16 @@ const getScheduledReportRunTimes = (schedule, limit = 1, taskTime = (0, moment_1
48
48
  return [];
49
49
  const originalStartDate = moment_1.default.utc(schedule.startDate);
50
50
  let startDate = originalStartDate;
51
- const runTimes = Array.from(Array(limit).keys()).map(() => {
51
+ const includeStartDate = taskTime.isSameOrBefore(originalStartDate, 'minute');
52
+ let runTimes = [];
53
+ if (includeStartDate) {
54
+ runTimes = [originalStartDate];
55
+ }
56
+ const scheduleRunTimes = Array.from(Array(includeStartDate ? limit - 1 : limit).keys()).map(() => {
52
57
  const nextRunTime = getNextRunTime(startDate, schedule, taskTime);
53
58
  startDate = nextRunTime.hour(originalStartDate.hour()).minute(originalStartDate.minute());
54
59
  return nextRunTime;
55
60
  });
56
- return runTimes;
61
+ return [...runTimes, ...scheduleRunTimes];
57
62
  };
58
63
  exports.getScheduledReportRunTimes = getScheduledReportRunTimes;
package/dist/mjs/api.js CHANGED
@@ -274,7 +274,7 @@ export default (auth, instanceOptions = {}) => {
274
274
  updateScheduledReport: factory.update(etainablApi, 'scheduled-reports'),
275
275
  createScheduledReport: factory.create(etainablApi, 'scheduled-reports'),
276
276
  removeScheduledReport: factory.remove(etainablApi, 'scheduled-reports'),
277
- sendScheduledReport: factory.customWithId(etainablApi, 'post', 'scheduled-reports', 'generate'),
277
+ sendScheduledReport: factory.customWithId(etainablApi, 'post', 'scheduled-reports', 'send'),
278
278
  // invoices
279
279
  getInvoice: factory.getWithId(etainablApi, 'invoices'),
280
280
  listInvoices: factory.list(etainablApi, 'invoices'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etainabl/nodejs-sdk",
3
- "version": "1.2.6",
3
+ "version": "1.2.8",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/mjs/index.js",
6
6
  "author": "Jonathan Lambert <jonathan@etainabl.com>",
@@ -15,7 +15,7 @@
15
15
  "@types/node": "^20.4.5"
16
16
  },
17
17
  "scripts": {
18
- "process": "tsc && yarn publish",
18
+ "process": "yarn build && yarn publish",
19
19
  "build": "rm -rf dist/* && tsc -p tsconfig.json && tsc -p tsconfig.cjs.json && ./fixup.sh"
20
20
  },
21
21
  "exports": {
package/src/api.ts CHANGED
@@ -341,7 +341,7 @@ export default (auth: AuthOptions, instanceOptions: CreateAxiosDefaults = {}) =>
341
341
  updateScheduledReport: factory.update(etainablApi, 'scheduled-reports'),
342
342
  createScheduledReport: factory.create(etainablApi, 'scheduled-reports'),
343
343
  removeScheduledReport: factory.remove(etainablApi, 'scheduled-reports'),
344
- sendScheduledReport: factory.customWithId(etainablApi, 'post', 'scheduled-reports', 'generate'),
344
+ sendScheduledReport: factory.customWithId(etainablApi, 'post', 'scheduled-reports', 'send'),
345
345
 
346
346
  // invoices
347
347
  getInvoice: factory.getWithId(etainablApi, 'invoices'),