@mosano-product-framework/sdk 0.2.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.
Files changed (74) hide show
  1. package/README.md +827 -0
  2. package/README.react.md +348 -0
  3. package/dist/auth/claims-types.d.ts +89 -0
  4. package/dist/auth/claims.d.ts +125 -0
  5. package/dist/auth/cross-tab.d.ts +114 -0
  6. package/dist/auth/errors.d.ts +40 -0
  7. package/dist/auth/index.d.ts +18 -0
  8. package/dist/auth/index.js +5 -0
  9. package/dist/auth/index.js.map +1 -0
  10. package/dist/auth/oauth-state.d.ts +93 -0
  11. package/dist/auth/session-manager.d.ts +253 -0
  12. package/dist/auth/storage.d.ts +36 -0
  13. package/dist/auth/tenant-directory.d.ts +59 -0
  14. package/dist/auth/tenant-selection.d.ts +92 -0
  15. package/dist/chunk-7WAV52EO.js +621 -0
  16. package/dist/chunk-7WAV52EO.js.map +1 -0
  17. package/dist/chunk-AJWM5MDZ.js +410 -0
  18. package/dist/chunk-AJWM5MDZ.js.map +1 -0
  19. package/dist/chunk-EXPYHNPV.js +212 -0
  20. package/dist/chunk-EXPYHNPV.js.map +1 -0
  21. package/dist/chunk-GPWGOYCA.js +85 -0
  22. package/dist/chunk-GPWGOYCA.js.map +1 -0
  23. package/dist/chunk-GQJ3QQPH.js +339 -0
  24. package/dist/chunk-GQJ3QQPH.js.map +1 -0
  25. package/dist/chunk-K2ELAI2X.js +64 -0
  26. package/dist/chunk-K2ELAI2X.js.map +1 -0
  27. package/dist/chunk-LRM6JJ63.js +616 -0
  28. package/dist/chunk-LRM6JJ63.js.map +1 -0
  29. package/dist/chunk-XAXFIIRT.js +959 -0
  30. package/dist/chunk-XAXFIIRT.js.map +1 -0
  31. package/dist/client/core/client-factory.d.ts +61 -0
  32. package/dist/client/core/client.d.ts +144 -0
  33. package/dist/client/core/errors.d.ts +105 -0
  34. package/dist/client/core/index.d.ts +9 -0
  35. package/dist/client/core/middleware.d.ts +67 -0
  36. package/dist/client/core/types.d.ts +99 -0
  37. package/dist/client/graphql/client.d.ts +66 -0
  38. package/dist/client/graphql/factory.d.ts +84 -0
  39. package/dist/client/graphql/operation.d.ts +24 -0
  40. package/dist/client/graphql/types.d.ts +60 -0
  41. package/dist/client/graphql/ws-client.d.ts +116 -0
  42. package/dist/client/index.d.ts +17 -0
  43. package/dist/client/index.js +227 -0
  44. package/dist/client/index.js.map +1 -0
  45. package/dist/client/middlewares/admin-auth.d.ts +90 -0
  46. package/dist/client/middlewares/auth.d.ts +81 -0
  47. package/dist/client/middlewares/index.d.ts +12 -0
  48. package/dist/client/middlewares/logging.d.ts +102 -0
  49. package/dist/client/middlewares/retry.d.ts +138 -0
  50. package/dist/client/middlewares/tenant.d.ts +60 -0
  51. package/dist/client/middlewares/turnstile.d.ts +41 -0
  52. package/dist/client/peer-free.d.ts +25 -0
  53. package/dist/client/utils/url.d.ts +19 -0
  54. package/dist/identity/index.d.ts +85 -0
  55. package/dist/identity/index.js +6 -0
  56. package/dist/identity/index.js.map +1 -0
  57. package/dist/identity/types.d.ts +690 -0
  58. package/dist/identity/v0.d.ts +594 -0
  59. package/dist/index.d.ts +50 -0
  60. package/dist/index.js +24 -0
  61. package/dist/index.js.map +1 -0
  62. package/dist/react/context.d.ts +47 -0
  63. package/dist/react/hooks.d.ts +120 -0
  64. package/dist/react/index.d.ts +19 -0
  65. package/dist/react/index.js +308 -0
  66. package/dist/react/index.js.map +1 -0
  67. package/dist/react/provider.d.ts +68 -0
  68. package/dist/react/store.d.ts +85 -0
  69. package/dist/storage/index.d.ts +31 -0
  70. package/dist/storage/index.js +5 -0
  71. package/dist/storage/index.js.map +1 -0
  72. package/dist/storage/types.d.ts +107 -0
  73. package/dist/storage/v0.d.ts +120 -0
  74. package/package.json +99 -0
@@ -0,0 +1,594 @@
1
+ import { MPFClient } from '../client/core/client.js';
2
+ import type { ClientConfig, RequestOptions } from '../client/core/types.js';
3
+ import type { OAuthStateStore } from '../auth/oauth-state.js';
4
+ import type * as Types from './types.js';
5
+ /**
6
+ * Configuration for the identity client.
7
+ */
8
+ export interface AuthClientV0Config extends ClientConfig {
9
+ /**
10
+ * Optional store for the OAuth CSRF state. When provided,
11
+ * `getGoogleOAuthURL` persists the minted state automatically so it survives
12
+ * the redirect.
13
+ *
14
+ * Sending it back stays explicit — `GoogleOAuthCallbackRequest.state` is
15
+ * required — because a security parameter should not be injected invisibly.
16
+ */
17
+ oauthStateStore?: OAuthStateStore;
18
+ }
19
+ /**
20
+ * Auth API v0 client
21
+ *
22
+ * Provides methods for authentication, user management, sessions,
23
+ * password recovery, and multi-tenant operations.
24
+ */
25
+ export declare class AuthClientV0 extends MPFClient {
26
+ /** Optional OAuth state store; see {@link AuthClientV0Config.oauthStateStore}. */
27
+ private readonly oauthStateStore?;
28
+ constructor(config: AuthClientV0Config);
29
+ /**
30
+ * Wraps request options with skipAuth: true for public endpoints
31
+ * that do not require authentication headers.
32
+ */
33
+ private publicOptions;
34
+ /**
35
+ * Register a new user with email and password
36
+ *
37
+ * Creates a new user account and returns access and refresh tokens.
38
+ *
39
+ * @param data - User registration data
40
+ * @param options - Optional request options
41
+ * @returns Access and refresh tokens
42
+ */
43
+ signUpEmailPassword(data: Types.CreateUserRequest, options?: RequestOptions): Promise<Types.AccessDataResponse>;
44
+ /**
45
+ * Login with email and password
46
+ *
47
+ * Authenticates a user and returns access and refresh tokens.
48
+ *
49
+ * @param data - Login credentials
50
+ * @param options - Optional request options
51
+ * @returns Access and refresh tokens
52
+ */
53
+ signInEmailPassword(data: Types.LoginRequest, options?: RequestOptions): Promise<Types.LoginResponse>;
54
+ /**
55
+ * Verify MFA code to complete login
56
+ *
57
+ * After a login attempt returns mfa_required, submit the TOTP code
58
+ * along with the MFA ticket to complete authentication.
59
+ *
60
+ * @param data - MFA ticket and TOTP code
61
+ * @param options - Optional request options
62
+ * @returns Access and refresh tokens
63
+ */
64
+ verifyMFA(data: Types.MFAVerifyRequest, options?: RequestOptions): Promise<Types.AccessDataResponse>;
65
+ /**
66
+ * Verify MFA setup to complete first-time enrollment and login
67
+ *
68
+ * After a login attempt returns mfa_setup_required, verify the TOTP
69
+ * setup by submitting a code from the authenticator app.
70
+ *
71
+ * @param data - MFA ticket and verification code
72
+ * @param options - Optional request options
73
+ * @returns Access and refresh tokens
74
+ */
75
+ verifyMFASetup(data: Types.MFASetupVerifyRequest, options?: RequestOptions): Promise<Types.AccessDataResponse>;
76
+ /**
77
+ * Send password recovery code to email
78
+ *
79
+ * Initiates the password recovery process by sending a verification code.
80
+ *
81
+ * @param data - Email address for recovery
82
+ * @param options - Optional request options
83
+ * @returns Success response
84
+ */
85
+ forgotPasswordWithEmail(data: Types.SendRecoveryCodeRequest, options?: RequestOptions): Promise<Types.SuccessResponse>;
86
+ /**
87
+ * Verify password recovery code
88
+ *
89
+ * Verifies the recovery code and returns a recovery token for password reset.
90
+ *
91
+ * @param data - Email and verification code
92
+ * @param options - Optional request options
93
+ * @returns Recovery token for password reset
94
+ */
95
+ verifyRecoveryCode(data: Types.VerifyRecoveryCodeRequest, options?: RequestOptions): Promise<Types.RecoveryTokenResponse>;
96
+ /**
97
+ * Reset password with recovery token
98
+ *
99
+ * Resets the user's password and returns new access and refresh tokens.
100
+ *
101
+ * @param data - Recovery token and new password
102
+ * @param options - Optional request options
103
+ * @returns Access and refresh tokens
104
+ */
105
+ resetPassword(data: Types.ResetPasswordRequest, options?: RequestOptions): Promise<Types.AccessDataResponse>;
106
+ /**
107
+ * Renew session with refresh token
108
+ *
109
+ * Exchanges a valid refresh token for new access and refresh tokens.
110
+ *
111
+ * Tenant is selected per request via the `X-MPF-Tenant` header, so a renewal
112
+ * neither takes nor changes a tenant.
113
+ *
114
+ * @param data - Refresh token
115
+ * @param options - Optional request options
116
+ * @returns Access and refresh tokens
117
+ */
118
+ renewSession(data: Types.RenewSessionRequest, options?: RequestOptions): Promise<Types.AccessDataResponse>;
119
+ /**
120
+ * Revoke session (logout)
121
+ *
122
+ * Revokes the session associated with the provided refresh token.
123
+ * Requires authentication.
124
+ *
125
+ * @param data - Refresh token to revoke
126
+ * @param options - Optional request options
127
+ * @returns Success response
128
+ */
129
+ revokeSession(data: Types.RevokeSessionRequest, options?: RequestOptions): Promise<Types.SuccessResponse>;
130
+ /**
131
+ * List pending invitations for the authenticated user
132
+ *
133
+ * Returns all pending invitations for the currently authenticated user.
134
+ * Requires authentication.
135
+ *
136
+ * @param options - Optional request options
137
+ * @returns Array of pending invitations
138
+ */
139
+ listMyInvitations(options?: RequestOptions): Promise<Types.PendingInvitationResponse[]>;
140
+ /**
141
+ * Preview an invitation (public, pre-auth).
142
+ *
143
+ * Returns the tenant, role, and inviter display name for the
144
+ * invitation-acceptance page. Email is intentionally omitted. Use this
145
+ * to render the accept page before the user signs in.
146
+ *
147
+ * @param token - Invitation token
148
+ * @param options - Optional request options
149
+ * @returns Public-safe invitation preview
150
+ */
151
+ previewInvitation(token: string, options?: RequestOptions): Promise<Types.InvitationPreviewResponse>;
152
+ /**
153
+ * Accept an invitation.
154
+ *
155
+ * Requires the user to be authenticated. The user's primary verified
156
+ * email must match the invitation. Creates the membership row.
157
+ *
158
+ * @param token - Invitation token
159
+ * @param options - Optional request options
160
+ * @returns Acceptance result (invitation + new membership)
161
+ */
162
+ acceptInvitation(token: string, options?: RequestOptions): Promise<Types.AcceptInvitationResponse>;
163
+ /**
164
+ * Revoke a pending invitation. Caller must be a manager of the tenant
165
+ * that issued the invitation.
166
+ *
167
+ * @param invitationId - Invitation ID (not the token)
168
+ * @param options - Optional request options
169
+ */
170
+ revokeInvitation(invitationId: string, options?: RequestOptions): Promise<Types.SuccessResponse>;
171
+ /**
172
+ * Health check endpoint
173
+ *
174
+ * Returns the health status of the service.
175
+ *
176
+ * @param options - Optional request options
177
+ * @returns Health status
178
+ */
179
+ healthCheck(options?: RequestOptions): Promise<Types.HealthResponse>;
180
+ /**
181
+ * Get current user profile
182
+ *
183
+ * Returns the authenticated user's profile information.
184
+ * Requires authentication.
185
+ *
186
+ * @param options - Optional request options
187
+ * @returns User profile
188
+ */
189
+ getMe(options?: RequestOptions): Promise<Types.UserProfileResponse>;
190
+ /**
191
+ * Update current user profile
192
+ *
193
+ * Updates the authenticated user's profile information.
194
+ * Requires authentication.
195
+ *
196
+ * @param data - Profile update data
197
+ * @param options - Optional request options
198
+ * @returns Updated user profile
199
+ */
200
+ updateMe(data: Types.UpdateProfileRequest, options?: RequestOptions): Promise<Types.SuccessResponse>;
201
+ /**
202
+ * List user emails
203
+ *
204
+ * Returns all email addresses associated with the authenticated user.
205
+ * Requires authentication.
206
+ *
207
+ * @param options - Optional request options
208
+ * @returns Array of email addresses
209
+ */
210
+ listEmails(options?: RequestOptions): Promise<Types.EmailResponse[]>;
211
+ /**
212
+ * Add a new email address
213
+ *
214
+ * Adds a new email address to the authenticated user's account.
215
+ * A verification code will be sent to the email.
216
+ * Requires authentication.
217
+ *
218
+ * @param data - Email address to add
219
+ * @param options - Optional request options
220
+ * @returns Added email information
221
+ */
222
+ addEmail(data: Types.AddEmailRequest, options?: RequestOptions): Promise<Types.EmailResponse>;
223
+ /**
224
+ * Verify an email address
225
+ *
226
+ * Verifies an email address using a verification code.
227
+ * Requires authentication.
228
+ *
229
+ * @param emailId - Email ID to verify
230
+ * @param data - Verification code
231
+ * @param options - Optional request options
232
+ * @returns Success response
233
+ */
234
+ verifyEmail(emailId: string, data: Types.VerifyContactRequest, options?: RequestOptions): Promise<Types.SuccessResponse>;
235
+ /**
236
+ * Delete an email address
237
+ *
238
+ * Removes an email address from the authenticated user's account.
239
+ * Cannot delete the primary email.
240
+ * Requires authentication.
241
+ *
242
+ * @param emailId - Email ID to delete
243
+ * @param options - Optional request options
244
+ * @returns Success response
245
+ */
246
+ deleteEmail(emailId: string, options?: RequestOptions): Promise<Types.SuccessResponse>;
247
+ /**
248
+ * Set email as primary
249
+ *
250
+ * Sets the specified email address as the primary email for the user.
251
+ * Email must be verified before it can be set as primary.
252
+ * Requires authentication.
253
+ *
254
+ * @param emailId - Email ID to set as primary
255
+ * @param options - Optional request options
256
+ * @returns Success response
257
+ */
258
+ setPrimaryEmail(emailId: string, options?: RequestOptions): Promise<Types.SuccessResponse>;
259
+ /**
260
+ * Send email verification code
261
+ *
262
+ * Sends a verification code to the authenticated user's primary email address.
263
+ * Use verifyEmail() to complete the verification.
264
+ * Requires authentication.
265
+ *
266
+ * @param options - Optional request options
267
+ * @returns Success response
268
+ */
269
+ sendEmailVerification(options?: RequestOptions): Promise<Types.SuccessResponse>;
270
+ /**
271
+ * List user phones
272
+ *
273
+ * Returns all phone numbers associated with the authenticated user.
274
+ * Requires authentication.
275
+ *
276
+ * @param options - Optional request options
277
+ * @returns Array of phone numbers
278
+ */
279
+ listPhones(options?: RequestOptions): Promise<Types.PhoneResponse[]>;
280
+ /**
281
+ * Add a new phone number
282
+ *
283
+ * Adds a new phone number to the authenticated user's account.
284
+ * A verification code will be sent to the phone.
285
+ * Requires authentication.
286
+ *
287
+ * @param data - Phone number to add (E.164 format)
288
+ * @param options - Optional request options
289
+ * @returns Added phone information
290
+ */
291
+ addPhone(data: Types.AddPhoneRequest, options?: RequestOptions): Promise<Types.PhoneResponse>;
292
+ /**
293
+ * Verify a phone number
294
+ *
295
+ * Verifies a phone number using a verification code.
296
+ * Requires authentication.
297
+ *
298
+ * @param phoneId - Phone ID to verify
299
+ * @param data - Verification code
300
+ * @param options - Optional request options
301
+ * @returns Success response
302
+ */
303
+ verifyPhone(phoneId: string, data: Types.VerifyContactRequest, options?: RequestOptions): Promise<Types.SuccessResponse>;
304
+ /**
305
+ * Delete a phone number
306
+ *
307
+ * Removes a phone number from the authenticated user's account.
308
+ * Cannot delete the primary phone.
309
+ * Requires authentication.
310
+ *
311
+ * @param phoneId - Phone ID to delete
312
+ * @param options - Optional request options
313
+ * @returns Success response
314
+ */
315
+ deletePhone(phoneId: string, options?: RequestOptions): Promise<Types.SuccessResponse>;
316
+ /**
317
+ * Set phone as primary
318
+ *
319
+ * Sets the specified phone number as the primary phone for the user.
320
+ * Phone must be verified before it can be set as primary.
321
+ * Requires authentication.
322
+ *
323
+ * @param phoneId - Phone ID to set as primary
324
+ * @param options - Optional request options
325
+ * @returns Success response
326
+ */
327
+ setPrimaryPhone(phoneId: string, options?: RequestOptions): Promise<Types.SuccessResponse>;
328
+ /**
329
+ * List user sessions
330
+ *
331
+ * Returns all active sessions for the authenticated user.
332
+ * Requires authentication.
333
+ *
334
+ * @param options - Optional request options
335
+ * @returns Array of sessions
336
+ */
337
+ listSessions(options?: RequestOptions): Promise<Types.SessionResponse[]>;
338
+ /**
339
+ * Delete a session
340
+ *
341
+ * Revokes a specific session for the authenticated user.
342
+ * Requires authentication.
343
+ *
344
+ * @param sessionId - Session ID to delete
345
+ * @param options - Optional request options
346
+ * @returns Success response
347
+ */
348
+ deleteSession(sessionId: string, options?: RequestOptions): Promise<Types.SuccessResponse>;
349
+ /**
350
+ * List authorized OAuth clients
351
+ *
352
+ * Returns all OAuth clients authorized by the authenticated user.
353
+ * Requires authentication.
354
+ *
355
+ * @param options - Optional request options
356
+ * @returns Array of OAuth clients
357
+ */
358
+ listClients(options?: RequestOptions): Promise<Types.ClientResponse[]>;
359
+ /**
360
+ * Revoke OAuth client authorization
361
+ *
362
+ * Revokes authorization for a specific OAuth client.
363
+ * Requires authentication.
364
+ *
365
+ * @param clientId - Client ID to revoke
366
+ * @param options - Optional request options
367
+ * @returns Success response
368
+ */
369
+ deleteClient(clientId: string, options?: RequestOptions): Promise<Types.SuccessResponse>;
370
+ /**
371
+ * Update password (authenticated)
372
+ *
373
+ * Updates the authenticated user's password.
374
+ * Requires authentication.
375
+ *
376
+ * @param data - Current and new password
377
+ * @param options - Optional request options
378
+ * @returns Success response
379
+ */
380
+ updatePassword(data: Types.UpdatePasswordRequest, options?: RequestOptions): Promise<Types.SuccessResponse>;
381
+ /**
382
+ * Create a new tenant
383
+ *
384
+ * Creates a new tenant organization. The authenticated user becomes the owner.
385
+ * Requires authentication.
386
+ *
387
+ * @param data - Tenant creation data
388
+ * @param options - Optional request options
389
+ * @returns Created tenant information
390
+ */
391
+ createTenant(data: Types.CreateTenantRequest, options?: RequestOptions): Promise<Types.TenantResponse>;
392
+ /**
393
+ * List current user's tenants
394
+ *
395
+ * Returns all tenants the authenticated user is a member of.
396
+ * Requires authentication.
397
+ *
398
+ * @param options - Optional request options
399
+ * @returns Array of tenant information
400
+ */
401
+ listMyTenants(options?: RequestOptions): Promise<Types.TenantResponse[]>;
402
+ /**
403
+ * List tenant members
404
+ *
405
+ * Returns all members of the specified tenant.
406
+ * Requires authentication and membership in the tenant.
407
+ *
408
+ * @param tenantId - Tenant ID
409
+ * @param options - Optional request options
410
+ * @returns Array of tenant members
411
+ */
412
+ listTenantMembers(tenantId: string, options?: RequestOptions): Promise<Types.MembershipResponse[]>;
413
+ /**
414
+ * Invite a member to tenant
415
+ *
416
+ * Sends an invitation to join the tenant. Requires authentication and
417
+ * owner/admin role on the tenant.
418
+ *
419
+ * @param tenantId - Target tenant ID
420
+ * @param data - Invitation data
421
+ * @param options - Optional request options
422
+ * @returns Invitation result, including a copyable accept_url
423
+ */
424
+ inviteTenantMember(tenantId: string, data: Types.InviteMemberRequest, options?: RequestOptions): Promise<Types.InvitationResponse>;
425
+ /**
426
+ * List pending invitations issued by the authenticated caller for a tenant.
427
+ *
428
+ * Returns only invitations whose `invited_by` matches the caller. Lets the
429
+ * caller copy the `accept_url` of an invite they previously sent (for
430
+ * example, to re-share if email delivery failed). Callers without a
431
+ * membership, and members who never issued an invite for this tenant,
432
+ * get an empty array.
433
+ *
434
+ * @param tenantId - Tenant ID
435
+ * @param options - Optional request options
436
+ * @returns Array of invitations issued by the caller
437
+ */
438
+ listTenantInvitationsIssuedByMe(tenantId: string, options?: RequestOptions): Promise<Types.IssuedInvitationResponse[]>;
439
+ /**
440
+ * Update member role
441
+ *
442
+ * Updates the role of a tenant member.
443
+ * Requires authentication and owner role in the tenant.
444
+ *
445
+ * @param tenantId - Tenant ID
446
+ * @param userId - User ID of the member
447
+ * @param data - New role
448
+ * @param options - Optional request options
449
+ * @returns Updated membership information
450
+ */
451
+ updateTenantMemberRole(tenantId: string, userId: string, data: Types.UpdateMemberRoleRequest, options?: RequestOptions): Promise<Types.MembershipResponse>;
452
+ /**
453
+ * Remove member from tenant
454
+ *
455
+ * Removes a member from the tenant.
456
+ * Cannot remove the last owner.
457
+ * Requires authentication and admin/owner role in the tenant.
458
+ *
459
+ * @param tenantId - Tenant ID
460
+ * @param userId - User ID of the member to remove
461
+ * @param options - Optional request options
462
+ * @returns Success response
463
+ */
464
+ removeTenantMember(tenantId: string, userId: string, options?: RequestOptions): Promise<Types.SuccessResponse>;
465
+ /**
466
+ * Setup TOTP two-factor authentication
467
+ *
468
+ * Initializes TOTP setup and returns the secret, QR code URL, and backup codes.
469
+ * The setup must be verified with verifyTOTP() before it becomes active.
470
+ * Requires authentication.
471
+ *
472
+ * @param options - Optional request options
473
+ * @returns TOTP setup data including secret and backup codes
474
+ */
475
+ setupTOTP(options?: RequestOptions): Promise<Types.TOTPSetupResponse>;
476
+ /**
477
+ * Verify TOTP setup
478
+ *
479
+ * Verifies a TOTP code to complete the 2FA setup process.
480
+ * After verification, TOTP will be required on future logins.
481
+ * Requires authentication.
482
+ *
483
+ * @param data - TOTP verification code
484
+ * @param options - Optional request options
485
+ * @returns Success response
486
+ */
487
+ verifyTOTP(data: Types.VerifyTOTPRequest, options?: RequestOptions): Promise<Types.SuccessResponse>;
488
+ /**
489
+ * Disable TOTP two-factor authentication
490
+ *
491
+ * Disables TOTP 2FA. Requires a valid TOTP code to confirm.
492
+ * Requires authentication.
493
+ *
494
+ * @param data - TOTP code to confirm disable
495
+ * @param options - Optional request options
496
+ * @returns Success response
497
+ */
498
+ disableTOTP(data: Types.DisableTOTPRequest, options?: RequestOptions): Promise<Types.SuccessResponse>;
499
+ /**
500
+ * Begin passkey login
501
+ *
502
+ * Starts the WebAuthn authentication process.
503
+ * Returns options to pass to navigator.credentials.get().
504
+ *
505
+ * @param options - Optional request options
506
+ * @returns WebAuthn request options
507
+ */
508
+ beginPasskeyLogin(options?: RequestOptions): Promise<Types.BeginPasskeyLoginResponse>;
509
+ /**
510
+ * Complete passkey login
511
+ *
512
+ * Completes the WebAuthn authentication and returns access tokens.
513
+ *
514
+ * @param data - WebAuthn assertion result from navigator.credentials.get()
515
+ * @param options - Optional request options
516
+ * @returns Access and refresh tokens
517
+ */
518
+ finishPasskeyLogin(data: Types.FinishPasskeyLoginRequest, options?: RequestOptions): Promise<Types.AccessDataResponse>;
519
+ /**
520
+ * Begin passkey registration
521
+ *
522
+ * Starts the WebAuthn registration process for the authenticated user.
523
+ * Returns options to pass to navigator.credentials.create().
524
+ * Requires authentication.
525
+ *
526
+ * @param options - Optional request options
527
+ * @returns WebAuthn creation options
528
+ */
529
+ beginPasskeyRegistration(options?: RequestOptions): Promise<Types.BeginPasskeyRegistrationResponse>;
530
+ /**
531
+ * Complete passkey registration
532
+ *
533
+ * Completes the WebAuthn registration with the attestation result.
534
+ * Requires authentication.
535
+ *
536
+ * @param data - WebAuthn attestation result and optional passkey name
537
+ * @param options - Optional request options
538
+ * @returns Success response
539
+ */
540
+ finishPasskeyRegistration(data: Types.FinishPasskeyRegistrationRequest, options?: RequestOptions): Promise<Types.PasskeyResponse>;
541
+ /**
542
+ * List registered passkeys
543
+ *
544
+ * Returns all passkeys registered by the authenticated user.
545
+ * Requires authentication.
546
+ *
547
+ * @param options - Optional request options
548
+ * @returns Array of passkey information
549
+ */
550
+ listPasskeys(options?: RequestOptions): Promise<Types.PasskeyResponse[]>;
551
+ /**
552
+ * Delete a passkey
553
+ *
554
+ * Removes a registered passkey from the authenticated user's account.
555
+ * If the user has TOTP 2FA enabled, a valid TOTP code must be provided.
556
+ * Requires authentication.
557
+ *
558
+ * @param passkeyId - Passkey ID to delete
559
+ * @param data - Optional request body with TOTP code for 2FA verification
560
+ * @param options - Optional request options
561
+ * @returns Success response
562
+ */
563
+ deletePasskey(passkeyId: string, data?: Types.DeletePasskeyRequest, options?: RequestOptions): Promise<Types.SuccessResponse>;
564
+ /**
565
+ * Get Google OAuth authorization URL and its CSRF state.
566
+ *
567
+ * Returns `{ url, state }`. Redirect the user to `url`, and keep `state` —
568
+ * `handleGoogleOAuthCallback` requires it. When the client was constructed
569
+ * with an `oauthStateStore`, the state is persisted here automatically.
570
+ *
571
+ * @param params - Query parameters including redirect_uri
572
+ * @param options - Optional request options
573
+ * @returns The authorization URL and the single-use state to round-trip
574
+ */
575
+ getGoogleOAuthURL(params: {
576
+ redirect_uri: string;
577
+ }, options?: RequestOptions): Promise<Types.GoogleOAuthURLResponse>;
578
+ /**
579
+ * Handle Google OAuth callback
580
+ *
581
+ * Exchanges the Google OAuth authorization code for access tokens.
582
+ * Creates a new user if one doesn't exist with the Google email.
583
+ *
584
+ * The `state` from `getGoogleOAuthURL` is **required**: the server validates
585
+ * it before exchanging the code, and rejects a mismatch, absence, expiry or
586
+ * reuse. See {@link Types.GoogleOAuthCallbackRequest.state}.
587
+ *
588
+ * @param data - OAuth callback data: code, redirect_uri and state
589
+ * @param options - Optional request options
590
+ * @returns Access and refresh tokens
591
+ * @throws {MPFValidationError} If `state` is missing or empty (client-side).
592
+ */
593
+ handleGoogleOAuthCallback(data: Types.GoogleOAuthCallbackRequest, options?: RequestOptions): Promise<Types.AccessDataResponse>;
594
+ }
@@ -0,0 +1,50 @@
1
+ /**
2
+ * MPF SDK — root barrel.
3
+ *
4
+ * The root exposes the four non-React modules as NAMESPACES rather than as flat
5
+ * re-exports, so that a name is always qualified by the layer it belongs to:
6
+ *
7
+ * ```ts
8
+ * import { client, auth, identity, storage } from '@mosano-product-framework/sdk';
9
+ *
10
+ * const api = identity.createAuthClient({ baseUrl });
11
+ * const selection = auth.createTenantSelection();
12
+ * if (err instanceof client.MPFAPIError) { ... }
13
+ * ```
14
+ *
15
+ * A default export with the same shape is provided for
16
+ * `import sdk from '@mosano-product-framework/sdk'`.
17
+ *
18
+ * ## What is deliberately NOT here
19
+ *
20
+ * **`react`.** Not even as a namespace. React is an OPTIONAL peer dependency; a
21
+ * static re-export from this file would put `react` in the module graph of every
22
+ * consumer, so merely importing the package would require React to be installed
23
+ * — breaking plain-Node consumers (this repo's own `e2e/` suite among them).
24
+ * Import from `@mosano-product-framework/sdk/react`.
25
+ *
26
+ * **`createGraphQLClient` / `createGraphQLWsTransport`.** Same reasoning for the
27
+ * optional `graphql-ws` peer: the `client` namespace below is the peer-free half
28
+ * of `./client`. Import from `@mosano-product-framework/sdk/client` for
29
+ * subscriptions.
30
+ *
31
+ * Both rules are enforced by `tests/module-boundaries.test.ts`.
32
+ *
33
+ * @packageDocumentation
34
+ */
35
+ export * as client from './client/peer-free.js';
36
+ export * as auth from './auth/index.js';
37
+ export * as identity from './identity/index.js';
38
+ export * as storage from './storage/index.js';
39
+ import * as clientNs from './client/peer-free.js';
40
+ import * as authNs from './auth/index.js';
41
+ import * as identityNs from './identity/index.js';
42
+ import * as storageNs from './storage/index.js';
43
+ /** Same shape as the named namespace exports above. */
44
+ declare const _default: {
45
+ client: typeof clientNs;
46
+ auth: typeof authNs;
47
+ identity: typeof identityNs;
48
+ storage: typeof storageNs;
49
+ };
50
+ export default _default;
package/dist/index.js ADDED
@@ -0,0 +1,24 @@
1
+ import { peer_free_exports } from './chunk-GQJ3QQPH.js';
2
+ export { peer_free_exports as client } from './chunk-GQJ3QQPH.js';
3
+ import { auth_exports } from './chunk-GPWGOYCA.js';
4
+ export { auth_exports as auth } from './chunk-GPWGOYCA.js';
5
+ import { identity_exports } from './chunk-XAXFIIRT.js';
6
+ export { identity_exports as identity } from './chunk-XAXFIIRT.js';
7
+ import './chunk-K2ELAI2X.js';
8
+ import { storage_exports } from './chunk-EXPYHNPV.js';
9
+ export { storage_exports as storage } from './chunk-EXPYHNPV.js';
10
+ import './chunk-LRM6JJ63.js';
11
+ import './chunk-7WAV52EO.js';
12
+ import './chunk-AJWM5MDZ.js';
13
+
14
+ // src/index.ts
15
+ var src_default = {
16
+ client: peer_free_exports,
17
+ auth: auth_exports,
18
+ identity: identity_exports,
19
+ storage: storage_exports
20
+ };
21
+
22
+ export { src_default as default };
23
+ //# sourceMappingURL=index.js.map
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AA8CA,IAAO,WAAA,GAAQ;AAAA,EACb,MAAA,EAAQ,iBAAA;AAAA,EACR,IAAA,EAAM,YAAA;AAAA,EACN,QAAA,EAAU,gBAAA;AAAA,EACV,OAAA,EAAS;AACX","file":"index.js","sourcesContent":["/**\n * MPF SDK — root barrel.\n *\n * The root exposes the four non-React modules as NAMESPACES rather than as flat\n * re-exports, so that a name is always qualified by the layer it belongs to:\n *\n * ```ts\n * import { client, auth, identity, storage } from '@mosano-product-framework/sdk';\n *\n * const api = identity.createAuthClient({ baseUrl });\n * const selection = auth.createTenantSelection();\n * if (err instanceof client.MPFAPIError) { ... }\n * ```\n *\n * A default export with the same shape is provided for\n * `import sdk from '@mosano-product-framework/sdk'`.\n *\n * ## What is deliberately NOT here\n *\n * **`react`.** Not even as a namespace. React is an OPTIONAL peer dependency; a\n * static re-export from this file would put `react` in the module graph of every\n * consumer, so merely importing the package would require React to be installed\n * — breaking plain-Node consumers (this repo's own `e2e/` suite among them).\n * Import from `@mosano-product-framework/sdk/react`.\n *\n * **`createGraphQLClient` / `createGraphQLWsTransport`.** Same reasoning for the\n * optional `graphql-ws` peer: the `client` namespace below is the peer-free half\n * of `./client`. Import from `@mosano-product-framework/sdk/client` for\n * subscriptions.\n *\n * Both rules are enforced by `tests/module-boundaries.test.ts`.\n *\n * @packageDocumentation\n */\n\nexport * as client from './client/peer-free.js';\nexport * as auth from './auth/index.js';\nexport * as identity from './identity/index.js';\nexport * as storage from './storage/index.js';\n\nimport * as clientNs from './client/peer-free.js';\nimport * as authNs from './auth/index.js';\nimport * as identityNs from './identity/index.js';\nimport * as storageNs from './storage/index.js';\n\n/** Same shape as the named namespace exports above. */\nexport default {\n client: clientNs,\n auth: authNs,\n identity: identityNs,\n storage: storageNs,\n};\n"]}