@yadsh/dsh-qa-integrations 0.5.0
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/LICENSE +21 -0
- package/README.md +617 -0
- package/compatibility.json +10 -0
- package/cordis.patch.yml +5 -0
- package/lib/broker.js +239 -0
- package/lib/broker.js.map +1 -0
- package/lib/client/bitrix24.js +33 -0
- package/lib/client/bitrix24.js.map +1 -0
- package/lib/client/card.js +33 -0
- package/lib/client/card.js.map +1 -0
- package/lib/client/confluence.js +148 -0
- package/lib/client/confluence.js.map +1 -0
- package/lib/client/copy.js +18 -0
- package/lib/client/copy.js.map +1 -0
- package/lib/client/gitlab.js +64 -0
- package/lib/client/gitlab.js.map +1 -0
- package/lib/client/index.js +71 -0
- package/lib/client/index.js.map +1 -0
- package/lib/client/integrations.js +34 -0
- package/lib/client/integrations.js.map +1 -0
- package/lib/client/jira.js +150 -0
- package/lib/client/jira.js.map +1 -0
- package/lib/client/provider-card.js +143 -0
- package/lib/client/provider-card.js.map +1 -0
- package/lib/client/styles.js +35 -0
- package/lib/client/styles.js.map +1 -0
- package/lib/client/teamcity.js +55 -0
- package/lib/client/teamcity.js.map +1 -0
- package/lib/client.js +8069 -0
- package/lib/client.js.map +1 -0
- package/lib/coerce.js +69 -0
- package/lib/coerce.js.map +1 -0
- package/lib/config.js +51 -0
- package/lib/config.js.map +1 -0
- package/lib/errors.js +14 -0
- package/lib/errors.js.map +1 -0
- package/lib/index.js +510 -0
- package/lib/index.js.map +1 -0
- package/lib/providers/bitrix24/catalog.js +245 -0
- package/lib/providers/bitrix24/catalog.js.map +1 -0
- package/lib/providers/bitrix24/config.js +40 -0
- package/lib/providers/bitrix24/config.js.map +1 -0
- package/lib/providers/bitrix24/index.js +128 -0
- package/lib/providers/bitrix24/index.js.map +1 -0
- package/lib/providers/bitrix24/operations.js +491 -0
- package/lib/providers/bitrix24/operations.js.map +1 -0
- package/lib/providers/bitrix24/tools.js +1035 -0
- package/lib/providers/bitrix24/tools.js.map +1 -0
- package/lib/providers/bitrix24/transport.js +142 -0
- package/lib/providers/bitrix24/transport.js.map +1 -0
- package/lib/providers/confluence/adf.js +348 -0
- package/lib/providers/confluence/adf.js.map +1 -0
- package/lib/providers/confluence/catalog.js +135 -0
- package/lib/providers/confluence/catalog.js.map +1 -0
- package/lib/providers/confluence/config.js +196 -0
- package/lib/providers/confluence/config.js.map +1 -0
- package/lib/providers/confluence/cql.js +78 -0
- package/lib/providers/confluence/cql.js.map +1 -0
- package/lib/providers/confluence/index.js +319 -0
- package/lib/providers/confluence/index.js.map +1 -0
- package/lib/providers/confluence/operations.js +653 -0
- package/lib/providers/confluence/operations.js.map +1 -0
- package/lib/providers/confluence/tools.js +282 -0
- package/lib/providers/confluence/tools.js.map +1 -0
- package/lib/providers/confluence/transport.js +247 -0
- package/lib/providers/confluence/transport.js.map +1 -0
- package/lib/providers/contract.js +2 -0
- package/lib/providers/contract.js.map +1 -0
- package/lib/providers/gitlab/catalog.js +171 -0
- package/lib/providers/gitlab/catalog.js.map +1 -0
- package/lib/providers/gitlab/config.js +141 -0
- package/lib/providers/gitlab/config.js.map +1 -0
- package/lib/providers/gitlab/index.js +227 -0
- package/lib/providers/gitlab/index.js.map +1 -0
- package/lib/providers/gitlab/operations.js +794 -0
- package/lib/providers/gitlab/operations.js.map +1 -0
- package/lib/providers/gitlab/tools.js +859 -0
- package/lib/providers/gitlab/tools.js.map +1 -0
- package/lib/providers/gitlab/transport.js +140 -0
- package/lib/providers/gitlab/transport.js.map +1 -0
- package/lib/providers/jira/adf.js +235 -0
- package/lib/providers/jira/adf.js.map +1 -0
- package/lib/providers/jira/catalog.js +145 -0
- package/lib/providers/jira/catalog.js.map +1 -0
- package/lib/providers/jira/config.js +198 -0
- package/lib/providers/jira/config.js.map +1 -0
- package/lib/providers/jira/index.js +301 -0
- package/lib/providers/jira/index.js.map +1 -0
- package/lib/providers/jira/jql.js +299 -0
- package/lib/providers/jira/jql.js.map +1 -0
- package/lib/providers/jira/operations.js +617 -0
- package/lib/providers/jira/operations.js.map +1 -0
- package/lib/providers/jira/tools.js +341 -0
- package/lib/providers/jira/tools.js.map +1 -0
- package/lib/providers/jira/transport.js +227 -0
- package/lib/providers/jira/transport.js.map +1 -0
- package/lib/providers/registry.js +21 -0
- package/lib/providers/registry.js.map +1 -0
- package/lib/providers/shared/account.js +20 -0
- package/lib/providers/shared/account.js.map +1 -0
- package/lib/providers/shared/host.js +15 -0
- package/lib/providers/shared/host.js.map +1 -0
- package/lib/providers/shared/http.js +148 -0
- package/lib/providers/shared/http.js.map +1 -0
- package/lib/providers/teamcity/artifacts.js +155 -0
- package/lib/providers/teamcity/artifacts.js.map +1 -0
- package/lib/providers/teamcity/catalog.js +155 -0
- package/lib/providers/teamcity/catalog.js.map +1 -0
- package/lib/providers/teamcity/config.js +262 -0
- package/lib/providers/teamcity/config.js.map +1 -0
- package/lib/providers/teamcity/index.js +228 -0
- package/lib/providers/teamcity/index.js.map +1 -0
- package/lib/providers/teamcity/locators.js +95 -0
- package/lib/providers/teamcity/locators.js.map +1 -0
- package/lib/providers/teamcity/logs.js +113 -0
- package/lib/providers/teamcity/logs.js.map +1 -0
- package/lib/providers/teamcity/network.js +160 -0
- package/lib/providers/teamcity/network.js.map +1 -0
- package/lib/providers/teamcity/operations.js +625 -0
- package/lib/providers/teamcity/operations.js.map +1 -0
- package/lib/providers/teamcity/tools.js +480 -0
- package/lib/providers/teamcity/tools.js.map +1 -0
- package/lib/providers/teamcity/transport.js +126 -0
- package/lib/providers/teamcity/transport.js.map +1 -0
- package/lib/redaction.js +38 -0
- package/lib/redaction.js.map +1 -0
- package/lib/repository.js +414 -0
- package/lib/repository.js.map +1 -0
- package/lib/secrets/key-provider.js +76 -0
- package/lib/secrets/key-provider.js.map +1 -0
- package/lib/secrets/secret-store.js +93 -0
- package/lib/secrets/secret-store.js.map +1 -0
- package/lib/shared/settings.js +19 -0
- package/lib/shared/settings.js.map +1 -0
- package/lib/tool-kit.js +55 -0
- package/lib/tool-kit.js.map +1 -0
- package/lib/tools.js +28 -0
- package/lib/tools.js.map +1 -0
- package/lib/typert.host.d.ts +3 -0
- package/lib/typert.host.js +1689 -0
- package/lib/typert.remote-client.d.ts +84 -0
- package/lib/typert.remote-client.js +1429 -0
- package/lib/types/broker.d.ts +30 -0
- package/lib/types/client/bitrix24.d.ts +18 -0
- package/lib/types/client/card.d.ts +13 -0
- package/lib/types/client/confluence.d.ts +17 -0
- package/lib/types/client/copy.d.ts +7 -0
- package/lib/types/client/gitlab.d.ts +15 -0
- package/lib/types/client/index.d.ts +13 -0
- package/lib/types/client/integrations.d.ts +28 -0
- package/lib/types/client/jira.d.ts +17 -0
- package/lib/types/client/provider-card.d.ts +63 -0
- package/lib/types/client/styles.d.ts +7 -0
- package/lib/types/client/teamcity.d.ts +19 -0
- package/lib/types/coerce.d.ts +18 -0
- package/lib/types/config.d.ts +48 -0
- package/lib/types/errors.d.ts +26 -0
- package/lib/types/index.d.ts +170 -0
- package/lib/types/providers/bitrix24/catalog.d.ts +48 -0
- package/lib/types/providers/bitrix24/config.d.ts +43 -0
- package/lib/types/providers/bitrix24/index.d.ts +31 -0
- package/lib/types/providers/bitrix24/operations.d.ts +13 -0
- package/lib/types/providers/bitrix24/tools.d.ts +9 -0
- package/lib/types/providers/bitrix24/transport.d.ts +26 -0
- package/lib/types/providers/confluence/adf.d.ts +22 -0
- package/lib/types/providers/confluence/catalog.d.ts +59 -0
- package/lib/types/providers/confluence/config.d.ts +68 -0
- package/lib/types/providers/confluence/cql.d.ts +43 -0
- package/lib/types/providers/confluence/index.d.ts +73 -0
- package/lib/types/providers/confluence/operations.d.ts +92 -0
- package/lib/types/providers/confluence/tools.d.ts +15 -0
- package/lib/types/providers/confluence/transport.d.ts +77 -0
- package/lib/types/providers/contract.d.ts +33 -0
- package/lib/types/providers/gitlab/catalog.d.ts +49 -0
- package/lib/types/providers/gitlab/config.d.ts +50 -0
- package/lib/types/providers/gitlab/index.d.ts +49 -0
- package/lib/types/providers/gitlab/operations.d.ts +40 -0
- package/lib/types/providers/gitlab/tools.d.ts +15 -0
- package/lib/types/providers/gitlab/transport.d.ts +52 -0
- package/lib/types/providers/jira/adf.d.ts +27 -0
- package/lib/types/providers/jira/catalog.d.ts +74 -0
- package/lib/types/providers/jira/config.d.ts +73 -0
- package/lib/types/providers/jira/index.d.ts +79 -0
- package/lib/types/providers/jira/jql.d.ts +51 -0
- package/lib/types/providers/jira/operations.d.ts +58 -0
- package/lib/types/providers/jira/tools.d.ts +17 -0
- package/lib/types/providers/jira/transport.d.ts +65 -0
- package/lib/types/providers/registry.d.ts +9 -0
- package/lib/types/providers/shared/account.d.ts +10 -0
- package/lib/types/providers/shared/host.d.ts +9 -0
- package/lib/types/providers/shared/http.d.ts +51 -0
- package/lib/types/providers/teamcity/artifacts.d.ts +45 -0
- package/lib/types/providers/teamcity/catalog.d.ts +55 -0
- package/lib/types/providers/teamcity/config.d.ts +66 -0
- package/lib/types/providers/teamcity/index.d.ts +62 -0
- package/lib/types/providers/teamcity/locators.d.ts +47 -0
- package/lib/types/providers/teamcity/logs.d.ts +31 -0
- package/lib/types/providers/teamcity/network.d.ts +32 -0
- package/lib/types/providers/teamcity/operations.d.ts +84 -0
- package/lib/types/providers/teamcity/tools.d.ts +15 -0
- package/lib/types/providers/teamcity/transport.d.ts +53 -0
- package/lib/types/redaction.d.ts +3 -0
- package/lib/types/repository.d.ts +48 -0
- package/lib/types/secrets/key-provider.d.ts +30 -0
- package/lib/types/secrets/secret-store.d.ts +12 -0
- package/lib/types/shared/settings.d.ts +19 -0
- package/lib/types/tool-kit.d.ts +26 -0
- package/lib/types/tools.d.ts +16 -0
- package/lib/types/types.d.ts +138 -0
- package/lib/types.js +2 -0
- package/lib/types.js.map +1 -0
- package/package.json +143 -0
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import z from "@deepseek-ai/schemastery";
|
|
2
|
+
/** Jira Cloud caps one search page at 100 issues once fields are requested. */
|
|
3
|
+
export const SEARCH_PAGE_CAP = 100;
|
|
4
|
+
/**
|
|
5
|
+
* The shape of a custom field id, as Jira spells it. The provider never carries
|
|
6
|
+
* one itself: an id belongs to an instance, so it arrives either from the
|
|
7
|
+
* field catalog or from the operator's aliases.
|
|
8
|
+
*/
|
|
9
|
+
export const CUSTOM_FIELD_ID = /^customfield_\d{1,10}$/u;
|
|
10
|
+
export const JIRA_DEFAULTS = Object.freeze({
|
|
11
|
+
enabled: true,
|
|
12
|
+
allowInsecureHttp: false,
|
|
13
|
+
sites: Object.freeze([]),
|
|
14
|
+
identityRead: true,
|
|
15
|
+
issuesRead: true,
|
|
16
|
+
commentsRead: true,
|
|
17
|
+
attachmentsRead: true,
|
|
18
|
+
transitionsRead: true,
|
|
19
|
+
projectsRead: true,
|
|
20
|
+
fieldsRead: true,
|
|
21
|
+
fieldAliases: Object.freeze({}),
|
|
22
|
+
defaultSearchLimit: 20,
|
|
23
|
+
maxSearchLimit: SEARCH_PAGE_CAP,
|
|
24
|
+
maxCommentLimit: 100,
|
|
25
|
+
maxTextChars: 20_000,
|
|
26
|
+
retries: 2,
|
|
27
|
+
});
|
|
28
|
+
const SITE_ID = /^[a-z0-9][a-z0-9-]{0,31}$/u;
|
|
29
|
+
const ALIAS = /^[a-z][a-z0-9-]{0,31}$/u;
|
|
30
|
+
const MAX_SITES = 16;
|
|
31
|
+
const MAX_ALIASES = 32;
|
|
32
|
+
function configError(message) {
|
|
33
|
+
return new Error(`jira integration config: ${message}`);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Canonicalize one configured site. Everything here is operator input, so a typo
|
|
37
|
+
* must fail loudly at load: a silently dropped site would leave users with a
|
|
38
|
+
* provider they cannot connect to and no explanation.
|
|
39
|
+
*/
|
|
40
|
+
function normalizeSite(input, index, allowInsecureHttp, seen) {
|
|
41
|
+
if (typeof input !== "object" || input === null || Array.isArray(input)) {
|
|
42
|
+
throw configError(`sites[${index}] must be a mapping`);
|
|
43
|
+
}
|
|
44
|
+
const record = input;
|
|
45
|
+
const id = typeof record["id"] === "string" ? record["id"].trim() : "";
|
|
46
|
+
if (!SITE_ID.test(id)) {
|
|
47
|
+
throw configError(`sites[${index}].id must be lowercase latin, digits or dashes`);
|
|
48
|
+
}
|
|
49
|
+
if (seen.has(id))
|
|
50
|
+
throw configError(`sites[${index}].id is a duplicate`);
|
|
51
|
+
seen.add(id);
|
|
52
|
+
const raw = typeof record["baseUrl"] === "string" ? record["baseUrl"] : "";
|
|
53
|
+
let url;
|
|
54
|
+
try {
|
|
55
|
+
url = new URL(raw.trim());
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
throw configError(`sites[${index}].baseUrl must be an absolute URL`);
|
|
59
|
+
}
|
|
60
|
+
if (url.protocol !== "https:" && url.protocol !== "http:") {
|
|
61
|
+
throw configError(`sites[${index}].baseUrl must use HTTP or HTTPS`);
|
|
62
|
+
}
|
|
63
|
+
if (url.protocol === "http:" && !allowInsecureHttp) {
|
|
64
|
+
throw configError(`sites[${index}].baseUrl needs HTTPS; set allowInsecureHttp for a development site`);
|
|
65
|
+
}
|
|
66
|
+
if (url.username !== "" || url.password !== "" || url.search !== "") {
|
|
67
|
+
throw configError(`sites[${index}].baseUrl must carry no credentials or query`);
|
|
68
|
+
}
|
|
69
|
+
// A trailing slash would double up when the API root is appended; the WHATWG
|
|
70
|
+
// URL parser has already folded away any `..` segments.
|
|
71
|
+
const path = url.pathname.replace(/\/+$/u, "");
|
|
72
|
+
const label = typeof record["label"] === "string" ? record["label"].trim() : "";
|
|
73
|
+
return Object.freeze({
|
|
74
|
+
id,
|
|
75
|
+
label: label === "" ? url.host : label,
|
|
76
|
+
baseUrl: `${url.origin}${path}`,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
function normalizeSites(input, allowInsecureHttp) {
|
|
80
|
+
if (input === undefined || input === null)
|
|
81
|
+
return JIRA_DEFAULTS.sites;
|
|
82
|
+
if (!Array.isArray(input))
|
|
83
|
+
throw configError("sites must be a list");
|
|
84
|
+
if (input.length > MAX_SITES) {
|
|
85
|
+
throw configError(`sites accepts at most ${MAX_SITES} entries`);
|
|
86
|
+
}
|
|
87
|
+
const seen = new Set();
|
|
88
|
+
return Object.freeze(input.map((entry, index) => normalizeSite(entry, index, allowInsecureHttp, seen)));
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* The instance's custom fields, as names this deployment chose. The mapping is
|
|
92
|
+
* operator input and fails loudly on a typo, like the site list: an alias that
|
|
93
|
+
* silently pointed nowhere would make a question about "the product" answer
|
|
94
|
+
* nothing at all, with no way to tell that from "no such issues".
|
|
95
|
+
*/
|
|
96
|
+
function normalizeAliases(input) {
|
|
97
|
+
if (input === undefined || input === null)
|
|
98
|
+
return JIRA_DEFAULTS.fieldAliases;
|
|
99
|
+
if (typeof input !== "object" || Array.isArray(input)) {
|
|
100
|
+
throw configError("fieldAliases must be a mapping of alias to customfield_ id");
|
|
101
|
+
}
|
|
102
|
+
const entries = Object.entries(input);
|
|
103
|
+
if (entries.length > MAX_ALIASES) {
|
|
104
|
+
throw configError(`fieldAliases accepts at most ${MAX_ALIASES} entries`);
|
|
105
|
+
}
|
|
106
|
+
const aliases = {};
|
|
107
|
+
for (const [alias, value] of entries) {
|
|
108
|
+
if (!ALIAS.test(alias)) {
|
|
109
|
+
throw configError(`fieldAliases keys must be lowercase latin, digits or dashes: ${JSON.stringify(alias)}`);
|
|
110
|
+
}
|
|
111
|
+
const id = typeof value === "string" ? value.trim() : "";
|
|
112
|
+
if (!CUSTOM_FIELD_ID.test(id)) {
|
|
113
|
+
throw configError(`fieldAliases.${alias} must be a customfield_ id, as jira_get_fields reports it`);
|
|
114
|
+
}
|
|
115
|
+
aliases[alias] = id;
|
|
116
|
+
}
|
|
117
|
+
return Object.freeze(aliases);
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Config slice of this provider, as it appears under `jira:` in YAML. The site
|
|
121
|
+
* list is validated and canonicalized by `resolveJiraConfig`, which is where a
|
|
122
|
+
* deployment typo fails loudly.
|
|
123
|
+
*/
|
|
124
|
+
export const jiraConfigSchema = z.object({
|
|
125
|
+
enabled: z.boolean().default(JIRA_DEFAULTS.enabled),
|
|
126
|
+
allowInsecureHttp: z.boolean().default(JIRA_DEFAULTS.allowInsecureHttp),
|
|
127
|
+
sites: z
|
|
128
|
+
.array(z.object({
|
|
129
|
+
id: z.string(),
|
|
130
|
+
label: z.string(),
|
|
131
|
+
baseUrl: z.string(),
|
|
132
|
+
}))
|
|
133
|
+
.default([]),
|
|
134
|
+
fieldAliases: z.dict(z.string()).default({}),
|
|
135
|
+
identityRead: z.boolean().default(JIRA_DEFAULTS.identityRead),
|
|
136
|
+
issuesRead: z.boolean().default(JIRA_DEFAULTS.issuesRead),
|
|
137
|
+
commentsRead: z.boolean().default(JIRA_DEFAULTS.commentsRead),
|
|
138
|
+
attachmentsRead: z.boolean().default(JIRA_DEFAULTS.attachmentsRead),
|
|
139
|
+
transitionsRead: z.boolean().default(JIRA_DEFAULTS.transitionsRead),
|
|
140
|
+
projectsRead: z.boolean().default(JIRA_DEFAULTS.projectsRead),
|
|
141
|
+
fieldsRead: z.boolean().default(JIRA_DEFAULTS.fieldsRead),
|
|
142
|
+
defaultSearchLimit: z
|
|
143
|
+
.number()
|
|
144
|
+
.step(1)
|
|
145
|
+
.min(1)
|
|
146
|
+
.max(SEARCH_PAGE_CAP)
|
|
147
|
+
.default(JIRA_DEFAULTS.defaultSearchLimit),
|
|
148
|
+
maxSearchLimit: z
|
|
149
|
+
.number()
|
|
150
|
+
.step(1)
|
|
151
|
+
.min(1)
|
|
152
|
+
.max(SEARCH_PAGE_CAP)
|
|
153
|
+
.default(JIRA_DEFAULTS.maxSearchLimit),
|
|
154
|
+
maxCommentLimit: z
|
|
155
|
+
.number()
|
|
156
|
+
.step(1)
|
|
157
|
+
.min(1)
|
|
158
|
+
.max(SEARCH_PAGE_CAP)
|
|
159
|
+
.default(JIRA_DEFAULTS.maxCommentLimit),
|
|
160
|
+
maxTextChars: z
|
|
161
|
+
.number()
|
|
162
|
+
.step(1)
|
|
163
|
+
.min(1_000)
|
|
164
|
+
.default(JIRA_DEFAULTS.maxTextChars),
|
|
165
|
+
retries: z.number().step(1).min(0).max(5).default(JIRA_DEFAULTS.retries),
|
|
166
|
+
});
|
|
167
|
+
export function resolveJiraConfig(input = {}) {
|
|
168
|
+
const allowInsecureHttp = input.allowInsecureHttp ?? JIRA_DEFAULTS.allowInsecureHttp;
|
|
169
|
+
// Jira Cloud answers at most 100 issues per page once fields are requested, so
|
|
170
|
+
// a deployment cannot raise the ceiling past that: the value is folded, not
|
|
171
|
+
// rejected, because an operator asking for more only wants the maximum.
|
|
172
|
+
const maxSearchLimit = Math.min(input.maxSearchLimit ?? JIRA_DEFAULTS.maxSearchLimit, SEARCH_PAGE_CAP);
|
|
173
|
+
const defaultSearchLimit = Math.min(input.defaultSearchLimit ?? JIRA_DEFAULTS.defaultSearchLimit, maxSearchLimit);
|
|
174
|
+
const maxCommentLimit = Math.min(input.maxCommentLimit ?? JIRA_DEFAULTS.maxCommentLimit, SEARCH_PAGE_CAP);
|
|
175
|
+
return Object.freeze({
|
|
176
|
+
enabled: input.enabled ?? JIRA_DEFAULTS.enabled,
|
|
177
|
+
allowInsecureHttp,
|
|
178
|
+
sites: normalizeSites(input.sites, allowInsecureHttp),
|
|
179
|
+
fieldAliases: normalizeAliases(input.fieldAliases),
|
|
180
|
+
identityRead: input.identityRead ?? JIRA_DEFAULTS.identityRead,
|
|
181
|
+
issuesRead: input.issuesRead ?? JIRA_DEFAULTS.issuesRead,
|
|
182
|
+
commentsRead: input.commentsRead ?? JIRA_DEFAULTS.commentsRead,
|
|
183
|
+
attachmentsRead: input.attachmentsRead ?? JIRA_DEFAULTS.attachmentsRead,
|
|
184
|
+
transitionsRead: input.transitionsRead ?? JIRA_DEFAULTS.transitionsRead,
|
|
185
|
+
projectsRead: input.projectsRead ?? JIRA_DEFAULTS.projectsRead,
|
|
186
|
+
fieldsRead: input.fieldsRead ?? JIRA_DEFAULTS.fieldsRead,
|
|
187
|
+
defaultSearchLimit,
|
|
188
|
+
maxSearchLimit,
|
|
189
|
+
maxCommentLimit,
|
|
190
|
+
maxTextChars: input.maxTextChars ?? JIRA_DEFAULTS.maxTextChars,
|
|
191
|
+
retries: input.retries ?? JIRA_DEFAULTS.retries,
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
/** The configured site a stored credential names, or undefined. */
|
|
195
|
+
export function jiraSite(flags, siteId) {
|
|
196
|
+
return flags.sites.find((item) => item.id === siteId);
|
|
197
|
+
}
|
|
198
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/providers/jira/config.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,0BAA0B,CAAC;AAyDzC,+EAA+E;AAC/E,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,CAAC;AAEnC;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,yBAAyB,CAAC;AAEzD,MAAM,CAAC,MAAM,aAAa,GAAc,MAAM,CAAC,MAAM,CAAC;IACpD,OAAO,EAAE,IAAI;IACb,iBAAiB,EAAE,KAAK;IACxB,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;IACxB,YAAY,EAAE,IAAI;IAClB,UAAU,EAAE,IAAI;IAChB,YAAY,EAAE,IAAI;IAClB,eAAe,EAAE,IAAI;IACrB,eAAe,EAAE,IAAI;IACrB,YAAY,EAAE,IAAI;IAClB,UAAU,EAAE,IAAI;IAChB,YAAY,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;IAC/B,kBAAkB,EAAE,EAAE;IACtB,cAAc,EAAE,eAAe;IAC/B,eAAe,EAAE,GAAG;IACpB,YAAY,EAAE,MAAM;IACpB,OAAO,EAAE,CAAC;CACX,CAAC,CAAC;AAEH,MAAM,OAAO,GAAG,4BAA4B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O,EAAE,KAAK,CAAC,OAAO,IAAI,aAAa,CAAC,OAAO;KAChD,CAAC,CAAC;AACL,CAAC;AAED,mEAAmE;AACnE,MAAM,UAAU,QAAQ,CACtB,KAAgB,EAChB,MAAc;IAEd,OAAO,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,MAAM,CAAC,CAAC;AACxD,CAAC"}
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
import { IntegrationError } from "../../errors.js";
|
|
2
|
+
import { JIRA_CAPABILITY_INFO, JIRA_OPERATIONS, enabledCapabilities, jiraOperationCapability, } from "./catalog.js";
|
|
3
|
+
import { CUSTOM_FIELD_ID, jiraSite, } from "./config.js";
|
|
4
|
+
import { needsUserLookup } from "./jql.js";
|
|
5
|
+
import { JIRA_HANDLERS, JIRA_PROJECTIONS, requestedIncludes, wantsFieldNames, } from "./operations.js";
|
|
6
|
+
import { JiraTransport, credentialFromPlaintext, credentialSite, } from "./transport.js";
|
|
7
|
+
export { credentialFromPlaintext, credentialSite, } from "./transport.js";
|
|
8
|
+
/**
|
|
9
|
+
* Jira Cloud API tokens are either the classic 24-character form or the newer
|
|
10
|
+
* prefixed one (`ATATT…`, base64url-ish and long). A pasted URL, a YAML snippet
|
|
11
|
+
* or an `email:token` pair is refused before anything is sent upstream.
|
|
12
|
+
*/
|
|
13
|
+
const TOKEN_SHAPE = /^[A-Za-z0-9_-]{20,512}$/u;
|
|
14
|
+
/** The Atlassian account an API token is spent as. Not a secret; not a host. */
|
|
15
|
+
const EMAIL_SHAPE = /^[^\s@]{1,128}@[^\s@]{1,190}$/u;
|
|
16
|
+
const NO_INCLUDES = Object.freeze([]);
|
|
17
|
+
/** Deployment types this provider speaks to. Data Center is a different API. */
|
|
18
|
+
const CLOUD_DEPLOYMENT = "Cloud";
|
|
19
|
+
function accountName(displayName, email) {
|
|
20
|
+
return displayName === undefined || displayName === ""
|
|
21
|
+
? email
|
|
22
|
+
: `${displayName} (${email})`;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Jira Cloud provider: operator-configured sites over an Atlassian API token.
|
|
26
|
+
*
|
|
27
|
+
* The token is spent against the site the credential names, and that site is
|
|
28
|
+
* re-resolved from operator config on every call, so a site the deployment
|
|
29
|
+
* removed or repointed closes the connection instead of redirecting it.
|
|
30
|
+
*/
|
|
31
|
+
export class JiraProvider {
|
|
32
|
+
config;
|
|
33
|
+
id = "jira";
|
|
34
|
+
displayName = "Jira";
|
|
35
|
+
/** What this deployment allows; Jira's own permissions narrow it upstream. */
|
|
36
|
+
capabilities;
|
|
37
|
+
capabilityInfo = JIRA_CAPABILITY_INFO;
|
|
38
|
+
transport;
|
|
39
|
+
constructor(config, fetcher = fetch) {
|
|
40
|
+
this.config = config;
|
|
41
|
+
this.transport = new JiraTransport(config, config.jira, fetcher);
|
|
42
|
+
this.capabilities = Object.freeze(enabledCapabilities(config.jira));
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Keep the token, the account it belongs to and the site it was minted for.
|
|
46
|
+
* Both non-secret choices come from the connect form and from operator config,
|
|
47
|
+
* never from a tool argument, which is what keeps the broker from dialling any
|
|
48
|
+
* host the caller names.
|
|
49
|
+
*/
|
|
50
|
+
parseCredential(raw, options) {
|
|
51
|
+
const token = raw.trim();
|
|
52
|
+
if (!TOKEN_SHAPE.test(token)) {
|
|
53
|
+
throw new IntegrationError("InvalidCredential", "Use an Atlassian API token");
|
|
54
|
+
}
|
|
55
|
+
const email = (options?.["email"] ?? "").trim();
|
|
56
|
+
if (!EMAIL_SHAPE.test(email)) {
|
|
57
|
+
throw new IntegrationError("InvalidCredential", "Use the e-mail of the Atlassian account the token belongs to");
|
|
58
|
+
}
|
|
59
|
+
const site = this.resolveSite(options?.["siteId"]);
|
|
60
|
+
return {
|
|
61
|
+
credential: JSON.stringify({
|
|
62
|
+
siteId: site.id,
|
|
63
|
+
email,
|
|
64
|
+
token,
|
|
65
|
+
}),
|
|
66
|
+
portal: site.baseUrl,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
operationCapability(operation) {
|
|
70
|
+
return jiraOperationCapability(operation);
|
|
71
|
+
}
|
|
72
|
+
async validate(context) {
|
|
73
|
+
const credential = credentialFromPlaintext(context.credential);
|
|
74
|
+
const site = credentialSite(this.config.jira, credential);
|
|
75
|
+
const myself = await this.transport.getJson(site, credential, "/rest/api/3/myself");
|
|
76
|
+
const accountId = myself["accountId"];
|
|
77
|
+
if (typeof accountId !== "string" || accountId === "") {
|
|
78
|
+
throw new IntegrationError("ProviderUnavailable", "Provider identity is unavailable");
|
|
79
|
+
}
|
|
80
|
+
await this.requireCloud(site, credential);
|
|
81
|
+
const email = typeof myself["emailAddress"] === "string" &&
|
|
82
|
+
myself["emailAddress"] !== ""
|
|
83
|
+
? myself["emailAddress"]
|
|
84
|
+
: credential.email;
|
|
85
|
+
const displayName = typeof myself["displayName"] === "string" ? myself["displayName"] : "";
|
|
86
|
+
return {
|
|
87
|
+
tenantId: site.baseUrl,
|
|
88
|
+
externalUserId: accountId,
|
|
89
|
+
displayName: accountName(displayName, email),
|
|
90
|
+
// Jira reports no granted scopes for an API token, so the deployment
|
|
91
|
+
// switches are the whole local boundary and the site's own permissions
|
|
92
|
+
// decide upstream.
|
|
93
|
+
capabilities: this.capabilities,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
async execute(context, operation, input) {
|
|
97
|
+
const credential = credentialFromPlaintext(context.credential);
|
|
98
|
+
const site = credentialSite(this.config.jira, credential);
|
|
99
|
+
const definition = JIRA_OPERATIONS[operation];
|
|
100
|
+
const handler = JIRA_HANDLERS[operation];
|
|
101
|
+
if (definition === undefined || handler === undefined) {
|
|
102
|
+
throw new IntegrationError("InvalidRequest", "Unsupported Jira operation");
|
|
103
|
+
}
|
|
104
|
+
const flags = this.config.jira;
|
|
105
|
+
// Two values a question carries but Jira cannot take as they stand: a custom
|
|
106
|
+
// field named by its business term instead of its instance id, and a person
|
|
107
|
+
// named the way a person actually has a name ("задачи Иванова"). Both are
|
|
108
|
+
// turned into what Jira filters on before the query is built.
|
|
109
|
+
const prepared = operation === "issues.search"
|
|
110
|
+
? await this.resolvePeople(site, credential, this.applyFieldAliases(input, flags))
|
|
111
|
+
: input;
|
|
112
|
+
const request = handler(prepared, {
|
|
113
|
+
externalUserId: context.externalUserId,
|
|
114
|
+
flags,
|
|
115
|
+
});
|
|
116
|
+
const include = operation === "issues.get"
|
|
117
|
+
? requestedIncludes(input["include"])
|
|
118
|
+
: NO_INCLUDES;
|
|
119
|
+
const data = await this.transport.getJson(site, credential, request.path, request.query);
|
|
120
|
+
// The schema is read only after the issue answered and only when the model
|
|
121
|
+
// asked for named custom fields: an issue that is not there has nothing to
|
|
122
|
+
// name, and the extra call would have been spent for nothing.
|
|
123
|
+
const fieldNames = wantsFieldNames(include) && flags.fieldsRead
|
|
124
|
+
? await this.fieldNames(site, credential)
|
|
125
|
+
: undefined;
|
|
126
|
+
const projection = JIRA_PROJECTIONS[operation];
|
|
127
|
+
const projected = projection === undefined
|
|
128
|
+
? data
|
|
129
|
+
: projection(data, {
|
|
130
|
+
flags,
|
|
131
|
+
site,
|
|
132
|
+
include,
|
|
133
|
+
fieldNames,
|
|
134
|
+
issueKey: typeof input["issueKey"] === "string"
|
|
135
|
+
? input["issueKey"]
|
|
136
|
+
: undefined,
|
|
137
|
+
});
|
|
138
|
+
return typeof projected === "object" &&
|
|
139
|
+
projected !== null &&
|
|
140
|
+
!Array.isArray(projected)
|
|
141
|
+
? projected
|
|
142
|
+
: { value: projected ?? null };
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Replace a custom field's alias with the instance id the operator mapped it
|
|
146
|
+
* to. The mapping lives in the deployment's config on purpose: which of an
|
|
147
|
+
* instance's fields carries "the product" is knowledge about that instance,
|
|
148
|
+
* not about this provider, so the repository ships no field id and the
|
|
149
|
+
* deployment declares its own names.
|
|
150
|
+
*
|
|
151
|
+
* A name that is neither an id nor a configured alias is refused here, with
|
|
152
|
+
* the aliases this deployment does declare, because a silently unresolved
|
|
153
|
+
* field would answer "no such issues" instead of "unknown field".
|
|
154
|
+
*/
|
|
155
|
+
applyFieldAliases(input, flags) {
|
|
156
|
+
const requested = input["customFields"];
|
|
157
|
+
if (!Array.isArray(requested))
|
|
158
|
+
return input;
|
|
159
|
+
const aliases = flags.fieldAliases;
|
|
160
|
+
const names = Object.keys(aliases).sort();
|
|
161
|
+
const resolved = requested.map((entry) => {
|
|
162
|
+
if (typeof entry !== "object" || entry === null || Array.isArray(entry)) {
|
|
163
|
+
return entry;
|
|
164
|
+
}
|
|
165
|
+
const record = entry;
|
|
166
|
+
const name = typeof record["field"] === "string" ? record["field"].trim() : "";
|
|
167
|
+
if (name === "" || CUSTOM_FIELD_ID.test(name))
|
|
168
|
+
return entry;
|
|
169
|
+
const id = aliases[name];
|
|
170
|
+
if (id !== undefined)
|
|
171
|
+
return { ...record, field: id };
|
|
172
|
+
throw new IntegrationError("InvalidRequest", names.length === 0
|
|
173
|
+
? `customFields.field "${name}" is not a customfield_ id; this deployment configured no aliases`
|
|
174
|
+
: `customFields.field "${name}" is not a customfield_ id or a configured alias (${names.join(", ")})`);
|
|
175
|
+
});
|
|
176
|
+
return { ...input, customFields: resolved };
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Replace a person's name with the account id Jira filters on, for the two
|
|
180
|
+
* filters that can carry one. `me` and an account id are already what Jira
|
|
181
|
+
* wants and cost no call.
|
|
182
|
+
*
|
|
183
|
+
* The directory is a read of the site's own user list, bounded to ten hits,
|
|
184
|
+
* and its answer is never handed to the model: it only decides the id the
|
|
185
|
+
* query is built from. A name nobody matches, or a name several people share,
|
|
186
|
+
* is refused with what to do next — an account id from an issue — because the
|
|
187
|
+
* alternative is a query that quietly answers "no such issues".
|
|
188
|
+
*/
|
|
189
|
+
async resolvePeople(site, credential, input) {
|
|
190
|
+
const resolved = { ...input };
|
|
191
|
+
for (const field of ["assignee", "reporter"]) {
|
|
192
|
+
const value = input[field];
|
|
193
|
+
if (!needsUserLookup(value))
|
|
194
|
+
continue;
|
|
195
|
+
resolved[field] = await this.accountIdFor(site, credential, field, String(value).trim());
|
|
196
|
+
}
|
|
197
|
+
return resolved;
|
|
198
|
+
}
|
|
199
|
+
async accountIdFor(site, credential, field, query) {
|
|
200
|
+
const users = await this.transport.getJson(site, credential, "/rest/api/3/user/search", { query, maxResults: 10 });
|
|
201
|
+
const byId = new Map();
|
|
202
|
+
for (const entry of Array.isArray(users) ? users : []) {
|
|
203
|
+
if (typeof entry !== "object" || entry === null)
|
|
204
|
+
continue;
|
|
205
|
+
const record = entry;
|
|
206
|
+
const accountId = record["accountId"];
|
|
207
|
+
if (typeof accountId !== "string" || accountId === "")
|
|
208
|
+
continue;
|
|
209
|
+
if (record["active"] === false)
|
|
210
|
+
continue;
|
|
211
|
+
const displayName = typeof record["displayName"] === "string"
|
|
212
|
+
? record["displayName"]
|
|
213
|
+
: accountId;
|
|
214
|
+
byId.set(accountId, displayName);
|
|
215
|
+
}
|
|
216
|
+
const matches = [...byId.entries()];
|
|
217
|
+
if (matches.length === 1 && matches[0] !== undefined)
|
|
218
|
+
return matches[0][0];
|
|
219
|
+
if (matches.length === 0) {
|
|
220
|
+
throw new IntegrationError("InvalidRequest", `${field} matches no Jira user named "${query}"; pass the accountId an issue reported, or "me"`);
|
|
221
|
+
}
|
|
222
|
+
const names = matches
|
|
223
|
+
.slice(0, 3)
|
|
224
|
+
.map(([, displayName]) => displayName)
|
|
225
|
+
.join(", ");
|
|
226
|
+
throw new IntegrationError("InvalidRequest", `${field} "${query}" matches ${matches.length} Jira users (${names}); pass the accountId an issue reported`);
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* The site's field schema, read only when an issue read was asked to name
|
|
230
|
+
* custom fields. It is not cached: the same site answers a different list to
|
|
231
|
+
* two users with different permissions, and a cross-user cache would be a leak
|
|
232
|
+
* for the sake of one call.
|
|
233
|
+
*/
|
|
234
|
+
async fieldNames(site, credential) {
|
|
235
|
+
const fields = await this.transport.getJson(site, credential, "/rest/api/3/field");
|
|
236
|
+
const names = new Map();
|
|
237
|
+
if (!Array.isArray(fields))
|
|
238
|
+
return names;
|
|
239
|
+
for (const entry of fields) {
|
|
240
|
+
if (typeof entry !== "object" || entry === null)
|
|
241
|
+
continue;
|
|
242
|
+
const record = entry;
|
|
243
|
+
const id = record["id"];
|
|
244
|
+
const name = record["name"];
|
|
245
|
+
if (typeof id === "string" && typeof name === "string" && name !== "") {
|
|
246
|
+
names.set(id, name);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
return names;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* The provider speaks the Cloud-only `/rest/api/3` surface. A Data Center
|
|
253
|
+
* instance answers a different API, and the specification forbids treating it
|
|
254
|
+
* as silently compatible, so the deployment type is checked once, at connect:
|
|
255
|
+
* a site that names a type other than Cloud is refused. A site that does not
|
|
256
|
+
* serve the endpoint at all — an older tenant, a proxy that hides it — is left
|
|
257
|
+
* to the identity call that already succeeded instead of failing on a probe
|
|
258
|
+
* that proves nothing either way.
|
|
259
|
+
*/
|
|
260
|
+
async requireCloud(site, credential) {
|
|
261
|
+
let info;
|
|
262
|
+
try {
|
|
263
|
+
info = await this.transport.getJson(site, credential, "/rest/api/3/serverInfo");
|
|
264
|
+
}
|
|
265
|
+
catch (error) {
|
|
266
|
+
if (error instanceof IntegrationError &&
|
|
267
|
+
(error.code === "ResourceNotFound" ||
|
|
268
|
+
error.code === "ProviderPermissionDenied")) {
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
throw error;
|
|
272
|
+
}
|
|
273
|
+
const deployment = info["deploymentType"];
|
|
274
|
+
if (typeof deployment !== "string" || deployment === "")
|
|
275
|
+
return;
|
|
276
|
+
if (deployment !== CLOUD_DEPLOYMENT) {
|
|
277
|
+
throw new IntegrationError("InvalidCredential", `Jira ${deployment} is not supported; this provider speaks Jira Cloud`);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
resolveSite(requested) {
|
|
281
|
+
const flags = this.config.jira;
|
|
282
|
+
const id = requested?.trim();
|
|
283
|
+
if (id !== undefined && id !== "") {
|
|
284
|
+
const site = jiraSite(flags, id);
|
|
285
|
+
if (site === undefined) {
|
|
286
|
+
throw new IntegrationError("InvalidCredential", "Unknown Jira site");
|
|
287
|
+
}
|
|
288
|
+
return site;
|
|
289
|
+
}
|
|
290
|
+
const [only] = flags.sites;
|
|
291
|
+
if (only === undefined) {
|
|
292
|
+
throw new IntegrationError("InvalidCredential", "No Jira site is configured");
|
|
293
|
+
}
|
|
294
|
+
if (flags.sites.length > 1) {
|
|
295
|
+
throw new IntegrationError("InvalidCredential", "Choose a Jira site");
|
|
296
|
+
}
|
|
297
|
+
return only;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
export default JiraProvider;
|
|
301
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/providers/jira/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAOnD,OAAO,EACL,oBAAoB,EACpB,eAAe,EACf,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,eAAe,EACf,QAAQ,GAGT,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,GAChB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,aAAa,EACb,uBAAuB,EACvB,cAAc,GAEf,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,uBAAuB,EACvB,cAAc,GAEf,MAAM,gBAAgB,CAAC;AAExB;;;;GAIG;AACH,MAAM,WAAW,GAAG,0BAA0B,CAA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