@koolbase/core 12.21.0 → 12.23.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.
@@ -258,6 +258,22 @@ export declare class KoolbaseStorageFileInUseError extends KoolbaseStorageError
258
258
  export declare class KoolbaseStorageNameHasHistoryError extends KoolbaseStorageError {
259
259
  constructor(message?: string);
260
260
  }
261
+ /**
262
+ * An upload refused because malware was found in it (storage S6). Nothing of
263
+ * it was kept; the message names what was found. Trying again with the same
264
+ * file will be refused again. Code: `malware_found`.
265
+ */
266
+ export declare class KoolbaseStorageMalwareError extends KoolbaseStorageError {
267
+ constructor(message?: string);
268
+ }
269
+ /**
270
+ * A file found to contain malware after it was stored (storage S6): it is
271
+ * quarantined, and no link to it is given. The server answers 423. Code:
272
+ * `quarantined`.
273
+ */
274
+ export declare class KoolbaseStorageQuarantinedError extends KoolbaseStorageError {
275
+ constructor(message?: string);
276
+ }
261
277
  /**
262
278
  * Maps a non-2xx storage-layer response to a typed
263
279
  * {@link KoolbaseStorageError}, preferring the server's stable `code` and
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.KoolbaseStorageNameHasHistoryError = exports.KoolbaseStorageFileInUseError = exports.KoolbaseDownloadCancelledError = exports.KoolbaseUploadIncompleteError = exports.KoolbaseStorageSignInRequiredError = exports.KoolbaseStorageInvalidCursorError = exports.KoolbaseStorageBusyError = exports.KoolbaseUploadNotFoundError = exports.KoolbaseUploadCancelledError = exports.KoolbaseStorageMetadataInvalidError = exports.KoolbaseStorageMimeTypeError = exports.KoolbaseStorageFileTooLargeError = exports.KoolbaseStorageQuotaError = exports.KoolbaseCapBelowUsageError = exports.KoolbaseUploadExpiredError = exports.KoolbaseUploadURLFailedError = exports.KoolbaseStoragePermissionError = exports.KoolbaseStorageValidationError = exports.KoolbaseStorageNotFoundError = exports.KoolbaseStorageConflictError = exports.KoolbaseStorageProjectIdentityError = exports.KoolbaseStorageError = void 0;
3
+ exports.KoolbaseStorageQuarantinedError = exports.KoolbaseStorageMalwareError = exports.KoolbaseStorageNameHasHistoryError = exports.KoolbaseStorageFileInUseError = exports.KoolbaseDownloadCancelledError = exports.KoolbaseUploadIncompleteError = exports.KoolbaseStorageSignInRequiredError = exports.KoolbaseStorageInvalidCursorError = exports.KoolbaseStorageBusyError = exports.KoolbaseUploadNotFoundError = exports.KoolbaseUploadCancelledError = exports.KoolbaseStorageMetadataInvalidError = exports.KoolbaseStorageMimeTypeError = exports.KoolbaseStorageFileTooLargeError = exports.KoolbaseStorageQuotaError = exports.KoolbaseCapBelowUsageError = exports.KoolbaseUploadExpiredError = exports.KoolbaseUploadURLFailedError = exports.KoolbaseStoragePermissionError = exports.KoolbaseStorageValidationError = exports.KoolbaseStorageNotFoundError = exports.KoolbaseStorageConflictError = exports.KoolbaseStorageProjectIdentityError = exports.KoolbaseStorageError = void 0;
4
4
  exports.koolbaseStorageError = koolbaseStorageError;
5
5
  exports.koolbaseStorageErrorFromResponse = koolbaseStorageErrorFromResponse;
6
6
  const errors_js_1 = require("./errors.js");
@@ -368,6 +368,32 @@ class KoolbaseStorageNameHasHistoryError extends KoolbaseStorageError {
368
368
  }
369
369
  }
370
370
  exports.KoolbaseStorageNameHasHistoryError = KoolbaseStorageNameHasHistoryError;
371
+ /**
372
+ * An upload refused because malware was found in it (storage S6). Nothing of
373
+ * it was kept; the message names what was found. Trying again with the same
374
+ * file will be refused again. Code: `malware_found`.
375
+ */
376
+ class KoolbaseStorageMalwareError extends KoolbaseStorageError {
377
+ constructor(message) {
378
+ super(message ?? 'This file contains malware and was not uploaded', 'malware_found');
379
+ this.name = 'KoolbaseStorageMalwareError';
380
+ Object.setPrototypeOf(this, KoolbaseStorageMalwareError.prototype);
381
+ }
382
+ }
383
+ exports.KoolbaseStorageMalwareError = KoolbaseStorageMalwareError;
384
+ /**
385
+ * A file found to contain malware after it was stored (storage S6): it is
386
+ * quarantined, and no link to it is given. The server answers 423. Code:
387
+ * `quarantined`.
388
+ */
389
+ class KoolbaseStorageQuarantinedError extends KoolbaseStorageError {
390
+ constructor(message) {
391
+ super(message ?? 'This file is quarantined: malware was found in it', 'quarantined');
392
+ this.name = 'KoolbaseStorageQuarantinedError';
393
+ Object.setPrototypeOf(this, KoolbaseStorageQuarantinedError.prototype);
394
+ }
395
+ }
396
+ exports.KoolbaseStorageQuarantinedError = KoolbaseStorageQuarantinedError;
371
397
  /**
372
398
  * Maps a non-2xx storage-layer response to a typed
373
399
  * {@link KoolbaseStorageError}, preferring the server's stable `code` and
@@ -421,6 +447,10 @@ function koolbaseStorageError(status, body, fallbackMessage = 'Storage request f
421
447
  }
422
448
  case 'name_has_history':
423
449
  return new KoolbaseStorageNameHasHistoryError(message);
450
+ case 'malware_found':
451
+ return new KoolbaseStorageMalwareError(message);
452
+ case 'quarantined':
453
+ return new KoolbaseStorageQuarantinedError(message);
424
454
  case 'upload_incomplete': {
425
455
  const d = (body?.details ?? {});
426
456
  return new KoolbaseUploadIncompleteError(message, Array.isArray(d.missing) ? d.missing : []);
@@ -434,6 +464,8 @@ function koolbaseStorageError(status, body, fallbackMessage = 'Storage request f
434
464
  return new KoolbaseStorageFileTooLargeError(message);
435
465
  case 415:
436
466
  return new KoolbaseStorageMimeTypeError(message);
467
+ case 423:
468
+ return new KoolbaseStorageQuarantinedError(message);
437
469
  case 404:
438
470
  return new KoolbaseStorageNotFoundError(message);
439
471
  case 401:
@@ -216,6 +216,7 @@ export declare class KoolbaseStorage {
216
216
  bucket: string;
217
217
  path: string;
218
218
  transform?: KoolbaseImageTransform;
219
+ preset?: string;
219
220
  }): string;
220
221
  /**
221
222
  * Build the stable public CDN URL for a file in a public bucket.
@@ -556,6 +556,9 @@ class KoolbaseStorage {
556
556
  this.nudgeBootstrap?.();
557
557
  throw new storage_errors_js_1.KoolbaseStorageProjectIdentityError();
558
558
  }
559
+ // A named preset (Storage → Presets): the edge sizes it; no transform.
560
+ if (args.preset)
561
+ return KoolbaseStorage.publicUrlWithPreset({ projectId: pid, presetName: args.preset, bucket: args.bucket, path: args.path });
559
562
  return KoolbaseStorage.publicUrl({ projectId: pid, bucket: args.bucket, path: args.path, transform: args.transform });
560
563
  }
561
564
  /**
@@ -258,6 +258,22 @@ export declare class KoolbaseStorageFileInUseError extends KoolbaseStorageError
258
258
  export declare class KoolbaseStorageNameHasHistoryError extends KoolbaseStorageError {
259
259
  constructor(message?: string);
260
260
  }
261
+ /**
262
+ * An upload refused because malware was found in it (storage S6). Nothing of
263
+ * it was kept; the message names what was found. Trying again with the same
264
+ * file will be refused again. Code: `malware_found`.
265
+ */
266
+ export declare class KoolbaseStorageMalwareError extends KoolbaseStorageError {
267
+ constructor(message?: string);
268
+ }
269
+ /**
270
+ * A file found to contain malware after it was stored (storage S6): it is
271
+ * quarantined, and no link to it is given. The server answers 423. Code:
272
+ * `quarantined`.
273
+ */
274
+ export declare class KoolbaseStorageQuarantinedError extends KoolbaseStorageError {
275
+ constructor(message?: string);
276
+ }
261
277
  /**
262
278
  * Maps a non-2xx storage-layer response to a typed
263
279
  * {@link KoolbaseStorageError}, preferring the server's stable `code` and
@@ -341,6 +341,30 @@ export class KoolbaseStorageNameHasHistoryError extends KoolbaseStorageError {
341
341
  Object.setPrototypeOf(this, KoolbaseStorageNameHasHistoryError.prototype);
342
342
  }
343
343
  }
344
+ /**
345
+ * An upload refused because malware was found in it (storage S6). Nothing of
346
+ * it was kept; the message names what was found. Trying again with the same
347
+ * file will be refused again. Code: `malware_found`.
348
+ */
349
+ export class KoolbaseStorageMalwareError extends KoolbaseStorageError {
350
+ constructor(message) {
351
+ super(message ?? 'This file contains malware and was not uploaded', 'malware_found');
352
+ this.name = 'KoolbaseStorageMalwareError';
353
+ Object.setPrototypeOf(this, KoolbaseStorageMalwareError.prototype);
354
+ }
355
+ }
356
+ /**
357
+ * A file found to contain malware after it was stored (storage S6): it is
358
+ * quarantined, and no link to it is given. The server answers 423. Code:
359
+ * `quarantined`.
360
+ */
361
+ export class KoolbaseStorageQuarantinedError extends KoolbaseStorageError {
362
+ constructor(message) {
363
+ super(message ?? 'This file is quarantined: malware was found in it', 'quarantined');
364
+ this.name = 'KoolbaseStorageQuarantinedError';
365
+ Object.setPrototypeOf(this, KoolbaseStorageQuarantinedError.prototype);
366
+ }
367
+ }
344
368
  /**
345
369
  * Maps a non-2xx storage-layer response to a typed
346
370
  * {@link KoolbaseStorageError}, preferring the server's stable `code` and
@@ -394,6 +418,10 @@ export function koolbaseStorageError(status, body, fallbackMessage = 'Storage re
394
418
  }
395
419
  case 'name_has_history':
396
420
  return new KoolbaseStorageNameHasHistoryError(message);
421
+ case 'malware_found':
422
+ return new KoolbaseStorageMalwareError(message);
423
+ case 'quarantined':
424
+ return new KoolbaseStorageQuarantinedError(message);
397
425
  case 'upload_incomplete': {
398
426
  const d = (body?.details ?? {});
399
427
  return new KoolbaseUploadIncompleteError(message, Array.isArray(d.missing) ? d.missing : []);
@@ -407,6 +435,8 @@ export function koolbaseStorageError(status, body, fallbackMessage = 'Storage re
407
435
  return new KoolbaseStorageFileTooLargeError(message);
408
436
  case 415:
409
437
  return new KoolbaseStorageMimeTypeError(message);
438
+ case 423:
439
+ return new KoolbaseStorageQuarantinedError(message);
410
440
  case 404:
411
441
  return new KoolbaseStorageNotFoundError(message);
412
442
  case 401:
@@ -216,6 +216,7 @@ export declare class KoolbaseStorage {
216
216
  bucket: string;
217
217
  path: string;
218
218
  transform?: KoolbaseImageTransform;
219
+ preset?: string;
219
220
  }): string;
220
221
  /**
221
222
  * Build the stable public CDN URL for a file in a public bucket.
@@ -553,6 +553,9 @@ export class KoolbaseStorage {
553
553
  this.nudgeBootstrap?.();
554
554
  throw new KoolbaseStorageProjectIdentityError();
555
555
  }
556
+ // A named preset (Storage → Presets): the edge sizes it; no transform.
557
+ if (args.preset)
558
+ return KoolbaseStorage.publicUrlWithPreset({ projectId: pid, presetName: args.preset, bucket: args.bucket, path: args.path });
556
559
  return KoolbaseStorage.publicUrl({ projectId: pid, bucket: args.bucket, path: args.path, transform: args.transform });
557
560
  }
558
561
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koolbase/core",
3
- "version": "12.21.0",
3
+ "version": "12.23.0",
4
4
  "description": "Koolbase SDK core \u2014 shared behaviour behind @koolbase/react-native and @koolbase/js. Install one of those, not this.",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "types": "./dist/esm/index.d.ts",