UNPKG

@saucelabs/visual

Version:

JS client bindings for Sauce Labs Visual

796 lines (784 loc) 447 kB
import { FormData, fetch_blob_default, formDataToBlob } from "./chunk-3IT7HMR5.js"; // src/graphql/__generated__/graphql.ts var BaselinesOrderBy = /* @__PURE__ */ ((BaselinesOrderBy2) => { BaselinesOrderBy2["BranchAsc"] = "BRANCH_ASC"; BaselinesOrderBy2["BranchDesc"] = "BRANCH_DESC"; BaselinesOrderBy2["CreatedAtAsc"] = "CREATED_AT_ASC"; BaselinesOrderBy2["CreatedAtDesc"] = "CREATED_AT_DESC"; BaselinesOrderBy2["CreatedByOrgIdAsc"] = "CREATED_BY_ORG_ID_ASC"; BaselinesOrderBy2["CreatedByOrgIdDesc"] = "CREATED_BY_ORG_ID_DESC"; BaselinesOrderBy2["CreatedByUserIdAsc"] = "CREATED_BY_USER_ID_ASC"; BaselinesOrderBy2["CreatedByUserIdDesc"] = "CREATED_BY_USER_ID_DESC"; BaselinesOrderBy2["IdAsc"] = "ID_ASC"; BaselinesOrderBy2["IdDesc"] = "ID_DESC"; BaselinesOrderBy2["Natural"] = "NATURAL"; BaselinesOrderBy2["ParentIdAsc"] = "PARENT_ID_ASC"; BaselinesOrderBy2["ParentIdDesc"] = "PARENT_ID_DESC"; BaselinesOrderBy2["PrimaryKeyAsc"] = "PRIMARY_KEY_ASC"; BaselinesOrderBy2["PrimaryKeyDesc"] = "PRIMARY_KEY_DESC"; BaselinesOrderBy2["ProjectAsc"] = "PROJECT_ASC"; BaselinesOrderBy2["ProjectDesc"] = "PROJECT_DESC"; BaselinesOrderBy2["SnapshotIdAsc"] = "SNAPSHOT_ID_ASC"; BaselinesOrderBy2["SnapshotIdDesc"] = "SNAPSHOT_ID_DESC"; return BaselinesOrderBy2; })(BaselinesOrderBy || {}); var BranchesOrderBy = /* @__PURE__ */ ((BranchesOrderBy2) => { BranchesOrderBy2["Natural"] = "NATURAL"; BranchesOrderBy2["PrimaryKeyAsc"] = "PRIMARY_KEY_ASC"; BranchesOrderBy2["PrimaryKeyDesc"] = "PRIMARY_KEY_DESC"; return BranchesOrderBy2; })(BranchesOrderBy || {}); var Browser = /* @__PURE__ */ ((Browser2) => { Browser2["Chrome"] = "CHROME"; Browser2["Edge"] = "EDGE"; Browser2["Firefox"] = "FIREFOX"; Browser2["None"] = "NONE"; Browser2["PlaywrightWebkit"] = "PLAYWRIGHT_WEBKIT"; Browser2["Safari"] = "SAFARI"; return Browser2; })(Browser || {}); var BuildMode = /* @__PURE__ */ ((BuildMode2) => { BuildMode2["Completed"] = "COMPLETED"; BuildMode2["Running"] = "RUNNING"; return BuildMode2; })(BuildMode || {}); var BuildStatus = /* @__PURE__ */ ((BuildStatus2) => { BuildStatus2["Approved"] = "APPROVED"; BuildStatus2["Empty"] = "EMPTY"; BuildStatus2["Equal"] = "EQUAL"; BuildStatus2["Errored"] = "ERRORED"; BuildStatus2["Queued"] = "QUEUED"; BuildStatus2["Rejected"] = "REJECTED"; BuildStatus2["Running"] = "RUNNING"; BuildStatus2["Unapproved"] = "UNAPPROVED"; return BuildStatus2; })(BuildStatus || {}); var BuildsOrderBy = /* @__PURE__ */ ((BuildsOrderBy2) => { BuildsOrderBy2["BranchAsc"] = "BRANCH_ASC"; BuildsOrderBy2["BranchDesc"] = "BRANCH_DESC"; BuildsOrderBy2["CreatedAtAsc"] = "CREATED_AT_ASC"; BuildsOrderBy2["CreatedAtDesc"] = "CREATED_AT_DESC"; BuildsOrderBy2["CreatedByOrgIdAsc"] = "CREATED_BY_ORG_ID_ASC"; BuildsOrderBy2["CreatedByOrgIdAscCustomIdAsc"] = "CREATED_BY_ORG_ID_ASC__CUSTOM_ID_ASC"; BuildsOrderBy2["CreatedByOrgIdDesc"] = "CREATED_BY_ORG_ID_DESC"; BuildsOrderBy2["CreatedByOrgIdDescCustomIdDesc"] = "CREATED_BY_ORG_ID_DESC__CUSTOM_ID_DESC"; BuildsOrderBy2["CreatedByUserIdAsc"] = "CREATED_BY_USER_ID_ASC"; BuildsOrderBy2["CreatedByUserIdDesc"] = "CREATED_BY_USER_ID_DESC"; BuildsOrderBy2["IdAsc"] = "ID_ASC"; BuildsOrderBy2["IdDesc"] = "ID_DESC"; BuildsOrderBy2["Natural"] = "NATURAL"; BuildsOrderBy2["OwningTeamIdAsc"] = "OWNING_TEAM_ID_ASC"; BuildsOrderBy2["OwningTeamIdDesc"] = "OWNING_TEAM_ID_DESC"; BuildsOrderBy2["PrimaryKeyAsc"] = "PRIMARY_KEY_ASC"; BuildsOrderBy2["PrimaryKeyDesc"] = "PRIMARY_KEY_DESC"; BuildsOrderBy2["ProjectAsc"] = "PROJECT_ASC"; BuildsOrderBy2["ProjectDesc"] = "PROJECT_DESC"; BuildsOrderBy2["StatusAsc"] = "STATUS_ASC"; BuildsOrderBy2["StatusDesc"] = "STATUS_DESC"; return BuildsOrderBy2; })(BuildsOrderBy || {}); var CommentAction = /* @__PURE__ */ ((CommentAction2) => { CommentAction2["Approved"] = "APPROVED"; CommentAction2["Rejected"] = "REJECTED"; CommentAction2["Unapproved"] = "UNAPPROVED"; CommentAction2["Unrejected"] = "UNREJECTED"; return CommentAction2; })(CommentAction || {}); var CommentsOrderBy = /* @__PURE__ */ ((CommentsOrderBy2) => { CommentsOrderBy2["CreatedAtAsc"] = "CREATED_AT_ASC"; CommentsOrderBy2["CreatedAtDesc"] = "CREATED_AT_DESC"; CommentsOrderBy2["DiffIdAsc"] = "DIFF_ID_ASC"; CommentsOrderBy2["DiffIdDesc"] = "DIFF_ID_DESC"; CommentsOrderBy2["IdAsc"] = "ID_ASC"; CommentsOrderBy2["IdDesc"] = "ID_DESC"; CommentsOrderBy2["Natural"] = "NATURAL"; CommentsOrderBy2["PrimaryKeyAsc"] = "PRIMARY_KEY_ASC"; CommentsOrderBy2["PrimaryKeyDesc"] = "PRIMARY_KEY_DESC"; return CommentsOrderBy2; })(CommentsOrderBy || {}); var DiffFeedbacksOrderBy = /* @__PURE__ */ ((DiffFeedbacksOrderBy2) => { DiffFeedbacksOrderBy2["Natural"] = "NATURAL"; return DiffFeedbacksOrderBy2; })(DiffFeedbacksOrderBy || {}); var DiffStatus = /* @__PURE__ */ ((DiffStatus2) => { DiffStatus2["Approved"] = "APPROVED"; DiffStatus2["Equal"] = "EQUAL"; DiffStatus2["Errored"] = "ERRORED"; DiffStatus2["Queued"] = "QUEUED"; DiffStatus2["Rejected"] = "REJECTED"; DiffStatus2["Unapproved"] = "UNAPPROVED"; return DiffStatus2; })(DiffStatus || {}); var DiffingMethod = /* @__PURE__ */ ((DiffingMethod2) => { DiffingMethod2["Balanced"] = "BALANCED"; DiffingMethod2["Experimental"] = "EXPERIMENTAL"; DiffingMethod2["Simple"] = "SIMPLE"; return DiffingMethod2; })(DiffingMethod || {}); var DiffsOrderBy = /* @__PURE__ */ ((DiffsOrderBy2) => { DiffsOrderBy2["BaselineIdAsc"] = "BASELINE_ID_ASC"; DiffsOrderBy2["BaselineIdDesc"] = "BASELINE_ID_DESC"; DiffsOrderBy2["BuildIdAsc"] = "BUILD_ID_ASC"; DiffsOrderBy2["BuildIdDesc"] = "BUILD_ID_DESC"; DiffsOrderBy2["CreatedAtAsc"] = "CREATED_AT_ASC"; DiffsOrderBy2["CreatedAtDesc"] = "CREATED_AT_DESC"; DiffsOrderBy2["IdAsc"] = "ID_ASC"; DiffsOrderBy2["IdDesc"] = "ID_DESC"; DiffsOrderBy2["Natural"] = "NATURAL"; DiffsOrderBy2["PrimaryKeyAsc"] = "PRIMARY_KEY_ASC"; DiffsOrderBy2["PrimaryKeyDesc"] = "PRIMARY_KEY_DESC"; DiffsOrderBy2["SnapshotIdAsc"] = "SNAPSHOT_ID_ASC"; DiffsOrderBy2["SnapshotIdDesc"] = "SNAPSHOT_ID_DESC"; DiffsOrderBy2["StatusAsc"] = "STATUS_ASC"; DiffsOrderBy2["StatusDesc"] = "STATUS_DESC"; DiffsOrderBy2["StatusIsEqualAsc"] = "STATUS_IS_EQUAL_ASC"; DiffsOrderBy2["StatusIsEqualDesc"] = "STATUS_IS_EQUAL_DESC"; return DiffsOrderBy2; })(DiffsOrderBy || {}); var DomFormat = /* @__PURE__ */ ((DomFormat2) => { DomFormat2["AndroidAppium"] = "ANDROID_APPIUM"; DomFormat2["Browser"] = "BROWSER"; DomFormat2["IosAppium"] = "IOS_APPIUM"; DomFormat2["None"] = "NONE"; return DomFormat2; })(DomFormat || {}); var GroupByOption = /* @__PURE__ */ ((GroupByOption2) => { GroupByOption2["Browser"] = "Browser"; GroupByOption2["Device"] = "Device"; GroupByOption2["OperatingSystemOperatingSystemVersion"] = "OperatingSystem_OperatingSystemVersion"; GroupByOption2["SuiteName"] = "SuiteName"; GroupByOption2["TestName"] = "TestName"; return GroupByOption2; })(GroupByOption || {}); var OperatingSystem = /* @__PURE__ */ ((OperatingSystem2) => { OperatingSystem2["Android"] = "ANDROID"; OperatingSystem2["Ios"] = "IOS"; OperatingSystem2["Linux"] = "LINUX"; OperatingSystem2["Macos"] = "MACOS"; OperatingSystem2["Unknown"] = "UNKNOWN"; OperatingSystem2["Windows"] = "WINDOWS"; return OperatingSystem2; })(OperatingSystem || {}); var OrgStatsOrderBy = /* @__PURE__ */ ((OrgStatsOrderBy2) => { OrgStatsOrderBy2["Natural"] = "NATURAL"; OrgStatsOrderBy2["OrgIdAsc"] = "ORG_ID_ASC"; OrgStatsOrderBy2["OrgIdAscHourAsc"] = "ORG_ID_ASC__HOUR_ASC"; OrgStatsOrderBy2["OrgIdDesc"] = "ORG_ID_DESC"; OrgStatsOrderBy2["OrgIdDescHourDesc"] = "ORG_ID_DESC__HOUR_DESC"; OrgStatsOrderBy2["PrimaryKeyAsc"] = "PRIMARY_KEY_ASC"; OrgStatsOrderBy2["PrimaryKeyDesc"] = "PRIMARY_KEY_DESC"; return OrgStatsOrderBy2; })(OrgStatsOrderBy || {}); var ProjectsOrderBy = /* @__PURE__ */ ((ProjectsOrderBy2) => { ProjectsOrderBy2["Natural"] = "NATURAL"; ProjectsOrderBy2["PrimaryKeyAsc"] = "PRIMARY_KEY_ASC"; ProjectsOrderBy2["PrimaryKeyDesc"] = "PRIMARY_KEY_DESC"; return ProjectsOrderBy2; })(ProjectsOrderBy || {}); var ScrollOption = /* @__PURE__ */ ((ScrollOption2) => { ScrollOption2["StartFromCurrentLocation"] = "START_FROM_CURRENT_LOCATION"; ScrollOption2["StartFromTop"] = "START_FROM_TOP"; return ScrollOption2; })(ScrollOption || {}); var SelectorType = /* @__PURE__ */ ((SelectorType2) => { SelectorType2["Xpath"] = "XPATH"; return SelectorType2; })(SelectorType || {}); var SnapshotsOrderBy = /* @__PURE__ */ ((SnapshotsOrderBy2) => { SnapshotsOrderBy2["BuildIdAsc"] = "BUILD_ID_ASC"; SnapshotsOrderBy2["BuildIdDesc"] = "BUILD_ID_DESC"; SnapshotsOrderBy2["CreatedAtAsc"] = "CREATED_AT_ASC"; SnapshotsOrderBy2["CreatedAtDesc"] = "CREATED_AT_DESC"; SnapshotsOrderBy2["IdAsc"] = "ID_ASC"; SnapshotsOrderBy2["IdDesc"] = "ID_DESC"; SnapshotsOrderBy2["Natural"] = "NATURAL"; SnapshotsOrderBy2["PrimaryKeyAsc"] = "PRIMARY_KEY_ASC"; SnapshotsOrderBy2["PrimaryKeyDesc"] = "PRIMARY_KEY_DESC"; SnapshotsOrderBy2["UploadIdAsc"] = "UPLOAD_ID_ASC"; SnapshotsOrderBy2["UploadIdDesc"] = "UPLOAD_ID_DESC"; return SnapshotsOrderBy2; })(SnapshotsOrderBy || {}); var UpdateDiffStatus = /* @__PURE__ */ ((UpdateDiffStatus2) => { UpdateDiffStatus2["Approved"] = "APPROVED"; UpdateDiffStatus2["Rejected"] = "REJECTED"; UpdateDiffStatus2["Unapproved"] = "UNAPPROVED"; return UpdateDiffStatus2; })(UpdateDiffStatus || {}); var BuildDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "build" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "UUID" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "alias": { "kind": "Name", "value": "result" }, "name": { "kind": "Name", "value": "build" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "id" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "name" } }, { "kind": "Field", "name": { "kind": "Name", "value": "url" } }, { "kind": "Field", "name": { "kind": "Name", "value": "status" } }, { "kind": "Field", "name": { "kind": "Name", "value": "project" } }, { "kind": "Field", "name": { "kind": "Name", "value": "branch" } }, { "kind": "Field", "name": { "kind": "Name", "value": "defaultBranch" } }, { "kind": "Field", "name": { "kind": "Name", "value": "mode" } }] } }] } }] }; var BuildByCustomIdDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "buildByCustomId" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "alias": { "kind": "Name", "value": "result" }, "name": { "kind": "Name", "value": "buildByCustomId" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "customId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "name" } }, { "kind": "Field", "name": { "kind": "Name", "value": "url" } }, { "kind": "Field", "name": { "kind": "Name", "value": "status" } }, { "kind": "Field", "name": { "kind": "Name", "value": "project" } }, { "kind": "Field", "name": { "kind": "Name", "value": "branch" } }, { "kind": "Field", "name": { "kind": "Name", "value": "mode" } }] } }] } }] }; var BuildStatusDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "buildStatus" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "UUID" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "alias": { "kind": "Name", "value": "result" }, "name": { "kind": "Name", "value": "build" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "id" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "url" } }, { "kind": "Field", "name": { "kind": "Name", "value": "status" } }, { "kind": "Field", "alias": { "kind": "Name", "value": "unapprovedCount" }, "name": { "kind": "Name", "value": "diffCountExtended" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "input" }, "value": { "kind": "ObjectValue", "fields": [{ "kind": "ObjectField", "name": { "kind": "Name", "value": "status" }, "value": { "kind": "EnumValue", "value": "UNAPPROVED" } }] } }] }, { "kind": "Field", "alias": { "kind": "Name", "value": "errorCount" }, "name": { "kind": "Name", "value": "diffCountExtended" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "input" }, "value": { "kind": "ObjectValue", "fields": [{ "kind": "ObjectField", "name": { "kind": "Name", "value": "status" }, "value": { "kind": "EnumValue", "value": "ERRORED" } }] } }] }] } }] } }] }; var BuildWithDiffsDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "buildWithDiffs" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "UUID" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "alias": { "kind": "Name", "value": "result" }, "name": { "kind": "Name", "value": "build" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "id" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "name" } }, { "kind": "Field", "name": { "kind": "Name", "value": "url" } }, { "kind": "Field", "name": { "kind": "Name", "value": "status" } }, { "kind": "Field", "name": { "kind": "Name", "value": "project" } }, { "kind": "Field", "name": { "kind": "Name", "value": "branch" } }, { "kind": "Field", "name": { "kind": "Name", "value": "diffs" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "nodes" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "baselineId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "status" } }, { "kind": "Field", "name": { "kind": "Name", "value": "baseline" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "snapshot" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "buildId" } }] } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "diffBounds" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "x" } }, { "kind": "Field", "name": { "kind": "Name", "value": "y" } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "diffClusters" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "x" } }, { "kind": "Field", "name": { "kind": "Name", "value": "y" } }, { "kind": "Field", "name": { "kind": "Name", "value": "width" } }, { "kind": "Field", "name": { "kind": "Name", "value": "height" } }] } }] } }] } }] } }] } }] }; var BuildWithDiffsByCustomIdDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "buildWithDiffsByCustomId" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "alias": { "kind": "Name", "value": "result" }, "name": { "kind": "Name", "value": "buildByCustomId" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "customId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "name" } }, { "kind": "Field", "name": { "kind": "Name", "value": "url" } }, { "kind": "Field", "name": { "kind": "Name", "value": "status" } }, { "kind": "Field", "name": { "kind": "Name", "value": "project" } }, { "kind": "Field", "name": { "kind": "Name", "value": "branch" } }, { "kind": "Field", "name": { "kind": "Name", "value": "diffs" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "nodes" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "baselineId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "status" } }, { "kind": "Field", "name": { "kind": "Name", "value": "baseline" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "snapshot" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "buildId" } }] } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "diffBounds" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "x" } }, { "kind": "Field", "name": { "kind": "Name", "value": "y" } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "diffClusters" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "x" } }, { "kind": "Field", "name": { "kind": "Name", "value": "y" } }] } }] } }] } }] } }] } }] }; var CreateBuildDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "createBuild" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "BuildIn" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "alias": { "kind": "Name", "value": "result" }, "name": { "kind": "Name", "value": "createBuild" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "input" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "name" } }, { "kind": "Field", "name": { "kind": "Name", "value": "project" } }, { "kind": "Field", "name": { "kind": "Name", "value": "branch" } }, { "kind": "Field", "name": { "kind": "Name", "value": "defaultBranch" } }, { "kind": "Field", "name": { "kind": "Name", "value": "status" } }, { "kind": "Field", "name": { "kind": "Name", "value": "url" } }] } }] } }] }; var CreateSnapshotDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "createSnapshot" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "SnapshotIn" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "alias": { "kind": "Name", "value": "result" }, "name": { "kind": "Name", "value": "createSnapshot" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "input" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "uploadId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "diffs" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "nodes" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "baselineId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "snapshotId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "status" } }, { "kind": "Field", "name": { "kind": "Name", "value": "diffBounds" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "x" } }, { "kind": "Field", "name": { "kind": "Name", "value": "y" } }, { "kind": "Field", "name": { "kind": "Name", "value": "width" } }, { "kind": "Field", "name": { "kind": "Name", "value": "height" } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "diffClusters" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "x" } }, { "kind": "Field", "name": { "kind": "Name", "value": "y" } }, { "kind": "Field", "name": { "kind": "Name", "value": "width" } }, { "kind": "Field", "name": { "kind": "Name", "value": "height" } }] } }] } }] } }] } }] } }] }; var CreateSnapshotFromWebDriverDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "createSnapshotFromWebDriver" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "CreateSnapshotFromWebDriverIn" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "alias": { "kind": "Name", "value": "result" }, "name": { "kind": "Name", "value": "createSnapshotFromWebDriver" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "input" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "uploadId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "diffs" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "nodes" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "baselineId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "snapshotId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "status" } }, { "kind": "Field", "name": { "kind": "Name", "value": "diffBounds" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "x" } }, { "kind": "Field", "name": { "kind": "Name", "value": "y" } }, { "kind": "Field", "name": { "kind": "Name", "value": "width" } }, { "kind": "Field", "name": { "kind": "Name", "value": "height" } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "diffClusters" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "x" } }, { "kind": "Field", "name": { "kind": "Name", "value": "y" } }, { "kind": "Field", "name": { "kind": "Name", "value": "width" } }, { "kind": "Field", "name": { "kind": "Name", "value": "height" } }] } }] } }] } }] } }] } }] }; var CreateSnapshotUploadDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "createSnapshotUpload" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "SnapshotUploadIn" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "alias": { "kind": "Name", "value": "result" }, "name": { "kind": "Name", "value": "createSnapshotUpload" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "input" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "buildId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "imageUploadUrl" } }, { "kind": "Field", "name": { "kind": "Name", "value": "domUploadUrl" } }] } }] } }] }; var DiffsForTestResultDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "diffsForTestResult" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "UUID" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "alias": { "kind": "Name", "value": "result" }, "name": { "kind": "Name", "value": "diffs" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "condition" }, "value": { "kind": "ObjectValue", "fields": [{ "kind": "ObjectField", "name": { "kind": "Name", "value": "buildId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } } }] } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "nodes" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "status" } }] } }] } }] } }] }; var FinishBuildDocumentDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "FinishBuildDocument" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "FinishBuildIn" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "alias": { "kind": "Name", "value": "result" }, "name": { "kind": "Name", "value": "finishBuild" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "input" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "name" } }, { "kind": "Field", "name": { "kind": "Name", "value": "status" } }, { "kind": "Field", "name": { "kind": "Name", "value": "url" } }] } }] } }] }; var MergeBaselinesDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "mergeBaselines" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "MergeBaselinesInput" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "alias": { "kind": "Name", "value": "result" }, "name": { "kind": "Name", "value": "mergeBaselines" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "input" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "baselines" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }] } }] } }] } }] }; var UpdateDiffDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "UpdateDiff" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "UpdateDiffIn" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "alias": { "kind": "Name", "value": "result" }, "name": { "kind": "Name", "value": "updateDiff" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "input" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "status" } }, { "kind": "Field", "name": { "kind": "Name", "value": "baselineId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "snapshotId" } }] } }] } }] }; var WebdriverSessionInfoDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "webdriverSessionInfo" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "WebdriverSessionInfoIn" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "alias": { "kind": "Name", "value": "result" }, "name": { "kind": "Name", "value": "webdriverSessionInfo" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "input" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "blob" } }, { "kind": "Field", "name": { "kind": "Name", "value": "operatingSystem" } }, { "kind": "Field", "name": { "kind": "Name", "value": "operatingSystemVersion" } }, { "kind": "Field", "name": { "kind": "Name", "value": "browser" } }, { "kind": "Field", "name": { "kind": "Name", "value": "browserVersion" } }, { "kind": "Field", "name": { "kind": "Name", "value": "deviceName" } }] } }] } }] }; // src/common/selective-region.ts async function selectiveRegionsToRegionIn(regions2, fn) { const awaited = await Promise.all( regions2.map(async (region) => { const resolved = await fn(region.element); return resolved.map((rect) => ({ ...rect, diffingOptions: selectiveRegionOptionsToDiffingOptions(region) })); }) ); return awaited.flatMap((x) => x); } function selectiveRegionsToRegionInSync(regions2, fn) { let result2; selectiveRegionsToRegionIn(regions2, (r) => Promise.resolve(fn(r))).then( (r) => { result2 = r; } ); if (result2 === void 0) throw new Error("internal logic error"); return result2; } function selectiveRegionOptionsToDiffingOptions(opt) { if ("enableOnly" in opt && opt.enableOnly) { const diffingOptions = { content: false, dimensions: false, position: false, structure: false, style: false, visual: false }; for (const key of opt.enableOnly) diffingOptions[key] = true; return diffingOptions; } else { const diffingOptions = { content: true, dimensions: true, position: true, structure: true, style: true, visual: true }; for (const key of opt.disableOnly) diffingOptions[key] = false; return diffingOptions; } } function selectiveRegionToRegionIn(input) { return input.map((opt) => { const { x, y, width, height } = opt; return { x, y, width, height, diffingOptions: selectiveRegionOptionsToDiffingOptions(opt) }; }); } // src/common/regions.ts var VisualApiRegion = class { name; aliases; graphqlEndpoint; jobUrlTemplate; constructor(options) { this.name = options.name; this.aliases = options.aliases; this.graphqlEndpoint = options.graphqlEndpoint; this.jobUrlTemplate = options.jobUrlTemplate; } jobUrl(jobId) { return this.jobUrlTemplate.replace("JOB_ID", jobId); } static fromName(name) { const r = regions.find((r2) => r2.name === name || r2.aliases.includes(name)); if (!r) { throw new Error(`${name} is not recognised as a Sauce Labs region.`); } return r; } }; var regions = [ new VisualApiRegion({ name: "staging", aliases: ["us-west-4-jeh6"], graphqlEndpoint: "https://api.staging.saucelabs.net/v1/visual/graphql", jobUrlTemplate: "https://app.staging.saucelabs.net/tests/JOB_ID" }), new VisualApiRegion({ name: "us-east-4", aliases: ["us-east-4-cm5i"], graphqlEndpoint: "https://api.us-east-4.saucelabs.com/v1/visual/graphql", jobUrlTemplate: "https://app.us-east-4.saucelabs.com/tests/JOB_ID" }), new VisualApiRegion({ name: "eu-central-1", aliases: ["eu", "eu-west-3-lnbf"], graphqlEndpoint: "https://api.eu-central-1.saucelabs.com/v1/visual/graphql", jobUrlTemplate: "https://app.eu-central-1.saucelabs.com/tests/JOB_ID" }), new VisualApiRegion({ name: "us-west-1", aliases: ["us", "us-west-4-i3er"], graphqlEndpoint: "https://api.us-west-1.saucelabs.com/v1/visual/graphql", jobUrlTemplate: "https://app.saucelabs.com/tests/JOB_ID" }) ]; var resolveRegionFromOndemandHostname = (hostname) => { const match = hostname.match( /^ondemand\.(?:([a-z0-9-]+)\.)?saucelabs\.(?:com|net)$/ ); if (!match) { return void 0; } if (!match[1]) { return "us-west-1"; } return match[1]; }; // src/common/api.ts import fs from "fs"; // ../node_modules/node-fetch/src/index.js import http2 from "http"; import https from "https"; import zlib from "zlib"; import Stream2, { PassThrough as PassThrough2, pipeline as pump } from "stream"; import { Buffer as Buffer3 } from "buffer"; // ../node_modules/node-fetch/node_modules/data-uri-to-buffer/dist/index.js function dataUriToBuffer(uri) { if (!/^data:/i.test(uri)) { throw new TypeError('`uri` does not appear to be a Data URI (must begin with "data:")'); } uri = uri.replace(/\r?\n/g, ""); const firstComma = uri.indexOf(","); if (firstComma === -1 || firstComma <= 4) { throw new TypeError("malformed data: URI"); } const meta = uri.substring(5, firstComma).split(";"); let charset = ""; let base64 = false; const type = meta[0] || "text/plain"; let typeFull = type; for (let i = 1; i < meta.length; i++) { if (meta[i] === "base64") { base64 = true; } else if (meta[i]) { typeFull += `;${meta[i]}`; if (meta[i].indexOf("charset=") === 0) { charset = meta[i].substring(8); } } } if (!meta[0] && !charset.length) { typeFull += ";charset=US-ASCII"; charset = "US-ASCII"; } const encoding = base64 ? "base64" : "ascii"; const data = unescape(uri.substring(firstComma + 1)); const buffer = Buffer.from(data, encoding); buffer.type = type; buffer.typeFull = typeFull; buffer.charset = charset; return buffer; } var dist_default = dataUriToBuffer; // ../node_modules/node-fetch/src/body.js import Stream, { PassThrough } from "stream"; import { types, deprecate, promisify } from "util"; import { Buffer as Buffer2 } from "buffer"; // ../node_modules/node-fetch/src/errors/base.js var FetchBaseError = class extends Error { constructor(message, type) { super(message); Error.captureStackTrace(this, this.constructor); this.type = type; } get name() { return this.constructor.name; } get [Symbol.toStringTag]() { return this.constructor.name; } }; // ../node_modules/node-fetch/src/errors/fetch-error.js var FetchError = class extends FetchBaseError { /** * @param {string} message - Error message for human * @param {string} [type] - Error type for machine * @param {SystemError} [systemError] - For Node.js system error */ constructor(message, type, systemError) { super(message, type); if (systemError) { this.code = this.errno = systemError.code; this.erroredSysCall = systemError.syscall; } } }; // ../node_modules/node-fetch/src/utils/is.js var NAME = Symbol.toStringTag; var isURLSearchParameters = (object) => { return typeof object === "object" && typeof object.append === "function" && typeof object.delete === "function" && typeof object.get === "function" && typeof object.getAll === "function" && typeof object.has === "function" && typeof object.set === "function" && typeof object.sort === "function" && object[NAME] === "URLSearchParams"; }; var isBlob = (object) => { return object && typeof object === "object" && typeof object.arrayBuffer === "function" && typeof object.type === "string" && typeof object.stream === "function" && typeof object.constructor === "function" && /^(Blob|File)$/.test(object[NAME]); }; var isAbortSignal = (object) => { return typeof object === "object" && (object[NAME] === "AbortSignal" || object[NAME] === "EventTarget"); }; var isDomainOrSubdomain = (destination, original) => { const orig = new URL(original).hostname; const dest = new URL(destination).hostname; return orig === dest || orig.endsWith(`.${dest}`); }; var isSameProtocol = (destination, original) => { const orig = new URL(original).protocol; const dest = new URL(destination).protocol; return orig === dest; }; // ../node_modules/node-fetch/src/body.js var pipeline = promisify(Stream.pipeline); var INTERNALS = Symbol("Body internals"); var Body = class { constructor(body, { size = 0 } = {}) { let boundary = null; if (body === null) { body = null; } else if (isURLSearchParameters(body)) { body = Buffer2.from(body.toString()); } else if (isBlob(body)) { } else if (Buffer2.isBuffer(body)) { } else if (types.isAnyArrayBuffer(body)) { body = Buffer2.from(body); } else if (ArrayBuffer.isView(body)) { body = Buffer2.from(body.buffer, body.byteOffset, body.byteLength); } else if (body instanceof Stream) { } else if (body instanceof FormData) { body = formDataToBlob(body); boundary = body.type.split("=")[1]; } else { body = Buffer2.from(String(body)); } let stream = body; if (Buffer2.isBuffer(body)) { stream = Stream.Readable.from(body); } else if (isBlob(body)) { stream = Stream.Readable.from(body.stream()); } this[INTERNALS] = { body, stream, boundary, disturbed: false, error: null }; this.size = size; if (body instanceof Stream) { body.on("error", (error_) => { const error = error_ instanceof FetchBaseError ? error_ : new FetchError(`Invalid response body while trying to fetch ${this.url}: ${error_.message}`, "system", error_); this[INTERNALS].error = error; }); } } get body() { return this[INTERNALS].stream; } get bodyUsed() { return this[INTERNALS].disturbed; } /** * Decode response as ArrayBuffer * * @return Promise */ async arrayBuffer() { const { buffer, byteOffset, byteLength } = await consumeBody(this); return buffer.slice(byteOffset, byteOffset + byteLength); } async formData() { const ct = this.headers.get("content-type"); if (ct.startsWith("application/x-www-form-urlencoded")) { const formData = new FormData(); const parameters = new URLSearchParams(await this.text()); for (const [name, value] of parameters) { formData.append(name, value); } return formData; } const { toFormData } = await import("./multipart-parser-EHIARONI.js"); return toFormData(this.body, ct); } /** * Return raw response as Blob * * @return Promise */ async blob() { const ct = this.headers && this.headers.get("content-type") || this[INTERNALS].body && this[INTERNALS].body.type || ""; const buf = await this.arrayBuffer(); return new fetch_blob_default([buf], { type: ct }); } /** * Decode response as json * * @return Promise */ async json() { const text = await this.text(); return JSON.parse(text); } /** * Decode response as text * * @return Promise */ async text() { const buffer = await consumeBody(this); return new TextDecoder().decode(buffer); } /** * Decode response as buffer (non-spec api) * * @return Promise */ buffer() { return consumeBody(this); } }; Body.prototype.buffer = deprecate(Body.prototype.buffer, "Please use 'response.arrayBuffer()' instead of 'response.buffer()'", "node-fetch#buffer"); Object.defineProperties(Body.prototype, { body: { enumerable: true }, bodyUsed: { enumerable: true }, arrayBuffer: { enumerable: true }, blob: { enumerable: true }, json: { enumerable: true }, text: { enumerable: true }, data: { get: deprecate( () => { }, "data doesn't exist, use json(), text(), arrayBuffer(), or body instead", "https://github.com/node-fetch/node-fetch/issues/1000 (response)" ) } }); async function consumeBody(data) { if (data[INTERNALS].disturbed) { throw new TypeError(`body used already for: ${data.url}`); } data[INTERNALS].disturbed = true; if (data[INTERNALS].error) { throw data[INTERNALS].error; } const { body } = data; if (body === null) { return Buffer2.alloc(0); } if (!(body instanceof Stream)) { return Buffer2.alloc(0); } const accum = []; let accumBytes = 0; try { for await (const chunk of body) { if (data.size > 0 && accumBytes + chunk.length > data.size) { const error = new FetchError(`content size at ${data.url} over limit: ${data.size}`, "max-size"); body.destroy(error); throw error; } accumBytes += chunk.length; accum.push(chunk); } } catch (error) { const error_ = error instanceof FetchBaseError ? error : new FetchError(`Invalid response body while trying to fetch ${data.url}: ${error.message}`, "system", error); throw error_; } if (body.readableEnded === true || body._readableState.ended === true) { try { if (accum.every((c) => typeof c === "string")) { return Buffer2.from(accum.join("")); } return Buffer2.concat(accum, accumBytes); } catch (error) { throw new FetchError(`Could not create Buffer from response body for ${data.url}: ${error.message}`, "system", error); } } else { throw new FetchError(`Premature close of server response while trying to fetch ${data.url}`); } } var clone = (instance, highWaterMark) => { let p1; let p2; let { body } = instance[INTERNALS]; if (instance.bodyUsed) { throw new Error("cannot clone body after it is used"); } if (body instanceof Stream && typeof body.getBoundary !== "function") { p1 = new PassThrough({ highWaterMark }); p2 = new PassThrough({ highWaterMark }); body.pipe(p1); body.pipe(p2); instance[INTERNALS].stream = p1; body = p2; } return body; }; var getNonSpecFormDataBoundary = deprecate( (body) => body.getBoundary(), "form-data doesn't follow the spec and requires special treatment. Use alternative package", "https://github.com/node-fetch/node-fetch/issues/1167" ); var extractContentType = (body, request) => { if (body === null) { return null; } if (typeof body === "string") { return "text/plain;charset=UTF-8"; } if (isURLSearchParameters(body)) { return "application/x-www-form-urlencoded;charset=UTF-8"; } if (isBlob(body)) { return body.type || null; } if (Buffer2.isBuffer(body) || types.isAnyArrayBuffer(body) || ArrayBuffer.isView(body)) { return null; } if (body instanceof FormData) { return `multipart/form-data; boundary=${request[INTERNALS].boundary}`; } if (body && typeof body.getBoundary === "function") { return `multipart/form-data;boundary=${getNonSpecFormDataBoundary(body)}`; } if (body instanceof Stream) { return null; } return "text/plain;charset=UTF-8"; }; var getTotalBytes = (request) => { const { body } = request[INTERNALS]; if (body === null) { return 0; } if (isBlob(body)) { return body.size; } if (Buffer2.isBuffer(body)) { return body.length; } if (body && typeof body.getLengthSync === "function") { return body.hasKnownLength && body.hasKnownLength() ? body.getLengthSync() : null; } return null; }; var writeToStream = async (dest, { body }) => { if (body === null) { dest.end(); } else { await pipeline(body, dest); } }; // ../node_modules/node-fetch/src/headers.js import { types as types2 } from "util"; import http from "http"; var validateHeaderName = typeof http.validateHeaderName === "function" ? http.validateHeaderName : (name) => { if (!/^[\^`\-\w!#$%&'*+.|~]+$/.test(name)) { const error = new TypeError(`Header name must be a valid HTTP token [${name}]`); Object.defineProperty(error, "code", { value: "ERR_INVALID_HTTP_TOKEN" }); throw error; } }; var validateHeaderValue = typeof http.validateHeaderValue === "function" ? http.validateHeaderValue : (name, value) => { if (/[^\t\u0020-\u007E\u0080-\u00FF]/.test(value)) { const error = new TypeError(`Invalid character in header content ["${name}"]`); Object.defineProperty(error, "code", { value: "ERR_INVALID_CHAR" }); throw error; } }; var Headers = class _Headers extends URLSearchParams { /** * Headers class * * @constructor * @param {HeadersInit} [init] - Response headers */ constructor(init) { let result2 = []; if (init instanceof _Headers) { const raw = init.raw(); for (const [name, values] of Object.entries(raw)) { result2.push(...values.map((value) => [name, value])); } } else if (init == null) { } else if (typeof init === "object" && !types2.isBoxedPrimitive(init)) { const method = init[Symbol.iterator]; if (method == null) { result2.push(...Object.entries(init)); } else { if (typeof method !== "function") { throw new TypeError("Header pairs must be iterable"); } result2 = [...init].map((pair) => { if (typeof pair !== "object" || types2.isBoxedPrimitive(pair)) { throw new TypeError("Each header pair must be an iterable object"); } return [...pair]; }).map((pair) => { if (pair.length !== 2) { throw new TypeError("Each header pair must be a name/value tuple"); } return [...pair]; }); } } else { throw new TypeError("Failed to construct 'Headers': The provided value is not of type '(sequence<sequence<ByteString>> or record<ByteString, ByteString>)"); } result2 = result2.length > 0 ? result2.map(([name, value]) => { validateHeaderName(name); validateHeaderValue(name, String(value)); return [String(name).toLowerCase(), String(value)]; }) : void 0; super(result2); return new Proxy(this, { get(target, p, receiver) { switch (p) { case "append": case "set": return (name, value) => { validateHeaderName(name); validateHeaderValue(name, String(value)); return URLSearchParams.prototype[p].call( target, String(name).toLowerCase(), String(value) ); }; case "delete": case "has": case "getAll": return (name) => { validateHeaderName(name); return URLSearchParams.prototype[p].call( target, String(name).toLowerCase() ); }; case "keys": return () => { target.sort(); return new Set(URLSearchParams.prototype.keys.call(target)).keys(); }; default: return Reflect.get(target, p, receiv