img-upload-kit 1.1.1 → 2.0.1
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/CHANGELOG.md +89 -74
- package/MIGRATION.md +192 -0
- package/README.md +243 -259
- package/dist/bin.js +1186 -0
- package/dist/bin.js.map +1 -0
- package/dist/blur.cjs +40 -412
- package/dist/blur.cjs.map +1 -1
- package/dist/blur.d.cts +5 -5
- package/dist/blur.d.ts +5 -5
- package/dist/blur.js +39 -393
- package/dist/blur.js.map +1 -1
- package/dist/blurDataUtils-DveBRtqE.d.cts +43 -0
- package/dist/blurDataUtils-yx9Q6HlU.d.ts +43 -0
- package/dist/blurService-D5TpMNji.d.ts +83 -0
- package/dist/blurService-DacwylJx.d.cts +83 -0
- package/dist/chunk-25GYKQ6J.js +158 -0
- package/dist/chunk-25GYKQ6J.js.map +1 -0
- package/dist/chunk-34L4TEE3.cjs +226 -0
- package/dist/chunk-34L4TEE3.cjs.map +1 -0
- package/dist/chunk-DFCSN3X7.cjs +158 -0
- package/dist/chunk-DFCSN3X7.cjs.map +1 -0
- package/dist/chunk-EWVIL57J.js +294 -0
- package/dist/chunk-EWVIL57J.js.map +1 -0
- package/dist/chunk-FP5YIWG5.cjs +135 -0
- package/dist/chunk-FP5YIWG5.cjs.map +1 -0
- package/dist/chunk-HILELQGS.js +226 -0
- package/dist/chunk-HILELQGS.js.map +1 -0
- package/dist/chunk-IDLLCVGB.js +2370 -0
- package/dist/chunk-IDLLCVGB.js.map +1 -0
- package/dist/chunk-J6A44Y3W.js +514 -0
- package/dist/chunk-J6A44Y3W.js.map +1 -0
- package/dist/chunk-LOSVFO56.cjs +145 -0
- package/dist/chunk-LOSVFO56.cjs.map +1 -0
- package/dist/chunk-MBQJ6NVJ.cjs +294 -0
- package/dist/chunk-MBQJ6NVJ.cjs.map +1 -0
- package/dist/chunk-MHGQEBPW.js +145 -0
- package/dist/chunk-MHGQEBPW.js.map +1 -0
- package/dist/chunk-QHU7FUO4.cjs +37 -0
- package/dist/chunk-QHU7FUO4.cjs.map +1 -0
- package/dist/chunk-S2IFAWJK.js +37 -0
- package/dist/chunk-S2IFAWJK.js.map +1 -0
- package/dist/chunk-TA5Y64JM.cjs +2370 -0
- package/dist/chunk-TA5Y64JM.cjs.map +1 -0
- package/dist/chunk-VYVZVUNI.js +135 -0
- package/dist/chunk-VYVZVUNI.js.map +1 -0
- package/dist/chunk-XKQMCY5Z.cjs +514 -0
- package/dist/chunk-XKQMCY5Z.cjs.map +1 -0
- package/dist/cli.cjs +273 -76
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +269 -73
- package/dist/cli.js.map +1 -1
- package/dist/headless.cjs +8 -1880
- package/dist/headless.cjs.map +1 -1
- package/dist/headless.d.cts +3 -1
- package/dist/headless.d.ts +3 -1
- package/dist/headless.js +25 -1886
- package/dist/headless.js.map +1 -1
- package/dist/index-BIdnqtW8.d.ts +234 -0
- package/dist/index-Brk_uHs6.d.cts +234 -0
- package/dist/{index-FVXXKf2v.d.ts → index-CPMlaQsC.d.ts} +76 -153
- package/dist/{index-FVXXKf2v.d.cts → index-DHINe-rA.d.cts} +76 -153
- package/dist/index.cjs +64 -532
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -4
- package/dist/index.d.ts +7 -4
- package/dist/index.js +63 -504
- package/dist/index.js.map +1 -1
- package/dist/{memoryAdapter-CBu7_3Pp.d.ts → memoryAdapter-Ck0ccZbF.d.cts} +3 -2
- package/dist/{memoryAdapter-BJjyLR-1.d.cts → memoryAdapter-DxEKaG0b.d.ts} +3 -2
- package/dist/placeholders-C4ftwaII.d.ts +5 -0
- package/dist/placeholders-x_3rt65M.d.cts +5 -0
- package/dist/react.cjs +1952 -3257
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +188 -50
- package/dist/react.d.ts +188 -50
- package/dist/react.js +1763 -3013
- package/dist/react.js.map +1 -1
- package/dist/server-handler.cjs +14 -0
- package/dist/server-handler.cjs.map +1 -0
- package/dist/server-handler.d.cts +3 -0
- package/dist/server-handler.d.ts +3 -0
- package/dist/server-handler.js +14 -0
- package/dist/server-handler.js.map +1 -0
- package/dist/server.cjs +1096 -532
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +77 -154
- package/dist/server.d.ts +77 -154
- package/dist/server.js +1050 -448
- package/dist/server.js.map +1 -1
- package/dist/storage.cjs +239 -232
- package/dist/storage.cjs.map +1 -1
- package/dist/storage.d.cts +21 -5
- package/dist/storage.d.ts +21 -5
- package/dist/storage.js +227 -207
- package/dist/storage.js.map +1 -1
- package/dist/styles/animated-image.css +112 -0
- package/dist/styles/dropzone-and-tiles.css +247 -0
- package/dist/styles/modals-and-dock.css +248 -0
- package/dist/styles/primitives.css +197 -0
- package/dist/styles/quality-and-inputs.css +184 -0
- package/dist/styles/tokens.css +123 -0
- package/dist/styles.css +235 -220
- package/dist/types-BrP-o9nd.d.cts +85 -0
- package/dist/types-sZ3KoFQY.d.ts +85 -0
- package/dist/types-yShGNQnW.d.cts +61 -0
- package/dist/types-yShGNQnW.d.ts +61 -0
- package/dist/{types-CiLY0DwB.d.cts → upload-C5Trd6Dh.d.cts} +27 -53
- package/dist/{types-CiLY0DwB.d.ts → upload-C5Trd6Dh.d.ts} +27 -53
- package/package.json +92 -32
- package/dist/blurService-DqsnfPTd.d.cts +0 -172
- package/dist/blurService-DqsnfPTd.d.ts +0 -172
package/dist/server.d.ts
CHANGED
|
@@ -1,44 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
width: number;
|
|
6
|
-
height: number;
|
|
7
|
-
format: ImageOutputFormat;
|
|
8
|
-
size: number;
|
|
9
|
-
}
|
|
10
|
-
interface BlurHashResult {
|
|
11
|
-
dataURL: string;
|
|
12
|
-
color: string;
|
|
13
|
-
blurHash?: string;
|
|
14
|
-
}
|
|
15
|
-
interface OptimizeImageOptions {
|
|
16
|
-
/** Max bounding box dimensions (fit: 'inside', withoutEnlargement: true). Defaults to 1920x1080. */
|
|
17
|
-
maxDimensions?: ImageDimensions;
|
|
18
|
-
/** Explicit output format; omit for smart size-guarded AVIF/WebP selection */
|
|
19
|
-
outputFormat?: ExplicitOutputFormat;
|
|
20
|
-
/** 1–100 compression quality. Defaults to smart photo/graphic heuristic (85–88). */
|
|
21
|
-
quality?: number;
|
|
22
|
-
}
|
|
23
|
-
interface GenerateBlurOptions {
|
|
24
|
-
width?: number;
|
|
25
|
-
fallbackWidth?: number;
|
|
26
|
-
quality?: number;
|
|
27
|
-
maxDataUrlChars?: number;
|
|
28
|
-
includeBlurHash?: boolean;
|
|
29
|
-
}
|
|
30
|
-
type ColorSamplingMode = 'balanced' | 'edge';
|
|
31
|
-
type EdgeKey = 'top' | 'right' | 'bottom' | 'left';
|
|
32
|
-
type EdgeColorSet = Record<EdgeKey, string>;
|
|
33
|
-
declare const PRIMARY_AVIF_EFFORT = 6;
|
|
34
|
-
declare const RETRY_AVIF_EFFORT = 5;
|
|
35
|
-
declare const BLUR_PLACEHOLDER_WIDTH = 128;
|
|
36
|
-
declare const BLUR_PLACEHOLDER_FALLBACK_WIDTH = 96;
|
|
37
|
-
declare const BLUR_PLACEHOLDER_QUALITY = 80;
|
|
38
|
-
declare const BLUR_PLACEHOLDER_MAX_CHARS = 8000;
|
|
39
|
-
declare const EDGE_COLOR_FALLBACK = "#6B7280";
|
|
40
|
-
declare const EDGE_WHITE_FALLBACK = "#F9FAFB";
|
|
41
|
-
declare const WHITE_DOMINANCE_RATIO = 1.35;
|
|
1
|
+
import { O as OptimizeImageOptions, a as OptimizedImageResult, G as GenerateBlurOptions, B as BlurHashResult, E as EdgeColorSet, C as ColorSamplingMode, P as ProcessImageBufferOptions, b as ProcessedImageBufferResult, I as ImageUploaderOptions, c as ImageUploader, d as InferredPresetKey, S as StoragePathGenerator, e as StoragePathContext, f as GeneratedStorageTarget } from './index-BIdnqtW8.js';
|
|
2
|
+
export { A as AllowClientOverrides, g as AuthorizeContext, h as BLUR_PLACEHOLDER_FALLBACK_WIDTH, i as BLUR_PLACEHOLDER_MAX_CHARS, j as BLUR_PLACEHOLDER_QUALITY, k as BLUR_PLACEHOLDER_WIDTH, D as DEFAULT_LIMIT_INPUT_PIXELS, l as EDGE_COLOR_FALLBACK, m as EDGE_WHITE_FALLBACK, n as EdgeKey, o as PRIMARY_AVIF_EFFORT, R as RETRY_AVIF_EFFORT, U as UploadErrorContext, p as UploadHttpHandlerOptions, q as UploadValidationError, W as WHITE_DOMINANCE_RATIO, r as createUploadHandler, s as createUploadHttpHandler, t as isClientValidationError } from './index-BIdnqtW8.js';
|
|
3
|
+
import { k as UploadPresetConfig, c as ImageOutputFormat, e as ImageVariant } from './upload-C5Trd6Dh.js';
|
|
4
|
+
import { S as StorageAdapter, h as StorageUploadResult } from './types-sZ3KoFQY.js';
|
|
42
5
|
|
|
43
6
|
declare function optimizeImage(buffer: Buffer, options?: OptimizeImageOptions): Promise<OptimizedImageResult>;
|
|
44
7
|
|
|
@@ -47,90 +10,11 @@ declare function generateBlurPlaceholder(buffer: Buffer, options?: GenerateBlurO
|
|
|
47
10
|
declare const generateBlurHash: typeof generateBlurPlaceholder;
|
|
48
11
|
|
|
49
12
|
declare function extractEdgeColorsFromBuffer(buffer: Buffer): Promise<EdgeColorSet>;
|
|
13
|
+
declare function computeEdgeColorSet(data: Buffer, width: number, height: number): EdgeColorSet;
|
|
50
14
|
declare function blendEdgeColors(edgeColors: EdgeColorSet): string;
|
|
51
15
|
|
|
52
16
|
declare function extractEnhancedColorFromBuffer(buffer: Buffer, mode?: ColorSamplingMode): Promise<string>;
|
|
53
17
|
|
|
54
|
-
interface ProcessedImageBufferResult {
|
|
55
|
-
optimized: OptimizedImageResult;
|
|
56
|
-
blurData: BlurHashResult;
|
|
57
|
-
contentHash: string;
|
|
58
|
-
originalSize: number;
|
|
59
|
-
}
|
|
60
|
-
interface ProcessImageBufferOptions {
|
|
61
|
-
maxDimensions?: ImageDimensions;
|
|
62
|
-
outputFormat?: ExplicitOutputFormat;
|
|
63
|
-
quality?: number;
|
|
64
|
-
includeBlurHash?: boolean;
|
|
65
|
-
optimizationTimeoutMs?: number;
|
|
66
|
-
blurTimeoutMs?: number;
|
|
67
|
-
}
|
|
68
|
-
interface StoragePathContext {
|
|
69
|
-
bucket: string;
|
|
70
|
-
folder?: string;
|
|
71
|
-
preset?: string;
|
|
72
|
-
format: ImageOutputFormat;
|
|
73
|
-
extension: string;
|
|
74
|
-
customFilename?: string;
|
|
75
|
-
contentHash: string;
|
|
76
|
-
originalName?: string;
|
|
77
|
-
metadata?: Record<string, string>;
|
|
78
|
-
}
|
|
79
|
-
interface GeneratedStorageTarget {
|
|
80
|
-
bucket: string;
|
|
81
|
-
path: string;
|
|
82
|
-
filename: string;
|
|
83
|
-
}
|
|
84
|
-
type StoragePathGenerator = (context: StoragePathContext) => GeneratedStorageTarget;
|
|
85
|
-
interface ImageUploaderOptions<TPresets extends Record<string, UploadPresetConfig> = Record<StandardPresetName, UploadPresetConfig>> {
|
|
86
|
-
/** Pluggable storage backend (Supabase, S3, R2, Local FS, Memory, or custom) */
|
|
87
|
-
storage: StorageAdapter;
|
|
88
|
-
/** Default bucket name when neither `options.bucket` nor `preset.bucket` is provided (defaults to `'images'`) */
|
|
89
|
-
defaultBucket?: string;
|
|
90
|
-
/** Default folder prefix within the bucket (defaults to `''` or preset folder) */
|
|
91
|
-
defaultFolder?: string;
|
|
92
|
-
/** Default max input size in MB (defaults to `10`) */
|
|
93
|
-
defaultMaxSizeMB?: number;
|
|
94
|
-
/** Default allowed MIME formats */
|
|
95
|
-
defaultAllowedFormats?: string[];
|
|
96
|
-
/** Default max bounding box dimensions (defaults to `1920x1080`) */
|
|
97
|
-
defaultMaxDimensions?: ImageDimensions;
|
|
98
|
-
/**
|
|
99
|
-
* Project-specific named presets (merged over universal `STANDARD_PRESETS` unless `includeStandardPresets: false`).
|
|
100
|
-
* Preset names are automatically inferred in `uploader.uploadImage(file, { preset })`.
|
|
101
|
-
*/
|
|
102
|
-
presets?: TPresets;
|
|
103
|
-
/** Include universal visual role presets (`thumbnail`, `avatar`, `card`, `cover`, `hero`, `logo`, `original`). Defaults to `true`. */
|
|
104
|
-
includeStandardPresets?: boolean;
|
|
105
|
-
/** Custom storage path generator for full control over bucket/folder/filename layout */
|
|
106
|
-
pathGenerator?: StoragePathGenerator;
|
|
107
|
-
/** Optional database/analytics hook invoked after each successful upload */
|
|
108
|
-
onUploadRecord?: UploadRecordHook;
|
|
109
|
-
/** Wait for `onUploadRecord` before returning (defaults to `false` best-effort) */
|
|
110
|
-
awaitRecordHook?: boolean;
|
|
111
|
-
/** Max concurrent Sharp + LQIP image processing pipelines (defaults to `2`) */
|
|
112
|
-
concurrency?: number;
|
|
113
|
-
/** Timeout per Sharp optimization job in ms (defaults to `60000`) */
|
|
114
|
-
optimizationTimeoutMs?: number;
|
|
115
|
-
/** Timeout per LQIP/blur generation job in ms (defaults to `30000`) */
|
|
116
|
-
blurTimeoutMs?: number;
|
|
117
|
-
/** Generate compact BlurHash strings by default on every upload */
|
|
118
|
-
includeBlurHash?: boolean;
|
|
119
|
-
}
|
|
120
|
-
type InferredPresetKey<TPresets extends Record<string, UploadPresetConfig>, TIncludeStandard extends boolean = true> = (keyof TPresets & string) | (TIncludeStandard extends false ? never : StandardPresetName) | (string & {});
|
|
121
|
-
interface ImageUploader<TPreset extends string = string> {
|
|
122
|
-
uploadImage(file: File | {
|
|
123
|
-
buffer: Buffer;
|
|
124
|
-
name?: string;
|
|
125
|
-
type: string;
|
|
126
|
-
size?: number;
|
|
127
|
-
}, options?: ImageUploadOptions<TPreset>): Promise<UploadedImageData>;
|
|
128
|
-
processBuffer(buffer: Buffer, options?: ProcessImageBufferOptions): Promise<ProcessedImageBufferResult>;
|
|
129
|
-
deleteImage(path: string, bucket?: string): Promise<void>;
|
|
130
|
-
deleteByUrl(url: string): Promise<boolean>;
|
|
131
|
-
resolvePreset(presetName?: string): UploadPresetConfig | undefined;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
18
|
declare function processImageBuffer(originalBuffer: Buffer, options?: ProcessImageBufferOptions): Promise<ProcessedImageBufferResult>;
|
|
135
19
|
|
|
136
20
|
declare function createImageUploader<TPresets extends Record<string, UploadPresetConfig> = Record<string, UploadPresetConfig>>(options: ImageUploaderOptions<TPresets>): ImageUploader<InferredPresetKey<TPresets>>;
|
|
@@ -153,67 +37,106 @@ interface UploadWithCollisionRetryResult {
|
|
|
153
37
|
}
|
|
154
38
|
/**
|
|
155
39
|
* Determines whether a storage error represents a filename or object collision.
|
|
156
|
-
* Matches `already exists
|
|
157
|
-
* (e.g. non-existent buckets, directories, or missing keys).
|
|
40
|
+
* Matches `already exists`, `EEXIST`, or HTTP 412 Precondition Failed, while strictly
|
|
41
|
+
* excluding `does not exist` (e.g. non-existent buckets, directories, or missing keys).
|
|
158
42
|
*/
|
|
159
43
|
declare function isCollisionError(e: unknown): boolean;
|
|
160
44
|
/**
|
|
161
45
|
* Uploads optimized image bytes to the storage backend with automatic filename
|
|
162
|
-
* collision retries
|
|
46
|
+
* collision retries. Server-side `customFilename` uses `upsert: true`, while
|
|
47
|
+
* client-supplied `customFilename` (`isClientFilename: true`) never upserts and
|
|
48
|
+
* appends a unique suffix on collision.
|
|
163
49
|
*/
|
|
164
50
|
declare function uploadWithCollisionRetry(params: UploadWithCollisionRetryParams): Promise<UploadWithCollisionRetryResult>;
|
|
165
51
|
interface MirrorBufferLocallyOptions {
|
|
166
52
|
buffer: Buffer | Uint8Array;
|
|
167
53
|
filename: string;
|
|
54
|
+
storagePath?: string;
|
|
168
55
|
fallbackUrl: string;
|
|
169
56
|
mirrorDir?: string;
|
|
170
57
|
publicUrlBase?: string;
|
|
171
58
|
}
|
|
172
59
|
/**
|
|
173
60
|
* Mirrors an uploaded image buffer to a local directory when `mirrorDir` is configured.
|
|
174
|
-
*
|
|
175
|
-
* `publicUrlBase` when local mirroring succeeds.
|
|
61
|
+
* Uses non-blocking `fs/promises` I/O, safely swallows read-only filesystem errors on
|
|
62
|
+
* serverless runtimes, and resolves `publicUrlBase` when local mirroring succeeds.
|
|
176
63
|
*/
|
|
177
|
-
declare function mirrorBufferLocally(options: MirrorBufferLocallyOptions): string
|
|
64
|
+
declare function mirrorBufferLocally(options: MirrorBufferLocallyOptions): Promise<string>;
|
|
178
65
|
|
|
179
|
-
interface
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
66
|
+
interface GenerateImageVariantsParams {
|
|
67
|
+
sourceBuffer: Buffer;
|
|
68
|
+
format: ImageOutputFormat;
|
|
69
|
+
quality?: number;
|
|
70
|
+
effort?: number;
|
|
71
|
+
limitInputPixels?: number;
|
|
72
|
+
mainWidth: number;
|
|
73
|
+
mainHeight: number;
|
|
74
|
+
mainUrl: string;
|
|
75
|
+
baseStoragePath: string;
|
|
76
|
+
baseFilename: string;
|
|
77
|
+
bucket: string;
|
|
78
|
+
storage: StorageAdapter;
|
|
79
|
+
variantWidths?: number[];
|
|
80
|
+
upsert?: boolean;
|
|
81
|
+
contentHash?: string;
|
|
82
|
+
metadata?: Record<string, string>;
|
|
83
|
+
mirrorDir?: string;
|
|
84
|
+
publicUrlBase?: string;
|
|
193
85
|
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
86
|
+
interface GeneratedVariantsResult {
|
|
87
|
+
variants: ImageVariant[];
|
|
88
|
+
srcSet?: string;
|
|
89
|
+
}
|
|
90
|
+
declare function buildVariantStoragePath(basePath: string, width: number): string;
|
|
91
|
+
declare function generateImageVariants(params: GenerateImageVariantsParams): Promise<GeneratedVariantsResult>;
|
|
92
|
+
|
|
93
|
+
type SniffedImageFormat = 'jpeg' | 'png' | 'gif' | 'webp' | 'avif' | 'heif' | 'tiff' | 'bmp' | 'ico' | 'svg';
|
|
94
|
+
interface SniffedFormatResult {
|
|
95
|
+
format: SniffedImageFormat;
|
|
96
|
+
mime: string;
|
|
197
97
|
}
|
|
198
|
-
declare function isClientValidationError(error: unknown): boolean;
|
|
199
98
|
/**
|
|
200
|
-
*
|
|
201
|
-
*
|
|
99
|
+
* Inspects magic bytes of a buffer to determine its true image format,
|
|
100
|
+
* independent of any client-supplied MIME type or file extension.
|
|
202
101
|
*/
|
|
203
|
-
declare function
|
|
204
|
-
|
|
205
|
-
DELETE: (request: Request) => Promise<Response>;
|
|
206
|
-
};
|
|
102
|
+
declare function sniffImageFormat(input: Buffer | Uint8Array): SniffedFormatResult | null;
|
|
103
|
+
declare function assertMagicBytesAllowed(buffer: Buffer | Uint8Array, allowedFormats: string[], allowSvg?: boolean): SniffedFormatResult;
|
|
207
104
|
|
|
105
|
+
declare const DEFAULT_MAX_SVG_BYTES: number;
|
|
106
|
+
interface SanitizeSvgOptions {
|
|
107
|
+
maxBytes?: number;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Dependency-free SVG sanitizer.
|
|
111
|
+
* Strips `<script>`, `<foreignObject>`, `<iframe|embed|object>`, `<!DOCTYPE>`/`<!ENTITY>`,
|
|
112
|
+
* custom XML entities, `on*` event attributes, and non-fragment / non-raster-data `href`s.
|
|
113
|
+
*/
|
|
114
|
+
declare function sanitizeSvg(input: Buffer | string, options?: SanitizeSvgOptions): Buffer;
|
|
115
|
+
|
|
116
|
+
declare class SemaphoreQueueFullError extends Error {
|
|
117
|
+
readonly status = 503;
|
|
118
|
+
constructor(message?: string);
|
|
119
|
+
}
|
|
120
|
+
interface SemaphoreOptions {
|
|
121
|
+
maxQueue?: number;
|
|
122
|
+
}
|
|
123
|
+
interface SemaphoreRunOptions {
|
|
124
|
+
signal?: AbortSignal;
|
|
125
|
+
timeoutMs?: number;
|
|
126
|
+
label?: string;
|
|
127
|
+
}
|
|
208
128
|
declare class AsyncSemaphore {
|
|
209
129
|
private readonly concurrency;
|
|
210
130
|
private activeCount;
|
|
131
|
+
private readonly maxQueue?;
|
|
211
132
|
private readonly queue;
|
|
212
|
-
constructor(concurrency: number);
|
|
213
|
-
|
|
133
|
+
constructor(concurrency: number, options?: SemaphoreOptions | number);
|
|
134
|
+
get active(): number;
|
|
135
|
+
get pending(): number;
|
|
136
|
+
run<T>(task: () => Promise<T>, options?: SemaphoreRunOptions): Promise<T>;
|
|
214
137
|
private acquire;
|
|
215
138
|
private release;
|
|
216
139
|
}
|
|
217
140
|
declare function withTimeout<T>(task: Promise<T>, timeoutMs: number, label: string): Promise<T>;
|
|
218
141
|
|
|
219
|
-
export { AsyncSemaphore,
|
|
142
|
+
export { AsyncSemaphore, BlurHashResult, ColorSamplingMode, DEFAULT_MAX_SVG_BYTES, EdgeColorSet, GenerateBlurOptions, type GenerateImageVariantsParams, GeneratedStorageTarget, type GeneratedVariantsResult, ImageUploader, ImageUploaderOptions, InferredPresetKey, type MirrorBufferLocallyOptions, OptimizeImageOptions, OptimizedImageResult, ProcessImageBufferOptions, ProcessedImageBufferResult, type SanitizeSvgOptions, type SemaphoreOptions, SemaphoreQueueFullError, type SemaphoreRunOptions, type SniffedFormatResult, type SniffedImageFormat, StoragePathContext, StoragePathGenerator, type UploadWithCollisionRetryParams, type UploadWithCollisionRetryResult, assertMagicBytesAllowed, blendEdgeColors, buildVariantStoragePath, computeEdgeColorSet, createDefaultPathGenerator, createImageUploader, encodeBlurHashString, extractEdgeColorsFromBuffer, extractEnhancedColorFromBuffer, formatToExtension, generateBlurHash, generateBlurPlaceholder, generateImageVariants, isCollisionError, mirrorBufferLocally, optimizeImage, processImageBuffer, sanitizeSegment, sanitizeSvg, sniffImageFormat, uploadWithCollisionRetry, withTimeout };
|