@luvio/command-aura-resource-cache-control
Advanced tools
Comparing version 5.21.1-alpha.0 to 5.23.0
@@ -26,12 +26,9 @@ import { CacheControlCommand } from '@luvio/command-cache-control/v1'; | ||
constructor(services: NamedCacheControllerService & NamedAuraNetworkService & ExtraServices); | ||
execute(): SyncOrAsync<Result<Data, AuraError | Error>>; | ||
execute(): SyncOrAsync<Result<Data, Error>>; | ||
readFromCache(cache: Cache): SyncOrAsync<Result<Data | undefined, Error>>; | ||
requestFromNetwork(): SyncOrAsync<Result<NetworkResult, Error>>; | ||
protected convertAuraResponseToData<Data = unknown>(responsePromise: Promise<AuraRawResponseBody<any>>): Promise<Result<Data, Error>>; | ||
protected coerceError(auraErrors: any[]): Error; | ||
protected convertAuraResponseToData<Data = unknown>(responsePromise: Promise<AuraRawResponseBody<any>>, coerceError: (errors: any[]) => Error): Promise<Result<Data, Error>>; | ||
writeToCache(cache: Cache, networkResult: Result<NetworkResult, Error>): SyncOrAsync<void>; | ||
buildKey(): string; | ||
} | ||
export declare class AuraError<Data = unknown> extends Error { | ||
data: Data; | ||
constructor(data: Data); | ||
} |
@@ -8,3 +8,3 @@ /** | ||
import { CacheControlCommand } from '@luvio/command-cache-control/v1'; | ||
import { resolvedPromiseLike, ok, err, toError, stableJSONStringify } from '@luvio/utils'; | ||
import { resolvedPromiseLike, ok, toError, err, stableJSONStringify } from '@luvio/utils'; | ||
@@ -37,5 +37,8 @@ /** | ||
requestFromNetwork() { | ||
return this.convertAuraResponseToData(this.services.auraNetwork(this.endpoint, this.auraParams, this.actionConfig)); | ||
return this.convertAuraResponseToData(this.services.auraNetwork(this.endpoint, this.auraParams, this.actionConfig), this.coerceError); | ||
} | ||
convertAuraResponseToData(responsePromise) { | ||
coerceError(auraErrors) { | ||
return toError(auraErrors[0]); // Default Implementation stringifies the response | ||
} | ||
convertAuraResponseToData(responsePromise, coerceError) { | ||
return responsePromise | ||
@@ -51,3 +54,3 @@ .then((response) => { | ||
if (actionErrors.length > 0) { | ||
return err(new AuraError(actionErrors)); | ||
return err(coerceError(actionErrors)); | ||
} | ||
@@ -70,8 +73,2 @@ return err(toError('Error fetching component')); | ||
} | ||
class AuraError extends Error { | ||
constructor(data) { | ||
super(); | ||
this.data = data; | ||
} | ||
} | ||
@@ -78,0 +75,0 @@ function buildServiceDescriptor() { |
@@ -26,12 +26,9 @@ import { CacheControlCommand } from '@luvio/command-cache-control/v1'; | ||
constructor(services: NamedCacheControllerService & NamedAuraNetworkService & ExtraServices); | ||
execute(): SyncOrAsync<Result<Data, AuraError | Error>>; | ||
execute(): SyncOrAsync<Result<Data, Error>>; | ||
readFromCache(cache: Cache): SyncOrAsync<Result<Data | undefined, Error>>; | ||
requestFromNetwork(): SyncOrAsync<Result<NetworkResult, Error>>; | ||
protected convertAuraResponseToData<Data = unknown>(responsePromise: Promise<AuraRawResponseBody<any>>): Promise<Result<Data, Error>>; | ||
protected coerceError(auraErrors: any[]): Error; | ||
protected convertAuraResponseToData<Data = unknown>(responsePromise: Promise<AuraRawResponseBody<any>>, coerceError: (errors: any[]) => Error): Promise<Result<Data, Error>>; | ||
writeToCache(cache: Cache, networkResult: Result<NetworkResult, Error>): SyncOrAsync<void>; | ||
buildKey(): string; | ||
} | ||
export declare class AuraError<Data = unknown> extends Error { | ||
data: Data; | ||
constructor(data: Data); | ||
} |
{ | ||
"name": "@luvio/command-aura-resource-cache-control", | ||
"version": "5.21.1-alpha.0", | ||
"version": "5.23.0", | ||
"private": false, | ||
@@ -33,7 +33,7 @@ "description": "Luvio Aura Resource Cache Control Command", | ||
"dependencies": { | ||
"@luvio/command-base": "5.21.1-alpha.0", | ||
"@luvio/command-cache-control": "5.21.1-alpha.0", | ||
"@luvio/service-aura-network": "5.21.1-alpha.0", | ||
"@luvio/service-cache-control": "5.21.1-alpha.0", | ||
"@luvio/utils": "5.21.1-alpha.0" | ||
"@luvio/command-base": "5.23.0", | ||
"@luvio/command-cache-control": "5.23.0", | ||
"@luvio/service-aura-network": "5.23.0", | ||
"@luvio/service-cache-control": "5.23.0", | ||
"@luvio/utils": "5.23.0" | ||
}, | ||
@@ -40,0 +40,0 @@ "volta": { |
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
24216
1
160
+ Added@luvio/command-base@5.23.0(transitive)
+ Added@luvio/command-cache-control@5.23.0(transitive)
+ Added@luvio/service-aura-network@5.23.0(transitive)
+ Added@luvio/service-cache@5.23.0(transitive)
+ Added@luvio/service-cache-control@5.23.0(transitive)
+ Added@luvio/utils@5.23.0(transitive)
- Removed@luvio/command-base@5.21.1-alpha.0(transitive)
- Removed@luvio/command-cache-control@5.21.1-alpha.0(transitive)
- Removed@luvio/service-aura-network@5.21.1-alpha.0(transitive)
- Removed@luvio/service-cache@5.21.1-alpha.0(transitive)
- Removed@luvio/service-cache-control@5.21.1-alpha.0(transitive)
- Removed@luvio/utils@5.21.1-alpha.0(transitive)
Updated@luvio/command-base@5.23.0
Updated@luvio/utils@5.23.0