Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 2 additions & 3 deletions .lintstagedrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx,json,jsonc,yml,yaml}": [
"biome check --write --no-errors-on-unmatched --files-ignore-unknown=true"
],
"**/package.json": ["prettier --write"],
"biome check --write --no-errors-on-unmatched --files-ignore-unknown=true"
],
"*.{md,mdx}": ["prettier --write"]
}
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ dictionaries
storybook-static

# NPM
*-lock.json
*-lock.json
8 changes: 0 additions & 8 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
"$schema": "https://json.schemastore.org/prettierrc",
"plugins": ["prettier-plugin-packagejson"],
"includes": ["**/package.json", "**/*.md"],
"singleQuote": true,
"semi": true,
"tabWidth": 2,
Expand All @@ -17,12 +15,6 @@
"singleQuote": false,
"quoteProps": "preserve"
}
},
{
"files": "package.json",
"options": {
"plugins": ["prettier-plugin-packagejson"]
}
}
]
}
7 changes: 0 additions & 7 deletions .vscode/extensions.json

This file was deleted.

9 changes: 0 additions & 9 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"cSpell.words": ["intlayer"],
"typescript.experimental.useTsgo": true,
"editor.formatOnSave": true,
"editor.defaultFormatter": "biomejs.biome",
"editor.codeActionsOnSave": {
Expand Down Expand Up @@ -32,13 +31,5 @@
},
"[markdown]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"emeraldwalk.runonsave": {
"commands": [
{
"match": ".*package\\.json$",
"cmd": "prettier --write ${file}"
}
]
}
}
3 changes: 2 additions & 1 deletion apps/backend/intlayer.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { type IntlayerConfig, Locales } from '@intlayer/types';
import { type IntlayerConfig, Locales } from '@intlayer/config';

export const locales = [Locales.ENGLISH, Locales.FRENCH, Locales.SPANISH];

/** @type {import('intlayer').IntlayerConfig} */
const config: IntlayerConfig = {
internationalization: {
locales,
Expand Down
17 changes: 7 additions & 10 deletions apps/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,18 @@
"scripts": {
"build": "tsdown --config tsdown.config.ts",
"build:ci": "tsdown --config tsdown.config.ts",
"clean": "rimraf ./dist .turbo",
"dev": "bun --hot --watch ./dist/esm/index.mjs",
"dev:package": "tsdown --config tsdown.config.ts --watch",
"clean": "rimraf ./dist",
"dev": "tsdown --config tsdown.config.ts --watch",
"email": "email dev --dir ./src/emails",
"format": "biome format . --check",
"format:fix": "biome format --write .",
"lint": "biome lint .",
"lint:fix": "biome lint --write .",
"format": "biome format . --check",
"format:fix": "biome format --write .",
"prepublish": "cp -f ../../README.md ./README.md",
"start": "cross-env NODE_ENV=production node dist/esm/index.mjs",
"start:stripe": "stripe listen --forward-to localhost:3100/webhook/stripe",
"test": "vitest run",
"test:watch": "vitest",
"typecheck": "tsc --noEmit --project tsconfig.types.json"
"test:watch": "vitest"
},
"dependencies": {
"@ai-sdk/anthropic": "2.0.27",
Expand All @@ -76,8 +74,8 @@
"@react-email/components": "0.5.6",
"ai": "5.0.71",
"better-auth": "1.3.27",
"cookie-parser": "1.4.7",
"compression": "1.8.1",
"cookie-parser": "1.4.7",
"cors": "2.8.5",
"cross-env": "10.1.0",
"dotenv": "16.6.1",
Expand All @@ -100,7 +98,6 @@
"@intlayer/config": "workspace:*",
"@intlayer/core": "workspace:*",
"@intlayer/docs": "workspace:*",
"@intlayer/types": "workspace:*",
"@types/body-parser": "1.19.6",
"@types/compression": "1.8.1",
"@types/cookie-parser": "1.4.9",
Expand All @@ -118,7 +115,7 @@
"esbuild-fix-imports-plugin": "1.0.22",
"intlayer": "workspace:*",
"rimraf": "6.0.1",
"tsdown": "0.15.7",

"typescript": "5.9.3",
"vitest": "3.2.4"
}
Expand Down
3 changes: 2 additions & 1 deletion apps/backend/src/controllers/ai.controller.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { KeyPath, Locales } from '@intlayer/types';
import type { Locales } from '@intlayer/config';
import type { KeyPath } from '@intlayer/core';
import type { ResponseWithSession } from '@middlewares/sessionAuth.middleware';
import { getDictionariesByTags } from '@services/dictionary.service';
import * as tagService from '@services/tag.service';
Expand Down
2 changes: 1 addition & 1 deletion apps/backend/src/controllers/dictionary.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as eventListener from '@controllers/eventListener.controller';
import type {
ContentNode,
Dictionary as LocalDictionary,
} from '@intlayer/types';
} from '@intlayer/core';
import { logger } from '@logger';
import type { ResponseWithSession } from '@middlewares/sessionAuth.middleware';
import * as dictionaryService from '@services/dictionary.service';
Expand Down
2 changes: 1 addition & 1 deletion apps/backend/src/controllers/stripe.controller.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Locales } from '@intlayer/types';
import type { Locales } from '@intlayer/config';
import type { ResponseWithSession } from '@middlewares/sessionAuth.middleware';
import * as emailService from '@services/email.service';
import * as subscriptionService from '@services/subscription.service';
Expand Down
4 changes: 0 additions & 4 deletions apps/backend/src/controllers/test.json

This file was deleted.

2 changes: 1 addition & 1 deletion apps/backend/src/schemas/project.schema.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Locales } from '@intlayer/types';
import { Locales } from '@intlayer/config';
import type { RenameId } from '@utils/mongoDB/types';
import {
MEMBERS_MIN_LENGTH,
Expand Down
2 changes: 1 addition & 1 deletion apps/backend/src/services/email.service.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import {
WelcomeEmailES,
WelcomeEmailFR,
} from '@emails/Welcome';
import type { Locales } from '@intlayer/types';
import type { Locales } from '@intlayer/config';
import { logger } from '@logger';
import { t } from 'express-intlayer';
import type { ComponentProps, JSX } from 'react';
Expand Down
5 changes: 1 addition & 4 deletions apps/backend/src/types/dictionary.types.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import type {
ContentNode,
Dictionary as DictionaryCore,
} from '@intlayer/types';
import type { ContentNode, Dictionary as DictionaryCore } from '@intlayer/core';
import type { RenameId } from '@utils/mongoDB/types';
import type { Document, Model, ObjectIdToString, Types } from 'mongoose';
import type { Project } from './project.types';
Expand Down
2 changes: 1 addition & 1 deletion apps/backend/src/types/project.types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { IntlayerConfig } from '@intlayer/types';
import type { IntlayerConfig } from '@intlayer/config';
import type { RenameId } from '@utils/mongoDB/types';
import type { Document, Model, ObjectIdToString, Types } from 'mongoose';
import type { Token } from 'oauth2-server';
Expand Down
2 changes: 1 addition & 1 deletion apps/backend/src/utils/AI/auditDictionary/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { readAsset } from 'utils:asset';
import type { Locales } from '@intlayer/config';
import { getLocaleName } from '@intlayer/core';
import { Locales } from '@intlayer/types';
import { logger } from '@logger';
import { extractJson } from '@utils/extractJSON';
import { generateText } from 'ai';
Expand Down
5 changes: 2 additions & 3 deletions apps/backend/src/utils/AI/auditDictionaryField/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { readAsset } from 'utils:asset';
import { getLocaleName } from '@intlayer/core';
import type { KeyPath } from '@intlayer/types';
import { Locales } from '@intlayer/types';
import type { Locales } from '@intlayer/config';
import { getLocaleName, type KeyPath } from '@intlayer/core';
import { logger } from '@logger';
import { generateText } from 'ai';
import type { Tag } from '@/types/tag.types';
Expand Down
2 changes: 1 addition & 1 deletion apps/backend/src/utils/AI/translateJSON/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { readAsset } from 'utils:asset';
import type { Locales } from '@intlayer/config';
import { getLocaleName } from '@intlayer/core';
import { Locales } from '@intlayer/types';
import { logger } from '@logger';
import { extractJson } from '@utils/extractJSON';
import { generateText } from 'ai';
Expand Down
4 changes: 3 additions & 1 deletion apps/backend/src/utils/errors/ErrorHandler.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
// Import required modules and types from their respective locations.

import { type LanguageContent, Locales } from '@intlayer/types';
import { Locales } from '@intlayer/config';
import { logger } from '@logger';
import { formatPaginatedResponse, formatResponse } from '@utils/responseData';
import type { Response } from 'express';
// @ts-ignore express-intlayer not build yet
import type { LanguageContent } from 'express-intlayer';
import { t } from 'express-intlayer';
import type { UserAPI } from '@/types/user.types';
import { HttpStatusCodes } from '@/utils/httpStatusCodes';
Expand Down
36 changes: 14 additions & 22 deletions apps/backend/src/utils/rateLimiter.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Response } from 'express';
import type { Request, Response } from 'express';
import rateLimit, {
ipKeyGenerator,
type Options,
Expand All @@ -17,29 +17,22 @@ const ipLimiterOptions: Partial<Options> = {
standardHeaders: 'draft-8',
legacyHeaders: false,
// Use a custom key generator that handles proxy headers securely
keyGenerator: (req) => {
keyGenerator: (req: Request) => {
// Normalize IPv6 to subnet using helper to avoid bypasses
return ipKeyGenerator(req.ip ?? req.socket?.remoteAddress ?? 'unknown');
},
handler: (req, res) => {
handler: (req: Request, res: Response) => {
const { limit, remaining, resetTime } = (req as any).rateLimit;

ErrorHandler.handleGenericErrorResponse(
res as unknown as Response,
'RATE_LIMIT_EXCEEDED',
{
limit: `${limit} per minute`,
retryAfter: Math.ceil((resetTime?.getTime() - Date.now()) / 1000),
remaining,
}
);
ErrorHandler.handleGenericErrorResponse(res, 'RATE_LIMIT_EXCEEDED', {
limit: `${limit} per minute`,
retryAfter: Math.ceil((resetTime?.getTime() - Date.now()) / 1000),
remaining,
});
},
};

// Fix type error of express-rate-limit
export const ipLimiter: any = rateLimit(
ipLimiterOptions
) satisfies RateLimitRequestHandler;
export const ipLimiter: RateLimitRequestHandler = rateLimit(ipLimiterOptions);

const unauthenticatedChatBotLimiterOptions: Partial<Options> = {
windowMs: 60 * 60 * 1000, // 1-hour window
Expand All @@ -48,15 +41,15 @@ const unauthenticatedChatBotLimiterOptions: Partial<Options> = {
skip: (_req, res) => Boolean(res.locals.user), // authenticated? then skip
legacyHeaders: false,
// Use a custom key generator that handles proxy headers securely
keyGenerator: (req) => {
keyGenerator: (req: Request) => {
// Normalize IPv6 to subnet using helper to avoid bypasses
return ipKeyGenerator(req.ip ?? req.socket?.remoteAddress ?? 'unknown');
},
handler: (req, res) => {
handler: (req: Request, res: Response) => {
const { limit, remaining, resetTime } = (req as any).rateLimit;

ErrorHandler.handleGenericErrorResponse(
res as unknown as Response,
res,
'RATE_LIMIT_EXCEEDED_UNAUTHENTICATED',
{
limit: `${limit} per hour`,
Expand All @@ -67,7 +60,6 @@ const unauthenticatedChatBotLimiterOptions: Partial<Options> = {
},
};

// Fix type error of express-rate-limit
export const unauthenticatedChatBotLimiter: any = rateLimit(
export const unauthenticatedChatBotLimiter: RateLimitRequestHandler = rateLimit(
unauthenticatedChatBotLimiterOptions
) satisfies RateLimitRequestHandler;
);
2 changes: 1 addition & 1 deletion apps/backend/src/webhooks/stripe.webhook.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Locales } from '@intlayer/types';
import type { Locales } from '@intlayer/config';
import { logger } from '@logger';
import * as emailService from '@services/email.service';
import { getOrganizationById } from '@services/organization.service';
Expand Down
2 changes: 1 addition & 1 deletion apps/backend/tsconfig.types.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "@utils/ts-config-types",
"include": ["src/**/*", "types/**/*"],
"include": ["src/**/*"],
"exclude": ["**/*.test.*"],
"compilerOptions": {
"outDir": "dist/types",
Expand Down
5 changes: 2 additions & 3 deletions apps/backend/types/tsdown.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/**
* Utility for tsdown to optimize the build process of assets and avoid them to be duplicated accross CJS and MJS output
*/ declare module 'utils:asset' {
// src/types/utils-asset.d.ts
declare module 'utils:asset' {
export function readAsset(
relFromSrc: string,
encoding?: BufferEncoding
Expand Down
2 changes: 1 addition & 1 deletion apps/website/intlayer.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type IntlayerConfig, Locales } from '@intlayer/types';
import { type IntlayerConfig, Locales } from 'intlayer';

export const locales = [
Locales.ENGLISH,
Expand Down
10 changes: 5 additions & 5 deletions apps/website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"dev:webpack": "next dev",
"editor": "intlayer-editor start",
"generate-pwa-assets": "pwa-asset-generator --preset minimal ../../packages/@intlayer/design-system/src/components/Logo/logo_circle_wite.svg ./public/assets/",
"prepare": "husky",
"prettier": "prettier . --check",
"prettier:fix": "prettier . --write",
"serve": "npx intlayer serve",
Expand All @@ -51,7 +52,6 @@
"dependencies": {
"@intlayer/api": "workspace:*",
"@intlayer/config": "workspace:*",
"@intlayer/types": "workspace:*",
"@intlayer/core": "workspace:*",
"@intlayer/design-system": "workspace:*",
"@intlayer/dictionaries-entry": "workspace:*",
Expand All @@ -62,15 +62,15 @@
"@next/third-parties": "15.3.3",
"@stripe/react-stripe-js": "5.2.0",
"@stripe/stripe-js": "8.0.0",
"@tanstack/react-query": "5.90.5",
"@tanstack/react-query": "5.90.2",
"@tanstack/react-table": "8.21.3",
"clsx": "2.1.1",
"cobe": "0.6.4",
"deepmerge": "4.3.1",
"framer-motion": "12.23.24",
"framer-motion": "12.23.21",
"fuse.js": "7.1.0",
"intlayer": "workspace:*",
"lucide-react": "0.546.0",
"lucide-react": "0.545.0",
"markdown-to-jsx": "7.7.13",
"next": "15.5.4",
"next-intlayer": "workspace:*",
Expand All @@ -94,7 +94,7 @@
"@utils/ts-config": "workspace:*",
"@utils/ts-config-types": "workspace:*",
"@utils/tsdown-config": "workspace:*",
"tsdown": "0.15.7",
"concurrently": "9.2.1",
"next-pwa": "5.6.0",
"postcss": "8.5.4",
"pwa-asset-generator": "8.0.5",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use client';

import type { IntlayerConfig } from '@intlayer/config';
import { useSession } from '@intlayer/design-system/hooks';
import { ConfigurationProvider } from '@intlayer/editor-react';
import type { IntlayerConfig } from '@intlayer/types';
import type { FC, PropsWithChildren } from 'react';

export const EditorConfigurationProvider: FC<PropsWithChildren> = ({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use client';

import type { Locales } from '@intlayer/config/client';
import { getUnmergedDictionaryByKeyPath } from '@intlayer/core';
import {
Button,
Expand All @@ -10,7 +11,6 @@ import {
useRightDrawerStore,
} from '@intlayer/design-system';
import { useFocusDictionary } from '@intlayer/editor-react';
import type { Locales } from '@intlayer/types';
import { Pencil } from 'lucide-react';
import { useIntlayer } from 'next-intlayer';
import { type FC, useState } from 'react';
Expand Down
Loading