@thirdweb-dev/storage
Advanced tools
Comparing version 0.1.2 to 0.2.0-nightly-3abe26c
@@ -1,1 +0,1 @@ | ||
export * from "./declarations/dist/index"; | ||
export * from "./declarations/src/index"; |
@@ -7,2 +7,3 @@ 'use strict'; | ||
var fetch$1 = require('cross-fetch'); | ||
var zod = require('zod'); | ||
@@ -568,2 +569,5 @@ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; } | ||
} | ||
function isBufferInstance(data) { | ||
return global.Buffer && data instanceof Buffer; | ||
} | ||
/** | ||
@@ -587,3 +591,3 @@ * Given a map of file hashes to ipfs uris, this function will hash | ||
var val = object[keys[key]]; | ||
var isFile = isFileInstance(val) || val instanceof Buffer; | ||
var isFile = isFileInstance(val) || isBufferInstance(val); | ||
@@ -661,3 +665,3 @@ if (_typeof(val) === "object" && !isFile) { | ||
object[keys[key]] = val.map(function (el) { | ||
var isFile = isFileInstance(el) || el instanceof Buffer; | ||
var isFile = isFileInstance(el) || isBufferInstance(el); | ||
@@ -672,3 +676,3 @@ if (_typeof(el) === "object" && !isFile) { | ||
var isFile = isFileInstance(val) || val instanceof Buffer; | ||
var isFile = isFileInstance(val) || isBufferInstance(val); | ||
@@ -953,3 +957,3 @@ if (_typeof(val) === "object" && !isFile) { | ||
fileName = "".concat(i + fileStartNumber).concat(extensions); | ||
} else if (file instanceof Buffer || typeof file === "string") { | ||
} else if (isBufferInstance(file) || typeof file === "string") { | ||
fileName = "".concat(i + fileStartNumber); | ||
@@ -1479,3 +1483,3 @@ } else if (file && file.name && file !== null && file !== void 0 && file.data) { | ||
if (isFileInstance(val) || val instanceof Buffer) { | ||
if (isFileInstance(val) || isBufferInstance(val)) { | ||
files.push(val); | ||
@@ -1674,3 +1678,3 @@ } else if (_typeof(val) === "object") { | ||
if (!(isFileInstance(data) || data instanceof Buffer || data.name && data.data && data.data instanceof Buffer)) { | ||
if (!(isFileInstance(data) || isBufferInstance(data) || data.name && data.data && isBufferInstance(data.data))) { | ||
_context2.next = 5; | ||
@@ -1687,6 +1691,6 @@ break; | ||
allFiles = data.filter(function (item) { | ||
return isFileInstance(item) || item instanceof Buffer || item.name && item.data && item.data instanceof Buffer; | ||
return isFileInstance(item) || isBufferInstance(item) || item.name && item.data && isBufferInstance(item.data); | ||
}); | ||
allObjects = data.filter(function (item) { | ||
return !isFileInstance(item) && !(item instanceof Buffer); | ||
return !isFileInstance(item) && !isBufferInstance(item); | ||
}); | ||
@@ -1787,3 +1791,13 @@ | ||
var isBrowser = function isBrowser() { | ||
return typeof window !== "undefined"; | ||
}; | ||
var fileOrBufferUnion = isBrowser() ? [zod.z["instanceof"](File), zod.z.string()] : [zod.z["instanceof"](Buffer), zod.z.string()]; | ||
var FileBufferOrStringSchema = zod.z.union(fileOrBufferUnion); | ||
exports.FileBufferOrStringSchema = FileBufferOrStringSchema; | ||
exports.IpfsStorage = IpfsStorage; | ||
exports.RemoteStorage = RemoteStorage; | ||
exports.isBrowser = isBrowser; | ||
exports.isBufferInstance = isBufferInstance; | ||
exports.isFileInstance = isFileInstance; |
@@ -7,2 +7,3 @@ 'use strict'; | ||
var fetch$1 = require('cross-fetch'); | ||
var zod = require('zod'); | ||
@@ -568,2 +569,5 @@ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; } | ||
} | ||
function isBufferInstance(data) { | ||
return global.Buffer && data instanceof Buffer; | ||
} | ||
/** | ||
@@ -587,3 +591,3 @@ * Given a map of file hashes to ipfs uris, this function will hash | ||
var val = object[keys[key]]; | ||
var isFile = isFileInstance(val) || val instanceof Buffer; | ||
var isFile = isFileInstance(val) || isBufferInstance(val); | ||
@@ -661,3 +665,3 @@ if (_typeof(val) === "object" && !isFile) { | ||
object[keys[key]] = val.map(function (el) { | ||
var isFile = isFileInstance(el) || el instanceof Buffer; | ||
var isFile = isFileInstance(el) || isBufferInstance(el); | ||
@@ -672,3 +676,3 @@ if (_typeof(el) === "object" && !isFile) { | ||
var isFile = isFileInstance(val) || val instanceof Buffer; | ||
var isFile = isFileInstance(val) || isBufferInstance(val); | ||
@@ -953,3 +957,3 @@ if (_typeof(val) === "object" && !isFile) { | ||
fileName = "".concat(i + fileStartNumber).concat(extensions); | ||
} else if (file instanceof Buffer || typeof file === "string") { | ||
} else if (isBufferInstance(file) || typeof file === "string") { | ||
fileName = "".concat(i + fileStartNumber); | ||
@@ -1479,3 +1483,3 @@ } else if (file && file.name && file !== null && file !== void 0 && file.data) { | ||
if (isFileInstance(val) || val instanceof Buffer) { | ||
if (isFileInstance(val) || isBufferInstance(val)) { | ||
files.push(val); | ||
@@ -1674,3 +1678,3 @@ } else if (_typeof(val) === "object") { | ||
if (!(isFileInstance(data) || data instanceof Buffer || data.name && data.data && data.data instanceof Buffer)) { | ||
if (!(isFileInstance(data) || isBufferInstance(data) || data.name && data.data && isBufferInstance(data.data))) { | ||
_context2.next = 5; | ||
@@ -1687,6 +1691,6 @@ break; | ||
allFiles = data.filter(function (item) { | ||
return isFileInstance(item) || item instanceof Buffer || item.name && item.data && item.data instanceof Buffer; | ||
return isFileInstance(item) || isBufferInstance(item) || item.name && item.data && isBufferInstance(item.data); | ||
}); | ||
allObjects = data.filter(function (item) { | ||
return !isFileInstance(item) && !(item instanceof Buffer); | ||
return !isFileInstance(item) && !isBufferInstance(item); | ||
}); | ||
@@ -1787,3 +1791,13 @@ | ||
var isBrowser = function isBrowser() { | ||
return typeof window !== "undefined"; | ||
}; | ||
var fileOrBufferUnion = isBrowser() ? [zod.z["instanceof"](File), zod.z.string()] : [zod.z["instanceof"](Buffer), zod.z.string()]; | ||
var FileBufferOrStringSchema = zod.z.union(fileOrBufferUnion); | ||
exports.FileBufferOrStringSchema = FileBufferOrStringSchema; | ||
exports.IpfsStorage = IpfsStorage; | ||
exports.RemoteStorage = RemoteStorage; | ||
exports.isBrowser = isBrowser; | ||
exports.isBufferInstance = isBufferInstance; | ||
exports.isFileInstance = isFileInstance; |
{ | ||
"name": "@thirdweb-dev/storage", | ||
"version": "0.1.2", | ||
"version": "0.2.0-nightly-3abe26c", | ||
"main": "dist/thirdweb-dev-storage.cjs.js", | ||
"repository": "https://github.com/thirdweb-dev/storage.git", | ||
"author": "adam-maj <mr.adam.maj@gmail.com>", | ||
"module": "dist/thirdweb-dev-storage.esm.js", | ||
"repository": { | ||
"directory": "packages/storage", | ||
"type": "git", | ||
"url": "https://github.com/thirdweb-dev/js.git" | ||
}, | ||
"author": "thirdweb eng <eng@thirdweb.com>", | ||
"license": "Apache-2.0", | ||
"scripts": { | ||
"build": "tsc --noEmit && preconstruct build", | ||
"build": "tsc && preconstruct build", | ||
"test": "ts-mocha 'test/**/*.ts' --paths -t 120000 -r esm -p tsconfig.testing.json" | ||
@@ -24,3 +29,2 @@ }, | ||
"@preconstruct/cli": "^2.2.1", | ||
"@trivago/prettier-plugin-sort-imports": "^3.3.0", | ||
"@types/chai": "^4.3.3", | ||
@@ -32,10 +36,4 @@ "@types/mocha": "^9.1.1", | ||
"eslint": "^8.22.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint-plugin-import": "^2.26.0", | ||
"eslint-plugin-inclusive-language": "^2.2.0", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
"eslint-plugin-tsdoc": "^0.2.16", | ||
"esm": "^3.2.25", | ||
"mocha": "^10.0.0", | ||
"prettier": "^2.7.1", | ||
"ts-mocha": "^10.0.0", | ||
@@ -47,4 +45,5 @@ "tsc": "^2.0.4", | ||
"cross-fetch": "^3.1.5", | ||
"form-data": "^4.0.0" | ||
"form-data": "^4.0.0", | ||
"zod": "^3.18.0" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
210026
14
28
4949
1
3
9
+ Addedzod@^3.18.0
+ Addedzod@3.24.1(transitive)