@inlang/sdk 0.36.4 → 2.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/database/initDb.d.ts +7 -0
- package/dist/database/initDb.d.ts.map +1 -0
- package/dist/database/initDb.js +36 -0
- package/dist/database/initDb.js.map +1 -0
- package/dist/database/initDbAndSchema.test.d.ts +2 -0
- package/dist/database/initDbAndSchema.test.d.ts.map +1 -0
- package/dist/database/initDbAndSchema.test.js +110 -0
- package/dist/database/initDbAndSchema.test.js.map +1 -0
- package/dist/database/jsonbPlugin.d.ts +20 -0
- package/dist/database/jsonbPlugin.d.ts.map +1 -0
- package/dist/database/jsonbPlugin.js +183 -0
- package/dist/database/jsonbPlugin.js.map +1 -0
- package/dist/database/jsonbPlugin.test.d.ts +2 -0
- package/dist/database/jsonbPlugin.test.d.ts.map +1 -0
- package/dist/database/jsonbPlugin.test.js +119 -0
- package/dist/database/jsonbPlugin.test.js.map +1 -0
- package/dist/database/schema.d.ts +74 -0
- package/dist/database/schema.d.ts.map +1 -0
- package/dist/database/schema.js +45 -0
- package/dist/database/schema.js.map +1 -0
- package/dist/helper.d.ts +71 -0
- package/dist/helper.d.ts.map +1 -0
- package/dist/helper.js +91 -0
- package/dist/helper.js.map +1 -0
- package/dist/human-id/human-id.d.ts +3 -0
- package/dist/human-id/human-id.d.ts.map +1 -0
- package/dist/human-id/human-id.js +12 -0
- package/dist/human-id/human-id.js.map +1 -0
- package/dist/human-id/words.d.ts.map +1 -0
- package/dist/{storage/human-id → human-id}/words.js +4 -0
- package/dist/human-id/words.js.map +1 -0
- package/dist/human-id/words.test.d.ts.map +1 -0
- package/dist/{storage/human-id → human-id}/words.test.js +4 -0
- package/dist/human-id/words.test.js.map +1 -0
- package/dist/import-export/exportFiles.d.ts +11 -0
- package/dist/import-export/exportFiles.d.ts.map +1 -0
- package/dist/import-export/exportFiles.js +26 -0
- package/dist/import-export/exportFiles.js.map +1 -0
- package/dist/import-export/importFiles.d.ts +13 -0
- package/dist/import-export/importFiles.d.ts.map +1 -0
- package/dist/import-export/importFiles.js +124 -0
- package/dist/import-export/importFiles.js.map +1 -0
- package/dist/import-export/importFiles.test.d.ts +2 -0
- package/dist/import-export/importFiles.test.d.ts.map +1 -0
- package/dist/import-export/importFiles.test.js +179 -0
- package/dist/import-export/importFiles.test.js.map +1 -0
- package/dist/import-export/roundtrip.test.d.ts +2 -0
- package/dist/import-export/roundtrip.test.d.ts.map +1 -0
- package/dist/import-export/roundtrip.test.js +273 -0
- package/dist/import-export/roundtrip.test.js.map +1 -0
- package/dist/import-export/upsertBundleNestedMatchByProperties.d.ts +4 -0
- package/dist/import-export/upsertBundleNestedMatchByProperties.d.ts.map +1 -0
- package/dist/import-export/upsertBundleNestedMatchByProperties.js +58 -0
- package/dist/import-export/upsertBundleNestedMatchByProperties.js.map +1 -0
- package/dist/index.d.ts +21 -18
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +20 -17
- package/dist/index.js.map +1 -0
- package/dist/json-schema/old-v1-message/fromMessageV1.d.ts +9 -0
- package/dist/json-schema/old-v1-message/fromMessageV1.d.ts.map +1 -0
- package/dist/json-schema/old-v1-message/fromMessageV1.js +84 -0
- package/dist/json-schema/old-v1-message/fromMessageV1.js.map +1 -0
- package/dist/json-schema/old-v1-message/fromMessageV1.test.d.ts +2 -0
- package/dist/json-schema/old-v1-message/fromMessageV1.test.d.ts.map +1 -0
- package/dist/json-schema/old-v1-message/fromMessageV1.test.js +85 -0
- package/dist/json-schema/old-v1-message/fromMessageV1.test.js.map +1 -0
- package/dist/json-schema/old-v1-message/schemaV1.d.ts +86 -0
- package/dist/json-schema/old-v1-message/schemaV1.d.ts.map +1 -0
- package/dist/json-schema/old-v1-message/schemaV1.js +35 -0
- package/dist/json-schema/old-v1-message/schemaV1.js.map +1 -0
- package/dist/json-schema/old-v1-message/toMessageV1.d.ts +9 -0
- package/dist/json-schema/old-v1-message/toMessageV1.d.ts.map +1 -0
- package/dist/json-schema/old-v1-message/toMessageV1.js +67 -0
- package/dist/json-schema/old-v1-message/toMessageV1.js.map +1 -0
- package/dist/json-schema/old-v1-message/toMessageV1.test.d.ts +2 -0
- package/dist/json-schema/old-v1-message/toMessageV1.test.d.ts.map +1 -0
- package/dist/json-schema/old-v1-message/toMessageV1.test.js +85 -0
- package/dist/json-schema/old-v1-message/toMessageV1.test.js.map +1 -0
- package/dist/json-schema/pattern.d.ts +190 -0
- package/dist/json-schema/pattern.d.ts.map +1 -0
- package/dist/json-schema/pattern.js +43 -0
- package/dist/json-schema/pattern.js.map +1 -0
- package/dist/json-schema/settings.d.ts +31 -0
- package/dist/json-schema/settings.d.ts.map +1 -0
- package/dist/json-schema/settings.js +96 -0
- package/dist/json-schema/settings.js.map +1 -0
- package/dist/json-schema/settings.test-d.d.ts +2 -0
- package/dist/json-schema/settings.test-d.d.ts.map +1 -0
- package/dist/json-schema/settings.test-d.js +20 -0
- package/dist/json-schema/settings.test-d.js.map +1 -0
- package/dist/lix-plugin/applyChanges.d.ts +3 -0
- package/dist/lix-plugin/applyChanges.d.ts.map +1 -0
- package/dist/lix-plugin/applyChanges.js +127 -0
- package/dist/lix-plugin/applyChanges.js.map +1 -0
- package/dist/lix-plugin/applyChanges.test.d.ts +2 -0
- package/dist/lix-plugin/applyChanges.test.d.ts.map +1 -0
- package/dist/lix-plugin/applyChanges.test.js +135 -0
- package/dist/lix-plugin/applyChanges.test.js.map +1 -0
- package/dist/lix-plugin/detectConflicts.d.ts +3 -0
- package/dist/lix-plugin/detectConflicts.d.ts.map +1 -0
- package/dist/lix-plugin/detectConflicts.js +47 -0
- package/dist/lix-plugin/detectConflicts.js.map +1 -0
- package/dist/lix-plugin/detectConflicts.test.d.ts +2 -0
- package/dist/lix-plugin/detectConflicts.test.d.ts.map +1 -0
- package/dist/lix-plugin/detectConflicts.test.js +251 -0
- package/dist/lix-plugin/detectConflicts.test.js.map +1 -0
- package/dist/lix-plugin/inlangLixPluginV1.d.ts +8 -0
- package/dist/lix-plugin/inlangLixPluginV1.d.ts.map +1 -0
- package/dist/lix-plugin/inlangLixPluginV1.js +109 -0
- package/dist/lix-plugin/inlangLixPluginV1.js.map +1 -0
- package/dist/lix-plugin/inlangLixPluginV1.test.d.ts +2 -0
- package/dist/lix-plugin/inlangLixPluginV1.test.d.ts.map +1 -0
- package/dist/lix-plugin/inlangLixPluginV1.test.js +418 -0
- package/dist/lix-plugin/inlangLixPluginV1.test.js.map +1 -0
- package/dist/lix-plugin/merge.test.d.ts +2 -0
- package/dist/lix-plugin/merge.test.d.ts.map +1 -0
- package/dist/lix-plugin/merge.test.js +120 -0
- package/dist/lix-plugin/merge.test.js.map +1 -0
- package/dist/lix-plugin/resolveConflictBySelecting.test.d.ts +2 -0
- package/dist/lix-plugin/resolveConflictBySelecting.test.d.ts.map +1 -0
- package/dist/lix-plugin/resolveConflictBySelecting.test.js +176 -0
- package/dist/lix-plugin/resolveConflictBySelecting.test.js.map +1 -0
- package/dist/migrations/v2/createMessageV1.d.ts +28 -0
- package/dist/migrations/v2/createMessageV1.d.ts.map +1 -0
- package/dist/migrations/v2/createMessageV1.js +31 -0
- package/dist/migrations/v2/createMessageV1.js.map +1 -0
- package/dist/migrations/v2/withLanguageTagToLocaleMigration.d.ts +9 -0
- package/dist/migrations/v2/withLanguageTagToLocaleMigration.d.ts.map +1 -0
- package/dist/migrations/v2/withLanguageTagToLocaleMigration.js +31 -0
- package/dist/migrations/v2/withLanguageTagToLocaleMigration.js.map +1 -0
- package/dist/migrations/v2/withLanguageTagToLocaleMigration.test.d.ts +2 -0
- package/dist/migrations/v2/withLanguageTagToLocaleMigration.test.d.ts.map +1 -0
- package/dist/migrations/v2/withLanguageTagToLocaleMigration.test.js +45 -0
- package/dist/migrations/v2/withLanguageTagToLocaleMigration.test.js.map +1 -0
- package/dist/plugin/cache.d.ts +6 -0
- package/dist/plugin/cache.d.ts.map +1 -0
- package/dist/plugin/cache.js +59 -0
- package/dist/plugin/cache.js.map +1 -0
- package/dist/plugin/cache.test.d.ts +2 -0
- package/dist/plugin/cache.test.d.ts.map +1 -0
- package/dist/plugin/cache.test.js +61 -0
- package/dist/plugin/cache.test.js.map +1 -0
- package/dist/plugin/errors.d.ts +41 -0
- package/dist/plugin/errors.d.ts.map +1 -0
- package/dist/plugin/errors.js +48 -0
- package/dist/plugin/errors.js.map +1 -0
- package/dist/plugin/importPlugins.d.ts +19 -0
- package/dist/plugin/importPlugins.d.ts.map +1 -0
- package/dist/plugin/importPlugins.js +43 -0
- package/dist/plugin/importPlugins.js.map +1 -0
- package/dist/plugin/importPlugins.test.d.ts +2 -0
- package/dist/plugin/importPlugins.test.d.ts.map +1 -0
- package/dist/plugin/importPlugins.test.js +95 -0
- package/dist/plugin/importPlugins.test.js.map +1 -0
- package/dist/plugin/meta/ideExtension.d.ts +54 -0
- package/dist/plugin/meta/ideExtension.d.ts.map +1 -0
- package/dist/plugin/meta/ideExtension.js +5 -0
- package/dist/plugin/meta/ideExtension.js.map +1 -0
- package/dist/plugin/schema.d.ts +152 -0
- package/dist/plugin/schema.d.ts.map +1 -0
- package/dist/plugin/schema.js +5 -0
- package/dist/plugin/schema.js.map +1 -0
- package/dist/project/api.d.ts +74 -0
- package/dist/project/api.d.ts.map +1 -0
- package/dist/project/api.js +5 -0
- package/dist/project/api.js.map +1 -0
- package/dist/project/initHandleSaveToLixOnChange.d.ts +14 -0
- package/dist/project/initHandleSaveToLixOnChange.d.ts.map +1 -0
- package/dist/project/initHandleSaveToLixOnChange.js +87 -0
- package/dist/project/initHandleSaveToLixOnChange.js.map +1 -0
- package/dist/project/loadProject.d.ts +53 -0
- package/dist/project/loadProject.d.ts.map +1 -0
- package/dist/project/loadProject.js +167 -0
- package/dist/project/loadProject.js.map +1 -0
- package/dist/project/loadProject.test.d.ts.map +1 -0
- package/dist/project/loadProject.test.js +146 -0
- package/dist/project/loadProject.test.js.map +1 -0
- package/dist/project/loadProjectFromDirectory.d.ts +77 -0
- package/dist/project/loadProjectFromDirectory.d.ts.map +1 -0
- package/dist/project/loadProjectFromDirectory.js +584 -0
- package/dist/project/loadProjectFromDirectory.js.map +1 -0
- package/dist/project/loadProjectFromDirectory.test.d.ts +2 -0
- package/dist/project/loadProjectFromDirectory.test.d.ts.map +1 -0
- package/dist/project/loadProjectFromDirectory.test.js +663 -0
- package/dist/project/loadProjectFromDirectory.test.js.map +1 -0
- package/dist/project/loadProjectInMemory.d.ts +8 -0
- package/dist/project/loadProjectInMemory.d.ts.map +1 -0
- package/dist/project/loadProjectInMemory.js +32 -0
- package/dist/project/loadProjectInMemory.js.map +1 -0
- package/dist/project/loadProjectInMemory.test.d.ts +2 -0
- package/dist/project/loadProjectInMemory.test.d.ts.map +1 -0
- package/dist/project/loadProjectInMemory.test.js +27 -0
- package/dist/project/loadProjectInMemory.test.js.map +1 -0
- package/dist/project/maybeCaptureTelemetry.d.ts +13 -0
- package/dist/project/maybeCaptureTelemetry.d.ts.map +1 -0
- package/dist/project/maybeCaptureTelemetry.js +53 -0
- package/dist/project/maybeCaptureTelemetry.js.map +1 -0
- package/dist/project/maybeCaptureTelemetry.test.d.ts +2 -0
- package/dist/project/maybeCaptureTelemetry.test.d.ts.map +1 -0
- package/dist/project/maybeCaptureTelemetry.test.js +65 -0
- package/dist/project/maybeCaptureTelemetry.test.js.map +1 -0
- package/dist/project/newProject.d.ts +17 -0
- package/dist/project/newProject.d.ts.map +1 -0
- package/dist/project/newProject.js +71 -0
- package/dist/project/newProject.js.map +1 -0
- package/dist/project/newProject.test.d.ts +2 -0
- package/dist/project/newProject.test.d.ts.map +1 -0
- package/dist/project/newProject.test.js +37 -0
- package/dist/project/newProject.test.js.map +1 -0
- package/dist/project/saveProjectToDirectory.d.ts +8 -0
- package/dist/project/saveProjectToDirectory.d.ts.map +1 -0
- package/dist/project/saveProjectToDirectory.js +86 -0
- package/dist/project/saveProjectToDirectory.js.map +1 -0
- package/dist/project/saveProjectToDirectory.test.d.ts +2 -0
- package/dist/project/saveProjectToDirectory.test.d.ts.map +1 -0
- package/dist/project/saveProjectToDirectory.test.js +245 -0
- package/dist/project/saveProjectToDirectory.test.js.map +1 -0
- package/dist/project/state/id$.d.ts +6 -0
- package/dist/project/state/id$.d.ts.map +1 -0
- package/dist/project/state/id$.js +19 -0
- package/dist/project/state/id$.js.map +1 -0
- package/dist/project/state/id$.test.d.ts +2 -0
- package/dist/project/state/id$.test.d.ts.map +1 -0
- package/dist/project/state/id$.test.js +36 -0
- package/dist/project/state/id$.test.js.map +1 -0
- package/dist/project/state/setSettings.d.ts +7 -0
- package/dist/project/state/setSettings.d.ts.map +1 -0
- package/dist/project/state/setSettings.js +16 -0
- package/dist/project/state/setSettings.js.map +1 -0
- package/dist/project/state/setSettings.test.d.ts +2 -0
- package/dist/project/state/setSettings.test.d.ts.map +1 -0
- package/dist/project/state/setSettings.test.js +58 -0
- package/dist/project/state/setSettings.test.js.map +1 -0
- package/dist/project/state/settings$.d.ts +7 -0
- package/dist/project/state/settings$.d.ts.map +1 -0
- package/dist/project/state/settings$.js +21 -0
- package/dist/project/state/settings$.js.map +1 -0
- package/dist/project/state/settings$.test.d.ts +2 -0
- package/dist/project/state/settings$.test.d.ts.map +1 -0
- package/dist/project/state/settings$.test.js +51 -0
- package/dist/project/state/settings$.test.js.map +1 -0
- package/dist/project/state/state.d.ts +58 -0
- package/dist/project/state/state.d.ts.map +1 -0
- package/dist/project/state/state.js +67 -0
- package/dist/project/state/state.js.map +1 -0
- package/dist/project/state/state.test.d.ts +2 -0
- package/dist/project/state/state.test.d.ts.map +1 -0
- package/dist/project/state/state.test.js +103 -0
- package/dist/project/state/state.test.js.map +1 -0
- package/dist/query-utilities/index.d.ts +5 -0
- package/dist/query-utilities/index.d.ts.map +1 -0
- package/dist/query-utilities/index.js +8 -0
- package/dist/query-utilities/index.js.map +1 -0
- package/dist/query-utilities/insertBundleNested.d.ts +4 -0
- package/dist/query-utilities/insertBundleNested.d.ts.map +1 -0
- package/dist/query-utilities/insertBundleNested.js +39 -0
- package/dist/query-utilities/insertBundleNested.js.map +1 -0
- package/dist/query-utilities/pollQuery.d.ts +14 -0
- package/dist/query-utilities/pollQuery.d.ts.map +1 -0
- package/dist/query-utilities/pollQuery.js +22 -0
- package/dist/query-utilities/pollQuery.js.map +1 -0
- package/dist/query-utilities/pollQuery.test.d.ts +2 -0
- package/dist/query-utilities/pollQuery.test.d.ts.map +1 -0
- package/dist/query-utilities/pollQuery.test.js +67 -0
- package/dist/query-utilities/pollQuery.test.js.map +1 -0
- package/dist/query-utilities/selectBundleNested.d.ts +107 -0
- package/dist/query-utilities/selectBundleNested.d.ts.map +1 -0
- package/dist/query-utilities/selectBundleNested.js +43 -0
- package/dist/query-utilities/selectBundleNested.js.map +1 -0
- package/dist/query-utilities/updateBundleNested.d.ts +12 -0
- package/dist/query-utilities/updateBundleNested.d.ts.map +1 -0
- package/dist/query-utilities/updateBundleNested.js +25 -0
- package/dist/query-utilities/updateBundleNested.js.map +1 -0
- package/dist/query-utilities/upsertBundleNested.d.ts +4 -0
- package/dist/query-utilities/upsertBundleNested.d.ts.map +1 -0
- package/dist/query-utilities/upsertBundleNested.js +50 -0
- package/dist/query-utilities/upsertBundleNested.js.map +1 -0
- package/dist/services/env-variables/index.d.ts +6 -0
- package/dist/services/env-variables/index.d.ts.map +1 -0
- package/dist/services/env-variables/index.js +9 -0
- package/dist/services/env-variables/index.js.map +1 -0
- package/dist/services/error-reporting/index.d.ts +15 -0
- package/dist/services/error-reporting/index.d.ts.map +1 -0
- package/dist/services/error-reporting/index.js +30 -0
- package/dist/services/error-reporting/index.js.map +1 -0
- package/dist/{telemetry → services/telemetry}/capture.d.ts +4 -2
- package/dist/services/telemetry/capture.d.ts.map +1 -0
- package/dist/services/telemetry/capture.js +77 -0
- package/dist/services/telemetry/capture.js.map +1 -0
- package/dist/services/telemetry/capture.test.d.ts +2 -0
- package/dist/services/telemetry/capture.test.d.ts.map +1 -0
- package/dist/services/telemetry/capture.test.js +44 -0
- package/dist/services/telemetry/capture.test.js.map +1 -0
- package/dist/utilities/detectJsonFormatting.d.ts +11 -0
- package/dist/utilities/detectJsonFormatting.d.ts.map +1 -0
- package/dist/utilities/detectJsonFormatting.js +83 -0
- package/dist/utilities/detectJsonFormatting.js.map +1 -0
- package/dist/utilities/detectJsonFormatting.test.d.ts +2 -0
- package/dist/utilities/detectJsonFormatting.test.d.ts.map +1 -0
- package/dist/utilities/detectJsonFormatting.test.js +33 -0
- package/dist/utilities/detectJsonFormatting.test.js.map +1 -0
- package/package.json +32 -40
- package/src/database/initDb.ts +34 -0
- package/src/database/initDbAndSchema.test.ts +125 -0
- package/src/database/jsonbPlugin.test.ts +154 -0
- package/src/database/jsonbPlugin.ts +215 -0
- package/src/database/schema.ts +127 -0
- package/src/helper.ts +113 -0
- package/src/human-id/human-id.ts +14 -0
- package/src/{storage/human-id → human-id}/words.test.ts +14 -14
- package/src/{storage/human-id → human-id}/words.ts +4 -4
- package/src/import-export/exportFiles.ts +36 -0
- package/src/import-export/importFiles.test.ts +211 -0
- package/src/import-export/importFiles.ts +142 -0
- package/src/import-export/roundtrip.test.ts +313 -0
- package/src/import-export/upsertBundleNestedMatchByProperties.ts +74 -0
- package/src/index.ts +29 -37
- package/src/json-schema/old-v1-message/README.md +1 -0
- package/src/json-schema/old-v1-message/fromMessageV1.test.ts +87 -0
- package/src/json-schema/old-v1-message/fromMessageV1.ts +99 -0
- package/src/json-schema/old-v1-message/schemaV1.ts +66 -0
- package/src/json-schema/old-v1-message/toMessageV1.test.ts +87 -0
- package/src/json-schema/old-v1-message/toMessageV1.ts +79 -0
- package/src/json-schema/pattern.ts +59 -0
- package/src/json-schema/settings.test-d.ts +21 -0
- package/src/json-schema/settings.ts +138 -0
- package/src/lix-plugin/applyChanges.test.ts +150 -0
- package/src/lix-plugin/applyChanges.ts +171 -0
- package/src/lix-plugin/detectConflicts.test.ts +286 -0
- package/src/lix-plugin/detectConflicts.ts +62 -0
- package/src/lix-plugin/inlangLixPluginV1.test.ts +439 -0
- package/src/lix-plugin/inlangLixPluginV1.ts +132 -0
- package/src/lix-plugin/merge.test.ts +133 -0
- package/src/lix-plugin/resolveConflictBySelecting.test.ts +188 -0
- package/src/migrations/v2/createMessageV1.ts +37 -0
- package/src/migrations/v2/withLanguageTagToLocaleMigration.test.ts +51 -0
- package/src/migrations/v2/withLanguageTagToLocaleMigration.ts +31 -0
- package/src/plugin/cache.test.ts +83 -0
- package/src/plugin/cache.ts +79 -0
- package/src/plugin/errors.ts +67 -0
- package/src/plugin/importPlugins.test.ts +107 -0
- package/src/plugin/importPlugins.ts +60 -0
- package/src/plugin/meta/ideExtension.ts +56 -0
- package/src/plugin/schema.ts +165 -0
- package/src/project/api.ts +77 -0
- package/src/project/initHandleSaveToLixOnChange.ts +93 -0
- package/src/project/loadProject.test.ts +177 -0
- package/src/project/loadProject.ts +245 -0
- package/src/project/loadProjectFromDirectory.test.ts +854 -0
- package/src/project/loadProjectFromDirectory.ts +752 -0
- package/src/project/loadProjectInMemory.test.ts +29 -0
- package/src/project/loadProjectInMemory.ts +36 -0
- package/src/project/maybeCaptureTelemetry.test.ts +72 -0
- package/src/project/maybeCaptureTelemetry.ts +61 -0
- package/src/project/newProject.test.ts +36 -0
- package/src/project/newProject.ts +78 -0
- package/src/project/saveProjectToDirectory.test.ts +310 -0
- package/src/project/saveProjectToDirectory.ts +100 -0
- package/src/query-utilities/index.ts +4 -0
- package/src/query-utilities/insertBundleNested.ts +46 -0
- package/src/query-utilities/selectBundleNested.ts +46 -0
- package/src/query-utilities/updateBundleNested.ts +35 -0
- package/src/query-utilities/upsertBundleNested.ts +61 -0
- package/src/services/env-variables/createIndexFile.js +40 -0
- package/src/{env-variables → services/env-variables}/index.d.ts +8 -5
- package/src/services/error-reporting/index.ts +28 -0
- package/src/services/telemetry/capture.test.ts +48 -0
- package/src/services/telemetry/capture.ts +98 -0
- package/src/utilities/detectJsonFormatting.test.ts +38 -0
- package/src/utilities/detectJsonFormatting.ts +109 -0
- package/dist/adapter/solidAdapter.d.ts +0 -33
- package/dist/adapter/solidAdapter.d.ts.map +0 -1
- package/dist/adapter/solidAdapter.js +0 -40
- package/dist/adapter/solidAdapter.test.d.ts +0 -2
- package/dist/adapter/solidAdapter.test.d.ts.map +0 -1
- package/dist/adapter/solidAdapter.test.js +0 -356
- package/dist/api.d.ts +0 -113
- package/dist/api.d.ts.map +0 -1
- package/dist/api.js +0 -1
- package/dist/api.test-d.d.ts +0 -2
- package/dist/api.test-d.d.ts.map +0 -1
- package/dist/api.test-d.js +0 -4
- package/dist/createMessageLintReportsQuery.d.ts +0 -12
- package/dist/createMessageLintReportsQuery.d.ts.map +0 -1
- package/dist/createMessageLintReportsQuery.js +0 -176
- package/dist/createMessagesQuery.d.ts +0 -19
- package/dist/createMessagesQuery.d.ts.map +0 -1
- package/dist/createMessagesQuery.js +0 -451
- package/dist/createMessagesQuery.test.d.ts +0 -2
- package/dist/createMessagesQuery.test.d.ts.map +0 -1
- package/dist/createMessagesQuery.test.js +0 -402
- package/dist/createNewProject.d.ts +0 -12
- package/dist/createNewProject.d.ts.map +0 -1
- package/dist/createNewProject.js +0 -38
- package/dist/createNewProject.test.d.ts +0 -2
- package/dist/createNewProject.test.d.ts.map +0 -1
- package/dist/createNewProject.test.js +0 -91
- package/dist/createNodeishFsWithAbsolutePaths.d.ts +0 -12
- package/dist/createNodeishFsWithAbsolutePaths.d.ts.map +0 -1
- package/dist/createNodeishFsWithAbsolutePaths.js +0 -38
- package/dist/createNodeishFsWithAbsolutePaths.test.d.ts +0 -2
- package/dist/createNodeishFsWithAbsolutePaths.test.d.ts.map +0 -1
- package/dist/createNodeishFsWithAbsolutePaths.test.js +0 -44
- package/dist/createNodeishFsWithWatcher.d.ts +0 -14
- package/dist/createNodeishFsWithWatcher.d.ts.map +0 -1
- package/dist/createNodeishFsWithWatcher.js +0 -75
- package/dist/createNodeishFsWithWatcher.test.d.ts +0 -2
- package/dist/createNodeishFsWithWatcher.test.d.ts.map +0 -1
- package/dist/createNodeishFsWithWatcher.test.js +0 -38
- package/dist/defaultProjectSettings.d.ts +0 -14
- package/dist/defaultProjectSettings.d.ts.map +0 -1
- package/dist/defaultProjectSettings.js +0 -22
- package/dist/env-variables/index.d.ts +0 -4
- package/dist/env-variables/index.d.ts.map +0 -1
- package/dist/env-variables/index.js +0 -3
- package/dist/errors.d.ts +0 -48
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -62
- package/dist/lint/index.d.ts +0 -3
- package/dist/lint/index.d.ts.map +0 -1
- package/dist/lint/index.js +0 -2
- package/dist/lint/message/errors.d.ts +0 -7
- package/dist/lint/message/errors.d.ts.map +0 -1
- package/dist/lint/message/errors.js +0 -9
- package/dist/lint/message/lintMessages.d.ts +0 -13
- package/dist/lint/message/lintMessages.d.ts.map +0 -1
- package/dist/lint/message/lintMessages.js +0 -12
- package/dist/lint/message/lintMessages.test.d.ts +0 -2
- package/dist/lint/message/lintMessages.test.d.ts.map +0 -1
- package/dist/lint/message/lintMessages.test.js +0 -107
- package/dist/lint/message/lintSingleMessage.d.ts +0 -19
- package/dist/lint/message/lintSingleMessage.d.ts.map +0 -1
- package/dist/lint/message/lintSingleMessage.js +0 -38
- package/dist/lint/message/lintSingleMessage.test.d.ts +0 -2
- package/dist/lint/message/lintSingleMessage.test.d.ts.map +0 -1
- package/dist/lint/message/lintSingleMessage.test.js +0 -161
- package/dist/listProjects.d.ts +0 -5
- package/dist/listProjects.d.ts.map +0 -1
- package/dist/listProjects.js +0 -38
- package/dist/listProjects.test.d.ts +0 -2
- package/dist/listProjects.test.d.ts.map +0 -1
- package/dist/listProjects.test.js +0 -72
- package/dist/loadProject.d.ts +0 -19
- package/dist/loadProject.d.ts.map +0 -1
- package/dist/loadProject.js +0 -343
- package/dist/loadProject.test.d.ts.map +0 -1
- package/dist/loadProject.test.js +0 -975
- package/dist/messages/errors.d.ts +0 -13
- package/dist/messages/errors.d.ts.map +0 -1
- package/dist/messages/errors.js +0 -18
- package/dist/messages/index.d.ts +0 -3
- package/dist/messages/index.d.ts.map +0 -1
- package/dist/messages/index.js +0 -2
- package/dist/messages/variant.d.ts +0 -46
- package/dist/messages/variant.d.ts.map +0 -1
- package/dist/messages/variant.js +0 -176
- package/dist/messages/variant.test.d.ts +0 -2
- package/dist/messages/variant.test.d.ts.map +0 -1
- package/dist/messages/variant.test.js +0 -439
- package/dist/migrations/maybeAddModuleCache.d.ts +0 -6
- package/dist/migrations/maybeAddModuleCache.d.ts.map +0 -1
- package/dist/migrations/maybeAddModuleCache.js +0 -62
- package/dist/migrations/maybeCreateFirstProjectId.d.ts +0 -16
- package/dist/migrations/maybeCreateFirstProjectId.d.ts.map +0 -1
- package/dist/migrations/maybeCreateFirstProjectId.js +0 -46
- package/dist/migrations/maybeCreateFirstProjectId.test.d.ts +0 -2
- package/dist/migrations/maybeCreateFirstProjectId.test.d.ts.map +0 -1
- package/dist/migrations/maybeCreateFirstProjectId.test.js +0 -24
- package/dist/migrations/migrateToDirectory.d.ts +0 -10
- package/dist/migrations/migrateToDirectory.d.ts.map +0 -1
- package/dist/migrations/migrateToDirectory.js +0 -48
- package/dist/migrations/migrateToDirectory.test.d.ts +0 -2
- package/dist/migrations/migrateToDirectory.test.d.ts.map +0 -1
- package/dist/migrations/migrateToDirectory.test.js +0 -48
- package/dist/parseConfig.d.ts +0 -8
- package/dist/parseConfig.d.ts.map +0 -1
- package/dist/parseConfig.js +0 -26
- package/dist/persistence/batchedIO.d.ts +0 -11
- package/dist/persistence/batchedIO.d.ts.map +0 -1
- package/dist/persistence/batchedIO.js +0 -49
- package/dist/persistence/batchedIO.test.d.ts +0 -2
- package/dist/persistence/batchedIO.test.d.ts.map +0 -1
- package/dist/persistence/batchedIO.test.js +0 -56
- package/dist/persistence/filelock/acquireFileLock.d.ts +0 -3
- package/dist/persistence/filelock/acquireFileLock.d.ts.map +0 -1
- package/dist/persistence/filelock/acquireFileLock.js +0 -111
- package/dist/persistence/filelock/releaseLock.d.ts +0 -3
- package/dist/persistence/filelock/releaseLock.d.ts.map +0 -1
- package/dist/persistence/filelock/releaseLock.js +0 -24
- package/dist/persistence/store.d.ts +0 -107
- package/dist/persistence/store.d.ts.map +0 -1
- package/dist/persistence/store.js +0 -99
- package/dist/persistence/store.test.d.ts +0 -2
- package/dist/persistence/store.test.d.ts.map +0 -1
- package/dist/persistence/store.test.js +0 -79
- package/dist/persistence/storeApi.d.ts +0 -22
- package/dist/persistence/storeApi.d.ts.map +0 -1
- package/dist/persistence/storeApi.js +0 -1
- package/dist/reactivity/map.d.ts +0 -67
- package/dist/reactivity/map.d.ts.map +0 -1
- package/dist/reactivity/map.js +0 -143
- package/dist/reactivity/solid.d.ts +0 -14
- package/dist/reactivity/solid.d.ts.map +0 -1
- package/dist/reactivity/solid.js +0 -15
- package/dist/reactivity/solid.test.d.ts +0 -2
- package/dist/reactivity/solid.test.d.ts.map +0 -1
- package/dist/reactivity/solid.test.js +0 -189
- package/dist/reactivity/trigger.d.ts +0 -11
- package/dist/reactivity/trigger.d.ts.map +0 -1
- package/dist/reactivity/trigger.js +0 -46
- package/dist/resolve-modules/cache.d.ts +0 -6
- package/dist/resolve-modules/cache.d.ts.map +0 -1
- package/dist/resolve-modules/cache.js +0 -58
- package/dist/resolve-modules/errors.d.ts +0 -41
- package/dist/resolve-modules/errors.d.ts.map +0 -1
- package/dist/resolve-modules/errors.js +0 -45
- package/dist/resolve-modules/import.d.ts +0 -19
- package/dist/resolve-modules/import.d.ts.map +0 -1
- package/dist/resolve-modules/import.js +0 -102
- package/dist/resolve-modules/import.test.d.ts +0 -2
- package/dist/resolve-modules/import.test.d.ts.map +0 -1
- package/dist/resolve-modules/import.test.js +0 -47
- package/dist/resolve-modules/index.d.ts +0 -3
- package/dist/resolve-modules/index.d.ts.map +0 -1
- package/dist/resolve-modules/index.js +0 -2
- package/dist/resolve-modules/message-lint-rules/errors.d.ts +0 -9
- package/dist/resolve-modules/message-lint-rules/errors.d.ts.map +0 -1
- package/dist/resolve-modules/message-lint-rules/errors.js +0 -6
- package/dist/resolve-modules/message-lint-rules/resolveMessageLintRules.d.ts +0 -9
- package/dist/resolve-modules/message-lint-rules/resolveMessageLintRules.d.ts.map +0 -1
- package/dist/resolve-modules/message-lint-rules/resolveMessageLintRules.js +0 -24
- package/dist/resolve-modules/plugins/errors.d.ts +0 -33
- package/dist/resolve-modules/plugins/errors.d.ts.map +0 -1
- package/dist/resolve-modules/plugins/errors.js +0 -38
- package/dist/resolve-modules/plugins/resolvePlugins.d.ts +0 -3
- package/dist/resolve-modules/plugins/resolvePlugins.d.ts.map +0 -1
- package/dist/resolve-modules/plugins/resolvePlugins.js +0 -92
- package/dist/resolve-modules/plugins/resolvePlugins.test.d.ts +0 -2
- package/dist/resolve-modules/plugins/resolvePlugins.test.d.ts.map +0 -1
- package/dist/resolve-modules/plugins/resolvePlugins.test.js +0 -252
- package/dist/resolve-modules/plugins/types.d.ts +0 -57
- package/dist/resolve-modules/plugins/types.d.ts.map +0 -1
- package/dist/resolve-modules/plugins/types.js +0 -1
- package/dist/resolve-modules/plugins/types.test.d.ts +0 -2
- package/dist/resolve-modules/plugins/types.test.d.ts.map +0 -1
- package/dist/resolve-modules/plugins/types.test.js +0 -45
- package/dist/resolve-modules/resolveModules.d.ts +0 -3
- package/dist/resolve-modules/resolveModules.d.ts.map +0 -1
- package/dist/resolve-modules/resolveModules.js +0 -80
- package/dist/resolve-modules/resolveModules.test.d.ts +0 -2
- package/dist/resolve-modules/resolveModules.test.d.ts.map +0 -1
- package/dist/resolve-modules/resolveModules.test.js +0 -185
- package/dist/resolve-modules/types.d.ts +0 -63
- package/dist/resolve-modules/types.d.ts.map +0 -1
- package/dist/resolve-modules/types.js +0 -1
- package/dist/resolve-modules/validateModuleSettings.test.d.ts +0 -2
- package/dist/resolve-modules/validateModuleSettings.test.d.ts.map +0 -1
- package/dist/resolve-modules/validateModuleSettings.test.js +0 -71
- package/dist/resolve-modules/validatedModuleSettings.d.ts +0 -7
- package/dist/resolve-modules/validatedModuleSettings.d.ts.map +0 -1
- package/dist/resolve-modules/validatedModuleSettings.js +0 -11
- package/dist/storage/helper.d.ts +0 -11
- package/dist/storage/helper.d.ts.map +0 -1
- package/dist/storage/helper.js +0 -63
- package/dist/storage/helpers.test.d.ts +0 -2
- package/dist/storage/helpers.test.d.ts.map +0 -1
- package/dist/storage/helpers.test.js +0 -84
- package/dist/storage/human-id/human-readable-id.d.ts +0 -3
- package/dist/storage/human-id/human-readable-id.d.ts.map +0 -1
- package/dist/storage/human-id/human-readable-id.js +0 -20
- package/dist/storage/human-id/words.d.ts.map +0 -1
- package/dist/storage/human-id/words.test.d.ts.map +0 -1
- package/dist/telemetry/capture.d.ts.map +0 -1
- package/dist/telemetry/capture.js +0 -39
- package/dist/telemetry/groupIdentify.d.ts +0 -13
- package/dist/telemetry/groupIdentify.d.ts.map +0 -1
- package/dist/telemetry/groupIdentify.js +0 -35
- package/dist/test-utilities/createMessage.d.ts +0 -18
- package/dist/test-utilities/createMessage.d.ts.map +0 -1
- package/dist/test-utilities/createMessage.js +0 -17
- package/dist/test-utilities/createMessage.test.d.ts +0 -2
- package/dist/test-utilities/createMessage.test.d.ts.map +0 -1
- package/dist/test-utilities/createMessage.test.js +0 -106
- package/dist/test-utilities/index.d.ts +0 -3
- package/dist/test-utilities/index.d.ts.map +0 -1
- package/dist/test-utilities/index.js +0 -2
- package/dist/test-utilities/sleep.d.ts +0 -4
- package/dist/test-utilities/sleep.d.ts.map +0 -1
- package/dist/test-utilities/sleep.js +0 -9
- package/dist/v2/helper.d.ts +0 -43
- package/dist/v2/helper.d.ts.map +0 -1
- package/dist/v2/helper.js +0 -75
- package/dist/v2/helper.test.d.ts +0 -2
- package/dist/v2/helper.test.d.ts.map +0 -1
- package/dist/v2/helper.test.js +0 -92
- package/dist/v2/index.d.ts +0 -4
- package/dist/v2/index.d.ts.map +0 -1
- package/dist/v2/index.js +0 -2
- package/dist/v2/mocks/index.d.ts +0 -3
- package/dist/v2/mocks/index.d.ts.map +0 -1
- package/dist/v2/mocks/index.js +0 -2
- package/dist/v2/mocks/multipleMatcher/bundle.d.ts +0 -3
- package/dist/v2/mocks/multipleMatcher/bundle.d.ts.map +0 -1
- package/dist/v2/mocks/multipleMatcher/bundle.js +0 -194
- package/dist/v2/mocks/multipleMatcher/bundle.test.d.ts +0 -2
- package/dist/v2/mocks/multipleMatcher/bundle.test.d.ts.map +0 -1
- package/dist/v2/mocks/multipleMatcher/bundle.test.js +0 -10
- package/dist/v2/mocks/plural/bundle.d.ts +0 -3
- package/dist/v2/mocks/plural/bundle.d.ts.map +0 -1
- package/dist/v2/mocks/plural/bundle.js +0 -162
- package/dist/v2/mocks/plural/bundle.test.d.ts +0 -2
- package/dist/v2/mocks/plural/bundle.test.d.ts.map +0 -1
- package/dist/v2/mocks/plural/bundle.test.js +0 -15
- package/dist/v2/shim.d.ts +0 -12
- package/dist/v2/shim.d.ts.map +0 -1
- package/dist/v2/shim.js +0 -151
- package/dist/v2/shim.test.d.ts +0 -2
- package/dist/v2/shim.test.d.ts.map +0 -1
- package/dist/v2/shim.test.js +0 -49
- package/dist/v2/stubQueryApi.d.ts +0 -9
- package/dist/v2/stubQueryApi.d.ts.map +0 -1
- package/dist/v2/stubQueryApi.js +0 -38
- package/dist/v2/types.d.ts +0 -521
- package/dist/v2/types.d.ts.map +0 -1
- package/dist/v2/types.js +0 -78
- package/dist/validateProjectPath.d.ts +0 -17
- package/dist/validateProjectPath.d.ts.map +0 -1
- package/dist/validateProjectPath.js +0 -31
- package/dist/validateProjectPath.test.d.ts +0 -2
- package/dist/validateProjectPath.test.d.ts.map +0 -1
- package/dist/validateProjectPath.test.js +0 -40
- package/dist/versionedInterfaces.d.ts +0 -8
- package/dist/versionedInterfaces.d.ts.map +0 -1
- package/dist/versionedInterfaces.js +0 -8
- package/src/adapter/solidAdapter.test.ts +0 -472
- package/src/adapter/solidAdapter.ts +0 -79
- package/src/api.test-d.ts +0 -8
- package/src/api.ts +0 -116
- package/src/createMessageLintReportsQuery.ts +0 -225
- package/src/createMessagesQuery.test.ts +0 -538
- package/src/createMessagesQuery.ts +0 -635
- package/src/createNewProject.test.ts +0 -105
- package/src/createNewProject.ts +0 -46
- package/src/createNodeishFsWithAbsolutePaths.test.ts +0 -55
- package/src/createNodeishFsWithAbsolutePaths.ts +0 -52
- package/src/createNodeishFsWithWatcher.test.ts +0 -50
- package/src/createNodeishFsWithWatcher.ts +0 -85
- package/src/defaultProjectSettings.ts +0 -26
- package/src/env-variables/.prettierignore +0 -1
- package/src/env-variables/createIndexFile.js +0 -28
- package/src/errors.ts +0 -84
- package/src/lint/index.ts +0 -2
- package/src/lint/message/errors.ts +0 -9
- package/src/lint/message/lintMessages.test.ts +0 -126
- package/src/lint/message/lintMessages.ts +0 -25
- package/src/lint/message/lintSingleMessage.test.ts +0 -191
- package/src/lint/message/lintSingleMessage.ts +0 -57
- package/src/listProjects.test.ts +0 -91
- package/src/listProjects.ts +0 -48
- package/src/loadProject.test.ts +0 -1173
- package/src/loadProject.ts +0 -460
- package/src/messages/errors.ts +0 -25
- package/src/messages/index.ts +0 -2
- package/src/messages/variant.test.ts +0 -511
- package/src/messages/variant.ts +0 -247
- package/src/migrations/maybeAddModuleCache.ts +0 -68
- package/src/migrations/maybeCreateFirstProjectId.test.ts +0 -31
- package/src/migrations/maybeCreateFirstProjectId.ts +0 -51
- package/src/migrations/migrateToDirectory.test.ts +0 -54
- package/src/migrations/migrateToDirectory.ts +0 -62
- package/src/parseConfig.ts +0 -35
- package/src/persistence/batchedIO.test.ts +0 -63
- package/src/persistence/batchedIO.ts +0 -64
- package/src/persistence/filelock/acquireFileLock.ts +0 -129
- package/src/persistence/filelock/releaseLock.ts +0 -29
- package/src/persistence/store.test.ts +0 -102
- package/src/persistence/store.ts +0 -119
- package/src/persistence/storeApi.ts +0 -19
- package/src/reactivity/map.ts +0 -135
- package/src/reactivity/solid.test.ts +0 -222
- package/src/reactivity/solid.ts +0 -42
- package/src/reactivity/trigger.ts +0 -46
- package/src/resolve-modules/cache.ts +0 -89
- package/src/resolve-modules/errors.ts +0 -69
- package/src/resolve-modules/import.test.ts +0 -62
- package/src/resolve-modules/import.ts +0 -133
- package/src/resolve-modules/index.ts +0 -2
- package/src/resolve-modules/message-lint-rules/errors.ts +0 -9
- package/src/resolve-modules/message-lint-rules/resolveMessageLintRules.ts +0 -27
- package/src/resolve-modules/plugins/errors.ts +0 -56
- package/src/resolve-modules/plugins/resolvePlugins.test.ts +0 -301
- package/src/resolve-modules/plugins/resolvePlugins.ts +0 -129
- package/src/resolve-modules/plugins/types.test.ts +0 -53
- package/src/resolve-modules/plugins/types.ts +0 -76
- package/src/resolve-modules/resolveModules.test.ts +0 -224
- package/src/resolve-modules/resolveModules.ts +0 -113
- package/src/resolve-modules/types.ts +0 -72
- package/src/resolve-modules/validateModuleSettings.test.ts +0 -85
- package/src/resolve-modules/validatedModuleSettings.ts +0 -19
- package/src/storage/helper.ts +0 -74
- package/src/storage/helpers.test.ts +0 -95
- package/src/storage/human-id/human-readable-id.ts +0 -27
- package/src/telemetry/capture.ts +0 -49
- package/src/telemetry/groupIdentify.ts +0 -41
- package/src/test-utilities/createMessage.test.ts +0 -118
- package/src/test-utilities/createMessage.ts +0 -21
- package/src/test-utilities/index.ts +0 -2
- package/src/test-utilities/sleep.ts +0 -11
- package/src/v2/helper.test.ts +0 -95
- package/src/v2/helper.ts +0 -98
- package/src/v2/index.ts +0 -3
- package/src/v2/mocks/index.ts +0 -2
- package/src/v2/mocks/multipleMatcher/bundle.test.ts +0 -11
- package/src/v2/mocks/multipleMatcher/bundle.ts +0 -196
- package/src/v2/mocks/plural/bundle.test.ts +0 -18
- package/src/v2/mocks/plural/bundle.ts +0 -164
- package/src/v2/shim.test.ts +0 -56
- package/src/v2/shim.ts +0 -173
- package/src/v2/stubQueryApi.ts +0 -43
- package/src/v2/types.ts +0 -159
- package/src/validateProjectPath.test.ts +0 -50
- package/src/validateProjectPath.ts +0 -38
- package/src/versionedInterfaces.ts +0 -9
- /package/dist/{storage/human-id → human-id}/words.d.ts +0 -0
- /package/dist/{storage/human-id → human-id}/words.test.d.ts +0 -0
- /package/dist/{loadProject.test.d.ts → project/loadProject.test.d.ts} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,21 +1,24 @@
|
|
|
1
|
+
export { newProject } from "./project/newProject.js";
|
|
2
|
+
export { loadProjectInMemory } from "./project/loadProjectInMemory.js";
|
|
3
|
+
export { loadProjectFromDirectory,
|
|
1
4
|
/**
|
|
2
|
-
|
|
3
|
-
*!
|
|
4
|
-
*! EXPORT AS LITTLE AS POSSIBLE TO MINIMIZE THE CHANCE OF BREAKING CHANGES.
|
|
5
|
+
* @deprecated use `loadProjectFromDirectory()` instead (it's a rename)
|
|
5
6
|
*/
|
|
6
|
-
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
export
|
|
13
|
-
export
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
16
|
-
export {
|
|
17
|
-
export {
|
|
18
|
-
export
|
|
19
|
-
export * from "./
|
|
20
|
-
export
|
|
7
|
+
loadProjectFromDirectory as loadProjectFromDirectoryInMemory, } from "./project/loadProjectFromDirectory.js";
|
|
8
|
+
export { saveProjectToDirectory } from "./project/saveProjectToDirectory.js";
|
|
9
|
+
export type { InlangProject } from "./project/api.js";
|
|
10
|
+
export * from "./json-schema/settings.js";
|
|
11
|
+
export * from "./json-schema/pattern.js";
|
|
12
|
+
export * from "./helper.js";
|
|
13
|
+
export * from "./query-utilities/index.js";
|
|
14
|
+
export * from "./plugin/errors.js";
|
|
15
|
+
export { humanId } from "./human-id/human-id.js";
|
|
16
|
+
export type { InlangDatabaseSchema } from "./database/schema.js";
|
|
17
|
+
export type { ImportFile, ExportFile } from "./project/api.js";
|
|
18
|
+
export type { InlangPlugin, BundleImport, MessageImport, VariantImport, } from "./plugin/schema.js";
|
|
19
|
+
export type { IdeExtensionConfig } from "./plugin/meta/ideExtension.js";
|
|
20
|
+
export * from "./database/schema.js";
|
|
21
|
+
export * from "@lix-js/sdk";
|
|
22
|
+
export { createMessageV1 } from "./migrations/v2/createMessageV1.js";
|
|
23
|
+
export { v7 as uuidV7 } from "uuid";
|
|
21
24
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAEvE,OAAO,EACN,wBAAwB;AACxB;;GAEG;AACH,wBAAwB,IAAI,gCAAgC,GAC5D,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,YAAY,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,aAAa,CAAC;AAC5B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,YAAY,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC/D,YAAY,EACX,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,aAAa,GACb,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACxE,cAAc,sBAAsB,CAAC;AACrC,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,19 +1,22 @@
|
|
|
1
|
+
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="38386619-c225-5777-b3e6-7b50f41eb3d4")}catch(e){}}();
|
|
3
|
+
export { newProject } from "./project/newProject.js";
|
|
4
|
+
export { loadProjectInMemory } from "./project/loadProjectInMemory.js";
|
|
5
|
+
export { loadProjectFromDirectory,
|
|
1
6
|
/**
|
|
2
|
-
|
|
3
|
-
*!
|
|
4
|
-
*! EXPORT AS LITTLE AS POSSIBLE TO MINIMIZE THE CHANCE OF BREAKING CHANGES.
|
|
7
|
+
* @deprecated use `loadProjectFromDirectory()` instead (it's a rename)
|
|
5
8
|
*/
|
|
6
|
-
|
|
7
|
-
export {
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
export
|
|
13
|
-
export {
|
|
14
|
-
export
|
|
15
|
-
export
|
|
16
|
-
export {
|
|
17
|
-
export
|
|
18
|
-
|
|
19
|
-
|
|
9
|
+
loadProjectFromDirectory as loadProjectFromDirectoryInMemory, } from "./project/loadProjectFromDirectory.js";
|
|
10
|
+
export { saveProjectToDirectory } from "./project/saveProjectToDirectory.js";
|
|
11
|
+
export * from "./json-schema/settings.js";
|
|
12
|
+
export * from "./json-schema/pattern.js";
|
|
13
|
+
export * from "./helper.js";
|
|
14
|
+
export * from "./query-utilities/index.js";
|
|
15
|
+
export * from "./plugin/errors.js";
|
|
16
|
+
export { humanId } from "./human-id/human-id.js";
|
|
17
|
+
export * from "./database/schema.js";
|
|
18
|
+
export * from "@lix-js/sdk";
|
|
19
|
+
export { createMessageV1 } from "./migrations/v2/createMessageV1.js";
|
|
20
|
+
export { v7 as uuidV7 } from "uuid";
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
22
|
+
//# debugId=38386619-c225-5777-b3e6-7b50f41eb3d4
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["index.ts"],"sourceRoot":"/","sourcesContent":["export { newProject } from \"./project/newProject.js\";\nexport { loadProjectInMemory } from \"./project/loadProjectInMemory.js\";\n\nexport {\n\tloadProjectFromDirectory,\n\t/**\n\t * @deprecated use `loadProjectFromDirectory()` instead (it's a rename)\n\t */\n\tloadProjectFromDirectory as loadProjectFromDirectoryInMemory,\n} from \"./project/loadProjectFromDirectory.js\";\n\nexport { saveProjectToDirectory } from \"./project/saveProjectToDirectory.js\";\nexport type { InlangProject } from \"./project/api.js\";\nexport * from \"./json-schema/settings.js\";\nexport * from \"./json-schema/pattern.js\";\nexport * from \"./helper.js\";\nexport * from \"./query-utilities/index.js\";\nexport * from \"./plugin/errors.js\";\nexport { humanId } from \"./human-id/human-id.js\";\nexport type { InlangDatabaseSchema } from \"./database/schema.js\";\nexport type { ImportFile, ExportFile } from \"./project/api.js\";\nexport type {\n\tInlangPlugin,\n\tBundleImport,\n\tMessageImport,\n\tVariantImport,\n} from \"./plugin/schema.js\";\nexport type { IdeExtensionConfig } from \"./plugin/meta/ideExtension.js\";\nexport * from \"./database/schema.js\";\nexport * from \"@lix-js/sdk\";\nexport { createMessageV1 } from \"./migrations/v2/createMessageV1.js\";\nexport { v7 as uuidV7 } from \"uuid\";\n"],"names":[],"mappings":";;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAEvE,OAAO,EACN,wBAAwB;AACxB;;GAEG;AACH,wBAAwB,IAAI,gCAAgC,GAC5D,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAE7E,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,aAAa,CAAC;AAC5B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAUjD,cAAc,sBAAsB,CAAC;AACrC,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC","debug_id":"38386619-c225-5777-b3e6-7b50f41eb3d4"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { BundleNested } from "../../database/schema.js";
|
|
2
|
+
import type { MessageV1 } from "./schemaV1.js";
|
|
3
|
+
/**
|
|
4
|
+
* Converts a MessageV1 into a BundleNested
|
|
5
|
+
*
|
|
6
|
+
* @throws If the message cannot be represented in the v1 format
|
|
7
|
+
*/
|
|
8
|
+
export declare function fromMessageV1(messageV1: MessageV1): BundleNested;
|
|
9
|
+
//# sourceMappingURL=fromMessageV1.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fromMessageV1.d.ts","sourceRoot":"/","sources":["json-schema/old-v1-message/fromMessageV1.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,YAAY,EAGZ,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EAAE,SAAS,EAAa,MAAM,eAAe,CAAC;AAE1D;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,SAAS,GAAG,YAAY,CAiEhE"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts a MessageV1 into a BundleNested
|
|
3
|
+
*
|
|
4
|
+
* @throws If the message cannot be represented in the v1 format
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="45afe632-0d35-5194-9127-dda10133a680")}catch(e){}}();
|
|
8
|
+
export function fromMessageV1(messageV1) {
|
|
9
|
+
const bundleId = messageV1.id;
|
|
10
|
+
const languages = [
|
|
11
|
+
...new Set(messageV1.variants.map((variant) => variant.languageTag)),
|
|
12
|
+
];
|
|
13
|
+
const declarations = new Set();
|
|
14
|
+
const messages = languages.map((language) => {
|
|
15
|
+
const messageId = bundleId + "_" + language;
|
|
16
|
+
//All variants that will be part of this message
|
|
17
|
+
const v1Variants = messageV1.variants.filter((variant) => variant.languageTag === language);
|
|
18
|
+
//find all selector names
|
|
19
|
+
const selectorNames = new Set();
|
|
20
|
+
for (const v1Selector of messageV1.selectors ?? []) {
|
|
21
|
+
selectorNames.add(v1Selector.name);
|
|
22
|
+
}
|
|
23
|
+
//The set of variables that need to be defined - Certainly includes the selectors
|
|
24
|
+
const variableNames = new Set(selectorNames);
|
|
25
|
+
const variants = [];
|
|
26
|
+
let variantIndex = 1;
|
|
27
|
+
for (const v1Variant of v1Variants) {
|
|
28
|
+
for (const element of v1Variant.pattern) {
|
|
29
|
+
if (element.type === "VariableReference") {
|
|
30
|
+
variableNames.add(element.name);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
variants.push({
|
|
34
|
+
// matching was not supported. no problem should arise
|
|
35
|
+
matches: [],
|
|
36
|
+
pattern: fromPatternV1(v1Variant.pattern),
|
|
37
|
+
id: messageId + "_" + variantIndex,
|
|
38
|
+
messageId: messageId,
|
|
39
|
+
});
|
|
40
|
+
variantIndex += 1;
|
|
41
|
+
}
|
|
42
|
+
//Create an input declaration for each variable and selector we need
|
|
43
|
+
for (const variable of variableNames) {
|
|
44
|
+
declarations.add({
|
|
45
|
+
type: "input-variable",
|
|
46
|
+
name: variable,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
id: messageId,
|
|
51
|
+
bundleId: bundleId,
|
|
52
|
+
locale: language,
|
|
53
|
+
selectors: [],
|
|
54
|
+
variants,
|
|
55
|
+
};
|
|
56
|
+
});
|
|
57
|
+
return {
|
|
58
|
+
id: bundleId,
|
|
59
|
+
declarations: [...declarations],
|
|
60
|
+
messages,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function fromPatternV1(pattern) {
|
|
64
|
+
return pattern.map((element) => {
|
|
65
|
+
switch (element.type) {
|
|
66
|
+
case "Text": {
|
|
67
|
+
return {
|
|
68
|
+
type: "text",
|
|
69
|
+
value: element.value,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
case "VariableReference":
|
|
73
|
+
return {
|
|
74
|
+
type: "expression",
|
|
75
|
+
arg: {
|
|
76
|
+
type: "variable-reference",
|
|
77
|
+
name: element.name,
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=fromMessageV1.js.map
|
|
84
|
+
//# debugId=45afe632-0d35-5194-9127-dda10133a680
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fromMessageV1.js","sources":["json-schema/old-v1-message/fromMessageV1.ts"],"sourceRoot":"/","sourcesContent":["import type {\n\tBundleNested,\n\tMessageNested,\n\tVariant,\n} from \"../../database/schema.js\";\nimport type { Declaration, Pattern } from \"../pattern.js\";\nimport type { MessageV1, PatternV1 } from \"./schemaV1.js\";\n\n/**\n * Converts a MessageV1 into a BundleNested\n *\n * @throws If the message cannot be represented in the v1 format\n */\nexport function fromMessageV1(messageV1: MessageV1): BundleNested {\n\tconst bundleId = messageV1.id;\n\n\tconst languages = [\n\t\t...new Set(messageV1.variants.map((variant) => variant.languageTag)),\n\t];\n\n\tconst declarations = new Set<Declaration>();\n\n\tconst messages: MessageNested[] = languages.map((language): MessageNested => {\n\t\tconst messageId = bundleId + \"_\" + language;\n\t\t//All variants that will be part of this message\n\t\tconst v1Variants = messageV1.variants.filter(\n\t\t\t(variant) => variant.languageTag === language\n\t\t);\n\n\t\t//find all selector names\n\t\tconst selectorNames = new Set<string>();\n\t\tfor (const v1Selector of messageV1.selectors ?? []) {\n\t\t\tselectorNames.add(v1Selector.name);\n\t\t}\n\n\t\t//The set of variables that need to be defined - Certainly includes the selectors\n\t\tconst variableNames = new Set<string>(selectorNames);\n\t\tconst variants: Variant[] = [];\n\t\tlet variantIndex = 1;\n\t\tfor (const v1Variant of v1Variants) {\n\t\t\tfor (const element of v1Variant.pattern) {\n\t\t\t\tif (element.type === \"VariableReference\") {\n\t\t\t\t\tvariableNames.add(element.name);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvariants.push({\n\t\t\t\t// matching was not supported. no problem should arise\n\t\t\t\tmatches: [],\n\t\t\t\tpattern: fromPatternV1(v1Variant.pattern),\n\t\t\t\tid: messageId + \"_\" + variantIndex,\n\t\t\t\tmessageId: messageId,\n\t\t\t});\n\t\t\tvariantIndex += 1;\n\t\t}\n\n\t\t//Create an input declaration for each variable and selector we need\n\t\tfor (const variable of variableNames) {\n\t\t\tdeclarations.add({\n\t\t\t\ttype: \"input-variable\",\n\t\t\t\tname: variable,\n\t\t\t});\n\t\t}\n\n\t\treturn {\n\t\t\tid: messageId,\n\t\t\tbundleId: bundleId,\n\t\t\tlocale: language,\n\t\t\tselectors: [],\n\t\t\tvariants,\n\t\t};\n\t});\n\n\treturn {\n\t\tid: bundleId,\n\t\tdeclarations: [...declarations],\n\t\tmessages,\n\t};\n}\nfunction fromPatternV1(pattern: PatternV1): Pattern {\n\treturn pattern.map((element) => {\n\t\tswitch (element.type) {\n\t\t\tcase \"Text\": {\n\t\t\t\treturn {\n\t\t\t\t\ttype: \"text\",\n\t\t\t\t\tvalue: element.value,\n\t\t\t\t};\n\t\t\t}\n\t\t\tcase \"VariableReference\":\n\t\t\t\treturn {\n\t\t\t\t\ttype: \"expression\",\n\t\t\t\t\targ: {\n\t\t\t\t\t\ttype: \"variable-reference\",\n\t\t\t\t\t\tname: element.name,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t}\n\t});\n}\n"],"names":[],"mappings":"AAQA;;;;GAIG;;;AACH,MAAM,UAAU,aAAa,CAAC,SAAoB;IACjD,MAAM,QAAQ,GAAG,SAAS,CAAC,EAAE,CAAC;IAE9B,MAAM,SAAS,GAAG;QACjB,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;KACpE,CAAC;IAEF,MAAM,YAAY,GAAG,IAAI,GAAG,EAAe,CAAC;IAE5C,MAAM,QAAQ,GAAoB,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAiB,EAAE;QAC3E,MAAM,SAAS,GAAG,QAAQ,GAAG,GAAG,GAAG,QAAQ,CAAC;QAC5C,gDAAgD;QAChD,MAAM,UAAU,GAAG,SAAS,CAAC,QAAQ,CAAC,MAAM,CAC3C,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,KAAK,QAAQ,CAC7C,CAAC;QAEF,yBAAyB;QACzB,MAAM,aAAa,GAAG,IAAI,GAAG,EAAU,CAAC;QACxC,KAAK,MAAM,UAAU,IAAI,SAAS,CAAC,SAAS,IAAI,EAAE,EAAE,CAAC;YACpD,aAAa,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QACpC,CAAC;QAED,iFAAiF;QACjF,MAAM,aAAa,GAAG,IAAI,GAAG,CAAS,aAAa,CAAC,CAAC;QACrD,MAAM,QAAQ,GAAc,EAAE,CAAC;QAC/B,IAAI,YAAY,GAAG,CAAC,CAAC;QACrB,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;YACpC,KAAK,MAAM,OAAO,IAAI,SAAS,CAAC,OAAO,EAAE,CAAC;gBACzC,IAAI,OAAO,CAAC,IAAI,KAAK,mBAAmB,EAAE,CAAC;oBAC1C,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;gBACjC,CAAC;YACF,CAAC;YAED,QAAQ,CAAC,IAAI,CAAC;gBACb,sDAAsD;gBACtD,OAAO,EAAE,EAAE;gBACX,OAAO,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC;gBACzC,EAAE,EAAE,SAAS,GAAG,GAAG,GAAG,YAAY;gBAClC,SAAS,EAAE,SAAS;aACpB,CAAC,CAAC;YACH,YAAY,IAAI,CAAC,CAAC;QACnB,CAAC;QAED,oEAAoE;QACpE,KAAK,MAAM,QAAQ,IAAI,aAAa,EAAE,CAAC;YACtC,YAAY,CAAC,GAAG,CAAC;gBAChB,IAAI,EAAE,gBAAgB;gBACtB,IAAI,EAAE,QAAQ;aACd,CAAC,CAAC;QACJ,CAAC;QAED,OAAO;YACN,EAAE,EAAE,SAAS;YACb,QAAQ,EAAE,QAAQ;YAClB,MAAM,EAAE,QAAQ;YAChB,SAAS,EAAE,EAAE;YACb,QAAQ;SACR,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO;QACN,EAAE,EAAE,QAAQ;QACZ,YAAY,EAAE,CAAC,GAAG,YAAY,CAAC;QAC/B,QAAQ;KACR,CAAC;AACH,CAAC;AACD,SAAS,aAAa,CAAC,OAAkB;IACxC,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;QAC9B,QAAQ,OAAO,CAAC,IAAI,EAAE,CAAC;YACtB,KAAK,MAAM,CAAC,CAAC,CAAC;gBACb,OAAO;oBACN,IAAI,EAAE,MAAM;oBACZ,KAAK,EAAE,OAAO,CAAC,KAAK;iBACpB,CAAC;YACH,CAAC;YACD,KAAK,mBAAmB;gBACvB,OAAO;oBACN,IAAI,EAAE,YAAY;oBAClB,GAAG,EAAE;wBACJ,IAAI,EAAE,oBAAoB;wBAC1B,IAAI,EAAE,OAAO,CAAC,IAAI;qBAClB;iBACD,CAAC;QACJ,CAAC;IACF,CAAC,CAAC,CAAC;AACJ,CAAC","debug_id":"45afe632-0d35-5194-9127-dda10133a680"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fromMessageV1.test.d.ts","sourceRoot":"/","sources":["json-schema/old-v1-message/fromMessageV1.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="eb8602fc-1b9b-5146-bcce-5e077ff9b4eb")}catch(e){}}();
|
|
3
|
+
import { test, expect } from "vitest";
|
|
4
|
+
import { fromMessageV1 } from "./fromMessageV1.js";
|
|
5
|
+
import { Value } from "@sinclair/typebox/value";
|
|
6
|
+
import { MessageV1 } from "./schemaV1.js";
|
|
7
|
+
const messageV1 = {
|
|
8
|
+
id: "hello_world",
|
|
9
|
+
alias: {},
|
|
10
|
+
variants: [
|
|
11
|
+
{
|
|
12
|
+
languageTag: "en",
|
|
13
|
+
match: [],
|
|
14
|
+
pattern: [
|
|
15
|
+
{
|
|
16
|
+
type: "Text",
|
|
17
|
+
value: "Hello World!",
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
languageTag: "de",
|
|
23
|
+
match: [],
|
|
24
|
+
pattern: [
|
|
25
|
+
{
|
|
26
|
+
type: "Text",
|
|
27
|
+
value: "Hallo Welt!",
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
selectors: [],
|
|
33
|
+
};
|
|
34
|
+
const bundle = {
|
|
35
|
+
id: "hello_world",
|
|
36
|
+
declarations: [],
|
|
37
|
+
messages: [
|
|
38
|
+
{
|
|
39
|
+
bundleId: "hello_world",
|
|
40
|
+
id: "hello_world" + "_en",
|
|
41
|
+
locale: "en",
|
|
42
|
+
selectors: [],
|
|
43
|
+
variants: [
|
|
44
|
+
{
|
|
45
|
+
id: "hello_world" + "_en_1",
|
|
46
|
+
matches: [],
|
|
47
|
+
messageId: "hello_world" + "_en",
|
|
48
|
+
pattern: [
|
|
49
|
+
{
|
|
50
|
+
type: "text",
|
|
51
|
+
value: "Hello World!",
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
bundleId: "hello_world",
|
|
59
|
+
id: "hello_world" + "_de",
|
|
60
|
+
locale: "de",
|
|
61
|
+
selectors: [],
|
|
62
|
+
variants: [
|
|
63
|
+
{
|
|
64
|
+
id: "hello_world" + "_de_1",
|
|
65
|
+
matches: [],
|
|
66
|
+
messageId: "hello_world" + "_de",
|
|
67
|
+
pattern: [
|
|
68
|
+
{
|
|
69
|
+
type: "text",
|
|
70
|
+
value: "Hallo Welt!",
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
};
|
|
78
|
+
test("fromMessageV1", () => {
|
|
79
|
+
expect(Value.Check(MessageV1, messageV1)).toBe(true);
|
|
80
|
+
const nestedBundle = fromMessageV1(messageV1);
|
|
81
|
+
expect(nestedBundle).toEqual(bundle);
|
|
82
|
+
});
|
|
83
|
+
test.todo("with variable references", () => { });
|
|
84
|
+
//# sourceMappingURL=fromMessageV1.test.js.map
|
|
85
|
+
//# debugId=eb8602fc-1b9b-5146-bcce-5e077ff9b4eb
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fromMessageV1.test.js","sources":["json-schema/old-v1-message/fromMessageV1.test.ts"],"sourceRoot":"/","sourcesContent":["import { test, expect } from \"vitest\";\nimport { fromMessageV1 } from \"./fromMessageV1.js\";\nimport { Value } from \"@sinclair/typebox/value\";\nimport { MessageV1 } from \"./schemaV1.js\";\nimport type { BundleNested } from \"../../database/schema.js\";\n\nconst messageV1: MessageV1 = {\n\tid: \"hello_world\",\n\talias: {},\n\tvariants: [\n\t\t{\n\t\t\tlanguageTag: \"en\",\n\t\t\tmatch: [],\n\t\t\tpattern: [\n\t\t\t\t{\n\t\t\t\t\ttype: \"Text\",\n\t\t\t\t\tvalue: \"Hello World!\",\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\t{\n\t\t\tlanguageTag: \"de\",\n\t\t\tmatch: [],\n\t\t\tpattern: [\n\t\t\t\t{\n\t\t\t\t\ttype: \"Text\",\n\t\t\t\t\tvalue: \"Hallo Welt!\",\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t],\n\tselectors: [],\n};\n\nconst bundle: BundleNested = {\n\tid: \"hello_world\",\n\tdeclarations: [],\n\tmessages: [\n\t\t{\n\t\t\tbundleId: \"hello_world\",\n\t\t\tid: \"hello_world\" + \"_en\",\n\t\t\tlocale: \"en\",\n\t\t\tselectors: [],\n\t\t\tvariants: [\n\t\t\t\t{\n\t\t\t\t\tid: \"hello_world\" + \"_en_1\",\n\t\t\t\t\tmatches: [],\n\t\t\t\t\tmessageId: \"hello_world\" + \"_en\",\n\t\t\t\t\tpattern: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\t\tvalue: \"Hello World!\",\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\t{\n\t\t\tbundleId: \"hello_world\",\n\t\t\tid: \"hello_world\" + \"_de\",\n\t\t\tlocale: \"de\",\n\t\t\tselectors: [],\n\t\t\tvariants: [\n\t\t\t\t{\n\t\t\t\t\tid: \"hello_world\" + \"_de_1\",\n\t\t\t\t\tmatches: [],\n\t\t\t\t\tmessageId: \"hello_world\" + \"_de\",\n\t\t\t\t\tpattern: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\t\tvalue: \"Hallo Welt!\",\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t],\n};\n\ntest(\"fromMessageV1\", () => {\n\texpect(Value.Check(MessageV1, messageV1)).toBe(true);\n\tconst nestedBundle: unknown = fromMessageV1(messageV1);\n\n\texpect(nestedBundle).toEqual(bundle);\n});\n\ntest.todo(\"with variable references\", () => {});\n"],"names":[],"mappings":";;AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG1C,MAAM,SAAS,GAAc;IAC5B,EAAE,EAAE,aAAa;IACjB,KAAK,EAAE,EAAE;IACT,QAAQ,EAAE;QACT;YACC,WAAW,EAAE,IAAI;YACjB,KAAK,EAAE,EAAE;YACT,OAAO,EAAE;gBACR;oBACC,IAAI,EAAE,MAAM;oBACZ,KAAK,EAAE,cAAc;iBACrB;aACD;SACD;QACD;YACC,WAAW,EAAE,IAAI;YACjB,KAAK,EAAE,EAAE;YACT,OAAO,EAAE;gBACR;oBACC,IAAI,EAAE,MAAM;oBACZ,KAAK,EAAE,aAAa;iBACpB;aACD;SACD;KACD;IACD,SAAS,EAAE,EAAE;CACb,CAAC;AAEF,MAAM,MAAM,GAAiB;IAC5B,EAAE,EAAE,aAAa;IACjB,YAAY,EAAE,EAAE;IAChB,QAAQ,EAAE;QACT;YACC,QAAQ,EAAE,aAAa;YACvB,EAAE,EAAE,aAAa,GAAG,KAAK;YACzB,MAAM,EAAE,IAAI;YACZ,SAAS,EAAE,EAAE;YACb,QAAQ,EAAE;gBACT;oBACC,EAAE,EAAE,aAAa,GAAG,OAAO;oBAC3B,OAAO,EAAE,EAAE;oBACX,SAAS,EAAE,aAAa,GAAG,KAAK;oBAChC,OAAO,EAAE;wBACR;4BACC,IAAI,EAAE,MAAM;4BACZ,KAAK,EAAE,cAAc;yBACrB;qBACD;iBACD;aACD;SACD;QACD;YACC,QAAQ,EAAE,aAAa;YACvB,EAAE,EAAE,aAAa,GAAG,KAAK;YACzB,MAAM,EAAE,IAAI;YACZ,SAAS,EAAE,EAAE;YACb,QAAQ,EAAE;gBACT;oBACC,EAAE,EAAE,aAAa,GAAG,OAAO;oBAC3B,OAAO,EAAE,EAAE;oBACX,SAAS,EAAE,aAAa,GAAG,KAAK;oBAChC,OAAO,EAAE;wBACR;4BACC,IAAI,EAAE,MAAM;4BACZ,KAAK,EAAE,aAAa;yBACpB;qBACD;iBACD;aACD;SACD;KACD;CACD,CAAC;AAEF,IAAI,CAAC,eAAe,EAAE,GAAG,EAAE;IAC1B,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACrD,MAAM,YAAY,GAAY,aAAa,CAAC,SAAS,CAAC,CAAC;IAEvD,MAAM,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AACtC,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,IAAI,CAAC,0BAA0B,EAAE,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC","debug_id":"eb8602fc-1b9b-5146-bcce-5e077ff9b4eb"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { type Static } from "@sinclair/typebox";
|
|
2
|
+
/**
|
|
3
|
+
* A (text) element that is translatable and rendered to the UI.
|
|
4
|
+
*/
|
|
5
|
+
export type TextV1 = Static<typeof TextV1>;
|
|
6
|
+
export declare const TextV1: import("@sinclair/typebox").TObject<{
|
|
7
|
+
type: import("@sinclair/typebox").TLiteral<"Text">;
|
|
8
|
+
value: import("@sinclair/typebox").TString;
|
|
9
|
+
}>;
|
|
10
|
+
export type VariableReferenceV1 = Static<typeof VariableReferenceV1>;
|
|
11
|
+
export declare const VariableReferenceV1: import("@sinclair/typebox").TObject<{
|
|
12
|
+
type: import("@sinclair/typebox").TLiteral<"VariableReference">;
|
|
13
|
+
name: import("@sinclair/typebox").TString;
|
|
14
|
+
}>;
|
|
15
|
+
/**
|
|
16
|
+
* An expression is a reference to a variable or a function.
|
|
17
|
+
*
|
|
18
|
+
* Think of expressions as elements that are rendered to a
|
|
19
|
+
* text value during runtime.
|
|
20
|
+
*/
|
|
21
|
+
export type ExpressionV1 = Static<typeof ExpressionV1>;
|
|
22
|
+
export declare const ExpressionV1: import("@sinclair/typebox").TObject<{
|
|
23
|
+
type: import("@sinclair/typebox").TLiteral<"VariableReference">;
|
|
24
|
+
name: import("@sinclair/typebox").TString;
|
|
25
|
+
}>;
|
|
26
|
+
/**
|
|
27
|
+
* A pattern is a sequence of elements that comprise
|
|
28
|
+
* a message that is rendered to the UI.
|
|
29
|
+
*/
|
|
30
|
+
export type PatternV1 = Static<typeof PatternV1>;
|
|
31
|
+
export declare const PatternV1: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
|
|
32
|
+
type: import("@sinclair/typebox").TLiteral<"Text">;
|
|
33
|
+
value: import("@sinclair/typebox").TString;
|
|
34
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
35
|
+
type: import("@sinclair/typebox").TLiteral<"VariableReference">;
|
|
36
|
+
name: import("@sinclair/typebox").TString;
|
|
37
|
+
}>]>>;
|
|
38
|
+
/**
|
|
39
|
+
* A variant contains a pattern that is rendered to the UI.
|
|
40
|
+
*/
|
|
41
|
+
export type VariantV1 = Static<typeof VariantV1>;
|
|
42
|
+
export declare const VariantV1: import("@sinclair/typebox").TObject<{
|
|
43
|
+
languageTag: import("@sinclair/typebox").TString;
|
|
44
|
+
/**
|
|
45
|
+
* The number of keys in each variant match MUST equal the number of expressions in the selectors.
|
|
46
|
+
*
|
|
47
|
+
* Inspired by: https://github.com/unicode-org/message-format-wg/blob/main/spec/formatting.md#pattern-selection
|
|
48
|
+
*/
|
|
49
|
+
match: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
50
|
+
pattern: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
|
|
51
|
+
type: import("@sinclair/typebox").TLiteral<"Text">;
|
|
52
|
+
value: import("@sinclair/typebox").TString;
|
|
53
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
54
|
+
type: import("@sinclair/typebox").TLiteral<"VariableReference">;
|
|
55
|
+
name: import("@sinclair/typebox").TString;
|
|
56
|
+
}>]>>;
|
|
57
|
+
}>;
|
|
58
|
+
export type MessageV1 = Static<typeof MessageV1>;
|
|
59
|
+
export declare const MessageV1: import("@sinclair/typebox").TObject<{
|
|
60
|
+
id: import("@sinclair/typebox").TString;
|
|
61
|
+
alias: import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TString>;
|
|
62
|
+
/**
|
|
63
|
+
* The order in which the selectors are placed determines the precedence of patterns.
|
|
64
|
+
*/
|
|
65
|
+
selectors: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
66
|
+
type: import("@sinclair/typebox").TLiteral<"VariableReference">;
|
|
67
|
+
name: import("@sinclair/typebox").TString;
|
|
68
|
+
}>>;
|
|
69
|
+
variants: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
70
|
+
languageTag: import("@sinclair/typebox").TString;
|
|
71
|
+
/**
|
|
72
|
+
* The number of keys in each variant match MUST equal the number of expressions in the selectors.
|
|
73
|
+
*
|
|
74
|
+
* Inspired by: https://github.com/unicode-org/message-format-wg/blob/main/spec/formatting.md#pattern-selection
|
|
75
|
+
*/
|
|
76
|
+
match: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
77
|
+
pattern: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
|
|
78
|
+
type: import("@sinclair/typebox").TLiteral<"Text">;
|
|
79
|
+
value: import("@sinclair/typebox").TString;
|
|
80
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
81
|
+
type: import("@sinclair/typebox").TLiteral<"VariableReference">;
|
|
82
|
+
name: import("@sinclair/typebox").TString;
|
|
83
|
+
}>]>>;
|
|
84
|
+
}>>;
|
|
85
|
+
}>;
|
|
86
|
+
//# sourceMappingURL=schemaV1.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemaV1.d.ts","sourceRoot":"/","sources":["json-schema/old-v1-message/schemaV1.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEtD;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,MAAM,CAAC,CAAC;AAC3C,eAAO,MAAM,MAAM;;;EAGjB,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,OAAO,mBAAmB,CAAC,CAAC;AACrE,eAAO,MAAM,mBAAmB;;;EAG9B,CAAC;AAEH;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,OAAO,YAAY,CAAC,CAAC;AACvD,eAAO,MAAM,YAAY;;;EAAoC,CAAC;AAS9D;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,SAAS,CAAC,CAAC;AACjD,eAAO,MAAM,SAAS;;;;;;KAAiD,CAAC;AAExE;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,SAAS,CAAC,CAAC;AACjD,eAAO,MAAM,SAAS;;IAErB;;;;OAIG;;;;;;;;;EAIF,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,SAAS,CAAC,CAAC;AACjD,eAAO,MAAM,SAAS;;;IAGrB;;OAEG;;;;;;;QAhBH;;;;WAIG;;;;;;;;;;EAeF,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="32eef17c-b0b8-5d95-95c4-3b6339e01eb9")}catch(e){}}();
|
|
3
|
+
import { Type } from "@sinclair/typebox";
|
|
4
|
+
export const TextV1 = Type.Object({
|
|
5
|
+
type: Type.Literal("Text"),
|
|
6
|
+
value: Type.String(),
|
|
7
|
+
});
|
|
8
|
+
export const VariableReferenceV1 = Type.Object({
|
|
9
|
+
type: Type.Literal("VariableReference"),
|
|
10
|
+
name: Type.String(),
|
|
11
|
+
});
|
|
12
|
+
export const ExpressionV1 = Type.Union([VariableReferenceV1]);
|
|
13
|
+
export const PatternV1 = Type.Array(Type.Union([TextV1, ExpressionV1]));
|
|
14
|
+
export const VariantV1 = Type.Object({
|
|
15
|
+
languageTag: Type.String(),
|
|
16
|
+
/**
|
|
17
|
+
* The number of keys in each variant match MUST equal the number of expressions in the selectors.
|
|
18
|
+
*
|
|
19
|
+
* Inspired by: https://github.com/unicode-org/message-format-wg/blob/main/spec/formatting.md#pattern-selection
|
|
20
|
+
*/
|
|
21
|
+
// a match can always only be string-based because a string is what is rendered to the UI
|
|
22
|
+
match: Type.Array(Type.String()),
|
|
23
|
+
pattern: PatternV1,
|
|
24
|
+
});
|
|
25
|
+
export const MessageV1 = Type.Object({
|
|
26
|
+
id: Type.String(),
|
|
27
|
+
alias: Type.Record(Type.String(), Type.String()),
|
|
28
|
+
/**
|
|
29
|
+
* The order in which the selectors are placed determines the precedence of patterns.
|
|
30
|
+
*/
|
|
31
|
+
selectors: Type.Array(ExpressionV1),
|
|
32
|
+
variants: Type.Array(VariantV1),
|
|
33
|
+
});
|
|
34
|
+
//# sourceMappingURL=schemaV1.js.map
|
|
35
|
+
//# debugId=32eef17c-b0b8-5d95-95c4-3b6339e01eb9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemaV1.js","sources":["json-schema/old-v1-message/schemaV1.ts"],"sourceRoot":"/","sourcesContent":["import { Type, type Static } from \"@sinclair/typebox\";\n\n/**\n * A (text) element that is translatable and rendered to the UI.\n */\nexport type TextV1 = Static<typeof TextV1>;\nexport const TextV1 = Type.Object({\n\ttype: Type.Literal(\"Text\"),\n\tvalue: Type.String(),\n});\n\nexport type VariableReferenceV1 = Static<typeof VariableReferenceV1>;\nexport const VariableReferenceV1 = Type.Object({\n\ttype: Type.Literal(\"VariableReference\"),\n\tname: Type.String(),\n});\n\n/**\n * An expression is a reference to a variable or a function.\n *\n * Think of expressions as elements that are rendered to a\n * text value during runtime.\n */\nexport type ExpressionV1 = Static<typeof ExpressionV1>;\nexport const ExpressionV1 = Type.Union([VariableReferenceV1]);\n\n// export type FunctionReference = {\n// \ttype: \"function\"\n// \tname: string\n// \toperand?: Text | VariableReference\n// \toptions?: Option[]\n// }\n\n/**\n * A pattern is a sequence of elements that comprise\n * a message that is rendered to the UI.\n */\nexport type PatternV1 = Static<typeof PatternV1>;\nexport const PatternV1 = Type.Array(Type.Union([TextV1, ExpressionV1]));\n\n/**\n * A variant contains a pattern that is rendered to the UI.\n */\nexport type VariantV1 = Static<typeof VariantV1>;\nexport const VariantV1 = Type.Object({\n\tlanguageTag: Type.String(),\n\t/**\n\t * The number of keys in each variant match MUST equal the number of expressions in the selectors.\n\t *\n\t * Inspired by: https://github.com/unicode-org/message-format-wg/blob/main/spec/formatting.md#pattern-selection\n\t */\n\t// a match can always only be string-based because a string is what is rendered to the UI\n\tmatch: Type.Array(Type.String()),\n\tpattern: PatternV1,\n});\n\nexport type MessageV1 = Static<typeof MessageV1>;\nexport const MessageV1 = Type.Object({\n\tid: Type.String(),\n\talias: Type.Record(Type.String(), Type.String()),\n\t/**\n\t * The order in which the selectors are placed determines the precedence of patterns.\n\t */\n\tselectors: Type.Array(ExpressionV1),\n\tvariants: Type.Array(VariantV1),\n});\n"],"names":[],"mappings":";;AAAA,OAAO,EAAE,IAAI,EAAe,MAAM,mBAAmB,CAAC;AAMtD,MAAM,CAAC,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;IACjC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;IAC1B,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE;CACpB,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC,MAAM,CAAC;IAC9C,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC;IACvC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE;CACnB,CAAC,CAAC;AASH,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC;AAc9D,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC;AAMxE,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC;IACpC,WAAW,EAAE,IAAI,CAAC,MAAM,EAAE;IAC1B;;;;OAIG;IACH,yFAAyF;IACzF,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;IAChC,OAAO,EAAE,SAAS;CAClB,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC;IACpC,EAAE,EAAE,IAAI,CAAC,MAAM,EAAE;IACjB,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;IAChD;;OAEG;IACH,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC;IACnC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC;CAC/B,CAAC,CAAC","debug_id":"32eef17c-b0b8-5d95-95c4-3b6339e01eb9"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { BundleNested } from "../../database/schema.js";
|
|
2
|
+
import type { MessageV1 } from "./schemaV1.js";
|
|
3
|
+
/**
|
|
4
|
+
* Converts a BundleNested into a legacy format.
|
|
5
|
+
*
|
|
6
|
+
* @throws If the message cannot be represented in the v1 format
|
|
7
|
+
*/
|
|
8
|
+
export declare function toMessageV1(bundle: BundleNested): MessageV1;
|
|
9
|
+
//# sourceMappingURL=toMessageV1.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toMessageV1.d.ts","sourceRoot":"/","sources":["json-schema/old-v1-message/toMessageV1.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAE7D,OAAO,KAAK,EAEX,SAAS,EAGT,MAAM,eAAe,CAAC;AAEvB;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,YAAY,GAAG,SAAS,CAkC3D"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts a BundleNested into a legacy format.
|
|
3
|
+
*
|
|
4
|
+
* @throws If the message cannot be represented in the v1 format
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="6cd368f0-2032-5124-8afa-4a9cc69a1451")}catch(e){}}();
|
|
8
|
+
export function toMessageV1(bundle) {
|
|
9
|
+
const variants = [];
|
|
10
|
+
const selectorNames = new Set();
|
|
11
|
+
for (const message of bundle.messages) {
|
|
12
|
+
// collect all selector names
|
|
13
|
+
for (const selector of message.selectors.map((s) => ({
|
|
14
|
+
type: "variable-reference",
|
|
15
|
+
name: s.name,
|
|
16
|
+
}))) {
|
|
17
|
+
selectorNames.add(selector.name);
|
|
18
|
+
}
|
|
19
|
+
// collect all variants
|
|
20
|
+
for (const variant of message.variants) {
|
|
21
|
+
variants.push({
|
|
22
|
+
languageTag: message.locale,
|
|
23
|
+
match: [],
|
|
24
|
+
pattern: toV1Pattern(variant.pattern),
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
const selectors = [...selectorNames].map((name) => ({
|
|
29
|
+
type: "VariableReference",
|
|
30
|
+
name,
|
|
31
|
+
}));
|
|
32
|
+
return {
|
|
33
|
+
id: bundle.id,
|
|
34
|
+
alias: {},
|
|
35
|
+
variants,
|
|
36
|
+
selectors,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* @throws If the pattern cannot be represented in the v1 format
|
|
41
|
+
*/
|
|
42
|
+
function toV1Pattern(pattern) {
|
|
43
|
+
return pattern.map((element) => {
|
|
44
|
+
switch (element.type) {
|
|
45
|
+
case "text": {
|
|
46
|
+
return {
|
|
47
|
+
type: "Text",
|
|
48
|
+
value: element.value,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
case "expression": {
|
|
52
|
+
if (element.arg.type === "variable-reference") {
|
|
53
|
+
return {
|
|
54
|
+
type: "VariableReference",
|
|
55
|
+
name: element.arg.name,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
throw new Error(`Unsupported expression argument type`);
|
|
59
|
+
}
|
|
60
|
+
default: {
|
|
61
|
+
throw new Error(`Unsupported pattern element type`);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=toMessageV1.js.map
|
|
67
|
+
//# debugId=6cd368f0-2032-5124-8afa-4a9cc69a1451
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toMessageV1.js","sources":["json-schema/old-v1-message/toMessageV1.ts"],"sourceRoot":"/","sourcesContent":["import type { BundleNested } from \"../../database/schema.js\";\nimport type { Pattern } from \"../pattern.js\";\nimport type {\n\tExpressionV1,\n\tMessageV1,\n\tPatternV1,\n\tVariantV1,\n} from \"./schemaV1.js\";\n\n/**\n * Converts a BundleNested into a legacy format.\n *\n * @throws If the message cannot be represented in the v1 format\n */\nexport function toMessageV1(bundle: BundleNested): MessageV1 {\n\tconst variants: VariantV1[] = [];\n\tconst selectorNames = new Set<string>();\n\n\tfor (const message of bundle.messages) {\n\t\t// collect all selector names\n\t\tfor (const selector of message.selectors.map((s) => ({\n\t\t\ttype: \"variable-reference\",\n\t\t\tname: s.name,\n\t\t}))) {\n\t\t\tselectorNames.add(selector.name);\n\t\t}\n\n\t\t// collect all variants\n\t\tfor (const variant of message.variants) {\n\t\t\tvariants.push({\n\t\t\t\tlanguageTag: message.locale,\n\t\t\t\tmatch: [],\n\t\t\t\tpattern: toV1Pattern(variant.pattern),\n\t\t\t});\n\t\t}\n\t}\n\n\tconst selectors: ExpressionV1[] = [...selectorNames].map((name) => ({\n\t\ttype: \"VariableReference\",\n\t\tname,\n\t}));\n\n\treturn {\n\t\tid: bundle.id,\n\t\talias: {},\n\t\tvariants,\n\t\tselectors,\n\t};\n}\n\n/**\n * @throws If the pattern cannot be represented in the v1 format\n */\nfunction toV1Pattern(pattern: Pattern): PatternV1 {\n\treturn pattern.map((element) => {\n\t\tswitch (element.type) {\n\t\t\tcase \"text\": {\n\t\t\t\treturn {\n\t\t\t\t\ttype: \"Text\",\n\t\t\t\t\tvalue: element.value,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tcase \"expression\": {\n\t\t\t\tif (element.arg.type === \"variable-reference\") {\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttype: \"VariableReference\",\n\t\t\t\t\t\tname: element.arg.name,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tthrow new Error(`Unsupported expression argument type`);\n\t\t\t}\n\n\t\t\tdefault: {\n\t\t\t\tthrow new Error(`Unsupported pattern element type`);\n\t\t\t}\n\t\t}\n\t});\n}\n"],"names":[],"mappings":"AASA;;;;GAIG;;;AACH,MAAM,UAAU,WAAW,CAAC,MAAoB;IAC/C,MAAM,QAAQ,GAAgB,EAAE,CAAC;IACjC,MAAM,aAAa,GAAG,IAAI,GAAG,EAAU,CAAC;IAExC,KAAK,MAAM,OAAO,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;QACvC,6BAA6B;QAC7B,KAAK,MAAM,QAAQ,IAAI,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACpD,IAAI,EAAE,oBAAoB;YAC1B,IAAI,EAAE,CAAC,CAAC,IAAI;SACZ,CAAC,CAAC,EAAE,CAAC;YACL,aAAa,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAClC,CAAC;QAED,uBAAuB;QACvB,KAAK,MAAM,OAAO,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;YACxC,QAAQ,CAAC,IAAI,CAAC;gBACb,WAAW,EAAE,OAAO,CAAC,MAAM;gBAC3B,KAAK,EAAE,EAAE;gBACT,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC;aACrC,CAAC,CAAC;QACJ,CAAC;IACF,CAAC;IAED,MAAM,SAAS,GAAmB,CAAC,GAAG,aAAa,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACnE,IAAI,EAAE,mBAAmB;QACzB,IAAI;KACJ,CAAC,CAAC,CAAC;IAEJ,OAAO;QACN,EAAE,EAAE,MAAM,CAAC,EAAE;QACb,KAAK,EAAE,EAAE;QACT,QAAQ;QACR,SAAS;KACT,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAS,WAAW,CAAC,OAAgB;IACpC,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;QAC9B,QAAQ,OAAO,CAAC,IAAI,EAAE,CAAC;YACtB,KAAK,MAAM,CAAC,CAAC,CAAC;gBACb,OAAO;oBACN,IAAI,EAAE,MAAM;oBACZ,KAAK,EAAE,OAAO,CAAC,KAAK;iBACpB,CAAC;YACH,CAAC;YAED,KAAK,YAAY,CAAC,CAAC,CAAC;gBACnB,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,KAAK,oBAAoB,EAAE,CAAC;oBAC/C,OAAO;wBACN,IAAI,EAAE,mBAAmB;wBACzB,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,IAAI;qBACtB,CAAC;gBACH,CAAC;gBACD,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;YACzD,CAAC;YAED,OAAO,CAAC,CAAC,CAAC;gBACT,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;YACrD,CAAC;QACF,CAAC;IACF,CAAC,CAAC,CAAC;AACJ,CAAC","debug_id":"6cd368f0-2032-5124-8afa-4a9cc69a1451"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toMessageV1.test.d.ts","sourceRoot":"/","sources":["json-schema/old-v1-message/toMessageV1.test.ts"],"names":[],"mappings":""}
|