@qawolf/ci-sdk
Advanced tools
Comparing version 0.17.0 to 0.17.1
@@ -7,3 +7,5 @@ import { type ApiConfig } from "../api-types"; | ||
export type GenerateSignedUrlForTeamStorageResponse = { | ||
errorMessage?: string; | ||
fileLocation?: string; | ||
httpStatus: number; | ||
playgroundFileLocation?: string; | ||
@@ -10,0 +12,0 @@ signedUrl?: string; |
@@ -17,2 +17,3 @@ "use strict"; | ||
fileLocation: json.fileLocation, | ||
httpStatus: response.status, | ||
playgroundFileLocation: json.playgroundFileLocation, | ||
@@ -23,12 +24,12 @@ signedUrl: json.signedUrl, | ||
} | ||
else { | ||
const error = await response.text(); | ||
console.log(`ERROR: ${error}`); | ||
return { | ||
success: false, | ||
}; | ||
} | ||
return { | ||
errorMessage: await response.text(), | ||
httpStatus: response.status, | ||
success: false, | ||
}; | ||
} | ||
catch (e) { | ||
return { | ||
errorMessage: "Network error, aborting request to generate signed URL", | ||
httpStatus: 0, | ||
success: false, | ||
@@ -35,0 +36,0 @@ }; |
@@ -7,7 +7,12 @@ import { type GenerateSignedUrlForTeamStorageConfig } from "../../api/generate-signed-url-for-team-storage"; | ||
playgroundFileLocation?: string; | ||
success: boolean; | ||
success: true; | ||
uploadUrl?: string; | ||
} | { | ||
abortReason: GenerateSignedUrlAbortReason; | ||
httpStatus?: number; | ||
success: false; | ||
}; | ||
export type GenerateSignedUrlAbortReason = "client-network-error" | "sdk-argument-validation-failed" | "400-invalid-request" | "401-invalid-credentials" | "403-forbidden" | "5XX-server-error" | "XXX-other-http-code"; | ||
export declare function generateSignedUrlForTempTeamStorage(deps: SdkDependencies, apiConfig: ApiConfig, config: GenerateSignedUrlForTeamStorageConfig): Promise<GenerateSignedUrlStatus>; | ||
export {}; | ||
//# sourceMappingURL=generate-signed-url-for-team-storage.d.ts.map |
@@ -9,8 +9,34 @@ "use strict"; | ||
log.error(`🚫 destinationFilePath is a required config parameter`); | ||
return { success: false }; | ||
return { | ||
abortReason: "sdk-argument-validation-failed", | ||
success: false, | ||
}; | ||
} | ||
const responseState = await (0, generate_signed_url_for_team_storage_1.callGenerateSignedUrlForTempTeamStorage)(apiConfig, config, deps); | ||
if (!responseState.success) { | ||
log.error(`🚫 Failed to generate signed URL for team storage. Please contact support.`); | ||
return { success: false }; | ||
let abortReason = "XXX-other-http-code"; | ||
if (responseState.httpStatus >= 500) { | ||
abortReason = "5XX-server-error"; | ||
log.error(`🚫 Unrecoverable error (status ${responseState.httpStatus}) when generating signed upload url: aborting.`); | ||
} | ||
else { | ||
if (responseState.httpStatus === 400) { | ||
abortReason = "400-invalid-request"; | ||
} | ||
else if (responseState.httpStatus === 401) { | ||
abortReason = "401-invalid-credentials"; | ||
} | ||
else if (responseState.httpStatus === 403) { | ||
abortReason = "403-forbidden"; | ||
} | ||
else if (responseState.httpStatus === 0) { | ||
abortReason = "client-network-error"; | ||
} | ||
log.error(`🚫 Unrecoverable error (status ${responseState.httpStatus}) when generating signed upload url: ${responseState.errorMessage ? `${responseState.errorMessage}.` : ""} aborting.`); | ||
} | ||
return { | ||
abortReason, | ||
httpStatus: responseState.httpStatus, | ||
success: false, | ||
}; | ||
} | ||
@@ -17,0 +43,0 @@ log.info(`✅ Generated Signed Upload URL: ${responseState.signedUrl}.`); |
@@ -21,4 +21,8 @@ import { type SdkDependencies } from "./dependencies"; | ||
playgroundFileLocation?: string; | ||
success: boolean; | ||
success: true; | ||
uploadUrl?: string; | ||
} | { | ||
abortReason: import("./domain/generate-signed-url-for-team-storage").GenerateSignedUrlAbortReason; | ||
httpStatus?: number; | ||
success: false; | ||
}>; | ||
@@ -25,0 +29,0 @@ pollCiGreenlightStatus: (args_0: import("./domain/poll-ci-greenlight").PollCiGreenlightParams) => Promise<import("./domain/poll-ci-greenlight").PollCiGreenlightStatus>; |
@@ -22,4 +22,8 @@ import { type CiGreenlightStatusBase } from "../lib/api/ci-greenlight"; | ||
playgroundFileLocation?: string; | ||
success: boolean; | ||
success: true; | ||
uploadUrl?: string; | ||
} | { | ||
abortReason: import("../lib/sdk/domain/generate-signed-url-for-team-storage").GenerateSignedUrlAbortReason; | ||
httpStatus?: number; | ||
success: false; | ||
}>; | ||
@@ -26,0 +30,0 @@ pollCiGreenlightStatus: (args_0: import("../lib/sdk/index").PollCiGreenlightParams) => Promise<import("../lib/sdk/index").PollCiGreenlightStatus>; |
@@ -7,3 +7,5 @@ import { type ApiConfig } from "../api-types"; | ||
export type GenerateSignedUrlForTeamStorageResponse = { | ||
errorMessage?: string; | ||
fileLocation?: string; | ||
httpStatus: number; | ||
playgroundFileLocation?: string; | ||
@@ -10,0 +12,0 @@ signedUrl?: string; |
@@ -14,2 +14,3 @@ export async function callGenerateSignedUrlForTempTeamStorage({ apiKey, serviceBase }, { destinationFilePath }, { fetch: localFetch }) { | ||
fileLocation: json.fileLocation, | ||
httpStatus: response.status, | ||
playgroundFileLocation: json.playgroundFileLocation, | ||
@@ -20,12 +21,12 @@ signedUrl: json.signedUrl, | ||
} | ||
else { | ||
const error = await response.text(); | ||
console.log(`ERROR: ${error}`); | ||
return { | ||
success: false, | ||
}; | ||
} | ||
return { | ||
errorMessage: await response.text(), | ||
httpStatus: response.status, | ||
success: false, | ||
}; | ||
} | ||
catch (e) { | ||
return { | ||
errorMessage: "Network error, aborting request to generate signed URL", | ||
httpStatus: 0, | ||
success: false, | ||
@@ -32,0 +33,0 @@ }; |
@@ -7,7 +7,12 @@ import { type GenerateSignedUrlForTeamStorageConfig } from "../../api/generate-signed-url-for-team-storage"; | ||
playgroundFileLocation?: string; | ||
success: boolean; | ||
success: true; | ||
uploadUrl?: string; | ||
} | { | ||
abortReason: GenerateSignedUrlAbortReason; | ||
httpStatus?: number; | ||
success: false; | ||
}; | ||
export type GenerateSignedUrlAbortReason = "client-network-error" | "sdk-argument-validation-failed" | "400-invalid-request" | "401-invalid-credentials" | "403-forbidden" | "5XX-server-error" | "XXX-other-http-code"; | ||
export declare function generateSignedUrlForTempTeamStorage(deps: SdkDependencies, apiConfig: ApiConfig, config: GenerateSignedUrlForTeamStorageConfig): Promise<GenerateSignedUrlStatus>; | ||
export {}; | ||
//# sourceMappingURL=generate-signed-url-for-team-storage.d.ts.map |
@@ -6,8 +6,34 @@ import { callGenerateSignedUrlForTempTeamStorage, } from "../../api/generate-signed-url-for-team-storage"; | ||
log.error(`🚫 destinationFilePath is a required config parameter`); | ||
return { success: false }; | ||
return { | ||
abortReason: "sdk-argument-validation-failed", | ||
success: false, | ||
}; | ||
} | ||
const responseState = await callGenerateSignedUrlForTempTeamStorage(apiConfig, config, deps); | ||
if (!responseState.success) { | ||
log.error(`🚫 Failed to generate signed URL for team storage. Please contact support.`); | ||
return { success: false }; | ||
let abortReason = "XXX-other-http-code"; | ||
if (responseState.httpStatus >= 500) { | ||
abortReason = "5XX-server-error"; | ||
log.error(`🚫 Unrecoverable error (status ${responseState.httpStatus}) when generating signed upload url: aborting.`); | ||
} | ||
else { | ||
if (responseState.httpStatus === 400) { | ||
abortReason = "400-invalid-request"; | ||
} | ||
else if (responseState.httpStatus === 401) { | ||
abortReason = "401-invalid-credentials"; | ||
} | ||
else if (responseState.httpStatus === 403) { | ||
abortReason = "403-forbidden"; | ||
} | ||
else if (responseState.httpStatus === 0) { | ||
abortReason = "client-network-error"; | ||
} | ||
log.error(`🚫 Unrecoverable error (status ${responseState.httpStatus}) when generating signed upload url: ${responseState.errorMessage ? `${responseState.errorMessage}.` : ""} aborting.`); | ||
} | ||
return { | ||
abortReason, | ||
httpStatus: responseState.httpStatus, | ||
success: false, | ||
}; | ||
} | ||
@@ -14,0 +40,0 @@ log.info(`✅ Generated Signed Upload URL: ${responseState.signedUrl}.`); |
@@ -21,4 +21,8 @@ import { type SdkDependencies } from "./dependencies"; | ||
playgroundFileLocation?: string; | ||
success: boolean; | ||
success: true; | ||
uploadUrl?: string; | ||
} | { | ||
abortReason: import("./domain/generate-signed-url-for-team-storage").GenerateSignedUrlAbortReason; | ||
httpStatus?: number; | ||
success: false; | ||
}>; | ||
@@ -25,0 +29,0 @@ pollCiGreenlightStatus: (args_0: import("./domain/poll-ci-greenlight").PollCiGreenlightParams) => Promise<import("./domain/poll-ci-greenlight").PollCiGreenlightStatus>; |
@@ -22,4 +22,8 @@ import { type CiGreenlightStatusBase } from "../lib/api/ci-greenlight"; | ||
playgroundFileLocation?: string; | ||
success: boolean; | ||
success: true; | ||
uploadUrl?: string; | ||
} | { | ||
abortReason: import("../lib/sdk/domain/generate-signed-url-for-team-storage").GenerateSignedUrlAbortReason; | ||
httpStatus?: number; | ||
success: false; | ||
}>; | ||
@@ -26,0 +30,0 @@ pollCiGreenlightStatus: (args_0: import("../lib/sdk/index").PollCiGreenlightParams) => Promise<import("../lib/sdk/index").PollCiGreenlightStatus>; |
@@ -7,3 +7,5 @@ import { type ApiConfig } from "../api-types"; | ||
export type GenerateSignedUrlForTeamStorageResponse = { | ||
errorMessage?: string; | ||
fileLocation?: string; | ||
httpStatus: number; | ||
playgroundFileLocation?: string; | ||
@@ -10,0 +12,0 @@ signedUrl?: string; |
@@ -7,7 +7,12 @@ import { type GenerateSignedUrlForTeamStorageConfig } from "../../api/generate-signed-url-for-team-storage"; | ||
playgroundFileLocation?: string; | ||
success: boolean; | ||
success: true; | ||
uploadUrl?: string; | ||
} | { | ||
abortReason: GenerateSignedUrlAbortReason; | ||
httpStatus?: number; | ||
success: false; | ||
}; | ||
export type GenerateSignedUrlAbortReason = "client-network-error" | "sdk-argument-validation-failed" | "400-invalid-request" | "401-invalid-credentials" | "403-forbidden" | "5XX-server-error" | "XXX-other-http-code"; | ||
export declare function generateSignedUrlForTempTeamStorage(deps: SdkDependencies, apiConfig: ApiConfig, config: GenerateSignedUrlForTeamStorageConfig): Promise<GenerateSignedUrlStatus>; | ||
export {}; | ||
//# sourceMappingURL=generate-signed-url-for-team-storage.d.ts.map |
@@ -21,4 +21,8 @@ import { type SdkDependencies } from "./dependencies"; | ||
playgroundFileLocation?: string; | ||
success: boolean; | ||
success: true; | ||
uploadUrl?: string; | ||
} | { | ||
abortReason: import("./domain/generate-signed-url-for-team-storage").GenerateSignedUrlAbortReason; | ||
httpStatus?: number; | ||
success: false; | ||
}>; | ||
@@ -25,0 +29,0 @@ pollCiGreenlightStatus: (args_0: import("./domain/poll-ci-greenlight").PollCiGreenlightParams) => Promise<import("./domain/poll-ci-greenlight").PollCiGreenlightStatus>; |
@@ -22,4 +22,8 @@ import { type CiGreenlightStatusBase } from "../lib/api/ci-greenlight"; | ||
playgroundFileLocation?: string; | ||
success: boolean; | ||
success: true; | ||
uploadUrl?: string; | ||
} | { | ||
abortReason: import("../lib/sdk/domain/generate-signed-url-for-team-storage").GenerateSignedUrlAbortReason; | ||
httpStatus?: number; | ||
success: false; | ||
}>; | ||
@@ -26,0 +30,0 @@ pollCiGreenlightStatus: (args_0: import("../lib/sdk/index").PollCiGreenlightParams) => Promise<import("../lib/sdk/index").PollCiGreenlightStatus>; |
{ | ||
"name": "@qawolf/ci-sdk", | ||
"version": "0.17.0", | ||
"version": "0.17.1", | ||
"description": "A simple SDK for interacting with QAWolf in CI scripts.", | ||
@@ -16,4 +16,4 @@ "type": "commonjs", | ||
"build": "./scripts/build.sh", | ||
"lint": "eslint . --ext js,jsx,mjs,ts,tsx --max-warnings=0 && prettier --check .", | ||
"lint:fix": "eslint . --ext js,jsx,mjs,ts,tsx --fix --max-warnings=0 && prettier --write .", | ||
"lint": "eslint . --ext js,jsx,mjs,ts,tsx --quiet && prettier --check .", | ||
"lint:fix": "eslint . --ext js,jsx,mjs,ts,tsx --fix --quiet && prettier --log-level=warn --write .", | ||
"test": "jest", | ||
@@ -20,0 +20,0 @@ "prepublishOnly": "nx run ci-sdk:build", |
@@ -379,2 +379,6 @@ # QAWolf CI SDK | ||
## v0.17.1 | ||
- Add detailed feedback when generateSignedUrlForTempTeamStorage fails. | ||
## v0.17.0 | ||
@@ -381,0 +385,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
441621
5842
482