@stack0/sdk 0.5.5 → 0.5.6

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/index.mjs CHANGED
@@ -911,10 +911,25 @@ var CDN = class {
911
911
  * filename: 'image.jpg',
912
912
  * mimeType: 'image/jpeg',
913
913
  * });
914
+ *
915
+ * // With watermark
916
+ * const watermarkedAsset = await cdn.upload({
917
+ * projectSlug: 'my-project',
918
+ * file: fileBuffer,
919
+ * filename: 'photo.jpg',
920
+ * mimeType: 'image/jpeg',
921
+ * watermark: {
922
+ * assetId: 'logo-asset-id', // or url: 'https://example.com/logo.png'
923
+ * position: 'bottom-right',
924
+ * opacity: 50,
925
+ * sizingMode: 'relative',
926
+ * width: 15, // 15% of image width
927
+ * },
928
+ * });
914
929
  * ```
915
930
  */
916
931
  async upload(options) {
917
- const { projectSlug, file, filename, mimeType, folder, metadata } = options;
932
+ const { projectSlug, file, filename, mimeType, folder, metadata, watermark } = options;
918
933
  let size;
919
934
  if (file instanceof Blob) {
920
935
  size = file.size;
@@ -929,7 +944,8 @@ var CDN = class {
929
944
  mimeType,
930
945
  size,
931
946
  folder,
932
- metadata
947
+ metadata,
948
+ watermark
933
949
  });
934
950
  const uploadResponse = await fetch(uploadUrl, {
935
951
  method: "PUT",
@@ -1430,10 +1446,9 @@ var CDN = class {
1430
1446
  * ```
1431
1447
  */
1432
1448
  async getPrivateDownloadUrl(request) {
1433
- const response = await this.http.post(
1434
- `/cdn/private/${request.fileId}/download`,
1435
- { expiresIn: request.expiresIn }
1436
- );
1449
+ const response = await this.http.post(`/cdn/private/${request.fileId}/download`, {
1450
+ expiresIn: request.expiresIn
1451
+ });
1437
1452
  if (typeof response.expiresAt === "string") {
1438
1453
  response.expiresAt = new Date(response.expiresAt);
1439
1454
  }
@@ -1571,10 +1586,9 @@ var CDN = class {
1571
1586
  * ```
1572
1587
  */
1573
1588
  async getBundleDownloadUrl(request) {
1574
- const response = await this.http.post(
1575
- `/cdn/bundles/${request.bundleId}/download`,
1576
- { expiresIn: request.expiresIn }
1577
- );
1589
+ const response = await this.http.post(`/cdn/bundles/${request.bundleId}/download`, {
1590
+ expiresIn: request.expiresIn
1591
+ });
1578
1592
  if (typeof response.expiresAt === "string") {
1579
1593
  response.expiresAt = new Date(response.expiresAt);
1580
1594
  }