@uniformdev/redirect 19.100.0 → 19.106.1-alpha.3
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 +8 -0
- package/dist/index.js +8 -0
- package/dist/index.mjs +8 -0
- package/package.json +3 -3
package/dist/index.esm.js
CHANGED
|
@@ -334,6 +334,7 @@ function mergeQueryStrings(qs1, qs2) {
|
|
|
334
334
|
var _RedirectClient = class _RedirectClient extends ApiClient {
|
|
335
335
|
constructor(options) {
|
|
336
336
|
super(options);
|
|
337
|
+
// Get a single redirect by ID or project map id
|
|
337
338
|
this.getRedirect = async (options) => {
|
|
338
339
|
var _a;
|
|
339
340
|
const { projectId } = this.options;
|
|
@@ -341,12 +342,14 @@ var _RedirectClient = class _RedirectClient extends ApiClient {
|
|
|
341
342
|
const results = await this.apiClient(fetchUri);
|
|
342
343
|
return (_a = results.redirects) == null ? void 0 : _a[0];
|
|
343
344
|
};
|
|
345
|
+
// Get redirects by list of IDs, source URL, target URL, or search
|
|
344
346
|
this.getRedirects = async (options) => {
|
|
345
347
|
const { projectId } = this.options;
|
|
346
348
|
const fetchUri = this.createUrl("/api/v1/redirect", { ...options, projectId });
|
|
347
349
|
const results = await this.apiClient(fetchUri);
|
|
348
350
|
return results;
|
|
349
351
|
};
|
|
352
|
+
// Assemble a trie powered search structure, used to have instant resolution of redirects. Note, result set may be large.
|
|
350
353
|
this.getRedirectTrie = async (options) => {
|
|
351
354
|
var _a, _b;
|
|
352
355
|
const { projectId } = this.options;
|
|
@@ -438,6 +441,8 @@ var _RedirectClient = class _RedirectClient extends ApiClient {
|
|
|
438
441
|
const trie = await this.getRedirectTrie();
|
|
439
442
|
return (_b = _RedirectClient.processHops(sanitizedUrl, trie, true, options)) == null ? void 0 : _b[0];
|
|
440
443
|
};
|
|
444
|
+
// Caculate redirect matches based on an incoming URL with an option to use a trie storage structure to streamline future
|
|
445
|
+
// redirect resolutions. Note this may cause a large in memory load for large collections of redirect, off by default.
|
|
441
446
|
this.processUrlAllMatches = async (url, options, useTrie) => {
|
|
442
447
|
const sanitizedUrl = url.endsWith("/") ? url.replace(/\/+$/, "") : url;
|
|
443
448
|
if (!useTrie) {
|
|
@@ -470,6 +475,7 @@ var _RedirectClient = class _RedirectClient extends ApiClient {
|
|
|
470
475
|
}
|
|
471
476
|
}
|
|
472
477
|
}
|
|
478
|
+
// Get all redirects in Uniform 500 at a time.
|
|
473
479
|
async *getAllRedirects(orderBy = "updated_at desc") {
|
|
474
480
|
var _a, _b;
|
|
475
481
|
const { projectId } = this.options;
|
|
@@ -518,6 +524,8 @@ var _RedirectClient = class _RedirectClient extends ApiClient {
|
|
|
518
524
|
}
|
|
519
525
|
return await _RedirectClient.assemblingPromise;
|
|
520
526
|
}
|
|
527
|
+
// Find all redirects involved for the current URL, this is for the case where a redirect definition leads to
|
|
528
|
+
// another redirect. This also involves cycle busting error handling
|
|
521
529
|
static processHops(initialUrl, trie, bestMatch, options) {
|
|
522
530
|
const url = (options == null ? void 0 : options.reverse) ? initialUrl.replace(/\/:/, "/~~") : initialUrl;
|
|
523
531
|
const isCycle = (id, result) => {
|
package/dist/index.js
CHANGED
|
@@ -380,6 +380,7 @@ function mergeQueryStrings(qs1, qs2) {
|
|
|
380
380
|
var _RedirectClient = class _RedirectClient extends import_api.ApiClient {
|
|
381
381
|
constructor(options) {
|
|
382
382
|
super(options);
|
|
383
|
+
// Get a single redirect by ID or project map id
|
|
383
384
|
this.getRedirect = async (options) => {
|
|
384
385
|
var _a;
|
|
385
386
|
const { projectId } = this.options;
|
|
@@ -387,12 +388,14 @@ var _RedirectClient = class _RedirectClient extends import_api.ApiClient {
|
|
|
387
388
|
const results = await this.apiClient(fetchUri);
|
|
388
389
|
return (_a = results.redirects) == null ? void 0 : _a[0];
|
|
389
390
|
};
|
|
391
|
+
// Get redirects by list of IDs, source URL, target URL, or search
|
|
390
392
|
this.getRedirects = async (options) => {
|
|
391
393
|
const { projectId } = this.options;
|
|
392
394
|
const fetchUri = this.createUrl("/api/v1/redirect", { ...options, projectId });
|
|
393
395
|
const results = await this.apiClient(fetchUri);
|
|
394
396
|
return results;
|
|
395
397
|
};
|
|
398
|
+
// Assemble a trie powered search structure, used to have instant resolution of redirects. Note, result set may be large.
|
|
396
399
|
this.getRedirectTrie = async (options) => {
|
|
397
400
|
var _a, _b;
|
|
398
401
|
const { projectId } = this.options;
|
|
@@ -484,6 +487,8 @@ var _RedirectClient = class _RedirectClient extends import_api.ApiClient {
|
|
|
484
487
|
const trie = await this.getRedirectTrie();
|
|
485
488
|
return (_b = _RedirectClient.processHops(sanitizedUrl, trie, true, options)) == null ? void 0 : _b[0];
|
|
486
489
|
};
|
|
490
|
+
// Caculate redirect matches based on an incoming URL with an option to use a trie storage structure to streamline future
|
|
491
|
+
// redirect resolutions. Note this may cause a large in memory load for large collections of redirect, off by default.
|
|
487
492
|
this.processUrlAllMatches = async (url, options, useTrie) => {
|
|
488
493
|
const sanitizedUrl = url.endsWith("/") ? url.replace(/\/+$/, "") : url;
|
|
489
494
|
if (!useTrie) {
|
|
@@ -516,6 +521,7 @@ var _RedirectClient = class _RedirectClient extends import_api.ApiClient {
|
|
|
516
521
|
}
|
|
517
522
|
}
|
|
518
523
|
}
|
|
524
|
+
// Get all redirects in Uniform 500 at a time.
|
|
519
525
|
async *getAllRedirects(orderBy = "updated_at desc") {
|
|
520
526
|
var _a, _b;
|
|
521
527
|
const { projectId } = this.options;
|
|
@@ -564,6 +570,8 @@ var _RedirectClient = class _RedirectClient extends import_api.ApiClient {
|
|
|
564
570
|
}
|
|
565
571
|
return await _RedirectClient.assemblingPromise;
|
|
566
572
|
}
|
|
573
|
+
// Find all redirects involved for the current URL, this is for the case where a redirect definition leads to
|
|
574
|
+
// another redirect. This also involves cycle busting error handling
|
|
567
575
|
static processHops(initialUrl, trie, bestMatch, options) {
|
|
568
576
|
const url = (options == null ? void 0 : options.reverse) ? initialUrl.replace(/\/:/, "/~~") : initialUrl;
|
|
569
577
|
const isCycle = (id, result) => {
|
package/dist/index.mjs
CHANGED
|
@@ -334,6 +334,7 @@ function mergeQueryStrings(qs1, qs2) {
|
|
|
334
334
|
var _RedirectClient = class _RedirectClient extends ApiClient {
|
|
335
335
|
constructor(options) {
|
|
336
336
|
super(options);
|
|
337
|
+
// Get a single redirect by ID or project map id
|
|
337
338
|
this.getRedirect = async (options) => {
|
|
338
339
|
var _a;
|
|
339
340
|
const { projectId } = this.options;
|
|
@@ -341,12 +342,14 @@ var _RedirectClient = class _RedirectClient extends ApiClient {
|
|
|
341
342
|
const results = await this.apiClient(fetchUri);
|
|
342
343
|
return (_a = results.redirects) == null ? void 0 : _a[0];
|
|
343
344
|
};
|
|
345
|
+
// Get redirects by list of IDs, source URL, target URL, or search
|
|
344
346
|
this.getRedirects = async (options) => {
|
|
345
347
|
const { projectId } = this.options;
|
|
346
348
|
const fetchUri = this.createUrl("/api/v1/redirect", { ...options, projectId });
|
|
347
349
|
const results = await this.apiClient(fetchUri);
|
|
348
350
|
return results;
|
|
349
351
|
};
|
|
352
|
+
// Assemble a trie powered search structure, used to have instant resolution of redirects. Note, result set may be large.
|
|
350
353
|
this.getRedirectTrie = async (options) => {
|
|
351
354
|
var _a, _b;
|
|
352
355
|
const { projectId } = this.options;
|
|
@@ -438,6 +441,8 @@ var _RedirectClient = class _RedirectClient extends ApiClient {
|
|
|
438
441
|
const trie = await this.getRedirectTrie();
|
|
439
442
|
return (_b = _RedirectClient.processHops(sanitizedUrl, trie, true, options)) == null ? void 0 : _b[0];
|
|
440
443
|
};
|
|
444
|
+
// Caculate redirect matches based on an incoming URL with an option to use a trie storage structure to streamline future
|
|
445
|
+
// redirect resolutions. Note this may cause a large in memory load for large collections of redirect, off by default.
|
|
441
446
|
this.processUrlAllMatches = async (url, options, useTrie) => {
|
|
442
447
|
const sanitizedUrl = url.endsWith("/") ? url.replace(/\/+$/, "") : url;
|
|
443
448
|
if (!useTrie) {
|
|
@@ -470,6 +475,7 @@ var _RedirectClient = class _RedirectClient extends ApiClient {
|
|
|
470
475
|
}
|
|
471
476
|
}
|
|
472
477
|
}
|
|
478
|
+
// Get all redirects in Uniform 500 at a time.
|
|
473
479
|
async *getAllRedirects(orderBy = "updated_at desc") {
|
|
474
480
|
var _a, _b;
|
|
475
481
|
const { projectId } = this.options;
|
|
@@ -518,6 +524,8 @@ var _RedirectClient = class _RedirectClient extends ApiClient {
|
|
|
518
524
|
}
|
|
519
525
|
return await _RedirectClient.assemblingPromise;
|
|
520
526
|
}
|
|
527
|
+
// Find all redirects involved for the current URL, this is for the case where a redirect definition leads to
|
|
528
|
+
// another redirect. This also involves cycle busting error handling
|
|
521
529
|
static processHops(initialUrl, trie, bestMatch, options) {
|
|
522
530
|
const url = (options == null ? void 0 : options.reverse) ? initialUrl.replace(/\/:/, "/~~") : initialUrl;
|
|
523
531
|
const isCycle = (id, result) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/redirect",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.106.1-alpha.3+47677ea6f",
|
|
4
4
|
"description": "Uniform redirect client",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -33,12 +33,12 @@
|
|
|
33
33
|
"/dist"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@uniformdev/context": "19.
|
|
36
|
+
"@uniformdev/context": "19.106.1-alpha.3+47677ea6f",
|
|
37
37
|
"p-limit": "^3.1.0",
|
|
38
38
|
"rfdc": "^1.3.0"
|
|
39
39
|
},
|
|
40
40
|
"publishConfig": {
|
|
41
41
|
"access": "public"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "47677ea6fd6eb707bb30eb20dc67e42573e0516d"
|
|
44
44
|
}
|