dragdropdo-sdk 1.0.1 → 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 +5 -22
- package/dist/src/client.d.ts +2 -6
- package/dist/src/client.js +6 -16
- package/dist/src/types.d.ts +4 -4
- package/package.json +1 -1
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'`, `'
|
|
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.
|
|
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
|
|
304
|
+
// Get specific file status by file key
|
|
312
305
|
const status = await client.getStatus({
|
|
313
306
|
mainTaskId: "task-123",
|
|
314
|
-
|
|
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.
|
|
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.
|
package/dist/src/client.d.ts
CHANGED
|
@@ -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
|
|
165
|
+
* // Get specific file status by file key
|
|
170
166
|
* const status = await client.getStatus({
|
|
171
167
|
* mainTaskId: 'task-123',
|
|
172
|
-
*
|
|
168
|
+
* fileKey: 'file-key-456'
|
|
173
169
|
* });
|
|
174
170
|
* ```
|
|
175
171
|
*/
|
package/dist/src/client.js
CHANGED
|
@@ -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
|
|
468
|
+
* // Get specific file status by file key
|
|
479
469
|
* const status = await client.getStatus({
|
|
480
470
|
* mainTaskId: 'task-123',
|
|
481
|
-
*
|
|
471
|
+
* fileKey: 'file-key-456'
|
|
482
472
|
* });
|
|
483
473
|
* ```
|
|
484
474
|
*/
|
|
@@ -488,8 +478,8 @@ class Dragdropdo {
|
|
|
488
478
|
}
|
|
489
479
|
try {
|
|
490
480
|
let url = `/api/v1/status/${options.mainTaskId}`;
|
|
491
|
-
if (options.
|
|
492
|
-
url += `/${options.
|
|
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;
|
|
@@ -538,7 +528,7 @@ class Dragdropdo {
|
|
|
538
528
|
* ```
|
|
539
529
|
*/
|
|
540
530
|
async pollStatus(options) {
|
|
541
|
-
const { mainTaskId,
|
|
531
|
+
const { mainTaskId, fileKey, interval = 2000, timeout = 300000, onUpdate, } = options;
|
|
542
532
|
const startTime = Date.now();
|
|
543
533
|
return new Promise((resolve, reject) => {
|
|
544
534
|
const poll = async () => {
|
|
@@ -549,7 +539,7 @@ class Dragdropdo {
|
|
|
549
539
|
return;
|
|
550
540
|
}
|
|
551
541
|
// Get status
|
|
552
|
-
const status = await this.getStatus({ mainTaskId,
|
|
542
|
+
const status = await this.getStatus({ mainTaskId, fileKey });
|
|
553
543
|
// Call update callback
|
|
554
544
|
if (onUpdate) {
|
|
555
545
|
onUpdate(status);
|
package/dist/src/types.d.ts
CHANGED
|
@@ -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', '
|
|
78
|
-
action: "convert" | "compress" | "merge" | "zip" | "create_zip" | "
|
|
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
|
|
106
|
-
|
|
105
|
+
/** Optional input file key for specific file status */
|
|
106
|
+
fileKey?: string;
|
|
107
107
|
}
|
|
108
108
|
export interface FileTaskStatus {
|
|
109
109
|
/** File key */
|