@arke-institute/sdk 2.0.0 → 2.2.0

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
@@ -151,6 +151,111 @@ const arke = new ArkeClient({
151
151
  });
152
152
  ```
153
153
 
154
+ ## Folder Upload
155
+
156
+ Upload entire folder structures with automatic CID computation and relationship linking:
157
+
158
+ ### Node.js
159
+
160
+ ```typescript
161
+ import { ArkeClient } from '@arke-institute/sdk';
162
+ import { uploadTree, scanDirectory } from '@arke-institute/sdk/operations';
163
+
164
+ const arke = new ArkeClient({ authToken: 'your-token' });
165
+
166
+ // Scan a local directory
167
+ const tree = await scanDirectory('/path/to/my-folder');
168
+
169
+ // Upload to a new collection
170
+ const result = await uploadTree(arke, tree, {
171
+ target: {
172
+ createCollection: {
173
+ label: 'My Upload',
174
+ description: 'Uploaded folder contents',
175
+ },
176
+ },
177
+ onProgress: (p) => {
178
+ console.log(`${p.phase}: ${p.completedFiles}/${p.totalFiles} files`);
179
+ },
180
+ });
181
+
182
+ console.log('Collection:', result.collection.id);
183
+ console.log('Files:', result.files.length);
184
+ console.log('Folders:', result.folders.length);
185
+ ```
186
+
187
+ ### Browser (Drag & Drop)
188
+
189
+ ```typescript
190
+ import { uploadTree, scanFileSystemEntries } from '@arke-institute/sdk/operations';
191
+
192
+ dropzone.ondrop = async (e) => {
193
+ e.preventDefault();
194
+ const entries = Array.from(e.dataTransfer.items)
195
+ .map(item => item.webkitGetAsEntry())
196
+ .filter(Boolean);
197
+
198
+ const tree = await scanFileSystemEntries(entries);
199
+ const result = await uploadTree(client, tree, {
200
+ target: { collectionId: 'existing-collection-id' },
201
+ });
202
+ };
203
+ ```
204
+
205
+ ### Browser (File Input)
206
+
207
+ ```typescript
208
+ import { uploadTree, scanFileList } from '@arke-institute/sdk/operations';
209
+
210
+ // <input type="file" webkitdirectory multiple />
211
+ input.onchange = async (e) => {
212
+ const tree = await scanFileList(e.target.files);
213
+ const result = await uploadTree(client, tree, {
214
+ target: { parentId: 'existing-folder-id', collectionId: 'collection-id' },
215
+ });
216
+ };
217
+ ```
218
+
219
+ ### Upload Options
220
+
221
+ ```typescript
222
+ const result = await uploadTree(client, tree, {
223
+ target: {
224
+ // Option 1: Create new collection
225
+ createCollection: { label: 'New Collection' },
226
+
227
+ // Option 2: Upload to existing collection root
228
+ collectionId: '01ABC...',
229
+
230
+ // Option 3: Upload to existing folder
231
+ collectionId: '01ABC...',
232
+ parentId: '01XYZ...',
233
+ },
234
+
235
+ // Progress tracking
236
+ onProgress: (p) => console.log(p.phase, p.completedFiles),
237
+
238
+ // Parallel uploads (default: 5)
239
+ concurrency: 10,
240
+
241
+ // Continue if some files fail
242
+ continueOnError: true,
243
+ });
244
+ ```
245
+
246
+ ### CID Utilities
247
+
248
+ ```typescript
249
+ import { computeCid, verifyCid } from '@arke-institute/sdk/operations';
250
+
251
+ // Compute CIDv1 for any content
252
+ const cid = await computeCid(new TextEncoder().encode('hello'));
253
+ // => "bafkreifzjut3te2nhyekklss27nh3k72ysco7y32koao5eei66wof36n5e"
254
+
255
+ // Verify content matches CID
256
+ const isValid = await verifyCid(content, expectedCid);
257
+ ```
258
+
154
259
  ## Development
155
260
 
156
261
  ### Regenerate Types
@@ -187,13 +292,12 @@ npm run publish-all:dry
187
292
  npm run publish-all
188
293
  ```
189
294
 
190
- ## Future Operations (TODO)
295
+ ## Future Operations
191
296
 
192
- The SDK includes placeholder modules for high-level operations:
297
+ The SDK includes placeholder modules for additional high-level operations:
193
298
 
194
- - **FolderOperations**: Recursive directory upload
195
299
  - **BatchOperations**: Bulk entity/relationship creation
196
- - **CryptoOperations**: Ed25519 key generation, CID computation
300
+ - **CryptoOperations**: Ed25519 key generation
197
301
 
198
302
  ## License
199
303
 
@@ -11,7 +11,12 @@ interface ArkeClientConfig {
11
11
  */
12
12
  baseUrl?: string;
13
13
  /**
14
- * Authentication token (JWT or API key)
14
+ * Authentication token - accepts either:
15
+ * - JWT token from Supabase auth (sent as Bearer)
16
+ * - Agent API key with 'ak_' prefix (sent as ApiKey)
17
+ * - User API key with 'uk_' prefix (sent as ApiKey)
18
+ *
19
+ * The correct Authorization header format is auto-detected from the token prefix.
15
20
  */
16
21
  authToken?: string;
17
22
  /**
@@ -39,13 +44,28 @@ declare const DEFAULT_CONFIG: Required<Pick<ArkeClientConfig, 'baseUrl' | 'netwo
39
44
  */
40
45
 
41
46
  type ArkeApiClient = Client<paths>;
47
+ /**
48
+ * Check if a token is an API key (starts with 'ak_' or 'uk_')
49
+ */
50
+ declare function isApiKey(token: string): boolean;
51
+ /**
52
+ * Get the appropriate Authorization header value for a token
53
+ * - API keys (ak_*, uk_*) use: ApiKey {token}
54
+ * - JWT tokens use: Bearer {token}
55
+ */
56
+ declare function getAuthorizationHeader(token: string): string;
42
57
  /**
43
58
  * Type-safe client for the Arke API
44
59
  *
45
60
  * @example
46
61
  * ```typescript
62
+ * // With JWT token
47
63
  * const arke = new ArkeClient({ authToken: 'your-jwt-token' });
48
64
  *
65
+ * // With API key (agent or user)
66
+ * const arke = new ArkeClient({ authToken: 'ak_your-agent-api-key' });
67
+ * const arke = new ArkeClient({ authToken: 'uk_your-user-api-key' });
68
+ *
49
69
  * // Create an entity
50
70
  * const { data, error } = await arke.api.POST('/entities', {
51
71
  * body: {
@@ -99,16 +119,174 @@ declare class ArkeClient {
99
119
  declare function createArkeClient(config?: ArkeClientConfig): ArkeClient;
100
120
 
101
121
  /**
102
- * Folder Operations
122
+ * Upload Types
123
+ *
124
+ * Type definitions for the folder/file upload system.
125
+ */
126
+ /**
127
+ * Represents a file to be uploaded.
128
+ * Platform-agnostic - works with browser File API or Node.js buffers.
129
+ */
130
+ interface UploadFile {
131
+ /** Filename (e.g., "document.pdf") */
132
+ name: string;
133
+ /** Relative path from upload root (e.g., "docs/reports/document.pdf") */
134
+ relativePath: string;
135
+ /** File size in bytes */
136
+ size: number;
137
+ /** MIME type (e.g., "application/pdf") */
138
+ mimeType: string;
139
+ /**
140
+ * Function to retrieve the file data.
141
+ * Called during upload phase.
142
+ */
143
+ getData: () => Promise<ArrayBuffer | Blob | Uint8Array>;
144
+ }
145
+ /**
146
+ * Represents a folder in the upload tree.
147
+ */
148
+ interface UploadFolder {
149
+ /** Folder name (e.g., "reports") */
150
+ name: string;
151
+ /** Relative path from upload root (e.g., "docs/reports") */
152
+ relativePath: string;
153
+ }
154
+ /**
155
+ * Complete tree structure to upload.
156
+ * Built by platform-specific scanners.
157
+ */
158
+ interface UploadTree {
159
+ /** All files to upload */
160
+ files: UploadFile[];
161
+ /** All folders to create (sorted by depth for correct ordering) */
162
+ folders: UploadFolder[];
163
+ }
164
+ /**
165
+ * Target specification for upload.
166
+ * Determines where items will be placed.
167
+ */
168
+ interface UploadTarget {
169
+ /**
170
+ * Collection ID - required for permissions.
171
+ * If not provided and createCollection is not set, upload will fail.
172
+ */
173
+ collectionId?: string;
174
+ /**
175
+ * Parent folder/collection ID where items will be added.
176
+ * If not provided, items go to collection root.
177
+ * Can be the same as collectionId (collection acts as folder).
178
+ */
179
+ parentId?: string;
180
+ /**
181
+ * Create a new collection for this upload.
182
+ * If set, collectionId is ignored.
183
+ */
184
+ createCollection?: {
185
+ /** Collection display name (required) */
186
+ label: string;
187
+ /** Collection description */
188
+ description?: string;
189
+ /** Custom roles (uses defaults if not provided) */
190
+ roles?: Record<string, string[]>;
191
+ };
192
+ }
193
+ /**
194
+ * Upload progress tracking.
195
+ */
196
+ interface UploadProgress$1 {
197
+ /** Current phase of the upload */
198
+ phase: 'computing-cids' | 'creating' | 'backlinking' | 'uploading' | 'complete' | 'error';
199
+ /** Current phase index (0=computing-cids, 1=creating, 2=backlinking, 3=uploading) */
200
+ phaseIndex: number;
201
+ /** Total number of phases (4, excluding complete/error) */
202
+ phaseCount: number;
203
+ /** Progress within current phase (0-100) */
204
+ phasePercent: number;
205
+ /** Total number of entities (files + folders) */
206
+ totalEntities: number;
207
+ /** Number of entities completed */
208
+ completedEntities: number;
209
+ /** Total number of parents to backlink */
210
+ totalParents: number;
211
+ /** Number of parents backlinked */
212
+ completedParents: number;
213
+ /** Current item being processed */
214
+ currentItem?: string;
215
+ /** Error message if phase is 'error' */
216
+ error?: string;
217
+ /** Bytes uploaded so far */
218
+ bytesUploaded?: number;
219
+ /** Total bytes to upload */
220
+ totalBytes?: number;
221
+ }
222
+ /**
223
+ * Configuration options for upload.
224
+ */
225
+ interface UploadOptions {
226
+ /** Where to upload */
227
+ target: UploadTarget;
228
+ /** Progress callback */
229
+ onProgress?: (progress: UploadProgress$1) => void;
230
+ /** Maximum concurrent operations (default: 5) */
231
+ concurrency?: number;
232
+ /** Continue uploading even if some files fail (default: false) */
233
+ continueOnError?: boolean;
234
+ /** Custom note to add to created entities */
235
+ note?: string;
236
+ }
237
+ /**
238
+ * Information about a created entity.
239
+ */
240
+ interface CreatedEntity {
241
+ /** Entity ID (ULID) */
242
+ id: string;
243
+ /** Entity CID */
244
+ cid: string;
245
+ /** Entity type */
246
+ type: 'file' | 'folder' | 'collection';
247
+ /** Original path in upload tree */
248
+ relativePath: string;
249
+ }
250
+ /**
251
+ * Result of an upload operation.
252
+ */
253
+ interface UploadResult {
254
+ /** Whether upload completed successfully */
255
+ success: boolean;
256
+ /** Collection used or created */
257
+ collection: {
258
+ id: string;
259
+ cid: string;
260
+ created: boolean;
261
+ };
262
+ /** Created folder entities */
263
+ folders: CreatedEntity[];
264
+ /** Created file entities */
265
+ files: CreatedEntity[];
266
+ /** Errors encountered (if continueOnError was true) */
267
+ errors: Array<{
268
+ path: string;
269
+ error: string;
270
+ }>;
271
+ }
272
+
273
+ /**
274
+ * Folder Operations (Legacy)
103
275
  *
104
- * High-level operations for working with folders and directory structures.
276
+ * @deprecated Use the new upload module instead:
277
+ * ```typescript
278
+ * import { uploadTree, scanDirectory } from '@arke-institute/sdk/operations';
105
279
  *
106
- * TODO: Implement folder operations
107
- * - uploadDirectory: Recursively upload a local directory
108
- * - createFolderHierarchy: Create folder structure from paths
109
- * - moveFolderContents: Move files between folders
280
+ * const tree = await scanDirectory('/path/to/folder');
281
+ * const result = await uploadTree(client, tree, {
282
+ * target: { collectionId: '...' },
283
+ * });
284
+ * ```
110
285
  */
111
286
 
287
+ /**
288
+ * @deprecated Use UploadProgress from upload module
289
+ */
112
290
  interface UploadProgress {
113
291
  phase: 'scanning' | 'creating-folders' | 'uploading-files' | 'linking' | 'complete';
114
292
  totalFiles: number;
@@ -117,6 +295,9 @@ interface UploadProgress {
117
295
  completedFolders: number;
118
296
  currentFile?: string;
119
297
  }
298
+ /**
299
+ * @deprecated Use UploadOptions from upload module
300
+ */
120
301
  interface UploadDirectoryOptions {
121
302
  /** Collection to upload into */
122
303
  collectionId: string;
@@ -127,6 +308,9 @@ interface UploadDirectoryOptions {
127
308
  /** Max concurrent uploads */
128
309
  concurrency?: number;
129
310
  }
311
+ /**
312
+ * @deprecated Use UploadResult from upload module
313
+ */
130
314
  interface UploadDirectoryResult {
131
315
  /** Root folder entity */
132
316
  rootFolder: unknown;
@@ -138,11 +322,13 @@ interface UploadDirectoryResult {
138
322
  /**
139
323
  * Folder operations helper
140
324
  *
141
- * @example
325
+ * @deprecated Use uploadTree and scanDirectory functions instead:
142
326
  * ```typescript
143
- * const folders = new FolderOperations(arkeClient);
144
- * const result = await folders.uploadDirectory('/path/to/local/folder', {
145
- * collectionId: '01ABC...',
327
+ * import { uploadTree, scanDirectory } from '@arke-institute/sdk/operations';
328
+ *
329
+ * const tree = await scanDirectory('/path/to/folder');
330
+ * const result = await uploadTree(client, tree, {
331
+ * target: { collectionId: '...' },
146
332
  * onProgress: (p) => console.log(`${p.completedFiles}/${p.totalFiles} files`),
147
333
  * });
148
334
  * ```
@@ -153,14 +339,9 @@ declare class FolderOperations {
153
339
  /**
154
340
  * Upload a local directory to Arke
155
341
  *
156
- * TODO: Implement this method
157
- * Steps:
158
- * 1. Scan directory structure
159
- * 2. Create folder hierarchy (depth-first)
160
- * 3. Upload files in parallel (with concurrency limit)
161
- * 4. Create bidirectional relationships (folder contains file)
342
+ * @deprecated Use uploadTree and scanDirectory instead
162
343
  */
163
- uploadDirectory(_localPath: string, _options: UploadDirectoryOptions): Promise<UploadDirectoryResult>;
344
+ uploadDirectory(localPath: string, options: UploadDirectoryOptions): Promise<UploadDirectoryResult>;
164
345
  }
165
346
 
166
347
  /**
@@ -299,4 +480,4 @@ declare class CryptoOperations {
299
480
  static computeCID(_content: Uint8Array): Promise<string>;
300
481
  }
301
482
 
302
- export { ArkeClient as A, BatchOperations as B, CryptoOperations as C, DEFAULT_CONFIG as D, FolderOperations as F, type KeyPair as K, type SignedPayload as S, type UploadProgress as U, type ArkeApiClient as a, type ArkeClientConfig as b, createArkeClient as c, type UploadDirectoryOptions as d, type UploadDirectoryResult as e, type BatchCreateOptions as f, type BatchResult as g };
483
+ export { ArkeClient as A, BatchOperations as B, CryptoOperations as C, DEFAULT_CONFIG as D, FolderOperations as F, type KeyPair as K, type SignedPayload as S, type UploadProgress$1 as U, type ArkeApiClient as a, type ArkeClientConfig as b, createArkeClient as c, type UploadDirectoryOptions as d, type UploadDirectoryResult as e, type BatchCreateOptions as f, getAuthorizationHeader as g, type BatchResult as h, isApiKey as i, type UploadTree as j, type UploadOptions as k, type UploadResult as l, type UploadFile as m, type UploadFolder as n, type UploadTarget as o, type CreatedEntity as p };
@@ -11,7 +11,12 @@ interface ArkeClientConfig {
11
11
  */
12
12
  baseUrl?: string;
13
13
  /**
14
- * Authentication token (JWT or API key)
14
+ * Authentication token - accepts either:
15
+ * - JWT token from Supabase auth (sent as Bearer)
16
+ * - Agent API key with 'ak_' prefix (sent as ApiKey)
17
+ * - User API key with 'uk_' prefix (sent as ApiKey)
18
+ *
19
+ * The correct Authorization header format is auto-detected from the token prefix.
15
20
  */
16
21
  authToken?: string;
17
22
  /**
@@ -39,13 +44,28 @@ declare const DEFAULT_CONFIG: Required<Pick<ArkeClientConfig, 'baseUrl' | 'netwo
39
44
  */
40
45
 
41
46
  type ArkeApiClient = Client<paths>;
47
+ /**
48
+ * Check if a token is an API key (starts with 'ak_' or 'uk_')
49
+ */
50
+ declare function isApiKey(token: string): boolean;
51
+ /**
52
+ * Get the appropriate Authorization header value for a token
53
+ * - API keys (ak_*, uk_*) use: ApiKey {token}
54
+ * - JWT tokens use: Bearer {token}
55
+ */
56
+ declare function getAuthorizationHeader(token: string): string;
42
57
  /**
43
58
  * Type-safe client for the Arke API
44
59
  *
45
60
  * @example
46
61
  * ```typescript
62
+ * // With JWT token
47
63
  * const arke = new ArkeClient({ authToken: 'your-jwt-token' });
48
64
  *
65
+ * // With API key (agent or user)
66
+ * const arke = new ArkeClient({ authToken: 'ak_your-agent-api-key' });
67
+ * const arke = new ArkeClient({ authToken: 'uk_your-user-api-key' });
68
+ *
49
69
  * // Create an entity
50
70
  * const { data, error } = await arke.api.POST('/entities', {
51
71
  * body: {
@@ -99,16 +119,174 @@ declare class ArkeClient {
99
119
  declare function createArkeClient(config?: ArkeClientConfig): ArkeClient;
100
120
 
101
121
  /**
102
- * Folder Operations
122
+ * Upload Types
123
+ *
124
+ * Type definitions for the folder/file upload system.
125
+ */
126
+ /**
127
+ * Represents a file to be uploaded.
128
+ * Platform-agnostic - works with browser File API or Node.js buffers.
129
+ */
130
+ interface UploadFile {
131
+ /** Filename (e.g., "document.pdf") */
132
+ name: string;
133
+ /** Relative path from upload root (e.g., "docs/reports/document.pdf") */
134
+ relativePath: string;
135
+ /** File size in bytes */
136
+ size: number;
137
+ /** MIME type (e.g., "application/pdf") */
138
+ mimeType: string;
139
+ /**
140
+ * Function to retrieve the file data.
141
+ * Called during upload phase.
142
+ */
143
+ getData: () => Promise<ArrayBuffer | Blob | Uint8Array>;
144
+ }
145
+ /**
146
+ * Represents a folder in the upload tree.
147
+ */
148
+ interface UploadFolder {
149
+ /** Folder name (e.g., "reports") */
150
+ name: string;
151
+ /** Relative path from upload root (e.g., "docs/reports") */
152
+ relativePath: string;
153
+ }
154
+ /**
155
+ * Complete tree structure to upload.
156
+ * Built by platform-specific scanners.
157
+ */
158
+ interface UploadTree {
159
+ /** All files to upload */
160
+ files: UploadFile[];
161
+ /** All folders to create (sorted by depth for correct ordering) */
162
+ folders: UploadFolder[];
163
+ }
164
+ /**
165
+ * Target specification for upload.
166
+ * Determines where items will be placed.
167
+ */
168
+ interface UploadTarget {
169
+ /**
170
+ * Collection ID - required for permissions.
171
+ * If not provided and createCollection is not set, upload will fail.
172
+ */
173
+ collectionId?: string;
174
+ /**
175
+ * Parent folder/collection ID where items will be added.
176
+ * If not provided, items go to collection root.
177
+ * Can be the same as collectionId (collection acts as folder).
178
+ */
179
+ parentId?: string;
180
+ /**
181
+ * Create a new collection for this upload.
182
+ * If set, collectionId is ignored.
183
+ */
184
+ createCollection?: {
185
+ /** Collection display name (required) */
186
+ label: string;
187
+ /** Collection description */
188
+ description?: string;
189
+ /** Custom roles (uses defaults if not provided) */
190
+ roles?: Record<string, string[]>;
191
+ };
192
+ }
193
+ /**
194
+ * Upload progress tracking.
195
+ */
196
+ interface UploadProgress$1 {
197
+ /** Current phase of the upload */
198
+ phase: 'computing-cids' | 'creating' | 'backlinking' | 'uploading' | 'complete' | 'error';
199
+ /** Current phase index (0=computing-cids, 1=creating, 2=backlinking, 3=uploading) */
200
+ phaseIndex: number;
201
+ /** Total number of phases (4, excluding complete/error) */
202
+ phaseCount: number;
203
+ /** Progress within current phase (0-100) */
204
+ phasePercent: number;
205
+ /** Total number of entities (files + folders) */
206
+ totalEntities: number;
207
+ /** Number of entities completed */
208
+ completedEntities: number;
209
+ /** Total number of parents to backlink */
210
+ totalParents: number;
211
+ /** Number of parents backlinked */
212
+ completedParents: number;
213
+ /** Current item being processed */
214
+ currentItem?: string;
215
+ /** Error message if phase is 'error' */
216
+ error?: string;
217
+ /** Bytes uploaded so far */
218
+ bytesUploaded?: number;
219
+ /** Total bytes to upload */
220
+ totalBytes?: number;
221
+ }
222
+ /**
223
+ * Configuration options for upload.
224
+ */
225
+ interface UploadOptions {
226
+ /** Where to upload */
227
+ target: UploadTarget;
228
+ /** Progress callback */
229
+ onProgress?: (progress: UploadProgress$1) => void;
230
+ /** Maximum concurrent operations (default: 5) */
231
+ concurrency?: number;
232
+ /** Continue uploading even if some files fail (default: false) */
233
+ continueOnError?: boolean;
234
+ /** Custom note to add to created entities */
235
+ note?: string;
236
+ }
237
+ /**
238
+ * Information about a created entity.
239
+ */
240
+ interface CreatedEntity {
241
+ /** Entity ID (ULID) */
242
+ id: string;
243
+ /** Entity CID */
244
+ cid: string;
245
+ /** Entity type */
246
+ type: 'file' | 'folder' | 'collection';
247
+ /** Original path in upload tree */
248
+ relativePath: string;
249
+ }
250
+ /**
251
+ * Result of an upload operation.
252
+ */
253
+ interface UploadResult {
254
+ /** Whether upload completed successfully */
255
+ success: boolean;
256
+ /** Collection used or created */
257
+ collection: {
258
+ id: string;
259
+ cid: string;
260
+ created: boolean;
261
+ };
262
+ /** Created folder entities */
263
+ folders: CreatedEntity[];
264
+ /** Created file entities */
265
+ files: CreatedEntity[];
266
+ /** Errors encountered (if continueOnError was true) */
267
+ errors: Array<{
268
+ path: string;
269
+ error: string;
270
+ }>;
271
+ }
272
+
273
+ /**
274
+ * Folder Operations (Legacy)
103
275
  *
104
- * High-level operations for working with folders and directory structures.
276
+ * @deprecated Use the new upload module instead:
277
+ * ```typescript
278
+ * import { uploadTree, scanDirectory } from '@arke-institute/sdk/operations';
105
279
  *
106
- * TODO: Implement folder operations
107
- * - uploadDirectory: Recursively upload a local directory
108
- * - createFolderHierarchy: Create folder structure from paths
109
- * - moveFolderContents: Move files between folders
280
+ * const tree = await scanDirectory('/path/to/folder');
281
+ * const result = await uploadTree(client, tree, {
282
+ * target: { collectionId: '...' },
283
+ * });
284
+ * ```
110
285
  */
111
286
 
287
+ /**
288
+ * @deprecated Use UploadProgress from upload module
289
+ */
112
290
  interface UploadProgress {
113
291
  phase: 'scanning' | 'creating-folders' | 'uploading-files' | 'linking' | 'complete';
114
292
  totalFiles: number;
@@ -117,6 +295,9 @@ interface UploadProgress {
117
295
  completedFolders: number;
118
296
  currentFile?: string;
119
297
  }
298
+ /**
299
+ * @deprecated Use UploadOptions from upload module
300
+ */
120
301
  interface UploadDirectoryOptions {
121
302
  /** Collection to upload into */
122
303
  collectionId: string;
@@ -127,6 +308,9 @@ interface UploadDirectoryOptions {
127
308
  /** Max concurrent uploads */
128
309
  concurrency?: number;
129
310
  }
311
+ /**
312
+ * @deprecated Use UploadResult from upload module
313
+ */
130
314
  interface UploadDirectoryResult {
131
315
  /** Root folder entity */
132
316
  rootFolder: unknown;
@@ -138,11 +322,13 @@ interface UploadDirectoryResult {
138
322
  /**
139
323
  * Folder operations helper
140
324
  *
141
- * @example
325
+ * @deprecated Use uploadTree and scanDirectory functions instead:
142
326
  * ```typescript
143
- * const folders = new FolderOperations(arkeClient);
144
- * const result = await folders.uploadDirectory('/path/to/local/folder', {
145
- * collectionId: '01ABC...',
327
+ * import { uploadTree, scanDirectory } from '@arke-institute/sdk/operations';
328
+ *
329
+ * const tree = await scanDirectory('/path/to/folder');
330
+ * const result = await uploadTree(client, tree, {
331
+ * target: { collectionId: '...' },
146
332
  * onProgress: (p) => console.log(`${p.completedFiles}/${p.totalFiles} files`),
147
333
  * });
148
334
  * ```
@@ -153,14 +339,9 @@ declare class FolderOperations {
153
339
  /**
154
340
  * Upload a local directory to Arke
155
341
  *
156
- * TODO: Implement this method
157
- * Steps:
158
- * 1. Scan directory structure
159
- * 2. Create folder hierarchy (depth-first)
160
- * 3. Upload files in parallel (with concurrency limit)
161
- * 4. Create bidirectional relationships (folder contains file)
342
+ * @deprecated Use uploadTree and scanDirectory instead
162
343
  */
163
- uploadDirectory(_localPath: string, _options: UploadDirectoryOptions): Promise<UploadDirectoryResult>;
344
+ uploadDirectory(localPath: string, options: UploadDirectoryOptions): Promise<UploadDirectoryResult>;
164
345
  }
165
346
 
166
347
  /**
@@ -299,4 +480,4 @@ declare class CryptoOperations {
299
480
  static computeCID(_content: Uint8Array): Promise<string>;
300
481
  }
301
482
 
302
- export { ArkeClient as A, BatchOperations as B, CryptoOperations as C, DEFAULT_CONFIG as D, FolderOperations as F, type KeyPair as K, type SignedPayload as S, type UploadProgress as U, type ArkeApiClient as a, type ArkeClientConfig as b, createArkeClient as c, type UploadDirectoryOptions as d, type UploadDirectoryResult as e, type BatchCreateOptions as f, type BatchResult as g };
483
+ export { ArkeClient as A, BatchOperations as B, CryptoOperations as C, DEFAULT_CONFIG as D, FolderOperations as F, type KeyPair as K, type SignedPayload as S, type UploadProgress$1 as U, type ArkeApiClient as a, type ArkeClientConfig as b, createArkeClient as c, type UploadDirectoryOptions as d, type UploadDirectoryResult as e, type BatchCreateOptions as f, getAuthorizationHeader as g, type BatchResult as h, isApiKey as i, type UploadTree as j, type UploadOptions as k, type UploadResult as l, type UploadFile as m, type UploadFolder as n, type UploadTarget as o, type CreatedEntity as p };