Merged in feat/syncDefaultMessage (pull request #3022)
Sync defaultMessage from lokalise * Enhance translation sync functionality and tests - Added logging for found component files during sync. - Introduced tests for handling complex components with replacements. - Updated regex in syncIntlFormatMessage to support optional second arguments. - Removed unused test files. * feat(syncDefaultMessage): add script for syncing default message with lokalise * feat(syncDefaultMessage): add script for syncing default message with lokalise Approved-by: Matilda Landström
This commit is contained in:
@@ -1,27 +1,27 @@
|
||||
services:
|
||||
redis-api:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
ports:
|
||||
- "3101:3001"
|
||||
depends_on:
|
||||
- redis
|
||||
environment:
|
||||
- REDIS_CONNECTION=redis:6379
|
||||
- PRIMARY_API_KEY=
|
||||
- SECONDARY_API_KEY=
|
||||
- NODE_ENV=development
|
||||
- SENTRY_ENABLED=false
|
||||
redis-api:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
ports:
|
||||
- "3101:3001"
|
||||
depends_on:
|
||||
- redis
|
||||
environment:
|
||||
- REDIS_CONNECTION=redis:6379
|
||||
- PRIMARY_API_KEY=
|
||||
- SECONDARY_API_KEY=
|
||||
- NODE_ENV=development
|
||||
- SENTRY_ENABLED=false
|
||||
|
||||
redis:
|
||||
image: redis:6
|
||||
ports:
|
||||
- "6379:6379"
|
||||
redis:
|
||||
image: redis:6
|
||||
ports:
|
||||
- "6379:6379"
|
||||
|
||||
redisinsight:
|
||||
image: redis/redisinsight:latest
|
||||
ports:
|
||||
- "5540:5540"
|
||||
depends_on:
|
||||
- redis
|
||||
redisinsight:
|
||||
image: redis/redisinsight:latest
|
||||
ports:
|
||||
- "5540:5540"
|
||||
depends_on:
|
||||
- redis
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
"scripts": {
|
||||
"dev": "bun --watch src/index.ts | pino-pretty -o '{if module}[{module}] {end}{msg}' -i pid,hostname",
|
||||
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0 && tsc",
|
||||
"lint:fix": "eslint . --ext ts,tsx --fix --report-unused-disable-directives --max-warnings 0 && tsc"
|
||||
"lint:fix": "eslint . --ext ts,tsx --fix --report-unused-disable-directives --max-warnings 0 && tsc",
|
||||
"format": "prettier --write ."
|
||||
},
|
||||
"dependencies": {
|
||||
"@elysiajs/server-timing": "^1.3.0",
|
||||
@@ -28,7 +29,6 @@
|
||||
"eslint": "^9",
|
||||
"eslint-plugin-simple-import-sort": "^10.0.0",
|
||||
"pino-pretty": "^13.0.0",
|
||||
"prettier": "^3.5.3",
|
||||
"typescript": "^5.7.2"
|
||||
},
|
||||
"prettier": {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Queue,Worker } from "bullmq";
|
||||
import { Queue, Worker } from "bullmq";
|
||||
import z from "zod";
|
||||
|
||||
import { env } from "@/env";
|
||||
@@ -6,7 +6,7 @@ import { sentry } from "@/server/sentry.server.config";
|
||||
import { loggerModule } from "@/utils/logger";
|
||||
import { timeout } from "@/utils/timeout";
|
||||
|
||||
import { bullmqredis,redis } from ".";
|
||||
import { bullmqredis, redis } from ".";
|
||||
|
||||
const DELETE_JOB = "deleteQueueJob";
|
||||
const deleteQueueLogger = loggerModule("deleteQueue");
|
||||
|
||||
@@ -8,35 +8,39 @@
|
||||
*/
|
||||
const maskChar = "*";
|
||||
export function mask(
|
||||
value: string,
|
||||
options?: { visibleStart?: number; visibleEnd?: number; maxLength?: number },
|
||||
value: string,
|
||||
options?: {
|
||||
visibleStart?: number;
|
||||
visibleEnd?: number;
|
||||
maxLength?: number;
|
||||
},
|
||||
): string {
|
||||
if (!value) return "";
|
||||
if (!value) return "";
|
||||
|
||||
const { visibleStart = 2, visibleEnd = 2, maxLength = 10 } = options ?? {};
|
||||
const { visibleStart = 2, visibleEnd = 2, maxLength = 10 } = options ?? {};
|
||||
|
||||
if (isEmail(value)) {
|
||||
return maskEmail(value);
|
||||
}
|
||||
if (isEmail(value)) {
|
||||
return maskEmail(value);
|
||||
}
|
||||
|
||||
const totalVisible = visibleStart + visibleEnd;
|
||||
if (value.length <= totalVisible) {
|
||||
return maskChar.repeat(value.length);
|
||||
}
|
||||
const totalVisible = visibleStart + visibleEnd;
|
||||
if (value.length <= totalVisible) {
|
||||
return maskChar.repeat(value.length);
|
||||
}
|
||||
|
||||
const start = value.slice(0, visibleStart);
|
||||
const middle = value.slice(visibleStart, -visibleEnd || undefined);
|
||||
const end = visibleEnd ? value.slice(-visibleEnd) : "";
|
||||
const start = value.slice(0, visibleStart);
|
||||
const middle = value.slice(visibleStart, -visibleEnd || undefined);
|
||||
const end = visibleEnd ? value.slice(-visibleEnd) : "";
|
||||
|
||||
const maskedLength = Math.min(middle.length, maxLength);
|
||||
return start + maskChar.repeat(maskedLength) + end;
|
||||
const maskedLength = Math.min(middle.length, maxLength);
|
||||
return start + maskChar.repeat(maskedLength) + end;
|
||||
}
|
||||
|
||||
function maskEmail(email: string): string {
|
||||
const [local, domain] = email.split("@");
|
||||
if (!domain || !local) return mask(email);
|
||||
const [subDomain, tld] = domain.split(/\.(?=[^.]+$)/);
|
||||
return `${mask(local)}@${mask(subDomain ?? "")}.${tld}`;
|
||||
const [local, domain] = email.split("@");
|
||||
if (!domain || !local) return mask(email);
|
||||
const [subDomain, tld] = domain.split(/\.(?=[^.]+$)/);
|
||||
return `${mask(local)}@${mask(subDomain ?? "")}.${tld}`;
|
||||
}
|
||||
|
||||
const isEmail = (value: string) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"extends": "@scandic-hotels/typescript-config/bun.json",
|
||||
"compilerOptions": {
|
||||
"paths": {
|
||||
"@/*": ["./src/*"]
|
||||
"extends": "@scandic-hotels/typescript-config/bun.json",
|
||||
"compilerOptions": {
|
||||
"paths": {
|
||||
"@/*": ["./src/*"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user