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

Hide system files attrs from CLI #901

Merged
merged 2 commits into from
Feb 20, 2025
Merged

Hide system files attrs from CLI #901

merged 2 commits into from
Feb 20, 2025

Conversation

nezaj
Copy link
Contributor

@nezaj nezaj commented Feb 19, 2025

Previously when we pulled from the CLI we'd get things like

$files: i.entity({
  "content-disposition": i.string().indexed(),
  "content-type": i.string().indexed(),
  "key-version": i.number(),
  "location-id": i.string().unique().indexed(),
  path: i.string().unique().indexed(),
  size: i.number().indexed(),
})

But things like key-version and location-id aren't relevant to users. For most folkscontent-type, content-disposition and size won't be used either.

With this change pulling from the CLI will return

$files: i.entity({
  path: i.string().unique().indexed(),
  url: i.string(),
})

If a user does want to leverage fields like content-type in their app they can add these fields into instant.schema.ts and when they use instant-cli push the plan! step will ignore the hidden fields, avoiding errors like

[error] Failed to update schema.
[error] Validation failed for schema
[error] schema: $files->content-type: Duplicate entry found for attribute. Check your schema file for duplicate link definitions. If it's not in the schema fi
le, it may have been generated by the backend. Check your full schema in the dashboard: https://www.instantdb.com/dash?s=main&t=explorer

Copy link

View Vercel preview at instant-www-js-hide-file-attrs-jsv.vercel.app.

Copy link
Contributor

@stopachka stopachka left a comment

Choose a reason for hiding this comment

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

Nice!

@nezaj nezaj merged commit e448c45 into main Feb 20, 2025
29 checks passed
@nezaj nezaj deleted the hide-file-attrs branch February 20, 2025 17:49
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