From 92a04f08bd65e31c7ec3eebd2f87150ce3ad4ad3 Mon Sep 17 00:00:00 2001 From: Darcy Ye Date: Tue, 5 Mar 2024 20:05:17 +0800 Subject: [PATCH] feat(core): use PUT instead of POST and refactor code --- packages/core/src/middleware/koa-guard.ts | 21 +++++-- packages/core/src/queries/logto-config.ts | 8 ++- .../core/src/routes/logto-config.openapi.json | 12 ++-- packages/core/src/routes/logto-config.test.ts | 31 ++++++---- packages/core/src/routes/logto-config.ts | 56 +++++++++---------- .../integration-tests/src/api/logto-config.ts | 4 +- .../src/tests/api/logto-config.test.ts | 26 ++++++++- .../phrases/src/locales/de/errors/index.ts | 2 - .../src/locales/de/errors/logto-config.ts | 9 --- .../phrases/src/locales/en/errors/index.ts | 2 - .../src/locales/en/errors/logto-config.ts | 8 --- .../phrases/src/locales/es/errors/index.ts | 2 - .../src/locales/es/errors/logto-config.ts | 9 --- .../phrases/src/locales/fr/errors/index.ts | 2 - .../src/locales/fr/errors/logto-config.ts | 9 --- .../phrases/src/locales/it/errors/index.ts | 2 - .../src/locales/it/errors/logto-config.ts | 9 --- .../phrases/src/locales/ja/errors/index.ts | 2 - .../src/locales/ja/errors/logto-config.ts | 9 --- .../phrases/src/locales/ko/errors/index.ts | 2 - .../src/locales/ko/errors/logto-config.ts | 9 --- .../phrases/src/locales/pl-pl/errors/index.ts | 2 - .../src/locales/pl-pl/errors/logto-config.ts | 9 --- .../phrases/src/locales/pt-br/errors/index.ts | 2 - .../src/locales/pt-br/errors/logto-config.ts | 9 --- .../phrases/src/locales/pt-pt/errors/index.ts | 2 - .../src/locales/pt-pt/errors/logto-config.ts | 9 --- .../phrases/src/locales/ru/errors/index.ts | 2 - .../src/locales/ru/errors/logto-config.ts | 9 --- .../phrases/src/locales/tr-tr/errors/index.ts | 2 - .../src/locales/tr-tr/errors/logto-config.ts | 9 --- .../phrases/src/locales/zh-cn/errors/index.ts | 2 - .../src/locales/zh-cn/errors/logto-config.ts | 9 --- .../phrases/src/locales/zh-hk/errors/index.ts | 2 - .../src/locales/zh-hk/errors/logto-config.ts | 9 --- .../phrases/src/locales/zh-tw/errors/index.ts | 2 - .../src/locales/zh-tw/errors/logto-config.ts | 9 --- 37 files changed, 96 insertions(+), 226 deletions(-) delete mode 100644 packages/phrases/src/locales/de/errors/logto-config.ts delete mode 100644 packages/phrases/src/locales/en/errors/logto-config.ts delete mode 100644 packages/phrases/src/locales/es/errors/logto-config.ts delete mode 100644 packages/phrases/src/locales/fr/errors/logto-config.ts delete mode 100644 packages/phrases/src/locales/it/errors/logto-config.ts delete mode 100644 packages/phrases/src/locales/ja/errors/logto-config.ts delete mode 100644 packages/phrases/src/locales/ko/errors/logto-config.ts delete mode 100644 packages/phrases/src/locales/pl-pl/errors/logto-config.ts delete mode 100644 packages/phrases/src/locales/pt-br/errors/logto-config.ts delete mode 100644 packages/phrases/src/locales/pt-pt/errors/logto-config.ts delete mode 100644 packages/phrases/src/locales/ru/errors/logto-config.ts delete mode 100644 packages/phrases/src/locales/tr-tr/errors/logto-config.ts delete mode 100644 packages/phrases/src/locales/zh-cn/errors/logto-config.ts delete mode 100644 packages/phrases/src/locales/zh-hk/errors/logto-config.ts delete mode 100644 packages/phrases/src/locales/zh-tw/errors/logto-config.ts diff --git a/packages/core/src/middleware/koa-guard.ts b/packages/core/src/middleware/koa-guard.ts index 8b24f3f71..2deb09d8c 100644 --- a/packages/core/src/middleware/koa-guard.ts +++ b/packages/core/src/middleware/koa-guard.ts @@ -92,16 +92,27 @@ export const isGuardMiddleware = ( ): function_ is WithGuardConfig => function_.name === 'guardMiddleware' && has(function_, 'config'); -export const tryParse = ( +export const parse = ( + type: 'query' | 'body' | 'params' | 'files', + guard: ZodType, + data: unknown +) => { + try { + return guard.parse(data); + } catch (error: unknown) { + throw new RequestError({ code: 'guard.invalid_input', type }, error); + } +}; + +const tryParse = ( type: 'query' | 'body' | 'params' | 'files', guard: Optional>, data: unknown ) => { - try { - return guard?.parse(data); - } catch (error: unknown) { - throw new RequestError({ code: 'guard.invalid_input', type }, error); + if (!guard) { + return; } + return parse(type, guard, data); }; export default function koaGuard< diff --git a/packages/core/src/queries/logto-config.ts b/packages/core/src/queries/logto-config.ts index 7b33b5aad..a7cabae10 100644 --- a/packages/core/src/queries/logto-config.ts +++ b/packages/core/src/queries/logto-config.ts @@ -53,7 +53,7 @@ export const createLogtoConfigQueries = (pool: CommonQueryMethods) => { `); // Can not narrow down the type of value if we utilize `buildInsertIntoWithPool` method. - const insertJwtCustomizer = async ( + const insertOrUpdateJwtCustomizer = async ( key: T, value: z.infer<(typeof jwtCustomizerConfigGuard)[T]> ) => @@ -61,7 +61,9 @@ export const createLogtoConfigQueries = (pool: CommonQueryMethods) => { sql` insert into ${table} (${fields.key}, ${fields.value}) values (${key}, ${sql.jsonb(value)}) - on conflict (${fields.tenantId}, ${fields.key}) do nothing + on conflict (${fields.tenantId}, ${fields.key}) do update set ${ + fields.value + } = ${sql.jsonb(value)} returning * ` ); @@ -72,6 +74,6 @@ export const createLogtoConfigQueries = (pool: CommonQueryMethods) => { getCloudConnectionData, getRowsByKeys, updateOidcConfigsByKey, - insertJwtCustomizer, + insertOrUpdateJwtCustomizer, }; }; diff --git a/packages/core/src/routes/logto-config.openapi.json b/packages/core/src/routes/logto-config.openapi.json index bf586f3ee..6c321d043 100644 --- a/packages/core/src/routes/logto-config.openapi.json +++ b/packages/core/src/routes/logto-config.openapi.json @@ -106,9 +106,9 @@ } }, "/api/configs/jwt-customizer/{tokenType}": { - "post": { - "summary": "Create JWT customizer", - "description": "Create a JWT customizer for the given token type.", + "put": { + "summary": "Create or update JWT customizer", + "description": "Create or update a JWT customizer for the given token type.", "parameters": [ { "in": "path", @@ -139,14 +139,14 @@ } }, "responses": { + "200": { + "description": "The updated JWT customizer." + }, "201": { "description": "The created JWT customizer." }, "400": { "description": "The request body is invalid." - }, - "409": { - "description": "The JWT customizer already exists." } } } diff --git a/packages/core/src/routes/logto-config.test.ts b/packages/core/src/routes/logto-config.test.ts index af95dd06a..ce0dc9dc4 100644 --- a/packages/core/src/routes/logto-config.test.ts +++ b/packages/core/src/routes/logto-config.test.ts @@ -54,7 +54,7 @@ const logtoConfigQueries = { }), updateOidcConfigsByKey: jest.fn(), getRowsByKeys: jest.fn(async () => mockLogtoConfigRows), - insertJwtCustomizer: jest.fn(), + insertOrUpdateJwtCustomizer: jest.fn(), }; const logtoConfigLibraries = { @@ -226,36 +226,43 @@ describe('configs routes', () => { ); }); - it('POST /configs/jwt-customizer/:tokenType should add a record successfully', async () => { + it('PUT /configs/jwt-customizer/:tokenType should add a record successfully', async () => { logtoConfigQueries.getRowsByKeys.mockResolvedValueOnce({ ...mockLogtoConfigRows, rows: [], rowCount: 0, }); - logtoConfigQueries.insertJwtCustomizer.mockResolvedValueOnce( + logtoConfigQueries.insertOrUpdateJwtCustomizer.mockResolvedValueOnce( mockJwtCustomizerConfigForAccessToken ); const response = await routeRequester - .post('/configs/jwt-customizer/access-token') - .send(mockJwtCustomizerConfigForAccessToken); - expect(logtoConfigQueries.insertJwtCustomizer).toHaveBeenCalledWith( + .put(`/configs/jwt-customizer/access-token`) + .send(mockJwtCustomizerConfigForAccessToken.value); + expect(logtoConfigQueries.insertOrUpdateJwtCustomizer).toHaveBeenCalledWith( LogtoJwtTokenKey.AccessToken, - mockJwtCustomizerConfigForAccessToken + mockJwtCustomizerConfigForAccessToken.value ); expect(response.status).toEqual(201); expect(response.body).toEqual(mockJwtCustomizerConfigForAccessToken.value); }); - it('POST /configs/jwt-customizer/:tokenType should fail ', async () => { + it('PUT /configs/jwt-customizer/:tokenType should update a record successfully', async () => { logtoConfigQueries.getRowsByKeys.mockResolvedValueOnce({ ...mockLogtoConfigRows, rows: [mockJwtCustomizerConfigForAccessToken], rowCount: 1, }); + logtoConfigQueries.insertOrUpdateJwtCustomizer.mockResolvedValueOnce( + mockJwtCustomizerConfigForAccessToken + ); const response = await routeRequester - .post('/configs/jwt-customizer/access-token') - .send(mockJwtCustomizerConfigForAccessToken); - expect(logtoConfigQueries.insertJwtCustomizer).not.toHaveBeenCalled(); - expect(response.status).toEqual(409); + .put('/configs/jwt-customizer/access-token') + .send(mockJwtCustomizerConfigForAccessToken.value); + expect(logtoConfigQueries.insertOrUpdateJwtCustomizer).toHaveBeenCalledWith( + LogtoJwtTokenKey.AccessToken, + mockJwtCustomizerConfigForAccessToken.value + ); + expect(response.status).toEqual(200); + expect(response.body).toEqual(mockJwtCustomizerConfigForAccessToken.value); }); }); diff --git a/packages/core/src/routes/logto-config.ts b/packages/core/src/routes/logto-config.ts index 3fac88e3a..86685de8a 100644 --- a/packages/core/src/routes/logto-config.ts +++ b/packages/core/src/routes/logto-config.ts @@ -20,8 +20,7 @@ import { import { z } from 'zod'; import RequestError from '#src/errors/RequestError/index.js'; -import koaGuard, { tryParse } from '#src/middleware/koa-guard.js'; -import assertThat from '#src/utils/assert-that.js'; +import koaGuard, { parse } from '#src/middleware/koa-guard.js'; import { exportJWK } from '#src/utils/jwks.js'; import type { AuthedRouter, RouterInitArgs } from './types.js'; @@ -39,6 +38,16 @@ const getLogtoJwtTokenKey = (key: LogtoJwtTokenKeyType): LogtoJwtTokenKey => ? LogtoJwtTokenKey.AccessToken : LogtoJwtTokenKey.ClientCredentials; +const guardJwtCustomizerBody = (tokenType: LogtoJwtTokenKeyType, body: unknown) => { + // Manually implement the request body type check, the flow aligns with the actual `koaGuard()`. + // Use ternary operator to get the specific guard brings difficulties to type inference. + if (tokenType === LogtoJwtTokenKeyType.AccessToken) { + return parse('body', jwtCustomizerAccessTokenGuard, body); + } + + return parse('body', jwtCustomizerClientCredentialsGuard, body); +}; + /** * Remove actual values of the private keys from response. * @param type Logto config key DB column name. Values are either `oidc.privateKeys` or `oidc.cookieKeys`. @@ -73,7 +82,7 @@ export default function logtoConfigRoutes( const { getAdminConsoleConfig, getRowsByKeys, - insertJwtCustomizer, + insertOrUpdateJwtCustomizer, updateAdminConsoleConfig, updateOidcConfigsByKey, } = queries.logtoConfigs; @@ -198,7 +207,7 @@ export default function logtoConfigRoutes( } ); - router.post( + router.put( '/configs/jwt-customizer/:tokenType', koaGuard({ params: z.object({ @@ -208,43 +217,28 @@ export default function logtoConfigRoutes( * Use `z.unknown()` to guard the request body as a JSON object, since the actual guard depends * on the `tokenType` and we can not get the value of `tokenType` before parsing the request body, * we will do more specific guard as long as we can get the value of `tokenType`. + * + * Should specify `body` in koaGuard, otherwise the request body is not accessible even via `ctx.request.body`. */ body: z.unknown(), response: jwtCustomizerAccessTokenGuard.or(jwtCustomizerClientCredentialsGuard), - status: [201, 400, 409], + status: [200, 201, 400], }), async (ctx, next) => { const { params: { tokenType }, - body, + body: rawBody, } = ctx.guard; + const key = getLogtoJwtTokenKey(tokenType); + const body = guardJwtCustomizerBody(tokenType, rawBody); - // Manually implement the request body type check, the flow aligns with the actual `koaGuard()`. - // Use ternary operator to get the specific guard brings difficulties to type inference. - if (tokenType === LogtoJwtTokenKeyType.AccessToken) { - tryParse('body', jwtCustomizerAccessTokenGuard, body); - } else { - tryParse('body', jwtCustomizerClientCredentialsGuard, body); + const { rows } = await getRowsByKeys([key]); + + const jwtCustomizer = await insertOrUpdateJwtCustomizer(key, body); + + if (rows.length === 0) { + ctx.status = 201; } - - const { rows } = await getRowsByKeys([getLogtoJwtTokenKey(tokenType)]); - assertThat( - rows.length === 0, - new RequestError({ - code: 'logto_config.jwt.customizer_exists', - tokenType, - status: 409, - }) - ); - - const jwtCustomizer = await insertJwtCustomizer( - getLogtoJwtTokenKey(tokenType), - // Since we applied the detailed guard manually, we can safely cast the `body` to the specific type. - // eslint-disable-next-line no-restricted-syntax - body as Parameters[1] - ); - - ctx.status = 201; ctx.body = jwtCustomizer.value; return next(); diff --git a/packages/integration-tests/src/api/logto-config.ts b/packages/integration-tests/src/api/logto-config.ts index badc14b09..3d70ea19b 100644 --- a/packages/integration-tests/src/api/logto-config.ts +++ b/packages/integration-tests/src/api/logto-config.ts @@ -34,7 +34,7 @@ export const rotateOidcKeys = async ( .post(`configs/oidc/${keyType}/rotate`, { json: { signingKeyAlgorithm } }) .json(); -export const insertJwtCustomizer = async (keyType: LogtoJwtTokenKeyType, value: unknown) => +export const insertOrUpdateJwtCustomizer = async (keyType: LogtoJwtTokenKeyType, value: unknown) => authedAdminApi - .post(`configs/jwt-customizer/${keyType}`, { json: value }) + .put(`configs/jwt-customizer/${keyType}`, { json: value }) .json(); diff --git a/packages/integration-tests/src/tests/api/logto-config.test.ts b/packages/integration-tests/src/tests/api/logto-config.test.ts index 57ae34a40..6a1e8b17d 100644 --- a/packages/integration-tests/src/tests/api/logto-config.test.ts +++ b/packages/integration-tests/src/tests/api/logto-config.test.ts @@ -11,7 +11,7 @@ import { getOidcKeys, rotateOidcKeys, updateAdminConsoleConfig, - insertJwtCustomizer, + insertOrUpdateJwtCustomizer, } from '#src/api/index.js'; import { expectRejects } from '#src/helpers/index.js'; @@ -141,15 +141,35 @@ describe('admin console sign-in experience', () => { ...accessTokenJwtCustomizerPayload, contextSample: {}, }; - const accessToken = await insertJwtCustomizer( + + const accessToken = await insertOrUpdateJwtCustomizer( LogtoJwtTokenKeyType.AccessToken, accessTokenJwtCustomizerPayload ); expect(accessToken).toMatchObject(accessTokenJwtCustomizerPayload); - const clientCredentials = await insertJwtCustomizer( + const newAccessTokenJwtCustomizerPayload = { + ...accessTokenJwtCustomizerPayload, + script: 'new script', + }; + const updatedAccessToken = await insertOrUpdateJwtCustomizer( + LogtoJwtTokenKeyType.AccessToken, + newAccessTokenJwtCustomizerPayload + ); + expect(updatedAccessToken).toMatchObject(newAccessTokenJwtCustomizerPayload); + + const clientCredentials = await insertOrUpdateJwtCustomizer( LogtoJwtTokenKeyType.ClientCredentials, clientCredentialsJwtCustomizerPayload ); expect(clientCredentials).toMatchObject(clientCredentialsJwtCustomizerPayload); + const newClientCredentialsJwtCustomizerPayload = { + ...clientCredentialsJwtCustomizerPayload, + script: 'new script client credentials', + }; + const updatedClientCredentials = await insertOrUpdateJwtCustomizer( + LogtoJwtTokenKeyType.ClientCredentials, + newClientCredentialsJwtCustomizerPayload + ); + expect(updatedClientCredentials).toMatchObject(newClientCredentialsJwtCustomizerPayload); }); }); diff --git a/packages/phrases/src/locales/de/errors/index.ts b/packages/phrases/src/locales/de/errors/index.ts index 239307676..74995792d 100644 --- a/packages/phrases/src/locales/de/errors/index.ts +++ b/packages/phrases/src/locales/de/errors/index.ts @@ -7,7 +7,6 @@ import guard from './guard.js'; import hook from './hook.js'; import localization from './localization.js'; import log from './log.js'; -import logto_config from './logto-config.js'; import oidc from './oidc.js'; import organization from './organization.js'; import password from './password.js'; @@ -36,7 +35,6 @@ const errors = { verification_code, sign_in_experiences, localization, - logto_config, swagger, entity, log, diff --git a/packages/phrases/src/locales/de/errors/logto-config.ts b/packages/phrases/src/locales/de/errors/logto-config.ts deleted file mode 100644 index 8aff44c45..000000000 --- a/packages/phrases/src/locales/de/errors/logto-config.ts +++ /dev/null @@ -1,9 +0,0 @@ -const logto_config = { - jwt: { - /** UNTRANSLATED */ - customizer_exists: - 'Can not create a new customizer since there is already one for the token type `{{tokenType}}`.', - }, -}; - -export default Object.freeze(logto_config); diff --git a/packages/phrases/src/locales/en/errors/index.ts b/packages/phrases/src/locales/en/errors/index.ts index 239307676..74995792d 100644 --- a/packages/phrases/src/locales/en/errors/index.ts +++ b/packages/phrases/src/locales/en/errors/index.ts @@ -7,7 +7,6 @@ import guard from './guard.js'; import hook from './hook.js'; import localization from './localization.js'; import log from './log.js'; -import logto_config from './logto-config.js'; import oidc from './oidc.js'; import organization from './organization.js'; import password from './password.js'; @@ -36,7 +35,6 @@ const errors = { verification_code, sign_in_experiences, localization, - logto_config, swagger, entity, log, diff --git a/packages/phrases/src/locales/en/errors/logto-config.ts b/packages/phrases/src/locales/en/errors/logto-config.ts deleted file mode 100644 index 65863e250..000000000 --- a/packages/phrases/src/locales/en/errors/logto-config.ts +++ /dev/null @@ -1,8 +0,0 @@ -const logto_config = { - jwt: { - customizer_exists: - 'Can not create a new customizer since there is already one for the token type `{{tokenType}}`.', - }, -}; - -export default Object.freeze(logto_config); diff --git a/packages/phrases/src/locales/es/errors/index.ts b/packages/phrases/src/locales/es/errors/index.ts index 239307676..74995792d 100644 --- a/packages/phrases/src/locales/es/errors/index.ts +++ b/packages/phrases/src/locales/es/errors/index.ts @@ -7,7 +7,6 @@ import guard from './guard.js'; import hook from './hook.js'; import localization from './localization.js'; import log from './log.js'; -import logto_config from './logto-config.js'; import oidc from './oidc.js'; import organization from './organization.js'; import password from './password.js'; @@ -36,7 +35,6 @@ const errors = { verification_code, sign_in_experiences, localization, - logto_config, swagger, entity, log, diff --git a/packages/phrases/src/locales/es/errors/logto-config.ts b/packages/phrases/src/locales/es/errors/logto-config.ts deleted file mode 100644 index 8aff44c45..000000000 --- a/packages/phrases/src/locales/es/errors/logto-config.ts +++ /dev/null @@ -1,9 +0,0 @@ -const logto_config = { - jwt: { - /** UNTRANSLATED */ - customizer_exists: - 'Can not create a new customizer since there is already one for the token type `{{tokenType}}`.', - }, -}; - -export default Object.freeze(logto_config); diff --git a/packages/phrases/src/locales/fr/errors/index.ts b/packages/phrases/src/locales/fr/errors/index.ts index 239307676..74995792d 100644 --- a/packages/phrases/src/locales/fr/errors/index.ts +++ b/packages/phrases/src/locales/fr/errors/index.ts @@ -7,7 +7,6 @@ import guard from './guard.js'; import hook from './hook.js'; import localization from './localization.js'; import log from './log.js'; -import logto_config from './logto-config.js'; import oidc from './oidc.js'; import organization from './organization.js'; import password from './password.js'; @@ -36,7 +35,6 @@ const errors = { verification_code, sign_in_experiences, localization, - logto_config, swagger, entity, log, diff --git a/packages/phrases/src/locales/fr/errors/logto-config.ts b/packages/phrases/src/locales/fr/errors/logto-config.ts deleted file mode 100644 index 8aff44c45..000000000 --- a/packages/phrases/src/locales/fr/errors/logto-config.ts +++ /dev/null @@ -1,9 +0,0 @@ -const logto_config = { - jwt: { - /** UNTRANSLATED */ - customizer_exists: - 'Can not create a new customizer since there is already one for the token type `{{tokenType}}`.', - }, -}; - -export default Object.freeze(logto_config); diff --git a/packages/phrases/src/locales/it/errors/index.ts b/packages/phrases/src/locales/it/errors/index.ts index 239307676..74995792d 100644 --- a/packages/phrases/src/locales/it/errors/index.ts +++ b/packages/phrases/src/locales/it/errors/index.ts @@ -7,7 +7,6 @@ import guard from './guard.js'; import hook from './hook.js'; import localization from './localization.js'; import log from './log.js'; -import logto_config from './logto-config.js'; import oidc from './oidc.js'; import organization from './organization.js'; import password from './password.js'; @@ -36,7 +35,6 @@ const errors = { verification_code, sign_in_experiences, localization, - logto_config, swagger, entity, log, diff --git a/packages/phrases/src/locales/it/errors/logto-config.ts b/packages/phrases/src/locales/it/errors/logto-config.ts deleted file mode 100644 index 8aff44c45..000000000 --- a/packages/phrases/src/locales/it/errors/logto-config.ts +++ /dev/null @@ -1,9 +0,0 @@ -const logto_config = { - jwt: { - /** UNTRANSLATED */ - customizer_exists: - 'Can not create a new customizer since there is already one for the token type `{{tokenType}}`.', - }, -}; - -export default Object.freeze(logto_config); diff --git a/packages/phrases/src/locales/ja/errors/index.ts b/packages/phrases/src/locales/ja/errors/index.ts index 239307676..74995792d 100644 --- a/packages/phrases/src/locales/ja/errors/index.ts +++ b/packages/phrases/src/locales/ja/errors/index.ts @@ -7,7 +7,6 @@ import guard from './guard.js'; import hook from './hook.js'; import localization from './localization.js'; import log from './log.js'; -import logto_config from './logto-config.js'; import oidc from './oidc.js'; import organization from './organization.js'; import password from './password.js'; @@ -36,7 +35,6 @@ const errors = { verification_code, sign_in_experiences, localization, - logto_config, swagger, entity, log, diff --git a/packages/phrases/src/locales/ja/errors/logto-config.ts b/packages/phrases/src/locales/ja/errors/logto-config.ts deleted file mode 100644 index 8aff44c45..000000000 --- a/packages/phrases/src/locales/ja/errors/logto-config.ts +++ /dev/null @@ -1,9 +0,0 @@ -const logto_config = { - jwt: { - /** UNTRANSLATED */ - customizer_exists: - 'Can not create a new customizer since there is already one for the token type `{{tokenType}}`.', - }, -}; - -export default Object.freeze(logto_config); diff --git a/packages/phrases/src/locales/ko/errors/index.ts b/packages/phrases/src/locales/ko/errors/index.ts index 239307676..74995792d 100644 --- a/packages/phrases/src/locales/ko/errors/index.ts +++ b/packages/phrases/src/locales/ko/errors/index.ts @@ -7,7 +7,6 @@ import guard from './guard.js'; import hook from './hook.js'; import localization from './localization.js'; import log from './log.js'; -import logto_config from './logto-config.js'; import oidc from './oidc.js'; import organization from './organization.js'; import password from './password.js'; @@ -36,7 +35,6 @@ const errors = { verification_code, sign_in_experiences, localization, - logto_config, swagger, entity, log, diff --git a/packages/phrases/src/locales/ko/errors/logto-config.ts b/packages/phrases/src/locales/ko/errors/logto-config.ts deleted file mode 100644 index 8aff44c45..000000000 --- a/packages/phrases/src/locales/ko/errors/logto-config.ts +++ /dev/null @@ -1,9 +0,0 @@ -const logto_config = { - jwt: { - /** UNTRANSLATED */ - customizer_exists: - 'Can not create a new customizer since there is already one for the token type `{{tokenType}}`.', - }, -}; - -export default Object.freeze(logto_config); diff --git a/packages/phrases/src/locales/pl-pl/errors/index.ts b/packages/phrases/src/locales/pl-pl/errors/index.ts index 239307676..74995792d 100644 --- a/packages/phrases/src/locales/pl-pl/errors/index.ts +++ b/packages/phrases/src/locales/pl-pl/errors/index.ts @@ -7,7 +7,6 @@ import guard from './guard.js'; import hook from './hook.js'; import localization from './localization.js'; import log from './log.js'; -import logto_config from './logto-config.js'; import oidc from './oidc.js'; import organization from './organization.js'; import password from './password.js'; @@ -36,7 +35,6 @@ const errors = { verification_code, sign_in_experiences, localization, - logto_config, swagger, entity, log, diff --git a/packages/phrases/src/locales/pl-pl/errors/logto-config.ts b/packages/phrases/src/locales/pl-pl/errors/logto-config.ts deleted file mode 100644 index 8aff44c45..000000000 --- a/packages/phrases/src/locales/pl-pl/errors/logto-config.ts +++ /dev/null @@ -1,9 +0,0 @@ -const logto_config = { - jwt: { - /** UNTRANSLATED */ - customizer_exists: - 'Can not create a new customizer since there is already one for the token type `{{tokenType}}`.', - }, -}; - -export default Object.freeze(logto_config); diff --git a/packages/phrases/src/locales/pt-br/errors/index.ts b/packages/phrases/src/locales/pt-br/errors/index.ts index 239307676..74995792d 100644 --- a/packages/phrases/src/locales/pt-br/errors/index.ts +++ b/packages/phrases/src/locales/pt-br/errors/index.ts @@ -7,7 +7,6 @@ import guard from './guard.js'; import hook from './hook.js'; import localization from './localization.js'; import log from './log.js'; -import logto_config from './logto-config.js'; import oidc from './oidc.js'; import organization from './organization.js'; import password from './password.js'; @@ -36,7 +35,6 @@ const errors = { verification_code, sign_in_experiences, localization, - logto_config, swagger, entity, log, diff --git a/packages/phrases/src/locales/pt-br/errors/logto-config.ts b/packages/phrases/src/locales/pt-br/errors/logto-config.ts deleted file mode 100644 index 8aff44c45..000000000 --- a/packages/phrases/src/locales/pt-br/errors/logto-config.ts +++ /dev/null @@ -1,9 +0,0 @@ -const logto_config = { - jwt: { - /** UNTRANSLATED */ - customizer_exists: - 'Can not create a new customizer since there is already one for the token type `{{tokenType}}`.', - }, -}; - -export default Object.freeze(logto_config); diff --git a/packages/phrases/src/locales/pt-pt/errors/index.ts b/packages/phrases/src/locales/pt-pt/errors/index.ts index 239307676..74995792d 100644 --- a/packages/phrases/src/locales/pt-pt/errors/index.ts +++ b/packages/phrases/src/locales/pt-pt/errors/index.ts @@ -7,7 +7,6 @@ import guard from './guard.js'; import hook from './hook.js'; import localization from './localization.js'; import log from './log.js'; -import logto_config from './logto-config.js'; import oidc from './oidc.js'; import organization from './organization.js'; import password from './password.js'; @@ -36,7 +35,6 @@ const errors = { verification_code, sign_in_experiences, localization, - logto_config, swagger, entity, log, diff --git a/packages/phrases/src/locales/pt-pt/errors/logto-config.ts b/packages/phrases/src/locales/pt-pt/errors/logto-config.ts deleted file mode 100644 index 8aff44c45..000000000 --- a/packages/phrases/src/locales/pt-pt/errors/logto-config.ts +++ /dev/null @@ -1,9 +0,0 @@ -const logto_config = { - jwt: { - /** UNTRANSLATED */ - customizer_exists: - 'Can not create a new customizer since there is already one for the token type `{{tokenType}}`.', - }, -}; - -export default Object.freeze(logto_config); diff --git a/packages/phrases/src/locales/ru/errors/index.ts b/packages/phrases/src/locales/ru/errors/index.ts index 239307676..74995792d 100644 --- a/packages/phrases/src/locales/ru/errors/index.ts +++ b/packages/phrases/src/locales/ru/errors/index.ts @@ -7,7 +7,6 @@ import guard from './guard.js'; import hook from './hook.js'; import localization from './localization.js'; import log from './log.js'; -import logto_config from './logto-config.js'; import oidc from './oidc.js'; import organization from './organization.js'; import password from './password.js'; @@ -36,7 +35,6 @@ const errors = { verification_code, sign_in_experiences, localization, - logto_config, swagger, entity, log, diff --git a/packages/phrases/src/locales/ru/errors/logto-config.ts b/packages/phrases/src/locales/ru/errors/logto-config.ts deleted file mode 100644 index 8aff44c45..000000000 --- a/packages/phrases/src/locales/ru/errors/logto-config.ts +++ /dev/null @@ -1,9 +0,0 @@ -const logto_config = { - jwt: { - /** UNTRANSLATED */ - customizer_exists: - 'Can not create a new customizer since there is already one for the token type `{{tokenType}}`.', - }, -}; - -export default Object.freeze(logto_config); diff --git a/packages/phrases/src/locales/tr-tr/errors/index.ts b/packages/phrases/src/locales/tr-tr/errors/index.ts index 239307676..74995792d 100644 --- a/packages/phrases/src/locales/tr-tr/errors/index.ts +++ b/packages/phrases/src/locales/tr-tr/errors/index.ts @@ -7,7 +7,6 @@ import guard from './guard.js'; import hook from './hook.js'; import localization from './localization.js'; import log from './log.js'; -import logto_config from './logto-config.js'; import oidc from './oidc.js'; import organization from './organization.js'; import password from './password.js'; @@ -36,7 +35,6 @@ const errors = { verification_code, sign_in_experiences, localization, - logto_config, swagger, entity, log, diff --git a/packages/phrases/src/locales/tr-tr/errors/logto-config.ts b/packages/phrases/src/locales/tr-tr/errors/logto-config.ts deleted file mode 100644 index 8aff44c45..000000000 --- a/packages/phrases/src/locales/tr-tr/errors/logto-config.ts +++ /dev/null @@ -1,9 +0,0 @@ -const logto_config = { - jwt: { - /** UNTRANSLATED */ - customizer_exists: - 'Can not create a new customizer since there is already one for the token type `{{tokenType}}`.', - }, -}; - -export default Object.freeze(logto_config); diff --git a/packages/phrases/src/locales/zh-cn/errors/index.ts b/packages/phrases/src/locales/zh-cn/errors/index.ts index 239307676..74995792d 100644 --- a/packages/phrases/src/locales/zh-cn/errors/index.ts +++ b/packages/phrases/src/locales/zh-cn/errors/index.ts @@ -7,7 +7,6 @@ import guard from './guard.js'; import hook from './hook.js'; import localization from './localization.js'; import log from './log.js'; -import logto_config from './logto-config.js'; import oidc from './oidc.js'; import organization from './organization.js'; import password from './password.js'; @@ -36,7 +35,6 @@ const errors = { verification_code, sign_in_experiences, localization, - logto_config, swagger, entity, log, diff --git a/packages/phrases/src/locales/zh-cn/errors/logto-config.ts b/packages/phrases/src/locales/zh-cn/errors/logto-config.ts deleted file mode 100644 index 8aff44c45..000000000 --- a/packages/phrases/src/locales/zh-cn/errors/logto-config.ts +++ /dev/null @@ -1,9 +0,0 @@ -const logto_config = { - jwt: { - /** UNTRANSLATED */ - customizer_exists: - 'Can not create a new customizer since there is already one for the token type `{{tokenType}}`.', - }, -}; - -export default Object.freeze(logto_config); diff --git a/packages/phrases/src/locales/zh-hk/errors/index.ts b/packages/phrases/src/locales/zh-hk/errors/index.ts index 239307676..74995792d 100644 --- a/packages/phrases/src/locales/zh-hk/errors/index.ts +++ b/packages/phrases/src/locales/zh-hk/errors/index.ts @@ -7,7 +7,6 @@ import guard from './guard.js'; import hook from './hook.js'; import localization from './localization.js'; import log from './log.js'; -import logto_config from './logto-config.js'; import oidc from './oidc.js'; import organization from './organization.js'; import password from './password.js'; @@ -36,7 +35,6 @@ const errors = { verification_code, sign_in_experiences, localization, - logto_config, swagger, entity, log, diff --git a/packages/phrases/src/locales/zh-hk/errors/logto-config.ts b/packages/phrases/src/locales/zh-hk/errors/logto-config.ts deleted file mode 100644 index 8aff44c45..000000000 --- a/packages/phrases/src/locales/zh-hk/errors/logto-config.ts +++ /dev/null @@ -1,9 +0,0 @@ -const logto_config = { - jwt: { - /** UNTRANSLATED */ - customizer_exists: - 'Can not create a new customizer since there is already one for the token type `{{tokenType}}`.', - }, -}; - -export default Object.freeze(logto_config); diff --git a/packages/phrases/src/locales/zh-tw/errors/index.ts b/packages/phrases/src/locales/zh-tw/errors/index.ts index 239307676..74995792d 100644 --- a/packages/phrases/src/locales/zh-tw/errors/index.ts +++ b/packages/phrases/src/locales/zh-tw/errors/index.ts @@ -7,7 +7,6 @@ import guard from './guard.js'; import hook from './hook.js'; import localization from './localization.js'; import log from './log.js'; -import logto_config from './logto-config.js'; import oidc from './oidc.js'; import organization from './organization.js'; import password from './password.js'; @@ -36,7 +35,6 @@ const errors = { verification_code, sign_in_experiences, localization, - logto_config, swagger, entity, log, diff --git a/packages/phrases/src/locales/zh-tw/errors/logto-config.ts b/packages/phrases/src/locales/zh-tw/errors/logto-config.ts deleted file mode 100644 index 8aff44c45..000000000 --- a/packages/phrases/src/locales/zh-tw/errors/logto-config.ts +++ /dev/null @@ -1,9 +0,0 @@ -const logto_config = { - jwt: { - /** UNTRANSLATED */ - customizer_exists: - 'Can not create a new customizer since there is already one for the token type `{{tokenType}}`.', - }, -}; - -export default Object.freeze(logto_config);