@inneropen/marvin-sdk 1.3.1 → 1.4.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
@@ -28,6 +28,7 @@ __export(platform_exports, {
28
28
  PlatformClient: () => PlatformClient,
29
29
  ResourcesModule: () => ResourcesModule,
30
30
  WorkspaceMembersModule: () => WorkspaceMembersModule,
31
+ WorkspacesModule: () => WorkspacesModule,
31
32
  createPlatformClient: () => createPlatformClient
32
33
  });
33
34
  module.exports = __toCommonJS(platform_exports);
@@ -517,6 +518,46 @@ var WorkspaceMembersModule = class {
517
518
  }
518
519
  };
519
520
 
521
+ // src/platform/workspaces.ts
522
+ var WorkspacesModule = class {
523
+ constructor(http) {
524
+ this.http = http;
525
+ }
526
+ http;
527
+ /**
528
+ * Get the current active workspace
529
+ */
530
+ async getCurrent() {
531
+ return this.http.get("/api/self/workspaces/current");
532
+ }
533
+ /**
534
+ * List all accessible workspaces
535
+ */
536
+ async list() {
537
+ return this.http.get("/api/self/workspaces");
538
+ }
539
+ /**
540
+ * Set active workspace by ID
541
+ */
542
+ async setActive(workspaceId) {
543
+ return this.http.put("/api/self/workspaces/current", {
544
+ workspace_id: workspaceId
545
+ });
546
+ }
547
+ /**
548
+ * Set active workspace by slug (convenience method)
549
+ * Internally looks up the workspace by slug and calls setActive with the ID
550
+ */
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);
558
+ }
559
+ };
560
+
520
561
  // src/platform/client.ts
521
562
  var PlatformClient = class extends HttpClient {
522
563
  entries;
@@ -526,6 +567,7 @@ var PlatformClient = class extends HttpClient {
526
567
  apiClients;
527
568
  entryTypes;
528
569
  workspaceMembers;
570
+ workspaces;
529
571
  constructor(config) {
530
572
  const httpConfig = {
531
573
  baseUrl: config.apiUrl,
@@ -540,6 +582,7 @@ var PlatformClient = class extends HttpClient {
540
582
  this.apiClients = new APIClientsModule(this);
541
583
  this.entryTypes = new EntryTypesModule(this);
542
584
  this.workspaceMembers = new WorkspaceMembersModule(this);
585
+ this.workspaces = new WorkspacesModule(this);
543
586
  }
544
587
  };
545
588
  function createPlatformClient(config) {
@@ -555,5 +598,6 @@ function createPlatformClient(config) {
555
598
  PlatformClient,
556
599
  ResourcesModule,
557
600
  WorkspaceMembersModule,
601
+ WorkspacesModule,
558
602
  createPlatformClient
559
603
  });
@@ -2677,6 +2677,48 @@ declare class WorkspaceMembersModule {
2677
2677
  remove(workspaceId: string, userId: string): Promise<void>;
2678
2678
  }
2679
2679
 
2680
+ /**
2681
+ * Workspaces Module - Platform API
2682
+ *
2683
+ * Workspace activation and listing operations
2684
+ */
2685
+
2686
+ interface Workspace {
2687
+ id: string;
2688
+ slug: string;
2689
+ name: string;
2690
+ description?: string | null;
2691
+ }
2692
+ interface WorkspaceWithMembership {
2693
+ workspace: Workspace;
2694
+ role: string;
2695
+ is_active: boolean;
2696
+ }
2697
+ interface WorkspaceActivationRequest {
2698
+ workspace_id: string;
2699
+ }
2700
+ declare class WorkspacesModule {
2701
+ private http;
2702
+ constructor(http: HttpClient);
2703
+ /**
2704
+ * Get the current active workspace
2705
+ */
2706
+ getCurrent(): Promise<Workspace>;
2707
+ /**
2708
+ * List all accessible workspaces
2709
+ */
2710
+ list(): Promise<WorkspaceWithMembership[]>;
2711
+ /**
2712
+ * Set active workspace by ID
2713
+ */
2714
+ setActive(workspaceId: string): Promise<Workspace>;
2715
+ /**
2716
+ * Set active workspace by slug (convenience method)
2717
+ * Internally looks up the workspace by slug and calls setActive with the ID
2718
+ */
2719
+ setActiveBySlug(slug: string): Promise<Workspace>;
2720
+ }
2721
+
2680
2722
  /**
2681
2723
  * Platform API Client
2682
2724
  *
@@ -2696,6 +2738,7 @@ declare class PlatformClient extends HttpClient {
2696
2738
  apiClients: APIClientsModule;
2697
2739
  entryTypes: EntryTypesModule;
2698
2740
  workspaceMembers: WorkspaceMembersModule;
2741
+ workspaces: WorkspacesModule;
2699
2742
  constructor(config: PlatformClientConfig);
2700
2743
  }
2701
2744
  /**
@@ -2703,4 +2746,4 @@ declare class PlatformClient extends HttpClient {
2703
2746
  */
2704
2747
  declare function createPlatformClient(config: PlatformClientConfig): PlatformClient;
2705
2748
 
2706
- 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, WorkspaceMembersModule, createPlatformClient };
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 };
@@ -2677,6 +2677,48 @@ declare class WorkspaceMembersModule {
2677
2677
  remove(workspaceId: string, userId: string): Promise<void>;
2678
2678
  }
2679
2679
 
2680
+ /**
2681
+ * Workspaces Module - Platform API
2682
+ *
2683
+ * Workspace activation and listing operations
2684
+ */
2685
+
2686
+ interface Workspace {
2687
+ id: string;
2688
+ slug: string;
2689
+ name: string;
2690
+ description?: string | null;
2691
+ }
2692
+ interface WorkspaceWithMembership {
2693
+ workspace: Workspace;
2694
+ role: string;
2695
+ is_active: boolean;
2696
+ }
2697
+ interface WorkspaceActivationRequest {
2698
+ workspace_id: string;
2699
+ }
2700
+ declare class WorkspacesModule {
2701
+ private http;
2702
+ constructor(http: HttpClient);
2703
+ /**
2704
+ * Get the current active workspace
2705
+ */
2706
+ getCurrent(): Promise<Workspace>;
2707
+ /**
2708
+ * List all accessible workspaces
2709
+ */
2710
+ list(): Promise<WorkspaceWithMembership[]>;
2711
+ /**
2712
+ * Set active workspace by ID
2713
+ */
2714
+ setActive(workspaceId: string): Promise<Workspace>;
2715
+ /**
2716
+ * Set active workspace by slug (convenience method)
2717
+ * Internally looks up the workspace by slug and calls setActive with the ID
2718
+ */
2719
+ setActiveBySlug(slug: string): Promise<Workspace>;
2720
+ }
2721
+
2680
2722
  /**
2681
2723
  * Platform API Client
2682
2724
  *
@@ -2696,6 +2738,7 @@ declare class PlatformClient extends HttpClient {
2696
2738
  apiClients: APIClientsModule;
2697
2739
  entryTypes: EntryTypesModule;
2698
2740
  workspaceMembers: WorkspaceMembersModule;
2741
+ workspaces: WorkspacesModule;
2699
2742
  constructor(config: PlatformClientConfig);
2700
2743
  }
2701
2744
  /**
@@ -2703,4 +2746,4 @@ declare class PlatformClient extends HttpClient {
2703
2746
  */
2704
2747
  declare function createPlatformClient(config: PlatformClientConfig): PlatformClient;
2705
2748
 
2706
- 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, WorkspaceMembersModule, createPlatformClient };
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 };
package/dist/platform.js CHANGED
@@ -313,6 +313,46 @@ var WorkspaceMembersModule = class {
313
313
  }
314
314
  };
315
315
 
316
+ // src/platform/workspaces.ts
317
+ var WorkspacesModule = class {
318
+ constructor(http) {
319
+ this.http = http;
320
+ }
321
+ http;
322
+ /**
323
+ * Get the current active workspace
324
+ */
325
+ async getCurrent() {
326
+ return this.http.get("/api/self/workspaces/current");
327
+ }
328
+ /**
329
+ * List all accessible workspaces
330
+ */
331
+ async list() {
332
+ return this.http.get("/api/self/workspaces");
333
+ }
334
+ /**
335
+ * Set active workspace by ID
336
+ */
337
+ async setActive(workspaceId) {
338
+ return this.http.put("/api/self/workspaces/current", {
339
+ workspace_id: workspaceId
340
+ });
341
+ }
342
+ /**
343
+ * Set active workspace by slug (convenience method)
344
+ * Internally looks up the workspace by slug and calls setActive with the ID
345
+ */
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);
353
+ }
354
+ };
355
+
316
356
  // src/platform/client.ts
317
357
  var PlatformClient = class extends HttpClient {
318
358
  entries;
@@ -322,6 +362,7 @@ var PlatformClient = class extends HttpClient {
322
362
  apiClients;
323
363
  entryTypes;
324
364
  workspaceMembers;
365
+ workspaces;
325
366
  constructor(config) {
326
367
  const httpConfig = {
327
368
  baseUrl: config.apiUrl,
@@ -336,6 +377,7 @@ var PlatformClient = class extends HttpClient {
336
377
  this.apiClients = new APIClientsModule(this);
337
378
  this.entryTypes = new EntryTypesModule(this);
338
379
  this.workspaceMembers = new WorkspaceMembersModule(this);
380
+ this.workspaces = new WorkspacesModule(this);
339
381
  }
340
382
  };
341
383
  function createPlatformClient(config) {
@@ -350,5 +392,6 @@ export {
350
392
  PlatformClient,
351
393
  ResourcesModule,
352
394
  WorkspaceMembersModule,
395
+ WorkspacesModule,
353
396
  createPlatformClient
354
397
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inneropen/marvin-sdk",
3
- "version": "1.3.1",
3
+ "version": "1.4.0",
4
4
  "description": "Official TypeScript SDK for Marvin CMS",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",