@prismatic-io/spectral 8.1.0-preview2 → 8.1.0-preview3

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/testing.d.ts CHANGED
@@ -63,7 +63,11 @@ declare type ToTestValues<TConfigVars extends ConfigVarResultCollection> = {
63
63
  * Invokes specified Flow of a Code Native Integration using supplied params.
64
64
  * Runs the Trigger and then the Action function and returns the result of the Action.
65
65
  */
66
- export declare const invokeFlow: <TConfigPages extends ConfigPages<any>, TConfigVars extends ConfigVarResultCollection = import("./types/utils").Prettify<{ [Key in keyof import("./types").GetElements<TConfigPages> as Key extends string ? Key : never]: import("./types").ElementToRuntimeType<import("./types").GetElements<TConfigPages>[Key]>; }>, TConfigVarValues extends TestConfigVarValues = ToTestValues<TConfigVars>>(flow: Flow<TConfigPages, ComponentSelector<any>, import("./types").TriggerPayload>, configVars: TConfigVarValues, context?: Partial<ActionContext<TConfigVars>> | undefined, payload?: TriggerPayload | undefined) => Promise<InvokeReturn<InvokeActionPerformReturn<false, unknown>>>;
66
+ export declare const invokeFlow: <TConfigPages extends ConfigPages<any>, TConfigVars extends ConfigVarResultCollection = import("./types/utils").Prettify<{ [Key in keyof import("./types").GetElements<TConfigPages> as Key extends string ? Key : never]: import("./types").ElementToRuntimeType<import("./types").GetElements<TConfigPages>[Key]>; }>, TConfigVarValues extends TestConfigVarValues = ToTestValues<TConfigVars>>(flow: Flow<TConfigPages, ComponentSelector<any>, import("./types").TriggerPayload>, { configVars, context, payload, }?: {
67
+ configVars?: TConfigVarValues | undefined;
68
+ context?: Partial<ActionContext<TConfigVars>> | undefined;
69
+ payload?: Partial<TriggerPayload> | undefined;
70
+ }) => Promise<InvokeReturn<InvokeActionPerformReturn<false, unknown>>>;
67
71
  export declare class ComponentTestHarness<TComponent extends Component> {
68
72
  component: TComponent;
69
73
  constructor(component: TComponent);
package/dist/testing.js CHANGED
@@ -178,7 +178,7 @@ const invokeDataSource = ({ perform }, params, context) => __awaiter(void 0, voi
178
178
  });
179
179
  exports.invokeDataSource = invokeDataSource;
180
180
  const createConfigVars = (values) => {
181
- return Object.entries(values).reduce((result, [key, value]) => {
181
+ return Object.entries(values !== null && values !== void 0 ? values : {}).reduce((result, [key, value]) => {
182
182
  // Connection
183
183
  if (typeof value === "object" && "fields" in value) {
184
184
  return Object.assign(Object.assign({}, result), { [key]: Object.assign(Object.assign({}, value), { key, configVarKey: "" }) });
@@ -190,12 +190,12 @@ const createConfigVars = (values) => {
190
190
  * Invokes specified Flow of a Code Native Integration using supplied params.
191
191
  * Runs the Trigger and then the Action function and returns the result of the Action.
192
192
  */
193
- const invokeFlow = (flow, configVars, context, payload) => __awaiter(void 0, void 0, void 0, function* () {
193
+ const invokeFlow = (flow, { configVars, context, payload, } = {}) => __awaiter(void 0, void 0, void 0, function* () {
194
194
  const realizedConfigVars = createConfigVars(configVars);
195
195
  const realizedContext = createActionContext(Object.assign(Object.assign({}, context), { configVars: realizedConfigVars }));
196
196
  const realizedPayload = Object.assign(Object.assign({}, (0, exports.defaultTriggerPayload)()), payload);
197
197
  const params = {
198
- onTrigger: { results: null },
198
+ onTrigger: { results: realizedPayload },
199
199
  };
200
200
  if ("onTrigger" in flow && typeof flow.onTrigger === "function") {
201
201
  const triggerResult = yield flow.onTrigger(realizedContext, realizedPayload, params);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prismatic-io/spectral",
3
- "version": "8.1.0-preview2",
3
+ "version": "8.1.0-preview3",
4
4
  "description": "Utility library for building Prismatic components",
5
5
  "keywords": [
6
6
  "prismatic"