@thirdweb-dev/storage
Advanced tools
Comparing version 2.0.8 to 2.0.9-nightly-2e3cc7cd-20240201004233
@@ -144,3 +144,3 @@ 'use strict'; | ||
function convertCidToV1(cid) { | ||
let normalized; | ||
let normalized = ''; | ||
try { | ||
@@ -405,3 +405,2 @@ const hash = cid.split("/")[0]; | ||
fix: "eslint src/ --fix", | ||
"generate-docs": "api-extractor run --local && api-documenter markdown -i ./temp -o ./docs", | ||
clean: "rm -rf dist/", | ||
@@ -422,4 +421,4 @@ build: "tsc && preconstruct build", | ||
devDependencies: { | ||
"@babel/preset-env": "^7.22.9", | ||
"@babel/preset-typescript": "^7.22.5", | ||
"@babel/preset-env": "^7.23.8", | ||
"@babel/preset-typescript": "^7.23.3", | ||
"@microsoft/api-documenter": "^7.22.30", | ||
@@ -429,3 +428,3 @@ "@microsoft/api-extractor": "^7.36.3", | ||
"@preconstruct/cli": "2.7.0", | ||
"@swc-node/register": "^1.6.6", | ||
"@swc-node/register": "^1.6.8", | ||
"@thirdweb-dev/tsconfig": "workspace:*", | ||
@@ -436,5 +435,5 @@ "@types/chai": "^4.3.5", | ||
"@typescript-eslint/eslint-plugin": "^6.2.0", | ||
"@typescript-eslint/parser": "^6.2.0", | ||
"@typescript-eslint/parser": "^6.19.1", | ||
chai: "^4.3.6", | ||
eslint: "^8.45.0", | ||
eslint: "^8.56.0", | ||
"eslint-config-thirdweb": "workspace:*", | ||
@@ -445,10 +444,10 @@ "eslint-plugin-tsdoc": "^0.2.16", | ||
rimraf: "^3.0.2", | ||
typescript: "^5.1.6", | ||
"typedoc-gen": "workspace:*" | ||
"typedoc-gen": "workspace:*", | ||
typescript: "^5.3.3" | ||
}, | ||
dependencies: { | ||
"@thirdweb-dev/crypto": "workspace:*", | ||
"cid-tool": "^3.0.0", | ||
"form-data": "^4.0.0", | ||
uuid: "^9.0.1", | ||
"@thirdweb-dev/crypto": "workspace:*" | ||
uuid: "^9.0.1" | ||
}, | ||
@@ -461,2 +460,78 @@ engines: { | ||
/** | ||
* @internal | ||
* | ||
* The code below comes from the package https://github.com/DamonOehlman/detect-browser | ||
*/ | ||
const operatingSystemRules = [["iOS", /iP(hone|od|ad)/], ["Android OS", /Android/], ["BlackBerry OS", /BlackBerry|BB10/], ["Windows Mobile", /IEMobile/], ["Amazon OS", /Kindle/], ["Windows 3.11", /Win16/], ["Windows 95", /(Windows 95)|(Win95)|(Windows_95)/], ["Windows 98", /(Windows 98)|(Win98)/], ["Windows 2000", /(Windows NT 5.0)|(Windows 2000)/], ["Windows XP", /(Windows NT 5.1)|(Windows XP)/], ["Windows Server 2003", /(Windows NT 5.2)/], ["Windows Vista", /(Windows NT 6.0)/], ["Windows 7", /(Windows NT 6.1)/], ["Windows 8", /(Windows NT 6.2)/], ["Windows 8.1", /(Windows NT 6.3)/], ["Windows 10", /(Windows NT 10.0)/], ["Windows ME", /Windows ME/], ["Windows CE", /Windows CE|WinCE|Microsoft Pocket Internet Explorer/], ["Open BSD", /OpenBSD/], ["Sun OS", /SunOS/], ["Chrome OS", /CrOS/], ["Linux", /(Linux)|(X11)/], ["Mac OS", /(Mac_PowerPC)|(Macintosh)/], ["QNX", /QNX/], ["BeOS", /BeOS/], ["OS/2", /OS\/2/]]; | ||
function detectOS(ua) { | ||
for (let ii = 0, count = operatingSystemRules.length; ii < count; ii++) { | ||
const result = operatingSystemRules[ii]; | ||
if (!result) { | ||
continue; | ||
} | ||
const [os, regex] = result; | ||
const match = regex.exec(ua); | ||
if (match) { | ||
return os; | ||
} | ||
} | ||
return null; | ||
} | ||
function getOperatingSystem() { | ||
if (typeof navigator !== "undefined" && navigator.product === "ReactNative") { | ||
return ""; | ||
} else if (typeof window !== "undefined") { | ||
const userAgent = navigator.userAgent; | ||
return detectOS(userAgent) || ""; | ||
} else { | ||
return process.platform; | ||
} | ||
} | ||
function setAnalyticsHeaders(headers) { | ||
const globals = getAnalyticsGlobals(); | ||
headers["x-sdk-version"] = globals.x_sdk_version; | ||
headers["x-sdk-name"] = globals.x_sdk_name; | ||
headers["x-sdk-platform"] = globals.x_sdk_platform; | ||
headers["x-sdk-os"] = globals.x_sdk_os; | ||
} | ||
function setAnalyticsHeadersForXhr(xhr) { | ||
const globals = getAnalyticsGlobals(); | ||
xhr.setRequestHeader("x-sdk-version", globals.x_sdk_version); | ||
xhr.setRequestHeader("x-sdk-os", globals.x_sdk_os); | ||
xhr.setRequestHeader("x-sdk-name", globals.x_sdk_name); | ||
xhr.setRequestHeader("x-sdk-platform", globals.x_sdk_platform); | ||
xhr.setRequestHeader("x-bundle-id", globals.app_bundle_id); | ||
} | ||
function getAnalyticsGlobals() { | ||
if (typeof globalThis === "undefined") { | ||
return { | ||
x_sdk_name: pkg.name, | ||
x_sdk_platform: getPlatform(), | ||
x_sdk_version: pkg.version, | ||
x_sdk_os: getOperatingSystem(), | ||
app_bundle_id: undefined | ||
}; | ||
} | ||
if (globalThis.X_SDK_NAME === undefined) { | ||
globalThis.X_SDK_NAME = pkg.name; | ||
globalThis.X_SDK_PLATFORM = getPlatform(); | ||
globalThis.X_SDK_VERSION = pkg.version; | ||
globalThis.X_SDK_OS = getOperatingSystem(); | ||
globalThis.APP_BUNDLE_ID = undefined; | ||
} | ||
return { | ||
x_sdk_name: globalThis.X_SDK_NAME, | ||
x_sdk_platform: globalThis.X_SDK_PLATFORM, | ||
x_sdk_version: globalThis.X_SDK_VERSION, | ||
x_sdk_os: globalThis.X_SDK_OS, | ||
app_bundle_id: globalThis.APP_BUNDLE_ID || "" // if react, this will be empty | ||
}; | ||
} | ||
function getPlatform() { | ||
return typeof navigator !== "undefined" && navigator.product === "ReactNative" ? "mobile" : typeof window !== "undefined" ? "browser" : "node"; | ||
} | ||
/** | ||
* Default downloader used - handles downloading from all schemes specified in the gateway URLs configuration. | ||
@@ -522,3 +597,3 @@ * | ||
if (isTwGatewayUrl(resolvedUri)) { | ||
const bundleId = typeof globalThis !== "undefined" && "APP_BUNDLE_ID" in globalThis ? globalThis.APP_BUNDLE_ID : undefined; | ||
const bundleId = getAnalyticsGlobals().app_bundle_id; | ||
if (this.secretKey) { | ||
@@ -548,5 +623,3 @@ headers = { | ||
} | ||
headers["x-sdk-version"] = pkg.version; | ||
headers["x-sdk-name"] = pkg.name; | ||
headers["x-sdk-platform"] = bundleId ? "react-native" : isBrowser() ? window.bridge !== undefined ? "webGL" : "browser" : "node"; | ||
setAnalyticsHeaders(headers); | ||
} | ||
@@ -825,9 +898,3 @@ if (isTooManyRequests(resolvedUri)) { | ||
} | ||
const bundleId = typeof globalThis !== "undefined" && "APP_BUNDLE_ID" in globalThis ? globalThis.APP_BUNDLE_ID : undefined; | ||
if (bundleId) { | ||
xhr.setRequestHeader("x-bundle-id", bundleId); | ||
} | ||
xhr.setRequestHeader("x-sdk-version", pkg.version); | ||
xhr.setRequestHeader("x-sdk-name", pkg.name); | ||
xhr.setRequestHeader("x-sdk-platform", bundleId ? "react-native" : isBrowser() ? window.bridge !== undefined ? "webGL" : "browser" : "node"); | ||
setAnalyticsHeadersForXhr(xhr); | ||
@@ -858,7 +925,2 @@ // if we have a authorization token on global context then add that to the headers, this is for the dashboard. | ||
// if we have a bundle id on global context then add that to the headers | ||
if (typeof globalThis !== "undefined" && "APP_BUNDLE_ID" in globalThis) { | ||
headers["x-bundle-id"] = globalThis.APP_BUNDLE_ID; | ||
} | ||
// if we have a authorization token on global context then add that to the headers, this is for the dashboard. | ||
@@ -874,2 +936,3 @@ if (typeof globalThis !== "undefined" && "TW_AUTH_TOKEN" in globalThis && typeof globalThis.TW_AUTH_TOKEN === "string") { | ||
} | ||
setAnalyticsHeaders(headers); | ||
const res = await fetch(`${this.uploadServerUrl}/ipfs/upload`, { | ||
@@ -876,0 +939,0 @@ method: "POST", |
@@ -144,3 +144,3 @@ 'use strict'; | ||
function convertCidToV1(cid) { | ||
let normalized; | ||
let normalized = ''; | ||
try { | ||
@@ -405,3 +405,2 @@ const hash = cid.split("/")[0]; | ||
fix: "eslint src/ --fix", | ||
"generate-docs": "api-extractor run --local && api-documenter markdown -i ./temp -o ./docs", | ||
clean: "rm -rf dist/", | ||
@@ -422,4 +421,4 @@ build: "tsc && preconstruct build", | ||
devDependencies: { | ||
"@babel/preset-env": "^7.22.9", | ||
"@babel/preset-typescript": "^7.22.5", | ||
"@babel/preset-env": "^7.23.8", | ||
"@babel/preset-typescript": "^7.23.3", | ||
"@microsoft/api-documenter": "^7.22.30", | ||
@@ -429,3 +428,3 @@ "@microsoft/api-extractor": "^7.36.3", | ||
"@preconstruct/cli": "2.7.0", | ||
"@swc-node/register": "^1.6.6", | ||
"@swc-node/register": "^1.6.8", | ||
"@thirdweb-dev/tsconfig": "workspace:*", | ||
@@ -436,5 +435,5 @@ "@types/chai": "^4.3.5", | ||
"@typescript-eslint/eslint-plugin": "^6.2.0", | ||
"@typescript-eslint/parser": "^6.2.0", | ||
"@typescript-eslint/parser": "^6.19.1", | ||
chai: "^4.3.6", | ||
eslint: "^8.45.0", | ||
eslint: "^8.56.0", | ||
"eslint-config-thirdweb": "workspace:*", | ||
@@ -445,10 +444,10 @@ "eslint-plugin-tsdoc": "^0.2.16", | ||
rimraf: "^3.0.2", | ||
typescript: "^5.1.6", | ||
"typedoc-gen": "workspace:*" | ||
"typedoc-gen": "workspace:*", | ||
typescript: "^5.3.3" | ||
}, | ||
dependencies: { | ||
"@thirdweb-dev/crypto": "workspace:*", | ||
"cid-tool": "^3.0.0", | ||
"form-data": "^4.0.0", | ||
uuid: "^9.0.1", | ||
"@thirdweb-dev/crypto": "workspace:*" | ||
uuid: "^9.0.1" | ||
}, | ||
@@ -461,2 +460,78 @@ engines: { | ||
/** | ||
* @internal | ||
* | ||
* The code below comes from the package https://github.com/DamonOehlman/detect-browser | ||
*/ | ||
const operatingSystemRules = [["iOS", /iP(hone|od|ad)/], ["Android OS", /Android/], ["BlackBerry OS", /BlackBerry|BB10/], ["Windows Mobile", /IEMobile/], ["Amazon OS", /Kindle/], ["Windows 3.11", /Win16/], ["Windows 95", /(Windows 95)|(Win95)|(Windows_95)/], ["Windows 98", /(Windows 98)|(Win98)/], ["Windows 2000", /(Windows NT 5.0)|(Windows 2000)/], ["Windows XP", /(Windows NT 5.1)|(Windows XP)/], ["Windows Server 2003", /(Windows NT 5.2)/], ["Windows Vista", /(Windows NT 6.0)/], ["Windows 7", /(Windows NT 6.1)/], ["Windows 8", /(Windows NT 6.2)/], ["Windows 8.1", /(Windows NT 6.3)/], ["Windows 10", /(Windows NT 10.0)/], ["Windows ME", /Windows ME/], ["Windows CE", /Windows CE|WinCE|Microsoft Pocket Internet Explorer/], ["Open BSD", /OpenBSD/], ["Sun OS", /SunOS/], ["Chrome OS", /CrOS/], ["Linux", /(Linux)|(X11)/], ["Mac OS", /(Mac_PowerPC)|(Macintosh)/], ["QNX", /QNX/], ["BeOS", /BeOS/], ["OS/2", /OS\/2/]]; | ||
function detectOS(ua) { | ||
for (let ii = 0, count = operatingSystemRules.length; ii < count; ii++) { | ||
const result = operatingSystemRules[ii]; | ||
if (!result) { | ||
continue; | ||
} | ||
const [os, regex] = result; | ||
const match = regex.exec(ua); | ||
if (match) { | ||
return os; | ||
} | ||
} | ||
return null; | ||
} | ||
function getOperatingSystem() { | ||
if (typeof navigator !== "undefined" && navigator.product === "ReactNative") { | ||
return ""; | ||
} else if (typeof window !== "undefined") { | ||
const userAgent = navigator.userAgent; | ||
return detectOS(userAgent) || ""; | ||
} else { | ||
return process.platform; | ||
} | ||
} | ||
function setAnalyticsHeaders(headers) { | ||
const globals = getAnalyticsGlobals(); | ||
headers["x-sdk-version"] = globals.x_sdk_version; | ||
headers["x-sdk-name"] = globals.x_sdk_name; | ||
headers["x-sdk-platform"] = globals.x_sdk_platform; | ||
headers["x-sdk-os"] = globals.x_sdk_os; | ||
} | ||
function setAnalyticsHeadersForXhr(xhr) { | ||
const globals = getAnalyticsGlobals(); | ||
xhr.setRequestHeader("x-sdk-version", globals.x_sdk_version); | ||
xhr.setRequestHeader("x-sdk-os", globals.x_sdk_os); | ||
xhr.setRequestHeader("x-sdk-name", globals.x_sdk_name); | ||
xhr.setRequestHeader("x-sdk-platform", globals.x_sdk_platform); | ||
xhr.setRequestHeader("x-bundle-id", globals.app_bundle_id); | ||
} | ||
function getAnalyticsGlobals() { | ||
if (typeof globalThis === "undefined") { | ||
return { | ||
x_sdk_name: pkg.name, | ||
x_sdk_platform: getPlatform(), | ||
x_sdk_version: pkg.version, | ||
x_sdk_os: getOperatingSystem(), | ||
app_bundle_id: undefined | ||
}; | ||
} | ||
if (globalThis.X_SDK_NAME === undefined) { | ||
globalThis.X_SDK_NAME = pkg.name; | ||
globalThis.X_SDK_PLATFORM = getPlatform(); | ||
globalThis.X_SDK_VERSION = pkg.version; | ||
globalThis.X_SDK_OS = getOperatingSystem(); | ||
globalThis.APP_BUNDLE_ID = undefined; | ||
} | ||
return { | ||
x_sdk_name: globalThis.X_SDK_NAME, | ||
x_sdk_platform: globalThis.X_SDK_PLATFORM, | ||
x_sdk_version: globalThis.X_SDK_VERSION, | ||
x_sdk_os: globalThis.X_SDK_OS, | ||
app_bundle_id: globalThis.APP_BUNDLE_ID || "" // if react, this will be empty | ||
}; | ||
} | ||
function getPlatform() { | ||
return typeof navigator !== "undefined" && navigator.product === "ReactNative" ? "mobile" : typeof window !== "undefined" ? "browser" : "node"; | ||
} | ||
/** | ||
* Default downloader used - handles downloading from all schemes specified in the gateway URLs configuration. | ||
@@ -522,3 +597,3 @@ * | ||
if (isTwGatewayUrl(resolvedUri)) { | ||
const bundleId = typeof globalThis !== "undefined" && "APP_BUNDLE_ID" in globalThis ? globalThis.APP_BUNDLE_ID : undefined; | ||
const bundleId = getAnalyticsGlobals().app_bundle_id; | ||
if (this.secretKey) { | ||
@@ -548,5 +623,3 @@ headers = { | ||
} | ||
headers["x-sdk-version"] = pkg.version; | ||
headers["x-sdk-name"] = pkg.name; | ||
headers["x-sdk-platform"] = bundleId ? "react-native" : isBrowser() ? window.bridge !== undefined ? "webGL" : "browser" : "node"; | ||
setAnalyticsHeaders(headers); | ||
} | ||
@@ -825,9 +898,3 @@ if (isTooManyRequests(resolvedUri)) { | ||
} | ||
const bundleId = typeof globalThis !== "undefined" && "APP_BUNDLE_ID" in globalThis ? globalThis.APP_BUNDLE_ID : undefined; | ||
if (bundleId) { | ||
xhr.setRequestHeader("x-bundle-id", bundleId); | ||
} | ||
xhr.setRequestHeader("x-sdk-version", pkg.version); | ||
xhr.setRequestHeader("x-sdk-name", pkg.name); | ||
xhr.setRequestHeader("x-sdk-platform", bundleId ? "react-native" : isBrowser() ? window.bridge !== undefined ? "webGL" : "browser" : "node"); | ||
setAnalyticsHeadersForXhr(xhr); | ||
@@ -858,7 +925,2 @@ // if we have a authorization token on global context then add that to the headers, this is for the dashboard. | ||
// if we have a bundle id on global context then add that to the headers | ||
if (typeof globalThis !== "undefined" && "APP_BUNDLE_ID" in globalThis) { | ||
headers["x-bundle-id"] = globalThis.APP_BUNDLE_ID; | ||
} | ||
// if we have a authorization token on global context then add that to the headers, this is for the dashboard. | ||
@@ -874,2 +936,3 @@ if (typeof globalThis !== "undefined" && "TW_AUTH_TOKEN" in globalThis && typeof globalThis.TW_AUTH_TOKEN === "string") { | ||
} | ||
setAnalyticsHeaders(headers); | ||
const res = await fetch(`${this.uploadServerUrl}/ipfs/upload`, { | ||
@@ -876,0 +939,0 @@ method: "POST", |
@@ -135,3 +135,3 @@ import CIDTool from 'cid-tool'; | ||
function convertCidToV1(cid) { | ||
let normalized; | ||
let normalized = ''; | ||
try { | ||
@@ -396,3 +396,2 @@ const hash = cid.split("/")[0]; | ||
fix: "eslint src/ --fix", | ||
"generate-docs": "api-extractor run --local && api-documenter markdown -i ./temp -o ./docs", | ||
clean: "rm -rf dist/", | ||
@@ -413,4 +412,4 @@ build: "tsc && preconstruct build", | ||
devDependencies: { | ||
"@babel/preset-env": "^7.22.9", | ||
"@babel/preset-typescript": "^7.22.5", | ||
"@babel/preset-env": "^7.23.8", | ||
"@babel/preset-typescript": "^7.23.3", | ||
"@microsoft/api-documenter": "^7.22.30", | ||
@@ -420,3 +419,3 @@ "@microsoft/api-extractor": "^7.36.3", | ||
"@preconstruct/cli": "2.7.0", | ||
"@swc-node/register": "^1.6.6", | ||
"@swc-node/register": "^1.6.8", | ||
"@thirdweb-dev/tsconfig": "workspace:*", | ||
@@ -427,5 +426,5 @@ "@types/chai": "^4.3.5", | ||
"@typescript-eslint/eslint-plugin": "^6.2.0", | ||
"@typescript-eslint/parser": "^6.2.0", | ||
"@typescript-eslint/parser": "^6.19.1", | ||
chai: "^4.3.6", | ||
eslint: "^8.45.0", | ||
eslint: "^8.56.0", | ||
"eslint-config-thirdweb": "workspace:*", | ||
@@ -436,10 +435,10 @@ "eslint-plugin-tsdoc": "^0.2.16", | ||
rimraf: "^3.0.2", | ||
typescript: "^5.1.6", | ||
"typedoc-gen": "workspace:*" | ||
"typedoc-gen": "workspace:*", | ||
typescript: "^5.3.3" | ||
}, | ||
dependencies: { | ||
"@thirdweb-dev/crypto": "workspace:*", | ||
"cid-tool": "^3.0.0", | ||
"form-data": "^4.0.0", | ||
uuid: "^9.0.1", | ||
"@thirdweb-dev/crypto": "workspace:*" | ||
uuid: "^9.0.1" | ||
}, | ||
@@ -452,2 +451,78 @@ engines: { | ||
/** | ||
* @internal | ||
* | ||
* The code below comes from the package https://github.com/DamonOehlman/detect-browser | ||
*/ | ||
const operatingSystemRules = [["iOS", /iP(hone|od|ad)/], ["Android OS", /Android/], ["BlackBerry OS", /BlackBerry|BB10/], ["Windows Mobile", /IEMobile/], ["Amazon OS", /Kindle/], ["Windows 3.11", /Win16/], ["Windows 95", /(Windows 95)|(Win95)|(Windows_95)/], ["Windows 98", /(Windows 98)|(Win98)/], ["Windows 2000", /(Windows NT 5.0)|(Windows 2000)/], ["Windows XP", /(Windows NT 5.1)|(Windows XP)/], ["Windows Server 2003", /(Windows NT 5.2)/], ["Windows Vista", /(Windows NT 6.0)/], ["Windows 7", /(Windows NT 6.1)/], ["Windows 8", /(Windows NT 6.2)/], ["Windows 8.1", /(Windows NT 6.3)/], ["Windows 10", /(Windows NT 10.0)/], ["Windows ME", /Windows ME/], ["Windows CE", /Windows CE|WinCE|Microsoft Pocket Internet Explorer/], ["Open BSD", /OpenBSD/], ["Sun OS", /SunOS/], ["Chrome OS", /CrOS/], ["Linux", /(Linux)|(X11)/], ["Mac OS", /(Mac_PowerPC)|(Macintosh)/], ["QNX", /QNX/], ["BeOS", /BeOS/], ["OS/2", /OS\/2/]]; | ||
function detectOS(ua) { | ||
for (let ii = 0, count = operatingSystemRules.length; ii < count; ii++) { | ||
const result = operatingSystemRules[ii]; | ||
if (!result) { | ||
continue; | ||
} | ||
const [os, regex] = result; | ||
const match = regex.exec(ua); | ||
if (match) { | ||
return os; | ||
} | ||
} | ||
return null; | ||
} | ||
function getOperatingSystem() { | ||
if (typeof navigator !== "undefined" && navigator.product === "ReactNative") { | ||
return ""; | ||
} else if (typeof window !== "undefined") { | ||
const userAgent = navigator.userAgent; | ||
return detectOS(userAgent) || ""; | ||
} else { | ||
return process.platform; | ||
} | ||
} | ||
function setAnalyticsHeaders(headers) { | ||
const globals = getAnalyticsGlobals(); | ||
headers["x-sdk-version"] = globals.x_sdk_version; | ||
headers["x-sdk-name"] = globals.x_sdk_name; | ||
headers["x-sdk-platform"] = globals.x_sdk_platform; | ||
headers["x-sdk-os"] = globals.x_sdk_os; | ||
} | ||
function setAnalyticsHeadersForXhr(xhr) { | ||
const globals = getAnalyticsGlobals(); | ||
xhr.setRequestHeader("x-sdk-version", globals.x_sdk_version); | ||
xhr.setRequestHeader("x-sdk-os", globals.x_sdk_os); | ||
xhr.setRequestHeader("x-sdk-name", globals.x_sdk_name); | ||
xhr.setRequestHeader("x-sdk-platform", globals.x_sdk_platform); | ||
xhr.setRequestHeader("x-bundle-id", globals.app_bundle_id); | ||
} | ||
function getAnalyticsGlobals() { | ||
if (typeof globalThis === "undefined") { | ||
return { | ||
x_sdk_name: pkg.name, | ||
x_sdk_platform: getPlatform(), | ||
x_sdk_version: pkg.version, | ||
x_sdk_os: getOperatingSystem(), | ||
app_bundle_id: undefined | ||
}; | ||
} | ||
if (globalThis.X_SDK_NAME === undefined) { | ||
globalThis.X_SDK_NAME = pkg.name; | ||
globalThis.X_SDK_PLATFORM = getPlatform(); | ||
globalThis.X_SDK_VERSION = pkg.version; | ||
globalThis.X_SDK_OS = getOperatingSystem(); | ||
globalThis.APP_BUNDLE_ID = undefined; | ||
} | ||
return { | ||
x_sdk_name: globalThis.X_SDK_NAME, | ||
x_sdk_platform: globalThis.X_SDK_PLATFORM, | ||
x_sdk_version: globalThis.X_SDK_VERSION, | ||
x_sdk_os: globalThis.X_SDK_OS, | ||
app_bundle_id: globalThis.APP_BUNDLE_ID || "" // if react, this will be empty | ||
}; | ||
} | ||
function getPlatform() { | ||
return typeof navigator !== "undefined" && navigator.product === "ReactNative" ? "mobile" : typeof window !== "undefined" ? "browser" : "node"; | ||
} | ||
/** | ||
* Default downloader used - handles downloading from all schemes specified in the gateway URLs configuration. | ||
@@ -513,3 +588,3 @@ * | ||
if (isTwGatewayUrl(resolvedUri)) { | ||
const bundleId = typeof globalThis !== "undefined" && "APP_BUNDLE_ID" in globalThis ? globalThis.APP_BUNDLE_ID : undefined; | ||
const bundleId = getAnalyticsGlobals().app_bundle_id; | ||
if (this.secretKey) { | ||
@@ -539,5 +614,3 @@ headers = { | ||
} | ||
headers["x-sdk-version"] = pkg.version; | ||
headers["x-sdk-name"] = pkg.name; | ||
headers["x-sdk-platform"] = bundleId ? "react-native" : isBrowser() ? window.bridge !== undefined ? "webGL" : "browser" : "node"; | ||
setAnalyticsHeaders(headers); | ||
} | ||
@@ -816,9 +889,3 @@ if (isTooManyRequests(resolvedUri)) { | ||
} | ||
const bundleId = typeof globalThis !== "undefined" && "APP_BUNDLE_ID" in globalThis ? globalThis.APP_BUNDLE_ID : undefined; | ||
if (bundleId) { | ||
xhr.setRequestHeader("x-bundle-id", bundleId); | ||
} | ||
xhr.setRequestHeader("x-sdk-version", pkg.version); | ||
xhr.setRequestHeader("x-sdk-name", pkg.name); | ||
xhr.setRequestHeader("x-sdk-platform", bundleId ? "react-native" : isBrowser() ? window.bridge !== undefined ? "webGL" : "browser" : "node"); | ||
setAnalyticsHeadersForXhr(xhr); | ||
@@ -849,7 +916,2 @@ // if we have a authorization token on global context then add that to the headers, this is for the dashboard. | ||
// if we have a bundle id on global context then add that to the headers | ||
if (typeof globalThis !== "undefined" && "APP_BUNDLE_ID" in globalThis) { | ||
headers["x-bundle-id"] = globalThis.APP_BUNDLE_ID; | ||
} | ||
// if we have a authorization token on global context then add that to the headers, this is for the dashboard. | ||
@@ -865,2 +927,3 @@ if (typeof globalThis !== "undefined" && "TW_AUTH_TOKEN" in globalThis && typeof globalThis.TW_AUTH_TOKEN === "string") { | ||
} | ||
setAnalyticsHeaders(headers); | ||
const res = await fetch(`${this.uploadServerUrl}/ipfs/upload`, { | ||
@@ -867,0 +930,0 @@ method: "POST", |
{ | ||
"name": "@thirdweb-dev/storage", | ||
"version": "2.0.8", | ||
"version": "2.0.9-nightly-2e3cc7cd-20240201004233", | ||
"main": "dist/thirdweb-dev-storage.cjs.js", | ||
@@ -24,4 +24,4 @@ "module": "dist/thirdweb-dev-storage.esm.js", | ||
"devDependencies": { | ||
"@babel/preset-env": "^7.22.9", | ||
"@babel/preset-typescript": "^7.22.5", | ||
"@babel/preset-env": "^7.23.8", | ||
"@babel/preset-typescript": "^7.23.3", | ||
"@microsoft/api-documenter": "^7.22.30", | ||
@@ -31,3 +31,3 @@ "@microsoft/api-extractor": "^7.36.3", | ||
"@preconstruct/cli": "2.7.0", | ||
"@swc-node/register": "^1.6.6", | ||
"@swc-node/register": "^1.6.8", | ||
"@thirdweb-dev/tsconfig": "^0.1.7", | ||
@@ -38,6 +38,6 @@ "@types/chai": "^4.3.5", | ||
"@typescript-eslint/eslint-plugin": "^6.2.0", | ||
"@typescript-eslint/parser": "^6.2.0", | ||
"@typescript-eslint/parser": "^6.19.1", | ||
"chai": "^4.3.6", | ||
"eslint": "^8.45.0", | ||
"eslint-config-thirdweb": "^0.1.6", | ||
"eslint": "^8.56.0", | ||
"eslint-config-thirdweb": "^0.1.7", | ||
"eslint-plugin-tsdoc": "^0.2.16", | ||
@@ -47,10 +47,10 @@ "esm": "^3.2.25", | ||
"rimraf": "^3.0.2", | ||
"typescript": "^5.1.6", | ||
"typedoc-gen": "^1.0.1" | ||
"typedoc-gen": "^1.0.1", | ||
"typescript": "^5.3.3" | ||
}, | ||
"dependencies": { | ||
"@thirdweb-dev/crypto": "0.2.0", | ||
"cid-tool": "^3.0.0", | ||
"form-data": "^4.0.0", | ||
"uuid": "^9.0.1", | ||
"@thirdweb-dev/crypto": "0.2.0" | ||
"uuid": "^9.0.1" | ||
}, | ||
@@ -64,3 +64,2 @@ "engines": { | ||
"fix": "eslint src/ --fix", | ||
"generate-docs": "api-extractor run --local && api-documenter markdown -i ./temp -o ./docs", | ||
"clean": "rm -rf dist/", | ||
@@ -67,0 +66,0 @@ "build": "tsc && preconstruct build", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
177747
49
4112
2