@prismatic-io/spectral
Advanced tools
Comparing version 7.0.0-pre to 7.0.1-pre
/// <reference types="node" /> | ||
import { DataSourceType } from "../types"; | ||
import { DataSourceResultType, DataSourceResultFieldType } from "../types"; | ||
interface DisplayDefinition { | ||
@@ -131,3 +131,3 @@ label: string; | ||
export declare type DataSourceResult = { | ||
content: DataSourceType; | ||
result: DataSourceResultType; | ||
supplementalData: { | ||
@@ -147,2 +147,3 @@ data: unknown; | ||
perform: DataSourcePerformFunction; | ||
resultFieldType: DataSourceResultFieldType; | ||
examplePayload?: unknown; | ||
@@ -149,0 +150,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import { ActionDisplayDefinition, DataSourcePerformFunction, Inputs, DataSourceResult, DataSourceType } from "."; | ||
import { ActionDisplayDefinition, DataSourcePerformFunction, Inputs, DataSourceResult, DataSourceResultType, DataSourceResultFieldType } from "."; | ||
/** | ||
@@ -6,3 +6,3 @@ * DataSourceDefinition is the type of the object that is passed in to `dataSource` function to | ||
*/ | ||
export interface DataSourceDefinition<TInputs extends Inputs, TDataSourceResult extends DataSourceResult<DataSourceType>> { | ||
export interface DataSourceDefinition<TInputs extends Inputs, TDataSourceResult extends DataSourceResult<DataSourceResultType>> { | ||
/** Defines how the Data Source is displayed in the Prismatic interface. */ | ||
@@ -12,2 +12,4 @@ display: ActionDisplayDefinition; | ||
perform: DataSourcePerformFunction<TInputs, TDataSourceResult>; | ||
/** Field type of the data produced by the data source perform function. */ | ||
resultFieldType: DataSourceResultFieldType; | ||
/** InputFields to present in the Prismatic interface for configuration of this Data Source. */ | ||
@@ -14,0 +16,0 @@ inputs: TInputs; |
@@ -1,3 +0,3 @@ | ||
import { Inputs, DataSourceResult, DataSourceType, ActionInputParameters, ActionContext } from "."; | ||
import { Inputs, DataSourceResult, DataSourceResultType, ActionInputParameters, ActionContext } from "."; | ||
/** Definition of the function to perform when a Data Source is invoked. */ | ||
export declare type DataSourcePerformFunction<T extends Inputs, TResult extends DataSourceResult<DataSourceType>> = (context: ActionContext, params: ActionInputParameters<T>) => Promise<TResult>; | ||
export declare type DataSourcePerformFunction<T extends Inputs, TResult extends DataSourceResult<DataSourceResultType>> = (context: ActionContext, params: ActionInputParameters<T>) => Promise<TResult>; |
@@ -0,5 +1,11 @@ | ||
/// <reference types="node" /> | ||
import { ObjectSelection, ObjectFieldMap, InputFieldDefaultMap } 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 = keyof typeof InputFieldDefaultMap; | ||
/** The actual data type of the data that is the result of the data source perform function. */ | ||
export declare type DataSourceResultType = ObjectSelection | ObjectFieldMap | Buffer | boolean | number | string | Record<string, unknown> | unknown[] | unknown; | ||
/** Represents the result of a Data Source action. */ | ||
export declare type DataSourceResult<ContentData> = { | ||
/** The data that will be used as content. */ | ||
content: ContentData; | ||
export declare type DataSourceResult<TDataSourceResultType> = { | ||
/** The resulting data that is returned from the data source. */ | ||
result: TDataSourceResultType; | ||
/** Additional data that may be useful for out-of-band processing at a later time. */ | ||
@@ -6,0 +12,0 @@ supplementalData?: { |
@@ -24,2 +24,1 @@ /** | ||
export * from "./DataSourceResult"; | ||
export * from "./DataSourceType"; |
@@ -40,2 +40,1 @@ "use strict"; | ||
__exportStar(require("./DataSourceResult"), exports); | ||
__exportStar(require("./DataSourceType"), exports); |
import { ConditionalExpression } from "./conditional-logic"; | ||
import { ObjectSelection, ObjectFieldMap } from "./DataSourceType"; | ||
export declare type ObjectSelection = { | ||
key: string; | ||
label?: string; | ||
fields: { | ||
key: string; | ||
label?: string; | ||
}[]; | ||
}[]; | ||
export declare type ObjectFieldMap = { | ||
key: string; | ||
label?: string; | ||
value: { | ||
objectKey: string; | ||
objectLabel?: string; | ||
fieldKey: string; | ||
fieldLabel?: string; | ||
}; | ||
}[]; | ||
/** InputField type enumeration. */ | ||
@@ -4,0 +21,0 @@ export declare type InputFieldType = InputFieldDefinition["type"]; |
{ | ||
"name": "@prismatic-io/spectral", | ||
"version": "7.0.0-pre", | ||
"version": "7.0.1-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
144688
3223
67