@onify/flow-extensions 1.0.0 → 1.1.0

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/CHANGELOG.md CHANGED
@@ -1,6 +1,10 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ # 1.0.1
5
+
6
+ - allow ISO8601 repeating interval and duration in timeCycle
7
+
4
8
  # 1.0.0
5
9
 
6
10
  - proper routing keys for end formatting
package/dist/index.js CHANGED
@@ -20,6 +20,8 @@ var _IO = require("./src/IO");
20
20
 
21
21
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22
22
 
23
+ const iso8601cycle = /^\s*(R\d+\/)?P\w+/i;
24
+
23
25
  class FormatError extends Error {
24
26
  constructor(elementId, err) {
25
27
  super(`<${elementId}> ${err.message}`);
@@ -330,7 +332,7 @@ class FormatActivity {
330
332
  if (timeCycles) {
331
333
  for (const cycle of timeCycles) {
332
334
  const cron = elementApi.resolveExpression(cycle);
333
- if (!cron) continue;
335
+ if (!cron || iso8601cycle.test(cron)) continue;
334
336
 
335
337
  const expireAtDt = _cronParser.default.parseExpression(cron).next().toDate();
336
338
 
@@ -340,9 +342,9 @@ class FormatActivity {
340
342
 
341
343
  return {
342
344
  resultVariable: this.resultVariable,
343
- ...(scheduledStart && activity.parent.type === 'bpmn:Process' ? {
345
+ ...(scheduledStart && activity.parent.type === 'bpmn:Process' && {
344
346
  scheduledStart
345
- } : undefined),
347
+ }),
346
348
  ...(((_user = user) === null || _user === void 0 ? void 0 : _user.length) && {
347
349
  candidateUsers: user
348
350
  }),
@@ -444,12 +446,12 @@ function registerIOScripts(parentId, context, type, ioBehaviour) {
444
446
  context.addScript(filename, {
445
447
  id: filename,
446
448
  scriptFormat: definition.scriptFormat,
447
- ...(definition.value ? {
449
+ ...(definition.value && {
448
450
  body: definition.value
449
- } : undefined),
450
- ...(definition.resource ? {
451
+ }),
452
+ ...(definition.resource && {
451
453
  resource: definition.resource
452
- } : undefined)
454
+ })
453
455
  });
454
456
  }
455
457
  }
package/dist/src/IO.js CHANGED
@@ -64,12 +64,12 @@ class InputOutput {
64
64
  type: parm.$type,
65
65
  behaviour: {
66
66
  scriptFormat,
67
- ...(value ? {
67
+ ...(value && {
68
68
  script: value
69
- } : undefined),
70
- ...(resource ? {
69
+ }),
70
+ ...(resource && {
71
71
  resource
72
- } : undefined)
72
+ })
73
73
  }
74
74
  });
75
75
  mapped.push(new IOScript(parm, id));
package/index.js CHANGED
@@ -5,6 +5,8 @@ import Connector from './src/Connector';
5
5
  import ServiceExpression from './src/ServiceExpression';
6
6
  import {InputOutput} from './src/IO';
7
7
 
8
+ const iso8601cycle = /^\s*(R\d+\/)?P\w+/i;
9
+
8
10
  class FormatError extends Error {
9
11
  constructor(elementId, err) {
10
12
  super(`<${elementId}> ${err.message}`);
@@ -236,7 +238,8 @@ class FormatActivity {
236
238
  if (timeCycles) {
237
239
  for (const cycle of timeCycles) {
238
240
  const cron = elementApi.resolveExpression(cycle);
239
- if (!cron) continue;
241
+ if (!cron || iso8601cycle.test(cron)) continue;
242
+
240
243
  const expireAtDt = cronParser.parseExpression(cron).next().toDate();
241
244
  if (!expireAt || expireAtDt < expireAt) expireAt = expireAtDt;
242
245
  }
@@ -244,7 +247,7 @@ class FormatActivity {
244
247
 
245
248
  return {
246
249
  resultVariable: this.resultVariable,
247
- ...(scheduledStart && activity.parent.type === 'bpmn:Process' ? {scheduledStart} : undefined),
250
+ ...(scheduledStart && activity.parent.type === 'bpmn:Process' && {scheduledStart}),
248
251
  ...(user?.length && {candidateUsers: user}),
249
252
  ...(groups?.length && {candidateGroups: groups}),
250
253
  ...(!elementApi.content.description && description && {description: elementApi.resolveExpression(description)}),
@@ -323,8 +326,8 @@ function registerIOScripts(parentId, context, type, ioBehaviour) {
323
326
  context.addScript(filename, {
324
327
  id: filename,
325
328
  scriptFormat: definition.scriptFormat,
326
- ...(definition.value ? {body: definition.value}: undefined),
327
- ...(definition.resource ? {resource: definition.resource}: undefined),
329
+ ...(definition.value && {body: definition.value}),
330
+ ...(definition.resource && {resource: definition.resource}),
328
331
  });
329
332
  }
330
333
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onify/flow-extensions",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Onify Flow extensions",
5
5
  "module": "index.js",
6
6
  "main": "dist/index.js",
@@ -35,12 +35,12 @@
35
35
  "license": "MIT",
36
36
  "devDependencies": {
37
37
  "@aircall/expression-parser": "^1.0.4",
38
- "@babel/cli": "^7.17.10",
39
- "@babel/core": "^7.18.5",
40
- "@babel/preset-env": "^7.18.2",
41
- "@babel/register": "^7.17.7",
42
- "bpmn-elements": "^8.0.1",
43
- "bpmn-engine": "^14.0.0",
38
+ "@babel/cli": "^7.18.6",
39
+ "@babel/core": "^7.18.6",
40
+ "@babel/preset-env": "^7.18.6",
41
+ "@babel/register": "^7.18.6",
42
+ "bpmn-elements": "^8.1.0",
43
+ "bpmn-engine": "^14.1.0",
44
44
  "bpmn-moddle": "^7.1.2",
45
45
  "c8": "^7.11.3",
46
46
  "camunda-bpmn-moddle": "^6.1.2",
@@ -51,10 +51,10 @@
51
51
  "mocha": "^10.0.0",
52
52
  "mocha-cakes-2": "^3.3.0",
53
53
  "moddle-context-serializer": "^2.1.0",
54
- "nock": "^13.2.6"
54
+ "nock": "^13.2.8"
55
55
  },
56
56
  "dependencies": {
57
- "cron-parser": "^4.4.0"
57
+ "cron-parser": "^4.5.0"
58
58
  },
59
59
  "files": [
60
60
  "src",
package/src/IO.js CHANGED
@@ -51,8 +51,8 @@ class InputOutput {
51
51
  type: parm.$type,
52
52
  behaviour: {
53
53
  scriptFormat,
54
- ...(value ? {script: value} : undefined),
55
- ...(resource ? {resource} : undefined),
54
+ ...(value && {script: value}),
55
+ ...(resource && {resource}),
56
56
  },
57
57
  });
58
58