@prismatic-io/spectral 7.8.1 → 7.8.3

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.
@@ -86,6 +86,7 @@ export interface TriggerPayload {
86
86
  user: User;
87
87
  integration: Integration;
88
88
  flow: Flow;
89
+ startedAt: string;
89
90
  }
90
91
  interface HttpResponse {
91
92
  statusCode: number;
package/dist/testing.d.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  * https://prismatic.io/docs/custom-components/writing-custom-components/#testing-a-component
6
6
  */
7
7
  import { TriggerPayload, TriggerResult, ConnectionValue, ActionLogger, Component, ActionContext, ActionPerformReturn, DataSourceResult, DataSourceContext } from "./serverTypes";
8
- import { ConnectionDefinition, ActionDefinition, TriggerDefinition, Inputs, ActionInputParameters, DataSourceDefinition, ActionPerformReturn as InvokeActionPerformReturn, TriggerResult as InvokeTriggerResult, DataSourceResult as InvokeDataSourceResult } from "./types";
8
+ import { ConnectionDefinition, ActionDefinition, TriggerDefinition, Inputs, ActionInputParameters, DataSourceDefinition, ActionPerformReturn as InvokeActionPerformReturn, TriggerResult as InvokeTriggerResult, DataSourceResult as InvokeDataSourceResult, TriggerEventFunctionReturn } from "./types";
9
9
  export declare const createConnection: <T extends ConnectionDefinition>({ key }: T, values: Record<string, unknown>, tokenValues?: Record<string, unknown> | undefined) => ConnectionValue;
10
10
  /**
11
11
  * Pre-built mock of ActionLogger. Suitable for asserting logs are created as expected.
@@ -63,6 +63,8 @@ export declare class ComponentTestHarness<TComponent extends Component> {
63
63
  private buildParams;
64
64
  connectionValue({ key }: ConnectionDefinition): ConnectionValue;
65
65
  trigger(key: string, payload?: TriggerPayload, params?: Record<string, unknown>, context?: Partial<ActionContext>): Promise<TriggerResult>;
66
+ triggerOnInstanceDeploy(key: string, params?: Record<string, unknown>, context?: Partial<ActionContext>): Promise<void | TriggerEventFunctionReturn>;
67
+ triggerOnInstanceDelete(key: string, params?: Record<string, unknown>, context?: Partial<ActionContext>): Promise<void | TriggerEventFunctionReturn>;
66
68
  action(key: string, params?: Record<string, unknown>, context?: Partial<ActionContext>): Promise<ActionPerformReturn>;
67
69
  dataSource(key: string, params?: Record<string, unknown>, context?: Partial<DataSourceContext>): Promise<DataSourceResult>;
68
70
  }
package/dist/testing.js CHANGED
@@ -142,6 +142,7 @@ const defaultTriggerPayload = () => {
142
142
  id: "flowId",
143
143
  name: "Flow 1",
144
144
  },
145
+ startedAt: new Date().toISOString(),
145
146
  };
146
147
  };
147
148
  exports.defaultTriggerPayload = defaultTriggerPayload;
@@ -216,6 +217,24 @@ class ComponentTestHarness {
216
217
  return trigger.perform(this.buildContext(baseActionContext, context), Object.assign(Object.assign({}, (0, exports.defaultTriggerPayload)()), payload), this.buildParams(trigger.inputs, params));
217
218
  });
218
219
  }
220
+ triggerOnInstanceDeploy(key, params, context) {
221
+ return __awaiter(this, void 0, void 0, function* () {
222
+ const trigger = this.component.triggers[key];
223
+ if (!trigger.onInstanceDeploy) {
224
+ throw new Error("Trigger does not support onInstanceDeploy");
225
+ }
226
+ return trigger.onInstanceDeploy(this.buildContext(baseActionContext, context), this.buildParams(trigger.inputs, params));
227
+ });
228
+ }
229
+ triggerOnInstanceDelete(key, params, context) {
230
+ return __awaiter(this, void 0, void 0, function* () {
231
+ const trigger = this.component.triggers[key];
232
+ if (!trigger.onInstanceDelete) {
233
+ throw new Error("Trigger does not support onInstanceDelete");
234
+ }
235
+ return trigger.onInstanceDelete(this.buildContext(baseActionContext, context), this.buildParams(trigger.inputs, params));
236
+ });
237
+ }
219
238
  action(key, params, context) {
220
239
  return __awaiter(this, void 0, void 0, function* () {
221
240
  const action = this.component.actions[key];
@@ -38,4 +38,6 @@ export interface TriggerPayload {
38
38
  integration: Integration;
39
39
  /** Contains attributes of the Flow that is being executed. */
40
40
  flow: Flow;
41
+ /** The time in UTC that execution started. */
42
+ startedAt: string;
41
43
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prismatic-io/spectral",
3
- "version": "7.8.1",
3
+ "version": "7.8.3",
4
4
  "description": "Utility library for building Prismatic components",
5
5
  "keywords": [
6
6
  "prismatic"