@qawolf/ci-sdk
Advanced tools
Comparing version 0.16.0 to 0.17.0
export * from "./ci-greenlight.js"; | ||
export * from "./deploy.js"; | ||
export * from "./generate-signed-url-for-team-storage.js"; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -6,2 +6,3 @@ "use strict"; | ||
tslib_1.__exportStar(require("./deploy.js"), exports); | ||
tslib_1.__exportStar(require("./generate-signed-url-for-team-storage.js"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -18,2 +18,8 @@ import { type SdkDependencies } from "./dependencies"; | ||
experimental_vcsBranchTesting: import("./domain/vcsBranchTesting").VCSBranchTestingSDK; | ||
generateSignedUrlForTempTeamStorage: (config: import("../api").GenerateSignedUrlForTeamStorageConfig) => Promise<{ | ||
fileLocation?: string; | ||
playgroundFileLocation?: string; | ||
success: boolean; | ||
uploadUrl?: string; | ||
}>; | ||
pollCiGreenlightStatus: (args_0: import("./domain/poll-ci-greenlight").PollCiGreenlightParams) => Promise<import("./domain/poll-ci-greenlight").PollCiGreenlightStatus>; | ||
@@ -20,0 +26,0 @@ }; |
@@ -10,2 +10,3 @@ "use strict"; | ||
const attempt_deploy_1 = require("./domain/attempt-deploy"); | ||
const generate_signed_url_for_team_storage_1 = require("./domain/generate-signed-url-for-team-storage"); | ||
const index_1 = require("./domain/legacy_previewTesting/index"); | ||
@@ -36,2 +37,3 @@ const poll_ci_greenlight_1 = require("./domain/poll-ci-greenlight"); | ||
experimental_vcsBranchTesting: (0, vcsBranchTesting_1.makeVCSBranchTestingSDK)(apiConfig, deps), | ||
generateSignedUrlForTempTeamStorage: generate_signed_url_for_team_storage_1.generateSignedUrlForTempTeamStorage.bind(null, deps, apiConfig), | ||
pollCiGreenlightStatus: poll_ci_greenlight_1.pollCiGreenlightStatus.bind(null, deps, apiConfig), | ||
@@ -38,0 +40,0 @@ }; |
@@ -19,2 +19,8 @@ import { type CiGreenlightStatusBase } from "../lib/api/ci-greenlight"; | ||
experimental_vcsBranchTesting: import("../lib/sdk/index").VCSBranchTestingSDK; | ||
generateSignedUrlForTempTeamStorage: (config: import("../lib/api").GenerateSignedUrlForTeamStorageConfig) => Promise<{ | ||
fileLocation?: string; | ||
playgroundFileLocation?: string; | ||
success: boolean; | ||
uploadUrl?: string; | ||
}>; | ||
pollCiGreenlightStatus: (args_0: import("../lib/sdk/index").PollCiGreenlightParams) => Promise<import("../lib/sdk/index").PollCiGreenlightStatus>; | ||
@@ -21,0 +27,0 @@ }; |
export * from "./ci-greenlight.js"; | ||
export * from "./deploy.js"; | ||
export * from "./generate-signed-url-for-team-storage.js"; | ||
//# sourceMappingURL=index.d.ts.map |
export * from "./ci-greenlight.js"; | ||
export * from "./deploy.js"; | ||
export * from "./generate-signed-url-for-team-storage.js"; | ||
//# sourceMappingURL=index.js.map |
@@ -18,2 +18,8 @@ import { type SdkDependencies } from "./dependencies"; | ||
experimental_vcsBranchTesting: import("./domain/vcsBranchTesting").VCSBranchTestingSDK; | ||
generateSignedUrlForTempTeamStorage: (config: import("../api").GenerateSignedUrlForTeamStorageConfig) => Promise<{ | ||
fileLocation?: string; | ||
playgroundFileLocation?: string; | ||
success: boolean; | ||
uploadUrl?: string; | ||
}>; | ||
pollCiGreenlightStatus: (args_0: import("./domain/poll-ci-greenlight").PollCiGreenlightParams) => Promise<import("./domain/poll-ci-greenlight").PollCiGreenlightStatus>; | ||
@@ -20,0 +26,0 @@ }; |
@@ -6,2 +6,3 @@ import { buildFetchWithTimeout } from "../utils"; | ||
import { attemptNotifyDeploy } from "./domain/attempt-deploy"; | ||
import { generateSignedUrlForTempTeamStorage } from "./domain/generate-signed-url-for-team-storage"; | ||
import { removeEnvironment, testPreview, } from "./domain/legacy_previewTesting/index"; | ||
@@ -32,2 +33,3 @@ import { pollCiGreenlightStatus } from "./domain/poll-ci-greenlight"; | ||
experimental_vcsBranchTesting: makeVCSBranchTestingSDK(apiConfig, deps), | ||
generateSignedUrlForTempTeamStorage: generateSignedUrlForTempTeamStorage.bind(null, deps, apiConfig), | ||
pollCiGreenlightStatus: pollCiGreenlightStatus.bind(null, deps, apiConfig), | ||
@@ -34,0 +36,0 @@ }; |
@@ -19,2 +19,8 @@ import { type CiGreenlightStatusBase } from "../lib/api/ci-greenlight"; | ||
experimental_vcsBranchTesting: import("../lib/sdk/index").VCSBranchTestingSDK; | ||
generateSignedUrlForTempTeamStorage: (config: import("../lib/api").GenerateSignedUrlForTeamStorageConfig) => Promise<{ | ||
fileLocation?: string; | ||
playgroundFileLocation?: string; | ||
success: boolean; | ||
uploadUrl?: string; | ||
}>; | ||
pollCiGreenlightStatus: (args_0: import("../lib/sdk/index").PollCiGreenlightParams) => Promise<import("../lib/sdk/index").PollCiGreenlightStatus>; | ||
@@ -21,0 +27,0 @@ }; |
export * from "./ci-greenlight.js"; | ||
export * from "./deploy.js"; | ||
export * from "./generate-signed-url-for-team-storage.js"; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -18,2 +18,8 @@ import { type SdkDependencies } from "./dependencies"; | ||
experimental_vcsBranchTesting: import("./domain/vcsBranchTesting").VCSBranchTestingSDK; | ||
generateSignedUrlForTempTeamStorage: (config: import("../api").GenerateSignedUrlForTeamStorageConfig) => Promise<{ | ||
fileLocation?: string; | ||
playgroundFileLocation?: string; | ||
success: boolean; | ||
uploadUrl?: string; | ||
}>; | ||
pollCiGreenlightStatus: (args_0: import("./domain/poll-ci-greenlight").PollCiGreenlightParams) => Promise<import("./domain/poll-ci-greenlight").PollCiGreenlightStatus>; | ||
@@ -20,0 +26,0 @@ }; |
@@ -19,2 +19,8 @@ import { type CiGreenlightStatusBase } from "../lib/api/ci-greenlight"; | ||
experimental_vcsBranchTesting: import("../lib/sdk/index").VCSBranchTestingSDK; | ||
generateSignedUrlForTempTeamStorage: (config: import("../lib/api").GenerateSignedUrlForTeamStorageConfig) => Promise<{ | ||
fileLocation?: string; | ||
playgroundFileLocation?: string; | ||
success: boolean; | ||
uploadUrl?: string; | ||
}>; | ||
pollCiGreenlightStatus: (args_0: import("../lib/sdk/index").PollCiGreenlightParams) => Promise<import("../lib/sdk/index").PollCiGreenlightStatus>; | ||
@@ -21,0 +27,0 @@ }; |
{ | ||
"name": "@qawolf/ci-sdk", | ||
"version": "0.16.0", | ||
"version": "0.17.0", | ||
"description": "A simple SDK for interacting with QAWolf in CI scripts.", | ||
@@ -5,0 +5,0 @@ "type": "commonjs", |
@@ -88,2 +88,76 @@ # QAWolf CI SDK | ||
## Example: Upload Run Input Artifacts | ||
```ts | ||
import { type DeployConfig, makeQaWolfSdk } from "@qawolf/ci-sdk"; | ||
import fs from "fs/promises"; | ||
import path from "path"; | ||
const { generateSignedUrlForTempTeamStorage, attemptNotifyDeploy } = | ||
makeQaWolfSdk({ | ||
apiKey: "qawolf_xxxxx", | ||
}); | ||
(async () => { | ||
const playgroundFileLocation = await uploadRunArtifact(""); | ||
if (playgroundFileLocation) { | ||
const deployConfig: DeployConfig = { | ||
branch: undefined, | ||
commitUrl: undefined, | ||
deduplicationKey: undefined, | ||
deploymentType: undefined, | ||
deploymentUrl: undefined, | ||
hostingService: undefined, | ||
sha: undefined, | ||
variables: { | ||
RUN_INPUT_PATH: playgroundFileLocation, | ||
}, | ||
}; | ||
const result = await attemptNotifyDeploy(deployConfig); | ||
if (result.outcome !== "success") { | ||
// Fail the job. | ||
process.exit(1); | ||
} | ||
const runId = result.runId; | ||
} | ||
})(); | ||
async function uploadRunArtifact(filePath: string): Promise<string> { | ||
const fileName = path.basename(filePath); | ||
const signedUrlResponse = await generateSignedUrlForTempTeamStorage({ | ||
destinationFilePath: fileName, | ||
}); | ||
if ( | ||
signedUrlResponse?.success && | ||
signedUrlResponse.playgroundFileLocation && | ||
signedUrlResponse.uploadUrl | ||
) { | ||
const fileBuffer = await fs.readFile(filePath); | ||
const url = signedUrlResponse.uploadUrl; | ||
try { | ||
const response = await fetch(url, { | ||
method: "PUT", | ||
body: fileBuffer, | ||
headers: { | ||
"Content-Type": "application/octet-stream", | ||
}, | ||
}); | ||
if (!response.ok) { | ||
return ""; | ||
} | ||
} catch (error) { | ||
return ""; | ||
} | ||
return signedUrlResponse.playgroundFileLocation; | ||
} | ||
return ""; | ||
} | ||
``` | ||
<a name="vcs-branch-testing"></a> | ||
@@ -306,2 +380,6 @@ | ||
## v0.17.0 | ||
- Add generateSignedUrlForTempTeamStorage function to be used in customer's CI pipeline. | ||
## v0.16.0 | ||
@@ -308,0 +386,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
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
434689
414
5743
478
16