@theholocron/jira-client 1.58.0-alpha.2 → 1.58.0-alpha.21
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/dist/index.d.mts +57 -0
- package/dist/index.mjs +6 -0
- package/package.json +18 -18
package/dist/index.d.mts
CHANGED
|
@@ -1,73 +1,125 @@
|
|
|
1
1
|
import { RestClient } from "@theholocron/http-client";
|
|
2
2
|
import { ErrorSink, Logger } from "@theholocron/observability/core";
|
|
3
|
+
/** Options for `createJiraClient()`. */
|
|
3
4
|
interface JiraClientOptions {
|
|
5
|
+
/** The base URL of the Jira REST API. */
|
|
4
6
|
host: string;
|
|
7
|
+
/** The pre-encoded Basic credential (Base64 of `email:apiToken`). */
|
|
5
8
|
token: string;
|
|
6
9
|
/** Override fetch for testing. Defaults to globalThis.fetch. */
|
|
7
10
|
fetch?: typeof fetch;
|
|
8
11
|
}
|
|
12
|
+
/** An issue's fields, keyed by field id or name. */
|
|
9
13
|
interface JiraIssueFields {
|
|
10
14
|
[key: string]: unknown;
|
|
11
15
|
}
|
|
16
|
+
/** A Jira issue. */
|
|
12
17
|
interface JiraIssue {
|
|
18
|
+
/** The issue id. */
|
|
13
19
|
id: string;
|
|
20
|
+
/** The issue key, e.g. `PROJ-123`. */
|
|
14
21
|
key: string;
|
|
22
|
+
/** The issue's fields. */
|
|
15
23
|
fields: JiraIssueFields;
|
|
16
24
|
}
|
|
25
|
+
/** A project version (release). */
|
|
17
26
|
interface JiraVersion {
|
|
27
|
+
/** The version id. */
|
|
18
28
|
id: string;
|
|
29
|
+
/** The version name. */
|
|
19
30
|
name: string;
|
|
31
|
+
/** The key of the project the version belongs to. */
|
|
20
32
|
project: string;
|
|
33
|
+
/** The start date. */
|
|
21
34
|
startDate?: string;
|
|
35
|
+
/** The release date. */
|
|
22
36
|
releaseDate?: string;
|
|
37
|
+
/** Whether the version has been released. */
|
|
23
38
|
released?: boolean;
|
|
24
39
|
[key: string]: unknown;
|
|
25
40
|
}
|
|
41
|
+
/** A Jira project. */
|
|
26
42
|
interface JiraProject {
|
|
43
|
+
/** The project id. */
|
|
27
44
|
id: string;
|
|
45
|
+
/** The project key. */
|
|
28
46
|
key: string;
|
|
47
|
+
/** The project name. */
|
|
29
48
|
name: string;
|
|
49
|
+
/** The issue types the project allows; present when requested with `expand=issueTypes`. */
|
|
30
50
|
issueTypes?: JiraIssueType[];
|
|
31
51
|
}
|
|
52
|
+
/** An issue type. */
|
|
32
53
|
interface JiraIssueType {
|
|
54
|
+
/** The issue type id. */
|
|
33
55
|
id: string;
|
|
56
|
+
/** The issue type name. */
|
|
34
57
|
name: string;
|
|
35
58
|
}
|
|
59
|
+
/** A workflow transition an issue can take. */
|
|
36
60
|
interface JiraTransition {
|
|
61
|
+
/** The transition id. */
|
|
37
62
|
id: string;
|
|
63
|
+
/** The transition name. */
|
|
38
64
|
name: string;
|
|
65
|
+
/** The status the issue ends up in. */
|
|
39
66
|
to: {
|
|
67
|
+
/** The target status id. */
|
|
40
68
|
id: string;
|
|
69
|
+
/** The target status name. */
|
|
41
70
|
name: string;
|
|
42
71
|
};
|
|
43
72
|
}
|
|
73
|
+
/** An issue resolution. */
|
|
44
74
|
interface JiraResolution {
|
|
75
|
+
/** The resolution id. */
|
|
45
76
|
id: string;
|
|
77
|
+
/** The resolution name. */
|
|
46
78
|
name: string;
|
|
79
|
+
/** The resolution's description. */
|
|
47
80
|
description?: string;
|
|
48
81
|
}
|
|
82
|
+
/** A kind of link between issues. */
|
|
49
83
|
interface JiraIssueLinkType {
|
|
84
|
+
/** The link type id. */
|
|
50
85
|
id: string;
|
|
86
|
+
/** The link type name. */
|
|
51
87
|
name: string;
|
|
88
|
+
/** The phrase describing the link from the inward issue. */
|
|
52
89
|
inward: string;
|
|
90
|
+
/** The phrase describing the link from the outward issue. */
|
|
53
91
|
outward: string;
|
|
54
92
|
}
|
|
93
|
+
/** The response of `issues.search()`. */
|
|
55
94
|
interface JiraSearchResponse {
|
|
95
|
+
/** The issues on this page. */
|
|
56
96
|
issues: JiraIssue[];
|
|
97
|
+
/** The total number of matches. */
|
|
57
98
|
total: number;
|
|
99
|
+
/** The page size used. */
|
|
58
100
|
maxResults: number;
|
|
101
|
+
/** The index of the first issue on this page. */
|
|
59
102
|
startAt: number;
|
|
60
103
|
}
|
|
104
|
+
/** Input for `issues.search()`. */
|
|
61
105
|
interface JiraSearchQuery {
|
|
106
|
+
/** The JQL query. */
|
|
62
107
|
jql?: string;
|
|
108
|
+
/** The index of the first result to return. */
|
|
63
109
|
startAt?: number;
|
|
110
|
+
/** The page size. */
|
|
64
111
|
maxResults?: number;
|
|
112
|
+
/** The fields to return for each issue. */
|
|
65
113
|
fields?: string[];
|
|
66
114
|
}
|
|
115
|
+
/** The outcome of linking one ticket in `links.createMany()`. */
|
|
67
116
|
interface IssueLinkResult {
|
|
117
|
+
/** The ticket key that was linked. */
|
|
68
118
|
ticket: string;
|
|
119
|
+
/** The HTTP status of the link request; `201` on success. */
|
|
69
120
|
status: number;
|
|
70
121
|
}
|
|
122
|
+
/** Issue link operations. */
|
|
71
123
|
declare function links(client: RestClient): {
|
|
72
124
|
create(ticket: string, link: string, type: string): Promise<number>;
|
|
73
125
|
createMany(tickets: string[], link: string, type: string): Promise<IssueLinkResult[]>;
|
|
@@ -75,6 +127,7 @@ declare function links(client: RestClient): {
|
|
|
75
127
|
issueLinkTypes: JiraIssueLinkType[];
|
|
76
128
|
}>;
|
|
77
129
|
};
|
|
130
|
+
/** Issue operations: create, read, update and search. */
|
|
78
131
|
declare function issues(client: RestClient): {
|
|
79
132
|
create(title: string, type: string, project: string, fields?: JiraIssueFields): Promise<JiraIssue>;
|
|
80
133
|
get(ticket: string, params?: Record<string, string>): Promise<JiraIssue>;
|
|
@@ -83,9 +136,11 @@ declare function issues(client: RestClient): {
|
|
|
83
136
|
getProperty(ticket: string, property: string): Promise<unknown>;
|
|
84
137
|
search(query?: JiraSearchQuery): Promise<JiraSearchResponse>;
|
|
85
138
|
};
|
|
139
|
+
/** Project operations. */
|
|
86
140
|
declare function projects(client: RestClient): {
|
|
87
141
|
get(id: string): Promise<JiraProject>;
|
|
88
142
|
};
|
|
143
|
+
/** Issue transition operations. */
|
|
89
144
|
declare function transitions(client: RestClient): {
|
|
90
145
|
create(ticket: string, statusId: string, fields?: JiraIssueFields): Promise<void>;
|
|
91
146
|
get(ticket: string): Promise<{
|
|
@@ -93,6 +148,7 @@ declare function transitions(client: RestClient): {
|
|
|
93
148
|
}>;
|
|
94
149
|
getResolutions(): Promise<JiraResolution[]>;
|
|
95
150
|
};
|
|
151
|
+
/** Project version (release) operations. */
|
|
96
152
|
declare function versions(client: RestClient): {
|
|
97
153
|
create(name: string, project: string, fields?: Partial<JiraVersion>): Promise<JiraVersion>;
|
|
98
154
|
get(version: string, params?: Record<string, string>): Promise<JiraVersion>;
|
|
@@ -100,6 +156,7 @@ declare function versions(client: RestClient): {
|
|
|
100
156
|
update(version: string, fields: Partial<JiraVersion>): Promise<JiraVersion>;
|
|
101
157
|
delete(version: string): Promise<void>;
|
|
102
158
|
};
|
|
159
|
+
/** Create a Jira client with `issues`, `links`, `projects`, `transitions` and `versions` groups, all sharing one REST client. `options.token` is the pre-encoded Basic credential (Base64 of `email:apiToken`). */
|
|
103
160
|
export declare function createJiraClient(options: {
|
|
104
161
|
host: string;
|
|
105
162
|
token: string;
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ProviderApiError, createRestClient } from "@theholocron/http-client";
|
|
2
2
|
// src/issues.ts
|
|
3
|
+
/** Issue operations: create, read, update and search. */
|
|
3
4
|
function issues(client) {
|
|
4
5
|
return {
|
|
5
6
|
create(title, type, project, fields = {}) {
|
|
@@ -39,6 +40,7 @@ function issues(client) {
|
|
|
39
40
|
};
|
|
40
41
|
}
|
|
41
42
|
// src/links.ts
|
|
43
|
+
/** Issue link operations. */
|
|
42
44
|
function links(client) {
|
|
43
45
|
return {
|
|
44
46
|
async create(ticket, link, type) {
|
|
@@ -69,12 +71,14 @@ function links(client) {
|
|
|
69
71
|
};
|
|
70
72
|
}
|
|
71
73
|
// src/projects.ts
|
|
74
|
+
/** Project operations. */
|
|
72
75
|
function projects(client) {
|
|
73
76
|
return { get(id) {
|
|
74
77
|
return client.request(`/project/${id}`, { query: { expand: "issueTypes" } });
|
|
75
78
|
} };
|
|
76
79
|
}
|
|
77
80
|
// src/transitions.ts
|
|
81
|
+
/** Issue transition operations. */
|
|
78
82
|
function transitions(client) {
|
|
79
83
|
return {
|
|
80
84
|
create(ticket, statusId, fields = {}) {
|
|
@@ -95,6 +99,7 @@ function transitions(client) {
|
|
|
95
99
|
};
|
|
96
100
|
}
|
|
97
101
|
// src/versions.ts
|
|
102
|
+
/** Project version (release) operations. */
|
|
98
103
|
function versions(client) {
|
|
99
104
|
return {
|
|
100
105
|
create(name, project, fields = {}) {
|
|
@@ -126,6 +131,7 @@ function versions(client) {
|
|
|
126
131
|
};
|
|
127
132
|
}
|
|
128
133
|
// src/index.ts
|
|
134
|
+
/** Create a Jira client with `issues`, `links`, `projects`, `transitions` and `versions` groups, all sharing one REST client. `options.token` is the pre-encoded Basic credential (Base64 of `email:apiToken`). */
|
|
129
135
|
function createJiraClient(options) {
|
|
130
136
|
const client = createRestClient({
|
|
131
137
|
baseUrl: options.host,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theholocron/jira-client",
|
|
3
|
-
"version": "1.58.0-alpha.
|
|
3
|
+
"version": "1.58.0-alpha.21",
|
|
4
4
|
"description": "A TypeScript client for the Jira REST API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jira",
|
|
@@ -32,23 +32,23 @@
|
|
|
32
32
|
"dist"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@theholocron/
|
|
36
|
-
"@theholocron/
|
|
35
|
+
"@theholocron/observability": "^0.7.0-alpha.2",
|
|
36
|
+
"@theholocron/http-client": "^1.58.0-alpha.21"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@types/node": "^26",
|
|
40
|
-
"@vitest/coverage-v8": "^5.0
|
|
41
|
-
"@vitest/eslint-plugin": "^1.6.
|
|
42
|
-
"eslint": "^10.
|
|
43
|
-
"eslint-plugin-n": "^18.
|
|
44
|
-
"globals": "^17.
|
|
45
|
-
"tsdown": "^0.23.
|
|
40
|
+
"@vitest/coverage-v8": "^5.1.0",
|
|
41
|
+
"@vitest/eslint-plugin": "^1.6.28",
|
|
42
|
+
"eslint": "^10.14.0",
|
|
43
|
+
"eslint-plugin-n": "^18.5.0",
|
|
44
|
+
"globals": "^17.14.0",
|
|
45
|
+
"tsdown": "^0.23.5",
|
|
46
46
|
"typescript": "^5.9.3",
|
|
47
|
-
"vitest": "^5.0
|
|
48
|
-
"@theholocron/eslint-config": "^8.9.0-alpha.
|
|
49
|
-
"@theholocron/
|
|
50
|
-
"@theholocron/
|
|
51
|
-
"@theholocron/
|
|
47
|
+
"vitest": "^5.1.0",
|
|
48
|
+
"@theholocron/eslint-config": "^8.9.0-alpha.12",
|
|
49
|
+
"@theholocron/tsconfig": "^8.9.0-alpha.12",
|
|
50
|
+
"@theholocron/vitest-config": "^8.9.0-alpha.12",
|
|
51
|
+
"@theholocron/tsdown-config": "^8.9.0-alpha.12"
|
|
52
52
|
},
|
|
53
53
|
"engines": {
|
|
54
54
|
"node": ">=22.0.0"
|
|
@@ -57,10 +57,10 @@
|
|
|
57
57
|
"access": "public"
|
|
58
58
|
},
|
|
59
59
|
"scripts": {
|
|
60
|
-
"
|
|
61
|
-
"
|
|
60
|
+
"build": "tsdown && node ../scripts/check-bundle-size.mjs",
|
|
61
|
+
"lint:code": "eslint .",
|
|
62
|
+
"test:unit": "vitest run --coverage",
|
|
62
63
|
"test:watch": "vitest",
|
|
63
|
-
"
|
|
64
|
-
"verification.unitTests": "vitest run"
|
|
64
|
+
"typecheck": "tsc --noEmit"
|
|
65
65
|
}
|
|
66
66
|
}
|