foundation-sdk 0.2.9 → 0.2.11

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.
@@ -22,7 +22,19 @@ interface EntityChangeEvent {
22
22
  namespace?: string;
23
23
  timestamp?: number;
24
24
  }
25
- type AuthProvider = (config: Record<string, unknown>) => Promise<AuthClient>;
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;
@@ -62,8 +74,11 @@ interface AuthClient {
62
74
  getUser(): Promise<User | undefined>;
63
75
  getTokenSilently(options?: Record<string, unknown>): Promise<string>;
64
76
  isAuthenticated(): Promise<boolean>;
77
+ handleCallback?(url?: string): Promise<void>;
65
78
  signIn?(email: string, password: string): Promise<void>;
66
79
  signUp?(email: string, password: string, metadata?: Record<string, unknown>): Promise<void>;
80
+ confirmSignUp?(email: string, code: string): Promise<void>;
81
+ resendSignUpCode?(email: string): Promise<void>;
67
82
  forgotPassword?(email: string): Promise<void>;
68
83
  resetPassword?(code: string, newPassword: string): Promise<void>;
69
84
  }
@@ -78,6 +93,12 @@ interface AuthService {
78
93
  signIn(email: string, password: string): Promise<void>;
79
94
  /** Direct sign up (for custom registration forms) */
80
95
  signUp(email: string, password: string, metadata?: Record<string, unknown>): Promise<void>;
96
+ /** Confirm sign up with verification code (Cognito email/SMS verification) */
97
+ confirmSignUp(email: string, code: string): Promise<void>;
98
+ /** Resend sign up verification code */
99
+ resendSignUpCode(email: string): Promise<void>;
100
+ /** Handle OAuth redirect callback — call on your /callback route */
101
+ handleCallback(url?: string): Promise<void>;
81
102
  /** Initiate password reset */
82
103
  forgotPassword(email: string): Promise<void>;
83
104
  /** Complete password reset with code */
@@ -178,6 +199,32 @@ interface IntegrationService {
178
199
  }>;
179
200
  disconnect(source: string, configurationId: string): Promise<void>;
180
201
  }
202
+ interface OAuthClient {
203
+ id: string;
204
+ name: string;
205
+ description?: string;
206
+ redirectUris: string[];
207
+ allowedScopes: string[];
208
+ grantTypes: string[];
209
+ status: string;
210
+ [key: string]: unknown;
211
+ }
212
+ interface OAuthConsentParams {
213
+ client_id: string;
214
+ redirect_uri: string;
215
+ scope: string;
216
+ state: string;
217
+ code_challenge: string;
218
+ code_challenge_method: string;
219
+ }
220
+ interface OAuthService {
221
+ /** Get an OAuth client's details (for consent screen) */
222
+ getClient(clientId: string): Promise<OAuthClient>;
223
+ /** Grant consent and generate authorization code */
224
+ authorizeConsent(params: OAuthConsentParams): Promise<{
225
+ code: string;
226
+ }>;
227
+ }
181
228
  interface OpenApiService {
182
229
  get(): Promise<Record<string, unknown>>;
183
230
  }
@@ -196,9 +243,10 @@ interface Foundation {
196
243
  integration: IntegrationService;
197
244
  account: AccountService;
198
245
  config: FullConfig;
246
+ oauth: OAuthService;
199
247
  openapi: OpenApiService;
200
248
  log: LogService;
201
249
  on(event: string, callback: (event: EntityChangeEvent) => void): () => void;
202
250
  }
203
251
 
204
- export type { AuthClient as A, DbService as D, EntityChangeEvent as E, FoundationConfig as F, IntegrationService as I, LogService as L, OpenApiService as O, User as U, Foundation as a, FullConfig as b, FileMetadata as c, AuthProvider as d, AuthService as e, FilesService as f, AccountService as g, Integration as h, IntegrationConnection as i, IntegrationDetail as j };
252
+ export type { AuthProvider as A, DbService as D, EntityChangeEvent as E, FoundationConfig as F, IntegrationService as I, LogService as L, OAuthService as O, User as U, Foundation as a, FullConfig as b, FileMetadata as c, AuthClient as d, AuthService as e, FilesService as f, AccountService as g, Integration as h, IntegrationConnection as i, IntegrationDetail as j, OAuthClient as k, OAuthConsentParams as l, OpenApiService as m, AuthProviderContext as n };
@@ -22,7 +22,19 @@ interface EntityChangeEvent {
22
22
  namespace?: string;
23
23
  timestamp?: number;
24
24
  }
25
- type AuthProvider = (config: Record<string, unknown>) => Promise<AuthClient>;
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;
@@ -62,8 +74,11 @@ interface AuthClient {
62
74
  getUser(): Promise<User | undefined>;
63
75
  getTokenSilently(options?: Record<string, unknown>): Promise<string>;
64
76
  isAuthenticated(): Promise<boolean>;
77
+ handleCallback?(url?: string): Promise<void>;
65
78
  signIn?(email: string, password: string): Promise<void>;
66
79
  signUp?(email: string, password: string, metadata?: Record<string, unknown>): Promise<void>;
80
+ confirmSignUp?(email: string, code: string): Promise<void>;
81
+ resendSignUpCode?(email: string): Promise<void>;
67
82
  forgotPassword?(email: string): Promise<void>;
68
83
  resetPassword?(code: string, newPassword: string): Promise<void>;
69
84
  }
@@ -78,6 +93,12 @@ interface AuthService {
78
93
  signIn(email: string, password: string): Promise<void>;
79
94
  /** Direct sign up (for custom registration forms) */
80
95
  signUp(email: string, password: string, metadata?: Record<string, unknown>): Promise<void>;
96
+ /** Confirm sign up with verification code (Cognito email/SMS verification) */
97
+ confirmSignUp(email: string, code: string): Promise<void>;
98
+ /** Resend sign up verification code */
99
+ resendSignUpCode(email: string): Promise<void>;
100
+ /** Handle OAuth redirect callback — call on your /callback route */
101
+ handleCallback(url?: string): Promise<void>;
81
102
  /** Initiate password reset */
82
103
  forgotPassword(email: string): Promise<void>;
83
104
  /** Complete password reset with code */
@@ -178,6 +199,32 @@ interface IntegrationService {
178
199
  }>;
179
200
  disconnect(source: string, configurationId: string): Promise<void>;
180
201
  }
202
+ interface OAuthClient {
203
+ id: string;
204
+ name: string;
205
+ description?: string;
206
+ redirectUris: string[];
207
+ allowedScopes: string[];
208
+ grantTypes: string[];
209
+ status: string;
210
+ [key: string]: unknown;
211
+ }
212
+ interface OAuthConsentParams {
213
+ client_id: string;
214
+ redirect_uri: string;
215
+ scope: string;
216
+ state: string;
217
+ code_challenge: string;
218
+ code_challenge_method: string;
219
+ }
220
+ interface OAuthService {
221
+ /** Get an OAuth client's details (for consent screen) */
222
+ getClient(clientId: string): Promise<OAuthClient>;
223
+ /** Grant consent and generate authorization code */
224
+ authorizeConsent(params: OAuthConsentParams): Promise<{
225
+ code: string;
226
+ }>;
227
+ }
181
228
  interface OpenApiService {
182
229
  get(): Promise<Record<string, unknown>>;
183
230
  }
@@ -196,9 +243,10 @@ interface Foundation {
196
243
  integration: IntegrationService;
197
244
  account: AccountService;
198
245
  config: FullConfig;
246
+ oauth: OAuthService;
199
247
  openapi: OpenApiService;
200
248
  log: LogService;
201
249
  on(event: string, callback: (event: EntityChangeEvent) => void): () => void;
202
250
  }
203
251
 
204
- export type { AuthClient as A, DbService as D, EntityChangeEvent as E, FoundationConfig as F, IntegrationService as I, LogService as L, OpenApiService as O, User as U, Foundation as a, FullConfig as b, FileMetadata as c, AuthProvider as d, AuthService as e, FilesService as f, AccountService as g, Integration as h, IntegrationConnection as i, IntegrationDetail as j };
252
+ export type { AuthProvider as A, DbService as D, EntityChangeEvent as E, FoundationConfig as F, IntegrationService as I, LogService as L, OAuthService as O, User as U, Foundation as a, FullConfig as b, FileMetadata as c, AuthClient as d, AuthService as e, FilesService as f, AccountService as g, Integration as h, IntegrationConnection as i, IntegrationDetail as j, OAuthClient as k, OAuthConsentParams as l, OpenApiService as m, AuthProviderContext as n };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foundation-sdk",
3
- "version": "0.2.9",
3
+ "version": "0.2.11",
4
4
  "description": "TypeScript SDK for Foundation",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -20,6 +20,9 @@
20
20
  "types": "./dist/auth-cognito.d.ts",
21
21
  "require": "./dist/auth-cognito.cjs",
22
22
  "import": "./dist/auth-cognito.js"
23
+ },
24
+ "./components": {
25
+ "import": "./dist/foundation-sdk.components.js"
23
26
  }
24
27
  },
25
28
  "unpkg": "./dist/foundation-sdk.browser.global.js",
@@ -28,7 +31,7 @@
28
31
  "dist"
29
32
  ],
30
33
  "scripts": {
31
- "build": "tsup",
34
+ "build": "tsup && vite build --config vite.components.config.ts",
32
35
  "dev": "tsup --watch",
33
36
  "test": "vitest run",
34
37
  "test:watch": "vitest",
@@ -58,12 +61,16 @@
58
61
  },
59
62
  "devDependencies": {
60
63
  "@auth0/auth0-spa-js": "^2.18.3",
64
+ "@vitejs/plugin-vue": "^6.0.5",
61
65
  "@vitest/coverage-v8": "^4.1.0",
62
66
  "aws-amplify": "^6.16.3",
63
67
  "happy-dom": "^20.8.4",
64
68
  "tsup": "^8.5.1",
65
69
  "typescript": "^5.0.0",
66
- "vitest": "^4.1.0"
70
+ "vite": "^8.0.3",
71
+ "vite-plugin-dts": "^4.5.4",
72
+ "vitest": "^4.1.0",
73
+ "vue": "^3.5.32"
67
74
  },
68
75
  "sideEffects": [
69
76
  "./dist/auth-auth0.*",