@teamkeel/testing-runtime 0.452.0 → 0.453.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.452.0",
3
+ "version": "0.453.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",
@@ -3,7 +3,10 @@ import { parseInputs, parseOutputs, reviver } from "./parsing.mjs";
3
3
 
4
4
  export class FlowExecutor {
5
5
  constructor(props) {
6
- this._flowUrl = process.env.KEEL_TESTING_FLOWS_API_URL + "/" + props.name;
6
+ this._flowUrl =
7
+ process.env.KEEL_TESTING_FLOWS_API_URL +
8
+ "/" +
9
+ encodeURIComponent(props.name);
7
10
  this._name = props.name;
8
11
  this._identity = props.identity || null;
9
12
  this._authToken = props.authToken || null;
@@ -69,28 +72,33 @@ export class FlowExecutor {
69
72
  }
70
73
 
71
74
  async get(id) {
72
- return fetch(this._flowUrl + "/" + id, {
75
+ return fetch(this._flowUrl + "/" + encodeURIComponent(id), {
73
76
  method: "GET",
74
77
  headers: this.headers(),
75
78
  }).then(handleResponse);
76
79
  }
77
80
 
78
81
  async cancel(id) {
79
- return fetch(this._flowUrl + "/" + id + "/cancel", {
82
+ return fetch(this._flowUrl + "/" + encodeURIComponent(id) + "/cancel", {
80
83
  method: "POST",
81
84
  headers: this.headers(),
82
85
  }).then(handleResponse);
83
86
  }
84
87
 
85
88
  async back(id) {
86
- return fetch(this._flowUrl + "/" + id + "/back", {
89
+ return fetch(this._flowUrl + "/" + encodeURIComponent(id) + "/back", {
87
90
  method: "POST",
88
91
  headers: this.headers(),
89
92
  }).then(handleResponse);
90
93
  }
91
94
 
92
95
  async putStepValues(id, stepId, values, action) {
93
- let url = this._flowUrl + "/" + id + "/" + stepId;
96
+ let url =
97
+ this._flowUrl +
98
+ "/" +
99
+ encodeURIComponent(id) +
100
+ "/" +
101
+ encodeURIComponent(stepId);
94
102
 
95
103
  if (action) {
96
104
  // If an action is provided then we need to add it to the URL
@@ -106,16 +114,13 @@ export class FlowExecutor {
106
114
  }
107
115
 
108
116
  async callback(id, stepId, element, callbackName, values) {
109
- let url =
110
- this._flowUrl +
111
- "/" +
112
- id +
113
- "/" +
114
- stepId +
115
- "/callback?element=" +
116
- element +
117
- "&callback=" +
118
- callbackName;
117
+ const query = new URLSearchParams({
118
+ element,
119
+ callback: callbackName,
120
+ }).toString();
121
+ const url = `${this._flowUrl}/${encodeURIComponent(
122
+ id
123
+ )}/${encodeURIComponent(stepId)}/callback?${query}`;
119
124
 
120
125
  return await fetch(url, {
121
126
  method: "POST",