@inneropen/marvin-sdk 1.4.0 → 1.6.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/dist/platform.cjs CHANGED
@@ -25,6 +25,7 @@ __export(platform_exports, {
25
25
  CollectionsModule: () => CollectionsModule,
26
26
  EntriesModule: () => EntriesModule,
27
27
  EntryTypesModule: () => EntryTypesModule,
28
+ InvitesModule: () => InvitesModule,
28
29
  PlatformClient: () => PlatformClient,
29
30
  ResourcesModule: () => ResourcesModule,
30
31
  WorkspaceMembersModule: () => WorkspaceMembersModule,
@@ -537,24 +538,66 @@ var WorkspacesModule = class {
537
538
  return this.http.get("/api/self/workspaces");
538
539
  }
539
540
  /**
540
- * Set active workspace by ID
541
+ * Set active workspace by slug or ID
542
+ * Backend accepts both, so no lookup needed
541
543
  */
542
- async setActive(workspaceId) {
544
+ async setActive(workspace) {
543
545
  return this.http.put("/api/self/workspaces/current", {
544
- workspace_id: workspaceId
546
+ workspace
545
547
  });
546
548
  }
549
+ // Admin operations (require SUPER_ADMIN or appropriate permissions)
547
550
  /**
548
- * Set active workspace by slug (convenience method)
549
- * Internally looks up the workspace by slug and calls setActive with the ID
551
+ * Get a workspace by ID (admin)
550
552
  */
551
- async setActiveBySlug(slug) {
552
- const workspaces = await this.list();
553
- const workspace = workspaces.find((w) => w.workspace.slug === slug);
554
- if (!workspace) {
555
- throw new Error(`Workspace with slug "${slug}" not found`);
556
- }
557
- return this.setActive(workspace.workspace.id);
553
+ async get(id) {
554
+ return this.http.get(`/api/admin/groups/${id}`);
555
+ }
556
+ /**
557
+ * Create a new workspace (requires SUPER_ADMIN)
558
+ */
559
+ async create(data) {
560
+ return this.http.post("/api/admin/groups", data);
561
+ }
562
+ /**
563
+ * Update workspace settings (requires ADMIN or OWNER)
564
+ */
565
+ async update(id, data) {
566
+ return this.http.put(`/api/admin/groups/${id}`, data);
567
+ }
568
+ /**
569
+ * Delete a workspace (requires SUPER_ADMIN)
570
+ */
571
+ async delete(id, force = false) {
572
+ const url = `/api/admin/groups/${id}${force ? "?force=true" : ""}`;
573
+ await this.http.delete(url);
574
+ }
575
+ };
576
+
577
+ // src/platform/invites.ts
578
+ var InvitesModule = class {
579
+ constructor(http) {
580
+ this.http = http;
581
+ }
582
+ http;
583
+ /**
584
+ * List all invite tokens for the current workspace
585
+ */
586
+ async list() {
587
+ const response = await this.http.get("/api/groups/invitations");
588
+ return response.items || [];
589
+ }
590
+ /**
591
+ * Create a new invite token
592
+ */
593
+ async create(data) {
594
+ return this.http.post("/api/groups/invitations", data);
595
+ }
596
+ /**
597
+ * Send an email invitation
598
+ */
599
+ async sendEmail(data) {
600
+ await this.http.post("/api/groups/invitations/email", data);
558
601
  }
559
602
  };
560
603
 
@@ -568,6 +611,7 @@ var PlatformClient = class extends HttpClient {
568
611
  entryTypes;
569
612
  workspaceMembers;
570
613
  workspaces;
614
+ invites;
571
615
  constructor(config) {
572
616
  const httpConfig = {
573
617
  baseUrl: config.apiUrl,
@@ -583,6 +627,7 @@ var PlatformClient = class extends HttpClient {
583
627
  this.entryTypes = new EntryTypesModule(this);
584
628
  this.workspaceMembers = new WorkspaceMembersModule(this);
585
629
  this.workspaces = new WorkspacesModule(this);
630
+ this.invites = new InvitesModule(this);
586
631
  }
587
632
  };
588
633
  function createPlatformClient(config) {
@@ -595,6 +640,7 @@ function createPlatformClient(config) {
595
640
  CollectionsModule,
596
641
  EntriesModule,
597
642
  EntryTypesModule,
643
+ InvitesModule,
598
644
  PlatformClient,
599
645
  ResourcesModule,
600
646
  WorkspaceMembersModule,
@@ -2279,11 +2279,8 @@ interface components {
2279
2279
  * @description Request to change active workspace.
2280
2280
  */
2281
2281
  WorkspaceActivationRequest: {
2282
- /**
2283
- * Workspaceid
2284
- * Format: uuid4
2285
- */
2286
- workspaceId: string;
2282
+ /** Workspace */
2283
+ workspace: string;
2287
2284
  };
2288
2285
  /**
2289
2286
  * WorkspaceInfo
@@ -2692,10 +2689,19 @@ interface Workspace {
2692
2689
  interface WorkspaceWithMembership {
2693
2690
  workspace: Workspace;
2694
2691
  role: string;
2695
- is_active: boolean;
2692
+ isActive: boolean;
2696
2693
  }
2697
2694
  interface WorkspaceActivationRequest {
2698
- workspace_id: string;
2695
+ workspace: string;
2696
+ }
2697
+ interface WorkspaceCreate {
2698
+ name: string;
2699
+ slug?: string;
2700
+ description?: string | null;
2701
+ }
2702
+ interface WorkspaceUpdate {
2703
+ name?: string;
2704
+ description?: string | null;
2699
2705
  }
2700
2706
  declare class WorkspacesModule {
2701
2707
  private http;
@@ -2709,14 +2715,56 @@ declare class WorkspacesModule {
2709
2715
  */
2710
2716
  list(): Promise<WorkspaceWithMembership[]>;
2711
2717
  /**
2712
- * Set active workspace by ID
2718
+ * Set active workspace by slug or ID
2719
+ * Backend accepts both, so no lookup needed
2720
+ */
2721
+ setActive(workspace: string): Promise<Workspace>;
2722
+ /**
2723
+ * Get a workspace by ID (admin)
2724
+ */
2725
+ get(id: string): Promise<Workspace>;
2726
+ /**
2727
+ * Create a new workspace (requires SUPER_ADMIN)
2728
+ */
2729
+ create(data: WorkspaceCreate): Promise<Workspace>;
2730
+ /**
2731
+ * Update workspace settings (requires ADMIN or OWNER)
2732
+ */
2733
+ update(id: string, data: WorkspaceUpdate): Promise<Workspace>;
2734
+ /**
2735
+ * Delete a workspace (requires SUPER_ADMIN)
2736
+ */
2737
+ delete(id: string, force?: boolean): Promise<void>;
2738
+ }
2739
+
2740
+ /**
2741
+ * Invites Module - Platform API
2742
+ *
2743
+ * Manage workspace invitation tokens and email invitations
2744
+ */
2745
+
2746
+ type InviteTokenCreate = components['schemas']['InviteTokenCreate'];
2747
+ type InviteTokenSummary = components['schemas']['InviteTokenSummary'];
2748
+ type InviteTokenPagination = components['schemas']['InviteTokenPagination'];
2749
+ interface EmailInvitationRequest {
2750
+ email: string;
2751
+ usesLeft?: number;
2752
+ }
2753
+ declare class InvitesModule {
2754
+ private http;
2755
+ constructor(http: HttpClient);
2756
+ /**
2757
+ * List all invite tokens for the current workspace
2758
+ */
2759
+ list(): Promise<InviteTokenSummary[]>;
2760
+ /**
2761
+ * Create a new invite token
2713
2762
  */
2714
- setActive(workspaceId: string): Promise<Workspace>;
2763
+ create(data: InviteTokenCreate): Promise<InviteTokenSummary>;
2715
2764
  /**
2716
- * Set active workspace by slug (convenience method)
2717
- * Internally looks up the workspace by slug and calls setActive with the ID
2765
+ * Send an email invitation
2718
2766
  */
2719
- setActiveBySlug(slug: string): Promise<Workspace>;
2767
+ sendEmail(data: EmailInvitationRequest): Promise<void>;
2720
2768
  }
2721
2769
 
2722
2770
  /**
@@ -2739,6 +2787,7 @@ declare class PlatformClient extends HttpClient {
2739
2787
  entryTypes: EntryTypesModule;
2740
2788
  workspaceMembers: WorkspaceMembersModule;
2741
2789
  workspaces: WorkspacesModule;
2790
+ invites: InvitesModule;
2742
2791
  constructor(config: PlatformClientConfig);
2743
2792
  }
2744
2793
  /**
@@ -2746,4 +2795,4 @@ declare class PlatformClient extends HttpClient {
2746
2795
  */
2747
2796
  declare function createPlatformClient(config: PlatformClientConfig): PlatformClient;
2748
2797
 
2749
- export { APIClientsModule, AssetsModule, CollectionsModule, EntriesModule, EntryTypesModule, type PlatformAPIClient, type PlatformAPIClientCreate, type PlatformAPIClientUpdate, type PlatformAPIClientWithToken, type PlatformAsset, type PlatformAssetCreate, type PlatformAssetUpdate, PlatformClient, type PlatformClientConfig, type PlatformCollection, type PlatformCollectionCreate, type PlatformCollectionUpdate, type PlatformEntry, type PlatformEntryCreate, type PlatformEntryType, type PlatformEntryUpdate, type PlatformResource, type PlatformResourceCreate, type PlatformResourceUpdate, type PlatformWorkspaceMember, type PlatformWorkspaceMemberCreate, type PlatformWorkspaceMemberUpdate, ResourcesModule, type Workspace, type WorkspaceActivationRequest, WorkspaceMembersModule, type WorkspaceWithMembership, WorkspacesModule, createPlatformClient };
2798
+ export { APIClientsModule, AssetsModule, CollectionsModule, type EmailInvitationRequest, EntriesModule, EntryTypesModule, type InviteTokenCreate, type InviteTokenPagination, type InviteTokenSummary, InvitesModule, type PlatformAPIClient, type PlatformAPIClientCreate, type PlatformAPIClientUpdate, type PlatformAPIClientWithToken, type PlatformAsset, type PlatformAssetCreate, type PlatformAssetUpdate, PlatformClient, type PlatformClientConfig, type PlatformCollection, type PlatformCollectionCreate, type PlatformCollectionUpdate, type PlatformEntry, type PlatformEntryCreate, type PlatformEntryType, type PlatformEntryUpdate, type PlatformResource, type PlatformResourceCreate, type PlatformResourceUpdate, type PlatformWorkspaceMember, type PlatformWorkspaceMemberCreate, type PlatformWorkspaceMemberUpdate, ResourcesModule, type Workspace, type WorkspaceActivationRequest, type WorkspaceCreate, WorkspaceMembersModule, type WorkspaceUpdate, type WorkspaceWithMembership, WorkspacesModule, createPlatformClient };
@@ -2279,11 +2279,8 @@ interface components {
2279
2279
  * @description Request to change active workspace.
2280
2280
  */
2281
2281
  WorkspaceActivationRequest: {
2282
- /**
2283
- * Workspaceid
2284
- * Format: uuid4
2285
- */
2286
- workspaceId: string;
2282
+ /** Workspace */
2283
+ workspace: string;
2287
2284
  };
2288
2285
  /**
2289
2286
  * WorkspaceInfo
@@ -2692,10 +2689,19 @@ interface Workspace {
2692
2689
  interface WorkspaceWithMembership {
2693
2690
  workspace: Workspace;
2694
2691
  role: string;
2695
- is_active: boolean;
2692
+ isActive: boolean;
2696
2693
  }
2697
2694
  interface WorkspaceActivationRequest {
2698
- workspace_id: string;
2695
+ workspace: string;
2696
+ }
2697
+ interface WorkspaceCreate {
2698
+ name: string;
2699
+ slug?: string;
2700
+ description?: string | null;
2701
+ }
2702
+ interface WorkspaceUpdate {
2703
+ name?: string;
2704
+ description?: string | null;
2699
2705
  }
2700
2706
  declare class WorkspacesModule {
2701
2707
  private http;
@@ -2709,14 +2715,56 @@ declare class WorkspacesModule {
2709
2715
  */
2710
2716
  list(): Promise<WorkspaceWithMembership[]>;
2711
2717
  /**
2712
- * Set active workspace by ID
2718
+ * Set active workspace by slug or ID
2719
+ * Backend accepts both, so no lookup needed
2720
+ */
2721
+ setActive(workspace: string): Promise<Workspace>;
2722
+ /**
2723
+ * Get a workspace by ID (admin)
2724
+ */
2725
+ get(id: string): Promise<Workspace>;
2726
+ /**
2727
+ * Create a new workspace (requires SUPER_ADMIN)
2728
+ */
2729
+ create(data: WorkspaceCreate): Promise<Workspace>;
2730
+ /**
2731
+ * Update workspace settings (requires ADMIN or OWNER)
2732
+ */
2733
+ update(id: string, data: WorkspaceUpdate): Promise<Workspace>;
2734
+ /**
2735
+ * Delete a workspace (requires SUPER_ADMIN)
2736
+ */
2737
+ delete(id: string, force?: boolean): Promise<void>;
2738
+ }
2739
+
2740
+ /**
2741
+ * Invites Module - Platform API
2742
+ *
2743
+ * Manage workspace invitation tokens and email invitations
2744
+ */
2745
+
2746
+ type InviteTokenCreate = components['schemas']['InviteTokenCreate'];
2747
+ type InviteTokenSummary = components['schemas']['InviteTokenSummary'];
2748
+ type InviteTokenPagination = components['schemas']['InviteTokenPagination'];
2749
+ interface EmailInvitationRequest {
2750
+ email: string;
2751
+ usesLeft?: number;
2752
+ }
2753
+ declare class InvitesModule {
2754
+ private http;
2755
+ constructor(http: HttpClient);
2756
+ /**
2757
+ * List all invite tokens for the current workspace
2758
+ */
2759
+ list(): Promise<InviteTokenSummary[]>;
2760
+ /**
2761
+ * Create a new invite token
2713
2762
  */
2714
- setActive(workspaceId: string): Promise<Workspace>;
2763
+ create(data: InviteTokenCreate): Promise<InviteTokenSummary>;
2715
2764
  /**
2716
- * Set active workspace by slug (convenience method)
2717
- * Internally looks up the workspace by slug and calls setActive with the ID
2765
+ * Send an email invitation
2718
2766
  */
2719
- setActiveBySlug(slug: string): Promise<Workspace>;
2767
+ sendEmail(data: EmailInvitationRequest): Promise<void>;
2720
2768
  }
2721
2769
 
2722
2770
  /**
@@ -2739,6 +2787,7 @@ declare class PlatformClient extends HttpClient {
2739
2787
  entryTypes: EntryTypesModule;
2740
2788
  workspaceMembers: WorkspaceMembersModule;
2741
2789
  workspaces: WorkspacesModule;
2790
+ invites: InvitesModule;
2742
2791
  constructor(config: PlatformClientConfig);
2743
2792
  }
2744
2793
  /**
@@ -2746,4 +2795,4 @@ declare class PlatformClient extends HttpClient {
2746
2795
  */
2747
2796
  declare function createPlatformClient(config: PlatformClientConfig): PlatformClient;
2748
2797
 
2749
- export { APIClientsModule, AssetsModule, CollectionsModule, EntriesModule, EntryTypesModule, type PlatformAPIClient, type PlatformAPIClientCreate, type PlatformAPIClientUpdate, type PlatformAPIClientWithToken, type PlatformAsset, type PlatformAssetCreate, type PlatformAssetUpdate, PlatformClient, type PlatformClientConfig, type PlatformCollection, type PlatformCollectionCreate, type PlatformCollectionUpdate, type PlatformEntry, type PlatformEntryCreate, type PlatformEntryType, type PlatformEntryUpdate, type PlatformResource, type PlatformResourceCreate, type PlatformResourceUpdate, type PlatformWorkspaceMember, type PlatformWorkspaceMemberCreate, type PlatformWorkspaceMemberUpdate, ResourcesModule, type Workspace, type WorkspaceActivationRequest, WorkspaceMembersModule, type WorkspaceWithMembership, WorkspacesModule, createPlatformClient };
2798
+ export { APIClientsModule, AssetsModule, CollectionsModule, type EmailInvitationRequest, EntriesModule, EntryTypesModule, type InviteTokenCreate, type InviteTokenPagination, type InviteTokenSummary, InvitesModule, type PlatformAPIClient, type PlatformAPIClientCreate, type PlatformAPIClientUpdate, type PlatformAPIClientWithToken, type PlatformAsset, type PlatformAssetCreate, type PlatformAssetUpdate, PlatformClient, type PlatformClientConfig, type PlatformCollection, type PlatformCollectionCreate, type PlatformCollectionUpdate, type PlatformEntry, type PlatformEntryCreate, type PlatformEntryType, type PlatformEntryUpdate, type PlatformResource, type PlatformResourceCreate, type PlatformResourceUpdate, type PlatformWorkspaceMember, type PlatformWorkspaceMemberCreate, type PlatformWorkspaceMemberUpdate, ResourcesModule, type Workspace, type WorkspaceActivationRequest, type WorkspaceCreate, WorkspaceMembersModule, type WorkspaceUpdate, type WorkspaceWithMembership, WorkspacesModule, createPlatformClient };
package/dist/platform.js CHANGED
@@ -332,24 +332,66 @@ var WorkspacesModule = class {
332
332
  return this.http.get("/api/self/workspaces");
333
333
  }
334
334
  /**
335
- * Set active workspace by ID
335
+ * Set active workspace by slug or ID
336
+ * Backend accepts both, so no lookup needed
336
337
  */
337
- async setActive(workspaceId) {
338
+ async setActive(workspace) {
338
339
  return this.http.put("/api/self/workspaces/current", {
339
- workspace_id: workspaceId
340
+ workspace
340
341
  });
341
342
  }
343
+ // Admin operations (require SUPER_ADMIN or appropriate permissions)
342
344
  /**
343
- * Set active workspace by slug (convenience method)
344
- * Internally looks up the workspace by slug and calls setActive with the ID
345
+ * Get a workspace by ID (admin)
345
346
  */
346
- async setActiveBySlug(slug) {
347
- const workspaces = await this.list();
348
- const workspace = workspaces.find((w) => w.workspace.slug === slug);
349
- if (!workspace) {
350
- throw new Error(`Workspace with slug "${slug}" not found`);
351
- }
352
- return this.setActive(workspace.workspace.id);
347
+ async get(id) {
348
+ return this.http.get(`/api/admin/groups/${id}`);
349
+ }
350
+ /**
351
+ * Create a new workspace (requires SUPER_ADMIN)
352
+ */
353
+ async create(data) {
354
+ return this.http.post("/api/admin/groups", data);
355
+ }
356
+ /**
357
+ * Update workspace settings (requires ADMIN or OWNER)
358
+ */
359
+ async update(id, data) {
360
+ return this.http.put(`/api/admin/groups/${id}`, data);
361
+ }
362
+ /**
363
+ * Delete a workspace (requires SUPER_ADMIN)
364
+ */
365
+ async delete(id, force = false) {
366
+ const url = `/api/admin/groups/${id}${force ? "?force=true" : ""}`;
367
+ await this.http.delete(url);
368
+ }
369
+ };
370
+
371
+ // src/platform/invites.ts
372
+ var InvitesModule = class {
373
+ constructor(http) {
374
+ this.http = http;
375
+ }
376
+ http;
377
+ /**
378
+ * List all invite tokens for the current workspace
379
+ */
380
+ async list() {
381
+ const response = await this.http.get("/api/groups/invitations");
382
+ return response.items || [];
383
+ }
384
+ /**
385
+ * Create a new invite token
386
+ */
387
+ async create(data) {
388
+ return this.http.post("/api/groups/invitations", data);
389
+ }
390
+ /**
391
+ * Send an email invitation
392
+ */
393
+ async sendEmail(data) {
394
+ await this.http.post("/api/groups/invitations/email", data);
353
395
  }
354
396
  };
355
397
 
@@ -363,6 +405,7 @@ var PlatformClient = class extends HttpClient {
363
405
  entryTypes;
364
406
  workspaceMembers;
365
407
  workspaces;
408
+ invites;
366
409
  constructor(config) {
367
410
  const httpConfig = {
368
411
  baseUrl: config.apiUrl,
@@ -378,6 +421,7 @@ var PlatformClient = class extends HttpClient {
378
421
  this.entryTypes = new EntryTypesModule(this);
379
422
  this.workspaceMembers = new WorkspaceMembersModule(this);
380
423
  this.workspaces = new WorkspacesModule(this);
424
+ this.invites = new InvitesModule(this);
381
425
  }
382
426
  };
383
427
  function createPlatformClient(config) {
@@ -389,6 +433,7 @@ export {
389
433
  CollectionsModule,
390
434
  EntriesModule,
391
435
  EntryTypesModule,
436
+ InvitesModule,
392
437
  PlatformClient,
393
438
  ResourcesModule,
394
439
  WorkspaceMembersModule,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inneropen/marvin-sdk",
3
- "version": "1.4.0",
3
+ "version": "1.6.0",
4
4
  "description": "Official TypeScript SDK for Marvin CMS",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",