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

fix: Add exports to build customer declaration files for combine schema #386

Merged
merged 5 commits into from
Nov 12, 2024

Conversation

zxl629
Copy link
Contributor

@zxl629 zxl629 commented Nov 7, 2024

Related issues:

Description of changes:
This change expands the tests originally created by @stocaaro. It introduces a new e2e test application that fails to build due to missing exports needed to construct customer *.d.ts project files.

The change then introduces the missing exports to @aws-amplify/data-schema needed to get this build to work.

Example of why we need this:

Customers with combine schema get compiler errors when they enable declarations in their compilerOptions:

const schema = a.schema({
  Todo: a
    .model({
      content: a.string(),
    })
    .authorization((allow) => [allow.guest()]),
});
const sqlSchema = generatedSqlSchema.authorization(allow => allow.guest());
const combinedSchema = a.combine([schema, sqlSchema]);

Results in the compile error:
The inferred type of 'buildCombineSchema' cannot be named without a reference to '../node_modules/@aws-amplify/data-schema/dist/esm/CombineSchema'. This is likely not portable. A type annotation is necessary.

This change adheres to the rules regarding new exported types to prevent breaking changes:

  • We must no remove functions
  • We must not add un-defaulted Generics
  • We must not add required param shape options

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Copy link

changeset-bot bot commented Nov 7, 2024

🦋 Changeset detected

Latest commit: ea98fbe

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
integration-tests Patch
@aws-amplify/data-schema 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

@zxl629 zxl629 marked this pull request as ready for review November 8, 2024 19:54
@zxl629 zxl629 requested review from a team as code owners November 8, 2024 19:54
@zxl629 zxl629 marked this pull request as draft November 9, 2024 00:14
@zxl629 zxl629 marked this pull request as ready for review November 11, 2024 18:11
@zxl629 zxl629 merged commit 723b301 into main Nov 12, 2024
9 checks passed
@zxl629 zxl629 deleted the lzhouq/fix/combine-exports branch November 12, 2024 19:23
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