@prismatic-io/spectral
Advanced tools
Comparing version 8.1.6 to 8.1.7
@@ -96,3 +96,11 @@ "use strict"; | ||
if ("value" in value) { | ||
return Object.assign(Object.assign({}, result), { [key]: { type: "value", value: value.value } }); | ||
const type = value.value instanceof Object ? "complex" : "value"; | ||
const valueExpr = value.value instanceof Object && !Array.isArray(value.value) | ||
? Object.entries(value.value).map(([k, v]) => ({ | ||
name: { type: "value", value: k }, | ||
type: "value", | ||
value: v, | ||
})) | ||
: value.value; | ||
return Object.assign(Object.assign({}, result), { [key]: { type: type, value: valueExpr } }); | ||
} | ||
@@ -189,8 +197,7 @@ if ("configVar" in value) { | ||
} | ||
const value = input.default | ||
? input.default | ||
: input.collection | ||
? [] | ||
: ""; | ||
return Object.assign(Object.assign({}, result), { [key]: { type: "value", value } }); | ||
const defaultValue = input.collection ? [] : ""; | ||
return Object.assign(Object.assign({}, result), { [key]: { | ||
type: input.collection ? "complex" : "value", | ||
value: input.default || defaultValue, | ||
} }); | ||
}, {}), meta }); | ||
@@ -197,0 +204,0 @@ } |
@@ -12,3 +12,3 @@ export declare const DefinitionVersion = 7; | ||
export declare type Input = { | ||
name?: string; | ||
name?: string | Input; | ||
type: "value" | "reference" | "configVar" | "template"; | ||
@@ -18,3 +18,3 @@ value: string; | ||
} | { | ||
name?: string; | ||
name?: string | Input; | ||
type: "complex"; | ||
@@ -21,0 +21,0 @@ value: string | Input; |
@@ -19,2 +19,3 @@ import { ObjectSelection, ObjectFieldMap, JSONForm, Element } from "./Inputs"; | ||
export declare type DataSourceType = keyof DataSourceTypeMap; | ||
export declare type CollectionDataSourceType = Exclude<DataSourceType, "objectSelection" | "objectFieldMap" | "jsonForm">; | ||
export declare type DataSourceResultType = DataSourceTypeMap[DataSourceType]; | ||
@@ -21,0 +22,0 @@ /** Represents the result of a Data Source action. */ |
@@ -1,2 +0,2 @@ | ||
import { DataSourceDefinition, ConnectionDefinition, ActionPerformFunction, ActionPerformReturn, TriggerEventFunction, TriggerPerformFunction, Inputs, TriggerResult, DataSourceType, TriggerPayload, Connection, JSONForm, ObjectFieldMap, ObjectSelection, ConfigVarResultCollection, Schedule } from "."; | ||
import { DataSourceDefinition, ConnectionDefinition, ActionPerformFunction, ActionPerformReturn, TriggerEventFunction, TriggerPerformFunction, Inputs, TriggerResult, DataSourceType, TriggerPayload, Connection, JSONForm, ObjectFieldMap, ObjectSelection, ConfigVarResultCollection, Schedule, CollectionDataSourceType } from "."; | ||
import { Prettify, UnionToIntersection, ValueOf } from "./utils"; | ||
@@ -90,2 +90,8 @@ export declare type ToDataSourceRuntimeType<TType extends DataSourceType> = TType extends "jsonForm" ? JSONForm : TType extends "objectSelection" ? ObjectSelection : TType extends "objectFieldMap" ? ObjectFieldMap : string; | ||
visibleToCustomerDeployer?: boolean; | ||
/** Optional default value for the Config Var. */ | ||
defaultValue?: string; | ||
/** Optional list of picklist values if the Config Var is a multi-choice selection value. */ | ||
pickList?: string[]; | ||
/** Optional value to specify the type of collection if the Config Var is multi-value. */ | ||
collectionType?: CollectionType; | ||
}; | ||
@@ -95,13 +101,13 @@ /** Defines attributes of a standard Config Var. */ | ||
/** The data type of the Config Var. */ | ||
dataType: Exclude<ConfigVarDataType, "schedule">; | ||
dataType: Exclude<ConfigVarDataType, "schedule" | "code">; | ||
}; | ||
export declare type CodeConfigVar = BaseConfigVar & { | ||
/** The data type of the Config Var. */ | ||
dataType: "code"; | ||
/** Optional default value for the Config Var. */ | ||
defaultValue?: string; | ||
/** Optional list of picklist values if the Config Var is a multi-choice selection value. */ | ||
pickList?: string[]; | ||
/** Optional value to specify the type of language if the Config Var is a code value. */ | ||
codeLanguage?: CodeLanguageType; | ||
/** Optional value to specify the type of collection if the Config Var is multi-value. */ | ||
collectionType?: CollectionType; | ||
}; | ||
export declare type ScheduleConfigVar = BaseConfigVar & { | ||
export declare type ScheduleConfigVar = Omit<BaseConfigVar, "collectionType"> & { | ||
/** The data type of the Config Var. */ | ||
@@ -114,5 +120,9 @@ dataType: "schedule"; | ||
}; | ||
declare type DataSourceDefinitionConfigVar = BaseConfigVar & Omit<DataSourceDefinition<Inputs, ConfigVarResultCollection, DataSourceType>, "display" | "inputs" | "examplePayload">; | ||
declare type DataSourceReferenceConfigVar<TComponents extends ComponentSelector<any>> = BaseConfigVar & { | ||
dataSourceType: DataSourceType; | ||
declare type BaseDataSourceConfigVar = ({ | ||
dataSourceType: CollectionDataSourceType; | ||
} & BaseConfigVar) | ({ | ||
dataSourceType: Exclude<DataSourceType, CollectionDataSourceType>; | ||
} & Omit<BaseConfigVar, "collectionType">); | ||
declare type DataSourceDefinitionConfigVar = BaseDataSourceConfigVar & Omit<DataSourceDefinition<Inputs, ConfigVarResultCollection, DataSourceType>, "display" | "inputs" | "examplePayload" | "dataSourceType" | "detailDataSource">; | ||
declare type DataSourceReferenceConfigVar<TComponents extends ComponentSelector<any>> = BaseDataSourceConfigVar & { | ||
dataSource: ToComponentReferences<"dataSource", TComponents, ConfigPages<TComponents>>; | ||
@@ -122,4 +132,5 @@ }; | ||
export declare type DataSourceConfigVar<TComponents extends ComponentSelector<any>> = DataSourceDefinitionConfigVar | DataSourceReferenceConfigVar<TComponents>; | ||
declare type ConnectionDefinitionConfigVar = BaseConfigVar & Omit<ConnectionDefinition, "label" | "comments" | "key">; | ||
declare type ConnectionReferenceConfigVar<TComponents extends ComponentSelector<any>> = BaseConfigVar & { | ||
declare type BaseConnectionConfigVar = Omit<BaseConfigVar, "collectionType">; | ||
declare type ConnectionDefinitionConfigVar = BaseConnectionConfigVar & Omit<ConnectionDefinition, "label" | "comments" | "key">; | ||
declare type ConnectionReferenceConfigVar<TComponents extends ComponentSelector<any>> = BaseConnectionConfigVar & { | ||
connection: ToComponentReferences<"connection", TComponents> & { | ||
@@ -131,3 +142,4 @@ template?: string; | ||
export declare type ConnectionConfigVar<TComponents extends ComponentSelector<any>> = ConnectionDefinitionConfigVar | ConnectionReferenceConfigVar<TComponents>; | ||
export declare type ConfigVar<TComponents extends ComponentSelector<any>> = StandardConfigVar | ScheduleConfigVar | DataSourceConfigVar<TComponents> | ConnectionConfigVar<TComponents>; | ||
export declare type ConfigVar<TComponents extends ComponentSelector<any>> = StandardConfigVar | CodeConfigVar | ScheduleConfigVar | DataSourceConfigVar<TComponents> | ConnectionConfigVar<TComponents>; | ||
export declare const isCodeConfigVar: (cv: ConfigVar<any>) => cv is CodeConfigVar; | ||
export declare const isScheduleConfigVar: (cv: ConfigVar<any>) => cv is ScheduleConfigVar; | ||
@@ -134,0 +146,0 @@ export declare const isDataSourceDefinitionConfigVar: (cv: ConfigVar<any>) => cv is DataSourceDefinitionConfigVar; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isComponentReference = exports.isConnectionReferenceConfigVar = exports.isConnectionDefinitionConfigVar = exports.isDataSourceReferenceConfigVar = exports.isDataSourceDefinitionConfigVar = exports.isScheduleConfigVar = void 0; | ||
exports.isComponentReference = exports.isConnectionReferenceConfigVar = exports.isConnectionDefinitionConfigVar = exports.isDataSourceReferenceConfigVar = exports.isDataSourceDefinitionConfigVar = exports.isScheduleConfigVar = exports.isCodeConfigVar = void 0; | ||
const isCodeConfigVar = (cv) => "dataType" in cv && cv.dataType === "code"; | ||
exports.isCodeConfigVar = isCodeConfigVar; | ||
const isScheduleConfigVar = (cv) => "dataType" in cv && cv.dataType === "schedule"; | ||
@@ -8,3 +10,5 @@ exports.isScheduleConfigVar = isScheduleConfigVar; | ||
exports.isDataSourceDefinitionConfigVar = isDataSourceDefinitionConfigVar; | ||
const isDataSourceReferenceConfigVar = (cv) => "dataSource" in cv && (0, exports.isComponentReference)(cv.dataSource); | ||
const isDataSourceReferenceConfigVar = (cv) => "dataSourceType" in cv && | ||
"dataSource" in cv && | ||
(0, exports.isComponentReference)(cv.dataSource); | ||
exports.isDataSourceReferenceConfigVar = isDataSourceReferenceConfigVar; | ||
@@ -11,0 +15,0 @@ const isConnectionDefinitionConfigVar = (cv) => "inputs" in cv; |
{ | ||
"name": "@prismatic-io/spectral", | ||
"version": "8.1.6", | ||
"version": "8.1.7", | ||
"description": "Utility library for building Prismatic components", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
218768
4579