@medialane/sdk 0.182.0 → 0.183.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 +55 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -1
- package/dist/index.d.ts +12 -1
- package/dist/index.js +53 -1
- package/dist/index.js.map +1 -1
- package/dist/starknet/index.cjs +19 -5
- package/dist/starknet/index.cjs.map +1 -1
- package/dist/starknet/index.d.cts +1 -1
- package/dist/starknet/index.d.ts +1 -1
- package/dist/starknet/index.js +20 -6
- package/dist/starknet/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -829,4 +829,15 @@ declare const IPFS_SAFE_CONTENT_TYPE_PREFIXES: readonly ["image/jpeg", "image/pn
|
|
|
829
829
|
declare function resolveSafeImageContentType(contentType: string): string;
|
|
830
830
|
declare const MAX_IPFS_GATEWAY_RESPONSE_BYTES: number;
|
|
831
831
|
|
|
832
|
-
|
|
832
|
+
type UploadKind = "image" | "document" | "media";
|
|
833
|
+
interface UploadLimit {
|
|
834
|
+
maxBytes: number;
|
|
835
|
+
mimeTypes: readonly string[];
|
|
836
|
+
}
|
|
837
|
+
declare const UPLOAD_LIMITS: Record<UploadKind, UploadLimit>;
|
|
838
|
+
declare function formatFileSize(bytes: number): string;
|
|
839
|
+
declare function uploadSizeError(file: {
|
|
840
|
+
size: number;
|
|
841
|
+
}, kind?: UploadKind): string | null;
|
|
842
|
+
|
|
843
|
+
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, 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, readBodyWithCap, resolveAppFeeConfig, resolveRemixPolicy, resolveSafeImageContentType, shortenAddress, stringifyBigInts, u256ToBigInt, uploadDirectoryToBackend, uploadFileToBackend, uploadJsonToBackend, uploadSizeError, validateUrl, verifyAccountSessionToken, verifySiwsToken };
|
package/dist/index.js
CHANGED
|
@@ -808,6 +808,58 @@ function resolveSafeImageContentType(contentType) {
|
|
|
808
808
|
}
|
|
809
809
|
var MAX_IPFS_GATEWAY_RESPONSE_BYTES = 25 * 1024 * 1024;
|
|
810
810
|
|
|
811
|
-
|
|
811
|
+
// src/uploads.ts
|
|
812
|
+
var MB = 1024 * 1024;
|
|
813
|
+
var UPLOAD_LIMITS = {
|
|
814
|
+
image: {
|
|
815
|
+
maxBytes: 50 * MB,
|
|
816
|
+
mimeTypes: ["image/jpeg", "image/png", "image/gif", "image/svg+xml", "image/webp"]
|
|
817
|
+
},
|
|
818
|
+
document: {
|
|
819
|
+
maxBytes: 20 * MB,
|
|
820
|
+
mimeTypes: [
|
|
821
|
+
"application/pdf",
|
|
822
|
+
"application/msword",
|
|
823
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
824
|
+
"application/vnd.oasis.opendocument.text",
|
|
825
|
+
"application/rtf",
|
|
826
|
+
"text/plain",
|
|
827
|
+
"text/markdown",
|
|
828
|
+
"application/octet-stream"
|
|
829
|
+
]
|
|
830
|
+
},
|
|
831
|
+
media: {
|
|
832
|
+
maxBytes: 100 * MB,
|
|
833
|
+
mimeTypes: [
|
|
834
|
+
"image/jpeg",
|
|
835
|
+
"image/png",
|
|
836
|
+
"image/gif",
|
|
837
|
+
"image/webp",
|
|
838
|
+
"image/svg+xml",
|
|
839
|
+
"image/avif",
|
|
840
|
+
"video/mp4",
|
|
841
|
+
"video/webm",
|
|
842
|
+
"video/ogg",
|
|
843
|
+
"audio/mpeg",
|
|
844
|
+
"audio/ogg",
|
|
845
|
+
"audio/wav",
|
|
846
|
+
"audio/webm",
|
|
847
|
+
"audio/flac",
|
|
848
|
+
"application/pdf"
|
|
849
|
+
]
|
|
850
|
+
}
|
|
851
|
+
};
|
|
852
|
+
function formatFileSize(bytes) {
|
|
853
|
+
const mb = bytes / MB;
|
|
854
|
+
return `${Number.isInteger(mb) ? mb : mb.toFixed(1)} MB`;
|
|
855
|
+
}
|
|
856
|
+
function uploadSizeError(file, kind = "image") {
|
|
857
|
+
const { maxBytes } = UPLOAD_LIMITS[kind];
|
|
858
|
+
if (file.size <= maxBytes) return null;
|
|
859
|
+
const noun = kind === "image" ? "image" : "file";
|
|
860
|
+
return `That ${noun} is ${formatFileSize(file.size)}. Please choose one under ${formatFileSize(maxBytes)}.`;
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
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, 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 };
|
|
812
864
|
//# sourceMappingURL=index.js.map
|
|
813
865
|
//# sourceMappingURL=index.js.map
|