1 | {"version":3,"file":"createErrorInfo.js","names":["_err","_interopRequireDefault","require","_keyBy","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","createErrorInfo","errors","undefined","errorsByCode","keyBy","defaultError","nack","telegram","redelivered","log","err","code","Err","getCode","error","getJSON","_default","exports"],"sources":["../src/createErrorInfo.js"],"sourcesContent":["import Err from '@lskjs/err';\nimport keyBy from 'lodash/keyBy';\n\nexport function createErrorInfo(errors = []) {\n const errorsByCode = keyBy(errors, 'code');\n const defaultError = {\n nack: 1,\n telegram: 1,\n redelivered: 1,\n log: 'error',\n };\n\n return function (err) {\n const code = Err.getCode(err);\n const error = errorsByCode[code] || {};\n return {\n ...defaultError,\n ...error,\n ...Err.getJSON(err),\n };\n };\n}\n\nexport default createErrorInfo;\n"],"mappings":";;;;;;;;;AAAA,IAAAA,IAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,sBAAA,CAAAC,OAAA;AAAiC,SAAAE,QAAAC,MAAA,EAAAC,cAAA,QAAAC,IAAA,GAAAC,MAAA,CAAAD,IAAA,CAAAF,MAAA,OAAAG,MAAA,CAAAC,qBAAA,QAAAC,OAAA,GAAAF,MAAA,CAAAC,qBAAA,CAAAJ,MAAA,GAAAC,cAAA,KAAAI,OAAA,GAAAA,OAAA,CAAAC,MAAA,WAAAC,GAAA,WAAAJ,MAAA,CAAAK,wBAAA,CAAAR,MAAA,EAAAO,GAAA,EAAAE,UAAA,OAAAP,IAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,IAAA,EAAAG,OAAA,YAAAH,IAAA;AAAA,SAAAU,cAAAC,MAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAF,CAAA,UAAAG,MAAA,WAAAF,SAAA,CAAAD,CAAA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