@fedify/uri-template 2.5.0-dev.2619 → 2.5.0-dev.2664
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/mod.cjs +2 -2
- package/dist/mod.js +2 -2
- package/package.json +1 -1
package/dist/mod.cjs
CHANGED
|
@@ -206,7 +206,7 @@ var NestedOpeningBraceError = class extends TemplateParseError {
|
|
|
206
206
|
var InvalidLiteralError = class extends TemplateParseError {
|
|
207
207
|
char;
|
|
208
208
|
constructor(template, position, char) {
|
|
209
|
-
super(template, position, `Pct-encode '${char}' (e.g. '%${char.charCodeAt(0).toString(16).toUpperCase().padStart(2, "0")}') or remove it. Literals may not contain CTL, SP, '
|
|
209
|
+
super(template, position, `Pct-encode '${char}' (e.g. '%${char.charCodeAt(0).toString(16).toUpperCase().padStart(2, "0")}') or remove it. Literals may not contain CTL, SP, '"', '\\'', lone '%', '<', '>', '\\\\', '^', '\`', or '|'.`, `Invalid literal character '${char}'`);
|
|
210
210
|
this.char = char;
|
|
211
211
|
this.name = "InvalidLiteralError";
|
|
212
212
|
}
|
|
@@ -609,7 +609,7 @@ function expandAssociative(varSpec, pairs, spec) {
|
|
|
609
609
|
return [expandNamedPair(key, item, spec)];
|
|
610
610
|
}
|
|
611
611
|
const expandNamedPair = (key, item, spec) => item === "" ? `${key}${spec.ifEmpty}` : `${key}=${item}`;
|
|
612
|
-
const encodeListMembers = (value, allowReserved) => value.
|
|
612
|
+
const encodeListMembers = (value, allowReserved) => value.flatMap((item) => item == null ? [] : [String(item)]).map(encodeValue(allowReserved));
|
|
613
613
|
const encodeAssociativePairs = (value, allowReserved) => Object.entries(value).map(([key, item]) => [key, normalizePairValue(item)]).filter(([, normalized]) => normalized != null).map((kv) => kv.map(encodeValue(allowReserved)));
|
|
614
614
|
function normalizePairValue(value) {
|
|
615
615
|
if (value == null) return null;
|
package/dist/mod.js
CHANGED
|
@@ -205,7 +205,7 @@ var NestedOpeningBraceError = class extends TemplateParseError {
|
|
|
205
205
|
var InvalidLiteralError = class extends TemplateParseError {
|
|
206
206
|
char;
|
|
207
207
|
constructor(template, position, char) {
|
|
208
|
-
super(template, position, `Pct-encode '${char}' (e.g. '%${char.charCodeAt(0).toString(16).toUpperCase().padStart(2, "0")}') or remove it. Literals may not contain CTL, SP, '
|
|
208
|
+
super(template, position, `Pct-encode '${char}' (e.g. '%${char.charCodeAt(0).toString(16).toUpperCase().padStart(2, "0")}') or remove it. Literals may not contain CTL, SP, '"', '\\'', lone '%', '<', '>', '\\\\', '^', '\`', or '|'.`, `Invalid literal character '${char}'`);
|
|
209
209
|
this.char = char;
|
|
210
210
|
this.name = "InvalidLiteralError";
|
|
211
211
|
}
|
|
@@ -608,7 +608,7 @@ function expandAssociative(varSpec, pairs, spec) {
|
|
|
608
608
|
return [expandNamedPair(key, item, spec)];
|
|
609
609
|
}
|
|
610
610
|
const expandNamedPair = (key, item, spec) => item === "" ? `${key}${spec.ifEmpty}` : `${key}=${item}`;
|
|
611
|
-
const encodeListMembers = (value, allowReserved) => value.
|
|
611
|
+
const encodeListMembers = (value, allowReserved) => value.flatMap((item) => item == null ? [] : [String(item)]).map(encodeValue(allowReserved));
|
|
612
612
|
const encodeAssociativePairs = (value, allowReserved) => Object.entries(value).map(([key, item]) => [key, normalizePairValue(item)]).filter(([, normalized]) => normalized != null).map((kv) => kv.map(encodeValue(allowReserved)));
|
|
613
613
|
function normalizePairValue(value) {
|
|
614
614
|
if (value == null) return null;
|