@arke-institute/sdk 0.1.1 → 0.1.3
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/dist/content/index.cjs +591 -0
- package/dist/content/index.cjs.map +1 -0
- package/dist/content/index.d.cts +516 -0
- package/dist/content/index.d.ts +516 -0
- package/dist/content/index.js +558 -0
- package/dist/content/index.js.map +1 -0
- package/dist/edit/index.cjs +1503 -0
- package/dist/edit/index.cjs.map +1 -0
- package/dist/edit/index.d.cts +78 -0
- package/dist/edit/index.d.ts +78 -0
- package/dist/edit/index.js +1447 -0
- package/dist/edit/index.js.map +1 -0
- package/dist/{errors-BrNZWPE7.d.cts → errors-3L7IiHcr.d.cts} +3 -0
- package/dist/{errors-CCyp5KCg.d.ts → errors-BTe8GKRQ.d.ts} +3 -0
- package/dist/errors-CT7yzKkU.d.cts +874 -0
- package/dist/errors-CT7yzKkU.d.ts +874 -0
- package/dist/graph/index.cjs +427 -0
- package/dist/graph/index.cjs.map +1 -0
- package/dist/graph/index.d.cts +485 -0
- package/dist/graph/index.d.ts +485 -0
- package/dist/graph/index.js +396 -0
- package/dist/graph/index.js.map +1 -0
- package/dist/index.cjs +2726 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +2708 -14
- package/dist/index.js.map +1 -1
- package/dist/query/index.cjs +356 -0
- package/dist/query/index.cjs.map +1 -0
- package/dist/query/index.d.cts +636 -0
- package/dist/query/index.d.ts +636 -0
- package/dist/query/index.js +328 -0
- package/dist/query/index.js.map +1 -0
- package/dist/upload/index.cjs +3 -14
- package/dist/upload/index.cjs.map +1 -1
- package/dist/upload/index.d.cts +2 -2
- package/dist/upload/index.d.ts +2 -2
- package/dist/upload/index.js +3 -14
- package/dist/upload/index.js.map +1 -1
- package/package.json +26 -1
|
@@ -0,0 +1,516 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Content package types for the Arke SDK
|
|
3
|
+
*
|
|
4
|
+
* Types for interacting with entities and content from the IPFS Wrapper service.
|
|
5
|
+
* Based on the arke/eidos@v1 schema.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Full entity manifest from IPFS Wrapper
|
|
9
|
+
*/
|
|
10
|
+
interface Entity {
|
|
11
|
+
/** Entity identifier (ULID or test ID with II prefix) */
|
|
12
|
+
id: string;
|
|
13
|
+
/** Entity type (e.g., "PI", "person", "place", "concept", "document") */
|
|
14
|
+
type: string;
|
|
15
|
+
/** Creation timestamp (immutable, set at v1) */
|
|
16
|
+
created_at: string;
|
|
17
|
+
/** Display name */
|
|
18
|
+
label?: string;
|
|
19
|
+
/** Human-readable description */
|
|
20
|
+
description?: string;
|
|
21
|
+
/** Version number */
|
|
22
|
+
ver: number;
|
|
23
|
+
/** Timestamp when this version was created */
|
|
24
|
+
ts: string;
|
|
25
|
+
/** CID of this manifest */
|
|
26
|
+
manifest_cid: string;
|
|
27
|
+
/** CID of the previous version (null for version 1) */
|
|
28
|
+
prev_cid: string | null;
|
|
29
|
+
/** Map of component names to their CIDs */
|
|
30
|
+
components: Record<string, string>;
|
|
31
|
+
/** IDs of child entities */
|
|
32
|
+
children_pi?: string[];
|
|
33
|
+
/** ID of parent entity */
|
|
34
|
+
parent_pi?: string;
|
|
35
|
+
/** Provenance: which PI extracted this entity */
|
|
36
|
+
source_pi?: string;
|
|
37
|
+
/** IDs of entities that have been merged into this one */
|
|
38
|
+
merged_entities?: string[];
|
|
39
|
+
/** Change note for this version */
|
|
40
|
+
note?: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Summary entity info returned when listing entities
|
|
44
|
+
*/
|
|
45
|
+
interface EntitySummary {
|
|
46
|
+
/** Entity identifier */
|
|
47
|
+
id: string;
|
|
48
|
+
/** Tip CID (latest manifest) */
|
|
49
|
+
tip: string;
|
|
50
|
+
/** Entity type (if include_metadata=true) */
|
|
51
|
+
type?: string;
|
|
52
|
+
/** Display name (if include_metadata=true) */
|
|
53
|
+
label?: string;
|
|
54
|
+
/** Version number (if include_metadata=true) */
|
|
55
|
+
ver?: number;
|
|
56
|
+
/** Timestamp (if include_metadata=true) */
|
|
57
|
+
ts?: string;
|
|
58
|
+
/** Change note (if include_metadata=true) */
|
|
59
|
+
note?: string;
|
|
60
|
+
/** Number of components (if include_metadata=true) */
|
|
61
|
+
component_count?: number;
|
|
62
|
+
/** Number of children (if include_metadata=true) */
|
|
63
|
+
children_count?: number;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Version entry in version history
|
|
67
|
+
*/
|
|
68
|
+
interface EntityVersion {
|
|
69
|
+
/** Version number */
|
|
70
|
+
ver: number;
|
|
71
|
+
/** CID of this version's manifest */
|
|
72
|
+
cid: string;
|
|
73
|
+
/** Timestamp when this version was created */
|
|
74
|
+
ts: string;
|
|
75
|
+
/** Change note for this version */
|
|
76
|
+
note?: string;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Options for listing entities
|
|
80
|
+
*/
|
|
81
|
+
interface ListOptions {
|
|
82
|
+
/** Maximum entities to return (1-1000, default: 100) */
|
|
83
|
+
limit?: number;
|
|
84
|
+
/** Cursor for pagination (CID, base32 starting with 'b') */
|
|
85
|
+
cursor?: string;
|
|
86
|
+
/** Whether to include full metadata for each entity */
|
|
87
|
+
include_metadata?: boolean;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Options for listing versions
|
|
91
|
+
*/
|
|
92
|
+
interface VersionsOptions {
|
|
93
|
+
/** Maximum versions to return (default: 20) */
|
|
94
|
+
limit?: number;
|
|
95
|
+
/** Cursor for pagination (CID to start from) */
|
|
96
|
+
cursor?: string;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Response from listing entities
|
|
100
|
+
*/
|
|
101
|
+
interface ListResponse {
|
|
102
|
+
/** List of entity summaries */
|
|
103
|
+
entities: EntitySummary[];
|
|
104
|
+
/** Number of entities returned (matches limit) */
|
|
105
|
+
limit: number;
|
|
106
|
+
/** Cursor for next page (null if no more) */
|
|
107
|
+
next_cursor: string | null;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Response from listing versions
|
|
111
|
+
*/
|
|
112
|
+
interface VersionsResponse {
|
|
113
|
+
/** List of versions (newest first) */
|
|
114
|
+
items: EntityVersion[];
|
|
115
|
+
/** Cursor for next page (null if reached genesis) */
|
|
116
|
+
next_cursor: string | null;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Response from resolving a PI
|
|
120
|
+
*/
|
|
121
|
+
interface ResolveResponse {
|
|
122
|
+
/** Entity identifier */
|
|
123
|
+
id: string;
|
|
124
|
+
/** Tip CID (latest manifest) */
|
|
125
|
+
tip: string;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* A single relationship edge in the semantic graph.
|
|
129
|
+
*
|
|
130
|
+
* Represents a typed, directional relationship from the source entity
|
|
131
|
+
* to a target entity or PI.
|
|
132
|
+
*/
|
|
133
|
+
interface Relationship {
|
|
134
|
+
/** Relationship predicate (e.g., "authored_by", "mentions", "located_in") */
|
|
135
|
+
predicate: string;
|
|
136
|
+
/** Type of target */
|
|
137
|
+
target_type: 'pi' | 'entity';
|
|
138
|
+
/** Target entity identifier */
|
|
139
|
+
target_id: string;
|
|
140
|
+
/** Display label for the target (e.g., "Alice Austen") */
|
|
141
|
+
target_label: string;
|
|
142
|
+
/** Target entity type (e.g., "person", "place") - only if target is entity */
|
|
143
|
+
target_entity_type?: string;
|
|
144
|
+
/** Optional metadata on the relationship edge */
|
|
145
|
+
properties?: Record<string, unknown>;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Relationships component stored in IPFS (arke/relationships@v1 schema).
|
|
149
|
+
*
|
|
150
|
+
* Contains the semantic graph relationships for an entity.
|
|
151
|
+
*/
|
|
152
|
+
interface RelationshipsComponent {
|
|
153
|
+
/** Schema identifier */
|
|
154
|
+
schema: 'arke/relationships@v1';
|
|
155
|
+
/** Array of relationships */
|
|
156
|
+
relationships: Relationship[];
|
|
157
|
+
/** ISO 8601 timestamp when this component was created/updated */
|
|
158
|
+
timestamp: string;
|
|
159
|
+
/** Optional note about changes */
|
|
160
|
+
note?: string;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Properties component stored in IPFS.
|
|
164
|
+
*
|
|
165
|
+
* Contains arbitrary metadata properties for an entity.
|
|
166
|
+
*/
|
|
167
|
+
interface PropertiesComponent {
|
|
168
|
+
/** Arbitrary key-value properties */
|
|
169
|
+
[key: string]: unknown;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Configuration for ContentClient
|
|
174
|
+
*/
|
|
175
|
+
interface ContentClientConfig {
|
|
176
|
+
/**
|
|
177
|
+
* Gateway base URL (e.g., https://gateway.arke.institute).
|
|
178
|
+
* The client will call /api/* endpoints for IPFS Wrapper.
|
|
179
|
+
*/
|
|
180
|
+
gatewayUrl: string;
|
|
181
|
+
/**
|
|
182
|
+
* Optional custom fetch implementation (useful for testing).
|
|
183
|
+
*/
|
|
184
|
+
fetchImpl?: typeof fetch;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Client for accessing entities and content from the Arke archive.
|
|
188
|
+
*
|
|
189
|
+
* All endpoints are public and do not require authentication.
|
|
190
|
+
*
|
|
191
|
+
* @example
|
|
192
|
+
* ```typescript
|
|
193
|
+
* const content = new ContentClient({
|
|
194
|
+
* gatewayUrl: 'https://gateway.arke.institute',
|
|
195
|
+
* });
|
|
196
|
+
*
|
|
197
|
+
* // Get an entity
|
|
198
|
+
* const entity = await content.get('01K75HQQXNTDG7BBP7PS9AWYAN');
|
|
199
|
+
*
|
|
200
|
+
* // Download content by CID
|
|
201
|
+
* const blob = await content.download('bafybeihkoviema7g3gxyt6la7vd5ho32jywf7b4c4z3qtwcabpjqxwsumu');
|
|
202
|
+
*
|
|
203
|
+
* // Get component content
|
|
204
|
+
* const pinax = await content.getComponent(entity, 'pinax');
|
|
205
|
+
* ```
|
|
206
|
+
*/
|
|
207
|
+
declare class ContentClient {
|
|
208
|
+
private baseUrl;
|
|
209
|
+
private fetchImpl;
|
|
210
|
+
constructor(config: ContentClientConfig);
|
|
211
|
+
private buildUrl;
|
|
212
|
+
private request;
|
|
213
|
+
/**
|
|
214
|
+
* Get an entity by its Persistent Identifier (PI).
|
|
215
|
+
*
|
|
216
|
+
* @param pi - Persistent Identifier (ULID or test PI with II prefix)
|
|
217
|
+
* @returns Full entity manifest
|
|
218
|
+
* @throws EntityNotFoundError if the entity doesn't exist
|
|
219
|
+
*
|
|
220
|
+
* @example
|
|
221
|
+
* ```typescript
|
|
222
|
+
* const entity = await content.get('01K75HQQXNTDG7BBP7PS9AWYAN');
|
|
223
|
+
* console.log('Version:', entity.ver);
|
|
224
|
+
* console.log('Components:', Object.keys(entity.components));
|
|
225
|
+
* ```
|
|
226
|
+
*/
|
|
227
|
+
get(pi: string): Promise<Entity>;
|
|
228
|
+
/**
|
|
229
|
+
* List entities with pagination.
|
|
230
|
+
*
|
|
231
|
+
* @param options - Pagination and metadata options
|
|
232
|
+
* @returns Paginated list of entity summaries
|
|
233
|
+
*
|
|
234
|
+
* @example
|
|
235
|
+
* ```typescript
|
|
236
|
+
* // Get first page
|
|
237
|
+
* const page1 = await content.list({ limit: 20, include_metadata: true });
|
|
238
|
+
*
|
|
239
|
+
* // Get next page
|
|
240
|
+
* if (page1.next_cursor) {
|
|
241
|
+
* const page2 = await content.list({ cursor: page1.next_cursor });
|
|
242
|
+
* }
|
|
243
|
+
* ```
|
|
244
|
+
*/
|
|
245
|
+
list(options?: ListOptions): Promise<ListResponse>;
|
|
246
|
+
/**
|
|
247
|
+
* Get version history for an entity.
|
|
248
|
+
*
|
|
249
|
+
* @param pi - Persistent Identifier
|
|
250
|
+
* @param options - Pagination options
|
|
251
|
+
* @returns Version history (newest first)
|
|
252
|
+
*
|
|
253
|
+
* @example
|
|
254
|
+
* ```typescript
|
|
255
|
+
* const history = await content.versions('01K75HQQXNTDG7BBP7PS9AWYAN');
|
|
256
|
+
* console.log('Total versions:', history.items.length);
|
|
257
|
+
* history.items.forEach(v => {
|
|
258
|
+
* console.log(`v${v.ver}: ${v.ts} - ${v.note || 'no note'}`);
|
|
259
|
+
* });
|
|
260
|
+
* ```
|
|
261
|
+
*/
|
|
262
|
+
versions(pi: string, options?: VersionsOptions): Promise<VersionsResponse>;
|
|
263
|
+
/**
|
|
264
|
+
* Get a specific version of an entity.
|
|
265
|
+
*
|
|
266
|
+
* @param pi - Persistent Identifier
|
|
267
|
+
* @param selector - Version selector: 'ver:N' for version number or 'cid:...' for CID
|
|
268
|
+
* @returns Entity manifest for the specified version
|
|
269
|
+
*
|
|
270
|
+
* @example
|
|
271
|
+
* ```typescript
|
|
272
|
+
* // Get version 2
|
|
273
|
+
* const v2 = await content.getVersion('01K75HQQXNTDG7BBP7PS9AWYAN', 'ver:2');
|
|
274
|
+
*
|
|
275
|
+
* // Get by CID
|
|
276
|
+
* const vByCid = await content.getVersion('01K75HQQXNTDG7BBP7PS9AWYAN', 'cid:bafybeih...');
|
|
277
|
+
* ```
|
|
278
|
+
*/
|
|
279
|
+
getVersion(pi: string, selector: string): Promise<Entity>;
|
|
280
|
+
/**
|
|
281
|
+
* Resolve a PI to its tip CID (fast lookup without fetching manifest).
|
|
282
|
+
*
|
|
283
|
+
* @param pi - Persistent Identifier
|
|
284
|
+
* @returns PI and tip CID
|
|
285
|
+
*
|
|
286
|
+
* @example
|
|
287
|
+
* ```typescript
|
|
288
|
+
* const { tip } = await content.resolve('01K75HQQXNTDG7BBP7PS9AWYAN');
|
|
289
|
+
* console.log('Latest manifest CID:', tip);
|
|
290
|
+
* ```
|
|
291
|
+
*/
|
|
292
|
+
resolve(pi: string): Promise<ResolveResponse>;
|
|
293
|
+
/**
|
|
294
|
+
* Get the list of child PIs for an entity (fast, returns only PIs).
|
|
295
|
+
*
|
|
296
|
+
* @param pi - Persistent Identifier of parent entity
|
|
297
|
+
* @returns Array of child PIs
|
|
298
|
+
*
|
|
299
|
+
* @example
|
|
300
|
+
* ```typescript
|
|
301
|
+
* const childPis = await content.children('01K75HQQXNTDG7BBP7PS9AWYAN');
|
|
302
|
+
* console.log('Children:', childPis);
|
|
303
|
+
* ```
|
|
304
|
+
*/
|
|
305
|
+
children(pi: string): Promise<string[]>;
|
|
306
|
+
/**
|
|
307
|
+
* Get all child entities for a parent (fetches full entity for each child).
|
|
308
|
+
*
|
|
309
|
+
* @param pi - Persistent Identifier of parent entity
|
|
310
|
+
* @returns Array of child entities
|
|
311
|
+
*
|
|
312
|
+
* @example
|
|
313
|
+
* ```typescript
|
|
314
|
+
* const childEntities = await content.childrenEntities('01K75HQQXNTDG7BBP7PS9AWYAN');
|
|
315
|
+
* childEntities.forEach(child => {
|
|
316
|
+
* console.log(`${child.pi}: v${child.ver}`);
|
|
317
|
+
* });
|
|
318
|
+
* ```
|
|
319
|
+
*/
|
|
320
|
+
childrenEntities(pi: string): Promise<Entity[]>;
|
|
321
|
+
/**
|
|
322
|
+
* Get the Arke origin block (root of the archive tree).
|
|
323
|
+
*
|
|
324
|
+
* @returns Arke origin entity
|
|
325
|
+
*
|
|
326
|
+
* @example
|
|
327
|
+
* ```typescript
|
|
328
|
+
* const origin = await content.arke();
|
|
329
|
+
* console.log('Arke origin:', origin.pi);
|
|
330
|
+
* ```
|
|
331
|
+
*/
|
|
332
|
+
arke(): Promise<Entity>;
|
|
333
|
+
/**
|
|
334
|
+
* Download content by CID.
|
|
335
|
+
*
|
|
336
|
+
* Returns Blob in browser environments, Buffer in Node.js.
|
|
337
|
+
*
|
|
338
|
+
* @param cid - Content Identifier
|
|
339
|
+
* @returns Content as Blob (browser) or Buffer (Node)
|
|
340
|
+
* @throws ContentNotFoundError if the content doesn't exist
|
|
341
|
+
*
|
|
342
|
+
* @example
|
|
343
|
+
* ```typescript
|
|
344
|
+
* const content = await client.download('bafybeih...');
|
|
345
|
+
*
|
|
346
|
+
* // In browser
|
|
347
|
+
* const url = URL.createObjectURL(content as Blob);
|
|
348
|
+
*
|
|
349
|
+
* // In Node.js
|
|
350
|
+
* fs.writeFileSync('output.bin', content as Buffer);
|
|
351
|
+
* ```
|
|
352
|
+
*/
|
|
353
|
+
download(cid: string): Promise<Blob | Buffer>;
|
|
354
|
+
/**
|
|
355
|
+
* Get a direct URL for content by CID.
|
|
356
|
+
*
|
|
357
|
+
* This is useful for embedding in img tags or for direct downloads.
|
|
358
|
+
*
|
|
359
|
+
* @param cid - Content Identifier
|
|
360
|
+
* @returns URL string
|
|
361
|
+
*
|
|
362
|
+
* @example
|
|
363
|
+
* ```typescript
|
|
364
|
+
* const url = content.getUrl('bafybeih...');
|
|
365
|
+
* // Use in img tag: <img src={url} />
|
|
366
|
+
* ```
|
|
367
|
+
*/
|
|
368
|
+
getUrl(cid: string): string;
|
|
369
|
+
/**
|
|
370
|
+
* Stream content by CID.
|
|
371
|
+
*
|
|
372
|
+
* @param cid - Content Identifier
|
|
373
|
+
* @returns ReadableStream of the content
|
|
374
|
+
* @throws ContentNotFoundError if the content doesn't exist
|
|
375
|
+
*
|
|
376
|
+
* @example
|
|
377
|
+
* ```typescript
|
|
378
|
+
* const stream = await content.stream('bafybeih...');
|
|
379
|
+
* const reader = stream.getReader();
|
|
380
|
+
* while (true) {
|
|
381
|
+
* const { done, value } = await reader.read();
|
|
382
|
+
* if (done) break;
|
|
383
|
+
* // Process chunk
|
|
384
|
+
* }
|
|
385
|
+
* ```
|
|
386
|
+
*/
|
|
387
|
+
stream(cid: string): Promise<ReadableStream<Uint8Array>>;
|
|
388
|
+
/**
|
|
389
|
+
* Download a DAG node (JSON) by CID.
|
|
390
|
+
*
|
|
391
|
+
* Use this to fetch JSON components like properties and relationships.
|
|
392
|
+
*
|
|
393
|
+
* @param cid - Content Identifier of the DAG node
|
|
394
|
+
* @returns Parsed JSON object
|
|
395
|
+
* @throws ContentNotFoundError if the content doesn't exist
|
|
396
|
+
*
|
|
397
|
+
* @example
|
|
398
|
+
* ```typescript
|
|
399
|
+
* const relationships = await content.getDag<RelationshipsComponent>(
|
|
400
|
+
* entity.components.relationships
|
|
401
|
+
* );
|
|
402
|
+
* console.log('Relationships:', relationships.relationships);
|
|
403
|
+
* ```
|
|
404
|
+
*/
|
|
405
|
+
getDag<T = unknown>(cid: string): Promise<T>;
|
|
406
|
+
/**
|
|
407
|
+
* Download a component from an entity.
|
|
408
|
+
*
|
|
409
|
+
* @param entity - Entity containing the component
|
|
410
|
+
* @param componentName - Name of the component (e.g., 'pinax', 'description', 'source')
|
|
411
|
+
* @returns Component content as Blob (browser) or Buffer (Node)
|
|
412
|
+
* @throws ComponentNotFoundError if the component doesn't exist
|
|
413
|
+
*
|
|
414
|
+
* @example
|
|
415
|
+
* ```typescript
|
|
416
|
+
* const entity = await content.get('01K75HQQXNTDG7BBP7PS9AWYAN');
|
|
417
|
+
* const pinax = await content.getComponent(entity, 'pinax');
|
|
418
|
+
* ```
|
|
419
|
+
*/
|
|
420
|
+
getComponent(entity: Entity, componentName: string): Promise<Blob | Buffer>;
|
|
421
|
+
/**
|
|
422
|
+
* Get the URL for a component from an entity.
|
|
423
|
+
*
|
|
424
|
+
* @param entity - Entity containing the component
|
|
425
|
+
* @param componentName - Name of the component
|
|
426
|
+
* @returns URL string
|
|
427
|
+
* @throws ComponentNotFoundError if the component doesn't exist
|
|
428
|
+
*
|
|
429
|
+
* @example
|
|
430
|
+
* ```typescript
|
|
431
|
+
* const entity = await content.get('01K75HQQXNTDG7BBP7PS9AWYAN');
|
|
432
|
+
* const imageUrl = content.getComponentUrl(entity, 'source');
|
|
433
|
+
* // Use in img tag: <img src={imageUrl} />
|
|
434
|
+
* ```
|
|
435
|
+
*/
|
|
436
|
+
getComponentUrl(entity: Entity, componentName: string): string;
|
|
437
|
+
/**
|
|
438
|
+
* Get the properties component for an entity.
|
|
439
|
+
*
|
|
440
|
+
* @param entity - Entity containing the properties component
|
|
441
|
+
* @returns Properties object, or null if no properties component exists
|
|
442
|
+
*
|
|
443
|
+
* @example
|
|
444
|
+
* ```typescript
|
|
445
|
+
* const entity = await content.get('01K75HQQXNTDG7BBP7PS9AWYAN');
|
|
446
|
+
* const props = await content.getProperties(entity);
|
|
447
|
+
* if (props) {
|
|
448
|
+
* console.log('Title:', props.title);
|
|
449
|
+
* }
|
|
450
|
+
* ```
|
|
451
|
+
*/
|
|
452
|
+
getProperties(entity: Entity): Promise<PropertiesComponent | null>;
|
|
453
|
+
/**
|
|
454
|
+
* Get the relationships component for an entity.
|
|
455
|
+
*
|
|
456
|
+
* @param entity - Entity containing the relationships component
|
|
457
|
+
* @returns Relationships component, or null if no relationships exist
|
|
458
|
+
*
|
|
459
|
+
* @example
|
|
460
|
+
* ```typescript
|
|
461
|
+
* const entity = await content.get('01K75HQQXNTDG7BBP7PS9AWYAN');
|
|
462
|
+
* const rels = await content.getRelationships(entity);
|
|
463
|
+
* if (rels) {
|
|
464
|
+
* rels.relationships.forEach(r => {
|
|
465
|
+
* console.log(`${r.predicate} -> ${r.target_label}`);
|
|
466
|
+
* });
|
|
467
|
+
* }
|
|
468
|
+
* ```
|
|
469
|
+
*/
|
|
470
|
+
getRelationships(entity: Entity): Promise<RelationshipsComponent | null>;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
/**
|
|
474
|
+
* Content package error classes for the Arke SDK
|
|
475
|
+
*/
|
|
476
|
+
/**
|
|
477
|
+
* Base error class for content operations
|
|
478
|
+
*/
|
|
479
|
+
declare class ContentError extends Error {
|
|
480
|
+
code: string;
|
|
481
|
+
details?: unknown | undefined;
|
|
482
|
+
constructor(message: string, code?: string, details?: unknown | undefined);
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
485
|
+
* Thrown when an entity is not found by ID
|
|
486
|
+
*/
|
|
487
|
+
declare class EntityNotFoundError extends ContentError {
|
|
488
|
+
constructor(id: string);
|
|
489
|
+
}
|
|
490
|
+
/**
|
|
491
|
+
* Thrown when content is not found by CID
|
|
492
|
+
*/
|
|
493
|
+
declare class ContentNotFoundError extends ContentError {
|
|
494
|
+
constructor(cid: string);
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* Thrown when a component is not found on an entity
|
|
498
|
+
*/
|
|
499
|
+
declare class ComponentNotFoundError extends ContentError {
|
|
500
|
+
constructor(id: string, componentName: string);
|
|
501
|
+
}
|
|
502
|
+
/**
|
|
503
|
+
* Thrown when a version is not found
|
|
504
|
+
*/
|
|
505
|
+
declare class VersionNotFoundError extends ContentError {
|
|
506
|
+
constructor(id: string, selector: string);
|
|
507
|
+
}
|
|
508
|
+
/**
|
|
509
|
+
* Thrown when a network error occurs
|
|
510
|
+
*/
|
|
511
|
+
declare class NetworkError extends ContentError {
|
|
512
|
+
statusCode?: number | undefined;
|
|
513
|
+
constructor(message: string, statusCode?: number | undefined);
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
export { ComponentNotFoundError, ContentClient, type ContentClientConfig, ContentError, ContentNotFoundError, type Entity, EntityNotFoundError, type EntitySummary, type EntityVersion, type ListOptions, type ListResponse, NetworkError, type PropertiesComponent, type Relationship, type RelationshipsComponent, type ResolveResponse, VersionNotFoundError, type VersionsOptions, type VersionsResponse };
|