hcloud-sdk 22.8.0 → 22.9.0

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/changelog.md CHANGED
@@ -1,5 +1,5 @@
1
- ## [22.8.0](https://github.com/moovit-sp-gmbh/hcloud-sdk-js/compare/v22.7.0...v22.8.0) (2026-07-29)
1
+ ## [22.9.0](https://github.com/moovit-sp-gmbh/hcloud-sdk-js/compare/v22.8.0...v22.9.0) (2026-07-30)
2
2
 
3
3
  ### Features
4
4
 
5
- * add method to reconnect to nats ([c200268](https://github.com/moovit-sp-gmbh/hcloud-sdk-js/commit/c200268fcb6660e5da21cacf1930e055c24940e0))
5
+ * implement bulk delete assets by filter functionality ([bc269d8](https://github.com/moovit-sp-gmbh/hcloud-sdk-js/commit/bc269d8105f55d14134b928309facfb616bff1bd))
@@ -226,6 +226,28 @@ export interface AssetFilter {
226
226
  value: string;
227
227
  comparator: (typeof searchParams)[this["key"]]["comparators"][number];
228
228
  }
229
+ export declare enum AssetBulkDeleteMode {
230
+ TRASHBIN = "TRASHBIN",
231
+ PERMANENT = "PERMANENT"
232
+ }
233
+ export interface AssetBulkDeleteByFilterDto {
234
+ /**
235
+ * Filters to select the assets to delete. Reuses the asset search filter type.
236
+ * Must contain at least one filter. All filters must match (AND). To match one
237
+ * of several values for the same field, pass an array as that filter's value.
238
+ */
239
+ filters: [AssetFilter, ...AssetFilter[]];
240
+ /**
241
+ * TRASHBIN (default) moves matching assets to the space's trash bin,
242
+ * PERMANENT deletes them non-recoverably.
243
+ */
244
+ mode?: AssetBulkDeleteMode;
245
+ }
246
+ export interface AssetBulkDeleteResultDto {
247
+ mode: AssetBulkDeleteMode;
248
+ count: number;
249
+ assetIds: string[];
250
+ }
229
251
  export declare enum AssetSearchContext {
230
252
  ORGANIZATION = "ORGANIZATION",
231
253
  TRASH = "TRASH",
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SubscriptionFilter = exports.AssetSearchContext = exports.searchParams = exports.supportedFormats = exports.Resolution = exports.MetadataType = exports.MediaType = exports.AssetPermission = exports.UploadStatus = exports.ItemType = exports.AssetType = void 0;
3
+ exports.SubscriptionFilter = exports.AssetSearchContext = exports.AssetBulkDeleteMode = exports.searchParams = exports.supportedFormats = exports.Resolution = exports.MetadataType = exports.MediaType = exports.AssetPermission = exports.UploadStatus = exports.ItemType = exports.AssetType = void 0;
4
4
  const SearchFilters_1 = require("../../global/SearchFilters");
5
5
  var AssetType;
6
6
  (function (AssetType) {
@@ -77,6 +77,11 @@ exports.searchParams = {
77
77
  comparators: [SearchFilters_1.SearchFilterComparatorString.IS, SearchFilters_1.SearchFilterComparatorString.IS_NOT, SearchFilters_1.SearchFilterComparatorString.CONTAINS],
78
78
  },
79
79
  };
80
+ var AssetBulkDeleteMode;
81
+ (function (AssetBulkDeleteMode) {
82
+ AssetBulkDeleteMode["TRASHBIN"] = "TRASHBIN";
83
+ AssetBulkDeleteMode["PERMANENT"] = "PERMANENT";
84
+ })(AssetBulkDeleteMode || (exports.AssetBulkDeleteMode = AssetBulkDeleteMode = {}));
80
85
  var AssetSearchContext;
81
86
  (function (AssetSearchContext) {
82
87
  AssetSearchContext["ORGANIZATION"] = "ORGANIZATION";
@@ -1,6 +1,6 @@
1
1
  import Base, { MaybeRaw } from "../../../Base";
2
2
  import { AuditLog } from "../../../interfaces/auditor";
3
- import { Asset, AssetPermission, AudioWaveformItem, CreateAsset, Mentionable, PatchAsset, Resolution, SubscriptionFilter, Upload, VTTThumbnail } from "../../../interfaces/cosmo/asset";
3
+ import { Asset, AssetBulkDeleteByFilterDto, AssetBulkDeleteResultDto, AssetPermission, AudioWaveformItem, CreateAsset, Mentionable, PatchAsset, Resolution, SubscriptionFilter, Upload, VTTThumbnail } from "../../../interfaces/cosmo/asset";
4
4
  import { StorageConfiguration } from "../../../interfaces/global/Storage";
5
5
  /**
6
6
  * @class Asset
@@ -97,6 +97,23 @@ export declare class CosmoAsset extends Base {
97
97
  deleteAssets<R extends boolean = false>(orgName: string, spaceName: string, assetIds: string[], force?: boolean, raw?: {
98
98
  raw: R;
99
99
  }): Promise<MaybeRaw<R, void>>;
100
+ /**
101
+ * Bulk-delete assets matching a filter.
102
+ * @remarks
103
+ * ** Under development, breaking changes possible**
104
+ *
105
+ * All filters must match for an asset to be deleted (AND combination). Folders are never deleted,
106
+ * assets already in the trash bin are ignored, and stacks are deleted as a whole (all versions).
107
+ * A filter matching no assets is not an error: it returns count 0 and an empty assetIds array.
108
+ * @param orgName Name of the Organization
109
+ * @param spaceName Name of the Space
110
+ * @param body Filters selecting the assets to delete and the delete mode (defaults to TRASHBIN)
111
+ * @param namespace Optional Namespaces to scope the filter to
112
+ * @returns The applied mode, the number of deleted assets and their IDs
113
+ */
114
+ bulkDeleteAssetsByFilter<R extends boolean = false>(orgName: string, spaceName: string, body: AssetBulkDeleteByFilterDto, namespace?: string | string[], raw?: {
115
+ raw: R;
116
+ }): Promise<MaybeRaw<R, AssetBulkDeleteResultDto>>;
100
117
  /**
101
118
  * Request download URLs for multiple assets.
102
119
  * @remarks
@@ -139,6 +139,29 @@ class CosmoAsset extends Base_1.default {
139
139
  return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : undefined);
140
140
  });
141
141
  }
142
+ /**
143
+ * Bulk-delete assets matching a filter.
144
+ * @remarks
145
+ * ** Under development, breaking changes possible**
146
+ *
147
+ * All filters must match for an asset to be deleted (AND combination). Folders are never deleted,
148
+ * assets already in the trash bin are ignored, and stacks are deleted as a whole (all versions).
149
+ * A filter matching no assets is not an error: it returns count 0 and an empty assetIds array.
150
+ * @param orgName Name of the Organization
151
+ * @param spaceName Name of the Space
152
+ * @param body Filters selecting the assets to delete and the delete mode (defaults to TRASHBIN)
153
+ * @param namespace Optional Namespaces to scope the filter to
154
+ * @returns The applied mode, the number of deleted assets and their IDs
155
+ */
156
+ bulkDeleteAssetsByFilter(orgName, spaceName, body, namespace, raw) {
157
+ return __awaiter(this, void 0, void 0, function* () {
158
+ const resp = yield this.axios.delete(this.getEndpoint(`/v1/org/${orgName}/spaces/${spaceName}/assets/bulk-delete`), {
159
+ data: body,
160
+ params: { namespace },
161
+ });
162
+ return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
163
+ });
164
+ }
142
165
  /**
143
166
  * Request download URLs for multiple assets.
144
167
  * @remarks
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hcloud-sdk",
3
- "version": "22.8.0",
3
+ "version": "22.9.0",
4
4
  "description": "hcloud platform sdk",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",