@prismatic-io/prism 5.2.10 → 6.0.0-preview1

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.
Files changed (160) hide show
  1. package/lib/index.js +32973 -5
  2. package/lib/run.js +365 -0
  3. package/lib/templates/action/action.ts.ejs +33 -0
  4. package/lib/templates/component/assets/icon.png.ejs +0 -0
  5. package/lib/templates/component/jest.config.js.ejs +4 -0
  6. package/lib/templates/component/package.json.ejs +6 -0
  7. package/lib/templates/component/src/client.ts.ejs +10 -0
  8. package/lib/templates/component/src/index.test.ts.ejs +47 -0
  9. package/lib/templates/component/src/index.ts.ejs +19 -0
  10. package/lib/templates/component/tsconfig.json.ejs +12 -0
  11. package/lib/templates/component/webpack.config.js.ejs +36 -0
  12. package/lib/templates/connection/basic.ts.ejs +25 -0
  13. package/lib/templates/connection/oauth.ts.ejs +65 -0
  14. package/lib/templates/dataSource/dataSource.ts.ejs +34 -0
  15. package/lib/templates/flow/flow.ts.ejs +37 -0
  16. package/lib/templates/formats/assets/icon.png.ejs +0 -0
  17. package/lib/templates/formats/jest.config.js.ejs +4 -0
  18. package/lib/templates/formats/tsconfig.json.ejs +12 -0
  19. package/lib/templates/formats/webpack.config.js.ejs +36 -0
  20. package/lib/templates/integration/assets/icon.png.ejs +0 -0
  21. package/lib/templates/integration/basic.ts.ejs +29 -0
  22. package/lib/templates/integration/jest.config.js.ejs +4 -0
  23. package/lib/templates/integration/oauth.ts.ejs +69 -0
  24. package/lib/templates/integration/package.json.ejs +6 -0
  25. package/lib/templates/integration/src/client.ts.ejs +10 -0
  26. package/lib/templates/integration/src/index.test.ts.ejs +18 -0
  27. package/lib/templates/integration/src/index.ts.ejs +11 -0
  28. package/lib/templates/integration/tsconfig.json.ejs +12 -0
  29. package/lib/templates/integration/webpack.config.js.ejs +36 -0
  30. package/lib/templates/trigger/trigger.ts.ejs +19 -0
  31. package/oclif.manifest.json +3153 -2451
  32. package/package.json +56 -60
  33. package/bin/run +0 -12
  34. package/lib/auth.js +0 -323
  35. package/lib/commands/alerts/events/list.js +0 -56
  36. package/lib/commands/alerts/groups/create.js +0 -58
  37. package/lib/commands/alerts/groups/delete.js +0 -35
  38. package/lib/commands/alerts/groups/list.js +0 -44
  39. package/lib/commands/alerts/monitors/clear.js +0 -35
  40. package/lib/commands/alerts/monitors/create.js +0 -102
  41. package/lib/commands/alerts/monitors/delete.js +0 -35
  42. package/lib/commands/alerts/monitors/list.js +0 -63
  43. package/lib/commands/alerts/triggers/list.js +0 -31
  44. package/lib/commands/alerts/webhooks/create.js +0 -67
  45. package/lib/commands/alerts/webhooks/delete.js +0 -35
  46. package/lib/commands/alerts/webhooks/list.js +0 -57
  47. package/lib/commands/components/actions/list.js +0 -96
  48. package/lib/commands/components/data-sources/list.js +0 -114
  49. package/lib/commands/components/delete.js +0 -35
  50. package/lib/commands/components/dev/run.js +0 -83
  51. package/lib/commands/components/dev/test.js +0 -266
  52. package/lib/commands/components/init/action.js +0 -12
  53. package/lib/commands/components/init/component.js +0 -12
  54. package/lib/commands/components/init/connection.js +0 -12
  55. package/lib/commands/components/init/dataSource.js +0 -12
  56. package/lib/commands/components/init/index.js +0 -126
  57. package/lib/commands/components/init/trigger.js +0 -12
  58. package/lib/commands/components/list.js +0 -95
  59. package/lib/commands/components/publish.js +0 -62
  60. package/lib/commands/components/triggers/list.js +0 -96
  61. package/lib/commands/customers/create.js +0 -72
  62. package/lib/commands/customers/credentials/create.js +0 -68
  63. package/lib/commands/customers/credentials/delete.js +0 -35
  64. package/lib/commands/customers/credentials/list.js +0 -56
  65. package/lib/commands/customers/credentials/update.js +0 -58
  66. package/lib/commands/customers/delete.js +0 -35
  67. package/lib/commands/customers/list.js +0 -51
  68. package/lib/commands/customers/update.js +0 -82
  69. package/lib/commands/customers/users/create.js +0 -67
  70. package/lib/commands/customers/users/delete.js +0 -35
  71. package/lib/commands/customers/users/list.js +0 -65
  72. package/lib/commands/customers/users/roles.js +0 -33
  73. package/lib/commands/customers/users/update.js +0 -76
  74. package/lib/commands/executions/step-result/get.js +0 -73
  75. package/lib/commands/instances/config-vars/list.js +0 -83
  76. package/lib/commands/instances/create.js +0 -84
  77. package/lib/commands/instances/delete.js +0 -35
  78. package/lib/commands/instances/deploy.js +0 -43
  79. package/lib/commands/instances/disable.js +0 -36
  80. package/lib/commands/instances/enable.js +0 -36
  81. package/lib/commands/instances/flow-configs/list.js +0 -62
  82. package/lib/commands/instances/flow-configs/test.js +0 -127
  83. package/lib/commands/instances/list.js +0 -86
  84. package/lib/commands/instances/update.js +0 -99
  85. package/lib/commands/integrations/available.js +0 -47
  86. package/lib/commands/integrations/create.js +0 -58
  87. package/lib/commands/integrations/delete.js +0 -35
  88. package/lib/commands/integrations/export.js +0 -29
  89. package/lib/commands/integrations/flows/list.js +0 -61
  90. package/lib/commands/integrations/flows/test.js +0 -124
  91. package/lib/commands/integrations/fork.js +0 -56
  92. package/lib/commands/integrations/import.js +0 -54
  93. package/lib/commands/integrations/init/flow.js +0 -12
  94. package/lib/commands/integrations/init/index.js +0 -45
  95. package/lib/commands/integrations/init/integration.js +0 -12
  96. package/lib/commands/integrations/list.js +0 -96
  97. package/lib/commands/integrations/marketplace.js +0 -80
  98. package/lib/commands/integrations/open.js +0 -18
  99. package/lib/commands/integrations/publish.js +0 -44
  100. package/lib/commands/integrations/update.js +0 -75
  101. package/lib/commands/integrations/versions/index.js +0 -83
  102. package/lib/commands/login.js +0 -33
  103. package/lib/commands/logout.js +0 -23
  104. package/lib/commands/logs/severities/list.js +0 -29
  105. package/lib/commands/me/index.js +0 -22
  106. package/lib/commands/me/token/revoke.js +0 -12
  107. package/lib/commands/me/token.js +0 -25
  108. package/lib/commands/on-prem-resources/delete.js +0 -35
  109. package/lib/commands/on-prem-resources/list.js +0 -69
  110. package/lib/commands/on-prem-resources/registration-jwt.js +0 -81
  111. package/lib/commands/organization/credentials/create.js +0 -60
  112. package/lib/commands/organization/credentials/delete.js +0 -35
  113. package/lib/commands/organization/credentials/list.js +0 -45
  114. package/lib/commands/organization/credentials/update.js +0 -58
  115. package/lib/commands/organization/signingKeys/delete.js +0 -35
  116. package/lib/commands/organization/signingKeys/generate.js +0 -22
  117. package/lib/commands/organization/signingKeys/import.js +0 -40
  118. package/lib/commands/organization/signingKeys/list.js +0 -36
  119. package/lib/commands/organization/update.js +0 -37
  120. package/lib/commands/organization/updateAvatarUrl.js +0 -47
  121. package/lib/commands/organization/users/create.js +0 -51
  122. package/lib/commands/organization/users/delete.js +0 -35
  123. package/lib/commands/organization/users/list.js +0 -60
  124. package/lib/commands/organization/users/roles.js +0 -33
  125. package/lib/commands/organization/users/update.js +0 -66
  126. package/lib/commands/translations/list.js +0 -35
  127. package/lib/config.js +0 -39
  128. package/lib/errors.js +0 -55
  129. package/lib/fields.js +0 -12
  130. package/lib/fs.js +0 -23
  131. package/lib/generate/action.js +0 -208
  132. package/lib/generate/index.js +0 -54
  133. package/lib/generate/input.js +0 -93
  134. package/lib/generate/parse.js +0 -59
  135. package/lib/generate/sourceFile.js +0 -90
  136. package/lib/generate/util.js +0 -17
  137. package/lib/graphql.js +0 -42
  138. package/lib/queries.graphql.js +0 -43
  139. package/lib/types.js +0 -6
  140. package/lib/utils/avatar.js +0 -48
  141. package/lib/utils/component/deleteByKey.js +0 -36
  142. package/lib/utils/component/publish.js +0 -247
  143. package/lib/utils/component/query.js +0 -23
  144. package/lib/utils/date.js +0 -14
  145. package/lib/utils/execution/logs.js +0 -86
  146. package/lib/utils/execution/stepResults.js +0 -87
  147. package/lib/utils/generate.js +0 -50
  148. package/lib/utils/import.js +0 -21
  149. package/lib/utils/integration/definition.js +0 -101
  150. package/lib/utils/integration/export.js +0 -36
  151. package/lib/utils/integration/import.js +0 -179
  152. package/lib/utils/integration/invoke.js +0 -81
  153. package/lib/utils/integration/open.js +0 -37
  154. package/lib/utils/integration/query.js +0 -59
  155. package/lib/utils/process.js +0 -15
  156. package/lib/utils/serialize.js +0 -8
  157. package/lib/utils/translations/processDataForTranslations.js +0 -132
  158. package/lib/utils/user/query.js +0 -26
  159. package/lib/yeoman.js +0 -27
  160. /package/{bin → lib}/run.cmd +0 -0
@@ -1,44 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const core_1 = require("@oclif/core");
4
- const graphql_1 = require("../../../graphql");
5
- class ListCommand extends core_1.Command {
6
- async run() {
7
- const { flags } = await this.parse(ListCommand);
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
- }
24
- }
25
- }
26
- `,
27
- variables: { after: cursor },
28
- });
29
- alertGroups = [...alertGroups, ...nodes];
30
- cursor = pageInfo.endCursor;
31
- hasNextPage = pageInfo.hasNextPage;
32
- }
33
- core_1.ux.table(alertGroups, {
34
- id: {
35
- minWidth: 8,
36
- extended: true,
37
- },
38
- name: {},
39
- }, { ...flags });
40
- }
41
- }
42
- exports.default = ListCommand;
43
- ListCommand.description = "List Alert Groups in your Organization";
44
- ListCommand.flags = { ...core_1.ux.table.flags() };
@@ -1,35 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const core_1 = require("@oclif/core");
4
- const graphql_1 = require("../../../graphql");
5
- class ClearCommand extends core_1.Command {
6
- async run() {
7
- const { args: { monitor }, } = await this.parse(ClearCommand);
8
- await (0, graphql_1.gqlRequest)({
9
- document: (0, graphql_1.gql) `
10
- mutation clearAlertMonitor($id: ID!) {
11
- clearAlertMonitor(input: { id: $id }) {
12
- alertMonitor {
13
- id
14
- }
15
- errors {
16
- field
17
- messages
18
- }
19
- }
20
- }
21
- `,
22
- variables: {
23
- id: monitor,
24
- },
25
- });
26
- }
27
- }
28
- exports.default = ClearCommand;
29
- ClearCommand.description = "Clear an Alert Monitor";
30
- ClearCommand.args = {
31
- monitor: core_1.Args.string({
32
- required: true,
33
- description: "ID of the monitor to clear",
34
- }),
35
- };
@@ -1,102 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const core_1 = require("@oclif/core");
4
- const graphql_1 = require("../../../graphql");
5
- const fields_1 = require("../../../fields");
6
- class CreateCommand extends core_1.Command {
7
- async run() {
8
- const { flags: { name, instance, triggers: triggerJson, duration, "log-severity": logSeverity, groups: groupJson, users: userJson, }, } = await this.parse(CreateCommand);
9
- const triggers = (0, fields_1.parseJsonOrUndefined)(triggerJson);
10
- const groups = (0, fields_1.parseJsonOrUndefined)(groupJson);
11
- const users = (0, fields_1.parseJsonOrUndefined)(userJson);
12
- const result = await (0, graphql_1.gqlRequest)({
13
- document: (0, graphql_1.gql) `
14
- mutation createAlertMonitor(
15
- $name: String!
16
- $instance: ID!
17
- $triggers: [ID]!
18
- $logSeverity: Int
19
- $duration: Int
20
- $groups: [ID]
21
- $users: [ID]
22
- ) {
23
- createAlertMonitor(
24
- input: {
25
- name: $name
26
- instance: $instance
27
- triggers: $triggers
28
- logSeverityLevelCondition: $logSeverity
29
- durationSecondsCondition: $duration
30
- groups: $groups
31
- users: $users
32
- }
33
- ) {
34
- alertMonitor {
35
- id
36
- }
37
- errors {
38
- field
39
- messages
40
- }
41
- }
42
- }
43
- `,
44
- variables: {
45
- name,
46
- instance,
47
- triggers,
48
- logSeverity,
49
- duration,
50
- groups,
51
- users,
52
- },
53
- });
54
- this.log(result.createAlertMonitor.alertMonitor.id);
55
- }
56
- }
57
- exports.default = CreateCommand;
58
- CreateCommand.description = "Create an Alert Monitor by attaching an Alert Trigger and a set of users and webhooks to an Instance";
59
- CreateCommand.flags = {
60
- name: core_1.Flags.string({
61
- name: "name",
62
- char: "n",
63
- required: true,
64
- description: "name of the alert monitor to be created",
65
- }),
66
- instance: core_1.Flags.string({
67
- name: "instance",
68
- char: "i",
69
- required: true,
70
- description: "ID of the instance to monitor",
71
- }),
72
- triggers: core_1.Flags.string({
73
- name: "triggers",
74
- char: "t",
75
- required: true,
76
- description: "JSON-formatted list of trigger IDs that should trigger this monitor",
77
- }),
78
- duration: core_1.Flags.integer({
79
- name: "duration",
80
- required: false,
81
- char: "d",
82
- description: "greatest time allowed (in seconds) for time-based triggers",
83
- }),
84
- "log-severity": core_1.Flags.integer({
85
- name: "log-severity",
86
- required: false,
87
- char: "s",
88
- description: "greatest log level {debug, info, warn, error} allowed for log-based triggers",
89
- }),
90
- groups: core_1.Flags.string({
91
- required: false,
92
- name: "groups",
93
- char: "g",
94
- description: "JSON-formatted list of group IDs to alert",
95
- }),
96
- users: core_1.Flags.string({
97
- required: false,
98
- name: "users",
99
- char: "u",
100
- description: "JSON-formatted list of Prismatic user IDs alert",
101
- }),
102
- };
@@ -1,35 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const core_1 = require("@oclif/core");
4
- const graphql_1 = require("../../../graphql");
5
- class DeleteCommand extends core_1.Command {
6
- async run() {
7
- const { args: { monitor }, } = await this.parse(DeleteCommand);
8
- await (0, graphql_1.gqlRequest)({
9
- document: (0, graphql_1.gql) `
10
- mutation deleteAlertMonitor($id: ID!) {
11
- deleteAlertMonitor(input: { id: $id }) {
12
- alertMonitor {
13
- id
14
- }
15
- errors {
16
- field
17
- messages
18
- }
19
- }
20
- }
21
- `,
22
- variables: {
23
- id: monitor,
24
- },
25
- });
26
- }
27
- }
28
- exports.default = DeleteCommand;
29
- DeleteCommand.description = "Delete an Alert Monitor";
30
- DeleteCommand.args = {
31
- monitor: core_1.Args.string({
32
- required: true,
33
- description: "ID of the monitor to delete",
34
- }),
35
- };
@@ -1,63 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const core_1 = require("@oclif/core");
4
- const graphql_1 = require("../../../graphql");
5
- class ListCommand extends core_1.Command {
6
- async run() {
7
- const { flags } = await this.parse(ListCommand);
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
- }
33
- }
34
- }
35
- `,
36
- variables: { after: cursor },
37
- });
38
- alertMonitors = [...alertMonitors, ...nodes];
39
- cursor = pageInfo.endCursor;
40
- hasNextPage = pageInfo.hasNextPage;
41
- }
42
- core_1.ux.table(alertMonitors, {
43
- id: {
44
- minWidth: 8,
45
- extended: true,
46
- },
47
- name: {},
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 },
58
- }, { ...flags });
59
- }
60
- }
61
- exports.default = ListCommand;
62
- ListCommand.description = "List Alert Monitors for Customer Instances";
63
- ListCommand.flags = { ...core_1.ux.table.flags() };
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const core_1 = require("@oclif/core");
4
- const graphql_1 = require("../../../graphql");
5
- class ListCommand extends core_1.Command {
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 listAlertTriggers {
11
- alertTriggers {
12
- nodes {
13
- id
14
- name
15
- }
16
- }
17
- }
18
- `,
19
- });
20
- core_1.ux.table(result.alertTriggers.nodes, {
21
- id: {
22
- minWidth: 8,
23
- extended: true,
24
- },
25
- name: {},
26
- }, { ...flags });
27
- }
28
- }
29
- exports.default = ListCommand;
30
- ListCommand.description = "List Alert Triggers";
31
- ListCommand.flags = { ...core_1.ux.table.flags() };
@@ -1,67 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const core_1 = require("@oclif/core");
4
- const graphql_1 = require("../../../graphql");
5
- class CreateCommand extends core_1.Command {
6
- async run() {
7
- const { flags: { name, url, headers, payloadTemplate }, } = await this.parse(CreateCommand);
8
- const result = await (0, graphql_1.gqlRequest)({
9
- document: (0, graphql_1.gql) `
10
- mutation createAlertWebhook(
11
- $name: String!
12
- $url: String!
13
- $headers: String
14
- $payloadTemplate: String!
15
- ) {
16
- createAlertWebhook(
17
- input: {
18
- name: $name
19
- url: $url
20
- headers: $headers
21
- payloadTemplate: $payloadTemplate
22
- }
23
- ) {
24
- alertWebhook {
25
- id
26
- }
27
- errors {
28
- field
29
- messages
30
- }
31
- }
32
- }
33
- `,
34
- variables: {
35
- name,
36
- url,
37
- headers,
38
- payloadTemplate,
39
- },
40
- });
41
- this.log(result.createAlertWebhook.alertWebhook.id);
42
- }
43
- }
44
- exports.default = CreateCommand;
45
- CreateCommand.description = "Create an Alert Webhook";
46
- CreateCommand.flags = {
47
- name: core_1.Flags.string({
48
- char: "n",
49
- required: true,
50
- description: "name of the webhook to be created",
51
- }),
52
- url: core_1.Flags.string({
53
- char: "u",
54
- required: true,
55
- description: "URL that will receive a POST request for an alert",
56
- }),
57
- headers: core_1.Flags.string({
58
- required: false,
59
- char: "h",
60
- description: "JSON-formatted object of key/value pairs to include in the request header",
61
- }),
62
- payloadTemplate: core_1.Flags.string({
63
- char: "p",
64
- required: true,
65
- description: "template string that will be used as the request body, see documentation for details",
66
- }),
67
- };
@@ -1,35 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const core_1 = require("@oclif/core");
4
- const graphql_1 = require("../../../graphql");
5
- class DeleteCommand extends core_1.Command {
6
- async run() {
7
- const { args: { webhook }, } = await this.parse(DeleteCommand);
8
- await (0, graphql_1.gqlRequest)({
9
- document: (0, graphql_1.gql) `
10
- mutation deleteAlertWebhook($id: ID!) {
11
- deleteAlertWebhook(input: { id: $id }) {
12
- alertWebhook {
13
- id
14
- }
15
- errors {
16
- field
17
- messages
18
- }
19
- }
20
- }
21
- `,
22
- variables: {
23
- id: webhook,
24
- },
25
- });
26
- }
27
- }
28
- exports.default = DeleteCommand;
29
- DeleteCommand.description = "Delete an Alert Webhook";
30
- DeleteCommand.args = {
31
- webhook: core_1.Args.string({
32
- required: true,
33
- description: "ID of the webhook to delete",
34
- }),
35
- };
@@ -1,57 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const core_1 = require("@oclif/core");
4
- const graphql_1 = require("../../../graphql");
5
- class ListCommand extends core_1.Command {
6
- async run() {
7
- const { flags } = await this.parse(ListCommand);
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
- }
27
- }
28
- }
29
- `,
30
- variables: { after: cursor },
31
- });
32
- alertWebhooks = [...alertWebhooks, ...nodes];
33
- cursor = pageInfo.endCursor;
34
- hasNextPage = pageInfo.hasNextPage;
35
- }
36
- core_1.ux.table(alertWebhooks, {
37
- id: {
38
- minWidth: 8,
39
- extended: true,
40
- },
41
- name: {},
42
- url: {
43
- extended: true,
44
- },
45
- headers: {
46
- extended: true,
47
- },
48
- payloadTemplate: {
49
- header: "Payload Template",
50
- extended: true,
51
- },
52
- }, { ...flags });
53
- }
54
- }
55
- exports.default = ListCommand;
56
- ListCommand.description = "List Alert Webhooks";
57
- ListCommand.flags = { ...core_1.ux.table.flags() };
@@ -1,96 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const core_1 = require("@oclif/core");
4
- const graphql_1 = require("../../../graphql");
5
- class ListCommand extends core_1.Command {
6
- async run() {
7
- const { flags, args: { 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, isDataSource: false, after: $after) {
25
- nodes {
26
- id
27
- key
28
- label
29
- description
30
- }
31
- pageInfo {
32
- hasNextPage
33
- endCursor
34
- }
35
- }
36
- }
37
- }
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.pageInfo.hasNextPage;
54
- }
55
- core_1.ux.table(actions, {
56
- id: {
57
- minWidth: 8,
58
- extended: true,
59
- },
60
- key: {
61
- minWidth: 10,
62
- extended: true,
63
- },
64
- label: {},
65
- description: {},
66
- componentid: {
67
- get: () => componentId,
68
- extended: true,
69
- },
70
- componentkey: {
71
- get: () => componentKey,
72
- extended: true,
73
- },
74
- }, { ...flags });
75
- }
76
- }
77
- exports.default = ListCommand;
78
- ListCommand.description = "List Actions that Components implement";
79
- ListCommand.flags = {
80
- ...core_1.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
- componentKey: core_1.Args.string({
92
- name: "Component Key",
93
- required: true,
94
- description: "The key of the component to show actions for (e.g. 'salesforce')",
95
- }),
96
- };
@@ -1,114 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const core_1 = require("@oclif/core");
4
- const graphql_1 = require("../../../graphql");
5
- class ListCommand extends core_1.Command {
6
- async run() {
7
- const { flags, args: { componentKey }, } = await this.parse(ListCommand);
8
- let dataSources = [];
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, isDataSource: true, after: $after) {
25
- nodes {
26
- id
27
- key
28
- label
29
- description
30
- dataSourceType
31
- detailDataSource {
32
- label
33
- }
34
- }
35
- pageInfo {
36
- hasNextPage
37
- endCursor
38
- }
39
- }
40
- }
41
- }
42
- }
43
- `,
44
- variables: {
45
- after: cursor,
46
- componentKey,
47
- public: flags.public ? true : flags.private ? false : null,
48
- },
49
- });
50
- if (!component) {
51
- console.log("The key you provided is not valid. Please run 'prism components:list -x' and identify a valid component key.");
52
- this.exit(1);
53
- }
54
- dataSources = [
55
- ...dataSources,
56
- ...component.actions.nodes.map((action) => {
57
- var _a;
58
- return ({
59
- ...action,
60
- detailDataSource: ((_a = action.detailDataSource) === null || _a === void 0 ? void 0 : _a.label) || "",
61
- });
62
- }),
63
- ];
64
- componentId = component.id;
65
- cursor = component.actions.pageInfo.endCursor;
66
- hasNextPage = component.actions.pageInfo.hasNextPage;
67
- }
68
- core_1.ux.table(dataSources, {
69
- id: {
70
- minWidth: 8,
71
- extended: true,
72
- },
73
- key: {
74
- minWidth: 10,
75
- extended: true,
76
- },
77
- label: {},
78
- description: {},
79
- dataSourceType: { header: "Type" },
80
- detailDataSource: {
81
- header: "Detail Data Source",
82
- extended: true,
83
- },
84
- componentid: {
85
- get: () => componentId,
86
- extended: true,
87
- },
88
- componentkey: {
89
- get: () => componentKey,
90
- extended: true,
91
- },
92
- }, { ...flags });
93
- }
94
- }
95
- exports.default = ListCommand;
96
- ListCommand.description = "List Data Sources that Components implement";
97
- ListCommand.flags = {
98
- ...core_1.ux.table.flags(),
99
- public: core_1.Flags.boolean({
100
- required: false,
101
- description: "Show data sources 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.",
102
- }),
103
- private: core_1.Flags.boolean({
104
- required: false,
105
- description: "Show data sources 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.",
106
- }),
107
- };
108
- ListCommand.args = {
109
- componentKey: core_1.Args.string({
110
- name: "Component Key",
111
- required: true,
112
- description: "The key of the component to show data sources for (e.g. 'salesforce')",
113
- }),
114
- };