@commercetools/cli-topic-import 0.0.0 → 0.0.2-rc.e6e7b377
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/commands/import/import-containers/create.d.ts +10 -0
- package/dist/commands/import/import-containers/create.d.ts.map +1 -0
- package/dist/commands/import/import-containers/create.js +28 -0
- package/dist/commands/import/import-containers/create.js.map +1 -0
- package/dist/commands/import/import-containers/delete.d.ts +10 -0
- package/dist/commands/import/import-containers/delete.d.ts.map +1 -0
- package/dist/commands/import/import-containers/delete.js +20 -0
- package/dist/commands/import/import-containers/delete.js.map +1 -0
- package/dist/commands/import/import-containers/get.d.ts +10 -0
- package/dist/commands/import/import-containers/get.d.ts.map +1 -0
- package/dist/commands/import/import-containers/get.js +20 -0
- package/dist/commands/import/import-containers/get.js.map +1 -0
- package/dist/commands/import/import-containers/list.d.ts +11 -0
- package/dist/commands/import/import-containers/list.d.ts.map +1 -0
- package/dist/commands/import/import-containers/list.js +29 -0
- package/dist/commands/import/import-containers/list.js.map +1 -0
- package/dist/commands/import/import-containers/update.d.ts +12 -0
- package/dist/commands/import/import-containers/update.d.ts.map +1 -0
- package/dist/commands/import/import-containers/update.js +36 -0
- package/dist/commands/import/import-containers/update.js.map +1 -0
- package/dist/commands/import/import-operations/get.d.ts +10 -0
- package/dist/commands/import/import-operations/get.d.ts.map +1 -0
- package/dist/commands/import/import-operations/get.js +20 -0
- package/dist/commands/import/import-operations/get.js.map +1 -0
- package/dist/commands/import/import-operations/list.d.ts +12 -0
- package/dist/commands/import/import-operations/list.d.ts.map +1 -0
- package/dist/commands/import/import-operations/list.js +34 -0
- package/dist/commands/import/import-operations/list.js.map +1 -0
- package/dist/commands/import/import-summaries/get.d.ts +10 -0
- package/dist/commands/import/import-summaries/get.d.ts.map +1 -0
- package/dist/commands/import/import-summaries/get.js +21 -0
- package/dist/commands/import/import-summaries/get.js.map +1 -0
- package/dist/common/oclif/import-base-command.d.ts +23 -0
- package/dist/common/oclif/import-base-command.d.ts.map +1 -0
- package/dist/common/oclif/import-base-command.js +87 -0
- package/dist/common/oclif/import-base-command.js.map +1 -0
- package/package.json +34 -7
- package/LICENSE +0 -21
- package/README.md +0 -3
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ImportBaseCommand } from "../../../common/oclif/import-base-command.js";
|
|
2
|
+
export default class ImportContainersCreate extends ImportBaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
body: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
|
+
debug: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
7
|
+
};
|
|
8
|
+
run(): Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=create.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../../src/commands/import/import-containers/create.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,8CAA8C,CAAC;AASjF,MAAM,CAAC,OAAO,OAAO,sBAAuB,SAAQ,iBAAiB;IACnE,OAAgB,WAAW,SAAgC;IAE3D,OAAgB,KAAK;;;MAMnB;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAS3B"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Flags } from "@oclif/core";
|
|
2
|
+
import { readFileSync } from "fs";
|
|
3
|
+
import { ImportBaseCommand } from "../../../common/oclif/import-base-command.js";
|
|
4
|
+
function parseBodyArg(input) {
|
|
5
|
+
if (input.startsWith("@")) {
|
|
6
|
+
return JSON.parse(readFileSync(input.slice(1), "utf8"));
|
|
7
|
+
}
|
|
8
|
+
return JSON.parse(input);
|
|
9
|
+
}
|
|
10
|
+
export default class ImportContainersCreate extends ImportBaseCommand {
|
|
11
|
+
static description = "Create an import container";
|
|
12
|
+
static flags = {
|
|
13
|
+
...ImportBaseCommand.baseFlags,
|
|
14
|
+
body: Flags.string({
|
|
15
|
+
description: "JSON body for the import container, or @filepath to read from a file",
|
|
16
|
+
required: true,
|
|
17
|
+
}),
|
|
18
|
+
};
|
|
19
|
+
async run() {
|
|
20
|
+
const { flags } = await this.parse(ImportContainersCreate);
|
|
21
|
+
this.spinner.start("Creating import container...");
|
|
22
|
+
const body = parseBodyArg(flags.body);
|
|
23
|
+
const result = await this.request("POST", "/import-containers", body);
|
|
24
|
+
this.spinner.stop();
|
|
25
|
+
this.log(JSON.stringify(result, null, 2));
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=create.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../../src/commands/import/import-containers/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,iBAAiB,EAAE,MAAM,8CAA8C,CAAC;AAEjF,SAAS,YAAY,CAAC,KAAa;IACjC,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC1B,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;IAC1D,CAAC;IACD,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAC3B,CAAC;AAED,MAAM,CAAC,OAAO,OAAO,sBAAuB,SAAQ,iBAAiB;IACnE,MAAM,CAAU,WAAW,GAAG,4BAA4B,CAAC;IAE3D,MAAM,CAAU,KAAK,GAAG;QACtB,GAAG,iBAAiB,CAAC,SAAS;QAC9B,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC;YACjB,WAAW,EAAE,sEAAsE;YACnF,QAAQ,EAAE,IAAI;SACf,CAAC;KACH,CAAC;IAEF,KAAK,CAAC,GAAG;QACP,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;QAC3D,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAC;QAEnD,MAAM,IAAI,GAAG,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACtC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,oBAAoB,EAAE,IAAI,CAAC,CAAC;QACtE,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QACpB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAC5C,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ImportBaseCommand } from "../../../common/oclif/import-base-command.js";
|
|
2
|
+
export default class ImportContainersDelete extends ImportBaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
key: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
|
+
debug: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
7
|
+
};
|
|
8
|
+
run(): Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=delete.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../../src/commands/import/import-containers/delete.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,8CAA8C,CAAC;AAEjF,MAAM,CAAC,OAAO,OAAO,sBAAuB,SAAQ,iBAAiB;IACnE,OAAgB,WAAW,SAAgC;IAE3D,OAAgB,KAAK;;;MAMnB;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAW3B"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Flags } from "@oclif/core";
|
|
2
|
+
import { ImportBaseCommand } from "../../../common/oclif/import-base-command.js";
|
|
3
|
+
export default class ImportContainersDelete extends ImportBaseCommand {
|
|
4
|
+
static description = "Delete an import container";
|
|
5
|
+
static flags = {
|
|
6
|
+
...ImportBaseCommand.baseFlags,
|
|
7
|
+
key: Flags.string({
|
|
8
|
+
description: "Key of the import container to delete",
|
|
9
|
+
required: true,
|
|
10
|
+
}),
|
|
11
|
+
};
|
|
12
|
+
async run() {
|
|
13
|
+
const { flags } = await this.parse(ImportContainersDelete);
|
|
14
|
+
this.spinner.start("Deleting import container...");
|
|
15
|
+
const result = await this.request("DELETE", `/import-containers/${encodeURIComponent(flags.key)}`);
|
|
16
|
+
this.spinner.stop();
|
|
17
|
+
this.log(JSON.stringify(result, null, 2));
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=delete.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../../src/commands/import/import-containers/delete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,8CAA8C,CAAC;AAEjF,MAAM,CAAC,OAAO,OAAO,sBAAuB,SAAQ,iBAAiB;IACnE,MAAM,CAAU,WAAW,GAAG,4BAA4B,CAAC;IAE3D,MAAM,CAAU,KAAK,GAAG;QACtB,GAAG,iBAAiB,CAAC,SAAS;QAC9B,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC;YAChB,WAAW,EAAE,uCAAuC;YACpD,QAAQ,EAAE,IAAI;SACf,CAAC;KACH,CAAC;IAEF,KAAK,CAAC,GAAG;QACP,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;QAC3D,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAC;QAEnD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAC/B,QAAQ,EACR,sBAAsB,kBAAkB,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CACtD,CAAC;QACF,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QACpB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAC5C,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ImportBaseCommand } from "../../../common/oclif/import-base-command.js";
|
|
2
|
+
export default class ImportContainersGet extends ImportBaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
key: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
|
+
debug: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
7
|
+
};
|
|
8
|
+
run(): Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=get.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../../src/commands/import/import-containers/get.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,8CAA8C,CAAC;AAEjF,MAAM,CAAC,OAAO,OAAO,mBAAoB,SAAQ,iBAAiB;IAChE,OAAgB,WAAW,SAAoC;IAE/D,OAAgB,KAAK;;;MAMnB;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAQ3B"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Flags } from "@oclif/core";
|
|
2
|
+
import { ImportBaseCommand } from "../../../common/oclif/import-base-command.js";
|
|
3
|
+
export default class ImportContainersGet extends ImportBaseCommand {
|
|
4
|
+
static description = "Get an import container by key";
|
|
5
|
+
static flags = {
|
|
6
|
+
...ImportBaseCommand.baseFlags,
|
|
7
|
+
key: Flags.string({
|
|
8
|
+
description: "Key of the import container to retrieve",
|
|
9
|
+
required: true,
|
|
10
|
+
}),
|
|
11
|
+
};
|
|
12
|
+
async run() {
|
|
13
|
+
const { flags } = await this.parse(ImportContainersGet);
|
|
14
|
+
this.spinner.start("Fetching import container...");
|
|
15
|
+
const result = await this.request("GET", `/import-containers/${encodeURIComponent(flags.key)}`);
|
|
16
|
+
this.spinner.stop();
|
|
17
|
+
this.log(JSON.stringify(result, null, 2));
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=get.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get.js","sourceRoot":"","sources":["../../../../src/commands/import/import-containers/get.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,8CAA8C,CAAC;AAEjF,MAAM,CAAC,OAAO,OAAO,mBAAoB,SAAQ,iBAAiB;IAChE,MAAM,CAAU,WAAW,GAAG,gCAAgC,CAAC;IAE/D,MAAM,CAAU,KAAK,GAAG;QACtB,GAAG,iBAAiB,CAAC,SAAS;QAC9B,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC;YAChB,WAAW,EAAE,yCAAyC;YACtD,QAAQ,EAAE,IAAI;SACf,CAAC;KACH,CAAC;IAEF,KAAK,CAAC,GAAG;QACP,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;QACxD,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAC;QAEnD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,sBAAsB,kBAAkB,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAChG,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QACpB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAC5C,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ImportBaseCommand } from "../../../common/oclif/import-base-command.js";
|
|
2
|
+
export default class ImportContainersList extends ImportBaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
limit: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
|
+
offset: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
debug: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
|
+
};
|
|
9
|
+
run(): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../../src/commands/import/import-containers/list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,8CAA8C,CAAC;AAEjF,MAAM,CAAC,OAAO,OAAO,oBAAqB,SAAQ,iBAAiB;IACjE,OAAgB,WAAW,SAAgC;IAE3D,OAAgB,KAAK;;;;MAYnB;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAY3B"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Flags } from "@oclif/core";
|
|
2
|
+
import { ImportBaseCommand } from "../../../common/oclif/import-base-command.js";
|
|
3
|
+
export default class ImportContainersList extends ImportBaseCommand {
|
|
4
|
+
static description = "List all import containers";
|
|
5
|
+
static flags = {
|
|
6
|
+
...ImportBaseCommand.baseFlags,
|
|
7
|
+
limit: Flags.integer({
|
|
8
|
+
description: "Maximum number of results to return",
|
|
9
|
+
default: 20,
|
|
10
|
+
min: 1,
|
|
11
|
+
}),
|
|
12
|
+
offset: Flags.integer({
|
|
13
|
+
description: "Number of results to skip",
|
|
14
|
+
default: 0,
|
|
15
|
+
min: 0,
|
|
16
|
+
}),
|
|
17
|
+
};
|
|
18
|
+
async run() {
|
|
19
|
+
const { flags } = await this.parse(ImportContainersList);
|
|
20
|
+
this.spinner.start("Fetching import containers...");
|
|
21
|
+
const params = new URLSearchParams();
|
|
22
|
+
params.set("limit", String(flags.limit));
|
|
23
|
+
params.set("offset", String(flags.offset));
|
|
24
|
+
const result = await this.request("GET", `/import-containers?${params.toString()}`);
|
|
25
|
+
this.spinner.stop();
|
|
26
|
+
this.log(JSON.stringify(result, null, 2));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../../src/commands/import/import-containers/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,8CAA8C,CAAC;AAEjF,MAAM,CAAC,OAAO,OAAO,oBAAqB,SAAQ,iBAAiB;IACjE,MAAM,CAAU,WAAW,GAAG,4BAA4B,CAAC;IAE3D,MAAM,CAAU,KAAK,GAAG;QACtB,GAAG,iBAAiB,CAAC,SAAS;QAC9B,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC;YACnB,WAAW,EAAE,qCAAqC;YAClD,OAAO,EAAE,EAAE;YACX,GAAG,EAAE,CAAC;SACP,CAAC;QACF,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC;YACpB,WAAW,EAAE,2BAA2B;YACxC,OAAO,EAAE,CAAC;YACV,GAAG,EAAE,CAAC;SACP,CAAC;KACH,CAAC;IAEF,KAAK,CAAC,GAAG;QACP,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;QACzD,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;QAEpD,MAAM,MAAM,GAAG,IAAI,eAAe,EAAE,CAAC;QACrC,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;QACzC,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;QAE3C,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,sBAAsB,MAAM,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QACpF,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QACpB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAC5C,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ImportBaseCommand } from "../../../common/oclif/import-base-command.js";
|
|
2
|
+
export default class ImportContainersUpdate extends ImportBaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
key: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
|
+
version: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
actions: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
debug: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
9
|
+
};
|
|
10
|
+
run(): Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=update.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../../src/commands/import/import-containers/update.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,8CAA8C,CAAC;AASjF,MAAM,CAAC,OAAO,OAAO,sBAAuB,SAAQ,iBAAiB;IACnE,OAAgB,WAAW,SAAgC;IAE3D,OAAgB,KAAK;;;;;MAcnB;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAa3B"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Flags } from "@oclif/core";
|
|
2
|
+
import { readFileSync } from "fs";
|
|
3
|
+
import { ImportBaseCommand } from "../../../common/oclif/import-base-command.js";
|
|
4
|
+
function parseBodyArg(input) {
|
|
5
|
+
if (input.startsWith("@")) {
|
|
6
|
+
return JSON.parse(readFileSync(input.slice(1), "utf8"));
|
|
7
|
+
}
|
|
8
|
+
return JSON.parse(input);
|
|
9
|
+
}
|
|
10
|
+
export default class ImportContainersUpdate extends ImportBaseCommand {
|
|
11
|
+
static description = "Update an import container";
|
|
12
|
+
static flags = {
|
|
13
|
+
...ImportBaseCommand.baseFlags,
|
|
14
|
+
key: Flags.string({
|
|
15
|
+
description: "Key of the import container to update",
|
|
16
|
+
required: true,
|
|
17
|
+
}),
|
|
18
|
+
version: Flags.integer({
|
|
19
|
+
description: "Current version of the import container",
|
|
20
|
+
required: true,
|
|
21
|
+
}),
|
|
22
|
+
actions: Flags.string({
|
|
23
|
+
description: "JSON array of update actions, or @filepath to read from a file",
|
|
24
|
+
required: true,
|
|
25
|
+
}),
|
|
26
|
+
};
|
|
27
|
+
async run() {
|
|
28
|
+
const { flags } = await this.parse(ImportContainersUpdate);
|
|
29
|
+
this.spinner.start("Updating import container...");
|
|
30
|
+
const actions = parseBodyArg(flags.actions);
|
|
31
|
+
const result = await this.request("POST", `/import-containers/${encodeURIComponent(flags.key)}`, { version: flags.version, actions });
|
|
32
|
+
this.spinner.stop();
|
|
33
|
+
this.log(JSON.stringify(result, null, 2));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=update.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../../../src/commands/import/import-containers/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,iBAAiB,EAAE,MAAM,8CAA8C,CAAC;AAEjF,SAAS,YAAY,CAAC,KAAa;IACjC,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC1B,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;IAC1D,CAAC;IACD,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAC3B,CAAC;AAED,MAAM,CAAC,OAAO,OAAO,sBAAuB,SAAQ,iBAAiB;IACnE,MAAM,CAAU,WAAW,GAAG,4BAA4B,CAAC;IAE3D,MAAM,CAAU,KAAK,GAAG;QACtB,GAAG,iBAAiB,CAAC,SAAS;QAC9B,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC;YAChB,WAAW,EAAE,uCAAuC;YACpD,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC;YACrB,WAAW,EAAE,yCAAyC;YACtD,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC;YACpB,WAAW,EAAE,gEAAgE;YAC7E,QAAQ,EAAE,IAAI;SACf,CAAC;KACH,CAAC;IAEF,KAAK,CAAC,GAAG;QACP,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;QAC3D,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAC;QAEnD,MAAM,OAAO,GAAG,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC5C,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAC/B,MAAM,EACN,sBAAsB,kBAAkB,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,EACrD,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,CACpC,CAAC;QACF,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QACpB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAC5C,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ImportBaseCommand } from "../../../common/oclif/import-base-command.js";
|
|
2
|
+
export default class ImportOperationsGet extends ImportBaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
id: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
|
+
debug: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
7
|
+
};
|
|
8
|
+
run(): Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=get.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../../src/commands/import/import-operations/get.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,8CAA8C,CAAC;AAEjF,MAAM,CAAC,OAAO,OAAO,mBAAoB,SAAQ,iBAAiB;IAChE,OAAgB,WAAW,SAAmC;IAE9D,OAAgB,KAAK;;;MAMnB;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAQ3B"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Flags } from "@oclif/core";
|
|
2
|
+
import { ImportBaseCommand } from "../../../common/oclif/import-base-command.js";
|
|
3
|
+
export default class ImportOperationsGet extends ImportBaseCommand {
|
|
4
|
+
static description = "Get an import operation by ID";
|
|
5
|
+
static flags = {
|
|
6
|
+
...ImportBaseCommand.baseFlags,
|
|
7
|
+
id: Flags.string({
|
|
8
|
+
description: "ID of the import operation to retrieve",
|
|
9
|
+
required: true,
|
|
10
|
+
}),
|
|
11
|
+
};
|
|
12
|
+
async run() {
|
|
13
|
+
const { flags } = await this.parse(ImportOperationsGet);
|
|
14
|
+
this.spinner.start("Fetching import operation...");
|
|
15
|
+
const result = await this.request("GET", `/import-operations/${encodeURIComponent(flags.id)}`);
|
|
16
|
+
this.spinner.stop();
|
|
17
|
+
this.log(JSON.stringify(result, null, 2));
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=get.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get.js","sourceRoot":"","sources":["../../../../src/commands/import/import-operations/get.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,8CAA8C,CAAC;AAEjF,MAAM,CAAC,OAAO,OAAO,mBAAoB,SAAQ,iBAAiB;IAChE,MAAM,CAAU,WAAW,GAAG,+BAA+B,CAAC;IAE9D,MAAM,CAAU,KAAK,GAAG;QACtB,GAAG,iBAAiB,CAAC,SAAS;QAC9B,EAAE,EAAE,KAAK,CAAC,MAAM,CAAC;YACf,WAAW,EAAE,wCAAwC;YACrD,QAAQ,EAAE,IAAI;SACf,CAAC;KACH,CAAC;IAEF,KAAK,CAAC,GAAG;QACP,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;QACxD,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAC;QAEnD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,sBAAsB,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QAC/F,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QACpB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAC5C,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ImportBaseCommand } from "../../../common/oclif/import-base-command.js";
|
|
2
|
+
export default class ImportOperationsList extends ImportBaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
"container-key": import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
|
+
limit: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
offset: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
debug: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
9
|
+
};
|
|
10
|
+
run(): Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../../src/commands/import/import-operations/list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,8CAA8C,CAAC;AAEjF,MAAM,CAAC,OAAO,OAAO,oBAAqB,SAAQ,iBAAiB;IACjE,OAAgB,WAAW,SAAoD;IAE/E,OAAgB,KAAK;;;;;MAgBnB;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAgB3B"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Flags } from "@oclif/core";
|
|
2
|
+
import { ImportBaseCommand } from "../../../common/oclif/import-base-command.js";
|
|
3
|
+
export default class ImportOperationsList extends ImportBaseCommand {
|
|
4
|
+
static description = "List import operations for an import container";
|
|
5
|
+
static flags = {
|
|
6
|
+
...ImportBaseCommand.baseFlags,
|
|
7
|
+
"container-key": Flags.string({
|
|
8
|
+
description: "Key of the import container",
|
|
9
|
+
required: true,
|
|
10
|
+
}),
|
|
11
|
+
limit: Flags.integer({
|
|
12
|
+
description: "Maximum number of results to return",
|
|
13
|
+
default: 20,
|
|
14
|
+
min: 1,
|
|
15
|
+
}),
|
|
16
|
+
offset: Flags.integer({
|
|
17
|
+
description: "Number of results to skip",
|
|
18
|
+
default: 0,
|
|
19
|
+
min: 0,
|
|
20
|
+
}),
|
|
21
|
+
};
|
|
22
|
+
async run() {
|
|
23
|
+
const { flags } = await this.parse(ImportOperationsList);
|
|
24
|
+
this.spinner.start("Fetching import operations...");
|
|
25
|
+
const params = new URLSearchParams();
|
|
26
|
+
params.set("limit", String(flags.limit));
|
|
27
|
+
params.set("offset", String(flags.offset));
|
|
28
|
+
const containerKey = encodeURIComponent(flags["container-key"]);
|
|
29
|
+
const result = await this.request("GET", `/import-containers/${containerKey}/import-operations?${params.toString()}`);
|
|
30
|
+
this.spinner.stop();
|
|
31
|
+
this.log(JSON.stringify(result, null, 2));
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../../src/commands/import/import-operations/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,8CAA8C,CAAC;AAEjF,MAAM,CAAC,OAAO,OAAO,oBAAqB,SAAQ,iBAAiB;IACjE,MAAM,CAAU,WAAW,GAAG,gDAAgD,CAAC;IAE/E,MAAM,CAAU,KAAK,GAAG;QACtB,GAAG,iBAAiB,CAAC,SAAS;QAC9B,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC;YAC5B,WAAW,EAAE,6BAA6B;YAC1C,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC;YACnB,WAAW,EAAE,qCAAqC;YAClD,OAAO,EAAE,EAAE;YACX,GAAG,EAAE,CAAC;SACP,CAAC;QACF,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC;YACpB,WAAW,EAAE,2BAA2B;YACxC,OAAO,EAAE,CAAC;YACV,GAAG,EAAE,CAAC;SACP,CAAC;KACH,CAAC;IAEF,KAAK,CAAC,GAAG;QACP,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;QACzD,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;QAEpD,MAAM,MAAM,GAAG,IAAI,eAAe,EAAE,CAAC;QACrC,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;QACzC,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;QAE3C,MAAM,YAAY,GAAG,kBAAkB,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC;QAChE,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAC/B,KAAK,EACL,sBAAsB,YAAY,sBAAsB,MAAM,CAAC,QAAQ,EAAE,EAAE,CAC5E,CAAC;QACF,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QACpB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAC5C,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ImportBaseCommand } from "../../../common/oclif/import-base-command.js";
|
|
2
|
+
export default class ImportSummariesGet extends ImportBaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
"container-key": import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
|
+
debug: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
7
|
+
};
|
|
8
|
+
run(): Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=get.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../../src/commands/import/import-summaries/get.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,8CAA8C,CAAC;AAEjF,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,iBAAiB;IAC/D,OAAgB,WAAW,SAAoD;IAE/E,OAAgB,KAAK;;;MAMnB;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAS3B"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Flags } from "@oclif/core";
|
|
2
|
+
import { ImportBaseCommand } from "../../../common/oclif/import-base-command.js";
|
|
3
|
+
export default class ImportSummariesGet extends ImportBaseCommand {
|
|
4
|
+
static description = "Get the import summary for an import container";
|
|
5
|
+
static flags = {
|
|
6
|
+
...ImportBaseCommand.baseFlags,
|
|
7
|
+
"container-key": Flags.string({
|
|
8
|
+
description: "Key of the import container",
|
|
9
|
+
required: true,
|
|
10
|
+
}),
|
|
11
|
+
};
|
|
12
|
+
async run() {
|
|
13
|
+
const { flags } = await this.parse(ImportSummariesGet);
|
|
14
|
+
this.spinner.start("Fetching import summary...");
|
|
15
|
+
const containerKey = encodeURIComponent(flags["container-key"]);
|
|
16
|
+
const result = await this.request("GET", `/import-containers/${containerKey}/import-summary`);
|
|
17
|
+
this.spinner.stop();
|
|
18
|
+
this.log(JSON.stringify(result, null, 2));
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=get.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get.js","sourceRoot":"","sources":["../../../../src/commands/import/import-summaries/get.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,8CAA8C,CAAC;AAEjF,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,iBAAiB;IAC/D,MAAM,CAAU,WAAW,GAAG,gDAAgD,CAAC;IAE/E,MAAM,CAAU,KAAK,GAAG;QACtB,GAAG,iBAAiB,CAAC,SAAS;QAC9B,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC;YAC5B,WAAW,EAAE,6BAA6B;YAC1C,QAAQ,EAAE,IAAI;SACf,CAAC;KACH,CAAC;IAEF,KAAK,CAAC,GAAG;QACP,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;QACvD,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;QAEjD,MAAM,YAAY,GAAG,kBAAkB,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC;QAChE,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,sBAAsB,YAAY,iBAAiB,CAAC,CAAC;QAC9F,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QACpB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAC5C,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Config, Interfaces } from "@oclif/core";
|
|
2
|
+
import { AuthCommand, CtpAuthorizedClient, CtpAuthFetchFactory } from "@commercetools/cli-plugin-auth";
|
|
3
|
+
import type { Ora } from "ora";
|
|
4
|
+
export declare abstract class ImportBaseCommand extends AuthCommand {
|
|
5
|
+
protected authorized: boolean;
|
|
6
|
+
protected spinner: Ora;
|
|
7
|
+
protected ctpAuthFetchFactory: CtpAuthFetchFactory;
|
|
8
|
+
static baseFlags: {
|
|
9
|
+
debug: Interfaces.BooleanFlag<boolean>;
|
|
10
|
+
};
|
|
11
|
+
constructor(argv: string[], config: Config);
|
|
12
|
+
protected init(): Promise<void>;
|
|
13
|
+
log(message?: string): void;
|
|
14
|
+
protected getPrincipal(): CtpAuthorizedClient;
|
|
15
|
+
protected getPrincipalDetails(): {
|
|
16
|
+
region: string;
|
|
17
|
+
projectKey: string;
|
|
18
|
+
};
|
|
19
|
+
private verifyAuthentication;
|
|
20
|
+
protected request(method: string, path: string, body?: unknown): Promise<unknown>;
|
|
21
|
+
protected catch(error: Interfaces.CommandError): Promise<void>;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=import-base-command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import-base-command.d.ts","sourceRoot":"","sources":["../../../src/common/oclif/import-base-command.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAS,UAAU,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EACL,WAAW,EAEX,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE/B,8BAAsB,iBAAkB,SAAQ,WAAW;IACzD,SAAS,CAAC,UAAU,UAAQ;IAC5B,SAAS,CAAC,OAAO,EAAE,GAAG,CAAC;IACvB,SAAS,CAAC,mBAAmB,EAAE,mBAAmB,CAAC;IAEnD,OAAgB,SAAS;;MAMvB;gBAEU,IAAI,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM;cASjB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAIrC,GAAG,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI;IAOpC,SAAS,CAAC,YAAY,IAAI,mBAAmB;IAW7C,SAAS,CAAC,mBAAmB,IAAI;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE;IAcvE,OAAO,CAAC,oBAAoB;cAYZ,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;cA2B9D,KAAK,CAAC,KAAK,EAAE,UAAU,CAAC,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;CAK9E"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import ora from "ora";
|
|
2
|
+
import { Config, Flags, Interfaces } from "@oclif/core";
|
|
3
|
+
import { AuthCommand, AuthorizationError, CtpAuthorizedClient, CtpAuthFetchFactory, } from "@commercetools/cli-plugin-auth";
|
|
4
|
+
export class ImportBaseCommand extends AuthCommand {
|
|
5
|
+
authorized = true;
|
|
6
|
+
spinner;
|
|
7
|
+
ctpAuthFetchFactory;
|
|
8
|
+
static baseFlags = {
|
|
9
|
+
debug: Flags.boolean({
|
|
10
|
+
hidden: true,
|
|
11
|
+
default: false,
|
|
12
|
+
description: "Enable debug output",
|
|
13
|
+
}),
|
|
14
|
+
};
|
|
15
|
+
constructor(argv, config) {
|
|
16
|
+
super(argv, config);
|
|
17
|
+
this.spinner = ora();
|
|
18
|
+
const authManager = this.getAuthenticationManager();
|
|
19
|
+
const authRepository = this.getAuthenticationRepository();
|
|
20
|
+
this.ctpAuthFetchFactory = new CtpAuthFetchFactory(authManager, authRepository);
|
|
21
|
+
}
|
|
22
|
+
async init() {
|
|
23
|
+
if (this.authorized)
|
|
24
|
+
this.verifyAuthentication();
|
|
25
|
+
}
|
|
26
|
+
log(message) {
|
|
27
|
+
if (this.spinner.isSpinning === false)
|
|
28
|
+
return super.log(message);
|
|
29
|
+
this.spinner.stop();
|
|
30
|
+
super.log(message);
|
|
31
|
+
this.spinner.start();
|
|
32
|
+
}
|
|
33
|
+
getPrincipal() {
|
|
34
|
+
const authentication = this.getAuthentication();
|
|
35
|
+
const principal = authentication?.getPrincipal();
|
|
36
|
+
if (principal instanceof CtpAuthorizedClient) {
|
|
37
|
+
return principal;
|
|
38
|
+
}
|
|
39
|
+
throw new AuthorizationError("Not authenticated. Run 'commercetools auth login' first.");
|
|
40
|
+
}
|
|
41
|
+
getPrincipalDetails() {
|
|
42
|
+
const principal = this.getPrincipal();
|
|
43
|
+
const projectKey = principal.getProjectKey();
|
|
44
|
+
if (projectKey === null) {
|
|
45
|
+
throw new Error("Principal is not scoped to a project");
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
region: principal.getRegion(),
|
|
49
|
+
projectKey,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
verifyAuthentication() {
|
|
53
|
+
if (this.getPrincipal() === null) {
|
|
54
|
+
throw new AuthorizationError("Not authenticated. Run 'commercetools auth login' first.");
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
async request(method, path, body) {
|
|
58
|
+
const { region, projectKey } = this.getPrincipalDetails();
|
|
59
|
+
const url = `https://import.${region}.commercetools.com/${projectKey}${path}`;
|
|
60
|
+
const authFetch = this.ctpAuthFetchFactory.create();
|
|
61
|
+
const response = await authFetch(url, {
|
|
62
|
+
method,
|
|
63
|
+
body: body !== undefined ? JSON.stringify(body) : undefined,
|
|
64
|
+
headers: body !== undefined ? { "Content-Type": "application/json" } : undefined,
|
|
65
|
+
});
|
|
66
|
+
if (!response.ok) {
|
|
67
|
+
let errorBody;
|
|
68
|
+
try {
|
|
69
|
+
errorBody = await response.json();
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
errorBody = {
|
|
73
|
+
statusCode: response.status,
|
|
74
|
+
message: response.statusText,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
throw new Error(JSON.stringify(errorBody, null, 2));
|
|
78
|
+
}
|
|
79
|
+
return response.json();
|
|
80
|
+
}
|
|
81
|
+
async catch(error) {
|
|
82
|
+
this.spinner.stop();
|
|
83
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
84
|
+
super.error(message);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=import-base-command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import-base-command.js","sourceRoot":"","sources":["../../../src/common/oclif/import-base-command.ts"],"names":[],"mappings":"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"}
|
package/package.json
CHANGED
|
@@ -1,13 +1,40 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools/cli-topic-import",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "Placeholder release to enable npm Trusted Publishing. Replaced by the first CI release.",
|
|
3
|
+
"version": "0.0.2-rc.e6e7b377",
|
|
5
4
|
"license": "MIT",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist",
|
|
9
|
+
"LICENSE"
|
|
10
|
+
],
|
|
6
11
|
"publishConfig": {
|
|
7
12
|
"access": "public"
|
|
8
13
|
},
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
"scripts": {
|
|
15
|
+
"clean": "rimraf dist",
|
|
16
|
+
"build": "yarn clean && tsc && tsc -p tsconfig.build.json",
|
|
17
|
+
"test": "vitest run --disable-console-intercept",
|
|
18
|
+
"coverage": "vitest run --disable-console-intercept --coverage"
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@commercetools/cli-plugin-auth": "0.0.10-rc.e6e7b377",
|
|
22
|
+
"@oclif/core": "4.2.10",
|
|
23
|
+
"ora": "8"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@commercetools/cli-testing": "0.0.10-rc.e6e7b377",
|
|
27
|
+
"@oclif/plugin-help": "6.2.27",
|
|
28
|
+
"@oclif/plugin-plugins": "5.4.36",
|
|
29
|
+
"@oclif/test": "4.1.12",
|
|
30
|
+
"@vitest/coverage-v8": "4.1.9",
|
|
31
|
+
"rimraf": "6.0.1",
|
|
32
|
+
"typescript": "5.8.3",
|
|
33
|
+
"vitest": "4.1.9"
|
|
34
|
+
},
|
|
35
|
+
"oclif": {
|
|
36
|
+
"topicSeparator": " ",
|
|
37
|
+
"commands": "./dist/commands"
|
|
38
|
+
},
|
|
39
|
+
"stableVersion": "0.0.2"
|
|
40
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2024 commercetools
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
package/README.md
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
# @commercetools/cli-topic-import
|
|
2
|
-
|
|
3
|
-
Placeholder `0.0.0` release published to enable npm [Trusted Publishing](https://docs.npmjs.com/trusted-publishers) for this package name. The first real version is published automatically by CI from [`commercetools/cli`](https://github.com/commercetools/cli).
|