@qawolf/ci-sdk 0.23.1 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/lib/other.ts","../src/lib/sdk/defaults/fetch.ts","../src/lib/sdk/defaults/log.ts","../src/lib/sdk/defaults/serviceBase.ts","../package.json","../src/lib/sdk/defaults/userAgent.ts","../src/lib/api/log.ts","../src/lib/sdk/domain/attemptDeploy/index.ts","../src/lib/api/generate-signed-url-for-run-inputs-executables.ts","../src/lib/sdk/domain/generateSignedUrls/generate-signed-url-for-run-inputs-executables.ts","../src/lib/api/generate-signed-url-for-team-storage.ts","../src/lib/sdk/domain/generateSignedUrls/generate-signed-url-for-team-storage.ts","../src/lib/api/ci-greenlight.ts","../src/lib/sdk/domain/poll-ci-greenlight.ts","../src/lib/sdk/index.ts"],"names":["sleep","ms","Promise","resolve","setTimeout","pluralize","count","buildFetchWithTimeout","fetch","timeout","args","signal","AbortSignal","defaultFetch","globalThis","defaultLogDriver","error","message","console","info","log","warn","defaultServiceBase","defaultUserAgent","packageJson","version","logFetchError","methodName","response","ok","eventId","failureMessage","body","json","catch","text","undefined","eventIdSuffix","messageSuffix","statusText","status","attemptNotifyDeploy","deps","apiConfig","config","localFetch","URL","serviceBase","JSON","stringify","branch","commit_url","commitUrl","deduplication_key","deduplicationKey","deployment_type","deploymentType","deployment_url","deploymentUrl","hosting_service","hostingService","merge_request_number","mergeRequestNumber","pull_request_number","pullRequestNumber","repository","sha","variables","headers","Authorization","apiKey","userAgent","method","handleErrorResponse","data","handleSuccessResponse","abortReason","httpStatus","outcome","environment","results","isPreviewDeployment","isStatic","logPrefix","alias","id","length","environmentId","runId","failReason","failedTrigger","find","t","failure_reason","duplicateSuite","duplicate_suite_id","successfulTrigger","created_suite_id","callGenerateSignedUrlForRunInputsExecutablesStorage","destinationFilePath","encodeURIComponent","fileLocation","playgroundFileLocation","signedUrl","success","errorMessage","e","generateSignedUrlForRunInputsExecutablesStorage","responseState","uploadUrl","callGenerateSignedUrlForTempTeamStorage","generateSignedUrlForTempTeamStorage","fetchCiGreenlightStatus","resp","greenlightStatus","canRetry","errorType","safeDefaults","abortOnSuperseded","maxRetries","pollTimeout","retryInterval","runInProgressInterval","runUnderReviewInterval","pollCiGreenlightStatus","onRunStageChanged","pollConfig","retries","currentStatus","startedAt","Date","now","hasTimedOut","retryLabel","previousStatus","runStage","urlInfo","relevantRunUrl","greenlight","relevantRunId","relevantRunWithBugsUrl","rootRunId","rootRunUrl","supersedingDetails","blockingBugsCount","blockingBugUrls","nonBlockingBugsCount","nonBlockingBugUrls","blockingBugList","map","url","join","nonBlockingBugList","bugsListInText","Error","makeQaWolfSdk","bind"],"mappings":";;;;;;AAEO,SAASA,MAAMC,EAAU,EAAA;AAC9B,EAAA,OAAO,IAAIC,OAAQ,CAAA,CAACC,YAAYC,UAAWD,CAAAA,OAAAA,EAASF,EAAAA,CAAAA,CAAAA;AACtD;AAFgBD,MAAAA,CAAAA,KAAAA,EAAAA,OAAAA,CAAAA;AAIT,SAASK,UAAUC,KAAa,EAAA;AACrC,EAAOA,OAAAA,KAAAA,KAAU,IAAI,EAAK,GAAA,GAAA;AAC5B;AAFgBD,MAAAA,CAAAA,SAAAA,EAAAA,WAAAA,CAAAA;AAYT,IAAME,qBAAAA,2BACVC,KAAoBC,EAAAA,OAAAA,KACrB,UAAUC,IACRF,KAAAA,KAAAA,CAAME,IAAK,CAAA,CAAA,CAAI,EAAA;AAAE,EAAA,GAAGA,KAAK,CAAA,CAAA;EAAIC,MAAQC,EAAAA,WAAAA,CAAYH,QAAQA,OAAAA;AAAS,CAAA,CAFpE,EAAA,uBAAA,CAAA;;;ACnBK,IAAMI,eAAeC,UAAWN,CAAAA,KAAAA;;;ACEhC,IAAMO,gBAA8B,GAAA;AACzCC,EAAAA,KAAAA,CAAMC,SAASD,KAAK,EAAA;AAClBE,IAAQF,OAAAA,CAAAA,KAAAA,C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AA,EACErF,MACAvB,EAAAA,WAAAA,GAAczB,oBACdiD,SAAYhD,GAAAA,gBAAAA,EAMd,EAAA,EACEf,QAAQK,YACRO,EAAAA,GAAAA,GAAML,gBAAgB,EAAA,GACM,EAAE,EAAA;AAEhC,EAAI,IAAA,OAAOP,UAAU,UAAY,EAAA;AAC/B,IAAA,MAAMkJ,KACJ,CAAA,CAAA;AACuG,4GAAA,CAAA,CAAA;AAE3G;AAEA,EAAA,MAAMhH,IAAwB,GAAA;;IAE5BlC,KAAOD,EAAAA,qBAAAA,CAAsBC,OAAO,GAAA,CAAA;AACpCY,IAAAA;AACF,GAAA;AACA,EAAA,MAAMuB,SAAuB,GAAA;AAAE2B,IAAAA,MAAAA;AAAQvB,IAAAA,WAAAA;AAAawB,IAAAA;AAAU,GAAA;AAC9D,EAAO,OAAA;AACL9B,IAAAA,mBAAAA,EAAqBA,mBAAoBmH,CAAAA,IAAAA,CAAK,IAAMlH,EAAAA,IAAAA,EAAMC,SAAAA,CAAAA;AAC1DgE,IAAAA,+CAAAA,EACEA,+CAAgDiD,CAAAA,IAAAA,CAC9C,IACAlH,EAAAA,IAAAA,EACAC,SAAAA,CAAAA;AAEJoE,IAAAA,mCAAAA,EACEA,mCAAoC6C,CAAAA,IAAAA,CAAK,IAAMlH,EAAAA,IAAAA,EAAMC,SAAAA,CAAAA;AACvDiF,IAAAA,sBAAAA,EAAwBA,sBAAuBgC,CAAAA,IAAAA,CAAK,IAAMlH,EAAAA,IAAAA,EAAMC,SAAAA;AAClE,GAAA;AACF;AAxCgBgH,MAAAA,CAAAA,aAAAA,EAAAA,eAAAA,CAAAA","file":"index.cjs","sourcesContent":["import { type FetchDriver } from \"./sdk/dependencies.js\";\n\nexport function sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\nexport function pluralize(count: number) {\n return count === 1 ? \"\" : \"s\";\n}\n\nexport function getBackoffMs(\n attemptNumber: number,\n minWaitMs = 1000,\n maxWaitMs = 10000,\n): number {\n return Math.min(maxWaitMs, minWaitMs * 1.2 ** attemptNumber);\n}\n\nexport const buildFetchWithTimeout =\n (fetch: FetchDriver, timeout: number) =>\n async (...args: Parameters<FetchDriver>) =>\n fetch(args[0], { ...args[1], signal: AbortSignal.timeout(timeout) });\n","export const defaultFetch = globalThis.fetch;\n","import { type LogDriver } from \"../dependencies.js\";\n\nexport const defaultLogDriver: LogDriver = {\n error(message, error) {\n console.error(message, error);\n },\n info(message) {\n console.log(message);\n },\n warn(message) {\n console.warn(message);\n },\n};\n","export const defaultServiceBase = \"https://app.qawolf.com/\";\n","{\n \"name\": \"@qawolf/ci-sdk\",\n \"version\": \"1.0.1\",\n \"private\": false,\n \"description\": \"A simple SDK for interacting with QAWolf in CI scripts.\",\n \"keywords\": [],\n \"license\": \"MIT\",\n \"author\": \"Jules Sam. Randolph<jules@qawolf.com>\",\n \"type\": \"module\",\n \"exports\": {\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"require\": \"./dist/index.cjs\",\n \"import\": \"./dist/index.js\",\n \"default\": \"./dist/index.js\"\n }\n },\n \"main\": \"./dist/index.cjs\",\n \"module\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"files\": [\n \"/dist\",\n \"/README.md\"\n ],\n \"scripts\": {\n \"build\": \"tsup src/index.ts --format esm,cjs --dts --clean --splitting --treeshake --sourcemap --outDir dist --target es2022\",\n \"lint\": \"cycle-import-scan . && eslint . --ext js,jsx,mjs,ts,tsx --quiet && prettier --check .\",\n \"lint:fix\": \"eslint . --ext js,jsx,mjs,ts,tsx --fix --quiet && prettier --log-level=warn --write .\",\n \"lint:warnings\": \"eslint . --ext js,jsx,mjs,ts,tsx\",\n \"prepublishOnly\": \"nx run ci-sdk:build\",\n \"test\": \"NODE_OPTIONS=\\\"--experimental-vm-modules\\\" NODE_NO_WARNINGS=1 jest\",\n \"tsc:check\": \"tsc --noEmit\"\n },\n \"dependencies\": {\n \"@qawolf/ci-utils\": \"^1.0.0\",\n \"@sinonjs/fake-timers\": \"^10.3.0\",\n \"slugify\": \"^1.6.6\",\n \"tslib\": \"^2.6.2\"\n },\n \"devDependencies\": {\n \"tsup\": \"8.3.5\"\n },\n \"engines\": {\n \"node\": \">=16\"\n }\n}\n","import packageJson from \"../../../../package.json\" with { type: \"json\" };\n\nexport const defaultUserAgent = `ci-sdk/${packageJson.version}`;\n","import { type LogDriver } from \"@qawolf/ci-utils\";\n\nexport async function logFetchError({\n log,\n methodName,\n response,\n}: {\n log: LogDriver;\n methodName: string;\n response: Response;\n}) {\n if (response.ok) return;\n\n const { eventId, failureMessage } = await (async () => {\n try {\n const body = (await response.json().catch(() => response.text())) as\n | Record<string, unknown>\n | string;\n if (typeof body === \"object\" && body !== null) {\n return {\n eventId: body.eventId,\n failureMessage: body.failureMessage,\n };\n }\n // If body is not an object (i.e., it's the text from catch)\n return {\n eventId: undefined,\n failureMessage: body,\n };\n } catch {\n // If both parsing attempts somehow fail\n return {\n eventId: undefined,\n failureMessage: undefined,\n };\n }\n })();\n\n const eventIdSuffix = eventId ? ` (Event ID: ${eventId})` : \"\";\n const messageSuffix = failureMessage ? `: ${failureMessage}` : \"\";\n\n const statusText =\n response.status >= 500\n ? \"Server Error\"\n : response.statusText || \"Unknown Error\";\n\n log.error(\n `❌ [${methodName}] ${response.status} ${statusText}${eventIdSuffix}${messageSuffix}`,\n );\n}\n","import { type ApiConfig } from \"../../../api-types.js\";\nimport { logFetchError } from \"../../../api/log.js\";\nimport { type LogDriver, type SdkDependencies } from \"../../dependencies.js\";\n\nimport {\n type AttemptDeployHttpAbortReason,\n type DeployConfig,\n type DeployStatus,\n type NotifyDeployStatus,\n} from \"./types.js\";\n\nexport async function attemptNotifyDeploy(\n deps: SdkDependencies,\n apiConfig: ApiConfig,\n config: Partial<DeployConfig>,\n): Promise<NotifyDeployStatus> {\n const { fetch: localFetch, log } = deps;\n try {\n const response = await localFetch(\n new URL(\"/api/webhooks/deploy_success\", apiConfig.serviceBase),\n {\n body: JSON.stringify({\n branch: config.branch,\n commit_url: config.commitUrl,\n deduplication_key: config.deduplicationKey,\n deployment_type: config.deploymentType,\n deployment_url: config.deploymentUrl,\n hosting_service: config.hostingService,\n merge_request_number:\n config.hostingService === \"GitLab\"\n ? config.mergeRequestNumber\n : undefined,\n pull_request_number:\n config.hostingService === \"GitHub\"\n ? config.pullRequestNumber\n : undefined,\n repository: config.repository,\n sha: config.sha,\n variables: config.variables,\n }),\n headers: {\n Authorization: `Bearer ${apiConfig.apiKey}`,\n \"Content-Type\": \"application/json\",\n \"User-Agent\": apiConfig.userAgent,\n },\n method: \"POST\",\n },\n );\n\n if (!response.ok) return handleErrorResponse(response, log);\n const data = (await response.json()) as DeployStatus;\n return handleSuccessResponse(data, log);\n } catch (error) {\n log.error(`🚫 Network error from deploy_success, aborting.`);\n return {\n abortReason: \"network-error\",\n httpStatus: undefined,\n outcome: \"aborted\",\n };\n }\n}\n\nasync function handleErrorResponse(\n response: Response,\n log: LogDriver,\n): Promise<NotifyDeployStatus> {\n const status = response.status;\n let abortReason: AttemptDeployHttpAbortReason;\n if (status === undefined) abortReason = \"network-error\";\n else if (status === 401) abortReason = \"401-unauthorized\";\n else if (status === 403) abortReason = \"403-forbidden\";\n else if (status >= 500) abortReason = \"5XX-server-error\";\n else abortReason = \"4XX-client-error\";\n await logFetchError({\n log,\n methodName: \"attemptNotifyDeploy\",\n response,\n });\n return {\n abortReason,\n httpStatus: status,\n outcome: \"aborted\",\n };\n}\n\nasync function handleSuccessResponse(\n data: DeployStatus,\n log: LogDriver,\n): Promise<NotifyDeployStatus> {\n const { environment, results } = data;\n const isPreviewDeployment = environment && !environment.isStatic;\n\n if (environment) {\n const logPrefix = environment.isStatic\n ? \"Static environment\"\n : \"Preview environment\";\n log.info(`${logPrefix}: ${environment.alias} (id: ${environment.id})`);\n }\n\n // No triggers were matched\n if (results.length === 0) {\n if (isPreviewDeployment) {\n log.info(\n `✅ Deployment notification was successful. No run was created for this deployment.`,\n );\n return {\n environmentId: environment.id,\n outcome: \"success\",\n runId: undefined,\n };\n }\n log.error(`🚫 No trigger matched the request. Please contact support.`);\n return { failReason: \"no-matched-trigger\", outcome: \"failed\" };\n }\n\n // If there are results, environment must be defined\n if (!environment) {\n log.error(`🚫 No environment matched the request. Please contact support.`);\n return { failReason: \"no-environment\", outcome: \"failed\" };\n }\n\n const failedTrigger = results.find((t) => \"failure_reason\" in t);\n if (failedTrigger) {\n log.error(\n `🚫 Run could not be created. Reason: \"${failedTrigger.failure_reason}\". Please contact support.`,\n );\n return { failReason: \"run-could-not-be-created\", outcome: \"failed\" };\n }\n\n const duplicateSuite = results.find((t) => \"duplicate_suite_id\" in t);\n if (duplicateSuite) {\n log.info(\n `✅ Deployment notification was successful. Previous run ID: ${duplicateSuite.duplicate_suite_id} already exists for this deployment.`,\n );\n return {\n environmentId: environment.id,\n outcome: \"success\",\n runId: duplicateSuite.duplicate_suite_id,\n };\n }\n\n const successfulTrigger = results.find((t) => \"created_suite_id\" in t);\n if (!successfulTrigger) {\n log.error(`🚫 No trigger matched the request. Please contact support.`);\n return { failReason: \"no-matched-trigger\", outcome: \"failed\" };\n }\n log.info(\n `✅ Deployment notification was successful. Run created with ID: ${successfulTrigger.created_suite_id}`,\n );\n return {\n environmentId: environment.id,\n outcome: \"success\",\n runId: successfulTrigger.created_suite_id,\n };\n}\n","import { type ApiConfig } from \"../api-types.js\";\nimport { type SdkDependencies } from \"../sdk/dependencies.js\";\nimport {\n type GenerateSignedUrlConfig,\n type GenerateSignedUrlResponse,\n} from \"../sdk/domain/generateSignedUrls/types.js\";\n\nimport { logFetchError } from \"./log.js\";\n\nexport async function callGenerateSignedUrlForRunInputsExecutablesStorage(\n { apiKey, serviceBase, userAgent }: ApiConfig,\n { destinationFilePath }: GenerateSignedUrlConfig,\n { fetch: localFetch, log }: SdkDependencies,\n): Promise<GenerateSignedUrlResponse> {\n try {\n const response = await localFetch(\n new URL(\n `${serviceBase}/api/v0/run-inputs-executables-signed-urls?file=${encodeURIComponent(destinationFilePath)}`,\n ),\n {\n headers: {\n Authorization: `Bearer ${apiKey}`,\n \"Content-Type\": \"application/json\",\n \"User-Agent\": userAgent,\n },\n method: \"GET\",\n },\n );\n\n if (response.status === 200) {\n const json =\n (await response.json()) as Partial<GenerateSignedUrlResponse>;\n return {\n fileLocation: json.fileLocation,\n httpStatus: response.status,\n playgroundFileLocation: json.playgroundFileLocation,\n signedUrl: json.signedUrl,\n success: true,\n } as const;\n }\n await logFetchError({\n log,\n methodName: \"callGenerateSignedUrlForRunInputsExecutablesStorage\",\n response,\n });\n return {\n errorMessage: await response.text(),\n httpStatus: response.status,\n success: false,\n } as const;\n } catch (e) {\n return {\n errorMessage: \"Network error, aborting request to generate signed URL\",\n httpStatus: 0,\n success: false,\n } as const;\n }\n}\n","import { type ApiConfig } from \"../../../api-types.js\";\nimport { callGenerateSignedUrlForRunInputsExecutablesStorage } from \"../../../api/generate-signed-url-for-run-inputs-executables.js\";\nimport { type SdkDependencies } from \"../../dependencies.js\";\n\nimport {\n type GenerateSignedUrlAbortReason,\n type GenerateSignedUrlConfig,\n type GenerateSignedUrlStatus,\n} from \"./types.js\";\n\nexport async function generateSignedUrlForRunInputsExecutablesStorage(\n deps: SdkDependencies,\n apiConfig: ApiConfig,\n config: GenerateSignedUrlConfig,\n): Promise<GenerateSignedUrlStatus> {\n const { log } = deps;\n\n if (!config.destinationFilePath) {\n log.error(`🚫 destinationFilePath is a required config parameter`);\n return {\n abortReason: \"sdk-argument-validation-failed\",\n success: false,\n };\n }\n\n const responseState =\n await callGenerateSignedUrlForRunInputsExecutablesStorage(\n apiConfig,\n config,\n deps,\n );\n if (!responseState.success) {\n let abortReason: GenerateSignedUrlAbortReason = \"XXX-other-http-code\";\n\n if (responseState.httpStatus >= 500) {\n abortReason = \"5XX-server-error\";\n log.error(\n `🚫 Unrecoverable error (status ${responseState.httpStatus}) when generating signed upload url: aborting.`,\n );\n } else {\n if (responseState.httpStatus === 400) abortReason = \"400-invalid-request\";\n else if (responseState.httpStatus === 401)\n abortReason = \"401-invalid-credentials\";\n else if (responseState.httpStatus === 403) abortReason = \"403-forbidden\";\n else if (responseState.httpStatus === 0)\n abortReason = \"client-network-error\";\n\n log.error(\n `🚫 Unrecoverable error (status ${responseState.httpStatus}) when generating signed upload url: ${responseState.errorMessage ? `${responseState.errorMessage}.` : \"\"} aborting.`,\n );\n }\n\n return {\n abortReason,\n httpStatus: responseState.httpStatus,\n success: false,\n };\n }\n\n log.info(`✅ Generated Signed Upload URL: ${responseState.signedUrl}.`);\n return {\n fileLocation: responseState.fileLocation,\n playgroundFileLocation: responseState.playgroundFileLocation,\n success: true,\n uploadUrl: responseState.signedUrl,\n };\n}\n","import { type ApiConfig } from \"../api-types.js\";\nimport { type SdkDependencies } from \"../sdk/dependencies.js\";\nimport {\n type GenerateSignedUrlConfig,\n type GenerateSignedUrlResponse,\n} from \"../sdk/domain/generateSignedUrls/types.js\";\n\nimport { logFetchError } from \"./log.js\";\n\nexport async function callGenerateSignedUrlForTempTeamStorage(\n { apiKey, serviceBase, userAgent }: ApiConfig,\n { destinationFilePath }: Partial<GenerateSignedUrlConfig>,\n { fetch: localFetch, log }: SdkDependencies,\n): Promise<GenerateSignedUrlResponse> {\n try {\n const response = await localFetch(\n new URL(\n `${serviceBase}/api/v0/team-storage-signed-url?file=${destinationFilePath}`,\n ),\n {\n headers: {\n Authorization: `Bearer ${apiKey}`,\n \"Content-Type\": \"application/json\",\n \"User-Agent\": userAgent,\n },\n method: \"GET\",\n },\n );\n\n if (response.status === 200) {\n const json =\n (await response.json()) as Partial<GenerateSignedUrlResponse>;\n return {\n fileLocation: json.fileLocation,\n httpStatus: response.status,\n playgroundFileLocation: json.playgroundFileLocation,\n signedUrl: json.signedUrl,\n success: true,\n } as const;\n }\n await logFetchError({\n log,\n methodName: \"callGenerateSignedUrlForTempTeamStorage\",\n response,\n });\n return {\n errorMessage: await response.text(),\n httpStatus: response.status,\n success: false,\n } as const;\n } catch (e) {\n return {\n errorMessage: \"Network error, aborting request to generate signed URL\",\n httpStatus: 0,\n success: false,\n } as const;\n }\n}\n","import { type ApiConfig } from \"../../../api-types.js\";\nimport { callGenerateSignedUrlForTempTeamStorage } from \"../../../api/generate-signed-url-for-team-storage.js\";\nimport { type SdkDependencies } from \"../../dependencies.js\";\n\nimport { type GenerateSignedUrlConfig } from \"./types.js\";\n\ntype GenerateSignedUrlStatus =\n | {\n fileLocation?: string;\n playgroundFileLocation?: string;\n success: true;\n uploadUrl?: string;\n }\n | {\n abortReason: GenerateSignedUrlAbortReason;\n httpStatus?: number;\n success: false;\n };\n\nexport type GenerateSignedUrlAbortReason =\n | \"client-network-error\"\n | \"sdk-argument-validation-failed\"\n | \"400-invalid-request\"\n | \"401-invalid-credentials\"\n | \"403-forbidden\"\n | \"5XX-server-error\"\n | \"XXX-other-http-code\";\n\nexport async function generateSignedUrlForTempTeamStorage(\n deps: SdkDependencies,\n apiConfig: ApiConfig,\n config: GenerateSignedUrlConfig,\n): Promise<GenerateSignedUrlStatus> {\n const { log } = deps;\n\n if (!config.destinationFilePath) {\n log.error(`🚫 destinationFilePath is a required config parameter`);\n return {\n abortReason: \"sdk-argument-validation-failed\",\n success: false,\n };\n }\n\n const responseState = await callGenerateSignedUrlForTempTeamStorage(\n apiConfig,\n config,\n deps,\n );\n if (!responseState.success) {\n let abortReason: GenerateSignedUrlAbortReason = \"XXX-other-http-code\";\n\n if (responseState.httpStatus >= 500) {\n abortReason = \"5XX-server-error\";\n log.error(\n `🚫 Unrecoverable error (status ${responseState.httpStatus}) when generating signed upload url: aborting.`,\n );\n } else {\n if (responseState.httpStatus === 400) abortReason = \"400-invalid-request\";\n else if (responseState.httpStatus === 401)\n abortReason = \"401-invalid-credentials\";\n else if (responseState.httpStatus === 403) abortReason = \"403-forbidden\";\n else if (responseState.httpStatus === 0)\n abortReason = \"client-network-error\";\n\n log.error(\n `🚫 Unrecoverable error (status ${responseState.httpStatus}) when generating signed upload url: ${responseState.errorMessage ? `${responseState.errorMessage}.` : \"\"} aborting.`,\n );\n }\n\n return {\n abortReason,\n httpStatus: responseState.httpStatus,\n success: false,\n };\n }\n\n log.info(`✅ Generated Signed Upload URL: ${responseState.signedUrl}.`);\n return {\n fileLocation: responseState.fileLocation,\n playgroundFileLocation: responseState.playgroundFileLocation,\n success: true,\n uploadUrl: responseState.signedUrl,\n };\n}\n","import { type ApiConfig } from \"../api-types.js\";\nimport { type SdkDependencies } from \"../sdk/dependencies.js\";\n\nimport { logFetchError } from \"./log.js\";\n\nexport type CiGreenlightBugDetails = {\n /**\n * The URL of this BR in the QAWolf application.\n */\n applicationUrl: string;\n /**\n * If this bug report is linked to an external issue, it will\n * show up here.\n */\n externalIssue:\n | {\n /**\n * The URL of the external issue in the external platform\n * application.\n */\n applicationUrl: string;\n /**\n * The ID of this issue in the external platform.\n */\n externalIssueId: string;\n /**\n * Lowercase platform name (e.g. \"jira\").\n */\n platform: string;\n }\n | undefined;\n /**\n * True if the bug is blocking.\n */\n isBlocking: boolean;\n /**\n * True if the bug has been found in this run.\n */\n isNew: boolean;\n /**\n * The name of this bug.\n */\n name: string;\n /**\n * The bug number.\n */\n number: number;\n /**\n * The priority of this bug.\n */\n priority: \"medium\" | \"unprioritized\" | \"low\" | \"high\" | \"urgent\";\n};\n\nexport type CiGreenlightBugData = {\n /**\n * The count of blocking bugs reproduced in the run.\n */\n blockingBugsCount: number;\n /**\n * The URLs of the blocking bugs.\n *\n * @deprecated This field will be removed in the next major version.\n * Prefer using `reproducedBugs` filtered by `isBlocking: true`, reading\n * the `applicationUrl` field.\n */\n blockingBugUrls: string[];\n /**\n * The count of non-blocking bugs reproduced in the run.\n */\n nonBlockingBugsCount: number;\n /**\n * The URLs of the non-blocking bugs.\n *\n * @deprecated This field will be removed in the next major version.\n * Prefer using `reproducedBugs` filtered by `isBlocking: false`, reading\n * the `applicationUrl` field.\n */\n nonBlockingBugUrls: string[];\n /**\n * Blocking bugs that were not reproduced in this run, but are still\n * opened in the run environment. This may happen when the run only covers a\n * subset of the workflows in environment.\n */\n otherBlockingBugsInEnvironment: CiGreenlightBugDetails[];\n /**\n * Bugs that were reproduced in this run. This includes newly found bugs.\n */\n reproducedBugs: CiGreenlightBugDetails[];\n};\n\n/**\n * @deprecated This type will be removed in the next major version. Use `CiGreenlightBugData` instead.\n */\nexport type CiGreenlightCompletedSuiteDetails = CiGreenlightBugData;\n\nexport type CiGreenlightStatusBase = {\n relevantRunId: string;\n relevantRunUrl: string;\n relevantRunWithBugsUrl: string;\n rootRunId: string;\n rootRunUrl: string;\n workflowsDisabledAfterRunCount: number;\n workflowsInRunCount: number;\n workflowsUnderInvestigationCount: number;\n};\n\n/**\n * The status of a CI greenlight run. See the API documentation here for\n * more details: https://qawolf.notion.site/1b170576efea411fa785842a71e7c99e\n */\nexport type CiGreenlightStatus = CiGreenlightStatusBase &\n (\n | ({\n greenlight: boolean;\n runStage: \"completed\";\n } & CiGreenlightBugData)\n | ({\n greenlight: false;\n runStage: \"underReview\";\n } & CiGreenlightBugData)\n | {\n greenlight: false;\n runStage: \"initializing\" | \"underReview\" | \"canceled\";\n }\n );\n\nexport async function fetchCiGreenlightStatus(\n { apiKey, serviceBase, userAgent }: ApiConfig,\n {\n runId,\n }: {\n runId: string;\n },\n { fetch: localFetch, log }: SdkDependencies,\n) {\n try {\n const resp = await localFetch(\n new URL(\n `/api/v0/ci-greenlight/${encodeURIComponent(runId)}`,\n serviceBase,\n ),\n {\n headers: {\n Authorization: `Bearer ${apiKey}`,\n \"User-Agent\": userAgent,\n },\n },\n );\n\n if (resp.ok) {\n const greenlightStatus = (await resp.json()) as CiGreenlightStatus;\n return {\n greenlightStatus,\n httpStatus: resp.status,\n ok: true,\n } as const;\n }\n await logFetchError({\n log,\n methodName: \"fetchCiGreenlightStatus\",\n response: resp,\n });\n if (resp.status === 404) {\n return {\n canRetry: true,\n errorType: \"not-found\",\n httpStatus: resp.status,\n ok: false,\n } as const;\n }\n if (resp.status >= 500) {\n return {\n canRetry: true,\n errorType: \"server\",\n httpStatus: resp.status,\n ok: false,\n } as const;\n }\n return {\n canRetry: false,\n errorType: \"client\",\n httpStatus: resp.status,\n ok: false,\n } as const;\n } catch (e) {\n return {\n canRetry: true,\n errorType: \"network\",\n httpStatus: 0,\n ok: false,\n } as const;\n }\n}\n","/* eslint-disable @qawolf/max-lines -- Technical debt */\n\nimport { type ApiConfig } from \"../../api-types.js\";\nimport {\n type CiGreenlightStatus,\n fetchCiGreenlightStatus,\n} from \"../../api/ci-greenlight.js\";\nimport { pluralize, sleep } from \"../../other.js\";\nimport { type SdkDependencies } from \"../dependencies.js\";\n\nexport type PollCiGreenlightPollConfig = {\n /**\n * If true, the job will be aborted when a superseding run is detected.\n *\n * @default false\n */\n abortOnSuperseded: boolean;\n /**\n * Maximum number of network operations retries before aborting the job.\n *\n * @default 10\n */\n maxRetries: number;\n /**\n * Timeout in milliseconds before aborting this polling operation.\n *\n * @default 120 minutes\n */\n pollTimeout: number;\n /**\n * Interval in milliseconds between network operations retries.\n *\n * @default 10 seconds\n */\n retryInterval: number;\n /**\n * Interval in milliseconds between polling for a run in progress.\n *\n * @default 30 seconds\n */\n runInProgressInterval: number;\n /**\n * Interval in milliseconds between polling for a run under review.\n *\n * @default 60 minutes\n */\n runUnderReviewInterval: number;\n};\n\nexport type PollCiGreenlightHttpAbortReason =\n | \"4XX-client-error\"\n | \"404-run-not-found\"\n | \"5XX-server-error\"\n | \"XXX-other-http-code\";\n\nexport type PollCiGreenlightNonHttpAbortReason =\n | \"poll-timed-out\"\n | \"run-canceled\"\n | \"network-error\"\n | \"superseded-run\";\n\nexport type PollCiGreenlightAbortReason =\n | PollCiGreenlightNonHttpAbortReason\n | PollCiGreenlightHttpAbortReason;\n\nexport type PollCiGreenlightStatus =\n | {\n greenlightStatus: Extract<CiGreenlightStatus, { runStage: \"completed\" }>;\n /**\n * No blocking bugs were found in the run.\n */\n outcome: \"success\";\n }\n | {\n greenlightStatus: Extract<CiGreenlightStatus, { runStage: \"completed\" }>;\n /**\n * Blocking bugs were found in the run.\n */\n outcome: \"failed\";\n }\n | {\n abortReason: PollCiGreenlightHttpAbortReason;\n httpStatus: number;\n /**\n * The run was aborted due to an unrecoverable error.\n */\n outcome: \"aborted\";\n }\n | {\n abortReason: PollCiGreenlightNonHttpAbortReason;\n httpStatus: undefined;\n /**\n * The run was aborted due to an unrecoverable error.\n */\n outcome: \"aborted\";\n };\n\nexport type PollCiGreenlightParams = {\n /**\n * Callback to be called when the lifecycle stage of the run changes.\n */\n onRunStageChanged?: (\n current: CiGreenlightStatus,\n previous: CiGreenlightStatus | undefined,\n ) => unknown | Promise<unknown>;\n runId: string;\n} & Partial<PollCiGreenlightPollConfig>;\n\n// If you change these values, make sure you update the JSDoc\n// comments in the PollConfig type.\nconst safeDefaults: PollCiGreenlightPollConfig = {\n abortOnSuperseded: false,\n maxRetries: 10,\n pollTimeout: 120 * 60 * 1000,\n retryInterval: 10 * 1000,\n runInProgressInterval: 30 * 1000,\n runUnderReviewInterval: 60 * 1000,\n};\n\nexport async function pollCiGreenlightStatus(\n deps: SdkDependencies,\n apiConfig: ApiConfig,\n {\n onRunStageChanged: onRunStageChanged = () => undefined,\n runId,\n ...pollConfig\n }: PollCiGreenlightParams,\n): Promise<PollCiGreenlightStatus> {\n let retries = 0;\n const { log } = deps;\n const {\n abortOnSuperseded = safeDefaults.abortOnSuperseded,\n maxRetries = safeDefaults.maxRetries,\n pollTimeout = safeDefaults.pollTimeout,\n retryInterval = safeDefaults.retryInterval,\n runInProgressInterval = safeDefaults.runInProgressInterval,\n runUnderReviewInterval = safeDefaults.runUnderReviewInterval,\n } = pollConfig;\n let currentStatus: CiGreenlightStatus | undefined = undefined;\n const startedAt = Date.now();\n let hasTimedOut = false;\n while (!(hasTimedOut = Date.now() - startedAt > pollTimeout)) {\n const responseState = await fetchCiGreenlightStatus(\n apiConfig,\n {\n runId,\n },\n deps,\n );\n if (!responseState.ok && !responseState.canRetry) {\n log.error(\n `🚫 Unrecoverable error (status ${responseState.httpStatus}) from CI greenlight, aborting.`,\n );\n return {\n abortReason: \"4XX-client-error\",\n httpStatus: responseState.httpStatus,\n outcome: \"aborted\",\n };\n }\n if (!responseState.ok) {\n // This is a non-OK retryable status.\n retries += 1;\n if (retries > maxRetries) {\n log.error(\n `🚫 Unrecoverable error${\n responseState.httpStatus\n ? ` (status ${responseState.httpStatus})`\n : \"\"\n } from CI greenlight, aborting after ${maxRetries} attempts.`,\n );\n if (responseState.errorType === \"network\") {\n return {\n abortReason: \"network-error\",\n httpStatus: undefined,\n outcome: \"aborted\",\n };\n }\n let abortReason: PollCiGreenlightAbortReason = \"XXX-other-http-code\";\n\n if (responseState.errorType === \"not-found\")\n abortReason = \"404-run-not-found\";\n else if (responseState.errorType === \"server\")\n abortReason = \"5XX-server-error\";\n else responseState satisfies never;\n\n return {\n abortReason,\n httpStatus: responseState.httpStatus,\n outcome: \"aborted\",\n };\n }\n const { errorType, httpStatus } = responseState;\n const retryLabel = `${\n httpStatus ? ` (status ${httpStatus})` : \"\"\n }, will try again... (${retries}/${maxRetries})`;\n if (errorType === \"network\") log.warn(`❌ Network error${retryLabel}`);\n else if (errorType === \"not-found\")\n log.info(`⏳ Run not found${retryLabel}`);\n else if (errorType === \"server\") log.warn(`❌ Server error${retryLabel}`);\n\n await sleep(retryInterval);\n continue;\n }\n // responseState.ok === true\n retries = 0;\n const { greenlightStatus } = responseState;\n const previousStatus = currentStatus;\n currentStatus = greenlightStatus;\n if (\n !previousStatus ||\n previousStatus.runStage !== greenlightStatus.runStage\n ) {\n try {\n await onRunStageChanged(greenlightStatus, previousStatus);\n } catch (e) {\n log.error(`Error in onRunStageChanged callback`, e);\n }\n }\n const urlInfo = `See ${greenlightStatus.relevantRunUrl}`;\n const {\n greenlight,\n relevantRunId,\n relevantRunUrl,\n relevantRunWithBugsUrl,\n rootRunId,\n rootRunUrl,\n runStage,\n } = greenlightStatus;\n if (rootRunId !== relevantRunId) {\n const supersedingDetails = `\n - Root: ${rootRunUrl}\n - Superseding: ${relevantRunUrl}`;\n if (abortOnSuperseded) {\n log.warn(\n `❌ Aborting due to superseded run (option 'abortOnSuperseded' is enabled).${supersedingDetails}`,\n );\n return {\n abortReason: \"superseded-run\",\n httpStatus: undefined,\n outcome: \"aborted\",\n };\n }\n log.info(`Root run was superseded:${supersedingDetails}`);\n }\n if (runStage === \"completed\") {\n const {\n blockingBugsCount,\n blockingBugUrls = [],\n nonBlockingBugsCount,\n nonBlockingBugUrls = [],\n } = greenlightStatus;\n const blockingBugList = blockingBugUrls\n .map((url) => `\\n• ${url}`)\n .join(\"\");\n const nonBlockingBugList = nonBlockingBugUrls\n .map((url) => `\\n• ${url}`)\n .join(\"\");\n const bugsListInText = `${\n blockingBugUrls.length > 0 ? `\\nBLOCKING BUGS:${blockingBugList}` : \"\"\n }${\n nonBlockingBugUrls.length > 0\n ? `\\nNON BLOCKING BUGS:${nonBlockingBugList}`\n : \"\"\n }`;\n if (greenlight) {\n log.info(\n `✅ Run passed and no blocking bugs found${\n nonBlockingBugsCount > 0\n ? ` and ${nonBlockingBugsCount} non-blocking bug${pluralize(\n nonBlockingBugsCount,\n )} found`\n : \"\"\n }.\\n${urlInfo}`,\n );\n return { greenlightStatus, outcome: \"success\" };\n } else {\n log.warn(\n `❌ Run failed and ${blockingBugsCount} blocking bug${pluralize(\n blockingBugsCount,\n )} found${\n nonBlockingBugsCount\n ? ` and ${nonBlockingBugsCount} non-blocking bug${pluralize(\n nonBlockingBugsCount,\n )}`\n : \"\"\n }.\\nSee ${relevantRunWithBugsUrl}\\n` +\n \"You may review the priority of certain bugs to mark these non-blocking and retry the job.\\n\" +\n bugsListInText,\n );\n return { greenlightStatus, outcome: \"failed\" };\n }\n }\n if (runStage === \"canceled\") {\n log.info(\n `🚫 Run was canceled. Aborting... Please contact support.\\n${urlInfo}`,\n );\n return {\n abortReason: \"run-canceled\",\n httpStatus: undefined,\n outcome: \"aborted\",\n };\n }\n // Non-terminal run stages\n if (hasTimedOut) {\n log.warn(`❌ Poll timed out after ${pollTimeout / 1000}s. Aborting...`);\n return {\n abortReason: \"poll-timed-out\",\n httpStatus: undefined,\n outcome: \"aborted\",\n };\n }\n if (runStage === \"initializing\") {\n log.info(`⏳ Run is in progress... ${urlInfo}`);\n await sleep(runInProgressInterval);\n } else if (runStage === \"underReview\") {\n log.info(`🕵️ Run is under review... ${urlInfo}`);\n await sleep(runUnderReviewInterval);\n } else throw Error(`Unexpected run stage: ${runStage satisfies never}`);\n }\n\n log.warn(`❌ Poll timed out after ${pollTimeout / 1000}s. Aborting...`);\n return {\n abortReason: \"poll-timed-out\",\n httpStatus: undefined,\n outcome: \"aborted\",\n };\n}\n","import { type ApiConfig } from \"../api-types.js\";\nimport { buildFetchWithTimeout } from \"../other.js\";\n\nimport { defaultFetch } from \"./defaults/fetch.js\";\nimport { defaultLogDriver } from \"./defaults/log.js\";\nimport { defaultServiceBase } from \"./defaults/serviceBase.js\";\nimport { defaultUserAgent } from \"./defaults/userAgent.js\";\nimport { type SdkDependencies } from \"./dependencies.js\";\nimport { attemptNotifyDeploy } from \"./domain/attemptDeploy/index.js\";\nimport { generateSignedUrlForRunInputsExecutablesStorage } from \"./domain/generateSignedUrls/generate-signed-url-for-run-inputs-executables.js\";\nimport { generateSignedUrlForTempTeamStorage } from \"./domain/generateSignedUrls/generate-signed-url-for-team-storage.js\";\nimport { pollCiGreenlightStatus } from \"./domain/poll-ci-greenlight.js\";\n\nexport function makeQaWolfSdk(\n {\n apiKey,\n serviceBase = defaultServiceBase,\n userAgent = defaultUserAgent,\n }: {\n apiKey: string;\n serviceBase?: string;\n userAgent?: string;\n },\n {\n fetch = defaultFetch,\n log = defaultLogDriver,\n }: Partial<SdkDependencies> = {},\n) {\n if (typeof fetch !== \"function\") {\n throw Error(\n `QA Wolf CI-SDK requires fetch to be defined. Make sure you are using NodeJS 18+, OR pass a fetch polyfill to the makeQaWolfSdk function.\nWe recommend 'undici' package for that purpose. See the Requirement section of our README for more guidance.`,\n );\n }\n\n const deps: SdkDependencies = {\n // Versions of fetch may have different default timeouts. For consistency, we explicitly set it to 60 seconds here.\n fetch: buildFetchWithTimeout(fetch, 60000),\n log,\n };\n const apiConfig: ApiConfig = { apiKey, serviceBase, userAgent };\n return {\n attemptNotifyDeploy: attemptNotifyDeploy.bind(null, deps, apiConfig),\n generateSignedUrlForRunInputsExecutablesStorage:\n generateSignedUrlForRunInputsExecutablesStorage.bind(\n null,\n deps,\n apiConfig,\n ),\n generateSignedUrlForTempTeamStorage:\n generateSignedUrlForTempTeamStorage.bind(null, deps, apiConfig),\n pollCiGreenlightStatus: pollCiGreenlightStatus.bind(null, deps, apiConfig),\n };\n}\n\nexport type * from \"./domain/attemptDeploy/index.js\";\nexport type * from \"./domain/generateSignedUrls/types.js\";\nexport type * from \"./domain/poll-ci-greenlight.js\";\n"]}
@@ -327,204 +327,6 @@ declare function pollCiGreenlightStatus(deps: SdkDependencies, apiConfig: ApiCon
327
327
 
328
328
  type GenerateSignedUrlAbortReason = "client-network-error" | "sdk-argument-validation-failed" | "400-invalid-request" | "401-invalid-credentials" | "403-forbidden" | "5XX-server-error" | "XXX-other-http-code";
329
329
 
330
- type BaseVCSBranchConfig = {
331
- /**
332
- * The maximum number of retries for network operations. Only recoverable
333
- * errors will trigger a retry, such as network and server errors.
334
- *
335
- * @default 10
336
- */
337
- maxRetries?: number;
338
- };
339
- type EnvironmentLayout = {
340
- /**
341
- * Each entry of this array defines a correspondence between a QA Wolf environment
342
- * and a VCS branch. Use environment aliases to refer to a particular environment.
343
- * If not provided, base environment identification will be handled by the QA Wolf
344
- * app.
345
- */
346
- baseEnvironmentsMapping?: Array<{
347
- environmentAlias: string;
348
- vcsBranch: string;
349
- }>;
350
- /**
351
- * A unique alias for the environment being tested. We recommend using either
352
- * `pullRequestDetailsToEnvironmentAlias` or the more generic
353
- * `arbitraryStringToEnvironmentAlias` to generate this value.
354
- */
355
- headEnvironmentAlias: string;
356
- };
357
- type VCSLayout = {
358
- /**
359
- * The base VCS branch from which this
360
- * branch was created.
361
- */
362
- baseVcsBranch: string;
363
- /**
364
- * The VCS branch to test.
365
- */
366
- headVcsBranch: string;
367
- };
368
- type PullRequestTestingLayout = EnvironmentLayout & VCSLayout;
369
-
370
- type NotifyVCSBranchMergeCanceledInput = {
371
- /**
372
- * A unique alias for the environment being tested. We recommend using either
373
- * `pullRequestDetailsToEnvironmentAlias` or the more generic
374
- * `arbitraryStringToEnvironmentAlias` to generate this value.
375
- */
376
- headEnvironmentAlias: string;
377
- } & BaseVCSBranchConfig;
378
- type NotifyMergeCanceledAbortReason = "forbidden" | "unauthenticated" | "network-error" | "server-error" | "invalid-input" | "head-environment-not-found" | "non-ephemeral-head-environment-violation" | "missing-vcs-branch-to-environment-alias-mapping";
379
- type NotifyMergeCanceledResult = {
380
- outcome: "success";
381
- } | {
382
- abortReason: NotifyMergeCanceledAbortReason;
383
- eventId?: string;
384
- outcome: "aborted";
385
- };
386
-
387
- type NotifyVCSBranchMergeCompletedInput = PullRequestTestingLayout & BaseVCSBranchConfig;
388
- type NotifyMergeCompletedResultAbortReason = "forbidden" | "unauthenticated" | "network-error" | "server-error" | "invalid-input" | "head-environment-not-found" | "base-environment-not-found" | "non-ephemeral-head-environment-violation" | "missing-vcs-branch-to-environment-alias-mapping";
389
- type NotifyMergeCompletedResult = {
390
- outcome: "success";
391
- } | {
392
- abortReason: NotifyMergeCompletedResultAbortReason;
393
- eventId?: string;
394
- outcome: "aborted";
395
- };
396
-
397
- type NotifyBuildDeployedInput = PullRequestTestingLayout & BaseVCSBranchConfig & {
398
- /**
399
- * A natural positive integer that defines the maximum number of concurrent
400
- * workflows that can be executed for this deployment. It will default to
401
- * the concurrency limit defined in the base environment.
402
- *
403
- * @remark `0` and `Infinity` are valid values and will disable concurrency
404
- * limits.
405
- */
406
- concurrencyLimit?: number;
407
- /**
408
- * A human-friendly name for the environment that was deployed. For PR testing,
409
- * we recommend using "PR #<PR_NUMBER> - <PR_NAME>".
410
- */
411
- headEnvironmentName: string;
412
- /**
413
- * Environment variables overrides for the build that was deployed.
414
- * These variables are used in QA Wolf workflows, and must be communicated
415
- * to provide any specific configuration for this deployment.
416
- *
417
- * The most common environment variable is URL, which is used to locate the
418
- * deployment in E2E tests.
419
- *
420
- * @remark Determining which environment environment variables must be set
421
- * will require assistance from a QA Wolf representative.
422
- */
423
- headEnvironmentVariables: Record<string, string>;
424
- /**
425
- * The VCS commit ID of the build that was deployed. Must be unique for this
426
- * repository, and is used as a unique build identifier.
427
- */
428
- headVcsCommitId: string;
429
- /**
430
- * The VCS commit URL of the build that was deployed. When provided,
431
- * it will be used in the QA Wolf UI to link to the build.
432
- */
433
- headVcsCommitUrl?: string;
434
- /**
435
- * A unique identifier for the PR/MR being tested.
436
- *
437
- * This field is a prerequisite for PR/MR comments feature to work,
438
- * in which QA Wolf will post a comment with test results, including
439
- * live updates.
440
- */
441
- pullOrMergeRequestNumber?: number;
442
- };
443
- type NotifyBuildDeployedAbortReason = "forbidden" | "unauthenticated" | "network-error" | "server-error" | "invalid-input" | "base-environment-not-found" | "base-trigger-not-found" | "repository-not-found" | "head-trigger-not-found" | "non-ephemeral-head-environment-violation" | "missing-vcs-branch-to-environment-alias-mapping" | "run-creation-failed";
444
- type NotifyBuildDeployedResult = {
445
- /**
446
- * When non-nil, indicates that a code hosting service installation was
447
- * found and enabled. This will allow QA Wolf to interact with this service
448
- * and post run status comments on PRs/MRs.
449
- */
450
- codeHostingServiceInstallationType: "GitHub" | "GitLab" | undefined;
451
- outcome: "success";
452
- runId: string;
453
- } | {
454
- abortReason: NotifyBuildDeployedAbortReason;
455
- eventId?: string;
456
- outcome: "aborted";
457
- };
458
-
459
- /**
460
- * Creates a compliant environment alias from pull request details.
461
- */
462
- declare function pullRequestDetailsToEnvironmentAlias({ codeHostingServiceOrganization, codeHostingServiceRepositoryName, pullRequestIdentifier, }: {
463
- /**
464
- * The name of the Organization owning the VCS repository the current VCS
465
- * branch belongs to.
466
- */
467
- codeHostingServiceOrganization: string;
468
- /**
469
- * The name of the VCS repository the current VCS branch belongs to.
470
- */
471
- codeHostingServiceRepositoryName: string;
472
- /**
473
- * A unique identifier for this PR/MR. It must be unique for the repository
474
- * defined in `codeHostingServiceRepositoryName`.
475
- */
476
- pullRequestIdentifier: string;
477
- }): string;
478
- /**
479
- * Creates a compliant environment alias from an arbitrary string.
480
- */
481
- declare function arbitraryStringToEnvironmentAlias(arbitraryString: string): string;
482
-
483
- declare function makeVCSBranchTestingSDK({ apiKey, serviceBase, userAgent, }: {
484
- apiKey: string;
485
- serviceBase?: string;
486
- userAgent?: string;
487
- }, { fetch, log, }?: Partial<SdkDependencies>): VCSBranchTestingSDK;
488
- type VCSBranchTestingSDK = {
489
- /**
490
- * Notify QA Wolf that the build has been deployed and is ready to be tested.
491
- * Any ongoing run will be aborted and a new one will be started.
492
- *
493
- * @remarks This method will create a new Environment if none exists matching
494
- * the provided environment alias.
495
- */
496
- notifyVCSBranchBuildDeployed(input: NotifyBuildDeployedInput): Promise<NotifyBuildDeployedResult>;
497
- /**
498
- * Notify QA Wolf that the VCS branch merge has been canceled, e.g. the PR/MR
499
- * has been closed without merging. This will abort any ongoing run, and
500
- * discard any investigation work by QA Wolf.
501
- */
502
- notifyVCSBranchMergeCanceled(input: NotifyVCSBranchMergeCanceledInput): Promise<NotifyMergeCanceledResult>;
503
- /**
504
- * Notify QA Wolf that the VCS branch merge has been completed. This will
505
- * inform QA Wolf that any Workflow code change should be promoted to the
506
- * base environment, as defined in the baseEnvironmentsMapping.
507
- */
508
- notifyVCSBranchMergeCompleted(input: NotifyVCSBranchMergeCompletedInput): Promise<NotifyMergeCompletedResult>;
509
- };
510
-
511
- interface TestPreviewParams {
512
- baseEnvironmentId: string | undefined;
513
- branch: string;
514
- commitUrl: string;
515
- deploymentUrl: string | undefined;
516
- pr: {
517
- number: number;
518
- title: string;
519
- } | undefined;
520
- qaWolfTeamId: string;
521
- repoFullName: string;
522
- sha: string;
523
- variables: {
524
- [key: string]: string;
525
- };
526
- }
527
-
528
330
  declare function attemptNotifyDeploy(deps: SdkDependencies, apiConfig: ApiConfig, config: Partial<DeployConfig>): Promise<NotifyDeployStatus>;
529
331
 
530
332
  declare function makeQaWolfSdk({ apiKey, serviceBase, userAgent, }: {
@@ -533,17 +335,6 @@ declare function makeQaWolfSdk({ apiKey, serviceBase, userAgent, }: {
533
335
  userAgent?: string;
534
336
  }, { fetch, log, }?: Partial<SdkDependencies>): {
535
337
  attemptNotifyDeploy: (config: Partial<DeployConfig>) => Promise<NotifyDeployStatus>;
536
- /**
537
- * @deprecated Use `experimental_vcsBranchTesting` instead.
538
- */
539
- experimental_removeEnvironment: (config: {
540
- branch: string;
541
- }) => Promise<void>;
542
- /**
543
- * @deprecated Use `experimental_vcsBranchTesting` instead.
544
- */
545
- experimental_testPreview: (config: TestPreviewParams) => Promise<NotifyDeployStatus>;
546
- experimental_vcsBranchTesting: VCSBranchTestingSDK;
547
338
  generateSignedUrlForRunInputsExecutablesStorage: (config: GenerateSignedUrlConfig) => Promise<GenerateSignedUrlStatus>;
548
339
  generateSignedUrlForTempTeamStorage: (config: GenerateSignedUrlConfig) => Promise<{
549
340
  fileLocation?: string;
@@ -558,4 +349,4 @@ declare function makeQaWolfSdk({ apiKey, serviceBase, userAgent, }: {
558
349
  pollCiGreenlightStatus: (args_0: PollCiGreenlightParams) => Promise<PollCiGreenlightStatus>;
559
350
  };
560
351
 
561
- export { type AttemptDeployAbortReason, type AttemptDeployFailedReason, type AttemptDeployHttpAbortReason, type AttemptDeployNonHttpAbortReason, type BaseVCSBranchConfig, type CiGreenlightStatus, type CiGreenlightStatusBase, type DeployConfig, type DeployStatus, type DeployStatusErrorResponse, type DeployStatusResponse, type DeployStatusSuccessResponse, type DeploySuccessSuiteAlreadyExistsResult, type DeploySuccessSuiteCreatedResult, type DeploySuccessSuiteCreationFailureResult, type DeploySuccessSuiteResult, type EnvironmentLayout, type FetchDriver, type GenerateSignedUrlAbortReason$1 as GenerateSignedUrlAbortReason, type GenerateSignedUrlConfig, type GenerateSignedUrlResponse, type GenerateSignedUrlStatus, type GitHubDeployConfig, type GitLabDeployConfig, type NotifyBuildDeployedInput, type NotifyBuildDeployedResult, type NotifyDeployStatus, type NotifyMergeCanceledResult, type NotifyMergeCompletedResult, type NotifyVCSBranchMergeCanceledInput, type NotifyVCSBranchMergeCompletedInput, type PollCiGreenlightAbortReason, type PollCiGreenlightHttpAbortReason, type PollCiGreenlightNonHttpAbortReason, type PollCiGreenlightParams, type PollCiGreenlightPollConfig, type PollCiGreenlightStatus, type PullRequestTestingLayout, type SdkDependencies, type VCSBranchTestingSDK, type VCSLayout, arbitraryStringToEnvironmentAlias, attemptNotifyDeploy, makeQaWolfSdk, makeVCSBranchTestingSDK, pollCiGreenlightStatus, pullRequestDetailsToEnvironmentAlias };
352
+ export { type AttemptDeployAbortReason, type AttemptDeployFailedReason, type AttemptDeployHttpAbortReason, type AttemptDeployNonHttpAbortReason, type CiGreenlightStatus, type CiGreenlightStatusBase, type DeployConfig, type DeployStatus, type DeployStatusErrorResponse, type DeployStatusResponse, type DeployStatusSuccessResponse, type DeploySuccessSuiteAlreadyExistsResult, type DeploySuccessSuiteCreatedResult, type DeploySuccessSuiteCreationFailureResult, type DeploySuccessSuiteResult, type FetchDriver, type GenerateSignedUrlAbortReason$1 as GenerateSignedUrlAbortReason, type GenerateSignedUrlConfig, type GenerateSignedUrlResponse, type GenerateSignedUrlStatus, type GitHubDeployConfig, type GitLabDeployConfig, type NotifyDeployStatus, type PollCiGreenlightAbortReason, type PollCiGreenlightHttpAbortReason, type PollCiGreenlightNonHttpAbortReason, type PollCiGreenlightParams, type PollCiGreenlightPollConfig, type PollCiGreenlightStatus, type SdkDependencies, attemptNotifyDeploy, makeQaWolfSdk, pollCiGreenlightStatus };
package/dist/index.d.ts CHANGED
@@ -327,204 +327,6 @@ declare function pollCiGreenlightStatus(deps: SdkDependencies, apiConfig: ApiCon
327
327
 
328
328
  type GenerateSignedUrlAbortReason = "client-network-error" | "sdk-argument-validation-failed" | "400-invalid-request" | "401-invalid-credentials" | "403-forbidden" | "5XX-server-error" | "XXX-other-http-code";
329
329
 
330
- type BaseVCSBranchConfig = {
331
- /**
332
- * The maximum number of retries for network operations. Only recoverable
333
- * errors will trigger a retry, such as network and server errors.
334
- *
335
- * @default 10
336
- */
337
- maxRetries?: number;
338
- };
339
- type EnvironmentLayout = {
340
- /**
341
- * Each entry of this array defines a correspondence between a QA Wolf environment
342
- * and a VCS branch. Use environment aliases to refer to a particular environment.
343
- * If not provided, base environment identification will be handled by the QA Wolf
344
- * app.
345
- */
346
- baseEnvironmentsMapping?: Array<{
347
- environmentAlias: string;
348
- vcsBranch: string;
349
- }>;
350
- /**
351
- * A unique alias for the environment being tested. We recommend using either
352
- * `pullRequestDetailsToEnvironmentAlias` or the more generic
353
- * `arbitraryStringToEnvironmentAlias` to generate this value.
354
- */
355
- headEnvironmentAlias: string;
356
- };
357
- type VCSLayout = {
358
- /**
359
- * The base VCS branch from which this
360
- * branch was created.
361
- */
362
- baseVcsBranch: string;
363
- /**
364
- * The VCS branch to test.
365
- */
366
- headVcsBranch: string;
367
- };
368
- type PullRequestTestingLayout = EnvironmentLayout & VCSLayout;
369
-
370
- type NotifyVCSBranchMergeCanceledInput = {
371
- /**
372
- * A unique alias for the environment being tested. We recommend using either
373
- * `pullRequestDetailsToEnvironmentAlias` or the more generic
374
- * `arbitraryStringToEnvironmentAlias` to generate this value.
375
- */
376
- headEnvironmentAlias: string;
377
- } & BaseVCSBranchConfig;
378
- type NotifyMergeCanceledAbortReason = "forbidden" | "unauthenticated" | "network-error" | "server-error" | "invalid-input" | "head-environment-not-found" | "non-ephemeral-head-environment-violation" | "missing-vcs-branch-to-environment-alias-mapping";
379
- type NotifyMergeCanceledResult = {
380
- outcome: "success";
381
- } | {
382
- abortReason: NotifyMergeCanceledAbortReason;
383
- eventId?: string;
384
- outcome: "aborted";
385
- };
386
-
387
- type NotifyVCSBranchMergeCompletedInput = PullRequestTestingLayout & BaseVCSBranchConfig;
388
- type NotifyMergeCompletedResultAbortReason = "forbidden" | "unauthenticated" | "network-error" | "server-error" | "invalid-input" | "head-environment-not-found" | "base-environment-not-found" | "non-ephemeral-head-environment-violation" | "missing-vcs-branch-to-environment-alias-mapping";
389
- type NotifyMergeCompletedResult = {
390
- outcome: "success";
391
- } | {
392
- abortReason: NotifyMergeCompletedResultAbortReason;
393
- eventId?: string;
394
- outcome: "aborted";
395
- };
396
-
397
- type NotifyBuildDeployedInput = PullRequestTestingLayout & BaseVCSBranchConfig & {
398
- /**
399
- * A natural positive integer that defines the maximum number of concurrent
400
- * workflows that can be executed for this deployment. It will default to
401
- * the concurrency limit defined in the base environment.
402
- *
403
- * @remark `0` and `Infinity` are valid values and will disable concurrency
404
- * limits.
405
- */
406
- concurrencyLimit?: number;
407
- /**
408
- * A human-friendly name for the environment that was deployed. For PR testing,
409
- * we recommend using "PR #<PR_NUMBER> - <PR_NAME>".
410
- */
411
- headEnvironmentName: string;
412
- /**
413
- * Environment variables overrides for the build that was deployed.
414
- * These variables are used in QA Wolf workflows, and must be communicated
415
- * to provide any specific configuration for this deployment.
416
- *
417
- * The most common environment variable is URL, which is used to locate the
418
- * deployment in E2E tests.
419
- *
420
- * @remark Determining which environment environment variables must be set
421
- * will require assistance from a QA Wolf representative.
422
- */
423
- headEnvironmentVariables: Record<string, string>;
424
- /**
425
- * The VCS commit ID of the build that was deployed. Must be unique for this
426
- * repository, and is used as a unique build identifier.
427
- */
428
- headVcsCommitId: string;
429
- /**
430
- * The VCS commit URL of the build that was deployed. When provided,
431
- * it will be used in the QA Wolf UI to link to the build.
432
- */
433
- headVcsCommitUrl?: string;
434
- /**
435
- * A unique identifier for the PR/MR being tested.
436
- *
437
- * This field is a prerequisite for PR/MR comments feature to work,
438
- * in which QA Wolf will post a comment with test results, including
439
- * live updates.
440
- */
441
- pullOrMergeRequestNumber?: number;
442
- };
443
- type NotifyBuildDeployedAbortReason = "forbidden" | "unauthenticated" | "network-error" | "server-error" | "invalid-input" | "base-environment-not-found" | "base-trigger-not-found" | "repository-not-found" | "head-trigger-not-found" | "non-ephemeral-head-environment-violation" | "missing-vcs-branch-to-environment-alias-mapping" | "run-creation-failed";
444
- type NotifyBuildDeployedResult = {
445
- /**
446
- * When non-nil, indicates that a code hosting service installation was
447
- * found and enabled. This will allow QA Wolf to interact with this service
448
- * and post run status comments on PRs/MRs.
449
- */
450
- codeHostingServiceInstallationType: "GitHub" | "GitLab" | undefined;
451
- outcome: "success";
452
- runId: string;
453
- } | {
454
- abortReason: NotifyBuildDeployedAbortReason;
455
- eventId?: string;
456
- outcome: "aborted";
457
- };
458
-
459
- /**
460
- * Creates a compliant environment alias from pull request details.
461
- */
462
- declare function pullRequestDetailsToEnvironmentAlias({ codeHostingServiceOrganization, codeHostingServiceRepositoryName, pullRequestIdentifier, }: {
463
- /**
464
- * The name of the Organization owning the VCS repository the current VCS
465
- * branch belongs to.
466
- */
467
- codeHostingServiceOrganization: string;
468
- /**
469
- * The name of the VCS repository the current VCS branch belongs to.
470
- */
471
- codeHostingServiceRepositoryName: string;
472
- /**
473
- * A unique identifier for this PR/MR. It must be unique for the repository
474
- * defined in `codeHostingServiceRepositoryName`.
475
- */
476
- pullRequestIdentifier: string;
477
- }): string;
478
- /**
479
- * Creates a compliant environment alias from an arbitrary string.
480
- */
481
- declare function arbitraryStringToEnvironmentAlias(arbitraryString: string): string;
482
-
483
- declare function makeVCSBranchTestingSDK({ apiKey, serviceBase, userAgent, }: {
484
- apiKey: string;
485
- serviceBase?: string;
486
- userAgent?: string;
487
- }, { fetch, log, }?: Partial<SdkDependencies>): VCSBranchTestingSDK;
488
- type VCSBranchTestingSDK = {
489
- /**
490
- * Notify QA Wolf that the build has been deployed and is ready to be tested.
491
- * Any ongoing run will be aborted and a new one will be started.
492
- *
493
- * @remarks This method will create a new Environment if none exists matching
494
- * the provided environment alias.
495
- */
496
- notifyVCSBranchBuildDeployed(input: NotifyBuildDeployedInput): Promise<NotifyBuildDeployedResult>;
497
- /**
498
- * Notify QA Wolf that the VCS branch merge has been canceled, e.g. the PR/MR
499
- * has been closed without merging. This will abort any ongoing run, and
500
- * discard any investigation work by QA Wolf.
501
- */
502
- notifyVCSBranchMergeCanceled(input: NotifyVCSBranchMergeCanceledInput): Promise<NotifyMergeCanceledResult>;
503
- /**
504
- * Notify QA Wolf that the VCS branch merge has been completed. This will
505
- * inform QA Wolf that any Workflow code change should be promoted to the
506
- * base environment, as defined in the baseEnvironmentsMapping.
507
- */
508
- notifyVCSBranchMergeCompleted(input: NotifyVCSBranchMergeCompletedInput): Promise<NotifyMergeCompletedResult>;
509
- };
510
-
511
- interface TestPreviewParams {
512
- baseEnvironmentId: string | undefined;
513
- branch: string;
514
- commitUrl: string;
515
- deploymentUrl: string | undefined;
516
- pr: {
517
- number: number;
518
- title: string;
519
- } | undefined;
520
- qaWolfTeamId: string;
521
- repoFullName: string;
522
- sha: string;
523
- variables: {
524
- [key: string]: string;
525
- };
526
- }
527
-
528
330
  declare function attemptNotifyDeploy(deps: SdkDependencies, apiConfig: ApiConfig, config: Partial<DeployConfig>): Promise<NotifyDeployStatus>;
529
331
 
530
332
  declare function makeQaWolfSdk({ apiKey, serviceBase, userAgent, }: {
@@ -533,17 +335,6 @@ declare function makeQaWolfSdk({ apiKey, serviceBase, userAgent, }: {
533
335
  userAgent?: string;
534
336
  }, { fetch, log, }?: Partial<SdkDependencies>): {
535
337
  attemptNotifyDeploy: (config: Partial<DeployConfig>) => Promise<NotifyDeployStatus>;
536
- /**
537
- * @deprecated Use `experimental_vcsBranchTesting` instead.
538
- */
539
- experimental_removeEnvironment: (config: {
540
- branch: string;
541
- }) => Promise<void>;
542
- /**
543
- * @deprecated Use `experimental_vcsBranchTesting` instead.
544
- */
545
- experimental_testPreview: (config: TestPreviewParams) => Promise<NotifyDeployStatus>;
546
- experimental_vcsBranchTesting: VCSBranchTestingSDK;
547
338
  generateSignedUrlForRunInputsExecutablesStorage: (config: GenerateSignedUrlConfig) => Promise<GenerateSignedUrlStatus>;
548
339
  generateSignedUrlForTempTeamStorage: (config: GenerateSignedUrlConfig) => Promise<{
549
340
  fileLocation?: string;
@@ -558,4 +349,4 @@ declare function makeQaWolfSdk({ apiKey, serviceBase, userAgent, }: {
558
349
  pollCiGreenlightStatus: (args_0: PollCiGreenlightParams) => Promise<PollCiGreenlightStatus>;
559
350
  };
560
351
 
561
- export { type AttemptDeployAbortReason, type AttemptDeployFailedReason, type AttemptDeployHttpAbortReason, type AttemptDeployNonHttpAbortReason, type BaseVCSBranchConfig, type CiGreenlightStatus, type CiGreenlightStatusBase, type DeployConfig, type DeployStatus, type DeployStatusErrorResponse, type DeployStatusResponse, type DeployStatusSuccessResponse, type DeploySuccessSuiteAlreadyExistsResult, type DeploySuccessSuiteCreatedResult, type DeploySuccessSuiteCreationFailureResult, type DeploySuccessSuiteResult, type EnvironmentLayout, type FetchDriver, type GenerateSignedUrlAbortReason$1 as GenerateSignedUrlAbortReason, type GenerateSignedUrlConfig, type GenerateSignedUrlResponse, type GenerateSignedUrlStatus, type GitHubDeployConfig, type GitLabDeployConfig, type NotifyBuildDeployedInput, type NotifyBuildDeployedResult, type NotifyDeployStatus, type NotifyMergeCanceledResult, type NotifyMergeCompletedResult, type NotifyVCSBranchMergeCanceledInput, type NotifyVCSBranchMergeCompletedInput, type PollCiGreenlightAbortReason, type PollCiGreenlightHttpAbortReason, type PollCiGreenlightNonHttpAbortReason, type PollCiGreenlightParams, type PollCiGreenlightPollConfig, type PollCiGreenlightStatus, type PullRequestTestingLayout, type SdkDependencies, type VCSBranchTestingSDK, type VCSLayout, arbitraryStringToEnvironmentAlias, attemptNotifyDeploy, makeQaWolfSdk, makeVCSBranchTestingSDK, pollCiGreenlightStatus, pullRequestDetailsToEnvironmentAlias };
352
+ export { type AttemptDeployAbortReason, type AttemptDeployFailedReason, type AttemptDeployHttpAbortReason, type AttemptDeployNonHttpAbortReason, type CiGreenlightStatus, type CiGreenlightStatusBase, type DeployConfig, type DeployStatus, type DeployStatusErrorResponse, type DeployStatusResponse, type DeployStatusSuccessResponse, type DeploySuccessSuiteAlreadyExistsResult, type DeploySuccessSuiteCreatedResult, type DeploySuccessSuiteCreationFailureResult, type DeploySuccessSuiteResult, type FetchDriver, type GenerateSignedUrlAbortReason$1 as GenerateSignedUrlAbortReason, type GenerateSignedUrlConfig, type GenerateSignedUrlResponse, type GenerateSignedUrlStatus, type GitHubDeployConfig, type GitLabDeployConfig, type NotifyDeployStatus, type PollCiGreenlightAbortReason, type PollCiGreenlightHttpAbortReason, type PollCiGreenlightNonHttpAbortReason, type PollCiGreenlightParams, type PollCiGreenlightPollConfig, type PollCiGreenlightStatus, type SdkDependencies, attemptNotifyDeploy, makeQaWolfSdk, pollCiGreenlightStatus };