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