@ecomweb/cli 1.2.1 → 1.3.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 +13 -0
- package/dist/commands/bug-reports/create.d.ts +26 -0
- package/dist/commands/bug-reports/create.js +99 -0
- package/dist/commands/bug-reports/create.js.map +1 -0
- package/dist/commands/bug-reports/get.d.ts +21 -0
- package/dist/commands/bug-reports/get.js +40 -0
- package/dist/commands/bug-reports/get.js.map +1 -0
- package/dist/commands/bug-reports/list.d.ts +21 -0
- package/dist/commands/bug-reports/list.js +47 -0
- package/dist/commands/bug-reports/list.js.map +1 -0
- package/dist/lib/api-client.d.ts +6 -0
- package/dist/lib/api-client.js +7 -3
- package/dist/lib/api-client.js.map +1 -1
- package/dist/lib/bug-reports.d.ts +73 -0
- package/dist/lib/bug-reports.js +111 -0
- package/dist/lib/bug-reports.js.map +1 -0
- package/dist/lib/errors.js +5 -3
- package/dist/lib/errors.js.map +1 -1
- package/dist/lib/screenshot.d.ts +14 -0
- package/dist/lib/screenshot.js +48 -0
- package/dist/lib/screenshot.js.map +1 -0
- package/oclif.manifest.json +855 -455
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -64,11 +64,24 @@ ecomweb theme settings set 54 --set shop_introduction='Chào mừng!' --set show
|
|
|
64
64
|
ecomweb store-pages create --title "Chính sách bảo hành" --slug warranty-policy --page-type warranty
|
|
65
65
|
ecomweb store-menus add-item customer-support-menu --page warranty-policy
|
|
66
66
|
|
|
67
|
+
# Bug reports (sent as you: needs `ecomweb auth login`, not an API key)
|
|
68
|
+
ecomweb bug-reports create --title "Can't save a product" --description "Save does nothing" --blocking
|
|
69
|
+
ecomweb bug-reports create --title "…" --description "…" --command "products update" --error-code VALIDATION_ERROR
|
|
70
|
+
ecomweb bug-reports create --title "…" --description "…" --screenshot ./shot.png --no-store
|
|
71
|
+
ecomweb bug-reports list --status fixed # yours and your stores' team's, newest first
|
|
72
|
+
ecomweb bug-reports get 1042 # or '#1042', quoted: # starts a comment in a shell
|
|
73
|
+
|
|
67
74
|
# All commands
|
|
68
75
|
ecomweb --help
|
|
69
76
|
ecomweb <topic> --help
|
|
70
77
|
```
|
|
71
78
|
|
|
79
|
+
A bug report is about the current store (`--store-ref`, then the project, then the
|
|
80
|
+
profile) unless you pass `--no-store`. `--screenshot` takes a PNG, JPEG or WebP image
|
|
81
|
+
of at most 5 MB. You can send 10 reports an hour and 30 a day. `get` shows `status_label`
|
|
82
|
+
and `outcome` (for a duplicate, the original's status and the reply); the JSON output (the
|
|
83
|
+
default) is where `outcome` appears, because table and CSV show only top-level fields.
|
|
84
|
+
|
|
72
85
|
## Start with an AI agent
|
|
73
86
|
|
|
74
87
|
Build your store's storefront with Claude Code or Codex. Log in, then create the
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { BaseCommand } from "../../base-command";
|
|
2
|
+
export default class BugReportsCreate extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
title: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
7
|
+
description: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
8
|
+
steps: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
9
|
+
blocking: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
screenshot: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
11
|
+
command: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
12
|
+
"error-code": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
13
|
+
"no-store": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
14
|
+
"store-ref": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
15
|
+
"api-key": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
16
|
+
"api-url": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
17
|
+
output: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
18
|
+
quiet: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
19
|
+
"dry-run": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
20
|
+
profile: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
21
|
+
full: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
22
|
+
fields: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
23
|
+
exclude: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
24
|
+
};
|
|
25
|
+
run(): Promise<void>;
|
|
26
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const base_command_1 = require("../../base-command");
|
|
5
|
+
const bug_reports_1 = require("../../lib/bug-reports");
|
|
6
|
+
const errors_1 = require("../../lib/errors");
|
|
7
|
+
const screenshot_1 = require("../../lib/screenshot");
|
|
8
|
+
class BugReportsCreate extends base_command_1.BaseCommand {
|
|
9
|
+
async run() {
|
|
10
|
+
(0, bug_reports_1.assertSignedIn)({
|
|
11
|
+
apiKey: this.configManager.resolveApiKey(this.getFlag("api-key")),
|
|
12
|
+
hasSession: this.credentials.get(this.profileName) !== undefined,
|
|
13
|
+
dryRun: this.isDryRun,
|
|
14
|
+
});
|
|
15
|
+
const noStore = this.getFlag("no-store") === true;
|
|
16
|
+
if (noStore && this.argv.some((a) => a === "--store-ref" || a.startsWith("--store-ref="))) {
|
|
17
|
+
throw new errors_1.CliError("CONFLICTING_INPUT", "Pass --store-ref or --no-store, not both.", errors_1.ExitCode.VALIDATION);
|
|
18
|
+
}
|
|
19
|
+
const title = (0, bug_reports_1.reportText)("--title", this.getFlag("title"), bug_reports_1.BUG_REPORT_LIMITS.title, { required: true });
|
|
20
|
+
const description = (0, bug_reports_1.reportText)("--description", this.getFlag("description"), bug_reports_1.BUG_REPORT_LIMITS.description, {
|
|
21
|
+
required: true,
|
|
22
|
+
});
|
|
23
|
+
const steps = (0, bug_reports_1.reportText)("--steps", this.getFlag("steps"), bug_reports_1.BUG_REPORT_LIMITS.steps);
|
|
24
|
+
const tool_name = (0, bug_reports_1.reportText)("--command", this.getFlag("command"), bug_reports_1.BUG_REPORT_LIMITS.tool_name);
|
|
25
|
+
const error_code = (0, bug_reports_1.reportText)("--error-code", this.getFlag("error-code"), bug_reports_1.BUG_REPORT_LIMITS.error_code);
|
|
26
|
+
const store = noStore ? undefined : this.resolveStore();
|
|
27
|
+
const file = this.getFlag("screenshot");
|
|
28
|
+
const shot = file ? (0, screenshot_1.readScreenshot)(file) : undefined;
|
|
29
|
+
const body = {
|
|
30
|
+
title,
|
|
31
|
+
description,
|
|
32
|
+
blocking: this.getFlag("blocking") === true,
|
|
33
|
+
...(steps !== undefined ? { steps } : {}),
|
|
34
|
+
...(store ? { store } : {}),
|
|
35
|
+
...(tool_name !== undefined ? { tool_name } : {}),
|
|
36
|
+
...(error_code !== undefined ? { error_code } : {}),
|
|
37
|
+
};
|
|
38
|
+
if (this.isDryRun) {
|
|
39
|
+
this.outputResult({
|
|
40
|
+
resource: "bug-reports",
|
|
41
|
+
action: "create (dry-run)",
|
|
42
|
+
data: {
|
|
43
|
+
method: "POST",
|
|
44
|
+
path: "/bug-reports",
|
|
45
|
+
encoding: shot ? "multipart" : "json",
|
|
46
|
+
body,
|
|
47
|
+
screenshot: shot ? { file: shot.path, bytes: shot.bytes, type: shot.mime } : null,
|
|
48
|
+
},
|
|
49
|
+
hints: { note: "Nothing was sent." },
|
|
50
|
+
});
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
let created;
|
|
54
|
+
try {
|
|
55
|
+
created = shot
|
|
56
|
+
? await this.apiClient.upload("/bug-reports", (0, bug_reports_1.bugReportForm)(body, shot), { retryRateLimit: false })
|
|
57
|
+
: await this.apiClient.post("/bug-reports", body, { retryRateLimit: false });
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
throw (0, bug_reports_1.bugReportApiError)(error, { store });
|
|
61
|
+
}
|
|
62
|
+
this.outputResult({
|
|
63
|
+
resource: "bug-reports",
|
|
64
|
+
action: "create",
|
|
65
|
+
data: { ...created, store: store ?? null },
|
|
66
|
+
available_actions: ["get", "list"],
|
|
67
|
+
hints: { get: `ecomweb bug-reports get ${created.id}` },
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
BugReportsCreate.description = "Report a bug to ecomweb staff. It is about the current store unless you pass --no-store. You get a number; check on it with ecomweb bug-reports get.";
|
|
72
|
+
BugReportsCreate.examples = [
|
|
73
|
+
'ecomweb bug-reports create --title "Can\'t save a product" --description "Save does nothing"',
|
|
74
|
+
'ecomweb bug-reports create --title "Update fails" --description "It prints an error" --blocking --command "products update" --error-code VALIDATION_ERROR',
|
|
75
|
+
'ecomweb bug-reports create --title "Login page" --description "The button is cut off" --screenshot ./shot.png --no-store',
|
|
76
|
+
];
|
|
77
|
+
BugReportsCreate.flags = {
|
|
78
|
+
...base_command_1.BaseCommand.baseFlags,
|
|
79
|
+
title: core_1.Flags.string({ required: true, description: "Short summary of the problem (at most 200 characters)" }),
|
|
80
|
+
description: core_1.Flags.string({
|
|
81
|
+
required: true,
|
|
82
|
+
description: "What happened, and what you expected (at most 5000 characters)",
|
|
83
|
+
}),
|
|
84
|
+
steps: core_1.Flags.string({ description: "Steps to reproduce (at most 5000 characters)" }),
|
|
85
|
+
blocking: core_1.Flags.boolean({ default: false, description: "The problem stops you selling or running your store" }),
|
|
86
|
+
screenshot: core_1.Flags.string({ description: "A PNG, JPEG or WebP image of at most 5 MB" }),
|
|
87
|
+
command: core_1.Flags.string({
|
|
88
|
+
description: 'The ecomweb command that failed, e.g. "products update" (at most 64 characters)',
|
|
89
|
+
}),
|
|
90
|
+
"error-code": core_1.Flags.string({
|
|
91
|
+
description: "The error code it printed, e.g. VALIDATION_ERROR (at most 64 characters)",
|
|
92
|
+
}),
|
|
93
|
+
"no-store": core_1.Flags.boolean({
|
|
94
|
+
default: false,
|
|
95
|
+
description: "File it as not about a store (by default it is about the current store)",
|
|
96
|
+
}),
|
|
97
|
+
};
|
|
98
|
+
exports.default = BugReportsCreate;
|
|
99
|
+
//# sourceMappingURL=create.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../src/commands/bug-reports/create.ts"],"names":[],"mappings":";;AAAA,sCAAoC;AACpC,qDAAiD;AACjD,uDAO+B;AAC/B,6CAAsD;AACtD,qDAAsD;AAItD,MAAqB,gBAAiB,SAAQ,0BAAW;IAgCvD,KAAK,CAAC,GAAG;QACP,IAAA,4BAAc,EAAC;YACb,MAAM,EAAE,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;YACjE,UAAU,EAAE,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,SAAS;YAChE,MAAM,EAAE,IAAI,CAAC,QAAQ;SACtB,CAAC,CAAC;QAEH,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;QAClD,IAAI,OAAO,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AqD,EAAE,CAAC;IAC/G,UAAU,EAAE,YAAK,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,2CAA2C,EAAE,CAAC;IACtF,OAAO,EAAE,YAAK,CAAC,MAAM,CAAC;QACpB,WAAW,EAAE,iFAAiF;KAC/F,CAAC;IACF,YAAY,EAAE,YAAK,CAAC,MAAM,CAAC;QACzB,WAAW,EAAE,0EAA0E;KACxF,CAAC;IACF,UAAU,EAAE,YAAK,CAAC,OAAO,CAAC;QACxB,OAAO,EAAE,KAAK;QACd,WAAW,EAAE,yEAAyE;KACvF,CAAC;CACH,CAAC;kBA9BiB,gBAAgB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { BaseCommand } from "../../base-command";
|
|
2
|
+
export default class BugReportsGet extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static args: {
|
|
6
|
+
number: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
7
|
+
};
|
|
8
|
+
static flags: {
|
|
9
|
+
"store-ref": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
|
+
"api-key": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
11
|
+
"api-url": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
12
|
+
output: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
13
|
+
quiet: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
14
|
+
"dry-run": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
15
|
+
profile: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
16
|
+
full: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
17
|
+
fields: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
18
|
+
exclude: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
19
|
+
};
|
|
20
|
+
run(): Promise<void>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const base_command_1 = require("../../base-command");
|
|
5
|
+
const bug_reports_1 = require("../../lib/bug-reports");
|
|
6
|
+
class BugReportsGet extends base_command_1.BaseCommand {
|
|
7
|
+
async run() {
|
|
8
|
+
(0, bug_reports_1.assertSignedIn)({
|
|
9
|
+
apiKey: this.configManager.resolveApiKey(this.getFlag("api-key")),
|
|
10
|
+
hasSession: this.credentials.get(this.profileName) !== undefined,
|
|
11
|
+
});
|
|
12
|
+
const { args } = await this.parse(BugReportsGet);
|
|
13
|
+
const digits = (0, bug_reports_1.parseReportNumber)(args.number);
|
|
14
|
+
let report;
|
|
15
|
+
try {
|
|
16
|
+
report = await this.apiClient.get(`/bug-reports/${digits}`);
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
throw (0, bug_reports_1.bugReportApiError)(error, { number: digits });
|
|
20
|
+
}
|
|
21
|
+
this.outputResult({
|
|
22
|
+
resource: "bug-reports",
|
|
23
|
+
action: "get",
|
|
24
|
+
data: (0, bug_reports_1.toCliReport)(report),
|
|
25
|
+
available_actions: ["list", "create"],
|
|
26
|
+
hints: { list: "ecomweb bug-reports list" },
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
BugReportsGet.description = "Show one bug report: its status, and for a duplicate the original's status and the reply (outcome).";
|
|
31
|
+
BugReportsGet.examples = ["ecomweb bug-reports get 1042", "ecomweb bug-reports get '#1042'"];
|
|
32
|
+
BugReportsGet.args = {
|
|
33
|
+
number: core_1.Args.string({
|
|
34
|
+
required: true,
|
|
35
|
+
description: "Report number: 1042 or '#1042' (quote it: # starts a comment in a shell)",
|
|
36
|
+
}),
|
|
37
|
+
};
|
|
38
|
+
BugReportsGet.flags = { ...base_command_1.BaseCommand.baseFlags };
|
|
39
|
+
exports.default = BugReportsGet;
|
|
40
|
+
//# sourceMappingURL=get.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get.js","sourceRoot":"","sources":["../../../src/commands/bug-reports/get.ts"],"names":[],"mappings":";;AAAA,sCAAmC;AACnC,qDAAiD;AACjD,uDAAkI;AAElI,MAAqB,aAAc,SAAQ,0BAAW;IAepD,KAAK,CAAC,GAAG;QACP,IAAA,4BAAc,EAAC;YACb,MAAM,EAAE,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;YACjE,UAAU,EAAE,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,SAAS;SACjE,CAAC,CAAC;QACH,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;QACjD,MAAM,MAAM,GAAG,IAAA,+BAAiB,EAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAE9C,IAAI,MAAyB,CAAC;QAC9B,IAAI,CAAC;YACH,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,GAAG,CAAoB,gBAAgB,MAAM,EAAE,CAAC,CAAC;QACjF,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,IAAA,+BAAiB,EAAC,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;QACrD,CAAC;QAED,IAAI,CAAC,YAAY,CAAC;YAChB,QAAQ,EAAE,aAAa;YACvB,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,IAAA,yBAAW,EAAC,MAAM,CAAC;YACzB,iBAAiB,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC;YACrC,KAAK,EAAE,EAAE,IAAI,EAAE,0BAA0B,EAAE;SAC5C,CAAC,CAAC;IACL,CAAC;;AApCM,yBAAW,GAChB,qGAAqG,CAAC;AAEjG,sBAAQ,GAAG,CAAC,8BAA8B,EAAE,iCAAiC,CAAC,CAAC;AAE/E,kBAAI,GAAG;IACZ,MAAM,EAAE,WAAI,CAAC,MAAM,CAAC;QAClB,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,0EAA0E;KACxF,CAAC;CACH,CAAC;AAEK,mBAAK,GAAG,EAAE,GAAG,0BAAW,CAAC,SAAS,EAAE,CAAC;kBAbzB,aAAa"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { BaseCommand } from "../../base-command";
|
|
2
|
+
export default class BugReportsList extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
status: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
7
|
+
page: import("@oclif/core/lib/interfaces").OptionFlag<number, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
8
|
+
limit: import("@oclif/core/lib/interfaces").OptionFlag<number, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
9
|
+
"store-ref": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
|
+
"api-key": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
11
|
+
"api-url": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
12
|
+
output: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
13
|
+
quiet: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
14
|
+
"dry-run": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
15
|
+
profile: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
16
|
+
full: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
17
|
+
fields: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
18
|
+
exclude: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
19
|
+
};
|
|
20
|
+
run(): Promise<void>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const base_command_1 = require("../../base-command");
|
|
5
|
+
const bug_reports_1 = require("../../lib/bug-reports");
|
|
6
|
+
class BugReportsList extends base_command_1.BaseCommand {
|
|
7
|
+
async run() {
|
|
8
|
+
(0, bug_reports_1.assertSignedIn)({
|
|
9
|
+
apiKey: this.configManager.resolveApiKey(this.getFlag("api-key")),
|
|
10
|
+
hasSession: this.credentials.get(this.profileName) !== undefined,
|
|
11
|
+
});
|
|
12
|
+
const status = this.getFlag("status");
|
|
13
|
+
const page = this.getFlag("page");
|
|
14
|
+
const limit = this.getFlag("limit");
|
|
15
|
+
let res;
|
|
16
|
+
try {
|
|
17
|
+
res = await this.apiClient.get("/bug-reports", { page, limit, ...(status && { status }) });
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
throw (0, bug_reports_1.bugReportApiError)(error);
|
|
21
|
+
}
|
|
22
|
+
const { total } = res.meta;
|
|
23
|
+
const has_next = page * limit < total;
|
|
24
|
+
const hints = { get_detail: "ecomweb bug-reports get <number>" };
|
|
25
|
+
if (has_next) {
|
|
26
|
+
hints.next_page = `ecomweb bug-reports list --page ${page + 1}${status ? ` --status ${status}` : ""}${limit !== 20 ? ` --limit ${limit}` : ""}`;
|
|
27
|
+
}
|
|
28
|
+
this.outputResult({
|
|
29
|
+
resource: "bug-reports",
|
|
30
|
+
action: "list",
|
|
31
|
+
data: res.data.map(bug_reports_1.toCliReport),
|
|
32
|
+
meta: { total, page, limit, has_next },
|
|
33
|
+
available_actions: ["get", "create"],
|
|
34
|
+
hints,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
BugReportsList.description = "List the bug reports you can see: yours, and those of your stores' team, newest first.";
|
|
39
|
+
BugReportsList.examples = ["ecomweb bug-reports list", "ecomweb bug-reports list --status fixed --page 2"];
|
|
40
|
+
BugReportsList.flags = {
|
|
41
|
+
...base_command_1.BaseCommand.baseFlags,
|
|
42
|
+
status: core_1.Flags.string({ options: [...bug_reports_1.BUG_REPORT_STATUSES], description: "Only reports with this status" }),
|
|
43
|
+
page: core_1.Flags.integer({ default: 1, min: 1, description: "Page number" }),
|
|
44
|
+
limit: core_1.Flags.integer({ default: 20, min: 1, max: 100, description: "Reports per page (at most 100)" }),
|
|
45
|
+
};
|
|
46
|
+
exports.default = BugReportsList;
|
|
47
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/bug-reports/list.ts"],"names":[],"mappings":";;AAAA,sCAAoC;AACpC,qDAAiD;AACjD,uDAAoI;AAEpI,MAAqB,cAAe,SAAQ,0BAAW;IAYrD,KAAK,CAAC,GAAG;QACP,IAAA,4BAAc,EAAC;YACb,MAAM,EAAE,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;YACjE,UAAU,EAAE,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,SAAS;SACjE,CAAC,CAAC;QAEH,MAAM,MAAM,G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AAK;SACN,CAAC,CAAC;IACL,CAAC;;AA5CM,0BAAW,GAAG,wFAAwF,CAAC;AAEvG,uBAAQ,GAAG,CAAC,0BAA0B,EAAE,kDAAkD,CAAC,CAAC;AAE5F,oBAAK,GAAG;IACb,GAAG,0BAAW,CAAC,SAAS;IACxB,MAAM,EAAE,YAAK,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,GAAG,iCAAmB,CAAC,EAAE,WAAW,EAAE,+BAA+B,EAAE,CAAC;IACzG,IAAI,EAAE,YAAK,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,WAAW,EAAE,aAAa,EAAE,CAAC;IACvE,KAAK,EAAE,YAAK,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,WAAW,EAAE,gCAAgC,EAAE,CAAC;CACvG,CAAC;kBAViB,cAAc"}
|
package/dist/lib/api-client.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { AxiosRequestConfig } from "axios";
|
|
2
2
|
import FormData from "form-data";
|
|
3
3
|
import { SessionProvider } from "./session";
|
|
4
|
+
declare module "axios" {
|
|
5
|
+
interface AxiosRequestConfig {
|
|
6
|
+
retryRateLimit?: boolean;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
4
9
|
export interface ApiClientOptions {
|
|
5
10
|
baseUrl: string;
|
|
6
11
|
apiKey?: string;
|
|
@@ -43,6 +48,7 @@ export declare class ApiClient {
|
|
|
43
48
|
storeEventStream(path: string, opts?: {
|
|
44
49
|
signal?: AbortSignal;
|
|
45
50
|
}): Promise<AsyncIterable<Buffer>>;
|
|
51
|
+
upload<T = any>(path: string, formData: FormData, config?: AxiosRequestConfig): Promise<T>;
|
|
46
52
|
storeUpload<T = any>(path: string, formData: FormData): Promise<T>;
|
|
47
53
|
listPaginated<T = any>(path: string, params?: Record<string, any>): Promise<PaginatedResponse<T>>;
|
|
48
54
|
listAll<T = any>(path: string, params?: Record<string, any>): Promise<T[]>;
|
package/dist/lib/api-client.js
CHANGED
|
@@ -43,7 +43,7 @@ class ApiClient {
|
|
|
43
43
|
this.client.interceptors.response.use(undefined, async (error) => {
|
|
44
44
|
const config = error.config;
|
|
45
45
|
const status = error.response?.status;
|
|
46
|
-
if (config && status === 429 && (config._retryCount ?? 0) < 3) {
|
|
46
|
+
if (config && status === 429 && config.retryRateLimit !== false && (config._retryCount ?? 0) < 3) {
|
|
47
47
|
config._retryCount = (config._retryCount || 0) + 1;
|
|
48
48
|
const delay = Math.pow(2, config._retryCount) * 1000;
|
|
49
49
|
await new Promise((r) => setTimeout(r, delay));
|
|
@@ -130,13 +130,17 @@ class ApiClient {
|
|
|
130
130
|
});
|
|
131
131
|
return data;
|
|
132
132
|
}
|
|
133
|
-
async
|
|
134
|
-
return this.post(
|
|
133
|
+
async upload(path, formData, config) {
|
|
134
|
+
return this.post(path, formData, {
|
|
135
|
+
...config,
|
|
135
136
|
headers: formData.getHeaders(),
|
|
136
137
|
maxContentLength: Infinity,
|
|
137
138
|
maxBodyLength: Infinity,
|
|
138
139
|
});
|
|
139
140
|
}
|
|
141
|
+
async storeUpload(path, formData) {
|
|
142
|
+
return this.upload(this.storePath(path), formData);
|
|
143
|
+
}
|
|
140
144
|
async listPaginated(path, params) {
|
|
141
145
|
return this.storeGet(path, params);
|
|
142
146
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-client.js","sourceRoot":"","sources":["../../src/lib/api-client.ts"],"names":[],"mappings":";;;;;;AAAA,kDAAiE;AACjE,0DAAiC;AACjC,uCAAyD;
|
|
1
|
+
{"version":3,"file":"api-client.js","sourceRoot":"","sources":["../../src/lib/api-client.ts"],"names":[],"mappings":";;;;;;AAAA,kDAAiE;AACjE,0DAAiC;AACjC,uCAAyD;AAqB5C,QAAA,YAAY,GAAG,CAAC,CAAC;AAC9B,MAAM,cAAc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,EAAE,MAAM,CAAC,CAAC;QACtD,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;IAC5D,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,GAAW;QACxB,OAAO,IAAI,CAAC,GAAG,CAAC,WAAW,GAAG,EAAE,CAAC,CAAC;IACpC,CAAC;CACF;AAtND,8BAsNC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import FormData from "form-data";
|
|
2
|
+
import type { Screenshot } from "./screenshot";
|
|
3
|
+
export declare const BUG_REPORT_STATUSES: readonly ["new", "confirmed", "in_progress", "fixed", "wont_fix", "duplicate"];
|
|
4
|
+
export type BugReportStatus = (typeof BUG_REPORT_STATUSES)[number];
|
|
5
|
+
export declare const BUG_REPORT_LIMITS: {
|
|
6
|
+
readonly title: 200;
|
|
7
|
+
readonly description: 5000;
|
|
8
|
+
readonly steps: 5000;
|
|
9
|
+
readonly tool_name: 64;
|
|
10
|
+
readonly error_code: 64;
|
|
11
|
+
};
|
|
12
|
+
export declare const BUG_REPORT_RATE: {
|
|
13
|
+
readonly perHour: 10;
|
|
14
|
+
readonly perDay: 30;
|
|
15
|
+
};
|
|
16
|
+
export declare const STATUS_LABELS_EN: Record<BugReportStatus, string>;
|
|
17
|
+
export declare function statusLabel(status: string, duplicateOf?: string | null): string;
|
|
18
|
+
export declare function parseReportNumber(raw: string): string;
|
|
19
|
+
export declare function reportText(flag: string, raw: string | undefined, max: number, opts?: {
|
|
20
|
+
required?: boolean;
|
|
21
|
+
}): string | undefined;
|
|
22
|
+
export interface MerchantBugReport {
|
|
23
|
+
id: string;
|
|
24
|
+
number: string;
|
|
25
|
+
title: string;
|
|
26
|
+
description: string;
|
|
27
|
+
steps: string | null;
|
|
28
|
+
store: {
|
|
29
|
+
ref: string;
|
|
30
|
+
name: string;
|
|
31
|
+
} | null;
|
|
32
|
+
source: "dashboard" | "cli" | "mcp";
|
|
33
|
+
reporter: {
|
|
34
|
+
name: string | null;
|
|
35
|
+
is_me: boolean;
|
|
36
|
+
};
|
|
37
|
+
status: BugReportStatus;
|
|
38
|
+
duplicate_of: string | null;
|
|
39
|
+
outcome: {
|
|
40
|
+
status: BugReportStatus;
|
|
41
|
+
reply: string | null;
|
|
42
|
+
};
|
|
43
|
+
status_changed_at: string | null;
|
|
44
|
+
created_at: string;
|
|
45
|
+
}
|
|
46
|
+
export type CliBugReport = MerchantBugReport & {
|
|
47
|
+
status_label: string;
|
|
48
|
+
outcome: {
|
|
49
|
+
status: BugReportStatus;
|
|
50
|
+
status_label: string;
|
|
51
|
+
reply: string | null;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
export declare function toCliReport(report: MerchantBugReport): CliBugReport;
|
|
55
|
+
export interface BugReportBody {
|
|
56
|
+
title: string;
|
|
57
|
+
description: string;
|
|
58
|
+
blocking: boolean;
|
|
59
|
+
steps?: string;
|
|
60
|
+
store?: string;
|
|
61
|
+
tool_name?: string;
|
|
62
|
+
error_code?: string;
|
|
63
|
+
}
|
|
64
|
+
export declare function bugReportForm(body: BugReportBody, shot: Screenshot): FormData;
|
|
65
|
+
export declare function assertSignedIn(opts: {
|
|
66
|
+
apiKey: string | undefined;
|
|
67
|
+
hasSession: boolean;
|
|
68
|
+
dryRun?: boolean;
|
|
69
|
+
}): void;
|
|
70
|
+
export declare function bugReportApiError(error: unknown, ctx?: {
|
|
71
|
+
store?: string;
|
|
72
|
+
number?: string;
|
|
73
|
+
}): unknown;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.STATUS_LABELS_EN = exports.BUG_REPORT_RATE = exports.BUG_REPORT_LIMITS = exports.BUG_REPORT_STATUSES = void 0;
|
|
7
|
+
exports.statusLabel = statusLabel;
|
|
8
|
+
exports.parseReportNumber = parseReportNumber;
|
|
9
|
+
exports.reportText = reportText;
|
|
10
|
+
exports.toCliReport = toCliReport;
|
|
11
|
+
exports.bugReportForm = bugReportForm;
|
|
12
|
+
exports.assertSignedIn = assertSignedIn;
|
|
13
|
+
exports.bugReportApiError = bugReportApiError;
|
|
14
|
+
const form_data_1 = __importDefault(require("form-data"));
|
|
15
|
+
const errors_1 = require("./errors");
|
|
16
|
+
const session_1 = require("./session");
|
|
17
|
+
exports.BUG_REPORT_STATUSES = ["new", "confirmed", "in_progress", "fixed", "wont_fix", "duplicate"];
|
|
18
|
+
exports.BUG_REPORT_LIMITS = { title: 200, description: 5000, steps: 5000, tool_name: 64, error_code: 64 };
|
|
19
|
+
exports.BUG_REPORT_RATE = { perHour: 10, perDay: 30 };
|
|
20
|
+
exports.STATUS_LABELS_EN = {
|
|
21
|
+
new: "Received",
|
|
22
|
+
confirmed: "Confirmed",
|
|
23
|
+
in_progress: "Being fixed",
|
|
24
|
+
fixed: "Fixed",
|
|
25
|
+
wont_fix: "Won't fix",
|
|
26
|
+
duplicate: "Duplicate",
|
|
27
|
+
};
|
|
28
|
+
function statusLabel(status, duplicateOf) {
|
|
29
|
+
if (status === "duplicate")
|
|
30
|
+
return duplicateOf ? `Duplicate of ${duplicateOf}` : "Duplicate";
|
|
31
|
+
return exports.STATUS_LABELS_EN[status] ?? status;
|
|
32
|
+
}
|
|
33
|
+
function parseReportNumber(raw) {
|
|
34
|
+
const m = /^#?0*([1-9]\d{0,17})$/.exec(raw);
|
|
35
|
+
if (!m) {
|
|
36
|
+
throw new errors_1.CliError("INVALID_ID", `The report number must be like 1042 or #1042, got "${raw}".`, errors_1.ExitCode.VALIDATION, {
|
|
37
|
+
hint: "ecomweb bug-reports list shows your reports' numbers. In a shell, quote '#1042' or leave the # out.",
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
return m[1];
|
|
41
|
+
}
|
|
42
|
+
function reportText(flag, raw, max, opts = {}) {
|
|
43
|
+
const value = (raw ?? "").trim();
|
|
44
|
+
if (value === "") {
|
|
45
|
+
if (opts.required)
|
|
46
|
+
throw new errors_1.CliError("INVALID_INPUT", `${flag} can't be blank.`, errors_1.ExitCode.VALIDATION);
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
const length = Array.from(value).length;
|
|
50
|
+
if (length > max) {
|
|
51
|
+
throw new errors_1.CliError("INVALID_INPUT", `${flag} is ${length} characters; the most is ${max}.`, errors_1.ExitCode.VALIDATION, {
|
|
52
|
+
details: { flag, length, max },
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
return value;
|
|
56
|
+
}
|
|
57
|
+
function toCliReport(report) {
|
|
58
|
+
return {
|
|
59
|
+
...report,
|
|
60
|
+
status_label: statusLabel(report.status, report.duplicate_of),
|
|
61
|
+
outcome: { ...report.outcome, status_label: statusLabel(report.outcome.status) },
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
function bugReportForm(body, shot) {
|
|
65
|
+
const form = new form_data_1.default();
|
|
66
|
+
form.append("title", body.title);
|
|
67
|
+
form.append("description", body.description);
|
|
68
|
+
form.append("blocking", String(body.blocking));
|
|
69
|
+
for (const key of ["steps", "store", "tool_name", "error_code"]) {
|
|
70
|
+
const value = body[key];
|
|
71
|
+
if (value !== undefined)
|
|
72
|
+
form.append(key, value);
|
|
73
|
+
}
|
|
74
|
+
form.append("screenshot", shot.buffer, { filename: shot.filename, contentType: shot.mime });
|
|
75
|
+
return form;
|
|
76
|
+
}
|
|
77
|
+
function assertSignedIn(opts) {
|
|
78
|
+
if (opts.apiKey) {
|
|
79
|
+
throw new errors_1.CliError("SIGN_IN_REQUIRED", "Bug reports are sent as you, so they need you signed in. This command is using an API key (--api-key or ECOMWEB_API_KEY), which can't send or read bug reports.", errors_1.ExitCode.AUTH_FAILURE, { hint: "Unset ECOMWEB_API_KEY (or drop --api-key), then run: ecomweb auth login" });
|
|
80
|
+
}
|
|
81
|
+
if (!opts.hasSession && !opts.dryRun)
|
|
82
|
+
throw (0, session_1.notLoggedIn)();
|
|
83
|
+
}
|
|
84
|
+
function bugReportApiError(error, ctx = {}) {
|
|
85
|
+
const code = (0, errors_1.apiErrorCode)(error);
|
|
86
|
+
const data = error?.response?.data;
|
|
87
|
+
const message = typeof data?.message === "string" ? data.message : "";
|
|
88
|
+
switch (code) {
|
|
89
|
+
case "BUG_REPORT_RATE_LIMITED":
|
|
90
|
+
return new errors_1.CliError(code, message, errors_1.ExitCode.ERROR, {
|
|
91
|
+
hint: "Wait a while before sending another: the limit is 10 reports an hour and 30 a day. ecomweb bug-reports list shows the ones already sent.",
|
|
92
|
+
...(data?.details && typeof data.details === "object" ? { details: data.details } : {}),
|
|
93
|
+
});
|
|
94
|
+
case "BUG_REPORT_STORE_NOT_FOUND":
|
|
95
|
+
return new errors_1.CliError(code, `You're not a member of store ${ctx.store}, or it was deleted.`, errors_1.ExitCode.NOT_FOUND, {
|
|
96
|
+
hint: "This report was about the current store. Pass --store-ref <ref> for one of your stores (ecomweb stores list), or --no-store if the problem is not about a store.",
|
|
97
|
+
details: { store: ctx.store },
|
|
98
|
+
});
|
|
99
|
+
case "BUG_REPORT_SCREENSHOT_INVALID":
|
|
100
|
+
return new errors_1.CliError(code, message, errors_1.ExitCode.VALIDATION, {
|
|
101
|
+
hint: "Use a PNG, JPEG or WebP image of at most 5 MB, or leave out --screenshot.",
|
|
102
|
+
});
|
|
103
|
+
case "BUG_REPORT_NOT_FOUND":
|
|
104
|
+
return new errors_1.CliError(code, `No bug report #${ctx.number} that you can see.`, errors_1.ExitCode.NOT_FOUND, {
|
|
105
|
+
hint: "ecomweb bug-reports list shows the reports you can see.",
|
|
106
|
+
});
|
|
107
|
+
default:
|
|
108
|
+
return error;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
//# sourceMappingURL=bug-reports.js.map
|
|
@@ -0,0 +1 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AI,EAAE,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;IACtE,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,yBAAyB;YAC5B,OAAO,IAAI,iBAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,iBAAQ,CAAC,KAAK,EAAE;gBACjD,IAAI,EAAE,0IAA0I;gBAChJ,GAAG,CAAC,IAAI,EAAE,OAAO,IAAI,OAAO,IAAI,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAkC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aACnH,CAAC,CAAC;QACL,KAAK,4BAA4B;YAC/B,OAAO,IAAI,iBAAQ,CAAC,IAAI,EAAE,gCAAgC,GAAG,CAAC,KAAK,sBAAsB,EAAE,iBAAQ,CAAC,SAAS,EAAE;gBAC7G,IAAI,EAAE,kKAAkK;gBACxK,OAAO,EAAE,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE;aAC9B,CAAC,CAAC;QACL,KAAK,+BAA+B;YAClC,OAAO,IAAI,iBAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,iBAAQ,CAAC,UAAU,EAAE;gBACtD,IAAI,EAAE,2EAA2E;aAClF,CAAC,CAAC;QACL,KAAK,sBAAsB;YACzB,OAAO,IAAI,iBAAQ,CAAC,IAAI,EAAE,kBAAkB,GAAG,CAAC,MAAM,oBAAoB,EAAE,iBAAQ,CAAC,SAAS,EAAE;gBAC9F,IAAI,EAAE,yDAAyD;aAChE,CAAC,CAAC;QACL;YACE,OAAO,KAAK,CAAC;IACjB,CAAC;AACH,CAAC"}
|
package/dist/lib/errors.js
CHANGED
|
@@ -166,10 +166,12 @@ function badRequestPayload(data) {
|
|
|
166
166
|
: typeof body.error === "string"
|
|
167
167
|
? body.error
|
|
168
168
|
: "Bad request";
|
|
169
|
-
const errors = Array.isArray(body.errors) ? body.errors : []
|
|
169
|
+
const errors = (Array.isArray(body.errors) ? body.errors : [])
|
|
170
|
+
.filter((e) => !!e && typeof e === "object")
|
|
171
|
+
.map(({ field, message, constraint }) => ({ field, message, constraint }));
|
|
170
172
|
const reasons = errors
|
|
171
|
-
.
|
|
172
|
-
.
|
|
173
|
+
.filter((e) => typeof e.message === "string" && !base.includes(e.message))
|
|
174
|
+
.map((e) => (typeof e.field === "string" ? `${e.field}: ${e.message}` : e.message));
|
|
173
175
|
return {
|
|
174
176
|
code,
|
|
175
177
|
message: reasons.length ? `${base}: ${reasons.join("; ")}` : base,
|