@arke-institute/klados-testing 0.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.
package/README.md ADDED
@@ -0,0 +1,139 @@
1
+ # @arke-institute/klados-testing
2
+
3
+ Test utilities for klados workers on the Arke network.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install --save-dev @arke-institute/klados-testing
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ### Configure the Test Client
14
+
15
+ Call `configureTestClient` once in your test setup:
16
+
17
+ ```typescript
18
+ import { configureTestClient } from '@arke-institute/klados-testing';
19
+
20
+ configureTestClient({
21
+ apiBase: 'https://arke-v1.arke.institute',
22
+ userKey: process.env.ARKE_USER_KEY!,
23
+ network: 'test',
24
+ });
25
+ ```
26
+
27
+ ### Create Test Fixtures
28
+
29
+ ```typescript
30
+ import {
31
+ createCollection,
32
+ createEntity,
33
+ deleteEntity,
34
+ } from '@arke-institute/klados-testing';
35
+
36
+ // Create a collection
37
+ const collection = await createCollection({
38
+ label: 'Test Collection',
39
+ allowedTypes: ['document'],
40
+ });
41
+
42
+ // Create an entity in the collection
43
+ const entity = await createEntity({
44
+ type: 'document',
45
+ properties: { title: 'Test' },
46
+ collectionId: collection.id,
47
+ });
48
+
49
+ // Cleanup
50
+ await deleteEntity(entity.id);
51
+ await deleteEntity(collection.id);
52
+ ```
53
+
54
+ ### Invoke and Verify Klados
55
+
56
+ ```typescript
57
+ import {
58
+ invokeKlados,
59
+ waitForKladosLog,
60
+ assertLogCompleted,
61
+ assertLogHasMessages,
62
+ } from '@arke-institute/klados-testing';
63
+
64
+ // Invoke a klados
65
+ const result = await invokeKlados({
66
+ kladosId: 'klados_xxx',
67
+ targetEntity: entity.id,
68
+ targetCollection: collection.id,
69
+ jobCollection: jobCollection.id,
70
+ confirm: true,
71
+ });
72
+
73
+ // Wait for completion
74
+ const log = await waitForKladosLog(result.job_collection!, {
75
+ timeout: 30000,
76
+ pollInterval: 1000,
77
+ });
78
+
79
+ // Verify with assertions
80
+ assertLogCompleted(log);
81
+ assertLogHasMessages(log, [
82
+ { level: 'info', textContains: 'Processing' },
83
+ { level: 'success', textContains: 'completed' },
84
+ ]);
85
+ ```
86
+
87
+ ## API Reference
88
+
89
+ ### Configuration
90
+
91
+ - `configureTestClient(config)` - Configure the test client
92
+ - `getConfig()` - Get current config (throws if not configured)
93
+ - `resetTestClient()` - Reset configuration
94
+
95
+ ### Entity Operations
96
+
97
+ - `createEntity(options)` - Create an entity
98
+ - `getEntity(id)` - Get an entity by ID
99
+ - `deleteEntity(id)` - Delete an entity
100
+ - `createCollection(options)` - Create a collection
101
+ - `getCollectionEntities(id)` - Get entities in a collection
102
+
103
+ ### Log Utilities
104
+
105
+ - `getKladosLog(id)` - Get a klados log by ID
106
+ - `getFirstLogFromCollection(id)` - Get first_log relationship from collection
107
+ - `waitForKladosLog(jobCollectionId, options?)` - Wait for log completion
108
+ - `getLogMessages(log)` - Extract messages from log
109
+ - `getLogEntry(log)` - Extract entry details from log
110
+
111
+ ### Klados Invocation
112
+
113
+ - `invokeKlados(options)` - Invoke a klados worker
114
+
115
+ ### Assertions
116
+
117
+ - `assertLogCompleted(log)` - Assert log completed successfully
118
+ - `assertLogFailed(log, expectedCode?)` - Assert log failed with error
119
+ - `assertLogHasMessages(log, criteria)` - Assert log contains specific messages
120
+ - `assertLogMessageCount(log, minCount)` - Assert minimum message count
121
+ - `assertLogHasHandoff(log, handoffType)` - Assert log has specific handoff
122
+
123
+ ### Helpers
124
+
125
+ - `sleep(ms)` - Sleep for duration
126
+ - `log(message, data?)` - Log with timestamp
127
+ - `apiRequest(method, path, body?)` - Make raw API request
128
+
129
+ ## Environment Variables
130
+
131
+ Your tests should set these environment variables:
132
+
133
+ - `ARKE_USER_KEY` - User API key (uk_...) for authentication
134
+ - `ARKE_API_BASE` - API base URL (default: https://arke-v1.arke.institute)
135
+ - `ARKE_NETWORK` - Network to use: 'test' or 'main' (default: test)
136
+
137
+ ## License
138
+
139
+ MIT
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Test assertions for klados logs
3
+ */
4
+ import type { KladosLogEntry, LogMessageCriteria } from './types';
5
+ /**
6
+ * Assert that a klados log completed successfully
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * const log = await waitForKladosLog(jobCollectionId);
11
+ * assertLogCompleted(log);
12
+ * ```
13
+ *
14
+ * @param log - The klados log entry (or null)
15
+ * @throws Error if log is null or has error status
16
+ */
17
+ export declare function assertLogCompleted(log: KladosLogEntry | null): asserts log is KladosLogEntry;
18
+ /**
19
+ * Assert that a klados log failed with an error
20
+ *
21
+ * @param log - The klados log entry (or null)
22
+ * @param expectedCode - Optional expected error code
23
+ * @throws Error if log is null or doesn't have error status
24
+ */
25
+ export declare function assertLogFailed(log: KladosLogEntry | null, expectedCode?: string): asserts log is KladosLogEntry;
26
+ /**
27
+ * Assert that a klados log contains specific messages
28
+ *
29
+ * @example
30
+ * ```typescript
31
+ * assertLogHasMessages(log, [
32
+ * { level: 'info', textContains: 'Processing' },
33
+ * { level: 'success', textContains: 'completed' },
34
+ * ]);
35
+ * ```
36
+ *
37
+ * @param log - The klados log entry
38
+ * @param criteria - Array of message criteria to match
39
+ * @throws Error if any criteria is not matched
40
+ */
41
+ export declare function assertLogHasMessages(log: KladosLogEntry, criteria: LogMessageCriteria[]): void;
42
+ /**
43
+ * Assert that a klados log has at least a minimum number of messages
44
+ *
45
+ * @param log - The klados log entry
46
+ * @param minCount - Minimum number of messages expected
47
+ */
48
+ export declare function assertLogMessageCount(log: KladosLogEntry, minCount: number): void;
49
+ /**
50
+ * Assert that a klados log has a handoff of a specific type
51
+ *
52
+ * @param log - The klados log entry
53
+ * @param handoffType - Expected handoff type
54
+ */
55
+ export declare function assertLogHasHandoff(log: KladosLogEntry, handoffType: 'invoke' | 'scatter' | 'complete' | 'error' | 'none'): void;
56
+ //# sourceMappingURL=assertions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assertions.d.ts","sourceRoot":"","sources":["../src/assertions.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAc,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE9E;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,cAAc,GAAG,IAAI,GAAG,OAAO,CAAC,GAAG,IAAI,cAAc,CAkB5F;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,GAAG,EAAE,cAAc,GAAG,IAAI,EAC1B,YAAY,CAAC,EAAE,MAAM,GACpB,OAAO,CAAC,GAAG,IAAI,cAAc,CAmB/B;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,cAAc,EACnB,QAAQ,EAAE,kBAAkB,EAAE,GAC7B,IAAI,CAgBN;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,cAAc,EACnB,QAAQ,EAAE,MAAM,GACf,IAAI,CAON;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,cAAc,EACnB,WAAW,EAAE,QAAQ,GAAG,SAAS,GAAG,UAAU,GAAG,OAAO,GAAG,MAAM,GAChE,IAAI,CAUN"}
@@ -0,0 +1,121 @@
1
+ /**
2
+ * Test assertions for klados logs
3
+ */
4
+ /**
5
+ * Assert that a klados log completed successfully
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * const log = await waitForKladosLog(jobCollectionId);
10
+ * assertLogCompleted(log);
11
+ * ```
12
+ *
13
+ * @param log - The klados log entry (or null)
14
+ * @throws Error if log is null or has error status
15
+ */
16
+ export function assertLogCompleted(log) {
17
+ if (!log) {
18
+ throw new Error('Expected klados log but got null');
19
+ }
20
+ if (log.properties.status === 'error') {
21
+ const entry = log.properties.log_data.entry;
22
+ const errorMsg = entry.error
23
+ ? `${entry.error.code}: ${entry.error.message}`
24
+ : 'Unknown error';
25
+ throw new Error(`Klados log has error status: ${errorMsg}`);
26
+ }
27
+ if (log.properties.status !== 'done') {
28
+ throw new Error(`Expected log status 'done' but got '${log.properties.status}'`);
29
+ }
30
+ }
31
+ /**
32
+ * Assert that a klados log failed with an error
33
+ *
34
+ * @param log - The klados log entry (or null)
35
+ * @param expectedCode - Optional expected error code
36
+ * @throws Error if log is null or doesn't have error status
37
+ */
38
+ export function assertLogFailed(log, expectedCode) {
39
+ if (!log) {
40
+ throw new Error('Expected klados log but got null');
41
+ }
42
+ if (log.properties.status !== 'error') {
43
+ throw new Error(`Expected log status 'error' but got '${log.properties.status}'`);
44
+ }
45
+ if (expectedCode) {
46
+ const actualCode = log.properties.log_data.entry.error?.code;
47
+ if (actualCode !== expectedCode) {
48
+ throw new Error(`Expected error code '${expectedCode}' but got '${actualCode}'`);
49
+ }
50
+ }
51
+ }
52
+ /**
53
+ * Assert that a klados log contains specific messages
54
+ *
55
+ * @example
56
+ * ```typescript
57
+ * assertLogHasMessages(log, [
58
+ * { level: 'info', textContains: 'Processing' },
59
+ * { level: 'success', textContains: 'completed' },
60
+ * ]);
61
+ * ```
62
+ *
63
+ * @param log - The klados log entry
64
+ * @param criteria - Array of message criteria to match
65
+ * @throws Error if any criteria is not matched
66
+ */
67
+ export function assertLogHasMessages(log, criteria) {
68
+ const messages = log.properties.log_data.messages;
69
+ for (const criterion of criteria) {
70
+ const found = messages.some((msg) => matchesMessageCriteria(msg, criterion));
71
+ if (!found) {
72
+ const criteriaStr = JSON.stringify(criterion);
73
+ const availableMessages = messages
74
+ .map((m) => ` - [${m.level}] ${m.message}`)
75
+ .join('\n');
76
+ throw new Error(`No message matching criteria ${criteriaStr}.\nAvailable messages:\n${availableMessages}`);
77
+ }
78
+ }
79
+ }
80
+ /**
81
+ * Assert that a klados log has at least a minimum number of messages
82
+ *
83
+ * @param log - The klados log entry
84
+ * @param minCount - Minimum number of messages expected
85
+ */
86
+ export function assertLogMessageCount(log, minCount) {
87
+ const actualCount = log.properties.log_data.messages.length;
88
+ if (actualCount < minCount) {
89
+ throw new Error(`Expected at least ${minCount} log messages but got ${actualCount}`);
90
+ }
91
+ }
92
+ /**
93
+ * Assert that a klados log has a handoff of a specific type
94
+ *
95
+ * @param log - The klados log entry
96
+ * @param handoffType - Expected handoff type
97
+ */
98
+ export function assertLogHasHandoff(log, handoffType) {
99
+ const handoffs = log.properties.log_data.entry.handoffs ?? [];
100
+ const found = handoffs.some((h) => h.type === handoffType);
101
+ if (!found) {
102
+ const available = handoffs.map((h) => h.type).join(', ') || '(none)';
103
+ throw new Error(`Expected handoff of type '${handoffType}' but found: ${available}`);
104
+ }
105
+ }
106
+ /**
107
+ * Check if a log message matches the given criteria
108
+ */
109
+ function matchesMessageCriteria(message, criteria) {
110
+ if (criteria.level && message.level !== criteria.level) {
111
+ return false;
112
+ }
113
+ if (criteria.textContains && !message.message.includes(criteria.textContains)) {
114
+ return false;
115
+ }
116
+ if (criteria.textEquals && message.message !== criteria.textEquals) {
117
+ return false;
118
+ }
119
+ return true;
120
+ }
121
+ //# sourceMappingURL=assertions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assertions.js","sourceRoot":"","sources":["../src/assertions.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,kBAAkB,CAAC,GAA0B;IAC3D,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;IACtD,CAAC;IAED,IAAI,GAAG,CAAC,UAAU,CAAC,MAAM,KAAK,OAAO,EAAE,CAAC;QACtC,MAAM,KAAK,GAAG,GAAG,CAAC,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC;QAC5C,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK;YAC1B,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE;YAC/C,CAAC,CAAC,eAAe,CAAC;QACpB,MAAM,I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EG;AACH,SAAS,sBAAsB,CAC7B,OAAmB,EACnB,QAA4B;IAE5B,IAAI,QAAQ,CAAC,KAAK,IAAI,OAAO,CAAC,KAAK,KAAK,QAAQ,CAAC,KAAK,EAAE,CAAC;QACvD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,QAAQ,CAAC,YAAY,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;QAC9E,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,QAAQ,CAAC,UAAU,IAAI,OAAO,CAAC,OAAO,KAAK,QAAQ,CAAC,UAAU,EAAE,CAAC;QACnE,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * API client utilities for klados testing
3
+ */
4
+ import type { TestConfig } from './types';
5
+ /**
6
+ * Configure the test client with API credentials
7
+ *
8
+ * This must be called before using any other functions.
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * configureTestClient({
13
+ * apiBase: 'https://arke-v1.arke.institute',
14
+ * userKey: process.env.ARKE_USER_KEY!,
15
+ * network: 'test',
16
+ * });
17
+ * ```
18
+ */
19
+ export declare function configureTestClient(config: TestConfig): void;
20
+ /**
21
+ * Get the current test client configuration
22
+ *
23
+ * @throws Error if configureTestClient has not been called
24
+ */
25
+ export declare function getConfig(): TestConfig;
26
+ /**
27
+ * Reset the test client configuration (useful for test teardown)
28
+ */
29
+ export declare function resetTestClient(): void;
30
+ /**
31
+ * Make an authenticated API request to the Arke API
32
+ *
33
+ * @param method - HTTP method
34
+ * @param path - API path (e.g., '/entities/123')
35
+ * @param body - Optional request body
36
+ * @returns Parsed JSON response
37
+ * @throws Error on API errors or invalid responses
38
+ */
39
+ export declare function apiRequest<T>(method: string, path: string, body?: Record<string, unknown>): Promise<T>;
40
+ /**
41
+ * Sleep for a specified duration
42
+ */
43
+ export declare function sleep(ms: number): Promise<void>;
44
+ /**
45
+ * Log a message with timestamp (useful for test debugging)
46
+ */
47
+ export declare function log(message: string, data?: unknown): void;
48
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAK1C;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,CAE5D;AAED;;;;GAIG;AACH,wBAAgB,SAAS,IAAI,UAAU,CAOtC;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,IAAI,CAEtC;AAED;;;;;;;;GAQG;AACH,wBAAsB,UAAU,CAAC,CAAC,EAChC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B,OAAO,CAAC,CAAC,CAAC,CA8BZ;AAED;;GAEG;AACH,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE/C;AAED;;GAEG;AACH,wBAAgB,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,CAOzD"}
package/dist/client.js ADDED
@@ -0,0 +1,93 @@
1
+ /**
2
+ * API client utilities for klados testing
3
+ */
4
+ // Global configuration
5
+ let globalConfig = null;
6
+ /**
7
+ * Configure the test client with API credentials
8
+ *
9
+ * This must be called before using any other functions.
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * configureTestClient({
14
+ * apiBase: 'https://arke-v1.arke.institute',
15
+ * userKey: process.env.ARKE_USER_KEY!,
16
+ * network: 'test',
17
+ * });
18
+ * ```
19
+ */
20
+ export function configureTestClient(config) {
21
+ globalConfig = config;
22
+ }
23
+ /**
24
+ * Get the current test client configuration
25
+ *
26
+ * @throws Error if configureTestClient has not been called
27
+ */
28
+ export function getConfig() {
29
+ if (!globalConfig) {
30
+ throw new Error('Test client not configured. Call configureTestClient() first.');
31
+ }
32
+ return globalConfig;
33
+ }
34
+ /**
35
+ * Reset the test client configuration (useful for test teardown)
36
+ */
37
+ export function resetTestClient() {
38
+ globalConfig = null;
39
+ }
40
+ /**
41
+ * Make an authenticated API request to the Arke API
42
+ *
43
+ * @param method - HTTP method
44
+ * @param path - API path (e.g., '/entities/123')
45
+ * @param body - Optional request body
46
+ * @returns Parsed JSON response
47
+ * @throws Error on API errors or invalid responses
48
+ */
49
+ export async function apiRequest(method, path, body) {
50
+ const config = getConfig();
51
+ const url = `${config.apiBase}${path}`;
52
+ const headers = {
53
+ Authorization: `ApiKey ${config.userKey}`,
54
+ 'Content-Type': 'application/json',
55
+ 'X-Arke-Network': config.network,
56
+ };
57
+ const response = await fetch(url, {
58
+ method,
59
+ headers,
60
+ body: body ? JSON.stringify(body) : undefined,
61
+ });
62
+ const text = await response.text();
63
+ let data;
64
+ try {
65
+ data = JSON.parse(text);
66
+ }
67
+ catch {
68
+ throw new Error(`Invalid JSON response: ${text}`);
69
+ }
70
+ if (!response.ok) {
71
+ throw new Error(`API error: ${response.status} - ${text}`);
72
+ }
73
+ return data;
74
+ }
75
+ /**
76
+ * Sleep for a specified duration
77
+ */
78
+ export function sleep(ms) {
79
+ return new Promise((resolve) => setTimeout(resolve, ms));
80
+ }
81
+ /**
82
+ * Log a message with timestamp (useful for test debugging)
83
+ */
84
+ export function log(message, data) {
85
+ const timestamp = new Date().toISOString().split('T')[1].split('.')[0];
86
+ if (data !== undefined) {
87
+ console.log(`[${timestamp}] ${message}`, JSON.stringify(data, null, 2));
88
+ }
89
+ else {
90
+ console.log(`[${timestamp}] ${message}`);
91
+ }
92
+ }
93
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"m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,CAAC;IACpD,CAAC;IAED,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,cAAc,QAAQ,CAAC,MAAM,MAAM,IAAI,EAAE,CAAC,CAAC;IAC7D,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,KAAK,CAAC,EAAU;IAC9B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAC3D,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,GAAG,CAAC,OAAe,EAAE,IAAc;IACjD,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACvE,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,OAAO,CAAC,GAAG,CAAC,IAAI,SAAS,KAAK,OAAO,EAAE,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAC1E,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,IAAI,SAAS,KAAK,OAAO,EAAE,CAAC,CAAC;IAC3C,CAAC;AACH,CAAC"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Entity and collection operations for klados testing
3
+ */
4
+ import type { Entity, Collection, CollectionEntities, CreateEntityOptions, CreateCollectionOptions } from './types';
5
+ /**
6
+ * Create a new entity
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * const entity = await createEntity({
11
+ * type: 'document',
12
+ * properties: { title: 'Test Document' },
13
+ * collectionId: collection.id,
14
+ * });
15
+ * ```
16
+ */
17
+ export declare function createEntity(options: CreateEntityOptions): Promise<Entity>;
18
+ /**
19
+ * Get an entity by ID
20
+ *
21
+ * @param id - Entity ID
22
+ */
23
+ export declare function getEntity(id: string): Promise<Entity>;
24
+ /**
25
+ * Delete an entity
26
+ *
27
+ * @param id - Entity ID to delete
28
+ */
29
+ export declare function deleteEntity(id: string): Promise<void>;
30
+ /**
31
+ * Create a new collection
32
+ *
33
+ * Uses POST /collections to get proper owner permissions.
34
+ *
35
+ * @example
36
+ * ```typescript
37
+ * const collection = await createCollection({
38
+ * label: 'Test Collection',
39
+ * allowedTypes: ['document'],
40
+ * });
41
+ * ```
42
+ */
43
+ export declare function createCollection(options: CreateCollectionOptions): Promise<Collection>;
44
+ /**
45
+ * Get entities in a collection
46
+ *
47
+ * Note: This endpoint has indexing lag. For log discovery, prefer
48
+ * using `getFirstLogFromCollection` which uses the first_log relationship.
49
+ *
50
+ * @param collectionId - Collection ID
51
+ */
52
+ export declare function getCollectionEntities(collectionId: string): Promise<CollectionEntities>;
53
+ //# sourceMappingURL=entities.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entities.d.ts","sourceRoot":"","sources":["../src/entities.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EACV,MAAM,EACN,UAAU,EACV,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,EACxB,MAAM,SAAS,CAAC;AAEjB;;;;;;;;;;;GAWG;AACH,wBAAsB,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,CAWhF;AAED;;;;GAIG;AACH,wBAAsB,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAE3D;AAED;;;;GAIG;AACH,wBAAsB,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE5D;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,UAAU,CAAC,CAMrB;AAED;;;;;;;GAOG;AACH,wBAAsB,qBAAqB,CACzC,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,kBAAkB,CAAC,CAK7B"}
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Entity and collection operations for klados testing
3
+ */
4
+ import { apiRequest } from './client';
5
+ /**
6
+ * Create a new entity
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * const entity = await createEntity({
11
+ * type: 'document',
12
+ * properties: { title: 'Test Document' },
13
+ * collectionId: collection.id,
14
+ * });
15
+ * ```
16
+ */
17
+ export async function createEntity(options) {
18
+ const body = {
19
+ type: options.type,
20
+ properties: options.properties,
21
+ };
22
+ if (options.collectionId) {
23
+ body.collection = options.collectionId;
24
+ }
25
+ return apiRequest('POST', '/entities', body);
26
+ }
27
+ /**
28
+ * Get an entity by ID
29
+ *
30
+ * @param id - Entity ID
31
+ */
32
+ export async function getEntity(id) {
33
+ return apiRequest('GET', `/entities/${id}`);
34
+ }
35
+ /**
36
+ * Delete an entity
37
+ *
38
+ * @param id - Entity ID to delete
39
+ */
40
+ export async function deleteEntity(id) {
41
+ await apiRequest('DELETE', `/entities/${id}`);
42
+ }
43
+ /**
44
+ * Create a new collection
45
+ *
46
+ * Uses POST /collections to get proper owner permissions.
47
+ *
48
+ * @example
49
+ * ```typescript
50
+ * const collection = await createCollection({
51
+ * label: 'Test Collection',
52
+ * allowedTypes: ['document'],
53
+ * });
54
+ * ```
55
+ */
56
+ export async function createCollection(options) {
57
+ return apiRequest('POST', '/collections', {
58
+ label: options.label,
59
+ description: options.description,
60
+ allowed_types: options.allowedTypes,
61
+ });
62
+ }
63
+ /**
64
+ * Get entities in a collection
65
+ *
66
+ * Note: This endpoint has indexing lag. For log discovery, prefer
67
+ * using `getFirstLogFromCollection` which uses the first_log relationship.
68
+ *
69
+ * @param collectionId - Collection ID
70
+ */
71
+ export async function getCollectionEntities(collectionId) {
72
+ return apiRequest('GET', `/collections/${collectionId}/entities`);
73
+ }
74
+ //# sourceMappingURL=entities.js.map
@@ -0,0 +1 @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klados-testing
3
+ *
4
+ * Test utilities for klados workers on the Arke network.
5
+ *
6
+ * @example
7
+ * ```typescript
8
+ * import {
9
+ * configureTestClient,
10
+ * createCollection,
11
+ * createEntity,
12
+ * deleteEntity,
13
+ * invokeKlados,
14
+ * waitForKladosLog,
15
+ * assertLogCompleted,
16
+ * assertLogHasMessages,
17
+ * } from '@arke-institute/klados-testing';
18
+ *
19
+ * // Configure once in test setup
20
+ * configureTestClient({
21
+ * apiBase: 'https://arke-v1.arke.institute',
22
+ * userKey: process.env.ARKE_USER_KEY!,
23
+ * network: 'test',
24
+ * });
25
+ *
26
+ * // Create test fixtures
27
+ * const collection = await createCollection({ label: 'Test' });
28
+ * const entity = await createEntity({
29
+ * type: 'document',
30
+ * properties: { content: 'test' },
31
+ * collectionId: collection.id,
32
+ * });
33
+ *
34
+ * // Invoke klados
35
+ * const result = await invokeKlados({
36
+ * kladosId: 'klados_xxx',
37
+ * targetEntity: entity.id,
38
+ * targetCollection: collection.id,
39
+ * jobCollection: collection.id,
40
+ * });
41
+ *
42
+ * // Wait for completion and verify
43
+ * const log = await waitForKladosLog(result.job_collection!);
44
+ * assertLogCompleted(log);
45
+ * assertLogHasMessages(log, [
46
+ * { level: 'info', textContains: 'Processing' },
47
+ * ]);
48
+ *
49
+ * // Cleanup
50
+ * await deleteEntity(entity.id);
51
+ * await deleteEntity(collection.id);
52
+ * ```
53
+ */
54
+ export { configureTestClient, getConfig, resetTestClient, apiRequest, sleep, log } from './client';
55
+ export { createEntity, getEntity, deleteEntity, createCollection, getCollectionEntities } from './entities';
56
+ export { getKladosLog, getFirstLogFromCollection, waitForKladosLog, getLogMessages, getLogEntry } from './logs';
57
+ export { invokeKlados } from './invoke';
58
+ export { assertLogCompleted, assertLogFailed, assertLogHasMessages, assertLogMessageCount, assertLogHasHandoff, } from './assertions';
59
+ export type { TestConfig, Entity, Collection, CollectionEntities, InvokeResult, LogMessage, KladosLogEntry, CreateEntityOptions, CreateCollectionOptions, InvokeKladosOptions, WaitForLogOptions, LogMessageCriteria, } from './types';
60
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AAGH,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,eAAe,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAGnG,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAG5G,OAAO,EAAE,YAAY,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAGhH,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAGxC,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,cAAc,CAAC;AAGtB,YAAY,EACV,UAAU,EACV,MAAM,EACN,UAAU,EACV,kBAAkB,EAClB,YAAY,EACZ,UAAU,EACV,cAAc,EACd,mBAAmB,EACnB,uBAAuB,EACvB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,SAAS,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,64 @@
1
+ /**
2
+ * @arke-institute/klados-testing
3
+ *
4
+ * Test utilities for klados workers on the Arke network.
5
+ *
6
+ * @example
7
+ * ```typescript
8
+ * import {
9
+ * configureTestClient,
10
+ * createCollection,
11
+ * createEntity,
12
+ * deleteEntity,
13
+ * invokeKlados,
14
+ * waitForKladosLog,
15
+ * assertLogCompleted,
16
+ * assertLogHasMessages,
17
+ * } from '@arke-institute/klados-testing';
18
+ *
19
+ * // Configure once in test setup
20
+ * configureTestClient({
21
+ * apiBase: 'https://arke-v1.arke.institute',
22
+ * userKey: process.env.ARKE_USER_KEY!,
23
+ * network: 'test',
24
+ * });
25
+ *
26
+ * // Create test fixtures
27
+ * const collection = await createCollection({ label: 'Test' });
28
+ * const entity = await createEntity({
29
+ * type: 'document',
30
+ * properties: { content: 'test' },
31
+ * collectionId: collection.id,
32
+ * });
33
+ *
34
+ * // Invoke klados
35
+ * const result = await invokeKlados({
36
+ * kladosId: 'klados_xxx',
37
+ * targetEntity: entity.id,
38
+ * targetCollection: collection.id,
39
+ * jobCollection: collection.id,
40
+ * });
41
+ *
42
+ * // Wait for completion and verify
43
+ * const log = await waitForKladosLog(result.job_collection!);
44
+ * assertLogCompleted(log);
45
+ * assertLogHasMessages(log, [
46
+ * { level: 'info', textContains: 'Processing' },
47
+ * ]);
48
+ *
49
+ * // Cleanup
50
+ * await deleteEntity(entity.id);
51
+ * await deleteEntity(collection.id);
52
+ * ```
53
+ */
54
+ // Configuration
55
+ export { configureTestClient, getConfig, resetTestClient, apiRequest, sleep, log } from './client';
56
+ // Entity operations
57
+ export { createEntity, getEntity, deleteEntity, createCollection, getCollectionEntities } from './entities';
58
+ // Log utilities
59
+ export { getKladosLog, getFirstLogFromCollection, waitForKladosLog, getLogMessages, getLogEntry } from './logs';
60
+ // Klados invocation
61
+ export { invokeKlados } from './invoke';
62
+ // Assertions
63
+ export { assertLogCompleted, assertLogFailed, assertLogHasMessages, assertLogMessageCount, assertLogHasHandoff, } from './assertions';
64
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AAEH,gBAAgB;AAChB,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,eAAe,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAEnG,oBAAoB;AACpB,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAE5G,gBAAgB;AAChB,OAAO,EAAE,YAAY,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAEhH,oBAAoB;AACpB,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,aAAa;AACb,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,cAAc,CAAC"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Klados invocation utilities for testing
3
+ */
4
+ import type { InvokeResult, InvokeKladosOptions } from './types';
5
+ /**
6
+ * Invoke a klados worker
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * const result = await invokeKlados({
11
+ * kladosId: 'klados_abc123',
12
+ * targetEntity: entity.id,
13
+ * targetCollection: collection.id,
14
+ * jobCollection: jobCollection.id,
15
+ * confirm: true,
16
+ * });
17
+ *
18
+ * if (result.status === 'started') {
19
+ * console.log('Job started:', result.job_id);
20
+ * }
21
+ * ```
22
+ *
23
+ * @param options - Invocation options
24
+ * @returns The invocation result
25
+ */
26
+ export declare function invokeKlados(options: InvokeKladosOptions): Promise<InvokeResult>;
27
+ //# sourceMappingURL=invoke.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invoke.d.ts","sourceRoot":"","sources":["../src/invoke.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEjE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,YAAY,CAChC,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,YAAY,CAAC,CAwBvB"}
package/dist/invoke.js ADDED
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Klados invocation utilities for testing
3
+ */
4
+ import { apiRequest } from './client';
5
+ /**
6
+ * Invoke a klados worker
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * const result = await invokeKlados({
11
+ * kladosId: 'klados_abc123',
12
+ * targetEntity: entity.id,
13
+ * targetCollection: collection.id,
14
+ * jobCollection: jobCollection.id,
15
+ * confirm: true,
16
+ * });
17
+ *
18
+ * if (result.status === 'started') {
19
+ * console.log('Job started:', result.job_id);
20
+ * }
21
+ * ```
22
+ *
23
+ * @param options - Invocation options
24
+ * @returns The invocation result
25
+ */
26
+ export async function invokeKlados(options) {
27
+ const body = {
28
+ target_collection: options.targetCollection,
29
+ job_collection: options.jobCollection,
30
+ confirm: options.confirm ?? true,
31
+ };
32
+ if (options.targetEntity) {
33
+ body.target_entity = options.targetEntity;
34
+ }
35
+ if (options.targetEntities) {
36
+ body.target_entities = options.targetEntities;
37
+ }
38
+ if (options.input) {
39
+ body.input = options.input;
40
+ }
41
+ return apiRequest('POST', `/kladoi/${options.kladosId}/invoke`, body);
42
+ }
43
+ //# sourceMappingURL=invoke.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invoke.js","sourceRoot":"","sources":["../src/invoke.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAGtC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,OAA4B;IAE5B,MAAM,IAAI,GAA4B;QACpC,iBAAiB,EAAE,OAAO,CAAC,gBAAgB;QAC3C,cAAc,EAAE,OAAO,CAAC,aAAa;QACrC,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,IAAI;KACjC,CAAC;IAEF,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;QACzB,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC;IAC5C,CAAC;IAED,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;QAC3B,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC;IAChD,CAAC;IAED,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QAClB,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;IAC7B,CAAC;IAED,OAAO,UAAU,CACf,MAAM,EACN,WAAW,OAAO,CAAC,QAAQ,SAAS,EACpC,IAAI,CACL,CAAC;AACJ,CAAC"}
package/dist/logs.d.ts ADDED
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Klados log utilities for testing
3
+ */
4
+ import type { KladosLogEntry, WaitForLogOptions } from './types';
5
+ /**
6
+ * Get a klados log entry by ID
7
+ *
8
+ * @param logId - Log entity ID
9
+ */
10
+ export declare function getKladosLog(logId: string): Promise<KladosLogEntry>;
11
+ /**
12
+ * Get the first_log relationship from a job collection
13
+ *
14
+ * This is more reliable than the indexed /collections/{id}/entities endpoint
15
+ * because it doesn't have indexing lag.
16
+ *
17
+ * @param collectionId - Job collection ID
18
+ * @returns Log entity ID or null if not found
19
+ */
20
+ export declare function getFirstLogFromCollection(collectionId: string): Promise<string | null>;
21
+ /**
22
+ * Wait for and retrieve the klados log from a job collection
23
+ *
24
+ * Uses the first_log relationship on the job collection for reliable discovery
25
+ * (bypasses indexing lag of the /collections/{id}/entities endpoint).
26
+ *
27
+ * Waits for the log to reach a terminal state (done or error) before returning.
28
+ *
29
+ * @example
30
+ * ```typescript
31
+ * const log = await waitForKladosLog(result.jobCollectionId, {
32
+ * timeout: 30000,
33
+ * pollInterval: 1000,
34
+ * });
35
+ *
36
+ * if (log) {
37
+ * console.log('Log status:', log.properties.status);
38
+ * }
39
+ * ```
40
+ *
41
+ * @param jobCollectionId - Job collection ID to search for logs
42
+ * @param options - Wait options
43
+ * @returns The log entry or null if not found within timeout
44
+ */
45
+ export declare function waitForKladosLog(jobCollectionId: string, options?: WaitForLogOptions): Promise<KladosLogEntry | null>;
46
+ /**
47
+ * Get all log messages from a klados log
48
+ *
49
+ * @param log - The klados log entry
50
+ */
51
+ export declare function getLogMessages(log: KladosLogEntry): import("./types").LogMessage[];
52
+ /**
53
+ * Get the log entry details from a klados log
54
+ *
55
+ * @param log - The klados log entry
56
+ */
57
+ export declare function getLogEntry(log: KladosLogEntry): {
58
+ id: string;
59
+ job_id: string;
60
+ klados_id: string;
61
+ status: "running" | "done" | "error";
62
+ started_at: string;
63
+ completed_at?: string;
64
+ received: {
65
+ target_entity?: string;
66
+ target_entities?: string[];
67
+ target_collection: string;
68
+ from_logs?: string[];
69
+ batch?: {
70
+ slot_id: string;
71
+ batch_id: string;
72
+ index: number;
73
+ total: number;
74
+ };
75
+ };
76
+ handoffs?: Array<{
77
+ target: string;
78
+ type: "invoke" | "scatter" | "complete" | "error" | "none";
79
+ job_id?: string;
80
+ error?: string;
81
+ }>;
82
+ error?: {
83
+ code: string;
84
+ message: string;
85
+ retryable: boolean;
86
+ };
87
+ };
88
+ //# sourceMappingURL=logs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logs.d.ts","sourceRoot":"","sources":["../src/logs.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAU,cAAc,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEzE;;;;GAIG;AACH,wBAAsB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAEzE;AAED;;;;;;;;GAQG;AACH,wBAAsB,yBAAyB,CAC7C,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CASxB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,gBAAgB,CACpC,eAAe,EAAE,MAAM,EACvB,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CA0BhC;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,cAAc,kCAEjD;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,cAAc;;;;;;;;qBAvBpB,CAAC;uBAGtB,CAAC;;iBAOU,CAAC;aAEjB,CAAA;;;;;;;;;;cAW4C,CAAC;aAC1B,CAAC;;;;;;;EACpB"}
package/dist/logs.js ADDED
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Klados log utilities for testing
3
+ */
4
+ import { apiRequest, sleep } from './client';
5
+ /**
6
+ * Get a klados log entry by ID
7
+ *
8
+ * @param logId - Log entity ID
9
+ */
10
+ export async function getKladosLog(logId) {
11
+ return apiRequest('GET', `/entities/${logId}`);
12
+ }
13
+ /**
14
+ * Get the first_log relationship from a job collection
15
+ *
16
+ * This is more reliable than the indexed /collections/{id}/entities endpoint
17
+ * because it doesn't have indexing lag.
18
+ *
19
+ * @param collectionId - Job collection ID
20
+ * @returns Log entity ID or null if not found
21
+ */
22
+ export async function getFirstLogFromCollection(collectionId) {
23
+ const collection = await apiRequest('GET', `/entities/${collectionId}`);
24
+ // Find the first_log relationship
25
+ const firstLogRel = collection.relationships?.find((r) => r.predicate === 'first_log');
26
+ return firstLogRel?.peer ?? null;
27
+ }
28
+ /**
29
+ * Wait for and retrieve the klados log from a job collection
30
+ *
31
+ * Uses the first_log relationship on the job collection for reliable discovery
32
+ * (bypasses indexing lag of the /collections/{id}/entities endpoint).
33
+ *
34
+ * Waits for the log to reach a terminal state (done or error) before returning.
35
+ *
36
+ * @example
37
+ * ```typescript
38
+ * const log = await waitForKladosLog(result.jobCollectionId, {
39
+ * timeout: 30000,
40
+ * pollInterval: 1000,
41
+ * });
42
+ *
43
+ * if (log) {
44
+ * console.log('Log status:', log.properties.status);
45
+ * }
46
+ * ```
47
+ *
48
+ * @param jobCollectionId - Job collection ID to search for logs
49
+ * @param options - Wait options
50
+ * @returns The log entry or null if not found within timeout
51
+ */
52
+ export async function waitForKladosLog(jobCollectionId, options) {
53
+ const timeout = options?.timeout ?? 10000;
54
+ const pollInterval = options?.pollInterval ?? 1000;
55
+ const startTime = Date.now();
56
+ while (Date.now() - startTime < timeout) {
57
+ try {
58
+ // Use first_log relationship for reliable discovery
59
+ const firstLogId = await getFirstLogFromCollection(jobCollectionId);
60
+ if (firstLogId) {
61
+ const log = await getKladosLog(firstLogId);
62
+ // Wait for terminal state (done or error)
63
+ if (log.properties.status === 'done' || log.properties.status === 'error') {
64
+ return log;
65
+ }
66
+ // Log exists but still running, continue polling
67
+ }
68
+ }
69
+ catch {
70
+ // Ignore errors during polling, just retry
71
+ }
72
+ await sleep(pollInterval);
73
+ }
74
+ return null;
75
+ }
76
+ /**
77
+ * Get all log messages from a klados log
78
+ *
79
+ * @param log - The klados log entry
80
+ */
81
+ export function getLogMessages(log) {
82
+ return log.properties.log_data.messages;
83
+ }
84
+ /**
85
+ * Get the log entry details from a klados log
86
+ *
87
+ * @param log - The klados log entry
88
+ */
89
+ export function getLogEntry(log) {
90
+ return log.properties.log_data.entry;
91
+ }
92
+ //# sourceMappingURL=logs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logs.js","sourceRoot":"","sources":["../src/logs.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAG7C;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,KAAa;IAC9C,OAAO,UAAU,CAAiB,KAAK,EAAE,aAAa,KAAK,EAAE,CAAC,CAAC;AACjE,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAC7C,YAAoB;IAEpB,MAAM,UAAU,GAAG,MAAM,UAAU,CAAS,KAAK,EAAE,aAAa,YAAY,EAAE,CAAC,CAAC;IAEhF,kCAAkC;IAClC,MAAM,WAAW,GAAG,UAAU,CAAC,aAAa,EAAE,IAAI,CAChD,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,KAAK,WAAW,CACnC,CAAC;IAEF,OAAO,WAAW,EAAE,IAAI,IAAI,IAAI,CAAC;AACn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7
+ export interface TestConfig {
8
+ /** Arke API base URL */
9
+ apiBase: string;
10
+ /** User API key (uk_...) for authentication */
11
+ userKey: string;
12
+ /** Network to operate on ('test' or 'main') */
13
+ network: 'test' | 'main';
14
+ }
15
+ /**
16
+ * A generic Arke entity
17
+ */
18
+ export interface Entity {
19
+ id: string;
20
+ type: string;
21
+ cid: string;
22
+ properties: Record<string, unknown>;
23
+ relationships?: Array<{
24
+ predicate: string;
25
+ peer: string;
26
+ peer_type?: string;
27
+ direction?: 'incoming' | 'outgoing';
28
+ }>;
29
+ }
30
+ /**
31
+ * A collection entity
32
+ */
33
+ export interface Collection {
34
+ id: string;
35
+ type: 'collection';
36
+ cid: string;
37
+ properties: {
38
+ label: string;
39
+ description?: string;
40
+ allowed_types?: string[];
41
+ };
42
+ }
43
+ /**
44
+ * Response from /collections/{id}/entities endpoint
45
+ */
46
+ export interface CollectionEntities {
47
+ collection_id: string;
48
+ entities: Array<{
49
+ pi: string;
50
+ type: string;
51
+ label: string;
52
+ }>;
53
+ }
54
+ /**
55
+ * Result of invoking a klados
56
+ */
57
+ export interface InvokeResult {
58
+ status: 'started' | 'rejected' | 'pending_confirmation';
59
+ job_id?: string;
60
+ job_collection?: string;
61
+ klados_id?: string;
62
+ error?: string;
63
+ message?: string;
64
+ }
65
+ /**
66
+ * A log message from klados execution
67
+ */
68
+ export interface LogMessage {
69
+ level: 'info' | 'warning' | 'error' | 'success';
70
+ message: string;
71
+ metadata?: Record<string, unknown>;
72
+ timestamp: string;
73
+ }
74
+ /**
75
+ * A klados log entry entity
76
+ */
77
+ export interface KladosLogEntry {
78
+ id: string;
79
+ type: string;
80
+ cid: string;
81
+ properties: {
82
+ job_id: string;
83
+ klados_id: string;
84
+ status: 'running' | 'done' | 'error';
85
+ log_data: {
86
+ agent_id: string;
87
+ agent_version: string;
88
+ entry: {
89
+ id: string;
90
+ job_id: string;
91
+ klados_id: string;
92
+ status: 'running' | 'done' | 'error';
93
+ started_at: string;
94
+ completed_at?: string;
95
+ received: {
96
+ target_entity?: string;
97
+ target_entities?: string[];
98
+ target_collection: string;
99
+ from_logs?: string[];
100
+ batch?: {
101
+ slot_id: string;
102
+ batch_id: string;
103
+ index: number;
104
+ total: number;
105
+ };
106
+ };
107
+ handoffs?: Array<{
108
+ target: string;
109
+ type: 'invoke' | 'scatter' | 'complete' | 'error' | 'none';
110
+ job_id?: string;
111
+ error?: string;
112
+ }>;
113
+ error?: {
114
+ code: string;
115
+ message: string;
116
+ retryable: boolean;
117
+ };
118
+ };
119
+ messages: LogMessage[];
120
+ };
121
+ };
122
+ }
123
+ /**
124
+ * Options for creating an entity
125
+ */
126
+ export interface CreateEntityOptions {
127
+ type: string;
128
+ properties: Record<string, unknown>;
129
+ collectionId?: string;
130
+ }
131
+ /**
132
+ * Options for creating a collection
133
+ */
134
+ export interface CreateCollectionOptions {
135
+ label: string;
136
+ description?: string;
137
+ allowedTypes?: string[];
138
+ }
139
+ /**
140
+ * Options for invoking a klados
141
+ */
142
+ export interface InvokeKladosOptions {
143
+ /** Klados ID to invoke */
144
+ kladosId: string;
145
+ /** Collection for permission scope (required) */
146
+ targetCollection: string;
147
+ /** Single entity to process (for cardinality: 'one') */
148
+ targetEntity?: string;
149
+ /** Multiple entities to process (for cardinality: 'many') */
150
+ targetEntities?: string[];
151
+ /** Job collection for logs */
152
+ jobCollection: string;
153
+ /** Execute (true) or preview (false) */
154
+ confirm?: boolean;
155
+ /** Optional input data */
156
+ input?: Record<string, unknown>;
157
+ }
158
+ /**
159
+ * Options for waiting for a klados log
160
+ */
161
+ export interface WaitForLogOptions {
162
+ /** Maximum time to wait in milliseconds (default: 10000) */
163
+ timeout?: number;
164
+ /** Poll interval in milliseconds (default: 1000) */
165
+ pollInterval?: number;
166
+ }
167
+ /**
168
+ * Criteria for matching a log message
169
+ */
170
+ export interface LogMessageCriteria {
171
+ /** Expected log level */
172
+ level?: 'info' | 'warning' | 'error' | 'success';
173
+ /** Text that should be contained in the message */
174
+ textContains?: string;
175
+ /** Exact message text match */
176
+ textEquals?: string;
177
+ }
178
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,wBAAwB;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,+CAA+C;IAC/C,OAAO,EAAE,MAAM,CAAC;IAChB,+CAA+C;IAC/C,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;CAC1B;AAMD;;GAEG;AACH,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,aAAa,CAAC,EAAE,KAAK,CAAC;QACpB,SAAS,EAAE,MAAM,CAAC;QAClB,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,SAAS,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC;KACrC,CAAC,CAAC;CACJ;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,YAAY,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE;QACV,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;KAC1B,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,KAAK,CAAC;QACd,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;KACf,CAAC,CAAC;CACJ;AAMD;;GAEG;AACH,MAA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tB,wCAAwC;IACxC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,0BAA0B;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,4DAA4D;IAC5D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oDAAoD;IACpD,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,yBAAyB;IACzB,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;IACjD,mDAAmD;IACnD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,+BAA+B;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB"}
package/dist/types.js ADDED
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Type definitions for klados testing utilities
3
+ */
4
+ export {};
5
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG"}
package/package.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "@arke-institute/klados-testing",
3
+ "version": "0.1.0",
4
+ "description": "Test utilities for klados workers on the Arke network",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist"
16
+ ],
17
+ "scripts": {
18
+ "build": "tsc",
19
+ "dev": "tsc --watch",
20
+ "type-check": "tsc --noEmit",
21
+ "clean": "rm -rf dist"
22
+ },
23
+ "peerDependencies": {
24
+ "@arke-institute/sdk": "^2.9.0"
25
+ },
26
+ "peerDependenciesMeta": {
27
+ "@arke-institute/sdk": {
28
+ "optional": true
29
+ }
30
+ },
31
+ "devDependencies": {
32
+ "@arke-institute/sdk": "^2.9.0",
33
+ "typescript": "^5.7.2"
34
+ },
35
+ "keywords": [
36
+ "arke",
37
+ "klados",
38
+ "testing",
39
+ "workflow",
40
+ "e2e"
41
+ ],
42
+ "author": "Arke Institute",
43
+ "license": "MIT"
44
+ }