@scalemule/nextjs 0.0.5 → 0.0.7
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/client.d.mts +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/client.js +2 -4
- package/dist/client.mjs +2 -4
- package/dist/{index-9v0SaLgg.d.mts → index-jomBa89d.d.mts} +2 -2
- package/dist/{index-9v0SaLgg.d.ts → index-jomBa89d.d.ts} +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +25 -9
- package/dist/index.mjs +25 -9
- package/dist/server/auth.js +8 -2
- package/dist/server/auth.mjs +8 -2
- package/dist/server/index.d.mts +3 -3
- package/dist/server/index.d.ts +3 -3
- package/dist/server/index.js +8 -2
- package/dist/server/index.mjs +8 -2
- package/dist/server/webhook-handler.d.mts +2 -2
- package/dist/server/webhook-handler.d.ts +2 -2
- package/dist/testing.d.mts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/{webhook-handler-Ymeice_x.d.ts → webhook-handler-BKhYMJ9A.d.ts} +1 -1
- package/dist/{webhook-handler-DCSwldKC.d.mts → webhook-handler-B_S2RgMO.d.mts} +1 -1
- package/package.json +1 -1
package/dist/client.d.mts
CHANGED
package/dist/client.d.ts
CHANGED
package/dist/client.js
CHANGED
|
@@ -482,10 +482,8 @@ var ScaleMuleClient = class {
|
|
|
482
482
|
} catch {
|
|
483
483
|
}
|
|
484
484
|
if (!response.ok) {
|
|
485
|
-
const
|
|
486
|
-
|
|
487
|
-
message: responseData?.message || text || response.statusText
|
|
488
|
-
};
|
|
485
|
+
const rawError = responseData?.error;
|
|
486
|
+
const error = rawError && typeof rawError === "object" ? rawError : { code: `HTTP_${response.status}`, message: typeof rawError === "string" ? rawError : responseData?.message || text || response.statusText };
|
|
489
487
|
if (attempt < maxRetries && RETRYABLE_STATUS_CODES.has(response.status)) {
|
|
490
488
|
lastError = error;
|
|
491
489
|
const delay = getBackoffDelay(attempt);
|
package/dist/client.mjs
CHANGED
|
@@ -480,10 +480,8 @@ var ScaleMuleClient = class {
|
|
|
480
480
|
} catch {
|
|
481
481
|
}
|
|
482
482
|
if (!response.ok) {
|
|
483
|
-
const
|
|
484
|
-
|
|
485
|
-
message: responseData?.message || text || response.statusText
|
|
486
|
-
};
|
|
483
|
+
const rawError = responseData?.error;
|
|
484
|
+
const error = rawError && typeof rawError === "object" ? rawError : { code: `HTTP_${response.status}`, message: typeof rawError === "string" ? rawError : responseData?.message || text || response.statusText };
|
|
487
485
|
if (attempt < maxRetries && RETRYABLE_STATUS_CODES.has(response.status)) {
|
|
488
486
|
lastError = error;
|
|
489
487
|
const delay = getBackoffDelay(attempt);
|
|
@@ -412,8 +412,8 @@ interface UseAuthReturn {
|
|
|
412
412
|
resetPassword: (token: string, newPassword: string) => Promise<void>;
|
|
413
413
|
/** Verify email with token */
|
|
414
414
|
verifyEmail: (token: string) => Promise<void>;
|
|
415
|
-
/** Resend verification email */
|
|
416
|
-
resendVerification: () => Promise<void>;
|
|
415
|
+
/** Resend verification email (optional email for unauthenticated resend) */
|
|
416
|
+
resendVerification: (email?: string) => Promise<void>;
|
|
417
417
|
/** Refresh session token */
|
|
418
418
|
refreshSession: () => Promise<void>;
|
|
419
419
|
/** Start OAuth flow for a provider */
|
|
@@ -412,8 +412,8 @@ interface UseAuthReturn {
|
|
|
412
412
|
resetPassword: (token: string, newPassword: string) => Promise<void>;
|
|
413
413
|
/** Verify email with token */
|
|
414
414
|
verifyEmail: (token: string) => Promise<void>;
|
|
415
|
-
/** Resend verification email */
|
|
416
|
-
resendVerification: () => Promise<void>;
|
|
415
|
+
/** Resend verification email (optional email for unauthenticated resend) */
|
|
416
|
+
resendVerification: (email?: string) => Promise<void>;
|
|
417
417
|
/** Refresh session token */
|
|
418
418
|
refreshSession: () => Promise<void>;
|
|
419
419
|
/** Start OAuth flow for a provider */
|
package/dist/index.d.mts
CHANGED
|
@@ -2,8 +2,8 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
import { ScaleMuleClient } from './client.mjs';
|
|
4
4
|
export { ClientConfig, RequestOptions, createClient } from './client.mjs';
|
|
5
|
-
import { S as ScaleMuleConfig, U as User, L as LoginResponse, A as ApiError, a as UseAuthReturn, b as UseBillingReturn, c as ListFilesParams, d as UseContentReturn, e as UseUserReturn, f as UseAnalyticsOptions, g as UseAnalyticsReturn } from './index-
|
|
6
|
-
export { a2 as AccountBalance, a9 as AnalyticsEvent, k as ApiResponse, af as BatchTrackRequest, a3 as BillingPayment, a5 as BillingPayout, a4 as BillingRefund, a7 as BillingTransaction, r as ChangeEmailRequest, C as ChangePasswordRequest, $ as ClientContext, a1 as ConnectedAccount, D as DeviceFingerprint, ac as DeviceInfo, ad as EnhancedAnalyticsEvent, F as ForgotPasswordRequest, x as LinkedAccount, T as ListFilesResponse, n as LoginDeviceInfo, l as LoginRequest, m as LoginResponseWithMFA, o as LoginRiskInfo, G as MFAChallengeResponse, M as MFAMethod, B as MFASMSSetupResponse, y as MFASetupRequest, H as MFAStatus, z as MFATOTPSetupResponse, E as MFAVerifyRequest, v as OAuthCallbackRequest, w as OAuthCallbackResponse, t as OAuthConfig, O as OAuthProvider, u as OAuthStartResponse, aa as PageViewData, a6 as PayoutSchedule, K as PhoneLoginRequest, I as PhoneSendCodeRequest, J as PhoneVerifyRequest, P as Profile, p as RefreshResponse, R as RegisterRequest, q as ResetPasswordRequest, h as ScaleMuleApiError, i as ScaleMuleEnvironment, s as Session, _ as SignedUploadCompleteRequest, Y as SignedUploadRequest, Z as SignedUploadResponse, X as SignedUploadUrl, j as StorageAdapter, N as StorageFile, ae as TrackEventResponse, a8 as TransactionSummary, ab as UTMParams, a0 as UpdateProfileRequest, Q as UploadOptions, W as UploadResponse, V as VerifyEmailRequest } from './index-
|
|
5
|
+
import { S as ScaleMuleConfig, U as User, L as LoginResponse, A as ApiError, a as UseAuthReturn, b as UseBillingReturn, c as ListFilesParams, d as UseContentReturn, e as UseUserReturn, f as UseAnalyticsOptions, g as UseAnalyticsReturn } from './index-jomBa89d.mjs';
|
|
6
|
+
export { a2 as AccountBalance, a9 as AnalyticsEvent, k as ApiResponse, af as BatchTrackRequest, a3 as BillingPayment, a5 as BillingPayout, a4 as BillingRefund, a7 as BillingTransaction, r as ChangeEmailRequest, C as ChangePasswordRequest, $ as ClientContext, a1 as ConnectedAccount, D as DeviceFingerprint, ac as DeviceInfo, ad as EnhancedAnalyticsEvent, F as ForgotPasswordRequest, x as LinkedAccount, T as ListFilesResponse, n as LoginDeviceInfo, l as LoginRequest, m as LoginResponseWithMFA, o as LoginRiskInfo, G as MFAChallengeResponse, M as MFAMethod, B as MFASMSSetupResponse, y as MFASetupRequest, H as MFAStatus, z as MFATOTPSetupResponse, E as MFAVerifyRequest, v as OAuthCallbackRequest, w as OAuthCallbackResponse, t as OAuthConfig, O as OAuthProvider, u as OAuthStartResponse, aa as PageViewData, a6 as PayoutSchedule, K as PhoneLoginRequest, I as PhoneSendCodeRequest, J as PhoneVerifyRequest, P as Profile, p as RefreshResponse, R as RegisterRequest, q as ResetPasswordRequest, h as ScaleMuleApiError, i as ScaleMuleEnvironment, s as Session, _ as SignedUploadCompleteRequest, Y as SignedUploadRequest, Z as SignedUploadResponse, X as SignedUploadUrl, j as StorageAdapter, N as StorageFile, ae as TrackEventResponse, a8 as TransactionSummary, ab as UTMParams, a0 as UpdateProfileRequest, Q as UploadOptions, W as UploadResponse, V as VerifyEmailRequest } from './index-jomBa89d.mjs';
|
|
7
7
|
|
|
8
8
|
interface ScaleMuleContextValue {
|
|
9
9
|
/** The API client instance */
|
package/dist/index.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
import { ScaleMuleClient } from './client.js';
|
|
4
4
|
export { ClientConfig, RequestOptions, createClient } from './client.js';
|
|
5
|
-
import { S as ScaleMuleConfig, U as User, L as LoginResponse, A as ApiError, a as UseAuthReturn, b as UseBillingReturn, c as ListFilesParams, d as UseContentReturn, e as UseUserReturn, f as UseAnalyticsOptions, g as UseAnalyticsReturn } from './index-
|
|
6
|
-
export { a2 as AccountBalance, a9 as AnalyticsEvent, k as ApiResponse, af as BatchTrackRequest, a3 as BillingPayment, a5 as BillingPayout, a4 as BillingRefund, a7 as BillingTransaction, r as ChangeEmailRequest, C as ChangePasswordRequest, $ as ClientContext, a1 as ConnectedAccount, D as DeviceFingerprint, ac as DeviceInfo, ad as EnhancedAnalyticsEvent, F as ForgotPasswordRequest, x as LinkedAccount, T as ListFilesResponse, n as LoginDeviceInfo, l as LoginRequest, m as LoginResponseWithMFA, o as LoginRiskInfo, G as MFAChallengeResponse, M as MFAMethod, B as MFASMSSetupResponse, y as MFASetupRequest, H as MFAStatus, z as MFATOTPSetupResponse, E as MFAVerifyRequest, v as OAuthCallbackRequest, w as OAuthCallbackResponse, t as OAuthConfig, O as OAuthProvider, u as OAuthStartResponse, aa as PageViewData, a6 as PayoutSchedule, K as PhoneLoginRequest, I as PhoneSendCodeRequest, J as PhoneVerifyRequest, P as Profile, p as RefreshResponse, R as RegisterRequest, q as ResetPasswordRequest, h as ScaleMuleApiError, i as ScaleMuleEnvironment, s as Session, _ as SignedUploadCompleteRequest, Y as SignedUploadRequest, Z as SignedUploadResponse, X as SignedUploadUrl, j as StorageAdapter, N as StorageFile, ae as TrackEventResponse, a8 as TransactionSummary, ab as UTMParams, a0 as UpdateProfileRequest, Q as UploadOptions, W as UploadResponse, V as VerifyEmailRequest } from './index-
|
|
5
|
+
import { S as ScaleMuleConfig, U as User, L as LoginResponse, A as ApiError, a as UseAuthReturn, b as UseBillingReturn, c as ListFilesParams, d as UseContentReturn, e as UseUserReturn, f as UseAnalyticsOptions, g as UseAnalyticsReturn } from './index-jomBa89d.js';
|
|
6
|
+
export { a2 as AccountBalance, a9 as AnalyticsEvent, k as ApiResponse, af as BatchTrackRequest, a3 as BillingPayment, a5 as BillingPayout, a4 as BillingRefund, a7 as BillingTransaction, r as ChangeEmailRequest, C as ChangePasswordRequest, $ as ClientContext, a1 as ConnectedAccount, D as DeviceFingerprint, ac as DeviceInfo, ad as EnhancedAnalyticsEvent, F as ForgotPasswordRequest, x as LinkedAccount, T as ListFilesResponse, n as LoginDeviceInfo, l as LoginRequest, m as LoginResponseWithMFA, o as LoginRiskInfo, G as MFAChallengeResponse, M as MFAMethod, B as MFASMSSetupResponse, y as MFASetupRequest, H as MFAStatus, z as MFATOTPSetupResponse, E as MFAVerifyRequest, v as OAuthCallbackRequest, w as OAuthCallbackResponse, t as OAuthConfig, O as OAuthProvider, u as OAuthStartResponse, aa as PageViewData, a6 as PayoutSchedule, K as PhoneLoginRequest, I as PhoneSendCodeRequest, J as PhoneVerifyRequest, P as Profile, p as RefreshResponse, R as RegisterRequest, q as ResetPasswordRequest, h as ScaleMuleApiError, i as ScaleMuleEnvironment, s as Session, _ as SignedUploadCompleteRequest, Y as SignedUploadRequest, Z as SignedUploadResponse, X as SignedUploadUrl, j as StorageAdapter, N as StorageFile, ae as TrackEventResponse, a8 as TransactionSummary, ab as UTMParams, a0 as UpdateProfileRequest, Q as UploadOptions, W as UploadResponse, V as VerifyEmailRequest } from './index-jomBa89d.js';
|
|
7
7
|
|
|
8
8
|
interface ScaleMuleContextValue {
|
|
9
9
|
/** The API client instance */
|
package/dist/index.js
CHANGED
|
@@ -487,10 +487,8 @@ var ScaleMuleClient = class {
|
|
|
487
487
|
} catch {
|
|
488
488
|
}
|
|
489
489
|
if (!response.ok) {
|
|
490
|
-
const
|
|
491
|
-
|
|
492
|
-
message: responseData?.message || text || response.statusText
|
|
493
|
-
};
|
|
490
|
+
const rawError = responseData?.error;
|
|
491
|
+
const error = rawError && typeof rawError === "object" ? rawError : { code: `HTTP_${response.status}`, message: typeof rawError === "string" ? rawError : responseData?.message || text || response.statusText };
|
|
494
492
|
if (attempt < maxRetries && RETRYABLE_STATUS_CODES.has(response.status)) {
|
|
495
493
|
lastError = error;
|
|
496
494
|
const delay = getBackoffDelay(attempt);
|
|
@@ -963,6 +961,9 @@ function useAuth() {
|
|
|
963
961
|
setError(err);
|
|
964
962
|
throw err;
|
|
965
963
|
}
|
|
964
|
+
if (response.data.sessionToken) {
|
|
965
|
+
await client.setSession(response.data.sessionToken, response.data.userId || response.data.user?.id || "");
|
|
966
|
+
}
|
|
966
967
|
return response.data.user;
|
|
967
968
|
}
|
|
968
969
|
try {
|
|
@@ -1001,6 +1002,11 @@ function useAuth() {
|
|
|
1001
1002
|
if (responseUser) {
|
|
1002
1003
|
setUser(responseUser);
|
|
1003
1004
|
}
|
|
1005
|
+
const sessionToken = "sessionToken" in loginData2 ? loginData2.sessionToken : void 0;
|
|
1006
|
+
const userId = "userId" in loginData2 ? loginData2.userId : void 0;
|
|
1007
|
+
if (sessionToken) {
|
|
1008
|
+
await client.setSession(sessionToken, userId || responseUser?.id || "");
|
|
1009
|
+
}
|
|
1004
1010
|
return response.data;
|
|
1005
1011
|
}
|
|
1006
1012
|
let loginResult;
|
|
@@ -1134,10 +1140,11 @@ function useAuth() {
|
|
|
1134
1140
|
},
|
|
1135
1141
|
[client, user, setUser, setError, authProxyUrl]
|
|
1136
1142
|
);
|
|
1137
|
-
const resendVerification = react.useCallback(async () => {
|
|
1143
|
+
const resendVerification = react.useCallback(async (email) => {
|
|
1138
1144
|
setError(null);
|
|
1139
1145
|
if (authProxyUrl) {
|
|
1140
|
-
const
|
|
1146
|
+
const body = email ? { email } : user ? {} : void 0;
|
|
1147
|
+
const response = await proxyFetch(authProxyUrl, "resend-verification", { body });
|
|
1141
1148
|
if (!response.success) {
|
|
1142
1149
|
const err = response.error || {
|
|
1143
1150
|
code: "RESEND_FAILED",
|
|
@@ -1147,15 +1154,19 @@ function useAuth() {
|
|
|
1147
1154
|
throw err;
|
|
1148
1155
|
}
|
|
1149
1156
|
} else {
|
|
1150
|
-
if (!user) {
|
|
1157
|
+
if (!user && !email) {
|
|
1151
1158
|
const err = {
|
|
1152
1159
|
code: "NOT_AUTHENTICATED",
|
|
1153
|
-
message: "Must be logged in to resend verification"
|
|
1160
|
+
message: "Must be logged in or provide email to resend verification"
|
|
1154
1161
|
};
|
|
1155
1162
|
throw err;
|
|
1156
1163
|
}
|
|
1157
1164
|
try {
|
|
1158
|
-
|
|
1165
|
+
if (email && !user) {
|
|
1166
|
+
await client.post("/v1/auth/resend-verification", { email });
|
|
1167
|
+
} else {
|
|
1168
|
+
await client.post("/v1/auth/resend-verification");
|
|
1169
|
+
}
|
|
1159
1170
|
} catch (err) {
|
|
1160
1171
|
if (err instanceof ScaleMuleApiError) {
|
|
1161
1172
|
setError(err);
|
|
@@ -1506,6 +1517,11 @@ function useAuth() {
|
|
|
1506
1517
|
if (responseUser) {
|
|
1507
1518
|
setUser(responseUser);
|
|
1508
1519
|
}
|
|
1520
|
+
const sessionToken = "sessionToken" in loginData ? loginData.sessionToken : void 0;
|
|
1521
|
+
const userId = "userId" in loginData ? loginData.userId : void 0;
|
|
1522
|
+
if (sessionToken) {
|
|
1523
|
+
await client.setSession(sessionToken, userId || responseUser?.id || "");
|
|
1524
|
+
}
|
|
1509
1525
|
return response.data;
|
|
1510
1526
|
}
|
|
1511
1527
|
let phoneLoginData;
|
package/dist/index.mjs
CHANGED
|
@@ -485,10 +485,8 @@ var ScaleMuleClient = class {
|
|
|
485
485
|
} catch {
|
|
486
486
|
}
|
|
487
487
|
if (!response.ok) {
|
|
488
|
-
const
|
|
489
|
-
|
|
490
|
-
message: responseData?.message || text || response.statusText
|
|
491
|
-
};
|
|
488
|
+
const rawError = responseData?.error;
|
|
489
|
+
const error = rawError && typeof rawError === "object" ? rawError : { code: `HTTP_${response.status}`, message: typeof rawError === "string" ? rawError : responseData?.message || text || response.statusText };
|
|
492
490
|
if (attempt < maxRetries && RETRYABLE_STATUS_CODES.has(response.status)) {
|
|
493
491
|
lastError = error;
|
|
494
492
|
const delay = getBackoffDelay(attempt);
|
|
@@ -961,6 +959,9 @@ function useAuth() {
|
|
|
961
959
|
setError(err);
|
|
962
960
|
throw err;
|
|
963
961
|
}
|
|
962
|
+
if (response.data.sessionToken) {
|
|
963
|
+
await client.setSession(response.data.sessionToken, response.data.userId || response.data.user?.id || "");
|
|
964
|
+
}
|
|
964
965
|
return response.data.user;
|
|
965
966
|
}
|
|
966
967
|
try {
|
|
@@ -999,6 +1000,11 @@ function useAuth() {
|
|
|
999
1000
|
if (responseUser) {
|
|
1000
1001
|
setUser(responseUser);
|
|
1001
1002
|
}
|
|
1003
|
+
const sessionToken = "sessionToken" in loginData2 ? loginData2.sessionToken : void 0;
|
|
1004
|
+
const userId = "userId" in loginData2 ? loginData2.userId : void 0;
|
|
1005
|
+
if (sessionToken) {
|
|
1006
|
+
await client.setSession(sessionToken, userId || responseUser?.id || "");
|
|
1007
|
+
}
|
|
1002
1008
|
return response.data;
|
|
1003
1009
|
}
|
|
1004
1010
|
let loginResult;
|
|
@@ -1132,10 +1138,11 @@ function useAuth() {
|
|
|
1132
1138
|
},
|
|
1133
1139
|
[client, user, setUser, setError, authProxyUrl]
|
|
1134
1140
|
);
|
|
1135
|
-
const resendVerification = useCallback(async () => {
|
|
1141
|
+
const resendVerification = useCallback(async (email) => {
|
|
1136
1142
|
setError(null);
|
|
1137
1143
|
if (authProxyUrl) {
|
|
1138
|
-
const
|
|
1144
|
+
const body = email ? { email } : user ? {} : void 0;
|
|
1145
|
+
const response = await proxyFetch(authProxyUrl, "resend-verification", { body });
|
|
1139
1146
|
if (!response.success) {
|
|
1140
1147
|
const err = response.error || {
|
|
1141
1148
|
code: "RESEND_FAILED",
|
|
@@ -1145,15 +1152,19 @@ function useAuth() {
|
|
|
1145
1152
|
throw err;
|
|
1146
1153
|
}
|
|
1147
1154
|
} else {
|
|
1148
|
-
if (!user) {
|
|
1155
|
+
if (!user && !email) {
|
|
1149
1156
|
const err = {
|
|
1150
1157
|
code: "NOT_AUTHENTICATED",
|
|
1151
|
-
message: "Must be logged in to resend verification"
|
|
1158
|
+
message: "Must be logged in or provide email to resend verification"
|
|
1152
1159
|
};
|
|
1153
1160
|
throw err;
|
|
1154
1161
|
}
|
|
1155
1162
|
try {
|
|
1156
|
-
|
|
1163
|
+
if (email && !user) {
|
|
1164
|
+
await client.post("/v1/auth/resend-verification", { email });
|
|
1165
|
+
} else {
|
|
1166
|
+
await client.post("/v1/auth/resend-verification");
|
|
1167
|
+
}
|
|
1157
1168
|
} catch (err) {
|
|
1158
1169
|
if (err instanceof ScaleMuleApiError) {
|
|
1159
1170
|
setError(err);
|
|
@@ -1504,6 +1515,11 @@ function useAuth() {
|
|
|
1504
1515
|
if (responseUser) {
|
|
1505
1516
|
setUser(responseUser);
|
|
1506
1517
|
}
|
|
1518
|
+
const sessionToken = "sessionToken" in loginData ? loginData.sessionToken : void 0;
|
|
1519
|
+
const userId = "userId" in loginData ? loginData.userId : void 0;
|
|
1520
|
+
if (sessionToken) {
|
|
1521
|
+
await client.setSession(sessionToken, userId || responseUser?.id || "");
|
|
1522
|
+
}
|
|
1507
1523
|
return response.data;
|
|
1508
1524
|
}
|
|
1509
1525
|
let phoneLoginData;
|
package/dist/server/auth.js
CHANGED
|
@@ -830,7 +830,13 @@ function createAuthRoutes(config = {}) {
|
|
|
830
830
|
if (config.onRegister) {
|
|
831
831
|
await config.onRegister({ id: registeredUser.id, email: registeredUser.email });
|
|
832
832
|
}
|
|
833
|
-
|
|
833
|
+
let loginData;
|
|
834
|
+
try {
|
|
835
|
+
loginData = await sm.auth.login({ email, password });
|
|
836
|
+
} catch {
|
|
837
|
+
return successResponse({ user: registeredUser, message: "Registration successful" }, 201);
|
|
838
|
+
}
|
|
839
|
+
return withSession(loginData, { user: registeredUser, sessionToken: loginData.session_token, userId: registeredUser.id }, cookieOptions);
|
|
834
840
|
}
|
|
835
841
|
// ==================== Login ====================
|
|
836
842
|
case "login": {
|
|
@@ -861,7 +867,7 @@ function createAuthRoutes(config = {}) {
|
|
|
861
867
|
email: loginData.user.email
|
|
862
868
|
});
|
|
863
869
|
}
|
|
864
|
-
return withSession(loginData, { user: loginData.user }, cookieOptions);
|
|
870
|
+
return withSession(loginData, { user: loginData.user, sessionToken: loginData.session_token, userId: loginData.user.id }, cookieOptions);
|
|
865
871
|
}
|
|
866
872
|
// ==================== Logout ====================
|
|
867
873
|
case "logout": {
|
package/dist/server/auth.mjs
CHANGED
|
@@ -828,7 +828,13 @@ function createAuthRoutes(config = {}) {
|
|
|
828
828
|
if (config.onRegister) {
|
|
829
829
|
await config.onRegister({ id: registeredUser.id, email: registeredUser.email });
|
|
830
830
|
}
|
|
831
|
-
|
|
831
|
+
let loginData;
|
|
832
|
+
try {
|
|
833
|
+
loginData = await sm.auth.login({ email, password });
|
|
834
|
+
} catch {
|
|
835
|
+
return successResponse({ user: registeredUser, message: "Registration successful" }, 201);
|
|
836
|
+
}
|
|
837
|
+
return withSession(loginData, { user: registeredUser, sessionToken: loginData.session_token, userId: registeredUser.id }, cookieOptions);
|
|
832
838
|
}
|
|
833
839
|
// ==================== Login ====================
|
|
834
840
|
case "login": {
|
|
@@ -859,7 +865,7 @@ function createAuthRoutes(config = {}) {
|
|
|
859
865
|
email: loginData.user.email
|
|
860
866
|
});
|
|
861
867
|
}
|
|
862
|
-
return withSession(loginData, { user: loginData.user }, cookieOptions);
|
|
868
|
+
return withSession(loginData, { user: loginData.user, sessionToken: loginData.session_token, userId: loginData.user.id }, cookieOptions);
|
|
863
869
|
}
|
|
864
870
|
// ==================== Logout ====================
|
|
865
871
|
case "logout": {
|
package/dist/server/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { S as ServerConfig } from '../webhook-handler-
|
|
2
|
-
export { a as ScaleMuleServer, d as VideoFailedEvent, V as VideoReadyEvent, f as VideoTranscodedEvent, e as VideoUploadedEvent, W as WebhookEvent, g as WebhookRoutesConfig, c as createServerClient, h as createWebhookHandler, b as createWebhookRoutes, p as parseWebhookEvent, r as registerVideoWebhook, v as verifyWebhookSignature } from '../webhook-handler-
|
|
3
|
-
import { $ as ClientContext, L as LoginResponse, A as ApiError } from '../index-
|
|
1
|
+
import { S as ServerConfig } from '../webhook-handler-B_S2RgMO.mjs';
|
|
2
|
+
export { a as ScaleMuleServer, d as VideoFailedEvent, V as VideoReadyEvent, f as VideoTranscodedEvent, e as VideoUploadedEvent, W as WebhookEvent, g as WebhookRoutesConfig, c as createServerClient, h as createWebhookHandler, b as createWebhookRoutes, p as parseWebhookEvent, r as registerVideoWebhook, v as verifyWebhookSignature } from '../webhook-handler-B_S2RgMO.mjs';
|
|
3
|
+
import { $ as ClientContext, L as LoginResponse, A as ApiError } from '../index-jomBa89d.mjs';
|
|
4
4
|
import { NextRequest, NextResponse } from 'next/server';
|
|
5
5
|
|
|
6
6
|
/**
|
package/dist/server/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { S as ServerConfig } from '../webhook-handler-
|
|
2
|
-
export { a as ScaleMuleServer, d as VideoFailedEvent, V as VideoReadyEvent, f as VideoTranscodedEvent, e as VideoUploadedEvent, W as WebhookEvent, g as WebhookRoutesConfig, c as createServerClient, h as createWebhookHandler, b as createWebhookRoutes, p as parseWebhookEvent, r as registerVideoWebhook, v as verifyWebhookSignature } from '../webhook-handler-
|
|
3
|
-
import { $ as ClientContext, L as LoginResponse, A as ApiError } from '../index-
|
|
1
|
+
import { S as ServerConfig } from '../webhook-handler-BKhYMJ9A.js';
|
|
2
|
+
export { a as ScaleMuleServer, d as VideoFailedEvent, V as VideoReadyEvent, f as VideoTranscodedEvent, e as VideoUploadedEvent, W as WebhookEvent, g as WebhookRoutesConfig, c as createServerClient, h as createWebhookHandler, b as createWebhookRoutes, p as parseWebhookEvent, r as registerVideoWebhook, v as verifyWebhookSignature } from '../webhook-handler-BKhYMJ9A.js';
|
|
3
|
+
import { $ as ClientContext, L as LoginResponse, A as ApiError } from '../index-jomBa89d.js';
|
|
4
4
|
import { NextRequest, NextResponse } from 'next/server';
|
|
5
5
|
|
|
6
6
|
/**
|
package/dist/server/index.js
CHANGED
|
@@ -1047,7 +1047,13 @@ function createAuthRoutes(config = {}) {
|
|
|
1047
1047
|
if (config.onRegister) {
|
|
1048
1048
|
await config.onRegister({ id: registeredUser.id, email: registeredUser.email });
|
|
1049
1049
|
}
|
|
1050
|
-
|
|
1050
|
+
let loginData;
|
|
1051
|
+
try {
|
|
1052
|
+
loginData = await sm.auth.login({ email, password });
|
|
1053
|
+
} catch {
|
|
1054
|
+
return successResponse({ user: registeredUser, message: "Registration successful" }, 201);
|
|
1055
|
+
}
|
|
1056
|
+
return withSession(loginData, { user: registeredUser, sessionToken: loginData.session_token, userId: registeredUser.id }, cookieOptions);
|
|
1051
1057
|
}
|
|
1052
1058
|
// ==================== Login ====================
|
|
1053
1059
|
case "login": {
|
|
@@ -1078,7 +1084,7 @@ function createAuthRoutes(config = {}) {
|
|
|
1078
1084
|
email: loginData.user.email
|
|
1079
1085
|
});
|
|
1080
1086
|
}
|
|
1081
|
-
return withSession(loginData, { user: loginData.user }, cookieOptions);
|
|
1087
|
+
return withSession(loginData, { user: loginData.user, sessionToken: loginData.session_token, userId: loginData.user.id }, cookieOptions);
|
|
1082
1088
|
}
|
|
1083
1089
|
// ==================== Logout ====================
|
|
1084
1090
|
case "logout": {
|
package/dist/server/index.mjs
CHANGED
|
@@ -1045,7 +1045,13 @@ function createAuthRoutes(config = {}) {
|
|
|
1045
1045
|
if (config.onRegister) {
|
|
1046
1046
|
await config.onRegister({ id: registeredUser.id, email: registeredUser.email });
|
|
1047
1047
|
}
|
|
1048
|
-
|
|
1048
|
+
let loginData;
|
|
1049
|
+
try {
|
|
1050
|
+
loginData = await sm.auth.login({ email, password });
|
|
1051
|
+
} catch {
|
|
1052
|
+
return successResponse({ user: registeredUser, message: "Registration successful" }, 201);
|
|
1053
|
+
}
|
|
1054
|
+
return withSession(loginData, { user: registeredUser, sessionToken: loginData.session_token, userId: registeredUser.id }, cookieOptions);
|
|
1049
1055
|
}
|
|
1050
1056
|
// ==================== Login ====================
|
|
1051
1057
|
case "login": {
|
|
@@ -1076,7 +1082,7 @@ function createAuthRoutes(config = {}) {
|
|
|
1076
1082
|
email: loginData.user.email
|
|
1077
1083
|
});
|
|
1078
1084
|
}
|
|
1079
|
-
return withSession(loginData, { user: loginData.user }, cookieOptions);
|
|
1085
|
+
return withSession(loginData, { user: loginData.user, sessionToken: loginData.session_token, userId: loginData.user.id }, cookieOptions);
|
|
1080
1086
|
}
|
|
1081
1087
|
// ==================== Logout ====================
|
|
1082
1088
|
case "logout": {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { h as createWebhookHandler } from '../webhook-handler-
|
|
2
|
-
import '../index-
|
|
1
|
+
export { h as createWebhookHandler } from '../webhook-handler-B_S2RgMO.mjs';
|
|
2
|
+
import '../index-jomBa89d.mjs';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { h as createWebhookHandler } from '../webhook-handler-
|
|
2
|
-
import '../index-
|
|
1
|
+
export { h as createWebhookHandler } from '../webhook-handler-BKhYMJ9A.js';
|
|
2
|
+
import '../index-jomBa89d.js';
|
package/dist/testing.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { U as User, N as StorageFile, A as ApiError } from './index-
|
|
3
|
+
import { U as User, N as StorageFile, A as ApiError } from './index-jomBa89d.mjs';
|
|
4
4
|
|
|
5
5
|
interface MockUserOptions {
|
|
6
6
|
id?: string;
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { U as User, N as StorageFile, A as ApiError } from './index-
|
|
3
|
+
import { U as User, N as StorageFile, A as ApiError } from './index-jomBa89d.js';
|
|
4
4
|
|
|
5
5
|
interface MockUserOptions {
|
|
6
6
|
id?: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as RegisterRequest, U as User, l as LoginRequest, L as LoginResponse, c as ListFilesParams, T as ListFilesResponse, N as StorageFile, $ as ClientContext, W as UploadResponse } from './index-
|
|
1
|
+
import { R as RegisterRequest, U as User, l as LoginRequest, L as LoginResponse, c as ListFilesParams, T as ListFilesResponse, N as StorageFile, $ as ClientContext, W as UploadResponse } from './index-jomBa89d.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Server-Side ScaleMule Client
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as RegisterRequest, U as User, l as LoginRequest, L as LoginResponse, c as ListFilesParams, T as ListFilesResponse, N as StorageFile, $ as ClientContext, W as UploadResponse } from './index-
|
|
1
|
+
import { R as RegisterRequest, U as User, l as LoginRequest, L as LoginResponse, c as ListFilesParams, T as ListFilesResponse, N as StorageFile, $ as ClientContext, W as UploadResponse } from './index-jomBa89d.mjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Server-Side ScaleMule Client
|
package/package.json
CHANGED