From 1505795d07a42f2f4dbbf3ff01789021c402cf26 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Thu, 25 Aug 2022 03:30:23 -0700 Subject: [PATCH 1/7] fix: update dependencies --- .npmrc | 1 + package.json | 30 ++++---- pnpm-lock.yaml | 204 ++++++++++++++++++++++++++----------------------- tsconfig.json | 4 +- 4 files changed, 127 insertions(+), 112 deletions(-) diff --git a/.npmrc b/.npmrc index ac5613f6..d8ede7ab 100644 --- a/.npmrc +++ b/.npmrc @@ -2,3 +2,4 @@ public-hoist-pattern[]=* package-lock=false lockfile=true prefer-frozen-lockfile=false +strict-peer-dependencies=false diff --git a/package.json b/package.json index 3fa3cc41..729f3b24 100644 --- a/package.json +++ b/package.json @@ -17,35 +17,35 @@ "url": "https://github.com/zeromq/zeromq.js.git" }, "dependencies": { - "node-gyp-build": "^4.2.3" + "node-gyp-build": "^4.5.0" }, "devDependencies": { "@gnd/typedoc": "^0.15.0-0", - "@types/chai": ">=4.2", - "@types/fs-extra": "^9.0.12", - "@types/mocha": ">=8.2", - "@types/node": ">=16.3", + "@types/chai": ">=4.3", + "@types/fs-extra": "^9.0.13", + "@types/mocha": ">=9.1", + "@types/node": ">=18.7", "@types/semver": ">=7", - "@types/weak-napi": "^2.0.0", + "@types/weak-napi": "^2.0.1", "benchmark": ">=2", "chai": ">=4.3", "choma": ">= 1.2", - "deasync": "^0.1.21", + "deasync": "^0.1.28", "eslint-config-atomic": "^1.18.1", "eslint-plugin-prettier": "^4.2.1", - "fs-extra": "^10.0.0", + "fs-extra": "^10.1.0", "gunzip-maybe": "^1.4.2", - "mocha": ">=9.0", - "node-addon-api": "^4.0.0", - "node-fetch": "^2.6.1", - "prebuildify": "^4.1.2", + "mocha": ">=10.0", + "node-addon-api": "^5.0.0", + "node-fetch": "^3.2.10", + "prebuildify": "^5.0.1", "prettier": "^2.7.1", "semver": ">=7", - "shx": "^0.3.3", + "shx": "^0.3.4", "tar-fs": "^2.1.1", - "ts-morph": "^11.0.3", + "ts-morph": "^16.0.0", "ts-node": ">=10", - "typescript": "4.3", + "typescript": "4.8", "weak-napi": "^2.0.2" }, "engines": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b424fb9f..c7992e1a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -2,32 +2,32 @@ lockfileVersion: 5.4 specifiers: '@gnd/typedoc': ^0.15.0-0 - '@types/chai': '>=4.2' - '@types/fs-extra': ^9.0.12 - '@types/mocha': '>=8.2' - '@types/node': '>=16.3' + '@types/chai': '>=4.3' + '@types/fs-extra': ^9.0.13 + '@types/mocha': '>=9.1' + '@types/node': '>=18.7' '@types/semver': '>=7' - '@types/weak-napi': ^2.0.0 + '@types/weak-napi': ^2.0.1 benchmark: '>=2' chai: '>=4.3' choma: '>= 1.2' - deasync: ^0.1.21 + deasync: ^0.1.28 eslint-config-atomic: ^1.18.1 eslint-plugin-prettier: ^4.2.1 - fs-extra: ^10.0.0 + fs-extra: ^10.1.0 gunzip-maybe: ^1.4.2 - mocha: '>=9.0' - node-addon-api: ^4.0.0 - node-fetch: ^2.6.1 - node-gyp-build: ^4.2.3 - prebuildify: ^4.1.2 + mocha: '>=10.0' + node-addon-api: ^5.0.0 + node-fetch: ^3.2.10 + node-gyp-build: ^4.5.0 + prebuildify: ^5.0.1 prettier: ^2.7.1 semver: '>=7' - shx: ^0.3.3 + shx: ^0.3.4 tar-fs: ^2.1.1 - ts-morph: ^11.0.3 + ts-morph: ^16.0.0 ts-node: '>=10' - typescript: '4.3' + typescript: '4.8' weak-napi: ^2.0.2 dependencies: @@ -50,16 +50,16 @@ devDependencies: fs-extra: 10.1.0 gunzip-maybe: 1.4.2 mocha: 10.0.0 - node-addon-api: 4.3.0 - node-fetch: 2.6.7 - prebuildify: 4.2.1 + node-addon-api: 5.0.0 + node-fetch: 3.2.10 + prebuildify: 5.0.1 prettier: 2.7.1 semver: 7.3.7 shx: 0.3.4 tar-fs: 2.1.1 - ts-morph: 11.0.3 - ts-node: 10.9.1_ckbdxqkkfqe3aau5baiq6k5aji - typescript: 4.3.5 + ts-morph: 16.0.0 + ts-node: 10.9.1_hwinnrf7y5nyyzygpj45jmvjia + typescript: 4.8.2 weak-napi: 2.0.2 packages: @@ -453,11 +453,11 @@ packages: fastq: 1.13.0 dev: true - /@ts-morph/common/0.10.1: - resolution: {integrity: sha512-rKN/VtZUUlW4M+6vjLFSaFc1Z9sK+1hh0832ucPtPkXqOw/mSWE80Lau4z2zTPNTqtxAjfZbvKpQcEwJy0KIEg==} + /@ts-morph/common/0.17.0: + resolution: {integrity: sha512-RMSSvSfs9kb0VzkvQ2NWobwnj7TxCA9vI/IjR9bDHqgAyVbu2T0DN4wiKVqomyDWqO7dPr/tErSfq7urQ1Q37g==} dependencies: fast-glob: 3.2.11 - minimatch: 3.1.2 + minimatch: 5.1.0 mkdirp: 1.0.4 path-browserify: 1.0.1 dev: true @@ -522,7 +522,7 @@ packages: '@types/node': 18.7.13 dev: true - /@typescript-eslint/eslint-plugin/5.35.1_ktjxjibzrfqejavile4bhmzhjq: + /@typescript-eslint/eslint-plugin/5.35.1_4kgehhvxgrxdvptdn2db7re534: resolution: {integrity: sha512-RBZZXZlI4XCY4Wzgy64vB+0slT9+yAPQRjj/HSaRwUot33xbDjF1oN9BLwOLTewoOI0jothIltZRe9uJCHf8gg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -533,23 +533,23 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/parser': 5.35.1_4rv7y5c6xz3vfxwhbrcxxi73bq + '@typescript-eslint/parser': 5.35.1_shit3uhl6a7megkzgoz6xssnfa '@typescript-eslint/scope-manager': 5.35.1 - '@typescript-eslint/type-utils': 5.35.1_4rv7y5c6xz3vfxwhbrcxxi73bq - '@typescript-eslint/utils': 5.35.1_4rv7y5c6xz3vfxwhbrcxxi73bq + '@typescript-eslint/type-utils': 5.35.1_shit3uhl6a7megkzgoz6xssnfa + '@typescript-eslint/utils': 5.35.1_shit3uhl6a7megkzgoz6xssnfa debug: 4.3.4 eslint: 8.22.0 functional-red-black-tree: 1.0.1 ignore: 5.2.0 regexpp: 3.2.0 semver: 7.3.7 - tsutils: 3.21.0_typescript@4.7.4 - typescript: 4.7.4 + tsutils: 3.21.0_typescript@4.8.2 + typescript: 4.8.2 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/parser/5.35.1_4rv7y5c6xz3vfxwhbrcxxi73bq: + /@typescript-eslint/parser/5.35.1_shit3uhl6a7megkzgoz6xssnfa: resolution: {integrity: sha512-XL2TBTSrh3yWAsMYpKseBYTVpvudNf69rPOWXWVBI08My2JVT5jR66eTt4IgQFHA/giiKJW5dUD4x/ZviCKyGg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -561,10 +561,10 @@ packages: dependencies: '@typescript-eslint/scope-manager': 5.35.1 '@typescript-eslint/types': 5.35.1 - '@typescript-eslint/typescript-estree': 5.35.1_typescript@4.7.4 + '@typescript-eslint/typescript-estree': 5.35.1_typescript@4.8.2 debug: 4.3.4 eslint: 8.22.0 - typescript: 4.7.4 + typescript: 4.8.2 transitivePeerDependencies: - supports-color dev: true @@ -577,7 +577,7 @@ packages: '@typescript-eslint/visitor-keys': 5.35.1 dev: true - /@typescript-eslint/type-utils/5.35.1_4rv7y5c6xz3vfxwhbrcxxi73bq: + /@typescript-eslint/type-utils/5.35.1_shit3uhl6a7megkzgoz6xssnfa: resolution: {integrity: sha512-8xT8ljvo43Mp7BiTn1vxLXkjpw8wS4oAc00hMSB4L1/jIiYbjjnc3Qp2GAUOG/v8zsNCd1qwcqfCQ0BuishHkw==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -587,11 +587,11 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/utils': 5.35.1_4rv7y5c6xz3vfxwhbrcxxi73bq + '@typescript-eslint/utils': 5.35.1_shit3uhl6a7megkzgoz6xssnfa debug: 4.3.4 eslint: 8.22.0 - tsutils: 3.21.0_typescript@4.7.4 - typescript: 4.7.4 + tsutils: 3.21.0_typescript@4.8.2 + typescript: 4.8.2 transitivePeerDependencies: - supports-color dev: true @@ -601,7 +601,7 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true - /@typescript-eslint/typescript-estree/5.35.1_typescript@4.7.4: + /@typescript-eslint/typescript-estree/5.35.1_typescript@4.8.2: resolution: {integrity: sha512-JUqE1+VRTGyoXlDWWjm6MdfpBYVq+hixytrv1oyjYIBEOZhBCwtpp5ZSvBt4wIA1MKWlnaC2UXl2XmYGC3BoQA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -616,13 +616,13 @@ packages: globby: 11.1.0 is-glob: 4.0.3 semver: 7.3.7 - tsutils: 3.21.0_typescript@4.7.4 - typescript: 4.7.4 + tsutils: 3.21.0_typescript@4.8.2 + typescript: 4.8.2 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/utils/5.35.1_4rv7y5c6xz3vfxwhbrcxxi73bq: + /@typescript-eslint/utils/5.35.1_shit3uhl6a7megkzgoz6xssnfa: resolution: {integrity: sha512-v6F8JNXgeBWI4pzZn36hT2HXXzoBBBJuOYvoQiaQaEEjdi5STzux3Yj8v7ODIpx36i/5s8TdzuQ54TPc5AITQQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -631,7 +631,7 @@ packages: '@types/json-schema': 7.0.11 '@typescript-eslint/scope-manager': 5.35.1 '@typescript-eslint/types': 5.35.1 - '@typescript-eslint/typescript-estree': 5.35.1_typescript@4.7.4 + '@typescript-eslint/typescript-estree': 5.35.1_typescript@4.8.2 eslint: 8.22.0 eslint-scope: 5.1.1 eslint-utils: 3.0.0_eslint@8.22.0 @@ -1085,8 +1085,8 @@ packages: wrap-ansi: 7.0.0 dev: true - /code-block-writer/10.1.1: - resolution: {integrity: sha512-67ueh2IRGst/51p0n6FvPrnRjAGHY5F8xdjkgrYE7DDzpJe6qA07RYQ9VcoUeo5ATOjSOiWpSL3SWBRRbempMw==} + /code-block-writer/11.0.3: + resolution: {integrity: sha512-NiujjUFB4SwScJq2bwbYUtXbZhBSlY6vYzm++3Q6oC+U+injTqfPYFK8wS9COOmb2lueqp0ZRB4nK1VYeHgNyw==} dev: true /coffeescript/1.12.7: @@ -1181,6 +1181,11 @@ packages: dev: true optional: true + /data-uri-to-buffer/4.0.0: + resolution: {integrity: sha512-Vr3mLBA8qWmcuschSLAOogKgQ/Jwxulv3RNE4FXnYWRGujzrRWQI4m12fQqRkwX06C0KanhLr4hK+GydchZsaA==} + engines: {node: '>= 12'} + dev: true + /date-now/0.1.4: resolution: {integrity: sha512-AsElvov3LoNB7tf5k37H2jYSB+ZZPMT5sG2QjJCcdlV5chIv6htBUBUui2IKRjgtKAKtCBN7Zbwa+MtwLjSeNw==} dev: true @@ -1496,8 +1501,8 @@ packages: '@babel/eslint-parser': 7.18.9_i2zlx7awpychpyuxyfseoqk6n4 '@babel/plugin-syntax-flow': 7.18.6_@babel+core@7.18.13 '@babel/plugin-syntax-jsx': 7.18.6_@babel+core@7.18.13 - '@typescript-eslint/eslint-plugin': 5.35.1_ktjxjibzrfqejavile4bhmzhjq - '@typescript-eslint/parser': 5.35.1_4rv7y5c6xz3vfxwhbrcxxi73bq + '@typescript-eslint/eslint-plugin': 5.35.1_4kgehhvxgrxdvptdn2db7re534 + '@typescript-eslint/parser': 5.35.1_shit3uhl6a7megkzgoz6xssnfa eslint: 8.22.0 eslint-config-prettier: 8.5.0_eslint@8.22.0 eslint-plugin-html: 6.2.0 @@ -1511,7 +1516,7 @@ packages: prettier: 2.6.2 read-pkg-up: 7.0.1 semver: 7.3.7 - typescript: 4.7.4 + typescript: 4.8.2 optionalDependencies: coffeescript: 1.12.7 eslint-plugin-coffee: 0.1.15_3jfu2bo3ghrhfqed2cmcdlharm @@ -1561,7 +1566,7 @@ packages: eslint-import-resolver-webpack: optional: true dependencies: - '@typescript-eslint/parser': 5.35.1_4rv7y5c6xz3vfxwhbrcxxi73bq + '@typescript-eslint/parser': 5.35.1_shit3uhl6a7megkzgoz6xssnfa debug: 3.2.7 eslint: 8.22.0 eslint-import-resolver-node: 0.3.6 @@ -1628,7 +1633,7 @@ packages: '@typescript-eslint/parser': optional: true dependencies: - '@typescript-eslint/parser': 5.35.1_4rv7y5c6xz3vfxwhbrcxxi73bq + '@typescript-eslint/parser': 5.35.1_shit3uhl6a7megkzgoz6xssnfa array-includes: 3.1.5 array.prototype.flat: 1.3.0 debug: 2.6.9 @@ -1993,6 +1998,14 @@ packages: reusify: 1.0.4 dev: true + /fetch-blob/3.2.0: + resolution: {integrity: sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==} + engines: {node: ^12.20 || >= 14.13} + dependencies: + node-domexception: 1.0.0 + web-streams-polyfill: 3.2.1 + dev: true + /file-entry-cache/6.0.1: resolution: {integrity: sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==} engines: {node: ^10.12.0 || >=12.0.0} @@ -2044,6 +2057,13 @@ packages: resolution: {integrity: sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==} dev: true + /formdata-polyfill/4.0.10: + resolution: {integrity: sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==} + engines: {node: '>=12.20.0'} + dependencies: + fetch-blob: 3.2.0 + dev: true + /fs-constants/1.0.0: resolution: {integrity: sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==} dev: true @@ -2735,6 +2755,13 @@ packages: brace-expansion: 2.0.1 dev: true + /minimatch/5.1.0: + resolution: {integrity: sha512-9TPBGGak4nHfGZsPBohm9AWg6NoT7QTCehS3BIJABslyZbzxfV78QM2Y6+i741OPZIafFAaiiEMh5OyIrJPgtg==} + engines: {node: '>=10'} + dependencies: + brace-expansion: 2.0.1 + dev: true + /minimist/1.2.6: resolution: {integrity: sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==} dev: true @@ -2804,10 +2831,11 @@ packages: resolution: {integrity: sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==} dev: true - /node-abi/2.30.1: - resolution: {integrity: sha512-/2D0wOQPgaUWzVSVgRMx+trKJRC2UG4SUc4oCJoXx9Uxjtp0Vy3/kt7zcbxHF8+Z/pK3UloLWzBISg72brfy1w==} + /node-abi/3.24.0: + resolution: {integrity: sha512-YPG3Co0luSu6GwOBsmIdGW6Wx0NyNDLg/hriIyDllVsNwnI6UeqaWShxC3lbH4LtEQUgoLP3XR1ndXiDAWvmRw==} + engines: {node: '>=10'} dependencies: - semver: 5.7.1 + semver: 7.3.7 dev: true /node-addon-api/1.7.2: @@ -2818,20 +2846,22 @@ packages: resolution: {integrity: sha512-mmcei9JghVNDYydghQmeDX8KoAm0FAiYyIcUt/N4nhyAipB17pllZQDOJD2fotxABnt4Mdz+dKTO7eftLg4d0A==} dev: true - /node-addon-api/4.3.0: - resolution: {integrity: sha512-73sE9+3UaLYYFmDsFZnqCInzPyh3MqIwZO9cw58yIqAZhONrrabrYyYe3TuIqtIiOuTXVhsGau8hcrhhwSsDIQ==} + /node-addon-api/5.0.0: + resolution: {integrity: sha512-CvkDw2OEnme7ybCykJpVcKH+uAOLV2qLqiyla128dN9TkEWfrYmxG6C2boDe5KcNQqZF3orkqzGgOMvZ/JNekA==} dev: true - /node-fetch/2.6.7: - resolution: {integrity: sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==} - engines: {node: 4.x || >=6.0.0} - peerDependencies: - encoding: ^0.1.0 - peerDependenciesMeta: - encoding: - optional: true + /node-domexception/1.0.0: + resolution: {integrity: sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==} + engines: {node: '>=10.5.0'} + dev: true + + /node-fetch/3.2.10: + resolution: {integrity: sha512-MhuzNwdURnZ1Cp4XTazr69K0BTizsBroX7Zx3UgDSVcZYKF/6p0CBe4EUb/hLqmzVhl0UpYfgRljQ4yxE+iCxA==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} dependencies: - whatwg-url: 5.0.0 + data-uri-to-buffer: 4.0.0 + fetch-blob: 3.2.0 + formdata-polyfill: 4.0.10 dev: true /node-gyp-build/4.5.0: @@ -3046,14 +3076,14 @@ packages: resolution: {integrity: sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg==} dev: true - /prebuildify/4.2.1: - resolution: {integrity: sha512-FFgf3jHbh404ZuM++Cr0nMhK/VIgpyzscEXXiZCX1gbQz1ktg0s4hFKr9nXQKDLA3De98BvqNZODfqvm0maA2w==} + /prebuildify/5.0.1: + resolution: {integrity: sha512-vXpKLfIEsDCqMJWVIoSrUUBJQIuAk9uHAkLiGJuTdXdqKSJ10sHmWeuNCDkIoRFTV1BDGYMghHVmDFP8NfkA2Q==} hasBin: true dependencies: execspawn: 1.0.1 minimist: 1.2.6 mkdirp-classic: 0.5.3 - node-abi: 2.30.1 + node-abi: 3.24.0 npm-run-path: 3.1.0 pump: 3.0.0 tar-fs: 2.1.1 @@ -3563,18 +3593,14 @@ packages: is-number: 7.0.0 dev: true - /tr46/0.0.3: - resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} - dev: true - - /ts-morph/11.0.3: - resolution: {integrity: sha512-ymuPkndv9rzqTLiHWMkVrFXWcN4nBiBGhRP/kTC9F5amAAl7BNLfyrsTzMD1o9A0zishKoF1KQT/0yyFhJnPgA==} + /ts-morph/16.0.0: + resolution: {integrity: sha512-jGNF0GVpFj0orFw55LTsQxVYEUOCWBAbR5Ls7fTYE5pQsbW18ssTb/6UXx/GYAEjS+DQTp8VoTw0vqYMiaaQuw==} dependencies: - '@ts-morph/common': 0.10.1 - code-block-writer: 10.1.1 + '@ts-morph/common': 0.17.0 + code-block-writer: 11.0.3 dev: true - /ts-node/10.9.1_ckbdxqkkfqe3aau5baiq6k5aji: + /ts-node/10.9.1_hwinnrf7y5nyyzygpj45jmvjia: resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==} hasBin: true peerDependencies: @@ -3600,7 +3626,7 @@ packages: create-require: 1.1.1 diff: 4.0.2 make-error: 1.3.6 - typescript: 4.3.5 + typescript: 4.8.2 v8-compile-cache-lib: 3.0.1 yn: 3.1.1 dev: true @@ -3618,14 +3644,14 @@ packages: resolution: {integrity: sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==} dev: true - /tsutils/3.21.0_typescript@4.7.4: + /tsutils/3.21.0_typescript@4.8.2: resolution: {integrity: sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==} engines: {node: '>= 6'} peerDependencies: typescript: '>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta' dependencies: tslib: 1.14.1 - typescript: 4.7.4 + typescript: 4.8.2 dev: true /type-check/0.4.0: @@ -3671,14 +3697,8 @@ packages: hasBin: true dev: true - /typescript/4.3.5: - resolution: {integrity: sha512-DqQgihaQ9cUrskJo9kIyW/+g0Vxsk8cDtZ52a3NGh0YNTfpUSArXSohyUGnvbPazEPLu398C0UxmKSOrPumUzA==} - engines: {node: '>=4.2.0'} - hasBin: true - dev: true - - /typescript/4.7.4: - resolution: {integrity: sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==} + /typescript/4.8.2: + resolution: {integrity: sha512-C0I1UsrrDHo2fYI5oaCGbSejwX4ch+9Y5jTQELvovfmFkK3HHSZJB8MSJcWLmCUBzQBchCrZ9rMRV6GuNrvGtw==} engines: {node: '>=4.2.0'} hasBin: true dev: true @@ -3789,15 +3809,9 @@ packages: setimmediate-napi: 1.0.6 dev: true - /webidl-conversions/3.0.1: - resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==} - dev: true - - /whatwg-url/5.0.0: - resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==} - dependencies: - tr46: 0.0.3 - webidl-conversions: 3.0.1 + /web-streams-polyfill/3.2.1: + resolution: {integrity: sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==} + engines: {node: '>= 8'} dev: true /which-boxed-primitive/1.0.2: diff --git a/tsconfig.json b/tsconfig.json index 5b5085c3..26da2dcf 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,13 +2,13 @@ "exclude": ["*.d.ts"], "compilerOptions": { "allowJs": false, - "target": "es2018", + "target": "ES2020", "outDir": "lib", "declaration": true, "module": "commonjs", "types": ["node", "mocha"], "strict": true, "strictPropertyInitialization": false, - "lib": ["es2018", "dom"] + "lib": ["ES2020", "dom"] } } From 76b72b09dba59cef6f43a117f35ae1e0fe55121c Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Thu, 25 Aug 2022 03:52:17 -0700 Subject: [PATCH 2/7] fix: fix typescript errors due to Error --- src/compat.ts | 4 ++-- src/index.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/compat.ts b/src/compat.ts index 8afab3b4..d97ff162 100644 --- a/src/compat.ts +++ b/src/compat.ts @@ -325,7 +325,7 @@ class Socket extends EventEmitter { } } } catch (err) { - if (!this._socket.closed && err.code !== "EBUSY") { + if (!this._socket.closed && (err as {code?: string}).code !== "EBUSY") { process.nextTick(() => this.emit("error", err)) } } @@ -348,7 +348,7 @@ class Socket extends EventEmitter { } } catch (err) { if (cb) { - cb(err) + cb(err as Error) } else { this.emit("error", err) } diff --git a/src/index.ts b/src/index.ts index ba050fd2..963b254c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -290,7 +290,7 @@ function asyncIterator, U>(this: T) { try { return {value: await this.receive(), done: false} } catch (err) { - if (this.closed && err.code === "EAGAIN") { + if (this.closed && (err as {code?: string}).code === "EAGAIN") { /* Cast so we can omit 'value: undefined'. */ return {done: true} as IteratorReturnResult } else { From 67247144efbfda61e52addedc17ba13ed5d9f584 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Sun, 4 Sep 2022 20:53:08 -0700 Subject: [PATCH 3/7] feat: add FullError with extra properties --- src/compat.ts | 3 ++- src/errors.ts | 9 +++++++++ src/index.ts | 3 ++- 3 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 src/errors.ts diff --git a/src/compat.ts b/src/compat.ts index d97ff162..0d6d440d 100644 --- a/src/compat.ts +++ b/src/compat.ts @@ -29,6 +29,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. import {EventEmitter} from "events" import * as zmq from "." +import {FullError} from "./errors" type AnySocket = | zmq.Pair @@ -325,7 +326,7 @@ class Socket extends EventEmitter { } } } catch (err) { - if (!this._socket.closed && (err as {code?: string}).code !== "EBUSY") { + if (!this._socket.closed && (err as FullError).code !== "EBUSY") { process.nextTick(() => this.emit("error", err)) } } diff --git a/src/errors.ts b/src/errors.ts new file mode 100644 index 00000000..de2768e1 --- /dev/null +++ b/src/errors.ts @@ -0,0 +1,9 @@ +export interface FullError extends Error { + code?: string + errno?: number + address?: string +} + +export function isFullError(err: unknown): err is FullError { + return err instanceof Error +} diff --git a/src/index.ts b/src/index.ts index 963b254c..0a6683ca 100644 --- a/src/index.ts +++ b/src/index.ts @@ -27,6 +27,7 @@ import { } from "./native" import * as draft from "./draft" +import {FullError} from "./errors" const {send, receive} = methods @@ -290,7 +291,7 @@ function asyncIterator, U>(this: T) { try { return {value: await this.receive(), done: false} } catch (err) { - if (this.closed && (err as {code?: string}).code === "EAGAIN") { + if (this.closed && (err as FullError).code === "EAGAIN") { /* Cast so we can omit 'value: undefined'. */ return {done: true} as IteratorReturnResult } else { From 3e57d2334ec99b33c904171bb7ea45e6069b316a Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Mon, 5 Sep 2022 02:46:47 -0700 Subject: [PATCH 4/7] test: use isFullError checks in the tests --- .../unit/compat/socket-error-callback-test.js | 4 +- test/unit/compat/socket-monitor-test.js | 4 +- test/unit/proxy-construction-test.ts | 7 +++- test/unit/proxy-run-test.ts | 17 ++++++-- test/unit/proxy-terminate-test.ts | 5 ++- test/unit/socket-bind-unbind-test.ts | 29 +++++++++---- test/unit/socket-close-test.ts | 9 +++- test/unit/socket-connect-disconnect-test.ts | 21 +++++++--- test/unit/socket-construction-test.ts | 13 ++++-- test/unit/socket-draft-server-client-test.ts | 5 ++- test/unit/socket-events-test.ts | 5 ++- test/unit/socket-req-rep-test.ts | 5 ++- test/unit/socket-router-dealer-test.ts | 5 ++- test/unit/socket-send-receive-test.ts | 41 ++++++++++++++----- 14 files changed, 130 insertions(+), 40 deletions(-) diff --git a/test/unit/compat/socket-error-callback-test.js b/test/unit/compat/socket-error-callback-test.js index d7d60117..d3c95fd0 100644 --- a/test/unit/compat/socket-error-callback-test.js +++ b/test/unit/compat/socket-error-callback-test.js @@ -20,7 +20,9 @@ if (process.env.INCLUDE_COMPAT_TESTS) { it("should callback with error when not connected", function (done) { sock.send(["foo", "bar"], null, err => { - assert.instanceOf(err, Error) + if (!isFullError(err)) { + throw err + } sock.close() done() }) diff --git a/test/unit/compat/socket-monitor-test.js b/test/unit/compat/socket-monitor-test.js index ced0d3c2..77c37b4f 100644 --- a/test/unit/compat/socket-monitor-test.js +++ b/test/unit/compat/socket-monitor-test.js @@ -77,7 +77,9 @@ if (process.env.INCLUDE_COMPAT_TESTS) { }) doubleRep.bind(address, err => { - assert.instanceOf(err, Error) + if (!isFullError(err)) { + throw err + } }) }) }) diff --git a/test/unit/proxy-construction-test.ts b/test/unit/proxy-construction-test.ts index 0275d101..c3f224d0 100644 --- a/test/unit/proxy-construction-test.ts +++ b/test/unit/proxy-construction-test.ts @@ -2,6 +2,7 @@ import * as semver from "semver" import * as zmq from "../../src" import {assert} from "chai" +import {isFullError} from "../../src/errors" describe("proxy construction", function () { beforeEach(function () { @@ -50,8 +51,10 @@ describe("proxy construction", function () { new (zmq.Proxy as any)({}, {}) assert.ok(false) } catch (err) { - assert.instanceOf(err, Error) - assert.oneOf(err.message, [ + if (!isFullError(err)) { + throw err + } + assert.oneOf((err as Error).message, [ "Invalid pointer passed as argument" /* before 8.7 */, "Invalid argument" /* as of 8.7 */, ]) diff --git a/test/unit/proxy-run-test.ts b/test/unit/proxy-run-test.ts index 08e875ff..f73011c9 100644 --- a/test/unit/proxy-run-test.ts +++ b/test/unit/proxy-run-test.ts @@ -3,6 +3,7 @@ import * as zmq from "../../src" import {assert} from "chai" import {testProtos, uniqAddress} from "./helpers" +import {isFullError} from "../../src/errors" for (const proto of testProtos("tcp", "ipc", "inproc")) { describe(`proxy with ${proto} run`, function () { @@ -30,7 +31,9 @@ for (const proto of testProtos("tcp", "ipc", "inproc")) { await proxy.run() assert.ok(false) } catch (err) { - assert.instanceOf(err, Error) + if (!isFullError(err)) { + throw err + } assert.equal(err.message, "Front-end socket must be bound or connected") } }) @@ -44,7 +47,9 @@ for (const proto of testProtos("tcp", "ipc", "inproc")) { await proxy.run() assert.ok(false) } catch (err) { - assert.instanceOf(err, Error) + if (!isFullError(err)) { + throw err + } assert.equal(err.message, "Front-end socket must be bound or connected") } }) @@ -56,7 +61,9 @@ for (const proto of testProtos("tcp", "ipc", "inproc")) { await proxy.run() assert.ok(false) } catch (err) { - assert.instanceOf(err, Error) + if (!isFullError(err)) { + throw err + } assert.equal(err.message, "Back-end socket must be bound or connected") assert.equal(err.code, "EINVAL") assert.typeOf(err.errno, "number") @@ -72,7 +79,9 @@ for (const proto of testProtos("tcp", "ipc", "inproc")) { await proxy.run() assert.ok(false) } catch (err) { - assert.instanceOf(err, Error) + if (!isFullError(err)) { + throw err + } assert.equal(err.message, "Back-end socket must be bound or connected") assert.equal(err.code, "EINVAL") assert.typeOf(err.errno, "number") diff --git a/test/unit/proxy-terminate-test.ts b/test/unit/proxy-terminate-test.ts index 29d45485..2d4afea8 100644 --- a/test/unit/proxy-terminate-test.ts +++ b/test/unit/proxy-terminate-test.ts @@ -3,6 +3,7 @@ import * as zmq from "../../src" import {assert} from "chai" import {testProtos, uniqAddress} from "./helpers" +import {isFullError} from "../../src/errors" for (const proto of testProtos("tcp", "ipc", "inproc")) { describe(`proxy with ${proto} terminate`, function () { @@ -34,7 +35,9 @@ for (const proto of testProtos("tcp", "ipc", "inproc")) { await proxy.terminate() assert.ok(false) } catch (err) { - assert.instanceOf(err, Error) + if (!isFullError(err)) { + throw err + } assert.equal(err.message, "Socket is closed") assert.equal(err.code, "EBADF") assert.typeOf(err.errno, "number") diff --git a/test/unit/socket-bind-unbind-test.ts b/test/unit/socket-bind-unbind-test.ts index ef8cc765..81bcabda 100644 --- a/test/unit/socket-bind-unbind-test.ts +++ b/test/unit/socket-bind-unbind-test.ts @@ -2,6 +2,7 @@ import * as zmq from "../../src" import {assert} from "chai" import {testProtos, uniqAddress} from "./helpers" +import {isFullError} from "../../src/errors" for (const proto of testProtos("tcp", "ipc", "inproc")) { describe(`socket with ${proto} bind/unbind`, function () { @@ -28,7 +29,9 @@ for (const proto of testProtos("tcp", "ipc", "inproc")) { await sock.unbind(address) assert.ok(false) } catch (err) { - assert.instanceOf(err, Error) + if (!isFullError(err)) { + throw err + } assert.equal(err.message, "No such endpoint") assert.equal(err.code, "ENOENT") assert.typeOf(err.errno, "number") @@ -41,7 +44,9 @@ for (const proto of testProtos("tcp", "ipc", "inproc")) { await sock.bind("foo-bar") assert.ok(false) } catch (err) { - assert.instanceOf(err, Error) + if (!isFullError(err)) { + throw err + } assert.equal(err.message, "Invalid argument") assert.equal(err.code, "EINVAL") assert.typeOf(err.errno, "number") @@ -54,7 +59,9 @@ for (const proto of testProtos("tcp", "ipc", "inproc")) { await sock.bind("foo://bar") assert.ok(false) } catch (err) { - assert.instanceOf(err, Error) + if (!isFullError(err)) { + throw err + } assert.equal(err.message, "Protocol not supported") assert.equal(err.code, "EPROTONOSUPPORT") assert.typeOf(err.errno, "number") @@ -69,7 +76,9 @@ for (const proto of testProtos("tcp", "ipc", "inproc")) { await sock.bind(uniqAddress(proto)) assert.ok(false) } catch (err) { - assert.instanceOf(err, Error) + if (!isFullError(err)) { + throw err + } assert.equal( err.message, "Socket is blocked by a bind or unbind operation", @@ -94,7 +103,9 @@ for (const proto of testProtos("tcp", "ipc", "inproc")) { await sock.unbind("foo-bar") assert.ok(false) } catch (err) { - assert.instanceOf(err, Error) + if (!isFullError(err)) { + throw err + } assert.equal(err.message, "Invalid argument") assert.equal(err.code, "EINVAL") assert.typeOf(err.errno, "number") @@ -107,7 +118,9 @@ for (const proto of testProtos("tcp", "ipc", "inproc")) { await sock.unbind("foo://bar") assert.ok(false) } catch (err) { - assert.instanceOf(err, Error) + if (!isFullError(err)) { + throw err + } assert.equal(err.message, "Protocol not supported") assert.equal(err.code, "EPROTONOSUPPORT") assert.typeOf(err.errno, "number") @@ -124,7 +137,9 @@ for (const proto of testProtos("tcp", "ipc", "inproc")) { await sock.unbind(address) assert.ok(false) } catch (err) { - assert.instanceOf(err, Error) + if (!isFullError(err)) { + throw err + } assert.equal( err.message, "Socket is blocked by a bind or unbind operation", diff --git a/test/unit/socket-close-test.ts b/test/unit/socket-close-test.ts index 29695035..1bf27b70 100644 --- a/test/unit/socket-close-test.ts +++ b/test/unit/socket-close-test.ts @@ -3,6 +3,7 @@ import * as zmq from "../../src" import {assert} from "chai" import {testProtos, uniqAddress} from "./helpers" +import {isFullError} from "../../src/errors" for (const proto of testProtos("tcp", "ipc", "inproc")) { describe(`socket with ${proto} close`, function () { @@ -32,7 +33,9 @@ for (const proto of testProtos("tcp", "ipc", "inproc")) { try { await promise } catch (err) { - assert.instanceOf(err, Error) + if (!isFullError(err)) { + throw err + } assert.equal(err.message, "Operation was not possible or timed out") assert.equal(err.code, "EAGAIN") assert.typeOf(err.errno, "number") @@ -47,7 +50,9 @@ for (const proto of testProtos("tcp", "ipc", "inproc")) { try { await promise } catch (err) { - assert.instanceOf(err, Error) + if (!isFullError(err)) { + throw err + } assert.equal(err.message, "Operation was not possible or timed out") assert.equal(err.code, "EAGAIN") assert.typeOf(err.errno, "number") diff --git a/test/unit/socket-connect-disconnect-test.ts b/test/unit/socket-connect-disconnect-test.ts index 60ad1d1c..3d9a39b4 100644 --- a/test/unit/socket-connect-disconnect-test.ts +++ b/test/unit/socket-connect-disconnect-test.ts @@ -3,6 +3,7 @@ import * as zmq from "../../src" import {assert} from "chai" import {testProtos, uniqAddress} from "./helpers" +import {isFullError} from "../../src/errors" for (const proto of testProtos("tcp", "ipc", "inproc")) { describe(`socket with ${proto} connect/disconnect`, function () { @@ -23,7 +24,9 @@ for (const proto of testProtos("tcp", "ipc", "inproc")) { await sock.connect("foo-bar") assert.ok(false) } catch (err) { - assert.instanceOf(err, Error) + if (!isFullError(err)) { + throw err + } assert.equal(err.message, "Invalid argument") assert.equal(err.code, "EINVAL") assert.typeOf(err.errno, "number") @@ -36,7 +39,9 @@ for (const proto of testProtos("tcp", "ipc", "inproc")) { await sock.connect("foo://bar") assert.ok(false) } catch (err) { - assert.instanceOf(err, Error) + if (!isFullError(err)) { + throw err + } assert.equal(err.message, "Protocol not supported") assert.equal(err.code, "EPROTONOSUPPORT") assert.typeOf(err.errno, "number") @@ -60,7 +65,9 @@ for (const proto of testProtos("tcp", "ipc", "inproc")) { await sock.disconnect(address) assert.ok(false) } catch (err) { - assert.instanceOf(err, Error) + if (!isFullError(err)) { + throw err + } assert.equal(err.message, "No such endpoint") assert.equal(err.code, "ENOENT") assert.typeOf(err.errno, "number") @@ -73,7 +80,9 @@ for (const proto of testProtos("tcp", "ipc", "inproc")) { await sock.disconnect("foo-bar") assert.ok(false) } catch (err) { - assert.instanceOf(err, Error) + if (!isFullError(err)) { + throw err + } assert.equal(err.message, "Invalid argument") assert.equal(err.code, "EINVAL") assert.typeOf(err.errno, "number") @@ -86,7 +95,9 @@ for (const proto of testProtos("tcp", "ipc", "inproc")) { await sock.disconnect("foo://bar") assert.ok(false) } catch (err) { - assert.instanceOf(err, Error) + if (!isFullError(err)) { + throw err + } assert.equal(err.message, "Protocol not supported") assert.equal(err.code, "EPROTONOSUPPORT") assert.typeOf(err.errno, "number") diff --git a/test/unit/socket-construction-test.ts b/test/unit/socket-construction-test.ts index b6b75b26..813dd039 100644 --- a/test/unit/socket-construction-test.ts +++ b/test/unit/socket-construction-test.ts @@ -1,6 +1,7 @@ import * as zmq from "../../src" import {assert} from "chai" +import {isFullError} from "../../src/errors" describe("socket construction", function () { afterEach(function () { @@ -53,7 +54,9 @@ describe("socket construction", function () { new (zmq.Socket as any)(37, new zmq.Context()) assert.ok(false) } catch (err) { - assert.instanceOf(err, Error) + if (!isFullError(err)) { + throw err + } assert.equal(err.message, "Invalid argument") assert.equal(err.code, "EINVAL") assert.typeOf(err.errno, "number") @@ -65,7 +68,9 @@ describe("socket construction", function () { new (zmq.Socket as any)(1, {context: {}}) assert.ok(false) } catch (err) { - assert.instanceOf(err, Error) + if (!isFullError(err)) { + throw err + } assert.oneOf(err.message, [ "Invalid pointer passed as argument" /* before 8.7 */, "Invalid argument" /* as of 8.7 */, @@ -177,7 +182,9 @@ describe("socket construction", function () { sockets.push(new zmq.Dealer({context})) } } catch (err) { - assert.instanceOf(err, Error) + if (!isFullError(err)) { + throw err + } assert.equal(err.message, "Too many open file descriptors") assert.equal(err.code, "EMFILE") assert.typeOf(err.errno, "number") diff --git a/test/unit/socket-draft-server-client-test.ts b/test/unit/socket-draft-server-client-test.ts index 52809575..2ab34347 100644 --- a/test/unit/socket-draft-server-client-test.ts +++ b/test/unit/socket-draft-server-client-test.ts @@ -3,6 +3,7 @@ import * as draft from "../../src/draft" import {assert} from "chai" import {testProtos, uniqAddress} from "./helpers" +import {isFullError} from "../../src/errors" if (zmq.capability.draft) { for (const proto of testProtos("tcp", "ipc", "inproc")) { @@ -75,7 +76,9 @@ if (zmq.capability.draft) { await server.send("foo", {routingId: 12345}) assert.ok(false) } catch (err) { - assert.instanceOf(err, Error) + if (!isFullError(err)) { + throw err + } assert.equal(err.message, "Host unreachable") assert.equal(err.code, "EHOSTUNREACH") diff --git a/test/unit/socket-events-test.ts b/test/unit/socket-events-test.ts index 422a4c63..91b24190 100644 --- a/test/unit/socket-events-test.ts +++ b/test/unit/socket-events-test.ts @@ -7,6 +7,7 @@ import { testProtos, uniqAddress, } from "./helpers" +import {isFullError} from "../../src/errors" for (const proto of testProtos("tcp", "ipc", "inproc")) { describe(`socket with ${proto} events`, function () { @@ -150,7 +151,9 @@ for (const proto of testProtos("tcp", "ipc", "inproc")) { await events.receive() assert.ok(false) } catch (err) { - assert.instanceOf(err, Error) + if (!isFullError(err)) { + throw err + } assert.equal(err.message, "Socket is closed") assert.equal(err.code, "EBADF") assert.typeOf(err.errno, "number") diff --git a/test/unit/socket-req-rep-test.ts b/test/unit/socket-req-rep-test.ts index 8e0e96d7..b3690067 100644 --- a/test/unit/socket-req-rep-test.ts +++ b/test/unit/socket-req-rep-test.ts @@ -2,6 +2,7 @@ import * as zmq from "../../src" import {assert} from "chai" import {testProtos, uniqAddress} from "./helpers" +import {isFullError} from "../../src/errors" for (const proto of testProtos("tcp", "ipc", "inproc")) { describe(`socket with ${proto} req/rep`, function () { @@ -88,7 +89,9 @@ for (const proto of testProtos("tcp", "ipc", "inproc")) { await req.send(Buffer.from("bar")) assert.ok(false) } catch (err) { - assert.instanceOf(err, Error) + if (!isFullError(err)) { + throw err + } assert.equal( err.message, "Operation cannot be accomplished in current state", diff --git a/test/unit/socket-router-dealer-test.ts b/test/unit/socket-router-dealer-test.ts index bdeecfbd..d564ac56 100644 --- a/test/unit/socket-router-dealer-test.ts +++ b/test/unit/socket-router-dealer-test.ts @@ -3,6 +3,7 @@ import * as zmq from "../../src" import {assert} from "chai" import {testProtos, uniqAddress} from "./helpers" +import {isFullError} from "../../src/errors" for (const proto of testProtos("tcp", "ipc", "inproc")) { describe(`socket with ${proto} router/dealer`, function () { @@ -77,7 +78,9 @@ for (const proto of testProtos("tcp", "ipc", "inproc")) { await router.send(["fooId", "foo"]) assert.ok(false) } catch (err) { - assert.instanceOf(err, Error) + if (!isFullError(err)) { + throw err + } assert.equal(err.message, "Host unreachable") assert.equal(err.code, "EHOSTUNREACH") diff --git a/test/unit/socket-send-receive-test.ts b/test/unit/socket-send-receive-test.ts index 7bd9dbf8..7246bec2 100644 --- a/test/unit/socket-send-receive-test.ts +++ b/test/unit/socket-send-receive-test.ts @@ -3,6 +3,7 @@ import * as zmq from "../../src" import {assert} from "chai" import {testProtos, uniqAddress} from "./helpers" +import {isFullError} from "../../src/errors" for (const proto of testProtos("tcp", "ipc", "inproc")) { describe(`socket with ${proto} send/receive`, function () { @@ -25,7 +26,9 @@ for (const proto of testProtos("tcp", "ipc", "inproc")) { try { ;(new zmq.Subscriber() as any).send() } catch (err) { - assert.instanceOf(err, Error) + if (!isFullError(err)) { + throw err + } assert.include(err.message, "send is not a function") } }) @@ -34,7 +37,9 @@ for (const proto of testProtos("tcp", "ipc", "inproc")) { try { ;(new zmq.Publisher() as any).receive() } catch (err) { - assert.instanceOf(err, Error) + if (!isFullError(err)) { + throw err + } assert.include(err.message, "receive is not a function") } }) @@ -45,7 +50,9 @@ for (const proto of testProtos("tcp", "ipc", "inproc")) { for await (const msg of new zmq.Publisher() as any) { } } catch (err) { - assert.instanceOf(err, Error) + if (!isFullError(err)) { + throw err + } assert.include(err.message, "receive is not a function") } }) @@ -72,7 +79,9 @@ for (const proto of testProtos("tcp", "ipc", "inproc")) { await sockA.send(Buffer.alloc(8192)) assert.ok(false) } catch (err) { - assert.instanceOf(err, Error) + if (!isFullError(err)) { + throw err + } assert.equal(err.message, "Operation was not possible or timed out") assert.equal(err.code, "EAGAIN") assert.typeOf(err.errno, "number") @@ -312,7 +321,9 @@ for (const proto of testProtos("tcp", "ipc", "inproc")) { await sockA.receive() assert.ok(false) } catch (err) { - assert.instanceOf(err, Error) + if (!isFullError(err)) { + throw err + } assert.equal(err.message, "Operation was not possible or timed out") assert.equal(err.code, "EAGAIN") assert.typeOf(err.errno, "number") @@ -502,7 +513,9 @@ for (const proto of testProtos("tcp", "ipc", "inproc")) { await sockA.send(Buffer.alloc(8192)) assert.ok(false) } catch (err) { - assert.instanceOf(err, Error) + if (!isFullError(err)) { + throw err + } assert.equal(err.message, "Socket is closed") assert.equal(err.code, "EBADF") assert.typeOf(err.errno, "number") @@ -514,7 +527,9 @@ for (const proto of testProtos("tcp", "ipc", "inproc")) { await sockA.receive() assert.ok(false) } catch (err) { - assert.instanceOf(err, Error) + if (!isFullError(err)) { + throw err + } assert.equal(err.message, "Socket is closed") assert.equal(err.code, "EBADF") assert.typeOf(err.errno, "number") @@ -539,7 +554,9 @@ for (const proto of testProtos("tcp", "ipc", "inproc")) { } assert.ok(false) } catch (err) { - assert.instanceOf(err, Error) + if (!isFullError(err)) { + throw err + } assert.equal( err.message, "Operation cannot be accomplished in current state", @@ -558,7 +575,9 @@ for (const proto of testProtos("tcp", "ipc", "inproc")) { sockA.send(null).catch(() => null) assert.ok(false) } catch (err) { - assert.instanceOf(err, Error) + if (!isFullError(err)) { + throw err + } assert.equal( err.message, "Socket is busy writing; only one send operation may be in progress at any time", @@ -577,7 +596,9 @@ for (const proto of testProtos("tcp", "ipc", "inproc")) { sockA.receive().catch(() => null) assert.ok(false) } catch (err) { - assert.instanceOf(err, Error) + if (!isFullError(err)) { + throw err + } assert.equal( err.message, "Socket is busy reading; only one receive operation may be in progress at any time", From a7143e2486f5e35ac93b35d29916aa5b239c6873 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Mon, 5 Sep 2022 02:47:59 -0700 Subject: [PATCH 5/7] fix: disable eslint error for exported interfaces due to errors --- src/draft.ts | 2 ++ src/index.ts | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/draft.ts b/src/draft.ts index b528b557..4cb8f97a 100644 --- a/src/draft.ts +++ b/src/draft.ts @@ -38,6 +38,7 @@ interface RadioGroupOptions { group: Buffer | string } +// eslint-disable-next-line @typescript-eslint/no-empty-interface export interface Radio extends Writable {} Object.assign(Radio.prototype, {send}) @@ -66,6 +67,7 @@ interface DishGroupOptions { group: Buffer } +// eslint-disable-next-line @typescript-eslint/no-empty-interface export interface Dish extends Readable<[Message, DishGroupOptions]> {} Object.assign(Dish.prototype, {receive}) diff --git a/src/index.ts b/src/index.ts index 0a6683ca..6a9483e9 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1026,6 +1026,7 @@ export class Publisher extends Socket { } } +// eslint-disable-next-line @typescript-eslint/no-empty-interface export interface Publisher extends Writable {} Object.assign(Publisher.prototype, {send}) @@ -1125,6 +1126,7 @@ export class Subscriber extends Socket { } } +// eslint-disable-next-line @typescript-eslint/no-empty-interface export interface Subscriber extends Readable {} Object.assign(Subscriber.prototype, {receive}) From 0968681e73c19474315b08531509a07f9dfb96b8 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Mon, 5 Sep 2022 02:58:52 -0700 Subject: [PATCH 6/7] build: disable lto due to failures on macos --- binding.gyp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/binding.gyp b/binding.gyp index b7a8eefd..d21ccb42 100644 --- a/binding.gyp +++ b/binding.gyp @@ -171,7 +171,7 @@ ], 'cflags_cc+': [ '-std=c++17', - '-flto', + # '-flto', '-Wno-missing-field-initializers', ], }], @@ -182,7 +182,7 @@ 'CLANG_CXX_LIBRARY': 'libc++', 'CLANG_CXX_LANGUAGE_STANDARD': 'c++17', 'MACOSX_DEPLOYMENT_TARGET': '10.9', - 'LLVM_LTO': 'YES', + # 'LLVM_LTO': 'YES', 'GCC_OPTIMIZATION_LEVEL': '3', 'DEPLOYMENT_POSTPROCESSING': 'YES', 'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', From 6364fddf067ca5f692fac4a5607e9a80c8357b90 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Mon, 5 Sep 2022 02:59:44 -0700 Subject: [PATCH 7/7] build: taget macos 10.15 --- binding.gyp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/binding.gyp b/binding.gyp index d21ccb42..6ccb2149 100644 --- a/binding.gyp +++ b/binding.gyp @@ -181,7 +181,7 @@ 'xcode_settings': { 'CLANG_CXX_LIBRARY': 'libc++', 'CLANG_CXX_LANGUAGE_STANDARD': 'c++17', - 'MACOSX_DEPLOYMENT_TARGET': '10.9', + 'MACOSX_DEPLOYMENT_TARGET': '10.15', # 'LLVM_LTO': 'YES', 'GCC_OPTIMIZATION_LEVEL': '3', 'DEPLOYMENT_POSTPROCESSING': 'YES',