@medialane/sdk 0.191.0 → 0.192.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/dist/index.cjs +24 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +23 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -837,6 +837,7 @@ declare const MAX_IPFS_GATEWAY_RESPONSE_BYTES: number;
|
|
|
837
837
|
type UploadKind = "image" | "document" | "media";
|
|
838
838
|
interface UploadLimit {
|
|
839
839
|
mimeTypes: readonly string[];
|
|
840
|
+
extensions: readonly string[];
|
|
840
841
|
}
|
|
841
842
|
declare const MAX_UPLOAD_BYTES: number;
|
|
842
843
|
declare const UPLOAD_LIMITS: Record<UploadKind, UploadLimit>;
|
|
@@ -844,5 +845,11 @@ declare function formatFileSize(bytes: number): string;
|
|
|
844
845
|
declare function uploadSizeError(file: {
|
|
845
846
|
size: number;
|
|
846
847
|
}, kind?: UploadKind): string | null;
|
|
848
|
+
declare function acceptFor(kind: UploadKind): string;
|
|
849
|
+
declare function uploadError(file: {
|
|
850
|
+
size: number;
|
|
851
|
+
type: string;
|
|
852
|
+
name?: string;
|
|
853
|
+
}, kind?: UploadKind): string | null;
|
|
847
854
|
|
|
848
|
-
export { ACCOUNT_SESSION_COOKIE, ACCOUNT_SESSION_TTL_SECONDS, ALLOWED_IMAGE_CONTENT_TYPES, type AppGatewayConfig, type AppSessionConfig, type AssetAttribute, type AssetMetadata, type BackendMetadataConfig, type BackendUploadResult, type BuildAssetMetadataInput, type BuildCollectionMetadataInput, type CanonicalHash, type CappedBody, type CertificateEmissionNextStep, type CertificateEmissionRun, Chain, type CollectionMetadata, type ConfirmResult, DEFAULT_CURRENCY, type DataTokenizationRun, type FeeEnv, IDENTITY_TTL_SECONDS, IPFS_SAFE_CONTENT_TYPE_PREFIXES, type ImageProxyConfig, type LaunchpadRun, type LaunchpadRunsClient, type LaunchpadRunsClientOptions, MAX_IMAGE_PROXY_BYTES, MAX_IMAGE_REDIRECTS, MAX_IPFS_GATEWAY_RESPONSE_BYTES, MAX_UPLOAD_BYTES, type NextStep, RESERVED_TRAITS, type RemixPolicy, type RemixPolicyInput, ResolvedFeeConfig, type RunQuote, type RunQuoteLine, RunRequestError, type RunStatus, STARKNET_COLLECTION_1155_CLASS_HASH, STARKNET_COLLECTION_1155_CONTRACT, STARKNET_COLLECTION_1155_FACTORY_CLASS_HASH, STARKNET_COLLECTION_1155_START_BLOCK, STARKNET_COLLECTION_721_CONTRACT, STARKNET_COLLECTION_721_START_BLOCK, STARKNET_CREATOR_COIN_CLASS_HASH, STARKNET_CREATOR_COIN_EKUBO_LAUNCHER, STARKNET_CREATOR_COIN_FACTORY_CLASS_HASH, STARKNET_CREATOR_COIN_FACTORY_CONTRACT, STARKNET_CREATOR_COIN_START_BLOCK, STARKNET_DATA_TOKENIZATION_721_CONTRACT, STARKNET_DROP_COLLECTION_CLASS_HASH, STARKNET_DROP_FACTORY_CONTRACT, STARKNET_DROP_FACTORY_START_BLOCK, STARKNET_EKUBO_CORE, STARKNET_GENESIS_MINT_CONTRACT, STARKNET_GENESIS_NFT_URI, STARKNET_IPCOLLECTION_CLASS_HASH, STARKNET_IPNFT_CLASS_HASH, STARKNET_IP_CLUB_COLLECTION_CLASS_HASH, STARKNET_IP_CLUB_FACTORY_CONTRACT, STARKNET_IP_SPONSORSHIP_CLASS_HASH, STARKNET_IP_SPONSORSHIP_CONTRACT, STARKNET_IP_TICKETS_FACTORY_CONTRACT, STARKNET_IP_TICKET_COLLECTION_CLASS_HASH, STARKNET_MARKETPLACE_1155_CLASS_HASH, STARKNET_MARKETPLACE_1155_CONTRACT, STARKNET_MARKETPLACE_1155_START_BLOCK, STARKNET_MARKETPLACE_721_CLASS_HASH, STARKNET_MARKETPLACE_721_CONTRACT, STARKNET_MARKETPLACE_721_START_BLOCK, STARKNET_NFTCOMMENTS_CONTRACT, STARKNET_POP_COLLECTION_CLASS_HASH, STARKNET_POP_FACTORY_CONTRACT, STARKNET_POP_FACTORY_START_BLOCK, SUPPORTED_TOKENS, SUPPORTED_URL_CHAINS, ServiceCapability, ServiceDefinition, type ServiceId, type SiwsIdentity, type SupportedToken, type SupportedTokenSymbol, type TicketingNextStep, type TicketingRun, UPLOAD_LIMITS, type UploadKind, type UploadLimit, type WalletRequest, assetHref, buildAssetMetadata, buildCollectionMetadata, chainFromSlug, chainSlug, coinHref, collectionHref, createAppGateway, createAppSessionHandler, createImageProxyHandler, createLaunchpadRunsClient, dropHref, encodeU256, formatAmount, formatFileSize, getBackendSignedUrl, getDerivativesTerm, getListableTokens, getService, getServicesByCapability, getTokenByAddress, getTokenBySymbol, hasCapability, isCertificateEmissionRun, isDataTokenizationRun, isPrivateHost, isPrivateOrInsecureUrl, isPublicAppRoute, isSameOrigin, isServiceId, isTicketingRun, isValidIpfsCidPath, issueAccountSessionToken, issueSiwsToken, listServices, normalizeAddress, normalizeHash, parseAmount, profileHref, readBodyWithCap, resolveAppFeeConfig, resolveRemixPolicy, resolveSafeImageContentType, shortenAddress, stringifyBigInts, u256ToBigInt, uploadDirectoryToBackend, uploadFileToBackend, uploadJsonToBackend, uploadSizeError, validateUrl, verifyAccountSessionToken, verifySiwsToken };
|
|
855
|
+
export { ACCOUNT_SESSION_COOKIE, ACCOUNT_SESSION_TTL_SECONDS, ALLOWED_IMAGE_CONTENT_TYPES, type AppGatewayConfig, type AppSessionConfig, type AssetAttribute, type AssetMetadata, type BackendMetadataConfig, type BackendUploadResult, type BuildAssetMetadataInput, type BuildCollectionMetadataInput, type CanonicalHash, type CappedBody, type CertificateEmissionNextStep, type CertificateEmissionRun, Chain, type CollectionMetadata, type ConfirmResult, DEFAULT_CURRENCY, type DataTokenizationRun, type FeeEnv, IDENTITY_TTL_SECONDS, IPFS_SAFE_CONTENT_TYPE_PREFIXES, type ImageProxyConfig, type LaunchpadRun, type LaunchpadRunsClient, type LaunchpadRunsClientOptions, MAX_IMAGE_PROXY_BYTES, MAX_IMAGE_REDIRECTS, MAX_IPFS_GATEWAY_RESPONSE_BYTES, MAX_UPLOAD_BYTES, type NextStep, RESERVED_TRAITS, type RemixPolicy, type RemixPolicyInput, ResolvedFeeConfig, type RunQuote, type RunQuoteLine, RunRequestError, type RunStatus, STARKNET_COLLECTION_1155_CLASS_HASH, STARKNET_COLLECTION_1155_CONTRACT, STARKNET_COLLECTION_1155_FACTORY_CLASS_HASH, STARKNET_COLLECTION_1155_START_BLOCK, STARKNET_COLLECTION_721_CONTRACT, STARKNET_COLLECTION_721_START_BLOCK, STARKNET_CREATOR_COIN_CLASS_HASH, STARKNET_CREATOR_COIN_EKUBO_LAUNCHER, STARKNET_CREATOR_COIN_FACTORY_CLASS_HASH, STARKNET_CREATOR_COIN_FACTORY_CONTRACT, STARKNET_CREATOR_COIN_START_BLOCK, STARKNET_DATA_TOKENIZATION_721_CONTRACT, STARKNET_DROP_COLLECTION_CLASS_HASH, STARKNET_DROP_FACTORY_CONTRACT, STARKNET_DROP_FACTORY_START_BLOCK, STARKNET_EKUBO_CORE, STARKNET_GENESIS_MINT_CONTRACT, STARKNET_GENESIS_NFT_URI, STARKNET_IPCOLLECTION_CLASS_HASH, STARKNET_IPNFT_CLASS_HASH, STARKNET_IP_CLUB_COLLECTION_CLASS_HASH, STARKNET_IP_CLUB_FACTORY_CONTRACT, STARKNET_IP_SPONSORSHIP_CLASS_HASH, STARKNET_IP_SPONSORSHIP_CONTRACT, STARKNET_IP_TICKETS_FACTORY_CONTRACT, STARKNET_IP_TICKET_COLLECTION_CLASS_HASH, STARKNET_MARKETPLACE_1155_CLASS_HASH, STARKNET_MARKETPLACE_1155_CONTRACT, STARKNET_MARKETPLACE_1155_START_BLOCK, STARKNET_MARKETPLACE_721_CLASS_HASH, STARKNET_MARKETPLACE_721_CONTRACT, STARKNET_MARKETPLACE_721_START_BLOCK, STARKNET_NFTCOMMENTS_CONTRACT, STARKNET_POP_COLLECTION_CLASS_HASH, STARKNET_POP_FACTORY_CONTRACT, STARKNET_POP_FACTORY_START_BLOCK, SUPPORTED_TOKENS, SUPPORTED_URL_CHAINS, ServiceCapability, ServiceDefinition, type ServiceId, type SiwsIdentity, type SupportedToken, type SupportedTokenSymbol, type TicketingNextStep, type TicketingRun, UPLOAD_LIMITS, type UploadKind, type UploadLimit, type WalletRequest, acceptFor, assetHref, buildAssetMetadata, buildCollectionMetadata, chainFromSlug, chainSlug, coinHref, collectionHref, createAppGateway, createAppSessionHandler, createImageProxyHandler, createLaunchpadRunsClient, dropHref, encodeU256, formatAmount, formatFileSize, getBackendSignedUrl, getDerivativesTerm, getListableTokens, getService, getServicesByCapability, getTokenByAddress, getTokenBySymbol, hasCapability, isCertificateEmissionRun, isDataTokenizationRun, isPrivateHost, isPrivateOrInsecureUrl, isPublicAppRoute, isSameOrigin, isServiceId, isTicketingRun, isValidIpfsCidPath, issueAccountSessionToken, issueSiwsToken, listServices, normalizeAddress, normalizeHash, parseAmount, profileHref, readBodyWithCap, resolveAppFeeConfig, resolveRemixPolicy, resolveSafeImageContentType, shortenAddress, stringifyBigInts, u256ToBigInt, uploadDirectoryToBackend, uploadError, uploadFileToBackend, uploadJsonToBackend, uploadSizeError, validateUrl, verifyAccountSessionToken, verifySiwsToken };
|
package/dist/index.d.ts
CHANGED
|
@@ -837,6 +837,7 @@ declare const MAX_IPFS_GATEWAY_RESPONSE_BYTES: number;
|
|
|
837
837
|
type UploadKind = "image" | "document" | "media";
|
|
838
838
|
interface UploadLimit {
|
|
839
839
|
mimeTypes: readonly string[];
|
|
840
|
+
extensions: readonly string[];
|
|
840
841
|
}
|
|
841
842
|
declare const MAX_UPLOAD_BYTES: number;
|
|
842
843
|
declare const UPLOAD_LIMITS: Record<UploadKind, UploadLimit>;
|
|
@@ -844,5 +845,11 @@ declare function formatFileSize(bytes: number): string;
|
|
|
844
845
|
declare function uploadSizeError(file: {
|
|
845
846
|
size: number;
|
|
846
847
|
}, kind?: UploadKind): string | null;
|
|
848
|
+
declare function acceptFor(kind: UploadKind): string;
|
|
849
|
+
declare function uploadError(file: {
|
|
850
|
+
size: number;
|
|
851
|
+
type: string;
|
|
852
|
+
name?: string;
|
|
853
|
+
}, kind?: UploadKind): string | null;
|
|
847
854
|
|
|
848
|
-
export { ACCOUNT_SESSION_COOKIE, ACCOUNT_SESSION_TTL_SECONDS, ALLOWED_IMAGE_CONTENT_TYPES, type AppGatewayConfig, type AppSessionConfig, type AssetAttribute, type AssetMetadata, type BackendMetadataConfig, type BackendUploadResult, type BuildAssetMetadataInput, type BuildCollectionMetadataInput, type CanonicalHash, type CappedBody, type CertificateEmissionNextStep, type CertificateEmissionRun, Chain, type CollectionMetadata, type ConfirmResult, DEFAULT_CURRENCY, type DataTokenizationRun, type FeeEnv, IDENTITY_TTL_SECONDS, IPFS_SAFE_CONTENT_TYPE_PREFIXES, type ImageProxyConfig, type LaunchpadRun, type LaunchpadRunsClient, type LaunchpadRunsClientOptions, MAX_IMAGE_PROXY_BYTES, MAX_IMAGE_REDIRECTS, MAX_IPFS_GATEWAY_RESPONSE_BYTES, MAX_UPLOAD_BYTES, type NextStep, RESERVED_TRAITS, type RemixPolicy, type RemixPolicyInput, ResolvedFeeConfig, type RunQuote, type RunQuoteLine, RunRequestError, type RunStatus, STARKNET_COLLECTION_1155_CLASS_HASH, STARKNET_COLLECTION_1155_CONTRACT, STARKNET_COLLECTION_1155_FACTORY_CLASS_HASH, STARKNET_COLLECTION_1155_START_BLOCK, STARKNET_COLLECTION_721_CONTRACT, STARKNET_COLLECTION_721_START_BLOCK, STARKNET_CREATOR_COIN_CLASS_HASH, STARKNET_CREATOR_COIN_EKUBO_LAUNCHER, STARKNET_CREATOR_COIN_FACTORY_CLASS_HASH, STARKNET_CREATOR_COIN_FACTORY_CONTRACT, STARKNET_CREATOR_COIN_START_BLOCK, STARKNET_DATA_TOKENIZATION_721_CONTRACT, STARKNET_DROP_COLLECTION_CLASS_HASH, STARKNET_DROP_FACTORY_CONTRACT, STARKNET_DROP_FACTORY_START_BLOCK, STARKNET_EKUBO_CORE, STARKNET_GENESIS_MINT_CONTRACT, STARKNET_GENESIS_NFT_URI, STARKNET_IPCOLLECTION_CLASS_HASH, STARKNET_IPNFT_CLASS_HASH, STARKNET_IP_CLUB_COLLECTION_CLASS_HASH, STARKNET_IP_CLUB_FACTORY_CONTRACT, STARKNET_IP_SPONSORSHIP_CLASS_HASH, STARKNET_IP_SPONSORSHIP_CONTRACT, STARKNET_IP_TICKETS_FACTORY_CONTRACT, STARKNET_IP_TICKET_COLLECTION_CLASS_HASH, STARKNET_MARKETPLACE_1155_CLASS_HASH, STARKNET_MARKETPLACE_1155_CONTRACT, STARKNET_MARKETPLACE_1155_START_BLOCK, STARKNET_MARKETPLACE_721_CLASS_HASH, STARKNET_MARKETPLACE_721_CONTRACT, STARKNET_MARKETPLACE_721_START_BLOCK, STARKNET_NFTCOMMENTS_CONTRACT, STARKNET_POP_COLLECTION_CLASS_HASH, STARKNET_POP_FACTORY_CONTRACT, STARKNET_POP_FACTORY_START_BLOCK, SUPPORTED_TOKENS, SUPPORTED_URL_CHAINS, ServiceCapability, ServiceDefinition, type ServiceId, type SiwsIdentity, type SupportedToken, type SupportedTokenSymbol, type TicketingNextStep, type TicketingRun, UPLOAD_LIMITS, type UploadKind, type UploadLimit, type WalletRequest, assetHref, buildAssetMetadata, buildCollectionMetadata, chainFromSlug, chainSlug, coinHref, collectionHref, createAppGateway, createAppSessionHandler, createImageProxyHandler, createLaunchpadRunsClient, dropHref, encodeU256, formatAmount, formatFileSize, getBackendSignedUrl, getDerivativesTerm, getListableTokens, getService, getServicesByCapability, getTokenByAddress, getTokenBySymbol, hasCapability, isCertificateEmissionRun, isDataTokenizationRun, isPrivateHost, isPrivateOrInsecureUrl, isPublicAppRoute, isSameOrigin, isServiceId, isTicketingRun, isValidIpfsCidPath, issueAccountSessionToken, issueSiwsToken, listServices, normalizeAddress, normalizeHash, parseAmount, profileHref, readBodyWithCap, resolveAppFeeConfig, resolveRemixPolicy, resolveSafeImageContentType, shortenAddress, stringifyBigInts, u256ToBigInt, uploadDirectoryToBackend, uploadFileToBackend, uploadJsonToBackend, uploadSizeError, validateUrl, verifyAccountSessionToken, verifySiwsToken };
|
|
855
|
+
export { ACCOUNT_SESSION_COOKIE, ACCOUNT_SESSION_TTL_SECONDS, ALLOWED_IMAGE_CONTENT_TYPES, type AppGatewayConfig, type AppSessionConfig, type AssetAttribute, type AssetMetadata, type BackendMetadataConfig, type BackendUploadResult, type BuildAssetMetadataInput, type BuildCollectionMetadataInput, type CanonicalHash, type CappedBody, type CertificateEmissionNextStep, type CertificateEmissionRun, Chain, type CollectionMetadata, type ConfirmResult, DEFAULT_CURRENCY, type DataTokenizationRun, type FeeEnv, IDENTITY_TTL_SECONDS, IPFS_SAFE_CONTENT_TYPE_PREFIXES, type ImageProxyConfig, type LaunchpadRun, type LaunchpadRunsClient, type LaunchpadRunsClientOptions, MAX_IMAGE_PROXY_BYTES, MAX_IMAGE_REDIRECTS, MAX_IPFS_GATEWAY_RESPONSE_BYTES, MAX_UPLOAD_BYTES, type NextStep, RESERVED_TRAITS, type RemixPolicy, type RemixPolicyInput, ResolvedFeeConfig, type RunQuote, type RunQuoteLine, RunRequestError, type RunStatus, STARKNET_COLLECTION_1155_CLASS_HASH, STARKNET_COLLECTION_1155_CONTRACT, STARKNET_COLLECTION_1155_FACTORY_CLASS_HASH, STARKNET_COLLECTION_1155_START_BLOCK, STARKNET_COLLECTION_721_CONTRACT, STARKNET_COLLECTION_721_START_BLOCK, STARKNET_CREATOR_COIN_CLASS_HASH, STARKNET_CREATOR_COIN_EKUBO_LAUNCHER, STARKNET_CREATOR_COIN_FACTORY_CLASS_HASH, STARKNET_CREATOR_COIN_FACTORY_CONTRACT, STARKNET_CREATOR_COIN_START_BLOCK, STARKNET_DATA_TOKENIZATION_721_CONTRACT, STARKNET_DROP_COLLECTION_CLASS_HASH, STARKNET_DROP_FACTORY_CONTRACT, STARKNET_DROP_FACTORY_START_BLOCK, STARKNET_EKUBO_CORE, STARKNET_GENESIS_MINT_CONTRACT, STARKNET_GENESIS_NFT_URI, STARKNET_IPCOLLECTION_CLASS_HASH, STARKNET_IPNFT_CLASS_HASH, STARKNET_IP_CLUB_COLLECTION_CLASS_HASH, STARKNET_IP_CLUB_FACTORY_CONTRACT, STARKNET_IP_SPONSORSHIP_CLASS_HASH, STARKNET_IP_SPONSORSHIP_CONTRACT, STARKNET_IP_TICKETS_FACTORY_CONTRACT, STARKNET_IP_TICKET_COLLECTION_CLASS_HASH, STARKNET_MARKETPLACE_1155_CLASS_HASH, STARKNET_MARKETPLACE_1155_CONTRACT, STARKNET_MARKETPLACE_1155_START_BLOCK, STARKNET_MARKETPLACE_721_CLASS_HASH, STARKNET_MARKETPLACE_721_CONTRACT, STARKNET_MARKETPLACE_721_START_BLOCK, STARKNET_NFTCOMMENTS_CONTRACT, STARKNET_POP_COLLECTION_CLASS_HASH, STARKNET_POP_FACTORY_CONTRACT, STARKNET_POP_FACTORY_START_BLOCK, SUPPORTED_TOKENS, SUPPORTED_URL_CHAINS, ServiceCapability, ServiceDefinition, type ServiceId, type SiwsIdentity, type SupportedToken, type SupportedTokenSymbol, type TicketingNextStep, type TicketingRun, UPLOAD_LIMITS, type UploadKind, type UploadLimit, type WalletRequest, acceptFor, assetHref, buildAssetMetadata, buildCollectionMetadata, chainFromSlug, chainSlug, coinHref, collectionHref, createAppGateway, createAppSessionHandler, createImageProxyHandler, createLaunchpadRunsClient, dropHref, encodeU256, formatAmount, formatFileSize, getBackendSignedUrl, getDerivativesTerm, getListableTokens, getService, getServicesByCapability, getTokenByAddress, getTokenBySymbol, hasCapability, isCertificateEmissionRun, isDataTokenizationRun, isPrivateHost, isPrivateOrInsecureUrl, isPublicAppRoute, isSameOrigin, isServiceId, isTicketingRun, isValidIpfsCidPath, issueAccountSessionToken, issueSiwsToken, listServices, normalizeAddress, normalizeHash, parseAmount, profileHref, readBodyWithCap, resolveAppFeeConfig, resolveRemixPolicy, resolveSafeImageContentType, shortenAddress, stringifyBigInts, u256ToBigInt, uploadDirectoryToBackend, uploadError, uploadFileToBackend, uploadJsonToBackend, uploadSizeError, validateUrl, verifyAccountSessionToken, verifySiwsToken };
|
package/dist/index.js
CHANGED
|
@@ -821,9 +821,11 @@ var MAX_IPFS_GATEWAY_RESPONSE_BYTES = 25 * 1024 * 1024;
|
|
|
821
821
|
// src/uploads.ts
|
|
822
822
|
var MB = 1024 * 1024;
|
|
823
823
|
var MAX_UPLOAD_BYTES = 90 * MB;
|
|
824
|
+
var IMAGE_EXTENSIONS = [".jpg", ".jpeg", ".png", ".gif", ".svg", ".webp", ".avif"];
|
|
824
825
|
var UPLOAD_LIMITS = {
|
|
825
826
|
image: {
|
|
826
|
-
mimeTypes: ["image/jpeg", "image/png", "image/gif", "image/svg+xml", "image/webp"]
|
|
827
|
+
mimeTypes: ["image/jpeg", "image/png", "image/gif", "image/svg+xml", "image/webp", "image/avif"],
|
|
828
|
+
extensions: IMAGE_EXTENSIONS
|
|
827
829
|
},
|
|
828
830
|
document: {
|
|
829
831
|
mimeTypes: [
|
|
@@ -835,7 +837,8 @@ var UPLOAD_LIMITS = {
|
|
|
835
837
|
"text/plain",
|
|
836
838
|
"text/markdown",
|
|
837
839
|
"application/octet-stream"
|
|
838
|
-
]
|
|
840
|
+
],
|
|
841
|
+
extensions: [".pdf", ".doc", ".docx", ".odt", ".rtf", ".txt", ".md"]
|
|
839
842
|
},
|
|
840
843
|
media: {
|
|
841
844
|
mimeTypes: [
|
|
@@ -854,7 +857,8 @@ var UPLOAD_LIMITS = {
|
|
|
854
857
|
"audio/webm",
|
|
855
858
|
"audio/flac",
|
|
856
859
|
"application/pdf"
|
|
857
|
-
]
|
|
860
|
+
],
|
|
861
|
+
extensions: [...IMAGE_EXTENSIONS, ".mp4", ".webm", ".ogv", ".ogg", ".mp3", ".wav", ".flac", ".pdf"]
|
|
858
862
|
}
|
|
859
863
|
};
|
|
860
864
|
function formatFileSize(bytes) {
|
|
@@ -866,7 +870,22 @@ function uploadSizeError(file, kind = "image") {
|
|
|
866
870
|
const noun = kind === "image" ? "image" : "file";
|
|
867
871
|
return `That ${noun} is ${formatFileSize(file.size)}. Please choose one under ${formatFileSize(MAX_UPLOAD_BYTES)}.`;
|
|
868
872
|
}
|
|
873
|
+
function acceptFor(kind) {
|
|
874
|
+
const { mimeTypes, extensions } = UPLOAD_LIMITS[kind];
|
|
875
|
+
return [...mimeTypes, ...extensions].join(",");
|
|
876
|
+
}
|
|
877
|
+
function typeList(extensions) {
|
|
878
|
+
const names = extensions.map((ext) => ext.slice(1).toUpperCase());
|
|
879
|
+
return names.length > 1 ? `${names.slice(0, -1).join(", ")} or ${names[names.length - 1]}` : names.join("");
|
|
880
|
+
}
|
|
881
|
+
function uploadError(file, kind = "image") {
|
|
882
|
+
const { mimeTypes, extensions } = UPLOAD_LIMITS[kind];
|
|
883
|
+
const name = (file.name ?? "").toLowerCase();
|
|
884
|
+
const allowed = mimeTypes.includes(file.type) || file.type === "" && extensions.some((ext) => name.endsWith(ext));
|
|
885
|
+
if (!allowed) return `Choose ${kind === "image" ? "an image" : "a file"} in ${typeList(extensions)}.`;
|
|
886
|
+
return uploadSizeError(file, kind);
|
|
887
|
+
}
|
|
869
888
|
|
|
870
|
-
export { ACCOUNT_SESSION_COOKIE, ACCOUNT_SESSION_TTL_SECONDS, ALLOWED_IMAGE_CONTENT_TYPES, IDENTITY_TTL_SECONDS, IPFS_SAFE_CONTENT_TYPE_PREFIXES, MAX_IMAGE_PROXY_BYTES, MAX_IMAGE_REDIRECTS, MAX_IPFS_GATEWAY_RESPONSE_BYTES, MAX_UPLOAD_BYTES, OPEN_LICENSES, RESERVED_TRAITS, RunRequestError, UPLOAD_LIMITS, buildAssetMetadata, buildCollectionMetadata, createAppGateway, createAppSessionHandler, createImageProxyHandler, createLaunchpadRunsClient, formatFileSize, getBackendSignedUrl, getDerivativesTerm, isCertificateEmissionRun, isDataTokenizationRun, isPrivateHost, isPrivateOrInsecureUrl, isPublicAppRoute, isSameOrigin, isTicketingRun, isValidIpfsCidPath, issueAccountSessionToken, issueSiwsToken, readBodyWithCap, resolveRemixPolicy, resolveSafeImageContentType, uploadDirectoryToBackend, uploadFileToBackend, uploadJsonToBackend, uploadSizeError, validateUrl, verifyAccountSessionToken, verifySiwsToken };
|
|
889
|
+
export { ACCOUNT_SESSION_COOKIE, ACCOUNT_SESSION_TTL_SECONDS, ALLOWED_IMAGE_CONTENT_TYPES, IDENTITY_TTL_SECONDS, IPFS_SAFE_CONTENT_TYPE_PREFIXES, MAX_IMAGE_PROXY_BYTES, MAX_IMAGE_REDIRECTS, MAX_IPFS_GATEWAY_RESPONSE_BYTES, MAX_UPLOAD_BYTES, OPEN_LICENSES, RESERVED_TRAITS, RunRequestError, UPLOAD_LIMITS, acceptFor, buildAssetMetadata, buildCollectionMetadata, createAppGateway, createAppSessionHandler, createImageProxyHandler, createLaunchpadRunsClient, formatFileSize, getBackendSignedUrl, getDerivativesTerm, isCertificateEmissionRun, isDataTokenizationRun, isPrivateHost, isPrivateOrInsecureUrl, isPublicAppRoute, isSameOrigin, isTicketingRun, isValidIpfsCidPath, issueAccountSessionToken, issueSiwsToken, readBodyWithCap, resolveRemixPolicy, resolveSafeImageContentType, uploadDirectoryToBackend, uploadError, uploadFileToBackend, uploadJsonToBackend, uploadSizeError, validateUrl, verifyAccountSessionToken, verifySiwsToken };
|
|
871
890
|
//# sourceMappingURL=index.js.map
|
|
872
891
|
//# sourceMappingURL=index.js.map
|