(feat) debug logging
This commit is contained in:
parent
8b7d97b937
commit
59917cc25d
8 changed files with 188 additions and 195 deletions
2
app.json
2
app.json
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "53fd430f-3924-4c6c-8774-b23fabfeb0e5",
|
||||
"version": "0.0.1",
|
||||
"requiredApiVersion": "^1.19.0",
|
||||
"requiredApiVersion": "^1.31.0",
|
||||
"iconFile": "icon.png",
|
||||
"author": {
|
||||
"name": "IndieHosters",
|
||||
|
|
237
package-lock.json
generated
237
package-lock.json
generated
|
@ -6,10 +6,10 @@
|
|||
"": {
|
||||
"devDependencies": {
|
||||
"@rocket.chat/apps-cli": "1.9.0",
|
||||
"@rocket.chat/apps-engine": "^1.19.0",
|
||||
"@rocket.chat/apps-engine": "^1.31.0",
|
||||
"@types/node": "14.14.6",
|
||||
"tslint": "^5.10.0",
|
||||
"typescript": "^4.0.5"
|
||||
"tslint": "^5.20.1",
|
||||
"typescript": "^4.6.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/code-frame": {
|
||||
|
@ -415,9 +415,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@oclif/color/node_modules/ansi-regex": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
|
||||
"integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.1.tgz",
|
||||
"integrity": "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
|
@ -874,9 +874,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@oclif/plugin-help/node_modules/ansi-regex": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
|
||||
"integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.1.tgz",
|
||||
"integrity": "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
|
@ -1288,15 +1288,6 @@
|
|||
"node": ">=8.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@rocket.chat/apps-cli/node_modules/semver": {
|
||||
"version": "6.3.0",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
|
||||
"integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"semver": "bin/semver.js"
|
||||
}
|
||||
},
|
||||
"node_modules/@rocket.chat/apps-cli/node_modules/typescript": {
|
||||
"version": "3.9.10",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.10.tgz",
|
||||
|
@ -1344,9 +1335,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@rocket.chat/apps-engine": {
|
||||
"version": "1.30.0",
|
||||
"resolved": "https://registry.npmjs.org/@rocket.chat/apps-engine/-/apps-engine-1.30.0.tgz",
|
||||
"integrity": "sha512-04X4nQPgZEz9w4b/8zCyW+EVixfzdrugW4u6YUYnB4tc9lDALawSvhz88XlDGvKwbsUKFfSx6ejdhASwSssPcA==",
|
||||
"version": "1.31.0",
|
||||
"resolved": "https://registry.npmjs.org/@rocket.chat/apps-engine/-/apps-engine-1.31.0.tgz",
|
||||
"integrity": "sha512-OAPSjqqFvX8kFgqq0aou05qm1hbIPv0ircUEpimM12DD5lfvmVAFhM5yqRod/DQjgFX2bJDD9NRCgBDRs5L5cw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"adm-zip": "^0.4.9",
|
||||
|
@ -1357,6 +1348,15 @@
|
|||
"uuid": "^3.2.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@rocket.chat/apps-engine/node_modules/semver": {
|
||||
"version": "5.7.1",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
|
||||
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"semver": "bin/semver"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "14.14.6",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.6.tgz",
|
||||
|
@ -1885,15 +1885,6 @@
|
|||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/conf/node_modules/semver": {
|
||||
"version": "6.3.0",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
|
||||
"integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"semver": "bin/semver.js"
|
||||
}
|
||||
},
|
||||
"node_modules/cross-spawn": {
|
||||
"version": "6.0.5",
|
||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz",
|
||||
|
@ -1910,6 +1901,15 @@
|
|||
"node": ">=4.8"
|
||||
}
|
||||
},
|
||||
"node_modules/cross-spawn/node_modules/semver": {
|
||||
"version": "5.7.1",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
|
||||
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"semver": "bin/semver"
|
||||
}
|
||||
},
|
||||
"node_modules/cryptiles": {
|
||||
"version": "4.1.3",
|
||||
"resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-4.1.3.tgz",
|
||||
|
@ -1933,9 +1933,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/debug": {
|
||||
"version": "4.3.3",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz",
|
||||
"integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==",
|
||||
"version": "4.3.4",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
|
||||
"integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"ms": "2.1.2"
|
||||
|
@ -2548,9 +2548,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/inquirer/node_modules/ansi-regex": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
|
||||
"integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.1.tgz",
|
||||
"integrity": "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
|
@ -2857,15 +2857,6 @@
|
|||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/make-dir/node_modules/semver": {
|
||||
"version": "6.3.0",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
|
||||
"integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"semver": "bin/semver.js"
|
||||
}
|
||||
},
|
||||
"node_modules/merge2": {
|
||||
"version": "1.4.1",
|
||||
"resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz",
|
||||
|
@ -2898,26 +2889,17 @@
|
|||
}
|
||||
},
|
||||
"node_modules/mime-types": {
|
||||
"version": "2.1.34",
|
||||
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.34.tgz",
|
||||
"integrity": "sha512-6cP692WwGIs9XXdOO4++N+7qjqv0rqxxVvJ3VHPh/Sc9mVZcQP+ZGhkKiTvWMQRr2tbHkJP/Yn7Y0npb3ZBs4A==",
|
||||
"version": "2.1.35",
|
||||
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
|
||||
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"mime-db": "1.51.0"
|
||||
"mime-db": "1.52.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/mime-types/node_modules/mime-db": {
|
||||
"version": "1.51.0",
|
||||
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.51.0.tgz",
|
||||
"integrity": "sha512-5y8A56jg7XVQx2mbv1lu49NR4dokRnhZYTtL+KGfaa27uq4pSTXkwQkFJl4pkRMyNFz/EtYDSkiiEHx3F7UN6g==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/mimic-fn": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz",
|
||||
|
@ -2928,9 +2910,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/minimatch": {
|
||||
"version": "3.0.5",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.5.tgz",
|
||||
"integrity": "sha512-tUpxzX0VAzJHjLu0xUfFv1gwVp9ba3IOuRAVH2EGuRW8a5emA2FlACLqiT/lDVtS1W+TGNwqz3sWaNyLgDJWuw==",
|
||||
"version": "3.1.2",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
|
||||
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
|
@ -3406,12 +3388,12 @@
|
|||
"dev": true
|
||||
},
|
||||
"node_modules/semver": {
|
||||
"version": "5.7.1",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
|
||||
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
|
||||
"version": "6.3.0",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
|
||||
"integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"semver": "bin/semver"
|
||||
"semver": "bin/semver.js"
|
||||
}
|
||||
},
|
||||
"node_modules/shebang-command": {
|
||||
|
@ -3665,6 +3647,15 @@
|
|||
"typescript": ">=2.3.0-dev || >=2.4.0-dev || >=2.5.0-dev || >=2.6.0-dev || >=2.7.0-dev || >=2.8.0-dev || >=2.9.0-dev || >=3.0.0-dev || >= 3.1.0-dev || >= 3.2.0-dev"
|
||||
}
|
||||
},
|
||||
"node_modules/tslint/node_modules/semver": {
|
||||
"version": "5.7.1",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
|
||||
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"semver": "bin/semver"
|
||||
}
|
||||
},
|
||||
"node_modules/tsutils": {
|
||||
"version": "2.29.0",
|
||||
"resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz",
|
||||
|
@ -3708,9 +3699,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "4.5.5",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.5.tgz",
|
||||
"integrity": "sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==",
|
||||
"version": "4.6.2",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.2.tgz",
|
||||
"integrity": "sha512-HM/hFigTBHZhLXshn9sN37H085+hQGeJHJ/X7LpBWLID/fbc2acUMfU+lGD98X81sKP+pFa9f0DZmCwB9GnbAg==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
|
@ -4258,9 +4249,9 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"ansi-regex": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
|
||||
"integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.1.tgz",
|
||||
"integrity": "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==",
|
||||
"dev": true
|
||||
},
|
||||
"chalk": {
|
||||
|
@ -4621,9 +4612,9 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"ansi-regex": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
|
||||
"integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.1.tgz",
|
||||
"integrity": "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==",
|
||||
"dev": true
|
||||
},
|
||||
"emoji-regex": {
|
||||
|
@ -4948,12 +4939,6 @@
|
|||
"yazl": "^2.5.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"semver": {
|
||||
"version": "6.3.0",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
|
||||
"integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
|
||||
"dev": true
|
||||
},
|
||||
"typescript": {
|
||||
"version": "3.9.10",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.10.tgz",
|
||||
|
@ -4988,9 +4973,9 @@
|
|||
}
|
||||
},
|
||||
"@rocket.chat/apps-engine": {
|
||||
"version": "1.30.0",
|
||||
"resolved": "https://registry.npmjs.org/@rocket.chat/apps-engine/-/apps-engine-1.30.0.tgz",
|
||||
"integrity": "sha512-04X4nQPgZEz9w4b/8zCyW+EVixfzdrugW4u6YUYnB4tc9lDALawSvhz88XlDGvKwbsUKFfSx6ejdhASwSssPcA==",
|
||||
"version": "1.31.0",
|
||||
"resolved": "https://registry.npmjs.org/@rocket.chat/apps-engine/-/apps-engine-1.31.0.tgz",
|
||||
"integrity": "sha512-OAPSjqqFvX8kFgqq0aou05qm1hbIPv0ircUEpimM12DD5lfvmVAFhM5yqRod/DQjgFX2bJDD9NRCgBDRs5L5cw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"adm-zip": "^0.4.9",
|
||||
|
@ -4999,6 +4984,14 @@
|
|||
"semver": "^5.5.0",
|
||||
"stack-trace": "0.0.10",
|
||||
"uuid": "^3.2.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"semver": {
|
||||
"version": "5.7.1",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
|
||||
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"@types/node": {
|
||||
|
@ -5410,14 +5403,6 @@
|
|||
"pkg-up": "^3.0.1",
|
||||
"semver": "^6.2.0",
|
||||
"write-file-atomic": "^3.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"semver": {
|
||||
"version": "6.3.0",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
|
||||
"integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"cross-spawn": {
|
||||
|
@ -5431,6 +5416,14 @@
|
|||
"semver": "^5.5.0",
|
||||
"shebang-command": "^1.2.0",
|
||||
"which": "^1.2.9"
|
||||
},
|
||||
"dependencies": {
|
||||
"semver": {
|
||||
"version": "5.7.1",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
|
||||
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"cryptiles": {
|
||||
|
@ -5452,9 +5445,9 @@
|
|||
}
|
||||
},
|
||||
"debug": {
|
||||
"version": "4.3.3",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz",
|
||||
"integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==",
|
||||
"version": "4.3.4",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
|
||||
"integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ms": "2.1.2"
|
||||
|
@ -5821,9 +5814,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"ansi-regex": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
|
||||
"integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.1.tgz",
|
||||
"integrity": "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==",
|
||||
"dev": true
|
||||
},
|
||||
"figures": {
|
||||
|
@ -6170,14 +6163,6 @@
|
|||
"dev": true,
|
||||
"requires": {
|
||||
"semver": "^6.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"semver": {
|
||||
"version": "6.3.0",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
|
||||
"integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"merge2": {
|
||||
|
@ -6203,20 +6188,12 @@
|
|||
"dev": true
|
||||
},
|
||||
"mime-types": {
|
||||
"version": "2.1.34",
|
||||
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.34.tgz",
|
||||
"integrity": "sha512-6cP692WwGIs9XXdOO4++N+7qjqv0rqxxVvJ3VHPh/Sc9mVZcQP+ZGhkKiTvWMQRr2tbHkJP/Yn7Y0npb3ZBs4A==",
|
||||
"version": "2.1.35",
|
||||
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
|
||||
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"mime-db": "1.51.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"mime-db": {
|
||||
"version": "1.51.0",
|
||||
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.51.0.tgz",
|
||||
"integrity": "sha512-5y8A56jg7XVQx2mbv1lu49NR4dokRnhZYTtL+KGfaa27uq4pSTXkwQkFJl4pkRMyNFz/EtYDSkiiEHx3F7UN6g==",
|
||||
"dev": true
|
||||
}
|
||||
"mime-db": "1.52.0"
|
||||
}
|
||||
},
|
||||
"mimic-fn": {
|
||||
|
@ -6226,9 +6203,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"minimatch": {
|
||||
"version": "3.0.5",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.5.tgz",
|
||||
"integrity": "sha512-tUpxzX0VAzJHjLu0xUfFv1gwVp9ba3IOuRAVH2EGuRW8a5emA2FlACLqiT/lDVtS1W+TGNwqz3sWaNyLgDJWuw==",
|
||||
"version": "3.1.2",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
|
||||
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
|
@ -6564,9 +6541,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"semver": {
|
||||
"version": "5.7.1",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
|
||||
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
|
||||
"version": "6.3.0",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
|
||||
"integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
|
||||
"dev": true
|
||||
},
|
||||
"shebang-command": {
|
||||
|
@ -6747,6 +6724,14 @@
|
|||
"semver": "^5.3.0",
|
||||
"tslib": "^1.8.0",
|
||||
"tsutils": "^2.29.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"semver": {
|
||||
"version": "5.7.1",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
|
||||
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"tsutils": {
|
||||
|
@ -6780,9 +6765,9 @@
|
|||
}
|
||||
},
|
||||
"typescript": {
|
||||
"version": "4.5.5",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.5.tgz",
|
||||
"integrity": "sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==",
|
||||
"version": "4.6.2",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.2.tgz",
|
||||
"integrity": "sha512-HM/hFigTBHZhLXshn9sN37H085+hQGeJHJ/X7LpBWLID/fbc2acUMfU+lGD98X81sKP+pFa9f0DZmCwB9GnbAg==",
|
||||
"dev": true
|
||||
},
|
||||
"universalify": {
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@rocket.chat/apps-cli": "1.9.0",
|
||||
"@rocket.chat/apps-engine": "^1.19.0",
|
||||
"@rocket.chat/apps-engine": "^1.31.0",
|
||||
"@types/node": "14.14.6",
|
||||
"tslint": "^5.10.0",
|
||||
"typescript": "^4.0.5"
|
||||
"tslint": "^5.20.1",
|
||||
"typescript": "^4.6.2"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import {
|
||||
IHttp,
|
||||
ILogger,
|
||||
IModify,
|
||||
IPersistence,
|
||||
IRead,
|
||||
|
@ -22,6 +23,7 @@ export class Context {
|
|||
public readonly modify: IModify;
|
||||
public readonly http: IHttp;
|
||||
public readonly persis: IPersistence;
|
||||
public readonly log: ILogger;
|
||||
constructor(
|
||||
request: IApiRequest,
|
||||
endpoint: IApiEndpointInfo,
|
||||
|
@ -29,8 +31,9 @@ export class Context {
|
|||
modify: IModify,
|
||||
http: IHttp,
|
||||
persis: IPersistence,
|
||||
log: ILogger,
|
||||
) {
|
||||
this.rc = new RcSdk(http, read);
|
||||
this.rc = new RcSdk(http, read, log);
|
||||
this.store = new Store(read, persis);
|
||||
this.request = request;
|
||||
this.endpoint = endpoint;
|
||||
|
@ -38,6 +41,7 @@ export class Context {
|
|||
this.modify = modify;
|
||||
this.http = http;
|
||||
this.persis = persis;
|
||||
this.log = log;
|
||||
}
|
||||
|
||||
public id(): string {
|
||||
|
|
|
@ -117,6 +117,7 @@ export abstract class ScimEndpoint extends ApiEndpoint {
|
|||
http: IHttp,
|
||||
persis: IPersistence,
|
||||
): Promise<IApiResponse> => {
|
||||
const logger = this.app.getLogger();
|
||||
try {
|
||||
const ctx = new Context(
|
||||
request,
|
||||
|
@ -125,9 +126,16 @@ export abstract class ScimEndpoint extends ApiEndpoint {
|
|||
modify,
|
||||
http,
|
||||
persis,
|
||||
logger,
|
||||
);
|
||||
await ctx.checkAuth();
|
||||
return await method.bind(this)(ctx);
|
||||
logger.debug(
|
||||
`SCIM Request ${name.toUpperCase()} /${this.path}`,
|
||||
request.content,
|
||||
);
|
||||
const response = await method.bind(this)(ctx);
|
||||
logger.debug("SCIM Response", response);
|
||||
return response;
|
||||
} catch (e) {
|
||||
let err: SCIMError;
|
||||
if (e.toSCIMError && typeof e.toSCIMError === "function") {
|
||||
|
@ -138,7 +146,7 @@ export abstract class ScimEndpoint extends ApiEndpoint {
|
|||
.setScimType(SCIMErrorType.INVALID_VALUE)
|
||||
.setDetail(e.message);
|
||||
}
|
||||
|
||||
logger.error(e);
|
||||
return this.error(err);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -2,6 +2,7 @@ import {
|
|||
IHttp,
|
||||
IHttpRequest,
|
||||
IHttpResponse,
|
||||
ILogger,
|
||||
IRead,
|
||||
} from "@rocket.chat/apps-engine/definition/accessors";
|
||||
import { EmptyResponseError } from "../errors/EmptyResponseError";
|
||||
|
@ -9,53 +10,45 @@ import { JsonParseError } from "../errors/JsonParseError";
|
|||
import { RcSdkTeam } from "./RcSdkTeam";
|
||||
import { RcSdkUser } from "./RcSdkUser";
|
||||
|
||||
type RequestCallback = (
|
||||
url: string,
|
||||
options: IHttpRequest,
|
||||
) => Promise<IHttpResponse>;
|
||||
|
||||
export class RcSdk {
|
||||
public user: RcSdkUser;
|
||||
public team: RcSdkTeam;
|
||||
private readonly baseUrl = "http://localhost:3000/api/v1";
|
||||
private readonly http: IHttp;
|
||||
private readonly read: IRead;
|
||||
private readonly logger: ILogger;
|
||||
|
||||
constructor(http: IHttp, read: IRead) {
|
||||
constructor(http: IHttp, read: IRead, logger: ILogger) {
|
||||
this.http = http;
|
||||
this.read = read;
|
||||
this.logger = logger;
|
||||
this.user = new RcSdkUser(this);
|
||||
this.team = new RcSdkTeam(this);
|
||||
}
|
||||
|
||||
public async get(url: string, content?: any): Promise<IHttpResponse> {
|
||||
return this.http.get(
|
||||
this.buildUrl(url),
|
||||
await this.buildOptions(content),
|
||||
);
|
||||
public get(url: string, content?: any): Promise<any> {
|
||||
return this.request(this.http.get, url, content);
|
||||
}
|
||||
|
||||
public async post(url: string, content?: any): Promise<IHttpResponse> {
|
||||
return this.http.post(
|
||||
this.buildUrl(url),
|
||||
await this.buildOptions(content),
|
||||
);
|
||||
public post(url: string, content?: any): Promise<any> {
|
||||
return this.request(this.http.post, url, content);
|
||||
}
|
||||
|
||||
public async put(url: string, content?: any): Promise<IHttpResponse> {
|
||||
return this.http.put(
|
||||
this.buildUrl(url),
|
||||
await this.buildOptions(content),
|
||||
);
|
||||
public put(url: string, content?: any): Promise<any> {
|
||||
return this.request(this.http.put, url, content);
|
||||
}
|
||||
|
||||
public async del(url: string, content?: any): Promise<IHttpResponse> {
|
||||
return this.http.del(
|
||||
this.buildUrl(url),
|
||||
await this.buildOptions(content),
|
||||
);
|
||||
public del(url: string, content?: any): Promise<any> {
|
||||
return this.request(this.http.del, url, content);
|
||||
}
|
||||
|
||||
public async patch(url: string, content?: any): Promise<IHttpResponse> {
|
||||
return this.http.patch(
|
||||
this.buildUrl(url),
|
||||
await this.buildOptions(content),
|
||||
);
|
||||
public patch(url: string, content?: any): Promise<any> {
|
||||
return this.request(this.http.patch, url, content);
|
||||
}
|
||||
|
||||
public parseResponse(response: IHttpResponse): any {
|
||||
|
@ -98,4 +91,19 @@ export class RcSdk {
|
|||
}
|
||||
return options;
|
||||
}
|
||||
|
||||
private async request(
|
||||
method: RequestCallback,
|
||||
url: string,
|
||||
content?: any,
|
||||
): Promise<IHttpResponse> {
|
||||
this.logger.debug(`API Request ${url}`, content);
|
||||
const response = await method.bind(this.http)(
|
||||
this.buildUrl(url),
|
||||
await this.buildOptions(content),
|
||||
);
|
||||
const o = this.parseResponse(response);
|
||||
this.logger.debug(`API Response`, o);
|
||||
return o;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -91,42 +91,35 @@ export class RcSdkTeam {
|
|||
this.sdk = sdk;
|
||||
}
|
||||
|
||||
public async listAll(): Promise<ITeamListAllResponse> {
|
||||
const response = await this.sdk.get(`teams.listAll`);
|
||||
return this.sdk.parseResponse(response);
|
||||
public listAll(): Promise<ITeamListAllResponse> {
|
||||
return this.sdk.get(`teams.listAll`);
|
||||
}
|
||||
|
||||
public async members(teamId: string): Promise<ITeamMembersResponse> {
|
||||
const response = await this.sdk.get(`teams.members?teamId=${teamId}`);
|
||||
return this.sdk.parseResponse(response);
|
||||
public members(teamId: string): Promise<ITeamMembersResponse> {
|
||||
return this.sdk.get(`teams.members?teamId=${teamId}`);
|
||||
}
|
||||
|
||||
public async info(teamId: string): Promise<ITeamInfoResponse> {
|
||||
const response = await this.sdk.get(`teams.info?teamId=${teamId}`);
|
||||
return this.sdk.parseResponse(response);
|
||||
public info(teamId: string): Promise<ITeamInfoResponse> {
|
||||
return this.sdk.get(`teams.info?teamId=${teamId}`);
|
||||
}
|
||||
|
||||
public async delete(body: ITeamDeleteBody): Promise<ITeamDeleteResponse> {
|
||||
const response = await this.sdk.post(`teams.delete`, body);
|
||||
return this.sdk.parseResponse(response);
|
||||
public delete(body: ITeamDeleteBody): Promise<ITeamDeleteResponse> {
|
||||
return this.sdk.post(`teams.delete`, body);
|
||||
}
|
||||
|
||||
public async create(body: ITeamCreateBody): Promise<ITeamCreateResponse> {
|
||||
const response = await this.sdk.post(`teams.create`, body);
|
||||
return this.sdk.parseResponse(response);
|
||||
public create(body: ITeamCreateBody): Promise<ITeamCreateResponse> {
|
||||
return this.sdk.post(`teams.create`, body);
|
||||
}
|
||||
|
||||
public async removeMember(
|
||||
public removeMember(
|
||||
body: ITeamRemoveMemberBody,
|
||||
): Promise<ITeamMemberResponse> {
|
||||
const response = await this.sdk.post(`teams.removeMember`, body);
|
||||
return this.sdk.parseResponse(response);
|
||||
return this.sdk.post(`teams.removeMember`, body);
|
||||
}
|
||||
|
||||
public async addMembers(
|
||||
public addMembers(
|
||||
body: ITeamAddMemberBody,
|
||||
): Promise<ITeamMemberResponse> {
|
||||
const response = await this.sdk.post(`teams.addMembers`, body);
|
||||
return this.sdk.parseResponse(response);
|
||||
return this.sdk.post(`teams.addMembers`, body);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,30 +72,25 @@ export class RcSdkUser {
|
|||
this.sdk = sdk;
|
||||
}
|
||||
|
||||
public async list(): Promise<IUserListResponse> {
|
||||
const response = await this.sdk.get(
|
||||
public list(): Promise<IUserListResponse> {
|
||||
return this.sdk.get(
|
||||
`users.list?query={"type":{"$eq":"user"}}&fields={"createdAt":1}`,
|
||||
);
|
||||
return this.sdk.parseResponse(response);
|
||||
}
|
||||
|
||||
public async info(userId: string): Promise<IUserResponse> {
|
||||
const response = await this.sdk.get(`users.info?userId=${userId}`);
|
||||
return this.sdk.parseResponse(response);
|
||||
public info(userId: string): Promise<IUserResponse> {
|
||||
return this.sdk.get(`users.info?userId=${userId}`);
|
||||
}
|
||||
|
||||
public async update(body: IUserUpdate): Promise<IUserResponse> {
|
||||
const response = await this.sdk.post(`users.update`, body);
|
||||
return this.sdk.parseResponse(response);
|
||||
public update(body: IUserUpdate): Promise<IUserResponse> {
|
||||
return this.sdk.post(`users.update`, body);
|
||||
}
|
||||
|
||||
public async delete(body: IUserDelete): Promise<IUserDeleteResponse> {
|
||||
const response = await this.sdk.post(`users.delete`, body);
|
||||
return this.sdk.parseResponse(response);
|
||||
public delete(body: IUserDelete): Promise<IUserDeleteResponse> {
|
||||
return this.sdk.post(`users.delete`, body);
|
||||
}
|
||||
|
||||
public async create(body: IUserCreate): Promise<IUserResponse> {
|
||||
const response = await this.sdk.post(`users.create`, body);
|
||||
return this.sdk.parseResponse(response);
|
||||
public create(body: IUserCreate): Promise<IUserResponse> {
|
||||
return this.sdk.post(`users.create`, body);
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue