@qawolf/ci-sdk 3.6.0 → 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 +49 -13
- package/dist/index.js +196 -2
- package/dist/index.js.map +3 -3
- 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/index.d.ts +23 -1
- package/dist/tests/test-lib.d.ts +12 -0
- package/package.json +2 -2
|
@@ -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";
|
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;
|
|
@@ -191,6 +207,11 @@ export declare function makeQaWolfSdk({ apiKey, serviceBase, userAgent, }: {
|
|
|
191
207
|
workspaceId?: string | undefined;
|
|
192
208
|
}) => Promise<import("./domain/environment/types.js").TerminateEnvironmentResult>;
|
|
193
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
|
+
*/
|
|
194
215
|
generateSignedUrlForRunInputsExecutablesStorage: (config: import("./domain/generateSignedUrls/types.js").GenerateSignedUrlConfig) => Promise<import("./domain/generateSignedUrls/types.js").GenerateSignedUrlStatus>;
|
|
195
216
|
generateSignedUrlForTempTeamStorage: (config: import("./domain/generateSignedUrls/types.js").GenerateSignedUrlConfig) => Promise<{
|
|
196
217
|
fileLocation?: string;
|
|
@@ -225,6 +246,7 @@ export declare function makeQaWolfSdk({ apiKey, serviceBase, userAgent, }: {
|
|
|
225
246
|
uploadBuild: (args_0: import("./domain/uploadBuild/types.js").UploadBuildParams) => Promise<import("./domain/uploadBuild/types.js").UploadBuildResult>;
|
|
226
247
|
};
|
|
227
248
|
export type * from "./domain/attemptDeploy/index.js";
|
|
249
|
+
export type * from "./domain/collectChanges/types.js";
|
|
228
250
|
export type * from "./domain/environment/types.js";
|
|
229
251
|
export type * from "./domain/generateSignedUrls/types.js";
|
|
230
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;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qawolf/ci-sdk",
|
|
3
|
-
"version": "3.6.
|
|
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": [],
|
|
@@ -39,7 +39,7 @@
|
|
|
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",
|