Upgrade octokit to v4.1.2
This commit is contained in:
parent
dbbcbe019d
commit
c1745a9831
1214 changed files with 160765 additions and 0 deletions
858
node_modules/.package-lock.json
generated
vendored
858
node_modules/.package-lock.json
generated
vendored
|
|
@ -838,6 +838,387 @@
|
|||
"node": ">=12.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/app": {
|
||||
"version": "15.1.4",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/app/-/app-15.1.4.tgz",
|
||||
"integrity": "sha512-PM1MqlPAnItjQIKWRmSoJu02+m7Eif4Am3w5C+Ctkw0//QETWMbW2ejBZhcw3aS7wRcFSbS+lH3NoYm614aZVQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@octokit/auth-app": "^7.1.5",
|
||||
"@octokit/auth-unauthenticated": "^6.1.2",
|
||||
"@octokit/core": "^6.1.4",
|
||||
"@octokit/oauth-app": "^7.1.6",
|
||||
"@octokit/plugin-paginate-rest": "^11.4.2",
|
||||
"@octokit/types": "^13.6.2",
|
||||
"@octokit/webhooks": "^13.6.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/app/node_modules/@octokit/auth-token": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-5.1.2.tgz",
|
||||
"integrity": "sha512-JcQDsBdg49Yky2w2ld20IHAlwr8d/d8N6NiOXbtuoPCqzbsiJgF633mVUw3x4mo0H5ypataQIX7SFu3yy44Mpw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/app/node_modules/@octokit/core": {
|
||||
"version": "6.1.4",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/core/-/core-6.1.4.tgz",
|
||||
"integrity": "sha512-lAS9k7d6I0MPN+gb9bKDt7X8SdxknYqAMh44S5L+lNqIN2NuV8nvv3g8rPp7MuRxcOpxpUIATWprO0C34a8Qmg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@octokit/auth-token": "^5.0.0",
|
||||
"@octokit/graphql": "^8.1.2",
|
||||
"@octokit/request": "^9.2.1",
|
||||
"@octokit/request-error": "^6.1.7",
|
||||
"@octokit/types": "^13.6.2",
|
||||
"before-after-hook": "^3.0.2",
|
||||
"universal-user-agent": "^7.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/app/node_modules/@octokit/endpoint": {
|
||||
"version": "10.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-10.1.3.tgz",
|
||||
"integrity": "sha512-nBRBMpKPhQUxCsQQeW+rCJ/OPSMcj3g0nfHn01zGYZXuNDvvXudF/TYY6APj5THlurerpFN4a/dQAIAaM6BYhA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@octokit/types": "^13.6.2",
|
||||
"universal-user-agent": "^7.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/app/node_modules/@octokit/graphql": {
|
||||
"version": "8.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-8.2.1.tgz",
|
||||
"integrity": "sha512-n57hXtOoHrhwTWdvhVkdJHdhTv0JstjDbDRhJfwIRNfFqmSo1DaK/mD2syoNUoLCyqSjBpGAKOG0BuwF392slw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@octokit/request": "^9.2.2",
|
||||
"@octokit/types": "^13.8.0",
|
||||
"universal-user-agent": "^7.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/app/node_modules/@octokit/plugin-paginate-rest": {
|
||||
"version": "11.4.2",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-11.4.2.tgz",
|
||||
"integrity": "sha512-BXJ7XPCTDXFF+wxcg/zscfgw2O/iDPtNSkwwR1W1W5c4Mb3zav/M2XvxQ23nVmKj7jpweB4g8viMeCQdm7LMVA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@octokit/types": "^13.7.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@octokit/core": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/app/node_modules/@octokit/request": {
|
||||
"version": "9.2.2",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-9.2.2.tgz",
|
||||
"integrity": "sha512-dZl0ZHx6gOQGcffgm1/Sf6JfEpmh34v3Af2Uci02vzUYz6qEN6zepoRtmybWXIGXFIK8K9ylE3b+duCWqhArtg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@octokit/endpoint": "^10.1.3",
|
||||
"@octokit/request-error": "^6.1.7",
|
||||
"@octokit/types": "^13.6.2",
|
||||
"fast-content-type-parse": "^2.0.0",
|
||||
"universal-user-agent": "^7.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/app/node_modules/@octokit/request-error": {
|
||||
"version": "6.1.7",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-6.1.7.tgz",
|
||||
"integrity": "sha512-69NIppAwaauwZv6aOzb+VVLwt+0havz9GT5YplkeJv7fG7a40qpLt/yZKyiDxAhgz0EtgNdNcb96Z0u+Zyuy2g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@octokit/types": "^13.6.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/app/node_modules/before-after-hook": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-3.0.2.tgz",
|
||||
"integrity": "sha512-Nik3Sc0ncrMK4UUdXQmAnRtzmNQTAAXmXIopizwZ1W1t8QmfJj+zL4OA2I7XPTPW5z5TDqv4hRo/JzouDJnX3A==",
|
||||
"license": "Apache-2.0"
|
||||
},
|
||||
"node_modules/@octokit/app/node_modules/universal-user-agent": {
|
||||
"version": "7.0.2",
|
||||
"resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-7.0.2.tgz",
|
||||
"integrity": "sha512-0JCqzSKnStlRRQfCdowvqy3cy0Dvtlb8xecj/H8JFZuCze4rwjPZQOgvFvn0Ws/usCHQFGpyr+pB9adaGwXn4Q==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/@octokit/auth-app": {
|
||||
"version": "7.1.5",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/auth-app/-/auth-app-7.1.5.tgz",
|
||||
"integrity": "sha512-boklS4E6LpbA3nRx+SU2fRKRGZJdOGoSZne/i3Y0B5rfHOcGwFgcXrwDLdtbv4igfDSnAkZaoNBv1GYjPDKRNw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@octokit/auth-oauth-app": "^8.1.3",
|
||||
"@octokit/auth-oauth-user": "^5.1.3",
|
||||
"@octokit/request": "^9.2.1",
|
||||
"@octokit/request-error": "^6.1.7",
|
||||
"@octokit/types": "^13.8.0",
|
||||
"toad-cache": "^3.7.0",
|
||||
"universal-github-app-jwt": "^2.2.0",
|
||||
"universal-user-agent": "^7.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/auth-app/node_modules/@octokit/endpoint": {
|
||||
"version": "10.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-10.1.3.tgz",
|
||||
"integrity": "sha512-nBRBMpKPhQUxCsQQeW+rCJ/OPSMcj3g0nfHn01zGYZXuNDvvXudF/TYY6APj5THlurerpFN4a/dQAIAaM6BYhA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@octokit/types": "^13.6.2",
|
||||
"universal-user-agent": "^7.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/auth-app/node_modules/@octokit/request": {
|
||||
"version": "9.2.2",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-9.2.2.tgz",
|
||||
"integrity": "sha512-dZl0ZHx6gOQGcffgm1/Sf6JfEpmh34v3Af2Uci02vzUYz6qEN6zepoRtmybWXIGXFIK8K9ylE3b+duCWqhArtg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@octokit/endpoint": "^10.1.3",
|
||||
"@octokit/request-error": "^6.1.7",
|
||||
"@octokit/types": "^13.6.2",
|
||||
"fast-content-type-parse": "^2.0.0",
|
||||
"universal-user-agent": "^7.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/auth-app/node_modules/@octokit/request-error": {
|
||||
"version": "6.1.7",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-6.1.7.tgz",
|
||||
"integrity": "sha512-69NIppAwaauwZv6aOzb+VVLwt+0havz9GT5YplkeJv7fG7a40qpLt/yZKyiDxAhgz0EtgNdNcb96Z0u+Zyuy2g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@octokit/types": "^13.6.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/auth-app/node_modules/universal-user-agent": {
|
||||
"version": "7.0.2",
|
||||
"resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-7.0.2.tgz",
|
||||
"integrity": "sha512-0JCqzSKnStlRRQfCdowvqy3cy0Dvtlb8xecj/H8JFZuCze4rwjPZQOgvFvn0Ws/usCHQFGpyr+pB9adaGwXn4Q==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/@octokit/auth-oauth-app": {
|
||||
"version": "8.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/auth-oauth-app/-/auth-oauth-app-8.1.3.tgz",
|
||||
"integrity": "sha512-4e6OjVe5rZ8yBe8w7byBjpKtSXFuro7gqeGAAZc7QYltOF8wB93rJl2FE0a4U1Mt88xxPv/mS+25/0DuLk0Ewg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@octokit/auth-oauth-device": "^7.1.3",
|
||||
"@octokit/auth-oauth-user": "^5.1.3",
|
||||
"@octokit/request": "^9.2.1",
|
||||
"@octokit/types": "^13.6.2",
|
||||
"universal-user-agent": "^7.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/auth-oauth-app/node_modules/@octokit/endpoint": {
|
||||
"version": "10.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-10.1.3.tgz",
|
||||
"integrity": "sha512-nBRBMpKPhQUxCsQQeW+rCJ/OPSMcj3g0nfHn01zGYZXuNDvvXudF/TYY6APj5THlurerpFN4a/dQAIAaM6BYhA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@octokit/types": "^13.6.2",
|
||||
"universal-user-agent": "^7.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/auth-oauth-app/node_modules/@octokit/request": {
|
||||
"version": "9.2.2",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-9.2.2.tgz",
|
||||
"integrity": "sha512-dZl0ZHx6gOQGcffgm1/Sf6JfEpmh34v3Af2Uci02vzUYz6qEN6zepoRtmybWXIGXFIK8K9ylE3b+duCWqhArtg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@octokit/endpoint": "^10.1.3",
|
||||
"@octokit/request-error": "^6.1.7",
|
||||
"@octokit/types": "^13.6.2",
|
||||
"fast-content-type-parse": "^2.0.0",
|
||||
"universal-user-agent": "^7.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/auth-oauth-app/node_modules/@octokit/request-error": {
|
||||
"version": "6.1.7",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-6.1.7.tgz",
|
||||
"integrity": "sha512-69NIppAwaauwZv6aOzb+VVLwt+0havz9GT5YplkeJv7fG7a40qpLt/yZKyiDxAhgz0EtgNdNcb96Z0u+Zyuy2g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@octokit/types": "^13.6.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/auth-oauth-app/node_modules/universal-user-agent": {
|
||||
"version": "7.0.2",
|
||||
"resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-7.0.2.tgz",
|
||||
"integrity": "sha512-0JCqzSKnStlRRQfCdowvqy3cy0Dvtlb8xecj/H8JFZuCze4rwjPZQOgvFvn0Ws/usCHQFGpyr+pB9adaGwXn4Q==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/@octokit/auth-oauth-device": {
|
||||
"version": "7.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/auth-oauth-device/-/auth-oauth-device-7.1.3.tgz",
|
||||
"integrity": "sha512-BECO/N4B/Uikj0w3GCvjf/odMujtYTP3q82BJSjxC2J3rxTEiZIJ+z2xnRlDb0IE9dQSaTgRqUPVOieSbFcVzg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@octokit/oauth-methods": "^5.1.4",
|
||||
"@octokit/request": "^9.2.1",
|
||||
"@octokit/types": "^13.6.2",
|
||||
"universal-user-agent": "^7.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/auth-oauth-device/node_modules/@octokit/endpoint": {
|
||||
"version": "10.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-10.1.3.tgz",
|
||||
"integrity": "sha512-nBRBMpKPhQUxCsQQeW+rCJ/OPSMcj3g0nfHn01zGYZXuNDvvXudF/TYY6APj5THlurerpFN4a/dQAIAaM6BYhA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@octokit/types": "^13.6.2",
|
||||
"universal-user-agent": "^7.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/auth-oauth-device/node_modules/@octokit/request": {
|
||||
"version": "9.2.2",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-9.2.2.tgz",
|
||||
"integrity": "sha512-dZl0ZHx6gOQGcffgm1/Sf6JfEpmh34v3Af2Uci02vzUYz6qEN6zepoRtmybWXIGXFIK8K9ylE3b+duCWqhArtg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@octokit/endpoint": "^10.1.3",
|
||||
"@octokit/request-error": "^6.1.7",
|
||||
"@octokit/types": "^13.6.2",
|
||||
"fast-content-type-parse": "^2.0.0",
|
||||
"universal-user-agent": "^7.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/auth-oauth-device/node_modules/@octokit/request-error": {
|
||||
"version": "6.1.7",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-6.1.7.tgz",
|
||||
"integrity": "sha512-69NIppAwaauwZv6aOzb+VVLwt+0havz9GT5YplkeJv7fG7a40qpLt/yZKyiDxAhgz0EtgNdNcb96Z0u+Zyuy2g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@octokit/types": "^13.6.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/auth-oauth-device/node_modules/universal-user-agent": {
|
||||
"version": "7.0.2",
|
||||
"resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-7.0.2.tgz",
|
||||
"integrity": "sha512-0JCqzSKnStlRRQfCdowvqy3cy0Dvtlb8xecj/H8JFZuCze4rwjPZQOgvFvn0Ws/usCHQFGpyr+pB9adaGwXn4Q==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/@octokit/auth-oauth-user": {
|
||||
"version": "5.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/auth-oauth-user/-/auth-oauth-user-5.1.3.tgz",
|
||||
"integrity": "sha512-zNPByPn9K7TC+OOHKGxU+MxrE9SZAN11UHYEFLsK2NRn3akJN2LHRl85q+Eypr3tuB2GrKx3rfj2phJdkYCvzw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@octokit/auth-oauth-device": "^7.1.3",
|
||||
"@octokit/oauth-methods": "^5.1.3",
|
||||
"@octokit/request": "^9.2.1",
|
||||
"@octokit/types": "^13.6.2",
|
||||
"universal-user-agent": "^7.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/auth-oauth-user/node_modules/@octokit/endpoint": {
|
||||
"version": "10.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-10.1.3.tgz",
|
||||
"integrity": "sha512-nBRBMpKPhQUxCsQQeW+rCJ/OPSMcj3g0nfHn01zGYZXuNDvvXudF/TYY6APj5THlurerpFN4a/dQAIAaM6BYhA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@octokit/types": "^13.6.2",
|
||||
"universal-user-agent": "^7.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/auth-oauth-user/node_modules/@octokit/request": {
|
||||
"version": "9.2.2",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-9.2.2.tgz",
|
||||
"integrity": "sha512-dZl0ZHx6gOQGcffgm1/Sf6JfEpmh34v3Af2Uci02vzUYz6qEN6zepoRtmybWXIGXFIK8K9ylE3b+duCWqhArtg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@octokit/endpoint": "^10.1.3",
|
||||
"@octokit/request-error": "^6.1.7",
|
||||
"@octokit/types": "^13.6.2",
|
||||
"fast-content-type-parse": "^2.0.0",
|
||||
"universal-user-agent": "^7.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/auth-oauth-user/node_modules/@octokit/request-error": {
|
||||
"version": "6.1.7",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-6.1.7.tgz",
|
||||
"integrity": "sha512-69NIppAwaauwZv6aOzb+VVLwt+0havz9GT5YplkeJv7fG7a40qpLt/yZKyiDxAhgz0EtgNdNcb96Z0u+Zyuy2g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@octokit/types": "^13.6.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/auth-oauth-user/node_modules/universal-user-agent": {
|
||||
"version": "7.0.2",
|
||||
"resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-7.0.2.tgz",
|
||||
"integrity": "sha512-0JCqzSKnStlRRQfCdowvqy3cy0Dvtlb8xecj/H8JFZuCze4rwjPZQOgvFvn0Ws/usCHQFGpyr+pB9adaGwXn4Q==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/@octokit/auth-token": {
|
||||
"version": "2.5.0",
|
||||
"license": "MIT",
|
||||
|
|
@ -856,6 +1237,31 @@
|
|||
"@octokit/openapi-types": "^12.11.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/auth-unauthenticated": {
|
||||
"version": "6.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/auth-unauthenticated/-/auth-unauthenticated-6.1.2.tgz",
|
||||
"integrity": "sha512-07DlUGcz/AAVdzu3EYfi/dOyMSHp9YsOxPl/MPmtlVXWiD//GlV8HgZsPhud94DEyx+RfrW0wSl46Lx+AWbOlg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@octokit/request-error": "^6.1.7",
|
||||
"@octokit/types": "^13.6.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/auth-unauthenticated/node_modules/@octokit/request-error": {
|
||||
"version": "6.1.7",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-6.1.7.tgz",
|
||||
"integrity": "sha512-69NIppAwaauwZv6aOzb+VVLwt+0havz9GT5YplkeJv7fG7a40qpLt/yZKyiDxAhgz0EtgNdNcb96Z0u+Zyuy2g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@octokit/types": "^13.6.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/core": {
|
||||
"version": "3.6.0",
|
||||
"license": "MIT",
|
||||
|
|
@ -920,10 +1326,200 @@
|
|||
"@octokit/openapi-types": "^12.11.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/oauth-app": {
|
||||
"version": "7.1.6",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/oauth-app/-/oauth-app-7.1.6.tgz",
|
||||
"integrity": "sha512-OMcMzY2WFARg80oJNFwWbY51TBUfLH4JGTy119cqiDawSFXSIBujxmpXiKbGWQlvfn0CxE6f7/+c6+Kr5hI2YA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@octokit/auth-oauth-app": "^8.1.3",
|
||||
"@octokit/auth-oauth-user": "^5.1.3",
|
||||
"@octokit/auth-unauthenticated": "^6.1.2",
|
||||
"@octokit/core": "^6.1.4",
|
||||
"@octokit/oauth-authorization-url": "^7.1.1",
|
||||
"@octokit/oauth-methods": "^5.1.4",
|
||||
"@types/aws-lambda": "^8.10.83",
|
||||
"universal-user-agent": "^7.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/oauth-app/node_modules/@octokit/auth-token": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-5.1.2.tgz",
|
||||
"integrity": "sha512-JcQDsBdg49Yky2w2ld20IHAlwr8d/d8N6NiOXbtuoPCqzbsiJgF633mVUw3x4mo0H5ypataQIX7SFu3yy44Mpw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/oauth-app/node_modules/@octokit/core": {
|
||||
"version": "6.1.4",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/core/-/core-6.1.4.tgz",
|
||||
"integrity": "sha512-lAS9k7d6I0MPN+gb9bKDt7X8SdxknYqAMh44S5L+lNqIN2NuV8nvv3g8rPp7MuRxcOpxpUIATWprO0C34a8Qmg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@octokit/auth-token": "^5.0.0",
|
||||
"@octokit/graphql": "^8.1.2",
|
||||
"@octokit/request": "^9.2.1",
|
||||
"@octokit/request-error": "^6.1.7",
|
||||
"@octokit/types": "^13.6.2",
|
||||
"before-after-hook": "^3.0.2",
|
||||
"universal-user-agent": "^7.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/oauth-app/node_modules/@octokit/endpoint": {
|
||||
"version": "10.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-10.1.3.tgz",
|
||||
"integrity": "sha512-nBRBMpKPhQUxCsQQeW+rCJ/OPSMcj3g0nfHn01zGYZXuNDvvXudF/TYY6APj5THlurerpFN4a/dQAIAaM6BYhA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@octokit/types": "^13.6.2",
|
||||
"universal-user-agent": "^7.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/oauth-app/node_modules/@octokit/graphql": {
|
||||
"version": "8.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-8.2.1.tgz",
|
||||
"integrity": "sha512-n57hXtOoHrhwTWdvhVkdJHdhTv0JstjDbDRhJfwIRNfFqmSo1DaK/mD2syoNUoLCyqSjBpGAKOG0BuwF392slw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@octokit/request": "^9.2.2",
|
||||
"@octokit/types": "^13.8.0",
|
||||
"universal-user-agent": "^7.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/oauth-app/node_modules/@octokit/request": {
|
||||
"version": "9.2.2",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-9.2.2.tgz",
|
||||
"integrity": "sha512-dZl0ZHx6gOQGcffgm1/Sf6JfEpmh34v3Af2Uci02vzUYz6qEN6zepoRtmybWXIGXFIK8K9ylE3b+duCWqhArtg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@octokit/endpoint": "^10.1.3",
|
||||
"@octokit/request-error": "^6.1.7",
|
||||
"@octokit/types": "^13.6.2",
|
||||
"fast-content-type-parse": "^2.0.0",
|
||||
"universal-user-agent": "^7.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/oauth-app/node_modules/@octokit/request-error": {
|
||||
"version": "6.1.7",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-6.1.7.tgz",
|
||||
"integrity": "sha512-69NIppAwaauwZv6aOzb+VVLwt+0havz9GT5YplkeJv7fG7a40qpLt/yZKyiDxAhgz0EtgNdNcb96Z0u+Zyuy2g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@octokit/types": "^13.6.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/oauth-app/node_modules/before-after-hook": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-3.0.2.tgz",
|
||||
"integrity": "sha512-Nik3Sc0ncrMK4UUdXQmAnRtzmNQTAAXmXIopizwZ1W1t8QmfJj+zL4OA2I7XPTPW5z5TDqv4hRo/JzouDJnX3A==",
|
||||
"license": "Apache-2.0"
|
||||
},
|
||||
"node_modules/@octokit/oauth-app/node_modules/universal-user-agent": {
|
||||
"version": "7.0.2",
|
||||
"resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-7.0.2.tgz",
|
||||
"integrity": "sha512-0JCqzSKnStlRRQfCdowvqy3cy0Dvtlb8xecj/H8JFZuCze4rwjPZQOgvFvn0Ws/usCHQFGpyr+pB9adaGwXn4Q==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/@octokit/oauth-authorization-url": {
|
||||
"version": "7.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/oauth-authorization-url/-/oauth-authorization-url-7.1.1.tgz",
|
||||
"integrity": "sha512-ooXV8GBSabSWyhLUowlMIVd9l1s2nsOGQdlP2SQ4LnkEsGXzeCvbSbCPdZThXhEFzleGPwbapT0Sb+YhXRyjCA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/oauth-methods": {
|
||||
"version": "5.1.4",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/oauth-methods/-/oauth-methods-5.1.4.tgz",
|
||||
"integrity": "sha512-Jc/ycnePClOvO1WL7tlC+TRxOFtyJBGuTDsL4dzXNiVZvzZdrPuNw7zHI3qJSUX2n6RLXE5L0SkFmYyNaVUFoQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@octokit/oauth-authorization-url": "^7.0.0",
|
||||
"@octokit/request": "^9.2.1",
|
||||
"@octokit/request-error": "^6.1.7",
|
||||
"@octokit/types": "^13.6.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/oauth-methods/node_modules/@octokit/endpoint": {
|
||||
"version": "10.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-10.1.3.tgz",
|
||||
"integrity": "sha512-nBRBMpKPhQUxCsQQeW+rCJ/OPSMcj3g0nfHn01zGYZXuNDvvXudF/TYY6APj5THlurerpFN4a/dQAIAaM6BYhA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@octokit/types": "^13.6.2",
|
||||
"universal-user-agent": "^7.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/oauth-methods/node_modules/@octokit/request": {
|
||||
"version": "9.2.2",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-9.2.2.tgz",
|
||||
"integrity": "sha512-dZl0ZHx6gOQGcffgm1/Sf6JfEpmh34v3Af2Uci02vzUYz6qEN6zepoRtmybWXIGXFIK8K9ylE3b+duCWqhArtg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@octokit/endpoint": "^10.1.3",
|
||||
"@octokit/request-error": "^6.1.7",
|
||||
"@octokit/types": "^13.6.2",
|
||||
"fast-content-type-parse": "^2.0.0",
|
||||
"universal-user-agent": "^7.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/oauth-methods/node_modules/@octokit/request-error": {
|
||||
"version": "6.1.7",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-6.1.7.tgz",
|
||||
"integrity": "sha512-69NIppAwaauwZv6aOzb+VVLwt+0havz9GT5YplkeJv7fG7a40qpLt/yZKyiDxAhgz0EtgNdNcb96Z0u+Zyuy2g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@octokit/types": "^13.6.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/oauth-methods/node_modules/universal-user-agent": {
|
||||
"version": "7.0.2",
|
||||
"resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-7.0.2.tgz",
|
||||
"integrity": "sha512-0JCqzSKnStlRRQfCdowvqy3cy0Dvtlb8xecj/H8JFZuCze4rwjPZQOgvFvn0Ws/usCHQFGpyr+pB9adaGwXn4Q==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/@octokit/openapi-types": {
|
||||
"version": "18.0.0",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@octokit/openapi-webhooks-types": {
|
||||
"version": "9.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/openapi-webhooks-types/-/openapi-webhooks-types-9.1.0.tgz",
|
||||
"integrity": "sha512-bO1D2jLdU8qEvqmbWjNxJzDYSFT4wesiYKIKP6f4LaM0XUGtn/0LBv/20hu9YqcnpdX38X5o/xANTMtIAqdwYw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@octokit/plugin-paginate-rest": {
|
||||
"version": "2.21.3",
|
||||
"license": "MIT",
|
||||
|
|
@ -1068,6 +1664,41 @@
|
|||
"integrity": "sha512-izFjMJ1sir0jn0ldEKhZ7xegCTj/ObmEDlEfpFrx4k/JyZSMRHbO3/rBwgE7f3m2DHt+RrNGIVw4wSmwnm3t/g==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@octokit/webhooks": {
|
||||
"version": "13.6.1",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/webhooks/-/webhooks-13.6.1.tgz",
|
||||
"integrity": "sha512-vk0jnc5k0/mLMUI4IA9LfSYkLs3OHtfa7B3h4aRG6to912V3wIG8lS/wKwatwYxRkAug4oE8is0ERRI8pzoYTw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@octokit/openapi-webhooks-types": "9.1.0",
|
||||
"@octokit/request-error": "^6.1.7",
|
||||
"@octokit/webhooks-methods": "^5.1.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/webhooks-methods": {
|
||||
"version": "5.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/webhooks-methods/-/webhooks-methods-5.1.1.tgz",
|
||||
"integrity": "sha512-NGlEHZDseJTCj8TMMFehzwa9g7On4KJMPVHDSrHxCQumL6uSQR8wIkP/qesv52fXqV1BPf4pTxwtS31ldAt9Xg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/webhooks/node_modules/@octokit/request-error": {
|
||||
"version": "6.1.7",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-6.1.7.tgz",
|
||||
"integrity": "sha512-69NIppAwaauwZv6aOzb+VVLwt+0havz9GT5YplkeJv7fG7a40qpLt/yZKyiDxAhgz0EtgNdNcb96Z0u+Zyuy2g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@octokit/types": "^13.6.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/@open-draft/deferred-promise": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@open-draft/deferred-promise/-/deferred-promise-2.2.0.tgz",
|
||||
|
|
@ -1258,6 +1889,12 @@
|
|||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/aws-lambda": {
|
||||
"version": "8.10.147",
|
||||
"resolved": "https://registry.npmjs.org/@types/aws-lambda/-/aws-lambda-8.10.147.tgz",
|
||||
"integrity": "sha512-nD0Z9fNIZcxYX5Mai2CTmFD7wX7UldCkW2ezCF8D1T5hdiLsnTWDGRpfRYntU6VjTdLQjOvyszru7I1c1oCQew==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/color-name": {
|
||||
"version": "1.1.1",
|
||||
"dev": true,
|
||||
|
|
@ -4308,6 +4945,22 @@
|
|||
"url": "https://github.com/sindresorhus/execa?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/fast-content-type-parse": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/fast-content-type-parse/-/fast-content-type-parse-2.0.1.tgz",
|
||||
"integrity": "sha512-nGqtvLrj5w0naR6tDPfB4cUmYCqouzyQiz6C5y/LtcDllJdrcc6WaWW6iXyIIOErTa/XRybj28aasdn4LkVk6Q==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/fastify"
|
||||
},
|
||||
{
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/fastify"
|
||||
}
|
||||
],
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/fast-deep-equal": {
|
||||
"version": "3.1.3",
|
||||
"license": "MIT"
|
||||
|
|
@ -5968,6 +6621,196 @@
|
|||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/octokit": {
|
||||
"version": "4.1.2",
|
||||
"resolved": "https://registry.npmjs.org/octokit/-/octokit-4.1.2.tgz",
|
||||
"integrity": "sha512-0kcTxJOK3yQrJsRb8wKa28hlTze4QOz4sLuUnfXXnhboDhFKgv8LxS86tFwbsafDW9JZ08ByuVAE8kQbYJIZkA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@octokit/app": "^15.1.4",
|
||||
"@octokit/core": "^6.1.4",
|
||||
"@octokit/oauth-app": "^7.1.6",
|
||||
"@octokit/plugin-paginate-graphql": "^5.2.4",
|
||||
"@octokit/plugin-paginate-rest": "^11.4.2",
|
||||
"@octokit/plugin-rest-endpoint-methods": "^13.3.1",
|
||||
"@octokit/plugin-retry": "^7.1.4",
|
||||
"@octokit/plugin-throttling": "^9.4.0",
|
||||
"@octokit/request-error": "^6.1.7",
|
||||
"@octokit/types": "^13.7.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/octokit/node_modules/@octokit/auth-token": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-5.1.2.tgz",
|
||||
"integrity": "sha512-JcQDsBdg49Yky2w2ld20IHAlwr8d/d8N6NiOXbtuoPCqzbsiJgF633mVUw3x4mo0H5ypataQIX7SFu3yy44Mpw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/octokit/node_modules/@octokit/core": {
|
||||
"version": "6.1.4",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/core/-/core-6.1.4.tgz",
|
||||
"integrity": "sha512-lAS9k7d6I0MPN+gb9bKDt7X8SdxknYqAMh44S5L+lNqIN2NuV8nvv3g8rPp7MuRxcOpxpUIATWprO0C34a8Qmg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@octokit/auth-token": "^5.0.0",
|
||||
"@octokit/graphql": "^8.1.2",
|
||||
"@octokit/request": "^9.2.1",
|
||||
"@octokit/request-error": "^6.1.7",
|
||||
"@octokit/types": "^13.6.2",
|
||||
"before-after-hook": "^3.0.2",
|
||||
"universal-user-agent": "^7.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/octokit/node_modules/@octokit/endpoint": {
|
||||
"version": "10.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-10.1.3.tgz",
|
||||
"integrity": "sha512-nBRBMpKPhQUxCsQQeW+rCJ/OPSMcj3g0nfHn01zGYZXuNDvvXudF/TYY6APj5THlurerpFN4a/dQAIAaM6BYhA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@octokit/types": "^13.6.2",
|
||||
"universal-user-agent": "^7.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/octokit/node_modules/@octokit/graphql": {
|
||||
"version": "8.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-8.2.1.tgz",
|
||||
"integrity": "sha512-n57hXtOoHrhwTWdvhVkdJHdhTv0JstjDbDRhJfwIRNfFqmSo1DaK/mD2syoNUoLCyqSjBpGAKOG0BuwF392slw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@octokit/request": "^9.2.2",
|
||||
"@octokit/types": "^13.8.0",
|
||||
"universal-user-agent": "^7.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/octokit/node_modules/@octokit/plugin-paginate-graphql": {
|
||||
"version": "5.2.4",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-graphql/-/plugin-paginate-graphql-5.2.4.tgz",
|
||||
"integrity": "sha512-pLZES1jWaOynXKHOqdnwZ5ULeVR6tVVCMm+AUbp0htdcyXDU95WbkYdU4R2ej1wKj5Tu94Mee2Ne0PjPO9cCyA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@octokit/core": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/octokit/node_modules/@octokit/plugin-paginate-rest": {
|
||||
"version": "11.4.2",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-11.4.2.tgz",
|
||||
"integrity": "sha512-BXJ7XPCTDXFF+wxcg/zscfgw2O/iDPtNSkwwR1W1W5c4Mb3zav/M2XvxQ23nVmKj7jpweB4g8viMeCQdm7LMVA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@octokit/types": "^13.7.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@octokit/core": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/octokit/node_modules/@octokit/plugin-rest-endpoint-methods": {
|
||||
"version": "13.3.1",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-13.3.1.tgz",
|
||||
"integrity": "sha512-o8uOBdsyR+WR8MK9Cco8dCgvG13H1RlM1nWnK/W7TEACQBFux/vPREgKucxUfuDQ5yi1T3hGf4C5ZmZXAERgwQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@octokit/types": "^13.8.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@octokit/core": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/octokit/node_modules/@octokit/plugin-retry": {
|
||||
"version": "7.1.4",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/plugin-retry/-/plugin-retry-7.1.4.tgz",
|
||||
"integrity": "sha512-7AIP4p9TttKN7ctygG4BtR7rrB0anZqoU9ThXFk8nETqIfvgPUANTSYHqWYknK7W3isw59LpZeLI8pcEwiJdRg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@octokit/request-error": "^6.1.7",
|
||||
"@octokit/types": "^13.6.2",
|
||||
"bottleneck": "^2.15.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@octokit/core": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/octokit/node_modules/@octokit/plugin-throttling": {
|
||||
"version": "9.4.0",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/plugin-throttling/-/plugin-throttling-9.4.0.tgz",
|
||||
"integrity": "sha512-IOlXxXhZA4Z3m0EEYtrrACkuHiArHLZ3CvqWwOez/pURNqRuwfoFlTPbN5Muf28pzFuztxPyiUiNwz8KctdZaQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@octokit/types": "^13.7.0",
|
||||
"bottleneck": "^2.15.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@octokit/core": "^6.1.3"
|
||||
}
|
||||
},
|
||||
"node_modules/octokit/node_modules/@octokit/request": {
|
||||
"version": "9.2.2",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-9.2.2.tgz",
|
||||
"integrity": "sha512-dZl0ZHx6gOQGcffgm1/Sf6JfEpmh34v3Af2Uci02vzUYz6qEN6zepoRtmybWXIGXFIK8K9ylE3b+duCWqhArtg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@octokit/endpoint": "^10.1.3",
|
||||
"@octokit/request-error": "^6.1.7",
|
||||
"@octokit/types": "^13.6.2",
|
||||
"fast-content-type-parse": "^2.0.0",
|
||||
"universal-user-agent": "^7.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/octokit/node_modules/@octokit/request-error": {
|
||||
"version": "6.1.7",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-6.1.7.tgz",
|
||||
"integrity": "sha512-69NIppAwaauwZv6aOzb+VVLwt+0havz9GT5YplkeJv7fG7a40qpLt/yZKyiDxAhgz0EtgNdNcb96Z0u+Zyuy2g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@octokit/types": "^13.6.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/octokit/node_modules/before-after-hook": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-3.0.2.tgz",
|
||||
"integrity": "sha512-Nik3Sc0ncrMK4UUdXQmAnRtzmNQTAAXmXIopizwZ1W1t8QmfJj+zL4OA2I7XPTPW5z5TDqv4hRo/JzouDJnX3A==",
|
||||
"license": "Apache-2.0"
|
||||
},
|
||||
"node_modules/octokit/node_modules/universal-user-agent": {
|
||||
"version": "7.0.2",
|
||||
"resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-7.0.2.tgz",
|
||||
"integrity": "sha512-0JCqzSKnStlRRQfCdowvqy3cy0Dvtlb8xecj/H8JFZuCze4rwjPZQOgvFvn0Ws/usCHQFGpyr+pB9adaGwXn4Q==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/once": {
|
||||
"version": "1.4.0",
|
||||
"license": "ISC",
|
||||
|
|
@ -7235,6 +8078,15 @@
|
|||
"node": ">=8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/toad-cache": {
|
||||
"version": "3.7.0",
|
||||
"resolved": "https://registry.npmjs.org/toad-cache/-/toad-cache-3.7.0.tgz",
|
||||
"integrity": "sha512-/m8M+2BJUpoJdgAHoG+baCwBT+tf2VraSfkBgl0Y00qIWt41DJ8R5B8nsEw0I58YwF5IZH6z24/2TobDKnqSWw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/tr46": {
|
||||
"version": "0.0.3",
|
||||
"license": "MIT"
|
||||
|
|
@ -7604,6 +8456,12 @@
|
|||
"version": "5.26.5",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/universal-github-app-jwt": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/universal-github-app-jwt/-/universal-github-app-jwt-2.2.0.tgz",
|
||||
"integrity": "sha512-G5o6f95b5BggDGuUfKDApKaCgNYy2x7OdHY0zSMF081O0EJobw+1130VONhrA7ezGSV2FNOGyM+KQpQZAr9bIQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/universal-user-agent": {
|
||||
"version": "6.0.0",
|
||||
"license": "ISC"
|
||||
|
|
|
|||
21
node_modules/@octokit/app/LICENSE
generated
vendored
Normal file
21
node_modules/@octokit/app/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
The MIT License
|
||||
|
||||
Copyright (c) 2018 Octokit contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
440
node_modules/@octokit/app/README.md
generated
vendored
Normal file
440
node_modules/@octokit/app/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,440 @@
|
|||
# app.js
|
||||
|
||||
> GitHub App toolset for Node.js
|
||||
|
||||
[](https://www.npmjs.com/package/@octokit/app)
|
||||
[](https://github.com/octokit/app.js/actions?workflow=Test)
|
||||
|
||||
<!-- toc -->
|
||||
|
||||
- [Usage](#usage)
|
||||
- [`App.defaults(options)`](#appdefaultsoptions)
|
||||
- [Constructor](#constructor)
|
||||
- [API](#api)
|
||||
- [`app.octokit`](#appoctokit)
|
||||
- [`app.log`](#applog)
|
||||
- [`app.getInstallationOctokit`](#appgetinstallationoctokit)
|
||||
- [`app.eachInstallation`](#appeachinstallation)
|
||||
- [`app.eachRepository`](#appeachrepository)
|
||||
- [`app.getInstallationUrl`](#appgetinstallationurl)
|
||||
- [`app.webhooks`](#appwebhooks)
|
||||
- [`app.oauth`](#appoauth)
|
||||
- [Middlewares](#middlewares)
|
||||
- [`createNodeMiddleware(app, options)`](#createnodemiddlewareapp-options)
|
||||
- [Contributing](#contributing)
|
||||
- [License](#license)
|
||||
|
||||
<!-- tocstop -->
|
||||
|
||||
## Usage
|
||||
|
||||
<table>
|
||||
<tbody valign=top align=left>
|
||||
<tr><th>
|
||||
|
||||
Browsers
|
||||
|
||||
</th><td width=100%>
|
||||
|
||||
`@octokit/app` is not meant for browser usage.
|
||||
|
||||
</td></tr>
|
||||
<tr><th>
|
||||
|
||||
Node
|
||||
|
||||
</th><td>
|
||||
|
||||
Install with `npm install @octokit/app`
|
||||
|
||||
```js
|
||||
const { App, createNodeMiddleware } = require("@octokit/app");
|
||||
```
|
||||
|
||||
</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
> [!IMPORTANT]
|
||||
> As we use [conditional exports](https://nodejs.org/api/packages.html#conditional-exports), you will need to adapt your `tsconfig.json` by setting `"moduleResolution": "node16", "module": "node16"`.
|
||||
>
|
||||
> See the TypeScript docs on [package.json "exports"](https://www.typescriptlang.org/docs/handbook/modules/reference.html#packagejson-exports).<br>
|
||||
> See this [helpful guide on transitioning to ESM](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c) from [@sindresorhus](https://github.com/sindresorhus)
|
||||
|
||||
```js
|
||||
const app = new App({
|
||||
appId: 123,
|
||||
privateKey: "-----BEGIN PRIVATE KEY-----\n...",
|
||||
oauth: {
|
||||
clientId: "0123",
|
||||
clientSecret: "0123secret",
|
||||
},
|
||||
webhooks: {
|
||||
secret: "secret",
|
||||
},
|
||||
});
|
||||
|
||||
const { data } = await app.octokit.request("/app");
|
||||
console.log("authenticated as %s", data.name);
|
||||
for await (const { installation } of app.eachInstallation.iterator()) {
|
||||
for await (const { octokit, repository } of app.eachRepository.iterator({
|
||||
installationId: installation.id,
|
||||
})) {
|
||||
await octokit.request("POST /repos/{owner}/{repo}/dispatches", {
|
||||
owner: repository.owner.login,
|
||||
repo: repository.name,
|
||||
event_type: "my_event",
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
app.webhooks.on("issues.opened", async ({ octokit, payload }) => {
|
||||
await octokit.request(
|
||||
"POST /repos/{owner}/{repo}/issues/{issue_number}/comments",
|
||||
{
|
||||
owner: payload.repository.owner.login,
|
||||
repo: payload.repository.name,
|
||||
issue_number: payload.issue.number,
|
||||
body: "Hello World!",
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
app.oauth.on("token", async ({ token, octokit }) => {
|
||||
const { data } = await octokit.request("GET /user");
|
||||
console.log(`Token retrieved for ${data.login}`);
|
||||
});
|
||||
|
||||
require("http").createServer(createNodeMiddleware(app)).listen(3000);
|
||||
// can now receive requests at /api/github/*
|
||||
```
|
||||
|
||||
## `App.defaults(options)`
|
||||
|
||||
Create a new `App` with custom defaults for the [constructor options](#constructor-options)
|
||||
|
||||
```js
|
||||
const MyApp = App.defaults({
|
||||
Octokit: MyOctokit,
|
||||
});
|
||||
const app = new MyApp({ clientId, clientSecret });
|
||||
// app.octokit is now an instance of MyOctokit
|
||||
```
|
||||
|
||||
## Constructor
|
||||
|
||||
<table width="100%">
|
||||
<thead align=left>
|
||||
<tr>
|
||||
<th width=150>
|
||||
name
|
||||
</th>
|
||||
<th width=70>
|
||||
type
|
||||
</th>
|
||||
<th>
|
||||
description
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody align=left valign=top>
|
||||
<tr>
|
||||
<th>
|
||||
<code>appId</code>
|
||||
</th>
|
||||
<th>
|
||||
<code>number</code>
|
||||
</th>
|
||||
<td>
|
||||
<strong>Required</strong>. Find the <strong>App ID</strong> on the app’s about page in settings.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<code>privateKey</code>
|
||||
</th>
|
||||
<th>
|
||||
<code>string</code>
|
||||
</th>
|
||||
<td>
|
||||
<strong>Required</strong>. Content of the <code>*.pem</code> file you downloaded from the app’s about page. You can generate a new private key if needed.
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="constructor-option-octokit">
|
||||
<th>
|
||||
<code>Octokit</code>
|
||||
</th>
|
||||
<th>
|
||||
<code>Constructor</code>
|
||||
</th>
|
||||
<td>
|
||||
|
||||
You can pass in your own Octokit constructor with custom defaults and plugins. Note that `authStrategy` will be always be set to `createAppAuth` from [`@octokit/auth-app`](https://github.com/octokit/auth-app.js).
|
||||
|
||||
For usage with enterprise, set `baseUrl` to the hostname + `/api/v3`. Example:
|
||||
|
||||
```js
|
||||
const { Octokit } = require("@octokit/core");
|
||||
new App({
|
||||
appId: 123,
|
||||
privateKey: "-----BEGIN PRIVATE KEY-----\n...",
|
||||
oauth: {
|
||||
clientId: 123,
|
||||
clientSecret: "secret",
|
||||
},
|
||||
webhooks: {
|
||||
secret: "secret",
|
||||
},
|
||||
Octokit: Octokit.defaults({
|
||||
baseUrl: "https://ghe.my-company.com/api/v3",
|
||||
}),
|
||||
});
|
||||
```
|
||||
|
||||
Defaults to [`@octokit/core`](https://github.com/octokit/core.js).
|
||||
|
||||
</td></tr>
|
||||
<tr id="constructor-option-log">
|
||||
<th>
|
||||
<code>log</code>
|
||||
</th>
|
||||
<th>
|
||||
<code>object</code>
|
||||
</th>
|
||||
<td>
|
||||
Used for internal logging. Defaults to <a href="https://developer.mozilla.org/en-US/docs/Web/API/console"><code>console</code></a>.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<code>webhooks.secret</code>
|
||||
</th>
|
||||
<th>
|
||||
<code>string</code>
|
||||
</th>
|
||||
<td>
|
||||
<strong>Required.</strong> Secret as configured in the GitHub App's settings.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<code>webhooks.transform</code>
|
||||
</th>
|
||||
<th>
|
||||
<code>function</code>
|
||||
</th>
|
||||
<td>
|
||||
Only relevant for `app.webhooks.on`. Transform emitted event before calling handlers. Can be asynchronous.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<code>oauth.clientId</code>
|
||||
</th>
|
||||
<th>
|
||||
<code>number</code>
|
||||
</th>
|
||||
<td>
|
||||
Find the OAuth <strong>Client ID</strong> on the app’s about page in settings.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<code>oauth.clientSecret</code>
|
||||
</th>
|
||||
<th>
|
||||
<code>number</code>
|
||||
</th>
|
||||
<td>
|
||||
Find the OAuth <strong>Client Secret</strong> on the app’s about page in settings.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<code>oauth.allowSignup</code>
|
||||
</th>
|
||||
<th>
|
||||
<code>boolean</code>
|
||||
</th>
|
||||
<td>
|
||||
Sets the default value for <code>app.oauth.getAuthorizationUrl(options)</code>.
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
## API
|
||||
|
||||
### `app.octokit`
|
||||
|
||||
Octokit instance. Uses the [`Octokit` constructor option](#constructor-option-octokit) if passed.
|
||||
|
||||
### `app.log`
|
||||
|
||||
See https://github.com/octokit/core.js#logging. Customize using the [`log` constructor option](#constructor-option-log).
|
||||
|
||||
### `app.getInstallationOctokit`
|
||||
|
||||
```js
|
||||
const octokit = await app.getInstallationOctokit(123);
|
||||
```
|
||||
|
||||
### `app.eachInstallation`
|
||||
|
||||
```js
|
||||
for await (const { octokit, installation } of app.eachInstallation.iterator()) { /* ... */ }
|
||||
await app.eachInstallation(({ octokit, installation }) => /* ... */)
|
||||
```
|
||||
|
||||
### `app.eachRepository`
|
||||
|
||||
```js
|
||||
for await (const { octokit, repository } of app.eachRepository.iterator()) { /* ... */ }
|
||||
await app.eachRepository(({ octokit, repository }) => /* ... */)
|
||||
```
|
||||
|
||||
Optionally pass installation ID to iterate through all repositories in one installation
|
||||
|
||||
```js
|
||||
for await (const { octokit, repository } of app.eachRepository.iterator({ installationId })) { /* ... */ }
|
||||
await app.eachRepository({ installationId }, ({ octokit, repository }) => /* ... */)
|
||||
```
|
||||
|
||||
### `app.getInstallationUrl`
|
||||
|
||||
```js
|
||||
const installationUrl = await app.getInstallationUrl();
|
||||
return res.redirect(installationUrl);
|
||||
```
|
||||
|
||||
Optionally pass the ID of a GitHub organization or user to request installation on that specific target.
|
||||
|
||||
If the user will be sent to a redirect URL after installation (such as if you request user authorization during installation), you can also supply a `state` string that will be included in the query of the post-install redirect.
|
||||
|
||||
```js
|
||||
const installationUrl = await app.getInstallationUrl({ state, target_id });
|
||||
return res.redirect(installationUrl);
|
||||
```
|
||||
|
||||
### `app.webhooks`
|
||||
|
||||
An [`@octokit/webhooks` instance](https://github.com/octokit/webhooks.js/#readme)
|
||||
|
||||
### `app.oauth`
|
||||
|
||||
An [`@octokit/oauth-app` instance](https://github.com/octokit/oauth-app.js/#readme)
|
||||
|
||||
## Middlewares
|
||||
|
||||
A middleware is a method or set of methods to handle requests for common environments.
|
||||
|
||||
By default, all middlewares expose the following routes
|
||||
|
||||
| Route | Route Description |
|
||||
| -------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `POST /api/github/webhooks` | Endpoint to receive GitHub Webhook Event requests |
|
||||
| `GET /api/github/oauth/login` | Redirects to GitHub's authorization endpoint. Accepts optional `?state` query parameter. |
|
||||
| `GET /api/github/oauth/callback` | The client's redirect endpoint. This is where the `token` event gets triggered |
|
||||
| `POST /api/github/oauth/token` | Exchange an authorization code for an OAuth Access token. If successful, the `token` event gets triggered. |
|
||||
| `GET /api/github/oauth/token` | Check if token is valid. Must authenticate using token in `Authorization` header. Uses GitHub's [`POST /applications/{client_id}/token`](https://developer.github.com/v3/apps/oauth_applications/#check-a-token) endpoint |
|
||||
| `PATCH /api/github/oauth/token` | Resets a token (invalidates current one, returns new token). Must authenticate using token in `Authorization` header. Uses GitHub's [`PATCH /applications/{client_id}/token`](https://developer.github.com/v3/apps/oauth_applications/#reset-a-token) endpoint. |
|
||||
| `DELETE /api/github/oauth/token` | Invalidates current token, basically the equivalent of a logout. Must authenticate using token in `Authorization` header. |
|
||||
| `DELETE /api/github/oauth/grant` | Revokes the user's grant, basically the equivalent of an uninstall. must authenticate using token in `Authorization` header. |
|
||||
|
||||
### `createNodeMiddleware(app, options)`
|
||||
|
||||
Middleware for Node's built in http server or [`express`](https://expressjs.com/).
|
||||
|
||||
```js
|
||||
const { App, createNodeMiddleware } = require("@octokit/app");
|
||||
|
||||
const app = new App({
|
||||
appId: 123,
|
||||
privateKey: "-----BEGIN PRIVATE KEY-----\n...",
|
||||
oauth: {
|
||||
clientId: "0123",
|
||||
clientSecret: "0123secret",
|
||||
},
|
||||
webhooks: {
|
||||
secret: "secret",
|
||||
},
|
||||
});
|
||||
|
||||
const middleware = createNodeMiddleware(app);
|
||||
require("http")
|
||||
.createServer(async (req, res) => {
|
||||
// `middleware` returns `false` when `req` is unhandled (beyond `/api/github`)
|
||||
if (await middleware(req, res)) return;
|
||||
res.writeHead(404);
|
||||
res.end();
|
||||
})
|
||||
.listen(3000);
|
||||
// can now receive user authorization callbacks at /api/github/*
|
||||
```
|
||||
|
||||
The middleware returned from `createNodeMiddleware` can also serve as an
|
||||
`Express.js` middleware directly.
|
||||
|
||||
<table width="100%">
|
||||
<thead align=left>
|
||||
<tr>
|
||||
<th width=150>
|
||||
name
|
||||
</th>
|
||||
<th width=70>
|
||||
type
|
||||
</th>
|
||||
<th>
|
||||
description
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody align=left valign=top>
|
||||
<tr>
|
||||
<th>
|
||||
<code>app</code>
|
||||
</th>
|
||||
<th>
|
||||
<code>App instance</code>
|
||||
</th>
|
||||
<td>
|
||||
<strong>Required</strong>.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<code>options.pathPrefix</code>
|
||||
</th>
|
||||
<th>
|
||||
<code>string</code>
|
||||
</th>
|
||||
<td>
|
||||
|
||||
All exposed paths will be prefixed with the provided prefix. Defaults to `"/api/github"`
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>log</code>
|
||||
<em>
|
||||
object
|
||||
</em>
|
||||
</td>
|
||||
<td>
|
||||
|
||||
Used for internal logging. Defaults to [`console`](https://developer.mozilla.org/en-US/docs/Web/API/console) with `debug` and `info` doing nothing.
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
## Contributing
|
||||
|
||||
See [CONTRIBUTING.md](CONTRIBUTING.md)
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
341
node_modules/@octokit/app/dist-node/index.js
generated
vendored
Normal file
341
node_modules/@octokit/app/dist-node/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,341 @@
|
|||
// pkg/dist-src/index.js
|
||||
import { Octokit as OctokitCore } from "@octokit/core";
|
||||
import { createAppAuth as createAppAuth3 } from "@octokit/auth-app";
|
||||
import { OAuthApp } from "@octokit/oauth-app";
|
||||
|
||||
// pkg/dist-src/version.js
|
||||
var VERSION = "15.1.4";
|
||||
|
||||
// pkg/dist-src/webhooks.js
|
||||
import { createAppAuth } from "@octokit/auth-app";
|
||||
import { createUnauthenticatedAuth } from "@octokit/auth-unauthenticated";
|
||||
import { Webhooks } from "@octokit/webhooks";
|
||||
function webhooks(appOctokit, options) {
|
||||
return new Webhooks({
|
||||
secret: options.secret,
|
||||
transform: async (event) => {
|
||||
if (!("installation" in event.payload) || typeof event.payload.installation !== "object") {
|
||||
const octokit2 = new appOctokit.constructor({
|
||||
authStrategy: createUnauthenticatedAuth,
|
||||
auth: {
|
||||
reason: `"installation" key missing in webhook event payload`
|
||||
}
|
||||
});
|
||||
return {
|
||||
...event,
|
||||
octokit: octokit2
|
||||
};
|
||||
}
|
||||
const installationId = event.payload.installation.id;
|
||||
const octokit = await appOctokit.auth({
|
||||
type: "installation",
|
||||
installationId,
|
||||
factory(auth) {
|
||||
return new auth.octokit.constructor({
|
||||
...auth.octokitOptions,
|
||||
authStrategy: createAppAuth,
|
||||
...{
|
||||
auth: {
|
||||
...auth,
|
||||
installationId
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
octokit.hook.before("request", (options2) => {
|
||||
options2.headers["x-github-delivery"] = event.id;
|
||||
});
|
||||
return {
|
||||
...event,
|
||||
octokit
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// pkg/dist-src/each-installation.js
|
||||
import { composePaginateRest } from "@octokit/plugin-paginate-rest";
|
||||
|
||||
// pkg/dist-src/get-installation-octokit.js
|
||||
import { createAppAuth as createAppAuth2 } from "@octokit/auth-app";
|
||||
async function getInstallationOctokit(app, installationId) {
|
||||
return app.octokit.auth({
|
||||
type: "installation",
|
||||
installationId,
|
||||
factory(auth) {
|
||||
const options = {
|
||||
...auth.octokitOptions,
|
||||
authStrategy: createAppAuth2,
|
||||
...{ auth: { ...auth, installationId } }
|
||||
};
|
||||
return new auth.octokit.constructor(options);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// pkg/dist-src/each-installation.js
|
||||
function eachInstallationFactory(app) {
|
||||
return Object.assign(eachInstallation.bind(null, app), {
|
||||
iterator: eachInstallationIterator.bind(null, app)
|
||||
});
|
||||
}
|
||||
async function eachInstallation(app, callback) {
|
||||
const i = eachInstallationIterator(app)[Symbol.asyncIterator]();
|
||||
let result = await i.next();
|
||||
while (!result.done) {
|
||||
await callback(result.value);
|
||||
result = await i.next();
|
||||
}
|
||||
}
|
||||
function eachInstallationIterator(app) {
|
||||
return {
|
||||
async *[Symbol.asyncIterator]() {
|
||||
const iterator = composePaginateRest.iterator(
|
||||
app.octokit,
|
||||
"GET /app/installations"
|
||||
);
|
||||
for await (const { data: installations } of iterator) {
|
||||
for (const installation of installations) {
|
||||
const installationOctokit = await getInstallationOctokit(
|
||||
app,
|
||||
installation.id
|
||||
);
|
||||
yield { octokit: installationOctokit, installation };
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// pkg/dist-src/each-repository.js
|
||||
import { composePaginateRest as composePaginateRest2 } from "@octokit/plugin-paginate-rest";
|
||||
function eachRepositoryFactory(app) {
|
||||
return Object.assign(eachRepository.bind(null, app), {
|
||||
iterator: eachRepositoryIterator.bind(null, app)
|
||||
});
|
||||
}
|
||||
async function eachRepository(app, queryOrCallback, callback) {
|
||||
const i = eachRepositoryIterator(
|
||||
app,
|
||||
callback ? queryOrCallback : void 0
|
||||
)[Symbol.asyncIterator]();
|
||||
let result = await i.next();
|
||||
while (!result.done) {
|
||||
if (callback) {
|
||||
await callback(result.value);
|
||||
} else {
|
||||
await queryOrCallback(result.value);
|
||||
}
|
||||
result = await i.next();
|
||||
}
|
||||
}
|
||||
function singleInstallationIterator(app, installationId) {
|
||||
return {
|
||||
async *[Symbol.asyncIterator]() {
|
||||
yield {
|
||||
octokit: await app.getInstallationOctokit(installationId)
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
function eachRepositoryIterator(app, query) {
|
||||
return {
|
||||
async *[Symbol.asyncIterator]() {
|
||||
const iterator = query ? singleInstallationIterator(app, query.installationId) : app.eachInstallation.iterator();
|
||||
for await (const { octokit } of iterator) {
|
||||
const repositoriesIterator = composePaginateRest2.iterator(
|
||||
octokit,
|
||||
"GET /installation/repositories"
|
||||
);
|
||||
for await (const { data: repositories } of repositoriesIterator) {
|
||||
for (const repository of repositories) {
|
||||
yield { octokit, repository };
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// pkg/dist-src/get-installation-url.js
|
||||
function getInstallationUrlFactory(app) {
|
||||
let installationUrlBasePromise;
|
||||
return async function getInstallationUrl(options = {}) {
|
||||
if (!installationUrlBasePromise) {
|
||||
installationUrlBasePromise = getInstallationUrlBase(app);
|
||||
}
|
||||
const installationUrlBase = await installationUrlBasePromise;
|
||||
const installationUrl = new URL(installationUrlBase);
|
||||
if (options.target_id !== void 0) {
|
||||
installationUrl.pathname += "/permissions";
|
||||
installationUrl.searchParams.append(
|
||||
"target_id",
|
||||
options.target_id.toFixed()
|
||||
);
|
||||
}
|
||||
if (options.state !== void 0) {
|
||||
installationUrl.searchParams.append("state", options.state);
|
||||
}
|
||||
return installationUrl.href;
|
||||
};
|
||||
}
|
||||
async function getInstallationUrlBase(app) {
|
||||
const { data: appInfo } = await app.octokit.request("GET /app");
|
||||
if (!appInfo) {
|
||||
throw new Error("[@octokit/app] unable to fetch metadata for app");
|
||||
}
|
||||
return `${appInfo.html_url}/installations/new`;
|
||||
}
|
||||
|
||||
// pkg/dist-src/middleware/node/index.js
|
||||
import {
|
||||
createNodeMiddleware as oauthNodeMiddleware,
|
||||
sendNodeResponse,
|
||||
unknownRouteResponse
|
||||
} from "@octokit/oauth-app";
|
||||
import { createNodeMiddleware as webhooksNodeMiddleware } from "@octokit/webhooks";
|
||||
function noop() {
|
||||
}
|
||||
function createNodeMiddleware(app, options = {}) {
|
||||
const log = Object.assign(
|
||||
{
|
||||
debug: noop,
|
||||
info: noop,
|
||||
warn: console.warn.bind(console),
|
||||
error: console.error.bind(console)
|
||||
},
|
||||
options.log
|
||||
);
|
||||
const optionsWithDefaults = {
|
||||
pathPrefix: "/api/github",
|
||||
...options,
|
||||
log
|
||||
};
|
||||
const webhooksMiddleware = webhooksNodeMiddleware(app.webhooks, {
|
||||
path: optionsWithDefaults.pathPrefix + "/webhooks",
|
||||
log
|
||||
});
|
||||
const oauthMiddleware = oauthNodeMiddleware(app.oauth, {
|
||||
pathPrefix: optionsWithDefaults.pathPrefix + "/oauth"
|
||||
});
|
||||
return middleware.bind(
|
||||
null,
|
||||
optionsWithDefaults.pathPrefix,
|
||||
webhooksMiddleware,
|
||||
oauthMiddleware
|
||||
);
|
||||
}
|
||||
async function middleware(pathPrefix, webhooksMiddleware, oauthMiddleware, request, response, next) {
|
||||
const { pathname } = new URL(request.url, "http://localhost");
|
||||
if (pathname.startsWith(`${pathPrefix}/`)) {
|
||||
if (pathname === `${pathPrefix}/webhooks`) {
|
||||
webhooksMiddleware(request, response);
|
||||
} else if (pathname.startsWith(`${pathPrefix}/oauth/`)) {
|
||||
oauthMiddleware(request, response);
|
||||
} else {
|
||||
sendNodeResponse(unknownRouteResponse(request), response);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
next?.();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// pkg/dist-src/index.js
|
||||
var App = class {
|
||||
static VERSION = VERSION;
|
||||
static defaults(defaults) {
|
||||
const AppWithDefaults = class extends this {
|
||||
constructor(...args) {
|
||||
super({
|
||||
...defaults,
|
||||
...args[0]
|
||||
});
|
||||
}
|
||||
};
|
||||
return AppWithDefaults;
|
||||
}
|
||||
octokit;
|
||||
// @ts-ignore calling app.webhooks will throw a helpful error when options.webhooks is not set
|
||||
webhooks;
|
||||
// @ts-ignore calling app.oauth will throw a helpful error when options.oauth is not set
|
||||
oauth;
|
||||
getInstallationOctokit;
|
||||
eachInstallation;
|
||||
eachRepository;
|
||||
getInstallationUrl;
|
||||
log;
|
||||
constructor(options) {
|
||||
const Octokit = options.Octokit || OctokitCore;
|
||||
const authOptions = Object.assign(
|
||||
{
|
||||
appId: options.appId,
|
||||
privateKey: options.privateKey
|
||||
},
|
||||
options.oauth ? {
|
||||
clientId: options.oauth.clientId,
|
||||
clientSecret: options.oauth.clientSecret
|
||||
} : {}
|
||||
);
|
||||
const octokitOptions = {
|
||||
authStrategy: createAppAuth3,
|
||||
auth: authOptions
|
||||
};
|
||||
if ("log" in options && typeof options.log !== "undefined") {
|
||||
octokitOptions.log = options.log;
|
||||
}
|
||||
this.octokit = new Octokit(octokitOptions);
|
||||
this.log = Object.assign(
|
||||
{
|
||||
debug: () => {
|
||||
},
|
||||
info: () => {
|
||||
},
|
||||
warn: console.warn.bind(console),
|
||||
error: console.error.bind(console)
|
||||
},
|
||||
options.log
|
||||
);
|
||||
if (options.webhooks) {
|
||||
this.webhooks = webhooks(this.octokit, options.webhooks);
|
||||
} else {
|
||||
Object.defineProperty(this, "webhooks", {
|
||||
get() {
|
||||
throw new Error("[@octokit/app] webhooks option not set");
|
||||
}
|
||||
});
|
||||
}
|
||||
if (options.oauth) {
|
||||
this.oauth = new OAuthApp({
|
||||
...options.oauth,
|
||||
clientType: "github-app",
|
||||
Octokit
|
||||
});
|
||||
} else {
|
||||
Object.defineProperty(this, "oauth", {
|
||||
get() {
|
||||
throw new Error(
|
||||
"[@octokit/app] oauth.clientId / oauth.clientSecret options are not set"
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
this.getInstallationOctokit = getInstallationOctokit.bind(
|
||||
null,
|
||||
this
|
||||
);
|
||||
this.eachInstallation = eachInstallationFactory(
|
||||
this
|
||||
);
|
||||
this.eachRepository = eachRepositoryFactory(
|
||||
this
|
||||
);
|
||||
this.getInstallationUrl = getInstallationUrlFactory(this);
|
||||
}
|
||||
};
|
||||
export {
|
||||
App,
|
||||
createNodeMiddleware
|
||||
};
|
||||
7
node_modules/@octokit/app/dist-node/index.js.map
generated
vendored
Normal file
7
node_modules/@octokit/app/dist-node/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
39
node_modules/@octokit/app/dist-src/each-installation.js
generated
vendored
Normal file
39
node_modules/@octokit/app/dist-src/each-installation.js
generated
vendored
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
import { composePaginateRest } from "@octokit/plugin-paginate-rest";
|
||||
import { getInstallationOctokit } from "./get-installation-octokit.js";
|
||||
function eachInstallationFactory(app) {
|
||||
return Object.assign(eachInstallation.bind(null, app), {
|
||||
iterator: eachInstallationIterator.bind(null, app)
|
||||
});
|
||||
}
|
||||
async function eachInstallation(app, callback) {
|
||||
const i = eachInstallationIterator(app)[Symbol.asyncIterator]();
|
||||
let result = await i.next();
|
||||
while (!result.done) {
|
||||
await callback(result.value);
|
||||
result = await i.next();
|
||||
}
|
||||
}
|
||||
function eachInstallationIterator(app) {
|
||||
return {
|
||||
async *[Symbol.asyncIterator]() {
|
||||
const iterator = composePaginateRest.iterator(
|
||||
app.octokit,
|
||||
"GET /app/installations"
|
||||
);
|
||||
for await (const { data: installations } of iterator) {
|
||||
for (const installation of installations) {
|
||||
const installationOctokit = await getInstallationOctokit(
|
||||
app,
|
||||
installation.id
|
||||
);
|
||||
yield { octokit: installationOctokit, installation };
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
export {
|
||||
eachInstallation,
|
||||
eachInstallationFactory,
|
||||
eachInstallationIterator
|
||||
};
|
||||
53
node_modules/@octokit/app/dist-src/each-repository.js
generated
vendored
Normal file
53
node_modules/@octokit/app/dist-src/each-repository.js
generated
vendored
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
import { composePaginateRest } from "@octokit/plugin-paginate-rest";
|
||||
function eachRepositoryFactory(app) {
|
||||
return Object.assign(eachRepository.bind(null, app), {
|
||||
iterator: eachRepositoryIterator.bind(null, app)
|
||||
});
|
||||
}
|
||||
async function eachRepository(app, queryOrCallback, callback) {
|
||||
const i = eachRepositoryIterator(
|
||||
app,
|
||||
callback ? queryOrCallback : void 0
|
||||
)[Symbol.asyncIterator]();
|
||||
let result = await i.next();
|
||||
while (!result.done) {
|
||||
if (callback) {
|
||||
await callback(result.value);
|
||||
} else {
|
||||
await queryOrCallback(result.value);
|
||||
}
|
||||
result = await i.next();
|
||||
}
|
||||
}
|
||||
function singleInstallationIterator(app, installationId) {
|
||||
return {
|
||||
async *[Symbol.asyncIterator]() {
|
||||
yield {
|
||||
octokit: await app.getInstallationOctokit(installationId)
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
function eachRepositoryIterator(app, query) {
|
||||
return {
|
||||
async *[Symbol.asyncIterator]() {
|
||||
const iterator = query ? singleInstallationIterator(app, query.installationId) : app.eachInstallation.iterator();
|
||||
for await (const { octokit } of iterator) {
|
||||
const repositoriesIterator = composePaginateRest.iterator(
|
||||
octokit,
|
||||
"GET /installation/repositories"
|
||||
);
|
||||
for await (const { data: repositories } of repositoriesIterator) {
|
||||
for (const repository of repositories) {
|
||||
yield { octokit, repository };
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
export {
|
||||
eachRepository,
|
||||
eachRepositoryFactory,
|
||||
eachRepositoryIterator
|
||||
};
|
||||
18
node_modules/@octokit/app/dist-src/get-installation-octokit.js
generated
vendored
Normal file
18
node_modules/@octokit/app/dist-src/get-installation-octokit.js
generated
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
import { createAppAuth } from "@octokit/auth-app";
|
||||
async function getInstallationOctokit(app, installationId) {
|
||||
return app.octokit.auth({
|
||||
type: "installation",
|
||||
installationId,
|
||||
factory(auth) {
|
||||
const options = {
|
||||
...auth.octokitOptions,
|
||||
authStrategy: createAppAuth,
|
||||
...{ auth: { ...auth, installationId } }
|
||||
};
|
||||
return new auth.octokit.constructor(options);
|
||||
}
|
||||
});
|
||||
}
|
||||
export {
|
||||
getInstallationOctokit
|
||||
};
|
||||
31
node_modules/@octokit/app/dist-src/get-installation-url.js
generated
vendored
Normal file
31
node_modules/@octokit/app/dist-src/get-installation-url.js
generated
vendored
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
function getInstallationUrlFactory(app) {
|
||||
let installationUrlBasePromise;
|
||||
return async function getInstallationUrl(options = {}) {
|
||||
if (!installationUrlBasePromise) {
|
||||
installationUrlBasePromise = getInstallationUrlBase(app);
|
||||
}
|
||||
const installationUrlBase = await installationUrlBasePromise;
|
||||
const installationUrl = new URL(installationUrlBase);
|
||||
if (options.target_id !== void 0) {
|
||||
installationUrl.pathname += "/permissions";
|
||||
installationUrl.searchParams.append(
|
||||
"target_id",
|
||||
options.target_id.toFixed()
|
||||
);
|
||||
}
|
||||
if (options.state !== void 0) {
|
||||
installationUrl.searchParams.append("state", options.state);
|
||||
}
|
||||
return installationUrl.href;
|
||||
};
|
||||
}
|
||||
async function getInstallationUrlBase(app) {
|
||||
const { data: appInfo } = await app.octokit.request("GET /app");
|
||||
if (!appInfo) {
|
||||
throw new Error("[@octokit/app] unable to fetch metadata for app");
|
||||
}
|
||||
return `${appInfo.html_url}/installations/new`;
|
||||
}
|
||||
export {
|
||||
getInstallationUrlFactory
|
||||
};
|
||||
105
node_modules/@octokit/app/dist-src/index.js
generated
vendored
Normal file
105
node_modules/@octokit/app/dist-src/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
import { Octokit as OctokitCore } from "@octokit/core";
|
||||
import { createAppAuth } from "@octokit/auth-app";
|
||||
import { OAuthApp } from "@octokit/oauth-app";
|
||||
import { VERSION } from "./version.js";
|
||||
import { webhooks } from "./webhooks.js";
|
||||
import { eachInstallationFactory } from "./each-installation.js";
|
||||
import { eachRepositoryFactory } from "./each-repository.js";
|
||||
import { getInstallationOctokit } from "./get-installation-octokit.js";
|
||||
import { getInstallationUrlFactory } from "./get-installation-url.js";
|
||||
class App {
|
||||
static VERSION = VERSION;
|
||||
static defaults(defaults) {
|
||||
const AppWithDefaults = class extends this {
|
||||
constructor(...args) {
|
||||
super({
|
||||
...defaults,
|
||||
...args[0]
|
||||
});
|
||||
}
|
||||
};
|
||||
return AppWithDefaults;
|
||||
}
|
||||
octokit;
|
||||
// @ts-ignore calling app.webhooks will throw a helpful error when options.webhooks is not set
|
||||
webhooks;
|
||||
// @ts-ignore calling app.oauth will throw a helpful error when options.oauth is not set
|
||||
oauth;
|
||||
getInstallationOctokit;
|
||||
eachInstallation;
|
||||
eachRepository;
|
||||
getInstallationUrl;
|
||||
log;
|
||||
constructor(options) {
|
||||
const Octokit = options.Octokit || OctokitCore;
|
||||
const authOptions = Object.assign(
|
||||
{
|
||||
appId: options.appId,
|
||||
privateKey: options.privateKey
|
||||
},
|
||||
options.oauth ? {
|
||||
clientId: options.oauth.clientId,
|
||||
clientSecret: options.oauth.clientSecret
|
||||
} : {}
|
||||
);
|
||||
const octokitOptions = {
|
||||
authStrategy: createAppAuth,
|
||||
auth: authOptions
|
||||
};
|
||||
if ("log" in options && typeof options.log !== "undefined") {
|
||||
octokitOptions.log = options.log;
|
||||
}
|
||||
this.octokit = new Octokit(octokitOptions);
|
||||
this.log = Object.assign(
|
||||
{
|
||||
debug: () => {
|
||||
},
|
||||
info: () => {
|
||||
},
|
||||
warn: console.warn.bind(console),
|
||||
error: console.error.bind(console)
|
||||
},
|
||||
options.log
|
||||
);
|
||||
if (options.webhooks) {
|
||||
this.webhooks = webhooks(this.octokit, options.webhooks);
|
||||
} else {
|
||||
Object.defineProperty(this, "webhooks", {
|
||||
get() {
|
||||
throw new Error("[@octokit/app] webhooks option not set");
|
||||
}
|
||||
});
|
||||
}
|
||||
if (options.oauth) {
|
||||
this.oauth = new OAuthApp({
|
||||
...options.oauth,
|
||||
clientType: "github-app",
|
||||
Octokit
|
||||
});
|
||||
} else {
|
||||
Object.defineProperty(this, "oauth", {
|
||||
get() {
|
||||
throw new Error(
|
||||
"[@octokit/app] oauth.clientId / oauth.clientSecret options are not set"
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
this.getInstallationOctokit = getInstallationOctokit.bind(
|
||||
null,
|
||||
this
|
||||
);
|
||||
this.eachInstallation = eachInstallationFactory(
|
||||
this
|
||||
);
|
||||
this.eachRepository = eachRepositoryFactory(
|
||||
this
|
||||
);
|
||||
this.getInstallationUrl = getInstallationUrlFactory(this);
|
||||
}
|
||||
}
|
||||
import { createNodeMiddleware } from "./middleware/node/index.js";
|
||||
export {
|
||||
App,
|
||||
createNodeMiddleware
|
||||
};
|
||||
57
node_modules/@octokit/app/dist-src/middleware/node/index.js
generated
vendored
Normal file
57
node_modules/@octokit/app/dist-src/middleware/node/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
import {
|
||||
createNodeMiddleware as oauthNodeMiddleware,
|
||||
sendNodeResponse,
|
||||
unknownRouteResponse
|
||||
} from "@octokit/oauth-app";
|
||||
import { createNodeMiddleware as webhooksNodeMiddleware } from "@octokit/webhooks";
|
||||
function noop() {
|
||||
}
|
||||
function createNodeMiddleware(app, options = {}) {
|
||||
const log = Object.assign(
|
||||
{
|
||||
debug: noop,
|
||||
info: noop,
|
||||
warn: console.warn.bind(console),
|
||||
error: console.error.bind(console)
|
||||
},
|
||||
options.log
|
||||
);
|
||||
const optionsWithDefaults = {
|
||||
pathPrefix: "/api/github",
|
||||
...options,
|
||||
log
|
||||
};
|
||||
const webhooksMiddleware = webhooksNodeMiddleware(app.webhooks, {
|
||||
path: optionsWithDefaults.pathPrefix + "/webhooks",
|
||||
log
|
||||
});
|
||||
const oauthMiddleware = oauthNodeMiddleware(app.oauth, {
|
||||
pathPrefix: optionsWithDefaults.pathPrefix + "/oauth"
|
||||
});
|
||||
return middleware.bind(
|
||||
null,
|
||||
optionsWithDefaults.pathPrefix,
|
||||
webhooksMiddleware,
|
||||
oauthMiddleware
|
||||
);
|
||||
}
|
||||
async function middleware(pathPrefix, webhooksMiddleware, oauthMiddleware, request, response, next) {
|
||||
const { pathname } = new URL(request.url, "http://localhost");
|
||||
if (pathname.startsWith(`${pathPrefix}/`)) {
|
||||
if (pathname === `${pathPrefix}/webhooks`) {
|
||||
webhooksMiddleware(request, response);
|
||||
} else if (pathname.startsWith(`${pathPrefix}/oauth/`)) {
|
||||
oauthMiddleware(request, response);
|
||||
} else {
|
||||
sendNodeResponse(unknownRouteResponse(request), response);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
next?.();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
export {
|
||||
createNodeMiddleware,
|
||||
middleware
|
||||
};
|
||||
4
node_modules/@octokit/app/dist-src/version.js
generated
vendored
Normal file
4
node_modules/@octokit/app/dist-src/version.js
generated
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
const VERSION = "15.1.4";
|
||||
export {
|
||||
VERSION
|
||||
};
|
||||
49
node_modules/@octokit/app/dist-src/webhooks.js
generated
vendored
Normal file
49
node_modules/@octokit/app/dist-src/webhooks.js
generated
vendored
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
import { createAppAuth } from "@octokit/auth-app";
|
||||
import { createUnauthenticatedAuth } from "@octokit/auth-unauthenticated";
|
||||
import { Webhooks } from "@octokit/webhooks";
|
||||
function webhooks(appOctokit, options) {
|
||||
return new Webhooks({
|
||||
secret: options.secret,
|
||||
transform: async (event) => {
|
||||
if (!("installation" in event.payload) || typeof event.payload.installation !== "object") {
|
||||
const octokit2 = new appOctokit.constructor({
|
||||
authStrategy: createUnauthenticatedAuth,
|
||||
auth: {
|
||||
reason: `"installation" key missing in webhook event payload`
|
||||
}
|
||||
});
|
||||
return {
|
||||
...event,
|
||||
octokit: octokit2
|
||||
};
|
||||
}
|
||||
const installationId = event.payload.installation.id;
|
||||
const octokit = await appOctokit.auth({
|
||||
type: "installation",
|
||||
installationId,
|
||||
factory(auth) {
|
||||
return new auth.octokit.constructor({
|
||||
...auth.octokitOptions,
|
||||
authStrategy: createAppAuth,
|
||||
...{
|
||||
auth: {
|
||||
...auth,
|
||||
installationId
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
octokit.hook.before("request", (options2) => {
|
||||
options2.headers["x-github-delivery"] = event.id;
|
||||
});
|
||||
return {
|
||||
...event,
|
||||
octokit
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
export {
|
||||
webhooks
|
||||
};
|
||||
122
node_modules/@octokit/app/dist-types/each-installation.d.ts
generated
vendored
Normal file
122
node_modules/@octokit/app/dist-types/each-installation.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,122 @@
|
|||
import type { Octokit } from "@octokit/core";
|
||||
import type { App } from "./index.js";
|
||||
import type { EachInstallationFunction, EachInstallationInterface } from "./types.js";
|
||||
export declare function eachInstallationFactory(app: App): EachInstallationInterface<Octokit>;
|
||||
export declare function eachInstallation(app: App, callback: EachInstallationFunction<Octokit>): Promise<void>;
|
||||
export declare function eachInstallationIterator(app: App): {
|
||||
[Symbol.asyncIterator](): AsyncGenerator<{
|
||||
octokit: Octokit;
|
||||
installation: {
|
||||
id: number;
|
||||
account: ({
|
||||
name?: string | null;
|
||||
email?: string | null;
|
||||
login: string;
|
||||
id: number;
|
||||
node_id: string;
|
||||
avatar_url: string;
|
||||
gravatar_id: string | null;
|
||||
url: string;
|
||||
html_url: string;
|
||||
followers_url: string;
|
||||
following_url: string;
|
||||
gists_url: string;
|
||||
starred_url: string;
|
||||
subscriptions_url: string;
|
||||
organizations_url: string;
|
||||
repos_url: string;
|
||||
events_url: string;
|
||||
received_events_url: string;
|
||||
type: string;
|
||||
site_admin: boolean;
|
||||
starred_at?: string;
|
||||
} & {
|
||||
description?: string | null;
|
||||
html_url: string;
|
||||
website_url?: string | null;
|
||||
id: number;
|
||||
node_id: string;
|
||||
name: string;
|
||||
slug: string;
|
||||
created_at: string | null;
|
||||
updated_at: string | null;
|
||||
avatar_url: string;
|
||||
}) | null;
|
||||
repository_selection: "all" | "selected";
|
||||
access_tokens_url: string;
|
||||
repositories_url: string;
|
||||
html_url: string;
|
||||
app_id: number;
|
||||
target_id: number;
|
||||
target_type: string;
|
||||
permissions: {
|
||||
actions?: "read" | "write";
|
||||
administration?: "read" | "write";
|
||||
checks?: "read" | "write";
|
||||
contents?: "read" | "write";
|
||||
deployments?: "read" | "write";
|
||||
environments?: "read" | "write";
|
||||
issues?: "read" | "write";
|
||||
metadata?: "read" | "write";
|
||||
packages?: "read" | "write";
|
||||
pages?: "read" | "write";
|
||||
pull_requests?: "read" | "write";
|
||||
repository_hooks?: "read" | "write";
|
||||
repository_projects?: "read" | "write" | "admin";
|
||||
secret_scanning_alerts?: "read" | "write";
|
||||
secrets?: "read" | "write";
|
||||
security_events?: "read" | "write";
|
||||
single_file?: "read" | "write";
|
||||
statuses?: "read" | "write";
|
||||
vulnerability_alerts?: "read" | "write";
|
||||
workflows?: "write";
|
||||
members?: "read" | "write";
|
||||
organization_administration?: "read" | "write";
|
||||
organization_custom_roles?: "read" | "write";
|
||||
organization_announcement_banners?: "read" | "write";
|
||||
organization_hooks?: "read" | "write";
|
||||
organization_personal_access_tokens?: "read" | "write";
|
||||
organization_personal_access_token_requests?: "read" | "write";
|
||||
organization_plan?: "read";
|
||||
organization_projects?: "read" | "write" | "admin";
|
||||
organization_packages?: "read" | "write";
|
||||
organization_secrets?: "read" | "write";
|
||||
organization_self_hosted_runners?: "read" | "write";
|
||||
organization_user_blocking?: "read" | "write";
|
||||
team_discussions?: "read" | "write";
|
||||
};
|
||||
events: string[];
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
single_file_name: string | null;
|
||||
has_multiple_single_files?: boolean;
|
||||
single_file_paths?: string[];
|
||||
app_slug: string;
|
||||
suspended_by: {
|
||||
name?: string | null;
|
||||
email?: string | null;
|
||||
login: string;
|
||||
id: number;
|
||||
node_id: string;
|
||||
avatar_url: string;
|
||||
gravatar_id: string | null;
|
||||
url: string;
|
||||
html_url: string;
|
||||
followers_url: string;
|
||||
following_url: string;
|
||||
gists_url: string;
|
||||
starred_url: string;
|
||||
subscriptions_url: string;
|
||||
organizations_url: string;
|
||||
repos_url: string;
|
||||
events_url: string;
|
||||
received_events_url: string;
|
||||
type: string;
|
||||
site_admin: boolean;
|
||||
starred_at?: string;
|
||||
} | null;
|
||||
suspended_at: string | null;
|
||||
contact_email?: string | null;
|
||||
};
|
||||
}, void, unknown>;
|
||||
};
|
||||
113
node_modules/@octokit/app/dist-types/each-repository.d.ts
generated
vendored
Normal file
113
node_modules/@octokit/app/dist-types/each-repository.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
import type { Octokit } from "@octokit/core";
|
||||
import type { App } from "./index.js";
|
||||
import type { EachRepositoryFunction, EachRepositoryInterface, EachRepositoryQuery } from "./types.js";
|
||||
export declare function eachRepositoryFactory(app: App): EachRepositoryInterface<Octokit>;
|
||||
export declare function eachRepository(app: App, queryOrCallback: EachRepositoryQuery | EachRepositoryFunction<Octokit>, callback?: EachRepositoryFunction<Octokit>): Promise<void>;
|
||||
export declare function eachRepositoryIterator(app: App, query?: EachRepositoryQuery): {
|
||||
[Symbol.asyncIterator](): AsyncGenerator<{
|
||||
octokit: Octokit;
|
||||
repository: {
|
||||
id: number;
|
||||
node_id: string;
|
||||
name: string;
|
||||
full_name: string;
|
||||
license: import("@octokit/openapi-types").components["schemas"]["nullable-license-simple"];
|
||||
forks: number;
|
||||
permissions?: {
|
||||
admin: boolean;
|
||||
pull: boolean;
|
||||
triage?: boolean;
|
||||
push: boolean;
|
||||
maintain?: boolean;
|
||||
};
|
||||
owner: import("@octokit/openapi-types").components["schemas"]["simple-user"];
|
||||
private: boolean;
|
||||
html_url: string;
|
||||
description: string | null;
|
||||
fork: boolean;
|
||||
url: string;
|
||||
archive_url: string;
|
||||
assignees_url: string;
|
||||
blobs_url: string;
|
||||
branches_url: string;
|
||||
collaborators_url: string;
|
||||
comments_url: string;
|
||||
commits_url: string;
|
||||
compare_url: string;
|
||||
contents_url: string;
|
||||
contributors_url: string;
|
||||
deployments_url: string;
|
||||
downloads_url: string;
|
||||
events_url: string;
|
||||
forks_url: string;
|
||||
git_commits_url: string;
|
||||
git_refs_url: string;
|
||||
git_tags_url: string;
|
||||
git_url: string;
|
||||
issue_comment_url: string;
|
||||
issue_events_url: string;
|
||||
issues_url: string;
|
||||
keys_url: string;
|
||||
labels_url: string;
|
||||
languages_url: string;
|
||||
merges_url: string;
|
||||
milestones_url: string;
|
||||
notifications_url: string;
|
||||
pulls_url: string;
|
||||
releases_url: string;
|
||||
ssh_url: string;
|
||||
stargazers_url: string;
|
||||
statuses_url: string;
|
||||
subscribers_url: string;
|
||||
subscription_url: string;
|
||||
tags_url: string;
|
||||
teams_url: string;
|
||||
trees_url: string;
|
||||
clone_url: string;
|
||||
mirror_url: string | null;
|
||||
hooks_url: string;
|
||||
svn_url: string;
|
||||
homepage: string | null;
|
||||
language: string | null;
|
||||
forks_count: number;
|
||||
stargazers_count: number;
|
||||
watchers_count: number;
|
||||
size: number;
|
||||
default_branch: string;
|
||||
open_issues_count: number;
|
||||
is_template?: boolean;
|
||||
topics?: string[];
|
||||
has_issues: boolean;
|
||||
has_projects: boolean;
|
||||
has_wiki: boolean;
|
||||
has_pages: boolean;
|
||||
has_downloads: boolean;
|
||||
has_discussions?: boolean;
|
||||
archived: boolean;
|
||||
disabled: boolean;
|
||||
visibility?: string;
|
||||
pushed_at: string | null;
|
||||
created_at: string | null;
|
||||
updated_at: string | null;
|
||||
allow_rebase_merge?: boolean;
|
||||
temp_clone_token?: string;
|
||||
allow_squash_merge?: boolean;
|
||||
allow_auto_merge?: boolean;
|
||||
delete_branch_on_merge?: boolean;
|
||||
allow_update_branch?: boolean;
|
||||
use_squash_pr_title_as_default?: boolean;
|
||||
squash_merge_commit_title?: "PR_TITLE" | "COMMIT_OR_PR_TITLE";
|
||||
squash_merge_commit_message?: "PR_BODY" | "COMMIT_MESSAGES" | "BLANK";
|
||||
merge_commit_title?: "PR_TITLE" | "MERGE_MESSAGE";
|
||||
merge_commit_message?: "PR_BODY" | "PR_TITLE" | "BLANK";
|
||||
allow_merge_commit?: boolean;
|
||||
allow_forking?: boolean;
|
||||
web_commit_signoff_required?: boolean;
|
||||
open_issues: number;
|
||||
watchers: number;
|
||||
master_branch?: string;
|
||||
starred_at?: string;
|
||||
anonymous_access_enabled?: boolean;
|
||||
};
|
||||
}, void, unknown>;
|
||||
};
|
||||
3
node_modules/@octokit/app/dist-types/get-installation-octokit.d.ts
generated
vendored
Normal file
3
node_modules/@octokit/app/dist-types/get-installation-octokit.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
import type { Octokit } from "@octokit/core";
|
||||
import type { App } from "./index.js";
|
||||
export declare function getInstallationOctokit(app: App, installationId: number): Promise<Octokit>;
|
||||
3
node_modules/@octokit/app/dist-types/get-installation-url.d.ts
generated
vendored
Normal file
3
node_modules/@octokit/app/dist-types/get-installation-url.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
import type { App } from "./index.js";
|
||||
import type { GetInstallationUrlOptions } from "./types.js";
|
||||
export declare function getInstallationUrlFactory(app: App): (options?: GetInstallationUrlOptions) => Promise<string>;
|
||||
55
node_modules/@octokit/app/dist-types/index.d.ts
generated
vendored
Normal file
55
node_modules/@octokit/app/dist-types/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
import { Octokit as OctokitCore } from "@octokit/core";
|
||||
import { OAuthApp } from "@octokit/oauth-app";
|
||||
import type { Webhooks } from "@octokit/webhooks";
|
||||
import type { Options, ConstructorOptions, EachInstallationInterface, EachRepositoryInterface, GetInstallationOctokitInterface, GetInstallationUrlInterface } from "./types.js";
|
||||
export type { EachInstallationInterface, EachRepositoryInterface, GetInstallationOctokitInterface, GetInstallationUrlInterface, } from "./types.js";
|
||||
type Constructor<T> = new (...args: any[]) => T;
|
||||
type OctokitType<TOptions extends Options> = TOptions["Octokit"] extends typeof OctokitCore ? InstanceType<TOptions["Octokit"]> : OctokitCore;
|
||||
type OctokitClassType<TOptions extends Options> = TOptions["Octokit"] extends typeof OctokitCore ? TOptions["Octokit"] : typeof OctokitCore;
|
||||
export declare class App<TOptions extends Options = Options> {
|
||||
static VERSION: string;
|
||||
static defaults<TDefaults extends Options, S extends Constructor<App<TDefaults>>>(this: S, defaults: Partial<TDefaults>): ({
|
||||
new (...args: any[]): {
|
||||
octokit: OctokitType<TDefaults>;
|
||||
webhooks: Webhooks<{
|
||||
octokit: OctokitType<TDefaults>;
|
||||
}>;
|
||||
oauth: OAuthApp<{
|
||||
clientType: "github-app";
|
||||
Octokit: OctokitClassType<TDefaults>;
|
||||
}>;
|
||||
getInstallationOctokit: GetInstallationOctokitInterface<OctokitType<TDefaults>>;
|
||||
eachInstallation: EachInstallationInterface<OctokitType<TDefaults>>;
|
||||
eachRepository: EachRepositoryInterface<OctokitType<TDefaults>>;
|
||||
getInstallationUrl: GetInstallationUrlInterface;
|
||||
log: {
|
||||
debug: (message: string, additionalInfo?: object) => void;
|
||||
info: (message: string, additionalInfo?: object) => void;
|
||||
warn: (message: string, additionalInfo?: object) => void;
|
||||
error: (message: string, additionalInfo?: object) => void;
|
||||
[key: string]: unknown;
|
||||
};
|
||||
};
|
||||
} & S) & typeof this;
|
||||
octokit: OctokitType<TOptions>;
|
||||
webhooks: Webhooks<{
|
||||
octokit: OctokitType<TOptions>;
|
||||
}>;
|
||||
oauth: OAuthApp<{
|
||||
clientType: "github-app";
|
||||
Octokit: OctokitClassType<TOptions>;
|
||||
}>;
|
||||
getInstallationOctokit: GetInstallationOctokitInterface<OctokitType<TOptions>>;
|
||||
eachInstallation: EachInstallationInterface<OctokitType<TOptions>>;
|
||||
eachRepository: EachRepositoryInterface<OctokitType<TOptions>>;
|
||||
getInstallationUrl: GetInstallationUrlInterface;
|
||||
log: {
|
||||
debug: (message: string, additionalInfo?: object) => void;
|
||||
info: (message: string, additionalInfo?: object) => void;
|
||||
warn: (message: string, additionalInfo?: object) => void;
|
||||
error: (message: string, additionalInfo?: object) => void;
|
||||
[key: string]: unknown;
|
||||
};
|
||||
constructor(options: ConstructorOptions<TOptions>);
|
||||
}
|
||||
export { createNodeMiddleware } from "./middleware/node/index.js";
|
||||
11
node_modules/@octokit/app/dist-types/middleware/node/index.d.ts
generated
vendored
Normal file
11
node_modules/@octokit/app/dist-types/middleware/node/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
type IncomingMessage = any;
|
||||
type ServerResponse = any;
|
||||
import type { App } from "../../index.js";
|
||||
import type { Options } from "../../types.js";
|
||||
export type MiddlewareOptions = {
|
||||
pathPrefix?: string;
|
||||
log?: Options["log"];
|
||||
};
|
||||
export declare function createNodeMiddleware(app: App, options?: MiddlewareOptions): (request: any, response: any, next?: Function | undefined) => Promise<boolean>;
|
||||
export declare function middleware(pathPrefix: string, webhooksMiddleware: any, oauthMiddleware: any, request: IncomingMessage, response: ServerResponse, next?: Function): Promise<boolean>;
|
||||
export {};
|
||||
58
node_modules/@octokit/app/dist-types/types.d.ts
generated
vendored
Normal file
58
node_modules/@octokit/app/dist-types/types.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
import type { Octokit } from "@octokit/core";
|
||||
import type { Endpoints } from "@octokit/types";
|
||||
export type Options = {
|
||||
appId?: number | string;
|
||||
privateKey?: string;
|
||||
webhooks?: {
|
||||
secret: string;
|
||||
};
|
||||
oauth?: {
|
||||
clientId: string;
|
||||
clientSecret: string;
|
||||
allowSignup?: boolean;
|
||||
};
|
||||
Octokit?: typeof Octokit;
|
||||
log?: {
|
||||
debug: (...data: any[]) => void;
|
||||
info: (...data: any[]) => void;
|
||||
warn: (...data: any[]) => void;
|
||||
error: (...data: any[]) => void;
|
||||
};
|
||||
};
|
||||
export type ConstructorOptions<TOptions extends Options> = TOptions & {
|
||||
appId: number | string;
|
||||
privateKey: string;
|
||||
};
|
||||
export type InstallationFunctionOptions<O> = {
|
||||
octokit: O;
|
||||
installation: Endpoints["GET /app/installations"]["response"]["data"][0];
|
||||
};
|
||||
export type EachInstallationFunction<O> = (options: InstallationFunctionOptions<O>) => unknown | Promise<unknown>;
|
||||
export interface EachInstallationInterface<O> {
|
||||
(callback: EachInstallationFunction<O>): Promise<void>;
|
||||
iterator: () => AsyncIterable<InstallationFunctionOptions<O>>;
|
||||
}
|
||||
type EachRepositoryFunctionOptions<O> = {
|
||||
octokit: O;
|
||||
repository: Endpoints["GET /installation/repositories"]["response"]["data"]["repositories"][0];
|
||||
};
|
||||
export type EachRepositoryFunction<O> = (options: EachRepositoryFunctionOptions<O>) => unknown | Promise<unknown>;
|
||||
export type EachRepositoryQuery = {
|
||||
installationId: number;
|
||||
};
|
||||
export interface EachRepositoryInterface<O> {
|
||||
(callback: EachRepositoryFunction<O>): Promise<void>;
|
||||
(query: EachRepositoryQuery, callback: EachRepositoryFunction<O>): Promise<void>;
|
||||
iterator: (query?: EachRepositoryQuery) => AsyncIterable<EachRepositoryFunctionOptions<O>>;
|
||||
}
|
||||
export interface GetInstallationOctokitInterface<O> {
|
||||
(installationId: number): Promise<O>;
|
||||
}
|
||||
export interface GetInstallationUrlOptions {
|
||||
state?: string;
|
||||
target_id?: number;
|
||||
}
|
||||
export interface GetInstallationUrlInterface {
|
||||
(options?: GetInstallationUrlOptions): Promise<string>;
|
||||
}
|
||||
export {};
|
||||
1
node_modules/@octokit/app/dist-types/version.d.ts
generated
vendored
Normal file
1
node_modules/@octokit/app/dist-types/version.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export declare const VERSION = "15.1.4";
|
||||
6
node_modules/@octokit/app/dist-types/webhooks.d.ts
generated
vendored
Normal file
6
node_modules/@octokit/app/dist-types/webhooks.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
import type { Octokit } from "@octokit/core";
|
||||
import { Webhooks, type EmitterWebhookEvent } from "@octokit/webhooks";
|
||||
import type { Options } from "./types.js";
|
||||
export declare function webhooks(appOctokit: Octokit, options: Required<Options>["webhooks"]): Webhooks<EmitterWebhookEvent & {
|
||||
octokit: Octokit;
|
||||
}>;
|
||||
341
node_modules/@octokit/app/dist-web/index.js
generated
vendored
Normal file
341
node_modules/@octokit/app/dist-web/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,341 @@
|
|||
// pkg/dist-src/index.js
|
||||
import { Octokit as OctokitCore } from "@octokit/core";
|
||||
import { createAppAuth as createAppAuth3 } from "@octokit/auth-app";
|
||||
import { OAuthApp } from "@octokit/oauth-app";
|
||||
|
||||
// pkg/dist-src/version.js
|
||||
var VERSION = "15.1.4";
|
||||
|
||||
// pkg/dist-src/webhooks.js
|
||||
import { createAppAuth } from "@octokit/auth-app";
|
||||
import { createUnauthenticatedAuth } from "@octokit/auth-unauthenticated";
|
||||
import { Webhooks } from "@octokit/webhooks";
|
||||
function webhooks(appOctokit, options) {
|
||||
return new Webhooks({
|
||||
secret: options.secret,
|
||||
transform: async (event) => {
|
||||
if (!("installation" in event.payload) || typeof event.payload.installation !== "object") {
|
||||
const octokit2 = new appOctokit.constructor({
|
||||
authStrategy: createUnauthenticatedAuth,
|
||||
auth: {
|
||||
reason: `"installation" key missing in webhook event payload`
|
||||
}
|
||||
});
|
||||
return {
|
||||
...event,
|
||||
octokit: octokit2
|
||||
};
|
||||
}
|
||||
const installationId = event.payload.installation.id;
|
||||
const octokit = await appOctokit.auth({
|
||||
type: "installation",
|
||||
installationId,
|
||||
factory(auth) {
|
||||
return new auth.octokit.constructor({
|
||||
...auth.octokitOptions,
|
||||
authStrategy: createAppAuth,
|
||||
...{
|
||||
auth: {
|
||||
...auth,
|
||||
installationId
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
octokit.hook.before("request", (options2) => {
|
||||
options2.headers["x-github-delivery"] = event.id;
|
||||
});
|
||||
return {
|
||||
...event,
|
||||
octokit
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// pkg/dist-src/each-installation.js
|
||||
import { composePaginateRest } from "@octokit/plugin-paginate-rest";
|
||||
|
||||
// pkg/dist-src/get-installation-octokit.js
|
||||
import { createAppAuth as createAppAuth2 } from "@octokit/auth-app";
|
||||
async function getInstallationOctokit(app, installationId) {
|
||||
return app.octokit.auth({
|
||||
type: "installation",
|
||||
installationId,
|
||||
factory(auth) {
|
||||
const options = {
|
||||
...auth.octokitOptions,
|
||||
authStrategy: createAppAuth2,
|
||||
...{ auth: { ...auth, installationId } }
|
||||
};
|
||||
return new auth.octokit.constructor(options);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// pkg/dist-src/each-installation.js
|
||||
function eachInstallationFactory(app) {
|
||||
return Object.assign(eachInstallation.bind(null, app), {
|
||||
iterator: eachInstallationIterator.bind(null, app)
|
||||
});
|
||||
}
|
||||
async function eachInstallation(app, callback) {
|
||||
const i = eachInstallationIterator(app)[Symbol.asyncIterator]();
|
||||
let result = await i.next();
|
||||
while (!result.done) {
|
||||
await callback(result.value);
|
||||
result = await i.next();
|
||||
}
|
||||
}
|
||||
function eachInstallationIterator(app) {
|
||||
return {
|
||||
async *[Symbol.asyncIterator]() {
|
||||
const iterator = composePaginateRest.iterator(
|
||||
app.octokit,
|
||||
"GET /app/installations"
|
||||
);
|
||||
for await (const { data: installations } of iterator) {
|
||||
for (const installation of installations) {
|
||||
const installationOctokit = await getInstallationOctokit(
|
||||
app,
|
||||
installation.id
|
||||
);
|
||||
yield { octokit: installationOctokit, installation };
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// pkg/dist-src/each-repository.js
|
||||
import { composePaginateRest as composePaginateRest2 } from "@octokit/plugin-paginate-rest";
|
||||
function eachRepositoryFactory(app) {
|
||||
return Object.assign(eachRepository.bind(null, app), {
|
||||
iterator: eachRepositoryIterator.bind(null, app)
|
||||
});
|
||||
}
|
||||
async function eachRepository(app, queryOrCallback, callback) {
|
||||
const i = eachRepositoryIterator(
|
||||
app,
|
||||
callback ? queryOrCallback : void 0
|
||||
)[Symbol.asyncIterator]();
|
||||
let result = await i.next();
|
||||
while (!result.done) {
|
||||
if (callback) {
|
||||
await callback(result.value);
|
||||
} else {
|
||||
await queryOrCallback(result.value);
|
||||
}
|
||||
result = await i.next();
|
||||
}
|
||||
}
|
||||
function singleInstallationIterator(app, installationId) {
|
||||
return {
|
||||
async *[Symbol.asyncIterator]() {
|
||||
yield {
|
||||
octokit: await app.getInstallationOctokit(installationId)
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
function eachRepositoryIterator(app, query) {
|
||||
return {
|
||||
async *[Symbol.asyncIterator]() {
|
||||
const iterator = query ? singleInstallationIterator(app, query.installationId) : app.eachInstallation.iterator();
|
||||
for await (const { octokit } of iterator) {
|
||||
const repositoriesIterator = composePaginateRest2.iterator(
|
||||
octokit,
|
||||
"GET /installation/repositories"
|
||||
);
|
||||
for await (const { data: repositories } of repositoriesIterator) {
|
||||
for (const repository of repositories) {
|
||||
yield { octokit, repository };
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// pkg/dist-src/get-installation-url.js
|
||||
function getInstallationUrlFactory(app) {
|
||||
let installationUrlBasePromise;
|
||||
return async function getInstallationUrl(options = {}) {
|
||||
if (!installationUrlBasePromise) {
|
||||
installationUrlBasePromise = getInstallationUrlBase(app);
|
||||
}
|
||||
const installationUrlBase = await installationUrlBasePromise;
|
||||
const installationUrl = new URL(installationUrlBase);
|
||||
if (options.target_id !== void 0) {
|
||||
installationUrl.pathname += "/permissions";
|
||||
installationUrl.searchParams.append(
|
||||
"target_id",
|
||||
options.target_id.toFixed()
|
||||
);
|
||||
}
|
||||
if (options.state !== void 0) {
|
||||
installationUrl.searchParams.append("state", options.state);
|
||||
}
|
||||
return installationUrl.href;
|
||||
};
|
||||
}
|
||||
async function getInstallationUrlBase(app) {
|
||||
const { data: appInfo } = await app.octokit.request("GET /app");
|
||||
if (!appInfo) {
|
||||
throw new Error("[@octokit/app] unable to fetch metadata for app");
|
||||
}
|
||||
return `${appInfo.html_url}/installations/new`;
|
||||
}
|
||||
|
||||
// pkg/dist-src/middleware/node/index.js
|
||||
import {
|
||||
createNodeMiddleware as oauthNodeMiddleware,
|
||||
sendNodeResponse,
|
||||
unknownRouteResponse
|
||||
} from "@octokit/oauth-app";
|
||||
import { createNodeMiddleware as webhooksNodeMiddleware } from "@octokit/webhooks";
|
||||
function noop() {
|
||||
}
|
||||
function createNodeMiddleware(app, options = {}) {
|
||||
const log = Object.assign(
|
||||
{
|
||||
debug: noop,
|
||||
info: noop,
|
||||
warn: console.warn.bind(console),
|
||||
error: console.error.bind(console)
|
||||
},
|
||||
options.log
|
||||
);
|
||||
const optionsWithDefaults = {
|
||||
pathPrefix: "/api/github",
|
||||
...options,
|
||||
log
|
||||
};
|
||||
const webhooksMiddleware = webhooksNodeMiddleware(app.webhooks, {
|
||||
path: optionsWithDefaults.pathPrefix + "/webhooks",
|
||||
log
|
||||
});
|
||||
const oauthMiddleware = oauthNodeMiddleware(app.oauth, {
|
||||
pathPrefix: optionsWithDefaults.pathPrefix + "/oauth"
|
||||
});
|
||||
return middleware.bind(
|
||||
null,
|
||||
optionsWithDefaults.pathPrefix,
|
||||
webhooksMiddleware,
|
||||
oauthMiddleware
|
||||
);
|
||||
}
|
||||
async function middleware(pathPrefix, webhooksMiddleware, oauthMiddleware, request, response, next) {
|
||||
const { pathname } = new URL(request.url, "http://localhost");
|
||||
if (pathname.startsWith(`${pathPrefix}/`)) {
|
||||
if (pathname === `${pathPrefix}/webhooks`) {
|
||||
webhooksMiddleware(request, response);
|
||||
} else if (pathname.startsWith(`${pathPrefix}/oauth/`)) {
|
||||
oauthMiddleware(request, response);
|
||||
} else {
|
||||
sendNodeResponse(unknownRouteResponse(request), response);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
next?.();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// pkg/dist-src/index.js
|
||||
var App = class {
|
||||
static VERSION = VERSION;
|
||||
static defaults(defaults) {
|
||||
const AppWithDefaults = class extends this {
|
||||
constructor(...args) {
|
||||
super({
|
||||
...defaults,
|
||||
...args[0]
|
||||
});
|
||||
}
|
||||
};
|
||||
return AppWithDefaults;
|
||||
}
|
||||
octokit;
|
||||
// @ts-ignore calling app.webhooks will throw a helpful error when options.webhooks is not set
|
||||
webhooks;
|
||||
// @ts-ignore calling app.oauth will throw a helpful error when options.oauth is not set
|
||||
oauth;
|
||||
getInstallationOctokit;
|
||||
eachInstallation;
|
||||
eachRepository;
|
||||
getInstallationUrl;
|
||||
log;
|
||||
constructor(options) {
|
||||
const Octokit = options.Octokit || OctokitCore;
|
||||
const authOptions = Object.assign(
|
||||
{
|
||||
appId: options.appId,
|
||||
privateKey: options.privateKey
|
||||
},
|
||||
options.oauth ? {
|
||||
clientId: options.oauth.clientId,
|
||||
clientSecret: options.oauth.clientSecret
|
||||
} : {}
|
||||
);
|
||||
const octokitOptions = {
|
||||
authStrategy: createAppAuth3,
|
||||
auth: authOptions
|
||||
};
|
||||
if ("log" in options && typeof options.log !== "undefined") {
|
||||
octokitOptions.log = options.log;
|
||||
}
|
||||
this.octokit = new Octokit(octokitOptions);
|
||||
this.log = Object.assign(
|
||||
{
|
||||
debug: () => {
|
||||
},
|
||||
info: () => {
|
||||
},
|
||||
warn: console.warn.bind(console),
|
||||
error: console.error.bind(console)
|
||||
},
|
||||
options.log
|
||||
);
|
||||
if (options.webhooks) {
|
||||
this.webhooks = webhooks(this.octokit, options.webhooks);
|
||||
} else {
|
||||
Object.defineProperty(this, "webhooks", {
|
||||
get() {
|
||||
throw new Error("[@octokit/app] webhooks option not set");
|
||||
}
|
||||
});
|
||||
}
|
||||
if (options.oauth) {
|
||||
this.oauth = new OAuthApp({
|
||||
...options.oauth,
|
||||
clientType: "github-app",
|
||||
Octokit
|
||||
});
|
||||
} else {
|
||||
Object.defineProperty(this, "oauth", {
|
||||
get() {
|
||||
throw new Error(
|
||||
"[@octokit/app] oauth.clientId / oauth.clientSecret options are not set"
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
this.getInstallationOctokit = getInstallationOctokit.bind(
|
||||
null,
|
||||
this
|
||||
);
|
||||
this.eachInstallation = eachInstallationFactory(
|
||||
this
|
||||
);
|
||||
this.eachRepository = eachRepositoryFactory(
|
||||
this
|
||||
);
|
||||
this.getInstallationUrl = getInstallationUrlFactory(this);
|
||||
}
|
||||
};
|
||||
export {
|
||||
App,
|
||||
createNodeMiddleware
|
||||
};
|
||||
7
node_modules/@octokit/app/dist-web/index.js.map
generated
vendored
Normal file
7
node_modules/@octokit/app/dist-web/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
21
node_modules/@octokit/app/node_modules/@octokit/auth-token/LICENSE
generated
vendored
Normal file
21
node_modules/@octokit/app/node_modules/@octokit/auth-token/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
The MIT License
|
||||
|
||||
Copyright (c) 2019 Octokit contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
284
node_modules/@octokit/app/node_modules/@octokit/auth-token/README.md
generated
vendored
Normal file
284
node_modules/@octokit/app/node_modules/@octokit/auth-token/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,284 @@
|
|||
# auth-token.js
|
||||
|
||||
> GitHub API token authentication for browsers and Node.js
|
||||
|
||||
[](https://www.npmjs.com/package/@octokit/auth-token)
|
||||
[](https://github.com/octokit/auth-token.js/actions?query=workflow%3ATest)
|
||||
|
||||
`@octokit/auth-token` is the simplest of [GitHub’s authentication strategies](https://github.com/octokit/auth.js).
|
||||
|
||||
It is useful if you want to support multiple authentication strategies, as it’s API is compatible with its sibling packages for [basic](https://github.com/octokit/auth-basic.js), [GitHub App](https://github.com/octokit/auth-app.js) and [OAuth app](https://github.com/octokit/auth.js) authentication.
|
||||
|
||||
<!-- toc -->
|
||||
|
||||
- [Usage](#usage)
|
||||
- [`createTokenAuth(token) options`](#createtokenauthtoken-options)
|
||||
- [`auth()`](#auth)
|
||||
- [Authentication object](#authentication-object)
|
||||
- [`auth.hook(request, route, options)` or `auth.hook(request, options)`](#authhookrequest-route-options-or-authhookrequest-options)
|
||||
- [Find more information](#find-more-information)
|
||||
- [Find out what scopes are enabled for oauth tokens](#find-out-what-scopes-are-enabled-for-oauth-tokens)
|
||||
- [Find out if token is a personal access token or if it belongs to an OAuth app](#find-out-if-token-is-a-personal-access-token-or-if-it-belongs-to-an-oauth-app)
|
||||
- [Find out what permissions are enabled for a repository](#find-out-what-permissions-are-enabled-for-a-repository)
|
||||
- [Use token for git operations](#use-token-for-git-operations)
|
||||
- [License](#license)
|
||||
|
||||
<!-- tocstop -->
|
||||
|
||||
## Usage
|
||||
|
||||
<table>
|
||||
<tbody valign=top align=left>
|
||||
<tr><th>
|
||||
Browsers
|
||||
</th><td width=100%>
|
||||
|
||||
Load `@octokit/auth-token` directly from [esm.sh](https://esm.sh)
|
||||
|
||||
```html
|
||||
<script type="module">
|
||||
import { createTokenAuth } from "https://esm.sh/@octokit/auth-token";
|
||||
</script>
|
||||
```
|
||||
|
||||
</td></tr>
|
||||
<tr><th>
|
||||
Node
|
||||
</th><td>
|
||||
|
||||
Install with <code>npm install @octokit/auth-token</code>
|
||||
|
||||
```js
|
||||
import { createTokenAuth } from "@octokit/auth-token";
|
||||
```
|
||||
|
||||
</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
```js
|
||||
const auth = createTokenAuth("ghp_PersonalAccessToken01245678900000000");
|
||||
const authentication = await auth();
|
||||
// {
|
||||
// type: 'token',
|
||||
// token: 'ghp_PersonalAccessToken01245678900000000',
|
||||
// tokenType: 'oauth'
|
||||
// }
|
||||
```
|
||||
|
||||
## `createTokenAuth(token) options`
|
||||
|
||||
The `createTokenAuth` method accepts a single argument of type string, which is the token. The passed token can be one of the following:
|
||||
|
||||
- [Personal access token](https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line)
|
||||
- [OAuth access token](https://developer.github.com/apps/building-oauth-apps/authorizing-oauth-apps/)
|
||||
- [GITHUB_TOKEN provided to GitHub Actions](https://developer.github.com/actions/creating-github-actions/accessing-the-runtime-environment/#environment-variables)
|
||||
- Installation access token ([server-to-server](https://developer.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-an-installation))
|
||||
- User authentication for installation ([user-to-server](https://docs.github.com/en/developers/apps/building-github-apps/identifying-and-authorizing-users-for-github-apps))
|
||||
|
||||
Examples
|
||||
|
||||
```js
|
||||
// Personal access token or OAuth access token
|
||||
createTokenAuth("ghp_PersonalAccessToken01245678900000000");
|
||||
// {
|
||||
// type: 'token',
|
||||
// token: 'ghp_PersonalAccessToken01245678900000000',
|
||||
// tokenType: 'oauth'
|
||||
// }
|
||||
|
||||
// Installation access token or GitHub Action token
|
||||
createTokenAuth("ghs_InstallallationOrActionToken00000000");
|
||||
// {
|
||||
// type: 'token',
|
||||
// token: 'ghs_InstallallationOrActionToken00000000',
|
||||
// tokenType: 'installation'
|
||||
// }
|
||||
|
||||
// Installation access token or GitHub Action token
|
||||
createTokenAuth("ghu_InstallationUserToServer000000000000");
|
||||
// {
|
||||
// type: 'token',
|
||||
// token: 'ghu_InstallationUserToServer000000000000',
|
||||
// tokenType: 'user-to-server'
|
||||
// }
|
||||
```
|
||||
|
||||
## `auth()`
|
||||
|
||||
The `auth()` method has no options. It returns a promise which resolves with the the authentication object.
|
||||
|
||||
## Authentication object
|
||||
|
||||
<table width="100%">
|
||||
<thead align=left>
|
||||
<tr>
|
||||
<th width=150>
|
||||
name
|
||||
</th>
|
||||
<th width=70>
|
||||
type
|
||||
</th>
|
||||
<th>
|
||||
description
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody align=left valign=top>
|
||||
<tr>
|
||||
<th>
|
||||
<code>type</code>
|
||||
</th>
|
||||
<th>
|
||||
<code>string</code>
|
||||
</th>
|
||||
<td>
|
||||
<code>"token"</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<code>token</code>
|
||||
</th>
|
||||
<th>
|
||||
<code>string</code>
|
||||
</th>
|
||||
<td>
|
||||
The provided token.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<code>tokenType</code>
|
||||
</th>
|
||||
<th>
|
||||
<code>string</code>
|
||||
</th>
|
||||
<td>
|
||||
Can be either <code>"oauth"</code> for personal access tokens and OAuth tokens, <code>"installation"</code> for installation access tokens (includes <code>GITHUB_TOKEN</code> provided to GitHub Actions), <code>"app"</code> for a GitHub App JSON Web Token, or <code>"user-to-server"</code> for a user authentication token through an app installation.
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
## `auth.hook(request, route, options)` or `auth.hook(request, options)`
|
||||
|
||||
`auth.hook()` hooks directly into the request life cycle. It authenticates the request using the provided token.
|
||||
|
||||
The `request` option is an instance of [`@octokit/request`](https://github.com/octokit/request.js#readme). The `route`/`options` parameters are the same as for the [`request()` method](https://github.com/octokit/request.js#request).
|
||||
|
||||
`auth.hook()` can be called directly to send an authenticated request
|
||||
|
||||
```js
|
||||
const { data: authorizations } = await auth.hook(
|
||||
request,
|
||||
"GET /authorizations",
|
||||
);
|
||||
```
|
||||
|
||||
Or it can be passed as option to [`request()`](https://github.com/octokit/request.js#request).
|
||||
|
||||
```js
|
||||
const requestWithAuth = request.defaults({
|
||||
request: {
|
||||
hook: auth.hook,
|
||||
},
|
||||
});
|
||||
|
||||
const { data: authorizations } = await requestWithAuth("GET /authorizations");
|
||||
```
|
||||
|
||||
## Find more information
|
||||
|
||||
`auth()` does not send any requests, it only transforms the provided token string into an authentication object.
|
||||
|
||||
Here is a list of things you can do to retrieve further information
|
||||
|
||||
### Find out what scopes are enabled for oauth tokens
|
||||
|
||||
Note that this does not work for installations. There is no way to retrieve permissions based on an installation access tokens.
|
||||
|
||||
```js
|
||||
const TOKEN = "ghp_PersonalAccessToken01245678900000000";
|
||||
|
||||
const auth = createTokenAuth(TOKEN);
|
||||
const authentication = await auth();
|
||||
|
||||
const response = await request("HEAD /");
|
||||
const scopes = response.headers["x-oauth-scopes"].split(/,\s+/);
|
||||
|
||||
if (scopes.length) {
|
||||
console.log(
|
||||
`"${TOKEN}" has ${scopes.length} scopes enabled: ${scopes.join(", ")}`,
|
||||
);
|
||||
} else {
|
||||
console.log(`"${TOKEN}" has no scopes enabled`);
|
||||
}
|
||||
```
|
||||
|
||||
### Find out if token is a personal access token or if it belongs to an OAuth app
|
||||
|
||||
```js
|
||||
const TOKEN = "ghp_PersonalAccessToken01245678900000000";
|
||||
|
||||
const auth = createTokenAuth(TOKEN);
|
||||
const authentication = await auth();
|
||||
|
||||
const response = await request("HEAD /");
|
||||
const clientId = response.headers["x-oauth-client-id"];
|
||||
|
||||
if (clientId) {
|
||||
console.log(
|
||||
`"${token}" is an OAuth token, its app’s client_id is ${clientId}.`,
|
||||
);
|
||||
} else {
|
||||
console.log(`"${token}" is a personal access token`);
|
||||
}
|
||||
```
|
||||
|
||||
### Find out what permissions are enabled for a repository
|
||||
|
||||
Note that the `permissions` key is not set when authenticated using an installation access token.
|
||||
|
||||
```js
|
||||
const TOKEN = "ghp_PersonalAccessToken01245678900000000";
|
||||
|
||||
const auth = createTokenAuth(TOKEN);
|
||||
const authentication = await auth();
|
||||
|
||||
const response = await request("GET /repos/{owner}/{repo}", {
|
||||
owner: "octocat",
|
||||
repo: "hello-world",
|
||||
});
|
||||
|
||||
console.log(response.data.permissions);
|
||||
// {
|
||||
// admin: true,
|
||||
// push: true,
|
||||
// pull: true
|
||||
// }
|
||||
```
|
||||
|
||||
### Use token for git operations
|
||||
|
||||
Both OAuth and installation access tokens can be used for git operations. However, when using with an installation, [the token must be prefixed with `x-access-token`](https://developer.github.com/apps/building-github-apps/authenticating-with-github-apps/#http-based-git-access-by-an-installation).
|
||||
|
||||
This example is using the [`execa`](https://github.com/sindresorhus/execa) package to run a `git push` command.
|
||||
|
||||
```js
|
||||
const TOKEN = "ghp_PersonalAccessToken01245678900000000";
|
||||
|
||||
const auth = createTokenAuth(TOKEN);
|
||||
const { token, tokenType } = await auth();
|
||||
const tokenWithPrefix =
|
||||
tokenType === "installation" ? `x-access-token:${token}` : token;
|
||||
|
||||
const repositoryUrl = `https://${tokenWithPrefix}@github.com/octocat/hello-world.git`;
|
||||
|
||||
const { stdout } = await execa("git", ["push", repositoryUrl]);
|
||||
console.log(stdout);
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
55
node_modules/@octokit/app/node_modules/@octokit/auth-token/dist-bundle/index.js
generated
vendored
Normal file
55
node_modules/@octokit/app/node_modules/@octokit/auth-token/dist-bundle/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
// pkg/dist-src/is-jwt.js
|
||||
var b64url = "(?:[a-zA-Z0-9_-]+)";
|
||||
var sep = "\\.";
|
||||
var jwtRE = new RegExp(`^${b64url}${sep}${b64url}${sep}${b64url}$`);
|
||||
var isJWT = jwtRE.test.bind(jwtRE);
|
||||
|
||||
// pkg/dist-src/auth.js
|
||||
async function auth(token) {
|
||||
const isApp = isJWT(token);
|
||||
const isInstallation = token.startsWith("v1.") || token.startsWith("ghs_");
|
||||
const isUserToServer = token.startsWith("ghu_");
|
||||
const tokenType = isApp ? "app" : isInstallation ? "installation" : isUserToServer ? "user-to-server" : "oauth";
|
||||
return {
|
||||
type: "token",
|
||||
token,
|
||||
tokenType
|
||||
};
|
||||
}
|
||||
|
||||
// pkg/dist-src/with-authorization-prefix.js
|
||||
function withAuthorizationPrefix(token) {
|
||||
if (token.split(/\./).length === 3) {
|
||||
return `bearer ${token}`;
|
||||
}
|
||||
return `token ${token}`;
|
||||
}
|
||||
|
||||
// pkg/dist-src/hook.js
|
||||
async function hook(token, request, route, parameters) {
|
||||
const endpoint = request.endpoint.merge(
|
||||
route,
|
||||
parameters
|
||||
);
|
||||
endpoint.headers.authorization = withAuthorizationPrefix(token);
|
||||
return request(endpoint);
|
||||
}
|
||||
|
||||
// pkg/dist-src/index.js
|
||||
var createTokenAuth = function createTokenAuth2(token) {
|
||||
if (!token) {
|
||||
throw new Error("[@octokit/auth-token] No token passed to createTokenAuth");
|
||||
}
|
||||
if (typeof token !== "string") {
|
||||
throw new Error(
|
||||
"[@octokit/auth-token] Token passed to createTokenAuth is not a string"
|
||||
);
|
||||
}
|
||||
token = token.replace(/^(token|bearer) +/i, "");
|
||||
return Object.assign(auth.bind(null, token), {
|
||||
hook: hook.bind(null, token)
|
||||
});
|
||||
};
|
||||
export {
|
||||
createTokenAuth
|
||||
};
|
||||
7
node_modules/@octokit/app/node_modules/@octokit/auth-token/dist-bundle/index.js.map
generated
vendored
Normal file
7
node_modules/@octokit/app/node_modules/@octokit/auth-token/dist-bundle/index.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"version": 3,
|
||||
"sources": ["../dist-src/is-jwt.js", "../dist-src/auth.js", "../dist-src/with-authorization-prefix.js", "../dist-src/hook.js", "../dist-src/index.js"],
|
||||
"sourcesContent": ["const b64url = \"(?:[a-zA-Z0-9_-]+)\";\nconst sep = \"\\\\.\";\nconst jwtRE = new RegExp(`^${b64url}${sep}${b64url}${sep}${b64url}$`);\nconst isJWT = jwtRE.test.bind(jwtRE);\nexport {\n isJWT\n};\n", "import { isJWT } from \"./is-jwt.js\";\nasync function auth(token) {\n const isApp = isJWT(token);\n const isInstallation = token.startsWith(\"v1.\") || token.startsWith(\"ghs_\");\n const isUserToServer = token.startsWith(\"ghu_\");\n const tokenType = isApp ? \"app\" : isInstallation ? \"installation\" : isUserToServer ? \"user-to-server\" : \"oauth\";\n return {\n type: \"token\",\n token,\n tokenType\n };\n}\nexport {\n auth\n};\n", "function withAuthorizationPrefix(token) {\n if (token.split(/\\./).length === 3) {\n return `bearer ${token}`;\n }\n return `token ${token}`;\n}\nexport {\n withAuthorizationPrefix\n};\n", "import { withAuthorizationPrefix } from \"./with-authorization-prefix.js\";\nasync function hook(token, request, route, parameters) {\n const endpoint = request.endpoint.merge(\n route,\n parameters\n );\n endpoint.headers.authorization = withAuthorizationPrefix(token);\n return request(endpoint);\n}\nexport {\n hook\n};\n", "import { auth } from \"./auth.js\";\nimport { hook } from \"./hook.js\";\nconst createTokenAuth = function createTokenAuth2(token) {\n if (!token) {\n throw new Error(\"[@octokit/auth-token] No token passed to createTokenAuth\");\n }\n if (typeof token !== \"string\") {\n throw new Error(\n \"[@octokit/auth-token] Token passed to createTokenAuth is not a string\"\n );\n }\n token = token.replace(/^(token|bearer) +/i, \"\");\n return Object.assign(auth.bind(null, token), {\n hook: hook.bind(null, token)\n });\n};\nexport {\n createTokenAuth\n};\n"],
|
||||
"mappings": ";AAAA,IAAM,SAAS;AACf,IAAM,MAAM;AACZ,IAAM,QAAQ,IAAI,OAAO,IAAI,MAAM,GAAG,GAAG,GAAG,MAAM,GAAG,GAAG,GAAG,MAAM,GAAG;AACpE,IAAM,QAAQ,MAAM,KAAK,KAAK,KAAK;;;ACFnC,eAAe,KAAK,OAAO;AACzB,QAAM,QAAQ,MAAM,KAAK;AACzB,QAAM,iBAAiB,MAAM,WAAW,KAAK,KAAK,MAAM,WAAW,MAAM;AACzE,QAAM,iBAAiB,MAAM,WAAW,MAAM;AAC9C,QAAM,YAAY,QAAQ,QAAQ,iBAAiB,iBAAiB,iBAAiB,mBAAmB;AACxG,SAAO;AAAA,IACL,MAAM;AAAA,IACN;AAAA,IACA;AAAA,EACF;AACF;;;ACXA,SAAS,wBAAwB,OAAO;AACtC,MAAI,MAAM,MAAM,IAAI,EAAE,WAAW,GAAG;AAClC,WAAO,UAAU,KAAK;AAAA,EACxB;AACA,SAAO,SAAS,KAAK;AACvB;;;ACJA,eAAe,KAAK,OAAO,SAAS,OAAO,YAAY;AACrD,QAAM,WAAW,QAAQ,SAAS;AAAA,IAChC;AAAA,IACA;AAAA,EACF;AACA,WAAS,QAAQ,gBAAgB,wBAAwB,KAAK;AAC9D,SAAO,QAAQ,QAAQ;AACzB;;;ACNA,IAAM,kBAAkB,SAAS,iBAAiB,OAAO;AACvD,MAAI,CAAC,OAAO;AACV,UAAM,IAAI,MAAM,0DAA0D;AAAA,EAC5E;AACA,MAAI,OAAO,UAAU,UAAU;AAC7B,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,UAAQ,MAAM,QAAQ,sBAAsB,EAAE;AAC9C,SAAO,OAAO,OAAO,KAAK,KAAK,MAAM,KAAK,GAAG;AAAA,IAC3C,MAAM,KAAK,KAAK,MAAM,KAAK;AAAA,EAC7B,CAAC;AACH;",
|
||||
"names": []
|
||||
}
|
||||
15
node_modules/@octokit/app/node_modules/@octokit/auth-token/dist-src/auth.js
generated
vendored
Normal file
15
node_modules/@octokit/app/node_modules/@octokit/auth-token/dist-src/auth.js
generated
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
import { isJWT } from "./is-jwt.js";
|
||||
async function auth(token) {
|
||||
const isApp = isJWT(token);
|
||||
const isInstallation = token.startsWith("v1.") || token.startsWith("ghs_");
|
||||
const isUserToServer = token.startsWith("ghu_");
|
||||
const tokenType = isApp ? "app" : isInstallation ? "installation" : isUserToServer ? "user-to-server" : "oauth";
|
||||
return {
|
||||
type: "token",
|
||||
token,
|
||||
tokenType
|
||||
};
|
||||
}
|
||||
export {
|
||||
auth
|
||||
};
|
||||
12
node_modules/@octokit/app/node_modules/@octokit/auth-token/dist-src/hook.js
generated
vendored
Normal file
12
node_modules/@octokit/app/node_modules/@octokit/auth-token/dist-src/hook.js
generated
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import { withAuthorizationPrefix } from "./with-authorization-prefix.js";
|
||||
async function hook(token, request, route, parameters) {
|
||||
const endpoint = request.endpoint.merge(
|
||||
route,
|
||||
parameters
|
||||
);
|
||||
endpoint.headers.authorization = withAuthorizationPrefix(token);
|
||||
return request(endpoint);
|
||||
}
|
||||
export {
|
||||
hook
|
||||
};
|
||||
19
node_modules/@octokit/app/node_modules/@octokit/auth-token/dist-src/index.js
generated
vendored
Normal file
19
node_modules/@octokit/app/node_modules/@octokit/auth-token/dist-src/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
import { auth } from "./auth.js";
|
||||
import { hook } from "./hook.js";
|
||||
const createTokenAuth = function createTokenAuth2(token) {
|
||||
if (!token) {
|
||||
throw new Error("[@octokit/auth-token] No token passed to createTokenAuth");
|
||||
}
|
||||
if (typeof token !== "string") {
|
||||
throw new Error(
|
||||
"[@octokit/auth-token] Token passed to createTokenAuth is not a string"
|
||||
);
|
||||
}
|
||||
token = token.replace(/^(token|bearer) +/i, "");
|
||||
return Object.assign(auth.bind(null, token), {
|
||||
hook: hook.bind(null, token)
|
||||
});
|
||||
};
|
||||
export {
|
||||
createTokenAuth
|
||||
};
|
||||
7
node_modules/@octokit/app/node_modules/@octokit/auth-token/dist-src/is-jwt.js
generated
vendored
Normal file
7
node_modules/@octokit/app/node_modules/@octokit/auth-token/dist-src/is-jwt.js
generated
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
const b64url = "(?:[a-zA-Z0-9_-]+)";
|
||||
const sep = "\\.";
|
||||
const jwtRE = new RegExp(`^${b64url}${sep}${b64url}${sep}${b64url}$`);
|
||||
const isJWT = jwtRE.test.bind(jwtRE);
|
||||
export {
|
||||
isJWT
|
||||
};
|
||||
9
node_modules/@octokit/app/node_modules/@octokit/auth-token/dist-src/with-authorization-prefix.js
generated
vendored
Normal file
9
node_modules/@octokit/app/node_modules/@octokit/auth-token/dist-src/with-authorization-prefix.js
generated
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
function withAuthorizationPrefix(token) {
|
||||
if (token.split(/\./).length === 3) {
|
||||
return `bearer ${token}`;
|
||||
}
|
||||
return `token ${token}`;
|
||||
}
|
||||
export {
|
||||
withAuthorizationPrefix
|
||||
};
|
||||
2
node_modules/@octokit/app/node_modules/@octokit/auth-token/dist-types/auth.d.ts
generated
vendored
Normal file
2
node_modules/@octokit/app/node_modules/@octokit/auth-token/dist-types/auth.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
import type { Token, Authentication } from "./types.js";
|
||||
export declare function auth(token: Token): Promise<Authentication>;
|
||||
2
node_modules/@octokit/app/node_modules/@octokit/auth-token/dist-types/hook.d.ts
generated
vendored
Normal file
2
node_modules/@octokit/app/node_modules/@octokit/auth-token/dist-types/hook.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
import type { AnyResponse, EndpointOptions, RequestInterface, RequestParameters, Route, Token } from "./types.js";
|
||||
export declare function hook(token: Token, request: RequestInterface, route: Route | EndpointOptions, parameters?: RequestParameters): Promise<AnyResponse>;
|
||||
7
node_modules/@octokit/app/node_modules/@octokit/auth-token/dist-types/index.d.ts
generated
vendored
Normal file
7
node_modules/@octokit/app/node_modules/@octokit/auth-token/dist-types/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
import type { StrategyInterface, Token, Authentication } from "./types.js";
|
||||
export type Types = {
|
||||
StrategyOptions: Token;
|
||||
AuthOptions: never;
|
||||
Authentication: Authentication;
|
||||
};
|
||||
export declare const createTokenAuth: StrategyInterface;
|
||||
1
node_modules/@octokit/app/node_modules/@octokit/auth-token/dist-types/is-jwt.d.ts
generated
vendored
Normal file
1
node_modules/@octokit/app/node_modules/@octokit/auth-token/dist-types/is-jwt.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export declare const isJWT: (string: string) => boolean;
|
||||
33
node_modules/@octokit/app/node_modules/@octokit/auth-token/dist-types/types.d.ts
generated
vendored
Normal file
33
node_modules/@octokit/app/node_modules/@octokit/auth-token/dist-types/types.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
import type * as OctokitTypes from "@octokit/types";
|
||||
export type AnyResponse = OctokitTypes.OctokitResponse<any>;
|
||||
export type StrategyInterface = OctokitTypes.StrategyInterface<[
|
||||
Token
|
||||
], [
|
||||
], Authentication>;
|
||||
export type EndpointDefaults = OctokitTypes.EndpointDefaults;
|
||||
export type EndpointOptions = OctokitTypes.EndpointOptions;
|
||||
export type RequestParameters = OctokitTypes.RequestParameters;
|
||||
export type RequestInterface = OctokitTypes.RequestInterface;
|
||||
export type Route = OctokitTypes.Route;
|
||||
export type Token = string;
|
||||
export type OAuthTokenAuthentication = {
|
||||
type: "token";
|
||||
tokenType: "oauth";
|
||||
token: Token;
|
||||
};
|
||||
export type InstallationTokenAuthentication = {
|
||||
type: "token";
|
||||
tokenType: "installation";
|
||||
token: Token;
|
||||
};
|
||||
export type AppAuthentication = {
|
||||
type: "token";
|
||||
tokenType: "app";
|
||||
token: Token;
|
||||
};
|
||||
export type UserToServerAuthentication = {
|
||||
type: "token";
|
||||
tokenType: "user-to-server";
|
||||
token: Token;
|
||||
};
|
||||
export type Authentication = OAuthTokenAuthentication | InstallationTokenAuthentication | AppAuthentication | UserToServerAuthentication;
|
||||
6
node_modules/@octokit/app/node_modules/@octokit/auth-token/dist-types/with-authorization-prefix.d.ts
generated
vendored
Normal file
6
node_modules/@octokit/app/node_modules/@octokit/auth-token/dist-types/with-authorization-prefix.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
/**
|
||||
* Prefix token for usage in the Authorization header
|
||||
*
|
||||
* @param token OAuth token or JSON Web Token
|
||||
*/
|
||||
export declare function withAuthorizationPrefix(token: string): string;
|
||||
51
node_modules/@octokit/app/node_modules/@octokit/auth-token/package.json
generated
vendored
Normal file
51
node_modules/@octokit/app/node_modules/@octokit/auth-token/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
{
|
||||
"name": "@octokit/auth-token",
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
"provenance": true
|
||||
},
|
||||
"type": "module",
|
||||
"version": "5.1.2",
|
||||
"description": "GitHub API token authentication for browsers and Node.js",
|
||||
"repository": "github:octokit/auth-token.js",
|
||||
"keywords": [
|
||||
"github",
|
||||
"octokit",
|
||||
"authentication",
|
||||
"api"
|
||||
],
|
||||
"author": "Gregor Martynus (https://github.com/gr2m)",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@octokit/request": "^9.0.0",
|
||||
"@octokit/tsconfig": "^4.0.0",
|
||||
"@octokit/types": "^13.0.0",
|
||||
"@vitest/coverage-v8": "^3.0.0",
|
||||
"esbuild": "^0.24.0",
|
||||
"fetch-mock": "^11.0.0",
|
||||
"glob": "^11.0.0",
|
||||
"prettier": "3.4.2",
|
||||
"semantic-release": "^24.0.0",
|
||||
"typescript": "^5.3.0",
|
||||
"vitest": "^3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
},
|
||||
"files": [
|
||||
"dist-*/**",
|
||||
"bin/**"
|
||||
],
|
||||
"types": "./dist-types/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist-types/index.d.ts",
|
||||
"import": "./dist-bundle/index.js",
|
||||
"default": "./dist-bundle/index.js"
|
||||
},
|
||||
"./types": {
|
||||
"types": "./dist-types/index.d.ts"
|
||||
}
|
||||
},
|
||||
"sideEffects": false
|
||||
}
|
||||
21
node_modules/@octokit/app/node_modules/@octokit/core/LICENSE
generated
vendored
Normal file
21
node_modules/@octokit/app/node_modules/@octokit/core/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
The MIT License
|
||||
|
||||
Copyright (c) 2019 Octokit contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
457
node_modules/@octokit/app/node_modules/@octokit/core/README.md
generated
vendored
Normal file
457
node_modules/@octokit/app/node_modules/@octokit/core/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,457 @@
|
|||
# core.js
|
||||
|
||||
> Extendable client for GitHub's REST & GraphQL APIs
|
||||
|
||||
[](https://www.npmjs.com/package/@octokit/core)
|
||||
[](https://github.com/octokit/core.js/actions?query=workflow%3ATest+branch%3Amain)
|
||||
|
||||
<!-- toc -->
|
||||
|
||||
- [Usage](#usage)
|
||||
- [REST API example](#rest-api-example)
|
||||
- [GraphQL example](#graphql-example)
|
||||
- [Options](#options)
|
||||
- [Defaults](#defaults)
|
||||
- [Authentication](#authentication)
|
||||
- [Logging](#logging)
|
||||
- [Hooks](#hooks)
|
||||
- [Plugins](#plugins)
|
||||
- [Build your own Octokit with Plugins and Defaults](#build-your-own-octokit-with-plugins-and-defaults)
|
||||
- [LICENSE](#license)
|
||||
|
||||
<!-- tocstop -->
|
||||
|
||||
If you need a minimalistic library to utilize GitHub's [REST API](https://developer.github.com/v3/) and [GraphQL API](https://developer.github.com/v4/) which you can extend with plugins as needed, then `@octokit/core` is a great starting point.
|
||||
|
||||
If you don't need the Plugin API then using [`@octokit/request`](https://github.com/octokit/request.js/) or [`@octokit/graphql`](https://github.com/octokit/graphql.js/) directly is a good alternative.
|
||||
|
||||
## Usage
|
||||
|
||||
<table>
|
||||
<tbody valign=top align=left>
|
||||
<tr><th>
|
||||
Browsers
|
||||
</th><td width=100%>
|
||||
Load <code>@octokit/core</code> directly from <a href="https://esm.sh">esm.sh</a>
|
||||
|
||||
```html
|
||||
<script type="module">
|
||||
import { Octokit } from "https://esm.sh/@octokit/core";
|
||||
</script>
|
||||
```
|
||||
|
||||
</td></tr>
|
||||
<tr><th>
|
||||
Node
|
||||
</th><td>
|
||||
|
||||
Install with <code>npm install @octokit/core</code>
|
||||
|
||||
```js
|
||||
import { Octokit } from "@octokit/core";
|
||||
```
|
||||
|
||||
</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
As we use [conditional exports](https://nodejs.org/api/packages.html#conditional-exports), you will need to adapt your `tsconfig.json`. See the TypeScript docs on [package.json "exports"](https://www.typescriptlang.org/docs/handbook/modules/reference.html#packagejson-exports).
|
||||
|
||||
### REST API example
|
||||
|
||||
```js
|
||||
// Create a personal access token at https://github.com/settings/tokens/new?scopes=repo
|
||||
const octokit = new Octokit({ auth: `personal-access-token123` });
|
||||
|
||||
const response = await octokit.request("GET /orgs/{org}/repos", {
|
||||
org: "octokit",
|
||||
type: "private",
|
||||
});
|
||||
```
|
||||
|
||||
See [`@octokit/request`](https://github.com/octokit/request.js) for full documentation of the `.request` method.
|
||||
|
||||
### GraphQL example
|
||||
|
||||
```js
|
||||
const octokit = new Octokit({ auth: `secret123` });
|
||||
|
||||
const response = await octokit.graphql(
|
||||
`query ($login: String!) {
|
||||
organization(login: $login) {
|
||||
repositories(privacy: PRIVATE) {
|
||||
totalCount
|
||||
}
|
||||
}
|
||||
}`,
|
||||
{ login: "octokit" },
|
||||
);
|
||||
```
|
||||
|
||||
See [`@octokit/graphql`](https://github.com/octokit/graphql.js) for full documentation of the `.graphql` method.
|
||||
|
||||
## Options
|
||||
|
||||
<table>
|
||||
<thead align=left>
|
||||
<tr>
|
||||
<th>
|
||||
name
|
||||
</th>
|
||||
<th>
|
||||
type
|
||||
</th>
|
||||
<th width=100%>
|
||||
description
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody align=left valign=top>
|
||||
<tr>
|
||||
<th>
|
||||
<code>options.authStrategy</code>
|
||||
</th>
|
||||
<td>
|
||||
<code>Function<code>
|
||||
</td>
|
||||
<td>
|
||||
Defaults to <a href="https://github.com/octokit/auth-token.js#readme"><code>@octokit/auth-token</code></a>. See <a href="#authentication">Authentication</a> below for examples.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<code>options.auth</code>
|
||||
</th>
|
||||
<td>
|
||||
<code>String</code> or <code>Object</code>
|
||||
</td>
|
||||
<td>
|
||||
See <a href="#authentication">Authentication</a> below for examples.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<code>options.baseUrl</code>
|
||||
</th>
|
||||
<td>
|
||||
<code>String</code>
|
||||
</td>
|
||||
<td>
|
||||
|
||||
When using with GitHub Enterprise Server, set `options.baseUrl` to the root URL of the API. For example, if your GitHub Enterprise Server's hostname is `github.acme-inc.com`, then set `options.baseUrl` to `https://github.acme-inc.com/api/v3`. Example
|
||||
|
||||
```js
|
||||
const octokit = new Octokit({
|
||||
baseUrl: "https://github.acme-inc.com/api/v3",
|
||||
});
|
||||
```
|
||||
|
||||
</td></tr>
|
||||
<tr>
|
||||
<th>
|
||||
<code>options.previews</code>
|
||||
</th>
|
||||
<td>
|
||||
<code>Array of Strings</code>
|
||||
</td>
|
||||
<td>
|
||||
|
||||
Some REST API endpoints require preview headers to be set, or enable
|
||||
additional features. Preview headers can be set on a per-request basis, e.g.
|
||||
|
||||
```js
|
||||
octokit.request("POST /repos/{owner}/{repo}/pulls", {
|
||||
mediaType: {
|
||||
previews: ["shadow-cat"],
|
||||
},
|
||||
owner,
|
||||
repo,
|
||||
title: "My pull request",
|
||||
base: "main",
|
||||
head: "my-feature",
|
||||
draft: true,
|
||||
});
|
||||
```
|
||||
|
||||
You can also set previews globally, by setting the `options.previews` option on the constructor. Example:
|
||||
|
||||
```js
|
||||
const octokit = new Octokit({
|
||||
previews: ["shadow-cat"],
|
||||
});
|
||||
```
|
||||
|
||||
</td></tr>
|
||||
<tr>
|
||||
<th>
|
||||
<code>options.request</code>
|
||||
</th>
|
||||
<td>
|
||||
<code>Object</code>
|
||||
</td>
|
||||
<td>
|
||||
|
||||
Set a default request timeout (`options.request.timeout`) or an [`http(s).Agent`](https://nodejs.org/api/http.html#http_class_http_agent) e.g. for proxy usage (Node only, `options.request.agent`).
|
||||
|
||||
There are more `options.request.*` options, see [`@octokit/request` options](https://github.com/octokit/request.js#request). `options.request` can also be set on a per-request basis.
|
||||
|
||||
</td></tr>
|
||||
<tr>
|
||||
<th>
|
||||
<code>options.timeZone</code>
|
||||
</th>
|
||||
<td>
|
||||
<code>String</code>
|
||||
</td>
|
||||
<td>
|
||||
|
||||
Sets the `Time-Zone` header which defines a timezone according to the [list of names from the Olson database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
|
||||
|
||||
```js
|
||||
const octokit = new Octokit({
|
||||
timeZone: "America/Los_Angeles",
|
||||
});
|
||||
```
|
||||
|
||||
The time zone header will determine the timezone used for generating the timestamp when creating commits. See [GitHub's Timezones documentation](https://developer.github.com/v3/#timezones).
|
||||
|
||||
</td></tr>
|
||||
<tr>
|
||||
<th>
|
||||
<code>options.userAgent</code>
|
||||
</th>
|
||||
<td>
|
||||
<code>String</code>
|
||||
</td>
|
||||
<td>
|
||||
|
||||
A custom user agent string for your app or library. Example
|
||||
|
||||
```js
|
||||
const octokit = new Octokit({
|
||||
userAgent: "my-app/v1.2.3",
|
||||
});
|
||||
```
|
||||
|
||||
</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
## Defaults
|
||||
|
||||
You can create a new Octokit class with customized default options.
|
||||
|
||||
```js
|
||||
const MyOctokit = Octokit.defaults({
|
||||
auth: "personal-access-token123",
|
||||
baseUrl: "https://github.acme-inc.com/api/v3",
|
||||
userAgent: "my-app/v1.2.3",
|
||||
});
|
||||
const octokit1 = new MyOctokit();
|
||||
const octokit2 = new MyOctokit();
|
||||
```
|
||||
|
||||
If you pass additional options to your new constructor, the options will be merged shallowly.
|
||||
|
||||
```js
|
||||
const MyOctokit = Octokit.defaults({
|
||||
foo: {
|
||||
opt1: 1,
|
||||
},
|
||||
});
|
||||
const octokit = new MyOctokit({
|
||||
foo: {
|
||||
opt2: 1,
|
||||
},
|
||||
});
|
||||
// options will be { foo: { opt2: 1 }}
|
||||
```
|
||||
|
||||
If you need a deep or conditional merge, you can pass a function instead.
|
||||
|
||||
```js
|
||||
const MyOctokit = Octokit.defaults((options) => {
|
||||
return {
|
||||
foo: Object.assign({}, options.foo, { opt1: 1 }),
|
||||
};
|
||||
});
|
||||
const octokit = new MyOctokit({
|
||||
foo: { opt2: 1 },
|
||||
});
|
||||
// options will be { foo: { opt1: 1, opt2: 1 }}
|
||||
```
|
||||
|
||||
Be careful about mutating the `options` object in the `Octokit.defaults` callback, as it can have unforeseen consequences.
|
||||
|
||||
## Authentication
|
||||
|
||||
Authentication is optional for some REST API endpoints accessing public data, but is required for GraphQL queries. Using authentication also increases your [API rate limit](https://developer.github.com/v3/#rate-limiting).
|
||||
|
||||
By default, Octokit authenticates using the [token authentication strategy](https://github.com/octokit/auth-token.js). Pass in a token using `options.auth`. It can be a personal access token, an OAuth token, an installation access token or a JSON Web Token for GitHub App authentication. The `Authorization` header will be set according to the type of token.
|
||||
|
||||
```js
|
||||
import { Octokit } from "@octokit/core";
|
||||
|
||||
const octokit = new Octokit({
|
||||
auth: "mypersonalaccesstoken123",
|
||||
});
|
||||
|
||||
const { data } = await octokit.request("/user");
|
||||
```
|
||||
|
||||
To use a different authentication strategy, set `options.authStrategy`. A list of authentication strategies is available at [octokit/authentication-strategies.js](https://github.com/octokit/authentication-strategies.js/#readme).
|
||||
|
||||
Example
|
||||
|
||||
```js
|
||||
import { Octokit } from "@octokit/core";
|
||||
import { createAppAuth } from "@octokit/auth-app";
|
||||
|
||||
const appOctokit = new Octokit({
|
||||
authStrategy: createAppAuth,
|
||||
auth: {
|
||||
appId: 123,
|
||||
privateKey: process.env.PRIVATE_KEY,
|
||||
},
|
||||
});
|
||||
|
||||
const { data } = await appOctokit.request("/app");
|
||||
```
|
||||
|
||||
The `.auth()` method returned by the current authentication strategy can be accessed at `octokit.auth()`. Example
|
||||
|
||||
```js
|
||||
const { token } = await appOctokit.auth({
|
||||
type: "installation",
|
||||
installationId: 123,
|
||||
});
|
||||
```
|
||||
|
||||
## Logging
|
||||
|
||||
There are four built-in log methods
|
||||
|
||||
1. `octokit.log.debug(message[, additionalInfo])`
|
||||
1. `octokit.log.info(message[, additionalInfo])`
|
||||
1. `octokit.log.warn(message[, additionalInfo])`
|
||||
1. `octokit.log.error(message[, additionalInfo])`
|
||||
|
||||
They can be configured using the [`log` client option](client-options). By default, `octokit.log.debug()` and `octokit.log.info()` are no-ops, while the other two call `console.warn()` and `console.error()` respectively.
|
||||
|
||||
This is useful if you build reusable [plugins](#plugins).
|
||||
|
||||
If you would like to make the log level configurable using an environment variable or external option, we recommend the [console-log-level](https://github.com/watson/console-log-level) package. Example
|
||||
|
||||
```js
|
||||
import consoleLogLevel from "console-log-level";
|
||||
const octokit = new Octokit({
|
||||
log: consoleLogLevel({ level: "info" }),
|
||||
});
|
||||
```
|
||||
|
||||
## Hooks
|
||||
|
||||
You can customize Octokit's request lifecycle with hooks.
|
||||
|
||||
```js
|
||||
octokit.hook.before("request", async (options) => {
|
||||
validate(options);
|
||||
});
|
||||
octokit.hook.after("request", async (response, options) => {
|
||||
console.log(`${options.method} ${options.url}: ${response.status}`);
|
||||
});
|
||||
octokit.hook.error("request", async (error, options) => {
|
||||
if (error.status === 304) {
|
||||
return findInCache(error.response.headers.etag);
|
||||
}
|
||||
|
||||
throw error;
|
||||
});
|
||||
octokit.hook.wrap("request", async (request, options) => {
|
||||
// add logic before, after, catch errors or replace the request altogether
|
||||
return request(options);
|
||||
});
|
||||
```
|
||||
|
||||
See [before-after-hook](https://github.com/gr2m/before-after-hook#readme) for more documentation on hooks.
|
||||
|
||||
## Plugins
|
||||
|
||||
Octokit’s functionality can be extended using plugins. The `Octokit.plugin()` method accepts a plugin (or many) and returns a new constructor.
|
||||
|
||||
A plugin is a function which gets two arguments:
|
||||
|
||||
1. the current instance
|
||||
2. the options passed to the constructor.
|
||||
|
||||
In order to extend `octokit`'s API, the plugin must return an object with the new methods. Please refrain from adding methods directly to the `octokit` instance, especialy if you depend on keys that do not exist in `@octokit/core`, such as `octokit.rest`.
|
||||
|
||||
```js
|
||||
// index.js
|
||||
import { Octokit } from "@octokit/core";
|
||||
import myPlugin from "./lib/my-plugin.js";
|
||||
import octokitPluginExample from "octokit-plugin-example";
|
||||
const MyOctokit = Octokit.plugin(
|
||||
myPlugin,
|
||||
octokitPluginExample
|
||||
);
|
||||
|
||||
const octokit = new MyOctokit({ greeting: "Moin moin" });
|
||||
octokit.helloWorld(); // logs "Moin moin, world!"
|
||||
octokit.request("GET /"); // logs "GET / - 200 in 123ms"
|
||||
|
||||
// lib/my-plugin.js
|
||||
const plugin = (octokit, options = { greeting: "Hello" }) => {
|
||||
// hook into the request lifecycle
|
||||
octokit.hook.wrap("request", async (request, options) => {
|
||||
const time = Date.now();
|
||||
const response = await request(options);
|
||||
console.log(
|
||||
`${options.method} ${options.url} – ${response.status} in ${Date.now() -
|
||||
time}ms`
|
||||
);
|
||||
return response;
|
||||
});
|
||||
|
||||
// add a custom method
|
||||
return {
|
||||
helloWorld: () => console.log(`${options.greeting}, world!`);
|
||||
}
|
||||
};
|
||||
export default plugin;
|
||||
```
|
||||
|
||||
## Build your own Octokit with Plugins and Defaults
|
||||
|
||||
You can build your own Octokit class with preset default options and plugins. In fact, this is mostly how the `@octokit/<context>` modules work, such as [`@octokit/action`](https://github.com/octokit/action.js):
|
||||
|
||||
```js
|
||||
import { Octokit } from "@octokit/core";
|
||||
import { paginateRest } from "@octokit/plugin-paginate-rest";
|
||||
import { throttling } from "@octokit/plugin-throttling";
|
||||
import { retry } from "@octokit/plugin-retry";
|
||||
import { createActionAuth } from "@octokit/auth-action";
|
||||
const MyActionOctokit = Octokit.plugin(
|
||||
paginateRest,
|
||||
throttling,
|
||||
retry,
|
||||
).defaults({
|
||||
throttle: {
|
||||
onAbuseLimit: (retryAfter, options) => {
|
||||
/* ... */
|
||||
},
|
||||
onRateLimit: (retryAfter, options) => {
|
||||
/* ... */
|
||||
},
|
||||
},
|
||||
authStrategy: createActionAuth,
|
||||
userAgent: `my-octokit-action/v1.2.3`,
|
||||
});
|
||||
|
||||
const octokit = new MyActionOctokit();
|
||||
const installations = await octokit.paginate("GET /app/installations");
|
||||
```
|
||||
|
||||
## LICENSE
|
||||
|
||||
[MIT](LICENSE)
|
||||
134
node_modules/@octokit/app/node_modules/@octokit/core/dist-src/index.js
generated
vendored
Normal file
134
node_modules/@octokit/app/node_modules/@octokit/core/dist-src/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,134 @@
|
|||
import { getUserAgent } from "universal-user-agent";
|
||||
import Hook from "before-after-hook";
|
||||
import { request } from "@octokit/request";
|
||||
import { withCustomRequest } from "@octokit/graphql";
|
||||
import { createTokenAuth } from "@octokit/auth-token";
|
||||
import { VERSION } from "./version.js";
|
||||
const noop = () => {
|
||||
};
|
||||
const consoleWarn = console.warn.bind(console);
|
||||
const consoleError = console.error.bind(console);
|
||||
const userAgentTrail = `octokit-core.js/${VERSION} ${getUserAgent()}`;
|
||||
class Octokit {
|
||||
static VERSION = VERSION;
|
||||
static defaults(defaults) {
|
||||
const OctokitWithDefaults = class extends this {
|
||||
constructor(...args) {
|
||||
const options = args[0] || {};
|
||||
if (typeof defaults === "function") {
|
||||
super(defaults(options));
|
||||
return;
|
||||
}
|
||||
super(
|
||||
Object.assign(
|
||||
{},
|
||||
defaults,
|
||||
options,
|
||||
options.userAgent && defaults.userAgent ? {
|
||||
userAgent: `${options.userAgent} ${defaults.userAgent}`
|
||||
} : null
|
||||
)
|
||||
);
|
||||
}
|
||||
};
|
||||
return OctokitWithDefaults;
|
||||
}
|
||||
static plugins = [];
|
||||
/**
|
||||
* Attach a plugin (or many) to your Octokit instance.
|
||||
*
|
||||
* @example
|
||||
* const API = Octokit.plugin(plugin1, plugin2, plugin3, ...)
|
||||
*/
|
||||
static plugin(...newPlugins) {
|
||||
const currentPlugins = this.plugins;
|
||||
const NewOctokit = class extends this {
|
||||
static plugins = currentPlugins.concat(
|
||||
newPlugins.filter((plugin) => !currentPlugins.includes(plugin))
|
||||
);
|
||||
};
|
||||
return NewOctokit;
|
||||
}
|
||||
constructor(options = {}) {
|
||||
const hook = new Hook.Collection();
|
||||
const requestDefaults = {
|
||||
baseUrl: request.endpoint.DEFAULTS.baseUrl,
|
||||
headers: {},
|
||||
request: Object.assign({}, options.request, {
|
||||
// @ts-ignore internal usage only, no need to type
|
||||
hook: hook.bind(null, "request")
|
||||
}),
|
||||
mediaType: {
|
||||
previews: [],
|
||||
format: ""
|
||||
}
|
||||
};
|
||||
requestDefaults.headers["user-agent"] = options.userAgent ? `${options.userAgent} ${userAgentTrail}` : userAgentTrail;
|
||||
if (options.baseUrl) {
|
||||
requestDefaults.baseUrl = options.baseUrl;
|
||||
}
|
||||
if (options.previews) {
|
||||
requestDefaults.mediaType.previews = options.previews;
|
||||
}
|
||||
if (options.timeZone) {
|
||||
requestDefaults.headers["time-zone"] = options.timeZone;
|
||||
}
|
||||
this.request = request.defaults(requestDefaults);
|
||||
this.graphql = withCustomRequest(this.request).defaults(requestDefaults);
|
||||
this.log = Object.assign(
|
||||
{
|
||||
debug: noop,
|
||||
info: noop,
|
||||
warn: consoleWarn,
|
||||
error: consoleError
|
||||
},
|
||||
options.log
|
||||
);
|
||||
this.hook = hook;
|
||||
if (!options.authStrategy) {
|
||||
if (!options.auth) {
|
||||
this.auth = async () => ({
|
||||
type: "unauthenticated"
|
||||
});
|
||||
} else {
|
||||
const auth = createTokenAuth(options.auth);
|
||||
hook.wrap("request", auth.hook);
|
||||
this.auth = auth;
|
||||
}
|
||||
} else {
|
||||
const { authStrategy, ...otherOptions } = options;
|
||||
const auth = authStrategy(
|
||||
Object.assign(
|
||||
{
|
||||
request: this.request,
|
||||
log: this.log,
|
||||
// we pass the current octokit instance as well as its constructor options
|
||||
// to allow for authentication strategies that return a new octokit instance
|
||||
// that shares the same internal state as the current one. The original
|
||||
// requirement for this was the "event-octokit" authentication strategy
|
||||
// of https://github.com/probot/octokit-auth-probot.
|
||||
octokit: this,
|
||||
octokitOptions: otherOptions
|
||||
},
|
||||
options.auth
|
||||
)
|
||||
);
|
||||
hook.wrap("request", auth.hook);
|
||||
this.auth = auth;
|
||||
}
|
||||
const classConstructor = this.constructor;
|
||||
for (let i = 0; i < classConstructor.plugins.length; ++i) {
|
||||
Object.assign(this, classConstructor.plugins[i](this, options));
|
||||
}
|
||||
}
|
||||
// assigned during constructor
|
||||
request;
|
||||
graphql;
|
||||
log;
|
||||
hook;
|
||||
// TODO: type `octokit.auth` based on passed options.authStrategy
|
||||
auth;
|
||||
}
|
||||
export {
|
||||
Octokit
|
||||
};
|
||||
4
node_modules/@octokit/app/node_modules/@octokit/core/dist-src/version.js
generated
vendored
Normal file
4
node_modules/@octokit/app/node_modules/@octokit/core/dist-src/version.js
generated
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
const VERSION = "6.1.4";
|
||||
export {
|
||||
VERSION
|
||||
};
|
||||
31
node_modules/@octokit/app/node_modules/@octokit/core/dist-types/index.d.ts
generated
vendored
Normal file
31
node_modules/@octokit/app/node_modules/@octokit/core/dist-types/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
import type { HookCollection } from "before-after-hook";
|
||||
import { request } from "@octokit/request";
|
||||
import { type graphql } from "@octokit/graphql";
|
||||
import type { Constructor, Hooks, OctokitOptions, OctokitPlugin, ReturnTypeOf, UnionToIntersection } from "./types.js";
|
||||
export type { OctokitOptions } from "./types.js";
|
||||
export declare class Octokit {
|
||||
static VERSION: string;
|
||||
static defaults<S extends Constructor<any>>(this: S, defaults: OctokitOptions | Function): S;
|
||||
static plugins: OctokitPlugin[];
|
||||
/**
|
||||
* Attach a plugin (or many) to your Octokit instance.
|
||||
*
|
||||
* @example
|
||||
* const API = Octokit.plugin(plugin1, plugin2, plugin3, ...)
|
||||
*/
|
||||
static plugin<S extends Constructor<any> & {
|
||||
plugins: any[];
|
||||
}, T extends OctokitPlugin[]>(this: S, ...newPlugins: T): S & Constructor<UnionToIntersection<ReturnTypeOf<T>>>;
|
||||
constructor(options?: OctokitOptions);
|
||||
request: typeof request;
|
||||
graphql: typeof graphql;
|
||||
log: {
|
||||
debug: (message: string, additionalInfo?: object) => any;
|
||||
info: (message: string, additionalInfo?: object) => any;
|
||||
warn: (message: string, additionalInfo?: object) => any;
|
||||
error: (message: string, additionalInfo?: object) => any;
|
||||
[key: string]: any;
|
||||
};
|
||||
hook: HookCollection<Hooks>;
|
||||
auth: (...args: unknown[]) => Promise<unknown>;
|
||||
}
|
||||
44
node_modules/@octokit/app/node_modules/@octokit/core/dist-types/types.d.ts
generated
vendored
Normal file
44
node_modules/@octokit/app/node_modules/@octokit/core/dist-types/types.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
import type * as OctokitTypes from "@octokit/types";
|
||||
import type { RequestError } from "@octokit/request-error";
|
||||
import type { Octokit } from "./index.js";
|
||||
export type RequestParameters = OctokitTypes.RequestParameters;
|
||||
export interface OctokitOptions {
|
||||
authStrategy?: any;
|
||||
auth?: any;
|
||||
userAgent?: string;
|
||||
previews?: string[];
|
||||
baseUrl?: string;
|
||||
log?: {
|
||||
debug: (message: string) => unknown;
|
||||
info: (message: string) => unknown;
|
||||
warn: (message: string) => unknown;
|
||||
error: (message: string) => unknown;
|
||||
};
|
||||
request?: OctokitTypes.RequestRequestOptions;
|
||||
timeZone?: string;
|
||||
[option: string]: any;
|
||||
}
|
||||
export type Constructor<T> = new (...args: any[]) => T;
|
||||
export type ReturnTypeOf<T extends AnyFunction | AnyFunction[]> = T extends AnyFunction ? ReturnType<T> : T extends AnyFunction[] ? UnionToIntersection<Exclude<ReturnType<T[number]>, void>> : never;
|
||||
/**
|
||||
* @author https://stackoverflow.com/users/2887218/jcalz
|
||||
* @see https://stackoverflow.com/a/50375286/10325032
|
||||
*/
|
||||
export type UnionToIntersection<Union> = (Union extends any ? (argument: Union) => void : never) extends (argument: infer Intersection) => void ? Intersection : never;
|
||||
type AnyFunction = (...args: any) => any;
|
||||
export type OctokitPlugin = (octokit: Octokit, options: OctokitOptions) => {
|
||||
[key: string]: any;
|
||||
} | void;
|
||||
export type Hooks = {
|
||||
request: {
|
||||
Options: Required<OctokitTypes.EndpointDefaults>;
|
||||
Result: OctokitTypes.OctokitResponse<any>;
|
||||
Error: RequestError | Error;
|
||||
};
|
||||
[key: string]: {
|
||||
Options: unknown;
|
||||
Result: unknown;
|
||||
Error: unknown;
|
||||
};
|
||||
};
|
||||
export {};
|
||||
1
node_modules/@octokit/app/node_modules/@octokit/core/dist-types/version.d.ts
generated
vendored
Normal file
1
node_modules/@octokit/app/node_modules/@octokit/core/dist-types/version.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export declare const VERSION = "6.1.4";
|
||||
69
node_modules/@octokit/app/node_modules/@octokit/core/package.json
generated
vendored
Normal file
69
node_modules/@octokit/app/node_modules/@octokit/core/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
{
|
||||
"name": "@octokit/core",
|
||||
"version": "6.1.4",
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
"provenance": true
|
||||
},
|
||||
"type": "module",
|
||||
"description": "Extendable client for GitHub's REST & GraphQL APIs",
|
||||
"repository": "github:octokit/core.js",
|
||||
"keywords": [
|
||||
"octokit",
|
||||
"github",
|
||||
"api",
|
||||
"sdk",
|
||||
"toolkit"
|
||||
],
|
||||
"author": "Gregor Martynus (https://github.com/gr2m)",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@octokit/auth-token": "^5.0.0",
|
||||
"@octokit/graphql": "^8.1.2",
|
||||
"@octokit/request": "^9.2.1",
|
||||
"@octokit/request-error": "^6.1.7",
|
||||
"@octokit/types": "^13.6.2",
|
||||
"before-after-hook": "^3.0.2",
|
||||
"universal-user-agent": "^7.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@octokit/auth-action": "^5.0.0",
|
||||
"@octokit/auth-app": "^7.0.0",
|
||||
"@octokit/auth-oauth-app": "^8.0.0",
|
||||
"@octokit/tsconfig": "^4.0.0",
|
||||
"@sinonjs/fake-timers": "^14.0.0",
|
||||
"@types/lolex": "^5.1.0",
|
||||
"@types/node": "^22.0.0",
|
||||
"@types/sinonjs__fake-timers": "^8.1.5",
|
||||
"@vitest/coverage-v8": "^3.0.5",
|
||||
"esbuild": "^0.25.0",
|
||||
"fetch-mock": "^12.0.0",
|
||||
"glob": "^11.0.0",
|
||||
"prettier": "3.4.2",
|
||||
"proxy": "^2.0.0",
|
||||
"semantic-release": "^24.0.0",
|
||||
"semantic-release-plugin-update-version-in-files": "^1.0.0",
|
||||
"typescript": "^5.0.0",
|
||||
"undici": "^6.0.0",
|
||||
"vitest": "^3.0.5"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
},
|
||||
"files": [
|
||||
"dist-*/**",
|
||||
"bin/**"
|
||||
],
|
||||
"types": "./dist-types/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist-types/index.d.ts",
|
||||
"import": "./dist-src/index.js",
|
||||
"default": "./dist-src/index.js"
|
||||
},
|
||||
"./types": {
|
||||
"types": "./dist-types/types.d.ts"
|
||||
}
|
||||
},
|
||||
"sideEffects": false
|
||||
}
|
||||
21
node_modules/@octokit/app/node_modules/@octokit/endpoint/LICENSE
generated
vendored
Normal file
21
node_modules/@octokit/app/node_modules/@octokit/endpoint/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
The MIT License
|
||||
|
||||
Copyright (c) 2018 Octokit contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
412
node_modules/@octokit/app/node_modules/@octokit/endpoint/README.md
generated
vendored
Normal file
412
node_modules/@octokit/app/node_modules/@octokit/endpoint/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,412 @@
|
|||
# endpoint.js
|
||||
|
||||
> Turns GitHub REST API endpoints into generic request options
|
||||
|
||||
[](https://www.npmjs.com/package/@octokit/endpoint)
|
||||
[](https://github.com/octokit/endpoint.js/actions/workflows/test.yml?query=branch%3Amain)
|
||||
|
||||
`@octokit/endpoint` combines [GitHub REST API routes](https://developer.github.com/v3/) with your parameters and turns them into generic request options that can be used in any request library.
|
||||
|
||||
<!-- update table of contents by running `npx markdown-toc README.md -i` -->
|
||||
|
||||
<!-- toc -->
|
||||
|
||||
- [Usage](#usage)
|
||||
- [API](#api)
|
||||
- [`endpoint(route, options)` or `endpoint(options)`](#endpointroute-options-or-endpointoptions)
|
||||
- [`endpoint.defaults()`](#endpointdefaults)
|
||||
- [`endpoint.DEFAULTS`](#endpointdefaults)
|
||||
- [`endpoint.merge(route, options)` or `endpoint.merge(options)`](#endpointmergeroute-options-or-endpointmergeoptions)
|
||||
- [`endpoint.parse()`](#endpointparse)
|
||||
- [Special cases](#special-cases)
|
||||
- [The `data` parameter – set request body directly](#the-data-parameter-%E2%80%93-set-request-body-directly)
|
||||
- [Set parameters for both the URL/query and the request body](#set-parameters-for-both-the-urlquery-and-the-request-body)
|
||||
- [LICENSE](#license)
|
||||
|
||||
<!-- tocstop -->
|
||||
|
||||
## Usage
|
||||
|
||||
<table>
|
||||
<tbody valign=top align=left>
|
||||
<tr><th>
|
||||
Browsers
|
||||
</th><td width=100%>
|
||||
Load <code>@octokit/endpoint</code> directly from <a href="https://esm.sh">esm.sh</a>
|
||||
|
||||
```html
|
||||
<script type="module">
|
||||
import { endpoint } from "https://esm.sh/@octokit/endpoint";
|
||||
</script>
|
||||
```
|
||||
|
||||
</td></tr>
|
||||
<tr><th>
|
||||
Node
|
||||
</th><td>
|
||||
|
||||
Install with <code>npm install @octokit/endpoint</code>
|
||||
|
||||
```js
|
||||
import { endpoint } from "@octokit/endpoint";
|
||||
```
|
||||
|
||||
</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
Example for [List organization repositories](https://developer.github.com/v3/repos/#list-organization-repositories)
|
||||
|
||||
```js
|
||||
const requestOptions = endpoint("GET /orgs/{org}/repos", {
|
||||
headers: {
|
||||
authorization: "token 0000000000000000000000000000000000000001",
|
||||
},
|
||||
org: "octokit",
|
||||
type: "private",
|
||||
});
|
||||
```
|
||||
|
||||
The resulting `requestOptions` looks as follows
|
||||
|
||||
```json
|
||||
{
|
||||
"method": "GET",
|
||||
"url": "https://api.github.com/orgs/octokit/repos?type=private",
|
||||
"headers": {
|
||||
"accept": "application/vnd.github.v3+json",
|
||||
"authorization": "token 0000000000000000000000000000000000000001",
|
||||
"user-agent": "octokit/endpoint.js v1.2.3"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
You can pass `requestOptions` to common request libraries
|
||||
|
||||
```js
|
||||
const { url, ...options } = requestOptions;
|
||||
// using with fetch (https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)
|
||||
fetch(url, options);
|
||||
// using with request (https://github.com/request/request)
|
||||
request(requestOptions);
|
||||
// using with got (https://github.com/sindresorhus/got)
|
||||
got[options.method](url, options);
|
||||
// using with axios
|
||||
axios(requestOptions);
|
||||
```
|
||||
|
||||
> [!IMPORTANT]
|
||||
> As we use [conditional exports](https://nodejs.org/api/packages.html#conditional-exports), you will need to adapt your `tsconfig.json`. See the TypeScript docs on [package.json "exports"](https://www.typescriptlang.org/docs/handbook/modules/reference.html#packagejson-exports).
|
||||
|
||||
## API
|
||||
|
||||
### `endpoint(route, options)` or `endpoint(options)`
|
||||
|
||||
<table>
|
||||
<thead align=left>
|
||||
<tr>
|
||||
<th>
|
||||
name
|
||||
</th>
|
||||
<th>
|
||||
type
|
||||
</th>
|
||||
<th width=100%>
|
||||
description
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody align=left valign=top>
|
||||
<tr>
|
||||
<th>
|
||||
<code>route</code>
|
||||
</th>
|
||||
<td>
|
||||
String
|
||||
</td>
|
||||
<td>
|
||||
If set, it has to be a string consisting of URL and the request method, e.g., <code>GET /orgs/{org}</code>. If it’s set to a URL, only the method defaults to <code>GET</code>.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<code>options.method</code>
|
||||
</th>
|
||||
<td>
|
||||
String
|
||||
</td>
|
||||
<td>
|
||||
<strong>Required unless <code>route</code> is set.</strong> Any supported <a href="https://developer.github.com/v3/#http-verbs">http verb</a>. <em>Defaults to <code>GET</code></em>.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<code>options.url</code>
|
||||
</th>
|
||||
<td>
|
||||
String
|
||||
</td>
|
||||
<td>
|
||||
<strong>Required unless <code>route</code> is set.</strong> A path or full URL which may contain <code>:variable</code> or <code>{variable}</code> placeholders,
|
||||
e.g., <code>/orgs/{org}/repos</code>. The <code>url</code> is parsed using <a href="https://github.com/bramstein/url-template">url-template</a>.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<code>options.baseUrl</code>
|
||||
</th>
|
||||
<td>
|
||||
String
|
||||
</td>
|
||||
<td>
|
||||
<em>Defaults to <code>https://api.github.com</code></em>.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<code>options.headers</code>
|
||||
</th>
|
||||
<td>
|
||||
Object
|
||||
</td>
|
||||
<td>
|
||||
Custom headers. Passed headers are merged with defaults:<br>
|
||||
<em><code>headers['user-agent']</code> defaults to <code>octokit-endpoint.js/1.2.3</code> (where <code>1.2.3</code> is the released version)</em>.<br>
|
||||
<em><code>headers['accept']</code> defaults to <code>application/vnd.github.v3+json</code></em>.<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<code>options.mediaType.format</code>
|
||||
</th>
|
||||
<td>
|
||||
String
|
||||
</td>
|
||||
<td>
|
||||
Media type param, such as <code>raw</code>, <code>diff</code>, or <code>text+json</code>. See <a href="https://developer.github.com/v3/media/">Media Types</a>. Setting <code>options.mediaType.format</code> will amend the <code>headers.accept</code> value.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<code>options.data</code>
|
||||
</th>
|
||||
<td>
|
||||
Any
|
||||
</td>
|
||||
<td>
|
||||
Set request body directly instead of setting it to JSON based on additional parameters. See <a href="#data-parameter">"The <code>data</code> parameter"</a> below.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<code>options.request</code>
|
||||
</th>
|
||||
<td>
|
||||
Object
|
||||
</td>
|
||||
<td>
|
||||
Pass custom meta information for the request. The <code>request</code> object will be returned as is.
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
All other options will be passed depending on the `method` and `url` options.
|
||||
|
||||
1. If the option key has a placeholder in the `url`, it will be used as the replacement. For example, if the passed options are `{url: '/orgs/{org}/repos', org: 'foo'}` the returned `options.url` is `https://api.github.com/orgs/foo/repos`.
|
||||
2. If the `method` is `GET` or `HEAD`, the option is passed as a query parameter.
|
||||
3. Otherwise, the parameter is passed in the request body as a JSON key.
|
||||
|
||||
**Result**
|
||||
|
||||
`endpoint()` is a synchronous method and returns an object with the following keys:
|
||||
|
||||
<table>
|
||||
<thead align=left>
|
||||
<tr>
|
||||
<th>
|
||||
key
|
||||
</th>
|
||||
<th>
|
||||
type
|
||||
</th>
|
||||
<th width=100%>
|
||||
description
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody align=left valign=top>
|
||||
<tr>
|
||||
<th><code>method</code></th>
|
||||
<td>String</td>
|
||||
<td>The http method. Always lowercase.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><code>url</code></th>
|
||||
<td>String</td>
|
||||
<td>The url with placeholders replaced with passed parameters.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><code>headers</code></th>
|
||||
<td>Object</td>
|
||||
<td>All header names are lowercased.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><code>body</code></th>
|
||||
<td>Any</td>
|
||||
<td>The request body if one is present. Only for <code>PATCH</code>, <code>POST</code>, <code>PUT</code>, <code>DELETE</code> requests.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><code>request</code></th>
|
||||
<td>Object</td>
|
||||
<td>Request meta option, it will be returned as it was passed into <code>endpoint()</code></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
### `endpoint.defaults()`
|
||||
|
||||
Override or set default options. Example:
|
||||
|
||||
```js
|
||||
const request = require("request");
|
||||
const myEndpoint = require("@octokit/endpoint").defaults({
|
||||
baseUrl: "https://github-enterprise.acme-inc.com/api/v3",
|
||||
headers: {
|
||||
"user-agent": "myApp/1.2.3",
|
||||
authorization: `token 0000000000000000000000000000000000000001`,
|
||||
},
|
||||
org: "my-project",
|
||||
per_page: 100,
|
||||
});
|
||||
|
||||
request(myEndpoint(`GET /orgs/{org}/repos`));
|
||||
```
|
||||
|
||||
You can call `.defaults()` again on the returned method, the defaults will cascade.
|
||||
|
||||
```js
|
||||
const myProjectEndpoint = endpoint.defaults({
|
||||
baseUrl: "https://github-enterprise.acme-inc.com/api/v3",
|
||||
headers: {
|
||||
"user-agent": "myApp/1.2.3",
|
||||
},
|
||||
org: "my-project",
|
||||
});
|
||||
const myProjectEndpointWithAuth = myProjectEndpoint.defaults({
|
||||
headers: {
|
||||
authorization: `token 0000000000000000000000000000000000000001`,
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
`myProjectEndpointWithAuth` now defaults the `baseUrl`, `headers['user-agent']`,
|
||||
`org` and `headers['authorization']` on top of `headers['accept']` that is set
|
||||
by the global default.
|
||||
|
||||
### `endpoint.DEFAULTS`
|
||||
|
||||
The current default options.
|
||||
|
||||
```js
|
||||
endpoint.DEFAULTS.baseUrl; // https://api.github.com
|
||||
const myEndpoint = endpoint.defaults({
|
||||
baseUrl: "https://github-enterprise.acme-inc.com/api/v3",
|
||||
});
|
||||
myEndpoint.DEFAULTS.baseUrl; // https://github-enterprise.acme-inc.com/api/v3
|
||||
```
|
||||
|
||||
### `endpoint.merge(route, options)` or `endpoint.merge(options)`
|
||||
|
||||
Get the defaulted endpoint options, but without parsing them into request options:
|
||||
|
||||
```js
|
||||
const myProjectEndpoint = endpoint.defaults({
|
||||
baseUrl: "https://github-enterprise.acme-inc.com/api/v3",
|
||||
headers: {
|
||||
"user-agent": "myApp/1.2.3",
|
||||
},
|
||||
org: "my-project",
|
||||
});
|
||||
myProjectEndpoint.merge("GET /orgs/{org}/repos", {
|
||||
headers: {
|
||||
authorization: `token 0000000000000000000000000000000000000001`,
|
||||
},
|
||||
org: "my-secret-project",
|
||||
type: "private",
|
||||
});
|
||||
|
||||
// {
|
||||
// baseUrl: 'https://github-enterprise.acme-inc.com/api/v3',
|
||||
// method: 'GET',
|
||||
// url: '/orgs/{org}/repos',
|
||||
// headers: {
|
||||
// accept: 'application/vnd.github.v3+json',
|
||||
// authorization: `token 0000000000000000000000000000000000000001`,
|
||||
// 'user-agent': 'myApp/1.2.3'
|
||||
// },
|
||||
// org: 'my-secret-project',
|
||||
// type: 'private'
|
||||
// }
|
||||
```
|
||||
|
||||
### `endpoint.parse()`
|
||||
|
||||
Stateless method to turn endpoint options into request options. Calling
|
||||
`endpoint(options)` is the same as calling `endpoint.parse(endpoint.merge(options))`.
|
||||
|
||||
## Special cases
|
||||
|
||||
<a name="data-parameter"></a>
|
||||
|
||||
### The `data` parameter – set request body directly
|
||||
|
||||
Some endpoints such as [Render a Markdown document in raw mode](https://developer.github.com/v3/markdown/#render-a-markdown-document-in-raw-mode) don’t have parameters that are sent as request body keys, instead, the request body needs to be set directly. In these cases, set the `data` parameter.
|
||||
|
||||
```js
|
||||
const options = endpoint("POST /markdown/raw", {
|
||||
data: "Hello world github/linguist#1 **cool**, and #1!",
|
||||
headers: {
|
||||
accept: "text/html;charset=utf-8",
|
||||
"content-type": "text/plain",
|
||||
},
|
||||
});
|
||||
|
||||
// options is
|
||||
// {
|
||||
// method: 'post',
|
||||
// url: 'https://api.github.com/markdown/raw',
|
||||
// headers: {
|
||||
// accept: 'text/html;charset=utf-8',
|
||||
// 'content-type': 'text/plain',
|
||||
// 'user-agent': userAgent
|
||||
// },
|
||||
// body: 'Hello world github/linguist#1 **cool**, and #1!'
|
||||
// }
|
||||
```
|
||||
|
||||
### Set parameters for both the URL/query and the request body
|
||||
|
||||
There are API endpoints that accept both query parameters as well as a body. In that case, you need to add the query parameters as templates to `options.url`, as defined in the [RFC 6570 URI Template specification](https://tools.ietf.org/html/rfc6570).
|
||||
|
||||
Example
|
||||
|
||||
```js
|
||||
endpoint(
|
||||
"POST https://uploads.github.com/repos/octocat/Hello-World/releases/1/assets{?name,label}",
|
||||
{
|
||||
name: "example.zip",
|
||||
label: "short description",
|
||||
headers: {
|
||||
"content-type": "text/plain",
|
||||
"content-length": 14,
|
||||
authorization: `token 0000000000000000000000000000000000000001`,
|
||||
},
|
||||
data: "Hello, world!",
|
||||
},
|
||||
);
|
||||
```
|
||||
|
||||
## LICENSE
|
||||
|
||||
[MIT](LICENSE)
|
||||
346
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-bundle/index.js
generated
vendored
Normal file
346
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-bundle/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,346 @@
|
|||
// pkg/dist-src/defaults.js
|
||||
import { getUserAgent } from "universal-user-agent";
|
||||
|
||||
// pkg/dist-src/version.js
|
||||
var VERSION = "0.0.0-development";
|
||||
|
||||
// pkg/dist-src/defaults.js
|
||||
var userAgent = `octokit-endpoint.js/${VERSION} ${getUserAgent()}`;
|
||||
var DEFAULTS = {
|
||||
method: "GET",
|
||||
baseUrl: "https://api.github.com",
|
||||
headers: {
|
||||
accept: "application/vnd.github.v3+json",
|
||||
"user-agent": userAgent
|
||||
},
|
||||
mediaType: {
|
||||
format: ""
|
||||
}
|
||||
};
|
||||
|
||||
// pkg/dist-src/util/lowercase-keys.js
|
||||
function lowercaseKeys(object) {
|
||||
if (!object) {
|
||||
return {};
|
||||
}
|
||||
return Object.keys(object).reduce((newObj, key) => {
|
||||
newObj[key.toLowerCase()] = object[key];
|
||||
return newObj;
|
||||
}, {});
|
||||
}
|
||||
|
||||
// pkg/dist-src/util/is-plain-object.js
|
||||
function isPlainObject(value) {
|
||||
if (typeof value !== "object" || value === null) return false;
|
||||
if (Object.prototype.toString.call(value) !== "[object Object]") return false;
|
||||
const proto = Object.getPrototypeOf(value);
|
||||
if (proto === null) return true;
|
||||
const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor;
|
||||
return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value);
|
||||
}
|
||||
|
||||
// pkg/dist-src/util/merge-deep.js
|
||||
function mergeDeep(defaults, options) {
|
||||
const result = Object.assign({}, defaults);
|
||||
Object.keys(options).forEach((key) => {
|
||||
if (isPlainObject(options[key])) {
|
||||
if (!(key in defaults)) Object.assign(result, { [key]: options[key] });
|
||||
else result[key] = mergeDeep(defaults[key], options[key]);
|
||||
} else {
|
||||
Object.assign(result, { [key]: options[key] });
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
// pkg/dist-src/util/remove-undefined-properties.js
|
||||
function removeUndefinedProperties(obj) {
|
||||
for (const key in obj) {
|
||||
if (obj[key] === void 0) {
|
||||
delete obj[key];
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
// pkg/dist-src/merge.js
|
||||
function merge(defaults, route, options) {
|
||||
if (typeof route === "string") {
|
||||
let [method, url] = route.split(" ");
|
||||
options = Object.assign(url ? { method, url } : { url: method }, options);
|
||||
} else {
|
||||
options = Object.assign({}, route);
|
||||
}
|
||||
options.headers = lowercaseKeys(options.headers);
|
||||
removeUndefinedProperties(options);
|
||||
removeUndefinedProperties(options.headers);
|
||||
const mergedOptions = mergeDeep(defaults || {}, options);
|
||||
if (options.url === "/graphql") {
|
||||
if (defaults && defaults.mediaType.previews?.length) {
|
||||
mergedOptions.mediaType.previews = defaults.mediaType.previews.filter(
|
||||
(preview) => !mergedOptions.mediaType.previews.includes(preview)
|
||||
).concat(mergedOptions.mediaType.previews);
|
||||
}
|
||||
mergedOptions.mediaType.previews = (mergedOptions.mediaType.previews || []).map((preview) => preview.replace(/-preview/, ""));
|
||||
}
|
||||
return mergedOptions;
|
||||
}
|
||||
|
||||
// pkg/dist-src/util/add-query-parameters.js
|
||||
function addQueryParameters(url, parameters) {
|
||||
const separator = /\?/.test(url) ? "&" : "?";
|
||||
const names = Object.keys(parameters);
|
||||
if (names.length === 0) {
|
||||
return url;
|
||||
}
|
||||
return url + separator + names.map((name) => {
|
||||
if (name === "q") {
|
||||
return "q=" + parameters.q.split("+").map(encodeURIComponent).join("+");
|
||||
}
|
||||
return `${name}=${encodeURIComponent(parameters[name])}`;
|
||||
}).join("&");
|
||||
}
|
||||
|
||||
// pkg/dist-src/util/extract-url-variable-names.js
|
||||
var urlVariableRegex = /\{[^{}}]+\}/g;
|
||||
function removeNonChars(variableName) {
|
||||
return variableName.replace(/(?:^\W+)|(?:(?<!\W)\W+$)/g, "").split(/,/);
|
||||
}
|
||||
function extractUrlVariableNames(url) {
|
||||
const matches = url.match(urlVariableRegex);
|
||||
if (!matches) {
|
||||
return [];
|
||||
}
|
||||
return matches.map(removeNonChars).reduce((a, b) => a.concat(b), []);
|
||||
}
|
||||
|
||||
// pkg/dist-src/util/omit.js
|
||||
function omit(object, keysToOmit) {
|
||||
const result = { __proto__: null };
|
||||
for (const key of Object.keys(object)) {
|
||||
if (keysToOmit.indexOf(key) === -1) {
|
||||
result[key] = object[key];
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// pkg/dist-src/util/url-template.js
|
||||
function encodeReserved(str) {
|
||||
return str.split(/(%[0-9A-Fa-f]{2})/g).map(function(part) {
|
||||
if (!/%[0-9A-Fa-f]/.test(part)) {
|
||||
part = encodeURI(part).replace(/%5B/g, "[").replace(/%5D/g, "]");
|
||||
}
|
||||
return part;
|
||||
}).join("");
|
||||
}
|
||||
function encodeUnreserved(str) {
|
||||
return encodeURIComponent(str).replace(/[!'()*]/g, function(c) {
|
||||
return "%" + c.charCodeAt(0).toString(16).toUpperCase();
|
||||
});
|
||||
}
|
||||
function encodeValue(operator, value, key) {
|
||||
value = operator === "+" || operator === "#" ? encodeReserved(value) : encodeUnreserved(value);
|
||||
if (key) {
|
||||
return encodeUnreserved(key) + "=" + value;
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
function isDefined(value) {
|
||||
return value !== void 0 && value !== null;
|
||||
}
|
||||
function isKeyOperator(operator) {
|
||||
return operator === ";" || operator === "&" || operator === "?";
|
||||
}
|
||||
function getValues(context, operator, key, modifier) {
|
||||
var value = context[key], result = [];
|
||||
if (isDefined(value) && value !== "") {
|
||||
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
||||
value = value.toString();
|
||||
if (modifier && modifier !== "*") {
|
||||
value = value.substring(0, parseInt(modifier, 10));
|
||||
}
|
||||
result.push(
|
||||
encodeValue(operator, value, isKeyOperator(operator) ? key : "")
|
||||
);
|
||||
} else {
|
||||
if (modifier === "*") {
|
||||
if (Array.isArray(value)) {
|
||||
value.filter(isDefined).forEach(function(value2) {
|
||||
result.push(
|
||||
encodeValue(operator, value2, isKeyOperator(operator) ? key : "")
|
||||
);
|
||||
});
|
||||
} else {
|
||||
Object.keys(value).forEach(function(k) {
|
||||
if (isDefined(value[k])) {
|
||||
result.push(encodeValue(operator, value[k], k));
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
const tmp = [];
|
||||
if (Array.isArray(value)) {
|
||||
value.filter(isDefined).forEach(function(value2) {
|
||||
tmp.push(encodeValue(operator, value2));
|
||||
});
|
||||
} else {
|
||||
Object.keys(value).forEach(function(k) {
|
||||
if (isDefined(value[k])) {
|
||||
tmp.push(encodeUnreserved(k));
|
||||
tmp.push(encodeValue(operator, value[k].toString()));
|
||||
}
|
||||
});
|
||||
}
|
||||
if (isKeyOperator(operator)) {
|
||||
result.push(encodeUnreserved(key) + "=" + tmp.join(","));
|
||||
} else if (tmp.length !== 0) {
|
||||
result.push(tmp.join(","));
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (operator === ";") {
|
||||
if (isDefined(value)) {
|
||||
result.push(encodeUnreserved(key));
|
||||
}
|
||||
} else if (value === "" && (operator === "&" || operator === "?")) {
|
||||
result.push(encodeUnreserved(key) + "=");
|
||||
} else if (value === "") {
|
||||
result.push("");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function parseUrl(template) {
|
||||
return {
|
||||
expand: expand.bind(null, template)
|
||||
};
|
||||
}
|
||||
function expand(template, context) {
|
||||
var operators = ["+", "#", ".", "/", ";", "?", "&"];
|
||||
template = template.replace(
|
||||
/\{([^\{\}]+)\}|([^\{\}]+)/g,
|
||||
function(_, expression, literal) {
|
||||
if (expression) {
|
||||
let operator = "";
|
||||
const values = [];
|
||||
if (operators.indexOf(expression.charAt(0)) !== -1) {
|
||||
operator = expression.charAt(0);
|
||||
expression = expression.substr(1);
|
||||
}
|
||||
expression.split(/,/g).forEach(function(variable) {
|
||||
var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable);
|
||||
values.push(getValues(context, operator, tmp[1], tmp[2] || tmp[3]));
|
||||
});
|
||||
if (operator && operator !== "+") {
|
||||
var separator = ",";
|
||||
if (operator === "?") {
|
||||
separator = "&";
|
||||
} else if (operator !== "#") {
|
||||
separator = operator;
|
||||
}
|
||||
return (values.length !== 0 ? operator : "") + values.join(separator);
|
||||
} else {
|
||||
return values.join(",");
|
||||
}
|
||||
} else {
|
||||
return encodeReserved(literal);
|
||||
}
|
||||
}
|
||||
);
|
||||
if (template === "/") {
|
||||
return template;
|
||||
} else {
|
||||
return template.replace(/\/$/, "");
|
||||
}
|
||||
}
|
||||
|
||||
// pkg/dist-src/parse.js
|
||||
function parse(options) {
|
||||
let method = options.method.toUpperCase();
|
||||
let url = (options.url || "/").replace(/:([a-z]\w+)/g, "{$1}");
|
||||
let headers = Object.assign({}, options.headers);
|
||||
let body;
|
||||
let parameters = omit(options, [
|
||||
"method",
|
||||
"baseUrl",
|
||||
"url",
|
||||
"headers",
|
||||
"request",
|
||||
"mediaType"
|
||||
]);
|
||||
const urlVariableNames = extractUrlVariableNames(url);
|
||||
url = parseUrl(url).expand(parameters);
|
||||
if (!/^http/.test(url)) {
|
||||
url = options.baseUrl + url;
|
||||
}
|
||||
const omittedParameters = Object.keys(options).filter((option) => urlVariableNames.includes(option)).concat("baseUrl");
|
||||
const remainingParameters = omit(parameters, omittedParameters);
|
||||
const isBinaryRequest = /application\/octet-stream/i.test(headers.accept);
|
||||
if (!isBinaryRequest) {
|
||||
if (options.mediaType.format) {
|
||||
headers.accept = headers.accept.split(/,/).map(
|
||||
(format) => format.replace(
|
||||
/application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/,
|
||||
`application/vnd$1$2.${options.mediaType.format}`
|
||||
)
|
||||
).join(",");
|
||||
}
|
||||
if (url.endsWith("/graphql")) {
|
||||
if (options.mediaType.previews?.length) {
|
||||
const previewsFromAcceptHeader = headers.accept.match(/(?<![\w-])[\w-]+(?=-preview)/g) || [];
|
||||
headers.accept = previewsFromAcceptHeader.concat(options.mediaType.previews).map((preview) => {
|
||||
const format = options.mediaType.format ? `.${options.mediaType.format}` : "+json";
|
||||
return `application/vnd.github.${preview}-preview${format}`;
|
||||
}).join(",");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (["GET", "HEAD"].includes(method)) {
|
||||
url = addQueryParameters(url, remainingParameters);
|
||||
} else {
|
||||
if ("data" in remainingParameters) {
|
||||
body = remainingParameters.data;
|
||||
} else {
|
||||
if (Object.keys(remainingParameters).length) {
|
||||
body = remainingParameters;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!headers["content-type"] && typeof body !== "undefined") {
|
||||
headers["content-type"] = "application/json; charset=utf-8";
|
||||
}
|
||||
if (["PATCH", "PUT"].includes(method) && typeof body === "undefined") {
|
||||
body = "";
|
||||
}
|
||||
return Object.assign(
|
||||
{ method, url, headers },
|
||||
typeof body !== "undefined" ? { body } : null,
|
||||
options.request ? { request: options.request } : null
|
||||
);
|
||||
}
|
||||
|
||||
// pkg/dist-src/endpoint-with-defaults.js
|
||||
function endpointWithDefaults(defaults, route, options) {
|
||||
return parse(merge(defaults, route, options));
|
||||
}
|
||||
|
||||
// pkg/dist-src/with-defaults.js
|
||||
function withDefaults(oldDefaults, newDefaults) {
|
||||
const DEFAULTS2 = merge(oldDefaults, newDefaults);
|
||||
const endpoint2 = endpointWithDefaults.bind(null, DEFAULTS2);
|
||||
return Object.assign(endpoint2, {
|
||||
DEFAULTS: DEFAULTS2,
|
||||
defaults: withDefaults.bind(null, DEFAULTS2),
|
||||
merge: merge.bind(null, DEFAULTS2),
|
||||
parse
|
||||
});
|
||||
}
|
||||
|
||||
// pkg/dist-src/index.js
|
||||
var endpoint = withDefaults(null, DEFAULTS);
|
||||
export {
|
||||
endpoint
|
||||
};
|
||||
7
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-bundle/index.js.map
generated
vendored
Normal file
7
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-bundle/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
17
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-src/defaults.js
generated
vendored
Normal file
17
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-src/defaults.js
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import { getUserAgent } from "universal-user-agent";
|
||||
import { VERSION } from "./version.js";
|
||||
const userAgent = `octokit-endpoint.js/${VERSION} ${getUserAgent()}`;
|
||||
const DEFAULTS = {
|
||||
method: "GET",
|
||||
baseUrl: "https://api.github.com",
|
||||
headers: {
|
||||
accept: "application/vnd.github.v3+json",
|
||||
"user-agent": userAgent
|
||||
},
|
||||
mediaType: {
|
||||
format: ""
|
||||
}
|
||||
};
|
||||
export {
|
||||
DEFAULTS
|
||||
};
|
||||
9
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-src/endpoint-with-defaults.js
generated
vendored
Normal file
9
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-src/endpoint-with-defaults.js
generated
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
import { DEFAULTS } from "./defaults.js";
|
||||
import { merge } from "./merge.js";
|
||||
import { parse } from "./parse.js";
|
||||
function endpointWithDefaults(defaults, route, options) {
|
||||
return parse(merge(defaults, route, options));
|
||||
}
|
||||
export {
|
||||
endpointWithDefaults
|
||||
};
|
||||
6
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-src/index.js
generated
vendored
Normal file
6
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-src/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
import { withDefaults } from "./with-defaults.js";
|
||||
import { DEFAULTS } from "./defaults.js";
|
||||
const endpoint = withDefaults(null, DEFAULTS);
|
||||
export {
|
||||
endpoint
|
||||
};
|
||||
27
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-src/merge.js
generated
vendored
Normal file
27
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-src/merge.js
generated
vendored
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
import { lowercaseKeys } from "./util/lowercase-keys.js";
|
||||
import { mergeDeep } from "./util/merge-deep.js";
|
||||
import { removeUndefinedProperties } from "./util/remove-undefined-properties.js";
|
||||
function merge(defaults, route, options) {
|
||||
if (typeof route === "string") {
|
||||
let [method, url] = route.split(" ");
|
||||
options = Object.assign(url ? { method, url } : { url: method }, options);
|
||||
} else {
|
||||
options = Object.assign({}, route);
|
||||
}
|
||||
options.headers = lowercaseKeys(options.headers);
|
||||
removeUndefinedProperties(options);
|
||||
removeUndefinedProperties(options.headers);
|
||||
const mergedOptions = mergeDeep(defaults || {}, options);
|
||||
if (options.url === "/graphql") {
|
||||
if (defaults && defaults.mediaType.previews?.length) {
|
||||
mergedOptions.mediaType.previews = defaults.mediaType.previews.filter(
|
||||
(preview) => !mergedOptions.mediaType.previews.includes(preview)
|
||||
).concat(mergedOptions.mediaType.previews);
|
||||
}
|
||||
mergedOptions.mediaType.previews = (mergedOptions.mediaType.previews || []).map((preview) => preview.replace(/-preview/, ""));
|
||||
}
|
||||
return mergedOptions;
|
||||
}
|
||||
export {
|
||||
merge
|
||||
};
|
||||
70
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-src/parse.js
generated
vendored
Normal file
70
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-src/parse.js
generated
vendored
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
import { addQueryParameters } from "./util/add-query-parameters.js";
|
||||
import { extractUrlVariableNames } from "./util/extract-url-variable-names.js";
|
||||
import { omit } from "./util/omit.js";
|
||||
import { parseUrl } from "./util/url-template.js";
|
||||
function parse(options) {
|
||||
let method = options.method.toUpperCase();
|
||||
let url = (options.url || "/").replace(/:([a-z]\w+)/g, "{$1}");
|
||||
let headers = Object.assign({}, options.headers);
|
||||
let body;
|
||||
let parameters = omit(options, [
|
||||
"method",
|
||||
"baseUrl",
|
||||
"url",
|
||||
"headers",
|
||||
"request",
|
||||
"mediaType"
|
||||
]);
|
||||
const urlVariableNames = extractUrlVariableNames(url);
|
||||
url = parseUrl(url).expand(parameters);
|
||||
if (!/^http/.test(url)) {
|
||||
url = options.baseUrl + url;
|
||||
}
|
||||
const omittedParameters = Object.keys(options).filter((option) => urlVariableNames.includes(option)).concat("baseUrl");
|
||||
const remainingParameters = omit(parameters, omittedParameters);
|
||||
const isBinaryRequest = /application\/octet-stream/i.test(headers.accept);
|
||||
if (!isBinaryRequest) {
|
||||
if (options.mediaType.format) {
|
||||
headers.accept = headers.accept.split(/,/).map(
|
||||
(format) => format.replace(
|
||||
/application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/,
|
||||
`application/vnd$1$2.${options.mediaType.format}`
|
||||
)
|
||||
).join(",");
|
||||
}
|
||||
if (url.endsWith("/graphql")) {
|
||||
if (options.mediaType.previews?.length) {
|
||||
const previewsFromAcceptHeader = headers.accept.match(/(?<![\w-])[\w-]+(?=-preview)/g) || [];
|
||||
headers.accept = previewsFromAcceptHeader.concat(options.mediaType.previews).map((preview) => {
|
||||
const format = options.mediaType.format ? `.${options.mediaType.format}` : "+json";
|
||||
return `application/vnd.github.${preview}-preview${format}`;
|
||||
}).join(",");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (["GET", "HEAD"].includes(method)) {
|
||||
url = addQueryParameters(url, remainingParameters);
|
||||
} else {
|
||||
if ("data" in remainingParameters) {
|
||||
body = remainingParameters.data;
|
||||
} else {
|
||||
if (Object.keys(remainingParameters).length) {
|
||||
body = remainingParameters;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!headers["content-type"] && typeof body !== "undefined") {
|
||||
headers["content-type"] = "application/json; charset=utf-8";
|
||||
}
|
||||
if (["PATCH", "PUT"].includes(method) && typeof body === "undefined") {
|
||||
body = "";
|
||||
}
|
||||
return Object.assign(
|
||||
{ method, url, headers },
|
||||
typeof body !== "undefined" ? { body } : null,
|
||||
options.request ? { request: options.request } : null
|
||||
);
|
||||
}
|
||||
export {
|
||||
parse
|
||||
};
|
||||
16
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-src/util/add-query-parameters.js
generated
vendored
Normal file
16
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-src/util/add-query-parameters.js
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
function addQueryParameters(url, parameters) {
|
||||
const separator = /\?/.test(url) ? "&" : "?";
|
||||
const names = Object.keys(parameters);
|
||||
if (names.length === 0) {
|
||||
return url;
|
||||
}
|
||||
return url + separator + names.map((name) => {
|
||||
if (name === "q") {
|
||||
return "q=" + parameters.q.split("+").map(encodeURIComponent).join("+");
|
||||
}
|
||||
return `${name}=${encodeURIComponent(parameters[name])}`;
|
||||
}).join("&");
|
||||
}
|
||||
export {
|
||||
addQueryParameters
|
||||
};
|
||||
14
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-src/util/extract-url-variable-names.js
generated
vendored
Normal file
14
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-src/util/extract-url-variable-names.js
generated
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
const urlVariableRegex = /\{[^{}}]+\}/g;
|
||||
function removeNonChars(variableName) {
|
||||
return variableName.replace(/(?:^\W+)|(?:(?<!\W)\W+$)/g, "").split(/,/);
|
||||
}
|
||||
function extractUrlVariableNames(url) {
|
||||
const matches = url.match(urlVariableRegex);
|
||||
if (!matches) {
|
||||
return [];
|
||||
}
|
||||
return matches.map(removeNonChars).reduce((a, b) => a.concat(b), []);
|
||||
}
|
||||
export {
|
||||
extractUrlVariableNames
|
||||
};
|
||||
11
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-src/util/is-plain-object.js
generated
vendored
Normal file
11
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-src/util/is-plain-object.js
generated
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
function isPlainObject(value) {
|
||||
if (typeof value !== "object" || value === null) return false;
|
||||
if (Object.prototype.toString.call(value) !== "[object Object]") return false;
|
||||
const proto = Object.getPrototypeOf(value);
|
||||
if (proto === null) return true;
|
||||
const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor;
|
||||
return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value);
|
||||
}
|
||||
export {
|
||||
isPlainObject
|
||||
};
|
||||
12
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-src/util/lowercase-keys.js
generated
vendored
Normal file
12
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-src/util/lowercase-keys.js
generated
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
function lowercaseKeys(object) {
|
||||
if (!object) {
|
||||
return {};
|
||||
}
|
||||
return Object.keys(object).reduce((newObj, key) => {
|
||||
newObj[key.toLowerCase()] = object[key];
|
||||
return newObj;
|
||||
}, {});
|
||||
}
|
||||
export {
|
||||
lowercaseKeys
|
||||
};
|
||||
16
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-src/util/merge-deep.js
generated
vendored
Normal file
16
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-src/util/merge-deep.js
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import { isPlainObject } from "./is-plain-object.js";
|
||||
function mergeDeep(defaults, options) {
|
||||
const result = Object.assign({}, defaults);
|
||||
Object.keys(options).forEach((key) => {
|
||||
if (isPlainObject(options[key])) {
|
||||
if (!(key in defaults)) Object.assign(result, { [key]: options[key] });
|
||||
else result[key] = mergeDeep(defaults[key], options[key]);
|
||||
} else {
|
||||
Object.assign(result, { [key]: options[key] });
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
export {
|
||||
mergeDeep
|
||||
};
|
||||
12
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-src/util/omit.js
generated
vendored
Normal file
12
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-src/util/omit.js
generated
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
function omit(object, keysToOmit) {
|
||||
const result = { __proto__: null };
|
||||
for (const key of Object.keys(object)) {
|
||||
if (keysToOmit.indexOf(key) === -1) {
|
||||
result[key] = object[key];
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
export {
|
||||
omit
|
||||
};
|
||||
11
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-src/util/remove-undefined-properties.js
generated
vendored
Normal file
11
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-src/util/remove-undefined-properties.js
generated
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
function removeUndefinedProperties(obj) {
|
||||
for (const key in obj) {
|
||||
if (obj[key] === void 0) {
|
||||
delete obj[key];
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
export {
|
||||
removeUndefinedProperties
|
||||
};
|
||||
133
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-src/util/url-template.js
generated
vendored
Normal file
133
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-src/util/url-template.js
generated
vendored
Normal file
|
|
@ -0,0 +1,133 @@
|
|||
function encodeReserved(str) {
|
||||
return str.split(/(%[0-9A-Fa-f]{2})/g).map(function(part) {
|
||||
if (!/%[0-9A-Fa-f]/.test(part)) {
|
||||
part = encodeURI(part).replace(/%5B/g, "[").replace(/%5D/g, "]");
|
||||
}
|
||||
return part;
|
||||
}).join("");
|
||||
}
|
||||
function encodeUnreserved(str) {
|
||||
return encodeURIComponent(str).replace(/[!'()*]/g, function(c) {
|
||||
return "%" + c.charCodeAt(0).toString(16).toUpperCase();
|
||||
});
|
||||
}
|
||||
function encodeValue(operator, value, key) {
|
||||
value = operator === "+" || operator === "#" ? encodeReserved(value) : encodeUnreserved(value);
|
||||
if (key) {
|
||||
return encodeUnreserved(key) + "=" + value;
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
function isDefined(value) {
|
||||
return value !== void 0 && value !== null;
|
||||
}
|
||||
function isKeyOperator(operator) {
|
||||
return operator === ";" || operator === "&" || operator === "?";
|
||||
}
|
||||
function getValues(context, operator, key, modifier) {
|
||||
var value = context[key], result = [];
|
||||
if (isDefined(value) && value !== "") {
|
||||
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
||||
value = value.toString();
|
||||
if (modifier && modifier !== "*") {
|
||||
value = value.substring(0, parseInt(modifier, 10));
|
||||
}
|
||||
result.push(
|
||||
encodeValue(operator, value, isKeyOperator(operator) ? key : "")
|
||||
);
|
||||
} else {
|
||||
if (modifier === "*") {
|
||||
if (Array.isArray(value)) {
|
||||
value.filter(isDefined).forEach(function(value2) {
|
||||
result.push(
|
||||
encodeValue(operator, value2, isKeyOperator(operator) ? key : "")
|
||||
);
|
||||
});
|
||||
} else {
|
||||
Object.keys(value).forEach(function(k) {
|
||||
if (isDefined(value[k])) {
|
||||
result.push(encodeValue(operator, value[k], k));
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
const tmp = [];
|
||||
if (Array.isArray(value)) {
|
||||
value.filter(isDefined).forEach(function(value2) {
|
||||
tmp.push(encodeValue(operator, value2));
|
||||
});
|
||||
} else {
|
||||
Object.keys(value).forEach(function(k) {
|
||||
if (isDefined(value[k])) {
|
||||
tmp.push(encodeUnreserved(k));
|
||||
tmp.push(encodeValue(operator, value[k].toString()));
|
||||
}
|
||||
});
|
||||
}
|
||||
if (isKeyOperator(operator)) {
|
||||
result.push(encodeUnreserved(key) + "=" + tmp.join(","));
|
||||
} else if (tmp.length !== 0) {
|
||||
result.push(tmp.join(","));
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (operator === ";") {
|
||||
if (isDefined(value)) {
|
||||
result.push(encodeUnreserved(key));
|
||||
}
|
||||
} else if (value === "" && (operator === "&" || operator === "?")) {
|
||||
result.push(encodeUnreserved(key) + "=");
|
||||
} else if (value === "") {
|
||||
result.push("");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function parseUrl(template) {
|
||||
return {
|
||||
expand: expand.bind(null, template)
|
||||
};
|
||||
}
|
||||
function expand(template, context) {
|
||||
var operators = ["+", "#", ".", "/", ";", "?", "&"];
|
||||
template = template.replace(
|
||||
/\{([^\{\}]+)\}|([^\{\}]+)/g,
|
||||
function(_, expression, literal) {
|
||||
if (expression) {
|
||||
let operator = "";
|
||||
const values = [];
|
||||
if (operators.indexOf(expression.charAt(0)) !== -1) {
|
||||
operator = expression.charAt(0);
|
||||
expression = expression.substr(1);
|
||||
}
|
||||
expression.split(/,/g).forEach(function(variable) {
|
||||
var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable);
|
||||
values.push(getValues(context, operator, tmp[1], tmp[2] || tmp[3]));
|
||||
});
|
||||
if (operator && operator !== "+") {
|
||||
var separator = ",";
|
||||
if (operator === "?") {
|
||||
separator = "&";
|
||||
} else if (operator !== "#") {
|
||||
separator = operator;
|
||||
}
|
||||
return (values.length !== 0 ? operator : "") + values.join(separator);
|
||||
} else {
|
||||
return values.join(",");
|
||||
}
|
||||
} else {
|
||||
return encodeReserved(literal);
|
||||
}
|
||||
}
|
||||
);
|
||||
if (template === "/") {
|
||||
return template;
|
||||
} else {
|
||||
return template.replace(/\/$/, "");
|
||||
}
|
||||
}
|
||||
export {
|
||||
parseUrl
|
||||
};
|
||||
4
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-src/version.js
generated
vendored
Normal file
4
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-src/version.js
generated
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
const VERSION = "10.1.3";
|
||||
export {
|
||||
VERSION
|
||||
};
|
||||
16
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-src/with-defaults.js
generated
vendored
Normal file
16
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-src/with-defaults.js
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import { endpointWithDefaults } from "./endpoint-with-defaults.js";
|
||||
import { merge } from "./merge.js";
|
||||
import { parse } from "./parse.js";
|
||||
function withDefaults(oldDefaults, newDefaults) {
|
||||
const DEFAULTS = merge(oldDefaults, newDefaults);
|
||||
const endpoint = endpointWithDefaults.bind(null, DEFAULTS);
|
||||
return Object.assign(endpoint, {
|
||||
DEFAULTS,
|
||||
defaults: withDefaults.bind(null, DEFAULTS),
|
||||
merge: merge.bind(null, DEFAULTS),
|
||||
parse
|
||||
});
|
||||
}
|
||||
export {
|
||||
withDefaults
|
||||
};
|
||||
2
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-types/defaults.d.ts
generated
vendored
Normal file
2
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-types/defaults.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
import type { EndpointDefaults } from "@octokit/types";
|
||||
export declare const DEFAULTS: EndpointDefaults;
|
||||
3
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-types/endpoint-with-defaults.d.ts
generated
vendored
Normal file
3
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-types/endpoint-with-defaults.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
import type { EndpointOptions, RequestParameters, Route } from "@octokit/types";
|
||||
import { DEFAULTS } from "./defaults.js";
|
||||
export declare function endpointWithDefaults(defaults: typeof DEFAULTS, route: Route | EndpointOptions, options?: RequestParameters): import("@octokit/types").RequestOptions;
|
||||
1
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-types/index.d.ts
generated
vendored
Normal file
1
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-types/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export declare const endpoint: import("@octokit/types").EndpointInterface<object>;
|
||||
2
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-types/merge.d.ts
generated
vendored
Normal file
2
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-types/merge.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
import type { EndpointDefaults, RequestParameters, Route } from "@octokit/types";
|
||||
export declare function merge(defaults: EndpointDefaults | null, route?: Route | RequestParameters, options?: RequestParameters): EndpointDefaults;
|
||||
2
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-types/parse.d.ts
generated
vendored
Normal file
2
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-types/parse.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
import type { EndpointDefaults, RequestOptions } from "@octokit/types";
|
||||
export declare function parse(options: EndpointDefaults): RequestOptions;
|
||||
4
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-types/util/add-query-parameters.d.ts
generated
vendored
Normal file
4
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-types/util/add-query-parameters.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
export declare function addQueryParameters(url: string, parameters: {
|
||||
[x: string]: string | undefined;
|
||||
q?: string;
|
||||
}): string;
|
||||
1
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-types/util/extract-url-variable-names.d.ts
generated
vendored
Normal file
1
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-types/util/extract-url-variable-names.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export declare function extractUrlVariableNames(url: string): string[];
|
||||
1
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-types/util/is-plain-object.d.ts
generated
vendored
Normal file
1
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-types/util/is-plain-object.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export declare function isPlainObject(value: unknown): value is Object;
|
||||
5
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-types/util/lowercase-keys.d.ts
generated
vendored
Normal file
5
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-types/util/lowercase-keys.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
export declare function lowercaseKeys(object?: {
|
||||
[key: string]: any;
|
||||
}): {
|
||||
[key: string]: any;
|
||||
};
|
||||
1
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-types/util/merge-deep.d.ts
generated
vendored
Normal file
1
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-types/util/merge-deep.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export declare function mergeDeep(defaults: any, options: any): object;
|
||||
5
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-types/util/omit.d.ts
generated
vendored
Normal file
5
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-types/util/omit.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
export declare function omit(object: {
|
||||
[key: string]: any;
|
||||
}, keysToOmit: string[]): {
|
||||
[key: string]: any;
|
||||
};
|
||||
1
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-types/util/remove-undefined-properties.d.ts
generated
vendored
Normal file
1
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-types/util/remove-undefined-properties.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export declare function removeUndefinedProperties(obj: any): any;
|
||||
3
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-types/util/url-template.d.ts
generated
vendored
Normal file
3
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-types/util/url-template.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
export declare function parseUrl(template: string): {
|
||||
expand: (context: object) => string;
|
||||
};
|
||||
1
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-types/version.d.ts
generated
vendored
Normal file
1
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-types/version.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export declare const VERSION = "10.1.3";
|
||||
2
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-types/with-defaults.d.ts
generated
vendored
Normal file
2
node_modules/@octokit/app/node_modules/@octokit/endpoint/dist-types/with-defaults.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
import type { EndpointInterface, RequestParameters, EndpointDefaults } from "@octokit/types";
|
||||
export declare function withDefaults(oldDefaults: EndpointDefaults | null, newDefaults: RequestParameters): EndpointInterface;
|
||||
51
node_modules/@octokit/app/node_modules/@octokit/endpoint/package.json
generated
vendored
Normal file
51
node_modules/@octokit/app/node_modules/@octokit/endpoint/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
{
|
||||
"name": "@octokit/endpoint",
|
||||
"version": "10.1.3",
|
||||
"type": "module",
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
"provenance": true
|
||||
},
|
||||
"description": "Turns REST API endpoints into generic request options",
|
||||
"repository": "github:octokit/endpoint.js",
|
||||
"keywords": [
|
||||
"octokit",
|
||||
"github",
|
||||
"api",
|
||||
"rest"
|
||||
],
|
||||
"author": "Gregor Martynus (https://github.com/gr2m)",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@octokit/tsconfig": "^4.0.0",
|
||||
"@types/node": "^22.0.0",
|
||||
"@vitest/coverage-v8": "^3.0.0",
|
||||
"esbuild": "^0.25.0",
|
||||
"glob": "^11.0.0",
|
||||
"prettier": "3.4.2",
|
||||
"semantic-release": "^24.0.0",
|
||||
"semantic-release-plugin-update-version-in-files": "^1.0.0",
|
||||
"typescript": "^5.0.0",
|
||||
"vitest": "^3.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@octokit/types": "^13.6.2",
|
||||
"universal-user-agent": "^7.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
},
|
||||
"files": [
|
||||
"dist-*/**",
|
||||
"bin/**"
|
||||
],
|
||||
"types": "./dist-types/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist-types/index.d.ts",
|
||||
"import": "./dist-bundle/index.js",
|
||||
"default": "./dist-bundle/index.js"
|
||||
}
|
||||
},
|
||||
"sideEffects": false
|
||||
}
|
||||
21
node_modules/@octokit/app/node_modules/@octokit/graphql/LICENSE
generated
vendored
Normal file
21
node_modules/@octokit/app/node_modules/@octokit/graphql/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
The MIT License
|
||||
|
||||
Copyright (c) 2018 Octokit contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
408
node_modules/@octokit/app/node_modules/@octokit/graphql/README.md
generated
vendored
Normal file
408
node_modules/@octokit/app/node_modules/@octokit/graphql/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,408 @@
|
|||
# graphql.js
|
||||
|
||||
> GitHub GraphQL API client for browsers and Node
|
||||
|
||||
[](https://www.npmjs.com/package/@octokit/graphql)
|
||||
[](https://github.com/octokit/graphql.js/actions?query=workflow%3ATest+branch%3Amain)
|
||||
|
||||
<!-- toc -->
|
||||
|
||||
- [Usage](#usage)
|
||||
- [Send a simple query](#send-a-simple-query)
|
||||
- [Authentication](#authentication)
|
||||
- [Variables](#variables)
|
||||
- [Pass query together with headers and variables](#pass-query-together-with-headers-and-variables)
|
||||
- [Use with GitHub Enterprise](#use-with-github-enterprise)
|
||||
- [Use custom `@octokit/request` instance](#use-custom-octokitrequest-instance)
|
||||
- [TypeScript](#typescript)
|
||||
- [Additional Types](#additional-types)
|
||||
- [Errors](#errors)
|
||||
- [Partial responses](#partial-responses)
|
||||
- [Writing tests](#writing-tests)
|
||||
- [License](#license)
|
||||
|
||||
<!-- tocstop -->
|
||||
|
||||
## Usage
|
||||
|
||||
<table>
|
||||
<tbody valign=top align=left>
|
||||
<tr><th>
|
||||
Browsers
|
||||
</th><td width=100%>
|
||||
|
||||
Load `@octokit/graphql` directly from [esm.sh](https://esm.sh)
|
||||
|
||||
```html
|
||||
<script type="module">
|
||||
import { graphql } from "https://esm.sh/@octokit/graphql";
|
||||
</script>
|
||||
```
|
||||
|
||||
</td></tr>
|
||||
<tr><th>
|
||||
Node
|
||||
</th><td>
|
||||
|
||||
Install with <code>npm install @octokit/graphql</code>
|
||||
|
||||
```js
|
||||
import { graphql } from "@octokit/graphql";
|
||||
```
|
||||
|
||||
</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
### Send a simple query
|
||||
|
||||
```js
|
||||
const { repository } = await graphql(
|
||||
`
|
||||
{
|
||||
repository(owner: "octokit", name: "graphql.js") {
|
||||
issues(last: 3) {
|
||||
edges {
|
||||
node {
|
||||
title
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`,
|
||||
{
|
||||
headers: {
|
||||
authorization: `token secret123`,
|
||||
},
|
||||
},
|
||||
);
|
||||
```
|
||||
|
||||
### Authentication
|
||||
|
||||
The simplest way to authenticate a request is to set the `Authorization` header, e.g. to a [personal access token](https://github.com/settings/tokens/).
|
||||
|
||||
```js
|
||||
const graphqlWithAuth = graphql.defaults({
|
||||
headers: {
|
||||
authorization: `token secret123`,
|
||||
},
|
||||
});
|
||||
const { repository } = await graphqlWithAuth(`
|
||||
{
|
||||
repository(owner: "octokit", name: "graphql.js") {
|
||||
issues(last: 3) {
|
||||
edges {
|
||||
node {
|
||||
title
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`);
|
||||
```
|
||||
|
||||
For more complex authentication strategies such as GitHub Apps or Basic, we recommend the according authentication library exported by [`@octokit/auth`](https://github.com/octokit/auth.js).
|
||||
|
||||
```js
|
||||
const { createAppAuth } = await import("@octokit/auth-app");
|
||||
const auth = createAppAuth({
|
||||
appId: process.env.APP_ID,
|
||||
privateKey: process.env.PRIVATE_KEY,
|
||||
installationId: 123,
|
||||
});
|
||||
const graphqlWithAuth = graphql.defaults({
|
||||
request: {
|
||||
hook: auth.hook,
|
||||
},
|
||||
});
|
||||
|
||||
const { repository } = await graphqlWithAuth(
|
||||
`{
|
||||
repository(owner: "octokit", name: "graphql.js") {
|
||||
issues(last: 3) {
|
||||
edges {
|
||||
node {
|
||||
title
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}`,
|
||||
);
|
||||
```
|
||||
|
||||
### Variables
|
||||
|
||||
⚠️ Do not use [template literals](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals) in the query strings as they make your code vulnerable to query injection attacks (see [#2](https://github.com/octokit/graphql.js/issues/2)). Use variables instead:
|
||||
|
||||
```js
|
||||
const { repository } = await graphql(
|
||||
`
|
||||
query lastIssues($owner: String!, $repo: String!, $num: Int = 3) {
|
||||
repository(owner: $owner, name: $repo) {
|
||||
issues(last: $num) {
|
||||
edges {
|
||||
node {
|
||||
title
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`,
|
||||
{
|
||||
owner: "octokit",
|
||||
repo: "graphql.js",
|
||||
headers: {
|
||||
authorization: `token secret123`,
|
||||
},
|
||||
},
|
||||
);
|
||||
```
|
||||
|
||||
### Pass query together with headers and variables
|
||||
|
||||
```js
|
||||
import { graphql } from("@octokit/graphql");
|
||||
const { repository } = await graphql({
|
||||
query: `query lastIssues($owner: String!, $repo: String!, $num: Int = 3) {
|
||||
repository(owner: $owner, name: $repo) {
|
||||
issues(last: $num) {
|
||||
edges {
|
||||
node {
|
||||
title
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}`,
|
||||
owner: "octokit",
|
||||
repo: "graphql.js",
|
||||
headers: {
|
||||
authorization: `token secret123`,
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
### Use with GitHub Enterprise
|
||||
|
||||
```js
|
||||
import { graphql } from "@octokit/graphql";
|
||||
graphql = graphql.defaults({
|
||||
baseUrl: "https://github-enterprise.acme-inc.com/api",
|
||||
headers: {
|
||||
authorization: `token secret123`,
|
||||
},
|
||||
});
|
||||
const { repository } = await graphql(`
|
||||
{
|
||||
repository(owner: "acme-project", name: "acme-repo") {
|
||||
issues(last: 3) {
|
||||
edges {
|
||||
node {
|
||||
title
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`);
|
||||
```
|
||||
|
||||
### Use custom `@octokit/request` instance
|
||||
|
||||
```js
|
||||
import { request } from "@octokit/request";
|
||||
import { withCustomRequest } from "@octokit/graphql";
|
||||
|
||||
let requestCounter = 0;
|
||||
const myRequest = request.defaults({
|
||||
headers: {
|
||||
authorization: "bearer secret123",
|
||||
},
|
||||
request: {
|
||||
hook(request, options) {
|
||||
requestCounter++;
|
||||
return request(options);
|
||||
},
|
||||
},
|
||||
});
|
||||
const myGraphql = withCustomRequest(myRequest);
|
||||
await request("/");
|
||||
await myGraphql(`
|
||||
{
|
||||
repository(owner: "acme-project", name: "acme-repo") {
|
||||
issues(last: 3) {
|
||||
edges {
|
||||
node {
|
||||
title
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`);
|
||||
// requestCounter is now 2
|
||||
```
|
||||
|
||||
## TypeScript
|
||||
|
||||
`@octokit/graphql` is exposing proper types for its usage with TypeScript projects.
|
||||
|
||||
### Additional Types
|
||||
|
||||
Additionally, `GraphQlQueryResponseData` has been exposed to users:
|
||||
|
||||
```ts
|
||||
import type { GraphQlQueryResponseData } from "@octokit/graphql";
|
||||
```
|
||||
|
||||
## Errors
|
||||
|
||||
In case of a GraphQL error, `error.message` is set to a combined message describing all errors returned by the endpoint.
|
||||
All errors can be accessed at `error.errors`. `error.request` has the request options such as query, variables and headers set for easier debugging.
|
||||
|
||||
```js
|
||||
import { graphql, GraphqlResponseError } from "@octokit/graphql";
|
||||
graphql = graphql.defaults({
|
||||
headers: {
|
||||
authorization: `token secret123`,
|
||||
},
|
||||
});
|
||||
const query = `{
|
||||
viewer {
|
||||
bioHtml
|
||||
}
|
||||
}`;
|
||||
|
||||
try {
|
||||
const result = await graphql(query);
|
||||
} catch (error) {
|
||||
if (error instanceof GraphqlResponseError) {
|
||||
// do something with the error, allowing you to detect a graphql response error,
|
||||
// compared to accidentally catching unrelated errors.
|
||||
|
||||
// server responds with an object like the following (as an example)
|
||||
// class GraphqlResponseError {
|
||||
// "headers": {
|
||||
// "status": "403",
|
||||
// },
|
||||
// "data": null,
|
||||
// "errors": [{
|
||||
// "message": "Field 'bioHtml' doesn't exist on type 'User'",
|
||||
// "locations": [{
|
||||
// "line": 3,
|
||||
// "column": 5
|
||||
// }]
|
||||
// }]
|
||||
// }
|
||||
|
||||
console.log("Request failed:", error.request); // { query, variables: {}, headers: { authorization: 'token secret123' } }
|
||||
console.log(error.message); // Field 'bioHtml' doesn't exist on type 'User'
|
||||
} else {
|
||||
// handle non-GraphQL error
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Partial responses
|
||||
|
||||
A GraphQL query may respond with partial data accompanied by errors. In this case we will throw an error but the partial data will still be accessible through `error.data`
|
||||
|
||||
```js
|
||||
import { graphql } from "@octokit/graphql";
|
||||
graphql = graphql.defaults({
|
||||
headers: {
|
||||
authorization: `token secret123`,
|
||||
},
|
||||
});
|
||||
const query = `{
|
||||
repository(name: "probot", owner: "probot") {
|
||||
name
|
||||
ref(qualifiedName: "master") {
|
||||
target {
|
||||
... on Commit {
|
||||
history(first: 25, after: "invalid cursor") {
|
||||
nodes {
|
||||
message
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}`;
|
||||
|
||||
try {
|
||||
const result = await graphql(query);
|
||||
} catch (error) {
|
||||
// server responds with
|
||||
// {
|
||||
// "data": {
|
||||
// "repository": {
|
||||
// "name": "probot",
|
||||
// "ref": null
|
||||
// }
|
||||
// },
|
||||
// "errors": [
|
||||
// {
|
||||
// "type": "INVALID_CURSOR_ARGUMENTS",
|
||||
// "path": [
|
||||
// "repository",
|
||||
// "ref",
|
||||
// "target",
|
||||
// "history"
|
||||
// ],
|
||||
// "locations": [
|
||||
// {
|
||||
// "line": 7,
|
||||
// "column": 11
|
||||
// }
|
||||
// ],
|
||||
// "message": "`invalid cursor` does not appear to be a valid cursor."
|
||||
// }
|
||||
// ]
|
||||
// }
|
||||
|
||||
console.log("Request failed:", error.request); // { query, variables: {}, headers: { authorization: 'token secret123' } }
|
||||
console.log(error.message); // `invalid cursor` does not appear to be a valid cursor.
|
||||
console.log(error.data); // { repository: { name: 'probot', ref: null } }
|
||||
}
|
||||
```
|
||||
|
||||
## Writing tests
|
||||
|
||||
You can pass a replacement for [the built-in fetch implementation](https://github.com/bitinn/node-fetch) as `request.fetch` option. For example, using [fetch-mock](http://www.wheresrhys.co.uk/fetch-mock/) works great to write tests
|
||||
|
||||
```js
|
||||
import assert from "assert";
|
||||
import fetchMock from "fetch-mock";
|
||||
|
||||
import { graphql } from "@octokit/graphql";
|
||||
|
||||
graphql("{ viewer { login } }", {
|
||||
headers: {
|
||||
authorization: "token secret123",
|
||||
},
|
||||
request: {
|
||||
fetch: fetchMock
|
||||
.sandbox()
|
||||
.post("https://api.github.com/graphql", (url, options) => {
|
||||
assert.strictEqual(options.headers.authorization, "token secret123");
|
||||
assert.strictEqual(
|
||||
options.body,
|
||||
'{"query":"{ viewer { login } }"}',
|
||||
"Sends correct query",
|
||||
);
|
||||
return { data: {} };
|
||||
}),
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
129
node_modules/@octokit/app/node_modules/@octokit/graphql/dist-bundle/index.js
generated
vendored
Normal file
129
node_modules/@octokit/app/node_modules/@octokit/graphql/dist-bundle/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,129 @@
|
|||
// pkg/dist-src/index.js
|
||||
import { request } from "@octokit/request";
|
||||
import { getUserAgent } from "universal-user-agent";
|
||||
|
||||
// pkg/dist-src/version.js
|
||||
var VERSION = "0.0.0-development";
|
||||
|
||||
// pkg/dist-src/with-defaults.js
|
||||
import { request as Request2 } from "@octokit/request";
|
||||
|
||||
// pkg/dist-src/graphql.js
|
||||
import { request as Request } from "@octokit/request";
|
||||
|
||||
// pkg/dist-src/error.js
|
||||
function _buildMessageForResponseErrors(data) {
|
||||
return `Request failed due to following response errors:
|
||||
` + data.errors.map((e) => ` - ${e.message}`).join("\n");
|
||||
}
|
||||
var GraphqlResponseError = class extends Error {
|
||||
constructor(request2, headers, response) {
|
||||
super(_buildMessageForResponseErrors(response));
|
||||
this.request = request2;
|
||||
this.headers = headers;
|
||||
this.response = response;
|
||||
this.errors = response.errors;
|
||||
this.data = response.data;
|
||||
if (Error.captureStackTrace) {
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
}
|
||||
}
|
||||
name = "GraphqlResponseError";
|
||||
errors;
|
||||
data;
|
||||
};
|
||||
|
||||
// pkg/dist-src/graphql.js
|
||||
var NON_VARIABLE_OPTIONS = [
|
||||
"method",
|
||||
"baseUrl",
|
||||
"url",
|
||||
"headers",
|
||||
"request",
|
||||
"query",
|
||||
"mediaType",
|
||||
"operationName"
|
||||
];
|
||||
var FORBIDDEN_VARIABLE_OPTIONS = ["query", "method", "url"];
|
||||
var GHES_V3_SUFFIX_REGEX = /\/api\/v3\/?$/;
|
||||
function graphql(request2, query, options) {
|
||||
if (options) {
|
||||
if (typeof query === "string" && "query" in options) {
|
||||
return Promise.reject(
|
||||
new Error(`[@octokit/graphql] "query" cannot be used as variable name`)
|
||||
);
|
||||
}
|
||||
for (const key in options) {
|
||||
if (!FORBIDDEN_VARIABLE_OPTIONS.includes(key)) continue;
|
||||
return Promise.reject(
|
||||
new Error(
|
||||
`[@octokit/graphql] "${key}" cannot be used as variable name`
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
const parsedOptions = typeof query === "string" ? Object.assign({ query }, options) : query;
|
||||
const requestOptions = Object.keys(
|
||||
parsedOptions
|
||||
).reduce((result, key) => {
|
||||
if (NON_VARIABLE_OPTIONS.includes(key)) {
|
||||
result[key] = parsedOptions[key];
|
||||
return result;
|
||||
}
|
||||
if (!result.variables) {
|
||||
result.variables = {};
|
||||
}
|
||||
result.variables[key] = parsedOptions[key];
|
||||
return result;
|
||||
}, {});
|
||||
const baseUrl = parsedOptions.baseUrl || request2.endpoint.DEFAULTS.baseUrl;
|
||||
if (GHES_V3_SUFFIX_REGEX.test(baseUrl)) {
|
||||
requestOptions.url = baseUrl.replace(GHES_V3_SUFFIX_REGEX, "/api/graphql");
|
||||
}
|
||||
return request2(requestOptions).then((response) => {
|
||||
if (response.data.errors) {
|
||||
const headers = {};
|
||||
for (const key of Object.keys(response.headers)) {
|
||||
headers[key] = response.headers[key];
|
||||
}
|
||||
throw new GraphqlResponseError(
|
||||
requestOptions,
|
||||
headers,
|
||||
response.data
|
||||
);
|
||||
}
|
||||
return response.data.data;
|
||||
});
|
||||
}
|
||||
|
||||
// pkg/dist-src/with-defaults.js
|
||||
function withDefaults(request2, newDefaults) {
|
||||
const newRequest = request2.defaults(newDefaults);
|
||||
const newApi = (query, options) => {
|
||||
return graphql(newRequest, query, options);
|
||||
};
|
||||
return Object.assign(newApi, {
|
||||
defaults: withDefaults.bind(null, newRequest),
|
||||
endpoint: newRequest.endpoint
|
||||
});
|
||||
}
|
||||
|
||||
// pkg/dist-src/index.js
|
||||
var graphql2 = withDefaults(request, {
|
||||
headers: {
|
||||
"user-agent": `octokit-graphql.js/${VERSION} ${getUserAgent()}`
|
||||
},
|
||||
method: "POST",
|
||||
url: "/graphql"
|
||||
});
|
||||
function withCustomRequest(customRequest) {
|
||||
return withDefaults(customRequest, {
|
||||
method: "POST",
|
||||
url: "/graphql"
|
||||
});
|
||||
}
|
||||
export {
|
||||
GraphqlResponseError,
|
||||
graphql2 as graphql,
|
||||
withCustomRequest
|
||||
};
|
||||
7
node_modules/@octokit/app/node_modules/@octokit/graphql/dist-bundle/index.js.map
generated
vendored
Normal file
7
node_modules/@octokit/app/node_modules/@octokit/graphql/dist-bundle/index.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"version": 3,
|
||||
"sources": ["../dist-src/index.js", "../dist-src/version.js", "../dist-src/with-defaults.js", "../dist-src/graphql.js", "../dist-src/error.js"],
|
||||
"sourcesContent": ["import { request } from \"@octokit/request\";\nimport { getUserAgent } from \"universal-user-agent\";\nimport { VERSION } from \"./version.js\";\nimport { withDefaults } from \"./with-defaults.js\";\nconst graphql = withDefaults(request, {\n headers: {\n \"user-agent\": `octokit-graphql.js/${VERSION} ${getUserAgent()}`\n },\n method: \"POST\",\n url: \"/graphql\"\n});\nimport { GraphqlResponseError } from \"./error.js\";\nfunction withCustomRequest(customRequest) {\n return withDefaults(customRequest, {\n method: \"POST\",\n url: \"/graphql\"\n });\n}\nexport {\n GraphqlResponseError,\n graphql,\n withCustomRequest\n};\n", "const VERSION = \"0.0.0-development\";\nexport {\n VERSION\n};\n", "import { request as Request } from \"@octokit/request\";\nimport { graphql } from \"./graphql.js\";\nfunction withDefaults(request, newDefaults) {\n const newRequest = request.defaults(newDefaults);\n const newApi = (query, options) => {\n return graphql(newRequest, query, options);\n };\n return Object.assign(newApi, {\n defaults: withDefaults.bind(null, newRequest),\n endpoint: newRequest.endpoint\n });\n}\nexport {\n withDefaults\n};\n", "import { request as Request } from \"@octokit/request\";\nimport { GraphqlResponseError } from \"./error.js\";\nconst NON_VARIABLE_OPTIONS = [\n \"method\",\n \"baseUrl\",\n \"url\",\n \"headers\",\n \"request\",\n \"query\",\n \"mediaType\",\n \"operationName\"\n];\nconst FORBIDDEN_VARIABLE_OPTIONS = [\"query\", \"method\", \"url\"];\nconst GHES_V3_SUFFIX_REGEX = /\\/api\\/v3\\/?$/;\nfunction graphql(request, query, options) {\n if (options) {\n if (typeof query === \"string\" && \"query\" in options) {\n return Promise.reject(\n new Error(`[@octokit/graphql] \"query\" cannot be used as variable name`)\n );\n }\n for (const key in options) {\n if (!FORBIDDEN_VARIABLE_OPTIONS.includes(key)) continue;\n return Promise.reject(\n new Error(\n `[@octokit/graphql] \"${key}\" cannot be used as variable name`\n )\n );\n }\n }\n const parsedOptions = typeof query === \"string\" ? Object.assign({ query }, options) : query;\n const requestOptions = Object.keys(\n parsedOptions\n ).reduce((result, key) => {\n if (NON_VARIABLE_OPTIONS.includes(key)) {\n result[key] = parsedOptions[key];\n return result;\n }\n if (!result.variables) {\n result.variables = {};\n }\n result.variables[key] = parsedOptions[key];\n return result;\n }, {});\n const baseUrl = parsedOptions.baseUrl || request.endpoint.DEFAULTS.baseUrl;\n if (GHES_V3_SUFFIX_REGEX.test(baseUrl)) {\n requestOptions.url = baseUrl.replace(GHES_V3_SUFFIX_REGEX, \"/api/graphql\");\n }\n return request(requestOptions).then((response) => {\n if (response.data.errors) {\n const headers = {};\n for (const key of Object.keys(response.headers)) {\n headers[key] = response.headers[key];\n }\n throw new GraphqlResponseError(\n requestOptions,\n headers,\n response.data\n );\n }\n return response.data.data;\n });\n}\nexport {\n graphql\n};\n", "function _buildMessageForResponseErrors(data) {\n return `Request failed due to following response errors:\n` + data.errors.map((e) => ` - ${e.message}`).join(\"\\n\");\n}\nclass GraphqlResponseError extends Error {\n constructor(request, headers, response) {\n super(_buildMessageForResponseErrors(response));\n this.request = request;\n this.headers = headers;\n this.response = response;\n this.errors = response.errors;\n this.data = response.data;\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor);\n }\n }\n name = \"GraphqlResponseError\";\n errors;\n data;\n}\nexport {\n GraphqlResponseError\n};\n"],
|
||||
"mappings": ";AAAA,SAAS,eAAe;AACxB,SAAS,oBAAoB;;;ACD7B,IAAM,UAAU;;;ACAhB,SAAS,WAAWA,gBAAe;;;ACAnC,SAAS,WAAW,eAAe;;;ACAnC,SAAS,+BAA+B,MAAM;AAC5C,SAAO;AAAA,IACL,KAAK,OAAO,IAAI,CAAC,MAAM,MAAM,EAAE,OAAO,EAAE,EAAE,KAAK,IAAI;AACvD;AACA,IAAM,uBAAN,cAAmC,MAAM;AAAA,EACvC,YAAYC,UAAS,SAAS,UAAU;AACtC,UAAM,+BAA+B,QAAQ,CAAC;AAC9C,SAAK,UAAUA;AACf,SAAK,UAAU;AACf,SAAK,WAAW;AAChB,SAAK,SAAS,SAAS;AACvB,SAAK,OAAO,SAAS;AACrB,QAAI,MAAM,mBAAmB;AAC3B,YAAM,kBAAkB,MAAM,KAAK,WAAW;AAAA,IAChD;AAAA,EACF;AAAA,EACA,OAAO;AAAA,EACP;AAAA,EACA;AACF;;;ADjBA,IAAM,uBAAuB;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AACA,IAAM,6BAA6B,CAAC,SAAS,UAAU,KAAK;AAC5D,IAAM,uBAAuB;AAC7B,SAAS,QAAQC,UAAS,OAAO,SAAS;AACxC,MAAI,SAAS;AACX,QAAI,OAAO,UAAU,YAAY,WAAW,SAAS;AACnD,aAAO,QAAQ;AAAA,QACb,IAAI,MAAM,4DAA4D;AAAA,MACxE;AAAA,IACF;AACA,eAAW,OAAO,SAAS;AACzB,UAAI,CAAC,2BAA2B,SAAS,GAAG,EAAG;AAC/C,aAAO,QAAQ;AAAA,QACb,IAAI;AAAA,UACF,uBAAuB,GAAG;AAAA,QAC5B;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACA,QAAM,gBAAgB,OAAO,UAAU,WAAW,OAAO,OAAO,EAAE,MAAM,GAAG,OAAO,IAAI;AACtF,QAAM,iBAAiB,OAAO;AAAA,IAC5B;AAAA,EACF,EAAE,OAAO,CAAC,QAAQ,QAAQ;AACxB,QAAI,qBAAqB,SAAS,GAAG,GAAG;AACtC,aAAO,GAAG,IAAI,cAAc,GAAG;AAC/B,aAAO;AAAA,IACT;AACA,QAAI,CAAC,OAAO,WAAW;AACrB,aAAO,YAAY,CAAC;AAAA,IACtB;AACA,WAAO,UAAU,GAAG,IAAI,cAAc,GAAG;AACzC,WAAO;AAAA,EACT,GAAG,CAAC,CAAC;AACL,QAAM,UAAU,cAAc,WAAWA,SAAQ,SAAS,SAAS;AACnE,MAAI,qBAAqB,KAAK,OAAO,GAAG;AACtC,mBAAe,MAAM,QAAQ,QAAQ,sBAAsB,cAAc;AAAA,EAC3E;AACA,SAAOA,SAAQ,cAAc,EAAE,KAAK,CAAC,aAAa;AAChD,QAAI,SAAS,KAAK,QAAQ;AACxB,YAAM,UAAU,CAAC;AACjB,iBAAW,OAAO,OAAO,KAAK,SAAS,OAAO,GAAG;AAC/C,gBAAQ,GAAG,IAAI,SAAS,QAAQ,GAAG;AAAA,MACrC;AACA,YAAM,IAAI;AAAA,QACR;AAAA,QACA;AAAA,QACA,SAAS;AAAA,MACX;AAAA,IACF;AACA,WAAO,SAAS,KAAK;AAAA,EACvB,CAAC;AACH;;;AD5DA,SAAS,aAAaC,UAAS,aAAa;AAC1C,QAAM,aAAaA,SAAQ,SAAS,WAAW;AAC/C,QAAM,SAAS,CAAC,OAAO,YAAY;AACjC,WAAO,QAAQ,YAAY,OAAO,OAAO;AAAA,EAC3C;AACA,SAAO,OAAO,OAAO,QAAQ;AAAA,IAC3B,UAAU,aAAa,KAAK,MAAM,UAAU;AAAA,IAC5C,UAAU,WAAW;AAAA,EACvB,CAAC;AACH;;;AFPA,IAAMC,WAAU,aAAa,SAAS;AAAA,EACpC,SAAS;AAAA,IACP,cAAc,sBAAsB,OAAO,IAAI,aAAa,CAAC;AAAA,EAC/D;AAAA,EACA,QAAQ;AAAA,EACR,KAAK;AACP,CAAC;AAED,SAAS,kBAAkB,eAAe;AACxC,SAAO,aAAa,eAAe;AAAA,IACjC,QAAQ;AAAA,IACR,KAAK;AAAA,EACP,CAAC;AACH;",
|
||||
"names": ["Request", "request", "request", "request", "graphql"]
|
||||
}
|
||||
23
node_modules/@octokit/app/node_modules/@octokit/graphql/dist-src/error.js
generated
vendored
Normal file
23
node_modules/@octokit/app/node_modules/@octokit/graphql/dist-src/error.js
generated
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
function _buildMessageForResponseErrors(data) {
|
||||
return `Request failed due to following response errors:
|
||||
` + data.errors.map((e) => ` - ${e.message}`).join("\n");
|
||||
}
|
||||
class GraphqlResponseError extends Error {
|
||||
constructor(request, headers, response) {
|
||||
super(_buildMessageForResponseErrors(response));
|
||||
this.request = request;
|
||||
this.headers = headers;
|
||||
this.response = response;
|
||||
this.errors = response.errors;
|
||||
this.data = response.data;
|
||||
if (Error.captureStackTrace) {
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
}
|
||||
}
|
||||
name = "GraphqlResponseError";
|
||||
errors;
|
||||
data;
|
||||
}
|
||||
export {
|
||||
GraphqlResponseError
|
||||
};
|
||||
66
node_modules/@octokit/app/node_modules/@octokit/graphql/dist-src/graphql.js
generated
vendored
Normal file
66
node_modules/@octokit/app/node_modules/@octokit/graphql/dist-src/graphql.js
generated
vendored
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
import { request as Request } from "@octokit/request";
|
||||
import { GraphqlResponseError } from "./error.js";
|
||||
const NON_VARIABLE_OPTIONS = [
|
||||
"method",
|
||||
"baseUrl",
|
||||
"url",
|
||||
"headers",
|
||||
"request",
|
||||
"query",
|
||||
"mediaType",
|
||||
"operationName"
|
||||
];
|
||||
const FORBIDDEN_VARIABLE_OPTIONS = ["query", "method", "url"];
|
||||
const GHES_V3_SUFFIX_REGEX = /\/api\/v3\/?$/;
|
||||
function graphql(request, query, options) {
|
||||
if (options) {
|
||||
if (typeof query === "string" && "query" in options) {
|
||||
return Promise.reject(
|
||||
new Error(`[@octokit/graphql] "query" cannot be used as variable name`)
|
||||
);
|
||||
}
|
||||
for (const key in options) {
|
||||
if (!FORBIDDEN_VARIABLE_OPTIONS.includes(key)) continue;
|
||||
return Promise.reject(
|
||||
new Error(
|
||||
`[@octokit/graphql] "${key}" cannot be used as variable name`
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
const parsedOptions = typeof query === "string" ? Object.assign({ query }, options) : query;
|
||||
const requestOptions = Object.keys(
|
||||
parsedOptions
|
||||
).reduce((result, key) => {
|
||||
if (NON_VARIABLE_OPTIONS.includes(key)) {
|
||||
result[key] = parsedOptions[key];
|
||||
return result;
|
||||
}
|
||||
if (!result.variables) {
|
||||
result.variables = {};
|
||||
}
|
||||
result.variables[key] = parsedOptions[key];
|
||||
return result;
|
||||
}, {});
|
||||
const baseUrl = parsedOptions.baseUrl || request.endpoint.DEFAULTS.baseUrl;
|
||||
if (GHES_V3_SUFFIX_REGEX.test(baseUrl)) {
|
||||
requestOptions.url = baseUrl.replace(GHES_V3_SUFFIX_REGEX, "/api/graphql");
|
||||
}
|
||||
return request(requestOptions).then((response) => {
|
||||
if (response.data.errors) {
|
||||
const headers = {};
|
||||
for (const key of Object.keys(response.headers)) {
|
||||
headers[key] = response.headers[key];
|
||||
}
|
||||
throw new GraphqlResponseError(
|
||||
requestOptions,
|
||||
headers,
|
||||
response.data
|
||||
);
|
||||
}
|
||||
return response.data.data;
|
||||
});
|
||||
}
|
||||
export {
|
||||
graphql
|
||||
};
|
||||
23
node_modules/@octokit/app/node_modules/@octokit/graphql/dist-src/index.js
generated
vendored
Normal file
23
node_modules/@octokit/app/node_modules/@octokit/graphql/dist-src/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import { request } from "@octokit/request";
|
||||
import { getUserAgent } from "universal-user-agent";
|
||||
import { VERSION } from "./version.js";
|
||||
import { withDefaults } from "./with-defaults.js";
|
||||
const graphql = withDefaults(request, {
|
||||
headers: {
|
||||
"user-agent": `octokit-graphql.js/${VERSION} ${getUserAgent()}`
|
||||
},
|
||||
method: "POST",
|
||||
url: "/graphql"
|
||||
});
|
||||
import { GraphqlResponseError } from "./error.js";
|
||||
function withCustomRequest(customRequest) {
|
||||
return withDefaults(customRequest, {
|
||||
method: "POST",
|
||||
url: "/graphql"
|
||||
});
|
||||
}
|
||||
export {
|
||||
GraphqlResponseError,
|
||||
graphql,
|
||||
withCustomRequest
|
||||
};
|
||||
4
node_modules/@octokit/app/node_modules/@octokit/graphql/dist-src/version.js
generated
vendored
Normal file
4
node_modules/@octokit/app/node_modules/@octokit/graphql/dist-src/version.js
generated
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
const VERSION = "8.2.1";
|
||||
export {
|
||||
VERSION
|
||||
};
|
||||
15
node_modules/@octokit/app/node_modules/@octokit/graphql/dist-src/with-defaults.js
generated
vendored
Normal file
15
node_modules/@octokit/app/node_modules/@octokit/graphql/dist-src/with-defaults.js
generated
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
import { request as Request } from "@octokit/request";
|
||||
import { graphql } from "./graphql.js";
|
||||
function withDefaults(request, newDefaults) {
|
||||
const newRequest = request.defaults(newDefaults);
|
||||
const newApi = (query, options) => {
|
||||
return graphql(newRequest, query, options);
|
||||
};
|
||||
return Object.assign(newApi, {
|
||||
defaults: withDefaults.bind(null, newRequest),
|
||||
endpoint: newRequest.endpoint
|
||||
});
|
||||
}
|
||||
export {
|
||||
withDefaults
|
||||
};
|
||||
13
node_modules/@octokit/app/node_modules/@octokit/graphql/dist-types/error.d.ts
generated
vendored
Normal file
13
node_modules/@octokit/app/node_modules/@octokit/graphql/dist-types/error.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import type { ResponseHeaders } from "@octokit/types";
|
||||
import type { GraphQlEndpointOptions, GraphQlQueryResponse } from "./types.js";
|
||||
type ServerResponseData<T> = Required<GraphQlQueryResponse<T>>;
|
||||
export declare class GraphqlResponseError<ResponseData> extends Error {
|
||||
readonly request: GraphQlEndpointOptions;
|
||||
readonly headers: ResponseHeaders;
|
||||
readonly response: ServerResponseData<ResponseData>;
|
||||
name: string;
|
||||
readonly errors: GraphQlQueryResponse<never>["errors"];
|
||||
readonly data: ResponseData;
|
||||
constructor(request: GraphQlEndpointOptions, headers: ResponseHeaders, response: ServerResponseData<ResponseData>);
|
||||
}
|
||||
export {};
|
||||
3
node_modules/@octokit/app/node_modules/@octokit/graphql/dist-types/graphql.d.ts
generated
vendored
Normal file
3
node_modules/@octokit/app/node_modules/@octokit/graphql/dist-types/graphql.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
import { request as Request } from "@octokit/request";
|
||||
import type { RequestParameters, GraphQlQueryResponseData } from "./types.js";
|
||||
export declare function graphql<ResponseData = GraphQlQueryResponseData>(request: typeof Request, query: string | RequestParameters, options?: RequestParameters): Promise<ResponseData>;
|
||||
5
node_modules/@octokit/app/node_modules/@octokit/graphql/dist-types/index.d.ts
generated
vendored
Normal file
5
node_modules/@octokit/app/node_modules/@octokit/graphql/dist-types/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
import { request } from "@octokit/request";
|
||||
export declare const graphql: import("./types.js").graphql;
|
||||
export type { GraphQlQueryResponseData } from "./types.js";
|
||||
export { GraphqlResponseError } from "./error.js";
|
||||
export declare function withCustomRequest(customRequest: typeof request): import("./types.js").graphql;
|
||||
55
node_modules/@octokit/app/node_modules/@octokit/graphql/dist-types/types.d.ts
generated
vendored
Normal file
55
node_modules/@octokit/app/node_modules/@octokit/graphql/dist-types/types.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
import type { EndpointOptions, RequestParameters as RequestParametersType, EndpointInterface } from "@octokit/types";
|
||||
export type GraphQlEndpointOptions = EndpointOptions & {
|
||||
variables?: {
|
||||
[key: string]: unknown;
|
||||
};
|
||||
};
|
||||
export type RequestParameters = RequestParametersType;
|
||||
export type Query = string;
|
||||
export interface graphql {
|
||||
/**
|
||||
* Sends a GraphQL query request based on endpoint options
|
||||
* The GraphQL query must be specified in `options`.
|
||||
*
|
||||
* @param {object} endpoint Must set `method` and `url`. Plus URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.
|
||||
*/
|
||||
<ResponseData>(options: RequestParameters): GraphQlResponse<ResponseData>;
|
||||
/**
|
||||
* Sends a GraphQL query request based on endpoint options
|
||||
*
|
||||
* @param {string} query GraphQL query. Example: `'query { viewer { login } }'`.
|
||||
* @param {object} [parameters] URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.
|
||||
*/
|
||||
<ResponseData>(query: Query, parameters?: RequestParameters): GraphQlResponse<ResponseData>;
|
||||
/**
|
||||
* Returns a new `endpoint` with updated route and parameters
|
||||
*/
|
||||
defaults: (newDefaults: RequestParameters) => graphql;
|
||||
/**
|
||||
* Octokit endpoint API, see {@link https://github.com/octokit/endpoint.js|@octokit/endpoint}
|
||||
*/
|
||||
endpoint: EndpointInterface;
|
||||
}
|
||||
export type GraphQlResponse<ResponseData> = Promise<ResponseData>;
|
||||
export type GraphQlQueryResponseData = {
|
||||
[key: string]: any;
|
||||
};
|
||||
export type GraphQlQueryResponse<ResponseData> = {
|
||||
data: ResponseData;
|
||||
errors?: [
|
||||
{
|
||||
type: string;
|
||||
message: string;
|
||||
path: [string];
|
||||
extensions: {
|
||||
[key: string]: any;
|
||||
};
|
||||
locations: [
|
||||
{
|
||||
line: number;
|
||||
column: number;
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
1
node_modules/@octokit/app/node_modules/@octokit/graphql/dist-types/version.d.ts
generated
vendored
Normal file
1
node_modules/@octokit/app/node_modules/@octokit/graphql/dist-types/version.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export declare const VERSION = "8.2.1";
|
||||
3
node_modules/@octokit/app/node_modules/@octokit/graphql/dist-types/with-defaults.d.ts
generated
vendored
Normal file
3
node_modules/@octokit/app/node_modules/@octokit/graphql/dist-types/with-defaults.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
import { request as Request } from "@octokit/request";
|
||||
import type { graphql as ApiInterface, RequestParameters } from "./types.js";
|
||||
export declare function withDefaults(request: typeof Request, newDefaults: RequestParameters): ApiInterface;
|
||||
56
node_modules/@octokit/app/node_modules/@octokit/graphql/package.json
generated
vendored
Normal file
56
node_modules/@octokit/app/node_modules/@octokit/graphql/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
{
|
||||
"name": "@octokit/graphql",
|
||||
"version": "8.2.1",
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
"provenance": true
|
||||
},
|
||||
"type": "module",
|
||||
"description": "GitHub GraphQL API client for browsers and Node",
|
||||
"repository": "github:octokit/graphql.js",
|
||||
"keywords": [
|
||||
"octokit",
|
||||
"github",
|
||||
"api",
|
||||
"graphql"
|
||||
],
|
||||
"author": "Gregor Martynus (https://github.com/gr2m)",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@octokit/request": "^9.2.2",
|
||||
"@octokit/types": "^13.8.0",
|
||||
"universal-user-agent": "^7.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@octokit/tsconfig": "^4.0.0",
|
||||
"@types/fetch-mock": "^7.2.5",
|
||||
"@types/node": "^22.0.0",
|
||||
"@vitest/coverage-v8": "^3.0.0",
|
||||
"esbuild": "^0.25.0",
|
||||
"fetch-mock": "^12.0.0",
|
||||
"glob": "^11.0.0",
|
||||
"prettier": "3.4.2",
|
||||
"semantic-release-plugin-update-version-in-files": "^1.0.0",
|
||||
"typescript": "^5.3.0",
|
||||
"vitest": "^3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
},
|
||||
"files": [
|
||||
"dist-*/**",
|
||||
"bin/**"
|
||||
],
|
||||
"types": "./dist-types/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist-types/index.d.ts",
|
||||
"import": "./dist-bundle/index.js",
|
||||
"default": "./dist-bundle/index.js"
|
||||
},
|
||||
"./types": {
|
||||
"types": "./dist-types/types.d.ts"
|
||||
}
|
||||
},
|
||||
"sideEffects": false
|
||||
}
|
||||
7
node_modules/@octokit/app/node_modules/@octokit/plugin-paginate-rest/LICENSE
generated
vendored
Normal file
7
node_modules/@octokit/app/node_modules/@octokit/plugin-paginate-rest/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
MIT License Copyright (c) 2019 Octokit contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue