Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fix type errors in translation api e2e test #619

Conversation

EvanHahn
Copy link
Contributor

@EvanHahn EvanHahn commented May 7, 2024

To be merged into #473.

See this comment.

@EvanHahn EvanHahn requested a review from tomasciccola May 7, 2024 18:13
@tomasciccola tomasciccola merged commit 1670644 into feat/record-translations-opts-lang May 7, 2024
4 checks passed
@tomasciccola tomasciccola deleted the avoid-ts-errors-in-translationapi-e2e-test-in-473 branch May 7, 2024 18:20
tomasciccola added a commit that referenced this pull request May 7, 2024
* feat: Add `lang` option to DataType read operations

* update typescript defs

* add getMany support

* initial implementation of `TranslationApi`

* * add @types/json-stable-strinfify
* start writing unit tests
* error handling for missing translation
* fix error in sql query

* * remove `message` from object when hashing
* fix logic error when `put`
* handle unexisting key in the indexing (by creating a new Set)
* make `fieldRef` and `regionCode` optional when `get`

* improve `get()` by ignoring not translated languages, improve typing

* * make `index` private, run it on `put`
* expose cache map through symbol and getter
* improve `get` signature (by making `fieldRef` and `regionCode`
  optional)
* add more unit tests

* revert `index` as private method, update tests

* update magic-bytes manually

* add e2e/translation-api.js and expose translation api in mapeo project

* * add translationTable to index writer
* add translationDoc to entries for batching indexer
* move decoding of translationDoc into `.index` function in
  translationApi

* rever changes to `.index` method (better to accept doc than block)

* first e2e tests

* revert regionCode fallback (since its handled in an upper layer)

* use default config for translationApi e2e tests, test with a bunch of
translations

* add translation fixtures

* add check of expected translation

* improve test messages

* add assertion of matching preset docId with translation docIdRef

* add tests and fixture for fields

* Integrate actual translation-api in DataType

* add type to translation

* Promise.all translation on getMany

* datatype clean, type translationApi in tests

* add fallback when not matching `regionCode`, test that

* re-add misterious dissapearing //ts-expect error on datatype

* Apply suggestions from code review

* Have better typing on `getByDocId` result
* Avoid extra translation lookup
* remove ts-ignore

Co-authored-by: Evan Hahn <me@evanhahn.com>

* revert removal of translation object clone in datatype

* check if `fieldRef` is string before setting the property

* Fix "use before define" issue with DataType & TranslationApi (#604)

`DataType` needs access to `TranslationApi.prototype.get`, but
`TranslationApi` needs access to `DataType`. To avoid this circular
reference, pass a `getTranslations` function into `DataType`.

* add e2e tests

* add e2e tests for presets

* chore: fix type errors in translation api e2e test (#619)

See [this comment](https://github.com/digidem/mapeo-core-next/pull/473/files/a51f709ca5edf7eec82c37ab922eab81433119c3#diff-8d53b37e24956c77fbf7b47691ded78c4b5c35010b94ad0b7e3d4dc49bcb6419).

---------

Co-authored-by: Tomás Ciccola <tciccola@digital-democracy.com>
Co-authored-by: tomasciccola <117094913+tomasciccola@users.noreply.github.com>
Co-authored-by: Evan Hahn <me@evanhahn.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants