{ "version": 3, "sources": ["../javascripts/actions/list.ts"], "sourcesContent": ["import type { Dispatch } from '@reduxjs/toolkit';\n\nimport type { ElasticSearchResponse } from '../@types/ElasticSearchResponse';\nimport type { WaykeList } from '../@types/List';\nimport type { BaseAction } from '../@types/actions';\nimport * as http from '../Http';\nimport { buildGetRequest } from '../Http/requestTemplates';\nimport type * as promises from '../utils/promises';\nimport requestCache from '../utils/request-cache';\n\nexport const REQ_LISTS = 'REQ/LISTS';\nexport const RCV_LISTS = 'RCV/LISTS';\nexport const ERR_LISTS = 'ERR/LISTS';\ntype REQ_LISTS_TYPE = BaseAction;\ntype RCV_LISTS_TYPE = BaseAction & {\n response: ElasticSearchResponse;\n};\ntype ERR_LISTS_TYPE = BaseAction;\n\nexport const REQ_LIST_HITS = 'REQ/LIST_HITS';\nexport const RCV_LIST_HITS = 'RCV/LIST_HITS';\nexport const ERR_LIST_HITS = 'ERR/LIST_HITS';\ntype REQ_LIST_HITS_TYPE = BaseAction;\ntype RCV_LIST_HITS_TYPE = BaseAction & {\n response: { [key: string]: number | undefined };\n};\ntype ERR_LIST_HITS_TYPE = BaseAction;\n\nexport type LIST_ACTION =\n | REQ_LISTS_TYPE\n | RCV_LISTS_TYPE\n | ERR_LISTS_TYPE\n | REQ_LIST_HITS_TYPE\n | RCV_LIST_HITS_TYPE\n | ERR_LIST_HITS_TYPE;\n\nexport const all = () => async (dispatch: Dispatch) => {\n if (requestCache.isPending(REQ_LISTS)) {\n return;\n }\n\n requestCache.isPending(REQ_LISTS, true);\n\n try {\n dispatch({ type: REQ_LISTS });\n const response = await http.json>(\n '/api/list',\n buildGetRequest(),\n );\n dispatch({ type: RCV_LISTS, response: response.response });\n } catch (error) {\n const _isCancelled = (error as { isCancelled: promises.CancelablePromiseRejection })\n .isCancelled;\n if (!_isCancelled) {\n dispatch({\n type: ERR_LISTS,\n });\n }\n }\n};\n\nexport const getListHits = () => async (dispatch: Dispatch) => {\n if (requestCache.isPending(REQ_LIST_HITS)) {\n return;\n }\n\n requestCache.isPending(REQ_LIST_HITS, true);\n\n try {\n dispatch({ type: REQ_LIST_HITS });\n const response = await http.json>(\n '/api/list/hits',\n buildGetRequest(),\n );\n dispatch({ type: RCV_LIST_HITS, response: response.response });\n } catch (error) {\n const _isCancelled = (error as { isCancelled: promises.CancelablePromiseRejection })\n .isCancelled;\n if (!_isCancelled) {\n dispatch({\n type: ERR_LIST_HITS,\n });\n }\n }\n};\n"], "mappings": "qGAUO,IAAMA,EAAY,YACZC,EAAY,YACZC,EAAY,YAOZC,EAAgB,gBAChBC,EAAgB,gBAChBC,EAAgB,gBAehBC,EAAM,IAAM,MAAOC,GAAuB,CACrD,GAAI,CAAAC,EAAa,UAAUR,CAAS,EAIpC,CAAAQ,EAAa,UAAUR,EAAW,EAAI,EAEtC,GAAI,CACFO,EAAS,CAAE,KAAMP,CAAU,CAAC,EAC5B,IAAMS,EAAW,MAAWC,EAC1B,YACAC,EAAgB,CAClB,EACAJ,EAAS,CAAE,KAAMN,EAAW,SAAUQ,EAAS,QAAS,CAAC,CAC3D,OAASG,EAAO,CACQA,EACnB,aAEDL,EAAS,CACP,KAAML,CACR,CAAC,CAEL,EACF,EAEaW,EAAc,IAAM,MAAON,GAAuB,CAC7D,GAAI,CAAAC,EAAa,UAAUL,CAAa,EAIxC,CAAAK,EAAa,UAAUL,EAAe,EAAI,EAE1C,GAAI,CACFI,EAAS,CAAE,KAAMJ,CAAc,CAAC,EAChC,IAAMM,EAAW,MAAWC,EAC1B,iBACAC,EAAgB,CAClB,EACAJ,EAAS,CAAE,KAAMH,EAAe,SAAUK,EAAS,QAAS,CAAC,CAC/D,OAASG,EAAO,CACQA,EACnB,aAEDL,EAAS,CACP,KAAMF,CACR,CAAC,CAEL,EACF", "names": ["REQ_LISTS", "RCV_LISTS", "ERR_LISTS", "REQ_LIST_HITS", "RCV_LIST_HITS", "ERR_LIST_HITS", "all", "dispatch", "request_cache_default", "response", "json", "buildGetRequest", "error", "getListHits"] }