@inneropen/marvin-sdk 1.8.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
@@ -1174,6 +1174,29 @@ var AuthClient = class extends HttpClient {
1174
1174
  async resetPassword(data) {
1175
1175
  return this.post("/api/users/reset-password", data);
1176
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
+ }
1177
1200
  };
1178
1201
  function createAuthClient(apiUrl) {
1179
1202
  return new AuthClient(apiUrl);
package/dist/index.d.cts CHANGED
@@ -523,6 +523,14 @@ interface ResetPasswordRequest {
523
523
  token: string;
524
524
  newPassword: string;
525
525
  }
526
+ interface LoginRequest {
527
+ username: string;
528
+ password: string;
529
+ }
530
+ interface AuthToken {
531
+ accessToken: string;
532
+ tokenType: string;
533
+ }
526
534
  declare class AuthClient extends HttpClient {
527
535
  constructor(apiUrl: string);
528
536
  /**
@@ -544,6 +552,11 @@ declare class AuthClient extends HttpClient {
544
552
  resetPassword(data: ResetPasswordRequest): Promise<{
545
553
  message: string;
546
554
  }>;
555
+ /**
556
+ * Login with username and password
557
+ * Returns access token for authenticated requests
558
+ */
559
+ login(data: LoginRequest): Promise<AuthToken>;
547
560
  }
548
561
  /**
549
562
  * Create an Auth client for registration and password reset
@@ -570,4 +583,4 @@ declare function createAuthClient(apiUrl: string): AuthClient;
570
583
  */
571
584
  declare function createMarvinClient(config?: Partial<MarvinConfig>): MarvinClient;
572
585
 
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 };
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
@@ -523,6 +523,14 @@ interface ResetPasswordRequest {
523
523
  token: string;
524
524
  newPassword: string;
525
525
  }
526
+ interface LoginRequest {
527
+ username: string;
528
+ password: string;
529
+ }
530
+ interface AuthToken {
531
+ accessToken: string;
532
+ tokenType: string;
533
+ }
526
534
  declare class AuthClient extends HttpClient {
527
535
  constructor(apiUrl: string);
528
536
  /**
@@ -544,6 +552,11 @@ declare class AuthClient extends HttpClient {
544
552
  resetPassword(data: ResetPasswordRequest): Promise<{
545
553
  message: string;
546
554
  }>;
555
+ /**
556
+ * Login with username and password
557
+ * Returns access token for authenticated requests
558
+ */
559
+ login(data: LoginRequest): Promise<AuthToken>;
547
560
  }
548
561
  /**
549
562
  * Create an Auth client for registration and password reset
@@ -570,4 +583,4 @@ declare function createAuthClient(apiUrl: string): AuthClient;
570
583
  */
571
584
  declare function createMarvinClient(config?: Partial<MarvinConfig>): MarvinClient;
572
585
 
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 };
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
@@ -797,6 +797,29 @@ var AuthClient = class extends HttpClient {
797
797
  async resetPassword(data) {
798
798
  return this.post("/api/users/reset-password", data);
799
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
+ }
800
823
  };
801
824
  function createAuthClient(apiUrl) {
802
825
  return new AuthClient(apiUrl);
package/dist/platform.cjs CHANGED
@@ -25,6 +25,7 @@ __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,
@@ -917,6 +918,30 @@ var EventsModule = class {
917
918
  }
918
919
  };
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
+
920
945
  // src/platform/client.ts
921
946
  var PlatformClient = class extends HttpClient {
922
947
  entries;
@@ -932,6 +957,7 @@ var PlatformClient = class extends HttpClient {
932
957
  webhooks;
933
958
  user;
934
959
  events;
960
+ session;
935
961
  // Admin modules
936
962
  adminUsers;
937
963
  adminSystem;
@@ -956,6 +982,7 @@ var PlatformClient = class extends HttpClient {
956
982
  this.webhooks = new WebhooksModule(this);
957
983
  this.user = new UserModule(this);
958
984
  this.events = new EventsModule(this);
985
+ this.session = new AuthModule(this);
959
986
  this.adminUsers = new AdminUsersModule(this);
960
987
  this.adminSystem = new AdminSystemModule(this);
961
988
  this.adminMaintenance = new AdminMaintenanceModule(this);
@@ -971,6 +998,7 @@ function createPlatformClient(config) {
971
998
  AdminSystemModule,
972
999
  AdminUsersModule,
973
1000
  AssetsModule,
1001
+ AuthModule,
974
1002
  CollectionsModule,
975
1003
  EntriesModule,
976
1004
  EntryTypesModule,
@@ -3141,6 +3141,29 @@ declare class EventsModule {
3141
3141
  getOptions(): Promise<EventOption[]>;
3142
3142
  }
3143
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
+
3144
3167
  /**
3145
3168
  * Platform API Client
3146
3169
  *
@@ -3166,6 +3189,7 @@ declare class PlatformClient extends HttpClient {
3166
3189
  webhooks: WebhooksModule;
3167
3190
  user: UserModule;
3168
3191
  events: EventsModule;
3192
+ session: AuthModule;
3169
3193
  adminUsers: AdminUsersModule;
3170
3194
  adminSystem: AdminSystemModule;
3171
3195
  adminMaintenance: AdminMaintenanceModule;
@@ -3176,4 +3200,4 @@ declare class PlatformClient extends HttpClient {
3176
3200
  */
3177
3201
  declare function createPlatformClient(config: PlatformClientConfig): PlatformClient;
3178
3202
 
3179
- export { APIClientsModule, type AdminAboutInfo, AdminMaintenanceModule, AdminSystemModule, AdminUsersModule, type ApiToken, type ApiTokenCreate, type ApiTokenWithToken, AssetsModule, 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 };
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 };
@@ -3141,6 +3141,29 @@ declare class EventsModule {
3141
3141
  getOptions(): Promise<EventOption[]>;
3142
3142
  }
3143
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
+
3144
3167
  /**
3145
3168
  * Platform API Client
3146
3169
  *
@@ -3166,6 +3189,7 @@ declare class PlatformClient extends HttpClient {
3166
3189
  webhooks: WebhooksModule;
3167
3190
  user: UserModule;
3168
3191
  events: EventsModule;
3192
+ session: AuthModule;
3169
3193
  adminUsers: AdminUsersModule;
3170
3194
  adminSystem: AdminSystemModule;
3171
3195
  adminMaintenance: AdminMaintenanceModule;
@@ -3176,4 +3200,4 @@ declare class PlatformClient extends HttpClient {
3176
3200
  */
3177
3201
  declare function createPlatformClient(config: PlatformClientConfig): PlatformClient;
3178
3202
 
3179
- export { APIClientsModule, type AdminAboutInfo, AdminMaintenanceModule, AdminSystemModule, AdminUsersModule, type ApiToken, type ApiTokenCreate, type ApiTokenWithToken, AssetsModule, 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 };
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
@@ -704,6 +704,30 @@ var EventsModule = class {
704
704
  }
705
705
  };
706
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
+
707
731
  // src/platform/client.ts
708
732
  var PlatformClient = class extends HttpClient {
709
733
  entries;
@@ -719,6 +743,7 @@ var PlatformClient = class extends HttpClient {
719
743
  webhooks;
720
744
  user;
721
745
  events;
746
+ session;
722
747
  // Admin modules
723
748
  adminUsers;
724
749
  adminSystem;
@@ -743,6 +768,7 @@ var PlatformClient = class extends HttpClient {
743
768
  this.webhooks = new WebhooksModule(this);
744
769
  this.user = new UserModule(this);
745
770
  this.events = new EventsModule(this);
771
+ this.session = new AuthModule(this);
746
772
  this.adminUsers = new AdminUsersModule(this);
747
773
  this.adminSystem = new AdminSystemModule(this);
748
774
  this.adminMaintenance = new AdminMaintenanceModule(this);
@@ -757,6 +783,7 @@ export {
757
783
  AdminSystemModule,
758
784
  AdminUsersModule,
759
785
  AssetsModule,
786
+ AuthModule,
760
787
  CollectionsModule,
761
788
  EntriesModule,
762
789
  EntryTypesModule,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inneropen/marvin-sdk",
3
- "version": "1.8.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",