@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.
- 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,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const core_1 = require("@oclif/core");
|
|
4
|
-
const publish_1 = require("../../utils/component/publish");
|
|
5
|
-
const query_1 = require("../../utils/user/query");
|
|
6
|
-
class PublishCommand extends core_1.Command {
|
|
7
|
-
async run() {
|
|
8
|
-
var _a;
|
|
9
|
-
const { flags: { comment, confirm, "check-signature": checkSignature, "skip-on-signature-match": skipOnSignatureMatch, customer: flagCustomer, }, } = await this.parse(PublishCommand);
|
|
10
|
-
const me = await (0, query_1.whoAmI)();
|
|
11
|
-
const customer = flagCustomer !== null && flagCustomer !== void 0 ? flagCustomer : (_a = me.customer) === null || _a === void 0 ? void 0 : _a.id;
|
|
12
|
-
const definition = await (0, publish_1.loadEntrypoint)();
|
|
13
|
-
await (0, publish_1.validateDefinition)(definition);
|
|
14
|
-
const packagePath = await (0, publish_1.createComponentPackage)();
|
|
15
|
-
if (checkSignature) {
|
|
16
|
-
const signatureMatches = await (0, publish_1.checkPackageSignature)(definition, packagePath, customer);
|
|
17
|
-
if (signatureMatches) {
|
|
18
|
-
if (skipOnSignatureMatch ||
|
|
19
|
-
!(await core_1.ux.confirm("The new package signature matches the existing package signature. Continue publishing new package? (y/N)"))) {
|
|
20
|
-
// Signatures match and we've opted to skip on match, so bail.
|
|
21
|
-
core_1.ux.log("Package signatures match, skipping publish.");
|
|
22
|
-
core_1.ux.exit(0);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
await (0, publish_1.confirmPublish)(definition, confirm);
|
|
27
|
-
const { iconUploadUrl, packageUploadUrl, connectionIconUploadUrls, versionNumber, } = await (0, publish_1.publishDefinition)(definition, comment, customer);
|
|
28
|
-
const { display: { iconPath }, } = definition;
|
|
29
|
-
await (0, publish_1.uploadFile)(packagePath, packageUploadUrl);
|
|
30
|
-
await (0, publish_1.uploadFile)(iconPath, iconUploadUrl);
|
|
31
|
-
await (0, publish_1.uploadConnectionIcons)(definition, connectionIconUploadUrls);
|
|
32
|
-
const { display: { label }, } = definition;
|
|
33
|
-
// Tell user that their publish was successful and can use components list to view status
|
|
34
|
-
this.log(`Successfully submitted ${label} (v${versionNumber})! The publish should finish processing shortly.`);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
exports.default = PublishCommand;
|
|
38
|
-
PublishCommand.description = "Publish a Component to Prismatic";
|
|
39
|
-
PublishCommand.flags = {
|
|
40
|
-
comment: core_1.Flags.string({
|
|
41
|
-
required: false,
|
|
42
|
-
char: "c",
|
|
43
|
-
description: "Comment about changes in this Publish",
|
|
44
|
-
}),
|
|
45
|
-
confirm: core_1.Flags.boolean({
|
|
46
|
-
allowNo: true,
|
|
47
|
-
default: true,
|
|
48
|
-
description: "Interactively confirm publish",
|
|
49
|
-
}),
|
|
50
|
-
"check-signature": core_1.Flags.boolean({
|
|
51
|
-
allowNo: true,
|
|
52
|
-
default: true,
|
|
53
|
-
description: "Check signature of existing component and confirm publish if matched",
|
|
54
|
-
}),
|
|
55
|
-
"skip-on-signature-match": core_1.Flags.boolean({
|
|
56
|
-
required: false,
|
|
57
|
-
description: "Skips component publish if the new signature matches the existing signature",
|
|
58
|
-
}),
|
|
59
|
-
customer: core_1.Flags.string({
|
|
60
|
-
description: "ID of customer with which to associate the component",
|
|
61
|
-
}),
|
|
62
|
-
};
|
|
@@ -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 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 {
|
|
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
|
-
triggers = [...triggers, ...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(triggers, {
|
|
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 Triggers 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 triggers for (e.g. 'salesforce')",
|
|
95
|
-
}),
|
|
96
|
-
};
|
|
@@ -1,72 +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, externalId, label }, } = await this.parse(CreateCommand);
|
|
8
|
-
const result = await (0, graphql_1.gqlRequest)({
|
|
9
|
-
document: (0, graphql_1.gql) `
|
|
10
|
-
mutation createCustomer(
|
|
11
|
-
$name: String!
|
|
12
|
-
$description: String
|
|
13
|
-
$externalId: String
|
|
14
|
-
$labels: [String]
|
|
15
|
-
) {
|
|
16
|
-
createCustomer(
|
|
17
|
-
input: {
|
|
18
|
-
name: $name
|
|
19
|
-
description: $description
|
|
20
|
-
externalId: $externalId
|
|
21
|
-
labels: $labels
|
|
22
|
-
}
|
|
23
|
-
) {
|
|
24
|
-
customer {
|
|
25
|
-
id
|
|
26
|
-
}
|
|
27
|
-
errors {
|
|
28
|
-
field
|
|
29
|
-
messages
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
`,
|
|
34
|
-
variables: {
|
|
35
|
-
name,
|
|
36
|
-
description,
|
|
37
|
-
externalId,
|
|
38
|
-
labels: label,
|
|
39
|
-
},
|
|
40
|
-
});
|
|
41
|
-
this.log(result.createCustomer.customer.id);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
exports.default = CreateCommand;
|
|
45
|
-
CreateCommand.description = "Create a new Customer";
|
|
46
|
-
CreateCommand.flags = {
|
|
47
|
-
name: core_1.Flags.string({
|
|
48
|
-
char: "n",
|
|
49
|
-
required: true,
|
|
50
|
-
description: "short name of the new customer",
|
|
51
|
-
}),
|
|
52
|
-
description: core_1.Flags.string({
|
|
53
|
-
char: "d",
|
|
54
|
-
description: "longer description of the customer",
|
|
55
|
-
required: false,
|
|
56
|
-
}),
|
|
57
|
-
externalId: core_1.Flags.string({
|
|
58
|
-
char: "e",
|
|
59
|
-
description: "external ID of the customer from your system",
|
|
60
|
-
}),
|
|
61
|
-
label: core_1.Flags.string({
|
|
62
|
-
char: "l",
|
|
63
|
-
description: "a label to apply to the customer",
|
|
64
|
-
multiple: true,
|
|
65
|
-
}),
|
|
66
|
-
};
|
|
67
|
-
CreateCommand.examples = [
|
|
68
|
-
{
|
|
69
|
-
description: "Apply multiple labels to a customer",
|
|
70
|
-
command: 'prism customers:create --name "Widgets Inc" --externalId "abc-123" --label "Prod Customers" --label "Beta Testers"',
|
|
71
|
-
},
|
|
72
|
-
];
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const core_1 = require("@oclif/core");
|
|
4
|
-
const fields_1 = require("../../../fields");
|
|
5
|
-
const graphql_1 = require("../../../graphql");
|
|
6
|
-
class CreateCommand extends core_1.Command {
|
|
7
|
-
async run() {
|
|
8
|
-
const { flags: { label, "authorization-method": authorizationMethod, fields, customer, }, } = await this.parse(CreateCommand);
|
|
9
|
-
const values = (0, fields_1.toValues)(fields);
|
|
10
|
-
const result = await (0, graphql_1.gqlRequest)({
|
|
11
|
-
document: (0, graphql_1.gql) `
|
|
12
|
-
mutation createCustomerCredential(
|
|
13
|
-
$customer: ID!
|
|
14
|
-
$label: String!
|
|
15
|
-
$authorizationMethod: ID!
|
|
16
|
-
$values: [InputCredentialFieldValue]
|
|
17
|
-
) {
|
|
18
|
-
createCustomerCredential(
|
|
19
|
-
input: {
|
|
20
|
-
customer: $customer
|
|
21
|
-
label: $label
|
|
22
|
-
authorizationMethod: $authorizationMethod
|
|
23
|
-
values: $values
|
|
24
|
-
}
|
|
25
|
-
) {
|
|
26
|
-
errors {
|
|
27
|
-
field
|
|
28
|
-
messages
|
|
29
|
-
}
|
|
30
|
-
credential {
|
|
31
|
-
id
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
`,
|
|
36
|
-
variables: {
|
|
37
|
-
customer,
|
|
38
|
-
label,
|
|
39
|
-
authorizationMethod,
|
|
40
|
-
values,
|
|
41
|
-
},
|
|
42
|
-
});
|
|
43
|
-
this.log(result.createCustomerCredential.credential.id);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
exports.default = CreateCommand;
|
|
47
|
-
CreateCommand.description = "Create a set of Customer-specific Credentials for use by Instance Actions";
|
|
48
|
-
CreateCommand.flags = {
|
|
49
|
-
customer: core_1.Flags.string({
|
|
50
|
-
char: "c",
|
|
51
|
-
required: true,
|
|
52
|
-
description: "ID of the customer",
|
|
53
|
-
}),
|
|
54
|
-
label: core_1.Flags.string({
|
|
55
|
-
char: "l",
|
|
56
|
-
required: true,
|
|
57
|
-
description: "name to give the new credentials",
|
|
58
|
-
}),
|
|
59
|
-
"authorization-method": core_1.Flags.string({
|
|
60
|
-
char: "a",
|
|
61
|
-
required: true,
|
|
62
|
-
description: "ID of the authorization method",
|
|
63
|
-
}),
|
|
64
|
-
fields: core_1.Flags.string({
|
|
65
|
-
char: "f",
|
|
66
|
-
description: "username, password, etc., in JSON format",
|
|
67
|
-
}),
|
|
68
|
-
};
|
|
@@ -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: { credential }, } = await this.parse(DeleteCommand);
|
|
8
|
-
await (0, graphql_1.gqlRequest)({
|
|
9
|
-
document: (0, graphql_1.gql) `
|
|
10
|
-
mutation deleteCredential($id: ID!) {
|
|
11
|
-
deleteCredential(input: { id: $id }) {
|
|
12
|
-
credential {
|
|
13
|
-
id
|
|
14
|
-
}
|
|
15
|
-
errors {
|
|
16
|
-
field
|
|
17
|
-
messages
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
`,
|
|
22
|
-
variables: {
|
|
23
|
-
id: credential,
|
|
24
|
-
},
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
exports.default = DeleteCommand;
|
|
29
|
-
DeleteCommand.description = "Delete a Customer Credential";
|
|
30
|
-
DeleteCommand.args = {
|
|
31
|
-
credential: core_1.Args.string({
|
|
32
|
-
required: true,
|
|
33
|
-
description: "ID of the credential to delete",
|
|
34
|
-
}),
|
|
35
|
-
};
|
|
@@ -1,56 +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 } = flags;
|
|
9
|
-
const result = await (0, graphql_1.gqlRequest)({
|
|
10
|
-
document: (0, graphql_1.gql) `
|
|
11
|
-
query listCustomerCredentials($id: ID!) {
|
|
12
|
-
customer(id: $id) {
|
|
13
|
-
credentials {
|
|
14
|
-
nodes {
|
|
15
|
-
id
|
|
16
|
-
label
|
|
17
|
-
authorizationMethod {
|
|
18
|
-
id
|
|
19
|
-
label
|
|
20
|
-
}
|
|
21
|
-
readyForUse
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
`,
|
|
27
|
-
variables: {
|
|
28
|
-
id: customer,
|
|
29
|
-
},
|
|
30
|
-
});
|
|
31
|
-
core_1.ux.table(result.customer.credentials.nodes, {
|
|
32
|
-
id: {
|
|
33
|
-
minWidth: 8,
|
|
34
|
-
extended: true,
|
|
35
|
-
},
|
|
36
|
-
label: {},
|
|
37
|
-
authorizationMethod: {
|
|
38
|
-
header: "Authorization Method",
|
|
39
|
-
get: (row) => row.authorizationMethod.label,
|
|
40
|
-
},
|
|
41
|
-
readyForUse: {
|
|
42
|
-
header: "Ready for Use",
|
|
43
|
-
},
|
|
44
|
-
}, { ...flags });
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
exports.default = ListCommand;
|
|
48
|
-
ListCommand.description = "List Credentials for a Customer";
|
|
49
|
-
ListCommand.flags = {
|
|
50
|
-
customer: core_1.Flags.string({
|
|
51
|
-
char: "c",
|
|
52
|
-
required: true,
|
|
53
|
-
description: "ID of a customer",
|
|
54
|
-
}),
|
|
55
|
-
...core_1.ux.table.flags(),
|
|
56
|
-
};
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const core_1 = require("@oclif/core");
|
|
4
|
-
const fields_1 = require("../../../fields");
|
|
5
|
-
const graphql_1 = require("../../../graphql");
|
|
6
|
-
class UpdateCommand extends core_1.Command {
|
|
7
|
-
async run() {
|
|
8
|
-
const { args: { credential }, flags: { label, fields }, } = await this.parse(UpdateCommand);
|
|
9
|
-
const values = (0, fields_1.toValues)(fields);
|
|
10
|
-
const result = await (0, graphql_1.gqlRequest)({
|
|
11
|
-
document: (0, graphql_1.gql) `
|
|
12
|
-
mutation updateCustomerCredential(
|
|
13
|
-
$label: String!
|
|
14
|
-
$values: [InputCredentialFieldValue]!
|
|
15
|
-
$credential: ID!
|
|
16
|
-
) {
|
|
17
|
-
updateCredential(
|
|
18
|
-
input: { label: $label, values: $values, id: $credential }
|
|
19
|
-
) {
|
|
20
|
-
errors {
|
|
21
|
-
field
|
|
22
|
-
messages
|
|
23
|
-
}
|
|
24
|
-
credential {
|
|
25
|
-
id
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
`,
|
|
30
|
-
variables: {
|
|
31
|
-
credential,
|
|
32
|
-
label,
|
|
33
|
-
values,
|
|
34
|
-
},
|
|
35
|
-
});
|
|
36
|
-
this.log(result.updateCredential.credential.id);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
exports.default = UpdateCommand;
|
|
40
|
-
UpdateCommand.description = "Update a Customer-specific Credential for use by Instance Actions";
|
|
41
|
-
UpdateCommand.args = {
|
|
42
|
-
credential: core_1.Args.string({
|
|
43
|
-
required: true,
|
|
44
|
-
description: "ID of a credential",
|
|
45
|
-
}),
|
|
46
|
-
};
|
|
47
|
-
UpdateCommand.flags = {
|
|
48
|
-
label: core_1.Flags.string({
|
|
49
|
-
char: "l",
|
|
50
|
-
required: true,
|
|
51
|
-
description: "new name to give the credential",
|
|
52
|
-
}),
|
|
53
|
-
fields: core_1.Flags.string({
|
|
54
|
-
char: "f",
|
|
55
|
-
required: true,
|
|
56
|
-
description: "username, password, etc., in JSON format",
|
|
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: { customer }, } = await this.parse(DeleteCommand);
|
|
8
|
-
await (0, graphql_1.gqlRequest)({
|
|
9
|
-
document: (0, graphql_1.gql) `
|
|
10
|
-
mutation deleteCustomer($id: ID!) {
|
|
11
|
-
deleteCustomer(input: { id: $id }) {
|
|
12
|
-
customer {
|
|
13
|
-
id
|
|
14
|
-
}
|
|
15
|
-
errors {
|
|
16
|
-
field
|
|
17
|
-
messages
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
`,
|
|
22
|
-
variables: {
|
|
23
|
-
id: customer,
|
|
24
|
-
},
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
exports.default = DeleteCommand;
|
|
29
|
-
DeleteCommand.description = "Delete a Customer";
|
|
30
|
-
DeleteCommand.args = {
|
|
31
|
-
customer: core_1.Args.string({
|
|
32
|
-
required: true,
|
|
33
|
-
description: "ID of the customer to delete",
|
|
34
|
-
}),
|
|
35
|
-
};
|
|
@@ -1,51 +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 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
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
`,
|
|
29
|
-
variables: { after: cursor },
|
|
30
|
-
});
|
|
31
|
-
customers = [...customers, ...nodes];
|
|
32
|
-
cursor = pageInfo.endCursor;
|
|
33
|
-
hasNextPage = pageInfo.hasNextPage;
|
|
34
|
-
}
|
|
35
|
-
core_1.ux.table(customers, {
|
|
36
|
-
id: {
|
|
37
|
-
minWidth: 8,
|
|
38
|
-
extended: true,
|
|
39
|
-
},
|
|
40
|
-
externalId: {
|
|
41
|
-
extended: true,
|
|
42
|
-
get: ({ externalId }) => externalId || "",
|
|
43
|
-
},
|
|
44
|
-
name: {},
|
|
45
|
-
description: {},
|
|
46
|
-
}, { ...flags });
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
exports.default = ListCommand;
|
|
50
|
-
ListCommand.description = "List your Customers";
|
|
51
|
-
ListCommand.flags = { ...core_1.ux.table.flags() };
|
|
@@ -1,82 +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: { customer }, flags: { name, description, externalId, label }, } = await this.parse(UpdateCommand);
|
|
8
|
-
const result = await (0, graphql_1.gqlRequest)({
|
|
9
|
-
document: (0, graphql_1.gql) `
|
|
10
|
-
mutation updateCustomer(
|
|
11
|
-
$id: ID!
|
|
12
|
-
$name: String
|
|
13
|
-
$description: String
|
|
14
|
-
$externalId: String
|
|
15
|
-
$labels: [String]
|
|
16
|
-
) {
|
|
17
|
-
updateCustomer(
|
|
18
|
-
input: {
|
|
19
|
-
id: $id
|
|
20
|
-
name: $name
|
|
21
|
-
description: $description
|
|
22
|
-
externalId: $externalId
|
|
23
|
-
labels: $labels
|
|
24
|
-
}
|
|
25
|
-
) {
|
|
26
|
-
customer {
|
|
27
|
-
id
|
|
28
|
-
}
|
|
29
|
-
errors {
|
|
30
|
-
field
|
|
31
|
-
messages
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
`,
|
|
36
|
-
variables: {
|
|
37
|
-
id: customer,
|
|
38
|
-
name,
|
|
39
|
-
description,
|
|
40
|
-
externalId,
|
|
41
|
-
labels: label,
|
|
42
|
-
},
|
|
43
|
-
});
|
|
44
|
-
this.log(result.updateCustomer.customer.id);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
exports.default = UpdateCommand;
|
|
48
|
-
// TODO: Add more flags once optional updates are implemented
|
|
49
|
-
UpdateCommand.description = "Update a Customer";
|
|
50
|
-
UpdateCommand.args = {
|
|
51
|
-
customer: core_1.Args.string({
|
|
52
|
-
required: true,
|
|
53
|
-
description: "ID of a customer",
|
|
54
|
-
}),
|
|
55
|
-
};
|
|
56
|
-
UpdateCommand.flags = {
|
|
57
|
-
name: core_1.Flags.string({
|
|
58
|
-
char: "n",
|
|
59
|
-
description: "name of the customer",
|
|
60
|
-
required: false,
|
|
61
|
-
}),
|
|
62
|
-
description: core_1.Flags.string({
|
|
63
|
-
char: "d",
|
|
64
|
-
description: "description of the customer",
|
|
65
|
-
required: false,
|
|
66
|
-
}),
|
|
67
|
-
externalId: core_1.Flags.string({
|
|
68
|
-
char: "e",
|
|
69
|
-
description: "external ID of the customer from your system",
|
|
70
|
-
}),
|
|
71
|
-
label: core_1.Flags.string({
|
|
72
|
-
char: "l",
|
|
73
|
-
description: "a label to apply to the customer",
|
|
74
|
-
multiple: true,
|
|
75
|
-
}),
|
|
76
|
-
};
|
|
77
|
-
UpdateCommand.examples = [
|
|
78
|
-
{
|
|
79
|
-
description: "Apply multiple labels to a customer (note: previously set labels will be overwritten)",
|
|
80
|
-
command: 'prism customers:update Q3VzdG9tZXI6MmUzZDllOTUtMWIyMy00N2FjLTk3MjUtMzU1OTA2YzgyZWZj --label "Prod Customers" --label "Beta Testers"',
|
|
81
|
-
},
|
|
82
|
-
];
|
|
@@ -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, email, role, customer }, } = await this.parse(CreateCommand);
|
|
8
|
-
const result = await (0, graphql_1.gqlRequest)({
|
|
9
|
-
document: (0, graphql_1.gql) `
|
|
10
|
-
mutation createCustomerUser(
|
|
11
|
-
$name: String
|
|
12
|
-
$email: String!
|
|
13
|
-
$role: ID!
|
|
14
|
-
$customer: ID!
|
|
15
|
-
) {
|
|
16
|
-
createCustomerUser(
|
|
17
|
-
input: {
|
|
18
|
-
name: $name
|
|
19
|
-
email: $email
|
|
20
|
-
role: $role
|
|
21
|
-
customer: $customer
|
|
22
|
-
}
|
|
23
|
-
) {
|
|
24
|
-
user {
|
|
25
|
-
id
|
|
26
|
-
}
|
|
27
|
-
errors {
|
|
28
|
-
field
|
|
29
|
-
messages
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
`,
|
|
34
|
-
variables: {
|
|
35
|
-
name,
|
|
36
|
-
email,
|
|
37
|
-
role,
|
|
38
|
-
customer,
|
|
39
|
-
},
|
|
40
|
-
});
|
|
41
|
-
this.log(result.createCustomerUser.user.id);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
exports.default = CreateCommand;
|
|
45
|
-
CreateCommand.description = "Create a User for the specified Customer";
|
|
46
|
-
CreateCommand.flags = {
|
|
47
|
-
email: core_1.Flags.string({
|
|
48
|
-
char: "e",
|
|
49
|
-
required: true,
|
|
50
|
-
description: "email address",
|
|
51
|
-
}),
|
|
52
|
-
role: core_1.Flags.string({
|
|
53
|
-
char: "r",
|
|
54
|
-
required: true,
|
|
55
|
-
description: "ID of the role to assign the user",
|
|
56
|
-
}),
|
|
57
|
-
customer: core_1.Flags.string({
|
|
58
|
-
char: "c",
|
|
59
|
-
required: true,
|
|
60
|
-
description: "ID of the customer this user is associated with",
|
|
61
|
-
}),
|
|
62
|
-
name: core_1.Flags.string({
|
|
63
|
-
char: "n",
|
|
64
|
-
description: "name of the new user",
|
|
65
|
-
required: false,
|
|
66
|
-
}),
|
|
67
|
-
};
|