@prismatic-io/prism 4.2.0 → 4.2.3
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/lib/commands/alerts/events/list.js +4 -1
- package/lib/commands/alerts/groups/list.js +23 -10
- package/lib/commands/alerts/monitors/list.js +41 -11
- package/lib/commands/alerts/webhooks/list.js +26 -13
- package/lib/commands/components/actions/list.js +60 -19
- package/lib/commands/components/init/index.js +5 -1
- package/lib/commands/components/list.js +42 -19
- package/lib/commands/components/triggers/list.js +61 -20
- package/lib/commands/customers/list.js +29 -11
- package/lib/commands/customers/users/list.js +34 -15
- package/lib/commands/instances/config-vars/list.js +44 -19
- package/lib/commands/instances/flow-configs/list.js +29 -16
- package/lib/commands/instances/list.js +45 -21
- package/lib/commands/integrations/flows/list.js +29 -16
- package/lib/commands/integrations/list.js +32 -15
- package/lib/commands/organization/users/list.js +37 -12
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
|
@@ -8,7 +8,10 @@ class ListCommand extends core_1.Command {
|
|
|
8
8
|
const result = await (0, graphql_1.gqlRequest)({
|
|
9
9
|
document: (0, graphql_1.gql) `
|
|
10
10
|
query listAlertEvents($alertMonitorId: ID) {
|
|
11
|
-
alertEvents(
|
|
11
|
+
alertEvents(
|
|
12
|
+
monitor: $alertMonitorId
|
|
13
|
+
sortBy: [{ field: CREATED_AT, direction: DESC }]
|
|
14
|
+
) {
|
|
12
15
|
nodes {
|
|
13
16
|
id
|
|
14
17
|
monitor {
|
|
@@ -5,19 +5,32 @@ const graphql_1 = require("../../../graphql");
|
|
|
5
5
|
class ListCommand extends core_1.Command {
|
|
6
6
|
async run() {
|
|
7
7
|
const { flags } = await this.parse(ListCommand);
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
nodes {
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
let alertGroups = [];
|
|
9
|
+
let hasNextPage = true;
|
|
10
|
+
let cursor = "";
|
|
11
|
+
while (hasNextPage) {
|
|
12
|
+
const { alertGroups: { nodes, pageInfo }, } = await (0, graphql_1.gqlRequest)({
|
|
13
|
+
document: (0, graphql_1.gql) `
|
|
14
|
+
query listAlertGroups($after: String) {
|
|
15
|
+
alertGroups(after: $after) {
|
|
16
|
+
nodes {
|
|
17
|
+
id
|
|
18
|
+
name
|
|
19
|
+
}
|
|
20
|
+
pageInfo {
|
|
21
|
+
hasNextPage
|
|
22
|
+
endCursor
|
|
23
|
+
}
|
|
15
24
|
}
|
|
16
25
|
}
|
|
26
|
+
`,
|
|
27
|
+
variables: { after: cursor },
|
|
28
|
+
});
|
|
29
|
+
alertGroups = [...alertGroups, ...nodes];
|
|
30
|
+
cursor = pageInfo.endCursor;
|
|
31
|
+
hasNextPage = pageInfo.hasNextPage;
|
|
17
32
|
}
|
|
18
|
-
|
|
19
|
-
});
|
|
20
|
-
core_1.CliUx.ux.table(result.alertGroups.nodes, {
|
|
33
|
+
core_1.CliUx.ux.table(alertGroups, {
|
|
21
34
|
id: {
|
|
22
35
|
minWidth: 8,
|
|
23
36
|
extended: true,
|
|
@@ -5,26 +5,56 @@ const graphql_1 = require("../../../graphql");
|
|
|
5
5
|
class ListCommand extends core_1.Command {
|
|
6
6
|
async run() {
|
|
7
7
|
const { flags } = await this.parse(ListCommand);
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
nodes {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
let alertMonitors = [];
|
|
9
|
+
let hasNextPage = true;
|
|
10
|
+
let cursor = "";
|
|
11
|
+
while (hasNextPage) {
|
|
12
|
+
const { alertMonitors: { nodes, pageInfo }, } = await (0, graphql_1.gqlRequest)({
|
|
13
|
+
document: (0, graphql_1.gql) `
|
|
14
|
+
query listAlertMonitors($after: String) {
|
|
15
|
+
alertMonitors(after: $after) {
|
|
16
|
+
nodes {
|
|
17
|
+
id
|
|
18
|
+
name
|
|
19
|
+
triggered
|
|
20
|
+
instance {
|
|
21
|
+
id
|
|
22
|
+
name
|
|
23
|
+
customer {
|
|
24
|
+
id
|
|
25
|
+
name
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
pageInfo {
|
|
30
|
+
hasNextPage
|
|
31
|
+
endCursor
|
|
32
|
+
}
|
|
16
33
|
}
|
|
17
34
|
}
|
|
35
|
+
`,
|
|
36
|
+
variables: { after: cursor },
|
|
37
|
+
});
|
|
38
|
+
alertMonitors = [...alertMonitors, ...nodes];
|
|
39
|
+
cursor = pageInfo.endCursor;
|
|
40
|
+
hasNextPage = pageInfo.hasNextPage;
|
|
18
41
|
}
|
|
19
|
-
|
|
20
|
-
});
|
|
21
|
-
core_1.CliUx.ux.table(result.alertMonitors.nodes, {
|
|
42
|
+
core_1.CliUx.ux.table(alertMonitors, {
|
|
22
43
|
id: {
|
|
23
44
|
minWidth: 8,
|
|
24
45
|
extended: true,
|
|
25
46
|
},
|
|
26
47
|
name: {},
|
|
27
48
|
triggered: {},
|
|
49
|
+
customer: {
|
|
50
|
+
get: ({ instance: { customer } }) => customer.name,
|
|
51
|
+
},
|
|
52
|
+
customerId: {
|
|
53
|
+
extended: true,
|
|
54
|
+
get: ({ instance: { customer } }) => customer.id,
|
|
55
|
+
},
|
|
56
|
+
instance: { get: ({ instance }) => instance.name },
|
|
57
|
+
instanceId: { extended: true, get: ({ instance }) => instance.id },
|
|
28
58
|
}, { ...flags });
|
|
29
59
|
}
|
|
30
60
|
}
|
|
@@ -5,22 +5,35 @@ const graphql_1 = require("../../../graphql");
|
|
|
5
5
|
class ListCommand extends core_1.Command {
|
|
6
6
|
async run() {
|
|
7
7
|
const { flags } = await this.parse(ListCommand);
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
nodes {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
let alertWebhooks = [];
|
|
9
|
+
let hasNextPage = true;
|
|
10
|
+
let cursor = "";
|
|
11
|
+
while (hasNextPage) {
|
|
12
|
+
const { alertWebhooks: { nodes, pageInfo }, } = await (0, graphql_1.gqlRequest)({
|
|
13
|
+
document: (0, graphql_1.gql) `
|
|
14
|
+
query listAlertWebhooks($after: String) {
|
|
15
|
+
alertWebhooks(after: $after) {
|
|
16
|
+
nodes {
|
|
17
|
+
id
|
|
18
|
+
name
|
|
19
|
+
payloadTemplate
|
|
20
|
+
url
|
|
21
|
+
headers
|
|
22
|
+
}
|
|
23
|
+
pageInfo {
|
|
24
|
+
hasNextPage
|
|
25
|
+
endCursor
|
|
26
|
+
}
|
|
18
27
|
}
|
|
19
28
|
}
|
|
29
|
+
`,
|
|
30
|
+
variables: { after: cursor },
|
|
31
|
+
});
|
|
32
|
+
alertWebhooks = [...alertWebhooks, ...nodes];
|
|
33
|
+
cursor = pageInfo.endCursor;
|
|
34
|
+
hasNextPage = pageInfo.hasNextPage;
|
|
20
35
|
}
|
|
21
|
-
|
|
22
|
-
});
|
|
23
|
-
core_1.CliUx.ux.table(result.alertWebhooks.nodes, {
|
|
36
|
+
core_1.CliUx.ux.table(alertWebhooks, {
|
|
24
37
|
id: {
|
|
25
38
|
minWidth: 8,
|
|
26
39
|
extended: true,
|
|
@@ -4,30 +4,54 @@ const core_1 = require("@oclif/core");
|
|
|
4
4
|
const graphql_1 = require("../../../graphql");
|
|
5
5
|
class ListCommand extends core_1.Command {
|
|
6
6
|
async run() {
|
|
7
|
-
const { flags } = await this.parse(ListCommand);
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
7
|
+
const { flags, args: { "Component Key": componentKey }, } = await this.parse(ListCommand);
|
|
8
|
+
let actions = [];
|
|
9
|
+
let componentId;
|
|
10
|
+
let hasNextPage = true;
|
|
11
|
+
let cursor = "";
|
|
12
|
+
while (hasNextPage) {
|
|
13
|
+
const { components: { nodes: [component], }, } = await (0, graphql_1.gqlRequest)({
|
|
14
|
+
document: (0, graphql_1.gql) `
|
|
15
|
+
query listComponentActions(
|
|
16
|
+
$componentKey: String
|
|
17
|
+
$after: String
|
|
18
|
+
$public: Boolean
|
|
19
|
+
) {
|
|
20
|
+
components(key: $componentKey, public: $public) {
|
|
21
|
+
nodes {
|
|
22
|
+
id
|
|
23
|
+
key
|
|
24
|
+
actions(isTrigger: false, after: $after) {
|
|
25
|
+
nodes {
|
|
20
26
|
id
|
|
21
27
|
key
|
|
28
|
+
label
|
|
29
|
+
description
|
|
30
|
+
}
|
|
31
|
+
pageInfo {
|
|
32
|
+
hasNextPage
|
|
33
|
+
endCursor
|
|
22
34
|
}
|
|
23
35
|
}
|
|
24
36
|
}
|
|
25
37
|
}
|
|
26
38
|
}
|
|
39
|
+
`,
|
|
40
|
+
variables: {
|
|
41
|
+
after: cursor,
|
|
42
|
+
componentKey,
|
|
43
|
+
public: flags.public ? true : flags.private ? false : null,
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
if (!component) {
|
|
47
|
+
console.log("The key you provided is not valid. Please run 'prism components:list -x' and identify a valid component key.");
|
|
48
|
+
this.exit(1);
|
|
49
|
+
}
|
|
50
|
+
actions = [...actions, ...component.actions.nodes];
|
|
51
|
+
componentId = component.id;
|
|
52
|
+
cursor = component.actions.pageInfo.endCursor;
|
|
53
|
+
hasNextPage = component.actions.hasNextPage;
|
|
27
54
|
}
|
|
28
|
-
`,
|
|
29
|
-
});
|
|
30
|
-
const actions = result.components.nodes.flatMap(({ actions }) => actions.nodes);
|
|
31
55
|
core_1.CliUx.ux.table(actions, {
|
|
32
56
|
id: {
|
|
33
57
|
minWidth: 8,
|
|
@@ -40,11 +64,11 @@ class ListCommand extends core_1.Command {
|
|
|
40
64
|
label: {},
|
|
41
65
|
description: {},
|
|
42
66
|
componentid: {
|
|
43
|
-
get: (
|
|
67
|
+
get: () => componentId,
|
|
44
68
|
extended: true,
|
|
45
69
|
},
|
|
46
70
|
componentkey: {
|
|
47
|
-
get: (
|
|
71
|
+
get: () => componentKey,
|
|
48
72
|
extended: true,
|
|
49
73
|
},
|
|
50
74
|
}, { ...flags });
|
|
@@ -52,4 +76,21 @@ class ListCommand extends core_1.Command {
|
|
|
52
76
|
}
|
|
53
77
|
exports.default = ListCommand;
|
|
54
78
|
ListCommand.description = "List Actions that Components implement";
|
|
55
|
-
ListCommand.flags = {
|
|
79
|
+
ListCommand.flags = {
|
|
80
|
+
...core_1.CliUx.ux.table.flags(),
|
|
81
|
+
public: core_1.Flags.boolean({
|
|
82
|
+
required: false,
|
|
83
|
+
description: "Show actions for the public component with the given key. Use this flag when you have a private component with the same key as a public component.",
|
|
84
|
+
}),
|
|
85
|
+
private: core_1.Flags.boolean({
|
|
86
|
+
required: false,
|
|
87
|
+
description: "Show actions for the private component with the given key. Use this flag when you have a private component with the same key as a public component.",
|
|
88
|
+
}),
|
|
89
|
+
};
|
|
90
|
+
ListCommand.args = [
|
|
91
|
+
{
|
|
92
|
+
name: "Component Key",
|
|
93
|
+
required: true,
|
|
94
|
+
description: "The key of the component to show actions for (e.g. 'salesforce')",
|
|
95
|
+
},
|
|
96
|
+
];
|
|
@@ -52,7 +52,11 @@ const formatSourceFiles = async (basePath, files) => {
|
|
|
52
52
|
};
|
|
53
53
|
class InitializeComponent extends core_1.Command {
|
|
54
54
|
async run() {
|
|
55
|
-
const { args: { name }, flags: { verbose, "wsdl-path":
|
|
55
|
+
const { args: { name }, flags: { verbose, "wsdl-path": rawWsdlPath, "open-api-path": rawOpenApiPath, }, } = await this.parse(InitializeComponent);
|
|
56
|
+
const wsdlPath = rawWsdlPath ? path.resolve(rawWsdlPath) : undefined;
|
|
57
|
+
const openApiPath = rawOpenApiPath
|
|
58
|
+
? path.resolve(rawOpenApiPath)
|
|
59
|
+
: undefined;
|
|
56
60
|
if (!componentNameRegex.test(name)) {
|
|
57
61
|
this.error(`'${name}' contains invalid characters. Please select a component name that starts and ends with alphanumeric characters, and contains only alphanumeric characters, hyphens, and underscores. See https://regex101.com/?regex=${encodeURIComponent(componentNameRegex.source)}`, { exit: 1 });
|
|
58
62
|
}
|
|
@@ -1,32 +1,50 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
const core_1 = require("@oclif/core");
|
|
7
|
+
const dayjs_1 = __importDefault(require("dayjs"));
|
|
4
8
|
const graphql_1 = require("../../graphql");
|
|
5
9
|
class ListCommand extends core_1.Command {
|
|
6
10
|
async run() {
|
|
7
11
|
const { flags } = await this.parse(ListCommand);
|
|
8
12
|
const { showAllVersions } = flags;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
nodes {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
let components = [];
|
|
14
|
+
let hasNextPage = true;
|
|
15
|
+
let cursor = "";
|
|
16
|
+
while (hasNextPage) {
|
|
17
|
+
const { components: { nodes, pageInfo }, } = await (0, graphql_1.gqlRequest)({
|
|
18
|
+
document: (0, graphql_1.gql) `
|
|
19
|
+
query listComponents($showAllVersions: Boolean, $after: String) {
|
|
20
|
+
components(allVersions: $showAllVersions, after: $after) {
|
|
21
|
+
nodes {
|
|
22
|
+
id
|
|
23
|
+
key
|
|
24
|
+
public
|
|
25
|
+
label
|
|
26
|
+
description
|
|
27
|
+
versionNumber
|
|
28
|
+
category
|
|
29
|
+
versionCreatedAt
|
|
30
|
+
}
|
|
31
|
+
pageInfo {
|
|
32
|
+
hasNextPage
|
|
33
|
+
endCursor
|
|
34
|
+
}
|
|
21
35
|
}
|
|
22
36
|
}
|
|
37
|
+
`,
|
|
38
|
+
variables: {
|
|
39
|
+
showAllVersions,
|
|
40
|
+
after: cursor,
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
components = [...components, ...nodes];
|
|
44
|
+
cursor = pageInfo.endCursor;
|
|
45
|
+
hasNextPage = pageInfo.hasNextPage;
|
|
23
46
|
}
|
|
24
|
-
|
|
25
|
-
variables: {
|
|
26
|
-
showAllVersions,
|
|
27
|
-
},
|
|
28
|
-
});
|
|
29
|
-
core_1.CliUx.ux.table(result.components.nodes, {
|
|
47
|
+
core_1.CliUx.ux.table(components, {
|
|
30
48
|
id: {
|
|
31
49
|
minWidth: 8,
|
|
32
50
|
extended: true,
|
|
@@ -39,7 +57,12 @@ class ListCommand extends core_1.Command {
|
|
|
39
57
|
public: {},
|
|
40
58
|
description: {},
|
|
41
59
|
versionNumber: { header: "Version" },
|
|
42
|
-
|
|
60
|
+
versionCreatedAt: {
|
|
61
|
+
header: "Last Published",
|
|
62
|
+
extended: true,
|
|
63
|
+
get: ({ versionCreatedAt }) => (0, dayjs_1.default)(versionCreatedAt).format(),
|
|
64
|
+
},
|
|
65
|
+
category: { get: ({ category }) => category || "" },
|
|
43
66
|
}, { ...flags });
|
|
44
67
|
}
|
|
45
68
|
}
|
|
@@ -4,31 +4,55 @@ const core_1 = require("@oclif/core");
|
|
|
4
4
|
const graphql_1 = require("../../../graphql");
|
|
5
5
|
class ListCommand extends core_1.Command {
|
|
6
6
|
async run() {
|
|
7
|
-
const { flags } = await this.parse(ListCommand);
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
7
|
+
const { flags, args: { "Component Key": componentKey }, } = await this.parse(ListCommand);
|
|
8
|
+
let triggers = [];
|
|
9
|
+
let componentId;
|
|
10
|
+
let hasNextPage = true;
|
|
11
|
+
let cursor = "";
|
|
12
|
+
while (hasNextPage) {
|
|
13
|
+
const { components: { nodes: [component], }, } = await (0, graphql_1.gqlRequest)({
|
|
14
|
+
document: (0, graphql_1.gql) `
|
|
15
|
+
query listComponentTriggers(
|
|
16
|
+
$componentKey: String
|
|
17
|
+
$after: String
|
|
18
|
+
$public: Boolean
|
|
19
|
+
) {
|
|
20
|
+
components(key: $componentKey, public: $public) {
|
|
21
|
+
nodes {
|
|
22
|
+
id
|
|
23
|
+
key
|
|
24
|
+
actions(isTrigger: true, after: $after) {
|
|
25
|
+
nodes {
|
|
20
26
|
id
|
|
21
27
|
key
|
|
28
|
+
label
|
|
29
|
+
description
|
|
30
|
+
}
|
|
31
|
+
pageInfo {
|
|
32
|
+
hasNextPage
|
|
33
|
+
endCursor
|
|
22
34
|
}
|
|
23
35
|
}
|
|
24
36
|
}
|
|
25
37
|
}
|
|
26
38
|
}
|
|
39
|
+
`,
|
|
40
|
+
variables: {
|
|
41
|
+
after: cursor,
|
|
42
|
+
componentKey,
|
|
43
|
+
public: flags.public ? true : flags.private ? false : null,
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
if (!component) {
|
|
47
|
+
console.log("The key you provided is not valid. Please run 'prism components:list -x' and identify a valid component key.");
|
|
48
|
+
this.exit(1);
|
|
49
|
+
}
|
|
50
|
+
triggers = [...triggers, ...component.actions.nodes];
|
|
51
|
+
componentId = component.id;
|
|
52
|
+
cursor = component.actions.pageInfo.endCursor;
|
|
53
|
+
hasNextPage = component.actions.hasNextPage;
|
|
27
54
|
}
|
|
28
|
-
|
|
29
|
-
});
|
|
30
|
-
const actions = result.components.nodes.flatMap(({ actions }) => actions.nodes);
|
|
31
|
-
core_1.CliUx.ux.table(actions, {
|
|
55
|
+
core_1.CliUx.ux.table(triggers, {
|
|
32
56
|
id: {
|
|
33
57
|
minWidth: 8,
|
|
34
58
|
extended: true,
|
|
@@ -40,11 +64,11 @@ class ListCommand extends core_1.Command {
|
|
|
40
64
|
label: {},
|
|
41
65
|
description: {},
|
|
42
66
|
componentid: {
|
|
43
|
-
get: (
|
|
67
|
+
get: () => componentId,
|
|
44
68
|
extended: true,
|
|
45
69
|
},
|
|
46
70
|
componentkey: {
|
|
47
|
-
get: (
|
|
71
|
+
get: () => componentKey,
|
|
48
72
|
extended: true,
|
|
49
73
|
},
|
|
50
74
|
}, { ...flags });
|
|
@@ -52,4 +76,21 @@ class ListCommand extends core_1.Command {
|
|
|
52
76
|
}
|
|
53
77
|
exports.default = ListCommand;
|
|
54
78
|
ListCommand.description = "List Triggers that Components implement";
|
|
55
|
-
ListCommand.flags = {
|
|
79
|
+
ListCommand.flags = {
|
|
80
|
+
...core_1.CliUx.ux.table.flags(),
|
|
81
|
+
public: core_1.Flags.boolean({
|
|
82
|
+
required: false,
|
|
83
|
+
description: "Show actions for the public component with the given key. Use this flag when you have a private component with the same key as a public component.",
|
|
84
|
+
}),
|
|
85
|
+
private: core_1.Flags.boolean({
|
|
86
|
+
required: false,
|
|
87
|
+
description: "Show actions for the private component with the given key. Use this flag when you have a private component with the same key as a public component.",
|
|
88
|
+
}),
|
|
89
|
+
};
|
|
90
|
+
ListCommand.args = [
|
|
91
|
+
{
|
|
92
|
+
name: "Component Key",
|
|
93
|
+
required: true,
|
|
94
|
+
description: "The key of the component to show triggers for (e.g. 'salesforce')",
|
|
95
|
+
},
|
|
96
|
+
];
|
|
@@ -5,24 +5,42 @@ const graphql_1 = require("../../graphql");
|
|
|
5
5
|
class ListCommand extends core_1.Command {
|
|
6
6
|
async run() {
|
|
7
7
|
const { flags } = await this.parse(ListCommand);
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
nodes {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
let customers = [];
|
|
9
|
+
let hasNextPage = true;
|
|
10
|
+
let cursor = "";
|
|
11
|
+
while (hasNextPage) {
|
|
12
|
+
const { customers: { nodes, pageInfo }, } = await (0, graphql_1.gqlRequest)({
|
|
13
|
+
document: (0, graphql_1.gql) `
|
|
14
|
+
query listCustomers($after: String) {
|
|
15
|
+
customers(isSystem: false, after: $after) {
|
|
16
|
+
nodes {
|
|
17
|
+
id
|
|
18
|
+
name
|
|
19
|
+
externalId
|
|
20
|
+
description
|
|
21
|
+
}
|
|
22
|
+
pageInfo {
|
|
23
|
+
hasNextPage
|
|
24
|
+
endCursor
|
|
25
|
+
}
|
|
16
26
|
}
|
|
17
27
|
}
|
|
28
|
+
`,
|
|
29
|
+
variables: { after: cursor },
|
|
30
|
+
});
|
|
31
|
+
customers = [...customers, ...nodes];
|
|
32
|
+
cursor = pageInfo.endCursor;
|
|
33
|
+
hasNextPage = pageInfo.hasNextPage;
|
|
18
34
|
}
|
|
19
|
-
|
|
20
|
-
});
|
|
21
|
-
core_1.CliUx.ux.table(result.customers.nodes, {
|
|
35
|
+
core_1.CliUx.ux.table(customers, {
|
|
22
36
|
id: {
|
|
23
37
|
minWidth: 8,
|
|
24
38
|
extended: true,
|
|
25
39
|
},
|
|
40
|
+
externalId: {
|
|
41
|
+
extended: true,
|
|
42
|
+
get: ({ externalId }) => externalId || "",
|
|
43
|
+
},
|
|
26
44
|
name: {},
|
|
27
45
|
description: {},
|
|
28
46
|
}, { ...flags });
|
|
@@ -5,31 +5,50 @@ const graphql_1 = require("../../../graphql");
|
|
|
5
5
|
class ListCommand extends core_1.Command {
|
|
6
6
|
async run() {
|
|
7
7
|
const { args: { customer }, flags, } = await this.parse(ListCommand);
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
users {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
8
|
+
let customerUsers = [];
|
|
9
|
+
let hasNextPage = true;
|
|
10
|
+
let cursor = "";
|
|
11
|
+
while (hasNextPage) {
|
|
12
|
+
const { customer: { users: { nodes, pageInfo }, }, } = await (0, graphql_1.gqlRequest)({
|
|
13
|
+
document: (0, graphql_1.gql) `
|
|
14
|
+
query listCustomerUsers($id: ID!, $after: String) {
|
|
15
|
+
customer(id: $id) {
|
|
16
|
+
users(after: $after) {
|
|
17
|
+
nodes {
|
|
18
|
+
id
|
|
19
|
+
name
|
|
20
|
+
email
|
|
21
|
+
externalId
|
|
22
|
+
role {
|
|
23
|
+
name
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
pageInfo {
|
|
27
|
+
hasNextPage
|
|
28
|
+
endCursor
|
|
29
|
+
}
|
|
17
30
|
}
|
|
18
31
|
}
|
|
19
32
|
}
|
|
33
|
+
`,
|
|
34
|
+
variables: { id: customer, after: cursor },
|
|
35
|
+
});
|
|
36
|
+
customerUsers = [...customerUsers, ...nodes];
|
|
37
|
+
cursor = pageInfo.endCursor;
|
|
38
|
+
hasNextPage = pageInfo.hasNextPage;
|
|
20
39
|
}
|
|
21
|
-
|
|
22
|
-
variables: {
|
|
23
|
-
id: customer,
|
|
24
|
-
},
|
|
25
|
-
});
|
|
26
|
-
core_1.CliUx.ux.table(result.customer.users.nodes, {
|
|
40
|
+
core_1.CliUx.ux.table(customerUsers, {
|
|
27
41
|
id: {
|
|
28
42
|
minWidth: 8,
|
|
29
43
|
extended: true,
|
|
30
44
|
},
|
|
31
45
|
name: {},
|
|
32
46
|
email: {},
|
|
47
|
+
role: { get: ({ role: { name } }) => name },
|
|
48
|
+
externalId: {
|
|
49
|
+
extended: true,
|
|
50
|
+
get: ({ externalId }) => externalId || "",
|
|
51
|
+
},
|
|
33
52
|
}, { ...flags });
|
|
34
53
|
}
|
|
35
54
|
}
|