@prismatic-io/spectral
Advanced tools
Comparing version 7.0.9-pre to 7.0.10-pre
@@ -6,3 +6,3 @@ /** | ||
*/ | ||
import { ActionDefinition, InputFieldDefinition, ComponentDefinition, DefaultConnectionDefinition, OAuth2ConnectionDefinition, Inputs, TriggerDefinition, ActionPerformReturn, TriggerResult, DataSourceDefinition, DataSourceResult } from "./types"; | ||
import { ActionDefinition, InputFieldDefinition, ComponentDefinition, DefaultConnectionDefinition, OAuth2ConnectionDefinition, Inputs, TriggerDefinition, ActionPerformReturn, TriggerResult, DataSourceDefinition } from "./types"; | ||
import { convertComponent } from "./serverTypes/convert"; | ||
@@ -47,3 +47,19 @@ /** | ||
*/ | ||
export declare const dataSource: <TInputs extends Inputs, TResult extends DataSourceResult<unknown>>(definition: DataSourceDefinition<TInputs, TResult>) => DataSourceDefinition<TInputs, TResult>; | ||
export declare const dataSource: <TInputs extends Inputs, TDataSourceType extends keyof { | ||
string: string; | ||
date: string; | ||
timestamp: string; | ||
picklist: import("./types").PickList; | ||
schedule: { | ||
value: string; | ||
}; | ||
code: string; | ||
credential: unknown; | ||
boolean: boolean; | ||
number: number; | ||
connection: import("./types").ConnectionDefinition; | ||
objectSelection: import("./types").ObjectSelection; | ||
objectFieldMap: import("./types").ObjectFieldMap; | ||
jsonForm: import("./types").JSONForm; | ||
}>(definition: DataSourceDefinition<TInputs, TDataSourceType>) => DataSourceDefinition<TInputs, TDataSourceType>; | ||
/** | ||
@@ -50,0 +66,0 @@ * For information and examples on how to write inputs |
/// <reference types="node" /> | ||
import { DataSourceResultType, DataSourceResultFieldType, Instance, Customer } from "../types"; | ||
import { Instance, Customer, DataSourceType, DataSourceResultType } from "../types"; | ||
interface DisplayDefinition { | ||
@@ -134,3 +134,3 @@ label: string; | ||
perform: DataSourcePerformFunction; | ||
resultFieldType: DataSourceResultFieldType; | ||
dataSourceType: DataSourceType; | ||
examplePayload?: unknown; | ||
@@ -137,0 +137,0 @@ } |
@@ -8,3 +8,3 @@ /** | ||
import { TriggerPayload, TriggerResult, ConnectionValue, ActionLogger, Component, ActionContext, ActionPerformReturn, DataSourceResult } from "./serverTypes"; | ||
import { ConnectionDefinition, ActionDefinition, TriggerDefinition, Inputs, ActionInputParameters, DataSourceDefinition, ActionPerformReturn as InvokeActionPerformReturn, TriggerResult as InvokeTriggerResult } from "./types"; | ||
import { ConnectionDefinition, ActionDefinition, TriggerDefinition, Inputs, ActionInputParameters, DataSourceDefinition, ActionPerformReturn as InvokeActionPerformReturn, TriggerResult as InvokeTriggerResult, DataSourceResult as InvokeDataSourceResult } from "./types"; | ||
export declare const createConnection: <T extends ConnectionDefinition>({ key }: T, values: Record<string, unknown>) => ConnectionValue; | ||
@@ -43,3 +43,19 @@ /** | ||
*/ | ||
export declare const invokeDataSource: <TInputs extends Inputs, TReturn extends DataSourceResult>({ perform }: DataSourceDefinition<TInputs, TReturn>, params: ActionInputParameters<TInputs>) => Promise<TReturn>; | ||
export declare const invokeDataSource: <TInputs extends Inputs, TDataSourceType extends keyof { | ||
string: string; | ||
date: string; | ||
timestamp: string; | ||
picklist: import("./types").PickList; | ||
schedule: { | ||
value: string; | ||
}; | ||
code: string; | ||
credential: unknown; | ||
boolean: boolean; | ||
number: number; | ||
connection: ConnectionDefinition; | ||
objectSelection: import("./types").ObjectSelection; | ||
objectFieldMap: import("./types").ObjectFieldMap; | ||
jsonForm: import("./types").JSONForm; | ||
}>({ perform }: DataSourceDefinition<TInputs, TDataSourceType>, params: ActionInputParameters<TInputs>) => Promise<InvokeDataSourceResult<TDataSourceType>>; | ||
export declare class ComponentTestHarness<TComponent extends Component> { | ||
@@ -59,4 +75,20 @@ component: TComponent; | ||
createHarness: <TComponent extends Component>(component: TComponent) => ComponentTestHarness<TComponent>; | ||
invokeDataSource: <TInputs_2 extends Inputs, TReturn_1 extends DataSourceResult>({ perform }: DataSourceDefinition<TInputs_2, TReturn_1>, params: ActionInputParameters<TInputs_2>) => Promise<TReturn_1>; | ||
invokeDataSource: <TInputs_2 extends Inputs, TDataSourceType extends keyof { | ||
string: string; | ||
date: string; | ||
timestamp: string; | ||
picklist: import("./types").PickList; | ||
schedule: { | ||
value: string; | ||
}; | ||
code: string; | ||
credential: unknown; | ||
boolean: boolean; | ||
number: number; | ||
connection: ConnectionDefinition; | ||
objectSelection: import("./types").ObjectSelection; | ||
objectFieldMap: import("./types").ObjectFieldMap; | ||
jsonForm: import("./types").JSONForm; | ||
}>({ perform }: DataSourceDefinition<TInputs_2, TDataSourceType>, params: ActionInputParameters<TInputs_2>) => Promise<InvokeDataSourceResult<TDataSourceType>>; | ||
}; | ||
export default _default; |
@@ -1,2 +0,2 @@ | ||
import { ActionDisplayDefinition, DataSourcePerformFunction, Inputs, DataSourceResult, DataSourceResultType, DataSourceResultFieldType } from "."; | ||
import { ActionDisplayDefinition, DataSourcePerformFunction, Inputs, DataSourceType } from "."; | ||
/** | ||
@@ -6,9 +6,9 @@ * DataSourceDefinition is the type of the object that is passed in to `dataSource` function to | ||
*/ | ||
export interface DataSourceDefinition<TInputs extends Inputs, TDataSourceResult extends DataSourceResult<DataSourceResultType>> { | ||
export interface DataSourceDefinition<TInputs extends Inputs, TDataSourceType extends DataSourceType> { | ||
/** Defines how the Data Source is displayed in the Prismatic interface. */ | ||
display: ActionDisplayDefinition; | ||
/** Function to perform when this Data Source is invoked. */ | ||
perform: DataSourcePerformFunction<TInputs, TDataSourceResult>; | ||
/** Field type of the data produced by the data source perform function. */ | ||
resultFieldType: DataSourceResultFieldType; | ||
/** Function to perform when this Data Source is invoked; fetches data from the data source. */ | ||
perform: DataSourcePerformFunction<TInputs, TDataSourceType>; | ||
/** The type of data that this Data Source represents. */ | ||
dataSourceType: TDataSourceType; | ||
/** InputFields to present in the Prismatic interface for configuration of this Data Source. */ | ||
@@ -15,0 +15,0 @@ inputs: TInputs; |
@@ -1,3 +0,3 @@ | ||
import { Inputs, DataSourceResult, DataSourceResultType, ActionInputParameters } from "."; | ||
import { Inputs, DataSourceResult, DataSourceType, ActionInputParameters } from "."; | ||
/** Definition of the function to perform when a Data Source is invoked. */ | ||
export declare type DataSourcePerformFunction<T extends Inputs, TResult extends DataSourceResult<DataSourceResultType>> = (params: ActionInputParameters<T>) => Promise<TResult>; | ||
export declare type DataSourcePerformFunction<TInputs extends Inputs, TDataSourceType extends DataSourceType> = (params: ActionInputParameters<TInputs>) => Promise<DataSourceResult<TDataSourceType>>; |
@@ -1,11 +0,27 @@ | ||
/// <reference types="node" /> | ||
import { ObjectSelection, ObjectFieldMap, JSONForm } from "./Inputs"; | ||
import { ConnectionDefinition } from "./ConnectionDefinition"; | ||
import { ObjectSelection, ObjectFieldMap, JSONForm, PickList } from "./Inputs"; | ||
/** The type of field that is appropriate for rendering the data that is the result of the data source perform function. */ | ||
export declare type DataSourceResultFieldType = "string" | "date" | "timestamp" | "picklist" | "schedule" | "code" | "credential" | "boolean" | "number" | "connection" | "objectSelection" | "objectFieldMap" | "jsonForm"; | ||
/** The actual data type of the data that is the result of the data source perform function. */ | ||
export declare type DataSourceResultType = ObjectSelection | ObjectFieldMap | JSONForm | Buffer | boolean | number | string | Record<string, unknown> | unknown[] | unknown; | ||
declare type DataSourceTypeMap = { | ||
string: string; | ||
date: string; | ||
timestamp: string; | ||
picklist: PickList; | ||
schedule: { | ||
value: string; | ||
}; | ||
code: string; | ||
credential: unknown; | ||
boolean: boolean; | ||
number: number; | ||
connection: ConnectionDefinition; | ||
objectSelection: ObjectSelection; | ||
objectFieldMap: ObjectFieldMap; | ||
jsonForm: JSONForm; | ||
}; | ||
export declare type DataSourceType = keyof DataSourceTypeMap; | ||
export declare type DataSourceResultType = DataSourceTypeMap[DataSourceType]; | ||
/** Represents the result of a Data Source action. */ | ||
export declare type DataSourceResult<TDataSourceResultType> = { | ||
export declare type DataSourceResult<TDataSourceType extends DataSourceType> = { | ||
/** The resulting data that is returned from the data source. */ | ||
result: TDataSourceResultType; | ||
result: DataSourceTypeMap[TDataSourceType]; | ||
/** Additional data that may be useful for out-of-band processing at a later time. | ||
@@ -19,1 +35,2 @@ * NOTE: This is only available when the Data Source is called as part of fetching | ||
}; | ||
export {}; |
import { ConditionalExpression } from "./conditional-logic"; | ||
export declare type ObjectSelection = { | ||
export declare type Element = { | ||
key: string; | ||
label?: string; | ||
selected?: boolean; | ||
fields?: { | ||
key: string; | ||
label?: string; | ||
}[]; | ||
}; | ||
export declare type ObjectSelection = { | ||
object: Element; | ||
fields?: Element[]; | ||
defaultSelected?: boolean; | ||
}[]; | ||
export declare type ObjectFieldMap = { | ||
key: string; | ||
label?: string; | ||
value: { | ||
objectKey: string; | ||
objectLabel?: string; | ||
fieldKey: string; | ||
fieldLabel?: string; | ||
}; | ||
defaultValue?: { | ||
objectKey: string; | ||
fieldKey: string; | ||
}; | ||
}[]; | ||
fields: { | ||
field: Element; | ||
mappedObject?: Element; | ||
mappedField?: Element; | ||
defaultObject?: Element; | ||
defaultField?: Element; | ||
}[]; | ||
options: { | ||
object: Element; | ||
fields: Element[]; | ||
}[]; | ||
}; | ||
export declare type JSONForm = { | ||
@@ -30,2 +29,6 @@ schema: Record<string, unknown>; | ||
}; | ||
export declare type PickList = { | ||
options?: string[]; | ||
selectedValue?: string; | ||
}; | ||
/** InputField type enumeration. */ | ||
@@ -32,0 +35,0 @@ export declare type InputFieldType = InputFieldDefinition["type"]; |
{ | ||
"name": "@prismatic-io/spectral", | ||
"version": "7.0.9-pre", | ||
"version": "7.0.10-pre", | ||
"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
150031
3376