From 6a2f6bc4770dbdde8ed2173ce331fd2b6ad6d24b Mon Sep 17 00:00:00 2001 From: rjrodger Date: Thu, 2 Jul 2020 01:09:53 +0100 Subject: [PATCH] v3.22.0 --- CHANGES.md | 6 + lib/api.js | 4 +- package-lock.json | 237 +-- package.json | 2 +- test/api.test.js | 37 +- test/coverage.html | 4719 ++++++++++++++++++++++-------------------- test/message.test.js | 68 +- test/sub.test.js | 5 +- 8 files changed, 2649 insertions(+), 2429 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 1afe5786..a71fef88 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,9 @@ +## 3.22.0 2020-07-02 + +* Update patrun module to fix sub multiple fires +* PR #855 seneca.fail - allow the boolean first arg to trigger the error throw + + ## 3.21.2 2020-05-26 * Handle 'object' === typeof(null) edge cases. diff --git a/lib/api.js b/lib/api.js index 7b47704b..56840310 100644 --- a/lib/api.js +++ b/lib/api.js @@ -177,9 +177,7 @@ exports.fail = function (...args) { return failIf(this, ...args) } - throw this.util.error('fail_wrong_number_of_args', - { num_args: args.length }) - + throw this.util.error('fail_wrong_number_of_args', { num_args: args.length }) function failIf(self, cond, code, args) { if (typeof cond !== 'boolean') { diff --git a/package-lock.json b/package-lock.json index 8b3fe121..dcb9e2ef 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,25 +1,25 @@ { "name": "seneca", - "version": "3.21.2", + "version": "3.22.0", "lockfileVersion": 1, "requires": true, "dependencies": { "@babel/code-frame": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.8.3.tgz", - "integrity": "sha512-a9gxpmdXtZEInkCSHUJDLHZVBgb1QS0jhss4cPP93EW7s+uC5bikET2twEF3KV+7rDblJcmNvTR7VJejqd2C2g==", + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz", + "integrity": "sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==", "dev": true, "requires": { - "@babel/highlight": "^7.8.3" + "@babel/highlight": "^7.10.4" } }, "@babel/generator": { - "version": "7.9.6", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.9.6.tgz", - "integrity": "sha512-+htwWKJbH2bL72HRluF8zumBxzuX0ZZUFl3JLNyoUjM/Ho8wnVpPXM6aUz8cfKDqQ/h7zHqKt4xzJteUosckqQ==", + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.10.4.tgz", + "integrity": "sha512-toLIHUIAgcQygFZRAQcsLQV3CBuX6yOIru1kJk/qqqvcRmZrYe6WavZTSG+bB8MxhnL9YPf+pKQfuiP161q7ng==", "dev": true, "requires": { - "@babel/types": "^7.9.6", + "@babel/types": "^7.10.4", "jsesc": "^2.5.1", "lodash": "^4.17.13", "source-map": "^0.5.0" @@ -34,92 +34,92 @@ } }, "@babel/helper-function-name": { - "version": "7.9.5", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.9.5.tgz", - "integrity": "sha512-JVcQZeXM59Cd1qanDUxv9fgJpt3NeKUaqBqUEvfmQ+BCOKq2xUgaWZW2hr0dkbyJgezYuplEoh5knmrnS68efw==", + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.10.4.tgz", + "integrity": "sha512-YdaSyz1n8gY44EmN7x44zBn9zQ1Ry2Y+3GTA+3vH6Mizke1Vw0aWDM66FOYEPw8//qKkmqOckrGgTYa+6sceqQ==", "dev": true, "requires": { - "@babel/helper-get-function-arity": "^7.8.3", - "@babel/template": "^7.8.3", - "@babel/types": "^7.9.5" + "@babel/helper-get-function-arity": "^7.10.4", + "@babel/template": "^7.10.4", + "@babel/types": "^7.10.4" } }, "@babel/helper-get-function-arity": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.8.3.tgz", - "integrity": "sha512-FVDR+Gd9iLjUMY1fzE2SR0IuaJToR4RkCDARVfsBBPSP53GEqSFjD8gNyxg246VUyc/ALRxFaAK8rVG7UT7xRA==", + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.10.4.tgz", + "integrity": "sha512-EkN3YDB+SRDgiIUnNgcmiD361ti+AVbL3f3Henf6dqqUyr5dMsorno0lJWJuLhDhkI5sYEpgj6y9kB8AOU1I2A==", "dev": true, "requires": { - "@babel/types": "^7.8.3" + "@babel/types": "^7.10.4" } }, "@babel/helper-split-export-declaration": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.8.3.tgz", - "integrity": "sha512-3x3yOeyBhW851hroze7ElzdkeRXQYQbFIb7gLK1WQYsw2GWDay5gAJNw1sWJ0VFP6z5J1whqeXH/WCdCjZv6dA==", + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.10.4.tgz", + "integrity": "sha512-pySBTeoUff56fL5CBU2hWm9TesA4r/rOkI9DyJLvvgz09MB9YtfIYe3iBriVaYNaPe+Alua0vBIOVOLs2buWhg==", "dev": true, "requires": { - "@babel/types": "^7.8.3" + "@babel/types": "^7.10.4" } }, "@babel/helper-validator-identifier": { - "version": "7.9.5", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.9.5.tgz", - "integrity": "sha512-/8arLKUFq882w4tWGj9JYzRpAlZgiWUJ+dtteNTDqrRBz9Iguck9Rn3ykuBDoUwh2TO4tSAJlrxDUOXWklJe4g==", + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz", + "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==", "dev": true }, "@babel/highlight": { - "version": "7.9.0", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.9.0.tgz", - "integrity": "sha512-lJZPilxX7Op3Nv/2cvFdnlepPXDxi29wxteT57Q965oc5R9v86ztx0jfxVrTcBk8C2kcPkkDa2Z4T3ZsPPVWsQ==", + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz", + "integrity": "sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA==", "dev": true, "requires": { - "@babel/helper-validator-identifier": "^7.9.0", + "@babel/helper-validator-identifier": "^7.10.4", "chalk": "^2.0.0", "js-tokens": "^4.0.0" } }, "@babel/parser": { - "version": "7.9.6", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.9.6.tgz", - "integrity": "sha512-AoeIEJn8vt+d/6+PXDRPaksYhnlbMIiejioBZvvMQsOjW/JYK6k/0dKnvvP3EhK5GfMBWDPtrxRtegWdAcdq9Q==", + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.10.4.tgz", + "integrity": "sha512-8jHII4hf+YVDsskTF6WuMB3X4Eh+PsUkC2ljq22so5rHvH+T8BzyL94VOdyFLNR8tBSVXOTbNHOKpR4TfRxVtA==", "dev": true }, "@babel/template": { - "version": "7.8.6", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.8.6.tgz", - "integrity": "sha512-zbMsPMy/v0PWFZEhQJ66bqjhH+z0JgMoBWuikXybgG3Gkd/3t5oQ1Rw2WQhnSrsOmsKXnZOx15tkC4qON/+JPg==", + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.10.4.tgz", + "integrity": "sha512-ZCjD27cGJFUB6nmCB1Enki3r+L5kJveX9pq1SvAUKoICy6CZ9yD8xO086YXdYhvNjBdnekm4ZnaP5yC8Cs/1tA==", "dev": true, "requires": { - "@babel/code-frame": "^7.8.3", - "@babel/parser": "^7.8.6", - "@babel/types": "^7.8.6" + "@babel/code-frame": "^7.10.4", + "@babel/parser": "^7.10.4", + "@babel/types": "^7.10.4" } }, "@babel/traverse": { - "version": "7.9.6", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.9.6.tgz", - "integrity": "sha512-b3rAHSjbxy6VEAvlxM8OV/0X4XrG72zoxme6q1MOoe2vd0bEc+TwayhuC1+Dfgqh1QEG+pj7atQqvUprHIccsg==", + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.10.4.tgz", + "integrity": "sha512-aSy7p5THgSYm4YyxNGz6jZpXf+Ok40QF3aA2LyIONkDHpAcJzDUqlCKXv6peqYUs2gmic849C/t2HKw2a2K20Q==", "dev": true, "requires": { - "@babel/code-frame": "^7.8.3", - "@babel/generator": "^7.9.6", - "@babel/helper-function-name": "^7.9.5", - "@babel/helper-split-export-declaration": "^7.8.3", - "@babel/parser": "^7.9.6", - "@babel/types": "^7.9.6", + "@babel/code-frame": "^7.10.4", + "@babel/generator": "^7.10.4", + "@babel/helper-function-name": "^7.10.4", + "@babel/helper-split-export-declaration": "^7.10.4", + "@babel/parser": "^7.10.4", + "@babel/types": "^7.10.4", "debug": "^4.1.0", "globals": "^11.1.0", "lodash": "^4.17.13" } }, "@babel/types": { - "version": "7.9.6", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.9.6.tgz", - "integrity": "sha512-qxXzvBO//jO9ZnoasKF1uJzHd2+M6Q2ZPIVfnFps8JJvXy0ZBbwbNOmE6SGIY5XOY6d1Bo5lb9d9RJ8nv3WSeA==", + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.10.4.tgz", + "integrity": "sha512-UTCFOxC3FsFHb7lkRMVvgLzaRVamXuAs2Tz4wajva4WxtVY82eZeaUBtC2Zt95FU9TiznuC0Zk35tsim8jeVpg==", "dev": true, "requires": { - "@babel/helper-validator-identifier": "^7.9.5", + "@babel/helper-validator-identifier": "^7.10.4", "lodash": "^4.17.13", "to-fast-properties": "^2.0.0" } @@ -338,19 +338,12 @@ "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==", "dev": true }, - "@types/events": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@types/events/-/events-3.0.0.tgz", - "integrity": "sha512-EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwya1/UFt9g==", - "dev": true - }, "@types/glob": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.1.tgz", - "integrity": "sha512-1Bh06cbWJUHMC97acuD6UMG29nMt0Aqz1vF3guLfG+kHHJhy3AyohZFFxYk2f7Q1SQIrNwvncxAE0N/9s70F2w==", + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.2.tgz", + "integrity": "sha512-VgNIkxK+j7Nz5P7jvUZlRvhuPSmsEfS03b0alKcq5V/STUKAa3Plemsn5mrQUO7am6OErJ4rhGEGJbACclrtRA==", "dev": true, "requires": { - "@types/events": "*", "@types/minimatch": "*", "@types/node": "*" } @@ -362,15 +355,15 @@ "dev": true }, "@types/node": { - "version": "14.0.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.0.5.tgz", - "integrity": "sha512-90hiq6/VqtQgX8Sp0EzeIsv3r+ellbGj4URKj5j30tLlZvRUpnAe9YbYnjl3pJM93GyXU0tghHhvXHq+5rnCKA==", + "version": "14.0.14", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.0.14.tgz", + "integrity": "sha512-syUgf67ZQpaJj01/tRTknkMNoBBLWJOBODF0Zm4NrXmiSuxjymFrxnTu1QVYRubhVkRcZLYZG8STTwJRdVm/WQ==", "dev": true }, "acorn": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.2.0.tgz", - "integrity": "sha512-apwXVmYVpQ34m/i71vrApRrRKCWQnZZF1+npOD0WV5xZFfwWOmKGQ2RWlfdy9vWITsenisM8M0Qeq8agcFHNiQ==", + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.3.1.tgz", + "integrity": "sha512-tLc0wSnatxAQHVHUapaHdz72pi9KUyHjq5KyHjGg9Y8Ifdc79pTh2XvI6I1/chZbnM7QtNKzh66ooDogPZSleA==", "dev": true }, "acorn-jsx": { @@ -630,13 +623,6 @@ "delayed-stream": "~1.0.0" } }, - "commander": { - "version": "2.20.3", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", - "dev": true, - "optional": true - }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -823,9 +809,9 @@ } }, "eslint-scope": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.0.0.tgz", - "integrity": "sha512-oYrhJW7S0bxAFDvWqzvMPRm6pcgcnWc4QnofCAqRTRfQC0JcwenzGglTtsLyIuuWFfkqDG9vz67cnttSd53djw==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.0.tgz", + "integrity": "sha512-iiGRvtxWqgtx5m8EyQUJihBloE4EnYeGE/bz1wSPwJE6tZuJUtHlhqDM4Xj2ukE8Dyy1+HCZ4hE0fzIVMzb58w==", "dev": true, "requires": { "esrecurse": "^4.1.0", @@ -842,9 +828,9 @@ } }, "eslint-visitor-keys": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.1.0.tgz", - "integrity": "sha512-8y9YjtM1JBJU/A9Kc+SbaOV4y29sSWckBwMHa+FGtVj5gN/sbnKDf6xJUl+8g7FAij9LVaP8C24DUiH/f/2Z9A==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", "dev": true }, "espree": { @@ -926,15 +912,15 @@ "dev": true }, "fast-deep-equal": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz", - "integrity": "sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA==", + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", "dev": true }, "fast-glob": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.2.tgz", - "integrity": "sha512-UDV82o4uQyljznxwMxyVRJgZZt3O5wENYojjzbaGEGZgeOxkLFf+V4cnUD+krzb2F72E18RhamkMZ7AdeggF7A==", + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.4.tgz", + "integrity": "sha512-kr/Oo6PX51265qeuCYsyGypiO5uJFgBS0jksyG7FUeCyQzNwYnzrNIMR1NXfkZXsMYXYLRAHgISHBz8gQcxKHQ==", "dev": true, "requires": { "@nodelib/fs.stat": "^2.0.2", @@ -1115,9 +1101,9 @@ }, "dependencies": { "ignore": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.6.tgz", - "integrity": "sha512-cgXgkypZBcCnOgSihyeqbo6gjIaIyDqPQB7Ra4vhE9m6kigdGoQDMHjviFhRZo3IMlRy6yElosoviMs5YxZXUA==", + "version": "5.1.8", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.8.tgz", + "integrity": "sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==", "dev": true } } @@ -1223,9 +1209,9 @@ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, "inquirer": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.1.0.tgz", - "integrity": "sha512-5fJMWEmikSYu0nv/flMc475MhGbB7TSPd/2IpFV4I4rMklboCH2rQjYY5kKiYGHqUF9gvaambupcJFFG9dvReg==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.2.0.tgz", + "integrity": "sha512-E0c4rPwr9ByePfNlTIB8z51kK1s2n6jrHuJeEHENl/sbq2G/S1auvibgEwNR4uSyiU+PiYHqSwsgGiXjG8p5ZQ==", "dev": true, "requires": { "ansi-escapes": "^4.2.1", @@ -1546,9 +1532,9 @@ } }, "merge2": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.3.0.tgz", - "integrity": "sha512-2j4DAdlBOkiSZIsaXk4mTE3sRS02yBHAtfy127xRV3bQUFqXkjHCHLW6Scv7DwNRbIWNHH8zpnz9zMaKXIdvYw==", + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", "dev": true }, "micromatch": { @@ -1765,9 +1751,9 @@ "dev": true }, "patrun": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/patrun/-/patrun-3.0.0.tgz", - "integrity": "sha512-fQ++l3FCnrQbO03wEjb2SFn+ixGXscS8948A4js0qDTBsod0eElYUDvuWCH4mV61V/7QN2lCtryRvoyBP0K/7g==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/patrun/-/patrun-4.0.0.tgz", + "integrity": "sha512-T+YuxuG7IKvOi4276DBNAFaAOEdeY5qjRs3sQ0owM45SFVFz14DTAjfE9J4Q/aUHlTw638/1B8k7tBo/dWTb3A==", "requires": { "gex": "^1.0.0" } @@ -1983,15 +1969,15 @@ "dev": true }, "seneca-entity": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/seneca-entity/-/seneca-entity-9.0.1.tgz", - "integrity": "sha512-KrRHy/qJ3OVIdCzwPfEWGD1XnTDU8MpZs6p8acA4ba925mPBdMtgpUH66vz7nwlVlzsxhGKfl36z+kQJ0BhCWg==", + "version": "10.0.2", + "resolved": "https://registry.npmjs.org/seneca-entity/-/seneca-entity-10.0.2.tgz", + "integrity": "sha512-DDUFMrIPbsVo82omEsX9lmkbBjoXDTg/UXV2ibmZuWyj4piJ+6tHdTfX+ZUil9FNpI0XPeLqiuDZXDSHW6/GYw==", "dev": true, "requires": { "eraro": "^2.1.0", "jsonic": "^0.3.1", "nid": "^1.1.0", - "seneca-mem-store": "^2.1.0" + "seneca-mem-store": "^3.0.1" } }, "seneca-error-test": { @@ -2010,15 +1996,15 @@ } }, "seneca-mem-store": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/seneca-mem-store/-/seneca-mem-store-2.1.0.tgz", - "integrity": "sha512-lQ29I0ObQd9gNcnEJhsD4Vu1lTFY8ANe9duhgw5djwPtR0L37PSVgxJhehb1mXZa08jJAPhPCznVLcf4SvQb2Q==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/seneca-mem-store/-/seneca-mem-store-3.0.1.tgz", + "integrity": "sha512-4ocd0amgzT+F4iHTSc3LnAqQym6RtldPUEmKgMcAEqfqPvsImF/rVPObgfDnE0wVL117Z0IGa8yKlAnILClCzw==", "dev": true }, "seneca-promisify": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/seneca-promisify/-/seneca-promisify-1.4.0.tgz", - "integrity": "sha512-4kjCBsWNPA7zfwXnj8zAI5bTgOr9i2ToLdYmIfAudXhUyKhtJCmwgh0FOvRg+BA5cwhHHAHp4UMjwuBL9arNmw==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/seneca-promisify/-/seneca-promisify-2.0.0.tgz", + "integrity": "sha512-xYpnZQAGJPrw1gytbpHc6rqvpbWPwA5Mt8Fl03d4mnn3zMN3to6Pgw29Nl1Ltz2bvnPsxusk2iETG/UnJtqgnQ==", "dev": true, "requires": { "optioner": "^5.0.1" @@ -2041,6 +2027,16 @@ "patrun": "^3.0.0", "qs": "^6.9.4", "reconnect-core": "^1.3.0" + }, + "dependencies": { + "patrun": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/patrun/-/patrun-3.0.0.tgz", + "integrity": "sha512-fQ++l3FCnrQbO03wEjb2SFn+ixGXscS8948A4js0qDTBsod0eElYUDvuWCH4mV61V/7QN2lCtryRvoyBP0K/7g==", + "requires": { + "gex": "^1.0.0" + } + } } }, "shebang-command": { @@ -2354,20 +2350,17 @@ "dev": true }, "typescript": { - "version": "3.9.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.3.tgz", - "integrity": "sha512-D/wqnB2xzNFIcoBG9FG8cXRDjiqSTbG2wd8DMZeQyJlP1vfTkIxH4GKveWaEBYySKIg+USu+E+EDIR47SqnaMQ==", + "version": "3.9.6", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.6.tgz", + "integrity": "sha512-Pspx3oKAPJtjNwE92YS05HQoY7z2SFyOpHo9MqJor3BXAGNaPUs83CuVp9VISFkSjyRfiTpmKuAYGJB7S7hOxw==", "dev": true }, "uglify-js": { - "version": "3.9.3", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.9.3.tgz", - "integrity": "sha512-r5ImcL6QyzQGVimQoov3aL2ZScywrOgBXGndbWrdehKoSvGe/RmiE5Jpw/v+GvxODt6l2tpBXwA7n+qZVlHBMA==", + "version": "3.10.0", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.10.0.tgz", + "integrity": "sha512-Esj5HG5WAyrLIdYU74Z3JdG2PxdIusvj6IWHMtlyESxc7kcDz7zYlYjpnSokn1UbpV0d/QX9fan7gkCNd/9BQA==", "dev": true, - "optional": true, - "requires": { - "commander": "~2.20.3" - } + "optional": true }, "uri-js": { "version": "4.2.2", @@ -2401,9 +2394,9 @@ "dev": true }, "v8-compile-cache": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.1.0.tgz", - "integrity": "sha512-usZBT3PW+LOjM25wbqIlZwPeJV+3OSz3M1k1Ws8snlW39dZyYL9lOGC5FgPVHfk0jKmjiDV8Z0mIbVQPiwFs7g==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.1.1.tgz", + "integrity": "sha512-8OQ9CL+VWyt3JStj7HX7/ciTL2V3Rl1Wf5OL+SNTm0yK1KvtReVulksyeRnCANHHuUxHlQig+JJDlUhBt1NQDQ==", "dev": true }, "verror": { diff --git a/package.json b/package.json index 8bf08e74..99505712 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "seneca", "description": "A Microservices Framework for Node.js", - "version": "3.21.2", + "version": "3.22.0", "license": "MIT", "homepage": "http://senecajs.org", "keywords": [ diff --git a/test/api.test.js b/test/api.test.js index 71cd9203..f1560311 100644 --- a/test/api.test.js +++ b/test/api.test.js @@ -57,7 +57,11 @@ describe('api', function () { } catch (err) { expect(err.code).equal('test_args') expect(err.message).equal('seneca: Test args foo { bar: 1 }.') - expect(err.details).equal({ arg0: 'foo', arg1: { bar: 1 }, not_an_arg: 1 }) + expect(err.details).equal({ + arg0: 'foo', + arg1: { bar: 1 }, + not_an_arg: 1, + }) expect(err.seneca).true() return fin() @@ -70,11 +74,19 @@ describe('api', function () { describe('when the condition is true', function () { it('throws', function (fin) { try { - si.fail(true, 'test_args', { arg0: 'foo', arg1: { bar: 1 }, not_an_arg: 1 }) + si.fail(true, 'test_args', { + arg0: 'foo', + arg1: { bar: 1 }, + not_an_arg: 1, + }) } catch (err) { expect(err.code).equal('test_args') expect(err.message).equal('seneca: Test args foo { bar: 1 }.') - expect(err.details).equal({ arg0: 'foo', arg1: { bar: 1 }, not_an_arg: 1 }) + expect(err.details).equal({ + arg0: 'foo', + arg1: { bar: 1 }, + not_an_arg: 1, + }) expect(err.seneca).true() return fin() @@ -87,7 +99,11 @@ describe('api', function () { describe('when the condition is false', function () { it('does not throw', function (fin) { try { - si.fail(false, 'test_args', { arg0: 'foo', arg1: { bar: 1 }, not_an_arg: 1 }) + si.fail(false, 'test_args', { + arg0: 'foo', + arg1: { bar: 1 }, + not_an_arg: 1, + }) } catch (err) { return fin(new Error('Expected the "fail" method to not throw.')) } @@ -99,7 +115,11 @@ describe('api', function () { describe('when the condition is not a boolean', function () { it('throws informing the client of the wrong type', function (fin) { try { - si.fail(0, 'test_args', { arg0: 'foo', arg1: { bar: 1 }, not_an_arg: 1 }) + si.fail(0, 'test_args', { + arg0: 'foo', + arg1: { bar: 1 }, + not_an_arg: 1, + }) } catch (err) { expect(err.code).equal('fail_cond_must_be_bool') @@ -140,7 +160,12 @@ describe('api', function () { describe('when given too many arguments', () => { it('throws a seneca error', function (fin) { try { - si.fail(true, 'test_args', { arg0: 'foo', arg1: { bar: 1 }, not_an_arg: 1 }, 2) + si.fail( + true, + 'test_args', + { arg0: 'foo', arg1: { bar: 1 }, not_an_arg: 1 }, + 2 + ) } catch (err) { expect(err.code).equal('fail_wrong_number_of_args') diff --git a/test/coverage.html b/test/coverage.html index c44b07b6..b4ebcfc4 100644 --- a/test/coverage.html +++ b/test/coverage.html @@ -552,11 +552,11 @@ lib/add.js
  • - 92.15 + 92.33 lib/api.js
  • - 87.52 + 87.69 lib/common.js
  • @@ -564,7 +564,7 @@ lib/errors.js
  • - 89.43 + 90.03 lib/inward.js
  • @@ -610,8 +610,8 @@

    Test Report

    0
    0
    -
    348
    -
    39305
    +
    353
    +
    43125
    @@ -627,6 +627,20 @@

    Test Report

    + + + + + + + + + + + + + + @@ -714,2436 +728,2471 @@

    Test Report

    act make_actmsg - 39 + 18 2 act process_outward - 213 + 128 3 actions cmd_ping - 397 + 325 4 actions cmd_stats - 109 + 92 5 actions cmd_close - 145 + 159 6 actions info_fatal - 149 + 161 7 actions get_options - 60 + 117 8 add name - 27 + 50 9 add action_modifier - 155 + 181 10 api error - 5 + 12 11 - api fail + api list - 2 + 63 12 - api list + api translate - 27 + 140 13 - api translate + api test-mode - 187 + 98 14 - api test-mode + api find_plugin - 106 + 195 15 - api find_plugin + api has_plugin - 146 + 292 16 - api has_plugin + api ignore_plugin - 265 + 448 17 - api ignore_plugin + api has - 368 + 6 18 - api has + api find - 7 + 42 19 - api find + api status - 30 + 153 20 - api status + api reply - 137 + 19 21 - api reply + api delegate - 16 + 31 - + 22 - api delegate + api fail invoked with a code and details - 21 + 3 - + 23 + api fail invoked with a condition, code and details when the condition is true throws + + + 3 + + + 24 + api fail invoked with a condition, code and details when the condition is false does not throw + + + 0 + + + 25 + api fail invoked with a condition, code and details when the condition is not a boolean throws informing the client of the wrong type + + + 3 + + + 26 + api fail when given no arguments throws a seneca error + + + 8 + + + 27 + api fail when given too many arguments throws a seneca error + + + 1 + + + 28 close happy - 137 + 128 - 24 + 29 close add - 130 + 140 - 25 + 30 close graceful - 244 + 240 - 26 + 31 close timeout - 134 + 135 - 27 + 32 close handle-signal - 127 + 133 - 28 + 33 close error - 125 + 131 - 29 + 34 close no-promise - 131 + 141 - 30 + 35 close with-promise - 126 + 150 - 31 + 36 close with-async-await - 123 + 158 - 32 + 37 common misc - 9 + 7 - 33 + 38 common deepextend-empty - 1 + 2 - 34 + 39 common deepextend-dups - 0 + 1 - 35 + 40 common deepextend-objs - 5 + 8 - 36 + 41 common deepextend-objs with functions 0 - 37 + 42 common pattern 0 - 38 + 43 common nil - 1 + 0 - 39 + 44 common recurse - 0 + 1 - 40 + 45 common pincanon - 1 + 0 - 41 + 46 common history - 5 + 7 - 42 + 47 common clean - 3 + 6 - 43 + 48 common parse_jsonic - 3 + 8 - 44 + 49 common make_plugin_key - 5 + 42 - 45 + 50 custom custom-basic - 39 + 79 - 46 + 51 custom custom-deep - 136 + 151 - 47 + 52 custom custom-reply - 136 + 141 - 48 + 53 custom custom-entity - 184 + 213 - 49 + 54 custom custom-prior - 30 + 24 - 50 + 55 custom custom-simple-transport - 175 + 191 - 51 + 56 custom custom-bells-transport - 292 + 306 - 52 + 57 custom custom-add-basic - 138 + 135 - 53 + 58 custom custom-add-fix - 25 + 32 - 54 + 59 debug logroute - 11 + 29 - 55 + 60 delegation happy - 160 + 154 - 56 + 61 delegation dynamic - 150 + 144 - 57 + 62 delegation prior.basic - 140 + 176 - 58 + 63 delegation parent.plugin - 174 + 187 - 59 + 64 entity happy - 43 + 56 - 60 + 65 entity entity-msg - 142 + 145 - 61 + 66 entity mem-ops - 204 + 238 - 62 + 67 error fail - 13 + 22 - 63 + 68 error response_is_error - 42 + 61 - 64 + 69 error action_callback - 31 + 86 - 65 + 70 error plugin_load - 29 + 56 - 66 + 71 error act_not_found - 99 + 232 - 67 + 72 error exec_action_throw_basic - 25 + 31 - 68 + 73 error exec_action_throw_basic_legacy - 59 + 113 - 69 + 74 error exec_action_throw_nolog - 21 + 146 - 70 + 75 error exec_action_errhandler_throw - 93 + 226 - 71 + 76 error exec_action_result - 55 + 80 - 72 + 77 error exec_deep_action_result - 33 + 78 - 73 + 78 error exec_remote_action_result - 183 + 339 - 74 + 79 error exec_action_result_legacy - 46 + 108 - 75 + 80 error exec_action_result_nolog - 36 + 26 - 76 + 81 error exec_action_errhandler_result - 77 + 92 - 77 + 82 error action_callback - 173 + 180 - 78 + 83 error legacy_fail 14 - 79 + 84 error types - 34 + 62 - 80 + 85 explain explain-basic - 63 + 69 - 81 + 86 explain explain-data - 94 + 65 - 82 + 87 explain explain-deep - 75 + 129 - 83 + 88 explain explain-toplevel - 134 + 148 - 84 + 89 explain explain-transport - 315 + 365 - 85 + 90 exports happy - 129 + 134 - 86 + 91 exports with-init - 121 + 136 - 87 + 92 exports with-preload - 128 + 126 - 88 + 93 exports with-preload-and-init - 126 + 127 - 89 + 94 outward act_error 1 - 90 + 95 inward announce - 129 + 125 - 91 + 96 inward arg-check - 2 + 3 - 92 + 97 legacy fail - 1 + 2 - 93 + 98 legacy argprops - 1 + 2 - 94 + 99 legacy router 1 - 95 + 100 legacy no-default-transport - 121 + 125 - 96 + 101 legacy actdef - 16 + 11 - 97 + 102 logging happy - 135 + 122 - 98 + 103 logging happy-ng - 126 + 124 - 99 + 104 logging level-text-values 18 - 100 + 105 logging build_log_spec 5 - 101 + 106 logging event - 153 + 144 - 102 + 107 logging quiet - 119 + 127 - 103 + 108 logging bad_logspec - 5 + 6 - 104 + 109 logging basic - 129 + 125 - 105 + 110 logging logger-output - 766 + 816 - 106 + 111 logging shortcuts - 1374 + 1419 - 107 + 112 logging test-mode-basic - 124 + 123 - 108 + 113 logging test-mode-option - 122 + 129 - 109 + 114 logging test-mode-argv - 127 + 131 - 110 + 115 logging test-mode-argv-opts 123 - 111 + 116 logging test-mode-env - 127 + 130 - 112 + 117 logging quiet-mode-basic 130 - 113 + 118 logging quiet-mode-option - 124 + 127 - 114 + 119 logging quiet-mode-argv - 125 + 129 - 115 + 120 logging quiet-mode-argv-opts - 129 + 126 - 116 + 121 logging quiet-mode-env - 128 + 136 - 117 + 122 logging test-quiet-mode-basic - 126 + 129 - 118 + 123 logging quiet-test-mode-basic - 127 + 128 - 119 + 124 logging test-ready-quiet-mode-basic - 242 + 247 - 120 + 125 logging quiet-ready-test-mode-basic 241 - 121 + 126 logging quiet-argv-override - 131 + 123 - 122 + 127 logging test-argv-override - 125 + 127 - 123 + 128 logging quiet-env-override - 123 + 126 - 124 + 129 logging test-env-override 127 - 125 + 130 logging intern.build_act_entry - 1 + 0 - 126 + 131 message happy-parents - 29 + 31 - 127 + 132 message complex-parents - 36 + 50 - 128 + 133 message loop - 23 + 24 - 129 + 134 message branch - 37 + 63 - 130 + 135 message empty-response - 124 + 133 - 131 + 136 message reply - 127 + 126 - 132 + 137 message prior - 123 + 132 - 133 + 138 message entity - 47 + 57 - 134 + 139 message single-simple-transport - 153 + 156 - 135 + 140 message simple-transport - 615 + 625 - 136 + 141 message partial-patterns - 135 + 130 - 137 + 142 meta custom-parents - 78 + 29 - 138 + 143 meta custom-priors - 81 + 60 - 139 + 144 meta custom-fixed - 26 + 22 - 140 + 145 options strict.find - 8 + 11 - 141 + 146 options internal.routers - 17 + 14 - 142 + 147 order happy - 255 + 270 - 143 + 148 outward make_error - 2 + 1 - 144 + 149 outward act_stats - 1 + 0 - 145 + 150 outward arg-check 1 - 146 + 151 plugin use.intern 15 - 147 + 152 plugin plugin-edges 11 - 148 + 153 plugin plugin-internal-ordu - 17 + 19 - 149 + 154 plugin standard-test-plugin - 156 + 206 - 150 + 155 plugin standard-test-plugin-full-ignore - 239 + 241 - 151 + 156 plugin plugin-ignore-via-options - 128 + 130 - 152 + 157 plugin plugin-ignore-null - 124 + 125 - 153 + 158 plugin plugin-delegate-init 127 - 154 + 159 plugin load-defaults - 127 + 128 - 155 + 160 plugin load-relative-to-root - 131 + 138 - 156 + 161 plugin good-default-options - 129 + 128 - 157 + 162 plugin bad-default-options - 31 + 51 - 158 + 163 plugin legacy-options - 21 + 26 - 159 + 164 plugin should return "no errors created." when passing test false - 432 + 435 - 160 + 165 plugin should return "error caught!" when passing test true - 376 + 464 - 161 + 166 plugin works with exportmap - 127 + 132 - 162 + 167 plugin bad - 136 + 142 - 163 + 168 plugin plugin-error-def - 23 + 27 - 164 + 169 plugin plugin-error-deprecated - 30 + 48 - 165 + 170 plugin plugin-error-add - 35 + 18 - 166 + 171 plugin plugin-error-act - 43 + 38 - 167 + 172 plugin depends - 147 + 154 - 168 + 173 plugin plugin-fix - 181 + 197 - 169 + 174 plugin export 15 - 170 + 175 plugin handles plugin with action that timesout - 244 + 259 - 171 + 176 plugin handles plugin action that throws an error - 136 + 239 - 172 + 177 plugin calling act from init actor is deprecated - 22 + 30 - 173 + 178 plugin plugin actions receive errors in callback function - 148 + 166 - 174 + 179 plugin dynamic-load-sequence - 356 + 367 - 175 + 180 plugin serial-load-sequence - 126 + 129 - 176 + 181 plugin plugin options can be modified by plugins during load sequence - 127 + 132 - 177 + 182 plugin plugin options can be modified by plugins during init sequence - 124 + 137 - 178 + 183 plugin plugin init can add actions for future init actions to call - 126 + 133 - 179 + 184 plugin plugin-init-error - 24 + 25 - 180 + 185 plugin plugin-extend-action-modifier - 151 + 166 - 181 + 186 plugin plugin-extend-logger - 128 + 127 - 182 + 187 plugin plugins-from-options - 130 + 134 - 183 + 188 plugin plugins-from-bad-options - 22 + 25 - 184 + 189 plugin plugins-options-precedence - 131 + 144 - 185 + 190 plugin error-plugin-define - 17 + 19 - 186 + 191 plugin error-plugin-init - 28 + 31 - 187 + 192 plugin error-plugin-action - 42 + 37 - 188 + 193 plugin no-name - 172 + 142 - 189 + 194 plugin seneca-prefix-wins - 129 + 136 - 190 + 195 plugin plugin-defaults-top-level-joi - 129 + 137 - 191 + 196 plugin plugin-order-task-args 13 - 192 + 197 plugin plugin-defaults-function - 130 + 126 - 193 + 198 print init - 11 + 12 - 194 + 199 print options - 14 + 13 - 195 + 200 print print - 12 + 9 - 196 + 201 print custom-print - 37 + 39 - 197 + 202 prior happy - 51 + 45 - 198 + 203 prior top-level 11 - 199 + 204 prior add-general-to-specific - 35 + 50 - 200 + 205 prior add-strict-general-to-specific 26 - 201 + 206 prior add-specific-to-general - 28 + 40 - 202 + 207 prior add-strict-specific-to-general - 31 + 32 - 203 + 208 prior add-general-to-specific-alpha - 33 + 45 - 204 + 209 prior add-general-to-specific-reverse-alpha - 27 + 29 - 205 + 210 prior add-strict-default - 35 + 38 - 206 + 211 prior add-strict-true - 20 + 55 - 207 + 212 private exit_close - 381 + 397 - 208 + 213 ready ready_die - 120 + 125 - 209 + 214 ready ready_die_no_errhandler 124 - 210 + 215 ready ready_null_name - 122 + 124 - 211 + 216 ready ready-complex - 269 + 268 - 212 + 217 ready ready-always-called - 238 + 235 - 213 + 218 ready ready-error-test - 124 + 132 - 214 + 219 ready ready-event - 37 + 22 - 215 + 220 ready ready-both - 129 + 131 - 216 + 221 seneca --seneca.log arguments tests: --seneca.log=level:warn - 26 + 12 - 217 + 222 seneca --seneca.log arguments tests: --seneca.log=level:warn+ - 58 + 14 - 218 + 223 seneca --seneca.log arguments tests: --seneca.log.level.warn - 21 + 39 - 219 + 224 seneca --seneca.log arguments tests: --seneca.log.level.warn+ - 21 + 24 - 220 + 225 seneca --seneca.log arguments tests: duplicate param --seneca.log - 31 + 40 - 221 + 226 seneca --seneca.log arguments tests: incorrect arg --seneca.log=level: - 34 + 26 - 222 + 227 seneca --seneca.log arguments tests: incorrect arg --seneca.log.level.abc - 34 + 66 - 223 + 228 seneca --seneca.log arguments tests: incorrect arg --seneca.log.abc - 22 + 14 - 224 + 229 seneca --seneca.log aliases tests: --seneca.log.quiet - 52 + 49 - 225 + 230 seneca --seneca.log aliases tests: --seneca.log.silent - 68 + 23 - 226 + 231 seneca --seneca.log aliases tests: --seneca.log.all - 18 + 45 - 227 + 232 seneca --seneca.log aliases tests: --seneca.log.any - 19 + 28 - 228 + 233 seneca --seneca.log aliases tests: --seneca.log.print - 36 + 43 - 229 + 234 seneca --seneca.log aliases tests: --seneca.log.test - 17 + 25 - 230 + 235 seneca --seneca.log aliases tests: --seneca.log.standard - 23 + 38 - 231 + 236 seneca --seneca.log aliases tests: --seneca.log.level.quiet - 19 + 21 - 232 + 237 seneca --seneca.log aliases tests: --seneca.log.level.silent - 33 + 77 - 233 + 238 seneca --seneca.log aliases tests: --seneca.log.level.all - 20 + 32 - 234 + 239 seneca --seneca.log aliases tests: --seneca.log.level.any - 19 + 35 - 235 + 240 seneca --seneca.log aliases tests: --seneca.log.level.print - 28 + 26 - 236 + 241 seneca --seneca.log aliases tests: --seneca.log.level.test - 22 + 36 - 237 + 242 seneca --seneca.log aliases tests: --seneca.log.level.standard - 17 + 18 - 238 + 243 seneca happy - 38 + 83 - 239 + 244 seneca require-abbrev - 252 + 260 - 240 + 245 seneca version - 10 + 15 - 241 + 246 seneca tag - 11 + 12 - 242 + 247 seneca json-inspect - 21 + 31 - 243 + 248 seneca quick - 75 + 78 - 244 + 249 seneca happy-error - 31 + 24 - 245 + 250 seneca errhandler - 113 + 116 - 246 + 251 seneca action-basic 21 - 247 + 252 seneca action-callback-instance - 27 + 36 - 248 + 253 seneca action-act-invalid-args - 21 + 26 - 249 + 254 seneca action-default - 19 + 32 - 250 + 255 seneca action-override - 138 + 139 - 251 + 256 seneca action-callback-args - 23 + 24 - 252 + 257 seneca action-extend - 129 + 184 - 253 + 258 seneca prior-nocache - 348 + 360 - 254 + 259 seneca gating 126 - 255 + 260 seneca act_if - 42 + 76 - 256 + 261 seneca loading-plugins - 157 + 180 - 257 + 262 seneca fire-and-forget - 14 + 10 - 258 + 263 seneca strargs - 124 + 85 - 259 + 264 seneca string-add - 25 + 76 - 260 + 265 seneca fix-basic - 15 + 13 - 261 + 266 seneca act-history - 82 + 100 - 262 + 267 seneca wrap - 61 + 111 - 263 + 268 seneca meta - 32 + 29 - 264 + 269 seneca strict-result - 18 + 29 - 265 + 270 seneca add-noop - 28 + 34 - 266 + 271 seneca supports jsonic params to has - 11 + 15 - 267 + 272 seneca supports a function to trace actions - 47 + 57 - 268 + 273 seneca supports true to be passed as trace action option - 23 + 59 - 269 + 274 seneca strict-find-false - 29 + 30 - 270 + 275 seneca strict-find-true - 24 + 42 - 271 + 276 seneca strict-find-default - 24 + 38 - 272 + 277 seneca catchall-pattern - 129 + 143 - 273 + 278 seneca memory - 473 + 651 - 274 + 279 seneca use-shortcut - 24 + 33 - 275 + 280 seneca status-log - 21 + 166 - 276 + 281 seneca reply-seneca - 123 + 146 - 277 + 282 seneca pattern-types - 129 + 132 - 278 + 283 seneca order - 9 + 21 - 279 + 284 seneca #decorate can add a property to seneca - 10 + 24 - 280 + 285 seneca #decorate cannot override core property - 24 + 57 - 281 + 286 seneca #decorate cannot overwrite a decorated property - 25 + 24 - 282 + 287 seneca #decorate cannot prefix a property with an underscore - 55 + 30 - 283 + 288 seneca #intercept intercept - 113 + 69 - 284 + 289 sequence single-add-act - 20 + 26 - 285 + 290 sequence double-add-act - 25 + 55 - 286 + 291 sequence single-add-act-ready - 131 + 130 - 287 + 292 sequence single-add-act-gate-action 22 - 288 + 293 sequence single-add-act-gate-instance - 30 + 58 - 289 + 294 smoke seneca-smoke - 30 + 27 - 290 + 295 options options-happy - 123 + 164 - 291 + 296 options options-getset - 126 + 128 - 292 + 297 options options-legacy - 123 + 127 - 293 + 298 options options-file-js - 127 + 124 - 294 + 299 options legacy-options-file-js - 122 + 134 - 295 + 300 options options-file-json - 128 + 134 - 296 + 301 options options-file-json-nomore - 123 + 122 - 297 + 302 options options-env - 128 + 126 - 298 + 303 options options-cmdline - 124 + 129 - 299 + 304 sub happy-sub - 31 + 44 - 300 + 305 sub inwards-outwards-sub - 48 + 66 - 301 + 306 sub specific-sub - 23 + 51 - 302 + 307 sub error-sub - 30 + 29 - 303 + 308 sub mixed-sub - 39 + 79 - 304 + 309 sub sub-prior - 126 + 157 - 305 + 310 sub sub-close - 127 + 128 - 306 + 311 sub sub-fix - 25 + 29 - 307 + 312 sub sub-once - 127 + 133 - 308 + 313 timeout happy - 124 + 126 - 309 + 314 timeout error-handler - 134 + 127 - 310 + 315 timeout should accept a timeout value from options - 238 + 251 - 311 + 316 transport happy-nextgen - 409 + 431 - 312 + 317 transport config-legacy-nextgen - 488 + 491 - 313 + 318 transport error-nextgen - 385 + 380 - 314 + 319 transport interop-nextgen - 287 + 321 - 315 + 320 transport config-nextgen - 520 + 567 - 316 + 321 transport nextgen-transport-local-override - 382 + 391 - 317 + 322 transport nextgen-meta - 383 + 406 - 318 + 323 transport nextgen-ordering - 507 + 494 - 319 + 324 transport transport-exact-single - 177 + 185 - 320 + 325 transport transport-local-override - 158 + 170 - 321 + 326 transport transport-star - 282 + 304 - 322 + 327 transport transport-star-pin-object - 283 + 294 - 323 + 328 transport transport-single-notdef - 163 + 221 - 324 + 329 transport transport-pins-notdef - 184 + 192 - 325 + 330 transport transport-single-wrap-and-star - 309 + 318 - 326 + 331 transport transport-local-single-and-star - 288 + 300 - 327 + 332 transport transport-local-over-wrap - 257 + 251 - 328 + 333 transport transport-local-prior-wrap - 177 + 188 - 329 + 334 transport transport-init-ordering - 246 + 245 - 330 + 335 transport transport-no-plugin-init - 289 + 286 - 331 + 336 transport transport-balance-exact - 924 + 948 - 332 + 337 transport multi-layer-error - 743 + 751 - 333 + 338 transport server can be restarted without issues to clients - 626 + 683 - 334 + 339 transport transport-listen supports-null-options - 127 + 133 - 335 + 340 transport transport-listen supports type as tcp option - 131 + 139 - 336 + 341 transport transport-listen supports type as http option - 124 + 146 - 337 + 342 transport transport-listen supports the port number as an argument - 128 + 134 - 338 + 343 transport transport-listen supports the port number and host as an argument - 129 + 138 - 339 + 344 transport transport-listen supports the port number, host, and path as an argument - 126 + 147 - 340 + 345 transport transport-listen action-error - 126 + 133 - 341 + 346 transport client() supports null options - 126 + 147 - 342 + 347 util seneca.util.deepextend.happy - 1 + 2 - 343 + 348 util seneca.util.deepextend.types with new - 3 + 5 - 344 + 349 util seneca.util.deepextend.types 6 - 345 + 350 util seneca.util.deepextend.mixed - 2 + 4 - 346 + 351 util seneca.util.deepextend.entity 1 - 347 + 352 xward happy-inward - 19 + 44 - 348 + 353 xward happy-outward - 44 + 182 @@ -3151,10 +3200,10 @@

    Test Report

    Code Coverage Report

    -
    91.22%
    -
    4817
    -
    4394
    -
    423
    +
    91.32%
    +
    4836
    +
    4416
    +
    420
    @@ -7731,7 +7780,7 @@

    seneca.js

    759 - 10387 + 10388 return void 0 @@ -7849,13 +7898,13 @@

    lib/act.js

    12 - 2833 + 2830 for (var l = 0; l < argsarr.length; ++l) { 13 - 6270 + 6264 argsarr[l] = arguments[l] @@ -7873,31 +7922,31 @@

    lib/act.js

    16 - 2833 + 2830 var self = this 17 - 2833 + 2830 var opts = self.options() 18 - 2833 + 2830 var spec = Common.build_message(self, argsarr, 'reply:f?', self.fixedargs) 19 - 2832 + 2829 var msg = spec.msg 20 - 2832 + 2829 var reply = spec.reply @@ -7969,13 +8018,13 @@

    lib/act.js

    32 - 2832 + 2829 intern.do_act(self, opts, msg, reply) 33 - 2832 + 2829 return self @@ -8017,13 +8066,13 @@

    lib/act.js

    40 - 2832 + 2829 var actmsg = intern.make_actmsg(origmsg) 41 - 2832 + 2829 var meta = new intern.Meta(instance, opts, origmsg, origreply) @@ -8035,7 +8084,7 @@

    lib/act.js

    43 - 2832 + 2829 if (meta.gate) { @@ -8065,7 +8114,7 @@

    lib/act.js

    48 - 2832 + 2829 var actctxt = { @@ -8113,7 +8162,7 @@

    lib/act.js

    56 - 2832 + 2829 var execspec = {} @@ -8125,7 +8174,7 @@

    lib/act.js

    58 - 2832 + 2829 execspec.dn = meta.id @@ -8137,7 +8186,7 @@

    lib/act.js

    60 - 2832 + 2829 execspec.fn = function act_fn(done) { @@ -8149,7 +8198,7 @@

    lib/act.js

    62 - 2832 + 2829 intern.execute_action( @@ -8203,7 +8252,7 @@

    lib/act.js

    71 - 2804 + 2801 intern.handle_reply(meta, actctxt, actmsg, err, out, reply_meta) @@ -8215,7 +8264,7 @@

    lib/act.js

    73 - 2806 + 2803 done() @@ -8275,7 +8324,7 @@

    lib/act.js

    83 - 2832 + 2829 execspec.ontm = function act_tm(timeout, start, end) { @@ -8293,7 +8342,7 @@

    lib/act.js

    86 - 5 + 9 var timeout_err = Common.error('action_timeout', { @@ -8359,7 +8408,7 @@

    lib/act.js

    97 - 5 + 9 intern.handle_reply(meta, actctxt, actmsg, timeout_err) @@ -8377,7 +8426,7 @@

    lib/act.js

    100 - 2832 + 2829 execspec.tm = meta.timeout @@ -8389,7 +8438,7 @@

    lib/act.js

    102 - 2832 + 2829 instance.private$.ge.add(execspec) @@ -8425,7 +8474,7 @@

    lib/act.js

    108 - 2833 + 2830 if (actmsg.id$) { @@ -8449,7 +8498,7 @@

    lib/act.js

    112 - 2833 + 2830 if (actmsg.caller$) { @@ -8473,7 +8522,7 @@

    lib/act.js

    116 - 2833 + 2830 if (actmsg.meta$) { @@ -8497,13 +8546,13 @@

    lib/act.js

    120 - 2833 + 2830 if (actmsg.prior$) { 121 - 103 + 100 delete actmsg.prior$ @@ -8521,7 +8570,7 @@

    lib/act.js

    124 - 2833 + 2830 if (actmsg.parents$) { @@ -8551,7 +8600,7 @@

    lib/act.js

    129 - 2833 + 2830 if (origmsg.transport$) { @@ -8575,7 +8624,7 @@

    lib/act.js

    133 - 2833 + 2830 return actmsg @@ -8611,7 +8660,7 @@

    lib/act.js

    139 - 2832 + 2829 var origmeta = origmsg.meta$ @@ -8629,7 +8678,7 @@

    lib/act.js

    142 - 2832 + 2829 var fixedmeta = instance.fixedmeta || {} @@ -8641,25 +8690,25 @@

    lib/act.js

    144 - 2832 + 2829 this.start = Date.now() 145 - 2832 + 2829 this.end = null 146 - 2832 + 2829 this.pattern = null 147 - 2832 + 2829 this.action = null @@ -8671,19 +8720,19 @@

    lib/act.js

    149 - 2832 + 2829 this.mi = id_tx[0] 150 - 2832 + 2829 this.tx = id_tx[1] 151 - 2832 + 2829 this.id = id_tx[0] + '/' + id_tx[1] @@ -8695,25 +8744,25 @@

    lib/act.js

    153 - 2832 + 2829 this.instance = instance.id 154 - 2832 + 2829 this.tag = instance.tag 155 - 2832 + 2829 this.seneca = instance.version 156 - 2832 + 2829 this.version = '0.1.0' @@ -8725,19 +8774,19 @@

    lib/act.js

    158 - 2832 + 2829 this.gate = !!origmsg.gate$ || fixedmeta.gate 159 - 2832 + 2829 this.fatal = !!origmsg.fatal$ || fixedmeta.fatal 160 - 2832 + 2829 this.local = !!origmsg.local$ || fixedmeta.local @@ -8761,7 +8810,7 @@

    lib/act.js

    164 - 2832 + 2829 this.timeout = Math.max( @@ -8833,25 +8882,25 @@

    lib/act.js

    176 - 2832 + 2829 this.plugin = origmsg.plugin$ 177 - 2832 + 2829 this.prior = origmsg.prior$ 178 - 2832 + 2829 this.caller = origmsg.caller$ 179 - 2832 + 2829 this.parents = origmsg.parents$ @@ -8875,7 +8924,7 @@

    lib/act.js

    183 - 2832 + 2829 this.remote = !!origmsg.remote$ @@ -8887,7 +8936,7 @@

    lib/act.js

    185 - 2832 + 2829 this.sync = @@ -8929,43 +8978,43 @@

    lib/act.js

    192 - 2832 + 2829 this.trace = null 193 - 2832 + 2829 this.sub = null 194 - 2832 + 2829 this.data = null 195 - 2832 + 2829 this.err = null 196 - 2832 + 2829 this.err_trace = null 197 - 2832 + 2829 this.error = null 198 - 2832 + 2829 this.empty = null @@ -9013,7 +9062,7 @@

    lib/act.js

    206 - 2832 + 2829 id_tx[1] = @@ -9061,7 +9110,7 @@

    lib/act.js

    214 - 2832 + 2829 return id_tx @@ -9097,13 +9146,13 @@

    lib/act.js

    220 - 2824 + 2825 var delegate = actctxt.seneca 221 - 2824 + 2825 var reply = actctxt.reply @@ -9115,7 +9164,7 @@

    lib/act.js

    223 - 2824 + 2825 var data = { @@ -9175,25 +9224,25 @@

    lib/act.js

    233 - 2824 + 2825 actctxt.duration = meta.end - meta.start 234 - 2824 + 2825 actctxt.actlog = intern.actlog 235 - 2824 + 2825 actctxt.errlog = intern.errlog 236 - 2824 + 2825 actctxt.error = Common.error @@ -9205,7 +9254,7 @@

    lib/act.js

    238 - 2824 + 2825 meta.error = Util.isError(data.res) @@ -9223,13 +9272,13 @@

    lib/act.js

    241 - 2824 + 2825 if (!meta.error && data.res === data.err) { 242 - 312 + 310 data.err = null @@ -9253,7 +9302,7 @@

    lib/act.js

    246 - 2824 + 2825 if ( @@ -9319,7 +9368,7 @@

    lib/act.js

    257 - 2824 + 2825 intern.process_outward(actctxt, data, delegate) @@ -9331,19 +9380,19 @@

    lib/act.js

    259 - 2824 + 2825 if (data.has_callback) { 260 - 2819 + 2820 try { 261 - 2819 + 2820 reply.call(delegate, data.err, data.res, data.meta) @@ -9421,7 +9470,7 @@

    lib/act.js

    274 - 2829 + 2830 if (outward) { @@ -9661,7 +9710,7 @@

    lib/act.js

    314 - 2832 + 2829 var actdef = meta.prior @@ -9679,7 +9728,7 @@

    lib/act.js

    317 - 2832 + 2829 var delegate = intern.make_act_delegate(act_instance, opts, meta, actdef) @@ -9691,19 +9740,19 @@

    lib/act.js

    319 - 2832 + 2829 actctxt.seneca = delegate 320 - 2832 + 2829 actctxt.actdef = actdef 321 - 2832 + 2829 execspec.ctxt.pattern = actdef ? actdef.pattern : null @@ -9721,13 +9770,13 @@

    lib/act.js

    324 - 2832 + 2829 var data = { meta: meta, msg: msg, reply: reply } 325 - 2832 + 2829 var inward = private$.inward.process(actctxt, data) @@ -9739,7 +9788,7 @@

    lib/act.js

    327 - 2832 + 2829 if ( @@ -9793,7 +9842,7 @@

    lib/act.js

    336 - 441 + 442 return @@ -9817,7 +9866,7 @@

    lib/act.js

    340 - 2391 + 2387 delegate.log.debug( @@ -9871,19 +9920,19 @@

    lib/act.js

    349 - 2391 + 2387 data.id = data.meta.id 350 - 2391 + 2387 data.result = [] 351 - 2391 + 2387 data.timelimit = Date.now() + data.meta.timeout @@ -9901,7 +9950,7 @@

    lib/act.js

    354 - 2391 + 2387 private$.history.add(data) @@ -9943,7 +9992,7 @@

    lib/act.js

    361 - 2391 + 2387 actdef.func.call(delegate, data.msg, data.reply, data.meta) @@ -9973,7 +10022,7 @@

    lib/act.js

    366 - 2832 + 2829 actdef = actdef || {} @@ -9985,7 +10034,7 @@

    lib/act.js

    368 - 2832 + 2829 var delegate_args = { @@ -10033,7 +10082,7 @@

    lib/act.js

    376 - 2832 + 2829 var delegate = instance.delegate(delegate_args) @@ -10045,7 +10094,7 @@

    lib/act.js

    378 - 2832 + 2829 var parent_act = instance.private$.act || meta.parent @@ -10057,7 +10106,7 @@

    lib/act.js

    380 - 2832 + 2829 delegate.private$.act = { @@ -10105,7 +10154,7 @@

    lib/act.js

    388 - 2832 + 2829 delegate.fixedargs.tx$ = meta.tx @@ -10123,7 +10172,7 @@

    lib/act.js

    391 - 2832 + 2829 return delegate @@ -10147,7 +10196,7 @@

    lib/act.js

    395 - 2391 + 2387 if (!inward) return false @@ -10159,19 +10208,19 @@

    lib/act.js

    397 - 441 + 442 var msg = data.msg 398 - 441 + 442 var reply = data.reply 399 - 441 + 442 var meta = data.meta @@ -10183,7 +10232,7 @@

    lib/act.js

    401 - 441 + 442 if ('error' === inward.kind) { @@ -10399,7 +10448,7 @@

    lib/act.js

    437 - 424 + 425 act_instance.log[inward.log.level]( @@ -10429,13 +10478,13 @@

    lib/act.js

    442 - 424 + 425 reply.call(act_instance, null, inward.result) 443 - 424 + 425 return true @@ -11027,13 +11076,13 @@

    lib/actions.js

    40 - 75 + 74 this.emit('close') 41 - 75 + 74 reply() @@ -12372,9 +12421,9 @@

    lib/add.js

    lib/api.js

    -
    92.15%
    -
    650
    -
    599
    +
    92.33%
    +
    665
    +
    614
    51
    @@ -12733,7 +12782,7 @@

    lib/api.js

    - + @@ -12745,13 +12794,13 @@

    lib/api.js

    - + - + @@ -13267,7 +13316,7 @@

    lib/api.js

    - + @@ -13291,7 +13340,7 @@

    lib/api.js

    - + @@ -13309,7 +13358,7 @@

    lib/api.js

    - + @@ -13339,13 +13388,13 @@

    lib/api.js

    - + - + @@ -13363,7 +13412,7 @@

    lib/api.js

    - + @@ -13381,7 +13430,7 @@

    lib/api.js

    - + @@ -13412,43 +13461,43 @@

    lib/api.js

    - + - + - - + + - + - + - + - + - - + + - - + + @@ -13460,115 +13509,115 @@

    lib/api.js

    - + - - + + - - + + - + - - + + - + - - + + - + - - + + - + - + - - + + - - + + - + - + - + - + - - + + - + - - + + - - + + @@ -13580,121 +13629,121 @@

    lib/api.js

    - + - + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - + - + - + - - + + - - + + - - + + - - + + - + @@ -13706,49 +13755,49 @@

    lib/api.js

    - + - - + + - + - - + + - - + + - + - - + + - - + + @@ -13759,62 +13808,62 @@

    lib/api.js

    - - + + - - + + - - + + - + - + - - + + - + - + - - + + - - + + - - + + - + @@ -13825,146 +13874,146 @@

    lib/api.js

    - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - + - - + + - - + + - + - - + + - + - - + + - + - + - - + + @@ -13972,143 +14021,143 @@

    lib/api.js

    - + - + - + - - + + - - + + - - + + - + - - + + - - + + - - + + - + - - + + - + - + - - + + - - + + - + - - + + - + - + - + - + - + - + - + - + - + - + - + @@ -14119,170 +14168,170 @@

    lib/api.js

    - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - + - + - + - + - - + + - + - - + + - + - + - - + + - - + + - - + + - - + + - - + + @@ -14293,110 +14342,110 @@

    lib/api.js

    - - + + - + - - + + - - + + - - + + - - + + - + - + - + - + - - + + - + - - + + - + - + - + - - + + - - + + - + - - + + @@ -14414,133 +14463,133 @@

    lib/api.js

    - + - + - - + + - - + + - - + + - + - + - + - + - + - + - + - - + + - - + + - + - + - + - + - - + + - - + + - + - - + + - + - - + + - - + + - + @@ -14551,488 +14600,488 @@

    lib/api.js

    - - + + - + - + - - + + - - + + - + - + - - + + - + - + - - + + - + - - + + - - + + - + - - + + - + - + - - + + - - + + - + - + - - + + - + - + - - + + - - + + - - + + - + - + - - + + - - + + - - + + - - + + - - + + - + - + - + - - + + - - + + - - + + - + - - + + - + - + - + - - + + - + - - + + - + - + - - + + - - + + - + - - + + - + - + - + - - + + - - + + - + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - + - - + + - - + + - + - - + + - + - - + + - + - + - + - + - - + + - - + + - - + + - - + + @@ -15044,259 +15093,259 @@

    lib/api.js

    - + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - + - - + + - + - + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - + - - + + - + - + - + - - + + - + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + @@ -15314,169 +15363,169 @@

    lib/api.js

    - + - + - - + + - - + + - + - - + + - - + + - + - + - - + + - - + + - + - - + + - + - + - - + + - - + + - - + + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + @@ -15487,38 +15536,38 @@

    lib/api.js

    - - + + - - + + - + - + - - + + - + @@ -15529,62 +15578,62 @@

    lib/api.js

    - - + + - - + + - + - + - - + + - + - - + + - - + + - - + + - - + + @@ -15595,356 +15644,356 @@

    lib/api.js

    - - + + - + - - + + - - + + - + - + - - + + - + - + - - + + - - + + - + - - + + - - + + - + - - + + - + - + - + - + - + - - + + - + - + - + - + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - + - - + + - + - + - + - - + + - + - + - - + + - + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - + - + - - + + - + @@ -15952,119 +16001,119 @@

    lib/api.js

    - + - + - - + + - + - - + + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - - + + - - + + - - + + - + - + - - + + - + - + @@ -16072,197 +16121,197 @@

    lib/api.js

    - + - + - - + + - + - - + + - - + + - - + + - + - + - - + + - + - + - + - + - - + + - - + + - + - + - + - + - + - - + + - - + + - + - + - - + + - - + + - - + + - + - + - - + + - - + + - - + + - + - + - + - - + + - + @@ -16276,245 +16325,245 @@

    lib/api.js

    - + - + - + - + - + - - + + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - + - + - + - - + + - - + + - + - - + + - + - - + + - + - + - + - + - - + + - + - + - + - - + + - - + + - + - + - + - + - + - + - + - + - - + + - + - + - - + + - + - - + + @@ -16526,103 +16575,103 @@

    lib/api.js

    - + - + - + - + - - + + - - + + - + - + - - + + - - + + - - + + - + - + - + - + - + - + - + - + - + - - + + - + - + - + @@ -16634,19 +16683,19 @@

    lib/api.js

    - + - - + + - - + + @@ -16657,248 +16706,248 @@

    lib/api.js

    - - + + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - - + + - + - - + + - + - - + + - + - - + + - + - + - + - + - - + + - + - + - + - - + + - + - - + + - + - - + + - + - + - + - - + + - - + + - + - + @@ -16909,176 +16958,176 @@

    lib/api.js

    - - + + - + - + - - + + - + - + - - + + - + - - + + - - + + - - + + - - + + - - + + - + - + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + @@ -17089,44 +17138,44 @@

    lib/api.js

    - - + + - + - - + + - + - - + + - - + + - + - + - - + + @@ -17137,86 +17186,86 @@

    lib/api.js

    - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + @@ -17228,526 +17277,646 @@

    lib/api.js

    - + - + - + - + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + @@ -17758,10 +17927,10 @@

    lib/api.js

    lib/common.js

    -
    87.52%
    +
    87.69%
    585
    -
    512
    -
    73
    +
    513
    +
    72
    58 2215522159 var private$ = self.private$
    60 2215522159 if (null == options) {
    61 2088020884 return private$.optioner.get()
    147 1617 if (null == first) {
    151 1415 var plugin_fullname =
    154 1415 var plugin =
    159 1415 var error = null
    160 1415 if (plugin && plugin.eraro && plugin.eraro.has(first)) {
    163 1112 error = Common.eraro.apply(this, arguments)
    166 1415 return error
    171 1exports.fail = function (code, args) {exports.fail = function (...args) {
    172 var error = this.error(code, args) if (args.length === 2) {
    173 5 return failIf(this, true, ...args)
    174
    if (
    args
    &&
    false === args.throw$
    ) {
    }
    175 return error
    176 } else {5 if (args.length === 3) {
    177 5 throw error3 return failIf(this, ...args)
    178 179 }
    180 2 throw this.util.error('fail_wrong_number_of_args', { num_args: args.length })
    181 1exports.inward = function () {
    182 // TODO: norma should support f/x where x = # args function failIf(self, cond, code, args) {
    183 var args = Norma('inward:f', arguments)8 if (typeof cond !== 'boolean') {
    184 1 this.private$.inward.add(args.inward) throw self.util.error('fail_cond_must_be_bool')
    185 1 return this }
    186 }
    187 7 if (!cond) {
    188 1exports.outward = function () { return
    189 var args = Norma('outward:f', arguments) }
    190 1 this.private$.outward.add(args.outward)
    191 1 return this6 const error = self.error(code, args)
    192 }
    193
    if (
    args
    &&
    false === args.throw$
    ) {
    194 1exports.prior = function () { return error
    195 if (null == this.private$.act) { } else {
    196 // TODO: should be a top level api method: seneca.fail6 throw error
    197 1 throw this.util.error('no_prior_action', { args: arguments }) }
    198 199 }
    200 // Get definition of prior action
    201 128 var priordef = this.private$.act.def.priordef1exports.inward = function () {
    202 // TODO: norma should support f/x where x = # args
    203 128 var spec = Common.build_message(this, arguments, 'reply:f?', this.fixedargs) var args = Norma('inward:f', arguments)
    204 1 this.private$.inward.add(args.inward)
    205 // TODO: clean sufficiently so that seneca.util.clean not needed1 return this
    206 128 var msg = spec.msg}
    207 128 var reply = spec.reply
    208 1exports.outward = function () {
    209 128 if (priordef) { var args = Norma('outward:f', arguments)
    210 103 msg.prior$ = priordef.id1 this.private$.outward.add(args.outward)
    211 103 this.act(msg, reply)1 return this
    212 } else {}
    213
    var meta =
    msg.meta$
    || {}
    214
    var out = msg.default$ ||
    meta.dflt
    || null
    1exports.prior = function () {
    215 25 out = null == out ? out : Object.assign({}, out) if (null == this.private$.act) {
    216 25 return reply.call(this, null, out, meta) // TODO: should be a top level api method: seneca.fail
    217 }1 throw this.util.error('no_prior_action', { args: arguments })
    218 } }
    219 220 // TODO: rename fixedargs // Get definition of prior action
    221 1exports.delegate = function (fixedargs, fixedmeta) {125 var priordef = this.private$.act.def.priordef
    222 var self = this
    223 3616 var root = this.root125 var spec = Common.build_message(this, arguments, 'reply:f?', this.fixedargs)
    224 3616 var opts = this.options()
    225 // TODO: clean sufficiently so that seneca.util.clean not needed
    226 3616 fixedargs = fixedargs || {}125 var msg = spec.msg
    227 3616 fixedmeta = fixedmeta || {}125 var reply = spec.reply
    228
    229 3616 var delegate = Object.create(self)125 if (priordef) {
    230 100 msg.prior$ = priordef.id
    231 3616 delegate.private$ = Object.create(self.private$)100 this.act(msg, reply)
    232 } else {
    233 3616 delegate.did =
    var meta =
    msg.meta$
    || {}
    234 (delegate.did ? delegate.did + '/' : '') + self.private$.didnid()
    var out = msg.default$ ||
    meta.dflt
    || null
    235 25 out = null == out ? out : Object.assign({}, out)
    236 function delegate_log() {25 return reply.call(this, null, out, meta)
    237 11975 return root.log.apply(delegate, arguments) }
    238 }}
    239
    240 3616 Object.assign(delegate_log, root.log)// TODO: rename fixedargs
    241 3616 delegate_log.self = () => delegate1exports.delegate = function (fixedargs, fixedmeta) {
    242 var self = this
    243 3616 var strdesc3613 var root = this.root
    244 3613 var opts = this.options()
    245 function delegate_toString() {
    246 94 if (strdesc) return strdesc3613 fixedargs = fixedargs || {}
    247 78 var vfa = {}3613 fixedmeta = fixedmeta || {}
    248 78 Object.keys(fixedargs).forEach((k) => {
    249 var v = fixedargs[k]3613 var delegate = Object.create(self)
    250 193 if (~k.indexOf('$')) return
    251 1 vfa[k] = v3613 delegate.private$ = Object.create(self.private$)
    252 })
    253 3613 delegate.did =
    254 78 strdesc = (delegate.did ? delegate.did + '/' : '') + self.private$.didnid()
    255 self.toString() +
    256 (Object.keys(vfa).length ? '/' + Jsonic.stringify(vfa) : '') function delegate_log() {
    257 11981 return root.log.apply(delegate, arguments)
    258 78 return strdesc }
    259 }
    260 3613 Object.assign(delegate_log, root.log)
    261
    var delegate_fixedargs =
    opts.strict.fixedargs
    3613 delegate_log.self = () => delegate
    262 ? Object.assign({}, fixedargs, self.fixedargs)
    263
    :
    Object.assign({}, self.fixedargs, fixedargs)
    3613 var strdesc
    264
    265
    var delegate_fixedmeta =
    opts.strict.fixedmeta
    function delegate_toString() {
    266
    ?
    Object.assign({}, fixedmeta, self.fixedmeta)
    98 if (strdesc) return strdesc
    267 : Object.assign({}, self.fixedmeta, fixedmeta)82 var vfa = {}
    268 82 Object.keys(fixedargs).forEach((k) => {
    269 function delegate_delegate(further_fixedargs, further_fixedmeta) { var v = fixedargs[k]
    270 2133 var args = Object.assign({}, delegate.fixedargs, further_fixedargs || {})209 if (~k.indexOf('$')) return
    271 2133 var meta = Object.assign({}, delegate.fixedmeta, further_fixedmeta || {})1 vfa[k] = v
    272 2133 return self.delegate.call(this, args, meta) })
    273 }
    274 82 strdesc =
    275 // Somewhere to put contextual data for this delegate. self.toString() +
    276 // For example, data for individual web requests. (Object.keys(vfa).length ? '/' + Jsonic.stringify(vfa) : '')
    277 3616 var delegate_context = Object.assign({}, self.context)
    278 82 return strdesc
    279 // Prevents incorrect prototype properties in mocha test contexts }
    280 3616 Object.defineProperties(delegate, {
    281 log: { value: delegate_log, writable: true },
    var delegate_fixedargs =
    opts.strict.fixedargs
    282 toString: { value: delegate_toString, writable: true }, ? Object.assign({}, fixedargs, self.fixedargs)
    283 fixedargs: { value: delegate_fixedargs, writable: true },
    :
    Object.assign({}, self.fixedargs, fixedargs)
    284 fixedmeta: { value: delegate_fixedmeta, writable: true },
    285 delegate: { value: delegate_delegate, writable: true },
    var delegate_fixedmeta =
    opts.strict.fixedmeta
    286 context: { value: delegate_context, writable: true },
    ?
    Object.assign({}, fixedmeta, self.fixedmeta)
    287 }) : Object.assign({}, self.fixedmeta, fixedmeta)
    288
    289 3616 return delegate function delegate_delegate(further_fixedargs, further_fixedmeta) {
    290 }2121 var args = Object.assign({}, delegate.fixedargs, further_fixedargs || {})
    291 2121 var meta = Object.assign({}, delegate.fixedmeta, further_fixedmeta || {})
    292 1exports.depends = function () {2121 return self.delegate.call(this, args, meta)
    293 var self = this }
    294 7 var private$ = this.private$
    295 7 var error = this.util.error // Somewhere to put contextual data for this delegate.
    296 7 var args = Norma('{pluginname:s deps:a? moredeps:s*}', arguments) // For example, data for individual web requests.
    297 3613 var delegate_context = Object.assign({}, self.context)
    298 7 var deps = args.deps || args.moredeps || []
    299 // Prevents incorrect prototype properties in mocha test contexts
    300 7 for (var i = 0; i < deps.length; i++) {3613 Object.defineProperties(delegate, {
    301 9 var depname = deps[i] log: { value: delegate_log, writable: true },
    302 toString: { value: delegate_toString, writable: true },
    303 9 if ( fixedargs: { value: delegate_fixedargs, writable: true },
    304 !private$.plugin_order.byname.includes(depname) && fixedmeta: { value: delegate_fixedmeta, writable: true },
    305
    !private$.plugin_order.byname.includes('seneca-' + depname)
    delegate: { value: delegate_delegate, writable: true },
    306 ) { context: { value: delegate_context, writable: true },
    307 2 self.die( })
    308 error('plugin_required', {
    309 name: args.pluginname,3613 return delegate
    310 dependency: depname,}
    311 })
    312 )1exports.depends = function () {
    313 2 break var self = this
    314 }7 var private$ = this.private$
    315 }7 var error = this.util.error
    316 }7 var args = Norma('{pluginname:s deps:a? moredeps:s*}', arguments)
    317
    318 1exports.export = function (key) {7 var deps = args.deps || args.moredeps || []
    319 var self = this
    320 76 var private$ = this.private$7 for (var i = 0; i < deps.length; i++) {
    321 76 var error = this.util.error9 var depname = deps[i]
    322 76 var opts = this.options()
    323 9 if (
    324 // Legacy aliases !private$.plugin_order.byname.includes(depname) &&
    325
    if (
    key === 'util'
    ) {
    !private$.plugin_order.byname.includes('seneca-' + depname)
    326 key = 'basic' ) {
    327 }2 self.die(
    328 error('plugin_required', {
    329 76 var exportval = private$.exports[key] name: args.pluginname,
    330 dependency: depname,
    331
    if (!exportval &&
    opts.strict.exports
    ) {
    })
    332 1 return self.die(error('export_not_found', { key: key })) )
    333 }2 break
    334 }
    335 75 return exportval }
    336 338 1exports.quiet = function (flags) {exports.export = function (key) {
    339 flags = flags || {} var self = this
    340 76 var private$ = this.private$
    341 39 var quiet_opts = {76 var error = this.util.error
    342 test: false,76 var opts = this.options()
    343 quiet: true,
    344 log: 'none', // Legacy aliases
    345 reload$: true,
    if (
    key === 'util'
    ) {
    346 } key = 'basic'
    347 }
    348 39 var opts = this.options(quiet_opts)
    349 76 var exportval = private$.exports[key]
    350 // An override from env or args is possible.
    351 // Only flip to test mode if called from test() method
    if (!exportval &&
    opts.strict.exports
    ) {
    352
    if (opts.test &&
    'test' !== flags.from
    ) {
    1 return self.die(error('export_not_found', { key: key }))
    353 2 return this.test() }
    354 } else {
    355 37 this.private$.logging.build_log(this)75 return exportval
    356 }
    357 37 return this
    358 }1exports.quiet = function (flags) {
    359 } flags = flags || {}
    360
    361 1exports.test = function (errhandler, logspec) {39 var quiet_opts = {
    362 var opts = this.options() test: false,
    363 quiet: true,
    364 205 if ('-' != opts.tag) { log: 'none',
    365 21 this.root.id = reload$: true,
    366 null == opts.id$ }
    367 ? this.private$.actnid().substring(0, 4) + '/' + opts.tag
    368 : '' + opts.id$39 var opts = this.options(quiet_opts)
    369 }
    370 // An override from env or args is possible.
    371 205 if ('function' !== typeof errhandler && null !== errhandler) { // Only flip to test mode if called from test() method
    372 55 logspec = errhandler
    if (opts.test &&
    'test' !== flags.from
    ) {
    373 55 errhandler = null2 return this.test()
    374 } } else {
    375 37 this.private$.logging.build_log(this)
    376
    logspec =
    true === logspec
    || 'true' === logspec ? 'test' : logspec
    377 37 return this
    378 205 var test_opts = { }
    379 errhandler: null == errhandler ? null : errhandler,}
    380 test: true,
    381 quiet: false,1exports.test = function (errhandler, logspec) {
    382 reload$: true, var opts = this.options()
    383 log: logspec || 'test',
    384 }205 if ('-' != opts.tag) {
    385 21 this.root.id =
    386 205 var set_opts = this.options(test_opts) null == opts.id$
    387 ? this.private$.actnid().substring(0, 4) + '/' + opts.tag
    388 // An override from env or args is possible. : '' + opts.id$
    389 205 if (set_opts.quiet) { }
    390 2 return this.quiet({ from: 'test' })
    391 } else {205 if ('function' !== typeof errhandler && null !== errhandler) {
    392 203 this.private$.logging.build_log(this)55 logspec = errhandler
    393 55 errhandler = null
    394 // Manually set logger to test_logger (avoids infecting options structure), }
    395 // unless there was an external logger defined by the options
    396 203 if (!this.private$.logger.from_options$) {
    logspec =
    true === logspec
    || 'true' === logspec ? 'test' : logspec
    397 190 this.root.private$.logger = this.private$.logging.test_logger
    398 }205 var test_opts = {
    399 errhandler: null == errhandler ? null : errhandler,
    400 203 return this test: true,
    401 } quiet: false,
    402 } reload$: true,
    403 log: logspec || 'test',
    404 1exports.ping = function () { }
    405 var now = Date.now()
    406 2 return {205 var set_opts = this.options(test_opts)
    407 now: now,
    408 uptime: now - this.private$.stats.start, // An override from env or args is possible.
    409 id: this.id,205 if (set_opts.quiet) {
    410 cpu: process.cpuUsage(),2 return this.quiet({ from: 'test' })
    411 mem: process.memoryUsage(), } else {
    412 act: this.private$.stats.act,203 this.private$.logging.build_log(this)
    413 tr: this.private$.transport.register.map(function (x) {
    414 return Object.assign({ when: x.when, err: x.err }, x.config) // Manually set logger to test_logger (avoids infecting options structure),
    415 }), // unless there was an external logger defined by the options
    416 }203 if (!this.private$.logger.from_options$) {
    417 }190 this.root.private$.logger = this.private$.logging.test_logger
    418 }
    419 1exports.translate = function (from_in, to_in, pick_in) {
    420 var from = 'string' === typeof from_in ? Jsonic(from_in) : from_in203 return this
    421 11 var to = 'string' === typeof to_in ? Jsonic(to_in) : to_in }
    422 }
    423 11 var pick = {}
    424 1exports.ping = function () {
    425 11 if ('string' === typeof pick_in) { var now = Date.now()
    426 4 pick_in = pick_in.split(/\s*,\s*/)2 return {
    427 } now: now,
    428 uptime: now - this.private$.stats.start,
    429 11 if (Array.isArray(pick_in)) { id: this.id,
    430 6 pick_in.forEach(function (prop) { cpu: process.cpuUsage(),
    431 if (prop.startsWith('-')) { mem: process.memoryUsage(),
    432 2 pick[prop.substring(1)] = false act: this.private$.stats.act,
    433 } else { tr: this.private$.transport.register.map(function (x) {
    434 7 pick[prop] = true return Object.assign({ when: x.when, err: x.err }, x.config)
    435 } }),
    436 }) }
    437
    } else if (pick_in &&
    'object' === typeof pick_in
    ) {
    }
    438 2 pick = Object.assign({}, pick_in)
    439 } else {1exports.translate = function (from_in, to_in, pick_in) {
    440 3 pick = null var from = 'string' === typeof from_in ? Jsonic(from_in) : from_in
    441 }11 var to = 'string' === typeof to_in ? Jsonic(to_in) : to_in
    442 443 11 this.add(from, function (msg, reply) { var pick = {}
    444 var pick_msg
    445 11 if ('string' === typeof pick_in) {
    446 11 if (pick) {4 pick_in = pick_in.split(/\s*,\s*/)
    447 8 pick_msg = {} }
    448 8 Object.keys(pick).forEach(function (prop) {
    449 if (pick[prop]) {11 if (Array.isArray(pick_in)) {
    450 9 pick_msg[prop] = msg[prop]6 pick_in.forEach(function (prop) {
    451 } if (prop.startsWith('-')) {
    452 })2 pick[prop.substring(1)] = false
    453 } else { } else {
    454 3 pick_msg = this.util.clean(msg)7 pick[prop] = true
    455 } }
    456 })
    457 11 var transmsg = Object.assign(pick_msg, to)
    } else if (pick_in &&
    'object' === typeof pick_in
    ) {
    458 11 this.act(transmsg, reply)2 pick = Object.assign({}, pick_in)
    459 }) } else {
    460 3 pick = null
    461 11 return this }
    462 }
    463 11 this.add(from, function (msg, reply) {
    464 1exports.gate = function () { var pick_msg
    465 return this.delegate({ gate$: true })
    466 }11 if (pick) {
    467 8 pick_msg = {}
    468 1exports.ungate = function () {8 Object.keys(pick).forEach(function (prop) {
    469 this.fixedargs.gate$ = false if (pick[prop]) {
    470 1 return this9 pick_msg[prop] = msg[prop]
    471 } }
    472 })
    473 // TODO this needs a better name } else {
    474 1exports.list_plugins = function () {3 pick_msg = this.util.clean(msg)
    475 return Object.assign({}, this.private$.plugins) }
    476 }
    477 11 var transmsg = Object.assign(pick_msg, to)
    478 1exports.find_plugin = function (plugindesc, tag) {11 this.act(transmsg, reply)
    479 var plugin_key = Common.make_plugin_key(plugindesc, tag) })
    480 4 return this.private$.plugins[plugin_key]
    481 }11 return this
    482 }
    483 1exports.has_plugin = function (plugindesc, tag) {
    484 var plugin_key = Common.make_plugin_key(plugindesc, tag)1exports.gate = function () {
    485 13 return !!this.private$.plugins[plugin_key] return this.delegate({ gate$: true })
    486 488 1exports.ignore_plugin = function (plugindesc, tag, ignore) {exports.ungate = function () {
    489 if ('boolean' === typeof tag) { this.fixedargs.gate$ = false
    490 5 ignore = tag1 return this
    491 5 tag = null}
    492 }
    493 8 var plugin_key = Common.make_plugin_key(plugindesc, tag)// TODO this needs a better name
    494 8 var resolved_ignore = (this.private$.ignore_plugins[plugin_key] =1exports.list_plugins = function () {
    495 null == ignore ? true : !!ignore) return Object.assign({}, this.private$.plugins)
    496 }
    497 8 this.log.info({
    498 kind: 'plugin',1exports.find_plugin = function (plugindesc, tag) {
    499 case: 'ignore', var plugin_key = Common.make_plugin_key(plugindesc, tag)
    500 full: plugin_key,4 return this.private$.plugins[plugin_key]
    501 ignore: resolved_ignore,}
    502 })
    503 1exports.has_plugin = function (plugindesc, tag) {
    504 8 return this var plugin_key = Common.make_plugin_key(plugindesc, tag)
    505 }13 return !!this.private$.plugins[plugin_key]
    506 }
    507 // Find the action metadata for a given pattern, if it exists.
    508 1exports.find = function (pattern, flags) {exports.ignore_plugin = function (plugindesc, tag, ignore) {
    509 var seneca = this if ('boolean' === typeof tag) {
    510 5 ignore = tag
    511 10303 var pat = 'string' === typeof pattern ? Jsonic(pattern) : pattern5 tag = null
    512 10303 pat = seneca.util.clean(pat) }
    513 10303 pat = pat || {}8 var plugin_key = Common.make_plugin_key(plugindesc, tag)
    514 8 var resolved_ignore = (this.private$.ignore_plugins[plugin_key] =
    515 10303 var actdef = seneca.private$.actrouter.find(pat, flags && flags.exact) null == ignore ? true : !!ignore)
    516
    517 10303 if (!actdef) {8 this.log.info({
    518 7718 actdef = seneca.private$.actrouter.find({}) kind: 'plugin',
    519 } case: 'ignore',
    520 full: plugin_key,
    521 10303 return actdef ignore: resolved_ignore,
    522 } })
    523
    524 // True if an action matching the pattern exists.8 return this
    525 1exports.has = function (pattern) {}
    526 return !!this.find(pattern, { exact: true })
    527 }// Find the action metadata for a given pattern, if it exists.
    528 1exports.find = function (pattern, flags) {
    529 // List all actions that match the pattern. var seneca = this
    530 1exports.list = function (pattern) {
    531 return this.private$.actrouter10303 var pat = 'string' === typeof pattern ? Jsonic(pattern) : pattern
    532 .list(null == pattern ? {} : Jsonic(pattern))10303 pat = seneca.util.clean(pat)
    533 .map((x) => x.match)10303 pat = pat || {}
    534
    535 /*10303 var actdef = seneca.private$.actrouter.find(pat, flags && flags.exact)
    536 return _.map(
    537 this.private$.actrouter.list(null == pattern ? {} : Jsonic(pattern)),10303 if (!actdef) {
    538 'match'7718 actdef = seneca.private$.actrouter.find({})
    539 ) }
    540 */
    541 }10303 return actdef
    542 }
    543 // Get the current status of the instance.
    544 1exports.status = function (flags) {// True if an action matching the pattern exists.
    545 flags = flags || {}1exports.has = function (pattern) {
    546 return !!this.find(pattern, { exact: true })
    547 6 var hist = this.private$.history.stats()}
    548 6 hist.log = this.private$.history.list()
    549 // List all actions that match the pattern.
    550 6 var status = {1exports.list = function (pattern) {
    551 stats: this.stats(flags.stats), return this.private$.actrouter
    552 history: hist, .list(null == pattern ? {} : Jsonic(pattern))
    553 transport: this.private$.transport, .map((x) => x.match)
    554 }
    555 /*
    556 6 return status return _.map(
    557 } this.private$.actrouter.list(null == pattern ? {} : Jsonic(pattern)),
    558 'match'
    559 // Reply to an action that is waiting for a result. )
    560 // Used by transports to decouple sending messages from receiving responses. */
    561 1exports.reply = function (spec) {}
    562 var instance = this
    563 34 var actctxt = null// Get the current status of the instance.
    564 1exports.status = function (flags) {
    565 34 if (spec && spec.meta) { flags = flags || {}
    566 32 actctxt = instance.private$.history.get(spec.meta.id)
    567 32 if (actctxt) {6 var hist = this.private$.history.stats()
    568 31 actctxt.reply(spec.err, spec.out, spec.meta)6 hist.log = this.private$.history.list()
    569 }
    570 }6 var status = {
    571 stats: this.stats(flags.stats),
    572 34 return !!actctxt history: hist,
    573 } transport: this.private$.transport,
    574 }
    575 // Listen for inbound messages.
    576 1exports.listen = function (callpoint) {6 return status
    577 return function api_listen(...argsarr) {}
    578 var private$ = this.private$
    579 47 var self = this// Reply to an action that is waiting for a result.
    580 // Used by transports to decouple sending messages from receiving responses.
    581 47 var done = argsarr[argsarr.length - 1]1exports.reply = function (spec) {
    582 47 if (typeof done === 'function') { var instance = this
    583 1 argsarr.pop()34 var actctxt = null
    584 } else {
    585 46 done = () => {}34 if (spec && spec.meta) {
    586 }32 actctxt = instance.private$.history.get(spec.meta.id)
    587 32 if (actctxt) {
    588 47 self.log.info({31 actctxt.reply(spec.err, spec.out, spec.meta)
    589 kind: 'listen', }
    590 case: 'INIT', }
    591 data: argsarr,
    592 callpoint: callpoint(true),34 return !!actctxt
    593 })}
    594
    595
    var opts =
    self.options().transport
    ||
    {}
    // Listen for inbound messages.
    596 47 var config = intern.resolve_config(intern.parse_config(argsarr), opts)1exports.listen = function (callpoint) {
    597 return function api_listen(...argsarr) {
    598 47 self.act( var private$ = this.private$
    599 'role:transport,cmd:listen',47 var self = this
    600 { config: config, gate$: true },
    601 function (err, result) {47 var done = argsarr[argsarr.length - 1]
    602
    if (
    err
    ) {
    47 if (typeof done === 'function') {
    603 return self.die(private$.error(err, 'transport_listen', config))1 argsarr.pop()
    604 } } else {
    605 46 done = () => {}
    606 47 done(null, result) }
    607 47 done = () => {}
    608 }47 self.log.info({
    609 ) kind: 'listen',
    610 case: 'INIT',
    611 47 return self data: argsarr,
    612 } callpoint: callpoint(true),
    613 } })
    614
    615 // Send outbound messages.
    var opts =
    self.options().transport
    ||
    {}
    616 1exports.client = function (callpoint) {47 var config = intern.resolve_config(intern.parse_config(argsarr), opts)
    617 return function api_client() {
    618 var private$ = this.private$47 self.act(
    619 43 var argsarr = Array.prototype.slice.call(arguments) 'role:transport,cmd:listen',
    620 43 var self = this { config: config, gate$: true },
    621 function (err, result) {
    622 43 self.log.info({
    if (
    err
    ) {
    623 kind: 'client', return self.die(private$.error(err, 'transport_listen', config))
    624 case: 'INIT', }
    625 data: argsarr,
    626 callpoint: callpoint(true),47 done(null, result)
    627 })47 done = () => {}
    628 }
    629
    var legacy =
    self.options().legacy
    ||
    {}
    )
    630
    var opts =
    self.options().transport
    ||
    {}
    631 47 return self
    632 43 var raw_config = intern.parse_config(argsarr) }
    633 }
    634 // pg: pin group
    635 43 raw_config.pg = Common.pincanon(raw_config.pin || raw_config.pins)// Send outbound messages.
    636 1exports.client = function (callpoint) {
    637 43 var config = intern.resolve_config(raw_config, opts) return function api_client() {
    638 var private$ = this.private$
    639 43 config.id = config.id || Common.pattern(raw_config) var argsarr = Array.prototype.slice.call(arguments)
    640 43 var self = this
    641 43 var pins =
    642 config.pins ||43 self.log.info({
    643
    (
    Array.isArray(config.pin)
    ?
    config.pin
    : [config.pin || ''])
    kind: 'client',
    644 case: 'INIT',
    645 43 pins = pins.map((pin) => { data: argsarr,
    646 return 'string' === typeof pin ? Jsonic(pin) : pin callpoint: callpoint(true),
    647
    649 //var sd = Plugins.make_delegate(self, {
    var legacy =
    self.options().legacy
    ||
    {}
    650 // TODO: review - this feels like a hack
    var opts =
    self.options().transport
    ||
    {}
    651 // perhaps we should instantiate a virtual plugin to represent the client?
    652 // ... but is this necessary at all?43 var raw_config = intern.parse_config(argsarr)
    653 43 var task_res = self.order.plugin.task.delegate.exec({
    654 ctx: { // pg: pin group
    655 seneca: self,43 raw_config.pg = Common.pincanon(raw_config.pin || raw_config.pins)
    656 },
    657 data: {43 var config = intern.resolve_config(raw_config, opts)
    658 plugin: {
    659 // TODO: make this unique with a counter43 config.id = config.id || Common.pattern(raw_config)
    660 name: 'seneca_internal_client',
    661 tag: void 0,43 var pins =
    662 }, config.pins ||
    663 },
    (
    Array.isArray(config.pin)
    ?
    config.pin
    : [config.pin || ''])
    664 })
    665 43 pins = pins.map((pin) => {
    666 43 var sd = task_res.out.delegate return 'string' === typeof pin ? Jsonic(pin) : pin
    667 })
    668 43 var sendclient
    669 //var sd = Plugins.make_delegate(self, {
    670 43 var transport_client = function transport_client(msg, reply, meta) { // TODO: review - this feels like a hack
    671
    if (
    legacy.meta
    ) {
    // perhaps we should instantiate a virtual plugin to represent the client?
    672 meta = meta || msg.meta$ // ... but is this necessary at all?
    673 }43 var task_res = self.order.plugin.task.delegate.exec({
    674 ctx: {
    675 // Undefined plugin init actions pass through here when seneca: self,
    676 // there's a catchall client, as they have local$:true },
    677 69 if (meta.local) { data: {
    678 11 this.prior(msg, reply) plugin: {
    679
    } else if (
    sendclient
    &&
    sendclient.send
    ) {
    // TODO: make this unique with a counter
    680
    if (
    legacy.meta
    ) {
    name: 'seneca_internal_client',
    681 msg.meta$ = meta tag: void 0,
    682 } },
    683 },
    684 58 sendclient.send.call(this, msg, reply, meta) })
    685 } else {
    686 this.log.error('no-transport-client', { config: config, msg: msg })43 var sd = task_res.out.delegate
    687 }
    688 }43 var sendclient
    689 690 43 transport_client.id = config.id var transport_client = function transport_client(msg, reply, meta) {
    691
    if (
    legacy.meta
    ) {
    692 43 if (config.makehandle) { meta = meta || msg.meta$
    693 1 transport_client.handle = config.makehandle(config) }
    694 }
    695 // Undefined plugin init actions pass through here when
    696 43 pins.forEach((pin) => { // there's a catchall client, as they have local$:true
    697 pin = Object.assign({}, pin)69 if (meta.local) {
    698 11 this.prior(msg, reply)
    699 // Override local actions, including those more specific than
    } else if (
    sendclient
    &&
    sendclient.send
    ) {
    700 // the client pattern
    if (
    legacy.meta
    ) {
    701
    if (
    config.override
    ) {
    msg.meta$ = meta
    702 sd.wrap( }
    703 sd.util.clean(pin),
    704 { client_pattern: sd.util.pattern(pin) },58 sendclient.send.call(this, msg, reply, meta)
    705 transport_client } else {
    706 ) this.log.error('no-transport-client', { config: config, msg: msg })
    707 708 }
    709 44 pin.client$ = true
    710 44 pin.strict$ = { add: true }43 transport_client.id = config.id
    711
    712 44 sd.add(pin, transport_client)43 if (config.makehandle) {
    713 })1 transport_client.handle = config.makehandle(config)
    714 }
    715 // Create client.
    716 43 sd.act( pins.forEach((pin) => {
    717 'role:transport,cmd:client', pin = Object.assign({}, pin)
    718 { config: config, gate$: true },
    719 function (err, liveclient) { // Override local actions, including those more specific than
    720
    if (
    err
    ) {
    // the client pattern
    721 return sd.die(private$.error(err, 'transport_client', config))
    if (
    config.override
    ) {
    722 } sd.wrap(
    723 sd.util.clean(pin),
    724
    if (
    null == liveclient
    ) {
    { client_pattern: sd.util.pattern(pin) },
    725 return sd.die( transport_client
    726 private$.error('transport_client_null', Common.clean(config)) )
    727 ) }
    728 }
    729 44 pin.client$ = true
    730 43 sendclient = liveclient44 pin.strict$ = { add: true }
    731 }
    732 )44 sd.add(pin, transport_client)
    733 })
    734 43 return self
    735 } // Create client.
    736 }43 sd.act(
    737 'role:transport,cmd:client',
    738 // Inspired by https://github.com/hapijs/hapi/blob/master/lib/plugin.js decorate { config: config, gate$: true },
    739 // TODO: convert to plugin configuration, with standard errors function (err, liveclient) {
    740 1exports.decorate = function () {
    if (
    err
    ) {
    741 var args = Norma('property:s value:.', arguments) return sd.die(private$.error(err, 'transport_client', config))
    742 }
    743 32 var property = args.property
    744 32 Assert(property[0] !== '_', 'property cannot start with _')
    if (
    null == liveclient
    ) {
    745 31 Assert( return sd.die(
    746 this.private$.decorations[property] === undefined, private$.error('transport_client_null', Common.clean(config))
    747 'seneca is already decorated with the property: ' + property )
    748 ) }
    749 30 Assert(
    750 this.root[property] === undefined,43 sendclient = liveclient
    751 'cannot override a core seneca property: ' + property }
    752 ) )
    753
    754 29 this.root[property] = this.private$.decorations[property] = args.value43 return self
    755 } }
    756 }
    757 1intern.parse_config = function (args) {
    758 var out = {}// Inspired by https://github.com/hapijs/hapi/blob/master/lib/plugin.js decorate
    759 // TODO: convert to plugin configuration, with standard errors
    760 90 var config = args.filter((x) => null != x)1exports.decorate = function () {
    761 var args = Norma('property:s value:.', arguments)
    762 90 var arglen = config.length
    763 40 var property = args.property
    764 // TODO: use Joi for better error msgs40 Assert(property[0] !== '_', 'property cannot start with _')
    765 39 Assert(
    766 90 if (arglen === 1) { this.private$.decorations[property] === undefined,
    767
    if (
    config[0]
    && 'object' === typeof config[0]) {
    'seneca is already decorated with the property: ' + property
    768 63 out = Object.assign({}, config[0]) )
    769 } else {38 Assert(
    770 17 out.port = parseInt(config[0], 10) this.root[property] === undefined,
    771 } 'cannot override a core seneca property: ' + property
    772 10 } else if (arglen === 2) { )
    773 1 out.port = parseInt(config[0], 10)
    774 1 out.host = config[1]37 this.root[property] = this.private$.decorations[property] = args.value
    775 9 } else if (arglen === 3) {}
    776 3 out.port = parseInt(config[0], 10)
    777 3 out.host = config[1]1intern.parse_config = function (args) {
    778 3 out.path = config[2] var out = {}
    779 }
    780 90 var config = args.filter((x) => null != x)
    781 90 return out
    782 }90 var arglen = config.length
    783
    784 1intern.resolve_config = function (config, options) { // TODO: use Joi for better error msgs
    785 var out = Object.assign({}, config)
    786 90 if (arglen === 1) {
    787 90 Object.keys(options).forEach((key) => {
    if (
    config[0]
    && 'object' === typeof config[0]) {
    788 var value = options[key]63 out = Object.assign({}, config[0])
    789
    if (
    value
    && 'object' === typeof value) {
    } else {
    790 13 return17 out.port = parseInt(config[0], 10)
    791
    792 228 out[key] = out[key] === void 0 ? value : out[key]10 } else if (arglen === 2) {
    793 })1 out.port = parseInt(config[0], 10)
    794 1 out.host = config[1]
    795 // Default transport is web9 } else if (arglen === 3) {
    796 90 out.type = out.type || 'web'3 out.port = parseInt(config[0], 10)
    797 3 out.host = config[1]
    798 // DEPRECATED: Remove in 4.03 out.path = config[2]
    799 90 if (out.type === 'direct' || out.type === 'http') { }
    800 2 out.type = 'web'
    801 }90 return out
    802 }
    803 90 var base = options[out.type] || {}
    804 1intern.resolve_config = function (config, options) {
    805 90 out = Object.assign({}, base, out) var out = Object.assign({}, config)
    806 807 90 if (out.type === 'web' || out.type === 'tcp') { Object.keys(options).forEach((key) => {
    808
    out.port =
    out.port == null
    ?
    base.port
    : out.port
    var value = options[key]
    809 53 out.host = out.host == null ? base.host : out.host
    if (
    value
    && 'object' === typeof value) {
    810 53 out.path = out.path == null ? base.path : out.path13 return
    811 } }
    812 228 out[key] = out[key] === void 0 ? value : out[key]
    813 })
    814
    815 // Default transport is web
    81690 out.type = out.type || 'web'
    817
    818 // DEPRECATED: Remove in 4.0
    81990 if (out.type === 'direct' || out.type === 'http') {
    8202 out.type = 'web'
    821 }
    822
    82390 var base = options[out.type] || {}
    824
    82590 out = Object.assign({}, base, out)
    826
    82790 if (out.type === 'web' || out.type === 'tcp') {
    828
    out.port =
    out.port == null
    ?
    base.port
    : out.port
    82953 out.host = out.host == null ? base.host : out.host
    83053 out.path = out.path == null ? base.path : out.path
    831 }
    832
    813
    833 90 return out
    814
    834 }
    815
    835
    816
    836 1 intern.close = function (callpoint, done) {
    817
    837 var seneca = this
    818
    838 78 var options = seneca.options()
    819
    839
    820
    840 78 var done_called = false
    821
    841 78 var safe_done = function safe_done(err) {
    822
    842 if (!done_called && 'function' === typeof done) {
    823
    843 77 done_called = true
    824
    844 77 return done.call(seneca, err)
    825
    845 }
    826
    846 }
    827
    847
    828
    848 // don't try to close twice
    829
    849 78 if (seneca.flags.closed) {
    830
    850 1 return safe_done()
    831
    851 }
    832
    852
    833
    853 77 seneca.ready(do_close)
    834
    854 77 var close_timeout = setTimeout(do_close, options.close_delay)
    835
    855
    836
    856 function do_close() {
    837
    857 78 clearTimeout(close_timeout)
    838
    858
    839
    859 78 if (seneca.flags.closed) {
    840
    860 1 return safe_done()
    841
    861 }
    842
    862
    843
    863 // TODO: remove in 4.x
    844
    864 77 seneca.closed = true
    845
    865
    846
    866 77 seneca.flags.closed = true
    847
    867
    848
    868 // cleanup process event listeners
    849
    869 77 Common.each(options.system.close_signals, function (active, signal) {
    850
    870
    if (
    active
    ) {
    851
    871 process.removeListener(signal, seneca.private$.exit_close)
    852
    872 }
    853
    873 })
    854
    874
    855
    875 77 seneca.log.debug({
    856
    876 kind: 'close',
    857
    877 notice: 'start',
    858
    878 callpoint: callpoint(true),
    859
    879 })
    860
    880
    861
    881 77 seneca.act('role:seneca,cmd:close,closing$:true', function (err) {
    862
    882 seneca.log.debug(errlog(err, { kind: 'close', notice: 'end' }))
    863
    883
    864
    884 77 seneca.removeAllListeners('act-in')
    865
    885 77 seneca.removeAllListeners('act-out')
    866
    886 77 seneca.removeAllListeners('act-err')
    867
    887 77 seneca.removeAllListeners('pin')
    868
    888 77 seneca.removeAllListeners('after-pin')
    869
    889 77 seneca.removeAllListeners('ready')
    870
    890
    871
    891 77 seneca.private$.history.close()
    872
    892
    873
    893
    if (
    seneca.private$.status_interval
    ) {
    874
    894 clearInterval(seneca.private$.status_interval)
    875
    895 }
    876
    896
    877
    897 77 return safe_done(err)
    878
    898 })
    879
    899 }
    880
    900
    881
    901 77 return seneca
    882
    902 }
    883
    903
    884
    904 1 intern.fix_args = function (origargs, patargs, msgargs, custom) {
    885
    905 var args = Common.parsePattern(this, origargs, 'rest:.*', patargs)
    886
    906 6 var fixargs = [args.pattern]
    887
    907 .concat({
    888
    908 fixed$: Object.assign({}, msgargs, args.pattern.fixed$),
    889
    909 custom$: Object.assign({}, custom, args.pattern.custom$),
    890
    910 })
    891
    911 .concat(args.rest)
    892
    912 6 return fixargs
    893
    913 }
    894
    914
    @@ -18401,13 +18570,13 @@

    lib/common.js

    - + - + @@ -18701,7 +18870,7 @@

    lib/common.js

    - + @@ -18749,7 +18918,7 @@

    lib/common.js

    - + @@ -19283,7 +19452,7 @@

    lib/common.js

    - + @@ -19295,7 +19464,7 @@

    lib/common.js

    - + @@ -19307,19 +19476,19 @@

    lib/common.js

    - + - + - + @@ -19331,13 +19500,13 @@

    lib/common.js

    - + - + @@ -19385,7 +19554,7 @@

    lib/common.js

    - + @@ -19793,7 +19962,7 @@

    lib/common.js

    - + @@ -19817,7 +19986,7 @@

    lib/common.js

    - + @@ -19841,7 +20010,7 @@

    lib/common.js

    - + @@ -19877,7 +20046,7 @@

    lib/common.js

    - + @@ -19895,7 +20064,7 @@

    lib/common.js

    - + @@ -19937,7 +20106,7 @@

    lib/common.js

    - + @@ -19949,7 +20118,7 @@

    lib/common.js

    - + @@ -20021,7 +20190,7 @@

    lib/common.js

    - + @@ -20039,7 +20208,7 @@

    lib/common.js

    - + @@ -20063,7 +20232,7 @@

    lib/common.js

    - + @@ -20159,7 +20328,7 @@

    lib/common.js

    - + @@ -20171,7 +20340,7 @@

    lib/common.js

    - + @@ -20183,7 +20352,7 @@

    lib/common.js

    - + @@ -20441,13 +20610,13 @@

    lib/common.js

    - + - + @@ -20828,11 +20997,11 @@

    lib/common.js

    - + - - + + @@ -20864,11 +21033,11 @@

    lib/common.js

    - + - + @@ -21041,13 +21210,13 @@

    lib/common.js

    - + - + @@ -21059,7 +21228,7 @@

    lib/common.js

    - + @@ -21203,7 +21372,7 @@

    lib/common.js

    - + @@ -21227,7 +21396,7 @@

    lib/common.js

    - + @@ -21749,7 +21918,7 @@

    lib/common.js

    - + @@ -21761,13 +21930,13 @@

    lib/common.js

    - + - + @@ -21821,13 +21990,13 @@

    lib/common.js

    - + - + @@ -21839,13 +22008,13 @@

    lib/common.js

    - + - + @@ -21863,13 +22032,13 @@

    lib/common.js

    - + - + @@ -21881,31 +22050,31 @@

    lib/common.js

    - + - + - + - + - + @@ -21917,13 +22086,13 @@

    lib/common.js

    - + - + @@ -21947,7 +22116,7 @@

    lib/common.js

    - + @@ -21983,13 +22152,13 @@

    lib/common.js

    - + - + @@ -22001,7 +22170,7 @@

    lib/common.js

    - + @@ -22173,8 +22342,8 @@

    lib/common.js

    lib/errors.js

    100%
    -
    112
    -
    112
    +
    116
    +
    116
    0
    105 1053410528 try {
    106 1053410528 return null == str ? null : Jsonic(str)
    155 29612955 args.msg = Object.assign(
    163 29602954 return args
    252 2370123709 if (null == obj) return obj
    254 2369723705 var out = Array.isArray(obj) ? [] : {}
    256 2369723705 var pn = Object.getOwnPropertyNames(obj)
    257 2369723705 for (var i = 0; i < pn.length; i++) {
    258 7788677949 var p = pn[i]
    260 7788677949 if ('$' != p[p.length - 1]) {
    261 6394963996 out[p] = obj[p]
    269 2369723705 return out
    337 2125 var test = so.test
    341 2125 var full =
    345 2125 if (0 < diecount) {
    351 1721 diecount++
    354 1721 try {
    361 1721 err.fatal$ = true
    363 1721 var logdesc = {
    375 1721 instance.log.fatal(logdesc)
    378 1721 stack = stack
    382 1721 var procdesc =
    398 1721 var when = new Date()
    400 1721 var clean_details = null
    402 1721 var stderrmsg =
    445 1721 if (so.errhandler) {
    446 1418 so.errhandler.call(instance, err)
    } catch (panic) {
    510 this.log.fatal({4 this.log.fatal({
    511
    516 if (so.test) {
    if (
    so.test
    ) {
    517
    545 56485646 var prior = callmeta.prior || {}
    546 56485646 actdef = actdef || {}
    548 56485646 return Object.assign(
    572 113117 if (err.details && ctxt && ctxt.caller) {
    576 113117 return Object.assign(
    663 24072403 var i = this._list.length - 1
    665 24072403 if (i < 0 || this._list[i].timelimit <= obj.timelimit) {
    666 23972393 this._list.push(obj)
    675 6225465694 var s = 0
    676 6225465694 var e = i
    678 6225465694 if (0 === this._list.length) {
    679 1184514997 return 0
    682 5040950697 do {
    683 104322104717 i = Math.floor((s + e) / 2)
    685 104322104717 if (timelimit > this._list[i].timelimit) {
    686 240262 s = i + 1
    687 240262 i = s
    688 104082104455 } else if (timelimit < this._list[i].timelimit) {
    689 104068104439 e = i
    691 1416 i++
    692 1416 break
    696 5040950697 return i
    702 6224465684 for (var j = 0; j < i; j++) {
    703 461492 delete this._map[this._list[j].id]
    705 6224465684 this._list = this._list.slice(i)
    @@ -23056,13 +23225,13 @@

    lib/errors.js

    - + - + @@ -23074,13 +23243,13 @@

    lib/errors.js

    - + - + @@ -23092,83 +23261,119 @@

    lib/errors.js

    - + - + - + - + - + - + - + - - + + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -23178,10 +23383,10 @@

    lib/errors.js

    lib/inward.js

    -
    89.43%
    +
    90.03%
    331
    -
    296
    -
    35
    +
    298
    +
    33
    145 action_timeout: fail_wrong_number_of_args:
    146 '<%=legacy_string%>Action <%=pattern%> timed out. Timeout was: <%=timeout%> (start: <%=start%>, end: <%=end%>. Message was: <%=message%>.', 'The Seneca.fail method was called with the wrong number of arguments: <%=num_args%>',
    147 148 use_no_args: fail_cond_must_be_bool:
    149 'The seneca.use method needs at least one argument to define a plugin.', 'The Seneca.fail method expected the `cond` param to be a boolean.',
    150 151 // Legacy error message codes action_timeout:
    152 '<%=legacy_string%>Action <%=pattern%> timed out. Timeout was: <%=timeout%> (start: <%=start%>, end: <%=end%>. Message was: <%=message%>.',
    153 act_invalid_args:
    154 'Action <%=pattern%> has invalid arguments; <%=message%>; ' + use_no_args:
    155 'arguments were: <%=msg%>.', 'The seneca.use method needs at least one argument to define a plugin.',
    156 }
    157 // Legacy error message codes
    158 1module.exports.deprecation = {
    159 seneca_parent: act_invalid_args:
    160 'Seneca.parent has been renamed to Seneca.prior. Seneca.parent will be removed in Seneca 4.x.', 'Action <%=pattern%> has invalid arguments; <%=message%>; ' +
    161 'arguments were: <%=msg%>.',
    162 seneca_next_act: 'Seneca.next_act will be removed in Seneca 3.x',}
    163 }
    164 1module.exports.deprecation = {
    165 seneca_parent:
    166 'Seneca.parent has been renamed to Seneca.prior. Seneca.parent will be removed in Seneca 4.x.',
    167
    168 seneca_next_act: 'Seneca.next_act will be removed in Seneca 3.x',
    169}
    170
    @@ -23371,7 +23576,7 @@

    lib/inward.js

    - + @@ -23383,19 +23588,19 @@

    lib/inward.js

    - + - + - + @@ -23413,7 +23618,7 @@

    lib/inward.js

    - + @@ -23437,13 +23642,13 @@

    lib/inward.js

    - + - + @@ -23479,13 +23684,13 @@

    lib/inward.js

    - + - + @@ -23599,7 +23804,7 @@

    lib/inward.js

    - + @@ -23641,7 +23846,7 @@

    lib/inward.js

    - + @@ -23671,7 +23876,7 @@

    lib/inward.js

    - + @@ -23767,13 +23972,13 @@

    lib/inward.js

    - + - + @@ -23785,7 +23990,7 @@

    lib/inward.js

    - + @@ -23797,7 +24002,7 @@

    lib/inward.js

    - + @@ -23815,7 +24020,7 @@

    lib/inward.js

    - + @@ -23839,19 +24044,19 @@

    lib/inward.js

    - + - + - + @@ -23869,7 +24074,7 @@

    lib/inward.js

    - + @@ -24061,13 +24266,13 @@

    lib/inward.js

    - + - + @@ -24079,7 +24284,7 @@

    lib/inward.js

    - + @@ -24181,13 +24386,13 @@

    lib/inward.js

    - + - + @@ -24199,13 +24404,13 @@

    lib/inward.js

    - + - + @@ -24415,13 +24620,13 @@

    lib/inward.js

    - + - + @@ -24433,13 +24638,13 @@

    lib/inward.js

    - + - + @@ -24457,7 +24662,7 @@

    lib/inward.js

    - + @@ -24469,13 +24674,13 @@

    lib/inward.js

    - + - + @@ -24484,11 +24689,11 @@

    lib/inward.js

    - + - - + + @@ -24499,7 +24704,7 @@

    lib/inward.js

    - + @@ -24508,11 +24713,11 @@

    lib/inward.js

    - + - + @@ -24583,7 +24788,7 @@

    lib/inward.js

    - + @@ -24595,7 +24800,7 @@

    lib/inward.js

    - + @@ -24631,13 +24836,13 @@

    lib/inward.js

    - + - + @@ -24727,7 +24932,7 @@

    lib/inward.js

    - + @@ -24739,25 +24944,25 @@

    lib/inward.js

    - + - + - + - + @@ -24769,7 +24974,7 @@

    lib/inward.js

    - + @@ -24835,19 +25040,19 @@

    lib/inward.js

    - + - + - + @@ -24865,7 +25070,7 @@

    lib/inward.js

    - + @@ -24955,7 +25160,7 @@

    lib/inward.js

    - + @@ -24997,7 +25202,7 @@

    lib/inward.js

    - + @@ -25009,7 +25214,7 @@

    lib/inward.js

    - + @@ -25021,13 +25226,13 @@

    lib/inward.js

    - + - + @@ -25039,7 +25244,7 @@

    lib/inward.js

    - + @@ -25057,7 +25262,7 @@

    lib/inward.js

    - + @@ -25105,7 +25310,7 @@

    lib/inward.js

    - + @@ -25147,7 +25352,7 @@

    lib/inward.js

    - + @@ -25171,13 +25376,13 @@

    lib/inward.js

    - + - + @@ -25213,13 +25418,13 @@

    lib/inward.js

    - + - + @@ -25237,13 +25442,13 @@

    lib/inward.js

    - + - + @@ -27375,13 +27580,13 @@

    lib/logging.js

    - + - + @@ -28221,7 +28426,7 @@

    lib/logging.js

    - + @@ -28245,13 +28450,13 @@

    lib/logging.js

    - + - + @@ -28263,7 +28468,7 @@

    lib/logging.js

    - + @@ -28299,7 +28504,7 @@

    lib/logging.js

    - + @@ -28323,25 +28528,25 @@

    lib/logging.js

    - + - + - + - + @@ -28353,13 +28558,13 @@

    lib/logging.js

    - + - + @@ -28377,13 +28582,13 @@

    lib/logging.js

    - + - + @@ -28407,13 +28612,13 @@

    lib/logging.js

    - + - + @@ -28437,7 +28642,7 @@

    lib/logging.js

    - + @@ -28449,7 +28654,7 @@

    lib/logging.js

    - + @@ -28461,13 +28666,13 @@

    lib/logging.js

    - + - + @@ -28485,7 +28690,7 @@

    lib/logging.js

    - + @@ -28623,13 +28828,13 @@

    lib/logging.js

    - + - + @@ -29307,19 +29512,19 @@

    lib/logging.js

    - + - + - + @@ -29331,25 +29536,25 @@

    lib/logging.js

    - + - + - + - + @@ -29379,7 +29584,7 @@

    lib/logging.js

    - + @@ -30763,7 +30968,7 @@

    lib/options.js

    - + @@ -31343,7 +31548,7 @@

    lib/outward.js

    - + @@ -31427,7 +31632,7 @@

    lib/outward.js

    - + @@ -31439,19 +31644,19 @@

    lib/outward.js

    - + - + - + @@ -31463,13 +31668,13 @@

    lib/outward.js

    - + - + @@ -31487,7 +31692,7 @@

    lib/outward.js

    - + @@ -31499,13 +31704,13 @@

    lib/outward.js

    - + - + @@ -31541,13 +31746,13 @@

    lib/outward.js

    - + - + @@ -31613,7 +31818,7 @@

    lib/outward.js

    - + @@ -31667,13 +31872,13 @@

    lib/outward.js

    - + - + @@ -31685,7 +31890,7 @@

    lib/outward.js

    - + @@ -31715,7 +31920,7 @@

    lib/outward.js

    - + @@ -31727,19 +31932,19 @@

    lib/outward.js

    - + - + - + @@ -31751,13 +31956,13 @@

    lib/outward.js

    - + - + @@ -31775,7 +31980,7 @@

    lib/outward.js

    - + @@ -31847,7 +32052,7 @@

    lib/outward.js

    - + @@ -31871,7 +32076,7 @@

    lib/outward.js

    - + @@ -31997,7 +32202,7 @@

    lib/outward.js

    - + @@ -32009,13 +32214,13 @@

    lib/outward.js

    - + - + @@ -32057,7 +32262,7 @@

    lib/outward.js

    - + @@ -32069,7 +32274,7 @@

    lib/outward.js

    - + @@ -32141,7 +32346,7 @@

    lib/outward.js

    - + @@ -32153,13 +32358,13 @@

    lib/outward.js

    - + - + @@ -32183,7 +32388,7 @@

    lib/outward.js

    - + @@ -32225,19 +32430,19 @@

    lib/outward.js

    - + - + - + @@ -32285,13 +32490,13 @@

    lib/outward.js

    - + - + @@ -32309,7 +32514,7 @@

    lib/outward.js

    - + @@ -32339,19 +32544,19 @@

    lib/outward.js

    - + - + - + @@ -32363,13 +32568,13 @@

    lib/outward.js

    - + - + @@ -32381,7 +32586,7 @@

    lib/outward.js

    - + @@ -32393,7 +32598,7 @@

    lib/outward.js

    - + @@ -32495,7 +32700,7 @@

    lib/outward.js

    - + @@ -32525,7 +32730,7 @@

    lib/outward.js

    - + @@ -32567,13 +32772,13 @@

    lib/outward.js

    - + - + @@ -32591,13 +32796,13 @@

    lib/outward.js

    - + - + @@ -32615,7 +32820,7 @@

    lib/outward.js

    - + @@ -32639,7 +32844,7 @@

    lib/outward.js

    - + @@ -32651,7 +32856,7 @@

    lib/outward.js

    - + @@ -32681,7 +32886,7 @@

    lib/outward.js

    - + @@ -32807,25 +33012,25 @@

    lib/outward.js

    - + - + - + - + @@ -32837,13 +33042,13 @@

    lib/outward.js

    - + - + @@ -32855,7 +33060,7 @@

    lib/outward.js

    - + @@ -32867,7 +33072,7 @@

    lib/outward.js

    - + @@ -32891,7 +33096,7 @@

    lib/outward.js

    - + @@ -33083,7 +33288,7 @@

    lib/outward.js

    - + @@ -33137,7 +33342,7 @@

    lib/outward.js

    - + @@ -33149,7 +33354,7 @@

    lib/outward.js

    - + @@ -33167,7 +33372,7 @@

    lib/outward.js

    - + @@ -33203,7 +33408,7 @@

    lib/outward.js

    - + @@ -33215,13 +33420,13 @@

    lib/outward.js

    - + - + @@ -33263,7 +33468,7 @@

    lib/outward.js

    - + @@ -37783,7 +37988,7 @@

    lib/print.js

    - + @@ -38129,13 +38334,13 @@

    lib/ready.js

    - + - + @@ -38147,7 +38352,7 @@

    lib/ready.js

    - + @@ -38171,7 +38376,7 @@

    lib/ready.js

    - + @@ -38213,7 +38418,7 @@

    lib/ready.js

    - + @@ -38225,13 +38430,13 @@

    lib/ready.js

    - + - + @@ -38243,7 +38448,7 @@

    lib/ready.js

    - + @@ -38297,13 +38502,13 @@

    lib/ready.js

    - + - + @@ -38315,13 +38520,13 @@

    lib/ready.js

    - + - + @@ -38333,13 +38538,13 @@

    lib/ready.js

    - + - + @@ -38381,13 +38586,13 @@

    lib/ready.js

    - + - + @@ -38399,19 +38604,19 @@

    lib/ready.js

    - + - + - + diff --git a/test/message.test.js b/test/message.test.js index b7550006..d11f00e6 100644 --- a/test/message.test.js +++ b/test/message.test.js @@ -18,14 +18,13 @@ var Seneca = require('..') var Transports = require('./stubs/transports.js') -var parents = (meta,i) => meta.parents.map((x) => x[null==i?0:i]) +var parents = (meta, i) => meta.parents.map((x) => x[null == i ? 0 : i]) var partial_match = (obj, pat) => Hoek.contain(obj, pat, { deep: true, part: true }) var is_uniq = (arr) => arr.length === new Set(arr).size - var test_opts = { parallel: false, timeout: 5555 * tmx } describe('message', function () { @@ -49,7 +48,7 @@ describe('message', function () { expect(parents(meta)).equal(['a:2', 'a:1']) // Ensure no duplicate message ids - expect(is_uniq(parents(meta,1))).true() + expect(is_uniq(parents(meta, 1))).true() expect(msg.x2).equal(2) @@ -58,8 +57,8 @@ describe('message', function () { }) .add('a:4', function a4(msg, reply, meta) { expect(parents(meta)).equal(['a:3', 'a:2', 'a:1']) - expect(is_uniq(parents(meta,1))).true() - + expect(is_uniq(parents(meta, 1))).true() + expect(msg.x3).equal(3) var m4 = { x4: msg.x } @@ -73,7 +72,6 @@ describe('message', function () { }) }) - it('complex-parents', test_opts, function (fin) { var mark = {} Seneca({ tag: 'h0' }) @@ -82,62 +80,62 @@ describe('message', function () { //console.log('CP ', meta.action, meta.pattern, parents(meta), meta.trace) expect(parents(meta)).equal([]) - mark.a1c=1 + mark.a1c = 1 this.act('a:2', msg) //console.log('CP t', meta.action, meta.trace) - - this.act('a:3', msg, function(err, out, meta) { - mark.a3r=1 + + this.act('a:3', msg, function (err, out, meta) { + mark.a3r = 1 //console.log('CP tr', meta.action, meta.trace) - + this.act('a:4', msg) - this.act('a:5', msg, function(err, out, meta) { - mark.a5r=1 + this.act('a:5', msg, function (err, out, meta) { + mark.a5r = 1 //console.log('CP trr', meta.action, meta.trace) - + reply() }) }) }) .add('a:2', function a2(msg, reply, meta) { //console.log('CP ', meta.action, meta.pattern, parents(meta), meta.trace) - + //expect(parents(meta)).equal(['a:1']) //expect(msg.x1).equal(msg.x) - mark.a2c=1 + mark.a2c = 1 //this.act('a:3', msg, reply) reply(msg) }) .add('a:3', function a3(msg, reply, meta) { //console.log('CP ', meta.action, meta.pattern, parents(meta), meta.trace) - + //expect(parents(meta)).equal(['a:2', 'a:1']) //expect(msg.x2).equal(msg.x) - mark.a3c=1 + mark.a3c = 1 //this.act('a:4', msg, reply) reply(msg) }) .add('a:4', function a4(msg, reply, meta) { //console.log('CP ', meta.action, meta.pattern, parents(meta), meta.trace) - + //expect(parents(meta)).equal(['a:3', 'a:2', 'a:1']) //expect(msg.x3).equal(msg.x) - mark.a4c=1 + mark.a4c = 1 reply(msg) }) .add('a:5', function a4(msg, reply, meta) { //console.log('CP ', meta.action, meta.pattern, parents(meta), meta.trace) - + //expect(parents(meta)).equal(['a:3', 'a:2', 'a:1']) //expect(msg.x3).equal(msg.x) - mark.a5c=1 + mark.a5c = 1 reply(msg) }) .act('a:1,x:10,y:20', function (err, out, meta) { @@ -148,22 +146,21 @@ describe('message', function () { */ //console.log('CP mark', mark) - expect(JSON.stringify(mark)) - .equal('{"a1c":1,"a2c":1,"a3c":1,"a3r":1,"a4c":1,"a5c":1,"a5r":1}') + expect(JSON.stringify(mark)).equal( + '{"a1c":1,"a2c":1,"a3c":1,"a3r":1,"a4c":1,"a5c":1,"a5r":1}' + ) //console.dir(meta,{depth:null}) - + fin() }) }) - - it('loop', test_opts, function (fin) { var i = 0 Seneca({ id$: 'loop', idlen: 4, log: 'silent', limits: { maxparents: 3 } }) .add('a:1', function a1(msg, reply, meta) { - expect(is_uniq(parents(meta,1))).true() + expect(is_uniq(parents(meta, 1))).true() i++ if (4 < i) { @@ -185,7 +182,6 @@ describe('message', function () { }) }) - it('branch', test_opts, function (fin) { var log = [] Seneca({ id$: 'branch', idlen: 4, limits: { maxparents: 3 } }) @@ -221,15 +217,15 @@ describe('message', function () { }) .add('a:3', function a3(msg, reply, meta) { expect(parents(meta)).equal(['a:2', 'a:1']) - expect(is_uniq(parents(meta,1))).true() + expect(is_uniq(parents(meta, 1))).true() log.push('a3') this.act('a:4', { a3: 1 }, reply) }) .add('a:4', function a3(msg, reply, meta) { expect(parents(meta)).equal(['a:3', 'a:2', 'a:1']) - expect(is_uniq(parents(meta,1))).true() - + expect(is_uniq(parents(meta, 1))).true() + log.push('a4') reply({ a4: 1 }) }) @@ -240,15 +236,15 @@ describe('message', function () { }) .add('c:1', function c1(msg, reply, meta) { expect(parents(meta)).equal(['a:2', 'a:1']) - expect(is_uniq(parents(meta,1))).true() - + expect(is_uniq(parents(meta, 1))).true() + log.push('c1') reply() }) .add('c:2', function c2(msg, reply, meta) { expect(parents(meta)).equal(['a:3', 'a:2', 'a:1']) - expect(is_uniq(parents(meta,1))).true() - + expect(is_uniq(parents(meta, 1))).true() + log.push('c2') reply() }) diff --git a/test/sub.test.js b/test/sub.test.js index e7fa2943..78418ae3 100644 --- a/test/sub.test.js +++ b/test/sub.test.js @@ -479,8 +479,6 @@ describe('sub', function () { }) }) - - it('sub-once', function (fin) { var log = [] Seneca() @@ -497,10 +495,9 @@ describe('sub', function () { .act('c:1,a:1') - .ready(function() { + .ready(function () { expect(log).equal(['s2']) fin() }) }) - })
    30 28322829 var meta = data.meta
    32 28322829 if (ctxt.actdef) {
    33 23962393 var fixed = ctxt.actdef.fixed
    34 23962393 var custom = ctxt.actdef.custom
    37 23962393 Object.assign(data.msg, fixed)
    41 23962393 meta.custom = meta.custom || {}
    42 23962393 Object.assign(meta.custom, custom)
    48 23932389 var so = ctxt.options
    49 23932389 var meta = data.meta
    68 23942390 if (!ctxt.actdef) return
    75 23922388 ctxt.seneca.emit('act-in', data.msg, null, data.meta)
    80 28322829 if (ctxt.seneca.flags.closed && !data.meta.closing) {
    96 23942390 var private$ = ctxt.seneca.private$
    97 23942390 ++private$.stats.act.calls
    99 23942390 var pattern = ctxt.actdef.pattern
    101 23942390 var actstats = (private$.stats.actmap[pattern] =
    104 23942390 ++actstats.calls
    108 28302826 var so = ctxt.options
    109 28302826 var msg = data.msg
    110 28302826 var meta = data.meta
    113 28302826 if (!ctxt.actdef) {
    145 24052401 var so = ctxt.options
    146 24052401 var msg = data.msg
    148 24052401 if (!ctxt.actdef) {
    165 23942390 var so = ctxt.options
    166 23942390 var msg = data.msg
    168 23942390 if ('function' !== typeof ctxt.actdef.validate) {
    169 23922388 return
    204 28312828 var so = ctxt.options
    205 28312828 var meta = data.meta
    207 28312828 var actid = meta.id
    208 28312828 var private$ = ctxt.seneca.private$
    211 28312828 var actdetails = private$.history.get(actid)
    213 28312828 if (actdetails) {
    214 12 private$.stats.act.cache++
    216
    var latest =
    actdetails.result[actdetails.result.length - 1]
    ||
    {}
    2 var latest = actdetails.result[actdetails.result.length - 1] || {}
    217
    218 12 var out = {
    kind:
    latest.err
    ?
    'error'
    : 'result',
    220
    result:
    latest.res
    ||
    null
    ,
    result: latest.res || null,
    221
    232 12 ctxt.cached$ = true
    234 12 return out
    240 23932389 var so = ctxt.options
    241 23932389 var msg = data.msg
    256 23932389 var meta = data.meta
    258 23932389 meta.pattern = ctxt.actdef.pattern
    259 23932389 meta.client_pattern = ctxt.actdef.client_pattern
    260 23932389 meta.action = ctxt.actdef.id
    261 23932389 meta.plugin = Object.assign({}, meta.plugin, ctxt.actdef.plugin)
    263 23932389 meta.parents = meta.parents || []
    274 23932389 if (parent) {
    275 301297 meta.parents = meta.parents.concat(parent.parents || [])
    276 301297 meta.parents.unshift(Common.make_trace_desc(parent))
    279 23932389 meta.custom = Object.assign(
    294 23932389 if (ctxt.seneca.private$.explain) {
    301 23922388 var meta = data.meta
    303 23922388 ctxt.seneca.fixedargs.tx$ = data.meta.tx
    305 23922388 data.reply = data.reply.bind(ctxt.seneca)
    306 23922388 data.reply.seneca = ctxt.seneca
    308 23922388 var reply = data.reply
    311 23922388 ctxt.seneca.good = function good(out) {
    319 23922388 ctxt.seneca.bad = function bad(err) {
    326 23922388 ctxt.seneca.reply = function reply(err, out) {
    330 23922388 ctxt.seneca.explain = intern.explain.bind(ctxt.seneca, meta)
    331 23922388 if (meta.explain) {
    337 23922388 var meta = data.meta
    338 23922388 var private$ = ctxt.seneca.private$
    341 23922388 if (meta.prior) {
    342 10399 return
    127 183184 var logstr = Common.stringify(entry)
    128 183184 this.private$.print.log(logstr)
    268 1786617889 } else if ('string' === typeof entry) {
    272 1786617889 var logspec = instance.private$.logspec
    273 1786617889 entry.level = entry.level || logspec.default_level
    275 1786617889 if ('number' !== typeof entry.level) {
    281 1786617889 var now = new Date()
    285 1786617889 entry.isot = entry.isot || now.toISOString()
    286 1786617889 entry.when = entry.when || now.getTime()
    287 1786617889 entry.level_name = entry.level_name || logspec.level_text[entry.level]
    288 1786617889 entry.seneca_id = entry.seneca_id || instance.id
    290 1786617889 if (instance.did) {
    291 1197511981 entry.seneca_did = entry.seneca_did || instance.did
    294 1786617889 if (instance.fixedargs.plugin$) {
    295 1183611842 entry.plugin_name = entry.plugin_name || instance.fixedargs.plugin$.name
    299 1786617889 if (instance.private$.act) {
    300 53815383 intern.build_act_entry(instance.private$.act, entry)
    304 1786617889 instance.emit('log', entry)
    306 1786617889 var level_match = logspec.live_level <= entry.level
    308 1786617889 if (level_match) {
    309 615623 instance.private$.logger.call(this, entry)
    312 1786617889 return this
    335 1782317846 entry.level = level
    336 1782317846 return self.log(entry)
    449 53835385 entry.actid = entry.actid || act.meta.id
    450 53835385 entry.pattern = entry.pattern || act.meta.pattern
    451 53835385 entry.action = entry.action || act.def.id
    453 53835385 entry.idpath = ('' + act.meta.tx).substring(0, 5)
    454 53835385 if (act.meta.parents) {
    455 49424943 for (var i = 0; i < act.meta.parents.length; i++) {
    456 10911064 entry.idpath += (
    461 53835385 entry.idpath += ('.' + act.meta.mi).substring(0, 6)
    224 2126321268 return options
    29 28262827 if (!ctxt.options.legacy.error) {
    43 28242825 Assert(ctxt.options)
    45 28242825 var so = ctxt.options
    46 28242825 var res = data.res
    47 28242825 var meta = data.meta
    49 28242825 var actid = meta.id
    50 28242825 var private$ = ctxt.seneca.private$
    53 28242825 var actdetails = private$.history.get(actid)
    55 28242825 if (actdetails) {
    56 23832379 actdetails.result.push({ when: Date.now(), res: res })
    62 28252826 if (!ctxt.actdef || ctxt.cached$) {
    63 437438 return
    74 22852289 private$.timestats.point(ctxt.duration, ctxt.actdef.pattern)
    83 6266 ++stats.fails
    84 6266 ++actstats.fails
    86 23262322 ++actstats.done
    91 28242825 Assert(ctxt.options)
    93 28242825 var so = ctxt.options
    94 28242825 var msg = data.msg
    95 28242825 var res = data.res
    97 28242825 if (void 0 === data.res) {
    98 621620 data.res = null
    101 28242825 var not_object =
    113 28242825 if (data.out instanceof Error) {
    117 28242825 var not_legacy = !(
    138 28242825 var meta = data.meta
    140 28242825 if (meta.error) {
    141 8690 return
    148 27382735 ctxt.seneca.emit('act-out', data.msg, data.res, data.meta)
    150 27382735 ctxt.seneca.log.debug(
    162 28242825 var private$ = ctxt.seneca.private$
    164 28242825 var meta = data.meta
    165 28242825 var reply_meta = data.reply_meta
    169 233230 meta.trace.push({
    176 28242825 if (parent_meta) {
    177 302299 parent_meta.trace = parent_meta.trace || []
    178 302299 parent_meta.trace.push({
    186 28242825 var meta = data.meta
    187 28242825 var reply_meta = data.reply_meta
    190 233230 meta.custom = Object.assign(meta.custom, reply_meta.custom)
    195 28242825 var delegate = ctxt.seneca
    196 28242825 var actdef = ctxt.actdef
    197 28242825 var meta = data.meta
    199 28242825 if (meta.error) {
    200 8690 data.error_desc = intern.act_error(delegate, ctxt, data)
    202 8690 if (meta.fatal) {
    204 59 return delegate.die(data.error_desc.err)
    221 27382735 data.err = null
    226 28242825 var delegate = ctxt.seneca
    233 28242825 var meta = data.meta
    234 28242825 var private$ = ctxt.seneca.private$
    237 28242825 if (meta.prior) {
    238 103100 return
    241 27212725 var submsg = ctxt.seneca.util.clean(data.msg)
    245 27212725 var sub_actions_list = private$.subrouter.outward.find(submsg, false, true)
    247 27212725 submsg.out$ = true
    252 27212725 for (var alI = 0; alI < sub_actions_list.length; alI++) {
    273 8690 var act_callpoint = ctxt.callpoint
    274 8690 var actdef = ctxt.actdef || {}
    275 8690 var origmsg = ctxt.origmsg
    276 8690 var reply = ctxt.reply
    278 8690 var meta = data.meta
    279 8690 var msg = data.msg
    281 8690 var opts = instance.options()
    283 8690 var call_cb = true
    287 8690 if (!err.seneca) {
    319 4347 } else if (
    328 8690 if (opts.legacy.error) {
    330 5861 err.details.plugin = err.details.plugin || {}
    333 8690 var entry = ctxt.actlog(actdef, msg, meta, origmsg, {
    339 8690 entry = ctxt.errlog(err, entry)
    341 8690 instance.log.error(entry)
    342 8690 instance.emit('act-err', msg, err)
    349 8690 return {
    49 369370 konsole_log.apply(konsole_log, arguments)
    31 641642 if ('function' === typeof ready_func) {
    32 637638 var private$ = self.root.private$
    34 637638 var ready_call = function () {
    38 637638 var ready_name =
    45 637638 Object.defineProperty(ready_call, 'name', { value: ready_name })
    47 637638 if (private$.ge.isclear()) {
    48 608600 execute_ready(self, ready_call)
    50 2938 private$.ready_list.push(ready_call)
    59 544548 const root = this
    60 544548 var private$ = root.private$
    62 544548 root.emit('ready')
    63 544548 execute_ready(root, private$.ready_list.shift())
    65 544548 if (private$.ge.isclear()) {
    66 543547 while (0 < private$.ready_list.length) {
    73 16791666 if (null == ready_func) return
    74 629634 var opts = instance.options()
    76 629634 try {
    77 629634 instance.log.debug({ kind: 'ready', case: 'call', name: ready_func.name })
    78 629634 ready_func()