Skip to content

Conversation

@Convly
Copy link
Member

@Convly Convly commented Feb 4, 2025

What does it do?

Add four new types and interfaces to the public SDK surface:

  • Strapi represents the sdk instance API
  • StrapiConfig is the configuration object that is used to configure the strapi instance
  • CollectionTypeManager is the object returned by a call to client.collection('<ct>')
  • SingleTypeManager is the object returned by a call to client.single('<st>')

Why is it needed?

Allow users to reference common sdk objects in their code without having to infer them from values

How to test it?

  • Build the bundles & setup the demos
  • Head to the TS demo
  • You should be able to import the types and use them as expected. You should not be able to use them as values.

Related issue(s)/PR(s)

resolves #33

@Convly Convly added pr: enhancement Refactorings / perfs / testing / translations source: client Source is the main client object labels Feb 4, 2025
@innerdvations
Copy link
Contributor

This is a good compromise (compared with exporting everything), especially since all of these are so directly touched by the user anyway.

Do you foresee any difficulties exposing CollectionTypeManager and SingleTypeManager considering the plans to add typings based on the project schemas?

@Convly
Copy link
Member Author

Convly commented Feb 4, 2025

Do you foresee any difficulties exposing CollectionTypeManager and SingleTypeManager considering the plans to add typings based on the project schemas?

I don't forecast any difficulty with that to be honest. But if we end up having breaking changes we could just use the occasion to release v2

Copy link
Contributor

@innerdvations innerdvations left a comment

Choose a reason for hiding this comment

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

Works for me!

@Convly Convly merged commit 8009f4e into main Feb 4, 2025
7 checks passed
@Convly Convly deleted the enhancement/export-common-types branch February 4, 2025 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr: enhancement Refactorings / perfs / testing / translations source: client Source is the main client object

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feat]: export types

2 participants