@koolbase/core 12.23.0 → 12.24.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.
@@ -201,8 +201,16 @@ export declare class KoolbaseStorage {
201
201
  updateMetadata(bucket: string, path: string, metadata: Record<string, string | null>): Promise<KoolbaseObject>;
202
202
  /**
203
203
  * Get a signed download URL for a file.
204
+ *
205
+ * `options.preset` names one of the project's image presets (Storage →
206
+ * Presets): an image's current version is then given sized as the preset
207
+ * says -- a private bucket's as a signed, hour-long address -- after the
208
+ * same rules decide whether this person may see it. Anything not an image
209
+ * is given as it is.
204
210
  */
205
- getDownloadUrl(bucket: string, path: string, versionId?: string): Promise<string>;
211
+ getDownloadUrl(bucket: string, path: string, versionId?: string, options?: {
212
+ preset?: string;
213
+ }): Promise<string>;
206
214
  /**
207
215
  * The stable public CDN URL for a file in a public bucket, using the project
208
216
  * identity the SDK learned at bootstrap -- the runtime form of
@@ -527,13 +527,22 @@ class KoolbaseStorage {
527
527
  }
528
528
  /**
529
529
  * Get a signed download URL for a file.
530
+ *
531
+ * `options.preset` names one of the project's image presets (Storage →
532
+ * Presets): an image's current version is then given sized as the preset
533
+ * says -- a private bucket's as a signed, hour-long address -- after the
534
+ * same rules decide whether this person may see it. Anything not an image
535
+ * is given as it is.
530
536
  */
531
- async getDownloadUrl(bucket, path, versionId) {
537
+ async getDownloadUrl(bucket, path, versionId, options) {
532
538
  let url = `${this.config.baseUrl}/v1/sdk/storage/download-url` +
533
539
  `?bucket=${encodeURIComponent(bucket)}&path=${encodeURIComponent(path)}`;
534
540
  if (versionId) {
535
541
  url += `&version_id=${encodeURIComponent(versionId)}`;
536
542
  }
543
+ if (options?.preset) {
544
+ url += `&preset=${encodeURIComponent(options.preset)}`;
545
+ }
537
546
  const res = await (0, network_js_1.sessionFetch)(url, { headers: await this.buildHeaders() });
538
547
  if (!res.ok) {
539
548
  throw await this.error(res, 'Failed to get download URL');
@@ -201,8 +201,16 @@ export declare class KoolbaseStorage {
201
201
  updateMetadata(bucket: string, path: string, metadata: Record<string, string | null>): Promise<KoolbaseObject>;
202
202
  /**
203
203
  * Get a signed download URL for a file.
204
+ *
205
+ * `options.preset` names one of the project's image presets (Storage →
206
+ * Presets): an image's current version is then given sized as the preset
207
+ * says -- a private bucket's as a signed, hour-long address -- after the
208
+ * same rules decide whether this person may see it. Anything not an image
209
+ * is given as it is.
204
210
  */
205
- getDownloadUrl(bucket: string, path: string, versionId?: string): Promise<string>;
211
+ getDownloadUrl(bucket: string, path: string, versionId?: string, options?: {
212
+ preset?: string;
213
+ }): Promise<string>;
206
214
  /**
207
215
  * The stable public CDN URL for a file in a public bucket, using the project
208
216
  * identity the SDK learned at bootstrap -- the runtime form of
@@ -524,13 +524,22 @@ export class KoolbaseStorage {
524
524
  }
525
525
  /**
526
526
  * Get a signed download URL for a file.
527
+ *
528
+ * `options.preset` names one of the project's image presets (Storage →
529
+ * Presets): an image's current version is then given sized as the preset
530
+ * says -- a private bucket's as a signed, hour-long address -- after the
531
+ * same rules decide whether this person may see it. Anything not an image
532
+ * is given as it is.
527
533
  */
528
- async getDownloadUrl(bucket, path, versionId) {
534
+ async getDownloadUrl(bucket, path, versionId, options) {
529
535
  let url = `${this.config.baseUrl}/v1/sdk/storage/download-url` +
530
536
  `?bucket=${encodeURIComponent(bucket)}&path=${encodeURIComponent(path)}`;
531
537
  if (versionId) {
532
538
  url += `&version_id=${encodeURIComponent(versionId)}`;
533
539
  }
540
+ if (options?.preset) {
541
+ url += `&preset=${encodeURIComponent(options.preset)}`;
542
+ }
534
543
  const res = await sessionFetch(url, { headers: await this.buildHeaders() });
535
544
  if (!res.ok) {
536
545
  throw await this.error(res, 'Failed to get download URL');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koolbase/core",
3
- "version": "12.23.0",
3
+ "version": "12.24.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",