@arke-institute/sdk 0.1.2 → 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.
Files changed (64) hide show
  1. package/README.md +126 -184
  2. package/dist/generated/index.cjs +19 -0
  3. package/dist/generated/index.cjs.map +1 -0
  4. package/dist/generated/index.d.cts +6192 -0
  5. package/dist/generated/index.d.ts +6192 -0
  6. package/dist/generated/index.js +1 -0
  7. package/dist/generated/index.js.map +1 -0
  8. package/dist/index-BrXke2kI.d.ts +302 -0
  9. package/dist/index-FHcLPBSV.d.cts +302 -0
  10. package/dist/index.cjs +188 -3654
  11. package/dist/index.cjs.map +1 -1
  12. package/dist/index.d.cts +62 -7
  13. package/dist/index.d.ts +62 -7
  14. package/dist/index.js +168 -3626
  15. package/dist/index.js.map +1 -1
  16. package/dist/operations/index.cjs +113 -0
  17. package/dist/operations/index.cjs.map +1 -0
  18. package/dist/operations/index.d.cts +3 -0
  19. package/dist/operations/index.d.ts +3 -0
  20. package/dist/operations/index.js +84 -0
  21. package/dist/operations/index.js.map +1 -0
  22. package/package.json +44 -53
  23. package/dist/client-dAk3E64p.d.cts +0 -183
  24. package/dist/client-dAk3E64p.d.ts +0 -183
  25. package/dist/collections/index.cjs +0 -233
  26. package/dist/collections/index.cjs.map +0 -1
  27. package/dist/collections/index.d.cts +0 -9
  28. package/dist/collections/index.d.ts +0 -9
  29. package/dist/collections/index.js +0 -205
  30. package/dist/collections/index.js.map +0 -1
  31. package/dist/content/index.cjs +0 -506
  32. package/dist/content/index.cjs.map +0 -1
  33. package/dist/content/index.d.cts +0 -403
  34. package/dist/content/index.d.ts +0 -403
  35. package/dist/content/index.js +0 -473
  36. package/dist/content/index.js.map +0 -1
  37. package/dist/edit/index.cjs +0 -1029
  38. package/dist/edit/index.cjs.map +0 -1
  39. package/dist/edit/index.d.cts +0 -78
  40. package/dist/edit/index.d.ts +0 -78
  41. package/dist/edit/index.js +0 -983
  42. package/dist/edit/index.js.map +0 -1
  43. package/dist/errors-3L7IiHcr.d.cts +0 -480
  44. package/dist/errors-B82BMmRP.d.cts +0 -343
  45. package/dist/errors-B82BMmRP.d.ts +0 -343
  46. package/dist/errors-BTe8GKRQ.d.ts +0 -480
  47. package/dist/graph/index.cjs +0 -433
  48. package/dist/graph/index.cjs.map +0 -1
  49. package/dist/graph/index.d.cts +0 -456
  50. package/dist/graph/index.d.ts +0 -456
  51. package/dist/graph/index.js +0 -402
  52. package/dist/graph/index.js.map +0 -1
  53. package/dist/query/index.cjs +0 -289
  54. package/dist/query/index.cjs.map +0 -1
  55. package/dist/query/index.d.cts +0 -541
  56. package/dist/query/index.d.ts +0 -541
  57. package/dist/query/index.js +0 -261
  58. package/dist/query/index.js.map +0 -1
  59. package/dist/upload/index.cjs +0 -1634
  60. package/dist/upload/index.cjs.map +0 -1
  61. package/dist/upload/index.d.cts +0 -150
  62. package/dist/upload/index.d.ts +0 -150
  63. package/dist/upload/index.js +0 -1597
  64. package/dist/upload/index.js.map +0 -1
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/operations/index.ts
21
+ var operations_exports = {};
22
+ __export(operations_exports, {
23
+ BatchOperations: () => BatchOperations,
24
+ CryptoOperations: () => CryptoOperations,
25
+ FolderOperations: () => FolderOperations
26
+ });
27
+ module.exports = __toCommonJS(operations_exports);
28
+
29
+ // src/operations/folders.ts
30
+ var FolderOperations = class {
31
+ constructor(client) {
32
+ this.client = client;
33
+ }
34
+ /**
35
+ * Upload a local directory to Arke
36
+ *
37
+ * TODO: Implement this method
38
+ * Steps:
39
+ * 1. Scan directory structure
40
+ * 2. Create folder hierarchy (depth-first)
41
+ * 3. Upload files in parallel (with concurrency limit)
42
+ * 4. Create bidirectional relationships (folder contains file)
43
+ */
44
+ async uploadDirectory(_localPath, _options) {
45
+ throw new Error("FolderOperations.uploadDirectory is not yet implemented");
46
+ }
47
+ };
48
+
49
+ // src/operations/batch.ts
50
+ var BatchOperations = class {
51
+ constructor(client) {
52
+ this.client = client;
53
+ }
54
+ /**
55
+ * Create multiple entities in parallel
56
+ *
57
+ * TODO: Implement this method
58
+ */
59
+ async createEntities(_entities, _options) {
60
+ throw new Error("BatchOperations.createEntities is not yet implemented");
61
+ }
62
+ /**
63
+ * Create multiple relationships in parallel
64
+ *
65
+ * TODO: Implement this method
66
+ */
67
+ async createRelationships(_relationships, _options) {
68
+ throw new Error("BatchOperations.createRelationships is not yet implemented");
69
+ }
70
+ };
71
+
72
+ // src/operations/crypto.ts
73
+ var CryptoOperations = class {
74
+ /**
75
+ * Generate an Ed25519 key pair for agent authentication
76
+ *
77
+ * TODO: Implement using Node.js crypto or Web Crypto API
78
+ */
79
+ static async generateKeyPair() {
80
+ throw new Error("CryptoOperations.generateKeyPair is not yet implemented");
81
+ }
82
+ /**
83
+ * Sign a payload with an Ed25519 private key
84
+ *
85
+ * TODO: Implement signature generation
86
+ */
87
+ static async signPayload(_privateKey, _payload) {
88
+ throw new Error("CryptoOperations.signPayload is not yet implemented");
89
+ }
90
+ /**
91
+ * Verify an Ed25519 signature
92
+ *
93
+ * TODO: Implement signature verification
94
+ */
95
+ static async verifySignature(_publicKey, _payload, _signature) {
96
+ throw new Error("CryptoOperations.verifySignature is not yet implemented");
97
+ }
98
+ /**
99
+ * Compute IPFS CID for content
100
+ *
101
+ * TODO: Implement using multiformats library
102
+ */
103
+ static async computeCID(_content) {
104
+ throw new Error("CryptoOperations.computeCID is not yet implemented");
105
+ }
106
+ };
107
+ // Annotate the CommonJS export names for ESM import in node:
108
+ 0 && (module.exports = {
109
+ BatchOperations,
110
+ CryptoOperations,
111
+ FolderOperations
112
+ });
113
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/operations/index.ts","../../src/operations/folders.ts","../../src/operations/batch.ts","../../src/operations/crypto.ts"],"sourcesContent":["/**\n * High-level operations built on top of the generated API client\n *\n * These provide convenience methods for common multi-step workflows.\n */\n\nexport { FolderOperations, type UploadProgress, type UploadDirectoryOptions, type UploadDirectoryResult } from './folders.js';\nexport { BatchOperations, type BatchCreateOptions, type BatchResult } from './batch.js';\nexport { CryptoOperations, type KeyPair, type SignedPayload } from './crypto.js';\n","/**\n * Folder Operations\n *\n * High-level operations for working with folders and directory structures.\n *\n * TODO: Implement folder operations\n * - uploadDirectory: Recursively upload a local directory\n * - createFolderHierarchy: Create folder structure from paths\n * - moveFolderContents: Move files between folders\n */\n\nimport type { ArkeClient } from '../client/ArkeClient.js';\n\nexport interface UploadProgress {\n phase: 'scanning' | 'creating-folders' | 'uploading-files' | 'linking' | 'complete';\n totalFiles: number;\n completedFiles: number;\n totalFolders: number;\n completedFolders: number;\n currentFile?: string;\n}\n\nexport interface UploadDirectoryOptions {\n /** Collection to upload into */\n collectionId: string;\n /** Parent folder ID (optional - creates at root if not provided) */\n parentFolderId?: string;\n /** Progress callback */\n onProgress?: (progress: UploadProgress) => void;\n /** Max concurrent uploads */\n concurrency?: number;\n}\n\nexport interface UploadDirectoryResult {\n /** Root folder entity */\n rootFolder: unknown; // TODO: Type from generated types\n /** All created folder entities */\n folders: unknown[];\n /** All created file entities */\n files: unknown[];\n}\n\n/**\n * Folder operations helper\n *\n * @example\n * ```typescript\n * const folders = new FolderOperations(arkeClient);\n * const result = await folders.uploadDirectory('/path/to/local/folder', {\n * collectionId: '01ABC...',\n * onProgress: (p) => console.log(`${p.completedFiles}/${p.totalFiles} files`),\n * });\n * ```\n */\nexport class FolderOperations {\n constructor(private client: ArkeClient) {}\n\n /**\n * Upload a local directory to Arke\n *\n * TODO: Implement this method\n * Steps:\n * 1. Scan directory structure\n * 2. Create folder hierarchy (depth-first)\n * 3. Upload files in parallel (with concurrency limit)\n * 4. Create bidirectional relationships (folder contains file)\n */\n async uploadDirectory(\n _localPath: string,\n _options: UploadDirectoryOptions\n ): Promise<UploadDirectoryResult> {\n throw new Error('FolderOperations.uploadDirectory is not yet implemented');\n }\n}\n","/**\n * Batch Operations\n *\n * High-level operations for bulk entity and relationship management.\n *\n * TODO: Implement batch operations\n * - createEntities: Create multiple entities in parallel\n * - updateEntities: Update multiple entities in parallel\n * - createRelationships: Create multiple relationships in parallel\n */\n\nimport type { ArkeClient } from '../client/ArkeClient.js';\n\nexport interface BatchCreateOptions {\n /** Max concurrent operations */\n concurrency?: number;\n /** Continue on individual failures */\n continueOnError?: boolean;\n /** Progress callback */\n onProgress?: (completed: number, total: number) => void;\n}\n\nexport interface BatchResult<T> {\n /** Successfully completed operations */\n succeeded: T[];\n /** Failed operations with errors */\n failed: Array<{ input: unknown; error: Error }>;\n}\n\n/**\n * Batch operations helper\n *\n * @example\n * ```typescript\n * const batch = new BatchOperations(arkeClient);\n * const result = await batch.createEntities([\n * { type: 'document', properties: { title: 'Doc 1' } },\n * { type: 'document', properties: { title: 'Doc 2' } },\n * ], { concurrency: 5 });\n * ```\n */\nexport class BatchOperations {\n constructor(private client: ArkeClient) {}\n\n /**\n * Create multiple entities in parallel\n *\n * TODO: Implement this method\n */\n async createEntities(\n _entities: Array<{\n collectionId: string;\n type: string;\n properties?: Record<string, unknown>;\n }>,\n _options?: BatchCreateOptions\n ): Promise<BatchResult<unknown>> {\n throw new Error('BatchOperations.createEntities is not yet implemented');\n }\n\n /**\n * Create multiple relationships in parallel\n *\n * TODO: Implement this method\n */\n async createRelationships(\n _relationships: Array<{\n sourceId: string;\n targetId: string;\n predicate: string;\n bidirectional?: boolean;\n properties?: Record<string, unknown>;\n }>,\n _options?: BatchCreateOptions\n ): Promise<BatchResult<unknown>> {\n throw new Error('BatchOperations.createRelationships is not yet implemented');\n }\n}\n","/**\n * Crypto Operations\n *\n * Cryptographic utilities for agents and content addressing.\n *\n * TODO: Implement crypto operations\n * - generateKeyPair: Generate Ed25519 key pair for agent authentication\n * - signPayload: Sign a payload with agent private key\n * - computeCID: Compute IPFS CID for content\n */\n\n/**\n * Ed25519 key pair for agent authentication\n */\nexport interface KeyPair {\n /** Public key in base64 */\n publicKey: string;\n /** Private key in base64 (keep secret!) */\n privateKey: string;\n}\n\n/**\n * Signed payload with signature\n */\nexport interface SignedPayload {\n /** Original payload */\n payload: string;\n /** Ed25519 signature in base64 */\n signature: string;\n /** Timestamp of signature */\n timestamp: number;\n}\n\n/**\n * Crypto operations helper\n *\n * @example\n * ```typescript\n * // Generate key pair for a new agent\n * const { publicKey, privateKey } = await CryptoOperations.generateKeyPair();\n *\n * // Sign a payload\n * const signed = await CryptoOperations.signPayload(privateKey, payload);\n * ```\n */\nexport class CryptoOperations {\n /**\n * Generate an Ed25519 key pair for agent authentication\n *\n * TODO: Implement using Node.js crypto or Web Crypto API\n */\n static async generateKeyPair(): Promise<KeyPair> {\n throw new Error('CryptoOperations.generateKeyPair is not yet implemented');\n }\n\n /**\n * Sign a payload with an Ed25519 private key\n *\n * TODO: Implement signature generation\n */\n static async signPayload(_privateKey: string, _payload: string): Promise<SignedPayload> {\n throw new Error('CryptoOperations.signPayload is not yet implemented');\n }\n\n /**\n * Verify an Ed25519 signature\n *\n * TODO: Implement signature verification\n */\n static async verifySignature(\n _publicKey: string,\n _payload: string,\n _signature: string\n ): Promise<boolean> {\n throw new Error('CryptoOperations.verifySignature is not yet implemented');\n }\n\n /**\n * Compute IPFS CID for content\n *\n * TODO: Implement using multiformats library\n */\n static async computeCID(_content: Uint8Array): Promise<string> {\n throw new Error('CryptoOperations.computeCID is not yet implemented');\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACsDO,IAAM,mBAAN,MAAuB;AAAA,EAC5B,YAAoB,QAAoB;AAApB;AAAA,EAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYzC,MAAM,gBACJ,YACA,UACgC;AAChC,UAAM,IAAI,MAAM,yDAAyD;AAAA,EAC3E;AACF;;;AChCO,IAAM,kBAAN,MAAsB;AAAA,EAC3B,YAAoB,QAAoB;AAApB;AAAA,EAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOzC,MAAM,eACJ,WAKA,UAC+B;AAC/B,UAAM,IAAI,MAAM,uDAAuD;AAAA,EACzE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,oBACJ,gBAOA,UAC+B;AAC/B,UAAM,IAAI,MAAM,4DAA4D;AAAA,EAC9E;AACF;;;AChCO,IAAM,mBAAN,MAAuB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAM5B,aAAa,kBAAoC;AAC/C,UAAM,IAAI,MAAM,yDAAyD;AAAA,EAC3E;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,aAAa,YAAY,aAAqB,UAA0C;AACtF,UAAM,IAAI,MAAM,qDAAqD;AAAA,EACvE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,aAAa,gBACX,YACA,UACA,YACkB;AAClB,UAAM,IAAI,MAAM,yDAAyD;AAAA,EAC3E;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,aAAa,WAAW,UAAuC;AAC7D,UAAM,IAAI,MAAM,oDAAoD;AAAA,EACtE;AACF;","names":[]}
@@ -0,0 +1,3 @@
1
+ export { f as BatchCreateOptions, B as BatchOperations, g as BatchResult, C as CryptoOperations, F as FolderOperations, K as KeyPair, S as SignedPayload, d as UploadDirectoryOptions, e as UploadDirectoryResult, U as UploadProgress } from '../index-FHcLPBSV.cjs';
2
+ import 'openapi-fetch';
3
+ import '../generated/index.cjs';
@@ -0,0 +1,3 @@
1
+ export { f as BatchCreateOptions, B as BatchOperations, g as BatchResult, C as CryptoOperations, F as FolderOperations, K as KeyPair, S as SignedPayload, d as UploadDirectoryOptions, e as UploadDirectoryResult, U as UploadProgress } from '../index-BrXke2kI.js';
2
+ import 'openapi-fetch';
3
+ import '../generated/index.js';
@@ -0,0 +1,84 @@
1
+ // src/operations/folders.ts
2
+ var FolderOperations = class {
3
+ constructor(client) {
4
+ this.client = client;
5
+ }
6
+ /**
7
+ * Upload a local directory to Arke
8
+ *
9
+ * TODO: Implement this method
10
+ * Steps:
11
+ * 1. Scan directory structure
12
+ * 2. Create folder hierarchy (depth-first)
13
+ * 3. Upload files in parallel (with concurrency limit)
14
+ * 4. Create bidirectional relationships (folder contains file)
15
+ */
16
+ async uploadDirectory(_localPath, _options) {
17
+ throw new Error("FolderOperations.uploadDirectory is not yet implemented");
18
+ }
19
+ };
20
+
21
+ // src/operations/batch.ts
22
+ var BatchOperations = class {
23
+ constructor(client) {
24
+ this.client = client;
25
+ }
26
+ /**
27
+ * Create multiple entities in parallel
28
+ *
29
+ * TODO: Implement this method
30
+ */
31
+ async createEntities(_entities, _options) {
32
+ throw new Error("BatchOperations.createEntities is not yet implemented");
33
+ }
34
+ /**
35
+ * Create multiple relationships in parallel
36
+ *
37
+ * TODO: Implement this method
38
+ */
39
+ async createRelationships(_relationships, _options) {
40
+ throw new Error("BatchOperations.createRelationships is not yet implemented");
41
+ }
42
+ };
43
+
44
+ // src/operations/crypto.ts
45
+ var CryptoOperations = class {
46
+ /**
47
+ * Generate an Ed25519 key pair for agent authentication
48
+ *
49
+ * TODO: Implement using Node.js crypto or Web Crypto API
50
+ */
51
+ static async generateKeyPair() {
52
+ throw new Error("CryptoOperations.generateKeyPair is not yet implemented");
53
+ }
54
+ /**
55
+ * Sign a payload with an Ed25519 private key
56
+ *
57
+ * TODO: Implement signature generation
58
+ */
59
+ static async signPayload(_privateKey, _payload) {
60
+ throw new Error("CryptoOperations.signPayload is not yet implemented");
61
+ }
62
+ /**
63
+ * Verify an Ed25519 signature
64
+ *
65
+ * TODO: Implement signature verification
66
+ */
67
+ static async verifySignature(_publicKey, _payload, _signature) {
68
+ throw new Error("CryptoOperations.verifySignature is not yet implemented");
69
+ }
70
+ /**
71
+ * Compute IPFS CID for content
72
+ *
73
+ * TODO: Implement using multiformats library
74
+ */
75
+ static async computeCID(_content) {
76
+ throw new Error("CryptoOperations.computeCID is not yet implemented");
77
+ }
78
+ };
79
+ export {
80
+ BatchOperations,
81
+ CryptoOperations,
82
+ FolderOperations
83
+ };
84
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/operations/folders.ts","../../src/operations/batch.ts","../../src/operations/crypto.ts"],"sourcesContent":["/**\n * Folder Operations\n *\n * High-level operations for working with folders and directory structures.\n *\n * TODO: Implement folder operations\n * - uploadDirectory: Recursively upload a local directory\n * - createFolderHierarchy: Create folder structure from paths\n * - moveFolderContents: Move files between folders\n */\n\nimport type { ArkeClient } from '../client/ArkeClient.js';\n\nexport interface UploadProgress {\n phase: 'scanning' | 'creating-folders' | 'uploading-files' | 'linking' | 'complete';\n totalFiles: number;\n completedFiles: number;\n totalFolders: number;\n completedFolders: number;\n currentFile?: string;\n}\n\nexport interface UploadDirectoryOptions {\n /** Collection to upload into */\n collectionId: string;\n /** Parent folder ID (optional - creates at root if not provided) */\n parentFolderId?: string;\n /** Progress callback */\n onProgress?: (progress: UploadProgress) => void;\n /** Max concurrent uploads */\n concurrency?: number;\n}\n\nexport interface UploadDirectoryResult {\n /** Root folder entity */\n rootFolder: unknown; // TODO: Type from generated types\n /** All created folder entities */\n folders: unknown[];\n /** All created file entities */\n files: unknown[];\n}\n\n/**\n * Folder operations helper\n *\n * @example\n * ```typescript\n * const folders = new FolderOperations(arkeClient);\n * const result = await folders.uploadDirectory('/path/to/local/folder', {\n * collectionId: '01ABC...',\n * onProgress: (p) => console.log(`${p.completedFiles}/${p.totalFiles} files`),\n * });\n * ```\n */\nexport class FolderOperations {\n constructor(private client: ArkeClient) {}\n\n /**\n * Upload a local directory to Arke\n *\n * TODO: Implement this method\n * Steps:\n * 1. Scan directory structure\n * 2. Create folder hierarchy (depth-first)\n * 3. Upload files in parallel (with concurrency limit)\n * 4. Create bidirectional relationships (folder contains file)\n */\n async uploadDirectory(\n _localPath: string,\n _options: UploadDirectoryOptions\n ): Promise<UploadDirectoryResult> {\n throw new Error('FolderOperations.uploadDirectory is not yet implemented');\n }\n}\n","/**\n * Batch Operations\n *\n * High-level operations for bulk entity and relationship management.\n *\n * TODO: Implement batch operations\n * - createEntities: Create multiple entities in parallel\n * - updateEntities: Update multiple entities in parallel\n * - createRelationships: Create multiple relationships in parallel\n */\n\nimport type { ArkeClient } from '../client/ArkeClient.js';\n\nexport interface BatchCreateOptions {\n /** Max concurrent operations */\n concurrency?: number;\n /** Continue on individual failures */\n continueOnError?: boolean;\n /** Progress callback */\n onProgress?: (completed: number, total: number) => void;\n}\n\nexport interface BatchResult<T> {\n /** Successfully completed operations */\n succeeded: T[];\n /** Failed operations with errors */\n failed: Array<{ input: unknown; error: Error }>;\n}\n\n/**\n * Batch operations helper\n *\n * @example\n * ```typescript\n * const batch = new BatchOperations(arkeClient);\n * const result = await batch.createEntities([\n * { type: 'document', properties: { title: 'Doc 1' } },\n * { type: 'document', properties: { title: 'Doc 2' } },\n * ], { concurrency: 5 });\n * ```\n */\nexport class BatchOperations {\n constructor(private client: ArkeClient) {}\n\n /**\n * Create multiple entities in parallel\n *\n * TODO: Implement this method\n */\n async createEntities(\n _entities: Array<{\n collectionId: string;\n type: string;\n properties?: Record<string, unknown>;\n }>,\n _options?: BatchCreateOptions\n ): Promise<BatchResult<unknown>> {\n throw new Error('BatchOperations.createEntities is not yet implemented');\n }\n\n /**\n * Create multiple relationships in parallel\n *\n * TODO: Implement this method\n */\n async createRelationships(\n _relationships: Array<{\n sourceId: string;\n targetId: string;\n predicate: string;\n bidirectional?: boolean;\n properties?: Record<string, unknown>;\n }>,\n _options?: BatchCreateOptions\n ): Promise<BatchResult<unknown>> {\n throw new Error('BatchOperations.createRelationships is not yet implemented');\n }\n}\n","/**\n * Crypto Operations\n *\n * Cryptographic utilities for agents and content addressing.\n *\n * TODO: Implement crypto operations\n * - generateKeyPair: Generate Ed25519 key pair for agent authentication\n * - signPayload: Sign a payload with agent private key\n * - computeCID: Compute IPFS CID for content\n */\n\n/**\n * Ed25519 key pair for agent authentication\n */\nexport interface KeyPair {\n /** Public key in base64 */\n publicKey: string;\n /** Private key in base64 (keep secret!) */\n privateKey: string;\n}\n\n/**\n * Signed payload with signature\n */\nexport interface SignedPayload {\n /** Original payload */\n payload: string;\n /** Ed25519 signature in base64 */\n signature: string;\n /** Timestamp of signature */\n timestamp: number;\n}\n\n/**\n * Crypto operations helper\n *\n * @example\n * ```typescript\n * // Generate key pair for a new agent\n * const { publicKey, privateKey } = await CryptoOperations.generateKeyPair();\n *\n * // Sign a payload\n * const signed = await CryptoOperations.signPayload(privateKey, payload);\n * ```\n */\nexport class CryptoOperations {\n /**\n * Generate an Ed25519 key pair for agent authentication\n *\n * TODO: Implement using Node.js crypto or Web Crypto API\n */\n static async generateKeyPair(): Promise<KeyPair> {\n throw new Error('CryptoOperations.generateKeyPair is not yet implemented');\n }\n\n /**\n * Sign a payload with an Ed25519 private key\n *\n * TODO: Implement signature generation\n */\n static async signPayload(_privateKey: string, _payload: string): Promise<SignedPayload> {\n throw new Error('CryptoOperations.signPayload is not yet implemented');\n }\n\n /**\n * Verify an Ed25519 signature\n *\n * TODO: Implement signature verification\n */\n static async verifySignature(\n _publicKey: string,\n _payload: string,\n _signature: string\n ): Promise<boolean> {\n throw new Error('CryptoOperations.verifySignature is not yet implemented');\n }\n\n /**\n * Compute IPFS CID for content\n *\n * TODO: Implement using multiformats library\n */\n static async computeCID(_content: Uint8Array): Promise<string> {\n throw new Error('CryptoOperations.computeCID is not yet implemented');\n }\n}\n"],"mappings":";AAsDO,IAAM,mBAAN,MAAuB;AAAA,EAC5B,YAAoB,QAAoB;AAApB;AAAA,EAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYzC,MAAM,gBACJ,YACA,UACgC;AAChC,UAAM,IAAI,MAAM,yDAAyD;AAAA,EAC3E;AACF;;;AChCO,IAAM,kBAAN,MAAsB;AAAA,EAC3B,YAAoB,QAAoB;AAApB;AAAA,EAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOzC,MAAM,eACJ,WAKA,UAC+B;AAC/B,UAAM,IAAI,MAAM,uDAAuD;AAAA,EACzE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,oBACJ,gBAOA,UAC+B;AAC/B,UAAM,IAAI,MAAM,4DAA4D;AAAA,EAC9E;AACF;;;AChCO,IAAM,mBAAN,MAAuB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAM5B,aAAa,kBAAoC;AAC/C,UAAM,IAAI,MAAM,yDAAyD;AAAA,EAC3E;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,aAAa,YAAY,aAAqB,UAA0C;AACtF,UAAM,IAAI,MAAM,qDAAqD;AAAA,EACvE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,aAAa,gBACX,YACA,UACA,YACkB;AAClB,UAAM,IAAI,MAAM,yDAAyD;AAAA,EAC3E;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,aAAa,WAAW,UAAuC;AAC7D,UAAM,IAAI,MAAM,oDAAoD;AAAA,EACtE;AACF;","names":[]}
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@arke-institute/sdk",
3
- "version": "0.1.2",
3
+ "version": "2.0.0",
4
+ "description": "TypeScript SDK for the Arke API - auto-generated from OpenAPI spec",
4
5
  "type": "module",
5
- "description": "TypeScript SDK for building applications on the Arke platform",
6
6
  "main": "dist/index.cjs",
7
7
  "module": "dist/index.js",
8
8
  "types": "dist/index.d.ts",
@@ -12,77 +12,68 @@
12
12
  "import": "./dist/index.js",
13
13
  "require": "./dist/index.cjs"
14
14
  },
15
- "./collections": {
16
- "types": "./dist/collections/index.d.ts",
17
- "import": "./dist/collections/index.js",
18
- "require": "./dist/collections/index.cjs"
15
+ "./generated": {
16
+ "types": "./dist/generated/index.d.ts",
17
+ "import": "./dist/generated/index.js",
18
+ "require": "./dist/generated/index.cjs"
19
19
  },
20
- "./upload": {
21
- "types": "./dist/upload/index.d.ts",
22
- "import": "./dist/upload/index.js",
23
- "require": "./dist/upload/index.cjs"
24
- },
25
- "./query": {
26
- "types": "./dist/query/index.d.ts",
27
- "import": "./dist/query/index.js",
28
- "require": "./dist/query/index.cjs"
29
- },
30
- "./edit": {
31
- "types": "./dist/edit/index.d.ts",
32
- "import": "./dist/edit/index.js",
33
- "require": "./dist/edit/index.cjs"
34
- },
35
- "./content": {
36
- "types": "./dist/content/index.d.ts",
37
- "import": "./dist/content/index.js",
38
- "require": "./dist/content/index.cjs"
39
- },
40
- "./graph": {
41
- "types": "./dist/graph/index.d.ts",
42
- "import": "./dist/graph/index.js",
43
- "require": "./dist/graph/index.cjs"
20
+ "./operations": {
21
+ "types": "./dist/operations/index.d.ts",
22
+ "import": "./dist/operations/index.js",
23
+ "require": "./dist/operations/index.cjs"
44
24
  }
45
25
  },
46
26
  "files": [
47
- "dist"
27
+ "dist",
28
+ "README.md"
48
29
  ],
49
30
  "scripts": {
31
+ "generate:fetch": "tsx scripts/fetch-spec.ts",
32
+ "generate:fetch:local": "tsx scripts/fetch-spec.ts --local",
33
+ "generate:types": "tsx scripts/generate.ts",
34
+ "generate": "npm run generate:fetch && npm run generate:types",
35
+ "generate:local": "npm run generate:fetch:local && npm run generate:types",
50
36
  "build": "tsup",
51
37
  "dev": "tsup --watch",
52
- "typecheck": "tsc --noEmit",
53
38
  "test": "vitest run",
39
+ "test:watch": "vitest",
40
+ "typecheck": "tsc --noEmit",
54
41
  "clean": "rm -rf dist",
55
- "prepublishOnly": "npm run build"
42
+ "prepublishOnly": "npm run build",
43
+ "publish:dry": "npm publish --dry-run",
44
+ "publish:sdk": "npm publish --access public",
45
+ "publish-all": "npm run generate && npm run test && npm run build && npm run publish:sdk",
46
+ "publish-all:dry": "npm run generate && npm run test && npm run build && npm run publish:dry"
56
47
  },
57
48
  "dependencies": {
58
- "diff": "^7.0.0",
59
- "multiformats": "^13.4.1"
49
+ "openapi-fetch": "^0.13.0"
60
50
  },
61
51
  "devDependencies": {
62
- "@types/diff": "^7.0.0",
63
- "@types/node": "^20.10.0",
64
- "tsup": "^8.0.0",
65
- "typescript": "^5.3.0",
66
- "vitest": "^1.0.0"
52
+ "openapi-typescript": "^7.4.0",
53
+ "tsup": "^8.3.0",
54
+ "typescript": "^5.7.0",
55
+ "vitest": "^2.1.0",
56
+ "tsx": "^4.19.0",
57
+ "@types/node": "^22.0.0"
58
+ },
59
+ "publishConfig": {
60
+ "access": "public"
61
+ },
62
+ "repository": {
63
+ "type": "git",
64
+ "url": "https://github.com/arke-institute/arke"
67
65
  },
68
66
  "keywords": [
69
67
  "arke",
68
+ "api",
70
69
  "sdk",
71
- "collections",
72
- "upload",
73
- "query",
74
- "edit",
75
- "knowledge-graph",
76
- "content",
77
- "typescript"
70
+ "typescript",
71
+ "ipfs",
72
+ "entities"
78
73
  ],
79
- "license": "MIT",
80
- "repository": {
81
- "type": "git",
82
- "url": "https://github.com/Arke-Institute/arke-sdk"
83
- },
84
74
  "author": "Arke Institute",
75
+ "license": "MIT",
85
76
  "engines": {
86
- "node": ">=18"
77
+ "node": ">=18.0.0"
87
78
  }
88
79
  }
@@ -1,183 +0,0 @@
1
- type CollectionVisibility = 'public' | 'private';
2
- type CollectionRole = 'owner' | 'editor';
3
- interface Collection {
4
- id: string;
5
- title: string;
6
- slug: string;
7
- description?: string | null;
8
- visibility: CollectionVisibility;
9
- creator_user_id?: string;
10
- created_at?: string;
11
- updated_at?: string;
12
- }
13
- interface CollectionDetails extends Collection {
14
- member_count: number;
15
- root_pi: string | null;
16
- users?: {
17
- email?: string;
18
- name?: string | null;
19
- };
20
- }
21
- interface PaginatedCollections {
22
- collections: CollectionDetails[];
23
- pagination: {
24
- total: number | null;
25
- limit: number;
26
- offset: number;
27
- };
28
- }
29
- interface MemberUser {
30
- id: string;
31
- email: string;
32
- name?: string | null;
33
- }
34
- interface Member {
35
- role: CollectionRole;
36
- created_at?: string;
37
- user: MemberUser;
38
- }
39
- interface MembersResponse {
40
- members: Member[];
41
- }
42
- interface InvitationUser {
43
- email: string;
44
- name?: string | null;
45
- }
46
- interface Invitation {
47
- id: string;
48
- role: CollectionRole;
49
- status: 'pending' | 'accepted' | 'declined' | 'expired';
50
- expires_at: string;
51
- created_at: string;
52
- responded_at?: string | null;
53
- invitee?: InvitationUser;
54
- inviter?: InvitationUser;
55
- collection?: {
56
- id: string;
57
- title: string;
58
- slug: string;
59
- };
60
- }
61
- interface InvitationsResponse {
62
- invitations: Invitation[];
63
- }
64
- interface CreateCollectionPayload {
65
- title: string;
66
- slug: string;
67
- description?: string;
68
- visibility?: CollectionVisibility;
69
- }
70
- interface RegisterRootPayload extends CreateCollectionPayload {
71
- rootPi: string;
72
- }
73
- interface UpdateCollectionPayload {
74
- title?: string;
75
- description?: string;
76
- visibility?: CollectionVisibility;
77
- }
78
- interface ChangeRootPayload {
79
- newRootPi: string;
80
- }
81
- interface MyCollectionsResponse {
82
- owned: Array<Collection & {
83
- role: CollectionRole;
84
- }>;
85
- editing: Array<Collection & {
86
- role: CollectionRole;
87
- }>;
88
- total: number;
89
- }
90
- interface MyAccessResponse {
91
- isMember: boolean;
92
- role: CollectionRole | null;
93
- canView: boolean;
94
- canEdit: boolean;
95
- canInvite: boolean;
96
- canManageMembers: boolean;
97
- canDelete: boolean;
98
- }
99
- interface RootResponse {
100
- rootPi: string;
101
- }
102
- interface ChangeRootResponse {
103
- previousRoot: string | null;
104
- newRoot: string;
105
- }
106
- interface SuccessResponse {
107
- success: boolean;
108
- }
109
- interface PiPermissions {
110
- pi: string;
111
- canView: boolean;
112
- canEdit: boolean;
113
- canAdminister: boolean;
114
- collection: {
115
- id: string;
116
- title: string;
117
- slug: string;
118
- visibility: CollectionVisibility;
119
- role: CollectionRole | null;
120
- rootPi: string;
121
- hops: number;
122
- } | null;
123
- }
124
-
125
- interface CollectionsClientConfig {
126
- /**
127
- * Gateway base URL (e.g., https://api.arke.institute).
128
- * Must already point at the Arke gateway that proxies /collections/*.
129
- */
130
- gatewayUrl: string;
131
- /**
132
- * Optional bearer token for authenticated routes.
133
- * Public routes will still include it if provided.
134
- */
135
- authToken?: string;
136
- /**
137
- * Optional custom fetch (useful for testing).
138
- */
139
- fetchImpl?: typeof fetch;
140
- }
141
- declare class CollectionsClient {
142
- private baseUrl;
143
- private authToken?;
144
- private fetchImpl;
145
- constructor(config: CollectionsClientConfig);
146
- setAuthToken(token?: string): void;
147
- private buildUrl;
148
- private getHeaders;
149
- private request;
150
- listCollections(params?: {
151
- limit?: number;
152
- offset?: number;
153
- }): Promise<PaginatedCollections>;
154
- getCollection(id: string): Promise<CollectionDetails>;
155
- getCollectionRoot(id: string): Promise<RootResponse>;
156
- getMyAccess(id: string): Promise<MyAccessResponse>;
157
- createCollection(payload: CreateCollectionPayload): Promise<Collection>;
158
- registerRoot(payload: RegisterRootPayload): Promise<Collection & {
159
- rootPi: string;
160
- }>;
161
- updateCollection(id: string, payload: UpdateCollectionPayload): Promise<Collection>;
162
- changeRoot(id: string, payload: ChangeRootPayload): Promise<ChangeRootResponse>;
163
- deleteCollection(id: string): Promise<SuccessResponse>;
164
- listMembers(collectionId: string): Promise<MembersResponse>;
165
- updateMemberRole(collectionId: string, userId: string, role: CollectionRole): Promise<{
166
- success: true;
167
- role: CollectionRole;
168
- }>;
169
- removeMember(collectionId: string, userId: string): Promise<SuccessResponse>;
170
- createInvitation(collectionId: string, email: string, role: CollectionRole): Promise<Invitation>;
171
- listInvitations(collectionId: string): Promise<InvitationsResponse>;
172
- acceptInvitation(invitationId: string): Promise<{
173
- success: true;
174
- role: CollectionRole;
175
- }>;
176
- declineInvitation(invitationId: string): Promise<SuccessResponse>;
177
- revokeInvitation(invitationId: string): Promise<SuccessResponse>;
178
- getMyCollections(): Promise<MyCollectionsResponse>;
179
- getMyInvitations(): Promise<InvitationsResponse>;
180
- getPiPermissions(pi: string): Promise<PiPermissions>;
181
- }
182
-
183
- export { CollectionsClient as C, type Invitation as I, type Member as M, type PaginatedCollections as P, type RegisterRootPayload as R, type SuccessResponse as S, type UpdateCollectionPayload as U, type CollectionsClientConfig as a, type Collection as b, type CollectionDetails as c, type CollectionRole as d, type CollectionVisibility as e, type CreateCollectionPayload as f, type ChangeRootPayload as g, type ChangeRootResponse as h, type MemberUser as i, type MembersResponse as j, type InvitationUser as k, type InvitationsResponse as l, type MyAccessResponse as m, type MyCollectionsResponse as n, type PiPermissions as o, type RootResponse as p };