@prismatic-io/prism 4.2.1 → 4.2.2

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.
@@ -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(monitor: $alertMonitorId) {
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
- const result = await (0, graphql_1.gqlRequest)({
9
- document: (0, graphql_1.gql) `
10
- query listAlertGroups {
11
- alertGroups {
12
- nodes {
13
- id
14
- name
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
- const result = await (0, graphql_1.gqlRequest)({
9
- document: (0, graphql_1.gql) `
10
- query listAlertMonitors {
11
- alertMonitors {
12
- nodes {
13
- id
14
- name
15
- triggered
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
- const result = await (0, graphql_1.gqlRequest)({
9
- document: (0, graphql_1.gql) `
10
- query listAlertWebhooks {
11
- alertWebhooks {
12
- nodes {
13
- id
14
- name
15
- payloadTemplate
16
- url
17
- headers
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
- const result = await (0, graphql_1.gqlRequest)({
9
- document: (0, graphql_1.gql) `
10
- query listComponentActions {
11
- components {
12
- nodes {
13
- actions(isTrigger: false) {
14
- nodes {
15
- id
16
- key
17
- label
18
- description
19
- component {
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: ({ component: { id } }) => id,
67
+ get: () => componentId,
44
68
  extended: true,
45
69
  },
46
70
  componentkey: {
47
- get: ({ component: { key } }) => key,
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 = { ...core_1.CliUx.ux.table.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
+ ];
@@ -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
- const result = await (0, graphql_1.gqlRequest)({
10
- document: (0, graphql_1.gql) `
11
- query listComponents($showAllVersions: Boolean) {
12
- components(allVersions: $showAllVersions) {
13
- nodes {
14
- id
15
- key
16
- public
17
- label
18
- description
19
- versionNumber
20
- category
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
- category: {},
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
- const result = await (0, graphql_1.gqlRequest)({
9
- document: (0, graphql_1.gql) `
10
- query listComponentTriggers {
11
- components {
12
- nodes {
13
- actions(isTrigger: true) {
14
- nodes {
15
- id
16
- key
17
- label
18
- description
19
- component {
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: ({ component: { id } }) => id,
67
+ get: () => componentId,
44
68
  extended: true,
45
69
  },
46
70
  componentkey: {
47
- get: ({ component: { key } }) => key,
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 = { ...core_1.CliUx.ux.table.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
- const result = await (0, graphql_1.gqlRequest)({
9
- document: (0, graphql_1.gql) `
10
- query listCustomers {
11
- customers(isSystem: false) {
12
- nodes {
13
- id
14
- name
15
- description
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
- const result = await (0, graphql_1.gqlRequest)({
9
- document: (0, graphql_1.gql) `
10
- query listCustomerUsers($id: ID!) {
11
- customer(id: $id) {
12
- users {
13
- nodes {
14
- id
15
- name
16
- email
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
  }
@@ -5,29 +5,50 @@ const graphql_1 = require("../../../graphql");
5
5
  class ListCommand extends core_1.Command {
6
6
  async run() {
7
7
  const { args: { instance }, flags, } = await this.parse(ListCommand);
8
- const result = await (0, graphql_1.gqlRequest)({
9
- document: (0, graphql_1.gql) `
10
- query listInstanceConfigVariables($id: ID!) {
11
- instance(id: $id) {
12
- configVariables {
13
- nodes {
14
- id
15
- value
16
- requiredConfigVariable {
8
+ let configVariables = [];
9
+ let hasNextPage = true;
10
+ let cursor = "";
11
+ while (hasNextPage) {
12
+ const { instance: { configVariables: { nodes, pageInfo }, }, } = await (0, graphql_1.gqlRequest)({
13
+ document: (0, graphql_1.gql) `
14
+ query listInstanceConfigVariables($id: ID!) {
15
+ instance(id: $id) {
16
+ configVariables {
17
+ nodes {
17
18
  id
18
- key
19
- defaultValue
19
+ value
20
+ status
21
+ inputs {
22
+ nodes {
23
+ name
24
+ value
25
+ }
26
+ }
27
+ requiredConfigVariable {
28
+ id
29
+ key
30
+ defaultValue
31
+ dataType
32
+ }
33
+ }
34
+ pageInfo {
35
+ hasNextPage
36
+ endCursor
20
37
  }
21
38
  }
22
39
  }
23
40
  }
41
+ `,
42
+ variables: {
43
+ id: instance,
44
+ after: cursor,
45
+ },
46
+ });
47
+ configVariables = [...configVariables, ...nodes];
48
+ cursor = pageInfo.endCursor;
49
+ hasNextPage = pageInfo.hasNextPage;
24
50
  }
25
- `,
26
- variables: {
27
- id: instance,
28
- },
29
- });
30
- core_1.CliUx.ux.table(result.instance.configVariables.nodes, {
51
+ core_1.CliUx.ux.table(configVariables, {
31
52
  id: {
32
53
  minWidth: 8,
33
54
  extended: true,
@@ -40,10 +61,14 @@ class ListCommand extends core_1.Command {
40
61
  get: (row) => row.requiredConfigVariable.key,
41
62
  },
42
63
  value: {
43
- get: (row) => row.value,
64
+ get: (row) => row.requiredConfigVariable.dataType === "CONNECTION"
65
+ ? row.inputs
66
+ : row.value,
44
67
  },
45
68
  defaultValue: {
46
- get: (row) => row.requiredConfigVariable.defaultValue,
69
+ get: (row) => row.requiredConfigVariable.dataType === "CONNECTION"
70
+ ? ""
71
+ : row.requiredConfigVariable.defaultValue,
47
72
  },
48
73
  }, { ...flags });
49
74
  }