0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00

refactor: upgrade logto sdks (#6160)

This commit is contained in:
Gao Sun 2024-07-02 12:32:22 +08:00 committed by GitHub
parent 6dc380145c
commit 9d3697a3b1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 49 additions and 39 deletions

View file

@ -33,7 +33,7 @@
"@logto/language-kit": "workspace:^1.1.0",
"@logto/phrases": "workspace:^1.11.0",
"@logto/phrases-experience": "workspace:^1.6.1",
"@logto/react": "^3.0.11",
"@logto/react": "^3.0.12",
"@logto/schemas": "workspace:^1.17.0",
"@logto/shared": "workspace:^3.1.1",
"@mdx-js/mdx": "^3.0.1",

View file

@ -22,7 +22,7 @@
"@logto/core-kit": "workspace:^2.4.0",
"@logto/language-kit": "workspace:^1.1.0",
"@logto/phrases": "workspace:^1.10.0",
"@logto/react": "^3.0.11",
"@logto/react": "^3.0.12",
"@logto/schemas": "workspace:^1.15.0",
"@parcel/core": "2.9.3",
"@parcel/transformer-sass": "2.9.3",

View file

@ -26,7 +26,7 @@
"@jest/types": "^29.1.2",
"@logto/connector-kit": "workspace:^3.0.0",
"@logto/core-kit": "workspace:^",
"@logto/js": "^4.1.1",
"@logto/js": "^4.1.4",
"@logto/node": "^2.4.7",
"@logto/schemas": "workspace:^1.17.0",
"@logto/shared": "workspace:^3.1.1",

View file

@ -1,4 +1,7 @@
import assert from 'node:assert';
import { UserScope, buildOrganizationUrn } from '@logto/core-kit';
import { LogtoError } from '@logto/js';
import { InteractionEvent, MfaFactor } from '@logto/schemas';
import { createUserMfaVerification, deleteUser } from '#src/api/admin-user.js';
@ -92,18 +95,33 @@ describe('get access token for organization', () => {
await organizationApi.deleteUser(newOrganization.id, testUserId);
await client.clearAccessToken();
await expect(
client.getOrganizationTokenClaims(newOrganization.id)
).rejects.toMatchInlineSnapshot('[Error: Access denied.]');
const error = await client
.getOrganizationTokenClaims(newOrganization.id)
.catch((error: unknown) => error);
assert(error instanceof LogtoError);
expect(error.code).toBe('unexpected_response_error');
expect(error.data).toMatchObject({
code: 'oidc.access_denied',
error: 'access_denied',
});
});
it('should throw when organization requires mfa but user has not configured', async () => {
await organizationApi.update(testOrganizationId, { isMfaRequired: true });
await client.clearAccessToken();
await expect(
client.getOrganizationTokenClaims(testOrganizationId)
).rejects.toMatchInlineSnapshot('[Error: Access denied.]');
const error = await client
.getOrganizationTokenClaims(testOrganizationId)
.catch((error: unknown) => error);
assert(error instanceof LogtoError);
expect(error.code).toBe('unexpected_response_error');
expect(error.data).toMatchObject({
code: 'oidc.access_denied',
error: 'access_denied',
});
});
it('should be able to get access token for organization when user has mfa configured', async () => {

View file

@ -2876,8 +2876,8 @@ importers:
specifier: workspace:^1.6.1
version: link:../phrases-experience
'@logto/react':
specifier: ^3.0.11
version: 3.0.11(react@18.2.0)
specifier: ^3.0.12
version: 3.0.13(react@18.2.0)
'@logto/schemas':
specifier: workspace:^1.17.0
version: link:../schemas
@ -3471,8 +3471,8 @@ importers:
specifier: workspace:^1.10.0
version: link:../phrases
'@logto/react':
specifier: ^3.0.11
version: 3.0.11(react@18.2.0)
specifier: ^3.0.12
version: 3.0.13(react@18.2.0)
'@logto/schemas':
specifier: workspace:^1.15.0
version: link:../schemas
@ -3787,8 +3787,8 @@ importers:
specifier: workspace:^
version: link:../toolkit/core-kit
'@logto/js':
specifier: ^4.1.1
version: 4.1.1
specifier: ^4.1.4
version: 4.1.4
'@logto/node':
specifier: ^2.4.7
version: 2.4.7
@ -5245,30 +5245,27 @@ packages:
resolution: {integrity: sha512-yDWSZMI2Qo/xoYU92tnwSP/gnSvq8+CLK5DqD/4brO42QJa7xjt7eA+HSyuMmSUrKffY2nP3riU81gs+nR8DkA==}
engines: {node: ^18.12.0}
'@logto/browser@2.2.13':
resolution: {integrity: sha512-7fyenm6f2xSzZc8GHFpAL38rxAXf1hQH/ySSow8QHjgypF0pz9zy9bRSG1oVFgsMrFWYf73dPk7V2ACQ5Tujww==}
'@logto/browser@2.2.15':
resolution: {integrity: sha512-sQf2jYTHMuU8tVqkgaoWrKy3mhuyuLqsUDmDr6TBRv6jjFQMnniI6/5jHlqnllCs6B5x8qsjctcqcYiqKQmc5g==}
'@logto/client@2.6.6':
resolution: {integrity: sha512-QT7jMnzEIWHBNrf9/M8p1OErRBbbNZjoekXGji5aZCyUh975hh8+GEBL21HV71FT3H/5Cq4Gf1GzUbAIW3izMA==}
'@logto/client@2.7.0':
resolution: {integrity: sha512-8mj+757befwQJ4M0h4f3fQwUB1lruDkyLNTyRFOQxFfDMN1QeD70B4nMnz6iTX/Gi09HnIskmj9MHWrbvH6LSQ==}
'@logto/client@2.7.2':
resolution: {integrity: sha512-jsmuDl9QpXfR3uLEMPE67tvYoL5XcjJi+4yGqucYPjd4GH6SUHp3N9skk8C/OyygnKDPLY+ttwD0LaIbpGvn+Q==}
'@logto/cloud@0.2.5-a7eedce':
resolution: {integrity: sha512-FFjkGjqUgn9PCZnSuCODm2FcjqBm4JfPxfHCiXlOkUjeUhTJLrj7C0gjKzSQ/B6IaWri4EXN/meuqi5z/AMIPg==}
engines: {node: ^20.9.0}
'@logto/js@4.1.1':
resolution: {integrity: sha512-+RgthBvDw30UojirtAjZeHNfOwDQVURmpjcIBYTIf6afx5F5jJq8b1D/eaFbrCFrmXmatkT2iN7X8kYHui86WQ==}
'@logto/js@4.1.3':
resolution: {integrity: sha512-TIYrVSyD0c1mEt3fU9NKbWRTblujs3Ct/DYgNzBLzE/tmSVvwM6Z4JxnwZZ3xyfnL8dC4UfSQRlc2gjSMzKUGw==}
'@logto/js@4.1.4':
resolution: {integrity: sha512-6twud1nFBQmj89/aflzej6yD1QwXfPiYmRtyYuN4a7O9OaaW3X/kJBVwjKUn5NC9IUt+rd+jXsI3QJXENfaLAw==}
'@logto/node@2.4.7':
resolution: {integrity: sha512-AlANeqY1NIt93EBcRzrTmyAVHXOHpszTJK+qe1ok50rmZlTmX2p7yQvrg0/Ehwf/+4Rla5vooAR+HIFMaOmPpQ==}
'@logto/react@3.0.11':
resolution: {integrity: sha512-JyOOf7zZOEg7fTRldfi9SGwwbuk3qJTlIKld+GQ1yGWIXilI2JyyY2XQraZWpHQLW8KtQFgRWQ/fUKV0bideFQ==}
'@logto/react@3.0.13':
resolution: {integrity: sha512-t3aHYtgJLocawGtL5hVO05/At6qa5WUAxqTj7FhxI4BDpewD2KZCVfbQyr9YXrPg60mTzkk0r00oEEO3oZqSVA==}
peerDependencies:
react: '>=16.8.0'
@ -14960,22 +14957,22 @@ snapshots:
'@silverhand/essentials': 2.9.1
tiny-cookie: 2.4.1
'@logto/browser@2.2.13':
'@logto/browser@2.2.15':
dependencies:
'@logto/client': 2.7.0
'@logto/client': 2.7.2
'@silverhand/essentials': 2.9.1
js-base64: 3.7.5
'@logto/client@2.6.6':
dependencies:
'@logto/js': 4.1.1
'@logto/js': 4.1.4
'@silverhand/essentials': 2.9.1
camelcase-keys: 7.0.2
jose: 5.2.4
'@logto/client@2.7.0':
'@logto/client@2.7.2':
dependencies:
'@logto/js': 4.1.3
'@logto/js': 4.1.4
'@silverhand/essentials': 2.9.1
camelcase-keys: 7.0.2
jose: 5.2.4
@ -14987,12 +14984,7 @@ snapshots:
transitivePeerDependencies:
- zod
'@logto/js@4.1.1':
dependencies:
'@silverhand/essentials': 2.9.1
camelcase-keys: 7.0.2
'@logto/js@4.1.3':
'@logto/js@4.1.4':
dependencies:
'@silverhand/essentials': 2.9.1
camelcase-keys: 7.0.2
@ -15003,9 +14995,9 @@ snapshots:
'@silverhand/essentials': 2.9.1
js-base64: 3.7.5
'@logto/react@3.0.11(react@18.2.0)':
'@logto/react@3.0.13(react@18.2.0)':
dependencies:
'@logto/browser': 2.2.13
'@logto/browser': 2.2.15
'@silverhand/essentials': 2.9.1
react: 18.2.0