@edgestore/react 0.1.5-alpha.3 → 0.1.5-alpha.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.
@@ -1 +1 @@
1
- {"version":3,"file":"createNextProxy.d.ts","sourceRoot":"","sources":["../src/createNextProxy.ts"],"names":[],"mappings":";AACA,OAAO,EACL,KAAK,SAAS,EACd,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,aAAa,EACnB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,CAAC;AAG7B;;;GAGG;AACH,MAAM,MAAM,QAAQ,CAAC,KAAK,IAAI;KAC3B,CAAC,IAAI,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC;CAE7B,GAAG,EAAE,CAAC;AAEP,MAAM,MAAM,eAAe,CAAC,OAAO,SAAS,SAAS,IAAI;KACtD,CAAC,IAAI,MAAM,OAAO,CAAC,SAAS,CAAC,GAAG;QAC/B,MAAM,EAAE,CACN,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,SAAS,KAAK,GACjE;YACE,IAAI,EAAE,IAAI,CAAC;YACX,gBAAgB,CAAC,EAAE,uBAAuB,CAAC;YAC3C,OAAO,CAAC,EAAE,aAAa,CAAC;SACzB,GACD;YACE,IAAI,EAAE,IAAI,CAAC;YACX,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;YACvD,gBAAgB,CAAC,EAAE,uBAAuB,CAAC;YAC3C,OAAO,CAAC,EAAE,aAAa,CAAC;SACzB,KACF,OAAO,CACV,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC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wBAAgB,eAAe,CAAC,OAAO,SAAS,SAAS,EAAE,EACzD,OAAO,EACP,iBAAiB,EACjB,oBAAwB,GACzB,EAAE;IACD,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,KAAK,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAClD,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,4BA6CA"}
package/dist/index.js CHANGED
@@ -3,6 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var React = require('react');
6
+ var core = require('@edgestore/server/core');
6
7
 
7
8
  function _interopNamespace(e) {
8
9
  if (e && e.__esModule) return e;
@@ -24,7 +25,7 @@ function _interopNamespace(e) {
24
25
 
25
26
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
26
27
 
27
- class EdgeStoreError extends Error {
28
+ class EdgeStoreClientError extends Error {
28
29
  constructor(message){
29
30
  super(message);
30
31
  this.name = 'EdgeStoreError';
@@ -57,7 +58,7 @@ function createNextProxy({ apiPath, uploadingCountRef, maxConcurrentUploads = 5
57
58
  apiPath
58
59
  });
59
60
  if (!success) {
60
- throw new EdgeStoreError('Failed to confirm upload');
61
+ throw new EdgeStoreClientError('Failed to confirm upload');
61
62
  }
62
63
  },
63
64
  delete: async (params)=>{
@@ -66,7 +67,7 @@ function createNextProxy({ apiPath, uploadingCountRef, maxConcurrentUploads = 5
66
67
  apiPath
67
68
  });
68
69
  if (!success) {
69
- throw new EdgeStoreError('Failed to delete file');
70
+ throw new EdgeStoreClientError('Failed to delete file');
70
71
  }
71
72
  }
72
73
  };
@@ -95,6 +96,11 @@ async function uploadFile({ file, input, onProgressChange, options }, { apiPath,
95
96
  'Content-Type': 'application/json'
96
97
  }
97
98
  });
99
+ if (!res.ok) {
100
+ throw new core.EdgeStoreApiClientError({
101
+ response: await res.json()
102
+ });
103
+ }
98
104
  const json = await res.json();
99
105
  if ('multipart' in json) {
100
106
  await multipartUpload({
@@ -109,7 +115,7 @@ async function uploadFile({ file, input, onProgressChange, options }, { apiPath,
109
115
  // Upload the file to the signed URL and get the progress
110
116
  await uploadFileInner(file, json.uploadUrl, onProgressChange);
111
117
  } else {
112
- throw new EdgeStoreError('An error occurred');
118
+ throw new EdgeStoreClientError('An error occurred');
113
119
  }
114
120
  return {
115
121
  url: getUrl(json.accessUrl, apiPath),
@@ -144,6 +150,8 @@ const uploadFileInner = async (file, uploadUrl, onProgressChange)=>{
144
150
  const promise = new Promise((resolve, reject)=>{
145
151
  const request = new XMLHttpRequest();
146
152
  request.open('PUT', uploadUrl);
153
+ // This is for Azure provider. Specifies the blob type
154
+ request.setRequestHeader('x-ms-blob-type', 'BlockBlob');
147
155
  request.addEventListener('loadstart', ()=>{
148
156
  onProgressChange?.(0);
149
157
  });
@@ -189,7 +197,7 @@ async function multipartUpload(params) {
189
197
  onProgressChange?.(totalProgress);
190
198
  });
191
199
  if (!eTag) {
192
- throw new EdgeStoreError('Could not get ETag from multipart response');
200
+ throw new EdgeStoreClientError('Could not get ETag from multipart response');
193
201
  }
194
202
  return {
195
203
  partNumber: part.partNumber,
@@ -220,7 +228,9 @@ async function multipartUpload(params) {
220
228
  }
221
229
  });
222
230
  if (!res.ok) {
223
- throw new EdgeStoreError('Multi-part upload failed');
231
+ throw new core.EdgeStoreApiClientError({
232
+ response: await res.json()
233
+ });
224
234
  }
225
235
  }
226
236
  async function confirmUpload({ url }, { apiPath, bucketName }) {
@@ -235,7 +245,9 @@ async function confirmUpload({ url }, { apiPath, bucketName }) {
235
245
  }
236
246
  });
237
247
  if (!res.ok) {
238
- throw new EdgeStoreError('An error occurred');
248
+ throw new core.EdgeStoreApiClientError({
249
+ response: await res.json()
250
+ });
239
251
  }
240
252
  return res.json();
241
253
  }
@@ -251,7 +263,9 @@ async function deleteFile({ url }, { apiPath, bucketName }) {
251
263
  }
252
264
  });
253
265
  if (!res.ok) {
254
- throw new EdgeStoreError('An error occurred');
266
+ throw new core.EdgeStoreApiClientError({
267
+ response: await res.json()
268
+ });
255
269
  }
256
270
  return res.json();
257
271
  }
package/dist/index.mjs CHANGED
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
+ import { EdgeStoreApiClientError } from '@edgestore/server/core';
2
3
 
3
- class EdgeStoreError extends Error {
4
+ class EdgeStoreClientError extends Error {
4
5
  constructor(message){
5
6
  super(message);
6
7
  this.name = 'EdgeStoreError';
@@ -33,7 +34,7 @@ function createNextProxy({ apiPath, uploadingCountRef, maxConcurrentUploads = 5
33
34
  apiPath
34
35
  });
35
36
  if (!success) {
36
- throw new EdgeStoreError('Failed to confirm upload');
37
+ throw new EdgeStoreClientError('Failed to confirm upload');
37
38
  }
38
39
  },
39
40
  delete: async (params)=>{
@@ -42,7 +43,7 @@ function createNextProxy({ apiPath, uploadingCountRef, maxConcurrentUploads = 5
42
43
  apiPath
43
44
  });
44
45
  if (!success) {
45
- throw new EdgeStoreError('Failed to delete file');
46
+ throw new EdgeStoreClientError('Failed to delete file');
46
47
  }
47
48
  }
48
49
  };
@@ -71,6 +72,11 @@ async function uploadFile({ file, input, onProgressChange, options }, { apiPath,
71
72
  'Content-Type': 'application/json'
72
73
  }
73
74
  });
75
+ if (!res.ok) {
76
+ throw new EdgeStoreApiClientError({
77
+ response: await res.json()
78
+ });
79
+ }
74
80
  const json = await res.json();
75
81
  if ('multipart' in json) {
76
82
  await multipartUpload({
@@ -85,7 +91,7 @@ async function uploadFile({ file, input, onProgressChange, options }, { apiPath,
85
91
  // Upload the file to the signed URL and get the progress
86
92
  await uploadFileInner(file, json.uploadUrl, onProgressChange);
87
93
  } else {
88
- throw new EdgeStoreError('An error occurred');
94
+ throw new EdgeStoreClientError('An error occurred');
89
95
  }
90
96
  return {
91
97
  url: getUrl(json.accessUrl, apiPath),
@@ -120,6 +126,8 @@ const uploadFileInner = async (file, uploadUrl, onProgressChange)=>{
120
126
  const promise = new Promise((resolve, reject)=>{
121
127
  const request = new XMLHttpRequest();
122
128
  request.open('PUT', uploadUrl);
129
+ // This is for Azure provider. Specifies the blob type
130
+ request.setRequestHeader('x-ms-blob-type', 'BlockBlob');
123
131
  request.addEventListener('loadstart', ()=>{
124
132
  onProgressChange?.(0);
125
133
  });
@@ -165,7 +173,7 @@ async function multipartUpload(params) {
165
173
  onProgressChange?.(totalProgress);
166
174
  });
167
175
  if (!eTag) {
168
- throw new EdgeStoreError('Could not get ETag from multipart response');
176
+ throw new EdgeStoreClientError('Could not get ETag from multipart response');
169
177
  }
170
178
  return {
171
179
  partNumber: part.partNumber,
@@ -196,7 +204,9 @@ async function multipartUpload(params) {
196
204
  }
197
205
  });
198
206
  if (!res.ok) {
199
- throw new EdgeStoreError('Multi-part upload failed');
207
+ throw new EdgeStoreApiClientError({
208
+ response: await res.json()
209
+ });
200
210
  }
201
211
  }
202
212
  async function confirmUpload({ url }, { apiPath, bucketName }) {
@@ -211,7 +221,9 @@ async function confirmUpload({ url }, { apiPath, bucketName }) {
211
221
  }
212
222
  });
213
223
  if (!res.ok) {
214
- throw new EdgeStoreError('An error occurred');
224
+ throw new EdgeStoreApiClientError({
225
+ response: await res.json()
226
+ });
215
227
  }
216
228
  return res.json();
217
229
  }
@@ -227,7 +239,9 @@ async function deleteFile({ url }, { apiPath, bucketName }) {
227
239
  }
228
240
  });
229
241
  if (!res.ok) {
230
- throw new EdgeStoreError('An error occurred');
242
+ throw new EdgeStoreApiClientError({
243
+ response: await res.json()
244
+ });
231
245
  }
232
246
  return res.json();
233
247
  }
@@ -1,5 +1,5 @@
1
- declare class EdgeStoreError extends Error {
1
+ declare class EdgeStoreClientError extends Error {
2
2
  constructor(message: string);
3
3
  }
4
- export default EdgeStoreError;
4
+ export default EdgeStoreClientError;
5
5
  //# sourceMappingURL=EdgeStoreError.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"EdgeStoreError.d.ts","sourceRoot":"","sources":["../../../src/libs/errors/EdgeStoreError.ts"],"names":[],"mappings":"AAAA,cAAM,cAAe,SAAQ,KAAK;gBACpB,OAAO,EAAE,MAAM;CAI5B;AAED,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"EdgeStoreError.d.ts","sourceRoot":"","sources":["../../../src/libs/errors/EdgeStoreError.ts"],"names":[],"mappings":"AAAA,cAAM,oBAAqB,SAAQ,KAAK;gBAC1B,OAAO,EAAE,MAAM;CAI5B;AAED,eAAe,oBAAoB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edgestore/react",
3
- "version": "0.1.5-alpha.3",
3
+ "version": "0.1.5-alpha.5",
4
4
  "description": "Upload files with ease from React/Next.js",
5
5
  "homepage": "https://edgestore.dev",
6
6
  "repository": "https://github.com/edgestorejs/edgestore.git",
@@ -60,14 +60,14 @@
60
60
  "uuid": "^9.0.0"
61
61
  },
62
62
  "peerDependencies": {
63
- "@edgestore/server": "0.1.5-alpha.3",
63
+ "@edgestore/server": "0.1.5-alpha.5",
64
64
  "next": "*",
65
65
  "react": ">=16.8.0",
66
66
  "react-dom": ">=16.8.0",
67
67
  "zod": ">=3.0.0"
68
68
  },
69
69
  "devDependencies": {
70
- "@edgestore/server": "0.1.5-alpha.3",
70
+ "@edgestore/server": "0.1.5-alpha.5",
71
71
  "@types/cookie": "^0.5.1",
72
72
  "@types/node": "^18.11.18",
73
73
  "@types/uuid": "^9.0.1",
@@ -77,5 +77,5 @@
77
77
  "typescript": "^5.1.6",
78
78
  "zod": "^3.21.4"
79
79
  },
80
- "gitHead": "ca121ee10a9cba4b397412588b4a447e800d4789"
80
+ "gitHead": "eb9944bf86d040a4bcbe8753cb428be5cf3e0cf7"
81
81
  }
@@ -1,12 +1,13 @@
1
1
  import { type RequestUploadRes } from '@edgestore/server/adapters';
2
2
  import {
3
+ EdgeStoreApiClientError,
3
4
  type AnyRouter,
4
5
  type InferBucketPathObject,
5
6
  type InferMetadataObject,
6
7
  type UploadOptions,
7
8
  } from '@edgestore/server/core';
8
9
  import { type z } from 'zod';
9
- import EdgeStoreError from './libs/errors/EdgeStoreError';
10
+ import EdgeStoreClientError from './libs/errors/EdgeStoreError';
10
11
 
11
12
  /**
12
13
  * @internal
@@ -100,7 +101,7 @@ export function createNextProxy<TRouter extends AnyRouter>({
100
101
  apiPath,
101
102
  });
102
103
  if (!success) {
103
- throw new EdgeStoreError('Failed to confirm upload');
104
+ throw new EdgeStoreClientError('Failed to confirm upload');
104
105
  }
105
106
  },
106
107
  delete: async (params: { url: string }) => {
@@ -109,7 +110,7 @@ export function createNextProxy<TRouter extends AnyRouter>({
109
110
  apiPath,
110
111
  });
111
112
  if (!success) {
112
- throw new EdgeStoreError('Failed to delete file');
113
+ throw new EdgeStoreClientError('Failed to delete file');
113
114
  }
114
115
  },
115
116
  };
@@ -158,6 +159,11 @@ async function uploadFile(
158
159
  'Content-Type': 'application/json',
159
160
  },
160
161
  });
162
+ if (!res.ok) {
163
+ throw new EdgeStoreApiClientError({
164
+ response: await res.json(),
165
+ });
166
+ }
161
167
  const json = (await res.json()) as RequestUploadRes;
162
168
  if ('multipart' in json) {
163
169
  await multipartUpload({
@@ -172,7 +178,7 @@ async function uploadFile(
172
178
  // Upload the file to the signed URL and get the progress
173
179
  await uploadFileInner(file, json.uploadUrl, onProgressChange);
174
180
  } else {
175
- throw new EdgeStoreError('An error occurred');
181
+ throw new EdgeStoreClientError('An error occurred');
176
182
  }
177
183
  return {
178
184
  url: getUrl(json.accessUrl, apiPath),
@@ -216,6 +222,8 @@ const uploadFileInner = async (
216
222
  const promise = new Promise<string | null>((resolve, reject) => {
217
223
  const request = new XMLHttpRequest();
218
224
  request.open('PUT', uploadUrl);
225
+ // This is for Azure provider. Specifies the blob type
226
+ request.setRequestHeader('x-ms-blob-type', 'BlockBlob');
219
227
  request.addEventListener('loadstart', () => {
220
228
  onProgressChange?.(0);
221
229
  });
@@ -281,7 +289,9 @@ async function multipartUpload(params: {
281
289
  onProgressChange?.(totalProgress);
282
290
  });
283
291
  if (!eTag) {
284
- throw new EdgeStoreError('Could not get ETag from multipart response');
292
+ throw new EdgeStoreClientError(
293
+ 'Could not get ETag from multipart response',
294
+ );
285
295
  }
286
296
  return {
287
297
  partNumber: part.partNumber,
@@ -317,7 +327,9 @@ async function multipartUpload(params: {
317
327
  },
318
328
  });
319
329
  if (!res.ok) {
320
- throw new EdgeStoreError('Multi-part upload failed');
330
+ throw new EdgeStoreApiClientError({
331
+ response: await res.json(),
332
+ });
321
333
  }
322
334
  }
323
335
 
@@ -346,7 +358,9 @@ async function confirmUpload(
346
358
  },
347
359
  });
348
360
  if (!res.ok) {
349
- throw new EdgeStoreError('An error occurred');
361
+ throw new EdgeStoreApiClientError({
362
+ response: await res.json(),
363
+ });
350
364
  }
351
365
  return res.json();
352
366
  }
@@ -376,7 +390,9 @@ async function deleteFile(
376
390
  },
377
391
  });
378
392
  if (!res.ok) {
379
- throw new EdgeStoreError('An error occurred');
393
+ throw new EdgeStoreApiClientError({
394
+ response: await res.json(),
395
+ });
380
396
  }
381
397
  return res.json();
382
398
  }
@@ -1,8 +1,8 @@
1
- class EdgeStoreError extends Error {
1
+ class EdgeStoreClientError extends Error {
2
2
  constructor(message: string) {
3
3
  super(message);
4
4
  this.name = 'EdgeStoreError';
5
5
  }
6
6
  }
7
7
 
8
- export default EdgeStoreError;
8
+ export default EdgeStoreClientError;