@reeve-iot/workflow-client 1.1.1 → 1.1.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.
- package/dist/client.js +8 -1
- package/dist/generate.js +2 -1
- package/package.json +1 -1
package/dist/client.js
CHANGED
|
@@ -32,7 +32,14 @@ function url(baseUrl, operation, route, args) {
|
|
|
32
32
|
query.append(name, String(value));
|
|
33
33
|
}
|
|
34
34
|
const search = query.toString();
|
|
35
|
-
return `${baseUrl
|
|
35
|
+
return `${withoutTrailingSlashes(baseUrl)}${path}${search === '' ? '' : `?${search}`}`;
|
|
36
|
+
}
|
|
37
|
+
/** Drops the trailing slashes of a base URL in one pass; a `/\/+$/` replace is quadratic on a run of slashes. */
|
|
38
|
+
function withoutTrailingSlashes(value) {
|
|
39
|
+
let end = value.length;
|
|
40
|
+
while (end > 0 && value.charCodeAt(end - 1) === 0x2f)
|
|
41
|
+
end--;
|
|
42
|
+
return value.slice(0, end);
|
|
36
43
|
}
|
|
37
44
|
function build(routes, options) {
|
|
38
45
|
const send = options.fetch ?? ((input, init) => globalThis.fetch(input, init));
|
package/dist/generate.js
CHANGED
|
@@ -36,7 +36,8 @@ export function translate(term) {
|
|
|
36
36
|
}
|
|
37
37
|
/** Strips the route constraints the server's template carries: `{id:guid}` is `{id}` to a caller. */
|
|
38
38
|
export function templateOf(path) {
|
|
39
|
-
|
|
39
|
+
// `[^{}]` and not `[^}]`: a constraint never opens a brace, and letting it would make the match quadratic on `{{0:`.
|
|
40
|
+
return `/${path.replace(/\{(\w+):[^{}]+\}/g, '{$1}')}`;
|
|
40
41
|
}
|
|
41
42
|
/** What one success resolves to, and whether the client should expect a body at all. */
|
|
42
43
|
export function successOf(endpoint) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reeve-iot/workflow-client",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "Typed HTTP client for the ReeveWorkflow endpoint surface. Generated from the surface the server publishes, so a signature change is a build error.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|