@prismatic-io/prism 4.1.1 → 4.2.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.
@@ -3,9 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.appendRequiredFields = exports.addRequiredInputs = exports.createDescription = void 0;
6
+ exports.createDescription = void 0;
7
7
  const striptags_1 = __importDefault(require("striptags"));
8
- const ts_morph_1 = require("ts-morph");
9
8
  const createDescription = (text) => {
10
9
  if (!text) {
11
10
  return "";
@@ -16,106 +15,3 @@ const createDescription = (text) => {
16
15
  return fragment.replace(/`/g, "'");
17
16
  };
18
17
  exports.createDescription = createDescription;
19
- const addProperty = (inputsFile, inputName, propertyList) => {
20
- const placeholder = inputsFile.addVariableStatement({
21
- declarationKind: ts_morph_1.VariableDeclarationKind.Const,
22
- declarations: [
23
- { name: "genericActionInput", initializer: ts_morph_1.Writers.object({}) },
24
- ],
25
- });
26
- const object = placeholder.getDeclarations()[0].getInitializer();
27
- object.addPropertyAssignments(propertyList);
28
- inputsFile.addVariableStatement({
29
- declarationKind: ts_morph_1.VariableDeclarationKind.Const,
30
- isExported: true,
31
- declarations: [
32
- { name: inputName, initializer: `input(${object.print()})` },
33
- ],
34
- });
35
- placeholder.remove();
36
- };
37
- const addRequiredInputs = (projectType, inputsFile, addRetry) => {
38
- addProperty(inputsFile, "apiBaseUrl", [
39
- { name: `"label"`, initializer: `"API Base URL"` },
40
- { name: `"type"`, initializer: `"string"` },
41
- { name: `"required"`, initializer: `false` },
42
- {
43
- name: `"comments"`,
44
- initializer: `"An optional url you can specify to override the default provided by the OpenAPI spec."`,
45
- },
46
- ]);
47
- addProperty(inputsFile, "debugRequest", [
48
- { name: `"label"`, initializer: `"Debug Request"` },
49
- { name: `"type"`, initializer: `"boolean"` },
50
- { name: `"required"`, initializer: `false` },
51
- {
52
- name: `"comments"`,
53
- initializer: `"An optional boolean you can toggle to log the contents of the HTTP request for each action."`,
54
- },
55
- ]);
56
- addProperty(inputsFile, "timeout", [
57
- { name: `"label"`, initializer: `"Timeout"` },
58
- { name: `"type"`, initializer: `"string"` },
59
- { name: `"required"`, initializer: `false` },
60
- {
61
- name: `"comments"`,
62
- initializer: `"An optional input that indicates how long the client will await a response."`,
63
- },
64
- ]);
65
- if (addRetry) {
66
- addProperty(inputsFile, "maxRetries", [
67
- { name: `"label"`, initializer: `"Max Retries"` },
68
- { name: `"type"`, initializer: `"string"` },
69
- { name: `"required"`, initializer: `false` },
70
- {
71
- name: `"comments"`,
72
- initializer: `"An optional input that indicates how many times this client will retry the request."`,
73
- },
74
- ]);
75
- addProperty(inputsFile, "retryDelayMS", [
76
- { name: `"label"`, initializer: `"Retry Delay (MS)"` },
77
- { name: `"type"`, initializer: `"string"` },
78
- { name: `"required"`, initializer: `false` },
79
- {
80
- name: `"comments"`,
81
- initializer: `"An optional input that indicates a delay between retries."`,
82
- },
83
- ]);
84
- addProperty(inputsFile, "retryOnAllErrors", [
85
- { name: `"label"`, initializer: `"Retry On All Errors"` },
86
- { name: `"type"`, initializer: `"boolean"` },
87
- { name: `"required"`, initializer: `false` },
88
- {
89
- name: `"comments"`,
90
- initializer: `"An optional boolean that will have the client retry the request, regardless of what type of error is thrown."`,
91
- },
92
- ]);
93
- addProperty(inputsFile, "useExponentialBackoff", [
94
- { name: `"label"`, initializer: `"Use Exponential Backoff"` },
95
- { name: `"type"`, initializer: `"boolean"` },
96
- { name: `"required"`, initializer: `false` },
97
- {
98
- name: `"comments"`,
99
- initializer: `"An optional boolean that will enable exponential backoff on retry."`,
100
- },
101
- ]);
102
- }
103
- return inputsFile;
104
- };
105
- exports.addRequiredInputs = addRequiredInputs;
106
- const appendRequiredFields = ({ inputFields, addRetry, includeClient, }) => {
107
- if (!includeClient) {
108
- return inputFields;
109
- }
110
- const base = [...inputFields, "apiBaseUrl", "debugRequest", "timeout"];
111
- return addRetry
112
- ? [
113
- ...base,
114
- "maxRetries",
115
- "retryDelayMS",
116
- "retryOnAllErrors",
117
- "useExponentialBackoff",
118
- ]
119
- : base;
120
- };
121
- exports.appendRequiredFields = appendRequiredFields;
package/lib/yeoman.js CHANGED
@@ -11,6 +11,7 @@ const generatorTypes = [
11
11
  "action",
12
12
  "trigger",
13
13
  "connection",
14
+ "formats",
14
15
  ];
15
16
  const runGenerator = async (generatorName, options) => {
16
17
  if (!generatorTypes.includes(generatorName)) {