@arke-institute/sdk 0.1.3 → 2.0.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 +126 -184
- package/dist/generated/index.cjs +19 -0
- package/dist/generated/index.cjs.map +1 -0
- package/dist/generated/index.d.cts +6192 -0
- package/dist/generated/index.d.ts +6192 -0
- package/dist/generated/index.js +1 -0
- package/dist/generated/index.js.map +1 -0
- package/dist/index-BrXke2kI.d.ts +302 -0
- package/dist/index-FHcLPBSV.d.cts +302 -0
- package/dist/index.cjs +188 -4254
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +62 -7
- package/dist/index.d.ts +62 -7
- package/dist/index.js +168 -4226
- package/dist/index.js.map +1 -1
- package/dist/operations/index.cjs +113 -0
- package/dist/operations/index.cjs.map +1 -0
- package/dist/operations/index.d.cts +3 -0
- package/dist/operations/index.d.ts +3 -0
- package/dist/operations/index.js +84 -0
- package/dist/operations/index.js.map +1 -0
- package/package.json +44 -53
- package/dist/client-dAk3E64p.d.cts +0 -183
- package/dist/client-dAk3E64p.d.ts +0 -183
- package/dist/collections/index.cjs +0 -233
- package/dist/collections/index.cjs.map +0 -1
- package/dist/collections/index.d.cts +0 -9
- package/dist/collections/index.d.ts +0 -9
- package/dist/collections/index.js +0 -205
- package/dist/collections/index.js.map +0 -1
- package/dist/content/index.cjs +0 -591
- package/dist/content/index.cjs.map +0 -1
- package/dist/content/index.d.cts +0 -516
- package/dist/content/index.d.ts +0 -516
- package/dist/content/index.js +0 -558
- package/dist/content/index.js.map +0 -1
- package/dist/edit/index.cjs +0 -1503
- package/dist/edit/index.cjs.map +0 -1
- package/dist/edit/index.d.cts +0 -78
- package/dist/edit/index.d.ts +0 -78
- package/dist/edit/index.js +0 -1447
- package/dist/edit/index.js.map +0 -1
- package/dist/errors-3L7IiHcr.d.cts +0 -480
- package/dist/errors-BTe8GKRQ.d.ts +0 -480
- package/dist/errors-CT7yzKkU.d.cts +0 -874
- package/dist/errors-CT7yzKkU.d.ts +0 -874
- package/dist/graph/index.cjs +0 -427
- package/dist/graph/index.cjs.map +0 -1
- package/dist/graph/index.d.cts +0 -485
- package/dist/graph/index.d.ts +0 -485
- package/dist/graph/index.js +0 -396
- package/dist/graph/index.js.map +0 -1
- package/dist/query/index.cjs +0 -356
- package/dist/query/index.cjs.map +0 -1
- package/dist/query/index.d.cts +0 -636
- package/dist/query/index.d.ts +0 -636
- package/dist/query/index.js +0 -328
- package/dist/query/index.js.map +0 -1
- package/dist/upload/index.cjs +0 -1634
- package/dist/upload/index.cjs.map +0 -1
- package/dist/upload/index.d.cts +0 -150
- package/dist/upload/index.d.ts +0 -150
- package/dist/upload/index.js +0 -1597
- package/dist/upload/index.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
import { Client } from 'openapi-fetch';
|
|
2
|
+
import { paths } from './generated/index.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* SDK configuration types
|
|
6
|
+
*/
|
|
7
|
+
interface ArkeClientConfig {
|
|
8
|
+
/**
|
|
9
|
+
* Base URL for the Arke API
|
|
10
|
+
* @default 'https://arke-v1.arke.institute'
|
|
11
|
+
*/
|
|
12
|
+
baseUrl?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Authentication token (JWT or API key)
|
|
15
|
+
*/
|
|
16
|
+
authToken?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Network to use ('main' or 'test')
|
|
19
|
+
* Test network uses 'II' prefixed IDs and isolated data
|
|
20
|
+
* @default 'main'
|
|
21
|
+
*/
|
|
22
|
+
network?: 'main' | 'test';
|
|
23
|
+
/**
|
|
24
|
+
* Callback to refresh auth token when expired
|
|
25
|
+
* Called automatically on 401 responses
|
|
26
|
+
*/
|
|
27
|
+
onTokenRefresh?: () => Promise<string>;
|
|
28
|
+
/**
|
|
29
|
+
* Custom headers to include in all requests
|
|
30
|
+
*/
|
|
31
|
+
headers?: Record<string, string>;
|
|
32
|
+
}
|
|
33
|
+
declare const DEFAULT_CONFIG: Required<Pick<ArkeClientConfig, 'baseUrl' | 'network'>>;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Main Arke SDK Client
|
|
37
|
+
*
|
|
38
|
+
* Provides type-safe access to the Arke API using openapi-fetch.
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
type ArkeApiClient = Client<paths>;
|
|
42
|
+
/**
|
|
43
|
+
* Type-safe client for the Arke API
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```typescript
|
|
47
|
+
* const arke = new ArkeClient({ authToken: 'your-jwt-token' });
|
|
48
|
+
*
|
|
49
|
+
* // Create an entity
|
|
50
|
+
* const { data, error } = await arke.api.POST('/entities', {
|
|
51
|
+
* body: {
|
|
52
|
+
* collection_id: '01ABC...',
|
|
53
|
+
* type: 'document',
|
|
54
|
+
* properties: { title: 'My Document' }
|
|
55
|
+
* }
|
|
56
|
+
* });
|
|
57
|
+
*
|
|
58
|
+
* // Get an entity
|
|
59
|
+
* const { data } = await arke.api.GET('/entities/{id}', {
|
|
60
|
+
* params: { path: { id: '01XYZ...' } }
|
|
61
|
+
* });
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
declare class ArkeClient {
|
|
65
|
+
/**
|
|
66
|
+
* The underlying openapi-fetch client with full type safety
|
|
67
|
+
* Use this for all API calls: arke.api.GET, arke.api.POST, etc.
|
|
68
|
+
*/
|
|
69
|
+
api: ArkeApiClient;
|
|
70
|
+
private config;
|
|
71
|
+
constructor(config?: ArkeClientConfig);
|
|
72
|
+
private createClient;
|
|
73
|
+
/**
|
|
74
|
+
* Update the authentication token
|
|
75
|
+
* Recreates the underlying client with new headers
|
|
76
|
+
*/
|
|
77
|
+
setAuthToken(token: string): void;
|
|
78
|
+
/**
|
|
79
|
+
* Clear the authentication token
|
|
80
|
+
*/
|
|
81
|
+
clearAuthToken(): void;
|
|
82
|
+
/**
|
|
83
|
+
* Get the current configuration
|
|
84
|
+
*/
|
|
85
|
+
getConfig(): Readonly<ArkeClientConfig>;
|
|
86
|
+
/**
|
|
87
|
+
* Get the base URL
|
|
88
|
+
*/
|
|
89
|
+
get baseUrl(): string;
|
|
90
|
+
/**
|
|
91
|
+
* Check if client is authenticated
|
|
92
|
+
*/
|
|
93
|
+
get isAuthenticated(): boolean;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Create a new ArkeClient instance
|
|
97
|
+
* Convenience function for those who prefer functional style
|
|
98
|
+
*/
|
|
99
|
+
declare function createArkeClient(config?: ArkeClientConfig): ArkeClient;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Folder Operations
|
|
103
|
+
*
|
|
104
|
+
* High-level operations for working with folders and directory structures.
|
|
105
|
+
*
|
|
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
|
|
110
|
+
*/
|
|
111
|
+
|
|
112
|
+
interface UploadProgress {
|
|
113
|
+
phase: 'scanning' | 'creating-folders' | 'uploading-files' | 'linking' | 'complete';
|
|
114
|
+
totalFiles: number;
|
|
115
|
+
completedFiles: number;
|
|
116
|
+
totalFolders: number;
|
|
117
|
+
completedFolders: number;
|
|
118
|
+
currentFile?: string;
|
|
119
|
+
}
|
|
120
|
+
interface UploadDirectoryOptions {
|
|
121
|
+
/** Collection to upload into */
|
|
122
|
+
collectionId: string;
|
|
123
|
+
/** Parent folder ID (optional - creates at root if not provided) */
|
|
124
|
+
parentFolderId?: string;
|
|
125
|
+
/** Progress callback */
|
|
126
|
+
onProgress?: (progress: UploadProgress) => void;
|
|
127
|
+
/** Max concurrent uploads */
|
|
128
|
+
concurrency?: number;
|
|
129
|
+
}
|
|
130
|
+
interface UploadDirectoryResult {
|
|
131
|
+
/** Root folder entity */
|
|
132
|
+
rootFolder: unknown;
|
|
133
|
+
/** All created folder entities */
|
|
134
|
+
folders: unknown[];
|
|
135
|
+
/** All created file entities */
|
|
136
|
+
files: unknown[];
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Folder operations helper
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
* ```typescript
|
|
143
|
+
* const folders = new FolderOperations(arkeClient);
|
|
144
|
+
* const result = await folders.uploadDirectory('/path/to/local/folder', {
|
|
145
|
+
* collectionId: '01ABC...',
|
|
146
|
+
* onProgress: (p) => console.log(`${p.completedFiles}/${p.totalFiles} files`),
|
|
147
|
+
* });
|
|
148
|
+
* ```
|
|
149
|
+
*/
|
|
150
|
+
declare class FolderOperations {
|
|
151
|
+
private client;
|
|
152
|
+
constructor(client: ArkeClient);
|
|
153
|
+
/**
|
|
154
|
+
* Upload a local directory to Arke
|
|
155
|
+
*
|
|
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)
|
|
162
|
+
*/
|
|
163
|
+
uploadDirectory(_localPath: string, _options: UploadDirectoryOptions): Promise<UploadDirectoryResult>;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Batch Operations
|
|
168
|
+
*
|
|
169
|
+
* High-level operations for bulk entity and relationship management.
|
|
170
|
+
*
|
|
171
|
+
* TODO: Implement batch operations
|
|
172
|
+
* - createEntities: Create multiple entities in parallel
|
|
173
|
+
* - updateEntities: Update multiple entities in parallel
|
|
174
|
+
* - createRelationships: Create multiple relationships in parallel
|
|
175
|
+
*/
|
|
176
|
+
|
|
177
|
+
interface BatchCreateOptions {
|
|
178
|
+
/** Max concurrent operations */
|
|
179
|
+
concurrency?: number;
|
|
180
|
+
/** Continue on individual failures */
|
|
181
|
+
continueOnError?: boolean;
|
|
182
|
+
/** Progress callback */
|
|
183
|
+
onProgress?: (completed: number, total: number) => void;
|
|
184
|
+
}
|
|
185
|
+
interface BatchResult<T> {
|
|
186
|
+
/** Successfully completed operations */
|
|
187
|
+
succeeded: T[];
|
|
188
|
+
/** Failed operations with errors */
|
|
189
|
+
failed: Array<{
|
|
190
|
+
input: unknown;
|
|
191
|
+
error: Error;
|
|
192
|
+
}>;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Batch operations helper
|
|
196
|
+
*
|
|
197
|
+
* @example
|
|
198
|
+
* ```typescript
|
|
199
|
+
* const batch = new BatchOperations(arkeClient);
|
|
200
|
+
* const result = await batch.createEntities([
|
|
201
|
+
* { type: 'document', properties: { title: 'Doc 1' } },
|
|
202
|
+
* { type: 'document', properties: { title: 'Doc 2' } },
|
|
203
|
+
* ], { concurrency: 5 });
|
|
204
|
+
* ```
|
|
205
|
+
*/
|
|
206
|
+
declare class BatchOperations {
|
|
207
|
+
private client;
|
|
208
|
+
constructor(client: ArkeClient);
|
|
209
|
+
/**
|
|
210
|
+
* Create multiple entities in parallel
|
|
211
|
+
*
|
|
212
|
+
* TODO: Implement this method
|
|
213
|
+
*/
|
|
214
|
+
createEntities(_entities: Array<{
|
|
215
|
+
collectionId: string;
|
|
216
|
+
type: string;
|
|
217
|
+
properties?: Record<string, unknown>;
|
|
218
|
+
}>, _options?: BatchCreateOptions): Promise<BatchResult<unknown>>;
|
|
219
|
+
/**
|
|
220
|
+
* Create multiple relationships in parallel
|
|
221
|
+
*
|
|
222
|
+
* TODO: Implement this method
|
|
223
|
+
*/
|
|
224
|
+
createRelationships(_relationships: Array<{
|
|
225
|
+
sourceId: string;
|
|
226
|
+
targetId: string;
|
|
227
|
+
predicate: string;
|
|
228
|
+
bidirectional?: boolean;
|
|
229
|
+
properties?: Record<string, unknown>;
|
|
230
|
+
}>, _options?: BatchCreateOptions): Promise<BatchResult<unknown>>;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Crypto Operations
|
|
235
|
+
*
|
|
236
|
+
* Cryptographic utilities for agents and content addressing.
|
|
237
|
+
*
|
|
238
|
+
* TODO: Implement crypto operations
|
|
239
|
+
* - generateKeyPair: Generate Ed25519 key pair for agent authentication
|
|
240
|
+
* - signPayload: Sign a payload with agent private key
|
|
241
|
+
* - computeCID: Compute IPFS CID for content
|
|
242
|
+
*/
|
|
243
|
+
/**
|
|
244
|
+
* Ed25519 key pair for agent authentication
|
|
245
|
+
*/
|
|
246
|
+
interface KeyPair {
|
|
247
|
+
/** Public key in base64 */
|
|
248
|
+
publicKey: string;
|
|
249
|
+
/** Private key in base64 (keep secret!) */
|
|
250
|
+
privateKey: string;
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Signed payload with signature
|
|
254
|
+
*/
|
|
255
|
+
interface SignedPayload {
|
|
256
|
+
/** Original payload */
|
|
257
|
+
payload: string;
|
|
258
|
+
/** Ed25519 signature in base64 */
|
|
259
|
+
signature: string;
|
|
260
|
+
/** Timestamp of signature */
|
|
261
|
+
timestamp: number;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Crypto operations helper
|
|
265
|
+
*
|
|
266
|
+
* @example
|
|
267
|
+
* ```typescript
|
|
268
|
+
* // Generate key pair for a new agent
|
|
269
|
+
* const { publicKey, privateKey } = await CryptoOperations.generateKeyPair();
|
|
270
|
+
*
|
|
271
|
+
* // Sign a payload
|
|
272
|
+
* const signed = await CryptoOperations.signPayload(privateKey, payload);
|
|
273
|
+
* ```
|
|
274
|
+
*/
|
|
275
|
+
declare class CryptoOperations {
|
|
276
|
+
/**
|
|
277
|
+
* Generate an Ed25519 key pair for agent authentication
|
|
278
|
+
*
|
|
279
|
+
* TODO: Implement using Node.js crypto or Web Crypto API
|
|
280
|
+
*/
|
|
281
|
+
static generateKeyPair(): Promise<KeyPair>;
|
|
282
|
+
/**
|
|
283
|
+
* Sign a payload with an Ed25519 private key
|
|
284
|
+
*
|
|
285
|
+
* TODO: Implement signature generation
|
|
286
|
+
*/
|
|
287
|
+
static signPayload(_privateKey: string, _payload: string): Promise<SignedPayload>;
|
|
288
|
+
/**
|
|
289
|
+
* Verify an Ed25519 signature
|
|
290
|
+
*
|
|
291
|
+
* TODO: Implement signature verification
|
|
292
|
+
*/
|
|
293
|
+
static verifySignature(_publicKey: string, _payload: string, _signature: string): Promise<boolean>;
|
|
294
|
+
/**
|
|
295
|
+
* Compute IPFS CID for content
|
|
296
|
+
*
|
|
297
|
+
* TODO: Implement using multiformats library
|
|
298
|
+
*/
|
|
299
|
+
static computeCID(_content: Uint8Array): Promise<string>;
|
|
300
|
+
}
|
|
301
|
+
|
|
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 };
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
import { Client } from 'openapi-fetch';
|
|
2
|
+
import { paths } from './generated/index.cjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* SDK configuration types
|
|
6
|
+
*/
|
|
7
|
+
interface ArkeClientConfig {
|
|
8
|
+
/**
|
|
9
|
+
* Base URL for the Arke API
|
|
10
|
+
* @default 'https://arke-v1.arke.institute'
|
|
11
|
+
*/
|
|
12
|
+
baseUrl?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Authentication token (JWT or API key)
|
|
15
|
+
*/
|
|
16
|
+
authToken?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Network to use ('main' or 'test')
|
|
19
|
+
* Test network uses 'II' prefixed IDs and isolated data
|
|
20
|
+
* @default 'main'
|
|
21
|
+
*/
|
|
22
|
+
network?: 'main' | 'test';
|
|
23
|
+
/**
|
|
24
|
+
* Callback to refresh auth token when expired
|
|
25
|
+
* Called automatically on 401 responses
|
|
26
|
+
*/
|
|
27
|
+
onTokenRefresh?: () => Promise<string>;
|
|
28
|
+
/**
|
|
29
|
+
* Custom headers to include in all requests
|
|
30
|
+
*/
|
|
31
|
+
headers?: Record<string, string>;
|
|
32
|
+
}
|
|
33
|
+
declare const DEFAULT_CONFIG: Required<Pick<ArkeClientConfig, 'baseUrl' | 'network'>>;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Main Arke SDK Client
|
|
37
|
+
*
|
|
38
|
+
* Provides type-safe access to the Arke API using openapi-fetch.
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
type ArkeApiClient = Client<paths>;
|
|
42
|
+
/**
|
|
43
|
+
* Type-safe client for the Arke API
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```typescript
|
|
47
|
+
* const arke = new ArkeClient({ authToken: 'your-jwt-token' });
|
|
48
|
+
*
|
|
49
|
+
* // Create an entity
|
|
50
|
+
* const { data, error } = await arke.api.POST('/entities', {
|
|
51
|
+
* body: {
|
|
52
|
+
* collection_id: '01ABC...',
|
|
53
|
+
* type: 'document',
|
|
54
|
+
* properties: { title: 'My Document' }
|
|
55
|
+
* }
|
|
56
|
+
* });
|
|
57
|
+
*
|
|
58
|
+
* // Get an entity
|
|
59
|
+
* const { data } = await arke.api.GET('/entities/{id}', {
|
|
60
|
+
* params: { path: { id: '01XYZ...' } }
|
|
61
|
+
* });
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
declare class ArkeClient {
|
|
65
|
+
/**
|
|
66
|
+
* The underlying openapi-fetch client with full type safety
|
|
67
|
+
* Use this for all API calls: arke.api.GET, arke.api.POST, etc.
|
|
68
|
+
*/
|
|
69
|
+
api: ArkeApiClient;
|
|
70
|
+
private config;
|
|
71
|
+
constructor(config?: ArkeClientConfig);
|
|
72
|
+
private createClient;
|
|
73
|
+
/**
|
|
74
|
+
* Update the authentication token
|
|
75
|
+
* Recreates the underlying client with new headers
|
|
76
|
+
*/
|
|
77
|
+
setAuthToken(token: string): void;
|
|
78
|
+
/**
|
|
79
|
+
* Clear the authentication token
|
|
80
|
+
*/
|
|
81
|
+
clearAuthToken(): void;
|
|
82
|
+
/**
|
|
83
|
+
* Get the current configuration
|
|
84
|
+
*/
|
|
85
|
+
getConfig(): Readonly<ArkeClientConfig>;
|
|
86
|
+
/**
|
|
87
|
+
* Get the base URL
|
|
88
|
+
*/
|
|
89
|
+
get baseUrl(): string;
|
|
90
|
+
/**
|
|
91
|
+
* Check if client is authenticated
|
|
92
|
+
*/
|
|
93
|
+
get isAuthenticated(): boolean;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Create a new ArkeClient instance
|
|
97
|
+
* Convenience function for those who prefer functional style
|
|
98
|
+
*/
|
|
99
|
+
declare function createArkeClient(config?: ArkeClientConfig): ArkeClient;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Folder Operations
|
|
103
|
+
*
|
|
104
|
+
* High-level operations for working with folders and directory structures.
|
|
105
|
+
*
|
|
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
|
|
110
|
+
*/
|
|
111
|
+
|
|
112
|
+
interface UploadProgress {
|
|
113
|
+
phase: 'scanning' | 'creating-folders' | 'uploading-files' | 'linking' | 'complete';
|
|
114
|
+
totalFiles: number;
|
|
115
|
+
completedFiles: number;
|
|
116
|
+
totalFolders: number;
|
|
117
|
+
completedFolders: number;
|
|
118
|
+
currentFile?: string;
|
|
119
|
+
}
|
|
120
|
+
interface UploadDirectoryOptions {
|
|
121
|
+
/** Collection to upload into */
|
|
122
|
+
collectionId: string;
|
|
123
|
+
/** Parent folder ID (optional - creates at root if not provided) */
|
|
124
|
+
parentFolderId?: string;
|
|
125
|
+
/** Progress callback */
|
|
126
|
+
onProgress?: (progress: UploadProgress) => void;
|
|
127
|
+
/** Max concurrent uploads */
|
|
128
|
+
concurrency?: number;
|
|
129
|
+
}
|
|
130
|
+
interface UploadDirectoryResult {
|
|
131
|
+
/** Root folder entity */
|
|
132
|
+
rootFolder: unknown;
|
|
133
|
+
/** All created folder entities */
|
|
134
|
+
folders: unknown[];
|
|
135
|
+
/** All created file entities */
|
|
136
|
+
files: unknown[];
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Folder operations helper
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
* ```typescript
|
|
143
|
+
* const folders = new FolderOperations(arkeClient);
|
|
144
|
+
* const result = await folders.uploadDirectory('/path/to/local/folder', {
|
|
145
|
+
* collectionId: '01ABC...',
|
|
146
|
+
* onProgress: (p) => console.log(`${p.completedFiles}/${p.totalFiles} files`),
|
|
147
|
+
* });
|
|
148
|
+
* ```
|
|
149
|
+
*/
|
|
150
|
+
declare class FolderOperations {
|
|
151
|
+
private client;
|
|
152
|
+
constructor(client: ArkeClient);
|
|
153
|
+
/**
|
|
154
|
+
* Upload a local directory to Arke
|
|
155
|
+
*
|
|
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)
|
|
162
|
+
*/
|
|
163
|
+
uploadDirectory(_localPath: string, _options: UploadDirectoryOptions): Promise<UploadDirectoryResult>;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Batch Operations
|
|
168
|
+
*
|
|
169
|
+
* High-level operations for bulk entity and relationship management.
|
|
170
|
+
*
|
|
171
|
+
* TODO: Implement batch operations
|
|
172
|
+
* - createEntities: Create multiple entities in parallel
|
|
173
|
+
* - updateEntities: Update multiple entities in parallel
|
|
174
|
+
* - createRelationships: Create multiple relationships in parallel
|
|
175
|
+
*/
|
|
176
|
+
|
|
177
|
+
interface BatchCreateOptions {
|
|
178
|
+
/** Max concurrent operations */
|
|
179
|
+
concurrency?: number;
|
|
180
|
+
/** Continue on individual failures */
|
|
181
|
+
continueOnError?: boolean;
|
|
182
|
+
/** Progress callback */
|
|
183
|
+
onProgress?: (completed: number, total: number) => void;
|
|
184
|
+
}
|
|
185
|
+
interface BatchResult<T> {
|
|
186
|
+
/** Successfully completed operations */
|
|
187
|
+
succeeded: T[];
|
|
188
|
+
/** Failed operations with errors */
|
|
189
|
+
failed: Array<{
|
|
190
|
+
input: unknown;
|
|
191
|
+
error: Error;
|
|
192
|
+
}>;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Batch operations helper
|
|
196
|
+
*
|
|
197
|
+
* @example
|
|
198
|
+
* ```typescript
|
|
199
|
+
* const batch = new BatchOperations(arkeClient);
|
|
200
|
+
* const result = await batch.createEntities([
|
|
201
|
+
* { type: 'document', properties: { title: 'Doc 1' } },
|
|
202
|
+
* { type: 'document', properties: { title: 'Doc 2' } },
|
|
203
|
+
* ], { concurrency: 5 });
|
|
204
|
+
* ```
|
|
205
|
+
*/
|
|
206
|
+
declare class BatchOperations {
|
|
207
|
+
private client;
|
|
208
|
+
constructor(client: ArkeClient);
|
|
209
|
+
/**
|
|
210
|
+
* Create multiple entities in parallel
|
|
211
|
+
*
|
|
212
|
+
* TODO: Implement this method
|
|
213
|
+
*/
|
|
214
|
+
createEntities(_entities: Array<{
|
|
215
|
+
collectionId: string;
|
|
216
|
+
type: string;
|
|
217
|
+
properties?: Record<string, unknown>;
|
|
218
|
+
}>, _options?: BatchCreateOptions): Promise<BatchResult<unknown>>;
|
|
219
|
+
/**
|
|
220
|
+
* Create multiple relationships in parallel
|
|
221
|
+
*
|
|
222
|
+
* TODO: Implement this method
|
|
223
|
+
*/
|
|
224
|
+
createRelationships(_relationships: Array<{
|
|
225
|
+
sourceId: string;
|
|
226
|
+
targetId: string;
|
|
227
|
+
predicate: string;
|
|
228
|
+
bidirectional?: boolean;
|
|
229
|
+
properties?: Record<string, unknown>;
|
|
230
|
+
}>, _options?: BatchCreateOptions): Promise<BatchResult<unknown>>;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Crypto Operations
|
|
235
|
+
*
|
|
236
|
+
* Cryptographic utilities for agents and content addressing.
|
|
237
|
+
*
|
|
238
|
+
* TODO: Implement crypto operations
|
|
239
|
+
* - generateKeyPair: Generate Ed25519 key pair for agent authentication
|
|
240
|
+
* - signPayload: Sign a payload with agent private key
|
|
241
|
+
* - computeCID: Compute IPFS CID for content
|
|
242
|
+
*/
|
|
243
|
+
/**
|
|
244
|
+
* Ed25519 key pair for agent authentication
|
|
245
|
+
*/
|
|
246
|
+
interface KeyPair {
|
|
247
|
+
/** Public key in base64 */
|
|
248
|
+
publicKey: string;
|
|
249
|
+
/** Private key in base64 (keep secret!) */
|
|
250
|
+
privateKey: string;
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Signed payload with signature
|
|
254
|
+
*/
|
|
255
|
+
interface SignedPayload {
|
|
256
|
+
/** Original payload */
|
|
257
|
+
payload: string;
|
|
258
|
+
/** Ed25519 signature in base64 */
|
|
259
|
+
signature: string;
|
|
260
|
+
/** Timestamp of signature */
|
|
261
|
+
timestamp: number;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Crypto operations helper
|
|
265
|
+
*
|
|
266
|
+
* @example
|
|
267
|
+
* ```typescript
|
|
268
|
+
* // Generate key pair for a new agent
|
|
269
|
+
* const { publicKey, privateKey } = await CryptoOperations.generateKeyPair();
|
|
270
|
+
*
|
|
271
|
+
* // Sign a payload
|
|
272
|
+
* const signed = await CryptoOperations.signPayload(privateKey, payload);
|
|
273
|
+
* ```
|
|
274
|
+
*/
|
|
275
|
+
declare class CryptoOperations {
|
|
276
|
+
/**
|
|
277
|
+
* Generate an Ed25519 key pair for agent authentication
|
|
278
|
+
*
|
|
279
|
+
* TODO: Implement using Node.js crypto or Web Crypto API
|
|
280
|
+
*/
|
|
281
|
+
static generateKeyPair(): Promise<KeyPair>;
|
|
282
|
+
/**
|
|
283
|
+
* Sign a payload with an Ed25519 private key
|
|
284
|
+
*
|
|
285
|
+
* TODO: Implement signature generation
|
|
286
|
+
*/
|
|
287
|
+
static signPayload(_privateKey: string, _payload: string): Promise<SignedPayload>;
|
|
288
|
+
/**
|
|
289
|
+
* Verify an Ed25519 signature
|
|
290
|
+
*
|
|
291
|
+
* TODO: Implement signature verification
|
|
292
|
+
*/
|
|
293
|
+
static verifySignature(_publicKey: string, _payload: string, _signature: string): Promise<boolean>;
|
|
294
|
+
/**
|
|
295
|
+
* Compute IPFS CID for content
|
|
296
|
+
*
|
|
297
|
+
* TODO: Implement using multiformats library
|
|
298
|
+
*/
|
|
299
|
+
static computeCID(_content: Uint8Array): Promise<string>;
|
|
300
|
+
}
|
|
301
|
+
|
|
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 };
|