From a06c679cdd3dd9d29c15c98517f28d5f3182cc29 Mon Sep 17 00:00:00 2001 From: Ruslan Gainutdinov Date: Mon, 10 Feb 2020 18:26:25 +0200 Subject: [PATCH] Add BPMN diagrams and on the fly svg,png generation --- package-lock.json | 432 ++++++++++++++++++ package.json | 5 +- specs/workflow/taxi/cancel-booking.bpmn | 214 +++++++++ specs/workflow/taxi/create-booking.bpmn | 362 +++++++++++++++ .../get-price-estimate-or-fixed-price.bpmn | 135 ++++++ specs/workflow/taxi/intro.bpmn | 134 ++++++ specs/workflow/taxi/modify-booking.bpmn | 188 ++++++++ .../taxi/retrieve-and-receive-status.bpmn | 224 +++++++++ .../workflow/taxi/search-available-cars.bpmn | 130 ++++++ utils/compile-workflows.js | 71 ++- 10 files changed, 1874 insertions(+), 21 deletions(-) create mode 100644 specs/workflow/taxi/cancel-booking.bpmn create mode 100644 specs/workflow/taxi/create-booking.bpmn create mode 100644 specs/workflow/taxi/get-price-estimate-or-fixed-price.bpmn create mode 100644 specs/workflow/taxi/intro.bpmn create mode 100644 specs/workflow/taxi/modify-booking.bpmn create mode 100644 specs/workflow/taxi/retrieve-and-receive-status.bpmn create mode 100644 specs/workflow/taxi/search-available-cars.bpmn diff --git a/package-lock.json b/package-lock.json index facb85e..33db06e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -186,6 +186,105 @@ "integrity": "sha512-kBa+cDHOR9jpRJ+kcGMsysrls0leukrm68DmFQoMIWQcXdr2cZvyvypWuGYT7U+9kAExUE7+T7r6G3C3A6L8MQ==", "dev": true }, + "@huksley/bpmn-to-image": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/@huksley/bpmn-to-image/-/bpmn-to-image-0.5.1.tgz", + "integrity": "sha512-Nl2AW8YYjqNVyH4veRV0tltH6bbreNHFOviolInQtzXwTMe2/s502IVRuUYigQG28ae/QnwYFZBKNFjdOBS+gw==", + "dev": true, + "requires": { + "bpmn-js": "^6.2.0", + "chalk": "^2.4.2", + "meow": "^4.0.0", + "puppeteer": "^1.16.0" + }, + "dependencies": { + "bpmn-font": { + "version": "0.9.3", + "resolved": "https://registry.npmjs.org/bpmn-font/-/bpmn-font-0.9.3.tgz", + "integrity": "sha512-kzRGXGLzTROLRNCSskkOyj/+SbtTAn2unKfgB9tNt7RWJFybg/Wbe9YjK2ALotI3b64wwlCTkAalXiTiskP6dg==", + "dev": true + }, + "bpmn-js": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/bpmn-js/-/bpmn-js-6.3.0.tgz", + "integrity": "sha512-9mY/p07iAIorEGkTlhM4fHg34tG+MAPAoEfM8XjJxvSHhtLEn1dIf4Jx+h0LVUxrneFSxnVaZq5BFlffGVPj6g==", + "dev": true, + "requires": { + "bpmn-font": "^0.9.3", + "bpmn-moddle": "^6.0.2", + "css.escape": "^1.5.1", + "diagram-js": "^6.4.0", + "diagram-js-direct-editing": "^1.6.1", + "ids": "^1.0.0", + "inherits": "^2.0.1", + "min-dash": "^3.5.1", + "min-dom": "^3.0.0", + "object-refs": "^0.3.0", + "tiny-svg": "^2.2.1" + } + }, + "bpmn-moddle": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/bpmn-moddle/-/bpmn-moddle-6.0.2.tgz", + "integrity": "sha512-RIazADF2YHZhVIXeWT5z6kNo2/uiFXNtb1iqiF51CvHoFJQR2Tj+znEtzHFjJQ1bLSHe7cAO82HEFmovzhiZ9w==", + "dev": true, + "requires": { + "min-dash": "^3.0.0", + "moddle": "^5.0.1", + "moddle-xml": "^8.0.2" + } + }, + "diagram-js": { + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/diagram-js/-/diagram-js-6.4.0.tgz", + "integrity": "sha512-E3U63Xh+79DAe7vl6UGe6JdgYWxQLBi03RpvsKGJpgJvv9cWnGDLVj6PBdVLCBZ1d3tXqQyGZIr0thswZhhBCA==", + "dev": true, + "requires": { + "css.escape": "^1.5.1", + "didi": "^4.0.0", + "hammerjs": "^2.0.1", + "inherits": "^2.0.1", + "min-dash": "^3.5.0", + "min-dom": "^3.0.0", + "object-refs": "^0.3.0", + "path-intersection": "^2.2.0", + "tiny-svg": "^2.2.1" + } + }, + "ids": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/ids/-/ids-1.0.0.tgz", + "integrity": "sha512-Zvtq1xUto4LttpstyOlFum8lKx+i1OmRfg+6A9drFS9iSZsDPMHG4Sof/qwNR4kCU7jBeWFPrY2ocHxiz7cCRw==", + "dev": true + }, + "moddle": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/moddle/-/moddle-5.0.1.tgz", + "integrity": "sha512-RB9NCYxbnQLiY1ZJ8Y61+I8TBEmmyaMr8Tj0+fJHN8Fm6l5NqojDy1s4LNDxq+omvug4gnzERMgT8uwNsADDvw==", + "dev": true, + "requires": { + "min-dash": "^3.0.0" + } + }, + "moddle-xml": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/moddle-xml/-/moddle-xml-8.0.2.tgz", + "integrity": "sha512-8PkPzoPs8/pz3waSL1EEE0Wm0C7jkHOPVt/GmWhdDJNiz2IlGcCBWBwgb32VcNoN7zAAMvRn0nJ9AyIdOchxIQ==", + "dev": true, + "requires": { + "min-dash": "^3.0.0", + "moddle": "^5.0.1", + "saxen": "^8.1.0" + } + }, + "path-intersection": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/path-intersection/-/path-intersection-2.2.0.tgz", + "integrity": "sha512-1qchRuLKhRt3qYePf9CU/74fLrBo9OTiKYNn5fxfuHJW6kTThEk04ql7w8JwOgZjNANAGp1052tWGpwZ7ItNRA==", + "dev": true + } + } + }, "@mrmlnc/readdir-enhanced": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz", @@ -693,6 +792,12 @@ "integrity": "sha512-THtfYS6KtME/yIAhKjZ2ul7XI96lQGHRputJQHO80LAWQnuGP4iCIN8vdMRboGbIEYBwU33q8Tch1os2+X0kMg==", "dev": true }, + "array-find-index": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", + "integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=", + "dev": true + }, "array-flatten": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", @@ -1173,6 +1278,17 @@ "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", "dev": true }, + "camelcase-keys": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-4.2.0.tgz", + "integrity": "sha1-oqpfsa9oh1glnDLBQUJteJI7m3c=", + "dev": true, + "requires": { + "camelcase": "^4.1.0", + "map-obj": "^2.0.0", + "quick-lru": "^1.0.0" + } + }, "camelize": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/camelize/-/camelize-1.0.0.tgz", @@ -1326,6 +1442,23 @@ "wrap-ansi": "^2.0.0" } }, + "closest": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/closest/-/closest-0.0.1.tgz", + "integrity": "sha1-JtpvgLPg4X5x+A8SeCgZ6fZTSVw=", + "dev": true, + "requires": { + "matches-selector": "0.0.1" + }, + "dependencies": { + "matches-selector": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/matches-selector/-/matches-selector-0.0.1.tgz", + "integrity": "sha1-HfUmIkOuNBwaCATdMCBIJnrHE7s=", + "dev": true + } + } + }, "co": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", @@ -1384,6 +1517,12 @@ "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==" }, + "component-event": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/component-event/-/component-event-0.1.4.tgz", + "integrity": "sha1-PeePwoeCOBeH4kvyp8U2vwFCybQ=", + "dev": true + }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -1646,6 +1785,21 @@ "postcss-value-parser": "^3.3.0" } }, + "css.escape": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/css.escape/-/css.escape-1.5.1.tgz", + "integrity": "sha1-QuJ9T6BK4y+TGktNQZH6nN3ul8s=", + "dev": true + }, + "currently-unhandled": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz", + "integrity": "sha1-mI3zP+qxke95mmE2nddsF635V+o=", + "dev": true, + "requires": { + "array-find-index": "^1.0.1" + } + }, "d3": { "version": "5.14.2", "resolved": "https://registry.npmjs.org/d3/-/d3-5.14.2.tgz", @@ -1984,6 +2138,24 @@ "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", "dev": true }, + "decamelize-keys": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/decamelize-keys/-/decamelize-keys-1.1.0.tgz", + "integrity": "sha1-0XGoeTMlKAfrPLYdwcFEXQeN8tk=", + "dev": true, + "requires": { + "decamelize": "^1.1.0", + "map-obj": "^1.0.0" + }, + "dependencies": { + "map-obj": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", + "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=", + "dev": true + } + } + }, "decimal.js": { "version": "9.0.1", "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-9.0.1.tgz", @@ -2097,6 +2269,16 @@ "dev": true, "optional": true }, + "delegate-events": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/delegate-events/-/delegate-events-1.1.1.tgz", + "integrity": "sha1-2rSQqcHx1AykDrzSHtr3F7Zx1NQ=", + "dev": true, + "requires": { + "closest": "*", + "component-event": "*" + } + }, "depd": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", @@ -2131,6 +2313,22 @@ "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=", "dev": true }, + "diagram-js-direct-editing": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/diagram-js-direct-editing/-/diagram-js-direct-editing-1.6.1.tgz", + "integrity": "sha512-FOW2qp7yT/L3Go/YfBOfnWrV2pc2PPoTSSRIg2nnld8pQDTnMaqKPva9GZEoCtcTJzPV4ctZX52ZdkJ3C7aWaA==", + "dev": true, + "requires": { + "min-dash": "^3.0.0", + "min-dom": "^3.0.0" + } + }, + "didi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/didi/-/didi-4.0.0.tgz", + "integrity": "sha512-AzMElh8mCHOPWPCWfGjoJRla31fMXUT6+287W5ef3IPmtuBcyG9+MkFS7uPP6v3t2Cl086KwWfRB9mESa0OsHQ==", + "dev": true + }, "diff": { "version": "3.5.0", "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", @@ -2169,6 +2367,12 @@ "integrity": "sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA==", "dev": true }, + "domify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/domify/-/domify-1.4.0.tgz", + "integrity": "sha1-EUg2F/dk+GlZdbS9x5sU8IA7Yps=", + "dev": true + }, "dompurify": { "version": "2.0.7", "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-2.0.7.tgz", @@ -3935,6 +4139,12 @@ "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", "dev": true }, + "hammerjs": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/hammerjs/-/hammerjs-2.0.8.tgz", + "integrity": "sha1-BO93hiz/K7edMPdpIJWTAiK/YPE=", + "dev": true + }, "handlebars": { "version": "4.5.3", "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.5.3.tgz", @@ -4272,6 +4482,18 @@ "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", "dev": true }, + "indent-string": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-3.2.0.tgz", + "integrity": "sha1-Sl/W0nzDMvN+VBmlBNu4NxBckok=", + "dev": true + }, + "indexof": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/indexof/-/indexof-0.0.1.tgz", + "integrity": "sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10=", + "dev": true + }, "inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -4884,6 +5106,16 @@ "js-tokens": "^3.0.0 || ^4.0.0" } }, + "loud-rejection": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.6.0.tgz", + "integrity": "sha1-W0b4AUft7leIcPCG0Eghz5mOVR8=", + "dev": true, + "requires": { + "currently-unhandled": "^0.4.1", + "signal-exit": "^3.0.0" + } + }, "lower-case": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-1.1.4.tgz", @@ -4954,6 +5186,12 @@ "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=" }, + "map-obj": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-2.0.0.tgz", + "integrity": "sha1-plzSkIepJZi4eRJXpSPgISIqwfk=", + "dev": true + }, "map-visit": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz", @@ -4974,6 +5212,12 @@ "integrity": "sha512-c+yYdCZJQrsRjTPhUx7VKkApw9bwDkNbHUKo1ovgcfDjb2kc8rLuRbIFyXL5WOEUwzSSKo3IXpph2K6DqB/KZg==", "dev": true }, + "matches-selector": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/matches-selector/-/matches-selector-1.2.0.tgz", + "integrity": "sha512-c4vLwYWyl+Ji+U43eU/G5FwxWd4ZH0ePUsFs5y0uwD9HUEFBXUQ1zUUan+78IpRD+y4pUfG0nAzNM292K7ItvA==", + "dev": true + }, "md5.js": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", @@ -5008,6 +5252,110 @@ "integrity": "sha512-ey6EpYv0tEaIbM/nTDOpHciXUvd+ackQrJgEzBwemhZZIWZjcyodqEcrmqDy2BKRTM3a65kKBV4WtLXJDt26SQ==", "dev": true }, + "meow": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/meow/-/meow-4.0.1.tgz", + "integrity": "sha512-xcSBHD5Z86zaOc+781KrupuHAzeGXSLtiAOmBsiLDiPSaYSB6hdew2ng9EBAnZ62jagG9MHAOdxpDi/lWBFJ/A==", + "dev": true, + "requires": { + "camelcase-keys": "^4.0.0", + "decamelize-keys": "^1.0.0", + "loud-rejection": "^1.0.0", + "minimist": "^1.1.3", + "minimist-options": "^3.0.1", + "normalize-package-data": "^2.3.4", + "read-pkg-up": "^3.0.0", + "redent": "^2.0.0", + "trim-newlines": "^2.0.0" + }, + "dependencies": { + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, + "requires": { + "locate-path": "^2.0.0" + } + }, + "load-json-file": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", + "integrity": "sha1-L19Fq5HjMhYjT9U62rZo607AmTs=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "parse-json": "^4.0.0", + "pify": "^3.0.0", + "strip-bom": "^3.0.0" + } + }, + "locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "dev": true, + "requires": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + } + }, + "p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "dev": true, + "requires": { + "p-try": "^1.0.0" + } + }, + "p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", + "dev": true, + "requires": { + "p-limit": "^1.1.0" + } + }, + "p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", + "dev": true + }, + "path-type": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", + "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", + "dev": true, + "requires": { + "pify": "^3.0.0" + } + }, + "read-pkg": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", + "integrity": "sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k=", + "dev": true, + "requires": { + "load-json-file": "^4.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^3.0.0" + } + }, + "read-pkg-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-3.0.0.tgz", + "integrity": "sha1-PtSWaF26D4/hGNBpHcUfSh/5bwc=", + "dev": true, + "requires": { + "find-up": "^2.0.0", + "read-pkg": "^3.0.0" + } + } + } + }, "merge-anything": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/merge-anything/-/merge-anything-2.4.1.tgz", @@ -5144,6 +5492,12 @@ "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", "dev": true }, + "min-dash": { + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/min-dash/-/min-dash-3.5.2.tgz", + "integrity": "sha512-YVbJZUtnzT5QsgJUp9H9uyJTW6NJgswFqI27RI/+MSox860uIjaGMbSQBftEzbMXiJVRG24hpoIh3SG666SHgA==", + "dev": true + }, "min-document": { "version": "2.19.0", "resolved": "https://registry.npmjs.org/min-document/-/min-document-2.19.0.tgz", @@ -5153,6 +5507,20 @@ "dom-walk": "^0.1.0" } }, + "min-dom": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/min-dom/-/min-dom-3.1.1.tgz", + "integrity": "sha512-qvURYMN2jHw9kPg1oFKdOd/VNJOsUNGV5H5j+zpJLkFVyP49tqmTQN8xWMYCDpIKetyQAC6jV5JjskNZr+JHpg==", + "dev": true, + "requires": { + "closest": "0.0.1", + "component-event": "^0.1.4", + "delegate-events": "^1.1.1", + "domify": "^1.3.1", + "indexof": "0.0.1", + "matches-selector": "^1.2.0" + } + }, "minify": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/minify/-/minify-4.1.3.tgz", @@ -5211,6 +5579,24 @@ "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", "dev": true }, + "minimist-options": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/minimist-options/-/minimist-options-3.0.2.tgz", + "integrity": "sha512-FyBrT/d0d4+uiZRbqznPXqw3IpZZG3gl3wKWiX784FycUKVwBt0uLBFkQrtE4tZOrgo78nZp2jnKz3L65T5LdQ==", + "dev": true, + "requires": { + "arrify": "^1.0.1", + "is-plain-obj": "^1.1.0" + }, + "dependencies": { + "arrify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", + "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", + "dev": true + } + } + }, "mixin-deep": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.2.tgz", @@ -5866,6 +6252,12 @@ "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==" }, + "object-refs": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/object-refs/-/object-refs-0.3.0.tgz", + "integrity": "sha512-eP0ywuoWOaDoiake/6kTJlPJhs+k0qNm4nYRzXLNHj6vh+5M3i9R1epJTdxIPGlhWc4fNRQ7a6XJNCX+/L4FOQ==", + "dev": true + }, "object-visit": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", @@ -6805,6 +7197,12 @@ "integrity": "sha1-nsYfeQSYdXB9aUFFlv2Qek1xHnM=", "dev": true }, + "quick-lru": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-1.1.0.tgz", + "integrity": "sha1-Q2CxfGETatOAeDl/8RQW4Ybc+7g=", + "dev": true + }, "randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", @@ -7059,6 +7457,16 @@ "resolve": "^1.1.6" } }, + "redent": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/redent/-/redent-2.0.0.tgz", + "integrity": "sha1-wbIAe0LVfrE4kHmzyDM2OdXhzKo=", + "dev": true, + "requires": { + "indent-string": "^3.0.0", + "strip-indent": "^2.0.0" + } + }, "redoc": { "version": "2.0.0-rc.18", "resolved": "https://registry.npmjs.org/redoc/-/redoc-2.0.0-rc.18.tgz", @@ -7582,6 +7990,12 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "dev": true }, + "saxen": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/saxen/-/saxen-8.1.0.tgz", + "integrity": "sha512-34U5SdDUxECB5Jkwbc2mAdxHyGvbfCHv0iHgf+x2jaYLlwsPpju9651Lld9CpFpF4zJsoWcF3Q05blXXNOb/cg==", + "dev": true + }, "scheduler": { "version": "0.17.0", "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.17.0.tgz", @@ -8209,6 +8623,12 @@ "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", "dev": true }, + "strip-indent": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-2.0.0.tgz", + "integrity": "sha1-XvjbKV0B5u1sv3qrlpmNeCJSe2g=", + "dev": true + }, "strip-json-comments": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", @@ -8403,6 +8823,12 @@ "dev": true, "optional": true }, + "tiny-svg": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/tiny-svg/-/tiny-svg-2.2.2.tgz", + "integrity": "sha512-u6zCuMkDR/3VAh83X7hDRn/pi0XhwG2ycuNS0cTFtQjGdOG2tSvEb8ds65VeGWc3H6PUjJKeunueXqgkZqtMsg==", + "dev": true + }, "tmp": { "version": "0.0.33", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", @@ -8477,6 +8903,12 @@ "nopt": "~1.0.10" } }, + "trim-newlines": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-2.0.0.tgz", + "integrity": "sha1-tAPQuRvlDDMd/EuC7s6yLD3hbSA=", + "dev": true + }, "trim-repeated": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/trim-repeated/-/trim-repeated-1.0.0.tgz", diff --git a/package.json b/package.json index 5ba3706..e00b4de 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "postinstall": "cp -f ./node_modules/mermaid/dist/mermaid.min.js ./node_modules/mermaid.cli/", "clean": "shx rm -Rf dist node_modules", "build": "node utils/adopt-schemas.js && node utils/bundle-spec.js && node utils/compile-workflows.js", - "start": "npm run build && nodemon src/index.js -w specs -w docs -w assets -w schemas -w src -w specs/workflow -e js,md,mmd,yml,yaml,json", + "start": "npm run build && nodemon src/index.js -w specs -w docs -w assets -w schemas -w src -w specs/workflow -e js,md,mmd,yml,yaml,json,bpmn", "prettify": "prettier --write --ignore-path .gitignore '**/*.{css,html,js,json,md,yaml,yml}'", "lint": "npm run lint-code && npm run lint-schemas && npm run lint-spec", "lint-code": "eslint .", @@ -51,7 +51,8 @@ "io-ts-promise": "^2.0.1", "maas-schemas-ts": "0.0.13", "mermaid": "^8.4.4", - "mermaid.cli": "^0.5.1" + "mermaid.cli": "^0.5.1", + "@huksley/bpmn-to-image": "^0.5.1" }, "dependencies": { "maas-schemas": "^10.0.1" diff --git a/specs/workflow/taxi/cancel-booking.bpmn b/specs/workflow/taxi/cancel-booking.bpmn new file mode 100644 index 0000000..4a28c8d --- /dev/null +++ b/specs/workflow/taxi/cancel-booking.bpmn @@ -0,0 +1,214 @@ + + + + + + Relevant points: +• Cancellation rules until certain statuses to be defined together with TSP. E.g. cancellation possible without fee before driver selected; without fee until driver reached the customer; with a fixed fee when driver waiting for customer but ride not started after agreed waiting time; not possible when ride started. + + + + + + + Task_1xbbysx + + + Task_1ntvywz + StartEvent_1 + Task_0h3ibyy + ExclusiveGateway_0zia6cf + Task_09wnrkm + Task_1hazb4q + + + Task_18upxqv + Task_1ghhz68 + EndEvent_0309c53 + Task_0huro5r + + + + SequenceFlow_125lmu9 + SequenceFlow_138xj4d + + + SequenceFlow_125lmu9 + + + SequenceFlow_0ylsg3v + SequenceFlow_0hds6m2 + SequenceFlow_1ymejzo + + + SequenceFlow_138xj4d + SequenceFlow_1uzu4es + SequenceFlow_1mmozp6 + + + SequenceFlow_1uzu4es + SequenceFlow_059qpyw + + + SequenceFlow_059qpyw + SequenceFlow_03edvzy + + + SequenceFlow_0hds6m2 + + + SequenceFlow_1ymejzo + SequenceFlow_0ycdx1z + + + SequenceFlow_1mmozp6 + SequenceFlow_1lzorgr + + + SequenceFlow_0ycdx1z + SequenceFlow_1lzorgr + + + + + + + + + + + + + + SequenceFlow_03edvzy + SequenceFlow_0ylsg3v + + + Respond with possible fee for late cancellation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/specs/workflow/taxi/create-booking.bpmn b/specs/workflow/taxi/create-booking.bpmn new file mode 100644 index 0000000..5b1e000 --- /dev/null +++ b/specs/workflow/taxi/create-booking.bpmn @@ -0,0 +1,362 @@ + + + + + + + Relevant points: +• For payment preauthorization, the final price would preferably be received then at the end of the ride +• ETA and location of the car are essential to receive in status so that they can be shown to the user +• Free text field to further explain pickup location and options to be chosen by customer + + + + + + + + Task_17wpk93 + Task_1vl5ps8 + Task_1r4mwkv + + + Task_1ixfgol + Task_1hvp0bj + Task_05l1fdu + ExclusiveGateway_0k33p1e + Task_1sg3b6h + Task_19zljl6 + ExclusiveGateway_19bt993 + Task_185cvl0 + + + ExclusiveGateway_1l8vni3 + Task_1mk2khh + Task_0o5v6e2 + StartEvent_1 + Task_0ncmpmr + Task_19de869 + Task_0kks85q + EndEvent_0k9fmkg + Task_08cft2q + + + + SequenceFlow_1nahky4 + SequenceFlow_1ul1ked + + + SequenceFlow_027ikcx + SequenceFlow_1qtw775 + + + SequenceFlow_1ul1ked + SequenceFlow_0ufk78c + + + SequenceFlow_0ufk78c + SequenceFlow_0p6d47t + SequenceFlow_072gbqe + + + SequenceFlow_10nnvgu + SequenceFlow_01watux + SequenceFlow_027ikcx + + + SequenceFlow_0p6d47t + + + SequenceFlow_0z87vf2 + SequenceFlow_10nnvgu + + + SequenceFlow_14f5tzc + + + SequenceFlow_1qtw775 + SequenceFlow_1nahky4 + + + SequenceFlow_1v1edsd + SequenceFlow_1j85fzv + + + SequenceFlow_12o9ua5 + SequenceFlow_0w08diz + + + SequenceFlow_1wr6onr + SequenceFlow_12o9ua5 + + + SequenceFlow_14f5tzc + SequenceFlow_0z87vf2 + + + SequenceFlow_0cpc4yh + SequenceFlow_02aiixu + + + SequenceFlow_02aiixu + SequenceFlow_1wr6onr + + + SequenceFlow_072gbqe + SequenceFlow_1v1edsd + + + SequenceFlow_1j85fzv + SequenceFlow_0bmmzvl + SequenceFlow_0cpc4yh + + + SequenceFlow_0w08diz + SequenceFlow_1kf1qzs + + + SequenceFlow_1kf1qzs + SequenceFlow_05854in + + + SequenceFlow_01watux + SequenceFlow_0bmmzvl + SequenceFlow_05854in + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/specs/workflow/taxi/get-price-estimate-or-fixed-price.bpmn b/specs/workflow/taxi/get-price-estimate-or-fixed-price.bpmn new file mode 100644 index 0000000..fb609a3 --- /dev/null +++ b/specs/workflow/taxi/get-price-estimate-or-fixed-price.bpmn @@ -0,0 +1,135 @@ + + + + + + Relevant points: +• Desired inputs: start time for pre-bookings, multipoint trips A-C-D-B, car type or passenger count, and also other options such as exclusive service, minivan, station wagon, driver language, pets allowed, disabled passenger + + + + + + + Task_162kt56 + + + Task_0p22r2o + Task_1poedk0 + + + Task_025zgcn + StartEvent_1 + EndEvent_1c0il93 + Task_0w25eof + + + + SequenceFlow_1ts982m + SequenceFlow_1onfdkr + + + SequenceFlow_1ts982m + + + SequenceFlow_1vqxtg2 + + + SequenceFlow_0gsopel + SequenceFlow_1q8us5r + + + SequenceFlow_1q8us5r + SequenceFlow_1vqxtg2 + + + SequenceFlow_14sqt98 + SequenceFlow_0gsopel + + + SequenceFlow_1onfdkr + SequenceFlow_14sqt98 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/specs/workflow/taxi/intro.bpmn b/specs/workflow/taxi/intro.bpmn new file mode 100644 index 0000000..c9902c5 --- /dev/null +++ b/specs/workflow/taxi/intro.bpmn @@ -0,0 +1,134 @@ + + + + + + Essential elements, for more information, go to https://camunda.com/bpmn/ + + + + + + + Task_1qapjw4 + + + StartEvent_1 + EndEvent_188nng4 + Task_027zp47 + ExclusiveGateway_1ljfnff + ExclusiveGateway_0lq120b + + + + SequenceFlow_0f4v221 + + + SequenceFlow_0gfkqgc + SequenceFlow_1xct747 + + + SequenceFlow_0f4v221 + SequenceFlow_04nrmxp + SequenceFlow_15bqfjb + + + SequenceFlow_04nrmxp + SequenceFlow_0gfkqgc + + + SequenceFlow_040balb + SequenceFlow_1xct747 + + + SequenceFlow_15bqfjb + SequenceFlow_040balb + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/specs/workflow/taxi/modify-booking.bpmn b/specs/workflow/taxi/modify-booking.bpmn new file mode 100644 index 0000000..5a71963 --- /dev/null +++ b/specs/workflow/taxi/modify-booking.bpmn @@ -0,0 +1,188 @@ + + + + + + Relevant points: +• Modification would be useful for e.g. changed destination, picking up a friend, or re-routing a trip in case of e.g. shared taxis + + + + + + + Task_1yh8gqr + + + StartEvent_1 + Task_1h3cel7 + Task_19pnl3v + Task_1owe6rt + ExclusiveGateway_04nfxgs + + + Task_1bg1oa3 + Task_0bxqvdi + Task_1s2qp9f + EndEvent_1fm6y4j + + + + SequenceFlow_1nd3ubi + + + SequenceFlow_1nd3ubi + SequenceFlow_02xeo04 + + + SequenceFlow_02xeo04 + SequenceFlow_0huvy65 + + + SequenceFlow_0in1ulm + SequenceFlow_0k83ltp + + + SequenceFlow_0huvy65 + SequenceFlow_1jcehyb + + + SequenceFlow_1jcehyb + SequenceFlow_0in1ulm + + + SequenceFlow_0k83ltp + SequenceFlow_1705ion + SequenceFlow_1gm7z7f + + + SequenceFlow_1705ion + SequenceFlow_1xjhe2a + + + SequenceFlow_1gm7z7f + SequenceFlow_01nk7c2 + + + SequenceFlow_01nk7c2 + SequenceFlow_1xjhe2a + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/specs/workflow/taxi/retrieve-and-receive-status.bpmn b/specs/workflow/taxi/retrieve-and-receive-status.bpmn new file mode 100644 index 0000000..f50f982 --- /dev/null +++ b/specs/workflow/taxi/retrieve-and-receive-status.bpmn @@ -0,0 +1,224 @@ + + + + + + + Relevant points: +• Both models should be preferably available: querying the status from Whim and getting status changes pushed from the TSP system +• ⚠️ FINAL PRICE: crucial for Whim would be to receive the final price after the ride has ended. It can be pulled from Whim or pushed to Whim, more important is that it would be available. +• Price change reason would also be good to receive, e.g. had to upgrade to a bigger car + + + + + + + Task_0av3o2x + EndEvent_0h27ccb + + + Task_1x6t5xl + + + Task_0knstai + StartEvent_1 + + + + SequenceFlow_0o514sb + SequenceFlow_00ncegs + + + SequenceFlow_00ncegs + + + SequenceFlow_0imd7gg + SequenceFlow_0o514sb + + + SequenceFlow_0qu1y6q + SequenceFlow_0imd7gg + + + SequenceFlow_0qu1y6q + + + + + + + Status changed by any reason; pushed to Whim via webhook + + + + + + + Task_0w1zlx7 + + + StartEvent_172m0hi + Task_1kmhpq4 + Task_1lylqx9 + + + UserTask_1e4dyod + EndEvent_10uuf5q + + + + SequenceFlow_02dq90o + + + SequenceFlow_02dq90o + SequenceFlow_1w0nex7 + + + SequenceFlow_1w0nex7 + SequenceFlow_14mcghj + + + SequenceFlow_14mcghj + SequenceFlow_15lx5mt + + + SequenceFlow_15lx5mt + SequenceFlow_1pawss2 + + + SequenceFlow_1pawss2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/specs/workflow/taxi/search-available-cars.bpmn b/specs/workflow/taxi/search-available-cars.bpmn new file mode 100644 index 0000000..6ec6af5 --- /dev/null +++ b/specs/workflow/taxi/search-available-cars.bpmn @@ -0,0 +1,130 @@ + + + + + Relevant points: +• ETA to the query location is good to return already here, if possible +• Car type, make and model, color, taxi id number good to return, if available + + + + + + Task_0rmkvy5 + Task_0ijoncr + + + EndEvent_0oc29eo + StartEvent_1 + Task_06jsdp2 + Task_0d4rtbo + + + Task_0xy3s05 + + + + SequenceFlow_03cm7sv + + + SequenceFlow_0htprwd + SequenceFlow_0r931sc + + + SequenceFlow_0a66fye + SequenceFlow_0htprwd + + + SequenceFlow_0r931sc + SequenceFlow_1fvfvqg + + + SequenceFlow_1iw75n0 + + + SequenceFlow_1iw75n0 + SequenceFlow_0a66fye + + + SequenceFlow_1fvfvqg + SequenceFlow_03cm7sv + + + + + + dasdasdas + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/utils/compile-workflows.js b/utils/compile-workflows.js index c3851eb..c5a89ac 100644 --- a/utils/compile-workflows.js +++ b/utils/compile-workflows.js @@ -4,35 +4,68 @@ const fs = require('fs'); const { spawn } = require('child_process'); const workflows = process.argv[2] || './specs/workflow'; const out = process.argv[3] || './dist/specs/workflow'; +const { convertAll: bpmnConvert } = require('@huksley/bpmn-to-image'); /** - * Process all workflows into svg files + * Invokes mmdc MermaidJS compiler to create svg file */ -async function compileWorkflows() { - if (!fs.existsSync(out)) { - fs.mkdirSync(out, { recursive: true }); +async function compileFile(input, output, path, file) { + if (file.endsWith('.mmd')) { + const svg = file.replace('.mmd', '.svg'); + const child = spawn('mmdc', ['-i', input + path + '/' + file, '-o', output + path + '/' + svg]); + child.stderr.on('data', data => { + // eslint-disable-next-line no-console + console.warn(`${path + file}: ${data}`); + }); + + child.on('close', code => { + if (code !== 0) { + // eslint-disable-next-line no-console + console.warn(`${path + file}: child process exited with code ${code}`); + } + }); + } else if (file.endsWith('.bpmn')) { + const svg = file.replace('.bpmn', '.svg'); + const png = file.replace('.bpmn', '.png'); + await bpmnConvert( + [ + { + input: input + path + '/' + file, + outputs: [output + path + '/' + svg, output + path + '/' + png], + }, + ], + { deviceScaleFactor: 4 } + ); + } +} + +/** + * Recursively walk the tree + */ +async function compileDir(input, output, path) { + if (!fs.existsSync(output + path)) { + fs.mkdirSync(output + path, { recursive: true }); } - fs.readdir(workflows, (err, files) => { + + fs.readdir(input + path, (err, files) => { files.forEach(file => { - if (file.endsWith('.mmd')) { - const svg = file.replace('.mmd', '.svg'); - const child = spawn('mmdc', ['-i', workflows + '/' + file, '-o', out + '/' + svg]); - child.stderr.on('data', data => { - // eslint-disable-next-line no-console - console.warn(`${file}: ${data}`); - }); - - child.on('close', code => { - if (code !== 0) { - // eslint-disable-next-line no-console - console.warn(`${file}: child process exited with code ${code}`); - } - }); + const stat = fs.lstatSync(input + path + '/' + file); + if (stat.isDirectory()) { + compileDir(input, output, path + '/' + file); + } else { + compileFile(input, output, path, file); } }); }); } +/** + * Process all workflow files in various files + */ +async function compileWorkflows(path) { + compileDir(workflows, out, ''); +} + module.exports = { compileWorkflows, };