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

SET account relation support #206

Merged
merged 7 commits into from
Feb 5, 2024
Merged

Conversation

PaulLeCam
Copy link
Contributor

There's a bunch of unrelated changes due to the breaking changes in Ceramic APIs, as well as fixing some new linting errors caught by ESLint, but the main relevant changes are:

  • Adding support for using the SET value as the accountRelation in the composite definition schema, as well as the accountRelationFields
  • Generating queries based on the SET account relation, both for a unique value (with a dedicated input) and all values (similar to the LIST account relation)
  • Generating mutations to create and update documents using the SET account relation
  • Adding new set[Model name] mutations in addition to the now deprecated create[Model name] for SINGLE account relations, for consistency with the SET account relation mutations

ukstv
ukstv previously approved these changes Feb 2, 2024
Copy link

@ukstv ukstv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor not-important nitpicks. Can be ignored.

await assertSupportedReadModelController(model, commit as unknown as SignedCommitContainer)
})
await Promise.all(
modelCommitsValues.filter(isSignedCommitContainer).map(async (commit: StreamCommits) => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here async and await marks could be omitted. Less troubles for Node.js to unpack the promises.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have more details why it causes troubles for Node please? For V8 using async/await is more optimized than hand-written promises.

case 'single':
runtime.accountData[key] = { type: 'node', name: modelName }
break
default:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have UnreachableCaseError to have exhaustiveness check.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I might add this at some point but I'd rather avoid importing more dependencies/APIs from Ceramic if that can be avoided.

Copy link
Contributor

@JulissaDantes JulissaDantes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! The only thing I would say is that I wish you would have done a PR addressing the adaptations to js-ceramic changes first, and then this one.

@PaulLeCam
Copy link
Contributor Author

LGTM! The only thing I would say is that I wish you would have done a PR addressing the adaptations to js-ceramic changes first, and then this one.

Thanks!
Yeah if I had known there would be breaking changes in Ceramic I would have done it differently, but it was unexpected to have to deal with it just to get this PR working.

@PaulLeCam PaulLeCam merged commit cf49049 into main Feb 5, 2024
5 checks passed
@PaulLeCam PaulLeCam deleted the feat/WS2-2950-set-account-relation branch February 5, 2024 20:15
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.

3 participants