@snap/camera-kit 0.8.0 → 0.9.0
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/docs/html/assets/main.js +57 -53
- package/docs/html/assets/search.js +1 -1
- package/docs/html/assets/style.css +504 -362
- package/docs/html/classes/CameraKit.html +113 -47
- package/docs/html/classes/CameraKitSession.html +202 -142
- package/docs/html/classes/CameraKitSource.html +124 -60
- package/docs/html/classes/LensPerformanceMeasurement.html +112 -46
- package/docs/html/classes/LensPerformanceMetrics.html +97 -32
- package/docs/html/classes/LensRepository.html +130 -66
- package/docs/html/classes/LensSources.html +98 -32
- package/docs/html/classes/Transform2D.html +111 -43
- package/docs/html/classes/TypedCustomEvent.html +109 -47
- package/docs/html/classes/TypedEventTarget.html +125 -65
- package/docs/html/functions/Injectable.html +113 -120
- package/docs/html/functions/bootstrapCameraKit.html +100 -104
- package/docs/html/functions/createExtension.html +90 -94
- package/docs/html/functions/createImageSource.html +90 -93
- package/docs/html/functions/createMediaStreamSource.html +90 -93
- package/docs/html/functions/createUserMediaSource.html +92 -96
- package/docs/html/functions/createVideoSource.html +90 -93
- package/docs/html/functions/estimateLensPerformance.html +88 -92
- package/docs/html/functions/getRequiredBootstrapURLs.html +90 -94
- package/docs/html/functions/lensSourcesFactory.html +88 -91
- package/docs/html/functions/uriHandlersFactory.html +88 -91
- package/docs/html/index.html +134 -170
- package/docs/html/interfaces/CameraKitBootstrapConfiguration.html +115 -49
- package/docs/html/interfaces/CameraKitSourceSubscriber.html +111 -45
- package/docs/html/interfaces/ComputedFrameMetrics.html +98 -32
- package/docs/html/interfaces/CreateSessionOptions.html +95 -29
- package/docs/html/interfaces/EstimatedLensPerformance.html +98 -32
- package/docs/html/interfaces/Lens.html +115 -49
- package/docs/html/interfaces/LensSource.html +107 -41
- package/docs/html/interfaces/MediaStreamSourceOptions.html +94 -28
- package/docs/html/interfaces/UriCancelRequest.html +94 -28
- package/docs/html/interfaces/UriHandler.html +108 -42
- package/docs/html/interfaces/UriRequest.html +106 -40
- package/docs/html/interfaces/UriResponse.html +106 -40
- package/docs/html/interfaces/VideoSourceOptions.html +90 -24
- package/docs/html/modules.html +161 -164
- package/docs/html/types/AssetLoader.html +91 -94
- package/docs/html/types/AssetTiming.html +85 -88
- package/docs/html/types/BenchmarkError.html +85 -88
- package/docs/html/types/BootstrapError.html +86 -89
- package/docs/html/types/CacheKeyNotFoundError.html +85 -88
- package/docs/html/types/CameraKitDeviceInfo.html +87 -90
- package/docs/html/types/CameraKitSessionEventListener.html +86 -89
- package/docs/html/types/CameraKitSessionEvents.html +88 -91
- package/docs/html/types/CameraKitSourceError.html +85 -88
- package/docs/html/types/CameraKitSourceInfo.html +85 -88
- package/docs/html/types/CameraKitSourceOptions.html +88 -92
- package/docs/html/types/ConfigurationError.html +86 -89
- package/docs/html/types/Keyboard.html +108 -111
- package/docs/html/types/KeyboardEvents.html +86 -89
- package/docs/html/types/LegalError.html +85 -88
- package/docs/html/types/LensAssetError.html +85 -88
- package/docs/html/types/LensContentValidationError.html +85 -88
- package/docs/html/types/LensError.html +85 -88
- package/docs/html/types/LensExecutionError.html +86 -89
- package/docs/html/types/LensImagePickerError.html +85 -88
- package/docs/html/types/LensLaunchParams.html +85 -88
- package/docs/html/types/LensMetricsEvents.html +86 -89
- package/docs/html/types/LensPerformanceCluster.html +85 -88
- package/docs/html/types/LensView.html +85 -88
- package/docs/html/types/LensWait.html +85 -88
- package/docs/html/types/PersistentStoreError.html +85 -88
- package/docs/html/types/PlatformNotSupportedError.html +86 -89
- package/docs/html/types/PublicContainer.html +85 -88
- package/docs/html/types/RenderTarget.html +85 -88
- package/docs/html/types/Uri.html +85 -88
- package/docs/html/types/UriHandlers.html +86 -89
- package/docs/html/types/WebGLError.html +85 -88
- package/docs/html/variables/extensionRequestContext.html +85 -88
- package/docs/md/README.md +1 -1
- package/docs/md/classes/CameraKit.md +1 -1
- package/docs/md/classes/CameraKitSession.md +1 -1
- package/docs/md/classes/CameraKitSource.md +1 -1
- package/docs/md/classes/LensPerformanceMeasurement.md +1 -1
- package/docs/md/classes/LensPerformanceMetrics.md +1 -1
- package/docs/md/classes/LensRepository.md +3 -3
- package/docs/md/classes/LensSources.md +1 -1
- package/docs/md/classes/Transform2D.md +3 -1
- package/docs/md/classes/TypedCustomEvent.md +1 -1
- package/docs/md/classes/TypedEventTarget.md +3 -3
- package/docs/md/interfaces/CameraKitBootstrapConfiguration.md +1 -1
- package/docs/md/interfaces/CameraKitSourceSubscriber.md +1 -1
- package/docs/md/interfaces/ComputedFrameMetrics.md +1 -1
- package/docs/md/interfaces/CreateSessionOptions.md +1 -1
- package/docs/md/interfaces/EstimatedLensPerformance.md +1 -1
- package/docs/md/interfaces/Lens.md +1 -1
- package/docs/md/interfaces/LensSource.md +1 -1
- package/docs/md/interfaces/MediaStreamSourceOptions.md +1 -1
- package/docs/md/interfaces/UriCancelRequest.md +1 -1
- package/docs/md/interfaces/UriHandler.md +1 -1
- package/docs/md/interfaces/UriRequest.md +1 -1
- package/docs/md/interfaces/UriResponse.md +1 -1
- package/docs/md/interfaces/VideoSourceOptions.md +1 -1
- package/docs/md/modules.md +3 -3
- package/lib/CameraKit.d.ts +7 -7
- package/lib/__tests__/data.d.ts +1 -1
- package/lib/__tests__/deferred.d.ts +1 -1
- package/lib/__tests__/jest.matchers.d.ts +1 -1
- package/lib/benchmark/estimateLensPerformanceCluster.d.ts +2 -2
- package/lib/bootstrapCameraKit.d.ts +1 -1
- package/lib/common/cameraKitUserAgent.d.ts +1 -1
- package/lib/common/localization.d.ts +8 -4
- package/lib/common/localization.js.map +1 -1
- package/lib/common/memoize.d.ts +2 -2
- package/lib/common/pageVisibility.js +1 -1
- package/lib/common/pageVisibility.js.map +1 -1
- package/lib/common/typeguards.d.ts +2 -2
- package/lib/common/types.d.ts +2 -2
- package/lib/common/validate.js +20 -12
- package/lib/common/validate.js.map +1 -1
- package/lib/configuration.d.ts +1 -1
- package/lib/configuration.js.map +1 -1
- package/lib/configurationOverrides.d.ts +1 -1
- package/lib/dependency-injection/Container.d.ts +5 -6
- package/lib/dependency-injection/Container.js +1 -1
- package/lib/dependency-injection/Container.js.map +1 -1
- package/lib/dependency-injection/PartialContainer.d.ts +10 -6
- package/lib/dependency-injection/PartialContainer.js.map +1 -1
- package/lib/dependency-injection/RootServices.d.ts +2 -2
- package/lib/dependency-injection/types.d.ts +9 -9
- package/lib/dependency-injection/types.js.map +1 -1
- package/lib/environment.json +1 -1
- package/lib/events/TypedCustomEvent.d.ts +1 -1
- package/lib/events/TypedEventTarget.d.ts +2 -2
- package/lib/events/scan.d.ts +1 -1
- package/lib/events/scan.js +3 -3
- package/lib/events/scan.js.map +1 -1
- package/lib/extensions/UriHandlers.d.ts +1 -1
- package/lib/generated-proto/blizzard/cameraKitEvents.d.ts +4 -4
- package/lib/generated-proto/pb_schema/camera_kit/v3/business_events.d.ts +4 -4
- package/lib/generated-proto/pb_schema/camera_kit/v3/business_events.js +3 -3
- package/lib/generated-proto/pb_schema/camera_kit/v3/business_events.js.map +1 -1
- package/lib/generated-proto/pb_schema/camera_kit/v3/export.d.ts +4 -4
- package/lib/generated-proto/pb_schema/camera_kit/v3/export.js +9 -9
- package/lib/generated-proto/pb_schema/camera_kit/v3/export.js.map +1 -1
- package/lib/generated-proto/pb_schema/camera_kit/v3/legal_prompt.d.ts +4 -4
- package/lib/generated-proto/pb_schema/camera_kit/v3/legal_prompt.js +2 -2
- package/lib/generated-proto/pb_schema/camera_kit/v3/legal_prompt.js.map +1 -1
- package/lib/generated-proto/pb_schema/camera_kit/v3/lens.d.ts +4 -4
- package/lib/generated-proto/pb_schema/camera_kit/v3/lens.js +17 -17
- package/lib/generated-proto/pb_schema/camera_kit/v3/lens.js.map +1 -1
- package/lib/generated-proto/pb_schema/camera_kit/v3/operational_metrics.d.ts +4 -4
- package/lib/generated-proto/pb_schema/camera_kit/v3/operational_metrics.js +4 -4
- package/lib/generated-proto/pb_schema/camera_kit/v3/operational_metrics.js.map +1 -1
- package/lib/generated-proto/pb_schema/camera_kit/v3/ranking.d.ts +4 -4
- package/lib/generated-proto/pb_schema/camera_kit/v3/ranking.js +3 -3
- package/lib/generated-proto/pb_schema/camera_kit/v3/ranking.js.map +1 -1
- package/lib/generated-proto/pb_schema/camera_kit/v3/service.d.ts +4 -4
- package/lib/generated-proto/pb_schema/camera_kit/v3/service.js +25 -25
- package/lib/generated-proto/pb_schema/camera_kit/v3/service.js.map +1 -1
- package/lib/generated-proto/pb_schema/cdp/cof/benchmark.d.ts +4 -4
- package/lib/generated-proto/pb_schema/cdp/cof/circumstance_service.d.ts +4533 -333
- package/lib/generated-proto/pb_schema/cdp/cof/config_request.d.ts +4 -4
- package/lib/generated-proto/pb_schema/cdp/cof/config_response.d.ts +572 -32
- package/lib/generated-proto/pb_schema/cdp/cof/config_result.d.ts +4 -4
- package/lib/generated-proto/pb_schema/cdp/cof/debug_info.d.ts +4 -4
- package/lib/generated-proto/pb_schema/common/ruid.d.ts +4 -4
- package/lib/generated-proto/pb_schema/common/value.d.ts +4 -4
- package/lib/generated-proto/pb_schema/google/api/http.d.ts +4 -4
- package/lib/generated-proto/pb_schema/google/protobuf/any.d.ts +4 -4
- package/lib/generated-proto/pb_schema/google/protobuf/descriptor.d.ts +4 -4
- package/lib/generated-proto/pb_schema/google/protobuf/timestamp.d.ts +4 -4
- package/lib/generated-proto/pb_schema/google/protobuf/wrappers.d.ts +4 -4
- package/lib/generated-proto/pb_schema/lenses/geocircle.d.ts +4 -4
- package/lib/generated-proto/pb_schema/lenses/geopoint.d.ts +4 -4
- package/lib/generated-proto/pb_schema/lenses/launch_params.d.ts +4 -4
- package/lib/generated-proto/pb_schema/lenses/launchdata.d.ts +4 -4
- package/lib/generated-proto/pb_schema/lenses/lures.d.ts +4 -4
- package/lib/generated-proto/pb_schema/lenses/persistent_store.d.ts +4 -4
- package/lib/generated-proto/pb_schema/lenses/snappable.d.ts +4 -4
- package/lib/generated-proto/pb_schema/lenses/user_data.d.ts +4 -4
- package/lib/handlers/HandlerChainBuilder.d.ts +3 -3
- package/lib/handlers/arrayBufferParsingHandler.d.ts +2 -2
- package/lib/handlers/arrayBufferParsingHandler.js.map +1 -1
- package/lib/handlers/cameraKitServiceFetchHandlerFactory.d.ts +1 -1
- package/lib/handlers/defaultFetchHandler.d.ts +1 -1
- package/lib/handlers/headersModifyingFetchHandler.js +5 -1
- package/lib/handlers/headersModifyingFetchHandler.js.map +1 -1
- package/lib/handlers/noCorsRetryingFetchHandler.js +4 -3
- package/lib/handlers/noCorsRetryingFetchHandler.js.map +1 -1
- package/lib/handlers/requestStateEmittingHandler.d.ts +2 -2
- package/lib/handlers/requestStateEmittingHandler.js.map +1 -1
- package/lib/handlers/responseCachingHandler.d.ts +1 -1
- package/lib/handlers/responseCachingHandler.js.map +1 -1
- package/lib/handlers/retryingHandler.d.ts +7 -0
- package/lib/handlers/retryingHandler.js +14 -5
- package/lib/handlers/retryingHandler.js.map +1 -1
- package/lib/legal/legalPrompt.d.ts +1 -1
- package/lib/legal/legalPrompt.js.map +1 -1
- package/lib/legal/legalState.d.ts +1 -1
- package/lib/legal/legalState.js.map +1 -1
- package/lib/lens/Lens.d.ts +1 -1
- package/lib/lens/LensLaunchParams.d.ts +2 -2
- package/lib/lens/LensRepository.d.ts +7 -8
- package/lib/lens/LensRepository.js.map +1 -1
- package/lib/lens/assets/LensAssetRepository.d.ts +2 -2
- package/lib/lens/assets/LensAssetsProvider.d.ts +1 -1
- package/lib/lens/assets/deviceDependentAssetLoader.d.ts +1 -1
- package/lib/lens/assets/remoteMediaAssetLoaderFactory.d.ts +1 -1
- package/lib/lens/assets/staticAssetLoader.d.ts +1 -1
- package/lib/lens-core-module/generated-types.d.ts +29 -29
- package/lib/lens-core-module/loader/lensCoreFactory.d.ts +1 -1
- package/lib/lensCoreWasmVersions.json +3 -3
- package/lib/logger/logger.d.ts +2 -2
- package/lib/media-sources/CameraKitSource.d.ts +3 -3
- package/lib/media-sources/CameraKitSource.js.map +1 -1
- package/lib/media-sources/FunctionSource.d.ts +1 -1
- package/lib/metrics/businessEventsReporter.d.ts +4 -4
- package/lib/metrics/businessEventsReporter.js.map +1 -1
- package/lib/metrics/metricsEventTarget.d.ts +5 -5
- package/lib/metrics/metricsHandler.d.ts +1 -1
- package/lib/metrics/operationalMetricsReporter.d.ts +2 -2
- package/lib/metrics/reporters/reportBenchmarks.d.ts +1 -1
- package/lib/metrics/reporters/reportLegalState.d.ts +1 -1
- package/lib/metrics/reporters/reportLensAndAssetDownload.d.ts +4 -4
- package/lib/metrics/reporters/reportLensValidationFailed.d.ts +1 -1
- package/lib/metrics/reporters/reportLensView.d.ts +1 -1
- package/lib/metrics/reporters/reportLensView.js +1 -1
- package/lib/metrics/reporters/reportLensView.js.map +1 -1
- package/lib/metrics/reporters/reportLensWait.d.ts +1 -1
- package/lib/metrics/reporters/reportUserSession.d.ts +1 -1
- package/lib/namedErrors.d.ts +17 -17
- package/lib/persistence/Persistence.d.ts +1 -1
- package/lib/remote-configuration/cofHandler.d.ts +1 -1
- package/lib/remote-configuration/cofHandler.js +7 -2
- package/lib/remote-configuration/cofHandler.js.map +1 -1
- package/lib/session/CameraKitSession.d.ts +1 -1
- package/lib/session/CameraKitSession.js.map +1 -1
- package/lib/session/CameraKitSessionEvents.d.ts +3 -3
- package/lib/session/LensKeyboard.d.ts +2 -2
- package/lib/session/LensPerformanceMetrics.js.map +1 -1
- package/lib/session/lensState.d.ts +2 -2
- package/lib/session/lensState.js.map +1 -1
- package/lib/session/sessionState.d.ts +1 -1
- package/lib/transforms/Transform2D.js +2 -1
- package/lib/transforms/Transform2D.js.map +1 -1
- package/package.json +14 -14
- package/docs/html/assets/widgets.png +0 -0
- package/docs/html/assets/widgets@2x.png +0 -0
|
@@ -4197,12 +4197,12 @@ export declare const ClientTargetingExpression_PropertyMetadata: {
|
|
|
4197
4197
|
abSeedForHashing?: string | undefined;
|
|
4198
4198
|
} & Record<Exclude<keyof I, keyof ClientTargetingExpression_PropertyMetadata>, never>>(object: I): ClientTargetingExpression_PropertyMetadata;
|
|
4199
4199
|
};
|
|
4200
|
-
|
|
4201
|
-
export
|
|
4200
|
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
4201
|
+
export type DeepPartial<T> = T extends Builtin ? T : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
|
|
4202
4202
|
[K in keyof T]?: DeepPartial<T[K]>;
|
|
4203
4203
|
} : Partial<T>;
|
|
4204
|
-
|
|
4205
|
-
export
|
|
4204
|
+
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
4205
|
+
export type Exact<P, I extends P> = P extends Builtin ? P : P & {
|
|
4206
4206
|
[K in keyof P]: Exact<P[K], I[K]>;
|
|
4207
4207
|
} & Record<Exclude<keyof I, KeysOfUnion<P>>, never>;
|
|
4208
4208
|
export {};
|
|
@@ -91,12 +91,12 @@ export declare const DebugTrace: {
|
|
|
91
91
|
budgetGroupId?: number | undefined;
|
|
92
92
|
} & Record<Exclude<keyof I, keyof DebugTrace>, never>>(object: I): DebugTrace;
|
|
93
93
|
};
|
|
94
|
-
|
|
95
|
-
export
|
|
94
|
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
95
|
+
export type DeepPartial<T> = T extends Builtin ? T : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
|
|
96
96
|
[K in keyof T]?: DeepPartial<T[K]>;
|
|
97
97
|
} : Partial<T>;
|
|
98
|
-
|
|
99
|
-
export
|
|
98
|
+
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
99
|
+
export type Exact<P, I extends P> = P extends Builtin ? P : P & {
|
|
100
100
|
[K in keyof P]: Exact<P[K], I[K]>;
|
|
101
101
|
} & Record<Exclude<keyof I, KeysOfUnion<P>>, never>;
|
|
102
102
|
export {};
|
|
@@ -64,12 +64,12 @@ export declare const Ruid: {
|
|
|
64
64
|
loggingIdValue?: string | undefined;
|
|
65
65
|
} & Record<Exclude<keyof I, keyof Ruid>, never>>(object: I): Ruid;
|
|
66
66
|
};
|
|
67
|
-
|
|
68
|
-
export
|
|
67
|
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
68
|
+
export type DeepPartial<T> = T extends Builtin ? T : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
|
|
69
69
|
[K in keyof T]?: DeepPartial<T[K]>;
|
|
70
70
|
} : Partial<T>;
|
|
71
|
-
|
|
72
|
-
export
|
|
71
|
+
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
72
|
+
export type Exact<P, I extends P> = P extends Builtin ? P : P & {
|
|
73
73
|
[K in keyof P]: Exact<P[K], I[K]>;
|
|
74
74
|
} & Record<Exclude<keyof I, KeysOfUnion<P>>, never>;
|
|
75
75
|
export {};
|
|
@@ -120,12 +120,12 @@ export declare const Value: {
|
|
|
120
120
|
intPairValue?: number | undefined;
|
|
121
121
|
} & Record<Exclude<keyof I, keyof Value>, never>>(object: I): Value;
|
|
122
122
|
};
|
|
123
|
-
|
|
124
|
-
export
|
|
123
|
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
124
|
+
export type DeepPartial<T> = T extends Builtin ? T : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
|
|
125
125
|
[K in keyof T]?: DeepPartial<T[K]>;
|
|
126
126
|
} : Partial<T>;
|
|
127
|
-
|
|
128
|
-
export
|
|
127
|
+
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
128
|
+
export type Exact<P, I extends P> = P extends Builtin ? P : P & {
|
|
129
129
|
[K in keyof P]: Exact<P[K], I[K]>;
|
|
130
130
|
} & Record<Exclude<keyof I, KeysOfUnion<P>>, never>;
|
|
131
131
|
export {};
|
|
@@ -3619,8 +3619,8 @@ export declare const CustomHttpPattern: {
|
|
|
3619
3619
|
path?: string | undefined;
|
|
3620
3620
|
} & Record<Exclude<keyof I, keyof CustomHttpPattern>, never>>(object: I): CustomHttpPattern;
|
|
3621
3621
|
};
|
|
3622
|
-
|
|
3623
|
-
export
|
|
3622
|
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
3623
|
+
export type DeepPartial<T> = T extends Builtin ? T : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {
|
|
3624
3624
|
$case: string;
|
|
3625
3625
|
} ? {
|
|
3626
3626
|
[K in keyof Omit<T, "$case">]?: DeepPartial<T[K]>;
|
|
@@ -3629,8 +3629,8 @@ export declare type DeepPartial<T> = T extends Builtin ? T : T extends Array<inf
|
|
|
3629
3629
|
} : T extends {} ? {
|
|
3630
3630
|
[K in keyof T]?: DeepPartial<T[K]>;
|
|
3631
3631
|
} : Partial<T>;
|
|
3632
|
-
|
|
3633
|
-
export
|
|
3632
|
+
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
3633
|
+
export type Exact<P, I extends P> = P extends Builtin ? P : P & {
|
|
3634
3634
|
[K in keyof P]: Exact<P[K], I[K]>;
|
|
3635
3635
|
} & Record<Exclude<keyof I, KeysOfUnion<P>>, never>;
|
|
3636
3636
|
export {};
|
|
@@ -122,8 +122,8 @@ export declare const Any: {
|
|
|
122
122
|
value?: Uint8Array | undefined;
|
|
123
123
|
} & Record<Exclude<keyof I, keyof Any>, never>>(object: I): Any;
|
|
124
124
|
};
|
|
125
|
-
|
|
126
|
-
export
|
|
125
|
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
126
|
+
export type DeepPartial<T> = T extends Builtin ? T : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {
|
|
127
127
|
$case: string;
|
|
128
128
|
} ? {
|
|
129
129
|
[K in keyof Omit<T, "$case">]?: DeepPartial<T[K]>;
|
|
@@ -132,8 +132,8 @@ export declare type DeepPartial<T> = T extends Builtin ? T : T extends Array<inf
|
|
|
132
132
|
} : T extends {} ? {
|
|
133
133
|
[K in keyof T]?: DeepPartial<T[K]>;
|
|
134
134
|
} : Partial<T>;
|
|
135
|
-
|
|
136
|
-
export
|
|
135
|
+
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
136
|
+
export type Exact<P, I extends P> = P extends Builtin ? P : P & {
|
|
137
137
|
[K in keyof P]: Exact<P[K], I[K]>;
|
|
138
138
|
} & Record<Exclude<keyof I, KeysOfUnion<P>>, never>;
|
|
139
139
|
export {};
|
|
@@ -50951,8 +50951,8 @@ export declare const GeneratedCodeInfo_Annotation: {
|
|
|
50951
50951
|
end?: number | undefined;
|
|
50952
50952
|
} & Record<Exclude<keyof I, keyof GeneratedCodeInfo_Annotation>, never>>(object: I): GeneratedCodeInfo_Annotation;
|
|
50953
50953
|
};
|
|
50954
|
-
|
|
50955
|
-
export
|
|
50954
|
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
50955
|
+
export type DeepPartial<T> = T extends Builtin ? T : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {
|
|
50956
50956
|
$case: string;
|
|
50957
50957
|
} ? {
|
|
50958
50958
|
[K in keyof Omit<T, "$case">]?: DeepPartial<T[K]>;
|
|
@@ -50961,8 +50961,8 @@ export declare type DeepPartial<T> = T extends Builtin ? T : T extends Array<inf
|
|
|
50961
50961
|
} : T extends {} ? {
|
|
50962
50962
|
[K in keyof T]?: DeepPartial<T[K]>;
|
|
50963
50963
|
} : Partial<T>;
|
|
50964
|
-
|
|
50965
|
-
export
|
|
50964
|
+
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
50965
|
+
export type Exact<P, I extends P> = P extends Builtin ? P : P & {
|
|
50966
50966
|
[K in keyof P]: Exact<P[K], I[K]>;
|
|
50967
50967
|
} & Record<Exclude<keyof I, KeysOfUnion<P>>, never>;
|
|
50968
50968
|
export {};
|
|
@@ -81,8 +81,8 @@ export declare const Timestamp: {
|
|
|
81
81
|
nanos?: number | undefined;
|
|
82
82
|
} & Record<Exclude<keyof I, keyof Timestamp>, never>>(object: I): Timestamp;
|
|
83
83
|
};
|
|
84
|
-
|
|
85
|
-
export
|
|
84
|
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
85
|
+
export type DeepPartial<T> = T extends Builtin ? T : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {
|
|
86
86
|
$case: string;
|
|
87
87
|
} ? {
|
|
88
88
|
[K in keyof Omit<T, "$case">]?: DeepPartial<T[K]>;
|
|
@@ -91,8 +91,8 @@ export declare type DeepPartial<T> = T extends Builtin ? T : T extends Array<inf
|
|
|
91
91
|
} : T extends {} ? {
|
|
92
92
|
[K in keyof T]?: DeepPartial<T[K]>;
|
|
93
93
|
} : Partial<T>;
|
|
94
|
-
|
|
95
|
-
export
|
|
94
|
+
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
95
|
+
export type Exact<P, I extends P> = P extends Builtin ? P : P & {
|
|
96
96
|
[K in keyof P]: Exact<P[K], I[K]>;
|
|
97
97
|
} & Record<Exclude<keyof I, KeysOfUnion<P>>, never>;
|
|
98
98
|
export {};
|
|
@@ -162,12 +162,12 @@ export declare const BytesValue: {
|
|
|
162
162
|
value?: Uint8Array | undefined;
|
|
163
163
|
} & Record<Exclude<keyof I, "value">, never>>(object: I): BytesValue;
|
|
164
164
|
};
|
|
165
|
-
|
|
166
|
-
export
|
|
165
|
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
166
|
+
export type DeepPartial<T> = T extends Builtin ? T : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
|
|
167
167
|
[K in keyof T]?: DeepPartial<T[K]>;
|
|
168
168
|
} : Partial<T>;
|
|
169
|
-
|
|
170
|
-
export
|
|
169
|
+
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
170
|
+
export type Exact<P, I extends P> = P extends Builtin ? P : P & {
|
|
171
171
|
[K in keyof P]: Exact<P[K], I[K]>;
|
|
172
172
|
} & Record<Exclude<keyof I, KeysOfUnion<P>>, never>;
|
|
173
173
|
export {};
|
|
@@ -25,8 +25,8 @@ export declare const Geocircle: {
|
|
|
25
25
|
} & Record<Exclude<keyof I["center"], keyof Geopoint>, never>) | undefined;
|
|
26
26
|
} & Record<Exclude<keyof I, keyof Geocircle>, never>>(object: I): Geocircle;
|
|
27
27
|
};
|
|
28
|
-
|
|
29
|
-
export
|
|
28
|
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
29
|
+
export type DeepPartial<T> = T extends Builtin ? T : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {
|
|
30
30
|
$case: string;
|
|
31
31
|
} ? {
|
|
32
32
|
[K in keyof Omit<T, "$case">]?: DeepPartial<T[K]>;
|
|
@@ -35,8 +35,8 @@ export declare type DeepPartial<T> = T extends Builtin ? T : T extends Array<inf
|
|
|
35
35
|
} : T extends {} ? {
|
|
36
36
|
[K in keyof T]?: DeepPartial<T[K]>;
|
|
37
37
|
} : Partial<T>;
|
|
38
|
-
|
|
39
|
-
export
|
|
38
|
+
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
39
|
+
export type Exact<P, I extends P> = P extends Builtin ? P : P & {
|
|
40
40
|
[K in keyof P]: Exact<P[K], I[K]>;
|
|
41
41
|
} & Record<Exclude<keyof I, KeysOfUnion<P>>, never>;
|
|
42
42
|
export {};
|
|
@@ -15,8 +15,8 @@ export declare const Geopoint: {
|
|
|
15
15
|
longitude?: number | undefined;
|
|
16
16
|
} & Record<Exclude<keyof I, keyof Geopoint>, never>>(object: I): Geopoint;
|
|
17
17
|
};
|
|
18
|
-
|
|
19
|
-
export
|
|
18
|
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
19
|
+
export type DeepPartial<T> = T extends Builtin ? T : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {
|
|
20
20
|
$case: string;
|
|
21
21
|
} ? {
|
|
22
22
|
[K in keyof Omit<T, "$case">]?: DeepPartial<T[K]>;
|
|
@@ -25,8 +25,8 @@ export declare type DeepPartial<T> = T extends Builtin ? T : T extends Array<inf
|
|
|
25
25
|
} : T extends {} ? {
|
|
26
26
|
[K in keyof T]?: DeepPartial<T[K]>;
|
|
27
27
|
} : Partial<T>;
|
|
28
|
-
|
|
29
|
-
export
|
|
28
|
+
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
29
|
+
export type Exact<P, I extends P> = P extends Builtin ? P : P & {
|
|
30
30
|
[K in keyof P]: Exact<P[K], I[K]>;
|
|
31
31
|
} & Record<Exclude<keyof I, KeysOfUnion<P>>, never>;
|
|
32
32
|
export {};
|
|
@@ -12,8 +12,8 @@ export declare const LaunchParams: {
|
|
|
12
12
|
data?: Uint8Array | undefined;
|
|
13
13
|
} & Record<Exclude<keyof I, "data">, never>>(object: I): LaunchParams;
|
|
14
14
|
};
|
|
15
|
-
|
|
16
|
-
export
|
|
15
|
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
16
|
+
export type DeepPartial<T> = T extends Builtin ? T : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {
|
|
17
17
|
$case: string;
|
|
18
18
|
} ? {
|
|
19
19
|
[K in keyof Omit<T, "$case">]?: DeepPartial<T[K]>;
|
|
@@ -22,8 +22,8 @@ export declare type DeepPartial<T> = T extends Builtin ? T : T extends Array<inf
|
|
|
22
22
|
} : T extends {} ? {
|
|
23
23
|
[K in keyof T]?: DeepPartial<T[K]>;
|
|
24
24
|
} : Partial<T>;
|
|
25
|
-
|
|
26
|
-
export
|
|
25
|
+
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
26
|
+
export type Exact<P, I extends P> = P extends Builtin ? P : P & {
|
|
27
27
|
[K in keyof P]: Exact<P[K], I[K]>;
|
|
28
28
|
} & Record<Exclude<keyof I, KeysOfUnion<P>>, never>;
|
|
29
29
|
export {};
|
|
@@ -348,8 +348,8 @@ export declare const LaunchData: {
|
|
|
348
348
|
apiDescriptors?: (LaunchData_ApiDescriptor[] & LaunchData_ApiDescriptor[] & Record<Exclude<keyof I["apiDescriptors"], keyof LaunchData_ApiDescriptor[]>, never>) | undefined;
|
|
349
349
|
} & Record<Exclude<keyof I, keyof LaunchData>, never>>(object: I): LaunchData;
|
|
350
350
|
};
|
|
351
|
-
|
|
352
|
-
export
|
|
351
|
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
352
|
+
export type DeepPartial<T> = T extends Builtin ? T : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {
|
|
353
353
|
$case: string;
|
|
354
354
|
} ? {
|
|
355
355
|
[K in keyof Omit<T, "$case">]?: DeepPartial<T[K]>;
|
|
@@ -358,8 +358,8 @@ export declare type DeepPartial<T> = T extends Builtin ? T : T extends Array<inf
|
|
|
358
358
|
} : T extends {} ? {
|
|
359
359
|
[K in keyof T]?: DeepPartial<T[K]>;
|
|
360
360
|
} : Partial<T>;
|
|
361
|
-
|
|
362
|
-
export
|
|
361
|
+
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
362
|
+
export type Exact<P, I extends P> = P extends Builtin ? P : P & {
|
|
363
363
|
[K in keyof P]: Exact<P[K], I[K]>;
|
|
364
364
|
} & Record<Exclude<keyof I, KeysOfUnion<P>>, never>;
|
|
365
365
|
export {};
|
|
@@ -96,8 +96,8 @@ export declare const Lures: {
|
|
|
96
96
|
} & Record<Exclude<keyof I["closestLure"], keyof Geocircle>, never>) | undefined;
|
|
97
97
|
} & Record<Exclude<keyof I, keyof Lures>, never>>(object: I): Lures;
|
|
98
98
|
};
|
|
99
|
-
|
|
100
|
-
export
|
|
99
|
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
100
|
+
export type DeepPartial<T> = T extends Builtin ? T : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {
|
|
101
101
|
$case: string;
|
|
102
102
|
} ? {
|
|
103
103
|
[K in keyof Omit<T, "$case">]?: DeepPartial<T[K]>;
|
|
@@ -106,8 +106,8 @@ export declare type DeepPartial<T> = T extends Builtin ? T : T extends Array<inf
|
|
|
106
106
|
} : T extends {} ? {
|
|
107
107
|
[K in keyof T]?: DeepPartial<T[K]>;
|
|
108
108
|
} : Partial<T>;
|
|
109
|
-
|
|
110
|
-
export
|
|
109
|
+
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
110
|
+
export type Exact<P, I extends P> = P extends Builtin ? P : P & {
|
|
111
111
|
[K in keyof P]: Exact<P[K], I[K]>;
|
|
112
112
|
} & Record<Exclude<keyof I, KeysOfUnion<P>>, never>;
|
|
113
113
|
export {};
|
|
@@ -12,8 +12,8 @@ export declare const PersistentStore: {
|
|
|
12
12
|
store?: Uint8Array | undefined;
|
|
13
13
|
} & Record<Exclude<keyof I, "store">, never>>(object: I): PersistentStore;
|
|
14
14
|
};
|
|
15
|
-
|
|
16
|
-
export
|
|
15
|
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
16
|
+
export type DeepPartial<T> = T extends Builtin ? T : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {
|
|
17
17
|
$case: string;
|
|
18
18
|
} ? {
|
|
19
19
|
[K in keyof Omit<T, "$case">]?: DeepPartial<T[K]>;
|
|
@@ -22,8 +22,8 @@ export declare type DeepPartial<T> = T extends Builtin ? T : T extends Array<inf
|
|
|
22
22
|
} : T extends {} ? {
|
|
23
23
|
[K in keyof T]?: DeepPartial<T[K]>;
|
|
24
24
|
} : Partial<T>;
|
|
25
|
-
|
|
26
|
-
export
|
|
25
|
+
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
26
|
+
export type Exact<P, I extends P> = P extends Builtin ? P : P & {
|
|
27
27
|
[K in keyof P]: Exact<P[K], I[K]>;
|
|
28
28
|
} & Record<Exclude<keyof I, KeysOfUnion<P>>, never>;
|
|
29
29
|
export {};
|
|
@@ -904,8 +904,8 @@ export declare const SnappableEncryptedKey: {
|
|
|
904
904
|
encryptionKeyIv?: Uint8Array | undefined;
|
|
905
905
|
} & Record<Exclude<keyof I, keyof SnappableEncryptedKey>, never>>(object: I): SnappableEncryptedKey;
|
|
906
906
|
};
|
|
907
|
-
|
|
908
|
-
export
|
|
907
|
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
908
|
+
export type DeepPartial<T> = T extends Builtin ? T : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {
|
|
909
909
|
$case: string;
|
|
910
910
|
} ? {
|
|
911
911
|
[K in keyof Omit<T, "$case">]?: DeepPartial<T[K]>;
|
|
@@ -914,8 +914,8 @@ export declare type DeepPartial<T> = T extends Builtin ? T : T extends Array<inf
|
|
|
914
914
|
} : T extends {} ? {
|
|
915
915
|
[K in keyof T]?: DeepPartial<T[K]>;
|
|
916
916
|
} : Partial<T>;
|
|
917
|
-
|
|
918
|
-
export
|
|
917
|
+
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
918
|
+
export type Exact<P, I extends P> = P extends Builtin ? P : P & {
|
|
919
919
|
[K in keyof P]: Exact<P[K], I[K]>;
|
|
920
920
|
} & Record<Exclude<keyof I, KeysOfUnion<P>>, never>;
|
|
921
921
|
export {};
|
|
@@ -230,8 +230,8 @@ export declare const UserDataList: {
|
|
|
230
230
|
}[]>, never>) | undefined;
|
|
231
231
|
} & Record<Exclude<keyof I, "userData">, never>>(object: I): UserDataList;
|
|
232
232
|
};
|
|
233
|
-
|
|
234
|
-
export
|
|
233
|
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
234
|
+
export type DeepPartial<T> = T extends Builtin ? T : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {
|
|
235
235
|
$case: string;
|
|
236
236
|
} ? {
|
|
237
237
|
[K in keyof Omit<T, "$case">]?: DeepPartial<T[K]>;
|
|
@@ -240,8 +240,8 @@ export declare type DeepPartial<T> = T extends Builtin ? T : T extends Array<inf
|
|
|
240
240
|
} : T extends {} ? {
|
|
241
241
|
[K in keyof T]?: DeepPartial<T[K]>;
|
|
242
242
|
} : Partial<T>;
|
|
243
|
-
|
|
244
|
-
export
|
|
243
|
+
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
244
|
+
export type Exact<P, I extends P> = P extends Builtin ? P : P & {
|
|
245
245
|
[K in keyof P]: Exact<P[K], I[K]>;
|
|
246
246
|
} & Record<Exclude<keyof I, KeysOfUnion<P>>, never>;
|
|
247
247
|
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type RequestMetadata = {
|
|
2
2
|
signal?: AbortSignal | null | undefined;
|
|
3
3
|
} | undefined;
|
|
4
|
-
export
|
|
5
|
-
export
|
|
4
|
+
export type Handler<Req, Res, Meta extends RequestMetadata> = (req: Req, metadata?: Meta) => Promise<Res>;
|
|
5
|
+
export type ChainableHandler<Req, Res, NextReq, NextRes, Meta extends RequestMetadata | undefined> = (next: Handler<NextReq, NextRes, Meta>) => Handler<Req, Res, Meta>;
|
|
6
6
|
/**
|
|
7
7
|
* Creates a Handler chain – a series of functions composed such that each function may call a supplied `next` function
|
|
8
8
|
* which passes execution down the chain. When the final Handler in the chain returns, execution passes back up the
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ChainableHandler, RequestMetadata } from "./HandlerChainBuilder";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
type ArrayBufferResponse = [ArrayBuffer, Response];
|
|
3
|
+
type ChainableArrayBufferHandler<Req, Meta extends RequestMetadata> = ChainableHandler<Req, ArrayBufferResponse, Req, Response, Meta>;
|
|
4
4
|
/**
|
|
5
5
|
* Parse a Fetch Response body into an ArrayBuffer.
|
|
6
6
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arrayBufferParsingHandler.js","sourceRoot":"","sources":["../../src/handlers/arrayBufferParsingHandler.ts"],"names":[],"mappings":";AAWA;;;;GAIG;AACH,MAAM,CAAC,MAAM,+BAA+B,
|
|
1
|
+
{"version":3,"file":"arrayBufferParsingHandler.js","sourceRoot":"","sources":["../../src/handlers/arrayBufferParsingHandler.ts"],"names":[],"mappings":";AAWA;;;;GAIG;AACH,MAAM,CAAC,MAAM,+BAA+B,GACxC,GAA8E,EAAE,CAChF,CAAC,IAAI,EAAE,EAAE,CACT,CAAO,GAAG,EAAE,QAAQ,EAAE,EAAE;IACpB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;IAC3C,IAAI,MAAmB,CAAC;IACxB,IAAI;QACA,MAAM,GAAG,MAAM,QAAQ,CAAC,WAAW,EAAE,CAAC;KACzC;IAAC,OAAO,CAAC,EAAE;QACR,MAAM,GAAG,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC;KAC/B;IACD,OAAO,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AAC9B,CAAC,CAAA,CAAC","sourcesContent":["import { ChainableHandler, RequestMetadata } from \"./HandlerChainBuilder\";\n\ntype ArrayBufferResponse = [ArrayBuffer, Response];\ntype ChainableArrayBufferHandler<Req, Meta extends RequestMetadata> = ChainableHandler<\n Req,\n ArrayBufferResponse,\n Req,\n Response,\n Meta\n>;\n\n/**\n * Parse a Fetch Response body into an ArrayBuffer.\n *\n * @returns {@link ChainableHandler}, suitable for use in {@link HandlerChainBuilder.map}\n */\nexport const createArrayBufferParsingHandler =\n <Req, Meta extends RequestMetadata>(): ChainableArrayBufferHandler<Req, Meta> =>\n (next) =>\n async (req, metadata) => {\n const response = await next(req, metadata);\n let buffer: ArrayBuffer;\n try {\n buffer = await response.arrayBuffer();\n } catch (_) {\n buffer = new ArrayBuffer(0);\n }\n return [buffer, response];\n };\n"]}
|
|
@@ -6,7 +6,7 @@ import { FetchHandler } from "./defaultFetchHandler";
|
|
|
6
6
|
* @internal
|
|
7
7
|
*/
|
|
8
8
|
export declare const cameraKitServiceFetchHandlerFactory: {
|
|
9
|
-
(args_0: CameraKitConfiguration, args_1: FetchHandler
|
|
9
|
+
(args_0: CameraKitConfiguration, args_1: FetchHandler): import("./HandlerChainBuilder").Handler<RequestInfo, Response, RequestInit | undefined>;
|
|
10
10
|
token: "cameraKitServiceFetchHandler";
|
|
11
11
|
dependencies: readonly ["configuration", "defaultFetchHandler"];
|
|
12
12
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type FetchHandler<R = Response> = (input: RequestInfo, init?: RequestInit) => Promise<R>;
|
|
2
2
|
/**
|
|
3
3
|
* The default Fetch implementation, used to make a simple HTTP requests without any custom headers. This can be passed
|
|
4
4
|
* to `HandlerChainBuilder` to form the basis for other Fetch implementations (e.g. with custom headers, which extract
|
|
@@ -5,7 +5,11 @@
|
|
|
5
5
|
* @returns {@link ChainableHandler}, suitable for use in {@link HandlerChainBuilder.map}
|
|
6
6
|
*/
|
|
7
7
|
export const createHeadersModifyingFetchHandler = (modifyHeaders) => (next) => (input, init) => {
|
|
8
|
-
const headers = init && init.headers
|
|
8
|
+
const headers = init && init.headers
|
|
9
|
+
? new Headers(init.headers)
|
|
10
|
+
: typeof input === "string"
|
|
11
|
+
? new Headers()
|
|
12
|
+
: input.headers;
|
|
9
13
|
const modifiedHeaders = modifyHeaders(headers);
|
|
10
14
|
// When `init` contains headers, `fetch` uses these *instead* of any headers found in the `input` Request.
|
|
11
15
|
return next(input, Object.assign(Object.assign({}, init), { headers: modifiedHeaders }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"headersModifyingFetchHandler.js","sourceRoot":"","sources":["../../src/handlers/headersModifyingFetchHandler.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,kCAAkC,
|
|
1
|
+
{"version":3,"file":"headersModifyingFetchHandler.js","sourceRoot":"","sources":["../../src/handlers/headersModifyingFetchHandler.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAC3C,CACI,aAA4C,EACiC,EAAE,CACnF,CAAC,IAAI,EAAE,EAAE,CACT,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;IACZ,MAAM,OAAO,GACT,IAAI,IAAI,IAAI,CAAC,OAAO;QAChB,CAAC,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC;QAC3B,CAAC,CAAC,OAAO,KAAK,KAAK,QAAQ;YAC3B,CAAC,CAAC,IAAI,OAAO,EAAE;YACf,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC;IAExB,MAAM,eAAe,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;IAE/C,0GAA0G;IAC1G,OAAO,IAAI,CAAC,KAAK,kCAAO,IAAI,KAAE,OAAO,EAAE,eAAe,IAAG,CAAC;AAC9D,CAAC,CAAC","sourcesContent":["import { ChainableHandler } from \"./HandlerChainBuilder\";\n\n/**\n * Modify a Fetch Request's headers.\n *\n * @param modifyHeaders\n * @returns {@link ChainableHandler}, suitable for use in {@link HandlerChainBuilder.map}\n */\nexport const createHeadersModifyingFetchHandler =\n <Res>(\n modifyHeaders: (headers: Headers) => Headers\n ): ChainableHandler<RequestInfo, Res, RequestInfo, Res, RequestInit | undefined> =>\n (next) =>\n (input, init) => {\n const headers =\n init && init.headers\n ? new Headers(init.headers)\n : typeof input === \"string\"\n ? new Headers()\n : input.headers;\n\n const modifiedHeaders = modifyHeaders(headers);\n\n // When `init` contains headers, `fetch` uses these *instead* of any headers found in the `input` Request.\n return next(input, { ...init, headers: modifiedHeaders });\n };\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { __awaiter } from "tslib";
|
|
2
2
|
import { getLogger } from "../logger/logger";
|
|
3
|
+
import { ensureClonedRequest } from "./retryingHandler";
|
|
3
4
|
const logger = getLogger("noCorsRetryingFetchHandler");
|
|
4
5
|
const logRetry = (error) => {
|
|
5
6
|
logger.warn(`NoCorsRetrying handler got failed response:`, error, `Retrying request with {mode: "no-cors"}.`);
|
|
@@ -72,7 +73,7 @@ export const createNoCorsRetryingFetchHandler = () => {
|
|
|
72
73
|
// of the request (e.g. the expiration time for a credential). We just make the request, and if it
|
|
73
74
|
// fails, this tells us we've made an invalid request. This does result in one additional request, but
|
|
74
75
|
// it makes this much more flexible and avoids having to maintain state (which can be a source of bugs).
|
|
75
|
-
return yield next(input, init);
|
|
76
|
+
return yield next(ensureClonedRequest(input), init);
|
|
76
77
|
}
|
|
77
78
|
catch (error) {
|
|
78
79
|
// If the request fails because it was aborted, we assume this was done intentionally and we can stop.
|
|
@@ -83,11 +84,11 @@ export const createNoCorsRetryingFetchHandler = () => {
|
|
|
83
84
|
// throw), and we'll just assume it's a CORs error. If it's not, we'll perform a "no-cors" retry anyway,
|
|
84
85
|
// which will presumably also fail, and that failure will be returned to the caller.
|
|
85
86
|
logRetry(error);
|
|
86
|
-
const noCorsRequest = (_a = noCorsRequests.get(requestKey)) !== null && _a !== void 0 ? _a : next(input, Object.assign(Object.assign({}, init), { mode: "no-cors" }));
|
|
87
|
+
const noCorsRequest = (_a = noCorsRequests.get(requestKey)) !== null && _a !== void 0 ? _a : next(ensureClonedRequest(input), Object.assign(Object.assign({}, init), { mode: "no-cors" }));
|
|
87
88
|
noCorsRequests.set(requestKey, noCorsRequest);
|
|
88
89
|
yield noCorsRequest;
|
|
89
90
|
noCorsRequests.delete(requestKey);
|
|
90
|
-
return next(input, init);
|
|
91
|
+
return next(ensureClonedRequest(input), init);
|
|
91
92
|
}
|
|
92
93
|
});
|
|
93
94
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"noCorsRetryingFetchHandler.js","sourceRoot":"","sources":["../../src/handlers/noCorsRetryingFetchHandler.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"noCorsRetryingFetchHandler.js","sourceRoot":"","sources":["../../src/handlers/noCorsRetryingFetchHandler.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,MAAM,MAAM,GAAG,SAAS,CAAC,4BAA4B,CAAC,CAAC;AAEvD,MAAM,QAAQ,GAAG,CAAC,KAAU,EAAE,EAAE;IAC5B,MAAM,CAAC,IAAI,CAAC,6CAA6C,EAAE,KAAK,EAAE,0CAA0C,CAAC,CAAC;AAClH,CAAC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,GAM9C,EAAE;IACA,+GAA+G;IAC/G,yGAAyG;IACzG,uEAAuE;IACvE,MAAM,cAAc,GAAG,IAAI,GAAG,EAAwB,CAAC;IAEvD,OAAO,CAAC,IAAI,EAAE,EAAE,CACZ,CAAO,KAAK,EAAE,IAAI,GAAG,EAAE,EAAE,EAAE;;QACvB,sGAAsG;QACtG,oGAAoG;QACpG,uFAAuF;QACvF,IAAI,UAAU,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC;QAC/D,IAAI;YACA,UAAU,GAAG,IAAI,GAAG,CAAC,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC;SAC1D;QAAC,OAAO,CAAC,EAAE;YACR,qDAAqD;SACxD;QAED,IAAI;YACA,oGAAoG;YACpG,kGAAkG;YAClG,sGAAsG;YACtG,wGAAwG;YACxG,OAAO,MAAM,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,CAAC;SACvD;QAAC,OAAO,KAAK,EAAE;YACZ,sGAAsG;YACtG,IAAI,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,YAAY;gBAAE,MAAM,KAAK,CAAC;YAEvE,iGAAiG;YACjG,mGAAmG;YACnG,wGAAwG;YACxG,oFAAoF;YACpF,QAAQ,CAAC,KAAK,CAAC,CAAC;YAChB,MAAM,aAAa,GACf,MAAA,cAAc,CAAC,GAAG,CAAC,UAAU,CAAC,mCAAI,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,kCAAO,IAAI,KAAE,IAAI,EAAE,SAAS,IAAG,CAAC;YACrG,cAAc,CAAC,GAAG,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;YAC9C,MAAM,aAAa,CAAC;YACpB,cAAc,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;YAClC,OAAO,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,CAAC;SACjD;IACL,CAAC,CAAA,CAAC;AACV,CAAC,CAAC","sourcesContent":["import { getLogger } from \"../logger/logger\";\nimport { ChainableHandler } from \"./HandlerChainBuilder\";\nimport { ensureClonedRequest } from \"./retryingHandler\";\n\nconst logger = getLogger(\"noCorsRetryingFetchHandler\");\n\nconst logRetry = (error: any) => {\n logger.warn(`NoCorsRetrying handler got failed response:`, error, `Retrying request with {mode: \"no-cors\"}.`);\n};\n\n/**\n * Some requests may require a no-cors pre-flight (which are allowed to follow redirects) before they can be\n * successful.\n *\n * An example is a federated identity authentication flow, like OpenID Connect or OAuth. In many such schemes,\n * an unauthenticated request will not include CORs headers. Instead, a redirect to an Identity Provider will be\n * returned. In order follow this redirect, the Fetch request must be made with \"no-cors\" mode.\n *\n * Once the \"no-cors\" request is made, redirects are followed resulting in authentication cookies being set on the\n * original domain. Then, the original request can be retried and the server will authenticate the request and set\n * proper CORs headers on the response.\n *\n * Here's an example request flow, in which the page already has cookies for IdentityProvider.com (if that wasn't\n * the case, IdentityProvider.com would prompt the user for credentials and the rest of the flow would be the same):\n *\n * ```\n * WebPage a.com MyServer b.com IdentityProvider c.com\n * | | |\n * Original request, | |\n * unauthenticated: | |\n * |------------------------>| |\n * |<--302: c.com, no CORs---| |\n * | | |\n * | | |\n * No CORs headers in | |\n * response. Retry in | |\n * \"no-cors\" mode: | |\n * |-----\"no-cors\" mode----->| |\n * |<--302: c.com, no CORs---| |\n * | | |\n * | | |\n * |------------------IdP cookies------------->|\n * |<----------302: b.com?token=foo------------|\n * | |\n * | | |\n * |----b.com?token=foo----->| |\n * |<-302: b.com, set cookie-| |\n * | | |\n * | | |\n * Retry original request, | |\n * now authenticated: | |\n * |-----------cookie------->| |\n * |<-----------200----------| |\n * | |\n * ```\n */\nexport const createNoCorsRetryingFetchHandler = <Res>(): ChainableHandler<\n RequestInfo,\n Res,\n RequestInfo,\n Res,\n RequestInit | undefined\n> => {\n // If concurrent requests are made to the same domain, we only want to perform one \"no-cors\" request. We assume\n // requests to the same domain will set the same authentication cookies. To support this, we'll store any\n // in-flight \"no-cors\" retries and re-use them for concurrent requests.\n const noCorsRequests = new Map<string, Promise<Res>>();\n\n return (next) =>\n async (input, init = {}) => {\n // `host` includes domain:port, so works for local development. If the input is a relative path, we'll\n // use `location.origin` to resolve into a fully qualified URL (although of course we don't actually\n // anticipate any CORs issues in that case -- but this is cleaner than special-casing).\n let requestKey = typeof input === \"string\" ? input : input.url;\n try {\n requestKey = new URL(requestKey, location.origin).host;\n } catch (_) {\n /* no-op, use the full input URL as the requestKey */\n }\n\n try {\n // By always attempting the request first, we avoid needing to maintain any state about the validity\n // of the request (e.g. the expiration time for a credential). We just make the request, and if it\n // fails, this tells us we've made an invalid request. This does result in one additional request, but\n // it makes this much more flexible and avoids having to maintain state (which can be a source of bugs).\n return await next(ensureClonedRequest(input), init);\n } catch (error) {\n // If the request fails because it was aborted, we assume this was done intentionally and we can stop.\n if (error instanceof Error && error.name === \"AbortError\") throw error;\n\n // Otherwise we don't actually care what error occurred – we know this will be an error thrown by\n // `fetch` itself (rather than some error encountered on the server, which wouldn't cause `next` to\n // throw), and we'll just assume it's a CORs error. If it's not, we'll perform a \"no-cors\" retry anyway,\n // which will presumably also fail, and that failure will be returned to the caller.\n logRetry(error);\n const noCorsRequest =\n noCorsRequests.get(requestKey) ?? next(ensureClonedRequest(input), { ...init, mode: \"no-cors\" });\n noCorsRequests.set(requestKey, noCorsRequest);\n await noCorsRequest;\n noCorsRequests.delete(requestKey);\n return next(ensureClonedRequest(input), init);\n }\n };\n};\n"]}
|
|
@@ -19,8 +19,8 @@ interface Errored {
|
|
|
19
19
|
dimensions: Dimensions;
|
|
20
20
|
error: Error;
|
|
21
21
|
}
|
|
22
|
-
export
|
|
23
|
-
export
|
|
22
|
+
export type Dimensions = Record<string, string | undefined>;
|
|
23
|
+
export type RequestStateEvents = TypedCustomEvent<"started", Started> | TypedCustomEvent<"completed", Completed> | TypedCustomEvent<"errored", Errored>;
|
|
24
24
|
export declare const requestStateEventTarget: TypedEventTarget<RequestStateEvents>;
|
|
25
25
|
export declare const dispatchRequestStarted: (data: Omit<Started, "requestId" | "timeMs">) => Started;
|
|
26
26
|
export declare const dispatchRequestCompleted: (data: Omit<Completed, "timeMs">) => Completed;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requestStateEmittingHandler.js","sourceRoot":"","sources":["../../src/handlers/requestStateEmittingHandler.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAG9D,IAAI,SAAS,GAAG,CAAC,CAAC;AAClB,MAAM,YAAY,GAAG,CAAC,GAAkB,EAAE,EAAE;IACxC,IAAI,GAAG,IAAI,IAAI;QAAE,OAAO,CAAC,CAAC;IAC1B,MAAM,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;IAC/B,OAAO,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;AAC1C,CAAC,CAAC;AA8BF,MAAM,CAAC,MAAM,uBAAuB,GAAG,IAAI,gBAAgB,EAAsB,CAAC;AAElF,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,IAA2C,EAAW,EAAE;IAC3F,MAAM,OAAO,mCAAiB,IAAI,KAAE,SAAS,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,GAAE,CAAC;IAClF,uBAAuB,CAAC,aAAa,CAAC,IAAI,gBAAgB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;IAChF,OAAO,OAAO,CAAC;AACnB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,IAA+B,EAAa,EAAE;IACnF,MAAM,SAAS,mCAAmB,IAAI,KAAE,MAAM,EAAE,SAAS,EAAE,GAAE,CAAC;IAC9D,uBAAuB,CAAC,aAAa,CAAC,IAAI,gBAAgB,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC,CAAC;IACpF,OAAO,SAAS,CAAC;AACrB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,IAA6B,EAAW,EAAE;IAC7E,MAAM,OAAO,mCAAiB,IAAI,KAAE,MAAM,EAAE,SAAS,EAAE,GAAE,CAAC;IAC1D,uBAAuB,CAAC,aAAa,CAAC,IAAI,gBAAgB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;IAChF,OAAO,OAAO,CAAC;AACnB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,iCAAiC,
|
|
1
|
+
{"version":3,"file":"requestStateEmittingHandler.js","sourceRoot":"","sources":["../../src/handlers/requestStateEmittingHandler.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAG9D,IAAI,SAAS,GAAG,CAAC,CAAC;AAClB,MAAM,YAAY,GAAG,CAAC,GAAkB,EAAE,EAAE;IACxC,IAAI,GAAG,IAAI,IAAI;QAAE,OAAO,CAAC,CAAC;IAC1B,MAAM,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;IAC/B,OAAO,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;AAC1C,CAAC,CAAC;AA8BF,MAAM,CAAC,MAAM,uBAAuB,GAAG,IAAI,gBAAgB,EAAsB,CAAC;AAElF,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,IAA2C,EAAW,EAAE;IAC3F,MAAM,OAAO,mCAAiB,IAAI,KAAE,SAAS,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,GAAE,CAAC;IAClF,uBAAuB,CAAC,aAAa,CAAC,IAAI,gBAAgB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;IAChF,OAAO,OAAO,CAAC;AACnB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,IAA+B,EAAa,EAAE;IACnF,MAAM,SAAS,mCAAmB,IAAI,KAAE,MAAM,EAAE,SAAS,EAAE,GAAE,CAAC;IAC9D,uBAAuB,CAAC,aAAa,CAAC,IAAI,gBAAgB,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC,CAAC;IACpF,OAAO,SAAS,CAAC;AACrB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,IAA6B,EAAW,EAAE;IAC7E,MAAM,OAAO,mCAAiB,IAAI,KAAE,MAAM,EAAE,SAAS,EAAE,GAAE,CAAC;IAC1D,uBAAuB,CAAC,aAAa,CAAC,IAAI,gBAAgB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;IAChF,OAAO,OAAO,CAAC;AACnB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,iCAAiC,GAC1C,GAME,EAAE,CACJ,CAAC,IAAI,EAAE,EAAE,CACT,CAAO,CAAC,OAAO,EAAE,UAAU,CAAC,EAAE,QAAQ,EAAE,EAAE;IACtC,MAAM,EAAE,SAAS,EAAE,GAAG,sBAAsB,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC;IAC7D,IAAI;QACA,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QAC/C,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC;QAC/B,MAAM,QAAQ,GAAG,YAAY,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC;QACtE,wBAAwB,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;QACtE,OAAO,QAAQ,CAAC;KACnB;IAAC,OAAO,KAAK,EAAE;QACZ,sBAAsB,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAC7E,MAAM,KAAK,CAAC;KACf;AACL,CAAC,CAAA,CAAC","sourcesContent":["import { ensureError } from \"../common/errorHelpers\";\nimport { getTimeMs } from \"../common/time\";\nimport { TypedCustomEvent } from \"../events/TypedCustomEvent\";\nimport { TypedEventTarget } from \"../events/TypedEventTarget\";\nimport { ChainableHandler, RequestMetadata } from \"./HandlerChainBuilder\";\n\nlet requestId = 0;\nconst safeParseInt = (str: string | null) => {\n if (str == null) return 0;\n const maybeInt = parseInt(str);\n return isNaN(maybeInt) ? 0 : maybeInt;\n};\n\ninterface Started {\n requestId: number;\n timeMs: number;\n dimensions: Dimensions;\n}\n\ninterface Completed {\n requestId: number;\n timeMs: number;\n dimensions: Dimensions;\n status: number;\n sizeByte: number;\n}\n\ninterface Errored {\n requestId: number;\n timeMs: number;\n dimensions: Dimensions;\n error: Error;\n}\n\nexport type Dimensions = Record<string, string | undefined>;\n\nexport type RequestStateEvents =\n | TypedCustomEvent<\"started\", Started>\n | TypedCustomEvent<\"completed\", Completed>\n | TypedCustomEvent<\"errored\", Errored>;\n\nexport const requestStateEventTarget = new TypedEventTarget<RequestStateEvents>();\n\nexport const dispatchRequestStarted = (data: Omit<Started, \"requestId\" | \"timeMs\">): Started => {\n const started: Started = { ...data, requestId: requestId++, timeMs: getTimeMs() };\n requestStateEventTarget.dispatchEvent(new TypedCustomEvent(\"started\", started));\n return started;\n};\n\nexport const dispatchRequestCompleted = (data: Omit<Completed, \"timeMs\">): Completed => {\n const completed: Completed = { ...data, timeMs: getTimeMs() };\n requestStateEventTarget.dispatchEvent(new TypedCustomEvent(\"completed\", completed));\n return completed;\n};\n\nexport const dispatchRequestErrored = (data: Omit<Errored, \"timeMs\">): Errored => {\n const errored: Errored = { ...data, timeMs: getTimeMs() };\n requestStateEventTarget.dispatchEvent(new TypedCustomEvent(\"errored\", errored));\n return errored;\n};\n\nexport const createRequestStateEmittingHandler =\n <D extends Dimensions = Dimensions>(): ChainableHandler<\n [RequestInfo, D],\n Response,\n RequestInfo,\n Response,\n RequestMetadata\n > =>\n (next) =>\n async ([request, dimensions], metadata) => {\n const { requestId } = dispatchRequestStarted({ dimensions });\n try {\n const response = await next(request, metadata);\n const status = response.status;\n const sizeByte = safeParseInt(response.headers.get(\"content-length\"));\n dispatchRequestCompleted({ requestId, dimensions, status, sizeByte });\n return response;\n } catch (error) {\n dispatchRequestErrored({ requestId, dimensions, error: ensureError(error) });\n throw error;\n }\n };\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Persistence, ValidKey } from "../persistence/Persistence";
|
|
2
2
|
import { ChainableHandler, RequestMetadata } from "./HandlerChainBuilder";
|
|
3
|
-
export
|
|
3
|
+
export type CachingStrategy<T> = (key: ValidKey, cache: Persistence<T>, network: () => Promise<T>) => Promise<T>;
|
|
4
4
|
/**
|
|
5
5
|
* Create a CachingStrategy that first makes a request to the network, falling back to cache if the network request
|
|
6
6
|
* fails. If the network request fails and a prior response has not been cached, an error is returned to the caller.
|