@fedify/uri-template 2.5.0-dev.2619 → 2.5.0-dev.2687
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.d.cts +3 -3
- package/dist/mod.d.ts +3 -3
- 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.d.cts
CHANGED
|
@@ -171,7 +171,7 @@ declare const OPERATORS: readonly ["", "+", ".", "/", ";", "?", "&", "#"];
|
|
|
171
171
|
/**
|
|
172
172
|
* Union of supported URI Template operators.
|
|
173
173
|
*/
|
|
174
|
-
type Operator = typeof OPERATORS[number];
|
|
174
|
+
type Operator = (typeof OPERATORS)[number];
|
|
175
175
|
//#endregion
|
|
176
176
|
//#region src/types.d.ts
|
|
177
177
|
/**
|
|
@@ -632,11 +632,11 @@ interface MinimalConstraint {
|
|
|
632
632
|
* The trailing `extends infer R ? R : never` is an identity that forces
|
|
633
633
|
* TypeScript to evaluate the conditional union eagerly.
|
|
634
634
|
*/
|
|
635
|
-
type ConstraintValue<C extends MinimalConstraint> = (
|
|
635
|
+
type ConstraintValue<C extends MinimalConstraint> = (C extends {
|
|
636
636
|
multiple: true;
|
|
637
637
|
} ? readonly string[] : string) | (C extends {
|
|
638
638
|
nullable: true;
|
|
639
|
-
} ? null : never)
|
|
639
|
+
} ? null : never) extends infer R ? R : never;
|
|
640
640
|
/**
|
|
641
641
|
* Computes the `values` record type from a map of variable constraints. An
|
|
642
642
|
* empty map (the default) widens to `Record<string, string>` because the
|
package/dist/mod.d.ts
CHANGED
|
@@ -171,7 +171,7 @@ declare const OPERATORS: readonly ["", "+", ".", "/", ";", "?", "&", "#"];
|
|
|
171
171
|
/**
|
|
172
172
|
* Union of supported URI Template operators.
|
|
173
173
|
*/
|
|
174
|
-
type Operator = typeof OPERATORS[number];
|
|
174
|
+
type Operator = (typeof OPERATORS)[number];
|
|
175
175
|
//#endregion
|
|
176
176
|
//#region src/types.d.ts
|
|
177
177
|
/**
|
|
@@ -632,11 +632,11 @@ interface MinimalConstraint {
|
|
|
632
632
|
* The trailing `extends infer R ? R : never` is an identity that forces
|
|
633
633
|
* TypeScript to evaluate the conditional union eagerly.
|
|
634
634
|
*/
|
|
635
|
-
type ConstraintValue<C extends MinimalConstraint> = (
|
|
635
|
+
type ConstraintValue<C extends MinimalConstraint> = (C extends {
|
|
636
636
|
multiple: true;
|
|
637
637
|
} ? readonly string[] : string) | (C extends {
|
|
638
638
|
nullable: true;
|
|
639
|
-
} ? null : never)
|
|
639
|
+
} ? null : never) extends infer R ? R : never;
|
|
640
640
|
/**
|
|
641
641
|
* Computes the `values` record type from a map of variable constraints. An
|
|
642
642
|
* empty map (the default) widens to `Record<string, string>` because the
|
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;
|