@teamkeel/testing-runtime 0.418.0 → 0.420.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamkeel/testing-runtime",
3
- "version": "0.418.0",
3
+ "version": "0.420.0",
4
4
  "description": "Internal package used by the generated @teamkeel/testing package",
5
5
  "exports": "./src/index.mjs",
6
6
  "typings": "src/index.d.ts",
@@ -81,6 +81,13 @@ export class FlowExecutor {
81
81
  }).then(handleResponse);
82
82
  }
83
83
 
84
+ async back(id) {
85
+ return fetch(this._flowUrl + "/" + id + "/back", {
86
+ method: "POST",
87
+ headers: this.headers(),
88
+ }).then(handleResponse);
89
+ }
90
+
84
91
  async putStepValues(id, stepId, values, action) {
85
92
  let url = this._flowUrl + "/" + id + "/" + stepId;
86
93
 
@@ -97,6 +104,25 @@ export class FlowExecutor {
97
104
  }).then(handleResponse);
98
105
  }
99
106
 
107
+ async callback(id, stepId, element, callbackName, values) {
108
+ let url =
109
+ this._flowUrl +
110
+ "/" +
111
+ id +
112
+ "/" +
113
+ stepId +
114
+ "/callback?element=" +
115
+ element +
116
+ "&callback=" +
117
+ callbackName;
118
+
119
+ return await fetch(url, {
120
+ method: "POST",
121
+ body: JSON.stringify(values),
122
+ headers: this.headers(),
123
+ }).then(handleResponse);
124
+ }
125
+
100
126
  async untilFinished(id, timeout = 5000) {
101
127
  const startTime = Date.now();
102
128
 
@@ -166,7 +192,9 @@ function handleResponse(r) {
166
192
 
167
193
  return r.text().then((t) => {
168
194
  const response = JSON.parse(t, reviver);
169
- response.input = parseOutputs(response.input);
195
+ if (response && response.input) {
196
+ response.input = parseOutputs(response.input);
197
+ }
170
198
 
171
199
  return response;
172
200
  });
package/src/index.d.ts CHANGED
@@ -144,12 +144,20 @@ declare class FlowExecutor<Input = {}> {
144
144
  start(inputs: Input): Promise<FlowRun<Input>>;
145
145
  get(id: string): Promise<FlowRun<Input>>;
146
146
  cancel(id: string): Promise<FlowRun<Input>>;
147
+ back(id: string): Promise<FlowRun<Input>>;
147
148
  putStepValues(
148
149
  id: string,
149
150
  stepId: string,
150
151
  values: Record<string, any>,
151
152
  action?: string
152
153
  ): Promise<FlowRun<Input>>;
154
+ callback(
155
+ id: string,
156
+ stepId: string,
157
+ element: string,
158
+ callbackName: string,
159
+ values: any
160
+ ): Promise<any>;
153
161
  untilAwaitingInput(id: string, timeout?: number): Promise<FlowRun<Input>>;
154
162
  untilFinished(id: string, timeout?: number): Promise<FlowRun<Input>>;
155
163
  }