diff --git a/inlang/source-code/sdk2/src/database/initDbAndSchema.test.ts b/inlang/source-code/sdk2/src/database/initDbAndSchema.test.ts index 138a814ca9..2278a1a359 100644 --- a/inlang/source-code/sdk2/src/database/initDbAndSchema.test.ts +++ b/inlang/source-code/sdk2/src/database/initDbAndSchema.test.ts @@ -2,10 +2,10 @@ import { createInMemoryDatabase } from "sqlite-wasm-kysely"; import { test, expect } from "vitest"; import { initDb } from "./initDb.js"; import { isBundleId } from "../bundle-id/bundle-id.js"; -import { validate } from "uuid"; +import { validate as isUuid } from "uuid"; import { createSchema } from "./schema.js"; -test("bundle ids should have a default value", async () => { +test("bundle default values", async () => { const sqlite = await createInMemoryDatabase({ readOnly: false, }); @@ -14,36 +14,15 @@ test("bundle ids should have a default value", async () => { const bundle = await db .insertInto("bundle") - .values({ - alias: { - mock: "mock", - }, - }) + .defaultValues() .returningAll() .executeTakeFirstOrThrow(); expect(isBundleId(bundle.id)).toBe(true); -}); - -test("bundle aliases should default to an empty object to ease bundle creation", async () => { - const sqlite = await createInMemoryDatabase({ - readOnly: false, - }); - const db = initDb({ sqlite }); - await createSchema({ sqlite }); - - const bundle = await db - .insertInto("bundle") - .values({ - id: "mock-id", - }) - .returningAll() - .executeTakeFirstOrThrow(); - expect(bundle.alias).toStrictEqual({}); }); -test("message ids should default to uuid", async () => { +test("message default values", async () => { const sqlite = await createInMemoryDatabase({ readOnly: false, }); @@ -61,16 +40,16 @@ test("message ids should default to uuid", async () => { .values({ bundleId: bundle.id, locale: "en", - selectors: [], - declarations: [], }) .returningAll() .executeTakeFirstOrThrow(); - expect(validate(message.id)).toBe(true); + expect(isUuid(message.id)).toBe(true); + expect(message.declarations).toStrictEqual([]); + expect(message.selectors).toStrictEqual([]); }); -test("variant ids should default to uuid", async () => { +test("variant default values", async () => { const sqlite = await createInMemoryDatabase({ readOnly: false, }); @@ -88,8 +67,6 @@ test("variant ids should default to uuid", async () => { .values({ bundleId: bundle.id, locale: "en", - selectors: [], - declarations: [], }) .returningAll() .executeTakeFirstOrThrow(); @@ -98,13 +75,13 @@ test("variant ids should default to uuid", async () => { .insertInto("variant") .values({ messageId: message.id, - match: {}, - pattern: [], }) .returningAll() .executeTakeFirstOrThrow(); - expect(validate(variant.id)).toBe(true); + expect(isUuid(variant.id)).toBe(true); + expect(variant.match).toStrictEqual({}); + expect(variant.pattern).toStrictEqual([]); }); test("it should handle json serialization", async () => { diff --git a/inlang/source-code/sdk2/src/database/schema.test-d.ts b/inlang/source-code/sdk2/src/database/schema.test-d.ts index 3846fbedf7..f49a012462 100644 --- a/inlang/source-code/sdk2/src/database/schema.test-d.ts +++ b/inlang/source-code/sdk2/src/database/schema.test-d.ts @@ -1,7 +1,11 @@ /* eslint-disable @typescript-eslint/no-unused-vars */ import type { Selectable } from "kysely"; -import type { Bundle, Message, Variant } from "../schema/schemaV2.js"; -import type { InlangDatabaseSchema } from "./schema.js"; +import type { + Bundle, + InlangDatabaseSchema, + Message, + Variant, +} from "./schema.js"; let _; diff --git a/inlang/source-code/sdk2/src/database/schema.ts b/inlang/source-code/sdk2/src/database/schema.ts index 61b91c5d0e..5336efa4c9 100644 --- a/inlang/source-code/sdk2/src/database/schema.ts +++ b/inlang/source-code/sdk2/src/database/schema.ts @@ -1,6 +1,6 @@ import type { Generated, Insertable, Selectable, Updateable } from "kysely"; -import type { Bundle, Message, Variant } from "../schema/schemaV2.js"; import type { SqliteDatabase } from "sqlite-wasm-kysely"; +import { Declaration, Expression, Pattern } from "../json-schema/pattern.js"; export async function createSchema(args: { sqlite: SqliteDatabase }) { args.sqlite.exec(` @@ -15,16 +15,16 @@ CREATE TABLE message ( id TEXT PRIMARY KEY DEFAULT (uuid_v4()), bundle_id TEXT NOT NULL, locale TEXT NOT NULL, - declarations TEXT NOT NULL, - selectors TEXT NOT NULL, + declarations TEXT NOT NULL DEFAULT '[]', + selectors TEXT NOT NULL DEFAULT '[]', FOREIGN KEY (bundle_id) REFERENCES bundle(id) ON DELETE CASCADE ) strict; CREATE TABLE variant ( id TEXT PRIMARY KEY DEFAULT (uuid_v4()), message_id TEXT NOT NULL, - match TEXT NOT NULL, - pattern TEXT NOT NULL, + match TEXT NOT NULL DEFAULT '{}', + pattern TEXT NOT NULL DEFAULT '[]', FOREIGN KEY (message_id) REFERENCES message(id) ON DELETE CASCADE ) strict; @@ -44,20 +44,30 @@ type BundleTable = { alias: Generated>; }; -type MessageTable = Omit & { +type MessageTable = { id: Generated; + bundleId: string; + locale: string; + declarations: Generated>; + selectors: Generated>; }; -type VariantTable = Omit & { +type VariantTable = { id: Generated; + messageId: string; + match: Generated>; + pattern: Generated; }; +export type Bundle = Selectable; export type NewBundle = Insertable; export type BundleUpdate = Updateable; +export type Message = Selectable; export type NewMessage = Insertable; export type MessageUpdate = Updateable; +export type Variant = Selectable; export type NewVariant = Selectable; export type VariantUpdate = Updateable; diff --git a/inlang/source-code/sdk2/src/helper.ts b/inlang/source-code/sdk2/src/helper.ts index 33adbd023e..659480b433 100644 --- a/inlang/source-code/sdk2/src/helper.ts +++ b/inlang/source-code/sdk2/src/helper.ts @@ -1,9 +1,15 @@ -// @ts-ignore import { v4 as uuid } from "uuid"; -import type { Bundle, Expression, Text, Variant } from "./schema/schemaV2.js"; -import type { ProjectSettings } from "./schema/settings.js"; +import type { ProjectSettings } from "./json-schema/settings.js"; import { generateBundleId } from "./bundle-id/bundle-id.js"; -import type { BundleNested, MessageNested } from "./database/schema.js"; +import type { + Bundle, + MessageNested, + NewBundleNested, + NewMessageNested, + NewVariant, + Variant, +} from "./database/schema.js"; +import type { Expression, Text } from "./json-schema/pattern.js"; /** * create v2 Bundle with a random human ID @@ -18,7 +24,7 @@ export function createBundle(args: { id?: string; messages: MessageNested[]; alias?: Bundle["alias"]; -}): BundleNested { +}): NewBundleNested { return { id: args.id ?? generateBundleId(), alias: args.alias ?? {}, @@ -35,14 +41,12 @@ export function createMessage(args: { locale: ProjectSettings["locales"][number]; text: string; match?: Record; -}): MessageNested { +}): NewMessageNested { const messageId = uuid(); return { bundleId: args.bundleId, id: messageId, locale: args.locale, - declarations: [], - selectors: [], variants: [ createVariant({ messageId: messageId, @@ -63,7 +67,7 @@ export function createVariant(args: { text?: string; match?: Record; pattern?: Variant["pattern"]; -}): Variant { +}): NewVariant { return { messageId: args.messageId, id: args.id ? args.id : uuid(), diff --git a/inlang/source-code/sdk2/src/import-export/index.ts b/inlang/source-code/sdk2/src/import-export/index.ts index 30f297d04e..63677ac892 100644 --- a/inlang/source-code/sdk2/src/import-export/index.ts +++ b/inlang/source-code/sdk2/src/import-export/index.ts @@ -3,7 +3,7 @@ import { PluginDoesNotImplementFunctionError, PluginMissingError, } from "../plugin/errors.js"; -import type { ProjectSettings } from "../schema/settings.js"; +import type { ProjectSettings } from "../json-schema/settings.js"; import type { InlangDatabaseSchema } from "../database/schema.js"; import { selectBundleNested } from "../query-utilities/selectBundleNested.js"; import type { InlangPlugin } from "../plugin/schema.js"; diff --git a/inlang/source-code/sdk2/src/index.ts b/inlang/source-code/sdk2/src/index.ts index d85d3ce934..00f6ec8898 100644 --- a/inlang/source-code/sdk2/src/index.ts +++ b/inlang/source-code/sdk2/src/index.ts @@ -2,8 +2,8 @@ export { newProject } from "./project/newProject.js"; export { loadProjectInMemory } from "./project/loadProjectInMemory.js"; export { loadProjectFromDirectoryInMemory } from "./project/loadProjectFromDirectory.js"; export type { InlangProject } from "./project/api.js"; -export * from "./schema/schemaV2.js"; -export * from "./schema/settings.js"; +export * from "./json-schema/settings.js"; +export * from "./json-schema/pattern.js"; export * from "./mock/index.js"; export * from "./helper.js"; export * from "./query-utilities/index.js"; @@ -18,4 +18,4 @@ export type { InlangDatabaseSchema } from "./database/schema.js"; export type { ResourceFile } from "./project/api.js"; export type { InlangPlugin } from "./plugin/schema.js"; export type { IdeExtensionConfig } from "./plugin/meta/ideExtension.js"; -export * from "./database/schema.js"; \ No newline at end of file +export * from "./database/schema.js"; diff --git a/inlang/source-code/sdk2/src/json-schema/old-v1-message/README.md b/inlang/source-code/sdk2/src/json-schema/old-v1-message/README.md new file mode 100644 index 0000000000..ff5758076f --- /dev/null +++ b/inlang/source-code/sdk2/src/json-schema/old-v1-message/README.md @@ -0,0 +1 @@ +This is the message data structure that has been used in the v1 version of the SDK. \ No newline at end of file diff --git a/inlang/source-code/sdk2/src/schema/migrations/fromMessageV1.test.ts b/inlang/source-code/sdk2/src/json-schema/old-v1-message/fromMessageV1.test.ts similarity index 97% rename from inlang/source-code/sdk2/src/schema/migrations/fromMessageV1.test.ts rename to inlang/source-code/sdk2/src/json-schema/old-v1-message/fromMessageV1.test.ts index 888621bd08..fcd70818b9 100644 --- a/inlang/source-code/sdk2/src/schema/migrations/fromMessageV1.test.ts +++ b/inlang/source-code/sdk2/src/json-schema/old-v1-message/fromMessageV1.test.ts @@ -1,7 +1,7 @@ import { test, expect } from "vitest"; import { fromMessageV1 } from "./fromMessageV1.js"; import { Value } from "@sinclair/typebox/value"; -import { MessageV1 } from "../schemaV1.js"; +import { MessageV1 } from "./schemaV1.js"; const messageV1: MessageV1 = { id: "hello_world", diff --git a/inlang/source-code/sdk2/src/schema/migrations/fromMessageV1.ts b/inlang/source-code/sdk2/src/json-schema/old-v1-message/fromMessageV1.ts similarity index 92% rename from inlang/source-code/sdk2/src/schema/migrations/fromMessageV1.ts rename to inlang/source-code/sdk2/src/json-schema/old-v1-message/fromMessageV1.ts index 6d5b8aa123..0e908f65b9 100644 --- a/inlang/source-code/sdk2/src/schema/migrations/fromMessageV1.ts +++ b/inlang/source-code/sdk2/src/json-schema/old-v1-message/fromMessageV1.ts @@ -1,8 +1,12 @@ import { generateStableBundleId } from "../../bundle-id/bundle-id.js"; -import type { BundleNested, MessageNested } from "../../database/schema.js"; +import type { + BundleNested, + MessageNested, + Variant, +} from "../../database/schema.js"; import type { InlangPlugin } from "../../plugin/schema.js"; -import type { MessageV1, PatternV1 } from "../schemaV1.js"; -import type { Declaration, Expression, Pattern, Variant } from "../schemaV2.js"; +import type { Declaration, Expression, Pattern } from "../pattern.js"; +import type { MessageV1, PatternV1 } from "./schemaV1.js"; /** * Converts a MessageV1 into a BundleNested diff --git a/inlang/source-code/sdk2/src/schema/schemaV1.ts b/inlang/source-code/sdk2/src/json-schema/old-v1-message/schemaV1.ts similarity index 100% rename from inlang/source-code/sdk2/src/schema/schemaV1.ts rename to inlang/source-code/sdk2/src/json-schema/old-v1-message/schemaV1.ts diff --git a/inlang/source-code/sdk2/src/schema/migrations/toMessageV1.test.ts b/inlang/source-code/sdk2/src/json-schema/old-v1-message/toMessageV1.test.ts similarity index 97% rename from inlang/source-code/sdk2/src/schema/migrations/toMessageV1.test.ts rename to inlang/source-code/sdk2/src/json-schema/old-v1-message/toMessageV1.test.ts index 29e1654780..aaac65ea68 100644 --- a/inlang/source-code/sdk2/src/schema/migrations/toMessageV1.test.ts +++ b/inlang/source-code/sdk2/src/json-schema/old-v1-message/toMessageV1.test.ts @@ -1,7 +1,7 @@ import { test, expect } from "vitest"; import { toMessageV1 } from "./toMessageV1.js"; import { Value } from "@sinclair/typebox/value"; -import { MessageV1 } from "../schemaV1.js"; +import { MessageV1 } from "./schemaV1.js"; import type { BundleNested } from "../../database/schema.js"; test("toMessageV1", () => { diff --git a/inlang/source-code/sdk2/src/schema/migrations/toMessageV1.ts b/inlang/source-code/sdk2/src/json-schema/old-v1-message/toMessageV1.ts similarity index 96% rename from inlang/source-code/sdk2/src/schema/migrations/toMessageV1.ts rename to inlang/source-code/sdk2/src/json-schema/old-v1-message/toMessageV1.ts index e6d4d133f1..37d7c11466 100644 --- a/inlang/source-code/sdk2/src/schema/migrations/toMessageV1.ts +++ b/inlang/source-code/sdk2/src/json-schema/old-v1-message/toMessageV1.ts @@ -1,12 +1,12 @@ import type { BundleNested } from "../../database/schema.js"; import type { InlangPlugin } from "../../plugin/schema.js"; +import type { Expression, Pattern } from "../pattern.js"; import type { ExpressionV1, MessageV1, PatternV1, VariantV1, -} from "../schemaV1.js"; -import type { Expression, Pattern } from "../schemaV2.js"; +} from "./schemaV1.js"; /** * Converts a BundleNested into a legacy format. diff --git a/inlang/source-code/sdk2/src/schema/schemaV2.ts b/inlang/source-code/sdk2/src/json-schema/pattern.ts similarity index 69% rename from inlang/source-code/sdk2/src/schema/schemaV2.ts rename to inlang/source-code/sdk2/src/json-schema/pattern.ts index 05878d0e32..47172b73bf 100644 --- a/inlang/source-code/sdk2/src/schema/schemaV2.ts +++ b/inlang/source-code/sdk2/src/json-schema/pattern.ts @@ -47,26 +47,3 @@ export const Declaration = Type.Object({ export type Pattern = Static; export const Pattern = Type.Array(Type.Union([Text, Expression])); - -export type Bundle = Static; -export const Bundle = Type.Object({ - id: Type.String(), - alias: Type.Record(Type.String(), Type.String()), -}); - -export type Message = Static; -export const Message = Type.Object({ - id: Type.String(), - bundleId: Type.String(), - locale: Type.String(), - declarations: Type.Array(Declaration), - selectors: Type.Array(Expression), -}); - -export type Variant = Static; -export const Variant = Type.Object({ - id: Type.String(), - messageId: Type.String(), - match: Type.Record(Type.String(), Type.String()), - pattern: Pattern, -}); diff --git a/inlang/source-code/sdk2/src/schema/settings.test-d.ts b/inlang/source-code/sdk2/src/json-schema/settings.test-d.ts similarity index 100% rename from inlang/source-code/sdk2/src/schema/settings.test-d.ts rename to inlang/source-code/sdk2/src/json-schema/settings.test-d.ts diff --git a/inlang/source-code/sdk2/src/schema/settings.ts b/inlang/source-code/sdk2/src/json-schema/settings.ts similarity index 100% rename from inlang/source-code/sdk2/src/schema/settings.ts rename to inlang/source-code/sdk2/src/json-schema/settings.ts diff --git a/inlang/source-code/sdk2/src/lix-plugin/applyChanges.test.ts b/inlang/source-code/sdk2/src/lix-plugin/applyChanges.test.ts index 7f10a3fb37..14f532ed69 100644 --- a/inlang/source-code/sdk2/src/lix-plugin/applyChanges.test.ts +++ b/inlang/source-code/sdk2/src/lix-plugin/applyChanges.test.ts @@ -2,10 +2,10 @@ import { test, expect } from "vitest"; import { loadProjectInMemory } from "../project/loadProjectInMemory.js"; import { newProject } from "../project/newProject.js"; import type { Change, NewChange } from "@lix-js/sdk"; -import type { Bundle } from "../schema/schemaV2.js"; import { applyChanges } from "./applyChanges.js"; import { loadDatabaseInMemory } from "sqlite-wasm-kysely"; import { initDb } from "../database/initDb.js"; +import type { Bundle } from "../database/schema.js"; test("it should be able to delete", async () => { const project = await loadProjectInMemory({ diff --git a/inlang/source-code/sdk2/src/lix-plugin/inlangLixPluginV1.test.ts b/inlang/source-code/sdk2/src/lix-plugin/inlangLixPluginV1.test.ts index db95aeef1c..1723baf9da 100644 --- a/inlang/source-code/sdk2/src/lix-plugin/inlangLixPluginV1.test.ts +++ b/inlang/source-code/sdk2/src/lix-plugin/inlangLixPluginV1.test.ts @@ -1,12 +1,11 @@ /* eslint-disable @typescript-eslint/no-non-null-assertion */ import { test, expect, describe } from "vitest"; import { inlangLixPluginV1 } from "./inlangLixPluginV1.js"; -import type { Variant } from "../schema/schemaV2.js"; import { type DiffReport } from "@lix-js/sdk"; import { newProject } from "../project/newProject.js"; import { loadProjectInMemory } from "../project/loadProjectInMemory.js"; import { contentFromDatabase } from "sqlite-wasm-kysely"; - +import type { Variant } from "../database/schema.js"; describe("plugin.diff.file", () => { test("insert of bundle", async () => { @@ -101,9 +100,7 @@ describe("plugin.diff.file", () => { .insertInto("message") .values({ id: "1", - declarations: [], bundleId: "unknown", - selectors: [], locale: "en", }) .execute(); @@ -137,16 +134,12 @@ describe("plugin.diff.file", () => { .values([ { id: "1", - declarations: [], - selectors: [], bundleId: "unknown", locale: "en", }, { id: "2", - declarations: [], bundleId: "unknown", - selectors: [], locale: "en", }, ]) @@ -157,16 +150,12 @@ describe("plugin.diff.file", () => { .values([ { id: "1", - declarations: [], bundleId: "unknown", - selectors: [], locale: "de", }, { id: "2", - declarations: [], bundleId: "unknown", - selectors: [], locale: "en", }, ]) diff --git a/inlang/source-code/sdk2/src/lix-plugin/inlangLixPluginV1.ts b/inlang/source-code/sdk2/src/lix-plugin/inlangLixPluginV1.ts index ad8fb9337a..e7ab5bb179 100644 --- a/inlang/source-code/sdk2/src/lix-plugin/inlangLixPluginV1.ts +++ b/inlang/source-code/sdk2/src/lix-plugin/inlangLixPluginV1.ts @@ -1,9 +1,9 @@ import type { DiffReport, LixPlugin } from "@lix-js/sdk"; -import { Bundle, Message, Variant } from "../schema/schemaV2.js"; import { loadDatabaseInMemory } from "sqlite-wasm-kysely"; import { initDb } from "../database/initDb.js"; import { applyChanges } from "./applyChanges.js"; import { detectConflicts } from "./detectConflicts.js"; +import type { Bundle, Message, Variant } from "../database/schema.js"; export const inlangLixPluginV1: LixPlugin<{ bundle: Bundle; diff --git a/inlang/source-code/sdk2/src/migrations/v2/withLanguageTagToLocaleMigration.test.ts b/inlang/source-code/sdk2/src/migrations/v2/withLanguageTagToLocaleMigration.test.ts index ca6fcff72c..e27c77b16f 100644 --- a/inlang/source-code/sdk2/src/migrations/v2/withLanguageTagToLocaleMigration.test.ts +++ b/inlang/source-code/sdk2/src/migrations/v2/withLanguageTagToLocaleMigration.test.ts @@ -1,5 +1,5 @@ import { expect, test } from "vitest"; -import type { ProjectSettings } from "../../schema/settings.js"; +import type { ProjectSettings } from "../../json-schema/settings.js"; import { withLanguageTagToLocaleMigration } from "./withLanguageTagToLocaleMigration.js"; test("it should set sourceLanguageTag and languageTags if non-existent to make v1 plugins work", async () => { diff --git a/inlang/source-code/sdk2/src/migrations/v2/withLanguageTagToLocaleMigration.ts b/inlang/source-code/sdk2/src/migrations/v2/withLanguageTagToLocaleMigration.ts index 736dbebd45..786d478d73 100644 --- a/inlang/source-code/sdk2/src/migrations/v2/withLanguageTagToLocaleMigration.ts +++ b/inlang/source-code/sdk2/src/migrations/v2/withLanguageTagToLocaleMigration.ts @@ -1,4 +1,4 @@ -import type { ProjectSettings } from "../../schema/settings.js"; +import type { ProjectSettings } from "../../json-schema/settings.js"; /** * Change introduced in v2. diff --git a/inlang/source-code/sdk2/src/mock/plural/bundle.test.ts b/inlang/source-code/sdk2/src/mock/bundle.test.ts similarity index 100% rename from inlang/source-code/sdk2/src/mock/plural/bundle.test.ts rename to inlang/source-code/sdk2/src/mock/bundle.test.ts diff --git a/inlang/source-code/sdk2/src/mock/plural/bundle.ts b/inlang/source-code/sdk2/src/mock/bundle.ts similarity index 95% rename from inlang/source-code/sdk2/src/mock/plural/bundle.ts rename to inlang/source-code/sdk2/src/mock/bundle.ts index 59fb0bd315..491436db22 100644 --- a/inlang/source-code/sdk2/src/mock/plural/bundle.ts +++ b/inlang/source-code/sdk2/src/mock/bundle.ts @@ -1,5 +1,8 @@ -import type { BundleNested } from "../../database/schema.js"; +import type { BundleNested } from "../database/schema.js"; +/** + * @deprecated use your own plural bundle mock. This variable will be removed at any time in the future. + */ export const pluralBundle: BundleNested = { id: "mock_bundle_human_id", alias: { diff --git a/inlang/source-code/sdk2/src/mock/index.ts b/inlang/source-code/sdk2/src/mock/index.ts index f8f578cf61..1255290402 100644 --- a/inlang/source-code/sdk2/src/mock/index.ts +++ b/inlang/source-code/sdk2/src/mock/index.ts @@ -1,2 +1 @@ -export * from "./mockhelper.js"; -export * from "./plural/bundle.js"; +export * from "./bundle.js"; diff --git a/inlang/source-code/sdk2/src/mock/mockdata.ts b/inlang/source-code/sdk2/src/mock/mockdata.ts deleted file mode 100644 index 1a6139a36e..0000000000 --- a/inlang/source-code/sdk2/src/mock/mockdata.ts +++ /dev/null @@ -1,465 +0,0 @@ -// const languageTags: string[] = [ -// "en-US", // English (United States) -// "es-ES", // Spanish (Spain) -// "fr-FR", // French (France) -// "de-DE", // German (Germany) -// "zh-CN", // Chinese (Simplified, China) -// "ja-JP", // Japanese (Japan) -// "ko-KR", // Korean (South Korea) -// "it-IT", // Italian (Italy) -// "pt-BR", // Portuguese (Brazil) -// ] - -export const translations: { [key: string]: string[] } = { - "en-US": [ - "Welcome back, ", - "Your account balance is ", - "You have ", - " new messages.", - "Click here to ", - "learn more", - "Your order number ", - " is being processed.", - "Thank you for your purchase.", - "Please enter your ", - "username", - " and ", - "password.", - "Your appointment is scheduled for ", - "Please contact ", - " customer support.", - "Order status: ", - "Shipment tracking number: ", - "Estimated delivery date: ", - "Invoice amount: ", - "Billing address: ", - "Shipping address: ", - "Promo code: ", - "Discount applied: ", - "Total amount: ", - "Payment method: ", - "Transaction ID: ", - "Date: ", - "Time: ", - "Location: ", - "Please review and confirm your ", - "changes.", - "Your settings have been ", - "updated.", - "An error occurred: ", - "Message: ", - "Details: ", - ], - "es-ES": [ - "Bienvenido de nuevo, ", - "Su saldo es ", - "Tiene ", - " nuevos mensajes.", - "Haga clic aquí para ", - "saber más", - "Su número de pedido ", - " está siendo procesado.", - "Gracias por su compra.", - "Por favor, ingrese su ", - "nombre de usuario", - " y ", - "contraseña.", - "Su cita está programada para ", - "Por favor, póngase en contacto con ", - " servicio al cliente.", - "Estado del pedido: ", - "Número de seguimiento del envío: ", - "Fecha estimada de entrega: ", - "Monto de la factura: ", - "Dirección de facturación: ", - "Dirección de envío: ", - "Código promocional: ", - "Descuento aplicado: ", - "Monto total: ", - "Método de pago: ", - "ID de transacción: ", - "Fecha: ", - "Hora: ", - "Ubicación: ", - "Por favor revise y confirme sus ", - "cambios.", - "Su configuración ha sido ", - "actualizada.", - "Ocurrió un error: ", - "Mensaje: ", - "Detalles: ", - ], - "fr-FR": [ - "Bon retour, ", - "Votre solde est de ", - "Vous avez ", - " nouveaux messages.", - "Cliquez ici pour ", - "en savoir plus", - "Votre numéro de commande ", - " est en cours de traitement.", - "Merci pour votre achat.", - "Veuillez entrer votre ", - "nom d'utilisateur", - " et ", - "mot de passe.", - "Votre rendez-vous est prévu pour le ", - "Veuillez contacter ", - " le service client.", - "Statut de la commande : ", - "Numéro de suivi de l'envoi : ", - "Date de livraison estimée : ", - "Montant de la facture : ", - "Adresse de facturation : ", - "Adresse de livraison : ", - "Code promo : ", - "Remise appliquée : ", - "Montant total : ", - "Mode de paiement : ", - "ID de transaction : ", - "Date : ", - "Heure : ", - "Lieu : ", - "Veuillez vérifier et confirmer vos ", - "modifications.", - "Vos paramètres ont été ", - "mis à jour.", - "Une erreur s'est produite : ", - "Message : ", - "Détails : ", - ], - de: [ - "Willkommen zurück, ", - "Ihr Kontostand beträgt ", - "Sie haben ", - " neue Nachrichten.", - "Klicken Sie hier, um ", - "mehr zu erfahren", - "Ihre Bestellnummer ", - " wird bearbeitet.", - "Danke für Ihren Einkauf.", - "Bitte geben Sie Ihren ", - "Benutzernamen", - " und ", - "Passwort ein.", - "Ihr Termin ist geplant für ", - "Bitte kontaktieren Sie ", - " den Kundenservice.", - "Bestellstatus: ", - "Sendungsverfolgungsnummer: ", - "Geschätztes Lieferdatum: ", - "Rechnungsbetrag: ", - "Rechnungsadresse: ", - "Lieferadresse: ", - "Gutscheincode: ", - "Angewandter Rabatt: ", - "Gesamtbetrag: ", - "Zahlungsmethode: ", - "Transaktions-ID: ", - "Datum: ", - "Uhrzeit: ", - "Ort: ", - "Bitte überprüfen und bestätigen Sie Ihre ", - "Änderungen.", - "Ihre Einstellungen wurden ", - "aktualisiert.", - "Ein Fehler ist aufgetreten: ", - "Nachricht: ", - "Details: ", - ], - "zh-CN": [ - "欢迎回来,", - "您的账户余额为 ", - "您有 ", - " 条新消息。", - "点击这里 ", - "了解更多", - "您的订单号 ", - " 正在处理中。", - "感谢您的购买。", - "请输入您的 ", - "用户名", - " 和 ", - "密码。", - "您的预约定于 ", - "请联系 ", - " 客户支持。", - "订单状态:", - "运单号:", - "预计送达日期:", - "发票金额:", - "账单地址:", - "送货地址:", - "促销代码:", - "已应用折扣:", - "总金额:", - "支付方式:", - "交易ID:", - "日期:", - "时间:", - "地点:", - "请检查并确认您的 ", - "更改。", - "您的设置已 ", - "更新。", - "发生错误:", - "消息:", - "详细信息:", - ], - "ja-JP": [ - "おかえりなさい、", - "あなたの残高は ", - "あなたには ", - " 新しいメッセージがあります。", - "ここをクリックして ", - "詳細を見る", - "あなたの注文番号 ", - " は処理中です。", - "ご購入ありがとうございます。", - "あなたの ", - "ユーザー名", - " と ", - "パスワードを入力してください。", - "あなたの予約は ", - " に予定されています。", - "サポートに連絡してください:", - "注文状況:", - "配送追跡番号:", - "推定配達日:", - "請求金額:", - "請求先住所:", - "配送先住所:", - "プロモーションコード:", - "適用された割引:", - "合計金額:", - "支払方法:", - "取引ID:", - "日付:", - "時間:", - "場所:", - "あなたの ", - "変更を確認してください。", - "設定が更新されました。", - "エラーが発生しました:", - "メッセージ:", - "詳細:", - ], - "ko-KR": [ - "다시 오신 것을 환영합니다, ", - "계좌 잔액은 ", - "새 메시지가 ", - "개 있습니다.", - "여기를 클릭하여 ", - "더 알아보기", - "주문 번호 ", - "가 처리 중입니다.", - "구매해 주셔서 감사합니다.", - "를 입력하십시오 ", - "사용자 이름", - "와 ", - "비밀번호.", - "예약이 예정되어 있습니다 ", - "고객 지원에 문의하십시오: ", - "주문 상태: ", - "배송 추적 번호: ", - "예상 배송일: ", - "청구 금액: ", - "청구서 주소: ", - "배송지 주소: ", - "프로모션 코드: ", - "적용된 할인: ", - "총 금액: ", - "결제 방법: ", - "거래 ID: ", - "날짜: ", - "시간: ", - "위치: ", - "를 검토하고 확인하십시오 ", - "변경 사항.", - "설정이 ", - "업데이트되었습니다.", - "오류가 발생했습니다: ", - "메시지: ", - "세부 정보: ", - ], - "it-IT": [ - "Bentornato, ", - "Il saldo del tuo account è ", - "Hai ", - " nuovi messaggi.", - "Clicca qui per ", - "saperne di più", - "Il numero del tuo ordine ", - " è in fase di elaborazione.", - "Grazie per il tuo acquisto.", - "Per favore, inserisci il tuo ", - "nome utente", - " e ", - "password.", - "Il tuo appuntamento è previsto per ", - "Si prega di contattare ", - " il supporto clienti.", - "Stato dell'ordine: ", - "Numero di tracciamento della spedizione: ", - "Data di consegna prevista: ", - "Importo della fattura: ", - "Indirizzo di fatturazione: ", - "Indirizzo di spedizione: ", - "Codice promozionale: ", - "Sconto applicato: ", - "Importo totale: ", - "Metodo di pagamento: ", - "ID transazione: ", - "Data: ", - "Ora: ", - "Luogo: ", - "Per favore, controlla e conferma i tuoi ", - "cambiamenti.", - "Le tue impostazioni sono state ", - "aggiornate.", - "Si è verificato un errore: ", - "Messaggio: ", - "Dettagli: ", - ], - "pt-BR": [ - "Bem-vindo de volta, ", - "Seu saldo é ", - "Você tem ", - " novas mensagens.", - "Clique aqui para ", - "saber mais", - "Seu número de pedido ", - " está sendo processado.", - "Obrigado pela sua compra.", - "Por favor, insira seu ", - "nome de usuário", - " e ", - "senha.", - "Seu compromisso está agendado para ", - "Por favor, entre em contato com ", - " o suporte ao cliente.", - "Status do pedido: ", - "Número de rastreamento da remessa: ", - "Data estimada de entrega: ", - "Valor da fatura: ", - "Endereço de cobrança: ", - "Endereço de entrega: ", - "Código promocional: ", - "Desconto aplicado: ", - "Valor total: ", - "Método de pagamento: ", - "ID da transação: ", - "Data: ", - "Hora: ", - "Local: ", - "Por favor, revise e confirme suas ", - "alterações.", - "Suas configurações foram ", - "atualizadas.", - "Ocorreu um erro: ", - "Mensagem: ", - "Detalhes: ", - ], -}; - -export const inputNames: string[] = [ - "username", - "accountBalance", - "messageCount", - "orderNumber", - "purchaseDate", - "appointmentDate", - "customerSupportContact", - "orderStatus", - "trackingNumber", - "deliveryDate", - "invoiceAmount", - "billingAddress", - "shippingAddress", - "promoCode", - "discountAmount", - "totalAmount", - "paymentMethod", - "transactionId", - "date", - "time", - "location", - "confirmationDetails", - "errorMessage", - "errorDetails", -]; - -export const simpleInputs = { - string: (name: string) => ({ - inputDeclaration: { - type: "input", - name: name, - value: { - type: "expression", - arg: { - type: "variable", - name: name, - }, - }, - }, - }), -}; - -export const inputsWithSelectors = { - number: (name: string) => ({ - inputDeclaration: { - type: "input", - name: name, - value: { - type: "expression", - arg: { - type: "variable", - name: name, - }, - }, - }, - - selector: { - type: "expression", - arg: { - type: "variable", - name: name, - }, - annotation: { - type: "function", - name: "number", - options: [], - }, - }, - - matcher: ["one", "many", "*"], - }), - gender: (name: string) => ({ - inputDeclaration: { - type: "input", - name: name, - value: { - type: "expression", - arg: { - type: "variable", - name: name, - }, - }, - }, - - selector: { - type: "expression", - arg: { - type: "variable", - name: name, - }, - annotation: { - type: "function", - name: "gender", - options: [], - }, - }, - - matcher: ["male", "female", "*"], - }), -}; diff --git a/inlang/source-code/sdk2/src/mock/mockhelper.ts b/inlang/source-code/sdk2/src/mock/mockhelper.ts deleted file mode 100644 index ad25febe87..0000000000 --- a/inlang/source-code/sdk2/src/mock/mockhelper.ts +++ /dev/null @@ -1,180 +0,0 @@ -/* eslint-disable @typescript-eslint/no-non-null-assertion */ -import type { Declaration, Expression, Pattern } from "../schema/schemaV2.js"; -import { generateBundleId } from "../bundle-id/bundle-id.js"; -import { - inputNames, - inputsWithSelectors, - simpleInputs, - translations, -} from "./mockdata.js"; -//@ts-ignore -import { v4 } from "uuid"; -import type { BundleNested, MessageNested } from "../database/schema.js"; - -export function generateUUID() { - return v4(); -} - -/** - * - * @param variants - * @returns an array of variants and there vorresponding matachers like [['one', 'one'], ['one', '*'],['*', 'one'], ['*', '*']] - */ -function generateCombinations( - variants: string[][], - selector: string[] -): Record[] { - const combinations: Record[] = []; - - function backtrack(path: Record, index: number) { - if (index === variants.length) { - combinations.push(path); - return; - } - - for (const variant of variants[index]!) { - path[selector[index]!] = variant; - backtrack(path, index + 1); - delete path[selector[index]!]; - } - } - - backtrack({}, 0); - return combinations; -} - -/** - * generates a message bundle with messages for the given locales and other properties passed as paramters - * @param languageTags language tags to generate messages for - * @param nInputs number of inputs to add number should be bigger or equal the number of selector for now - * @param nSelectors number of selectors to add like plural forms or numbers - * @param nExpressions number of expressens to add to the variant patterns (like name placeholders) - */ -export function createMockBundle(args: { - languageTags: string[]; - nInputs: number; - nSelectors: number; - nExpressions: number; -}) { - const bundleId = generateBundleId(); - const bundleAlias = { - // TODO generate more realistic message bundle name like login_button or welcome_message or learn_more_lix - default: "name_" + generateBundleId(), - }; - - const selectors: any[] = []; - const inputs: any[] = []; - const matchers: string[][] = []; - - // add selectors with selectors and matchers first - for (let i = 0; i < args.nSelectors; i++) { - if (i === 0) { - selectors.push(inputsWithSelectors.gender("gender").selector); - inputs.push(inputsWithSelectors.gender("gender").inputDeclaration); - matchers.push(inputsWithSelectors.gender("gender").matcher); - } else { - const inputName: string = inputNames[i]!; - selectors.push(inputsWithSelectors.number(inputName).selector); - inputs.push(inputsWithSelectors.number(inputName).inputDeclaration); - matchers.push(inputsWithSelectors.number(inputName).matcher); - } - } - - // fill up the remaining inputs with simple inputs (no selector function and matchers) - for (let i = inputs.length; i < args.nInputs; i++) { - const inputName: string = inputNames[i]!; // TODO generate a selector name - if (i === 0) { - inputs.push(simpleInputs.string(inputName).inputDeclaration); - } else { - inputs.push(simpleInputs.string(inputName).inputDeclaration); - } - } - - const messages = createMessages( - bundleId, - args.languageTags, - inputs, - selectors, - generateCombinations(matchers, selectors) - ); - return { - id: bundleId, - alias: bundleAlias, - messages: messages, - } as BundleNested; -} - -function createMessages( - bundleId: string, - languageTags: string[], - inputs: Declaration[], - selectors: Expression[], - variants: Array> -) { - const messagesByLanguage: Record = {}; - - for (const lanugageTag of languageTags) { - const messageId = generateUUID(); - messagesByLanguage[lanugageTag] = { - id: messageId, - bundleId: bundleId, - locale: lanugageTag, // cycling through 10 locales - declarations: inputs, - selectors: selectors, - variants: [], - }; - } - - for (const variant of variants) { - const y = messagesByLanguage["en"]!; - - y; - const patternsByLanguage = createPattern(inputs, languageTags); - for (const lanugageTag of languageTags) { - messagesByLanguage[lanugageTag]!.variants.push({ - id: generateUUID(), - match: variant, - messageId: messagesByLanguage[lanugageTag]!.id, - pattern: patternsByLanguage[lanugageTag]!, - }); - } - } - - return Object.values(messagesByLanguage); -} - -function createPattern(inputs: Declaration[], languageTags: string[]) { - const patterns: { - [languageTag: string]: Pattern; - } = {}; - for (const lanugageTag of languageTags) { - patterns[lanugageTag] = []; - } - - const textIndex = Math.floor(Math.random() * translations["en-US"]!.length); - for (const lanugageTag of languageTags) { - patterns[lanugageTag]!.push({ - type: "text", - value: translations[lanugageTag]![textIndex]!, - }); - } - - for (const input of inputs) { - const textIndex = Math.floor(Math.random() * translations["en-US"]!.length); - for (const lanugageTag of languageTags) { - patterns[lanugageTag]!.push({ - type: "text", - value: translations[lanugageTag]![textIndex]!, - }); - } - - for (const lanugageTag of languageTags) { - patterns[lanugageTag]!.push({ - type: "expression", - arg: { type: "variable", name: input.name }, - }); - } - } - - return patterns; -} diff --git a/inlang/source-code/sdk2/src/plugin/errors.ts b/inlang/source-code/sdk2/src/plugin/errors.ts index a79882555f..cc5d15d519 100644 --- a/inlang/source-code/sdk2/src/plugin/errors.ts +++ b/inlang/source-code/sdk2/src/plugin/errors.ts @@ -37,22 +37,6 @@ export class PluginImportError extends PluginError { } } -export class PluginExportIsInvalidError extends PluginError { - constructor(options: { plugin: string; errors: ValueError[] }) { - super( - `The export(s) of "${options.plugin}" are invalid:\n\n${options.errors - .map( - (error) => - `"${error.path}" "${JSON.stringify(error.value, undefined, 2)}": "${ - error.message - }"` - ) - .join("\n")}`, - options - ); - this.name = "PluginExportIsInvalidError"; - } -} export class PluginSettingsAreInvalidError extends PluginError { constructor(options: { plugin: string; errors: ValueError[] }) { diff --git a/inlang/source-code/sdk2/src/plugin/importPlugins.ts b/inlang/source-code/sdk2/src/plugin/importPlugins.ts index 06ecb106a1..17793f6100 100644 --- a/inlang/source-code/sdk2/src/plugin/importPlugins.ts +++ b/inlang/source-code/sdk2/src/plugin/importPlugins.ts @@ -1,4 +1,4 @@ -import type { ProjectSettings } from "../schema/settings.js"; +import type { ProjectSettings } from "../json-schema/settings.js"; import { PluginError, PluginImportError } from "./errors.js"; import type { InlangPlugin } from "./schema.js"; diff --git a/inlang/source-code/sdk2/src/plugin/schema.ts b/inlang/source-code/sdk2/src/plugin/schema.ts index b2437fe9fb..c7d3effd43 100644 --- a/inlang/source-code/sdk2/src/plugin/schema.ts +++ b/inlang/source-code/sdk2/src/plugin/schema.ts @@ -1,6 +1,6 @@ import type { TObject } from "@sinclair/typebox"; -import type { MessageV1 } from "../schema/schemaV1.js"; -import type { ProjectSettings } from "../schema/settings.js"; +import type { MessageV1 } from "../json-schema/old-v1-message/schemaV1.js"; +import type { ProjectSettings } from "../json-schema/settings.js"; import type { ResourceFile } from "../project/api.js"; import type { BundleNested, NewBundleNested } from "../database/schema.js"; diff --git a/inlang/source-code/sdk2/src/project/api.ts b/inlang/source-code/sdk2/src/project/api.ts index a4b7c2a53f..1152cd02dd 100644 --- a/inlang/source-code/sdk2/src/project/api.ts +++ b/inlang/source-code/sdk2/src/project/api.ts @@ -4,7 +4,7 @@ import type { NewBundleNested, } from "../database/schema.js"; import type { InlangPlugin } from "../plugin/schema.js"; -import type { ProjectSettings } from "../schema/settings.js"; +import type { ProjectSettings } from "../json-schema/settings.js"; import type { Lix } from "@lix-js/sdk"; import type { SqliteDatabase } from "sqlite-wasm-kysely"; diff --git a/inlang/source-code/sdk2/src/project/loadProject.test.ts b/inlang/source-code/sdk2/src/project/loadProject.test.ts index cc9a20aa32..2134bc69a3 100644 --- a/inlang/source-code/sdk2/src/project/loadProject.test.ts +++ b/inlang/source-code/sdk2/src/project/loadProject.test.ts @@ -18,8 +18,6 @@ test("it should persist changes of bundles, messages, and variants to lix ", asy .values({ bundleId: bundle.id, locale: "en", - declarations: [], - selectors: [], }) .returning("id") .executeTakeFirstOrThrow(); diff --git a/inlang/source-code/sdk2/src/project/loadProject.ts b/inlang/source-code/sdk2/src/project/loadProject.ts index 4ba18383ca..1423ce0d96 100644 --- a/inlang/source-code/sdk2/src/project/loadProject.ts +++ b/inlang/source-code/sdk2/src/project/loadProject.ts @@ -1,6 +1,6 @@ import { type Lix } from "@lix-js/sdk"; import type { InlangPlugin } from "../plugin/schema.js"; -import type { ProjectSettings } from "../schema/settings.js"; +import type { ProjectSettings } from "../json-schema/settings.js"; import { type SqliteDatabase } from "sqlite-wasm-kysely"; import { initDb } from "../database/initDb.js"; import { initHandleSaveToLixOnChange } from "./initHandleSaveToLixOnChange.js"; diff --git a/inlang/source-code/sdk2/src/project/loadProjectFromDirectory.test.ts b/inlang/source-code/sdk2/src/project/loadProjectFromDirectory.test.ts index e7dd53b505..0d14658e19 100644 --- a/inlang/source-code/sdk2/src/project/loadProjectFromDirectory.test.ts +++ b/inlang/source-code/sdk2/src/project/loadProjectFromDirectory.test.ts @@ -1,12 +1,15 @@ /* eslint-disable @typescript-eslint/no-non-null-assertion */ import { expect, test } from "vitest"; -import { ProjectSettings } from "../schema/settings.js"; +import { ProjectSettings } from "../json-schema/settings.js"; import { Volume } from "memfs"; import { loadProjectFromDirectoryInMemory } from "./loadProjectFromDirectory.js"; import { selectBundleNested } from "../query-utilities/selectBundleNested.js"; -import type { Text } from "../schema/schemaV2.js"; +import { Text } from "../json-schema/pattern.js"; import type { InlangPlugin } from "../plugin/schema.js"; -import type { MessageV1, VariantV1 } from "../schema/schemaV1.js"; +import type { + MessageV1, + VariantV1, +} from "../json-schema/old-v1-message/schemaV1.js"; test("plugin.loadMessages and plugin.saveMessages must not be condigured together with import export", async () => { const mockLegacyPlugin: InlangPlugin = { diff --git a/inlang/source-code/sdk2/src/project/loadProjectFromDirectory.ts b/inlang/source-code/sdk2/src/project/loadProjectFromDirectory.ts index 0c7ee04f5c..653d14e2fc 100644 --- a/inlang/source-code/sdk2/src/project/loadProjectFromDirectory.ts +++ b/inlang/source-code/sdk2/src/project/loadProjectFromDirectory.ts @@ -7,7 +7,7 @@ import type fs from "node:fs/promises"; import nodePath from "node:path"; import type { InlangPlugin } from "../plugin/schema.js"; import { insertBundleNested } from "../query-utilities/insertBundleNested.js"; -import { fromMessageV1 } from "../schema/migrations/fromMessageV1.js"; +import { fromMessageV1 } from "../json-schema/old-v1-message/fromMessageV1.js"; /** * Loads a project from a directory. diff --git a/inlang/source-code/sdk2/src/project/newProject.ts b/inlang/source-code/sdk2/src/project/newProject.ts index ec8bd1e9ef..e1a532c1c2 100644 --- a/inlang/source-code/sdk2/src/project/newProject.ts +++ b/inlang/source-code/sdk2/src/project/newProject.ts @@ -1,5 +1,5 @@ import { newLixFile, openLixInMemory } from "@lix-js/sdk"; -import type { ProjectSettings } from "../schema/settings.js"; +import type { ProjectSettings } from "../json-schema/settings.js"; import { contentFromDatabase, createInMemoryDatabase, diff --git a/inlang/source-code/sdk2/src/project/state/setSettings.test.ts b/inlang/source-code/sdk2/src/project/state/setSettings.test.ts index 6357231ee2..f9d9e5cb1d 100644 --- a/inlang/source-code/sdk2/src/project/state/setSettings.test.ts +++ b/inlang/source-code/sdk2/src/project/state/setSettings.test.ts @@ -1,6 +1,6 @@ import { expect, test } from "vitest"; import { newLixFile, openLixInMemory, uuidv4 } from "@lix-js/sdk"; -import { ProjectSettings } from "../../schema/settings.js"; +import { ProjectSettings } from "../../json-schema/settings.js"; import { createProjectState } from "./state.js"; import { setSettings } from "./setSettings.js"; diff --git a/inlang/source-code/sdk2/src/project/state/setSettings.ts b/inlang/source-code/sdk2/src/project/state/setSettings.ts index 6914cd1a22..4381804880 100644 --- a/inlang/source-code/sdk2/src/project/state/setSettings.ts +++ b/inlang/source-code/sdk2/src/project/state/setSettings.ts @@ -1,5 +1,5 @@ import type { Lix } from "@lix-js/sdk"; -import type { ProjectSettings } from "../../schema/settings.js"; +import type { ProjectSettings } from "../../json-schema/settings.js"; export async function setSettings(args: { newSettings: ProjectSettings; lix: Lix }) { const cloned = structuredClone(args.newSettings); diff --git a/inlang/source-code/sdk2/src/project/state/settings$.test.ts b/inlang/source-code/sdk2/src/project/state/settings$.test.ts index fc26dbac2c..9c94a940a1 100644 --- a/inlang/source-code/sdk2/src/project/state/settings$.test.ts +++ b/inlang/source-code/sdk2/src/project/state/settings$.test.ts @@ -1,7 +1,7 @@ import { expect, test } from "vitest"; import { createSettings$ } from "./settings$.js"; import { newLixFile, openLixInMemory } from "@lix-js/sdk"; -import type { ProjectSettings } from "../../schema/settings.js"; +import type { ProjectSettings } from "../../json-schema/settings.js"; import { firstValueFrom } from "rxjs"; import { withLanguageTagToLocaleMigration } from "../../migrations/v2/withLanguageTagToLocaleMigration.js"; diff --git a/inlang/source-code/sdk2/src/project/state/settings$.ts b/inlang/source-code/sdk2/src/project/state/settings$.ts index 41e3fc3c97..a97579a930 100644 --- a/inlang/source-code/sdk2/src/project/state/settings$.ts +++ b/inlang/source-code/sdk2/src/project/state/settings$.ts @@ -1,6 +1,6 @@ import { type Lix } from "@lix-js/sdk"; import { map, share, type Observable } from "rxjs"; -import type { ProjectSettings } from "../../schema/settings.js"; +import type { ProjectSettings } from "../../json-schema/settings.js"; import { withLanguageTagToLocaleMigration } from "../../migrations/v2/withLanguageTagToLocaleMigration.js"; import { pollQuery } from "../../query-utilities/pollQuery.js"; diff --git a/inlang/source-code/sdk2/src/project/state/state.test.ts b/inlang/source-code/sdk2/src/project/state/state.test.ts index 0fd98972bc..86f66ae5ae 100644 --- a/inlang/source-code/sdk2/src/project/state/state.test.ts +++ b/inlang/source-code/sdk2/src/project/state/state.test.ts @@ -1,7 +1,7 @@ import { test, expect, vi } from "vitest"; import { createProjectState } from "./state.js"; import { newLixFile, openLixInMemory } from "@lix-js/sdk"; -import type { ProjectSettings } from "../../schema/settings.js"; +import type { ProjectSettings } from "../../json-schema/settings.js"; test("plugins should be re-imported if the settings have been updated", async () => { const mockImportPlugins = vi.hoisted(() => diff --git a/inlang/source-code/sdk2/src/project/state/state.ts b/inlang/source-code/sdk2/src/project/state/state.ts index a114cbb007..33a3b10fb3 100644 --- a/inlang/source-code/sdk2/src/project/state/state.ts +++ b/inlang/source-code/sdk2/src/project/state/state.ts @@ -1,6 +1,6 @@ import { firstValueFrom, map, merge, share, switchMap } from "rxjs"; import type { InlangPlugin } from "../../plugin/schema.js"; -import type { ProjectSettings } from "../../schema/settings.js"; +import type { ProjectSettings } from "../../json-schema/settings.js"; import { importPlugins, type PreprocessPluginBeforeImportFunction,