diff --git a/package-lock.json b/package-lock.json index baa3205a234..80e47519f87 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14826,6 +14826,8 @@ }, "node_modules/npm/node_modules/@isaacs/cliui/node_modules/string-width": { "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", "dev": true, "inBundle": true, "license": "MIT", @@ -14860,8 +14862,6 @@ }, "node_modules/npm/node_modules/@isaacs/string-locale-compare": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@isaacs/string-locale-compare/-/string-locale-compare-1.1.0.tgz", - "integrity": "sha512-SQ7Kzhh9+D+ZW9MA0zkYv3VXhIDNx+LzM6EJ+/65I3QY+enU6Itte7E5XX7EWrqLW2FN4n06GWzBnPoC3th2aQ==", "dev": true, "inBundle": true, "license": "ISC" @@ -14934,8 +14934,6 @@ }, "node_modules/npm/node_modules/@npmcli/disparity-colors": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@npmcli/disparity-colors/-/disparity-colors-3.0.0.tgz", - "integrity": "sha512-5R/z157/f20Fi0Ou4ZttL51V0xz0EdPEOauFtPCEYOLInDBRCj1/TxOJ5aGTrtShxEshN2d+hXb9ZKSi5RLBcg==", "dev": true, "inBundle": true, "license": "ISC", @@ -14948,8 +14946,6 @@ }, "node_modules/npm/node_modules/@npmcli/fs": { "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@npmcli/fs/-/fs-3.1.0.tgz", - "integrity": "sha512-7kZUAaLscfgbwBQRbvdMYaZOWyMEcPTH/tJjnyAWJ/dvvs9Ef+CERx/qJb9GExJpl1qipaDGn7KqHnFGGixd0w==", "dev": true, "inBundle": true, "license": "ISC", @@ -14962,8 +14958,6 @@ }, "node_modules/npm/node_modules/@npmcli/git": { "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@npmcli/git/-/git-4.1.0.tgz", - "integrity": "sha512-9hwoB3gStVfa0N31ymBmrX+GuDGdVA/QWShZVqE0HK2Af+7QGGrCTbZia/SW0ImUTjTne7SP91qxDmtXvDHRPQ==", "dev": true, "inBundle": true, "license": "ISC", @@ -14983,8 +14977,6 @@ }, "node_modules/npm/node_modules/@npmcli/installed-package-contents": { "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@npmcli/installed-package-contents/-/installed-package-contents-2.0.2.tgz", - "integrity": "sha512-xACzLPhnfD51GKvTOOuNX2/V4G4mz9/1I2MfDoye9kBM3RYe5g2YbscsaGoTlaWqkxeiapBWyseULVKpSVHtKQ==", "dev": true, "inBundle": true, "license": "ISC", @@ -15001,8 +14993,6 @@ }, "node_modules/npm/node_modules/@npmcli/map-workspaces": { "version": "3.0.4", - "resolved": "https://registry.npmjs.org/@npmcli/map-workspaces/-/map-workspaces-3.0.4.tgz", - "integrity": "sha512-Z0TbvXkRbacjFFLpVpV0e2mheCh+WzQpcqL+4xp49uNJOxOnIAPZyXtUxZ5Qn3QBTGKA11Exjd9a5411rBrhDg==", "dev": true, "inBundle": true, "license": "ISC", @@ -15018,8 +15008,6 @@ }, "node_modules/npm/node_modules/@npmcli/metavuln-calculator": { "version": "5.0.1", - "resolved": "https://registry.npmjs.org/@npmcli/metavuln-calculator/-/metavuln-calculator-5.0.1.tgz", - "integrity": "sha512-qb8Q9wIIlEPj3WeA1Lba91R4ZboPL0uspzV0F9uwP+9AYMVB2zOoa7Pbk12g6D2NHAinSbHh6QYmGuRyHZ874Q==", "dev": true, "inBundle": true, "license": "ISC", @@ -15035,8 +15023,6 @@ }, "node_modules/npm/node_modules/@npmcli/name-from-folder": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@npmcli/name-from-folder/-/name-from-folder-2.0.0.tgz", - "integrity": "sha512-pwK+BfEBZJbKdNYpHHRTNBwBoqrN/iIMO0AiGvYsp3Hoaq0WbgGSWQR6SCldZovoDpY3yje5lkFUe6gsDgJ2vg==", "dev": true, "inBundle": true, "license": "ISC", @@ -15046,8 +15032,6 @@ }, "node_modules/npm/node_modules/@npmcli/node-gyp": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@npmcli/node-gyp/-/node-gyp-3.0.0.tgz", - "integrity": "sha512-gp8pRXC2oOxu0DUE1/M3bYtb1b3/DbJ5aM113+XJBgfXdussRAsX0YOrOhdd8WvnAR6auDBvJomGAkLKA5ydxA==", "dev": true, "inBundle": true, "license": "ISC", @@ -15057,8 +15041,6 @@ }, "node_modules/npm/node_modules/@npmcli/package-json": { "version": "4.0.1", - "resolved": "https://registry.npmjs.org/@npmcli/package-json/-/package-json-4.0.1.tgz", - "integrity": "sha512-lRCEGdHZomFsURroh522YvA/2cVb9oPIJrjHanCJZkiasz1BzcnLr3tBJhlV7S86MBJBuAQ33is2D60YitZL2Q==", "dev": true, "inBundle": true, "license": "ISC", @@ -15077,8 +15059,6 @@ }, "node_modules/npm/node_modules/@npmcli/promise-spawn": { "version": "6.0.2", - "resolved": "https://registry.npmjs.org/@npmcli/promise-spawn/-/promise-spawn-6.0.2.tgz", - "integrity": "sha512-gGq0NJkIGSwdbUt4yhdF8ZrmkGKVz9vAdVzpOfnom+V8PLSmSOVhZwbNvZZS1EYcJN5hzzKBxmmVVAInM6HQLg==", "dev": true, "inBundle": true, "license": "ISC", @@ -15103,8 +15083,6 @@ }, "node_modules/npm/node_modules/@npmcli/run-script": { "version": "6.0.2", - "resolved": "https://registry.npmjs.org/@npmcli/run-script/-/run-script-6.0.2.tgz", - "integrity": "sha512-NCcr1uQo1k5U+SYlnIrbAh3cxy+OQT1VtqiAbxdymSlptbzBb62AjH2xXgjNCoP073hoa1CfCAcwoZ8k96C4nA==", "dev": true, "inBundle": true, "license": "ISC", @@ -15155,8 +15133,6 @@ }, "node_modules/npm/node_modules/@tootallnate/once": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-2.0.0.tgz", - "integrity": "sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==", "dev": true, "inBundle": true, "license": "MIT", @@ -15166,8 +15142,6 @@ }, "node_modules/npm/node_modules/@tufjs/canonical-json": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@tufjs/canonical-json/-/canonical-json-1.0.0.tgz", - "integrity": "sha512-QTnf++uxunWvG2z3UFNzAoQPHxnSXOwtaI3iJ+AohhV+5vONuArPjJE7aPXPVXfXJsqrVbZBu9b81AJoSd09IQ==", "dev": true, "inBundle": true, "license": "MIT", @@ -15177,8 +15151,6 @@ }, "node_modules/npm/node_modules/@tufjs/models": { "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@tufjs/models/-/models-1.0.4.tgz", - "integrity": "sha512-qaGV9ltJP0EO25YfFUPhxRVK0evXFIAGicsVXuRim4Ed9cjPxYhNnNJ49SFmbeLgtxpslIkX317IgpfcHPVj/A==", "dev": true, "inBundle": true, "license": "MIT", @@ -15192,8 +15164,6 @@ }, "node_modules/npm/node_modules/abbrev": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-2.0.0.tgz", - "integrity": "sha512-6/mh1E2u2YgEsCHdY0Yx5oW+61gZU+1vXaoiHHrpKeuRNNgFvS+/jrwHiQhB5apAf5oB7UB7E19ol2R2LKH8hQ==", "dev": true, "inBundle": true, "license": "ISC", @@ -15203,8 +15173,6 @@ }, "node_modules/npm/node_modules/abort-controller": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", - "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", "dev": true, "inBundle": true, "license": "MIT", @@ -15296,8 +15264,6 @@ }, "node_modules/npm/node_modules/archy": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/archy/-/archy-1.0.0.tgz", - "integrity": "sha512-Xg+9RwCg/0p32teKdGMPTPnVXKD0w3DfHnFTficozsAgsvq2XenPJq/MYpzzQ/v8zrOyJn6Ds39VA4JIDwFfqw==", "dev": true, "inBundle": true, "license": "MIT" @@ -15362,8 +15328,6 @@ }, "node_modules/npm/node_modules/binary-extensions": { "version": "2.2.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", - "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", "dev": true, "inBundle": true, "license": "MIT", @@ -15384,8 +15348,6 @@ }, "node_modules/npm/node_modules/buffer": { "version": "6.0.3", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", - "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", "dev": true, "funding": [ { @@ -15410,8 +15372,6 @@ }, "node_modules/npm/node_modules/builtins": { "version": "5.0.1", - "resolved": "https://registry.npmjs.org/builtins/-/builtins-5.0.1.tgz", - "integrity": "sha512-qwVpFEHNfhYJIzNRBvd2C1kyo6jz3ZSMPyyuR47OPdiKWlbYnZNyDWuyR175qDnAJLiCo5fBBqPb3RiXgWlkOQ==", "dev": true, "inBundle": true, "license": "MIT", @@ -15444,8 +15404,6 @@ }, "node_modules/npm/node_modules/chalk": { "version": "5.3.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", - "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==", "dev": true, "inBundle": true, "license": "MIT", @@ -15469,8 +15427,6 @@ }, "node_modules/npm/node_modules/ci-info": { "version": "3.8.0", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.8.0.tgz", - "integrity": "sha512-eXTggHWSooYhq49F2opQhuHWgzucfF2YgODK4e1566GQs5BIfP30B0oenwBJHfWxAs2fyPB1s7Mg949zLf61Yw==", "dev": true, "funding": [ { @@ -15486,8 +15442,6 @@ }, "node_modules/npm/node_modules/cidr-regex": { "version": "3.1.1", - "resolved": "https://registry.npmjs.org/cidr-regex/-/cidr-regex-3.1.1.tgz", - "integrity": "sha512-RBqYd32aDwbCMFJRL6wHOlDNYJsPNTt8vC82ErHF5vKt8QQzxm1FrkW8s/R5pVrXMf17sba09Uoy91PKiddAsw==", "dev": true, "inBundle": true, "license": "BSD-2-Clause", @@ -15511,8 +15465,6 @@ }, "node_modules/npm/node_modules/cli-columns": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/cli-columns/-/cli-columns-4.0.0.tgz", - "integrity": "sha512-XW2Vg+w+L9on9wtwKpyzluIPCWXjaBahI7mTcYjx+BVIYD9c3yqcv/yKC7CmdCZat4rq2yiE1UMSJC5ivKfMtQ==", "dev": true, "inBundle": true, "license": "MIT", @@ -15526,8 +15478,6 @@ }, "node_modules/npm/node_modules/cli-table3": { "version": "0.6.3", - "resolved": "https://registry.npmjs.org/cli-table3/-/cli-table3-0.6.3.tgz", - "integrity": "sha512-w5Jac5SykAeZJKntOxJCrm63Eg5/4dhMWIcuTbo9rpE+brgaSZo0RuNJZeOyMgsUdhDeojvgyQLmjI+K50ZGyg==", "dev": true, "inBundle": true, "license": "MIT", @@ -15554,8 +15504,6 @@ }, "node_modules/npm/node_modules/cmd-shim": { "version": "6.0.1", - "resolved": "https://registry.npmjs.org/cmd-shim/-/cmd-shim-6.0.1.tgz", - "integrity": "sha512-S9iI9y0nKR4hwEQsVWpyxld/6kRfGepGfzff83FcaiEBpmvlbA2nnGe7Cylgrx2f/p1P5S5wpRm9oL8z1PbS3Q==", "dev": true, "inBundle": true, "license": "ISC", @@ -15587,8 +15535,6 @@ }, "node_modules/npm/node_modules/color-support": { "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz", - "integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==", "dev": true, "inBundle": true, "license": "ISC", @@ -15598,8 +15544,6 @@ }, "node_modules/npm/node_modules/columnify": { "version": "1.6.0", - "resolved": "https://registry.npmjs.org/columnify/-/columnify-1.6.0.tgz", - "integrity": "sha512-lomjuFZKfM6MSAnV9aCZC9sc0qGbmZdfygNv+nCpqVkSKdCxCklLtd16O0EILGkImHw9ZpHkAnHaB+8Zxq5W6Q==", "dev": true, "inBundle": true, "license": "MIT", @@ -15613,8 +15557,6 @@ }, "node_modules/npm/node_modules/common-ancestor-path": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/common-ancestor-path/-/common-ancestor-path-1.0.1.tgz", - "integrity": "sha512-L3sHRo1pXXEqX8VU28kfgUY+YGsk09hPqZiZmLacNib6XNTCM8ubYeT7ryXQw8asB1sKgcU5lkB7ONug08aB8w==", "dev": true, "inBundle": true, "license": "ISC" @@ -15653,6 +15595,8 @@ }, "node_modules/npm/node_modules/cross-spawn/node_modules/which": { "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", "dev": true, "inBundle": true, "license": "ISC", @@ -15701,6 +15645,8 @@ }, "node_modules/npm/node_modules/debug/node_modules/ms": { "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true, "inBundle": true, "license": "MIT" @@ -15738,8 +15684,6 @@ }, "node_modules/npm/node_modules/diff": { "version": "5.1.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-5.1.0.tgz", - "integrity": "sha512-D+mk+qE8VC/PAUrlAU34N+VfXev0ghe5ywmpqrawphmVZc1bEfn56uo9qpyGp1p4xpzOHkSW4ztBd6L7Xx4ACw==", "dev": true, "inBundle": true, "license": "BSD-3-Clause", @@ -15765,8 +15709,6 @@ }, "node_modules/npm/node_modules/encoding": { "version": "0.1.13", - "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz", - "integrity": "sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==", "dev": true, "inBundle": true, "license": "MIT", @@ -15777,8 +15719,6 @@ }, "node_modules/npm/node_modules/env-paths": { "version": "2.2.1", - "resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz", - "integrity": "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==", "dev": true, "inBundle": true, "license": "MIT", @@ -15788,16 +15728,12 @@ }, "node_modules/npm/node_modules/err-code": { "version": "2.0.3", - "resolved": "https://registry.npmjs.org/err-code/-/err-code-2.0.3.tgz", - "integrity": "sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA==", "dev": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/event-target-shim": { "version": "5.0.1", - "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", - "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", "dev": true, "inBundle": true, "license": "MIT", @@ -15818,16 +15754,12 @@ }, "node_modules/npm/node_modules/exponential-backoff": { "version": "3.1.1", - "resolved": "https://registry.npmjs.org/exponential-backoff/-/exponential-backoff-3.1.1.tgz", - "integrity": "sha512-dX7e/LHVJ6W3DE1MHWi9S1EYzDESENfLrYohG2G++ovZrYOkm4Knwa0mc1cn84xJOR4KEU0WSchhLbd0UklbHw==", "dev": true, "inBundle": true, "license": "Apache-2.0" }, "node_modules/npm/node_modules/fastest-levenshtein": { "version": "1.0.16", - "resolved": "https://registry.npmjs.org/fastest-levenshtein/-/fastest-levenshtein-1.0.16.tgz", - "integrity": "sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg==", "dev": true, "inBundle": true, "license": "MIT", @@ -15883,8 +15815,6 @@ }, "node_modules/npm/node_modules/gauge": { "version": "5.0.1", - "resolved": "https://registry.npmjs.org/gauge/-/gauge-5.0.1.tgz", - "integrity": "sha512-CmykPMJGuNan/3S4kZOpvvPYSNqSHANiWnh9XcMU2pSjtBfF0XzZ2p1bFAxTbnFxyBuPxQYHhzwaoOmUdqzvxQ==", "dev": true, "inBundle": true, "license": "ISC", @@ -15926,8 +15856,6 @@ }, "node_modules/npm/node_modules/graceful-fs": { "version": "4.2.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", - "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", "dev": true, "inBundle": true, "license": "ISC" @@ -15956,8 +15884,6 @@ }, "node_modules/npm/node_modules/hosted-git-info": { "version": "6.1.1", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-6.1.1.tgz", - "integrity": "sha512-r0EI+HBMcXadMrugk0GCQ+6BQV39PiWAZVfq7oIckeGiN7sjRGyQxPdft3nQekFTCQbYxLBH+/axZMeH8UX6+w==", "dev": true, "inBundle": true, "license": "ISC", @@ -15970,16 +15896,12 @@ }, "node_modules/npm/node_modules/http-cache-semantics": { "version": "4.1.1", - "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz", - "integrity": "sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==", "dev": true, "inBundle": true, "license": "BSD-2-Clause" }, "node_modules/npm/node_modules/http-proxy-agent": { "version": "5.0.0", - "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz", - "integrity": "sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w==", "dev": true, "inBundle": true, "license": "MIT", @@ -16009,8 +15931,6 @@ }, "node_modules/npm/node_modules/humanize-ms": { "version": "1.2.1", - "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", - "integrity": "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==", "dev": true, "inBundle": true, "license": "MIT", @@ -16020,8 +15940,6 @@ }, "node_modules/npm/node_modules/iconv-lite": { "version": "0.6.3", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", - "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", "dev": true, "inBundle": true, "license": "MIT", @@ -16035,8 +15953,6 @@ }, "node_modules/npm/node_modules/ieee754": { "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", "dev": true, "funding": [ { @@ -16057,8 +15973,6 @@ }, "node_modules/npm/node_modules/ignore-walk": { "version": "6.0.3", - "resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-6.0.3.tgz", - "integrity": "sha512-C7FfFoTA+bI10qfeydT8aZbvr91vAEU+2W5BZUlzPec47oNb07SsOfwYrtxuvOYdUApPP/Qlh4DtAO51Ekk2QA==", "dev": true, "inBundle": true, "license": "ISC", @@ -16113,8 +16027,6 @@ }, "node_modules/npm/node_modules/ini": { "version": "4.1.1", - "resolved": "https://registry.npmjs.org/ini/-/ini-4.1.1.tgz", - "integrity": "sha512-QQnnxNyfvmHFIsj7gkPcYymR8Jdw/o7mp5ZFihxn6h8Ci6fh3Dx4E1gPjpQEpIuPo9XVNY/ZUwh4BPMjGyL01g==", "dev": true, "inBundle": true, "license": "ISC", @@ -16124,8 +16036,6 @@ }, "node_modules/npm/node_modules/init-package-json": { "version": "5.0.0", - "resolved": "https://registry.npmjs.org/init-package-json/-/init-package-json-5.0.0.tgz", - "integrity": "sha512-kBhlSheBfYmq3e0L1ii+VKe3zBTLL5lDCDWR+f9dLmEGSB3MqLlMlsolubSsyI88Bg6EA+BIMlomAnQ1SwgQBw==", "dev": true, "inBundle": true, "license": "ISC", @@ -16152,8 +16062,6 @@ }, "node_modules/npm/node_modules/ip-regex": { "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-4.3.0.tgz", - "integrity": "sha512-B9ZWJxHHOHUhUjCPrMpLD4xEq35bUTClHM1S6CBU5ixQnkZmwipwgc96vAd7AAGM9TGHvJR+Uss+/Ak6UphK+Q==", "dev": true, "inBundle": true, "license": "MIT", @@ -16163,8 +16071,6 @@ }, "node_modules/npm/node_modules/is-cidr": { "version": "4.0.2", - "resolved": "https://registry.npmjs.org/is-cidr/-/is-cidr-4.0.2.tgz", - "integrity": "sha512-z4a1ENUajDbEl/Q6/pVBpTR1nBjjEE1X7qb7bmWYanNnPoKAvUCPFKeXV6Fe4mgTkWKBqiHIcwsI3SndiO5FeA==", "dev": true, "inBundle": true, "license": "BSD-2-Clause", @@ -16200,8 +16106,6 @@ }, "node_modules/npm/node_modules/is-lambda": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-lambda/-/is-lambda-1.0.1.tgz", - "integrity": "sha512-z7CMFGNrENq5iFB9Bqo64Xk6Y9sg+epq1myIcdHaGnbMTYOxvzsEtdYqQUylB7LxfkvgrrjP32T6Ywciio9UIQ==", "dev": true, "inBundle": true, "license": "MIT" @@ -16234,8 +16138,6 @@ }, "node_modules/npm/node_modules/json-parse-even-better-errors": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-3.0.0.tgz", - "integrity": "sha512-iZbGHafX/59r39gPwVPRBGw0QQKnA7tte5pSMrhWOW7swGsVvVTjmfyAV9pNqk8YGT7tRCdxRu8uzcgZwoDooA==", "dev": true, "inBundle": true, "license": "MIT", @@ -16245,8 +16147,6 @@ }, "node_modules/npm/node_modules/json-stringify-nice": { "version": "1.1.4", - "resolved": "https://registry.npmjs.org/json-stringify-nice/-/json-stringify-nice-1.1.4.tgz", - "integrity": "sha512-5Z5RFW63yxReJ7vANgW6eZFGWaQvnPE3WNmZoOJrSkGju2etKA2L5rrOa1sm877TVTFt57A80BH1bArcmlLfPw==", "dev": true, "inBundle": true, "license": "ISC", @@ -16256,8 +16156,6 @@ }, "node_modules/npm/node_modules/jsonparse": { "version": "1.3.1", - "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz", - "integrity": "sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg==", "dev": true, "engines": [ "node >= 0.2.0" @@ -16267,24 +16165,18 @@ }, "node_modules/npm/node_modules/just-diff": { "version": "6.0.2", - "resolved": "https://registry.npmjs.org/just-diff/-/just-diff-6.0.2.tgz", - "integrity": "sha512-S59eriX5u3/QhMNq3v/gm8Kd0w8OS6Tz2FS1NG4blv+z0MuQcBRJyFWjdovM0Rad4/P4aUPFtnkNjMjyMlMSYA==", "dev": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/just-diff-apply": { "version": "5.5.0", - "resolved": "https://registry.npmjs.org/just-diff-apply/-/just-diff-apply-5.5.0.tgz", - "integrity": "sha512-OYTthRfSh55WOItVqwpefPtNt2VdKsq5AnAK6apdtR6yCH8pr0CmSr710J0Mf+WdQy7K/OzMy7K2MgAfdQURDw==", "dev": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/libnpmaccess": { "version": "7.0.2", - "resolved": "https://registry.npmjs.org/libnpmaccess/-/libnpmaccess-7.0.2.tgz", - "integrity": "sha512-vHBVMw1JFMTgEk15zRsJuSAg7QtGGHpUSEfnbcRL1/gTBag9iEfJbyjpDmdJmwMhvpoLoNBtdAUCdGnaP32hhw==", "dev": true, "inBundle": true, "license": "ISC", @@ -16352,8 +16244,6 @@ }, "node_modules/npm/node_modules/libnpmhook": { "version": "9.0.3", - "resolved": "https://registry.npmjs.org/libnpmhook/-/libnpmhook-9.0.3.tgz", - "integrity": "sha512-wMZe58sI7KLhg0+nUWZW5KdMfjNNcOIIbkoP19BDHYoUF9El7eeUWkGNxUGzpHkPKiGoQ1z/v6CYin4deebeuw==", "dev": true, "inBundle": true, "license": "ISC", @@ -16367,8 +16257,6 @@ }, "node_modules/npm/node_modules/libnpmorg": { "version": "5.0.4", - "resolved": "https://registry.npmjs.org/libnpmorg/-/libnpmorg-5.0.4.tgz", - "integrity": "sha512-YqYXLMAN0Y1eJH4w3hUFN9648xfSdvJANMsdeZTOWJOW4Pqp8qapJFzQdqCfUkg+tEuQmnaFQQKXvkMZC51+Mw==", "dev": true, "inBundle": true, "license": "ISC", @@ -16397,8 +16285,6 @@ }, "node_modules/npm/node_modules/libnpmpublish": { "version": "7.5.0", - "resolved": "https://registry.npmjs.org/libnpmpublish/-/libnpmpublish-7.5.0.tgz", - "integrity": "sha512-zctH6QcTJ093lpxmkufr2zr3AJ9V90hcRilDFNin6n91ODj+S28RdyMFFJpa9NwyztmyV2hlWLyZv0GaOQBDyA==", "dev": true, "inBundle": true, "license": "ISC", @@ -16418,8 +16304,6 @@ }, "node_modules/npm/node_modules/libnpmsearch": { "version": "6.0.2", - "resolved": "https://registry.npmjs.org/libnpmsearch/-/libnpmsearch-6.0.2.tgz", - "integrity": "sha512-p+5BF19AvnVg8mcIQhy6yWhI6jHQRVMYaIaKeITEfYAffWsqbottA/WZdMtHL76hViC6SFM1WdclM1w5eAIa1g==", "dev": true, "inBundle": true, "license": "ISC", @@ -16432,8 +16316,6 @@ }, "node_modules/npm/node_modules/libnpmteam": { "version": "5.0.3", - "resolved": "https://registry.npmjs.org/libnpmteam/-/libnpmteam-5.0.3.tgz", - "integrity": "sha512-7XOGhi45s+ml6TyrhJUTyrErcoDMKGKfEtiTEco4ofU7BGGAUOalVztKMVLLJgJOOXdIAIlzCHqkTXEuSiyCiA==", "dev": true, "inBundle": true, "license": "ISC", @@ -16447,8 +16329,6 @@ }, "node_modules/npm/node_modules/libnpmversion": { "version": "4.0.2", - "resolved": "https://registry.npmjs.org/libnpmversion/-/libnpmversion-4.0.2.tgz", - "integrity": "sha512-n1X70mFHv8Piy4yos+MFWUARSkTbyV5cdsHScaIkuwYvRAF/s2VtYScDzWB4Oe8uNEuGNdjiRR1E/Dh1tMvv6g==", "dev": true, "inBundle": true, "license": "ISC", @@ -16465,8 +16345,6 @@ }, "node_modules/npm/node_modules/lru-cache": { "version": "7.18.3", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz", - "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==", "dev": true, "inBundle": true, "license": "ISC", @@ -16476,8 +16354,6 @@ }, "node_modules/npm/node_modules/make-fetch-happen": { "version": "11.1.1", - "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-11.1.1.tgz", - "integrity": "sha512-rLWS7GCSTcEujjVBs2YqG7Y4643u8ucvCJeSRqiLYhesrDuzeuFIk37xREzAsfQaqzl8b9rNCE4m6J8tvX4Q8w==", "dev": true, "inBundle": true, "license": "ISC", @@ -16532,8 +16408,6 @@ }, "node_modules/npm/node_modules/minipass-collect": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/minipass-collect/-/minipass-collect-1.0.2.tgz", - "integrity": "sha512-6T6lH0H8OG9kITm/Jm6tdooIbogG9e0tLgpY6mphXSm/A9u8Nq1ryBG+Qspiub9LjWlBPsPS3tWQ/Botq4FdxA==", "dev": true, "inBundle": true, "license": "ISC", @@ -16546,6 +16420,8 @@ }, "node_modules/npm/node_modules/minipass-collect/node_modules/minipass": { "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", "dev": true, "inBundle": true, "license": "ISC", @@ -16575,8 +16451,6 @@ }, "node_modules/npm/node_modules/minipass-flush": { "version": "1.0.5", - "resolved": "https://registry.npmjs.org/minipass-flush/-/minipass-flush-1.0.5.tgz", - "integrity": "sha512-JmQSYYpPUqX5Jyn1mXaRwOda1uQ8HP5KAT/oDSLCzt1BYRhQU0/hDtsB1ufZfEEzMZ9aAVmsBw8+FWsIXlClWw==", "dev": true, "inBundle": true, "license": "ISC", @@ -16589,6 +16463,8 @@ }, "node_modules/npm/node_modules/minipass-flush/node_modules/minipass": { "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", "dev": true, "inBundle": true, "license": "ISC", @@ -16601,8 +16477,6 @@ }, "node_modules/npm/node_modules/minipass-json-stream": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minipass-json-stream/-/minipass-json-stream-1.0.1.tgz", - "integrity": "sha512-ODqY18UZt/I8k+b7rl2AENgbWE8IDYam+undIJONvigAz8KR5GWblsFTEfQs0WODsjbSXWlm+JHEv8Gr6Tfdbg==", "dev": true, "inBundle": true, "license": "MIT", @@ -16613,6 +16487,8 @@ }, "node_modules/npm/node_modules/minipass-json-stream/node_modules/minipass": { "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", "dev": true, "inBundle": true, "license": "ISC", @@ -16625,8 +16501,6 @@ }, "node_modules/npm/node_modules/minipass-pipeline": { "version": "1.2.4", - "resolved": "https://registry.npmjs.org/minipass-pipeline/-/minipass-pipeline-1.2.4.tgz", - "integrity": "sha512-xuIq7cIOt09RPRJ19gdi4b+RiNvDFYe5JH+ggNvBqGqpQXcru3PcRmOZuHBKWK1Txf9+cQ+HMVN4d6z46LZP7A==", "dev": true, "inBundle": true, "license": "ISC", @@ -16639,6 +16513,8 @@ }, "node_modules/npm/node_modules/minipass-pipeline/node_modules/minipass": { "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", "dev": true, "inBundle": true, "license": "ISC", @@ -16651,8 +16527,6 @@ }, "node_modules/npm/node_modules/minipass-sized": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/minipass-sized/-/minipass-sized-1.0.3.tgz", - "integrity": "sha512-MbkQQ2CTiBMlA2Dm/5cY+9SWFEN8pzzOXi6rlM5Xxq0Yqbda5ZQy9sU75a673FE9ZK0Zsbr6Y5iP6u9nktfg2g==", "dev": true, "inBundle": true, "license": "ISC", @@ -16665,6 +16539,8 @@ }, "node_modules/npm/node_modules/minipass-sized/node_modules/minipass": { "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", "dev": true, "inBundle": true, "license": "ISC", @@ -16692,6 +16568,8 @@ }, "node_modules/npm/node_modules/minizlib/node_modules/minipass": { "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", "dev": true, "inBundle": true, "license": "ISC", @@ -16718,16 +16596,12 @@ }, "node_modules/npm/node_modules/ms": { "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "dev": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/mute-stream": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-1.0.0.tgz", - "integrity": "sha512-avsJQhyd+680gKXyG/sQc0nXaC6rBkPOfyHYcFb9+hdkqQkR9bdnkJ0AMZhke0oesPqIO+mFFJ+IdBc7mst4IA==", "dev": true, "inBundle": true, "license": "ISC", @@ -16737,8 +16611,6 @@ }, "node_modules/npm/node_modules/negotiator": { "version": "0.6.3", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", - "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", "dev": true, "inBundle": true, "license": "MIT", @@ -16748,8 +16620,6 @@ }, "node_modules/npm/node_modules/node-gyp": { "version": "9.4.0", - "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-9.4.0.tgz", - "integrity": "sha512-dMXsYP6gc9rRbejLXmTbVRYjAHw7ppswsKyMxuxJxxOHzluIO1rGp9TOQgjFJ+2MCqcOcQTOPB/8Xwhr+7s4Eg==", "dev": true, "inBundle": true, "license": "MIT", @@ -16775,16 +16645,12 @@ }, "node_modules/npm/node_modules/node-gyp/node_modules/abbrev": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", - "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", "dev": true, "inBundle": true, "license": "ISC" }, "node_modules/npm/node_modules/node-gyp/node_modules/are-we-there-yet": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-3.0.1.tgz", - "integrity": "sha512-QZW4EDmGwlYur0Yyf/b2uGucHQMa8aFUP7eu9ddR73vvhFyt4V0Vl3QHPcTNJ8l6qYOBdxgXdnBXQrHilfRQBg==", "dev": true, "inBundle": true, "license": "ISC", @@ -16810,8 +16676,6 @@ }, "node_modules/npm/node_modules/node-gyp/node_modules/gauge": { "version": "4.0.4", - "resolved": "https://registry.npmjs.org/gauge/-/gauge-4.0.4.tgz", - "integrity": "sha512-f9m+BEN5jkg6a0fZjleidjN51VE1X+mPFQ2DJ0uv1V39oCLCbsGe6yjbBnp7eK7z/+GAon99a3nHuqbuuthyPg==", "dev": true, "inBundle": true, "license": "ISC", @@ -16831,6 +16695,8 @@ }, "node_modules/npm/node_modules/node-gyp/node_modules/glob": { "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", "dev": true, "inBundle": true, "license": "ISC", @@ -16934,8 +16800,6 @@ }, "node_modules/npm/node_modules/nopt": { "version": "7.2.0", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-7.2.0.tgz", - "integrity": "sha512-CVDtwCdhYIvnAzFoJ6NJ6dX3oga9/HyciQDnG1vQDjSLMeKLJ4A93ZqYKDrgYSr1FBY5/hMYC+2VCi24pgpkGA==", "dev": true, "inBundle": true, "license": "ISC", @@ -16951,8 +16815,6 @@ }, "node_modules/npm/node_modules/normalize-package-data": { "version": "5.0.0", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-5.0.0.tgz", - "integrity": "sha512-h9iPVIfrVZ9wVYQnxFgtw1ugSvGEMOlyPWWtm8BMJhnwyEL/FLbYbTY3V3PpjI/BUK67n9PEWDu6eHzu1fB15Q==", "dev": true, "inBundle": true, "license": "BSD-2-Clause", @@ -16968,8 +16830,6 @@ }, "node_modules/npm/node_modules/npm-audit-report": { "version": "5.0.0", - "resolved": "https://registry.npmjs.org/npm-audit-report/-/npm-audit-report-5.0.0.tgz", - "integrity": "sha512-EkXrzat7zERmUhHaoren1YhTxFwsOu5jypE84k6632SXTHcQE1z8V51GC6GVZt8LxkC+tbBcKMUBZAgk8SUSbw==", "dev": true, "inBundle": true, "license": "ISC", @@ -16979,8 +16839,6 @@ }, "node_modules/npm/node_modules/npm-bundled": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/npm-bundled/-/npm-bundled-3.0.0.tgz", - "integrity": "sha512-Vq0eyEQy+elFpzsKjMss9kxqb9tG3YHg4dsyWuUENuzvSUWe1TCnW/vV9FkhvBk/brEDoDiVd+M1Btosa6ImdQ==", "dev": true, "inBundle": true, "license": "ISC", @@ -17005,8 +16863,6 @@ }, "node_modules/npm/node_modules/npm-normalize-package-bin": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/npm-normalize-package-bin/-/npm-normalize-package-bin-3.0.1.tgz", - "integrity": "sha512-dMxCf+zZ+3zeQZXKxmyuCKlIDPGuv8EF940xbkC4kQVDTtqoh6rJFO+JTKSA6/Rwi0getWmtuy4Itup0AMcaDQ==", "dev": true, "inBundle": true, "license": "ISC", @@ -17016,8 +16872,6 @@ }, "node_modules/npm/node_modules/npm-package-arg": { "version": "10.1.0", - "resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-10.1.0.tgz", - "integrity": "sha512-uFyyCEmgBfZTtrKk/5xDfHp6+MdrqGotX/VoOyEEl3mBwiEE5FlBaePanazJSVMPT7vKepcjYBY2ztg9A3yPIA==", "dev": true, "inBundle": true, "license": "ISC", @@ -17033,8 +16887,6 @@ }, "node_modules/npm/node_modules/npm-packlist": { "version": "7.0.4", - "resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-7.0.4.tgz", - "integrity": "sha512-d6RGEuRrNS5/N84iglPivjaJPxhDbZmlbTwTDX2IbcRHG5bZCdtysYMhwiPvcF4GisXHGn7xsxv+GQ7T/02M5Q==", "dev": true, "inBundle": true, "license": "ISC", @@ -17062,8 +16914,6 @@ }, "node_modules/npm/node_modules/npm-profile": { "version": "7.0.1", - "resolved": "https://registry.npmjs.org/npm-profile/-/npm-profile-7.0.1.tgz", - "integrity": "sha512-VReArOY/fCx5dWL66cbJ2OMogTQAVVQA//8jjmjkarboki3V7UJ0XbGFW+khRwiAJFQjuH0Bqr/yF7Y5RZdkMQ==", "dev": true, "inBundle": true, "license": "ISC", @@ -17077,8 +16927,6 @@ }, "node_modules/npm/node_modules/npm-registry-fetch": { "version": "14.0.5", - "resolved": "https://registry.npmjs.org/npm-registry-fetch/-/npm-registry-fetch-14.0.5.tgz", - "integrity": "sha512-kIDMIo4aBm6xg7jOttupWZamsZRkAqMqwqqbVXnUqstY5+tapvv6bkH/qMR76jdgV+YljEUCyWx3hRYMrJiAgA==", "dev": true, "inBundle": true, "license": "ISC", @@ -17097,8 +16945,6 @@ }, "node_modules/npm/node_modules/npm-user-validate": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/npm-user-validate/-/npm-user-validate-2.0.0.tgz", - "integrity": "sha512-sSWeqAYJ2dUPStJB+AEj0DyLRltr/f6YNcvCA7phkB8/RMLMnVsQ41GMwHo/ERZLYNDsyB2wPm7pZo1mqPOl7Q==", "dev": true, "inBundle": true, "license": "BSD-2-Clause", @@ -17108,8 +16954,6 @@ }, "node_modules/npm/node_modules/npmlog": { "version": "7.0.1", - "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-7.0.1.tgz", - "integrity": "sha512-uJ0YFk/mCQpLBt+bxN88AKd+gyqZvZDbtiNxk6Waqcj2aPRyfVx8ITawkyQynxUagInjdYT1+qj4NfA5KJJUxg==", "dev": true, "inBundle": true, "license": "ISC", @@ -17153,8 +16997,6 @@ }, "node_modules/npm/node_modules/pacote": { "version": "15.2.0", - "resolved": "https://registry.npmjs.org/pacote/-/pacote-15.2.0.tgz", - "integrity": "sha512-rJVZeIwHTUta23sIZgEIM62WYwbmGbThdbnkt81ravBplQv+HjyroqnLRNH2+sLJHcGZmLRmhPwACqhfTcOmnA==", "dev": true, "inBundle": true, "license": "ISC", @@ -17187,8 +17029,6 @@ }, "node_modules/npm/node_modules/parse-conflict-json": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/parse-conflict-json/-/parse-conflict-json-3.0.1.tgz", - "integrity": "sha512-01TvEktc68vwbJOtWZluyWeVGWjP+bZwXtPDMQVbBKzbJ/vZBif0L69KH1+cHv1SZ6e0FKLvjyHe8mqsIqYOmw==", "dev": true, "inBundle": true, "license": "ISC", @@ -17250,8 +17090,6 @@ }, "node_modules/npm/node_modules/postcss-selector-parser": { "version": "6.0.13", - "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.13.tgz", - "integrity": "sha512-EaV1Gl4mUEV4ddhDnv/xtj7sxwrwxdetHdWUGnT4VJQf+4d05v6lHYZr8N573k5Z0BViss7BDhfWtKS3+sfAqQ==", "dev": true, "inBundle": true, "license": "MIT", @@ -17265,8 +17103,6 @@ }, "node_modules/npm/node_modules/proc-log": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/proc-log/-/proc-log-3.0.0.tgz", - "integrity": "sha512-++Vn7NS4Xf9NacaU9Xq3URUuqZETPsf8L4j5/ckhaRYsfPeRyzGw+iDjFhV/Jr3uNmTvvddEJFWh5R1gRgUH8A==", "dev": true, "inBundle": true, "license": "ISC", @@ -17287,8 +17123,6 @@ }, "node_modules/npm/node_modules/promise-all-reject-late": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/promise-all-reject-late/-/promise-all-reject-late-1.0.1.tgz", - "integrity": "sha512-vuf0Lf0lOxyQREH7GDIOUMLS7kz+gs8i6B+Yi8dC68a2sychGrHTJYghMBD6k7eUcH0H5P73EckCA48xijWqXw==", "dev": true, "inBundle": true, "license": "ISC", @@ -17298,8 +17132,6 @@ }, "node_modules/npm/node_modules/promise-call-limit": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/promise-call-limit/-/promise-call-limit-1.0.2.tgz", - "integrity": "sha512-1vTUnfI2hzui8AEIixbdAJlFY4LFDXqQswy/2eOlThAscXCY4It8FdVuI0fMJGAB2aWGbdQf/gv0skKYXmdrHA==", "dev": true, "inBundle": true, "license": "ISC", @@ -17309,16 +17141,12 @@ }, "node_modules/npm/node_modules/promise-inflight": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/promise-inflight/-/promise-inflight-1.0.1.tgz", - "integrity": "sha512-6zWPyEOFaQBJYcGMHBKTKJ3u6TBsnMFOIZSa6ce1e/ZrrsOlnHRHbabMjLiBYKp+n44X9eUI6VUPaukCXHuG4g==", "dev": true, "inBundle": true, "license": "ISC" }, "node_modules/npm/node_modules/promise-retry": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/promise-retry/-/promise-retry-2.0.1.tgz", - "integrity": "sha512-y+WKFlBR8BGXnsNlIHFGPZmyDf3DFMoLhaflAnyZgV6rG6xu+JwesTo2Q9R6XwYmtmwAFCkAk3e35jEdoeh/3g==", "dev": true, "inBundle": true, "license": "MIT", @@ -17332,8 +17160,6 @@ }, "node_modules/npm/node_modules/promzard": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/promzard/-/promzard-1.0.0.tgz", - "integrity": "sha512-KQVDEubSUHGSt5xLakaToDFrSoZhStB8dXLzk2xvwR67gJktrHFvpR63oZgHyK19WKbHFLXJqCPXdVR3aBP8Ig==", "dev": true, "inBundle": true, "license": "ISC", @@ -17346,8 +17172,6 @@ }, "node_modules/npm/node_modules/qrcode-terminal": { "version": "0.12.0", - "resolved": "https://registry.npmjs.org/qrcode-terminal/-/qrcode-terminal-0.12.0.tgz", - "integrity": "sha512-EXtzRZmC+YGmGlDFbXKxQiMZNwCLEO6BANKXG4iCtSIM0yqc/pappSx3RIKr4r0uh5JsBckOXeKrB3Iz7mdQpQ==", "dev": true, "inBundle": true, "bin": { @@ -17356,8 +17180,6 @@ }, "node_modules/npm/node_modules/read": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/read/-/read-2.1.0.tgz", - "integrity": "sha512-bvxi1QLJHcaywCAEsAk4DG3nVoqiY2Csps3qzWalhj5hFqRn1d/OixkFXtLO1PrgHUcAP0FNaSY/5GYNfENFFQ==", "dev": true, "inBundle": true, "license": "ISC", @@ -17370,8 +17192,6 @@ }, "node_modules/npm/node_modules/read-cmd-shim": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/read-cmd-shim/-/read-cmd-shim-4.0.0.tgz", - "integrity": "sha512-yILWifhaSEEytfXI76kB9xEEiG1AiozaCJZ83A87ytjRiN+jVibXjedjCRNjoZviinhG+4UkalO3mWTd8u5O0Q==", "dev": true, "inBundle": true, "license": "ISC", @@ -17381,8 +17201,6 @@ }, "node_modules/npm/node_modules/read-package-json": { "version": "6.0.4", - "resolved": "https://registry.npmjs.org/read-package-json/-/read-package-json-6.0.4.tgz", - "integrity": "sha512-AEtWXYfopBj2z5N5PbkAOeNHRPUg5q+Nen7QLxV8M2zJq1ym6/lCz3fYNTCXe19puu2d06jfHhrP7v/S2PtMMw==", "dev": true, "inBundle": true, "license": "ISC", @@ -17398,8 +17216,6 @@ }, "node_modules/npm/node_modules/read-package-json-fast": { "version": "3.0.2", - "resolved": "https://registry.npmjs.org/read-package-json-fast/-/read-package-json-fast-3.0.2.tgz", - "integrity": "sha512-0J+Msgym3vrLOUB3hzQCuZHII0xkNGCtz/HJH9xZshwv9DbDwkw1KaE3gx/e2J5rpEY5rtOy6cyhKOPrkP7FZw==", "dev": true, "inBundle": true, "license": "ISC", @@ -17428,8 +17244,6 @@ }, "node_modules/npm/node_modules/retry": { "version": "0.12.0", - "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz", - "integrity": "sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow==", "dev": true, "inBundle": true, "license": "MIT", @@ -17468,6 +17282,8 @@ }, "node_modules/npm/node_modules/rimraf/node_modules/glob": { "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", "dev": true, "inBundle": true, "license": "ISC", @@ -17524,8 +17340,6 @@ }, "node_modules/npm/node_modules/safer-buffer": { "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "dev": true, "inBundle": true, "license": "MIT", @@ -17550,6 +17364,8 @@ }, "node_modules/npm/node_modules/semver/node_modules/lru-cache": { "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", "dev": true, "inBundle": true, "license": "ISC", @@ -17626,8 +17442,6 @@ }, "node_modules/npm/node_modules/smart-buffer": { "version": "4.2.0", - "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", - "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==", "dev": true, "inBundle": true, "license": "MIT", @@ -17638,8 +17452,6 @@ }, "node_modules/npm/node_modules/socks": { "version": "2.7.1", - "resolved": "https://registry.npmjs.org/socks/-/socks-2.7.1.tgz", - "integrity": "sha512-7maUZy1N7uo6+WVEX6psASxtNlKaNVMlGQKkG/63nEDdLOWNbiUMoLK7X4uYoLhQstau72mLgfEWcXcwsaHbYQ==", "dev": true, "inBundle": true, "license": "MIT", @@ -17654,8 +17466,6 @@ }, "node_modules/npm/node_modules/socks-proxy-agent": { "version": "7.0.0", - "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-7.0.0.tgz", - "integrity": "sha512-Fgl0YPZ902wEsAyiQ+idGd1A7rSFx/ayC1CQVMw5P+EQx2V0SgpGtf6OKFhVjPflPUl9YMmEOnmfjCdMUsygww==", "dev": true, "inBundle": true, "license": "MIT", @@ -17795,8 +17605,6 @@ }, "node_modules/npm/node_modules/supports-color": { "version": "9.4.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-9.4.0.tgz", - "integrity": "sha512-VL+lNrEoIXww1coLPOmiEmK/0sGigko5COxI09KzHc2VJXJsQ37UaQ+8quuxjDeA7+KnLGTWRyOXSLLR2Wb4jw==", "dev": true, "inBundle": true, "license": "MIT", @@ -17828,6 +17636,8 @@ }, "node_modules/npm/node_modules/tar/node_modules/fs-minipass": { "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", + "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", "dev": true, "inBundle": true, "license": "ISC", @@ -17840,6 +17650,8 @@ }, "node_modules/npm/node_modules/tar/node_modules/fs-minipass/node_modules/minipass": { "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", "dev": true, "inBundle": true, "license": "ISC", @@ -17852,24 +17664,18 @@ }, "node_modules/npm/node_modules/text-table": { "version": "0.2.0", - "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", - "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", "dev": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/tiny-relative-date": { "version": "1.3.0", - "resolved": "https://registry.npmjs.org/tiny-relative-date/-/tiny-relative-date-1.3.0.tgz", - "integrity": "sha512-MOQHpzllWxDCHHaDno30hhLfbouoYlOI8YlMNtvKe1zXbjEVhbcEovQxvZrPvtiYW630GQDoMMarCnjfyfHA+A==", "dev": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/treeverse": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/treeverse/-/treeverse-3.0.0.tgz", - "integrity": "sha512-gcANaAnd2QDZFmHFEOF4k7uc1J/6a6z3DJMd/QwEyxLoKGiptJRwid582r7QIsFlFMIZ3SnxfS52S4hm2DHkuQ==", "dev": true, "inBundle": true, "license": "ISC", @@ -17879,8 +17685,6 @@ }, "node_modules/npm/node_modules/tuf-js": { "version": "1.1.7", - "resolved": "https://registry.npmjs.org/tuf-js/-/tuf-js-1.1.7.tgz", - "integrity": "sha512-i3P9Kgw3ytjELUfpuKVDNBJvk4u5bXL6gskv572mcevPbSKCV3zt3djhmlEQ65yERjIbOSncy7U4cQJaB1CBCg==", "dev": true, "inBundle": true, "license": "MIT", @@ -17895,8 +17699,6 @@ }, "node_modules/npm/node_modules/unique-filename": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/unique-filename/-/unique-filename-3.0.0.tgz", - "integrity": "sha512-afXhuC55wkAmZ0P18QsVE6kp8JaxrEokN2HGIoIVv2ijHQd419H0+6EigAFcIzXeMIkcIkNBpB3L/DXB3cTS/g==", "dev": true, "inBundle": true, "license": "ISC", @@ -17909,8 +17711,6 @@ }, "node_modules/npm/node_modules/unique-slug": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unique-slug/-/unique-slug-4.0.0.tgz", - "integrity": "sha512-WrcA6AyEfqDX5bWige/4NQfPZMtASNVxdmWR76WESYQVAACSgWcR6e9i0mofqqBxYFtL4oAxPIptY73/0YE1DQ==", "dev": true, "inBundle": true, "license": "ISC", @@ -17931,8 +17731,6 @@ }, "node_modules/npm/node_modules/validate-npm-package-license": { "version": "3.0.4", - "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", - "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", "dev": true, "inBundle": true, "license": "Apache-2.0", @@ -17943,8 +17741,6 @@ }, "node_modules/npm/node_modules/validate-npm-package-name": { "version": "5.0.0", - "resolved": "https://registry.npmjs.org/validate-npm-package-name/-/validate-npm-package-name-5.0.0.tgz", - "integrity": "sha512-YuKoXDAhBYxY7SfOKxHBDoSyENFeW5VvIIQp2TGQuit8gpK6MnWaQelBKxso72DoxTZfZdcP3W90LqpSkgPzLQ==", "dev": true, "inBundle": true, "license": "ISC", @@ -17957,16 +17753,12 @@ }, "node_modules/npm/node_modules/walk-up-path": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/walk-up-path/-/walk-up-path-3.0.1.tgz", - "integrity": "sha512-9YlCL/ynK3CTlrSRrDxZvUauLzAswPCrsaCgilqFevUYpeEW0/3ScEjaa3kbW/T0ghhkEr7mv+fpjqn1Y1YuTA==", "dev": true, "inBundle": true, "license": "ISC" }, "node_modules/npm/node_modules/wcwidth": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", - "integrity": "sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==", "dev": true, "inBundle": true, "license": "MIT", @@ -17976,8 +17768,6 @@ }, "node_modules/npm/node_modules/which": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/which/-/which-3.0.1.tgz", - "integrity": "sha512-XA1b62dzQzLfaEOSQFTCOd5KFf/1VSzZo7/7TUjnya6u0vGGKzU96UQBZTAThCb2j4/xjBAyii1OhRLJEivHvg==", "dev": true, "inBundle": true, "license": "ISC", @@ -17993,8 +17783,6 @@ }, "node_modules/npm/node_modules/wide-align": { "version": "1.1.5", - "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.5.tgz", - "integrity": "sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==", "dev": true, "inBundle": true, "license": "ISC", @@ -18057,6 +17845,8 @@ }, "node_modules/npm/node_modules/wrap-ansi/node_modules/ansi-styles": { "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", "dev": true, "inBundle": true, "license": "MIT", @@ -18077,6 +17867,8 @@ }, "node_modules/npm/node_modules/wrap-ansi/node_modules/string-width": { "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", "dev": true, "inBundle": true, "license": "MIT", @@ -18119,8 +17911,6 @@ }, "node_modules/npm/node_modules/write-file-atomic": { "version": "5.0.1", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-5.0.1.tgz", - "integrity": "sha512-+QU2zd6OTD8XWIJCbffaiQeH9U73qIqafo1x6V1snCWYGJf6cVE0cDR4D8xRzcEnfI21IFrUPzPGtcPf8AC+Rw==", "dev": true, "inBundle": true, "license": "ISC", @@ -23708,4 +23498,4 @@ } } } -} \ No newline at end of file +} diff --git a/src/Components/Assets/AssetFilter.tsx b/src/Components/Assets/AssetFilter.tsx index 98f7f52e1e1..703dbe027d3 100644 --- a/src/Components/Assets/AssetFilter.tsx +++ b/src/Components/Assets/AssetFilter.tsx @@ -18,9 +18,42 @@ import { dateQueryString } from "../../Utils/utils"; const getDate = (value: any) => value && dayjs(value).isValid() && dayjs(value).toDate(); +const initialFacilityState: FacilityModel = { + id: undefined, + name: "", + read_cover_image_url: "", + facility_type: "", + address: "", + features: [], + location: { + latitude: 0, + longitude: 0, + }, + oxygen_capacity: 0, + phone_number: "", + type_b_cylinders: 0, + type_c_cylinders: 0, + type_d_cylinders: 0, + middleware_address: "", + expected_type_b_cylinders: 0, + expected_type_c_cylinders: 0, + expected_type_d_cylinders: 0, + expected_oxygen_requirement: 0, + local_body_object: undefined, + district_object: undefined, + state_object: undefined, + ward_object: undefined, + modified_date: "", + created_date: "", + state: 0, + district: 0, + local_body: 0, + ward: 0, +}; + function AssetFilter(props: any) { const { filter, onChange, closeFilter } = props; - const [facility, setFacility] = useState({ name: "" }); + const [facility, setFacility] = useState(initialFacilityState); const [asset_type, setAssetType] = useState( filter.asset_type ? filter.asset_type : "" ); @@ -40,7 +73,39 @@ function AssetFilter(props: any) { pathParams: { id: facilityId }, onResponse: ({ res, data }) => { if (res?.status === 200 && data) { - setFacility(data); + const transformedData = { + id: Number(data.id), + name: data.name, + read_cover_image_url: data.read_cover_image_url, + facility_type: String(data.facility_type), + address: data.address, + features: data.features, + location: { + latitude: Number(data.latitude), + longitude: Number(data.longitude), + }, + oxygen_capacity: data.oxygen_capacity, + phone_number: data.phone_number, + type_b_cylinders: data.type_b_cylinders, + type_c_cylinders: data.type_c_cylinders, + type_d_cylinders: data.type_d_cylinders, + middleware_address: data.middleware_address, + expected_type_b_cylinders: data.expected_type_b_cylinders, + expected_type_c_cylinders: data.expected_type_c_cylinders, + expected_type_d_cylinders: data.expected_type_d_cylinders, + expected_oxygen_requirement: data.expected_oxygen_requirement, + local_body_object: data.local_body_object, + district_object: data.district_object, + state_object: data.state_object, + ward_object: data.ward_object, + modified_date: data.modified_date, + created_date: data.created_date, + state: data.state, + district: data.district, + local_body: data.local_body, + ward: data.ward, + }; + setFacility(transformedData); } }, prefetch: !!facilityId, @@ -54,7 +119,7 @@ function AssetFilter(props: any) { }, [facility.id, qParams.facility, qParams.location]); const clearFilter = useCallback(() => { - setFacility({ name: "" }); + setFacility(initialFacilityState); setAssetType(""); setAssetStatus(""); setAssetClass(""); diff --git a/src/Components/ExternalResult/ResultUpdate.tsx b/src/Components/ExternalResult/ResultUpdate.tsx index 92d4d63b427..66497e13de4 100644 --- a/src/Components/ExternalResult/ResultUpdate.tsx +++ b/src/Components/ExternalResult/ResultUpdate.tsx @@ -98,7 +98,13 @@ export default function UpdateResult(props: any) { }); if (res && data) { setIsLocalbodyLoading(false); - setLocalBody([...initialLocalbodies, ...data]); + const transformedData = { + id: data.id, + name: data.name, + number: data.state, + }; + initialLocalbodies.push(transformedData); + setLocalBody([...initialLocalbodies]); } } else { setLocalBody(initialLocalbodies); diff --git a/src/Components/Facility/FacilityCard.tsx b/src/Components/Facility/FacilityCard.tsx index d8c8baeb802..12af4e13142 100644 --- a/src/Components/Facility/FacilityCard.tsx +++ b/src/Components/Facility/FacilityCard.tsx @@ -1,9 +1,6 @@ import { useState } from "react"; -import { useDispatch } from "react-redux"; import { Link } from "raviger"; import { useTranslation } from "react-i18next"; - -import { sendNotificationMessages } from "../../Redux/actions"; import { FACILITY_FEATURE_TYPES } from "../../Common/constants"; import ButtonV2, { Cancel, Submit } from "../Common/components/ButtonV2"; import * as Notification from "../../Utils/Notifications.js"; @@ -14,26 +11,28 @@ import DialogModal from "../Common/Dialog"; import TextAreaFormField from "../Form/FormFields/TextAreaFormField"; import useConfig from "../../Common/hooks/useConfig"; import { classNames } from "../../Utils/utils"; +import request from "../../Utils/request/request"; +import routes from "../../Redux/api"; export const FacilityCard = (props: { facility: any; userType: any }) => { const { facility, userType } = props; const { kasp_string } = useConfig(); const { t } = useTranslation(); - const dispatchAction: any = useDispatch(); const [notifyModalFor, setNotifyModalFor] = useState(undefined); const [notifyMessage, setNotifyMessage] = useState(""); const [notifyError, setNotifyError] = useState(""); const handleNotifySubmit = async (id: any) => { - const data = { - facility: id, - message: notifyMessage, - }; - if (data.message.trim().length >= 1) { + if (notifyMessage.trim().length >= 1) { setNotifyError(""); - const res = await dispatchAction(sendNotificationMessages(data)); - if (res && res.status == 204) { + const { res } = await request(routes.sendNotificationMessages, { + body: { + facility: id, + message: notifyMessage, + }, + }); + if (res?.ok && res.status == 204) { Notification.Success({ msg: "Facility Notified", }); diff --git a/src/Components/Facility/FacilityCreate.tsx b/src/Components/Facility/FacilityCreate.tsx index e742caefb82..002ab94deb2 100644 --- a/src/Components/Facility/FacilityCreate.tsx +++ b/src/Components/Facility/FacilityCreate.tsx @@ -1,7 +1,7 @@ import * as Notification from "../../Utils/Notifications.js"; import ButtonV2, { Cancel, Submit } from "../Common/components/ButtonV2"; -import { CapacityModal, DoctorModal } from "./models"; +import { CapacityModal, DoctorModal, IFacilityRequest } from "./models"; import { DraftSection, useAutoSaveReducer } from "../../Utils/AutoSave.js"; import { FACILITY_FEATURE_TYPES, @@ -13,19 +13,8 @@ import { SelectFormField, } from "../Form/FormFields/SelectFormField"; import { Popover, Transition } from "@headlessui/react"; -import { Fragment, lazy, useCallback, useState } from "react"; +import { Fragment, lazy, useEffect, useState } from "react"; import Steps, { Step } from "../Common/Steps"; -import { - createFacility, - getDistrictByState, - getLocalbodyByDistrict, - getPermittedFacility, - getStates, - getWardByLocalBody, - listCapacity, - listDoctor, - updateFacility, -} from "../../Redux/actions"; import { getPincodeDetails, includesIgnoreCase, @@ -37,7 +26,6 @@ import { validateLongitude, validatePincode, } from "../../Common/validation"; -import { statusType, useAbortableEffect } from "../../Common/utils"; import { BedCapacity } from "./BedCapacity"; import BedTypeCard from "./BedTypeCard"; @@ -57,9 +45,11 @@ import TextFormField from "../Form/FormFields/TextFormField"; import { navigate } from "raviger"; import useAppHistory from "../../Common/hooks/useAppHistory"; import useConfig from "../../Common/hooks/useConfig"; -import { useDispatch } from "react-redux"; import { useTranslation } from "react-i18next"; import { PhoneNumberValidator } from "../Form/FieldValidators.js"; +import request from "../../Utils/request/request.js"; +import routes from "../../Redux/api.js"; +import useQuery from "../../Utils/request/useQuery.js"; const Loading = lazy(() => import("../Common/Loading")); @@ -150,7 +140,6 @@ const facilityCreateReducer = (state = initialState, action: FormAction) => { export const FacilityCreate = (props: FacilityProps) => { const { t } = useTranslation(); const { gov_data_api_key, kasp_string, kasp_enabled } = useConfig(); - const dispatchAction: any = useDispatch(); const { facilityId } = props; const [state, dispatch] = useAutoSaveReducer( @@ -176,37 +165,40 @@ export const FacilityCreate = (props: FacilityProps) => { const { goBack } = useAppHistory(); const headerText = !facilityId ? "Create Facility" : "Update Facility"; const buttonText = !facilityId ? "Save Facility" : "Update Facility"; + const [newId, setNewId] = useState(0); - const fetchDistricts = useCallback( - async (id: number) => { - if (id > 0) { - setIsDistrictLoading(true); - const districtList = await dispatchAction(getDistrictByState({ id })); - if (districtList) { - setDistricts([...districtList.data]); + const { data: districtData, refetch: districtFetch } = useQuery( + routes.getDistrictByState, + { + pathParams: { + id: String(newId), + }, + onResponse: ({ res, data }) => { + if (newId > 0) { + setIsDistrictLoading(true); + if (res?.ok && data) { + setDistricts([data]); + } + setIsDistrictLoading(false); } - setIsDistrictLoading(false); - return districtList ? [...districtList.data] : []; - } - }, - [dispatchAction] + }, + } ); - const fetchLocalBody = useCallback( - async (id: number) => { - if (id > 0) { + const { refetch: localBodyFetch } = useQuery(routes.getLocalbodyByDistrict, { + pathParams: { + id: String(newId), + }, + onResponse: ({ res, data }) => { + if (newId > 0) { setIsLocalbodyLoading(true); - const localBodyList = await dispatchAction( - getLocalbodyByDistrict({ id }) - ); - setIsLocalbodyLoading(false); - if (localBodyList) { - setLocalBodies([...localBodyList.data]); + if (res?.ok && data) { + setLocalBodies([data]); } + setIsLocalbodyLoading(false); } }, - [dispatchAction] - ); + }); const getSteps = (): Step[] => { return [ @@ -245,59 +237,70 @@ export const FacilityCreate = (props: FacilityProps) => { ]; }; - const fetchWards = useCallback( - async (id: number) => { - if (id > 0) { + const { refetch: wardsFetch } = useQuery(routes.getWardByLocalBody, { + pathParams: { + id: String(newId), + }, + onResponse: ({ res, data }) => { + if (newId > 0) { setIsWardLoading(true); - const wardList = await dispatchAction(getWardByLocalBody({ id })); - setIsWardLoading(false); - if (wardList) { - setWard([...wardList.data.results]); + if (res?.ok && data) { + const updatedWards = { + id: data.results[0].id, + name: data.results[0].name, + number: data.results[0].number, + }; + setWard([updatedWards]); } + setIsWardLoading(false); } }, - [dispatchAction] - ); + }); - const fetchData = useCallback( - async (status: statusType) => { + const { refetch: facilityFetch } = useQuery(routes.getPermittedFacility, { + pathParams: { + id: facilityId || "", + }, + onResponse: ({ res, data }) => { if (facilityId) { setIsLoading(true); - const res = await dispatchAction(getPermittedFacility(facilityId)); - if (!status.aborted && res.data) { + if (res && data) { const formData = { - facility_type: res.data.facility_type, - name: res.data.name, - state: res.data.state ? res.data.state : 0, - district: res.data.district ? res.data.district : 0, - local_body: res.data.local_body ? res.data.local_body : 0, - features: res.data.features || [], - ward: res.data.ward_object ? res.data.ward_object.id : 0, - kasp_empanelled: res.data.kasp_empanelled - ? String(res.data.kasp_empanelled) + facility_type: String(data.facility_type), + name: data.name, + state: data.state ? data.state : 0, + district: data.district ? data.district : 0, + local_body: data.local_body ? data.local_body : 0, + features: data.features || [], + ward: data.ward_object ? data.ward_object.id : 0, + kasp_empanelled: data.kasp_empanelled + ? String(data.kasp_empanelled) : "false", - address: res.data.address, - pincode: res.data.pincode, + address: data.address, + pincode: String(data.pincode), phone_number: - res.data.phone_number.length == 10 - ? "+91" + res.data.phone_number - : res.data.phone_number, - latitude: res.data.latitude || "", - longitude: res.data.longitude || "", - type_b_cylinders: res.data.type_b_cylinders, - type_c_cylinders: res.data.type_c_cylinders, - type_d_cylinders: res.data.type_d_cylinders, - expected_type_b_cylinders: res.data.expected_type_b_cylinders, - expected_type_c_cylinders: res.data.expected_type_c_cylinders, - expected_type_d_cylinders: res.data.expected_type_d_cylinders, - expected_oxygen_requirement: res.data.expected_oxygen_requirement, - oxygen_capacity: res.data.oxygen_capacity, + data.phone_number.length == 10 + ? "+91" + data.phone_number + : data.phone_number, + latitude: data.latitude || "", + longitude: data.longitude || "", + type_b_cylinders: data.type_b_cylinders, + type_c_cylinders: data.type_c_cylinders, + type_d_cylinders: data.type_d_cylinders, + expected_type_b_cylinders: data.expected_type_b_cylinders, + expected_type_c_cylinders: data.expected_type_c_cylinders, + expected_type_d_cylinders: data.expected_type_d_cylinders, + expected_oxygen_requirement: data.expected_oxygen_requirement, + oxygen_capacity: data.oxygen_capacity, }; dispatch({ type: "set_form", form: formData }); Promise.all([ - fetchDistricts(res.data.state), - fetchLocalBody(res.data.district), - fetchWards(res.data.local_body), + setNewId(data.state), + districtFetch(), + setNewId(data.district), + localBodyFetch(), + setNewId(data.local_body), + wardsFetch(), ]); } else { navigate(`/facility/${facilityId}`); @@ -305,30 +308,24 @@ export const FacilityCreate = (props: FacilityProps) => { setIsLoading(false); } }, - [dispatchAction, facilityId, fetchDistricts, fetchLocalBody, fetchWards] - ); + }); - const fetchStates = useCallback( - async (status: statusType) => { + const { refetch: fetchStates } = useQuery(routes.statesList, { + onResponse: ({ res, data }) => { setIsStateLoading(true); - const statesRes = await dispatchAction(getStates()); - if (!status.aborted && statesRes.data.results) { - setStates([...statesRes.data.results]); + if (res && data) { + setStates([...data.results]); } setIsStateLoading(false); }, - [dispatchAction] - ); + }); - useAbortableEffect( - (status: statusType) => { - if (facilityId) { - fetchData(status); - } - fetchStates(status); - }, - [dispatch, fetchData] - ); + useEffect(() => { + if (facilityId) { + facilityFetch(); + } + fetchStates(); + }, [dispatch, facilityFetch]); const handleChange = (e: FieldChangeEvent) => { dispatch({ @@ -362,13 +359,14 @@ export const FacilityCreate = (props: FacilityProps) => { return includesIgnoreCase(state.name, pincodeDetails.statename); }); if (!matchedState) return; + setNewId(matchedState.id); + if (!districtData) return; - const fetchedDistricts = await fetchDistricts(matchedState.id); - if (!fetchedDistricts) return; - - const matchedDistrict = fetchedDistricts.find((district) => { - return includesIgnoreCase(district.name, pincodeDetails.district); - }); + const matchedDistrict = Object.values(districtData).find( + (district: any) => { + return includesIgnoreCase(district.name, pincodeDetails.district); + } + ); if (!matchedDistrict) return; dispatch({ @@ -376,12 +374,13 @@ export const FacilityCreate = (props: FacilityProps) => { form: { ...state.form, state: matchedState.id, - district: matchedDistrict.id, + district: districtData.id, pincode: e.value, }, }); - fetchLocalBody(matchedDistrict.id); + setNewId(districtData.id); + localBodyFetch(); setShowAutoFilledPincode(true); setTimeout(() => { setShowAutoFilledPincode(false); @@ -479,8 +478,8 @@ export const FacilityCreate = (props: FacilityProps) => { console.log(state.form); if (validated) { setIsLoading(true); - const data = { - facility_type: state.form.facility_type, + const data: IFacilityRequest = { + facility_type: Number(state.form.facility_type) || undefined, name: state.form.name, district: state.form.district, state: state.form.state, @@ -490,8 +489,8 @@ export const FacilityCreate = (props: FacilityProps) => { features: state.form.features, ward: state.form.ward, kasp_empanelled: JSON.parse(state.form.kasp_empanelled), - latitude: state.form.latitude || null, - longitude: state.form.longitude || null, + latitude: state.form.latitude, + longitude: state.form.longitude, phone_number: parsePhoneNumber(state.form.phone_number), oxygen_capacity: state.form.oxygen_capacity ? state.form.oxygen_capacity @@ -520,12 +519,24 @@ export const FacilityCreate = (props: FacilityProps) => { ? state.form.expected_type_d_cylinders : 0, }; - const res = await dispatchAction( - facilityId ? updateFacility(facilityId, data) : createFacility(data) - ); - if (res && (res.status === 200 || res.status === 201) && res.data) { - const id = res.data.id; + const { res, data: requestData } = facilityId + ? await request(routes.updateFacility, { + body: data, + pathParams: { + id: facilityId, + }, + }) + : await request(routes.createFacility, { + body: data, + }); + + if ( + res?.ok && + (res.status === 200 || res.status === 201) && + requestData + ) { + const id = requestData.id; dispatch({ type: "set_form", form: initForm }); if (!facilityId) { Notification.Success({ @@ -540,9 +551,9 @@ export const FacilityCreate = (props: FacilityProps) => { navigate(`/facility/${facilityId}`); } } else { - if (res?.data) + if (requestData) Notification.Error({ - msg: "Something went wrong: " + (res.data.detail || ""), + msg: "Something went wrong: ", }); } setIsLoading(false); @@ -603,11 +614,17 @@ export const FacilityCreate = (props: FacilityProps) => { lastUpdated={res.modified_date} removeBedType={removeCurrentBedType} handleUpdate={async () => { - const capacityRes = await dispatchAction( - listCapacity({}, { facilityId: createdFacilityId }) - ); - if (capacityRes && capacityRes.data) { - setCapacityData(capacityRes.data.results); + const { res, data } = await request(routes.getCapacity, { + pathParams: { facilityId: createdFacilityId }, + }); + if (res?.ok && data) { + const convertedResult = data.results.map((result) => { + return { + ...result, + id: Number(result.id), + }; + }); + setCapacityData(convertedResult); } }} /> @@ -640,11 +657,17 @@ export const FacilityCreate = (props: FacilityProps) => { facilityId={createdFacilityId || ""} key={`bed_${data.id}`} handleUpdate={async () => { - const doctorRes = await dispatchAction( - listDoctor({}, { facilityId: createdFacilityId }) - ); - if (doctorRes && doctorRes.data) { - setDoctorData(doctorRes.data.results); + const { res, data } = await request(routes.listDoctor, { + pathParams: { facilityId: createdFacilityId }, + }); + if (res?.ok && data) { + const convertedResult = data.results.map((result) => { + return { + ...result, + id: Number(result.id), + }; + }); + setDoctorData(convertedResult); } }} {...data} @@ -686,11 +709,17 @@ export const FacilityCreate = (props: FacilityProps) => { navigate(`/facility/${createdFacilityId}`); }} handleUpdate={async () => { - const doctorRes = await dispatchAction( - listDoctor({}, { facilityId: createdFacilityId }) - ); - if (doctorRes && doctorRes.data) { - setDoctorData(doctorRes.data.results); + const { res, data } = await request(routes.listDoctor, { + pathParams: { facilityId: createdFacilityId }, + }); + if (res?.ok && data) { + const convertedResult = data.results.map((result) => { + return { + ...result, + id: Number(result.id), + }; + }); + setDoctorData(convertedResult); } }} /> @@ -721,11 +750,17 @@ export const FacilityCreate = (props: FacilityProps) => { setCurrentStep(3); }} handleUpdate={async () => { - const capacityRes = await dispatchAction( - listCapacity({}, { facilityId: createdFacilityId }) - ); - if (capacityRes && capacityRes.data) { - setCapacityData(capacityRes.data.results); + const { res, data } = await request(routes.getCapacity, { + pathParams: { facilityId: createdFacilityId }, + }); + if (res?.ok && data) { + const convertedResult = data.results.map((result) => { + return { + ...result, + id: Number(result.id), + }; + }); + setCapacityData(convertedResult); } }} /> @@ -757,9 +792,12 @@ export const FacilityCreate = (props: FacilityProps) => { handleDraftSelect={(newState: any) => { dispatch({ type: "set_state", state: newState }); Promise.all([ - fetchDistricts(newState.form.state), - fetchLocalBody(newState.form.district), - fetchWards(newState.form.local_body), + setNewId(newState.data.state), + districtFetch(), + setNewId(newState.data.district), + localBodyFetch(), + setNewId(newState.data.local_body), + wardsFetch(), ]); }} formData={state.form} @@ -811,7 +849,8 @@ export const FacilityCreate = (props: FacilityProps) => { onChange={(event) => { handleChange(event); if (!event) return; - fetchDistricts(event.value); + setNewId(event.value); + districtFetch(); }} /> { onChange={(event) => { handleChange(event); if (!event) return; - fetchLocalBody(event.value); + setNewId(event.value); + localBodyFetch(); }} /> { onChange={(event) => { handleChange(event); if (!event) return; - fetchWards(event.value); + setNewId(event.value); + wardsFetch(); }} /> import("../Common/Loading")); @@ -58,11 +52,44 @@ export const getFacilityFeatureIcon = (featureId: number) => { ); }; +const initialFacilityState: FacilityModel = { + id: undefined, + name: "", + read_cover_image_url: "", + facility_type: "", + address: "", + features: [], + location: { + latitude: 0, + longitude: 0, + }, + oxygen_capacity: 0, + phone_number: "", + type_b_cylinders: 0, + type_c_cylinders: 0, + type_d_cylinders: 0, + middleware_address: "", + expected_type_b_cylinders: 0, + expected_type_c_cylinders: 0, + expected_type_d_cylinders: 0, + expected_oxygen_requirement: 0, + local_body_object: undefined, + district_object: undefined, + state_object: undefined, + ward_object: undefined, + modified_date: "", + created_date: "", + state: 0, + district: 0, + local_body: 0, + ward: 0, +}; + export const FacilityHome = (props: any) => { const { t } = useTranslation(); const { facilityId } = props; - const dispatch: any = useDispatch(); - const [facilityData, setFacilityData] = useState({}); + const [facilityData, setFacilityData] = + useState(initialFacilityState); const [capacityData, setCapacityData] = useState>([]); const [doctorData, setDoctorData] = useState>([]); const [isLoading, setIsLoading] = useState(false); @@ -80,32 +107,104 @@ export const FacilityHome = (props: any) => { useMessageListener((data) => console.log(data)); - const fetchData = useCallback( - async (status: statusType) => { + const { res: permittedFacilityRes, data: permittedFacilityData } = useQuery( + routes.getPermittedFacility, + { + pathParams: { + id: facilityId, + }, + } + ); + + useEffect(() => { + const fetchData = async () => { setIsLoading(true); - const facilityRes = await dispatch(getPermittedFacility(facilityId)); - if (facilityRes) { - const [capacityRes, doctorRes, triageRes] = await Promise.all([ - dispatch(listCapacity({}, { facilityId })), - dispatch(listDoctor({}, { facilityId })), - dispatch(getTriageInfo({ facilityId })), - ]); - if (!status.aborted) { + if (permittedFacilityRes?.ok) { + const { res: capacityRes, data: capacityData } = await request( + routes.getCapacity, + { + pathParams: { facilityId: facilityId }, + } + ); + const { res: doctorRes, data: doctorData } = await request( + routes.listDoctor, + { + pathParams: { facilityId: facilityId }, + } + ); + const { res: triageRes, data: triageData } = await request( + routes.getTriage, + { + pathParams: { + facilityId: String(facilityId), + }, + } + ); + + if (permittedFacilityRes) { setIsLoading(false); - if (!facilityRes.data) { + if (!permittedFacilityData) { Notification.Error({ msg: "Something went wrong..!", }); } else { - setFacilityData(facilityRes.data); - if (capacityRes && capacityRes.data) { - setCapacityData(capacityRes.data.results); + const transformedPermittedFacilityData = { + id: Number(permittedFacilityData.id), + name: permittedFacilityData.name, + district: permittedFacilityData.district, + read_cover_image_url: permittedFacilityData.read_cover_image_url, + facility_type: String(permittedFacilityData.facility_type), + address: permittedFacilityData.address, + features: permittedFacilityData.features, + location: { + latitude: Number(permittedFacilityData.latitude), + longitude: Number(permittedFacilityData.longitude), + }, + oxygen_capacity: permittedFacilityData.oxygen_capacity, + phone_number: permittedFacilityData.phone_number, + type_b_cylinders: permittedFacilityData.type_b_cylinders, + type_c_cylinders: permittedFacilityData.type_c_cylinders, + type_d_cylinders: permittedFacilityData.type_d_cylinders, + middleware_address: permittedFacilityData.middleware_address, + expected_type_b_cylinders: + permittedFacilityData.expected_type_b_cylinders, + expected_type_c_cylinders: + permittedFacilityData.expected_type_c_cylinders, + expected_type_d_cylinders: + permittedFacilityData.expected_type_d_cylinders, + expected_oxygen_requirement: + permittedFacilityData.expected_oxygen_requirement, + local_body_object: permittedFacilityData.local_body_object, + district_object: permittedFacilityData.district_object, + state_object: permittedFacilityData.state_object, + ward_object: permittedFacilityData.ward_object, + modified_date: permittedFacilityData.modified_date, + created_date: permittedFacilityData.created_date, + state: permittedFacilityData.state, + local_body: permittedFacilityData.local_body, + ward: permittedFacilityData.ward, + }; + setFacilityData(transformedPermittedFacilityData); + if (capacityRes?.ok && capacityData) { + const transformedCapacityData = { + id: Number(capacityData.results[0].id), + room_type: capacityData.results[0].room_type, + modified_date: capacityData.results[0].modified_date, + total_capacity: capacityData.results[0].total_capacity, + current_capacity: capacityData.results[0].current_capacity, + }; + setCapacityData([transformedCapacityData]); } - if (doctorRes && doctorRes.data) { - setDoctorData(doctorRes.data.results); + if (doctorRes?.ok && doctorData) { + const transformedDoctorData = { + id: Number(doctorData.results[0].id), + area: doctorData.results[0].area, + count: doctorData.results[0].count, + }; + setDoctorData([transformedDoctorData]); // calculating total doctors count let totalCount = 0; - doctorRes.data.results.map((doctor: DoctorModal) => { + [transformedDoctorData].map((doctor: DoctorModal) => { if (doctor.count) { totalCount += doctor.count; } @@ -113,12 +212,27 @@ export const FacilityHome = (props: any) => { setTotalDoctors(totalCount); } if ( - triageRes && - triageRes.data && - triageRes.data.results && - triageRes.data.results.length + triageRes?.ok && + triageData && + triageData.results && + triageData.results.length ) { - setPatientStatsData(triageRes.data.results); + const transformedTriageData = { + id: Number(triageData.results[0].id), + entryDate: triageData.results[0].entry_date, + num_patients_visited: + triageData.results[0].num_patients_visited, + num_patients_home_quarantine: + triageData.results[0].num_patients_home_quarantine, + num_patients_isolation: + triageData.results[0].num_patients_isolation, + num_patient_referred: + triageData.results[0].num_patient_referred, + entry_date: Number(triageData.results[0].entry_date), + num_patient_confirmed_positive: + triageData.results[0].num_patient_confirmed_positive, + }; + setPatientStatsData([transformedTriageData]); } } } @@ -126,30 +240,25 @@ export const FacilityHome = (props: any) => { navigate("/not-found"); setIsLoading(false); } - }, - [dispatch, facilityId] - ); - - useAbortableEffect( - (status: statusType) => { - fetchData(status); - }, - [dispatch, fetchData] - ); + }; + if (permittedFacilityRes?.ok) fetchData(); + }, [facilityId, permittedFacilityRes, permittedFacilityData]); const handleDeleteClose = () => { setOpenDeleteDialog(false); }; const handleDeleteSubmit = async () => { - const res = await dispatch(deleteFacility(facilityId)); - if (res?.status === 204) { + const { res, data } = await request(routes.deleteFacility, { + pathParams: { id: facilityId }, + }); + if (res?.ok && res?.status === 204) { Notification.Success({ msg: "Facility deleted successfully", }); } else { Notification.Error({ - msg: "Error while deleting Facility: " + (res?.data?.detail || ""), + msg: "Error while deleting Facility: " + (data?.detail || ""), }); } navigate("/facility"); @@ -209,11 +318,17 @@ export const FacilityHome = (props: any) => { lastUpdated={res.modified_date} removeBedType={removeCurrentBedType} handleUpdate={async () => { - const capacityRes = await dispatch( - listCapacity({}, { facilityId }) - ); - if (capacityRes && capacityRes.data) { - setCapacityData(capacityRes.data.results); + const { res, data } = await request(routes.getCapacity, { + pathParams: { facilityId }, + }); + if (res?.ok && data) { + const convertedResult = data.results.map((result) => { + return { + ...result, + id: Number(result.id), + }; + }); + setCapacityData(convertedResult); } }} /> @@ -263,14 +378,20 @@ export const FacilityHome = (props: any) => { facilityId={facilityId} key={`bed_${data.id}`} handleUpdate={async () => { - const doctorRes = await dispatch( - listDoctor({}, { facilityId }) - ); - if (doctorRes && doctorRes.data) { - setDoctorData(doctorRes.data.results); + const { res, data } = await request(routes.listDoctor, { + pathParams: { facilityId: facilityId }, + }); + if (res?.ok && data) { + const convertedResult = data.results.map((result) => { + return { + ...result, + id: Number(result.id), + }; + }); + setDoctorData(convertedResult); // update total doctors count let totalCount = 0; - doctorRes.data.results.map((doctor: DoctorModal) => { + convertedResult.map((doctor: DoctorModal) => { if (doctor.count) { totalCount += doctor.count; } @@ -750,11 +871,17 @@ export const FacilityHome = (props: any) => { facilityId={facilityId} handleClose={() => setBedCapacityModalOpen(false)} handleUpdate={async () => { - const capacityRes = await dispatch( - listCapacity({}, { facilityId }) - ); - if (capacityRes && capacityRes.data) { - setCapacityData(capacityRes.data.results); + const { res, data } = await request(routes.getCapacity, { + pathParams: { facilityId }, + }); + if (res && data) { + const convertedResult = data.results.map((result) => { + return { + ...result, + id: Number(result.id), + }; + }); + setCapacityData(convertedResult); } }} /> @@ -771,12 +898,20 @@ export const FacilityHome = (props: any) => { facilityId={facilityId} handleClose={() => setDoctorCapacityModalOpen(false)} handleUpdate={async () => { - const doctorRes = await dispatch(listDoctor({}, { facilityId })); - if (doctorRes && doctorRes.data) { - setDoctorData(doctorRes.data.results); + const { res, data } = await request(routes.listDoctor, { + pathParams: { facilityId: facilityId }, + }); + if (res && data) { + const convertedResult = data.results.map((result) => { + return { + ...result, + id: Number(result.id), + }; + }); + setDoctorData(convertedResult); // update total doctors count setTotalDoctors( - doctorRes.data.results.reduce( + convertedResult.reduce( (acc: number, doctor: DoctorModal) => acc + (doctor.count || 0), 0 diff --git a/src/Components/Facility/FacilityUsers.tsx b/src/Components/Facility/FacilityUsers.tsx index caff279ad7e..28abe2c31cc 100644 --- a/src/Components/Facility/FacilityUsers.tsx +++ b/src/Components/Facility/FacilityUsers.tsx @@ -1,14 +1,4 @@ -import { lazy, useCallback, useEffect, useState } from "react"; -import { useDispatch } from "react-redux"; -import { statusType, useAbortableEffect } from "../../Common/utils"; -import { - addUserFacility, - deleteUserFacility, - getUserListFacility, - deleteUser, - getFacilityUsers, - getAnyFacility, -} from "../../Redux/actions"; +import { lazy, useEffect, useState } from "react"; import Pagination from "../Common/Pagination"; import { USER_TYPES, RESULTS_PER_PAGE_LIMIT } from "../../Common/constants"; import { FacilityModel } from "../Facility/models"; @@ -23,12 +13,14 @@ import CareIcon from "../../CAREUI/icons/CareIcon"; import ButtonV2 from "../Common/components/ButtonV2"; import Page from "../Common/components/Page"; import useAuthUser from "../../Common/hooks/useAuthUser"; +import request from "../../Utils/request/request"; +import routes from "../../Redux/api"; +import useQuery from "../../Utils/request/useQuery"; const Loading = lazy(() => import("../Common/Loading")); export default function FacilityUsers(props: any) { const { facilityId } = props; - const dispatch: any = useDispatch(); const initialData: any[] = []; let manageUsers: any = null; const [users, setUsers] = useState(initialData); @@ -66,11 +58,17 @@ export default function FacilityUsers(props: any) { useEffect(() => { async function fetchFacilityName() { if (facilityId) { - const res = await dispatch(getAnyFacility(facilityId)); - setFacilityData({ - name: res?.data?.name || "", - district_object_id: res?.data?.district_object?.id || 0, + const { res, data } = await request(routes.getAnyFacility, { + pathParams: { + id: facilityId, + }, }); + if (res && data) { + setFacilityData({ + name: data.name || "", + district_object_id: data?.district_object?.id || 0, + }); + } } else { setFacilityData({ name: "", @@ -79,32 +77,21 @@ export default function FacilityUsers(props: any) { } } fetchFacilityName(); - }, [dispatch, facilityId]); + }, [facilityId]); - const fetchData = useCallback( - async (status: statusType) => { + const { refetch } = useQuery(routes.getFacilityUsers, { + query: { offset: offset, limit: limit }, + pathParams: { facility_id: facilityId }, + prefetch: facilityId !== undefined, + onResponse: ({ res, data }) => { setIsLoading(true); - const res = await dispatch( - getFacilityUsers(facilityId, { offset, limit }) - ); - - if (!status.aborted) { - if (res && res.data) { - setUsers(res.data.results); - setTotalCount(res.data.count); - } - setIsLoading(false); + if (res?.ok && data) { + setUsers(data.results); + setTotalCount(data.count); } + setIsLoading(false); }, - [dispatch, facilityId, offset, limit] - ); - - useAbortableEffect( - (status: statusType) => { - fetchData(status); - }, - [fetchData] - ); + }); const handlePagination = (page: number, limit: number) => { const offset = (page - 1) * limit; @@ -117,13 +104,15 @@ export default function FacilityUsers(props: any) { return; } setIsFacilityLoading(true); - const res = await dispatch(getUserListFacility({ username })); - if (res && res.data) { + const { res, data } = await request(routes.userListFacility, { + pathParams: { username: username }, + }); + if (res?.ok && data) { const updated = users.map((user) => { return user.username === username ? { ...user, - facilities: res.data, + facilities: data, } : user; }); @@ -156,12 +145,13 @@ export default function FacilityUsers(props: any) { const handleUnlinkFacilitySubmit = async () => { setIsFacilityLoading(true); - await dispatch( - deleteUserFacility( - unlinkFacilityData.userName, - String(unlinkFacilityData?.facility?.id) - ) - ); + await request(routes.deleteUserFacility, { + // body given in the dispatch call but there is no body in API documentation + // body: { id: String(unlinkFacilityData?.facility?.id) }, + pathParams: { + username: unlinkFacilityData.userName, + }, + }); setIsFacilityLoading(false); loadFacilities(unlinkFacilityData.userName); hideUnlinkFacilityModal(); @@ -173,19 +163,21 @@ export default function FacilityUsers(props: any) { const handleSubmit = async () => { const username = userData.username; - const res = await dispatch(deleteUser(username)); + const { res, data } = await request(routes.deleteUser, { + pathParams: { username: username }, + }); if (res?.status === 204) { Notification.Success({ msg: "User deleted successfully", }); } else { Notification.Error({ - msg: "Error while deleting User: " + (res?.data?.detail || ""), + msg: "Error while deleting User: " + (data?.detail || ""), }); } setUserData({ show: false, username: "", name: "" }); - fetchData({ aborted: false }); + refetch(); }; const handleDelete = (user: any) => { @@ -268,7 +260,15 @@ export default function FacilityUsers(props: any) { const addFacility = async (username: string, facility: any) => { hideLinkFacilityModal(); setIsFacilityLoading(true); - await dispatch(addUserFacility(username, String(facility.id))); + // Remaining props of request are not specified in dispatch request + await request(routes.addUserFacility, { + body: { + username: facility.id, + }, + pathParams: { + username: username, + }, + }); setIsFacilityLoading(false); loadFacilities(username); }; diff --git a/src/Components/Facility/HospitalList.tsx b/src/Components/Facility/HospitalList.tsx index ffdc1f4ed12..caf18e3481f 100644 --- a/src/Components/Facility/HospitalList.tsx +++ b/src/Components/Facility/HospitalList.tsx @@ -3,14 +3,8 @@ import { downloadFacilityCapacity, downloadFacilityDoctors, downloadFacilityTriage, - getDistrict, - getLocalBody, - getPermittedFacilities, - getState, } from "../../Redux/actions"; -import { statusType, useAbortableEffect } from "../../Common/utils"; -import { lazy, useCallback, useState } from "react"; -import { useDispatch } from "react-redux"; +import { lazy, useEffect, useState } from "react"; import { AdvancedFilterButton } from "../../CAREUI/interactive/FiltersSlideover"; import CountBlock from "../../CAREUI/display/Count"; import ExportMenu from "../Common/Export"; @@ -25,6 +19,8 @@ import { navigate } from "raviger"; import useFilters from "../../Common/hooks/useFilters"; import { useTranslation } from "react-i18next"; import useAuthUser from "../../Common/hooks/useAuthUser"; +import useQuery from "../../Utils/request/useQuery"; +import routes from "../../Redux/api"; const Loading = lazy(() => import("../Common/Loading")); @@ -39,7 +35,6 @@ export const HospitalList = () => { } = useFilters({ limit: 14, }); - const dispatchAction: any = useDispatch(); const [data, setData] = useState>([]); let manageFacilities: any = null; const [isLoading, setIsLoading] = useState(false); @@ -50,105 +45,114 @@ export const HospitalList = () => { const { user_type } = useAuthUser(); const { t } = useTranslation(); - const fetchData = useCallback( - async (status: statusType) => { - setIsLoading(true); - const params = { - limit: resultsPerPage, - page: qParams.page || 1, - offset: (qParams.page ? qParams.page - 1 : 0) * resultsPerPage, - search_text: qParams.search || undefined, - state: qParams.state, - district: qParams.district, - local_body: qParams.local_body, - facility_type: qParams.facility_type, - kasp_empanelled: qParams.kasp_empanelled, - }; - - const res = await dispatchAction(getPermittedFacilities(params)); - if (!status.aborted) { - if (res && res.data) { - setData(res.data.results); - setTotalCount(res.data.count); - } - setIsLoading(false); - } + const { + res: permittedDataRes, + data: permittedData, + refetch: permittedFacilitiesFetch, + } = useQuery(routes.getPermittedFacilities, { + query: { + district: qParams.district, + district_name: districtName, + facility_type: qParams.facility_type, + kasp_empanelled: qParams.kasp_empanelled, + limit: resultsPerPage, + local_body: qParams.local_body, + local_body_name: localbodyName, + offset: (qParams.page ? qParams.page - 1 : 0) * resultsPerPage, + search_text: qParams.search || undefined, + state: qParams.state, + state_name: stateName, }, - [ - qParams.page, - qParams.search, - qParams.state, - qParams.district, - qParams.local_body, - qParams.facility_type, - qParams.kasp_empanelled, - dispatchAction, - ] - ); + }); - useAbortableEffect( - (status: statusType) => { - fetchData(status); - }, - [fetchData] - ); + useEffect(() => { + setIsLoading(true); + if (permittedDataRes?.ok && permittedData) { + const transformedData = permittedData.results.map((result) => ({ + id: Number(result.id), + name: result.name, + district: result.district, + read_cover_image_url: result.read_cover_image_url, + facility_type: String(result.facility_type), + address: result.address, + features: result.features, + location: { + latitude: Number(result.latitude), + longitude: Number(result.longitude), + }, + oxygen_capacity: result.oxygen_capacity, + phone_number: result.phone_number, + type_b_cylinders: result.type_b_cylinders, + type_c_cylinders: result.type_c_cylinders, + type_d_cylinders: result.type_d_cylinders, + middleware_address: result.middleware_address, + expected_type_b_cylinders: result.expected_type_b_cylinders, + expected_type_c_cylinders: result.expected_type_c_cylinders, + expected_type_d_cylinders: result.expected_type_d_cylinders, + expected_oxygen_requirement: result.expected_oxygen_requirement, + local_body_object: result.local_body_object, + district_object: result.district_object, + state_object: result.state_object, + ward_object: result.ward_object, + modified_date: result.modified_date, + created_date: result.created_date, + })); - const fetchStateName = useCallback( - async (status: statusType) => { - const res = - Number(qParams.state) && - (await dispatchAction(getState(qParams.state))); - if (!status.aborted) { - setStateName(res?.data?.name); - } - }, - [dispatchAction, qParams.state] - ); + setData(transformedData); + setTotalCount(permittedData.count); + } + setIsLoading(false); + }, [ + qParams.page, + qParams.search, + qParams.state, + qParams.district, + qParams.local_body, + qParams.facility_type, + qParams.kasp_empanelled, + permittedDataRes, + permittedData, + ]); - useAbortableEffect( - (status: statusType) => { - fetchStateName(status); - }, - [fetchStateName] - ); + useEffect(() => { + permittedFacilitiesFetch(); + }, [permittedFacilitiesFetch]); - const fetchDistrictName = useCallback( - async (status: statusType) => { - const res = - Number(qParams.district) && - (await dispatchAction(getDistrict(qParams.district))); - if (!status.aborted) { - setDistrictName(res?.data?.name); + useQuery(routes.getState, { + pathParams: { + id: qParams.state, + }, + prefetch: qParams.state !== undefined, + onResponse: ({ res, data }) => { + if (res?.ok && data) { + setStateName(data.name); } }, - [dispatchAction, qParams.district] - ); + }); - useAbortableEffect( - (status: statusType) => { - fetchDistrictName(status); + useQuery(routes.getDistrict, { + pathParams: { + id: qParams.district, }, - [fetchDistrictName] - ); - - const fetchLocalbodyName = useCallback( - async (status: statusType) => { - const res = - Number(qParams.local_body) && - (await dispatchAction(getLocalBody({ id: qParams.local_body }))); - if (!status.aborted) { - setLocalbodyName(res?.data?.name); + prefetch: qParams.district !== undefined, + onResponse: ({ res, data }) => { + if (res?.ok && data) { + setDistrictName(data.name); } }, - [dispatchAction, qParams.local_body] - ); + }); - useAbortableEffect( - (status: statusType) => { - fetchLocalbodyName(status); + useQuery(routes.getLocalBody, { + pathParams: { + id: qParams.local_body, }, - [fetchLocalbodyName] - ); + prefetch: qParams.local_body !== undefined, + onResponse: ({ res, data }) => { + if (res?.ok && data) { + setLocalbodyName(data.name); + } + }, + }); const findFacilityTypeById = (id: number) => { const facility_type = FACILITY_TYPES.find((type) => type.id == id); diff --git a/src/Components/Facility/InventoryList.tsx b/src/Components/Facility/InventoryList.tsx index 26f1af87191..52b63a69e70 100644 --- a/src/Components/Facility/InventoryList.tsx +++ b/src/Components/Facility/InventoryList.tsx @@ -1,19 +1,18 @@ -import { useState, useCallback, useEffect, lazy } from "react"; +import { useState, useEffect, lazy } from "react"; import { navigate } from "raviger"; -import { useDispatch } from "react-redux"; -import { statusType, useAbortableEffect } from "../../Common/utils"; -import { getInventorySummary, getAnyFacility } from "../../Redux/actions"; import Pagination from "../Common/Pagination"; import { classNames } from "../../Utils/utils"; import Page from "../Common/components/Page"; import ButtonV2 from "../Common/components/ButtonV2"; import { NonReadOnlyUsers } from "../../Utils/AuthorizeFor"; +import useQuery from "../../Utils/request/useQuery"; +import routes from "../../Redux/api"; +import request from "../../Utils/request/request"; const Loading = lazy(() => import("../Common/Loading")); export default function InventoryList(props: any) { const { facilityId }: any = props; - const dispatchAction: any = useDispatch(); const [isLoading, setIsLoading] = useState(false); const initialInventory: any[] = []; let inventoryItem: any = null; @@ -24,42 +23,39 @@ export default function InventoryList(props: any) { const [facilityName, setFacilityName] = useState(""); const limit = 14; - const fetchData = useCallback( - async (status: statusType) => { + useQuery(routes.getInventorySummary, { + query: { + limit, + offset, + }, + pathParams: { + id: facilityId, + }, + onResponse: ({ res, data }) => { setIsLoading(true); - const res = await dispatchAction( - getInventorySummary(facilityId, { limit, offset }) - ); - if (!status.aborted) { - if (res?.data) { - setInventory(res.data.results); - setTotalCount(res.data.count); - } - setIsLoading(false); + if (res?.ok && data) { + setInventory(data.results); + setTotalCount(data.count); } + setIsLoading(false); }, - [dispatchAction, offset, facilityId] - ); - - useAbortableEffect( - (status: statusType) => { - fetchData(status); - }, - [fetchData] - ); + }); useEffect(() => { async function fetchFacilityName() { if (facilityId) { - const res = await dispatchAction(getAnyFacility(facilityId)); - - setFacilityName(res?.data?.name || ""); + const { res, data } = await request(routes.getAnyFacility, { + pathParams: { + id: facilityId, + }, + }); + if (res?.ok && data) setFacilityName(data.name || ""); } else { setFacilityName(""); } } fetchFacilityName(); - }, [dispatchAction, facilityId]); + }, [facilityId]); const handlePagination = (page: number, limit: number) => { const offset = (page - 1) * limit; diff --git a/src/Components/Facility/InventoryLog.tsx b/src/Components/Facility/InventoryLog.tsx index 5518b5e320f..8d1928b8b97 100644 --- a/src/Components/Facility/InventoryLog.tsx +++ b/src/Components/Facility/InventoryLog.tsx @@ -1,25 +1,19 @@ -import { useState, useCallback, useEffect, lazy } from "react"; +import { useState, useEffect, lazy } from "react"; import * as Notification from "../../Utils/Notifications.js"; -import { useDispatch } from "react-redux"; -import { - getInventoryLog, - flagInventoryItem, - deleteLastInventoryLog, - getAnyFacility, -} from "../../Redux/actions"; -import { statusType, useAbortableEffect } from "../../Common/utils"; import Pagination from "../Common/Pagination"; import { formatDateTime } from "../../Utils/utils"; import Page from "../Common/components/Page.js"; import CareIcon from "../../CAREUI/icons/CareIcon.js"; import ButtonV2 from "../Common/components/ButtonV2.js"; +import useQuery from "../../Utils/request/useQuery.js"; +import routes from "../../Redux/api.js"; +import request from "../../Utils/request/request.js"; const Loading = lazy(() => import("../Common/Loading")); export default function InventoryLog(props: any) { const { facilityId, inventoryId }: any = props; - const dispatchAction: any = useDispatch(); const [isLoading, setIsLoading] = useState(false); const [saving, setSaving] = useState(false); const initialInventory: any[] = []; @@ -34,81 +28,87 @@ export default function InventoryLog(props: any) { const [itemName, setItemName] = useState(" "); const [facilityName, setFacilityName] = useState(""); - const fetchData = useCallback( - async (status: statusType) => { + const { refetch } = useQuery(routes.getInventoryLog, { + query: { + item: item, + limit: limit, + name: facilityName, + offset: offset, + }, + pathParams: { + id: facilityId, + }, + prefetch: facilityId !== undefined, + onResponse: ({ res, data }) => { setIsLoading(true); - const res = await dispatchAction( - getInventoryLog(facilityId, { item, limit, offset }) - ); - if (!status.aborted) { - if (res?.data) { - setInventory(res.data.results); - setCurrentStock(res.data.results[0].current_stock); - setTotalCount(res.data.count); - setItemName(res.data.results[0].item_object.name); - } - setIsLoading(false); + if (res?.ok && data) { + setInventory(data.results); + setCurrentStock(data.results[0].current_stock); + setTotalCount(data.count); + setItemName(data.results[0].item_object.name); } + setIsLoading(false); }, - [dispatchAction, offset, facilityId] - ); + }); useEffect(() => { async function fetchFacilityName() { if (facilityId) { - const res = await dispatchAction(getAnyFacility(facilityId)); + const { res, data } = await request(routes.getAnyFacility, { + pathParams: { + id: facilityId, + }, + }); - setFacilityName(res?.data?.name || ""); + if (res?.ok && data) setFacilityName(data.name || ""); } else { setFacilityName(""); } } fetchFacilityName(); - }, [dispatchAction, facilityId]); + }, [facilityId]); const flagFacility = async (id: string) => { setSaving(true); - const res = await dispatchAction( - flagInventoryItem({ facility_external_id: facilityId, external_id: id }) - ); - - if (res && res.status === 204) { + // request body is not given in the dispath call + const { res } = await request(routes.flagInventoryItem, { + pathParams: { + facility_external_id: facilityId, + external_id: id, + }, + }); + if (res?.ok && res.status === 204) { Notification.Success({ msg: "Updated Successfully", }); - fetchData({ aborted: false }); + refetch(); } setSaving(false); }; const removeLastInventoryLog = async (id: any) => { setSaving(true); - const res = await dispatchAction( - deleteLastInventoryLog({ + // API call not matching with documentation. Extra pathparam given in this file for dispatch call + const { res, data } = await request(routes.deleteLastInventoryLog, { + pathParams: { facility_external_id: facilityId, id: id, - }) - ); + }, + }); - if (res?.status === 201) { + if (res?.ok && res?.status === 201) { Notification.Success({ msg: "Last entry deleted Successfully", }); - fetchData({ aborted: false }); + refetch(); } else { Notification.Error({ - msg: "Error while deleting last entry: " + (res?.data?.detail || ""), + msg: "Error while deleting last entry: " + (data?.detail || ""), }); } setSaving(false); }; - useAbortableEffect( - (status: statusType) => { - fetchData(status); - }, - [fetchData] - ); const handlePagination = (page: number, limit: number) => { const offset = (page - 1) * limit; setCurrentPage(page); diff --git a/src/Components/Facility/LegacyFacilityCNS.tsx b/src/Components/Facility/LegacyFacilityCNS.tsx index 5b0005c9daf..6f10a82de0d 100644 --- a/src/Components/Facility/LegacyFacilityCNS.tsx +++ b/src/Components/Facility/LegacyFacilityCNS.tsx @@ -1,12 +1,6 @@ import { navigate } from "raviger"; import { useEffect, useState } from "react"; -import { useDispatch } from "react-redux"; import CareIcon from "../../CAREUI/icons/CareIcon"; -import { - getAllPatient, - getPermittedFacility, - listAssetBeds, -} from "../../Redux/actions"; import { classNames } from "../../Utils/utils"; import { AssetData, AssetLocationObject } from "../Assets/AssetTypes"; import ButtonV2, { Cancel, Submit } from "../Common/components/ButtonV2"; @@ -19,6 +13,8 @@ import AutocompleteFormField from "../Form/FormFields/Autocomplete"; import { uniqBy } from "lodash-es"; import DialogModal from "../Common/Dialog"; import { LegacyMonitorCard } from "./LegacyMonitorCard"; +import request from "../../Utils/request/request"; +import routes from "../../Redux/api"; interface Monitor { patient: PatientModel; @@ -34,7 +30,6 @@ export default function LegacyFacilityCNS({ }: { facilityId: string; }) { - const dispatch = useDispatch(); const [isFullscreen, setIsFullscreen] = useState(false); const [monitors, setMonitors] = useState(); const [facility, setFacility] = useState(); @@ -61,25 +56,76 @@ export default function LegacyFacilityCNS({ useEffect(() => { async function fetchFacility() { - const res = await dispatch(getPermittedFacility(facilityId || "")); - if (res.status === 200) setFacility(res.data); + const { res, data } = await request(routes.getPermittedFacility, { + pathParams: { facilityId }, + }); + if (res?.ok && res?.status === 200 && data) { + const updateData = { + id: Number(data.id), + name: data.name, + district: data.district_object.id, + read_cover_image_url: data.read_cover_image_url, + facility_type: data.facility_type.toString(), + address: data.address, + features: data.features, + location: { + latitude: Number(data.latitude), + longitude: Number(data.longitude), + }, + oxygen_capacity: data.oxygen_capacity, + phone_number: data.phone_number, + type_b_cylinders: data.type_b_cylinders, + type_c_cylinders: data.type_c_cylinders, + type_d_cylinders: data.type_d_cylinders, + middleware_address: data.middleware_address, + expected_type_b_cylinders: data.expected_type_b_cylinders, + expected_type_c_cylinders: data.expected_type_c_cylinders, + expected_type_d_cylinders: data.expected_type_d_cylinders, + expected_oxygen_requirement: data.expected_oxygen_requirement, + local_body_object: { + name: data.local_body_object.name, + body_type: data.local_body_object.body_type, + localbody_code: data.local_body_object.localbody_code, + district: data.local_body_object.district, + }, + district_object: { + id: data.district_object.id, + name: data.district_object.name, + state: data.district_object.state, + }, + state_object: { + id: data.state_object.id, + name: data.state_object.name, + }, + ward_object: { + id: data.ward_object.id, + name: data.ward_object.name, + number: data.ward_object.number, + local_body: data.ward_object.local_body, + }, + modified_date: data.modified_date, + created_date: data.created_date, + }; + + setFacility(updateData); + } } fetchFacility(); - }, [facilityId, dispatch]); + }, [facilityId]); useEffect(() => { if (!facility) return; const middlewareHostname = facility.middleware_address; async function fetchPatients() { - const res = await dispatch( - getAllPatient( - { facility: facilityId, is_active: "True" }, - "cns-patient-list" - ) - ); - if (res.status === 200) { - const patients = res.data.results as PatientModel[]; + const { res, data } = await request(routes.patientList, { + query: { + facility: facilityId, + is_active: true, + }, + }); + if (res?.ok && res.status === 200 && data) { + const patients = data as PatientModel[]; return patients.filter( (patient) => !!patient.last_consultation?.current_bed?.bed_object.id ); @@ -87,27 +133,25 @@ export default function LegacyFacilityCNS({ } async function fetchPatientMonitorAsset(patient: PatientModel) { - const res = await dispatch( - listAssetBeds( - { - bed: patient.last_consultation?.current_bed?.bed_object?.id, - }, - `asset-bed-${patient.id}` - ) - ); + // Request body in API documentation is not matching with request body of dispatch call + const { res, data } = await request(routes.listAssetBeds, { + query: { id: `asset-bed-${patient.id}` }, + pathParams: { + bed: patient.last_consultation?.current_bed?.bed_object?.id || "", + }, + }); + if (res?.status === 200 && data) { + const asset = data.results.find( + (assetBed: any) => + assetBed.asset_object.meta?.asset_type === "HL7MONITOR" + )?.asset_object as AssetData | undefined; - if (res.status !== 200) return; + if (!asset) return; - const asset = res.data.results.find( - (assetBed: any) => - assetBed.asset_object.meta?.asset_type === "HL7MONITOR" - )?.asset_object as AssetData | undefined; + const socketUrl = `wss://${middlewareHostname}/observations/${asset.meta?.local_ip_address}`; - if (!asset) return; - - const socketUrl = `wss://${middlewareHostname}/observations/${asset.meta?.local_ip_address}`; - - return { patient, asset, socketUrl } as Monitor; + return { patient, asset, socketUrl } as Monitor; + } } async function fetchMonitors() { @@ -130,7 +174,7 @@ export default function LegacyFacilityCNS({ }, CNS_REFRESH_INTERVAL); return () => clearInterval(interval); - }, [dispatch, facility, facilityId]); + }, [facility, facilityId]); if (!monitors) return ; return ( diff --git a/src/Components/Facility/MinQuantityList.tsx b/src/Components/Facility/MinQuantityList.tsx index 631f432a9dc..bc66dad0e2d 100644 --- a/src/Components/Facility/MinQuantityList.tsx +++ b/src/Components/Facility/MinQuantityList.tsx @@ -1,18 +1,16 @@ -import { useCallback, useState, useEffect, lazy } from "react"; -import { useDispatch } from "react-redux"; - -import { statusType, useAbortableEffect } from "../../Common/utils"; -import { getMinQuantity, getAnyFacility } from "../../Redux/actions"; +import { useState, useEffect, lazy } from "react"; import Pagination from "../Common/Pagination"; import { MinQuantityRequiredModal } from "./MinQuantityRequiredModal"; import ButtonV2 from "../Common/components/ButtonV2"; import { NonReadOnlyUsers } from "../../Utils/AuthorizeFor"; import Page from "../Common/components/Page"; +import request from "../../Utils/request/request"; +import routes from "../../Redux/api"; +import useQuery from "../../Utils/request/useQuery"; const Loading = lazy(() => import("../Common/Loading")); export default function MinQuantityList(props: any) { const { facilityId }: any = props; - const dispatchAction: any = useDispatch(); const [isLoading, setIsLoading] = useState(false); const initialInventory: any[] = []; let inventoryItem: any = null; @@ -26,42 +24,39 @@ export default function MinQuantityList(props: any) { const [selectedItem, setSelectedItem] = useState({ id: 0, item_id: 0 }); const limit = 14; - const fetchData = useCallback( - async (status: statusType) => { + const { refetch } = useQuery(routes.getMinQuantity, { + query: { + limit: limit, + offset: offset, + }, + pathParams: { + id: facilityId, + }, + onResponse: ({ res, data }) => { setIsLoading(true); - const res = await dispatchAction( - getMinQuantity(facilityId, { limit, offset }) - ); - if (!status.aborted) { - if (res && res.data) { - setInventory(res.data.results); - setTotalCount(res.data.count); - } - setIsLoading(false); + if (res?.ok && data) { + setInventory(data.results); + setTotalCount(data.count); } + setIsLoading(false); }, - [dispatchAction, offset, facilityId] - ); - - useAbortableEffect( - (status: statusType) => { - fetchData(status); - }, - [fetchData] - ); + }); useEffect(() => { async function fetchFacilityName() { if (facilityId) { - const res = await dispatchAction(getAnyFacility(facilityId)); - - setFacilityName(res?.data?.name || ""); + const { res, data } = await request(routes.getAnyFacility, { + pathParams: { + id: facilityId, + }, + }); + if (res?.ok && data) setFacilityName(data.name || ""); } else { setFacilityName(""); } } fetchFacilityName(); - }, [dispatchAction, facilityId]); + }, [facilityId]); const handlePagination = (page: number, limit: number) => { const offset = (page - 1) * limit; @@ -236,7 +231,7 @@ export default function MinQuantityList(props: any) { show={showMinQuantityRequiredModal} handleClose={() => setShowMinQuantityRequiredModal(false)} handleUpdate={() => { - fetchData({ aborted: false }); + refetch(); setShowMinQuantityRequiredModal(false); }} /> diff --git a/src/Components/Facility/MinQuantityRequiredModal.tsx b/src/Components/Facility/MinQuantityRequiredModal.tsx index d076b65f076..aa0dafcdc06 100644 --- a/src/Components/Facility/MinQuantityRequiredModal.tsx +++ b/src/Components/Facility/MinQuantityRequiredModal.tsx @@ -1,15 +1,11 @@ -import { useCallback, useReducer, useState } from "react"; -import { useDispatch } from "react-redux"; -import { statusType, useAbortableEffect } from "../../Common/utils"; -import { - updateMinQuantity, - getAnyFacility, - getMinQuantityOfItem, -} from "../../Redux/actions"; +import { useEffect, useReducer, useState } from "react"; import * as Notification from "../../Utils/Notifications.js"; import ButtonV2 from "../Common/components/ButtonV2"; import DialogModal from "../Common/Dialog"; import TextFormField from "../Form/FormFields/TextFormField"; +import request from "../../Utils/request/request"; +import routes from "../../Redux/api"; +import useQuery from "../../Utils/request/useQuery"; const initForm = { id: "", @@ -42,56 +38,65 @@ export const MinQuantityRequiredModal = (props: any) => { const [state, dispatch] = useReducer(inventoryFormReducer, initialState); const { facilityId, inventoryId, itemId, show, handleClose, handleUpdate } = props; - const dispatchAction: any = useDispatch(); const [isLoading, setIsLoading] = useState(false); const [data, setData] = useState(" "); const [facilityName, setFacilityName] = useState(""); - const fetchData = useCallback( - async (status: statusType) => { + const { + res: minQuantityRes, + data: minQuantityData, + refetch: minQuantityFetch, + } = useQuery(routes.getMinQuantityOfItem, { + pathParams: { + id: facilityId, + external_id: inventoryId, + }, + }); + + useEffect(() => { + const fetchData = async () => { setIsLoading(true); - const res = await dispatchAction( - getMinQuantityOfItem(facilityId, inventoryId) - ); - if (!status.aborted) { - if (res && res.data) { - setData(res.data.item_object.name); - const form = { ...state.form, quantity: res.data.min_quantity }; - dispatch({ type: "set_form", form }); - } - if (facilityId) { - const res = await dispatchAction(getAnyFacility(facilityId)); + if (minQuantityRes && minQuantityData) { + setData(minQuantityData.item_object.name); + const form = { ...state.form, quantity: minQuantityData.min_quantity }; + dispatch({ type: "set_form", form }); + } + if (facilityId) { + const { res, data } = await request(routes.getAnyFacility, { + pathParams: { + id: facilityId, + }, + }); + if (res?.ok && data) setFacilityName(data.name || ""); + } else { + setFacilityName(""); + } - setFacilityName(res?.data?.name || ""); - } else { - setFacilityName(""); - } + setIsLoading(false); + }; + if (minQuantityRes?.ok && minQuantityData) fetchData(); + }, [facilityId, inventoryId, minQuantityData, minQuantityRes, state.form]); - setIsLoading(false); - } - }, - [dispatchAction, facilityId, inventoryId] - ); - useAbortableEffect( - (status: statusType) => { - fetchData(status); - }, - [fetchData] - ); + useEffect(() => { + minQuantityFetch(); + }, [minQuantityFetch]); const handleSubmit = async (e: any) => { e.preventDefault(); setIsLoading(true); - const data: any = { - min_quantity: Number(state.form.quantity), - item: Number(itemId), - }; - const res = await dispatchAction( - updateMinQuantity(data, { facilityId, inventoryId }) - ); + const { res, data } = await request(routes.updateMinQuantity, { + body: { + min_quantity: Number(state.form.quantity), + item: Number(itemId), + }, + pathParams: { + facilityId: facilityId, + inventoryId: inventoryId, + }, + }); setIsLoading(false); - if (res && res.data) { + if (res?.ok && data) { Notification.Success({ msg: "Minimum quantity updated successfully", }); diff --git a/src/Components/Facility/SetInventoryForm.tsx b/src/Components/Facility/SetInventoryForm.tsx index d0a275e41ba..86a493dee08 100644 --- a/src/Components/Facility/SetInventoryForm.tsx +++ b/src/Components/Facility/SetInventoryForm.tsx @@ -1,13 +1,4 @@ -import { useCallback, useReducer, useState, useEffect, lazy } from "react"; -import { useDispatch } from "react-redux"; - -import { statusType, useAbortableEffect } from "../../Common/utils"; -import { - getItems, - setMinQuantity, - getAnyFacility, - getMinQuantity, -} from "../../Redux/actions"; +import { useReducer, useState, useEffect, lazy } from "react"; import * as Notification from "../../Utils/Notifications.js"; import { InventoryItemsModel } from "./models"; import { Cancel, Submit } from "../Common/components/ButtonV2"; @@ -17,6 +8,9 @@ import Card from "../../CAREUI/display/Card"; import { FieldChangeEvent } from "../Form/FormFields/Utils"; import { SelectFormField } from "../Form/FormFields/SelectFormField"; import TextFormField from "../Form/FormFields/TextFormField"; +import request from "../../Utils/request/request"; +import routes from "../../Redux/api"; +import useQuery from "../../Utils/request/useQuery"; const Loading = lazy(() => import("../Common/Loading")); const initForm = { @@ -50,7 +44,6 @@ export const SetInventoryForm = (props: any) => { const { goBack } = useAppHistory(); const [state, dispatch] = useReducer(inventoryFormReducer, initialState); const { facilityId } = props; - const dispatchAction: any = useDispatch(); const [isLoading, setIsLoading] = useState(false); const [data, setData] = useState>([]); const [currentUnit, setCurrentUnit] = useState(); @@ -59,56 +52,76 @@ export const SetInventoryForm = (props: any) => { const limit = 14; const offset = 0; - const fetchData = useCallback( - async (status: statusType) => { - setIsLoading(true); + const { + res: minQuantityRes, + data: minQuantityData, + refetch: minQuantityFetch, + } = useQuery(routes.getMinQuantity, { + pathParams: { + id: facilityId, + }, + }); + useEffect(() => { + const fetchData = async () => { + setIsLoading(true); const existingItemIDs: number[] = []; - const resMinQuantity = await dispatchAction( - getMinQuantity(facilityId, {}) - ); - - resMinQuantity.data.results.map((item: any) => - existingItemIDs.push(item.item_object.id) - ); - - const res = await dispatchAction(getItems({ limit, offset })); - - if (!status.aborted) { - if (res && res.data) { - const filteredData = res.data.results.filter( - (item: any) => !existingItemIDs.includes(item.id) - ); - setData(filteredData); - dispatch({ - type: "set_form", - form: { ...state.form, id: filteredData[0]?.id }, - }); - } - setIsLoading(false); + if (minQuantityRes?.ok && minQuantityData) { + minQuantityData.results.map((item: any) => + existingItemIDs.push(item.item_object.id) + ); } - }, - [dispatchAction] - ); - useAbortableEffect( - (status: statusType) => { - fetchData(status); - }, - [fetchData] - ); + const { res, data } = await request(routes.getItems, { + query: { + limit: limit, + offset: offset, + }, + }); + if (res?.ok && data) { + const filteredData = data.results.filter( + (item: any) => !existingItemIDs.includes(item.id) + ); + const transformedData = filteredData.map((item) => { + const allowedUnits = item.allowed_units || []; + return { + id: item.id, + name: item.name, + default_unit: item.default_unit, + allowedUnits, + }; + }); + + setData(transformedData); + + dispatch({ + type: "set_form", + form: { ...state.form, id: filteredData[0]?.id }, + }); + } + setIsLoading(false); + }; + if (minQuantityRes && minQuantityData) fetchData(); + }, [minQuantityData, minQuantityRes, state.form]); + + useEffect(() => { + minQuantityFetch(); + }, [minQuantityFetch]); useEffect(() => { async function fetchFacilityName() { if (facilityId) { - const res = await dispatchAction(getAnyFacility(facilityId)); - - setFacilityName(res?.data?.name || ""); + const { res, data } = await request(routes.getAnyFacility, { + pathParams: { + id: facilityId, + }, + }); + if (res && data) setFacilityName(data.name || ""); } else { setFacilityName(""); } } fetchFacilityName(); - }, [dispatchAction, facilityId]); + }, [facilityId]); useEffect(() => { // set the default units according to the item @@ -125,14 +138,17 @@ export const SetInventoryForm = (props: any) => { const handleSubmit = async (e: any) => { e.preventDefault(); setIsLoading(true); - const data: any = { - min_quantity: Number(state.form.quantity), - item: Number(state.form.id), - }; - - const res = await dispatchAction(setMinQuantity(data, { facilityId })); + const { res, data } = await request(routes.setMinQuantity, { + body: { + min_quantity: Number(state.form.quantity), + item: Number(state.form.id), + }, + pathParams: { + facilityId: facilityId, + }, + }); setIsLoading(false); - if (res && res.data && res.data.id) { + if (res && data && data.id) { Notification.Success({ msg: "Minimum quantiy updated successfully", }); diff --git a/src/Components/Facility/TransferPatientDialog.tsx b/src/Components/Facility/TransferPatientDialog.tsx index 632765c2492..dd832edf3c5 100644 --- a/src/Components/Facility/TransferPatientDialog.tsx +++ b/src/Components/Facility/TransferPatientDialog.tsx @@ -9,10 +9,10 @@ import { FieldLabel } from "../Form/FormFields/FormField"; import { OptionsType } from "../../Common/constants"; import { SelectFormField } from "../Form/FormFields/SelectFormField"; import { navigate } from "raviger"; -import { transferPatient } from "../../Redux/actions"; -import { useDispatch } from "react-redux"; import { dateQueryString } from "../../Utils/utils.js"; import dayjs from "dayjs"; +import request from "../../Utils/request/request.js"; +import routes from "../../Redux/api.js"; interface Props { patientList: Array; @@ -60,7 +60,6 @@ const patientFormReducer = (state = initialState, action: any) => { const TransferPatientDialog = (props: Props) => { const { patientList, handleOk, handleCancel, facilityId } = props; - const dispatchAction: any = useDispatch(); const [isLoading, setIsLoading] = useState(false); const [state, dispatch] = useReducer(patientFormReducer, initialState); const patientOptions: Array = patientList.map((patient) => { @@ -114,25 +113,27 @@ const TransferPatientDialog = (props: Props) => { const validForm = validateForm(); if (validForm) { setIsLoading(true); - const data = { - date_of_birth: dateQueryString(state.form.date_of_birth), - facility: facilityId, - }; - const res = await dispatchAction( - transferPatient(data, { id: state.form.patient }) - ); + const { res, data } = await request(routes.transferPatient, { + body: { + date_of_birth: dateQueryString(state.form.date_of_birth), + facility: facilityId, + }, + pathParams: { + id: state.form.patient, + }, + }); setIsLoading(false); - if (res && res.data && res.status === 200) { + if (res?.ok && data && res.status === 200) { dispatch({ type: "set_form", form: initForm }); handleOk(); Notification.Success({ - msg: `Patient ${res.data.patient} transferred successfully`, + msg: `Patient ${data.patient} transferred successfully`, }); const newFacilityId = - res.data && res.data.facility_object && res.data.facility_object.id; + data && data.facility_object && data.facility_object.id; if (newFacilityId) { navigate( - `/facility/${newFacilityId}/patient/${res.data.patient}/consultation` + `/facility/${newFacilityId}/patient/${data.patient}/consultation` ); } else { navigate("/facility"); diff --git a/src/Components/Facility/TreatmentSummary.tsx b/src/Components/Facility/TreatmentSummary.tsx index 3fbd80ac8b2..fb9a652b361 100644 --- a/src/Components/Facility/TreatmentSummary.tsx +++ b/src/Components/Facility/TreatmentSummary.tsx @@ -1,22 +1,16 @@ -import { lazy, useCallback, useState } from "react"; -import { useDispatch } from "react-redux"; -import { - getPatient, - getInvestigation, - getConsultation, -} from "../../Redux/actions"; +import { lazy, useEffect, useState } from "react"; import { ConsultationModel } from "./models"; -import { statusType, useAbortableEffect } from "../../Common/utils"; import { PatientModel } from "../Patient/models"; import { GENDER_TYPES } from "../../Common/constants"; import { formatAge, formatDate, formatDateTime } from "../../Utils/utils"; +import routes from "../../Redux/api"; +import useQuery from "../../Utils/request/useQuery"; const Loading = lazy(() => import("../Common/Loading")); const TreatmentSummary = (props: any) => { const { consultationId, patientId } = props; const date = new Date(); - const dispatch: any = useDispatch(); const [patientData, setPatientData] = useState({}); const [consultationData, setConsultationData] = useState( {} @@ -25,70 +19,60 @@ const TreatmentSummary = (props: any) => { const [investigations, setInvestigations] = useState>([]); const [dailyRounds, setDailyRounds] = useState({}); - const fetchPatientData = useCallback( - async (status: statusType) => { + const { refetch: patientFetch } = useQuery(routes.getPatient, { + pathParams: { + id: patientId, + }, + prefetch: patientId !== undefined, + onResponse: ({ res, data }) => { setIsLoading(true); - const res = await dispatch(getPatient({ id: patientId })); - if (!status.aborted) { - if (res?.data) { - setPatientData(res.data); - } else { - setPatientData({}); - } + if (res?.ok && data) { + setPatientData(data); } setIsLoading(false); }, - [patientId, dispatch] - ); + }); - const fetchInvestigationData = useCallback( - async (status: statusType) => { + const { refetch: investigationFetch } = useQuery(routes.getInvestigation, { + pathParams: { + consultation_external_id: consultationId, + }, + prefetch: consultationId !== undefined, + onResponse: ({ res, data }) => { setIsLoading(true); - const res = await dispatch(getInvestigation({}, consultationId)); - - if (!status.aborted) { - if (res?.data?.results) { - const valueMap = res.data.results.reduce( - (acc: any, cur: { id: any }) => ({ ...acc, [cur.id]: cur }), - {} - ); - setInvestigations(valueMap); - } else { - setInvestigations([]); - } + if (res?.ok && data) { + const valueMap = data.results.reduce( + (acc: any, cur: { id: any }) => ({ ...acc, [cur.id]: cur }), + {} + ); + setInvestigations(valueMap); } setIsLoading(false); }, - [consultationId, dispatch] - ); + }); - const fetchConsultation = useCallback( - async (status: statusType) => { + const { refetch: consultationFetch } = useQuery(routes.getConsultation, { + pathParams: { + id: consultationId, + }, + prefetch: consultationId !== undefined, + onResponse: ({ res, data }) => { setIsLoading(true); - const [res] = await Promise.all([ - dispatch(getConsultation(consultationId)), - ]); - if (!status.aborted) { - if (res?.data) { - setConsultationData(res.data); - if (res.data.last_daily_round) { - setDailyRounds(res.data.last_daily_round); - } - } else { - setConsultationData({}); + if (res?.ok && data) { + setConsultationData(data); + if (data.last_daily_round) { + setDailyRounds(data.last_daily_round); // added last_daily_rounds in model(not present in documentation) } } setIsLoading(false); }, - [consultationId, dispatch] - ); - - useAbortableEffect((status: statusType) => { - fetchPatientData(status); - fetchInvestigationData(status); + }); - fetchConsultation(status); - }, []); + useEffect(() => { + patientFetch(); + investigationFetch(); + consultationFetch(); + }, [patientFetch, investigationFetch, consultationFetch]); return (
diff --git a/src/Components/Facility/TriageForm.tsx b/src/Components/Facility/TriageForm.tsx index 3c8e6b1497b..4061e73055a 100644 --- a/src/Components/Facility/TriageForm.tsx +++ b/src/Components/Facility/TriageForm.tsx @@ -1,16 +1,7 @@ import ConfirmDialog from "../Common/ConfirmDialog"; import Card from "../../CAREUI/display/Card"; - import CareIcon from "../../CAREUI/icons/CareIcon"; -import { useCallback, useReducer, useState, useEffect, lazy } from "react"; -import { useDispatch } from "react-redux"; -import { statusType, useAbortableEffect } from "../../Common/utils"; -import { - createTriageForm, - getTriageDetails, - getAnyFacility, - getTriageInfo, -} from "../../Redux/actions"; +import { useReducer, useState, useEffect, lazy } from "react"; import * as Notification from "../../Utils/Notifications.js"; import TextFormField from "../Form/FormFields/TextFormField"; import { PatientStatsModel } from "./models"; @@ -22,6 +13,9 @@ const Loading = lazy(() => import("../Common/Loading")); import Page from "../Common/components/Page"; import dayjs from "dayjs"; import { dateQueryString } from "../../Utils/utils"; +import useQuery from "../../Utils/request/useQuery"; +import routes from "../../Redux/api"; +import request from "../../Utils/request/request"; interface triageFormProps extends PatientStatsModel { facilityId: number; @@ -63,8 +57,6 @@ const triageFormReducer = (state = initialState, action: any) => { export const TriageForm = (props: triageFormProps) => { const { goBack } = useAppHistory(); - const dispatchTriageData: any = useDispatch(); - const dispatchAction: any = useDispatch(); const { facilityId, id } = props; const [state, dispatch] = useReducer(triageFormReducer, initialState); const [isLoading, setIsLoading] = useState(false); @@ -77,83 +69,76 @@ export const TriageForm = (props: triageFormProps) => { const headerText = !id ? "Add Triage" : "Edit Triage"; const buttonText = !id ? "Save Triage" : "Update Triage"; - const fetchData = useCallback( - async (status: statusType) => { + useQuery(routes.getTriageDetails, { + pathParams: { + facilityId: String(facilityId), + id: String(id), + }, + prefetch: id !== undefined && facilityId !== undefined, + onResponse: ({ res, data }) => { setIsLoading(true); - if (id) { + if (res?.ok && data) { // Edit Form functionality - const res = await dispatchAction( - getTriageDetails({ facilityId: facilityId, id: id }) - ); - if (!status.aborted && res && res.data) { - dispatch({ - type: "set_form", - form: { - entry_date: res.data.entry_date - ? dayjs(res.data.entry_date).toDate() - : null, - num_patients_visited: res.data.num_patients_visited, - num_patients_home_quarantine: - res.data.num_patients_home_quarantine, - num_patients_isolation: res.data.num_patients_isolation, - num_patient_referred: res.data.num_patient_referred, - num_patient_confirmed_positive: - res.data.num_patient_confirmed_positive, - }, - }); - } + dispatch({ + type: "set_form", + form: { + entry_date: data.entry_date + ? dayjs(data.entry_date).toDate() + : null, + num_patients_visited: data.num_patients_visited, + num_patients_home_quarantine: data.num_patients_home_quarantine, + num_patients_isolation: data.num_patients_isolation, + num_patient_referred: data.num_patient_referred, + num_patient_confirmed_positive: data.num_patient_confirmed_positive, + }, + }); } setIsLoading(false); }, - [dispatchAction, facilityId, id] - ); + }); - useAbortableEffect( - (status: statusType) => { - fetchData(status); + useQuery(routes.getTriage, { + pathParams: { + facilityId: String(facilityId), }, - [dispatch, fetchData, id] - ); - - // this will fetch all triage data of the facility - const fetchTriageData = useCallback( - async (status: statusType) => { - const [triageRes] = await Promise.all([ - dispatchTriageData(getTriageInfo({ facilityId })), - ]); - if (!status.aborted) { - if ( - triageRes && - triageRes.data && - triageRes.data.results && - triageRes.data.results.length - ) { - setPatientStatsData(triageRes.data.results); - } + prefetch: facilityId !== undefined, + onResponse: ({ res, data }) => { + if (res?.ok && data && data.results && data.results.length > 0) { + const firstResult = data.results[0]; + const updatedDataArray: PatientStatsModel[] = [ + { + id: Number(firstResult.id), + entryDate: firstResult.entry_date.toString(), + num_patients_visited: firstResult.num_patients_visited, + num_patients_home_quarantine: + firstResult.num_patients_home_quarantine, + num_patients_isolation: firstResult.num_patients_isolation, + num_patient_referred: firstResult.num_patient_referred, + entry_date: Number(firstResult.entry_date), + num_patient_confirmed_positive: + firstResult.num_patient_confirmed_positive, + }, + ]; + setPatientStatsData(updatedDataArray); } }, - [dispatchTriageData, facilityId] - ); - - useAbortableEffect( - (status: statusType) => { - fetchTriageData(status); - }, - [dispatch, fetchTriageData] - ); + }); useEffect(() => { async function fetchFacilityName() { if (facilityId) { - const res = await dispatchAction(getAnyFacility(facilityId)); - - setFacilityName(res?.data?.name || ""); + const { res, data } = await request(routes.getAnyFacility, { + pathParams: { + id: String(facilityId), + }, + }); + if (res?.ok && data) setFacilityName(data.name || ""); } else { setFacilityName(""); } } fetchFacilityName(); - }, [dispatchAction, facilityId]); + }, [facilityId]); const validateForm = () => { const errors = { ...initForm }; @@ -192,7 +177,7 @@ export const TriageForm = (props: triageFormProps) => { setOpenModalForExistingTriage(false); const validForm = validateForm(); if (validForm) { - const data = { + const requestData = { entry_date: dateQueryString(state.form.entry_date), num_patients_visited: Number(state.form.num_patients_visited), num_patients_home_quarantine: Number( @@ -206,17 +191,20 @@ export const TriageForm = (props: triageFormProps) => { }; //proceed if the triage does not exist or proceed has allowed to proceed after seeing the modal or it's a edit feature of the same date if ( - !isTriageExist(data) || + !isTriageExist(requestData) || openModalForExistingTriage || buttonText === "Update Triage" ) { setOpenModalForExistingTriage(false); setIsLoading(true); - const res = await dispatchAction( - createTriageForm(data, { facilityId }) - ); + const { res, data } = await request(routes.createTriage, { + body: requestData, + pathParams: { + facilityId: String(facilityId), + }, + }); setIsLoading(false); - if (res && res.data) { + if (res?.ok && data) { dispatch({ type: "set_form", form: initForm }); if (id) { Notification.Success({ diff --git a/src/Components/Facility/models.tsx b/src/Components/Facility/models.tsx index f5ddde19d2d..0f375871259 100644 --- a/src/Components/Facility/models.tsx +++ b/src/Components/Facility/models.tsx @@ -3,6 +3,7 @@ import { ProcedureType } from "../Common/prescription-builder/ProcedureBuilder"; import { NormalPrescription, PRNPrescription } from "../Medicine/models"; import { AssetData } from "../Assets/AssetTypes"; import { UserBareMinimum } from "../Users/models"; +import { PaginatedResponse } from "../../Utils/request/types"; export interface LocalBodyModel { name: string; @@ -25,6 +26,10 @@ export interface WardModel { number: number; local_body: number; } +export interface HomeFacilityModel { + id: string; + name: string; +} export interface FacilityModel { id?: number; name?: string; @@ -84,7 +89,7 @@ export type PatientCategory = | "Abnormal" | "Critical"; -export interface ConsultationModel { +export type ConsultationModel = { admission_date?: string; admitted?: boolean; test_id?: string; @@ -147,7 +152,7 @@ export interface ConsultationModel { death_confirmed_doctor?: string; is_readmission?: boolean; medico_legal_case?: boolean; -} +}; export interface PatientStatsModel { id?: number; entryDate?: string; @@ -171,19 +176,11 @@ export interface DupPatientModel { } export interface InventoryItemsModel { - // count?: number; + count?: number; id?: number; name?: string; - default_unit?: { - id: number; - name: string; - }; - allowed_units?: [ - { - id: number; - name: string; - } - ]; + default_unit?: UnitModel; + allowed_units?: UnitModel[]; } export interface LocationModel { @@ -229,3 +226,430 @@ export type ICD11DiagnosisModel = { id: string; label: string; }; + +export interface BaseResponse { + id: string; + created_date: string; + modified_date: string; +} + +type UnitModel = { + id: number; + name: string; +}; + +export type IFacilityNotificationRequest = { + facility?: string; + message?: string; +}; + +export type IFacilityNotificationResponse = { + [key: string]: string; +}; + +export type IStateListResponse = PaginatedResponse; + +export type IDistrictLocalBodyResponse = StateModel & { + state: number; +}; + +export type IFacilityRequest = Omit< + FacilityModel, + | "id" + | "location" + | "local_body_object" + | "district_object" + | "state_object" + | "ward_object" + | "modified_date" + | "created_date" + | "facility_type" +> & { + facility_type?: number; + district_name?: string; + pincode?: string; + state?: number; + local_body?: number; + ward?: number; + kasp_empanelled?: any; + latitude?: string; + longitude?: string; + phone_number?: string | undefined; +}; +export type IFacilityResponse = { + id: string; + name: string; + local_body: number; + district: number; + state: number; + ward_object: WardModel; + local_body_object: { id: number } & LocalBodyModel; + district_object: DistrictModel; + state_object: StateModel; + read_cover_image_url: string; + features: number[]; + patient_count: string; + bed_count: string; + ward: number; + facility_type: number; + address: string; + longitude: string; + latitude: string; + pincode: number; + oxygen_capacity: number; + phone_number: string; + modified_date: string; + created_date: string; + kasp_empanelled: boolean; + middleware_address: string; + expected_oxygen_requirement: number; + type_b_cylinders: number; + type_c_cylinders: number; + type_d_cylinders: number; + expected_type_b_cylinders: number; + expected_type_c_cylinders: number; + expected_type_d_cylinders: number; +}; + +export type IListDoctorResponse = PaginatedResponse<{ + id: string; + area_text: number; + area: number; + count: number; +}>; + +export type IUserListFacilityResponse = { + id: number; + username: string; + first_name: string; + last_name: string; + email: string; + user_type: number; + doctor_qualification: string; + doctor_experience_commenced_on: string; + doctor_medical_council_registration: string; + created_by: string; + home_facility: string; + weekly_working_hours: number; + local_body: number; + district: number; + state: number; + phone_number: string; + alt_phone_number: string; + gender: number; + age: number; + is_superuser: boolean; + verified: boolean; + home_facility_object: HomeFacilityModel; + local_body_object: { id: number } & LocalBodyModel; + district_object: DistrictModel; + state_object: StateModel; + pf_endpoint: string; + pf_p256dh: string; + pf_auth: string; +}; + +export type DeleteModel = { + detail?: string; +}; + +export type IUserFacilityRequest = { + username?: string; + first_name?: string; + last_name?: string; + email?: string; + doctor_qualification?: string; + doctor_experience_commenced_on?: string; + doctor_medical_council_registration?: string; + home_facility?: string; + weekly_working_hours?: number; + phone_number?: string; + alt_phone_number?: string; + gender?: number; + age?: number; +}; + +export type IUserFacilityResponse = IUserListFacilityResponse; + +export type IFacilityUserResponse = { + count: number; + next: string | null; + previous: string | null; + results: { + id: number; + first_name: string; + username: string; + email: string; + last_name: string; + alt_phone_number: string; + user_type: number; + last_login: string; + home_facility_object: HomeFacilityModel; + doctor_qualification: string; + doctor_experience_commenced_on: string; + doctor_medical_council_registration: string; + skills: { + id: string; + name: string; + description: string; + }[]; + }[]; +}; + +export type ILocalBodyResponse = StateModel & { + body_type: number; + localbody_code: string; + district: number; +}; + +export interface InventoryItemObjectModel { + id: number; + default_unit: UnitModel; + allowed_units: UnitModel[]; + tags: UnitModel[]; + name: string; + description: string; + min_quantity: number; +} + +export type IInventorySummaryResponse = PaginatedResponse<{ + id: string; + item_object: InventoryItemObjectModel; + unit_object: UnitModel; + created_date: string; + quantity: number; + is_low: boolean; + item: number; +}>; + +export type IInventoryLogResponse = Omit< + IInventorySummaryResponse, + "results" +> & { + results: { + id: string; + item_object: InventoryItemObjectModel; + unit_object: { + id: number; + name: string; + }; + external_id: string; + current_stock: number; + quantity_in_default_unit: number; + is_incoming: boolean; + probable_accident: boolean; + created_by: number; + }[]; +}; + +export type IFaciclityMinimumQuantityRequest = { + min_quantity?: number; + item?: number; +}; +export type IFaciclityMinimumQuantityResponse = { + id: string; + item_object: InventoryItemObjectModel; + created_date: string; + min_quantity: number; + item: number; +}; + +interface FacilityObjectModel { + id: string; + name: string; + local_body: number; + district: number; + state: number; + ward_object: WardModel; + local_body_object: { id: number } & LocalBodyModel; + district_object: DistrictModel; + state_object: StateModel; + facility_type: string; + read_cover_image_url: string; + features: number[]; + patient_count: string; + bed_count: string; +} + +export type IPatientTransferRequest = { + facility?: string; + date_of_birth?: string; +}; +export type IPatientTransferResponse = { + date_of_birth: string; + patient: string; + facility_object: FacilityObjectModel; +}; + +export type IInvestigationResponse = PaginatedResponse<{ + id: string; + group_object: { + external_id: string; + name: string; + }; + investigation_object: { + external_id: string; + name: string; + unit: string; + ideal_value: string; + min_value: number; + max_value: number; + investigation_type: string; + choices: string; + }; + session_object: { + session_external_id: string; + session_created_date: string; + created_by: number; + }; + value: number; + notes: string; + investigation: number; + group: number; + consultation: number; + session: number; +}>; + +type BedObjectModel = BaseResponse & { + bed_type: number; + location_object: { + id: string; + facility: { + id: string; + name: string; + }; + created_date: string; + modified_date: string; + name: string; + description: string; + location_type: number; + }; + is_occupied: boolean; + name: string; + description: string; + meta: Record; +}; + +export type IConsultationBedResponse = BaseResponse & { + bed_object: BedObjectModel; + assets_objects: Asset[]; + last_daily_round: string; + start_date: string; + end_date: string; + meta: Record; +}; + +type Asset = BaseResponse & { + status: number; + asset_type: number; + location_object: { + id: string; + facility: { + id: string; + name: string; + }; + created_date: string; + modified_date: string; + name: string; + description: string; + location_type: number; + }; + last_service: { + id: string; + edits: ServiceEdit[]; + external_id: string; + created_date: string; + modified_date: string; + serviced_on: string; + note: string; + }; + name: string; + description: string; + asset_class: string; + is_working: boolean; + not_working_reason: string; + serial_number: string; + warranty_details: string; + meta: Record; + vendor_name: string; + support_name: string; + support_phone: string; + support_email: string; + qr_code_id: string; + manufacturer: string; + warranty_amc_end_of_validity: string; +}; + +type ServiceEdit = { + id: string; + edited_by: { + id: number; + first_name: string; + username: string; + email: string; + last_name: string; + user_type: number; + last_login: string; + }; + edited_on: string; + serviced_on: string; + note: string; +}; + +export type ITriageDetailResponse = BaseResponse & { + entry_date: string; + facility: string; + num_patients_visited: number; + num_patients_home_quarantine: number; + num_patients_isolation: number; + num_patient_referred: number; + num_patient_confirmed_positive: number; +}; + +export type IMinQuantityItemResponse = { + id: string; + item_object: InventoryItemObjectModel; + created_date: string; + min_quantity: number; + item: number; +}; + +export type ISetMinQuantityRequest = { + min_quantity?: number; + item?: number; +}; +export type ISetMinQuantityResponse = IMinQuantityItemResponse; + +export type IFlagInventoryItemResponse = { + id: string; + item_object: InventoryItemObjectModel; + unit_object: UnitModel; + external_id: string; + created_date: string; + current_stock: number; + quantity_in_default_unit: number; + quantity: number; + is_incoming: boolean; + probable_accident: boolean; + item: number; + unit: number; + created_by: number; +}; + +export type ICreateTriageRequest = { + entry_date?: string; + num_patients_visited?: number; + num_patients_home_quarantine?: number; + num_patients_isolation?: number; + num_patient_referred?: number; + num_patient_confirmed_positive?: number; +}; +export type ICreateTriageResponse = BaseResponse & { + entry_date: string; + facility: string; + num_patients_visited: number; + num_patients_home_quarantine: number; + num_patients_isolation: number; + num_patient_referred: number; + num_patient_confirmed_positive: number; +}; diff --git a/src/Redux/actions.tsx b/src/Redux/actions.tsx index 15934d0957d..90ff8e493a8 100644 --- a/src/Redux/actions.tsx +++ b/src/Redux/actions.tsx @@ -25,7 +25,6 @@ export const addUser = (params: object) => { export const deleteUser = (username: string) => { return fireRequest("deleteUser", [username], {}); }; - export const checkResetToken = (params: object) => { return fireRequest("checkResetToken", [], params); }; @@ -51,18 +50,6 @@ export const updateUserPnconfig = (params: object, pathParams: object) => { }; // Facility -export const createFacility = (params: object) => { - return fireRequest("createFacility", [], params); -}; -export const updateFacility = (id: string, params: object) => { - return fireRequest("updateFacility", [id], params); -}; -export const partialUpdateFacility = (id: string, params: object) => { - return fireRequest("partialUpdateFacility", [id], params); -}; -export const deleteFacility = (id: string) => { - return fireRequest("deleteFacility", [id], {}); -}; export const deleteFacilityCoverImage = (id: string) => { return fireRequest("deleteFacilityCoverImage", [], {}, { id }); }; @@ -77,39 +64,21 @@ export const getUserListSkills = (pathParam: object) => { export const partialUpdateUser = (username: string, data: any) => { return fireRequest("partialUpdateUser", [], data, { username }); }; -export const getUserListFacility = (pathParam: object) => { - return fireRequest("userListFacility", [], {}, pathParam); -}; export const addUserSkill = (username: string, skill: string) => { return fireRequest("addUserSkill", [], { skill }, { username }); }; -export const addUserFacility = (username: string, facility: string) => { - return fireRequest("addUserFacility", [], { facility }, { username }); -}; - export const deleteUserSkill = (username: string, id: string) => { return fireRequest("deleteUserSkill", [], {}, { username, id }); }; -export const deleteUserFacility = (username: string, facility: string) => { - return fireRequest( - "deleteUserFacility", - [], - { data: { facility } }, - { username } - ); -}; - export const clearHomeFacility = (username: string) => { return fireRequest("clearHomeFacility", [], {}, { username }); }; - -export const getPermittedFacilities = (params: object) => { - return fireRequest("getPermittedFacilities", [], params); +export const getUserListFacility = (pathParam: object) => { + return fireRequest("userListFacility", [], {}, pathParam); }; - export const getAllFacilities = (params: object) => { return fireRequest("getAllFacilities", [], params); }; @@ -117,27 +86,20 @@ export const getAllFacilities = (params: object) => { export const getAllSkills = (params: object) => { return fireRequest("getAllSkills", [], params); }; - -export const getPermittedFacility = (id: number | string, key?: string) => { - return fireRequest("getPermittedFacility", [], {}, { id: id }, key); +export const addUserFacility = (username: string, facility: string) => { + return fireRequest("addUserFacility", [], { facility }, { username }); }; - -export const getAnyFacility = (id: number | string, key?: string) => { - return fireRequest("getAnyFacility", [], {}, { id: id }, key); +export const getOnlineDoctors = () => { + return fireRequest("getOnlineDoctors", [], {}, {}); }; - -export const getFacilityUsers = (id: string, params?: object) => { +export const deleteUserFacility = (username: string, facility: string) => { return fireRequest( - "getFacilityUsers", + "deleteUserFacility", [], - { ...params }, - { facility_id: id } + { data: { facility } }, + { username } ); }; -export const getOnlineDoctors = () => { - return fireRequest("getOnlineDoctors", [], {}, {}); -}; - export const listFacilityAssetLocation = (params: object, pathParam: object) => fireRequest("listFacilityAssetLocation", [], params, pathParam); export const createFacilityAssetLocation = ( @@ -147,6 +109,9 @@ export const createFacilityAssetLocation = ( fireRequest("createFacilityAssetLocation", [], params, { facility_external_id: facility_id, }); +export const getPermittedFacilities = (params: object) => { + return fireRequest("getPermittedFacilities", [], params); +}; export const getFacilityAssetLocation = ( facility_external_id: string, external_id: string @@ -157,6 +122,23 @@ export const getFacilityAssetLocation = ( {}, { facility_external_id, external_id } ); + +export const getPermittedFacility = (id: number | string, key?: string) => { + return fireRequest("getPermittedFacility", [], {}, { id: id }, key); +}; + +export const getAnyFacility = (id: number | string, key?: string) => { + return fireRequest("getAnyFacility", [], {}, { id: id }, key); +}; + +export const getFacilityUsers = (id: string, params?: object) => { + return fireRequest( + "getFacilityUsers", + [], + { ...params }, + { facility_id: id } + ); +}; export const updateFacilityAssetLocation = ( params: object, facility_external_id: string, @@ -369,21 +351,7 @@ export const createDoctor = ( export const deleteDoctor = (id: number, pathParam: object) => { return fireRequest("deleteDoctor", [id], {}, pathParam); }; -export const createTriageForm = (params: object, pathParam: object) => { - return fireRequest("createTriage", [], params, pathParam); -}; -export const getTriageInfo = (pathParam: object) => { - return fireRequest("getTriage", [], {}, pathParam); -}; -export const getTriageDetails = (pathParam: object) => { - return fireRequest("getTriageDetails", [], {}, pathParam); -}; -export const listCapacity = (params: object, pathParam: object) => { - return fireRequest("getCapacity", [], params, pathParam); -}; -export const listDoctor = (params: object, pathParam: object) => { - return fireRequest("listDoctor", [], params, pathParam); -}; + export const getCapacity = (id: number, pathParam: object) => { return fireRequest("getCapacity", [id], {}, pathParam); }; @@ -398,6 +366,12 @@ export const getDoctor = (pathParam: object) => { export const deleteCapacity = (pathParam: object) => { return fireRequest("deleteCapacityBed", [], {}, pathParam); }; +export const listCapacity = (params: object, pathParam: object) => { + return fireRequest("getCapacity", [], params, pathParam); +}; +export const listDoctor = (params: object, pathParam: object) => { + return fireRequest("listDoctor", [], params, pathParam); +}; //Patient export const searchPatient = (params: object) => { @@ -406,24 +380,15 @@ export const searchPatient = (params: object) => { export const searchUser = (params: object) => { return fireRequest("searchUser", [], params); }; -export const getAllPatient = (params: object, altKey: string) => { - return fireRequest("patientList", [], params, null, altKey); -}; export const createPatient = (params: object) => { return fireRequest("addPatient", [], params); }; -export const getPatient = (pathParam: object) => { - return fireRequest("getPatient", [], {}, pathParam); -}; export const updatePatient = (params: object, pathParam: object) => { return fireRequest("updatePatient", [], params, pathParam); }; export const patchPatient = (params: object, pathParam: object) => { return fireRequest("patchPatient", [], params, pathParam); }; -export const transferPatient = (params: object, pathParam: object) => { - return fireRequest("transferPatient", [], params, pathParam); -}; export const getPatientNotes = ( patientId: string, limit: number, @@ -435,14 +400,14 @@ export const addPatientNote = (patientId: string, params: object) => { return fireRequest("addPatientNote", [], params, { patientId }); }; -export const getStates = () => { - return fireRequest("statesList", []); -}; export const getStatesByText = (params: object) => { return fireRequest("statesList", [], params); }; -export const getState = (id: number) => { - return fireRequest("getState", [], {}, { id: id }); +export const getAllPatient = (params: object, altKey: string) => { + return fireRequest("patientList", [], params, null, altKey); +}; +export const getPatient = (pathParam: object) => { + return fireRequest("getPatient", [], {}, pathParam); }; // District/State/Local body/ward @@ -452,6 +417,13 @@ export const getDistrictByState = (pathParam: object) => { export const getDistrictByName = (params: object) => { return fireRequest("getDistrictByName", [], params, null); }; +export const getStates = () => { + return fireRequest("statesList", []); +}; + +export const getLocalbodyByName = (params: object) => { + return fireRequest("getLocalbodyByName", [], params, null); +}; export const getDistrict = (id: number, key?: string) => { return fireRequest("getDistrict", [], {}, { id: id }, key); }; @@ -459,10 +431,6 @@ export const getDistrict = (id: number, key?: string) => { export const getLocalbodyByDistrict = (pathParam: object) => { return fireRequest("getLocalbodyByDistrict", [], {}, pathParam); }; -export const getLocalbodyByName = (params: object) => { - return fireRequest("getLocalbodyByName", [], params, null); -}; - export const getWardByLocalBody = (pathParam: object) => { return fireRequest("getWardByLocalBody", [], {}, pathParam); }; @@ -547,16 +515,10 @@ export const getItems = (params: object) => { export const postInventory = (params: object, pathParams: object) => { return fireRequest("createInventory", [], params, pathParams); }; + export const getInventoryLog = (params: object, pathParams: object) => { return fireRequest("getInventoryLog", [params, "inventory"], pathParams); }; -export const setMinQuantity = (params: object, pathParams: object) => { - return fireRequest("setMinQuantity", [], params, pathParams); -}; -export const getMinQuantity = (facilityId: object, params: object) => { - return fireRequest("getMinQuantity", [facilityId, "min_quantity"], params); -}; - export const getMinQuantityOfItem = ( facilityId: object, externalId: object @@ -568,9 +530,6 @@ export const getMinQuantityOfItem = ( ]); }; -export const updateMinQuantity = (pathParams: object, params: object) => { - return fireRequest("updateMinQuantity", [], pathParams, params); -}; export const getInventorySummary = (facilityId: number, params: object) => { return fireRequest( "getInventorySummary", @@ -582,14 +541,6 @@ export const getItemName = (id: number) => { return fireRequest("getItemName", [id], {}); }; -export const flagInventoryItem = (params: object) => { - return fireRequest("flagInventoryItem", [], {}, params); -}; - -export const deleteLastInventoryLog = (params: object) => { - return fireRequest("deleteLastInventoryLog", [], {}, params); -}; - export const generateDischargeSummary = (pathParams: object) => { return fireRequest("dischargeSummaryGenerate", [], {}, pathParams); }; @@ -697,10 +648,6 @@ export const getPublicKey = () => { return fireRequest("getPublicKey", [], {}, {}); }; -export const sendNotificationMessages = (params: object) => { - return fireRequest("sendNotificationMessages", [], params, {}); -}; - // FileUpload export const createUpload = (params: object) => { @@ -762,7 +709,6 @@ export const getInvestigationSessions = ( consultation_external_id: consultation_external_id, }); }; - export const getInvestigation = ( params: object, consultation_external_id: string diff --git a/src/Redux/api.tsx b/src/Redux/api.tsx index 01c356f6603..48d0bf9f05f 100644 --- a/src/Redux/api.tsx +++ b/src/Redux/api.tsx @@ -28,7 +28,6 @@ import { AssetUpdate, } from "../Components/Assets/AssetTypes"; import { - ConsultationModel, FacilityModel, LocationModel, WardModel, @@ -37,16 +36,49 @@ import { IDeleteExternalResult, IExternalResult, IExternalResultCsv, - ILocalBodies, ILocalBodyByDistrict, IPartialUpdateExternalResult, } from "../Components/ExternalResult/models"; import { Prescription } from "../Components/Medicine/models"; +import { + IUserFacilityRequest, + IFacilityNotificationRequest, + IFacilityRequest, + IFacilityResponse, + IListDoctorResponse, + IUserListFacilityResponse, + IUserFacilityResponse, + IFacilityUserResponse, + ILocalBodyResponse, + IInventorySummaryResponse, + IInventoryLogResponse, + IFaciclityMinimumQuantityResponse, + IFaciclityMinimumQuantityRequest, + IPatientTransferRequest, + IPatientTransferResponse, + IInvestigationResponse, + IConsultationBedResponse, + ITriageDetailResponse, + IMinQuantityItemResponse, + ISetMinQuantityRequest, + ISetMinQuantityResponse, + IFlagInventoryItemResponse, + IStateListResponse, + IDistrictLocalBodyResponse, + ICreateTriageRequest, + ICreateTriageResponse, + IFacilityNotificationResponse, + CapacityModal, + StateModel, + InventoryItemObjectModel, + DeleteModel, + ConsultationModel, +} from "../Components/Facility/models"; +import { PatientModel } from "../Components/Patient/models"; import { UserModel } from "../Components/Users/models"; import { PaginatedResponse } from "../Utils/request/types"; -import { PatientModel } from "../Components/Patient/models"; import { IComment, IResource } from "../Components/Resource/models"; /** @@ -142,11 +174,14 @@ const routes = { userListFacility: { path: "/api/v1/users/{username}/get_facilities/", + TRes: Type(), }, addUserFacility: { path: "/api/v1/users/{username}/add_facility/", method: "PUT", + TBody: Type(), + TRes: Type(), }, addUserSkill: { @@ -157,6 +192,7 @@ const routes = { deleteUserFacility: { path: "/api/v1/users/{username}/delete_facility/", method: "DELETE", + TRes: Type(), }, clearHomeFacility: { @@ -186,8 +222,9 @@ const routes = { }, deleteUser: { - path: "/api/v1/users", + path: "/api/v1/users/{username}", method: "DELETE", + TRes: Type(), }, addUser: { @@ -222,6 +259,7 @@ const routes = { getPermittedFacilities: { path: "/api/v1/facility/", + TRes: Type>(), }, getAllFacilities: { @@ -231,12 +269,13 @@ const routes = { createFacility: { path: "/api/v1/facility/", method: "POST", + TRes: Type(), + TBody: Type(), }, getPermittedFacility: { path: "/api/v1/facility/{id}/", - method: "GET", - TRes: Type(), + TRes: Type(), }, getAnyFacility: { @@ -246,8 +285,10 @@ const routes = { }, updateFacility: { - path: "/api/v1/facility", + path: "/api/v1/facility/{id}/", method: "PUT", + TRes: Type(), + TBody: Type(), }, partialUpdateFacility: { @@ -264,6 +305,7 @@ const routes = { getFacilityUsers: { path: "/api/v1/facility/{facility_id}/get_users/", + TRes: Type(), }, listFacilityAssetLocation: { @@ -373,8 +415,9 @@ const routes = { // Download Api deleteFacility: { - path: "/api/v1/facility", + path: "/api/v1/facility/{id}", method: "DELETE", + TRes: Type(), }, downloadFacility: { @@ -408,6 +451,7 @@ const routes = { }, getConsultation: { path: "/api/v1/consultation/{id}/", + TRes: Type(), }, updateConsultation: { path: "/api/v1/consultation/{id}/", @@ -460,6 +504,7 @@ const routes = { getCapacity: { path: "/api/v1/facility/{facilityId}/capacity/", + TRes: Type>(), }, getCapacityBed: { @@ -473,6 +518,7 @@ const routes = { listDoctor: { path: "/api/v1/facility/{facilityId}/hospital_doctor/", + TRes: Type(), }, getDoctor: { path: "/api/v1/facility/{facilityId}/hospital_doctor/{id}/", @@ -497,13 +543,17 @@ const routes = { createTriage: { path: "/api/v1/facility/{facilityId}/patient_stats/", method: "POST", + TBody: Type(), + TRes: Type(), }, getTriage: { path: "/api/v1/facility/{facilityId}/patient_stats/", + TRes: Type>(), }, getTriageDetails: { path: "/api/v1/facility/{facilityId}/patient_stats/{id}/", + TRes: Type(), }, // //Care Center @@ -519,6 +569,7 @@ const routes = { }, patientList: { path: "/api/v1/patient/", + TRes: Type(), }, addPatient: { path: "/api/v1/patient/", @@ -539,6 +590,8 @@ const routes = { transferPatient: { path: "/api/v1/patient/{id}/transfer/", method: "POST", + TBody: Type(), + TRes: Type(), }, getPatientNotes: { path: "/api/v1/patient/{patientId}/notes/", @@ -598,19 +651,23 @@ const routes = { // States statesList: { path: "/api/v1/state/", + TRes: Type(), }, getState: { path: "/api/v1/state/{id}/", + TRes: Type(), }, // Districts getDistrict: { path: "/api/v1/district/{id}/", + TRes: Type(), }, getDistrictByState: { path: "/api/v1/state/{id}/districts/", + TRes: Type(), }, getDistrictByName: { path: "/api/v1/district/", @@ -622,13 +679,13 @@ const routes = { }, getLocalbodyByDistrict: { path: "/api/v1/district/{id}/local_bodies/", - method: "GET", - TRes: Type(), + TRes: Type(), }, // Local Body getLocalBody: { path: "/api/v1/local_body/{id}/", + TRes: Type(), }, getAllLocalBody: { path: "/api/v1/local_body/", @@ -665,29 +722,43 @@ const routes = { //inventory getItems: { path: "/api/v1/items/", + TRes: Type>(), }, createInventory: { path: "/api/v1/facility/{facilityId}/inventory/", method: "POST", }, getInventoryLog: { - path: "/api/v1/facility", + path: "/api/v1/facility/{id}/inventory/", + TRes: Type(), }, setMinQuantity: { path: "/api/v1/facility/{facilityId}/min_quantity/", method: "POST", + TBody: Type(), + TRes: Type(), }, getMinQuantity: { - path: "/api/v1/facility", + path: "/api/v1/facility/{id}/min_quantity/", + method: "GET", + TRes: Type>(), + }, + + getMinQuantityOfItem: { + path: "/api/v1/facility/{id}/min_quantity/{external_id}", method: "GET", + TRes: Type(), }, updateMinQuantity: { path: "/api/v1/facility/{facilityId}/min_quantity/{inventoryId}", method: "PATCH", + TBody: Type(), + TRes: Type(), }, getInventorySummary: { - path: "/api/v1/facility", + path: "/api/v1/facility/{id}/inventorysummary/", method: "GET", + TRes: Type(), }, getItemName: { path: "/api/v1/items", @@ -696,10 +767,12 @@ const routes = { flagInventoryItem: { path: "/api/v1/facility/{facility_external_id}/inventory/{external_id}/flag/", method: "PUT", + TRes: Type(), }, deleteLastInventoryLog: { path: "/api/v1/facility/{facility_external_id}/inventory/delete_last/?item={id}", method: "DELETE", + TRes: Type(), }, dischargeSummaryGenerate: { path: "/api/v1/consultation/{external_id}/generate_discharge_summary/", @@ -786,6 +859,8 @@ const routes = { sendNotificationMessages: { path: "/api/v1/notification/notify/", method: "POST", + TRes: Type(), + Tbody: Type(), }, // FileUpload Create @@ -826,6 +901,7 @@ const routes = { getInvestigation: { path: "/api/v1/consultation/{consultation_external_id}/investigation/", method: "GET", + TRes: Type(), }, getPatientInvestigation: { path: "/api/v1/patient/{patient_external_id}/investigation/",