@fabriktor/client 0.0.77 → 0.0.79
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/src/core/path.js +6 -1
- package/package.json +2 -2
package/dist/src/core/path.js
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
4
4
|
// not use this file except in compliance with the License. You may obtain
|
|
5
5
|
// a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
-
import { PathActions } from "@fabriktor/schema";
|
|
6
|
+
import { PathActions, ZeroID } from "@fabriktor/schema";
|
|
7
|
+
import { errInvalidArgument } from "./err.js";
|
|
7
8
|
const pathSep = "/";
|
|
8
9
|
function clean(v) {
|
|
9
10
|
return v.replace(/^\/+|\/+$/g, "");
|
|
@@ -11,6 +12,10 @@ function clean(v) {
|
|
|
11
12
|
export function buildPath(opts) {
|
|
12
13
|
const out = [opts.svc, opts.col].map(clean);
|
|
13
14
|
if (opts.id !== undefined) {
|
|
15
|
+
// An explicit empty ID must not turn a record request into a collection request.
|
|
16
|
+
if (opts.id.trim() === ZeroID) {
|
|
17
|
+
throw errInvalidArgument({ msg: "Record path requires a nonempty ID." });
|
|
18
|
+
}
|
|
14
19
|
out.push(encodeURIComponent(opts.id));
|
|
15
20
|
}
|
|
16
21
|
if (opts.action !== undefined) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fabriktor/client",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.79",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -17,6 +17,6 @@
|
|
|
17
17
|
"typescript": "^6.0.3"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@fabriktor/schema": "0.0.
|
|
20
|
+
"@fabriktor/schema": "0.0.61"
|
|
21
21
|
}
|
|
22
22
|
}
|