foundation-sdk 0.2.10 → 0.3.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/auth-auth0.cjs +1 -1
- package/dist/auth-auth0.cjs.map +1 -1
- package/dist/auth-auth0.d.cts +2 -2
- package/dist/auth-auth0.d.ts +2 -2
- package/dist/auth-auth0.js +1 -1
- package/dist/auth-auth0.js.map +1 -1
- package/dist/auth-cognito.cjs +1 -1
- package/dist/auth-cognito.cjs.map +1 -1
- package/dist/auth-cognito.d.cts +2 -2
- package/dist/auth-cognito.d.ts +2 -2
- package/dist/auth-cognito.js +1 -1
- package/dist/auth-cognito.js.map +1 -1
- package/dist/foundation-sdk.browser.auth0.global.js +3 -3
- package/dist/foundation-sdk.browser.auth0.global.js.map +1 -1
- package/dist/foundation-sdk.browser.global.js +3 -3
- package/dist/foundation-sdk.browser.global.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/{types-HdCjnyCt.d.cts → types-BiBc2oYU.d.cts} +76 -8
- package/dist/{types-HdCjnyCt.d.ts → types-BiBc2oYU.d.ts} +76 -8
- package/package.json +1 -1
|
@@ -22,7 +22,19 @@ interface EntityChangeEvent {
|
|
|
22
22
|
namespace?: string;
|
|
23
23
|
timestamp?: number;
|
|
24
24
|
}
|
|
25
|
-
|
|
25
|
+
interface AuthProviderContext {
|
|
26
|
+
/** API base URL for backend endpoints */
|
|
27
|
+
apiBaseUrl: string;
|
|
28
|
+
/** Account service base URL */
|
|
29
|
+
accountBaseUrl: string;
|
|
30
|
+
/** App ID for request headers */
|
|
31
|
+
appId: string;
|
|
32
|
+
/** Tenant ID for request headers */
|
|
33
|
+
tenantId: string;
|
|
34
|
+
/** App version for request headers */
|
|
35
|
+
version: string;
|
|
36
|
+
}
|
|
37
|
+
type AuthProvider = (config: Record<string, unknown>, ctx: AuthProviderContext) => Promise<AuthClient>;
|
|
26
38
|
interface FoundationConfig {
|
|
27
39
|
/** Backend config endpoint URL. If omitted, reads from /foundation-env.json */
|
|
28
40
|
configUrl?: string;
|
|
@@ -56,14 +68,34 @@ interface FullConfig {
|
|
|
56
68
|
};
|
|
57
69
|
readonly raw: Record<string, unknown>;
|
|
58
70
|
}
|
|
71
|
+
type SignInStep = 'DONE' | 'CONFIRM_SIGN_UP' | 'CONFIRM_SIGN_IN_WITH_SMS_CODE' | 'CONFIRM_SIGN_IN_WITH_TOTP_CODE' | 'CONTINUE_SIGN_IN_WITH_MFA_SELECTION' | 'RESET_PASSWORD' | 'CONFIRM_SIGN_IN_WITH_NEW_PASSWORD_REQUIRED' | string;
|
|
72
|
+
interface SignInResult {
|
|
73
|
+
isSignedIn: boolean;
|
|
74
|
+
nextStep?: {
|
|
75
|
+
signInStep: SignInStep;
|
|
76
|
+
[key: string]: unknown;
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
type SignUpStep = 'DONE' | 'CONFIRM_SIGN_UP' | string;
|
|
80
|
+
interface SignUpResult {
|
|
81
|
+
isSignUpComplete: boolean;
|
|
82
|
+
userId?: string;
|
|
83
|
+
nextStep?: {
|
|
84
|
+
signUpStep: SignUpStep;
|
|
85
|
+
[key: string]: unknown;
|
|
86
|
+
};
|
|
87
|
+
}
|
|
59
88
|
interface AuthClient {
|
|
60
89
|
login(options?: Record<string, unknown>): Promise<void>;
|
|
61
90
|
logout(options?: Record<string, unknown>): void | Promise<void>;
|
|
62
91
|
getUser(): Promise<User | undefined>;
|
|
63
92
|
getTokenSilently(options?: Record<string, unknown>): Promise<string>;
|
|
64
93
|
isAuthenticated(): Promise<boolean>;
|
|
65
|
-
|
|
66
|
-
|
|
94
|
+
handleCallback?(url?: string): Promise<void>;
|
|
95
|
+
signIn?(email: string, password: string): Promise<SignInResult>;
|
|
96
|
+
signUp?(email: string, password: string, metadata?: Record<string, unknown>): Promise<SignUpResult>;
|
|
97
|
+
confirmSignUp?(email: string, code: string): Promise<void>;
|
|
98
|
+
resendSignUpCode?(email: string): Promise<void>;
|
|
67
99
|
forgotPassword?(email: string): Promise<void>;
|
|
68
100
|
resetPassword?(code: string, newPassword: string): Promise<void>;
|
|
69
101
|
}
|
|
@@ -74,10 +106,19 @@ interface AuthService {
|
|
|
74
106
|
/** Redirect-based login (Auth0 Universal Login / Cognito Hosted UI) */
|
|
75
107
|
login(options?: Record<string, unknown>): Promise<void>;
|
|
76
108
|
logout(options?: Record<string, unknown>): Promise<void>;
|
|
77
|
-
/** Direct sign in with credentials (for custom login forms)
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
109
|
+
/** Direct sign in with credentials (for custom login forms).
|
|
110
|
+
* Returns `{ isSignedIn, nextStep? }`. Check `isSignedIn` before navigating. */
|
|
111
|
+
signIn(email: string, password: string): Promise<SignInResult>;
|
|
112
|
+
/** Direct sign up (for custom registration forms).
|
|
113
|
+
* Returns `{ isSignUpComplete, nextStep? }`. If configured for unified verification,
|
|
114
|
+
* `isSignUpComplete` is true and the backend sends a verification email. */
|
|
115
|
+
signUp(email: string, password: string, metadata?: Record<string, unknown>): Promise<SignUpResult>;
|
|
116
|
+
/** Confirm sign up with verification code (Cognito email/SMS verification) */
|
|
117
|
+
confirmSignUp(email: string, code: string): Promise<void>;
|
|
118
|
+
/** Resend sign up verification code */
|
|
119
|
+
resendSignUpCode(email: string): Promise<void>;
|
|
120
|
+
/** Handle OAuth redirect callback — call on your /callback route */
|
|
121
|
+
handleCallback(url?: string): Promise<void>;
|
|
81
122
|
/** Initiate password reset */
|
|
82
123
|
forgotPassword(email: string): Promise<void>;
|
|
83
124
|
/** Complete password reset with code */
|
|
@@ -178,6 +219,32 @@ interface IntegrationService {
|
|
|
178
219
|
}>;
|
|
179
220
|
disconnect(source: string, configurationId: string): Promise<void>;
|
|
180
221
|
}
|
|
222
|
+
interface OAuthClient {
|
|
223
|
+
id: string;
|
|
224
|
+
name: string;
|
|
225
|
+
description?: string;
|
|
226
|
+
redirectUris: string[];
|
|
227
|
+
allowedScopes: string[];
|
|
228
|
+
grantTypes: string[];
|
|
229
|
+
status: string;
|
|
230
|
+
[key: string]: unknown;
|
|
231
|
+
}
|
|
232
|
+
interface OAuthConsentParams {
|
|
233
|
+
client_id: string;
|
|
234
|
+
redirect_uri: string;
|
|
235
|
+
scope: string;
|
|
236
|
+
state: string;
|
|
237
|
+
code_challenge: string;
|
|
238
|
+
code_challenge_method: string;
|
|
239
|
+
}
|
|
240
|
+
interface OAuthService {
|
|
241
|
+
/** Get an OAuth client's details (for consent screen) */
|
|
242
|
+
getClient(clientId: string): Promise<OAuthClient>;
|
|
243
|
+
/** Grant consent and generate authorization code */
|
|
244
|
+
authorizeConsent(params: OAuthConsentParams): Promise<{
|
|
245
|
+
code: string;
|
|
246
|
+
}>;
|
|
247
|
+
}
|
|
181
248
|
interface OpenApiService {
|
|
182
249
|
get(): Promise<Record<string, unknown>>;
|
|
183
250
|
}
|
|
@@ -196,9 +263,10 @@ interface Foundation {
|
|
|
196
263
|
integration: IntegrationService;
|
|
197
264
|
account: AccountService;
|
|
198
265
|
config: FullConfig;
|
|
266
|
+
oauth: OAuthService;
|
|
199
267
|
openapi: OpenApiService;
|
|
200
268
|
log: LogService;
|
|
201
269
|
on(event: string, callback: (event: EntityChangeEvent) => void): () => void;
|
|
202
270
|
}
|
|
203
271
|
|
|
204
|
-
export type {
|
|
272
|
+
export type { AuthProvider as A, DbService as D, EntityChangeEvent as E, FoundationConfig as F, IntegrationService as I, LogService as L, OAuthService as O, SignInResult as S, User as U, Foundation as a, FullConfig as b, FileMetadata as c, AuthClient as d, AuthService as e, SignInStep as f, SignUpResult as g, SignUpStep as h, FilesService as i, AccountService as j, Integration as k, IntegrationConnection as l, IntegrationDetail as m, OAuthClient as n, OAuthConsentParams as o, OpenApiService as p, AuthProviderContext as q };
|
|
@@ -22,7 +22,19 @@ interface EntityChangeEvent {
|
|
|
22
22
|
namespace?: string;
|
|
23
23
|
timestamp?: number;
|
|
24
24
|
}
|
|
25
|
-
|
|
25
|
+
interface AuthProviderContext {
|
|
26
|
+
/** API base URL for backend endpoints */
|
|
27
|
+
apiBaseUrl: string;
|
|
28
|
+
/** Account service base URL */
|
|
29
|
+
accountBaseUrl: string;
|
|
30
|
+
/** App ID for request headers */
|
|
31
|
+
appId: string;
|
|
32
|
+
/** Tenant ID for request headers */
|
|
33
|
+
tenantId: string;
|
|
34
|
+
/** App version for request headers */
|
|
35
|
+
version: string;
|
|
36
|
+
}
|
|
37
|
+
type AuthProvider = (config: Record<string, unknown>, ctx: AuthProviderContext) => Promise<AuthClient>;
|
|
26
38
|
interface FoundationConfig {
|
|
27
39
|
/** Backend config endpoint URL. If omitted, reads from /foundation-env.json */
|
|
28
40
|
configUrl?: string;
|
|
@@ -56,14 +68,34 @@ interface FullConfig {
|
|
|
56
68
|
};
|
|
57
69
|
readonly raw: Record<string, unknown>;
|
|
58
70
|
}
|
|
71
|
+
type SignInStep = 'DONE' | 'CONFIRM_SIGN_UP' | 'CONFIRM_SIGN_IN_WITH_SMS_CODE' | 'CONFIRM_SIGN_IN_WITH_TOTP_CODE' | 'CONTINUE_SIGN_IN_WITH_MFA_SELECTION' | 'RESET_PASSWORD' | 'CONFIRM_SIGN_IN_WITH_NEW_PASSWORD_REQUIRED' | string;
|
|
72
|
+
interface SignInResult {
|
|
73
|
+
isSignedIn: boolean;
|
|
74
|
+
nextStep?: {
|
|
75
|
+
signInStep: SignInStep;
|
|
76
|
+
[key: string]: unknown;
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
type SignUpStep = 'DONE' | 'CONFIRM_SIGN_UP' | string;
|
|
80
|
+
interface SignUpResult {
|
|
81
|
+
isSignUpComplete: boolean;
|
|
82
|
+
userId?: string;
|
|
83
|
+
nextStep?: {
|
|
84
|
+
signUpStep: SignUpStep;
|
|
85
|
+
[key: string]: unknown;
|
|
86
|
+
};
|
|
87
|
+
}
|
|
59
88
|
interface AuthClient {
|
|
60
89
|
login(options?: Record<string, unknown>): Promise<void>;
|
|
61
90
|
logout(options?: Record<string, unknown>): void | Promise<void>;
|
|
62
91
|
getUser(): Promise<User | undefined>;
|
|
63
92
|
getTokenSilently(options?: Record<string, unknown>): Promise<string>;
|
|
64
93
|
isAuthenticated(): Promise<boolean>;
|
|
65
|
-
|
|
66
|
-
|
|
94
|
+
handleCallback?(url?: string): Promise<void>;
|
|
95
|
+
signIn?(email: string, password: string): Promise<SignInResult>;
|
|
96
|
+
signUp?(email: string, password: string, metadata?: Record<string, unknown>): Promise<SignUpResult>;
|
|
97
|
+
confirmSignUp?(email: string, code: string): Promise<void>;
|
|
98
|
+
resendSignUpCode?(email: string): Promise<void>;
|
|
67
99
|
forgotPassword?(email: string): Promise<void>;
|
|
68
100
|
resetPassword?(code: string, newPassword: string): Promise<void>;
|
|
69
101
|
}
|
|
@@ -74,10 +106,19 @@ interface AuthService {
|
|
|
74
106
|
/** Redirect-based login (Auth0 Universal Login / Cognito Hosted UI) */
|
|
75
107
|
login(options?: Record<string, unknown>): Promise<void>;
|
|
76
108
|
logout(options?: Record<string, unknown>): Promise<void>;
|
|
77
|
-
/** Direct sign in with credentials (for custom login forms)
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
109
|
+
/** Direct sign in with credentials (for custom login forms).
|
|
110
|
+
* Returns `{ isSignedIn, nextStep? }`. Check `isSignedIn` before navigating. */
|
|
111
|
+
signIn(email: string, password: string): Promise<SignInResult>;
|
|
112
|
+
/** Direct sign up (for custom registration forms).
|
|
113
|
+
* Returns `{ isSignUpComplete, nextStep? }`. If configured for unified verification,
|
|
114
|
+
* `isSignUpComplete` is true and the backend sends a verification email. */
|
|
115
|
+
signUp(email: string, password: string, metadata?: Record<string, unknown>): Promise<SignUpResult>;
|
|
116
|
+
/** Confirm sign up with verification code (Cognito email/SMS verification) */
|
|
117
|
+
confirmSignUp(email: string, code: string): Promise<void>;
|
|
118
|
+
/** Resend sign up verification code */
|
|
119
|
+
resendSignUpCode(email: string): Promise<void>;
|
|
120
|
+
/** Handle OAuth redirect callback — call on your /callback route */
|
|
121
|
+
handleCallback(url?: string): Promise<void>;
|
|
81
122
|
/** Initiate password reset */
|
|
82
123
|
forgotPassword(email: string): Promise<void>;
|
|
83
124
|
/** Complete password reset with code */
|
|
@@ -178,6 +219,32 @@ interface IntegrationService {
|
|
|
178
219
|
}>;
|
|
179
220
|
disconnect(source: string, configurationId: string): Promise<void>;
|
|
180
221
|
}
|
|
222
|
+
interface OAuthClient {
|
|
223
|
+
id: string;
|
|
224
|
+
name: string;
|
|
225
|
+
description?: string;
|
|
226
|
+
redirectUris: string[];
|
|
227
|
+
allowedScopes: string[];
|
|
228
|
+
grantTypes: string[];
|
|
229
|
+
status: string;
|
|
230
|
+
[key: string]: unknown;
|
|
231
|
+
}
|
|
232
|
+
interface OAuthConsentParams {
|
|
233
|
+
client_id: string;
|
|
234
|
+
redirect_uri: string;
|
|
235
|
+
scope: string;
|
|
236
|
+
state: string;
|
|
237
|
+
code_challenge: string;
|
|
238
|
+
code_challenge_method: string;
|
|
239
|
+
}
|
|
240
|
+
interface OAuthService {
|
|
241
|
+
/** Get an OAuth client's details (for consent screen) */
|
|
242
|
+
getClient(clientId: string): Promise<OAuthClient>;
|
|
243
|
+
/** Grant consent and generate authorization code */
|
|
244
|
+
authorizeConsent(params: OAuthConsentParams): Promise<{
|
|
245
|
+
code: string;
|
|
246
|
+
}>;
|
|
247
|
+
}
|
|
181
248
|
interface OpenApiService {
|
|
182
249
|
get(): Promise<Record<string, unknown>>;
|
|
183
250
|
}
|
|
@@ -196,9 +263,10 @@ interface Foundation {
|
|
|
196
263
|
integration: IntegrationService;
|
|
197
264
|
account: AccountService;
|
|
198
265
|
config: FullConfig;
|
|
266
|
+
oauth: OAuthService;
|
|
199
267
|
openapi: OpenApiService;
|
|
200
268
|
log: LogService;
|
|
201
269
|
on(event: string, callback: (event: EntityChangeEvent) => void): () => void;
|
|
202
270
|
}
|
|
203
271
|
|
|
204
|
-
export type {
|
|
272
|
+
export type { AuthProvider as A, DbService as D, EntityChangeEvent as E, FoundationConfig as F, IntegrationService as I, LogService as L, OAuthService as O, SignInResult as S, User as U, Foundation as a, FullConfig as b, FileMetadata as c, AuthClient as d, AuthService as e, SignInStep as f, SignUpResult as g, SignUpStep as h, FilesService as i, AccountService as j, Integration as k, IntegrationConnection as l, IntegrationDetail as m, OAuthClient as n, OAuthConsentParams as o, OpenApiService as p, AuthProviderContext as q };
|