@qawolf/ci-sdk 3.5.1 → 3.6.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.
- package/README.md +57 -13
- package/dist/index.js +300 -21
- package/dist/index.js.map +4 -4
- package/dist/lib/sdk/domain/collectChanges/gitDriver.d.ts +3 -0
- package/dist/lib/sdk/domain/collectChanges/index.d.ts +11 -0
- package/dist/lib/sdk/domain/collectChanges/parseLog.d.ts +12 -0
- package/dist/lib/sdk/domain/collectChanges/summarizeCommits.d.ts +19 -0
- package/dist/lib/sdk/domain/collectChanges/types.d.ts +41 -0
- package/dist/lib/sdk/domain/uploadBuild/types.d.ts +2 -2
- package/dist/lib/sdk/domain/waitForVerdict/testHarness.d.ts +6 -2
- package/dist/lib/sdk/domain/waitForVerdict/waitingForAnswer.d.ts +10 -0
- package/dist/lib/sdk/index.d.ts +37 -1
- package/dist/tests/test-lib.d.ts +26 -0
- package/package.json +3 -3
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CollectChangesParams, CollectChangesResult, GitDriver } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Builds the `changes` summary of what landed after `since` up to HEAD from
|
|
4
|
+
* the local git history, for `deployment.reportStatus`. Each commit on the
|
|
5
|
+
* first-parent line becomes one change: a merged pull request when its
|
|
6
|
+
* message says so, otherwise a commit. It reads commit messages and, when
|
|
7
|
+
* asked, changed file paths; never diffs or file contents. It returns the
|
|
8
|
+
* summary instead of sending it, so it can be checked or edited first, and
|
|
9
|
+
* refuses a shallow clone rather than send part of a range.
|
|
10
|
+
*/
|
|
11
|
+
export declare function collectChanges(git: GitDriver, { cwd, include, releaseNotes, since, }: CollectChangesParams): Promise<CollectChangesResult>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Commit } from "./summarizeCommits.js";
|
|
2
|
+
/**
|
|
3
|
+
* The `git log --format` that `parseLog` reads: the hash, subject and body,
|
|
4
|
+
* each ending in a NUL, which commit text and paths can't hold.
|
|
5
|
+
*/
|
|
6
|
+
export declare const logFormat = "%H%x00%s%x00%b%x00";
|
|
7
|
+
/**
|
|
8
|
+
* Reads `git log -z` output in `logFormat`. With `--name-only`, each
|
|
9
|
+
* record's changed paths follow, each ending in a NUL, so paths come through
|
|
10
|
+
* unquoted.
|
|
11
|
+
*/
|
|
12
|
+
export declare function parseLog(stdout: string): Commit[];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { DeploymentChanges } from "./types.js";
|
|
2
|
+
export declare const maxItems = 250;
|
|
3
|
+
export type Commit = {
|
|
4
|
+
body: string;
|
|
5
|
+
paths: string[];
|
|
6
|
+
subject: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* The changes summary of a range's commits, newest first, within the API's
|
|
10
|
+
* limits. `commits` may be the newest part of a range of `totalCount`; every
|
|
11
|
+
* change left out, there or to fit, is counted in `omittedCount`.
|
|
12
|
+
*/
|
|
13
|
+
export declare function summarizeCommits({ commits, includeDescriptions, includePaths, releaseNotes, totalCount, }: {
|
|
14
|
+
commits: Commit[];
|
|
15
|
+
includeDescriptions: boolean;
|
|
16
|
+
includePaths: boolean;
|
|
17
|
+
releaseNotes: string | undefined;
|
|
18
|
+
totalCount: number;
|
|
19
|
+
}): DeploymentChanges;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { ReportDeploymentParams } from "../reportDeployment/types.js";
|
|
2
|
+
/** Runs `git` with these arguments in `cwd`, without a shell. */
|
|
3
|
+
export type GitDriver = (args: string[], cwd: string) => Promise<{
|
|
4
|
+
ok: true;
|
|
5
|
+
stdout: string;
|
|
6
|
+
} | {
|
|
7
|
+
ok: false;
|
|
8
|
+
stderr: string;
|
|
9
|
+
}>;
|
|
10
|
+
/** What `collectChanges` may read and send. Code and diffs are never read. */
|
|
11
|
+
export type CollectedChangeLevel = "descriptions" | "paths" | "titles";
|
|
12
|
+
export type CollectChangesParams = {
|
|
13
|
+
/** The repository to read; the current directory when unset. */
|
|
14
|
+
cwd?: string;
|
|
15
|
+
/** What to send for each change: its title by default, and optionally its description and changed paths. */
|
|
16
|
+
include?: CollectedChangeLevel[];
|
|
17
|
+
/** Notes written for the release, sent as they are. */
|
|
18
|
+
releaseNotes?: string;
|
|
19
|
+
/** The commit the environment ran before, e.g. the previous release tag. */
|
|
20
|
+
since: string;
|
|
21
|
+
};
|
|
22
|
+
export type DeploymentChanges = NonNullable<ReportDeploymentParams["changes"]>;
|
|
23
|
+
export type CollectChangesResult = {
|
|
24
|
+
changes: DeploymentChanges;
|
|
25
|
+
outcome: "collected";
|
|
26
|
+
}
|
|
27
|
+
/** The clone is shallow, so it may not hold the whole range. */
|
|
28
|
+
| {
|
|
29
|
+
fix: string;
|
|
30
|
+
outcome: "history-unavailable";
|
|
31
|
+
}
|
|
32
|
+
/** `since` names no commit in this repository, e.g. a typo or a tag that wasn't fetched. */
|
|
33
|
+
| {
|
|
34
|
+
fix: string;
|
|
35
|
+
outcome: "since-not-found";
|
|
36
|
+
}
|
|
37
|
+
/** Git failed for another reason. */
|
|
38
|
+
| {
|
|
39
|
+
message: string;
|
|
40
|
+
outcome: "git-failed";
|
|
41
|
+
};
|
|
@@ -14,7 +14,7 @@ export type UploadBuildParams = {
|
|
|
14
14
|
* runs created with it install.
|
|
15
15
|
*/
|
|
16
16
|
environment?: CreateBuildInput["environment"];
|
|
17
|
-
/** Path of the `.apk`, `.aab` or `.ipa` file to upload, at most
|
|
17
|
+
/** Path of the `.apk`, `.aab` or `.ipa` file to upload, at most 1 GB by default. */
|
|
18
18
|
filePath: string;
|
|
19
19
|
/**
|
|
20
20
|
* The workspace to upload into. Required when authenticating with an
|
|
@@ -49,7 +49,7 @@ export type UploadBuildResult = {
|
|
|
49
49
|
}
|
|
50
50
|
/**
|
|
51
51
|
* QA Wolf refused to sign the upload. `invalid-request` covers a file that
|
|
52
|
-
* is not an `.apk`, `.aab` or `.ipa`, or is larger than
|
|
52
|
+
* is not an `.apk`, `.aab` or `.ipa`, or is larger than the workspace's limit, 1 GB by default.
|
|
53
53
|
*/
|
|
54
54
|
| (PublicApiFailureResult & {
|
|
55
55
|
failedStep: "request-upload";
|
|
@@ -26,8 +26,10 @@ export declare function unmatchedTrigger(reason: string, triggerName?: string):
|
|
|
26
26
|
outcome: string;
|
|
27
27
|
};
|
|
28
28
|
};
|
|
29
|
-
export declare function runPayload({ blockingBugCount, runId, status, }: {
|
|
29
|
+
export declare function runPayload({ blockingBugCount, flows, needsReview, runId, status, }: {
|
|
30
30
|
blockingBugCount?: number;
|
|
31
|
+
flows?: unknown[];
|
|
32
|
+
needsReview?: boolean;
|
|
31
33
|
runId?: string;
|
|
32
34
|
status: string;
|
|
33
35
|
}): Record<string, unknown>;
|
|
@@ -39,13 +41,15 @@ export declare function runPayload({ blockingBugCount, runId, status, }: {
|
|
|
39
41
|
* every run, or a queue per requested run id when a test needs to tell two
|
|
40
42
|
* runs apart.
|
|
41
43
|
*/
|
|
42
|
-
export declare function makeHarness({ evaluations, runs, }: {
|
|
44
|
+
export declare function makeHarness({ evaluations, investigations, runs, }: {
|
|
43
45
|
evaluations?: Reply[];
|
|
46
|
+
investigations?: Reply[];
|
|
44
47
|
runs?: Record<string, Reply[]> | Reply[];
|
|
45
48
|
}): {
|
|
46
49
|
apiConfig: ApiConfig;
|
|
47
50
|
calls: {
|
|
48
51
|
evaluations: number;
|
|
52
|
+
investigations: number;
|
|
49
53
|
runs: number;
|
|
50
54
|
};
|
|
51
55
|
deps: SdkDependencies;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { z } from "zod";
|
|
2
|
+
import { publicContractsV1 } from "@qawolf/api-contracts";
|
|
3
|
+
import type { PublicApiCallResult } from "../../publicApi/callContract.js";
|
|
4
|
+
import type { WaitContext } from "./types.js";
|
|
5
|
+
type RunReading = z.output<typeof publicContractsV1.run.get.output>;
|
|
6
|
+
export declare function requestRunIdsWaitingForAnswer({ ctx, runs, }: {
|
|
7
|
+
ctx: WaitContext;
|
|
8
|
+
runs: RunReading[];
|
|
9
|
+
}): Promise<PublicApiCallResult<Set<string>>>;
|
|
10
|
+
export {};
|
package/dist/lib/sdk/index.d.ts
CHANGED
|
@@ -1,20 +1,36 @@
|
|
|
1
1
|
import type { SdkDependencies } from "./dependencies.js";
|
|
2
|
+
import type { GitDriver } from "./domain/collectChanges/types.js";
|
|
2
3
|
export declare function makeQaWolfSdk({ apiKey, serviceBase, userAgent, }: {
|
|
3
4
|
apiKey: string;
|
|
4
5
|
serviceBase?: string;
|
|
5
6
|
userAgent?: string;
|
|
6
|
-
}, { clock, fetch, log, }?: Partial<SdkDependencies
|
|
7
|
+
}, { clock, fetch, git, log, }?: Partial<SdkDependencies & {
|
|
8
|
+
git: GitDriver;
|
|
9
|
+
}>): {
|
|
7
10
|
/**
|
|
8
11
|
* @deprecated Reports through the legacy `deploy_success` webhook, which
|
|
9
12
|
* triggers do not see. Use `deployment.reportStatus` instead.
|
|
10
13
|
*/
|
|
11
14
|
attemptNotifyDeploy: (config: Partial<import("./domain/attemptDeploy/deployConfig.js").DeployConfig>) => Promise<import("./domain/attemptDeploy/types.js").NotifyDeployStatus>;
|
|
12
15
|
deployment: {
|
|
16
|
+
/** Builds `changes` for `reportStatus` from the local git history; sends nothing itself. */
|
|
17
|
+
collectChanges: (args_0: import("./domain/collectChanges/types.js").CollectChangesParams) => Promise<import("./domain/collectChanges/types.js").CollectChangesResult>;
|
|
13
18
|
reportStatus: (params: {
|
|
14
19
|
providerDeploymentId: string;
|
|
15
20
|
status: "success" | "pending" | "failure" | "inactive";
|
|
16
21
|
workspaceId: string;
|
|
17
22
|
builds?: string[] | undefined;
|
|
23
|
+
changes?: {
|
|
24
|
+
items?: {
|
|
25
|
+
kind: "pull-request" | "commit";
|
|
26
|
+
title: string;
|
|
27
|
+
changedPaths?: string[] | undefined;
|
|
28
|
+
description?: string | undefined;
|
|
29
|
+
url?: string | undefined;
|
|
30
|
+
}[] | undefined;
|
|
31
|
+
omittedCount?: number | undefined;
|
|
32
|
+
releaseNotes?: string | undefined;
|
|
33
|
+
} | undefined;
|
|
18
34
|
deployTarget?: string | undefined;
|
|
19
35
|
environment?: {
|
|
20
36
|
id: string;
|
|
@@ -105,6 +121,20 @@ export declare function makeQaWolfSdk({ apiKey, serviceBase, userAgent, }: {
|
|
|
105
121
|
runId: string;
|
|
106
122
|
url: string;
|
|
107
123
|
};
|
|
124
|
+
} | {
|
|
125
|
+
deploymentId: string;
|
|
126
|
+
outcome: "needs-review";
|
|
127
|
+
runs: {
|
|
128
|
+
blockingBugCount: number;
|
|
129
|
+
runId: string;
|
|
130
|
+
runUrl: string;
|
|
131
|
+
status: "canceled" | "failed" | "running" | "passed" | "superseded" | "queued";
|
|
132
|
+
triggerName: string;
|
|
133
|
+
supersededBy?: {
|
|
134
|
+
runId: string;
|
|
135
|
+
url: string;
|
|
136
|
+
} | undefined;
|
|
137
|
+
}[];
|
|
108
138
|
} | {
|
|
109
139
|
deploymentId: string;
|
|
110
140
|
elapsedMs: number;
|
|
@@ -177,6 +207,11 @@ export declare function makeQaWolfSdk({ apiKey, serviceBase, userAgent, }: {
|
|
|
177
207
|
workspaceId?: string | undefined;
|
|
178
208
|
}) => Promise<import("./domain/environment/types.js").TerminateEnvironmentResult>;
|
|
179
209
|
};
|
|
210
|
+
/**
|
|
211
|
+
* Deprecated for Android and iOS builds: use `uploadBuild`, whose runs
|
|
212
|
+
* record which build they tested. Still the way to upload Windows and
|
|
213
|
+
* Linux app files.
|
|
214
|
+
*/
|
|
180
215
|
generateSignedUrlForRunInputsExecutablesStorage: (config: import("./domain/generateSignedUrls/types.js").GenerateSignedUrlConfig) => Promise<import("./domain/generateSignedUrls/types.js").GenerateSignedUrlStatus>;
|
|
181
216
|
generateSignedUrlForTempTeamStorage: (config: import("./domain/generateSignedUrls/types.js").GenerateSignedUrlConfig) => Promise<{
|
|
182
217
|
fileLocation?: string;
|
|
@@ -211,6 +246,7 @@ export declare function makeQaWolfSdk({ apiKey, serviceBase, userAgent, }: {
|
|
|
211
246
|
uploadBuild: (args_0: import("./domain/uploadBuild/types.js").UploadBuildParams) => Promise<import("./domain/uploadBuild/types.js").UploadBuildResult>;
|
|
212
247
|
};
|
|
213
248
|
export type * from "./domain/attemptDeploy/index.js";
|
|
249
|
+
export type * from "./domain/collectChanges/types.js";
|
|
214
250
|
export type * from "./domain/environment/types.js";
|
|
215
251
|
export type * from "./domain/generateSignedUrls/types.js";
|
|
216
252
|
export type * from "./domain/notifyTerminatedEphemeralEnvironment/types.js";
|
package/dist/tests/test-lib.d.ts
CHANGED
|
@@ -9,11 +9,23 @@ export declare function makeQaWolfSdkForTest({ apiKey }: {
|
|
|
9
9
|
sdk: {
|
|
10
10
|
attemptNotifyDeploy: (config: Partial<import("../index.js").DeployConfig>) => Promise<import("../index.js").NotifyDeployStatus>;
|
|
11
11
|
deployment: {
|
|
12
|
+
collectChanges: (args_0: import("../lib/sdk/index.js").CollectChangesParams) => Promise<import("../lib/sdk/index.js").CollectChangesResult>;
|
|
12
13
|
reportStatus: (params: {
|
|
13
14
|
providerDeploymentId: string;
|
|
14
15
|
status: "success" | "pending" | "failure" | "inactive";
|
|
15
16
|
workspaceId: string;
|
|
16
17
|
builds?: string[] | undefined;
|
|
18
|
+
changes?: {
|
|
19
|
+
items?: {
|
|
20
|
+
kind: "pull-request" | "commit";
|
|
21
|
+
title: string;
|
|
22
|
+
changedPaths?: string[] | undefined;
|
|
23
|
+
description?: string | undefined;
|
|
24
|
+
url?: string | undefined;
|
|
25
|
+
}[] | undefined;
|
|
26
|
+
omittedCount?: number | undefined;
|
|
27
|
+
releaseNotes?: string | undefined;
|
|
28
|
+
} | undefined;
|
|
17
29
|
deployTarget?: string | undefined;
|
|
18
30
|
environment?: {
|
|
19
31
|
id: string;
|
|
@@ -104,6 +116,20 @@ export declare function makeQaWolfSdkForTest({ apiKey }: {
|
|
|
104
116
|
runId: string;
|
|
105
117
|
url: string;
|
|
106
118
|
};
|
|
119
|
+
} | {
|
|
120
|
+
deploymentId: string;
|
|
121
|
+
outcome: "needs-review";
|
|
122
|
+
runs: {
|
|
123
|
+
blockingBugCount: number;
|
|
124
|
+
runId: string;
|
|
125
|
+
runUrl: string;
|
|
126
|
+
status: "canceled" | "failed" | "running" | "passed" | "superseded" | "queued";
|
|
127
|
+
triggerName: string;
|
|
128
|
+
supersededBy?: {
|
|
129
|
+
runId: string;
|
|
130
|
+
url: string;
|
|
131
|
+
} | undefined;
|
|
132
|
+
}[];
|
|
107
133
|
} | {
|
|
108
134
|
deploymentId: string;
|
|
109
135
|
elapsedMs: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qawolf/ci-sdk",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A simple SDK for interacting with QAWolf in CI scripts.",
|
|
6
6
|
"keywords": [],
|
|
@@ -34,12 +34,12 @@
|
|
|
34
34
|
"tsc:check": "tsc --noEmit"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@qawolf/api-contracts": ">=0.
|
|
37
|
+
"@qawolf/api-contracts": ">=0.108.0",
|
|
38
38
|
"@qawolf/ci-utils": "^2.0.0",
|
|
39
39
|
"@sinonjs/fake-timers": "^10.3.0",
|
|
40
40
|
"superjson": "^2.2.6",
|
|
41
41
|
"tslib": "^2.6.2",
|
|
42
|
-
"zod": "^4.
|
|
42
|
+
"zod": "^4.6.6"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@qawolf/platform-builder": "^1.2.7",
|