@descope/node-sdk 1.6.1 → 1.6.3

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.d.ts CHANGED
@@ -1,8 +1,23 @@
1
1
  import * as _descope_core_js_sdk from '@descope/core-js-sdk';
2
- import _descope_core_js_sdk__default, { UserResponse, SdkResponse, ExchangeAccessKeyResponse } from '@descope/core-js-sdk';
2
+ import _descope_core_js_sdk__default, { DeliveryMethod, UserResponse, SdkResponse, ExchangeAccessKeyResponse } from '@descope/core-js-sdk';
3
3
  export { DeliveryMethod, JWTResponse, OAuthProvider, ResponseData, SdkResponse } from '@descope/core-js-sdk';
4
4
  import { JWTHeaderParameters, KeyLike } from 'jose';
5
5
 
6
+ /** Parsed JWT token */
7
+ interface Token {
8
+ sub?: string;
9
+ exp?: number;
10
+ iss?: string;
11
+ [claim: string]: unknown;
12
+ }
13
+ /** All information regarding token including the raw JWT, parsed JWT and cookies */
14
+ interface AuthenticationInfo {
15
+ jwt: string;
16
+ token: Token;
17
+ cookies?: string[];
18
+ }
19
+ declare type DeliveryMethodForTestUser = DeliveryMethod | 'Embedded';
20
+
6
21
  /** Represents a tenant association for a User or Access Key. The tenantId is required to denote
7
22
  * which tenant the user or access key belongs to. The roleNames array is an optional list of
8
23
  * roles for the user or access key in this specific tenant.
@@ -57,6 +72,7 @@ declare type Tenant = {
57
72
  id: string;
58
73
  name: string;
59
74
  selfProvisioningDomains: string[];
75
+ customAttributes?: Record<string, string | number | boolean>;
60
76
  };
61
77
  /** Represents a permission in a project. It has a name and optionally a description.
62
78
  * It also has a flag indicating whether it is system default or not.
@@ -152,6 +168,7 @@ declare type User = {
152
168
  verifiedEmail?: boolean;
153
169
  verifiedPhone?: boolean;
154
170
  test?: boolean;
171
+ additionalLoginIds?: string[];
155
172
  };
156
173
  declare type UserMapping = {
157
174
  name: string;
@@ -180,6 +197,7 @@ declare type SSOSettingsResponse = {
180
197
  userMapping: UserMapping;
181
198
  groupsMapping: GroupsMapping[];
182
199
  redirectUrl: string;
200
+ domains: string[];
183
201
  domain: string;
184
202
  };
185
203
  declare type ProviderTokenResponse = {
@@ -307,38 +325,48 @@ declare type AuthzRelationQuery = {
307
325
  target: string;
308
326
  hasRelation?: boolean;
309
327
  };
310
- declare type NewProjectResponse = {
328
+ /**
329
+ * AuthzModified has the list of resources and targets that were modified since given time returned from GetModified
330
+ */
331
+ declare type AuthzModified = {
332
+ resources: string[];
333
+ targets: string[];
334
+ schemaChanged: boolean;
335
+ };
336
+ declare type CloneProjectResponse = {
311
337
  projectId: string;
312
338
  projectName: string;
313
- projectSettingsWeb: Record<string, any>;
314
- authMethodsMagicLink: Record<string, any>;
315
- authMethodsOTP: Record<string, any>;
316
- authMethodsSAML: Record<string, any>;
317
- authMethodsOAuth: Record<string, any>;
318
- authMethodsWebAuthn: Record<string, any>;
319
- authMethodsTOTP: Record<string, any>;
320
- messagingProvidersWeb: Record<string, any>;
321
- authMethodsEnchantedLink: Record<string, any>;
322
- authMethodsPassword: Record<string, any>;
323
- authMethodsOIDCIDP: Record<string, any>;
324
- authMethodsEmbeddedLink: Record<string, any>;
325
339
  tag?: string;
326
340
  };
327
341
 
328
- /** Parsed JWT token */
329
- interface Token {
330
- sub?: string;
331
- exp?: number;
332
- iss?: string;
333
- [claim: string]: unknown;
334
- }
335
- /** All information regarding token including the raw JWT, parsed JWT and cookies */
336
- interface AuthenticationInfo {
337
- jwt: string;
338
- token: Token;
339
- cookies?: string[];
342
+ interface UserOptions {
343
+ email?: string;
344
+ phone?: string;
345
+ displayName?: string;
346
+ roles?: string[];
347
+ userTenants?: AssociatedTenant[];
348
+ customAttributes?: Record<string, AttributesTypes>;
349
+ picture?: string;
350
+ verifiedEmail?: boolean;
351
+ verifiedPhone?: boolean;
352
+ givenName?: string;
353
+ middleName?: string;
354
+ familyName?: string;
355
+ additionalLoginIds?: string[];
340
356
  }
341
357
 
358
+ /** Common Error Codes */
359
+ declare const descopeErrors: {
360
+ badRequest: string;
361
+ missingArguments: string;
362
+ invalidRequest: string;
363
+ invalidArguments: string;
364
+ wrongOTPCode: string;
365
+ tooManyOTPAttempts: string;
366
+ enchantedLinkPending: string;
367
+ userNotFound: string;
368
+ };
369
+
342
370
  /** Configuration arguments which include the Descope core SDK args and an optional management key */
343
371
  declare type NodeSdkArgs = Parameters<typeof _descope_core_js_sdk__default>[0] & {
344
372
  managementKey?: string;
@@ -348,43 +376,85 @@ declare const nodeSdk: {
348
376
  ({ managementKey, publicKey, ...config }: NodeSdkArgs): {
349
377
  management: {
350
378
  user: {
351
- create: (loginId: string, email?: string, phone?: string, displayName?: string, roles?: string[], userTenants?: AssociatedTenant[], customAttributes?: Record<string, AttributesTypes>, picture?: string, verifiedEmail?: boolean, verifiedPhone?: boolean) => Promise<SdkResponse<_descope_core_js_sdk.UserResponse>>;
352
- createTestUser: (loginId: string, email?: string, phone?: string, displayName?: string, roles?: string[], userTenants?: AssociatedTenant[], customAttributes?: Record<string, AttributesTypes>, picture?: string, verifiedEmail?: boolean, verifiedPhone?: boolean) => Promise<SdkResponse<_descope_core_js_sdk.UserResponse>>;
353
- invite: (loginId: string, email?: string, phone?: string, displayName?: string, roles?: string[], userTenants?: AssociatedTenant[], customAttributes?: Record<string, AttributesTypes>, picture?: string, verifiedEmail?: boolean, verifiedPhone?: boolean, inviteUrl?: string, sendMail?: boolean, sendSMS?: boolean) => Promise<SdkResponse<_descope_core_js_sdk.UserResponse>>;
379
+ create: {
380
+ (loginId: string, options?: UserOptions): Promise<SdkResponse<_descope_core_js_sdk.UserResponse>>;
381
+ (loginId: string, email?: string, phone?: string, displayName?: string, roles?: string[], userTenants?: AssociatedTenant[], customAttributes?: Record<string, AttributesTypes>, picture?: string, verifiedEmail?: boolean, verifiedPhone?: boolean, givenName?: string, middleName?: string, familyName?: string, additionalLoginIds?: string[]): Promise<SdkResponse<_descope_core_js_sdk.UserResponse>>;
382
+ };
383
+ createTestUser: {
384
+ (loginId: string, options?: UserOptions): Promise<SdkResponse<_descope_core_js_sdk.UserResponse>>;
385
+ (loginId: string, email?: string, phone?: string, displayName?: string, roles?: string[], userTenants?: AssociatedTenant[], customAttributes?: Record<string, AttributesTypes>, picture?: string, verifiedEmail?: boolean, verifiedPhone?: boolean, givenName?: string, middleName?: string, familyName?: string, additionalLoginIds?: string[]): Promise<SdkResponse<_descope_core_js_sdk.UserResponse>>;
386
+ };
387
+ invite: {
388
+ (loginId: string, options?: UserOptions & {
389
+ inviteUrl?: string;
390
+ sendMail?: boolean;
391
+ sendSMS?: boolean;
392
+ }): Promise<SdkResponse<_descope_core_js_sdk.UserResponse>>;
393
+ (loginId: string, email?: string, phone?: string, displayName?: string, roles?: string[], userTenants?: AssociatedTenant[], customAttributes?: Record<string, AttributesTypes>, picture?: string, verifiedEmail?: boolean, verifiedPhone?: boolean, inviteUrl?: string, sendMail?: boolean, sendSMS?: boolean, givenName?: string, middleName?: string, familyName?: string, additionalLoginIds?: string[]): Promise<SdkResponse<_descope_core_js_sdk.UserResponse>>;
394
+ }; /**
395
+ * Retrieves the roles from JWT top level claims that match the specified roles list
396
+ * @param authInfo JWT parsed info containing the roles
397
+ * @param roles List of roles to match against the JWT claims
398
+ * @returns An array of roles that are both in the JWT claims and the specified list. Returns an empty array if no matches are found
399
+ */
354
400
  inviteBatch: (users: User[], inviteUrl?: string, sendMail?: boolean, sendSMS?: boolean) => Promise<SdkResponse<InviteBatchResponse>>;
355
- update: (loginId: string, email?: string, phone?: string, displayName?: string, roles?: string[], userTenants?: AssociatedTenant[], customAttributes?: Record<string, AttributesTypes>, picture?: string, verifiedEmail?: boolean, verifiedPhone?: boolean) => Promise<SdkResponse<_descope_core_js_sdk.UserResponse>>;
401
+ update: {
402
+ (loginId: string, options?: UserOptions): Promise<SdkResponse<_descope_core_js_sdk.UserResponse>>;
403
+ (loginId: string, email?: string, phone?: string, displayName?: string, roles?: string[], userTenants?: AssociatedTenant[], customAttributes?: Record<string, AttributesTypes>, picture?: string, verifiedEmail?: boolean, verifiedPhone?: boolean, givenName?: string, middleName?: string, familyName?: string, additionalLoginIds?: string[]): Promise<SdkResponse<_descope_core_js_sdk.UserResponse>>;
404
+ };
356
405
  delete: (loginId: string) => Promise<SdkResponse<never>>;
406
+ deleteByUserId: (userId: string) => Promise<SdkResponse<_descope_core_js_sdk.UserResponse>>;
357
407
  deleteAllTestUsers: () => Promise<SdkResponse<never>>;
358
408
  load: (loginId: string) => Promise<SdkResponse<_descope_core_js_sdk.UserResponse>>;
359
409
  loadByUserId: (userId: string) => Promise<SdkResponse<_descope_core_js_sdk.UserResponse>>;
360
410
  logoutUser: (loginId: string) => Promise<SdkResponse<never>>;
361
411
  logoutUserByUserId: (userId: string) => Promise<SdkResponse<never>>;
362
412
  searchAll: (tenantIds?: string[], roles?: string[], limit?: number, page?: number, testUsersOnly?: boolean, withTestUser?: boolean, customAttributes?: Record<string, AttributesTypes>, statuses?: UserStatus[], emails?: string[], phones?: string[]) => Promise<SdkResponse<_descope_core_js_sdk.UserResponse[]>>;
413
+ search: (searchReq: {
414
+ page?: number;
415
+ limit?: number;
416
+ sort?: {
417
+ field: string;
418
+ desc?: boolean;
419
+ }[];
420
+ text?: string;
421
+ emails?: string[];
422
+ phones?: string[];
423
+ statuses?: UserStatus[];
424
+ roles?: string[];
425
+ tenantIds?: string[];
426
+ customAttributes?: Record<string, AttributesTypes>;
427
+ withTestUser?: boolean;
428
+ testUsersOnly?: boolean;
429
+ }) => Promise<SdkResponse<_descope_core_js_sdk.UserResponse[]>>;
363
430
  getProviderToken: (loginId: string, provider: string) => Promise<SdkResponse<ProviderTokenResponse>>;
364
431
  activate: (loginId: string) => Promise<SdkResponse<_descope_core_js_sdk.UserResponse>>;
365
432
  deactivate: (loginId: string) => Promise<SdkResponse<_descope_core_js_sdk.UserResponse>>;
366
433
  updateLoginId: (loginId: string, newLoginId?: string) => Promise<SdkResponse<_descope_core_js_sdk.UserResponse>>;
367
434
  updateEmail: (loginId: string, email: string, isVerified: boolean) => Promise<SdkResponse<_descope_core_js_sdk.UserResponse>>;
368
435
  updatePhone: (loginId: string, phone: string, isVerified: boolean) => Promise<SdkResponse<_descope_core_js_sdk.UserResponse>>;
369
- updateDisplayName: (loginId: string, displayName: string) => Promise<SdkResponse<_descope_core_js_sdk.UserResponse>>;
436
+ updateDisplayName: (loginId: string, displayName?: string, givenName?: string, middleName?: string, familyName?: string) => Promise<SdkResponse<_descope_core_js_sdk.UserResponse>>;
370
437
  updatePicture: (loginId: string, picture: string) => Promise<SdkResponse<_descope_core_js_sdk.UserResponse>>;
371
438
  updateCustomAttribute: (loginId: string, attributeKey: string, attributeValue: AttributesTypes) => Promise<SdkResponse<_descope_core_js_sdk.UserResponse>>;
439
+ setRoles: (loginId: string, roles: string[]) => Promise<SdkResponse<_descope_core_js_sdk.UserResponse>>;
372
440
  addRoles: (loginId: string, roles: string[]) => Promise<SdkResponse<_descope_core_js_sdk.UserResponse>>;
373
441
  removeRoles: (loginId: string, roles: string[]) => Promise<SdkResponse<_descope_core_js_sdk.UserResponse>>;
374
442
  addTenant: (loginId: string, tenantId: string) => Promise<SdkResponse<_descope_core_js_sdk.UserResponse>>;
375
443
  removeTenant: (loginId: string, tenantId: string) => Promise<SdkResponse<_descope_core_js_sdk.UserResponse>>;
444
+ setTenantRoles: (loginId: string, tenantId: string, roles: string[]) => Promise<SdkResponse<_descope_core_js_sdk.UserResponse>>;
376
445
  addTenantRoles: (loginId: string, tenantId: string, roles: string[]) => Promise<SdkResponse<_descope_core_js_sdk.UserResponse>>;
377
446
  removeTenantRoles: (loginId: string, tenantId: string, roles: string[]) => Promise<SdkResponse<_descope_core_js_sdk.UserResponse>>;
378
- generateOTPForTestUser: (deliveryMethod: "email" | "sms" | "whatsapp", loginId: string) => Promise<SdkResponse<GenerateOTPForTestResponse>>;
379
- generateMagicLinkForTestUser: (deliveryMethod: "email" | "sms" | "whatsapp", loginId: string, uri: string) => Promise<SdkResponse<GenerateMagicLinkForTestResponse>>;
380
- generateEnchantedLinkForTestUser: (loginId: string, uri: string) => Promise<SdkResponse<GenerateEnchantedLinkForTestResponse>>;
447
+ generateOTPForTestUser: (deliveryMethod: DeliveryMethodForTestUser, loginId: string, loginOptions?: _descope_core_js_sdk.LoginOptions) => Promise<SdkResponse<GenerateOTPForTestResponse>>;
448
+ generateMagicLinkForTestUser: (deliveryMethod: DeliveryMethodForTestUser, loginId: string, uri: string, loginOptions?: _descope_core_js_sdk.LoginOptions) => Promise<SdkResponse<GenerateMagicLinkForTestResponse>>;
449
+ generateEnchantedLinkForTestUser: (loginId: string, uri: string, loginOptions?: _descope_core_js_sdk.LoginOptions) => Promise<SdkResponse<GenerateEnchantedLinkForTestResponse>>;
381
450
  generateEmbeddedLink: (loginId: string, customClaims?: Record<string, any>) => Promise<SdkResponse<GenerateEmbeddedLinkResponse>>;
382
451
  setPassword: (loginId: string, password: string) => Promise<SdkResponse<never>>;
383
452
  expirePassword: (loginId: string) => Promise<SdkResponse<never>>;
453
+ removeAllPasskeys: (loginId: string) => Promise<SdkResponse<never>>;
384
454
  };
385
455
  project: {
386
456
  updateName: (name: string) => Promise<SdkResponse<never>>;
387
- clone: (name: string, tag?: "production") => Promise<SdkResponse<NewProjectResponse>>;
457
+ clone: (name: string, tag?: "production") => Promise<SdkResponse<CloneProjectResponse>>;
388
458
  };
389
459
  accessKey: {
390
460
  create: (name: string, expireTime: number, roles?: string[], keyTenants?: AssociatedTenant[]) => Promise<SdkResponse<CreatedAccessKeyResponse>>;
@@ -407,8 +477,8 @@ declare const nodeSdk: {
407
477
  sso: {
408
478
  getSettings: (tenantId: string) => Promise<SdkResponse<SSOSettingsResponse>>;
409
479
  deleteSettings: (tenantId: string) => Promise<SdkResponse<never>>;
410
- configureSettings: (tenantId: string, idpURL: string, idpCert: string, entityId: string, redirectURL: string, domain: string) => Promise<SdkResponse<never>>;
411
- configureMetadata: (tenantId: string, idpMetadataURL: string, redirectURL: string, domain: string) => Promise<SdkResponse<never>>;
480
+ configureSettings: (tenantId: string, idpURL: string, idpCert: string, entityId: string, redirectURL: string, domains: string[]) => Promise<SdkResponse<never>>;
481
+ configureMetadata: (tenantId: string, idpMetadataURL: string, redirectURL: string, domains: string[]) => Promise<SdkResponse<never>>;
412
482
  configureMapping: (tenantId: string, roleMappings?: RoleMappings, attributeMapping?: AttributeMapping) => Promise<SdkResponse<never>>;
413
483
  };
414
484
  jwt: {
@@ -433,6 +503,7 @@ declare const nodeSdk: {
433
503
  };
434
504
  flow: {
435
505
  list: () => Promise<SdkResponse<FlowsResponse>>;
506
+ delete: (flowIds: string[]) => Promise<SdkResponse<never>>;
436
507
  export: (flowId: string) => Promise<SdkResponse<FlowResponse>>;
437
508
  import: (flowId: string, flow: Flow, screens?: Screen[]) => Promise<SdkResponse<FlowResponse>>;
438
509
  };
@@ -459,6 +530,7 @@ declare const nodeSdk: {
459
530
  resourceRelations: (resource: string) => Promise<SdkResponse<AuthzRelation[]>>;
460
531
  targetsRelations: (targets: string[]) => Promise<SdkResponse<AuthzRelation[]>>;
461
532
  whatCanTargetAccess: (target: string) => Promise<SdkResponse<AuthzRelation[]>>;
533
+ getModified: (since: Date) => Promise<SdkResponse<AuthzModified>>;
462
534
  };
463
535
  };
464
536
  getKey: (header: JWTHeaderParameters) => Promise<KeyLike | Uint8Array>;
@@ -468,9 +540,13 @@ declare const nodeSdk: {
468
540
  validateAndRefreshSession: (sessionToken?: string, refreshToken?: string) => Promise<AuthenticationInfo>;
469
541
  exchangeAccessKey: (accessKey: string) => Promise<AuthenticationInfo>;
470
542
  validatePermissions: (authInfo: AuthenticationInfo, permissions: string[]) => boolean;
543
+ getMatchedPermissions: (authInfo: AuthenticationInfo, permissions: string[]) => string[];
471
544
  validateTenantPermissions: (authInfo: AuthenticationInfo, tenant: string, permissions: string[]) => boolean;
545
+ getMatchedTenantPermissions: (authInfo: AuthenticationInfo, tenant: string, permissions: string[]) => string[];
472
546
  validateRoles: (authInfo: AuthenticationInfo, roles: string[]) => boolean;
547
+ getMatchedRoles: (authInfo: AuthenticationInfo, roles: string[]) => string[];
473
548
  validateTenantRoles: (authInfo: AuthenticationInfo, tenant: string, roles: string[]) => boolean;
549
+ getMatchedTenantRoles: (authInfo: AuthenticationInfo, tenant: string, roles: string[]) => string[];
474
550
  accessKey: {
475
551
  exchange: (accessKey: string) => Promise<SdkResponse<ExchangeAccessKeyResponse>>;
476
552
  };
@@ -490,13 +566,13 @@ declare const nodeSdk: {
490
566
  }>>;
491
567
  };
492
568
  signIn: {
493
- sms: (loginId: string) => Promise<SdkResponse<{
569
+ sms: (loginId: string, loginOptions?: _descope_core_js_sdk.LoginOptions, token?: string) => Promise<SdkResponse<{
494
570
  maskedPhone: string;
495
571
  }>>;
496
- whatsapp: (loginId: string) => Promise<SdkResponse<{
572
+ whatsapp: (loginId: string, loginOptions?: _descope_core_js_sdk.LoginOptions, token?: string) => Promise<SdkResponse<{
497
573
  maskedPhone: string;
498
574
  }>>;
499
- email: (loginId: string) => Promise<SdkResponse<{
575
+ email: (loginId: string, loginOptions?: _descope_core_js_sdk.LoginOptions, token?: string) => Promise<SdkResponse<{
500
576
  maskedEmail: string;
501
577
  }>>;
502
578
  };
@@ -504,33 +580,57 @@ declare const nodeSdk: {
504
580
  sms: (loginId: string, user?: {
505
581
  email?: string;
506
582
  name?: string;
583
+ givenName?: string;
584
+ middleName?: string;
585
+ familyName?: string;
507
586
  phone?: string;
587
+ }, signUpOptions?: {
588
+ customClaims?: Record<string, any>;
589
+ templateOptions?: {
590
+ [x: string]: string;
591
+ };
508
592
  }) => Promise<SdkResponse<{
509
593
  maskedPhone: string;
510
594
  }>>;
511
595
  whatsapp: (loginId: string, user?: {
512
596
  email?: string;
513
597
  name?: string;
598
+ givenName?: string;
599
+ middleName?: string;
600
+ familyName?: string;
514
601
  phone?: string;
602
+ }, signUpOptions?: {
603
+ customClaims?: Record<string, any>;
604
+ templateOptions?: {
605
+ [x: string]: string;
606
+ };
515
607
  }) => Promise<SdkResponse<{
516
608
  maskedPhone: string;
517
609
  }>>;
518
610
  email: (loginId: string, user?: {
519
611
  email?: string;
520
612
  name?: string;
613
+ givenName?: string;
614
+ middleName?: string;
615
+ familyName?: string;
521
616
  phone?: string;
617
+ }, signUpOptions?: {
618
+ customClaims?: Record<string, any>;
619
+ templateOptions?: {
620
+ [x: string]: string;
621
+ };
522
622
  }) => Promise<SdkResponse<{
523
623
  maskedEmail: string;
524
624
  }>>;
525
625
  };
526
626
  signUpOrIn: {
527
- sms: (loginId: string) => Promise<SdkResponse<{
627
+ sms: (loginId: string, loginOptions?: _descope_core_js_sdk.LoginOptions, token?: string) => Promise<SdkResponse<{
528
628
  maskedPhone: string;
529
629
  }>>;
530
- whatsapp: (loginId: string) => Promise<SdkResponse<{
630
+ whatsapp: (loginId: string, loginOptions?: _descope_core_js_sdk.LoginOptions, token?: string) => Promise<SdkResponse<{
531
631
  maskedPhone: string;
532
632
  }>>;
533
- email: (loginId: string) => Promise<SdkResponse<{
633
+ email: (loginId: string, loginOptions?: _descope_core_js_sdk.LoginOptions, token?: string) => Promise<SdkResponse<{
534
634
  maskedEmail: string;
535
635
  }>>;
536
636
  };
@@ -538,6 +638,9 @@ declare const nodeSdk: {
538
638
  email: <T extends boolean>(loginId: string, email: string, token?: string, updateOptions?: {
539
639
  addToLoginIDs?: T;
540
640
  onMergeUseExisting?: T extends true ? boolean : never;
641
+ templateOptions?: {
642
+ [x: string]: string;
643
+ };
541
644
  }) => Promise<SdkResponse<{
542
645
  maskedEmail: string;
543
646
  }>>;
@@ -545,12 +648,18 @@ declare const nodeSdk: {
545
648
  sms: <T_1 extends boolean>(loginId: string, phone: string, token?: string, updateOptions?: {
546
649
  addToLoginIDs?: T_1;
547
650
  onMergeUseExisting?: T_1 extends true ? boolean : never;
651
+ templateOptions?: {
652
+ [x: string]: string;
653
+ };
548
654
  }) => Promise<SdkResponse<{
549
655
  maskedPhone: string;
550
656
  }>>;
551
657
  whatsapp: <T_1 extends boolean>(loginId: string, phone: string, token?: string, updateOptions?: {
552
658
  addToLoginIDs?: T_1;
553
659
  onMergeUseExisting?: T_1 extends true ? boolean : never;
660
+ templateOptions?: {
661
+ [x: string]: string;
662
+ };
554
663
  }) => Promise<SdkResponse<{
555
664
  maskedPhone: string;
556
665
  }>>;
@@ -563,47 +672,86 @@ declare const nodeSdk: {
563
672
  cookies?: string[];
564
673
  }>>;
565
674
  signIn: {
566
- sms: (loginId: string, uri: string) => Promise<SdkResponse<{
675
+ sms: (loginId: string, URI: string, loginOptions?: _descope_core_js_sdk.LoginOptions, token?: string) => Promise<SdkResponse<{
567
676
  maskedPhone: string;
568
677
  }>>;
569
- whatsapp: (loginId: string, uri: string) => Promise<SdkResponse<{
678
+ whatsapp: (loginId: string, URI: string, loginOptions?: _descope_core_js_sdk.LoginOptions, token?: string) => Promise<SdkResponse<{
570
679
  maskedPhone: string;
571
680
  }>>;
572
- email: (loginId: string, uri: string) => Promise<SdkResponse<{
681
+ email: (loginId: string, URI: string, loginOptions?: _descope_core_js_sdk.LoginOptions, token?: string) => Promise<SdkResponse<{
573
682
  maskedEmail: string;
574
683
  }>>;
575
684
  };
576
685
  signUp: {
577
- sms: (loginId: string, uri: string, user?: {
686
+ sms: (loginId: string, URI: string, user?: {
578
687
  email?: string;
579
688
  name?: string;
689
+ givenName?: string;
690
+ middleName?: string;
691
+ familyName?: string;
580
692
  phone?: string;
693
+ }, signUpOptions?: {
694
+ customClaims?: Record<string, any>;
695
+ templateOptions?: {
696
+ [x: string]: string;
697
+ };
581
698
  }) => Promise<SdkResponse<{
582
699
  maskedPhone: string;
583
700
  }>>;
584
- whatsapp: (loginId: string, uri: string, user?: {
701
+ whatsapp: (loginId: string, URI: string, user?: {
585
702
  email?: string;
586
703
  name?: string;
704
+ givenName?: string;
705
+ middleName?: string;
706
+ familyName?: string;
587
707
  phone?: string;
708
+ }, signUpOptions?: {
709
+ customClaims?: Record<string, any>;
710
+ templateOptions?: {
711
+ [x: string]: string;
712
+ };
588
713
  }) => Promise<SdkResponse<{
589
714
  maskedPhone: string;
590
715
  }>>;
591
- email: (loginId: string, uri: string, user?: {
716
+ email: (loginId: string, URI: string, user?: {
592
717
  email?: string;
593
718
  name?: string;
719
+ givenName?: string;
720
+ middleName?: string;
721
+ familyName?: string;
594
722
  phone?: string;
723
+ }, signUpOptions?: {
724
+ customClaims?: Record<string, any>;
725
+ templateOptions?: {
726
+ [x: string]: string;
727
+ };
595
728
  }) => Promise<SdkResponse<{
596
729
  maskedEmail: string;
597
730
  }>>;
598
731
  };
599
732
  signUpOrIn: {
600
- sms: (loginId: string, uri: string) => Promise<SdkResponse<{
733
+ sms: (loginId: string, URI?: string, signUpOptions?: {
734
+ customClaims?: Record<string, any>;
735
+ templateOptions?: {
736
+ [x: string]: string;
737
+ };
738
+ }) => Promise<SdkResponse<{
601
739
  maskedPhone: string;
602
740
  }>>;
603
- whatsapp: (loginId: string, uri: string) => Promise<SdkResponse<{
741
+ whatsapp: (loginId: string, URI?: string, signUpOptions?: {
742
+ customClaims?: Record<string, any>;
743
+ templateOptions?: {
744
+ [x: string]: string;
745
+ };
746
+ }) => Promise<SdkResponse<{
604
747
  maskedPhone: string;
605
748
  }>>;
606
- email: (loginId: string, uri: string) => Promise<SdkResponse<{
749
+ email: (loginId: string, URI?: string, signUpOptions?: {
750
+ customClaims?: Record<string, any>;
751
+ templateOptions?: {
752
+ [x: string]: string;
753
+ };
754
+ }) => Promise<SdkResponse<{
607
755
  maskedEmail: string;
608
756
  }>>;
609
757
  };
@@ -611,6 +759,9 @@ declare const nodeSdk: {
611
759
  email: <T_2 extends boolean>(loginId: string, email: string, URI?: string, token?: string, updateOptions?: {
612
760
  addToLoginIDs?: T_2;
613
761
  onMergeUseExisting?: T_2 extends true ? boolean : never;
762
+ templateOptions?: {
763
+ [x: string]: string;
764
+ };
614
765
  }) => Promise<SdkResponse<{
615
766
  maskedEmail: string;
616
767
  }>>;
@@ -618,12 +769,18 @@ declare const nodeSdk: {
618
769
  sms: <T_3 extends boolean>(loginId: string, phone: string, URI?: string, token?: string, updateOptions?: {
619
770
  addToLoginIDs?: T_3;
620
771
  onMergeUseExisting?: T_3 extends true ? boolean : never;
772
+ templateOptions?: {
773
+ [x: string]: string;
774
+ };
621
775
  }) => Promise<SdkResponse<{
622
776
  maskedPhone: string;
623
777
  }>>;
624
778
  whatsapp: <T_3 extends boolean>(loginId: string, phone: string, URI?: string, token?: string, updateOptions?: {
625
779
  addToLoginIDs?: T_3;
626
780
  onMergeUseExisting?: T_3 extends true ? boolean : never;
781
+ templateOptions?: {
782
+ [x: string]: string;
783
+ };
627
784
  }) => Promise<SdkResponse<{
628
785
  maskedPhone: string;
629
786
  }>>;
@@ -632,15 +789,28 @@ declare const nodeSdk: {
632
789
  };
633
790
  enchantedLink: {
634
791
  verify: (token: string) => Promise<SdkResponse<never>>;
635
- signIn: (loginId: string, uri: string) => Promise<SdkResponse<_descope_core_js_sdk.EnchantedLinkResponse & {
792
+ signIn: (loginId: string, URI?: string, loginOptions?: _descope_core_js_sdk.LoginOptions, token?: string) => Promise<SdkResponse<_descope_core_js_sdk.EnchantedLinkResponse & {
636
793
  refreshJwt?: string;
637
794
  cookies?: string[];
638
795
  }>>;
639
- signUpOrIn: (loginId: string, uri: string) => Promise<SdkResponse<_descope_core_js_sdk.EnchantedLinkResponse>>;
640
- signUp: (loginId: string, uri: string, user?: {
796
+ signUpOrIn: (loginId: string, URI?: string, signUpOptions?: {
797
+ customClaims?: Record<string, any>;
798
+ templateOptions?: {
799
+ [x: string]: string;
800
+ };
801
+ }) => Promise<SdkResponse<_descope_core_js_sdk.EnchantedLinkResponse>>;
802
+ signUp: (loginId: string, URI?: string, user?: {
641
803
  email?: string;
642
804
  name?: string;
805
+ givenName?: string;
806
+ middleName?: string;
807
+ familyName?: string;
643
808
  phone?: string;
809
+ }, signUpOptions?: {
810
+ customClaims?: Record<string, any>;
811
+ templateOptions?: {
812
+ [x: string]: string;
813
+ };
644
814
  }) => Promise<SdkResponse<_descope_core_js_sdk.EnchantedLinkResponse & {
645
815
  refreshJwt?: string;
646
816
  cookies?: string[];
@@ -653,60 +823,23 @@ declare const nodeSdk: {
653
823
  email: <T_4 extends boolean>(loginId: string, email: string, URI?: string, token?: string, updateOptions?: {
654
824
  addToLoginIDs?: T_4;
655
825
  onMergeUseExisting?: T_4 extends true ? boolean : never;
826
+ templateOptions?: {
827
+ [x: string]: string;
828
+ };
656
829
  }) => Promise<SdkResponse<_descope_core_js_sdk.EnchantedLinkResponse>>;
657
830
  };
658
831
  };
659
832
  oauth: {
660
- start: ((provider: string, redirectUrl?: string, loginOptions?: {
661
- stepup?: boolean;
662
- mfa?: boolean;
663
- customClaims?: Record<string, any>;
664
- }, token?: string) => Promise<SdkResponse<_descope_core_js_sdk.ResponseData>>) & {
665
- facebook: (redirectURL?: string, loginOptions?: {
666
- stepup?: boolean;
667
- mfa?: boolean;
668
- customClaims?: Record<string, any>;
669
- }, token?: string) => Promise<SdkResponse<_descope_core_js_sdk.URLResponse>>;
670
- github: (redirectURL?: string, loginOptions?: {
671
- stepup?: boolean;
672
- mfa?: boolean;
673
- customClaims?: Record<string, any>;
674
- }, token?: string) => Promise<SdkResponse<_descope_core_js_sdk.URLResponse>>;
675
- google: (redirectURL?: string, loginOptions?: {
676
- stepup?: boolean;
677
- mfa?: boolean;
678
- customClaims?: Record<string, any>;
679
- }, token?: string) => Promise<SdkResponse<_descope_core_js_sdk.URLResponse>>;
680
- microsoft: (redirectURL?: string, loginOptions?: {
681
- stepup?: boolean;
682
- mfa?: boolean;
683
- customClaims?: Record<string, any>;
684
- }, token?: string) => Promise<SdkResponse<_descope_core_js_sdk.URLResponse>>;
685
- gitlab: (redirectURL?: string, loginOptions?: {
686
- stepup?: boolean;
687
- mfa?: boolean;
688
- customClaims?: Record<string, any>;
689
- }, token?: string) => Promise<SdkResponse<_descope_core_js_sdk.URLResponse>>;
690
- apple: (redirectURL?: string, loginOptions?: {
691
- stepup?: boolean;
692
- mfa?: boolean;
693
- customClaims?: Record<string, any>;
694
- }, token?: string) => Promise<SdkResponse<_descope_core_js_sdk.URLResponse>>;
695
- discord: (redirectURL?: string, loginOptions?: {
696
- stepup?: boolean;
697
- mfa?: boolean;
698
- customClaims?: Record<string, any>;
699
- }, token?: string) => Promise<SdkResponse<_descope_core_js_sdk.URLResponse>>;
700
- linkedin: (redirectURL?: string, loginOptions?: {
701
- stepup?: boolean;
702
- mfa?: boolean;
703
- customClaims?: Record<string, any>;
704
- }, token?: string) => Promise<SdkResponse<_descope_core_js_sdk.URLResponse>>;
705
- slack: (redirectURL?: string, loginOptions?: {
706
- stepup?: boolean;
707
- mfa?: boolean;
708
- customClaims?: Record<string, any>;
709
- }, token?: string) => Promise<SdkResponse<_descope_core_js_sdk.URLResponse>>;
833
+ start: ((provider: string, redirectUrl?: string, loginOptions?: _descope_core_js_sdk.LoginOptions, token?: string) => Promise<SdkResponse<_descope_core_js_sdk.ResponseData>>) & {
834
+ facebook: (redirectURL?: string, loginOptions?: _descope_core_js_sdk.LoginOptions, token?: string) => Promise<SdkResponse<_descope_core_js_sdk.URLResponse>>;
835
+ github: (redirectURL?: string, loginOptions?: _descope_core_js_sdk.LoginOptions, token?: string) => Promise<SdkResponse<_descope_core_js_sdk.URLResponse>>;
836
+ google: (redirectURL?: string, loginOptions?: _descope_core_js_sdk.LoginOptions, token?: string) => Promise<SdkResponse<_descope_core_js_sdk.URLResponse>>;
837
+ microsoft: (redirectURL?: string, loginOptions?: _descope_core_js_sdk.LoginOptions, token?: string) => Promise<SdkResponse<_descope_core_js_sdk.URLResponse>>;
838
+ gitlab: (redirectURL?: string, loginOptions?: _descope_core_js_sdk.LoginOptions, token?: string) => Promise<SdkResponse<_descope_core_js_sdk.URLResponse>>;
839
+ apple: (redirectURL?: string, loginOptions?: _descope_core_js_sdk.LoginOptions, token?: string) => Promise<SdkResponse<_descope_core_js_sdk.URLResponse>>;
840
+ discord: (redirectURL?: string, loginOptions?: _descope_core_js_sdk.LoginOptions, token?: string) => Promise<SdkResponse<_descope_core_js_sdk.URLResponse>>;
841
+ linkedin: (redirectURL?: string, loginOptions?: _descope_core_js_sdk.LoginOptions, token?: string) => Promise<SdkResponse<_descope_core_js_sdk.URLResponse>>;
842
+ slack: (redirectURL?: string, loginOptions?: _descope_core_js_sdk.LoginOptions, token?: string) => Promise<SdkResponse<_descope_core_js_sdk.URLResponse>>;
710
843
  };
711
844
  exchange: (code: string) => Promise<SdkResponse<_descope_core_js_sdk.JWTResponse & {
712
845
  refreshJwt?: string;
@@ -714,11 +847,7 @@ declare const nodeSdk: {
714
847
  }>>;
715
848
  };
716
849
  saml: {
717
- start: (tenantIdOrEmail: string, redirectUrl?: string, loginOptions?: {
718
- stepup?: boolean;
719
- mfa?: boolean;
720
- customClaims?: Record<string, any>;
721
- }, token?: string) => Promise<SdkResponse<_descope_core_js_sdk.URLResponse>>;
850
+ start: (tenantIdOrEmail: string, redirectUrl?: string, loginOptions?: _descope_core_js_sdk.LoginOptions, token?: string) => Promise<SdkResponse<_descope_core_js_sdk.URLResponse>>;
722
851
  exchange: (code: string) => Promise<SdkResponse<_descope_core_js_sdk.JWTResponse & {
723
852
  refreshJwt?: string;
724
853
  cookies?: string[];
@@ -728,13 +857,12 @@ declare const nodeSdk: {
728
857
  signUp: (loginId: string, user?: {
729
858
  email?: string;
730
859
  name?: string;
860
+ givenName?: string;
861
+ middleName?: string;
862
+ familyName?: string;
731
863
  phone?: string;
732
864
  }) => Promise<SdkResponse<_descope_core_js_sdk.TOTPResponse>>;
733
- verify: (loginId: string, code: string, loginOptions?: {
734
- stepup?: boolean;
735
- mfa?: boolean;
736
- customClaims?: Record<string, any>;
737
- }, token?: string) => Promise<SdkResponse<_descope_core_js_sdk.JWTResponse & {
865
+ verify: (loginId: string, code: string, loginOptions?: _descope_core_js_sdk.LoginOptions, token?: string) => Promise<SdkResponse<_descope_core_js_sdk.JWTResponse & {
738
866
  refreshJwt?: string;
739
867
  cookies?: string[];
740
868
  }>>;
@@ -753,11 +881,7 @@ declare const nodeSdk: {
753
881
  }>>;
754
882
  };
755
883
  signIn: {
756
- start: (loginId: string, origin: string, loginOptions?: {
757
- stepup?: boolean;
758
- mfa?: boolean;
759
- customClaims?: Record<string, any>;
760
- }, token?: string) => Promise<SdkResponse<{
884
+ start: (loginId: string, origin: string, loginOptions?: _descope_core_js_sdk.LoginOptions, token?: string) => Promise<SdkResponse<{
761
885
  transactionId: string;
762
886
  options: string;
763
887
  create: boolean;
@@ -787,10 +911,15 @@ declare const nodeSdk: {
787
911
  signUp: (loginId: string, password: string, user?: {
788
912
  email?: string;
789
913
  name?: string;
914
+ givenName?: string;
915
+ middleName?: string;
916
+ familyName?: string;
790
917
  phone?: string;
791
918
  }) => Promise<SdkResponse<_descope_core_js_sdk.JWTResponse>>;
792
919
  signIn: (loginId: string, password: string) => Promise<SdkResponse<_descope_core_js_sdk.JWTResponse>>;
793
- sendReset: (loginId: string, redirectUrl?: string) => Promise<SdkResponse<{
920
+ sendReset: (loginId: string, redirectUrl?: string, templateOptions?: {
921
+ [x: string]: string;
922
+ }) => Promise<SdkResponse<{
794
923
  resetMethod: string;
795
924
  pendingRef?: string;
796
925
  linkId?: string;
@@ -800,11 +929,7 @@ declare const nodeSdk: {
800
929
  replace: (loginId: string, oldPassword: string, newPassword: string) => Promise<SdkResponse<_descope_core_js_sdk.JWTResponse>>;
801
930
  policy: () => Promise<SdkResponse<{
802
931
  minLength: number;
803
- lowercase: boolean; /**
804
- * Validate the given JWT with the right key and make sure the issuer is correct
805
- * @param jwt the JWT string to parse and validate
806
- * @returns AuthenticationInfo with the parsed token and JWT. Will throw an error if validation fails.
807
- */
932
+ lowercase: boolean;
808
933
  uppercase: boolean;
809
934
  number: boolean;
810
935
  nonAlphanumeric: boolean;
@@ -833,7 +958,10 @@ declare const nodeSdk: {
833
958
  samlIdpStateId?: string;
834
959
  samlIdpUsername?: string;
835
960
  ssoAppId?: string;
961
+ oidcLoginHint?: string;
836
962
  abTestingKey?: number;
963
+ startOptionsVersion?: number;
964
+ client?: Record<string, any>;
837
965
  }, conditionInteractionId?: string, interactionId?: string, version?: number, componentsVersion?: string, input?: {
838
966
  [x: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | any)[])[])[])[])[])[])[])[])[])[])[];
839
967
  }) => Promise<SdkResponse<_descope_core_js_sdk.FlowResponse>>;
@@ -908,4 +1036,4 @@ declare const nodeSdk: {
908
1036
  SessionTokenCookieName: string;
909
1037
  };
910
1038
 
911
- export { AuthenticationInfo, nodeSdk as default };
1039
+ export { AuthenticationInfo, nodeSdk as default, descopeErrors };