@eyeauras/youtrack-cli 0.7.1 → 0.8.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/README.md +57 -11
- package/dist/src/cli-support.d.ts +8 -6
- package/dist/src/cli-support.d.ts.map +1 -1
- package/dist/src/cli-support.js +26 -7
- package/dist/src/cli-support.js.map +1 -1
- package/dist/src/cli.d.ts.map +1 -1
- package/dist/src/cli.js +9 -5
- package/dist/src/cli.js.map +1 -1
- package/dist/src/client.d.ts +16 -9
- package/dist/src/client.d.ts.map +1 -1
- package/dist/src/client.js +80 -30
- package/dist/src/client.js.map +1 -1
- package/dist/src/index.d.ts +6 -5
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +5 -4
- package/dist/src/index.js.map +1 -1
- package/dist/src/issue-attachments-commands.d.ts.map +1 -1
- package/dist/src/issue-attachments-commands.js +7 -4
- package/dist/src/issue-attachments-commands.js.map +1 -1
- package/dist/src/issue-attachments.d.ts +5 -3
- package/dist/src/issue-attachments.d.ts.map +1 -1
- package/dist/src/issue-attachments.js +12 -3
- package/dist/src/issue-attachments.js.map +1 -1
- package/dist/src/issue-context-commands.d.ts.map +1 -1
- package/dist/src/issue-context-commands.js +23 -5
- package/dist/src/issue-context-commands.js.map +1 -1
- package/dist/src/issue-context.d.ts +11 -4
- package/dist/src/issue-context.d.ts.map +1 -1
- package/dist/src/issue-context.js +15 -3
- package/dist/src/issue-context.js.map +1 -1
- package/dist/src/issue-fields-commands.d.ts.map +1 -1
- package/dist/src/issue-fields-commands.js +2 -2
- package/dist/src/issue-fields-commands.js.map +1 -1
- package/dist/src/issue-fields.d.ts +4 -4
- package/dist/src/issue-fields.d.ts.map +1 -1
- package/dist/src/issue-fields.js +7 -7
- package/dist/src/issue-fields.js.map +1 -1
- package/dist/src/issue-reactions-commands.d.ts +2 -0
- package/dist/src/issue-reactions-commands.d.ts.map +1 -0
- package/dist/src/issue-reactions-commands.js +11 -0
- package/dist/src/issue-reactions-commands.js.map +1 -0
- package/dist/src/issue-reactions.d.ts +6 -0
- package/dist/src/issue-reactions.d.ts.map +1 -0
- package/dist/src/issue-reactions.js +15 -0
- package/dist/src/issue-reactions.js.map +1 -0
- package/dist/src/issue-relations-commands.d.ts.map +1 -1
- package/dist/src/issue-relations-commands.js +8 -7
- package/dist/src/issue-relations-commands.js.map +1 -1
- package/dist/src/issue-relations.d.ts +10 -9
- package/dist/src/issue-relations.d.ts.map +1 -1
- package/dist/src/issue-relations.js +16 -10
- package/dist/src/issue-relations.js.map +1 -1
- package/dist/src/issue-time-commands.d.ts.map +1 -1
- package/dist/src/issue-time-commands.js +20 -6
- package/dist/src/issue-time-commands.js.map +1 -1
- package/dist/src/issue-time.d.ts +18 -4
- package/dist/src/issue-time.d.ts.map +1 -1
- package/dist/src/issue-time.js +22 -4
- package/dist/src/issue-time.js.map +1 -1
- package/dist/src/presentation.d.ts +5 -0
- package/dist/src/presentation.d.ts.map +1 -1
- package/dist/src/presentation.js +30 -0
- package/dist/src/presentation.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -23,10 +23,10 @@ for each profile and reimport auxiliary secrets. Existing profiles and permissio
|
|
|
23
23
|
Licensed under MIT. See the [release guide](docs/release.md).
|
|
24
24
|
|
|
25
25
|
YouTrack consumes the exact published `@eyeauras/cli-factory` version declared in package.json. The CLI
|
|
26
|
-
provides standard profiles/auth/permissions and
|
|
26
|
+
provides standard profiles/auth/permissions and 128 REST operations: 103 ReadOnly and 25 Update.
|
|
27
27
|
Five workflow leaves reuse those operations instead of adding REST operations: issue and article
|
|
28
|
-
attachment download, article export, and `issues batch validate/apply`. There are
|
|
29
|
-
leaves:
|
|
28
|
+
attachment download, article export, and `issues batch validate/apply`. There are 131 service
|
|
29
|
+
leaves: 126 for REST operations plus these five. Two `--direct` selectors each select a second
|
|
30
30
|
REST endpoint without adding another leaf.
|
|
31
31
|
The foundational read projections are:
|
|
32
32
|
|
|
@@ -48,7 +48,7 @@ onboarding or credential access on CLI, execute and RPC. The static errors are
|
|
|
48
48
|
`--page-size must be a nonnegative safe decimal integer.` and
|
|
49
49
|
`--start must be a nonnegative integer.`; they never include the supplied input.
|
|
50
50
|
Directly callable service methods retain their own range validation.
|
|
51
|
-
All
|
|
51
|
+
All 49 offset lists return `{count,items,hasMore,nextStart}` across library, CLI, execute and RPC.
|
|
52
52
|
Each ordinary list makes one request without lookahead and rejects an oversized server page.
|
|
53
53
|
Nonempty pages have `hasMore:null`, including short pages: a server cap is not end evidence.
|
|
54
54
|
Continue at `nextStart`, which advances by actual returned rows. A positive-size empty page has
|
|
@@ -80,13 +80,13 @@ npm start -- issues comments list DEMO-1 --page-size 3 --profile youtrack-dev
|
|
|
80
80
|
```
|
|
81
81
|
|
|
82
82
|
Handlers return domain values for human, `--json` and persistent `--json-rpc` output.
|
|
83
|
-
Empty collections
|
|
83
|
+
Empty offset collections have an empty `items` array. Signed/credential-bearing URLs and the active bearer token are
|
|
84
84
|
scrubbed recursively, including explicitly projected nested fields. Unsigned URLs remain
|
|
85
85
|
unchanged. An HTTP error status fails with Core's `HttpError` (`YouTrack answered HTTP 404.`,
|
|
86
86
|
codes `http.notFound`, `http.unauthorized` with an `auth login` follow-up, `http.rateLimited` with
|
|
87
87
|
safe Retry-After text, and so on), never with raw server errors or authentication material.
|
|
88
88
|
Remote mutations require the Update gate, described below. The ReadOnly download and export
|
|
89
|
-
commands write only their explicitly requested local file
|
|
89
|
+
commands write only their explicitly requested local file in the invocation directory or explicit output path.
|
|
90
90
|
|
|
91
91
|
### Reading output
|
|
92
92
|
|
|
@@ -108,12 +108,58 @@ Compressed wire length is syntax-checked but not compared with decoded size. HTT
|
|
|
108
108
|
Retry-After, empty/null mutation and UTF-8 BOM behavior are unchanged. No request is retried
|
|
109
109
|
automatically. Runtime memory and service limits still apply.
|
|
110
110
|
|
|
111
|
+
## M01: issue workflows in 0.8.0
|
|
112
|
+
|
|
113
|
+
The API inventory is frozen at 282 published operations (281 business routes plus schema metadata).
|
|
114
|
+
M01 exposes 128 routes. Complete operation contracts cover 119/282 (42.20%); nine reachable routes
|
|
115
|
+
still have explicitly deferred request controls. The [frozen audit](docs/rest-api-coverage/README.md)
|
|
116
|
+
and [current mapping](docs/rest-api-coverage/current/coverage.json) keep these measures separate.
|
|
117
|
+
|
|
118
|
+
- `issues list --custom-field <name>` is repeatable. Names, order and duplicates are preserved
|
|
119
|
+
as repeated native `customFields` parameters, including every request made by `--all`.
|
|
120
|
+
- `issues activity list <issueID> --categories <categories>` reads one offset page;
|
|
121
|
+
`issues activity get <issueID> <activityID>` reads one item. These differ from the native
|
|
122
|
+
`issues activity page` cursor resource. The issue list/page support `--author`,
|
|
123
|
+
`--activity-start` and `--activity-end`; only the cursor page accepts `--activity-id`.
|
|
124
|
+
Cursor values and direction remain opaque, without automatic traversal. Activity time bounds
|
|
125
|
+
remain literal API strings, including native Long values.
|
|
126
|
+
- Issue create/update, custom-field set, comment add/update, attachment upload, link add and
|
|
127
|
+
work-item add/update accept `--fields` and `--mute-update-notifications [boolean]`.
|
|
128
|
+
An omitted notification flag sends no parameter; a bare flag means true, and `false` is sent
|
|
129
|
+
as false. The server enforces Apply Commands Silently; this does not mute workflow notifications.
|
|
130
|
+
Only issue create and comment add accept `--draft-id`. Keep `--body` required; use `{}` when
|
|
131
|
+
publishing a draft without additional fields. Normal issue creation still requires project/summary.
|
|
132
|
+
- `work-items list` adds repeatable `--author` and `--creator`, `--start-date`, `--end-date`, `--work-start`,
|
|
133
|
+
`--work-end`, `--created-start`, `--created-end`, `--updated-start`, `--updated-end`.
|
|
134
|
+
`--start` stays the raw offset; `--work-start` selects the native temporal `start` filter.
|
|
135
|
+
Filter values remain literal strings so a native Long does not lose precision in JavaScript.
|
|
136
|
+
YouTrack validates date formats, interval semantics and applicability.
|
|
137
|
+
- `tags list --query <query>` searches the tag catalogue. `issues tags get <issueID> <tagID>`
|
|
138
|
+
inspects one assignment; tag add and existing tag/link remove commands accept `--fields`.
|
|
139
|
+
- `issues attachments update <issueID> <attachmentID> --body <json>` updates native metadata.
|
|
140
|
+
`issues attachments delete <issueID> <attachmentID>` and
|
|
141
|
+
`issues work-items delete <issueID> <itemID>` remove only the selected resource.
|
|
142
|
+
|
|
143
|
+
Write failures after submission report an unknown outcome when the reply is lost, unreadable or
|
|
144
|
+
invalid, or the server returns 5xx. Check the selected object before retrying; no automatic retry
|
|
145
|
+
is performed. HTTP 4xx rejection and local validation keep their distinct diagnostics.
|
|
146
|
+
- `issues comments reaction list/get/add/remove` take issue/comment IDs, plus a reaction ID
|
|
147
|
+
for get/remove. Add requires `--body` containing native `reaction`; names are not restricted
|
|
148
|
+
to a hard-coded list. Reads use ReadOnly; add/remove use Update, even when remote service
|
|
149
|
+
permissions call these operations reads.
|
|
150
|
+
|
|
151
|
+
Every new read/write supports `--fields`. DELETE projections follow the explicit official
|
|
152
|
+
parameter tables; an omitted projection preserves the prior query-free DELETE. Successful empty
|
|
153
|
+
write bodies return JSON null; nonempty native results are scrubbed as usual. Optional fields do
|
|
154
|
+
not imply response/version guarantees beyond the public contract. All writes stay Update-gated,
|
|
155
|
+
with no implicit lookup, automatic retry, target expansion or binary transfer follow-up.
|
|
156
|
+
|
|
111
157
|
## URL and token input
|
|
112
158
|
|
|
113
159
|
Copy the service base address, for example `https://youtrack.example.test/youtrack/`. Include any context path and port; omit `/api`, issue pages and query strings. HTTP and HTTPS are supported. Context segments named `api`, `app/rest`, `admin` or `issues` are
|
|
114
160
|
valid deployment contexts; the CLI appends its own service endpoints to the configured base.
|
|
115
161
|
Create/copy a permanent token in your YouTrack profile with the **YouTrack** service scope.
|
|
116
|
-
See the [permanent-token guide](https://www.jetbrains.com/help/youtrack/devportal/Manage-Permanent-Token.html). Paste only its value: `FICTIONAL_TOKEN_VALUE` is a fictional example.
|
|
162
|
+
See the [optional API reference: permanent-token guide](https://www.jetbrains.com/help/youtrack/devportal/Manage-Permanent-Token.html). Paste only its value: `FICTIONAL_TOKEN_VALUE` is a fictional example.
|
|
117
163
|
Do not include `Bearer `, `Authorization:`, or surrounding quotes. The same guidance appears in
|
|
118
164
|
`profile configure --help`, `auth login --help`, and before interactive input.
|
|
119
165
|
|
|
@@ -149,8 +195,8 @@ without `/api`, credentials, query or fragment. Normal redirects are followed, i
|
|
|
149
195
|
same-host HTTP-to-HTTPS upgrades with authentication. Other origin changes remove credentials.
|
|
150
196
|
|
|
151
197
|
Create a token in your YouTrack profile with the YouTrack service scope and only the
|
|
152
|
-
account permissions you need. See JetBrains' [permanent token documentation](https://www.jetbrains.com/help/youtrack/devportal/authentication-with-permanent-token.html).
|
|
153
|
-
The identity fields follow [My User Profile](https://www.jetbrains.com/help/youtrack/devportal/resource-api-users-me.html).
|
|
198
|
+
account permissions you need. See JetBrains' [optional API reference: permanent token documentation](https://www.jetbrains.com/help/youtrack/devportal/authentication-with-permanent-token.html).
|
|
199
|
+
The identity fields follow [optional API reference: My User Profile](https://www.jetbrains.com/help/youtrack/devportal/resource-api-users-me.html).
|
|
154
200
|
|
|
155
201
|
The candidate is validated before storage in the operating-system credential store.
|
|
156
202
|
Non-secret profiles live in current-user AppData for application `youtrack-cli`; the
|
|
@@ -427,7 +473,7 @@ a `CliError` carrying `.result`.
|
|
|
427
473
|
|
|
428
474
|
This is a breaking change: scripts that previously relied on exit 0 plus `status: incomplete`
|
|
429
475
|
must now handle the failure path and read the same summary from the appropriate surface.
|
|
430
|
-
See the [0.6.1 release notes](https://github.com/iXab3r/EyeAuras.CliFactory/blob/
|
|
476
|
+
See the [optional provenance: 0.6.1 release notes](https://github.com/iXab3r/EyeAuras.CliFactory/blob/bf79b80636bcdd790bbd6c25648842ae5213f267/CHANGELOG.md#061).
|
|
431
477
|
|
|
432
478
|
`--failed-rows <path.json>` saves the `failed` and `unattempted` rows
|
|
433
479
|
as a manifest at the requested path relative to the invocation working directory for deliberate resubmission; `uncertain` rows are left out and must
|
|
@@ -477,7 +523,7 @@ are not availability evidence, and failed prerequisites still fail the overall p
|
|
|
477
523
|
writes, automatic pagination or further resource discovery occur. CI and arbitrary URL/token/
|
|
478
524
|
command arguments are refused; inherited `YOUTRACK_TOKEN` is removed case-insensitively.
|
|
479
525
|
The shared Core proof invoker keeps the 30-second timeout and separate 64-KiB stdout/stderr bounds;
|
|
480
|
-
see the [shared CI and process contract](
|
|
526
|
+
see the [shared CI and process contract](docs/testing.md).
|
|
481
527
|
Do not run it in CI or add it to generic test commands. A failed proof requires local
|
|
482
528
|
configuration/TLS/permission investigation; its payloads are deliberately not logged.
|
|
483
529
|
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { type CommandContext, type CommandDefinition, type GatedTargetCommand, type HumanView, type OptionDefinition } from "@eyeauras/cli-factory";
|
|
2
|
-
import { type Connection, type IssueSearchOptions } from "./client.js";
|
|
2
|
+
import { type Connection, type IssueSearchOptions, type WriteOptions } from "./client.js";
|
|
3
3
|
export declare const bodyOptions: readonly OptionDefinition[];
|
|
4
4
|
export declare const fileOption: (flags: string, description: string, required?: boolean) => OptionDefinition;
|
|
5
5
|
/** Read one caller-selected file as strict UTF-8 (initial BOM removed); call only inside an admitted handler. */
|
|
6
6
|
export declare function readTextFile(path: string): Promise<string>;
|
|
7
7
|
export declare const projectionOptions: readonly OptionDefinition[];
|
|
8
|
+
/** Omitted controls remain omitted; an explicit false travels to the native API. */
|
|
9
|
+
export declare const notificationOptions: readonly OptionDefinition[];
|
|
10
|
+
export declare const draftOptions: readonly OptionDefinition[];
|
|
11
|
+
export declare function writeOptions(options: Record<string, unknown>): WriteOptions;
|
|
8
12
|
export declare const pageOptions: readonly OptionDefinition[];
|
|
9
13
|
export declare function connection(context: CommandContext): Promise<Connection>;
|
|
10
14
|
export declare const readTarget: GatedTargetCommand<Connection>, updateCommand: GatedTargetCommand<Connection>;
|
|
@@ -13,12 +17,10 @@ export declare const readCommand: GatedTargetCommand<Connection>;
|
|
|
13
17
|
type PositionalValues<Text extends string> = Text extends `<${string}> ${infer Rest}` ? [string, ...PositionalValues<Rest>] : Text extends `<${string}>` ? [string] : [];
|
|
14
18
|
type CommandValues<Syntax extends string> = Syntax extends `${string} ${infer Arguments}` ? PositionalValues<Arguments> : [];
|
|
15
19
|
type ReadOperation<Syntax extends string> = (connection: Connection, ...arguments_: [...CommandValues<Syntax>, IssueSearchOptions]) => unknown;
|
|
16
|
-
type
|
|
17
|
-
|
|
18
|
-
export declare function pagedRead<const Syntax extends string>(syntax: Syntax, description: string, operation: ReadOperation<Syntax>, view?: HumanView): CommandDefinition;
|
|
20
|
+
type ProjectedBodyOperation<Syntax extends string> = (connection: Connection, ...arguments_: [...CommandValues<Syntax>, unknown, WriteOptions]) => unknown;
|
|
21
|
+
export declare function pagedRead<const Syntax extends string>(syntax: Syntax, description: string, operation: ReadOperation<Syntax>, view?: HumanView, extraOptions?: readonly OptionDefinition[]): CommandDefinition;
|
|
19
22
|
export declare function projectedRead<const Syntax extends string>(syntax: Syntax, description: string, operation: ReadOperation<Syntax>, view?: HumanView): CommandDefinition;
|
|
20
|
-
export declare function
|
|
21
|
-
export declare function projectedBodyUpdate<const Syntax extends string>(syntax: Syntax, description: string, operation: ProjectedBodyOperation<Syntax>, textField?: string, view?: HumanView): CommandDefinition;
|
|
23
|
+
export declare function projectedBodyUpdate<const Syntax extends string>(syntax: Syntax, description: string, operation: ProjectedBodyOperation<Syntax>, textField?: string, view?: HumanView, extraOptions?: readonly OptionDefinition[]): CommandDefinition;
|
|
22
24
|
export declare function readOptions(options: Record<string, unknown>): IssueSearchOptions;
|
|
23
25
|
export {};
|
|
24
26
|
//# sourceMappingURL=cli-support.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-support.d.ts","sourceRoot":"","sources":["../../src/cli-support.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,SAAS,EACd,KAAK,gBAAgB,EACtB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAoC,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CAAC,EACzC,SAAS,CAAC,EAAE,MAAM,EAClB,IAAI,CAAC,EAAE,SAAS,EAChB,YAAY,GAAE,SAAS,gBAAgB,EAAO,GAC7C,iBAAiB,CAOnB;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,kBAAkB,CAUhF"}
|
package/dist/src/cli-support.js
CHANGED
|
@@ -53,6 +53,27 @@ async function bodyInput(options, textField) {
|
|
|
53
53
|
export const projectionOptions = [
|
|
54
54
|
{ flags: "--fields <projection>", description: "YouTrack fields projection" },
|
|
55
55
|
];
|
|
56
|
+
/** Omitted controls remain omitted; an explicit false travels to the native API. */
|
|
57
|
+
export const notificationOptions = [{
|
|
58
|
+
flags: "--mute-update-notifications [boolean]", description: "Suppress notifications (true or false)",
|
|
59
|
+
parse(value) {
|
|
60
|
+
if (value === "true")
|
|
61
|
+
return true;
|
|
62
|
+
if (value === "false")
|
|
63
|
+
return false;
|
|
64
|
+
throw new Error("The notification control must be true or false.");
|
|
65
|
+
},
|
|
66
|
+
}];
|
|
67
|
+
export const draftOptions = [
|
|
68
|
+
{ flags: "--draft-id <id>", description: "Publish an existing draft" },
|
|
69
|
+
];
|
|
70
|
+
export function writeOptions(options) {
|
|
71
|
+
return {
|
|
72
|
+
...(typeof options.fields === "string" ? { fields: options.fields } : {}),
|
|
73
|
+
...(typeof options.draftId === "string" ? { draftId: options.draftId } : {}),
|
|
74
|
+
...(typeof options.muteUpdateNotifications === "boolean" ? { muteUpdateNotifications: options.muteUpdateNotifications } : {}),
|
|
75
|
+
};
|
|
76
|
+
}
|
|
56
77
|
export const pageOptions = [
|
|
57
78
|
...projectionOptions,
|
|
58
79
|
{
|
|
@@ -117,17 +138,14 @@ function operationCommand(leaf, syntax, description, operation, options, operati
|
|
|
117
138
|
]), options);
|
|
118
139
|
return view === undefined ? definition : withView(view, definition);
|
|
119
140
|
}
|
|
120
|
-
export function pagedRead(syntax, description, operation, view) {
|
|
121
|
-
return operationCommand(readCommand, syntax, description, operation, pageOptions, (options) => [readOptions(options)], view);
|
|
141
|
+
export function pagedRead(syntax, description, operation, view, extraOptions = []) {
|
|
142
|
+
return operationCommand(readCommand, syntax, description, operation, [...pageOptions, ...extraOptions], (options) => [readOptions(options)], view);
|
|
122
143
|
}
|
|
123
144
|
export function projectedRead(syntax, description, operation, view) {
|
|
124
145
|
return operationCommand(readCommand, syntax, description, operation, projectionOptions, (options) => [readOptions(options)], view);
|
|
125
146
|
}
|
|
126
|
-
export function
|
|
127
|
-
return operationCommand(updateCommand, syntax, description, operation, bodyInputOptions(textField), async (options) => [await bodyInput(options, textField)], view);
|
|
128
|
-
}
|
|
129
|
-
export function projectedBodyUpdate(syntax, description, operation, textField, view) {
|
|
130
|
-
return operationCommand(updateCommand, syntax, description, operation, [...bodyInputOptions(textField), ...projectionOptions], async (options) => [await bodyInput(options, textField), readOptions(options)], view);
|
|
147
|
+
export function projectedBodyUpdate(syntax, description, operation, textField, view, extraOptions = []) {
|
|
148
|
+
return operationCommand(updateCommand, syntax, description, operation, [...bodyInputOptions(textField), ...projectionOptions, ...extraOptions], async (options) => [await bodyInput(options, textField), writeOptions(options)], view);
|
|
131
149
|
}
|
|
132
150
|
export function readOptions(options) {
|
|
133
151
|
return {
|
|
@@ -135,6 +153,7 @@ export function readOptions(options) {
|
|
|
135
153
|
...(typeof options.pageSize === "number" ? { pageSize: options.pageSize } : {}),
|
|
136
154
|
...(typeof options.start === "number" ? { start: options.start } : {}),
|
|
137
155
|
...(typeof options.query === "string" ? { query: options.query } : {}),
|
|
156
|
+
...(Array.isArray(options.customField) ? { customFields: options.customField } : {}),
|
|
138
157
|
...(typeof options.maxResults === "number" ? { maxResults: options.maxResults } : {}),
|
|
139
158
|
...(typeof options.maxBytes === "number" ? { maxBytes: options.maxBytes } : {}),
|
|
140
159
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-support.js","sourceRoot":"","sources":["../../src/cli-support.ts"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AAC,CAAC,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACrF,GAAG,CAAC,OAAO,OAAO,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAChF,CAAC;AACJ,CAAC"}
|
package/dist/src/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,cAAc,EACnB,KAAK,UAAU,EAChB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,cAAc,EACnB,KAAK,UAAU,EAChB,MAAM,uBAAuB,CAAC;AA4E/B,wBAAgB,iBAAiB,CAAC,OAAO,CAAC,EAAE,UAAU,GAAG,cAAc,CAgJtE"}
|
package/dist/src/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { command, createCli, helpLayout, integerParser, Permission, tokenAuth, } from "@eyeauras/cli-factory";
|
|
2
2
|
import { addComment, currentUser, getIssue, listComments, listIssues, listProjects, readUser, youTrackUrl, youTrackUrlHelp, } from "./client.js";
|
|
3
|
-
import {
|
|
3
|
+
import { projectedBodyUpdate, notificationOptions, draftOptions, fileOption, pagedRead, pageOptions, projectedRead, readCommand, readOptions, readTextFile, updateCommand, } from "./cli-support.js";
|
|
4
4
|
import { downloadLimit } from "./attachment-download.js";
|
|
5
5
|
import { applyIssueBatch, manifestRows } from "./issue-batch.js";
|
|
6
6
|
import { createIssue, updateIssue } from "./issue-fields.js";
|
|
@@ -40,7 +40,7 @@ export function createYouTrackCli(runtime) {
|
|
|
40
40
|
name: "youtrack-cli",
|
|
41
41
|
description: "AI-friendly access to YouTrack",
|
|
42
42
|
examples: [...issueExamples.slice(0, 3), "article get KB-A-7", "project list"],
|
|
43
|
-
version: "0.
|
|
43
|
+
version: "0.8.0",
|
|
44
44
|
applicationId: "youtrack-cli",
|
|
45
45
|
permissions: {},
|
|
46
46
|
profile: {
|
|
@@ -103,13 +103,17 @@ export function createYouTrackCli(runtime) {
|
|
|
103
103
|
...fieldsIssueChildren,
|
|
104
104
|
...attachmentsIssueChildren,
|
|
105
105
|
...queryIssueChildren,
|
|
106
|
-
|
|
107
|
-
|
|
106
|
+
projectedBodyUpdate("create", "Create an issue", createIssue, "description", createdIssue, [...notificationOptions, ...draftOptions]),
|
|
107
|
+
projectedBodyUpdate("update <issueID>", "Update the summary, description or custom fields", updateIssue, "description", updatedIssue, notificationOptions),
|
|
108
108
|
withView(issueTable, readCommand("list", "Search issues", (client, { options }, context) => {
|
|
109
109
|
return listIssues(client, { ...readOptions(options), progress: context.progress });
|
|
110
110
|
}, [
|
|
111
111
|
...pageOptions,
|
|
112
112
|
{ flags: "--query <query>", description: "YouTrack search query" },
|
|
113
|
+
{
|
|
114
|
+
flags: "--custom-field <name>", description: "Select a custom field (repeatable)",
|
|
115
|
+
parse: (value, previous) => [...(Array.isArray(previous) ? previous : []), value],
|
|
116
|
+
},
|
|
113
117
|
{ flags: "--all", description: "Read every page (needs --max-results)" },
|
|
114
118
|
{
|
|
115
119
|
flags: "--max-results <count>", description: "Fail above this many issues",
|
|
@@ -146,7 +150,7 @@ export function createYouTrackCli(runtime) {
|
|
|
146
150
|
]),
|
|
147
151
|
command("comments", "Read and add comments", [
|
|
148
152
|
...contextCommentChildren,
|
|
149
|
-
|
|
153
|
+
projectedBodyUpdate("add <issueID>", "Add a comment", addComment, "text", commentAdded("issueID"), [...notificationOptions, ...draftOptions]),
|
|
150
154
|
pagedRead("list <issueID>", "List comments", listComments, commentTable),
|
|
151
155
|
]),
|
|
152
156
|
], { examples: issueExamples }),
|
package/dist/src/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,SAAS,EACT,UAAU,EACV,aAAa,EACb,UAAU,EACV,SAAS,GAGV,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,UAAU,EACV,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,QAAQ,EACR,WAAW,EACX,eAAe,GAChB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,SAAS,EACT,UAAU,EACV,aAAa,EACb,UAAU,EACV,SAAS,GAGV,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,UAAU,EACV,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,QAAQ,EACR,WAAW,EACX,eAAe,GAChB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,YAAY,EACZ,UAAU,EACV,SAAS,EACT,WAAW,EACX,aAAa,EACb,WAAW,EACX,WAAW,EACX,YAAY,EACZ,aAAa,GACd,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAChH,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC/E,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,C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AAC,SAAS,CAAC,EAAE,CAAC,GAAG,mBAAmB,EAAE,GAAG,YAAY,CAAC,CAAC;oBAC7I,SAAS,CAAC,gBAAgB,EAAE,eAAe,EAAE,YAAY,EAAE,YAAY,CAAC;iBACzE,CAAC;aACH,EAAE,EAAE,QAAQ,EAAE,aAAa,EAAE,CAAC;SAChC,CAAC;QACF,GAAG,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC;KAC9C,CAAC,CAAC;AACL,CAAC"}
|
package/dist/src/client.d.ts
CHANGED
|
@@ -14,9 +14,15 @@ export type YouTrackValue = null | boolean | number | string | YouTrackObject |
|
|
|
14
14
|
export interface YouTrackObject {
|
|
15
15
|
[field: string]: YouTrackValue;
|
|
16
16
|
}
|
|
17
|
+
export type QueryParameters = Record<string, string | readonly string[]>;
|
|
17
18
|
export interface ProjectionOptions {
|
|
18
19
|
fields?: string;
|
|
19
20
|
}
|
|
21
|
+
export interface WriteOptions extends ProjectionOptions {
|
|
22
|
+
draftId?: string;
|
|
23
|
+
muteUpdateNotifications?: boolean;
|
|
24
|
+
}
|
|
25
|
+
export declare function writeQuery(options: WriteOptions, projection: string): Record<string, string>;
|
|
20
26
|
export interface PageOptions extends ProjectionOptions {
|
|
21
27
|
pageSize?: number;
|
|
22
28
|
start?: number;
|
|
@@ -30,6 +36,7 @@ export interface YouTrackPage<T = YouTrackObject> {
|
|
|
30
36
|
}
|
|
31
37
|
export interface IssueSearchOptions extends PageOptions {
|
|
32
38
|
query?: string;
|
|
39
|
+
customFields?: readonly string[];
|
|
33
40
|
/** Read every page; fail instead of returning more issues. */
|
|
34
41
|
maxResults?: number;
|
|
35
42
|
progress?: (message: string) => void;
|
|
@@ -45,21 +52,21 @@ export declare function fields(options: ProjectionOptions, defaults: string): st
|
|
|
45
52
|
export declare function page(options: PageOptions, defaults: string): Record<string, string>;
|
|
46
53
|
export declare function encodedID(id: string, label?: string): string;
|
|
47
54
|
export declare function issuePath(id: string): string;
|
|
48
|
-
export declare function readObject(connection: Connection, path: string, query:
|
|
49
|
-
export declare function readNullableObject(connection: Connection, path: string, query:
|
|
55
|
+
export declare function readObject(connection: Connection, path: string, query: QueryParameters, body?: YouTrackObject): Promise<YouTrackObject>;
|
|
56
|
+
export declare function readNullableObject(connection: Connection, path: string, query: QueryParameters): Promise<YouTrackObject | null>;
|
|
50
57
|
export declare function getAttachmentDownloadMetadata(connection: Connection, attachmentPath: string): Promise<{
|
|
51
58
|
id: string;
|
|
52
59
|
name: string;
|
|
53
60
|
mimeType: string | null;
|
|
54
61
|
url: string;
|
|
55
62
|
}>;
|
|
56
|
-
export declare function readCollection(connection: Connection, path: string, query:
|
|
63
|
+
export declare function readCollection(connection: Connection, path: string, query: QueryParameters, budget?: ByteBudget): Promise<YouTrackObject[]>;
|
|
57
64
|
/** One request, without lookahead. A zero-size request supplies no end evidence. */
|
|
58
|
-
export declare function readPage(connection: Connection, path: string, query:
|
|
65
|
+
export declare function readPage(connection: Connection, path: string, query: QueryParameters, budget?: ByteBudget): Promise<YouTrackPage>;
|
|
59
66
|
/** Read a complete issue selection; only an empty offset page establishes its end.
|
|
60
67
|
* Repeated string IDs are dropped; offset paging is not a snapshot of a changing dataset.
|
|
61
68
|
*/
|
|
62
|
-
export declare function readPages(connection: Connection, path: string, query:
|
|
69
|
+
export declare function readPages(connection: Connection, path: string, query: QueryParameters, { pageSize, start, maxResults, budget, progress }: {
|
|
63
70
|
pageSize: number;
|
|
64
71
|
start: number;
|
|
65
72
|
maxResults: number;
|
|
@@ -81,9 +88,9 @@ export declare const listComments: (connection: Connection, issueID: string, opt
|
|
|
81
88
|
export declare function mutationBody(value: unknown): YouTrackObject;
|
|
82
89
|
export declare function narrative(value: unknown, label: string): string;
|
|
83
90
|
export declare function nullableText(value: unknown, label: string): string | null;
|
|
84
|
-
export declare function mutate(connection: Connection, path: string, body: YouTrackObject, projection: string): Promise<YouTrackObject | null>;
|
|
85
|
-
export declare function deleteObject(connection: Connection, path: string): Promise<YouTrackObject | null>;
|
|
86
|
-
export declare function uploadObjectCollection(connection: Connection, path: string, body: FormData, projection: string): Promise<YouTrackObject[] | null>;
|
|
87
|
-
export declare function addComment(connection: Connection, issueID: string, input: unknown): Promise<YouTrackObject | null>;
|
|
91
|
+
export declare function mutate(connection: Connection, path: string, body: YouTrackObject, projection: string, options?: WriteOptions): Promise<YouTrackObject | null>;
|
|
92
|
+
export declare function deleteObject(connection: Connection, path: string, options?: ProjectionOptions): Promise<YouTrackObject | null>;
|
|
93
|
+
export declare function uploadObjectCollection(connection: Connection, path: string, body: FormData, projection: string, options?: WriteOptions): Promise<YouTrackObject[] | null>;
|
|
94
|
+
export declare function addComment(connection: Connection, issueID: string, input: unknown, options?: WriteOptions): Promise<YouTrackObject | null>;
|
|
88
95
|
export {};
|
|
89
96
|
//# sourceMappingURL=client.d.ts.map
|
package/dist/src/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;IAChC,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,eAAO,MAAM,eAAe,gGAAgG,CAAC;AAE7H,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAIlD;AAED,MAAM,MAAM,aAAa,GAAG,IAAI,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,cAAc,GAAG,aAAa,EAAE,CAAC;AAChG,MAAM,WAAW,cAAc;IAC7B,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,CAAC;C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Y,CA2FxB,CAAC;AAEF,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,cAAc,CAmB3D;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAK/D;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAKzE;AAeD,wBAAsB,MAAM,CAC1B,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,cAAc,EACpB,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE,YAAiB,GACzB,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAQhC;AAED,wBAAsB,YAAY,CAAC,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,iBAAsB,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAMxI;AAED,wBAAsB,sBAAsB,CAC1C,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,QAAQ,EACd,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE,YAAiB,GACzB,OAAO,CAAC,cAAc,EAAE,GAAG,IAAI,CAAC,CAUlC;AAED,wBAAsB,UAAU,CAC9B,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,OAAO,EACd,OAAO,GAAE,YAAiB,GACzB,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAMhC"}
|
package/dist/src/client.js
CHANGED
|
@@ -5,6 +5,16 @@ export function youTrackUrl(value) {
|
|
|
5
5
|
const url = parseServerUrl(value, message);
|
|
6
6
|
return url.href;
|
|
7
7
|
}
|
|
8
|
+
export function writeQuery(options, projection) {
|
|
9
|
+
if (options.muteUpdateNotifications !== undefined && typeof options.muteUpdateNotifications !== "boolean") {
|
|
10
|
+
throw new Error("The notification control must be boolean.");
|
|
11
|
+
}
|
|
12
|
+
return {
|
|
13
|
+
fields: fields(options, projection),
|
|
14
|
+
...(options.draftId === undefined ? {} : { draftId: requiredText(options.draftId, "draft ID") }),
|
|
15
|
+
...(options.muteUpdateNotifications === undefined ? {} : { muteUpdateNotifications: String(options.muteUpdateNotifications) }),
|
|
16
|
+
};
|
|
17
|
+
}
|
|
8
18
|
const issueListFields = "id,idReadable,summary,project(id,name,shortName),updated,resolved";
|
|
9
19
|
const commentFields = "id,text,author(id,login),created,updated";
|
|
10
20
|
export function requiredText(value, label) {
|
|
@@ -102,22 +112,35 @@ function object(value) {
|
|
|
102
112
|
}
|
|
103
113
|
async function request(connection, path, query, responseName = "JSON", options = {}) {
|
|
104
114
|
const url = new URL(path, youTrackUrl(connection.baseUrl));
|
|
105
|
-
|
|
115
|
+
const parameters = new URLSearchParams();
|
|
116
|
+
for (const [name, value] of Object.entries(query)) {
|
|
117
|
+
if (typeof value === "string")
|
|
118
|
+
parameters.append(name, value);
|
|
119
|
+
else
|
|
120
|
+
for (const item of value)
|
|
121
|
+
parameters.append(name, item);
|
|
122
|
+
}
|
|
123
|
+
url.search = parameters.toString();
|
|
106
124
|
const token = normalizeBearerToken(connection.token);
|
|
107
125
|
const body = options.body;
|
|
108
126
|
const multipart = body instanceof FormData;
|
|
127
|
+
const init = {
|
|
128
|
+
headers: {
|
|
129
|
+
Accept: "application/json",
|
|
130
|
+
Authorization: `Bearer ${token}`,
|
|
131
|
+
...(body === undefined || multipart ? {} : { "Content-Type": "application/json" }),
|
|
132
|
+
},
|
|
133
|
+
method: options.method ?? "GET",
|
|
134
|
+
...(body === undefined ? {} : { body: multipart ? body : JSON.stringify(body) }),
|
|
135
|
+
...(connection.signal === undefined ? {} : { signal: connection.signal }),
|
|
136
|
+
};
|
|
137
|
+
if (options.onSubmit) {
|
|
138
|
+
connection.signal?.throwIfAborted();
|
|
139
|
+
options.onSubmit();
|
|
140
|
+
}
|
|
109
141
|
let response;
|
|
110
142
|
try {
|
|
111
|
-
response = await fetchWithRedirects(connection.fetch ?? globalThis.fetch, url,
|
|
112
|
-
headers: {
|
|
113
|
-
Accept: "application/json",
|
|
114
|
-
Authorization: `Bearer ${token}`,
|
|
115
|
-
...(body === undefined || multipart ? {} : { "Content-Type": "application/json" }),
|
|
116
|
-
},
|
|
117
|
-
method: options.method ?? "GET",
|
|
118
|
-
...(body === undefined ? {} : { body: multipart ? body : JSON.stringify(body) }),
|
|
119
|
-
...(connection.signal === undefined ? {} : { signal: connection.signal }),
|
|
120
|
-
});
|
|
143
|
+
response = await fetchWithRedirects(connection.fetch ?? globalThis.fetch, url, init);
|
|
121
144
|
}
|
|
122
145
|
catch (cause) {
|
|
123
146
|
throw new CliError("Could not reach YouTrack; check the URL, connectivity and TLS.", {
|
|
@@ -314,6 +337,13 @@ export async function listIssues(connection, options = {}) {
|
|
|
314
337
|
const query = {
|
|
315
338
|
...page(options, issueListFields),
|
|
316
339
|
...(options.query === undefined ? {} : { query: requiredText(options.query, "query") }),
|
|
340
|
+
...(options.customFields === undefined ? {} : {
|
|
341
|
+
customFields: (() => {
|
|
342
|
+
if (!Array.isArray(options.customFields))
|
|
343
|
+
throw new Error("The custom fields must be a list of names.");
|
|
344
|
+
return options.customFields.map(value => requiredText(value, "custom field name"));
|
|
345
|
+
})(),
|
|
346
|
+
}),
|
|
317
347
|
};
|
|
318
348
|
const budget = options.maxBytes === undefined
|
|
319
349
|
? undefined
|
|
@@ -366,33 +396,53 @@ export function nullableText(value, label) {
|
|
|
366
396
|
}
|
|
367
397
|
return value;
|
|
368
398
|
}
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
399
|
+
/** A received 4xx is a rejection; other post-submission failures cannot prove no write. */
|
|
400
|
+
async function mutationResult(operation) {
|
|
401
|
+
let submitted = false;
|
|
402
|
+
try {
|
|
403
|
+
return await operation(() => { submitted = true; });
|
|
404
|
+
}
|
|
405
|
+
catch (error) {
|
|
406
|
+
if (submitted && error instanceof Error && !(error instanceof HttpError && error.status >= 400 && error.status < 500)) {
|
|
407
|
+
error.message += " The write outcome is unknown.";
|
|
408
|
+
}
|
|
409
|
+
throw error;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
export async function mutate(connection, path, body, projection, options = {}) {
|
|
413
|
+
const query = writeQuery(options, projection);
|
|
414
|
+
return mutationResult(async (onSubmit) => {
|
|
415
|
+
const value = await request(connection, path, query, "JSON", {
|
|
416
|
+
method: "POST", body, allowEmpty: true, onSubmit,
|
|
417
|
+
});
|
|
418
|
+
return value === null ? null : object(scrub(value, connection.token.trim()));
|
|
372
419
|
});
|
|
373
|
-
return value === null ? null : object(scrub(value, connection.token.trim()));
|
|
374
420
|
}
|
|
375
|
-
export async function deleteObject(connection, path) {
|
|
376
|
-
const
|
|
377
|
-
return
|
|
421
|
+
export async function deleteObject(connection, path, options = {}) {
|
|
422
|
+
const query = options.fields === undefined ? {} : { fields: fields(options, "") };
|
|
423
|
+
return mutationResult(async (onSubmit) => {
|
|
424
|
+
const value = await request(connection, path, query, "JSON", { method: "DELETE", allowEmpty: true, onSubmit });
|
|
425
|
+
return value === null ? null : object(scrub(value, connection.token.trim()));
|
|
426
|
+
});
|
|
378
427
|
}
|
|
379
|
-
export async function uploadObjectCollection(connection, path, body, projection) {
|
|
380
|
-
const
|
|
381
|
-
|
|
428
|
+
export async function uploadObjectCollection(connection, path, body, projection, options = {}) {
|
|
429
|
+
const query = writeQuery(options, projection);
|
|
430
|
+
return mutationResult(async (onSubmit) => {
|
|
431
|
+
const value = await request(connection, path, query, "JSON", {
|
|
432
|
+
method: "POST", body, allowEmpty: true, onSubmit,
|
|
433
|
+
});
|
|
434
|
+
if (value === null)
|
|
435
|
+
return null;
|
|
436
|
+
if (!Array.isArray(value))
|
|
437
|
+
throw new Error("Invalid upload collection response from YouTrack.");
|
|
438
|
+
return value.map((item) => object(scrub(item, connection.token.trim())));
|
|
382
439
|
});
|
|
383
|
-
if (value === null) {
|
|
384
|
-
return null;
|
|
385
|
-
}
|
|
386
|
-
if (!Array.isArray(value)) {
|
|
387
|
-
throw new Error("Invalid upload collection response from YouTrack.");
|
|
388
|
-
}
|
|
389
|
-
return value.map((item) => object(scrub(item, connection.token.trim())));
|
|
390
440
|
}
|
|
391
|
-
export async function addComment(connection, issueID, input) {
|
|
441
|
+
export async function addComment(connection, issueID, input, options = {}) {
|
|
392
442
|
const body = mutationBody(input);
|
|
393
443
|
return mutate(connection, `${issuePath(issueID)}/comments`, {
|
|
394
444
|
...body,
|
|
395
445
|
...(Object.hasOwn(body, "text") ? { text: nullableText(body.text, "text") } : {}),
|
|
396
|
-
}, commentFields);
|
|
446
|
+
}, commentFields, options);
|
|
397
447
|
}
|
|
398
448
|
//# sourceMappingURL=client.js.map
|