@inneropen/marvin-sdk 1.6.0 → 1.8.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/index.cjs CHANGED
@@ -1116,6 +1116,7 @@ var init_marvin = __esm({
1116
1116
  // src/index.ts
1117
1117
  var index_exports = {};
1118
1118
  __export(index_exports, {
1119
+ AuthClient: () => AuthClient,
1119
1120
  BearerTokenAuth: () => BearerTokenAuth,
1120
1121
  Collection: () => Collection,
1121
1122
  Entry: () => Entry,
@@ -1131,6 +1132,7 @@ __export(index_exports, {
1131
1132
  Resource: () => Resource,
1132
1133
  SessionAuth: () => SessionAuth,
1133
1134
  Workspace: () => Workspace,
1135
+ createAuthClient: () => createAuthClient,
1134
1136
  createConfigFromEnv: () => createConfigFromEnv,
1135
1137
  createMarvinClient: () => createMarvinClient,
1136
1138
  createPaginatedResponse: () => createPaginatedResponse,
@@ -1147,6 +1149,37 @@ init_workspace();
1147
1149
  init_entry();
1148
1150
  init_collection();
1149
1151
  init_resource();
1152
+
1153
+ // src/auth.ts
1154
+ init_core();
1155
+ var AuthClient = class extends HttpClient {
1156
+ constructor(apiUrl) {
1157
+ super({ baseUrl: apiUrl, auth: new NoAuth() });
1158
+ }
1159
+ /**
1160
+ * Register a new user
1161
+ */
1162
+ async register(data) {
1163
+ return this.post("/api/users/register", data);
1164
+ }
1165
+ /**
1166
+ * Request password reset (sends email with token)
1167
+ */
1168
+ async forgotPassword(data) {
1169
+ return this.post("/api/users/forgot-password", data);
1170
+ }
1171
+ /**
1172
+ * Reset password with token from email
1173
+ */
1174
+ async resetPassword(data) {
1175
+ return this.post("/api/users/reset-password", data);
1176
+ }
1177
+ };
1178
+ function createAuthClient(apiUrl) {
1179
+ return new AuthClient(apiUrl);
1180
+ }
1181
+
1182
+ // src/index.ts
1150
1183
  function createMarvinClient(config) {
1151
1184
  const { MarvinClient: MarvinClient2 } = (init_marvin(), __toCommonJS(marvin_exports));
1152
1185
  const { createConfigFromEnv: createConfigFromEnv2 } = (init_config(), __toCommonJS(config_exports));
@@ -1155,6 +1188,7 @@ function createMarvinClient(config) {
1155
1188
  }
1156
1189
  // Annotate the CommonJS export names for ESM import in node:
1157
1190
  0 && (module.exports = {
1191
+ AuthClient,
1158
1192
  BearerTokenAuth,
1159
1193
  Collection,
1160
1194
  Entry,
@@ -1170,6 +1204,7 @@ function createMarvinClient(config) {
1170
1204
  Resource,
1171
1205
  SessionAuth,
1172
1206
  Workspace,
1207
+ createAuthClient,
1173
1208
  createConfigFromEnv,
1174
1209
  createMarvinClient,
1175
1210
  createPaginatedResponse,
package/dist/index.d.cts CHANGED
@@ -504,6 +504,52 @@ declare class MarvinClient {
504
504
  getResourceEntries(slug: string): Promise<MarvinEntry[]>;
505
505
  }
506
506
 
507
+ /**
508
+ * Authentication & User Registration
509
+ *
510
+ * Public authentication endpoints (no auth required)
511
+ */
512
+
513
+ interface UserRegistration {
514
+ username: string;
515
+ email: string;
516
+ password: string;
517
+ fullName?: string;
518
+ }
519
+ interface ForgotPasswordRequest {
520
+ email: string;
521
+ }
522
+ interface ResetPasswordRequest {
523
+ token: string;
524
+ newPassword: string;
525
+ }
526
+ declare class AuthClient extends HttpClient {
527
+ constructor(apiUrl: string);
528
+ /**
529
+ * Register a new user
530
+ */
531
+ register(data: UserRegistration): Promise<{
532
+ message: string;
533
+ userId: string;
534
+ }>;
535
+ /**
536
+ * Request password reset (sends email with token)
537
+ */
538
+ forgotPassword(data: ForgotPasswordRequest): Promise<{
539
+ message: string;
540
+ }>;
541
+ /**
542
+ * Reset password with token from email
543
+ */
544
+ resetPassword(data: ResetPasswordRequest): Promise<{
545
+ message: string;
546
+ }>;
547
+ }
548
+ /**
549
+ * Create an Auth client for registration and password reset
550
+ */
551
+ declare function createAuthClient(apiUrl: string): AuthClient;
552
+
507
553
  /**
508
554
  * Create a Marvin client instance from environment variables
509
555
  *
@@ -524,4 +570,4 @@ declare class MarvinClient {
524
570
  */
525
571
  declare function createMarvinClient(config?: Partial<MarvinConfig>): MarvinClient;
526
572
 
527
- export { Collection, Entry, GetResourcesOptions$1 as GetResourcesOptions, HttpClient, MarvinApiError, MarvinAsset, MarvinAuthError, MarvinCache, MarvinClient, MarvinCollection, type MarvinConfig, MarvinConfigError, MarvinEntry, MarvinEntryType, MarvinError, MarvinResource, MarvinSite, MarvinValidationError, type PaginatedResponse, type PaginationMeta, type PaginationParams, Resource, Workspace, createConfigFromEnv, createMarvinClient, createPaginatedResponse, extractData, isPaginatedResponse, offsetToPage, pageToOffset };
573
+ export { AuthClient, Collection, Entry, type ForgotPasswordRequest, GetResourcesOptions$1 as GetResourcesOptions, HttpClient, MarvinApiError, MarvinAsset, MarvinAuthError, MarvinCache, MarvinClient, MarvinCollection, type MarvinConfig, MarvinConfigError, MarvinEntry, MarvinEntryType, MarvinError, MarvinResource, MarvinSite, MarvinValidationError, type PaginatedResponse, type PaginationMeta, type PaginationParams, type ResetPasswordRequest, Resource, type UserRegistration, Workspace, createAuthClient, createConfigFromEnv, createMarvinClient, createPaginatedResponse, extractData, isPaginatedResponse, offsetToPage, pageToOffset };
package/dist/index.d.ts CHANGED
@@ -504,6 +504,52 @@ declare class MarvinClient {
504
504
  getResourceEntries(slug: string): Promise<MarvinEntry[]>;
505
505
  }
506
506
 
507
+ /**
508
+ * Authentication & User Registration
509
+ *
510
+ * Public authentication endpoints (no auth required)
511
+ */
512
+
513
+ interface UserRegistration {
514
+ username: string;
515
+ email: string;
516
+ password: string;
517
+ fullName?: string;
518
+ }
519
+ interface ForgotPasswordRequest {
520
+ email: string;
521
+ }
522
+ interface ResetPasswordRequest {
523
+ token: string;
524
+ newPassword: string;
525
+ }
526
+ declare class AuthClient extends HttpClient {
527
+ constructor(apiUrl: string);
528
+ /**
529
+ * Register a new user
530
+ */
531
+ register(data: UserRegistration): Promise<{
532
+ message: string;
533
+ userId: string;
534
+ }>;
535
+ /**
536
+ * Request password reset (sends email with token)
537
+ */
538
+ forgotPassword(data: ForgotPasswordRequest): Promise<{
539
+ message: string;
540
+ }>;
541
+ /**
542
+ * Reset password with token from email
543
+ */
544
+ resetPassword(data: ResetPasswordRequest): Promise<{
545
+ message: string;
546
+ }>;
547
+ }
548
+ /**
549
+ * Create an Auth client for registration and password reset
550
+ */
551
+ declare function createAuthClient(apiUrl: string): AuthClient;
552
+
507
553
  /**
508
554
  * Create a Marvin client instance from environment variables
509
555
  *
@@ -524,4 +570,4 @@ declare class MarvinClient {
524
570
  */
525
571
  declare function createMarvinClient(config?: Partial<MarvinConfig>): MarvinClient;
526
572
 
527
- export { Collection, Entry, GetResourcesOptions$1 as GetResourcesOptions, HttpClient, MarvinApiError, MarvinAsset, MarvinAuthError, MarvinCache, MarvinClient, MarvinCollection, type MarvinConfig, MarvinConfigError, MarvinEntry, MarvinEntryType, MarvinError, MarvinResource, MarvinSite, MarvinValidationError, type PaginatedResponse, type PaginationMeta, type PaginationParams, Resource, Workspace, createConfigFromEnv, createMarvinClient, createPaginatedResponse, extractData, isPaginatedResponse, offsetToPage, pageToOffset };
573
+ export { AuthClient, Collection, Entry, type ForgotPasswordRequest, GetResourcesOptions$1 as GetResourcesOptions, HttpClient, MarvinApiError, MarvinAsset, MarvinAuthError, MarvinCache, MarvinClient, MarvinCollection, type MarvinConfig, MarvinConfigError, MarvinEntry, MarvinEntryType, MarvinError, MarvinResource, MarvinSite, MarvinValidationError, type PaginatedResponse, type PaginationMeta, type PaginationParams, type ResetPasswordRequest, Resource, type UserRegistration, Workspace, createAuthClient, createConfigFromEnv, createMarvinClient, createPaginatedResponse, extractData, isPaginatedResponse, offsetToPage, pageToOffset };
package/dist/index.js CHANGED
@@ -772,6 +772,37 @@ init_workspace();
772
772
  init_entry();
773
773
  init_collection();
774
774
  init_resource();
775
+
776
+ // src/auth.ts
777
+ init_core();
778
+ var AuthClient = class extends HttpClient {
779
+ constructor(apiUrl) {
780
+ super({ baseUrl: apiUrl, auth: new NoAuth() });
781
+ }
782
+ /**
783
+ * Register a new user
784
+ */
785
+ async register(data) {
786
+ return this.post("/api/users/register", data);
787
+ }
788
+ /**
789
+ * Request password reset (sends email with token)
790
+ */
791
+ async forgotPassword(data) {
792
+ return this.post("/api/users/forgot-password", data);
793
+ }
794
+ /**
795
+ * Reset password with token from email
796
+ */
797
+ async resetPassword(data) {
798
+ return this.post("/api/users/reset-password", data);
799
+ }
800
+ };
801
+ function createAuthClient(apiUrl) {
802
+ return new AuthClient(apiUrl);
803
+ }
804
+
805
+ // src/index.ts
775
806
  function createMarvinClient(config) {
776
807
  const { MarvinClient: MarvinClient2 } = (init_marvin(), __toCommonJS(marvin_exports));
777
808
  const { createConfigFromEnv: createConfigFromEnv2 } = (init_config(), __toCommonJS(config_exports));
@@ -779,6 +810,7 @@ function createMarvinClient(config) {
779
810
  return new MarvinClient2(finalConfig);
780
811
  }
781
812
  export {
813
+ AuthClient,
782
814
  BearerTokenAuth,
783
815
  Collection,
784
816
  Entry,
@@ -794,6 +826,7 @@ export {
794
826
  Resource,
795
827
  SessionAuth,
796
828
  Workspace,
829
+ createAuthClient,
797
830
  createConfigFromEnv,
798
831
  createMarvinClient,
799
832
  createPaginatedResponse,
package/dist/platform.cjs CHANGED
@@ -21,13 +21,20 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var platform_exports = {};
22
22
  __export(platform_exports, {
23
23
  APIClientsModule: () => APIClientsModule,
24
+ AdminMaintenanceModule: () => AdminMaintenanceModule,
25
+ AdminSystemModule: () => AdminSystemModule,
26
+ AdminUsersModule: () => AdminUsersModule,
24
27
  AssetsModule: () => AssetsModule,
25
28
  CollectionsModule: () => CollectionsModule,
26
29
  EntriesModule: () => EntriesModule,
27
30
  EntryTypesModule: () => EntryTypesModule,
31
+ EventsModule: () => EventsModule,
28
32
  InvitesModule: () => InvitesModule,
33
+ NotificationsModule: () => NotificationsModule,
29
34
  PlatformClient: () => PlatformClient,
30
35
  ResourcesModule: () => ResourcesModule,
36
+ UserModule: () => UserModule,
37
+ WebhooksModule: () => WebhooksModule,
31
38
  WorkspaceMembersModule: () => WorkspaceMembersModule,
32
39
  WorkspacesModule: () => WorkspacesModule,
33
40
  createPlatformClient: () => createPlatformClient
@@ -572,6 +579,18 @@ var WorkspacesModule = class {
572
579
  const url = `/api/admin/groups/${id}${force ? "?force=true" : ""}`;
573
580
  await this.http.delete(url);
574
581
  }
582
+ /**
583
+ * Get workspace preferences
584
+ */
585
+ async getPreferences(workspaceId) {
586
+ return this.http.get(`/api/groups/${workspaceId}/preferences`);
587
+ }
588
+ /**
589
+ * Update workspace preferences
590
+ */
591
+ async updatePreferences(workspaceId, data) {
592
+ return this.http.put(`/api/groups/${workspaceId}/preferences`, data);
593
+ }
575
594
  };
576
595
 
577
596
  // src/platform/invites.ts
@@ -601,6 +620,303 @@ var InvitesModule = class {
601
620
  }
602
621
  };
603
622
 
623
+ // src/platform/notifications.ts
624
+ var NotificationsModule = class {
625
+ constructor(http) {
626
+ this.http = http;
627
+ }
628
+ http;
629
+ /**
630
+ * List all notifications for the current workspace
631
+ */
632
+ async list() {
633
+ return this.http.get("/api/group/notifications");
634
+ }
635
+ /**
636
+ * Get a notification by ID
637
+ */
638
+ async get(id) {
639
+ return this.http.get(`/api/group/notifications/${id}`);
640
+ }
641
+ /**
642
+ * Create a new notification
643
+ */
644
+ async create(data) {
645
+ return this.http.post("/api/group/notifications", data);
646
+ }
647
+ /**
648
+ * Update a notification
649
+ */
650
+ async update(id, data) {
651
+ return this.http.put(`/api/group/notifications/${id}`, data);
652
+ }
653
+ /**
654
+ * Delete a notification
655
+ */
656
+ async delete(id) {
657
+ await this.http.delete(`/api/group/notifications/${id}`);
658
+ }
659
+ /**
660
+ * Test a notification
661
+ */
662
+ async test(id) {
663
+ return this.http.post(`/api/group/notifications/${id}/test`, {});
664
+ }
665
+ };
666
+
667
+ // src/platform/webhooks.ts
668
+ var WebhooksModule = class {
669
+ constructor(http) {
670
+ this.http = http;
671
+ }
672
+ http;
673
+ /**
674
+ * List all webhooks for the current workspace
675
+ */
676
+ async list() {
677
+ const response = await this.http.get("/api/groups/webhooks");
678
+ return response.items || [];
679
+ }
680
+ /**
681
+ * Get a webhook by ID
682
+ */
683
+ async get(id) {
684
+ return this.http.get(`/api/groups/webhooks/${id}`);
685
+ }
686
+ /**
687
+ * Create a new webhook
688
+ */
689
+ async create(data) {
690
+ return this.http.post("/api/groups/webhooks", data);
691
+ }
692
+ /**
693
+ * Update a webhook
694
+ */
695
+ async update(id, data) {
696
+ return this.http.put(`/api/groups/webhooks/${id}`, data);
697
+ }
698
+ /**
699
+ * Delete a webhook
700
+ */
701
+ async delete(id) {
702
+ await this.http.delete(`/api/groups/webhooks/${id}`);
703
+ }
704
+ /**
705
+ * Test a webhook
706
+ */
707
+ async test(id) {
708
+ return this.http.post(`/api/groups/webhooks/${id}/test`, {});
709
+ }
710
+ /**
711
+ * Rerun failed webhooks
712
+ */
713
+ async rerun() {
714
+ return this.http.post("/api/groups/webhooks/rerun", {});
715
+ }
716
+ };
717
+
718
+ // src/platform/admin/users.ts
719
+ var AdminUsersModule = class {
720
+ constructor(http) {
721
+ this.http = http;
722
+ }
723
+ http;
724
+ /**
725
+ * List all users (paginated)
726
+ */
727
+ async list(page = 1, perPage = 50) {
728
+ return this.http.get(`/api/admin/users?page=${page}&per_page=${perPage}`);
729
+ }
730
+ /**
731
+ * Get a user by ID
732
+ */
733
+ async get(id) {
734
+ return this.http.get(`/api/admin/users/${id}`);
735
+ }
736
+ /**
737
+ * Update a user
738
+ */
739
+ async update(id, data) {
740
+ return this.http.put(`/api/admin/users/${id}`, data);
741
+ }
742
+ /**
743
+ * Delete a user
744
+ */
745
+ async delete(id) {
746
+ await this.http.delete(`/api/admin/users/${id}`);
747
+ }
748
+ /**
749
+ * Generate a password reset token for a user
750
+ */
751
+ async generatePasswordResetToken(userId) {
752
+ return this.http.post("/api/admin/users/password-reset-token", { userId });
753
+ }
754
+ /**
755
+ * Unlock a locked user account
756
+ */
757
+ async unlock(userId) {
758
+ await this.http.post("/api/admin/users/unlock", { userId });
759
+ }
760
+ };
761
+
762
+ // src/platform/admin/system.ts
763
+ var AdminSystemModule = class {
764
+ constructor(http) {
765
+ this.http = http;
766
+ }
767
+ http;
768
+ /**
769
+ * Get system information
770
+ */
771
+ async getAbout() {
772
+ return this.http.get("/api/admin/about");
773
+ }
774
+ /**
775
+ * Check system health
776
+ */
777
+ async check() {
778
+ return this.http.get("/api/admin/about/check");
779
+ }
780
+ /**
781
+ * Get startup information
782
+ */
783
+ async getStartupInfo() {
784
+ return this.http.get("/api/admin/about/startup-info");
785
+ }
786
+ /**
787
+ * Get system statistics
788
+ */
789
+ async getStatistics() {
790
+ return this.http.get("/api/admin/about/statistics");
791
+ }
792
+ /**
793
+ * Get email settings
794
+ */
795
+ async getEmailSettings() {
796
+ return this.http.get("/api/admin/email");
797
+ }
798
+ /**
799
+ * Update email settings
800
+ */
801
+ async updateEmailSettings(data) {
802
+ return this.http.put("/api/admin/email", data);
803
+ }
804
+ };
805
+
806
+ // src/platform/admin/maintenance.ts
807
+ var AdminMaintenanceModule = class {
808
+ constructor(http) {
809
+ this.http = http;
810
+ }
811
+ http;
812
+ /**
813
+ * Clean temporary files
814
+ */
815
+ async cleanTemp() {
816
+ return this.http.post("/api/admin/maintenance/clean/temp", {});
817
+ }
818
+ /**
819
+ * Clean up old events
820
+ */
821
+ async cleanupEvents() {
822
+ return this.http.post("/api/admin/maintenance/cleanup-events", {});
823
+ }
824
+ /**
825
+ * Clean up expired tokens
826
+ */
827
+ async cleanupTokens() {
828
+ return this.http.post("/api/admin/maintenance/cleanup-tokens", {});
829
+ }
830
+ /**
831
+ * Clear application cache
832
+ */
833
+ async clearCache() {
834
+ return this.http.post("/api/admin/maintenance/clear-cache", {});
835
+ }
836
+ /**
837
+ * Optimize database
838
+ */
839
+ async optimizeDatabase() {
840
+ return this.http.post("/api/admin/maintenance/optimize-db", {});
841
+ }
842
+ /**
843
+ * Get maintenance statistics
844
+ */
845
+ async getStats() {
846
+ return this.http.get("/api/admin/maintenance/stats");
847
+ }
848
+ /**
849
+ * Get storage information
850
+ */
851
+ async getStorage() {
852
+ return this.http.get("/api/admin/maintenance/storage");
853
+ }
854
+ };
855
+
856
+ // src/platform/user.ts
857
+ var UserModule = class {
858
+ constructor(http) {
859
+ this.http = http;
860
+ }
861
+ http;
862
+ /**
863
+ * Get current user profile
864
+ */
865
+ async getProfile() {
866
+ return this.http.get("/api/self");
867
+ }
868
+ /**
869
+ * List personal API tokens
870
+ */
871
+ async listApiTokens() {
872
+ return this.http.get("/api/self/api-tokens");
873
+ }
874
+ /**
875
+ * Create a new personal API token
876
+ */
877
+ async createApiToken(data) {
878
+ return this.http.post("/api/self/api-tokens", data);
879
+ }
880
+ /**
881
+ * Revoke an API token
882
+ */
883
+ async revokeApiToken(tokenId) {
884
+ await this.http.post(`/api/self/api-tokens/${tokenId}/revoke`, {});
885
+ }
886
+ /**
887
+ * Rotate an API token (revoke old, create new)
888
+ */
889
+ async rotateApiToken(tokenId) {
890
+ return this.http.post(`/api/self/api-tokens/${tokenId}/rotate`, {});
891
+ }
892
+ /**
893
+ * Delete an API token
894
+ */
895
+ async deleteApiToken(tokenId) {
896
+ await this.http.delete(`/api/self/api-tokens/${tokenId}`);
897
+ }
898
+ /**
899
+ * Change password
900
+ */
901
+ async changePassword(data) {
902
+ await this.http.put("/api/self/password", data);
903
+ }
904
+ };
905
+
906
+ // src/platform/events.ts
907
+ var EventsModule = class {
908
+ constructor(http) {
909
+ this.http = http;
910
+ }
911
+ http;
912
+ /**
913
+ * Get available event types for webhooks and notifications
914
+ */
915
+ async getOptions() {
916
+ return this.http.get("/api/event/options");
917
+ }
918
+ };
919
+
604
920
  // src/platform/client.ts
605
921
  var PlatformClient = class extends HttpClient {
606
922
  entries;
@@ -612,6 +928,14 @@ var PlatformClient = class extends HttpClient {
612
928
  workspaceMembers;
613
929
  workspaces;
614
930
  invites;
931
+ notifications;
932
+ webhooks;
933
+ user;
934
+ events;
935
+ // Admin modules
936
+ adminUsers;
937
+ adminSystem;
938
+ adminMaintenance;
615
939
  constructor(config) {
616
940
  const httpConfig = {
617
941
  baseUrl: config.apiUrl,
@@ -628,6 +952,13 @@ var PlatformClient = class extends HttpClient {
628
952
  this.workspaceMembers = new WorkspaceMembersModule(this);
629
953
  this.workspaces = new WorkspacesModule(this);
630
954
  this.invites = new InvitesModule(this);
955
+ this.notifications = new NotificationsModule(this);
956
+ this.webhooks = new WebhooksModule(this);
957
+ this.user = new UserModule(this);
958
+ this.events = new EventsModule(this);
959
+ this.adminUsers = new AdminUsersModule(this);
960
+ this.adminSystem = new AdminSystemModule(this);
961
+ this.adminMaintenance = new AdminMaintenanceModule(this);
631
962
  }
632
963
  };
633
964
  function createPlatformClient(config) {
@@ -636,13 +967,20 @@ function createPlatformClient(config) {
636
967
  // Annotate the CommonJS export names for ESM import in node:
637
968
  0 && (module.exports = {
638
969
  APIClientsModule,
970
+ AdminMaintenanceModule,
971
+ AdminSystemModule,
972
+ AdminUsersModule,
639
973
  AssetsModule,
640
974
  CollectionsModule,
641
975
  EntriesModule,
642
976
  EntryTypesModule,
977
+ EventsModule,
643
978
  InvitesModule,
979
+ NotificationsModule,
644
980
  PlatformClient,
645
981
  ResourcesModule,
982
+ UserModule,
983
+ WebhooksModule,
646
984
  WorkspaceMembersModule,
647
985
  WorkspacesModule,
648
986
  createPlatformClient