@arke-institute/sdk 2.0.0 → 2.1.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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/client/ArkeClient.ts","../src/client/config.ts","../src/client/errors.ts","../src/operations/folders.ts","../src/operations/batch.ts","../src/operations/crypto.ts"],"sourcesContent":["/**\n * @arke-institute/sdk\n *\n * TypeScript SDK for the Arke API - auto-generated from OpenAPI spec.\n *\n * @example\n * ```typescript\n * import { ArkeClient } from '@arke-institute/sdk';\n *\n * const arke = new ArkeClient({ authToken: 'your-jwt-token' });\n *\n * // Create an entity\n * const { data, error } = await arke.api.POST('/entities', {\n * body: {\n * collection_id: '01ABC...',\n * type: 'document',\n * properties: { title: 'My Document' }\n * }\n * });\n *\n * if (error) {\n * console.error('Failed to create entity:', error);\n * } else {\n * console.log('Created entity:', data.id);\n * }\n * ```\n */\n\n// Main client\nexport { ArkeClient, createArkeClient, type ArkeApiClient } from './client/ArkeClient.js';\n\n// Configuration\nexport { type ArkeClientConfig, DEFAULT_CONFIG } from './client/config.js';\n\n// Errors\nexport {\n ArkeError,\n CASConflictError,\n NotFoundError,\n ValidationError,\n AuthenticationError,\n ForbiddenError,\n parseApiError,\n} from './client/errors.js';\n\n// Generated types\nexport type { paths, components, operations } from './generated/index.js';\n\n// High-level operations (TODO: implement)\nexport {\n FolderOperations,\n BatchOperations,\n CryptoOperations,\n type UploadProgress,\n type UploadDirectoryOptions,\n type UploadDirectoryResult,\n type BatchCreateOptions,\n type BatchResult,\n type KeyPair,\n type SignedPayload,\n} from './operations/index.js';\n","/**\n * Main Arke SDK Client\n *\n * Provides type-safe access to the Arke API using openapi-fetch.\n */\n\nimport createClient, { type Client } from 'openapi-fetch';\nimport type { paths } from '../generated/types.js';\nimport { ArkeClientConfig, DEFAULT_CONFIG } from './config.js';\n\nexport type ArkeApiClient = Client<paths>;\n\n/**\n * Type-safe client for the Arke API\n *\n * @example\n * ```typescript\n * const arke = new ArkeClient({ authToken: 'your-jwt-token' });\n *\n * // Create an entity\n * const { data, error } = await arke.api.POST('/entities', {\n * body: {\n * collection_id: '01ABC...',\n * type: 'document',\n * properties: { title: 'My Document' }\n * }\n * });\n *\n * // Get an entity\n * const { data } = await arke.api.GET('/entities/{id}', {\n * params: { path: { id: '01XYZ...' } }\n * });\n * ```\n */\nexport class ArkeClient {\n /**\n * The underlying openapi-fetch client with full type safety\n * Use this for all API calls: arke.api.GET, arke.api.POST, etc.\n */\n public api: ArkeApiClient;\n\n private config: ArkeClientConfig;\n\n constructor(config: ArkeClientConfig = {}) {\n this.config = {\n ...DEFAULT_CONFIG,\n ...config,\n };\n\n this.api = this.createClient();\n }\n\n private createClient(): ArkeApiClient {\n const headers: Record<string, string> = {\n 'Content-Type': 'application/json',\n ...this.config.headers,\n };\n\n if (this.config.authToken) {\n headers['Authorization'] = `Bearer ${this.config.authToken}`;\n }\n\n if (this.config.network === 'test') {\n headers['X-Arke-Network'] = 'test';\n }\n\n return createClient<paths>({\n baseUrl: this.config.baseUrl ?? DEFAULT_CONFIG.baseUrl,\n headers,\n });\n }\n\n /**\n * Update the authentication token\n * Recreates the underlying client with new headers\n */\n setAuthToken(token: string): void {\n this.config.authToken = token;\n this.api = this.createClient();\n }\n\n /**\n * Clear the authentication token\n */\n clearAuthToken(): void {\n this.config.authToken = undefined;\n this.api = this.createClient();\n }\n\n /**\n * Get the current configuration\n */\n getConfig(): Readonly<ArkeClientConfig> {\n return { ...this.config };\n }\n\n /**\n * Get the base URL\n */\n get baseUrl(): string {\n return this.config.baseUrl ?? DEFAULT_CONFIG.baseUrl;\n }\n\n /**\n * Check if client is authenticated\n */\n get isAuthenticated(): boolean {\n return !!this.config.authToken;\n }\n}\n\n/**\n * Create a new ArkeClient instance\n * Convenience function for those who prefer functional style\n */\nexport function createArkeClient(config?: ArkeClientConfig): ArkeClient {\n return new ArkeClient(config);\n}\n\n// Re-export types and errors\nexport type { ArkeClientConfig } from './config.js';\nexport * from './errors.js';\n","/**\n * SDK configuration types\n */\n\nexport interface ArkeClientConfig {\n /**\n * Base URL for the Arke API\n * @default 'https://arke-v1.arke.institute'\n */\n baseUrl?: string;\n\n /**\n * Authentication token (JWT or API key)\n */\n authToken?: string;\n\n /**\n * Network to use ('main' or 'test')\n * Test network uses 'II' prefixed IDs and isolated data\n * @default 'main'\n */\n network?: 'main' | 'test';\n\n /**\n * Callback to refresh auth token when expired\n * Called automatically on 401 responses\n */\n onTokenRefresh?: () => Promise<string>;\n\n /**\n * Custom headers to include in all requests\n */\n headers?: Record<string, string>;\n}\n\nexport const DEFAULT_CONFIG: Required<Pick<ArkeClientConfig, 'baseUrl' | 'network'>> = {\n baseUrl: 'https://arke-v1.arke.institute',\n network: 'main',\n};\n","/**\n * SDK error classes\n */\n\n/**\n * Base error class for all Arke SDK errors\n */\nexport class ArkeError extends Error {\n constructor(\n message: string,\n public readonly code: string,\n public readonly status?: number,\n public readonly details?: unknown\n ) {\n super(message);\n this.name = 'ArkeError';\n // Maintains proper stack trace for where error was thrown\n Error.captureStackTrace?.(this, this.constructor);\n }\n\n toJSON() {\n return {\n name: this.name,\n message: this.message,\n code: this.code,\n status: this.status,\n details: this.details,\n };\n }\n}\n\n/**\n * CAS (Compare-And-Swap) conflict - entity was modified by another request\n */\nexport class CASConflictError extends ArkeError {\n constructor(\n public readonly expectedTip?: string,\n public readonly actualTip?: string\n ) {\n super(\n 'Entity was modified by another request. Refresh and retry with the current tip.',\n 'CAS_CONFLICT',\n 409,\n { expectedTip, actualTip }\n );\n this.name = 'CASConflictError';\n }\n}\n\n/**\n * Resource not found\n */\nexport class NotFoundError extends ArkeError {\n constructor(resourceType: string, id: string) {\n super(`${resourceType} not found: ${id}`, 'NOT_FOUND', 404, { resourceType, id });\n this.name = 'NotFoundError';\n }\n}\n\n/**\n * Validation error - invalid request data\n */\nexport class ValidationError extends ArkeError {\n constructor(\n message: string,\n public readonly field?: string,\n details?: unknown\n ) {\n super(message, 'VALIDATION_ERROR', 400, details ?? { field });\n this.name = 'ValidationError';\n }\n}\n\n/**\n * Authentication required or invalid\n */\nexport class AuthenticationError extends ArkeError {\n constructor(message = 'Authentication required') {\n super(message, 'AUTH_REQUIRED', 401);\n this.name = 'AuthenticationError';\n }\n}\n\n/**\n * Permission denied\n */\nexport class ForbiddenError extends ArkeError {\n constructor(action?: string, resource?: string) {\n const msg = action\n ? `Permission denied: ${action}${resource ? ` on ${resource}` : ''}`\n : 'Permission denied';\n super(msg, 'FORBIDDEN', 403, { action, resource });\n this.name = 'ForbiddenError';\n }\n}\n\n/**\n * Parse API error response into appropriate error class\n */\nexport function parseApiError(status: number, body: unknown): ArkeError {\n const errorBody = body as { error?: string; message?: string; details?: unknown } | null;\n const message = errorBody?.error ?? errorBody?.message ?? 'Unknown error';\n\n switch (status) {\n case 400:\n return new ValidationError(message, undefined, errorBody?.details);\n\n case 401:\n return new AuthenticationError(message);\n\n case 403:\n return new ForbiddenError(message);\n\n case 404:\n return new NotFoundError('Resource', 'unknown');\n\n case 409: {\n // Parse CAS conflict details if available\n const details = errorBody?.details as { expected?: string; actual?: string } | undefined;\n return new CASConflictError(details?.expected, details?.actual);\n }\n\n default:\n return new ArkeError(message, 'API_ERROR', status, errorBody?.details);\n }\n}\n","/**\n * Folder Operations\n *\n * High-level operations for working with folders and directory structures.\n *\n * TODO: Implement folder operations\n * - uploadDirectory: Recursively upload a local directory\n * - createFolderHierarchy: Create folder structure from paths\n * - moveFolderContents: Move files between folders\n */\n\nimport type { ArkeClient } from '../client/ArkeClient.js';\n\nexport interface UploadProgress {\n phase: 'scanning' | 'creating-folders' | 'uploading-files' | 'linking' | 'complete';\n totalFiles: number;\n completedFiles: number;\n totalFolders: number;\n completedFolders: number;\n currentFile?: string;\n}\n\nexport interface UploadDirectoryOptions {\n /** Collection to upload into */\n collectionId: string;\n /** Parent folder ID (optional - creates at root if not provided) */\n parentFolderId?: string;\n /** Progress callback */\n onProgress?: (progress: UploadProgress) => void;\n /** Max concurrent uploads */\n concurrency?: number;\n}\n\nexport interface UploadDirectoryResult {\n /** Root folder entity */\n rootFolder: unknown; // TODO: Type from generated types\n /** All created folder entities */\n folders: unknown[];\n /** All created file entities */\n files: unknown[];\n}\n\n/**\n * Folder operations helper\n *\n * @example\n * ```typescript\n * const folders = new FolderOperations(arkeClient);\n * const result = await folders.uploadDirectory('/path/to/local/folder', {\n * collectionId: '01ABC...',\n * onProgress: (p) => console.log(`${p.completedFiles}/${p.totalFiles} files`),\n * });\n * ```\n */\nexport class FolderOperations {\n constructor(private client: ArkeClient) {}\n\n /**\n * Upload a local directory to Arke\n *\n * TODO: Implement this method\n * Steps:\n * 1. Scan directory structure\n * 2. Create folder hierarchy (depth-first)\n * 3. Upload files in parallel (with concurrency limit)\n * 4. Create bidirectional relationships (folder contains file)\n */\n async uploadDirectory(\n _localPath: string,\n _options: UploadDirectoryOptions\n ): Promise<UploadDirectoryResult> {\n throw new Error('FolderOperations.uploadDirectory is not yet implemented');\n }\n}\n","/**\n * Batch Operations\n *\n * High-level operations for bulk entity and relationship management.\n *\n * TODO: Implement batch operations\n * - createEntities: Create multiple entities in parallel\n * - updateEntities: Update multiple entities in parallel\n * - createRelationships: Create multiple relationships in parallel\n */\n\nimport type { ArkeClient } from '../client/ArkeClient.js';\n\nexport interface BatchCreateOptions {\n /** Max concurrent operations */\n concurrency?: number;\n /** Continue on individual failures */\n continueOnError?: boolean;\n /** Progress callback */\n onProgress?: (completed: number, total: number) => void;\n}\n\nexport interface BatchResult<T> {\n /** Successfully completed operations */\n succeeded: T[];\n /** Failed operations with errors */\n failed: Array<{ input: unknown; error: Error }>;\n}\n\n/**\n * Batch operations helper\n *\n * @example\n * ```typescript\n * const batch = new BatchOperations(arkeClient);\n * const result = await batch.createEntities([\n * { type: 'document', properties: { title: 'Doc 1' } },\n * { type: 'document', properties: { title: 'Doc 2' } },\n * ], { concurrency: 5 });\n * ```\n */\nexport class BatchOperations {\n constructor(private client: ArkeClient) {}\n\n /**\n * Create multiple entities in parallel\n *\n * TODO: Implement this method\n */\n async createEntities(\n _entities: Array<{\n collectionId: string;\n type: string;\n properties?: Record<string, unknown>;\n }>,\n _options?: BatchCreateOptions\n ): Promise<BatchResult<unknown>> {\n throw new Error('BatchOperations.createEntities is not yet implemented');\n }\n\n /**\n * Create multiple relationships in parallel\n *\n * TODO: Implement this method\n */\n async createRelationships(\n _relationships: Array<{\n sourceId: string;\n targetId: string;\n predicate: string;\n bidirectional?: boolean;\n properties?: Record<string, unknown>;\n }>,\n _options?: BatchCreateOptions\n ): Promise<BatchResult<unknown>> {\n throw new Error('BatchOperations.createRelationships is not yet implemented');\n }\n}\n","/**\n * Crypto Operations\n *\n * Cryptographic utilities for agents and content addressing.\n *\n * TODO: Implement crypto operations\n * - generateKeyPair: Generate Ed25519 key pair for agent authentication\n * - signPayload: Sign a payload with agent private key\n * - computeCID: Compute IPFS CID for content\n */\n\n/**\n * Ed25519 key pair for agent authentication\n */\nexport interface KeyPair {\n /** Public key in base64 */\n publicKey: string;\n /** Private key in base64 (keep secret!) */\n privateKey: string;\n}\n\n/**\n * Signed payload with signature\n */\nexport interface SignedPayload {\n /** Original payload */\n payload: string;\n /** Ed25519 signature in base64 */\n signature: string;\n /** Timestamp of signature */\n timestamp: number;\n}\n\n/**\n * Crypto operations helper\n *\n * @example\n * ```typescript\n * // Generate key pair for a new agent\n * const { publicKey, privateKey } = await CryptoOperations.generateKeyPair();\n *\n * // Sign a payload\n * const signed = await CryptoOperations.signPayload(privateKey, payload);\n * ```\n */\nexport class CryptoOperations {\n /**\n * Generate an Ed25519 key pair for agent authentication\n *\n * TODO: Implement using Node.js crypto or Web Crypto API\n */\n static async generateKeyPair(): Promise<KeyPair> {\n throw new Error('CryptoOperations.generateKeyPair is not yet implemented');\n }\n\n /**\n * Sign a payload with an Ed25519 private key\n *\n * TODO: Implement signature generation\n */\n static async signPayload(_privateKey: string, _payload: string): Promise<SignedPayload> {\n throw new Error('CryptoOperations.signPayload is not yet implemented');\n }\n\n /**\n * Verify an Ed25519 signature\n *\n * TODO: Implement signature verification\n */\n static async verifySignature(\n _publicKey: string,\n _payload: string,\n _signature: string\n ): Promise<boolean> {\n throw new Error('CryptoOperations.verifySignature is not yet implemented');\n }\n\n /**\n * Compute IPFS CID for content\n *\n * TODO: Implement using multiformats library\n */\n static async computeCID(_content: Uint8Array): Promise<string> {\n throw new Error('CryptoOperations.computeCID is not yet implemented');\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACMA,2BAA0C;;;AC6BnC,IAAM,iBAA0E;AAAA,EACrF,SAAS;AAAA,EACT,SAAS;AACX;;;AC/BO,IAAM,YAAN,cAAwB,MAAM;AAAA,EACnC,YACE,SACgB,MACA,QACA,SAChB;AACA,UAAM,OAAO;AAJG;AACA;AACA;AAGhB,SAAK,OAAO;AAEZ,UAAM,oBAAoB,MAAM,KAAK,WAAW;AAAA,EAClD;AAAA,EAEA,SAAS;AACP,WAAO;AAAA,MACL,MAAM,KAAK;AAAA,MACX,SAAS,KAAK;AAAA,MACd,MAAM,KAAK;AAAA,MACX,QAAQ,KAAK;AAAA,MACb,SAAS,KAAK;AAAA,IAChB;AAAA,EACF;AACF;AAKO,IAAM,mBAAN,cAA+B,UAAU;AAAA,EAC9C,YACkB,aACA,WAChB;AACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA,EAAE,aAAa,UAAU;AAAA,IAC3B;AARgB;AACA;AAQhB,SAAK,OAAO;AAAA,EACd;AACF;AAKO,IAAM,gBAAN,cAA4B,UAAU;AAAA,EAC3C,YAAY,cAAsB,IAAY;AAC5C,UAAM,GAAG,YAAY,eAAe,EAAE,IAAI,aAAa,KAAK,EAAE,cAAc,GAAG,CAAC;AAChF,SAAK,OAAO;AAAA,EACd;AACF;AAKO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B;AAAA,EAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOzC,MAAM,eACJ,WAKA,UAC+B;AAC/B,UAAM,IAAI,MAAM,uDAAuD;AAAA,EACzE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,oBACJ,gBAOA,UAC+B;AAC/B,UAAM,IAAI,MAAM,4DAA4D;AAAA,EAC9E;AACF;;;AChCO,IAAM,mBAAN,MAAuB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAM5B,aAAa,kBAAoC;AAC/C,UAAM,IAAI,MAAM,yDAAyD;AAAA,EAC3E;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,aAAa,YAAY,aAAqB,UAA0C;AACtF,UAAM,IAAI,MAAM,qDAAqD;AAAA,EACvE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,aAAa,gBACX,YACA,UACA,YACkB;AAClB,UAAM,IAAI,MAAM,yDAAyD;AAAA,EAC3E;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,aAAa,WAAW,UAAuC;AAC7D,UAAM,IAAI,MAAM,oDAAoD;AAAA,EACtE;AACF;","names":["createClient"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/client/ArkeClient.ts","../src/client/config.ts","../src/client/errors.ts","../src/operations/upload/cid.ts","../src/operations/upload/engine.ts","../src/operations/upload/scanners.ts","../src/operations/folders.ts","../src/operations/batch.ts","../src/operations/crypto.ts"],"sourcesContent":["/**\n * @arke-institute/sdk\n *\n * TypeScript SDK for the Arke API - auto-generated from OpenAPI spec.\n *\n * @example\n * ```typescript\n * import { ArkeClient } from '@arke-institute/sdk';\n *\n * const arke = new ArkeClient({ authToken: 'your-jwt-token' });\n *\n * // Create an entity\n * const { data, error } = await arke.api.POST('/entities', {\n * body: {\n * collection_id: '01ABC...',\n * type: 'document',\n * properties: { title: 'My Document' }\n * }\n * });\n *\n * if (error) {\n * console.error('Failed to create entity:', error);\n * } else {\n * console.log('Created entity:', data.id);\n * }\n * ```\n */\n\n// Main client\nexport { ArkeClient, createArkeClient, type ArkeApiClient } from './client/ArkeClient.js';\n\n// Configuration\nexport { type ArkeClientConfig, DEFAULT_CONFIG } from './client/config.js';\n\n// Errors\nexport {\n ArkeError,\n CASConflictError,\n NotFoundError,\n ValidationError,\n AuthenticationError,\n ForbiddenError,\n parseApiError,\n} from './client/errors.js';\n\n// Generated types\nexport type { paths, components, operations } from './generated/index.js';\n\n// High-level operations (TODO: implement)\nexport {\n FolderOperations,\n BatchOperations,\n CryptoOperations,\n type UploadProgress,\n type UploadDirectoryOptions,\n type UploadDirectoryResult,\n type BatchCreateOptions,\n type BatchResult,\n type KeyPair,\n type SignedPayload,\n} from './operations/index.js';\n","/**\n * Main Arke SDK Client\n *\n * Provides type-safe access to the Arke API using openapi-fetch.\n */\n\nimport createClient, { type Client } from 'openapi-fetch';\nimport type { paths } from '../generated/types.js';\nimport { ArkeClientConfig, DEFAULT_CONFIG } from './config.js';\n\nexport type ArkeApiClient = Client<paths>;\n\n/**\n * Type-safe client for the Arke API\n *\n * @example\n * ```typescript\n * const arke = new ArkeClient({ authToken: 'your-jwt-token' });\n *\n * // Create an entity\n * const { data, error } = await arke.api.POST('/entities', {\n * body: {\n * collection_id: '01ABC...',\n * type: 'document',\n * properties: { title: 'My Document' }\n * }\n * });\n *\n * // Get an entity\n * const { data } = await arke.api.GET('/entities/{id}', {\n * params: { path: { id: '01XYZ...' } }\n * });\n * ```\n */\nexport class ArkeClient {\n /**\n * The underlying openapi-fetch client with full type safety\n * Use this for all API calls: arke.api.GET, arke.api.POST, etc.\n */\n public api: ArkeApiClient;\n\n private config: ArkeClientConfig;\n\n constructor(config: ArkeClientConfig = {}) {\n this.config = {\n ...DEFAULT_CONFIG,\n ...config,\n };\n\n this.api = this.createClient();\n }\n\n private createClient(): ArkeApiClient {\n const headers: Record<string, string> = {\n 'Content-Type': 'application/json',\n ...this.config.headers,\n };\n\n if (this.config.authToken) {\n headers['Authorization'] = `Bearer ${this.config.authToken}`;\n }\n\n if (this.config.network === 'test') {\n headers['X-Arke-Network'] = 'test';\n }\n\n return createClient<paths>({\n baseUrl: this.config.baseUrl ?? DEFAULT_CONFIG.baseUrl,\n headers,\n });\n }\n\n /**\n * Update the authentication token\n * Recreates the underlying client with new headers\n */\n setAuthToken(token: string): void {\n this.config.authToken = token;\n this.api = this.createClient();\n }\n\n /**\n * Clear the authentication token\n */\n clearAuthToken(): void {\n this.config.authToken = undefined;\n this.api = this.createClient();\n }\n\n /**\n * Get the current configuration\n */\n getConfig(): Readonly<ArkeClientConfig> {\n return { ...this.config };\n }\n\n /**\n * Get the base URL\n */\n get baseUrl(): string {\n return this.config.baseUrl ?? DEFAULT_CONFIG.baseUrl;\n }\n\n /**\n * Check if client is authenticated\n */\n get isAuthenticated(): boolean {\n return !!this.config.authToken;\n }\n}\n\n/**\n * Create a new ArkeClient instance\n * Convenience function for those who prefer functional style\n */\nexport function createArkeClient(config?: ArkeClientConfig): ArkeClient {\n return new ArkeClient(config);\n}\n\n// Re-export types and errors\nexport type { ArkeClientConfig } from './config.js';\nexport * from './errors.js';\n","/**\n * SDK configuration types\n */\n\nexport interface ArkeClientConfig {\n /**\n * Base URL for the Arke API\n * @default 'https://arke-v1.arke.institute'\n */\n baseUrl?: string;\n\n /**\n * Authentication token (JWT or API key)\n */\n authToken?: string;\n\n /**\n * Network to use ('main' or 'test')\n * Test network uses 'II' prefixed IDs and isolated data\n * @default 'main'\n */\n network?: 'main' | 'test';\n\n /**\n * Callback to refresh auth token when expired\n * Called automatically on 401 responses\n */\n onTokenRefresh?: () => Promise<string>;\n\n /**\n * Custom headers to include in all requests\n */\n headers?: Record<string, string>;\n}\n\nexport const DEFAULT_CONFIG: Required<Pick<ArkeClientConfig, 'baseUrl' | 'network'>> = {\n baseUrl: 'https://arke-v1.arke.institute',\n network: 'main',\n};\n","/**\n * SDK error classes\n */\n\n/**\n * Base error class for all Arke SDK errors\n */\nexport class ArkeError extends Error {\n constructor(\n message: string,\n public readonly code: string,\n public readonly status?: number,\n public readonly details?: unknown\n ) {\n super(message);\n this.name = 'ArkeError';\n // Maintains proper stack trace for where error was thrown\n Error.captureStackTrace?.(this, this.constructor);\n }\n\n toJSON() {\n return {\n name: this.name,\n message: this.message,\n code: this.code,\n status: this.status,\n details: this.details,\n };\n }\n}\n\n/**\n * CAS (Compare-And-Swap) conflict - entity was modified by another request\n */\nexport class CASConflictError extends ArkeError {\n constructor(\n public readonly expectedTip?: string,\n public readonly actualTip?: string\n ) {\n super(\n 'Entity was modified by another request. Refresh and retry with the current tip.',\n 'CAS_CONFLICT',\n 409,\n { expectedTip, actualTip }\n );\n this.name = 'CASConflictError';\n }\n}\n\n/**\n * Resource not found\n */\nexport class NotFoundError extends ArkeError {\n constructor(resourceType: string, id: string) {\n super(`${resourceType} not found: ${id}`, 'NOT_FOUND', 404, { resourceType, id });\n this.name = 'NotFoundError';\n }\n}\n\n/**\n * Validation error - invalid request data\n */\nexport class ValidationError extends ArkeError {\n constructor(\n message: string,\n public readonly field?: string,\n details?: unknown\n ) {\n super(message, 'VALIDATION_ERROR', 400, details ?? { field });\n this.name = 'ValidationError';\n }\n}\n\n/**\n * Authentication required or invalid\n */\nexport class AuthenticationError extends ArkeError {\n constructor(message = 'Authentication required') {\n super(message, 'AUTH_REQUIRED', 401);\n this.name = 'AuthenticationError';\n }\n}\n\n/**\n * Permission denied\n */\nexport class ForbiddenError extends ArkeError {\n constructor(action?: string, resource?: string) {\n const msg = action\n ? `Permission denied: ${action}${resource ? ` on ${resource}` : ''}`\n : 'Permission denied';\n super(msg, 'FORBIDDEN', 403, { action, resource });\n this.name = 'ForbiddenError';\n }\n}\n\n/**\n * Parse API error response into appropriate error class\n */\nexport function parseApiError(status: number, body: unknown): ArkeError {\n const errorBody = body as { error?: string; message?: string; details?: unknown } | null;\n const message = errorBody?.error ?? errorBody?.message ?? 'Unknown error';\n\n switch (status) {\n case 400:\n return new ValidationError(message, undefined, errorBody?.details);\n\n case 401:\n return new AuthenticationError(message);\n\n case 403:\n return new ForbiddenError(message);\n\n case 404:\n return new NotFoundError('Resource', 'unknown');\n\n case 409: {\n // Parse CAS conflict details if available\n const details = errorBody?.details as { expected?: string; actual?: string } | undefined;\n return new CASConflictError(details?.expected, details?.actual);\n }\n\n default:\n return new ArkeError(message, 'API_ERROR', status, errorBody?.details);\n }\n}\n","/**\n * CID Computation Utility\n *\n * Computes IPFS CIDv1 (base32) for file content.\n * Uses raw codec (0x55) and SHA-256 hash.\n */\n\nimport { CID } from 'multiformats/cid';\nimport { sha256 } from 'multiformats/hashes/sha2';\nimport * as raw from 'multiformats/codecs/raw';\n\n/**\n * Compute CIDv1 for binary content.\n * Returns base32 encoded string (bafk... prefix for raw codec).\n *\n * @param data - Binary content as ArrayBuffer, Uint8Array, or Blob\n * @returns CIDv1 string in base32 encoding\n *\n * @example\n * ```typescript\n * const cid = await computeCid(new TextEncoder().encode('hello world'));\n * // Returns: \"bafkreifzjut3te2nhyekklss27nh3k72ysco7y32koao5eei66wof36n5e\"\n * ```\n */\nexport async function computeCid(data: ArrayBuffer | Uint8Array | Blob): Promise<string> {\n // Convert to Uint8Array\n let bytes: Uint8Array;\n\n if (data instanceof Blob) {\n const buffer = await data.arrayBuffer();\n bytes = new Uint8Array(buffer);\n } else if (data instanceof ArrayBuffer) {\n bytes = new Uint8Array(data);\n } else {\n bytes = data;\n }\n\n // Compute SHA-256 hash\n const hash = await sha256.digest(bytes);\n\n // Create CIDv1 with raw codec\n const cid = CID.create(1, raw.code, hash);\n\n // Return base32 encoded string\n return cid.toString();\n}\n\n/**\n * Verify a CID matches the content.\n *\n * @param data - Binary content\n * @param expectedCid - CID to verify against\n * @returns true if CID matches\n */\nexport async function verifyCid(\n data: ArrayBuffer | Uint8Array | Blob,\n expectedCid: string\n): Promise<boolean> {\n const computed = await computeCid(data);\n return computed === expectedCid;\n}\n","/**\n * Upload Engine\n *\n * Core upload implementation that handles the multi-phase upload process:\n * 1. Create collection (if needed)\n * 2. Compute CIDs for all files\n * 3. Create all entities (folders + files) in parallel\n * 4. Upload file content to presigned URLs\n * 5. Bulk link children to their parents\n */\n\nimport type { ArkeClient } from '../../client/ArkeClient.js';\nimport type { components } from '../../generated/types.js';\nimport { computeCid } from './cid.js';\nimport type {\n UploadTree,\n UploadOptions,\n UploadResult,\n UploadProgress,\n UploadFile,\n UploadFolder,\n PreparedFile,\n CreatedFolder,\n CreatedFile,\n CreatedEntity,\n} from './types.js';\n\ntype CreateCollectionRequest = components['schemas']['CreateCollectionRequest'];\ntype CreateFolderRequest = components['schemas']['CreateFolderRequest'];\ntype CreateFileRequest = components['schemas']['CreateFileRequest'];\ntype BulkAddChildrenRequest = components['schemas']['BulkAddChildrenRequest'];\n\n/**\n * Simple concurrency limiter for parallel operations.\n */\nasync function parallelLimit<T, R>(\n items: T[],\n concurrency: number,\n fn: (item: T, index: number) => Promise<R>\n): Promise<R[]> {\n const results: R[] = [];\n let index = 0;\n\n async function worker(): Promise<void> {\n while (index < items.length) {\n const currentIndex = index++;\n const item = items[currentIndex]!;\n results[currentIndex] = await fn(item, currentIndex);\n }\n }\n\n const workers = Array.from({ length: Math.min(concurrency, items.length) }, () => worker());\n await Promise.all(workers);\n\n return results;\n}\n\n/**\n * Parse folder path to get parent path.\n * e.g., \"docs/images/photos\" -> \"docs/images\"\n */\nfunction getParentPath(relativePath: string): string | null {\n const lastSlash = relativePath.lastIndexOf('/');\n if (lastSlash === -1) return null;\n return relativePath.slice(0, lastSlash);\n}\n\n/**\n * Get the immediate children paths for a given parent path.\n */\nfunction getImmediateChildren(\n parentPath: string | null,\n folders: UploadFolder[],\n files: PreparedFile[]\n): { folders: UploadFolder[]; files: PreparedFile[] } {\n const childFolders = folders.filter((f) => getParentPath(f.relativePath) === parentPath);\n const childFiles = files.filter((f) => getParentPath(f.relativePath) === parentPath);\n return { folders: childFolders, files: childFiles };\n}\n\n/**\n * Main upload function.\n * Orchestrates the entire upload process.\n */\nexport async function uploadTree(\n client: ArkeClient,\n tree: UploadTree,\n options: UploadOptions\n): Promise<UploadResult> {\n const { target, onProgress, concurrency = 5, continueOnError = false, note } = options;\n\n const errors: Array<{ path: string; error: string }> = [];\n const createdFolders: CreatedFolder[] = [];\n const createdFiles: CreatedFile[] = [];\n\n // Helper to report progress\n const reportProgress = (progress: Partial<UploadProgress>) => {\n if (onProgress) {\n onProgress({\n phase: 'scanning',\n totalFiles: tree.files.length,\n completedFiles: 0,\n totalFolders: tree.folders.length,\n completedFolders: 0,\n ...progress,\n } as UploadProgress);\n }\n };\n\n try {\n // ─────────────────────────────────────────────────────────────────────────\n // PHASE 1: Resolve or create collection\n // ─────────────────────────────────────────────────────────────────────────\n let collectionId: string;\n let collectionCid: string;\n let collectionCreated = false;\n\n if (target.createCollection) {\n reportProgress({ phase: 'scanning', currentFolder: 'Creating collection...' });\n\n const collectionBody: CreateCollectionRequest = {\n label: target.createCollection.label,\n description: target.createCollection.description,\n roles: target.createCollection.roles,\n note,\n };\n\n const { data, error } = await client.api.POST('/collections', {\n body: collectionBody,\n });\n\n if (error || !data) {\n throw new Error(`Failed to create collection: ${JSON.stringify(error)}`);\n }\n\n collectionId = data.id;\n collectionCid = data.cid;\n collectionCreated = true;\n } else if (target.collectionId) {\n collectionId = target.collectionId;\n\n // Fetch collection to get current CID\n const { data, error } = await client.api.GET('/collections/{id}', {\n params: { path: { id: collectionId } },\n });\n\n if (error || !data) {\n throw new Error(`Failed to fetch collection: ${JSON.stringify(error)}`);\n }\n\n collectionCid = data.cid;\n } else {\n throw new Error('Must provide either collectionId or createCollection in target');\n }\n\n // Determine the parent for root-level items\n const rootParentId = target.parentId ?? collectionId;\n\n // ─────────────────────────────────────────────────────────────────────────\n // PHASE 2: Compute CIDs for all files\n // ─────────────────────────────────────────────────────────────────────────\n reportProgress({\n phase: 'computing-cids',\n totalFiles: tree.files.length,\n completedFiles: 0,\n });\n\n const preparedFiles: PreparedFile[] = [];\n let cidProgress = 0;\n\n await parallelLimit(tree.files, concurrency, async (file) => {\n try {\n const data = await file.getData();\n const cid = await computeCid(data);\n\n preparedFiles.push({\n ...file,\n cid,\n });\n\n cidProgress++;\n reportProgress({\n phase: 'computing-cids',\n completedFiles: cidProgress,\n currentFile: file.relativePath,\n });\n } catch (err) {\n const errorMsg = err instanceof Error ? err.message : String(err);\n if (continueOnError) {\n errors.push({ path: file.relativePath, error: `CID computation failed: ${errorMsg}` });\n } else {\n throw new Error(`Failed to compute CID for ${file.relativePath}: ${errorMsg}`);\n }\n }\n });\n\n // ─────────────────────────────────────────────────────────────────────────\n // PHASE 3: Create all folder entities\n // ─────────────────────────────────────────────────────────────────────────\n reportProgress({\n phase: 'creating-folders',\n totalFolders: tree.folders.length,\n completedFolders: 0,\n });\n\n // Sort folders by depth (parents first)\n const sortedFolders = [...tree.folders].sort(\n (a, b) => a.relativePath.split('/').length - b.relativePath.split('/').length\n );\n\n // Create folders sequentially to ensure parents exist first\n // (We don't set parent relationships here - we'll do that in the linking phase)\n for (let i = 0; i < sortedFolders.length; i++) {\n const folder = sortedFolders[i]!;\n\n try {\n const folderBody: CreateFolderRequest = {\n label: folder.name,\n collection: collectionId,\n note,\n };\n\n const { data, error } = await client.api.POST('/folders', {\n body: folderBody,\n });\n\n if (error || !data) {\n throw new Error(JSON.stringify(error));\n }\n\n createdFolders.push({\n name: folder.name,\n relativePath: folder.relativePath,\n id: data.id,\n entityCid: data.cid,\n });\n\n reportProgress({\n phase: 'creating-folders',\n completedFolders: i + 1,\n currentFolder: folder.relativePath,\n });\n } catch (err) {\n const errorMsg = err instanceof Error ? err.message : String(err);\n if (continueOnError) {\n errors.push({ path: folder.relativePath, error: `Folder creation failed: ${errorMsg}` });\n } else {\n throw new Error(`Failed to create folder ${folder.relativePath}: ${errorMsg}`);\n }\n }\n }\n\n // Build folder path -> entity map for linking phase\n const folderPathToEntity = new Map<string, CreatedFolder>();\n for (const folder of createdFolders) {\n folderPathToEntity.set(folder.relativePath, folder);\n }\n\n // ─────────────────────────────────────────────────────────────────────────\n // PHASE 4: Create all file entities (parallel)\n // ─────────────────────────────────────────────────────────────────────────\n reportProgress({\n phase: 'creating-files',\n totalFiles: preparedFiles.length,\n completedFiles: 0,\n });\n\n let fileCreateProgress = 0;\n\n await parallelLimit(preparedFiles, concurrency, async (file) => {\n try {\n const fileBody: CreateFileRequest = {\n key: file.cid, // Use CID as storage key (best practice)\n filename: file.name,\n content_type: file.mimeType,\n size: file.size,\n cid: file.cid,\n collection: collectionId,\n };\n\n const { data, error } = await client.api.POST('/files', {\n body: fileBody,\n });\n\n if (error || !data) {\n throw new Error(JSON.stringify(error));\n }\n\n createdFiles.push({\n ...file,\n id: data.id,\n entityCid: data.cid,\n uploadUrl: data.upload_url,\n uploadExpiresAt: data.upload_expires_at,\n });\n\n fileCreateProgress++;\n reportProgress({\n phase: 'creating-files',\n completedFiles: fileCreateProgress,\n currentFile: file.relativePath,\n });\n } catch (err) {\n const errorMsg = err instanceof Error ? err.message : String(err);\n if (continueOnError) {\n errors.push({ path: file.relativePath, error: `File creation failed: ${errorMsg}` });\n } else {\n throw new Error(`Failed to create file ${file.relativePath}: ${errorMsg}`);\n }\n }\n });\n\n // ─────────────────────────────────────────────────────────────────────────\n // PHASE 5: Upload file content to presigned URLs\n // ─────────────────────────────────────────────────────────────────────────\n const totalBytes = createdFiles.reduce((sum, f) => sum + f.size, 0);\n let bytesUploaded = 0;\n\n reportProgress({\n phase: 'uploading-content',\n totalFiles: createdFiles.length,\n completedFiles: 0,\n totalBytes,\n bytesUploaded: 0,\n });\n\n let uploadProgress = 0;\n\n await parallelLimit(createdFiles, concurrency, async (file) => {\n try {\n // Get the file data again for upload\n const data = await file.getData();\n\n // Convert to appropriate format for fetch\n let body: Blob;\n if (data instanceof Blob) {\n body = data;\n } else if (data instanceof Uint8Array) {\n // Convert Uint8Array to Blob - copy to new ArrayBuffer to handle SharedArrayBuffer case\n const arrayBuffer = new ArrayBuffer(data.byteLength);\n new Uint8Array(arrayBuffer).set(data);\n body = new Blob([arrayBuffer], { type: file.mimeType });\n } else {\n // ArrayBuffer\n body = new Blob([data], { type: file.mimeType });\n }\n\n // Upload to presigned URL\n const response = await fetch(file.uploadUrl, {\n method: 'PUT',\n body,\n headers: {\n 'Content-Type': file.mimeType,\n },\n });\n\n if (!response.ok) {\n throw new Error(`Upload failed with status ${response.status}`);\n }\n\n bytesUploaded += file.size;\n uploadProgress++;\n\n reportProgress({\n phase: 'uploading-content',\n completedFiles: uploadProgress,\n currentFile: file.relativePath,\n bytesUploaded,\n totalBytes,\n });\n } catch (err) {\n const errorMsg = err instanceof Error ? err.message : String(err);\n if (continueOnError) {\n errors.push({ path: file.relativePath, error: `Upload failed: ${errorMsg}` });\n } else {\n throw new Error(`Failed to upload ${file.relativePath}: ${errorMsg}`);\n }\n }\n });\n\n // ─────────────────────────────────────────────────────────────────────────\n // PHASE 6: Link children to parents using bulk operations\n // ─────────────────────────────────────────────────────────────────────────\n reportProgress({ phase: 'linking' });\n\n // Build file path -> entity map\n const filePathToEntity = new Map<string, CreatedFile>();\n for (const file of createdFiles) {\n filePathToEntity.set(file.relativePath, file);\n }\n\n // Group items by their parent path\n // For root items (no parent path), parent is rootParentId (collection or specified folder)\n const parentGroups = new Map<string, { folderId: string; children: { id: string }[] }>();\n\n // Add folders to their parent groups\n for (const folder of createdFolders) {\n const parentPath = getParentPath(folder.relativePath);\n let parentId: string;\n\n if (parentPath === null) {\n // Root level folder - parent is the target\n parentId = rootParentId;\n } else {\n // Nested folder - find parent folder entity\n const parentFolder = folderPathToEntity.get(parentPath);\n if (!parentFolder) {\n errors.push({\n path: folder.relativePath,\n error: `Parent folder not found: ${parentPath}`,\n });\n continue;\n }\n parentId = parentFolder.id;\n }\n\n if (!parentGroups.has(parentId)) {\n parentGroups.set(parentId, { folderId: parentId, children: [] });\n }\n parentGroups.get(parentId)!.children.push({ id: folder.id });\n }\n\n // Add files to their parent groups\n for (const file of createdFiles) {\n const parentPath = getParentPath(file.relativePath);\n let parentId: string;\n\n if (parentPath === null) {\n // Root level file - parent is the target\n parentId = rootParentId;\n } else {\n // Nested file - find parent folder entity\n const parentFolder = folderPathToEntity.get(parentPath);\n if (!parentFolder) {\n errors.push({\n path: file.relativePath,\n error: `Parent folder not found: ${parentPath}`,\n });\n continue;\n }\n parentId = parentFolder.id;\n }\n\n if (!parentGroups.has(parentId)) {\n parentGroups.set(parentId, { folderId: parentId, children: [] });\n }\n parentGroups.get(parentId)!.children.push({ id: file.id });\n }\n\n // Execute bulk add children for each parent\n // We need to get current CID for each parent before linking\n for (const [parentId, group] of parentGroups) {\n if (group.children.length === 0) continue;\n\n try {\n // Get current parent CID\n // If parent is collection, we already have it. Otherwise fetch folder.\n let expectTip: string;\n\n if (parentId === collectionId) {\n // For collection, refetch to get current CID (might have changed)\n const { data, error } = await client.api.GET('/collections/{id}', {\n params: { path: { id: collectionId } },\n });\n if (error || !data) {\n throw new Error(`Failed to fetch collection CID: ${JSON.stringify(error)}`);\n }\n expectTip = data.cid;\n } else {\n // For folder, fetch current state\n const { data, error } = await client.api.GET('/folders/{id}', {\n params: { path: { id: parentId } },\n });\n if (error || !data) {\n throw new Error(`Failed to fetch folder CID: ${JSON.stringify(error)}`);\n }\n expectTip = data.cid;\n }\n\n // Bulk add children\n const bulkBody: BulkAddChildrenRequest = {\n expect_tip: expectTip,\n children: group.children,\n note,\n };\n\n const { error } = await client.api.POST('/folders/{id}/children/bulk', {\n params: { path: { id: parentId } },\n body: bulkBody,\n });\n\n if (error) {\n throw new Error(JSON.stringify(error));\n }\n } catch (err) {\n const errorMsg = err instanceof Error ? err.message : String(err);\n if (continueOnError) {\n errors.push({\n path: `parent:${parentId}`,\n error: `Bulk linking failed: ${errorMsg}`,\n });\n } else {\n throw new Error(`Failed to link children to ${parentId}: ${errorMsg}`);\n }\n }\n }\n\n // ─────────────────────────────────────────────────────────────────────────\n // Complete!\n // ─────────────────────────────────────────────────────────────────────────\n reportProgress({ phase: 'complete' });\n\n // Build result\n const resultFolders: CreatedEntity[] = createdFolders.map((f) => ({\n id: f.id,\n cid: f.entityCid,\n type: 'folder' as const,\n relativePath: f.relativePath,\n }));\n\n const resultFiles: CreatedEntity[] = createdFiles.map((f) => ({\n id: f.id,\n cid: f.entityCid,\n type: 'file' as const,\n relativePath: f.relativePath,\n }));\n\n return {\n success: errors.length === 0,\n collection: {\n id: collectionId,\n cid: collectionCid,\n created: collectionCreated,\n },\n folders: resultFolders,\n files: resultFiles,\n errors,\n };\n } catch (err) {\n const errorMsg = err instanceof Error ? err.message : String(err);\n\n reportProgress({\n phase: 'error',\n error: errorMsg,\n });\n\n return {\n success: false,\n collection: {\n id: target.collectionId ?? '',\n cid: '',\n created: false,\n },\n folders: createdFolders.map((f) => ({\n id: f.id,\n cid: f.entityCid,\n type: 'folder' as const,\n relativePath: f.relativePath,\n })),\n files: createdFiles.map((f) => ({\n id: f.id,\n cid: f.entityCid,\n type: 'file' as const,\n relativePath: f.relativePath,\n })),\n errors: [...errors, { path: '', error: errorMsg }],\n };\n }\n}\n","/**\n * Platform-specific Scanners\n *\n * Helpers to build UploadTree from different input sources.\n * These are optional utilities - users can also build UploadTree manually.\n */\n\n/// <reference lib=\"dom\" />\n\nimport type { UploadTree, UploadFile, UploadFolder } from './types.js';\n\n/**\n * Detect MIME type from filename.\n * Falls back to 'application/octet-stream' if unknown.\n */\nexport function getMimeType(filename: string): string {\n const ext = filename.toLowerCase().split('.').pop() || '';\n\n const mimeTypes: Record<string, string> = {\n // Images\n jpg: 'image/jpeg',\n jpeg: 'image/jpeg',\n png: 'image/png',\n gif: 'image/gif',\n webp: 'image/webp',\n svg: 'image/svg+xml',\n ico: 'image/x-icon',\n bmp: 'image/bmp',\n tiff: 'image/tiff',\n tif: 'image/tiff',\n\n // Documents\n pdf: 'application/pdf',\n doc: 'application/msword',\n docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',\n xls: 'application/vnd.ms-excel',\n xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',\n ppt: 'application/vnd.ms-powerpoint',\n pptx: 'application/vnd.openxmlformats-officedocument.presentationml.presentation',\n odt: 'application/vnd.oasis.opendocument.text',\n ods: 'application/vnd.oasis.opendocument.spreadsheet',\n odp: 'application/vnd.oasis.opendocument.presentation',\n\n // Text\n txt: 'text/plain',\n md: 'text/markdown',\n csv: 'text/csv',\n html: 'text/html',\n htm: 'text/html',\n css: 'text/css',\n xml: 'text/xml',\n rtf: 'application/rtf',\n\n // Code\n js: 'text/javascript',\n mjs: 'text/javascript',\n ts: 'text/typescript',\n jsx: 'text/javascript',\n tsx: 'text/typescript',\n json: 'application/json',\n yaml: 'text/yaml',\n yml: 'text/yaml',\n\n // Archives\n zip: 'application/zip',\n tar: 'application/x-tar',\n gz: 'application/gzip',\n rar: 'application/vnd.rar',\n '7z': 'application/x-7z-compressed',\n\n // Audio\n mp3: 'audio/mpeg',\n wav: 'audio/wav',\n ogg: 'audio/ogg',\n m4a: 'audio/mp4',\n flac: 'audio/flac',\n\n // Video\n mp4: 'video/mp4',\n webm: 'video/webm',\n avi: 'video/x-msvideo',\n mov: 'video/quicktime',\n mkv: 'video/x-matroska',\n\n // Fonts\n woff: 'font/woff',\n woff2: 'font/woff2',\n ttf: 'font/ttf',\n otf: 'font/otf',\n\n // Other\n wasm: 'application/wasm',\n };\n\n return mimeTypes[ext] || 'application/octet-stream';\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Node.js Scanner\n// ─────────────────────────────────────────────────────────────────────────────\n\n/**\n * Scan a local directory and build an UploadTree.\n *\n * **Node.js only** - uses fs and path modules.\n *\n * @param directoryPath - Absolute path to directory\n * @param options - Scanner options\n * @returns UploadTree ready for upload\n *\n * @example\n * ```typescript\n * import { scanDirectory } from '@arke-institute/sdk/operations';\n *\n * const tree = await scanDirectory('/path/to/my-project');\n * const result = await uploadTree(client, tree, { target: { collectionId: '...' } });\n * ```\n */\nexport async function scanDirectory(\n directoryPath: string,\n options: {\n /** Patterns to ignore (glob-style, e.g., 'node_modules', '.git') */\n ignore?: string[];\n /** Whether to include hidden files (default: false) */\n includeHidden?: boolean;\n } = {}\n): Promise<UploadTree> {\n // Dynamic import for Node.js modules (allows SDK to be used in browser too)\n const fs = await import('node:fs/promises');\n const path = await import('node:path');\n\n const { ignore = ['node_modules', '.git', '.DS_Store'], includeHidden = false } = options;\n\n const files: UploadFile[] = [];\n const folders: UploadFolder[] = [];\n\n // Get the root folder name\n const rootName = path.basename(directoryPath);\n\n async function scanDir(dirPath: string, relativePath: string): Promise<void> {\n const entries = await fs.readdir(dirPath, { withFileTypes: true });\n\n for (const entry of entries) {\n const name = entry.name;\n\n // Skip hidden files unless explicitly included\n if (!includeHidden && name.startsWith('.')) {\n continue;\n }\n\n // Skip ignored patterns\n if (ignore.some((pattern) => name === pattern || name.match(pattern))) {\n continue;\n }\n\n const fullPath = path.join(dirPath, name);\n const entryRelativePath = relativePath ? `${relativePath}/${name}` : name;\n\n if (entry.isDirectory()) {\n folders.push({\n name,\n relativePath: entryRelativePath,\n });\n\n // Recurse into subdirectory\n await scanDir(fullPath, entryRelativePath);\n } else if (entry.isFile()) {\n const stat = await fs.stat(fullPath);\n\n files.push({\n name,\n relativePath: entryRelativePath,\n size: stat.size,\n mimeType: getMimeType(name),\n getData: async () => {\n const buffer = await fs.readFile(fullPath);\n // Convert Node.js Buffer to ArrayBuffer\n return buffer.buffer.slice(buffer.byteOffset, buffer.byteOffset + buffer.byteLength);\n },\n });\n }\n // Skip symlinks, etc.\n }\n }\n\n await scanDir(directoryPath, '');\n\n // Sort folders by depth (important for creation order)\n folders.sort((a, b) => a.relativePath.split('/').length - b.relativePath.split('/').length);\n\n return { files, folders };\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Browser Scanners\n// ─────────────────────────────────────────────────────────────────────────────\n\n/**\n * Scan browser FileSystemEntry objects (from drag-drop or showDirectoryPicker).\n *\n * **Browser only** - uses FileSystemEntry API.\n *\n * @param entries - FileSystemEntry array from DataTransferItem.webkitGetAsEntry()\n * @returns UploadTree ready for upload\n *\n * @example\n * ```typescript\n * // In a drop handler\n * dropzone.ondrop = async (e) => {\n * const entries = Array.from(e.dataTransfer.items)\n * .map(item => item.webkitGetAsEntry())\n * .filter(Boolean);\n *\n * const tree = await scanFileSystemEntries(entries);\n * const result = await uploadTree(client, tree, { target: { collectionId: '...' } });\n * };\n * ```\n */\nexport async function scanFileSystemEntries(\n entries: FileSystemEntry[],\n options: {\n /** Patterns to ignore */\n ignore?: string[];\n } = {}\n): Promise<UploadTree> {\n const { ignore = ['node_modules', '.git', '.DS_Store'] } = options;\n\n const files: UploadFile[] = [];\n const folders: UploadFolder[] = [];\n\n async function processEntry(entry: FileSystemEntry, parentPath: string): Promise<void> {\n const name = entry.name;\n\n // Skip ignored patterns\n if (ignore.some((pattern) => name === pattern)) {\n return;\n }\n\n const relativePath = parentPath ? `${parentPath}/${name}` : name;\n\n if (entry.isFile) {\n const fileEntry = entry as FileSystemFileEntry;\n\n // Get File object from FileSystemFileEntry\n const file = await new Promise<File>((resolve, reject) => {\n fileEntry.file(resolve, reject);\n });\n\n files.push({\n name,\n relativePath,\n size: file.size,\n mimeType: file.type || getMimeType(name),\n getData: async () => file.arrayBuffer(),\n });\n } else if (entry.isDirectory) {\n const dirEntry = entry as FileSystemDirectoryEntry;\n\n folders.push({\n name,\n relativePath,\n });\n\n // Read directory contents\n const reader = dirEntry.createReader();\n const childEntries = await new Promise<FileSystemEntry[]>((resolve, reject) => {\n const allEntries: FileSystemEntry[] = [];\n\n function readEntries() {\n reader.readEntries((entries) => {\n if (entries.length === 0) {\n resolve(allEntries);\n } else {\n allEntries.push(...entries);\n readEntries(); // Continue reading (readEntries returns max 100 at a time)\n }\n }, reject);\n }\n\n readEntries();\n });\n\n // Process children\n for (const childEntry of childEntries) {\n await processEntry(childEntry, relativePath);\n }\n }\n }\n\n // Process all root entries\n for (const entry of entries) {\n if (entry) {\n await processEntry(entry, '');\n }\n }\n\n // Sort folders by depth\n folders.sort((a, b) => a.relativePath.split('/').length - b.relativePath.split('/').length);\n\n return { files, folders };\n}\n\n/**\n * Build UploadTree from a FileList (from <input type=\"file\"> with webkitdirectory).\n *\n * **Browser only** - uses File API.\n *\n * @param fileList - FileList from input element\n * @returns UploadTree ready for upload\n *\n * @example\n * ```typescript\n * <input type=\"file\" webkitdirectory multiple onChange={async (e) => {\n * const tree = await scanFileList(e.target.files);\n * const result = await uploadTree(client, tree, { target: { collectionId: '...' } });\n * }} />\n * ```\n */\nexport async function scanFileList(\n fileList: FileList,\n options: {\n /** Patterns to ignore */\n ignore?: string[];\n } = {}\n): Promise<UploadTree> {\n const { ignore = ['node_modules', '.git', '.DS_Store'] } = options;\n\n const files: UploadFile[] = [];\n const folderPaths = new Set<string>();\n\n for (let i = 0; i < fileList.length; i++) {\n const file = fileList[i];\n if (!file) continue;\n\n // webkitRelativePath gives us the path including the root folder\n const relativePath = file.webkitRelativePath || file.name;\n const name = file.name;\n\n // Skip ignored patterns (check each path segment)\n const pathSegments = relativePath.split('/');\n if (pathSegments.some((segment: string) => ignore.includes(segment))) {\n continue;\n }\n\n // Extract folder paths\n const pathParts = relativePath.split('/');\n for (let j = 1; j < pathParts.length; j++) {\n const folderPath = pathParts.slice(0, j).join('/');\n folderPaths.add(folderPath);\n }\n\n // Capture file reference for closure\n const fileRef = file;\n files.push({\n name,\n relativePath,\n size: fileRef.size,\n mimeType: fileRef.type || getMimeType(name),\n getData: async () => fileRef.arrayBuffer(),\n });\n }\n\n // Convert folder paths to UploadFolder objects\n const folders: UploadFolder[] = Array.from(folderPaths)\n .map((path) => ({\n name: path.split('/').pop()!,\n relativePath: path,\n }))\n .sort((a, b) => a.relativePath.split('/').length - b.relativePath.split('/').length);\n\n return { files, folders };\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Utility: Build tree from flat file list\n// ─────────────────────────────────────────────────────────────────────────────\n\n/**\n * Build an UploadTree from a flat array of files with paths.\n *\n * Useful for programmatically constructing uploads without filesystem access.\n *\n * @param items - Array of file items with path, data, and optional metadata\n * @returns UploadTree ready for upload\n *\n * @example\n * ```typescript\n * const tree = buildUploadTree([\n * { path: 'docs/readme.md', data: new Blob(['# Hello']) },\n * { path: 'docs/images/logo.png', data: logoBlob },\n * ]);\n * ```\n */\nexport function buildUploadTree(\n items: Array<{\n /** Relative path (e.g., \"docs/readme.md\") */\n path: string;\n /** File data */\n data: Blob | ArrayBuffer | Uint8Array;\n /** MIME type (auto-detected if not provided) */\n mimeType?: string;\n }>\n): UploadTree {\n const files: UploadFile[] = [];\n const folderPaths = new Set<string>();\n\n for (const item of items) {\n const pathParts = item.path.split('/');\n const name = pathParts.pop()!;\n\n // Extract folder paths\n for (let i = 1; i <= pathParts.length; i++) {\n folderPaths.add(pathParts.slice(0, i).join('/'));\n }\n\n // Determine size\n let size: number;\n if (item.data instanceof Blob) {\n size = item.data.size;\n } else if (item.data instanceof ArrayBuffer) {\n size = item.data.byteLength;\n } else {\n size = item.data.length;\n }\n\n files.push({\n name,\n relativePath: item.path,\n size,\n mimeType: item.mimeType || getMimeType(name),\n getData: async () => item.data,\n });\n }\n\n const folders: UploadFolder[] = Array.from(folderPaths)\n .map((path) => ({\n name: path.split('/').pop()!,\n relativePath: path,\n }))\n .sort((a, b) => a.relativePath.split('/').length - b.relativePath.split('/').length);\n\n return { files, folders };\n}\n","/**\n * Folder Operations (Legacy)\n *\n * @deprecated Use the new upload module instead:\n * ```typescript\n * import { uploadTree, scanDirectory } from '@arke-institute/sdk/operations';\n *\n * const tree = await scanDirectory('/path/to/folder');\n * const result = await uploadTree(client, tree, {\n * target: { collectionId: '...' },\n * });\n * ```\n */\n\nimport type { ArkeClient } from '../client/ArkeClient.js';\nimport { uploadTree, scanDirectory, type UploadResult } from './upload/index.js';\n\n/**\n * @deprecated Use UploadProgress from upload module\n */\nexport interface UploadProgress {\n phase: 'scanning' | 'creating-folders' | 'uploading-files' | 'linking' | 'complete';\n totalFiles: number;\n completedFiles: number;\n totalFolders: number;\n completedFolders: number;\n currentFile?: string;\n}\n\n/**\n * @deprecated Use UploadOptions from upload module\n */\nexport interface UploadDirectoryOptions {\n /** Collection to upload into */\n collectionId: string;\n /** Parent folder ID (optional - creates at root if not provided) */\n parentFolderId?: string;\n /** Progress callback */\n onProgress?: (progress: UploadProgress) => void;\n /** Max concurrent uploads */\n concurrency?: number;\n}\n\n/**\n * @deprecated Use UploadResult from upload module\n */\nexport interface UploadDirectoryResult {\n /** Root folder entity */\n rootFolder: unknown;\n /** All created folder entities */\n folders: unknown[];\n /** All created file entities */\n files: unknown[];\n}\n\n/**\n * Folder operations helper\n *\n * @deprecated Use uploadTree and scanDirectory functions instead:\n * ```typescript\n * import { uploadTree, scanDirectory } from '@arke-institute/sdk/operations';\n *\n * const tree = await scanDirectory('/path/to/folder');\n * const result = await uploadTree(client, tree, {\n * target: { collectionId: '...' },\n * onProgress: (p) => console.log(`${p.completedFiles}/${p.totalFiles} files`),\n * });\n * ```\n */\nexport class FolderOperations {\n constructor(private client: ArkeClient) {}\n\n /**\n * Upload a local directory to Arke\n *\n * @deprecated Use uploadTree and scanDirectory instead\n */\n async uploadDirectory(\n localPath: string,\n options: UploadDirectoryOptions\n ): Promise<UploadDirectoryResult> {\n // Use the new implementation\n const tree = await scanDirectory(localPath);\n\n const result: UploadResult = await uploadTree(this.client, tree, {\n target: {\n collectionId: options.collectionId,\n parentId: options.parentFolderId,\n },\n concurrency: options.concurrency,\n onProgress: options.onProgress\n ? (p) => {\n // Map new progress to old format\n options.onProgress!({\n phase:\n p.phase === 'computing-cids' || p.phase === 'creating-folders'\n ? 'creating-folders'\n : p.phase === 'creating-files' || p.phase === 'uploading-content'\n ? 'uploading-files'\n : p.phase === 'linking'\n ? 'linking'\n : p.phase === 'complete'\n ? 'complete'\n : 'scanning',\n totalFiles: p.totalFiles,\n completedFiles: p.completedFiles,\n totalFolders: p.totalFolders,\n completedFolders: p.completedFolders,\n currentFile: p.currentFile,\n });\n }\n : undefined,\n });\n\n return {\n rootFolder: result.folders[0] || null,\n folders: result.folders,\n files: result.files,\n };\n }\n}\n","/**\n * Batch Operations\n *\n * High-level operations for bulk entity and relationship management.\n *\n * TODO: Implement batch operations\n * - createEntities: Create multiple entities in parallel\n * - updateEntities: Update multiple entities in parallel\n * - createRelationships: Create multiple relationships in parallel\n */\n\nimport type { ArkeClient } from '../client/ArkeClient.js';\n\nexport interface BatchCreateOptions {\n /** Max concurrent operations */\n concurrency?: number;\n /** Continue on individual failures */\n continueOnError?: boolean;\n /** Progress callback */\n onProgress?: (completed: number, total: number) => void;\n}\n\nexport interface BatchResult<T> {\n /** Successfully completed operations */\n succeeded: T[];\n /** Failed operations with errors */\n failed: Array<{ input: unknown; error: Error }>;\n}\n\n/**\n * Batch operations helper\n *\n * @example\n * ```typescript\n * const batch = new BatchOperations(arkeClient);\n * const result = await batch.createEntities([\n * { type: 'document', properties: { title: 'Doc 1' } },\n * { type: 'document', properties: { title: 'Doc 2' } },\n * ], { concurrency: 5 });\n * ```\n */\nexport class BatchOperations {\n constructor(private client: ArkeClient) {}\n\n /**\n * Create multiple entities in parallel\n *\n * TODO: Implement this method\n */\n async createEntities(\n _entities: Array<{\n collectionId: string;\n type: string;\n properties?: Record<string, unknown>;\n }>,\n _options?: BatchCreateOptions\n ): Promise<BatchResult<unknown>> {\n throw new Error('BatchOperations.createEntities is not yet implemented');\n }\n\n /**\n * Create multiple relationships in parallel\n *\n * TODO: Implement this method\n */\n async createRelationships(\n _relationships: Array<{\n sourceId: string;\n targetId: string;\n predicate: string;\n bidirectional?: boolean;\n properties?: Record<string, unknown>;\n }>,\n _options?: BatchCreateOptions\n ): Promise<BatchResult<unknown>> {\n throw new Error('BatchOperations.createRelationships is not yet implemented');\n }\n}\n","/**\n * Crypto Operations\n *\n * Cryptographic utilities for agents and content addressing.\n *\n * TODO: Implement crypto operations\n * - generateKeyPair: Generate Ed25519 key pair for agent authentication\n * - signPayload: Sign a payload with agent private key\n * - computeCID: Compute IPFS CID for content\n */\n\n/**\n * Ed25519 key pair for agent authentication\n */\nexport interface KeyPair {\n /** Public key in base64 */\n publicKey: string;\n /** Private key in base64 (keep secret!) */\n privateKey: string;\n}\n\n/**\n * Signed payload with signature\n */\nexport interface SignedPayload {\n /** Original payload */\n payload: string;\n /** Ed25519 signature in base64 */\n signature: string;\n /** Timestamp of signature */\n timestamp: number;\n}\n\n/**\n * Crypto operations helper\n *\n * @example\n * ```typescript\n * // Generate key pair for a new agent\n * const { publicKey, privateKey } = await CryptoOperations.generateKeyPair();\n *\n * // Sign a payload\n * const signed = await CryptoOperations.signPayload(privateKey, payload);\n * ```\n */\nexport class CryptoOperations {\n /**\n * Generate an Ed25519 key pair for agent authentication\n *\n * TODO: Implement using Node.js crypto or Web Crypto API\n */\n static async generateKeyPair(): Promise<KeyPair> {\n throw new Error('CryptoOperations.generateKeyPair is not yet implemented');\n }\n\n /**\n * Sign a payload with an Ed25519 private key\n *\n * TODO: Implement signature generation\n */\n static async signPayload(_privateKey: string, _payload: string): Promise<SignedPayload> {\n throw new Error('CryptoOperations.signPayload is not yet implemented');\n }\n\n /**\n * Verify an Ed25519 signature\n *\n * TODO: Implement signature verification\n */\n static async verifySignature(\n _publicKey: string,\n _payload: string,\n _signature: string\n ): Promise<boolean> {\n throw new Error('CryptoOperations.verifySignature is not yet implemented');\n }\n\n /**\n * Compute IPFS CID for content\n *\n * TODO: Implement using multiformats library\n */\n static async computeCID(_content: Uint8Array): Promise<string> {\n throw new Error('CryptoOperations.computeCID is not yet implemented');\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACMA,2BAA0C;;;AC6BnC,IAAM,iBAA0E;AAAA,EACrF,SAAS;AAAA,EACT,SAAS;AACX;;;AC/BO,IAAM,YAAN,cAAwB,MAAM;AAAA,EACnC,YACE,SACgBA,OACA,QACA,SAChB;AACA,UAAM,OAAO;AAJG,gBAAAA;AACA;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AOA,aAAa,YAAY,aAAqB,UAA0C;AACtF,UAAM,IAAI,MAAM,qDAAqD;AAAA,EACvE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,aAAa,gBACX,YACA,UACA,YACkB;AAClB,UAAM,IAAI,MAAM,yDAAyD;AAAA,EAC3E;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,aAAa,WAAW,UAAuC;AAC7D,UAAM,IAAI,MAAM,oDAAoD;AAAA,EACtE;AACF;","names":["code","createClient","error"]}
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- export { a as ArkeApiClient, A as ArkeClient, b as ArkeClientConfig, f as BatchCreateOptions, B as BatchOperations, g as BatchResult, C as CryptoOperations, D as DEFAULT_CONFIG, F as FolderOperations, K as KeyPair, S as SignedPayload, d as UploadDirectoryOptions, e as UploadDirectoryResult, U as UploadProgress, c as createArkeClient } from './index-FHcLPBSV.cjs';
1
+ export { a as ArkeApiClient, A as ArkeClient, b as ArkeClientConfig, f as BatchCreateOptions, B as BatchOperations, g as BatchResult, C as CryptoOperations, D as DEFAULT_CONFIG, F as FolderOperations, K as KeyPair, S as SignedPayload, d as UploadDirectoryOptions, e as UploadDirectoryResult, U as UploadProgress, c as createArkeClient } from './crypto-iYgzUi77.cjs';
2
2
  export { components, operations, paths } from './generated/index.cjs';
3
3
  import 'openapi-fetch';
4
4
 
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { a as ArkeApiClient, A as ArkeClient, b as ArkeClientConfig, f as BatchCreateOptions, B as BatchOperations, g as BatchResult, C as CryptoOperations, D as DEFAULT_CONFIG, F as FolderOperations, K as KeyPair, S as SignedPayload, d as UploadDirectoryOptions, e as UploadDirectoryResult, U as UploadProgress, c as createArkeClient } from './index-BrXke2kI.js';
1
+ export { a as ArkeApiClient, A as ArkeClient, b as ArkeClientConfig, f as BatchCreateOptions, B as BatchOperations, g as BatchResult, C as CryptoOperations, D as DEFAULT_CONFIG, F as FolderOperations, K as KeyPair, S as SignedPayload, d as UploadDirectoryOptions, e as UploadDirectoryResult, U as UploadProgress, c as createArkeClient } from './crypto-CQnwqWQn.js';
2
2
  export { components, operations, paths } from './generated/index.js';
3
3
  import 'openapi-fetch';
4
4