@arke-institute/sdk 0.1.3 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/README.md +222 -176
  2. package/dist/crypto-CQnwqWQn.d.ts +459 -0
  3. package/dist/crypto-iYgzUi77.d.cts +459 -0
  4. package/dist/generated/index.cjs +19 -0
  5. package/dist/generated/index.cjs.map +1 -0
  6. package/dist/generated/index.d.cts +6545 -0
  7. package/dist/generated/index.d.ts +6545 -0
  8. package/dist/generated/index.js +1 -0
  9. package/dist/generated/index.js.map +1 -0
  10. package/dist/index.cjs +725 -4248
  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 +706 -4221
  15. package/dist/index.js.map +1 -1
  16. package/dist/operations/index.cjs +806 -0
  17. package/dist/operations/index.cjs.map +1 -0
  18. package/dist/operations/index.d.cts +157 -0
  19. package/dist/operations/index.d.ts +157 -0
  20. package/dist/operations/index.js +759 -0
  21. package/dist/operations/index.js.map +1 -0
  22. package/openapi/spec.json +8648 -0
  23. package/openapi/version.json +7 -0
  24. package/package.json +51 -52
  25. package/dist/client-dAk3E64p.d.cts +0 -183
  26. package/dist/client-dAk3E64p.d.ts +0 -183
  27. package/dist/collections/index.cjs +0 -233
  28. package/dist/collections/index.cjs.map +0 -1
  29. package/dist/collections/index.d.cts +0 -9
  30. package/dist/collections/index.d.ts +0 -9
  31. package/dist/collections/index.js +0 -205
  32. package/dist/collections/index.js.map +0 -1
  33. package/dist/content/index.cjs +0 -591
  34. package/dist/content/index.cjs.map +0 -1
  35. package/dist/content/index.d.cts +0 -516
  36. package/dist/content/index.d.ts +0 -516
  37. package/dist/content/index.js +0 -558
  38. package/dist/content/index.js.map +0 -1
  39. package/dist/edit/index.cjs +0 -1503
  40. package/dist/edit/index.cjs.map +0 -1
  41. package/dist/edit/index.d.cts +0 -78
  42. package/dist/edit/index.d.ts +0 -78
  43. package/dist/edit/index.js +0 -1447
  44. package/dist/edit/index.js.map +0 -1
  45. package/dist/errors-3L7IiHcr.d.cts +0 -480
  46. package/dist/errors-BTe8GKRQ.d.ts +0 -480
  47. package/dist/errors-CT7yzKkU.d.cts +0 -874
  48. package/dist/errors-CT7yzKkU.d.ts +0 -874
  49. package/dist/graph/index.cjs +0 -427
  50. package/dist/graph/index.cjs.map +0 -1
  51. package/dist/graph/index.d.cts +0 -485
  52. package/dist/graph/index.d.ts +0 -485
  53. package/dist/graph/index.js +0 -396
  54. package/dist/graph/index.js.map +0 -1
  55. package/dist/query/index.cjs +0 -356
  56. package/dist/query/index.cjs.map +0 -1
  57. package/dist/query/index.d.cts +0 -636
  58. package/dist/query/index.d.ts +0 -636
  59. package/dist/query/index.js +0 -328
  60. package/dist/query/index.js.map +0 -1
  61. package/dist/upload/index.cjs +0 -1634
  62. package/dist/upload/index.cjs.map +0 -1
  63. package/dist/upload/index.d.cts +0 -150
  64. package/dist/upload/index.d.ts +0 -150
  65. package/dist/upload/index.js +0 -1597
  66. package/dist/upload/index.js.map +0 -1
@@ -0,0 +1,7 @@
1
+ {
2
+ "specVersion": "1.0.0",
3
+ "apiVersion": "1.0.0",
4
+ "fetchedAt": "2025-12-30T18:35:48.207Z",
5
+ "sourceUrl": "https://arke-v1.arke.institute/openapi.json",
6
+ "openApiVersion": "3.1.0"
7
+ }
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@arke-institute/sdk",
3
- "version": "0.1.3",
3
+ "version": "2.1.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,76 @@
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"
20
+ "./operations": {
21
+ "types": "./dist/operations/index.d.ts",
22
+ "import": "./dist/operations/index.js",
23
+ "require": "./dist/operations/index.cjs"
24
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"
25
+ "./spec": {
26
+ "import": "./openapi/spec.json",
27
+ "require": "./openapi/spec.json"
44
28
  }
45
29
  },
46
30
  "files": [
47
- "dist"
31
+ "dist",
32
+ "openapi",
33
+ "README.md"
48
34
  ],
49
35
  "scripts": {
36
+ "generate:fetch": "tsx scripts/fetch-spec.ts",
37
+ "generate:fetch:local": "tsx scripts/fetch-spec.ts --local",
38
+ "generate:types": "tsx scripts/generate.ts",
39
+ "generate": "npm run generate:fetch && npm run generate:types",
40
+ "generate:local": "npm run generate:fetch:local && npm run generate:types",
50
41
  "build": "tsup",
51
42
  "dev": "tsup --watch",
52
- "typecheck": "tsc --noEmit",
53
43
  "test": "vitest run",
44
+ "test:watch": "vitest",
45
+ "test:e2e": "vitest run --config vitest.e2e.config.ts",
46
+ "typecheck": "tsc --noEmit",
54
47
  "clean": "rm -rf dist",
55
- "prepublishOnly": "npm run build"
48
+ "prepublishOnly": "npm run build",
49
+ "publish:dry": "npm publish --dry-run",
50
+ "publish:sdk": "npm publish --access public",
51
+ "publish-all": "npm run generate && npm run test && npm run build && npm run publish:sdk",
52
+ "publish-all:dry": "npm run generate && npm run test && npm run build && npm run publish:dry"
56
53
  },
57
54
  "dependencies": {
58
- "diff": "^7.0.0",
59
- "multiformats": "^13.4.1"
55
+ "multiformats": "^13.4.2",
56
+ "openapi-fetch": "^0.13.0"
60
57
  },
61
58
  "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"
59
+ "@types/node": "^22.0.0",
60
+ "jose": "^6.1.3",
61
+ "openapi-typescript": "^7.4.0",
62
+ "tsup": "^8.3.0",
63
+ "tsx": "^4.19.0",
64
+ "typescript": "^5.7.0",
65
+ "vitest": "^2.1.0"
66
+ },
67
+ "publishConfig": {
68
+ "access": "public"
69
+ },
70
+ "repository": {
71
+ "type": "git",
72
+ "url": "https://github.com/arke-institute/arke"
67
73
  },
68
74
  "keywords": [
69
75
  "arke",
76
+ "api",
70
77
  "sdk",
71
- "collections",
72
- "upload",
73
- "query",
74
- "edit",
75
- "knowledge-graph",
76
- "content",
77
- "typescript"
78
+ "typescript",
79
+ "ipfs",
80
+ "entities"
78
81
  ],
79
- "license": "MIT",
80
- "repository": {
81
- "type": "git",
82
- "url": "https://github.com/Arke-Institute/arke-sdk"
83
- },
84
82
  "author": "Arke Institute",
83
+ "license": "MIT",
85
84
  "engines": {
86
- "node": ">=18"
85
+ "node": ">=18.0.0"
87
86
  }
88
87
  }
@@ -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 };
@@ -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 };