sodas-sdk 1.1.11 → 1.1.12
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/SODAS_SDK_CLASS/DCAT/dataset.d.ts +2 -0
- package/dist/SODAS_SDK_CLASS/DCAT/datasetSeries.d.ts +21 -1
- package/dist/SODAS_SDK_CLASS/DCAT/distribution.d.ts +6 -0
- package/dist/SODAS_SDK_CLASS/dcatClass.d.ts +7 -0
- package/dist/__tests__/SODAS_SDK_CLASS/DCAT/dataset/interoperation.medium.test.d.ts +1 -0
- package/dist/__tests__/SODAS_SDK_CLASS/DCAT/dataset/populateToSync.small.test.d.ts +1 -0
- package/dist/__tests__/SODAS_SDK_CLASS/DCAT/datasetSeries/interoperation.medium.test.d.ts +1 -0
- package/dist/__tests__/SODAS_SDK_CLASS/DCAT/datasetSeries/populateToSync.small.test.d.ts +1 -0
- package/dist/__tests__/SODAS_SDK_CLASS/DCAT/distribution/populateToSync.small.test.d.ts +1 -0
- package/dist/index.browser.js +228 -12
- package/dist/index.browser.js.map +1 -1
- package/dist/index.legacy.browser.js +228 -12
- package/dist/index.legacy.browser.js.map +1 -1
- package/dist/index.legacy.node.cjs +228 -12
- package/dist/index.legacy.node.cjs.map +1 -1
- package/dist/index.node.js +228 -12
- package/dist/index.node.js.map +1 -1
- package/package.json +1 -1
package/dist/index.node.js
CHANGED
|
@@ -5540,6 +5540,70 @@ class Dataset extends _dcatResource__WEBPACK_IMPORTED_MODULE_4__["default"] {
|
|
|
5540
5540
|
}
|
|
5541
5541
|
});
|
|
5542
5542
|
}
|
|
5543
|
+
static syncToCurrentHub(dataset) {
|
|
5544
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
5545
|
+
var _a;
|
|
5546
|
+
try {
|
|
5547
|
+
const checkExisting = yield Dataset.getDBRecordByAssetID((0,_core_type__WEBPACK_IMPORTED_MODULE_1__.asID)(dataset.assetID));
|
|
5548
|
+
if (checkExisting) {
|
|
5549
|
+
checkExisting.populateToSync(dataset);
|
|
5550
|
+
yield checkExisting.updateDBRecord();
|
|
5551
|
+
}
|
|
5552
|
+
}
|
|
5553
|
+
catch (error) {
|
|
5554
|
+
if (axios__WEBPACK_IMPORTED_MODULE_6__["default"].isAxiosError(error) && ((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 404) {
|
|
5555
|
+
const newDataset = new Dataset();
|
|
5556
|
+
newDataset.populateToSync(dataset);
|
|
5557
|
+
yield newDataset.createDBRecord();
|
|
5558
|
+
}
|
|
5559
|
+
else {
|
|
5560
|
+
throw error;
|
|
5561
|
+
}
|
|
5562
|
+
}
|
|
5563
|
+
});
|
|
5564
|
+
}
|
|
5565
|
+
populateToSync(source) {
|
|
5566
|
+
const excludedKeys = new Set([
|
|
5567
|
+
"ID",
|
|
5568
|
+
"DatasetID",
|
|
5569
|
+
"IsVersionOf",
|
|
5570
|
+
"PreviousVersionID",
|
|
5571
|
+
"NextVersionID",
|
|
5572
|
+
"VersionInfos",
|
|
5573
|
+
"InSeriesID",
|
|
5574
|
+
"FirstID",
|
|
5575
|
+
"PreviousID",
|
|
5576
|
+
"NextID",
|
|
5577
|
+
"LastID",
|
|
5578
|
+
"DistributionIDs",
|
|
5579
|
+
]);
|
|
5580
|
+
for (const key in source) {
|
|
5581
|
+
if (!Object.prototype.hasOwnProperty.call(source, key))
|
|
5582
|
+
continue;
|
|
5583
|
+
if (key === "Distributions")
|
|
5584
|
+
continue;
|
|
5585
|
+
if (excludedKeys.has(key))
|
|
5586
|
+
continue;
|
|
5587
|
+
const value = source[key];
|
|
5588
|
+
if (value !== undefined) {
|
|
5589
|
+
this[key] = value;
|
|
5590
|
+
}
|
|
5591
|
+
}
|
|
5592
|
+
// Handle distributions separately so that we can preserve identity fields
|
|
5593
|
+
// of existing distributions while syncing other fields, and create new
|
|
5594
|
+
// distributions for any additional ones in the source.
|
|
5595
|
+
const sourceDistributions = source.Distributions;
|
|
5596
|
+
if (!sourceDistributions || sourceDistributions.length === 0) {
|
|
5597
|
+
return;
|
|
5598
|
+
}
|
|
5599
|
+
this.Distributions = [];
|
|
5600
|
+
for (let i = 0; i < sourceDistributions.length; i++) {
|
|
5601
|
+
const srcDist = sourceDistributions[i];
|
|
5602
|
+
const targetDist = new _distribution__WEBPACK_IMPORTED_MODULE_5__["default"]();
|
|
5603
|
+
targetDist.populateToSync(srcDist);
|
|
5604
|
+
this.Distributions.push(targetDist);
|
|
5605
|
+
}
|
|
5606
|
+
}
|
|
5543
5607
|
createDBRecord() {
|
|
5544
5608
|
const _super = Object.create(null, {
|
|
5545
5609
|
createDBRecord: { get: () => super.createDBRecord }
|
|
@@ -5729,6 +5793,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
5729
5793
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
5730
5794
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
5731
5795
|
/* harmony export */ });
|
|
5796
|
+
/* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! axios */ "./node_modules/axios/lib/axios.js");
|
|
5732
5797
|
/* harmony import */ var _core_error__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../core/error */ "./lib/core/error.ts");
|
|
5733
5798
|
/* harmony import */ var _core_type__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../core/type */ "./lib/core/type.ts");
|
|
5734
5799
|
/* harmony import */ var _core_util__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../core/util */ "./lib/core/util.ts");
|
|
@@ -5748,10 +5813,105 @@ var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _argume
|
|
|
5748
5813
|
|
|
5749
5814
|
|
|
5750
5815
|
|
|
5816
|
+
|
|
5751
5817
|
/**
|
|
5752
5818
|
* Represents a series of datasets.
|
|
5753
5819
|
*/
|
|
5754
5820
|
class DatasetSeries extends _dcatResource__WEBPACK_IMPORTED_MODULE_4__["default"] {
|
|
5821
|
+
static syncToCurrentHub(datasetSeries) {
|
|
5822
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
5823
|
+
var _a;
|
|
5824
|
+
try {
|
|
5825
|
+
const checkExisting = yield DatasetSeries.getDBRecordByAssetID((0,_core_type__WEBPACK_IMPORTED_MODULE_1__.asID)(datasetSeries.assetID));
|
|
5826
|
+
if (checkExisting) {
|
|
5827
|
+
yield checkExisting.populateToSync(datasetSeries);
|
|
5828
|
+
yield checkExisting.updateDBRecord();
|
|
5829
|
+
}
|
|
5830
|
+
}
|
|
5831
|
+
catch (error) {
|
|
5832
|
+
if (axios__WEBPACK_IMPORTED_MODULE_5__["default"].isAxiosError(error) && ((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 404) {
|
|
5833
|
+
const newDatasetSeries = new DatasetSeries();
|
|
5834
|
+
yield newDatasetSeries.populateToSync(datasetSeries);
|
|
5835
|
+
yield newDatasetSeries.createDBRecord();
|
|
5836
|
+
}
|
|
5837
|
+
else {
|
|
5838
|
+
throw error;
|
|
5839
|
+
}
|
|
5840
|
+
}
|
|
5841
|
+
});
|
|
5842
|
+
}
|
|
5843
|
+
/**
|
|
5844
|
+
* Populates this instance with values from the given DatasetSeries, except for:
|
|
5845
|
+
* - DB identity / temporal fields (ID, IRI, Issued, Modified, CreatedAt, UpdatedAt)
|
|
5846
|
+
* - Version/lineage fields (IsVersionOf, PreviousVersionID, NextVersionID, VersionInfos)
|
|
5847
|
+
* - Series identity fields (DatasetSeriesID, InSeriesID)
|
|
5848
|
+
* - Fields explicitly set to `undefined` on the source instance
|
|
5849
|
+
*
|
|
5850
|
+
* Additionally, when SeriesMembers are present on the source, this method
|
|
5851
|
+
* resolves each member via Dataset.getDBRecordByAssetID (by AssetID) and
|
|
5852
|
+
* replaces this.SeriesMemberIDs with the resolved IDs.
|
|
5853
|
+
*/
|
|
5854
|
+
populateToSync(source) {
|
|
5855
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
5856
|
+
var _a;
|
|
5857
|
+
const excludedKeys = new Set([
|
|
5858
|
+
"ID",
|
|
5859
|
+
"IsVersionOf",
|
|
5860
|
+
"PreviousVersionID",
|
|
5861
|
+
"NextVersionID",
|
|
5862
|
+
"VersionInfos",
|
|
5863
|
+
"DatasetSeriesID",
|
|
5864
|
+
"InSeriesID",
|
|
5865
|
+
]);
|
|
5866
|
+
for (const key in source) {
|
|
5867
|
+
if (!Object.prototype.hasOwnProperty.call(source, key))
|
|
5868
|
+
continue;
|
|
5869
|
+
if (key === "SeriesMembers")
|
|
5870
|
+
continue;
|
|
5871
|
+
if (excludedKeys.has(key))
|
|
5872
|
+
continue;
|
|
5873
|
+
const value = source[key];
|
|
5874
|
+
if (value !== undefined) {
|
|
5875
|
+
this[key] = value;
|
|
5876
|
+
}
|
|
5877
|
+
}
|
|
5878
|
+
this.SeriesMembers = [];
|
|
5879
|
+
const sourceMembers = source.SeriesMembers;
|
|
5880
|
+
if (!sourceMembers || sourceMembers.length === 0) {
|
|
5881
|
+
return;
|
|
5882
|
+
}
|
|
5883
|
+
const resolvedIDs = [];
|
|
5884
|
+
for (const member of sourceMembers) {
|
|
5885
|
+
if (!member)
|
|
5886
|
+
continue;
|
|
5887
|
+
const assetIDStr = member.assetID;
|
|
5888
|
+
if (!assetIDStr)
|
|
5889
|
+
continue;
|
|
5890
|
+
const assetID = (0,_core_type__WEBPACK_IMPORTED_MODULE_1__.asID)(assetIDStr);
|
|
5891
|
+
// Prefer existing record by AssetID; if not found, create a new one.
|
|
5892
|
+
try {
|
|
5893
|
+
const existing = yield _dataset__WEBPACK_IMPORTED_MODULE_3__["default"].getDBRecordByAssetID(assetID);
|
|
5894
|
+
if (existing) {
|
|
5895
|
+
existing.populateToSync(member);
|
|
5896
|
+
yield existing.updateDBRecord();
|
|
5897
|
+
resolvedIDs.push(existing.id);
|
|
5898
|
+
}
|
|
5899
|
+
}
|
|
5900
|
+
catch (error) {
|
|
5901
|
+
if (axios__WEBPACK_IMPORTED_MODULE_5__["default"].isAxiosError(error) && ((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 404) {
|
|
5902
|
+
const newMember = new _dataset__WEBPACK_IMPORTED_MODULE_3__["default"]();
|
|
5903
|
+
newMember.populateToSync(member);
|
|
5904
|
+
yield newMember.createDBRecord();
|
|
5905
|
+
resolvedIDs.push(newMember.id);
|
|
5906
|
+
}
|
|
5907
|
+
else {
|
|
5908
|
+
throw error;
|
|
5909
|
+
}
|
|
5910
|
+
}
|
|
5911
|
+
}
|
|
5912
|
+
this.SeriesMemberIDs = resolvedIDs;
|
|
5913
|
+
});
|
|
5914
|
+
}
|
|
5755
5915
|
/**
|
|
5756
5916
|
* Initializes or updates the API_URL and LIST_URL for Dataset.
|
|
5757
5917
|
*
|
|
@@ -5792,11 +5952,17 @@ class DatasetSeries extends _dcatResource__WEBPACK_IMPORTED_MODULE_4__["default"
|
|
|
5792
5952
|
}
|
|
5793
5953
|
populateSeriesMembersFromDTO(dto) {
|
|
5794
5954
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5955
|
+
this.SeriesMembers = [];
|
|
5795
5956
|
if (dto.SeriesMemberIDs && dto.SeriesMemberIDs.length != 0) {
|
|
5796
5957
|
this.SeriesMemberIDs = (0,_core_type__WEBPACK_IMPORTED_MODULE_1__.asIDs)(dto.SeriesMemberIDs);
|
|
5797
|
-
this.
|
|
5798
|
-
|
|
5799
|
-
|
|
5958
|
+
if (this.SeriesMemberIDs && this.SeriesMemberIDs.length != 0) {
|
|
5959
|
+
for (const seriesMemberID of this.SeriesMemberIDs) {
|
|
5960
|
+
const seriesMember = yield _dataset__WEBPACK_IMPORTED_MODULE_3__["default"].getDBRecord(seriesMemberID);
|
|
5961
|
+
if (seriesMember) {
|
|
5962
|
+
this.SeriesMembers.push(seriesMember);
|
|
5963
|
+
}
|
|
5964
|
+
}
|
|
5965
|
+
}
|
|
5800
5966
|
}
|
|
5801
5967
|
});
|
|
5802
5968
|
}
|
|
@@ -5815,6 +5981,17 @@ class DatasetSeries extends _dcatResource__WEBPACK_IMPORTED_MODULE_4__["default"
|
|
|
5815
5981
|
yield _super.deleteDBRecord.call(this);
|
|
5816
5982
|
});
|
|
5817
5983
|
}
|
|
5984
|
+
/**
|
|
5985
|
+
* Creates a dataset series DB record in an interoperated context
|
|
5986
|
+
* (e.g. together with related Dataset instances or other resources).
|
|
5987
|
+
*
|
|
5988
|
+
* The implementation will be added later.
|
|
5989
|
+
*/
|
|
5990
|
+
createInteroperatedDBRecord() {
|
|
5991
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
5992
|
+
// TODO: Implement interoperated create logic.
|
|
5993
|
+
});
|
|
5994
|
+
}
|
|
5818
5995
|
appendSeriesMember(dataset) {
|
|
5819
5996
|
if (!this.SeriesMemberIDs) {
|
|
5820
5997
|
this.SeriesMemberIDs = [];
|
|
@@ -5847,7 +6024,7 @@ class DatasetSeries extends _dcatResource__WEBPACK_IMPORTED_MODULE_4__["default"
|
|
|
5847
6024
|
get datasetSeriesID() {
|
|
5848
6025
|
return this.DatasetSeriesID;
|
|
5849
6026
|
}
|
|
5850
|
-
get
|
|
6027
|
+
get seriesMemberIDs() {
|
|
5851
6028
|
return this.SeriesMemberIDs;
|
|
5852
6029
|
}
|
|
5853
6030
|
get seriesMembers() {
|
|
@@ -6271,8 +6448,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
6271
6448
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
6272
6449
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
6273
6450
|
/* harmony export */ });
|
|
6274
|
-
/* harmony import */ var
|
|
6275
|
-
/* harmony import */ var
|
|
6451
|
+
/* harmony import */ var _SODAS_SDK_FILE_dataFile__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../SODAS_SDK_FILE/dataFile */ "./lib/SODAS_SDK_FILE/dataFile.ts");
|
|
6452
|
+
/* harmony import */ var _core_type__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../core/type */ "./lib/core/type.ts");
|
|
6276
6453
|
/* harmony import */ var _dcatClass__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../dcatClass */ "./lib/SODAS_SDK_CLASS/dcatClass.ts");
|
|
6277
6454
|
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
6278
6455
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
@@ -6287,6 +6464,24 @@ var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _argume
|
|
|
6287
6464
|
|
|
6288
6465
|
|
|
6289
6466
|
class Distribution extends _dcatClass__WEBPACK_IMPORTED_MODULE_2__["default"] {
|
|
6467
|
+
/**
|
|
6468
|
+
* Populates this instance with values from the given Distribution, except for:
|
|
6469
|
+
* - DB identity / temporal fields (ID, IRI, Issued, Modified, CreatedAt, UpdatedAt)
|
|
6470
|
+
* - Fields that are explicitly set to `undefined` on the source instance
|
|
6471
|
+
*/
|
|
6472
|
+
populateToSync(source) {
|
|
6473
|
+
const excludedKeys = new Set(["ID", "IsDistributionOf", "AccessServiceID"]);
|
|
6474
|
+
for (const key in source) {
|
|
6475
|
+
if (!Object.prototype.hasOwnProperty.call(source, key))
|
|
6476
|
+
continue;
|
|
6477
|
+
if (excludedKeys.has(key))
|
|
6478
|
+
continue;
|
|
6479
|
+
const value = source[key];
|
|
6480
|
+
if (value !== undefined) {
|
|
6481
|
+
this[key] = value;
|
|
6482
|
+
}
|
|
6483
|
+
}
|
|
6484
|
+
}
|
|
6290
6485
|
toDTO() {
|
|
6291
6486
|
return Object.assign(Object.assign(Object.assign(Object.assign({}, super.toDTO()), (this.IsDistributionOf && { IsDistributionOf: this.IsDistributionOf })), (this.AccessServiceID && { AccessServiceID: this.AccessServiceID })), { AccessURL: this.AccessURL, ByteSize: this.ByteSize, CompressFormat: this.CompressFormat, DownloadURL: this.DownloadURL, MediaType: this.MediaType, PackageFormat: this.PackageFormat, SpatialResolutionInMeters: this.SpatialResolutionInMeters, TemporalResolution: this.TemporalResolution, AccessRights: this.AccessRights, ConformsTo: this.ConformsTo, DescriptionML: this.DescriptionML, Format: this.Format, License: this.License, Rights: this.Rights, TitleML: this.TitleML, HasPolicy: this.HasPolicy, Checksum: this.Checksum });
|
|
6292
6487
|
}
|
|
@@ -6298,7 +6493,7 @@ class Distribution extends _dcatClass__WEBPACK_IMPORTED_MODULE_2__["default"] {
|
|
|
6298
6493
|
yield _super.populateFromDTO.call(this, dto);
|
|
6299
6494
|
const distributionDTO = dto;
|
|
6300
6495
|
distributionDTO.AccessServiceID &&
|
|
6301
|
-
(this.AccessServiceID = (0,
|
|
6496
|
+
(this.AccessServiceID = (0,_core_type__WEBPACK_IMPORTED_MODULE_1__.asID)(distributionDTO.AccessServiceID));
|
|
6302
6497
|
distributionDTO.AccessURL && (this.AccessURL = distributionDTO.AccessURL);
|
|
6303
6498
|
distributionDTO.ByteSize && (this.ByteSize = distributionDTO.ByteSize);
|
|
6304
6499
|
distributionDTO.CompressFormat &&
|
|
@@ -6326,7 +6521,7 @@ class Distribution extends _dcatClass__WEBPACK_IMPORTED_MODULE_2__["default"] {
|
|
|
6326
6521
|
distributionDTO.HasPolicy && (this.HasPolicy = distributionDTO.HasPolicy);
|
|
6327
6522
|
distributionDTO.Checksum && (this.Checksum = distributionDTO.Checksum);
|
|
6328
6523
|
distributionDTO.IsDistributionOf &&
|
|
6329
|
-
(this.IsDistributionOf = (0,
|
|
6524
|
+
(this.IsDistributionOf = (0,_core_type__WEBPACK_IMPORTED_MODULE_1__.asID)(distributionDTO.IsDistributionOf));
|
|
6330
6525
|
});
|
|
6331
6526
|
}
|
|
6332
6527
|
/**
|
|
@@ -6342,7 +6537,7 @@ class Distribution extends _dcatClass__WEBPACK_IMPORTED_MODULE_2__["default"] {
|
|
|
6342
6537
|
Distribution.DOWNLOAD_API_URL = `${url}/data/download`;
|
|
6343
6538
|
}
|
|
6344
6539
|
static configureBucketName(bucketName) {
|
|
6345
|
-
|
|
6540
|
+
_SODAS_SDK_FILE_dataFile__WEBPACK_IMPORTED_MODULE_0__["default"].configureBucketName(bucketName);
|
|
6346
6541
|
}
|
|
6347
6542
|
/**
|
|
6348
6543
|
* Sets file information for a browser environment.
|
|
@@ -6350,7 +6545,7 @@ class Distribution extends _dcatClass__WEBPACK_IMPORTED_MODULE_2__["default"] {
|
|
|
6350
6545
|
*/
|
|
6351
6546
|
setUploadingDataForBrowser(file) {
|
|
6352
6547
|
if (!this.UploadingData) {
|
|
6353
|
-
this.UploadingData = new
|
|
6548
|
+
this.UploadingData = new _SODAS_SDK_FILE_dataFile__WEBPACK_IMPORTED_MODULE_0__["default"]();
|
|
6354
6549
|
}
|
|
6355
6550
|
this.UploadingData.setFileForBrowser(file);
|
|
6356
6551
|
}
|
|
@@ -6360,7 +6555,7 @@ class Distribution extends _dcatClass__WEBPACK_IMPORTED_MODULE_2__["default"] {
|
|
|
6360
6555
|
*/
|
|
6361
6556
|
setUploadingDataForNode(filePath) {
|
|
6362
6557
|
if (!this.UploadingData) {
|
|
6363
|
-
this.UploadingData = new
|
|
6558
|
+
this.UploadingData = new _SODAS_SDK_FILE_dataFile__WEBPACK_IMPORTED_MODULE_0__["default"]();
|
|
6364
6559
|
}
|
|
6365
6560
|
this.UploadingData.setFileForNode(filePath);
|
|
6366
6561
|
}
|
|
@@ -6553,7 +6748,7 @@ class Distribution extends _dcatClass__WEBPACK_IMPORTED_MODULE_2__["default"] {
|
|
|
6553
6748
|
return this.IsDistributionOf;
|
|
6554
6749
|
}
|
|
6555
6750
|
set isDistributionOf(value) {
|
|
6556
|
-
this.IsDistributionOf = (0,
|
|
6751
|
+
this.IsDistributionOf = (0,_core_type__WEBPACK_IMPORTED_MODULE_1__.asID)(value);
|
|
6557
6752
|
}
|
|
6558
6753
|
}
|
|
6559
6754
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Distribution);
|
|
@@ -6806,6 +7001,27 @@ class DCAT_MODEL extends _sodasSDKClass__WEBPACK_IMPORTED_MODULE_3__["default"]
|
|
|
6806
7001
|
}
|
|
6807
7002
|
});
|
|
6808
7003
|
}
|
|
7004
|
+
/**
|
|
7005
|
+
* Checks whether a DB record exists for the given AssetID and returns its ID.
|
|
7006
|
+
*
|
|
7007
|
+
* This method wraps getDBRecordByAssetID and converts a 404 response to `null`,
|
|
7008
|
+
* while rethrowing any other kind of error.
|
|
7009
|
+
*/
|
|
7010
|
+
static checkDBRecordOfAssetID(assetID) {
|
|
7011
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
7012
|
+
var _a;
|
|
7013
|
+
try {
|
|
7014
|
+
const record = (yield this.getDBRecordByAssetID(assetID));
|
|
7015
|
+
return record.id;
|
|
7016
|
+
}
|
|
7017
|
+
catch (error) {
|
|
7018
|
+
if (axios__WEBPACK_IMPORTED_MODULE_4__["default"].isAxiosError(error) && ((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 404) {
|
|
7019
|
+
return null;
|
|
7020
|
+
}
|
|
7021
|
+
throw error;
|
|
7022
|
+
}
|
|
7023
|
+
});
|
|
7024
|
+
}
|
|
6809
7025
|
updateDBRecord() {
|
|
6810
7026
|
return __awaiter(this, void 0, void 0, function* () {
|
|
6811
7027
|
this.throwErrorIfAPIURLNotSet();
|