@oasis-path/gamma-sdk 1.0.23 → 1.0.25

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.
@@ -2,7 +2,6 @@ export interface UploadWithTokenOptions {
2
2
  file: Buffer | Blob | File | NodeJS.ReadableStream;
3
3
  filename: string;
4
4
  mimeType?: string;
5
- folderId?: string;
6
5
  token: string;
7
6
  }
8
7
  export interface UploadWithTokenResponse {
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.uploadWithToken = uploadWithToken;
4
4
  async function uploadWithToken(options, baseUrl) {
5
- const { file, filename, mimeType, folderId, token } = options;
5
+ const { file, filename, mimeType, token } = options;
6
6
  const formData = new FormData();
7
7
  // Handle different file input types
8
8
  if (typeof Buffer !== 'undefined' && file instanceof Buffer) {
@@ -17,7 +17,7 @@ async function uploadWithToken(options, baseUrl) {
17
17
  // Blob or File
18
18
  formData.append('file', file, filename);
19
19
  }
20
- const url = new URL(`/api/files/upload-presigned/${folderId || ''}`, baseUrl);
20
+ const url = new URL('/api/files/upload-presigned', baseUrl);
21
21
  url.searchParams.append('token', token);
22
22
  const response = await fetch(url.toString(), {
23
23
  method: 'POST',
@@ -41,7 +41,12 @@ async function makeTrpcRequest(method, path, baseUrl, apiKey, options) {
41
41
  }
42
42
  const contentType = response.headers.get('content-type');
43
43
  if (contentType?.includes('application/json')) {
44
- return await response.json();
44
+ const jsonResponse = await response.json();
45
+ // Unwrap nested result.data structure if present
46
+ if (jsonResponse?.result?.data) {
47
+ return jsonResponse.result.data;
48
+ }
49
+ return jsonResponse;
45
50
  }
46
51
  return response;
47
52
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oasis-path/gamma-sdk",
3
- "version": "1.0.23",
3
+ "version": "1.0.25",
4
4
  "description": "TypeScript SDK for Gamma Files API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",