@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.cjs
CHANGED
|
@@ -810,6 +810,58 @@ function resolveSafeImageContentType(contentType) {
|
|
|
810
810
|
}
|
|
811
811
|
var MAX_IPFS_GATEWAY_RESPONSE_BYTES = 25 * 1024 * 1024;
|
|
812
812
|
|
|
813
|
+
// src/uploads.ts
|
|
814
|
+
var MB = 1024 * 1024;
|
|
815
|
+
var UPLOAD_LIMITS = {
|
|
816
|
+
image: {
|
|
817
|
+
maxBytes: 50 * MB,
|
|
818
|
+
mimeTypes: ["image/jpeg", "image/png", "image/gif", "image/svg+xml", "image/webp"]
|
|
819
|
+
},
|
|
820
|
+
document: {
|
|
821
|
+
maxBytes: 20 * MB,
|
|
822
|
+
mimeTypes: [
|
|
823
|
+
"application/pdf",
|
|
824
|
+
"application/msword",
|
|
825
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
826
|
+
"application/vnd.oasis.opendocument.text",
|
|
827
|
+
"application/rtf",
|
|
828
|
+
"text/plain",
|
|
829
|
+
"text/markdown",
|
|
830
|
+
"application/octet-stream"
|
|
831
|
+
]
|
|
832
|
+
},
|
|
833
|
+
media: {
|
|
834
|
+
maxBytes: 100 * MB,
|
|
835
|
+
mimeTypes: [
|
|
836
|
+
"image/jpeg",
|
|
837
|
+
"image/png",
|
|
838
|
+
"image/gif",
|
|
839
|
+
"image/webp",
|
|
840
|
+
"image/svg+xml",
|
|
841
|
+
"image/avif",
|
|
842
|
+
"video/mp4",
|
|
843
|
+
"video/webm",
|
|
844
|
+
"video/ogg",
|
|
845
|
+
"audio/mpeg",
|
|
846
|
+
"audio/ogg",
|
|
847
|
+
"audio/wav",
|
|
848
|
+
"audio/webm",
|
|
849
|
+
"audio/flac",
|
|
850
|
+
"application/pdf"
|
|
851
|
+
]
|
|
852
|
+
}
|
|
853
|
+
};
|
|
854
|
+
function formatFileSize(bytes) {
|
|
855
|
+
const mb = bytes / MB;
|
|
856
|
+
return `${Number.isInteger(mb) ? mb : mb.toFixed(1)} MB`;
|
|
857
|
+
}
|
|
858
|
+
function uploadSizeError(file, kind = "image") {
|
|
859
|
+
const { maxBytes } = UPLOAD_LIMITS[kind];
|
|
860
|
+
if (file.size <= maxBytes) return null;
|
|
861
|
+
const noun = kind === "image" ? "image" : "file";
|
|
862
|
+
return `That ${noun} is ${formatFileSize(file.size)}. Please choose one under ${formatFileSize(maxBytes)}.`;
|
|
863
|
+
}
|
|
864
|
+
|
|
813
865
|
Object.defineProperty(exports, "ApiClient", {
|
|
814
866
|
enumerable: true,
|
|
815
867
|
get: function () { return chunkF5USCCM4_cjs.ApiClient; }
|
|
@@ -1117,12 +1169,14 @@ exports.MAX_IPFS_GATEWAY_RESPONSE_BYTES = MAX_IPFS_GATEWAY_RESPONSE_BYTES;
|
|
|
1117
1169
|
exports.OPEN_LICENSES = OPEN_LICENSES;
|
|
1118
1170
|
exports.RESERVED_TRAITS = RESERVED_TRAITS;
|
|
1119
1171
|
exports.RunRequestError = RunRequestError;
|
|
1172
|
+
exports.UPLOAD_LIMITS = UPLOAD_LIMITS;
|
|
1120
1173
|
exports.buildAssetMetadata = buildAssetMetadata;
|
|
1121
1174
|
exports.buildCollectionMetadata = buildCollectionMetadata;
|
|
1122
1175
|
exports.createAppGateway = createAppGateway;
|
|
1123
1176
|
exports.createAppSessionHandler = createAppSessionHandler;
|
|
1124
1177
|
exports.createImageProxyHandler = createImageProxyHandler;
|
|
1125
1178
|
exports.createLaunchpadRunsClient = createLaunchpadRunsClient;
|
|
1179
|
+
exports.formatFileSize = formatFileSize;
|
|
1126
1180
|
exports.getBackendSignedUrl = getBackendSignedUrl;
|
|
1127
1181
|
exports.getDerivativesTerm = getDerivativesTerm;
|
|
1128
1182
|
exports.isCertificateEmissionRun = isCertificateEmissionRun;
|
|
@@ -1141,6 +1195,7 @@ exports.resolveSafeImageContentType = resolveSafeImageContentType;
|
|
|
1141
1195
|
exports.uploadDirectoryToBackend = uploadDirectoryToBackend;
|
|
1142
1196
|
exports.uploadFileToBackend = uploadFileToBackend;
|
|
1143
1197
|
exports.uploadJsonToBackend = uploadJsonToBackend;
|
|
1198
|
+
exports.uploadSizeError = uploadSizeError;
|
|
1144
1199
|
exports.validateUrl = validateUrl;
|
|
1145
1200
|
exports.verifyAccountSessionToken = verifyAccountSessionToken;
|
|
1146
1201
|
exports.verifySiwsToken = verifySiwsToken;
|