@uniformdev/redirect
Advanced tools
Comparing version 19.173.2-alpha.8 to 19.173.2-alpha.210
@@ -211,6 +211,9 @@ "use strict"; | ||
const getVariables = () => { | ||
return wildcards.filter((wildcard) => Boolean(wildcard) && wildcard.active).reduce((variables, wildcard) => { | ||
variables[wildcard.name] = segments[wildcard.start]; | ||
return variables; | ||
}, new Object()); | ||
return wildcards.filter((wildcard) => Boolean(wildcard) && wildcard.active).reduce( | ||
(variables, wildcard) => { | ||
variables[wildcard.name] = segments[wildcard.start]; | ||
return variables; | ||
}, | ||
new Object() | ||
); | ||
}; | ||
@@ -217,0 +220,0 @@ const getPropsStartingWithColon = (obj) => { |
@@ -40,81 +40,2 @@ import { ClientOptions, ApiClient } from '@uniformdev/context/api'; | ||
type RedirectClientCacheOptions = { | ||
prePopulate?: boolean; | ||
refreshRate?: number; | ||
}; | ||
declare abstract class RedirectClientCache<RedirectClientCacheOptions> { | ||
options: RedirectClientCacheOptions; | ||
constructor(options: RedirectClientCacheOptions); | ||
abstract get(key: string): Promise<PathTrie<DirectionAwareRedirectDefinition>> | undefined; | ||
abstract set(key: string, data: Promise<PathTrie<DirectionAwareRedirectDefinition>>, refresh: () => Promise<PathTrie<DirectionAwareRedirectDefinition>>): void; | ||
abstract refresh(): Promise<void[]>; | ||
} | ||
type RedirectClientOptions = ClientOptions & { | ||
/** Caching mechanism used to hold redirect data payload for rapid retrieval */ | ||
dataCache?: RedirectClientCache<RedirectClientCacheOptions>; | ||
}; | ||
type RedirectOptions = { | ||
/** Reverse flips the direction of the search, instead of redirecting a source to a target you will be finding the source that could have produced a given target */ | ||
reverse?: boolean; | ||
/** Includes a label highlighting all wildcard variables with HTML em tags */ | ||
label?: boolean; | ||
}; | ||
declare class RedirectClient extends ApiClient<RedirectClientOptions> { | ||
constructor(options: RedirectClientOptions); | ||
getRedirect: (options: RedirectClientGetRedirect) => Promise<RedirectDefinition | undefined>; | ||
getRedirects: (options?: RedirectClientGetRedirects) => Promise<RedirectGetResponse>; | ||
getAllRedirects(orderBy?: RedirectClientGetRedirects['orderBy']): AsyncGenerator<{ | ||
redirect: { | ||
id?: string | undefined; | ||
sourceUrl: string; | ||
targetUrl: string; | ||
targetStatusCode: number; | ||
sourceProjectMapNodeId?: string | undefined; | ||
targetProjectMapNodeId?: string | undefined; | ||
projectMapId?: string | undefined; | ||
sourceRetainQuerystring?: boolean | undefined; | ||
sourceMustMatchDomain?: boolean | undefined; | ||
targetPreserveIncomingProtocol?: boolean | undefined; | ||
targetPreserveIncomingDomain?: boolean | undefined; | ||
targetMergeQuerystring?: boolean | undefined; | ||
labelAsSystem?: boolean | undefined; | ||
}; | ||
metadata: { | ||
updatedAt?: string | undefined; | ||
updatedBy?: string | undefined; | ||
createdAt?: string | undefined; | ||
createdBy?: string | undefined; | ||
createdByName?: string | undefined; | ||
}; | ||
total: number | undefined; | ||
}, void, unknown>; | ||
getRedirectTrie: (options?: { | ||
bypassDataCache?: boolean; | ||
}) => Promise<PathTrie<DirectionAwareRedirectDefinition>>; | ||
resetRedirectTrieDataCache: () => Promise<void>; | ||
upsertRedirect: (redirect: RedirectUpsertRequest['redirect']) => Promise<string>; | ||
deleteRedirect: (id: string) => Promise<string>; | ||
static processUrlBestMatch: (url: string, trie: PathTrie<DirectionAwareRedirectDefinition>, options?: RedirectOptions) => Promise<RedirectResult | undefined>; | ||
processUrlBestMatch: (url: string, options?: RedirectOptions, useTrie?: boolean) => Promise<RedirectResult | undefined>; | ||
processUrlAllMatches: (url: string, options?: RedirectOptions, useTrie?: boolean) => Promise<RedirectResult[]>; | ||
private static assembling; | ||
private static assemblingPromise; | ||
private assembleTrie; | ||
private static processHops; | ||
private static processHop; | ||
/** | ||
* Taking the url, found definition and variables and returning a redirect result object | ||
* @param processedUrl - Propertly formatted url input | ||
* @param definition - Redirect definition found to match the processed url | ||
* @param variables - Wildcard variables found during definition discovery | ||
* @param options - Different options available to the redirect engine | ||
*/ | ||
private static processDefinitionToResults; | ||
static validateRedirect(url: string, redirectDefinition: RedirectDefinition['redirect']): boolean; | ||
} | ||
declare class UncachedRedirectClient extends RedirectClient { | ||
constructor(options: Omit<RedirectClientOptions, 'bypassCache'>); | ||
} | ||
/** | ||
@@ -363,2 +284,61 @@ * This file was auto-generated by openapi-typescript. | ||
type RedirectClientCacheOptions = { | ||
prePopulate?: boolean; | ||
refreshRate?: number; | ||
}; | ||
declare abstract class RedirectClientCache<RedirectClientCacheOptions> { | ||
options: RedirectClientCacheOptions; | ||
constructor(options: RedirectClientCacheOptions); | ||
abstract get(key: string): Promise<PathTrie<DirectionAwareRedirectDefinition>> | undefined; | ||
abstract set(key: string, data: Promise<PathTrie<DirectionAwareRedirectDefinition>>, refresh: () => Promise<PathTrie<DirectionAwareRedirectDefinition>>): void; | ||
abstract refresh(): Promise<void[]>; | ||
} | ||
type RedirectClientOptions = ClientOptions & { | ||
/** Caching mechanism used to hold redirect data payload for rapid retrieval */ | ||
dataCache?: RedirectClientCache<RedirectClientCacheOptions>; | ||
}; | ||
type RedirectOptions = { | ||
/** Reverse flips the direction of the search, instead of redirecting a source to a target you will be finding the source that could have produced a given target */ | ||
reverse?: boolean; | ||
/** Includes a label highlighting all wildcard variables with HTML em tags */ | ||
label?: boolean; | ||
}; | ||
declare class RedirectClient extends ApiClient<RedirectClientOptions> { | ||
constructor(options: RedirectClientOptions); | ||
getRedirect: (options: RedirectClientGetRedirect) => Promise<RedirectDefinition | undefined>; | ||
getRedirects: (options?: RedirectClientGetRedirects) => Promise<RedirectGetResponse>; | ||
getAllRedirects(orderBy?: RedirectClientGetRedirects['orderBy']): AsyncGenerator<{ | ||
redirect: components["schemas"]["Redirect"]; | ||
metadata: components["schemas"]["RedirectMetadata"]; | ||
total: number | undefined; | ||
}, void, unknown>; | ||
getRedirectTrie: (options?: { | ||
bypassDataCache?: boolean; | ||
}) => Promise<PathTrie<DirectionAwareRedirectDefinition>>; | ||
resetRedirectTrieDataCache: () => Promise<void>; | ||
upsertRedirect: (redirect: RedirectUpsertRequest["redirect"]) => Promise<string>; | ||
deleteRedirect: (id: string) => Promise<string>; | ||
static processUrlBestMatch: (url: string, trie: PathTrie<DirectionAwareRedirectDefinition>, options?: RedirectOptions) => Promise<RedirectResult | undefined>; | ||
processUrlBestMatch: (url: string, options?: RedirectOptions, useTrie?: boolean) => Promise<RedirectResult | undefined>; | ||
processUrlAllMatches: (url: string, options?: RedirectOptions, useTrie?: boolean) => Promise<RedirectResult[]>; | ||
private static assembling; | ||
private static assemblingPromise; | ||
private assembleTrie; | ||
private static processHops; | ||
private static processHop; | ||
/** | ||
* Taking the url, found definition and variables and returning a redirect result object | ||
* @param processedUrl - Propertly formatted url input | ||
* @param definition - Redirect definition found to match the processed url | ||
* @param variables - Wildcard variables found during definition discovery | ||
* @param options - Different options available to the redirect engine | ||
*/ | ||
private static processDefinitionToResults; | ||
static validateRedirect(url: string, redirectDefinition: RedirectDefinition['redirect']): boolean; | ||
} | ||
declare class UncachedRedirectClient extends RedirectClient { | ||
constructor(options: Omit<RedirectClientOptions, 'bypassCache'>); | ||
} | ||
type RedirectUpsertRequest = paths['/api/v1/redirect']['put']['requestBody']['content']['application/json']; | ||
@@ -365,0 +345,0 @@ type RedirectDeleteRequest = paths['/api/v1/redirect']['delete']['requestBody']['content']['application/json']; |
@@ -165,6 +165,9 @@ // src/cache/data/refresher.ts | ||
const getVariables = () => { | ||
return wildcards.filter((wildcard) => Boolean(wildcard) && wildcard.active).reduce((variables, wildcard) => { | ||
variables[wildcard.name] = segments[wildcard.start]; | ||
return variables; | ||
}, new Object()); | ||
return wildcards.filter((wildcard) => Boolean(wildcard) && wildcard.active).reduce( | ||
(variables, wildcard) => { | ||
variables[wildcard.name] = segments[wildcard.start]; | ||
return variables; | ||
}, | ||
new Object() | ||
); | ||
}; | ||
@@ -171,0 +174,0 @@ const getPropsStartingWithColon = (obj) => { |
@@ -211,6 +211,9 @@ "use strict"; | ||
const getVariables = () => { | ||
return wildcards.filter((wildcard) => Boolean(wildcard) && wildcard.active).reduce((variables, wildcard) => { | ||
variables[wildcard.name] = segments[wildcard.start]; | ||
return variables; | ||
}, new Object()); | ||
return wildcards.filter((wildcard) => Boolean(wildcard) && wildcard.active).reduce( | ||
(variables, wildcard) => { | ||
variables[wildcard.name] = segments[wildcard.start]; | ||
return variables; | ||
}, | ||
new Object() | ||
); | ||
}; | ||
@@ -217,0 +220,0 @@ const getPropsStartingWithColon = (obj) => { |
{ | ||
"name": "@uniformdev/redirect", | ||
"version": "19.173.2-alpha.8+7b0bc70fd5", | ||
"version": "19.173.2-alpha.210+4f0f6ff104", | ||
"description": "Uniform redirect client", | ||
@@ -36,3 +36,3 @@ "license": "SEE LICENSE IN LICENSE.txt", | ||
"dependencies": { | ||
"@uniformdev/context": "19.173.2-alpha.8+7b0bc70fd5", | ||
"@uniformdev/context": "19.173.2-alpha.210+4f0f6ff104", | ||
"p-limit": "^3.1.0", | ||
@@ -44,3 +44,3 @@ "rfdc": "^1.3.0" | ||
}, | ||
"gitHead": "7b0bc70fd58912415a860667c266cb339fa8133a" | ||
"gitHead": "4f0f6ff104f46349c338fde461f063f22f04ce0e" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
149587
3302