@inneropen/marvin-sdk 1.0.3 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/HttpClient-CLtgQGXH.d.cts +113 -0
- package/dist/HttpClient-CLtgQGXH.d.ts +113 -0
- package/dist/chunk-LQOFJMRJ.js +391 -0
- package/dist/index.cjs +350 -33
- package/dist/index.d.cts +102 -5
- package/dist/index.d.ts +102 -5
- package/dist/index.js +51 -97
- package/dist/platform.cjs +559 -0
- package/dist/platform.d.cts +2706 -0
- package/dist/platform.d.ts +2706 -0
- package/dist/platform.js +354 -0
- package/dist/types/index.d.cts +2 -0
- package/dist/types/index.d.ts +2 -0
- package/package.json +10 -3
package/dist/platform.js
ADDED
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
import {
|
|
2
|
+
HttpClient,
|
|
3
|
+
SessionAuth,
|
|
4
|
+
init_core
|
|
5
|
+
} from "./chunk-LQOFJMRJ.js";
|
|
6
|
+
|
|
7
|
+
// src/platform/client.ts
|
|
8
|
+
init_core();
|
|
9
|
+
|
|
10
|
+
// src/platform/entries.ts
|
|
11
|
+
var EntriesModule = class {
|
|
12
|
+
constructor(http) {
|
|
13
|
+
this.http = http;
|
|
14
|
+
}
|
|
15
|
+
http;
|
|
16
|
+
/**
|
|
17
|
+
* List all entries
|
|
18
|
+
*/
|
|
19
|
+
async list() {
|
|
20
|
+
return this.http.get("/api/platform/entries");
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Get a single entry by ID
|
|
24
|
+
*/
|
|
25
|
+
async get(id) {
|
|
26
|
+
return this.http.get(`/api/platform/entries/${id}`);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Create a new entry
|
|
30
|
+
*/
|
|
31
|
+
async create(data) {
|
|
32
|
+
return this.http.post("/api/platform/entries", data);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Update an entry
|
|
36
|
+
*/
|
|
37
|
+
async update(id, data) {
|
|
38
|
+
return this.http.patch(`/api/platform/entries/${id}`, data);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Delete an entry
|
|
42
|
+
*/
|
|
43
|
+
async delete(id) {
|
|
44
|
+
return this.http.delete(`/api/platform/entries/${id}`);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Get collections that this entry belongs to
|
|
48
|
+
*/
|
|
49
|
+
async listCollections(entryId) {
|
|
50
|
+
return this.http.get(`/api/platform/entries/${entryId}/collections`);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Add entry to a collection
|
|
54
|
+
*/
|
|
55
|
+
async addToCollection(entryId, collectionId) {
|
|
56
|
+
return this.http.post(
|
|
57
|
+
`/api/platform/entries/${entryId}/collections/${collectionId}`,
|
|
58
|
+
{}
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Remove entry from a collection
|
|
63
|
+
*/
|
|
64
|
+
async removeFromCollection(entryId, collectionId) {
|
|
65
|
+
return this.http.delete(`/api/platform/entries/${entryId}/collections/${collectionId}`);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
// src/platform/collections.ts
|
|
70
|
+
var CollectionsModule = class {
|
|
71
|
+
constructor(http) {
|
|
72
|
+
this.http = http;
|
|
73
|
+
}
|
|
74
|
+
http;
|
|
75
|
+
/**
|
|
76
|
+
* List all collections
|
|
77
|
+
*/
|
|
78
|
+
async list() {
|
|
79
|
+
return this.http.get("/api/platform/collections");
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Get a single collection by ID
|
|
83
|
+
*/
|
|
84
|
+
async get(id) {
|
|
85
|
+
return this.http.get(`/api/platform/collections/${id}`);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Create a new collection
|
|
89
|
+
*/
|
|
90
|
+
async create(data) {
|
|
91
|
+
return this.http.post("/api/platform/collections", data);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Update a collection
|
|
95
|
+
*/
|
|
96
|
+
async update(id, data) {
|
|
97
|
+
return this.http.patch(`/api/platform/collections/${id}`, data);
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Delete a collection
|
|
101
|
+
*/
|
|
102
|
+
async delete(id) {
|
|
103
|
+
return this.http.delete(`/api/platform/collections/${id}`);
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Get entries in a collection
|
|
107
|
+
*/
|
|
108
|
+
async getEntries(id) {
|
|
109
|
+
return this.http.get(`/api/platform/collections/${id}/entries`);
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
// src/platform/resources.ts
|
|
114
|
+
var ResourcesModule = class {
|
|
115
|
+
constructor(http) {
|
|
116
|
+
this.http = http;
|
|
117
|
+
}
|
|
118
|
+
http;
|
|
119
|
+
/**
|
|
120
|
+
* List all resources
|
|
121
|
+
*/
|
|
122
|
+
async list() {
|
|
123
|
+
return this.http.get("/api/platform/resources");
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Get a single resource by ID
|
|
127
|
+
*/
|
|
128
|
+
async get(id) {
|
|
129
|
+
return this.http.get(`/api/platform/resources/${id}`);
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Create a new resource
|
|
133
|
+
*/
|
|
134
|
+
async create(data) {
|
|
135
|
+
return this.http.post("/api/platform/resources", data);
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Update a resource
|
|
139
|
+
*/
|
|
140
|
+
async update(id, data) {
|
|
141
|
+
return this.http.patch(`/api/platform/resources/${id}`, data);
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Delete a resource
|
|
145
|
+
*/
|
|
146
|
+
async delete(id) {
|
|
147
|
+
return this.http.delete(`/api/platform/resources/${id}`);
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Get entries that reference this resource
|
|
151
|
+
*/
|
|
152
|
+
async getEntries(id) {
|
|
153
|
+
return this.http.get(`/api/platform/resources/${id}/entries`);
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
// src/platform/assets.ts
|
|
158
|
+
var AssetsModule = class {
|
|
159
|
+
constructor(http) {
|
|
160
|
+
this.http = http;
|
|
161
|
+
}
|
|
162
|
+
http;
|
|
163
|
+
/**
|
|
164
|
+
* List all assets
|
|
165
|
+
*/
|
|
166
|
+
async list() {
|
|
167
|
+
return this.http.get("/api/platform/assets");
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Get a single asset by ID
|
|
171
|
+
*/
|
|
172
|
+
async get(id) {
|
|
173
|
+
return this.http.get(`/api/platform/assets/${id}`);
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Create a new asset
|
|
177
|
+
*/
|
|
178
|
+
async create(data) {
|
|
179
|
+
return this.http.post("/api/platform/assets", data);
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Update an asset
|
|
183
|
+
*/
|
|
184
|
+
async update(id, data) {
|
|
185
|
+
return this.http.patch(`/api/platform/assets/${id}`, data);
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Delete an asset
|
|
189
|
+
*/
|
|
190
|
+
async delete(id) {
|
|
191
|
+
return this.http.delete(`/api/platform/assets/${id}`);
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
// src/platform/apiClients.ts
|
|
196
|
+
var APIClientsModule = class {
|
|
197
|
+
constructor(http) {
|
|
198
|
+
this.http = http;
|
|
199
|
+
}
|
|
200
|
+
http;
|
|
201
|
+
/**
|
|
202
|
+
* List all API clients
|
|
203
|
+
*/
|
|
204
|
+
async list() {
|
|
205
|
+
return this.http.get("/api/platform/api-clients");
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Get a single API client by ID
|
|
209
|
+
*/
|
|
210
|
+
async get(id) {
|
|
211
|
+
return this.http.get(`/api/platform/api-clients/${id}`);
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Create a new API client (returns client with token)
|
|
215
|
+
*/
|
|
216
|
+
async create(data) {
|
|
217
|
+
return this.http.post("/api/platform/api-clients", data);
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Update an API client
|
|
221
|
+
*/
|
|
222
|
+
async update(id, data) {
|
|
223
|
+
return this.http.patch(`/api/platform/api-clients/${id}`, data);
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Delete an API client
|
|
227
|
+
*/
|
|
228
|
+
async delete(id) {
|
|
229
|
+
return this.http.delete(`/api/platform/api-clients/${id}`);
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Rotate API client token (generates new token, invalidates old one)
|
|
233
|
+
*/
|
|
234
|
+
async rotateToken(id) {
|
|
235
|
+
return this.http.post(
|
|
236
|
+
`/api/platform/api-clients/${id}/rotate-token`,
|
|
237
|
+
{}
|
|
238
|
+
);
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Preview API client token (show token prefix and metadata without revealing full token)
|
|
242
|
+
*/
|
|
243
|
+
async preview(id) {
|
|
244
|
+
return this.http.get(`/api/platform/api-clients/${id}/preview`);
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
// src/platform/entryTypes.ts
|
|
249
|
+
var EntryTypesModule = class {
|
|
250
|
+
constructor(http) {
|
|
251
|
+
this.http = http;
|
|
252
|
+
}
|
|
253
|
+
http;
|
|
254
|
+
/**
|
|
255
|
+
* List all entry types
|
|
256
|
+
*/
|
|
257
|
+
async list() {
|
|
258
|
+
return this.http.get("/api/platform/entry-types");
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Get a single entry type by ID
|
|
262
|
+
*/
|
|
263
|
+
async get(id) {
|
|
264
|
+
return this.http.get(`/api/platform/entry-types/${id}`);
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
// src/platform/workspaceMembers.ts
|
|
269
|
+
var WorkspaceMembersModule = class {
|
|
270
|
+
constructor(http) {
|
|
271
|
+
this.http = http;
|
|
272
|
+
}
|
|
273
|
+
http;
|
|
274
|
+
/**
|
|
275
|
+
* List all members of a workspace
|
|
276
|
+
*/
|
|
277
|
+
async list(workspaceId) {
|
|
278
|
+
return this.http.get(
|
|
279
|
+
`/api/platform/workspaces/${workspaceId}/members`
|
|
280
|
+
);
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Get a specific workspace member
|
|
284
|
+
*/
|
|
285
|
+
async get(workspaceId, userId) {
|
|
286
|
+
return this.http.get(
|
|
287
|
+
`/api/platform/workspaces/${workspaceId}/members/${userId}`
|
|
288
|
+
);
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Add a user to a workspace with a specific role
|
|
292
|
+
*/
|
|
293
|
+
async add(workspaceId, data) {
|
|
294
|
+
return this.http.post(
|
|
295
|
+
`/api/platform/workspaces/${workspaceId}/members`,
|
|
296
|
+
data
|
|
297
|
+
);
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Update a workspace member's role
|
|
301
|
+
*/
|
|
302
|
+
async updateRole(workspaceId, userId, data) {
|
|
303
|
+
return this.http.put(
|
|
304
|
+
`/api/platform/workspaces/${workspaceId}/members/${userId}`,
|
|
305
|
+
data
|
|
306
|
+
);
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Remove a user from a workspace
|
|
310
|
+
*/
|
|
311
|
+
async remove(workspaceId, userId) {
|
|
312
|
+
return this.http.delete(`/api/platform/workspaces/${workspaceId}/members/${userId}`);
|
|
313
|
+
}
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
// src/platform/client.ts
|
|
317
|
+
var PlatformClient = class extends HttpClient {
|
|
318
|
+
entries;
|
|
319
|
+
collections;
|
|
320
|
+
resources;
|
|
321
|
+
assets;
|
|
322
|
+
apiClients;
|
|
323
|
+
entryTypes;
|
|
324
|
+
workspaceMembers;
|
|
325
|
+
constructor(config) {
|
|
326
|
+
const httpConfig = {
|
|
327
|
+
baseUrl: config.apiUrl,
|
|
328
|
+
auth: new SessionAuth(config.userToken),
|
|
329
|
+
credentials: config.credentials || "include"
|
|
330
|
+
};
|
|
331
|
+
super(httpConfig);
|
|
332
|
+
this.entries = new EntriesModule(this);
|
|
333
|
+
this.collections = new CollectionsModule(this);
|
|
334
|
+
this.resources = new ResourcesModule(this);
|
|
335
|
+
this.assets = new AssetsModule(this);
|
|
336
|
+
this.apiClients = new APIClientsModule(this);
|
|
337
|
+
this.entryTypes = new EntryTypesModule(this);
|
|
338
|
+
this.workspaceMembers = new WorkspaceMembersModule(this);
|
|
339
|
+
}
|
|
340
|
+
};
|
|
341
|
+
function createPlatformClient(config) {
|
|
342
|
+
return new PlatformClient(config);
|
|
343
|
+
}
|
|
344
|
+
export {
|
|
345
|
+
APIClientsModule,
|
|
346
|
+
AssetsModule,
|
|
347
|
+
CollectionsModule,
|
|
348
|
+
EntriesModule,
|
|
349
|
+
EntryTypesModule,
|
|
350
|
+
PlatformClient,
|
|
351
|
+
ResourcesModule,
|
|
352
|
+
WorkspaceMembersModule,
|
|
353
|
+
createPlatformClient
|
|
354
|
+
};
|
package/dist/types/index.d.cts
CHANGED
package/dist/types/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inneropen/marvin-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "Official TypeScript SDK for Marvin CMS",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -17,6 +17,11 @@
|
|
|
17
17
|
"import": "./dist/index.js",
|
|
18
18
|
"require": "./dist/index.cjs"
|
|
19
19
|
},
|
|
20
|
+
"./platform": {
|
|
21
|
+
"types": "./dist/platform.d.ts",
|
|
22
|
+
"import": "./dist/platform.js",
|
|
23
|
+
"require": "./dist/platform.cjs"
|
|
24
|
+
},
|
|
20
25
|
"./types": {
|
|
21
26
|
"types": "./dist/types/index.d.ts",
|
|
22
27
|
"import": "./dist/types/index.js",
|
|
@@ -55,8 +60,9 @@
|
|
|
55
60
|
},
|
|
56
61
|
"homepage": "https://github.com/inneropen/marvin-sdk#readme",
|
|
57
62
|
"scripts": {
|
|
58
|
-
"build": "tsup src/index.ts src/types/index.ts --format esm,cjs --dts --clean",
|
|
59
|
-
"dev": "tsup src/index.ts src/types/index.ts --format esm,cjs --dts --watch",
|
|
63
|
+
"build": "tsup src/index.ts src/platform.ts src/types/index.ts --format esm,cjs --dts --clean",
|
|
64
|
+
"dev": "tsup src/index.ts src/platform.ts src/types/index.ts --format esm,cjs --dts --watch",
|
|
65
|
+
"generate:types": "openapi-typescript http://localhost:8080/openapi.json -o src/generated/schema.ts",
|
|
60
66
|
"typecheck": "tsc --noEmit",
|
|
61
67
|
"prepublishOnly": "npm run build"
|
|
62
68
|
},
|
|
@@ -68,6 +74,7 @@
|
|
|
68
74
|
},
|
|
69
75
|
"devDependencies": {
|
|
70
76
|
"@types/node": "^26.1.0",
|
|
77
|
+
"openapi-typescript": "^7.13.0",
|
|
71
78
|
"tsup": "^8.5.1"
|
|
72
79
|
}
|
|
73
80
|
}
|