Unique ids for v2 Message and Variant types
Adds persisted unique identifiers for v2 Messages and Variants.
Resolves https://github.com/opral/inlang-message-sdk/issues/92 (MESDK-132)
Step 4 in https://github.com/opral/inlang-message-sdk/issues/70
The main goal of this change is to enable lint reports to reference Messages and Variants. This should also help apps to perform crud operations on Messages and Variants without resorting to array indexes for ids.
NOTE: This is a breaking change on the v2 MessageBundle AST
- [x] add
idstring property on v2 Message and Variant types - [x] randomId() function - returns new unique id string using ~~crypto.randomUUID()~~ uuid npm package (for now)
- [x] modify createMessageBundle() and createMessage() helpers, and add createVariant() helper
- [x] fix v1 <=> v2 message conversion - note that the new Message and Variant ids are not preserved round trip (this conversion is only used temporarily in the experimental persistence feature-flagged version of cli translate)
- [x] fix mocks and tests to add id properties, and accommodate non-deterministic (random) ids
- [x] minimal changes to message-bundle-component to make tests work
- [x] changeset
cc: @martin-lysk because of impact on Slot persistence
cc: @NilsJacobsen because of impact on the WIP message-bundle-component
🦋 Changeset detected
Latest commit: 2f603a63842bf26e6df672d54fe53b45dd8dc72d
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 25 packages
| Name | Type |
|---|---|
| @inlang/sdk | Minor |
| @inlang/message-bundle-component | Patch |
| @inlang/badge | Patch |
| @inlang/doc-layout-component | Patch |
| @inlang/editor | Patch |
| @inlang/github-lint-action | Patch |
| vs-code-extension | Patch |
| @inlang/rpc | Patch |
| @inlang/settings-component | Patch |
| @inlang/telemetry | Patch |
| @inlang/cross-sell-ninja | Patch |
| @inlang/plugin-i18next | Patch |
| @inlang/plugin-json | Patch |
| @inlang/plugin-m-function-matcher | Patch |
| @inlang/plugin-next-intl | Patch |
| @inlang/plugin-t-function-matcher | Patch |
| @inlang/paraglide-unplugin | Patch |
| @inlang/paraglide-js-e2e | Patch |
| @inlang/paraglide-next-e2e | Patch |
| @inlang/paraglide-rollup | Patch |
| @inlang/paraglide-vite | Patch |
| @inlang/paraglide-webpack | Patch |
| @inlang/paraglide-astro | Patch |
| @inlang/paraglide-sveltekit | Patch |
| @inlang/paraglide-sveltekit-example | Patch |
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
Thanks @NilsJacobsen I make a few message-bundle-component changes to fix tests and the build is working locally, but still failing in CI. Any ideas? https://github.com/opral/monorepo/actions/runs/9549090991/job/26317852306?pr=2937#step:8:3542
Okey wait, I gonna make the adjustments in this PR. Give me some minutes.
Hmm I don't know where the problem comes from. Maybe the nx cache gets confused somewhere and links still to an old version of the sdk/v2. We can try to reset and try again.
Trying again with latest from main.
@NilsJacobsen I believe I have found the issue - I missed on place where you used upsertVariant with a literal variant object. For some reason the build was working locally even though it should not. I think you may be right about the NX cache. 😬
closing because outdated