@inneropen/marvin-sdk 1.11.0-next.3 → 2.0.0-next.10
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/index.cjs +36 -0
- package/dist/index.d.cts +30 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.js +36 -0
- package/dist/platform.cjs +197 -0
- package/dist/platform.d.cts +871 -61
- package/dist/platform.d.ts +871 -61
- package/dist/platform.js +194 -0
- package/dist/types/index.d.cts +19 -0
- package/dist/types/index.d.ts +19 -0
- package/package.json +8 -2
package/dist/index.cjs
CHANGED
|
@@ -461,9 +461,20 @@ var init_entry = __esm({
|
|
|
461
461
|
get description() {
|
|
462
462
|
return this.data.description;
|
|
463
463
|
}
|
|
464
|
+
/**
|
|
465
|
+
* @deprecated Use field('body') or dataJson instead. Will be removed in v3.0.0
|
|
466
|
+
*/
|
|
464
467
|
get contentMarkdown() {
|
|
465
468
|
return this.data.contentMarkdown;
|
|
466
469
|
}
|
|
470
|
+
/**
|
|
471
|
+
* Schema-driven content data (replaces contentMarkdown in v2.0.0).
|
|
472
|
+
* Access specific fields using the field() helper method.
|
|
473
|
+
* @since 2.0.0
|
|
474
|
+
*/
|
|
475
|
+
get dataJson() {
|
|
476
|
+
return this.data.dataJson;
|
|
477
|
+
}
|
|
467
478
|
get metadata() {
|
|
468
479
|
return this.data.metadata;
|
|
469
480
|
}
|
|
@@ -497,6 +508,31 @@ var init_entry = __esm({
|
|
|
497
508
|
get collections() {
|
|
498
509
|
return this.data.collections || [];
|
|
499
510
|
}
|
|
511
|
+
/**
|
|
512
|
+
* Get a specific field value from the entry's schema-driven content (dataJson).
|
|
513
|
+
*
|
|
514
|
+
* @param key - Field key as defined in the entry type's schema
|
|
515
|
+
* @returns The field value, or undefined if not present
|
|
516
|
+
* @since 2.0.0
|
|
517
|
+
*
|
|
518
|
+
* @example
|
|
519
|
+
* ```typescript
|
|
520
|
+
* const entry = await client.entries.get('my-entry');
|
|
521
|
+
* const body = entry.field('body'); // Get markdown body
|
|
522
|
+
* const difficulty = entry.field('difficulty'); // Get difficulty level
|
|
523
|
+
* const heroImage = entry.field('heroImage'); // Get hero image UUID
|
|
524
|
+
* ```
|
|
525
|
+
*/
|
|
526
|
+
field(key) {
|
|
527
|
+
return this.data.dataJson?.[key];
|
|
528
|
+
}
|
|
529
|
+
/**
|
|
530
|
+
* Get all fields from the entry's schema-driven content.
|
|
531
|
+
* @since 2.0.0
|
|
532
|
+
*/
|
|
533
|
+
get fields() {
|
|
534
|
+
return this.data.dataJson || {};
|
|
535
|
+
}
|
|
500
536
|
/**
|
|
501
537
|
* Get related entries (future)
|
|
502
538
|
*/
|
package/dist/index.d.cts
CHANGED
|
@@ -288,7 +288,16 @@ declare class Entry {
|
|
|
288
288
|
get slug(): string;
|
|
289
289
|
get summary(): string | undefined;
|
|
290
290
|
get description(): string | undefined;
|
|
291
|
+
/**
|
|
292
|
+
* @deprecated Use field('body') or dataJson instead. Will be removed in v3.0.0
|
|
293
|
+
*/
|
|
291
294
|
get contentMarkdown(): string | undefined;
|
|
295
|
+
/**
|
|
296
|
+
* Schema-driven content data (replaces contentMarkdown in v2.0.0).
|
|
297
|
+
* Access specific fields using the field() helper method.
|
|
298
|
+
* @since 2.0.0
|
|
299
|
+
*/
|
|
300
|
+
get dataJson(): Record<string, unknown> | undefined;
|
|
292
301
|
get metadata(): Record<string, unknown> | undefined;
|
|
293
302
|
get status(): string;
|
|
294
303
|
get publishedAt(): string | undefined;
|
|
@@ -304,6 +313,27 @@ declare class Entry {
|
|
|
304
313
|
* Get entry collections
|
|
305
314
|
*/
|
|
306
315
|
get collections(): MarvinCollection[];
|
|
316
|
+
/**
|
|
317
|
+
* Get a specific field value from the entry's schema-driven content (dataJson).
|
|
318
|
+
*
|
|
319
|
+
* @param key - Field key as defined in the entry type's schema
|
|
320
|
+
* @returns The field value, or undefined if not present
|
|
321
|
+
* @since 2.0.0
|
|
322
|
+
*
|
|
323
|
+
* @example
|
|
324
|
+
* ```typescript
|
|
325
|
+
* const entry = await client.entries.get('my-entry');
|
|
326
|
+
* const body = entry.field('body'); // Get markdown body
|
|
327
|
+
* const difficulty = entry.field('difficulty'); // Get difficulty level
|
|
328
|
+
* const heroImage = entry.field('heroImage'); // Get hero image UUID
|
|
329
|
+
* ```
|
|
330
|
+
*/
|
|
331
|
+
field<T = unknown>(key: string): T | undefined;
|
|
332
|
+
/**
|
|
333
|
+
* Get all fields from the entry's schema-driven content.
|
|
334
|
+
* @since 2.0.0
|
|
335
|
+
*/
|
|
336
|
+
get fields(): Record<string, unknown>;
|
|
307
337
|
/**
|
|
308
338
|
* Get related entries (future)
|
|
309
339
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -288,7 +288,16 @@ declare class Entry {
|
|
|
288
288
|
get slug(): string;
|
|
289
289
|
get summary(): string | undefined;
|
|
290
290
|
get description(): string | undefined;
|
|
291
|
+
/**
|
|
292
|
+
* @deprecated Use field('body') or dataJson instead. Will be removed in v3.0.0
|
|
293
|
+
*/
|
|
291
294
|
get contentMarkdown(): string | undefined;
|
|
295
|
+
/**
|
|
296
|
+
* Schema-driven content data (replaces contentMarkdown in v2.0.0).
|
|
297
|
+
* Access specific fields using the field() helper method.
|
|
298
|
+
* @since 2.0.0
|
|
299
|
+
*/
|
|
300
|
+
get dataJson(): Record<string, unknown> | undefined;
|
|
292
301
|
get metadata(): Record<string, unknown> | undefined;
|
|
293
302
|
get status(): string;
|
|
294
303
|
get publishedAt(): string | undefined;
|
|
@@ -304,6 +313,27 @@ declare class Entry {
|
|
|
304
313
|
* Get entry collections
|
|
305
314
|
*/
|
|
306
315
|
get collections(): MarvinCollection[];
|
|
316
|
+
/**
|
|
317
|
+
* Get a specific field value from the entry's schema-driven content (dataJson).
|
|
318
|
+
*
|
|
319
|
+
* @param key - Field key as defined in the entry type's schema
|
|
320
|
+
* @returns The field value, or undefined if not present
|
|
321
|
+
* @since 2.0.0
|
|
322
|
+
*
|
|
323
|
+
* @example
|
|
324
|
+
* ```typescript
|
|
325
|
+
* const entry = await client.entries.get('my-entry');
|
|
326
|
+
* const body = entry.field('body'); // Get markdown body
|
|
327
|
+
* const difficulty = entry.field('difficulty'); // Get difficulty level
|
|
328
|
+
* const heroImage = entry.field('heroImage'); // Get hero image UUID
|
|
329
|
+
* ```
|
|
330
|
+
*/
|
|
331
|
+
field<T = unknown>(key: string): T | undefined;
|
|
332
|
+
/**
|
|
333
|
+
* Get all fields from the entry's schema-driven content.
|
|
334
|
+
* @since 2.0.0
|
|
335
|
+
*/
|
|
336
|
+
get fields(): Record<string, unknown>;
|
|
307
337
|
/**
|
|
308
338
|
* Get related entries (future)
|
|
309
339
|
*/
|
package/dist/index.js
CHANGED
|
@@ -107,9 +107,20 @@ var init_entry = __esm({
|
|
|
107
107
|
get description() {
|
|
108
108
|
return this.data.description;
|
|
109
109
|
}
|
|
110
|
+
/**
|
|
111
|
+
* @deprecated Use field('body') or dataJson instead. Will be removed in v3.0.0
|
|
112
|
+
*/
|
|
110
113
|
get contentMarkdown() {
|
|
111
114
|
return this.data.contentMarkdown;
|
|
112
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* Schema-driven content data (replaces contentMarkdown in v2.0.0).
|
|
118
|
+
* Access specific fields using the field() helper method.
|
|
119
|
+
* @since 2.0.0
|
|
120
|
+
*/
|
|
121
|
+
get dataJson() {
|
|
122
|
+
return this.data.dataJson;
|
|
123
|
+
}
|
|
113
124
|
get metadata() {
|
|
114
125
|
return this.data.metadata;
|
|
115
126
|
}
|
|
@@ -143,6 +154,31 @@ var init_entry = __esm({
|
|
|
143
154
|
get collections() {
|
|
144
155
|
return this.data.collections || [];
|
|
145
156
|
}
|
|
157
|
+
/**
|
|
158
|
+
* Get a specific field value from the entry's schema-driven content (dataJson).
|
|
159
|
+
*
|
|
160
|
+
* @param key - Field key as defined in the entry type's schema
|
|
161
|
+
* @returns The field value, or undefined if not present
|
|
162
|
+
* @since 2.0.0
|
|
163
|
+
*
|
|
164
|
+
* @example
|
|
165
|
+
* ```typescript
|
|
166
|
+
* const entry = await client.entries.get('my-entry');
|
|
167
|
+
* const body = entry.field('body'); // Get markdown body
|
|
168
|
+
* const difficulty = entry.field('difficulty'); // Get difficulty level
|
|
169
|
+
* const heroImage = entry.field('heroImage'); // Get hero image UUID
|
|
170
|
+
* ```
|
|
171
|
+
*/
|
|
172
|
+
field(key) {
|
|
173
|
+
return this.data.dataJson?.[key];
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Get all fields from the entry's schema-driven content.
|
|
177
|
+
* @since 2.0.0
|
|
178
|
+
*/
|
|
179
|
+
get fields() {
|
|
180
|
+
return this.data.dataJson || {};
|
|
181
|
+
}
|
|
146
182
|
/**
|
|
147
183
|
* Get related entries (future)
|
|
148
184
|
*/
|
package/dist/platform.cjs
CHANGED
|
@@ -27,14 +27,17 @@ __export(platform_exports, {
|
|
|
27
27
|
AssetsModule: () => AssetsModule,
|
|
28
28
|
AuthModule: () => AuthModule,
|
|
29
29
|
CollectionsModule: () => CollectionsModule,
|
|
30
|
+
EmailTemplatesClient: () => EmailTemplatesClient,
|
|
30
31
|
EntriesModule: () => EntriesModule,
|
|
31
32
|
EntryTypesModule: () => EntryTypesModule,
|
|
32
33
|
EventLogModule: () => EventLogModule,
|
|
33
34
|
EventsModule: () => EventsModule,
|
|
35
|
+
FormsModule: () => FormsModule,
|
|
34
36
|
InvitesModule: () => InvitesModule,
|
|
35
37
|
NotificationsModule: () => NotificationsModule,
|
|
36
38
|
PlatformClient: () => PlatformClient,
|
|
37
39
|
ResourcesModule: () => ResourcesModule,
|
|
40
|
+
ScheduledTasksModule: () => ScheduledTasksModule,
|
|
38
41
|
ThemeModule: () => ThemeModule,
|
|
39
42
|
UserModule: () => UserModule,
|
|
40
43
|
WebhooksModule: () => WebhooksModule,
|
|
@@ -1151,6 +1154,191 @@ var ThemeModule = class {
|
|
|
1151
1154
|
}
|
|
1152
1155
|
};
|
|
1153
1156
|
|
|
1157
|
+
// src/platform/emailTemplates.ts
|
|
1158
|
+
var EmailTemplatesClient = class {
|
|
1159
|
+
constructor(http) {
|
|
1160
|
+
this.http = http;
|
|
1161
|
+
}
|
|
1162
|
+
http;
|
|
1163
|
+
/**
|
|
1164
|
+
* List all email templates for the workspace
|
|
1165
|
+
* @param groupId - Workspace ID
|
|
1166
|
+
*/
|
|
1167
|
+
async list(groupId) {
|
|
1168
|
+
return this.http.get(`/api/platform/workspaces/${groupId}/email-templates`);
|
|
1169
|
+
}
|
|
1170
|
+
/**
|
|
1171
|
+
* Get a specific email template
|
|
1172
|
+
* @param groupId - Workspace ID
|
|
1173
|
+
* @param templateId - Template ID
|
|
1174
|
+
*/
|
|
1175
|
+
async get(groupId, templateId) {
|
|
1176
|
+
return this.http.get(`/api/platform/workspaces/${groupId}/email-templates/${templateId}`);
|
|
1177
|
+
}
|
|
1178
|
+
/**
|
|
1179
|
+
* Create a new email template
|
|
1180
|
+
* @param groupId - Workspace ID
|
|
1181
|
+
* @param data - Template data
|
|
1182
|
+
*/
|
|
1183
|
+
async create(groupId, data) {
|
|
1184
|
+
return this.http.post(`/api/platform/workspaces/${groupId}/email-templates`, data);
|
|
1185
|
+
}
|
|
1186
|
+
/**
|
|
1187
|
+
* Update an email template
|
|
1188
|
+
* @param groupId - Workspace ID
|
|
1189
|
+
* @param templateId - Template ID
|
|
1190
|
+
* @param data - Updated template data
|
|
1191
|
+
*/
|
|
1192
|
+
async update(groupId, templateId, data) {
|
|
1193
|
+
return this.http.patch(`/api/platform/workspaces/${groupId}/email-templates/${templateId}`, data);
|
|
1194
|
+
}
|
|
1195
|
+
/**
|
|
1196
|
+
* Delete an email template
|
|
1197
|
+
* @param groupId - Workspace ID
|
|
1198
|
+
* @param templateId - Template ID
|
|
1199
|
+
*/
|
|
1200
|
+
async delete(groupId, templateId) {
|
|
1201
|
+
await this.http.delete(`/api/platform/workspaces/${groupId}/email-templates/${templateId}`);
|
|
1202
|
+
}
|
|
1203
|
+
/**
|
|
1204
|
+
* Send a test email using a template
|
|
1205
|
+
* @param groupId - Workspace ID
|
|
1206
|
+
* @param templateId - Template ID
|
|
1207
|
+
* @param recipientEmail - Test recipient email address
|
|
1208
|
+
*/
|
|
1209
|
+
async sendTest(groupId, templateId, recipientEmail) {
|
|
1210
|
+
return this.http.post(`/api/platform/workspaces/${groupId}/email-templates/${templateId}/test`, {
|
|
1211
|
+
recipient_email: recipientEmail
|
|
1212
|
+
});
|
|
1213
|
+
}
|
|
1214
|
+
};
|
|
1215
|
+
|
|
1216
|
+
// src/platform/scheduledTasks.ts
|
|
1217
|
+
var ScheduledTasksModule = class {
|
|
1218
|
+
constructor(http) {
|
|
1219
|
+
this.http = http;
|
|
1220
|
+
}
|
|
1221
|
+
http;
|
|
1222
|
+
/**
|
|
1223
|
+
* List all scheduled tasks for the current workspace
|
|
1224
|
+
*/
|
|
1225
|
+
async list() {
|
|
1226
|
+
return this.http.get("/api/platform/scheduled-tasks");
|
|
1227
|
+
}
|
|
1228
|
+
/**
|
|
1229
|
+
* Get a scheduled task by ID or slug
|
|
1230
|
+
*/
|
|
1231
|
+
async get(idOrSlug) {
|
|
1232
|
+
return this.http.get(`/api/platform/scheduled-tasks/${idOrSlug}`);
|
|
1233
|
+
}
|
|
1234
|
+
/**
|
|
1235
|
+
* Create a new scheduled task
|
|
1236
|
+
*/
|
|
1237
|
+
async create(data) {
|
|
1238
|
+
return this.http.post("/api/platform/scheduled-tasks", data);
|
|
1239
|
+
}
|
|
1240
|
+
/**
|
|
1241
|
+
* Update a scheduled task
|
|
1242
|
+
*/
|
|
1243
|
+
async update(idOrSlug, data) {
|
|
1244
|
+
return this.http.patch(`/api/platform/scheduled-tasks/${idOrSlug}`, data);
|
|
1245
|
+
}
|
|
1246
|
+
/**
|
|
1247
|
+
* Delete a scheduled task
|
|
1248
|
+
*/
|
|
1249
|
+
async delete(idOrSlug) {
|
|
1250
|
+
await this.http.delete(`/api/platform/scheduled-tasks/${idOrSlug}`);
|
|
1251
|
+
}
|
|
1252
|
+
/**
|
|
1253
|
+
* Manually trigger task execution (bypass schedule)
|
|
1254
|
+
*/
|
|
1255
|
+
async execute(idOrSlug) {
|
|
1256
|
+
await this.http.post(`/api/platform/scheduled-tasks/${idOrSlug}/execute`, {});
|
|
1257
|
+
}
|
|
1258
|
+
/**
|
|
1259
|
+
* Get task execution history
|
|
1260
|
+
*/
|
|
1261
|
+
async history(idOrSlug, options) {
|
|
1262
|
+
const params = new URLSearchParams();
|
|
1263
|
+
if (options?.limit) {
|
|
1264
|
+
params.set("limit", options.limit.toString());
|
|
1265
|
+
}
|
|
1266
|
+
const query = params.toString() ? `?${params.toString()}` : "";
|
|
1267
|
+
return this.http.get(
|
|
1268
|
+
`/api/platform/scheduled-tasks/${idOrSlug}/history${query}`
|
|
1269
|
+
);
|
|
1270
|
+
}
|
|
1271
|
+
/**
|
|
1272
|
+
* Get available task types
|
|
1273
|
+
*/
|
|
1274
|
+
async taskTypes(options) {
|
|
1275
|
+
const params = new URLSearchParams();
|
|
1276
|
+
if (options?.detailed) {
|
|
1277
|
+
params.set("detailed", "true");
|
|
1278
|
+
}
|
|
1279
|
+
const query = params.toString() ? `?${params.toString()}` : "";
|
|
1280
|
+
return this.http.get(`/api/platform/scheduled-tasks/task-types${query}`);
|
|
1281
|
+
}
|
|
1282
|
+
};
|
|
1283
|
+
|
|
1284
|
+
// src/platform/forms.ts
|
|
1285
|
+
var FormsModule = class {
|
|
1286
|
+
constructor(http) {
|
|
1287
|
+
this.http = http;
|
|
1288
|
+
}
|
|
1289
|
+
http;
|
|
1290
|
+
/**
|
|
1291
|
+
* List all forms
|
|
1292
|
+
*/
|
|
1293
|
+
async list() {
|
|
1294
|
+
return this.http.get("/api/platform/forms");
|
|
1295
|
+
}
|
|
1296
|
+
/**
|
|
1297
|
+
* Get a single form by ID
|
|
1298
|
+
*/
|
|
1299
|
+
async get(id) {
|
|
1300
|
+
return this.http.get(`/api/platform/forms/${id}`);
|
|
1301
|
+
}
|
|
1302
|
+
/**
|
|
1303
|
+
* Create a new form
|
|
1304
|
+
*/
|
|
1305
|
+
async create(data) {
|
|
1306
|
+
return this.http.post("/api/platform/forms", data);
|
|
1307
|
+
}
|
|
1308
|
+
/**
|
|
1309
|
+
* Update a form
|
|
1310
|
+
*/
|
|
1311
|
+
async update(id, data) {
|
|
1312
|
+
return this.http.patch(`/api/platform/forms/${id}`, data);
|
|
1313
|
+
}
|
|
1314
|
+
/**
|
|
1315
|
+
* Delete a form
|
|
1316
|
+
*/
|
|
1317
|
+
async delete(id) {
|
|
1318
|
+
return this.http.delete(`/api/platform/forms/${id}`);
|
|
1319
|
+
}
|
|
1320
|
+
/**
|
|
1321
|
+
* Get submissions for a form
|
|
1322
|
+
*/
|
|
1323
|
+
async getSubmissions(formId) {
|
|
1324
|
+
return this.http.get(`/api/platform/forms/${formId}/submissions`);
|
|
1325
|
+
}
|
|
1326
|
+
/**
|
|
1327
|
+
* Get a published form by slug (Publishing API - public access)
|
|
1328
|
+
*/
|
|
1329
|
+
async getPublishedForm(slug) {
|
|
1330
|
+
return this.http.get(`/api/publish/forms/${slug}`);
|
|
1331
|
+
}
|
|
1332
|
+
/**
|
|
1333
|
+
* Submit data to a published form (Publishing API - public access)
|
|
1334
|
+
*/
|
|
1335
|
+
async submitForm(slug, data) {
|
|
1336
|
+
return this.http.post(`/api/publish/forms/${slug}/submit`, {
|
|
1337
|
+
dataJson: data
|
|
1338
|
+
});
|
|
1339
|
+
}
|
|
1340
|
+
};
|
|
1341
|
+
|
|
1154
1342
|
// src/platform/client.ts
|
|
1155
1343
|
var PlatformClient = class extends HttpClient {
|
|
1156
1344
|
entries;
|
|
@@ -1169,6 +1357,9 @@ var PlatformClient = class extends HttpClient {
|
|
|
1169
1357
|
eventLog;
|
|
1170
1358
|
session;
|
|
1171
1359
|
theme;
|
|
1360
|
+
emailTemplates;
|
|
1361
|
+
scheduledTasks;
|
|
1362
|
+
forms;
|
|
1172
1363
|
// Admin modules
|
|
1173
1364
|
adminUsers;
|
|
1174
1365
|
adminSystem;
|
|
@@ -1196,6 +1387,9 @@ var PlatformClient = class extends HttpClient {
|
|
|
1196
1387
|
this.eventLog = new EventLogModule(this);
|
|
1197
1388
|
this.session = new AuthModule(this);
|
|
1198
1389
|
this.theme = new ThemeModule(this);
|
|
1390
|
+
this.emailTemplates = new EmailTemplatesClient(this);
|
|
1391
|
+
this.scheduledTasks = new ScheduledTasksModule(this);
|
|
1392
|
+
this.forms = new FormsModule(this);
|
|
1199
1393
|
this.adminUsers = new AdminUsersModule(this);
|
|
1200
1394
|
this.adminSystem = new AdminSystemModule(this);
|
|
1201
1395
|
this.adminMaintenance = new AdminMaintenanceModule(this);
|
|
@@ -1213,14 +1407,17 @@ function createPlatformClient(config) {
|
|
|
1213
1407
|
AssetsModule,
|
|
1214
1408
|
AuthModule,
|
|
1215
1409
|
CollectionsModule,
|
|
1410
|
+
EmailTemplatesClient,
|
|
1216
1411
|
EntriesModule,
|
|
1217
1412
|
EntryTypesModule,
|
|
1218
1413
|
EventLogModule,
|
|
1219
1414
|
EventsModule,
|
|
1415
|
+
FormsModule,
|
|
1220
1416
|
InvitesModule,
|
|
1221
1417
|
NotificationsModule,
|
|
1222
1418
|
PlatformClient,
|
|
1223
1419
|
ResourcesModule,
|
|
1420
|
+
ScheduledTasksModule,
|
|
1224
1421
|
ThemeModule,
|
|
1225
1422
|
UserModule,
|
|
1226
1423
|
WebhooksModule,
|