mirror of
https://github.com/ASzc/change-string-case-action.git
synced 2024-11-23 06:43:50 +08:00
npm install
This commit is contained in:
parent
850209ac54
commit
d0603cd0a7
246
node_modules/.package-lock.json
generated
vendored
246
node_modules/.package-lock.json
generated
vendored
@ -1,145 +1,170 @@
|
||||
{
|
||||
"name": "change-string-case-action",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 2,
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"node_modules/@actions/core": {
|
||||
"version": "1.10.0",
|
||||
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.10.0.tgz",
|
||||
"integrity": "sha512-2aZDDa3zrrZbP5ZYg159sNoLRb61nQ7awl5pSvIq5Qpj81vwDzdMRKzkWJGJuwVvWpvZKx7vspJALyvaaIQyug==",
|
||||
"version": "1.10.1",
|
||||
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.10.1.tgz",
|
||||
"integrity": "sha512-3lBR9EDAY+iYIpTnTIXmWcNbX3T2kCkAEQGIQx4NVQ0575nk2k3GRZDTPQG+vVtS2izSLmINlxXf0uLtnrTP+g==",
|
||||
"dependencies": {
|
||||
"@actions/http-client": "^2.0.1",
|
||||
"uuid": "^8.3.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@actions/core/node_modules/@actions/http-client": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.0.1.tgz",
|
||||
"integrity": "sha512-PIXiMVtz6VvyaRsGY268qvj57hXQEpsYogYOu2nrQhlf+XCGmZstmuZBbAybUl1nQGnvS1k1eEsQ69ZoD7xlSw==",
|
||||
"dependencies": {
|
||||
"tunnel": "^0.0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/@actions/github": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@actions/github/-/github-4.0.0.tgz",
|
||||
"integrity": "sha512-Ej/Y2E+VV6sR9X7pWL5F3VgEWrABaT292DRqRU6R4hnQjPtC/zD3nagxVdXWiRQvYDh8kHXo7IDmG42eJ/dOMA==",
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@actions/github/-/github-6.0.0.tgz",
|
||||
"integrity": "sha512-alScpSVnYmjNEXboZjarjukQEzgCRmjMv6Xj47fsdnqGS73bjJNDpiiXmp8jr0UZLdUB6d9jW63IcmddUP+l0g==",
|
||||
"dependencies": {
|
||||
"@actions/http-client": "^1.0.8",
|
||||
"@octokit/core": "^3.0.0",
|
||||
"@octokit/plugin-paginate-rest": "^2.2.3",
|
||||
"@octokit/plugin-rest-endpoint-methods": "^4.0.0"
|
||||
"@actions/http-client": "^2.2.0",
|
||||
"@octokit/core": "^5.0.1",
|
||||
"@octokit/plugin-paginate-rest": "^9.0.0",
|
||||
"@octokit/plugin-rest-endpoint-methods": "^10.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@actions/http-client": {
|
||||
"version": "1.0.8",
|
||||
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.8.tgz",
|
||||
"integrity": "sha512-G4JjJ6f9Hb3Zvejj+ewLLKLf99ZC+9v+yCxoYf9vSyH+WkzPLB2LuUtRMGNkooMqdugGBFStIKXOuvH1W+EctA==",
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.2.0.tgz",
|
||||
"integrity": "sha512-q+epW0trjVUUHboliPb4UF9g2msf+w61b32tAkFEwL/IwP0DQWgbCMM0Hbe3e3WXSKz5VcUXbzJQgy8Hkra/Lg==",
|
||||
"dependencies": {
|
||||
"tunnel": "0.0.6"
|
||||
"tunnel": "^0.0.6",
|
||||
"undici": "^5.25.4"
|
||||
}
|
||||
},
|
||||
"node_modules/@fastify/busboy": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.0.0.tgz",
|
||||
"integrity": "sha512-JUFJad5lv7jxj926GPgymrWQxxjPYuJNiNjNMzqT+HiuP6Vl3dk5xzG+8sTX96np0ZAluvaMzPsjhHZ5rNuNQQ==",
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/auth-token": {
|
||||
"version": "2.4.2",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-2.4.2.tgz",
|
||||
"integrity": "sha512-jE/lE/IKIz2v1+/P0u4fJqv0kYwXOTujKemJMFr6FeopsxlIK3+wKDCJGnysg81XID5TgZQbIfuJ5J0lnTiuyQ==",
|
||||
"dependencies": {
|
||||
"@octokit/types": "^5.0.0"
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-4.0.0.tgz",
|
||||
"integrity": "sha512-tY/msAuJo6ARbK6SPIxZrPBms3xPbfwBrulZe0Wtr/DIY9lje2HeV1uoebShn6mx7SjCHif6EjMvoREj+gZ+SA==",
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/core": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/core/-/core-3.1.1.tgz",
|
||||
"integrity": "sha512-cQ2HGrtyNJ1IBxpTP1U5m/FkMAJvgw7d2j1q3c9P0XUuYilEgF6e4naTpsgm4iVcQeOnccZlw7XHRIUBy0ymcg==",
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/core/-/core-5.0.1.tgz",
|
||||
"integrity": "sha512-lyeeeZyESFo+ffI801SaBKmCfsvarO+dgV8/0gD8u1d87clbEdWsP5yC+dSj3zLhb2eIf5SJrn6vDz9AheETHw==",
|
||||
"dependencies": {
|
||||
"@octokit/auth-token": "^2.4.0",
|
||||
"@octokit/graphql": "^4.3.1",
|
||||
"@octokit/request": "^5.4.0",
|
||||
"@octokit/types": "^5.0.0",
|
||||
"before-after-hook": "^2.1.0",
|
||||
"@octokit/auth-token": "^4.0.0",
|
||||
"@octokit/graphql": "^7.0.0",
|
||||
"@octokit/request": "^8.0.2",
|
||||
"@octokit/request-error": "^5.0.0",
|
||||
"@octokit/types": "^12.0.0",
|
||||
"before-after-hook": "^2.2.0",
|
||||
"universal-user-agent": "^6.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/endpoint": {
|
||||
"version": "6.0.5",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-6.0.5.tgz",
|
||||
"integrity": "sha512-70K5u6zd45ItOny6aHQAsea8HHQjlQq85yqOMe+Aj8dkhN2qSJ9T+Q3YjUjEYfPRBcuUWNgMn62DQnP/4LAIiQ==",
|
||||
"version": "9.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-9.0.1.tgz",
|
||||
"integrity": "sha512-hRlOKAovtINHQPYHZlfyFwaM8OyetxeoC81lAkBy34uLb8exrZB50SQdeW3EROqiY9G9yxQTpp5OHTV54QD+vA==",
|
||||
"dependencies": {
|
||||
"@octokit/types": "^5.0.0",
|
||||
"is-plain-object": "^4.0.0",
|
||||
"@octokit/types": "^12.0.0",
|
||||
"is-plain-object": "^5.0.0",
|
||||
"universal-user-agent": "^6.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/graphql": {
|
||||
"version": "4.5.3",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-4.5.3.tgz",
|
||||
"integrity": "sha512-JyYvi3j2tOb5ofASEpcg1Advs07H+Ag+I+ez7buuZfNVAmh1IYcDTuxd4gnYH8S2PSGu+f5IdDGxMmkK+5zsdA==",
|
||||
"version": "7.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-7.0.2.tgz",
|
||||
"integrity": "sha512-OJ2iGMtj5Tg3s6RaXH22cJcxXRi7Y3EBqbHTBRq+PQAqfaS8f/236fUrWhfSn8P4jovyzqucxme7/vWSSZBX2Q==",
|
||||
"dependencies": {
|
||||
"@octokit/request": "^5.3.0",
|
||||
"@octokit/types": "^5.0.0",
|
||||
"@octokit/request": "^8.0.1",
|
||||
"@octokit/types": "^12.0.0",
|
||||
"universal-user-agent": "^6.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/openapi-types": {
|
||||
"version": "19.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-19.0.1.tgz",
|
||||
"integrity": "sha512-zC+73r2HIoRb9rWW5S3Y759hrpadlD5pNnya/QfZv0JZE7mvMu+FUa7nxHqTadi2hZc4BPZjJ8veDTuJnh8+8g=="
|
||||
},
|
||||
"node_modules/@octokit/plugin-paginate-rest": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.3.0.tgz",
|
||||
"integrity": "sha512-Ye2ZJreP0ZlqJQz8fz+hXvrEAEYK4ay7br1eDpWzr6j76VXs/gKqxFcH8qRzkB3fo/2xh4Vy9VtGii4ZDc9qlA==",
|
||||
"version": "9.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-9.1.0.tgz",
|
||||
"integrity": "sha512-FK1WMa5261SaMX/33S1EOEzalnu9+YoKfrxzRVimciachMFSWH9kQ9SOKdxxxuZXX+KxCLw1knQkneSLYmgdbg==",
|
||||
"dependencies": {
|
||||
"@octokit/types": "^5.2.0"
|
||||
"@octokit/types": "^12.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@octokit/core": ">=5"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/plugin-rest-endpoint-methods": {
|
||||
"version": "4.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-4.1.2.tgz",
|
||||
"integrity": "sha512-PTI7wpbGEZ2IR87TVh+TNWaLcgX/RsZQalFbQCq8XxYUrQ36RHyERrHSNXFy5gkWpspUAOYRSV707JJv6BhqJA==",
|
||||
"version": "10.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-10.1.0.tgz",
|
||||
"integrity": "sha512-SnVot2WFI61LYkTeSCkKNfvfqw7FdgtqvaC8nMUwYiHA8UTKoGDjL+R5pCaCEvoLu3O55pUOtNaTIyo7ngJySQ==",
|
||||
"dependencies": {
|
||||
"@octokit/types": "^5.1.1",
|
||||
"deprecation": "^2.3.1"
|
||||
"@octokit/types": "^12.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@octokit/core": ">=5"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/request": {
|
||||
"version": "5.4.7",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.4.7.tgz",
|
||||
"integrity": "sha512-FN22xUDP0i0uF38YMbOfx6TotpcENP5W8yJM1e/LieGXn6IoRxDMnBf7tx5RKSW4xuUZ/1P04NFZy5iY3Rax1A==",
|
||||
"version": "8.1.4",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-8.1.4.tgz",
|
||||
"integrity": "sha512-M0aaFfpGPEKrg7XoA/gwgRvc9MSXHRO2Ioki1qrPDbl1e9YhjIwVoHE7HIKmv/m3idzldj//xBujcFNqGX6ENA==",
|
||||
"dependencies": {
|
||||
"@octokit/endpoint": "^6.0.1",
|
||||
"@octokit/request-error": "^2.0.0",
|
||||
"@octokit/types": "^5.0.0",
|
||||
"deprecation": "^2.0.0",
|
||||
"is-plain-object": "^4.0.0",
|
||||
"node-fetch": "^2.3.0",
|
||||
"once": "^1.4.0",
|
||||
"@octokit/endpoint": "^9.0.0",
|
||||
"@octokit/request-error": "^5.0.0",
|
||||
"@octokit/types": "^12.0.0",
|
||||
"is-plain-object": "^5.0.0",
|
||||
"universal-user-agent": "^6.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/request-error": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-2.0.2.tgz",
|
||||
"integrity": "sha512-2BrmnvVSV1MXQvEkrb9zwzP0wXFNbPJij922kYBTLIlIafukrGOb+ABBT2+c6wZiuyWDH1K1zmjGQ0toN/wMWw==",
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-5.0.1.tgz",
|
||||
"integrity": "sha512-X7pnyTMV7MgtGmiXBwmO6M5kIPrntOXdyKZLigNfQWSEQzVxR4a4vo49vJjTWX70mPndj8KhfT4Dx+2Ng3vnBQ==",
|
||||
"dependencies": {
|
||||
"@octokit/types": "^5.0.1",
|
||||
"@octokit/types": "^12.0.0",
|
||||
"deprecation": "^2.0.0",
|
||||
"once": "^1.4.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/types": {
|
||||
"version": "5.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-5.2.0.tgz",
|
||||
"integrity": "sha512-XjOk9y4m8xTLIKPe1NFxNWBdzA2/z3PFFA/bwf4EoH6oS8hM0Y46mEa4Cb+KCyj/tFDznJFahzQ0Aj3o1FYq4A==",
|
||||
"version": "12.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-12.1.0.tgz",
|
||||
"integrity": "sha512-JmjQr5ZbOnpnOLX5drI2O2I1N9suOYZAgINHXTlVVg4lRtUifMv2JssT+RhmNxQwXH153Pc8HaCMdTRkqI1oVQ==",
|
||||
"dependencies": {
|
||||
"@types/node": ">= 8"
|
||||
"@octokit/openapi-types": "^19.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "14.0.27",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.0.27.tgz",
|
||||
"integrity": "sha512-kVrqXhbclHNHGu9ztnAwSncIgJv/FaxmzXJvGXNdcCpV1b8u1/Mi6z6m0vwy0LzKeXFTPLH0NzwmoJ3fNCIq0g=="
|
||||
},
|
||||
"node_modules/before-after-hook": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.1.0.tgz",
|
||||
"integrity": "sha512-IWIbu7pMqyw3EAJHzzHbWa85b6oud/yfKYg5rqB5hNE8CeMi3nX+2C2sj0HswfblST86hpVEOAb9x34NZd6P7A=="
|
||||
"version": "2.2.3",
|
||||
"resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.3.tgz",
|
||||
"integrity": "sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ=="
|
||||
},
|
||||
"node_modules/deprecation": {
|
||||
"version": "2.3.1",
|
||||
@ -147,45 +172,21 @@
|
||||
"integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ=="
|
||||
},
|
||||
"node_modules/is-plain-object": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-4.1.1.tgz",
|
||||
"integrity": "sha512-5Aw8LLVsDlZsETVMhoMXzqsXwQqr/0vlnBYzIXJbYo2F4yYlhLHs+Ez7Bod7IIQKWkJbJfxrWD7pA1Dw1TKrwA==",
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz",
|
||||
"integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/node-fetch": {
|
||||
"version": "2.6.7",
|
||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz",
|
||||
"integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==",
|
||||
"dependencies": {
|
||||
"whatwg-url": "^5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "4.x || >=6.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"encoding": "^0.1.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"encoding": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/once": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
||||
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
|
||||
"integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
|
||||
"dependencies": {
|
||||
"wrappy": "1"
|
||||
}
|
||||
},
|
||||
"node_modules/tr46": {
|
||||
"version": "0.0.3",
|
||||
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
|
||||
"integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="
|
||||
},
|
||||
"node_modules/tunnel": {
|
||||
"version": "0.0.6",
|
||||
"resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz",
|
||||
@ -194,6 +195,17 @@
|
||||
"node": ">=0.6.11 <=0.7.0 || >=0.7.3"
|
||||
}
|
||||
},
|
||||
"node_modules/undici": {
|
||||
"version": "5.26.5",
|
||||
"resolved": "https://registry.npmjs.org/undici/-/undici-5.26.5.tgz",
|
||||
"integrity": "sha512-cSb4bPFd5qgR7qr2jYAi0hlX9n5YKK2ONKkLFkxl+v/9BvC0sOpZjBHDBSXc5lWAf5ty9oZdRXytBIHzgUcerw==",
|
||||
"dependencies": {
|
||||
"@fastify/busboy": "^2.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.0"
|
||||
}
|
||||
},
|
||||
"node_modules/universal-user-agent": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.0.tgz",
|
||||
@ -207,24 +219,10 @@
|
||||
"uuid": "dist/bin/uuid"
|
||||
}
|
||||
},
|
||||
"node_modules/webidl-conversions": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
|
||||
"integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ=="
|
||||
},
|
||||
"node_modules/whatwg-url": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
|
||||
"integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==",
|
||||
"dependencies": {
|
||||
"tr46": "~0.0.3",
|
||||
"webidl-conversions": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/wrappy": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
|
||||
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="
|
||||
}
|
||||
}
|
||||
}
|
||||
|
4
node_modules/@actions/core/README.md
generated
vendored
4
node_modules/@actions/core/README.md
generated
vendored
@ -121,7 +121,7 @@ const result = await core.group('Do something async', async () => {
|
||||
|
||||
This library has 3 methods that will produce [annotations](https://docs.github.com/en/rest/reference/checks#create-a-check-run).
|
||||
```js
|
||||
core.error('This is a bad error. This will also fail the build.')
|
||||
core.error('This is a bad error, action may still succeed though.')
|
||||
|
||||
core.warning('Something went wrong, but it\'s not bad enough to fail the build.')
|
||||
|
||||
@ -163,7 +163,7 @@ export interface AnnotationProperties {
|
||||
startColumn?: number
|
||||
|
||||
/**
|
||||
* The start column for the annotation. Cannot be sent when `startLine` and `endLine` are different values.
|
||||
* The end column for the annotation. Cannot be sent when `startLine` and `endLine` are different values.
|
||||
* Defaults to `startColumn` when `startColumn` is provided.
|
||||
*/
|
||||
endColumn?: number
|
||||
|
4
node_modules/@actions/core/lib/core.d.ts
generated
vendored
4
node_modules/@actions/core/lib/core.d.ts
generated
vendored
@ -21,7 +21,7 @@ export declare enum ExitCode {
|
||||
Failure = 1
|
||||
}
|
||||
/**
|
||||
* Optional properties that can be sent with annotatation commands (notice, error, and warning)
|
||||
* Optional properties that can be sent with annotation commands (notice, error, and warning)
|
||||
* See: https://docs.github.com/en/rest/reference/checks#create-a-check-run for more information about annotations.
|
||||
*/
|
||||
export interface AnnotationProperties {
|
||||
@ -46,7 +46,7 @@ export interface AnnotationProperties {
|
||||
*/
|
||||
startColumn?: number;
|
||||
/**
|
||||
* The start column for the annotation. Cannot be sent when `startLine` and `endLine` are different values.
|
||||
* The end column for the annotation. Cannot be sent when `startLine` and `endLine` are different values.
|
||||
* Defaults to `startColumn` when `startColumn` is provided.
|
||||
*/
|
||||
endColumn?: number;
|
||||
|
2
node_modules/@actions/core/lib/oidc-utils.js
generated
vendored
2
node_modules/@actions/core/lib/oidc-utils.js
generated
vendored
@ -44,7 +44,7 @@ class OidcClient {
|
||||
.catch(error => {
|
||||
throw new Error(`Failed to get ID Token. \n
|
||||
Error Code : ${error.statusCode}\n
|
||||
Error Message: ${error.result.message}`);
|
||||
Error Message: ${error.message}`);
|
||||
});
|
||||
const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value;
|
||||
if (!id_token) {
|
||||
|
2
node_modules/@actions/core/lib/oidc-utils.js.map
generated
vendored
2
node_modules/@actions/core/lib/oidc-utils.js.map
generated
vendored
@ -1 +1 @@
|
||||
{"version":3,"file":"oidc-utils.js","sourceRoot":"","sources":["../src/oidc-utils.ts"],"names":[],"mappings":";;;;;;;;;;;;AAGA,sDAA+C;AAC/C,wDAAqE;AACrE,iCAAuC;AAKvC,MAAa,UAAU;IACb,MAAM,CAAC,gBAAgB,CAC7B,UAAU,GAAG,IAAI,EACjB,QAAQ,GAAG,EAAE;QAEb,MAAM,cAAc,GAAmB;YACrC,YAAY,EAAE,UAAU;YACxB,UAAU,EAAE,QAAQ;SACrB,CAAA;QAED,OAAO,IAAI,wBAAU,CACnB,qBAAqB,EACrB,CAAC,IAAI,8BAAuB,CAAC,UAAU,CAAC,eAAe,EAAE,CAAC,CAAC,EAC3D,cAAc,CACf,CAAA;IACH,CAAC;IAEO,MAAM,CAAC,eAAe;QAC5B,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAA;QAC3D,IAAI,CAAC,KAAK,EAAE;YACV,MAAM,IAAI,KAAK,CACb,2DAA2D,CAC5D,CAAA;SACF;QACD,OAAO,KAAK,CAAA;IACd,CAAC;IAEO,MAAM,CAAC,aAAa;QAC1B,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAA;QAC9D,IAAI,CAAC,UAAU,EAAE;YACf,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAA;SAC3E;QACD,OAAO,UAAU,CAAA;IACnB,CAAC;IAEO,MAAM,CAAO,OAAO,CAAC,YAAoB;;;YAC/C,MAAM,UAAU,GAAG,UAAU,CAAC,gBAAgB,EAAE,CAAA;YAEhD,MAAM,GAAG,GAAG,MAAM,UAAU;iBACzB,OAAO,CAAgB,YAAY,CAAC;iBACpC,KAAK,CAAC,KAAK,CAAC,EAAE;gBACb,MAAM,IAAI,KAAK,CACb;uBACa,KAAK,CAAC,UAAU;yBACd,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,CACtC,CAAA;YACH,CAAC,CAAC,CAAA;YAEJ,MAAM,QAAQ,SAAG,GAAG,CAAC,MAAM,0CAAE,KAAK,CAAA;YAClC,IAAI,CAAC,QAAQ,EAAE;gBACb,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAA;aACjE;YACD,OAAO,QAAQ,CAAA;;KAChB;IAED,MAAM,CAAO,UAAU,CAAC,QAAiB;;YACvC,IAAI;gBACF,gDAAgD;gBAChD,IAAI,YAAY,GAAW,UAAU,CAAC,aAAa,EAAE,CAAA;gBACrD,IAAI,QAAQ,EAAE;oBACZ,MAAM,eAAe,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAA;oBACpD,YAAY,GAAG,GAAG,YAAY,aAAa,eAAe,EAAE,CAAA;iBAC7D;gBAED,YAAK,CAAC,mBAAmB,YAAY,EAAE,CAAC,CAAA;gBAExC,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC,YAAY,CAAC,CAAA;gBACvD,gBAAS,CAAC,QAAQ,CAAC,CAAA;gBACnB,OAAO,QAAQ,CAAA;aAChB;YAAC,OAAO,KAAK,EAAE;gBACd,MAAM,IAAI,KAAK,CAAC,kBAAkB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAA;aACnD;QACH,CAAC;KAAA;CACF;AAzED,gCAyEC"}
|
||||
{"version":3,"file":"oidc-utils.js","sourceRoot":"","sources":["../src/oidc-utils.ts"],"names":[],"mappings":";;;;;;;;;;;;AAGA,sDAA+C;AAC/C,wDAAqE;AACrE,iCAAuC;AAKvC,MAAa,UAAU;IACb,MAAM,CAAC,gBAAgB,CAC7B,UAAU,GAAG,IAAI,EACjB,QAAQ,GAAG,EAAE;QAEb,MAAM,cAAc,GAAmB;YACrC,YAAY,EAAE,UAAU;YACxB,UAAU,EAAE,QAAQ;SACrB,CAAA;QAED,OAAO,IAAI,wBAAU,CACnB,qBAAqB,EACrB,CAAC,IAAI,8BAAuB,CAAC,UAAU,CAAC,eAAe,EAAE,CAAC,CAAC,EAC3D,cAAc,CACf,CAAA;IACH,CAAC;IAEO,MAAM,CAAC,eAAe;QAC5B,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAA;QAC3D,IAAI,CAAC,KAAK,EAAE;YACV,MAAM,IAAI,KAAK,CACb,2DAA2D,CAC5D,CAAA;SACF;QACD,OAAO,KAAK,CAAA;IACd,CAAC;IAEO,MAAM,CAAC,aAAa;QAC1B,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAA;QAC9D,IAAI,CAAC,UAAU,EAAE;YACf,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAA;SAC3E;QACD,OAAO,UAAU,CAAA;IACnB,CAAC;IAEO,MAAM,CAAO,OAAO,CAAC,YAAoB;;;YAC/C,MAAM,UAAU,GAAG,UAAU,CAAC,gBAAgB,EAAE,CAAA;YAEhD,MAAM,GAAG,GAAG,MAAM,UAAU;iBACzB,OAAO,CAAgB,YAAY,CAAC;iBACpC,KAAK,CAAC,KAAK,CAAC,EAAE;gBACb,MAAM,IAAI,KAAK,CACb;uBACa,KAAK,CAAC,UAAU;yBACd,KAAK,CAAC,OAAO,EAAE,CAC/B,CAAA;YACH,CAAC,CAAC,CAAA;YAEJ,MAAM,QAAQ,SAAG,GAAG,CAAC,MAAM,0CAAE,KAAK,CAAA;YAClC,IAAI,CAAC,QAAQ,EAAE;gBACb,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAA;aACjE;YACD,OAAO,QAAQ,CAAA;;KAChB;IAED,MAAM,CAAO,UAAU,CAAC,QAAiB;;YACvC,IAAI;gBACF,gDAAgD;gBAChD,IAAI,YAAY,GAAW,UAAU,CAAC,aAAa,EAAE,CAAA;gBACrD,IAAI,QAAQ,EAAE;oBACZ,MAAM,eAAe,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAA;oBACpD,YAAY,GAAG,GAAG,YAAY,aAAa,eAAe,EAAE,CAAA;iBAC7D;gBAED,YAAK,CAAC,mBAAmB,YAAY,EAAE,CAAC,CAAA;gBAExC,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC,YAAY,CAAC,CAAA;gBACvD,gBAAS,CAAC,QAAQ,CAAC,CAAA;gBACnB,OAAO,QAAQ,CAAA;aAChB;YAAC,OAAO,KAAK,EAAE;gBACd,MAAM,IAAI,KAAK,CAAC,kBAAkB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAA;aACnD;QACH,CAAC;KAAA;CACF;AAzED,gCAyEC"}
|
21
node_modules/@actions/core/node_modules/@actions/http-client/LICENSE
generated
vendored
21
node_modules/@actions/core/node_modules/@actions/http-client/LICENSE
generated
vendored
@ -1,21 +0,0 @@
|
||||
Actions Http Client for Node.js
|
||||
|
||||
Copyright (c) GitHub, Inc.
|
||||
|
||||
All rights reserved.
|
||||
|
||||
MIT License
|
||||
|
||||
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.
|
73
node_modules/@actions/core/node_modules/@actions/http-client/README.md
generated
vendored
73
node_modules/@actions/core/node_modules/@actions/http-client/README.md
generated
vendored
@ -1,73 +0,0 @@
|
||||
# `@actions/http-client`
|
||||
|
||||
A lightweight HTTP client optimized for building actions.
|
||||
|
||||
## Features
|
||||
|
||||
- HTTP client with TypeScript generics and async/await/Promises
|
||||
- Typings included!
|
||||
- [Proxy support](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/about-self-hosted-runners#using-a-proxy-server-with-self-hosted-runners) just works with actions and the runner
|
||||
- Targets ES2019 (runner runs actions with node 12+). Only supported on node 12+.
|
||||
- Basic, Bearer and PAT Support out of the box. Extensible handlers for others.
|
||||
- Redirects supported
|
||||
|
||||
Features and releases [here](./RELEASES.md)
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
npm install @actions/http-client --save
|
||||
```
|
||||
|
||||
## Samples
|
||||
|
||||
See the [tests](./__tests__) for detailed examples.
|
||||
|
||||
## Errors
|
||||
|
||||
### HTTP
|
||||
|
||||
The HTTP client does not throw unless truly exceptional.
|
||||
|
||||
* A request that successfully executes resulting in a 404, 500 etc... will return a response object with a status code and a body.
|
||||
* Redirects (3xx) will be followed by default.
|
||||
|
||||
See the [tests](./__tests__) for detailed examples.
|
||||
|
||||
## Debugging
|
||||
|
||||
To enable detailed console logging of all HTTP requests and responses, set the NODE_DEBUG environment varible:
|
||||
|
||||
```shell
|
||||
export NODE_DEBUG=http
|
||||
```
|
||||
|
||||
## Node support
|
||||
|
||||
The http-client is built using the latest LTS version of Node 12. It may work on previous node LTS versions but it's tested and officially supported on Node12+.
|
||||
|
||||
## Support and Versioning
|
||||
|
||||
We follow semver and will hold compatibility between major versions and increment the minor version with new features and capabilities (while holding compat).
|
||||
|
||||
## Contributing
|
||||
|
||||
We welcome PRs. Please create an issue and if applicable, a design before proceeding with code.
|
||||
|
||||
once:
|
||||
|
||||
```
|
||||
npm install
|
||||
```
|
||||
|
||||
To build:
|
||||
|
||||
```
|
||||
npm run build
|
||||
```
|
||||
|
||||
To run all tests:
|
||||
|
||||
```
|
||||
npm test
|
||||
```
|
1
node_modules/@actions/core/node_modules/@actions/http-client/lib/index.js.map
generated
vendored
1
node_modules/@actions/core/node_modules/@actions/http-client/lib/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
1
node_modules/@actions/core/node_modules/@actions/http-client/lib/proxy.js.map
generated
vendored
1
node_modules/@actions/core/node_modules/@actions/http-client/lib/proxy.js.map
generated
vendored
@ -1 +0,0 @@
|
||||
{"version":3,"file":"proxy.js","sourceRoot":"","sources":["../src/proxy.ts"],"names":[],"mappings":";;;AAAA,SAAgB,WAAW,CAAC,MAAW;IACrC,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,KAAK,QAAQ,CAAA;IAE7C,IAAI,WAAW,CAAC,MAAM,CAAC,EAAE;QACvB,OAAO,SAAS,CAAA;KACjB;IAED,MAAM,QAAQ,GAAG,CAAC,GAAG,EAAE;QACrB,IAAI,QAAQ,EAAE;YACZ,OAAO,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAA;SAChE;aAAM;YACL,OAAO,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAA;SAC9D;IACH,CAAC,CAAC,EAAE,CAAA;IAEJ,IAAI,QAAQ,EAAE;QACZ,OAAO,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAA;KACzB;SAAM;QACL,OAAO,SAAS,CAAA;KACjB;AACH,CAAC;AApBD,kCAoBC;AAED,SAAgB,WAAW,CAAC,MAAW;IACrC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE;QACpB,OAAO,KAAK,CAAA;KACb;IAED,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE,CAAA;IACxE,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,KAAK,CAAA;KACb;IAED,6BAA6B;IAC7B,IAAI,OAA2B,CAAA;IAC/B,IAAI,MAAM,CAAC,IAAI,EAAE;QACf,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;KAC9B;SAAM,IAAI,MAAM,CAAC,QAAQ,KAAK,OAAO,EAAE;QACtC,OAAO,GAAG,EAAE,CAAA;KACb;SAAM,IAAI,MAAM,CAAC,QAAQ,KAAK,QAAQ,EAAE;QACvC,OAAO,GAAG,GAAG,CAAA;KACd;IAED,qDAAqD;IACrD,MAAM,aAAa,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAA;IACrD,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;QAC/B,aAAa,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,IAAI,OAAO,EAAE,CAAC,CAAA;KACrD;IAED,uCAAuC;IACvC,KAAK,MAAM,gBAAgB,IAAI,OAAO;SACnC,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;SAChC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE;QACjB,IAAI,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,gBAAgB,CAAC,EAAE;YACnD,OAAO,IAAI,CAAA;SACZ;KACF;IAED,OAAO,KAAK,CAAA;AACd,CAAC;AArCD,kCAqCC"}
|
48
node_modules/@actions/core/node_modules/@actions/http-client/package.json
generated
vendored
48
node_modules/@actions/core/node_modules/@actions/http-client/package.json
generated
vendored
@ -1,48 +0,0 @@
|
||||
{
|
||||
"name": "@actions/http-client",
|
||||
"version": "2.0.1",
|
||||
"description": "Actions Http Client",
|
||||
"keywords": [
|
||||
"github",
|
||||
"actions",
|
||||
"http"
|
||||
],
|
||||
"homepage": "https://github.com/actions/toolkit/tree/main/packages/http-client",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
"directories": {
|
||||
"lib": "lib",
|
||||
"test": "__tests__"
|
||||
},
|
||||
"files": [
|
||||
"lib",
|
||||
"!.DS_Store"
|
||||
],
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/actions/toolkit.git",
|
||||
"directory": "packages/http-client"
|
||||
},
|
||||
"scripts": {
|
||||
"audit-moderate": "npm install && npm audit --json --audit-level=moderate > audit.json",
|
||||
"test": "echo \"Error: run tests from root\" && exit 1",
|
||||
"build": "tsc",
|
||||
"format": "prettier --write **/*.ts",
|
||||
"format-check": "prettier --check **/*.ts",
|
||||
"tsc": "tsc"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/actions/toolkit/issues"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/tunnel": "0.0.3",
|
||||
"proxy": "^1.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"tunnel": "^0.0.6"
|
||||
}
|
||||
}
|
6
node_modules/@actions/core/package.json
generated
vendored
6
node_modules/@actions/core/package.json
generated
vendored
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@actions/core",
|
||||
"version": "1.10.0",
|
||||
"version": "1.10.1",
|
||||
"description": "Actions core lib",
|
||||
"keywords": [
|
||||
"github",
|
||||
@ -30,7 +30,7 @@
|
||||
"scripts": {
|
||||
"audit-moderate": "npm install && npm audit --json --audit-level=moderate > audit.json",
|
||||
"test": "echo \"Error: run tests from root\" && exit 1",
|
||||
"tsc": "tsc"
|
||||
"tsc": "tsc -p tsconfig.json"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/actions/toolkit/issues"
|
||||
@ -43,4 +43,4 @@
|
||||
"@types/node": "^12.0.2",
|
||||
"@types/uuid": "^8.3.4"
|
||||
}
|
||||
}
|
||||
}
|
9
node_modules/@actions/github/LICENSE.md
generated
vendored
Normal file
9
node_modules/@actions/github/LICENSE.md
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright 2019 GitHub
|
||||
|
||||
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.
|
17
node_modules/@actions/github/README.md
generated
vendored
17
node_modules/@actions/github/README.md
generated
vendored
@ -22,7 +22,7 @@ async function run() {
|
||||
// You can also pass in additional options as a second parameter to getOctokit
|
||||
// const octokit = github.getOctokit(myToken, {userAgent: "MyActionVersion1"});
|
||||
|
||||
const { data: pullRequest } = await octokit.pulls.get({
|
||||
const { data: pullRequest } = await octokit.rest.pulls.get({
|
||||
owner: 'octokit',
|
||||
repo: 'rest.js',
|
||||
pull_number: 123,
|
||||
@ -50,7 +50,7 @@ const github = require('@actions/github');
|
||||
|
||||
const context = github.context;
|
||||
|
||||
const newIssue = await octokit.issues.create({
|
||||
const newIssue = await octokit.rest.issues.create({
|
||||
...context.repo,
|
||||
title: 'New issue!',
|
||||
body: 'Hello Universe!'
|
||||
@ -59,18 +59,19 @@ const newIssue = await octokit.issues.create({
|
||||
|
||||
## Webhook payload typescript definitions
|
||||
|
||||
The npm module `@octokit/webhooks` provides type definitions for the response payloads. You can cast the payload to these types for better type information.
|
||||
The npm module `@octokit/webhooks-definitions` provides type definitions for the response payloads. You can cast the payload to these types for better type information.
|
||||
|
||||
First, install the npm module `npm install @octokit/webhooks`
|
||||
First, install the npm module `npm install @octokit/webhooks-definitions`
|
||||
|
||||
Then, assert the type based on the eventName
|
||||
```ts
|
||||
import * as core from '@actions/core'
|
||||
import * as github from '@actions/github'
|
||||
import * as Webhooks from '@octokit/webhooks'
|
||||
import {PushEvent} from '@octokit/webhooks-definitions/schema'
|
||||
|
||||
if (github.context.eventName === 'push') {
|
||||
const pushPayload = github.context.payload as Webhooks.WebhookPayloadPush
|
||||
core.info(`The head commit is: ${pushPayload.head}`)
|
||||
const pushPayload = github.context.payload as PushEvent
|
||||
core.info(`The head commit is: ${pushPayload.head_commit}`)
|
||||
}
|
||||
```
|
||||
|
||||
@ -90,7 +91,7 @@ const octokit = GitHub.plugin(enterpriseServer220Admin)
|
||||
const myToken = core.getInput('myToken');
|
||||
const myOctokit = new octokit(getOctokitOptions(token))
|
||||
// Create a new user
|
||||
myOctokit.enterpriseAdmin.createUser({
|
||||
myOctokit.rest.enterpriseAdmin.createUser({
|
||||
login: "testuser",
|
||||
email: "testuser@test.com",
|
||||
});
|
||||
|
3
node_modules/@actions/github/lib/context.d.ts
generated
vendored
3
node_modules/@actions/github/lib/context.d.ts
generated
vendored
@ -13,6 +13,9 @@ export declare class Context {
|
||||
job: string;
|
||||
runNumber: number;
|
||||
runId: number;
|
||||
apiUrl: string;
|
||||
serverUrl: string;
|
||||
graphqlUrl: string;
|
||||
/**
|
||||
* Hydrate the context from the environment
|
||||
*/
|
||||
|
9
node_modules/@actions/github/lib/context.js
generated
vendored
9
node_modules/@actions/github/lib/context.js
generated
vendored
@ -8,10 +8,11 @@ class Context {
|
||||
* Hydrate the context from the environment
|
||||
*/
|
||||
constructor() {
|
||||
var _a, _b, _c;
|
||||
this.payload = {};
|
||||
if (process.env.GITHUB_EVENT_PATH) {
|
||||
if (fs_1.existsSync(process.env.GITHUB_EVENT_PATH)) {
|
||||
this.payload = JSON.parse(fs_1.readFileSync(process.env.GITHUB_EVENT_PATH, { encoding: 'utf8' }));
|
||||
if ((0, fs_1.existsSync)(process.env.GITHUB_EVENT_PATH)) {
|
||||
this.payload = JSON.parse((0, fs_1.readFileSync)(process.env.GITHUB_EVENT_PATH, { encoding: 'utf8' }));
|
||||
}
|
||||
else {
|
||||
const path = process.env.GITHUB_EVENT_PATH;
|
||||
@ -27,6 +28,10 @@ class Context {
|
||||
this.job = process.env.GITHUB_JOB;
|
||||
this.runNumber = parseInt(process.env.GITHUB_RUN_NUMBER, 10);
|
||||
this.runId = parseInt(process.env.GITHUB_RUN_ID, 10);
|
||||
this.apiUrl = (_a = process.env.GITHUB_API_URL) !== null && _a !== void 0 ? _a : `https://api.github.com`;
|
||||
this.serverUrl = (_b = process.env.GITHUB_SERVER_URL) !== null && _b !== void 0 ? _b : `https://github.com`;
|
||||
this.graphqlUrl =
|
||||
(_c = process.env.GITHUB_GRAPHQL_URL) !== null && _c !== void 0 ? _c : `https://api.github.com/graphql`;
|
||||
}
|
||||
get issue() {
|
||||
const payload = this.payload;
|
||||
|
2
node_modules/@actions/github/lib/context.js.map
generated
vendored
2
node_modules/@actions/github/lib/context.js.map
generated
vendored
@ -1 +1 @@
|
||||
{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":";;;AAEA,2BAA2C;AAC3C,2BAAsB;AAEtB,MAAa,OAAO;IAgBlB;;OAEG;IACH;QACE,IAAI,CAAC,OAAO,GAAG,EAAE,CAAA;QACjB,IAAI,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE;YACjC,IAAI,eAAU,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,EAAE;gBAC7C,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,KAAK,CACvB,iBAAY,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,EAAC,QAAQ,EAAE,MAAM,EAAC,CAAC,CAChE,CAAA;aACF;iBAAM;gBACL,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAA;gBAC1C,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,qBAAqB,IAAI,kBAAkB,QAAG,EAAE,CAAC,CAAA;aACvE;SACF;QACD,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,iBAA2B,CAAA;QACxD,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,UAAoB,CAAA;QAC3C,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,UAAoB,CAAA;QAC3C,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,eAAyB,CAAA;QACrD,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,aAAuB,CAAA;QACjD,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,YAAsB,CAAA;QAC/C,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,UAAoB,CAAA;QAC3C,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,iBAA2B,EAAE,EAAE,CAAC,CAAA;QACtE,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,aAAuB,EAAE,EAAE,CAAC,CAAA;IAChE,CAAC;IAED,IAAI,KAAK;QACP,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAA;QAE5B,uCACK,IAAI,CAAC,IAAI,KACZ,MAAM,EAAE,CAAC,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,YAAY,IAAI,OAAO,CAAC,CAAC,MAAM,IAClE;IACH,CAAC;IAED,IAAI,IAAI;QACN,IAAI,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE;YACjC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;YAC9D,OAAO,EAAC,KAAK,EAAE,IAAI,EAAC,CAAA;SACrB;QAED,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;YAC3B,OAAO;gBACL,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK;gBAC1C,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI;aACnC,CAAA;SACF;QAED,MAAM,IAAI,KAAK,CACb,kFAAkF,CACnF,CAAA;IACH,CAAC;CACF;AApED,0BAoEC"}
|
||||
{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":";;;AAEA,2BAA2C;AAC3C,2BAAsB;AAEtB,MAAa,OAAO;IAmBlB;;OAEG;IACH;;QACE,IAAI,CAAC,OAAO,GAAG,EAAE,CAAA;QACjB,IAAI,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE;YACjC,IAAI,IAAA,eAAU,EAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,EAAE;gBAC7C,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,KAAK,CACvB,IAAA,iBAAY,EAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,EAAC,QAAQ,EAAE,MAAM,EAAC,CAAC,CAChE,CAAA;aACF;iBAAM;gBACL,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAA;gBAC1C,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,qBAAqB,IAAI,kBAAkB,QAAG,EAAE,CAAC,CAAA;aACvE;SACF;QACD,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,iBAA2B,CAAA;QACxD,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,UAAoB,CAAA;QAC3C,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,UAAoB,CAAA;QAC3C,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,eAAyB,CAAA;QACrD,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,aAAuB,CAAA;QACjD,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,YAAsB,CAAA;QAC/C,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,UAAoB,CAAA;QAC3C,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,iBAA2B,EAAE,EAAE,CAAC,CAAA;QACtE,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,aAAuB,EAAE,EAAE,CAAC,CAAA;QAC9D,IAAI,CAAC,MAAM,GAAG,MAAA,OAAO,CAAC,GAAG,CAAC,cAAc,mCAAI,wBAAwB,CAAA;QACpE,IAAI,CAAC,SAAS,GAAG,MAAA,OAAO,CAAC,GAAG,CAAC,iBAAiB,mCAAI,oBAAoB,CAAA;QACtE,IAAI,CAAC,UAAU;YACb,MAAA,OAAO,CAAC,GAAG,CAAC,kBAAkB,mCAAI,gCAAgC,CAAA;IACtE,CAAC;IAED,IAAI,KAAK;QACP,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAA;QAE5B,uCACK,IAAI,CAAC,IAAI,KACZ,MAAM,EAAE,CAAC,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,YAAY,IAAI,OAAO,CAAC,CAAC,MAAM,IAClE;IACH,CAAC;IAED,IAAI,IAAI;QACN,IAAI,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE;YACjC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;YAC9D,OAAO,EAAC,KAAK,EAAE,IAAI,EAAC,CAAA;SACrB;QAED,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;YAC3B,OAAO;gBACL,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK;gBAC1C,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI;aACnC,CAAA;SACF;QAED,MAAM,IAAI,KAAK,CACb,kFAAkF,CACnF,CAAA;IACH,CAAC;CACF;AA3ED,0BA2EC"}
|
4
node_modules/@actions/github/lib/github.d.ts
generated
vendored
4
node_modules/@actions/github/lib/github.d.ts
generated
vendored
@ -1,6 +1,6 @@
|
||||
import * as Context from './context';
|
||||
import { GitHub } from './utils';
|
||||
import { OctokitOptions } from '@octokit/core/dist-types/types';
|
||||
import { OctokitOptions, OctokitPlugin } from '@octokit/core/dist-types/types';
|
||||
export declare const context: Context.Context;
|
||||
/**
|
||||
* Returns a hydrated octokit ready to use for GitHub Actions
|
||||
@ -8,4 +8,4 @@ export declare const context: Context.Context;
|
||||
* @param token the repo PAT or GITHUB_TOKEN
|
||||
* @param options other options to set
|
||||
*/
|
||||
export declare function getOctokit(token: string, options?: OctokitOptions): InstanceType<typeof GitHub>;
|
||||
export declare function getOctokit(token: string, options?: OctokitOptions, ...additionalPlugins: OctokitPlugin[]): InstanceType<typeof GitHub>;
|
||||
|
13
node_modules/@actions/github/lib/github.js
generated
vendored
13
node_modules/@actions/github/lib/github.js
generated
vendored
@ -1,7 +1,11 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
@ -14,7 +18,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
@ -29,8 +33,9 @@ exports.context = new Context.Context();
|
||||
* @param token the repo PAT or GITHUB_TOKEN
|
||||
* @param options other options to set
|
||||
*/
|
||||
function getOctokit(token, options) {
|
||||
return new utils_1.GitHub(utils_1.getOctokitOptions(token, options));
|
||||
function getOctokit(token, options, ...additionalPlugins) {
|
||||
const GitHubWithPlugins = utils_1.GitHub.plugin(...additionalPlugins);
|
||||
return new GitHubWithPlugins((0, utils_1.getOctokitOptions)(token, options));
|
||||
}
|
||||
exports.getOctokit = getOctokit;
|
||||
//# sourceMappingURL=github.js.map
|
2
node_modules/@actions/github/lib/github.js.map
generated
vendored
2
node_modules/@actions/github/lib/github.js.map
generated
vendored
@ -1 +1 @@
|
||||
{"version":3,"file":"github.js","sourceRoot":"","sources":["../src/github.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAoC;AACpC,mCAAiD;AAKpC,QAAA,OAAO,GAAG,IAAI,OAAO,CAAC,OAAO,EAAE,CAAA;AAE5C;;;;;GAKG;AACH,SAAgB,UAAU,CACxB,KAAa,EACb,OAAwB;IAExB,OAAO,IAAI,cAAM,CAAC,yBAAiB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAA;AACtD,CAAC;AALD,gCAKC"}
|
||||
{"version":3,"file":"github.js","sourceRoot":"","sources":["../src/github.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAoC;AACpC,mCAAiD;AAKpC,QAAA,OAAO,GAAG,IAAI,OAAO,CAAC,OAAO,EAAE,CAAA;AAE5C;;;;;GAKG;AACH,SAAgB,UAAU,CACxB,KAAa,EACb,OAAwB,EACxB,GAAG,iBAAkC;IAErC,MAAM,iBAAiB,GAAG,cAAM,CAAC,MAAM,CAAC,GAAG,iBAAiB,CAAC,CAAA;IAC7D,OAAO,IAAI,iBAAiB,CAAC,IAAA,yBAAiB,EAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAA;AACjE,CAAC;AAPD,gCAOC"}
|
3
node_modules/@actions/github/lib/internal/utils.d.ts
generated
vendored
3
node_modules/@actions/github/lib/internal/utils.d.ts
generated
vendored
@ -1,6 +1,9 @@
|
||||
/// <reference types="node" />
|
||||
import * as http from 'http';
|
||||
import { OctokitOptions } from '@octokit/core/dist-types/types';
|
||||
import { ProxyAgent, fetch } from 'undici';
|
||||
export declare function getAuthString(token: string, options: OctokitOptions): string | undefined;
|
||||
export declare function getProxyAgent(destinationUrl: string): http.Agent;
|
||||
export declare function getProxyAgentDispatcher(destinationUrl: string): ProxyAgent | undefined;
|
||||
export declare function getProxyFetch(destinationUrl: any): typeof fetch;
|
||||
export declare function getApiBaseUrl(): string;
|
||||
|
33
node_modules/@actions/github/lib/internal/utils.js
generated
vendored
33
node_modules/@actions/github/lib/internal/utils.js
generated
vendored
@ -1,7 +1,11 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
@ -14,13 +18,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getApiBaseUrl = exports.getProxyAgent = exports.getAuthString = void 0;
|
||||
exports.getApiBaseUrl = exports.getProxyFetch = exports.getProxyAgentDispatcher = exports.getProxyAgent = exports.getAuthString = void 0;
|
||||
const httpClient = __importStar(require("@actions/http-client"));
|
||||
const undici_1 = require("undici");
|
||||
function getAuthString(token, options) {
|
||||
if (!token && !options.auth) {
|
||||
throw new Error('Parameter token or opts.auth is required');
|
||||
@ -36,6 +50,19 @@ function getProxyAgent(destinationUrl) {
|
||||
return hc.getAgent(destinationUrl);
|
||||
}
|
||||
exports.getProxyAgent = getProxyAgent;
|
||||
function getProxyAgentDispatcher(destinationUrl) {
|
||||
const hc = new httpClient.HttpClient();
|
||||
return hc.getAgentDispatcher(destinationUrl);
|
||||
}
|
||||
exports.getProxyAgentDispatcher = getProxyAgentDispatcher;
|
||||
function getProxyFetch(destinationUrl) {
|
||||
const httpDispatcher = getProxyAgentDispatcher(destinationUrl);
|
||||
const proxyFetch = (url, opts) => __awaiter(this, void 0, void 0, function* () {
|
||||
return (0, undici_1.fetch)(url, Object.assign(Object.assign({}, opts), { dispatcher: httpDispatcher }));
|
||||
});
|
||||
return proxyFetch;
|
||||
}
|
||||
exports.getProxyFetch = getProxyFetch;
|
||||
function getApiBaseUrl() {
|
||||
return process.env['GITHUB_API_URL'] || 'https://api.github.com';
|
||||
}
|
||||
|
2
node_modules/@actions/github/lib/internal/utils.js.map
generated
vendored
2
node_modules/@actions/github/lib/internal/utils.js.map
generated
vendored
@ -1 +1 @@
|
||||
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/internal/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AACA,iEAAkD;AAGlD,SAAgB,aAAa,CAC3B,KAAa,EACb,OAAuB;IAEvB,IAAI,CAAC,KAAK,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE;QAC3B,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAA;KAC5D;SAAM,IAAI,KAAK,IAAI,OAAO,CAAC,IAAI,EAAE;QAChC,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAA;KAC5E;IAED,OAAO,OAAO,OAAO,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,KAAK,EAAE,CAAA;AAC3E,CAAC;AAXD,sCAWC;AAED,SAAgB,aAAa,CAAC,cAAsB;IAClD,MAAM,EAAE,GAAG,IAAI,UAAU,CAAC,UAAU,EAAE,CAAA;IACtC,OAAO,EAAE,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAA;AACpC,CAAC;AAHD,sCAGC;AAED,SAAgB,aAAa;IAC3B,OAAO,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,IAAI,wBAAwB,CAAA;AAClE,CAAC;AAFD,sCAEC"}
|
||||
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/internal/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,iEAAkD;AAElD,mCAAwC;AAExC,SAAgB,aAAa,CAC3B,KAAa,EACb,OAAuB;IAEvB,IAAI,CAAC,KAAK,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE;QAC3B,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAA;KAC5D;SAAM,IAAI,KAAK,IAAI,OAAO,CAAC,IAAI,EAAE;QAChC,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAA;KAC5E;IAED,OAAO,OAAO,OAAO,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,KAAK,EAAE,CAAA;AAC3E,CAAC;AAXD,sCAWC;AAED,SAAgB,aAAa,CAAC,cAAsB;IAClD,MAAM,EAAE,GAAG,IAAI,UAAU,CAAC,UAAU,EAAE,CAAA;IACtC,OAAO,EAAE,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAA;AACpC,CAAC;AAHD,sCAGC;AAED,SAAgB,uBAAuB,CACrC,cAAsB;IAEtB,MAAM,EAAE,GAAG,IAAI,UAAU,CAAC,UAAU,EAAE,CAAA;IACtC,OAAO,EAAE,CAAC,kBAAkB,CAAC,cAAc,CAAC,CAAA;AAC9C,CAAC;AALD,0DAKC;AAED,SAAgB,aAAa,CAAC,cAAc;IAC1C,MAAM,cAAc,GAAG,uBAAuB,CAAC,cAAc,CAAC,CAAA;IAC9D,MAAM,UAAU,GAAiB,CAAO,GAAG,EAAE,IAAI,EAAE,EAAE;QACnD,OAAO,IAAA,cAAK,EAAC,GAAG,kCACX,IAAI,KACP,UAAU,EAAE,cAAc,IAC1B,CAAA;IACJ,CAAC,CAAA,CAAA;IACD,OAAO,UAAU,CAAA;AACnB,CAAC;AATD,sCASC;AAED,SAAgB,aAAa;IAC3B,OAAO,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,IAAI,wBAAwB,CAAA;AAClE,CAAC;AAFD,sCAEC"}
|
10
node_modules/@actions/github/lib/utils.d.ts
generated
vendored
10
node_modules/@actions/github/lib/utils.d.ts
generated
vendored
@ -2,14 +2,8 @@ import * as Context from './context';
|
||||
import { Octokit } from '@octokit/core';
|
||||
import { OctokitOptions } from '@octokit/core/dist-types/types';
|
||||
export declare const context: Context.Context;
|
||||
export declare const GitHub: (new (...args: any[]) => {
|
||||
[x: string]: any;
|
||||
}) & {
|
||||
new (...args: any[]): {
|
||||
[x: string]: any;
|
||||
};
|
||||
plugins: any[];
|
||||
} & typeof Octokit & import("@octokit/core/dist-types/types").Constructor<import("@octokit/plugin-rest-endpoint-methods/dist-types/generated/method-types").RestEndpointMethods & {
|
||||
export declare const defaults: OctokitOptions;
|
||||
export declare const GitHub: typeof Octokit & import("@octokit/core/dist-types/types").Constructor<import("@octokit/plugin-rest-endpoint-methods/dist-types/types").Api & {
|
||||
paginate: import("@octokit/plugin-paginate-rest").PaginateInterface;
|
||||
}>;
|
||||
/**
|
||||
|
17
node_modules/@actions/github/lib/utils.js
generated
vendored
17
node_modules/@actions/github/lib/utils.js
generated
vendored
@ -1,7 +1,11 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
@ -14,12 +18,12 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getOctokitOptions = exports.GitHub = exports.context = void 0;
|
||||
exports.getOctokitOptions = exports.GitHub = exports.defaults = exports.context = void 0;
|
||||
const Context = __importStar(require("./context"));
|
||||
const Utils = __importStar(require("./internal/utils"));
|
||||
// octokit + plugins
|
||||
@ -28,13 +32,14 @@ const plugin_rest_endpoint_methods_1 = require("@octokit/plugin-rest-endpoint-me
|
||||
const plugin_paginate_rest_1 = require("@octokit/plugin-paginate-rest");
|
||||
exports.context = new Context.Context();
|
||||
const baseUrl = Utils.getApiBaseUrl();
|
||||
const defaults = {
|
||||
exports.defaults = {
|
||||
baseUrl,
|
||||
request: {
|
||||
agent: Utils.getProxyAgent(baseUrl)
|
||||
agent: Utils.getProxyAgent(baseUrl),
|
||||
fetch: Utils.getProxyFetch(baseUrl)
|
||||
}
|
||||
};
|
||||
exports.GitHub = core_1.Octokit.plugin(plugin_rest_endpoint_methods_1.restEndpointMethods, plugin_paginate_rest_1.paginateRest).defaults(defaults);
|
||||
exports.GitHub = core_1.Octokit.plugin(plugin_rest_endpoint_methods_1.restEndpointMethods, plugin_paginate_rest_1.paginateRest).defaults(exports.defaults);
|
||||
/**
|
||||
* Convience function to correctly format Octokit Options to pass into the constructor.
|
||||
*
|
||||
|
2
node_modules/@actions/github/lib/utils.js.map
generated
vendored
2
node_modules/@actions/github/lib/utils.js.map
generated
vendored
@ -1 +1 @@
|
||||
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAoC;AACpC,wDAAyC;AAEzC,oBAAoB;AACpB,wCAAqC;AAErC,wFAAyE;AACzE,wEAA0D;AAE7C,QAAA,OAAO,GAAG,IAAI,OAAO,CAAC,OAAO,EAAE,CAAA;AAE5C,MAAM,OAAO,GAAG,KAAK,CAAC,aAAa,EAAE,CAAA;AACrC,MAAM,QAAQ,GAAG;IACf,OAAO;IACP,OAAO,EAAE;QACP,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC;KACpC;CACF,CAAA;AAEY,QAAA,MAAM,GAAG,cAAO,CAAC,MAAM,CAClC,kDAAmB,EACnB,mCAAY,CACb,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;AAEpB;;;;;GAKG;AACH,SAAgB,iBAAiB,CAC/B,KAAa,EACb,OAAwB;IAExB,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,IAAI,EAAE,CAAC,CAAA,CAAC,iEAAiE;IAE/G,OAAO;IACP,MAAM,IAAI,GAAG,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;IAC7C,IAAI,IAAI,EAAE;QACR,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;KACjB;IAED,OAAO,IAAI,CAAA;AACb,CAAC;AAbD,8CAaC"}
|
||||
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAoC;AACpC,wDAAyC;AAEzC,oBAAoB;AACpB,wCAAqC;AAErC,wFAAyE;AACzE,wEAA0D;AAE7C,QAAA,OAAO,GAAG,IAAI,OAAO,CAAC,OAAO,EAAE,CAAA;AAE5C,MAAM,OAAO,GAAG,KAAK,CAAC,aAAa,EAAE,CAAA;AACxB,QAAA,QAAQ,GAAmB;IACtC,OAAO;IACP,OAAO,EAAE;QACP,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC;QACnC,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC;KACpC;CACF,CAAA;AAEY,QAAA,MAAM,GAAG,cAAO,CAAC,MAAM,CAClC,kDAAmB,EACnB,mCAAY,CACb,CAAC,QAAQ,CAAC,gBAAQ,CAAC,CAAA;AAEpB;;;;;GAKG;AACH,SAAgB,iBAAiB,CAC/B,KAAa,EACb,OAAwB;IAExB,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,IAAI,EAAE,CAAC,CAAA,CAAC,iEAAiE;IAE/G,OAAO;IACP,MAAM,IAAI,GAAG,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;IAC7C,IAAI,IAAI,EAAE;QACR,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;KACjB;IAED,OAAO,IAAI,CAAA;AACb,CAAC;AAbD,8CAaC"}
|
19
node_modules/@actions/github/package.json
generated
vendored
19
node_modules/@actions/github/package.json
generated
vendored
@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@actions/github",
|
||||
"version": "4.0.0",
|
||||
"version": "6.0.0",
|
||||
"description": "Actions github lib",
|
||||
"keywords": [
|
||||
"github",
|
||||
"actions"
|
||||
],
|
||||
"homepage": "https://github.com/actions/toolkit/tree/master/packages/github",
|
||||
"homepage": "https://github.com/actions/toolkit/tree/main/packages/github",
|
||||
"license": "MIT",
|
||||
"main": "lib/github.js",
|
||||
"types": "lib/github.d.ts",
|
||||
@ -27,7 +27,7 @@
|
||||
"directory": "packages/github"
|
||||
},
|
||||
"scripts": {
|
||||
"audit-moderate": "npm install && npm audit --audit-level=moderate",
|
||||
"audit-moderate": "npm install && npm audit --json --audit-level=moderate > audit.json",
|
||||
"test": "jest",
|
||||
"build": "tsc",
|
||||
"format": "prettier --write **/*.ts",
|
||||
@ -38,13 +38,12 @@
|
||||
"url": "https://github.com/actions/toolkit/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"@actions/http-client": "^1.0.8",
|
||||
"@octokit/core": "^3.0.0",
|
||||
"@octokit/plugin-paginate-rest": "^2.2.3",
|
||||
"@octokit/plugin-rest-endpoint-methods": "^4.0.0"
|
||||
"@actions/http-client": "^2.2.0",
|
||||
"@octokit/core": "^5.0.1",
|
||||
"@octokit/plugin-paginate-rest": "^9.0.0",
|
||||
"@octokit/plugin-rest-endpoint-methods": "^10.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"jest": "^25.1.0",
|
||||
"proxy": "^1.0.1"
|
||||
"proxy": "^2.1.1"
|
||||
}
|
||||
}
|
||||
}
|
32
node_modules/@actions/http-client/README.md
generated
vendored
32
node_modules/@actions/http-client/README.md
generated
vendored
@ -1,18 +1,11 @@
|
||||
# `@actions/http-client`
|
||||
|
||||
<p align="center">
|
||||
<img src="actions.png">
|
||||
</p>
|
||||
|
||||
# Actions Http-Client
|
||||
|
||||
[![Http Status](https://github.com/actions/http-client/workflows/http-tests/badge.svg)](https://github.com/actions/http-client/actions)
|
||||
|
||||
A lightweight HTTP client optimized for use with actions, TypeScript with generics and async await.
|
||||
A lightweight HTTP client optimized for building actions.
|
||||
|
||||
## Features
|
||||
|
||||
- HTTP client with TypeScript generics and async/await/Promises
|
||||
- Typings included so no need to acquire separately (great for intellisense and no versioning drift)
|
||||
- Typings included!
|
||||
- [Proxy support](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/about-self-hosted-runners#using-a-proxy-server-with-self-hosted-runners) just works with actions and the runner
|
||||
- Targets ES2019 (runner runs actions with node 12+). Only supported on node 12+.
|
||||
- Basic, Bearer and PAT Support out of the box. Extensible handlers for others.
|
||||
@ -28,7 +21,7 @@ npm install @actions/http-client --save
|
||||
|
||||
## Samples
|
||||
|
||||
See the [HTTP](./__tests__) tests for detailed examples.
|
||||
See the [tests](./__tests__) for detailed examples.
|
||||
|
||||
## Errors
|
||||
|
||||
@ -39,13 +32,13 @@ The HTTP client does not throw unless truly exceptional.
|
||||
* A request that successfully executes resulting in a 404, 500 etc... will return a response object with a status code and a body.
|
||||
* Redirects (3xx) will be followed by default.
|
||||
|
||||
See [HTTP tests](./__tests__) for detailed examples.
|
||||
See the [tests](./__tests__) for detailed examples.
|
||||
|
||||
## Debugging
|
||||
|
||||
To enable detailed console logging of all HTTP requests and responses, set the NODE_DEBUG environment varible:
|
||||
|
||||
```
|
||||
```shell
|
||||
export NODE_DEBUG=http
|
||||
```
|
||||
|
||||
@ -63,17 +56,18 @@ We welcome PRs. Please create an issue and if applicable, a design before proce
|
||||
|
||||
once:
|
||||
|
||||
```bash
|
||||
$ npm install
|
||||
```
|
||||
npm install
|
||||
```
|
||||
|
||||
To build:
|
||||
|
||||
```bash
|
||||
$ npm run build
|
||||
```
|
||||
npm run build
|
||||
```
|
||||
|
||||
To run all tests:
|
||||
```bash
|
||||
$ npm test
|
||||
|
||||
```
|
||||
npm test
|
||||
```
|
||||
|
16
node_modules/@actions/http-client/RELEASES.md
generated
vendored
16
node_modules/@actions/http-client/RELEASES.md
generated
vendored
@ -1,16 +0,0 @@
|
||||
## Releases
|
||||
|
||||
## 1.0.7
|
||||
Update NPM dependencies and add 429 to the list of HttpCodes
|
||||
|
||||
## 1.0.6
|
||||
Automatically sends Content-Type and Accept application/json headers for \<verb>Json() helper methods if not set in the client or parameters.
|
||||
|
||||
## 1.0.5
|
||||
Adds \<verb>Json() helper methods for json over http scenarios.
|
||||
|
||||
## 1.0.4
|
||||
Started to add \<verb>Json() helper methods. Do not use this release for that. Use >= 1.0.5 since there was an issue with types.
|
||||
|
||||
## 1.0.1 to 1.0.3
|
||||
Adds proxy support.
|
BIN
node_modules/@actions/http-client/actions.png
generated
vendored
BIN
node_modules/@actions/http-client/actions.png
generated
vendored
Binary file not shown.
Before Width: | Height: | Size: 33 KiB |
23
node_modules/@actions/http-client/auth.d.ts
generated
vendored
23
node_modules/@actions/http-client/auth.d.ts
generated
vendored
@ -1,23 +0,0 @@
|
||||
import ifm = require('./interfaces');
|
||||
export declare class BasicCredentialHandler implements ifm.IRequestHandler {
|
||||
username: string;
|
||||
password: string;
|
||||
constructor(username: string, password: string);
|
||||
prepareRequest(options: any): void;
|
||||
canHandleAuthentication(response: ifm.IHttpClientResponse): boolean;
|
||||
handleAuthentication(httpClient: ifm.IHttpClient, requestInfo: ifm.IRequestInfo, objs: any): Promise<ifm.IHttpClientResponse>;
|
||||
}
|
||||
export declare class BearerCredentialHandler implements ifm.IRequestHandler {
|
||||
token: string;
|
||||
constructor(token: string);
|
||||
prepareRequest(options: any): void;
|
||||
canHandleAuthentication(response: ifm.IHttpClientResponse): boolean;
|
||||
handleAuthentication(httpClient: ifm.IHttpClient, requestInfo: ifm.IRequestInfo, objs: any): Promise<ifm.IHttpClientResponse>;
|
||||
}
|
||||
export declare class PersonalAccessTokenCredentialHandler implements ifm.IRequestHandler {
|
||||
token: string;
|
||||
constructor(token: string);
|
||||
prepareRequest(options: any): void;
|
||||
canHandleAuthentication(response: ifm.IHttpClientResponse): boolean;
|
||||
handleAuthentication(httpClient: ifm.IHttpClient, requestInfo: ifm.IRequestInfo, objs: any): Promise<ifm.IHttpClientResponse>;
|
||||
}
|
58
node_modules/@actions/http-client/auth.js
generated
vendored
58
node_modules/@actions/http-client/auth.js
generated
vendored
@ -1,58 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
class BasicCredentialHandler {
|
||||
constructor(username, password) {
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
}
|
||||
prepareRequest(options) {
|
||||
options.headers['Authorization'] =
|
||||
'Basic ' +
|
||||
Buffer.from(this.username + ':' + this.password).toString('base64');
|
||||
}
|
||||
// This handler cannot handle 401
|
||||
canHandleAuthentication(response) {
|
||||
return false;
|
||||
}
|
||||
handleAuthentication(httpClient, requestInfo, objs) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
exports.BasicCredentialHandler = BasicCredentialHandler;
|
||||
class BearerCredentialHandler {
|
||||
constructor(token) {
|
||||
this.token = token;
|
||||
}
|
||||
// currently implements pre-authorization
|
||||
// TODO: support preAuth = false where it hooks on 401
|
||||
prepareRequest(options) {
|
||||
options.headers['Authorization'] = 'Bearer ' + this.token;
|
||||
}
|
||||
// This handler cannot handle 401
|
||||
canHandleAuthentication(response) {
|
||||
return false;
|
||||
}
|
||||
handleAuthentication(httpClient, requestInfo, objs) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
exports.BearerCredentialHandler = BearerCredentialHandler;
|
||||
class PersonalAccessTokenCredentialHandler {
|
||||
constructor(token) {
|
||||
this.token = token;
|
||||
}
|
||||
// currently implements pre-authorization
|
||||
// TODO: support preAuth = false where it hooks on 401
|
||||
prepareRequest(options) {
|
||||
options.headers['Authorization'] =
|
||||
'Basic ' + Buffer.from('PAT:' + this.token).toString('base64');
|
||||
}
|
||||
// This handler cannot handle 401
|
||||
canHandleAuthentication(response) {
|
||||
return false;
|
||||
}
|
||||
handleAuthentication(httpClient, requestInfo, objs) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
exports.PersonalAccessTokenCredentialHandler = PersonalAccessTokenCredentialHandler;
|
119
node_modules/@actions/http-client/index.d.ts
generated
vendored
119
node_modules/@actions/http-client/index.d.ts
generated
vendored
@ -1,119 +0,0 @@
|
||||
/// <reference types="node" />
|
||||
import http = require('http');
|
||||
import ifm = require('./interfaces');
|
||||
export declare enum HttpCodes {
|
||||
OK = 200,
|
||||
MultipleChoices = 300,
|
||||
MovedPermanently = 301,
|
||||
ResourceMoved = 302,
|
||||
SeeOther = 303,
|
||||
NotModified = 304,
|
||||
UseProxy = 305,
|
||||
SwitchProxy = 306,
|
||||
TemporaryRedirect = 307,
|
||||
PermanentRedirect = 308,
|
||||
BadRequest = 400,
|
||||
Unauthorized = 401,
|
||||
PaymentRequired = 402,
|
||||
Forbidden = 403,
|
||||
NotFound = 404,
|
||||
MethodNotAllowed = 405,
|
||||
NotAcceptable = 406,
|
||||
ProxyAuthenticationRequired = 407,
|
||||
RequestTimeout = 408,
|
||||
Conflict = 409,
|
||||
Gone = 410,
|
||||
TooManyRequests = 429,
|
||||
InternalServerError = 500,
|
||||
NotImplemented = 501,
|
||||
BadGateway = 502,
|
||||
ServiceUnavailable = 503,
|
||||
GatewayTimeout = 504
|
||||
}
|
||||
export declare enum Headers {
|
||||
Accept = "accept",
|
||||
ContentType = "content-type"
|
||||
}
|
||||
export declare enum MediaTypes {
|
||||
ApplicationJson = "application/json"
|
||||
}
|
||||
/**
|
||||
* Returns the proxy URL, depending upon the supplied url and proxy environment variables.
|
||||
* @param serverUrl The server URL where the request will be sent. For example, https://api.github.com
|
||||
*/
|
||||
export declare function getProxyUrl(serverUrl: string): string;
|
||||
export declare class HttpClientResponse implements ifm.IHttpClientResponse {
|
||||
constructor(message: http.IncomingMessage);
|
||||
message: http.IncomingMessage;
|
||||
readBody(): Promise<string>;
|
||||
}
|
||||
export declare function isHttps(requestUrl: string): boolean;
|
||||
export declare class HttpClient {
|
||||
userAgent: string | undefined;
|
||||
handlers: ifm.IRequestHandler[];
|
||||
requestOptions: ifm.IRequestOptions;
|
||||
private _ignoreSslError;
|
||||
private _socketTimeout;
|
||||
private _allowRedirects;
|
||||
private _allowRedirectDowngrade;
|
||||
private _maxRedirects;
|
||||
private _allowRetries;
|
||||
private _maxRetries;
|
||||
private _agent;
|
||||
private _proxyAgent;
|
||||
private _keepAlive;
|
||||
private _disposed;
|
||||
constructor(userAgent?: string, handlers?: ifm.IRequestHandler[], requestOptions?: ifm.IRequestOptions);
|
||||
options(requestUrl: string, additionalHeaders?: ifm.IHeaders): Promise<ifm.IHttpClientResponse>;
|
||||
get(requestUrl: string, additionalHeaders?: ifm.IHeaders): Promise<ifm.IHttpClientResponse>;
|
||||
del(requestUrl: string, additionalHeaders?: ifm.IHeaders): Promise<ifm.IHttpClientResponse>;
|
||||
post(requestUrl: string, data: string, additionalHeaders?: ifm.IHeaders): Promise<ifm.IHttpClientResponse>;
|
||||
patch(requestUrl: string, data: string, additionalHeaders?: ifm.IHeaders): Promise<ifm.IHttpClientResponse>;
|
||||
put(requestUrl: string, data: string, additionalHeaders?: ifm.IHeaders): Promise<ifm.IHttpClientResponse>;
|
||||
head(requestUrl: string, additionalHeaders?: ifm.IHeaders): Promise<ifm.IHttpClientResponse>;
|
||||
sendStream(verb: string, requestUrl: string, stream: NodeJS.ReadableStream, additionalHeaders?: ifm.IHeaders): Promise<ifm.IHttpClientResponse>;
|
||||
/**
|
||||
* Gets a typed object from an endpoint
|
||||
* Be aware that not found returns a null. Other errors (4xx, 5xx) reject the promise
|
||||
*/
|
||||
getJson<T>(requestUrl: string, additionalHeaders?: ifm.IHeaders): Promise<ifm.ITypedResponse<T>>;
|
||||
postJson<T>(requestUrl: string, obj: any, additionalHeaders?: ifm.IHeaders): Promise<ifm.ITypedResponse<T>>;
|
||||
putJson<T>(requestUrl: string, obj: any, additionalHeaders?: ifm.IHeaders): Promise<ifm.ITypedResponse<T>>;
|
||||
patchJson<T>(requestUrl: string, obj: any, additionalHeaders?: ifm.IHeaders): Promise<ifm.ITypedResponse<T>>;
|
||||
/**
|
||||
* Makes a raw http request.
|
||||
* All other methods such as get, post, patch, and request ultimately call this.
|
||||
* Prefer get, del, post and patch
|
||||
*/
|
||||
request(verb: string, requestUrl: string, data: string | NodeJS.ReadableStream, headers: ifm.IHeaders): Promise<ifm.IHttpClientResponse>;
|
||||
/**
|
||||
* Needs to be called if keepAlive is set to true in request options.
|
||||
*/
|
||||
dispose(): void;
|
||||
/**
|
||||
* Raw request.
|
||||
* @param info
|
||||
* @param data
|
||||
*/
|
||||
requestRaw(info: ifm.IRequestInfo, data: string | NodeJS.ReadableStream): Promise<ifm.IHttpClientResponse>;
|
||||
/**
|
||||
* Raw request with callback.
|
||||
* @param info
|
||||
* @param data
|
||||
* @param onResult
|
||||
*/
|
||||
requestRawWithCallback(info: ifm.IRequestInfo, data: string | NodeJS.ReadableStream, onResult: (err: any, res: ifm.IHttpClientResponse) => void): void;
|
||||
/**
|
||||
* Gets an http agent. This function is useful when you need an http agent that handles
|
||||
* routing through a proxy server - depending upon the url and proxy environment variables.
|
||||
* @param serverUrl The server URL where the request will be sent. For example, https://api.github.com
|
||||
*/
|
||||
getAgent(serverUrl: string): http.Agent;
|
||||
private _prepareRequest;
|
||||
private _mergeHeaders;
|
||||
private _getExistingOrDefaultHeader;
|
||||
private _getAgent;
|
||||
private _performExponentialBackoff;
|
||||
private static dateTimeDeserializer;
|
||||
private _processResponse;
|
||||
}
|
531
node_modules/@actions/http-client/index.js
generated
vendored
531
node_modules/@actions/http-client/index.js
generated
vendored
@ -1,531 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const url = require("url");
|
||||
const http = require("http");
|
||||
const https = require("https");
|
||||
const pm = require("./proxy");
|
||||
let tunnel;
|
||||
var HttpCodes;
|
||||
(function (HttpCodes) {
|
||||
HttpCodes[HttpCodes["OK"] = 200] = "OK";
|
||||
HttpCodes[HttpCodes["MultipleChoices"] = 300] = "MultipleChoices";
|
||||
HttpCodes[HttpCodes["MovedPermanently"] = 301] = "MovedPermanently";
|
||||
HttpCodes[HttpCodes["ResourceMoved"] = 302] = "ResourceMoved";
|
||||
HttpCodes[HttpCodes["SeeOther"] = 303] = "SeeOther";
|
||||
HttpCodes[HttpCodes["NotModified"] = 304] = "NotModified";
|
||||
HttpCodes[HttpCodes["UseProxy"] = 305] = "UseProxy";
|
||||
HttpCodes[HttpCodes["SwitchProxy"] = 306] = "SwitchProxy";
|
||||
HttpCodes[HttpCodes["TemporaryRedirect"] = 307] = "TemporaryRedirect";
|
||||
HttpCodes[HttpCodes["PermanentRedirect"] = 308] = "PermanentRedirect";
|
||||
HttpCodes[HttpCodes["BadRequest"] = 400] = "BadRequest";
|
||||
HttpCodes[HttpCodes["Unauthorized"] = 401] = "Unauthorized";
|
||||
HttpCodes[HttpCodes["PaymentRequired"] = 402] = "PaymentRequired";
|
||||
HttpCodes[HttpCodes["Forbidden"] = 403] = "Forbidden";
|
||||
HttpCodes[HttpCodes["NotFound"] = 404] = "NotFound";
|
||||
HttpCodes[HttpCodes["MethodNotAllowed"] = 405] = "MethodNotAllowed";
|
||||
HttpCodes[HttpCodes["NotAcceptable"] = 406] = "NotAcceptable";
|
||||
HttpCodes[HttpCodes["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired";
|
||||
HttpCodes[HttpCodes["RequestTimeout"] = 408] = "RequestTimeout";
|
||||
HttpCodes[HttpCodes["Conflict"] = 409] = "Conflict";
|
||||
HttpCodes[HttpCodes["Gone"] = 410] = "Gone";
|
||||
HttpCodes[HttpCodes["TooManyRequests"] = 429] = "TooManyRequests";
|
||||
HttpCodes[HttpCodes["InternalServerError"] = 500] = "InternalServerError";
|
||||
HttpCodes[HttpCodes["NotImplemented"] = 501] = "NotImplemented";
|
||||
HttpCodes[HttpCodes["BadGateway"] = 502] = "BadGateway";
|
||||
HttpCodes[HttpCodes["ServiceUnavailable"] = 503] = "ServiceUnavailable";
|
||||
HttpCodes[HttpCodes["GatewayTimeout"] = 504] = "GatewayTimeout";
|
||||
})(HttpCodes = exports.HttpCodes || (exports.HttpCodes = {}));
|
||||
var Headers;
|
||||
(function (Headers) {
|
||||
Headers["Accept"] = "accept";
|
||||
Headers["ContentType"] = "content-type";
|
||||
})(Headers = exports.Headers || (exports.Headers = {}));
|
||||
var MediaTypes;
|
||||
(function (MediaTypes) {
|
||||
MediaTypes["ApplicationJson"] = "application/json";
|
||||
})(MediaTypes = exports.MediaTypes || (exports.MediaTypes = {}));
|
||||
/**
|
||||
* Returns the proxy URL, depending upon the supplied url and proxy environment variables.
|
||||
* @param serverUrl The server URL where the request will be sent. For example, https://api.github.com
|
||||
*/
|
||||
function getProxyUrl(serverUrl) {
|
||||
let proxyUrl = pm.getProxyUrl(url.parse(serverUrl));
|
||||
return proxyUrl ? proxyUrl.href : '';
|
||||
}
|
||||
exports.getProxyUrl = getProxyUrl;
|
||||
const HttpRedirectCodes = [
|
||||
HttpCodes.MovedPermanently,
|
||||
HttpCodes.ResourceMoved,
|
||||
HttpCodes.SeeOther,
|
||||
HttpCodes.TemporaryRedirect,
|
||||
HttpCodes.PermanentRedirect
|
||||
];
|
||||
const HttpResponseRetryCodes = [
|
||||
HttpCodes.BadGateway,
|
||||
HttpCodes.ServiceUnavailable,
|
||||
HttpCodes.GatewayTimeout
|
||||
];
|
||||
const RetryableHttpVerbs = ['OPTIONS', 'GET', 'DELETE', 'HEAD'];
|
||||
const ExponentialBackoffCeiling = 10;
|
||||
const ExponentialBackoffTimeSlice = 5;
|
||||
class HttpClientResponse {
|
||||
constructor(message) {
|
||||
this.message = message;
|
||||
}
|
||||
readBody() {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
let output = Buffer.alloc(0);
|
||||
this.message.on('data', (chunk) => {
|
||||
output = Buffer.concat([output, chunk]);
|
||||
});
|
||||
this.message.on('end', () => {
|
||||
resolve(output.toString());
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.HttpClientResponse = HttpClientResponse;
|
||||
function isHttps(requestUrl) {
|
||||
let parsedUrl = url.parse(requestUrl);
|
||||
return parsedUrl.protocol === 'https:';
|
||||
}
|
||||
exports.isHttps = isHttps;
|
||||
class HttpClient {
|
||||
constructor(userAgent, handlers, requestOptions) {
|
||||
this._ignoreSslError = false;
|
||||
this._allowRedirects = true;
|
||||
this._allowRedirectDowngrade = false;
|
||||
this._maxRedirects = 50;
|
||||
this._allowRetries = false;
|
||||
this._maxRetries = 1;
|
||||
this._keepAlive = false;
|
||||
this._disposed = false;
|
||||
this.userAgent = userAgent;
|
||||
this.handlers = handlers || [];
|
||||
this.requestOptions = requestOptions;
|
||||
if (requestOptions) {
|
||||
if (requestOptions.ignoreSslError != null) {
|
||||
this._ignoreSslError = requestOptions.ignoreSslError;
|
||||
}
|
||||
this._socketTimeout = requestOptions.socketTimeout;
|
||||
if (requestOptions.allowRedirects != null) {
|
||||
this._allowRedirects = requestOptions.allowRedirects;
|
||||
}
|
||||
if (requestOptions.allowRedirectDowngrade != null) {
|
||||
this._allowRedirectDowngrade = requestOptions.allowRedirectDowngrade;
|
||||
}
|
||||
if (requestOptions.maxRedirects != null) {
|
||||
this._maxRedirects = Math.max(requestOptions.maxRedirects, 0);
|
||||
}
|
||||
if (requestOptions.keepAlive != null) {
|
||||
this._keepAlive = requestOptions.keepAlive;
|
||||
}
|
||||
if (requestOptions.allowRetries != null) {
|
||||
this._allowRetries = requestOptions.allowRetries;
|
||||
}
|
||||
if (requestOptions.maxRetries != null) {
|
||||
this._maxRetries = requestOptions.maxRetries;
|
||||
}
|
||||
}
|
||||
}
|
||||
options(requestUrl, additionalHeaders) {
|
||||
return this.request('OPTIONS', requestUrl, null, additionalHeaders || {});
|
||||
}
|
||||
get(requestUrl, additionalHeaders) {
|
||||
return this.request('GET', requestUrl, null, additionalHeaders || {});
|
||||
}
|
||||
del(requestUrl, additionalHeaders) {
|
||||
return this.request('DELETE', requestUrl, null, additionalHeaders || {});
|
||||
}
|
||||
post(requestUrl, data, additionalHeaders) {
|
||||
return this.request('POST', requestUrl, data, additionalHeaders || {});
|
||||
}
|
||||
patch(requestUrl, data, additionalHeaders) {
|
||||
return this.request('PATCH', requestUrl, data, additionalHeaders || {});
|
||||
}
|
||||
put(requestUrl, data, additionalHeaders) {
|
||||
return this.request('PUT', requestUrl, data, additionalHeaders || {});
|
||||
}
|
||||
head(requestUrl, additionalHeaders) {
|
||||
return this.request('HEAD', requestUrl, null, additionalHeaders || {});
|
||||
}
|
||||
sendStream(verb, requestUrl, stream, additionalHeaders) {
|
||||
return this.request(verb, requestUrl, stream, additionalHeaders);
|
||||
}
|
||||
/**
|
||||
* Gets a typed object from an endpoint
|
||||
* Be aware that not found returns a null. Other errors (4xx, 5xx) reject the promise
|
||||
*/
|
||||
async getJson(requestUrl, additionalHeaders = {}) {
|
||||
additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
|
||||
let res = await this.get(requestUrl, additionalHeaders);
|
||||
return this._processResponse(res, this.requestOptions);
|
||||
}
|
||||
async postJson(requestUrl, obj, additionalHeaders = {}) {
|
||||
let data = JSON.stringify(obj, null, 2);
|
||||
additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
|
||||
additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson);
|
||||
let res = await this.post(requestUrl, data, additionalHeaders);
|
||||
return this._processResponse(res, this.requestOptions);
|
||||
}
|
||||
async putJson(requestUrl, obj, additionalHeaders = {}) {
|
||||
let data = JSON.stringify(obj, null, 2);
|
||||
additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
|
||||
additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson);
|
||||
let res = await this.put(requestUrl, data, additionalHeaders);
|
||||
return this._processResponse(res, this.requestOptions);
|
||||
}
|
||||
async patchJson(requestUrl, obj, additionalHeaders = {}) {
|
||||
let data = JSON.stringify(obj, null, 2);
|
||||
additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
|
||||
additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson);
|
||||
let res = await this.patch(requestUrl, data, additionalHeaders);
|
||||
return this._processResponse(res, this.requestOptions);
|
||||
}
|
||||
/**
|
||||
* Makes a raw http request.
|
||||
* All other methods such as get, post, patch, and request ultimately call this.
|
||||
* Prefer get, del, post and patch
|
||||
*/
|
||||
async request(verb, requestUrl, data, headers) {
|
||||
if (this._disposed) {
|
||||
throw new Error('Client has already been disposed.');
|
||||
}
|
||||
let parsedUrl = url.parse(requestUrl);
|
||||
let info = this._prepareRequest(verb, parsedUrl, headers);
|
||||
// Only perform retries on reads since writes may not be idempotent.
|
||||
let maxTries = this._allowRetries && RetryableHttpVerbs.indexOf(verb) != -1
|
||||
? this._maxRetries + 1
|
||||
: 1;
|
||||
let numTries = 0;
|
||||
let response;
|
||||
while (numTries < maxTries) {
|
||||
response = await this.requestRaw(info, data);
|
||||
// Check if it's an authentication challenge
|
||||
if (response &&
|
||||
response.message &&
|
||||
response.message.statusCode === HttpCodes.Unauthorized) {
|
||||
let authenticationHandler;
|
||||
for (let i = 0; i < this.handlers.length; i++) {
|
||||
if (this.handlers[i].canHandleAuthentication(response)) {
|
||||
authenticationHandler = this.handlers[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (authenticationHandler) {
|
||||
return authenticationHandler.handleAuthentication(this, info, data);
|
||||
}
|
||||
else {
|
||||
// We have received an unauthorized response but have no handlers to handle it.
|
||||
// Let the response return to the caller.
|
||||
return response;
|
||||
}
|
||||
}
|
||||
let redirectsRemaining = this._maxRedirects;
|
||||
while (HttpRedirectCodes.indexOf(response.message.statusCode) != -1 &&
|
||||
this._allowRedirects &&
|
||||
redirectsRemaining > 0) {
|
||||
const redirectUrl = response.message.headers['location'];
|
||||
if (!redirectUrl) {
|
||||
// if there's no location to redirect to, we won't
|
||||
break;
|
||||
}
|
||||
let parsedRedirectUrl = url.parse(redirectUrl);
|
||||
if (parsedUrl.protocol == 'https:' &&
|
||||
parsedUrl.protocol != parsedRedirectUrl.protocol &&
|
||||
!this._allowRedirectDowngrade) {
|
||||
throw new Error('Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.');
|
||||
}
|
||||
// we need to finish reading the response before reassigning response
|
||||
// which will leak the open socket.
|
||||
await response.readBody();
|
||||
// strip authorization header if redirected to a different hostname
|
||||
if (parsedRedirectUrl.hostname !== parsedUrl.hostname) {
|
||||
for (let header in headers) {
|
||||
// header names are case insensitive
|
||||
if (header.toLowerCase() === 'authorization') {
|
||||
delete headers[header];
|
||||
}
|
||||
}
|
||||
}
|
||||
// let's make the request with the new redirectUrl
|
||||
info = this._prepareRequest(verb, parsedRedirectUrl, headers);
|
||||
response = await this.requestRaw(info, data);
|
||||
redirectsRemaining--;
|
||||
}
|
||||
if (HttpResponseRetryCodes.indexOf(response.message.statusCode) == -1) {
|
||||
// If not a retry code, return immediately instead of retrying
|
||||
return response;
|
||||
}
|
||||
numTries += 1;
|
||||
if (numTries < maxTries) {
|
||||
await response.readBody();
|
||||
await this._performExponentialBackoff(numTries);
|
||||
}
|
||||
}
|
||||
return response;
|
||||
}
|
||||
/**
|
||||
* Needs to be called if keepAlive is set to true in request options.
|
||||
*/
|
||||
dispose() {
|
||||
if (this._agent) {
|
||||
this._agent.destroy();
|
||||
}
|
||||
this._disposed = true;
|
||||
}
|
||||
/**
|
||||
* Raw request.
|
||||
* @param info
|
||||
* @param data
|
||||
*/
|
||||
requestRaw(info, data) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let callbackForResult = function (err, res) {
|
||||
if (err) {
|
||||
reject(err);
|
||||
}
|
||||
resolve(res);
|
||||
};
|
||||
this.requestRawWithCallback(info, data, callbackForResult);
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Raw request with callback.
|
||||
* @param info
|
||||
* @param data
|
||||
* @param onResult
|
||||
*/
|
||||
requestRawWithCallback(info, data, onResult) {
|
||||
let socket;
|
||||
if (typeof data === 'string') {
|
||||
info.options.headers['Content-Length'] = Buffer.byteLength(data, 'utf8');
|
||||
}
|
||||
let callbackCalled = false;
|
||||
let handleResult = (err, res) => {
|
||||
if (!callbackCalled) {
|
||||
callbackCalled = true;
|
||||
onResult(err, res);
|
||||
}
|
||||
};
|
||||
let req = info.httpModule.request(info.options, (msg) => {
|
||||
let res = new HttpClientResponse(msg);
|
||||
handleResult(null, res);
|
||||
});
|
||||
req.on('socket', sock => {
|
||||
socket = sock;
|
||||
});
|
||||
// If we ever get disconnected, we want the socket to timeout eventually
|
||||
req.setTimeout(this._socketTimeout || 3 * 60000, () => {
|
||||
if (socket) {
|
||||
socket.end();
|
||||
}
|
||||
handleResult(new Error('Request timeout: ' + info.options.path), null);
|
||||
});
|
||||
req.on('error', function (err) {
|
||||
// err has statusCode property
|
||||
// res should have headers
|
||||
handleResult(err, null);
|
||||
});
|
||||
if (data && typeof data === 'string') {
|
||||
req.write(data, 'utf8');
|
||||
}
|
||||
if (data && typeof data !== 'string') {
|
||||
data.on('close', function () {
|
||||
req.end();
|
||||
});
|
||||
data.pipe(req);
|
||||
}
|
||||
else {
|
||||
req.end();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Gets an http agent. This function is useful when you need an http agent that handles
|
||||
* routing through a proxy server - depending upon the url and proxy environment variables.
|
||||
* @param serverUrl The server URL where the request will be sent. For example, https://api.github.com
|
||||
*/
|
||||
getAgent(serverUrl) {
|
||||
let parsedUrl = url.parse(serverUrl);
|
||||
return this._getAgent(parsedUrl);
|
||||
}
|
||||
_prepareRequest(method, requestUrl, headers) {
|
||||
const info = {};
|
||||
info.parsedUrl = requestUrl;
|
||||
const usingSsl = info.parsedUrl.protocol === 'https:';
|
||||
info.httpModule = usingSsl ? https : http;
|
||||
const defaultPort = usingSsl ? 443 : 80;
|
||||
info.options = {};
|
||||
info.options.host = info.parsedUrl.hostname;
|
||||
info.options.port = info.parsedUrl.port
|
||||
? parseInt(info.parsedUrl.port)
|
||||
: defaultPort;
|
||||
info.options.path =
|
||||
(info.parsedUrl.pathname || '') + (info.parsedUrl.search || '');
|
||||
info.options.method = method;
|
||||
info.options.headers = this._mergeHeaders(headers);
|
||||
if (this.userAgent != null) {
|
||||
info.options.headers['user-agent'] = this.userAgent;
|
||||
}
|
||||
info.options.agent = this._getAgent(info.parsedUrl);
|
||||
// gives handlers an opportunity to participate
|
||||
if (this.handlers) {
|
||||
this.handlers.forEach(handler => {
|
||||
handler.prepareRequest(info.options);
|
||||
});
|
||||
}
|
||||
return info;
|
||||
}
|
||||
_mergeHeaders(headers) {
|
||||
const lowercaseKeys = obj => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCase()] = obj[k]), c), {});
|
||||
if (this.requestOptions && this.requestOptions.headers) {
|
||||
return Object.assign({}, lowercaseKeys(this.requestOptions.headers), lowercaseKeys(headers));
|
||||
}
|
||||
return lowercaseKeys(headers || {});
|
||||
}
|
||||
_getExistingOrDefaultHeader(additionalHeaders, header, _default) {
|
||||
const lowercaseKeys = obj => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCase()] = obj[k]), c), {});
|
||||
let clientHeader;
|
||||
if (this.requestOptions && this.requestOptions.headers) {
|
||||
clientHeader = lowercaseKeys(this.requestOptions.headers)[header];
|
||||
}
|
||||
return additionalHeaders[header] || clientHeader || _default;
|
||||
}
|
||||
_getAgent(parsedUrl) {
|
||||
let agent;
|
||||
let proxyUrl = pm.getProxyUrl(parsedUrl);
|
||||
let useProxy = proxyUrl && proxyUrl.hostname;
|
||||
if (this._keepAlive && useProxy) {
|
||||
agent = this._proxyAgent;
|
||||
}
|
||||
if (this._keepAlive && !useProxy) {
|
||||
agent = this._agent;
|
||||
}
|
||||
// if agent is already assigned use that agent.
|
||||
if (!!agent) {
|
||||
return agent;
|
||||
}
|
||||
const usingSsl = parsedUrl.protocol === 'https:';
|
||||
let maxSockets = 100;
|
||||
if (!!this.requestOptions) {
|
||||
maxSockets = this.requestOptions.maxSockets || http.globalAgent.maxSockets;
|
||||
}
|
||||
if (useProxy) {
|
||||
// If using proxy, need tunnel
|
||||
if (!tunnel) {
|
||||
tunnel = require('tunnel');
|
||||
}
|
||||
const agentOptions = {
|
||||
maxSockets: maxSockets,
|
||||
keepAlive: this._keepAlive,
|
||||
proxy: {
|
||||
proxyAuth: proxyUrl.auth,
|
||||
host: proxyUrl.hostname,
|
||||
port: proxyUrl.port
|
||||
}
|
||||
};
|
||||
let tunnelAgent;
|
||||
const overHttps = proxyUrl.protocol === 'https:';
|
||||
if (usingSsl) {
|
||||
tunnelAgent = overHttps ? tunnel.httpsOverHttps : tunnel.httpsOverHttp;
|
||||
}
|
||||
else {
|
||||
tunnelAgent = overHttps ? tunnel.httpOverHttps : tunnel.httpOverHttp;
|
||||
}
|
||||
agent = tunnelAgent(agentOptions);
|
||||
this._proxyAgent = agent;
|
||||
}
|
||||
// if reusing agent across request and tunneling agent isn't assigned create a new agent
|
||||
if (this._keepAlive && !agent) {
|
||||
const options = { keepAlive: this._keepAlive, maxSockets: maxSockets };
|
||||
agent = usingSsl ? new https.Agent(options) : new http.Agent(options);
|
||||
this._agent = agent;
|
||||
}
|
||||
// if not using private agent and tunnel agent isn't setup then use global agent
|
||||
if (!agent) {
|
||||
agent = usingSsl ? https.globalAgent : http.globalAgent;
|
||||
}
|
||||
if (usingSsl && this._ignoreSslError) {
|
||||
// we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process
|
||||
// http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options
|
||||
// we have to cast it to any and change it directly
|
||||
agent.options = Object.assign(agent.options || {}, {
|
||||
rejectUnauthorized: false
|
||||
});
|
||||
}
|
||||
return agent;
|
||||
}
|
||||
_performExponentialBackoff(retryNumber) {
|
||||
retryNumber = Math.min(ExponentialBackoffCeiling, retryNumber);
|
||||
const ms = ExponentialBackoffTimeSlice * Math.pow(2, retryNumber);
|
||||
return new Promise(resolve => setTimeout(() => resolve(), ms));
|
||||
}
|
||||
static dateTimeDeserializer(key, value) {
|
||||
if (typeof value === 'string') {
|
||||
let a = new Date(value);
|
||||
if (!isNaN(a.valueOf())) {
|
||||
return a;
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
async _processResponse(res, options) {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
const statusCode = res.message.statusCode;
|
||||
const response = {
|
||||
statusCode: statusCode,
|
||||
result: null,
|
||||
headers: {}
|
||||
};
|
||||
// not found leads to null obj returned
|
||||
if (statusCode == HttpCodes.NotFound) {
|
||||
resolve(response);
|
||||
}
|
||||
let obj;
|
||||
let contents;
|
||||
// get the result from the body
|
||||
try {
|
||||
contents = await res.readBody();
|
||||
if (contents && contents.length > 0) {
|
||||
if (options && options.deserializeDates) {
|
||||
obj = JSON.parse(contents, HttpClient.dateTimeDeserializer);
|
||||
}
|
||||
else {
|
||||
obj = JSON.parse(contents);
|
||||
}
|
||||
response.result = obj;
|
||||
}
|
||||
response.headers = res.message.headers;
|
||||
}
|
||||
catch (err) {
|
||||
// Invalid resource (contents not json); leaving result obj null
|
||||
}
|
||||
// note that 3xx redirects are handled by the http layer.
|
||||
if (statusCode > 299) {
|
||||
let msg;
|
||||
// if exception/error in body, attempt to get better error
|
||||
if (obj && obj.message) {
|
||||
msg = obj.message;
|
||||
}
|
||||
else if (contents && contents.length > 0) {
|
||||
// it may be the case that the exception is in the body message as string
|
||||
msg = contents;
|
||||
}
|
||||
else {
|
||||
msg = 'Failed request: (' + statusCode + ')';
|
||||
}
|
||||
let err = new Error(msg);
|
||||
// attach statusCode and body obj (if available) to the error object
|
||||
err['statusCode'] = statusCode;
|
||||
if (response.result) {
|
||||
err['result'] = response.result;
|
||||
}
|
||||
reject(err);
|
||||
}
|
||||
else {
|
||||
resolve(response);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.HttpClient = HttpClient;
|
50
node_modules/@actions/http-client/interfaces.d.ts
generated
vendored
50
node_modules/@actions/http-client/interfaces.d.ts
generated
vendored
@ -1,50 +0,0 @@
|
||||
/// <reference types="node" />
|
||||
import http = require('http');
|
||||
import url = require('url');
|
||||
export interface IHeaders {
|
||||
[key: string]: any;
|
||||
}
|
||||
export interface IHttpClient {
|
||||
options(requestUrl: string, additionalHeaders?: IHeaders): Promise<IHttpClientResponse>;
|
||||
get(requestUrl: string, additionalHeaders?: IHeaders): Promise<IHttpClientResponse>;
|
||||
del(requestUrl: string, additionalHeaders?: IHeaders): Promise<IHttpClientResponse>;
|
||||
post(requestUrl: string, data: string, additionalHeaders?: IHeaders): Promise<IHttpClientResponse>;
|
||||
patch(requestUrl: string, data: string, additionalHeaders?: IHeaders): Promise<IHttpClientResponse>;
|
||||
put(requestUrl: string, data: string, additionalHeaders?: IHeaders): Promise<IHttpClientResponse>;
|
||||
sendStream(verb: string, requestUrl: string, stream: NodeJS.ReadableStream, additionalHeaders?: IHeaders): Promise<IHttpClientResponse>;
|
||||
request(verb: string, requestUrl: string, data: string | NodeJS.ReadableStream, headers: IHeaders): Promise<IHttpClientResponse>;
|
||||
requestRaw(info: IRequestInfo, data: string | NodeJS.ReadableStream): Promise<IHttpClientResponse>;
|
||||
requestRawWithCallback(info: IRequestInfo, data: string | NodeJS.ReadableStream, onResult: (err: any, res: IHttpClientResponse) => void): void;
|
||||
}
|
||||
export interface IRequestHandler {
|
||||
prepareRequest(options: http.RequestOptions): void;
|
||||
canHandleAuthentication(response: IHttpClientResponse): boolean;
|
||||
handleAuthentication(httpClient: IHttpClient, requestInfo: IRequestInfo, objs: any): Promise<IHttpClientResponse>;
|
||||
}
|
||||
export interface IHttpClientResponse {
|
||||
message: http.IncomingMessage;
|
||||
readBody(): Promise<string>;
|
||||
}
|
||||
export interface IRequestInfo {
|
||||
options: http.RequestOptions;
|
||||
parsedUrl: url.Url;
|
||||
httpModule: any;
|
||||
}
|
||||
export interface IRequestOptions {
|
||||
headers?: IHeaders;
|
||||
socketTimeout?: number;
|
||||
ignoreSslError?: boolean;
|
||||
allowRedirects?: boolean;
|
||||
allowRedirectDowngrade?: boolean;
|
||||
maxRedirects?: number;
|
||||
maxSockets?: number;
|
||||
keepAlive?: boolean;
|
||||
deserializeDates?: boolean;
|
||||
allowRetries?: boolean;
|
||||
maxRetries?: number;
|
||||
}
|
||||
export interface ITypedResponse<T> {
|
||||
statusCode: number;
|
||||
result: T | null;
|
||||
headers: Object;
|
||||
}
|
2
node_modules/@actions/http-client/interfaces.js
generated
vendored
2
node_modules/@actions/http-client/interfaces.js
generated
vendored
@ -1,2 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
@ -1 +1 @@
|
||||
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":";;;;;;;;;;;;AAIA,MAAa,sBAAsB;IAIjC,YAAY,QAAgB,EAAE,QAAgB;QAC5C,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;QACxB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;IAC1B,CAAC;IAED,cAAc,CAAC,OAA4B;QACzC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;YACpB,MAAM,KAAK,CAAC,4BAA4B,CAAC,CAAA;SAC1C;QACD,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC,GAAG,SAAS,MAAM,CAAC,IAAI,CACrD,GAAG,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,EAAE,CACpC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAA;IACxB,CAAC;IAED,iCAAiC;IACjC,uBAAuB;QACrB,OAAO,KAAK,CAAA;IACd,CAAC;IAEK,oBAAoB;;YACxB,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAA;QACpC,CAAC;KAAA;CACF;AA1BD,wDA0BC;AAED,MAAa,uBAAuB;IAGlC,YAAY,KAAa;QACvB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,CAAC;IAED,yCAAyC;IACzC,sDAAsD;IACtD,cAAc,CAAC,OAA4B;QACzC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;YACpB,MAAM,KAAK,CAAC,4BAA4B,CAAC,CAAA;SAC1C;QACD,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC,GAAG,UAAU,IAAI,CAAC,KAAK,EAAE,CAAA;IAC3D,CAAC;IAED,iCAAiC;IACjC,uBAAuB;QACrB,OAAO,KAAK,CAAA;IACd,CAAC;IAEK,oBAAoB;;YACxB,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAA;QACpC,CAAC;KAAA;CACF;AAxBD,0DAwBC;AAED,MAAa,oCAAoC;IAI/C,YAAY,KAAa;QACvB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,CAAC;IAED,yCAAyC;IACzC,sDAAsD;IACtD,cAAc,CAAC,OAA4B;QACzC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;YACpB,MAAM,KAAK,CAAC,4BAA4B,CAAC,CAAA;SAC1C;QACD,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC,GAAG,SAAS,MAAM,CAAC,IAAI,CACrD,OAAO,IAAI,CAAC,KAAK,EAAE,CACpB,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAA;IACxB,CAAC;IAED,iCAAiC;IACjC,uBAAuB;QACrB,OAAO,KAAK,CAAA;IACd,CAAC;IAEK,oBAAoB;;YACxB,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAA;QACpC,CAAC;KAAA;CACF;AA3BD,oFA2BC"}
|
||||
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":";;;;;;;;;;;;AAIA,MAAa,sBAAsB;IAIjC,YAAY,QAAgB,EAAE,QAAgB;QAC5C,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;QACxB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;IAC1B,CAAC;IAED,cAAc,CAAC,OAA4B;QACzC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;YACpB,MAAM,KAAK,CAAC,4BAA4B,CAAC,CAAA;SAC1C;QACD,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC,GAAG,SAAS,MAAM,CAAC,IAAI,CACrD,GAAG,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,EAAE,CACpC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAA;IACxB,CAAC;IAED,iCAAiC;IACjC,uBAAuB;QACrB,OAAO,KAAK,CAAA;IACd,CAAC;IAEK,oBAAoB;;YACxB,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAA;QACpC,CAAC;KAAA;CACF;AA1BD,wDA0BC;AAED,MAAa,uBAAuB;IAGlC,YAAY,KAAa;QACvB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,CAAC;IAED,yCAAyC;IACzC,sDAAsD;IACtD,cAAc,CAAC,OAA4B;QACzC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;YACpB,MAAM,KAAK,CAAC,4BAA4B,CAAC,CAAA;SAC1C;QACD,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC,GAAG,UAAU,IAAI,CAAC,KAAK,EAAE,CAAA;IAC3D,CAAC;IAED,iCAAiC;IACjC,uBAAuB;QACrB,OAAO,KAAK,CAAA;IACd,CAAC;IAEK,oBAAoB;;YACxB,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAA;QACpC,CAAC;KAAA;CACF;AAxBD,0DAwBC;AAED,MAAa,oCAAoC;IAK/C,YAAY,KAAa;QACvB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,CAAC;IAED,yCAAyC;IACzC,sDAAsD;IACtD,cAAc,CAAC,OAA4B;QACzC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;YACpB,MAAM,KAAK,CAAC,4BAA4B,CAAC,CAAA;SAC1C;QACD,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC,GAAG,SAAS,MAAM,CAAC,IAAI,CACrD,OAAO,IAAI,CAAC,KAAK,EAAE,CACpB,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAA;IACxB,CAAC;IAED,iCAAiC;IACjC,uBAAuB;QACrB,OAAO,KAAK,CAAA;IACd,CAAC;IAEK,oBAAoB;;YACxB,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAA;QACpC,CAAC;KAAA;CACF;AA5BD,oFA4BC"}
|
@ -1,6 +1,9 @@
|
||||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
import * as http from 'http';
|
||||
import * as ifm from './interfaces';
|
||||
import { ProxyAgent } from 'undici';
|
||||
export declare enum HttpCodes {
|
||||
OK = 200,
|
||||
MultipleChoices = 300,
|
||||
@ -51,6 +54,7 @@ export declare class HttpClientResponse {
|
||||
constructor(message: http.IncomingMessage);
|
||||
message: http.IncomingMessage;
|
||||
readBody(): Promise<string>;
|
||||
readBodyBuffer?(): Promise<Buffer>;
|
||||
}
|
||||
export declare function isHttps(requestUrl: string): boolean;
|
||||
export declare class HttpClient {
|
||||
@ -66,6 +70,7 @@ export declare class HttpClient {
|
||||
private _maxRetries;
|
||||
private _agent;
|
||||
private _proxyAgent;
|
||||
private _proxyAgentDispatcher;
|
||||
private _keepAlive;
|
||||
private _disposed;
|
||||
constructor(userAgent?: string, handlers?: ifm.RequestHandler[], requestOptions?: ifm.RequestOptions);
|
||||
@ -114,10 +119,12 @@ export declare class HttpClient {
|
||||
* @param serverUrl The server URL where the request will be sent. For example, https://api.github.com
|
||||
*/
|
||||
getAgent(serverUrl: string): http.Agent;
|
||||
getAgentDispatcher(serverUrl: string): ProxyAgent | undefined;
|
||||
private _prepareRequest;
|
||||
private _mergeHeaders;
|
||||
private _getExistingOrDefaultHeader;
|
||||
private _getAgent;
|
||||
private _getProxyAgentDispatcher;
|
||||
private _performExponentialBackoff;
|
||||
private _processResponse;
|
||||
}
|
@ -2,7 +2,11 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
@ -15,7 +19,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
@ -34,6 +38,7 @@ const http = __importStar(require("http"));
|
||||
const https = __importStar(require("https"));
|
||||
const pm = __importStar(require("./proxy"));
|
||||
const tunnel = __importStar(require("tunnel"));
|
||||
const undici_1 = require("undici");
|
||||
var HttpCodes;
|
||||
(function (HttpCodes) {
|
||||
HttpCodes[HttpCodes["OK"] = 200] = "OK";
|
||||
@ -63,16 +68,16 @@ var HttpCodes;
|
||||
HttpCodes[HttpCodes["BadGateway"] = 502] = "BadGateway";
|
||||
HttpCodes[HttpCodes["ServiceUnavailable"] = 503] = "ServiceUnavailable";
|
||||
HttpCodes[HttpCodes["GatewayTimeout"] = 504] = "GatewayTimeout";
|
||||
})(HttpCodes = exports.HttpCodes || (exports.HttpCodes = {}));
|
||||
})(HttpCodes || (exports.HttpCodes = HttpCodes = {}));
|
||||
var Headers;
|
||||
(function (Headers) {
|
||||
Headers["Accept"] = "accept";
|
||||
Headers["ContentType"] = "content-type";
|
||||
})(Headers = exports.Headers || (exports.Headers = {}));
|
||||
})(Headers || (exports.Headers = Headers = {}));
|
||||
var MediaTypes;
|
||||
(function (MediaTypes) {
|
||||
MediaTypes["ApplicationJson"] = "application/json";
|
||||
})(MediaTypes = exports.MediaTypes || (exports.MediaTypes = {}));
|
||||
})(MediaTypes || (exports.MediaTypes = MediaTypes = {}));
|
||||
/**
|
||||
* Returns the proxy URL, depending upon the supplied url and proxy environment variables.
|
||||
* @param serverUrl The server URL where the request will be sent. For example, https://api.github.com
|
||||
@ -123,6 +128,19 @@ class HttpClientResponse {
|
||||
}));
|
||||
});
|
||||
}
|
||||
readBodyBuffer() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
|
||||
const chunks = [];
|
||||
this.message.on('data', (chunk) => {
|
||||
chunks.push(chunk);
|
||||
});
|
||||
this.message.on('end', () => {
|
||||
resolve(Buffer.concat(chunks));
|
||||
});
|
||||
}));
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.HttpClientResponse = HttpClientResponse;
|
||||
function isHttps(requestUrl) {
|
||||
@ -428,6 +446,15 @@ class HttpClient {
|
||||
const parsedUrl = new URL(serverUrl);
|
||||
return this._getAgent(parsedUrl);
|
||||
}
|
||||
getAgentDispatcher(serverUrl) {
|
||||
const parsedUrl = new URL(serverUrl);
|
||||
const proxyUrl = pm.getProxyUrl(parsedUrl);
|
||||
const useProxy = proxyUrl && proxyUrl.hostname;
|
||||
if (!useProxy) {
|
||||
return;
|
||||
}
|
||||
return this._getProxyAgentDispatcher(parsedUrl, proxyUrl);
|
||||
}
|
||||
_prepareRequest(method, requestUrl, headers) {
|
||||
const info = {};
|
||||
info.parsedUrl = requestUrl;
|
||||
@ -527,6 +554,30 @@ class HttpClient {
|
||||
}
|
||||
return agent;
|
||||
}
|
||||
_getProxyAgentDispatcher(parsedUrl, proxyUrl) {
|
||||
let proxyAgent;
|
||||
if (this._keepAlive) {
|
||||
proxyAgent = this._proxyAgentDispatcher;
|
||||
}
|
||||
// if agent is already assigned use that agent.
|
||||
if (proxyAgent) {
|
||||
return proxyAgent;
|
||||
}
|
||||
const usingSsl = parsedUrl.protocol === 'https:';
|
||||
proxyAgent = new undici_1.ProxyAgent(Object.assign({ uri: proxyUrl.href, pipelining: !this._keepAlive ? 0 : 1 }, ((proxyUrl.username || proxyUrl.password) && {
|
||||
token: `${proxyUrl.username}:${proxyUrl.password}`
|
||||
})));
|
||||
this._proxyAgentDispatcher = proxyAgent;
|
||||
if (usingSsl && this._ignoreSslError) {
|
||||
// we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process
|
||||
// http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options
|
||||
// we have to cast it to any and change it directly
|
||||
proxyAgent.options = Object.assign(proxyAgent.options.requestTls || {}, {
|
||||
rejectUnauthorized: false
|
||||
});
|
||||
}
|
||||
return proxyAgent;
|
||||
}
|
||||
_performExponentialBackoff(retryNumber) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
retryNumber = Math.min(ExponentialBackoffCeiling, retryNumber);
|
1
node_modules/@actions/http-client/lib/index.js.map
generated
vendored
Normal file
1
node_modules/@actions/http-client/lib/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -1,4 +1,6 @@
|
||||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
import * as http from 'http';
|
||||
import * as https from 'https';
|
||||
import { HttpClientResponse } from './index';
|
@ -15,7 +15,13 @@ function getProxyUrl(reqUrl) {
|
||||
}
|
||||
})();
|
||||
if (proxyVar) {
|
||||
return new URL(proxyVar);
|
||||
try {
|
||||
return new URL(proxyVar);
|
||||
}
|
||||
catch (_a) {
|
||||
if (!proxyVar.startsWith('http://') && !proxyVar.startsWith('https://'))
|
||||
return new URL(`http://${proxyVar}`);
|
||||
}
|
||||
}
|
||||
else {
|
||||
return undefined;
|
||||
@ -26,6 +32,10 @@ function checkBypass(reqUrl) {
|
||||
if (!reqUrl.hostname) {
|
||||
return false;
|
||||
}
|
||||
const reqHost = reqUrl.hostname;
|
||||
if (isLoopbackAddress(reqHost)) {
|
||||
return true;
|
||||
}
|
||||
const noProxy = process.env['no_proxy'] || process.env['NO_PROXY'] || '';
|
||||
if (!noProxy) {
|
||||
return false;
|
||||
@ -51,11 +61,22 @@ function checkBypass(reqUrl) {
|
||||
.split(',')
|
||||
.map(x => x.trim().toUpperCase())
|
||||
.filter(x => x)) {
|
||||
if (upperReqHosts.some(x => x === upperNoProxyItem)) {
|
||||
if (upperNoProxyItem === '*' ||
|
||||
upperReqHosts.some(x => x === upperNoProxyItem ||
|
||||
x.endsWith(`.${upperNoProxyItem}`) ||
|
||||
(upperNoProxyItem.startsWith('.') &&
|
||||
x.endsWith(`${upperNoProxyItem}`)))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
exports.checkBypass = checkBypass;
|
||||
function isLoopbackAddress(host) {
|
||||
const hostLower = host.toLowerCase();
|
||||
return (hostLower === 'localhost' ||
|
||||
hostLower.startsWith('127.') ||
|
||||
hostLower.startsWith('[::1]') ||
|
||||
hostLower.startsWith('[0:0:0:0:0:0:0:1]'));
|
||||
}
|
||||
//# sourceMappingURL=proxy.js.map
|
1
node_modules/@actions/http-client/lib/proxy.js.map
generated
vendored
Normal file
1
node_modules/@actions/http-client/lib/proxy.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"proxy.js","sourceRoot":"","sources":["../src/proxy.ts"],"names":[],"mappings":";;;AAAA,SAAgB,WAAW,CAAC,MAAW;IACrC,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,KAAK,QAAQ,CAAA;IAE7C,IAAI,WAAW,CAAC,MAAM,CAAC,EAAE;QACvB,OAAO,SAAS,CAAA;KACjB;IAED,MAAM,QAAQ,GAAG,CAAC,GAAG,EAAE;QACrB,IAAI,QAAQ,EAAE;YACZ,OAAO,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAA;SAChE;aAAM;YACL,OAAO,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAA;SAC9D;IACH,CAAC,CAAC,EAAE,CAAA;IAEJ,IAAI,QAAQ,EAAE;QACZ,IAAI;YACF,OAAO,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAA;SACzB;QAAC,WAAM;YACN,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,UAAU,CAAC;gBACrE,OAAO,IAAI,GAAG,CAAC,UAAU,QAAQ,EAAE,CAAC,CAAA;SACvC;KACF;SAAM;QACL,OAAO,SAAS,CAAA;KACjB;AACH,CAAC;AAzBD,kCAyBC;AAED,SAAgB,WAAW,CAAC,MAAW;IACrC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE;QACpB,OAAO,KAAK,CAAA;KACb;IAED,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAA;IAC/B,IAAI,iBAAiB,CAAC,OAAO,CAAC,EAAE;QAC9B,OAAO,IAAI,CAAA;KACZ;IAED,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE,CAAA;IACxE,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,KAAK,CAAA;KACb;IAED,6BAA6B;IAC7B,IAAI,OAA2B,CAAA;IAC/B,IAAI,MAAM,CAAC,IAAI,EAAE;QACf,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;KAC9B;SAAM,IAAI,MAAM,CAAC,QAAQ,KAAK,OAAO,EAAE;QACtC,OAAO,GAAG,EAAE,CAAA;KACb;SAAM,IAAI,MAAM,CAAC,QAAQ,KAAK,QAAQ,EAAE;QACvC,OAAO,GAAG,GAAG,CAAA;KACd;IAED,qDAAqD;IACrD,MAAM,aAAa,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAA;IACrD,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;QAC/B,aAAa,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,IAAI,OAAO,EAAE,CAAC,CAAA;KACrD;IAED,uCAAuC;IACvC,KAAK,MAAM,gBAAgB,IAAI,OAAO;SACnC,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;SAChC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE;QACjB,IACE,gBAAgB,KAAK,GAAG;YACxB,aAAa,CAAC,IAAI,CAChB,CAAC,CAAC,EAAE,CACF,CAAC,KAAK,gBAAgB;gBACtB,CAAC,CAAC,QAAQ,CAAC,IAAI,gBAAgB,EAAE,CAAC;gBAClC,CAAC,gBAAgB,CAAC,UAAU,CAAC,GAAG,CAAC;oBAC/B,CAAC,CAAC,QAAQ,CAAC,GAAG,gBAAgB,EAAE,CAAC,CAAC,CACvC,EACD;YACA,OAAO,IAAI,CAAA;SACZ;KACF;IAED,OAAO,KAAK,CAAA;AACd,CAAC;AAnDD,kCAmDC;AAED,SAAS,iBAAiB,CAAC,IAAY;IACrC,MAAM,SAAS,GAAG,IAAI,CAAC,WAAW,EAAE,CAAA;IACpC,OAAO,CACL,SAAS,KAAK,WAAW;QACzB,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC;QAC5B,SAAS,CAAC,UAAU,CAAC,OAAO,CAAC;QAC7B,SAAS,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAC1C,CAAA;AACH,CAAC"}
|
62
node_modules/@actions/http-client/package.json
generated
vendored
62
node_modules/@actions/http-client/package.json
generated
vendored
@ -1,39 +1,51 @@
|
||||
{
|
||||
"name": "@actions/http-client",
|
||||
"version": "1.0.8",
|
||||
"version": "2.2.0",
|
||||
"description": "Actions Http Client",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"build": "rm -Rf ./_out && tsc && cp package*.json ./_out && cp *.md ./_out && cp LICENSE ./_out && cp actions.png ./_out",
|
||||
"test": "jest",
|
||||
"format": "prettier --write *.ts && prettier --write **/*.ts",
|
||||
"format-check": "prettier --check *.ts && prettier --check **/*.ts",
|
||||
"audit-check": "npm audit --audit-level=moderate"
|
||||
"keywords": [
|
||||
"github",
|
||||
"actions",
|
||||
"http"
|
||||
],
|
||||
"homepage": "https://github.com/actions/toolkit/tree/main/packages/http-client",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
"directories": {
|
||||
"lib": "lib",
|
||||
"test": "__tests__"
|
||||
},
|
||||
"files": [
|
||||
"lib",
|
||||
"!.DS_Store"
|
||||
],
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/actions/http-client.git"
|
||||
"url": "git+https://github.com/actions/toolkit.git",
|
||||
"directory": "packages/http-client"
|
||||
},
|
||||
"scripts": {
|
||||
"audit-moderate": "npm install && npm audit --json --audit-level=moderate > audit.json",
|
||||
"test": "echo \"Error: run tests from root\" && exit 1",
|
||||
"build": "tsc",
|
||||
"format": "prettier --write **/*.ts",
|
||||
"format-check": "prettier --check **/*.ts",
|
||||
"tsc": "tsc"
|
||||
},
|
||||
"keywords": [
|
||||
"Actions",
|
||||
"Http"
|
||||
],
|
||||
"author": "GitHub, Inc.",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/actions/http-client/issues"
|
||||
"url": "https://github.com/actions/toolkit/issues"
|
||||
},
|
||||
"homepage": "https://github.com/actions/http-client#readme",
|
||||
"devDependencies": {
|
||||
"@types/jest": "^25.1.4",
|
||||
"@types/node": "^12.12.31",
|
||||
"jest": "^25.1.0",
|
||||
"prettier": "^2.0.4",
|
||||
"proxy": "^1.0.1",
|
||||
"ts-jest": "^25.2.1",
|
||||
"typescript": "^3.8.3"
|
||||
"@types/node": "20.7.1",
|
||||
"@types/tunnel": "0.0.3",
|
||||
"proxy": "^2.1.1",
|
||||
"@types/proxy": "^1.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"tunnel": "0.0.6"
|
||||
"tunnel": "^0.0.6",
|
||||
"undici": "^5.25.4"
|
||||
}
|
||||
}
|
||||
|
4
node_modules/@actions/http-client/proxy.d.ts
generated
vendored
4
node_modules/@actions/http-client/proxy.d.ts
generated
vendored
@ -1,4 +0,0 @@
|
||||
/// <reference types="node" />
|
||||
import * as url from 'url';
|
||||
export declare function getProxyUrl(reqUrl: url.Url): url.Url | undefined;
|
||||
export declare function checkBypass(reqUrl: url.Url): boolean;
|
58
node_modules/@actions/http-client/proxy.js
generated
vendored
58
node_modules/@actions/http-client/proxy.js
generated
vendored
@ -1,58 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const url = require("url");
|
||||
function getProxyUrl(reqUrl) {
|
||||
let usingSsl = reqUrl.protocol === 'https:';
|
||||
let proxyUrl;
|
||||
if (checkBypass(reqUrl)) {
|
||||
return proxyUrl;
|
||||
}
|
||||
let proxyVar;
|
||||
if (usingSsl) {
|
||||
proxyVar = process.env['https_proxy'] || process.env['HTTPS_PROXY'];
|
||||
}
|
||||
else {
|
||||
proxyVar = process.env['http_proxy'] || process.env['HTTP_PROXY'];
|
||||
}
|
||||
if (proxyVar) {
|
||||
proxyUrl = url.parse(proxyVar);
|
||||
}
|
||||
return proxyUrl;
|
||||
}
|
||||
exports.getProxyUrl = getProxyUrl;
|
||||
function checkBypass(reqUrl) {
|
||||
if (!reqUrl.hostname) {
|
||||
return false;
|
||||
}
|
||||
let noProxy = process.env['no_proxy'] || process.env['NO_PROXY'] || '';
|
||||
if (!noProxy) {
|
||||
return false;
|
||||
}
|
||||
// Determine the request port
|
||||
let reqPort;
|
||||
if (reqUrl.port) {
|
||||
reqPort = Number(reqUrl.port);
|
||||
}
|
||||
else if (reqUrl.protocol === 'http:') {
|
||||
reqPort = 80;
|
||||
}
|
||||
else if (reqUrl.protocol === 'https:') {
|
||||
reqPort = 443;
|
||||
}
|
||||
// Format the request hostname and hostname with port
|
||||
let upperReqHosts = [reqUrl.hostname.toUpperCase()];
|
||||
if (typeof reqPort === 'number') {
|
||||
upperReqHosts.push(`${upperReqHosts[0]}:${reqPort}`);
|
||||
}
|
||||
// Compare request host against noproxy
|
||||
for (let upperNoProxyItem of noProxy
|
||||
.split(',')
|
||||
.map(x => x.trim().toUpperCase())
|
||||
.filter(x => x)) {
|
||||
if (upperReqHosts.some(x => x === upperNoProxyItem)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
exports.checkBypass = checkBypass;
|
19
node_modules/@fastify/busboy/LICENSE
generated
vendored
Normal file
19
node_modules/@fastify/busboy/LICENSE
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
Copyright Brian White. All rights reserved.
|
||||
|
||||
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.
|
271
node_modules/@fastify/busboy/README.md
generated
vendored
Normal file
271
node_modules/@fastify/busboy/README.md
generated
vendored
Normal file
@ -0,0 +1,271 @@
|
||||
# busboy
|
||||
|
||||
<div align="center">
|
||||
|
||||
[![Build Status](https://github.com/fastify/busboy/workflows/ci/badge.svg)](https://github.com/fastify/busboy/actions)
|
||||
[![Coverage Status](https://coveralls.io/repos/fastify/busboy/badge.svg?branch=master)](https://coveralls.io/r/fastify/busboy?branch=master)
|
||||
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://standardjs.com/)
|
||||
[![Security Responsible Disclosure](https://img.shields.io/badge/Security-Responsible%20Disclosure-yellow.svg)](https://github.com/nodejs/security-wg/blob/HEAD/processes/responsible_disclosure_template.md)
|
||||
|
||||
</div>
|
||||
|
||||
<div align="center">
|
||||
|
||||
[![NPM version](https://img.shields.io/npm/v/@fastify/busboy.svg?style=flat)](https://www.npmjs.com/package/@fastify/busboy)
|
||||
[![NPM downloads](https://img.shields.io/npm/dm/@fastify/busboy.svg?style=flat)](https://www.npmjs.com/package/@fastify/busboy)
|
||||
|
||||
</div>
|
||||
|
||||
Description
|
||||
===========
|
||||
|
||||
A Node.js module for parsing incoming HTML form data.
|
||||
|
||||
This is an officially supported fork by [fastify](https://github.com/fastify/) organization of the amazing library [originally created](https://github.com/mscdex/busboy) by Brian White,
|
||||
aimed at addressing long-standing issues with it.
|
||||
|
||||
Benchmark (Mean time for 500 Kb payload, 2000 cycles, 1000 cycle warmup):
|
||||
|
||||
| Library | Version | Mean time in nanoseconds (less is better) |
|
||||
|-----------------------|---------|-------------------------------------------|
|
||||
| busboy | 0.3.1 | `340114` |
|
||||
| @fastify/busboy | 1.0.0 | `270984` |
|
||||
|
||||
[Changelog](https://github.com/fastify/busboy/blob/master/CHANGELOG.md) since busboy 0.31.
|
||||
|
||||
Requirements
|
||||
============
|
||||
|
||||
* [Node.js](http://nodejs.org/) 10+
|
||||
|
||||
|
||||
Install
|
||||
=======
|
||||
|
||||
npm i @fastify/busboy
|
||||
|
||||
|
||||
Examples
|
||||
========
|
||||
|
||||
* Parsing (multipart) with default options:
|
||||
|
||||
```javascript
|
||||
const http = require('node:http');
|
||||
const { inspect } = require('node:util');
|
||||
const Busboy = require('busboy');
|
||||
|
||||
http.createServer((req, res) => {
|
||||
if (req.method === 'POST') {
|
||||
const busboy = new Busboy({ headers: req.headers });
|
||||
busboy.on('file', (fieldname, file, filename, encoding, mimetype) => {
|
||||
console.log(`File [${fieldname}]: filename: ${filename}, encoding: ${encoding}, mimetype: ${mimetype}`);
|
||||
file.on('data', data => {
|
||||
console.log(`File [${fieldname}] got ${data.length} bytes`);
|
||||
});
|
||||
file.on('end', () => {
|
||||
console.log(`File [${fieldname}] Finished`);
|
||||
});
|
||||
});
|
||||
busboy.on('field', (fieldname, val, fieldnameTruncated, valTruncated, encoding, mimetype) => {
|
||||
console.log(`Field [${fieldname}]: value: ${inspect(val)}`);
|
||||
});
|
||||
busboy.on('finish', () => {
|
||||
console.log('Done parsing form!');
|
||||
res.writeHead(303, { Connection: 'close', Location: '/' });
|
||||
res.end();
|
||||
});
|
||||
req.pipe(busboy);
|
||||
} else if (req.method === 'GET') {
|
||||
res.writeHead(200, { Connection: 'close' });
|
||||
res.end(`<html><head></head><body>
|
||||
<form method="POST" enctype="multipart/form-data">
|
||||
<input type="text" name="textfield"><br>
|
||||
<input type="file" name="filefield"><br>
|
||||
<input type="submit">
|
||||
</form>
|
||||
</body></html>`);
|
||||
}
|
||||
}).listen(8000, () => {
|
||||
console.log('Listening for requests');
|
||||
});
|
||||
|
||||
// Example output, using http://nodejs.org/images/ryan-speaker.jpg as the file:
|
||||
//
|
||||
// Listening for requests
|
||||
// File [filefield]: filename: ryan-speaker.jpg, encoding: binary
|
||||
// File [filefield] got 11971 bytes
|
||||
// Field [textfield]: value: 'testing! :-)'
|
||||
// File [filefield] Finished
|
||||
// Done parsing form!
|
||||
```
|
||||
|
||||
* Save all incoming files to disk:
|
||||
|
||||
```javascript
|
||||
const http = require('node:http');
|
||||
const path = require('node:path');
|
||||
const os = require('node:os');
|
||||
const fs = require('node:fs');
|
||||
|
||||
const Busboy = require('busboy');
|
||||
|
||||
http.createServer(function(req, res) {
|
||||
if (req.method === 'POST') {
|
||||
const busboy = new Busboy({ headers: req.headers });
|
||||
busboy.on('file', function(fieldname, file, filename, encoding, mimetype) {
|
||||
var saveTo = path.join(os.tmpdir(), path.basename(fieldname));
|
||||
file.pipe(fs.createWriteStream(saveTo));
|
||||
});
|
||||
busboy.on('finish', function() {
|
||||
res.writeHead(200, { 'Connection': 'close' });
|
||||
res.end("That's all folks!");
|
||||
});
|
||||
return req.pipe(busboy);
|
||||
}
|
||||
res.writeHead(404);
|
||||
res.end();
|
||||
}).listen(8000, function() {
|
||||
console.log('Listening for requests');
|
||||
});
|
||||
```
|
||||
|
||||
* Parsing (urlencoded) with default options:
|
||||
|
||||
```javascript
|
||||
const http = require('node:http');
|
||||
const { inspect } = require('node:util');
|
||||
|
||||
const Busboy = require('busboy');
|
||||
|
||||
http.createServer(function(req, res) {
|
||||
if (req.method === 'POST') {
|
||||
const busboy = new Busboy({ headers: req.headers });
|
||||
busboy.on('file', function(fieldname, file, filename, encoding, mimetype) {
|
||||
console.log('File [' + fieldname + ']: filename: ' + filename);
|
||||
file.on('data', function(data) {
|
||||
console.log('File [' + fieldname + '] got ' + data.length + ' bytes');
|
||||
});
|
||||
file.on('end', function() {
|
||||
console.log('File [' + fieldname + '] Finished');
|
||||
});
|
||||
});
|
||||
busboy.on('field', function(fieldname, val, fieldnameTruncated, valTruncated) {
|
||||
console.log('Field [' + fieldname + ']: value: ' + inspect(val));
|
||||
});
|
||||
busboy.on('finish', function() {
|
||||
console.log('Done parsing form!');
|
||||
res.writeHead(303, { Connection: 'close', Location: '/' });
|
||||
res.end();
|
||||
});
|
||||
req.pipe(busboy);
|
||||
} else if (req.method === 'GET') {
|
||||
res.writeHead(200, { Connection: 'close' });
|
||||
res.end('<html><head></head><body>\
|
||||
<form method="POST">\
|
||||
<input type="text" name="textfield"><br />\
|
||||
<select name="selectfield">\
|
||||
<option value="1">1</option>\
|
||||
<option value="10">10</option>\
|
||||
<option value="100">100</option>\
|
||||
<option value="9001">9001</option>\
|
||||
</select><br />\
|
||||
<input type="checkbox" name="checkfield">Node.js rules!<br />\
|
||||
<input type="submit">\
|
||||
</form>\
|
||||
</body></html>');
|
||||
}
|
||||
}).listen(8000, function() {
|
||||
console.log('Listening for requests');
|
||||
});
|
||||
|
||||
// Example output:
|
||||
//
|
||||
// Listening for requests
|
||||
// Field [textfield]: value: 'testing! :-)'
|
||||
// Field [selectfield]: value: '9001'
|
||||
// Field [checkfield]: value: 'on'
|
||||
// Done parsing form!
|
||||
```
|
||||
|
||||
|
||||
API
|
||||
===
|
||||
|
||||
_Busboy_ is a _Writable_ stream
|
||||
|
||||
Busboy (special) events
|
||||
-----------------------
|
||||
|
||||
* **file**(< _string_ >fieldname, < _ReadableStream_ >stream, < _string_ >filename, < _string_ >transferEncoding, < _string_ >mimeType) - Emitted for each new file form field found. `transferEncoding` contains the 'Content-Transfer-Encoding' value for the file stream. `mimeType` contains the 'Content-Type' value for the file stream.
|
||||
* Note: if you listen for this event, you should always handle the `stream` no matter if you care about the file contents or not (e.g. you can simply just do `stream.resume();` if you want to discard the contents), otherwise the 'finish' event will never fire on the Busboy instance. However, if you don't care about **any** incoming files, you can simply not listen for the 'file' event at all and any/all files will be automatically and safely discarded (these discarded files do still count towards `files` and `parts` limits).
|
||||
* If a configured file size limit was reached, `stream` will both have a boolean property `truncated` (best checked at the end of the stream) and emit a 'limit' event to notify you when this happens.
|
||||
* The property `bytesRead` informs about the number of bytes that have been read so far.
|
||||
|
||||
* **field**(< _string_ >fieldname, < _string_ >value, < _boolean_ >fieldnameTruncated, < _boolean_ >valueTruncated, < _string_ >transferEncoding, < _string_ >mimeType) - Emitted for each new non-file field found.
|
||||
|
||||
* **partsLimit**() - Emitted when specified `parts` limit has been reached. No more 'file' or 'field' events will be emitted.
|
||||
|
||||
* **filesLimit**() - Emitted when specified `files` limit has been reached. No more 'file' events will be emitted.
|
||||
|
||||
* **fieldsLimit**() - Emitted when specified `fields` limit has been reached. No more 'field' events will be emitted.
|
||||
|
||||
|
||||
Busboy methods
|
||||
--------------
|
||||
|
||||
* **(constructor)**(< _object_ >config) - Creates and returns a new Busboy instance.
|
||||
|
||||
* The constructor takes the following valid `config` settings:
|
||||
|
||||
* **headers** - _object_ - These are the HTTP headers of the incoming request, which are used by individual parsers.
|
||||
|
||||
* **autoDestroy** - _boolean_ - Whether this stream should automatically call .destroy() on itself after ending. (Default: false).
|
||||
|
||||
* **highWaterMark** - _integer_ - highWaterMark to use for this Busboy instance (Default: WritableStream default).
|
||||
|
||||
* **fileHwm** - _integer_ - highWaterMark to use for file streams (Default: ReadableStream default).
|
||||
|
||||
* **defCharset** - _string_ - Default character set to use when one isn't defined (Default: 'utf8').
|
||||
|
||||
* **preservePath** - _boolean_ - If paths in the multipart 'filename' field shall be preserved. (Default: false).
|
||||
|
||||
* **isPartAFile** - __function__ - Use this function to override the default file detection functionality. It has following parameters:
|
||||
|
||||
* fieldName - __string__ The name of the field.
|
||||
|
||||
* contentType - __string__ The content-type of the part, e.g. `text/plain`, `image/jpeg`, `application/octet-stream`
|
||||
|
||||
* fileName - __string__ The name of a file supplied by the part.
|
||||
|
||||
(Default: `(fieldName, contentType, fileName) => (contentType === 'application/octet-stream' || fileName !== undefined)`)
|
||||
|
||||
* **limits** - _object_ - Various limits on incoming data. Valid properties are:
|
||||
|
||||
* **fieldNameSize** - _integer_ - Max field name size (in bytes) (Default: 100 bytes).
|
||||
|
||||
* **fieldSize** - _integer_ - Max field value size (in bytes) (Default: 1 MiB, which is 1024 x 1024 bytes).
|
||||
|
||||
* **fields** - _integer_ - Max number of non-file fields (Default: Infinity).
|
||||
|
||||
* **fileSize** - _integer_ - For multipart forms, the max file size (in bytes) (Default: Infinity).
|
||||
|
||||
* **files** - _integer_ - For multipart forms, the max number of file fields (Default: Infinity).
|
||||
|
||||
* **parts** - _integer_ - For multipart forms, the max number of parts (fields + files) (Default: Infinity).
|
||||
|
||||
* **headerPairs** - _integer_ - For multipart forms, the max number of header key=>value pairs to parse **Default:** 2000
|
||||
|
||||
* **headerSize** - _integer_ - For multipart forms, the max size of a multipart header **Default:** 81920.
|
||||
|
||||
* The constructor can throw errors:
|
||||
|
||||
* **Busboy expected an options-Object.** - Busboy expected an Object as first parameters.
|
||||
|
||||
* **Busboy expected an options-Object with headers-attribute.** - The first parameter is lacking of a headers-attribute.
|
||||
|
||||
* **Limit $limit is not a valid number** - Busboy expected the desired limit to be of type number. Busboy throws this Error to prevent a potential security issue by falling silently back to the Busboy-defaults. Potential source for this Error can be the direct use of environment variables without transforming them to the type number.
|
||||
|
||||
* **Unsupported Content-Type.** - The `Content-Type` isn't one Busboy can parse.
|
||||
|
||||
* **Missing Content-Type-header.** - The provided headers don't include `Content-Type` at all.
|
19
node_modules/@fastify/busboy/deps/dicer/LICENSE
generated
vendored
Normal file
19
node_modules/@fastify/busboy/deps/dicer/LICENSE
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
Copyright Brian White. All rights reserved.
|
||||
|
||||
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.
|
207
node_modules/@fastify/busboy/deps/dicer/lib/Dicer.js
generated
vendored
Normal file
207
node_modules/@fastify/busboy/deps/dicer/lib/Dicer.js
generated
vendored
Normal file
@ -0,0 +1,207 @@
|
||||
'use strict'
|
||||
|
||||
const WritableStream = require('node:stream').Writable
|
||||
const inherits = require('node:util').inherits
|
||||
|
||||
const StreamSearch = require('../../streamsearch/sbmh')
|
||||
|
||||
const PartStream = require('./PartStream')
|
||||
const HeaderParser = require('./HeaderParser')
|
||||
|
||||
const DASH = 45
|
||||
const B_ONEDASH = Buffer.from('-')
|
||||
const B_CRLF = Buffer.from('\r\n')
|
||||
const EMPTY_FN = function () {}
|
||||
|
||||
function Dicer (cfg) {
|
||||
if (!(this instanceof Dicer)) { return new Dicer(cfg) }
|
||||
WritableStream.call(this, cfg)
|
||||
|
||||
if (!cfg || (!cfg.headerFirst && typeof cfg.boundary !== 'string')) { throw new TypeError('Boundary required') }
|
||||
|
||||
if (typeof cfg.boundary === 'string') { this.setBoundary(cfg.boundary) } else { this._bparser = undefined }
|
||||
|
||||
this._headerFirst = cfg.headerFirst
|
||||
|
||||
this._dashes = 0
|
||||
this._parts = 0
|
||||
this._finished = false
|
||||
this._realFinish = false
|
||||
this._isPreamble = true
|
||||
this._justMatched = false
|
||||
this._firstWrite = true
|
||||
this._inHeader = true
|
||||
this._part = undefined
|
||||
this._cb = undefined
|
||||
this._ignoreData = false
|
||||
this._partOpts = { highWaterMark: cfg.partHwm }
|
||||
this._pause = false
|
||||
|
||||
const self = this
|
||||
this._hparser = new HeaderParser(cfg)
|
||||
this._hparser.on('header', function (header) {
|
||||
self._inHeader = false
|
||||
self._part.emit('header', header)
|
||||
})
|
||||
}
|
||||
inherits(Dicer, WritableStream)
|
||||
|
||||
Dicer.prototype.emit = function (ev) {
|
||||
if (ev === 'finish' && !this._realFinish) {
|
||||
if (!this._finished) {
|
||||
const self = this
|
||||
process.nextTick(function () {
|
||||
self.emit('error', new Error('Unexpected end of multipart data'))
|
||||
if (self._part && !self._ignoreData) {
|
||||
const type = (self._isPreamble ? 'Preamble' : 'Part')
|
||||
self._part.emit('error', new Error(type + ' terminated early due to unexpected end of multipart data'))
|
||||
self._part.push(null)
|
||||
process.nextTick(function () {
|
||||
self._realFinish = true
|
||||
self.emit('finish')
|
||||
self._realFinish = false
|
||||
})
|
||||
return
|
||||
}
|
||||
self._realFinish = true
|
||||
self.emit('finish')
|
||||
self._realFinish = false
|
||||
})
|
||||
}
|
||||
} else { WritableStream.prototype.emit.apply(this, arguments) }
|
||||
}
|
||||
|
||||
Dicer.prototype._write = function (data, encoding, cb) {
|
||||
// ignore unexpected data (e.g. extra trailer data after finished)
|
||||
if (!this._hparser && !this._bparser) { return cb() }
|
||||
|
||||
if (this._headerFirst && this._isPreamble) {
|
||||
if (!this._part) {
|
||||
this._part = new PartStream(this._partOpts)
|
||||
if (this._events.preamble) { this.emit('preamble', this._part) } else { this._ignore() }
|
||||
}
|
||||
const r = this._hparser.push(data)
|
||||
if (!this._inHeader && r !== undefined && r < data.length) { data = data.slice(r) } else { return cb() }
|
||||
}
|
||||
|
||||
// allows for "easier" testing
|
||||
if (this._firstWrite) {
|
||||
this._bparser.push(B_CRLF)
|
||||
this._firstWrite = false
|
||||
}
|
||||
|
||||
this._bparser.push(data)
|
||||
|
||||
if (this._pause) { this._cb = cb } else { cb() }
|
||||
}
|
||||
|
||||
Dicer.prototype.reset = function () {
|
||||
this._part = undefined
|
||||
this._bparser = undefined
|
||||
this._hparser = undefined
|
||||
}
|
||||
|
||||
Dicer.prototype.setBoundary = function (boundary) {
|
||||
const self = this
|
||||
this._bparser = new StreamSearch('\r\n--' + boundary)
|
||||
this._bparser.on('info', function (isMatch, data, start, end) {
|
||||
self._oninfo(isMatch, data, start, end)
|
||||
})
|
||||
}
|
||||
|
||||
Dicer.prototype._ignore = function () {
|
||||
if (this._part && !this._ignoreData) {
|
||||
this._ignoreData = true
|
||||
this._part.on('error', EMPTY_FN)
|
||||
// we must perform some kind of read on the stream even though we are
|
||||
// ignoring the data, otherwise node's Readable stream will not emit 'end'
|
||||
// after pushing null to the stream
|
||||
this._part.resume()
|
||||
}
|
||||
}
|
||||
|
||||
Dicer.prototype._oninfo = function (isMatch, data, start, end) {
|
||||
let buf; const self = this; let i = 0; let r; let shouldWriteMore = true
|
||||
|
||||
if (!this._part && this._justMatched && data) {
|
||||
while (this._dashes < 2 && (start + i) < end) {
|
||||
if (data[start + i] === DASH) {
|
||||
++i
|
||||
++this._dashes
|
||||
} else {
|
||||
if (this._dashes) { buf = B_ONEDASH }
|
||||
this._dashes = 0
|
||||
break
|
||||
}
|
||||
}
|
||||
if (this._dashes === 2) {
|
||||
if ((start + i) < end && this._events.trailer) { this.emit('trailer', data.slice(start + i, end)) }
|
||||
this.reset()
|
||||
this._finished = true
|
||||
// no more parts will be added
|
||||
if (self._parts === 0) {
|
||||
self._realFinish = true
|
||||
self.emit('finish')
|
||||
self._realFinish = false
|
||||
}
|
||||
}
|
||||
if (this._dashes) { return }
|
||||
}
|
||||
if (this._justMatched) { this._justMatched = false }
|
||||
if (!this._part) {
|
||||
this._part = new PartStream(this._partOpts)
|
||||
this._part._read = function (n) {
|
||||
self._unpause()
|
||||
}
|
||||
if (this._isPreamble && this._events.preamble) { this.emit('preamble', this._part) } else if (this._isPreamble !== true && this._events.part) { this.emit('part', this._part) } else { this._ignore() }
|
||||
if (!this._isPreamble) { this._inHeader = true }
|
||||
}
|
||||
if (data && start < end && !this._ignoreData) {
|
||||
if (this._isPreamble || !this._inHeader) {
|
||||
if (buf) { shouldWriteMore = this._part.push(buf) }
|
||||
shouldWriteMore = this._part.push(data.slice(start, end))
|
||||
if (!shouldWriteMore) { this._pause = true }
|
||||
} else if (!this._isPreamble && this._inHeader) {
|
||||
if (buf) { this._hparser.push(buf) }
|
||||
r = this._hparser.push(data.slice(start, end))
|
||||
if (!this._inHeader && r !== undefined && r < end) { this._oninfo(false, data, start + r, end) }
|
||||
}
|
||||
}
|
||||
if (isMatch) {
|
||||
this._hparser.reset()
|
||||
if (this._isPreamble) { this._isPreamble = false } else {
|
||||
if (start !== end) {
|
||||
++this._parts
|
||||
this._part.on('end', function () {
|
||||
if (--self._parts === 0) {
|
||||
if (self._finished) {
|
||||
self._realFinish = true
|
||||
self.emit('finish')
|
||||
self._realFinish = false
|
||||
} else {
|
||||
self._unpause()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
this._part.push(null)
|
||||
this._part = undefined
|
||||
this._ignoreData = false
|
||||
this._justMatched = true
|
||||
this._dashes = 0
|
||||
}
|
||||
}
|
||||
|
||||
Dicer.prototype._unpause = function () {
|
||||
if (!this._pause) { return }
|
||||
|
||||
this._pause = false
|
||||
if (this._cb) {
|
||||
const cb = this._cb
|
||||
this._cb = undefined
|
||||
cb()
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Dicer
|
100
node_modules/@fastify/busboy/deps/dicer/lib/HeaderParser.js
generated
vendored
Normal file
100
node_modules/@fastify/busboy/deps/dicer/lib/HeaderParser.js
generated
vendored
Normal file
@ -0,0 +1,100 @@
|
||||
'use strict'
|
||||
|
||||
const EventEmitter = require('node:events').EventEmitter
|
||||
const inherits = require('node:util').inherits
|
||||
const getLimit = require('../../../lib/utils/getLimit')
|
||||
|
||||
const StreamSearch = require('../../streamsearch/sbmh')
|
||||
|
||||
const B_DCRLF = Buffer.from('\r\n\r\n')
|
||||
const RE_CRLF = /\r\n/g
|
||||
const RE_HDR = /^([^:]+):[ \t]?([\x00-\xFF]+)?$/ // eslint-disable-line no-control-regex
|
||||
|
||||
function HeaderParser (cfg) {
|
||||
EventEmitter.call(this)
|
||||
|
||||
cfg = cfg || {}
|
||||
const self = this
|
||||
this.nread = 0
|
||||
this.maxed = false
|
||||
this.npairs = 0
|
||||
this.maxHeaderPairs = getLimit(cfg, 'maxHeaderPairs', 2000)
|
||||
this.maxHeaderSize = getLimit(cfg, 'maxHeaderSize', 80 * 1024)
|
||||
this.buffer = ''
|
||||
this.header = {}
|
||||
this.finished = false
|
||||
this.ss = new StreamSearch(B_DCRLF)
|
||||
this.ss.on('info', function (isMatch, data, start, end) {
|
||||
if (data && !self.maxed) {
|
||||
if (self.nread + end - start >= self.maxHeaderSize) {
|
||||
end = self.maxHeaderSize - self.nread + start
|
||||
self.nread = self.maxHeaderSize
|
||||
self.maxed = true
|
||||
} else { self.nread += (end - start) }
|
||||
|
||||
self.buffer += data.toString('binary', start, end)
|
||||
}
|
||||
if (isMatch) { self._finish() }
|
||||
})
|
||||
}
|
||||
inherits(HeaderParser, EventEmitter)
|
||||
|
||||
HeaderParser.prototype.push = function (data) {
|
||||
const r = this.ss.push(data)
|
||||
if (this.finished) { return r }
|
||||
}
|
||||
|
||||
HeaderParser.prototype.reset = function () {
|
||||
this.finished = false
|
||||
this.buffer = ''
|
||||
this.header = {}
|
||||
this.ss.reset()
|
||||
}
|
||||
|
||||
HeaderParser.prototype._finish = function () {
|
||||
if (this.buffer) { this._parseHeader() }
|
||||
this.ss.matches = this.ss.maxMatches
|
||||
const header = this.header
|
||||
this.header = {}
|
||||
this.buffer = ''
|
||||
this.finished = true
|
||||
this.nread = this.npairs = 0
|
||||
this.maxed = false
|
||||
this.emit('header', header)
|
||||
}
|
||||
|
||||
HeaderParser.prototype._parseHeader = function () {
|
||||
if (this.npairs === this.maxHeaderPairs) { return }
|
||||
|
||||
const lines = this.buffer.split(RE_CRLF)
|
||||
const len = lines.length
|
||||
let m, h
|
||||
|
||||
for (var i = 0; i < len; ++i) { // eslint-disable-line no-var
|
||||
if (lines[i].length === 0) { continue }
|
||||
if (lines[i][0] === '\t' || lines[i][0] === ' ') {
|
||||
// folded header content
|
||||
// RFC2822 says to just remove the CRLF and not the whitespace following
|
||||
// it, so we follow the RFC and include the leading whitespace ...
|
||||
if (h) {
|
||||
this.header[h][this.header[h].length - 1] += lines[i]
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
const posColon = lines[i].indexOf(':')
|
||||
if (
|
||||
posColon === -1 ||
|
||||
posColon === 0
|
||||
) {
|
||||
return
|
||||
}
|
||||
m = RE_HDR.exec(lines[i])
|
||||
h = m[1].toLowerCase()
|
||||
this.header[h] = this.header[h] || []
|
||||
this.header[h].push((m[2] || ''))
|
||||
if (++this.npairs === this.maxHeaderPairs) { break }
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = HeaderParser
|
13
node_modules/@fastify/busboy/deps/dicer/lib/PartStream.js
generated
vendored
Normal file
13
node_modules/@fastify/busboy/deps/dicer/lib/PartStream.js
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
'use strict'
|
||||
|
||||
const inherits = require('node:util').inherits
|
||||
const ReadableStream = require('node:stream').Readable
|
||||
|
||||
function PartStream (opts) {
|
||||
ReadableStream.call(this, opts)
|
||||
}
|
||||
inherits(PartStream, ReadableStream)
|
||||
|
||||
PartStream.prototype._read = function (n) {}
|
||||
|
||||
module.exports = PartStream
|
164
node_modules/@fastify/busboy/deps/dicer/lib/dicer.d.ts
generated
vendored
Normal file
164
node_modules/@fastify/busboy/deps/dicer/lib/dicer.d.ts
generated
vendored
Normal file
@ -0,0 +1,164 @@
|
||||
// Type definitions for dicer 0.2
|
||||
// Project: https://github.com/mscdex/dicer
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
/// <reference types="node" />
|
||||
|
||||
import stream = require("stream");
|
||||
|
||||
// tslint:disable:unified-signatures
|
||||
|
||||
/**
|
||||
* A very fast streaming multipart parser for node.js.
|
||||
* Dicer is a WritableStream
|
||||
*
|
||||
* Dicer (special) events:
|
||||
* - on('finish', ()) - Emitted when all parts have been parsed and the Dicer instance has been ended.
|
||||
* - on('part', (stream: PartStream)) - Emitted when a new part has been found.
|
||||
* - on('preamble', (stream: PartStream)) - Emitted for preamble if you should happen to need it (can usually be ignored).
|
||||
* - on('trailer', (data: Buffer)) - Emitted when trailing data was found after the terminating boundary (as with the preamble, this can usually be ignored too).
|
||||
*/
|
||||
export class Dicer extends stream.Writable {
|
||||
/**
|
||||
* Creates and returns a new Dicer instance with the following valid config settings:
|
||||
*
|
||||
* @param config The configuration to use
|
||||
*/
|
||||
constructor(config: Dicer.Config);
|
||||
/**
|
||||
* Sets the boundary to use for parsing and performs some initialization needed for parsing.
|
||||
* You should only need to use this if you set headerFirst to true in the constructor and are parsing the boundary from the preamble header.
|
||||
*
|
||||
* @param boundary The boundary to use
|
||||
*/
|
||||
setBoundary(boundary: string): void;
|
||||
addListener(event: "finish", listener: () => void): this;
|
||||
addListener(event: "part", listener: (stream: Dicer.PartStream) => void): this;
|
||||
addListener(event: "preamble", listener: (stream: Dicer.PartStream) => void): this;
|
||||
addListener(event: "trailer", listener: (data: Buffer) => void): this;
|
||||
addListener(event: "close", listener: () => void): this;
|
||||
addListener(event: "drain", listener: () => void): this;
|
||||
addListener(event: "error", listener: (err: Error) => void): this;
|
||||
addListener(event: "pipe", listener: (src: stream.Readable) => void): this;
|
||||
addListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
|
||||
addListener(event: string, listener: (...args: any[]) => void): this;
|
||||
on(event: "finish", listener: () => void): this;
|
||||
on(event: "part", listener: (stream: Dicer.PartStream) => void): this;
|
||||
on(event: "preamble", listener: (stream: Dicer.PartStream) => void): this;
|
||||
on(event: "trailer", listener: (data: Buffer) => void): this;
|
||||
on(event: "close", listener: () => void): this;
|
||||
on(event: "drain", listener: () => void): this;
|
||||
on(event: "error", listener: (err: Error) => void): this;
|
||||
on(event: "pipe", listener: (src: stream.Readable) => void): this;
|
||||
on(event: "unpipe", listener: (src: stream.Readable) => void): this;
|
||||
on(event: string, listener: (...args: any[]) => void): this;
|
||||
once(event: "finish", listener: () => void): this;
|
||||
once(event: "part", listener: (stream: Dicer.PartStream) => void): this;
|
||||
once(event: "preamble", listener: (stream: Dicer.PartStream) => void): this;
|
||||
once(event: "trailer", listener: (data: Buffer) => void): this;
|
||||
once(event: "close", listener: () => void): this;
|
||||
once(event: "drain", listener: () => void): this;
|
||||
once(event: "error", listener: (err: Error) => void): this;
|
||||
once(event: "pipe", listener: (src: stream.Readable) => void): this;
|
||||
once(event: "unpipe", listener: (src: stream.Readable) => void): this;
|
||||
once(event: string, listener: (...args: any[]) => void): this;
|
||||
prependListener(event: "finish", listener: () => void): this;
|
||||
prependListener(event: "part", listener: (stream: Dicer.PartStream) => void): this;
|
||||
prependListener(event: "preamble", listener: (stream: Dicer.PartStream) => void): this;
|
||||
prependListener(event: "trailer", listener: (data: Buffer) => void): this;
|
||||
prependListener(event: "close", listener: () => void): this;
|
||||
prependListener(event: "drain", listener: () => void): this;
|
||||
prependListener(event: "error", listener: (err: Error) => void): this;
|
||||
prependListener(event: "pipe", listener: (src: stream.Readable) => void): this;
|
||||
prependListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
|
||||
prependListener(event: string, listener: (...args: any[]) => void): this;
|
||||
prependOnceListener(event: "finish", listener: () => void): this;
|
||||
prependOnceListener(event: "part", listener: (stream: Dicer.PartStream) => void): this;
|
||||
prependOnceListener(event: "preamble", listener: (stream: Dicer.PartStream) => void): this;
|
||||
prependOnceListener(event: "trailer", listener: (data: Buffer) => void): this;
|
||||
prependOnceListener(event: "close", listener: () => void): this;
|
||||
prependOnceListener(event: "drain", listener: () => void): this;
|
||||
prependOnceListener(event: "error", listener: (err: Error) => void): this;
|
||||
prependOnceListener(event: "pipe", listener: (src: stream.Readable) => void): this;
|
||||
prependOnceListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
|
||||
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
||||
removeListener(event: "finish", listener: () => void): this;
|
||||
removeListener(event: "part", listener: (stream: Dicer.PartStream) => void): this;
|
||||
removeListener(event: "preamble", listener: (stream: Dicer.PartStream) => void): this;
|
||||
removeListener(event: "trailer", listener: (data: Buffer) => void): this;
|
||||
removeListener(event: "close", listener: () => void): this;
|
||||
removeListener(event: "drain", listener: () => void): this;
|
||||
removeListener(event: "error", listener: (err: Error) => void): this;
|
||||
removeListener(event: "pipe", listener: (src: stream.Readable) => void): this;
|
||||
removeListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
|
||||
removeListener(event: string, listener: (...args: any[]) => void): this;
|
||||
}
|
||||
|
||||
declare namespace Dicer {
|
||||
interface Config {
|
||||
/**
|
||||
* This is the boundary used to detect the beginning of a new part.
|
||||
*/
|
||||
boundary?: string | undefined;
|
||||
/**
|
||||
* If true, preamble header parsing will be performed first.
|
||||
*/
|
||||
headerFirst?: boolean | undefined;
|
||||
/**
|
||||
* The maximum number of header key=>value pairs to parse Default: 2000 (same as node's http).
|
||||
*/
|
||||
maxHeaderPairs?: number | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* PartStream is a _ReadableStream_
|
||||
*
|
||||
* PartStream (special) events:
|
||||
* - on('header', (header: object)) - An object containing the header for this particular part. Each property value is an array of one or more string values.
|
||||
*/
|
||||
interface PartStream extends stream.Readable {
|
||||
addListener(event: "header", listener: (header: object) => void): this;
|
||||
addListener(event: "close", listener: () => void): this;
|
||||
addListener(event: "data", listener: (chunk: Buffer | string) => void): this;
|
||||
addListener(event: "end", listener: () => void): this;
|
||||
addListener(event: "readable", listener: () => void): this;
|
||||
addListener(event: "error", listener: (err: Error) => void): this;
|
||||
addListener(event: string, listener: (...args: any[]) => void): this;
|
||||
on(event: "header", listener: (header: object) => void): this;
|
||||
on(event: "close", listener: () => void): this;
|
||||
on(event: "data", listener: (chunk: Buffer | string) => void): this;
|
||||
on(event: "end", listener: () => void): this;
|
||||
on(event: "readable", listener: () => void): this;
|
||||
on(event: "error", listener: (err: Error) => void): this;
|
||||
on(event: string, listener: (...args: any[]) => void): this;
|
||||
once(event: "header", listener: (header: object) => void): this;
|
||||
once(event: "close", listener: () => void): this;
|
||||
once(event: "data", listener: (chunk: Buffer | string) => void): this;
|
||||
once(event: "end", listener: () => void): this;
|
||||
once(event: "readable", listener: () => void): this;
|
||||
once(event: "error", listener: (err: Error) => void): this;
|
||||
once(event: string, listener: (...args: any[]) => void): this;
|
||||
prependListener(event: "header", listener: (header: object) => void): this;
|
||||
prependListener(event: "close", listener: () => void): this;
|
||||
prependListener(event: "data", listener: (chunk: Buffer | string) => void): this;
|
||||
prependListener(event: "end", listener: () => void): this;
|
||||
prependListener(event: "readable", listener: () => void): this;
|
||||
prependListener(event: "error", listener: (err: Error) => void): this;
|
||||
prependListener(event: string, listener: (...args: any[]) => void): this;
|
||||
prependOnceListener(event: "header", listener: (header: object) => void): this;
|
||||
prependOnceListener(event: "close", listener: () => void): this;
|
||||
prependOnceListener(event: "data", listener: (chunk: Buffer | string) => void): this;
|
||||
prependOnceListener(event: "end", listener: () => void): this;
|
||||
prependOnceListener(event: "readable", listener: () => void): this;
|
||||
prependOnceListener(event: "error", listener: (err: Error) => void): this;
|
||||
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
||||
removeListener(event: "header", listener: (header: object) => void): this;
|
||||
removeListener(event: "close", listener: () => void): this;
|
||||
removeListener(event: "data", listener: (chunk: Buffer | string) => void): this;
|
||||
removeListener(event: "end", listener: () => void): this;
|
||||
removeListener(event: "readable", listener: () => void): this;
|
||||
removeListener(event: "error", listener: (err: Error) => void): this;
|
||||
removeListener(event: string, listener: (...args: any[]) => void): this;
|
||||
}
|
||||
}
|
228
node_modules/@fastify/busboy/deps/streamsearch/sbmh.js
generated
vendored
Normal file
228
node_modules/@fastify/busboy/deps/streamsearch/sbmh.js
generated
vendored
Normal file
@ -0,0 +1,228 @@
|
||||
'use strict'
|
||||
|
||||
/**
|
||||
* Copyright Brian White. All rights reserved.
|
||||
*
|
||||
* @see https://github.com/mscdex/streamsearch
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Based heavily on the Streaming Boyer-Moore-Horspool C++ implementation
|
||||
* by Hongli Lai at: https://github.com/FooBarWidget/boyer-moore-horspool
|
||||
*/
|
||||
const EventEmitter = require('node:events').EventEmitter
|
||||
const inherits = require('node:util').inherits
|
||||
|
||||
function SBMH (needle) {
|
||||
if (typeof needle === 'string') {
|
||||
needle = Buffer.from(needle)
|
||||
}
|
||||
|
||||
if (!Buffer.isBuffer(needle)) {
|
||||
throw new TypeError('The needle has to be a String or a Buffer.')
|
||||
}
|
||||
|
||||
const needleLength = needle.length
|
||||
|
||||
if (needleLength === 0) {
|
||||
throw new Error('The needle cannot be an empty String/Buffer.')
|
||||
}
|
||||
|
||||
if (needleLength > 256) {
|
||||
throw new Error('The needle cannot have a length bigger than 256.')
|
||||
}
|
||||
|
||||
this.maxMatches = Infinity
|
||||
this.matches = 0
|
||||
|
||||
this._occ = new Array(256)
|
||||
.fill(needleLength) // Initialize occurrence table.
|
||||
this._lookbehind_size = 0
|
||||
this._needle = needle
|
||||
this._bufpos = 0
|
||||
|
||||
this._lookbehind = Buffer.alloc(needleLength)
|
||||
|
||||
// Populate occurrence table with analysis of the needle,
|
||||
// ignoring last letter.
|
||||
for (var i = 0; i < needleLength - 1; ++i) { // eslint-disable-line no-var
|
||||
this._occ[needle[i]] = needleLength - 1 - i
|
||||
}
|
||||
}
|
||||
inherits(SBMH, EventEmitter)
|
||||
|
||||
SBMH.prototype.reset = function () {
|
||||
this._lookbehind_size = 0
|
||||
this.matches = 0
|
||||
this._bufpos = 0
|
||||
}
|
||||
|
||||
SBMH.prototype.push = function (chunk, pos) {
|
||||
if (!Buffer.isBuffer(chunk)) {
|
||||
chunk = Buffer.from(chunk, 'binary')
|
||||
}
|
||||
const chlen = chunk.length
|
||||
this._bufpos = pos || 0
|
||||
let r
|
||||
while (r !== chlen && this.matches < this.maxMatches) { r = this._sbmh_feed(chunk) }
|
||||
return r
|
||||
}
|
||||
|
||||
SBMH.prototype._sbmh_feed = function (data) {
|
||||
const len = data.length
|
||||
const needle = this._needle
|
||||
const needleLength = needle.length
|
||||
const lastNeedleChar = needle[needleLength - 1]
|
||||
|
||||
// Positive: points to a position in `data`
|
||||
// pos == 3 points to data[3]
|
||||
// Negative: points to a position in the lookbehind buffer
|
||||
// pos == -2 points to lookbehind[lookbehind_size - 2]
|
||||
let pos = -this._lookbehind_size
|
||||
let ch
|
||||
|
||||
if (pos < 0) {
|
||||
// Lookbehind buffer is not empty. Perform Boyer-Moore-Horspool
|
||||
// search with character lookup code that considers both the
|
||||
// lookbehind buffer and the current round's haystack data.
|
||||
//
|
||||
// Loop until
|
||||
// there is a match.
|
||||
// or until
|
||||
// we've moved past the position that requires the
|
||||
// lookbehind buffer. In this case we switch to the
|
||||
// optimized loop.
|
||||
// or until
|
||||
// the character to look at lies outside the haystack.
|
||||
while (pos < 0 && pos <= len - needleLength) {
|
||||
ch = this._sbmh_lookup_char(data, pos + needleLength - 1)
|
||||
|
||||
if (
|
||||
ch === lastNeedleChar &&
|
||||
this._sbmh_memcmp(data, pos, needleLength - 1)
|
||||
) {
|
||||
this._lookbehind_size = 0
|
||||
++this.matches
|
||||
this.emit('info', true)
|
||||
|
||||
return (this._bufpos = pos + needleLength)
|
||||
}
|
||||
pos += this._occ[ch]
|
||||
}
|
||||
|
||||
// No match.
|
||||
|
||||
if (pos < 0) {
|
||||
// There's too few data for Boyer-Moore-Horspool to run,
|
||||
// so let's use a different algorithm to skip as much as
|
||||
// we can.
|
||||
// Forward pos until
|
||||
// the trailing part of lookbehind + data
|
||||
// looks like the beginning of the needle
|
||||
// or until
|
||||
// pos == 0
|
||||
while (pos < 0 && !this._sbmh_memcmp(data, pos, len - pos)) { ++pos }
|
||||
}
|
||||
|
||||
if (pos >= 0) {
|
||||
// Discard lookbehind buffer.
|
||||
this.emit('info', false, this._lookbehind, 0, this._lookbehind_size)
|
||||
this._lookbehind_size = 0
|
||||
} else {
|
||||
// Cut off part of the lookbehind buffer that has
|
||||
// been processed and append the entire haystack
|
||||
// into it.
|
||||
const bytesToCutOff = this._lookbehind_size + pos
|
||||
if (bytesToCutOff > 0) {
|
||||
// The cut off data is guaranteed not to contain the needle.
|
||||
this.emit('info', false, this._lookbehind, 0, bytesToCutOff)
|
||||
}
|
||||
|
||||
this._lookbehind.copy(this._lookbehind, 0, bytesToCutOff,
|
||||
this._lookbehind_size - bytesToCutOff)
|
||||
this._lookbehind_size -= bytesToCutOff
|
||||
|
||||
data.copy(this._lookbehind, this._lookbehind_size)
|
||||
this._lookbehind_size += len
|
||||
|
||||
this._bufpos = len
|
||||
return len
|
||||
}
|
||||
}
|
||||
|
||||
pos += (pos >= 0) * this._bufpos
|
||||
|
||||
// Lookbehind buffer is now empty. We only need to check if the
|
||||
// needle is in the haystack.
|
||||
if (data.indexOf(needle, pos) !== -1) {
|
||||
pos = data.indexOf(needle, pos)
|
||||
++this.matches
|
||||
if (pos > 0) { this.emit('info', true, data, this._bufpos, pos) } else { this.emit('info', true) }
|
||||
|
||||
return (this._bufpos = pos + needleLength)
|
||||
} else {
|
||||
pos = len - needleLength
|
||||
}
|
||||
|
||||
// There was no match. If there's trailing haystack data that we cannot
|
||||
// match yet using the Boyer-Moore-Horspool algorithm (because the trailing
|
||||
// data is less than the needle size) then match using a modified
|
||||
// algorithm that starts matching from the beginning instead of the end.
|
||||
// Whatever trailing data is left after running this algorithm is added to
|
||||
// the lookbehind buffer.
|
||||
while (
|
||||
pos < len &&
|
||||
(
|
||||
data[pos] !== needle[0] ||
|
||||
(
|
||||
(Buffer.compare(
|
||||
data.subarray(pos, pos + len - pos),
|
||||
needle.subarray(0, len - pos)
|
||||
) !== 0)
|
||||
)
|
||||
)
|
||||
) {
|
||||
++pos
|
||||
}
|
||||
if (pos < len) {
|
||||
data.copy(this._lookbehind, 0, pos, pos + (len - pos))
|
||||
this._lookbehind_size = len - pos
|
||||
}
|
||||
|
||||
// Everything until pos is guaranteed not to contain needle data.
|
||||
if (pos > 0) { this.emit('info', false, data, this._bufpos, pos < len ? pos : len) }
|
||||
|
||||
this._bufpos = len
|
||||
return len
|
||||
}
|
||||
|
||||
SBMH.prototype._sbmh_lookup_char = function (data, pos) {
|
||||
return (pos < 0)
|
||||
? this._lookbehind[this._lookbehind_size + pos]
|
||||
: data[pos]
|
||||
}
|
||||
|
||||
SBMH.prototype._sbmh_memcmp = function (data, pos, len) {
|
||||
for (var i = 0; i < len; ++i) { // eslint-disable-line no-var
|
||||
if (this._sbmh_lookup_char(data, pos + i) !== this._needle[i]) { return false }
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
module.exports = SBMH
|
196
node_modules/@fastify/busboy/lib/main.d.ts
generated
vendored
Normal file
196
node_modules/@fastify/busboy/lib/main.d.ts
generated
vendored
Normal file
@ -0,0 +1,196 @@
|
||||
// Definitions by: Jacob Baskin <https://github.com/jacobbaskin>
|
||||
// BendingBender <https://github.com/BendingBender>
|
||||
// Igor Savin <https://github.com/kibertoad>
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import * as http from 'http';
|
||||
import { Readable, Writable } from 'stream';
|
||||
export { Dicer } from "../deps/dicer/lib/dicer";
|
||||
|
||||
export const Busboy: BusboyConstructor;
|
||||
export default Busboy;
|
||||
|
||||
export interface BusboyConfig {
|
||||
/**
|
||||
* These are the HTTP headers of the incoming request, which are used by individual parsers.
|
||||
*/
|
||||
headers: BusboyHeaders;
|
||||
/**
|
||||
* `highWaterMark` to use for this Busboy instance.
|
||||
* @default WritableStream default.
|
||||
*/
|
||||
highWaterMark?: number | undefined;
|
||||
/**
|
||||
* highWaterMark to use for file streams.
|
||||
* @default ReadableStream default.
|
||||
*/
|
||||
fileHwm?: number | undefined;
|
||||
/**
|
||||
* Default character set to use when one isn't defined.
|
||||
* @default 'utf8'
|
||||
*/
|
||||
defCharset?: string | undefined;
|
||||
/**
|
||||
* Detect if a Part is a file.
|
||||
*
|
||||
* By default a file is detected if contentType
|
||||
* is application/octet-stream or fileName is not
|
||||
* undefined.
|
||||
*
|
||||
* Modify this to handle e.g. Blobs.
|
||||
*/
|
||||
isPartAFile?: (fieldName: string | undefined, contentType: string | undefined, fileName: string | undefined) => boolean;
|
||||
/**
|
||||
* If paths in the multipart 'filename' field shall be preserved.
|
||||
* @default false
|
||||
*/
|
||||
preservePath?: boolean | undefined;
|
||||
/**
|
||||
* Various limits on incoming data.
|
||||
*/
|
||||
limits?:
|
||||
| {
|
||||
/**
|
||||
* Max field name size (in bytes)
|
||||
* @default 100 bytes
|
||||
*/
|
||||
fieldNameSize?: number | undefined;
|
||||
/**
|
||||
* Max field value size (in bytes)
|
||||
* @default 1MB
|
||||
*/
|
||||
fieldSize?: number | undefined;
|
||||
/**
|
||||
* Max number of non-file fields
|
||||
* @default Infinity
|
||||
*/
|
||||
fields?: number | undefined;
|
||||
/**
|
||||
* For multipart forms, the max file size (in bytes)
|
||||
* @default Infinity
|
||||
*/
|
||||
fileSize?: number | undefined;
|
||||
/**
|
||||
* For multipart forms, the max number of file fields
|
||||
* @default Infinity
|
||||
*/
|
||||
files?: number | undefined;
|
||||
/**
|
||||
* For multipart forms, the max number of parts (fields + files)
|
||||
* @default Infinity
|
||||
*/
|
||||
parts?: number | undefined;
|
||||
/**
|
||||
* For multipart forms, the max number of header key=>value pairs to parse
|
||||
* @default 2000
|
||||
*/
|
||||
headerPairs?: number | undefined;
|
||||
|
||||
/**
|
||||
* For multipart forms, the max size of a header part
|
||||
* @default 81920
|
||||
*/
|
||||
headerSize?: number | undefined;
|
||||
}
|
||||
| undefined;
|
||||
}
|
||||
|
||||
export type BusboyHeaders = { 'content-type': string } & http.IncomingHttpHeaders;
|
||||
|
||||
export interface BusboyFileStream extends
|
||||
Readable {
|
||||
|
||||
truncated: boolean;
|
||||
|
||||
/**
|
||||
* The number of bytes that have been read so far.
|
||||
*/
|
||||
bytesRead: number;
|
||||
}
|
||||
|
||||
export interface Busboy extends Writable {
|
||||
addListener<Event extends keyof BusboyEvents>(event: Event, listener: BusboyEvents[Event]): this;
|
||||
|
||||
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
|
||||
on<Event extends keyof BusboyEvents>(event: Event, listener: BusboyEvents[Event]): this;
|
||||
|
||||
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
|
||||
once<Event extends keyof BusboyEvents>(event: Event, listener: BusboyEvents[Event]): this;
|
||||
|
||||
once(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
|
||||
removeListener<Event extends keyof BusboyEvents>(event: Event, listener: BusboyEvents[Event]): this;
|
||||
|
||||
removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
|
||||
off<Event extends keyof BusboyEvents>(event: Event, listener: BusboyEvents[Event]): this;
|
||||
|
||||
off(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
|
||||
prependListener<Event extends keyof BusboyEvents>(event: Event, listener: BusboyEvents[Event]): this;
|
||||
|
||||
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
|
||||
prependOnceListener<Event extends keyof BusboyEvents>(event: Event, listener: BusboyEvents[Event]): this;
|
||||
|
||||
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
}
|
||||
|
||||
export interface BusboyEvents {
|
||||
/**
|
||||
* Emitted for each new file form field found.
|
||||
*
|
||||
* * Note: if you listen for this event, you should always handle the `stream` no matter if you care about the
|
||||
* file contents or not (e.g. you can simply just do `stream.resume();` if you want to discard the contents),
|
||||
* otherwise the 'finish' event will never fire on the Busboy instance. However, if you don't care about **any**
|
||||
* incoming files, you can simply not listen for the 'file' event at all and any/all files will be automatically
|
||||
* and safely discarded (these discarded files do still count towards `files` and `parts` limits).
|
||||
* * If a configured file size limit was reached, `stream` will both have a boolean property `truncated`
|
||||
* (best checked at the end of the stream) and emit a 'limit' event to notify you when this happens.
|
||||
*
|
||||
* @param listener.transferEncoding Contains the 'Content-Transfer-Encoding' value for the file stream.
|
||||
* @param listener.mimeType Contains the 'Content-Type' value for the file stream.
|
||||
*/
|
||||
file: (
|
||||
fieldname: string,
|
||||
stream: BusboyFileStream,
|
||||
filename: string,
|
||||
transferEncoding: string,
|
||||
mimeType: string,
|
||||
) => void;
|
||||
/**
|
||||
* Emitted for each new non-file field found.
|
||||
*/
|
||||
field: (
|
||||
fieldname: string,
|
||||
value: string,
|
||||
fieldnameTruncated: boolean,
|
||||
valueTruncated: boolean,
|
||||
transferEncoding: string,
|
||||
mimeType: string,
|
||||
) => void;
|
||||
finish: () => void;
|
||||
/**
|
||||
* Emitted when specified `parts` limit has been reached. No more 'file' or 'field' events will be emitted.
|
||||
*/
|
||||
partsLimit: () => void;
|
||||
/**
|
||||
* Emitted when specified `files` limit has been reached. No more 'file' events will be emitted.
|
||||
*/
|
||||
filesLimit: () => void;
|
||||
/**
|
||||
* Emitted when specified `fields` limit has been reached. No more 'field' events will be emitted.
|
||||
*/
|
||||
fieldsLimit: () => void;
|
||||
error: (error: unknown) => void;
|
||||
}
|
||||
|
||||
export interface BusboyConstructor {
|
||||
(options: BusboyConfig): Busboy;
|
||||
|
||||
new(options: BusboyConfig): Busboy;
|
||||
}
|
||||
|
85
node_modules/@fastify/busboy/lib/main.js
generated
vendored
Normal file
85
node_modules/@fastify/busboy/lib/main.js
generated
vendored
Normal file
@ -0,0 +1,85 @@
|
||||
'use strict'
|
||||
|
||||
const WritableStream = require('node:stream').Writable
|
||||
const { inherits } = require('node:util')
|
||||
const Dicer = require('../deps/dicer/lib/Dicer')
|
||||
|
||||
const MultipartParser = require('./types/multipart')
|
||||
const UrlencodedParser = require('./types/urlencoded')
|
||||
const parseParams = require('./utils/parseParams')
|
||||
|
||||
function Busboy (opts) {
|
||||
if (!(this instanceof Busboy)) { return new Busboy(opts) }
|
||||
|
||||
if (typeof opts !== 'object') {
|
||||
throw new TypeError('Busboy expected an options-Object.')
|
||||
}
|
||||
if (typeof opts.headers !== 'object') {
|
||||
throw new TypeError('Busboy expected an options-Object with headers-attribute.')
|
||||
}
|
||||
if (typeof opts.headers['content-type'] !== 'string') {
|
||||
throw new TypeError('Missing Content-Type-header.')
|
||||
}
|
||||
|
||||
const {
|
||||
headers,
|
||||
...streamOptions
|
||||
} = opts
|
||||
|
||||
this.opts = {
|
||||
autoDestroy: false,
|
||||
...streamOptions
|
||||
}
|
||||
WritableStream.call(this, this.opts)
|
||||
|
||||
this._done = false
|
||||
this._parser = this.getParserByHeaders(headers)
|
||||
this._finished = false
|
||||
}
|
||||
inherits(Busboy, WritableStream)
|
||||
|
||||
Busboy.prototype.emit = function (ev) {
|
||||
if (ev === 'finish') {
|
||||
if (!this._done) {
|
||||
this._parser?.end()
|
||||
return
|
||||
} else if (this._finished) {
|
||||
return
|
||||
}
|
||||
this._finished = true
|
||||
}
|
||||
WritableStream.prototype.emit.apply(this, arguments)
|
||||
}
|
||||
|
||||
Busboy.prototype.getParserByHeaders = function (headers) {
|
||||
const parsed = parseParams(headers['content-type'])
|
||||
|
||||
const cfg = {
|
||||
defCharset: this.opts.defCharset,
|
||||
fileHwm: this.opts.fileHwm,
|
||||
headers,
|
||||
highWaterMark: this.opts.highWaterMark,
|
||||
isPartAFile: this.opts.isPartAFile,
|
||||
limits: this.opts.limits,
|
||||
parsedConType: parsed,
|
||||
preservePath: this.opts.preservePath
|
||||
}
|
||||
|
||||
if (MultipartParser.detect.test(parsed[0])) {
|
||||
return new MultipartParser(this, cfg)
|
||||
}
|
||||
if (UrlencodedParser.detect.test(parsed[0])) {
|
||||
return new UrlencodedParser(this, cfg)
|
||||
}
|
||||
throw new Error('Unsupported Content-Type.')
|
||||
}
|
||||
|
||||
Busboy.prototype._write = function (chunk, encoding, cb) {
|
||||
this._parser.write(chunk, cb)
|
||||
}
|
||||
|
||||
module.exports = Busboy
|
||||
module.exports.default = Busboy
|
||||
module.exports.Busboy = Busboy
|
||||
|
||||
module.exports.Dicer = Dicer
|
306
node_modules/@fastify/busboy/lib/types/multipart.js
generated
vendored
Normal file
306
node_modules/@fastify/busboy/lib/types/multipart.js
generated
vendored
Normal file
@ -0,0 +1,306 @@
|
||||
'use strict'
|
||||
|
||||
// TODO:
|
||||
// * support 1 nested multipart level
|
||||
// (see second multipart example here:
|
||||
// http://www.w3.org/TR/html401/interact/forms.html#didx-multipartform-data)
|
||||
// * support limits.fieldNameSize
|
||||
// -- this will require modifications to utils.parseParams
|
||||
|
||||
const { Readable } = require('node:stream')
|
||||
const { inherits } = require('node:util')
|
||||
|
||||
const Dicer = require('../../deps/dicer/lib/Dicer')
|
||||
|
||||
const parseParams = require('../utils/parseParams')
|
||||
const decodeText = require('../utils/decodeText')
|
||||
const basename = require('../utils/basename')
|
||||
const getLimit = require('../utils/getLimit')
|
||||
|
||||
const RE_BOUNDARY = /^boundary$/i
|
||||
const RE_FIELD = /^form-data$/i
|
||||
const RE_CHARSET = /^charset$/i
|
||||
const RE_FILENAME = /^filename$/i
|
||||
const RE_NAME = /^name$/i
|
||||
|
||||
Multipart.detect = /^multipart\/form-data/i
|
||||
function Multipart (boy, cfg) {
|
||||
let i
|
||||
let len
|
||||
const self = this
|
||||
let boundary
|
||||
const limits = cfg.limits
|
||||
const isPartAFile = cfg.isPartAFile || ((fieldName, contentType, fileName) => (contentType === 'application/octet-stream' || fileName !== undefined))
|
||||
const parsedConType = cfg.parsedConType || []
|
||||
const defCharset = cfg.defCharset || 'utf8'
|
||||
const preservePath = cfg.preservePath
|
||||
const fileOpts = { highWaterMark: cfg.fileHwm }
|
||||
|
||||
for (i = 0, len = parsedConType.length; i < len; ++i) {
|
||||
if (Array.isArray(parsedConType[i]) &&
|
||||
RE_BOUNDARY.test(parsedConType[i][0])) {
|
||||
boundary = parsedConType[i][1]
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
function checkFinished () {
|
||||
if (nends === 0 && finished && !boy._done) {
|
||||
finished = false
|
||||
self.end()
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof boundary !== 'string') { throw new Error('Multipart: Boundary not found') }
|
||||
|
||||
const fieldSizeLimit = getLimit(limits, 'fieldSize', 1 * 1024 * 1024)
|
||||
const fileSizeLimit = getLimit(limits, 'fileSize', Infinity)
|
||||
const filesLimit = getLimit(limits, 'files', Infinity)
|
||||
const fieldsLimit = getLimit(limits, 'fields', Infinity)
|
||||
const partsLimit = getLimit(limits, 'parts', Infinity)
|
||||
const headerPairsLimit = getLimit(limits, 'headerPairs', 2000)
|
||||
const headerSizeLimit = getLimit(limits, 'headerSize', 80 * 1024)
|
||||
|
||||
let nfiles = 0
|
||||
let nfields = 0
|
||||
let nends = 0
|
||||
let curFile
|
||||
let curField
|
||||
let finished = false
|
||||
|
||||
this._needDrain = false
|
||||
this._pause = false
|
||||
this._cb = undefined
|
||||
this._nparts = 0
|
||||
this._boy = boy
|
||||
|
||||
const parserCfg = {
|
||||
boundary,
|
||||
maxHeaderPairs: headerPairsLimit,
|
||||
maxHeaderSize: headerSizeLimit,
|
||||
partHwm: fileOpts.highWaterMark,
|
||||
highWaterMark: cfg.highWaterMark
|
||||
}
|
||||
|
||||
this.parser = new Dicer(parserCfg)
|
||||
this.parser.on('drain', function () {
|
||||
self._needDrain = false
|
||||
if (self._cb && !self._pause) {
|
||||
const cb = self._cb
|
||||
self._cb = undefined
|
||||
cb()
|
||||
}
|
||||
}).on('part', function onPart (part) {
|
||||
if (++self._nparts > partsLimit) {
|
||||
self.parser.removeListener('part', onPart)
|
||||
self.parser.on('part', skipPart)
|
||||
boy.hitPartsLimit = true
|
||||
boy.emit('partsLimit')
|
||||
return skipPart(part)
|
||||
}
|
||||
|
||||
// hack because streams2 _always_ doesn't emit 'end' until nextTick, so let
|
||||
// us emit 'end' early since we know the part has ended if we are already
|
||||
// seeing the next part
|
||||
if (curField) {
|
||||
const field = curField
|
||||
field.emit('end')
|
||||
field.removeAllListeners('end')
|
||||
}
|
||||
|
||||
part.on('header', function (header) {
|
||||
let contype
|
||||
let fieldname
|
||||
let parsed
|
||||
let charset
|
||||
let encoding
|
||||
let filename
|
||||
let nsize = 0
|
||||
|
||||
if (header['content-type']) {
|
||||
parsed = parseParams(header['content-type'][0])
|
||||
if (parsed[0]) {
|
||||
contype = parsed[0].toLowerCase()
|
||||
for (i = 0, len = parsed.length; i < len; ++i) {
|
||||
if (RE_CHARSET.test(parsed[i][0])) {
|
||||
charset = parsed[i][1].toLowerCase()
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (contype === undefined) { contype = 'text/plain' }
|
||||
if (charset === undefined) { charset = defCharset }
|
||||
|
||||
if (header['content-disposition']) {
|
||||
parsed = parseParams(header['content-disposition'][0])
|
||||
if (!RE_FIELD.test(parsed[0])) { return skipPart(part) }
|
||||
for (i = 0, len = parsed.length; i < len; ++i) {
|
||||
if (RE_NAME.test(parsed[i][0])) {
|
||||
fieldname = parsed[i][1]
|
||||
} else if (RE_FILENAME.test(parsed[i][0])) {
|
||||
filename = parsed[i][1]
|
||||
if (!preservePath) { filename = basename(filename) }
|
||||
}
|
||||
}
|
||||
} else { return skipPart(part) }
|
||||
|
||||
if (header['content-transfer-encoding']) { encoding = header['content-transfer-encoding'][0].toLowerCase() } else { encoding = '7bit' }
|
||||
|
||||
let onData,
|
||||
onEnd
|
||||
|
||||
if (isPartAFile(fieldname, contype, filename)) {
|
||||
// file/binary field
|
||||
if (nfiles === filesLimit) {
|
||||
if (!boy.hitFilesLimit) {
|
||||
boy.hitFilesLimit = true
|
||||
boy.emit('filesLimit')
|
||||
}
|
||||
return skipPart(part)
|
||||
}
|
||||
|
||||
++nfiles
|
||||
|
||||
if (!boy._events.file) {
|
||||
self.parser._ignore()
|
||||
return
|
||||
}
|
||||
|
||||
++nends
|
||||
const file = new FileStream(fileOpts)
|
||||
curFile = file
|
||||
file.on('end', function () {
|
||||
--nends
|
||||
self._pause = false
|
||||
checkFinished()
|
||||
if (self._cb && !self._needDrain) {
|
||||
const cb = self._cb
|
||||
self._cb = undefined
|
||||
cb()
|
||||
}
|
||||
})
|
||||
file._read = function (n) {
|
||||
if (!self._pause) { return }
|
||||
self._pause = false
|
||||
if (self._cb && !self._needDrain) {
|
||||
const cb = self._cb
|
||||
self._cb = undefined
|
||||
cb()
|
||||
}
|
||||
}
|
||||
boy.emit('file', fieldname, file, filename, encoding, contype)
|
||||
|
||||
onData = function (data) {
|
||||
if ((nsize += data.length) > fileSizeLimit) {
|
||||
const extralen = fileSizeLimit - nsize + data.length
|
||||
if (extralen > 0) { file.push(data.slice(0, extralen)) }
|
||||
file.truncated = true
|
||||
file.bytesRead = fileSizeLimit
|
||||
part.removeAllListeners('data')
|
||||
file.emit('limit')
|
||||
return
|
||||
} else if (!file.push(data)) { self._pause = true }
|
||||
|
||||
file.bytesRead = nsize
|
||||
}
|
||||
|
||||
onEnd = function () {
|
||||
curFile = undefined
|
||||
file.push(null)
|
||||
}
|
||||
} else {
|
||||
// non-file field
|
||||
if (nfields === fieldsLimit) {
|
||||
if (!boy.hitFieldsLimit) {
|
||||
boy.hitFieldsLimit = true
|
||||
boy.emit('fieldsLimit')
|
||||
}
|
||||
return skipPart(part)
|
||||
}
|
||||
|
||||
++nfields
|
||||
++nends
|
||||
let buffer = ''
|
||||
let truncated = false
|
||||
curField = part
|
||||
|
||||
onData = function (data) {
|
||||
if ((nsize += data.length) > fieldSizeLimit) {
|
||||
const extralen = (fieldSizeLimit - (nsize - data.length))
|
||||
buffer += data.toString('binary', 0, extralen)
|
||||
truncated = true
|
||||
part.removeAllListeners('data')
|
||||
} else { buffer += data.toString('binary') }
|
||||
}
|
||||
|
||||
onEnd = function () {
|
||||
curField = undefined
|
||||
if (buffer.length) { buffer = decodeText(buffer, 'binary', charset) }
|
||||
boy.emit('field', fieldname, buffer, false, truncated, encoding, contype)
|
||||
--nends
|
||||
checkFinished()
|
||||
}
|
||||
}
|
||||
|
||||
/* As of node@2efe4ab761666 (v0.10.29+/v0.11.14+), busboy had become
|
||||
broken. Streams2/streams3 is a huge black box of confusion, but
|
||||
somehow overriding the sync state seems to fix things again (and still
|
||||
seems to work for previous node versions).
|
||||
*/
|
||||
part._readableState.sync = false
|
||||
|
||||
part.on('data', onData)
|
||||
part.on('end', onEnd)
|
||||
}).on('error', function (err) {
|
||||
if (curFile) { curFile.emit('error', err) }
|
||||
})
|
||||
}).on('error', function (err) {
|
||||
boy.emit('error', err)
|
||||
}).on('finish', function () {
|
||||
finished = true
|
||||
checkFinished()
|
||||
})
|
||||
}
|
||||
|
||||
Multipart.prototype.write = function (chunk, cb) {
|
||||
const r = this.parser.write(chunk)
|
||||
if (r && !this._pause) {
|
||||
cb()
|
||||
} else {
|
||||
this._needDrain = !r
|
||||
this._cb = cb
|
||||
}
|
||||
}
|
||||
|
||||
Multipart.prototype.end = function () {
|
||||
const self = this
|
||||
|
||||
if (self.parser.writable) {
|
||||
self.parser.end()
|
||||
} else if (!self._boy._done) {
|
||||
process.nextTick(function () {
|
||||
self._boy._done = true
|
||||
self._boy.emit('finish')
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function skipPart (part) {
|
||||
part.resume()
|
||||
}
|
||||
|
||||
function FileStream (opts) {
|
||||
Readable.call(this, opts)
|
||||
|
||||
this.bytesRead = 0
|
||||
|
||||
this.truncated = false
|
||||
}
|
||||
|
||||
inherits(FileStream, Readable)
|
||||
|
||||
FileStream.prototype._read = function (n) {}
|
||||
|
||||
module.exports = Multipart
|
190
node_modules/@fastify/busboy/lib/types/urlencoded.js
generated
vendored
Normal file
190
node_modules/@fastify/busboy/lib/types/urlencoded.js
generated
vendored
Normal file
@ -0,0 +1,190 @@
|
||||
'use strict'
|
||||
|
||||
const Decoder = require('../utils/Decoder')
|
||||
const decodeText = require('../utils/decodeText')
|
||||
const getLimit = require('../utils/getLimit')
|
||||
|
||||
const RE_CHARSET = /^charset$/i
|
||||
|
||||
UrlEncoded.detect = /^application\/x-www-form-urlencoded/i
|
||||
function UrlEncoded (boy, cfg) {
|
||||
const limits = cfg.limits
|
||||
const parsedConType = cfg.parsedConType
|
||||
this.boy = boy
|
||||
|
||||
this.fieldSizeLimit = getLimit(limits, 'fieldSize', 1 * 1024 * 1024)
|
||||
this.fieldNameSizeLimit = getLimit(limits, 'fieldNameSize', 100)
|
||||
this.fieldsLimit = getLimit(limits, 'fields', Infinity)
|
||||
|
||||
let charset
|
||||
for (var i = 0, len = parsedConType.length; i < len; ++i) { // eslint-disable-line no-var
|
||||
if (Array.isArray(parsedConType[i]) &&
|
||||
RE_CHARSET.test(parsedConType[i][0])) {
|
||||
charset = parsedConType[i][1].toLowerCase()
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if (charset === undefined) { charset = cfg.defCharset || 'utf8' }
|
||||
|
||||
this.decoder = new Decoder()
|
||||
this.charset = charset
|
||||
this._fields = 0
|
||||
this._state = 'key'
|
||||
this._checkingBytes = true
|
||||
this._bytesKey = 0
|
||||
this._bytesVal = 0
|
||||
this._key = ''
|
||||
this._val = ''
|
||||
this._keyTrunc = false
|
||||
this._valTrunc = false
|
||||
this._hitLimit = false
|
||||
}
|
||||
|
||||
UrlEncoded.prototype.write = function (data, cb) {
|
||||
if (this._fields === this.fieldsLimit) {
|
||||
if (!this.boy.hitFieldsLimit) {
|
||||
this.boy.hitFieldsLimit = true
|
||||
this.boy.emit('fieldsLimit')
|
||||
}
|
||||
return cb()
|
||||
}
|
||||
|
||||
let idxeq; let idxamp; let i; let p = 0; const len = data.length
|
||||
|
||||
while (p < len) {
|
||||
if (this._state === 'key') {
|
||||
idxeq = idxamp = undefined
|
||||
for (i = p; i < len; ++i) {
|
||||
if (!this._checkingBytes) { ++p }
|
||||
if (data[i] === 0x3D/* = */) {
|
||||
idxeq = i
|
||||
break
|
||||
} else if (data[i] === 0x26/* & */) {
|
||||
idxamp = i
|
||||
break
|
||||
}
|
||||
if (this._checkingBytes && this._bytesKey === this.fieldNameSizeLimit) {
|
||||
this._hitLimit = true
|
||||
break
|
||||
} else if (this._checkingBytes) { ++this._bytesKey }
|
||||
}
|
||||
|
||||
if (idxeq !== undefined) {
|
||||
// key with assignment
|
||||
if (idxeq > p) { this._key += this.decoder.write(data.toString('binary', p, idxeq)) }
|
||||
this._state = 'val'
|
||||
|
||||
this._hitLimit = false
|
||||
this._checkingBytes = true
|
||||
this._val = ''
|
||||
this._bytesVal = 0
|
||||
this._valTrunc = false
|
||||
this.decoder.reset()
|
||||
|
||||
p = idxeq + 1
|
||||
} else if (idxamp !== undefined) {
|
||||
// key with no assignment
|
||||
++this._fields
|
||||
let key; const keyTrunc = this._keyTrunc
|
||||
if (idxamp > p) { key = (this._key += this.decoder.write(data.toString('binary', p, idxamp))) } else { key = this._key }
|
||||
|
||||
this._hitLimit = false
|
||||
this._checkingBytes = true
|
||||
this._key = ''
|
||||
this._bytesKey = 0
|
||||
this._keyTrunc = false
|
||||
this.decoder.reset()
|
||||
|
||||
if (key.length) {
|
||||
this.boy.emit('field', decodeText(key, 'binary', this.charset),
|
||||
'',
|
||||
keyTrunc,
|
||||
false)
|
||||
}
|
||||
|
||||
p = idxamp + 1
|
||||
if (this._fields === this.fieldsLimit) { return cb() }
|
||||
} else if (this._hitLimit) {
|
||||
// we may not have hit the actual limit if there are encoded bytes...
|
||||
if (i > p) { this._key += this.decoder.write(data.toString('binary', p, i)) }
|
||||
p = i
|
||||
if ((this._bytesKey = this._key.length) === this.fieldNameSizeLimit) {
|
||||
// yep, we actually did hit the limit
|
||||
this._checkingBytes = false
|
||||
this._keyTrunc = true
|
||||
}
|
||||
} else {
|
||||
if (p < len) { this._key += this.decoder.write(data.toString('binary', p)) }
|
||||
p = len
|
||||
}
|
||||
} else {
|
||||
idxamp = undefined
|
||||
for (i = p; i < len; ++i) {
|
||||
if (!this._checkingBytes) { ++p }
|
||||
if (data[i] === 0x26/* & */) {
|
||||
idxamp = i
|
||||
break
|
||||
}
|
||||
if (this._checkingBytes && this._bytesVal === this.fieldSizeLimit) {
|
||||
this._hitLimit = true
|
||||
break
|
||||
} else if (this._checkingBytes) { ++this._bytesVal }
|
||||
}
|
||||
|
||||
if (idxamp !== undefined) {
|
||||
++this._fields
|
||||
if (idxamp > p) { this._val += this.decoder.write(data.toString('binary', p, idxamp)) }
|
||||
this.boy.emit('field', decodeText(this._key, 'binary', this.charset),
|
||||
decodeText(this._val, 'binary', this.charset),
|
||||
this._keyTrunc,
|
||||
this._valTrunc)
|
||||
this._state = 'key'
|
||||
|
||||
this._hitLimit = false
|
||||
this._checkingBytes = true
|
||||
this._key = ''
|
||||
this._bytesKey = 0
|
||||
this._keyTrunc = false
|
||||
this.decoder.reset()
|
||||
|
||||
p = idxamp + 1
|
||||
if (this._fields === this.fieldsLimit) { return cb() }
|
||||
} else if (this._hitLimit) {
|
||||
// we may not have hit the actual limit if there are encoded bytes...
|
||||
if (i > p) { this._val += this.decoder.write(data.toString('binary', p, i)) }
|
||||
p = i
|
||||
if ((this._val === '' && this.fieldSizeLimit === 0) ||
|
||||
(this._bytesVal = this._val.length) === this.fieldSizeLimit) {
|
||||
// yep, we actually did hit the limit
|
||||
this._checkingBytes = false
|
||||
this._valTrunc = true
|
||||
}
|
||||
} else {
|
||||
if (p < len) { this._val += this.decoder.write(data.toString('binary', p)) }
|
||||
p = len
|
||||
}
|
||||
}
|
||||
}
|
||||
cb()
|
||||
}
|
||||
|
||||
UrlEncoded.prototype.end = function () {
|
||||
if (this.boy._done) { return }
|
||||
|
||||
if (this._state === 'key' && this._key.length > 0) {
|
||||
this.boy.emit('field', decodeText(this._key, 'binary', this.charset),
|
||||
'',
|
||||
this._keyTrunc,
|
||||
false)
|
||||
} else if (this._state === 'val') {
|
||||
this.boy.emit('field', decodeText(this._key, 'binary', this.charset),
|
||||
decodeText(this._val, 'binary', this.charset),
|
||||
this._keyTrunc,
|
||||
this._valTrunc)
|
||||
}
|
||||
this.boy._done = true
|
||||
this.boy.emit('finish')
|
||||
}
|
||||
|
||||
module.exports = UrlEncoded
|
54
node_modules/@fastify/busboy/lib/utils/Decoder.js
generated
vendored
Normal file
54
node_modules/@fastify/busboy/lib/utils/Decoder.js
generated
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
'use strict'
|
||||
|
||||
const RE_PLUS = /\+/g
|
||||
|
||||
const HEX = [
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,
|
||||
0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
]
|
||||
|
||||
function Decoder () {
|
||||
this.buffer = undefined
|
||||
}
|
||||
Decoder.prototype.write = function (str) {
|
||||
// Replace '+' with ' ' before decoding
|
||||
str = str.replace(RE_PLUS, ' ')
|
||||
let res = ''
|
||||
let i = 0; let p = 0; const len = str.length
|
||||
for (; i < len; ++i) {
|
||||
if (this.buffer !== undefined) {
|
||||
if (!HEX[str.charCodeAt(i)]) {
|
||||
res += '%' + this.buffer
|
||||
this.buffer = undefined
|
||||
--i // retry character
|
||||
} else {
|
||||
this.buffer += str[i]
|
||||
++p
|
||||
if (this.buffer.length === 2) {
|
||||
res += String.fromCharCode(parseInt(this.buffer, 16))
|
||||
this.buffer = undefined
|
||||
}
|
||||
}
|
||||
} else if (str[i] === '%') {
|
||||
if (i > p) {
|
||||
res += str.substring(p, i)
|
||||
p = i
|
||||
}
|
||||
this.buffer = ''
|
||||
++p
|
||||
}
|
||||
}
|
||||
if (p < len && this.buffer === undefined) { res += str.substring(p) }
|
||||
return res
|
||||
}
|
||||
Decoder.prototype.reset = function () {
|
||||
this.buffer = undefined
|
||||
}
|
||||
|
||||
module.exports = Decoder
|
14
node_modules/@fastify/busboy/lib/utils/basename.js
generated
vendored
Normal file
14
node_modules/@fastify/busboy/lib/utils/basename.js
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = function basename (path) {
|
||||
if (typeof path !== 'string') { return '' }
|
||||
for (var i = path.length - 1; i >= 0; --i) { // eslint-disable-line no-var
|
||||
switch (path.charCodeAt(i)) {
|
||||
case 0x2F: // '/'
|
||||
case 0x5C: // '\'
|
||||
path = path.slice(i + 1)
|
||||
return (path === '..' || path === '.' ? '' : path)
|
||||
}
|
||||
}
|
||||
return (path === '..' || path === '.' ? '' : path)
|
||||
}
|
26
node_modules/@fastify/busboy/lib/utils/decodeText.js
generated
vendored
Normal file
26
node_modules/@fastify/busboy/lib/utils/decodeText.js
generated
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
'use strict'
|
||||
|
||||
// Node has always utf-8
|
||||
const utf8Decoder = new TextDecoder('utf-8')
|
||||
const textDecoders = new Map([
|
||||
['utf-8', utf8Decoder],
|
||||
['utf8', utf8Decoder]
|
||||
])
|
||||
|
||||
function decodeText (text, textEncoding, destEncoding) {
|
||||
if (text) {
|
||||
if (textDecoders.has(destEncoding)) {
|
||||
try {
|
||||
return textDecoders.get(destEncoding).decode(Buffer.from(text, textEncoding))
|
||||
} catch (e) { }
|
||||
} else {
|
||||
try {
|
||||
textDecoders.set(destEncoding, new TextDecoder(destEncoding))
|
||||
return textDecoders.get(destEncoding).decode(Buffer.from(text, textEncoding))
|
||||
} catch (e) { }
|
||||
}
|
||||
}
|
||||
return text
|
||||
}
|
||||
|
||||
module.exports = decodeText
|
16
node_modules/@fastify/busboy/lib/utils/getLimit.js
generated
vendored
Normal file
16
node_modules/@fastify/busboy/lib/utils/getLimit.js
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = function getLimit (limits, name, defaultLimit) {
|
||||
if (
|
||||
!limits ||
|
||||
limits[name] === undefined ||
|
||||
limits[name] === null
|
||||
) { return defaultLimit }
|
||||
|
||||
if (
|
||||
typeof limits[name] !== 'number' ||
|
||||
isNaN(limits[name])
|
||||
) { throw new TypeError('Limit ' + name + ' is not a valid number') }
|
||||
|
||||
return limits[name]
|
||||
}
|
87
node_modules/@fastify/busboy/lib/utils/parseParams.js
generated
vendored
Normal file
87
node_modules/@fastify/busboy/lib/utils/parseParams.js
generated
vendored
Normal file
@ -0,0 +1,87 @@
|
||||
'use strict'
|
||||
|
||||
const decodeText = require('./decodeText')
|
||||
|
||||
const RE_ENCODED = /%([a-fA-F0-9]{2})/g
|
||||
|
||||
function encodedReplacer (match, byte) {
|
||||
return String.fromCharCode(parseInt(byte, 16))
|
||||
}
|
||||
|
||||
function parseParams (str) {
|
||||
const res = []
|
||||
let state = 'key'
|
||||
let charset = ''
|
||||
let inquote = false
|
||||
let escaping = false
|
||||
let p = 0
|
||||
let tmp = ''
|
||||
|
||||
for (var i = 0, len = str.length; i < len; ++i) { // eslint-disable-line no-var
|
||||
const char = str[i]
|
||||
if (char === '\\' && inquote) {
|
||||
if (escaping) { escaping = false } else {
|
||||
escaping = true
|
||||
continue
|
||||
}
|
||||
} else if (char === '"') {
|
||||
if (!escaping) {
|
||||
if (inquote) {
|
||||
inquote = false
|
||||
state = 'key'
|
||||
} else { inquote = true }
|
||||
continue
|
||||
} else { escaping = false }
|
||||
} else {
|
||||
if (escaping && inquote) { tmp += '\\' }
|
||||
escaping = false
|
||||
if ((state === 'charset' || state === 'lang') && char === "'") {
|
||||
if (state === 'charset') {
|
||||
state = 'lang'
|
||||
charset = tmp.substring(1)
|
||||
} else { state = 'value' }
|
||||
tmp = ''
|
||||
continue
|
||||
} else if (state === 'key' &&
|
||||
(char === '*' || char === '=') &&
|
||||
res.length) {
|
||||
if (char === '*') { state = 'charset' } else { state = 'value' }
|
||||
res[p] = [tmp, undefined]
|
||||
tmp = ''
|
||||
continue
|
||||
} else if (!inquote && char === ';') {
|
||||
state = 'key'
|
||||
if (charset) {
|
||||
if (tmp.length) {
|
||||
tmp = decodeText(tmp.replace(RE_ENCODED, encodedReplacer),
|
||||
'binary',
|
||||
charset)
|
||||
}
|
||||
charset = ''
|
||||
} else if (tmp.length) {
|
||||
tmp = decodeText(tmp, 'binary', 'utf8')
|
||||
}
|
||||
if (res[p] === undefined) { res[p] = tmp } else { res[p][1] = tmp }
|
||||
tmp = ''
|
||||
++p
|
||||
continue
|
||||
} else if (!inquote && (char === ' ' || char === '\t')) { continue }
|
||||
}
|
||||
tmp += char
|
||||
}
|
||||
if (charset && tmp.length) {
|
||||
tmp = decodeText(tmp.replace(RE_ENCODED, encodedReplacer),
|
||||
'binary',
|
||||
charset)
|
||||
} else if (tmp) {
|
||||
tmp = decodeText(tmp, 'binary', 'utf8')
|
||||
}
|
||||
|
||||
if (res[p] === undefined) {
|
||||
if (tmp) { res[p] = tmp }
|
||||
} else { res[p][1] = tmp }
|
||||
|
||||
return res
|
||||
}
|
||||
|
||||
module.exports = parseParams
|
89
node_modules/@fastify/busboy/package.json
generated
vendored
Normal file
89
node_modules/@fastify/busboy/package.json
generated
vendored
Normal file
@ -0,0 +1,89 @@
|
||||
{
|
||||
"name": "@fastify/busboy",
|
||||
"version": "2.0.0",
|
||||
"private": false,
|
||||
"author": "Brian White <mscdex@mscdex.net>",
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Igor Savin",
|
||||
"email": "kibertoad@gmail.com",
|
||||
"url": "https://github.com/kibertoad"
|
||||
},
|
||||
{
|
||||
"name": "Aras Abbasi",
|
||||
"email": "aras.abbasi@gmail.com",
|
||||
"url": "https://github.com/uzlopak"
|
||||
}
|
||||
],
|
||||
"description": "A streaming parser for HTML form data for node.js",
|
||||
"main": "lib/main",
|
||||
"types": "lib/main.d.ts",
|
||||
"scripts": {
|
||||
"bench:busboy": "cd benchmarks && npm install && npm run benchmark-fastify",
|
||||
"bench:dicer": "node bench/dicer/dicer-bench-multipart-parser.js",
|
||||
"coveralls": "nyc report --reporter=lcov",
|
||||
"lint": "npm run lint:standard",
|
||||
"lint:everything": "npm run lint && npm run test:types",
|
||||
"lint:fix": "standard --fix",
|
||||
"lint:standard": "standard --verbose | snazzy",
|
||||
"test:mocha": "mocha test",
|
||||
"test:types": "tsd",
|
||||
"test:coverage": "nyc npm run test",
|
||||
"test": "npm run test:mocha"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.1.0",
|
||||
"busboy": "^1.0.0",
|
||||
"chai": "^4.3.6",
|
||||
"eslint": "^8.23.0",
|
||||
"eslint-config-standard": "^17.0.0",
|
||||
"eslint-plugin-n": "^16.0.0",
|
||||
"mocha": "^10.0.0",
|
||||
"nyc": "^15.1.0",
|
||||
"photofinish": "^1.8.0",
|
||||
"snazzy": "^9.0.0",
|
||||
"standard": "^17.0.0",
|
||||
"tsd": "^0.29.0",
|
||||
"typescript": "^5.0.2"
|
||||
},
|
||||
"keywords": [
|
||||
"uploads",
|
||||
"forms",
|
||||
"multipart",
|
||||
"form-data"
|
||||
],
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/fastify/busboy.git"
|
||||
},
|
||||
"tsd": {
|
||||
"directory": "test/types",
|
||||
"compilerOptions": {
|
||||
"esModuleInterop": false,
|
||||
"module": "commonjs",
|
||||
"target": "ES2017"
|
||||
}
|
||||
},
|
||||
"standard": {
|
||||
"globals": [
|
||||
"describe",
|
||||
"it"
|
||||
],
|
||||
"ignore": [
|
||||
"bench"
|
||||
]
|
||||
},
|
||||
"files": [
|
||||
"README.md",
|
||||
"LICENSE",
|
||||
"lib/*",
|
||||
"deps/encoding/*",
|
||||
"deps/dicer/lib",
|
||||
"deps/streamsearch/",
|
||||
"deps/dicer/LICENSE"
|
||||
]
|
||||
}
|
61
node_modules/@octokit/auth-token/README.md
generated
vendored
61
node_modules/@octokit/auth-token/README.md
generated
vendored
@ -33,11 +33,11 @@ It is useful if you want to support multiple authentication strategies, as it’
|
||||
Browsers
|
||||
</th><td width=100%>
|
||||
|
||||
Load `@octokit/auth-token` directly from [cdn.pika.dev](https://cdn.pika.dev)
|
||||
Load `@octokit/auth-token` directly from [cdn.skypack.dev](https://cdn.skypack.dev)
|
||||
|
||||
```html
|
||||
<script type="module">
|
||||
import { createTokenAuth } from "https://cdn.pika.dev/@octokit/auth-token";
|
||||
import { createTokenAuth } from "https://cdn.skypack.dev/@octokit/auth-token";
|
||||
</script>
|
||||
```
|
||||
|
||||
@ -58,12 +58,13 @@ const { createTokenAuth } = require("@octokit/auth-token");
|
||||
</table>
|
||||
|
||||
```js
|
||||
const auth = createTokenAuth("1234567890abcdef1234567890abcdef12345678");
|
||||
const auth = createTokenAuth("ghp_PersonalAccessToken01245678900000000");
|
||||
const authentication = await auth();
|
||||
// {
|
||||
// type: 'token',
|
||||
// token: '1234567890abcdef1234567890abcdef12345678',
|
||||
// token: 'ghp_PersonalAccessToken01245678900000000',
|
||||
// tokenType: 'oauth'
|
||||
// }
|
||||
```
|
||||
|
||||
## `createTokenAuth(token) options`
|
||||
@ -72,17 +73,36 @@ The `createTokenAuth` method accepts a single argument of type string, which is
|
||||
|
||||
- [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/)
|
||||
- Installation access token ([GitHub App Installation](https://developer.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-an-installation))
|
||||
- [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("1234567890abcdef1234567890abcdef12345678");
|
||||
createTokenAuth("ghp_PersonalAccessToken01245678900000000");
|
||||
// {
|
||||
// type: 'token',
|
||||
// token: 'ghp_PersonalAccessToken01245678900000000',
|
||||
// tokenType: 'oauth'
|
||||
// }
|
||||
|
||||
// Installation access token or GitHub Action token
|
||||
createTokenAuth("v1.d3d433526f780fbcc3129004e2731b3904ad0b86");
|
||||
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()`
|
||||
@ -136,7 +156,7 @@ The `auth()` method has no options. It returns a promise which resolves with the
|
||||
<code>string</code>
|
||||
</th>
|
||||
<td>
|
||||
Can be either <code>"oauth"</code> for personal access tokens and OAuth tokens, or <code>"installation"</code> for installation access tokens (includes <code>GITHUB_TOKEN</code> provided to GitHub Actions)
|
||||
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>
|
||||
@ -180,14 +200,12 @@ Here is a list of things you can do to retrieve further information
|
||||
Note that this does not work for installations. There is no way to retrieve permissions based on an installation access tokens.
|
||||
|
||||
```js
|
||||
const TOKEN = "1234567890abcdef1234567890abcdef12345678";
|
||||
const TOKEN = "ghp_PersonalAccessToken01245678900000000";
|
||||
|
||||
const auth = createTokenAuth(TOKEN);
|
||||
const authentication = await auth();
|
||||
|
||||
const response = await request("HEAD /", {
|
||||
headers: authentication.headers,
|
||||
});
|
||||
const response = await request("HEAD /");
|
||||
const scopes = response.headers["x-oauth-scopes"].split(/,\s+/);
|
||||
|
||||
if (scopes.length) {
|
||||
@ -202,14 +220,12 @@ if (scopes.length) {
|
||||
### Find out if token is a personal access token or if it belongs to an OAuth app
|
||||
|
||||
```js
|
||||
const TOKEN = "1234567890abcdef1234567890abcdef12345678";
|
||||
const TOKEN = "ghp_PersonalAccessToken01245678900000000";
|
||||
|
||||
const auth = createTokenAuth(TOKEN);
|
||||
const authentication = await auth();
|
||||
|
||||
const response = await request("HEAD /", {
|
||||
headers: authentication.headers,
|
||||
});
|
||||
const response = await request("HEAD /");
|
||||
const clientId = response.headers["x-oauth-client-id"];
|
||||
|
||||
if (clientId) {
|
||||
@ -226,18 +242,17 @@ if (clientId) {
|
||||
Note that the `permissions` key is not set when authenticated using an installation access token.
|
||||
|
||||
```js
|
||||
const TOKEN = "1234567890abcdef1234567890abcdef12345678";
|
||||
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'
|
||||
headers: authentication.headers
|
||||
const response = await request("GET /repos/{owner}/{repo}", {
|
||||
owner: "octocat",
|
||||
repo: "hello-world",
|
||||
});
|
||||
|
||||
console.log(response.data.permissions)
|
||||
console.log(response.data.permissions);
|
||||
// {
|
||||
// admin: true,
|
||||
// push: true,
|
||||
@ -252,7 +267,7 @@ Both OAuth and installation access tokens can be used for git operations. Howeve
|
||||
This example is using the [`execa`](https://github.com/sindresorhus/execa) package to run a `git push` command.
|
||||
|
||||
```js
|
||||
const TOKEN = "1234567890abcdef1234567890abcdef12345678";
|
||||
const TOKEN = "ghp_PersonalAccessToken01245678900000000";
|
||||
|
||||
const auth = createTokenAuth(TOKEN);
|
||||
const { token, tokenType } = await auth();
|
||||
|
66
node_modules/@octokit/auth-token/dist-node/index.js
generated
vendored
66
node_modules/@octokit/auth-token/dist-node/index.js
generated
vendored
@ -1,49 +1,79 @@
|
||||
'use strict';
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
// pkg/dist-src/index.js
|
||||
var dist_src_exports = {};
|
||||
__export(dist_src_exports, {
|
||||
createTokenAuth: () => createTokenAuth
|
||||
});
|
||||
module.exports = __toCommonJS(dist_src_exports);
|
||||
|
||||
// pkg/dist-src/auth.js
|
||||
var REGEX_IS_INSTALLATION_LEGACY = /^v1\./;
|
||||
var REGEX_IS_INSTALLATION = /^ghs_/;
|
||||
var REGEX_IS_USER_TO_SERVER = /^ghu_/;
|
||||
async function auth(token) {
|
||||
const tokenType = token.split(/\./).length === 3 ? "app" : /^v\d+\./.test(token) ? "installation" : "oauth";
|
||||
const isApp = token.split(/\./).length === 3;
|
||||
const isInstallation = REGEX_IS_INSTALLATION_LEGACY.test(token) || REGEX_IS_INSTALLATION.test(token);
|
||||
const isUserToServer = REGEX_IS_USER_TO_SERVER.test(token);
|
||||
const tokenType = isApp ? "app" : isInstallation ? "installation" : isUserToServer ? "user-to-server" : "oauth";
|
||||
return {
|
||||
type: "token",
|
||||
token: token,
|
||||
token,
|
||||
tokenType
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Prefix token for usage in the Authorization header
|
||||
*
|
||||
* @param token OAuth token or JSON Web Token
|
||||
*/
|
||||
// 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);
|
||||
const endpoint = request.endpoint.merge(
|
||||
route,
|
||||
parameters
|
||||
);
|
||||
endpoint.headers.authorization = withAuthorizationPrefix(token);
|
||||
return request(endpoint);
|
||||
}
|
||||
|
||||
const createTokenAuth = function createTokenAuth(token) {
|
||||
// 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");
|
||||
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)
|
||||
});
|
||||
};
|
||||
|
||||
exports.createTokenAuth = createTokenAuth;
|
||||
//# sourceMappingURL=index.js.map
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
createTokenAuth
|
||||
});
|
||||
|
8
node_modules/@octokit/auth-token/dist-node/index.js.map
generated
vendored
8
node_modules/@octokit/auth-token/dist-node/index.js.map
generated
vendored
@ -1 +1,7 @@
|
||||
{"version":3,"file":"index.js","sources":["../dist-src/auth.js","../dist-src/with-authorization-prefix.js","../dist-src/hook.js","../dist-src/index.js"],"sourcesContent":["export async function auth(token) {\n const tokenType = token.split(/\\./).length === 3\n ? \"app\"\n : /^v\\d+\\./.test(token)\n ? \"installation\"\n : \"oauth\";\n return {\n type: \"token\",\n token: token,\n tokenType\n };\n}\n","/**\n * Prefix token for usage in the Authorization header\n *\n * @param token OAuth token or JSON Web Token\n */\nexport function withAuthorizationPrefix(token) {\n if (token.split(/\\./).length === 3) {\n return `bearer ${token}`;\n }\n return `token ${token}`;\n}\n","import { withAuthorizationPrefix } from \"./with-authorization-prefix\";\nexport async function hook(token, request, route, parameters) {\n const endpoint = request.endpoint.merge(route, parameters);\n endpoint.headers.authorization = withAuthorizationPrefix(token);\n return request(endpoint);\n}\n","import { auth } from \"./auth\";\nimport { hook } from \"./hook\";\nexport const createTokenAuth = function createTokenAuth(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(\"[@octokit/auth-token] Token passed to createTokenAuth is not a string\");\n }\n token = token.replace(/^(token|bearer) +/i, \"\");\n return Object.assign(auth.bind(null, token), {\n hook: hook.bind(null, token)\n });\n};\n"],"names":["auth","token","tokenType","split","length","test","type","withAuthorizationPrefix","hook","request","route","parameters","endpoint","merge","headers","authorization","createTokenAuth","Error","replace","Object","assign","bind"],"mappings":";;;;AAAO,eAAeA,IAAf,CAAoBC,KAApB,EAA2B;AAC9B,QAAMC,SAAS,GAAGD,KAAK,CAACE,KAAN,CAAY,IAAZ,EAAkBC,MAAlB,KAA6B,CAA7B,GACZ,KADY,GAEZ,UAAUC,IAAV,CAAeJ,KAAf,IACI,cADJ,GAEI,OAJV;AAKA,SAAO;AACHK,IAAAA,IAAI,EAAE,OADH;AAEHL,IAAAA,KAAK,EAAEA,KAFJ;AAGHC,IAAAA;AAHG,GAAP;AAKH;;ACXD;;;;;AAKA,AAAO,SAASK,uBAAT,CAAiCN,KAAjC,EAAwC;AAC3C,MAAIA,KAAK,CAACE,KAAN,CAAY,IAAZ,EAAkBC,MAAlB,KAA6B,CAAjC,EAAoC;AAChC,WAAQ,UAASH,KAAM,EAAvB;AACH;;AACD,SAAQ,SAAQA,KAAM,EAAtB;AACH;;ACTM,eAAeO,IAAf,CAAoBP,KAApB,EAA2BQ,OAA3B,EAAoCC,KAApC,EAA2CC,UAA3C,EAAuD;AAC1D,QAAMC,QAAQ,GAAGH,OAAO,CAACG,QAAR,CAAiBC,KAAjB,CAAuBH,KAAvB,EAA8BC,UAA9B,CAAjB;AACAC,EAAAA,QAAQ,CAACE,OAAT,CAAiBC,aAAjB,GAAiCR,uBAAuB,CAACN,KAAD,CAAxD;AACA,SAAOQ,OAAO,CAACG,QAAD,CAAd;AACH;;MCHYI,eAAe,GAAG,SAASA,eAAT,CAAyBf,KAAzB,EAAgC;AAC3D,MAAI,CAACA,KAAL,EAAY;AACR,UAAM,IAAIgB,KAAJ,CAAU,0DAAV,CAAN;AACH;;AACD,MAAI,OAAOhB,KAAP,KAAiB,QAArB,EAA+B;AAC3B,UAAM,IAAIgB,KAAJ,CAAU,uEAAV,CAAN;AACH;;AACDhB,EAAAA,KAAK,GAAGA,KAAK,CAACiB,OAAN,CAAc,oBAAd,EAAoC,EAApC,CAAR;AACA,SAAOC,MAAM,CAACC,MAAP,CAAcpB,IAAI,CAACqB,IAAL,CAAU,IAAV,EAAgBpB,KAAhB,CAAd,EAAsC;AACzCO,IAAAA,IAAI,EAAEA,IAAI,CAACa,IAAL,CAAU,IAAV,EAAgBpB,KAAhB;AADmC,GAAtC,CAAP;AAGH,CAXM;;;;"}
|
||||
{
|
||||
"version": 3,
|
||||
"sources": ["../dist-src/index.js", "../dist-src/auth.js", "../dist-src/with-authorization-prefix.js", "../dist-src/hook.js"],
|
||||
"sourcesContent": ["import { auth } from \"./auth\";\nimport { hook } from \"./hook\";\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", "const REGEX_IS_INSTALLATION_LEGACY = /^v1\\./;\nconst REGEX_IS_INSTALLATION = /^ghs_/;\nconst REGEX_IS_USER_TO_SERVER = /^ghu_/;\nasync function auth(token) {\n const isApp = token.split(/\\./).length === 3;\n const isInstallation = REGEX_IS_INSTALLATION_LEGACY.test(token) || REGEX_IS_INSTALLATION.test(token);\n const isUserToServer = REGEX_IS_USER_TO_SERVER.test(token);\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\";\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"],
|
||||
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAM,+BAA+B;AACrC,IAAM,wBAAwB;AAC9B,IAAM,0BAA0B;AAChC,eAAe,KAAK,OAAO;AACzB,QAAM,QAAQ,MAAM,MAAM,IAAI,EAAE,WAAW;AAC3C,QAAM,iBAAiB,6BAA6B,KAAK,KAAK,KAAK,sBAAsB,KAAK,KAAK;AACnG,QAAM,iBAAiB,wBAAwB,KAAK,KAAK;AACzD,QAAM,YAAY,QAAQ,QAAQ,iBAAiB,iBAAiB,iBAAiB,mBAAmB;AACxG,SAAO;AAAA,IACL,MAAM;AAAA,IACN;AAAA,IACA;AAAA,EACF;AACF;;;ACbA,SAAS,wBAAwB,OAAO;AACtC,MAAI,MAAM,MAAM,IAAI,EAAE,WAAW,GAAG;AAClC,WAAO,UAAU;AAAA,EACnB;AACA,SAAO,SAAS;AAClB;;;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;;;AHNA,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": []
|
||||
}
|
||||
|
27
node_modules/@octokit/auth-token/dist-src/auth.js
generated
vendored
27
node_modules/@octokit/auth-token/dist-src/auth.js
generated
vendored
@ -1,12 +1,17 @@
|
||||
export async function auth(token) {
|
||||
const tokenType = token.split(/\./).length === 3
|
||||
? "app"
|
||||
: /^v\d+\./.test(token)
|
||||
? "installation"
|
||||
: "oauth";
|
||||
return {
|
||||
type: "token",
|
||||
token: token,
|
||||
tokenType
|
||||
};
|
||||
const REGEX_IS_INSTALLATION_LEGACY = /^v1\./;
|
||||
const REGEX_IS_INSTALLATION = /^ghs_/;
|
||||
const REGEX_IS_USER_TO_SERVER = /^ghu_/;
|
||||
async function auth(token) {
|
||||
const isApp = token.split(/\./).length === 3;
|
||||
const isInstallation = REGEX_IS_INSTALLATION_LEGACY.test(token) || REGEX_IS_INSTALLATION.test(token);
|
||||
const isUserToServer = REGEX_IS_USER_TO_SERVER.test(token);
|
||||
const tokenType = isApp ? "app" : isInstallation ? "installation" : isUserToServer ? "user-to-server" : "oauth";
|
||||
return {
|
||||
type: "token",
|
||||
token,
|
||||
tokenType
|
||||
};
|
||||
}
|
||||
export {
|
||||
auth
|
||||
};
|
||||
|
14
node_modules/@octokit/auth-token/dist-src/hook.js
generated
vendored
14
node_modules/@octokit/auth-token/dist-src/hook.js
generated
vendored
@ -1,6 +1,12 @@
|
||||
import { withAuthorizationPrefix } from "./with-authorization-prefix";
|
||||
export async function hook(token, request, route, parameters) {
|
||||
const endpoint = request.endpoint.merge(route, parameters);
|
||||
endpoint.headers.authorization = withAuthorizationPrefix(token);
|
||||
return request(endpoint);
|
||||
async function hook(token, request, route, parameters) {
|
||||
const endpoint = request.endpoint.merge(
|
||||
route,
|
||||
parameters
|
||||
);
|
||||
endpoint.headers.authorization = withAuthorizationPrefix(token);
|
||||
return request(endpoint);
|
||||
}
|
||||
export {
|
||||
hook
|
||||
};
|
||||
|
27
node_modules/@octokit/auth-token/dist-src/index.js
generated
vendored
27
node_modules/@octokit/auth-token/dist-src/index.js
generated
vendored
@ -1,14 +1,19 @@
|
||||
import { auth } from "./auth";
|
||||
import { hook } from "./hook";
|
||||
export const createTokenAuth = function createTokenAuth(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)
|
||||
});
|
||||
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
|
||||
};
|
||||
|
0
node_modules/@octokit/auth-token/dist-src/types.js
generated
vendored
0
node_modules/@octokit/auth-token/dist-src/types.js
generated
vendored
18
node_modules/@octokit/auth-token/dist-src/with-authorization-prefix.js
generated
vendored
18
node_modules/@octokit/auth-token/dist-src/with-authorization-prefix.js
generated
vendored
@ -1,11 +1,9 @@
|
||||
/**
|
||||
* Prefix token for usage in the Authorization header
|
||||
*
|
||||
* @param token OAuth token or JSON Web Token
|
||||
*/
|
||||
export function withAuthorizationPrefix(token) {
|
||||
if (token.split(/\./).length === 3) {
|
||||
return `bearer ${token}`;
|
||||
}
|
||||
return `token ${token}`;
|
||||
function withAuthorizationPrefix(token) {
|
||||
if (token.split(/\./).length === 3) {
|
||||
return `bearer ${token}`;
|
||||
}
|
||||
return `token ${token}`;
|
||||
}
|
||||
export {
|
||||
withAuthorizationPrefix
|
||||
};
|
||||
|
2
node_modules/@octokit/auth-token/dist-types/auth.d.ts
generated
vendored
2
node_modules/@octokit/auth-token/dist-types/auth.d.ts
generated
vendored
@ -1,2 +1,2 @@
|
||||
import { Token, Authentication } from "./types";
|
||||
import type { Token, Authentication } from "./types";
|
||||
export declare function auth(token: Token): Promise<Authentication>;
|
||||
|
2
node_modules/@octokit/auth-token/dist-types/hook.d.ts
generated
vendored
2
node_modules/@octokit/auth-token/dist-types/hook.d.ts
generated
vendored
@ -1,2 +1,2 @@
|
||||
import { AnyResponse, EndpointOptions, RequestInterface, RequestParameters, Route, Token } from "./types";
|
||||
import type { AnyResponse, EndpointOptions, RequestInterface, RequestParameters, Route, Token } from "./types";
|
||||
export declare function hook(token: Token, request: RequestInterface, route: Route | EndpointOptions, parameters?: RequestParameters): Promise<AnyResponse>;
|
||||
|
4
node_modules/@octokit/auth-token/dist-types/index.d.ts
generated
vendored
4
node_modules/@octokit/auth-token/dist-types/index.d.ts
generated
vendored
@ -1,5 +1,5 @@
|
||||
import { StrategyInterface, Token, Authentication } from "./types";
|
||||
export declare type Types = {
|
||||
import type { StrategyInterface, Token, Authentication } from "./types";
|
||||
export type Types = {
|
||||
StrategyOptions: Token;
|
||||
AuthOptions: never;
|
||||
Authentication: Authentication;
|
||||
|
32
node_modules/@octokit/auth-token/dist-types/types.d.ts
generated
vendored
32
node_modules/@octokit/auth-token/dist-types/types.d.ts
generated
vendored
@ -1,25 +1,33 @@
|
||||
import * as OctokitTypes from "@octokit/types";
|
||||
export declare type AnyResponse = OctokitTypes.OctokitResponse<any>;
|
||||
export declare type StrategyInterface = OctokitTypes.StrategyInterface<[Token], [], Authentication>;
|
||||
export declare type EndpointDefaults = OctokitTypes.EndpointDefaults;
|
||||
export declare type EndpointOptions = OctokitTypes.EndpointOptions;
|
||||
export declare type RequestParameters = OctokitTypes.RequestParameters;
|
||||
export declare type RequestInterface = OctokitTypes.RequestInterface;
|
||||
export declare type Route = OctokitTypes.Route;
|
||||
export declare type Token = string;
|
||||
export declare type OAuthTokenAuthentication = {
|
||||
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 declare type InstallationTokenAuthentication = {
|
||||
export type InstallationTokenAuthentication = {
|
||||
type: "token";
|
||||
tokenType: "installation";
|
||||
token: Token;
|
||||
};
|
||||
export declare type AppAuthentication = {
|
||||
export type AppAuthentication = {
|
||||
type: "token";
|
||||
tokenType: "app";
|
||||
token: Token;
|
||||
};
|
||||
export declare type Authentication = OAuthTokenAuthentication | InstallationTokenAuthentication | AppAuthentication;
|
||||
export type UserToServerAuthentication = {
|
||||
type: "token";
|
||||
tokenType: "user-to-server";
|
||||
token: Token;
|
||||
};
|
||||
export type Authentication = OAuthTokenAuthentication | InstallationTokenAuthentication | AppAuthentication | UserToServerAuthentication;
|
||||
|
78
node_modules/@octokit/auth-token/dist-web/index.js
generated
vendored
78
node_modules/@octokit/auth-token/dist-web/index.js
generated
vendored
@ -1,46 +1,52 @@
|
||||
// pkg/dist-src/auth.js
|
||||
var REGEX_IS_INSTALLATION_LEGACY = /^v1\./;
|
||||
var REGEX_IS_INSTALLATION = /^ghs_/;
|
||||
var REGEX_IS_USER_TO_SERVER = /^ghu_/;
|
||||
async function auth(token) {
|
||||
const tokenType = token.split(/\./).length === 3
|
||||
? "app"
|
||||
: /^v\d+\./.test(token)
|
||||
? "installation"
|
||||
: "oauth";
|
||||
return {
|
||||
type: "token",
|
||||
token: token,
|
||||
tokenType
|
||||
};
|
||||
const isApp = token.split(/\./).length === 3;
|
||||
const isInstallation = REGEX_IS_INSTALLATION_LEGACY.test(token) || REGEX_IS_INSTALLATION.test(token);
|
||||
const isUserToServer = REGEX_IS_USER_TO_SERVER.test(token);
|
||||
const tokenType = isApp ? "app" : isInstallation ? "installation" : isUserToServer ? "user-to-server" : "oauth";
|
||||
return {
|
||||
type: "token",
|
||||
token,
|
||||
tokenType
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Prefix token for usage in the Authorization header
|
||||
*
|
||||
* @param token OAuth token or JSON Web Token
|
||||
*/
|
||||
// pkg/dist-src/with-authorization-prefix.js
|
||||
function withAuthorizationPrefix(token) {
|
||||
if (token.split(/\./).length === 3) {
|
||||
return `bearer ${token}`;
|
||||
}
|
||||
return `token ${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);
|
||||
const endpoint = request.endpoint.merge(
|
||||
route,
|
||||
parameters
|
||||
);
|
||||
endpoint.headers.authorization = withAuthorizationPrefix(token);
|
||||
return request(endpoint);
|
||||
}
|
||||
|
||||
const createTokenAuth = function createTokenAuth(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)
|
||||
});
|
||||
// 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
|
||||
};
|
||||
|
||||
export { createTokenAuth };
|
||||
//# sourceMappingURL=index.js.map
|
||||
|
8
node_modules/@octokit/auth-token/dist-web/index.js.map
generated
vendored
8
node_modules/@octokit/auth-token/dist-web/index.js.map
generated
vendored
@ -1 +1,7 @@
|
||||
{"version":3,"file":"index.js","sources":["../dist-src/auth.js","../dist-src/with-authorization-prefix.js","../dist-src/hook.js","../dist-src/index.js"],"sourcesContent":["export async function auth(token) {\n const tokenType = token.split(/\\./).length === 3\n ? \"app\"\n : /^v\\d+\\./.test(token)\n ? \"installation\"\n : \"oauth\";\n return {\n type: \"token\",\n token: token,\n tokenType\n };\n}\n","/**\n * Prefix token for usage in the Authorization header\n *\n * @param token OAuth token or JSON Web Token\n */\nexport function withAuthorizationPrefix(token) {\n if (token.split(/\\./).length === 3) {\n return `bearer ${token}`;\n }\n return `token ${token}`;\n}\n","import { withAuthorizationPrefix } from \"./with-authorization-prefix\";\nexport async function hook(token, request, route, parameters) {\n const endpoint = request.endpoint.merge(route, parameters);\n endpoint.headers.authorization = withAuthorizationPrefix(token);\n return request(endpoint);\n}\n","import { auth } from \"./auth\";\nimport { hook } from \"./hook\";\nexport const createTokenAuth = function createTokenAuth(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(\"[@octokit/auth-token] Token passed to createTokenAuth is not a string\");\n }\n token = token.replace(/^(token|bearer) +/i, \"\");\n return Object.assign(auth.bind(null, token), {\n hook: hook.bind(null, token)\n });\n};\n"],"names":[],"mappings":"AAAO,eAAe,IAAI,CAAC,KAAK,EAAE;AAClC,IAAI,MAAM,SAAS,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC;AACpD,UAAU,KAAK;AACf,UAAU,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC;AAC/B,cAAc,cAAc;AAC5B,cAAc,OAAO,CAAC;AACtB,IAAI,OAAO;AACX,QAAQ,IAAI,EAAE,OAAO;AACrB,QAAQ,KAAK,EAAE,KAAK;AACpB,QAAQ,SAAS;AACjB,KAAK,CAAC;AACN;;ACXA;AACA;AACA;AACA;AACA;AACA,AAAO,SAAS,uBAAuB,CAAC,KAAK,EAAE;AAC/C,IAAI,IAAI,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE;AACxC,QAAQ,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;AACjC,KAAK;AACL,IAAI,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;AAC5B,CAAC;;ACTM,eAAe,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE;AAC9D,IAAI,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;AAC/D,IAAI,QAAQ,CAAC,OAAO,CAAC,aAAa,GAAG,uBAAuB,CAAC,KAAK,CAAC,CAAC;AACpE,IAAI,OAAO,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC7B,CAAC;;ACHW,MAAC,eAAe,GAAG,SAAS,eAAe,CAAC,KAAK,EAAE;AAC/D,IAAI,IAAI,CAAC,KAAK,EAAE;AAChB,QAAQ,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAC;AACpF,KAAK;AACL,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;AACnC,QAAQ,MAAM,IAAI,KAAK,CAAC,uEAAuE,CAAC,CAAC;AACjG,KAAK;AACL,IAAI,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,oBAAoB,EAAE,EAAE,CAAC,CAAC;AACpD,IAAI,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE;AACjD,QAAQ,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC;AACpC,KAAK,CAAC,CAAC;AACP,CAAC;;;;"}
|
||||
{
|
||||
"version": 3,
|
||||
"sources": ["../dist-src/auth.js", "../dist-src/with-authorization-prefix.js", "../dist-src/hook.js", "../dist-src/index.js"],
|
||||
"sourcesContent": ["const REGEX_IS_INSTALLATION_LEGACY = /^v1\\./;\nconst REGEX_IS_INSTALLATION = /^ghs_/;\nconst REGEX_IS_USER_TO_SERVER = /^ghu_/;\nasync function auth(token) {\n const isApp = token.split(/\\./).length === 3;\n const isInstallation = REGEX_IS_INSTALLATION_LEGACY.test(token) || REGEX_IS_INSTALLATION.test(token);\n const isUserToServer = REGEX_IS_USER_TO_SERVER.test(token);\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\";\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\";\nimport { hook } from \"./hook\";\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,+BAA+B;AACrC,IAAM,wBAAwB;AAC9B,IAAM,0BAA0B;AAChC,eAAe,KAAK,OAAO;AACzB,QAAM,QAAQ,MAAM,MAAM,IAAI,EAAE,WAAW;AAC3C,QAAM,iBAAiB,6BAA6B,KAAK,KAAK,KAAK,sBAAsB,KAAK,KAAK;AACnG,QAAM,iBAAiB,wBAAwB,KAAK,KAAK;AACzD,QAAM,YAAY,QAAQ,QAAQ,iBAAiB,iBAAiB,iBAAiB,mBAAmB;AACxG,SAAO;AAAA,IACL,MAAM;AAAA,IACN;AAAA,IACA;AAAA,EACF;AACF;;;ACbA,SAAS,wBAAwB,OAAO;AACtC,MAAI,MAAM,MAAM,IAAI,EAAE,WAAW,GAAG;AAClC,WAAO,UAAU;AAAA,EACnB;AACA,SAAO,SAAS;AAClB;;;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": []
|
||||
}
|
||||
|
60
node_modules/@octokit/auth-token/package.json
generated
vendored
60
node_modules/@octokit/auth-token/package.json
generated
vendored
@ -1,48 +1,44 @@
|
||||
{
|
||||
"name": "@octokit/auth-token",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"version": "4.0.0",
|
||||
"description": "GitHub API token authentication for browsers and Node.js",
|
||||
"version": "2.4.2",
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"dist-*/",
|
||||
"bin/"
|
||||
],
|
||||
"pika": true,
|
||||
"sideEffects": false,
|
||||
"repository": "github:octokit/auth-token.js",
|
||||
"keywords": [
|
||||
"github",
|
||||
"octokit",
|
||||
"authentication",
|
||||
"api"
|
||||
],
|
||||
"homepage": "https://github.com/octokit/auth-token.js#readme",
|
||||
"bugs": {
|
||||
"url": "https://github.com/octokit/auth-token.js/issues"
|
||||
},
|
||||
"repository": "https://github.com/octokit/auth-token.js",
|
||||
"dependencies": {
|
||||
"@octokit/types": "^5.0.0"
|
||||
},
|
||||
"author": "Gregor Martynus (https://github.com/gr2m)",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@octokit/core": "^2.2.0",
|
||||
"@octokit/request": "^5.3.0",
|
||||
"@pika/pack": "^0.5.0",
|
||||
"@pika/plugin-build-node": "^0.9.0",
|
||||
"@pika/plugin-build-web": "^0.9.0",
|
||||
"@pika/plugin-ts-standard-pkg": "^0.9.0",
|
||||
"@octokit/request": "^6.0.0",
|
||||
"@octokit/tsconfig": "^2.0.0",
|
||||
"@octokit/types": "^9.2.3",
|
||||
"@types/fetch-mock": "^7.3.1",
|
||||
"@types/jest": "^26.0.0",
|
||||
"@types/jest": "^29.0.0",
|
||||
"esbuild": "^0.18.0",
|
||||
"fetch-mock": "^9.0.0",
|
||||
"jest": "^25.1.0",
|
||||
"semantic-release": "^17.0.0",
|
||||
"ts-jest": "^25.1.0",
|
||||
"typescript": "^3.7.2"
|
||||
"glob": "^10.2.6",
|
||||
"jest": "^29.0.0",
|
||||
"prettier": "2.8.8",
|
||||
"semantic-release": "^21.0.0",
|
||||
"ts-jest": "^29.0.0",
|
||||
"typescript": "^5.0.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
},
|
||||
"source": "dist-src/index.js",
|
||||
"types": "dist-types/index.d.ts",
|
||||
"files": [
|
||||
"dist-*/**",
|
||||
"bin/**"
|
||||
],
|
||||
"main": "dist-node/index.js",
|
||||
"module": "dist-web/index.js"
|
||||
"browser": "dist-web/index.js",
|
||||
"types": "dist-types/index.d.ts",
|
||||
"module": "dist-src/index.js",
|
||||
"sideEffects": false
|
||||
}
|
||||
|
48
node_modules/@octokit/core/README.md
generated
vendored
48
node_modules/@octokit/core/README.md
generated
vendored
@ -3,7 +3,7 @@
|
||||
> Extendable client for GitHub's REST & GraphQL APIs
|
||||
|
||||
[![@latest](https://img.shields.io/npm/v/@octokit/core.svg)](https://www.npmjs.com/package/@octokit/core)
|
||||
[![Build Status](https://github.com/octokit/core.js/workflows/Test/badge.svg)](https://github.com/octokit/core.js/actions?query=workflow%3ATest+branch%3Amaster)
|
||||
[![Build Status](https://github.com/octokit/core.js/workflows/Test/badge.svg)](https://github.com/octokit/core.js/actions?query=workflow%3ATest+branch%3Amain)
|
||||
|
||||
<!-- toc -->
|
||||
|
||||
@ -32,11 +32,11 @@ If you don't need the Plugin API then using [`@octokit/request`](https://github.
|
||||
<tr><th>
|
||||
Browsers
|
||||
</th><td width=100%>
|
||||
Load <code>@octokit/core</code> directly from <a href="https://cdn.pika.dev">cdn.pika.dev</a>
|
||||
|
||||
Load <code>@octokit/core</code> directly from <a href="https://esm.sh">esm.sh</a>
|
||||
|
||||
```html
|
||||
<script type="module">
|
||||
import { Octokit } from "https://cdn.pika.dev/@octokit/core";
|
||||
import { Octokit } from "https://esm.sh/@octokit/core";
|
||||
</script>
|
||||
```
|
||||
|
||||
@ -62,7 +62,7 @@ const { Octokit } = require("@octokit/core");
|
||||
// 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", {
|
||||
const response = await octokit.request("GET /orgs/{org}/repos", {
|
||||
org: "octokit",
|
||||
type: "private",
|
||||
});
|
||||
@ -83,7 +83,7 @@ const response = await octokit.graphql(
|
||||
}
|
||||
}
|
||||
}`,
|
||||
{ login: "octokit" }
|
||||
{ login: "octokit" },
|
||||
);
|
||||
```
|
||||
|
||||
@ -114,7 +114,7 @@ See [`@octokit/graphql`](https://github.com/octokit/graphql.js) for full documen
|
||||
<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.
|
||||
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>
|
||||
@ -125,7 +125,7 @@ See [`@octokit/graphql`](https://github.com/octokit/graphql.js) for full documen
|
||||
<code>String</code> or <code>Object</code>
|
||||
</td>
|
||||
<td>
|
||||
See <a href="authentication">Authentication</a> below for examples.
|
||||
See <a href="#authentication">Authentication</a> below for examples.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -159,14 +159,14 @@ 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", {
|
||||
octokit.request("POST /repos/{owner}/{repo}/pulls", {
|
||||
mediaType: {
|
||||
previews: ["shadow-cat"],
|
||||
},
|
||||
owner,
|
||||
repo,
|
||||
title: "My pull request",
|
||||
base: "master",
|
||||
base: "main",
|
||||
head: "my-feature",
|
||||
draft: true,
|
||||
});
|
||||
@ -271,7 +271,7 @@ 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, { opt2: 1 }),
|
||||
foo: Object.assign({}, options.foo, { opt1: 1 }),
|
||||
};
|
||||
});
|
||||
const octokit = new MyOctokit({
|
||||
@ -298,7 +298,9 @@ const octokit = new Octokit({
|
||||
const { data } = await octokit.request("/user");
|
||||
```
|
||||
|
||||
To use a different authentication strategy, set `options.authStrategy`. A set of officially supported authentication strategies can be retrieved from [`@octokit/auth`](https://github.com/octokit/auth-app.js#readme). Example
|
||||
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";
|
||||
@ -307,7 +309,7 @@ import { createAppAuth } from "@octokit/auth-app";
|
||||
const appOctokit = new Octokit({
|
||||
authStrategy: createAppAuth,
|
||||
auth: {
|
||||
id: 123,
|
||||
appId: 123,
|
||||
privateKey: process.env.PRIVATE_KEY,
|
||||
},
|
||||
});
|
||||
@ -358,7 +360,7 @@ octokit.hook.after("request", async (response, options) => {
|
||||
});
|
||||
octokit.hook.error("request", async (error, options) => {
|
||||
if (error.status === 304) {
|
||||
return findInCache(error.headers.etag);
|
||||
return findInCache(error.response.headers.etag);
|
||||
}
|
||||
|
||||
throw error;
|
||||
@ -380,7 +382,7 @@ 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.
|
||||
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
|
||||
@ -421,11 +423,19 @@ You can build your own Octokit class with preset default options and plugins. In
|
||||
```js
|
||||
const { Octokit } = require("@octokit/core");
|
||||
const MyActionOctokit = Octokit.plugin(
|
||||
require("@octokit/plugin-paginate"),
|
||||
require("@octokit/plugin-throttle"),
|
||||
require("@octokit/plugin-retry")
|
||||
require("@octokit/plugin-paginate-rest").paginateRest,
|
||||
require("@octokit/plugin-throttling").throttling,
|
||||
require("@octokit/plugin-retry").retry,
|
||||
).defaults({
|
||||
authStrategy: require("@octokit/auth-action"),
|
||||
throttle: {
|
||||
onAbuseLimit: (retryAfter, options) => {
|
||||
/* ... */
|
||||
},
|
||||
onRateLimit: (retryAfter, options) => {
|
||||
/* ... */
|
||||
},
|
||||
},
|
||||
authStrategy: require("@octokit/auth-action").createActionAuth,
|
||||
userAgent: `my-octokit-action/v1.2.3`,
|
||||
});
|
||||
|
||||
|
285
node_modules/@octokit/core/dist-node/index.js
generated
vendored
285
node_modules/@octokit/core/dist-node/index.js
generated
vendored
@ -1,176 +1,163 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var universalUserAgent = require('universal-user-agent');
|
||||
var beforeAfterHook = require('before-after-hook');
|
||||
var request = require('@octokit/request');
|
||||
var graphql = require('@octokit/graphql');
|
||||
var authToken = require('@octokit/auth-token');
|
||||
|
||||
function _defineProperty(obj, key, value) {
|
||||
if (key in obj) {
|
||||
Object.defineProperty(obj, key, {
|
||||
value: value,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true
|
||||
});
|
||||
} else {
|
||||
obj[key] = value;
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
return obj;
|
||||
}
|
||||
// pkg/dist-src/index.js
|
||||
var dist_src_exports = {};
|
||||
__export(dist_src_exports, {
|
||||
Octokit: () => Octokit
|
||||
});
|
||||
module.exports = __toCommonJS(dist_src_exports);
|
||||
var import_universal_user_agent = require("universal-user-agent");
|
||||
var import_before_after_hook = require("before-after-hook");
|
||||
var import_request = require("@octokit/request");
|
||||
var import_graphql = require("@octokit/graphql");
|
||||
var import_auth_token = require("@octokit/auth-token");
|
||||
|
||||
function ownKeys(object, enumerableOnly) {
|
||||
var keys = Object.keys(object);
|
||||
// pkg/dist-src/version.js
|
||||
var VERSION = "5.0.1";
|
||||
|
||||
if (Object.getOwnPropertySymbols) {
|
||||
var symbols = Object.getOwnPropertySymbols(object);
|
||||
if (enumerableOnly) symbols = symbols.filter(function (sym) {
|
||||
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
||||
});
|
||||
keys.push.apply(keys, symbols);
|
||||
// pkg/dist-src/index.js
|
||||
var Octokit = class {
|
||||
static {
|
||||
this.VERSION = VERSION;
|
||||
}
|
||||
|
||||
return keys;
|
||||
}
|
||||
|
||||
function _objectSpread2(target) {
|
||||
for (var i = 1; i < arguments.length; i++) {
|
||||
var source = arguments[i] != null ? arguments[i] : {};
|
||||
|
||||
if (i % 2) {
|
||||
ownKeys(Object(source), true).forEach(function (key) {
|
||||
_defineProperty(target, key, source[key]);
|
||||
});
|
||||
} else if (Object.getOwnPropertyDescriptors) {
|
||||
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
||||
} else {
|
||||
ownKeys(Object(source)).forEach(function (key) {
|
||||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return target;
|
||||
}
|
||||
|
||||
const VERSION = "3.1.1";
|
||||
|
||||
class Octokit {
|
||||
constructor(options = {}) {
|
||||
const hook = new beforeAfterHook.Collection();
|
||||
const requestDefaults = {
|
||||
baseUrl: request.request.endpoint.DEFAULTS.baseUrl,
|
||||
headers: {},
|
||||
request: Object.assign({}, options.request, {
|
||||
hook: hook.bind(null, "request")
|
||||
}),
|
||||
mediaType: {
|
||||
previews: [],
|
||||
format: ""
|
||||
}
|
||||
}; // prepend default user agent with `options.userAgent` if set
|
||||
|
||||
requestDefaults.headers["user-agent"] = [options.userAgent, `octokit-core.js/${VERSION} ${universalUserAgent.getUserAgent()}`].filter(Boolean).join(" ");
|
||||
|
||||
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.request.defaults(requestDefaults);
|
||||
this.graphql = graphql.withCustomRequest(this.request).defaults(_objectSpread2(_objectSpread2({}, requestDefaults), {}, {
|
||||
baseUrl: requestDefaults.baseUrl.replace(/\/api\/v3$/, "/api")
|
||||
}));
|
||||
this.log = Object.assign({
|
||||
debug: () => {},
|
||||
info: () => {},
|
||||
warn: console.warn.bind(console),
|
||||
error: console.error.bind(console)
|
||||
}, options.log);
|
||||
this.hook = hook; // (1) If neither `options.authStrategy` nor `options.auth` are set, the `octokit` instance
|
||||
// is unauthenticated. The `this.auth()` method is a no-op and no request hook is registred.
|
||||
// (2) If only `options.auth` is set, use the default token authentication strategy.
|
||||
// (3) If `options.authStrategy` is set then use it and pass in `options.auth`. Always pass own request as many strategies accept a custom request instance.
|
||||
// TODO: type `options.auth` based on `options.authStrategy`.
|
||||
|
||||
if (!options.authStrategy) {
|
||||
if (!options.auth) {
|
||||
// (1)
|
||||
this.auth = async () => ({
|
||||
type: "unauthenticated"
|
||||
});
|
||||
} else {
|
||||
// (2)
|
||||
const auth = authToken.createTokenAuth(options.auth); // @ts-ignore ¯\_(ツ)_/¯
|
||||
|
||||
hook.wrap("request", auth.hook);
|
||||
this.auth = auth;
|
||||
}
|
||||
} else {
|
||||
const auth = options.authStrategy(Object.assign({
|
||||
request: this.request
|
||||
}, options.auth)); // @ts-ignore ¯\_(ツ)_/¯
|
||||
|
||||
hook.wrap("request", auth.hook);
|
||||
this.auth = auth;
|
||||
} // apply plugins
|
||||
// https://stackoverflow.com/a/16345172
|
||||
|
||||
|
||||
const classConstructor = this.constructor;
|
||||
classConstructor.plugins.forEach(plugin => {
|
||||
Object.assign(this, plugin(this, options));
|
||||
});
|
||||
}
|
||||
|
||||
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));
|
||||
super(
|
||||
Object.assign(
|
||||
{},
|
||||
defaults,
|
||||
options,
|
||||
options.userAgent && defaults.userAgent ? {
|
||||
userAgent: `${options.userAgent} ${defaults.userAgent}`
|
||||
} : null
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
};
|
||||
return OctokitWithDefaults;
|
||||
}
|
||||
static {
|
||||
this.plugins = [];
|
||||
}
|
||||
/**
|
||||
* Attach a plugin (or many) to your Octokit instance.
|
||||
*
|
||||
* @example
|
||||
* const API = Octokit.plugin(plugin1, plugin2, plugin3, ...)
|
||||
*/
|
||||
|
||||
|
||||
static plugin(...newPlugins) {
|
||||
var _a;
|
||||
|
||||
const currentPlugins = this.plugins;
|
||||
const NewOctokit = (_a = class extends this {}, _a.plugins = currentPlugins.concat(newPlugins.filter(plugin => !currentPlugins.includes(plugin))), _a);
|
||||
const NewOctokit = class extends this {
|
||||
static {
|
||||
this.plugins = currentPlugins.concat(
|
||||
newPlugins.filter((plugin) => !currentPlugins.includes(plugin))
|
||||
);
|
||||
}
|
||||
};
|
||||
return NewOctokit;
|
||||
}
|
||||
|
||||
}
|
||||
Octokit.VERSION = VERSION;
|
||||
Octokit.plugins = [];
|
||||
|
||||
exports.Octokit = Octokit;
|
||||
//# sourceMappingURL=index.js.map
|
||||
constructor(options = {}) {
|
||||
const hook = new import_before_after_hook.Collection();
|
||||
const requestDefaults = {
|
||||
baseUrl: import_request.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,
|
||||
`octokit-core.js/${VERSION} ${(0, import_universal_user_agent.getUserAgent)()}`
|
||||
].filter(Boolean).join(" ");
|
||||
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 = import_request.request.defaults(requestDefaults);
|
||||
this.graphql = (0, import_graphql.withCustomRequest)(this.request).defaults(requestDefaults);
|
||||
this.log = Object.assign(
|
||||
{
|
||||
debug: () => {
|
||||
},
|
||||
info: () => {
|
||||
},
|
||||
warn: console.warn.bind(console),
|
||||
error: console.error.bind(console)
|
||||
},
|
||||
options.log
|
||||
);
|
||||
this.hook = hook;
|
||||
if (!options.authStrategy) {
|
||||
if (!options.auth) {
|
||||
this.auth = async () => ({
|
||||
type: "unauthenticated"
|
||||
});
|
||||
} else {
|
||||
const auth = (0, import_auth_token.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;
|
||||
classConstructor.plugins.forEach((plugin) => {
|
||||
Object.assign(this, plugin(this, options));
|
||||
});
|
||||
}
|
||||
};
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
Octokit
|
||||
});
|
||||
|
8
node_modules/@octokit/core/dist-node/index.js.map
generated
vendored
8
node_modules/@octokit/core/dist-node/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
233
node_modules/@octokit/core/dist-src/index.js
generated
vendored
233
node_modules/@octokit/core/dist-src/index.js
generated
vendored
@ -1,118 +1,133 @@
|
||||
import { getUserAgent } from "universal-user-agent";
|
||||
import { Collection } from "before-after-hook";
|
||||
import { request } from "@octokit/request";
|
||||
import { withCustomRequest } from "@octokit/graphql";
|
||||
import { graphql, withCustomRequest } from "@octokit/graphql";
|
||||
import { createTokenAuth } from "@octokit/auth-token";
|
||||
import { VERSION } from "./version";
|
||||
export class Octokit {
|
||||
constructor(options = {}) {
|
||||
const hook = new Collection();
|
||||
const requestDefaults = {
|
||||
baseUrl: request.endpoint.DEFAULTS.baseUrl,
|
||||
headers: {},
|
||||
request: Object.assign({}, options.request, {
|
||||
hook: hook.bind(null, "request"),
|
||||
}),
|
||||
mediaType: {
|
||||
previews: [],
|
||||
format: "",
|
||||
},
|
||||
};
|
||||
// prepend default user agent with `options.userAgent` if set
|
||||
requestDefaults.headers["user-agent"] = [
|
||||
options.userAgent,
|
||||
`octokit-core.js/${VERSION} ${getUserAgent()}`,
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join(" ");
|
||||
if (options.baseUrl) {
|
||||
requestDefaults.baseUrl = options.baseUrl;
|
||||
class Octokit {
|
||||
static {
|
||||
this.VERSION = VERSION;
|
||||
}
|
||||
static defaults(defaults) {
|
||||
const OctokitWithDefaults = class extends this {
|
||||
constructor(...args) {
|
||||
const options = args[0] || {};
|
||||
if (typeof defaults === "function") {
|
||||
super(defaults(options));
|
||||
return;
|
||||
}
|
||||
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,
|
||||
baseUrl: requestDefaults.baseUrl.replace(/\/api\/v3$/, "/api"),
|
||||
});
|
||||
this.log = Object.assign({
|
||||
debug: () => { },
|
||||
info: () => { },
|
||||
warn: console.warn.bind(console),
|
||||
error: console.error.bind(console),
|
||||
}, options.log);
|
||||
this.hook = hook;
|
||||
// (1) If neither `options.authStrategy` nor `options.auth` are set, the `octokit` instance
|
||||
// is unauthenticated. The `this.auth()` method is a no-op and no request hook is registred.
|
||||
// (2) If only `options.auth` is set, use the default token authentication strategy.
|
||||
// (3) If `options.authStrategy` is set then use it and pass in `options.auth`. Always pass own request as many strategies accept a custom request instance.
|
||||
// TODO: type `options.auth` based on `options.authStrategy`.
|
||||
if (!options.authStrategy) {
|
||||
if (!options.auth) {
|
||||
// (1)
|
||||
this.auth = async () => ({
|
||||
type: "unauthenticated",
|
||||
});
|
||||
}
|
||||
else {
|
||||
// (2)
|
||||
const auth = createTokenAuth(options.auth);
|
||||
// @ts-ignore ¯\_(ツ)_/¯
|
||||
hook.wrap("request", auth.hook);
|
||||
this.auth = auth;
|
||||
}
|
||||
}
|
||||
else {
|
||||
const auth = options.authStrategy(Object.assign({
|
||||
request: this.request,
|
||||
}, options.auth));
|
||||
// @ts-ignore ¯\_(ツ)_/¯
|
||||
hook.wrap("request", auth.hook);
|
||||
this.auth = auth;
|
||||
}
|
||||
// apply plugins
|
||||
// https://stackoverflow.com/a/16345172
|
||||
const classConstructor = this.constructor;
|
||||
classConstructor.plugins.forEach((plugin) => {
|
||||
Object.assign(this, plugin(this, options));
|
||||
super(
|
||||
Object.assign(
|
||||
{},
|
||||
defaults,
|
||||
options,
|
||||
options.userAgent && defaults.userAgent ? {
|
||||
userAgent: `${options.userAgent} ${defaults.userAgent}`
|
||||
} : null
|
||||
)
|
||||
);
|
||||
}
|
||||
};
|
||||
return OctokitWithDefaults;
|
||||
}
|
||||
static {
|
||||
this.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 {
|
||||
this.plugins = currentPlugins.concat(
|
||||
newPlugins.filter((plugin) => !currentPlugins.includes(plugin))
|
||||
);
|
||||
}
|
||||
};
|
||||
return NewOctokit;
|
||||
}
|
||||
constructor(options = {}) {
|
||||
const hook = new 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,
|
||||
`octokit-core.js/${VERSION} ${getUserAgent()}`
|
||||
].filter(Boolean).join(" ");
|
||||
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: () => {
|
||||
},
|
||||
info: () => {
|
||||
},
|
||||
warn: console.warn.bind(console),
|
||||
error: console.error.bind(console)
|
||||
},
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
/**
|
||||
* Attach a plugin (or many) to your Octokit instance.
|
||||
*
|
||||
* @example
|
||||
* const API = Octokit.plugin(plugin1, plugin2, plugin3, ...)
|
||||
*/
|
||||
static plugin(...newPlugins) {
|
||||
var _a;
|
||||
const currentPlugins = this.plugins;
|
||||
const NewOctokit = (_a = class extends this {
|
||||
},
|
||||
_a.plugins = currentPlugins.concat(newPlugins.filter((plugin) => !currentPlugins.includes(plugin))),
|
||||
_a);
|
||||
return NewOctokit;
|
||||
}
|
||||
const classConstructor = this.constructor;
|
||||
classConstructor.plugins.forEach((plugin) => {
|
||||
Object.assign(this, plugin(this, options));
|
||||
});
|
||||
}
|
||||
}
|
||||
Octokit.VERSION = VERSION;
|
||||
Octokit.plugins = [];
|
||||
export {
|
||||
Octokit
|
||||
};
|
||||
|
0
node_modules/@octokit/core/dist-src/types.js
generated
vendored
0
node_modules/@octokit/core/dist-src/types.js
generated
vendored
5
node_modules/@octokit/core/dist-src/version.js
generated
vendored
5
node_modules/@octokit/core/dist-src/version.js
generated
vendored
@ -1 +1,4 @@
|
||||
export const VERSION = "3.1.1";
|
||||
const VERSION = "5.0.1";
|
||||
export {
|
||||
VERSION
|
||||
};
|
||||
|
20
node_modules/@octokit/core/dist-types/index.d.ts
generated
vendored
20
node_modules/@octokit/core/dist-types/index.d.ts
generated
vendored
@ -1,14 +1,10 @@
|
||||
import { HookCollection } from "before-after-hook";
|
||||
import type { HookCollection } from "before-after-hook";
|
||||
import { request } from "@octokit/request";
|
||||
import { graphql } from "@octokit/graphql";
|
||||
import { Constructor, OctokitOptions, OctokitPlugin, ReturnTypeOf, UnionToIntersection } from "./types";
|
||||
import type { Constructor, Hooks, OctokitOptions, OctokitPlugin, ReturnTypeOf, UnionToIntersection } from "./types";
|
||||
export declare class Octokit {
|
||||
static VERSION: string;
|
||||
static defaults<S extends Constructor<any>>(this: S, defaults: OctokitOptions | Function): {
|
||||
new (...args: any[]): {
|
||||
[x: string]: any;
|
||||
};
|
||||
} & S;
|
||||
static defaults<S extends Constructor<any>>(this: S, defaults: OctokitOptions | Function): S;
|
||||
static plugins: OctokitPlugin[];
|
||||
/**
|
||||
* Attach a plugin (or many) to your Octokit instance.
|
||||
@ -18,12 +14,7 @@ export declare class Octokit {
|
||||
*/
|
||||
static plugin<S extends Constructor<any> & {
|
||||
plugins: any[];
|
||||
}, T extends OctokitPlugin[]>(this: S, ...newPlugins: T): {
|
||||
new (...args: any[]): {
|
||||
[x: string]: any;
|
||||
};
|
||||
plugins: any[];
|
||||
} & S & Constructor<UnionToIntersection<ReturnTypeOf<T>>>;
|
||||
}, T extends OctokitPlugin[]>(this: S, ...newPlugins: T): S & Constructor<UnionToIntersection<ReturnTypeOf<T>>>;
|
||||
constructor(options?: OctokitOptions);
|
||||
request: typeof request;
|
||||
graphql: typeof graphql;
|
||||
@ -34,7 +25,6 @@ export declare class Octokit {
|
||||
error: (message: string, additionalInfo?: object) => any;
|
||||
[key: string]: any;
|
||||
};
|
||||
hook: HookCollection;
|
||||
hook: HookCollection<Hooks>;
|
||||
auth: (...args: unknown[]) => Promise<unknown>;
|
||||
[key: string]: any;
|
||||
}
|
||||
|
38
node_modules/@octokit/core/dist-types/types.d.ts
generated
vendored
38
node_modules/@octokit/core/dist-types/types.d.ts
generated
vendored
@ -1,22 +1,44 @@
|
||||
import * as OctokitTypes from "@octokit/types";
|
||||
import { RequestError } from "@octokit/request-error";
|
||||
import { Octokit } from ".";
|
||||
export declare type RequestParameters = OctokitTypes.RequestParameters;
|
||||
export declare type OctokitOptions = {
|
||||
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 declare type Constructor<T> = new (...args: any[]) => T;
|
||||
export declare type ReturnTypeOf<T extends AnyFunction | AnyFunction[]> = T extends AnyFunction ? ReturnType<T> : T extends AnyFunction[] ? UnionToIntersection<ReturnType<T[number]>> : never;
|
||||
}
|
||||
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 declare type UnionToIntersection<Union> = (Union extends any ? (argument: Union) => void : never) extends (argument: infer Intersection) => void ? Intersection : never;
|
||||
declare type AnyFunction = (...args: any) => any;
|
||||
export declare type OctokitPlugin = (octokit: Octokit, options: OctokitOptions) => {
|
||||
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 {};
|
||||
|
2
node_modules/@octokit/core/dist-types/version.d.ts
generated
vendored
2
node_modules/@octokit/core/dist-types/version.d.ts
generated
vendored
@ -1 +1 @@
|
||||
export declare const VERSION = "3.1.1";
|
||||
export declare const VERSION = "5.0.1";
|
||||
|
251
node_modules/@octokit/core/dist-web/index.js
generated
vendored
251
node_modules/@octokit/core/dist-web/index.js
generated
vendored
@ -1,123 +1,138 @@
|
||||
import { getUserAgent } from 'universal-user-agent';
|
||||
import { Collection } from 'before-after-hook';
|
||||
import { request } from '@octokit/request';
|
||||
import { withCustomRequest } from '@octokit/graphql';
|
||||
import { createTokenAuth } from '@octokit/auth-token';
|
||||
// pkg/dist-src/index.js
|
||||
import { getUserAgent } from "universal-user-agent";
|
||||
import { Collection } from "before-after-hook";
|
||||
import { request } from "@octokit/request";
|
||||
import { graphql, withCustomRequest } from "@octokit/graphql";
|
||||
import { createTokenAuth } from "@octokit/auth-token";
|
||||
|
||||
const VERSION = "3.1.1";
|
||||
// pkg/dist-src/version.js
|
||||
var VERSION = "5.0.1";
|
||||
|
||||
class Octokit {
|
||||
constructor(options = {}) {
|
||||
const hook = new Collection();
|
||||
const requestDefaults = {
|
||||
baseUrl: request.endpoint.DEFAULTS.baseUrl,
|
||||
headers: {},
|
||||
request: Object.assign({}, options.request, {
|
||||
hook: hook.bind(null, "request"),
|
||||
}),
|
||||
mediaType: {
|
||||
previews: [],
|
||||
format: "",
|
||||
},
|
||||
};
|
||||
// prepend default user agent with `options.userAgent` if set
|
||||
requestDefaults.headers["user-agent"] = [
|
||||
options.userAgent,
|
||||
`octokit-core.js/${VERSION} ${getUserAgent()}`,
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join(" ");
|
||||
if (options.baseUrl) {
|
||||
requestDefaults.baseUrl = options.baseUrl;
|
||||
// pkg/dist-src/index.js
|
||||
var Octokit = class {
|
||||
static {
|
||||
this.VERSION = VERSION;
|
||||
}
|
||||
static defaults(defaults) {
|
||||
const OctokitWithDefaults = class extends this {
|
||||
constructor(...args) {
|
||||
const options = args[0] || {};
|
||||
if (typeof defaults === "function") {
|
||||
super(defaults(options));
|
||||
return;
|
||||
}
|
||||
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,
|
||||
baseUrl: requestDefaults.baseUrl.replace(/\/api\/v3$/, "/api"),
|
||||
});
|
||||
this.log = Object.assign({
|
||||
debug: () => { },
|
||||
info: () => { },
|
||||
warn: console.warn.bind(console),
|
||||
error: console.error.bind(console),
|
||||
}, options.log);
|
||||
this.hook = hook;
|
||||
// (1) If neither `options.authStrategy` nor `options.auth` are set, the `octokit` instance
|
||||
// is unauthenticated. The `this.auth()` method is a no-op and no request hook is registred.
|
||||
// (2) If only `options.auth` is set, use the default token authentication strategy.
|
||||
// (3) If `options.authStrategy` is set then use it and pass in `options.auth`. Always pass own request as many strategies accept a custom request instance.
|
||||
// TODO: type `options.auth` based on `options.authStrategy`.
|
||||
if (!options.authStrategy) {
|
||||
if (!options.auth) {
|
||||
// (1)
|
||||
this.auth = async () => ({
|
||||
type: "unauthenticated",
|
||||
});
|
||||
}
|
||||
else {
|
||||
// (2)
|
||||
const auth = createTokenAuth(options.auth);
|
||||
// @ts-ignore ¯\_(ツ)_/¯
|
||||
hook.wrap("request", auth.hook);
|
||||
this.auth = auth;
|
||||
}
|
||||
}
|
||||
else {
|
||||
const auth = options.authStrategy(Object.assign({
|
||||
request: this.request,
|
||||
}, options.auth));
|
||||
// @ts-ignore ¯\_(ツ)_/¯
|
||||
hook.wrap("request", auth.hook);
|
||||
this.auth = auth;
|
||||
}
|
||||
// apply plugins
|
||||
// https://stackoverflow.com/a/16345172
|
||||
const classConstructor = this.constructor;
|
||||
classConstructor.plugins.forEach((plugin) => {
|
||||
Object.assign(this, plugin(this, options));
|
||||
super(
|
||||
Object.assign(
|
||||
{},
|
||||
defaults,
|
||||
options,
|
||||
options.userAgent && defaults.userAgent ? {
|
||||
userAgent: `${options.userAgent} ${defaults.userAgent}`
|
||||
} : null
|
||||
)
|
||||
);
|
||||
}
|
||||
};
|
||||
return OctokitWithDefaults;
|
||||
}
|
||||
static {
|
||||
this.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 {
|
||||
this.plugins = currentPlugins.concat(
|
||||
newPlugins.filter((plugin) => !currentPlugins.includes(plugin))
|
||||
);
|
||||
}
|
||||
};
|
||||
return NewOctokit;
|
||||
}
|
||||
constructor(options = {}) {
|
||||
const hook = new 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,
|
||||
`octokit-core.js/${VERSION} ${getUserAgent()}`
|
||||
].filter(Boolean).join(" ");
|
||||
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: () => {
|
||||
},
|
||||
info: () => {
|
||||
},
|
||||
warn: console.warn.bind(console),
|
||||
error: console.error.bind(console)
|
||||
},
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
/**
|
||||
* Attach a plugin (or many) to your Octokit instance.
|
||||
*
|
||||
* @example
|
||||
* const API = Octokit.plugin(plugin1, plugin2, plugin3, ...)
|
||||
*/
|
||||
static plugin(...newPlugins) {
|
||||
var _a;
|
||||
const currentPlugins = this.plugins;
|
||||
const NewOctokit = (_a = class extends this {
|
||||
},
|
||||
_a.plugins = currentPlugins.concat(newPlugins.filter((plugin) => !currentPlugins.includes(plugin))),
|
||||
_a);
|
||||
return NewOctokit;
|
||||
}
|
||||
}
|
||||
Octokit.VERSION = VERSION;
|
||||
Octokit.plugins = [];
|
||||
|
||||
export { Octokit };
|
||||
//# sourceMappingURL=index.js.map
|
||||
const classConstructor = this.constructor;
|
||||
classConstructor.plugins.forEach((plugin) => {
|
||||
Object.assign(this, plugin(this, options));
|
||||
});
|
||||
}
|
||||
};
|
||||
export {
|
||||
Octokit
|
||||
};
|
||||
|
8
node_modules/@octokit/core/dist-web/index.js.map
generated
vendored
8
node_modules/@octokit/core/dist-web/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
75
node_modules/@octokit/core/package.json
generated
vendored
75
node_modules/@octokit/core/package.json
generated
vendored
@ -1,14 +1,11 @@
|
||||
{
|
||||
"name": "@octokit/core",
|
||||
"version": "5.0.1",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"description": "Extendable client for GitHub's REST & GraphQL APIs",
|
||||
"version": "3.1.1",
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"dist-*/",
|
||||
"bin/"
|
||||
],
|
||||
"pika": true,
|
||||
"sideEffects": false,
|
||||
"repository": "github:octokit/core.js",
|
||||
"keywords": [
|
||||
"octokit",
|
||||
"github",
|
||||
@ -16,42 +13,50 @@
|
||||
"sdk",
|
||||
"toolkit"
|
||||
],
|
||||
"repository": "https://github.com/octokit/core.js",
|
||||
"author": "Gregor Martynus (https://github.com/gr2m)",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@octokit/auth-token": "^2.4.0",
|
||||
"@octokit/graphql": "^4.3.1",
|
||||
"@octokit/request": "^5.4.0",
|
||||
"@octokit/types": "^5.0.0",
|
||||
"before-after-hook": "^2.1.0",
|
||||
"@octokit/auth-token": "^4.0.0",
|
||||
"@octokit/graphql": "^7.0.0",
|
||||
"@octokit/request": "^8.0.2",
|
||||
"@octokit/request-error": "^5.0.0",
|
||||
"@octokit/types": "^12.0.0",
|
||||
"before-after-hook": "^2.2.0",
|
||||
"universal-user-agent": "^6.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@octokit/auth": "^2.0.0",
|
||||
"@pika/pack": "^0.5.0",
|
||||
"@pika/plugin-build-node": "^0.9.0",
|
||||
"@pika/plugin-build-web": "^0.9.0",
|
||||
"@pika/plugin-ts-standard-pkg": "^0.9.0",
|
||||
"@octokit/auth-action": "^4.0.0",
|
||||
"@octokit/auth-app": "^6.0.0",
|
||||
"@octokit/auth-oauth-app": "^7.0.0",
|
||||
"@octokit/tsconfig": "^2.0.0",
|
||||
"@types/fetch-mock": "^7.3.1",
|
||||
"@types/jest": "^26.0.0",
|
||||
"@types/jest": "^29.0.0",
|
||||
"@types/lolex": "^5.1.0",
|
||||
"@types/node": "^14.0.4",
|
||||
"@types/node-fetch": "^2.5.0",
|
||||
"fetch-mock": "^9.0.0",
|
||||
"http-proxy-agent": "^4.0.1",
|
||||
"jest": "^25.1.0",
|
||||
"@types/node": "^18.0.0",
|
||||
"esbuild": "^0.19.0",
|
||||
"fetch-mock": "npm:@gr2m/fetch-mock@9.11.0-pull-request-644.1",
|
||||
"glob": "^10.2.5",
|
||||
"http-proxy-agent": "^7.0.0",
|
||||
"jest": "^29.0.0",
|
||||
"lolex": "^6.0.0",
|
||||
"prettier": "^2.0.4",
|
||||
"proxy": "^1.0.1",
|
||||
"semantic-release": "^17.0.0",
|
||||
"prettier": "3.0.3",
|
||||
"proxy": "^2.0.0",
|
||||
"semantic-release": "^22.0.0",
|
||||
"semantic-release-plugin-update-version-in-files": "^1.0.0",
|
||||
"ts-jest": "^25.1.0",
|
||||
"typescript": "^3.5.3"
|
||||
"ts-jest": "^29.0.0",
|
||||
"typescript": "^5.0.0",
|
||||
"undici": "5.25.2"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
},
|
||||
"source": "dist-src/index.js",
|
||||
"types": "dist-types/index.d.ts",
|
||||
"files": [
|
||||
"dist-*/**",
|
||||
"bin/**"
|
||||
],
|
||||
"main": "dist-node/index.js",
|
||||
"module": "dist-web/index.js"
|
||||
"module": "dist-web/index.js",
|
||||
"types": "dist-types/index.d.ts",
|
||||
"source": "dist-src/index.js",
|
||||
"sideEffects": false
|
||||
}
|
||||
|
35
node_modules/@octokit/endpoint/README.md
generated
vendored
35
node_modules/@octokit/endpoint/README.md
generated
vendored
@ -3,7 +3,7 @@
|
||||
> Turns GitHub REST API endpoints into generic request options
|
||||
|
||||
[![@latest](https://img.shields.io/npm/v/@octokit/endpoint.svg)](https://www.npmjs.com/package/@octokit/endpoint)
|
||||
![Build Status](https://github.com/octokit/endpoint.js/workflows/Test/badge.svg)
|
||||
[![Build Status](https://github.com/octokit/endpoint.js/workflows/Test/badge.svg)](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.
|
||||
|
||||
@ -32,11 +32,11 @@
|
||||
<tr><th>
|
||||
Browsers
|
||||
</th><td width=100%>
|
||||
Load <code>@octokit/endpoint</code> directly from <a href="https://cdn.pika.dev">cdn.pika.dev</a>
|
||||
|
||||
Load <code>@octokit/endpoint</code> directly from <a href="https://esm.sh">esm.sh</a>
|
||||
|
||||
```html
|
||||
<script type="module">
|
||||
import { endpoint } from "https://cdn.pika.dev/@octokit/endpoint";
|
||||
import { endpoint } from "https://esm.sh/@octokit/endpoint";
|
||||
</script>
|
||||
```
|
||||
|
||||
@ -59,7 +59,7 @@ const { endpoint } = require("@octokit/endpoint");
|
||||
Example for [List organization repositories](https://developer.github.com/v3/repos/#list-organization-repositories)
|
||||
|
||||
```js
|
||||
const requestOptions = endpoint("GET /orgs/:org/repos", {
|
||||
const requestOptions = endpoint("GET /orgs/{org}/repos", {
|
||||
headers: {
|
||||
authorization: "token 0000000000000000000000000000000000000001",
|
||||
},
|
||||
@ -123,7 +123,7 @@ axios(requestOptions);
|
||||
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>.
|
||||
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>
|
||||
@ -146,7 +146,7 @@ axios(requestOptions);
|
||||
</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>.
|
||||
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>
|
||||
@ -184,17 +184,6 @@ axios(requestOptions);
|
||||
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.mediaType.previews</code>
|
||||
</th>
|
||||
<td>
|
||||
Array of Strings
|
||||
</td>
|
||||
<td>
|
||||
Name of previews, such as <code>mercy</code>, <code>symmetra</code>, or <code>scarlet-witch</code>. See <a href="https://developer.github.com/v3/previews/">API Previews</a>. If <code>options.mediaType.previews</code> was set as default, the new previews will be merged into the default ones. Setting <code>options.mediaType.previews</code> will amend the <code>headers.accept</code> value. <code>options.mediaType.previews</code> will be merged with an existing array set using <code>.defaults()</code>.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<code>options.data</code>
|
||||
@ -222,7 +211,7 @@ axios(requestOptions);
|
||||
|
||||
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`.
|
||||
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.
|
||||
|
||||
@ -289,7 +278,7 @@ const myEndpoint = require("@octokit/endpoint").defaults({
|
||||
per_page: 100,
|
||||
});
|
||||
|
||||
request(myEndpoint(`GET /orgs/:org/repos`));
|
||||
request(myEndpoint(`GET /orgs/{org}/repos`));
|
||||
```
|
||||
|
||||
You can call `.defaults()` again on the returned method, the defaults will cascade.
|
||||
@ -337,7 +326,7 @@ const myProjectEndpoint = endpoint.defaults({
|
||||
},
|
||||
org: "my-project",
|
||||
});
|
||||
myProjectEndpoint.merge("GET /orgs/:org/repos", {
|
||||
myProjectEndpoint.merge("GET /orgs/{org}/repos", {
|
||||
headers: {
|
||||
authorization: `token 0000000000000000000000000000000000000001`,
|
||||
},
|
||||
@ -348,7 +337,7 @@ myProjectEndpoint.merge("GET /orgs/:org/repos", {
|
||||
// {
|
||||
// baseUrl: 'https://github-enterprise.acme-inc.com/api/v3',
|
||||
// method: 'GET',
|
||||
// url: '/orgs/:org/repos',
|
||||
// url: '/orgs/{org}/repos',
|
||||
// headers: {
|
||||
// accept: 'application/vnd.github.v3+json',
|
||||
// authorization: `token 0000000000000000000000000000000000000001`,
|
||||
@ -412,7 +401,7 @@ endpoint(
|
||||
authorization: `token 0000000000000000000000000000000000000001`,
|
||||
},
|
||||
data: "Hello, world!",
|
||||
}
|
||||
},
|
||||
);
|
||||
```
|
||||
|
||||
|
371
node_modules/@octokit/endpoint/dist-node/index.js
generated
vendored
371
node_modules/@octokit/endpoint/dist-node/index.js
generated
vendored
@ -1,186 +1,195 @@
|
||||
'use strict';
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
// pkg/dist-src/index.js
|
||||
var dist_src_exports = {};
|
||||
__export(dist_src_exports, {
|
||||
endpoint: () => endpoint
|
||||
});
|
||||
module.exports = __toCommonJS(dist_src_exports);
|
||||
|
||||
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
||||
// pkg/dist-src/defaults.js
|
||||
var import_universal_user_agent = require("universal-user-agent");
|
||||
|
||||
var isPlainObject = _interopDefault(require('is-plain-object'));
|
||||
var universalUserAgent = require('universal-user-agent');
|
||||
// pkg/dist-src/version.js
|
||||
var VERSION = "9.0.1";
|
||||
|
||||
// pkg/dist-src/defaults.js
|
||||
var userAgent = `octokit-endpoint.js/${VERSION} ${(0, import_universal_user_agent.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/merge-deep.js
|
||||
var import_is_plain_object = require("is-plain-object");
|
||||
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]);
|
||||
Object.keys(options).forEach((key) => {
|
||||
if ((0, import_is_plain_object.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]
|
||||
});
|
||||
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);
|
||||
options = Object.assign(url ? { method, url } : { url: method }, options);
|
||||
} else {
|
||||
options = Object.assign({}, route);
|
||||
} // lowercase header names before merging with defaults to avoid duplicates
|
||||
|
||||
|
||||
options.headers = lowercaseKeys(options.headers);
|
||||
const mergedOptions = mergeDeep(defaults || {}, options); // mediaType.previews arrays are merged, instead of overwritten
|
||||
|
||||
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/, ""));
|
||||
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 => {
|
||||
return url + separator + names.map((name) => {
|
||||
if (name === "q") {
|
||||
return "q=" + parameters.q.split("+").map(encodeURIComponent).join("+");
|
||||
}
|
||||
|
||||
return `${name}=${encodeURIComponent(parameters[name])}`;
|
||||
}).join("&");
|
||||
}
|
||||
|
||||
const urlVariableRegex = /\{[^}]+\}/g;
|
||||
|
||||
// pkg/dist-src/util/extract-url-variable-names.js
|
||||
var urlVariableRegex = /\{[^}]+\}/g;
|
||||
function removeNonChars(variableName) {
|
||||
return variableName.replace(/^\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) {
|
||||
return Object.keys(object).filter(option => !keysToOmit.includes(option)).reduce((obj, key) => {
|
||||
return Object.keys(object).filter((option) => !keysToOmit.includes(option)).reduce((obj, key) => {
|
||||
obj[key] = object[key];
|
||||
return obj;
|
||||
}, {});
|
||||
}
|
||||
|
||||
// Based on https://github.com/bramstein/url-template, licensed under BSD
|
||||
// TODO: create separate package.
|
||||
//
|
||||
// Copyright (c) 2012-2014, Bram Stein
|
||||
// All rights reserved.
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// 1. Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// 3. The name of the author may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
// EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
/* istanbul ignore file */
|
||||
// pkg/dist-src/util/url-template.js
|
||||
function encodeReserved(str) {
|
||||
return str.split(/(%[0-9A-Fa-f]{2})/g).map(function (part) {
|
||||
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 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 !== undefined && value !== null;
|
||||
return value !== void 0 && value !== null;
|
||||
}
|
||||
|
||||
function isKeyOperator(operator) {
|
||||
return operator === ";" || operator === "&" || operator === "?";
|
||||
}
|
||||
|
||||
function getValues(context, operator, key, modifier) {
|
||||
var value = context[key],
|
||||
result = [];
|
||||
|
||||
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 : ""));
|
||||
result.push(
|
||||
encodeValue(operator, value, isKeyOperator(operator) ? key : "")
|
||||
);
|
||||
} else {
|
||||
if (modifier === "*") {
|
||||
if (Array.isArray(value)) {
|
||||
value.filter(isDefined).forEach(function (value) {
|
||||
result.push(encodeValue(operator, value, isKeyOperator(operator) ? key : ""));
|
||||
value.filter(isDefined).forEach(function(value2) {
|
||||
result.push(
|
||||
encodeValue(operator, value2, isKeyOperator(operator) ? key : "")
|
||||
);
|
||||
});
|
||||
} else {
|
||||
Object.keys(value).forEach(function (k) {
|
||||
Object.keys(value).forEach(function(k) {
|
||||
if (isDefined(value[k])) {
|
||||
result.push(encodeValue(operator, value[k], k));
|
||||
}
|
||||
@ -188,20 +197,18 @@ function getValues(context, operator, key, modifier) {
|
||||
}
|
||||
} else {
|
||||
const tmp = [];
|
||||
|
||||
if (Array.isArray(value)) {
|
||||
value.filter(isDefined).forEach(function (value) {
|
||||
tmp.push(encodeValue(operator, value));
|
||||
value.filter(isDefined).forEach(function(value2) {
|
||||
tmp.push(encodeValue(operator, value2));
|
||||
});
|
||||
} else {
|
||||
Object.keys(value).forEach(function (k) {
|
||||
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) {
|
||||
@ -220,89 +227,88 @@ function getValues(context, operator, key, modifier) {
|
||||
result.push("");
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function parseUrl(template) {
|
||||
return {
|
||||
expand: expand.bind(null, template)
|
||||
};
|
||||
}
|
||||
|
||||
function expand(template, context) {
|
||||
var operators = ["+", "#", ".", "/", ";", "?", "&"];
|
||||
return 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 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(",");
|
||||
}
|
||||
|
||||
return (values.length !== 0 ? operator : "") + values.join(separator);
|
||||
} else {
|
||||
return values.join(",");
|
||||
return encodeReserved(literal);
|
||||
}
|
||||
} else {
|
||||
return encodeReserved(literal);
|
||||
}
|
||||
});
|
||||
);
|
||||
}
|
||||
|
||||
// pkg/dist-src/parse.js
|
||||
function parse(options) {
|
||||
// https://fetch.spec.whatwg.org/#methods
|
||||
let method = options.method.toUpperCase(); // replace :varname with {varname} to make it RFC 6570 compatible
|
||||
|
||||
let url = (options.url || "/").replace(/:([a-z]\w+)/g, "{+$1}");
|
||||
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"]); // extract variable names from URL to calculate remaining variables later
|
||||
|
||||
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 omittedParameters = Object.keys(options).filter((option) => urlVariableNames.includes(option)).concat("baseUrl");
|
||||
const remainingParameters = omit(parameters, omittedParameters);
|
||||
const isBinaryRequset = /application\/octet-stream/i.test(headers.accept);
|
||||
|
||||
if (!isBinaryRequset) {
|
||||
const isBinaryRequest = /application\/octet-stream/i.test(headers.accept);
|
||||
if (!isBinaryRequest) {
|
||||
if (options.mediaType.format) {
|
||||
// e.g. application/vnd.github.v3+json => application/vnd.github.v3.raw
|
||||
headers.accept = headers.accept.split(/,/).map(preview => preview.replace(/application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/, `application/vnd$1$2.${options.mediaType.format}`)).join(",");
|
||||
headers.accept = headers.accept.split(/,/).map(
|
||||
(format) => format.replace(
|
||||
/application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/,
|
||||
`application/vnd$1$2.${options.mediaType.format}`
|
||||
)
|
||||
).join(",");
|
||||
}
|
||||
|
||||
if (options.mediaType.previews.length) {
|
||||
const previewsFromAcceptHeader = headers.accept.match(/[\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 (url.endsWith("/graphql")) {
|
||||
if (options.mediaType.previews?.length) {
|
||||
const previewsFromAcceptHeader = headers.accept.match(/[\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(",");
|
||||
}
|
||||
}
|
||||
} // for GET/HEAD requests, set URL query parameters from remaining parameters
|
||||
// for PATCH/POST/PUT/DELETE requests, set request body from remaining parameters
|
||||
|
||||
|
||||
}
|
||||
if (["GET", "HEAD"].includes(method)) {
|
||||
url = addQueryParameters(url, remainingParameters);
|
||||
} else {
|
||||
@ -311,69 +317,42 @@ function parse(options) {
|
||||
} else {
|
||||
if (Object.keys(remainingParameters).length) {
|
||||
body = remainingParameters;
|
||||
} else {
|
||||
headers["content-length"] = 0;
|
||||
}
|
||||
}
|
||||
} // default content-type for JSON if body is set
|
||||
|
||||
|
||||
}
|
||||
if (!headers["content-type"] && typeof body !== "undefined") {
|
||||
headers["content-type"] = "application/json; charset=utf-8";
|
||||
} // GitHub expects 'content-length: 0' header for PUT/PATCH requests without body.
|
||||
// fetch does not allow to set `content-length` header, but we can set body to an empty string
|
||||
|
||||
|
||||
}
|
||||
if (["PATCH", "PUT"].includes(method) && typeof body === "undefined") {
|
||||
body = "";
|
||||
} // Only return body/request keys if present
|
||||
|
||||
|
||||
return Object.assign({
|
||||
method,
|
||||
url,
|
||||
headers
|
||||
}, typeof body !== "undefined" ? {
|
||||
body
|
||||
} : null, options.request ? {
|
||||
request: options.request
|
||||
} : null);
|
||||
}
|
||||
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 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),
|
||||
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
|
||||
});
|
||||
}
|
||||
|
||||
const VERSION = "6.0.5";
|
||||
|
||||
const userAgent = `octokit-endpoint.js/${VERSION} ${universalUserAgent.getUserAgent()}`; // DEFAULTS has all properties set that EndpointOptions has, except url.
|
||||
// So we use RequestParameters and add method as additional required property.
|
||||
|
||||
const DEFAULTS = {
|
||||
method: "GET",
|
||||
baseUrl: "https://api.github.com",
|
||||
headers: {
|
||||
accept: "application/vnd.github.v3+json",
|
||||
"user-agent": userAgent
|
||||
},
|
||||
mediaType: {
|
||||
format: "",
|
||||
previews: []
|
||||
}
|
||||
};
|
||||
|
||||
const endpoint = withDefaults(null, DEFAULTS);
|
||||
|
||||
exports.endpoint = endpoint;
|
||||
//# sourceMappingURL=index.js.map
|
||||
// pkg/dist-src/index.js
|
||||
var endpoint = withDefaults(null, DEFAULTS);
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
endpoint
|
||||
});
|
||||
|
8
node_modules/@octokit/endpoint/dist-node/index.js.map
generated
vendored
8
node_modules/@octokit/endpoint/dist-node/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
26
node_modules/@octokit/endpoint/dist-src/defaults.js
generated
vendored
26
node_modules/@octokit/endpoint/dist-src/defaults.js
generated
vendored
@ -1,17 +1,17 @@
|
||||
import { getUserAgent } from "universal-user-agent";
|
||||
import { VERSION } from "./version";
|
||||
const userAgent = `octokit-endpoint.js/${VERSION} ${getUserAgent()}`;
|
||||
// DEFAULTS has all properties set that EndpointOptions has, except url.
|
||||
// So we use RequestParameters and add method as additional required property.
|
||||
export const DEFAULTS = {
|
||||
method: "GET",
|
||||
baseUrl: "https://api.github.com",
|
||||
headers: {
|
||||
accept: "application/vnd.github.v3+json",
|
||||
"user-agent": userAgent,
|
||||
},
|
||||
mediaType: {
|
||||
format: "",
|
||||
previews: [],
|
||||
},
|
||||
const DEFAULTS = {
|
||||
method: "GET",
|
||||
baseUrl: "https://api.github.com",
|
||||
headers: {
|
||||
accept: "application/vnd.github.v3+json",
|
||||
"user-agent": userAgent
|
||||
},
|
||||
mediaType: {
|
||||
format: ""
|
||||
}
|
||||
};
|
||||
export {
|
||||
DEFAULTS
|
||||
};
|
||||
|
8
node_modules/@octokit/endpoint/dist-src/endpoint-with-defaults.js
generated
vendored
8
node_modules/@octokit/endpoint/dist-src/endpoint-with-defaults.js
generated
vendored
@ -1,5 +1,9 @@
|
||||
import { DEFAULTS } from "./defaults";
|
||||
import { merge } from "./merge";
|
||||
import { parse } from "./parse";
|
||||
export function endpointWithDefaults(defaults, route, options) {
|
||||
return parse(merge(defaults, route, options));
|
||||
function endpointWithDefaults(defaults, route, options) {
|
||||
return parse(merge(defaults, route, options));
|
||||
}
|
||||
export {
|
||||
endpointWithDefaults
|
||||
};
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user