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

Tuple types are still causing Hydra Typegen to fail #398

Closed
Lezek123 opened this issue May 18, 2021 · 0 comments · Fixed by #403
Closed

Tuple types are still causing Hydra Typegen to fail #398

Lezek123 opened this issue May 18, 2021 · 0 comments · Fixed by #403

Comments

@Lezek123
Copy link
Contributor

Hydra version: 3.0.0-beta.6

After the fix in #373, there is still an issue in the generated files:

    export class PostDeletedEvent {
        public readonly expectedParamTypes = ['Vec<u8>', 'ForumUserId', 'Vec<(CategoryId, ThreadId, PostId, bool)>', ]

        constructor(public readonly ctx: SubstrateEvent) {}

        get params(): [Bytes,ForumUserId,Vec<(CategoryId,ThreadId,PostId,bool)>] {
            

            return [createTypeUnsafe<Bytes & Codec>(
            typeRegistry, 'Bytes', [this.ctx.params[0].value]) ,
createTypeUnsafe<ForumUserId & Codec>(
            typeRegistry, 'ForumUserId', [this.ctx.params[1].value]) ,
createTypeUnsafe<Vec<(CategoryId,ThreadId,PostId,bool)> & Codec>(
            typeRegistry, 'Vec<(CategoryId,ThreadId,PostId,bool)>', [this.ctx.params[2].value]) ]
        }
        /* ... */

For example:

[error] mappings/generated/types/forum.ts: SyntaxError: '=>' expected. (454:79)
[error]   452 |         constructor(public readonly ctx: SubstrateEvent) {}
[error]   453 | 
[error] > 454 |         get params(): [Bytes,ForumUserId,Vec<(CategoryId,ThreadId,PostId,bool)>] {
dzhelezov added a commit to dzhelezov/hydra that referenced this issue May 21, 2021
affects: @dzlzv/hydra-typegen

tuples of the form (T1, T2, T3) are recursively replaced with [T1,T2,T3] & Codec

ISSUES CLOSED: Joystream#398
dzhelezov added a commit that referenced this issue May 21, 2021
affects: @dzlzv/hydra-typegen

tuples of the form (T1, T2, T3) are recursively replaced with [T1,T2,T3] & Codec

ISSUES CLOSED: #398
dzhelezov pushed a commit to dzhelezov/hydra that referenced this issue Jun 9, 2021
affects: @dzlzv/hydra-cli

feat(hydra-cli): add filtering support to interfaces by implementers

affects: @dzlzv/hydra-cli

fix(hydra-cli): make 'implementers' nullable

affects: @dzlzv/hydra-cli

fix(hydra-cli): replace string check with enum options

affects: @dzlzv/hydra-cli

test(hydra-cli): interface relations tests

affects: @dzlzv/hydra-cli

fix(hydra-cli): object property name duplication

affects: @dzlzv/hydra-cli

fix(hydra-cli): rename fieldName naming strategy toLower->camelCase

affects: @dzlzv/hydra-cli

fix(hydra-cli): add guards for fetching interface relations

affects: @dzlzv/hydra-cli

fix(hydra-cli): update filtered types based on '_in, _eq' operators

affects: @dzlzv/hydra-cli

test(hydra-e2e-tests): query interfaces with enum

affects: hydra-e2e-tests

fix(hydra-typegen): do proper handling of tuples in typegen (Joystream#403)

affects: @dzlzv/hydra-typegen

tuples of the form (T1, T2, T3) are recursively replaced with [T1,T2,T3] & Codec

ISSUES CLOSED: Joystream#398

feat(hydra-cli) relations filtering: single query design (Joystream#402)

* feat(hydra-cli): single-query implementation of relationship filtering

affects: @dzlzv/hydra-cli

* feat(hydra-cli): add support for a single-query relationship filters

affects: @dzlzv/hydra-cli

Builds a complex SQL subqueries using Warthog's query builders to filter out the relation field. To
make things work, additional subclass WarthogBaseService is introduced, together with utils

ISSUES CLOSED: Joystream#391

* test(hydra-e2e-tests): add e2e tests for relations filtering

affects: hydra-e2e-tests

* chore(sample): cleanup sample project

affects: sample, sample-mappings

* fix(hydra-cli): apply take-limit at the end of the relations filtering query

affects: @dzlzv/hydra-cli

fix(hydra-cli): fix derived field naming and add test

affects: @dzlzv/hydra-cli

feat(hydra-cli): implementators no longer directly extend the interface classes and so the fields ar

affects: @dzlzv/hydra-cli

feat(hydra-cli): extract orderBy methods in WarthogBaseService

affects: @dzlzv/hydra-cli

feat(hydra-cli): optimized implementation of interfaces fetching

affects: @dzlzv/hydra-cli

fully reworked immplemntation of the interfaces service with minumal dependency on the code
generation. First, IDs are fetched from a union of each implementation table satifing the filter,
and afterwards each table is queried separately by those IDs.

fix(hydra-cli): add TYPEORM_LOGGING option to the graphql-server

affects: @dzlzv/hydra-cli

test(hydra-e2e-test): add e2e tests for interface queries

affects: hydra-e2e-tests
dzhelezov pushed a commit to dzhelezov/hydra that referenced this issue Jun 9, 2021
affects: @dzlzv/hydra-cli

feat(hydra-cli): add filtering support to interfaces by implementers

affects: @dzlzv/hydra-cli

fix(hydra-cli): make 'implementers' nullable

affects: @dzlzv/hydra-cli

fix(hydra-cli): replace string check with enum options

affects: @dzlzv/hydra-cli

test(hydra-cli): interface relations tests

affects: @dzlzv/hydra-cli

fix(hydra-cli): object property name duplication

affects: @dzlzv/hydra-cli

fix(hydra-cli): rename fieldName naming strategy toLower->camelCase

affects: @dzlzv/hydra-cli

fix(hydra-cli): add guards for fetching interface relations

affects: @dzlzv/hydra-cli

fix(hydra-cli): update filtered types based on '_in, _eq' operators

affects: @dzlzv/hydra-cli

test(hydra-e2e-tests): query interfaces with enum

affects: hydra-e2e-tests

fix(hydra-typegen): do proper handling of tuples in typegen (Joystream#403)

affects: @dzlzv/hydra-typegen

tuples of the form (T1, T2, T3) are recursively replaced with [T1,T2,T3] & Codec

ISSUES CLOSED: Joystream#398

feat(hydra-cli) relations filtering: single query design (Joystream#402)

* feat(hydra-cli): single-query implementation of relationship filtering

affects: @dzlzv/hydra-cli

* feat(hydra-cli): add support for a single-query relationship filters

affects: @dzlzv/hydra-cli

Builds a complex SQL subqueries using Warthog's query builders to filter out the relation field. To
make things work, additional subclass WarthogBaseService is introduced, together with utils

ISSUES CLOSED: Joystream#391

* test(hydra-e2e-tests): add e2e tests for relations filtering

affects: hydra-e2e-tests

* chore(sample): cleanup sample project

affects: sample, sample-mappings

* fix(hydra-cli): apply take-limit at the end of the relations filtering query

affects: @dzlzv/hydra-cli

fix(hydra-cli): fix derived field naming and add test

affects: @dzlzv/hydra-cli

feat(hydra-cli): implementators no longer directly extend the interface classes and so the fields ar

affects: @dzlzv/hydra-cli

feat(hydra-cli): extract orderBy methods in WarthogBaseService

affects: @dzlzv/hydra-cli

feat(hydra-cli): optimized implementation of interfaces fetching

affects: @dzlzv/hydra-cli

fully reworked immplemntation of the interfaces service with minumal dependency on the code
generation. First, IDs are fetched from a union of each implementation table satifing the filter,
and afterwards each table is queried separately by those IDs.

fix(hydra-cli): add TYPEORM_LOGGING option to the graphql-server

affects: @dzlzv/hydra-cli

test(hydra-e2e-test): add e2e tests for interface queries

affects: hydra-e2e-tests
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 a pull request may close this issue.

1 participant