Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3378cda945 | ||
|
|
e177c20e0f | ||
|
|
961c2284dc | ||
|
|
15db0371da | ||
|
|
9ccc6dbd71 | ||
|
|
000e2a0d29 | ||
|
|
d0ac2addd1 | ||
|
|
040c2598aa | ||
|
|
31c86eb3b3 | ||
|
|
cc82279e84 | ||
|
|
74cd7f68cb |
1
.github/workflows/test.yml
vendored
1
.github/workflows/test.yml
vendored
@@ -5,6 +5,7 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
pull_request:
|
pull_request:
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
|||||||
66
README.md
66
README.md
@@ -79,11 +79,53 @@ jobs:
|
|||||||
# required
|
# required
|
||||||
app-id: ${{ vars.APP_ID }}
|
app-id: ${{ vars.APP_ID }}
|
||||||
private-key: ${{ secrets.PRIVATE_KEY }}
|
private-key: ${{ secrets.PRIVATE_KEY }}
|
||||||
|
- name: Get GitHub App User ID
|
||||||
|
id: get-user-id
|
||||||
|
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ steps.app-token.outputs.token }}
|
||||||
- id: committer
|
- id: committer
|
||||||
run: echo "string=${{steps.app-auth.outputs.app-slug}}[bot] <${{ steps.app-auth.outputs.installation-id }}+${{ steps.app-auth.outputs.app-slug }}[bot]@users.noreply.github.com>" >> "$GITHUB_OUTPUT"
|
run: echo "string=${{ steps.app-token.outputs.app-slug }}[bot] <${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com>" >> "$GITHUB_OUTPUT"
|
||||||
- run: echo "committer string is ${{steps.committer.outputs.string}}"
|
- run: echo "committer string is ${ {steps.committer.outputs.string }}"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Configure git CLI for an app's bot user
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
on: [pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
auto-format:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/create-github-app-token@v1
|
||||||
|
id: app-token
|
||||||
|
with:
|
||||||
|
# required
|
||||||
|
app-id: ${{ vars.APP_ID }}
|
||||||
|
private-key: ${{ secrets.PRIVATE_KEY }}
|
||||||
|
- name: Get GitHub App User ID
|
||||||
|
id: get-user-id
|
||||||
|
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ steps.app-token.outputs.token }}
|
||||||
|
- run: |
|
||||||
|
git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]'
|
||||||
|
git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com>'
|
||||||
|
# git commands like commit work using the bot user
|
||||||
|
- run: |
|
||||||
|
git add .
|
||||||
|
git commit -m "Auto-generated changes"
|
||||||
|
git push
|
||||||
|
```
|
||||||
|
|
||||||
|
> [!TIP]
|
||||||
|
> The `<BOT USER ID>` is the numeric user ID of the app's bot user, which can be found under `https://api.github.com/users/<app-slug>%5Bbot%5D`.
|
||||||
|
>
|
||||||
|
> For example, we can check at `https://api.github.com/users/dependabot[bot]` to see the user ID of Dependabot is 49699333.
|
||||||
|
>
|
||||||
|
> Alternatively, you can use the [octokit/request-action](https://github.com/octokit/request-action) to get the ID.
|
||||||
|
|
||||||
### Create a token for all repositories in the current owner's installation
|
### Create a token for all repositories in the current owner's installation
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
@@ -165,7 +207,7 @@ jobs:
|
|||||||
set-matrix:
|
set-matrix:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
outputs:
|
||||||
matrix: ${{steps.set.outputs.matrix }}
|
matrix: ${{ steps.set.outputs.matrix }}
|
||||||
steps:
|
steps:
|
||||||
- id: set
|
- id: set
|
||||||
run: echo 'matrix=[{"owner":"owner1"},{"owner":"owner2","repos":["repo1"]}]' >>"$GITHUB_OUTPUT"
|
run: echo 'matrix=[{"owner":"owner1"},{"owner":"owner2","repos":["repo1"]}]' >>"$GITHUB_OUTPUT"
|
||||||
@@ -236,6 +278,24 @@ jobs:
|
|||||||
|
|
||||||
**Required:** GitHub App private key. Escaped newlines (`\\n`) will be automatically replaced with actual newlines.
|
**Required:** GitHub App private key. Escaped newlines (`\\n`) will be automatically replaced with actual newlines.
|
||||||
|
|
||||||
|
Some other actions may require the private key to be Base64 encoded. To avoid recreating a new secret, it can be decoded on the fly, but it needs to be managed securely. Here is an example of how this can be achieved:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
steps:
|
||||||
|
- name: Decode the GitHub App Private Key
|
||||||
|
id: decode
|
||||||
|
run: |
|
||||||
|
private_key=$(echo "${{ secrets.PRIVATE_KEY }}" | base64 -d | awk 'BEGIN {ORS="\\n"} {print}' | head -c -2) &> /dev/null
|
||||||
|
echo "::add-mask::$private_key"
|
||||||
|
echo "private-key=$private_key" >> "$GITHUB_OUTPUT"
|
||||||
|
- name: Generate GitHub App Token
|
||||||
|
id: app-token
|
||||||
|
uses: actions/create-github-app-token@v1
|
||||||
|
with:
|
||||||
|
app-id: ${{ vars.APP_ID }}
|
||||||
|
private-key: ${{ steps.decode.outputs.private-key }}
|
||||||
|
```
|
||||||
|
|
||||||
### `owner`
|
### `owner`
|
||||||
|
|
||||||
**Optional:** The owner of the GitHub App installation. If empty, defaults to the current repository owner.
|
**Optional:** The owner of the GitHub App installation. If empty, defaults to the current repository owner.
|
||||||
|
|||||||
567
dist/main.cjs
vendored
567
dist/main.cjs
vendored
@@ -2239,6 +2239,7 @@ var require_decodeText = __commonJS({
|
|||||||
return decoders.utf8;
|
return decoders.utf8;
|
||||||
case "latin1":
|
case "latin1":
|
||||||
case "ascii":
|
case "ascii":
|
||||||
|
// TODO: Make these a separate, strict decoder?
|
||||||
case "us-ascii":
|
case "us-ascii":
|
||||||
case "iso-8859-1":
|
case "iso-8859-1":
|
||||||
case "iso8859-1":
|
case "iso8859-1":
|
||||||
@@ -2938,6 +2939,7 @@ var require_basename = __commonJS({
|
|||||||
for (var i = path.length - 1; i >= 0; --i) {
|
for (var i = path.length - 1; i >= 0; --i) {
|
||||||
switch (path.charCodeAt(i)) {
|
switch (path.charCodeAt(i)) {
|
||||||
case 47:
|
case 47:
|
||||||
|
// '/'
|
||||||
case 92:
|
case 92:
|
||||||
path = path.slice(i + 1);
|
path = path.slice(i + 1);
|
||||||
return path === ".." || path === "." ? "" : path;
|
return path === ".." || path === "." ? "" : path;
|
||||||
@@ -4172,7 +4174,21 @@ var require_util2 = __commonJS({
|
|||||||
return referrerOrigin;
|
return referrerOrigin;
|
||||||
}
|
}
|
||||||
case "strict-origin":
|
case "strict-origin":
|
||||||
|
// eslint-disable-line
|
||||||
|
/**
|
||||||
|
* 1. If referrerURL is a potentially trustworthy URL and
|
||||||
|
* request’s current URL is not a potentially trustworthy URL,
|
||||||
|
* then return no referrer.
|
||||||
|
* 2. Return referrerOrigin
|
||||||
|
*/
|
||||||
case "no-referrer-when-downgrade":
|
case "no-referrer-when-downgrade":
|
||||||
|
// eslint-disable-line
|
||||||
|
/**
|
||||||
|
* 1. If referrerURL is a potentially trustworthy URL and
|
||||||
|
* request’s current URL is not a potentially trustworthy URL,
|
||||||
|
* then return no referrer.
|
||||||
|
* 2. Return referrerOrigin
|
||||||
|
*/
|
||||||
default:
|
default:
|
||||||
return isNonPotentiallyTrustWorthy ? "no-referrer" : referrerOrigin;
|
return isNonPotentiallyTrustWorthy ? "no-referrer" : referrerOrigin;
|
||||||
}
|
}
|
||||||
@@ -20172,6 +20188,27 @@ var require_util8 = __commonJS({
|
|||||||
}
|
}
|
||||||
var kEnumerableProperty = /* @__PURE__ */ Object.create(null);
|
var kEnumerableProperty = /* @__PURE__ */ Object.create(null);
|
||||||
kEnumerableProperty.enumerable = true;
|
kEnumerableProperty.enumerable = true;
|
||||||
|
var normalizedMethodRecordsBase = {
|
||||||
|
delete: "DELETE",
|
||||||
|
DELETE: "DELETE",
|
||||||
|
get: "GET",
|
||||||
|
GET: "GET",
|
||||||
|
head: "HEAD",
|
||||||
|
HEAD: "HEAD",
|
||||||
|
options: "OPTIONS",
|
||||||
|
OPTIONS: "OPTIONS",
|
||||||
|
post: "POST",
|
||||||
|
POST: "POST",
|
||||||
|
put: "PUT",
|
||||||
|
PUT: "PUT"
|
||||||
|
};
|
||||||
|
var normalizedMethodRecords = {
|
||||||
|
...normalizedMethodRecordsBase,
|
||||||
|
patch: "patch",
|
||||||
|
PATCH: "PATCH"
|
||||||
|
};
|
||||||
|
Object.setPrototypeOf(normalizedMethodRecordsBase, null);
|
||||||
|
Object.setPrototypeOf(normalizedMethodRecords, null);
|
||||||
module2.exports = {
|
module2.exports = {
|
||||||
kEnumerableProperty,
|
kEnumerableProperty,
|
||||||
nop,
|
nop,
|
||||||
@@ -20210,6 +20247,8 @@ var require_util8 = __commonJS({
|
|||||||
isValidHeaderValue,
|
isValidHeaderValue,
|
||||||
isTokenCharCode,
|
isTokenCharCode,
|
||||||
parseRangeHeader,
|
parseRangeHeader,
|
||||||
|
normalizedMethodRecordsBase,
|
||||||
|
normalizedMethodRecords,
|
||||||
isValidPort,
|
isValidPort,
|
||||||
isHttpOrHttpsPrefixed,
|
isHttpOrHttpsPrefixed,
|
||||||
nodeMajor,
|
nodeMajor,
|
||||||
@@ -20425,7 +20464,8 @@ var require_request3 = __commonJS({
|
|||||||
isBlobLike,
|
isBlobLike,
|
||||||
buildURL,
|
buildURL,
|
||||||
validateHandler,
|
validateHandler,
|
||||||
getServerName
|
getServerName,
|
||||||
|
normalizedMethodRecords
|
||||||
} = require_util8();
|
} = require_util8();
|
||||||
var { channels } = require_diagnostics();
|
var { channels } = require_diagnostics();
|
||||||
var { headerNameLowerCasedRecord } = require_constants6();
|
var { headerNameLowerCasedRecord } = require_constants6();
|
||||||
@@ -20452,12 +20492,12 @@ var require_request3 = __commonJS({
|
|||||||
throw new InvalidArgumentError("path must be a string");
|
throw new InvalidArgumentError("path must be a string");
|
||||||
} else if (path[0] !== "/" && !(path.startsWith("http://") || path.startsWith("https://")) && method !== "CONNECT") {
|
} else if (path[0] !== "/" && !(path.startsWith("http://") || path.startsWith("https://")) && method !== "CONNECT") {
|
||||||
throw new InvalidArgumentError("path must be an absolute URL or start with a slash");
|
throw new InvalidArgumentError("path must be an absolute URL or start with a slash");
|
||||||
} else if (invalidPathRegex.exec(path) !== null) {
|
} else if (invalidPathRegex.test(path)) {
|
||||||
throw new InvalidArgumentError("invalid request path");
|
throw new InvalidArgumentError("invalid request path");
|
||||||
}
|
}
|
||||||
if (typeof method !== "string") {
|
if (typeof method !== "string") {
|
||||||
throw new InvalidArgumentError("method must be a string");
|
throw new InvalidArgumentError("method must be a string");
|
||||||
} else if (!isValidHTTPToken(method)) {
|
} else if (normalizedMethodRecords[method] === void 0 && !isValidHTTPToken(method)) {
|
||||||
throw new InvalidArgumentError("invalid request method");
|
throw new InvalidArgumentError("invalid request method");
|
||||||
}
|
}
|
||||||
if (upgrade && typeof upgrade !== "string") {
|
if (upgrade && typeof upgrade !== "string") {
|
||||||
@@ -21002,7 +21042,7 @@ var require_connect2 = __commonJS({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
function buildConnector({ allowH2, maxCachedSessions, socketPath, timeout, ...opts }) {
|
function buildConnector({ allowH2, maxCachedSessions, socketPath, timeout, session: customSession, ...opts }) {
|
||||||
if (maxCachedSessions != null && (!Number.isInteger(maxCachedSessions) || maxCachedSessions < 0)) {
|
if (maxCachedSessions != null && (!Number.isInteger(maxCachedSessions) || maxCachedSessions < 0)) {
|
||||||
throw new InvalidArgumentError("maxCachedSessions must be a positive integer or zero");
|
throw new InvalidArgumentError("maxCachedSessions must be a positive integer or zero");
|
||||||
}
|
}
|
||||||
@@ -21018,7 +21058,7 @@ var require_connect2 = __commonJS({
|
|||||||
}
|
}
|
||||||
servername = servername || options.servername || util.getServerName(host) || null;
|
servername = servername || options.servername || util.getServerName(host) || null;
|
||||||
const sessionKey = servername || hostname;
|
const sessionKey = servername || hostname;
|
||||||
const session = sessionCache.get(sessionKey) || null;
|
const session = customSession || sessionCache.get(sessionKey) || null;
|
||||||
assert(sessionKey);
|
assert(sessionKey);
|
||||||
socket = tls.connect({
|
socket = tls.connect({
|
||||||
highWaterMark: 16384,
|
highWaterMark: 16384,
|
||||||
@@ -22536,7 +22576,7 @@ var require_util9 = __commonJS({
|
|||||||
var { getGlobalOrigin } = require_global3();
|
var { getGlobalOrigin } = require_global3();
|
||||||
var { collectASequenceOfCodePoints, collectAnHTTPQuotedString, removeChars, parseMIMEType } = require_data_url();
|
var { collectASequenceOfCodePoints, collectAnHTTPQuotedString, removeChars, parseMIMEType } = require_data_url();
|
||||||
var { performance: performance2 } = require("node:perf_hooks");
|
var { performance: performance2 } = require("node:perf_hooks");
|
||||||
var { isBlobLike, ReadableStreamFrom, isValidHTTPToken } = require_util8();
|
var { isBlobLike, ReadableStreamFrom, isValidHTTPToken, normalizedMethodRecordsBase } = require_util8();
|
||||||
var assert = require("node:assert");
|
var assert = require("node:assert");
|
||||||
var { isUint8Array } = require("node:util/types");
|
var { isUint8Array } = require("node:util/types");
|
||||||
var { webidl } = require_webidl2();
|
var { webidl } = require_webidl2();
|
||||||
@@ -22643,7 +22683,7 @@ var require_util9 = __commonJS({
|
|||||||
}
|
}
|
||||||
function appendRequestOriginHeader(request2) {
|
function appendRequestOriginHeader(request2) {
|
||||||
let serializedOrigin = request2.origin;
|
let serializedOrigin = request2.origin;
|
||||||
if (serializedOrigin === "client") {
|
if (serializedOrigin === "client" || serializedOrigin === void 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (request2.responseTainting === "cors" || request2.mode === "websocket") {
|
if (request2.responseTainting === "cors" || request2.mode === "websocket") {
|
||||||
@@ -22761,7 +22801,21 @@ var require_util9 = __commonJS({
|
|||||||
return referrerOrigin;
|
return referrerOrigin;
|
||||||
}
|
}
|
||||||
case "strict-origin":
|
case "strict-origin":
|
||||||
|
// eslint-disable-line
|
||||||
|
/**
|
||||||
|
* 1. If referrerURL is a potentially trustworthy URL and
|
||||||
|
* request’s current URL is not a potentially trustworthy URL,
|
||||||
|
* then return no referrer.
|
||||||
|
* 2. Return referrerOrigin
|
||||||
|
*/
|
||||||
case "no-referrer-when-downgrade":
|
case "no-referrer-when-downgrade":
|
||||||
|
// eslint-disable-line
|
||||||
|
/**
|
||||||
|
* 1. If referrerURL is a potentially trustworthy URL and
|
||||||
|
* request’s current URL is not a potentially trustworthy URL,
|
||||||
|
* then return no referrer.
|
||||||
|
* 2. Return referrerOrigin
|
||||||
|
*/
|
||||||
default:
|
default:
|
||||||
return isNonPotentiallyTrustWorthy ? "no-referrer" : referrerOrigin;
|
return isNonPotentiallyTrustWorthy ? "no-referrer" : referrerOrigin;
|
||||||
}
|
}
|
||||||
@@ -22924,29 +22978,8 @@ var require_util9 = __commonJS({
|
|||||||
function isCancelled(fetchParams) {
|
function isCancelled(fetchParams) {
|
||||||
return fetchParams.controller.state === "aborted" || fetchParams.controller.state === "terminated";
|
return fetchParams.controller.state === "aborted" || fetchParams.controller.state === "terminated";
|
||||||
}
|
}
|
||||||
var normalizeMethodRecordBase = {
|
|
||||||
delete: "DELETE",
|
|
||||||
DELETE: "DELETE",
|
|
||||||
get: "GET",
|
|
||||||
GET: "GET",
|
|
||||||
head: "HEAD",
|
|
||||||
HEAD: "HEAD",
|
|
||||||
options: "OPTIONS",
|
|
||||||
OPTIONS: "OPTIONS",
|
|
||||||
post: "POST",
|
|
||||||
POST: "POST",
|
|
||||||
put: "PUT",
|
|
||||||
PUT: "PUT"
|
|
||||||
};
|
|
||||||
var normalizeMethodRecord = {
|
|
||||||
...normalizeMethodRecordBase,
|
|
||||||
patch: "patch",
|
|
||||||
PATCH: "PATCH"
|
|
||||||
};
|
|
||||||
Object.setPrototypeOf(normalizeMethodRecordBase, null);
|
|
||||||
Object.setPrototypeOf(normalizeMethodRecord, null);
|
|
||||||
function normalizeMethod(method) {
|
function normalizeMethod(method) {
|
||||||
return normalizeMethodRecordBase[method.toLowerCase()] ?? method;
|
return normalizedMethodRecordsBase[method.toLowerCase()] ?? method;
|
||||||
}
|
}
|
||||||
function serializeJavascriptValueToJSONString(value) {
|
function serializeJavascriptValueToJSONString(value) {
|
||||||
const result = JSON.stringify(value);
|
const result = JSON.stringify(value);
|
||||||
@@ -23083,7 +23116,7 @@ var require_util9 = __commonJS({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
async function fullyReadBody(body, processBody, processBodyError, shouldClone) {
|
async function fullyReadBody(body, processBody, processBodyError) {
|
||||||
const successSteps = processBody;
|
const successSteps = processBody;
|
||||||
const errorSteps = processBodyError;
|
const errorSteps = processBodyError;
|
||||||
let reader;
|
let reader;
|
||||||
@@ -23094,7 +23127,7 @@ var require_util9 = __commonJS({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
successSteps(await readAllBytes(reader, shouldClone));
|
successSteps(await readAllBytes(reader));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
errorSteps(e);
|
errorSteps(e);
|
||||||
}
|
}
|
||||||
@@ -23117,19 +23150,12 @@ var require_util9 = __commonJS({
|
|||||||
assert(!invalidIsomorphicEncodeValueRegex.test(input));
|
assert(!invalidIsomorphicEncodeValueRegex.test(input));
|
||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
async function readAllBytes(reader, shouldClone) {
|
async function readAllBytes(reader) {
|
||||||
const bytes = [];
|
const bytes = [];
|
||||||
let byteLength = 0;
|
let byteLength = 0;
|
||||||
while (true) {
|
while (true) {
|
||||||
const { done, value: chunk } = await reader.read();
|
const { done, value: chunk } = await reader.read();
|
||||||
if (done) {
|
if (done) {
|
||||||
if (bytes.length === 1) {
|
|
||||||
const { buffer, byteOffset, byteLength: byteLength2 } = bytes[0];
|
|
||||||
if (shouldClone === false) {
|
|
||||||
return Buffer.from(buffer, byteOffset, byteLength2);
|
|
||||||
}
|
|
||||||
return Buffer.from(buffer.slice(byteOffset, byteOffset + byteLength2), 0, byteLength2);
|
|
||||||
}
|
|
||||||
return Buffer.concat(bytes, byteLength);
|
return Buffer.concat(bytes, byteLength);
|
||||||
}
|
}
|
||||||
if (!isUint8Array(chunk)) {
|
if (!isUint8Array(chunk)) {
|
||||||
@@ -23392,7 +23418,6 @@ var require_util9 = __commonJS({
|
|||||||
urlHasHttpsScheme,
|
urlHasHttpsScheme,
|
||||||
urlIsHttpHttpsScheme,
|
urlIsHttpHttpsScheme,
|
||||||
readAllBytes,
|
readAllBytes,
|
||||||
normalizeMethodRecord,
|
|
||||||
simpleRangeHeaderValue,
|
simpleRangeHeaderValue,
|
||||||
buildContentRange,
|
buildContentRange,
|
||||||
parseMetadata,
|
parseMetadata,
|
||||||
@@ -23892,11 +23917,23 @@ var require_body2 = __commonJS({
|
|||||||
var { webidl } = require_webidl2();
|
var { webidl } = require_webidl2();
|
||||||
var { Blob: Blob2 } = require("node:buffer");
|
var { Blob: Blob2 } = require("node:buffer");
|
||||||
var assert = require("node:assert");
|
var assert = require("node:assert");
|
||||||
var { isErrored } = require_util8();
|
var { isErrored, isDisturbed } = require("node:stream");
|
||||||
var { isArrayBuffer } = require("node:util/types");
|
var { isArrayBuffer } = require("node:util/types");
|
||||||
var { serializeAMimeType } = require_data_url();
|
var { serializeAMimeType } = require_data_url();
|
||||||
var { multipartFormDataParser } = require_formdata_parser();
|
var { multipartFormDataParser } = require_formdata_parser();
|
||||||
var textEncoder = new TextEncoder();
|
var textEncoder = new TextEncoder();
|
||||||
|
function noop() {
|
||||||
|
}
|
||||||
|
var hasFinalizationRegistry = globalThis.FinalizationRegistry && process.version.indexOf("v18") !== 0;
|
||||||
|
var streamRegistry;
|
||||||
|
if (hasFinalizationRegistry) {
|
||||||
|
streamRegistry = new FinalizationRegistry((weakRef) => {
|
||||||
|
const stream = weakRef.deref();
|
||||||
|
if (stream && !stream.locked && !isDisturbed(stream) && !isErrored(stream)) {
|
||||||
|
stream.cancel("Response object has been garbage collected").catch(noop);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
function extractBody(object, keepalive = false) {
|
function extractBody(object, keepalive = false) {
|
||||||
let stream = null;
|
let stream = null;
|
||||||
if (object instanceof ReadableStream) {
|
if (object instanceof ReadableStream) {
|
||||||
@@ -24039,8 +24076,11 @@ Content-Type: ${value.type || "application/octet-stream"}\r
|
|||||||
}
|
}
|
||||||
return extractBody(object, keepalive);
|
return extractBody(object, keepalive);
|
||||||
}
|
}
|
||||||
function cloneBody(body) {
|
function cloneBody(instance, body) {
|
||||||
const [out1, out2] = body.stream.tee();
|
const [out1, out2] = body.stream.tee();
|
||||||
|
if (hasFinalizationRegistry) {
|
||||||
|
streamRegistry.register(instance, new WeakRef(out1));
|
||||||
|
}
|
||||||
body.stream = out1;
|
body.stream = out1;
|
||||||
return {
|
return {
|
||||||
stream: out2,
|
stream: out2,
|
||||||
@@ -24064,18 +24104,18 @@ Content-Type: ${value.type || "application/octet-stream"}\r
|
|||||||
mimeType = serializeAMimeType(mimeType);
|
mimeType = serializeAMimeType(mimeType);
|
||||||
}
|
}
|
||||||
return new Blob2([bytes], { type: mimeType });
|
return new Blob2([bytes], { type: mimeType });
|
||||||
}, instance, false);
|
}, instance);
|
||||||
},
|
},
|
||||||
arrayBuffer() {
|
arrayBuffer() {
|
||||||
return consumeBody(this, (bytes) => {
|
return consumeBody(this, (bytes) => {
|
||||||
return bytes.buffer;
|
return new Uint8Array(bytes).buffer;
|
||||||
}, instance, true);
|
}, instance);
|
||||||
},
|
},
|
||||||
text() {
|
text() {
|
||||||
return consumeBody(this, utf8DecodeBytes, instance, false);
|
return consumeBody(this, utf8DecodeBytes, instance);
|
||||||
},
|
},
|
||||||
json() {
|
json() {
|
||||||
return consumeBody(this, parseJSONFromBytes, instance, false);
|
return consumeBody(this, parseJSONFromBytes, instance);
|
||||||
},
|
},
|
||||||
formData() {
|
formData() {
|
||||||
return consumeBody(this, (value) => {
|
return consumeBody(this, (value) => {
|
||||||
@@ -24104,12 +24144,12 @@ Content-Type: ${value.type || "application/octet-stream"}\r
|
|||||||
throw new TypeError(
|
throw new TypeError(
|
||||||
'Content-Type was not one of "multipart/form-data" or "application/x-www-form-urlencoded".'
|
'Content-Type was not one of "multipart/form-data" or "application/x-www-form-urlencoded".'
|
||||||
);
|
);
|
||||||
}, instance, false);
|
}, instance);
|
||||||
},
|
},
|
||||||
bytes() {
|
bytes() {
|
||||||
return consumeBody(this, (bytes) => {
|
return consumeBody(this, (bytes) => {
|
||||||
return new Uint8Array(bytes.buffer, 0, bytes.byteLength);
|
return new Uint8Array(bytes);
|
||||||
}, instance, true);
|
}, instance);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return methods;
|
return methods;
|
||||||
@@ -24117,9 +24157,9 @@ Content-Type: ${value.type || "application/octet-stream"}\r
|
|||||||
function mixinBody(prototype) {
|
function mixinBody(prototype) {
|
||||||
Object.assign(prototype.prototype, bodyMixinMethods(prototype));
|
Object.assign(prototype.prototype, bodyMixinMethods(prototype));
|
||||||
}
|
}
|
||||||
async function consumeBody(object, convertBytesToJSValue, instance, shouldClone) {
|
async function consumeBody(object, convertBytesToJSValue, instance) {
|
||||||
webidl.brandCheck(object, instance);
|
webidl.brandCheck(object, instance);
|
||||||
if (bodyUnusable(object[kState].body)) {
|
if (bodyUnusable(object)) {
|
||||||
throw new TypeError("Body is unusable: Body has already been read");
|
throw new TypeError("Body is unusable: Body has already been read");
|
||||||
}
|
}
|
||||||
throwIfAborted(object[kState]);
|
throwIfAborted(object[kState]);
|
||||||
@@ -24136,10 +24176,11 @@ Content-Type: ${value.type || "application/octet-stream"}\r
|
|||||||
successSteps(Buffer.allocUnsafe(0));
|
successSteps(Buffer.allocUnsafe(0));
|
||||||
return promise.promise;
|
return promise.promise;
|
||||||
}
|
}
|
||||||
await fullyReadBody(object[kState].body, successSteps, errorSteps, shouldClone);
|
await fullyReadBody(object[kState].body, successSteps, errorSteps);
|
||||||
return promise.promise;
|
return promise.promise;
|
||||||
}
|
}
|
||||||
function bodyUnusable(body) {
|
function bodyUnusable(object) {
|
||||||
|
const body = object[kState].body;
|
||||||
return body != null && (body.stream.locked || util.isDisturbed(body.stream));
|
return body != null && (body.stream.locked || util.isDisturbed(body.stream));
|
||||||
}
|
}
|
||||||
function parseJSONFromBytes(bytes) {
|
function parseJSONFromBytes(bytes) {
|
||||||
@@ -24157,7 +24198,10 @@ Content-Type: ${value.type || "application/octet-stream"}\r
|
|||||||
extractBody,
|
extractBody,
|
||||||
safelyExtractBody,
|
safelyExtractBody,
|
||||||
cloneBody,
|
cloneBody,
|
||||||
mixinBody
|
mixinBody,
|
||||||
|
streamRegistry,
|
||||||
|
hasFinalizationRegistry,
|
||||||
|
bodyUnusable
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -24889,25 +24933,25 @@ upgrade: ${upgrade}\r
|
|||||||
channels.sendHeaders.publish({ request: request2, headers: header, socket });
|
channels.sendHeaders.publish({ request: request2, headers: header, socket });
|
||||||
}
|
}
|
||||||
if (!body || bodyLength === 0) {
|
if (!body || bodyLength === 0) {
|
||||||
writeBuffer({ abort, body: null, client, request: request2, socket, contentLength, header, expectsPayload });
|
writeBuffer(abort, null, client, request2, socket, contentLength, header, expectsPayload);
|
||||||
} else if (util.isBuffer(body)) {
|
} else if (util.isBuffer(body)) {
|
||||||
writeBuffer({ abort, body, client, request: request2, socket, contentLength, header, expectsPayload });
|
writeBuffer(abort, body, client, request2, socket, contentLength, header, expectsPayload);
|
||||||
} else if (util.isBlobLike(body)) {
|
} else if (util.isBlobLike(body)) {
|
||||||
if (typeof body.stream === "function") {
|
if (typeof body.stream === "function") {
|
||||||
writeIterable({ abort, body: body.stream(), client, request: request2, socket, contentLength, header, expectsPayload });
|
writeIterable(abort, body.stream(), client, request2, socket, contentLength, header, expectsPayload);
|
||||||
} else {
|
} else {
|
||||||
writeBlob({ abort, body, client, request: request2, socket, contentLength, header, expectsPayload });
|
writeBlob(abort, body, client, request2, socket, contentLength, header, expectsPayload);
|
||||||
}
|
}
|
||||||
} else if (util.isStream(body)) {
|
} else if (util.isStream(body)) {
|
||||||
writeStream({ abort, body, client, request: request2, socket, contentLength, header, expectsPayload });
|
writeStream(abort, body, client, request2, socket, contentLength, header, expectsPayload);
|
||||||
} else if (util.isIterable(body)) {
|
} else if (util.isIterable(body)) {
|
||||||
writeIterable({ abort, body, client, request: request2, socket, contentLength, header, expectsPayload });
|
writeIterable(abort, body, client, request2, socket, contentLength, header, expectsPayload);
|
||||||
} else {
|
} else {
|
||||||
assert(false);
|
assert(false);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
function writeStream({ abort, body, client, request: request2, socket, contentLength, header, expectsPayload }) {
|
function writeStream(abort, body, client, request2, socket, contentLength, header, expectsPayload) {
|
||||||
assert(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined");
|
assert(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined");
|
||||||
let finished = false;
|
let finished = false;
|
||||||
const writer = new AsyncWriter({ abort, socket, request: request2, contentLength, client, expectsPayload, header });
|
const writer = new AsyncWriter({ abort, socket, request: request2, contentLength, client, expectsPayload, header });
|
||||||
@@ -24976,7 +25020,7 @@ upgrade: ${upgrade}\r
|
|||||||
setImmediate(onClose);
|
setImmediate(onClose);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function writeBuffer({ abort, body, client, request: request2, socket, contentLength, header, expectsPayload }) {
|
function writeBuffer(abort, body, client, request2, socket, contentLength, header, expectsPayload) {
|
||||||
try {
|
try {
|
||||||
if (!body) {
|
if (!body) {
|
||||||
if (contentLength === 0) {
|
if (contentLength === 0) {
|
||||||
@@ -25007,7 +25051,7 @@ upgrade: ${upgrade}\r
|
|||||||
abort(err);
|
abort(err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
async function writeBlob({ abort, body, client, request: request2, socket, contentLength, header, expectsPayload }) {
|
async function writeBlob(abort, body, client, request2, socket, contentLength, header, expectsPayload) {
|
||||||
assert(contentLength === body.size, "blob body must have content length");
|
assert(contentLength === body.size, "blob body must have content length");
|
||||||
try {
|
try {
|
||||||
if (contentLength != null && contentLength !== body.size) {
|
if (contentLength != null && contentLength !== body.size) {
|
||||||
@@ -25030,7 +25074,7 @@ upgrade: ${upgrade}\r
|
|||||||
abort(err);
|
abort(err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
async function writeIterable({ abort, body, client, request: request2, socket, contentLength, header, expectsPayload }) {
|
async function writeIterable(abort, body, client, request2, socket, contentLength, header, expectsPayload) {
|
||||||
assert(contentLength !== 0 || client[kRunning] === 0, "iterator body cannot be pipelined");
|
assert(contentLength !== 0 || client[kRunning] === 0, "iterator body cannot be pipelined");
|
||||||
let callback = null;
|
let callback = null;
|
||||||
function onDrain() {
|
function onDrain() {
|
||||||
@@ -25493,81 +25537,79 @@ var require_client_h2 = __commonJS({
|
|||||||
return true;
|
return true;
|
||||||
function writeBodyH2() {
|
function writeBodyH2() {
|
||||||
if (!body || contentLength === 0) {
|
if (!body || contentLength === 0) {
|
||||||
writeBuffer({
|
writeBuffer(
|
||||||
abort,
|
abort,
|
||||||
|
stream,
|
||||||
|
null,
|
||||||
client,
|
client,
|
||||||
request: request2,
|
request2,
|
||||||
|
client[kSocket],
|
||||||
contentLength,
|
contentLength,
|
||||||
expectsPayload,
|
expectsPayload
|
||||||
h2stream: stream,
|
);
|
||||||
body: null,
|
|
||||||
socket: client[kSocket]
|
|
||||||
});
|
|
||||||
} else if (util.isBuffer(body)) {
|
} else if (util.isBuffer(body)) {
|
||||||
writeBuffer({
|
writeBuffer(
|
||||||
abort,
|
abort,
|
||||||
client,
|
stream,
|
||||||
request: request2,
|
|
||||||
contentLength,
|
|
||||||
body,
|
body,
|
||||||
expectsPayload,
|
client,
|
||||||
h2stream: stream,
|
request2,
|
||||||
socket: client[kSocket]
|
client[kSocket],
|
||||||
});
|
contentLength,
|
||||||
|
expectsPayload
|
||||||
|
);
|
||||||
} else if (util.isBlobLike(body)) {
|
} else if (util.isBlobLike(body)) {
|
||||||
if (typeof body.stream === "function") {
|
if (typeof body.stream === "function") {
|
||||||
writeIterable({
|
writeIterable(
|
||||||
abort,
|
abort,
|
||||||
|
stream,
|
||||||
|
body.stream(),
|
||||||
client,
|
client,
|
||||||
request: request2,
|
request2,
|
||||||
|
client[kSocket],
|
||||||
contentLength,
|
contentLength,
|
||||||
expectsPayload,
|
expectsPayload
|
||||||
h2stream: stream,
|
);
|
||||||
body: body.stream(),
|
|
||||||
socket: client[kSocket]
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
writeBlob({
|
writeBlob(
|
||||||
abort,
|
abort,
|
||||||
|
stream,
|
||||||
body,
|
body,
|
||||||
client,
|
client,
|
||||||
request: request2,
|
request2,
|
||||||
|
client[kSocket],
|
||||||
contentLength,
|
contentLength,
|
||||||
expectsPayload,
|
expectsPayload
|
||||||
h2stream: stream,
|
);
|
||||||
socket: client[kSocket]
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
} else if (util.isStream(body)) {
|
} else if (util.isStream(body)) {
|
||||||
writeStream({
|
writeStream(
|
||||||
abort,
|
abort,
|
||||||
|
client[kSocket],
|
||||||
|
expectsPayload,
|
||||||
|
stream,
|
||||||
body,
|
body,
|
||||||
client,
|
client,
|
||||||
request: request2,
|
request2,
|
||||||
contentLength,
|
contentLength
|
||||||
expectsPayload,
|
);
|
||||||
socket: client[kSocket],
|
|
||||||
h2stream: stream,
|
|
||||||
header: ""
|
|
||||||
});
|
|
||||||
} else if (util.isIterable(body)) {
|
} else if (util.isIterable(body)) {
|
||||||
writeIterable({
|
writeIterable(
|
||||||
abort,
|
abort,
|
||||||
|
stream,
|
||||||
body,
|
body,
|
||||||
client,
|
client,
|
||||||
request: request2,
|
request2,
|
||||||
|
client[kSocket],
|
||||||
contentLength,
|
contentLength,
|
||||||
expectsPayload,
|
expectsPayload
|
||||||
header: "",
|
);
|
||||||
h2stream: stream,
|
|
||||||
socket: client[kSocket]
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
assert(false);
|
assert(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function writeBuffer({ abort, h2stream, body, client, request: request2, socket, contentLength, expectsPayload }) {
|
function writeBuffer(abort, h2stream, body, client, request2, socket, contentLength, expectsPayload) {
|
||||||
try {
|
try {
|
||||||
if (body != null && util.isBuffer(body)) {
|
if (body != null && util.isBuffer(body)) {
|
||||||
assert(contentLength === body.byteLength, "buffer body must have content length");
|
assert(contentLength === body.byteLength, "buffer body must have content length");
|
||||||
@@ -25586,7 +25628,7 @@ var require_client_h2 = __commonJS({
|
|||||||
abort(error);
|
abort(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function writeStream({ abort, socket, expectsPayload, h2stream, body, client, request: request2, contentLength }) {
|
function writeStream(abort, socket, expectsPayload, h2stream, body, client, request2, contentLength) {
|
||||||
assert(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined");
|
assert(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined");
|
||||||
const pipe = pipeline(
|
const pipe = pipeline(
|
||||||
body,
|
body,
|
||||||
@@ -25610,7 +25652,7 @@ var require_client_h2 = __commonJS({
|
|||||||
request2.onBodySent(chunk);
|
request2.onBodySent(chunk);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
async function writeBlob({ abort, h2stream, body, client, request: request2, socket, contentLength, expectsPayload }) {
|
async function writeBlob(abort, h2stream, body, client, request2, socket, contentLength, expectsPayload) {
|
||||||
assert(contentLength === body.size, "blob body must have content length");
|
assert(contentLength === body.size, "blob body must have content length");
|
||||||
try {
|
try {
|
||||||
if (contentLength != null && contentLength !== body.size) {
|
if (contentLength != null && contentLength !== body.size) {
|
||||||
@@ -25631,7 +25673,7 @@ var require_client_h2 = __commonJS({
|
|||||||
abort(err);
|
abort(err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
async function writeIterable({ abort, h2stream, body, client, request: request2, socket, contentLength, expectsPayload }) {
|
async function writeIterable(abort, h2stream, body, client, request2, socket, contentLength, expectsPayload) {
|
||||||
assert(contentLength !== 0 || client[kRunning] === 0, "iterator body cannot be pipelined");
|
assert(contentLength !== 0 || client[kRunning] === 0, "iterator body cannot be pipelined");
|
||||||
let callback = null;
|
let callback = null;
|
||||||
function onDrain() {
|
function onDrain() {
|
||||||
@@ -26713,8 +26755,13 @@ var require_balanced_pool2 = __commonJS({
|
|||||||
var kMaxWeightPerServer = Symbol("kMaxWeightPerServer");
|
var kMaxWeightPerServer = Symbol("kMaxWeightPerServer");
|
||||||
var kErrorPenalty = Symbol("kErrorPenalty");
|
var kErrorPenalty = Symbol("kErrorPenalty");
|
||||||
function getGreatestCommonDivisor(a, b) {
|
function getGreatestCommonDivisor(a, b) {
|
||||||
if (b === 0) return a;
|
if (a === 0) return b;
|
||||||
return getGreatestCommonDivisor(b, a % b);
|
while (b !== 0) {
|
||||||
|
const t = b;
|
||||||
|
b = a % b;
|
||||||
|
a = t;
|
||||||
|
}
|
||||||
|
return a;
|
||||||
}
|
}
|
||||||
function defaultFactory(origin, opts) {
|
function defaultFactory(origin, opts) {
|
||||||
return new Pool(origin, opts);
|
return new Pool(origin, opts);
|
||||||
@@ -26768,7 +26815,11 @@ var require_balanced_pool2 = __commonJS({
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
_updateBalancedPoolStats() {
|
_updateBalancedPoolStats() {
|
||||||
this[kGreatestCommonDivisor] = this[kClients].map((p) => p[kWeight]).reduce(getGreatestCommonDivisor, 0);
|
let result = 0;
|
||||||
|
for (let i = 0; i < this[kClients].length; i++) {
|
||||||
|
result = getGreatestCommonDivisor(this[kClients][i][kWeight], result);
|
||||||
|
}
|
||||||
|
this[kGreatestCommonDivisor] = result;
|
||||||
}
|
}
|
||||||
removeUpstream(upstream) {
|
removeUpstream(upstream) {
|
||||||
const upstreamOrigin = parseOrigin(upstream).origin;
|
const upstreamOrigin = parseOrigin(upstream).origin;
|
||||||
@@ -27376,7 +27427,7 @@ var require_retry_handler = __commonJS({
|
|||||||
this.abort(
|
this.abort(
|
||||||
new RequestRetryError("Content-Range mismatch", statusCode, {
|
new RequestRetryError("Content-Range mismatch", statusCode, {
|
||||||
headers,
|
headers,
|
||||||
count: this.retryCount
|
data: { count: this.retryCount }
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
return false;
|
return false;
|
||||||
@@ -27385,7 +27436,7 @@ var require_retry_handler = __commonJS({
|
|||||||
this.abort(
|
this.abort(
|
||||||
new RequestRetryError("ETag mismatch", statusCode, {
|
new RequestRetryError("ETag mismatch", statusCode, {
|
||||||
headers,
|
headers,
|
||||||
count: this.retryCount
|
data: { count: this.retryCount }
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
return false;
|
return false;
|
||||||
@@ -30153,7 +30204,7 @@ var require_response2 = __commonJS({
|
|||||||
"node_modules/undici/lib/web/fetch/response.js"(exports2, module2) {
|
"node_modules/undici/lib/web/fetch/response.js"(exports2, module2) {
|
||||||
"use strict";
|
"use strict";
|
||||||
var { Headers, HeadersList, fill, getHeadersGuard, setHeadersGuard, setHeadersList } = require_headers2();
|
var { Headers, HeadersList, fill, getHeadersGuard, setHeadersGuard, setHeadersList } = require_headers2();
|
||||||
var { extractBody, cloneBody, mixinBody } = require_body2();
|
var { extractBody, cloneBody, mixinBody, hasFinalizationRegistry, streamRegistry, bodyUnusable } = require_body2();
|
||||||
var util = require_util8();
|
var util = require_util8();
|
||||||
var nodeUtil = require("node:util");
|
var nodeUtil = require("node:util");
|
||||||
var { kEnumerableProperty } = util;
|
var { kEnumerableProperty } = util;
|
||||||
@@ -30178,19 +30229,7 @@ var require_response2 = __commonJS({
|
|||||||
var { kConstruct } = require_symbols6();
|
var { kConstruct } = require_symbols6();
|
||||||
var assert = require("node:assert");
|
var assert = require("node:assert");
|
||||||
var { types } = require("node:util");
|
var { types } = require("node:util");
|
||||||
var { isDisturbed, isErrored } = require("node:stream");
|
|
||||||
var textEncoder = new TextEncoder("utf-8");
|
var textEncoder = new TextEncoder("utf-8");
|
||||||
var hasFinalizationRegistry = globalThis.FinalizationRegistry && process.version.indexOf("v18") !== 0;
|
|
||||||
var registry;
|
|
||||||
if (hasFinalizationRegistry) {
|
|
||||||
registry = new FinalizationRegistry((stream) => {
|
|
||||||
if (!stream.locked && !isDisturbed(stream) && !isErrored(stream)) {
|
|
||||||
stream.cancel("Response object has been garbage collected").catch(noop);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
function noop() {
|
|
||||||
}
|
|
||||||
var Response = class _Response {
|
var Response = class _Response {
|
||||||
// Creates network error Response.
|
// Creates network error Response.
|
||||||
static error() {
|
static error() {
|
||||||
@@ -30302,7 +30341,7 @@ var require_response2 = __commonJS({
|
|||||||
// Returns a clone of response.
|
// Returns a clone of response.
|
||||||
clone() {
|
clone() {
|
||||||
webidl.brandCheck(this, _Response);
|
webidl.brandCheck(this, _Response);
|
||||||
if (this.bodyUsed || this.body?.locked) {
|
if (bodyUnusable(this)) {
|
||||||
throw webidl.errors.exception({
|
throw webidl.errors.exception({
|
||||||
header: "Response.clone",
|
header: "Response.clone",
|
||||||
message: "Body has already been consumed."
|
message: "Body has already been consumed."
|
||||||
@@ -30361,7 +30400,7 @@ var require_response2 = __commonJS({
|
|||||||
}
|
}
|
||||||
const newResponse = makeResponse({ ...response, body: null });
|
const newResponse = makeResponse({ ...response, body: null });
|
||||||
if (response.body != null) {
|
if (response.body != null) {
|
||||||
newResponse.body = cloneBody(response.body);
|
newResponse.body = cloneBody(newResponse, response.body);
|
||||||
}
|
}
|
||||||
return newResponse;
|
return newResponse;
|
||||||
}
|
}
|
||||||
@@ -30486,7 +30525,7 @@ var require_response2 = __commonJS({
|
|||||||
setHeadersList(response[kHeaders], innerResponse.headersList);
|
setHeadersList(response[kHeaders], innerResponse.headersList);
|
||||||
setHeadersGuard(response[kHeaders], guard);
|
setHeadersGuard(response[kHeaders], guard);
|
||||||
if (hasFinalizationRegistry && innerResponse.body?.stream) {
|
if (hasFinalizationRegistry && innerResponse.body?.stream) {
|
||||||
registry.register(response, innerResponse.body.stream);
|
streamRegistry.register(response, new WeakRef(innerResponse.body.stream));
|
||||||
}
|
}
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
@@ -30601,7 +30640,7 @@ var require_dispatcher_weakref2 = __commonJS({
|
|||||||
var require_request4 = __commonJS({
|
var require_request4 = __commonJS({
|
||||||
"node_modules/undici/lib/web/fetch/request.js"(exports2, module2) {
|
"node_modules/undici/lib/web/fetch/request.js"(exports2, module2) {
|
||||||
"use strict";
|
"use strict";
|
||||||
var { extractBody, mixinBody, cloneBody } = require_body2();
|
var { extractBody, mixinBody, cloneBody, bodyUnusable } = require_body2();
|
||||||
var { Headers, fill: fillHeaders, HeadersList, setHeadersGuard, getHeadersGuard, setHeadersList, getHeadersList } = require_headers2();
|
var { Headers, fill: fillHeaders, HeadersList, setHeadersGuard, getHeadersGuard, setHeadersList, getHeadersList } = require_headers2();
|
||||||
var { FinalizationRegistry: FinalizationRegistry2 } = require_dispatcher_weakref2()();
|
var { FinalizationRegistry: FinalizationRegistry2 } = require_dispatcher_weakref2()();
|
||||||
var util = require_util8();
|
var util = require_util8();
|
||||||
@@ -30609,9 +30648,7 @@ var require_request4 = __commonJS({
|
|||||||
var {
|
var {
|
||||||
isValidHTTPToken,
|
isValidHTTPToken,
|
||||||
sameOrigin,
|
sameOrigin,
|
||||||
normalizeMethod,
|
environmentSettingsObject
|
||||||
environmentSettingsObject,
|
|
||||||
normalizeMethodRecord
|
|
||||||
} = require_util9();
|
} = require_util9();
|
||||||
var {
|
var {
|
||||||
forbiddenMethodsSet,
|
forbiddenMethodsSet,
|
||||||
@@ -30623,7 +30660,7 @@ var require_request4 = __commonJS({
|
|||||||
requestCache,
|
requestCache,
|
||||||
requestDuplex
|
requestDuplex
|
||||||
} = require_constants8();
|
} = require_constants8();
|
||||||
var { kEnumerableProperty } = util;
|
var { kEnumerableProperty, normalizedMethodRecordsBase, normalizedMethodRecords } = util;
|
||||||
var { kHeaders, kSignal, kState, kDispatcher } = require_symbols7();
|
var { kHeaders, kSignal, kState, kDispatcher } = require_symbols7();
|
||||||
var { webidl } = require_webidl2();
|
var { webidl } = require_webidl2();
|
||||||
var { URLSerializer } = require_data_url();
|
var { URLSerializer } = require_data_url();
|
||||||
@@ -30820,17 +30857,18 @@ var require_request4 = __commonJS({
|
|||||||
}
|
}
|
||||||
if (init.method !== void 0) {
|
if (init.method !== void 0) {
|
||||||
let method = init.method;
|
let method = init.method;
|
||||||
const mayBeNormalized = normalizeMethodRecord[method];
|
const mayBeNormalized = normalizedMethodRecords[method];
|
||||||
if (mayBeNormalized !== void 0) {
|
if (mayBeNormalized !== void 0) {
|
||||||
request2.method = mayBeNormalized;
|
request2.method = mayBeNormalized;
|
||||||
} else {
|
} else {
|
||||||
if (!isValidHTTPToken(method)) {
|
if (!isValidHTTPToken(method)) {
|
||||||
throw new TypeError(`'${method}' is not a valid HTTP method.`);
|
throw new TypeError(`'${method}' is not a valid HTTP method.`);
|
||||||
}
|
}
|
||||||
if (forbiddenMethodsSet.has(method.toUpperCase())) {
|
const upperCase = method.toUpperCase();
|
||||||
|
if (forbiddenMethodsSet.has(upperCase)) {
|
||||||
throw new TypeError(`'${method}' HTTP method is unsupported.`);
|
throw new TypeError(`'${method}' HTTP method is unsupported.`);
|
||||||
}
|
}
|
||||||
method = normalizeMethod(method);
|
method = normalizedMethodRecordsBase[upperCase] ?? method;
|
||||||
request2.method = method;
|
request2.method = method;
|
||||||
}
|
}
|
||||||
if (!patchMethodWarning && request2.method === "patch") {
|
if (!patchMethodWarning && request2.method === "patch") {
|
||||||
@@ -30923,7 +30961,7 @@ var require_request4 = __commonJS({
|
|||||||
}
|
}
|
||||||
let finalBody = inputOrInitBody;
|
let finalBody = inputOrInitBody;
|
||||||
if (initBody == null && inputBody != null) {
|
if (initBody == null && inputBody != null) {
|
||||||
if (util.isDisturbed(inputBody.stream) || inputBody.stream.locked) {
|
if (bodyUnusable(input)) {
|
||||||
throw new TypeError(
|
throw new TypeError(
|
||||||
"Cannot construct a Request with a Request object that has already been used."
|
"Cannot construct a Request with a Request object that has already been used."
|
||||||
);
|
);
|
||||||
@@ -31058,7 +31096,7 @@ var require_request4 = __commonJS({
|
|||||||
// Returns a clone of request.
|
// Returns a clone of request.
|
||||||
clone() {
|
clone() {
|
||||||
webidl.brandCheck(this, _Request);
|
webidl.brandCheck(this, _Request);
|
||||||
if (this.bodyUsed || this.body?.locked) {
|
if (bodyUnusable(this)) {
|
||||||
throw new TypeError("unusable");
|
throw new TypeError("unusable");
|
||||||
}
|
}
|
||||||
const clonedRequest = cloneRequest(this[kState]);
|
const clonedRequest = cloneRequest(this[kState]);
|
||||||
@@ -31151,7 +31189,7 @@ var require_request4 = __commonJS({
|
|||||||
function cloneRequest(request2) {
|
function cloneRequest(request2) {
|
||||||
const newRequest = makeRequest({ ...request2, body: null });
|
const newRequest = makeRequest({ ...request2, body: null });
|
||||||
if (request2.body != null) {
|
if (request2.body != null) {
|
||||||
newRequest.body = cloneBody(request2.body);
|
newRequest.body = cloneBody(newRequest, request2.body);
|
||||||
}
|
}
|
||||||
return newRequest;
|
return newRequest;
|
||||||
}
|
}
|
||||||
@@ -35546,7 +35584,6 @@ var require_websocket2 = __commonJS({
|
|||||||
var { types } = require("node:util");
|
var { types } = require("node:util");
|
||||||
var { ErrorEvent, CloseEvent } = require_events2();
|
var { ErrorEvent, CloseEvent } = require_events2();
|
||||||
var { SendQueue } = require_sender();
|
var { SendQueue } = require_sender();
|
||||||
var experimentalWarned = false;
|
|
||||||
var WebSocket = class _WebSocket extends EventTarget {
|
var WebSocket = class _WebSocket extends EventTarget {
|
||||||
#events = {
|
#events = {
|
||||||
open: null,
|
open: null,
|
||||||
@@ -35567,12 +35604,6 @@ var require_websocket2 = __commonJS({
|
|||||||
super();
|
super();
|
||||||
const prefix = "WebSocket constructor";
|
const prefix = "WebSocket constructor";
|
||||||
webidl.argumentLengthCheck(arguments, 1, prefix);
|
webidl.argumentLengthCheck(arguments, 1, prefix);
|
||||||
if (!experimentalWarned) {
|
|
||||||
experimentalWarned = true;
|
|
||||||
process.emitWarning("WebSockets are experimental, expect them to change at any time.", {
|
|
||||||
code: "UNDICI-WS"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
const options = webidl.converters["DOMString or sequence<DOMString> or WebSocketInit"](protocols, prefix, "options");
|
const options = webidl.converters["DOMString or sequence<DOMString> or WebSocketInit"](protocols, prefix, "options");
|
||||||
url = webidl.converters.USVString(url, prefix, "url");
|
url = webidl.converters.USVString(url, prefix, "url");
|
||||||
protocols = options.protocols;
|
protocols = options.protocols;
|
||||||
@@ -36972,132 +37003,116 @@ var RequestError = class extends Error {
|
|||||||
|
|
||||||
// node_modules/@octokit/request/dist-bundle/index.js
|
// node_modules/@octokit/request/dist-bundle/index.js
|
||||||
var VERSION2 = "0.0.0-development";
|
var VERSION2 = "0.0.0-development";
|
||||||
|
var defaults_default = {
|
||||||
|
headers: {
|
||||||
|
"user-agent": `octokit-request.js/${VERSION2} ${getUserAgent()}`
|
||||||
|
}
|
||||||
|
};
|
||||||
function isPlainObject2(value) {
|
function isPlainObject2(value) {
|
||||||
if (typeof value !== "object" || value === null)
|
if (typeof value !== "object" || value === null) return false;
|
||||||
return false;
|
if (Object.prototype.toString.call(value) !== "[object Object]") return false;
|
||||||
if (Object.prototype.toString.call(value) !== "[object Object]")
|
|
||||||
return false;
|
|
||||||
const proto = Object.getPrototypeOf(value);
|
const proto = Object.getPrototypeOf(value);
|
||||||
if (proto === null)
|
if (proto === null) return true;
|
||||||
return true;
|
|
||||||
const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor;
|
const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor;
|
||||||
return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value);
|
return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value);
|
||||||
}
|
}
|
||||||
function getBufferResponse(response) {
|
async function fetchWrapper(requestOptions) {
|
||||||
return response.arrayBuffer();
|
const fetch = requestOptions.request?.fetch || globalThis.fetch;
|
||||||
}
|
|
||||||
function fetchWrapper(requestOptions) {
|
|
||||||
const log = requestOptions.request && requestOptions.request.log ? requestOptions.request.log : console;
|
|
||||||
const parseSuccessResponseBody = requestOptions.request?.parseSuccessResponseBody !== false;
|
|
||||||
if (isPlainObject2(requestOptions.body) || Array.isArray(requestOptions.body)) {
|
|
||||||
requestOptions.body = JSON.stringify(requestOptions.body);
|
|
||||||
}
|
|
||||||
let headers = {};
|
|
||||||
let status;
|
|
||||||
let url;
|
|
||||||
let { fetch } = globalThis;
|
|
||||||
if (requestOptions.request?.fetch) {
|
|
||||||
fetch = requestOptions.request.fetch;
|
|
||||||
}
|
|
||||||
if (!fetch) {
|
if (!fetch) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
"fetch is not set. Please pass a fetch implementation as new Octokit({ request: { fetch }}). Learn more at https://github.com/octokit/octokit.js/#fetch-missing"
|
"fetch is not set. Please pass a fetch implementation as new Octokit({ request: { fetch }}). Learn more at https://github.com/octokit/octokit.js/#fetch-missing"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return fetch(requestOptions.url, {
|
const log = requestOptions.request?.log || console;
|
||||||
method: requestOptions.method,
|
const parseSuccessResponseBody = requestOptions.request?.parseSuccessResponseBody !== false;
|
||||||
body: requestOptions.body,
|
const body = isPlainObject2(requestOptions.body) || Array.isArray(requestOptions.body) ? JSON.stringify(requestOptions.body) : requestOptions.body;
|
||||||
redirect: requestOptions.request?.redirect,
|
const requestHeaders = Object.fromEntries(
|
||||||
// Header values must be `string`
|
Object.entries(requestOptions.headers).map(([name, value]) => [
|
||||||
headers: Object.fromEntries(
|
name,
|
||||||
Object.entries(requestOptions.headers).map(([name, value]) => [
|
String(value)
|
||||||
name,
|
])
|
||||||
String(value)
|
);
|
||||||
])
|
let fetchResponse;
|
||||||
),
|
try {
|
||||||
signal: requestOptions.request?.signal,
|
fetchResponse = await fetch(requestOptions.url, {
|
||||||
// duplex must be set if request.body is ReadableStream or Async Iterables.
|
method: requestOptions.method,
|
||||||
// See https://fetch.spec.whatwg.org/#dom-requestinit-duplex.
|
body,
|
||||||
...requestOptions.body && { duplex: "half" }
|
redirect: requestOptions.request?.redirect,
|
||||||
}).then(async (response) => {
|
headers: requestHeaders,
|
||||||
url = response.url;
|
signal: requestOptions.request?.signal,
|
||||||
status = response.status;
|
// duplex must be set if request.body is ReadableStream or Async Iterables.
|
||||||
for (const keyAndValue of response.headers) {
|
// See https://fetch.spec.whatwg.org/#dom-requestinit-duplex.
|
||||||
headers[keyAndValue[0]] = keyAndValue[1];
|
...requestOptions.body && { duplex: "half" }
|
||||||
}
|
});
|
||||||
if ("deprecation" in headers) {
|
} catch (error) {
|
||||||
const matches = headers.link && headers.link.match(/<([^>]+)>; rel="deprecation"/);
|
let message = "Unknown Error";
|
||||||
const deprecationLink = matches && matches.pop();
|
if (error instanceof Error) {
|
||||||
log.warn(
|
if (error.name === "AbortError") {
|
||||||
`[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${headers.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}`
|
error.status = 500;
|
||||||
);
|
throw error;
|
||||||
}
|
|
||||||
if (status === 204 || status === 205) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (requestOptions.method === "HEAD") {
|
|
||||||
if (status < 400) {
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
throw new RequestError(response.statusText, status, {
|
message = error.message;
|
||||||
response: {
|
if (error.name === "TypeError" && "cause" in error) {
|
||||||
url,
|
if (error.cause instanceof Error) {
|
||||||
status,
|
message = error.cause.message;
|
||||||
headers,
|
} else if (typeof error.cause === "string") {
|
||||||
data: void 0
|
message = error.cause;
|
||||||
},
|
}
|
||||||
request: requestOptions
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (status === 304) {
|
|
||||||
throw new RequestError("Not modified", status, {
|
|
||||||
response: {
|
|
||||||
url,
|
|
||||||
status,
|
|
||||||
headers,
|
|
||||||
data: await getResponseData(response)
|
|
||||||
},
|
|
||||||
request: requestOptions
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (status >= 400) {
|
|
||||||
const data = await getResponseData(response);
|
|
||||||
const error = new RequestError(toErrorMessage(data), status, {
|
|
||||||
response: {
|
|
||||||
url,
|
|
||||||
status,
|
|
||||||
headers,
|
|
||||||
data
|
|
||||||
},
|
|
||||||
request: requestOptions
|
|
||||||
});
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
return parseSuccessResponseBody ? await getResponseData(response) : response.body;
|
|
||||||
}).then((data) => {
|
|
||||||
return {
|
|
||||||
status,
|
|
||||||
url,
|
|
||||||
headers,
|
|
||||||
data
|
|
||||||
};
|
|
||||||
}).catch((error) => {
|
|
||||||
if (error instanceof RequestError)
|
|
||||||
throw error;
|
|
||||||
else if (error.name === "AbortError")
|
|
||||||
throw error;
|
|
||||||
let message = error.message;
|
|
||||||
if (error.name === "TypeError" && "cause" in error) {
|
|
||||||
if (error.cause instanceof Error) {
|
|
||||||
message = error.cause.message;
|
|
||||||
} else if (typeof error.cause === "string") {
|
|
||||||
message = error.cause;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw new RequestError(message, 500, {
|
const requestError = new RequestError(message, 500, {
|
||||||
request: requestOptions
|
request: requestOptions
|
||||||
});
|
});
|
||||||
});
|
requestError.cause = error;
|
||||||
|
throw requestError;
|
||||||
|
}
|
||||||
|
const status = fetchResponse.status;
|
||||||
|
const url = fetchResponse.url;
|
||||||
|
const responseHeaders = {};
|
||||||
|
for (const [key, value] of fetchResponse.headers) {
|
||||||
|
responseHeaders[key] = value;
|
||||||
|
}
|
||||||
|
const octokitResponse = {
|
||||||
|
url,
|
||||||
|
status,
|
||||||
|
headers: responseHeaders,
|
||||||
|
data: ""
|
||||||
|
};
|
||||||
|
if ("deprecation" in responseHeaders) {
|
||||||
|
const matches = responseHeaders.link && responseHeaders.link.match(/<([^>]+)>; rel="deprecation"/);
|
||||||
|
const deprecationLink = matches && matches.pop();
|
||||||
|
log.warn(
|
||||||
|
`[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${responseHeaders.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (status === 204 || status === 205) {
|
||||||
|
return octokitResponse;
|
||||||
|
}
|
||||||
|
if (requestOptions.method === "HEAD") {
|
||||||
|
if (status < 400) {
|
||||||
|
return octokitResponse;
|
||||||
|
}
|
||||||
|
throw new RequestError(fetchResponse.statusText, status, {
|
||||||
|
response: octokitResponse,
|
||||||
|
request: requestOptions
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (status === 304) {
|
||||||
|
octokitResponse.data = await getResponseData(fetchResponse);
|
||||||
|
throw new RequestError("Not modified", status, {
|
||||||
|
response: octokitResponse,
|
||||||
|
request: requestOptions
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (status >= 400) {
|
||||||
|
octokitResponse.data = await getResponseData(fetchResponse);
|
||||||
|
throw new RequestError(toErrorMessage(octokitResponse.data), status, {
|
||||||
|
response: octokitResponse,
|
||||||
|
request: requestOptions
|
||||||
|
});
|
||||||
|
}
|
||||||
|
octokitResponse.data = parseSuccessResponseBody ? await getResponseData(fetchResponse) : fetchResponse.body;
|
||||||
|
return octokitResponse;
|
||||||
}
|
}
|
||||||
async function getResponseData(response) {
|
async function getResponseData(response) {
|
||||||
const contentType = response.headers.get("content-type");
|
const contentType = response.headers.get("content-type");
|
||||||
@@ -37107,22 +37122,18 @@ async function getResponseData(response) {
|
|||||||
if (!contentType || /^text\/|charset=utf-8$/.test(contentType)) {
|
if (!contentType || /^text\/|charset=utf-8$/.test(contentType)) {
|
||||||
return response.text();
|
return response.text();
|
||||||
}
|
}
|
||||||
return getBufferResponse(response);
|
return response.arrayBuffer();
|
||||||
}
|
}
|
||||||
function toErrorMessage(data) {
|
function toErrorMessage(data) {
|
||||||
if (typeof data === "string")
|
if (typeof data === "string") {
|
||||||
return data;
|
return data;
|
||||||
let suffix;
|
}
|
||||||
if ("documentation_url" in data) {
|
if (data instanceof ArrayBuffer) {
|
||||||
suffix = ` - ${data.documentation_url}`;
|
return "Unknown error";
|
||||||
} else {
|
|
||||||
suffix = "";
|
|
||||||
}
|
}
|
||||||
if ("message" in data) {
|
if ("message" in data) {
|
||||||
if (Array.isArray(data.errors)) {
|
const suffix = "documentation_url" in data ? ` - ${data.documentation_url}` : "";
|
||||||
return `${data.message}: ${data.errors.map(JSON.stringify).join(", ")}${suffix}`;
|
return Array.isArray(data.errors) ? `${data.message}: ${data.errors.map((v) => JSON.stringify(v)).join(", ")}${suffix}` : `${data.message}${suffix}`;
|
||||||
}
|
|
||||||
return `${data.message}${suffix}`;
|
|
||||||
}
|
}
|
||||||
return `Unknown error: ${JSON.stringify(data)}`;
|
return `Unknown error: ${JSON.stringify(data)}`;
|
||||||
}
|
}
|
||||||
@@ -37149,11 +37160,7 @@ function withDefaults2(oldEndpoint, newDefaults) {
|
|||||||
defaults: withDefaults2.bind(null, endpoint2)
|
defaults: withDefaults2.bind(null, endpoint2)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
var request = withDefaults2(endpoint, {
|
var request = withDefaults2(endpoint, defaults_default);
|
||||||
headers: {
|
|
||||||
"user-agent": `octokit-request.js/${VERSION2} ${getUserAgent()}`
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// node_modules/@octokit/oauth-methods/dist-bundle/index.js
|
// node_modules/@octokit/oauth-methods/dist-bundle/index.js
|
||||||
function requestToOAuthBaseUrl(request2) {
|
function requestToOAuthBaseUrl(request2) {
|
||||||
@@ -39499,7 +39506,7 @@ async function hook4(state, request2, route, parameters) {
|
|||||||
state,
|
state,
|
||||||
// @ts-expect-error TBD
|
// @ts-expect-error TBD
|
||||||
{},
|
{},
|
||||||
request2
|
request2.defaults({ baseUrl: endpoint2.baseUrl })
|
||||||
);
|
);
|
||||||
endpoint2.headers.authorization = `token ${token}`;
|
endpoint2.headers.authorization = `token ${token}`;
|
||||||
return sendRequestWithRetries(
|
return sendRequestWithRetries(
|
||||||
@@ -39532,7 +39539,7 @@ async function sendRequestWithRetries(state, request2, options, createdAt, retri
|
|||||||
return sendRequestWithRetries(state, request2, options, createdAt, retries);
|
return sendRequestWithRetries(state, request2, options, createdAt, retries);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var VERSION6 = "7.1.0";
|
var VERSION6 = "7.1.1";
|
||||||
function createAppAuth(options) {
|
function createAppAuth(options) {
|
||||||
if (!options.appId) {
|
if (!options.appId) {
|
||||||
throw new Error("[@octokit/auth-app] appId option is required");
|
throw new Error("[@octokit/auth-app] appId option is required");
|
||||||
|
|||||||
563
dist/post.cjs
vendored
563
dist/post.cjs
vendored
@@ -2238,6 +2238,7 @@ var require_decodeText = __commonJS({
|
|||||||
return decoders.utf8;
|
return decoders.utf8;
|
||||||
case "latin1":
|
case "latin1":
|
||||||
case "ascii":
|
case "ascii":
|
||||||
|
// TODO: Make these a separate, strict decoder?
|
||||||
case "us-ascii":
|
case "us-ascii":
|
||||||
case "iso-8859-1":
|
case "iso-8859-1":
|
||||||
case "iso8859-1":
|
case "iso8859-1":
|
||||||
@@ -2937,6 +2938,7 @@ var require_basename = __commonJS({
|
|||||||
for (var i = path.length - 1; i >= 0; --i) {
|
for (var i = path.length - 1; i >= 0; --i) {
|
||||||
switch (path.charCodeAt(i)) {
|
switch (path.charCodeAt(i)) {
|
||||||
case 47:
|
case 47:
|
||||||
|
// '/'
|
||||||
case 92:
|
case 92:
|
||||||
path = path.slice(i + 1);
|
path = path.slice(i + 1);
|
||||||
return path === ".." || path === "." ? "" : path;
|
return path === ".." || path === "." ? "" : path;
|
||||||
@@ -4171,7 +4173,21 @@ var require_util2 = __commonJS({
|
|||||||
return referrerOrigin;
|
return referrerOrigin;
|
||||||
}
|
}
|
||||||
case "strict-origin":
|
case "strict-origin":
|
||||||
|
// eslint-disable-line
|
||||||
|
/**
|
||||||
|
* 1. If referrerURL is a potentially trustworthy URL and
|
||||||
|
* request’s current URL is not a potentially trustworthy URL,
|
||||||
|
* then return no referrer.
|
||||||
|
* 2. Return referrerOrigin
|
||||||
|
*/
|
||||||
case "no-referrer-when-downgrade":
|
case "no-referrer-when-downgrade":
|
||||||
|
// eslint-disable-line
|
||||||
|
/**
|
||||||
|
* 1. If referrerURL is a potentially trustworthy URL and
|
||||||
|
* request’s current URL is not a potentially trustworthy URL,
|
||||||
|
* then return no referrer.
|
||||||
|
* 2. Return referrerOrigin
|
||||||
|
*/
|
||||||
default:
|
default:
|
||||||
return isNonPotentiallyTrustWorthy ? "no-referrer" : referrerOrigin;
|
return isNonPotentiallyTrustWorthy ? "no-referrer" : referrerOrigin;
|
||||||
}
|
}
|
||||||
@@ -19943,6 +19959,27 @@ var require_util8 = __commonJS({
|
|||||||
}
|
}
|
||||||
var kEnumerableProperty = /* @__PURE__ */ Object.create(null);
|
var kEnumerableProperty = /* @__PURE__ */ Object.create(null);
|
||||||
kEnumerableProperty.enumerable = true;
|
kEnumerableProperty.enumerable = true;
|
||||||
|
var normalizedMethodRecordsBase = {
|
||||||
|
delete: "DELETE",
|
||||||
|
DELETE: "DELETE",
|
||||||
|
get: "GET",
|
||||||
|
GET: "GET",
|
||||||
|
head: "HEAD",
|
||||||
|
HEAD: "HEAD",
|
||||||
|
options: "OPTIONS",
|
||||||
|
OPTIONS: "OPTIONS",
|
||||||
|
post: "POST",
|
||||||
|
POST: "POST",
|
||||||
|
put: "PUT",
|
||||||
|
PUT: "PUT"
|
||||||
|
};
|
||||||
|
var normalizedMethodRecords = {
|
||||||
|
...normalizedMethodRecordsBase,
|
||||||
|
patch: "patch",
|
||||||
|
PATCH: "PATCH"
|
||||||
|
};
|
||||||
|
Object.setPrototypeOf(normalizedMethodRecordsBase, null);
|
||||||
|
Object.setPrototypeOf(normalizedMethodRecords, null);
|
||||||
module2.exports = {
|
module2.exports = {
|
||||||
kEnumerableProperty,
|
kEnumerableProperty,
|
||||||
nop,
|
nop,
|
||||||
@@ -19981,6 +20018,8 @@ var require_util8 = __commonJS({
|
|||||||
isValidHeaderValue,
|
isValidHeaderValue,
|
||||||
isTokenCharCode,
|
isTokenCharCode,
|
||||||
parseRangeHeader,
|
parseRangeHeader,
|
||||||
|
normalizedMethodRecordsBase,
|
||||||
|
normalizedMethodRecords,
|
||||||
isValidPort,
|
isValidPort,
|
||||||
isHttpOrHttpsPrefixed,
|
isHttpOrHttpsPrefixed,
|
||||||
nodeMajor,
|
nodeMajor,
|
||||||
@@ -20196,7 +20235,8 @@ var require_request3 = __commonJS({
|
|||||||
isBlobLike,
|
isBlobLike,
|
||||||
buildURL,
|
buildURL,
|
||||||
validateHandler,
|
validateHandler,
|
||||||
getServerName
|
getServerName,
|
||||||
|
normalizedMethodRecords
|
||||||
} = require_util8();
|
} = require_util8();
|
||||||
var { channels } = require_diagnostics();
|
var { channels } = require_diagnostics();
|
||||||
var { headerNameLowerCasedRecord } = require_constants6();
|
var { headerNameLowerCasedRecord } = require_constants6();
|
||||||
@@ -20223,12 +20263,12 @@ var require_request3 = __commonJS({
|
|||||||
throw new InvalidArgumentError("path must be a string");
|
throw new InvalidArgumentError("path must be a string");
|
||||||
} else if (path[0] !== "/" && !(path.startsWith("http://") || path.startsWith("https://")) && method !== "CONNECT") {
|
} else if (path[0] !== "/" && !(path.startsWith("http://") || path.startsWith("https://")) && method !== "CONNECT") {
|
||||||
throw new InvalidArgumentError("path must be an absolute URL or start with a slash");
|
throw new InvalidArgumentError("path must be an absolute URL or start with a slash");
|
||||||
} else if (invalidPathRegex.exec(path) !== null) {
|
} else if (invalidPathRegex.test(path)) {
|
||||||
throw new InvalidArgumentError("invalid request path");
|
throw new InvalidArgumentError("invalid request path");
|
||||||
}
|
}
|
||||||
if (typeof method !== "string") {
|
if (typeof method !== "string") {
|
||||||
throw new InvalidArgumentError("method must be a string");
|
throw new InvalidArgumentError("method must be a string");
|
||||||
} else if (!isValidHTTPToken(method)) {
|
} else if (normalizedMethodRecords[method] === void 0 && !isValidHTTPToken(method)) {
|
||||||
throw new InvalidArgumentError("invalid request method");
|
throw new InvalidArgumentError("invalid request method");
|
||||||
}
|
}
|
||||||
if (upgrade && typeof upgrade !== "string") {
|
if (upgrade && typeof upgrade !== "string") {
|
||||||
@@ -20773,7 +20813,7 @@ var require_connect2 = __commonJS({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
function buildConnector({ allowH2, maxCachedSessions, socketPath, timeout, ...opts }) {
|
function buildConnector({ allowH2, maxCachedSessions, socketPath, timeout, session: customSession, ...opts }) {
|
||||||
if (maxCachedSessions != null && (!Number.isInteger(maxCachedSessions) || maxCachedSessions < 0)) {
|
if (maxCachedSessions != null && (!Number.isInteger(maxCachedSessions) || maxCachedSessions < 0)) {
|
||||||
throw new InvalidArgumentError("maxCachedSessions must be a positive integer or zero");
|
throw new InvalidArgumentError("maxCachedSessions must be a positive integer or zero");
|
||||||
}
|
}
|
||||||
@@ -20789,7 +20829,7 @@ var require_connect2 = __commonJS({
|
|||||||
}
|
}
|
||||||
servername = servername || options.servername || util.getServerName(host) || null;
|
servername = servername || options.servername || util.getServerName(host) || null;
|
||||||
const sessionKey = servername || hostname;
|
const sessionKey = servername || hostname;
|
||||||
const session = sessionCache.get(sessionKey) || null;
|
const session = customSession || sessionCache.get(sessionKey) || null;
|
||||||
assert(sessionKey);
|
assert(sessionKey);
|
||||||
socket = tls.connect({
|
socket = tls.connect({
|
||||||
highWaterMark: 16384,
|
highWaterMark: 16384,
|
||||||
@@ -22307,7 +22347,7 @@ var require_util9 = __commonJS({
|
|||||||
var { getGlobalOrigin } = require_global3();
|
var { getGlobalOrigin } = require_global3();
|
||||||
var { collectASequenceOfCodePoints, collectAnHTTPQuotedString, removeChars, parseMIMEType } = require_data_url();
|
var { collectASequenceOfCodePoints, collectAnHTTPQuotedString, removeChars, parseMIMEType } = require_data_url();
|
||||||
var { performance: performance2 } = require("node:perf_hooks");
|
var { performance: performance2 } = require("node:perf_hooks");
|
||||||
var { isBlobLike, ReadableStreamFrom, isValidHTTPToken } = require_util8();
|
var { isBlobLike, ReadableStreamFrom, isValidHTTPToken, normalizedMethodRecordsBase } = require_util8();
|
||||||
var assert = require("node:assert");
|
var assert = require("node:assert");
|
||||||
var { isUint8Array } = require("node:util/types");
|
var { isUint8Array } = require("node:util/types");
|
||||||
var { webidl } = require_webidl2();
|
var { webidl } = require_webidl2();
|
||||||
@@ -22414,7 +22454,7 @@ var require_util9 = __commonJS({
|
|||||||
}
|
}
|
||||||
function appendRequestOriginHeader(request2) {
|
function appendRequestOriginHeader(request2) {
|
||||||
let serializedOrigin = request2.origin;
|
let serializedOrigin = request2.origin;
|
||||||
if (serializedOrigin === "client") {
|
if (serializedOrigin === "client" || serializedOrigin === void 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (request2.responseTainting === "cors" || request2.mode === "websocket") {
|
if (request2.responseTainting === "cors" || request2.mode === "websocket") {
|
||||||
@@ -22532,7 +22572,21 @@ var require_util9 = __commonJS({
|
|||||||
return referrerOrigin;
|
return referrerOrigin;
|
||||||
}
|
}
|
||||||
case "strict-origin":
|
case "strict-origin":
|
||||||
|
// eslint-disable-line
|
||||||
|
/**
|
||||||
|
* 1. If referrerURL is a potentially trustworthy URL and
|
||||||
|
* request’s current URL is not a potentially trustworthy URL,
|
||||||
|
* then return no referrer.
|
||||||
|
* 2. Return referrerOrigin
|
||||||
|
*/
|
||||||
case "no-referrer-when-downgrade":
|
case "no-referrer-when-downgrade":
|
||||||
|
// eslint-disable-line
|
||||||
|
/**
|
||||||
|
* 1. If referrerURL is a potentially trustworthy URL and
|
||||||
|
* request’s current URL is not a potentially trustworthy URL,
|
||||||
|
* then return no referrer.
|
||||||
|
* 2. Return referrerOrigin
|
||||||
|
*/
|
||||||
default:
|
default:
|
||||||
return isNonPotentiallyTrustWorthy ? "no-referrer" : referrerOrigin;
|
return isNonPotentiallyTrustWorthy ? "no-referrer" : referrerOrigin;
|
||||||
}
|
}
|
||||||
@@ -22695,29 +22749,8 @@ var require_util9 = __commonJS({
|
|||||||
function isCancelled(fetchParams) {
|
function isCancelled(fetchParams) {
|
||||||
return fetchParams.controller.state === "aborted" || fetchParams.controller.state === "terminated";
|
return fetchParams.controller.state === "aborted" || fetchParams.controller.state === "terminated";
|
||||||
}
|
}
|
||||||
var normalizeMethodRecordBase = {
|
|
||||||
delete: "DELETE",
|
|
||||||
DELETE: "DELETE",
|
|
||||||
get: "GET",
|
|
||||||
GET: "GET",
|
|
||||||
head: "HEAD",
|
|
||||||
HEAD: "HEAD",
|
|
||||||
options: "OPTIONS",
|
|
||||||
OPTIONS: "OPTIONS",
|
|
||||||
post: "POST",
|
|
||||||
POST: "POST",
|
|
||||||
put: "PUT",
|
|
||||||
PUT: "PUT"
|
|
||||||
};
|
|
||||||
var normalizeMethodRecord = {
|
|
||||||
...normalizeMethodRecordBase,
|
|
||||||
patch: "patch",
|
|
||||||
PATCH: "PATCH"
|
|
||||||
};
|
|
||||||
Object.setPrototypeOf(normalizeMethodRecordBase, null);
|
|
||||||
Object.setPrototypeOf(normalizeMethodRecord, null);
|
|
||||||
function normalizeMethod(method) {
|
function normalizeMethod(method) {
|
||||||
return normalizeMethodRecordBase[method.toLowerCase()] ?? method;
|
return normalizedMethodRecordsBase[method.toLowerCase()] ?? method;
|
||||||
}
|
}
|
||||||
function serializeJavascriptValueToJSONString(value) {
|
function serializeJavascriptValueToJSONString(value) {
|
||||||
const result = JSON.stringify(value);
|
const result = JSON.stringify(value);
|
||||||
@@ -22854,7 +22887,7 @@ var require_util9 = __commonJS({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
async function fullyReadBody(body, processBody, processBodyError, shouldClone) {
|
async function fullyReadBody(body, processBody, processBodyError) {
|
||||||
const successSteps = processBody;
|
const successSteps = processBody;
|
||||||
const errorSteps = processBodyError;
|
const errorSteps = processBodyError;
|
||||||
let reader;
|
let reader;
|
||||||
@@ -22865,7 +22898,7 @@ var require_util9 = __commonJS({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
successSteps(await readAllBytes(reader, shouldClone));
|
successSteps(await readAllBytes(reader));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
errorSteps(e);
|
errorSteps(e);
|
||||||
}
|
}
|
||||||
@@ -22888,19 +22921,12 @@ var require_util9 = __commonJS({
|
|||||||
assert(!invalidIsomorphicEncodeValueRegex.test(input));
|
assert(!invalidIsomorphicEncodeValueRegex.test(input));
|
||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
async function readAllBytes(reader, shouldClone) {
|
async function readAllBytes(reader) {
|
||||||
const bytes = [];
|
const bytes = [];
|
||||||
let byteLength = 0;
|
let byteLength = 0;
|
||||||
while (true) {
|
while (true) {
|
||||||
const { done, value: chunk } = await reader.read();
|
const { done, value: chunk } = await reader.read();
|
||||||
if (done) {
|
if (done) {
|
||||||
if (bytes.length === 1) {
|
|
||||||
const { buffer, byteOffset, byteLength: byteLength2 } = bytes[0];
|
|
||||||
if (shouldClone === false) {
|
|
||||||
return Buffer.from(buffer, byteOffset, byteLength2);
|
|
||||||
}
|
|
||||||
return Buffer.from(buffer.slice(byteOffset, byteOffset + byteLength2), 0, byteLength2);
|
|
||||||
}
|
|
||||||
return Buffer.concat(bytes, byteLength);
|
return Buffer.concat(bytes, byteLength);
|
||||||
}
|
}
|
||||||
if (!isUint8Array(chunk)) {
|
if (!isUint8Array(chunk)) {
|
||||||
@@ -23163,7 +23189,6 @@ var require_util9 = __commonJS({
|
|||||||
urlHasHttpsScheme,
|
urlHasHttpsScheme,
|
||||||
urlIsHttpHttpsScheme,
|
urlIsHttpHttpsScheme,
|
||||||
readAllBytes,
|
readAllBytes,
|
||||||
normalizeMethodRecord,
|
|
||||||
simpleRangeHeaderValue,
|
simpleRangeHeaderValue,
|
||||||
buildContentRange,
|
buildContentRange,
|
||||||
parseMetadata,
|
parseMetadata,
|
||||||
@@ -23663,11 +23688,23 @@ var require_body2 = __commonJS({
|
|||||||
var { webidl } = require_webidl2();
|
var { webidl } = require_webidl2();
|
||||||
var { Blob: Blob2 } = require("node:buffer");
|
var { Blob: Blob2 } = require("node:buffer");
|
||||||
var assert = require("node:assert");
|
var assert = require("node:assert");
|
||||||
var { isErrored } = require_util8();
|
var { isErrored, isDisturbed } = require("node:stream");
|
||||||
var { isArrayBuffer } = require("node:util/types");
|
var { isArrayBuffer } = require("node:util/types");
|
||||||
var { serializeAMimeType } = require_data_url();
|
var { serializeAMimeType } = require_data_url();
|
||||||
var { multipartFormDataParser } = require_formdata_parser();
|
var { multipartFormDataParser } = require_formdata_parser();
|
||||||
var textEncoder = new TextEncoder();
|
var textEncoder = new TextEncoder();
|
||||||
|
function noop() {
|
||||||
|
}
|
||||||
|
var hasFinalizationRegistry = globalThis.FinalizationRegistry && process.version.indexOf("v18") !== 0;
|
||||||
|
var streamRegistry;
|
||||||
|
if (hasFinalizationRegistry) {
|
||||||
|
streamRegistry = new FinalizationRegistry((weakRef) => {
|
||||||
|
const stream = weakRef.deref();
|
||||||
|
if (stream && !stream.locked && !isDisturbed(stream) && !isErrored(stream)) {
|
||||||
|
stream.cancel("Response object has been garbage collected").catch(noop);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
function extractBody(object, keepalive = false) {
|
function extractBody(object, keepalive = false) {
|
||||||
let stream = null;
|
let stream = null;
|
||||||
if (object instanceof ReadableStream) {
|
if (object instanceof ReadableStream) {
|
||||||
@@ -23810,8 +23847,11 @@ Content-Type: ${value.type || "application/octet-stream"}\r
|
|||||||
}
|
}
|
||||||
return extractBody(object, keepalive);
|
return extractBody(object, keepalive);
|
||||||
}
|
}
|
||||||
function cloneBody(body) {
|
function cloneBody(instance, body) {
|
||||||
const [out1, out2] = body.stream.tee();
|
const [out1, out2] = body.stream.tee();
|
||||||
|
if (hasFinalizationRegistry) {
|
||||||
|
streamRegistry.register(instance, new WeakRef(out1));
|
||||||
|
}
|
||||||
body.stream = out1;
|
body.stream = out1;
|
||||||
return {
|
return {
|
||||||
stream: out2,
|
stream: out2,
|
||||||
@@ -23835,18 +23875,18 @@ Content-Type: ${value.type || "application/octet-stream"}\r
|
|||||||
mimeType = serializeAMimeType(mimeType);
|
mimeType = serializeAMimeType(mimeType);
|
||||||
}
|
}
|
||||||
return new Blob2([bytes], { type: mimeType });
|
return new Blob2([bytes], { type: mimeType });
|
||||||
}, instance, false);
|
}, instance);
|
||||||
},
|
},
|
||||||
arrayBuffer() {
|
arrayBuffer() {
|
||||||
return consumeBody(this, (bytes) => {
|
return consumeBody(this, (bytes) => {
|
||||||
return bytes.buffer;
|
return new Uint8Array(bytes).buffer;
|
||||||
}, instance, true);
|
}, instance);
|
||||||
},
|
},
|
||||||
text() {
|
text() {
|
||||||
return consumeBody(this, utf8DecodeBytes, instance, false);
|
return consumeBody(this, utf8DecodeBytes, instance);
|
||||||
},
|
},
|
||||||
json() {
|
json() {
|
||||||
return consumeBody(this, parseJSONFromBytes, instance, false);
|
return consumeBody(this, parseJSONFromBytes, instance);
|
||||||
},
|
},
|
||||||
formData() {
|
formData() {
|
||||||
return consumeBody(this, (value) => {
|
return consumeBody(this, (value) => {
|
||||||
@@ -23875,12 +23915,12 @@ Content-Type: ${value.type || "application/octet-stream"}\r
|
|||||||
throw new TypeError(
|
throw new TypeError(
|
||||||
'Content-Type was not one of "multipart/form-data" or "application/x-www-form-urlencoded".'
|
'Content-Type was not one of "multipart/form-data" or "application/x-www-form-urlencoded".'
|
||||||
);
|
);
|
||||||
}, instance, false);
|
}, instance);
|
||||||
},
|
},
|
||||||
bytes() {
|
bytes() {
|
||||||
return consumeBody(this, (bytes) => {
|
return consumeBody(this, (bytes) => {
|
||||||
return new Uint8Array(bytes.buffer, 0, bytes.byteLength);
|
return new Uint8Array(bytes);
|
||||||
}, instance, true);
|
}, instance);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return methods;
|
return methods;
|
||||||
@@ -23888,9 +23928,9 @@ Content-Type: ${value.type || "application/octet-stream"}\r
|
|||||||
function mixinBody(prototype) {
|
function mixinBody(prototype) {
|
||||||
Object.assign(prototype.prototype, bodyMixinMethods(prototype));
|
Object.assign(prototype.prototype, bodyMixinMethods(prototype));
|
||||||
}
|
}
|
||||||
async function consumeBody(object, convertBytesToJSValue, instance, shouldClone) {
|
async function consumeBody(object, convertBytesToJSValue, instance) {
|
||||||
webidl.brandCheck(object, instance);
|
webidl.brandCheck(object, instance);
|
||||||
if (bodyUnusable(object[kState].body)) {
|
if (bodyUnusable(object)) {
|
||||||
throw new TypeError("Body is unusable: Body has already been read");
|
throw new TypeError("Body is unusable: Body has already been read");
|
||||||
}
|
}
|
||||||
throwIfAborted(object[kState]);
|
throwIfAborted(object[kState]);
|
||||||
@@ -23907,10 +23947,11 @@ Content-Type: ${value.type || "application/octet-stream"}\r
|
|||||||
successSteps(Buffer.allocUnsafe(0));
|
successSteps(Buffer.allocUnsafe(0));
|
||||||
return promise.promise;
|
return promise.promise;
|
||||||
}
|
}
|
||||||
await fullyReadBody(object[kState].body, successSteps, errorSteps, shouldClone);
|
await fullyReadBody(object[kState].body, successSteps, errorSteps);
|
||||||
return promise.promise;
|
return promise.promise;
|
||||||
}
|
}
|
||||||
function bodyUnusable(body) {
|
function bodyUnusable(object) {
|
||||||
|
const body = object[kState].body;
|
||||||
return body != null && (body.stream.locked || util.isDisturbed(body.stream));
|
return body != null && (body.stream.locked || util.isDisturbed(body.stream));
|
||||||
}
|
}
|
||||||
function parseJSONFromBytes(bytes) {
|
function parseJSONFromBytes(bytes) {
|
||||||
@@ -23928,7 +23969,10 @@ Content-Type: ${value.type || "application/octet-stream"}\r
|
|||||||
extractBody,
|
extractBody,
|
||||||
safelyExtractBody,
|
safelyExtractBody,
|
||||||
cloneBody,
|
cloneBody,
|
||||||
mixinBody
|
mixinBody,
|
||||||
|
streamRegistry,
|
||||||
|
hasFinalizationRegistry,
|
||||||
|
bodyUnusable
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -24660,25 +24704,25 @@ upgrade: ${upgrade}\r
|
|||||||
channels.sendHeaders.publish({ request: request2, headers: header, socket });
|
channels.sendHeaders.publish({ request: request2, headers: header, socket });
|
||||||
}
|
}
|
||||||
if (!body || bodyLength === 0) {
|
if (!body || bodyLength === 0) {
|
||||||
writeBuffer({ abort, body: null, client, request: request2, socket, contentLength, header, expectsPayload });
|
writeBuffer(abort, null, client, request2, socket, contentLength, header, expectsPayload);
|
||||||
} else if (util.isBuffer(body)) {
|
} else if (util.isBuffer(body)) {
|
||||||
writeBuffer({ abort, body, client, request: request2, socket, contentLength, header, expectsPayload });
|
writeBuffer(abort, body, client, request2, socket, contentLength, header, expectsPayload);
|
||||||
} else if (util.isBlobLike(body)) {
|
} else if (util.isBlobLike(body)) {
|
||||||
if (typeof body.stream === "function") {
|
if (typeof body.stream === "function") {
|
||||||
writeIterable({ abort, body: body.stream(), client, request: request2, socket, contentLength, header, expectsPayload });
|
writeIterable(abort, body.stream(), client, request2, socket, contentLength, header, expectsPayload);
|
||||||
} else {
|
} else {
|
||||||
writeBlob({ abort, body, client, request: request2, socket, contentLength, header, expectsPayload });
|
writeBlob(abort, body, client, request2, socket, contentLength, header, expectsPayload);
|
||||||
}
|
}
|
||||||
} else if (util.isStream(body)) {
|
} else if (util.isStream(body)) {
|
||||||
writeStream({ abort, body, client, request: request2, socket, contentLength, header, expectsPayload });
|
writeStream(abort, body, client, request2, socket, contentLength, header, expectsPayload);
|
||||||
} else if (util.isIterable(body)) {
|
} else if (util.isIterable(body)) {
|
||||||
writeIterable({ abort, body, client, request: request2, socket, contentLength, header, expectsPayload });
|
writeIterable(abort, body, client, request2, socket, contentLength, header, expectsPayload);
|
||||||
} else {
|
} else {
|
||||||
assert(false);
|
assert(false);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
function writeStream({ abort, body, client, request: request2, socket, contentLength, header, expectsPayload }) {
|
function writeStream(abort, body, client, request2, socket, contentLength, header, expectsPayload) {
|
||||||
assert(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined");
|
assert(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined");
|
||||||
let finished = false;
|
let finished = false;
|
||||||
const writer = new AsyncWriter({ abort, socket, request: request2, contentLength, client, expectsPayload, header });
|
const writer = new AsyncWriter({ abort, socket, request: request2, contentLength, client, expectsPayload, header });
|
||||||
@@ -24747,7 +24791,7 @@ upgrade: ${upgrade}\r
|
|||||||
setImmediate(onClose);
|
setImmediate(onClose);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function writeBuffer({ abort, body, client, request: request2, socket, contentLength, header, expectsPayload }) {
|
function writeBuffer(abort, body, client, request2, socket, contentLength, header, expectsPayload) {
|
||||||
try {
|
try {
|
||||||
if (!body) {
|
if (!body) {
|
||||||
if (contentLength === 0) {
|
if (contentLength === 0) {
|
||||||
@@ -24778,7 +24822,7 @@ upgrade: ${upgrade}\r
|
|||||||
abort(err);
|
abort(err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
async function writeBlob({ abort, body, client, request: request2, socket, contentLength, header, expectsPayload }) {
|
async function writeBlob(abort, body, client, request2, socket, contentLength, header, expectsPayload) {
|
||||||
assert(contentLength === body.size, "blob body must have content length");
|
assert(contentLength === body.size, "blob body must have content length");
|
||||||
try {
|
try {
|
||||||
if (contentLength != null && contentLength !== body.size) {
|
if (contentLength != null && contentLength !== body.size) {
|
||||||
@@ -24801,7 +24845,7 @@ upgrade: ${upgrade}\r
|
|||||||
abort(err);
|
abort(err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
async function writeIterable({ abort, body, client, request: request2, socket, contentLength, header, expectsPayload }) {
|
async function writeIterable(abort, body, client, request2, socket, contentLength, header, expectsPayload) {
|
||||||
assert(contentLength !== 0 || client[kRunning] === 0, "iterator body cannot be pipelined");
|
assert(contentLength !== 0 || client[kRunning] === 0, "iterator body cannot be pipelined");
|
||||||
let callback = null;
|
let callback = null;
|
||||||
function onDrain() {
|
function onDrain() {
|
||||||
@@ -25264,81 +25308,79 @@ var require_client_h2 = __commonJS({
|
|||||||
return true;
|
return true;
|
||||||
function writeBodyH2() {
|
function writeBodyH2() {
|
||||||
if (!body || contentLength === 0) {
|
if (!body || contentLength === 0) {
|
||||||
writeBuffer({
|
writeBuffer(
|
||||||
abort,
|
abort,
|
||||||
|
stream,
|
||||||
|
null,
|
||||||
client,
|
client,
|
||||||
request: request2,
|
request2,
|
||||||
|
client[kSocket],
|
||||||
contentLength,
|
contentLength,
|
||||||
expectsPayload,
|
expectsPayload
|
||||||
h2stream: stream,
|
);
|
||||||
body: null,
|
|
||||||
socket: client[kSocket]
|
|
||||||
});
|
|
||||||
} else if (util.isBuffer(body)) {
|
} else if (util.isBuffer(body)) {
|
||||||
writeBuffer({
|
writeBuffer(
|
||||||
abort,
|
abort,
|
||||||
client,
|
stream,
|
||||||
request: request2,
|
|
||||||
contentLength,
|
|
||||||
body,
|
body,
|
||||||
expectsPayload,
|
client,
|
||||||
h2stream: stream,
|
request2,
|
||||||
socket: client[kSocket]
|
client[kSocket],
|
||||||
});
|
contentLength,
|
||||||
|
expectsPayload
|
||||||
|
);
|
||||||
} else if (util.isBlobLike(body)) {
|
} else if (util.isBlobLike(body)) {
|
||||||
if (typeof body.stream === "function") {
|
if (typeof body.stream === "function") {
|
||||||
writeIterable({
|
writeIterable(
|
||||||
abort,
|
abort,
|
||||||
|
stream,
|
||||||
|
body.stream(),
|
||||||
client,
|
client,
|
||||||
request: request2,
|
request2,
|
||||||
|
client[kSocket],
|
||||||
contentLength,
|
contentLength,
|
||||||
expectsPayload,
|
expectsPayload
|
||||||
h2stream: stream,
|
);
|
||||||
body: body.stream(),
|
|
||||||
socket: client[kSocket]
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
writeBlob({
|
writeBlob(
|
||||||
abort,
|
abort,
|
||||||
|
stream,
|
||||||
body,
|
body,
|
||||||
client,
|
client,
|
||||||
request: request2,
|
request2,
|
||||||
|
client[kSocket],
|
||||||
contentLength,
|
contentLength,
|
||||||
expectsPayload,
|
expectsPayload
|
||||||
h2stream: stream,
|
);
|
||||||
socket: client[kSocket]
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
} else if (util.isStream(body)) {
|
} else if (util.isStream(body)) {
|
||||||
writeStream({
|
writeStream(
|
||||||
abort,
|
abort,
|
||||||
|
client[kSocket],
|
||||||
|
expectsPayload,
|
||||||
|
stream,
|
||||||
body,
|
body,
|
||||||
client,
|
client,
|
||||||
request: request2,
|
request2,
|
||||||
contentLength,
|
contentLength
|
||||||
expectsPayload,
|
);
|
||||||
socket: client[kSocket],
|
|
||||||
h2stream: stream,
|
|
||||||
header: ""
|
|
||||||
});
|
|
||||||
} else if (util.isIterable(body)) {
|
} else if (util.isIterable(body)) {
|
||||||
writeIterable({
|
writeIterable(
|
||||||
abort,
|
abort,
|
||||||
|
stream,
|
||||||
body,
|
body,
|
||||||
client,
|
client,
|
||||||
request: request2,
|
request2,
|
||||||
|
client[kSocket],
|
||||||
contentLength,
|
contentLength,
|
||||||
expectsPayload,
|
expectsPayload
|
||||||
header: "",
|
);
|
||||||
h2stream: stream,
|
|
||||||
socket: client[kSocket]
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
assert(false);
|
assert(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function writeBuffer({ abort, h2stream, body, client, request: request2, socket, contentLength, expectsPayload }) {
|
function writeBuffer(abort, h2stream, body, client, request2, socket, contentLength, expectsPayload) {
|
||||||
try {
|
try {
|
||||||
if (body != null && util.isBuffer(body)) {
|
if (body != null && util.isBuffer(body)) {
|
||||||
assert(contentLength === body.byteLength, "buffer body must have content length");
|
assert(contentLength === body.byteLength, "buffer body must have content length");
|
||||||
@@ -25357,7 +25399,7 @@ var require_client_h2 = __commonJS({
|
|||||||
abort(error);
|
abort(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function writeStream({ abort, socket, expectsPayload, h2stream, body, client, request: request2, contentLength }) {
|
function writeStream(abort, socket, expectsPayload, h2stream, body, client, request2, contentLength) {
|
||||||
assert(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined");
|
assert(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined");
|
||||||
const pipe = pipeline(
|
const pipe = pipeline(
|
||||||
body,
|
body,
|
||||||
@@ -25381,7 +25423,7 @@ var require_client_h2 = __commonJS({
|
|||||||
request2.onBodySent(chunk);
|
request2.onBodySent(chunk);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
async function writeBlob({ abort, h2stream, body, client, request: request2, socket, contentLength, expectsPayload }) {
|
async function writeBlob(abort, h2stream, body, client, request2, socket, contentLength, expectsPayload) {
|
||||||
assert(contentLength === body.size, "blob body must have content length");
|
assert(contentLength === body.size, "blob body must have content length");
|
||||||
try {
|
try {
|
||||||
if (contentLength != null && contentLength !== body.size) {
|
if (contentLength != null && contentLength !== body.size) {
|
||||||
@@ -25402,7 +25444,7 @@ var require_client_h2 = __commonJS({
|
|||||||
abort(err);
|
abort(err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
async function writeIterable({ abort, h2stream, body, client, request: request2, socket, contentLength, expectsPayload }) {
|
async function writeIterable(abort, h2stream, body, client, request2, socket, contentLength, expectsPayload) {
|
||||||
assert(contentLength !== 0 || client[kRunning] === 0, "iterator body cannot be pipelined");
|
assert(contentLength !== 0 || client[kRunning] === 0, "iterator body cannot be pipelined");
|
||||||
let callback = null;
|
let callback = null;
|
||||||
function onDrain() {
|
function onDrain() {
|
||||||
@@ -26484,8 +26526,13 @@ var require_balanced_pool2 = __commonJS({
|
|||||||
var kMaxWeightPerServer = Symbol("kMaxWeightPerServer");
|
var kMaxWeightPerServer = Symbol("kMaxWeightPerServer");
|
||||||
var kErrorPenalty = Symbol("kErrorPenalty");
|
var kErrorPenalty = Symbol("kErrorPenalty");
|
||||||
function getGreatestCommonDivisor(a, b) {
|
function getGreatestCommonDivisor(a, b) {
|
||||||
if (b === 0) return a;
|
if (a === 0) return b;
|
||||||
return getGreatestCommonDivisor(b, a % b);
|
while (b !== 0) {
|
||||||
|
const t = b;
|
||||||
|
b = a % b;
|
||||||
|
a = t;
|
||||||
|
}
|
||||||
|
return a;
|
||||||
}
|
}
|
||||||
function defaultFactory(origin, opts) {
|
function defaultFactory(origin, opts) {
|
||||||
return new Pool(origin, opts);
|
return new Pool(origin, opts);
|
||||||
@@ -26539,7 +26586,11 @@ var require_balanced_pool2 = __commonJS({
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
_updateBalancedPoolStats() {
|
_updateBalancedPoolStats() {
|
||||||
this[kGreatestCommonDivisor] = this[kClients].map((p) => p[kWeight]).reduce(getGreatestCommonDivisor, 0);
|
let result = 0;
|
||||||
|
for (let i = 0; i < this[kClients].length; i++) {
|
||||||
|
result = getGreatestCommonDivisor(this[kClients][i][kWeight], result);
|
||||||
|
}
|
||||||
|
this[kGreatestCommonDivisor] = result;
|
||||||
}
|
}
|
||||||
removeUpstream(upstream) {
|
removeUpstream(upstream) {
|
||||||
const upstreamOrigin = parseOrigin(upstream).origin;
|
const upstreamOrigin = parseOrigin(upstream).origin;
|
||||||
@@ -27147,7 +27198,7 @@ var require_retry_handler = __commonJS({
|
|||||||
this.abort(
|
this.abort(
|
||||||
new RequestRetryError("Content-Range mismatch", statusCode, {
|
new RequestRetryError("Content-Range mismatch", statusCode, {
|
||||||
headers,
|
headers,
|
||||||
count: this.retryCount
|
data: { count: this.retryCount }
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
return false;
|
return false;
|
||||||
@@ -27156,7 +27207,7 @@ var require_retry_handler = __commonJS({
|
|||||||
this.abort(
|
this.abort(
|
||||||
new RequestRetryError("ETag mismatch", statusCode, {
|
new RequestRetryError("ETag mismatch", statusCode, {
|
||||||
headers,
|
headers,
|
||||||
count: this.retryCount
|
data: { count: this.retryCount }
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
return false;
|
return false;
|
||||||
@@ -29924,7 +29975,7 @@ var require_response2 = __commonJS({
|
|||||||
"node_modules/undici/lib/web/fetch/response.js"(exports2, module2) {
|
"node_modules/undici/lib/web/fetch/response.js"(exports2, module2) {
|
||||||
"use strict";
|
"use strict";
|
||||||
var { Headers, HeadersList, fill, getHeadersGuard, setHeadersGuard, setHeadersList } = require_headers2();
|
var { Headers, HeadersList, fill, getHeadersGuard, setHeadersGuard, setHeadersList } = require_headers2();
|
||||||
var { extractBody, cloneBody, mixinBody } = require_body2();
|
var { extractBody, cloneBody, mixinBody, hasFinalizationRegistry, streamRegistry, bodyUnusable } = require_body2();
|
||||||
var util = require_util8();
|
var util = require_util8();
|
||||||
var nodeUtil = require("node:util");
|
var nodeUtil = require("node:util");
|
||||||
var { kEnumerableProperty } = util;
|
var { kEnumerableProperty } = util;
|
||||||
@@ -29949,19 +30000,7 @@ var require_response2 = __commonJS({
|
|||||||
var { kConstruct } = require_symbols6();
|
var { kConstruct } = require_symbols6();
|
||||||
var assert = require("node:assert");
|
var assert = require("node:assert");
|
||||||
var { types } = require("node:util");
|
var { types } = require("node:util");
|
||||||
var { isDisturbed, isErrored } = require("node:stream");
|
|
||||||
var textEncoder = new TextEncoder("utf-8");
|
var textEncoder = new TextEncoder("utf-8");
|
||||||
var hasFinalizationRegistry = globalThis.FinalizationRegistry && process.version.indexOf("v18") !== 0;
|
|
||||||
var registry;
|
|
||||||
if (hasFinalizationRegistry) {
|
|
||||||
registry = new FinalizationRegistry((stream) => {
|
|
||||||
if (!stream.locked && !isDisturbed(stream) && !isErrored(stream)) {
|
|
||||||
stream.cancel("Response object has been garbage collected").catch(noop);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
function noop() {
|
|
||||||
}
|
|
||||||
var Response = class _Response {
|
var Response = class _Response {
|
||||||
// Creates network error Response.
|
// Creates network error Response.
|
||||||
static error() {
|
static error() {
|
||||||
@@ -30073,7 +30112,7 @@ var require_response2 = __commonJS({
|
|||||||
// Returns a clone of response.
|
// Returns a clone of response.
|
||||||
clone() {
|
clone() {
|
||||||
webidl.brandCheck(this, _Response);
|
webidl.brandCheck(this, _Response);
|
||||||
if (this.bodyUsed || this.body?.locked) {
|
if (bodyUnusable(this)) {
|
||||||
throw webidl.errors.exception({
|
throw webidl.errors.exception({
|
||||||
header: "Response.clone",
|
header: "Response.clone",
|
||||||
message: "Body has already been consumed."
|
message: "Body has already been consumed."
|
||||||
@@ -30132,7 +30171,7 @@ var require_response2 = __commonJS({
|
|||||||
}
|
}
|
||||||
const newResponse = makeResponse({ ...response, body: null });
|
const newResponse = makeResponse({ ...response, body: null });
|
||||||
if (response.body != null) {
|
if (response.body != null) {
|
||||||
newResponse.body = cloneBody(response.body);
|
newResponse.body = cloneBody(newResponse, response.body);
|
||||||
}
|
}
|
||||||
return newResponse;
|
return newResponse;
|
||||||
}
|
}
|
||||||
@@ -30257,7 +30296,7 @@ var require_response2 = __commonJS({
|
|||||||
setHeadersList(response[kHeaders], innerResponse.headersList);
|
setHeadersList(response[kHeaders], innerResponse.headersList);
|
||||||
setHeadersGuard(response[kHeaders], guard);
|
setHeadersGuard(response[kHeaders], guard);
|
||||||
if (hasFinalizationRegistry && innerResponse.body?.stream) {
|
if (hasFinalizationRegistry && innerResponse.body?.stream) {
|
||||||
registry.register(response, innerResponse.body.stream);
|
streamRegistry.register(response, new WeakRef(innerResponse.body.stream));
|
||||||
}
|
}
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
@@ -30372,7 +30411,7 @@ var require_dispatcher_weakref2 = __commonJS({
|
|||||||
var require_request4 = __commonJS({
|
var require_request4 = __commonJS({
|
||||||
"node_modules/undici/lib/web/fetch/request.js"(exports2, module2) {
|
"node_modules/undici/lib/web/fetch/request.js"(exports2, module2) {
|
||||||
"use strict";
|
"use strict";
|
||||||
var { extractBody, mixinBody, cloneBody } = require_body2();
|
var { extractBody, mixinBody, cloneBody, bodyUnusable } = require_body2();
|
||||||
var { Headers, fill: fillHeaders, HeadersList, setHeadersGuard, getHeadersGuard, setHeadersList, getHeadersList } = require_headers2();
|
var { Headers, fill: fillHeaders, HeadersList, setHeadersGuard, getHeadersGuard, setHeadersList, getHeadersList } = require_headers2();
|
||||||
var { FinalizationRegistry: FinalizationRegistry2 } = require_dispatcher_weakref2()();
|
var { FinalizationRegistry: FinalizationRegistry2 } = require_dispatcher_weakref2()();
|
||||||
var util = require_util8();
|
var util = require_util8();
|
||||||
@@ -30380,9 +30419,7 @@ var require_request4 = __commonJS({
|
|||||||
var {
|
var {
|
||||||
isValidHTTPToken,
|
isValidHTTPToken,
|
||||||
sameOrigin,
|
sameOrigin,
|
||||||
normalizeMethod,
|
environmentSettingsObject
|
||||||
environmentSettingsObject,
|
|
||||||
normalizeMethodRecord
|
|
||||||
} = require_util9();
|
} = require_util9();
|
||||||
var {
|
var {
|
||||||
forbiddenMethodsSet,
|
forbiddenMethodsSet,
|
||||||
@@ -30394,7 +30431,7 @@ var require_request4 = __commonJS({
|
|||||||
requestCache,
|
requestCache,
|
||||||
requestDuplex
|
requestDuplex
|
||||||
} = require_constants8();
|
} = require_constants8();
|
||||||
var { kEnumerableProperty } = util;
|
var { kEnumerableProperty, normalizedMethodRecordsBase, normalizedMethodRecords } = util;
|
||||||
var { kHeaders, kSignal, kState, kDispatcher } = require_symbols7();
|
var { kHeaders, kSignal, kState, kDispatcher } = require_symbols7();
|
||||||
var { webidl } = require_webidl2();
|
var { webidl } = require_webidl2();
|
||||||
var { URLSerializer } = require_data_url();
|
var { URLSerializer } = require_data_url();
|
||||||
@@ -30591,17 +30628,18 @@ var require_request4 = __commonJS({
|
|||||||
}
|
}
|
||||||
if (init.method !== void 0) {
|
if (init.method !== void 0) {
|
||||||
let method = init.method;
|
let method = init.method;
|
||||||
const mayBeNormalized = normalizeMethodRecord[method];
|
const mayBeNormalized = normalizedMethodRecords[method];
|
||||||
if (mayBeNormalized !== void 0) {
|
if (mayBeNormalized !== void 0) {
|
||||||
request2.method = mayBeNormalized;
|
request2.method = mayBeNormalized;
|
||||||
} else {
|
} else {
|
||||||
if (!isValidHTTPToken(method)) {
|
if (!isValidHTTPToken(method)) {
|
||||||
throw new TypeError(`'${method}' is not a valid HTTP method.`);
|
throw new TypeError(`'${method}' is not a valid HTTP method.`);
|
||||||
}
|
}
|
||||||
if (forbiddenMethodsSet.has(method.toUpperCase())) {
|
const upperCase = method.toUpperCase();
|
||||||
|
if (forbiddenMethodsSet.has(upperCase)) {
|
||||||
throw new TypeError(`'${method}' HTTP method is unsupported.`);
|
throw new TypeError(`'${method}' HTTP method is unsupported.`);
|
||||||
}
|
}
|
||||||
method = normalizeMethod(method);
|
method = normalizedMethodRecordsBase[upperCase] ?? method;
|
||||||
request2.method = method;
|
request2.method = method;
|
||||||
}
|
}
|
||||||
if (!patchMethodWarning && request2.method === "patch") {
|
if (!patchMethodWarning && request2.method === "patch") {
|
||||||
@@ -30694,7 +30732,7 @@ var require_request4 = __commonJS({
|
|||||||
}
|
}
|
||||||
let finalBody = inputOrInitBody;
|
let finalBody = inputOrInitBody;
|
||||||
if (initBody == null && inputBody != null) {
|
if (initBody == null && inputBody != null) {
|
||||||
if (util.isDisturbed(inputBody.stream) || inputBody.stream.locked) {
|
if (bodyUnusable(input)) {
|
||||||
throw new TypeError(
|
throw new TypeError(
|
||||||
"Cannot construct a Request with a Request object that has already been used."
|
"Cannot construct a Request with a Request object that has already been used."
|
||||||
);
|
);
|
||||||
@@ -30829,7 +30867,7 @@ var require_request4 = __commonJS({
|
|||||||
// Returns a clone of request.
|
// Returns a clone of request.
|
||||||
clone() {
|
clone() {
|
||||||
webidl.brandCheck(this, _Request);
|
webidl.brandCheck(this, _Request);
|
||||||
if (this.bodyUsed || this.body?.locked) {
|
if (bodyUnusable(this)) {
|
||||||
throw new TypeError("unusable");
|
throw new TypeError("unusable");
|
||||||
}
|
}
|
||||||
const clonedRequest = cloneRequest(this[kState]);
|
const clonedRequest = cloneRequest(this[kState]);
|
||||||
@@ -30922,7 +30960,7 @@ var require_request4 = __commonJS({
|
|||||||
function cloneRequest(request2) {
|
function cloneRequest(request2) {
|
||||||
const newRequest = makeRequest({ ...request2, body: null });
|
const newRequest = makeRequest({ ...request2, body: null });
|
||||||
if (request2.body != null) {
|
if (request2.body != null) {
|
||||||
newRequest.body = cloneBody(request2.body);
|
newRequest.body = cloneBody(newRequest, request2.body);
|
||||||
}
|
}
|
||||||
return newRequest;
|
return newRequest;
|
||||||
}
|
}
|
||||||
@@ -35317,7 +35355,6 @@ var require_websocket2 = __commonJS({
|
|||||||
var { types } = require("node:util");
|
var { types } = require("node:util");
|
||||||
var { ErrorEvent, CloseEvent } = require_events2();
|
var { ErrorEvent, CloseEvent } = require_events2();
|
||||||
var { SendQueue } = require_sender();
|
var { SendQueue } = require_sender();
|
||||||
var experimentalWarned = false;
|
|
||||||
var WebSocket = class _WebSocket extends EventTarget {
|
var WebSocket = class _WebSocket extends EventTarget {
|
||||||
#events = {
|
#events = {
|
||||||
open: null,
|
open: null,
|
||||||
@@ -35338,12 +35375,6 @@ var require_websocket2 = __commonJS({
|
|||||||
super();
|
super();
|
||||||
const prefix = "WebSocket constructor";
|
const prefix = "WebSocket constructor";
|
||||||
webidl.argumentLengthCheck(arguments, 1, prefix);
|
webidl.argumentLengthCheck(arguments, 1, prefix);
|
||||||
if (!experimentalWarned) {
|
|
||||||
experimentalWarned = true;
|
|
||||||
process.emitWarning("WebSockets are experimental, expect them to change at any time.", {
|
|
||||||
code: "UNDICI-WS"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
const options = webidl.converters["DOMString or sequence<DOMString> or WebSocketInit"](protocols, prefix, "options");
|
const options = webidl.converters["DOMString or sequence<DOMString> or WebSocketInit"](protocols, prefix, "options");
|
||||||
url = webidl.converters.USVString(url, prefix, "url");
|
url = webidl.converters.USVString(url, prefix, "url");
|
||||||
protocols = options.protocols;
|
protocols = options.protocols;
|
||||||
@@ -36784,132 +36815,116 @@ var RequestError = class extends Error {
|
|||||||
|
|
||||||
// node_modules/@octokit/request/dist-bundle/index.js
|
// node_modules/@octokit/request/dist-bundle/index.js
|
||||||
var VERSION2 = "0.0.0-development";
|
var VERSION2 = "0.0.0-development";
|
||||||
|
var defaults_default = {
|
||||||
|
headers: {
|
||||||
|
"user-agent": `octokit-request.js/${VERSION2} ${getUserAgent()}`
|
||||||
|
}
|
||||||
|
};
|
||||||
function isPlainObject2(value) {
|
function isPlainObject2(value) {
|
||||||
if (typeof value !== "object" || value === null)
|
if (typeof value !== "object" || value === null) return false;
|
||||||
return false;
|
if (Object.prototype.toString.call(value) !== "[object Object]") return false;
|
||||||
if (Object.prototype.toString.call(value) !== "[object Object]")
|
|
||||||
return false;
|
|
||||||
const proto = Object.getPrototypeOf(value);
|
const proto = Object.getPrototypeOf(value);
|
||||||
if (proto === null)
|
if (proto === null) return true;
|
||||||
return true;
|
|
||||||
const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor;
|
const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor;
|
||||||
return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value);
|
return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value);
|
||||||
}
|
}
|
||||||
function getBufferResponse(response) {
|
async function fetchWrapper(requestOptions) {
|
||||||
return response.arrayBuffer();
|
const fetch = requestOptions.request?.fetch || globalThis.fetch;
|
||||||
}
|
|
||||||
function fetchWrapper(requestOptions) {
|
|
||||||
const log = requestOptions.request && requestOptions.request.log ? requestOptions.request.log : console;
|
|
||||||
const parseSuccessResponseBody = requestOptions.request?.parseSuccessResponseBody !== false;
|
|
||||||
if (isPlainObject2(requestOptions.body) || Array.isArray(requestOptions.body)) {
|
|
||||||
requestOptions.body = JSON.stringify(requestOptions.body);
|
|
||||||
}
|
|
||||||
let headers = {};
|
|
||||||
let status;
|
|
||||||
let url;
|
|
||||||
let { fetch } = globalThis;
|
|
||||||
if (requestOptions.request?.fetch) {
|
|
||||||
fetch = requestOptions.request.fetch;
|
|
||||||
}
|
|
||||||
if (!fetch) {
|
if (!fetch) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
"fetch is not set. Please pass a fetch implementation as new Octokit({ request: { fetch }}). Learn more at https://github.com/octokit/octokit.js/#fetch-missing"
|
"fetch is not set. Please pass a fetch implementation as new Octokit({ request: { fetch }}). Learn more at https://github.com/octokit/octokit.js/#fetch-missing"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return fetch(requestOptions.url, {
|
const log = requestOptions.request?.log || console;
|
||||||
method: requestOptions.method,
|
const parseSuccessResponseBody = requestOptions.request?.parseSuccessResponseBody !== false;
|
||||||
body: requestOptions.body,
|
const body = isPlainObject2(requestOptions.body) || Array.isArray(requestOptions.body) ? JSON.stringify(requestOptions.body) : requestOptions.body;
|
||||||
redirect: requestOptions.request?.redirect,
|
const requestHeaders = Object.fromEntries(
|
||||||
// Header values must be `string`
|
Object.entries(requestOptions.headers).map(([name, value]) => [
|
||||||
headers: Object.fromEntries(
|
name,
|
||||||
Object.entries(requestOptions.headers).map(([name, value]) => [
|
String(value)
|
||||||
name,
|
])
|
||||||
String(value)
|
);
|
||||||
])
|
let fetchResponse;
|
||||||
),
|
try {
|
||||||
signal: requestOptions.request?.signal,
|
fetchResponse = await fetch(requestOptions.url, {
|
||||||
// duplex must be set if request.body is ReadableStream or Async Iterables.
|
method: requestOptions.method,
|
||||||
// See https://fetch.spec.whatwg.org/#dom-requestinit-duplex.
|
body,
|
||||||
...requestOptions.body && { duplex: "half" }
|
redirect: requestOptions.request?.redirect,
|
||||||
}).then(async (response) => {
|
headers: requestHeaders,
|
||||||
url = response.url;
|
signal: requestOptions.request?.signal,
|
||||||
status = response.status;
|
// duplex must be set if request.body is ReadableStream or Async Iterables.
|
||||||
for (const keyAndValue of response.headers) {
|
// See https://fetch.spec.whatwg.org/#dom-requestinit-duplex.
|
||||||
headers[keyAndValue[0]] = keyAndValue[1];
|
...requestOptions.body && { duplex: "half" }
|
||||||
}
|
});
|
||||||
if ("deprecation" in headers) {
|
} catch (error) {
|
||||||
const matches = headers.link && headers.link.match(/<([^>]+)>; rel="deprecation"/);
|
let message = "Unknown Error";
|
||||||
const deprecationLink = matches && matches.pop();
|
if (error instanceof Error) {
|
||||||
log.warn(
|
if (error.name === "AbortError") {
|
||||||
`[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${headers.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}`
|
error.status = 500;
|
||||||
);
|
throw error;
|
||||||
}
|
|
||||||
if (status === 204 || status === 205) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (requestOptions.method === "HEAD") {
|
|
||||||
if (status < 400) {
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
throw new RequestError(response.statusText, status, {
|
message = error.message;
|
||||||
response: {
|
if (error.name === "TypeError" && "cause" in error) {
|
||||||
url,
|
if (error.cause instanceof Error) {
|
||||||
status,
|
message = error.cause.message;
|
||||||
headers,
|
} else if (typeof error.cause === "string") {
|
||||||
data: void 0
|
message = error.cause;
|
||||||
},
|
}
|
||||||
request: requestOptions
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (status === 304) {
|
|
||||||
throw new RequestError("Not modified", status, {
|
|
||||||
response: {
|
|
||||||
url,
|
|
||||||
status,
|
|
||||||
headers,
|
|
||||||
data: await getResponseData(response)
|
|
||||||
},
|
|
||||||
request: requestOptions
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (status >= 400) {
|
|
||||||
const data = await getResponseData(response);
|
|
||||||
const error = new RequestError(toErrorMessage(data), status, {
|
|
||||||
response: {
|
|
||||||
url,
|
|
||||||
status,
|
|
||||||
headers,
|
|
||||||
data
|
|
||||||
},
|
|
||||||
request: requestOptions
|
|
||||||
});
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
return parseSuccessResponseBody ? await getResponseData(response) : response.body;
|
|
||||||
}).then((data) => {
|
|
||||||
return {
|
|
||||||
status,
|
|
||||||
url,
|
|
||||||
headers,
|
|
||||||
data
|
|
||||||
};
|
|
||||||
}).catch((error) => {
|
|
||||||
if (error instanceof RequestError)
|
|
||||||
throw error;
|
|
||||||
else if (error.name === "AbortError")
|
|
||||||
throw error;
|
|
||||||
let message = error.message;
|
|
||||||
if (error.name === "TypeError" && "cause" in error) {
|
|
||||||
if (error.cause instanceof Error) {
|
|
||||||
message = error.cause.message;
|
|
||||||
} else if (typeof error.cause === "string") {
|
|
||||||
message = error.cause;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw new RequestError(message, 500, {
|
const requestError = new RequestError(message, 500, {
|
||||||
request: requestOptions
|
request: requestOptions
|
||||||
});
|
});
|
||||||
});
|
requestError.cause = error;
|
||||||
|
throw requestError;
|
||||||
|
}
|
||||||
|
const status = fetchResponse.status;
|
||||||
|
const url = fetchResponse.url;
|
||||||
|
const responseHeaders = {};
|
||||||
|
for (const [key, value] of fetchResponse.headers) {
|
||||||
|
responseHeaders[key] = value;
|
||||||
|
}
|
||||||
|
const octokitResponse = {
|
||||||
|
url,
|
||||||
|
status,
|
||||||
|
headers: responseHeaders,
|
||||||
|
data: ""
|
||||||
|
};
|
||||||
|
if ("deprecation" in responseHeaders) {
|
||||||
|
const matches = responseHeaders.link && responseHeaders.link.match(/<([^>]+)>; rel="deprecation"/);
|
||||||
|
const deprecationLink = matches && matches.pop();
|
||||||
|
log.warn(
|
||||||
|
`[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${responseHeaders.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (status === 204 || status === 205) {
|
||||||
|
return octokitResponse;
|
||||||
|
}
|
||||||
|
if (requestOptions.method === "HEAD") {
|
||||||
|
if (status < 400) {
|
||||||
|
return octokitResponse;
|
||||||
|
}
|
||||||
|
throw new RequestError(fetchResponse.statusText, status, {
|
||||||
|
response: octokitResponse,
|
||||||
|
request: requestOptions
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (status === 304) {
|
||||||
|
octokitResponse.data = await getResponseData(fetchResponse);
|
||||||
|
throw new RequestError("Not modified", status, {
|
||||||
|
response: octokitResponse,
|
||||||
|
request: requestOptions
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (status >= 400) {
|
||||||
|
octokitResponse.data = await getResponseData(fetchResponse);
|
||||||
|
throw new RequestError(toErrorMessage(octokitResponse.data), status, {
|
||||||
|
response: octokitResponse,
|
||||||
|
request: requestOptions
|
||||||
|
});
|
||||||
|
}
|
||||||
|
octokitResponse.data = parseSuccessResponseBody ? await getResponseData(fetchResponse) : fetchResponse.body;
|
||||||
|
return octokitResponse;
|
||||||
}
|
}
|
||||||
async function getResponseData(response) {
|
async function getResponseData(response) {
|
||||||
const contentType = response.headers.get("content-type");
|
const contentType = response.headers.get("content-type");
|
||||||
@@ -36919,22 +36934,18 @@ async function getResponseData(response) {
|
|||||||
if (!contentType || /^text\/|charset=utf-8$/.test(contentType)) {
|
if (!contentType || /^text\/|charset=utf-8$/.test(contentType)) {
|
||||||
return response.text();
|
return response.text();
|
||||||
}
|
}
|
||||||
return getBufferResponse(response);
|
return response.arrayBuffer();
|
||||||
}
|
}
|
||||||
function toErrorMessage(data) {
|
function toErrorMessage(data) {
|
||||||
if (typeof data === "string")
|
if (typeof data === "string") {
|
||||||
return data;
|
return data;
|
||||||
let suffix;
|
}
|
||||||
if ("documentation_url" in data) {
|
if (data instanceof ArrayBuffer) {
|
||||||
suffix = ` - ${data.documentation_url}`;
|
return "Unknown error";
|
||||||
} else {
|
|
||||||
suffix = "";
|
|
||||||
}
|
}
|
||||||
if ("message" in data) {
|
if ("message" in data) {
|
||||||
if (Array.isArray(data.errors)) {
|
const suffix = "documentation_url" in data ? ` - ${data.documentation_url}` : "";
|
||||||
return `${data.message}: ${data.errors.map(JSON.stringify).join(", ")}${suffix}`;
|
return Array.isArray(data.errors) ? `${data.message}: ${data.errors.map((v) => JSON.stringify(v)).join(", ")}${suffix}` : `${data.message}${suffix}`;
|
||||||
}
|
|
||||||
return `${data.message}${suffix}`;
|
|
||||||
}
|
}
|
||||||
return `Unknown error: ${JSON.stringify(data)}`;
|
return `Unknown error: ${JSON.stringify(data)}`;
|
||||||
}
|
}
|
||||||
@@ -36961,11 +36972,7 @@ function withDefaults2(oldEndpoint, newDefaults) {
|
|||||||
defaults: withDefaults2.bind(null, endpoint2)
|
defaults: withDefaults2.bind(null, endpoint2)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
var request = withDefaults2(endpoint, {
|
var request = withDefaults2(endpoint, defaults_default);
|
||||||
headers: {
|
|
||||||
"user-agent": `octokit-request.js/${VERSION2} ${getUserAgent()}`
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// lib/request.js
|
// lib/request.js
|
||||||
var import_undici = __toESM(require_undici2(), 1);
|
var import_undici = __toESM(require_undici2(), 1);
|
||||||
|
|||||||
678
package-lock.json
generated
678
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
20
package.json
20
package.json
@@ -2,10 +2,10 @@
|
|||||||
"name": "create-github-app-token",
|
"name": "create-github-app-token",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "1.10.2",
|
"version": "1.10.4",
|
||||||
"description": "GitHub Action for creating a GitHub App Installation Access Token",
|
"description": "GitHub Action for creating a GitHub App Installation Access Token",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "esbuild main.js post.js --bundle --outdir=dist --out-extension:.js=.cjs --platform=node --target=node20.0.0",
|
"build": "esbuild main.js post.js --bundle --outdir=dist --out-extension:.js=.cjs --platform=node --target=node20.0.0 --packages=bundle",
|
||||||
"test": "c8 --100 ava tests/index.js",
|
"test": "c8 --100 ava tests/index.js",
|
||||||
"coverage": "c8 report --reporter html",
|
"coverage": "c8 report --reporter html",
|
||||||
"postcoverage": "open-cli coverage/index.html"
|
"postcoverage": "open-cli coverage/index.html"
|
||||||
@@ -13,20 +13,20 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.10.1",
|
"@actions/core": "^1.10.1",
|
||||||
"@octokit/auth-app": "^7.1.0",
|
"@octokit/auth-app": "^7.1.1",
|
||||||
"@octokit/request": "^9.0.1",
|
"@octokit/request": "^9.1.3",
|
||||||
"p-retry": "^6.2.0",
|
"p-retry": "^6.2.0",
|
||||||
"undici": "^6.18.2"
|
"undici": "^6.19.8"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@sinonjs/fake-timers": "^11.2.2",
|
"@sinonjs/fake-timers": "^13.0.1",
|
||||||
"ava": "^6.1.3",
|
"ava": "^6.1.3",
|
||||||
"c8": "^9.1.0",
|
"c8": "^10.1.2",
|
||||||
"dotenv": "^16.4.5",
|
"dotenv": "^16.4.5",
|
||||||
"esbuild": "^0.21.4",
|
"esbuild": "^0.23.1",
|
||||||
"execa": "^9.1.0",
|
"execa": "^9.3.1",
|
||||||
"open-cli": "^8.0.0",
|
"open-cli": "^8.0.0",
|
||||||
"yaml": "^2.4.2"
|
"yaml": "^2.5.1"
|
||||||
},
|
},
|
||||||
"release": {
|
"release": {
|
||||||
"branches": [
|
"branches": [
|
||||||
|
|||||||
@@ -1,11 +1,21 @@
|
|||||||
import { readdirSync } from "node:fs";
|
import { readdirSync } from "node:fs";
|
||||||
|
|
||||||
import { execa } from "execa";
|
|
||||||
import test from "ava";
|
import test from "ava";
|
||||||
|
import { execa } from "execa";
|
||||||
|
|
||||||
const tests = readdirSync("tests").filter((file) => file.endsWith(".test.js"));
|
// Get all files in tests directory
|
||||||
|
const files = readdirSync("tests");
|
||||||
|
|
||||||
for (const file of tests) {
|
// Files to ignore
|
||||||
|
const ignore = ["index.js", "main.js", "README.md", "snapshots"];
|
||||||
|
|
||||||
|
const testFiles = files.filter((file) => !ignore.includes(file));
|
||||||
|
|
||||||
|
// Throw an error if there is a file that does not end with test.js in the tests directory
|
||||||
|
for (const file of testFiles) {
|
||||||
|
if (!file.endsWith(".test.js")) {
|
||||||
|
throw new Error(`File ${file} does not end with .test.js`);
|
||||||
|
}
|
||||||
test(file, async (t) => {
|
test(file, async (t) => {
|
||||||
// Override Actions environment variables that change `core`’s behavior
|
// Override Actions environment variables that change `core`’s behavior
|
||||||
const env = {
|
const env = {
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
import { test, DEFAULT_ENV } from "./main.js";
|
import { DEFAULT_ENV, test } from "./main.js";
|
||||||
|
|
||||||
// Verify that main works with a custom GitHub API URL passed as `github-api-url` input
|
// Verify that main works with a custom GitHub API URL passed as `github-api-url` input
|
||||||
await test(
|
await test(
|
||||||
() => {
|
() => {
|
||||||
process.env.INPUT_OWNER = process.env.GITHUB_REPOSITORY_OWNER;
|
process.env.INPUT_OWNER = process.env.GITHUB_REPOSITORY_OWNER;
|
||||||
process.env.INPUT_REPOSITORIES = process.env.GITHUB_REPOSITORY;
|
const currentRepoName = process.env.GITHUB_REPOSITORY.split("/")[1];
|
||||||
|
process.env.INPUT_REPOSITORIES = currentRepoName;
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
...DEFAULT_ENV,
|
...DEFAULT_ENV,
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
import { test, DEFAULT_ENV } from "./main.js";
|
|
||||||
|
|
||||||
// Verify `main` works correctly when `private-key` input has escaped newlines
|
|
||||||
await test(() => {
|
|
||||||
process.env['INPUT_PRIVATE-KEY'] = DEFAULT_ENV.PRIVATE_KEY.replace(/\n/g, '\\n')
|
|
||||||
});
|
|
||||||
9
tests/main-private-key-with-escaped-newlines.test.js
Normal file
9
tests/main-private-key-with-escaped-newlines.test.js
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import { DEFAULT_ENV, test } from "./main.js";
|
||||||
|
|
||||||
|
// Verify `main` works correctly when `private-key` input has escaped newlines
|
||||||
|
await test(() => {
|
||||||
|
process.env["INPUT_PRIVATE-KEY"] = DEFAULT_ENV["INPUT_PRIVATE-KEY"].replace(
|
||||||
|
/\n/g,
|
||||||
|
"\\n"
|
||||||
|
);
|
||||||
|
});
|
||||||
@@ -3,5 +3,6 @@ import { test } from "./main.js";
|
|||||||
// Verify `main` successfully obtains a token when the `owner` and `repositories` inputs are set (and the latter is a list of repos).
|
// Verify `main` successfully obtains a token when the `owner` and `repositories` inputs are set (and the latter is a list of repos).
|
||||||
await test(() => {
|
await test(() => {
|
||||||
process.env.INPUT_OWNER = process.env.GITHUB_REPOSITORY_OWNER;
|
process.env.INPUT_OWNER = process.env.GITHUB_REPOSITORY_OWNER;
|
||||||
process.env.INPUT_REPOSITORIES = `${process.env.GITHUB_REPOSITORY},actions/toolkit`;
|
const currentRepoName = process.env.GITHUB_REPOSITORY.split("/")[1];
|
||||||
|
process.env.INPUT_REPOSITORIES = `${currentRepoName},toolkit`;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,5 +3,6 @@ import { test } from "./main.js";
|
|||||||
// Verify `main` successfully obtains a token when the `owner` and `repositories` inputs are set (and the latter is a single repo).
|
// Verify `main` successfully obtains a token when the `owner` and `repositories` inputs are set (and the latter is a single repo).
|
||||||
await test(() => {
|
await test(() => {
|
||||||
process.env.INPUT_OWNER = process.env.GITHUB_REPOSITORY_OWNER;
|
process.env.INPUT_OWNER = process.env.GITHUB_REPOSITORY_OWNER;
|
||||||
process.env.INPUT_REPOSITORIES = process.env.GITHUB_REPOSITORY;
|
const currentRepoName = process.env.GITHUB_REPOSITORY.split("/")[1];
|
||||||
|
process.env.INPUT_REPOSITORIES = currentRepoName;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,5 +3,6 @@ import { test } from "./main.js";
|
|||||||
// Verify `main` successfully obtains a token when the `owner` input is not set, but the `repositories` input is set.
|
// Verify `main` successfully obtains a token when the `owner` input is not set, but the `repositories` input is set.
|
||||||
await test(() => {
|
await test(() => {
|
||||||
delete process.env.INPUT_OWNER;
|
delete process.env.INPUT_OWNER;
|
||||||
process.env.INPUT_REPOSITORIES = process.env.GITHUB_REPOSITORY;
|
const currentRepoName = process.env.GITHUB_REPOSITORY.split("/")[1];
|
||||||
|
process.env.INPUT_REPOSITORIES = currentRepoName;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ export async function test(cb = (_mockPool) => {}, env = DEFAULT_ENV) {
|
|||||||
|
|
||||||
// Set up mocking
|
// Set up mocking
|
||||||
const baseUrl = new URL(env["INPUT_GITHUB-API-URL"]);
|
const baseUrl = new URL(env["INPUT_GITHUB-API-URL"]);
|
||||||
const basePath = baseUrl.pathname === '/' ? '' : baseUrl.pathname;
|
const basePath = baseUrl.pathname === "/" ? "" : baseUrl.pathname;
|
||||||
const mockAgent = new MockAgent();
|
const mockAgent = new MockAgent();
|
||||||
mockAgent.disableNetConnect();
|
mockAgent.disableNetConnect();
|
||||||
setGlobalDispatcher(mockAgent);
|
setGlobalDispatcher(mockAgent);
|
||||||
@@ -58,8 +58,9 @@ export async function test(cb = (_mockPool) => {}, env = DEFAULT_ENV) {
|
|||||||
const mockInstallationId = "123456";
|
const mockInstallationId = "123456";
|
||||||
const mockAppSlug = "github-actions";
|
const mockAppSlug = "github-actions";
|
||||||
const owner = env.INPUT_OWNER ?? env.GITHUB_REPOSITORY_OWNER;
|
const owner = env.INPUT_OWNER ?? env.GITHUB_REPOSITORY_OWNER;
|
||||||
|
const currentRepoName = env.GITHUB_REPOSITORY.split("/")[1];
|
||||||
const repo = encodeURIComponent(
|
const repo = encodeURIComponent(
|
||||||
(env.INPUT_REPOSITORIES ?? env.GITHUB_REPOSITORY).split(",")[0]
|
(env.INPUT_REPOSITORIES ?? currentRepoName).split(",")[0]
|
||||||
);
|
);
|
||||||
mockPool
|
mockPool
|
||||||
.intercept({
|
.intercept({
|
||||||
@@ -73,7 +74,7 @@ export async function test(cb = (_mockPool) => {}, env = DEFAULT_ENV) {
|
|||||||
})
|
})
|
||||||
.reply(
|
.reply(
|
||||||
200,
|
200,
|
||||||
{ id: mockInstallationId, "app_slug": mockAppSlug },
|
{ id: mockInstallationId, app_slug: mockAppSlug },
|
||||||
{ headers: { "content-type": "application/json" } }
|
{ headers: { "content-type": "application/json" } }
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ Generated by [AVA](https://avajs.dev).
|
|||||||
|
|
||||||
> stdout
|
> stdout
|
||||||
|
|
||||||
`owner and repositories set, creating token for repositories "actions/create-github-app-token" owned by "actions"␊
|
`owner and repositories set, creating token for repositories "create-github-app-token" owned by "actions"␊
|
||||||
::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
|
::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
|
||||||
␊
|
␊
|
||||||
::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
|
::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
|
||||||
@@ -75,6 +75,45 @@ Generated by [AVA](https://avajs.dev).
|
|||||||
|
|
||||||
''
|
''
|
||||||
|
|
||||||
|
## main-private-key-with-escaped-newlines.test.js
|
||||||
|
|
||||||
|
> stderr
|
||||||
|
|
||||||
|
''
|
||||||
|
|
||||||
|
> stdout
|
||||||
|
|
||||||
|
`owner and repositories not set, creating token for the current repository ("create-github-app-token")␊
|
||||||
|
::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
|
||||||
|
␊
|
||||||
|
::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
|
||||||
|
␊
|
||||||
|
::set-output name=installation-id::123456␊
|
||||||
|
␊
|
||||||
|
::set-output name=app-slug::github-actions␊
|
||||||
|
::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
|
||||||
|
::save-state name=expiresAt::2016-07-11T22:14:10Z`
|
||||||
|
|
||||||
|
## main-repo-skew.test.js
|
||||||
|
|
||||||
|
> stderr
|
||||||
|
|
||||||
|
`'Issued at' claim ('iat') must be an Integer representing the time that the assertion was issued.␊
|
||||||
|
[@octokit/auth-app] GitHub API time and system time are different by 30 seconds. Retrying request with the difference accounted for.`
|
||||||
|
|
||||||
|
> stdout
|
||||||
|
|
||||||
|
`owner and repositories set, creating token for repositories "failed-repo" owned by "actions"␊
|
||||||
|
::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
|
||||||
|
␊
|
||||||
|
::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
|
||||||
|
␊
|
||||||
|
::set-output name=installation-id::123456␊
|
||||||
|
␊
|
||||||
|
::set-output name=app-slug::github-actions␊
|
||||||
|
::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
|
||||||
|
::save-state name=expiresAt::2016-07-11T22:14:10Z`
|
||||||
|
|
||||||
## main-token-get-owner-set-repo-fail-response.test.js
|
## main-token-get-owner-set-repo-fail-response.test.js
|
||||||
|
|
||||||
> stderr
|
> stderr
|
||||||
@@ -103,7 +142,7 @@ Generated by [AVA](https://avajs.dev).
|
|||||||
|
|
||||||
> stdout
|
> stdout
|
||||||
|
|
||||||
`owner and repositories set, creating token for repositories "actions/create-github-app-token,actions/toolkit" owned by "actions"␊
|
`owner and repositories set, creating token for repositories "create-github-app-token,toolkit" owned by "actions"␊
|
||||||
::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
|
::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
|
||||||
␊
|
␊
|
||||||
::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
|
::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
|
||||||
@@ -122,7 +161,7 @@ Generated by [AVA](https://avajs.dev).
|
|||||||
|
|
||||||
> stdout
|
> stdout
|
||||||
|
|
||||||
`owner and repositories set, creating token for repositories "actions/create-github-app-token" owned by "actions"␊
|
`owner and repositories set, creating token for repositories "create-github-app-token" owned by "actions"␊
|
||||||
::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
|
::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
|
||||||
␊
|
␊
|
||||||
::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
|
::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
|
||||||
@@ -199,7 +238,7 @@ Generated by [AVA](https://avajs.dev).
|
|||||||
|
|
||||||
> stdout
|
> stdout
|
||||||
|
|
||||||
`owner not set, creating owner for given repositories "actions/create-github-app-token" in current owner ("actions")␊
|
`owner not set, creating owner for given repositories "create-github-app-token" in current owner ("actions")␊
|
||||||
::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
|
::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
|
||||||
␊
|
␊
|
||||||
::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
|
::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a␊
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user