@pixeyedev/storybook 0.4.3 → 0.4.5

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.
Files changed (2) hide show
  1. package/dist/upload.js +18 -9
  2. package/package.json +1 -1
package/dist/upload.js CHANGED
@@ -1,4 +1,4 @@
1
- import { PixeyeError } from '@pixeyedev/core';
1
+ import { isRetryableHttpError, maskPresignedUrl, PixeyeError, withRetry } from '@pixeyedev/core';
2
2
  import { StorybookFinalizeResponseSchema, StorybookUploadResponseSchema } from '@pixeyedev/shared';
3
3
  /**
4
4
  * Upload a Storybook bundle to Pixeye for server-side rendering.
@@ -36,15 +36,24 @@ export const uploadBundle = async (opts) => {
36
36
  const skipped = uploadData.bundleExists;
37
37
  // Step 2: Upload bundle to presigned URL (skip if already exists)
38
38
  if (!skipped) {
39
- const putRes = await fetch(uploadData.presignedUrl, {
40
- method: 'PUT',
41
- body: new Uint8Array(opts.buffer),
42
- headers: { 'Content-Type': 'application/gzip' }
39
+ const maskedUrl = maskPresignedUrl(uploadData.presignedUrl);
40
+ await withRetry(async () => {
41
+ const putRes = await fetch(uploadData.presignedUrl, {
42
+ method: 'PUT',
43
+ body: new Uint8Array(opts.buffer),
44
+ headers: { 'Content-Type': 'application/gzip' }
45
+ });
46
+ if (!putRes.ok) {
47
+ const text = await putRes.text();
48
+ throw new PixeyeError(putRes.status, maskedUrl, text);
49
+ }
50
+ }, isRetryableHttpError, {
51
+ maxAttempts: 3,
52
+ baseDelayMs: 1000,
53
+ onRetry: (attempt, err) => {
54
+ console.warn(`[pixeye] Bundle upload retry ${attempt}/3: ${err.message}`);
55
+ }
43
56
  });
44
- if (!putRes.ok) {
45
- const text = await putRes.text();
46
- throw new PixeyeError(putRes.status, 'presigned-put', text);
47
- }
48
57
  }
49
58
  // Step 3: Finalize — creates build + pipeline, enqueues render job
50
59
  const finalizeRes = await fetch(`${baseUrl}/api/v1/storybook/uploads/${uploadData.uploadId}/finalize`, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pixeyedev/storybook",
3
- "version": "0.4.3",
3
+ "version": "0.4.5",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "files": [