dragdropdo-sdk 1.0.0 → 1.0.2

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/README.md CHANGED
@@ -193,7 +193,7 @@ Create a file operation (convert, compress, merge, zip, etc.).
193
193
 
194
194
  **Parameters:**
195
195
 
196
- - `options.action` (required) - Action to perform: `'convert'`, `'compress'`, `'merge'`, `'zip'`, `'share'`, `'lock'`, `'unlock'`, `'reset_password'`
196
+ - `options.action` (required) - Action to perform: `'convert'`, `'compress'`, `'merge'`, `'zip'`, `'lock'`, `'unlock'`, `'reset_password'`
197
197
  - `options.fileKeys` (required) - Array of file keys from upload
198
198
  - `options.parameters` (optional) - Action-specific parameters
199
199
  - `options.notes` (optional) - User metadata
@@ -257,13 +257,6 @@ await client.zip(fileKeys, notes?);
257
257
  // Example: await client.zip(['file-key-1', 'file-key-2']);
258
258
  ```
259
259
 
260
- **Share:**
261
-
262
- ```typescript
263
- await client.share(fileKeys, notes?);
264
- // Example: await client.share(['file-key-123']);
265
- ```
266
-
267
260
  **Lock PDF:**
268
261
 
269
262
  ```typescript
@@ -296,7 +289,7 @@ Get the current status of an operation.
296
289
  **Parameters:**
297
290
 
298
291
  - `options.mainTaskId` (required) - Main task ID from operation creation
299
- - `options.fileTaskId` (optional) - Specific file task ID
292
+ - `options.fileKey` (optional) - Input file key for specific file status
300
293
 
301
294
  **Returns:** `Promise<StatusResponse>` with operation and file statuses
302
295
 
@@ -308,10 +301,10 @@ const status = await client.getStatus({
308
301
  mainTaskId: "task-123",
309
302
  });
310
303
 
311
- // Get specific file task status
304
+ // Get specific file status by file key
312
305
  const status = await client.getStatus({
313
306
  mainTaskId: "task-123",
314
- fileTaskId: "file-task-456",
307
+ fileKey: "file-key-456",
315
308
  });
316
309
 
317
310
  console.log("Operation status:", status.operationStatus);
@@ -334,7 +327,7 @@ Poll operation status until completion or failure.
334
327
  **Parameters:**
335
328
 
336
329
  - `options.mainTaskId` (required) - Main task ID
337
- - `options.fileTaskId` (optional) - Specific file task ID
330
+ - `options.fileKey` (optional) - Input file key for specific file status
338
331
  - `options.interval` (optional) - Polling interval in milliseconds (default: `2000`)
339
332
  - `options.timeout` (optional) - Maximum polling duration in milliseconds (default: `300000` = 5 minutes)
340
333
  - `options.onUpdate` (optional) - Callback for each status update
@@ -543,16 +536,6 @@ Create a ZIP archive from multiple files.
543
536
  await client.zip(["file-key-1", "file-key-2"]);
544
537
  ```
545
538
 
546
- ### Share
547
-
548
- Generate shareable links for files.
549
-
550
- **Example:**
551
-
552
- ```typescript
553
- await client.share(["file-key-123"]);
554
- ```
555
-
556
539
  ### Lock PDF
557
540
 
558
541
  Protect PDF with password.
@@ -137,10 +137,6 @@ export declare class Dragdropdo {
137
137
  * Create a ZIP archive from files
138
138
  */
139
139
  zip(fileKeys: string[], notes?: Record<string, string>): Promise<OperationResponse>;
140
- /**
141
- * Share files (generate shareable links)
142
- */
143
- share(fileKeys: string[], notes?: Record<string, string>): Promise<OperationResponse>;
144
140
  /**
145
141
  * Lock PDF with password
146
142
  */
@@ -166,10 +162,10 @@ export declare class Dragdropdo {
166
162
  * mainTaskId: 'task-123'
167
163
  * });
168
164
  *
169
- * // Get specific file task status
165
+ * // Get specific file status by file key
170
166
  * const status = await client.getStatus({
171
167
  * mainTaskId: 'task-123',
172
- * fileTaskId: 'file-task-456'
168
+ * fileKey: 'file-key-456'
173
169
  * });
174
170
  * ```
175
171
  */
@@ -155,7 +155,7 @@ class Dragdropdo {
155
155
  }
156
156
  try {
157
157
  // Step 1: Request presigned URLs
158
- const uploadResponse = await this.axiosInstance.post("/v1/biz/initiate-upload", {
158
+ const uploadResponse = await this.axiosInstance.post("/api/v1/initiate-upload", {
159
159
  file_name: fileName,
160
160
  size: fileSize,
161
161
  mime_type: detectedMimeType,
@@ -218,7 +218,7 @@ class Dragdropdo {
218
218
  }
219
219
  // Step 3: Complete the multipart upload
220
220
  try {
221
- await this.axiosInstance.post("/v1/biz/complete-upload", {
221
+ await this.axiosInstance.post("/api/v1/complete-upload", {
222
222
  file_key: fileKey,
223
223
  upload_id: uploadId,
224
224
  object_name: objectName,
@@ -291,7 +291,7 @@ class Dragdropdo {
291
291
  throw new errors_1.D3ValidationError("Extension (ext) is required");
292
292
  }
293
293
  try {
294
- const response = await this.axiosInstance.post("/v1/biz/supported-operation", {
294
+ const response = await this.axiosInstance.post("/api/v1/supported-operation", {
295
295
  ext: options.ext,
296
296
  action: options.action,
297
297
  parameters: options.parameters,
@@ -350,7 +350,7 @@ class Dragdropdo {
350
350
  throw new errors_1.D3ValidationError("At least one file key is required");
351
351
  }
352
352
  try {
353
- const response = await this.axiosInstance.post("/v1/biz/do", {
353
+ const response = await this.axiosInstance.post("/api/v1/do", {
354
354
  action: options.action,
355
355
  file_keys: options.fileKeys,
356
356
  parameters: options.parameters,
@@ -416,16 +416,6 @@ class Dragdropdo {
416
416
  notes,
417
417
  });
418
418
  }
419
- /**
420
- * Share files (generate shareable links)
421
- */
422
- async share(fileKeys, notes) {
423
- return this.createOperation({
424
- action: "share",
425
- fileKeys,
426
- notes,
427
- });
428
- }
429
419
  /**
430
420
  * Lock PDF with password
431
421
  */
@@ -475,10 +465,10 @@ class Dragdropdo {
475
465
  * mainTaskId: 'task-123'
476
466
  * });
477
467
  *
478
- * // Get specific file task status
468
+ * // Get specific file status by file key
479
469
  * const status = await client.getStatus({
480
470
  * mainTaskId: 'task-123',
481
- * fileTaskId: 'file-task-456'
471
+ * fileKey: 'file-key-456'
482
472
  * });
483
473
  * ```
484
474
  */
@@ -487,19 +477,20 @@ class Dragdropdo {
487
477
  throw new errors_1.D3ValidationError("mainTaskId is required");
488
478
  }
489
479
  try {
490
- let url = `/v1/biz/status/${options.mainTaskId}`;
491
- if (options.fileTaskId) {
492
- url += `/${options.fileTaskId}`;
480
+ let url = `/api/v1/status/${options.mainTaskId}`;
481
+ if (options.fileKey) {
482
+ url += `/${options.fileKey}`;
493
483
  }
494
484
  const response = await this.axiosInstance.get(url);
495
485
  const rawData = response.data.data;
496
486
  // Transform snake_case to camelCase
497
487
  const transformed = this.toCamelCase(rawData);
488
+ const rawStatus = (transformed.operationStatus || transformed.operation_status || "").toLowerCase();
498
489
  return {
499
- operationStatus: transformed.operationStatus || transformed.operation_status,
490
+ operationStatus: rawStatus,
500
491
  filesData: (transformed.filesData || transformed.files_data || []).map((file) => ({
501
492
  fileKey: file.fileKey || file.file_key,
502
- status: file.status,
493
+ status: (file.status || "").toLowerCase(),
503
494
  downloadLink: file.downloadLink || file.download_link,
504
495
  errorCode: file.errorCode || file.error_code,
505
496
  errorMessage: file.errorMessage || file.error_message,
@@ -537,7 +528,7 @@ class Dragdropdo {
537
528
  * ```
538
529
  */
539
530
  async pollStatus(options) {
540
- const { mainTaskId, fileTaskId, interval = 2000, timeout = 300000, onUpdate, } = options;
531
+ const { mainTaskId, fileKey, interval = 2000, timeout = 300000, onUpdate, } = options;
541
532
  const startTime = Date.now();
542
533
  return new Promise((resolve, reject) => {
543
534
  const poll = async () => {
@@ -548,7 +539,7 @@ class Dragdropdo {
548
539
  return;
549
540
  }
550
541
  // Get status
551
- const status = await this.getStatus({ mainTaskId, fileTaskId });
542
+ const status = await this.getStatus({ mainTaskId, fileKey });
552
543
  // Call update callback
553
544
  if (onUpdate) {
554
545
  onUpdate(status);
@@ -74,8 +74,8 @@ export interface SupportedOperationResponse {
74
74
  parameters?: Record<string, any>;
75
75
  }
76
76
  export interface OperationOptions {
77
- /** Action to perform: 'convert', 'compress', 'merge', 'zip', 'share', 'lock', 'unlock', 'reset_password' */
78
- action: "convert" | "compress" | "merge" | "zip" | "create_zip" | "share" | "lock" | "unlock" | "reset_password";
77
+ /** Action to perform: 'convert', 'compress', 'merge', 'zip', 'lock', 'unlock', 'reset_password' */
78
+ action: "convert" | "compress" | "merge" | "zip" | "create_zip" | "lock" | "unlock" | "reset_password";
79
79
  /** Array of file keys from upload */
80
80
  fileKeys: string[];
81
81
  /** Action-specific parameters */
@@ -102,8 +102,8 @@ export interface OperationResponse {
102
102
  export interface StatusOptions {
103
103
  /** Main task ID */
104
104
  mainTaskId: string;
105
- /** Optional file task ID for specific file status */
106
- fileTaskId?: string;
105
+ /** Optional input file key for specific file status */
106
+ fileKey?: string;
107
107
  }
108
108
  export interface FileTaskStatus {
109
109
  /** File key */
@@ -68,7 +68,7 @@ describe("Dragdropdo end-to-end (mocked HTTP)", () => {
68
68
  }
69
69
  };
70
70
  (0, nock_1.default)(API_BASE)
71
- .post("/v1/external/upload", (body) => {
71
+ .post("/api/v1/initiate-upload", (body) => {
72
72
  return (body.file_name === "test.pdf" &&
73
73
  body.size === 6 * 1024 * 1024 &&
74
74
  body.mime_type === "application/pdf" &&
@@ -91,7 +91,7 @@ describe("Dragdropdo end-to-end (mocked HTTP)", () => {
91
91
  .put("/part2")
92
92
  .reply(200, {}, { ETag: '"etag-part-2"' });
93
93
  (0, nock_1.default)(API_BASE)
94
- .post("/v1/external/complete-upload", (body) => {
94
+ .post("/api/v1/complete-upload", (body) => {
95
95
  return (body.file_key === "file-key-123" &&
96
96
  body.upload_id === "upload-id-456" &&
97
97
  Array.isArray(body.parts) &&
@@ -126,7 +126,7 @@ describe("Dragdropdo end-to-end (mocked HTTP)", () => {
126
126
  test("creates an operation and polls status to completion", async () => {
127
127
  const client = new src_1.Dragdropdo({ apiKey: "test-key", baseURL: API_BASE });
128
128
  (0, nock_1.default)(API_BASE)
129
- .post("/v1/external/do", {
129
+ .post("/api/v1/do", {
130
130
  action: "convert",
131
131
  file_keys: ["file-key-123"],
132
132
  parameters: { convert_to: "png" },
@@ -134,14 +134,14 @@ describe("Dragdropdo end-to-end (mocked HTTP)", () => {
134
134
  })
135
135
  .reply(200, { data: { mainTaskId: "task-123" } });
136
136
  (0, nock_1.default)(API_BASE)
137
- .get("/v1/external/status/task-123")
137
+ .get("/api/v1/status/task-123")
138
138
  .reply(200, {
139
139
  data: {
140
140
  operationStatus: "queued",
141
141
  filesData: [{ fileKey: "file-key-123", status: "queued" }],
142
142
  },
143
143
  })
144
- .get("/v1/external/status/task-123")
144
+ .get("/api/v1/status/task-123")
145
145
  .reply(200, {
146
146
  data: {
147
147
  operationStatus: "completed",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dragdropdo-sdk",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Official Node.js client library for the dragdropdo.com Business API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -19,6 +19,7 @@
19
19
  "convert",
20
20
  "compress"
21
21
  ],
22
+ "homepage": "https://dragdropdo.com",
22
23
  "author": "TrippyTech Labs LLP",
23
24
  "license": "ISC",
24
25
  "dependencies": {