@anvilkit/plugin-asset-manager 0.1.2 → 0.1.4
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/README.md +366 -108
- package/dist/adapters/data-url.cjs +10 -6
- package/dist/adapters/data-url.d.cts +1 -1
- package/dist/adapters/data-url.d.cts.map +1 -1
- package/dist/adapters/data-url.d.ts +1 -1
- package/dist/adapters/data-url.d.ts.map +1 -1
- package/dist/adapters/data-url.js +7 -3
- package/dist/adapters/extract-image-dimensions.cjs +9 -0
- package/dist/adapters/extract-image-dimensions.d.cts +6 -0
- package/dist/adapters/extract-image-dimensions.d.cts.map +1 -1
- package/dist/adapters/extract-image-dimensions.d.ts +6 -0
- package/dist/adapters/extract-image-dimensions.d.ts.map +1 -1
- package/dist/adapters/extract-image-dimensions.js +9 -0
- package/dist/adapters/in-memory.cjs +6 -4
- package/dist/adapters/in-memory.d.cts +7 -1
- package/dist/adapters/in-memory.d.cts.map +1 -1
- package/dist/adapters/in-memory.d.ts +7 -1
- package/dist/adapters/in-memory.d.ts.map +1 -1
- package/dist/adapters/in-memory.js +6 -4
- package/dist/adapters/s3-presigned.cjs +90 -40
- package/dist/adapters/s3-presigned.d.cts +5 -4
- package/dist/adapters/s3-presigned.d.cts.map +1 -1
- package/dist/adapters/s3-presigned.d.ts +5 -4
- package/dist/adapters/s3-presigned.d.ts.map +1 -1
- package/dist/adapters/s3-presigned.js +80 -30
- package/dist/index.cjs +20 -20
- package/dist/index.d.cts +13 -13
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +13 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -7
- package/dist/plugin.cjs +56 -31
- package/dist/plugin.d.cts +6 -5
- package/dist/plugin.d.cts.map +1 -1
- package/dist/plugin.d.ts +6 -5
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +34 -17
- package/dist/testing/index.cjs +2 -2
- package/dist/testing/index.d.cts +1 -1
- package/dist/testing/index.d.cts.map +1 -1
- package/dist/testing/index.d.ts +1 -1
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +1 -1
- package/dist/{types.d.cts → types/types.d.cts} +9 -1
- package/dist/types/types.d.cts.map +1 -0
- package/dist/{types.d.ts → types/types.d.ts} +9 -1
- package/dist/types/types.d.ts.map +1 -0
- package/dist/types/types.js +1 -0
- package/dist/ui/AssetBrowser.cjs +55 -20
- package/dist/ui/AssetBrowser.d.cts +11 -2
- package/dist/ui/AssetBrowser.d.cts.map +1 -1
- package/dist/ui/AssetBrowser.d.ts +11 -2
- package/dist/ui/AssetBrowser.d.ts.map +1 -1
- package/dist/ui/AssetBrowser.js +55 -20
- package/dist/ui/AssetCommandPalette.cjs +20 -11
- package/dist/ui/AssetCommandPalette.d.cts +1 -1
- package/dist/ui/AssetCommandPalette.d.cts.map +1 -1
- package/dist/ui/AssetCommandPalette.d.ts +1 -1
- package/dist/ui/AssetCommandPalette.d.ts.map +1 -1
- package/dist/ui/AssetCommandPalette.js +19 -10
- package/dist/ui/AssetManagerUI.cjs +3 -2
- package/dist/ui/AssetManagerUI.d.cts +1 -1
- package/dist/ui/AssetManagerUI.d.cts.map +1 -1
- package/dist/ui/AssetManagerUI.d.ts +1 -1
- package/dist/ui/AssetManagerUI.d.ts.map +1 -1
- package/dist/ui/AssetManagerUI.js +2 -1
- package/dist/ui/DeleteAssetDialog.cjs +1 -0
- package/dist/ui/DeleteAssetDialog.d.cts +1 -1
- package/dist/ui/DeleteAssetDialog.d.cts.map +1 -1
- package/dist/ui/DeleteAssetDialog.d.ts +1 -1
- package/dist/ui/DeleteAssetDialog.d.ts.map +1 -1
- package/dist/ui/DeleteAssetDialog.js +1 -0
- package/dist/ui/MetadataPanel.cjs +1 -0
- package/dist/ui/MetadataPanel.d.cts +1 -1
- package/dist/ui/MetadataPanel.d.cts.map +1 -1
- package/dist/ui/MetadataPanel.d.ts +1 -1
- package/dist/ui/MetadataPanel.d.ts.map +1 -1
- package/dist/ui/MetadataPanel.js +1 -0
- package/dist/ui/ReplaceAssetDialog.cjs +1 -0
- package/dist/ui/ReplaceAssetDialog.d.cts +1 -1
- package/dist/ui/ReplaceAssetDialog.d.cts.map +1 -1
- package/dist/ui/ReplaceAssetDialog.d.ts +1 -1
- package/dist/ui/ReplaceAssetDialog.d.ts.map +1 -1
- package/dist/ui/ReplaceAssetDialog.js +1 -0
- package/dist/ui/UploadButton.cjs +24 -9
- package/dist/ui/UploadButton.d.cts +1 -1
- package/dist/ui/UploadButton.d.cts.map +1 -1
- package/dist/ui/UploadButton.d.ts +1 -1
- package/dist/ui/UploadButton.d.ts.map +1 -1
- package/dist/ui/UploadButton.js +23 -8
- package/dist/ui/index.cjs +5 -5
- package/dist/utils/asset-reference.d.cts.map +1 -0
- package/dist/utils/asset-reference.d.ts.map +1 -0
- package/dist/utils/csp.d.cts.map +1 -0
- package/dist/utils/csp.d.ts.map +1 -0
- package/dist/utils/errors.d.cts.map +1 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/header-action.d.cts.map +1 -0
- package/dist/utils/header-action.d.ts.map +1 -0
- package/dist/{infer-kind.d.cts → utils/infer-kind.d.cts} +1 -1
- package/dist/utils/infer-kind.d.cts.map +1 -0
- package/dist/{infer-kind.d.ts → utils/infer-kind.d.ts} +1 -1
- package/dist/utils/infer-kind.d.ts.map +1 -0
- package/dist/utils/registry.d.cts +3 -0
- package/dist/utils/registry.d.cts.map +1 -0
- package/dist/utils/registry.d.ts +3 -0
- package/dist/utils/registry.d.ts.map +1 -0
- package/dist/{resolver.cjs → utils/resolver.cjs} +8 -3
- package/dist/{resolver.d.cts → utils/resolver.d.cts} +1 -1
- package/dist/utils/resolver.d.cts.map +1 -0
- package/dist/{resolver.d.ts → utils/resolver.d.ts} +1 -1
- package/dist/utils/resolver.d.ts.map +1 -0
- package/dist/{resolver.js → utils/resolver.js} +6 -1
- package/dist/{retry.cjs → utils/retry.cjs} +10 -8
- package/dist/utils/retry.d.cts.map +1 -0
- package/dist/utils/retry.d.ts.map +1 -0
- package/dist/{retry.js → utils/retry.js} +10 -8
- package/dist/{studio-asset-source.cjs → utils/studio-asset-source.cjs} +28 -7
- package/dist/{studio-asset-source.d.cts → utils/studio-asset-source.d.cts} +2 -2
- package/dist/utils/studio-asset-source.d.cts.map +1 -0
- package/dist/{studio-asset-source.d.ts → utils/studio-asset-source.d.ts} +2 -2
- package/dist/utils/studio-asset-source.d.ts.map +1 -0
- package/dist/{studio-asset-source.js → utils/studio-asset-source.js} +26 -5
- package/dist/{validate-upload-result.cjs → utils/validate-upload-result.cjs} +49 -10
- package/dist/{validate-upload-result.d.cts → utils/validate-upload-result.d.cts} +1 -1
- package/dist/utils/validate-upload-result.d.cts.map +1 -0
- package/dist/{validate-upload-result.d.ts → utils/validate-upload-result.d.ts} +1 -1
- package/dist/utils/validate-upload-result.d.ts.map +1 -0
- package/dist/{validate-upload-result.js → utils/validate-upload-result.js} +49 -10
- package/dist/version.cjs +36 -0
- package/dist/version.d.cts +20 -0
- package/dist/version.d.cts.map +1 -0
- package/dist/version.d.ts +20 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +2 -0
- package/meta/config.json +8 -0
- package/package.json +23 -22
- package/dist/asset-reference.d.cts.map +0 -1
- package/dist/asset-reference.d.ts.map +0 -1
- package/dist/csp.d.cts.map +0 -1
- package/dist/csp.d.ts.map +0 -1
- package/dist/errors.d.cts.map +0 -1
- package/dist/errors.d.ts.map +0 -1
- package/dist/header-action.d.cts.map +0 -1
- package/dist/header-action.d.ts.map +0 -1
- package/dist/infer-kind.d.cts.map +0 -1
- package/dist/infer-kind.d.ts.map +0 -1
- package/dist/registry.d.cts +0 -3
- package/dist/registry.d.cts.map +0 -1
- package/dist/registry.d.ts +0 -3
- package/dist/registry.d.ts.map +0 -1
- package/dist/resolver.d.cts.map +0 -1
- package/dist/resolver.d.ts.map +0 -1
- package/dist/retry.d.cts.map +0 -1
- package/dist/retry.d.ts.map +0 -1
- package/dist/studio-asset-source.d.cts.map +0 -1
- package/dist/studio-asset-source.d.ts.map +0 -1
- package/dist/types.d.cts.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -0
- package/dist/validate-upload-result.d.cts.map +0 -1
- package/dist/validate-upload-result.d.ts.map +0 -1
- /package/dist/{types.cjs → types/types.cjs} +0 -0
- /package/dist/{asset-reference.cjs → utils/asset-reference.cjs} +0 -0
- /package/dist/{asset-reference.d.cts → utils/asset-reference.d.cts} +0 -0
- /package/dist/{asset-reference.d.ts → utils/asset-reference.d.ts} +0 -0
- /package/dist/{asset-reference.js → utils/asset-reference.js} +0 -0
- /package/dist/{csp.cjs → utils/csp.cjs} +0 -0
- /package/dist/{csp.d.cts → utils/csp.d.cts} +0 -0
- /package/dist/{csp.d.ts → utils/csp.d.ts} +0 -0
- /package/dist/{csp.js → utils/csp.js} +0 -0
- /package/dist/{errors.cjs → utils/errors.cjs} +0 -0
- /package/dist/{errors.d.cts → utils/errors.d.cts} +0 -0
- /package/dist/{errors.d.ts → utils/errors.d.ts} +0 -0
- /package/dist/{errors.js → utils/errors.js} +0 -0
- /package/dist/{header-action.cjs → utils/header-action.cjs} +0 -0
- /package/dist/{header-action.d.cts → utils/header-action.d.cts} +0 -0
- /package/dist/{header-action.d.ts → utils/header-action.d.ts} +0 -0
- /package/dist/{header-action.js → utils/header-action.js} +0 -0
- /package/dist/{infer-kind.cjs → utils/infer-kind.cjs} +0 -0
- /package/dist/{infer-kind.js → utils/infer-kind.js} +0 -0
- /package/dist/{registry.cjs → utils/registry.cjs} +0 -0
- /package/dist/{registry.js → utils/registry.js} +0 -0
- /package/dist/{retry.d.cts → utils/retry.d.cts} +0 -0
- /package/dist/{retry.d.ts → utils/retry.d.ts} +0 -0
|
@@ -31,17 +31,26 @@ async function extractImageDimensions(url, mimeType, options = {}) {
|
|
|
31
31
|
if (!mimeType || !mimeType.startsWith("image/")) return;
|
|
32
32
|
if ("u" < typeof Image) return;
|
|
33
33
|
const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
34
|
+
const signal = options.signal;
|
|
35
|
+
if (signal?.aborted) return;
|
|
34
36
|
return new Promise((resolve)=>{
|
|
35
37
|
let settled = false;
|
|
36
38
|
const image = new Image();
|
|
39
|
+
const onAbort = ()=>{
|
|
40
|
+
settle(void 0);
|
|
41
|
+
};
|
|
37
42
|
const settle = (value)=>{
|
|
38
43
|
if (settled) return;
|
|
39
44
|
settled = true;
|
|
40
45
|
image.onload = null;
|
|
41
46
|
image.onerror = null;
|
|
42
47
|
if (void 0 !== timer) clearTimeout(timer);
|
|
48
|
+
signal?.removeEventListener("abort", onAbort);
|
|
43
49
|
resolve(value);
|
|
44
50
|
};
|
|
51
|
+
signal?.addEventListener("abort", onAbort, {
|
|
52
|
+
once: true
|
|
53
|
+
});
|
|
45
54
|
image.onload = ()=>{
|
|
46
55
|
const width = Math.round(image.naturalWidth);
|
|
47
56
|
const height = Math.round(image.naturalHeight);
|
|
@@ -12,6 +12,12 @@
|
|
|
12
12
|
export interface ExtractImageDimensionsOptions {
|
|
13
13
|
/** Abort decode after this many ms. Default 3000. */
|
|
14
14
|
readonly timeoutMs?: number;
|
|
15
|
+
/**
|
|
16
|
+
* Cancels the in-flight decode. On abort the timer is cleared, the
|
|
17
|
+
* `Image` handlers are detached, and the promise resolves `undefined`
|
|
18
|
+
* (decode is best-effort — abort is not an error here).
|
|
19
|
+
*/
|
|
20
|
+
readonly signal?: AbortSignal;
|
|
15
21
|
}
|
|
16
22
|
export interface ImageDimensions {
|
|
17
23
|
readonly width: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract-image-dimensions.d.cts","sourceRoot":"","sources":["../../src/adapters/extract-image-dimensions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,WAAW,6BAA6B;IAC7C,qDAAqD;IACrD,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"extract-image-dimensions.d.cts","sourceRoot":"","sources":["../../src/adapters/extract-image-dimensions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,WAAW,6BAA6B;IAC7C,qDAAqD;IACrD,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC9B;AAED,MAAM,WAAW,eAAe;IAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACxB;AAID,wBAAsB,sBAAsB,CAC3C,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,OAAO,GAAE,6BAAkC,GACzC,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC,CAkEtC"}
|
|
@@ -12,6 +12,12 @@
|
|
|
12
12
|
export interface ExtractImageDimensionsOptions {
|
|
13
13
|
/** Abort decode after this many ms. Default 3000. */
|
|
14
14
|
readonly timeoutMs?: number;
|
|
15
|
+
/**
|
|
16
|
+
* Cancels the in-flight decode. On abort the timer is cleared, the
|
|
17
|
+
* `Image` handlers are detached, and the promise resolves `undefined`
|
|
18
|
+
* (decode is best-effort — abort is not an error here).
|
|
19
|
+
*/
|
|
20
|
+
readonly signal?: AbortSignal;
|
|
15
21
|
}
|
|
16
22
|
export interface ImageDimensions {
|
|
17
23
|
readonly width: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract-image-dimensions.d.ts","sourceRoot":"","sources":["../../src/adapters/extract-image-dimensions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,WAAW,6BAA6B;IAC7C,qDAAqD;IACrD,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"extract-image-dimensions.d.ts","sourceRoot":"","sources":["../../src/adapters/extract-image-dimensions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,WAAW,6BAA6B;IAC7C,qDAAqD;IACrD,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC9B;AAED,MAAM,WAAW,eAAe;IAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACxB;AAID,wBAAsB,sBAAsB,CAC3C,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,OAAO,GAAE,6BAAkC,GACzC,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC,CAkEtC"}
|
|
@@ -3,17 +3,26 @@ async function extractImageDimensions(url, mimeType, options = {}) {
|
|
|
3
3
|
if (!mimeType || !mimeType.startsWith("image/")) return;
|
|
4
4
|
if ("u" < typeof Image) return;
|
|
5
5
|
const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
6
|
+
const signal = options.signal;
|
|
7
|
+
if (signal?.aborted) return;
|
|
6
8
|
return new Promise((resolve)=>{
|
|
7
9
|
let settled = false;
|
|
8
10
|
const image = new Image();
|
|
11
|
+
const onAbort = ()=>{
|
|
12
|
+
settle(void 0);
|
|
13
|
+
};
|
|
9
14
|
const settle = (value)=>{
|
|
10
15
|
if (settled) return;
|
|
11
16
|
settled = true;
|
|
12
17
|
image.onload = null;
|
|
13
18
|
image.onerror = null;
|
|
14
19
|
if (void 0 !== timer) clearTimeout(timer);
|
|
20
|
+
signal?.removeEventListener("abort", onAbort);
|
|
15
21
|
resolve(value);
|
|
16
22
|
};
|
|
23
|
+
signal?.addEventListener("abort", onAbort, {
|
|
24
|
+
once: true
|
|
25
|
+
});
|
|
17
26
|
image.onload = ()=>{
|
|
18
27
|
const width = Math.round(image.naturalWidth);
|
|
19
28
|
const height = Math.round(image.naturalHeight);
|
|
@@ -28,14 +28,16 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
28
28
|
});
|
|
29
29
|
const external_extract_image_dimensions_cjs_namespaceObject = require("./extract-image-dimensions.cjs");
|
|
30
30
|
function inMemoryUploader() {
|
|
31
|
-
const filesById = new Map();
|
|
32
31
|
let counter = 0;
|
|
33
|
-
return async (file)=>{
|
|
32
|
+
return async (file, opts)=>{
|
|
34
33
|
counter += 1;
|
|
35
34
|
const id = `asset-${counter}`;
|
|
36
|
-
filesById.set(id, file);
|
|
37
35
|
const url = "function" == typeof URL.createObjectURL ? URL.createObjectURL(file) : `blob:asset-manager/${id}`;
|
|
38
|
-
const dimensions = await (0, external_extract_image_dimensions_cjs_namespaceObject.extractImageDimensions)(url, file.type
|
|
36
|
+
const dimensions = await (0, external_extract_image_dimensions_cjs_namespaceObject.extractImageDimensions)(url, file.type, {
|
|
37
|
+
...opts?.signal ? {
|
|
38
|
+
signal: opts.signal
|
|
39
|
+
} : {}
|
|
40
|
+
});
|
|
39
41
|
const result = {
|
|
40
42
|
id,
|
|
41
43
|
url,
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
import type { UploadAdapter } from "../types.js";
|
|
1
|
+
import type { UploadAdapter } from "../types/types.js";
|
|
2
|
+
/**
|
|
3
|
+
* In-memory upload adapter for demos and tests. Returns a `blob:` URL
|
|
4
|
+
* that the consumer renders directly, so the object URL intentionally
|
|
5
|
+
* lives for the page lifetime — it cannot be revoked while the asset is
|
|
6
|
+
* still referenced. Not for production use.
|
|
7
|
+
*/
|
|
2
8
|
export declare function inMemoryUploader(): UploadAdapter;
|
|
3
9
|
//# sourceMappingURL=in-memory.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"in-memory.d.cts","sourceRoot":"","sources":["../../src/adapters/in-memory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAgB,MAAM,
|
|
1
|
+
{"version":3,"file":"in-memory.d.cts","sourceRoot":"","sources":["../../src/adapters/in-memory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAgB,MAAM,mBAAmB,CAAC;AAGrE;;;;;GAKG;AACH,wBAAgB,gBAAgB,IAAI,aAAa,CA8BhD"}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
import type { UploadAdapter } from "../types.js";
|
|
1
|
+
import type { UploadAdapter } from "../types/types.js";
|
|
2
|
+
/**
|
|
3
|
+
* In-memory upload adapter for demos and tests. Returns a `blob:` URL
|
|
4
|
+
* that the consumer renders directly, so the object URL intentionally
|
|
5
|
+
* lives for the page lifetime — it cannot be revoked while the asset is
|
|
6
|
+
* still referenced. Not for production use.
|
|
7
|
+
*/
|
|
2
8
|
export declare function inMemoryUploader(): UploadAdapter;
|
|
3
9
|
//# sourceMappingURL=in-memory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"in-memory.d.ts","sourceRoot":"","sources":["../../src/adapters/in-memory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAgB,MAAM,
|
|
1
|
+
{"version":3,"file":"in-memory.d.ts","sourceRoot":"","sources":["../../src/adapters/in-memory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAgB,MAAM,mBAAmB,CAAC;AAGrE;;;;;GAKG;AACH,wBAAgB,gBAAgB,IAAI,aAAa,CA8BhD"}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { extractImageDimensions } from "./extract-image-dimensions.js";
|
|
2
2
|
function inMemoryUploader() {
|
|
3
|
-
const filesById = new Map();
|
|
4
3
|
let counter = 0;
|
|
5
|
-
return async (file)=>{
|
|
4
|
+
return async (file, opts)=>{
|
|
6
5
|
counter += 1;
|
|
7
6
|
const id = `asset-${counter}`;
|
|
8
|
-
filesById.set(id, file);
|
|
9
7
|
const url = "function" == typeof URL.createObjectURL ? URL.createObjectURL(file) : `blob:asset-manager/${id}`;
|
|
10
|
-
const dimensions = await extractImageDimensions(url, file.type
|
|
8
|
+
const dimensions = await extractImageDimensions(url, file.type, {
|
|
9
|
+
...opts?.signal ? {
|
|
10
|
+
signal: opts.signal
|
|
11
|
+
} : {}
|
|
12
|
+
});
|
|
11
13
|
const result = {
|
|
12
14
|
id,
|
|
13
15
|
url,
|
|
@@ -24,43 +24,48 @@ var __webpack_require__ = {};
|
|
|
24
24
|
var __webpack_exports__ = {};
|
|
25
25
|
__webpack_require__.r(__webpack_exports__);
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
RetryableError: ()=>retry_cjs_namespaceObject.RetryableError,
|
|
28
|
+
s3PresignedAdapter: ()=>s3PresignedAdapter
|
|
29
29
|
});
|
|
30
|
-
const
|
|
31
|
-
const
|
|
30
|
+
const errors_cjs_namespaceObject = require("../utils/errors.cjs");
|
|
31
|
+
const retry_cjs_namespaceObject = require("../utils/retry.cjs");
|
|
32
32
|
function s3PresignedAdapter(options) {
|
|
33
33
|
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
34
34
|
if ("function" != typeof fetchImpl) throw new Error("s3PresignedAdapter: no `fetch` implementation available. Pass `options.fetch`.");
|
|
35
35
|
const generateId = options.idGenerator ?? defaultIdGenerator;
|
|
36
|
-
return async (file)=>{
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
36
|
+
return async (file, callOptions)=>{
|
|
37
|
+
const { signal, dispose } = combineSignals(options.signal, callOptions?.signal);
|
|
38
|
+
try {
|
|
39
|
+
const presign = await (0, retry_cjs_namespaceObject.withRetry)(()=>requestPresign(file, fetchImpl, options, signal), {
|
|
40
|
+
...options.retry ?? {},
|
|
41
|
+
signal
|
|
42
|
+
});
|
|
43
|
+
await (0, retry_cjs_namespaceObject.withRetry)(()=>putToS3(file, presign, fetchImpl, signal), {
|
|
44
|
+
...options.retry ?? {},
|
|
45
|
+
signal
|
|
46
|
+
});
|
|
47
|
+
const id = presign.id ?? generateId();
|
|
48
|
+
const publicUrl = presign.publicUrl ?? stripQueryAndFragment(presign.url);
|
|
49
|
+
const result = {
|
|
50
|
+
id,
|
|
51
|
+
url: publicUrl,
|
|
52
|
+
...file.name ? {
|
|
53
|
+
name: file.name
|
|
54
|
+
} : {},
|
|
55
|
+
meta: {
|
|
56
|
+
size: file.size,
|
|
57
|
+
...file.type ? {
|
|
58
|
+
mimeType: file.type
|
|
59
|
+
} : {}
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
return result;
|
|
63
|
+
} finally{
|
|
64
|
+
dispose();
|
|
65
|
+
}
|
|
61
66
|
};
|
|
62
67
|
}
|
|
63
|
-
async function requestPresign(file, fetchImpl, options) {
|
|
68
|
+
async function requestPresign(file, fetchImpl, options, signal) {
|
|
64
69
|
const url = "string" == typeof options.presignEndpoint ? options.presignEndpoint : options.presignEndpoint.toString();
|
|
65
70
|
const body = JSON.stringify({
|
|
66
71
|
name: file.name,
|
|
@@ -76,28 +81,28 @@ async function requestPresign(file, fetchImpl, options) {
|
|
|
76
81
|
...options.headers ?? {}
|
|
77
82
|
},
|
|
78
83
|
body,
|
|
79
|
-
...
|
|
80
|
-
signal
|
|
84
|
+
...signal ? {
|
|
85
|
+
signal
|
|
81
86
|
} : {}
|
|
82
87
|
});
|
|
83
88
|
} catch (cause) {
|
|
84
|
-
throw new
|
|
89
|
+
throw new retry_cjs_namespaceObject.RetryableError(`s3PresignedAdapter: presign request failed (${describeError(cause)}).`, {
|
|
85
90
|
cause
|
|
86
91
|
});
|
|
87
92
|
}
|
|
88
|
-
if (response.status >= 500) throw new
|
|
93
|
+
if (response.status >= 500) throw new retry_cjs_namespaceObject.RetryableError(`s3PresignedAdapter: presign returned ${response.status}.`, {
|
|
89
94
|
retryAfterMs: parseRetryAfter(response.headers.get("retry-after"))
|
|
90
95
|
});
|
|
91
|
-
if (!response.ok) throw new
|
|
96
|
+
if (!response.ok) throw new errors_cjs_namespaceObject.AssetValidationError("UPLOAD_FAILED", `s3PresignedAdapter: presign returned ${response.status}.`);
|
|
92
97
|
let payload;
|
|
93
98
|
try {
|
|
94
99
|
payload = await response.json();
|
|
95
100
|
} catch (cause) {
|
|
96
|
-
throw new
|
|
101
|
+
throw new errors_cjs_namespaceObject.AssetValidationError("UPLOAD_FAILED", "s3PresignedAdapter: presign response was not JSON.", {
|
|
97
102
|
cause
|
|
98
103
|
});
|
|
99
104
|
}
|
|
100
|
-
if (!isPresignResponse(payload)) throw new
|
|
105
|
+
if (!isPresignResponse(payload)) throw new errors_cjs_namespaceObject.AssetValidationError("UPLOAD_FAILED", "s3PresignedAdapter: presign response missing `url`.");
|
|
101
106
|
return payload;
|
|
102
107
|
}
|
|
103
108
|
async function putToS3(file, presign, fetchImpl, signal) {
|
|
@@ -118,14 +123,14 @@ async function putToS3(file, presign, fetchImpl, signal) {
|
|
|
118
123
|
} : {}
|
|
119
124
|
});
|
|
120
125
|
} catch (cause) {
|
|
121
|
-
throw new
|
|
126
|
+
throw new retry_cjs_namespaceObject.RetryableError(`s3PresignedAdapter: PUT failed (${describeError(cause)}).`, {
|
|
122
127
|
cause
|
|
123
128
|
});
|
|
124
129
|
}
|
|
125
|
-
if (response.status >= 500) throw new
|
|
130
|
+
if (response.status >= 500) throw new retry_cjs_namespaceObject.RetryableError(`s3PresignedAdapter: PUT returned ${response.status}.`, {
|
|
126
131
|
retryAfterMs: parseRetryAfter(response.headers.get("retry-after"))
|
|
127
132
|
});
|
|
128
|
-
if (!response.ok) throw new
|
|
133
|
+
if (!response.ok) throw new errors_cjs_namespaceObject.AssetValidationError("UPLOAD_FAILED", `s3PresignedAdapter: PUT returned ${response.status}.`);
|
|
129
134
|
}
|
|
130
135
|
function isPresignResponse(value) {
|
|
131
136
|
return null !== value && "object" == typeof value && "string" == typeof value.url && value.url.length > 0;
|
|
@@ -155,6 +160,51 @@ function defaultIdGenerator() {
|
|
|
155
160
|
if (void 0 !== globalThis.crypto && "function" == typeof globalThis.crypto.randomUUID) return globalThis.crypto.randomUUID();
|
|
156
161
|
return `asset-${Math.random().toString(36).slice(2)}-${Date.now()}`;
|
|
157
162
|
}
|
|
163
|
+
const NOOP_DISPOSE = ()=>void 0;
|
|
164
|
+
function combineSignals(a, b) {
|
|
165
|
+
if (!a) return {
|
|
166
|
+
signal: b,
|
|
167
|
+
dispose: NOOP_DISPOSE
|
|
168
|
+
};
|
|
169
|
+
if (!b) return {
|
|
170
|
+
signal: a,
|
|
171
|
+
dispose: NOOP_DISPOSE
|
|
172
|
+
};
|
|
173
|
+
if (a === b) return {
|
|
174
|
+
signal: a,
|
|
175
|
+
dispose: NOOP_DISPOSE
|
|
176
|
+
};
|
|
177
|
+
const anyImpl = AbortSignal.any;
|
|
178
|
+
if ("function" == typeof anyImpl) return {
|
|
179
|
+
signal: anyImpl([
|
|
180
|
+
a,
|
|
181
|
+
b
|
|
182
|
+
]),
|
|
183
|
+
dispose: NOOP_DISPOSE
|
|
184
|
+
};
|
|
185
|
+
const controller = new AbortController();
|
|
186
|
+
const onAbortA = ()=>{
|
|
187
|
+
if (!controller.signal.aborted) controller.abort(a.reason);
|
|
188
|
+
};
|
|
189
|
+
const onAbortB = ()=>{
|
|
190
|
+
if (!controller.signal.aborted) controller.abort(b.reason);
|
|
191
|
+
};
|
|
192
|
+
if (a.aborted) onAbortA();
|
|
193
|
+
else a.addEventListener("abort", onAbortA, {
|
|
194
|
+
once: true
|
|
195
|
+
});
|
|
196
|
+
if (b.aborted) onAbortB();
|
|
197
|
+
else b.addEventListener("abort", onAbortB, {
|
|
198
|
+
once: true
|
|
199
|
+
});
|
|
200
|
+
return {
|
|
201
|
+
signal: controller.signal,
|
|
202
|
+
dispose: ()=>{
|
|
203
|
+
a.removeEventListener("abort", onAbortA);
|
|
204
|
+
b.removeEventListener("abort", onAbortB);
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
}
|
|
158
208
|
exports.RetryableError = __webpack_exports__.RetryableError;
|
|
159
209
|
exports.s3PresignedAdapter = __webpack_exports__.s3PresignedAdapter;
|
|
160
210
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
@@ -17,10 +17,11 @@
|
|
|
17
17
|
*
|
|
18
18
|
* @experimental Public surface may change before v1.0.
|
|
19
19
|
*/
|
|
20
|
-
import {
|
|
21
|
-
import type
|
|
22
|
-
export {
|
|
23
|
-
|
|
20
|
+
import type { UploadAdapter } from "../types/types.js";
|
|
21
|
+
import { type RetryOptions } from "../utils/retry.js";
|
|
22
|
+
export type { RetryOptions } from "../utils/retry.js";
|
|
23
|
+
/** @deprecated Import from `@anvilkit/plugin-asset-manager/retry` instead. */
|
|
24
|
+
export { RetryableError } from "../utils/retry.js";
|
|
24
25
|
export interface S3PresignedAdapterOptions {
|
|
25
26
|
/** Endpoint that returns a presigned PUT target for the file. */
|
|
26
27
|
readonly presignEndpoint: string | URL;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"s3-presigned.d.cts","sourceRoot":"","sources":["../../src/adapters/s3-presigned.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;
|
|
1
|
+
{"version":3,"file":"s3-presigned.d.cts","sourceRoot":"","sources":["../../src/adapters/s3-presigned.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAgB,MAAM,mBAAmB,CAAC;AAErE,OAAO,EAEN,KAAK,YAAY,EAEjB,MAAM,mBAAmB,CAAC;AAE3B,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAMtD,8EAA8E;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,MAAM,WAAW,yBAAyB;IACzC,iEAAiE;IACjE,QAAQ,CAAC,eAAe,EAAE,MAAM,GAAG,GAAG,CAAC;IACvC;;;;OAIG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;IACzC,yEAAyE;IACzE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,kDAAkD;IAClD,QAAQ,CAAC,KAAK,CAAC,EAAE,YAAY,CAAC;IAC9B,iEAAiE;IACjE,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;IAC9B,6DAA6D;IAC7D,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1C,uEAAuE;IACvE,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,MAAM,CAAC;CACpC;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IACjC,yBAAyB;IACzB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,yEAAyE;IACzE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,+DAA+D;IAC/D,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1C,wDAAwD;IACxD,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,kBAAkB,CACjC,OAAO,EAAE,yBAAyB,GAChC,aAAa,CA+Cf"}
|
|
@@ -17,10 +17,11 @@
|
|
|
17
17
|
*
|
|
18
18
|
* @experimental Public surface may change before v1.0.
|
|
19
19
|
*/
|
|
20
|
-
import {
|
|
21
|
-
import type
|
|
22
|
-
export {
|
|
23
|
-
|
|
20
|
+
import type { UploadAdapter } from "../types/types.js";
|
|
21
|
+
import { type RetryOptions } from "../utils/retry.js";
|
|
22
|
+
export type { RetryOptions } from "../utils/retry.js";
|
|
23
|
+
/** @deprecated Import from `@anvilkit/plugin-asset-manager/retry` instead. */
|
|
24
|
+
export { RetryableError } from "../utils/retry.js";
|
|
24
25
|
export interface S3PresignedAdapterOptions {
|
|
25
26
|
/** Endpoint that returns a presigned PUT target for the file. */
|
|
26
27
|
readonly presignEndpoint: string | URL;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"s3-presigned.d.ts","sourceRoot":"","sources":["../../src/adapters/s3-presigned.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;
|
|
1
|
+
{"version":3,"file":"s3-presigned.d.ts","sourceRoot":"","sources":["../../src/adapters/s3-presigned.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAgB,MAAM,mBAAmB,CAAC;AAErE,OAAO,EAEN,KAAK,YAAY,EAEjB,MAAM,mBAAmB,CAAC;AAE3B,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAMtD,8EAA8E;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,MAAM,WAAW,yBAAyB;IACzC,iEAAiE;IACjE,QAAQ,CAAC,eAAe,EAAE,MAAM,GAAG,GAAG,CAAC;IACvC;;;;OAIG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;IACzC,yEAAyE;IACzE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,kDAAkD;IAClD,QAAQ,CAAC,KAAK,CAAC,EAAE,YAAY,CAAC;IAC9B,iEAAiE;IACjE,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;IAC9B,6DAA6D;IAC7D,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1C,uEAAuE;IACvE,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,MAAM,CAAC;CACpC;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IACjC,yBAAyB;IACzB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,yEAAyE;IACzE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,+DAA+D;IAC/D,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1C,wDAAwD;IACxD,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,kBAAkB,CACjC,OAAO,EAAE,yBAAyB,GAChC,aAAa,CA+Cf"}
|
|
@@ -1,37 +1,42 @@
|
|
|
1
|
-
import { AssetValidationError } from "../errors.js";
|
|
2
|
-
import { RetryableError, withRetry } from "../retry.js";
|
|
1
|
+
import { AssetValidationError } from "../utils/errors.js";
|
|
2
|
+
import { RetryableError, withRetry } from "../utils/retry.js";
|
|
3
3
|
function s3PresignedAdapter(options) {
|
|
4
4
|
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
5
5
|
if ("function" != typeof fetchImpl) throw new Error("s3PresignedAdapter: no `fetch` implementation available. Pass `options.fetch`.");
|
|
6
6
|
const generateId = options.idGenerator ?? defaultIdGenerator;
|
|
7
|
-
return async (file)=>{
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
signal
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
7
|
+
return async (file, callOptions)=>{
|
|
8
|
+
const { signal, dispose } = combineSignals(options.signal, callOptions?.signal);
|
|
9
|
+
try {
|
|
10
|
+
const presign = await withRetry(()=>requestPresign(file, fetchImpl, options, signal), {
|
|
11
|
+
...options.retry ?? {},
|
|
12
|
+
signal
|
|
13
|
+
});
|
|
14
|
+
await withRetry(()=>putToS3(file, presign, fetchImpl, signal), {
|
|
15
|
+
...options.retry ?? {},
|
|
16
|
+
signal
|
|
17
|
+
});
|
|
18
|
+
const id = presign.id ?? generateId();
|
|
19
|
+
const publicUrl = presign.publicUrl ?? stripQueryAndFragment(presign.url);
|
|
20
|
+
const result = {
|
|
21
|
+
id,
|
|
22
|
+
url: publicUrl,
|
|
23
|
+
...file.name ? {
|
|
24
|
+
name: file.name
|
|
25
|
+
} : {},
|
|
26
|
+
meta: {
|
|
27
|
+
size: file.size,
|
|
28
|
+
...file.type ? {
|
|
29
|
+
mimeType: file.type
|
|
30
|
+
} : {}
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
return result;
|
|
34
|
+
} finally{
|
|
35
|
+
dispose();
|
|
36
|
+
}
|
|
32
37
|
};
|
|
33
38
|
}
|
|
34
|
-
async function requestPresign(file, fetchImpl, options) {
|
|
39
|
+
async function requestPresign(file, fetchImpl, options, signal) {
|
|
35
40
|
const url = "string" == typeof options.presignEndpoint ? options.presignEndpoint : options.presignEndpoint.toString();
|
|
36
41
|
const body = JSON.stringify({
|
|
37
42
|
name: file.name,
|
|
@@ -47,8 +52,8 @@ async function requestPresign(file, fetchImpl, options) {
|
|
|
47
52
|
...options.headers ?? {}
|
|
48
53
|
},
|
|
49
54
|
body,
|
|
50
|
-
...
|
|
51
|
-
signal
|
|
55
|
+
...signal ? {
|
|
56
|
+
signal
|
|
52
57
|
} : {}
|
|
53
58
|
});
|
|
54
59
|
} catch (cause) {
|
|
@@ -126,4 +131,49 @@ function defaultIdGenerator() {
|
|
|
126
131
|
if (void 0 !== globalThis.crypto && "function" == typeof globalThis.crypto.randomUUID) return globalThis.crypto.randomUUID();
|
|
127
132
|
return `asset-${Math.random().toString(36).slice(2)}-${Date.now()}`;
|
|
128
133
|
}
|
|
134
|
+
const NOOP_DISPOSE = ()=>void 0;
|
|
135
|
+
function combineSignals(a, b) {
|
|
136
|
+
if (!a) return {
|
|
137
|
+
signal: b,
|
|
138
|
+
dispose: NOOP_DISPOSE
|
|
139
|
+
};
|
|
140
|
+
if (!b) return {
|
|
141
|
+
signal: a,
|
|
142
|
+
dispose: NOOP_DISPOSE
|
|
143
|
+
};
|
|
144
|
+
if (a === b) return {
|
|
145
|
+
signal: a,
|
|
146
|
+
dispose: NOOP_DISPOSE
|
|
147
|
+
};
|
|
148
|
+
const anyImpl = AbortSignal.any;
|
|
149
|
+
if ("function" == typeof anyImpl) return {
|
|
150
|
+
signal: anyImpl([
|
|
151
|
+
a,
|
|
152
|
+
b
|
|
153
|
+
]),
|
|
154
|
+
dispose: NOOP_DISPOSE
|
|
155
|
+
};
|
|
156
|
+
const controller = new AbortController();
|
|
157
|
+
const onAbortA = ()=>{
|
|
158
|
+
if (!controller.signal.aborted) controller.abort(a.reason);
|
|
159
|
+
};
|
|
160
|
+
const onAbortB = ()=>{
|
|
161
|
+
if (!controller.signal.aborted) controller.abort(b.reason);
|
|
162
|
+
};
|
|
163
|
+
if (a.aborted) onAbortA();
|
|
164
|
+
else a.addEventListener("abort", onAbortA, {
|
|
165
|
+
once: true
|
|
166
|
+
});
|
|
167
|
+
if (b.aborted) onAbortB();
|
|
168
|
+
else b.addEventListener("abort", onAbortB, {
|
|
169
|
+
once: true
|
|
170
|
+
});
|
|
171
|
+
return {
|
|
172
|
+
signal: controller.signal,
|
|
173
|
+
dispose: ()=>{
|
|
174
|
+
a.removeEventListener("abort", onAbortA);
|
|
175
|
+
b.removeEventListener("abort", onAbortB);
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
}
|
|
129
179
|
export { RetryableError, s3PresignedAdapter };
|
package/dist/index.cjs
CHANGED
|
@@ -24,33 +24,33 @@ var __webpack_require__ = {};
|
|
|
24
24
|
var __webpack_exports__ = {};
|
|
25
25
|
__webpack_require__.r(__webpack_exports__);
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
-
AssetResolutionError: ()=>
|
|
28
|
-
|
|
29
|
-
inferAssetKind: ()=>external_infer_kind_cjs_namespaceObject.inferAssetKind,
|
|
30
|
-
createIRAssetResolver: ()=>external_resolver_cjs_namespaceObject.createIRAssetResolver,
|
|
31
|
-
resolveAssets: ()=>external_resolver_cjs_namespaceObject.resolveAssets,
|
|
27
|
+
AssetResolutionError: ()=>errors_cjs_namespaceObject.AssetResolutionError,
|
|
28
|
+
AssetValidationError: ()=>errors_cjs_namespaceObject.AssetValidationError,
|
|
32
29
|
createAssetManagerPlugin: ()=>external_plugin_cjs_namespaceObject.createAssetManagerPlugin,
|
|
33
|
-
|
|
34
|
-
createAssetRegistry: ()=>
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
getAssetRegistry: ()=>external_plugin_cjs_namespaceObject.getAssetRegistry,
|
|
38
|
-
createStudioAssetSource: ()=>external_studio_asset_source_cjs_namespaceObject.createStudioAssetSource,
|
|
39
|
-
inferStudioAssetKind: ()=>external_studio_asset_source_cjs_namespaceObject.inferStudioAssetKind,
|
|
30
|
+
createAssetReference: ()=>external_plugin_cjs_namespaceObject.createAssetReference,
|
|
31
|
+
createAssetRegistry: ()=>registry_cjs_namespaceObject.createAssetRegistry,
|
|
32
|
+
createIRAssetResolver: ()=>resolver_cjs_namespaceObject.createIRAssetResolver,
|
|
33
|
+
createStudioAssetSource: ()=>studio_asset_source_cjs_namespaceObject.createStudioAssetSource,
|
|
40
34
|
dataUrlUploader: ()=>data_url_cjs_namespaceObject.dataUrlUploader,
|
|
35
|
+
getAssetRegistry: ()=>external_plugin_cjs_namespaceObject.getAssetRegistry,
|
|
36
|
+
getRequiredCsp: ()=>csp_cjs_namespaceObject.getRequiredCsp,
|
|
41
37
|
inMemoryUploader: ()=>in_memory_cjs_namespaceObject.inMemoryUploader,
|
|
42
|
-
|
|
38
|
+
inferAssetKind: ()=>infer_kind_cjs_namespaceObject.inferAssetKind,
|
|
39
|
+
inferStudioAssetKind: ()=>studio_asset_source_cjs_namespaceObject.inferStudioAssetKind,
|
|
40
|
+
resolveAssets: ()=>resolver_cjs_namespaceObject.resolveAssets,
|
|
41
|
+
uploadAsset: ()=>external_plugin_cjs_namespaceObject.uploadAsset,
|
|
42
|
+
validateUploadResult: ()=>validate_upload_result_cjs_namespaceObject.validateUploadResult
|
|
43
43
|
});
|
|
44
44
|
const data_url_cjs_namespaceObject = require("./adapters/data-url.cjs");
|
|
45
45
|
const in_memory_cjs_namespaceObject = require("./adapters/in-memory.cjs");
|
|
46
|
-
const external_csp_cjs_namespaceObject = require("./csp.cjs");
|
|
47
|
-
const external_errors_cjs_namespaceObject = require("./errors.cjs");
|
|
48
|
-
const external_infer_kind_cjs_namespaceObject = require("./infer-kind.cjs");
|
|
49
46
|
const external_plugin_cjs_namespaceObject = require("./plugin.cjs");
|
|
50
|
-
const
|
|
51
|
-
const
|
|
52
|
-
const
|
|
53
|
-
const
|
|
47
|
+
const csp_cjs_namespaceObject = require("./utils/csp.cjs");
|
|
48
|
+
const errors_cjs_namespaceObject = require("./utils/errors.cjs");
|
|
49
|
+
const infer_kind_cjs_namespaceObject = require("./utils/infer-kind.cjs");
|
|
50
|
+
const registry_cjs_namespaceObject = require("./utils/registry.cjs");
|
|
51
|
+
const resolver_cjs_namespaceObject = require("./utils/resolver.cjs");
|
|
52
|
+
const studio_asset_source_cjs_namespaceObject = require("./utils/studio-asset-source.cjs");
|
|
53
|
+
const validate_upload_result_cjs_namespaceObject = require("./utils/validate-upload-result.cjs");
|
|
54
54
|
exports.AssetResolutionError = __webpack_exports__.AssetResolutionError;
|
|
55
55
|
exports.AssetValidationError = __webpack_exports__.AssetValidationError;
|
|
56
56
|
exports.createAssetManagerPlugin = __webpack_exports__.createAssetManagerPlugin;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
export type { DataUrlUploaderOptions } from "./adapters/data-url.js";
|
|
2
2
|
export { dataUrlUploader } from "./adapters/data-url.js";
|
|
3
3
|
export { inMemoryUploader } from "./adapters/in-memory.js";
|
|
4
|
-
export type { RequiredCsp, RequiredCspOptions, S3CspOptions, } from "./csp.js";
|
|
5
|
-
export { getRequiredCsp } from "./csp.js";
|
|
6
|
-
export type { AssetResolutionErrorCode } from "./errors.js";
|
|
7
|
-
export { AssetResolutionError, AssetValidationError, } from "./errors.js";
|
|
8
|
-
export { inferAssetKind } from "./infer-kind.js";
|
|
9
4
|
export { createAssetManagerPlugin, createAssetReference, getAssetRegistry, uploadAsset, } from "./plugin.js";
|
|
10
|
-
export {
|
|
11
|
-
export type {
|
|
12
|
-
export {
|
|
13
|
-
export type {
|
|
14
|
-
export {
|
|
15
|
-
export
|
|
16
|
-
export
|
|
17
|
-
export {
|
|
5
|
+
export type { AssetKind, AssetManagerOptions, AssetMeta, AssetRegistry, AssetRegistryListener, AssetSearchOptions, AssetSearchPage, UploadAdapter, UploadAdapterOptions, UploadResult, } from "./types/types.js";
|
|
6
|
+
export type { RequiredCsp, RequiredCspOptions, S3CspOptions, } from "./utils/csp.js";
|
|
7
|
+
export { getRequiredCsp } from "./utils/csp.js";
|
|
8
|
+
export type { AssetResolutionErrorCode } from "./utils/errors.js";
|
|
9
|
+
export { AssetResolutionError, AssetValidationError } from "./utils/errors.js";
|
|
10
|
+
export { inferAssetKind } from "./utils/infer-kind.js";
|
|
11
|
+
export { createAssetRegistry } from "./utils/registry.js";
|
|
12
|
+
export type { CreateIRAssetResolverOptions } from "./utils/resolver.js";
|
|
13
|
+
export { createIRAssetResolver, resolveAssets } from "./utils/resolver.js";
|
|
14
|
+
export type { CreateStudioAssetSourceOptions } from "./utils/studio-asset-source.js";
|
|
15
|
+
export { createStudioAssetSource, inferStudioAssetKind, } from "./utils/studio-asset-source.js";
|
|
16
|
+
export type { ValidateUploadResultOptions } from "./utils/validate-upload-result.js";
|
|
17
|
+
export { validateUploadResult } from "./utils/validate-upload-result.js";
|
|
18
18
|
//# sourceMappingURL=index.d.cts.map
|