@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.
@@ -1,5 +1,5 @@
1
1
  /// <reference types="node" />
2
- import { DataSourceType } from "../types";
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
- content: DataSourceType;
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, DataSourceType } from ".";
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<DataSourceType>> {
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, DataSourceType, ActionInputParameters, ActionContext } from ".";
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<DataSourceType>> = (context: ActionContext, params: ActionInputParameters<T>) => Promise<TResult>;
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<ContentData> = {
3
- /** The data that will be used as content. */
4
- content: ContentData;
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;
@@ -1,5 +1,22 @@
1
1
  import { ConditionalExpression } from "./conditional-logic";
2
- import { ObjectSelection, ObjectFieldMap } from "./DataSourceType";
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>;
@@ -21,4 +21,3 @@ export * from "./TriggerPayload";
21
21
  export * from "./DataSourceDefinition";
22
22
  export * from "./DataSourcePerformFunction";
23
23
  export * from "./DataSourceResult";
24
- export * from "./DataSourceType";
@@ -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,6 +1,6 @@
1
1
  {
2
2
  "name": "@prismatic-io/spectral",
3
- "version": "7.0.0-pre",
3
+ "version": "7.0.1-pre",
4
4
  "description": "Utility library for building Prismatic components",
5
5
  "keywords": [
6
6
  "prismatic"
@@ -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;
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });