sodas-sdk 1.1.11 → 1.1.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.
@@ -46,6 +46,8 @@ declare class Dataset extends DCAT_RESOURCE {
46
46
  toDTO(): DatasetDTO;
47
47
  populateFromDTO(dto: DCAT_MODEL_DTO): Promise<void>;
48
48
  populateDistributionFromDTO(dto: DatasetDTO): Promise<void>;
49
+ static syncToCurrentHub(dataset: Dataset): Promise<void>;
50
+ populateToSync(source: Dataset): void;
49
51
  createDBRecord(): Promise<void>;
50
52
  private deleteNotMaintainedDistributions;
51
53
  updateDBRecord(): Promise<void>;
@@ -27,6 +27,19 @@ declare class DatasetSeries extends DCAT_RESOURCE {
27
27
  private WasGeneratedBy;
28
28
  private SeriesMembers;
29
29
  private SeriesMemberIDs;
30
+ static syncToCurrentHub(datasetSeries: DatasetSeries): Promise<void>;
31
+ /**
32
+ * Populates this instance with values from the given DatasetSeries, except for:
33
+ * - DB identity / temporal fields (ID, IRI, Issued, Modified, CreatedAt, UpdatedAt)
34
+ * - Version/lineage fields (IsVersionOf, PreviousVersionID, NextVersionID, VersionInfos)
35
+ * - Series identity fields (DatasetSeriesID, InSeriesID)
36
+ * - Fields explicitly set to `undefined` on the source instance
37
+ *
38
+ * Additionally, when SeriesMembers are present on the source, this method
39
+ * resolves each member via Dataset.getDBRecordByAssetID (by AssetID) and
40
+ * replaces this.SeriesMemberIDs with the resolved IDs.
41
+ */
42
+ populateToSync(source: DatasetSeries): Promise<void>;
30
43
  /**
31
44
  * Initializes or updates the API_URL and LIST_URL for Dataset.
32
45
  *
@@ -38,10 +51,17 @@ declare class DatasetSeries extends DCAT_RESOURCE {
38
51
  populateFromDTO(dto: DCAT_MODEL_DTO): Promise<void>;
39
52
  populateSeriesMembersFromDTO(dto: DatasetSeriesDTO): Promise<void>;
40
53
  deleteDBRecord(): Promise<void>;
54
+ /**
55
+ * Creates a dataset series DB record in an interoperated context
56
+ * (e.g. together with related Dataset instances or other resources).
57
+ *
58
+ * The implementation will be added later.
59
+ */
60
+ createInteroperatedDBRecord(): Promise<void>;
41
61
  appendSeriesMember(dataset: Dataset): void;
42
62
  switchSeriesMembers(index1: number, index2: number): void;
43
63
  get datasetSeriesID(): IDType;
44
- get seriesMembereIDs(): IDType[];
64
+ get seriesMemberIDs(): IDType[];
45
65
  get seriesMembers(): Dataset[];
46
66
  get frequency(): string;
47
67
  set frequency(value: string);
@@ -44,6 +44,12 @@ declare class Distribution extends DCAT_MODEL {
44
44
  private TitleML;
45
45
  private HasPolicy;
46
46
  private Checksum;
47
+ /**
48
+ * Populates this instance with values from the given Distribution, except for:
49
+ * - DB identity / temporal fields (ID, IRI, Issued, Modified, CreatedAt, UpdatedAt)
50
+ * - Fields that are explicitly set to `undefined` on the source instance
51
+ */
52
+ populateToSync(source: Distribution): void;
47
53
  toDTO(): DistributionDTO;
48
54
  populateFromDTO(dto: DCAT_MODEL_DTO): Promise<void>;
49
55
  /**
@@ -23,6 +23,13 @@ declare abstract class DCAT_MODEL extends SODAS_SDK_CLASS {
23
23
  createDBRecord(): Promise<void>;
24
24
  static getDBRecord<GENERIC_DCAT_MODEL extends DCAT_MODEL>(this: DCAT_MODEL_STATIC<GENERIC_DCAT_MODEL>, ID: IDType): Promise<GENERIC_DCAT_MODEL>;
25
25
  static getDBRecordByAssetID<GENERIC_DCAT_MODEL extends DCAT_MODEL>(this: DCAT_MODEL_STATIC<GENERIC_DCAT_MODEL>, assetID: IDType): Promise<GENERIC_DCAT_MODEL>;
26
+ /**
27
+ * Checks whether a DB record exists for the given AssetID and returns its ID.
28
+ *
29
+ * This method wraps getDBRecordByAssetID and converts a 404 response to `null`,
30
+ * while rethrowing any other kind of error.
31
+ */
32
+ static checkDBRecordOfAssetID(assetID: IDType): Promise<IDType | null>;
26
33
  updateDBRecord(): Promise<void>;
27
34
  deleteDBRecord(): Promise<void>;
28
35
  get createdAt(): Date;
@@ -2501,6 +2501,70 @@ class Dataset extends _dcatResource__WEBPACK_IMPORTED_MODULE_4__["default"] {
2501
2501
  }
2502
2502
  });
2503
2503
  }
2504
+ static syncToCurrentHub(dataset) {
2505
+ return __awaiter(this, void 0, void 0, function* () {
2506
+ var _a;
2507
+ try {
2508
+ const checkExisting = yield Dataset.getDBRecordByAssetID((0,_core_type__WEBPACK_IMPORTED_MODULE_1__.asID)(dataset.assetID));
2509
+ if (checkExisting) {
2510
+ checkExisting.populateToSync(dataset);
2511
+ yield checkExisting.updateDBRecord();
2512
+ }
2513
+ }
2514
+ catch (error) {
2515
+ if (axios__WEBPACK_IMPORTED_MODULE_6__["default"].isAxiosError(error) && ((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 404) {
2516
+ const newDataset = new Dataset();
2517
+ newDataset.populateToSync(dataset);
2518
+ yield newDataset.createDBRecord();
2519
+ }
2520
+ else {
2521
+ throw error;
2522
+ }
2523
+ }
2524
+ });
2525
+ }
2526
+ populateToSync(source) {
2527
+ const excludedKeys = new Set([
2528
+ "ID",
2529
+ "DatasetID",
2530
+ "IsVersionOf",
2531
+ "PreviousVersionID",
2532
+ "NextVersionID",
2533
+ "VersionInfos",
2534
+ "InSeriesID",
2535
+ "FirstID",
2536
+ "PreviousID",
2537
+ "NextID",
2538
+ "LastID",
2539
+ "DistributionIDs",
2540
+ ]);
2541
+ for (const key in source) {
2542
+ if (!Object.prototype.hasOwnProperty.call(source, key))
2543
+ continue;
2544
+ if (key === "Distributions")
2545
+ continue;
2546
+ if (excludedKeys.has(key))
2547
+ continue;
2548
+ const value = source[key];
2549
+ if (value !== undefined) {
2550
+ this[key] = value;
2551
+ }
2552
+ }
2553
+ // Handle distributions separately so that we can preserve identity fields
2554
+ // of existing distributions while syncing other fields, and create new
2555
+ // distributions for any additional ones in the source.
2556
+ const sourceDistributions = source.Distributions;
2557
+ if (!sourceDistributions || sourceDistributions.length === 0) {
2558
+ return;
2559
+ }
2560
+ this.Distributions = [];
2561
+ for (let i = 0; i < sourceDistributions.length; i++) {
2562
+ const srcDist = sourceDistributions[i];
2563
+ const targetDist = new _distribution__WEBPACK_IMPORTED_MODULE_5__["default"]();
2564
+ targetDist.populateToSync(srcDist);
2565
+ this.Distributions.push(targetDist);
2566
+ }
2567
+ }
2504
2568
  createDBRecord() {
2505
2569
  const _super = Object.create(null, {
2506
2570
  createDBRecord: { get: () => super.createDBRecord }
@@ -2557,6 +2621,9 @@ class Dataset extends _dcatResource__WEBPACK_IMPORTED_MODULE_4__["default"] {
2557
2621
  }
2558
2622
  else {
2559
2623
  yield distribution.createDBRecord();
2624
+ if (!this.DistributionIDs) {
2625
+ this.DistributionIDs = [];
2626
+ }
2560
2627
  this.DistributionIDs.push((0,_core_type__WEBPACK_IMPORTED_MODULE_1__.asID)(distribution.id));
2561
2628
  }
2562
2629
  }
@@ -2690,6 +2757,7 @@ __webpack_require__.r(__webpack_exports__);
2690
2757
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2691
2758
  /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
2692
2759
  /* harmony export */ });
2760
+ /* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! axios */ "./node_modules/axios/lib/axios.js");
2693
2761
  /* harmony import */ var _core_error__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../core/error */ "./lib/core/error.ts");
2694
2762
  /* harmony import */ var _core_type__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../core/type */ "./lib/core/type.ts");
2695
2763
  /* harmony import */ var _core_util__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../core/util */ "./lib/core/util.ts");
@@ -2709,10 +2777,105 @@ var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _argume
2709
2777
 
2710
2778
 
2711
2779
 
2780
+
2712
2781
  /**
2713
2782
  * Represents a series of datasets.
2714
2783
  */
2715
2784
  class DatasetSeries extends _dcatResource__WEBPACK_IMPORTED_MODULE_4__["default"] {
2785
+ static syncToCurrentHub(datasetSeries) {
2786
+ return __awaiter(this, void 0, void 0, function* () {
2787
+ var _a;
2788
+ try {
2789
+ const checkExisting = yield DatasetSeries.getDBRecordByAssetID((0,_core_type__WEBPACK_IMPORTED_MODULE_1__.asID)(datasetSeries.assetID));
2790
+ if (checkExisting) {
2791
+ yield checkExisting.populateToSync(datasetSeries);
2792
+ yield checkExisting.updateDBRecord();
2793
+ }
2794
+ }
2795
+ catch (error) {
2796
+ if (axios__WEBPACK_IMPORTED_MODULE_5__["default"].isAxiosError(error) && ((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 404) {
2797
+ const newDatasetSeries = new DatasetSeries();
2798
+ yield newDatasetSeries.populateToSync(datasetSeries);
2799
+ yield newDatasetSeries.createDBRecord();
2800
+ }
2801
+ else {
2802
+ throw error;
2803
+ }
2804
+ }
2805
+ });
2806
+ }
2807
+ /**
2808
+ * Populates this instance with values from the given DatasetSeries, except for:
2809
+ * - DB identity / temporal fields (ID, IRI, Issued, Modified, CreatedAt, UpdatedAt)
2810
+ * - Version/lineage fields (IsVersionOf, PreviousVersionID, NextVersionID, VersionInfos)
2811
+ * - Series identity fields (DatasetSeriesID, InSeriesID)
2812
+ * - Fields explicitly set to `undefined` on the source instance
2813
+ *
2814
+ * Additionally, when SeriesMembers are present on the source, this method
2815
+ * resolves each member via Dataset.getDBRecordByAssetID (by AssetID) and
2816
+ * replaces this.SeriesMemberIDs with the resolved IDs.
2817
+ */
2818
+ populateToSync(source) {
2819
+ return __awaiter(this, void 0, void 0, function* () {
2820
+ var _a;
2821
+ const excludedKeys = new Set([
2822
+ "ID",
2823
+ "IsVersionOf",
2824
+ "PreviousVersionID",
2825
+ "NextVersionID",
2826
+ "VersionInfos",
2827
+ "DatasetSeriesID",
2828
+ "InSeriesID",
2829
+ ]);
2830
+ for (const key in source) {
2831
+ if (!Object.prototype.hasOwnProperty.call(source, key))
2832
+ continue;
2833
+ if (key === "SeriesMembers")
2834
+ continue;
2835
+ if (excludedKeys.has(key))
2836
+ continue;
2837
+ const value = source[key];
2838
+ if (value !== undefined) {
2839
+ this[key] = value;
2840
+ }
2841
+ }
2842
+ this.SeriesMembers = [];
2843
+ const sourceMembers = source.SeriesMembers;
2844
+ if (!sourceMembers || sourceMembers.length === 0) {
2845
+ return;
2846
+ }
2847
+ const resolvedIDs = [];
2848
+ for (const member of sourceMembers) {
2849
+ if (!member)
2850
+ continue;
2851
+ const assetIDStr = member.assetID;
2852
+ if (!assetIDStr)
2853
+ continue;
2854
+ const assetID = (0,_core_type__WEBPACK_IMPORTED_MODULE_1__.asID)(assetIDStr);
2855
+ // Prefer existing record by AssetID; if not found, create a new one.
2856
+ try {
2857
+ const existing = yield _dataset__WEBPACK_IMPORTED_MODULE_3__["default"].getDBRecordByAssetID(assetID);
2858
+ if (existing) {
2859
+ existing.populateToSync(member);
2860
+ yield existing.updateDBRecord();
2861
+ resolvedIDs.push(existing.id);
2862
+ }
2863
+ }
2864
+ catch (error) {
2865
+ if (axios__WEBPACK_IMPORTED_MODULE_5__["default"].isAxiosError(error) && ((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 404) {
2866
+ const newMember = new _dataset__WEBPACK_IMPORTED_MODULE_3__["default"]();
2867
+ newMember.populateToSync(member);
2868
+ yield newMember.createDBRecord();
2869
+ resolvedIDs.push(newMember.id);
2870
+ }
2871
+ else {
2872
+ throw error;
2873
+ }
2874
+ }
2875
+ }
2876
+ this.SeriesMemberIDs = resolvedIDs;
2877
+ });
2878
+ }
2716
2879
  /**
2717
2880
  * Initializes or updates the API_URL and LIST_URL for Dataset.
2718
2881
  *
@@ -2753,11 +2916,17 @@ class DatasetSeries extends _dcatResource__WEBPACK_IMPORTED_MODULE_4__["default"
2753
2916
  }
2754
2917
  populateSeriesMembersFromDTO(dto) {
2755
2918
  return __awaiter(this, void 0, void 0, function* () {
2919
+ this.SeriesMembers = [];
2756
2920
  if (dto.SeriesMemberIDs && dto.SeriesMemberIDs.length != 0) {
2757
2921
  this.SeriesMemberIDs = (0,_core_type__WEBPACK_IMPORTED_MODULE_1__.asIDs)(dto.SeriesMemberIDs);
2758
- this.SeriesMembers = yield Promise.all(dto.SeriesMemberIDs.map((seriesMemberID) => __awaiter(this, void 0, void 0, function* () {
2759
- return yield _dataset__WEBPACK_IMPORTED_MODULE_3__["default"].getDBRecord(seriesMemberID);
2760
- })));
2922
+ if (this.SeriesMemberIDs && this.SeriesMemberIDs.length != 0) {
2923
+ for (const seriesMemberID of this.SeriesMemberIDs) {
2924
+ const seriesMember = yield _dataset__WEBPACK_IMPORTED_MODULE_3__["default"].getDBRecord(seriesMemberID);
2925
+ if (seriesMember) {
2926
+ this.SeriesMembers.push(seriesMember);
2927
+ }
2928
+ }
2929
+ }
2761
2930
  }
2762
2931
  });
2763
2932
  }
@@ -2776,6 +2945,17 @@ class DatasetSeries extends _dcatResource__WEBPACK_IMPORTED_MODULE_4__["default"
2776
2945
  yield _super.deleteDBRecord.call(this);
2777
2946
  });
2778
2947
  }
2948
+ /**
2949
+ * Creates a dataset series DB record in an interoperated context
2950
+ * (e.g. together with related Dataset instances or other resources).
2951
+ *
2952
+ * The implementation will be added later.
2953
+ */
2954
+ createInteroperatedDBRecord() {
2955
+ return __awaiter(this, void 0, void 0, function* () {
2956
+ // TODO: Implement interoperated create logic.
2957
+ });
2958
+ }
2779
2959
  appendSeriesMember(dataset) {
2780
2960
  if (!this.SeriesMemberIDs) {
2781
2961
  this.SeriesMemberIDs = [];
@@ -2808,7 +2988,7 @@ class DatasetSeries extends _dcatResource__WEBPACK_IMPORTED_MODULE_4__["default"
2808
2988
  get datasetSeriesID() {
2809
2989
  return this.DatasetSeriesID;
2810
2990
  }
2811
- get seriesMembereIDs() {
2991
+ get seriesMemberIDs() {
2812
2992
  return this.SeriesMemberIDs;
2813
2993
  }
2814
2994
  get seriesMembers() {
@@ -3232,8 +3412,8 @@ __webpack_require__.r(__webpack_exports__);
3232
3412
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3233
3413
  /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
3234
3414
  /* harmony export */ });
3235
- /* harmony import */ var _core_type__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../core/type */ "./lib/core/type.ts");
3236
- /* harmony import */ var _SODAS_SDK_FILE_dataFile__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../SODAS_SDK_FILE/dataFile */ "./lib/SODAS_SDK_FILE/dataFile.ts");
3415
+ /* harmony import */ var _SODAS_SDK_FILE_dataFile__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../SODAS_SDK_FILE/dataFile */ "./lib/SODAS_SDK_FILE/dataFile.ts");
3416
+ /* harmony import */ var _core_type__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../core/type */ "./lib/core/type.ts");
3237
3417
  /* harmony import */ var _dcatClass__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../dcatClass */ "./lib/SODAS_SDK_CLASS/dcatClass.ts");
3238
3418
  var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
3239
3419
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
@@ -3248,6 +3428,24 @@ var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _argume
3248
3428
 
3249
3429
 
3250
3430
  class Distribution extends _dcatClass__WEBPACK_IMPORTED_MODULE_2__["default"] {
3431
+ /**
3432
+ * Populates this instance with values from the given Distribution, except for:
3433
+ * - DB identity / temporal fields (ID, IRI, Issued, Modified, CreatedAt, UpdatedAt)
3434
+ * - Fields that are explicitly set to `undefined` on the source instance
3435
+ */
3436
+ populateToSync(source) {
3437
+ const excludedKeys = new Set(["ID", "IsDistributionOf", "AccessServiceID"]);
3438
+ for (const key in source) {
3439
+ if (!Object.prototype.hasOwnProperty.call(source, key))
3440
+ continue;
3441
+ if (excludedKeys.has(key))
3442
+ continue;
3443
+ const value = source[key];
3444
+ if (value !== undefined) {
3445
+ this[key] = value;
3446
+ }
3447
+ }
3448
+ }
3251
3449
  toDTO() {
3252
3450
  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 });
3253
3451
  }
@@ -3259,7 +3457,7 @@ class Distribution extends _dcatClass__WEBPACK_IMPORTED_MODULE_2__["default"] {
3259
3457
  yield _super.populateFromDTO.call(this, dto);
3260
3458
  const distributionDTO = dto;
3261
3459
  distributionDTO.AccessServiceID &&
3262
- (this.AccessServiceID = (0,_core_type__WEBPACK_IMPORTED_MODULE_0__.asID)(distributionDTO.AccessServiceID));
3460
+ (this.AccessServiceID = (0,_core_type__WEBPACK_IMPORTED_MODULE_1__.asID)(distributionDTO.AccessServiceID));
3263
3461
  distributionDTO.AccessURL && (this.AccessURL = distributionDTO.AccessURL);
3264
3462
  distributionDTO.ByteSize && (this.ByteSize = distributionDTO.ByteSize);
3265
3463
  distributionDTO.CompressFormat &&
@@ -3287,7 +3485,7 @@ class Distribution extends _dcatClass__WEBPACK_IMPORTED_MODULE_2__["default"] {
3287
3485
  distributionDTO.HasPolicy && (this.HasPolicy = distributionDTO.HasPolicy);
3288
3486
  distributionDTO.Checksum && (this.Checksum = distributionDTO.Checksum);
3289
3487
  distributionDTO.IsDistributionOf &&
3290
- (this.IsDistributionOf = (0,_core_type__WEBPACK_IMPORTED_MODULE_0__.asID)(distributionDTO.IsDistributionOf));
3488
+ (this.IsDistributionOf = (0,_core_type__WEBPACK_IMPORTED_MODULE_1__.asID)(distributionDTO.IsDistributionOf));
3291
3489
  });
3292
3490
  }
3293
3491
  /**
@@ -3303,7 +3501,7 @@ class Distribution extends _dcatClass__WEBPACK_IMPORTED_MODULE_2__["default"] {
3303
3501
  Distribution.DOWNLOAD_API_URL = `${url}/data/download`;
3304
3502
  }
3305
3503
  static configureBucketName(bucketName) {
3306
- _SODAS_SDK_FILE_dataFile__WEBPACK_IMPORTED_MODULE_1__["default"].configureBucketName(bucketName);
3504
+ _SODAS_SDK_FILE_dataFile__WEBPACK_IMPORTED_MODULE_0__["default"].configureBucketName(bucketName);
3307
3505
  }
3308
3506
  /**
3309
3507
  * Sets file information for a browser environment.
@@ -3311,7 +3509,7 @@ class Distribution extends _dcatClass__WEBPACK_IMPORTED_MODULE_2__["default"] {
3311
3509
  */
3312
3510
  setUploadingDataForBrowser(file) {
3313
3511
  if (!this.UploadingData) {
3314
- this.UploadingData = new _SODAS_SDK_FILE_dataFile__WEBPACK_IMPORTED_MODULE_1__["default"]();
3512
+ this.UploadingData = new _SODAS_SDK_FILE_dataFile__WEBPACK_IMPORTED_MODULE_0__["default"]();
3315
3513
  }
3316
3514
  this.UploadingData.setFileForBrowser(file);
3317
3515
  }
@@ -3321,7 +3519,7 @@ class Distribution extends _dcatClass__WEBPACK_IMPORTED_MODULE_2__["default"] {
3321
3519
  */
3322
3520
  setUploadingDataForNode(filePath) {
3323
3521
  if (!this.UploadingData) {
3324
- this.UploadingData = new _SODAS_SDK_FILE_dataFile__WEBPACK_IMPORTED_MODULE_1__["default"]();
3522
+ this.UploadingData = new _SODAS_SDK_FILE_dataFile__WEBPACK_IMPORTED_MODULE_0__["default"]();
3325
3523
  }
3326
3524
  this.UploadingData.setFileForNode(filePath);
3327
3525
  }
@@ -3514,7 +3712,7 @@ class Distribution extends _dcatClass__WEBPACK_IMPORTED_MODULE_2__["default"] {
3514
3712
  return this.IsDistributionOf;
3515
3713
  }
3516
3714
  set isDistributionOf(value) {
3517
- this.IsDistributionOf = (0,_core_type__WEBPACK_IMPORTED_MODULE_0__.asID)(value);
3715
+ this.IsDistributionOf = (0,_core_type__WEBPACK_IMPORTED_MODULE_1__.asID)(value);
3518
3716
  }
3519
3717
  }
3520
3718
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Distribution);
@@ -3767,6 +3965,27 @@ class DCAT_MODEL extends _sodasSDKClass__WEBPACK_IMPORTED_MODULE_3__["default"]
3767
3965
  }
3768
3966
  });
3769
3967
  }
3968
+ /**
3969
+ * Checks whether a DB record exists for the given AssetID and returns its ID.
3970
+ *
3971
+ * This method wraps getDBRecordByAssetID and converts a 404 response to `null`,
3972
+ * while rethrowing any other kind of error.
3973
+ */
3974
+ static checkDBRecordOfAssetID(assetID) {
3975
+ return __awaiter(this, void 0, void 0, function* () {
3976
+ var _a;
3977
+ try {
3978
+ const record = (yield this.getDBRecordByAssetID(assetID));
3979
+ return record.id;
3980
+ }
3981
+ catch (error) {
3982
+ if (axios__WEBPACK_IMPORTED_MODULE_4__["default"].isAxiosError(error) && ((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 404) {
3983
+ return null;
3984
+ }
3985
+ throw error;
3986
+ }
3987
+ });
3988
+ }
3770
3989
  updateDBRecord() {
3771
3990
  return __awaiter(this, void 0, void 0, function* () {
3772
3991
  this.throwErrorIfAPIURLNotSet();