@inlang/sdk 0.36.4 → 2.0.0-beta.2
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 +168 -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 +15 -0
- package/dist/project/maybeCaptureTelemetry.d.ts.map +1 -0
- package/dist/project/maybeCaptureTelemetry.js +58 -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 +71 -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 +5 -2
- package/dist/services/telemetry/capture.d.ts.map +1 -0
- package/dist/services/telemetry/capture.js +76 -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 +46 -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 +176 -0
- package/src/project/loadProject.ts +246 -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 +79 -0
- package/src/project/maybeCaptureTelemetry.ts +69 -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 +50 -0
- package/src/services/telemetry/capture.ts +99 -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
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* validate that a project path is absolute and ends with {name}.inlang.
|
|
3
|
-
*
|
|
4
|
-
* @throws if the path is not valid.
|
|
5
|
-
*/
|
|
6
|
-
export function assertValidProjectPath(projectPath) {
|
|
7
|
-
if (!isAbsolutePath(projectPath)) {
|
|
8
|
-
throw new Error(`Expected an absolute path but received "${projectPath}".`);
|
|
9
|
-
}
|
|
10
|
-
if (!isInlangProjectPath(projectPath)) {
|
|
11
|
-
throw new Error(`Expected a path ending in "{name}.inlang" but received "${projectPath}".\n\nValid examples: \n- "/path/to/micky-mouse.inlang"\n- "/path/to/green-elephant.inlang\n`);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* tests whether a path ends with {name}.inlang
|
|
16
|
-
* (does not remove trailing slash)
|
|
17
|
-
*/
|
|
18
|
-
export function isInlangProjectPath(path) {
|
|
19
|
-
return /[^\\/]+\.inlang$/.test(path);
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* tests whether a path starts with a forward slash (/) or a windows-style
|
|
23
|
-
* drive letter (C: or D:, etc.) followed by a slash
|
|
24
|
-
*/
|
|
25
|
-
export function isAbsolutePath(path) {
|
|
26
|
-
return /^\/|^[A-Za-z]:[\\/]/.test(path);
|
|
27
|
-
// OG from sdk/src/isAbsolutePath.ts - TODO: find out where this regex came from
|
|
28
|
-
// const matchPosixAndWindowsAbsolutePaths =
|
|
29
|
-
// /^(?:[A-Za-z]:\\(?:[^\\]+\\)*[^\\]+|[A-Za-z]:\/(?:[^/]+\/)*[^/]+|\/(?:[^/]+\/)*[^/]+)$/
|
|
30
|
-
// return matchPosixAndWindowsAbsolutePaths.test(path)
|
|
31
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validateProjectPath.test.d.ts","sourceRoot":"","sources":["../src/validateProjectPath.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { assert, describe, it } from "vitest";
|
|
2
|
-
import { assertValidProjectPath, isAbsolutePath, isInlangProjectPath, } from "./validateProjectPath.js";
|
|
3
|
-
describe("isAbsolutePath", () => {
|
|
4
|
-
it("should correctly identify Unix absolute paths", () => {
|
|
5
|
-
assert.isTrue(isAbsolutePath("/home/user/documents/file.txt"));
|
|
6
|
-
assert.isTrue(isAbsolutePath("/usr/local/bin/script.sh"));
|
|
7
|
-
assert.isFalse(isAbsolutePath("relative/path/to/file.txt"));
|
|
8
|
-
});
|
|
9
|
-
it("should correctly identify Windows absolute paths", () => {
|
|
10
|
-
assert.isTrue(isAbsolutePath("C:\\Users\\User\\Documents\\File.txt"));
|
|
11
|
-
assert.isTrue(isAbsolutePath("C:/Users/user/project.inlang/settings.json"));
|
|
12
|
-
assert.isFalse(isAbsolutePath("Projects\\Project1\\source\\file.txt"));
|
|
13
|
-
});
|
|
14
|
-
it("should handle edge cases", () => {
|
|
15
|
-
assert.isFalse(isAbsolutePath("")); // Empty path should return false
|
|
16
|
-
assert.isFalse(isAbsolutePath("relative/path/../file.txt")); // Relative path with ".." should return false
|
|
17
|
-
assert.isFalse(isAbsolutePath("../relative/path/to/file.txt"));
|
|
18
|
-
assert.isFalse(isAbsolutePath("./relative/path/to/file.txt"));
|
|
19
|
-
});
|
|
20
|
-
});
|
|
21
|
-
describe("isInlangProjectPath", () => {
|
|
22
|
-
it("should correctly identify valid inlang project paths", () => {
|
|
23
|
-
assert.isTrue(isInlangProjectPath("/path/to/orange-mouse.inlang"));
|
|
24
|
-
assert.isFalse(isInlangProjectPath("relative/path/to/file.txt"));
|
|
25
|
-
assert.isFalse(isInlangProjectPath("/path/to/.inlang"));
|
|
26
|
-
assert.isFalse(isInlangProjectPath("/path/to/white-elephant.inlang/"));
|
|
27
|
-
assert.isFalse(isInlangProjectPath("/path/to/blue-elephant.inlang/settings.json"));
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
describe("assertValidProjectPath", () => {
|
|
31
|
-
it("should not throw for valid project paths", () => {
|
|
32
|
-
assert.doesNotThrow(() => assertValidProjectPath("/path/to/brown-mouse.inlang"));
|
|
33
|
-
assert.doesNotThrow(() => assertValidProjectPath("/path/to/green-elephant.inlang"));
|
|
34
|
-
});
|
|
35
|
-
it("should throw for invalid project paths", () => {
|
|
36
|
-
assert.throws(() => assertValidProjectPath("relative/path/to/flying-lizard.inlang"));
|
|
37
|
-
assert.throws(() => assertValidProjectPath("/path/to/loud-mouse.inlang/"));
|
|
38
|
-
assert.throws(() => assertValidProjectPath("/path/to/green-elephant.inlang/settings.json"));
|
|
39
|
-
});
|
|
40
|
-
});
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export * from "@inlang/json-types";
|
|
2
|
-
export * from "@inlang/language-tag";
|
|
3
|
-
export * from "@inlang/message-lint-rule";
|
|
4
|
-
export * from "@inlang/message";
|
|
5
|
-
export * from "@inlang/plugin";
|
|
6
|
-
export * from "@inlang/project-settings";
|
|
7
|
-
export * from "@inlang/translatable";
|
|
8
|
-
//# sourceMappingURL=versionedInterfaces.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"versionedInterfaces.d.ts","sourceRoot":"","sources":["../src/versionedInterfaces.ts"],"names":[],"mappings":"AAEA,cAAc,oBAAoB,CAAA;AAClC,cAAc,sBAAsB,CAAA;AACpC,cAAc,2BAA2B,CAAA;AACzC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,0BAA0B,CAAA;AACxC,cAAc,sBAAsB,CAAA"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
// Re-exporting for easier importing
|
|
2
|
-
export * from "@inlang/json-types";
|
|
3
|
-
export * from "@inlang/language-tag";
|
|
4
|
-
export * from "@inlang/message-lint-rule";
|
|
5
|
-
export * from "@inlang/message";
|
|
6
|
-
export * from "@inlang/plugin";
|
|
7
|
-
export * from "@inlang/project-settings";
|
|
8
|
-
export * from "@inlang/translatable";
|
|
@@ -1,472 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
2
|
-
import { describe, it, expect } from "vitest"
|
|
3
|
-
import type { ImportFunction } from "../resolve-modules/index.js"
|
|
4
|
-
import { createEffect, from, createRoot } from "../reactivity/solid.js"
|
|
5
|
-
import { solidAdapter } from "./solidAdapter.js"
|
|
6
|
-
import { loadProject } from "../loadProject.js"
|
|
7
|
-
import { mockRepo } from "@lix-js/client"
|
|
8
|
-
import type {
|
|
9
|
-
Message,
|
|
10
|
-
ProjectSettings,
|
|
11
|
-
Plugin,
|
|
12
|
-
MessageLintRule,
|
|
13
|
-
Text,
|
|
14
|
-
} from "../versionedInterfaces.js"
|
|
15
|
-
|
|
16
|
-
// ------------------------------------------------------------------------------------------------
|
|
17
|
-
|
|
18
|
-
const config: ProjectSettings = {
|
|
19
|
-
sourceLanguageTag: "en",
|
|
20
|
-
languageTags: ["en"],
|
|
21
|
-
modules: ["plugin.js", "plugin2.js"],
|
|
22
|
-
messageLintRuleLevels: {
|
|
23
|
-
"messageLintRule.project.missingTranslation": "error",
|
|
24
|
-
},
|
|
25
|
-
"plugin.project.i18next": {
|
|
26
|
-
pathPattern: "./examples/example01/{languageTag}.json",
|
|
27
|
-
variableReferencePattern: ["{", "}"],
|
|
28
|
-
},
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const configWithAliases: ProjectSettings = {
|
|
32
|
-
...config,
|
|
33
|
-
experimental: { aliases: true },
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const mockPlugin: Plugin = {
|
|
37
|
-
id: "plugin.project.i18next",
|
|
38
|
-
description: { en: "Mock plugin description" },
|
|
39
|
-
displayName: { en: "Mock Plugin" },
|
|
40
|
-
|
|
41
|
-
loadMessages: () => exampleMessages,
|
|
42
|
-
saveMessages: () => undefined,
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// TODO: use `createMessage` utility
|
|
46
|
-
const exampleMessages: Message[] = [
|
|
47
|
-
{
|
|
48
|
-
id: "a",
|
|
49
|
-
alias: {},
|
|
50
|
-
selectors: [],
|
|
51
|
-
variants: [
|
|
52
|
-
{
|
|
53
|
-
languageTag: "en",
|
|
54
|
-
match: [],
|
|
55
|
-
pattern: [
|
|
56
|
-
{
|
|
57
|
-
type: "Text",
|
|
58
|
-
value: "test",
|
|
59
|
-
},
|
|
60
|
-
],
|
|
61
|
-
},
|
|
62
|
-
],
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
id: "b",
|
|
66
|
-
alias: {},
|
|
67
|
-
selectors: [],
|
|
68
|
-
variants: [
|
|
69
|
-
{
|
|
70
|
-
languageTag: "en",
|
|
71
|
-
match: [],
|
|
72
|
-
pattern: [
|
|
73
|
-
{
|
|
74
|
-
type: "Text",
|
|
75
|
-
value: "test",
|
|
76
|
-
},
|
|
77
|
-
],
|
|
78
|
-
},
|
|
79
|
-
],
|
|
80
|
-
},
|
|
81
|
-
]
|
|
82
|
-
|
|
83
|
-
const mockLintRule: MessageLintRule = {
|
|
84
|
-
id: "messageLintRule.namespace.mock",
|
|
85
|
-
description: { en: "Mock lint rule description" },
|
|
86
|
-
displayName: { en: "Mock Lint Rule" },
|
|
87
|
-
|
|
88
|
-
run: () => undefined,
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
const $import: ImportFunction = async (name) => ({
|
|
92
|
-
default: name === "plugin.js" ? mockPlugin : mockLintRule,
|
|
93
|
-
})
|
|
94
|
-
|
|
95
|
-
// ------------------------------------------------------------------------------------------------
|
|
96
|
-
|
|
97
|
-
describe("config", () => {
|
|
98
|
-
it("should react to changes in config", async () => {
|
|
99
|
-
const repo = await mockRepo()
|
|
100
|
-
const fs = repo.nodeishFs
|
|
101
|
-
await fs.mkdir("/user/project.inlang", { recursive: true })
|
|
102
|
-
await fs.writeFile("/user/project.inlang/settings.json", JSON.stringify(config))
|
|
103
|
-
const project = solidAdapter(
|
|
104
|
-
await loadProject({
|
|
105
|
-
projectPath: "/user/project.inlang",
|
|
106
|
-
repo,
|
|
107
|
-
_import: $import,
|
|
108
|
-
}),
|
|
109
|
-
{ from }
|
|
110
|
-
)
|
|
111
|
-
|
|
112
|
-
let counter = 0
|
|
113
|
-
createEffect(() => {
|
|
114
|
-
project.settings()
|
|
115
|
-
counter += 1
|
|
116
|
-
})
|
|
117
|
-
|
|
118
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
119
|
-
const newConfig = { ...project.settings()!, languageTags: ["en", "de"] }
|
|
120
|
-
|
|
121
|
-
project.setSettings(newConfig)
|
|
122
|
-
|
|
123
|
-
// TODO: how can we await `setConfig` correctly
|
|
124
|
-
await new Promise((resolve) => setTimeout(resolve, 510))
|
|
125
|
-
|
|
126
|
-
expect(counter).toBe(2) // 2 times because effect creation + set
|
|
127
|
-
expect(project.settings()).toStrictEqual(newConfig)
|
|
128
|
-
})
|
|
129
|
-
})
|
|
130
|
-
|
|
131
|
-
describe("installed", () => {
|
|
132
|
-
it("react to changes that are unrelated to installed items", async () => {
|
|
133
|
-
const repo = await mockRepo()
|
|
134
|
-
const fs = repo.nodeishFs
|
|
135
|
-
await fs.mkdir("/user/project.inlang", { recursive: true })
|
|
136
|
-
await fs.writeFile("/user/project.inlang/settings.json", JSON.stringify(config))
|
|
137
|
-
const project = solidAdapter(
|
|
138
|
-
await loadProject({
|
|
139
|
-
projectPath: "/user/project.inlang",
|
|
140
|
-
repo,
|
|
141
|
-
_import: $import,
|
|
142
|
-
}),
|
|
143
|
-
{ from }
|
|
144
|
-
)
|
|
145
|
-
let counterPlugins = 0
|
|
146
|
-
let counterLint = 0
|
|
147
|
-
|
|
148
|
-
createEffect(() => {
|
|
149
|
-
project.installed.plugins()
|
|
150
|
-
counterPlugins += 1
|
|
151
|
-
})
|
|
152
|
-
|
|
153
|
-
createEffect(() => {
|
|
154
|
-
project.installed.messageLintRules()
|
|
155
|
-
counterLint += 1
|
|
156
|
-
})
|
|
157
|
-
|
|
158
|
-
project.setSettings({ ...project.settings()!, languageTags: ["en", "fr"] })
|
|
159
|
-
|
|
160
|
-
// TODO: how can we await `setConfig` correctly
|
|
161
|
-
await new Promise((resolve) => setTimeout(resolve, 0))
|
|
162
|
-
|
|
163
|
-
expect(counterPlugins).toBe(3) // 3 times because effect creation + setSettings, setResolvedModules
|
|
164
|
-
expect(counterLint).toBe(3) // 3 times because effect creation + setSettings, setResolvedModules
|
|
165
|
-
})
|
|
166
|
-
})
|
|
167
|
-
|
|
168
|
-
describe("messages", () => {
|
|
169
|
-
it("should react to changes in config", async () => {
|
|
170
|
-
const repo = await mockRepo()
|
|
171
|
-
const fs = repo.nodeishFs
|
|
172
|
-
const mockConfig: ProjectSettings = {
|
|
173
|
-
sourceLanguageTag: "en",
|
|
174
|
-
languageTags: ["en", "de"],
|
|
175
|
-
modules: ["./plugin-a.js"],
|
|
176
|
-
"library.project.paraglideJsSveltekit": {
|
|
177
|
-
languageNegotiation: {
|
|
178
|
-
strategies: [
|
|
179
|
-
{
|
|
180
|
-
type: "localStorage",
|
|
181
|
-
} as any,
|
|
182
|
-
],
|
|
183
|
-
},
|
|
184
|
-
},
|
|
185
|
-
}
|
|
186
|
-
const mockPlugin: Plugin = {
|
|
187
|
-
id: "plugin.mock.id",
|
|
188
|
-
displayName: {
|
|
189
|
-
en: "hello",
|
|
190
|
-
},
|
|
191
|
-
description: {
|
|
192
|
-
en: "wo",
|
|
193
|
-
},
|
|
194
|
-
|
|
195
|
-
loadMessages: ({ settings }) => (settings.languageTags.length ? exampleMessages : []),
|
|
196
|
-
saveMessages: () => undefined,
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
const mockImport: ImportFunction = async () => ({ default: mockPlugin })
|
|
200
|
-
|
|
201
|
-
await fs.mkdir("/user/project.inlang.inlang", { recursive: true })
|
|
202
|
-
await fs.writeFile("/user/project.inlang.inlang/settings.json", JSON.stringify(mockConfig))
|
|
203
|
-
const project = solidAdapter(
|
|
204
|
-
await loadProject({
|
|
205
|
-
projectPath: "/user/project.inlang.inlang",
|
|
206
|
-
repo,
|
|
207
|
-
_import: mockImport,
|
|
208
|
-
}),
|
|
209
|
-
{ from }
|
|
210
|
-
)
|
|
211
|
-
|
|
212
|
-
let effectOnMessagesCounter = -1
|
|
213
|
-
createEffect(() => {
|
|
214
|
-
project.query.messages.getAll()
|
|
215
|
-
effectOnMessagesCounter += 1
|
|
216
|
-
})
|
|
217
|
-
|
|
218
|
-
expect(Object.values(project.query.messages.getAll()).length).toBe(2)
|
|
219
|
-
|
|
220
|
-
project.setSettings({ ...project.settings()!, languageTags: ["en"] })
|
|
221
|
-
|
|
222
|
-
// TODO: how can we await `setConfig` correctly
|
|
223
|
-
await new Promise((resolve) => setTimeout(resolve, 510))
|
|
224
|
-
|
|
225
|
-
expect(effectOnMessagesCounter).toBe(2) // 2 = setSetting (clearing the message index), subsequencial loadMessage call
|
|
226
|
-
expect(Object.values(project.query.messages.getAll()).length).toBe(2)
|
|
227
|
-
})
|
|
228
|
-
|
|
229
|
-
it("should react to message udpate", async () => {
|
|
230
|
-
const repo = await mockRepo()
|
|
231
|
-
const fs = repo.nodeishFs
|
|
232
|
-
await fs.mkdir("/user/project.inlang.inlang", { recursive: true })
|
|
233
|
-
await fs.writeFile("/user/project.inlang.inlang/settings.json", JSON.stringify(config))
|
|
234
|
-
const project = solidAdapter(
|
|
235
|
-
await loadProject({
|
|
236
|
-
projectPath: "/user/project.inlang.inlang",
|
|
237
|
-
repo,
|
|
238
|
-
_import: $import,
|
|
239
|
-
}),
|
|
240
|
-
{ from }
|
|
241
|
-
)
|
|
242
|
-
|
|
243
|
-
let counter = 0
|
|
244
|
-
createEffect(() => {
|
|
245
|
-
project.query.messages.getAll()
|
|
246
|
-
counter += 1
|
|
247
|
-
})
|
|
248
|
-
|
|
249
|
-
const messagesBefore = project.query.messages.getAll
|
|
250
|
-
expect(Object.values(messagesBefore()).length).toBe(2)
|
|
251
|
-
expect(
|
|
252
|
-
(
|
|
253
|
-
Object.values(messagesBefore())[0]?.variants.find((variant) => variant.languageTag === "en")
|
|
254
|
-
?.pattern[0] as Text
|
|
255
|
-
).value
|
|
256
|
-
).toBe("test")
|
|
257
|
-
|
|
258
|
-
project.query.messages.update({
|
|
259
|
-
where: { id: "a" },
|
|
260
|
-
// TODO: use `createMessage` utility
|
|
261
|
-
data: {
|
|
262
|
-
...exampleMessages[0],
|
|
263
|
-
variants: [
|
|
264
|
-
{
|
|
265
|
-
languageTag: "en",
|
|
266
|
-
match: [],
|
|
267
|
-
pattern: [
|
|
268
|
-
{
|
|
269
|
-
type: "Text",
|
|
270
|
-
value: "test2",
|
|
271
|
-
},
|
|
272
|
-
],
|
|
273
|
-
},
|
|
274
|
-
],
|
|
275
|
-
},
|
|
276
|
-
})
|
|
277
|
-
|
|
278
|
-
it("should react to message udpate (with aliases)", async () => {
|
|
279
|
-
const repo = await mockRepo()
|
|
280
|
-
const fs = repo.nodeishFs
|
|
281
|
-
await fs.mkdir("/user/project.inlang.inlang", { recursive: true })
|
|
282
|
-
await fs.writeFile(
|
|
283
|
-
"/user/project.inlang.inlang/settings.json",
|
|
284
|
-
JSON.stringify(configWithAliases)
|
|
285
|
-
)
|
|
286
|
-
const project = solidAdapter(
|
|
287
|
-
await loadProject({
|
|
288
|
-
projectPath: "/user/project.inlang.inlang",
|
|
289
|
-
repo,
|
|
290
|
-
_import: $import,
|
|
291
|
-
}),
|
|
292
|
-
{ from }
|
|
293
|
-
)
|
|
294
|
-
|
|
295
|
-
let counter = 0
|
|
296
|
-
createEffect(() => {
|
|
297
|
-
project.query.messages.getAll()
|
|
298
|
-
counter += 1
|
|
299
|
-
})
|
|
300
|
-
|
|
301
|
-
const messagesBefore = project.query.messages.getAll
|
|
302
|
-
expect(Object.values(messagesBefore()).length).toBe(2)
|
|
303
|
-
expect(
|
|
304
|
-
(
|
|
305
|
-
Object.values(messagesBefore())[0]?.variants.find(
|
|
306
|
-
(variant) => variant.languageTag === "en"
|
|
307
|
-
)?.pattern[0] as Text
|
|
308
|
-
).value
|
|
309
|
-
).toBe("test")
|
|
310
|
-
|
|
311
|
-
project.query.messages.update({
|
|
312
|
-
where: { id: "raw_tapir_pause_grateful" },
|
|
313
|
-
// TODO: use `createMessage` utility
|
|
314
|
-
data: {
|
|
315
|
-
...exampleMessages[0],
|
|
316
|
-
variants: [
|
|
317
|
-
{
|
|
318
|
-
languageTag: "en",
|
|
319
|
-
match: [],
|
|
320
|
-
pattern: [
|
|
321
|
-
{
|
|
322
|
-
type: "Text",
|
|
323
|
-
value: "test2",
|
|
324
|
-
},
|
|
325
|
-
],
|
|
326
|
-
},
|
|
327
|
-
],
|
|
328
|
-
},
|
|
329
|
-
})
|
|
330
|
-
|
|
331
|
-
expect(counter).toBe(2) // 2 times because effect creation + set
|
|
332
|
-
const messagesAfter = project.query.messages.getAll
|
|
333
|
-
expect(Object.values(messagesAfter()).length).toBe(2)
|
|
334
|
-
expect(
|
|
335
|
-
(
|
|
336
|
-
Object.values(messagesAfter())[0]?.variants.find(
|
|
337
|
-
(variant) => variant.languageTag === "en"
|
|
338
|
-
)?.pattern[0] as Text
|
|
339
|
-
).value
|
|
340
|
-
).toBe("test2")
|
|
341
|
-
})
|
|
342
|
-
|
|
343
|
-
expect(counter).toBe(2) // 2 times because effect creation + set
|
|
344
|
-
const messagesAfter = project.query.messages.getAll
|
|
345
|
-
expect(Object.values(messagesAfter()).length).toBe(2)
|
|
346
|
-
expect(
|
|
347
|
-
(
|
|
348
|
-
Object.values(messagesAfter())[0]?.variants.find((variant) => variant.languageTag === "en")
|
|
349
|
-
?.pattern[0] as Text
|
|
350
|
-
).value
|
|
351
|
-
).toBe("test2")
|
|
352
|
-
})
|
|
353
|
-
})
|
|
354
|
-
|
|
355
|
-
describe("lint", () => {
|
|
356
|
-
it("should react to changes in config", async () => {
|
|
357
|
-
await createRoot(async () => {
|
|
358
|
-
const repo = await mockRepo()
|
|
359
|
-
const fs = repo.nodeishFs
|
|
360
|
-
await fs.mkdir("/user/project.inlang", { recursive: true })
|
|
361
|
-
await fs.writeFile("/user/project.inlang/settings.json", JSON.stringify(config))
|
|
362
|
-
const project = solidAdapter(
|
|
363
|
-
await loadProject({
|
|
364
|
-
projectPath: "/user/project.inlang",
|
|
365
|
-
repo,
|
|
366
|
-
_import: $import,
|
|
367
|
-
}),
|
|
368
|
-
{ from }
|
|
369
|
-
)
|
|
370
|
-
|
|
371
|
-
// set counter to -1 since creating effect will execute once
|
|
372
|
-
let counter = -1
|
|
373
|
-
createEffect(() => {
|
|
374
|
-
project.query.messageLintReports.getAll()
|
|
375
|
-
counter += 1
|
|
376
|
-
})
|
|
377
|
-
|
|
378
|
-
expect(counter).toBe(0)
|
|
379
|
-
|
|
380
|
-
// wait for all int reports beeing executed
|
|
381
|
-
await new Promise((resolve) => setTimeout(resolve, 510))
|
|
382
|
-
|
|
383
|
-
// 1 because we batch the two lint rules
|
|
384
|
-
expect(counter).toBe(1)
|
|
385
|
-
|
|
386
|
-
const currentSettings = project.settings()!
|
|
387
|
-
const newConfig = { ...currentSettings, languageTags: ["en", "de"] }
|
|
388
|
-
project.setSettings(newConfig)
|
|
389
|
-
|
|
390
|
-
// set settings trigges synchronous -> +1
|
|
391
|
-
expect(counter).toBe(2)
|
|
392
|
-
|
|
393
|
-
await new Promise((resolve) => setTimeout(resolve, 510))
|
|
394
|
-
|
|
395
|
-
// 4 = 2 + batched(1 (effect->settings) and 1 (effect->Resolved Plugin))
|
|
396
|
-
expect(counter).toBe(3)
|
|
397
|
-
expect(project.query.messageLintReports.getAll()).toEqual([])
|
|
398
|
-
|
|
399
|
-
await new Promise((resolve) => setTimeout(resolve, 510))
|
|
400
|
-
|
|
401
|
-
const newConfig2 = { ...project.settings()!, languageTags: ["en", "de", "fr"] }
|
|
402
|
-
project.setSettings(newConfig2)
|
|
403
|
-
|
|
404
|
-
// set settings trigges synchronous -> +1
|
|
405
|
-
expect(counter).toBe(4)
|
|
406
|
-
|
|
407
|
-
await new Promise((resolve) => setTimeout(resolve, 510))
|
|
408
|
-
|
|
409
|
-
// 5 -> 4 + 1 new lint report batch
|
|
410
|
-
expect(counter).toBe(5)
|
|
411
|
-
expect(project.query.messageLintReports.getAll()).toEqual([])
|
|
412
|
-
})
|
|
413
|
-
})
|
|
414
|
-
|
|
415
|
-
it.todo("should react to changes to packages")
|
|
416
|
-
it.todo("should react to changes to modules")
|
|
417
|
-
|
|
418
|
-
it("should react to changes to messages", async () => {
|
|
419
|
-
await createRoot(async () => {
|
|
420
|
-
const repo = await mockRepo()
|
|
421
|
-
const fs = repo.nodeishFs
|
|
422
|
-
await fs.mkdir("/user/project.inlang", { recursive: true })
|
|
423
|
-
await fs.writeFile("/user/project.inlang/settings.json", JSON.stringify(config))
|
|
424
|
-
const project = solidAdapter(
|
|
425
|
-
await loadProject({
|
|
426
|
-
projectPath: "/user/project.inlang",
|
|
427
|
-
repo,
|
|
428
|
-
_import: $import,
|
|
429
|
-
}),
|
|
430
|
-
{ from }
|
|
431
|
-
)
|
|
432
|
-
|
|
433
|
-
let counter = -1 // -1 to start counting after the initial effect
|
|
434
|
-
createEffect(() => {
|
|
435
|
-
project.query.messageLintReports.getAll()
|
|
436
|
-
counter += 1
|
|
437
|
-
})
|
|
438
|
-
expect(counter).toBe(0)
|
|
439
|
-
|
|
440
|
-
await new Promise((resolve) => setTimeout(resolve, 510))
|
|
441
|
-
// 1 -> lint rules are batched - we expect one signal on getAll
|
|
442
|
-
expect(counter).toBe(1)
|
|
443
|
-
|
|
444
|
-
project.query.messages.update({
|
|
445
|
-
where: { id: "a" },
|
|
446
|
-
data: {
|
|
447
|
-
...exampleMessages[0],
|
|
448
|
-
variants: [{ languageTag: "en", match: [], pattern: [{ type: "Text", value: "new" }] }],
|
|
449
|
-
},
|
|
450
|
-
})
|
|
451
|
-
await new Promise((resolve) => setTimeout(resolve, 510))
|
|
452
|
-
|
|
453
|
-
// 1 -> previous two messages + 0 - report results are the same - no effect
|
|
454
|
-
expect(counter).toBe(1)
|
|
455
|
-
expect(project.query.messageLintReports.getAll()).toEqual([])
|
|
456
|
-
|
|
457
|
-
project.query.messages.update({
|
|
458
|
-
where: { id: "a" },
|
|
459
|
-
data: {
|
|
460
|
-
...exampleMessages[0],
|
|
461
|
-
variants: [{ languageTag: "en", match: [], pattern: [{ type: "Text", value: "new" }] }],
|
|
462
|
-
},
|
|
463
|
-
})
|
|
464
|
-
|
|
465
|
-
await new Promise((resolve) => setTimeout(resolve, 510))
|
|
466
|
-
|
|
467
|
-
// 2 -> the updated message does not update the lint rules - result is the same
|
|
468
|
-
expect(counter).toBe(1)
|
|
469
|
-
expect(project.query.messageLintReports.getAll()).toEqual([])
|
|
470
|
-
})
|
|
471
|
-
})
|
|
472
|
-
})
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import type { InlangProject, MessageLintReportsQueryApi } from "../api.js"
|
|
2
|
-
import { observable, type from as solidFrom } from "../reactivity/solid.js"
|
|
3
|
-
import type { MessageQueryApi } from "@inlang/sdk"
|
|
4
|
-
|
|
5
|
-
export const solidAdapter = (
|
|
6
|
-
project: InlangProject,
|
|
7
|
-
arg: {
|
|
8
|
-
from: typeof solidFrom
|
|
9
|
-
}
|
|
10
|
-
): InlangProjectWithSolidAdapter => {
|
|
11
|
-
const convert = <T>(signal: () => T): (() => T) => {
|
|
12
|
-
return arg.from(observable(signal)) as () => T
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
return {
|
|
16
|
-
id: project.id,
|
|
17
|
-
customApi: convert(project.customApi),
|
|
18
|
-
settings: convert(project.settings),
|
|
19
|
-
errors: convert(project.errors),
|
|
20
|
-
installed: {
|
|
21
|
-
messageLintRules: convert(project.installed.messageLintRules),
|
|
22
|
-
plugins: convert(project.installed.plugins),
|
|
23
|
-
},
|
|
24
|
-
setSettings: project.setSettings,
|
|
25
|
-
query: {
|
|
26
|
-
messages: {
|
|
27
|
-
create: project.query.messages.create,
|
|
28
|
-
update: project.query.messages.update,
|
|
29
|
-
delete: project.query.messages.delete,
|
|
30
|
-
upsert: project.query.messages.upsert,
|
|
31
|
-
get: project.query.messages.get,
|
|
32
|
-
// get: (args) => {
|
|
33
|
-
// const [message, setMessage] = createSignal<Message | undefined>()
|
|
34
|
-
// project.query.messages.get.subscribe(args, setMessage)
|
|
35
|
-
// return message()
|
|
36
|
-
// },
|
|
37
|
-
getAll: convert(project.query.messages.getAll),
|
|
38
|
-
includedMessageIds: convert(project.query.messages.includedMessageIds),
|
|
39
|
-
},
|
|
40
|
-
messageLintReports: {
|
|
41
|
-
get: project.query.messageLintReports.get,
|
|
42
|
-
getAll: convert(project.query.messageLintReports.getAll),
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
} satisfies InlangProjectWithSolidAdapter
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export type InlangProjectWithSolidAdapter = {
|
|
49
|
-
id: InlangProject["id"]
|
|
50
|
-
customApi: () => ReturnType<InlangProject["customApi"]>
|
|
51
|
-
installed: {
|
|
52
|
-
plugins: () => ReturnType<InlangProject["installed"]["plugins"]>
|
|
53
|
-
messageLintRules: () => ReturnType<InlangProject["installed"]["messageLintRules"]>
|
|
54
|
-
}
|
|
55
|
-
errors: () => ReturnType<InlangProject["errors"]>
|
|
56
|
-
settings: () => ReturnType<InlangProject["settings"]>
|
|
57
|
-
setSettings: InlangProject["setSettings"]
|
|
58
|
-
query: {
|
|
59
|
-
messages: {
|
|
60
|
-
create: MessageQueryApi["create"]
|
|
61
|
-
update: MessageQueryApi["update"]
|
|
62
|
-
delete: MessageQueryApi["delete"]
|
|
63
|
-
upsert: MessageQueryApi["upsert"]
|
|
64
|
-
get: MessageQueryApi["get"]
|
|
65
|
-
//get: (args: Parameters<MessageQueryApi["get"]>[0]) => ReturnType<MessageQueryApi["get"]>
|
|
66
|
-
getAll: () => ReturnType<MessageQueryApi["getAll"]>
|
|
67
|
-
includedMessageIds: () => ReturnType<MessageQueryApi["includedMessageIds"]>
|
|
68
|
-
}
|
|
69
|
-
messageLintReports: {
|
|
70
|
-
get: MessageLintReportsQueryApi["get"]
|
|
71
|
-
getAll: () => ReturnType<MessageLintReportsQueryApi["getAll"]>
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// const x = {} as InlangProjectWithSolidAdapter
|
|
77
|
-
// x.query.lintReports.getAll()
|
|
78
|
-
|
|
79
|
-
// console.log(await x.lint())
|
package/src/api.test-d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { ProjectSettings } from "@inlang/project-settings"
|
|
2
|
-
import type { InlangProject } from "./api.js"
|
|
3
|
-
import { expectType } from "tsd"
|
|
4
|
-
|
|
5
|
-
const project: InlangProject = {} as any
|
|
6
|
-
|
|
7
|
-
// it should not have potentially undefined settings.
|
|
8
|
-
expectType<ProjectSettings>(project.settings())
|