@prismatic-io/prism 3.2.2 → 4.1.0

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 (207) hide show
  1. package/bin/run +9 -8
  2. package/lib/auth.js +184 -202
  3. package/lib/commands/alerts/events/list.js +27 -57
  4. package/lib/commands/alerts/groups/create.js +18 -49
  5. package/lib/commands/alerts/groups/delete.js +10 -41
  6. package/lib/commands/alerts/groups/list.js +15 -47
  7. package/lib/commands/alerts/monitors/clear.js +10 -41
  8. package/lib/commands/alerts/monitors/create.js +27 -58
  9. package/lib/commands/alerts/monitors/delete.js +10 -41
  10. package/lib/commands/alerts/monitors/list.js +16 -48
  11. package/lib/commands/alerts/triggers/list.js +15 -47
  12. package/lib/commands/alerts/webhooks/create.js +18 -49
  13. package/lib/commands/alerts/webhooks/delete.js +10 -41
  14. package/lib/commands/alerts/webhooks/list.js +25 -57
  15. package/lib/commands/authorization-methods/list.js +20 -51
  16. package/lib/commands/components/actions/list.js +29 -61
  17. package/lib/commands/components/delete.js +10 -41
  18. package/lib/commands/components/dev/run.js +75 -0
  19. package/lib/commands/components/dev/test.js +218 -0
  20. package/lib/commands/components/init/action.js +12 -0
  21. package/lib/commands/components/init/component.js +12 -0
  22. package/lib/commands/components/init/connection.js +12 -0
  23. package/lib/commands/components/init/index.js +203 -0
  24. package/lib/commands/components/init/trigger.js +12 -0
  25. package/lib/commands/components/list.js +31 -60
  26. package/lib/commands/components/publish.js +29 -279
  27. package/lib/commands/components/triggers/list.js +29 -61
  28. package/lib/commands/customers/create.js +14 -45
  29. package/lib/commands/customers/credentials/create.js +19 -50
  30. package/lib/commands/customers/credentials/delete.js +10 -41
  31. package/lib/commands/customers/credentials/list.js +30 -59
  32. package/lib/commands/customers/credentials/update.js +16 -47
  33. package/lib/commands/customers/delete.js +10 -41
  34. package/lib/commands/customers/list.js +16 -48
  35. package/lib/commands/customers/update.js +15 -46
  36. package/lib/commands/customers/users/create.js +18 -49
  37. package/lib/commands/customers/users/delete.js +10 -41
  38. package/lib/commands/customers/users/list.js +21 -51
  39. package/lib/commands/customers/users/roles.js +18 -48
  40. package/lib/commands/customers/users/update.js +19 -50
  41. package/lib/commands/executions/step-result/get.js +36 -66
  42. package/lib/commands/instances/config-vars/list.js +32 -62
  43. package/lib/commands/instances/create.js +20 -51
  44. package/lib/commands/instances/delete.js +10 -41
  45. package/lib/commands/instances/deploy.js +20 -44
  46. package/lib/commands/instances/disable.js +11 -42
  47. package/lib/commands/instances/enable.js +11 -42
  48. package/lib/commands/instances/flow-configs/list.js +25 -55
  49. package/lib/commands/instances/flow-configs/test.js +62 -97
  50. package/lib/commands/instances/list.js +31 -59
  51. package/lib/commands/instances/update.js +15 -46
  52. package/lib/commands/integrations/available.js +13 -44
  53. package/lib/commands/integrations/create.js +14 -45
  54. package/lib/commands/integrations/delete.js +10 -41
  55. package/lib/commands/integrations/export.js +16 -59
  56. package/lib/commands/integrations/flows/list.js +22 -52
  57. package/lib/commands/integrations/flows/test.js +62 -96
  58. package/lib/commands/integrations/fork.js +15 -46
  59. package/lib/commands/integrations/import.js +12 -63
  60. package/lib/commands/integrations/list.js +25 -54
  61. package/lib/commands/integrations/publish.js +13 -44
  62. package/lib/commands/integrations/update.js +18 -49
  63. package/lib/commands/integrations/versions/index.js +26 -58
  64. package/lib/commands/login.js +16 -32
  65. package/lib/commands/logout.js +10 -22
  66. package/lib/commands/logs/severities/list.js +15 -47
  67. package/lib/commands/me/index.js +13 -60
  68. package/lib/commands/me/token/revoke.js +12 -0
  69. package/lib/commands/me/token.js +10 -22
  70. package/lib/commands/organization/credentials/create.js +17 -48
  71. package/lib/commands/organization/credentials/delete.js +10 -41
  72. package/lib/commands/organization/credentials/list.js +22 -54
  73. package/lib/commands/organization/credentials/update.js +16 -47
  74. package/lib/commands/organization/update.js +12 -43
  75. package/lib/commands/organization/updateAvatarUrl.js +14 -45
  76. package/lib/commands/organization/users/create.js +16 -47
  77. package/lib/commands/organization/users/delete.js +10 -41
  78. package/lib/commands/organization/users/list.js +16 -48
  79. package/lib/commands/organization/users/roles.js +18 -48
  80. package/lib/commands/organization/users/update.js +19 -50
  81. package/lib/config.js +24 -30
  82. package/lib/errors.js +48 -27
  83. package/lib/fields.js +6 -4
  84. package/lib/fs.js +6 -14
  85. package/lib/generate/action.js +36 -41
  86. package/lib/generate/client.js +11 -16
  87. package/lib/generate/connection.js +4 -13
  88. package/lib/generate/index.js +29 -19
  89. package/lib/generate/input.js +28 -43
  90. package/lib/generate/parse.js +38 -44
  91. package/lib/generate/sourceFile.js +11 -7
  92. package/lib/generate/util.js +9 -7
  93. package/lib/graphql.js +37 -65
  94. package/lib/index.js +3 -3
  95. package/lib/utils/component/publish.js +219 -0
  96. package/lib/utils/component/query.js +23 -0
  97. package/lib/utils/date.js +14 -0
  98. package/lib/utils/execution/logs.js +86 -0
  99. package/lib/utils/integration/definition.js +101 -0
  100. package/lib/utils/integration/export.js +36 -0
  101. package/lib/utils/integration/import.js +46 -0
  102. package/lib/utils/integration/invoke.js +64 -0
  103. package/lib/utils/integration/query.js +59 -0
  104. package/lib/utils/serialize.js +8 -0
  105. package/lib/utils/user/query.js +24 -0
  106. package/lib/yeoman.js +23 -0
  107. package/oclif.manifest.json +1 -1
  108. package/package.json +48 -54
  109. package/templates/component/openapi/client.ts +11 -9
  110. package/templates/component/openapi/request.ts +6 -4
  111. package/lib/auth.js.map +0 -1
  112. package/lib/commands/alerts/events/list.js.map +0 -1
  113. package/lib/commands/alerts/groups/create.js.map +0 -1
  114. package/lib/commands/alerts/groups/delete.js.map +0 -1
  115. package/lib/commands/alerts/groups/list.js.map +0 -1
  116. package/lib/commands/alerts/monitors/clear.js.map +0 -1
  117. package/lib/commands/alerts/monitors/create.js.map +0 -1
  118. package/lib/commands/alerts/monitors/delete.js.map +0 -1
  119. package/lib/commands/alerts/monitors/list.js.map +0 -1
  120. package/lib/commands/alerts/triggers/list.js.map +0 -1
  121. package/lib/commands/alerts/webhooks/create.js.map +0 -1
  122. package/lib/commands/alerts/webhooks/delete.js.map +0 -1
  123. package/lib/commands/alerts/webhooks/list.js.map +0 -1
  124. package/lib/commands/authorization-methods/list.js.map +0 -1
  125. package/lib/commands/components/actions/list.js.map +0 -1
  126. package/lib/commands/components/delete.js.map +0 -1
  127. package/lib/commands/components/init.js +0 -224
  128. package/lib/commands/components/init.js.map +0 -1
  129. package/lib/commands/components/list.js.map +0 -1
  130. package/lib/commands/components/publish.js.map +0 -1
  131. package/lib/commands/components/triggers/list.js.map +0 -1
  132. package/lib/commands/customers/create.js.map +0 -1
  133. package/lib/commands/customers/credentials/create.js.map +0 -1
  134. package/lib/commands/customers/credentials/delete.js.map +0 -1
  135. package/lib/commands/customers/credentials/list.js.map +0 -1
  136. package/lib/commands/customers/credentials/update.js.map +0 -1
  137. package/lib/commands/customers/delete.js.map +0 -1
  138. package/lib/commands/customers/list.js.map +0 -1
  139. package/lib/commands/customers/update.js.map +0 -1
  140. package/lib/commands/customers/users/create.js.map +0 -1
  141. package/lib/commands/customers/users/delete.js.map +0 -1
  142. package/lib/commands/customers/users/list.js.map +0 -1
  143. package/lib/commands/customers/users/roles.js.map +0 -1
  144. package/lib/commands/customers/users/update.js.map +0 -1
  145. package/lib/commands/executions/step-result/get.js.map +0 -1
  146. package/lib/commands/instances/config-vars/list.js.map +0 -1
  147. package/lib/commands/instances/create.js.map +0 -1
  148. package/lib/commands/instances/delete.js.map +0 -1
  149. package/lib/commands/instances/deploy.js.map +0 -1
  150. package/lib/commands/instances/disable.js.map +0 -1
  151. package/lib/commands/instances/enable.js.map +0 -1
  152. package/lib/commands/instances/flow-configs/list.js.map +0 -1
  153. package/lib/commands/instances/flow-configs/test.js.map +0 -1
  154. package/lib/commands/instances/list.js.map +0 -1
  155. package/lib/commands/instances/update.js.map +0 -1
  156. package/lib/commands/integrations/available.js.map +0 -1
  157. package/lib/commands/integrations/create.js.map +0 -1
  158. package/lib/commands/integrations/delete.js.map +0 -1
  159. package/lib/commands/integrations/export.js.map +0 -1
  160. package/lib/commands/integrations/flows/list.js.map +0 -1
  161. package/lib/commands/integrations/flows/test.js.map +0 -1
  162. package/lib/commands/integrations/fork.js.map +0 -1
  163. package/lib/commands/integrations/import.js.map +0 -1
  164. package/lib/commands/integrations/list.js.map +0 -1
  165. package/lib/commands/integrations/publish.js.map +0 -1
  166. package/lib/commands/integrations/update.js.map +0 -1
  167. package/lib/commands/integrations/versions/index.js.map +0 -1
  168. package/lib/commands/login.js.map +0 -1
  169. package/lib/commands/logout.js.map +0 -1
  170. package/lib/commands/logs/severities/list.js.map +0 -1
  171. package/lib/commands/me/index.js.map +0 -1
  172. package/lib/commands/me/token.js.map +0 -1
  173. package/lib/commands/organization/credentials/create.js.map +0 -1
  174. package/lib/commands/organization/credentials/delete.js.map +0 -1
  175. package/lib/commands/organization/credentials/list.js.map +0 -1
  176. package/lib/commands/organization/credentials/update.js.map +0 -1
  177. package/lib/commands/organization/update.js.map +0 -1
  178. package/lib/commands/organization/updateAvatarUrl.js.map +0 -1
  179. package/lib/commands/organization/users/create.js.map +0 -1
  180. package/lib/commands/organization/users/delete.js.map +0 -1
  181. package/lib/commands/organization/users/list.js.map +0 -1
  182. package/lib/commands/organization/users/roles.js.map +0 -1
  183. package/lib/commands/organization/users/update.js.map +0 -1
  184. package/lib/config.js.map +0 -1
  185. package/lib/errors.js.map +0 -1
  186. package/lib/fields.js.map +0 -1
  187. package/lib/fs.js.map +0 -1
  188. package/lib/generate/action.js.map +0 -1
  189. package/lib/generate/client.js.map +0 -1
  190. package/lib/generate/connection.js.map +0 -1
  191. package/lib/generate/index.js.map +0 -1
  192. package/lib/generate/input.js.map +0 -1
  193. package/lib/generate/parse.js.map +0 -1
  194. package/lib/generate/sourceFile.js.map +0 -1
  195. package/lib/generate/util.js.map +0 -1
  196. package/lib/graphql.js.map +0 -1
  197. package/lib/index.js.map +0 -1
  198. package/templates/component/jest.config.js +0 -4
  199. package/templates/component/package.json +0 -24
  200. package/templates/component/src/actions.ts +0 -33
  201. package/templates/component/src/client.ts +0 -7
  202. package/templates/component/src/connections.ts +0 -25
  203. package/templates/component/src/index.test.ts +0 -32
  204. package/templates/component/src/index.ts +0 -17
  205. package/templates/component/src/triggers.ts +0 -18
  206. package/templates/component/tsconfig.json +0 -19
  207. package/templates/component/webpack.config.js +0 -44
@@ -1,304 +1,54 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
- Object.defineProperty(o, "default", { enumerable: true, value: v });
11
- }) : function(o, v) {
12
- o["default"] = v;
13
- });
14
- var __importStar = (this && this.__importStar) || function (mod) {
15
- if (mod && mod.__esModule) return mod;
16
- var result = {};
17
- if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
- __setModuleDefault(result, mod);
19
- return result;
20
- };
21
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
22
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
23
- return new (P || (P = Promise))(function (resolve, reject) {
24
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
25
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
26
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
27
- step((generator = generator.apply(thisArg, _arguments || [])).next());
28
- });
29
- };
30
- var __rest = (this && this.__rest) || function (s, e) {
31
- var t = {};
32
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
33
- t[p] = s[p];
34
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
35
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
36
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
37
- t[p[i]] = s[p[i]];
38
- }
39
- return t;
40
- };
41
- var __importDefault = (this && this.__importDefault) || function (mod) {
42
- return (mod && mod.__esModule) ? mod : { "default": mod };
43
- };
44
2
  Object.defineProperty(exports, "__esModule", { value: true });
45
- const command_1 = require("@oclif/command");
46
- const fs_1 = require("../../fs");
47
- const crypto_1 = __importDefault(require("crypto"));
48
- const tempy_1 = __importDefault(require("tempy"));
49
- const axios_1 = __importDefault(require("axios"));
50
- const mime_types_1 = __importDefault(require("mime-types"));
51
- const path_1 = require("path");
52
- const graphql_1 = __importStar(require("../../graphql"));
53
- const archiver_1 = __importDefault(require("archiver"));
54
- const cli_ux_1 = __importDefault(require("cli-ux"));
55
- class PublishCommand extends command_1.Command {
56
- run() {
57
- return __awaiter(this, void 0, void 0, function* () {
58
- const { flags: { comment, confirm, "skip-upload": skipUpload, "skip-on-signature-match": skipOnSignatureMatch, }, } = this.parse(PublishCommand);
59
- const definition = yield this.loadEntrypoint();
60
- // Output basic information to the user to confirm that this component is what they want to publish
61
- const { key, display: { label, description, iconPath }, connections, } = definition;
62
- if (!label || !description) {
63
- this.error("Failed to find required Component manifest information. Exiting.", { exit: 1 });
64
- }
65
- if (iconPath && !(yield fs_1.exists(iconPath))) {
66
- this.error("Icon was specified (iconPath) but a file was not found at specified path. Exiting.", { exit: 1 });
67
- }
68
- // TODO: Check if all Connection icons exist.
69
- const packagePath = yield this.createPackage();
70
- yield this.checkSignature(key, packagePath, skipOnSignatureMatch);
71
- yield this.confirmPublish(label, description, confirm);
72
- const { iconUploadUrl, packageUploadUrl, connectionIconUploadUrls, versionNumber, } = yield this.publishDefinition(definition, comment);
73
- if (!skipUpload) {
74
- yield this.uploadIcon(iconPath, iconUploadUrl);
75
- yield this.uploadConnectionIcons(connections, connectionIconUploadUrls);
76
- yield this.uploadPackage(packagePath, packageUploadUrl);
77
- }
78
- // Tell user that their publish was successful and can use components list to view status
79
- this.log(`Successfully submitted ${label} (v${versionNumber})! The publish should finish processing shortly.`);
80
- });
81
- }
82
- seekComponentPackageDistDirectory() {
83
- return __awaiter(this, void 0, void 0, function* () {
84
- while (!(yield fs_1.exists("package.json"))) {
85
- const tempDir = process.cwd();
86
- process.chdir("../");
87
- if (process.cwd() == tempDir) {
88
- this.error("Failed to find 'package.json' file. Is the current path a component?", { exit: 1 });
89
- }
90
- }
91
- if (!(yield fs_1.exists("./dist"))) {
92
- this.error("Failed to find 'dist' folder. Is the current path a component?", { exit: 1 });
93
- }
94
- process.chdir("./dist");
95
- });
96
- }
97
- loadEntrypoint() {
98
- return __awaiter(this, void 0, void 0, function* () {
99
- // If we don't have an index.js in cwd seek directories to find package.json of component
100
- if (!(yield fs_1.exists("index.js"))) {
101
- yield this.seekComponentPackageDistDirectory();
102
- }
103
- // If we still didn't find index.js error out
104
- if (!(yield fs_1.exists("index.js"))) {
105
- this.error("Failed to find 'index.js' entrypoint file. Is the current path a component?", { exit: 1 });
3
+ const core_1 = require("@oclif/core");
4
+ const publish_1 = require("../../utils/component/publish");
5
+ class PublishCommand extends core_1.Command {
6
+ async run() {
7
+ const { flags: { comment, confirm, "skip-upload": skipUpload, "skip-on-signature-match": skipOnSignatureMatch, }, } = await this.parse(PublishCommand);
8
+ const definition = await (0, publish_1.loadEntrypoint)();
9
+ await (0, publish_1.validateDefinition)(definition);
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);
106
18
  }
107
- // Require index.js and access its root-most default export which should be the Component config
108
- const cwd = process.cwd();
109
- const entrypointPath = path_1.resolve(cwd, "./index.js");
110
- const { default: definition, } = // eslint-disable-next-line @typescript-eslint/no-var-requires
111
- require(entrypointPath);
112
- return definition;
113
- });
114
- }
115
- checkSignature(key, packagePath, skipOnSignatureMatch) {
116
- return __awaiter(this, void 0, void 0, function* () {
117
- // Retrieve the existing signature of the component if it exists.
118
- const result = yield graphql_1.default.query({
119
- query: graphql_1.gql `
120
- query component($key: String!) {
121
- components(key: $key) {
122
- nodes {
123
- signature
124
- }
125
- }
126
19
  }
127
- `,
128
- variables: {
129
- key,
130
- },
131
- });
132
- const { data: { components: { nodes: [{ signature: existingSignature } = { signature: null }], }, }, } = result;
133
- // Generate the signature of the package so we may compare it against the existing one.
134
- const packageSignature = crypto_1.default
135
- .createHash("sha1")
136
- .update(yield fs_1.fs.readFile(packagePath))
137
- .digest("hex");
138
- if (existingSignature === packageSignature) {
139
- if (skipOnSignatureMatch ||
140
- !(yield cli_ux_1.default.confirm("The new package signature matches the existing package signature. Continue publishing new package? (y/N)"))) {
141
- // Signatures match and we've opted to skip on match, so bail.
142
- this.log("Package signatures match, skipping publish.");
143
- this.exit(0);
144
- }
145
- }
146
- });
147
- }
148
- confirmPublish(label, description, confirm) {
149
- return __awaiter(this, void 0, void 0, function* () {
150
- if (!confirm)
151
- return;
152
- this.log(label, "-", description);
153
- const continuePublish = yield cli_ux_1.default.confirm(`Would you like to publish ${label}? (y/N)`);
154
- if (!continuePublish)
155
- this.exit(0);
156
- });
157
- }
158
- publishDefinition(_a, comment) {
159
- var { actions, triggers, connections } = _a, componentDefinition = __rest(_a, ["actions", "triggers", "connections"]);
160
- return __awaiter(this, void 0, void 0, function* () {
161
- // FIXME: Ideally we should just pass the entire configuration blob but Graphene can't represent
162
- // a dictionary having arbitrary keys. For now, split actions and triggers out.
163
- const actionDefinitions = Object.values(actions || {}).map((action) => {
164
- return Object.assign(Object.assign({}, action), { examplePayload: (action === null || action === void 0 ? void 0 : action.examplePayload) ? JSON.stringify(action === null || action === void 0 ? void 0 : action.examplePayload)
165
- : JSON.stringify({}) });
166
- });
167
- const triggerDefinitions = Object.values(triggers || {}).map((trigger) => {
168
- return Object.assign(Object.assign({}, trigger), { examplePayload: (trigger === null || trigger === void 0 ? void 0 : trigger.examplePayload) ? JSON.stringify(trigger === null || trigger === void 0 ? void 0 : trigger.examplePayload)
169
- : JSON.stringify({}) });
170
- });
171
- const connectionDefinitions = connections || [];
172
- // Initiate start of the publish procedure by sending config data and receive back presigned s3 URL
173
- const result = yield graphql_1.default.mutate({
174
- mutation: graphql_1.gql `
175
- mutation publishComponent(
176
- $definition: ComponentDefinitionInput!
177
- $actions: [ActionDefinitionInput]!
178
- $triggers: [TriggerDefinitionInput]
179
- $connections: [ConnectionDefinitionInput]
180
- $comment: String
181
- ) {
182
- publishComponent(
183
- input: {
184
- definition: $definition
185
- actions: $actions
186
- triggers: $triggers
187
- connections: $connections
188
- comment: $comment
189
- }
190
- ) {
191
- publishResult {
192
- component {
193
- id
194
- versionNumber
195
- }
196
- iconUploadUrl
197
- packageUploadUrl
198
- connectionIconUploadUrls {
199
- connectionKey
200
- iconUploadUrl
201
- }
202
- }
203
- errors {
204
- field
205
- messages
206
- }
207
- }
20
+ await (0, publish_1.confirmPublish)(definition, confirm);
21
+ 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);
208
27
  }
209
- `,
210
- variables: {
211
- definition: componentDefinition,
212
- actions: actionDefinitions,
213
- triggers: triggerDefinitions,
214
- connections: connectionDefinitions,
215
- comment,
216
- },
217
- });
218
- const { iconUploadUrl, packageUploadUrl, connectionIconUploadUrls, component: { versionNumber }, } = result.data.publishComponent.publishResult;
219
- const uploadUrls = connectionIconUploadUrls.reduce((result, { connectionKey, iconUploadUrl }) => (Object.assign(Object.assign({}, result), { [connectionKey]: iconUploadUrl })), {});
220
- return {
221
- iconUploadUrl,
222
- packageUploadUrl,
223
- connectionIconUploadUrls: uploadUrls,
224
- versionNumber,
225
- };
226
- });
227
- }
228
- createPackage() {
229
- return __awaiter(this, void 0, void 0, function* () {
230
- const zip = archiver_1.default("zip", { zlib: { level: 9 } });
231
- const pathPromise = tempy_1.default.write(zip, { extension: "zip" });
232
- // Zip all files in the current directory (since we found the index.js entrypoint)
233
- zip.directory(process.cwd(), false);
234
- yield zip.finalize();
235
- return pathPromise;
236
- });
237
- }
238
- uploadPackage(path, url) {
239
- return __awaiter(this, void 0, void 0, function* () {
240
- // HACK: We read the entire file into a buffer and then upload it to workaround
241
- // a deficiency in LocalStack's S3 implementation. This will be changed to a streamed
242
- // upload once we're on AWS proper.
243
- return axios_1.default.put(url, yield fs_1.fs.readFile(path), {
244
- headers: {
245
- "Content-Type": "application/zip",
246
- },
247
- });
248
- });
249
- }
250
- uploadIcon(path, url) {
251
- return __awaiter(this, void 0, void 0, function* () {
252
- return axios_1.default.put(url, yield fs_1.fs.readFile(path), {
253
- headers: {
254
- "Content-Type": mime_types_1.default.contentType(path),
255
- },
256
- });
257
- });
258
- }
259
- uploadConnectionIcons(connections, connectionIconUploadUrls) {
260
- return __awaiter(this, void 0, void 0, function* () {
261
- if (!connections || !connections.length) {
262
- return;
263
- }
264
- const iconPaths = connections.reduce((result, { key, iconPath }) => {
265
- if (!iconPath) {
266
- return result;
267
- }
268
- return Object.assign(Object.assign({}, result), { [key]: iconPath });
269
- }, {});
270
- const promises = Object.entries(connectionIconUploadUrls).map(([connectionKey, uploadUrl]) => __awaiter(this, void 0, void 0, function* () {
271
- const iconPath = iconPaths[connectionKey];
272
- return axios_1.default.put(uploadUrl, yield fs_1.fs.readFile(iconPath), {
273
- headers: {
274
- "Content-Type": mime_types_1.default.contentType(iconPath),
275
- },
276
- });
277
- }));
278
- yield Promise.all(promises);
279
- });
28
+ const { display: { label }, } = definition;
29
+ // Tell user that their publish was successful and can use components list to view status
30
+ this.log(`Successfully submitted ${label} (v${versionNumber})! The publish should finish processing shortly.`);
280
31
  }
281
32
  }
282
33
  exports.default = PublishCommand;
283
34
  PublishCommand.description = "Publish a Component to Prismatic";
284
35
  PublishCommand.flags = {
285
- comment: command_1.flags.string({
36
+ comment: core_1.Flags.string({
286
37
  required: false,
287
38
  char: "c",
288
39
  description: "Comment about changes in this Publish",
289
40
  }),
290
- confirm: command_1.flags.boolean({
41
+ confirm: core_1.Flags.boolean({
291
42
  allowNo: true,
292
43
  default: true,
293
44
  description: "Interactively confirm publish",
294
45
  }),
295
- "skip-upload": command_1.flags.boolean({
46
+ "skip-upload": core_1.Flags.boolean({
296
47
  description: "Skip upload of Component package",
297
48
  required: false,
298
49
  }),
299
- "skip-on-signature-match": command_1.flags.boolean({
50
+ "skip-on-signature-match": core_1.Flags.boolean({
300
51
  required: false,
301
52
  description: "Skips component publish if the new signature matches the existing signature",
302
53
  }),
303
54
  };
304
- //# sourceMappingURL=publish.js.map
@@ -1,42 +1,12 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
- Object.defineProperty(o, "default", { enumerable: true, value: v });
11
- }) : function(o, v) {
12
- o["default"] = v;
13
- });
14
- var __importStar = (this && this.__importStar) || function (mod) {
15
- if (mod && mod.__esModule) return mod;
16
- var result = {};
17
- if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
- __setModuleDefault(result, mod);
19
- return result;
20
- };
21
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
22
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
23
- return new (P || (P = Promise))(function (resolve, reject) {
24
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
25
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
26
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
27
- step((generator = generator.apply(thisArg, _arguments || [])).next());
28
- });
29
- };
30
2
  Object.defineProperty(exports, "__esModule", { value: true });
31
- const command_1 = require("@oclif/command");
32
- const graphql_1 = __importStar(require("../../../graphql"));
33
- const cli_ux_1 = require("cli-ux");
34
- class ListCommand extends command_1.Command {
35
- run() {
36
- return __awaiter(this, void 0, void 0, function* () {
37
- const { flags } = this.parse(ListCommand);
38
- const result = yield graphql_1.default.query({
39
- query: graphql_1.gql `
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) `
40
10
  query listComponentTriggers {
41
11
  components {
42
12
  nodes {
@@ -56,32 +26,30 @@ class ListCommand extends command_1.Command {
56
26
  }
57
27
  }
58
28
  `,
59
- });
60
- const actions = result.data.components.nodes.flatMap(({ actions }) => actions.nodes);
61
- cli_ux_1.cli.table(actions, {
62
- id: {
63
- minWidth: 8,
64
- extended: true,
65
- },
66
- key: {
67
- minWidth: 10,
68
- extended: true,
69
- },
70
- label: {},
71
- description: {},
72
- componentid: {
73
- get: ({ component: { id } }) => id,
74
- extended: true,
75
- },
76
- componentkey: {
77
- get: ({ component: { key } }) => key,
78
- extended: true,
79
- },
80
- }, Object.assign({}, flags));
81
29
  });
30
+ const actions = result.components.nodes.flatMap(({ actions }) => actions.nodes);
31
+ core_1.CliUx.ux.table(actions, {
32
+ id: {
33
+ minWidth: 8,
34
+ extended: true,
35
+ },
36
+ key: {
37
+ minWidth: 10,
38
+ extended: true,
39
+ },
40
+ label: {},
41
+ description: {},
42
+ componentid: {
43
+ get: ({ component: { id } }) => id,
44
+ extended: true,
45
+ },
46
+ componentkey: {
47
+ get: ({ component: { key } }) => key,
48
+ extended: true,
49
+ },
50
+ }, { ...flags });
82
51
  }
83
52
  }
84
53
  exports.default = ListCommand;
85
54
  ListCommand.description = "List Triggers that Components implement";
86
- ListCommand.flags = Object.assign({}, cli_ux_1.cli.table.flags());
87
- //# sourceMappingURL=list.js.map
55
+ ListCommand.flags = { ...core_1.CliUx.ux.table.flags() };
@@ -1,41 +1,12 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
- Object.defineProperty(o, "default", { enumerable: true, value: v });
11
- }) : function(o, v) {
12
- o["default"] = v;
13
- });
14
- var __importStar = (this && this.__importStar) || function (mod) {
15
- if (mod && mod.__esModule) return mod;
16
- var result = {};
17
- if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
- __setModuleDefault(result, mod);
19
- return result;
20
- };
21
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
22
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
23
- return new (P || (P = Promise))(function (resolve, reject) {
24
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
25
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
26
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
27
- step((generator = generator.apply(thisArg, _arguments || [])).next());
28
- });
29
- };
30
2
  Object.defineProperty(exports, "__esModule", { value: true });
31
- const command_1 = require("@oclif/command");
32
- const graphql_1 = __importStar(require("../../graphql"));
33
- class CreateCommand extends command_1.Command {
34
- run() {
35
- return __awaiter(this, void 0, void 0, function* () {
36
- const { flags: { name, description }, } = this.parse(CreateCommand);
37
- const result = yield graphql_1.default.mutate({
38
- mutation: graphql_1.gql `
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 }, } = await this.parse(CreateCommand);
8
+ const result = await (0, graphql_1.gqlRequest)({
9
+ document: (0, graphql_1.gql) `
39
10
  mutation createCustomer($name: String!, $description: String) {
40
11
  createCustomer(input: { name: $name, description: $description }) {
41
12
  customer {
@@ -48,27 +19,25 @@ class CreateCommand extends command_1.Command {
48
19
  }
49
20
  }
50
21
  `,
51
- variables: {
52
- name,
53
- description,
54
- },
55
- });
56
- this.log(result.data.createCustomer.customer.id);
22
+ variables: {
23
+ name,
24
+ description,
25
+ },
57
26
  });
27
+ this.log(result.createCustomer.customer.id);
58
28
  }
59
29
  }
60
30
  exports.default = CreateCommand;
61
31
  CreateCommand.description = "Create a new Customer";
62
32
  CreateCommand.flags = {
63
- name: command_1.flags.string({
33
+ name: core_1.Flags.string({
64
34
  char: "n",
65
35
  required: true,
66
36
  description: "short name of the new customer",
67
37
  }),
68
- description: command_1.flags.string({
38
+ description: core_1.Flags.string({
69
39
  char: "d",
70
40
  description: "longer description of the customer",
71
41
  required: false,
72
42
  }),
73
43
  };
74
- //# sourceMappingURL=create.js.map
@@ -1,43 +1,14 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
- Object.defineProperty(o, "default", { enumerable: true, value: v });
11
- }) : function(o, v) {
12
- o["default"] = v;
13
- });
14
- var __importStar = (this && this.__importStar) || function (mod) {
15
- if (mod && mod.__esModule) return mod;
16
- var result = {};
17
- if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
- __setModuleDefault(result, mod);
19
- return result;
20
- };
21
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
22
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
23
- return new (P || (P = Promise))(function (resolve, reject) {
24
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
25
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
26
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
27
- step((generator = generator.apply(thisArg, _arguments || [])).next());
28
- });
29
- };
30
2
  Object.defineProperty(exports, "__esModule", { value: true });
31
- const command_1 = require("@oclif/command");
3
+ const core_1 = require("@oclif/core");
32
4
  const fields_1 = require("../../../fields");
33
- const graphql_1 = __importStar(require("../../../graphql"));
34
- class CreateCommand extends command_1.Command {
35
- run() {
36
- return __awaiter(this, void 0, void 0, function* () {
37
- const { flags: { label, "authorization-method": authorizationMethod, fields, customer, }, } = this.parse(CreateCommand);
38
- const values = fields_1.toValues(fields);
39
- const result = yield graphql_1.default.mutate({
40
- mutation: graphql_1.gql `
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) `
41
12
  mutation createCustomerCredential(
42
13
  $customer: ID!
43
14
  $label: String!
@@ -62,38 +33,36 @@ class CreateCommand extends command_1.Command {
62
33
  }
63
34
  }
64
35
  `,
65
- variables: {
66
- customer,
67
- label,
68
- authorizationMethod,
69
- values,
70
- },
71
- });
72
- this.log(result.data.createCustomerCredential.credential.id);
36
+ variables: {
37
+ customer,
38
+ label,
39
+ authorizationMethod,
40
+ values,
41
+ },
73
42
  });
43
+ this.log(result.createCustomerCredential.credential.id);
74
44
  }
75
45
  }
76
46
  exports.default = CreateCommand;
77
47
  CreateCommand.description = "Create a set of Customer-specific Credentials for use by Instance Actions";
78
48
  CreateCommand.flags = {
79
- customer: command_1.flags.string({
49
+ customer: core_1.Flags.string({
80
50
  char: "c",
81
51
  required: true,
82
52
  description: "ID of the customer",
83
53
  }),
84
- label: command_1.flags.string({
54
+ label: core_1.Flags.string({
85
55
  char: "l",
86
56
  required: true,
87
57
  description: "name to give the new credentials",
88
58
  }),
89
- "authorization-method": command_1.flags.string({
59
+ "authorization-method": core_1.Flags.string({
90
60
  char: "a",
91
61
  required: true,
92
62
  description: "ID of the authorization method",
93
63
  }),
94
- fields: command_1.flags.string({
64
+ fields: core_1.Flags.string({
95
65
  char: "f",
96
66
  description: "username, password, etc., in JSON format",
97
67
  }),
98
68
  };
99
- //# sourceMappingURL=create.js.map