@uniformdev/redirect 19.29.0 → 19.29.1-alpha.19

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.ts CHANGED
@@ -86,6 +86,7 @@ declare class RedirectClient extends ApiClient<RedirectClientOptions> {
86
86
  updatedBy?: string | undefined;
87
87
  createdAt?: string | undefined;
88
88
  createdBy?: string | undefined;
89
+ createdByName?: string | undefined;
89
90
  };
90
91
  total: number | undefined;
91
92
  }, void, unknown>;
@@ -270,8 +271,10 @@ interface components {
270
271
  updatedBy?: string;
271
272
  /** @description The time the redirect was created in UTC */
272
273
  createdAt?: string;
273
- /** @description The user who created this redirect or system */
274
+ /** @description The user who created this redirect */
274
275
  createdBy?: string;
276
+ /** @description The user who created this redirect's name */
277
+ createdByName?: string;
275
278
  };
276
279
  Redirect: {
277
280
  /**
package/dist/index.esm.js CHANGED
@@ -46,7 +46,7 @@ var RedirectClientCache = class {
46
46
  };
47
47
 
48
48
  // src/cache/withMemoryCache.ts
49
- var _WithMemoryCache = class extends RedirectClientCache {
49
+ var _WithMemoryCache = class _WithMemoryCache extends RedirectClientCache {
50
50
  constructor(options) {
51
51
  super(options);
52
52
  if (options.refreshRate && !_WithMemoryCache.refresher) {
@@ -89,16 +89,19 @@ var _WithMemoryCache = class extends RedirectClientCache {
89
89
  for (const key in _WithMemoryCache.trieCache) {
90
90
  const p = (_b = (_a = _WithMemoryCache.trieCache[key]) == null ? void 0 : _a.refresh) == null ? void 0 : _b.call(_a);
91
91
  if (p) {
92
- _WithMemoryCache.trieCache[key] = { ..._WithMemoryCache.trieCache[key], data: p };
93
- caches.push(p.then());
92
+ caches.push(
93
+ p.then(() => {
94
+ _WithMemoryCache.trieCache[key] = { ..._WithMemoryCache.trieCache[key], data: p };
95
+ })
96
+ );
94
97
  }
95
98
  }
96
99
  return Promise.all(caches);
97
100
  }
98
101
  };
99
- var WithMemoryCache = _WithMemoryCache;
100
102
  /* Memory static class level variable to store data across multiple instances of the redirect client */
101
- WithMemoryCache.trieCache = {};
103
+ _WithMemoryCache.trieCache = {};
104
+ var WithMemoryCache = _WithMemoryCache;
102
105
 
103
106
  // src/data/pathTrie.ts
104
107
  import rfdc from "rfdc";
@@ -178,7 +181,7 @@ var PathTrie = class {
178
181
  }
179
182
  return result;
180
183
  };
181
- const scanWildcards = (i) => {
184
+ const scanWildcards = () => {
182
185
  let wildcard = void 0;
183
186
  while ((!wildcard || wildcard.active) && wildcards.length) {
184
187
  wildcard = wildcards.pop();
@@ -188,7 +191,7 @@ var PathTrie = class {
188
191
  wildcard.active = true;
189
192
  cur = wildcard == null ? void 0 : wildcard.startTrie;
190
193
  wildcards.push(wildcard);
191
- if (i === segments.length - 1 && wildcards.length && wildcards[wildcards.length - 1].active && wildcards[wildcards.length - 1].startTrie[dataProp]) {
194
+ if (wildcards.length && wildcards[wildcards.length - 1].start === segments.length - 1 && wildcards[wildcards.length - 1].active && wildcards[wildcards.length - 1].startTrie[dataProp]) {
192
195
  wildcards[wildcards.length - 1].startTrie[dataProp].forEach(
193
196
  (d) => ret.push({ data: d, variables: getVariables() })
194
197
  );
@@ -222,20 +225,23 @@ var PathTrie = class {
222
225
  if (cur[dataProp]) {
223
226
  cur[dataProp].forEach((d) => ret.push({ data: d, variables: getVariables() }));
224
227
  } else {
225
- const more = scanWildcards(i);
228
+ const more = scanWildcards();
226
229
  if (typeof more === "undefined" || ret.length > 0 && bestMatch)
227
230
  return [...ret, ...splats];
228
231
  i = more;
229
232
  }
230
233
  }
231
234
  } else {
232
- const more = scanWildcards(i);
235
+ const more = scanWildcards();
233
236
  if (typeof more === "undefined" || ret.length > 0 && bestMatch)
234
237
  return [...ret, ...splats];
235
238
  i = more;
239
+ if (ret.length > 0 && bestMatch)
240
+ return [...ret, ...splats];
241
+ continue;
236
242
  }
237
243
  if (i === segments.length - 1 && wildcards.length !== 0) {
238
- const more = scanWildcards(i);
244
+ const more = scanWildcards();
239
245
  if (typeof more === "undefined" || ret.length > 0 && bestMatch)
240
246
  return [...ret, ...splats];
241
247
  i = more;
@@ -268,7 +274,7 @@ function processUrl(url) {
268
274
  }
269
275
 
270
276
  // src/redirectClient.ts
271
- var _RedirectClient = class extends ApiClient {
277
+ var _RedirectClient = class _RedirectClient extends ApiClient {
272
278
  constructor(options) {
273
279
  super(options);
274
280
  this.getRedirect = async (options) => {
@@ -569,15 +575,15 @@ var _RedirectClient = class extends ApiClient {
569
575
  return variables;
570
576
  }
571
577
  };
572
- var RedirectClient = _RedirectClient;
573
- RedirectClient.processUrlBestMatch = async (url, trie, options) => {
578
+ _RedirectClient.processUrlBestMatch = async (url, trie, options) => {
574
579
  var _a;
575
580
  return (_a = _RedirectClient.processHops(url, trie, true, options)) == null ? void 0 : _a[0];
576
581
  };
577
- RedirectClient.assembling = false;
578
- RedirectClient.assemblingPromise = new Promise(
582
+ _RedirectClient.assembling = false;
583
+ _RedirectClient.assemblingPromise = new Promise(
579
584
  () => new PathTrie()
580
585
  );
586
+ var RedirectClient = _RedirectClient;
581
587
  var UncachedRedirectClient = class extends RedirectClient {
582
588
  constructor(options) {
583
589
  super({ ...options, bypassCache: true });
package/dist/index.js CHANGED
@@ -103,6 +103,7 @@ var require_package = __commonJS({
103
103
  // ../../node_modules/.pnpm/dotenv@16.1.3/node_modules/dotenv/lib/main.js
104
104
  var require_main = __commonJS({
105
105
  "../../node_modules/.pnpm/dotenv@16.1.3/node_modules/dotenv/lib/main.js"(exports, module2) {
106
+ "use strict";
106
107
  var fs = require("fs");
107
108
  var path = require("path");
108
109
  var os = require("os");
@@ -372,7 +373,7 @@ var RedirectClientCache = class {
372
373
  };
373
374
 
374
375
  // src/cache/withMemoryCache.ts
375
- var _WithMemoryCache = class extends RedirectClientCache {
376
+ var _WithMemoryCache = class _WithMemoryCache extends RedirectClientCache {
376
377
  constructor(options) {
377
378
  super(options);
378
379
  if (options.refreshRate && !_WithMemoryCache.refresher) {
@@ -415,16 +416,19 @@ var _WithMemoryCache = class extends RedirectClientCache {
415
416
  for (const key in _WithMemoryCache.trieCache) {
416
417
  const p = (_b = (_a = _WithMemoryCache.trieCache[key]) == null ? void 0 : _a.refresh) == null ? void 0 : _b.call(_a);
417
418
  if (p) {
418
- _WithMemoryCache.trieCache[key] = { ..._WithMemoryCache.trieCache[key], data: p };
419
- caches.push(p.then());
419
+ caches.push(
420
+ p.then(() => {
421
+ _WithMemoryCache.trieCache[key] = { ..._WithMemoryCache.trieCache[key], data: p };
422
+ })
423
+ );
420
424
  }
421
425
  }
422
426
  return Promise.all(caches);
423
427
  }
424
428
  };
425
- var WithMemoryCache = _WithMemoryCache;
426
429
  /* Memory static class level variable to store data across multiple instances of the redirect client */
427
- WithMemoryCache.trieCache = {};
430
+ _WithMemoryCache.trieCache = {};
431
+ var WithMemoryCache = _WithMemoryCache;
428
432
 
429
433
  // src/data/pathTrie.ts
430
434
  var import_rfdc = __toESM(require("rfdc"));
@@ -504,7 +508,7 @@ var PathTrie = class {
504
508
  }
505
509
  return result;
506
510
  };
507
- const scanWildcards = (i) => {
511
+ const scanWildcards = () => {
508
512
  let wildcard = void 0;
509
513
  while ((!wildcard || wildcard.active) && wildcards.length) {
510
514
  wildcard = wildcards.pop();
@@ -514,7 +518,7 @@ var PathTrie = class {
514
518
  wildcard.active = true;
515
519
  cur = wildcard == null ? void 0 : wildcard.startTrie;
516
520
  wildcards.push(wildcard);
517
- if (i === segments.length - 1 && wildcards.length && wildcards[wildcards.length - 1].active && wildcards[wildcards.length - 1].startTrie[dataProp]) {
521
+ if (wildcards.length && wildcards[wildcards.length - 1].start === segments.length - 1 && wildcards[wildcards.length - 1].active && wildcards[wildcards.length - 1].startTrie[dataProp]) {
518
522
  wildcards[wildcards.length - 1].startTrie[dataProp].forEach(
519
523
  (d) => ret.push({ data: d, variables: getVariables() })
520
524
  );
@@ -548,20 +552,23 @@ var PathTrie = class {
548
552
  if (cur[dataProp]) {
549
553
  cur[dataProp].forEach((d) => ret.push({ data: d, variables: getVariables() }));
550
554
  } else {
551
- const more = scanWildcards(i);
555
+ const more = scanWildcards();
552
556
  if (typeof more === "undefined" || ret.length > 0 && bestMatch)
553
557
  return [...ret, ...splats];
554
558
  i = more;
555
559
  }
556
560
  }
557
561
  } else {
558
- const more = scanWildcards(i);
562
+ const more = scanWildcards();
559
563
  if (typeof more === "undefined" || ret.length > 0 && bestMatch)
560
564
  return [...ret, ...splats];
561
565
  i = more;
566
+ if (ret.length > 0 && bestMatch)
567
+ return [...ret, ...splats];
568
+ continue;
562
569
  }
563
570
  if (i === segments.length - 1 && wildcards.length !== 0) {
564
- const more = scanWildcards(i);
571
+ const more = scanWildcards();
565
572
  if (typeof more === "undefined" || ret.length > 0 && bestMatch)
566
573
  return [...ret, ...splats];
567
574
  i = more;
@@ -594,7 +601,7 @@ function processUrl(url) {
594
601
  }
595
602
 
596
603
  // src/redirectClient.ts
597
- var _RedirectClient = class extends import_api.ApiClient {
604
+ var _RedirectClient = class _RedirectClient extends import_api.ApiClient {
598
605
  constructor(options) {
599
606
  super(options);
600
607
  this.getRedirect = async (options) => {
@@ -895,15 +902,15 @@ var _RedirectClient = class extends import_api.ApiClient {
895
902
  return variables;
896
903
  }
897
904
  };
898
- var RedirectClient = _RedirectClient;
899
- RedirectClient.processUrlBestMatch = async (url, trie, options) => {
905
+ _RedirectClient.processUrlBestMatch = async (url, trie, options) => {
900
906
  var _a;
901
907
  return (_a = _RedirectClient.processHops(url, trie, true, options)) == null ? void 0 : _a[0];
902
908
  };
903
- RedirectClient.assembling = false;
904
- RedirectClient.assemblingPromise = new Promise(
909
+ _RedirectClient.assembling = false;
910
+ _RedirectClient.assemblingPromise = new Promise(
905
911
  () => new PathTrie()
906
912
  );
913
+ var RedirectClient = _RedirectClient;
907
914
  var UncachedRedirectClient = class extends RedirectClient {
908
915
  constructor(options) {
909
916
  super({ ...options, bypassCache: true });
package/dist/index.mjs CHANGED
@@ -46,7 +46,7 @@ var RedirectClientCache = class {
46
46
  };
47
47
 
48
48
  // src/cache/withMemoryCache.ts
49
- var _WithMemoryCache = class extends RedirectClientCache {
49
+ var _WithMemoryCache = class _WithMemoryCache extends RedirectClientCache {
50
50
  constructor(options) {
51
51
  super(options);
52
52
  if (options.refreshRate && !_WithMemoryCache.refresher) {
@@ -89,16 +89,19 @@ var _WithMemoryCache = class extends RedirectClientCache {
89
89
  for (const key in _WithMemoryCache.trieCache) {
90
90
  const p = (_b = (_a = _WithMemoryCache.trieCache[key]) == null ? void 0 : _a.refresh) == null ? void 0 : _b.call(_a);
91
91
  if (p) {
92
- _WithMemoryCache.trieCache[key] = { ..._WithMemoryCache.trieCache[key], data: p };
93
- caches.push(p.then());
92
+ caches.push(
93
+ p.then(() => {
94
+ _WithMemoryCache.trieCache[key] = { ..._WithMemoryCache.trieCache[key], data: p };
95
+ })
96
+ );
94
97
  }
95
98
  }
96
99
  return Promise.all(caches);
97
100
  }
98
101
  };
99
- var WithMemoryCache = _WithMemoryCache;
100
102
  /* Memory static class level variable to store data across multiple instances of the redirect client */
101
- WithMemoryCache.trieCache = {};
103
+ _WithMemoryCache.trieCache = {};
104
+ var WithMemoryCache = _WithMemoryCache;
102
105
 
103
106
  // src/data/pathTrie.ts
104
107
  import rfdc from "rfdc";
@@ -178,7 +181,7 @@ var PathTrie = class {
178
181
  }
179
182
  return result;
180
183
  };
181
- const scanWildcards = (i) => {
184
+ const scanWildcards = () => {
182
185
  let wildcard = void 0;
183
186
  while ((!wildcard || wildcard.active) && wildcards.length) {
184
187
  wildcard = wildcards.pop();
@@ -188,7 +191,7 @@ var PathTrie = class {
188
191
  wildcard.active = true;
189
192
  cur = wildcard == null ? void 0 : wildcard.startTrie;
190
193
  wildcards.push(wildcard);
191
- if (i === segments.length - 1 && wildcards.length && wildcards[wildcards.length - 1].active && wildcards[wildcards.length - 1].startTrie[dataProp]) {
194
+ if (wildcards.length && wildcards[wildcards.length - 1].start === segments.length - 1 && wildcards[wildcards.length - 1].active && wildcards[wildcards.length - 1].startTrie[dataProp]) {
192
195
  wildcards[wildcards.length - 1].startTrie[dataProp].forEach(
193
196
  (d) => ret.push({ data: d, variables: getVariables() })
194
197
  );
@@ -222,20 +225,23 @@ var PathTrie = class {
222
225
  if (cur[dataProp]) {
223
226
  cur[dataProp].forEach((d) => ret.push({ data: d, variables: getVariables() }));
224
227
  } else {
225
- const more = scanWildcards(i);
228
+ const more = scanWildcards();
226
229
  if (typeof more === "undefined" || ret.length > 0 && bestMatch)
227
230
  return [...ret, ...splats];
228
231
  i = more;
229
232
  }
230
233
  }
231
234
  } else {
232
- const more = scanWildcards(i);
235
+ const more = scanWildcards();
233
236
  if (typeof more === "undefined" || ret.length > 0 && bestMatch)
234
237
  return [...ret, ...splats];
235
238
  i = more;
239
+ if (ret.length > 0 && bestMatch)
240
+ return [...ret, ...splats];
241
+ continue;
236
242
  }
237
243
  if (i === segments.length - 1 && wildcards.length !== 0) {
238
- const more = scanWildcards(i);
244
+ const more = scanWildcards();
239
245
  if (typeof more === "undefined" || ret.length > 0 && bestMatch)
240
246
  return [...ret, ...splats];
241
247
  i = more;
@@ -268,7 +274,7 @@ function processUrl(url) {
268
274
  }
269
275
 
270
276
  // src/redirectClient.ts
271
- var _RedirectClient = class extends ApiClient {
277
+ var _RedirectClient = class _RedirectClient extends ApiClient {
272
278
  constructor(options) {
273
279
  super(options);
274
280
  this.getRedirect = async (options) => {
@@ -569,15 +575,15 @@ var _RedirectClient = class extends ApiClient {
569
575
  return variables;
570
576
  }
571
577
  };
572
- var RedirectClient = _RedirectClient;
573
- RedirectClient.processUrlBestMatch = async (url, trie, options) => {
578
+ _RedirectClient.processUrlBestMatch = async (url, trie, options) => {
574
579
  var _a;
575
580
  return (_a = _RedirectClient.processHops(url, trie, true, options)) == null ? void 0 : _a[0];
576
581
  };
577
- RedirectClient.assembling = false;
578
- RedirectClient.assemblingPromise = new Promise(
582
+ _RedirectClient.assembling = false;
583
+ _RedirectClient.assemblingPromise = new Promise(
579
584
  () => new PathTrie()
580
585
  );
586
+ var RedirectClient = _RedirectClient;
581
587
  var UncachedRedirectClient = class extends RedirectClient {
582
588
  constructor(options) {
583
589
  super({ ...options, bypassCache: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/redirect",
3
- "version": "19.29.0",
3
+ "version": "19.29.1-alpha.19+838467072",
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.0",
35
+ "@uniformdev/context": "19.29.1-alpha.19+838467072",
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": "f8e9d5f6283fb3d72ba095c0e307907dc591ce4a"
42
+ "gitHead": "8384670725623d7fab7ef04837c79491e7e45442"
43
43
  }