@uniformdev/redirect 19.29.1-alpha.19 → 19.29.1-alpha.24
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.esm.js +7 -12
- package/dist/index.js +7 -12
- package/dist/index.mjs +7 -12
- package/package.json +3 -3
package/dist/index.esm.js
CHANGED
|
@@ -209,14 +209,14 @@ var PathTrie = class {
|
|
|
209
209
|
});
|
|
210
210
|
}
|
|
211
211
|
getPropsStartingWithColon(cur).forEach((wildcard) => {
|
|
212
|
-
if (!processed.has(wildcard)) {
|
|
212
|
+
if (!processed.has(wildcard + i)) {
|
|
213
213
|
wildcards.push({
|
|
214
214
|
startTrie: cur[wildcard],
|
|
215
215
|
start: i,
|
|
216
216
|
active: false,
|
|
217
217
|
name: wildcard
|
|
218
218
|
});
|
|
219
|
-
processed.add(wildcard);
|
|
219
|
+
processed.add(wildcard + i);
|
|
220
220
|
}
|
|
221
221
|
});
|
|
222
222
|
if (Object.hasOwn(cur, segment)) {
|
|
@@ -414,7 +414,7 @@ var _RedirectClient = class _RedirectClient extends ApiClient {
|
|
|
414
414
|
metadata: redirect.metadata,
|
|
415
415
|
reverse: false
|
|
416
416
|
});
|
|
417
|
-
trie.insert(target.path, {
|
|
417
|
+
trie.insert(target.path.replace(/\/:/, "/~~"), {
|
|
418
418
|
redirect: redirect.redirect,
|
|
419
419
|
metadata: redirect.metadata,
|
|
420
420
|
reverse: true
|
|
@@ -426,8 +426,9 @@ var _RedirectClient = class _RedirectClient extends ApiClient {
|
|
|
426
426
|
}
|
|
427
427
|
return await _RedirectClient.assemblingPromise;
|
|
428
428
|
}
|
|
429
|
-
static processHops(
|
|
429
|
+
static processHops(initialUrl, trie, bestMatch, options) {
|
|
430
430
|
var _a;
|
|
431
|
+
const url = (options == null ? void 0 : options.reverse) ? initialUrl.replace(/\/:/, "/~~") : initialUrl;
|
|
431
432
|
const isCycle = (id, result) => {
|
|
432
433
|
var _a2;
|
|
433
434
|
if (!id || !result.lastHop)
|
|
@@ -472,13 +473,7 @@ var _RedirectClient = class _RedirectClient extends ApiClient {
|
|
|
472
473
|
}
|
|
473
474
|
static processHop(url, trie, bestMatch, options) {
|
|
474
475
|
const processedUrl = processUrl(url);
|
|
475
|
-
|
|
476
|
-
if (!(definition == null ? void 0 : definition.length)) {
|
|
477
|
-
definition = trie.find(processedUrl.path + processedUrl.query, bestMatch);
|
|
478
|
-
}
|
|
479
|
-
if (!(definition == null ? void 0 : definition.length)) {
|
|
480
|
-
definition = trie.find(processedUrl.path, bestMatch);
|
|
481
|
-
}
|
|
476
|
+
const definition = trie.find(processedUrl.path, false);
|
|
482
477
|
if (definition == null ? void 0 : definition.length) {
|
|
483
478
|
return definition.filter(
|
|
484
479
|
(def) => def.data.reverse === Boolean(options == null ? void 0 : options.reverse) && _RedirectClient.validateRedirect(url, def.data.redirect)
|
|
@@ -501,7 +496,7 @@ var _RedirectClient = class _RedirectClient extends ApiClient {
|
|
|
501
496
|
const redirect = definition == null ? void 0 : definition.redirect;
|
|
502
497
|
if (redirect.sourceMustMatchDomain && processedUrl.domain !== processedResult.domain)
|
|
503
498
|
return void 0;
|
|
504
|
-
const finalUrl = _RedirectClient.getTargetVariableExpandedUrl(processedUrl.url, redirect);
|
|
499
|
+
const finalUrl = (options == null ? void 0 : options.reverse) ? "n/a" : _RedirectClient.getTargetVariableExpandedUrl(processedUrl.url, redirect);
|
|
505
500
|
return {
|
|
506
501
|
url: finalUrl,
|
|
507
502
|
definition,
|
package/dist/index.js
CHANGED
|
@@ -536,14 +536,14 @@ var PathTrie = class {
|
|
|
536
536
|
});
|
|
537
537
|
}
|
|
538
538
|
getPropsStartingWithColon(cur).forEach((wildcard) => {
|
|
539
|
-
if (!processed.has(wildcard)) {
|
|
539
|
+
if (!processed.has(wildcard + i)) {
|
|
540
540
|
wildcards.push({
|
|
541
541
|
startTrie: cur[wildcard],
|
|
542
542
|
start: i,
|
|
543
543
|
active: false,
|
|
544
544
|
name: wildcard
|
|
545
545
|
});
|
|
546
|
-
processed.add(wildcard);
|
|
546
|
+
processed.add(wildcard + i);
|
|
547
547
|
}
|
|
548
548
|
});
|
|
549
549
|
if (Object.hasOwn(cur, segment)) {
|
|
@@ -741,7 +741,7 @@ var _RedirectClient = class _RedirectClient extends import_api.ApiClient {
|
|
|
741
741
|
metadata: redirect.metadata,
|
|
742
742
|
reverse: false
|
|
743
743
|
});
|
|
744
|
-
trie.insert(target.path, {
|
|
744
|
+
trie.insert(target.path.replace(/\/:/, "/~~"), {
|
|
745
745
|
redirect: redirect.redirect,
|
|
746
746
|
metadata: redirect.metadata,
|
|
747
747
|
reverse: true
|
|
@@ -753,8 +753,9 @@ var _RedirectClient = class _RedirectClient extends import_api.ApiClient {
|
|
|
753
753
|
}
|
|
754
754
|
return await _RedirectClient.assemblingPromise;
|
|
755
755
|
}
|
|
756
|
-
static processHops(
|
|
756
|
+
static processHops(initialUrl, trie, bestMatch, options) {
|
|
757
757
|
var _a;
|
|
758
|
+
const url = (options == null ? void 0 : options.reverse) ? initialUrl.replace(/\/:/, "/~~") : initialUrl;
|
|
758
759
|
const isCycle = (id, result) => {
|
|
759
760
|
var _a2;
|
|
760
761
|
if (!id || !result.lastHop)
|
|
@@ -799,13 +800,7 @@ var _RedirectClient = class _RedirectClient extends import_api.ApiClient {
|
|
|
799
800
|
}
|
|
800
801
|
static processHop(url, trie, bestMatch, options) {
|
|
801
802
|
const processedUrl = processUrl(url);
|
|
802
|
-
|
|
803
|
-
if (!(definition == null ? void 0 : definition.length)) {
|
|
804
|
-
definition = trie.find(processedUrl.path + processedUrl.query, bestMatch);
|
|
805
|
-
}
|
|
806
|
-
if (!(definition == null ? void 0 : definition.length)) {
|
|
807
|
-
definition = trie.find(processedUrl.path, bestMatch);
|
|
808
|
-
}
|
|
803
|
+
const definition = trie.find(processedUrl.path, false);
|
|
809
804
|
if (definition == null ? void 0 : definition.length) {
|
|
810
805
|
return definition.filter(
|
|
811
806
|
(def) => def.data.reverse === Boolean(options == null ? void 0 : options.reverse) && _RedirectClient.validateRedirect(url, def.data.redirect)
|
|
@@ -828,7 +823,7 @@ var _RedirectClient = class _RedirectClient extends import_api.ApiClient {
|
|
|
828
823
|
const redirect = definition == null ? void 0 : definition.redirect;
|
|
829
824
|
if (redirect.sourceMustMatchDomain && processedUrl.domain !== processedResult.domain)
|
|
830
825
|
return void 0;
|
|
831
|
-
const finalUrl = _RedirectClient.getTargetVariableExpandedUrl(processedUrl.url, redirect);
|
|
826
|
+
const finalUrl = (options == null ? void 0 : options.reverse) ? "n/a" : _RedirectClient.getTargetVariableExpandedUrl(processedUrl.url, redirect);
|
|
832
827
|
return {
|
|
833
828
|
url: finalUrl,
|
|
834
829
|
definition,
|
package/dist/index.mjs
CHANGED
|
@@ -209,14 +209,14 @@ var PathTrie = class {
|
|
|
209
209
|
});
|
|
210
210
|
}
|
|
211
211
|
getPropsStartingWithColon(cur).forEach((wildcard) => {
|
|
212
|
-
if (!processed.has(wildcard)) {
|
|
212
|
+
if (!processed.has(wildcard + i)) {
|
|
213
213
|
wildcards.push({
|
|
214
214
|
startTrie: cur[wildcard],
|
|
215
215
|
start: i,
|
|
216
216
|
active: false,
|
|
217
217
|
name: wildcard
|
|
218
218
|
});
|
|
219
|
-
processed.add(wildcard);
|
|
219
|
+
processed.add(wildcard + i);
|
|
220
220
|
}
|
|
221
221
|
});
|
|
222
222
|
if (Object.hasOwn(cur, segment)) {
|
|
@@ -414,7 +414,7 @@ var _RedirectClient = class _RedirectClient extends ApiClient {
|
|
|
414
414
|
metadata: redirect.metadata,
|
|
415
415
|
reverse: false
|
|
416
416
|
});
|
|
417
|
-
trie.insert(target.path, {
|
|
417
|
+
trie.insert(target.path.replace(/\/:/, "/~~"), {
|
|
418
418
|
redirect: redirect.redirect,
|
|
419
419
|
metadata: redirect.metadata,
|
|
420
420
|
reverse: true
|
|
@@ -426,8 +426,9 @@ var _RedirectClient = class _RedirectClient extends ApiClient {
|
|
|
426
426
|
}
|
|
427
427
|
return await _RedirectClient.assemblingPromise;
|
|
428
428
|
}
|
|
429
|
-
static processHops(
|
|
429
|
+
static processHops(initialUrl, trie, bestMatch, options) {
|
|
430
430
|
var _a;
|
|
431
|
+
const url = (options == null ? void 0 : options.reverse) ? initialUrl.replace(/\/:/, "/~~") : initialUrl;
|
|
431
432
|
const isCycle = (id, result) => {
|
|
432
433
|
var _a2;
|
|
433
434
|
if (!id || !result.lastHop)
|
|
@@ -472,13 +473,7 @@ var _RedirectClient = class _RedirectClient extends ApiClient {
|
|
|
472
473
|
}
|
|
473
474
|
static processHop(url, trie, bestMatch, options) {
|
|
474
475
|
const processedUrl = processUrl(url);
|
|
475
|
-
|
|
476
|
-
if (!(definition == null ? void 0 : definition.length)) {
|
|
477
|
-
definition = trie.find(processedUrl.path + processedUrl.query, bestMatch);
|
|
478
|
-
}
|
|
479
|
-
if (!(definition == null ? void 0 : definition.length)) {
|
|
480
|
-
definition = trie.find(processedUrl.path, bestMatch);
|
|
481
|
-
}
|
|
476
|
+
const definition = trie.find(processedUrl.path, false);
|
|
482
477
|
if (definition == null ? void 0 : definition.length) {
|
|
483
478
|
return definition.filter(
|
|
484
479
|
(def) => def.data.reverse === Boolean(options == null ? void 0 : options.reverse) && _RedirectClient.validateRedirect(url, def.data.redirect)
|
|
@@ -501,7 +496,7 @@ var _RedirectClient = class _RedirectClient extends ApiClient {
|
|
|
501
496
|
const redirect = definition == null ? void 0 : definition.redirect;
|
|
502
497
|
if (redirect.sourceMustMatchDomain && processedUrl.domain !== processedResult.domain)
|
|
503
498
|
return void 0;
|
|
504
|
-
const finalUrl = _RedirectClient.getTargetVariableExpandedUrl(processedUrl.url, redirect);
|
|
499
|
+
const finalUrl = (options == null ? void 0 : options.reverse) ? "n/a" : _RedirectClient.getTargetVariableExpandedUrl(processedUrl.url, redirect);
|
|
505
500
|
return {
|
|
506
501
|
url: finalUrl,
|
|
507
502
|
definition,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/redirect",
|
|
3
|
-
"version": "19.29.1-alpha.
|
|
3
|
+
"version": "19.29.1-alpha.24+52c8819dc",
|
|
4
4
|
"description": "Uniform redirect client",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -32,12 +32,12 @@
|
|
|
32
32
|
"/dist"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@uniformdev/context": "19.29.1-alpha.
|
|
35
|
+
"@uniformdev/context": "19.29.1-alpha.24+52c8819dc",
|
|
36
36
|
"p-limit": "^3.1.0",
|
|
37
37
|
"rfdc": "^1.3.0"
|
|
38
38
|
},
|
|
39
39
|
"publishConfig": {
|
|
40
40
|
"access": "public"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "52c8819dc742c4f4816246468258f11ed6294862"
|
|
43
43
|
}
|