@prismatic-io/prism 4.2.1 → 4.2.4

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
+ ];
@@ -109,7 +109,7 @@ class TestCommand extends core_1.Command {
109
109
  definition.display.label = `${definition.display.label} ${name} Testing`;
110
110
  await (0, publish_1.validateDefinition)(definition);
111
111
  const packagePath = await (0, publish_1.createComponentPackage)();
112
- const signatureMatches = await (0, publish_1.checkSignature)(definition, packagePath);
112
+ const signatureMatches = await (0, publish_1.checkPackageSignature)(definition, packagePath);
113
113
  core_1.CliUx.ux.action.stop();
114
114
  if (!signatureMatches) {
115
115
  core_1.CliUx.ux.action.start("Publishing Component");
@@ -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": wsdlPath, "open-api-path": openApiPath }, } = await this.parse(InitializeComponent);
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
- 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,27 +4,27 @@ const core_1 = require("@oclif/core");
4
4
  const publish_1 = require("../../utils/component/publish");
5
5
  class PublishCommand extends core_1.Command {
6
6
  async run() {
7
- const { flags: { comment, confirm, "skip-upload": skipUpload, "skip-on-signature-match": skipOnSignatureMatch, }, } = await this.parse(PublishCommand);
7
+ const { flags: { comment, confirm, "check-signature": checkSignature, "skip-on-signature-match": skipOnSignatureMatch, }, } = await this.parse(PublishCommand);
8
8
  const definition = await (0, publish_1.loadEntrypoint)();
9
9
  await (0, publish_1.validateDefinition)(definition);
10
10
  const packagePath = await (0, publish_1.createComponentPackage)();
11
- const signatureMatches = await (0, publish_1.checkSignature)(definition, packagePath);
12
- if (signatureMatches) {
13
- if (skipOnSignatureMatch ||
14
- !(await core_1.CliUx.ux.confirm("The new package signature matches the existing package signature. Continue publishing new package? (y/N)"))) {
15
- // Signatures match and we've opted to skip on match, so bail.
16
- core_1.CliUx.ux.log("Package signatures match, skipping publish.");
17
- core_1.CliUx.ux.exit(0);
11
+ if (checkSignature) {
12
+ const signatureMatches = await (0, publish_1.checkPackageSignature)(definition, packagePath);
13
+ if (signatureMatches) {
14
+ if (skipOnSignatureMatch ||
15
+ !(await core_1.CliUx.ux.confirm("The new package signature matches the existing package signature. Continue publishing new package? (y/N)"))) {
16
+ // Signatures match and we've opted to skip on match, so bail.
17
+ core_1.CliUx.ux.log("Package signatures match, skipping publish.");
18
+ core_1.CliUx.ux.exit(0);
19
+ }
18
20
  }
19
21
  }
20
22
  await (0, publish_1.confirmPublish)(definition, confirm);
21
23
  const { iconUploadUrl, packageUploadUrl, connectionIconUploadUrls, versionNumber, } = await (0, publish_1.publishDefinition)(definition, comment);
22
- if (!skipUpload) {
23
- const { display: { iconPath }, } = definition;
24
- await (0, publish_1.uploadFile)(iconPath, iconUploadUrl);
25
- await (0, publish_1.uploadConnectionIcons)(definition, connectionIconUploadUrls);
26
- await (0, publish_1.uploadFile)(packagePath, packageUploadUrl);
27
- }
24
+ const { display: { iconPath }, } = definition;
25
+ await (0, publish_1.uploadFile)(iconPath, iconUploadUrl);
26
+ await (0, publish_1.uploadConnectionIcons)(definition, connectionIconUploadUrls);
27
+ await (0, publish_1.uploadFile)(packagePath, packageUploadUrl);
28
28
  const { display: { label }, } = definition;
29
29
  // Tell user that their publish was successful and can use components list to view status
30
30
  this.log(`Successfully submitted ${label} (v${versionNumber})! The publish should finish processing shortly.`);
@@ -43,9 +43,10 @@ PublishCommand.flags = {
43
43
  default: true,
44
44
  description: "Interactively confirm publish",
45
45
  }),
46
- "skip-upload": core_1.Flags.boolean({
47
- description: "Skip upload of Component package",
48
- required: false,
46
+ "check-signature": core_1.Flags.boolean({
47
+ allowNo: true,
48
+ default: true,
49
+ description: "Check signature of existing component and confirm publish if matched",
49
50
  }),
50
51
  "skip-on-signature-match": core_1.Flags.boolean({
51
52
  required: false,
@@ -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 });