@prismatic-io/spectral 8.0.1 → 8.0.2

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.
@@ -21,6 +21,9 @@ const convertIntegration = (definition) => {
21
21
  };
22
22
  exports.convertIntegration = convertIntegration;
23
23
  const convertConfigPages = (pages) => {
24
+ if (!pages || !Object.keys(pages).length) {
25
+ return;
26
+ }
24
27
  return Object.entries(pages).map(([name, { tagline, elements }]) => ({
25
28
  name,
26
29
  tagline,
@@ -199,8 +202,10 @@ const codeNativeIntegrationComponent = ({ name, iconPath, description, flows = [
199
202
  description: "The function that will be executed by the flow to return an HTTP response.",
200
203
  },
201
204
  perform: onTrigger,
202
- onInstanceDeploy: onInstanceDeploy,
203
- onInstanceDelete: onInstanceDelete,
205
+ onInstanceDeploy,
206
+ hasOnInstanceDeploy: !!onInstanceDeploy,
207
+ onInstanceDelete,
208
+ hasOnInstanceDelete: !!onInstanceDelete,
204
209
  inputs: [],
205
210
  scheduleSupport: "valid",
206
211
  synchronousResponseSupport: "valid",
@@ -48,7 +48,7 @@ export interface ActionLogger {
48
48
  warn: ActionLoggerFunction;
49
49
  error: ActionLoggerFunction;
50
50
  }
51
- export declare type ActionContext<TConfigVars extends ConfigVarResultCollection> = {
51
+ export declare type ActionContext<TConfigVars extends ConfigVarResultCollection = ConfigVarResultCollection> = {
52
52
  logger: ActionLogger;
53
53
  instanceState: Record<string, unknown>;
54
54
  crossFlowState: Record<string, unknown>;
@@ -111,9 +111,9 @@ interface TriggerBranchingResult extends TriggerBaseResult {
111
111
  branch: string;
112
112
  }
113
113
  export declare type TriggerResult = TriggerBranchingResult | TriggerBaseResult | undefined;
114
- export declare type TriggerPerformFunction = (context: ActionContext<any>, payload: TriggerPayload, params: Record<string, unknown>) => Promise<TriggerResult>;
114
+ export declare type TriggerPerformFunction = (context: ActionContext, payload: TriggerPayload, params: Record<string, unknown>) => Promise<TriggerResult>;
115
115
  export declare type TriggerEventFunctionResult = TriggerEventFunctionReturn | void;
116
- export declare type TriggerEventFunction = (context: ActionContext<any>, params: Record<string, unknown>) => Promise<TriggerEventFunctionResult>;
116
+ export declare type TriggerEventFunction = (context: ActionContext, params: Record<string, unknown>) => Promise<TriggerEventFunctionResult>;
117
117
  export interface Trigger {
118
118
  key: string;
119
119
  display: DisplayDefinition & {
@@ -136,7 +136,7 @@ export interface Trigger {
136
136
  examplePayload?: unknown;
137
137
  isCommonTrigger?: boolean;
138
138
  }
139
- export interface DataSourceContext<TConfigVars extends ConfigVarResultCollection> {
139
+ export interface DataSourceContext<TConfigVars extends ConfigVarResultCollection = ConfigVarResultCollection> {
140
140
  logger: ActionLogger;
141
141
  configVars: TConfigVars;
142
142
  customer: CustomerAttributes;
@@ -150,7 +150,7 @@ export declare type DataSourceResult = {
150
150
  contentType: string;
151
151
  };
152
152
  };
153
- export declare type DataSourcePerformFunction = (context: DataSourceContext<any>, params: Record<string, unknown>) => Promise<DataSourceResult>;
153
+ export declare type DataSourcePerformFunction = (context: DataSourceContext, params: Record<string, unknown>) => Promise<DataSourceResult>;
154
154
  export interface DataSource {
155
155
  key: string;
156
156
  display: DisplayDefinition & {
@@ -214,7 +214,7 @@ interface ServerPerformBranchingDataReturn extends ServerPerformDataReturn {
214
214
  branch: string;
215
215
  }
216
216
  export declare type ActionPerformReturn = ServerPerformDataStructureReturn | ServerPerformBranchingDataStructureReturn | ServerPerformDataReturn | ServerPerformBranchingDataReturn | undefined;
217
- export declare type ActionPerformFunction = (context: ActionContext<any>, params: Record<string, unknown>) => Promise<ActionPerformReturn>;
217
+ export declare type ActionPerformFunction = (context: ActionContext, params: Record<string, unknown>) => Promise<ActionPerformReturn>;
218
218
  interface InputFieldChoice {
219
219
  label: string;
220
220
  value: string;
@@ -35,6 +35,11 @@ export declare type ObjectFieldMap = {
35
35
  fields: Element[];
36
36
  }[];
37
37
  };
38
+ export declare type Schedule = {
39
+ value: string;
40
+ schedule_type: string;
41
+ time_zone: string;
42
+ };
38
43
  export declare type JSONForm = {
39
44
  /**
40
45
  * The data/JSON schema defines the underlying data to
@@ -248,5 +253,5 @@ export interface InputFieldChoice {
248
253
  /** InputField collection enumeration */
249
254
  export declare type InputFieldCollection = "valuelist" | "keyvaluelist";
250
255
  /** Config variable result collection */
251
- export declare type ConfigVarResultCollection = Record<string, string | Connection | JSONForm | ObjectSelection | ObjectFieldMap>;
256
+ export declare type ConfigVarResultCollection = Record<string, string | Schedule | Connection | JSONForm | ObjectSelection | ObjectFieldMap>;
252
257
  export {};
@@ -1,7 +1,8 @@
1
- import { DataSourceDefinition, ConnectionDefinition, ActionPerformFunction, ActionPerformReturn, TriggerEventFunction, TriggerPerformFunction, Inputs, TriggerResult, DataSourceType, TriggerPayload, Connection, JSONForm, ObjectFieldMap, ObjectSelection, ConfigVarResultCollection } from ".";
1
+ import { DataSourceDefinition, ConnectionDefinition, ActionPerformFunction, ActionPerformReturn, TriggerEventFunction, TriggerPerformFunction, Inputs, TriggerResult, DataSourceType, TriggerPayload, Connection, JSONForm, ObjectFieldMap, ObjectSelection, ConfigVarResultCollection, Schedule } from ".";
2
2
  import { Prettify, UnionToIntersection, ValueOf } from "./utils";
3
3
  declare type ToDataSourceRuntimeType<TType extends DataSourceType> = TType extends "jsonForm" ? JSONForm : TType extends "objectSelection" ? ObjectSelection : TType extends "objectFieldMap" ? ObjectFieldMap : string;
4
- export declare type ElementToRuntimeType<TElement extends ConfigPageElement> = TElement extends ConnectionConfigVar ? Connection : TElement extends DataSourceConfigVar ? ToDataSourceRuntimeType<TElement["dataSourceType"]> : TElement extends StandardConfigVar ? string : never;
4
+ declare type ToRuntimeType<TType extends ConfigVarDataType> = TType extends ConfigVarDataType.Schedule ? Schedule : string;
5
+ export declare type ElementToRuntimeType<TElement extends ConfigPageElement> = TElement extends ConnectionConfigVar ? Connection : TElement extends DataSourceConfigVar ? ToDataSourceRuntimeType<TElement["dataSourceType"]> : TElement extends StandardConfigVar ? ToRuntimeType<TElement["dataType"]> : never;
5
6
  declare type GetElements<TConfigPages extends ConfigPages> = TConfigPages extends ConfigPages ? UnionToIntersection<ValueOf<TConfigPages>["elements"]> : never;
6
7
  export declare type ExtractConfigVars<TConfigPages extends ConfigPages, TElements extends ConfigPage["elements"] = GetElements<TConfigPages>> = Prettify<{
7
8
  [Key in keyof TElements]: ElementToRuntimeType<TElements[Key]>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prismatic-io/spectral",
3
- "version": "8.0.1",
3
+ "version": "8.0.2",
4
4
  "description": "Utility library for building Prismatic components",
5
5
  "keywords": [
6
6
  "prismatic"