emblem-vault-sdk 1.7.11 → 1.7.13
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/bundle.js +26 -22
- package/dist/index.js +1 -1
- package/dist/utils.js +25 -21
- package/docs/bundle.js +26 -22
- package/package.json +2 -2
- package/src/utils.ts +25 -21
package/dist/bundle.js
CHANGED
|
@@ -709310,7 +709310,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
709310
709310
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
709311
709311
|
const bignumber_1 = require("@ethersproject/bignumber");
|
|
709312
709312
|
const utils_1 = require("./utils");
|
|
709313
|
-
const SDK_VERSION = '1.7.
|
|
709313
|
+
const SDK_VERSION = '1.7.13';
|
|
709314
709314
|
class EmblemVaultSDK {
|
|
709315
709315
|
constructor(apiKey, baseUrl) {
|
|
709316
709316
|
this.apiKey = apiKey;
|
|
@@ -710174,27 +710174,31 @@ function getHandlerContract(web3) {
|
|
|
710174
710174
|
exports.getHandlerContract = getHandlerContract;
|
|
710175
710175
|
function checkContentType(url) {
|
|
710176
710176
|
return new Promise((resolve, reject) => {
|
|
710177
|
-
let returnVal = {};
|
|
710178
|
-
|
|
710179
|
-
|
|
710180
|
-
|
|
710181
|
-
|
|
710182
|
-
|
|
710183
|
-
|
|
710184
|
-
|
|
710185
|
-
|
|
710186
|
-
|
|
710187
|
-
|
|
710188
|
-
|
|
710189
|
-
|
|
710190
|
-
|
|
710191
|
-
|
|
710192
|
-
|
|
710193
|
-
|
|
710194
|
-
|
|
710195
|
-
|
|
710196
|
-
|
|
710197
|
-
|
|
710177
|
+
let returnVal = { valid: false };
|
|
710178
|
+
try {
|
|
710179
|
+
fetch(url, { method: 'HEAD' })
|
|
710180
|
+
.then(response => {
|
|
710181
|
+
if (!response.ok) {
|
|
710182
|
+
returnVal.valid = false;
|
|
710183
|
+
}
|
|
710184
|
+
else if (response.status === 200) {
|
|
710185
|
+
const contentType = response.headers.get('content-type');
|
|
710186
|
+
let extension = getFileExtensionFromMimeType(contentType);
|
|
710187
|
+
returnVal.valid = true;
|
|
710188
|
+
returnVal.contentType = contentType;
|
|
710189
|
+
returnVal.extension = extension;
|
|
710190
|
+
returnVal.embed = !isValidDirect(extension);
|
|
710191
|
+
console.log('Content-Type:', contentType);
|
|
710192
|
+
}
|
|
710193
|
+
resolve(returnVal);
|
|
710194
|
+
})
|
|
710195
|
+
.catch(error => {
|
|
710196
|
+
console.error('Error while fetching URL:', error);
|
|
710197
|
+
resolve(returnVal);
|
|
710198
|
+
});
|
|
710199
|
+
}
|
|
710200
|
+
catch (error) {
|
|
710201
|
+
}
|
|
710198
710202
|
});
|
|
710199
710203
|
}
|
|
710200
710204
|
exports.checkContentType = checkContentType;
|
package/dist/index.js
CHANGED
|
@@ -34,7 +34,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
34
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
35
|
const bignumber_1 = require("@ethersproject/bignumber");
|
|
36
36
|
const utils_1 = require("./utils");
|
|
37
|
-
const SDK_VERSION = '1.7.
|
|
37
|
+
const SDK_VERSION = '1.7.13';
|
|
38
38
|
class EmblemVaultSDK {
|
|
39
39
|
constructor(apiKey, baseUrl) {
|
|
40
40
|
this.apiKey = apiKey;
|
package/dist/utils.js
CHANGED
|
@@ -544,27 +544,31 @@ function getHandlerContract(web3) {
|
|
|
544
544
|
exports.getHandlerContract = getHandlerContract;
|
|
545
545
|
function checkContentType(url) {
|
|
546
546
|
return new Promise((resolve, reject) => {
|
|
547
|
-
let returnVal = {};
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
547
|
+
let returnVal = { valid: false };
|
|
548
|
+
try {
|
|
549
|
+
fetch(url, { method: 'HEAD' })
|
|
550
|
+
.then(response => {
|
|
551
|
+
if (!response.ok) {
|
|
552
|
+
returnVal.valid = false;
|
|
553
|
+
}
|
|
554
|
+
else if (response.status === 200) {
|
|
555
|
+
const contentType = response.headers.get('content-type');
|
|
556
|
+
let extension = getFileExtensionFromMimeType(contentType);
|
|
557
|
+
returnVal.valid = true;
|
|
558
|
+
returnVal.contentType = contentType;
|
|
559
|
+
returnVal.extension = extension;
|
|
560
|
+
returnVal.embed = !isValidDirect(extension);
|
|
561
|
+
console.log('Content-Type:', contentType);
|
|
562
|
+
}
|
|
563
|
+
resolve(returnVal);
|
|
564
|
+
})
|
|
565
|
+
.catch(error => {
|
|
566
|
+
console.error('Error while fetching URL:', error);
|
|
567
|
+
resolve(returnVal);
|
|
568
|
+
});
|
|
569
|
+
}
|
|
570
|
+
catch (error) {
|
|
571
|
+
}
|
|
568
572
|
});
|
|
569
573
|
}
|
|
570
574
|
exports.checkContentType = checkContentType;
|
package/docs/bundle.js
CHANGED
|
@@ -709310,7 +709310,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
709310
709310
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
709311
709311
|
const bignumber_1 = require("@ethersproject/bignumber");
|
|
709312
709312
|
const utils_1 = require("./utils");
|
|
709313
|
-
const SDK_VERSION = '1.7.
|
|
709313
|
+
const SDK_VERSION = '1.7.13';
|
|
709314
709314
|
class EmblemVaultSDK {
|
|
709315
709315
|
constructor(apiKey, baseUrl) {
|
|
709316
709316
|
this.apiKey = apiKey;
|
|
@@ -710174,27 +710174,31 @@ function getHandlerContract(web3) {
|
|
|
710174
710174
|
exports.getHandlerContract = getHandlerContract;
|
|
710175
710175
|
function checkContentType(url) {
|
|
710176
710176
|
return new Promise((resolve, reject) => {
|
|
710177
|
-
let returnVal = {};
|
|
710178
|
-
|
|
710179
|
-
|
|
710180
|
-
|
|
710181
|
-
|
|
710182
|
-
|
|
710183
|
-
|
|
710184
|
-
|
|
710185
|
-
|
|
710186
|
-
|
|
710187
|
-
|
|
710188
|
-
|
|
710189
|
-
|
|
710190
|
-
|
|
710191
|
-
|
|
710192
|
-
|
|
710193
|
-
|
|
710194
|
-
|
|
710195
|
-
|
|
710196
|
-
|
|
710197
|
-
|
|
710177
|
+
let returnVal = { valid: false };
|
|
710178
|
+
try {
|
|
710179
|
+
fetch(url, { method: 'HEAD' })
|
|
710180
|
+
.then(response => {
|
|
710181
|
+
if (!response.ok) {
|
|
710182
|
+
returnVal.valid = false;
|
|
710183
|
+
}
|
|
710184
|
+
else if (response.status === 200) {
|
|
710185
|
+
const contentType = response.headers.get('content-type');
|
|
710186
|
+
let extension = getFileExtensionFromMimeType(contentType);
|
|
710187
|
+
returnVal.valid = true;
|
|
710188
|
+
returnVal.contentType = contentType;
|
|
710189
|
+
returnVal.extension = extension;
|
|
710190
|
+
returnVal.embed = !isValidDirect(extension);
|
|
710191
|
+
console.log('Content-Type:', contentType);
|
|
710192
|
+
}
|
|
710193
|
+
resolve(returnVal);
|
|
710194
|
+
})
|
|
710195
|
+
.catch(error => {
|
|
710196
|
+
console.error('Error while fetching URL:', error);
|
|
710197
|
+
resolve(returnVal);
|
|
710198
|
+
});
|
|
710199
|
+
}
|
|
710200
|
+
catch (error) {
|
|
710201
|
+
}
|
|
710198
710202
|
});
|
|
710199
710203
|
}
|
|
710200
710204
|
exports.checkContentType = checkContentType;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "emblem-vault-sdk",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.13",
|
|
4
4
|
"description": "Emblem Vault Software Development Kit",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -36,6 +36,6 @@
|
|
|
36
36
|
"web3": "^4.4.0"
|
|
37
37
|
},
|
|
38
38
|
"engines": {
|
|
39
|
-
"node": ">=20.
|
|
39
|
+
"node": ">=20.5.1"
|
|
40
40
|
}
|
|
41
41
|
}
|
package/src/utils.ts
CHANGED
|
@@ -502,27 +502,31 @@ export function checkContentType(url: string) {
|
|
|
502
502
|
return new Promise((resolve, reject) => {
|
|
503
503
|
// Making a HTTP HEAD request to get only the headers
|
|
504
504
|
type ReturnVal = { valid?: boolean, contentType?: string | null, extension?: string, embed?: boolean };
|
|
505
|
-
let returnVal: ReturnVal = {};
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
505
|
+
let returnVal: ReturnVal = {valid: false};
|
|
506
|
+
try {
|
|
507
|
+
fetch(url, { method: 'HEAD' })
|
|
508
|
+
.then(response => {
|
|
509
|
+
if (!response.ok) {
|
|
510
|
+
returnVal.valid = false
|
|
511
|
+
}
|
|
512
|
+
else if (response.status === 200) {
|
|
513
|
+
const contentType = response.headers.get('content-type');
|
|
514
|
+
let extension = getFileExtensionFromMimeType(contentType)
|
|
515
|
+
returnVal.valid = true
|
|
516
|
+
returnVal.contentType = contentType
|
|
517
|
+
returnVal.extension = extension
|
|
518
|
+
returnVal.embed = !isValidDirect(extension)
|
|
519
|
+
console.log('Content-Type:', contentType);
|
|
520
|
+
}
|
|
521
|
+
resolve(returnVal);
|
|
522
|
+
})
|
|
523
|
+
.catch(error => {
|
|
524
|
+
console.error('Error while fetching URL:', error);
|
|
525
|
+
resolve(returnVal);
|
|
526
|
+
});
|
|
527
|
+
} catch (error) {
|
|
528
|
+
|
|
529
|
+
}
|
|
526
530
|
});
|
|
527
531
|
}
|
|
528
532
|
|