@prismatic-io/spectral 7.0.5-pre → 7.0.8-pre
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.
|
@@ -14,4 +14,6 @@ export interface DataSourceDefinition<TInputs extends Inputs, TDataSourceResult
|
|
|
14
14
|
inputs: TInputs;
|
|
15
15
|
/** An example of the payload outputted by this Data Source. */
|
|
16
16
|
examplePayload?: Awaited<ReturnType<this["perform"]>>;
|
|
17
|
+
/** Specifies the name of a Data Source in this Component which can provide additional details about the content for this Data Source, such as example values when selecting particular API object fields. */
|
|
18
|
+
detailDataSource?: string;
|
|
17
19
|
}
|
|
@@ -8,7 +8,9 @@ export declare type DataSourceResultType = ObjectSelection | ObjectFieldMap | JS
|
|
|
8
8
|
export declare type DataSourceResult<TDataSourceResultType> = {
|
|
9
9
|
/** The resulting data that is returned from the data source. */
|
|
10
10
|
result: TDataSourceResultType;
|
|
11
|
-
/** Additional data that may be useful for out-of-band processing at a later time.
|
|
11
|
+
/** Additional data that may be useful for out-of-band processing at a later time.
|
|
12
|
+
* NOTE: This is only available when the Data Source is called as part of fetching
|
|
13
|
+
* contents for a Configuration Wizard Page. */
|
|
12
14
|
supplementalData?: {
|
|
13
15
|
data: unknown;
|
|
14
16
|
contentType: string;
|
package/dist/types/Inputs.d.ts
CHANGED
|
@@ -19,9 +19,7 @@ export declare type ObjectFieldMap = {
|
|
|
19
19
|
};
|
|
20
20
|
defaultValue?: {
|
|
21
21
|
objectKey: string;
|
|
22
|
-
objectLabel?: string;
|
|
23
22
|
fieldKey: string;
|
|
24
|
-
fieldLabel?: string;
|
|
25
23
|
};
|
|
26
24
|
}[];
|
|
27
25
|
export declare type JSONForm = {
|
|
@@ -165,7 +163,7 @@ export interface Connection {
|
|
|
165
163
|
/** Defines attributes of an ObjectSelectionInputField. */
|
|
166
164
|
export interface ObjectSelectionInputField extends BaseInputField {
|
|
167
165
|
/** Data type the InputField will collect. */
|
|
168
|
-
type: "
|
|
166
|
+
type: "objectSelection";
|
|
169
167
|
/** Collection type of the InputField */
|
|
170
168
|
collection?: InputFieldCollection;
|
|
171
169
|
/** Default value for this field. */
|
|
@@ -176,7 +174,7 @@ export interface ObjectSelectionInputField extends BaseInputField {
|
|
|
176
174
|
/** Defines attributes of an ObjectFieldMapInputField. */
|
|
177
175
|
export interface ObjectFieldMapInputField extends BaseInputField {
|
|
178
176
|
/** Data type the InputField will collect. */
|
|
179
|
-
type: "
|
|
177
|
+
type: "objectFieldMap";
|
|
180
178
|
/** Collection type of the InputField */
|
|
181
179
|
collection?: InputFieldCollection;
|
|
182
180
|
/** Default value for this field. */
|
|
@@ -184,10 +182,10 @@ export interface ObjectFieldMapInputField extends BaseInputField {
|
|
|
184
182
|
/** Clean function */
|
|
185
183
|
clean?: InputCleanFunction<NonNullable<this["default"]>>;
|
|
186
184
|
}
|
|
187
|
-
/** Defines attributes of a
|
|
185
|
+
/** Defines attributes of a JSONFormInputField. */
|
|
188
186
|
export interface JSONFormInputField extends BaseInputField {
|
|
189
187
|
/** Data type the InputField will collect. */
|
|
190
|
-
type: "
|
|
188
|
+
type: "jsonForm";
|
|
191
189
|
/** Collection type of the InputField */
|
|
192
190
|
collection?: InputFieldCollection;
|
|
193
191
|
/** Default value for this field. */
|
package/dist/types/Inputs.js
CHANGED
|
@@ -10,7 +10,7 @@ exports.InputFieldDefaultMap = {
|
|
|
10
10
|
code: "",
|
|
11
11
|
conditional: undefined,
|
|
12
12
|
connection: undefined,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
objectSelection: undefined,
|
|
14
|
+
objectFieldMap: undefined,
|
|
15
|
+
jsonForm: undefined,
|
|
16
16
|
};
|
package/dist/util.d.ts
CHANGED
|
@@ -31,6 +31,7 @@ declare const _default: {
|
|
|
31
31
|
toBufferDataPayload: (value: unknown) => DataPayload;
|
|
32
32
|
isData: (value: unknown) => boolean;
|
|
33
33
|
toData: (value: unknown) => DataPayload;
|
|
34
|
+
isString: (value: unknown) => value is string;
|
|
34
35
|
toString: (value: unknown, defaultValue?: string) => string;
|
|
35
36
|
keyValPairListToObject: <TValue = unknown>(kvpList: KeyValuePair<unknown>[], valueConverter?: ((value: unknown) => TValue) | undefined) => Record<string, TValue>;
|
|
36
37
|
isJSON: (value: string) => boolean;
|
|
@@ -42,6 +43,8 @@ declare const _default: {
|
|
|
42
43
|
toObjectFieldMap: (value: unknown) => ObjectFieldMap;
|
|
43
44
|
isJSONForm: (value: unknown) => value is JSONForm;
|
|
44
45
|
toJSONForm: (value: unknown) => JSONForm;
|
|
46
|
+
isPicklist: (value: unknown) => boolean;
|
|
47
|
+
isSchedule: (value: unknown) => boolean;
|
|
45
48
|
};
|
|
46
49
|
docs: {
|
|
47
50
|
formatJsonExample: (input: unknown) => string;
|
package/dist/util.js
CHANGED
|
@@ -280,6 +280,25 @@ const toDate = (value) => {
|
|
|
280
280
|
* @returns This function returns true if `value` is a valid URL, and false otherwise.
|
|
281
281
|
*/
|
|
282
282
|
const isUrl = (value) => (0, valid_url_1.isWebUri)(value) !== undefined;
|
|
283
|
+
/**
|
|
284
|
+
* This function checks if value is a valid picklist.
|
|
285
|
+
*
|
|
286
|
+
* - `util.types.isPicklist(["value", new String("value")])` will return `true`.
|
|
287
|
+
*
|
|
288
|
+
* @param value The variable to test.
|
|
289
|
+
* @returns This function returns true if `value` is a valid picklist.
|
|
290
|
+
*/
|
|
291
|
+
const isPicklist = (value) => Array.isArray(value) && value.every(isString);
|
|
292
|
+
/**
|
|
293
|
+
* This function checks if value is a valid schedule.
|
|
294
|
+
*
|
|
295
|
+
* - `util.types.isSchedule({value: "00 00 * * 2,3"})` will return `true`.
|
|
296
|
+
* - `util.types.isSchedule({value: "00 00 * * 2,3", scheduleType: "week", timeZone: "America/Chicago"})` will return `true`.
|
|
297
|
+
*
|
|
298
|
+
* @param value The variable to test.
|
|
299
|
+
* @returns This function returns true if `value` is a valid schedule.
|
|
300
|
+
*/
|
|
301
|
+
const isSchedule = (value) => isObjectWithTruthyKeys(value, ["value"]);
|
|
283
302
|
/**
|
|
284
303
|
* This function helps to transform key-value lists to objects.
|
|
285
304
|
* This is useful for transforming inputs that are key-value collections into objects.
|
|
@@ -373,6 +392,13 @@ const toData = (value) => toBufferDataPayload(value);
|
|
|
373
392
|
* @returns This function returns a code block that can be used for documentation.
|
|
374
393
|
*/
|
|
375
394
|
const formatJsonExample = (input) => ["```json", JSON.stringify(input, undefined, 2), "```"].join("\n");
|
|
395
|
+
/**
|
|
396
|
+
* This function checks if value is a string.
|
|
397
|
+
* `util.types.isString("value")` and `util.types.isString(new String("value"))` return true.
|
|
398
|
+
* @param value The variable to test.
|
|
399
|
+
* @returns This function returns true or false, depending on if `value` is a string.
|
|
400
|
+
*/
|
|
401
|
+
const isString = (value) => typeof value === "string" || value instanceof String;
|
|
376
402
|
/**
|
|
377
403
|
* This function converts a `value` to a string.
|
|
378
404
|
* If `value` is undefined or an empty string, an optional `defaultValue` can be returned.
|
|
@@ -445,6 +471,7 @@ exports.default = {
|
|
|
445
471
|
toBufferDataPayload,
|
|
446
472
|
isData,
|
|
447
473
|
toData,
|
|
474
|
+
isString,
|
|
448
475
|
toString,
|
|
449
476
|
keyValPairListToObject,
|
|
450
477
|
isJSON,
|
|
@@ -456,6 +483,8 @@ exports.default = {
|
|
|
456
483
|
toObjectFieldMap,
|
|
457
484
|
isJSONForm,
|
|
458
485
|
toJSONForm,
|
|
486
|
+
isPicklist,
|
|
487
|
+
isSchedule,
|
|
459
488
|
},
|
|
460
489
|
docs: {
|
|
461
490
|
formatJsonExample,
|