@descope/node-sdk
Advanced tools
Comparing version 0.0.0-next-0e660dc4-20230313 to 0.0.0-next-0ff273e7-20230504
@@ -1,2 +0,2 @@ | ||
"use strict";var e=require("tslib"),t=require("@descope/core-js-sdk"),s=require("jose"),a=require("node-fetch-commonjs");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=n(t),r=n(a);const i=t=>async(...s)=>{var a,n,o;const r=await t(...s);if(!r.data)return r;let i=r.data,{refreshJwt:l}=i,d=e.__rest(i,["refreshJwt"]);const p=[];var m;return l?p.push(`${"DSR"}=${l}; Domain=${(null==(m=d)?void 0:m.cookieDomain)||""}; Max-Age=${(null==m?void 0:m.cookieMaxAge)||""}; Path=${(null==m?void 0:m.cookiePath)||"/"}; HttpOnly; SameSite=Strict`):(null===(a=r.response)||void 0===a?void 0:a.headers.get("set-cookie"))&&(l=((e,t)=>{const s=null==e?void 0:e.match(RegExp(`(?:^|;\\s*)${t}=([^;]*)`));return s?s[1]:null})(null===(n=r.response)||void 0===n?void 0:n.headers.get("set-cookie"),"DSR"),p.push(null===(o=r.response)||void 0===o?void 0:o.headers.get("set-cookie"))),Object.assign(Object.assign({},r),{data:Object.assign(Object.assign({},r.data),{refreshJwt:l,cookies:p})})};function l(e,t,s){var a,n;const o=s?null===(n=null===(a=e.token.tenants)||void 0===a?void 0:a[s])||void 0===n?void 0:n[t]:e.token[t];return Array.isArray(o)?o:[]}var d={create:"/v1/mgmt/user/create",update:"/v1/mgmt/user/update",delete:"/v1/mgmt/user/delete",load:"/v1/mgmt/user",search:"/v1/mgmt/user/search",updateStatus:"/v1/mgmt/user/update/status",updateEmail:"/v1/mgmt/user/update/email",updatePhone:"/v1/mgmt/user/update/phone",updateDisplayName:"/v1/mgmt/user/update/name",addRole:"/v1/mgmt/user/update/role/add",removeRole:"/v1/mgmt/user/update/role/remove",addTenant:"/v1/mgmt/user/update/tenant/add",removeTenant:"/v1/mgmt/user/update/tenant/remove"},p={create:"/v1/mgmt/accesskey/create",load:"/v1/mgmt/accesskey",search:"/v1/mgmt/accesskey/search",update:"/v1/mgmt/accesskey/update",deactivate:"/v1/mgmt/accesskey/deactivate",activate:"/v1/mgmt/accesskey/activate",delete:"/v1/mgmt/accesskey/delete"},m={create:"/v1/mgmt/tenant/create",update:"/v1/mgmt/tenant/update",delete:"/v1/mgmt/tenant/delete",loadAll:"/v1/mgmt/tenant/all"},c={configure:"/v1/mgmt/sso/settings",metadata:"/v1/mgmt/sso/metadata",mapping:"/v1/mgmt/sso/mapping"},u={update:"/v1/mgmt/jwt/update"},h={create:"/v1/mgmt/permission/create",update:"/v1/mgmt/permission/update",delete:"/v1/mgmt/permission/delete",loadAll:"/v1/mgmt/permission/all"},v={create:"/v1/mgmt/role/create",update:"/v1/mgmt/role/update",delete:"/v1/mgmt/role/delete",loadAll:"/v1/mgmt/role/all"},g={loadAllGroups:"/v1/mgmt/group/all",loadAllGroupsForMember:"/v1/mgmt/group/member/all",loadAllGroupMembers:"/v1/mgmt/group/members"};const f=(e,s)=>({create:(a,n,o,r,i,l)=>t.transformResponse(e.httpClient.post(d.create,{loginId:a,email:n,phone:o,displayName:r,roleNames:i,userTenants:l},{token:s}),(e=>e.user)),invite:(a,n,o,r,i,l)=>t.transformResponse(e.httpClient.post(d.create,{loginId:a,email:n,phone:o,displayName:r,roleNames:i,userTenants:l,invite:!0},{token:s}),(e=>e.user)),update:(a,n,o,r,i,l)=>t.transformResponse(e.httpClient.post(d.update,{loginId:a,email:n,phone:o,displayName:r,roleNames:i,userTenants:l},{token:s}),(e=>e.user)),delete:a=>t.transformResponse(e.httpClient.post(d.delete,{loginId:a},{token:s})),load:a=>t.transformResponse(e.httpClient.get(d.load,{queryParams:{loginId:a},token:s}),(e=>e.user)),loadByUserId:a=>t.transformResponse(e.httpClient.get(d.load,{queryParams:{userId:a},token:s}),(e=>e.user)),searchAll:(a,n,o,r)=>t.transformResponse(e.httpClient.post(d.search,{tenantIds:a,roleNames:n,limit:o,page:r},{token:s}),(e=>e.users)),activate:a=>t.transformResponse(e.httpClient.post(d.updateStatus,{loginId:a,status:"enabled"},{token:s}),(e=>e.user)),deactivate:a=>t.transformResponse(e.httpClient.post(d.updateStatus,{loginId:a,status:"disabled"},{token:s}),(e=>e.user)),updateEmail:(a,n,o)=>t.transformResponse(e.httpClient.post(d.updateEmail,{loginId:a,email:n,verified:o},{token:s}),(e=>e.user)),updatePhone:(a,n,o)=>t.transformResponse(e.httpClient.post(d.updatePhone,{loginId:a,phone:n,verified:o},{token:s}),(e=>e.user)),updateDisplayName:(a,n)=>t.transformResponse(e.httpClient.post(d.updateDisplayName,{loginId:a,displayName:n},{token:s}),(e=>e.user)),addRoles:(a,n)=>t.transformResponse(e.httpClient.post(d.addRole,{loginId:a,roleNames:n},{token:s}),(e=>e.user)),removeRoles:(a,n)=>t.transformResponse(e.httpClient.post(d.removeRole,{loginId:a,roleNames:n},{token:s}),(e=>e.user)),addTenant:(a,n)=>t.transformResponse(e.httpClient.post(d.addTenant,{loginId:a,tenantId:n},{token:s}),(e=>e.user)),removeTenant:(a,n)=>t.transformResponse(e.httpClient.post(d.removeTenant,{loginId:a,tenantId:n},{token:s}),(e=>e.user)),addTenantRoles:(a,n,o)=>t.transformResponse(e.httpClient.post(d.addRole,{loginId:a,tenantId:n,roleNames:o},{token:s}),(e=>e.user)),removeTenantRoles:(a,n,o)=>t.transformResponse(e.httpClient.post(d.removeRole,{loginId:a,tenantId:n,roleNames:o},{token:s}),(e=>e.user))}),k=(e,s)=>({create:(a,n)=>t.transformResponse(e.httpClient.post(m.create,{name:a,selfProvisioningDomains:n},{token:s})),createWithId:(a,n,o)=>t.transformResponse(e.httpClient.post(m.create,{id:a,name:n,selfProvisioningDomains:o},{token:s})),update:(a,n,o)=>t.transformResponse(e.httpClient.post(m.update,{id:a,name:n,selfProvisioningDomains:o},{token:s})),delete:a=>t.transformResponse(e.httpClient.post(m.delete,{id:a},{token:s})),loadAll:()=>t.transformResponse(e.httpClient.get(m.loadAll,{token:s}),(e=>e.tenants))}),y=(e,s)=>({update:(a,n)=>t.transformResponse(e.httpClient.post(u.update,{jwt:a,customClaims:n},{token:s}))}),R=(e,s)=>({create:(a,n)=>t.transformResponse(e.httpClient.post(h.create,{name:a,description:n},{token:s})),update:(a,n,o)=>t.transformResponse(e.httpClient.post(h.update,{name:a,newName:n,description:o},{token:s})),delete:a=>t.transformResponse(e.httpClient.post(h.delete,{name:a},{token:s})),loadAll:()=>t.transformResponse(e.httpClient.get(h.loadAll,{token:s}),(e=>e.permissions))}),C=(e,s)=>({create:(a,n,o)=>t.transformResponse(e.httpClient.post(v.create,{name:a,description:n,permissionNames:o},{token:s})),update:(a,n,o,r)=>t.transformResponse(e.httpClient.post(v.update,{name:a,newName:n,description:o,permissionNames:r},{token:s})),delete:a=>t.transformResponse(e.httpClient.post(v.delete,{name:a},{token:s})),loadAll:()=>t.transformResponse(e.httpClient.get(v.loadAll,{token:s}),(e=>e.roles))}),w=(e,s)=>({loadAllGroups:a=>t.transformResponse(e.httpClient.post(g.loadAllGroups,{tenantId:a},{token:s})),loadAllGroupsForMember:(a,n,o)=>t.transformResponse(e.httpClient.post(g.loadAllGroupsForMember,{tenantId:a,loginIds:o,userIds:n},{token:s})),loadAllGroupMembers:(a,n)=>t.transformResponse(e.httpClient.post(g.loadAllGroupMembers,{tenantId:a,groupId:n},{token:s}))}),I=(e,s)=>({configureSettings:(a,n,o,r,i,l)=>t.transformResponse(e.httpClient.post(c.configure,{tenantId:a,idpURL:n,entityId:r,idpCert:o,redirectURL:i,domain:l},{token:s})),configureMetadata:(a,n)=>t.transformResponse(e.httpClient.post(c.metadata,{tenantId:a,idpMetadataURL:n},{token:s})),configureMapping:(a,n,o)=>t.transformResponse(e.httpClient.post(c.mapping,{tenantId:a,roleMapping:n,attributeMapping:o},{token:s}))}),b=(e,s)=>({create:(a,n,o,r)=>t.transformResponse(e.httpClient.post(p.create,{name:a,expireTime:n,roleNames:o,keyTenants:r},{token:s})),load:a=>t.transformResponse(e.httpClient.get(p.load,{queryParams:{id:a},token:s}),(e=>e.key)),searchAll:a=>t.transformResponse(e.httpClient.post(p.search,{tenantIds:a},{token:s}),(e=>e.keys)),update:(a,n)=>t.transformResponse(e.httpClient.post(p.update,{id:a,name:n},{token:s}),(e=>e.key)),deactivate:a=>t.transformResponse(e.httpClient.post(p.deactivate,{id:a},{token:s})),activate:a=>t.transformResponse(e.httpClient.post(p.activate,{id:a},{token:s})),delete:a=>t.transformResponse(e.httpClient.post(p.delete,{id:a},{token:s}))});var A;null!==(A=globalThis.Headers)&&void 0!==A||(globalThis.Headers=a.Headers);const j=(...e)=>(e.forEach((e=>{var t,s;e&&(null!==(t=(s=e).highWaterMark)&&void 0!==t||(s.highWaterMark=32212254720))})),r.default(...e)),T=a=>{var n,{managementKey:r}=a,d=e.__rest(a,["managementKey"]);const p=o.default(Object.assign(Object.assign({},d),{fetch:j,baseHeaders:Object.assign(Object.assign({},d.baseHeaders),{"x-descope-sdk-name":"nodejs","x-descope-sdk-node-version":(null===(n=null===process||void 0===process?void 0:process.versions)||void 0===n?void 0:n.node)||"","x-descope-sdk-version":"0.0.0-next-0e660dc4-20230313"})})),{projectId:m,logger:c}=d,u={},h=((e,t)=>({user:f(e,t),accessKey:b(e,t),tenant:k(e,t),sso:I(e,t),jwt:y(e,t),permission:R(e,t),role:C(e,t),group:w(e,t)}))(p,r),v=Object.assign(Object.assign({},p),{management:h,async getKey(e){if(!(null==e?void 0:e.kid))throw Error("header.kid must not be empty");if(u[e.kid])return u[e.kid];if(Object.assign(u,await(async()=>{const e=(await p.httpClient.get(`v2/keys/${m}`).then((e=>e.json()))).keys;return Array.isArray(e)?(await Promise.all(e.map((async e=>[e.kid,await s.importJWK(e)])))).reduce(((e,[t,s])=>t?Object.assign(Object.assign({},e),{[t.toString()]:s}):e),{}):{}})()),!u[e.kid])throw Error("failed to fetch matching key");return u[e.kid]},async validateJwt(e){var t;const a=(await s.jwtVerify(e,v.getKey,{clockTolerance:5})).payload;if(a&&(a.iss=null===(t=a.iss)||void 0===t?void 0:t.split("/").pop(),a.iss!==m))throw new s.errors.JWTClaimValidationFailed('unexpected "iss" claim value',"iss","check_failed");return{jwt:e,token:a}},async validateSession(e){if(!e)throw Error("session token is required for validation");try{return await v.validateJwt(e)}catch(e){throw null==c||c.error("session validation failed",e),Error("session validation failed")}},async refreshSession(e){var t,s;if(!e)throw Error("refresh token is required to refresh a session");try{await v.validateJwt(e);const a=await v.refresh(e);if(a.ok){return await v.validateJwt(null===(t=a.data)||void 0===t?void 0:t.sessionJwt)}throw Error(null===(s=a.error)||void 0===s?void 0:s.errorMessage)}catch(e){throw null==c||c.error("refresh token validation failed",e),Error("refresh token validation failed")}},async validateAndRefreshSession(e,t){if(!e&&!t)throw Error("both session and refresh tokens are empty");try{return await v.validateSession(e)}catch(e){null==c||c.log("session validation failed - trying to refresh it")}return v.refreshSession(t)},async exchangeAccessKey(e){if(!e)throw Error("access key must not be empty");let t;try{t=await v.accessKey.exchange(e)}catch(e){throw null==c||c.error("failed to exchange access key",e),Error("could not exchange access key")}const{sessionJwt:s}=t.data;if(!s)throw null==c||c.error("failed to parse exchange access key response"),Error("could not exchange access key");try{return await v.validateJwt(s)}catch(e){throw null==c||c.error("failed to parse jwt from access key",e),Error("could not exchange access key")}},validatePermissions:(e,t)=>v.validateTenantPermissions(e,null,t),validateTenantPermissions(e,t,s){const a=l(e,"permissions",t);return s.every((e=>a.includes(e)))},validateRoles:(e,t)=>v.validateTenantRoles(e,null,t),validateTenantRoles(e,t,s){const a=l(e,"roles",t);return s.every((e=>a.includes(e)))}});return t.wrapWith(v,["otp.verify.email","otp.verify.sms","otp.verify.whatsapp","magicLink.verify","enchantedLink.signUp","enchantedLink.signIn","oauth.exchange","saml.exchange","totp.verify","webauthn.signIn.finish","webauthn.signUp.finish","refresh"],i)};T.RefreshTokenCookieName="DSR",T.SessionTokenCookieName="DS",module.exports=T; | ||
"use strict";var e=require("tslib"),t=require("@descope/core-js-sdk"),s=require("jose"),o=require("node-fetch-commonjs");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=n(t),r=n(o);const i=t=>async(...s)=>{var o,n,a;const r=await t(...s);if(!r.data)return r;let i=r.data,{refreshJwt:l}=i,p=e.__rest(i,["refreshJwt"]);const d=[];var m;return l?d.push(`${"DSR"}=${l}; Domain=${(null==(m=p)?void 0:m.cookieDomain)||""}; Max-Age=${(null==m?void 0:m.cookieMaxAge)||""}; Path=${(null==m?void 0:m.cookiePath)||"/"}; HttpOnly; SameSite=Strict`):(null===(o=r.response)||void 0===o?void 0:o.headers.get("set-cookie"))&&(l=((e,t)=>{const s=null==e?void 0:e.match(RegExp(`(?:^|;\\s*)${t}=([^;]*)`));return s?s[1]:null})(null===(n=r.response)||void 0===n?void 0:n.headers.get("set-cookie"),"DSR"),d.push(null===(a=r.response)||void 0===a?void 0:a.headers.get("set-cookie"))),Object.assign(Object.assign({},r),{data:Object.assign(Object.assign({},r.data),{refreshJwt:l,cookies:d})})};function l(e,t,s){var o,n;const a=s?null===(n=null===(o=e.token.tenants)||void 0===o?void 0:o[s])||void 0===n?void 0:n[t]:e.token[t];return Array.isArray(a)?a:[]}var p={create:"/v1/mgmt/user/create",update:"/v1/mgmt/user/update",delete:"/v1/mgmt/user/delete",deleteAllTestUsers:"/v1/mgmt/user/test/delete/all",load:"/v1/mgmt/user",search:"/v1/mgmt/user/search",updateStatus:"/v1/mgmt/user/update/status",updateEmail:"/v1/mgmt/user/update/email",updatePhone:"/v1/mgmt/user/update/phone",updateDisplayName:"/v1/mgmt/user/update/name",updatePicture:"/v1/mgmt/user/update/picture",updateCustomAttribute:"/v1/mgmt/user/update/customAttribute",addRole:"/v1/mgmt/user/update/role/add",removeRole:"/v1/mgmt/user/update/role/remove",addTenant:"/v1/mgmt/user/update/tenant/add",removeTenant:"/v1/mgmt/user/update/tenant/remove",generateOTPForTest:"/v1/mgmt/tests/generate/otp",generateMagicLinkForTest:"/v1/mgmt/tests/generate/magiclink",generateEnchantedLinkForTest:"/v1/mgmt/tests/generate/enchantedlink"},d={create:"/v1/mgmt/accesskey/create",load:"/v1/mgmt/accesskey",search:"/v1/mgmt/accesskey/search",update:"/v1/mgmt/accesskey/update",deactivate:"/v1/mgmt/accesskey/deactivate",activate:"/v1/mgmt/accesskey/activate",delete:"/v1/mgmt/accesskey/delete"},m={create:"/v1/mgmt/tenant/create",update:"/v1/mgmt/tenant/update",delete:"/v1/mgmt/tenant/delete",loadAll:"/v1/mgmt/tenant/all"},u={configure:"/v1/mgmt/sso/settings",metadata:"/v1/mgmt/sso/metadata",mapping:"/v1/mgmt/sso/mapping"},c={update:"/v1/mgmt/jwt/update"},g={create:"/v1/mgmt/permission/create",update:"/v1/mgmt/permission/update",delete:"/v1/mgmt/permission/delete",loadAll:"/v1/mgmt/permission/all"},h={create:"/v1/mgmt/role/create",update:"/v1/mgmt/role/update",delete:"/v1/mgmt/role/delete",loadAll:"/v1/mgmt/role/all"},v={export:"/v1/mgmt/flow/export",import:"/v1/mgmt/flow/import"},f={export:"/v1/mgmt/theme/export",import:"/v1/mgmt/theme/import"},k={loadAllGroups:"/v1/mgmt/group/all",loadAllGroupsForMember:"/v1/mgmt/group/member/all",loadAllGroupMembers:"/v1/mgmt/group/members"};const R=(e,s)=>({create:(o,n,a,r,i,l,d,m)=>t.transformResponse(e.httpClient.post(p.create,{loginId:o,email:n,phone:a,displayName:r,roleNames:i,userTenants:l,customAttributes:d,picture:m},{token:s}),(e=>e.user)),createTestUser:(o,n,a,r,i,l,d,m)=>t.transformResponse(e.httpClient.post(p.create,{loginId:o,email:n,phone:a,displayName:r,roleNames:i,userTenants:l,test:!0,customAttributes:d,picture:m},{token:s}),(e=>e.user)),invite:(o,n,a,r,i,l,d,m)=>t.transformResponse(e.httpClient.post(p.create,{loginId:o,email:n,phone:a,displayName:r,roleNames:i,userTenants:l,invite:!0,customAttributes:d,picture:m},{token:s}),(e=>e.user)),update:(o,n,a,r,i,l,d,m)=>t.transformResponse(e.httpClient.post(p.update,{loginId:o,email:n,phone:a,displayName:r,roleNames:i,userTenants:l,customAttributes:d,picture:m},{token:s}),(e=>e.user)),delete:o=>t.transformResponse(e.httpClient.post(p.delete,{loginId:o},{token:s})),deleteAllTestUsers:()=>t.transformResponse(e.httpClient.delete(p.deleteAllTestUsers,{},{token:s})),load:o=>t.transformResponse(e.httpClient.get(p.load,{queryParams:{loginId:o},token:s}),(e=>e.user)),loadByUserId:o=>t.transformResponse(e.httpClient.get(p.load,{queryParams:{userId:o},token:s}),(e=>e.user)),searchAll:(o,n,a,r,i,l,d)=>t.transformResponse(e.httpClient.post(p.search,{tenantIds:o,roleNames:n,limit:a,page:r,testUsersOnly:i,withTestUser:l,customAttributes:d},{token:s}),(e=>e.users)),activate:o=>t.transformResponse(e.httpClient.post(p.updateStatus,{loginId:o,status:"enabled"},{token:s}),(e=>e.user)),deactivate:o=>t.transformResponse(e.httpClient.post(p.updateStatus,{loginId:o,status:"disabled"},{token:s}),(e=>e.user)),updateEmail:(o,n,a)=>t.transformResponse(e.httpClient.post(p.updateEmail,{loginId:o,email:n,verified:a},{token:s}),(e=>e.user)),updatePhone:(o,n,a)=>t.transformResponse(e.httpClient.post(p.updatePhone,{loginId:o,phone:n,verified:a},{token:s}),(e=>e.user)),updateDisplayName:(o,n)=>t.transformResponse(e.httpClient.post(p.updateDisplayName,{loginId:o,displayName:n},{token:s}),(e=>e.user)),updatePicture:(o,n)=>t.transformResponse(e.httpClient.post(p.updatePicture,{loginId:o,picture:n},{token:s}),(e=>e.user)),updateCustomAttribute:(o,n,a)=>t.transformResponse(e.httpClient.post(p.updateCustomAttribute,{loginId:o,attributeKey:n,attributeValue:a},{token:s}),(e=>e.user)),addRoles:(o,n)=>t.transformResponse(e.httpClient.post(p.addRole,{loginId:o,roleNames:n},{token:s}),(e=>e.user)),removeRoles:(o,n)=>t.transformResponse(e.httpClient.post(p.removeRole,{loginId:o,roleNames:n},{token:s}),(e=>e.user)),addTenant:(o,n)=>t.transformResponse(e.httpClient.post(p.addTenant,{loginId:o,tenantId:n},{token:s}),(e=>e.user)),removeTenant:(o,n)=>t.transformResponse(e.httpClient.post(p.removeTenant,{loginId:o,tenantId:n},{token:s}),(e=>e.user)),addTenantRoles:(o,n,a)=>t.transformResponse(e.httpClient.post(p.addRole,{loginId:o,tenantId:n,roleNames:a},{token:s}),(e=>e.user)),removeTenantRoles:(o,n,a)=>t.transformResponse(e.httpClient.post(p.removeRole,{loginId:o,tenantId:n,roleNames:a},{token:s}),(e=>e.user)),generateOTPForTestUser:(o,n)=>t.transformResponse(e.httpClient.post(p.generateOTPForTest,{deliveryMethod:o,loginId:n},{token:s}),(e=>e)),generateMagicLinkForTestUser:(o,n,a)=>t.transformResponse(e.httpClient.post(p.generateMagicLinkForTest,{deliveryMethod:o,loginId:n,URI:a},{token:s}),(e=>e)),generateEnchantedLinkForTestUser:(o,n)=>t.transformResponse(e.httpClient.post(p.generateEnchantedLinkForTest,{loginId:o,URI:n},{token:s}),(e=>e))}),y=(e,s)=>({create:(o,n)=>t.transformResponse(e.httpClient.post(m.create,{name:o,selfProvisioningDomains:n},{token:s})),createWithId:(o,n,a)=>t.transformResponse(e.httpClient.post(m.create,{id:o,name:n,selfProvisioningDomains:a},{token:s})),update:(o,n,a)=>t.transformResponse(e.httpClient.post(m.update,{id:o,name:n,selfProvisioningDomains:a},{token:s})),delete:o=>t.transformResponse(e.httpClient.post(m.delete,{id:o},{token:s})),loadAll:()=>t.transformResponse(e.httpClient.get(m.loadAll,{token:s}),(e=>e.tenants))}),C=(e,s)=>({update:(o,n)=>t.transformResponse(e.httpClient.post(c.update,{jwt:o,customClaims:n},{token:s}))}),w=(e,s)=>({create:(o,n)=>t.transformResponse(e.httpClient.post(g.create,{name:o,description:n},{token:s})),update:(o,n,a)=>t.transformResponse(e.httpClient.post(g.update,{name:o,newName:n,description:a},{token:s})),delete:o=>t.transformResponse(e.httpClient.post(g.delete,{name:o},{token:s})),loadAll:()=>t.transformResponse(e.httpClient.get(g.loadAll,{token:s}),(e=>e.permissions))}),I=(e,s)=>({create:(o,n,a)=>t.transformResponse(e.httpClient.post(h.create,{name:o,description:n,permissionNames:a},{token:s})),update:(o,n,a,r)=>t.transformResponse(e.httpClient.post(h.update,{name:o,newName:n,description:a,permissionNames:r},{token:s})),delete:o=>t.transformResponse(e.httpClient.post(h.delete,{name:o},{token:s})),loadAll:()=>t.transformResponse(e.httpClient.get(h.loadAll,{token:s}),(e=>e.roles))}),b=(e,s)=>({loadAllGroups:o=>t.transformResponse(e.httpClient.post(k.loadAllGroups,{tenantId:o},{token:s})),loadAllGroupsForMember:(o,n,a)=>t.transformResponse(e.httpClient.post(k.loadAllGroupsForMember,{tenantId:o,loginIds:a,userIds:n},{token:s})),loadAllGroupMembers:(o,n)=>t.transformResponse(e.httpClient.post(k.loadAllGroupMembers,{tenantId:o,groupId:n},{token:s}))}),T=(e,s)=>({configureSettings:(o,n,a,r,i,l)=>t.transformResponse(e.httpClient.post(u.configure,{tenantId:o,idpURL:n,entityId:r,idpCert:a,redirectURL:i,domain:l},{token:s})),configureMetadata:(o,n)=>t.transformResponse(e.httpClient.post(u.metadata,{tenantId:o,idpMetadataURL:n},{token:s})),configureMapping:(o,n,a)=>t.transformResponse(e.httpClient.post(u.mapping,{tenantId:o,roleMapping:n,attributeMapping:a},{token:s}))}),A=(e,s)=>({create:(o,n,a,r)=>t.transformResponse(e.httpClient.post(d.create,{name:o,expireTime:n,roleNames:a,keyTenants:r},{token:s})),load:o=>t.transformResponse(e.httpClient.get(d.load,{queryParams:{id:o},token:s}),(e=>e.key)),searchAll:o=>t.transformResponse(e.httpClient.post(d.search,{tenantIds:o},{token:s}),(e=>e.keys)),update:(o,n)=>t.transformResponse(e.httpClient.post(d.update,{id:o,name:n},{token:s}),(e=>e.key)),deactivate:o=>t.transformResponse(e.httpClient.post(d.deactivate,{id:o},{token:s})),activate:o=>t.transformResponse(e.httpClient.post(d.activate,{id:o},{token:s})),delete:o=>t.transformResponse(e.httpClient.post(d.delete,{id:o},{token:s}))}),x=(e,s)=>({export:o=>t.transformResponse(e.httpClient.post(v.export,{flowId:o},{token:s})),import:(o,n,a)=>t.transformResponse(e.httpClient.post(v.import,{flowId:o,flow:n,screens:a},{token:s}))}),j=(e,s)=>({export:()=>t.transformResponse(e.httpClient.post(f.export,{},{token:s})),import:o=>t.transformResponse(e.httpClient.post(f.import,{theme:o},{token:s}))});var N;null!==(N=globalThis.Headers)&&void 0!==N||(globalThis.Headers=o.Headers);const M=(...e)=>(e.forEach((e=>{var t,s;e&&(null!==(t=(s=e).highWaterMark)&&void 0!==t||(s.highWaterMark=31457280))})),r.default(...e)),P=o=>{var n,{managementKey:r}=o,p=e.__rest(o,["managementKey"]);const d=a.default(Object.assign(Object.assign({},p),{fetch:M,baseHeaders:Object.assign(Object.assign({},p.baseHeaders),{"x-descope-sdk-name":"nodejs","x-descope-sdk-node-version":(null===(n=null===process||void 0===process?void 0:process.versions)||void 0===n?void 0:n.node)||"","x-descope-sdk-version":"0.0.0-next-0ff273e7-20230504"})})),{projectId:m,logger:u}=p,c={},g=((e,t)=>({user:R(e,t),accessKey:A(e,t),tenant:y(e,t),sso:T(e,t),jwt:C(e,t),permission:w(e,t),role:I(e,t),group:b(e,t),flow:x(e,t),theme:j(e,t)}))(d,r),h=Object.assign(Object.assign({},d),{management:g,async getKey(e){if(!(null==e?void 0:e.kid))throw Error("header.kid must not be empty");if(c[e.kid])return c[e.kid];if(Object.assign(c,await(async()=>{const e=(await d.httpClient.get(`v2/keys/${m}`).then((e=>e.json()))).keys;return Array.isArray(e)?(await Promise.all(e.map((async e=>[e.kid,await s.importJWK(e)])))).reduce(((e,[t,s])=>t?Object.assign(Object.assign({},e),{[t.toString()]:s}):e),{}):{}})()),!c[e.kid])throw Error("failed to fetch matching key");return c[e.kid]},async validateJwt(e){var t;const o=(await s.jwtVerify(e,h.getKey,{clockTolerance:5})).payload;if(o&&(o.iss=null===(t=o.iss)||void 0===t?void 0:t.split("/").pop(),o.iss!==m))throw new s.errors.JWTClaimValidationFailed('unexpected "iss" claim value',"iss","check_failed");return{jwt:e,token:o}},async validateSession(e){if(!e)throw Error("session token is required for validation");try{return await h.validateJwt(e)}catch(e){throw null==u||u.error("session validation failed",e),Error("session validation failed")}},async refreshSession(e){var t,s;if(!e)throw Error("refresh token is required to refresh a session");try{await h.validateJwt(e);const o=await h.refresh(e);if(o.ok){return await h.validateJwt(null===(t=o.data)||void 0===t?void 0:t.sessionJwt)}throw Error(null===(s=o.error)||void 0===s?void 0:s.errorMessage)}catch(e){throw null==u||u.error("refresh token validation failed",e),Error("refresh token validation failed")}},async validateAndRefreshSession(e,t){if(!e&&!t)throw Error("both session and refresh tokens are empty");try{return await h.validateSession(e)}catch(e){null==u||u.log("session validation failed - trying to refresh it")}return h.refreshSession(t)},async exchangeAccessKey(e){if(!e)throw Error("access key must not be empty");let t;try{t=await h.accessKey.exchange(e)}catch(e){throw null==u||u.error("failed to exchange access key",e),Error("could not exchange access key")}const{sessionJwt:s}=t.data;if(!s)throw null==u||u.error("failed to parse exchange access key response"),Error("could not exchange access key");try{return await h.validateJwt(s)}catch(e){throw null==u||u.error("failed to parse jwt from access key",e),Error("could not exchange access key")}},validatePermissions:(e,t)=>h.validateTenantPermissions(e,null,t),validateTenantPermissions(e,t,s){const o=l(e,"permissions",t);return s.every((e=>o.includes(e)))},validateRoles:(e,t)=>h.validateTenantRoles(e,null,t),validateTenantRoles(e,t,s){const o=l(e,"roles",t);return s.every((e=>o.includes(e)))}});return t.wrapWith(h,["otp.verify.email","otp.verify.sms","otp.verify.whatsapp","magicLink.verify","enchantedLink.signUp","enchantedLink.signIn","oauth.exchange","saml.exchange","totp.verify","webauthn.signIn.finish","webauthn.signUp.finish","refresh"],i)};P.RefreshTokenCookieName="DSR",P.SessionTokenCookieName="DS",module.exports=P; | ||
//# sourceMappingURL=index.cjs.js.map |
import * as _descope_core_js_sdk from '@descope/core-js-sdk'; | ||
import _descope_core_js_sdk__default, { SdkResponse, ExchangeAccessKeyResponse } from '@descope/core-js-sdk'; | ||
export { DeliveryMethod, OAuthProvider } from '@descope/core-js-sdk'; | ||
export { DeliveryMethod, OAuthProvider, ResponseData, SdkResponse } from '@descope/core-js-sdk'; | ||
import { JWTHeaderParameters, KeyLike } from 'jose'; | ||
@@ -74,2 +74,3 @@ | ||
permissionNames: string[]; | ||
createdTime: number; | ||
}; | ||
@@ -88,2 +89,42 @@ /** Represents a group in a project. It has an id and display name and a list of group members. */ | ||
}; | ||
declare type Flow = { | ||
id: string; | ||
name: string; | ||
description?: string; | ||
dsl: any; | ||
disabled: boolean; | ||
etag?: string; | ||
}; | ||
declare type Screen = { | ||
id: string; | ||
flowId: string; | ||
inputs?: any; | ||
interactions?: any; | ||
htmlTemplate: any; | ||
}; | ||
declare type FlowResponse = { | ||
flow: Flow; | ||
screens: Screen[]; | ||
}; | ||
declare type Theme = { | ||
id: string; | ||
cssTemplate?: any; | ||
}; | ||
declare type ThemeResponse = { | ||
theme: Theme; | ||
}; | ||
declare type GenerateOTPForTestResponse = { | ||
loginId: string; | ||
code: string; | ||
}; | ||
declare type GenerateMagicLinkForTestResponse = { | ||
loginId: string; | ||
link: string; | ||
}; | ||
declare type GenerateEnchantedLinkForTestResponse = { | ||
loginId: string; | ||
link: string; | ||
pendingRef: string; | ||
}; | ||
declare type AttributesTypes = string | boolean | number; | ||
@@ -112,9 +153,11 @@ /** Parsed JWT token */ | ||
user: { | ||
create: (loginId: string, email?: string, phone?: string, displayName?: string, roles?: string[], userTenants?: AssociatedTenant[]) => Promise<SdkResponse<_descope_core_js_sdk.UserResponse>>; | ||
invite: (loginId: string, email?: string, phone?: string, displayName?: string, roles?: string[], userTenants?: AssociatedTenant[]) => Promise<SdkResponse<_descope_core_js_sdk.UserResponse>>; | ||
update: (loginId: string, email?: string, phone?: string, displayName?: string, roles?: string[], userTenants?: AssociatedTenant[]) => Promise<SdkResponse<_descope_core_js_sdk.UserResponse>>; | ||
create: (loginId: string, email?: string, phone?: string, displayName?: string, roles?: string[], userTenants?: AssociatedTenant[], customAttributes?: Record<string, AttributesTypes>, picture?: string) => Promise<SdkResponse<_descope_core_js_sdk.UserResponse>>; | ||
createTestUser: (loginId: string, email?: string, phone?: string, displayName?: string, roles?: string[], userTenants?: AssociatedTenant[], customAttributes?: Record<string, AttributesTypes>, picture?: string) => Promise<SdkResponse<_descope_core_js_sdk.UserResponse>>; | ||
invite: (loginId: string, email?: string, phone?: string, displayName?: string, roles?: string[], userTenants?: AssociatedTenant[], customAttributes?: Record<string, AttributesTypes>, picture?: string) => Promise<SdkResponse<_descope_core_js_sdk.UserResponse>>; | ||
update: (loginId: string, email?: string, phone?: string, displayName?: string, roles?: string[], userTenants?: AssociatedTenant[], customAttributes?: Record<string, AttributesTypes>, picture?: string) => Promise<SdkResponse<_descope_core_js_sdk.UserResponse>>; | ||
delete: (loginId: string) => Promise<SdkResponse<never>>; | ||
deleteAllTestUsers: () => Promise<SdkResponse<never>>; | ||
load: (loginId: string) => Promise<SdkResponse<_descope_core_js_sdk.UserResponse>>; | ||
loadByUserId: (userId: string) => Promise<SdkResponse<_descope_core_js_sdk.UserResponse>>; | ||
searchAll: (tenantIds?: string[], roles?: string[], limit?: number, page?: number) => Promise<SdkResponse<_descope_core_js_sdk.UserResponse[]>>; | ||
searchAll: (tenantIds?: string[], roles?: string[], limit?: number, page?: number, testUsersOnly?: boolean, withTestUser?: boolean, customAttributes?: Record<string, AttributesTypes>) => Promise<SdkResponse<_descope_core_js_sdk.UserResponse[]>>; | ||
activate: (loginId: string) => Promise<SdkResponse<_descope_core_js_sdk.UserResponse>>; | ||
@@ -125,2 +168,4 @@ deactivate: (loginId: string) => Promise<SdkResponse<_descope_core_js_sdk.UserResponse>>; | ||
updateDisplayName: (loginId: string, displayName: string) => Promise<SdkResponse<_descope_core_js_sdk.UserResponse>>; | ||
updatePicture: (loginId: string, picture: string) => Promise<SdkResponse<_descope_core_js_sdk.UserResponse>>; | ||
updateCustomAttribute: (loginId: string, attributeKey: string, attributeValue: AttributesTypes) => Promise<SdkResponse<_descope_core_js_sdk.UserResponse>>; | ||
addRoles: (loginId: string, roles: string[]) => Promise<SdkResponse<_descope_core_js_sdk.UserResponse>>; | ||
@@ -132,2 +177,5 @@ removeRoles: (loginId: string, roles: string[]) => Promise<SdkResponse<_descope_core_js_sdk.UserResponse>>; | ||
removeTenantRoles: (loginId: string, tenantId: string, roles: string[]) => Promise<SdkResponse<_descope_core_js_sdk.UserResponse>>; | ||
generateOTPForTestUser: (deliveryMethod: "email" | "sms" | "whatsapp", loginId: string) => Promise<SdkResponse<GenerateOTPForTestResponse>>; | ||
generateMagicLinkForTestUser: (deliveryMethod: "email" | "sms" | "whatsapp", loginId: string, uri: string) => Promise<SdkResponse<GenerateMagicLinkForTestResponse>>; | ||
generateEnchantedLinkForTestUser: (loginId: string, uri: string) => Promise<SdkResponse<GenerateEnchantedLinkForTestResponse>>; | ||
}; | ||
@@ -175,2 +223,10 @@ accessKey: { | ||
}; | ||
flow: { | ||
export: (flowId: string) => Promise<SdkResponse<FlowResponse>>; | ||
import: (flowId: string, flow: Flow, screens?: Screen[]) => Promise<SdkResponse<FlowResponse>>; | ||
}; | ||
theme: { | ||
export: () => Promise<SdkResponse<ThemeResponse>>; | ||
import: (theme: Theme) => Promise<SdkResponse<ThemeResponse>>; | ||
}; | ||
}; | ||
@@ -192,11 +248,11 @@ getKey: (header: JWTHeaderParameters) => Promise<KeyLike | Uint8Array>; | ||
verify: { | ||
email: (loginId: string, code: string) => Promise<SdkResponse<_descope_core_js_sdk.JWTResponse & { | ||
sms: (loginId: string, code: string) => Promise<SdkResponse<_descope_core_js_sdk.JWTResponse & { | ||
refreshJwt?: string; | ||
cookies?: string[]; | ||
}>>; | ||
sms: (loginId: string, code: string) => Promise<SdkResponse<_descope_core_js_sdk.JWTResponse & { | ||
whatsapp: (loginId: string, code: string) => Promise<SdkResponse<_descope_core_js_sdk.JWTResponse & { | ||
refreshJwt?: string; | ||
cookies?: string[]; | ||
}>>; | ||
whatsapp: (loginId: string, code: string) => Promise<SdkResponse<_descope_core_js_sdk.JWTResponse & { | ||
email: (loginId: string, code: string) => Promise<SdkResponse<_descope_core_js_sdk.JWTResponse & { | ||
refreshJwt?: string; | ||
@@ -207,34 +263,66 @@ cookies?: string[]; | ||
signIn: { | ||
email: (loginId: string) => Promise<SdkResponse<never>>; | ||
sms: (loginId: string) => Promise<SdkResponse<never>>; | ||
whatsapp: (loginId: string) => Promise<SdkResponse<never>>; | ||
sms: (loginId: string) => Promise<SdkResponse<{ | ||
maskedPhone: string; | ||
}>>; | ||
whatsapp: (loginId: string) => Promise<SdkResponse<{ | ||
maskedPhone: string; | ||
}>>; | ||
email: (loginId: string) => Promise<SdkResponse<{ | ||
maskedEmail: string; | ||
}>>; | ||
}; | ||
signUp: { | ||
email: (loginId: string, user?: { | ||
sms: (loginId: string, user?: { | ||
email?: string; | ||
name?: string; | ||
phone?: string; | ||
}) => Promise<SdkResponse<never>>; | ||
sms: (loginId: string, user?: { | ||
}) => Promise<SdkResponse<{ | ||
maskedPhone: string; | ||
}>>; | ||
whatsapp: (loginId: string, user?: { | ||
email?: string; | ||
name?: string; | ||
phone?: string; | ||
}) => Promise<SdkResponse<never>>; | ||
whatsapp: (loginId: string, user?: { | ||
}) => Promise<SdkResponse<{ | ||
maskedPhone: string; | ||
}>>; | ||
email: (loginId: string, user?: { | ||
email?: string; | ||
name?: string; | ||
phone?: string; | ||
}) => Promise<SdkResponse<never>>; | ||
}) => Promise<SdkResponse<{ | ||
maskedEmail: string; | ||
}>>; | ||
}; | ||
signUpOrIn: { | ||
email: (loginId: string) => Promise<SdkResponse<never>>; | ||
sms: (loginId: string) => Promise<SdkResponse<never>>; | ||
whatsapp: (loginId: string) => Promise<SdkResponse<never>>; | ||
sms: (loginId: string) => Promise<SdkResponse<{ | ||
maskedPhone: string; | ||
}>>; | ||
whatsapp: (loginId: string) => Promise<SdkResponse<{ | ||
maskedPhone: string; | ||
}>>; | ||
email: (loginId: string) => Promise<SdkResponse<{ | ||
maskedEmail: string; | ||
}>>; | ||
}; | ||
update: { | ||
email: (loginId: string, email: string, token?: string) => Promise<SdkResponse<never>>; | ||
email: <T extends boolean>(loginId: string, email: string, token?: string, updateOptions?: { | ||
addToLoginIDs?: T; | ||
onMergeUseExisting?: T extends true ? boolean : never; | ||
}) => Promise<SdkResponse<{ | ||
maskedEmail: string; | ||
}>>; | ||
phone: { | ||
email: (loginId: string, phone: string) => Promise<SdkResponse<never>>; | ||
sms: (loginId: string, phone: string) => Promise<SdkResponse<never>>; | ||
whatsapp: (loginId: string, phone: string) => Promise<SdkResponse<never>>; | ||
sms: <T_1 extends boolean>(loginId: string, phone: string, token?: string, updateOptions?: { | ||
addToLoginIDs?: T_1; | ||
onMergeUseExisting?: T_1 extends true ? boolean : never; | ||
}) => Promise<SdkResponse<{ | ||
maskedPhone: string; | ||
}>>; | ||
whatsapp: <T_1 extends boolean>(loginId: string, phone: string, token?: string, updateOptions?: { | ||
addToLoginIDs?: T_1; | ||
onMergeUseExisting?: T_1 extends true ? boolean : never; | ||
}) => Promise<SdkResponse<{ | ||
maskedPhone: string; | ||
}>>; | ||
}; | ||
@@ -249,34 +337,66 @@ }; | ||
signIn: { | ||
email: (loginId: string, uri: string) => Promise<SdkResponse<never>>; | ||
sms: (loginId: string, uri: string) => Promise<SdkResponse<never>>; | ||
whatsapp: (loginId: string, uri: string) => Promise<SdkResponse<never>>; | ||
sms: (loginId: string, uri: string) => Promise<SdkResponse<{ | ||
maskedPhone: string; | ||
}>>; | ||
whatsapp: (loginId: string, uri: string) => Promise<SdkResponse<{ | ||
maskedPhone: string; | ||
}>>; | ||
email: (loginId: string, uri: string) => Promise<SdkResponse<{ | ||
maskedEmail: string; | ||
}>>; | ||
}; | ||
signUp: { | ||
email: (loginId: string, uri: string, user?: { | ||
sms: (loginId: string, uri: string, user?: { | ||
email?: string; | ||
name?: string; | ||
phone?: string; | ||
}) => Promise<SdkResponse<never>>; | ||
sms: (loginId: string, uri: string, user?: { | ||
}) => Promise<SdkResponse<{ | ||
maskedPhone: string; | ||
}>>; | ||
whatsapp: (loginId: string, uri: string, user?: { | ||
email?: string; | ||
name?: string; | ||
phone?: string; | ||
}) => Promise<SdkResponse<never>>; | ||
whatsapp: (loginId: string, uri: string, user?: { | ||
}) => Promise<SdkResponse<{ | ||
maskedPhone: string; | ||
}>>; | ||
email: (loginId: string, uri: string, user?: { | ||
email?: string; | ||
name?: string; | ||
phone?: string; | ||
}) => Promise<SdkResponse<never>>; | ||
}) => Promise<SdkResponse<{ | ||
maskedEmail: string; | ||
}>>; | ||
}; | ||
signUpOrIn: { | ||
email: (loginId: string, uri: string) => Promise<SdkResponse<never>>; | ||
sms: (loginId: string, uri: string) => Promise<SdkResponse<never>>; | ||
whatsapp: (loginId: string, uri: string) => Promise<SdkResponse<never>>; | ||
sms: (loginId: string, uri: string) => Promise<SdkResponse<{ | ||
maskedPhone: string; | ||
}>>; | ||
whatsapp: (loginId: string, uri: string) => Promise<SdkResponse<{ | ||
maskedPhone: string; | ||
}>>; | ||
email: (loginId: string, uri: string) => Promise<SdkResponse<{ | ||
maskedEmail: string; | ||
}>>; | ||
}; | ||
update: { | ||
email: (loginId: string, email: string, URI?: string, token?: string) => Promise<SdkResponse<never>>; | ||
email: <T_2 extends boolean>(loginId: string, email: string, URI?: string, token?: string, updateOptions?: { | ||
addToLoginIDs?: T_2; | ||
onMergeUseExisting?: T_2 extends true ? boolean : never; | ||
}) => Promise<SdkResponse<{ | ||
maskedEmail: string; | ||
}>>; | ||
phone: { | ||
email: (loginId: string, phone: string) => Promise<SdkResponse<never>>; | ||
sms: (loginId: string, phone: string) => Promise<SdkResponse<never>>; | ||
whatsapp: (loginId: string, phone: string) => Promise<SdkResponse<never>>; | ||
sms: <T_3 extends boolean>(loginId: string, phone: string, URI?: string, token?: string, updateOptions?: { | ||
addToLoginIDs?: T_3; | ||
onMergeUseExisting?: T_3 extends true ? boolean : never; | ||
}) => Promise<SdkResponse<{ | ||
maskedPhone: string; | ||
}>>; | ||
whatsapp: <T_3 extends boolean>(loginId: string, phone: string, URI?: string, token?: string, updateOptions?: { | ||
addToLoginIDs?: T_3; | ||
onMergeUseExisting?: T_3 extends true ? boolean : never; | ||
}) => Promise<SdkResponse<{ | ||
maskedPhone: string; | ||
}>>; | ||
}; | ||
@@ -305,3 +425,6 @@ }; | ||
update: { | ||
email: (loginId: string, email: string, URI?: string, token?: string) => Promise<SdkResponse<_descope_core_js_sdk.EnchantedLinkResponse>>; | ||
email: <T_4 extends boolean>(loginId: string, email: string, URI?: string, token?: string, updateOptions?: { | ||
addToLoginIDs?: T_4; | ||
onMergeUseExisting?: T_4 extends true ? boolean : never; | ||
}) => Promise<SdkResponse<_descope_core_js_sdk.EnchantedLinkResponse>>; | ||
}; | ||
@@ -313,40 +436,24 @@ }; | ||
redirect: boolean; | ||
}>(redirectURL?: string, config?: B) => Promise<B extends { | ||
redirect: true; | ||
} ? undefined : SdkResponse<_descope_core_js_sdk.URLResponse>>; | ||
}>(redirectURL?: string, config?: B) => Promise<SdkResponse<_descope_core_js_sdk.URLResponse>>; | ||
github: <B_1 extends { | ||
redirect: boolean; | ||
}>(redirectURL?: string, config?: B_1) => Promise<B_1 extends { | ||
redirect: true; | ||
} ? undefined : SdkResponse<_descope_core_js_sdk.URLResponse>>; | ||
}>(redirectURL?: string, config?: B_1) => Promise<SdkResponse<_descope_core_js_sdk.URLResponse>>; | ||
google: <B_2 extends { | ||
redirect: boolean; | ||
}>(redirectURL?: string, config?: B_2) => Promise<B_2 extends { | ||
redirect: true; | ||
} ? undefined : SdkResponse<_descope_core_js_sdk.URLResponse>>; | ||
}>(redirectURL?: string, config?: B_2) => Promise<SdkResponse<_descope_core_js_sdk.URLResponse>>; | ||
microsoft: <B_3 extends { | ||
redirect: boolean; | ||
}>(redirectURL?: string, config?: B_3) => Promise<B_3 extends { | ||
redirect: true; | ||
} ? undefined : SdkResponse<_descope_core_js_sdk.URLResponse>>; | ||
}>(redirectURL?: string, config?: B_3) => Promise<SdkResponse<_descope_core_js_sdk.URLResponse>>; | ||
gitlab: <B_4 extends { | ||
redirect: boolean; | ||
}>(redirectURL?: string, config?: B_4) => Promise<B_4 extends { | ||
redirect: true; | ||
} ? undefined : SdkResponse<_descope_core_js_sdk.URLResponse>>; | ||
}>(redirectURL?: string, config?: B_4) => Promise<SdkResponse<_descope_core_js_sdk.URLResponse>>; | ||
apple: <B_5 extends { | ||
redirect: boolean; | ||
}>(redirectURL?: string, config?: B_5) => Promise<B_5 extends { | ||
redirect: true; | ||
} ? undefined : SdkResponse<_descope_core_js_sdk.URLResponse>>; | ||
}>(redirectURL?: string, config?: B_5) => Promise<SdkResponse<_descope_core_js_sdk.URLResponse>>; | ||
discord: <B_6 extends { | ||
redirect: boolean; | ||
}>(redirectURL?: string, config?: B_6) => Promise<B_6 extends { | ||
redirect: true; | ||
} ? undefined : SdkResponse<_descope_core_js_sdk.URLResponse>>; | ||
}>(redirectURL?: string, config?: B_6) => Promise<SdkResponse<_descope_core_js_sdk.URLResponse>>; | ||
linkedin: <B_7 extends { | ||
redirect: boolean; | ||
}>(redirectURL?: string, config?: B_7) => Promise<B_7 extends { | ||
redirect: true; | ||
} ? undefined : SdkResponse<_descope_core_js_sdk.URLResponse>>; | ||
}>(redirectURL?: string, config?: B_7) => Promise<SdkResponse<_descope_core_js_sdk.URLResponse>>; | ||
}; | ||
@@ -359,7 +466,7 @@ exchange: (code: string) => Promise<SdkResponse<_descope_core_js_sdk.JWTResponse & { | ||
saml: { | ||
start: <B_1 extends { | ||
redirect: boolean; | ||
}>(tenantNameOrEmail: string, config?: B_1) => Promise<B_1 extends { | ||
redirect: true; | ||
} ? undefined : SdkResponse<_descope_core_js_sdk.URLResponse>>; | ||
start: (tenantNameOrEmail: string, redirectUrl?: string, loginOptions?: { | ||
stepup?: boolean; | ||
mfa?: boolean; | ||
customClaims?: Record<string, any>; | ||
}, token?: string) => Promise<SdkResponse<_descope_core_js_sdk.URLResponse>>; | ||
exchange: (code: string) => Promise<SdkResponse<_descope_core_js_sdk.JWTResponse & { | ||
@@ -391,3 +498,3 @@ refreshJwt?: string; | ||
options: string; | ||
create: boolean; | ||
create: boolean; /** Get the key that can validate the given JWT KID in the header. Can retrieve the public key from local cache or from Descope. */ | ||
}>>; | ||
@@ -407,3 +514,3 @@ finish: (transactionId: string, response: string) => Promise<SdkResponse<_descope_core_js_sdk.JWTResponse & { | ||
options: string; | ||
create: boolean; | ||
create: boolean; /** Get the key that can validate the given JWT KID in the header. Can retrieve the public key from local cache or from Descope. */ | ||
}>>; | ||
@@ -419,3 +526,3 @@ finish: (transactionId: string, response: string) => Promise<SdkResponse<_descope_core_js_sdk.JWTResponse & { | ||
options: string; | ||
create: boolean; | ||
create: boolean; /** Get the key that can validate the given JWT KID in the header. Can retrieve the public key from local cache or from Descope. */ | ||
}>>; | ||
@@ -427,3 +534,3 @@ }; | ||
options: string; | ||
create: boolean; | ||
create: boolean; /** Get the key that can validate the given JWT KID in the header. Can retrieve the public key from local cache or from Descope. */ | ||
}>>; | ||
@@ -433,2 +540,25 @@ finish: (transactionId: string, response: string) => Promise<SdkResponse<_descope_core_js_sdk.ResponseData>>; | ||
}; | ||
password: { | ||
signUp: (loginId: string, password: string, user?: { | ||
email?: string; | ||
name?: string; | ||
phone?: string; | ||
}) => Promise<SdkResponse<_descope_core_js_sdk.JWTResponse>>; | ||
signIn: (loginId: string, password: string) => Promise<SdkResponse<_descope_core_js_sdk.JWTResponse>>; | ||
sendReset: (loginId: string, redirectUrl?: string) => Promise<SdkResponse<{ | ||
resetMethod: string; | ||
pendingRef?: string; | ||
linkId?: string; | ||
maskedEmail: string; | ||
}>>; | ||
update: (loginId: string, newPassword: string, token?: string) => Promise<SdkResponse<never>>; | ||
replace: (loginId: string, oldPassword: string, newPassword: string) => Promise<SdkResponse<never>>; | ||
policy: () => Promise<SdkResponse<{ | ||
minLength: number; | ||
lowercase: boolean; | ||
uppercase: boolean; | ||
number: boolean; | ||
nonAlphanumeric: boolean; | ||
}>>; | ||
}; | ||
flow: { | ||
@@ -447,8 +577,12 @@ start: (flowId: string, options?: { | ||
}; | ||
redirectAuth?: { | ||
callbackUrl: string; | ||
codeChallenge: string; | ||
}; | ||
}, conditionInteractionId?: string, interactionId?: string, input?: { | ||
[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)[])[])[])[])[])[])[])[])[])[])[]; | ||
}) => Promise<SdkResponse<_descope_core_js_sdk.FlowResponse>>; | ||
}, version?: number) => Promise<SdkResponse<_descope_core_js_sdk.FlowResponse>>; | ||
next: (executionId: string, stepId: string, interactionId: string, input?: { | ||
[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)[])[])[])[])[])[])[])[])[])[])[]; | ||
}) => Promise<SdkResponse<_descope_core_js_sdk.FlowResponse>>; | ||
}, version?: number) => Promise<SdkResponse<_descope_core_js_sdk.FlowResponse>>; | ||
}; | ||
@@ -455,0 +589,0 @@ refresh: (token?: string) => Promise<SdkResponse<_descope_core_js_sdk.JWTResponse & { |
@@ -1,2 +0,2 @@ | ||
import{__rest as e}from"tslib";import t,{transformResponse as a,wrapWith as n}from"@descope/core-js-sdk";import{jwtVerify as s,errors as o,importJWK as r}from"jose";import i,{Headers as l}from"node-fetch-commonjs";const d=t=>async(...a)=>{var n,s,o;const r=await t(...a);if(!r.data)return r;let i=r.data,{refreshJwt:l}=i,d=e(i,["refreshJwt"]);const p=[];var m;return l?p.push(`${"DSR"}=${l}; Domain=${(null==(m=d)?void 0:m.cookieDomain)||""}; Max-Age=${(null==m?void 0:m.cookieMaxAge)||""}; Path=${(null==m?void 0:m.cookiePath)||"/"}; HttpOnly; SameSite=Strict`):(null===(n=r.response)||void 0===n?void 0:n.headers.get("set-cookie"))&&(l=((e,t)=>{const a=null==e?void 0:e.match(RegExp(`(?:^|;\\s*)${t}=([^;]*)`));return a?a[1]:null})(null===(s=r.response)||void 0===s?void 0:s.headers.get("set-cookie"),"DSR"),p.push(null===(o=r.response)||void 0===o?void 0:o.headers.get("set-cookie"))),Object.assign(Object.assign({},r),{data:Object.assign(Object.assign({},r.data),{refreshJwt:l,cookies:p})})};function p(e,t,a){var n,s;const o=a?null===(s=null===(n=e.token.tenants)||void 0===n?void 0:n[a])||void 0===s?void 0:s[t]:e.token[t];return Array.isArray(o)?o:[]}var m={create:"/v1/mgmt/user/create",update:"/v1/mgmt/user/update",delete:"/v1/mgmt/user/delete",load:"/v1/mgmt/user",search:"/v1/mgmt/user/search",updateStatus:"/v1/mgmt/user/update/status",updateEmail:"/v1/mgmt/user/update/email",updatePhone:"/v1/mgmt/user/update/phone",updateDisplayName:"/v1/mgmt/user/update/name",addRole:"/v1/mgmt/user/update/role/add",removeRole:"/v1/mgmt/user/update/role/remove",addTenant:"/v1/mgmt/user/update/tenant/add",removeTenant:"/v1/mgmt/user/update/tenant/remove"},c={create:"/v1/mgmt/accesskey/create",load:"/v1/mgmt/accesskey",search:"/v1/mgmt/accesskey/search",update:"/v1/mgmt/accesskey/update",deactivate:"/v1/mgmt/accesskey/deactivate",activate:"/v1/mgmt/accesskey/activate",delete:"/v1/mgmt/accesskey/delete"},u={create:"/v1/mgmt/tenant/create",update:"/v1/mgmt/tenant/update",delete:"/v1/mgmt/tenant/delete",loadAll:"/v1/mgmt/tenant/all"},h={configure:"/v1/mgmt/sso/settings",metadata:"/v1/mgmt/sso/metadata",mapping:"/v1/mgmt/sso/mapping"},g={update:"/v1/mgmt/jwt/update"},v={create:"/v1/mgmt/permission/create",update:"/v1/mgmt/permission/update",delete:"/v1/mgmt/permission/delete",loadAll:"/v1/mgmt/permission/all"},k={create:"/v1/mgmt/role/create",update:"/v1/mgmt/role/update",delete:"/v1/mgmt/role/delete",loadAll:"/v1/mgmt/role/all"},y={loadAllGroups:"/v1/mgmt/group/all",loadAllGroupsForMember:"/v1/mgmt/group/member/all",loadAllGroupMembers:"/v1/mgmt/group/members"};const f=(e,t)=>({create:(n,s,o,r,i,l)=>a(e.httpClient.post(m.create,{loginId:n,email:s,phone:o,displayName:r,roleNames:i,userTenants:l},{token:t}),(e=>e.user)),invite:(n,s,o,r,i,l)=>a(e.httpClient.post(m.create,{loginId:n,email:s,phone:o,displayName:r,roleNames:i,userTenants:l,invite:!0},{token:t}),(e=>e.user)),update:(n,s,o,r,i,l)=>a(e.httpClient.post(m.update,{loginId:n,email:s,phone:o,displayName:r,roleNames:i,userTenants:l},{token:t}),(e=>e.user)),delete:n=>a(e.httpClient.post(m.delete,{loginId:n},{token:t})),load:n=>a(e.httpClient.get(m.load,{queryParams:{loginId:n},token:t}),(e=>e.user)),loadByUserId:n=>a(e.httpClient.get(m.load,{queryParams:{userId:n},token:t}),(e=>e.user)),searchAll:(n,s,o,r)=>a(e.httpClient.post(m.search,{tenantIds:n,roleNames:s,limit:o,page:r},{token:t}),(e=>e.users)),activate:n=>a(e.httpClient.post(m.updateStatus,{loginId:n,status:"enabled"},{token:t}),(e=>e.user)),deactivate:n=>a(e.httpClient.post(m.updateStatus,{loginId:n,status:"disabled"},{token:t}),(e=>e.user)),updateEmail:(n,s,o)=>a(e.httpClient.post(m.updateEmail,{loginId:n,email:s,verified:o},{token:t}),(e=>e.user)),updatePhone:(n,s,o)=>a(e.httpClient.post(m.updatePhone,{loginId:n,phone:s,verified:o},{token:t}),(e=>e.user)),updateDisplayName:(n,s)=>a(e.httpClient.post(m.updateDisplayName,{loginId:n,displayName:s},{token:t}),(e=>e.user)),addRoles:(n,s)=>a(e.httpClient.post(m.addRole,{loginId:n,roleNames:s},{token:t}),(e=>e.user)),removeRoles:(n,s)=>a(e.httpClient.post(m.removeRole,{loginId:n,roleNames:s},{token:t}),(e=>e.user)),addTenant:(n,s)=>a(e.httpClient.post(m.addTenant,{loginId:n,tenantId:s},{token:t}),(e=>e.user)),removeTenant:(n,s)=>a(e.httpClient.post(m.removeTenant,{loginId:n,tenantId:s},{token:t}),(e=>e.user)),addTenantRoles:(n,s,o)=>a(e.httpClient.post(m.addRole,{loginId:n,tenantId:s,roleNames:o},{token:t}),(e=>e.user)),removeTenantRoles:(n,s,o)=>a(e.httpClient.post(m.removeRole,{loginId:n,tenantId:s,roleNames:o},{token:t}),(e=>e.user))}),C=(e,t)=>({create:(n,s)=>a(e.httpClient.post(u.create,{name:n,selfProvisioningDomains:s},{token:t})),createWithId:(n,s,o)=>a(e.httpClient.post(u.create,{id:n,name:s,selfProvisioningDomains:o},{token:t})),update:(n,s,o)=>a(e.httpClient.post(u.update,{id:n,name:s,selfProvisioningDomains:o},{token:t})),delete:n=>a(e.httpClient.post(u.delete,{id:n},{token:t})),loadAll:()=>a(e.httpClient.get(u.loadAll,{token:t}),(e=>e.tenants))}),w=(e,t)=>({update:(n,s)=>a(e.httpClient.post(g.update,{jwt:n,customClaims:s},{token:t}))}),I=(e,t)=>({create:(n,s)=>a(e.httpClient.post(v.create,{name:n,description:s},{token:t})),update:(n,s,o)=>a(e.httpClient.post(v.update,{name:n,newName:s,description:o},{token:t})),delete:n=>a(e.httpClient.post(v.delete,{name:n},{token:t})),loadAll:()=>a(e.httpClient.get(v.loadAll,{token:t}),(e=>e.permissions))}),b=(e,t)=>({create:(n,s,o)=>a(e.httpClient.post(k.create,{name:n,description:s,permissionNames:o},{token:t})),update:(n,s,o,r)=>a(e.httpClient.post(k.update,{name:n,newName:s,description:o,permissionNames:r},{token:t})),delete:n=>a(e.httpClient.post(k.delete,{name:n},{token:t})),loadAll:()=>a(e.httpClient.get(k.loadAll,{token:t}),(e=>e.roles))}),A=(e,t)=>({loadAllGroups:n=>a(e.httpClient.post(y.loadAllGroups,{tenantId:n},{token:t})),loadAllGroupsForMember:(n,s,o)=>a(e.httpClient.post(y.loadAllGroupsForMember,{tenantId:n,loginIds:o,userIds:s},{token:t})),loadAllGroupMembers:(n,s)=>a(e.httpClient.post(y.loadAllGroupMembers,{tenantId:n,groupId:s},{token:t}))}),j=(e,t)=>({configureSettings:(n,s,o,r,i,l)=>a(e.httpClient.post(h.configure,{tenantId:n,idpURL:s,entityId:r,idpCert:o,redirectURL:i,domain:l},{token:t})),configureMetadata:(n,s)=>a(e.httpClient.post(h.metadata,{tenantId:n,idpMetadataURL:s},{token:t})),configureMapping:(n,s,o)=>a(e.httpClient.post(h.mapping,{tenantId:n,roleMapping:s,attributeMapping:o},{token:t}))}),T=(e,t)=>({create:(n,s,o,r)=>a(e.httpClient.post(c.create,{name:n,expireTime:s,roleNames:o,keyTenants:r},{token:t})),load:n=>a(e.httpClient.get(c.load,{queryParams:{id:n},token:t}),(e=>e.key)),searchAll:n=>a(e.httpClient.post(c.search,{tenantIds:n},{token:t}),(e=>e.keys)),update:(n,s)=>a(e.httpClient.post(c.update,{id:n,name:s},{token:t}),(e=>e.key)),deactivate:n=>a(e.httpClient.post(c.deactivate,{id:n},{token:t})),activate:n=>a(e.httpClient.post(c.activate,{id:n},{token:t})),delete:n=>a(e.httpClient.post(c.delete,{id:n},{token:t}))});var N;null!==(N=globalThis.Headers)&&void 0!==N||(globalThis.Headers=l);const R=(...e)=>(e.forEach((e=>{var t,a;e&&(null!==(t=(a=e).highWaterMark)&&void 0!==t||(a.highWaterMark=32212254720))})),i(...e)),x=a=>{var i,{managementKey:l}=a,m=e(a,["managementKey"]);const c=t(Object.assign(Object.assign({},m),{fetch:R,baseHeaders:Object.assign(Object.assign({},m.baseHeaders),{"x-descope-sdk-name":"nodejs","x-descope-sdk-node-version":(null===(i=null===process||void 0===process?void 0:process.versions)||void 0===i?void 0:i.node)||"","x-descope-sdk-version":"0.0.0-next-0e660dc4-20230313"})})),{projectId:u,logger:h}=m,g={},v=((e,t)=>({user:f(e,t),accessKey:T(e,t),tenant:C(e,t),sso:j(e,t),jwt:w(e,t),permission:I(e,t),role:b(e,t),group:A(e,t)}))(c,l),k=Object.assign(Object.assign({},c),{management:v,async getKey(e){if(!(null==e?void 0:e.kid))throw Error("header.kid must not be empty");if(g[e.kid])return g[e.kid];if(Object.assign(g,await(async()=>{const e=(await c.httpClient.get(`v2/keys/${u}`).then((e=>e.json()))).keys;return Array.isArray(e)?(await Promise.all(e.map((async e=>[e.kid,await r(e)])))).reduce(((e,[t,a])=>t?Object.assign(Object.assign({},e),{[t.toString()]:a}):e),{}):{}})()),!g[e.kid])throw Error("failed to fetch matching key");return g[e.kid]},async validateJwt(e){var t;const a=(await s(e,k.getKey,{clockTolerance:5})).payload;if(a&&(a.iss=null===(t=a.iss)||void 0===t?void 0:t.split("/").pop(),a.iss!==u))throw new o.JWTClaimValidationFailed('unexpected "iss" claim value',"iss","check_failed");return{jwt:e,token:a}},async validateSession(e){if(!e)throw Error("session token is required for validation");try{return await k.validateJwt(e)}catch(e){throw null==h||h.error("session validation failed",e),Error("session validation failed")}},async refreshSession(e){var t,a;if(!e)throw Error("refresh token is required to refresh a session");try{await k.validateJwt(e);const n=await k.refresh(e);if(n.ok){return await k.validateJwt(null===(t=n.data)||void 0===t?void 0:t.sessionJwt)}throw Error(null===(a=n.error)||void 0===a?void 0:a.errorMessage)}catch(e){throw null==h||h.error("refresh token validation failed",e),Error("refresh token validation failed")}},async validateAndRefreshSession(e,t){if(!e&&!t)throw Error("both session and refresh tokens are empty");try{return await k.validateSession(e)}catch(e){null==h||h.log("session validation failed - trying to refresh it")}return k.refreshSession(t)},async exchangeAccessKey(e){if(!e)throw Error("access key must not be empty");let t;try{t=await k.accessKey.exchange(e)}catch(e){throw null==h||h.error("failed to exchange access key",e),Error("could not exchange access key")}const{sessionJwt:a}=t.data;if(!a)throw null==h||h.error("failed to parse exchange access key response"),Error("could not exchange access key");try{return await k.validateJwt(a)}catch(e){throw null==h||h.error("failed to parse jwt from access key",e),Error("could not exchange access key")}},validatePermissions:(e,t)=>k.validateTenantPermissions(e,null,t),validateTenantPermissions(e,t,a){const n=p(e,"permissions",t);return a.every((e=>n.includes(e)))},validateRoles:(e,t)=>k.validateTenantRoles(e,null,t),validateTenantRoles(e,t,a){const n=p(e,"roles",t);return a.every((e=>n.includes(e)))}});return n(k,["otp.verify.email","otp.verify.sms","otp.verify.whatsapp","magicLink.verify","enchantedLink.signUp","enchantedLink.signIn","oauth.exchange","saml.exchange","totp.verify","webauthn.signIn.finish","webauthn.signUp.finish","refresh"],d)};x.RefreshTokenCookieName="DSR",x.SessionTokenCookieName="DS";export{x as default}; | ||
import{__rest as e}from"tslib";import t,{transformResponse as a,wrapWith as s}from"@descope/core-js-sdk";import{jwtVerify as o,errors as n,importJWK as r}from"jose";import i,{Headers as l}from"node-fetch-commonjs";const d=t=>async(...a)=>{var s,o,n;const r=await t(...a);if(!r.data)return r;let i=r.data,{refreshJwt:l}=i,d=e(i,["refreshJwt"]);const p=[];var m;return l?p.push(`${"DSR"}=${l}; Domain=${(null==(m=d)?void 0:m.cookieDomain)||""}; Max-Age=${(null==m?void 0:m.cookieMaxAge)||""}; Path=${(null==m?void 0:m.cookiePath)||"/"}; HttpOnly; SameSite=Strict`):(null===(s=r.response)||void 0===s?void 0:s.headers.get("set-cookie"))&&(l=((e,t)=>{const a=null==e?void 0:e.match(RegExp(`(?:^|;\\s*)${t}=([^;]*)`));return a?a[1]:null})(null===(o=r.response)||void 0===o?void 0:o.headers.get("set-cookie"),"DSR"),p.push(null===(n=r.response)||void 0===n?void 0:n.headers.get("set-cookie"))),Object.assign(Object.assign({},r),{data:Object.assign(Object.assign({},r.data),{refreshJwt:l,cookies:p})})};function p(e,t,a){var s,o;const n=a?null===(o=null===(s=e.token.tenants)||void 0===s?void 0:s[a])||void 0===o?void 0:o[t]:e.token[t];return Array.isArray(n)?n:[]}var m={create:"/v1/mgmt/user/create",update:"/v1/mgmt/user/update",delete:"/v1/mgmt/user/delete",deleteAllTestUsers:"/v1/mgmt/user/test/delete/all",load:"/v1/mgmt/user",search:"/v1/mgmt/user/search",updateStatus:"/v1/mgmt/user/update/status",updateEmail:"/v1/mgmt/user/update/email",updatePhone:"/v1/mgmt/user/update/phone",updateDisplayName:"/v1/mgmt/user/update/name",updatePicture:"/v1/mgmt/user/update/picture",updateCustomAttribute:"/v1/mgmt/user/update/customAttribute",addRole:"/v1/mgmt/user/update/role/add",removeRole:"/v1/mgmt/user/update/role/remove",addTenant:"/v1/mgmt/user/update/tenant/add",removeTenant:"/v1/mgmt/user/update/tenant/remove",generateOTPForTest:"/v1/mgmt/tests/generate/otp",generateMagicLinkForTest:"/v1/mgmt/tests/generate/magiclink",generateEnchantedLinkForTest:"/v1/mgmt/tests/generate/enchantedlink"},u={create:"/v1/mgmt/accesskey/create",load:"/v1/mgmt/accesskey",search:"/v1/mgmt/accesskey/search",update:"/v1/mgmt/accesskey/update",deactivate:"/v1/mgmt/accesskey/deactivate",activate:"/v1/mgmt/accesskey/activate",delete:"/v1/mgmt/accesskey/delete"},c={create:"/v1/mgmt/tenant/create",update:"/v1/mgmt/tenant/update",delete:"/v1/mgmt/tenant/delete",loadAll:"/v1/mgmt/tenant/all"},g={configure:"/v1/mgmt/sso/settings",metadata:"/v1/mgmt/sso/metadata",mapping:"/v1/mgmt/sso/mapping"},h={update:"/v1/mgmt/jwt/update"},v={create:"/v1/mgmt/permission/create",update:"/v1/mgmt/permission/update",delete:"/v1/mgmt/permission/delete",loadAll:"/v1/mgmt/permission/all"},k={create:"/v1/mgmt/role/create",update:"/v1/mgmt/role/update",delete:"/v1/mgmt/role/delete",loadAll:"/v1/mgmt/role/all"},y={export:"/v1/mgmt/flow/export",import:"/v1/mgmt/flow/import"},f={export:"/v1/mgmt/theme/export",import:"/v1/mgmt/theme/import"},C={loadAllGroups:"/v1/mgmt/group/all",loadAllGroupsForMember:"/v1/mgmt/group/member/all",loadAllGroupMembers:"/v1/mgmt/group/members"};const w=(e,t)=>({create:(s,o,n,r,i,l,d,p)=>a(e.httpClient.post(m.create,{loginId:s,email:o,phone:n,displayName:r,roleNames:i,userTenants:l,customAttributes:d,picture:p},{token:t}),(e=>e.user)),createTestUser:(s,o,n,r,i,l,d,p)=>a(e.httpClient.post(m.create,{loginId:s,email:o,phone:n,displayName:r,roleNames:i,userTenants:l,test:!0,customAttributes:d,picture:p},{token:t}),(e=>e.user)),invite:(s,o,n,r,i,l,d,p)=>a(e.httpClient.post(m.create,{loginId:s,email:o,phone:n,displayName:r,roleNames:i,userTenants:l,invite:!0,customAttributes:d,picture:p},{token:t}),(e=>e.user)),update:(s,o,n,r,i,l,d,p)=>a(e.httpClient.post(m.update,{loginId:s,email:o,phone:n,displayName:r,roleNames:i,userTenants:l,customAttributes:d,picture:p},{token:t}),(e=>e.user)),delete:s=>a(e.httpClient.post(m.delete,{loginId:s},{token:t})),deleteAllTestUsers:()=>a(e.httpClient.delete(m.deleteAllTestUsers,{},{token:t})),load:s=>a(e.httpClient.get(m.load,{queryParams:{loginId:s},token:t}),(e=>e.user)),loadByUserId:s=>a(e.httpClient.get(m.load,{queryParams:{userId:s},token:t}),(e=>e.user)),searchAll:(s,o,n,r,i,l,d)=>a(e.httpClient.post(m.search,{tenantIds:s,roleNames:o,limit:n,page:r,testUsersOnly:i,withTestUser:l,customAttributes:d},{token:t}),(e=>e.users)),activate:s=>a(e.httpClient.post(m.updateStatus,{loginId:s,status:"enabled"},{token:t}),(e=>e.user)),deactivate:s=>a(e.httpClient.post(m.updateStatus,{loginId:s,status:"disabled"},{token:t}),(e=>e.user)),updateEmail:(s,o,n)=>a(e.httpClient.post(m.updateEmail,{loginId:s,email:o,verified:n},{token:t}),(e=>e.user)),updatePhone:(s,o,n)=>a(e.httpClient.post(m.updatePhone,{loginId:s,phone:o,verified:n},{token:t}),(e=>e.user)),updateDisplayName:(s,o)=>a(e.httpClient.post(m.updateDisplayName,{loginId:s,displayName:o},{token:t}),(e=>e.user)),updatePicture:(s,o)=>a(e.httpClient.post(m.updatePicture,{loginId:s,picture:o},{token:t}),(e=>e.user)),updateCustomAttribute:(s,o,n)=>a(e.httpClient.post(m.updateCustomAttribute,{loginId:s,attributeKey:o,attributeValue:n},{token:t}),(e=>e.user)),addRoles:(s,o)=>a(e.httpClient.post(m.addRole,{loginId:s,roleNames:o},{token:t}),(e=>e.user)),removeRoles:(s,o)=>a(e.httpClient.post(m.removeRole,{loginId:s,roleNames:o},{token:t}),(e=>e.user)),addTenant:(s,o)=>a(e.httpClient.post(m.addTenant,{loginId:s,tenantId:o},{token:t}),(e=>e.user)),removeTenant:(s,o)=>a(e.httpClient.post(m.removeTenant,{loginId:s,tenantId:o},{token:t}),(e=>e.user)),addTenantRoles:(s,o,n)=>a(e.httpClient.post(m.addRole,{loginId:s,tenantId:o,roleNames:n},{token:t}),(e=>e.user)),removeTenantRoles:(s,o,n)=>a(e.httpClient.post(m.removeRole,{loginId:s,tenantId:o,roleNames:n},{token:t}),(e=>e.user)),generateOTPForTestUser:(s,o)=>a(e.httpClient.post(m.generateOTPForTest,{deliveryMethod:s,loginId:o},{token:t}),(e=>e)),generateMagicLinkForTestUser:(s,o,n)=>a(e.httpClient.post(m.generateMagicLinkForTest,{deliveryMethod:s,loginId:o,URI:n},{token:t}),(e=>e)),generateEnchantedLinkForTestUser:(s,o)=>a(e.httpClient.post(m.generateEnchantedLinkForTest,{loginId:s,URI:o},{token:t}),(e=>e))}),I=(e,t)=>({create:(s,o)=>a(e.httpClient.post(c.create,{name:s,selfProvisioningDomains:o},{token:t})),createWithId:(s,o,n)=>a(e.httpClient.post(c.create,{id:s,name:o,selfProvisioningDomains:n},{token:t})),update:(s,o,n)=>a(e.httpClient.post(c.update,{id:s,name:o,selfProvisioningDomains:n},{token:t})),delete:s=>a(e.httpClient.post(c.delete,{id:s},{token:t})),loadAll:()=>a(e.httpClient.get(c.loadAll,{token:t}),(e=>e.tenants))}),b=(e,t)=>({update:(s,o)=>a(e.httpClient.post(h.update,{jwt:s,customClaims:o},{token:t}))}),T=(e,t)=>({create:(s,o)=>a(e.httpClient.post(v.create,{name:s,description:o},{token:t})),update:(s,o,n)=>a(e.httpClient.post(v.update,{name:s,newName:o,description:n},{token:t})),delete:s=>a(e.httpClient.post(v.delete,{name:s},{token:t})),loadAll:()=>a(e.httpClient.get(v.loadAll,{token:t}),(e=>e.permissions))}),A=(e,t)=>({create:(s,o,n)=>a(e.httpClient.post(k.create,{name:s,description:o,permissionNames:n},{token:t})),update:(s,o,n,r)=>a(e.httpClient.post(k.update,{name:s,newName:o,description:n,permissionNames:r},{token:t})),delete:s=>a(e.httpClient.post(k.delete,{name:s},{token:t})),loadAll:()=>a(e.httpClient.get(k.loadAll,{token:t}),(e=>e.roles))}),x=(e,t)=>({loadAllGroups:s=>a(e.httpClient.post(C.loadAllGroups,{tenantId:s},{token:t})),loadAllGroupsForMember:(s,o,n)=>a(e.httpClient.post(C.loadAllGroupsForMember,{tenantId:s,loginIds:n,userIds:o},{token:t})),loadAllGroupMembers:(s,o)=>a(e.httpClient.post(C.loadAllGroupMembers,{tenantId:s,groupId:o},{token:t}))}),j=(e,t)=>({configureSettings:(s,o,n,r,i,l)=>a(e.httpClient.post(g.configure,{tenantId:s,idpURL:o,entityId:r,idpCert:n,redirectURL:i,domain:l},{token:t})),configureMetadata:(s,o)=>a(e.httpClient.post(g.metadata,{tenantId:s,idpMetadataURL:o},{token:t})),configureMapping:(s,o,n)=>a(e.httpClient.post(g.mapping,{tenantId:s,roleMapping:o,attributeMapping:n},{token:t}))}),N=(e,t)=>({create:(s,o,n,r)=>a(e.httpClient.post(u.create,{name:s,expireTime:o,roleNames:n,keyTenants:r},{token:t})),load:s=>a(e.httpClient.get(u.load,{queryParams:{id:s},token:t}),(e=>e.key)),searchAll:s=>a(e.httpClient.post(u.search,{tenantIds:s},{token:t}),(e=>e.keys)),update:(s,o)=>a(e.httpClient.post(u.update,{id:s,name:o},{token:t}),(e=>e.key)),deactivate:s=>a(e.httpClient.post(u.deactivate,{id:s},{token:t})),activate:s=>a(e.httpClient.post(u.activate,{id:s},{token:t})),delete:s=>a(e.httpClient.post(u.delete,{id:s},{token:t}))}),R=(e,t)=>({export:s=>a(e.httpClient.post(y.export,{flowId:s},{token:t})),import:(s,o,n)=>a(e.httpClient.post(y.import,{flowId:s,flow:o,screens:n},{token:t}))}),M=(e,t)=>({export:()=>a(e.httpClient.post(f.export,{},{token:t})),import:s=>a(e.httpClient.post(f.import,{theme:s},{token:t}))});var P;null!==(P=globalThis.Headers)&&void 0!==P||(globalThis.Headers=l);const E=(...e)=>(e.forEach((e=>{var t,a;e&&(null!==(t=(a=e).highWaterMark)&&void 0!==t||(a.highWaterMark=31457280))})),i(...e)),O=a=>{var i,{managementKey:l}=a,m=e(a,["managementKey"]);const u=t(Object.assign(Object.assign({},m),{fetch:E,baseHeaders:Object.assign(Object.assign({},m.baseHeaders),{"x-descope-sdk-name":"nodejs","x-descope-sdk-node-version":(null===(i=null===process||void 0===process?void 0:process.versions)||void 0===i?void 0:i.node)||"","x-descope-sdk-version":"0.0.0-next-0ff273e7-20230504"})})),{projectId:c,logger:g}=m,h={},v=((e,t)=>({user:w(e,t),accessKey:N(e,t),tenant:I(e,t),sso:j(e,t),jwt:b(e,t),permission:T(e,t),role:A(e,t),group:x(e,t),flow:R(e,t),theme:M(e,t)}))(u,l),k=Object.assign(Object.assign({},u),{management:v,async getKey(e){if(!(null==e?void 0:e.kid))throw Error("header.kid must not be empty");if(h[e.kid])return h[e.kid];if(Object.assign(h,await(async()=>{const e=(await u.httpClient.get(`v2/keys/${c}`).then((e=>e.json()))).keys;return Array.isArray(e)?(await Promise.all(e.map((async e=>[e.kid,await r(e)])))).reduce(((e,[t,a])=>t?Object.assign(Object.assign({},e),{[t.toString()]:a}):e),{}):{}})()),!h[e.kid])throw Error("failed to fetch matching key");return h[e.kid]},async validateJwt(e){var t;const a=(await o(e,k.getKey,{clockTolerance:5})).payload;if(a&&(a.iss=null===(t=a.iss)||void 0===t?void 0:t.split("/").pop(),a.iss!==c))throw new n.JWTClaimValidationFailed('unexpected "iss" claim value',"iss","check_failed");return{jwt:e,token:a}},async validateSession(e){if(!e)throw Error("session token is required for validation");try{return await k.validateJwt(e)}catch(e){throw null==g||g.error("session validation failed",e),Error("session validation failed")}},async refreshSession(e){var t,a;if(!e)throw Error("refresh token is required to refresh a session");try{await k.validateJwt(e);const s=await k.refresh(e);if(s.ok){return await k.validateJwt(null===(t=s.data)||void 0===t?void 0:t.sessionJwt)}throw Error(null===(a=s.error)||void 0===a?void 0:a.errorMessage)}catch(e){throw null==g||g.error("refresh token validation failed",e),Error("refresh token validation failed")}},async validateAndRefreshSession(e,t){if(!e&&!t)throw Error("both session and refresh tokens are empty");try{return await k.validateSession(e)}catch(e){null==g||g.log("session validation failed - trying to refresh it")}return k.refreshSession(t)},async exchangeAccessKey(e){if(!e)throw Error("access key must not be empty");let t;try{t=await k.accessKey.exchange(e)}catch(e){throw null==g||g.error("failed to exchange access key",e),Error("could not exchange access key")}const{sessionJwt:a}=t.data;if(!a)throw null==g||g.error("failed to parse exchange access key response"),Error("could not exchange access key");try{return await k.validateJwt(a)}catch(e){throw null==g||g.error("failed to parse jwt from access key",e),Error("could not exchange access key")}},validatePermissions:(e,t)=>k.validateTenantPermissions(e,null,t),validateTenantPermissions(e,t,a){const s=p(e,"permissions",t);return a.every((e=>s.includes(e)))},validateRoles:(e,t)=>k.validateTenantRoles(e,null,t),validateTenantRoles(e,t,a){const s=p(e,"roles",t);return a.every((e=>s.includes(e)))}});return s(k,["otp.verify.email","otp.verify.sms","otp.verify.whatsapp","magicLink.verify","enchantedLink.signUp","enchantedLink.signIn","oauth.exchange","saml.exchange","totp.verify","webauthn.signIn.finish","webauthn.signUp.finish","refresh"],d)};O.RefreshTokenCookieName="DSR",O.SessionTokenCookieName="DS";export{O as default}; | ||
//# sourceMappingURL=index.esm.js.map |
{ | ||
"name": "@descope/node-sdk", | ||
"version": "0.0.0-next-0e660dc4-20230313", | ||
"version": "0.0.0-next-0ff273e7-20230504", | ||
"description": "Node.js library used to integrate with Descope", | ||
@@ -52,6 +52,6 @@ "typings": "./dist/index.d.ts", | ||
"devDependencies": { | ||
"@rollup/plugin-commonjs": "^22.0.0", | ||
"@rollup/plugin-commonjs": "^24.0.0", | ||
"@rollup/plugin-json": "^4.1.0", | ||
"@rollup/plugin-node-resolve": "^13.3.0", | ||
"@rollup/plugin-replace": "^4.0.0", | ||
"@rollup/plugin-replace": "^5.0.0", | ||
"@rollup/plugin-typescript": "^8.3.0", | ||
@@ -71,3 +71,3 @@ "@size-limit/preset-small-lib": "^8.0.0", | ||
"eslint-plugin-import": "^2.26.0", | ||
"eslint-plugin-jest": "^26.4.6", | ||
"eslint-plugin-jest": "^27.0.0", | ||
"eslint-plugin-jest-dom": "^4.0.2", | ||
@@ -80,3 +80,3 @@ "eslint-plugin-jest-formatting": "^3.1.0", | ||
"jest": "^29.0.0", | ||
"jsdoc": "^3.6.10", | ||
"jsdoc": "^4.0.0", | ||
"lint-staged": "^13.0.3", | ||
@@ -92,3 +92,3 @@ "nock": "^13.2.4", | ||
"rollup-plugin-dts": "^4.2.2", | ||
"rollup-plugin-esbuild": "^4.9.1", | ||
"rollup-plugin-esbuild": "^5.0.0", | ||
"rollup-plugin-inject-process-env": "^1.3.1", | ||
@@ -102,4 +102,4 @@ "rollup-plugin-livereload": "^2.0.5", | ||
"dependencies": { | ||
"@descope/core-js-sdk": "0.0.42", | ||
"jose": "4.13.0", | ||
"@descope/core-js-sdk": "1.2.1", | ||
"jose": "4.14.1", | ||
"node-fetch-commonjs": "3.2.4" | ||
@@ -106,0 +106,0 @@ }, |
142
README.md
@@ -222,2 +222,66 @@ # Descope SDK for Node.js | ||
### Passwords | ||
The user can also authenticate with a password, though it's recommended to | ||
prefer passwordless authentication methods if possible. Sign up requires the | ||
caller to provide a valid password that meets all the requirements configured | ||
for the [password authentication method](https://app.descope.com/settings/authentication/password) in the Descope console. | ||
```js | ||
// Every user must have a loginId. All other user information is optional | ||
const loginId = 'desmond@descope.com'; | ||
const password = 'qYlvi65KaX'; | ||
const user = { | ||
name: 'Desmond Copeland', | ||
email: loginId, | ||
}; | ||
const jwtResponse = await descopeClient.password.signUp(loginId, password, user); | ||
// jwtResponse.data.sessionJwt; | ||
// jwtResponse.data.refreshJwt; | ||
``` | ||
The user can later sign in using the same loginId and password. | ||
```js | ||
const jwtResponse = await descopeClient.password.signIn(loginId, password); | ||
// jwtResponse.data.sessionJwt; | ||
// jwtResponse.data.refreshJwt; | ||
``` | ||
The session and refresh JWTs should be returned to the caller, and passed with every request in the session. Read more on [session validation](#session-validation) | ||
In case the user needs to update their password, one of two methods are available: Resetting their password or replacing their password | ||
**Changing Passwords** | ||
_NOTE: sendReset will only work if the user has a validated email address. Otherwise password reset prompts cannot be sent._ | ||
In the [password authentication method](https://app.descope.com/settings/authentication/password) in the Descope console, it is possible to define which alternative authentication method can be used in order to authenticate the user, in order to reset and update their password. | ||
```js | ||
// Start the reset process by sending a password reset prompt. In this example we'll assume | ||
// that magic link is configured as the reset method. The optional redirect URL is used in the | ||
// same way as in regular magic link authentication. | ||
const loginId = 'desmond@descope.com'; | ||
const redirectURL = 'https://myapp.com/password-reset'; | ||
const passwordResetResponse = await descopeClient.password.sendReset(loginId, redirectURL); | ||
``` | ||
The magic link, in this case, must then be verified like any other magic link (see the [magic link section](#magic-link) for more details). However, after verifying the user, it is expected | ||
to allow them to provide a new password instead of the old one. Since the user is now authenticated, this is possible via: | ||
```js | ||
// The refresh token is required to make sure the user is authenticated. | ||
await descopeClient.password.update(loginId, newPassword, token); | ||
``` | ||
`update()` can always be called when the user is authenticated and has a valid session. | ||
Alternatively, it is also possible to replace an existing active password with a new one. | ||
```js | ||
// Replaces the user's current password with a new one | ||
await descopeClient.password.replace(loginId, oldPassword, newPassword); | ||
``` | ||
### Session Validation | ||
@@ -603,2 +667,31 @@ | ||
### Manage Flows | ||
You can import and export flows and screens, or the project theme: | ||
```typescript | ||
// Export the flow and it's matching screens based on the given id | ||
const res = await descopeClient.management.flow.export('sign-up'); | ||
console.log('found flow', res.data.flow); | ||
res.data.screens.forEach((screen) => { | ||
// do something | ||
}); | ||
// Import the given flow and screens as the given id | ||
const { flow, screens } = res.data; | ||
const updatedRes = descopeClient.management.flow.import('sign-up', flow, screens); | ||
console.log('updated flow', updatedRes.data.flow); | ||
updatedRes.data.screens.forEach((screen) => { | ||
// do something | ||
}); | ||
// Export the current theme of the project | ||
const res = descopeClient.management.theme.export(); | ||
console.log(res.data.theme); | ||
// Import the given theme to the project | ||
const updatedRes = descopeClient.management.theme.import(theme); | ||
console.log(updatedRes.data.theme); | ||
``` | ||
### Manage JWTs | ||
@@ -615,2 +708,51 @@ | ||
### Utils for your end to end (e2e) tests and integration tests | ||
To ease your e2e tests, we exposed dedicated management methods, | ||
that way, you don't need to use 3rd party messaging services in order to receive sign-in/up Emails or SMS, and avoid the need of parsing the code and token from them. | ||
```typescript | ||
// User for test can be created, this user will be able to generate code/link without | ||
// the need of 3rd party messaging services. | ||
// Test user must have a loginId, other fields are optional. | ||
// Roles should be set directly if no tenants exist, otherwise set | ||
// on a per-tenant basis. | ||
await descopeClient.management.user.createTestUser( | ||
'desmond@descope.com', | ||
'desmond@descope.com', | ||
null, | ||
'Desmond Copeland', | ||
null, | ||
[{ tenantId: 'tenant-ID1', roleNames: ['role-name1'] }], | ||
); | ||
// Now test user got created, and this user will be available until you delete it, | ||
// you can use any management operation for test user CRUD. | ||
// You can also delete all test users. | ||
await descopeClient.management.user.deleteAllTestUsers(); | ||
// OTP code can be generated for test user, for example: | ||
const { code } = await descopeClient.management.user.generateOTPForTestUser( | ||
'sms', | ||
'desmond@descope.com', | ||
); | ||
// Now you can verify the code is valid (using descopeClient.auth.*.verify for example) | ||
// Same as OTP, magic link can be generated for test user, for example: | ||
const { link } = await descopeClient.management.user.generateMagicLinkForTestUser( | ||
'email', | ||
'desmond@descope.com', | ||
'', | ||
); | ||
// Enchanted link can be generated for test user, for example: | ||
const { link, pendingRef } = await descopeClient.management.user.generateEnchantedLinkForTestUser( | ||
'desmond@descope.com', | ||
'', | ||
); | ||
// Note 1: The generate code/link functions, work only for test users, will not work for regular users. | ||
// Note 2: In case of testing sign-in / sign-up operations with test users, need to make sure to generate the code prior calling the sign-in / sign-up operations. | ||
``` | ||
## Code Examples | ||
@@ -617,0 +759,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
212169
736
807
105
+ Added@babel/runtime@7.26.0(transitive)
+ Added@descope/core-js-sdk@1.2.1(transitive)
+ Added@eslint-community/eslint-utils@4.4.1(transitive)
+ Added@eslint-community/regexpp@4.12.1(transitive)
+ Added@eslint/eslintrc@2.1.4(transitive)
+ Added@eslint/js@8.57.1(transitive)
+ Added@humanwhocodes/config-array@0.13.0(transitive)
+ Added@humanwhocodes/module-importer@1.0.1(transitive)
+ Added@humanwhocodes/object-schema@2.0.3(transitive)
+ Added@nodelib/fs.scandir@2.1.5(transitive)
+ Added@nodelib/fs.stat@2.0.5(transitive)
+ Added@nodelib/fs.walk@1.2.8(transitive)
+ Added@ungap/structured-clone@1.2.1(transitive)
+ Addedacorn@8.14.0(transitive)
+ Addedacorn-jsx@5.3.2(transitive)
+ Addedajv@6.12.6(transitive)
+ Addedansi-regex@5.0.1(transitive)
+ Addedansi-styles@4.3.0(transitive)
+ Addedargparse@2.0.1(transitive)
+ Addedaria-query@5.3.2(transitive)
+ Addedarray-buffer-byte-length@1.0.2(transitive)
+ Addedarray-includes@3.1.8(transitive)
+ Addedarray.prototype.flat@1.3.3(transitive)
+ Addedarray.prototype.flatmap@1.3.3(transitive)
+ Addedarraybuffer.prototype.slice@1.0.4(transitive)
+ Addedast-types-flow@0.0.7(transitive)
+ Addedavailable-typed-arrays@1.0.7(transitive)
+ Addedaxe-core@4.10.2(transitive)
+ Addedaxobject-query@3.2.4(transitive)
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedcall-bind@1.0.8(transitive)
+ Addedcall-bind-apply-helpers@1.0.1(transitive)
+ Addedcall-bound@1.0.3(transitive)
+ Addedcallsites@3.1.0(transitive)
+ Addedchalk@4.1.2(transitive)
+ Addedcolor-convert@2.0.1(transitive)
+ Addedcolor-name@1.1.4(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addedcross-spawn@7.0.6(transitive)
+ Addeddamerau-levenshtein@1.0.8(transitive)
+ Addeddata-view-buffer@1.0.2(transitive)
+ Addeddata-view-byte-length@1.0.2(transitive)
+ Addeddata-view-byte-offset@1.0.1(transitive)
+ Addeddebug@4.4.0(transitive)
+ Addeddeep-is@0.1.4(transitive)
+ Addeddefine-data-property@1.1.4(transitive)
+ Addeddefine-properties@1.2.1(transitive)
+ Addeddoctrine@3.0.0(transitive)
+ Addeddunder-proto@1.0.1(transitive)
+ Addedemoji-regex@9.2.2(transitive)
+ Addedes-abstract@1.23.9(transitive)
+ Addedes-define-property@1.0.1(transitive)
+ Addedes-errors@1.3.0(transitive)
+ Addedes-object-atoms@1.1.1(transitive)
+ Addedes-set-tostringtag@2.1.0(transitive)
+ Addedes-shim-unscopables@1.0.2(transitive)
+ Addedes-to-primitive@1.3.0(transitive)
+ Addedescape-string-regexp@4.0.0(transitive)
+ Addedeslint@8.57.1(transitive)
+ Addedeslint-plugin-jsx-a11y@6.7.1(transitive)
+ Addedeslint-scope@7.2.2(transitive)
+ Addedeslint-visitor-keys@3.4.3(transitive)
+ Addedespree@9.6.1(transitive)
+ Addedesquery@1.6.0(transitive)
+ Addedesrecurse@4.3.0(transitive)
+ Addedestraverse@5.3.0(transitive)
+ Addedesutils@2.0.3(transitive)
+ Addedfast-deep-equal@3.1.3(transitive)
+ Addedfast-json-stable-stringify@2.1.0(transitive)
+ Addedfast-levenshtein@2.0.6(transitive)
+ Addedfastq@1.18.0(transitive)
+ Addedfile-entry-cache@6.0.1(transitive)
+ Addedfind-up@5.0.0(transitive)
+ Addedflat-cache@3.2.0(transitive)
+ Addedflatted@3.3.2(transitive)
+ Addedfor-each@0.3.3(transitive)
+ Addedfs.realpath@1.0.0(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedfunction.prototype.name@1.1.8(transitive)
+ Addedfunctions-have-names@1.2.3(transitive)
+ Addedget-intrinsic@1.2.7(transitive)
+ Addedget-proto@1.0.1(transitive)
+ Addedget-symbol-description@1.1.0(transitive)
+ Addedglob@7.2.3(transitive)
+ Addedglob-parent@6.0.2(transitive)
+ Addedglobals@13.24.0(transitive)
+ Addedglobalthis@1.0.4(transitive)
+ Addedgopd@1.2.0(transitive)
+ Addedgraphemer@1.4.0(transitive)
+ Addedhas@1.0.4(transitive)
+ Addedhas-bigints@1.1.0(transitive)
+ Addedhas-flag@4.0.0(transitive)
+ Addedhas-property-descriptors@1.0.2(transitive)
+ Addedhas-proto@1.2.0(transitive)
+ Addedhas-symbols@1.1.0(transitive)
+ Addedhas-tostringtag@1.0.2(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedignore@5.3.2(transitive)
+ Addedimport-fresh@3.3.0(transitive)
+ Addedimurmurhash@0.1.4(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedinternal-slot@1.1.0(transitive)
+ Addedis-array-buffer@3.0.5(transitive)
+ Addedis-async-function@2.1.0(transitive)
+ Addedis-bigint@1.1.0(transitive)
+ Addedis-boolean-object@1.2.1(transitive)
+ Addedis-callable@1.2.7(transitive)
+ Addedis-data-view@1.0.2(transitive)
+ Addedis-date-object@1.1.0(transitive)
+ Addedis-extglob@2.1.1(transitive)
+ Addedis-finalizationregistry@1.1.1(transitive)
+ Addedis-generator-function@1.1.0(transitive)
+ Addedis-glob@4.0.3(transitive)
+ Addedis-map@2.0.3(transitive)
+ Addedis-number-object@1.1.1(transitive)
+ Addedis-path-inside@3.0.3(transitive)
+ Addedis-regex@1.2.1(transitive)
+ Addedis-set@2.0.3(transitive)
+ Addedis-shared-array-buffer@1.0.4(transitive)
+ Addedis-string@1.1.1(transitive)
+ Addedis-symbol@1.1.1(transitive)
+ Addedis-typed-array@1.1.15(transitive)
+ Addedis-weakmap@2.0.2(transitive)
+ Addedis-weakref@1.1.0(transitive)
+ Addedis-weakset@2.0.4(transitive)
+ Addedisarray@2.0.5(transitive)
+ Addedisexe@2.0.0(transitive)
+ Addedjose@4.14.1(transitive)
+ Addedjs-yaml@4.1.0(transitive)
+ Addedjson-buffer@3.0.1(transitive)
+ Addedjson-schema-traverse@0.4.1(transitive)
+ Addedjson-stable-stringify-without-jsonify@1.0.1(transitive)
+ Addedjsx-ast-utils@3.3.5(transitive)
+ Addedkeyv@4.5.4(transitive)
+ Addedlevn@0.4.1(transitive)
+ Addedlocate-path@6.0.0(transitive)
+ Addedlodash.merge@4.6.2(transitive)
+ Addedmath-intrinsics@1.1.0(transitive)
+ Addedminimatch@3.1.2(transitive)
+ Addedms@2.1.3(transitive)
+ Addednatural-compare@1.4.0(transitive)
+ Addedobject-inspect@1.13.3(transitive)
+ Addedobject-keys@1.1.1(transitive)
+ Addedobject.assign@4.1.7(transitive)
+ Addedobject.entries@1.1.8(transitive)
+ Addedobject.fromentries@2.0.8(transitive)
+ Addedobject.values@1.2.1(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedoptionator@0.9.4(transitive)
+ Addedown-keys@1.0.1(transitive)
+ Addedp-limit@3.1.0(transitive)
+ Addedp-locate@5.0.0(transitive)
+ Addedparent-module@1.0.1(transitive)
+ Addedpath-exists@4.0.0(transitive)
+ Addedpath-is-absolute@1.0.1(transitive)
+ Addedpath-key@3.1.1(transitive)
+ Addedpossible-typed-array-names@1.0.0(transitive)
+ Addedprelude-ls@1.2.1(transitive)
+ Addedpunycode@2.3.1(transitive)
+ Addedqueue-microtask@1.2.3(transitive)
+ Addedreflect.getprototypeof@1.0.10(transitive)
+ Addedregenerator-runtime@0.14.1(transitive)
+ Addedregexp.prototype.flags@1.5.4(transitive)
+ Addedresolve-from@4.0.0(transitive)
+ Addedreusify@1.0.4(transitive)
+ Addedrimraf@3.0.2(transitive)
+ Addedrun-parallel@1.2.0(transitive)
+ Addedsafe-array-concat@1.1.3(transitive)
+ Addedsafe-push-apply@1.0.0(transitive)
+ Addedsafe-regex-test@1.1.0(transitive)
+ Addedsemver@6.3.1(transitive)
+ Addedset-function-length@1.2.2(transitive)
+ Addedset-function-name@2.0.2(transitive)
+ Addedset-proto@1.0.0(transitive)
+ Addedshebang-command@2.0.0(transitive)
+ Addedshebang-regex@3.0.0(transitive)
+ Addedside-channel@1.1.0(transitive)
+ Addedside-channel-list@1.0.0(transitive)
+ Addedside-channel-map@1.0.1(transitive)
+ Addedside-channel-weakmap@1.0.2(transitive)
+ Addedstring.prototype.trim@1.2.10(transitive)
+ Addedstring.prototype.trimend@1.0.9(transitive)
+ Addedstring.prototype.trimstart@1.0.8(transitive)
+ Addedstrip-ansi@6.0.1(transitive)
+ Addedstrip-json-comments@3.1.1(transitive)
+ Addedsupports-color@7.2.0(transitive)
+ Addedtext-table@0.2.0(transitive)
+ Addedtype-check@0.4.0(transitive)
+ Addedtype-fest@0.20.2(transitive)
+ Addedtyped-array-buffer@1.0.3(transitive)
+ Addedtyped-array-byte-length@1.0.3(transitive)
+ Addedtyped-array-byte-offset@1.0.4(transitive)
+ Addedtyped-array-length@1.0.7(transitive)
+ Addedunbox-primitive@1.1.0(transitive)
+ Addeduri-js@4.4.1(transitive)
+ Addedwhich@2.0.2(transitive)
+ Addedwhich-boxed-primitive@1.1.1(transitive)
+ Addedwhich-builtin-type@1.2.1(transitive)
+ Addedwhich-collection@1.0.2(transitive)
+ Addedwhich-typed-array@1.1.18(transitive)
+ Addedword-wrap@1.2.5(transitive)
+ Addedwrappy@1.0.2(transitive)
+ Addedyocto-queue@0.1.0(transitive)
- Removed@descope/core-js-sdk@0.0.42(transitive)
- Removedjose@4.13.0(transitive)
Updated@descope/core-js-sdk@1.2.1
Updatedjose@4.14.1