@prismatic-io/spectral 7.0.0-pre → 7.0.1-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.
- package/dist/serverTypes/index.d.ts +3 -2
- package/dist/types/DataSourceDefinition.d.ts +4 -2
- package/dist/types/DataSourcePerformFunction.d.ts +2 -2
- package/dist/types/DataSourceResult.d.ts +9 -3
- package/dist/types/Inputs.d.ts +18 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/index.js +0 -1
- package/package.json +1 -1
- package/dist/types/DataSourceType.d.ts +0 -20
- package/dist/types/DataSourceType.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import {
|
|
2
|
+
import { DataSourceResultType, DataSourceResultFieldType } from "../types";
|
|
3
3
|
interface DisplayDefinition {
|
|
4
4
|
label: string;
|
|
5
5
|
description: string;
|
|
@@ -128,7 +128,7 @@ export interface Trigger {
|
|
|
128
128
|
isCommonTrigger?: boolean;
|
|
129
129
|
}
|
|
130
130
|
export declare type DataSourceResult = {
|
|
131
|
-
|
|
131
|
+
result: DataSourceResultType;
|
|
132
132
|
supplementalData: {
|
|
133
133
|
data: unknown;
|
|
134
134
|
contentType: string;
|
|
@@ -143,6 +143,7 @@ export interface DataSource {
|
|
|
143
143
|
};
|
|
144
144
|
inputs: Input[];
|
|
145
145
|
perform: DataSourcePerformFunction;
|
|
146
|
+
resultFieldType: DataSourceResultFieldType;
|
|
146
147
|
examplePayload?: unknown;
|
|
147
148
|
}
|
|
148
149
|
export declare enum OAuth2Type {
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { ActionDisplayDefinition, DataSourcePerformFunction, Inputs, DataSourceResult,
|
|
1
|
+
import { ActionDisplayDefinition, DataSourcePerformFunction, Inputs, DataSourceResult, DataSourceResultType, DataSourceResultFieldType } from ".";
|
|
2
2
|
/**
|
|
3
3
|
* DataSourceDefinition is the type of the object that is passed in to `dataSource` function to
|
|
4
4
|
* define a component Data Source.
|
|
5
5
|
*/
|
|
6
|
-
export interface DataSourceDefinition<TInputs extends Inputs, TDataSourceResult extends DataSourceResult<
|
|
6
|
+
export interface DataSourceDefinition<TInputs extends Inputs, TDataSourceResult extends DataSourceResult<DataSourceResultType>> {
|
|
7
7
|
/** Defines how the Data Source is displayed in the Prismatic interface. */
|
|
8
8
|
display: ActionDisplayDefinition;
|
|
9
9
|
/** Function to perform when this Data Source is invoked. */
|
|
10
10
|
perform: DataSourcePerformFunction<TInputs, TDataSourceResult>;
|
|
11
|
+
/** Field type of the data produced by the data source perform function. */
|
|
12
|
+
resultFieldType: DataSourceResultFieldType;
|
|
11
13
|
/** InputFields to present in the Prismatic interface for configuration of this Data Source. */
|
|
12
14
|
inputs: TInputs;
|
|
13
15
|
/** An example of the payload outputted by this Data Source. */
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Inputs, DataSourceResult,
|
|
1
|
+
import { Inputs, DataSourceResult, DataSourceResultType, ActionInputParameters, ActionContext } from ".";
|
|
2
2
|
/** Definition of the function to perform when a Data Source is invoked. */
|
|
3
|
-
export declare type DataSourcePerformFunction<T extends Inputs, TResult extends DataSourceResult<
|
|
3
|
+
export declare type DataSourcePerformFunction<T extends Inputs, TResult extends DataSourceResult<DataSourceResultType>> = (context: ActionContext, params: ActionInputParameters<T>) => Promise<TResult>;
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { ObjectSelection, ObjectFieldMap, InputFieldDefaultMap } from "./Inputs";
|
|
3
|
+
/** The type of field that is appropriate for rendering the data that is the result of the data source perform function. */
|
|
4
|
+
export declare type DataSourceResultFieldType = keyof typeof InputFieldDefaultMap;
|
|
5
|
+
/** The actual data type of the data that is the result of the data source perform function. */
|
|
6
|
+
export declare type DataSourceResultType = ObjectSelection | ObjectFieldMap | Buffer | boolean | number | string | Record<string, unknown> | unknown[] | unknown;
|
|
1
7
|
/** Represents the result of a Data Source action. */
|
|
2
|
-
export declare type DataSourceResult<
|
|
3
|
-
/** The data that
|
|
4
|
-
|
|
8
|
+
export declare type DataSourceResult<TDataSourceResultType> = {
|
|
9
|
+
/** The resulting data that is returned from the data source. */
|
|
10
|
+
result: TDataSourceResultType;
|
|
5
11
|
/** Additional data that may be useful for out-of-band processing at a later time. */
|
|
6
12
|
supplementalData?: {
|
|
7
13
|
data: unknown;
|
package/dist/types/Inputs.d.ts
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
import { ConditionalExpression } from "./conditional-logic";
|
|
2
|
-
|
|
2
|
+
export declare type ObjectSelection = {
|
|
3
|
+
key: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
fields: {
|
|
6
|
+
key: string;
|
|
7
|
+
label?: string;
|
|
8
|
+
}[];
|
|
9
|
+
}[];
|
|
10
|
+
export declare type ObjectFieldMap = {
|
|
11
|
+
key: string;
|
|
12
|
+
label?: string;
|
|
13
|
+
value: {
|
|
14
|
+
objectKey: string;
|
|
15
|
+
objectLabel?: string;
|
|
16
|
+
fieldKey: string;
|
|
17
|
+
fieldLabel?: string;
|
|
18
|
+
};
|
|
19
|
+
}[];
|
|
3
20
|
/** InputField type enumeration. */
|
|
4
21
|
export declare type InputFieldType = InputFieldDefinition["type"];
|
|
5
22
|
export declare const InputFieldDefaultMap: Record<InputFieldType, string | undefined>;
|
package/dist/types/index.d.ts
CHANGED
package/dist/types/index.js
CHANGED
|
@@ -37,4 +37,3 @@ __exportStar(require("./TriggerPayload"), exports);
|
|
|
37
37
|
__exportStar(require("./DataSourceDefinition"), exports);
|
|
38
38
|
__exportStar(require("./DataSourcePerformFunction"), exports);
|
|
39
39
|
__exportStar(require("./DataSourceResult"), exports);
|
|
40
|
-
__exportStar(require("./DataSourceType"), exports);
|
package/package.json
CHANGED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
export declare type ObjectSelection = {
|
|
3
|
-
key: string;
|
|
4
|
-
label?: string;
|
|
5
|
-
fields: {
|
|
6
|
-
key: string;
|
|
7
|
-
label?: string;
|
|
8
|
-
}[];
|
|
9
|
-
}[];
|
|
10
|
-
export declare type ObjectFieldMap = {
|
|
11
|
-
key: string;
|
|
12
|
-
label?: string;
|
|
13
|
-
value: {
|
|
14
|
-
objectKey: string;
|
|
15
|
-
objectLabel?: string;
|
|
16
|
-
fieldKey: string;
|
|
17
|
-
fieldLabel?: string;
|
|
18
|
-
};
|
|
19
|
-
}[];
|
|
20
|
-
export declare type DataSourceType = ObjectSelection | ObjectFieldMap | Buffer | boolean | number | string | Record<string, unknown> | unknown[] | unknown;
|