jiradc-cli 1.0.42 → 1.0.43
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.js +39 -35
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2711,52 +2711,56 @@ function search3(parent) {
|
|
|
2711
2711
|
parser: nonEmpty
|
|
2712
2712
|
});
|
|
2713
2713
|
scopeIdOption(cmd, "structure", { mandatory: true });
|
|
2714
|
-
cmd.option("--fields <fields>", "Comma-separated fields to return", text);
|
|
2714
|
+
cmd.option("--fields <fields>", "Comma-separated fields to return, by name or id", text);
|
|
2715
|
+
cmd.option("--all-fields", "Return all fields instead of defaults");
|
|
2715
2716
|
paginationOptions(cmd, { defaultLimit: 25, maxLimit: 50 });
|
|
2716
2717
|
examples(cmd, [
|
|
2717
2718
|
`"child of folder('Billing')" --structure "My Structure"`,
|
|
2718
2719
|
`"descendants of folder('Billing')" --structure 42 --limit 50`
|
|
2719
2720
|
]);
|
|
2720
|
-
cmd.action(
|
|
2721
|
-
|
|
2722
|
-
[
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2721
|
+
cmd.action(
|
|
2722
|
+
async (sjql, opts) => {
|
|
2723
|
+
for (const [name, value] of [
|
|
2724
|
+
["--structure", opts.structure],
|
|
2725
|
+
["<sjql>", sjql]
|
|
2726
|
+
]) {
|
|
2727
|
+
if (value.includes('"')) {
|
|
2728
|
+
throw new CliUsageError(
|
|
2729
|
+
`${name} must not contain a double quote \u2014 S-JQL uses single quotes inside, e.g. "child of folder('Billing')"`
|
|
2730
|
+
);
|
|
2731
|
+
}
|
|
2732
|
+
}
|
|
2733
|
+
const client = getClient();
|
|
2734
|
+
const fields = await selectFields(client, opts, SEARCH_DEFAULT_FIELDS);
|
|
2735
|
+
const jql = `issue in structure("${opts.structure}", "${sjql}")`;
|
|
2736
|
+
let res;
|
|
2737
|
+
try {
|
|
2738
|
+
res = await client.issues.search({
|
|
2739
|
+
jql,
|
|
2740
|
+
startAt: opts.start ?? 0,
|
|
2741
|
+
maxResults: opts.limit,
|
|
2742
|
+
fields
|
|
2743
|
+
});
|
|
2744
|
+
} catch (err) {
|
|
2745
|
+
const detail = err.response?.data;
|
|
2746
|
+
const raw = detail === void 0 ? "" : JSON.stringify(detail);
|
|
2747
|
+
if (!raw.includes("Structure query")) throw err;
|
|
2748
|
+
const suggestion = /did you mean ([^"]+?)\?/.exec(raw)?.[1];
|
|
2726
2749
|
throw new CliUsageError(
|
|
2727
|
-
|
|
2750
|
+
`Structure rejected the query ${JSON.stringify(sjql)}`,
|
|
2751
|
+
suggestion !== void 0 ? `The query is S-JQL, not JQL. Structure suggests: ${suggestion}.` : `The query is S-JQL, not JQL \u2014 use shapes like "child of folder('Name')", "descendants of folder('Name')" or "issue in (PROJ-123)", with single quotes inside.`,
|
|
2752
|
+
detail
|
|
2728
2753
|
);
|
|
2729
2754
|
}
|
|
2730
|
-
|
|
2731
|
-
const client = getClient();
|
|
2732
|
-
const jql = `issue in structure("${opts.structure}", "${sjql}")`;
|
|
2733
|
-
let res;
|
|
2734
|
-
try {
|
|
2735
|
-
res = await client.issues.search({
|
|
2755
|
+
output({
|
|
2736
2756
|
jql,
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2757
|
+
total: res.total,
|
|
2758
|
+
startAt: res.startAt,
|
|
2759
|
+
count: res.issues?.length ?? 0,
|
|
2760
|
+
issues: (res.issues ?? []).map(transformIssue)
|
|
2740
2761
|
});
|
|
2741
|
-
} catch (err) {
|
|
2742
|
-
const detail = err.response?.data;
|
|
2743
|
-
const raw = detail === void 0 ? "" : JSON.stringify(detail);
|
|
2744
|
-
if (!raw.includes("Structure query")) throw err;
|
|
2745
|
-
const suggestion = /did you mean ([^"]+?)\?/.exec(raw)?.[1];
|
|
2746
|
-
throw new CliUsageError(
|
|
2747
|
-
`Structure rejected the query ${JSON.stringify(sjql)}`,
|
|
2748
|
-
suggestion !== void 0 ? `The query is S-JQL, not JQL. Structure suggests: ${suggestion}.` : `The query is S-JQL, not JQL \u2014 use shapes like "child of folder('Name')", "descendants of folder('Name')" or "issue in (PROJ-123)", with single quotes inside.`,
|
|
2749
|
-
detail
|
|
2750
|
-
);
|
|
2751
2762
|
}
|
|
2752
|
-
|
|
2753
|
-
jql,
|
|
2754
|
-
total: res.total,
|
|
2755
|
-
startAt: res.startAt,
|
|
2756
|
-
count: res.issues?.length ?? 0,
|
|
2757
|
-
issues: (res.issues ?? []).map(transformIssue)
|
|
2758
|
-
});
|
|
2759
|
-
});
|
|
2763
|
+
);
|
|
2760
2764
|
}
|
|
2761
2765
|
|
|
2762
2766
|
// src/commands/structure/index.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jiradc-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.43",
|
|
4
4
|
"publish": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"tsx": "^4.19.2",
|
|
24
24
|
"typescript": "^5.7.2",
|
|
25
25
|
"vitest": "^4.0.16",
|
|
26
|
-
"config-eslint": "0.0.0",
|
|
27
26
|
"cli-utils": "1.0.0",
|
|
27
|
+
"config-eslint": "0.0.0",
|
|
28
28
|
"config-typescript": "0.0.0"
|
|
29
29
|
},
|
|
30
30
|
"engines": {
|