@uniformdev/project-map 19.36.1-alpha.4 → 19.36.1-alpha.61
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/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.esm.js +26 -3
- package/dist/index.js +26 -3
- package/dist/index.mjs +26 -3
- package/package.json +4 -4
package/dist/index.d.mts
CHANGED
|
@@ -617,8 +617,10 @@ type UnmatchedRoute = {
|
|
|
617
617
|
match: false;
|
|
618
618
|
};
|
|
619
619
|
type ExpandOptions = {
|
|
620
|
-
dynamicInputValues?: Record<string, string>;
|
|
620
|
+
dynamicInputValues?: Record<string, string | number | boolean>;
|
|
621
621
|
allowedQueryParams?: Array<string>;
|
|
622
|
+
/** Prevents URL-escaping of variable expressions of the form ${...} in the expand result */
|
|
623
|
+
doNotEscapeVariables?: boolean;
|
|
622
624
|
};
|
|
623
625
|
declare class Route {
|
|
624
626
|
#private;
|
package/dist/index.d.ts
CHANGED
|
@@ -617,8 +617,10 @@ type UnmatchedRoute = {
|
|
|
617
617
|
match: false;
|
|
618
618
|
};
|
|
619
619
|
type ExpandOptions = {
|
|
620
|
-
dynamicInputValues?: Record<string, string>;
|
|
620
|
+
dynamicInputValues?: Record<string, string | number | boolean>;
|
|
621
621
|
allowedQueryParams?: Array<string>;
|
|
622
|
+
/** Prevents URL-escaping of variable expressions of the form ${...} in the expand result */
|
|
623
|
+
doNotEscapeVariables?: boolean;
|
|
622
624
|
};
|
|
623
625
|
declare class Route {
|
|
624
626
|
#private;
|
package/dist/index.esm.js
CHANGED
|
@@ -193,6 +193,7 @@ var cutReferences = (node) => node ? {
|
|
|
193
193
|
} : void 0;
|
|
194
194
|
|
|
195
195
|
// src/util/Route.ts
|
|
196
|
+
import { createVariableReference, parseVariableExpression } from "@uniformdev/canvas";
|
|
196
197
|
var _routeInfo, _parseRouteOrPath, parseRouteOrPath_fn, _isDynamicRouteSegment, isDynamicRouteSegment_fn;
|
|
197
198
|
var _Route = class _Route {
|
|
198
199
|
constructor(route) {
|
|
@@ -244,7 +245,7 @@ var _Route = class _Route {
|
|
|
244
245
|
* Creates an expanded path value for this route given dynamic input values and allowed query string values
|
|
245
246
|
*/
|
|
246
247
|
expand(options) {
|
|
247
|
-
const { dynamicInputValues = {}, allowedQueryParams = [] } = options != null ? options : {};
|
|
248
|
+
const { dynamicInputValues = {}, allowedQueryParams = [], doNotEscapeVariables = false } = options != null ? options : {};
|
|
248
249
|
const path = __privateGet(this, _routeInfo).segments.map((segment) => {
|
|
249
250
|
const dynamicSegmentName = _Route.getDynamicRouteSegmentName(segment);
|
|
250
251
|
if (!dynamicSegmentName) {
|
|
@@ -261,9 +262,17 @@ var _Route = class _Route {
|
|
|
261
262
|
);
|
|
262
263
|
return segment;
|
|
263
264
|
}
|
|
264
|
-
return
|
|
265
|
+
return encodeRouteComponent(dynamicSegmentValue, doNotEscapeVariables);
|
|
265
266
|
}).join("/");
|
|
266
|
-
const queries = allowedQueryParams.filter((qs) =>
|
|
267
|
+
const queries = allowedQueryParams.filter((qs) => {
|
|
268
|
+
const type = typeof dynamicInputValues[qs];
|
|
269
|
+
return type === "string" || type === "number" || type === "boolean";
|
|
270
|
+
}).map(
|
|
271
|
+
(qs) => `${encodeRouteComponent(qs, doNotEscapeVariables)}=${encodeRouteComponent(
|
|
272
|
+
dynamicInputValues[qs],
|
|
273
|
+
doNotEscapeVariables
|
|
274
|
+
)}`
|
|
275
|
+
);
|
|
267
276
|
const query = queries.length ? `?${queries.join("&")}` : "";
|
|
268
277
|
return `/${path}${query}`;
|
|
269
278
|
}
|
|
@@ -295,6 +304,20 @@ __privateAdd(_Route, _parseRouteOrPath);
|
|
|
295
304
|
__privateAdd(_Route, _isDynamicRouteSegment);
|
|
296
305
|
_Route.dynamicSegmentPrefix = ":";
|
|
297
306
|
var Route = _Route;
|
|
307
|
+
function encodeRouteComponent(value, doNotEscapeVariables) {
|
|
308
|
+
if (!doNotEscapeVariables) {
|
|
309
|
+
return encodeURIComponent(value);
|
|
310
|
+
}
|
|
311
|
+
const result = [];
|
|
312
|
+
parseVariableExpression(value.toString(10), (token, type) => {
|
|
313
|
+
if (type === "variable") {
|
|
314
|
+
result.push(createVariableReference(token));
|
|
315
|
+
} else {
|
|
316
|
+
result.push(encodeURIComponent(token));
|
|
317
|
+
}
|
|
318
|
+
});
|
|
319
|
+
return result.join("");
|
|
320
|
+
}
|
|
298
321
|
export {
|
|
299
322
|
ProjectMapClient,
|
|
300
323
|
ROOT_NODE_PATH,
|
package/dist/index.js
CHANGED
|
@@ -221,6 +221,7 @@ var cutReferences = (node) => node ? {
|
|
|
221
221
|
} : void 0;
|
|
222
222
|
|
|
223
223
|
// src/util/Route.ts
|
|
224
|
+
var import_canvas = require("@uniformdev/canvas");
|
|
224
225
|
var _routeInfo, _parseRouteOrPath, parseRouteOrPath_fn, _isDynamicRouteSegment, isDynamicRouteSegment_fn;
|
|
225
226
|
var _Route = class _Route {
|
|
226
227
|
constructor(route) {
|
|
@@ -272,7 +273,7 @@ var _Route = class _Route {
|
|
|
272
273
|
* Creates an expanded path value for this route given dynamic input values and allowed query string values
|
|
273
274
|
*/
|
|
274
275
|
expand(options) {
|
|
275
|
-
const { dynamicInputValues = {}, allowedQueryParams = [] } = options != null ? options : {};
|
|
276
|
+
const { dynamicInputValues = {}, allowedQueryParams = [], doNotEscapeVariables = false } = options != null ? options : {};
|
|
276
277
|
const path = __privateGet(this, _routeInfo).segments.map((segment) => {
|
|
277
278
|
const dynamicSegmentName = _Route.getDynamicRouteSegmentName(segment);
|
|
278
279
|
if (!dynamicSegmentName) {
|
|
@@ -289,9 +290,17 @@ var _Route = class _Route {
|
|
|
289
290
|
);
|
|
290
291
|
return segment;
|
|
291
292
|
}
|
|
292
|
-
return
|
|
293
|
+
return encodeRouteComponent(dynamicSegmentValue, doNotEscapeVariables);
|
|
293
294
|
}).join("/");
|
|
294
|
-
const queries = allowedQueryParams.filter((qs) =>
|
|
295
|
+
const queries = allowedQueryParams.filter((qs) => {
|
|
296
|
+
const type = typeof dynamicInputValues[qs];
|
|
297
|
+
return type === "string" || type === "number" || type === "boolean";
|
|
298
|
+
}).map(
|
|
299
|
+
(qs) => `${encodeRouteComponent(qs, doNotEscapeVariables)}=${encodeRouteComponent(
|
|
300
|
+
dynamicInputValues[qs],
|
|
301
|
+
doNotEscapeVariables
|
|
302
|
+
)}`
|
|
303
|
+
);
|
|
295
304
|
const query = queries.length ? `?${queries.join("&")}` : "";
|
|
296
305
|
return `/${path}${query}`;
|
|
297
306
|
}
|
|
@@ -323,6 +332,20 @@ __privateAdd(_Route, _parseRouteOrPath);
|
|
|
323
332
|
__privateAdd(_Route, _isDynamicRouteSegment);
|
|
324
333
|
_Route.dynamicSegmentPrefix = ":";
|
|
325
334
|
var Route = _Route;
|
|
335
|
+
function encodeRouteComponent(value, doNotEscapeVariables) {
|
|
336
|
+
if (!doNotEscapeVariables) {
|
|
337
|
+
return encodeURIComponent(value);
|
|
338
|
+
}
|
|
339
|
+
const result = [];
|
|
340
|
+
(0, import_canvas.parseVariableExpression)(value.toString(10), (token, type) => {
|
|
341
|
+
if (type === "variable") {
|
|
342
|
+
result.push((0, import_canvas.createVariableReference)(token));
|
|
343
|
+
} else {
|
|
344
|
+
result.push(encodeURIComponent(token));
|
|
345
|
+
}
|
|
346
|
+
});
|
|
347
|
+
return result.join("");
|
|
348
|
+
}
|
|
326
349
|
// Annotate the CommonJS export names for ESM import in node:
|
|
327
350
|
0 && (module.exports = {
|
|
328
351
|
ProjectMapClient,
|
package/dist/index.mjs
CHANGED
|
@@ -193,6 +193,7 @@ var cutReferences = (node) => node ? {
|
|
|
193
193
|
} : void 0;
|
|
194
194
|
|
|
195
195
|
// src/util/Route.ts
|
|
196
|
+
import { createVariableReference, parseVariableExpression } from "@uniformdev/canvas";
|
|
196
197
|
var _routeInfo, _parseRouteOrPath, parseRouteOrPath_fn, _isDynamicRouteSegment, isDynamicRouteSegment_fn;
|
|
197
198
|
var _Route = class _Route {
|
|
198
199
|
constructor(route) {
|
|
@@ -244,7 +245,7 @@ var _Route = class _Route {
|
|
|
244
245
|
* Creates an expanded path value for this route given dynamic input values and allowed query string values
|
|
245
246
|
*/
|
|
246
247
|
expand(options) {
|
|
247
|
-
const { dynamicInputValues = {}, allowedQueryParams = [] } = options != null ? options : {};
|
|
248
|
+
const { dynamicInputValues = {}, allowedQueryParams = [], doNotEscapeVariables = false } = options != null ? options : {};
|
|
248
249
|
const path = __privateGet(this, _routeInfo).segments.map((segment) => {
|
|
249
250
|
const dynamicSegmentName = _Route.getDynamicRouteSegmentName(segment);
|
|
250
251
|
if (!dynamicSegmentName) {
|
|
@@ -261,9 +262,17 @@ var _Route = class _Route {
|
|
|
261
262
|
);
|
|
262
263
|
return segment;
|
|
263
264
|
}
|
|
264
|
-
return
|
|
265
|
+
return encodeRouteComponent(dynamicSegmentValue, doNotEscapeVariables);
|
|
265
266
|
}).join("/");
|
|
266
|
-
const queries = allowedQueryParams.filter((qs) =>
|
|
267
|
+
const queries = allowedQueryParams.filter((qs) => {
|
|
268
|
+
const type = typeof dynamicInputValues[qs];
|
|
269
|
+
return type === "string" || type === "number" || type === "boolean";
|
|
270
|
+
}).map(
|
|
271
|
+
(qs) => `${encodeRouteComponent(qs, doNotEscapeVariables)}=${encodeRouteComponent(
|
|
272
|
+
dynamicInputValues[qs],
|
|
273
|
+
doNotEscapeVariables
|
|
274
|
+
)}`
|
|
275
|
+
);
|
|
267
276
|
const query = queries.length ? `?${queries.join("&")}` : "";
|
|
268
277
|
return `/${path}${query}`;
|
|
269
278
|
}
|
|
@@ -295,6 +304,20 @@ __privateAdd(_Route, _parseRouteOrPath);
|
|
|
295
304
|
__privateAdd(_Route, _isDynamicRouteSegment);
|
|
296
305
|
_Route.dynamicSegmentPrefix = ":";
|
|
297
306
|
var Route = _Route;
|
|
307
|
+
function encodeRouteComponent(value, doNotEscapeVariables) {
|
|
308
|
+
if (!doNotEscapeVariables) {
|
|
309
|
+
return encodeURIComponent(value);
|
|
310
|
+
}
|
|
311
|
+
const result = [];
|
|
312
|
+
parseVariableExpression(value.toString(10), (token, type) => {
|
|
313
|
+
if (type === "variable") {
|
|
314
|
+
result.push(createVariableReference(token));
|
|
315
|
+
} else {
|
|
316
|
+
result.push(encodeURIComponent(token));
|
|
317
|
+
}
|
|
318
|
+
});
|
|
319
|
+
return result.join("");
|
|
320
|
+
}
|
|
298
321
|
export {
|
|
299
322
|
ProjectMapClient,
|
|
300
323
|
ROOT_NODE_PATH,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/project-map",
|
|
3
|
-
"version": "19.36.1-alpha.
|
|
3
|
+
"version": "19.36.1-alpha.61+12e4e2a6e",
|
|
4
4
|
"description": "Uniform Project Map",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
"/dist"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@uniformdev/canvas": "19.36.1-alpha.
|
|
36
|
-
"@uniformdev/context": "19.36.1-alpha.
|
|
35
|
+
"@uniformdev/canvas": "19.36.1-alpha.61+12e4e2a6e",
|
|
36
|
+
"@uniformdev/context": "19.36.1-alpha.61+12e4e2a6e"
|
|
37
37
|
},
|
|
38
38
|
"publishConfig": {
|
|
39
39
|
"access": "public"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "12e4e2a6e17788b5337c4c0c90c094735d256c60"
|
|
42
42
|
}
|