@prismatic-io/prism 5.2.11 → 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.
- package/lib/index.js +32973 -5
- package/lib/run.js +365 -0
- package/lib/templates/action/action.ts.ejs +33 -0
- package/lib/templates/component/assets/icon.png.ejs +0 -0
- package/lib/templates/component/jest.config.js.ejs +4 -0
- package/lib/templates/component/package.json.ejs +6 -0
- package/lib/templates/component/src/client.ts.ejs +10 -0
- package/lib/templates/component/src/index.test.ts.ejs +47 -0
- package/lib/templates/component/src/index.ts.ejs +19 -0
- package/lib/templates/component/tsconfig.json.ejs +12 -0
- package/lib/templates/component/webpack.config.js.ejs +36 -0
- package/lib/templates/connection/basic.ts.ejs +25 -0
- package/lib/templates/connection/oauth.ts.ejs +65 -0
- package/lib/templates/dataSource/dataSource.ts.ejs +34 -0
- package/lib/templates/flow/flow.ts.ejs +37 -0
- package/lib/templates/formats/assets/icon.png.ejs +0 -0
- package/lib/templates/formats/jest.config.js.ejs +4 -0
- package/lib/templates/formats/tsconfig.json.ejs +12 -0
- package/lib/templates/formats/webpack.config.js.ejs +36 -0
- package/lib/templates/integration/assets/icon.png.ejs +0 -0
- package/lib/templates/integration/basic.ts.ejs +29 -0
- package/lib/templates/integration/jest.config.js.ejs +4 -0
- package/lib/templates/integration/oauth.ts.ejs +69 -0
- package/lib/templates/integration/package.json.ejs +6 -0
- package/lib/templates/integration/src/client.ts.ejs +10 -0
- package/lib/templates/integration/src/index.test.ts.ejs +18 -0
- package/lib/templates/integration/src/index.ts.ejs +11 -0
- package/lib/templates/integration/tsconfig.json.ejs +12 -0
- package/lib/templates/integration/webpack.config.js.ejs +36 -0
- package/lib/templates/trigger/trigger.ts.ejs +19 -0
- package/oclif.manifest.json +3153 -2451
- package/package.json +56 -60
- package/bin/run +0 -12
- package/lib/auth.js +0 -323
- package/lib/commands/alerts/events/list.js +0 -56
- package/lib/commands/alerts/groups/create.js +0 -58
- package/lib/commands/alerts/groups/delete.js +0 -35
- package/lib/commands/alerts/groups/list.js +0 -44
- package/lib/commands/alerts/monitors/clear.js +0 -35
- package/lib/commands/alerts/monitors/create.js +0 -102
- package/lib/commands/alerts/monitors/delete.js +0 -35
- package/lib/commands/alerts/monitors/list.js +0 -63
- package/lib/commands/alerts/triggers/list.js +0 -31
- package/lib/commands/alerts/webhooks/create.js +0 -67
- package/lib/commands/alerts/webhooks/delete.js +0 -35
- package/lib/commands/alerts/webhooks/list.js +0 -57
- package/lib/commands/components/actions/list.js +0 -96
- package/lib/commands/components/data-sources/list.js +0 -114
- package/lib/commands/components/delete.js +0 -35
- package/lib/commands/components/dev/run.js +0 -83
- package/lib/commands/components/dev/test.js +0 -266
- package/lib/commands/components/init/action.js +0 -12
- package/lib/commands/components/init/component.js +0 -12
- package/lib/commands/components/init/connection.js +0 -12
- package/lib/commands/components/init/dataSource.js +0 -12
- package/lib/commands/components/init/index.js +0 -126
- package/lib/commands/components/init/trigger.js +0 -12
- package/lib/commands/components/list.js +0 -95
- package/lib/commands/components/publish.js +0 -62
- package/lib/commands/components/triggers/list.js +0 -96
- package/lib/commands/customers/create.js +0 -72
- package/lib/commands/customers/credentials/create.js +0 -68
- package/lib/commands/customers/credentials/delete.js +0 -35
- package/lib/commands/customers/credentials/list.js +0 -56
- package/lib/commands/customers/credentials/update.js +0 -58
- package/lib/commands/customers/delete.js +0 -35
- package/lib/commands/customers/list.js +0 -51
- package/lib/commands/customers/update.js +0 -82
- package/lib/commands/customers/users/create.js +0 -67
- package/lib/commands/customers/users/delete.js +0 -35
- package/lib/commands/customers/users/list.js +0 -65
- package/lib/commands/customers/users/roles.js +0 -33
- package/lib/commands/customers/users/update.js +0 -76
- package/lib/commands/executions/step-result/get.js +0 -73
- package/lib/commands/instances/config-vars/list.js +0 -83
- package/lib/commands/instances/create.js +0 -84
- package/lib/commands/instances/delete.js +0 -35
- package/lib/commands/instances/deploy.js +0 -43
- package/lib/commands/instances/disable.js +0 -36
- package/lib/commands/instances/enable.js +0 -36
- package/lib/commands/instances/flow-configs/list.js +0 -62
- package/lib/commands/instances/flow-configs/test.js +0 -127
- package/lib/commands/instances/list.js +0 -86
- package/lib/commands/instances/update.js +0 -99
- package/lib/commands/integrations/available.js +0 -47
- package/lib/commands/integrations/create.js +0 -58
- package/lib/commands/integrations/delete.js +0 -35
- package/lib/commands/integrations/export.js +0 -29
- package/lib/commands/integrations/flows/list.js +0 -61
- package/lib/commands/integrations/flows/test.js +0 -124
- package/lib/commands/integrations/fork.js +0 -56
- package/lib/commands/integrations/import.js +0 -54
- package/lib/commands/integrations/init/flow.js +0 -12
- package/lib/commands/integrations/init/index.js +0 -45
- package/lib/commands/integrations/init/integration.js +0 -12
- package/lib/commands/integrations/list.js +0 -96
- package/lib/commands/integrations/marketplace.js +0 -80
- package/lib/commands/integrations/open.js +0 -18
- package/lib/commands/integrations/publish.js +0 -44
- package/lib/commands/integrations/update.js +0 -75
- package/lib/commands/integrations/versions/index.js +0 -83
- package/lib/commands/login.js +0 -33
- package/lib/commands/logout.js +0 -23
- package/lib/commands/logs/severities/list.js +0 -29
- package/lib/commands/me/index.js +0 -22
- package/lib/commands/me/token/revoke.js +0 -12
- package/lib/commands/me/token.js +0 -25
- package/lib/commands/on-prem-resources/delete.js +0 -35
- package/lib/commands/on-prem-resources/list.js +0 -69
- package/lib/commands/on-prem-resources/registration-jwt.js +0 -81
- package/lib/commands/organization/credentials/create.js +0 -60
- package/lib/commands/organization/credentials/delete.js +0 -35
- package/lib/commands/organization/credentials/list.js +0 -45
- package/lib/commands/organization/credentials/update.js +0 -58
- package/lib/commands/organization/signingkeys/delete.js +0 -35
- package/lib/commands/organization/signingkeys/generate.js +0 -22
- package/lib/commands/organization/signingkeys/import.js +0 -40
- package/lib/commands/organization/signingkeys/list.js +0 -36
- package/lib/commands/organization/update.js +0 -37
- package/lib/commands/organization/updateAvatarUrl.js +0 -47
- package/lib/commands/organization/users/create.js +0 -51
- package/lib/commands/organization/users/delete.js +0 -35
- package/lib/commands/organization/users/list.js +0 -60
- package/lib/commands/organization/users/roles.js +0 -33
- package/lib/commands/organization/users/update.js +0 -66
- package/lib/commands/translations/list.js +0 -35
- package/lib/config.js +0 -39
- package/lib/errors.js +0 -55
- package/lib/fields.js +0 -12
- package/lib/fs.js +0 -23
- package/lib/generate/action.js +0 -208
- package/lib/generate/index.js +0 -54
- package/lib/generate/input.js +0 -93
- package/lib/generate/parse.js +0 -59
- package/lib/generate/sourceFile.js +0 -90
- package/lib/generate/util.js +0 -17
- package/lib/graphql.js +0 -42
- package/lib/queries.graphql.js +0 -43
- package/lib/types.js +0 -6
- package/lib/utils/avatar.js +0 -48
- package/lib/utils/component/deleteByKey.js +0 -36
- package/lib/utils/component/publish.js +0 -247
- package/lib/utils/component/query.js +0 -23
- package/lib/utils/date.js +0 -14
- package/lib/utils/execution/logs.js +0 -86
- package/lib/utils/execution/stepResults.js +0 -87
- package/lib/utils/generate.js +0 -50
- package/lib/utils/import.js +0 -21
- package/lib/utils/integration/definition.js +0 -101
- package/lib/utils/integration/export.js +0 -36
- package/lib/utils/integration/import.js +0 -179
- package/lib/utils/integration/invoke.js +0 -81
- package/lib/utils/integration/open.js +0 -37
- package/lib/utils/integration/query.js +0 -59
- package/lib/utils/process.js +0 -15
- package/lib/utils/serialize.js +0 -8
- package/lib/utils/translations/processDataForTranslations.js +0 -132
- package/lib/utils/user/query.js +0 -26
- package/lib/yeoman.js +0 -27
- /package/{bin → lib}/run.cmd +0 -0
|
@@ -1,127 +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 TestCommand extends core_1.Command {
|
|
6
|
-
async run() {
|
|
7
|
-
const { args: { flowConfig }, flags: { tail, payload, contentType }, } = await this.parse(TestCommand);
|
|
8
|
-
const result = await (0, graphql_1.gqlRequest)({
|
|
9
|
-
document: (0, graphql_1.gql) `
|
|
10
|
-
mutation testInstanceFlowConfig(
|
|
11
|
-
$id: ID!
|
|
12
|
-
$payload: String
|
|
13
|
-
$contentType: String
|
|
14
|
-
) {
|
|
15
|
-
testInstanceFlowConfig(
|
|
16
|
-
input: { id: $id, payload: $payload, contentType: $contentType }
|
|
17
|
-
) {
|
|
18
|
-
testInstanceFlowConfigResult {
|
|
19
|
-
flowConfig {
|
|
20
|
-
id
|
|
21
|
-
}
|
|
22
|
-
execution {
|
|
23
|
-
id
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
errors {
|
|
27
|
-
field
|
|
28
|
-
messages
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
`,
|
|
33
|
-
variables: {
|
|
34
|
-
id: flowConfig,
|
|
35
|
-
payload,
|
|
36
|
-
contentType,
|
|
37
|
-
},
|
|
38
|
-
});
|
|
39
|
-
if (!tail) {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
const executionId = result.testInstanceFlowConfig.testInstanceFlowConfigResult.execution.id;
|
|
43
|
-
await this.tailLogs(executionId);
|
|
44
|
-
}
|
|
45
|
-
async tailLogs(executionId) {
|
|
46
|
-
const { flags } = await this.parse(TestCommand);
|
|
47
|
-
let nextCursor = undefined;
|
|
48
|
-
// eslint-disable-next-line no-constant-condition
|
|
49
|
-
while (true) {
|
|
50
|
-
await core_1.ux.wait(500);
|
|
51
|
-
const result = await this.fetchLogs(executionId, nextCursor);
|
|
52
|
-
if (result === undefined)
|
|
53
|
-
continue;
|
|
54
|
-
const { logs, cursor, executionComplete } = result;
|
|
55
|
-
nextCursor = cursor;
|
|
56
|
-
core_1.ux.table(logs, {
|
|
57
|
-
timestamp: {},
|
|
58
|
-
severity: {
|
|
59
|
-
minWidth: 12,
|
|
60
|
-
},
|
|
61
|
-
message: {},
|
|
62
|
-
}, { ...flags, "no-header": true });
|
|
63
|
-
if (executionComplete)
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
async fetchLogs(executionId, nextCursor) {
|
|
68
|
-
const results = await (0, graphql_1.gqlRequest)({
|
|
69
|
-
document: (0, graphql_1.gql) `
|
|
70
|
-
query listInstanceTestLogs($executionId: ID!, $nextCursor: String) {
|
|
71
|
-
logs(
|
|
72
|
-
executionResult: $executionId
|
|
73
|
-
after: $nextCursor
|
|
74
|
-
orderBy: { field: TIMESTAMP, direction: ASC }
|
|
75
|
-
) {
|
|
76
|
-
edges {
|
|
77
|
-
node {
|
|
78
|
-
timestamp
|
|
79
|
-
severity
|
|
80
|
-
message
|
|
81
|
-
}
|
|
82
|
-
cursor
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
`,
|
|
87
|
-
variables: {
|
|
88
|
-
executionId,
|
|
89
|
-
nextCursor,
|
|
90
|
-
},
|
|
91
|
-
});
|
|
92
|
-
const { edges, } = results.logs;
|
|
93
|
-
if (!edges || edges.length === 0) {
|
|
94
|
-
return undefined;
|
|
95
|
-
}
|
|
96
|
-
const logs = edges.map(({ node }) => node);
|
|
97
|
-
const executionComplete = logs.reduce((result, { message }) => result || message.startsWith("Ending Instance Execution"), false);
|
|
98
|
-
const { cursor } = edges[edges.length - 1];
|
|
99
|
-
return { logs, cursor, executionComplete };
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
exports.default = TestCommand;
|
|
103
|
-
TestCommand.description = "Test a Flow Config of an Instance";
|
|
104
|
-
TestCommand.args = {
|
|
105
|
-
flowConfig: core_1.Args.string({
|
|
106
|
-
description: "ID of a Flow Config to test",
|
|
107
|
-
required: true,
|
|
108
|
-
}),
|
|
109
|
-
};
|
|
110
|
-
TestCommand.flags = {
|
|
111
|
-
...core_1.ux.table.flags({ only: ["extended", "columns"] }),
|
|
112
|
-
tail: core_1.Flags.boolean({
|
|
113
|
-
required: false,
|
|
114
|
-
char: "t",
|
|
115
|
-
description: "Tail logs of the flow config test run",
|
|
116
|
-
}),
|
|
117
|
-
payload: core_1.Flags.string({
|
|
118
|
-
required: false,
|
|
119
|
-
char: "p",
|
|
120
|
-
description: "Optional JSON-formatted data payload to submit with the test",
|
|
121
|
-
}),
|
|
122
|
-
contentType: core_1.Flags.string({
|
|
123
|
-
required: false,
|
|
124
|
-
char: "c",
|
|
125
|
-
description: "Optional content-type for the test payload",
|
|
126
|
-
}),
|
|
127
|
-
};
|
|
@@ -1,86 +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 { customer, integration } = flags;
|
|
9
|
-
let instances = [];
|
|
10
|
-
let hasNextPage = true;
|
|
11
|
-
let cursor = "";
|
|
12
|
-
while (hasNextPage) {
|
|
13
|
-
const { instances: { nodes, pageInfo }, } = await (0, graphql_1.gqlRequest)({
|
|
14
|
-
document: (0, graphql_1.gql) `
|
|
15
|
-
query listInstances($customer: ID, $integration: ID, $after: String) {
|
|
16
|
-
instances(
|
|
17
|
-
customer: $customer
|
|
18
|
-
integration: $integration
|
|
19
|
-
isSystem: false
|
|
20
|
-
after: $after
|
|
21
|
-
) {
|
|
22
|
-
nodes {
|
|
23
|
-
id
|
|
24
|
-
name
|
|
25
|
-
description
|
|
26
|
-
enabled
|
|
27
|
-
customer {
|
|
28
|
-
id
|
|
29
|
-
name
|
|
30
|
-
externalId
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
pageInfo {
|
|
34
|
-
hasNextPage
|
|
35
|
-
endCursor
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
`,
|
|
40
|
-
variables: {
|
|
41
|
-
customer,
|
|
42
|
-
integration,
|
|
43
|
-
after: cursor,
|
|
44
|
-
},
|
|
45
|
-
});
|
|
46
|
-
instances = [...instances, ...nodes];
|
|
47
|
-
cursor = pageInfo.endCursor;
|
|
48
|
-
hasNextPage = pageInfo.hasNextPage;
|
|
49
|
-
}
|
|
50
|
-
core_1.ux.table(instances, {
|
|
51
|
-
id: {
|
|
52
|
-
minWidth: 8,
|
|
53
|
-
extended: true,
|
|
54
|
-
},
|
|
55
|
-
name: {},
|
|
56
|
-
customer: {
|
|
57
|
-
get: ({ customer }) => customer.name,
|
|
58
|
-
},
|
|
59
|
-
customerid: {
|
|
60
|
-
get: ({ customer }) => customer.id,
|
|
61
|
-
extended: true,
|
|
62
|
-
},
|
|
63
|
-
customerExternalId: {
|
|
64
|
-
get: ({ customer }) => customer.externalId || "",
|
|
65
|
-
extended: true,
|
|
66
|
-
},
|
|
67
|
-
description: {},
|
|
68
|
-
enabled: { extended: true },
|
|
69
|
-
}, { ...flags });
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
exports.default = ListCommand;
|
|
73
|
-
ListCommand.description = "List Instances";
|
|
74
|
-
ListCommand.flags = {
|
|
75
|
-
customer: core_1.Flags.string({
|
|
76
|
-
char: "c",
|
|
77
|
-
required: false,
|
|
78
|
-
description: "ID of a customer",
|
|
79
|
-
}),
|
|
80
|
-
integration: core_1.Flags.string({
|
|
81
|
-
char: "i",
|
|
82
|
-
required: false,
|
|
83
|
-
description: "ID of an integration",
|
|
84
|
-
}),
|
|
85
|
-
...core_1.ux.table.flags(),
|
|
86
|
-
};
|
|
@@ -1,99 +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 UpdateCommand extends core_1.Command {
|
|
6
|
-
async run() {
|
|
7
|
-
const { args: { instance }, flags: { name, description, version, deploy, label }, } = await this.parse(UpdateCommand);
|
|
8
|
-
const result = await (0, graphql_1.gqlRequest)({
|
|
9
|
-
document: (0, graphql_1.gql) `
|
|
10
|
-
mutation updateInstance(
|
|
11
|
-
$id: ID!
|
|
12
|
-
$name: String
|
|
13
|
-
$description: String
|
|
14
|
-
$version: ID
|
|
15
|
-
$labels: [String]
|
|
16
|
-
) {
|
|
17
|
-
updateInstance(
|
|
18
|
-
input: {
|
|
19
|
-
id: $id
|
|
20
|
-
name: $name
|
|
21
|
-
description: $description
|
|
22
|
-
integration: $version
|
|
23
|
-
labels: $labels
|
|
24
|
-
}
|
|
25
|
-
) {
|
|
26
|
-
instance {
|
|
27
|
-
id
|
|
28
|
-
}
|
|
29
|
-
errors {
|
|
30
|
-
field
|
|
31
|
-
messages
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
`,
|
|
36
|
-
variables: {
|
|
37
|
-
id: instance,
|
|
38
|
-
name,
|
|
39
|
-
description,
|
|
40
|
-
version,
|
|
41
|
-
labels: label,
|
|
42
|
-
},
|
|
43
|
-
});
|
|
44
|
-
if (!deploy) {
|
|
45
|
-
this.log(result.updateInstance.instance.id);
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
const deployResult = await (0, graphql_1.gqlRequest)({
|
|
49
|
-
document: (0, graphql_1.gql) `
|
|
50
|
-
mutation deployInstance($id: ID!) {
|
|
51
|
-
deployInstance(input: { id: $id }) {
|
|
52
|
-
instance {
|
|
53
|
-
id
|
|
54
|
-
}
|
|
55
|
-
errors {
|
|
56
|
-
field
|
|
57
|
-
messages
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
`,
|
|
62
|
-
variables: {
|
|
63
|
-
id: instance,
|
|
64
|
-
},
|
|
65
|
-
});
|
|
66
|
-
this.log(deployResult.deployInstance.instance.id);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
exports.default = UpdateCommand;
|
|
70
|
-
// TODO: Add more flags once optional updates are implemented
|
|
71
|
-
UpdateCommand.description = "Update an Instance";
|
|
72
|
-
UpdateCommand.args = {
|
|
73
|
-
instance: core_1.Args.string({
|
|
74
|
-
required: true,
|
|
75
|
-
description: "ID of an instance",
|
|
76
|
-
}),
|
|
77
|
-
};
|
|
78
|
-
UpdateCommand.flags = {
|
|
79
|
-
name: core_1.Flags.string({
|
|
80
|
-
char: "n",
|
|
81
|
-
description: "Name of the instance",
|
|
82
|
-
}),
|
|
83
|
-
description: core_1.Flags.string({
|
|
84
|
-
char: "d",
|
|
85
|
-
description: "Description for the instance",
|
|
86
|
-
}),
|
|
87
|
-
version: core_1.Flags.string({
|
|
88
|
-
char: "v",
|
|
89
|
-
description: "ID of integration version",
|
|
90
|
-
}),
|
|
91
|
-
deploy: core_1.Flags.boolean({
|
|
92
|
-
description: "Deploy the instance after updating",
|
|
93
|
-
}),
|
|
94
|
-
label: core_1.Flags.string({
|
|
95
|
-
char: "l",
|
|
96
|
-
description: "a label or set of labels to apply to the instance",
|
|
97
|
-
multiple: true,
|
|
98
|
-
}),
|
|
99
|
-
};
|
|
@@ -1,47 +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 AvailableCommand extends core_1.Command {
|
|
6
|
-
async run() {
|
|
7
|
-
const { args: { integration }, flags: { available }, } = await this.parse(AvailableCommand);
|
|
8
|
-
const result = await (0, graphql_1.gqlRequest)({
|
|
9
|
-
document: (0, graphql_1.gql) `
|
|
10
|
-
mutation markAvailability($id: ID!, $available: Boolean!) {
|
|
11
|
-
updateIntegrationVersionAvailability(
|
|
12
|
-
input: { id: $id, available: $available }
|
|
13
|
-
) {
|
|
14
|
-
integration {
|
|
15
|
-
id
|
|
16
|
-
}
|
|
17
|
-
errors {
|
|
18
|
-
field
|
|
19
|
-
messages
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
`,
|
|
24
|
-
variables: {
|
|
25
|
-
id: integration,
|
|
26
|
-
available,
|
|
27
|
-
},
|
|
28
|
-
});
|
|
29
|
-
this.log(result.updateIntegrationVersionAvailability.integration.id);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
exports.default = AvailableCommand;
|
|
33
|
-
AvailableCommand.description = "Mark an Integration version as available or unavailable";
|
|
34
|
-
AvailableCommand.args = {
|
|
35
|
-
integration: core_1.Args.string({
|
|
36
|
-
required: true,
|
|
37
|
-
description: "ID of an integration version",
|
|
38
|
-
}),
|
|
39
|
-
};
|
|
40
|
-
AvailableCommand.flags = {
|
|
41
|
-
available: core_1.Flags.boolean({
|
|
42
|
-
required: true,
|
|
43
|
-
char: "a",
|
|
44
|
-
description: "Version is available or unavailable",
|
|
45
|
-
allowNo: true,
|
|
46
|
-
}),
|
|
47
|
-
};
|
|
@@ -1,58 +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, description, customer }, } = await this.parse(CreateCommand);
|
|
8
|
-
const result = await (0, graphql_1.gqlRequest)({
|
|
9
|
-
document: (0, graphql_1.gql) `
|
|
10
|
-
mutation createIntegration(
|
|
11
|
-
$name: String!
|
|
12
|
-
$description: String!
|
|
13
|
-
$customer: ID
|
|
14
|
-
) {
|
|
15
|
-
createIntegration(
|
|
16
|
-
input: {
|
|
17
|
-
name: $name
|
|
18
|
-
description: $description
|
|
19
|
-
customer: $customer
|
|
20
|
-
}
|
|
21
|
-
) {
|
|
22
|
-
integration {
|
|
23
|
-
id
|
|
24
|
-
}
|
|
25
|
-
errors {
|
|
26
|
-
field
|
|
27
|
-
messages
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
`,
|
|
32
|
-
variables: {
|
|
33
|
-
name,
|
|
34
|
-
description,
|
|
35
|
-
customer,
|
|
36
|
-
},
|
|
37
|
-
});
|
|
38
|
-
this.log(result.createIntegration.integration.id);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
exports.default = CreateCommand;
|
|
42
|
-
CreateCommand.description = "Create an Integration";
|
|
43
|
-
CreateCommand.flags = {
|
|
44
|
-
name: core_1.Flags.string({
|
|
45
|
-
char: "n",
|
|
46
|
-
required: true,
|
|
47
|
-
description: "name of the integration to create",
|
|
48
|
-
}),
|
|
49
|
-
description: core_1.Flags.string({
|
|
50
|
-
char: "d",
|
|
51
|
-
required: true,
|
|
52
|
-
description: "longer description of the integration",
|
|
53
|
-
}),
|
|
54
|
-
customer: core_1.Flags.string({
|
|
55
|
-
char: "c",
|
|
56
|
-
description: "ID of customer with which to associate the integration",
|
|
57
|
-
}),
|
|
58
|
-
};
|
|
@@ -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: { integration }, } = await this.parse(DeleteCommand);
|
|
8
|
-
await (0, graphql_1.gqlRequest)({
|
|
9
|
-
document: (0, graphql_1.gql) `
|
|
10
|
-
mutation deleteIntegration($id: ID!) {
|
|
11
|
-
deleteIntegration(input: { id: $id }) {
|
|
12
|
-
integration {
|
|
13
|
-
id
|
|
14
|
-
}
|
|
15
|
-
errors {
|
|
16
|
-
field
|
|
17
|
-
messages
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
`,
|
|
22
|
-
variables: {
|
|
23
|
-
id: integration,
|
|
24
|
-
},
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
exports.default = DeleteCommand;
|
|
29
|
-
DeleteCommand.description = "Delete an Integration";
|
|
30
|
-
DeleteCommand.args = {
|
|
31
|
-
integration: core_1.Args.string({
|
|
32
|
-
required: true,
|
|
33
|
-
description: "ID of the integration to delete",
|
|
34
|
-
}),
|
|
35
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const core_1 = require("@oclif/core");
|
|
4
|
-
const export_1 = require("../../utils/integration/export");
|
|
5
|
-
const serialize_1 = require("../../utils/serialize");
|
|
6
|
-
class ExportCommand extends core_1.Command {
|
|
7
|
-
async run() {
|
|
8
|
-
const { args: { integration }, flags: { "latest-components": useLatestComponentVersions }, } = await this.parse(ExportCommand);
|
|
9
|
-
const definition = await (0, export_1.exportDefinition)({
|
|
10
|
-
integrationId: integration,
|
|
11
|
-
latestComponents: useLatestComponentVersions,
|
|
12
|
-
});
|
|
13
|
-
this.log((0, serialize_1.dumpYaml)(definition));
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
exports.default = ExportCommand;
|
|
17
|
-
ExportCommand.description = "Export an integration to YAML definition";
|
|
18
|
-
ExportCommand.args = {
|
|
19
|
-
integration: core_1.Args.string({
|
|
20
|
-
required: true,
|
|
21
|
-
description: "ID of an integration to export",
|
|
22
|
-
}),
|
|
23
|
-
};
|
|
24
|
-
ExportCommand.flags = {
|
|
25
|
-
"latest-components": core_1.Flags.boolean({
|
|
26
|
-
char: "l",
|
|
27
|
-
description: "Use the latest available version of each Component upon import",
|
|
28
|
-
}),
|
|
29
|
-
};
|
|
@@ -1,61 +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 { args: { integration }, flags, } = await this.parse(ListCommand);
|
|
8
|
-
let flows = [];
|
|
9
|
-
let hasNextPage = true;
|
|
10
|
-
let cursor = "";
|
|
11
|
-
while (hasNextPage) {
|
|
12
|
-
const { integration: { flows: { nodes, pageInfo }, }, } = await (0, graphql_1.gqlRequest)({
|
|
13
|
-
document: (0, graphql_1.gql) `
|
|
14
|
-
query listIntegrationFlows($id: ID!, $after: String) {
|
|
15
|
-
integration(id: $id) {
|
|
16
|
-
flows(after: $after) {
|
|
17
|
-
nodes {
|
|
18
|
-
id
|
|
19
|
-
name
|
|
20
|
-
description
|
|
21
|
-
testUrl
|
|
22
|
-
}
|
|
23
|
-
pageInfo {
|
|
24
|
-
hasNextPage
|
|
25
|
-
endCursor
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
`,
|
|
31
|
-
variables: {
|
|
32
|
-
id: integration,
|
|
33
|
-
after: cursor,
|
|
34
|
-
},
|
|
35
|
-
});
|
|
36
|
-
flows = [...flows, ...nodes];
|
|
37
|
-
cursor = pageInfo.endCursor;
|
|
38
|
-
hasNextPage = pageInfo.hasNextPage;
|
|
39
|
-
}
|
|
40
|
-
core_1.ux.table(flows, {
|
|
41
|
-
id: {
|
|
42
|
-
minWidth: 8,
|
|
43
|
-
extended: true,
|
|
44
|
-
},
|
|
45
|
-
name: {},
|
|
46
|
-
description: {},
|
|
47
|
-
testUrl: { header: "Test URL", extended: true },
|
|
48
|
-
}, { ...flags });
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
exports.default = ListCommand;
|
|
52
|
-
ListCommand.description = "List Integration Flows";
|
|
53
|
-
ListCommand.args = {
|
|
54
|
-
integration: core_1.Args.string({
|
|
55
|
-
description: "ID of an Integration",
|
|
56
|
-
required: true,
|
|
57
|
-
}),
|
|
58
|
-
};
|
|
59
|
-
ListCommand.flags = {
|
|
60
|
-
...core_1.ux.table.flags(),
|
|
61
|
-
};
|
|
@@ -1,124 +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 TestCommand extends core_1.Command {
|
|
6
|
-
async run() {
|
|
7
|
-
const { args: { flow }, flags: { tail, payload, contentType }, } = await this.parse(TestCommand);
|
|
8
|
-
const result = await (0, graphql_1.gqlRequest)({
|
|
9
|
-
document: (0, graphql_1.gql) `
|
|
10
|
-
mutation testIntegrationFlow(
|
|
11
|
-
$id: ID!
|
|
12
|
-
$payload: String
|
|
13
|
-
$contentType: String
|
|
14
|
-
) {
|
|
15
|
-
testIntegrationFlow(
|
|
16
|
-
input: { id: $id, payload: $payload, contentType: $contentType }
|
|
17
|
-
) {
|
|
18
|
-
testIntegrationFlowResult {
|
|
19
|
-
flow {
|
|
20
|
-
id
|
|
21
|
-
}
|
|
22
|
-
execution {
|
|
23
|
-
id
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
errors {
|
|
27
|
-
field
|
|
28
|
-
messages
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
`,
|
|
33
|
-
variables: {
|
|
34
|
-
id: flow,
|
|
35
|
-
payload,
|
|
36
|
-
contentType,
|
|
37
|
-
},
|
|
38
|
-
});
|
|
39
|
-
const executionId = result.testIntegrationFlow.testIntegrationFlowResult.execution.id;
|
|
40
|
-
console.log(`Execution ID: ${executionId}`);
|
|
41
|
-
if (tail) {
|
|
42
|
-
await this.tailLogs(executionId);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
async tailLogs(executionId) {
|
|
46
|
-
const { flags } = await this.parse(TestCommand);
|
|
47
|
-
let nextCursor = undefined;
|
|
48
|
-
// eslint-disable-next-line no-constant-condition
|
|
49
|
-
while (true) {
|
|
50
|
-
await core_1.ux.wait(500);
|
|
51
|
-
const result = await this.fetchLogs(executionId, nextCursor);
|
|
52
|
-
if (result === undefined)
|
|
53
|
-
continue;
|
|
54
|
-
const { logs, cursor, executionComplete } = result;
|
|
55
|
-
nextCursor = cursor;
|
|
56
|
-
core_1.ux.table(logs, {
|
|
57
|
-
timestamp: {},
|
|
58
|
-
severity: {
|
|
59
|
-
minWidth: 12,
|
|
60
|
-
},
|
|
61
|
-
message: {},
|
|
62
|
-
}, { ...flags, "no-header": true });
|
|
63
|
-
if (executionComplete)
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
async fetchLogs(executionId, nextCursor) {
|
|
68
|
-
const results = await (0, graphql_1.gqlRequest)({
|
|
69
|
-
document: (0, graphql_1.gql) `
|
|
70
|
-
query listIntegrationTestLogs($executionId: ID!, $nextCursor: String) {
|
|
71
|
-
logs(
|
|
72
|
-
executionResult: $executionId
|
|
73
|
-
after: $nextCursor
|
|
74
|
-
orderBy: { field: TIMESTAMP, direction: ASC }
|
|
75
|
-
) {
|
|
76
|
-
edges {
|
|
77
|
-
node {
|
|
78
|
-
timestamp
|
|
79
|
-
severity
|
|
80
|
-
message
|
|
81
|
-
}
|
|
82
|
-
cursor
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
`,
|
|
87
|
-
variables: {
|
|
88
|
-
executionId,
|
|
89
|
-
nextCursor,
|
|
90
|
-
},
|
|
91
|
-
});
|
|
92
|
-
const { edges } = results.logs;
|
|
93
|
-
if (!edges || edges.length === 0) {
|
|
94
|
-
return undefined;
|
|
95
|
-
}
|
|
96
|
-
const logs = edges.map(({ node }) => node);
|
|
97
|
-
const executionComplete = logs.reduce((result, { message }) => result || message.startsWith("Ending Instance"), false);
|
|
98
|
-
const { cursor } = edges[edges.length - 1];
|
|
99
|
-
return { logs, cursor, executionComplete };
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
exports.default = TestCommand;
|
|
103
|
-
TestCommand.description = "Run a test of an Integration Flow";
|
|
104
|
-
TestCommand.args = {
|
|
105
|
-
flow: core_1.Args.string({ description: "ID of a flow to test", required: true }),
|
|
106
|
-
};
|
|
107
|
-
TestCommand.flags = {
|
|
108
|
-
...core_1.ux.table.flags({ only: ["extended", "columns"] }),
|
|
109
|
-
tail: core_1.Flags.boolean({
|
|
110
|
-
char: "t",
|
|
111
|
-
description: "Tail logs of the integration test run",
|
|
112
|
-
required: false,
|
|
113
|
-
}),
|
|
114
|
-
payload: core_1.Flags.string({
|
|
115
|
-
char: "p",
|
|
116
|
-
description: "Optional JSON-formatted data payload to submit with the test",
|
|
117
|
-
required: false,
|
|
118
|
-
}),
|
|
119
|
-
contentType: core_1.Flags.string({
|
|
120
|
-
char: "c",
|
|
121
|
-
description: "Optional content-type for the test payload",
|
|
122
|
-
required: false,
|
|
123
|
-
}),
|
|
124
|
-
};
|