@autofleet/rabbit 1.5.6 → 1.5.7-2

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.
@@ -0,0 +1,5 @@
1
+ <component name="ProjectCodeStyleConfiguration">
2
+ <state>
3
+ <option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
4
+ </state>
5
+ </component>
@@ -0,0 +1,158 @@
1
+ <component name="InspectionProjectProfileManager">
2
+ <profile version="1.0">
3
+ <option name="myName" value="Project Default" />
4
+ <inspection_tool class="AmdModulesDependencies" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
5
+ <inspection_tool class="BadExpressionStatementJS" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
6
+ <inspection_tool class="CallerJS" enabled="false" level="WARNING" enabled_by_default="false" />
7
+ <inspection_tool class="CommaExpressionJS" enabled="false" level="WARNING" enabled_by_default="false" />
8
+ <inspection_tool class="ConstantConditionalExpressionJS" enabled="false" level="WARNING" enabled_by_default="false" />
9
+ <inspection_tool class="ContinueOrBreakFromFinallyBlockJS" enabled="false" level="WARNING" enabled_by_default="false" />
10
+ <inspection_tool class="ES6AwaitOutsideAsyncFunction" enabled="false" level="ERROR" enabled_by_default="false" />
11
+ <inspection_tool class="ES6BindWithArrowFunction" enabled="false" level="WARNING" enabled_by_default="false" />
12
+ <inspection_tool class="ES6CheckImport" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
13
+ <inspection_tool class="ES6ClassMemberInitializationOrder" enabled="false" level="WARNING" enabled_by_default="false" />
14
+ <inspection_tool class="ES6ConvertLetToConst" enabled="false" level="INFORMATION" enabled_by_default="false" />
15
+ <inspection_tool class="ES6ConvertModuleExportToExport" enabled="false" level="INFORMATION" enabled_by_default="false" />
16
+ <inspection_tool class="ES6ConvertRequireIntoImport" enabled="false" level="INFORMATION" enabled_by_default="false" />
17
+ <inspection_tool class="ES6ConvertToForOf" enabled="false" level="INFORMATION" enabled_by_default="false" />
18
+ <inspection_tool class="ES6ConvertVarToLetConst" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
19
+ <inspection_tool class="ES6DestructuringVariablesMerge" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
20
+ <inspection_tool class="ES6MissingAwait" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
21
+ <inspection_tool class="ES6ModulesDependencies" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
22
+ <inspection_tool class="ES6PossiblyAsyncFunction" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
23
+ <inspection_tool class="ES6PreferShortImport" enabled="false" level="WARNING" enabled_by_default="false" />
24
+ <inspection_tool class="ES6RedundantAwait" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
25
+ <inspection_tool class="ES6RedundantNestingInTemplateLiteral" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
26
+ <inspection_tool class="ES6ShorthandObjectProperty" enabled="false" level="INFORMATION" enabled_by_default="false" />
27
+ <inspection_tool class="ES6UnusedImports" enabled="false" level="WARNING" enabled_by_default="false" />
28
+ <inspection_tool class="EmptyStatementBodyJS" enabled="false" level="WARNING" enabled_by_default="false">
29
+ <option name="m_reportEmptyBlocks" value="false" />
30
+ </inspection_tool>
31
+ <inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
32
+ <inspection_tool class="ExceptionCaughtLocallyJS" enabled="false" level="WARNING" enabled_by_default="false" />
33
+ <inspection_tool class="FallThroughInSwitchStatementJS" enabled="false" level="WARNING" enabled_by_default="false" />
34
+ <inspection_tool class="FlowJSConfig" enabled="false" level="WARNING" enabled_by_default="false" />
35
+ <inspection_tool class="FlowJSFlagCommentPlacement" enabled="false" level="WARNING" enabled_by_default="false" />
36
+ <inspection_tool class="IncompatibleMaskJS" enabled="false" level="WARNING" enabled_by_default="false" />
37
+ <inspection_tool class="InfiniteLoopJS" enabled="false" level="WARNING" enabled_by_default="false" />
38
+ <inspection_tool class="InfiniteRecursionJS" enabled="false" level="WARNING" enabled_by_default="false" />
39
+ <inspection_tool class="JSAccessibilityCheck" enabled="false" level="WARNING" enabled_by_default="false" />
40
+ <inspection_tool class="JSAnnotator" enabled="false" level="ERROR" enabled_by_default="false" />
41
+ <inspection_tool class="JSArrowFunctionBracesCanBeRemoved" enabled="false" level="INFORMATION" enabled_by_default="false" />
42
+ <inspection_tool class="JSAssignmentUsedAsCondition" enabled="false" level="WARNING" enabled_by_default="false" />
43
+ <inspection_tool class="JSBitwiseOperatorUsage" enabled="false" level="WARNING" enabled_by_default="false" />
44
+ <inspection_tool class="JSCheckFunctionSignatures" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
45
+ <inspection_tool class="JSClosureCompilerSyntax" enabled="false" level="WARNING" enabled_by_default="false" />
46
+ <inspection_tool class="JSCommentMatchesSignature" enabled="false" level="WARNING" enabled_by_default="false" />
47
+ <inspection_tool class="JSComparisonWithNaN" enabled="false" level="WARNING" enabled_by_default="false" />
48
+ <inspection_tool class="JSConsecutiveCommasInArrayLiteral" enabled="false" level="WARNING" enabled_by_default="false" />
49
+ <inspection_tool class="JSConstantReassignment" enabled="false" level="ERROR" enabled_by_default="false" />
50
+ <inspection_tool class="JSDeprecatedSymbols" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
51
+ <inspection_tool class="JSDuplicateCaseLabel" enabled="false" level="WARNING" enabled_by_default="false" />
52
+ <inspection_tool class="JSDuplicatedDeclaration" enabled="false" level="WARNING" enabled_by_default="false" />
53
+ <inspection_tool class="JSEqualityComparisonWithCoercion" enabled="false" level="WARNING" enabled_by_default="false" />
54
+ <inspection_tool class="JSFileReferences" enabled="false" level="WARNING" enabled_by_default="false" />
55
+ <inspection_tool class="JSFunctionExpressionToArrowFunction" enabled="false" level="INFORMATION" enabled_by_default="false" />
56
+ <inspection_tool class="JSIgnoredPromiseFromCall" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
57
+ <inspection_tool class="JSIncompatibleTypesComparison" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
58
+ <inspection_tool class="JSJQueryEfficiency" enabled="false" level="WARNING" enabled_by_default="false" />
59
+ <inspection_tool class="JSJoinVariableDeclarationAndAssignment" enabled="false" level="INFORMATION" enabled_by_default="false" />
60
+ <inspection_tool class="JSLastCommaInArrayLiteral" enabled="false" level="WARNING" enabled_by_default="false" />
61
+ <inspection_tool class="JSLastCommaInObjectLiteral" enabled="false" level="WARNING" enabled_by_default="false" />
62
+ <inspection_tool class="JSMethodCanBeStatic" enabled="false" level="WARNING" enabled_by_default="false" />
63
+ <inspection_tool class="JSMismatchedCollectionQueryUpdate" enabled="false" level="WARNING" enabled_by_default="false">
64
+ <option name="queries" value="trace,write,forEach,length,size" />
65
+ <option name="updates" value="pop,push,shift,splice,unshift,add,insert,remove,reverse,copyWithin,fill,sort" />
66
+ </inspection_tool>
67
+ <inspection_tool class="JSMissingSwitchBranches" enabled="false" level="INFORMATION" enabled_by_default="false" />
68
+ <inspection_tool class="JSMissingSwitchDefault" enabled="false" level="INFORMATION" enabled_by_default="false" />
69
+ <inspection_tool class="JSNonASCIINames" enabled="false" level="WARNING" enabled_by_default="false" />
70
+ <inspection_tool class="JSObjectNullOrUndefined" enabled="false" level="WARNING" enabled_by_default="false" />
71
+ <inspection_tool class="JSObsoletePrivateAccessSyntax" enabled="false" level="ERROR" enabled_by_default="false" />
72
+ <inspection_tool class="JSOctalInteger" enabled="false" level="ERROR" enabled_by_default="false" />
73
+ <inspection_tool class="JSPotentiallyInvalidConstructorUsage" enabled="false" level="WARNING" enabled_by_default="false">
74
+ <option name="myConsiderUppercaseFunctionsToBeConstructors" value="true" />
75
+ </inspection_tool>
76
+ <inspection_tool class="JSPotentiallyInvalidTargetOfIndexedPropertyAccess" enabled="false" level="WARNING" enabled_by_default="false" />
77
+ <inspection_tool class="JSPotentiallyInvalidUsageOfClassThis" enabled="false" level="WARNING" enabled_by_default="false" />
78
+ <inspection_tool class="JSPotentiallyInvalidUsageOfThis" enabled="false" level="WARNING" enabled_by_default="false" />
79
+ <inspection_tool class="JSPrimitiveTypeWrapperUsage" enabled="false" level="WARNING" enabled_by_default="false" />
80
+ <inspection_tool class="JSRedundantSwitchStatement" enabled="false" level="INFORMATION" enabled_by_default="false" />
81
+ <inspection_tool class="JSReferencingArgumentsOutsideOfFunction" enabled="false" level="ERROR" enabled_by_default="false" />
82
+ <inspection_tool class="JSReferencingMutableVariableFromClosure" enabled="false" level="WARNING" enabled_by_default="false" />
83
+ <inspection_tool class="JSRemoveUnnecessaryParentheses" enabled="false" level="INFORMATION" enabled_by_default="false" />
84
+ <inspection_tool class="JSStringConcatenationToES6Template" enabled="false" level="INFORMATION" enabled_by_default="false" />
85
+ <inspection_tool class="JSSuspiciousEqPlus" enabled="false" level="WARNING" enabled_by_default="false" />
86
+ <inspection_tool class="JSSuspiciousNameCombination" enabled="false" level="WARNING" enabled_by_default="false">
87
+ <group names="x,width,left,right" />
88
+ <group names="y,height,top,bottom" />
89
+ <exclude classes="Math" />
90
+ </inspection_tool>
91
+ <inspection_tool class="JSSwitchVariableDeclarationIssue" enabled="false" level="WARNING" enabled_by_default="false" />
92
+ <inspection_tool class="JSTestFailedLine" enabled="false" level="WARNING" enabled_by_default="false" />
93
+ <inspection_tool class="JSTypeOfValues" enabled="false" level="WARNING" enabled_by_default="false" />
94
+ <inspection_tool class="JSUndeclaredVariable" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
95
+ <inspection_tool class="JSUndefinedPropertyAssignment" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
96
+ <inspection_tool class="JSUnfilteredForInLoop" enabled="false" level="WARNING" enabled_by_default="false" />
97
+ <inspection_tool class="JSUnnecessarySemicolon" enabled="false" level="WARNING" enabled_by_default="false" />
98
+ <inspection_tool class="JSUnreachableSwitchBranches" enabled="false" level="WARNING" enabled_by_default="false" />
99
+ <inspection_tool class="JSUnresolvedExtXType" enabled="false" level="WARNING" enabled_by_default="false" />
100
+ <inspection_tool class="JSUnresolvedFunction" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
101
+ <inspection_tool class="JSUnresolvedLibraryURL" enabled="false" level="WARNING" enabled_by_default="false" />
102
+ <inspection_tool class="JSUnresolvedVariable" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
103
+ <inspection_tool class="JSUnusedAssignment" enabled="false" level="WARNING" enabled_by_default="false" />
104
+ <inspection_tool class="JSUnusedGlobalSymbols" enabled="false" level="WARNING" enabled_by_default="false" />
105
+ <inspection_tool class="JSUnusedLocalSymbols" enabled="false" level="WARNING" enabled_by_default="false" />
106
+ <inspection_tool class="JSValidateJSDoc" enabled="false" level="WARNING" enabled_by_default="false" />
107
+ <inspection_tool class="JSValidateTypes" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
108
+ <inspection_tool class="JSXNamespaceValidation" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
109
+ <inspection_tool class="KarmaConfigFile" enabled="false" level="WARNING" enabled_by_default="false" />
110
+ <inspection_tool class="LoopStatementThatDoesntLoopJS" enabled="false" level="WARNING" enabled_by_default="false" />
111
+ <inspection_tool class="NodeCoreCodingAssistance" enabled="false" level="WARNING" enabled_by_default="false" />
112
+ <inspection_tool class="NodeModulesDependencies" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
113
+ <inspection_tool class="NpmUsedModulesInstalled" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
114
+ <inspection_tool class="PackageJsonMismatchedDependency" enabled="false" level="WARNING" enabled_by_default="false" />
115
+ <inspection_tool class="PointlessArithmeticExpressionJS" enabled="false" level="WARNING" enabled_by_default="false" />
116
+ <inspection_tool class="PointlessBooleanExpressionJS" enabled="false" level="WARNING" enabled_by_default="false" />
117
+ <inspection_tool class="ReservedWordUsedAsNameJS" enabled="false" level="WARNING" enabled_by_default="false" />
118
+ <inspection_tool class="ReturnFromFinallyBlockJS" enabled="false" level="WARNING" enabled_by_default="false" />
119
+ <inspection_tool class="ShiftOutOfRangeJS" enabled="false" level="WARNING" enabled_by_default="false" />
120
+ <inspection_tool class="SillyAssignmentJS" enabled="false" level="WARNING" enabled_by_default="false" />
121
+ <inspection_tool class="SuspiciousTypeOfGuard" enabled="false" level="WARNING" enabled_by_default="false" />
122
+ <inspection_tool class="ThisExpressionReferencesGlobalObjectJS" enabled="false" level="WARNING" enabled_by_default="false" />
123
+ <inspection_tool class="ThrowFromFinallyBlockJS" enabled="false" level="WARNING" enabled_by_default="false" />
124
+ <inspection_tool class="TrivialConditionalJS" enabled="false" level="WARNING" enabled_by_default="false" />
125
+ <inspection_tool class="TrivialIfJS" enabled="false" level="WARNING" enabled_by_default="false" />
126
+ <inspection_tool class="TypeScriptAbstractClassConstructorCanBeMadeProtected" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
127
+ <inspection_tool class="TypeScriptAccessibilityCheck" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
128
+ <inspection_tool class="TypeScriptCheckImport" enabled="false" level="ERROR" enabled_by_default="false" />
129
+ <inspection_tool class="TypeScriptConfig" enabled="false" level="WARNING" enabled_by_default="false" />
130
+ <inspection_tool class="TypeScriptDuplicateUnionOrIntersectionType" enabled="false" level="WARNING" enabled_by_default="false" />
131
+ <inspection_tool class="TypeScriptExplicitMemberType" enabled="false" level="INFORMATION" enabled_by_default="false" />
132
+ <inspection_tool class="TypeScriptFieldCanBeMadeReadonly" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
133
+ <inspection_tool class="TypeScriptLibrary" enabled="false" level="ERROR" enabled_by_default="false" />
134
+ <inspection_tool class="TypeScriptMissingAugmentationImport" enabled="false" level="INFORMATION" enabled_by_default="false" />
135
+ <inspection_tool class="TypeScriptMissingConfigOption" enabled="false" level="WARNING" enabled_by_default="false" />
136
+ <inspection_tool class="TypeScriptRedundantGenericType" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
137
+ <inspection_tool class="TypeScriptSmartCast" enabled="false" level="WARNING" enabled_by_default="false" />
138
+ <inspection_tool class="TypeScriptSuspiciousConstructorParameterAssignment" enabled="false" level="WARNING" enabled_by_default="false" />
139
+ <inspection_tool class="TypeScriptUMDGlobal" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
140
+ <inspection_tool class="TypeScriptUnresolvedFunction" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
141
+ <inspection_tool class="TypeScriptUnresolvedVariable" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
142
+ <inspection_tool class="TypeScriptValidateGenericTypes" enabled="false" level="ERROR" enabled_by_default="false" />
143
+ <inspection_tool class="TypeScriptValidateJSTypes" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
144
+ <inspection_tool class="TypeScriptValidateTypes" enabled="false" level="ERROR" enabled_by_default="false" />
145
+ <inspection_tool class="UnnecessaryContinueJS" enabled="false" level="WARNING" enabled_by_default="false" />
146
+ <inspection_tool class="UnnecessaryLabelJS" enabled="false" level="WARNING" enabled_by_default="false" />
147
+ <inspection_tool class="UnnecessaryLabelOnBreakStatementJS" enabled="false" level="WARNING" enabled_by_default="false" />
148
+ <inspection_tool class="UnnecessaryLabelOnContinueStatementJS" enabled="false" level="WARNING" enabled_by_default="false" />
149
+ <inspection_tool class="UnnecessaryLocalVariableJS" enabled="false" level="WARNING" enabled_by_default="false">
150
+ <option name="m_ignoreImmediatelyReturnedVariables" value="false" />
151
+ <option name="m_ignoreAnnotatedVariables" value="false" />
152
+ </inspection_tool>
153
+ <inspection_tool class="UnnecessaryReturnJS" enabled="false" level="WARNING" enabled_by_default="false" />
154
+ <inspection_tool class="UnreachableCodeJS" enabled="false" level="WARNING" enabled_by_default="false" />
155
+ <inspection_tool class="WebpackConfigHighlighting" enabled="false" level="WARNING" enabled_by_default="false" />
156
+ <inspection_tool class="WithStatementJS" enabled="false" level="WARNING" enabled_by_default="false" />
157
+ </profile>
158
+ </component>
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="EslintConfiguration">
4
+ <option name="fix-on-save" value="true" />
5
+ </component>
6
+ </project>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/rabbit.iml" filepath="$PROJECT_DIR$/.idea/rabbit.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="WEB_MODULE" version="4">
3
+ <component name="NewModuleRootManager">
4
+ <content url="file://$MODULE_DIR$">
5
+ <excludeFolder url="file://$MODULE_DIR$/.tmp" />
6
+ <excludeFolder url="file://$MODULE_DIR$/temp" />
7
+ <excludeFolder url="file://$MODULE_DIR$/tmp" />
8
+ </content>
9
+ <orderEntry type="inheritedJdk" />
10
+ <orderEntry type="sourceFolder" forTests="false" />
11
+ </component>
12
+ </module>
package/.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
+ </component>
6
+ </project>
@@ -0,0 +1,506 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="AutoImportSettings">
4
+ <option name="autoReloadType" value="SELECTIVE" />
5
+ </component>
6
+ <component name="BranchesTreeState">
7
+ <expand>
8
+ <path>
9
+ <item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
10
+ <item name="LOCAL_ROOT" type="e8cecc67:BranchNodeDescriptor" />
11
+ </path>
12
+ <path>
13
+ <item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
14
+ <item name="REMOTE_ROOT" type="e8cecc67:BranchNodeDescriptor" />
15
+ </path>
16
+ <path>
17
+ <item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
18
+ <item name="REMOTE_ROOT" type="e8cecc67:BranchNodeDescriptor" />
19
+ <item name="GROUP_NODE:origin" type="e8cecc67:BranchNodeDescriptor" />
20
+ </path>
21
+ <path>
22
+ <item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
23
+ <item name="REMOTE_ROOT" type="e8cecc67:BranchNodeDescriptor" />
24
+ <item name="GROUP_NODE:origin" type="e8cecc67:BranchNodeDescriptor" />
25
+ <item name="GROUP_NODE:dependabot" type="e8cecc67:BranchNodeDescriptor" />
26
+ </path>
27
+ <path>
28
+ <item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
29
+ <item name="REMOTE_ROOT" type="e8cecc67:BranchNodeDescriptor" />
30
+ <item name="GROUP_NODE:origin" type="e8cecc67:BranchNodeDescriptor" />
31
+ <item name="GROUP_NODE:dependabot" type="e8cecc67:BranchNodeDescriptor" />
32
+ <item name="GROUP_NODE:npm_and_yarn" type="e8cecc67:BranchNodeDescriptor" />
33
+ </path>
34
+ <path>
35
+ <item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
36
+ <item name="REMOTE_ROOT" type="e8cecc67:BranchNodeDescriptor" />
37
+ <item name="GROUP_NODE:origin" type="e8cecc67:BranchNodeDescriptor" />
38
+ <item name="GROUP_NODE:hot-fix" type="e8cecc67:BranchNodeDescriptor" />
39
+ </path>
40
+ </expand>
41
+ <select />
42
+ </component>
43
+ <component name="ChangeListManager">
44
+ <list default="true" id="1723b515-3530-42bb-82ff-6779499ab47b" name="Default Changelist" comment="">
45
+ <change beforePath="$PROJECT_DIR$/src/index.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/index.ts" afterDir="false" />
46
+ </list>
47
+ <option name="SHOW_DIALOG" value="false" />
48
+ <option name="HIGHLIGHT_CONFLICTS" value="true" />
49
+ <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
50
+ <option name="LAST_RESOLUTION" value="IGNORE" />
51
+ </component>
52
+ <component name="Git.Settings">
53
+ <option name="PREVIOUS_COMMIT_AUTHORS">
54
+ <list>
55
+ <option value="q" />
56
+ </list>
57
+ </option>
58
+ <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
59
+ <option name="RESET_MODE" value="HARD" />
60
+ </component>
61
+ <component name="ProjectId" id="1kkbq4cPpgJtXBPfswsGj3HyZyE" />
62
+ <component name="ProjectViewState">
63
+ <option name="compactDirectories" value="true" />
64
+ <option name="hideEmptyMiddlePackages" value="true" />
65
+ <option name="showLibraryContents" value="true" />
66
+ <option name="showMembers" value="true" />
67
+ </component>
68
+ <component name="PropertiesComponent">
69
+ <property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
70
+ <property name="WebServerToolWindowFactoryState" value="false" />
71
+ <property name="add_unversioned_files" value="$PROJECT_DIR$/node_modules/@types/amqp-connection-manager/index.d.ts" />
72
+ <property name="com.intellij.ide.scratch.LRUPopupBuilder$1/New Scratch File" value="ECMAScript 6" />
73
+ <property name="editorconfig.notification" value="null" />
74
+ <property name="last_opened_file_path" value="$PROJECT_DIR$" />
75
+ <property name="node.js.detected.package.eslint" value="true" />
76
+ <property name="node.js.detected.package.standard" value="true" />
77
+ <property name="node.js.path.for.package.eslint" value="project" />
78
+ <property name="node.js.path.for.package.standard" value="project" />
79
+ <property name="node.js.selected.package.eslint" value="(autodetect)" />
80
+ <property name="node.js.selected.package.standard" value="" />
81
+ <property name="nodejs.jest.jest_package" value="$PROJECT_DIR$/node_modules/jest" />
82
+ <property name="nodejs_interpreter_path" value="$USER_HOME$/.nvm/versions/node/v11.14.0/bin/node" />
83
+ <property name="nodejs_package_manager_path" value="npm" />
84
+ <property name="run.code.analysis.last.selected.profile" value="pProject Default" />
85
+ <property name="settings.editor.selected.configurable" value="settings.nodejs" />
86
+ <property name="ts.external.directory.path" value="$PROJECT_DIR$/node_modules/typescript/lib" />
87
+ <property name="vue.rearranger.settings.migration" value="true" />
88
+ </component>
89
+ <component name="RecentsManager">
90
+ <key name="MoveFile.RECENT_KEYS">
91
+ <recent name="$PROJECT_DIR$/.github/workflows" />
92
+ </key>
93
+ <key name="CopyFile.RECENT_KEYS">
94
+ <recent name="$PROJECT_DIR$" />
95
+ </key>
96
+ </component>
97
+ <component name="RunAnythingCache">
98
+ <option name="myCommands">
99
+ <command value="open common-types" />
100
+ <command value="open placement-ms" />
101
+ </option>
102
+ </component>
103
+ <component name="RunManager" selected="Node.js.scratch_116.es6">
104
+ <configuration name="all" type="JavaScriptTestRunnerJest">
105
+ <node-interpreter value="project" />
106
+ <node-options value="" />
107
+ <jest-package value="$PROJECT_DIR$/node_modules/jest" />
108
+ <working-dir value="$PROJECT_DIR$" />
109
+ <envs>
110
+ <env name="RABBITMQ_SERVICE_HOST" value="34.76.223.229:5672" />
111
+ </envs>
112
+ <scope-kind value="ALL" />
113
+ <method v="2" />
114
+ </configuration>
115
+ <configuration name="scratch_115.es6" type="NodeJSConfigurationType" temporary="true" nameIsGenerated="true" path-to-js-file="$APPLICATION_CONFIG_DIR$/scratches/scratch_115.es6" working-dir="$PROJECT_DIR$">
116
+ <method v="2" />
117
+ </configuration>
118
+ <configuration name="scratch_116.es6" type="NodeJSConfigurationType" temporary="true" nameIsGenerated="true" path-to-js-file="$APPLICATION_CONFIG_DIR$/scratches/scratch_116.es6" working-dir="$PROJECT_DIR$">
119
+ <method v="2" />
120
+ </configuration>
121
+ <configuration name="coverage" type="js.build_tools.npm" nameIsGenerated="true">
122
+ <package-json value="$PROJECT_DIR$/package.json" />
123
+ <command value="run" />
124
+ <scripts>
125
+ <script value="coverage" />
126
+ </scripts>
127
+ <node-interpreter value="project" />
128
+ <envs>
129
+ <env name="RABBITMQ_SERVICE_HOST" value="34.76.223.229:5672" />
130
+ </envs>
131
+ <method v="2" />
132
+ </configuration>
133
+ <configuration name="prepublish" type="js.build_tools.npm" temporary="true" nameIsGenerated="true">
134
+ <package-json value="$PROJECT_DIR$/package.json" />
135
+ <command value="run" />
136
+ <scripts>
137
+ <script value="prepublish" />
138
+ </scripts>
139
+ <node-interpreter value="project" />
140
+ <envs />
141
+ <method v="2" />
142
+ </configuration>
143
+ <configuration name="test-local" type="js.build_tools.npm" temporary="true">
144
+ <package-json value="$PROJECT_DIR$/package.json" />
145
+ <command value="run" />
146
+ <scripts>
147
+ <script value="test-local" />
148
+ </scripts>
149
+ <node-interpreter value="project" />
150
+ <envs />
151
+ <method v="2" />
152
+ </configuration>
153
+ <configuration name="test" type="js.build_tools.npm" temporary="true" nameIsGenerated="true">
154
+ <package-json value="$PROJECT_DIR$/package.json" />
155
+ <command value="run" />
156
+ <scripts>
157
+ <script value="test" />
158
+ </scripts>
159
+ <node-interpreter value="project" />
160
+ <envs />
161
+ <method v="2" />
162
+ </configuration>
163
+ <list>
164
+ <item itemvalue="Jest.all" />
165
+ <item itemvalue="Node.js.scratch_115.es6" />
166
+ <item itemvalue="Node.js.scratch_116.es6" />
167
+ <item itemvalue="npm.coverage" />
168
+ <item itemvalue="npm.prepublish" />
169
+ <item itemvalue="npm.test-local" />
170
+ <item itemvalue="npm.test" />
171
+ </list>
172
+ <recent_temporary>
173
+ <list>
174
+ <item itemvalue="Node.js.scratch_116.es6" />
175
+ <item itemvalue="Node.js.scratch_115.es6" />
176
+ <item itemvalue="npm.test-local" />
177
+ <item itemvalue="npm.test" />
178
+ <item itemvalue="npm.prepublish" />
179
+ </list>
180
+ </recent_temporary>
181
+ </component>
182
+ <component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
183
+ <component name="TaskManager">
184
+ <task active="true" id="Default" summary="Default task">
185
+ <changelist id="1723b515-3530-42bb-82ff-6779499ab47b" name="Default Changelist" comment="" />
186
+ <created>1606247725673</created>
187
+ <option name="number" value="Default" />
188
+ <option name="presentableId" value="Default" />
189
+ <updated>1606247725673</updated>
190
+ <workItem from="1606247727265" duration="13430000" />
191
+ <workItem from="1606382729664" duration="198000" />
192
+ <workItem from="1606829370658" duration="21577000" />
193
+ <workItem from="1606917300059" duration="14413000" />
194
+ <workItem from="1607078177282" duration="104000" />
195
+ <workItem from="1607078303904" duration="125000" />
196
+ <workItem from="1607078775174" duration="236000" />
197
+ <workItem from="1607079027954" duration="199000" />
198
+ <workItem from="1607079531155" duration="17000" />
199
+ <workItem from="1607079570023" duration="2327000" />
200
+ <workItem from="1607336805742" duration="5378000" />
201
+ <workItem from="1608730385550" duration="1504000" />
202
+ <workItem from="1608732614257" duration="1797000" />
203
+ <workItem from="1609075001438" duration="5775000" />
204
+ <workItem from="1609106672294" duration="594000" />
205
+ <workItem from="1609146731453" duration="21000" />
206
+ <workItem from="1609193609209" duration="1486000" />
207
+ <workItem from="1609629219943" duration="5228000" />
208
+ </task>
209
+ <task id="LOCAL-00001" summary="validate name before usage">
210
+ <created>1606375684964</created>
211
+ <option name="number" value="00001" />
212
+ <option name="presentableId" value="LOCAL-00001" />
213
+ <option name="project" value="LOCAL" />
214
+ <updated>1606375684964</updated>
215
+ </task>
216
+ <task id="LOCAL-00002" summary="adding timeout to publish">
217
+ <created>1606835517532</created>
218
+ <option name="number" value="00002" />
219
+ <option name="presentableId" value="LOCAL-00002" />
220
+ <option name="project" value="LOCAL" />
221
+ <updated>1606835517532</updated>
222
+ </task>
223
+ <task id="LOCAL-00003" summary="adding ci">
224
+ <created>1606835975767</created>
225
+ <option name="number" value="00003" />
226
+ <option name="presentableId" value="LOCAL-00003" />
227
+ <option name="project" value="LOCAL" />
228
+ <updated>1606835975767</updated>
229
+ </task>
230
+ <task id="LOCAL-00004" summary="linter project fix">
231
+ <created>1606836614988</created>
232
+ <option name="number" value="00004" />
233
+ <option name="presentableId" value="LOCAL-00004" />
234
+ <option name="project" value="LOCAL" />
235
+ <updated>1606836614988</updated>
236
+ </task>
237
+ <task id="LOCAL-00005" summary="fix">
238
+ <created>1606836726909</created>
239
+ <option name="number" value="00005" />
240
+ <option name="presentableId" value="LOCAL-00005" />
241
+ <option name="project" value="LOCAL" />
242
+ <updated>1606836726909</updated>
243
+ </task>
244
+ <task id="LOCAL-00006" summary="fix">
245
+ <created>1606836810770</created>
246
+ <option name="number" value="00006" />
247
+ <option name="presentableId" value="LOCAL-00006" />
248
+ <option name="project" value="LOCAL" />
249
+ <updated>1606836810770</updated>
250
+ </task>
251
+ <task id="LOCAL-00007" summary="speedup">
252
+ <created>1606836887964</created>
253
+ <option name="number" value="00007" />
254
+ <option name="presentableId" value="LOCAL-00007" />
255
+ <option name="project" value="LOCAL" />
256
+ <updated>1606836887964</updated>
257
+ </task>
258
+ <task id="LOCAL-00008" summary="added exchange name">
259
+ <created>1606896219788</created>
260
+ <option name="number" value="00008" />
261
+ <option name="presentableId" value="LOCAL-00008" />
262
+ <option name="project" value="LOCAL" />
263
+ <updated>1606896219788</updated>
264
+ </task>
265
+ <task id="LOCAL-00009" summary="fix">
266
+ <created>1606896520899</created>
267
+ <option name="number" value="00009" />
268
+ <option name="presentableId" value="LOCAL-00009" />
269
+ <option name="project" value="LOCAL" />
270
+ <updated>1606896520899</updated>
271
+ </task>
272
+ <task id="LOCAL-00010" summary="fix">
273
+ <created>1606896542182</created>
274
+ <option name="number" value="00010" />
275
+ <option name="presentableId" value="LOCAL-00010" />
276
+ <option name="project" value="LOCAL" />
277
+ <updated>1606896542182</updated>
278
+ </task>
279
+ <task id="LOCAL-00011" summary="tests">
280
+ <created>1606897178798</created>
281
+ <option name="number" value="00011" />
282
+ <option name="presentableId" value="LOCAL-00011" />
283
+ <option name="project" value="LOCAL" />
284
+ <updated>1606897178798</updated>
285
+ </task>
286
+ <task id="LOCAL-00012" summary="lint">
287
+ <created>1606897323855</created>
288
+ <option name="number" value="00012" />
289
+ <option name="presentableId" value="LOCAL-00012" />
290
+ <option name="project" value="LOCAL" />
291
+ <updated>1606897323855</updated>
292
+ </task>
293
+ <task id="LOCAL-00013" summary="more tests">
294
+ <created>1606899570854</created>
295
+ <option name="number" value="00013" />
296
+ <option name="presentableId" value="LOCAL-00013" />
297
+ <option name="project" value="LOCAL" />
298
+ <updated>1606899570854</updated>
299
+ </task>
300
+ <task id="LOCAL-00014" summary="more tests">
301
+ <created>1606901258614</created>
302
+ <option name="number" value="00014" />
303
+ <option name="presentableId" value="LOCAL-00014" />
304
+ <option name="project" value="LOCAL" />
305
+ <updated>1606901258614</updated>
306
+ </task>
307
+ <task id="LOCAL-00015" summary="fix rebase">
308
+ <created>1606903555798</created>
309
+ <option name="number" value="00015" />
310
+ <option name="presentableId" value="LOCAL-00015" />
311
+ <option name="project" value="LOCAL" />
312
+ <updated>1606903555798</updated>
313
+ </task>
314
+ <task id="LOCAL-00016" summary="remove dry run">
315
+ <created>1606904172238</created>
316
+ <option name="number" value="00016" />
317
+ <option name="presentableId" value="LOCAL-00016" />
318
+ <option name="project" value="LOCAL" />
319
+ <updated>1606904172238</updated>
320
+ </task>
321
+ <task id="LOCAL-00017" summary="fix_setup_rebased">
322
+ <created>1606904762864</created>
323
+ <option name="number" value="00017" />
324
+ <option name="presentableId" value="LOCAL-00017" />
325
+ <option name="project" value="LOCAL" />
326
+ <updated>1606904762864</updated>
327
+ </task>
328
+ <task id="LOCAL-00018" summary="trying to deps issue">
329
+ <created>1606915494203</created>
330
+ <option name="number" value="00018" />
331
+ <option name="presentableId" value="LOCAL-00018" />
332
+ <option name="project" value="LOCAL" />
333
+ <updated>1606915494203</updated>
334
+ </task>
335
+ <task id="LOCAL-00019" summary="fix">
336
+ <created>1606915709197</created>
337
+ <option name="number" value="00019" />
338
+ <option name="presentableId" value="LOCAL-00019" />
339
+ <option name="project" value="LOCAL" />
340
+ <updated>1606915709197</updated>
341
+ </task>
342
+ <task id="LOCAL-00020" summary="fix jest version">
343
+ <created>1606917673879</created>
344
+ <option name="number" value="00020" />
345
+ <option name="presentableId" value="LOCAL-00020" />
346
+ <option name="project" value="LOCAL" />
347
+ <updated>1606917673879</updated>
348
+ </task>
349
+ <task id="LOCAL-00021" summary="fix bug">
350
+ <created>1606991487518</created>
351
+ <option name="number" value="00021" />
352
+ <option name="presentableId" value="LOCAL-00021" />
353
+ <option name="project" value="LOCAL" />
354
+ <updated>1606991487518</updated>
355
+ </task>
356
+ <task id="LOCAL-00022" summary="lint">
357
+ <created>1606991581442</created>
358
+ <option name="number" value="00022" />
359
+ <option name="presentableId" value="LOCAL-00022" />
360
+ <option name="project" value="LOCAL" />
361
+ <updated>1606991581442</updated>
362
+ </task>
363
+ <task id="LOCAL-00023" summary="adding getQueueLength">
364
+ <created>1607002290463</created>
365
+ <option name="number" value="00023" />
366
+ <option name="presentableId" value="LOCAL-00023" />
367
+ <option name="project" value="LOCAL" />
368
+ <updated>1607002290463</updated>
369
+ </task>
370
+ <task id="LOCAL-00024" summary="tests">
371
+ <created>1607003599348</created>
372
+ <option name="number" value="00024" />
373
+ <option name="presentableId" value="LOCAL-00024" />
374
+ <option name="project" value="LOCAL" />
375
+ <updated>1607003599348</updated>
376
+ </task>
377
+ <task id="LOCAL-00025" summary="fix ts">
378
+ <created>1608732876582</created>
379
+ <option name="number" value="00025" />
380
+ <option name="presentableId" value="LOCAL-00025" />
381
+ <option name="project" value="LOCAL" />
382
+ <updated>1608732876582</updated>
383
+ </task>
384
+ <task id="LOCAL-00026" summary="fix ts">
385
+ <created>1608732889194</created>
386
+ <option name="number" value="00026" />
387
+ <option name="presentableId" value="LOCAL-00026" />
388
+ <option name="project" value="LOCAL" />
389
+ <updated>1608732889194</updated>
390
+ </task>
391
+ <task id="LOCAL-00027" summary="add dead msg ttl option">
392
+ <created>1609077111668</created>
393
+ <option name="number" value="00027" />
394
+ <option name="presentableId" value="LOCAL-00027" />
395
+ <option name="project" value="LOCAL" />
396
+ <updated>1609077111668</updated>
397
+ </task>
398
+ <task id="LOCAL-00028" summary="fix">
399
+ <created>1609077372036</created>
400
+ <option name="number" value="00028" />
401
+ <option name="presentableId" value="LOCAL-00028" />
402
+ <option name="project" value="LOCAL" />
403
+ <updated>1609077372036</updated>
404
+ </task>
405
+ <task id="LOCAL-00029" summary="consumeFromExchange">
406
+ <created>1609078082651</created>
407
+ <option name="number" value="00029" />
408
+ <option name="presentableId" value="LOCAL-00029" />
409
+ <option name="project" value="LOCAL" />
410
+ <updated>1609078082651</updated>
411
+ </task>
412
+ <task id="LOCAL-00030" summary="consumeFromExchange">
413
+ <created>1609078249310</created>
414
+ <option name="number" value="00030" />
415
+ <option name="presentableId" value="LOCAL-00030" />
416
+ <option name="project" value="LOCAL" />
417
+ <updated>1609078249310</updated>
418
+ </task>
419
+ <option name="localTasksCounter" value="31" />
420
+ <servers />
421
+ </component>
422
+ <component name="TypeScriptGeneratedFilesManager">
423
+ <option name="version" value="3" />
424
+ </component>
425
+ <component name="Vcs.Log.Tabs.Properties">
426
+ <option name="TAB_STATES">
427
+ <map>
428
+ <entry key="MAIN">
429
+ <value>
430
+ <State>
431
+ <option name="FILTERS">
432
+ <map>
433
+ <entry key="branch">
434
+ <value>
435
+ <list>
436
+ <option value="HEAD" />
437
+ </list>
438
+ </value>
439
+ </entry>
440
+ </map>
441
+ </option>
442
+ </State>
443
+ </value>
444
+ </entry>
445
+ </map>
446
+ </option>
447
+ <option name="RECENT_FILTERS">
448
+ <map>
449
+ <entry key="Branch">
450
+ <value>
451
+ <list>
452
+ <RecentGroup>
453
+ <option name="FILTER_VALUES">
454
+ <option value="HEAD" />
455
+ </option>
456
+ </RecentGroup>
457
+ <RecentGroup>
458
+ <option name="FILTER_VALUES">
459
+ <option value="origin/fix_setup_rebased" />
460
+ </option>
461
+ </RecentGroup>
462
+ <RecentGroup>
463
+ <option name="FILTER_VALUES">
464
+ <option value="origin/fix_setup" />
465
+ </option>
466
+ </RecentGroup>
467
+ </list>
468
+ </value>
469
+ </entry>
470
+ </map>
471
+ </option>
472
+ <option name="oldMeFiltersMigrated" value="true" />
473
+ </component>
474
+ <component name="VcsManagerConfiguration">
475
+ <MESSAGE value="validate name before usage" />
476
+ <MESSAGE value="adding timeout to publish" />
477
+ <MESSAGE value="adding ci" />
478
+ <MESSAGE value="linter project fix" />
479
+ <MESSAGE value="speedup" />
480
+ <MESSAGE value="added exchange name" />
481
+ <MESSAGE value="more tests" />
482
+ <MESSAGE value="fix rebase" />
483
+ <MESSAGE value="remove dry run" />
484
+ <MESSAGE value="fix_setup_rebased" />
485
+ <MESSAGE value="trying to deps issue" />
486
+ <MESSAGE value="fix jest version" />
487
+ <MESSAGE value="fix bug" />
488
+ <MESSAGE value="lint" />
489
+ <MESSAGE value="adding getQueueLength" />
490
+ <MESSAGE value="tests" />
491
+ <MESSAGE value="bind queue fix" />
492
+ <MESSAGE value="new trace" />
493
+ <MESSAGE value="fix ts" />
494
+ <MESSAGE value="add dead msg ttl option" />
495
+ <MESSAGE value="consumeFromExchange" />
496
+ <MESSAGE value="fix" />
497
+ <option name="LAST_COMMIT_MESSAGE" value="fix" />
498
+ </component>
499
+ <component name="XSLT-Support.FileAssociations.UIState">
500
+ <expand />
501
+ <select />
502
+ </component>
503
+ <component name="com.intellij.coverage.CoverageDataManagerImpl">
504
+ <SUITE FILE_PATH="coverage/rabbit$RabbitMQ_cant_publish_to_unknown_exchange.info" NAME="all Coverage Results" MODIFIED="1606901213465" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="JestJavaScriptTestRunnerCoverage" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" />
505
+ </component>
506
+ </project>
package/dist/index.d.ts CHANGED
@@ -1,32 +1,42 @@
1
1
  /// <reference types="node" />
2
+ import { Options } from 'amqplib';
2
3
  import { AmqpConnectionManager, ChannelWrapper } from 'amqp-connection-manager';
3
4
  import { EventEmitter } from 'events';
4
5
  interface ExchangesCache {
5
6
  [key: string]: any;
6
7
  }
8
+ export interface AfRabbitOptions {
9
+ reconnect: boolean;
10
+ }
7
11
  declare class RabbitMq {
8
12
  static parseMsg(msg: any): any;
9
13
  static validateName(type: string, name: string): void;
14
+ static consumeOptions(options?: any): {
15
+ limit: number;
16
+ deadMessageTtl: number;
17
+ };
10
18
  PUBLISH_TIMEOUT: number;
11
19
  PUBLISH_ERROR_MSG: string;
12
20
  DISCONNECT_MSG: string;
21
+ RESCONNECT_MSG: string;
13
22
  channel: ChannelWrapper | null;
14
23
  connection: AmqpConnectionManager | null;
15
24
  em: EventEmitter;
16
25
  creatingConnection: boolean;
17
26
  exchanges: ExchangesCache;
18
- constructor();
27
+ options: AfRabbitOptions | undefined;
28
+ constructor(options?: AfRabbitOptions);
19
29
  ack: (msg: any) => Promise<void>;
20
- nack: (queue: string) => (msg: any, retries: number) => Promise<void>;
30
+ nack: (queue: string, options?: Options.AssertQueue | undefined) => (msg: any, retries: number) => Promise<void>;
21
31
  getConnection(): Promise<AmqpConnectionManager>;
22
32
  assertChannel(): Promise<ChannelWrapper>;
23
33
  assertExchange(exchangeName: string, options?: any): Promise<any>;
24
34
  getQueueLength(queue: string): Promise<any>;
25
35
  bindQueue(queue: string, exchange: string): Promise<any>;
26
- assertQueue(queue: string, options?: any): Promise<void>;
36
+ assertQueue(queue: string, options?: Options.AssertQueue): Promise<void>;
27
37
  consume(queue: string, callback: (msg: any, ack: Function, nack: Function) => any, options?: any): Promise<void>;
28
38
  consumeFromExchange(queue: string, exchange: string, callback: (msg: any, ack: Function, nack: Function) => any, options?: any): Promise<void>;
29
39
  publish(exchange: string, content: any): Promise<unknown>;
30
- sendToQueue(queue: string, content: any): Promise<void>;
40
+ sendToQueue(queue: string, content: any, options?: any): Promise<void>;
31
41
  }
32
42
  export default RabbitMq;
package/dist/index.js CHANGED
@@ -41,25 +41,29 @@ const rabbitError_1 = __importDefault(require("./rabbitError"));
41
41
  const assertExchangeFanout = (c, exchangeName) => c.assertExchange(exchangeName, 'fanout');
42
42
  const connectionCreatedConst = 'connectionCreated';
43
43
  class RabbitMq {
44
- constructor() {
44
+ constructor(options) {
45
45
  this.PUBLISH_TIMEOUT = Number(process.env.RABBITMQ_PUBLISH_TIMEOUT) || 60000;
46
46
  this.PUBLISH_ERROR_MSG = `rabbit: publish timeout(${this.PUBLISH_TIMEOUT}ms) has pass, exchange: `;
47
47
  this.DISCONNECT_MSG = 'rabbit: connection disconnect';
48
+ this.RESCONNECT_MSG = 'rabbit: reconnecting';
48
49
  this.ack = (msg) => __awaiter(this, void 0, void 0, function* () {
49
50
  if (this.channel) {
50
51
  yield this.channel.ack(msg);
51
52
  }
52
53
  });
53
- this.nack = (queue) => (msg, retries) => __awaiter(this, void 0, void 0, function* () {
54
+ this.nack = (queue, options) => (msg, retries) => __awaiter(this, void 0, void 0, function* () {
55
+ if (options === null || options === void 0 ? void 0 : options.messageTtl) {
56
+ msg.content['x-message-ttl'] = options.messageTtl;
57
+ }
54
58
  if (this.channel) {
55
59
  if (!msg.content['x-retry-count'] || msg.content['x-retry-count'] <= retries) {
56
60
  msg.content['x-retry-count'] = msg.content['x-retry-count'] ? msg.content['x-retry-count'] + 1 : 1;
57
- yield this.sendToQueue(queue, msg.content);
61
+ yield this.sendToQueue(queue, msg.content, options);
58
62
  }
59
63
  else {
60
64
  const deadQueue = `${queue}-dead`;
61
- yield this.assertQueue(deadQueue);
62
- yield this.sendToQueue(deadQueue, msg.content);
65
+ yield this.assertQueue(deadQueue, options);
66
+ yield this.sendToQueue(deadQueue, msg.content, options);
63
67
  }
64
68
  yield this.channel.ack(msg);
65
69
  }
@@ -69,6 +73,7 @@ class RabbitMq {
69
73
  this.connection = null;
70
74
  this.creatingConnection = false;
71
75
  this.exchanges = {};
76
+ this.options = options;
72
77
  }
73
78
  static parseMsg(msg) {
74
79
  let { content } = msg;
@@ -84,6 +89,9 @@ class RabbitMq {
84
89
  throw new rabbitError_1.default(`error while using ${type} with no name`);
85
90
  }
86
91
  }
92
+ static consumeOptions(options) {
93
+ return Object.assign({ limit: 1, deadMessageTtl: null }, options);
94
+ }
87
95
  getConnection() {
88
96
  return __awaiter(this, void 0, void 0, function* () {
89
97
  return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
@@ -98,7 +106,16 @@ class RabbitMq {
98
106
  const host = process.env.RABBITMQ_SERVICE_HOST || '';
99
107
  const connection = yield amqp_connection_manager_1.connect([`amqp://${host}`]);
100
108
  this.connection = connection;
101
- this.connection.on('disconnect', ({ err }) => console.error(`${this.DISCONNECT_MSG}${err && ` - ${err}`}`));
109
+ this.connection.on('disconnect', ({ err }) => {
110
+ var _a;
111
+ if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.reconnect) {
112
+ console.error(`${this.RESCONNECT_MSG}${err && ` - ${err}`}`);
113
+ this.connection = null;
114
+ }
115
+ else {
116
+ console.error(`${this.DISCONNECT_MSG}${err && ` - ${err}`}`);
117
+ }
118
+ });
102
119
  this.creatingConnection = false;
103
120
  this.em.emit(connectionCreatedConst, connection);
104
121
  resolve(connection);
@@ -156,13 +173,13 @@ class RabbitMq {
156
173
  return __awaiter(this, void 0, void 0, function* () {
157
174
  RabbitMq.validateName('queue', queue);
158
175
  const channel = yield this.assertChannel();
159
- return channel.addSetup((c) => c.assertQueue(queue));
176
+ return channel.addSetup((c) => c.assertQueue(queue, options));
160
177
  });
161
178
  }
162
179
  consume(queue, callback, options) {
163
180
  return __awaiter(this, void 0, void 0, function* () {
164
181
  RabbitMq.validateName('queue', queue);
165
- const { limit } = (options && options.limit) ? options : { limit: 1 };
182
+ const { limit, deadMessageTtl } = RabbitMq.consumeOptions(options);
166
183
  const channel = yield this.assertChannel();
167
184
  return channel.addSetup((c) => __awaiter(this, void 0, void 0, function* () {
168
185
  yield c.assertQueue(queue);
@@ -170,7 +187,7 @@ class RabbitMq {
170
187
  return Promise.all([
171
188
  c.consume(queue, (msg) => {
172
189
  outbreak_1.newTrace(outbreak_1.traceTypes.RABBIT);
173
- callback(RabbitMq.parseMsg(msg), this.ack, this.nack(queue));
190
+ callback(RabbitMq.parseMsg(msg), this.ack, this.nack(queue, { messageTtl: deadMessageTtl }));
174
191
  }),
175
192
  ]);
176
193
  }));
@@ -180,7 +197,7 @@ class RabbitMq {
180
197
  return __awaiter(this, void 0, void 0, function* () {
181
198
  RabbitMq.validateName('queue', queue);
182
199
  RabbitMq.validateName('exchange', exchange);
183
- const { limit } = (options && options.limit) ? options : { limit: 1 };
200
+ const { limit, deadMessageTtl } = RabbitMq.consumeOptions(options);
184
201
  const channel = yield this.assertChannel();
185
202
  return channel.addSetup((c) => __awaiter(this, void 0, void 0, function* () {
186
203
  const assertExchange = yield assertExchangeFanout(c, exchange);
@@ -191,7 +208,7 @@ class RabbitMq {
191
208
  c.bindQueue(queue, exchange, ''),
192
209
  c.consume(queue, (msg) => {
193
210
  outbreak_1.newTrace(outbreak_1.traceTypes.RABBIT);
194
- callback(RabbitMq.parseMsg(msg), this.ack, this.nack(queue));
211
+ callback(RabbitMq.parseMsg(msg), this.ack, this.nack(queue, { messageTtl: deadMessageTtl }));
195
212
  }),
196
213
  ]);
197
214
  }));
@@ -208,11 +225,11 @@ class RabbitMq {
208
225
  })).timeout(this.PUBLISH_TIMEOUT, `${this.PUBLISH_ERROR_MSG}${exchange}`);
209
226
  });
210
227
  }
211
- sendToQueue(queue, content) {
228
+ sendToQueue(queue, content, options) {
212
229
  return __awaiter(this, void 0, void 0, function* () {
213
230
  RabbitMq.validateName('queue', queue);
214
231
  const channel = yield this.assertChannel();
215
- yield this.assertQueue(queue);
232
+ yield this.assertQueue(queue, options);
216
233
  return channel.sendToQueue(queue, Buffer.from(JSON.stringify(content)));
217
234
  });
218
235
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autofleet/rabbit",
3
- "version": "1.5.6",
3
+ "version": "1.5.7-2",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/src/index.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /* eslint-disable @typescript-eslint/ban-ts-comment,@typescript-eslint/ban-types,@typescript-eslint/no-unused-vars,consistent-return,no-async-promise-executor,no-param-reassign,no-empty */
2
2
  // eslint-disable-next-line max-classes-per-file
3
3
  import * as bluebird from 'bluebird';
4
- import { ConfirmChannel } from 'amqplib';
4
+ import { ConfirmChannel, Options } from 'amqplib';
5
5
  import { AmqpConnectionManager, ChannelWrapper, connect } from 'amqp-connection-manager';
6
6
  import { EventEmitter } from 'events';
7
7
  import { newTrace, traceTypes } from '@autofleet/outbreak';
@@ -11,6 +11,10 @@ interface ExchangesCache {
11
11
  [key: string]: any
12
12
  }
13
13
 
14
+ export interface AfRabbitOptions {
15
+ reconnect: boolean
16
+ }
17
+
14
18
  const assertExchangeFanout = (c: any, exchangeName: string) => c.assertExchange(exchangeName, 'fanout');
15
19
 
16
20
  const connectionCreatedConst = 'connectionCreated';
@@ -35,12 +39,22 @@ class RabbitMq {
35
39
  }
36
40
  }
37
41
 
42
+ static consumeOptions(options?: any): {limit: number, deadMessageTtl: number} {
43
+ return {
44
+ limit: 1,
45
+ deadMessageTtl: null,
46
+ ...options,
47
+ };
48
+ }
49
+
38
50
  PUBLISH_TIMEOUT = Number(process.env.RABBITMQ_PUBLISH_TIMEOUT) || 60000;
39
51
 
40
52
  PUBLISH_ERROR_MSG = `rabbit: publish timeout(${this.PUBLISH_TIMEOUT}ms) has pass, exchange: `;
41
53
 
42
54
  DISCONNECT_MSG = 'rabbit: connection disconnect';
43
55
 
56
+ RESCONNECT_MSG = 'rabbit: reconnecting';
57
+
44
58
  channel: ChannelWrapper | null;
45
59
 
46
60
  connection: AmqpConnectionManager | null;
@@ -51,12 +65,15 @@ class RabbitMq {
51
65
 
52
66
  exchanges: ExchangesCache;
53
67
 
54
- constructor() {
68
+ options: AfRabbitOptions | undefined;
69
+
70
+ constructor(options?: AfRabbitOptions) {
55
71
  this.em = new EventEmitter();
56
72
  this.channel = null;
57
73
  this.connection = null;
58
74
  this.creatingConnection = false;
59
75
  this.exchanges = {};
76
+ this.options = options;
60
77
  }
61
78
 
62
79
  public ack = async (msg: any) => {
@@ -65,15 +82,18 @@ class RabbitMq {
65
82
  }
66
83
  }
67
84
 
68
- public nack = (queue: string) => async (msg: any, retries: number) => {
85
+ public nack = (queue: string, options?: Options.AssertQueue) => async (msg: any, retries: number) => {
86
+ if (options?.messageTtl) {
87
+ msg.content['x-message-ttl'] = options.messageTtl;
88
+ }
69
89
  if (this.channel) {
70
90
  if (!msg.content['x-retry-count'] || msg.content['x-retry-count'] <= retries) {
71
91
  msg.content['x-retry-count'] = msg.content['x-retry-count'] ? msg.content['x-retry-count'] + 1 : 1;
72
- await this.sendToQueue(queue, msg.content);
92
+ await this.sendToQueue(queue, msg.content, options);
73
93
  } else {
74
94
  const deadQueue = `${queue}-dead`;
75
- await this.assertQueue(deadQueue);
76
- await this.sendToQueue(deadQueue, msg.content);
95
+ await this.assertQueue(deadQueue, options);
96
+ await this.sendToQueue(deadQueue, msg.content, options);
77
97
  }
78
98
  await this.channel.ack(msg);
79
99
  }
@@ -93,7 +113,14 @@ class RabbitMq {
93
113
  const connection: AmqpConnectionManager = await connect([`amqp://${host}`]);
94
114
  this.connection = connection;
95
115
  this.connection.on('disconnect',
96
- ({ err }) => console.error(`${this.DISCONNECT_MSG}${err && ` - ${err}`}`));
116
+ ({ err }) => {
117
+ if (this.options?.reconnect) {
118
+ console.error(`${this.RESCONNECT_MSG}${err && ` - ${err}`}`);
119
+ this.connection = null;
120
+ } else {
121
+ console.error(`${this.DISCONNECT_MSG}${err && ` - ${err}`}`);
122
+ }
123
+ });
97
124
  this.creatingConnection = false;
98
125
  this.em.emit(connectionCreatedConst, connection);
99
126
  resolve(connection);
@@ -144,15 +171,15 @@ class RabbitMq {
144
171
  return channel.bindQueue(queue, exchange, '');
145
172
  }
146
173
 
147
- async assertQueue(queue: string, options?: any) {
174
+ async assertQueue(queue: string, options?: Options.AssertQueue) {
148
175
  RabbitMq.validateName('queue', queue);
149
176
  const channel: ChannelWrapper = await this.assertChannel();
150
- return channel.addSetup((c: ConfirmChannel) => c.assertQueue(queue));
177
+ return channel.addSetup((c: ConfirmChannel) => c.assertQueue(queue, options));
151
178
  }
152
179
 
153
180
  async consume(queue: string, callback: (msg: any, ack: Function, nack: Function) => any, options?: any) {
154
181
  RabbitMq.validateName('queue', queue);
155
- const { limit } = (options && options.limit) ? options : { limit: 1 };
182
+ const { limit, deadMessageTtl } = RabbitMq.consumeOptions(options);
156
183
  const channel: ChannelWrapper = await this.assertChannel();
157
184
  return channel.addSetup(async (c: ConfirmChannel) => {
158
185
  await c.assertQueue(queue);
@@ -162,7 +189,7 @@ class RabbitMq {
162
189
  queue,
163
190
  (msg: any) => {
164
191
  newTrace(traceTypes.RABBIT);
165
- callback(RabbitMq.parseMsg(msg), this.ack, this.nack(queue));
192
+ callback(RabbitMq.parseMsg(msg), this.ack, this.nack(queue, { messageTtl: deadMessageTtl }));
166
193
  },
167
194
  ),
168
195
  ]);
@@ -172,7 +199,7 @@ class RabbitMq {
172
199
  async consumeFromExchange(queue: string, exchange: string, callback: (msg: any, ack: Function, nack: Function) => any, options?: any) {
173
200
  RabbitMq.validateName('queue', queue);
174
201
  RabbitMq.validateName('exchange', exchange);
175
- const { limit } = (options && options.limit) ? options : { limit: 1 };
202
+ const { limit, deadMessageTtl } = RabbitMq.consumeOptions(options);
176
203
  const channel: ChannelWrapper = await this.assertChannel();
177
204
 
178
205
  return channel.addSetup(async (c: ConfirmChannel) => {
@@ -186,7 +213,7 @@ class RabbitMq {
186
213
  queue,
187
214
  (msg: any) => {
188
215
  newTrace(traceTypes.RABBIT);
189
- callback(RabbitMq.parseMsg(msg), this.ack, this.nack(queue));
216
+ callback(RabbitMq.parseMsg(msg), this.ack, this.nack(queue, { messageTtl: deadMessageTtl }));
190
217
  },
191
218
  ),
192
219
  ]);
@@ -203,10 +230,10 @@ class RabbitMq {
203
230
  }).timeout(this.PUBLISH_TIMEOUT, `${this.PUBLISH_ERROR_MSG}${exchange}`);
204
231
  }
205
232
 
206
- async sendToQueue(queue: string, content: any) {
233
+ async sendToQueue(queue: string, content: any, options?: any) {
207
234
  RabbitMq.validateName('queue', queue);
208
235
  const channel: ChannelWrapper = await this.assertChannel();
209
- await this.assertQueue(queue);
236
+ await this.assertQueue(queue, options);
210
237
  return channel.sendToQueue(queue, Buffer.from(JSON.stringify(content)));
211
238
  }
212
239
  }