@inneropen/marvin-sdk 1.7.0 → 1.9.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,60 @@ 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
+ * Login with username and password
1179
+ * Returns access token for authenticated requests
1180
+ */
1181
+ async login(data) {
1182
+ const formData = new URLSearchParams();
1183
+ formData.append("username", data.username);
1184
+ formData.append("password", data.password);
1185
+ const response = await this.request(
1186
+ "POST",
1187
+ "/api/auth/token",
1188
+ {
1189
+ body: formData.toString(),
1190
+ headers: {
1191
+ "Content-Type": "application/x-www-form-urlencoded"
1192
+ }
1193
+ }
1194
+ );
1195
+ return {
1196
+ accessToken: response.access_token,
1197
+ tokenType: response.token_type
1198
+ };
1199
+ }
1200
+ };
1201
+ function createAuthClient(apiUrl) {
1202
+ return new AuthClient(apiUrl);
1203
+ }
1204
+
1205
+ // src/index.ts
1150
1206
  function createMarvinClient(config) {
1151
1207
  const { MarvinClient: MarvinClient2 } = (init_marvin(), __toCommonJS(marvin_exports));
1152
1208
  const { createConfigFromEnv: createConfigFromEnv2 } = (init_config(), __toCommonJS(config_exports));
@@ -1155,6 +1211,7 @@ function createMarvinClient(config) {
1155
1211
  }
1156
1212
  // Annotate the CommonJS export names for ESM import in node:
1157
1213
  0 && (module.exports = {
1214
+ AuthClient,
1158
1215
  BearerTokenAuth,
1159
1216
  Collection,
1160
1217
  Entry,
@@ -1170,6 +1227,7 @@ function createMarvinClient(config) {
1170
1227
  Resource,
1171
1228
  SessionAuth,
1172
1229
  Workspace,
1230
+ createAuthClient,
1173
1231
  createConfigFromEnv,
1174
1232
  createMarvinClient,
1175
1233
  createPaginatedResponse,
package/dist/index.d.cts CHANGED
@@ -504,6 +504,65 @@ 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
+ interface LoginRequest {
527
+ username: string;
528
+ password: string;
529
+ }
530
+ interface AuthToken {
531
+ accessToken: string;
532
+ tokenType: string;
533
+ }
534
+ declare class AuthClient extends HttpClient {
535
+ constructor(apiUrl: string);
536
+ /**
537
+ * Register a new user
538
+ */
539
+ register(data: UserRegistration): Promise<{
540
+ message: string;
541
+ userId: string;
542
+ }>;
543
+ /**
544
+ * Request password reset (sends email with token)
545
+ */
546
+ forgotPassword(data: ForgotPasswordRequest): Promise<{
547
+ message: string;
548
+ }>;
549
+ /**
550
+ * Reset password with token from email
551
+ */
552
+ resetPassword(data: ResetPasswordRequest): Promise<{
553
+ message: string;
554
+ }>;
555
+ /**
556
+ * Login with username and password
557
+ * Returns access token for authenticated requests
558
+ */
559
+ login(data: LoginRequest): Promise<AuthToken>;
560
+ }
561
+ /**
562
+ * Create an Auth client for registration and password reset
563
+ */
564
+ declare function createAuthClient(apiUrl: string): AuthClient;
565
+
507
566
  /**
508
567
  * Create a Marvin client instance from environment variables
509
568
  *
@@ -524,4 +583,4 @@ declare class MarvinClient {
524
583
  */
525
584
  declare function createMarvinClient(config?: Partial<MarvinConfig>): MarvinClient;
526
585
 
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 };
586
+ export { AuthClient, type AuthToken, Collection, Entry, type ForgotPasswordRequest, GetResourcesOptions$1 as GetResourcesOptions, HttpClient, type LoginRequest, 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,65 @@ 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
+ interface LoginRequest {
527
+ username: string;
528
+ password: string;
529
+ }
530
+ interface AuthToken {
531
+ accessToken: string;
532
+ tokenType: string;
533
+ }
534
+ declare class AuthClient extends HttpClient {
535
+ constructor(apiUrl: string);
536
+ /**
537
+ * Register a new user
538
+ */
539
+ register(data: UserRegistration): Promise<{
540
+ message: string;
541
+ userId: string;
542
+ }>;
543
+ /**
544
+ * Request password reset (sends email with token)
545
+ */
546
+ forgotPassword(data: ForgotPasswordRequest): Promise<{
547
+ message: string;
548
+ }>;
549
+ /**
550
+ * Reset password with token from email
551
+ */
552
+ resetPassword(data: ResetPasswordRequest): Promise<{
553
+ message: string;
554
+ }>;
555
+ /**
556
+ * Login with username and password
557
+ * Returns access token for authenticated requests
558
+ */
559
+ login(data: LoginRequest): Promise<AuthToken>;
560
+ }
561
+ /**
562
+ * Create an Auth client for registration and password reset
563
+ */
564
+ declare function createAuthClient(apiUrl: string): AuthClient;
565
+
507
566
  /**
508
567
  * Create a Marvin client instance from environment variables
509
568
  *
@@ -524,4 +583,4 @@ declare class MarvinClient {
524
583
  */
525
584
  declare function createMarvinClient(config?: Partial<MarvinConfig>): MarvinClient;
526
585
 
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 };
586
+ export { AuthClient, type AuthToken, Collection, Entry, type ForgotPasswordRequest, GetResourcesOptions$1 as GetResourcesOptions, HttpClient, type LoginRequest, 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,60 @@ 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
+ * Login with username and password
802
+ * Returns access token for authenticated requests
803
+ */
804
+ async login(data) {
805
+ const formData = new URLSearchParams();
806
+ formData.append("username", data.username);
807
+ formData.append("password", data.password);
808
+ const response = await this.request(
809
+ "POST",
810
+ "/api/auth/token",
811
+ {
812
+ body: formData.toString(),
813
+ headers: {
814
+ "Content-Type": "application/x-www-form-urlencoded"
815
+ }
816
+ }
817
+ );
818
+ return {
819
+ accessToken: response.access_token,
820
+ tokenType: response.token_type
821
+ };
822
+ }
823
+ };
824
+ function createAuthClient(apiUrl) {
825
+ return new AuthClient(apiUrl);
826
+ }
827
+
828
+ // src/index.ts
775
829
  function createMarvinClient(config) {
776
830
  const { MarvinClient: MarvinClient2 } = (init_marvin(), __toCommonJS(marvin_exports));
777
831
  const { createConfigFromEnv: createConfigFromEnv2 } = (init_config(), __toCommonJS(config_exports));
@@ -779,6 +833,7 @@ function createMarvinClient(config) {
779
833
  return new MarvinClient2(finalConfig);
780
834
  }
781
835
  export {
836
+ AuthClient,
782
837
  BearerTokenAuth,
783
838
  Collection,
784
839
  Entry,
@@ -794,6 +849,7 @@ export {
794
849
  Resource,
795
850
  SessionAuth,
796
851
  Workspace,
852
+ createAuthClient,
797
853
  createConfigFromEnv,
798
854
  createMarvinClient,
799
855
  createPaginatedResponse,
package/dist/platform.cjs CHANGED
@@ -25,13 +25,16 @@ __export(platform_exports, {
25
25
  AdminSystemModule: () => AdminSystemModule,
26
26
  AdminUsersModule: () => AdminUsersModule,
27
27
  AssetsModule: () => AssetsModule,
28
+ AuthModule: () => AuthModule,
28
29
  CollectionsModule: () => CollectionsModule,
29
30
  EntriesModule: () => EntriesModule,
30
31
  EntryTypesModule: () => EntryTypesModule,
32
+ EventsModule: () => EventsModule,
31
33
  InvitesModule: () => InvitesModule,
32
34
  NotificationsModule: () => NotificationsModule,
33
35
  PlatformClient: () => PlatformClient,
34
36
  ResourcesModule: () => ResourcesModule,
37
+ UserModule: () => UserModule,
35
38
  WebhooksModule: () => WebhooksModule,
36
39
  WorkspaceMembersModule: () => WorkspaceMembersModule,
37
40
  WorkspacesModule: () => WorkspacesModule,
@@ -851,6 +854,94 @@ var AdminMaintenanceModule = class {
851
854
  }
852
855
  };
853
856
 
857
+ // src/platform/user.ts
858
+ var UserModule = class {
859
+ constructor(http) {
860
+ this.http = http;
861
+ }
862
+ http;
863
+ /**
864
+ * Get current user profile
865
+ */
866
+ async getProfile() {
867
+ return this.http.get("/api/self");
868
+ }
869
+ /**
870
+ * List personal API tokens
871
+ */
872
+ async listApiTokens() {
873
+ return this.http.get("/api/self/api-tokens");
874
+ }
875
+ /**
876
+ * Create a new personal API token
877
+ */
878
+ async createApiToken(data) {
879
+ return this.http.post("/api/self/api-tokens", data);
880
+ }
881
+ /**
882
+ * Revoke an API token
883
+ */
884
+ async revokeApiToken(tokenId) {
885
+ await this.http.post(`/api/self/api-tokens/${tokenId}/revoke`, {});
886
+ }
887
+ /**
888
+ * Rotate an API token (revoke old, create new)
889
+ */
890
+ async rotateApiToken(tokenId) {
891
+ return this.http.post(`/api/self/api-tokens/${tokenId}/rotate`, {});
892
+ }
893
+ /**
894
+ * Delete an API token
895
+ */
896
+ async deleteApiToken(tokenId) {
897
+ await this.http.delete(`/api/self/api-tokens/${tokenId}`);
898
+ }
899
+ /**
900
+ * Change password
901
+ */
902
+ async changePassword(data) {
903
+ await this.http.put("/api/self/password", data);
904
+ }
905
+ };
906
+
907
+ // src/platform/events.ts
908
+ var EventsModule = class {
909
+ constructor(http) {
910
+ this.http = http;
911
+ }
912
+ http;
913
+ /**
914
+ * Get available event types for webhooks and notifications
915
+ */
916
+ async getOptions() {
917
+ return this.http.get("/api/event/options");
918
+ }
919
+ };
920
+
921
+ // src/platform/auth.ts
922
+ var AuthModule = class {
923
+ constructor(http) {
924
+ this.http = http;
925
+ }
926
+ http;
927
+ /**
928
+ * Refresh access token
929
+ */
930
+ async refresh() {
931
+ const response = await this.http.get("/api/auth/refresh");
932
+ return {
933
+ accessToken: response.access_token,
934
+ tokenType: response.token_type
935
+ };
936
+ }
937
+ /**
938
+ * Logout current user (clears session)
939
+ */
940
+ async logout() {
941
+ await this.http.post("/api/auth/logout", {});
942
+ }
943
+ };
944
+
854
945
  // src/platform/client.ts
855
946
  var PlatformClient = class extends HttpClient {
856
947
  entries;
@@ -864,6 +955,9 @@ var PlatformClient = class extends HttpClient {
864
955
  invites;
865
956
  notifications;
866
957
  webhooks;
958
+ user;
959
+ events;
960
+ session;
867
961
  // Admin modules
868
962
  adminUsers;
869
963
  adminSystem;
@@ -886,6 +980,9 @@ var PlatformClient = class extends HttpClient {
886
980
  this.invites = new InvitesModule(this);
887
981
  this.notifications = new NotificationsModule(this);
888
982
  this.webhooks = new WebhooksModule(this);
983
+ this.user = new UserModule(this);
984
+ this.events = new EventsModule(this);
985
+ this.session = new AuthModule(this);
889
986
  this.adminUsers = new AdminUsersModule(this);
890
987
  this.adminSystem = new AdminSystemModule(this);
891
988
  this.adminMaintenance = new AdminMaintenanceModule(this);
@@ -901,13 +998,16 @@ function createPlatformClient(config) {
901
998
  AdminSystemModule,
902
999
  AdminUsersModule,
903
1000
  AssetsModule,
1001
+ AuthModule,
904
1002
  CollectionsModule,
905
1003
  EntriesModule,
906
1004
  EntryTypesModule,
1005
+ EventsModule,
907
1006
  InvitesModule,
908
1007
  NotificationsModule,
909
1008
  PlatformClient,
910
1009
  ResourcesModule,
1010
+ UserModule,
911
1011
  WebhooksModule,
912
1012
  WorkspaceMembersModule,
913
1013
  WorkspacesModule,
@@ -3055,6 +3055,115 @@ declare class AdminMaintenanceModule {
3055
3055
  getStorage(): Promise<MaintenanceStorageDetails>;
3056
3056
  }
3057
3057
 
3058
+ /**
3059
+ * User Self-Service Module - Platform API
3060
+ *
3061
+ * User profile and personal API token management
3062
+ */
3063
+
3064
+ interface UserProfile {
3065
+ id: string;
3066
+ username: string;
3067
+ email: string;
3068
+ fullName?: string | null;
3069
+ admin: boolean;
3070
+ }
3071
+ interface ApiToken {
3072
+ id: string;
3073
+ name: string;
3074
+ description?: string | null;
3075
+ lastUsedAt?: string | null;
3076
+ createdAt: string;
3077
+ expiresAt?: string | null;
3078
+ }
3079
+ interface ApiTokenCreate {
3080
+ name: string;
3081
+ description?: string | null;
3082
+ expiresAt?: string | null;
3083
+ }
3084
+ interface ApiTokenWithToken extends ApiToken {
3085
+ token: string;
3086
+ }
3087
+ interface PasswordChange {
3088
+ currentPassword: string;
3089
+ newPassword: string;
3090
+ }
3091
+ declare class UserModule {
3092
+ private http;
3093
+ constructor(http: HttpClient);
3094
+ /**
3095
+ * Get current user profile
3096
+ */
3097
+ getProfile(): Promise<UserProfile>;
3098
+ /**
3099
+ * List personal API tokens
3100
+ */
3101
+ listApiTokens(): Promise<ApiToken[]>;
3102
+ /**
3103
+ * Create a new personal API token
3104
+ */
3105
+ createApiToken(data: ApiTokenCreate): Promise<ApiTokenWithToken>;
3106
+ /**
3107
+ * Revoke an API token
3108
+ */
3109
+ revokeApiToken(tokenId: string): Promise<void>;
3110
+ /**
3111
+ * Rotate an API token (revoke old, create new)
3112
+ */
3113
+ rotateApiToken(tokenId: string): Promise<ApiTokenWithToken>;
3114
+ /**
3115
+ * Delete an API token
3116
+ */
3117
+ deleteApiToken(tokenId: string): Promise<void>;
3118
+ /**
3119
+ * Change password
3120
+ */
3121
+ changePassword(data: PasswordChange): Promise<void>;
3122
+ }
3123
+
3124
+ /**
3125
+ * Events Module - Platform API
3126
+ *
3127
+ * Event type information for webhooks and notifications
3128
+ */
3129
+
3130
+ interface EventOption {
3131
+ value: string;
3132
+ label: string;
3133
+ description?: string;
3134
+ }
3135
+ declare class EventsModule {
3136
+ private http;
3137
+ constructor(http: HttpClient);
3138
+ /**
3139
+ * Get available event types for webhooks and notifications
3140
+ */
3141
+ getOptions(): Promise<EventOption[]>;
3142
+ }
3143
+
3144
+ /**
3145
+ * Auth Module - Platform API
3146
+ *
3147
+ * Authenticated session management (logout, refresh)
3148
+ */
3149
+
3150
+ interface AuthToken {
3151
+ accessToken: string;
3152
+ tokenType: string;
3153
+ }
3154
+ declare class AuthModule {
3155
+ private http;
3156
+ constructor(http: HttpClient);
3157
+ /**
3158
+ * Refresh access token
3159
+ */
3160
+ refresh(): Promise<AuthToken>;
3161
+ /**
3162
+ * Logout current user (clears session)
3163
+ */
3164
+ logout(): Promise<void>;
3165
+ }
3166
+
3058
3167
  /**
3059
3168
  * Platform API Client
3060
3169
  *
@@ -3078,6 +3187,9 @@ declare class PlatformClient extends HttpClient {
3078
3187
  invites: InvitesModule;
3079
3188
  notifications: NotificationsModule;
3080
3189
  webhooks: WebhooksModule;
3190
+ user: UserModule;
3191
+ events: EventsModule;
3192
+ session: AuthModule;
3081
3193
  adminUsers: AdminUsersModule;
3082
3194
  adminSystem: AdminSystemModule;
3083
3195
  adminMaintenance: AdminMaintenanceModule;
@@ -3088,4 +3200,4 @@ declare class PlatformClient extends HttpClient {
3088
3200
  */
3089
3201
  declare function createPlatformClient(config: PlatformClientConfig): PlatformClient;
3090
3202
 
3091
- export { APIClientsModule, type AdminAboutInfo, AdminMaintenanceModule, AdminSystemModule, AdminUsersModule, AssetsModule, CollectionsModule, type EmailInvitationRequest, type EmailSettings, EntriesModule, EntryTypesModule, type InviteTokenCreate, type InviteTokenPagination, type InviteTokenSummary, InvitesModule, type MaintenanceStorageDetails, type MaintenanceSummary, type Notification, type NotificationCreate, type NotificationUpdate, NotificationsModule, type PasswordResetTokenRequest, type PasswordResetTokenResponse, 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 SystemStatistics, type UnlockUserRequest, type User, type UserCreate, type UserPagination, type UserSummary, type UserUpdate, type Webhook, type WebhookCreate, type WebhookMethod, type WebhookPagination, type WebhookUpdate, WebhooksModule, type Workspace, type WorkspaceActivationRequest, type WorkspaceCreate, WorkspaceMembersModule, type WorkspacePreferences, type WorkspacePreferencesUpdate, type WorkspaceUpdate, type WorkspaceWithMembership, WorkspacesModule, createPlatformClient };
3203
+ export { APIClientsModule, type AdminAboutInfo, AdminMaintenanceModule, AdminSystemModule, AdminUsersModule, type ApiToken, type ApiTokenCreate, type ApiTokenWithToken, AssetsModule, AuthModule, type AuthToken, CollectionsModule, type EmailInvitationRequest, type EmailSettings, EntriesModule, EntryTypesModule, type EventOption, EventsModule, type InviteTokenCreate, type InviteTokenPagination, type InviteTokenSummary, InvitesModule, type MaintenanceStorageDetails, type MaintenanceSummary, type Notification, type NotificationCreate, type NotificationUpdate, NotificationsModule, type PasswordChange, type PasswordResetTokenRequest, type PasswordResetTokenResponse, 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 SystemStatistics, type UnlockUserRequest, type User, type UserCreate, UserModule, type UserPagination, type UserProfile, type UserSummary, type UserUpdate, type Webhook, type WebhookCreate, type WebhookMethod, type WebhookPagination, type WebhookUpdate, WebhooksModule, type Workspace, type WorkspaceActivationRequest, type WorkspaceCreate, WorkspaceMembersModule, type WorkspacePreferences, type WorkspacePreferencesUpdate, type WorkspaceUpdate, type WorkspaceWithMembership, WorkspacesModule, createPlatformClient };
@@ -3055,6 +3055,115 @@ declare class AdminMaintenanceModule {
3055
3055
  getStorage(): Promise<MaintenanceStorageDetails>;
3056
3056
  }
3057
3057
 
3058
+ /**
3059
+ * User Self-Service Module - Platform API
3060
+ *
3061
+ * User profile and personal API token management
3062
+ */
3063
+
3064
+ interface UserProfile {
3065
+ id: string;
3066
+ username: string;
3067
+ email: string;
3068
+ fullName?: string | null;
3069
+ admin: boolean;
3070
+ }
3071
+ interface ApiToken {
3072
+ id: string;
3073
+ name: string;
3074
+ description?: string | null;
3075
+ lastUsedAt?: string | null;
3076
+ createdAt: string;
3077
+ expiresAt?: string | null;
3078
+ }
3079
+ interface ApiTokenCreate {
3080
+ name: string;
3081
+ description?: string | null;
3082
+ expiresAt?: string | null;
3083
+ }
3084
+ interface ApiTokenWithToken extends ApiToken {
3085
+ token: string;
3086
+ }
3087
+ interface PasswordChange {
3088
+ currentPassword: string;
3089
+ newPassword: string;
3090
+ }
3091
+ declare class UserModule {
3092
+ private http;
3093
+ constructor(http: HttpClient);
3094
+ /**
3095
+ * Get current user profile
3096
+ */
3097
+ getProfile(): Promise<UserProfile>;
3098
+ /**
3099
+ * List personal API tokens
3100
+ */
3101
+ listApiTokens(): Promise<ApiToken[]>;
3102
+ /**
3103
+ * Create a new personal API token
3104
+ */
3105
+ createApiToken(data: ApiTokenCreate): Promise<ApiTokenWithToken>;
3106
+ /**
3107
+ * Revoke an API token
3108
+ */
3109
+ revokeApiToken(tokenId: string): Promise<void>;
3110
+ /**
3111
+ * Rotate an API token (revoke old, create new)
3112
+ */
3113
+ rotateApiToken(tokenId: string): Promise<ApiTokenWithToken>;
3114
+ /**
3115
+ * Delete an API token
3116
+ */
3117
+ deleteApiToken(tokenId: string): Promise<void>;
3118
+ /**
3119
+ * Change password
3120
+ */
3121
+ changePassword(data: PasswordChange): Promise<void>;
3122
+ }
3123
+
3124
+ /**
3125
+ * Events Module - Platform API
3126
+ *
3127
+ * Event type information for webhooks and notifications
3128
+ */
3129
+
3130
+ interface EventOption {
3131
+ value: string;
3132
+ label: string;
3133
+ description?: string;
3134
+ }
3135
+ declare class EventsModule {
3136
+ private http;
3137
+ constructor(http: HttpClient);
3138
+ /**
3139
+ * Get available event types for webhooks and notifications
3140
+ */
3141
+ getOptions(): Promise<EventOption[]>;
3142
+ }
3143
+
3144
+ /**
3145
+ * Auth Module - Platform API
3146
+ *
3147
+ * Authenticated session management (logout, refresh)
3148
+ */
3149
+
3150
+ interface AuthToken {
3151
+ accessToken: string;
3152
+ tokenType: string;
3153
+ }
3154
+ declare class AuthModule {
3155
+ private http;
3156
+ constructor(http: HttpClient);
3157
+ /**
3158
+ * Refresh access token
3159
+ */
3160
+ refresh(): Promise<AuthToken>;
3161
+ /**
3162
+ * Logout current user (clears session)
3163
+ */
3164
+ logout(): Promise<void>;
3165
+ }
3166
+
3058
3167
  /**
3059
3168
  * Platform API Client
3060
3169
  *
@@ -3078,6 +3187,9 @@ declare class PlatformClient extends HttpClient {
3078
3187
  invites: InvitesModule;
3079
3188
  notifications: NotificationsModule;
3080
3189
  webhooks: WebhooksModule;
3190
+ user: UserModule;
3191
+ events: EventsModule;
3192
+ session: AuthModule;
3081
3193
  adminUsers: AdminUsersModule;
3082
3194
  adminSystem: AdminSystemModule;
3083
3195
  adminMaintenance: AdminMaintenanceModule;
@@ -3088,4 +3200,4 @@ declare class PlatformClient extends HttpClient {
3088
3200
  */
3089
3201
  declare function createPlatformClient(config: PlatformClientConfig): PlatformClient;
3090
3202
 
3091
- export { APIClientsModule, type AdminAboutInfo, AdminMaintenanceModule, AdminSystemModule, AdminUsersModule, AssetsModule, CollectionsModule, type EmailInvitationRequest, type EmailSettings, EntriesModule, EntryTypesModule, type InviteTokenCreate, type InviteTokenPagination, type InviteTokenSummary, InvitesModule, type MaintenanceStorageDetails, type MaintenanceSummary, type Notification, type NotificationCreate, type NotificationUpdate, NotificationsModule, type PasswordResetTokenRequest, type PasswordResetTokenResponse, 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 SystemStatistics, type UnlockUserRequest, type User, type UserCreate, type UserPagination, type UserSummary, type UserUpdate, type Webhook, type WebhookCreate, type WebhookMethod, type WebhookPagination, type WebhookUpdate, WebhooksModule, type Workspace, type WorkspaceActivationRequest, type WorkspaceCreate, WorkspaceMembersModule, type WorkspacePreferences, type WorkspacePreferencesUpdate, type WorkspaceUpdate, type WorkspaceWithMembership, WorkspacesModule, createPlatformClient };
3203
+ export { APIClientsModule, type AdminAboutInfo, AdminMaintenanceModule, AdminSystemModule, AdminUsersModule, type ApiToken, type ApiTokenCreate, type ApiTokenWithToken, AssetsModule, AuthModule, type AuthToken, CollectionsModule, type EmailInvitationRequest, type EmailSettings, EntriesModule, EntryTypesModule, type EventOption, EventsModule, type InviteTokenCreate, type InviteTokenPagination, type InviteTokenSummary, InvitesModule, type MaintenanceStorageDetails, type MaintenanceSummary, type Notification, type NotificationCreate, type NotificationUpdate, NotificationsModule, type PasswordChange, type PasswordResetTokenRequest, type PasswordResetTokenResponse, 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 SystemStatistics, type UnlockUserRequest, type User, type UserCreate, UserModule, type UserPagination, type UserProfile, type UserSummary, type UserUpdate, type Webhook, type WebhookCreate, type WebhookMethod, type WebhookPagination, type WebhookUpdate, WebhooksModule, type Workspace, type WorkspaceActivationRequest, type WorkspaceCreate, WorkspaceMembersModule, type WorkspacePreferences, type WorkspacePreferencesUpdate, type WorkspaceUpdate, type WorkspaceWithMembership, WorkspacesModule, createPlatformClient };
package/dist/platform.js CHANGED
@@ -640,6 +640,94 @@ var AdminMaintenanceModule = class {
640
640
  }
641
641
  };
642
642
 
643
+ // src/platform/user.ts
644
+ var UserModule = class {
645
+ constructor(http) {
646
+ this.http = http;
647
+ }
648
+ http;
649
+ /**
650
+ * Get current user profile
651
+ */
652
+ async getProfile() {
653
+ return this.http.get("/api/self");
654
+ }
655
+ /**
656
+ * List personal API tokens
657
+ */
658
+ async listApiTokens() {
659
+ return this.http.get("/api/self/api-tokens");
660
+ }
661
+ /**
662
+ * Create a new personal API token
663
+ */
664
+ async createApiToken(data) {
665
+ return this.http.post("/api/self/api-tokens", data);
666
+ }
667
+ /**
668
+ * Revoke an API token
669
+ */
670
+ async revokeApiToken(tokenId) {
671
+ await this.http.post(`/api/self/api-tokens/${tokenId}/revoke`, {});
672
+ }
673
+ /**
674
+ * Rotate an API token (revoke old, create new)
675
+ */
676
+ async rotateApiToken(tokenId) {
677
+ return this.http.post(`/api/self/api-tokens/${tokenId}/rotate`, {});
678
+ }
679
+ /**
680
+ * Delete an API token
681
+ */
682
+ async deleteApiToken(tokenId) {
683
+ await this.http.delete(`/api/self/api-tokens/${tokenId}`);
684
+ }
685
+ /**
686
+ * Change password
687
+ */
688
+ async changePassword(data) {
689
+ await this.http.put("/api/self/password", data);
690
+ }
691
+ };
692
+
693
+ // src/platform/events.ts
694
+ var EventsModule = class {
695
+ constructor(http) {
696
+ this.http = http;
697
+ }
698
+ http;
699
+ /**
700
+ * Get available event types for webhooks and notifications
701
+ */
702
+ async getOptions() {
703
+ return this.http.get("/api/event/options");
704
+ }
705
+ };
706
+
707
+ // src/platform/auth.ts
708
+ var AuthModule = class {
709
+ constructor(http) {
710
+ this.http = http;
711
+ }
712
+ http;
713
+ /**
714
+ * Refresh access token
715
+ */
716
+ async refresh() {
717
+ const response = await this.http.get("/api/auth/refresh");
718
+ return {
719
+ accessToken: response.access_token,
720
+ tokenType: response.token_type
721
+ };
722
+ }
723
+ /**
724
+ * Logout current user (clears session)
725
+ */
726
+ async logout() {
727
+ await this.http.post("/api/auth/logout", {});
728
+ }
729
+ };
730
+
643
731
  // src/platform/client.ts
644
732
  var PlatformClient = class extends HttpClient {
645
733
  entries;
@@ -653,6 +741,9 @@ var PlatformClient = class extends HttpClient {
653
741
  invites;
654
742
  notifications;
655
743
  webhooks;
744
+ user;
745
+ events;
746
+ session;
656
747
  // Admin modules
657
748
  adminUsers;
658
749
  adminSystem;
@@ -675,6 +766,9 @@ var PlatformClient = class extends HttpClient {
675
766
  this.invites = new InvitesModule(this);
676
767
  this.notifications = new NotificationsModule(this);
677
768
  this.webhooks = new WebhooksModule(this);
769
+ this.user = new UserModule(this);
770
+ this.events = new EventsModule(this);
771
+ this.session = new AuthModule(this);
678
772
  this.adminUsers = new AdminUsersModule(this);
679
773
  this.adminSystem = new AdminSystemModule(this);
680
774
  this.adminMaintenance = new AdminMaintenanceModule(this);
@@ -689,13 +783,16 @@ export {
689
783
  AdminSystemModule,
690
784
  AdminUsersModule,
691
785
  AssetsModule,
786
+ AuthModule,
692
787
  CollectionsModule,
693
788
  EntriesModule,
694
789
  EntryTypesModule,
790
+ EventsModule,
695
791
  InvitesModule,
696
792
  NotificationsModule,
697
793
  PlatformClient,
698
794
  ResourcesModule,
795
+ UserModule,
699
796
  WebhooksModule,
700
797
  WorkspaceMembersModule,
701
798
  WorkspacesModule,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inneropen/marvin-sdk",
3
- "version": "1.7.0",
3
+ "version": "1.9.0",
4
4
  "description": "Official TypeScript SDK for Marvin CMS",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",