@prismatic-io/spectral 7.6.0 → 7.6.2

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.
@@ -69,6 +69,15 @@ export declare const buildRawRequestAction: (baseUrl: string, label?: string, de
69
69
  comments: string;
70
70
  example: string;
71
71
  };
72
+ fileDataFileNames: {
73
+ label: string;
74
+ placeholder: string;
75
+ type: "string";
76
+ collection: "keyvaluelist";
77
+ required: false;
78
+ comments: string;
79
+ clean: (values: any) => Record<string, string> | undefined;
80
+ };
72
81
  queryParams: {
73
82
  label: string;
74
83
  placeholder: string;
@@ -73,11 +73,11 @@ const toAuthorizationHeaders = (connection) => {
73
73
  }
74
74
  throw new Error(`Failed to guess at authorization parameters for Connection: ${connection.key}`);
75
75
  };
76
- const toFormData = (formData, fileData) => {
76
+ const toFormData = (formData, fileData, fileDataFileNames = {}) => {
77
77
  const form = new form_data_1.default();
78
78
  (formData || []).map(({ key, value }) => form.append(key, value));
79
79
  (fileData || []).map(({ key, value }) => form.append(key, util_1.default.types.toBufferDataPayload(value).data, {
80
- filename: key,
80
+ filename: (fileDataFileNames === null || fileDataFileNames === void 0 ? void 0 : fileDataFileNames[key]) || key,
81
81
  }));
82
82
  return form;
83
83
  };
@@ -134,7 +134,7 @@ const sendRawRequest = (baseUrl, values, authorizationHeaders = {}) => __awaiter
134
134
  throw new Error("Cannot specify both Data and File/Form Data.");
135
135
  }
136
136
  const payload = !(0, lodash_1.isEmpty)(values.formData) || !(0, lodash_1.isEmpty)(values.fileData)
137
- ? toFormData(values.formData, values.fileData)
137
+ ? toFormData(values.formData, values.fileData, values.fileDataFileNames)
138
138
  : values.data;
139
139
  const client = (0, exports.createClient)({
140
140
  baseUrl,
@@ -117,6 +117,15 @@ export declare const fileData: {
117
117
  comments: string;
118
118
  example: string;
119
119
  };
120
+ export declare const fileDataFileNames: {
121
+ label: string;
122
+ placeholder: string;
123
+ type: "string";
124
+ collection: "keyvaluelist";
125
+ required: false;
126
+ comments: string;
127
+ clean: (values: any) => Record<string, string> | undefined;
128
+ };
120
129
  export declare const debugRequest: {
121
130
  label: string;
122
131
  type: "boolean";
@@ -171,6 +180,15 @@ export declare const inputs: {
171
180
  comments: string;
172
181
  example: string;
173
182
  };
183
+ fileDataFileNames: {
184
+ label: string;
185
+ placeholder: string;
186
+ type: "string";
187
+ collection: "keyvaluelist";
188
+ required: false;
189
+ comments: string;
190
+ clean: (values: any) => Record<string, string> | undefined;
191
+ };
174
192
  queryParams: {
175
193
  label: string;
176
194
  placeholder: string;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.inputs = exports.debugRequest = exports.fileData = exports.formData = exports.retryAllErrors = exports.useExponentialBackoff = exports.retryDelayMS = exports.maxRetries = exports.queryParams = exports.headers = exports.responseType = exports.method = exports.timeout = exports.data = exports.url = void 0;
3
+ exports.inputs = exports.debugRequest = exports.fileDataFileNames = exports.fileData = exports.formData = exports.retryAllErrors = exports.useExponentialBackoff = exports.retryDelayMS = exports.maxRetries = exports.queryParams = exports.headers = exports.responseType = exports.method = exports.timeout = exports.data = exports.url = void 0;
4
4
  const __1 = require("../..");
5
5
  const supportedMethods = [
6
6
  "DELETE",
@@ -135,6 +135,15 @@ exports.fileData = (0, __1.input)({
135
135
  comments: "File Data to be sent as a multipart form upload.",
136
136
  example: `[{key: "example.txt", value: "My File Contents"}]`,
137
137
  });
138
+ exports.fileDataFileNames = (0, __1.input)({
139
+ label: "File Data File Names",
140
+ placeholder: "The file name to apply to a file",
141
+ type: "string",
142
+ collection: "keyvaluelist",
143
+ required: false,
144
+ comments: "File names to apply to the file data inputs. Keys must match the file data keys above.",
145
+ clean: (values) => values ? __1.util.types.keyValPairListToObject(values) : undefined,
146
+ });
138
147
  exports.debugRequest = (0, __1.input)({
139
148
  label: "Debug Request",
140
149
  type: "boolean",
@@ -148,6 +157,7 @@ exports.inputs = {
148
157
  data: exports.data,
149
158
  formData: exports.formData,
150
159
  fileData: exports.fileData,
160
+ fileDataFileNames: exports.fileDataFileNames,
151
161
  queryParams: exports.queryParams,
152
162
  headers: exports.headers,
153
163
  responseType: exports.responseType,
@@ -3,6 +3,10 @@ export declare enum OAuth2Type {
3
3
  ClientCredentials = "client_credentials",
4
4
  AuthorizationCode = "authorization_code"
5
5
  }
6
+ export declare enum OAuth2PkceMethod {
7
+ Plain = "plain",
8
+ S256 = "S256"
9
+ }
6
10
  interface BaseConnectionDefinition {
7
11
  key: string;
8
12
  label: string;
@@ -17,6 +21,8 @@ export interface DefaultConnectionDefinition extends BaseConnectionDefinition {
17
21
  }
18
22
  interface OAuth2AuthorizationCodeConnectionDefinition extends BaseConnectionDefinition {
19
23
  oauth2Type: OAuth2Type.AuthorizationCode;
24
+ /** The PKCE method (S256 or plain) that this OAuth 2.0 connection uses (if any) */
25
+ oauth2PkceMethod?: OAuth2PkceMethod;
20
26
  inputs: {
21
27
  authorizeUrl: ConnectionInput;
22
28
  tokenUrl: ConnectionInput;
@@ -1,8 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.OAuth2Type = void 0;
3
+ exports.OAuth2PkceMethod = exports.OAuth2Type = void 0;
4
4
  var OAuth2Type;
5
5
  (function (OAuth2Type) {
6
6
  OAuth2Type["ClientCredentials"] = "client_credentials";
7
7
  OAuth2Type["AuthorizationCode"] = "authorization_code";
8
8
  })(OAuth2Type = exports.OAuth2Type || (exports.OAuth2Type = {}));
9
+ var OAuth2PkceMethod;
10
+ (function (OAuth2PkceMethod) {
11
+ OAuth2PkceMethod["Plain"] = "plain";
12
+ OAuth2PkceMethod["S256"] = "S256";
13
+ })(OAuth2PkceMethod = exports.OAuth2PkceMethod || (exports.OAuth2PkceMethod = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prismatic-io/spectral",
3
- "version": "7.6.0",
3
+ "version": "7.6.2",
4
4
  "description": "Utility library for building Prismatic components",
5
5
  "keywords": [
6
6
  "prismatic"