@ecomweb/cli 0.2.0 → 0.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 +11 -2
- package/dist/base-command.d.ts +3 -0
- package/dist/base-command.js +2 -0
- package/dist/base-command.js.map +1 -1
- package/dist/commands/assets/upload-and-link.js +2 -1
- package/dist/commands/assets/upload-and-link.js.map +1 -1
- package/dist/commands/assets/upload.js +2 -1
- package/dist/commands/assets/upload.js.map +1 -1
- package/dist/commands/attributes/list.d.ts +2 -0
- package/dist/commands/attributes/list.js +20 -9
- package/dist/commands/attributes/list.js.map +1 -1
- package/dist/commands/auth/login.js +9 -0
- package/dist/commands/auth/login.js.map +1 -1
- package/dist/commands/auth/status.js +8 -1
- package/dist/commands/auth/status.js.map +1 -1
- package/dist/commands/blog-posts/create.js.map +1 -1
- package/dist/commands/categories/all.d.ts +2 -18
- package/dist/commands/categories/all.js +2 -24
- package/dist/commands/categories/all.js.map +1 -1
- package/dist/commands/categories/create.d.ts +2 -27
- package/dist/commands/categories/create.js +2 -73
- package/dist/commands/categories/create.js.map +1 -1
- package/dist/commands/categories/delete.d.ts +2 -24
- package/dist/commands/categories/delete.js +2 -30
- package/dist/commands/categories/delete.js.map +1 -1
- package/dist/commands/categories/get.d.ts +2 -23
- package/dist/commands/categories/get.js +2 -26
- package/dist/commands/categories/get.js.map +1 -1
- package/dist/commands/categories/list.d.ts +2 -27
- package/dist/commands/categories/list.js +2 -65
- package/dist/commands/categories/list.js.map +1 -1
- package/dist/commands/categories/update.d.ts +2 -33
- package/dist/commands/categories/update.js +2 -79
- package/dist/commands/categories/update.js.map +1 -1
- package/dist/commands/collections/create.js +3 -2
- package/dist/commands/collections/create.js.map +1 -1
- package/dist/commands/describe.js +6 -0
- package/dist/commands/describe.js.map +1 -1
- package/dist/commands/product-services/assign.d.ts +26 -0
- package/dist/commands/product-services/assign.js +51 -0
- package/dist/commands/product-services/assign.js.map +1 -0
- package/dist/commands/product-services/create.d.ts +25 -0
- package/dist/commands/product-services/create.js +65 -0
- package/dist/commands/product-services/create.js.map +1 -0
- package/dist/commands/product-services/delete.d.ts +24 -0
- package/dist/commands/product-services/delete.js +30 -0
- package/dist/commands/product-services/delete.js.map +1 -0
- package/dist/commands/product-services/list.d.ts +19 -0
- package/dist/commands/product-services/list.js +33 -0
- package/dist/commands/product-services/list.js.map +1 -0
- package/dist/commands/product-services/update.d.ts +31 -0
- package/dist/commands/product-services/update.js +66 -0
- package/dist/commands/product-services/update.js.map +1 -0
- package/dist/commands/product-tags/list.d.ts +5 -0
- package/dist/commands/product-tags/list.js +36 -4
- package/dist/commands/product-tags/list.js.map +1 -1
- package/dist/commands/products/create.d.ts +2 -1
- package/dist/commands/products/create.js +6 -3
- package/dist/commands/products/create.js.map +1 -1
- package/dist/commands/products/get.d.ts +0 -1
- package/dist/commands/products/get.js +1 -3
- package/dist/commands/products/get.js.map +1 -1
- package/dist/commands/products/list.d.ts +0 -2
- package/dist/commands/products/list.js +2 -6
- package/dist/commands/products/list.js.map +1 -1
- package/dist/commands/products/search.d.ts +0 -2
- package/dist/commands/products/search.js +1 -5
- package/dist/commands/products/search.js.map +1 -1
- package/dist/commands/products/update.d.ts +2 -1
- package/dist/commands/products/update.js +6 -3
- package/dist/commands/products/update.js.map +1 -1
- package/dist/commands/store-settings/auth/get.d.ts +18 -0
- package/dist/commands/store-settings/auth/get.js +23 -0
- package/dist/commands/store-settings/auth/get.js.map +1 -0
- package/dist/commands/store-settings/auth/update.d.ts +29 -0
- package/dist/commands/store-settings/auth/update.js +78 -0
- package/dist/commands/store-settings/auth/update.js.map +1 -0
- package/dist/commands/stores/current.js +19 -2
- package/dist/commands/stores/current.js.map +1 -1
- package/dist/commands/stores/update.d.ts +22 -0
- package/dist/commands/stores/update.js +60 -0
- package/dist/commands/stores/update.js.map +1 -0
- package/dist/lib/categories-removed.d.ts +9 -0
- package/dist/lib/categories-removed.js +22 -0
- package/dist/lib/categories-removed.js.map +1 -0
- package/dist/lib/config.d.ts +2 -0
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/email-login.d.ts +7 -0
- package/dist/lib/email-login.js +35 -18
- package/dist/lib/email-login.js.map +1 -1
- package/dist/lib/multipart.d.ts +2 -0
- package/dist/lib/multipart.js +15 -0
- package/dist/lib/multipart.js.map +1 -0
- package/dist/lib/stdin.d.ts +6 -2
- package/dist/lib/stdin.js +9 -9
- package/dist/lib/stdin.js.map +1 -1
- package/dist/lib/validators.d.ts +11 -0
- package/dist/lib/validators.js +104 -43
- package/dist/lib/validators.js.map +1 -1
- package/oclif.manifest.json +4945 -4114
- package/package.json +1 -1
|
@@ -1,24 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export default class CategoriesGet extends
|
|
3
|
-
static description: string;
|
|
4
|
-
static examples: string[];
|
|
5
|
-
static args: {
|
|
6
|
-
id: import("@oclif/core/lib/interfaces").Arg<number, {
|
|
7
|
-
max?: number;
|
|
8
|
-
min?: number;
|
|
9
|
-
}>;
|
|
10
|
-
};
|
|
11
|
-
static flags: {
|
|
12
|
-
"store-ref": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
13
|
-
"api-key": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
14
|
-
"api-url": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
15
|
-
output: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
16
|
-
quiet: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
17
|
-
"dry-run": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
18
|
-
profile: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
19
|
-
full: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
20
|
-
fields: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
21
|
-
exclude: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
22
|
-
};
|
|
23
|
-
run(): Promise<void>;
|
|
1
|
+
import { CategoriesRemovedCommand } from "../../lib/categories-removed";
|
|
2
|
+
export default class CategoriesGet extends CategoriesRemovedCommand {
|
|
24
3
|
}
|
|
@@ -1,31 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
const output_1 = require("../../lib/output");
|
|
6
|
-
class CategoriesGet extends base_command_1.BaseCommand {
|
|
7
|
-
async run() {
|
|
8
|
-
const storeRef = this.requireStore();
|
|
9
|
-
const { args } = await this.parse(CategoriesGet);
|
|
10
|
-
const category = await this.apiClient.storeGet(`/categories/${args.id}`);
|
|
11
|
-
this.outputResult((0, output_1.getEnvelope)("categories", storeRef, category, {
|
|
12
|
-
hints: {
|
|
13
|
-
update: `ecomweb categories update ${args.id} --stdin`,
|
|
14
|
-
delete: `ecomweb categories delete ${args.id}`,
|
|
15
|
-
list: "ecomweb categories list",
|
|
16
|
-
},
|
|
17
|
-
}));
|
|
18
|
-
}
|
|
3
|
+
const categories_removed_1 = require("../../lib/categories-removed");
|
|
4
|
+
class CategoriesGet extends categories_removed_1.CategoriesRemovedCommand {
|
|
19
5
|
}
|
|
20
|
-
CategoriesGet.description = "Get a category by ID";
|
|
21
|
-
CategoriesGet.examples = [
|
|
22
|
-
"ecomweb categories get 42",
|
|
23
|
-
];
|
|
24
|
-
CategoriesGet.args = {
|
|
25
|
-
id: core_1.Args.integer({ description: "Category ID", required: true }),
|
|
26
|
-
};
|
|
27
|
-
CategoriesGet.flags = {
|
|
28
|
-
...base_command_1.BaseCommand.baseFlags,
|
|
29
|
-
};
|
|
30
6
|
exports.default = CategoriesGet;
|
|
31
7
|
//# sourceMappingURL=get.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get.js","sourceRoot":"","sources":["../../../src/commands/categories/get.ts"],"names":[],"mappings":";;AAAA,
|
|
1
|
+
{"version":3,"file":"get.js","sourceRoot":"","sources":["../../../src/commands/categories/get.ts"],"names":[],"mappings":";;AAAA,qEAAwE;AAExE,MAAqB,aAAc,SAAQ,6CAAwB;CAAG;AAAtE,gCAAsE"}
|
|
@@ -1,28 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export default class CategoriesList extends
|
|
3
|
-
static description: string;
|
|
4
|
-
static examples: string[];
|
|
5
|
-
static flags: {
|
|
6
|
-
"parent-id": import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
7
|
-
"is-active": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
8
|
-
name: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
9
|
-
"external-cat-id": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
|
-
"include-counts": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
11
|
-
"include-children": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
12
|
-
"sort-by": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
13
|
-
"sort-order": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
14
|
-
limit: import("@oclif/core/lib/interfaces").OptionFlag<number, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
15
|
-
offset: import("@oclif/core/lib/interfaces").OptionFlag<number, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
16
|
-
"store-ref": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
17
|
-
"api-key": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
18
|
-
"api-url": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
19
|
-
output: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
20
|
-
quiet: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
21
|
-
"dry-run": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
22
|
-
profile: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
23
|
-
full: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
24
|
-
fields: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
25
|
-
exclude: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
26
|
-
};
|
|
27
|
-
run(): Promise<void>;
|
|
1
|
+
import { CategoriesRemovedCommand } from "../../lib/categories-removed";
|
|
2
|
+
export default class CategoriesList extends CategoriesRemovedCommand {
|
|
28
3
|
}
|
|
@@ -1,70 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
const output_1 = require("../../lib/output");
|
|
6
|
-
class CategoriesList extends base_command_1.BaseCommand {
|
|
7
|
-
async run() {
|
|
8
|
-
const storeRef = this.requireStore();
|
|
9
|
-
const params = {};
|
|
10
|
-
const flagMap = {
|
|
11
|
-
"parent-id": "parent_id",
|
|
12
|
-
"is-active": "is_active",
|
|
13
|
-
name: "name",
|
|
14
|
-
"external-cat-id": "external_cat_id",
|
|
15
|
-
"include-counts": "include_counts",
|
|
16
|
-
"include-children": "include_children",
|
|
17
|
-
"sort-by": "sort_by",
|
|
18
|
-
"sort-order": "sort_order",
|
|
19
|
-
limit: "limit",
|
|
20
|
-
offset: "offset",
|
|
21
|
-
};
|
|
22
|
-
for (const [flag, param] of Object.entries(flagMap)) {
|
|
23
|
-
const value = this.getFlag(flag);
|
|
24
|
-
if (value !== undefined)
|
|
25
|
-
params[param] = value;
|
|
26
|
-
}
|
|
27
|
-
const response = await this.apiClient.listPaginated("/categories", params);
|
|
28
|
-
this.outputResult((0, output_1.listEnvelope)("categories", storeRef, response.data, {
|
|
29
|
-
total: response.meta.total,
|
|
30
|
-
limit: response.meta.limit,
|
|
31
|
-
offset: response.meta.offset,
|
|
32
|
-
has_next: response.meta.hasNext,
|
|
33
|
-
}, {
|
|
34
|
-
hints: {
|
|
35
|
-
get_detail: "ecomweb categories get <id>",
|
|
36
|
-
create: "ecomweb categories create --stdin",
|
|
37
|
-
next_page: response.meta.hasNext
|
|
38
|
-
? `ecomweb categories list --offset ${response.meta.offset + response.meta.limit}`
|
|
39
|
-
: undefined,
|
|
40
|
-
},
|
|
41
|
-
}));
|
|
42
|
-
}
|
|
3
|
+
const categories_removed_1 = require("../../lib/categories-removed");
|
|
4
|
+
class CategoriesList extends categories_removed_1.CategoriesRemovedCommand {
|
|
43
5
|
}
|
|
44
|
-
CategoriesList.description = "List categories with pagination and filtering";
|
|
45
|
-
CategoriesList.examples = [
|
|
46
|
-
"ecomweb categories list",
|
|
47
|
-
"ecomweb categories list --is-active --include-children",
|
|
48
|
-
"ecomweb categories list --parent-id 5 --sort-by name --sort-order asc",
|
|
49
|
-
];
|
|
50
|
-
CategoriesList.flags = {
|
|
51
|
-
...base_command_1.BaseCommand.baseFlags,
|
|
52
|
-
"parent-id": core_1.Flags.integer({ description: "Filter by parent category ID" }),
|
|
53
|
-
"is-active": core_1.Flags.boolean({
|
|
54
|
-
description: "Filter by active status",
|
|
55
|
-
allowNo: true,
|
|
56
|
-
}),
|
|
57
|
-
name: core_1.Flags.string({ description: "Filter by name" }),
|
|
58
|
-
"external-cat-id": core_1.Flags.string({ description: "Filter by external category ID" }),
|
|
59
|
-
"include-counts": core_1.Flags.boolean({ description: "Include product counts" }),
|
|
60
|
-
"include-children": core_1.Flags.boolean({ description: "Include child categories" }),
|
|
61
|
-
"sort-by": core_1.Flags.string({ description: "Sort field" }),
|
|
62
|
-
"sort-order": core_1.Flags.string({
|
|
63
|
-
description: "Sort direction",
|
|
64
|
-
options: ["asc", "desc"],
|
|
65
|
-
}),
|
|
66
|
-
limit: core_1.Flags.integer({ description: "Results per page", default: 20 }),
|
|
67
|
-
offset: core_1.Flags.integer({ description: "Offset for pagination", default: 0 }),
|
|
68
|
-
};
|
|
69
6
|
exports.default = CategoriesList;
|
|
70
7
|
//# sourceMappingURL=list.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/categories/list.ts"],"names":[],"mappings":";;AAAA,
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/categories/list.ts"],"names":[],"mappings":";;AAAA,qEAAwE;AAExE,MAAqB,cAAe,SAAQ,6CAAwB;CAAG;AAAvE,iCAAuE"}
|
|
@@ -1,34 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export default class CategoriesUpdate extends
|
|
3
|
-
static description: string;
|
|
4
|
-
static examples: string[];
|
|
5
|
-
static args: {
|
|
6
|
-
id: import("@oclif/core/lib/interfaces").Arg<number, {
|
|
7
|
-
max?: number;
|
|
8
|
-
min?: number;
|
|
9
|
-
}>;
|
|
10
|
-
};
|
|
11
|
-
static flags: {
|
|
12
|
-
stdin: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
13
|
-
file: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
14
|
-
name: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
15
|
-
slug: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
16
|
-
description: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
17
|
-
"image-url": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
18
|
-
"parent-id": import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
19
|
-
"sort-order": import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
20
|
-
"is-active": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
21
|
-
"external-cat-id": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
22
|
-
"store-ref": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
23
|
-
"api-key": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
24
|
-
"api-url": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
25
|
-
output: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
26
|
-
quiet: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
27
|
-
"dry-run": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
28
|
-
profile: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
29
|
-
full: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
30
|
-
fields: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
31
|
-
exclude: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
32
|
-
};
|
|
33
|
-
run(): Promise<void>;
|
|
1
|
+
import { CategoriesRemovedCommand } from "../../lib/categories-removed";
|
|
2
|
+
export default class CategoriesUpdate extends CategoriesRemovedCommand {
|
|
34
3
|
}
|
|
@@ -1,84 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
const output_1 = require("../../lib/output");
|
|
6
|
-
const stdin_1 = require("../../lib/stdin");
|
|
7
|
-
class CategoriesUpdate extends base_command_1.BaseCommand {
|
|
8
|
-
async run() {
|
|
9
|
-
const storeRef = this.requireStore();
|
|
10
|
-
const { args } = await this.parse(CategoriesUpdate);
|
|
11
|
-
let body = await (0, stdin_1.getJsonInput)({
|
|
12
|
-
stdin: this.getFlag("stdin"),
|
|
13
|
-
file: this.getFlag("file"),
|
|
14
|
-
});
|
|
15
|
-
if (body && body.data && typeof body.data === "object") {
|
|
16
|
-
body = body.data;
|
|
17
|
-
}
|
|
18
|
-
if (!body) {
|
|
19
|
-
body = {};
|
|
20
|
-
if (this.getFlag("name"))
|
|
21
|
-
body.name = this.getFlag("name");
|
|
22
|
-
if (this.getFlag("slug"))
|
|
23
|
-
body.slug = this.getFlag("slug");
|
|
24
|
-
if (this.getFlag("description"))
|
|
25
|
-
body.description = this.getFlag("description");
|
|
26
|
-
if (this.getFlag("image-url"))
|
|
27
|
-
body.image_url = this.getFlag("image-url");
|
|
28
|
-
if (this.getFlag("parent-id") !== undefined)
|
|
29
|
-
body.parent_id = this.getFlag("parent-id");
|
|
30
|
-
if (this.getFlag("sort-order") !== undefined)
|
|
31
|
-
body.sort_order = this.getFlag("sort-order");
|
|
32
|
-
if (this.getFlag("is-active") !== undefined)
|
|
33
|
-
body.is_active = this.getFlag("is-active");
|
|
34
|
-
if (this.getFlag("external-cat-id"))
|
|
35
|
-
body.external_cat_id = this.getFlag("external-cat-id");
|
|
36
|
-
if (Object.keys(body).length === 0) {
|
|
37
|
-
this.outputJson({
|
|
38
|
-
error: {
|
|
39
|
-
code: "NO_INPUT",
|
|
40
|
-
message: "No input provided.",
|
|
41
|
-
hint: "Use --stdin, --file, or individual flags.",
|
|
42
|
-
},
|
|
43
|
-
});
|
|
44
|
-
this.exit(2);
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
if (this.isDryRun) {
|
|
49
|
-
this.outputResult((0, output_1.mutationEnvelope)("categories", "update (dry-run)", storeRef, { id: args.id, ...body }));
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
const result = await this.apiClient.storePut(`/categories/${args.id}`, body);
|
|
53
|
-
this.outputResult((0, output_1.mutationEnvelope)("categories", "update", storeRef, result, {
|
|
54
|
-
get: `ecomweb categories get ${args.id}`,
|
|
55
|
-
}));
|
|
56
|
-
}
|
|
3
|
+
const categories_removed_1 = require("../../lib/categories-removed");
|
|
4
|
+
class CategoriesUpdate extends categories_removed_1.CategoriesRemovedCommand {
|
|
57
5
|
}
|
|
58
|
-
CategoriesUpdate.description = "Update a category by ID";
|
|
59
|
-
CategoriesUpdate.examples = [
|
|
60
|
-
`ecomweb categories update 42 --stdin <<< '{"name":"Updated Category"}'`,
|
|
61
|
-
"ecomweb categories update 42 --name 'New Name' --is-active",
|
|
62
|
-
"ecomweb categories update 42 --file category.json",
|
|
63
|
-
];
|
|
64
|
-
CategoriesUpdate.args = {
|
|
65
|
-
id: core_1.Args.integer({ description: "Category ID", required: true }),
|
|
66
|
-
};
|
|
67
|
-
CategoriesUpdate.flags = {
|
|
68
|
-
...base_command_1.BaseCommand.baseFlags,
|
|
69
|
-
stdin: core_1.Flags.boolean({ description: "Read JSON body from stdin" }),
|
|
70
|
-
file: core_1.Flags.string({ description: "Read JSON body from file" }),
|
|
71
|
-
name: core_1.Flags.string({ description: "Category name" }),
|
|
72
|
-
slug: core_1.Flags.string({ description: "URL-friendly slug" }),
|
|
73
|
-
description: core_1.Flags.string({ description: "Category description" }),
|
|
74
|
-
"image-url": core_1.Flags.string({ description: "Category image URL" }),
|
|
75
|
-
"parent-id": core_1.Flags.integer({ description: "Parent category ID" }),
|
|
76
|
-
"sort-order": core_1.Flags.integer({ description: "Sort order" }),
|
|
77
|
-
"is-active": core_1.Flags.boolean({
|
|
78
|
-
description: "Whether category is active",
|
|
79
|
-
allowNo: true,
|
|
80
|
-
}),
|
|
81
|
-
"external-cat-id": core_1.Flags.string({ description: "External category ID" }),
|
|
82
|
-
};
|
|
83
6
|
exports.default = CategoriesUpdate;
|
|
84
7
|
//# sourceMappingURL=update.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../../src/commands/categories/update.ts"],"names":[],"mappings":";;AAAA,
|
|
1
|
+
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../../src/commands/categories/update.ts"],"names":[],"mappings":";;AAAA,qEAAwE;AAExE,MAAqB,gBAAiB,SAAQ,6CAAwB;CAAG;AAAzE,mCAAyE"}
|
|
@@ -41,6 +41,7 @@ class CollectionsCreate extends base_command_1.BaseCommand {
|
|
|
41
41
|
this.exit(2);
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
|
+
body.type ??= "manual";
|
|
44
45
|
}
|
|
45
46
|
if (this.isDryRun) {
|
|
46
47
|
this.outputResult((0, output_1.mutationEnvelope)("collections", "create (dry-run)", storeRef, body));
|
|
@@ -56,7 +57,7 @@ class CollectionsCreate extends base_command_1.BaseCommand {
|
|
|
56
57
|
CollectionsCreate.description = "Create a new collection";
|
|
57
58
|
CollectionsCreate.examples = [
|
|
58
59
|
`ecomweb collections create --stdin <<< '{"name":"Summer","type":"manual","slug":"summer","product_ids":[1,2,3]}'`,
|
|
59
|
-
"ecomweb collections create --name Summer --
|
|
60
|
+
"ecomweb collections create --name Summer --slug summer --product-ids 1,2,3",
|
|
60
61
|
"ecomweb collections create --file collection.json",
|
|
61
62
|
];
|
|
62
63
|
CollectionsCreate.flags = {
|
|
@@ -65,7 +66,7 @@ CollectionsCreate.flags = {
|
|
|
65
66
|
file: core_1.Flags.string({ description: "Read JSON body from file" }),
|
|
66
67
|
name: core_1.Flags.string({ description: "Collection name" }),
|
|
67
68
|
type: core_1.Flags.string({
|
|
68
|
-
description: "Collection type",
|
|
69
|
+
description: "Collection type (default: manual; smart needs search_criteria, so pass it with --stdin or --file)",
|
|
69
70
|
options: ["manual", "smart"],
|
|
70
71
|
}),
|
|
71
72
|
slug: core_1.Flags.string({ description: "URL-friendly slug" }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../src/commands/collections/create.ts"],"names":[],"mappings":";;AAAA,sCAAoC;AACpC,qDAAiD;AACjD,6CAAoD;AACpD,2CAA+C;AAE/C,MAAqB,iBAAkB,SAAQ,0BAAW;IAgCxD,KAAK,CAAC,GAAG;QACP,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;QAErC,IAAI,IAAI,GAAG,MAAM,IAAA,oBAAY,EAAC;YAC5B,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;YAC5B,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;SAC3B,CAAC,CAAC;QAEH,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,IAAI,GAAG,EAAyB,CAAC;YACjC,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;gBAAE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YAC3D,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;gBAAE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAA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|
const operation = this.getFlag("operation") || "create";
|
|
11
11
|
const schema = (0, validators_1.getResourceSchema)(resource, operation);
|
|
12
|
+
const removed = schema ? undefined : (0, validators_1.getRemovedResource)(resource);
|
|
13
|
+
if (removed) {
|
|
14
|
+
this.outputJson({ error: removed });
|
|
15
|
+
this.exit(2);
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
12
18
|
if (!schema) {
|
|
13
19
|
const available = (0, validators_1.getAvailableResources)();
|
|
14
20
|
const operations = (0, validators_1.getAvailableOperations)(resource);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"describe.js","sourceRoot":"","sources":["../../src/commands/describe.ts"],"names":[],"mappings":";;AAAA,sCAA0C;AAC1C,kDAA8C;AAC9C,
|
|
1
|
+
{"version":3,"file":"describe.js","sourceRoot":"","sources":["../../src/commands/describe.ts"],"names":[],"mappings":";;AAAA,sCAA0C;AAC1C,kDAA8C;AAC9C,kDAAyH;AAEzH,MAAqB,QAAS,SAAQ,0BAAW;IAyB/C,KAAK,CAAC,GAAG;QACP,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAC5C,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC/B,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAS,WAAW,CAAC,IAAI,QAAQ,CAAC;QAEhE,MAAM,MAAM,GAAG,IAAA,8BAAiB,EAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;QAEtD,MAAM,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAA,+BAAkB,EAAC,QAAQ,CAAC,CAAC;QAClE,IAAI,OAAO,EAAE,CAAC;YACZ,IAAI,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;YACpC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACb,OAAO;QACT,CAAC;QAED,I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ommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static args: {
|
|
6
|
+
"product-id": import("@oclif/core/lib/interfaces").Arg<number, {
|
|
7
|
+
max?: number;
|
|
8
|
+
min?: number;
|
|
9
|
+
}>;
|
|
10
|
+
};
|
|
11
|
+
static flags: {
|
|
12
|
+
"service-ids": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
13
|
+
none: 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,51 @@
|
|
|
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 output_1 = require("../../lib/output");
|
|
6
|
+
class ProductServicesAssign extends base_command_1.BaseCommand {
|
|
7
|
+
async run() {
|
|
8
|
+
const storeRef = this.requireStore();
|
|
9
|
+
const { args } = await this.parse(ProductServicesAssign);
|
|
10
|
+
const productId = args["product-id"];
|
|
11
|
+
const ids = this.getFlag("service-ids");
|
|
12
|
+
if (ids === undefined && !this.getFlag("none")) {
|
|
13
|
+
this.outputJson({
|
|
14
|
+
error: {
|
|
15
|
+
code: "NO_INPUT",
|
|
16
|
+
message: "Pass --service-ids, or --none to remove them all.",
|
|
17
|
+
hint: "ecomweb product-services list",
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
this.exit(2);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const body = { service_ids: ids === undefined ? [] : ids.split(",").map(Number).filter(Boolean) };
|
|
24
|
+
if (this.isDryRun) {
|
|
25
|
+
this.outputResult((0, output_1.mutationEnvelope)("product-services", "assign (dry-run)", storeRef, { product_id: productId, ...body }));
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
await this.apiClient.storePut(`/products/${productId}/services`, body);
|
|
29
|
+
this.outputResult((0, output_1.mutationEnvelope)("product-services", "assign", storeRef, { product_id: productId, ...body }, {
|
|
30
|
+
list: `ecomweb product-services list --product-id ${productId}`,
|
|
31
|
+
}));
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
ProductServicesAssign.description = "Set the services shown on a product (replaces its current ones)";
|
|
35
|
+
ProductServicesAssign.examples = [
|
|
36
|
+
"ecomweb product-services assign 42 --service-ids 1,2",
|
|
37
|
+
"ecomweb product-services assign 42 --none",
|
|
38
|
+
];
|
|
39
|
+
ProductServicesAssign.args = {
|
|
40
|
+
"product-id": core_1.Args.integer({ description: "Product ID", required: true }),
|
|
41
|
+
};
|
|
42
|
+
ProductServicesAssign.flags = {
|
|
43
|
+
...base_command_1.BaseCommand.baseFlags,
|
|
44
|
+
"service-ids": core_1.Flags.string({
|
|
45
|
+
description: "Comma-separated service IDs",
|
|
46
|
+
exclusive: ["none"],
|
|
47
|
+
}),
|
|
48
|
+
none: core_1.Flags.boolean({ description: "Remove every service from the product" }),
|
|
49
|
+
};
|
|
50
|
+
exports.default = ProductServicesAssign;
|
|
51
|
+
//# sourceMappingURL=assign.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assign.js","sourceRoot":"","sources":["../../../src/commands/product-services/assign.ts"],"names":[],"mappings":";;AAAA,sCAA0C;AAC1C,qDAAiD;AACjD,6CAAoD;AAEpD,MAAqB,qBAAsB,SAAQ,0BAAW;IAqB5D,KAAK,CAAC,GAAG;QACP,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;QACrC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;QACzD,MAAM,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC;QAErC,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAqB,aAAa,CAAC,CAAC;QAC5D,IAAI,GAAG,KAAK,SAAS,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YAC/C,IAAI,CAAC,UAAU,CAAC;gBACd,KAAK,EAAE;oBACL,IAAI,EAAE,UAAU;oBAChB,OAAO,EAAE,mDAAmD;oBAC5D,IAAI,EAAE,+BAA+B;iBACtC;aACF,CAAC,CAAC;YACH,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACb,OAAO;QACT,CAAC;QACD,MAAM,IAAI,GAAG,EAAE,WAAW,EAAE,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;QAElG,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClB,IAAI,CAAC,YAAY,CAAC,IAAA,yBAAgB,EAAC,kBAAkB,EAAE,kBAAkB,EAAE,QAAQ,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC,CAAC;YAC1H,OAAO;QACT,CAAC;QAED,MAAM,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,aAAa,SAAS,WAAW,EAAE,IAAI,CAAC,CAAC;QAEvE,IAAI,CAAC,YAAY,CACf,IAAA,yBAAgB,EAAC,kBAAkB,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAAE;YAC3F,IAAI,EAAE,8CAA8C,SAAS,EAAE;SAChE,CAAC,CACH,CAAC;IACJ,CAAC;;AAnDM,iCAAW,GAAG,iEAAiE,CAAC;AAEhF,8BAAQ,GAAG;IAChB,sDAAsD;IACtD,2CAA2C;CAC5C,CAAC;AAEK,0BAAI,GAAG;IACZ,YAAY,EAAE,WAAI,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;CAC1E,CAAC;AAEK,2BAAK,GAAG;IACb,GAAG,0BAAW,CAAC,SAAS;IACxB,aAAa,EAAE,YAAK,CAAC,MAAM,CAAC;QAC1B,WAAW,EAAE,6BAA6B;QAC1C,SAAS,EAAE,CAAC,MAAM,CAAC;KACpB,CAAC;IACF,IAAI,EAAE,YAAK,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,uCAAuC,EAAE,CAAC;CAC9E,CAAC;kBAnBiB,qBAAqB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { BaseCommand } from "../../base-command";
|
|
2
|
+
export default class ProductServicesCreate extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
stdin: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
7
|
+
file: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
8
|
+
name: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
9
|
+
description: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
|
+
"icon-url": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
11
|
+
"redirection-url": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
12
|
+
"sort-index": import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
13
|
+
"store-ref": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
14
|
+
"api-key": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
15
|
+
"api-url": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
16
|
+
output: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
17
|
+
quiet: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
18
|
+
"dry-run": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
19
|
+
profile: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
20
|
+
full: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
21
|
+
fields: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
22
|
+
exclude: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
23
|
+
};
|
|
24
|
+
run(): Promise<void>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
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 output_1 = require("../../lib/output");
|
|
6
|
+
const stdin_1 = require("../../lib/stdin");
|
|
7
|
+
class ProductServicesCreate extends base_command_1.BaseCommand {
|
|
8
|
+
async run() {
|
|
9
|
+
const storeRef = this.requireStore();
|
|
10
|
+
let body = await (0, stdin_1.getJsonInput)({
|
|
11
|
+
stdin: this.getFlag("stdin"),
|
|
12
|
+
file: this.getFlag("file"),
|
|
13
|
+
});
|
|
14
|
+
if (!body) {
|
|
15
|
+
body = {};
|
|
16
|
+
if (this.getFlag("name"))
|
|
17
|
+
body.name = this.getFlag("name");
|
|
18
|
+
if (this.getFlag("description") !== undefined)
|
|
19
|
+
body.description = this.getFlag("description");
|
|
20
|
+
if (this.getFlag("icon-url") !== undefined)
|
|
21
|
+
body.icon_url = this.getFlag("icon-url");
|
|
22
|
+
if (this.getFlag("redirection-url") !== undefined)
|
|
23
|
+
body.redirection_url = this.getFlag("redirection-url");
|
|
24
|
+
if (this.getFlag("sort-index") !== undefined)
|
|
25
|
+
body.sort_index = this.getFlag("sort-index");
|
|
26
|
+
if (Object.keys(body).length === 0) {
|
|
27
|
+
this.outputJson({
|
|
28
|
+
error: {
|
|
29
|
+
code: "NO_INPUT",
|
|
30
|
+
message: "No input provided.",
|
|
31
|
+
hint: "Run: ecomweb describe product-services --operation create",
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
this.exit(2);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (this.isDryRun) {
|
|
39
|
+
this.outputResult((0, output_1.mutationEnvelope)("product-services", "create (dry-run)", storeRef, body));
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const result = await this.apiClient.storePost("/product-services", body);
|
|
43
|
+
this.outputResult((0, output_1.mutationEnvelope)("product-services", "create", storeRef, result, {
|
|
44
|
+
assign: `ecomweb product-services assign <product-id> --service-ids ${result.id}`,
|
|
45
|
+
update: `ecomweb product-services update ${result.id} --stdin`,
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
ProductServicesCreate.description = "Create a product service (a badge shown on product pages, like free returns)";
|
|
50
|
+
ProductServicesCreate.examples = [
|
|
51
|
+
`ecomweb product-services create --name "Miễn phí đổi trả" --icon-url https://example.com/returns.svg`,
|
|
52
|
+
`ecomweb product-services create --stdin <<< '{"name":"Giao hàng nhanh","description":"Trong 24h nội thành"}'`,
|
|
53
|
+
];
|
|
54
|
+
ProductServicesCreate.flags = {
|
|
55
|
+
...base_command_1.BaseCommand.baseFlags,
|
|
56
|
+
stdin: core_1.Flags.boolean({ description: "Read JSON body from stdin" }),
|
|
57
|
+
file: core_1.Flags.string({ description: "Read JSON body from file" }),
|
|
58
|
+
name: core_1.Flags.string({ description: "Service name (max 255 characters)" }),
|
|
59
|
+
description: core_1.Flags.string({ description: "Details, e.g. for a tooltip" }),
|
|
60
|
+
"icon-url": core_1.Flags.string({ description: "Icon or badge image URL" }),
|
|
61
|
+
"redirection-url": core_1.Flags.string({ description: "Where clicking the badge goes" }),
|
|
62
|
+
"sort-index": core_1.Flags.integer({ description: "Display order (0 first)", min: 0 }),
|
|
63
|
+
};
|
|
64
|
+
exports.default = ProductServicesCreate;
|
|
65
|
+
//# sourceMappingURL=create.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../src/commands/product-services/create.ts"],"names":[],"mappings":";;AAAA,sCAAoC;AACpC,qDAAiD;AACjD,6CAAoD;AACpD,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AC,MAAM,CAAC,EAAE,WAAW,EAAE,+BAA+B,EAAE,CAAC;IACjF,YAAY,EAAE,YAAK,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,yBAAyB,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;CAChF,CAAC;kBAjBiB,qBAAqB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { BaseCommand } from "../../base-command";
|
|
2
|
+
export default class ProductServicesDelete extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static args: {
|
|
6
|
+
id: import("@oclif/core/lib/interfaces").Arg<number, {
|
|
7
|
+
max?: number;
|
|
8
|
+
min?: number;
|
|
9
|
+
}>;
|
|
10
|
+
};
|
|
11
|
+
static flags: {
|
|
12
|
+
"store-ref": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
13
|
+
"api-key": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
14
|
+
"api-url": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
15
|
+
output: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
16
|
+
quiet: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
17
|
+
"dry-run": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
18
|
+
profile: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
19
|
+
full: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
20
|
+
fields: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
21
|
+
exclude: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
22
|
+
};
|
|
23
|
+
run(): Promise<void>;
|
|
24
|
+
}
|