@machhub-dev/node-red-nodes 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +373 -0
- package/dist/lib/config/machhub-env-loader.js +93 -0
- package/dist/lib/enums/data.enums.js +12 -0
- package/dist/lib/errors/errors.js +15 -0
- package/dist/lib/models/collections.model.js +2 -0
- package/dist/lib/models/machine.models.js +2 -0
- package/dist/lib/models/product.models.js +2 -0
- package/dist/lib/models/recordId.models.js +11 -0
- package/dist/lib/services/http.api.services.js +152 -0
- package/dist/lib/services/http.service.js +188 -0
- package/dist/lib/services/mqtt.service.js +234 -0
- package/dist/nodes/bulk-tag-write.html +91 -0
- package/dist/nodes/bulk-tag-write.js +118 -0
- package/dist/nodes/collections.html +508 -0
- package/dist/nodes/collections.js +241 -0
- package/dist/nodes/dbquery.html +131 -0
- package/dist/nodes/dbquery.js +83 -0
- package/dist/nodes/machhub-config.html +39 -0
- package/dist/nodes/machhub-config.js +15 -0
- package/dist/nodes/tag-read.html +194 -0
- package/dist/nodes/tag-read.js +133 -0
- package/dist/nodes/tag-write.html +162 -0
- package/dist/nodes/tag-write.js +110 -0
- package/node_modules/@babel/runtime/LICENSE +22 -0
- package/node_modules/@babel/runtime/README.md +19 -0
- package/node_modules/@babel/runtime/helpers/AwaitValue.js +4 -0
- package/node_modules/@babel/runtime/helpers/OverloadYield.js +4 -0
- package/node_modules/@babel/runtime/helpers/applyDecoratedDescriptor.js +9 -0
- package/node_modules/@babel/runtime/helpers/applyDecs.js +236 -0
- package/node_modules/@babel/runtime/helpers/applyDecs2203.js +184 -0
- package/node_modules/@babel/runtime/helpers/applyDecs2203R.js +191 -0
- package/node_modules/@babel/runtime/helpers/applyDecs2301.js +222 -0
- package/node_modules/@babel/runtime/helpers/applyDecs2305.js +133 -0
- package/node_modules/@babel/runtime/helpers/applyDecs2311.js +124 -0
- package/node_modules/@babel/runtime/helpers/arrayLikeToArray.js +6 -0
- package/node_modules/@babel/runtime/helpers/arrayWithHoles.js +4 -0
- package/node_modules/@babel/runtime/helpers/arrayWithoutHoles.js +5 -0
- package/node_modules/@babel/runtime/helpers/assertClassBrand.js +5 -0
- package/node_modules/@babel/runtime/helpers/assertThisInitialized.js +5 -0
- package/node_modules/@babel/runtime/helpers/asyncGeneratorDelegate.js +24 -0
- package/node_modules/@babel/runtime/helpers/asyncIterator.js +45 -0
- package/node_modules/@babel/runtime/helpers/asyncToGenerator.js +26 -0
- package/node_modules/@babel/runtime/helpers/awaitAsyncGenerator.js +5 -0
- package/node_modules/@babel/runtime/helpers/callSuper.js +7 -0
- package/node_modules/@babel/runtime/helpers/checkInRHS.js +6 -0
- package/node_modules/@babel/runtime/helpers/checkPrivateRedeclaration.js +4 -0
- package/node_modules/@babel/runtime/helpers/classApplyDescriptorDestructureSet.js +10 -0
- package/node_modules/@babel/runtime/helpers/classApplyDescriptorGet.js +4 -0
- package/node_modules/@babel/runtime/helpers/classApplyDescriptorSet.js +7 -0
- package/node_modules/@babel/runtime/helpers/classCallCheck.js +4 -0
- package/node_modules/@babel/runtime/helpers/classCheckPrivateStaticAccess.js +5 -0
- package/node_modules/@babel/runtime/helpers/classCheckPrivateStaticFieldDescriptor.js +4 -0
- package/node_modules/@babel/runtime/helpers/classExtractFieldDescriptor.js +5 -0
- package/node_modules/@babel/runtime/helpers/classNameTDZError.js +4 -0
- package/node_modules/@babel/runtime/helpers/classPrivateFieldDestructureSet.js +7 -0
- package/node_modules/@babel/runtime/helpers/classPrivateFieldGet.js +7 -0
- package/node_modules/@babel/runtime/helpers/classPrivateFieldGet2.js +5 -0
- package/node_modules/@babel/runtime/helpers/classPrivateFieldInitSpec.js +5 -0
- package/node_modules/@babel/runtime/helpers/classPrivateFieldLooseBase.js +5 -0
- package/node_modules/@babel/runtime/helpers/classPrivateFieldLooseKey.js +5 -0
- package/node_modules/@babel/runtime/helpers/classPrivateFieldSet.js +7 -0
- package/node_modules/@babel/runtime/helpers/classPrivateFieldSet2.js +5 -0
- package/node_modules/@babel/runtime/helpers/classPrivateGetter.js +5 -0
- package/node_modules/@babel/runtime/helpers/classPrivateMethodGet.js +5 -0
- package/node_modules/@babel/runtime/helpers/classPrivateMethodInitSpec.js +5 -0
- package/node_modules/@babel/runtime/helpers/classPrivateMethodSet.js +4 -0
- package/node_modules/@babel/runtime/helpers/classPrivateSetter.js +5 -0
- package/node_modules/@babel/runtime/helpers/classStaticPrivateFieldDestructureSet.js +7 -0
- package/node_modules/@babel/runtime/helpers/classStaticPrivateFieldSpecGet.js +7 -0
- package/node_modules/@babel/runtime/helpers/classStaticPrivateFieldSpecSet.js +7 -0
- package/node_modules/@babel/runtime/helpers/classStaticPrivateMethodGet.js +5 -0
- package/node_modules/@babel/runtime/helpers/classStaticPrivateMethodSet.js +4 -0
- package/node_modules/@babel/runtime/helpers/construct.js +10 -0
- package/node_modules/@babel/runtime/helpers/createClass.js +13 -0
- package/node_modules/@babel/runtime/helpers/createForOfIteratorHelper.js +50 -0
- package/node_modules/@babel/runtime/helpers/createForOfIteratorHelperLoose.js +19 -0
- package/node_modules/@babel/runtime/helpers/createSuper.js +16 -0
- package/node_modules/@babel/runtime/helpers/decorate.js +250 -0
- package/node_modules/@babel/runtime/helpers/defaults.js +9 -0
- package/node_modules/@babel/runtime/helpers/defineAccessor.js +8 -0
- package/node_modules/@babel/runtime/helpers/defineEnumerableProperties.js +12 -0
- package/node_modules/@babel/runtime/helpers/defineProperty.js +10 -0
- package/node_modules/@babel/runtime/helpers/dispose.js +28 -0
- package/node_modules/@babel/runtime/helpers/esm/AwaitValue.js +4 -0
- package/node_modules/@babel/runtime/helpers/esm/OverloadYield.js +4 -0
- package/node_modules/@babel/runtime/helpers/esm/applyDecoratedDescriptor.js +9 -0
- package/node_modules/@babel/runtime/helpers/esm/applyDecs.js +236 -0
- package/node_modules/@babel/runtime/helpers/esm/applyDecs2203.js +184 -0
- package/node_modules/@babel/runtime/helpers/esm/applyDecs2203R.js +191 -0
- package/node_modules/@babel/runtime/helpers/esm/applyDecs2301.js +222 -0
- package/node_modules/@babel/runtime/helpers/esm/applyDecs2305.js +133 -0
- package/node_modules/@babel/runtime/helpers/esm/applyDecs2311.js +124 -0
- package/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js +6 -0
- package/node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js +4 -0
- package/node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js +5 -0
- package/node_modules/@babel/runtime/helpers/esm/assertClassBrand.js +5 -0
- package/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js +5 -0
- package/node_modules/@babel/runtime/helpers/esm/asyncGeneratorDelegate.js +24 -0
- package/node_modules/@babel/runtime/helpers/esm/asyncIterator.js +45 -0
- package/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js +26 -0
- package/node_modules/@babel/runtime/helpers/esm/awaitAsyncGenerator.js +5 -0
- package/node_modules/@babel/runtime/helpers/esm/callSuper.js +7 -0
- package/node_modules/@babel/runtime/helpers/esm/checkInRHS.js +6 -0
- package/node_modules/@babel/runtime/helpers/esm/checkPrivateRedeclaration.js +4 -0
- package/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorDestructureSet.js +10 -0
- package/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorGet.js +4 -0
- package/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorSet.js +7 -0
- package/node_modules/@babel/runtime/helpers/esm/classCallCheck.js +4 -0
- package/node_modules/@babel/runtime/helpers/esm/classCheckPrivateStaticAccess.js +5 -0
- package/node_modules/@babel/runtime/helpers/esm/classCheckPrivateStaticFieldDescriptor.js +4 -0
- package/node_modules/@babel/runtime/helpers/esm/classExtractFieldDescriptor.js +5 -0
- package/node_modules/@babel/runtime/helpers/esm/classNameTDZError.js +4 -0
- package/node_modules/@babel/runtime/helpers/esm/classPrivateFieldDestructureSet.js +7 -0
- package/node_modules/@babel/runtime/helpers/esm/classPrivateFieldGet.js +7 -0
- package/node_modules/@babel/runtime/helpers/esm/classPrivateFieldGet2.js +5 -0
- package/node_modules/@babel/runtime/helpers/esm/classPrivateFieldInitSpec.js +5 -0
- package/node_modules/@babel/runtime/helpers/esm/classPrivateFieldLooseBase.js +5 -0
- package/node_modules/@babel/runtime/helpers/esm/classPrivateFieldLooseKey.js +5 -0
- package/node_modules/@babel/runtime/helpers/esm/classPrivateFieldSet.js +7 -0
- package/node_modules/@babel/runtime/helpers/esm/classPrivateFieldSet2.js +5 -0
- package/node_modules/@babel/runtime/helpers/esm/classPrivateGetter.js +5 -0
- package/node_modules/@babel/runtime/helpers/esm/classPrivateMethodGet.js +5 -0
- package/node_modules/@babel/runtime/helpers/esm/classPrivateMethodInitSpec.js +5 -0
- package/node_modules/@babel/runtime/helpers/esm/classPrivateMethodSet.js +4 -0
- package/node_modules/@babel/runtime/helpers/esm/classPrivateSetter.js +5 -0
- package/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldDestructureSet.js +7 -0
- package/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldSpecGet.js +7 -0
- package/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldSpecSet.js +7 -0
- package/node_modules/@babel/runtime/helpers/esm/classStaticPrivateMethodGet.js +5 -0
- package/node_modules/@babel/runtime/helpers/esm/classStaticPrivateMethodSet.js +4 -0
- package/node_modules/@babel/runtime/helpers/esm/construct.js +10 -0
- package/node_modules/@babel/runtime/helpers/esm/createClass.js +13 -0
- package/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelper.js +50 -0
- package/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelperLoose.js +19 -0
- package/node_modules/@babel/runtime/helpers/esm/createSuper.js +16 -0
- package/node_modules/@babel/runtime/helpers/esm/decorate.js +250 -0
- package/node_modules/@babel/runtime/helpers/esm/defaults.js +9 -0
- package/node_modules/@babel/runtime/helpers/esm/defineAccessor.js +8 -0
- package/node_modules/@babel/runtime/helpers/esm/defineEnumerableProperties.js +12 -0
- package/node_modules/@babel/runtime/helpers/esm/defineProperty.js +10 -0
- package/node_modules/@babel/runtime/helpers/esm/dispose.js +28 -0
- package/node_modules/@babel/runtime/helpers/esm/extends.js +10 -0
- package/node_modules/@babel/runtime/helpers/esm/get.js +11 -0
- package/node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js +6 -0
- package/node_modules/@babel/runtime/helpers/esm/identity.js +4 -0
- package/node_modules/@babel/runtime/helpers/esm/importDeferProxy.js +27 -0
- package/node_modules/@babel/runtime/helpers/esm/inherits.js +14 -0
- package/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js +5 -0
- package/node_modules/@babel/runtime/helpers/esm/initializerDefineProperty.js +9 -0
- package/node_modules/@babel/runtime/helpers/esm/initializerWarningHelper.js +4 -0
- package/node_modules/@babel/runtime/helpers/esm/instanceof.js +4 -0
- package/node_modules/@babel/runtime/helpers/esm/interopRequireDefault.js +6 -0
- package/node_modules/@babel/runtime/helpers/esm/interopRequireWildcard.js +27 -0
- package/node_modules/@babel/runtime/helpers/esm/isNativeFunction.js +8 -0
- package/node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js +9 -0
- package/node_modules/@babel/runtime/helpers/esm/iterableToArray.js +4 -0
- package/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js +28 -0
- package/node_modules/@babel/runtime/helpers/esm/jsx.js +22 -0
- package/node_modules/@babel/runtime/helpers/esm/maybeArrayLike.js +9 -0
- package/node_modules/@babel/runtime/helpers/esm/newArrowCheck.js +4 -0
- package/node_modules/@babel/runtime/helpers/esm/nonIterableRest.js +4 -0
- package/node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js +4 -0
- package/node_modules/@babel/runtime/helpers/esm/nullishReceiverError.js +4 -0
- package/node_modules/@babel/runtime/helpers/esm/objectDestructuringEmpty.js +4 -0
- package/node_modules/@babel/runtime/helpers/esm/objectSpread.js +14 -0
- package/node_modules/@babel/runtime/helpers/esm/objectSpread2.js +23 -0
- package/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js +13 -0
- package/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js +10 -0
- package/node_modules/@babel/runtime/helpers/esm/package.json +3 -0
- package/node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js +8 -0
- package/node_modules/@babel/runtime/helpers/esm/readOnlyError.js +4 -0
- package/node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js +304 -0
- package/node_modules/@babel/runtime/helpers/esm/set.js +22 -0
- package/node_modules/@babel/runtime/helpers/esm/setFunctionName.js +12 -0
- package/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js +6 -0
- package/node_modules/@babel/runtime/helpers/esm/skipFirstGeneratorNext.js +7 -0
- package/node_modules/@babel/runtime/helpers/esm/slicedToArray.js +8 -0
- package/node_modules/@babel/runtime/helpers/esm/superPropBase.js +6 -0
- package/node_modules/@babel/runtime/helpers/esm/superPropGet.js +9 -0
- package/node_modules/@babel/runtime/helpers/esm/superPropSet.js +6 -0
- package/node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteral.js +8 -0
- package/node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteralLoose.js +4 -0
- package/node_modules/@babel/runtime/helpers/esm/tdz.js +4 -0
- package/node_modules/@babel/runtime/helpers/esm/temporalRef.js +6 -0
- package/node_modules/@babel/runtime/helpers/esm/temporalUndefined.js +2 -0
- package/node_modules/@babel/runtime/helpers/esm/toArray.js +8 -0
- package/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js +8 -0
- package/node_modules/@babel/runtime/helpers/esm/toPrimitive.js +12 -0
- package/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js +7 -0
- package/node_modules/@babel/runtime/helpers/esm/toSetter.js +10 -0
- package/node_modules/@babel/runtime/helpers/esm/typeof.js +10 -0
- package/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js +9 -0
- package/node_modules/@babel/runtime/helpers/esm/using.js +12 -0
- package/node_modules/@babel/runtime/helpers/esm/usingCtx.js +59 -0
- package/node_modules/@babel/runtime/helpers/esm/wrapAsyncGenerator.js +69 -0
- package/node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js +27 -0
- package/node_modules/@babel/runtime/helpers/esm/wrapRegExp.js +51 -0
- package/node_modules/@babel/runtime/helpers/esm/writeOnlyError.js +4 -0
- package/node_modules/@babel/runtime/helpers/extends.js +10 -0
- package/node_modules/@babel/runtime/helpers/get.js +11 -0
- package/node_modules/@babel/runtime/helpers/getPrototypeOf.js +6 -0
- package/node_modules/@babel/runtime/helpers/identity.js +4 -0
- package/node_modules/@babel/runtime/helpers/importDeferProxy.js +27 -0
- package/node_modules/@babel/runtime/helpers/inherits.js +14 -0
- package/node_modules/@babel/runtime/helpers/inheritsLoose.js +5 -0
- package/node_modules/@babel/runtime/helpers/initializerDefineProperty.js +9 -0
- package/node_modules/@babel/runtime/helpers/initializerWarningHelper.js +4 -0
- package/node_modules/@babel/runtime/helpers/instanceof.js +4 -0
- package/node_modules/@babel/runtime/helpers/interopRequireDefault.js +6 -0
- package/node_modules/@babel/runtime/helpers/interopRequireWildcard.js +27 -0
- package/node_modules/@babel/runtime/helpers/isNativeFunction.js +8 -0
- package/node_modules/@babel/runtime/helpers/isNativeReflectConstruct.js +9 -0
- package/node_modules/@babel/runtime/helpers/iterableToArray.js +4 -0
- package/node_modules/@babel/runtime/helpers/iterableToArrayLimit.js +28 -0
- package/node_modules/@babel/runtime/helpers/jsx.js +22 -0
- package/node_modules/@babel/runtime/helpers/maybeArrayLike.js +9 -0
- package/node_modules/@babel/runtime/helpers/newArrowCheck.js +4 -0
- package/node_modules/@babel/runtime/helpers/nonIterableRest.js +4 -0
- package/node_modules/@babel/runtime/helpers/nonIterableSpread.js +4 -0
- package/node_modules/@babel/runtime/helpers/nullishReceiverError.js +4 -0
- package/node_modules/@babel/runtime/helpers/objectDestructuringEmpty.js +4 -0
- package/node_modules/@babel/runtime/helpers/objectSpread.js +14 -0
- package/node_modules/@babel/runtime/helpers/objectSpread2.js +23 -0
- package/node_modules/@babel/runtime/helpers/objectWithoutProperties.js +13 -0
- package/node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js +10 -0
- package/node_modules/@babel/runtime/helpers/possibleConstructorReturn.js +8 -0
- package/node_modules/@babel/runtime/helpers/readOnlyError.js +4 -0
- package/node_modules/@babel/runtime/helpers/regeneratorRuntime.js +304 -0
- package/node_modules/@babel/runtime/helpers/set.js +22 -0
- package/node_modules/@babel/runtime/helpers/setFunctionName.js +12 -0
- package/node_modules/@babel/runtime/helpers/setPrototypeOf.js +6 -0
- package/node_modules/@babel/runtime/helpers/skipFirstGeneratorNext.js +7 -0
- package/node_modules/@babel/runtime/helpers/slicedToArray.js +8 -0
- package/node_modules/@babel/runtime/helpers/superPropBase.js +6 -0
- package/node_modules/@babel/runtime/helpers/superPropGet.js +9 -0
- package/node_modules/@babel/runtime/helpers/superPropSet.js +6 -0
- package/node_modules/@babel/runtime/helpers/taggedTemplateLiteral.js +8 -0
- package/node_modules/@babel/runtime/helpers/taggedTemplateLiteralLoose.js +4 -0
- package/node_modules/@babel/runtime/helpers/tdz.js +4 -0
- package/node_modules/@babel/runtime/helpers/temporalRef.js +6 -0
- package/node_modules/@babel/runtime/helpers/temporalUndefined.js +2 -0
- package/node_modules/@babel/runtime/helpers/toArray.js +8 -0
- package/node_modules/@babel/runtime/helpers/toConsumableArray.js +8 -0
- package/node_modules/@babel/runtime/helpers/toPrimitive.js +12 -0
- package/node_modules/@babel/runtime/helpers/toPropertyKey.js +7 -0
- package/node_modules/@babel/runtime/helpers/toSetter.js +10 -0
- package/node_modules/@babel/runtime/helpers/typeof.js +10 -0
- package/node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js +9 -0
- package/node_modules/@babel/runtime/helpers/using.js +12 -0
- package/node_modules/@babel/runtime/helpers/usingCtx.js +59 -0
- package/node_modules/@babel/runtime/helpers/wrapAsyncGenerator.js +69 -0
- package/node_modules/@babel/runtime/helpers/wrapNativeSuper.js +27 -0
- package/node_modules/@babel/runtime/helpers/wrapRegExp.js +51 -0
- package/node_modules/@babel/runtime/helpers/writeOnlyError.js +4 -0
- package/node_modules/@babel/runtime/package.json +1056 -0
- package/node_modules/@babel/runtime/regenerator/index.js +15 -0
- package/node_modules/@types/ace/LICENSE +21 -0
- package/node_modules/@types/ace/README.md +15 -0
- package/node_modules/@types/ace/index.d.ts +3135 -0
- package/node_modules/@types/ace/package.json +30 -0
- package/node_modules/@types/body-parser/LICENSE +21 -0
- package/node_modules/@types/body-parser/README.md +15 -0
- package/node_modules/@types/body-parser/index.d.ts +95 -0
- package/node_modules/@types/body-parser/package.json +58 -0
- package/node_modules/@types/connect/LICENSE +21 -0
- package/node_modules/@types/connect/README.md +15 -0
- package/node_modules/@types/connect/index.d.ts +91 -0
- package/node_modules/@types/connect/package.json +32 -0
- package/node_modules/@types/cors/LICENSE +21 -0
- package/node_modules/@types/cors/README.md +75 -0
- package/node_modules/@types/cors/index.d.ts +56 -0
- package/node_modules/@types/cors/package.json +32 -0
- package/node_modules/@types/express/LICENSE +21 -0
- package/node_modules/@types/express/README.md +15 -0
- package/node_modules/@types/express/index.d.ts +128 -0
- package/node_modules/@types/express/package.json +45 -0
- package/node_modules/@types/express-serve-static-core/LICENSE +21 -0
- package/node_modules/@types/express-serve-static-core/README.md +15 -0
- package/node_modules/@types/express-serve-static-core/index.d.ts +1295 -0
- package/node_modules/@types/express-serve-static-core/package.json +50 -0
- package/node_modules/@types/http-errors/LICENSE +21 -0
- package/node_modules/@types/http-errors/README.md +15 -0
- package/node_modules/@types/http-errors/index.d.ts +77 -0
- package/node_modules/@types/http-errors/package.json +30 -0
- package/node_modules/@types/jquery/JQuery.d.ts +13372 -0
- package/node_modules/@types/jquery/JQueryStatic.d.ts +13944 -0
- package/node_modules/@types/jquery/LICENSE +21 -0
- package/node_modules/@types/jquery/README.md +15 -0
- package/node_modules/@types/jquery/dist/jquery.slim.d.ts +3 -0
- package/node_modules/@types/jquery/index.d.ts +7 -0
- package/node_modules/@types/jquery/legacy.d.ts +204 -0
- package/node_modules/@types/jquery/misc.d.ts +7364 -0
- package/node_modules/@types/jquery/package.json +132 -0
- package/node_modules/@types/mime/LICENSE +21 -0
- package/node_modules/@types/mime/Mime.d.ts +10 -0
- package/node_modules/@types/mime/README.md +15 -0
- package/node_modules/@types/mime/index.d.ts +31 -0
- package/node_modules/@types/mime/lite.d.ts +7 -0
- package/node_modules/@types/mime/package.json +30 -0
- package/node_modules/@types/node/LICENSE +21 -0
- package/node_modules/@types/node/README.md +15 -0
- package/node_modules/@types/node/assert/strict.d.ts +8 -0
- package/node_modules/@types/node/assert.d.ts +1040 -0
- package/node_modules/@types/node/async_hooks.d.ts +541 -0
- package/node_modules/@types/node/buffer.d.ts +2293 -0
- package/node_modules/@types/node/child_process.d.ts +1544 -0
- package/node_modules/@types/node/cluster.d.ts +578 -0
- package/node_modules/@types/node/console.d.ts +452 -0
- package/node_modules/@types/node/constants.d.ts +19 -0
- package/node_modules/@types/node/crypto.d.ts +4451 -0
- package/node_modules/@types/node/dgram.d.ts +596 -0
- package/node_modules/@types/node/diagnostics_channel.d.ts +554 -0
- package/node_modules/@types/node/dns/promises.d.ts +476 -0
- package/node_modules/@types/node/dns.d.ts +865 -0
- package/node_modules/@types/node/dom-events.d.ts +124 -0
- package/node_modules/@types/node/domain.d.ts +170 -0
- package/node_modules/@types/node/events.d.ts +931 -0
- package/node_modules/@types/node/fs/promises.d.ts +1264 -0
- package/node_modules/@types/node/fs.d.ts +4390 -0
- package/node_modules/@types/node/globals.d.ts +510 -0
- package/node_modules/@types/node/globals.global.d.ts +1 -0
- package/node_modules/@types/node/http.d.ts +1921 -0
- package/node_modules/@types/node/http2.d.ts +2418 -0
- package/node_modules/@types/node/https.d.ts +550 -0
- package/node_modules/@types/node/index.d.ts +90 -0
- package/node_modules/@types/node/inspector.d.ts +2746 -0
- package/node_modules/@types/node/module.d.ts +301 -0
- package/node_modules/@types/node/net.d.ts +999 -0
- package/node_modules/@types/node/os.d.ts +495 -0
- package/node_modules/@types/node/package.json +217 -0
- package/node_modules/@types/node/path.d.ts +200 -0
- package/node_modules/@types/node/perf_hooks.d.ts +941 -0
- package/node_modules/@types/node/process.d.ts +1913 -0
- package/node_modules/@types/node/punycode.d.ts +117 -0
- package/node_modules/@types/node/querystring.d.ts +153 -0
- package/node_modules/@types/node/readline/promises.d.ts +150 -0
- package/node_modules/@types/node/readline.d.ts +540 -0
- package/node_modules/@types/node/repl.d.ts +430 -0
- package/node_modules/@types/node/sea.d.ts +153 -0
- package/node_modules/@types/node/sqlite.d.ts +213 -0
- package/node_modules/@types/node/stream/consumers.d.ts +12 -0
- package/node_modules/@types/node/stream/promises.d.ts +83 -0
- package/node_modules/@types/node/stream/web.d.ts +367 -0
- package/node_modules/@types/node/stream.d.ts +1707 -0
- package/node_modules/@types/node/string_decoder.d.ts +67 -0
- package/node_modules/@types/node/test.d.ts +2006 -0
- package/node_modules/@types/node/timers/promises.d.ts +97 -0
- package/node_modules/@types/node/timers.d.ts +240 -0
- package/node_modules/@types/node/tls.d.ts +1220 -0
- package/node_modules/@types/node/trace_events.d.ts +197 -0
- package/node_modules/@types/node/tty.d.ts +208 -0
- package/node_modules/@types/node/url.d.ts +969 -0
- package/node_modules/@types/node/util.d.ts +2298 -0
- package/node_modules/@types/node/v8.d.ts +808 -0
- package/node_modules/@types/node/vm.d.ts +922 -0
- package/node_modules/@types/node/wasi.d.ts +181 -0
- package/node_modules/@types/node/worker_threads.d.ts +712 -0
- package/node_modules/@types/node/zlib.d.ts +539 -0
- package/node_modules/@types/node-red/LICENSE +21 -0
- package/node_modules/@types/node-red/README.md +15 -0
- package/node_modules/@types/node-red/index.d.ts +241 -0
- package/node_modules/@types/node-red/package.json +52 -0
- package/node_modules/@types/node-red__editor-api/LICENSE +21 -0
- package/node_modules/@types/node-red__editor-api/README.md +65 -0
- package/node_modules/@types/node-red__editor-api/index.d.ts +46 -0
- package/node_modules/@types/node-red__editor-api/package.json +33 -0
- package/node_modules/@types/node-red__editor-client/LICENSE +21 -0
- package/node_modules/@types/node-red__editor-client/README.md +15 -0
- package/node_modules/@types/node-red__editor-client/index.d.ts +1738 -0
- package/node_modules/@types/node-red__editor-client/package.json +36 -0
- package/node_modules/@types/node-red__registry/LICENSE +21 -0
- package/node_modules/@types/node-red__registry/README.md +15 -0
- package/node_modules/@types/node-red__registry/index.d.ts +452 -0
- package/node_modules/@types/node-red__registry/package.json +34 -0
- package/node_modules/@types/node-red__runtime/LICENSE +21 -0
- package/node_modules/@types/node-red__runtime/README.md +15 -0
- package/node_modules/@types/node-red__runtime/index.d.ts +1458 -0
- package/node_modules/@types/node-red__runtime/package.json +36 -0
- package/node_modules/@types/node-red__util/LICENSE +21 -0
- package/node_modules/@types/node-red__util/README.md +15 -0
- package/node_modules/@types/node-red__util/index.d.ts +557 -0
- package/node_modules/@types/node-red__util/package.json +34 -0
- package/node_modules/@types/passport/LICENSE +21 -0
- package/node_modules/@types/passport/README.md +15 -0
- package/node_modules/@types/passport/index.d.ts +921 -0
- package/node_modules/@types/passport/package.json +57 -0
- package/node_modules/@types/qs/LICENSE +21 -0
- package/node_modules/@types/qs/README.md +15 -0
- package/node_modules/@types/qs/index.d.ts +80 -0
- package/node_modules/@types/qs/package.json +65 -0
- package/node_modules/@types/range-parser/LICENSE +21 -0
- package/node_modules/@types/range-parser/README.md +53 -0
- package/node_modules/@types/range-parser/index.d.ts +34 -0
- package/node_modules/@types/range-parser/package.json +25 -0
- package/node_modules/@types/readable-stream/LICENSE +21 -0
- package/node_modules/@types/readable-stream/README.md +15 -0
- package/node_modules/@types/readable-stream/index.d.ts +677 -0
- package/node_modules/@types/readable-stream/package.json +38 -0
- package/node_modules/@types/send/LICENSE +21 -0
- package/node_modules/@types/send/README.md +15 -0
- package/node_modules/@types/send/index.d.ts +225 -0
- package/node_modules/@types/send/package.json +33 -0
- package/node_modules/@types/serve-static/LICENSE +21 -0
- package/node_modules/@types/serve-static/README.md +15 -0
- package/node_modules/@types/serve-static/index.d.ts +107 -0
- package/node_modules/@types/serve-static/package.json +39 -0
- package/node_modules/@types/sizzle/LICENSE +21 -0
- package/node_modules/@types/sizzle/README.md +15 -0
- package/node_modules/@types/sizzle/index.d.ts +91 -0
- package/node_modules/@types/sizzle/package.json +25 -0
- package/node_modules/@types/ws/LICENSE +21 -0
- package/node_modules/@types/ws/README.md +15 -0
- package/node_modules/@types/ws/index.d.mts +21 -0
- package/node_modules/@types/ws/index.d.ts +401 -0
- package/node_modules/@types/ws/package.json +71 -0
- package/node_modules/abort-controller/LICENSE +21 -0
- package/node_modules/abort-controller/README.md +98 -0
- package/node_modules/abort-controller/browser.js +13 -0
- package/node_modules/abort-controller/browser.mjs +11 -0
- package/node_modules/abort-controller/dist/abort-controller.d.ts +43 -0
- package/node_modules/abort-controller/dist/abort-controller.js +127 -0
- package/node_modules/abort-controller/dist/abort-controller.js.map +1 -0
- package/node_modules/abort-controller/dist/abort-controller.mjs +118 -0
- package/node_modules/abort-controller/dist/abort-controller.mjs.map +1 -0
- package/node_modules/abort-controller/dist/abort-controller.umd.js +5 -0
- package/node_modules/abort-controller/dist/abort-controller.umd.js.map +1 -0
- package/node_modules/abort-controller/package.json +97 -0
- package/node_modules/abort-controller/polyfill.js +21 -0
- package/node_modules/abort-controller/polyfill.mjs +19 -0
- package/node_modules/base64-js/LICENSE +21 -0
- package/node_modules/base64-js/README.md +34 -0
- package/node_modules/base64-js/base64js.min.js +1 -0
- package/node_modules/base64-js/index.d.ts +3 -0
- package/node_modules/base64-js/index.js +150 -0
- package/node_modules/base64-js/package.json +47 -0
- package/node_modules/bl/.github/dependabot.yml +16 -0
- package/node_modules/bl/.github/workflows/test-and-release.yml +61 -0
- package/node_modules/bl/BufferList.d.ts +418 -0
- package/node_modules/bl/BufferList.js +400 -0
- package/node_modules/bl/CHANGELOG.md +142 -0
- package/node_modules/bl/LICENSE.md +13 -0
- package/node_modules/bl/README.md +247 -0
- package/node_modules/bl/bl.js +84 -0
- package/node_modules/bl/index.d.ts +88 -0
- package/node_modules/bl/package.json +123 -0
- package/node_modules/bl/test/convert.js +21 -0
- package/node_modules/bl/test/indexOf.js +492 -0
- package/node_modules/bl/test/isBufferList.js +32 -0
- package/node_modules/bl/test/test.js +948 -0
- package/node_modules/buffer/AUTHORS.md +73 -0
- package/node_modules/buffer/LICENSE +21 -0
- package/node_modules/buffer/README.md +410 -0
- package/node_modules/buffer/index.d.ts +194 -0
- package/node_modules/buffer/index.js +2106 -0
- package/node_modules/buffer/package.json +93 -0
- package/node_modules/buffer-from/LICENSE +21 -0
- package/node_modules/buffer-from/index.js +72 -0
- package/node_modules/buffer-from/package.json +19 -0
- package/node_modules/buffer-from/readme.md +69 -0
- package/node_modules/commist/.github/workflows/ci.yml +27 -0
- package/node_modules/commist/LICENSE +21 -0
- package/node_modules/commist/README.md +113 -0
- package/node_modules/commist/example.js +26 -0
- package/node_modules/commist/index.js +155 -0
- package/node_modules/commist/leven.js +91 -0
- package/node_modules/commist/package.json +28 -0
- package/node_modules/commist/test.js +368 -0
- package/node_modules/concat-stream/LICENSE +24 -0
- package/node_modules/concat-stream/index.js +144 -0
- package/node_modules/concat-stream/node_modules/readable-stream/CONTRIBUTING.md +38 -0
- package/node_modules/concat-stream/node_modules/readable-stream/GOVERNANCE.md +136 -0
- package/node_modules/concat-stream/node_modules/readable-stream/LICENSE +47 -0
- package/node_modules/concat-stream/node_modules/readable-stream/README.md +106 -0
- package/node_modules/concat-stream/node_modules/readable-stream/errors-browser.js +127 -0
- package/node_modules/concat-stream/node_modules/readable-stream/errors.js +116 -0
- package/node_modules/concat-stream/node_modules/readable-stream/experimentalWarning.js +17 -0
- package/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_duplex.js +126 -0
- package/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_passthrough.js +37 -0
- package/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_readable.js +1027 -0
- package/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_transform.js +190 -0
- package/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_writable.js +641 -0
- package/node_modules/concat-stream/node_modules/readable-stream/lib/internal/streams/async_iterator.js +180 -0
- package/node_modules/concat-stream/node_modules/readable-stream/lib/internal/streams/buffer_list.js +183 -0
- package/node_modules/concat-stream/node_modules/readable-stream/lib/internal/streams/destroy.js +96 -0
- package/node_modules/concat-stream/node_modules/readable-stream/lib/internal/streams/end-of-stream.js +86 -0
- package/node_modules/concat-stream/node_modules/readable-stream/lib/internal/streams/from-browser.js +3 -0
- package/node_modules/concat-stream/node_modules/readable-stream/lib/internal/streams/from.js +52 -0
- package/node_modules/concat-stream/node_modules/readable-stream/lib/internal/streams/pipeline.js +86 -0
- package/node_modules/concat-stream/node_modules/readable-stream/lib/internal/streams/state.js +22 -0
- package/node_modules/concat-stream/node_modules/readable-stream/lib/internal/streams/stream-browser.js +1 -0
- package/node_modules/concat-stream/node_modules/readable-stream/lib/internal/streams/stream.js +1 -0
- package/node_modules/concat-stream/node_modules/readable-stream/package.json +68 -0
- package/node_modules/concat-stream/node_modules/readable-stream/readable-browser.js +9 -0
- package/node_modules/concat-stream/node_modules/readable-stream/readable.js +16 -0
- package/node_modules/concat-stream/package.json +55 -0
- package/node_modules/concat-stream/readme.md +102 -0
- package/node_modules/debug/LICENSE +20 -0
- package/node_modules/debug/README.md +481 -0
- package/node_modules/debug/package.json +60 -0
- package/node_modules/debug/src/browser.js +271 -0
- package/node_modules/debug/src/common.js +274 -0
- package/node_modules/debug/src/index.js +10 -0
- package/node_modules/debug/src/node.js +263 -0
- package/node_modules/event-target-shim/LICENSE +22 -0
- package/node_modules/event-target-shim/README.md +293 -0
- package/node_modules/event-target-shim/dist/event-target-shim.js +871 -0
- package/node_modules/event-target-shim/dist/event-target-shim.js.map +1 -0
- package/node_modules/event-target-shim/dist/event-target-shim.mjs +862 -0
- package/node_modules/event-target-shim/dist/event-target-shim.mjs.map +1 -0
- package/node_modules/event-target-shim/dist/event-target-shim.umd.js +6 -0
- package/node_modules/event-target-shim/dist/event-target-shim.umd.js.map +1 -0
- package/node_modules/event-target-shim/index.d.ts +399 -0
- package/node_modules/event-target-shim/package.json +82 -0
- package/node_modules/events/.airtap.yml +15 -0
- package/node_modules/events/.github/FUNDING.yml +12 -0
- package/node_modules/events/.travis.yml +18 -0
- package/node_modules/events/History.md +118 -0
- package/node_modules/events/LICENSE +22 -0
- package/node_modules/events/Readme.md +50 -0
- package/node_modules/events/events.js +497 -0
- package/node_modules/events/package.json +37 -0
- package/node_modules/events/security.md +10 -0
- package/node_modules/events/tests/add-listeners.js +111 -0
- package/node_modules/events/tests/check-listener-leaks.js +101 -0
- package/node_modules/events/tests/common.js +104 -0
- package/node_modules/events/tests/errors.js +13 -0
- package/node_modules/events/tests/events-list.js +28 -0
- package/node_modules/events/tests/events-once.js +234 -0
- package/node_modules/events/tests/index.js +64 -0
- package/node_modules/events/tests/legacy-compat.js +16 -0
- package/node_modules/events/tests/listener-count.js +37 -0
- package/node_modules/events/tests/listeners-side-effects.js +56 -0
- package/node_modules/events/tests/listeners.js +168 -0
- package/node_modules/events/tests/max-listeners.js +47 -0
- package/node_modules/events/tests/method-names.js +35 -0
- package/node_modules/events/tests/modify-in-emit.js +90 -0
- package/node_modules/events/tests/num-args.js +60 -0
- package/node_modules/events/tests/once.js +83 -0
- package/node_modules/events/tests/prepend.js +31 -0
- package/node_modules/events/tests/remove-all-listeners.js +133 -0
- package/node_modules/events/tests/remove-listeners.js +212 -0
- package/node_modules/events/tests/set-max-listeners-side-effects.js +31 -0
- package/node_modules/events/tests/special-event-names.js +45 -0
- package/node_modules/events/tests/subclass.js +66 -0
- package/node_modules/events/tests/symbols.js +25 -0
- package/node_modules/fast-unique-numbers/LICENSE +21 -0
- package/node_modules/fast-unique-numbers/README.md +51 -0
- package/node_modules/fast-unique-numbers/build/es2019/factories/add-unique-number.d.ts +3 -0
- package/node_modules/fast-unique-numbers/build/es2019/factories/add-unique-number.d.ts.map +1 -0
- package/node_modules/fast-unique-numbers/build/es2019/factories/add-unique-number.js +8 -0
- package/node_modules/fast-unique-numbers/build/es2019/factories/add-unique-number.js.map +1 -0
- package/node_modules/fast-unique-numbers/build/es2019/factories/cache.d.ts +3 -0
- package/node_modules/fast-unique-numbers/build/es2019/factories/cache.d.ts.map +1 -0
- package/node_modules/fast-unique-numbers/build/es2019/factories/cache.js +7 -0
- package/node_modules/fast-unique-numbers/build/es2019/factories/cache.js.map +1 -0
- package/node_modules/fast-unique-numbers/build/es2019/factories/generate-unique-number.d.ts +3 -0
- package/node_modules/fast-unique-numbers/build/es2019/factories/generate-unique-number.d.ts.map +1 -0
- package/node_modules/fast-unique-numbers/build/es2019/factories/generate-unique-number.js +46 -0
- package/node_modules/fast-unique-numbers/build/es2019/factories/generate-unique-number.js.map +1 -0
- package/node_modules/fast-unique-numbers/build/es2019/module.d.ts +5 -0
- package/node_modules/fast-unique-numbers/build/es2019/module.d.ts.map +1 -0
- package/node_modules/fast-unique-numbers/build/es2019/module.js +14 -0
- package/node_modules/fast-unique-numbers/build/es2019/module.js.map +1 -0
- package/node_modules/fast-unique-numbers/build/es2019/types/add-unique-number-factory.d.ts +4 -0
- package/node_modules/fast-unique-numbers/build/es2019/types/add-unique-number-factory.d.ts.map +1 -0
- package/node_modules/fast-unique-numbers/build/es2019/types/add-unique-number-factory.js +2 -0
- package/node_modules/fast-unique-numbers/build/es2019/types/add-unique-number-factory.js.map +1 -0
- package/node_modules/fast-unique-numbers/build/es2019/types/add-unique-number-function.d.ts +2 -0
- package/node_modules/fast-unique-numbers/build/es2019/types/add-unique-number-function.d.ts.map +1 -0
- package/node_modules/fast-unique-numbers/build/es2019/types/add-unique-number-function.js +2 -0
- package/node_modules/fast-unique-numbers/build/es2019/types/add-unique-number-function.js.map +1 -0
- package/node_modules/fast-unique-numbers/build/es2019/types/cache-factory.d.ts +3 -0
- package/node_modules/fast-unique-numbers/build/es2019/types/cache-factory.d.ts.map +1 -0
- package/node_modules/fast-unique-numbers/build/es2019/types/cache-factory.js +2 -0
- package/node_modules/fast-unique-numbers/build/es2019/types/cache-factory.js.map +1 -0
- package/node_modules/fast-unique-numbers/build/es2019/types/cache-function.d.ts +2 -0
- package/node_modules/fast-unique-numbers/build/es2019/types/cache-function.d.ts.map +1 -0
- package/node_modules/fast-unique-numbers/build/es2019/types/cache-function.js +2 -0
- package/node_modules/fast-unique-numbers/build/es2019/types/cache-function.js.map +1 -0
- package/node_modules/fast-unique-numbers/build/es2019/types/generate-unique-number-factory.d.ts +4 -0
- package/node_modules/fast-unique-numbers/build/es2019/types/generate-unique-number-factory.d.ts.map +1 -0
- package/node_modules/fast-unique-numbers/build/es2019/types/generate-unique-number-factory.js +2 -0
- package/node_modules/fast-unique-numbers/build/es2019/types/generate-unique-number-factory.js.map +1 -0
- package/node_modules/fast-unique-numbers/build/es2019/types/generate-unique-number-function.d.ts +2 -0
- package/node_modules/fast-unique-numbers/build/es2019/types/generate-unique-number-function.d.ts.map +1 -0
- package/node_modules/fast-unique-numbers/build/es2019/types/generate-unique-number-function.js +2 -0
- package/node_modules/fast-unique-numbers/build/es2019/types/generate-unique-number-function.js.map +1 -0
- package/node_modules/fast-unique-numbers/build/es2019/types/index.d.ts +7 -0
- package/node_modules/fast-unique-numbers/build/es2019/types/index.d.ts.map +1 -0
- package/node_modules/fast-unique-numbers/build/es2019/types/index.js +7 -0
- package/node_modules/fast-unique-numbers/build/es2019/types/index.js.map +1 -0
- package/node_modules/fast-unique-numbers/build/es5/bundle.js +76 -0
- package/node_modules/fast-unique-numbers/build/node/factories/add-unique-number.js +14 -0
- package/node_modules/fast-unique-numbers/build/node/factories/cache.js +13 -0
- package/node_modules/fast-unique-numbers/build/node/factories/generate-unique-number.js +52 -0
- package/node_modules/fast-unique-numbers/build/node/module.js +34 -0
- package/node_modules/fast-unique-numbers/build/node/types/add-unique-number-factory.js +5 -0
- package/node_modules/fast-unique-numbers/build/node/types/add-unique-number-function.js +5 -0
- package/node_modules/fast-unique-numbers/build/node/types/cache-factory.js +5 -0
- package/node_modules/fast-unique-numbers/build/node/types/cache-function.js +5 -0
- package/node_modules/fast-unique-numbers/build/node/types/generate-unique-number-factory.js +5 -0
- package/node_modules/fast-unique-numbers/build/node/types/generate-unique-number-function.js +5 -0
- package/node_modules/fast-unique-numbers/build/node/types/index.js +71 -0
- package/node_modules/fast-unique-numbers/package.json +94 -0
- package/node_modules/fast-unique-numbers/src/factories/add-unique-number.ts +11 -0
- package/node_modules/fast-unique-numbers/src/factories/cache.ts +9 -0
- package/node_modules/fast-unique-numbers/src/factories/generate-unique-number.ts +55 -0
- package/node_modules/fast-unique-numbers/src/module.ts +17 -0
- package/node_modules/fast-unique-numbers/src/tsconfig.json +6 -0
- package/node_modules/fast-unique-numbers/src/types/add-unique-number-factory.ts +4 -0
- package/node_modules/fast-unique-numbers/src/types/add-unique-number-function.ts +1 -0
- package/node_modules/fast-unique-numbers/src/types/cache-factory.ts +3 -0
- package/node_modules/fast-unique-numbers/src/types/cache-function.ts +1 -0
- package/node_modules/fast-unique-numbers/src/types/generate-unique-number-factory.ts +7 -0
- package/node_modules/fast-unique-numbers/src/types/generate-unique-number-function.ts +1 -0
- package/node_modules/fast-unique-numbers/src/types/index.ts +6 -0
- package/node_modules/help-me/.github/workflows/ci.yml +28 -0
- package/node_modules/help-me/LICENSE +22 -0
- package/node_modules/help-me/README.md +66 -0
- package/node_modules/help-me/doc/hello.txt +1 -0
- package/node_modules/help-me/doc/help.txt +5 -0
- package/node_modules/help-me/example.js +18 -0
- package/node_modules/help-me/fixture/basic/hello.txt +1 -0
- package/node_modules/help-me/fixture/basic/help.txt +1 -0
- package/node_modules/help-me/fixture/dir/a/b.txt +0 -0
- package/node_modules/help-me/fixture/no-ext/hello +1 -0
- package/node_modules/help-me/fixture/sameprefix/hello world.txt +1 -0
- package/node_modules/help-me/fixture/sameprefix/hello.txt +1 -0
- package/node_modules/help-me/fixture/shortnames/abcde fghi lmno.txt +1 -0
- package/node_modules/help-me/fixture/shortnames/abcde hello.txt +1 -0
- package/node_modules/help-me/fixture/shortnames/hello world.txt +1 -0
- package/node_modules/help-me/help-me.js +134 -0
- package/node_modules/help-me/package.json +36 -0
- package/node_modules/help-me/test.js +316 -0
- package/node_modules/ieee754/LICENSE +11 -0
- package/node_modules/ieee754/README.md +51 -0
- package/node_modules/ieee754/index.d.ts +10 -0
- package/node_modules/ieee754/index.js +85 -0
- package/node_modules/ieee754/package.json +52 -0
- package/node_modules/inherits/LICENSE +16 -0
- package/node_modules/inherits/README.md +42 -0
- package/node_modules/inherits/inherits.js +9 -0
- package/node_modules/inherits/inherits_browser.js +27 -0
- package/node_modules/inherits/package.json +29 -0
- package/node_modules/js-sdsl/CHANGELOG.md +211 -0
- package/node_modules/js-sdsl/LICENSE +21 -0
- package/node_modules/js-sdsl/README.md +296 -0
- package/node_modules/js-sdsl/README.zh-CN.md +298 -0
- package/node_modules/js-sdsl/dist/cjs/container/ContainerBase/index.d.ts +206 -0
- package/node_modules/js-sdsl/dist/cjs/container/ContainerBase/index.js +40 -0
- package/node_modules/js-sdsl/dist/cjs/container/ContainerBase/index.js.map +1 -0
- package/node_modules/js-sdsl/dist/cjs/container/HashContainer/Base/index.d.ts +29 -0
- package/node_modules/js-sdsl/dist/cjs/container/HashContainer/Base/index.js +188 -0
- package/node_modules/js-sdsl/dist/cjs/container/HashContainer/Base/index.js.map +1 -0
- package/node_modules/js-sdsl/dist/cjs/container/HashContainer/HashMap.d.ts +49 -0
- package/node_modules/js-sdsl/dist/cjs/container/HashContainer/HashMap.js +125 -0
- package/node_modules/js-sdsl/dist/cjs/container/HashContainer/HashMap.js.map +1 -0
- package/node_modules/js-sdsl/dist/cjs/container/HashContainer/HashSet.d.ts +39 -0
- package/node_modules/js-sdsl/dist/cjs/container/HashContainer/HashSet.js +94 -0
- package/node_modules/js-sdsl/dist/cjs/container/HashContainer/HashSet.js.map +1 -0
- package/node_modules/js-sdsl/dist/cjs/container/OtherContainer/PriorityQueue.d.ts +79 -0
- package/node_modules/js-sdsl/dist/cjs/container/OtherContainer/PriorityQueue.js +118 -0
- package/node_modules/js-sdsl/dist/cjs/container/OtherContainer/PriorityQueue.js.map +1 -0
- package/node_modules/js-sdsl/dist/cjs/container/OtherContainer/Queue.d.ts +22 -0
- package/node_modules/js-sdsl/dist/cjs/container/OtherContainer/Queue.js +52 -0
- package/node_modules/js-sdsl/dist/cjs/container/OtherContainer/Queue.js.map +1 -0
- package/node_modules/js-sdsl/dist/cjs/container/OtherContainer/Stack.d.ts +22 -0
- package/node_modules/js-sdsl/dist/cjs/container/OtherContainer/Stack.js +42 -0
- package/node_modules/js-sdsl/dist/cjs/container/OtherContainer/Stack.js.map +1 -0
- package/node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Base/RandomIterator.d.ts +9 -0
- package/node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Base/RandomIterator.js +58 -0
- package/node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Base/RandomIterator.js.map +1 -0
- package/node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Base/index.d.ts +67 -0
- package/node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Base/index.js +16 -0
- package/node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Base/index.js.map +1 -0
- package/node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Deque.d.ts +58 -0
- package/node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Deque.js +338 -0
- package/node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Deque.js.map +1 -0
- package/node_modules/js-sdsl/dist/cjs/container/SequentialContainer/LinkList.d.ts +58 -0
- package/node_modules/js-sdsl/dist/cjs/container/SequentialContainer/LinkList.js +330 -0
- package/node_modules/js-sdsl/dist/cjs/container/SequentialContainer/LinkList.js.map +1 -0
- package/node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Vector.d.ts +40 -0
- package/node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Vector.js +158 -0
- package/node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Vector.js.map +1 -0
- package/node_modules/js-sdsl/dist/cjs/container/TreeContainer/Base/TreeIterator.d.ts +18 -0
- package/node_modules/js-sdsl/dist/cjs/container/TreeContainer/Base/TreeIterator.js +80 -0
- package/node_modules/js-sdsl/dist/cjs/container/TreeContainer/Base/TreeIterator.js.map +1 -0
- package/node_modules/js-sdsl/dist/cjs/container/TreeContainer/Base/TreeNode.d.ts +47 -0
- package/node_modules/js-sdsl/dist/cjs/container/TreeContainer/Base/TreeNode.js +115 -0
- package/node_modules/js-sdsl/dist/cjs/container/TreeContainer/Base/TreeNode.js.map +1 -0
- package/node_modules/js-sdsl/dist/cjs/container/TreeContainer/Base/index.d.ts +58 -0
- package/node_modules/js-sdsl/dist/cjs/container/TreeContainer/Base/index.js +514 -0
- package/node_modules/js-sdsl/dist/cjs/container/TreeContainer/Base/index.js.map +1 -0
- package/node_modules/js-sdsl/dist/cjs/container/TreeContainer/OrderedMap.d.ts +62 -0
- package/node_modules/js-sdsl/dist/cjs/container/TreeContainer/OrderedMap.js +127 -0
- package/node_modules/js-sdsl/dist/cjs/container/TreeContainer/OrderedMap.js.map +1 -0
- package/node_modules/js-sdsl/dist/cjs/container/TreeContainer/OrderedSet.d.ts +54 -0
- package/node_modules/js-sdsl/dist/cjs/container/TreeContainer/OrderedSet.js +107 -0
- package/node_modules/js-sdsl/dist/cjs/container/TreeContainer/OrderedSet.js.map +1 -0
- package/node_modules/js-sdsl/dist/cjs/index.d.ts +21 -0
- package/node_modules/js-sdsl/dist/cjs/index.js +102 -0
- package/node_modules/js-sdsl/dist/cjs/index.js.map +1 -0
- package/node_modules/js-sdsl/dist/cjs/utils/checkObject.d.ts +1 -0
- package/node_modules/js-sdsl/dist/cjs/utils/checkObject.js +13 -0
- package/node_modules/js-sdsl/dist/cjs/utils/checkObject.js.map +1 -0
- package/node_modules/js-sdsl/dist/cjs/utils/throwError.d.ts +1 -0
- package/node_modules/js-sdsl/dist/cjs/utils/throwError.js +12 -0
- package/node_modules/js-sdsl/dist/cjs/utils/throwError.js.map +1 -0
- package/node_modules/js-sdsl/dist/esm/container/ContainerBase/index.d.ts +206 -0
- package/node_modules/js-sdsl/dist/esm/container/ContainerBase/index.js +68 -0
- package/node_modules/js-sdsl/dist/esm/container/ContainerBase/index.js.map +1 -0
- package/node_modules/js-sdsl/dist/esm/container/HashContainer/Base/index.d.ts +29 -0
- package/node_modules/js-sdsl/dist/esm/container/HashContainer/Base/index.js +201 -0
- package/node_modules/js-sdsl/dist/esm/container/HashContainer/Base/index.js.map +1 -0
- package/node_modules/js-sdsl/dist/esm/container/HashContainer/HashMap.d.ts +49 -0
- package/node_modules/js-sdsl/dist/esm/container/HashContainer/HashMap.js +248 -0
- package/node_modules/js-sdsl/dist/esm/container/HashContainer/HashMap.js.map +1 -0
- package/node_modules/js-sdsl/dist/esm/container/HashContainer/HashSet.d.ts +39 -0
- package/node_modules/js-sdsl/dist/esm/container/HashContainer/HashSet.js +223 -0
- package/node_modules/js-sdsl/dist/esm/container/HashContainer/HashSet.js.map +1 -0
- package/node_modules/js-sdsl/dist/esm/container/OtherContainer/PriorityQueue.d.ts +79 -0
- package/node_modules/js-sdsl/dist/esm/container/OtherContainer/PriorityQueue.js +171 -0
- package/node_modules/js-sdsl/dist/esm/container/OtherContainer/PriorityQueue.js.map +1 -0
- package/node_modules/js-sdsl/dist/esm/container/OtherContainer/Queue.d.ts +22 -0
- package/node_modules/js-sdsl/dist/esm/container/OtherContainer/Queue.js +69 -0
- package/node_modules/js-sdsl/dist/esm/container/OtherContainer/Queue.js.map +1 -0
- package/node_modules/js-sdsl/dist/esm/container/OtherContainer/Stack.d.ts +22 -0
- package/node_modules/js-sdsl/dist/esm/container/OtherContainer/Stack.js +59 -0
- package/node_modules/js-sdsl/dist/esm/container/OtherContainer/Stack.js.map +1 -0
- package/node_modules/js-sdsl/dist/esm/container/SequentialContainer/Base/RandomIterator.d.ts +9 -0
- package/node_modules/js-sdsl/dist/esm/container/SequentialContainer/Base/RandomIterator.js +78 -0
- package/node_modules/js-sdsl/dist/esm/container/SequentialContainer/Base/RandomIterator.js.map +1 -0
- package/node_modules/js-sdsl/dist/esm/container/SequentialContainer/Base/index.d.ts +67 -0
- package/node_modules/js-sdsl/dist/esm/container/SequentialContainer/Base/index.js +33 -0
- package/node_modules/js-sdsl/dist/esm/container/SequentialContainer/Base/index.js.map +1 -0
- package/node_modules/js-sdsl/dist/esm/container/SequentialContainer/Deque.d.ts +58 -0
- package/node_modules/js-sdsl/dist/esm/container/SequentialContainer/Deque.js +498 -0
- package/node_modules/js-sdsl/dist/esm/container/SequentialContainer/Deque.js.map +1 -0
- package/node_modules/js-sdsl/dist/esm/container/SequentialContainer/LinkList.d.ts +58 -0
- package/node_modules/js-sdsl/dist/esm/container/SequentialContainer/LinkList.js +456 -0
- package/node_modules/js-sdsl/dist/esm/container/SequentialContainer/LinkList.js.map +1 -0
- package/node_modules/js-sdsl/dist/esm/container/SequentialContainer/Vector.d.ts +40 -0
- package/node_modules/js-sdsl/dist/esm/container/SequentialContainer/Vector.js +323 -0
- package/node_modules/js-sdsl/dist/esm/container/SequentialContainer/Vector.js.map +1 -0
- package/node_modules/js-sdsl/dist/esm/container/TreeContainer/Base/TreeIterator.d.ts +18 -0
- package/node_modules/js-sdsl/dist/esm/container/TreeContainer/Base/TreeIterator.js +98 -0
- package/node_modules/js-sdsl/dist/esm/container/TreeContainer/Base/TreeIterator.js.map +1 -0
- package/node_modules/js-sdsl/dist/esm/container/TreeContainer/Base/TreeNode.d.ts +47 -0
- package/node_modules/js-sdsl/dist/esm/container/TreeContainer/Base/TreeNode.js +132 -0
- package/node_modules/js-sdsl/dist/esm/container/TreeContainer/Base/TreeNode.js.map +1 -0
- package/node_modules/js-sdsl/dist/esm/container/TreeContainer/Base/index.d.ts +58 -0
- package/node_modules/js-sdsl/dist/esm/container/TreeContainer/Base/index.js +600 -0
- package/node_modules/js-sdsl/dist/esm/container/TreeContainer/Base/index.js.map +1 -0
- package/node_modules/js-sdsl/dist/esm/container/TreeContainer/OrderedMap.d.ts +62 -0
- package/node_modules/js-sdsl/dist/esm/container/TreeContainer/OrderedMap.js +265 -0
- package/node_modules/js-sdsl/dist/esm/container/TreeContainer/OrderedMap.js.map +1 -0
- package/node_modules/js-sdsl/dist/esm/container/TreeContainer/OrderedSet.d.ts +54 -0
- package/node_modules/js-sdsl/dist/esm/container/TreeContainer/OrderedSet.js +245 -0
- package/node_modules/js-sdsl/dist/esm/container/TreeContainer/OrderedSet.js.map +1 -0
- package/node_modules/js-sdsl/dist/esm/index.d.ts +21 -0
- package/node_modules/js-sdsl/dist/esm/index.js +20 -0
- package/node_modules/js-sdsl/dist/esm/index.js.map +1 -0
- package/node_modules/js-sdsl/dist/esm/utils/checkObject.d.ts +1 -0
- package/node_modules/js-sdsl/dist/esm/utils/checkObject.js +5 -0
- package/node_modules/js-sdsl/dist/esm/utils/checkObject.js.map +1 -0
- package/node_modules/js-sdsl/dist/esm/utils/throwError.d.ts +1 -0
- package/node_modules/js-sdsl/dist/esm/utils/throwError.js +4 -0
- package/node_modules/js-sdsl/dist/esm/utils/throwError.js.map +1 -0
- package/node_modules/js-sdsl/dist/umd/js-sdsl.js +3154 -0
- package/node_modules/js-sdsl/dist/umd/js-sdsl.min.js +8 -0
- package/node_modules/js-sdsl/dist/umd/js-sdsl.min.js.map +1 -0
- package/node_modules/js-sdsl/package.json +166 -0
- package/node_modules/jsonata/LICENSE +19 -0
- package/node_modules/jsonata/README.md +70 -0
- package/node_modules/jsonata/jsonata-es5.js +9867 -0
- package/node_modules/jsonata/jsonata-es5.min.js +1 -0
- package/node_modules/jsonata/jsonata.d.ts +53 -0
- package/node_modules/jsonata/jsonata.js +7541 -0
- package/node_modules/jsonata/jsonata.min.js +1 -0
- package/node_modules/jsonata/package.json +62 -0
- package/node_modules/lru-cache/LICENSE +15 -0
- package/node_modules/lru-cache/README.md +331 -0
- package/node_modules/lru-cache/dist/commonjs/index.d.ts +1277 -0
- package/node_modules/lru-cache/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/lru-cache/dist/commonjs/index.js +1546 -0
- package/node_modules/lru-cache/dist/commonjs/index.js.map +1 -0
- package/node_modules/lru-cache/dist/commonjs/index.min.js +2 -0
- package/node_modules/lru-cache/dist/commonjs/index.min.js.map +7 -0
- package/node_modules/lru-cache/dist/commonjs/package.json +3 -0
- package/node_modules/lru-cache/dist/esm/index.d.ts +1277 -0
- package/node_modules/lru-cache/dist/esm/index.d.ts.map +1 -0
- package/node_modules/lru-cache/dist/esm/index.js +1542 -0
- package/node_modules/lru-cache/dist/esm/index.js.map +1 -0
- package/node_modules/lru-cache/dist/esm/index.min.js +2 -0
- package/node_modules/lru-cache/dist/esm/index.min.js.map +7 -0
- package/node_modules/lru-cache/dist/esm/package.json +3 -0
- package/node_modules/lru-cache/package.json +116 -0
- package/node_modules/minimist/.eslintrc +29 -0
- package/node_modules/minimist/.github/FUNDING.yml +12 -0
- package/node_modules/minimist/.nycrc +14 -0
- package/node_modules/minimist/CHANGELOG.md +298 -0
- package/node_modules/minimist/LICENSE +18 -0
- package/node_modules/minimist/README.md +121 -0
- package/node_modules/minimist/example/parse.js +4 -0
- package/node_modules/minimist/index.js +263 -0
- package/node_modules/minimist/package.json +75 -0
- package/node_modules/minimist/test/all_bool.js +34 -0
- package/node_modules/minimist/test/bool.js +177 -0
- package/node_modules/minimist/test/dash.js +43 -0
- package/node_modules/minimist/test/default_bool.js +37 -0
- package/node_modules/minimist/test/dotted.js +24 -0
- package/node_modules/minimist/test/kv_short.js +32 -0
- package/node_modules/minimist/test/long.js +33 -0
- package/node_modules/minimist/test/num.js +38 -0
- package/node_modules/minimist/test/parse.js +209 -0
- package/node_modules/minimist/test/parse_modified.js +11 -0
- package/node_modules/minimist/test/proto.js +64 -0
- package/node_modules/minimist/test/short.js +69 -0
- package/node_modules/minimist/test/stop_early.js +17 -0
- package/node_modules/minimist/test/unknown.js +104 -0
- package/node_modules/minimist/test/whitespace.js +10 -0
- package/node_modules/mqtt/CONTRIBUTING.md +27 -0
- package/node_modules/mqtt/LICENSE.md +15 -0
- package/node_modules/mqtt/README.md +960 -0
- package/node_modules/mqtt/build/bin/mqtt.d.ts +2 -0
- package/node_modules/mqtt/build/bin/mqtt.js +30 -0
- package/node_modules/mqtt/build/bin/mqtt.js.map +1 -0
- package/node_modules/mqtt/build/bin/pub.d.ts +2 -0
- package/node_modules/mqtt/build/bin/pub.js +147 -0
- package/node_modules/mqtt/build/bin/pub.js.map +1 -0
- package/node_modules/mqtt/build/bin/sub.d.ts +2 -0
- package/node_modules/mqtt/build/bin/sub.js +121 -0
- package/node_modules/mqtt/build/bin/sub.js.map +1 -0
- package/node_modules/mqtt/build/index.d.ts +3 -0
- package/node_modules/mqtt/build/index.js +32 -0
- package/node_modules/mqtt/build/index.js.map +1 -0
- package/node_modules/mqtt/build/lib/BufferedDuplex.d.ts +20 -0
- package/node_modules/mqtt/build/lib/BufferedDuplex.js +78 -0
- package/node_modules/mqtt/build/lib/BufferedDuplex.js.map +1 -0
- package/node_modules/mqtt/build/lib/KeepaliveManager.d.ts +21 -0
- package/node_modules/mqtt/build/lib/KeepaliveManager.js +73 -0
- package/node_modules/mqtt/build/lib/KeepaliveManager.js.map +1 -0
- package/node_modules/mqtt/build/lib/TypedEmitter.d.ts +19 -0
- package/node_modules/mqtt/build/lib/TypedEmitter.js +13 -0
- package/node_modules/mqtt/build/lib/TypedEmitter.js.map +1 -0
- package/node_modules/mqtt/build/lib/client.d.ts +235 -0
- package/node_modules/mqtt/build/lib/client.js +1211 -0
- package/node_modules/mqtt/build/lib/client.js.map +1 -0
- package/node_modules/mqtt/build/lib/connect/ali.d.ts +3 -0
- package/node_modules/mqtt/build/lib/connect/ali.js +108 -0
- package/node_modules/mqtt/build/lib/connect/ali.js.map +1 -0
- package/node_modules/mqtt/build/lib/connect/index.d.ts +10 -0
- package/node_modules/mqtt/build/lib/connect/index.js +192 -0
- package/node_modules/mqtt/build/lib/connect/index.js.map +1 -0
- package/node_modules/mqtt/build/lib/connect/tcp.d.ts +3 -0
- package/node_modules/mqtt/build/lib/connect/tcp.js +18 -0
- package/node_modules/mqtt/build/lib/connect/tcp.js.map +1 -0
- package/node_modules/mqtt/build/lib/connect/tls.d.ts +3 -0
- package/node_modules/mqtt/build/lib/connect/tls.js +38 -0
- package/node_modules/mqtt/build/lib/connect/tls.js.map +1 -0
- package/node_modules/mqtt/build/lib/connect/ws.d.ts +4 -0
- package/node_modules/mqtt/build/lib/connect/ws.js +217 -0
- package/node_modules/mqtt/build/lib/connect/ws.js.map +1 -0
- package/node_modules/mqtt/build/lib/connect/wx.d.ts +6 -0
- package/node_modules/mqtt/build/lib/connect/wx.js +115 -0
- package/node_modules/mqtt/build/lib/connect/wx.js.map +1 -0
- package/node_modules/mqtt/build/lib/default-message-id-provider.d.ts +16 -0
- package/node_modules/mqtt/build/lib/default-message-id-provider.js +24 -0
- package/node_modules/mqtt/build/lib/default-message-id-provider.js.map +1 -0
- package/node_modules/mqtt/build/lib/get-timer.d.ts +8 -0
- package/node_modules/mqtt/build/lib/get-timer.js +53 -0
- package/node_modules/mqtt/build/lib/get-timer.js.map +1 -0
- package/node_modules/mqtt/build/lib/handlers/ack.d.ts +48 -0
- package/node_modules/mqtt/build/lib/handlers/ack.js +131 -0
- package/node_modules/mqtt/build/lib/handlers/ack.js.map +1 -0
- package/node_modules/mqtt/build/lib/handlers/auth.d.ts +3 -0
- package/node_modules/mqtt/build/lib/handlers/auth.js +30 -0
- package/node_modules/mqtt/build/lib/handlers/auth.js.map +1 -0
- package/node_modules/mqtt/build/lib/handlers/connack.d.ts +3 -0
- package/node_modules/mqtt/build/lib/handlers/connack.js +47 -0
- package/node_modules/mqtt/build/lib/handlers/connack.js.map +1 -0
- package/node_modules/mqtt/build/lib/handlers/index.d.ts +3 -0
- package/node_modules/mqtt/build/lib/handlers/index.js +68 -0
- package/node_modules/mqtt/build/lib/handlers/index.js.map +1 -0
- package/node_modules/mqtt/build/lib/handlers/publish.d.ts +3 -0
- package/node_modules/mqtt/build/lib/handlers/publish.js +106 -0
- package/node_modules/mqtt/build/lib/handlers/publish.js.map +1 -0
- package/node_modules/mqtt/build/lib/handlers/pubrel.d.ts +3 -0
- package/node_modules/mqtt/build/lib/handlers/pubrel.js +25 -0
- package/node_modules/mqtt/build/lib/handlers/pubrel.js.map +1 -0
- package/node_modules/mqtt/build/lib/is-browser.d.ts +4 -0
- package/node_modules/mqtt/build/lib/is-browser.js +27 -0
- package/node_modules/mqtt/build/lib/is-browser.js.map +1 -0
- package/node_modules/mqtt/build/lib/shared.d.ts +23 -0
- package/node_modules/mqtt/build/lib/shared.js +41 -0
- package/node_modules/mqtt/build/lib/shared.js.map +1 -0
- package/node_modules/mqtt/build/lib/store.d.ts +24 -0
- package/node_modules/mqtt/build/lib/store.js +80 -0
- package/node_modules/mqtt/build/lib/store.js.map +1 -0
- package/node_modules/mqtt/build/lib/topic-alias-recv.d.ts +9 -0
- package/node_modules/mqtt/build/lib/topic-alias-recv.js +24 -0
- package/node_modules/mqtt/build/lib/topic-alias-recv.js.map +1 -0
- package/node_modules/mqtt/build/lib/topic-alias-send.d.ts +13 -0
- package/node_modules/mqtt/build/lib/topic-alias-send.js +53 -0
- package/node_modules/mqtt/build/lib/topic-alias-send.js.map +1 -0
- package/node_modules/mqtt/build/lib/unique-message-id-provider.d.ts +11 -0
- package/node_modules/mqtt/build/lib/unique-message-id-provider.js +26 -0
- package/node_modules/mqtt/build/lib/unique-message-id-provider.js.map +1 -0
- package/node_modules/mqtt/build/lib/validations.d.ts +2 -0
- package/node_modules/mqtt/build/lib/validations.js +32 -0
- package/node_modules/mqtt/build/lib/validations.js.map +1 -0
- package/node_modules/mqtt/build/mqtt.d.ts +12 -0
- package/node_modules/mqtt/build/mqtt.js +51 -0
- package/node_modules/mqtt/build/mqtt.js.map +1 -0
- package/node_modules/mqtt/build/tsconfig.build.tsbuildinfo +1 -0
- package/node_modules/mqtt/dist/mqtt.esm.js +10 -0
- package/node_modules/mqtt/dist/mqtt.js +21678 -0
- package/node_modules/mqtt/dist/mqtt.min.js +10 -0
- package/node_modules/mqtt/help/help.txt +8 -0
- package/node_modules/mqtt/help/publish.txt +26 -0
- package/node_modules/mqtt/help/subscribe.txt +26 -0
- package/node_modules/mqtt/package.json +171 -0
- package/node_modules/mqtt/src/bin/mqtt.ts +39 -0
- package/node_modules/mqtt/src/bin/pub.ts +174 -0
- package/node_modules/mqtt/src/bin/sub.ts +146 -0
- package/node_modules/mqtt/src/index.ts +4 -0
- package/node_modules/mqtt/src/lib/BufferedDuplex.ts +115 -0
- package/node_modules/mqtt/src/lib/KeepaliveManager.ts +112 -0
- package/node_modules/mqtt/src/lib/TypedEmitter.ts +71 -0
- package/node_modules/mqtt/src/lib/client.ts +2371 -0
- package/node_modules/mqtt/src/lib/connect/ali.ts +127 -0
- package/node_modules/mqtt/src/lib/connect/index.ts +288 -0
- package/node_modules/mqtt/src/lib/connect/tcp.ts +22 -0
- package/node_modules/mqtt/src/lib/connect/tls.ts +54 -0
- package/node_modules/mqtt/src/lib/connect/ws.ts +303 -0
- package/node_modules/mqtt/src/lib/connect/wx.ts +142 -0
- package/node_modules/mqtt/src/lib/default-message-id-provider.ts +99 -0
- package/node_modules/mqtt/src/lib/get-timer.ts +40 -0
- package/node_modules/mqtt/src/lib/handlers/ack.ts +159 -0
- package/node_modules/mqtt/src/lib/handlers/auth.ts +44 -0
- package/node_modules/mqtt/src/lib/handlers/connack.ts +55 -0
- package/node_modules/mqtt/src/lib/handlers/index.ts +74 -0
- package/node_modules/mqtt/src/lib/handlers/publish.ts +183 -0
- package/node_modules/mqtt/src/lib/handlers/pubrel.ts +27 -0
- package/node_modules/mqtt/src/lib/is-browser.ts +46 -0
- package/node_modules/mqtt/src/lib/shared.ts +87 -0
- package/node_modules/mqtt/src/lib/store.ts +166 -0
- package/node_modules/mqtt/src/lib/topic-alias-recv.ts +48 -0
- package/node_modules/mqtt/src/lib/topic-alias-send.ts +96 -0
- package/node_modules/mqtt/src/lib/unique-message-id-provider.ts +64 -0
- package/node_modules/mqtt/src/lib/validations.ts +46 -0
- package/node_modules/mqtt/src/mqtt.ts +28 -0
- package/node_modules/mqtt-packet/.github/workflows/ci.yml +27 -0
- package/node_modules/mqtt-packet/CONTRIBUTING.md +27 -0
- package/node_modules/mqtt-packet/LICENSE.md +13 -0
- package/node_modules/mqtt-packet/README.md +491 -0
- package/node_modules/mqtt-packet/benchmarks/generate.js +26 -0
- package/node_modules/mqtt-packet/benchmarks/generateNet.js +50 -0
- package/node_modules/mqtt-packet/benchmarks/parse.js +19 -0
- package/node_modules/mqtt-packet/benchmarks/writeToStream.js +48 -0
- package/node_modules/mqtt-packet/constants.js +291 -0
- package/node_modules/mqtt-packet/generate.js +57 -0
- package/node_modules/mqtt-packet/mqtt.js +3 -0
- package/node_modules/mqtt-packet/numbers.js +59 -0
- package/node_modules/mqtt-packet/package.json +48 -0
- package/node_modules/mqtt-packet/packet.js +13 -0
- package/node_modules/mqtt-packet/parser.js +809 -0
- package/node_modules/mqtt-packet/test.js +3177 -0
- package/node_modules/mqtt-packet/testRandom.js +86 -0
- package/node_modules/mqtt-packet/types/index.d.ts +257 -0
- package/node_modules/mqtt-packet/writeToStream.js +1127 -0
- package/node_modules/ms/index.js +162 -0
- package/node_modules/ms/license.md +21 -0
- package/node_modules/ms/package.json +37 -0
- package/node_modules/ms/readme.md +60 -0
- package/node_modules/number-allocator/.github/workflows/nodejs.yml +33 -0
- package/node_modules/number-allocator/CHANGELOG.md +47 -0
- package/node_modules/number-allocator/LICENSE +21 -0
- package/node_modules/number-allocator/README.md +203 -0
- package/node_modules/number-allocator/index.js +7 -0
- package/node_modules/number-allocator/karma.conf.js +63 -0
- package/node_modules/number-allocator/lib/number-allocator.js +249 -0
- package/node_modules/number-allocator/package.json +69 -0
- package/node_modules/number-allocator/test/test.js +337 -0
- package/node_modules/number-allocator/test/typescript/test.ts +24 -0
- package/node_modules/number-allocator/test/typescript/tsconfig.json +14 -0
- package/node_modules/number-allocator/types/index.d.ts +1 -0
- package/node_modules/number-allocator/types/lib/number-allocator.d.ts +65 -0
- package/node_modules/process/.eslintrc +21 -0
- package/node_modules/process/LICENSE +22 -0
- package/node_modules/process/README.md +26 -0
- package/node_modules/process/browser.js +184 -0
- package/node_modules/process/index.js +2 -0
- package/node_modules/process/package.json +27 -0
- package/node_modules/process/test.js +199 -0
- package/node_modules/process-nextick-args/index.js +45 -0
- package/node_modules/process-nextick-args/license.md +19 -0
- package/node_modules/process-nextick-args/package.json +25 -0
- package/node_modules/process-nextick-args/readme.md +18 -0
- package/node_modules/readable-stream/LICENSE +47 -0
- package/node_modules/readable-stream/README.md +116 -0
- package/node_modules/readable-stream/lib/_stream_duplex.js +4 -0
- package/node_modules/readable-stream/lib/_stream_passthrough.js +4 -0
- package/node_modules/readable-stream/lib/_stream_readable.js +4 -0
- package/node_modules/readable-stream/lib/_stream_transform.js +4 -0
- package/node_modules/readable-stream/lib/_stream_writable.js +4 -0
- package/node_modules/readable-stream/lib/internal/streams/add-abort-signal.js +52 -0
- package/node_modules/readable-stream/lib/internal/streams/buffer_list.js +157 -0
- package/node_modules/readable-stream/lib/internal/streams/compose.js +194 -0
- package/node_modules/readable-stream/lib/internal/streams/destroy.js +290 -0
- package/node_modules/readable-stream/lib/internal/streams/duplex.js +143 -0
- package/node_modules/readable-stream/lib/internal/streams/duplexify.js +378 -0
- package/node_modules/readable-stream/lib/internal/streams/end-of-stream.js +284 -0
- package/node_modules/readable-stream/lib/internal/streams/from.js +98 -0
- package/node_modules/readable-stream/lib/internal/streams/lazy_transform.js +51 -0
- package/node_modules/readable-stream/lib/internal/streams/legacy.js +89 -0
- package/node_modules/readable-stream/lib/internal/streams/operators.js +457 -0
- package/node_modules/readable-stream/lib/internal/streams/passthrough.js +39 -0
- package/node_modules/readable-stream/lib/internal/streams/pipeline.js +471 -0
- package/node_modules/readable-stream/lib/internal/streams/readable.js +1288 -0
- package/node_modules/readable-stream/lib/internal/streams/state.js +39 -0
- package/node_modules/readable-stream/lib/internal/streams/transform.js +180 -0
- package/node_modules/readable-stream/lib/internal/streams/utils.js +329 -0
- package/node_modules/readable-stream/lib/internal/streams/writable.js +817 -0
- package/node_modules/readable-stream/lib/internal/validators.js +530 -0
- package/node_modules/readable-stream/lib/ours/browser.js +35 -0
- package/node_modules/readable-stream/lib/ours/errors.js +341 -0
- package/node_modules/readable-stream/lib/ours/index.js +65 -0
- package/node_modules/readable-stream/lib/ours/primordials.js +107 -0
- package/node_modules/readable-stream/lib/ours/util.js +200 -0
- package/node_modules/readable-stream/lib/stream/promises.js +43 -0
- package/node_modules/readable-stream/lib/stream.js +141 -0
- package/node_modules/readable-stream/package.json +86 -0
- package/node_modules/regenerator-runtime/LICENSE +21 -0
- package/node_modules/regenerator-runtime/README.md +31 -0
- package/node_modules/regenerator-runtime/package.json +19 -0
- package/node_modules/regenerator-runtime/path.js +11 -0
- package/node_modules/regenerator-runtime/runtime.js +761 -0
- package/node_modules/reinterval/.npmignore +27 -0
- package/node_modules/reinterval/.travis.yml +20 -0
- package/node_modules/reinterval/LICENSE +22 -0
- package/node_modules/reinterval/README.md +60 -0
- package/node_modules/reinterval/index.js +57 -0
- package/node_modules/reinterval/package.json +32 -0
- package/node_modules/reinterval/tests/test.js +52 -0
- package/node_modules/rfdc/.github/workflows/ci.yml +21 -0
- package/node_modules/rfdc/LICENSE +15 -0
- package/node_modules/rfdc/default.js +3 -0
- package/node_modules/rfdc/index.d.ts +13 -0
- package/node_modules/rfdc/index.js +198 -0
- package/node_modules/rfdc/index.test-d.ts +13 -0
- package/node_modules/rfdc/package.json +73 -0
- package/node_modules/rfdc/readme.md +181 -0
- package/node_modules/rfdc/test/index.js +306 -0
- package/node_modules/safe-buffer/LICENSE +21 -0
- package/node_modules/safe-buffer/README.md +584 -0
- package/node_modules/safe-buffer/index.d.ts +187 -0
- package/node_modules/safe-buffer/index.js +62 -0
- package/node_modules/safe-buffer/package.json +37 -0
- package/node_modules/split2/LICENSE +13 -0
- package/node_modules/split2/README.md +85 -0
- package/node_modules/split2/bench.js +27 -0
- package/node_modules/split2/index.js +141 -0
- package/node_modules/split2/package.json +39 -0
- package/node_modules/split2/test.js +409 -0
- package/node_modules/string_decoder/LICENSE +48 -0
- package/node_modules/string_decoder/README.md +47 -0
- package/node_modules/string_decoder/lib/string_decoder.js +296 -0
- package/node_modules/string_decoder/node_modules/safe-buffer/LICENSE +21 -0
- package/node_modules/string_decoder/node_modules/safe-buffer/README.md +584 -0
- package/node_modules/string_decoder/node_modules/safe-buffer/index.d.ts +187 -0
- package/node_modules/string_decoder/node_modules/safe-buffer/index.js +65 -0
- package/node_modules/string_decoder/node_modules/safe-buffer/package.json +51 -0
- package/node_modules/string_decoder/package.json +34 -0
- package/node_modules/tslib/CopyrightNotice.txt +15 -0
- package/node_modules/tslib/LICENSE.txt +12 -0
- package/node_modules/tslib/README.md +164 -0
- package/node_modules/tslib/SECURITY.md +41 -0
- package/node_modules/tslib/modules/index.d.ts +37 -0
- package/node_modules/tslib/modules/index.js +68 -0
- package/node_modules/tslib/modules/package.json +3 -0
- package/node_modules/tslib/package.json +47 -0
- package/node_modules/tslib/tslib.d.ts +453 -0
- package/node_modules/tslib/tslib.es6.html +1 -0
- package/node_modules/tslib/tslib.es6.js +379 -0
- package/node_modules/tslib/tslib.es6.mjs +378 -0
- package/node_modules/tslib/tslib.html +1 -0
- package/node_modules/tslib/tslib.js +429 -0
- package/node_modules/typedarray/.travis.yml +4 -0
- package/node_modules/typedarray/LICENSE +35 -0
- package/node_modules/typedarray/example/tarray.js +4 -0
- package/node_modules/typedarray/index.js +630 -0
- package/node_modules/typedarray/package.json +55 -0
- package/node_modules/typedarray/readme.markdown +61 -0
- package/node_modules/typedarray/test/server/undef_globals.js +19 -0
- package/node_modules/typedarray/test/tarray.js +10 -0
- package/node_modules/undici-types/LICENSE +21 -0
- package/node_modules/undici-types/README.md +6 -0
- package/node_modules/undici-types/agent.d.ts +31 -0
- package/node_modules/undici-types/api.d.ts +43 -0
- package/node_modules/undici-types/balanced-pool.d.ts +29 -0
- package/node_modules/undici-types/cache.d.ts +36 -0
- package/node_modules/undici-types/client.d.ts +108 -0
- package/node_modules/undici-types/connector.d.ts +34 -0
- package/node_modules/undici-types/content-type.d.ts +21 -0
- package/node_modules/undici-types/cookies.d.ts +28 -0
- package/node_modules/undici-types/diagnostics-channel.d.ts +66 -0
- package/node_modules/undici-types/dispatcher.d.ts +255 -0
- package/node_modules/undici-types/env-http-proxy-agent.d.ts +21 -0
- package/node_modules/undici-types/errors.d.ts +149 -0
- package/node_modules/undici-types/eventsource.d.ts +63 -0
- package/node_modules/undici-types/fetch.d.ts +209 -0
- package/node_modules/undici-types/file.d.ts +39 -0
- package/node_modules/undici-types/filereader.d.ts +54 -0
- package/node_modules/undici-types/formdata.d.ts +108 -0
- package/node_modules/undici-types/global-dispatcher.d.ts +9 -0
- package/node_modules/undici-types/global-origin.d.ts +7 -0
- package/node_modules/undici-types/handlers.d.ts +15 -0
- package/node_modules/undici-types/header.d.ts +4 -0
- package/node_modules/undici-types/index.d.ts +71 -0
- package/node_modules/undici-types/interceptors.d.ts +15 -0
- package/node_modules/undici-types/mock-agent.d.ts +50 -0
- package/node_modules/undici-types/mock-client.d.ts +25 -0
- package/node_modules/undici-types/mock-errors.d.ts +12 -0
- package/node_modules/undici-types/mock-interceptor.d.ts +93 -0
- package/node_modules/undici-types/mock-pool.d.ts +25 -0
- package/node_modules/undici-types/package.json +55 -0
- package/node_modules/undici-types/patch.d.ts +71 -0
- package/node_modules/undici-types/pool-stats.d.ts +19 -0
- package/node_modules/undici-types/pool.d.ts +39 -0
- package/node_modules/undici-types/proxy-agent.d.ts +28 -0
- package/node_modules/undici-types/readable.d.ts +60 -0
- package/node_modules/undici-types/retry-agent.d.ts +8 -0
- package/node_modules/undici-types/retry-handler.d.ts +116 -0
- package/node_modules/undici-types/util.d.ts +18 -0
- package/node_modules/undici-types/webidl.d.ts +222 -0
- package/node_modules/undici-types/websocket.d.ts +152 -0
- package/node_modules/util-deprecate/History.md +16 -0
- package/node_modules/util-deprecate/LICENSE +24 -0
- package/node_modules/util-deprecate/README.md +53 -0
- package/node_modules/util-deprecate/browser.js +67 -0
- package/node_modules/util-deprecate/node.js +6 -0
- package/node_modules/util-deprecate/package.json +27 -0
- package/node_modules/worker-timers/LICENSE +21 -0
- package/node_modules/worker-timers/README.md +79 -0
- package/node_modules/worker-timers/build/es2019/factories/load-or-return-broker.d.ts +2 -0
- package/node_modules/worker-timers/build/es2019/factories/load-or-return-broker.d.ts.map +1 -0
- package/node_modules/worker-timers/build/es2019/factories/load-or-return-broker.js +15 -0
- package/node_modules/worker-timers/build/es2019/factories/load-or-return-broker.js.map +1 -0
- package/node_modules/worker-timers/build/es2019/module.d.ts +6 -0
- package/node_modules/worker-timers/build/es2019/module.d.ts.map +1 -0
- package/node_modules/worker-timers/build/es2019/module.js +9 -0
- package/node_modules/worker-timers/build/es2019/module.js.map +1 -0
- package/node_modules/worker-timers/build/es2019/worker/worker.d.ts +2 -0
- package/node_modules/worker-timers/build/es2019/worker/worker.d.ts.map +1 -0
- package/node_modules/worker-timers/build/es2019/worker/worker.js +3 -0
- package/node_modules/worker-timers/build/es2019/worker/worker.js.map +1 -0
- package/node_modules/worker-timers/build/es5/bundle.js +50 -0
- package/node_modules/worker-timers/package.json +106 -0
- package/node_modules/worker-timers/src/factories/load-or-return-broker.ts +19 -0
- package/node_modules/worker-timers/src/module.ts +13 -0
- package/node_modules/worker-timers/src/tsconfig.json +6 -0
- package/node_modules/worker-timers/src/worker/worker.ts +2 -0
- package/node_modules/worker-timers-broker/LICENSE +21 -0
- package/node_modules/worker-timers-broker/README.md +5 -0
- package/node_modules/worker-timers-broker/build/es2019/guards/call-notification.d.ts +3 -0
- package/node_modules/worker-timers-broker/build/es2019/guards/call-notification.d.ts.map +1 -0
- package/node_modules/worker-timers-broker/build/es2019/guards/call-notification.js +4 -0
- package/node_modules/worker-timers-broker/build/es2019/guards/call-notification.js.map +1 -0
- package/node_modules/worker-timers-broker/build/es2019/guards/clear-response.d.ts +3 -0
- package/node_modules/worker-timers-broker/build/es2019/guards/clear-response.d.ts.map +1 -0
- package/node_modules/worker-timers-broker/build/es2019/guards/clear-response.js +4 -0
- package/node_modules/worker-timers-broker/build/es2019/guards/clear-response.js.map +1 -0
- package/node_modules/worker-timers-broker/build/es2019/module.d.ts +7 -0
- package/node_modules/worker-timers-broker/build/es2019/module.d.ts.map +1 -0
- package/node_modules/worker-timers-broker/build/es2019/module.js +142 -0
- package/node_modules/worker-timers-broker/build/es2019/module.js.map +1 -0
- package/node_modules/worker-timers-broker/build/es5/bundle.js +162 -0
- package/node_modules/worker-timers-broker/package.json +84 -0
- package/node_modules/worker-timers-broker/src/guards/call-notification.ts +5 -0
- package/node_modules/worker-timers-broker/src/guards/clear-response.ts +5 -0
- package/node_modules/worker-timers-broker/src/module.ts +173 -0
- package/node_modules/worker-timers-broker/src/tsconfig.json +6 -0
- package/node_modules/worker-timers-worker/LICENSE +21 -0
- package/node_modules/worker-timers-worker/README.md +5 -0
- package/node_modules/worker-timers-worker/build/es2019/helpers/timer.d.ts +5 -0
- package/node_modules/worker-timers-worker/build/es2019/helpers/timer.d.ts.map +1 -0
- package/node_modules/worker-timers-worker/build/es2019/helpers/timer.js +50 -0
- package/node_modules/worker-timers-worker/build/es2019/helpers/timer.js.map +1 -0
- package/node_modules/worker-timers-worker/build/es2019/interfaces/broker-event.d.ts +5 -0
- package/node_modules/worker-timers-worker/build/es2019/interfaces/broker-event.d.ts.map +1 -0
- package/node_modules/worker-timers-worker/build/es2019/interfaces/broker-event.js +2 -0
- package/node_modules/worker-timers-worker/build/es2019/interfaces/broker-event.js.map +1 -0
- package/node_modules/worker-timers-worker/build/es2019/interfaces/call-notification.d.ts +10 -0
- package/node_modules/worker-timers-worker/build/es2019/interfaces/call-notification.d.ts.map +1 -0
- package/node_modules/worker-timers-worker/build/es2019/interfaces/call-notification.js +2 -0
- package/node_modules/worker-timers-worker/build/es2019/interfaces/call-notification.js.map +1 -0
- package/node_modules/worker-timers-worker/build/es2019/interfaces/clear-request.d.ts +10 -0
- package/node_modules/worker-timers-worker/build/es2019/interfaces/clear-request.d.ts.map +1 -0
- package/node_modules/worker-timers-worker/build/es2019/interfaces/clear-request.js +2 -0
- package/node_modules/worker-timers-worker/build/es2019/interfaces/clear-request.js.map +1 -0
- package/node_modules/worker-timers-worker/build/es2019/interfaces/clear-response.d.ts +5 -0
- package/node_modules/worker-timers-worker/build/es2019/interfaces/clear-response.d.ts.map +1 -0
- package/node_modules/worker-timers-worker/build/es2019/interfaces/clear-response.js +2 -0
- package/node_modules/worker-timers-worker/build/es2019/interfaces/clear-response.js.map +1 -0
- package/node_modules/worker-timers-worker/build/es2019/interfaces/error-notification.d.ts +8 -0
- package/node_modules/worker-timers-worker/build/es2019/interfaces/error-notification.d.ts.map +1 -0
- package/node_modules/worker-timers-worker/build/es2019/interfaces/error-notification.js +2 -0
- package/node_modules/worker-timers-worker/build/es2019/interfaces/error-notification.js.map +1 -0
- package/node_modules/worker-timers-worker/build/es2019/interfaces/error-response.d.ts +8 -0
- package/node_modules/worker-timers-worker/build/es2019/interfaces/error-response.d.ts.map +1 -0
- package/node_modules/worker-timers-worker/build/es2019/interfaces/error-response.js +2 -0
- package/node_modules/worker-timers-worker/build/es2019/interfaces/error-response.js.map +1 -0
- package/node_modules/worker-timers-worker/build/es2019/interfaces/index.d.ts +9 -0
- package/node_modules/worker-timers-worker/build/es2019/interfaces/index.d.ts.map +1 -0
- package/node_modules/worker-timers-worker/build/es2019/interfaces/index.js +9 -0
- package/node_modules/worker-timers-worker/build/es2019/interfaces/index.js.map +1 -0
- package/node_modules/worker-timers-worker/build/es2019/interfaces/set-notification.d.ts +12 -0
- package/node_modules/worker-timers-worker/build/es2019/interfaces/set-notification.d.ts.map +1 -0
- package/node_modules/worker-timers-worker/build/es2019/interfaces/set-notification.js +2 -0
- package/node_modules/worker-timers-worker/build/es2019/interfaces/set-notification.js.map +1 -0
- package/node_modules/worker-timers-worker/build/es2019/interfaces/worker-event.d.ts +5 -0
- package/node_modules/worker-timers-worker/build/es2019/interfaces/worker-event.d.ts.map +1 -0
- package/node_modules/worker-timers-worker/build/es2019/interfaces/worker-event.js +2 -0
- package/node_modules/worker-timers-worker/build/es2019/interfaces/worker-event.js.map +1 -0
- package/node_modules/worker-timers-worker/build/es2019/module.d.ts +3 -0
- package/node_modules/worker-timers-worker/build/es2019/module.d.ts.map +1 -0
- package/node_modules/worker-timers-worker/build/es2019/module.js +50 -0
- package/node_modules/worker-timers-worker/build/es2019/module.js.map +1 -0
- package/node_modules/worker-timers-worker/build/es2019/types/broker-message.d.ts +3 -0
- package/node_modules/worker-timers-worker/build/es2019/types/broker-message.d.ts.map +1 -0
- package/node_modules/worker-timers-worker/build/es2019/types/broker-message.js +2 -0
- package/node_modules/worker-timers-worker/build/es2019/types/broker-message.js.map +1 -0
- package/node_modules/worker-timers-worker/build/es2019/types/index.d.ts +4 -0
- package/node_modules/worker-timers-worker/build/es2019/types/index.d.ts.map +1 -0
- package/node_modules/worker-timers-worker/build/es2019/types/index.js +4 -0
- package/node_modules/worker-timers-worker/build/es2019/types/index.js.map +1 -0
- package/node_modules/worker-timers-worker/build/es2019/types/timer-type.d.ts +2 -0
- package/node_modules/worker-timers-worker/build/es2019/types/timer-type.d.ts.map +1 -0
- package/node_modules/worker-timers-worker/build/es2019/types/timer-type.js +2 -0
- package/node_modules/worker-timers-worker/build/es2019/types/timer-type.js.map +1 -0
- package/node_modules/worker-timers-worker/build/es2019/types/worker-message.d.ts +3 -0
- package/node_modules/worker-timers-worker/build/es2019/types/worker-message.d.ts.map +1 -0
- package/node_modules/worker-timers-worker/build/es2019/types/worker-message.js +2 -0
- package/node_modules/worker-timers-worker/build/es2019/types/worker-message.js.map +1 -0
- package/node_modules/worker-timers-worker/build/es5/bundle.js +117 -0
- package/node_modules/worker-timers-worker/package.json +91 -0
- package/node_modules/worker-timers-worker/src/helpers/timer.ts +68 -0
- package/node_modules/worker-timers-worker/src/interfaces/broker-event.ts +5 -0
- package/node_modules/worker-timers-worker/src/interfaces/call-notification.ts +13 -0
- package/node_modules/worker-timers-worker/src/interfaces/clear-request.ts +13 -0
- package/node_modules/worker-timers-worker/src/interfaces/clear-response.ts +5 -0
- package/node_modules/worker-timers-worker/src/interfaces/error-notification.ts +9 -0
- package/node_modules/worker-timers-worker/src/interfaces/error-response.ts +9 -0
- package/node_modules/worker-timers-worker/src/interfaces/index.ts +8 -0
- package/node_modules/worker-timers-worker/src/interfaces/set-notification.ts +17 -0
- package/node_modules/worker-timers-worker/src/interfaces/worker-event.ts +5 -0
- package/node_modules/worker-timers-worker/src/module.ts +54 -0
- package/node_modules/worker-timers-worker/src/tsconfig.json +6 -0
- package/node_modules/worker-timers-worker/src/types/broker-message.ts +3 -0
- package/node_modules/worker-timers-worker/src/types/index.ts +3 -0
- package/node_modules/worker-timers-worker/src/types/timer-type.ts +1 -0
- package/node_modules/worker-timers-worker/src/types/worker-message.ts +3 -0
- package/node_modules/ws/LICENSE +20 -0
- package/node_modules/ws/README.md +548 -0
- package/node_modules/ws/browser.js +8 -0
- package/node_modules/ws/index.js +13 -0
- package/node_modules/ws/lib/buffer-util.js +131 -0
- package/node_modules/ws/lib/constants.js +18 -0
- package/node_modules/ws/lib/event-target.js +292 -0
- package/node_modules/ws/lib/extension.js +203 -0
- package/node_modules/ws/lib/limiter.js +55 -0
- package/node_modules/ws/lib/permessage-deflate.js +514 -0
- package/node_modules/ws/lib/receiver.js +706 -0
- package/node_modules/ws/lib/sender.js +602 -0
- package/node_modules/ws/lib/stream.js +159 -0
- package/node_modules/ws/lib/subprotocol.js +62 -0
- package/node_modules/ws/lib/validation.js +152 -0
- package/node_modules/ws/lib/websocket-server.js +540 -0
- package/node_modules/ws/lib/websocket.js +1388 -0
- package/node_modules/ws/package.json +69 -0
- package/node_modules/ws/wrapper.mjs +8 -0
- package/package.json +51 -0
|
@@ -0,0 +1,3177 @@
|
|
|
1
|
+
const util = require('util')
|
|
2
|
+
|
|
3
|
+
const test = require('tape')
|
|
4
|
+
const mqtt = require('./')
|
|
5
|
+
const WS = require('readable-stream').Writable
|
|
6
|
+
|
|
7
|
+
function normalExpectedObject (object) {
|
|
8
|
+
if (object.username != null) object.username = object.username.toString()
|
|
9
|
+
if (object.password != null) object.password = Buffer.from(object.password)
|
|
10
|
+
return object
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function testParseGenerate (name, object, buffer, opts) {
|
|
14
|
+
test(`${name} parse`, t => {
|
|
15
|
+
t.plan(2)
|
|
16
|
+
|
|
17
|
+
const parser = mqtt.parser(opts)
|
|
18
|
+
const expected = object
|
|
19
|
+
const fixture = buffer
|
|
20
|
+
|
|
21
|
+
parser.on('packet', packet => {
|
|
22
|
+
if (packet.cmd !== 'publish') {
|
|
23
|
+
delete packet.topic
|
|
24
|
+
delete packet.payload
|
|
25
|
+
}
|
|
26
|
+
t.deepLooseEqual(packet, normalExpectedObject(expected), 'expected packet')
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
parser.on('error', err => {
|
|
30
|
+
t.fail(err)
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
t.equal(parser.parse(fixture), 0, 'remaining bytes')
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
test(`${name} generate`, t => {
|
|
37
|
+
// For really large buffers, the expanded hex string can be so long as to
|
|
38
|
+
// generate an error in nodejs 14.x, so only do the test with extra output
|
|
39
|
+
// for relatively small buffers.
|
|
40
|
+
const bigLength = 10000
|
|
41
|
+
const generatedBuffer = mqtt.generate(object, opts)
|
|
42
|
+
if (generatedBuffer.length < bigLength && buffer.length < bigLength) {
|
|
43
|
+
t.equal(generatedBuffer.toString('hex'), buffer.toString('hex'))
|
|
44
|
+
} else {
|
|
45
|
+
const bufferOkay = generatedBuffer.equals(buffer)
|
|
46
|
+
if (bufferOkay) {
|
|
47
|
+
t.pass()
|
|
48
|
+
} else {
|
|
49
|
+
// Output abbreviated representations of the buffers.
|
|
50
|
+
t.comment('Expected:\n' + util.inspect(buffer))
|
|
51
|
+
t.comment('Got:\n' + util.inspect(generatedBuffer))
|
|
52
|
+
t.fail('Large buffers not equal')
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
t.end()
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
test(`${name} mirror`, t => {
|
|
59
|
+
t.plan(2)
|
|
60
|
+
|
|
61
|
+
const parser = mqtt.parser(opts)
|
|
62
|
+
const expected = object
|
|
63
|
+
const fixture = mqtt.generate(object, opts)
|
|
64
|
+
|
|
65
|
+
parser.on('packet', packet => {
|
|
66
|
+
if (packet.cmd !== 'publish') {
|
|
67
|
+
delete packet.topic
|
|
68
|
+
delete packet.payload
|
|
69
|
+
}
|
|
70
|
+
t.deepLooseEqual(packet, normalExpectedObject(expected), 'expected packet')
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
parser.on('error', err => {
|
|
74
|
+
t.fail(err)
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
t.equal(parser.parse(fixture), 0, 'remaining bytes')
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
test(`${name} writeToStream`, t => {
|
|
81
|
+
const stream = WS()
|
|
82
|
+
stream.write = () => true
|
|
83
|
+
stream.on('error', (err) => t.fail(err))
|
|
84
|
+
|
|
85
|
+
const result = mqtt.writeToStream(object, stream, opts)
|
|
86
|
+
t.equal(result, true, 'should return true')
|
|
87
|
+
t.end()
|
|
88
|
+
})
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// the API allows to pass strings as buffers to writeToStream and generate
|
|
92
|
+
// parsing them back will result in a string so only generate and compare to buffer
|
|
93
|
+
function testGenerateOnly (name, object, buffer, opts) {
|
|
94
|
+
test(name, t => {
|
|
95
|
+
t.equal(mqtt.generate(object, opts).toString('hex'), buffer.toString('hex'))
|
|
96
|
+
t.end()
|
|
97
|
+
})
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function testParseOnly (name, object, buffer, opts) {
|
|
101
|
+
test(name, t => {
|
|
102
|
+
const parser = mqtt.parser(opts)
|
|
103
|
+
// const expected = object
|
|
104
|
+
// const fixture = buffer
|
|
105
|
+
|
|
106
|
+
t.plan(2 + Object.keys(object).length)
|
|
107
|
+
|
|
108
|
+
parser.on('packet', packet => {
|
|
109
|
+
t.equal(Object.keys(object).length, Object.keys(packet).length, 'key count')
|
|
110
|
+
Object.keys(object).forEach(key => {
|
|
111
|
+
t.deepEqual(packet[key], object[key], `expected packet property ${key}`)
|
|
112
|
+
})
|
|
113
|
+
})
|
|
114
|
+
|
|
115
|
+
t.equal(parser.parse(buffer), 0, 'remaining bytes')
|
|
116
|
+
t.end()
|
|
117
|
+
})
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function testParseError (expected, fixture, opts) {
|
|
121
|
+
test(expected, t => {
|
|
122
|
+
t.plan(1)
|
|
123
|
+
|
|
124
|
+
const parser = mqtt.parser(opts)
|
|
125
|
+
|
|
126
|
+
parser.on('error', err => {
|
|
127
|
+
t.equal(err.message, expected, 'expected error message')
|
|
128
|
+
})
|
|
129
|
+
|
|
130
|
+
parser.on('packet', () => {
|
|
131
|
+
t.fail('parse errors should not be followed by packet events')
|
|
132
|
+
})
|
|
133
|
+
|
|
134
|
+
parser.parse(fixture)
|
|
135
|
+
t.end()
|
|
136
|
+
})
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function testGenerateError (expected, fixture, opts, name) {
|
|
140
|
+
test(name || expected, t => {
|
|
141
|
+
t.plan(1)
|
|
142
|
+
|
|
143
|
+
try {
|
|
144
|
+
mqtt.generate(fixture, opts)
|
|
145
|
+
} catch (err) {
|
|
146
|
+
t.equal(expected, err.message)
|
|
147
|
+
}
|
|
148
|
+
t.end()
|
|
149
|
+
})
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function testGenerateErrorMultipleCmds (cmds, expected, fixture, opts) {
|
|
153
|
+
cmds.forEach(cmd => {
|
|
154
|
+
const obj = Object.assign({}, fixture)
|
|
155
|
+
obj.cmd = cmd
|
|
156
|
+
testGenerateError(expected, obj, opts, `${expected} on ${cmd}`)
|
|
157
|
+
}
|
|
158
|
+
)
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function testParseGenerateDefaults (name, object, buffer, generated, opts) {
|
|
162
|
+
testParseOnly(`${name} parse`, generated, buffer, opts)
|
|
163
|
+
testGenerateOnly(`${name} generate`, object, buffer, opts)
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function testParseAndGenerate (name, object, buffer, opts) {
|
|
167
|
+
testParseOnly(`${name} parse`, object, buffer, opts)
|
|
168
|
+
testGenerateOnly(`${name} generate`, object, buffer, opts)
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function testWriteToStreamError (expected, fixture) {
|
|
172
|
+
test(`writeToStream ${expected} error`, t => {
|
|
173
|
+
t.plan(2)
|
|
174
|
+
|
|
175
|
+
const stream = WS()
|
|
176
|
+
|
|
177
|
+
stream.write = () => t.fail('should not have called write')
|
|
178
|
+
stream.on('error', () => t.pass('error emitted'))
|
|
179
|
+
|
|
180
|
+
const result = mqtt.writeToStream(fixture, stream)
|
|
181
|
+
|
|
182
|
+
t.false(result, 'result should be false')
|
|
183
|
+
})
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
test('cacheNumbers get/set/unset', t => {
|
|
187
|
+
t.true(mqtt.writeToStream.cacheNumbers, 'initial state of cacheNumbers is enabled')
|
|
188
|
+
mqtt.writeToStream.cacheNumbers = false
|
|
189
|
+
t.false(mqtt.writeToStream.cacheNumbers, 'cacheNumbers can be disabled')
|
|
190
|
+
mqtt.writeToStream.cacheNumbers = true
|
|
191
|
+
t.true(mqtt.writeToStream.cacheNumbers, 'cacheNumbers can be enabled')
|
|
192
|
+
t.end()
|
|
193
|
+
})
|
|
194
|
+
|
|
195
|
+
test('disabled numbers cache', t => {
|
|
196
|
+
const stream = WS()
|
|
197
|
+
const message = {
|
|
198
|
+
cmd: 'publish',
|
|
199
|
+
retain: false,
|
|
200
|
+
qos: 0,
|
|
201
|
+
dup: false,
|
|
202
|
+
length: 10,
|
|
203
|
+
topic: Buffer.from('test'),
|
|
204
|
+
payload: Buffer.from('test')
|
|
205
|
+
}
|
|
206
|
+
const expected = Buffer.from([
|
|
207
|
+
48, 10, // Header
|
|
208
|
+
0, 4, // Topic length
|
|
209
|
+
116, 101, 115, 116, // Topic (test)
|
|
210
|
+
116, 101, 115, 116 // Payload (test)
|
|
211
|
+
])
|
|
212
|
+
let written = Buffer.alloc(0)
|
|
213
|
+
|
|
214
|
+
stream.write = (chunk) => {
|
|
215
|
+
written = Buffer.concat([written, chunk])
|
|
216
|
+
}
|
|
217
|
+
mqtt.writeToStream.cacheNumbers = false
|
|
218
|
+
|
|
219
|
+
mqtt.writeToStream(message, stream)
|
|
220
|
+
|
|
221
|
+
t.deepEqual(written, expected, 'written buffer is expected')
|
|
222
|
+
|
|
223
|
+
mqtt.writeToStream.cacheNumbers = true
|
|
224
|
+
|
|
225
|
+
stream.end()
|
|
226
|
+
t.end()
|
|
227
|
+
})
|
|
228
|
+
|
|
229
|
+
testGenerateError('Unknown command', {})
|
|
230
|
+
|
|
231
|
+
testParseError('Not supported', Buffer.from([0, 1, 0]), {})
|
|
232
|
+
|
|
233
|
+
// Length header field
|
|
234
|
+
testParseError('Invalid variable byte integer', Buffer.from(
|
|
235
|
+
[16, 255, 255, 255, 255]
|
|
236
|
+
), {})
|
|
237
|
+
testParseError('Invalid variable byte integer', Buffer.from(
|
|
238
|
+
[16, 255, 255, 255, 128]
|
|
239
|
+
), {})
|
|
240
|
+
testParseError('Invalid variable byte integer', Buffer.from(
|
|
241
|
+
[16, 255, 255, 255, 255, 1]
|
|
242
|
+
), {})
|
|
243
|
+
testParseError('Invalid variable byte integer', Buffer.from(
|
|
244
|
+
[16, 255, 255, 255, 255, 127]
|
|
245
|
+
), {})
|
|
246
|
+
testParseError('Invalid variable byte integer', Buffer.from(
|
|
247
|
+
[16, 255, 255, 255, 255, 128]
|
|
248
|
+
), {})
|
|
249
|
+
testParseError('Invalid variable byte integer', Buffer.from(
|
|
250
|
+
[16, 255, 255, 255, 255, 255, 1]
|
|
251
|
+
), {})
|
|
252
|
+
|
|
253
|
+
testParseGenerate('minimal connect', {
|
|
254
|
+
cmd: 'connect',
|
|
255
|
+
retain: false,
|
|
256
|
+
qos: 0,
|
|
257
|
+
dup: false,
|
|
258
|
+
length: 18,
|
|
259
|
+
protocolId: 'MQIsdp',
|
|
260
|
+
protocolVersion: 3,
|
|
261
|
+
clean: false,
|
|
262
|
+
keepalive: 30,
|
|
263
|
+
clientId: 'test'
|
|
264
|
+
}, Buffer.from([
|
|
265
|
+
16, 18, // Header
|
|
266
|
+
0, 6, // Protocol ID length
|
|
267
|
+
77, 81, 73, 115, 100, 112, // Protocol ID
|
|
268
|
+
3, // Protocol version
|
|
269
|
+
0, // Connect flags
|
|
270
|
+
0, 30, // Keepalive
|
|
271
|
+
0, 4, // Client ID length
|
|
272
|
+
116, 101, 115, 116 // Client ID
|
|
273
|
+
]))
|
|
274
|
+
|
|
275
|
+
testGenerateOnly('minimal connect with clientId as Buffer', {
|
|
276
|
+
cmd: 'connect',
|
|
277
|
+
retain: false,
|
|
278
|
+
qos: 0,
|
|
279
|
+
dup: false,
|
|
280
|
+
length: 18,
|
|
281
|
+
protocolId: 'MQIsdp',
|
|
282
|
+
protocolVersion: 3,
|
|
283
|
+
clean: false,
|
|
284
|
+
keepalive: 30,
|
|
285
|
+
clientId: Buffer.from('test')
|
|
286
|
+
}, Buffer.from([
|
|
287
|
+
16, 18, // Header
|
|
288
|
+
0, 6, // Protocol ID length
|
|
289
|
+
77, 81, 73, 115, 100, 112, // Protocol ID
|
|
290
|
+
3, // Protocol version
|
|
291
|
+
0, // Connect flags
|
|
292
|
+
0, 30, // Keepalive
|
|
293
|
+
0, 4, // Client ID length
|
|
294
|
+
116, 101, 115, 116 // Client ID
|
|
295
|
+
]))
|
|
296
|
+
|
|
297
|
+
testParseGenerate('connect MQTT bridge 131', {
|
|
298
|
+
cmd: 'connect',
|
|
299
|
+
retain: false,
|
|
300
|
+
qos: 0,
|
|
301
|
+
dup: false,
|
|
302
|
+
length: 18,
|
|
303
|
+
protocolId: 'MQIsdp',
|
|
304
|
+
protocolVersion: 3,
|
|
305
|
+
bridgeMode: true,
|
|
306
|
+
clean: false,
|
|
307
|
+
keepalive: 30,
|
|
308
|
+
clientId: 'test'
|
|
309
|
+
}, Buffer.from([
|
|
310
|
+
16, 18, // Header
|
|
311
|
+
0, 6, // Protocol ID length
|
|
312
|
+
77, 81, 73, 115, 100, 112, // Protocol ID
|
|
313
|
+
131, // Protocol version
|
|
314
|
+
0, // Connect flags
|
|
315
|
+
0, 30, // Keepalive
|
|
316
|
+
0, 4, // Client ID length
|
|
317
|
+
116, 101, 115, 116 // Client ID
|
|
318
|
+
]))
|
|
319
|
+
|
|
320
|
+
testParseGenerate('connect MQTT bridge 132', {
|
|
321
|
+
cmd: 'connect',
|
|
322
|
+
retain: false,
|
|
323
|
+
qos: 0,
|
|
324
|
+
dup: false,
|
|
325
|
+
length: 18,
|
|
326
|
+
protocolId: 'MQIsdp',
|
|
327
|
+
protocolVersion: 4,
|
|
328
|
+
bridgeMode: true,
|
|
329
|
+
clean: false,
|
|
330
|
+
keepalive: 30,
|
|
331
|
+
clientId: 'test'
|
|
332
|
+
}, Buffer.from([
|
|
333
|
+
16, 18, // Header
|
|
334
|
+
0, 6, // Protocol ID length
|
|
335
|
+
77, 81, 73, 115, 100, 112, // Protocol ID
|
|
336
|
+
132, // Protocol version
|
|
337
|
+
0, // Connect flags
|
|
338
|
+
0, 30, // Keepalive
|
|
339
|
+
0, 4, // Client ID length
|
|
340
|
+
116, 101, 115, 116 // Client ID
|
|
341
|
+
]))
|
|
342
|
+
|
|
343
|
+
testParseGenerate('connect MQTT 5', {
|
|
344
|
+
cmd: 'connect',
|
|
345
|
+
retain: false,
|
|
346
|
+
qos: 0,
|
|
347
|
+
dup: false,
|
|
348
|
+
length: 125,
|
|
349
|
+
protocolId: 'MQTT',
|
|
350
|
+
protocolVersion: 5,
|
|
351
|
+
will: {
|
|
352
|
+
retain: true,
|
|
353
|
+
qos: 2,
|
|
354
|
+
properties: {
|
|
355
|
+
willDelayInterval: 1234,
|
|
356
|
+
payloadFormatIndicator: false,
|
|
357
|
+
messageExpiryInterval: 4321,
|
|
358
|
+
contentType: 'test',
|
|
359
|
+
responseTopic: 'topic',
|
|
360
|
+
correlationData: Buffer.from([1, 2, 3, 4]),
|
|
361
|
+
userProperties: {
|
|
362
|
+
test: 'test'
|
|
363
|
+
}
|
|
364
|
+
},
|
|
365
|
+
topic: 'topic',
|
|
366
|
+
payload: Buffer.from([4, 3, 2, 1])
|
|
367
|
+
},
|
|
368
|
+
clean: true,
|
|
369
|
+
keepalive: 30,
|
|
370
|
+
properties: {
|
|
371
|
+
sessionExpiryInterval: 1234,
|
|
372
|
+
receiveMaximum: 432,
|
|
373
|
+
maximumPacketSize: 100,
|
|
374
|
+
topicAliasMaximum: 456,
|
|
375
|
+
requestResponseInformation: true,
|
|
376
|
+
requestProblemInformation: true,
|
|
377
|
+
userProperties: {
|
|
378
|
+
test: 'test'
|
|
379
|
+
},
|
|
380
|
+
authenticationMethod: 'test',
|
|
381
|
+
authenticationData: Buffer.from([1, 2, 3, 4])
|
|
382
|
+
},
|
|
383
|
+
clientId: 'test'
|
|
384
|
+
}, Buffer.from([
|
|
385
|
+
16, 125, // Header
|
|
386
|
+
0, 4, // Protocol ID length
|
|
387
|
+
77, 81, 84, 84, // Protocol ID
|
|
388
|
+
5, // Protocol version
|
|
389
|
+
54, // Connect flags
|
|
390
|
+
0, 30, // Keepalive
|
|
391
|
+
47, // properties length
|
|
392
|
+
17, 0, 0, 4, 210, // sessionExpiryInterval
|
|
393
|
+
33, 1, 176, // receiveMaximum
|
|
394
|
+
39, 0, 0, 0, 100, // maximumPacketSize
|
|
395
|
+
34, 1, 200, // topicAliasMaximum
|
|
396
|
+
25, 1, // requestResponseInformation
|
|
397
|
+
23, 1, // requestProblemInformation,
|
|
398
|
+
38, 0, 4, 116, 101, 115, 116, 0, 4, 116, 101, 115, 116, // userProperties,
|
|
399
|
+
21, 0, 4, 116, 101, 115, 116, // authenticationMethod
|
|
400
|
+
22, 0, 4, 1, 2, 3, 4, // authenticationData
|
|
401
|
+
0, 4, // Client ID length
|
|
402
|
+
116, 101, 115, 116, // Client ID
|
|
403
|
+
47, // will properties
|
|
404
|
+
24, 0, 0, 4, 210, // will delay interval
|
|
405
|
+
1, 0, // payload format indicator
|
|
406
|
+
2, 0, 0, 16, 225, // message expiry interval
|
|
407
|
+
3, 0, 4, 116, 101, 115, 116, // content type
|
|
408
|
+
8, 0, 5, 116, 111, 112, 105, 99, // response topic
|
|
409
|
+
9, 0, 4, 1, 2, 3, 4, // corelation data
|
|
410
|
+
38, 0, 4, 116, 101, 115, 116, 0, 4, 116, 101, 115, 116, // user properties
|
|
411
|
+
0, 5, // Will topic length
|
|
412
|
+
116, 111, 112, 105, 99, // Will topic
|
|
413
|
+
0, 4, // Will payload length
|
|
414
|
+
4, 3, 2, 1// Will payload
|
|
415
|
+
]))
|
|
416
|
+
|
|
417
|
+
testParseGenerate('connect MQTT 5 with will properties but with empty will payload', {
|
|
418
|
+
cmd: 'connect',
|
|
419
|
+
retain: false,
|
|
420
|
+
qos: 0,
|
|
421
|
+
dup: false,
|
|
422
|
+
length: 121,
|
|
423
|
+
protocolId: 'MQTT',
|
|
424
|
+
protocolVersion: 5,
|
|
425
|
+
will: {
|
|
426
|
+
retain: true,
|
|
427
|
+
qos: 2,
|
|
428
|
+
properties: {
|
|
429
|
+
willDelayInterval: 1234,
|
|
430
|
+
payloadFormatIndicator: false,
|
|
431
|
+
messageExpiryInterval: 4321,
|
|
432
|
+
contentType: 'test',
|
|
433
|
+
responseTopic: 'topic',
|
|
434
|
+
correlationData: Buffer.from([1, 2, 3, 4]),
|
|
435
|
+
userProperties: {
|
|
436
|
+
test: 'test'
|
|
437
|
+
}
|
|
438
|
+
},
|
|
439
|
+
topic: 'topic',
|
|
440
|
+
payload: Buffer.from([])
|
|
441
|
+
},
|
|
442
|
+
clean: true,
|
|
443
|
+
keepalive: 30,
|
|
444
|
+
properties: {
|
|
445
|
+
sessionExpiryInterval: 1234,
|
|
446
|
+
receiveMaximum: 432,
|
|
447
|
+
maximumPacketSize: 100,
|
|
448
|
+
topicAliasMaximum: 456,
|
|
449
|
+
requestResponseInformation: true,
|
|
450
|
+
requestProblemInformation: true,
|
|
451
|
+
userProperties: {
|
|
452
|
+
test: 'test'
|
|
453
|
+
},
|
|
454
|
+
authenticationMethod: 'test',
|
|
455
|
+
authenticationData: Buffer.from([1, 2, 3, 4])
|
|
456
|
+
},
|
|
457
|
+
clientId: 'test'
|
|
458
|
+
}, Buffer.from([
|
|
459
|
+
16, 121, // Header
|
|
460
|
+
0, 4, // Protocol ID length
|
|
461
|
+
77, 81, 84, 84, // Protocol ID
|
|
462
|
+
5, // Protocol version
|
|
463
|
+
54, // Connect flags
|
|
464
|
+
0, 30, // Keepalive
|
|
465
|
+
47, // properties length
|
|
466
|
+
17, 0, 0, 4, 210, // sessionExpiryInterval
|
|
467
|
+
33, 1, 176, // receiveMaximum
|
|
468
|
+
39, 0, 0, 0, 100, // maximumPacketSize
|
|
469
|
+
34, 1, 200, // topicAliasMaximum
|
|
470
|
+
25, 1, // requestResponseInformation
|
|
471
|
+
23, 1, // requestProblemInformation,
|
|
472
|
+
38, 0, 4, 116, 101, 115, 116, 0, 4, 116, 101, 115, 116, // userProperties,
|
|
473
|
+
21, 0, 4, 116, 101, 115, 116, // authenticationMethod
|
|
474
|
+
22, 0, 4, 1, 2, 3, 4, // authenticationData
|
|
475
|
+
0, 4, // Client ID length
|
|
476
|
+
116, 101, 115, 116, // Client ID
|
|
477
|
+
47, // will properties
|
|
478
|
+
24, 0, 0, 4, 210, // will delay interval
|
|
479
|
+
1, 0, // payload format indicator
|
|
480
|
+
2, 0, 0, 16, 225, // message expiry interval
|
|
481
|
+
3, 0, 4, 116, 101, 115, 116, // content type
|
|
482
|
+
8, 0, 5, 116, 111, 112, 105, 99, // response topic
|
|
483
|
+
9, 0, 4, 1, 2, 3, 4, // corelation data
|
|
484
|
+
38, 0, 4, 116, 101, 115, 116, 0, 4, 116, 101, 115, 116, // user properties
|
|
485
|
+
0, 5, // Will topic length
|
|
486
|
+
116, 111, 112, 105, 99, // Will topic
|
|
487
|
+
0, 0 // Will payload length
|
|
488
|
+
]))
|
|
489
|
+
|
|
490
|
+
testParseGenerate('connect MQTT 5 w/o will properties', {
|
|
491
|
+
cmd: 'connect',
|
|
492
|
+
retain: false,
|
|
493
|
+
qos: 0,
|
|
494
|
+
dup: false,
|
|
495
|
+
length: 78,
|
|
496
|
+
protocolId: 'MQTT',
|
|
497
|
+
protocolVersion: 5,
|
|
498
|
+
will: {
|
|
499
|
+
retain: true,
|
|
500
|
+
qos: 2,
|
|
501
|
+
topic: 'topic',
|
|
502
|
+
payload: Buffer.from([4, 3, 2, 1])
|
|
503
|
+
},
|
|
504
|
+
clean: true,
|
|
505
|
+
keepalive: 30,
|
|
506
|
+
properties: {
|
|
507
|
+
sessionExpiryInterval: 1234,
|
|
508
|
+
receiveMaximum: 432,
|
|
509
|
+
maximumPacketSize: 100,
|
|
510
|
+
topicAliasMaximum: 456,
|
|
511
|
+
requestResponseInformation: true,
|
|
512
|
+
requestProblemInformation: true,
|
|
513
|
+
userProperties: {
|
|
514
|
+
test: 'test'
|
|
515
|
+
},
|
|
516
|
+
authenticationMethod: 'test',
|
|
517
|
+
authenticationData: Buffer.from([1, 2, 3, 4])
|
|
518
|
+
},
|
|
519
|
+
clientId: 'test'
|
|
520
|
+
}, Buffer.from([
|
|
521
|
+
16, 78, // Header
|
|
522
|
+
0, 4, // Protocol ID length
|
|
523
|
+
77, 81, 84, 84, // Protocol ID
|
|
524
|
+
5, // Protocol version
|
|
525
|
+
54, // Connect flags
|
|
526
|
+
0, 30, // Keepalive
|
|
527
|
+
47, // properties length
|
|
528
|
+
17, 0, 0, 4, 210, // sessionExpiryInterval
|
|
529
|
+
33, 1, 176, // receiveMaximum
|
|
530
|
+
39, 0, 0, 0, 100, // maximumPacketSize
|
|
531
|
+
34, 1, 200, // topicAliasMaximum
|
|
532
|
+
25, 1, // requestResponseInformation
|
|
533
|
+
23, 1, // requestProblemInformation,
|
|
534
|
+
38, 0, 4, 116, 101, 115, 116, 0, 4, 116, 101, 115, 116, // userProperties,
|
|
535
|
+
21, 0, 4, 116, 101, 115, 116, // authenticationMethod
|
|
536
|
+
22, 0, 4, 1, 2, 3, 4, // authenticationData
|
|
537
|
+
0, 4, // Client ID length
|
|
538
|
+
116, 101, 115, 116, // Client ID
|
|
539
|
+
0, // will properties
|
|
540
|
+
0, 5, // Will topic length
|
|
541
|
+
116, 111, 112, 105, 99, // Will topic
|
|
542
|
+
0, 4, // Will payload length
|
|
543
|
+
4, 3, 2, 1// Will payload
|
|
544
|
+
]))
|
|
545
|
+
|
|
546
|
+
testParseGenerate('no clientId with 3.1.1', {
|
|
547
|
+
cmd: 'connect',
|
|
548
|
+
retain: false,
|
|
549
|
+
qos: 0,
|
|
550
|
+
dup: false,
|
|
551
|
+
length: 12,
|
|
552
|
+
protocolId: 'MQTT',
|
|
553
|
+
protocolVersion: 4,
|
|
554
|
+
clean: true,
|
|
555
|
+
keepalive: 30,
|
|
556
|
+
clientId: ''
|
|
557
|
+
}, Buffer.from([
|
|
558
|
+
16, 12, // Header
|
|
559
|
+
0, 4, // Protocol ID length
|
|
560
|
+
77, 81, 84, 84, // Protocol ID
|
|
561
|
+
4, // Protocol version
|
|
562
|
+
2, // Connect flags
|
|
563
|
+
0, 30, // Keepalive
|
|
564
|
+
0, 0 // Client ID length
|
|
565
|
+
]))
|
|
566
|
+
|
|
567
|
+
testParseGenerateDefaults('no clientId with 5.0', {
|
|
568
|
+
cmd: 'connect',
|
|
569
|
+
protocolId: 'MQTT',
|
|
570
|
+
protocolVersion: 5,
|
|
571
|
+
clean: true,
|
|
572
|
+
keepalive: 60,
|
|
573
|
+
properties:
|
|
574
|
+
{
|
|
575
|
+
receiveMaximum: 20
|
|
576
|
+
},
|
|
577
|
+
clientId: ''
|
|
578
|
+
}, Buffer.from(
|
|
579
|
+
[16, 16, 0, 4, 77, 81, 84, 84, 5, 2, 0, 60, 3, 33, 0, 20, 0, 0]
|
|
580
|
+
), {
|
|
581
|
+
cmd: 'connect',
|
|
582
|
+
retain: false,
|
|
583
|
+
qos: 0,
|
|
584
|
+
dup: false,
|
|
585
|
+
length: 16,
|
|
586
|
+
topic: null,
|
|
587
|
+
payload: null,
|
|
588
|
+
protocolId: 'MQTT',
|
|
589
|
+
protocolVersion: 5,
|
|
590
|
+
clean: true,
|
|
591
|
+
keepalive: 60,
|
|
592
|
+
properties: {
|
|
593
|
+
receiveMaximum: 20
|
|
594
|
+
},
|
|
595
|
+
clientId: ''
|
|
596
|
+
}, { protocolVersion: 5 })
|
|
597
|
+
|
|
598
|
+
testParseGenerateDefaults('utf-8 clientId with 5.0', {
|
|
599
|
+
cmd: 'connect',
|
|
600
|
+
retain: false,
|
|
601
|
+
qos: 0,
|
|
602
|
+
dup: false,
|
|
603
|
+
length: 23,
|
|
604
|
+
protocolId: 'MQTT',
|
|
605
|
+
protocolVersion: 4,
|
|
606
|
+
clean: true,
|
|
607
|
+
keepalive: 30,
|
|
608
|
+
clientId: 'Ŧėśt🜄'
|
|
609
|
+
}, Buffer.from([
|
|
610
|
+
16, 23, // Header
|
|
611
|
+
0, 4, // Protocol ID length
|
|
612
|
+
77, 81, 84, 84, // Protocol ID
|
|
613
|
+
4, // Protocol version
|
|
614
|
+
2, // Connect flags
|
|
615
|
+
0, 30, // Keepalive
|
|
616
|
+
0, 11, // Client ID length
|
|
617
|
+
197, 166, // Ŧ (UTF-8: 0xc5a6)
|
|
618
|
+
196, 151, // ė (UTF-8: 0xc497)
|
|
619
|
+
197, 155, // ś (utf-8: 0xc59b)
|
|
620
|
+
116, // t (utf-8: 0x74)
|
|
621
|
+
240, 159, 156, 132 // 🜄 (utf-8: 0xf09f9c84)
|
|
622
|
+
]), {
|
|
623
|
+
cmd: 'connect',
|
|
624
|
+
retain: false,
|
|
625
|
+
qos: 0,
|
|
626
|
+
dup: false,
|
|
627
|
+
length: 23,
|
|
628
|
+
topic: null,
|
|
629
|
+
payload: null,
|
|
630
|
+
protocolId: 'MQTT',
|
|
631
|
+
protocolVersion: 4,
|
|
632
|
+
clean: true,
|
|
633
|
+
keepalive: 30,
|
|
634
|
+
clientId: 'Ŧėśt🜄'
|
|
635
|
+
}, { protocol: 5 })
|
|
636
|
+
|
|
637
|
+
testParseGenerateDefaults('default connect', {
|
|
638
|
+
cmd: 'connect',
|
|
639
|
+
clientId: 'test'
|
|
640
|
+
}, Buffer.from([
|
|
641
|
+
16, 16, 0, 4, 77, 81, 84,
|
|
642
|
+
84, 4, 2, 0, 0,
|
|
643
|
+
0, 4, 116, 101, 115, 116
|
|
644
|
+
]), {
|
|
645
|
+
cmd: 'connect',
|
|
646
|
+
retain: false,
|
|
647
|
+
qos: 0,
|
|
648
|
+
dup: false,
|
|
649
|
+
length: 16,
|
|
650
|
+
topic: null,
|
|
651
|
+
payload: null,
|
|
652
|
+
protocolId: 'MQTT',
|
|
653
|
+
protocolVersion: 4,
|
|
654
|
+
clean: true,
|
|
655
|
+
keepalive: 0,
|
|
656
|
+
clientId: 'test'
|
|
657
|
+
})
|
|
658
|
+
|
|
659
|
+
testParseAndGenerate('Version 4 CONACK', {
|
|
660
|
+
cmd: 'connack',
|
|
661
|
+
retain: false,
|
|
662
|
+
qos: 0,
|
|
663
|
+
dup: false,
|
|
664
|
+
length: 2,
|
|
665
|
+
topic: null,
|
|
666
|
+
payload: null,
|
|
667
|
+
sessionPresent: false,
|
|
668
|
+
returnCode: 1
|
|
669
|
+
}, Buffer.from([
|
|
670
|
+
32, 2, // Fixed Header (CONNACK, Remaining Length)
|
|
671
|
+
0, 1 // Variable Header (Session not present, Connection Refused - unacceptable protocol version)
|
|
672
|
+
]), {}) // Default protocolVersion (4)
|
|
673
|
+
|
|
674
|
+
testParseAndGenerate('Version 5 CONACK', {
|
|
675
|
+
cmd: 'connack',
|
|
676
|
+
retain: false,
|
|
677
|
+
qos: 0,
|
|
678
|
+
dup: false,
|
|
679
|
+
length: 3,
|
|
680
|
+
topic: null,
|
|
681
|
+
payload: null,
|
|
682
|
+
sessionPresent: false,
|
|
683
|
+
reasonCode: 140
|
|
684
|
+
}, Buffer.from([
|
|
685
|
+
32, 3, // Fixed Header (CONNACK, Remaining Length)
|
|
686
|
+
0, 140, // Variable Header (Session not present, Bad authentication method)
|
|
687
|
+
0 // Property Length Zero
|
|
688
|
+
]), { protocolVersion: 5 })
|
|
689
|
+
|
|
690
|
+
testParseOnly('Version 4 CONACK in Version 5 mode', {
|
|
691
|
+
cmd: 'connack',
|
|
692
|
+
retain: false,
|
|
693
|
+
qos: 0,
|
|
694
|
+
dup: false,
|
|
695
|
+
length: 2,
|
|
696
|
+
topic: null,
|
|
697
|
+
payload: null,
|
|
698
|
+
sessionPresent: false,
|
|
699
|
+
reasonCode: 1 // a version 4 return code stored in the version 5 reasonCode because this client is in version 5
|
|
700
|
+
}, Buffer.from([
|
|
701
|
+
32, 2, // Fixed Header (CONNACK, Remaining Length)
|
|
702
|
+
0, 1 // Variable Header (Session not present, Connection Refused - unacceptable protocol version)
|
|
703
|
+
]), { protocolVersion: 5 }) // message is in version 4 format, but this client is in version 5 mode
|
|
704
|
+
|
|
705
|
+
testParseOnly('Version 5 PUBACK test 1', {
|
|
706
|
+
cmd: 'puback',
|
|
707
|
+
messageId: 42,
|
|
708
|
+
retain: false,
|
|
709
|
+
qos: 0,
|
|
710
|
+
dup: false,
|
|
711
|
+
length: 2,
|
|
712
|
+
topic: null,
|
|
713
|
+
payload: null,
|
|
714
|
+
reasonCode: 0
|
|
715
|
+
}, Buffer.from([
|
|
716
|
+
64, 2, // Fixed Header (PUBACK, Remaining Length)
|
|
717
|
+
0, 42 // Variable Header (2 Bytes: Packet Identifier 42, Implied Reason code: Success, Implied no properties)
|
|
718
|
+
]), { protocolVersion: 5 }
|
|
719
|
+
)
|
|
720
|
+
|
|
721
|
+
testParseAndGenerate('Version 5 PUBACK test 2', {
|
|
722
|
+
cmd: 'puback',
|
|
723
|
+
messageId: 42,
|
|
724
|
+
retain: false,
|
|
725
|
+
qos: 0,
|
|
726
|
+
dup: false,
|
|
727
|
+
length: 2,
|
|
728
|
+
topic: null,
|
|
729
|
+
payload: null,
|
|
730
|
+
reasonCode: 0
|
|
731
|
+
}, Buffer.from([
|
|
732
|
+
64, 2, // Fixed Header (PUBACK, Remaining Length)
|
|
733
|
+
0, 42 // Variable Header (2 Bytes: Packet Identifier 42, Implied reason code: 0 Success, Implied no properties)
|
|
734
|
+
]), { protocolVersion: 5 }
|
|
735
|
+
)
|
|
736
|
+
|
|
737
|
+
testParseOnly('Version 5 PUBACK test 2.1', {
|
|
738
|
+
cmd: 'puback',
|
|
739
|
+
messageId: 42,
|
|
740
|
+
retain: false,
|
|
741
|
+
qos: 0,
|
|
742
|
+
dup: false,
|
|
743
|
+
length: 3,
|
|
744
|
+
topic: null,
|
|
745
|
+
payload: null,
|
|
746
|
+
reasonCode: 0
|
|
747
|
+
}, Buffer.from([
|
|
748
|
+
64, 3, // Fixed Header (PUBACK, Remaining Length)
|
|
749
|
+
0, 42, 0 // Variable Header (2 Bytes: Packet Identifier 42, Reason code: 0 Success, Implied no properties)
|
|
750
|
+
]), { protocolVersion: 5 }
|
|
751
|
+
)
|
|
752
|
+
|
|
753
|
+
testParseOnly('Version 5 PUBACK test 3', {
|
|
754
|
+
cmd: 'puback',
|
|
755
|
+
messageId: 42,
|
|
756
|
+
retain: false,
|
|
757
|
+
qos: 0,
|
|
758
|
+
dup: false,
|
|
759
|
+
length: 4,
|
|
760
|
+
topic: null,
|
|
761
|
+
payload: null,
|
|
762
|
+
reasonCode: 0
|
|
763
|
+
}, Buffer.from([
|
|
764
|
+
64, 4, // Fixed Header (PUBACK, Remaining Length)
|
|
765
|
+
0, 42, 0, // Variable Header (2 Bytes: Packet Identifier 42, Reason code: 0 Success)
|
|
766
|
+
0 // no properties
|
|
767
|
+
]), { protocolVersion: 5 }
|
|
768
|
+
)
|
|
769
|
+
|
|
770
|
+
testParseOnly('Version 5 CONNACK test 1', {
|
|
771
|
+
cmd: 'connack',
|
|
772
|
+
retain: false,
|
|
773
|
+
qos: 0,
|
|
774
|
+
dup: false,
|
|
775
|
+
length: 1,
|
|
776
|
+
topic: null,
|
|
777
|
+
payload: null,
|
|
778
|
+
sessionPresent: true,
|
|
779
|
+
reasonCode: 0
|
|
780
|
+
}, Buffer.from([
|
|
781
|
+
32, 1, // Fixed Header (CONNACK, Remaining Length)
|
|
782
|
+
1 // Variable Header (Session Present: 1 => true, Implied Reason code: Success, Implied no properties)
|
|
783
|
+
]), { protocolVersion: 5 }
|
|
784
|
+
)
|
|
785
|
+
|
|
786
|
+
testParseOnly('Version 5 CONNACK test 2', {
|
|
787
|
+
cmd: 'connack',
|
|
788
|
+
retain: false,
|
|
789
|
+
qos: 0,
|
|
790
|
+
dup: false,
|
|
791
|
+
length: 2,
|
|
792
|
+
topic: null,
|
|
793
|
+
payload: null,
|
|
794
|
+
sessionPresent: true,
|
|
795
|
+
reasonCode: 0
|
|
796
|
+
}, Buffer.from([
|
|
797
|
+
32, 2, // Fixed Header (CONNACK, Remaining Length)
|
|
798
|
+
1, 0 // Variable Header (Session Present: 1 => true, Connect Reason code: Success, Implied no properties)
|
|
799
|
+
]), { protocolVersion: 5 }
|
|
800
|
+
)
|
|
801
|
+
|
|
802
|
+
testParseAndGenerate('Version 5 CONNACK test 3', {
|
|
803
|
+
cmd: 'connack',
|
|
804
|
+
retain: false,
|
|
805
|
+
qos: 0,
|
|
806
|
+
dup: false,
|
|
807
|
+
length: 3,
|
|
808
|
+
topic: null,
|
|
809
|
+
payload: null,
|
|
810
|
+
sessionPresent: true,
|
|
811
|
+
reasonCode: 0
|
|
812
|
+
}, Buffer.from([
|
|
813
|
+
32, 3, // Fixed Header (CONNACK, Remaining Length)
|
|
814
|
+
1, 0, // Variable Header (Session Present: 1 => true, Connect Reason code: Success)
|
|
815
|
+
0 // no properties
|
|
816
|
+
]), { protocolVersion: 5 }
|
|
817
|
+
)
|
|
818
|
+
|
|
819
|
+
testParseOnly('Version 5 DISCONNECT test 1', {
|
|
820
|
+
cmd: 'disconnect',
|
|
821
|
+
retain: false,
|
|
822
|
+
qos: 0,
|
|
823
|
+
dup: false,
|
|
824
|
+
length: 0,
|
|
825
|
+
topic: null,
|
|
826
|
+
payload: null,
|
|
827
|
+
reasonCode: 0
|
|
828
|
+
}, Buffer.from([
|
|
829
|
+
224, 0 // Fixed Header (DISCONNECT, Remaining Length), Implied Reason code: Normal Disconnection
|
|
830
|
+
]), { protocolVersion: 5 }
|
|
831
|
+
)
|
|
832
|
+
|
|
833
|
+
testParseOnly('Version 5 DISCONNECT test 2', {
|
|
834
|
+
cmd: 'disconnect',
|
|
835
|
+
retain: false,
|
|
836
|
+
qos: 0,
|
|
837
|
+
dup: false,
|
|
838
|
+
length: 1,
|
|
839
|
+
topic: null,
|
|
840
|
+
payload: null,
|
|
841
|
+
reasonCode: 0
|
|
842
|
+
}, Buffer.from([
|
|
843
|
+
224, 1, // Fixed Header (DISCONNECT, Remaining Length)
|
|
844
|
+
0 // reason Code (Normal disconnection)
|
|
845
|
+
]), { protocolVersion: 5 }
|
|
846
|
+
)
|
|
847
|
+
|
|
848
|
+
testParseAndGenerate('Version 5 DISCONNECT test 3', {
|
|
849
|
+
cmd: 'disconnect',
|
|
850
|
+
retain: false,
|
|
851
|
+
qos: 0,
|
|
852
|
+
dup: false,
|
|
853
|
+
length: 2,
|
|
854
|
+
topic: null,
|
|
855
|
+
payload: null,
|
|
856
|
+
reasonCode: 0
|
|
857
|
+
}, Buffer.from([
|
|
858
|
+
224, 2, // Fixed Header (DISCONNECT, Remaining Length)
|
|
859
|
+
0, // reason Code (Normal disconnection)
|
|
860
|
+
0 // no properties
|
|
861
|
+
]), { protocolVersion: 5 }
|
|
862
|
+
)
|
|
863
|
+
|
|
864
|
+
testParseGenerate('empty will payload', {
|
|
865
|
+
cmd: 'connect',
|
|
866
|
+
retain: false,
|
|
867
|
+
qos: 0,
|
|
868
|
+
dup: false,
|
|
869
|
+
length: 47,
|
|
870
|
+
protocolId: 'MQIsdp',
|
|
871
|
+
protocolVersion: 3,
|
|
872
|
+
will: {
|
|
873
|
+
retain: true,
|
|
874
|
+
qos: 2,
|
|
875
|
+
topic: 'topic',
|
|
876
|
+
payload: Buffer.alloc(0)
|
|
877
|
+
},
|
|
878
|
+
clean: true,
|
|
879
|
+
keepalive: 30,
|
|
880
|
+
clientId: 'test',
|
|
881
|
+
username: 'username',
|
|
882
|
+
password: Buffer.from('password')
|
|
883
|
+
}, Buffer.from([
|
|
884
|
+
16, 47, // Header
|
|
885
|
+
0, 6, // Protocol ID length
|
|
886
|
+
77, 81, 73, 115, 100, 112, // Protocol ID
|
|
887
|
+
3, // Protocol version
|
|
888
|
+
246, // Connect flags
|
|
889
|
+
0, 30, // Keepalive
|
|
890
|
+
0, 4, // Client ID length
|
|
891
|
+
116, 101, 115, 116, // Client ID
|
|
892
|
+
0, 5, // Will topic length
|
|
893
|
+
116, 111, 112, 105, 99, // Will topic
|
|
894
|
+
0, 0, // Will payload length
|
|
895
|
+
// Will payload
|
|
896
|
+
0, 8, // Username length
|
|
897
|
+
117, 115, 101, 114, 110, 97, 109, 101, // Username
|
|
898
|
+
0, 8, // Password length
|
|
899
|
+
112, 97, 115, 115, 119, 111, 114, 100 // Password
|
|
900
|
+
]))
|
|
901
|
+
|
|
902
|
+
testParseGenerate('empty buffer username payload', {
|
|
903
|
+
cmd: 'connect',
|
|
904
|
+
retain: false,
|
|
905
|
+
qos: 0,
|
|
906
|
+
dup: false,
|
|
907
|
+
length: 20,
|
|
908
|
+
protocolId: 'MQIsdp',
|
|
909
|
+
protocolVersion: 3,
|
|
910
|
+
clean: true,
|
|
911
|
+
keepalive: 30,
|
|
912
|
+
clientId: 'test',
|
|
913
|
+
username: Buffer.from('')
|
|
914
|
+
}, Buffer.from([
|
|
915
|
+
16, 20, // Header
|
|
916
|
+
0, 6, // Protocol ID length
|
|
917
|
+
77, 81, 73, 115, 100, 112, // Protocol ID
|
|
918
|
+
3, // Protocol version
|
|
919
|
+
130, // Connect flags
|
|
920
|
+
0, 30, // Keepalive
|
|
921
|
+
0, 4, // Client ID length
|
|
922
|
+
116, 101, 115, 116, // Client ID
|
|
923
|
+
0, 0 // Username length
|
|
924
|
+
// Empty Username payload
|
|
925
|
+
]))
|
|
926
|
+
|
|
927
|
+
testParseGenerate('empty string username payload', {
|
|
928
|
+
cmd: 'connect',
|
|
929
|
+
retain: false,
|
|
930
|
+
qos: 0,
|
|
931
|
+
dup: false,
|
|
932
|
+
length: 20,
|
|
933
|
+
protocolId: 'MQIsdp',
|
|
934
|
+
protocolVersion: 3,
|
|
935
|
+
clean: true,
|
|
936
|
+
keepalive: 30,
|
|
937
|
+
clientId: 'test',
|
|
938
|
+
username: ''
|
|
939
|
+
}, Buffer.from([
|
|
940
|
+
16, 20, // Header
|
|
941
|
+
0, 6, // Protocol ID length
|
|
942
|
+
77, 81, 73, 115, 100, 112, // Protocol ID
|
|
943
|
+
3, // Protocol version
|
|
944
|
+
130, // Connect flags
|
|
945
|
+
0, 30, // Keepalive
|
|
946
|
+
0, 4, // Client ID length
|
|
947
|
+
116, 101, 115, 116, // Client ID
|
|
948
|
+
0, 0 // Username length
|
|
949
|
+
// Empty Username payload
|
|
950
|
+
]))
|
|
951
|
+
|
|
952
|
+
testParseGenerate('empty buffer password payload', {
|
|
953
|
+
cmd: 'connect',
|
|
954
|
+
retain: false,
|
|
955
|
+
qos: 0,
|
|
956
|
+
dup: false,
|
|
957
|
+
length: 30,
|
|
958
|
+
protocolId: 'MQIsdp',
|
|
959
|
+
protocolVersion: 3,
|
|
960
|
+
clean: true,
|
|
961
|
+
keepalive: 30,
|
|
962
|
+
clientId: 'test',
|
|
963
|
+
username: 'username',
|
|
964
|
+
password: Buffer.from('')
|
|
965
|
+
}, Buffer.from([
|
|
966
|
+
16, 30, // Header
|
|
967
|
+
0, 6, // Protocol ID length
|
|
968
|
+
77, 81, 73, 115, 100, 112, // Protocol ID
|
|
969
|
+
3, // Protocol version
|
|
970
|
+
194, // Connect flags
|
|
971
|
+
0, 30, // Keepalive
|
|
972
|
+
0, 4, // Client ID length
|
|
973
|
+
116, 101, 115, 116, // Client ID
|
|
974
|
+
0, 8, // Username length
|
|
975
|
+
117, 115, 101, 114, 110, 97, 109, 101, // Username payload
|
|
976
|
+
0, 0 // Password length
|
|
977
|
+
// Empty password payload
|
|
978
|
+
]))
|
|
979
|
+
|
|
980
|
+
testParseGenerate('empty string password payload', {
|
|
981
|
+
cmd: 'connect',
|
|
982
|
+
retain: false,
|
|
983
|
+
qos: 0,
|
|
984
|
+
dup: false,
|
|
985
|
+
length: 30,
|
|
986
|
+
protocolId: 'MQIsdp',
|
|
987
|
+
protocolVersion: 3,
|
|
988
|
+
clean: true,
|
|
989
|
+
keepalive: 30,
|
|
990
|
+
clientId: 'test',
|
|
991
|
+
username: 'username',
|
|
992
|
+
password: ''
|
|
993
|
+
}, Buffer.from([
|
|
994
|
+
16, 30, // Header
|
|
995
|
+
0, 6, // Protocol ID length
|
|
996
|
+
77, 81, 73, 115, 100, 112, // Protocol ID
|
|
997
|
+
3, // Protocol version
|
|
998
|
+
194, // Connect flags
|
|
999
|
+
0, 30, // Keepalive
|
|
1000
|
+
0, 4, // Client ID length
|
|
1001
|
+
116, 101, 115, 116, // Client ID
|
|
1002
|
+
0, 8, // Username length
|
|
1003
|
+
117, 115, 101, 114, 110, 97, 109, 101, // Username payload
|
|
1004
|
+
0, 0 // Password length
|
|
1005
|
+
// Empty password payload
|
|
1006
|
+
]))
|
|
1007
|
+
|
|
1008
|
+
testParseGenerate('empty string username and password payload', {
|
|
1009
|
+
cmd: 'connect',
|
|
1010
|
+
retain: false,
|
|
1011
|
+
qos: 0,
|
|
1012
|
+
dup: false,
|
|
1013
|
+
length: 22,
|
|
1014
|
+
protocolId: 'MQIsdp',
|
|
1015
|
+
protocolVersion: 3,
|
|
1016
|
+
clean: true,
|
|
1017
|
+
keepalive: 30,
|
|
1018
|
+
clientId: 'test',
|
|
1019
|
+
username: '',
|
|
1020
|
+
password: Buffer.from('')
|
|
1021
|
+
}, Buffer.from([
|
|
1022
|
+
16, 22, // Header
|
|
1023
|
+
0, 6, // Protocol ID length
|
|
1024
|
+
77, 81, 73, 115, 100, 112, // Protocol ID
|
|
1025
|
+
3, // Protocol version
|
|
1026
|
+
194, // Connect flags
|
|
1027
|
+
0, 30, // Keepalive
|
|
1028
|
+
0, 4, // Client ID length
|
|
1029
|
+
116, 101, 115, 116, // Client ID
|
|
1030
|
+
0, 0, // Username length
|
|
1031
|
+
// Empty Username payload
|
|
1032
|
+
0, 0 // Password length
|
|
1033
|
+
// Empty password payload
|
|
1034
|
+
]))
|
|
1035
|
+
|
|
1036
|
+
testParseGenerate('maximal connect', {
|
|
1037
|
+
cmd: 'connect',
|
|
1038
|
+
retain: false,
|
|
1039
|
+
qos: 0,
|
|
1040
|
+
dup: false,
|
|
1041
|
+
length: 54,
|
|
1042
|
+
protocolId: 'MQIsdp',
|
|
1043
|
+
protocolVersion: 3,
|
|
1044
|
+
will: {
|
|
1045
|
+
retain: true,
|
|
1046
|
+
qos: 2,
|
|
1047
|
+
topic: 'topic',
|
|
1048
|
+
payload: Buffer.from('payload')
|
|
1049
|
+
},
|
|
1050
|
+
clean: true,
|
|
1051
|
+
keepalive: 30,
|
|
1052
|
+
clientId: 'test',
|
|
1053
|
+
username: 'username',
|
|
1054
|
+
password: Buffer.from('password')
|
|
1055
|
+
}, Buffer.from([
|
|
1056
|
+
16, 54, // Header
|
|
1057
|
+
0, 6, // Protocol ID length
|
|
1058
|
+
77, 81, 73, 115, 100, 112, // Protocol ID
|
|
1059
|
+
3, // Protocol version
|
|
1060
|
+
246, // Connect flags
|
|
1061
|
+
0, 30, // Keepalive
|
|
1062
|
+
0, 4, // Client ID length
|
|
1063
|
+
116, 101, 115, 116, // Client ID
|
|
1064
|
+
0, 5, // Will topic length
|
|
1065
|
+
116, 111, 112, 105, 99, // Will topic
|
|
1066
|
+
0, 7, // Will payload length
|
|
1067
|
+
112, 97, 121, 108, 111, 97, 100, // Will payload
|
|
1068
|
+
0, 8, // Username length
|
|
1069
|
+
117, 115, 101, 114, 110, 97, 109, 101, // Username
|
|
1070
|
+
0, 8, // Password length
|
|
1071
|
+
112, 97, 115, 115, 119, 111, 114, 100 // Password
|
|
1072
|
+
]))
|
|
1073
|
+
|
|
1074
|
+
testParseGenerate('max connect with special chars', {
|
|
1075
|
+
cmd: 'connect',
|
|
1076
|
+
retain: false,
|
|
1077
|
+
qos: 0,
|
|
1078
|
+
dup: false,
|
|
1079
|
+
length: 57,
|
|
1080
|
+
protocolId: 'MQIsdp',
|
|
1081
|
+
protocolVersion: 3,
|
|
1082
|
+
will: {
|
|
1083
|
+
retain: true,
|
|
1084
|
+
qos: 2,
|
|
1085
|
+
topic: 'tòpic',
|
|
1086
|
+
payload: Buffer.from('pay£oad')
|
|
1087
|
+
},
|
|
1088
|
+
clean: true,
|
|
1089
|
+
keepalive: 30,
|
|
1090
|
+
clientId: 'te$t',
|
|
1091
|
+
username: 'u$ern4me',
|
|
1092
|
+
password: Buffer.from('p4$$w0£d')
|
|
1093
|
+
}, Buffer.from([
|
|
1094
|
+
16, 57, // Header
|
|
1095
|
+
0, 6, // Protocol ID length
|
|
1096
|
+
77, 81, 73, 115, 100, 112, // Protocol ID
|
|
1097
|
+
3, // Protocol version
|
|
1098
|
+
246, // Connect flags
|
|
1099
|
+
0, 30, // Keepalive
|
|
1100
|
+
0, 4, // Client ID length
|
|
1101
|
+
116, 101, 36, 116, // Client ID
|
|
1102
|
+
0, 6, // Will topic length
|
|
1103
|
+
116, 195, 178, 112, 105, 99, // Will topic
|
|
1104
|
+
0, 8, // Will payload length
|
|
1105
|
+
112, 97, 121, 194, 163, 111, 97, 100, // Will payload
|
|
1106
|
+
0, 8, // Username length
|
|
1107
|
+
117, 36, 101, 114, 110, 52, 109, 101, // Username
|
|
1108
|
+
0, 9, // Password length
|
|
1109
|
+
112, 52, 36, 36, 119, 48, 194, 163, 100 // Password
|
|
1110
|
+
]))
|
|
1111
|
+
|
|
1112
|
+
testGenerateOnly('connect all strings generate', {
|
|
1113
|
+
cmd: 'connect',
|
|
1114
|
+
retain: false,
|
|
1115
|
+
qos: 0,
|
|
1116
|
+
dup: false,
|
|
1117
|
+
length: 54,
|
|
1118
|
+
protocolId: 'MQIsdp',
|
|
1119
|
+
protocolVersion: 3,
|
|
1120
|
+
will: {
|
|
1121
|
+
retain: true,
|
|
1122
|
+
qos: 2,
|
|
1123
|
+
topic: 'topic',
|
|
1124
|
+
payload: 'payload'
|
|
1125
|
+
},
|
|
1126
|
+
clean: true,
|
|
1127
|
+
keepalive: 30,
|
|
1128
|
+
clientId: 'test',
|
|
1129
|
+
username: 'username',
|
|
1130
|
+
password: 'password'
|
|
1131
|
+
}, Buffer.from([
|
|
1132
|
+
16, 54, // Header
|
|
1133
|
+
0, 6, // Protocol ID length
|
|
1134
|
+
77, 81, 73, 115, 100, 112, // Protocol ID
|
|
1135
|
+
3, // Protocol version
|
|
1136
|
+
246, // Connect flags
|
|
1137
|
+
0, 30, // Keepalive
|
|
1138
|
+
0, 4, // Client ID length
|
|
1139
|
+
116, 101, 115, 116, // Client ID
|
|
1140
|
+
0, 5, // Will topic length
|
|
1141
|
+
116, 111, 112, 105, 99, // Will topic
|
|
1142
|
+
0, 7, // Will payload length
|
|
1143
|
+
112, 97, 121, 108, 111, 97, 100, // Will payload
|
|
1144
|
+
0, 8, // Username length
|
|
1145
|
+
117, 115, 101, 114, 110, 97, 109, 101, // Username
|
|
1146
|
+
0, 8, // Password length
|
|
1147
|
+
112, 97, 115, 115, 119, 111, 114, 100 // Password
|
|
1148
|
+
]))
|
|
1149
|
+
|
|
1150
|
+
testParseError('Cannot parse protocolId', Buffer.from([
|
|
1151
|
+
16, 4,
|
|
1152
|
+
0, 6,
|
|
1153
|
+
77, 81
|
|
1154
|
+
]))
|
|
1155
|
+
|
|
1156
|
+
// missing protocol version on connect
|
|
1157
|
+
testParseError('Packet too short', Buffer.from([
|
|
1158
|
+
16, 8, // Header
|
|
1159
|
+
0, 6, // Protocol ID length
|
|
1160
|
+
77, 81, 73, 115, 100, 112 // Protocol ID
|
|
1161
|
+
]))
|
|
1162
|
+
|
|
1163
|
+
// missing keepalive on connect
|
|
1164
|
+
testParseError('Packet too short', Buffer.from([
|
|
1165
|
+
16, 10, // Header
|
|
1166
|
+
0, 6, // Protocol ID length
|
|
1167
|
+
77, 81, 73, 115, 100, 112, // Protocol ID
|
|
1168
|
+
3, // Protocol version
|
|
1169
|
+
246 // Connect flags
|
|
1170
|
+
]))
|
|
1171
|
+
|
|
1172
|
+
// missing clientid on connect
|
|
1173
|
+
testParseError('Packet too short', Buffer.from([
|
|
1174
|
+
16, 10, // Header
|
|
1175
|
+
0, 6, // Protocol ID length
|
|
1176
|
+
77, 81, 73, 115, 100, 112, // Protocol ID
|
|
1177
|
+
3, // Protocol version
|
|
1178
|
+
246, // Connect flags
|
|
1179
|
+
0, 30 // Keepalive
|
|
1180
|
+
]))
|
|
1181
|
+
|
|
1182
|
+
// missing will topic on connect
|
|
1183
|
+
testParseError('Cannot parse will topic', Buffer.from([
|
|
1184
|
+
16, 16, // Header
|
|
1185
|
+
0, 6, // Protocol ID length
|
|
1186
|
+
77, 81, 73, 115, 100, 112, // Protocol ID
|
|
1187
|
+
3, // Protocol version
|
|
1188
|
+
246, // Connect flags
|
|
1189
|
+
0, 30, // Keepalive
|
|
1190
|
+
0, 2, // Will topic length
|
|
1191
|
+
0, 0 // Will topic
|
|
1192
|
+
]))
|
|
1193
|
+
|
|
1194
|
+
// missing will payload on connect
|
|
1195
|
+
testParseError('Cannot parse will payload', Buffer.from([
|
|
1196
|
+
16, 23, // Header
|
|
1197
|
+
0, 6, // Protocol ID length
|
|
1198
|
+
77, 81, 73, 115, 100, 112, // Protocol ID
|
|
1199
|
+
3, // Protocol version
|
|
1200
|
+
246, // Connect flags
|
|
1201
|
+
0, 30, // Keepalive
|
|
1202
|
+
0, 5, // Will topic length
|
|
1203
|
+
116, 111, 112, 105, 99, // Will topic
|
|
1204
|
+
0, 2, // Will payload length
|
|
1205
|
+
0, 0 // Will payload
|
|
1206
|
+
]))
|
|
1207
|
+
|
|
1208
|
+
// missing username on connect
|
|
1209
|
+
testParseError('Cannot parse username', Buffer.from([
|
|
1210
|
+
16, 32, // Header
|
|
1211
|
+
0, 6, // Protocol ID length
|
|
1212
|
+
77, 81, 73, 115, 100, 112, // Protocol ID
|
|
1213
|
+
3, // Protocol version
|
|
1214
|
+
246, // Connect flags
|
|
1215
|
+
0, 30, // Keepalive
|
|
1216
|
+
0, 5, // Will topic length
|
|
1217
|
+
116, 111, 112, 105, 99, // Will topic
|
|
1218
|
+
0, 7, // Will payload length
|
|
1219
|
+
112, 97, 121, 108, 111, 97, 100, // Will payload
|
|
1220
|
+
0, 2, // Username length
|
|
1221
|
+
0, 0 // Username
|
|
1222
|
+
]))
|
|
1223
|
+
|
|
1224
|
+
// missing password on connect
|
|
1225
|
+
testParseError('Cannot parse password', Buffer.from([
|
|
1226
|
+
16, 42, // Header
|
|
1227
|
+
0, 6, // Protocol ID length
|
|
1228
|
+
77, 81, 73, 115, 100, 112, // Protocol ID
|
|
1229
|
+
3, // Protocol version
|
|
1230
|
+
246, // Connect flags
|
|
1231
|
+
0, 30, // Keepalive
|
|
1232
|
+
0, 5, // Will topic length
|
|
1233
|
+
116, 111, 112, 105, 99, // Will topic
|
|
1234
|
+
0, 7, // Will payload length
|
|
1235
|
+
112, 97, 121, 108, 111, 97, 100, // Will payload
|
|
1236
|
+
0, 8, // Username length
|
|
1237
|
+
117, 115, 101, 114, 110, 97, 109, 101, // Username
|
|
1238
|
+
0, 2, // Password length
|
|
1239
|
+
0, 0 // Password
|
|
1240
|
+
]))
|
|
1241
|
+
|
|
1242
|
+
// Where a flag bit is marked as “Reserved” in Table 2.2 - Flag Bits, it is reserved for future use and MUST be set to the value listed in that table [MQTT-2.2.2-1]. If invalid flags are received, the receiver MUST close the Network Connection [MQTT-2.2.2-2]
|
|
1243
|
+
testParseError('Invalid header flag bits, must be 0x0 for connect packet', Buffer.from([
|
|
1244
|
+
18, 10, // Header
|
|
1245
|
+
0, 4, // Protocol ID length
|
|
1246
|
+
0x4d, 0x51, 0x54, 0x54, // Protocol ID
|
|
1247
|
+
3, // Protocol version
|
|
1248
|
+
2, // Connect flags
|
|
1249
|
+
0, 30 // Keepalive
|
|
1250
|
+
]))
|
|
1251
|
+
|
|
1252
|
+
// The Server MUST validate that the reserved flag in the CONNECT Control Packet is set to zero and disconnect the Client if it is not zero [MQTT-3.1.2-3]
|
|
1253
|
+
testParseError('Connect flag bit 0 must be 0, but got 1', Buffer.from([
|
|
1254
|
+
16, 10, // Header
|
|
1255
|
+
0, 4, // Protocol ID length
|
|
1256
|
+
0x4d, 0x51, 0x54, 0x54, // Protocol ID
|
|
1257
|
+
3, // Protocol version
|
|
1258
|
+
3, // Connect flags
|
|
1259
|
+
0, 30 // Keepalive
|
|
1260
|
+
]))
|
|
1261
|
+
|
|
1262
|
+
// If the Will Flag is set to 0 the Will QoS and Will Retain fields in the Connect Flags MUST be set to zero and the Will Topic and Will Message fields MUST NOT be present in the payload [MQTT-3.1.2-11].
|
|
1263
|
+
testParseError('Will Retain Flag must be set to zero when Will Flag is set to 0', Buffer.from([
|
|
1264
|
+
16, 10, // Header
|
|
1265
|
+
0, 4, // Protocol ID length
|
|
1266
|
+
0x4d, 0x51, 0x54, 0x54, // Protocol ID
|
|
1267
|
+
3, // Protocol version
|
|
1268
|
+
0x22, // Connect flags
|
|
1269
|
+
0, 30 // Keepalive
|
|
1270
|
+
]))
|
|
1271
|
+
|
|
1272
|
+
// If the Will Flag is set to 0 the Will QoS and Will Retain fields in the Connect Flags MUST be set to zero and the Will Topic and Will Message fields MUST NOT be present in the payload [MQTT-3.1.2-11].
|
|
1273
|
+
testParseError('Will QoS must be set to zero when Will Flag is set to 0', Buffer.from([
|
|
1274
|
+
16, 10, // Header
|
|
1275
|
+
0, 4, // Protocol ID length
|
|
1276
|
+
0x4d, 0x51, 0x54, 0x54, // Protocol ID
|
|
1277
|
+
3, // Protocol version
|
|
1278
|
+
0x12, // Connect flags
|
|
1279
|
+
0, 30 // Keepalive
|
|
1280
|
+
]))
|
|
1281
|
+
|
|
1282
|
+
// If the Will Flag is set to 0 the Will QoS and Will Retain fields in the Connect Flags MUST be set to zero and the Will Topic and Will Message fields MUST NOT be present in the payload [MQTT-3.1.2-11].
|
|
1283
|
+
testParseError('Will QoS must be set to zero when Will Flag is set to 0', Buffer.from([
|
|
1284
|
+
16, 10, // Header
|
|
1285
|
+
0, 4, // Protocol ID length
|
|
1286
|
+
0x4d, 0x51, 0x54, 0x54, // Protocol ID
|
|
1287
|
+
3, // Protocol version
|
|
1288
|
+
0xa, // Connect flags
|
|
1289
|
+
0, 30 // Keepalive
|
|
1290
|
+
]))
|
|
1291
|
+
|
|
1292
|
+
// CONNECT, SUBSCRIBE, SUBACK, UNSUBSCRIBE, UNSUBACK (v.5) packets must have payload
|
|
1293
|
+
// CONNECT
|
|
1294
|
+
testParseError('Packet too short', Buffer.from([
|
|
1295
|
+
16, // Header
|
|
1296
|
+
8, // Packet length
|
|
1297
|
+
0, 4, // Protocol ID length
|
|
1298
|
+
77, 81, 84, 84, // MQTT
|
|
1299
|
+
5, // Version
|
|
1300
|
+
2, // Clean Start enabled
|
|
1301
|
+
0, 0, // Keep-Alive
|
|
1302
|
+
0, // Property Length
|
|
1303
|
+
0, 0 // Properties
|
|
1304
|
+
// No payload
|
|
1305
|
+
]), { protocolVersion: 5 })
|
|
1306
|
+
// SUBSCRIBE
|
|
1307
|
+
testParseError('Malformed subscribe, no payload specified', Buffer.from([
|
|
1308
|
+
130, // Header
|
|
1309
|
+
0 // Packet length
|
|
1310
|
+
]), { protocolVersion: 5 })
|
|
1311
|
+
// SUBACK
|
|
1312
|
+
testParseError('Malformed suback, no payload specified', Buffer.from([
|
|
1313
|
+
144, // Header
|
|
1314
|
+
0 // Packet length
|
|
1315
|
+
]), { protocolVersion: 5 })
|
|
1316
|
+
// UNSUBSCRIBE
|
|
1317
|
+
testParseError('Malformed unsubscribe, no payload specified', Buffer.from([
|
|
1318
|
+
162, // Header
|
|
1319
|
+
0 // Packet length
|
|
1320
|
+
]), { protocolVersion: 5 })
|
|
1321
|
+
// UNSUBACK (v.5)
|
|
1322
|
+
testParseError('Malformed unsuback, no payload specified', Buffer.from([
|
|
1323
|
+
176, // Header
|
|
1324
|
+
0 // Packet length
|
|
1325
|
+
]), { protocolVersion: 5 })
|
|
1326
|
+
// UNSUBACK (v.4)
|
|
1327
|
+
testParseError('Malformed unsuback, payload length must be 2', Buffer.from([
|
|
1328
|
+
176, // Header
|
|
1329
|
+
1, // Packet length
|
|
1330
|
+
1
|
|
1331
|
+
]), { protocolVersion: 4 })
|
|
1332
|
+
// UNSUBACK (v.3)
|
|
1333
|
+
testParseError('Malformed unsuback, payload length must be 2', Buffer.from([
|
|
1334
|
+
176, // Header
|
|
1335
|
+
1, // Packet length
|
|
1336
|
+
1
|
|
1337
|
+
]), { protocolVersion: 3 })
|
|
1338
|
+
|
|
1339
|
+
testParseGenerate('connack with return code 0', {
|
|
1340
|
+
cmd: 'connack',
|
|
1341
|
+
retain: false,
|
|
1342
|
+
qos: 0,
|
|
1343
|
+
dup: false,
|
|
1344
|
+
length: 2,
|
|
1345
|
+
sessionPresent: false,
|
|
1346
|
+
returnCode: 0
|
|
1347
|
+
}, Buffer.from([
|
|
1348
|
+
32, 2, 0, 0
|
|
1349
|
+
]))
|
|
1350
|
+
|
|
1351
|
+
testParseGenerate('connack MQTT 5 with properties', {
|
|
1352
|
+
cmd: 'connack',
|
|
1353
|
+
retain: false,
|
|
1354
|
+
qos: 0,
|
|
1355
|
+
dup: false,
|
|
1356
|
+
length: 87,
|
|
1357
|
+
sessionPresent: false,
|
|
1358
|
+
reasonCode: 0,
|
|
1359
|
+
properties: {
|
|
1360
|
+
sessionExpiryInterval: 1234,
|
|
1361
|
+
receiveMaximum: 432,
|
|
1362
|
+
maximumQoS: 2,
|
|
1363
|
+
retainAvailable: true,
|
|
1364
|
+
maximumPacketSize: 100,
|
|
1365
|
+
assignedClientIdentifier: 'test',
|
|
1366
|
+
topicAliasMaximum: 456,
|
|
1367
|
+
reasonString: 'test',
|
|
1368
|
+
userProperties: {
|
|
1369
|
+
test: 'test'
|
|
1370
|
+
},
|
|
1371
|
+
wildcardSubscriptionAvailable: true,
|
|
1372
|
+
subscriptionIdentifiersAvailable: true,
|
|
1373
|
+
sharedSubscriptionAvailable: false,
|
|
1374
|
+
serverKeepAlive: 1234,
|
|
1375
|
+
responseInformation: 'test',
|
|
1376
|
+
serverReference: 'test',
|
|
1377
|
+
authenticationMethod: 'test',
|
|
1378
|
+
authenticationData: Buffer.from([1, 2, 3, 4])
|
|
1379
|
+
}
|
|
1380
|
+
}, Buffer.from([
|
|
1381
|
+
32, 87, 0, 0,
|
|
1382
|
+
84, // properties length
|
|
1383
|
+
17, 0, 0, 4, 210, // sessionExpiryInterval
|
|
1384
|
+
33, 1, 176, // receiveMaximum
|
|
1385
|
+
36, 2, // Maximum qos
|
|
1386
|
+
37, 1, // retainAvailable
|
|
1387
|
+
39, 0, 0, 0, 100, // maximumPacketSize
|
|
1388
|
+
18, 0, 4, 116, 101, 115, 116, // assignedClientIdentifier
|
|
1389
|
+
34, 1, 200, // topicAliasMaximum
|
|
1390
|
+
31, 0, 4, 116, 101, 115, 116, // reasonString
|
|
1391
|
+
38, 0, 4, 116, 101, 115, 116, 0, 4, 116, 101, 115, 116, // userProperties
|
|
1392
|
+
40, 1, // wildcardSubscriptionAvailable
|
|
1393
|
+
41, 1, // subscriptionIdentifiersAvailable
|
|
1394
|
+
42, 0, // sharedSubscriptionAvailable
|
|
1395
|
+
19, 4, 210, // serverKeepAlive
|
|
1396
|
+
26, 0, 4, 116, 101, 115, 116, // responseInformation
|
|
1397
|
+
28, 0, 4, 116, 101, 115, 116, // serverReference
|
|
1398
|
+
21, 0, 4, 116, 101, 115, 116, // authenticationMethod
|
|
1399
|
+
22, 0, 4, 1, 2, 3, 4 // authenticationData
|
|
1400
|
+
]), { protocolVersion: 5 })
|
|
1401
|
+
|
|
1402
|
+
testParseGenerate('connack MQTT 5 with properties and doubled user properties', {
|
|
1403
|
+
cmd: 'connack',
|
|
1404
|
+
retain: false,
|
|
1405
|
+
qos: 0,
|
|
1406
|
+
dup: false,
|
|
1407
|
+
length: 100,
|
|
1408
|
+
sessionPresent: false,
|
|
1409
|
+
reasonCode: 0,
|
|
1410
|
+
properties: {
|
|
1411
|
+
sessionExpiryInterval: 1234,
|
|
1412
|
+
receiveMaximum: 432,
|
|
1413
|
+
maximumQoS: 2,
|
|
1414
|
+
retainAvailable: true,
|
|
1415
|
+
maximumPacketSize: 100,
|
|
1416
|
+
assignedClientIdentifier: 'test',
|
|
1417
|
+
topicAliasMaximum: 456,
|
|
1418
|
+
reasonString: 'test',
|
|
1419
|
+
userProperties: {
|
|
1420
|
+
test: ['test', 'test']
|
|
1421
|
+
},
|
|
1422
|
+
wildcardSubscriptionAvailable: true,
|
|
1423
|
+
subscriptionIdentifiersAvailable: true,
|
|
1424
|
+
sharedSubscriptionAvailable: false,
|
|
1425
|
+
serverKeepAlive: 1234,
|
|
1426
|
+
responseInformation: 'test',
|
|
1427
|
+
serverReference: 'test',
|
|
1428
|
+
authenticationMethod: 'test',
|
|
1429
|
+
authenticationData: Buffer.from([1, 2, 3, 4])
|
|
1430
|
+
}
|
|
1431
|
+
}, Buffer.from([
|
|
1432
|
+
32, 100, 0, 0,
|
|
1433
|
+
97, // properties length
|
|
1434
|
+
17, 0, 0, 4, 210, // sessionExpiryInterval
|
|
1435
|
+
33, 1, 176, // receiveMaximum
|
|
1436
|
+
36, 2, // Maximum qos
|
|
1437
|
+
37, 1, // retainAvailable
|
|
1438
|
+
39, 0, 0, 0, 100, // maximumPacketSize
|
|
1439
|
+
18, 0, 4, 116, 101, 115, 116, // assignedClientIdentifier
|
|
1440
|
+
34, 1, 200, // topicAliasMaximum
|
|
1441
|
+
31, 0, 4, 116, 101, 115, 116, // reasonString
|
|
1442
|
+
38, 0, 4, 116, 101, 115, 116, 0, 4, 116, 101, 115, 116,
|
|
1443
|
+
38, 0, 4, 116, 101, 115, 116, 0, 4, 116, 101, 115, 116, // userProperties
|
|
1444
|
+
40, 1, // wildcardSubscriptionAvailable
|
|
1445
|
+
41, 1, // subscriptionIdentifiersAvailable
|
|
1446
|
+
42, 0, // sharedSubscriptionAvailable
|
|
1447
|
+
19, 4, 210, // serverKeepAlive
|
|
1448
|
+
26, 0, 4, 116, 101, 115, 116, // responseInformation
|
|
1449
|
+
28, 0, 4, 116, 101, 115, 116, // serverReference
|
|
1450
|
+
21, 0, 4, 116, 101, 115, 116, // authenticationMethod
|
|
1451
|
+
22, 0, 4, 1, 2, 3, 4 // authenticationData
|
|
1452
|
+
]), { protocolVersion: 5 })
|
|
1453
|
+
|
|
1454
|
+
testParseGenerate('connack with return code 0 session present bit set', {
|
|
1455
|
+
cmd: 'connack',
|
|
1456
|
+
retain: false,
|
|
1457
|
+
qos: 0,
|
|
1458
|
+
dup: false,
|
|
1459
|
+
length: 2,
|
|
1460
|
+
sessionPresent: true,
|
|
1461
|
+
returnCode: 0
|
|
1462
|
+
}, Buffer.from([
|
|
1463
|
+
32, 2, 1, 0
|
|
1464
|
+
]))
|
|
1465
|
+
|
|
1466
|
+
testParseGenerate('connack with return code 5', {
|
|
1467
|
+
cmd: 'connack',
|
|
1468
|
+
retain: false,
|
|
1469
|
+
qos: 0,
|
|
1470
|
+
dup: false,
|
|
1471
|
+
length: 2,
|
|
1472
|
+
sessionPresent: false,
|
|
1473
|
+
returnCode: 5
|
|
1474
|
+
}, Buffer.from([
|
|
1475
|
+
32, 2, 0, 5
|
|
1476
|
+
]))
|
|
1477
|
+
|
|
1478
|
+
// Where a flag bit is marked as “Reserved” in Table 2.2 - Flag Bits, it is reserved for future use and MUST be set to the value listed in that table [MQTT-2.2.2-1]. If invalid flags are received, the receiver MUST close the Network Connection [MQTT-2.2.2-2]
|
|
1479
|
+
testParseError('Invalid header flag bits, must be 0x0 for connack packet', Buffer.from([
|
|
1480
|
+
33, 2, // header
|
|
1481
|
+
0, // flags
|
|
1482
|
+
5 // return code
|
|
1483
|
+
]))
|
|
1484
|
+
|
|
1485
|
+
// Byte 1 is the "Connect Acknowledge Flags". Bits 7-1 are reserved and MUST be set to 0 [MQTT-3.2.2-1].
|
|
1486
|
+
testParseError('Invalid connack flags, bits 7-1 must be set to 0', Buffer.from([
|
|
1487
|
+
32, 2, // header
|
|
1488
|
+
2, // flags
|
|
1489
|
+
5 // return code
|
|
1490
|
+
]))
|
|
1491
|
+
|
|
1492
|
+
testGenerateError('Invalid return code', {
|
|
1493
|
+
cmd: 'connack',
|
|
1494
|
+
retain: false,
|
|
1495
|
+
qos: 0,
|
|
1496
|
+
dup: false,
|
|
1497
|
+
length: 2,
|
|
1498
|
+
sessionPresent: false,
|
|
1499
|
+
returnCode: '5' // returncode must be a number
|
|
1500
|
+
})
|
|
1501
|
+
|
|
1502
|
+
testParseGenerate('minimal publish', {
|
|
1503
|
+
cmd: 'publish',
|
|
1504
|
+
retain: false,
|
|
1505
|
+
qos: 0,
|
|
1506
|
+
dup: false,
|
|
1507
|
+
length: 10,
|
|
1508
|
+
topic: 'test',
|
|
1509
|
+
payload: Buffer.from('test')
|
|
1510
|
+
}, Buffer.from([
|
|
1511
|
+
48, 10, // Header
|
|
1512
|
+
0, 4, // Topic length
|
|
1513
|
+
116, 101, 115, 116, // Topic (test)
|
|
1514
|
+
116, 101, 115, 116 // Payload (test)
|
|
1515
|
+
]))
|
|
1516
|
+
|
|
1517
|
+
testParseGenerate('publish MQTT 5 properties', {
|
|
1518
|
+
cmd: 'publish',
|
|
1519
|
+
retain: true,
|
|
1520
|
+
qos: 2,
|
|
1521
|
+
dup: true,
|
|
1522
|
+
length: 86,
|
|
1523
|
+
topic: 'test',
|
|
1524
|
+
payload: Buffer.from('test'),
|
|
1525
|
+
messageId: 10,
|
|
1526
|
+
properties: {
|
|
1527
|
+
payloadFormatIndicator: true,
|
|
1528
|
+
messageExpiryInterval: 4321,
|
|
1529
|
+
topicAlias: 100,
|
|
1530
|
+
responseTopic: 'topic',
|
|
1531
|
+
correlationData: Buffer.from([1, 2, 3, 4]),
|
|
1532
|
+
userProperties: {
|
|
1533
|
+
test: ['test', 'test', 'test']
|
|
1534
|
+
},
|
|
1535
|
+
subscriptionIdentifier: 120,
|
|
1536
|
+
contentType: 'test'
|
|
1537
|
+
}
|
|
1538
|
+
}, Buffer.from([
|
|
1539
|
+
61, 86, // Header
|
|
1540
|
+
0, 4, // Topic length
|
|
1541
|
+
116, 101, 115, 116, // Topic (test)
|
|
1542
|
+
0, 10, // Message ID
|
|
1543
|
+
73, // properties length
|
|
1544
|
+
1, 1, // payloadFormatIndicator
|
|
1545
|
+
2, 0, 0, 16, 225, // message expiry interval
|
|
1546
|
+
35, 0, 100, // topicAlias
|
|
1547
|
+
8, 0, 5, 116, 111, 112, 105, 99, // response topic
|
|
1548
|
+
9, 0, 4, 1, 2, 3, 4, // correlationData
|
|
1549
|
+
38, 0, 4, 116, 101, 115, 116, 0, 4, 116, 101, 115, 116, // userProperties
|
|
1550
|
+
38, 0, 4, 116, 101, 115, 116, 0, 4, 116, 101, 115, 116, // userProperties
|
|
1551
|
+
38, 0, 4, 116, 101, 115, 116, 0, 4, 116, 101, 115, 116, // userProperties
|
|
1552
|
+
11, 120, // subscriptionIdentifier
|
|
1553
|
+
3, 0, 4, 116, 101, 115, 116, // content type
|
|
1554
|
+
116, 101, 115, 116 // Payload (test)
|
|
1555
|
+
]), { protocolVersion: 5 })
|
|
1556
|
+
|
|
1557
|
+
testParseGenerate('publish MQTT 5 with multiple same properties', {
|
|
1558
|
+
cmd: 'publish',
|
|
1559
|
+
retain: true,
|
|
1560
|
+
qos: 2,
|
|
1561
|
+
dup: true,
|
|
1562
|
+
length: 64,
|
|
1563
|
+
topic: 'test',
|
|
1564
|
+
payload: Buffer.from('test'),
|
|
1565
|
+
messageId: 10,
|
|
1566
|
+
properties: {
|
|
1567
|
+
payloadFormatIndicator: true,
|
|
1568
|
+
messageExpiryInterval: 4321,
|
|
1569
|
+
topicAlias: 100,
|
|
1570
|
+
responseTopic: 'topic',
|
|
1571
|
+
correlationData: Buffer.from([1, 2, 3, 4]),
|
|
1572
|
+
userProperties: {
|
|
1573
|
+
test: 'test'
|
|
1574
|
+
},
|
|
1575
|
+
subscriptionIdentifier: [120, 121, 122],
|
|
1576
|
+
contentType: 'test'
|
|
1577
|
+
}
|
|
1578
|
+
}, Buffer.from([
|
|
1579
|
+
61, 64, // Header
|
|
1580
|
+
0, 4, // Topic length
|
|
1581
|
+
116, 101, 115, 116, // Topic (test)
|
|
1582
|
+
0, 10, // Message ID
|
|
1583
|
+
51, // properties length
|
|
1584
|
+
1, 1, // payloadFormatIndicator
|
|
1585
|
+
2, 0, 0, 16, 225, // message expiry interval
|
|
1586
|
+
35, 0, 100, // topicAlias
|
|
1587
|
+
8, 0, 5, 116, 111, 112, 105, 99, // response topic
|
|
1588
|
+
9, 0, 4, 1, 2, 3, 4, // correlationData
|
|
1589
|
+
38, 0, 4, 116, 101, 115, 116, 0, 4, 116, 101, 115, 116, // userProperties
|
|
1590
|
+
11, 120, // subscriptionIdentifier
|
|
1591
|
+
11, 121, // subscriptionIdentifier
|
|
1592
|
+
11, 122, // subscriptionIdentifier
|
|
1593
|
+
3, 0, 4, 116, 101, 115, 116, // content type
|
|
1594
|
+
116, 101, 115, 116 // Payload (test)
|
|
1595
|
+
]), { protocolVersion: 5 })
|
|
1596
|
+
|
|
1597
|
+
testParseGenerate('publish MQTT 5 properties with 0-4 byte varbyte', {
|
|
1598
|
+
cmd: 'publish',
|
|
1599
|
+
retain: true,
|
|
1600
|
+
qos: 2,
|
|
1601
|
+
dup: true,
|
|
1602
|
+
length: 27,
|
|
1603
|
+
topic: 'test',
|
|
1604
|
+
payload: Buffer.from('test'),
|
|
1605
|
+
messageId: 10,
|
|
1606
|
+
properties: {
|
|
1607
|
+
payloadFormatIndicator: false,
|
|
1608
|
+
subscriptionIdentifier: [128, 16384, 2097152] // this tests the varbyte handling
|
|
1609
|
+
}
|
|
1610
|
+
}, Buffer.from([
|
|
1611
|
+
61, 27, // Header
|
|
1612
|
+
0, 4, // Topic length
|
|
1613
|
+
116, 101, 115, 116, // Topic (test)
|
|
1614
|
+
0, 10, // Message ID
|
|
1615
|
+
14, // properties length
|
|
1616
|
+
1, 0, // payloadFormatIndicator
|
|
1617
|
+
11, 128, 1, // subscriptionIdentifier
|
|
1618
|
+
11, 128, 128, 1, // subscriptionIdentifier
|
|
1619
|
+
11, 128, 128, 128, 1, // subscriptionIdentifier
|
|
1620
|
+
116, 101, 115, 116 // Payload (test)
|
|
1621
|
+
]), { protocolVersion: 5 })
|
|
1622
|
+
|
|
1623
|
+
testParseGenerate('publish MQTT 5 properties with max value varbyte', {
|
|
1624
|
+
cmd: 'publish',
|
|
1625
|
+
retain: true,
|
|
1626
|
+
qos: 2,
|
|
1627
|
+
dup: true,
|
|
1628
|
+
length: 22,
|
|
1629
|
+
topic: 'test',
|
|
1630
|
+
payload: Buffer.from('test'),
|
|
1631
|
+
messageId: 10,
|
|
1632
|
+
properties: {
|
|
1633
|
+
payloadFormatIndicator: false,
|
|
1634
|
+
subscriptionIdentifier: [1, 268435455]
|
|
1635
|
+
}
|
|
1636
|
+
}, Buffer.from([
|
|
1637
|
+
61, 22, // Header
|
|
1638
|
+
0, 4, // Topic length
|
|
1639
|
+
116, 101, 115, 116, // Topic (test)
|
|
1640
|
+
0, 10, // Message ID
|
|
1641
|
+
9, // properties length
|
|
1642
|
+
1, 0, // payloadFormatIndicator
|
|
1643
|
+
11, 1, // subscriptionIdentifier
|
|
1644
|
+
11, 255, 255, 255, 127, // subscriptionIdentifier (max value)
|
|
1645
|
+
116, 101, 115, 116 // Payload (test)
|
|
1646
|
+
]), { protocolVersion: 5 })
|
|
1647
|
+
|
|
1648
|
+
; (() => {
|
|
1649
|
+
const buffer = Buffer.alloc(2048)
|
|
1650
|
+
testParseGenerate('2KB publish packet', {
|
|
1651
|
+
cmd: 'publish',
|
|
1652
|
+
retain: false,
|
|
1653
|
+
qos: 0,
|
|
1654
|
+
dup: false,
|
|
1655
|
+
length: 2054,
|
|
1656
|
+
topic: 'test',
|
|
1657
|
+
payload: buffer
|
|
1658
|
+
}, Buffer.concat([Buffer.from([
|
|
1659
|
+
48, 134, 16, // Header
|
|
1660
|
+
0, 4, // Topic length
|
|
1661
|
+
116, 101, 115, 116 // Topic (test)
|
|
1662
|
+
]), buffer]))
|
|
1663
|
+
})()
|
|
1664
|
+
|
|
1665
|
+
; (() => {
|
|
1666
|
+
const maxLength = 268435455
|
|
1667
|
+
const buffer = Buffer.alloc(maxLength - 6)
|
|
1668
|
+
testParseGenerate('Max payload publish packet', {
|
|
1669
|
+
cmd: 'publish',
|
|
1670
|
+
retain: false,
|
|
1671
|
+
qos: 0,
|
|
1672
|
+
dup: false,
|
|
1673
|
+
length: maxLength,
|
|
1674
|
+
topic: 'test',
|
|
1675
|
+
payload: buffer
|
|
1676
|
+
}, Buffer.concat([Buffer.from([
|
|
1677
|
+
48, 255, 255, 255, 127, // Header
|
|
1678
|
+
0, 4, // Topic length
|
|
1679
|
+
116, 101, 115, 116 // Topic (test)
|
|
1680
|
+
]), buffer]))
|
|
1681
|
+
})()
|
|
1682
|
+
|
|
1683
|
+
testParseGenerate('maximal publish', {
|
|
1684
|
+
cmd: 'publish',
|
|
1685
|
+
retain: true,
|
|
1686
|
+
qos: 2,
|
|
1687
|
+
length: 12,
|
|
1688
|
+
dup: true,
|
|
1689
|
+
topic: 'test',
|
|
1690
|
+
messageId: 10,
|
|
1691
|
+
payload: Buffer.from('test')
|
|
1692
|
+
}, Buffer.from([
|
|
1693
|
+
61, 12, // Header
|
|
1694
|
+
0, 4, // Topic length
|
|
1695
|
+
116, 101, 115, 116, // Topic
|
|
1696
|
+
0, 10, // Message ID
|
|
1697
|
+
116, 101, 115, 116 // Payload
|
|
1698
|
+
]))
|
|
1699
|
+
|
|
1700
|
+
test('publish all strings generate', t => {
|
|
1701
|
+
const message = {
|
|
1702
|
+
cmd: 'publish',
|
|
1703
|
+
retain: true,
|
|
1704
|
+
qos: 2,
|
|
1705
|
+
length: 12,
|
|
1706
|
+
dup: true,
|
|
1707
|
+
topic: 'test',
|
|
1708
|
+
messageId: 10,
|
|
1709
|
+
payload: Buffer.from('test')
|
|
1710
|
+
}
|
|
1711
|
+
const expected = Buffer.from([
|
|
1712
|
+
61, 12, // Header
|
|
1713
|
+
0, 4, // Topic length
|
|
1714
|
+
116, 101, 115, 116, // Topic
|
|
1715
|
+
0, 10, // Message ID
|
|
1716
|
+
116, 101, 115, 116 // Payload
|
|
1717
|
+
])
|
|
1718
|
+
|
|
1719
|
+
t.equal(mqtt.generate(message).toString('hex'), expected.toString('hex'))
|
|
1720
|
+
t.end()
|
|
1721
|
+
})
|
|
1722
|
+
|
|
1723
|
+
testParseGenerate('empty publish', {
|
|
1724
|
+
cmd: 'publish',
|
|
1725
|
+
retain: false,
|
|
1726
|
+
qos: 0,
|
|
1727
|
+
dup: false,
|
|
1728
|
+
length: 6,
|
|
1729
|
+
topic: 'test',
|
|
1730
|
+
payload: Buffer.alloc(0)
|
|
1731
|
+
}, Buffer.from([
|
|
1732
|
+
48, 6, // Header
|
|
1733
|
+
0, 4, // Topic length
|
|
1734
|
+
116, 101, 115, 116 // Topic
|
|
1735
|
+
// Empty payload
|
|
1736
|
+
]))
|
|
1737
|
+
|
|
1738
|
+
// A PUBLISH Packet MUST NOT have both QoS bits set to 1. If a Server or Client receives a PUBLISH Packet which has both QoS bits set to 1 it MUST close the Network Connection [MQTT-3.3.1-4].
|
|
1739
|
+
testParseError('Packet must not have both QoS bits set to 1', Buffer.from([
|
|
1740
|
+
0x36, 6, // Header
|
|
1741
|
+
0, 4, // Topic length
|
|
1742
|
+
116, 101, 115, 116 // Topic
|
|
1743
|
+
// Empty payload
|
|
1744
|
+
]))
|
|
1745
|
+
|
|
1746
|
+
test('splitted publish parse', t => {
|
|
1747
|
+
t.plan(3)
|
|
1748
|
+
|
|
1749
|
+
const parser = mqtt.parser()
|
|
1750
|
+
const expected = {
|
|
1751
|
+
cmd: 'publish',
|
|
1752
|
+
retain: false,
|
|
1753
|
+
qos: 0,
|
|
1754
|
+
dup: false,
|
|
1755
|
+
length: 10,
|
|
1756
|
+
topic: 'test',
|
|
1757
|
+
payload: Buffer.from('test')
|
|
1758
|
+
}
|
|
1759
|
+
|
|
1760
|
+
parser.on('packet', packet => {
|
|
1761
|
+
t.deepLooseEqual(packet, expected, 'expected packet')
|
|
1762
|
+
})
|
|
1763
|
+
|
|
1764
|
+
t.equal(parser.parse(Buffer.from([
|
|
1765
|
+
48, 10, // Header
|
|
1766
|
+
0, 4, // Topic length
|
|
1767
|
+
116, 101, 115, 116 // Topic (test)
|
|
1768
|
+
])), 6, 'remaining bytes')
|
|
1769
|
+
|
|
1770
|
+
t.equal(parser.parse(Buffer.from([
|
|
1771
|
+
116, 101, 115, 116 // Payload (test)
|
|
1772
|
+
])), 0, 'remaining bytes')
|
|
1773
|
+
})
|
|
1774
|
+
|
|
1775
|
+
test('split publish longer', t => {
|
|
1776
|
+
t.plan(3)
|
|
1777
|
+
|
|
1778
|
+
const length = 255
|
|
1779
|
+
const topic = 'test'
|
|
1780
|
+
// Minus two bytes for the topic length specifier
|
|
1781
|
+
const payloadLength = length - topic.length - 2
|
|
1782
|
+
|
|
1783
|
+
const parser = mqtt.parser()
|
|
1784
|
+
const expected = {
|
|
1785
|
+
cmd: 'publish',
|
|
1786
|
+
retain: false,
|
|
1787
|
+
qos: 0,
|
|
1788
|
+
dup: false,
|
|
1789
|
+
length,
|
|
1790
|
+
topic,
|
|
1791
|
+
payload: Buffer.from('a'.repeat(payloadLength))
|
|
1792
|
+
}
|
|
1793
|
+
|
|
1794
|
+
parser.on('packet', packet => {
|
|
1795
|
+
t.deepLooseEqual(packet, expected, 'expected packet')
|
|
1796
|
+
})
|
|
1797
|
+
|
|
1798
|
+
t.equal(parser.parse(Buffer.from([
|
|
1799
|
+
48, 255, 1, // Header
|
|
1800
|
+
0, topic.length, // Topic length
|
|
1801
|
+
116, 101, 115, 116 // Topic (test)
|
|
1802
|
+
])), 6, 'remaining bytes')
|
|
1803
|
+
|
|
1804
|
+
t.equal(parser.parse(Buffer.from(Array(payloadLength).fill(97))),
|
|
1805
|
+
0, 'remaining bytes')
|
|
1806
|
+
})
|
|
1807
|
+
|
|
1808
|
+
test('split length parse', t => {
|
|
1809
|
+
t.plan(4)
|
|
1810
|
+
|
|
1811
|
+
const length = 255
|
|
1812
|
+
const topic = 'test'
|
|
1813
|
+
const payloadLength = length - topic.length - 2
|
|
1814
|
+
|
|
1815
|
+
const parser = mqtt.parser()
|
|
1816
|
+
const expected = {
|
|
1817
|
+
cmd: 'publish',
|
|
1818
|
+
retain: false,
|
|
1819
|
+
qos: 0,
|
|
1820
|
+
dup: false,
|
|
1821
|
+
length,
|
|
1822
|
+
topic,
|
|
1823
|
+
payload: Buffer.from('a'.repeat(payloadLength))
|
|
1824
|
+
}
|
|
1825
|
+
|
|
1826
|
+
parser.on('packet', packet => {
|
|
1827
|
+
t.deepLooseEqual(packet, expected, 'expected packet')
|
|
1828
|
+
})
|
|
1829
|
+
|
|
1830
|
+
t.equal(parser.parse(Buffer.from([
|
|
1831
|
+
48, 255 // Header (partial length)
|
|
1832
|
+
])), 1, 'remaining bytes')
|
|
1833
|
+
|
|
1834
|
+
t.equal(parser.parse(Buffer.from([
|
|
1835
|
+
1, // Rest of header length
|
|
1836
|
+
0, topic.length, // Topic length
|
|
1837
|
+
116, 101, 115, 116 // Topic (test)
|
|
1838
|
+
])), 6, 'remaining bytes')
|
|
1839
|
+
|
|
1840
|
+
t.equal(parser.parse(Buffer.from(Array(payloadLength).fill(97))),
|
|
1841
|
+
0, 'remaining bytes')
|
|
1842
|
+
})
|
|
1843
|
+
|
|
1844
|
+
testGenerateError('Invalid variable byte integer: 268435456', {
|
|
1845
|
+
cmd: 'publish',
|
|
1846
|
+
retain: false,
|
|
1847
|
+
qos: 0,
|
|
1848
|
+
dup: false,
|
|
1849
|
+
length: (268435455 + 1),
|
|
1850
|
+
topic: 'test',
|
|
1851
|
+
payload: Buffer.alloc(268435455 + 1 - 6)
|
|
1852
|
+
}, {}, 'Length var byte integer over max allowed value throws error')
|
|
1853
|
+
|
|
1854
|
+
testGenerateError('Invalid subscriptionIdentifier: 268435456', {
|
|
1855
|
+
cmd: 'publish',
|
|
1856
|
+
retain: true,
|
|
1857
|
+
qos: 2,
|
|
1858
|
+
dup: true,
|
|
1859
|
+
length: 27,
|
|
1860
|
+
topic: 'test',
|
|
1861
|
+
payload: Buffer.from('test'),
|
|
1862
|
+
messageId: 10,
|
|
1863
|
+
properties: {
|
|
1864
|
+
payloadFormatIndicator: false,
|
|
1865
|
+
subscriptionIdentifier: 268435456
|
|
1866
|
+
}
|
|
1867
|
+
}, { protocolVersion: 5 }, 'MQTT 5.0 var byte integer >24 bits throws error')
|
|
1868
|
+
|
|
1869
|
+
testParseGenerate('puback', {
|
|
1870
|
+
cmd: 'puback',
|
|
1871
|
+
retain: false,
|
|
1872
|
+
qos: 0,
|
|
1873
|
+
dup: false,
|
|
1874
|
+
length: 2,
|
|
1875
|
+
messageId: 2
|
|
1876
|
+
}, Buffer.from([
|
|
1877
|
+
64, 2, // Header
|
|
1878
|
+
0, 2 // Message ID
|
|
1879
|
+
]))
|
|
1880
|
+
|
|
1881
|
+
// Where a flag bit is marked as “Reserved” in Table 2.2 - Flag Bits, it is reserved for future use and MUST be set to the value listed in that table [MQTT-2.2.2-1]. If invalid flags are received, the receiver MUST close the Network Connection [MQTT-2.2.2-2]
|
|
1882
|
+
testParseError('Invalid header flag bits, must be 0x0 for puback packet', Buffer.from([
|
|
1883
|
+
65, 2, // Header
|
|
1884
|
+
0, 2 // Message ID
|
|
1885
|
+
]))
|
|
1886
|
+
|
|
1887
|
+
testParseGenerate('puback without reason and no MQTT 5 properties', {
|
|
1888
|
+
cmd: 'puback',
|
|
1889
|
+
retain: false,
|
|
1890
|
+
qos: 0,
|
|
1891
|
+
dup: false,
|
|
1892
|
+
length: 2,
|
|
1893
|
+
messageId: 2,
|
|
1894
|
+
reasonCode: 0
|
|
1895
|
+
}, Buffer.from([
|
|
1896
|
+
64, 2, // Header
|
|
1897
|
+
0, 2 // Message ID
|
|
1898
|
+
]), { protocolVersion: 5 })
|
|
1899
|
+
|
|
1900
|
+
testParseGenerate('puback with reason and no MQTT 5 properties', {
|
|
1901
|
+
cmd: 'puback',
|
|
1902
|
+
retain: false,
|
|
1903
|
+
qos: 0,
|
|
1904
|
+
dup: false,
|
|
1905
|
+
length: 4,
|
|
1906
|
+
messageId: 2,
|
|
1907
|
+
reasonCode: 16
|
|
1908
|
+
}, Buffer.from([
|
|
1909
|
+
64, 4, // Header
|
|
1910
|
+
0, 2, // Message ID
|
|
1911
|
+
16, // reason code
|
|
1912
|
+
0 // no user properties
|
|
1913
|
+
]), { protocolVersion: 5 })
|
|
1914
|
+
|
|
1915
|
+
testParseGenerate('puback MQTT 5 properties', {
|
|
1916
|
+
cmd: 'puback',
|
|
1917
|
+
retain: false,
|
|
1918
|
+
qos: 0,
|
|
1919
|
+
dup: false,
|
|
1920
|
+
length: 24,
|
|
1921
|
+
messageId: 2,
|
|
1922
|
+
reasonCode: 16,
|
|
1923
|
+
properties: {
|
|
1924
|
+
reasonString: 'test',
|
|
1925
|
+
userProperties: {
|
|
1926
|
+
test: 'test'
|
|
1927
|
+
}
|
|
1928
|
+
}
|
|
1929
|
+
}, Buffer.from([
|
|
1930
|
+
64, 24, // Header
|
|
1931
|
+
0, 2, // Message ID
|
|
1932
|
+
16, // reason code
|
|
1933
|
+
20, // properties length
|
|
1934
|
+
31, 0, 4, 116, 101, 115, 116, // reasonString
|
|
1935
|
+
38, 0, 4, 116, 101, 115, 116, 0, 4, 116, 101, 115, 116 // userProperties
|
|
1936
|
+
]), { protocolVersion: 5 })
|
|
1937
|
+
|
|
1938
|
+
testParseError('Invalid puback reason code', Buffer.from([
|
|
1939
|
+
64, 4, // Header
|
|
1940
|
+
0, 2, // Message ID
|
|
1941
|
+
0x11, // reason code
|
|
1942
|
+
0 // properties length
|
|
1943
|
+
]), { protocolVersion: 5 })
|
|
1944
|
+
|
|
1945
|
+
testParseGenerate('pubrec', {
|
|
1946
|
+
cmd: 'pubrec',
|
|
1947
|
+
retain: false,
|
|
1948
|
+
qos: 0,
|
|
1949
|
+
dup: false,
|
|
1950
|
+
length: 2,
|
|
1951
|
+
messageId: 2
|
|
1952
|
+
}, Buffer.from([
|
|
1953
|
+
80, 2, // Header
|
|
1954
|
+
0, 2 // Message ID
|
|
1955
|
+
]))
|
|
1956
|
+
|
|
1957
|
+
// Where a flag bit is marked as “Reserved” in Table 2.2 - Flag Bits, it is reserved for future use and MUST be set to the value listed in that table [MQTT-2.2.2-1]. If invalid flags are received, the receiver MUST close the Network Connection [MQTT-2.2.2-2]
|
|
1958
|
+
testParseError('Invalid header flag bits, must be 0x0 for pubrec packet', Buffer.from([
|
|
1959
|
+
81, 2, // Header
|
|
1960
|
+
0, 2 // Message ID
|
|
1961
|
+
]))
|
|
1962
|
+
|
|
1963
|
+
testParseGenerate('pubrec MQTT 5 properties', {
|
|
1964
|
+
cmd: 'pubrec',
|
|
1965
|
+
retain: false,
|
|
1966
|
+
qos: 0,
|
|
1967
|
+
dup: false,
|
|
1968
|
+
length: 24,
|
|
1969
|
+
messageId: 2,
|
|
1970
|
+
reasonCode: 16,
|
|
1971
|
+
properties: {
|
|
1972
|
+
reasonString: 'test',
|
|
1973
|
+
userProperties: {
|
|
1974
|
+
test: 'test'
|
|
1975
|
+
}
|
|
1976
|
+
}
|
|
1977
|
+
}, Buffer.from([
|
|
1978
|
+
80, 24, // Header
|
|
1979
|
+
0, 2, // Message ID
|
|
1980
|
+
16, // reason code
|
|
1981
|
+
20, // properties length
|
|
1982
|
+
31, 0, 4, 116, 101, 115, 116, // reasonString
|
|
1983
|
+
38, 0, 4, 116, 101, 115, 116, 0, 4, 116, 101, 115, 116 // userProperties
|
|
1984
|
+
]), { protocolVersion: 5 })
|
|
1985
|
+
|
|
1986
|
+
testParseGenerate('pubrel', {
|
|
1987
|
+
cmd: 'pubrel',
|
|
1988
|
+
retain: false,
|
|
1989
|
+
qos: 1,
|
|
1990
|
+
dup: false,
|
|
1991
|
+
length: 2,
|
|
1992
|
+
messageId: 2
|
|
1993
|
+
}, Buffer.from([
|
|
1994
|
+
98, 2, // Header
|
|
1995
|
+
0, 2 // Message ID
|
|
1996
|
+
]))
|
|
1997
|
+
|
|
1998
|
+
testParseError('Invalid pubrel reason code', Buffer.from([
|
|
1999
|
+
98, 4, // Header
|
|
2000
|
+
0, 2, // Message ID
|
|
2001
|
+
0x11, // Reason code
|
|
2002
|
+
0 // Properties length
|
|
2003
|
+
]), { protocolVersion: 5 })
|
|
2004
|
+
|
|
2005
|
+
// Where a flag bit is marked as “Reserved” in Table 2.2 - Flag Bits, it is reserved for future use and MUST be set to the value listed in that table [MQTT-2.2.2-1]. If invalid flags are received, the receiver MUST close the Network Connection [MQTT-2.2.2-2]
|
|
2006
|
+
testParseError('Invalid header flag bits, must be 0x2 for pubrel packet', Buffer.from([
|
|
2007
|
+
96, 2, // Header
|
|
2008
|
+
0, 2 // Message ID
|
|
2009
|
+
]))
|
|
2010
|
+
|
|
2011
|
+
testParseGenerate('pubrel MQTT5 properties', {
|
|
2012
|
+
cmd: 'pubrel',
|
|
2013
|
+
retain: false,
|
|
2014
|
+
qos: 1,
|
|
2015
|
+
dup: false,
|
|
2016
|
+
length: 24,
|
|
2017
|
+
messageId: 2,
|
|
2018
|
+
reasonCode: 0x92,
|
|
2019
|
+
properties: {
|
|
2020
|
+
reasonString: 'test',
|
|
2021
|
+
userProperties: {
|
|
2022
|
+
test: 'test'
|
|
2023
|
+
}
|
|
2024
|
+
}
|
|
2025
|
+
}, Buffer.from([
|
|
2026
|
+
98, 24, // Header
|
|
2027
|
+
0, 2, // Message ID
|
|
2028
|
+
0x92, // reason code
|
|
2029
|
+
20, // properties length
|
|
2030
|
+
31, 0, 4, 116, 101, 115, 116, // reasonString
|
|
2031
|
+
38, 0, 4, 116, 101, 115, 116, 0, 4, 116, 101, 115, 116 // userProperties
|
|
2032
|
+
]), { protocolVersion: 5 })
|
|
2033
|
+
|
|
2034
|
+
testParseError('Invalid pubrel reason code', Buffer.from([
|
|
2035
|
+
98, 4, // Header
|
|
2036
|
+
0, 2, // Message ID
|
|
2037
|
+
16, // reason code
|
|
2038
|
+
0 // properties length
|
|
2039
|
+
]), { protocolVersion: 5 })
|
|
2040
|
+
|
|
2041
|
+
testParseGenerate('pubcomp', {
|
|
2042
|
+
cmd: 'pubcomp',
|
|
2043
|
+
retain: false,
|
|
2044
|
+
qos: 0,
|
|
2045
|
+
dup: false,
|
|
2046
|
+
length: 2,
|
|
2047
|
+
messageId: 2
|
|
2048
|
+
}, Buffer.from([
|
|
2049
|
+
112, 2, // Header
|
|
2050
|
+
0, 2 // Message ID
|
|
2051
|
+
]))
|
|
2052
|
+
|
|
2053
|
+
// Where a flag bit is marked as “Reserved” in Table 2.2 - Flag Bits, it is reserved for future use and MUST be set to the value listed in that table [MQTT-2.2.2-1]. If invalid flags are received, the receiver MUST close the Network Connection [MQTT-2.2.2-2]
|
|
2054
|
+
testParseError('Invalid header flag bits, must be 0x0 for pubcomp packet', Buffer.from([
|
|
2055
|
+
113, 2, // Header
|
|
2056
|
+
0, 2 // Message ID
|
|
2057
|
+
]))
|
|
2058
|
+
|
|
2059
|
+
testParseGenerate('pubcomp MQTT 5 properties', {
|
|
2060
|
+
cmd: 'pubcomp',
|
|
2061
|
+
retain: false,
|
|
2062
|
+
qos: 0,
|
|
2063
|
+
dup: false,
|
|
2064
|
+
length: 24,
|
|
2065
|
+
messageId: 2,
|
|
2066
|
+
reasonCode: 0x92,
|
|
2067
|
+
properties: {
|
|
2068
|
+
reasonString: 'test',
|
|
2069
|
+
userProperties: {
|
|
2070
|
+
test: 'test'
|
|
2071
|
+
}
|
|
2072
|
+
}
|
|
2073
|
+
}, Buffer.from([
|
|
2074
|
+
112, 24, // Header
|
|
2075
|
+
0, 2, // Message ID
|
|
2076
|
+
0x92, // reason code
|
|
2077
|
+
20, // properties length
|
|
2078
|
+
31, 0, 4, 116, 101, 115, 116, // reasonString
|
|
2079
|
+
38, 0, 4, 116, 101, 115, 116, 0, 4, 116, 101, 115, 116 // userProperties
|
|
2080
|
+
]), { protocolVersion: 5 })
|
|
2081
|
+
|
|
2082
|
+
testParseError('Invalid pubcomp reason code', Buffer.from([
|
|
2083
|
+
112, 4, // Header
|
|
2084
|
+
0, 2, // Message ID
|
|
2085
|
+
16, // reason code
|
|
2086
|
+
0 // properties length
|
|
2087
|
+
]), { protocolVersion: 5 })
|
|
2088
|
+
|
|
2089
|
+
testParseError('Invalid header flag bits, must be 0x2 for subscribe packet', Buffer.from([
|
|
2090
|
+
128, 9, // Header (subscribeqos=0length=9)
|
|
2091
|
+
0, 6, // Message ID (6)
|
|
2092
|
+
0, 4, // Topic length,
|
|
2093
|
+
116, 101, 115, 116, // Topic (test)
|
|
2094
|
+
0 // Qos (0)
|
|
2095
|
+
]))
|
|
2096
|
+
|
|
2097
|
+
testParseGenerate('subscribe to one topic', {
|
|
2098
|
+
cmd: 'subscribe',
|
|
2099
|
+
retain: false,
|
|
2100
|
+
qos: 1,
|
|
2101
|
+
dup: false,
|
|
2102
|
+
length: 9,
|
|
2103
|
+
subscriptions: [
|
|
2104
|
+
{
|
|
2105
|
+
topic: 'test',
|
|
2106
|
+
qos: 0
|
|
2107
|
+
}
|
|
2108
|
+
],
|
|
2109
|
+
messageId: 6
|
|
2110
|
+
}, Buffer.from([
|
|
2111
|
+
130, 9, // Header (subscribeqos=1length=9)
|
|
2112
|
+
0, 6, // Message ID (6)
|
|
2113
|
+
0, 4, // Topic length,
|
|
2114
|
+
116, 101, 115, 116, // Topic (test)
|
|
2115
|
+
0 // Qos (0)
|
|
2116
|
+
]))
|
|
2117
|
+
|
|
2118
|
+
testParseError('Invalid subscribe QoS, must be <= 2', Buffer.from([
|
|
2119
|
+
130, 9, // Header (subscribeqos=0length=9)
|
|
2120
|
+
0, 6, // Message ID (6)
|
|
2121
|
+
0, 4, // Topic length,
|
|
2122
|
+
116, 101, 115, 116, // Topic (test)
|
|
2123
|
+
3 // Qos
|
|
2124
|
+
]))
|
|
2125
|
+
|
|
2126
|
+
testParseError('Invalid subscribe topic flag bits, bits 7-6 must be 0', Buffer.from([
|
|
2127
|
+
130, 10, // Header (subscribeqos=0length=9)
|
|
2128
|
+
0, 6, // Message ID (6)
|
|
2129
|
+
0, // Property length (0)
|
|
2130
|
+
0, 4, // Topic length,
|
|
2131
|
+
116, 101, 115, 116, // Topic (test)
|
|
2132
|
+
0x80 // Flags
|
|
2133
|
+
]), { protocolVersion: 5 })
|
|
2134
|
+
|
|
2135
|
+
testParseError('Invalid retain handling, must be <= 2', Buffer.from([
|
|
2136
|
+
130, 10, // Header (subscribeqos=0length=9)
|
|
2137
|
+
0, 6, // Message ID (6)
|
|
2138
|
+
0, // Property length (0)
|
|
2139
|
+
0, 4, // Topic length,
|
|
2140
|
+
116, 101, 115, 116, // Topic (test)
|
|
2141
|
+
0x30 // Flags
|
|
2142
|
+
]), { protocolVersion: 5 })
|
|
2143
|
+
|
|
2144
|
+
testParseError('Invalid subscribe topic flag bits, bits 7-2 must be 0', Buffer.from([
|
|
2145
|
+
130, 9, // Header (subscribeqos=0length=9)
|
|
2146
|
+
0, 6, // Message ID (6)
|
|
2147
|
+
0, 4, // Topic length,
|
|
2148
|
+
116, 101, 115, 116, // Topic (test)
|
|
2149
|
+
0x08 // Flags
|
|
2150
|
+
]))
|
|
2151
|
+
|
|
2152
|
+
testParseGenerate('subscribe to one topic by MQTT 5', {
|
|
2153
|
+
cmd: 'subscribe',
|
|
2154
|
+
retain: false,
|
|
2155
|
+
qos: 1,
|
|
2156
|
+
dup: false,
|
|
2157
|
+
length: 26,
|
|
2158
|
+
subscriptions: [
|
|
2159
|
+
{
|
|
2160
|
+
topic: 'test',
|
|
2161
|
+
qos: 0,
|
|
2162
|
+
nl: false,
|
|
2163
|
+
rap: true,
|
|
2164
|
+
rh: 1
|
|
2165
|
+
}
|
|
2166
|
+
],
|
|
2167
|
+
messageId: 6,
|
|
2168
|
+
properties: {
|
|
2169
|
+
subscriptionIdentifier: 145,
|
|
2170
|
+
userProperties: {
|
|
2171
|
+
test: 'test'
|
|
2172
|
+
}
|
|
2173
|
+
}
|
|
2174
|
+
}, Buffer.from([
|
|
2175
|
+
130, 26, // Header (subscribeqos=1length=9)
|
|
2176
|
+
0, 6, // Message ID (6)
|
|
2177
|
+
16, // properties length
|
|
2178
|
+
11, 145, 1, // subscriptionIdentifier
|
|
2179
|
+
38, 0, 4, 116, 101, 115, 116, 0, 4, 116, 101, 115, 116, // userProperties
|
|
2180
|
+
0, 4, // Topic length,
|
|
2181
|
+
116, 101, 115, 116, // Topic (test)
|
|
2182
|
+
24 // settings(qos: 0, noLocal: false, Retain as Published: true, retain handling: 1)
|
|
2183
|
+
]), { protocolVersion: 5 })
|
|
2184
|
+
|
|
2185
|
+
testParseGenerate('subscribe to three topics', {
|
|
2186
|
+
cmd: 'subscribe',
|
|
2187
|
+
retain: false,
|
|
2188
|
+
qos: 1,
|
|
2189
|
+
dup: false,
|
|
2190
|
+
length: 23,
|
|
2191
|
+
subscriptions: [
|
|
2192
|
+
{
|
|
2193
|
+
topic: 'test',
|
|
2194
|
+
qos: 0
|
|
2195
|
+
}, {
|
|
2196
|
+
topic: 'uest',
|
|
2197
|
+
qos: 1
|
|
2198
|
+
}, {
|
|
2199
|
+
topic: 'tfst',
|
|
2200
|
+
qos: 2
|
|
2201
|
+
}
|
|
2202
|
+
],
|
|
2203
|
+
messageId: 6
|
|
2204
|
+
}, Buffer.from([
|
|
2205
|
+
130, 23, // Header (publishqos=1length=9)
|
|
2206
|
+
0, 6, // Message ID (6)
|
|
2207
|
+
0, 4, // Topic length,
|
|
2208
|
+
116, 101, 115, 116, // Topic (test)
|
|
2209
|
+
0, // Qos (0)
|
|
2210
|
+
0, 4, // Topic length
|
|
2211
|
+
117, 101, 115, 116, // Topic (uest)
|
|
2212
|
+
1, // Qos (1)
|
|
2213
|
+
0, 4, // Topic length
|
|
2214
|
+
116, 102, 115, 116, // Topic (tfst)
|
|
2215
|
+
2 // Qos (2)
|
|
2216
|
+
]))
|
|
2217
|
+
|
|
2218
|
+
testParseGenerate('subscribe to 3 topics by MQTT 5', {
|
|
2219
|
+
cmd: 'subscribe',
|
|
2220
|
+
retain: false,
|
|
2221
|
+
qos: 1,
|
|
2222
|
+
dup: false,
|
|
2223
|
+
length: 40,
|
|
2224
|
+
subscriptions: [
|
|
2225
|
+
{
|
|
2226
|
+
topic: 'test',
|
|
2227
|
+
qos: 0,
|
|
2228
|
+
nl: false,
|
|
2229
|
+
rap: true,
|
|
2230
|
+
rh: 1
|
|
2231
|
+
},
|
|
2232
|
+
{
|
|
2233
|
+
topic: 'uest',
|
|
2234
|
+
qos: 1,
|
|
2235
|
+
nl: false,
|
|
2236
|
+
rap: false,
|
|
2237
|
+
rh: 0
|
|
2238
|
+
}, {
|
|
2239
|
+
topic: 'tfst',
|
|
2240
|
+
qos: 2,
|
|
2241
|
+
nl: true,
|
|
2242
|
+
rap: false,
|
|
2243
|
+
rh: 0
|
|
2244
|
+
}
|
|
2245
|
+
],
|
|
2246
|
+
messageId: 6,
|
|
2247
|
+
properties: {
|
|
2248
|
+
subscriptionIdentifier: 145,
|
|
2249
|
+
userProperties: {
|
|
2250
|
+
test: 'test'
|
|
2251
|
+
}
|
|
2252
|
+
}
|
|
2253
|
+
}, Buffer.from([
|
|
2254
|
+
130, 40, // Header (subscribeqos=1length=9)
|
|
2255
|
+
0, 6, // Message ID (6)
|
|
2256
|
+
16, // properties length
|
|
2257
|
+
11, 145, 1, // subscriptionIdentifier
|
|
2258
|
+
38, 0, 4, 116, 101, 115, 116, 0, 4, 116, 101, 115, 116, // userProperties
|
|
2259
|
+
0, 4, // Topic length,
|
|
2260
|
+
116, 101, 115, 116, // Topic (test)
|
|
2261
|
+
24, // settings(qos: 0, noLocal: false, Retain as Published: true, retain handling: 1)
|
|
2262
|
+
0, 4, // Topic length
|
|
2263
|
+
117, 101, 115, 116, // Topic (uest)
|
|
2264
|
+
1, // Qos (1)
|
|
2265
|
+
0, 4, // Topic length
|
|
2266
|
+
116, 102, 115, 116, // Topic (tfst)
|
|
2267
|
+
6 // Qos (2), No Local: true
|
|
2268
|
+
]), { protocolVersion: 5 })
|
|
2269
|
+
|
|
2270
|
+
testParseGenerate('suback', {
|
|
2271
|
+
cmd: 'suback',
|
|
2272
|
+
retain: false,
|
|
2273
|
+
qos: 0,
|
|
2274
|
+
dup: false,
|
|
2275
|
+
length: 5,
|
|
2276
|
+
granted: [0, 1, 2],
|
|
2277
|
+
messageId: 6
|
|
2278
|
+
}, Buffer.from([
|
|
2279
|
+
144, 5, // Header
|
|
2280
|
+
0, 6, // Message ID
|
|
2281
|
+
0, 1, 2
|
|
2282
|
+
]))
|
|
2283
|
+
|
|
2284
|
+
testParseGenerate('suback', {
|
|
2285
|
+
cmd: 'suback',
|
|
2286
|
+
retain: false,
|
|
2287
|
+
qos: 0,
|
|
2288
|
+
dup: false,
|
|
2289
|
+
length: 7,
|
|
2290
|
+
granted: [0, 1, 2, 128],
|
|
2291
|
+
messageId: 6
|
|
2292
|
+
}, Buffer.from([
|
|
2293
|
+
144, 7, // Header
|
|
2294
|
+
0, 6, // Message ID
|
|
2295
|
+
0, // Property length
|
|
2296
|
+
0, 1, 2, 128 // Granted qos (0, 1, 2) and a rejected being 0x80
|
|
2297
|
+
]), { protocolVersion: 5 })
|
|
2298
|
+
|
|
2299
|
+
testParseError('Invalid suback QoS, must be 0, 1, 2 or 128', Buffer.from([
|
|
2300
|
+
144, 6, // Header
|
|
2301
|
+
0, 6, // Message ID
|
|
2302
|
+
0, 1, 2, 3 // Granted qos (0, 1, 2)
|
|
2303
|
+
]))
|
|
2304
|
+
|
|
2305
|
+
testParseError('Invalid suback code', Buffer.from([
|
|
2306
|
+
144, 6, // Header
|
|
2307
|
+
0, 6, // Message ID
|
|
2308
|
+
0, 1, 2, 0x79 // Granted qos (0, 1, 2) and an invalid code
|
|
2309
|
+
]), { protocolVersion: 5 })
|
|
2310
|
+
|
|
2311
|
+
testParseGenerate('suback MQTT 5', {
|
|
2312
|
+
cmd: 'suback',
|
|
2313
|
+
retain: false,
|
|
2314
|
+
qos: 0,
|
|
2315
|
+
dup: false,
|
|
2316
|
+
length: 27,
|
|
2317
|
+
granted: [0, 1, 2, 128],
|
|
2318
|
+
messageId: 6,
|
|
2319
|
+
properties: {
|
|
2320
|
+
reasonString: 'test',
|
|
2321
|
+
userProperties: {
|
|
2322
|
+
test: 'test'
|
|
2323
|
+
}
|
|
2324
|
+
}
|
|
2325
|
+
}, Buffer.from([
|
|
2326
|
+
144, 27, // Header
|
|
2327
|
+
0, 6, // Message ID
|
|
2328
|
+
20, // properties length
|
|
2329
|
+
31, 0, 4, 116, 101, 115, 116, // reasonString
|
|
2330
|
+
38, 0, 4, 116, 101, 115, 116, 0, 4, 116, 101, 115, 116, // userProperties
|
|
2331
|
+
0, 1, 2, 128 // Granted qos (0, 1, 2) and a rejected being 0x80
|
|
2332
|
+
]), { protocolVersion: 5 })
|
|
2333
|
+
|
|
2334
|
+
testParseGenerate('unsubscribe', {
|
|
2335
|
+
cmd: 'unsubscribe',
|
|
2336
|
+
retain: false,
|
|
2337
|
+
qos: 1,
|
|
2338
|
+
dup: false,
|
|
2339
|
+
length: 14,
|
|
2340
|
+
unsubscriptions: [
|
|
2341
|
+
'tfst',
|
|
2342
|
+
'test'
|
|
2343
|
+
],
|
|
2344
|
+
messageId: 7
|
|
2345
|
+
}, Buffer.from([
|
|
2346
|
+
162, 14,
|
|
2347
|
+
0, 7, // Message ID (7)
|
|
2348
|
+
0, 4, // Topic length
|
|
2349
|
+
116, 102, 115, 116, // Topic (tfst)
|
|
2350
|
+
0, 4, // Topic length,
|
|
2351
|
+
116, 101, 115, 116 // Topic (test)
|
|
2352
|
+
]))
|
|
2353
|
+
|
|
2354
|
+
// Where a flag bit is marked as “Reserved” in Table 2.2 - Flag Bits, it is reserved for future use and MUST be set to the value listed in that table [MQTT-2.2.2-1]. If invalid flags are received, the receiver MUST close the Network Connection [MQTT-2.2.2-2]
|
|
2355
|
+
testParseError('Invalid header flag bits, must be 0x2 for unsubscribe packet', Buffer.from([
|
|
2356
|
+
160, 14,
|
|
2357
|
+
0, 7, // Message ID (7)
|
|
2358
|
+
0, 4, // Topic length
|
|
2359
|
+
116, 102, 115, 116, // Topic (tfst)
|
|
2360
|
+
0, 4, // Topic length,
|
|
2361
|
+
116, 101, 115, 116 // Topic (test)
|
|
2362
|
+
]))
|
|
2363
|
+
|
|
2364
|
+
testGenerateError('Invalid unsubscriptions', {
|
|
2365
|
+
cmd: 'unsubscribe',
|
|
2366
|
+
retain: false,
|
|
2367
|
+
qos: 1,
|
|
2368
|
+
dup: true,
|
|
2369
|
+
length: 5,
|
|
2370
|
+
unsubscriptions: 5,
|
|
2371
|
+
messageId: 7
|
|
2372
|
+
}, {}, 'unsubscribe with unsubscriptions not an array')
|
|
2373
|
+
|
|
2374
|
+
testGenerateError('Invalid unsubscriptions', {
|
|
2375
|
+
cmd: 'unsubscribe',
|
|
2376
|
+
retain: false,
|
|
2377
|
+
qos: 1,
|
|
2378
|
+
dup: true,
|
|
2379
|
+
length: 5,
|
|
2380
|
+
unsubscriptions: [1, 2],
|
|
2381
|
+
messageId: 7
|
|
2382
|
+
}, {}, 'unsubscribe with unsubscriptions as an object')
|
|
2383
|
+
|
|
2384
|
+
testParseGenerate('unsubscribe MQTT 5', {
|
|
2385
|
+
cmd: 'unsubscribe',
|
|
2386
|
+
retain: false,
|
|
2387
|
+
qos: 1,
|
|
2388
|
+
dup: false,
|
|
2389
|
+
length: 28,
|
|
2390
|
+
unsubscriptions: [
|
|
2391
|
+
'tfst',
|
|
2392
|
+
'test'
|
|
2393
|
+
],
|
|
2394
|
+
messageId: 7,
|
|
2395
|
+
properties: {
|
|
2396
|
+
userProperties: {
|
|
2397
|
+
test: 'test'
|
|
2398
|
+
}
|
|
2399
|
+
}
|
|
2400
|
+
}, Buffer.from([
|
|
2401
|
+
162, 28,
|
|
2402
|
+
0, 7, // Message ID (7)
|
|
2403
|
+
13, // properties length
|
|
2404
|
+
38, 0, 4, 116, 101, 115, 116, 0, 4, 116, 101, 115, 116, // userProperties
|
|
2405
|
+
0, 4, // Topic length
|
|
2406
|
+
116, 102, 115, 116, // Topic (tfst)
|
|
2407
|
+
0, 4, // Topic length,
|
|
2408
|
+
116, 101, 115, 116 // Topic (test)
|
|
2409
|
+
]), { protocolVersion: 5 })
|
|
2410
|
+
|
|
2411
|
+
testParseGenerate('unsuback', {
|
|
2412
|
+
cmd: 'unsuback',
|
|
2413
|
+
retain: false,
|
|
2414
|
+
qos: 0,
|
|
2415
|
+
dup: false,
|
|
2416
|
+
length: 2,
|
|
2417
|
+
messageId: 8
|
|
2418
|
+
}, Buffer.from([
|
|
2419
|
+
176, 2, // Header
|
|
2420
|
+
0, 8 // Message ID
|
|
2421
|
+
]))
|
|
2422
|
+
|
|
2423
|
+
// Where a flag bit is marked as “Reserved” in Table 2.2 - Flag Bits, it is reserved for future use and MUST be set to the value listed in that table [MQTT-2.2.2-1]. If invalid flags are received, the receiver MUST close the Network Connection [MQTT-2.2.2-2]
|
|
2424
|
+
testParseError('Invalid header flag bits, must be 0x0 for unsuback packet', Buffer.from([
|
|
2425
|
+
177, 2, // Header
|
|
2426
|
+
0, 8 // Message ID
|
|
2427
|
+
]))
|
|
2428
|
+
|
|
2429
|
+
testParseGenerate('unsuback MQTT 5', {
|
|
2430
|
+
cmd: 'unsuback',
|
|
2431
|
+
retain: false,
|
|
2432
|
+
qos: 0,
|
|
2433
|
+
dup: false,
|
|
2434
|
+
length: 25,
|
|
2435
|
+
messageId: 8,
|
|
2436
|
+
properties: {
|
|
2437
|
+
reasonString: 'test',
|
|
2438
|
+
userProperties: {
|
|
2439
|
+
test: 'test'
|
|
2440
|
+
}
|
|
2441
|
+
},
|
|
2442
|
+
granted: [0, 128]
|
|
2443
|
+
}, Buffer.from([
|
|
2444
|
+
176, 25, // Header
|
|
2445
|
+
0, 8, // Message ID
|
|
2446
|
+
20, // properties length
|
|
2447
|
+
31, 0, 4, 116, 101, 115, 116, // reasonString
|
|
2448
|
+
38, 0, 4, 116, 101, 115, 116, 0, 4, 116, 101, 115, 116, // userProperties
|
|
2449
|
+
0, 128 // success and error
|
|
2450
|
+
]), { protocolVersion: 5 })
|
|
2451
|
+
|
|
2452
|
+
testParseError('Invalid unsuback code', Buffer.from([
|
|
2453
|
+
176, 4, // Header
|
|
2454
|
+
0, 8, // Message ID
|
|
2455
|
+
0, // properties length
|
|
2456
|
+
0x84 // reason codes
|
|
2457
|
+
]), { protocolVersion: 5 })
|
|
2458
|
+
|
|
2459
|
+
testParseGenerate('pingreq', {
|
|
2460
|
+
cmd: 'pingreq',
|
|
2461
|
+
retain: false,
|
|
2462
|
+
qos: 0,
|
|
2463
|
+
dup: false,
|
|
2464
|
+
length: 0
|
|
2465
|
+
}, Buffer.from([
|
|
2466
|
+
192, 0 // Header
|
|
2467
|
+
]))
|
|
2468
|
+
|
|
2469
|
+
// Where a flag bit is marked as “Reserved” in Table 2.2 - Flag Bits, it is reserved for future use and MUST be set to the value listed in that table [MQTT-2.2.2-1]. If invalid flags are received, the receiver MUST close the Network Connection [MQTT-2.2.2-2]
|
|
2470
|
+
testParseError('Invalid header flag bits, must be 0x0 for pingreq packet', Buffer.from([
|
|
2471
|
+
193, 0 // Header
|
|
2472
|
+
]))
|
|
2473
|
+
|
|
2474
|
+
testParseGenerate('pingresp', {
|
|
2475
|
+
cmd: 'pingresp',
|
|
2476
|
+
retain: false,
|
|
2477
|
+
qos: 0,
|
|
2478
|
+
dup: false,
|
|
2479
|
+
length: 0
|
|
2480
|
+
}, Buffer.from([
|
|
2481
|
+
208, 0 // Header
|
|
2482
|
+
]))
|
|
2483
|
+
|
|
2484
|
+
// Where a flag bit is marked as “Reserved” in Table 2.2 - Flag Bits, it is reserved for future use and MUST be set to the value listed in that table [MQTT-2.2.2-1]. If invalid flags are received, the receiver MUST close the Network Connection [MQTT-2.2.2-2]
|
|
2485
|
+
testParseError('Invalid header flag bits, must be 0x0 for pingresp packet', Buffer.from([
|
|
2486
|
+
209, 0 // Header
|
|
2487
|
+
]))
|
|
2488
|
+
|
|
2489
|
+
testParseGenerate('disconnect', {
|
|
2490
|
+
cmd: 'disconnect',
|
|
2491
|
+
retain: false,
|
|
2492
|
+
qos: 0,
|
|
2493
|
+
dup: false,
|
|
2494
|
+
length: 0
|
|
2495
|
+
}, Buffer.from([
|
|
2496
|
+
224, 0 // Header
|
|
2497
|
+
]))
|
|
2498
|
+
|
|
2499
|
+
// Where a flag bit is marked as “Reserved” in Table 2.2 - Flag Bits, it is reserved for future use and MUST be set to the value listed in that table [MQTT-2.2.2-1]. If invalid flags are received, the receiver MUST close the Network Connection [MQTT-2.2.2-2]
|
|
2500
|
+
testParseError('Invalid header flag bits, must be 0x0 for disconnect packet', Buffer.from([
|
|
2501
|
+
225, 0 // Header
|
|
2502
|
+
]))
|
|
2503
|
+
|
|
2504
|
+
testParseGenerate('disconnect MQTT 5', {
|
|
2505
|
+
cmd: 'disconnect',
|
|
2506
|
+
retain: false,
|
|
2507
|
+
qos: 0,
|
|
2508
|
+
dup: false,
|
|
2509
|
+
length: 34,
|
|
2510
|
+
reasonCode: 0,
|
|
2511
|
+
properties: {
|
|
2512
|
+
sessionExpiryInterval: 145,
|
|
2513
|
+
reasonString: 'test',
|
|
2514
|
+
userProperties: {
|
|
2515
|
+
test: 'test'
|
|
2516
|
+
},
|
|
2517
|
+
serverReference: 'test'
|
|
2518
|
+
}
|
|
2519
|
+
}, Buffer.from([
|
|
2520
|
+
224, 34, // Header
|
|
2521
|
+
0, // reason code
|
|
2522
|
+
32, // properties length
|
|
2523
|
+
17, 0, 0, 0, 145, // sessionExpiryInterval
|
|
2524
|
+
31, 0, 4, 116, 101, 115, 116, // reasonString
|
|
2525
|
+
38, 0, 4, 116, 101, 115, 116, 0, 4, 116, 101, 115, 116, // userProperties
|
|
2526
|
+
28, 0, 4, 116, 101, 115, 116// serverReference
|
|
2527
|
+
]), { protocolVersion: 5 })
|
|
2528
|
+
|
|
2529
|
+
testParseGenerate('disconnect MQTT 5 with no properties', {
|
|
2530
|
+
cmd: 'disconnect',
|
|
2531
|
+
retain: false,
|
|
2532
|
+
qos: 0,
|
|
2533
|
+
dup: false,
|
|
2534
|
+
length: 2,
|
|
2535
|
+
reasonCode: 0
|
|
2536
|
+
}, Buffer.from([
|
|
2537
|
+
224, 2, // Fixed Header (DISCONNECT, Remaining Length)
|
|
2538
|
+
0, // Reason Code (Normal Disconnection)
|
|
2539
|
+
0 // Property Length (0 => No Properties)
|
|
2540
|
+
]), { protocolVersion: 5 })
|
|
2541
|
+
|
|
2542
|
+
testParseError('Invalid disconnect reason code', Buffer.from([
|
|
2543
|
+
224, 2, // Fixed Header (DISCONNECT, Remaining Length)
|
|
2544
|
+
0x05, // Reason Code (Normal Disconnection)
|
|
2545
|
+
0 // Property Length (0 => No Properties)
|
|
2546
|
+
]), { protocolVersion: 5 })
|
|
2547
|
+
|
|
2548
|
+
testParseGenerate('auth MQTT 5', {
|
|
2549
|
+
cmd: 'auth',
|
|
2550
|
+
retain: false,
|
|
2551
|
+
qos: 0,
|
|
2552
|
+
dup: false,
|
|
2553
|
+
length: 36,
|
|
2554
|
+
reasonCode: 0,
|
|
2555
|
+
properties: {
|
|
2556
|
+
authenticationMethod: 'test',
|
|
2557
|
+
authenticationData: Buffer.from([0, 1, 2, 3]),
|
|
2558
|
+
reasonString: 'test',
|
|
2559
|
+
userProperties: {
|
|
2560
|
+
test: 'test'
|
|
2561
|
+
}
|
|
2562
|
+
}
|
|
2563
|
+
}, Buffer.from([
|
|
2564
|
+
240, 36, // Header
|
|
2565
|
+
0, // reason code
|
|
2566
|
+
34, // properties length
|
|
2567
|
+
21, 0, 4, 116, 101, 115, 116, // auth method
|
|
2568
|
+
22, 0, 4, 0, 1, 2, 3, // auth data
|
|
2569
|
+
31, 0, 4, 116, 101, 115, 116, // reasonString
|
|
2570
|
+
38, 0, 4, 116, 101, 115, 116, 0, 4, 116, 101, 115, 116 // userProperties
|
|
2571
|
+
]), { protocolVersion: 5 })
|
|
2572
|
+
|
|
2573
|
+
testParseError('Invalid auth reason code', Buffer.from([
|
|
2574
|
+
240, 2, // Fixed Header (DISCONNECT, Remaining Length)
|
|
2575
|
+
0x17, // Reason Code
|
|
2576
|
+
0 // Property Length (0 => No Properties)
|
|
2577
|
+
]), { protocolVersion: 5 })
|
|
2578
|
+
|
|
2579
|
+
testGenerateError('Invalid protocolId', {
|
|
2580
|
+
cmd: 'connect',
|
|
2581
|
+
retain: false,
|
|
2582
|
+
qos: 0,
|
|
2583
|
+
dup: false,
|
|
2584
|
+
length: 54,
|
|
2585
|
+
protocolId: 42,
|
|
2586
|
+
protocolVersion: 3,
|
|
2587
|
+
will: {
|
|
2588
|
+
retain: true,
|
|
2589
|
+
qos: 2,
|
|
2590
|
+
topic: 'topic',
|
|
2591
|
+
payload: 'payload'
|
|
2592
|
+
},
|
|
2593
|
+
clean: true,
|
|
2594
|
+
keepalive: 30,
|
|
2595
|
+
clientId: 'test',
|
|
2596
|
+
username: 'username',
|
|
2597
|
+
password: 'password'
|
|
2598
|
+
})
|
|
2599
|
+
|
|
2600
|
+
testGenerateError('Invalid protocol version', {
|
|
2601
|
+
cmd: 'connect',
|
|
2602
|
+
retain: false,
|
|
2603
|
+
qos: 0,
|
|
2604
|
+
dup: false,
|
|
2605
|
+
length: 54,
|
|
2606
|
+
protocolId: 'MQIsdp',
|
|
2607
|
+
protocolVersion: 1,
|
|
2608
|
+
will: {
|
|
2609
|
+
retain: true,
|
|
2610
|
+
qos: 2,
|
|
2611
|
+
topic: 'topic',
|
|
2612
|
+
payload: 'payload'
|
|
2613
|
+
},
|
|
2614
|
+
clean: true,
|
|
2615
|
+
keepalive: 30,
|
|
2616
|
+
clientId: 'test',
|
|
2617
|
+
username: 'username',
|
|
2618
|
+
password: 'password'
|
|
2619
|
+
})
|
|
2620
|
+
|
|
2621
|
+
testGenerateError('clientId must be supplied before 3.1.1', {
|
|
2622
|
+
cmd: 'connect',
|
|
2623
|
+
retain: false,
|
|
2624
|
+
qos: 0,
|
|
2625
|
+
dup: false,
|
|
2626
|
+
length: 54,
|
|
2627
|
+
protocolId: 'MQIsdp',
|
|
2628
|
+
protocolVersion: 3,
|
|
2629
|
+
will: {
|
|
2630
|
+
retain: true,
|
|
2631
|
+
qos: 2,
|
|
2632
|
+
topic: 'topic',
|
|
2633
|
+
payload: 'payload'
|
|
2634
|
+
},
|
|
2635
|
+
clean: true,
|
|
2636
|
+
keepalive: 30,
|
|
2637
|
+
username: 'username',
|
|
2638
|
+
password: 'password'
|
|
2639
|
+
})
|
|
2640
|
+
|
|
2641
|
+
testGenerateError('clientId must be given if cleanSession set to 0', {
|
|
2642
|
+
cmd: 'connect',
|
|
2643
|
+
retain: false,
|
|
2644
|
+
qos: 0,
|
|
2645
|
+
dup: false,
|
|
2646
|
+
length: 54,
|
|
2647
|
+
protocolId: 'MQTT',
|
|
2648
|
+
protocolVersion: 4,
|
|
2649
|
+
will: {
|
|
2650
|
+
retain: true,
|
|
2651
|
+
qos: 2,
|
|
2652
|
+
topic: 'topic',
|
|
2653
|
+
payload: 'payload'
|
|
2654
|
+
},
|
|
2655
|
+
clean: false,
|
|
2656
|
+
keepalive: 30,
|
|
2657
|
+
username: 'username',
|
|
2658
|
+
password: 'password'
|
|
2659
|
+
})
|
|
2660
|
+
|
|
2661
|
+
testGenerateError('Invalid keepalive', {
|
|
2662
|
+
cmd: 'connect',
|
|
2663
|
+
retain: false,
|
|
2664
|
+
qos: 0,
|
|
2665
|
+
dup: false,
|
|
2666
|
+
length: 54,
|
|
2667
|
+
protocolId: 'MQIsdp',
|
|
2668
|
+
protocolVersion: 3,
|
|
2669
|
+
will: {
|
|
2670
|
+
retain: true,
|
|
2671
|
+
qos: 2,
|
|
2672
|
+
topic: 'topic',
|
|
2673
|
+
payload: 'payload'
|
|
2674
|
+
},
|
|
2675
|
+
clean: true,
|
|
2676
|
+
keepalive: 'hello',
|
|
2677
|
+
clientId: 'test',
|
|
2678
|
+
username: 'username',
|
|
2679
|
+
password: 'password'
|
|
2680
|
+
})
|
|
2681
|
+
|
|
2682
|
+
testGenerateError('Invalid keepalive', {
|
|
2683
|
+
cmd: 'connect',
|
|
2684
|
+
keepalive: 3.1416
|
|
2685
|
+
})
|
|
2686
|
+
|
|
2687
|
+
testGenerateError('Invalid will', {
|
|
2688
|
+
cmd: 'connect',
|
|
2689
|
+
retain: false,
|
|
2690
|
+
qos: 0,
|
|
2691
|
+
dup: false,
|
|
2692
|
+
length: 54,
|
|
2693
|
+
protocolId: 'MQIsdp',
|
|
2694
|
+
protocolVersion: 3,
|
|
2695
|
+
will: 42,
|
|
2696
|
+
clean: true,
|
|
2697
|
+
keepalive: 30,
|
|
2698
|
+
clientId: 'test',
|
|
2699
|
+
username: 'username',
|
|
2700
|
+
password: 'password'
|
|
2701
|
+
})
|
|
2702
|
+
|
|
2703
|
+
testGenerateError('Invalid will topic', {
|
|
2704
|
+
cmd: 'connect',
|
|
2705
|
+
retain: false,
|
|
2706
|
+
qos: 0,
|
|
2707
|
+
dup: false,
|
|
2708
|
+
length: 54,
|
|
2709
|
+
protocolId: 'MQIsdp',
|
|
2710
|
+
protocolVersion: 3,
|
|
2711
|
+
will: {
|
|
2712
|
+
retain: true,
|
|
2713
|
+
qos: 2,
|
|
2714
|
+
payload: 'payload'
|
|
2715
|
+
},
|
|
2716
|
+
clean: true,
|
|
2717
|
+
keepalive: 30,
|
|
2718
|
+
clientId: 'test',
|
|
2719
|
+
username: 'username',
|
|
2720
|
+
password: 'password'
|
|
2721
|
+
})
|
|
2722
|
+
|
|
2723
|
+
testGenerateError('Invalid will payload', {
|
|
2724
|
+
cmd: 'connect',
|
|
2725
|
+
retain: false,
|
|
2726
|
+
qos: 0,
|
|
2727
|
+
dup: false,
|
|
2728
|
+
length: 54,
|
|
2729
|
+
protocolId: 'MQIsdp',
|
|
2730
|
+
protocolVersion: 3,
|
|
2731
|
+
will: {
|
|
2732
|
+
retain: true,
|
|
2733
|
+
qos: 2,
|
|
2734
|
+
topic: 'topic',
|
|
2735
|
+
payload: 42
|
|
2736
|
+
},
|
|
2737
|
+
clean: true,
|
|
2738
|
+
keepalive: 30,
|
|
2739
|
+
clientId: 'test',
|
|
2740
|
+
username: 'username',
|
|
2741
|
+
password: 'password'
|
|
2742
|
+
})
|
|
2743
|
+
|
|
2744
|
+
testGenerateError('Invalid username', {
|
|
2745
|
+
cmd: 'connect',
|
|
2746
|
+
retain: false,
|
|
2747
|
+
qos: 0,
|
|
2748
|
+
dup: false,
|
|
2749
|
+
length: 54,
|
|
2750
|
+
protocolId: 'MQIsdp',
|
|
2751
|
+
protocolVersion: 3,
|
|
2752
|
+
will: {
|
|
2753
|
+
retain: true,
|
|
2754
|
+
qos: 2,
|
|
2755
|
+
topic: 'topic',
|
|
2756
|
+
payload: 'payload'
|
|
2757
|
+
},
|
|
2758
|
+
clean: true,
|
|
2759
|
+
keepalive: 30,
|
|
2760
|
+
clientId: 'test',
|
|
2761
|
+
username: 42,
|
|
2762
|
+
password: 'password'
|
|
2763
|
+
})
|
|
2764
|
+
|
|
2765
|
+
testGenerateError('Invalid password', {
|
|
2766
|
+
cmd: 'connect',
|
|
2767
|
+
retain: false,
|
|
2768
|
+
qos: 0,
|
|
2769
|
+
dup: false,
|
|
2770
|
+
length: 54,
|
|
2771
|
+
protocolId: 'MQIsdp',
|
|
2772
|
+
protocolVersion: 3,
|
|
2773
|
+
will: {
|
|
2774
|
+
retain: true,
|
|
2775
|
+
qos: 2,
|
|
2776
|
+
topic: 'topic',
|
|
2777
|
+
payload: 'payload'
|
|
2778
|
+
},
|
|
2779
|
+
clean: true,
|
|
2780
|
+
keepalive: 30,
|
|
2781
|
+
clientId: 'test',
|
|
2782
|
+
username: 'username',
|
|
2783
|
+
password: 42
|
|
2784
|
+
})
|
|
2785
|
+
|
|
2786
|
+
testGenerateError('Username is required to use password', {
|
|
2787
|
+
cmd: 'connect',
|
|
2788
|
+
retain: false,
|
|
2789
|
+
qos: 0,
|
|
2790
|
+
dup: false,
|
|
2791
|
+
length: 54,
|
|
2792
|
+
protocolId: 'MQIsdp',
|
|
2793
|
+
protocolVersion: 3,
|
|
2794
|
+
will: {
|
|
2795
|
+
retain: true,
|
|
2796
|
+
qos: 2,
|
|
2797
|
+
topic: 'topic',
|
|
2798
|
+
payload: 'payload'
|
|
2799
|
+
},
|
|
2800
|
+
clean: true,
|
|
2801
|
+
keepalive: 30,
|
|
2802
|
+
clientId: 'test',
|
|
2803
|
+
password: 'password'
|
|
2804
|
+
})
|
|
2805
|
+
|
|
2806
|
+
testGenerateError('Invalid messageExpiryInterval: -4321', {
|
|
2807
|
+
cmd: 'publish',
|
|
2808
|
+
retain: true,
|
|
2809
|
+
qos: 2,
|
|
2810
|
+
dup: true,
|
|
2811
|
+
length: 60,
|
|
2812
|
+
topic: 'test',
|
|
2813
|
+
payload: Buffer.from('test'),
|
|
2814
|
+
messageId: 10,
|
|
2815
|
+
properties: {
|
|
2816
|
+
payloadFormatIndicator: true,
|
|
2817
|
+
messageExpiryInterval: -4321,
|
|
2818
|
+
topicAlias: 100,
|
|
2819
|
+
responseTopic: 'topic',
|
|
2820
|
+
correlationData: Buffer.from([1, 2, 3, 4]),
|
|
2821
|
+
userProperties: {
|
|
2822
|
+
test: 'test'
|
|
2823
|
+
},
|
|
2824
|
+
subscriptionIdentifier: 120,
|
|
2825
|
+
contentType: 'test'
|
|
2826
|
+
}
|
|
2827
|
+
}, { protocolVersion: 5 })
|
|
2828
|
+
|
|
2829
|
+
testGenerateError('Invalid topicAlias: -100', {
|
|
2830
|
+
cmd: 'publish',
|
|
2831
|
+
retain: true,
|
|
2832
|
+
qos: 2,
|
|
2833
|
+
dup: true,
|
|
2834
|
+
length: 60,
|
|
2835
|
+
topic: 'test',
|
|
2836
|
+
payload: Buffer.from('test'),
|
|
2837
|
+
messageId: 10,
|
|
2838
|
+
properties: {
|
|
2839
|
+
payloadFormatIndicator: true,
|
|
2840
|
+
messageExpiryInterval: 4321,
|
|
2841
|
+
topicAlias: -100,
|
|
2842
|
+
responseTopic: 'topic',
|
|
2843
|
+
correlationData: Buffer.from([1, 2, 3, 4]),
|
|
2844
|
+
userProperties: {
|
|
2845
|
+
test: 'test'
|
|
2846
|
+
},
|
|
2847
|
+
subscriptionIdentifier: 120,
|
|
2848
|
+
contentType: 'test'
|
|
2849
|
+
}
|
|
2850
|
+
}, { protocolVersion: 5 })
|
|
2851
|
+
|
|
2852
|
+
testGenerateError('Invalid subscriptionIdentifier: -120', {
|
|
2853
|
+
cmd: 'publish',
|
|
2854
|
+
retain: true,
|
|
2855
|
+
qos: 2,
|
|
2856
|
+
dup: true,
|
|
2857
|
+
length: 60,
|
|
2858
|
+
topic: 'test',
|
|
2859
|
+
payload: Buffer.from('test'),
|
|
2860
|
+
messageId: 10,
|
|
2861
|
+
properties: {
|
|
2862
|
+
payloadFormatIndicator: true,
|
|
2863
|
+
messageExpiryInterval: 4321,
|
|
2864
|
+
topicAlias: 100,
|
|
2865
|
+
responseTopic: 'topic',
|
|
2866
|
+
correlationData: Buffer.from([1, 2, 3, 4]),
|
|
2867
|
+
userProperties: {
|
|
2868
|
+
test: 'test'
|
|
2869
|
+
},
|
|
2870
|
+
subscriptionIdentifier: -120,
|
|
2871
|
+
contentType: 'test'
|
|
2872
|
+
}
|
|
2873
|
+
}, { protocolVersion: 5 })
|
|
2874
|
+
|
|
2875
|
+
test('support cork', t => {
|
|
2876
|
+
t.plan(9)
|
|
2877
|
+
|
|
2878
|
+
const dest = WS()
|
|
2879
|
+
|
|
2880
|
+
dest._write = (chunk, enc, cb) => {
|
|
2881
|
+
t.pass('_write called')
|
|
2882
|
+
cb()
|
|
2883
|
+
}
|
|
2884
|
+
|
|
2885
|
+
mqtt.writeToStream({
|
|
2886
|
+
cmd: 'connect',
|
|
2887
|
+
retain: false,
|
|
2888
|
+
qos: 0,
|
|
2889
|
+
dup: false,
|
|
2890
|
+
length: 18,
|
|
2891
|
+
protocolId: 'MQIsdp',
|
|
2892
|
+
protocolVersion: 3,
|
|
2893
|
+
clean: false,
|
|
2894
|
+
keepalive: 30,
|
|
2895
|
+
clientId: 'test'
|
|
2896
|
+
}, dest)
|
|
2897
|
+
|
|
2898
|
+
dest.end()
|
|
2899
|
+
})
|
|
2900
|
+
|
|
2901
|
+
// The following test case was designed after experiencing errors
|
|
2902
|
+
// when trying to connect with tls on a non tls mqtt port
|
|
2903
|
+
// the specific behaviour is:
|
|
2904
|
+
// - first byte suggests this is a connect message
|
|
2905
|
+
// - second byte suggests message length to be smaller than buffer length
|
|
2906
|
+
// thus payload processing starts
|
|
2907
|
+
// - the first two bytes suggest a protocol identifier string length
|
|
2908
|
+
// that leads the parser pointer close to the end of the buffer
|
|
2909
|
+
// - when trying to read further connect flags the buffer produces
|
|
2910
|
+
// a "out of range" Error
|
|
2911
|
+
//
|
|
2912
|
+
testParseError('Packet too short', Buffer.from([
|
|
2913
|
+
16, 9,
|
|
2914
|
+
0, 6,
|
|
2915
|
+
77, 81, 73, 115, 100, 112,
|
|
2916
|
+
3
|
|
2917
|
+
]))
|
|
2918
|
+
|
|
2919
|
+
// CONNECT Packets that show other protocol IDs than
|
|
2920
|
+
// the valid values MQTT and MQIsdp should cause an error
|
|
2921
|
+
// those packets are a hint that this is not a mqtt connection
|
|
2922
|
+
testParseError('Invalid protocolId', Buffer.from([
|
|
2923
|
+
16, 18,
|
|
2924
|
+
0, 6,
|
|
2925
|
+
65, 65, 65, 65, 65, 65, // AAAAAA
|
|
2926
|
+
3, // Protocol version
|
|
2927
|
+
0, // Connect flags
|
|
2928
|
+
0, 10, // Keepalive
|
|
2929
|
+
0, 4, // Client ID length
|
|
2930
|
+
116, 101, 115, 116 // Client ID
|
|
2931
|
+
]))
|
|
2932
|
+
|
|
2933
|
+
// CONNECT Packets that contain an unsupported protocol version
|
|
2934
|
+
// Flag (i.e. not `3` or `4` or '5') should cause an error
|
|
2935
|
+
testParseError('Invalid protocol version', Buffer.from([
|
|
2936
|
+
16, 18,
|
|
2937
|
+
0, 6,
|
|
2938
|
+
77, 81, 73, 115, 100, 112, // Protocol ID
|
|
2939
|
+
1, // Protocol version
|
|
2940
|
+
0, // Connect flags
|
|
2941
|
+
0, 10, // Keepalive
|
|
2942
|
+
0, 4, // Client ID length
|
|
2943
|
+
116, 101, 115, 116 // Client ID
|
|
2944
|
+
]))
|
|
2945
|
+
|
|
2946
|
+
// When a packet contains a string in the variable header and the
|
|
2947
|
+
// given string length of this exceeds the overall length of the packet that
|
|
2948
|
+
// was specified in the fixed header, parsing must fail.
|
|
2949
|
+
// this case simulates this behavior with the protocol ID string of the
|
|
2950
|
+
// CONNECT packet. The fixed header suggests a remaining length of 8 bytes
|
|
2951
|
+
// which would be exceeded by the string length of 15
|
|
2952
|
+
// in this case, a protocol ID parse error is expected
|
|
2953
|
+
testParseError('Cannot parse protocolId', Buffer.from([
|
|
2954
|
+
16, 8, // Fixed header
|
|
2955
|
+
0, 15, // string length 15 --> 15 > 8 --> error!
|
|
2956
|
+
77, 81, 73, 115, 100, 112,
|
|
2957
|
+
77, 81, 73, 115, 100, 112,
|
|
2958
|
+
77, 81, 73, 115, 100, 112,
|
|
2959
|
+
77, 81, 73, 115, 100, 112,
|
|
2960
|
+
77, 81, 73, 115, 100, 112,
|
|
2961
|
+
77, 81, 73, 115, 100, 112,
|
|
2962
|
+
77, 81, 73, 115, 100, 112,
|
|
2963
|
+
77, 81, 73, 115, 100, 112
|
|
2964
|
+
]))
|
|
2965
|
+
|
|
2966
|
+
testParseError('Unknown property', Buffer.from([
|
|
2967
|
+
61, 60, // Header
|
|
2968
|
+
0, 4, // Topic length
|
|
2969
|
+
116, 101, 115, 116, // Topic (test)
|
|
2970
|
+
0, 10, // Message ID
|
|
2971
|
+
47, // properties length
|
|
2972
|
+
126, 1, // unknown property
|
|
2973
|
+
2, 0, 0, 16, 225, // message expiry interval
|
|
2974
|
+
35, 0, 100, // topicAlias
|
|
2975
|
+
8, 0, 5, 116, 111, 112, 105, 99, // response topic
|
|
2976
|
+
9, 0, 4, 1, 2, 3, 4, // correlationData
|
|
2977
|
+
38, 0, 4, 116, 101, 115, 116, 0, 4, 116, 101, 115, 116, // userProperties
|
|
2978
|
+
11, 120, // subscriptionIdentifier
|
|
2979
|
+
3, 0, 4, 116, 101, 115, 116, // content type
|
|
2980
|
+
116, 101, 115, 116 // Payload (test)
|
|
2981
|
+
]), { protocolVersion: 5 })
|
|
2982
|
+
|
|
2983
|
+
testParseError('Not supported auth packet for this version MQTT', Buffer.from([
|
|
2984
|
+
240, 36, // Header
|
|
2985
|
+
0, // reason code
|
|
2986
|
+
34, // properties length
|
|
2987
|
+
21, 0, 4, 116, 101, 115, 116, // auth method
|
|
2988
|
+
22, 0, 4, 0, 1, 2, 3, // auth data
|
|
2989
|
+
31, 0, 4, 116, 101, 115, 116, // reasonString
|
|
2990
|
+
38, 0, 4, 116, 101, 115, 116, 0, 4, 116, 101, 115, 116 // userProperties
|
|
2991
|
+
]))
|
|
2992
|
+
|
|
2993
|
+
// When a Subscribe packet contains a topic_filter and the given
|
|
2994
|
+
// length is topic_filter.length + 1 then the last byte (requested QoS) is interpreted as topic_filter
|
|
2995
|
+
// reading the requested_qos at the end causes 'Index out of range' read
|
|
2996
|
+
testParseError('Malformed Subscribe Payload', Buffer.from([
|
|
2997
|
+
130, 14, // subscribe header and remaining length
|
|
2998
|
+
0, 123, // packet ID
|
|
2999
|
+
0, 10, // topic filter length
|
|
3000
|
+
104, 105, 106, 107, 108, 47, 109, 110, 111, // topic filter with length of 9 bytes
|
|
3001
|
+
0 // requested QoS
|
|
3002
|
+
]))
|
|
3003
|
+
|
|
3004
|
+
test('Cannot parse property code type', t => {
|
|
3005
|
+
const packets = Buffer.from([
|
|
3006
|
+
16, 16, 0, 4, 77, 81, 84, 84, 5, 2, 0, 60, 3, 33, 0, 20, 0, 0, 98, 2, 211, 1, 224, 2, 0, 32
|
|
3007
|
+
])
|
|
3008
|
+
|
|
3009
|
+
t.plan(3)
|
|
3010
|
+
|
|
3011
|
+
const parser = mqtt.parser()
|
|
3012
|
+
|
|
3013
|
+
parser.on('error', err => {
|
|
3014
|
+
t.equal(err.message, 'Cannot parse property code type', 'expected error message')
|
|
3015
|
+
t.end()
|
|
3016
|
+
})
|
|
3017
|
+
|
|
3018
|
+
parser.on('packet', (packet) => {
|
|
3019
|
+
t.pass('Packet parsed')
|
|
3020
|
+
})
|
|
3021
|
+
|
|
3022
|
+
parser.parse(packets)
|
|
3023
|
+
})
|
|
3024
|
+
|
|
3025
|
+
testWriteToStreamError('Invalid command', {
|
|
3026
|
+
cmd: 'invalid'
|
|
3027
|
+
})
|
|
3028
|
+
|
|
3029
|
+
testWriteToStreamError('Invalid protocolId', {
|
|
3030
|
+
cmd: 'connect',
|
|
3031
|
+
protocolId: {}
|
|
3032
|
+
})
|
|
3033
|
+
|
|
3034
|
+
test('userProperties null prototype', t => {
|
|
3035
|
+
t.plan(3)
|
|
3036
|
+
|
|
3037
|
+
const packet = mqtt.generate({
|
|
3038
|
+
cmd: 'connect',
|
|
3039
|
+
retain: false,
|
|
3040
|
+
qos: 0,
|
|
3041
|
+
dup: false,
|
|
3042
|
+
length: 125,
|
|
3043
|
+
protocolId: 'MQTT',
|
|
3044
|
+
protocolVersion: 5,
|
|
3045
|
+
will: {
|
|
3046
|
+
retain: true,
|
|
3047
|
+
qos: 2,
|
|
3048
|
+
properties: {
|
|
3049
|
+
willDelayInterval: 1234,
|
|
3050
|
+
payloadFormatIndicator: false,
|
|
3051
|
+
messageExpiryInterval: 4321,
|
|
3052
|
+
contentType: 'test',
|
|
3053
|
+
responseTopic: 'topic',
|
|
3054
|
+
correlationData: Buffer.from([1, 2, 3, 4]),
|
|
3055
|
+
userProperties: {
|
|
3056
|
+
test: 'test'
|
|
3057
|
+
}
|
|
3058
|
+
},
|
|
3059
|
+
topic: 'topic',
|
|
3060
|
+
payload: Buffer.from([4, 3, 2, 1])
|
|
3061
|
+
},
|
|
3062
|
+
clean: true,
|
|
3063
|
+
keepalive: 30,
|
|
3064
|
+
properties: {
|
|
3065
|
+
sessionExpiryInterval: 1234,
|
|
3066
|
+
receiveMaximum: 432,
|
|
3067
|
+
maximumPacketSize: 100,
|
|
3068
|
+
topicAliasMaximum: 456,
|
|
3069
|
+
requestResponseInformation: true,
|
|
3070
|
+
requestProblemInformation: true,
|
|
3071
|
+
userProperties: {
|
|
3072
|
+
test: 'test'
|
|
3073
|
+
},
|
|
3074
|
+
authenticationMethod: 'test',
|
|
3075
|
+
authenticationData: Buffer.from([1, 2, 3, 4])
|
|
3076
|
+
},
|
|
3077
|
+
clientId: 'test'
|
|
3078
|
+
})
|
|
3079
|
+
|
|
3080
|
+
const parser = mqtt.parser()
|
|
3081
|
+
|
|
3082
|
+
parser.on('packet', packet => {
|
|
3083
|
+
t.equal(packet.cmd, 'connect')
|
|
3084
|
+
t.equal(Object.getPrototypeOf(packet.properties.userProperties), null)
|
|
3085
|
+
t.equal(Object.getPrototypeOf(packet.will.properties.userProperties), null)
|
|
3086
|
+
})
|
|
3087
|
+
|
|
3088
|
+
parser.parse(packet)
|
|
3089
|
+
})
|
|
3090
|
+
|
|
3091
|
+
test('stops parsing after first error', t => {
|
|
3092
|
+
t.plan(4)
|
|
3093
|
+
|
|
3094
|
+
const parser = mqtt.parser()
|
|
3095
|
+
|
|
3096
|
+
let packetCount = 0
|
|
3097
|
+
let errorCount = 0
|
|
3098
|
+
let expectedPackets = 1
|
|
3099
|
+
let expectedErrors = 1
|
|
3100
|
+
|
|
3101
|
+
parser.on('packet', packet => {
|
|
3102
|
+
t.ok(++packetCount <= expectedPackets, `expected <= ${expectedPackets} packets`)
|
|
3103
|
+
})
|
|
3104
|
+
|
|
3105
|
+
parser.on('error', erroneous => {
|
|
3106
|
+
t.ok(++errorCount <= expectedErrors, `expected <= ${expectedErrors} errors`)
|
|
3107
|
+
})
|
|
3108
|
+
|
|
3109
|
+
parser.parse(Buffer.from([
|
|
3110
|
+
// First, a valid connect packet:
|
|
3111
|
+
|
|
3112
|
+
16, 12, // Header
|
|
3113
|
+
0, 4, // Protocol ID length
|
|
3114
|
+
77, 81, 84, 84, // Protocol ID
|
|
3115
|
+
4, // Protocol version
|
|
3116
|
+
2, // Connect flags
|
|
3117
|
+
0, 30, // Keepalive
|
|
3118
|
+
0, 0, // Client ID length
|
|
3119
|
+
|
|
3120
|
+
// Then an invalid subscribe packet:
|
|
3121
|
+
|
|
3122
|
+
128, 9, // Header (subscribeqos=0length=9)
|
|
3123
|
+
0, 6, // Message ID (6)
|
|
3124
|
+
0, 4, // Topic length,
|
|
3125
|
+
116, 101, 115, 116, // Topic (test)
|
|
3126
|
+
0, // Qos (0)
|
|
3127
|
+
|
|
3128
|
+
// And another invalid subscribe packet:
|
|
3129
|
+
|
|
3130
|
+
128, 9, // Header (subscribeqos=0length=9)
|
|
3131
|
+
0, 6, // Message ID (6)
|
|
3132
|
+
0, 4, // Topic length,
|
|
3133
|
+
116, 101, 115, 116, // Topic (test)
|
|
3134
|
+
0, // Qos (0)
|
|
3135
|
+
|
|
3136
|
+
// Finally, a valid disconnect packet:
|
|
3137
|
+
|
|
3138
|
+
224, 0 // Header
|
|
3139
|
+
]))
|
|
3140
|
+
|
|
3141
|
+
// Calling parse again clears the error and continues parsing
|
|
3142
|
+
packetCount = 0
|
|
3143
|
+
errorCount = 0
|
|
3144
|
+
expectedPackets = 2
|
|
3145
|
+
expectedErrors = 0
|
|
3146
|
+
|
|
3147
|
+
parser.parse(Buffer.from([
|
|
3148
|
+
// Connect:
|
|
3149
|
+
|
|
3150
|
+
16, 12, // Header
|
|
3151
|
+
0, 4, // Protocol ID length
|
|
3152
|
+
77, 81, 84, 84, // Protocol ID
|
|
3153
|
+
4, // Protocol version
|
|
3154
|
+
2, // Connect flags
|
|
3155
|
+
0, 30, // Keepalive
|
|
3156
|
+
0, 0, // Client ID length
|
|
3157
|
+
|
|
3158
|
+
// Disconnect:
|
|
3159
|
+
|
|
3160
|
+
224, 0 // Header
|
|
3161
|
+
]))
|
|
3162
|
+
})
|
|
3163
|
+
|
|
3164
|
+
testGenerateErrorMultipleCmds([
|
|
3165
|
+
'publish',
|
|
3166
|
+
'puback',
|
|
3167
|
+
'pubrec',
|
|
3168
|
+
'pubrel',
|
|
3169
|
+
'subscribe',
|
|
3170
|
+
'suback',
|
|
3171
|
+
'unsubscribe',
|
|
3172
|
+
'unsuback'
|
|
3173
|
+
], 'Invalid messageId', {
|
|
3174
|
+
qos: 1, // required for publish
|
|
3175
|
+
topic: 'test', // required for publish
|
|
3176
|
+
messageId: 'a'
|
|
3177
|
+
}, {})
|