-
Notifications
You must be signed in to change notification settings - Fork 6
Adapt ArkType as a core technology #213
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
Merged
Merged
Changes from 8 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
1a04418
feat: Replace TypeBox with Zod as a dependency.
yamcodes 4a69c25
refactor: Replace Elysia's `t.Void` with Zod's `z.void()` for the `NO…
yamcodes a1b269c
refactor: replace Zod with Arktype for schema validation.
yamcodes 75c2632
feat: Update Arktype response types from 'void' to 'type("undefined")…
yamcodes b1c9a83
refactor: Wrap DTO regexes in `type()` calls for schema validation an…
yamcodes a60b792
refactor: Use `arkregex` for defining regex patterns in `CreateUserDto`.
yamcodes 0ef5f81
feat: Add ArkType as a core Bedstack component and update all related…
yamcodes 752236f
docs: Remove ArkType entry from homepage.
yamcodes 2035043
Refine error path assignment, update user DTO and comments API respon…
yamcodes 123bd41
[autofix.ci] apply automated fixes
autofix-ci[bot] 705c24a
docs: refine ArkType description in `what-is-bedstack.md` for accuracy.
yamcodes cf3e03e
docs: refine ArkType type inference description from "best-in-class" …
yamcodes f0ff737
docs: improve clarity and conciseness across various documentation fi…
yamcodes b14d99f
docs: remove GOVERNANCE.md and clarify Drizzle v1 Beta support in REA…
yamcodes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,22 +1,23 @@ | ||
| import { t } from 'elysia'; | ||
| import { type } from 'arktype'; | ||
|
|
||
| export const ArticleResponseDto = t.Object({ | ||
| article: t.Object({ | ||
| slug: t.String(), | ||
| title: t.String(), | ||
| description: t.String(), | ||
| body: t.String(), | ||
| tagList: t.Array(t.String()), | ||
| createdAt: t.String(), | ||
| updatedAt: t.String(), | ||
| favorited: t.Boolean(), | ||
| favoritesCount: t.Number(), | ||
| author: t.Object({ | ||
| username: t.String(), | ||
| bio: t.Union([t.Null(), t.String()]), | ||
| image: t.Union([t.Null(), t.String()]), | ||
| following: t.Boolean(), | ||
| }), | ||
| }), | ||
| export const ArticleResponseDto = type({ | ||
| article: { | ||
| slug: 'string', | ||
| title: 'string', | ||
| description: 'string', | ||
| body: 'string', | ||
| tagList: 'string[]', | ||
| createdAt: 'string', | ||
| updatedAt: 'string', | ||
| favorited: 'boolean', | ||
| favoritesCount: 'number', | ||
| author: { | ||
| username: 'string', | ||
| 'bio?': 'string | null', | ||
| 'image?': 'string | null', | ||
| following: 'boolean', | ||
| }, | ||
| }, | ||
| }); | ||
| export type ArticleResponseDto = typeof ArticleResponseDto.static; | ||
|
|
||
| export type ArticleResponseDto = typeof ArticleResponseDto.infer; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,9 @@ | ||
| import { t } from 'elysia'; | ||
| import { type } from 'arktype'; | ||
| import { ArticleResponseDto } from './article-response.dto'; | ||
|
|
||
| export const ArticlesResponseDto = t.Object({ | ||
| articles: t.Array(t.Omit(ArticleResponseDto.properties.article, ['body'])), | ||
| articlesCount: t.Number(), | ||
| export const ArticlesResponseDto = type({ | ||
| articles: ArticleResponseDto.get('article').omit('body').array(), | ||
| articlesCount: 'number', | ||
| }); | ||
| export type ArticlesResponseDto = typeof ArticlesResponseDto.static; | ||
|
|
||
| export type ArticlesResponseDto = typeof ArticlesResponseDto.infer; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,12 @@ | ||
| import { t } from 'elysia'; | ||
| import { type } from 'arktype'; | ||
|
|
||
| export const CreateArticleDto = t.Object({ | ||
| article: t.Object({ | ||
| title: t.String({ minLength: 1 }), | ||
| description: t.String({ minLength: 1 }), | ||
| body: t.String({ minLength: 1 }), | ||
| tagList: t.Optional(t.Array(t.String({ minLength: 1 }))), | ||
| }), | ||
| export const CreateArticleDto = type({ | ||
| article: { | ||
| title: 'string > 0', | ||
| description: 'string > 0', | ||
| body: 'string > 0', | ||
| 'tagList?': 'string[]', | ||
| }, | ||
| }); | ||
| export type CreateArticleDto = typeof CreateArticleDto.static; | ||
|
|
||
| export type CreateArticleDto = typeof CreateArticleDto.infer; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,9 @@ | ||
| import { t } from 'elysia'; | ||
| import { ArticleFeedQueryDto } from './article-feed-query.dto'; | ||
|
|
||
| export const ListArticlesQueryDto = t.Composite([ | ||
| ArticleFeedQueryDto, | ||
| t.Object({ | ||
| tag: t.Optional(t.String({ minLength: 1 })), | ||
| author: t.Optional(t.String({ minLength: 1 })), | ||
| favorited: t.Optional(t.String({ minLength: 1 })), | ||
| }), | ||
| ]); | ||
| export type ListArticlesQueryDto = typeof ListArticlesQueryDto.static; | ||
| export const ListArticlesQueryDto = ArticleFeedQueryDto.merge({ | ||
| 'tag?': 'string > 0', | ||
| 'author?': 'string > 0', | ||
| 'favorited?': 'string > 0', | ||
| }); | ||
|
|
||
| export type ListArticlesQueryDto = typeof ListArticlesQueryDto.infer; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,8 @@ | ||
| import { t } from 'elysia'; | ||
| import { type } from 'arktype'; | ||
| import { CreateArticleDto } from './create-article.dto'; | ||
|
|
||
| export const UpdateArticleDto = t.Object({ | ||
| article: t.Partial(CreateArticleDto.properties.article), | ||
| export const UpdateArticleDto = type({ | ||
| article: CreateArticleDto.get('article').partial(), | ||
| }); | ||
| export type UpdateArticleDto = typeof UpdateArticleDto.static; | ||
|
|
||
| export type UpdateArticleDto = typeof UpdateArticleDto.infer; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,18 +1,18 @@ | ||
| import { t } from 'elysia'; | ||
| import { type } from 'arktype'; | ||
|
|
||
| export const CommentResponseDto = t.Object({ | ||
| comment: t.Object({ | ||
| id: t.Number(), | ||
| body: t.String(), | ||
| createdAt: t.String(), | ||
| updatedAt: t.String(), | ||
| author: t.Object({ | ||
| username: t.String(), | ||
| bio: t.Union([t.Null(), t.String()]), | ||
| image: t.Union([t.Null(), t.String()]), | ||
| following: t.Boolean(), | ||
| }), | ||
| }), | ||
| export const CommentResponseDto = type({ | ||
| comment: { | ||
| id: 'number', | ||
| body: 'string', | ||
| createdAt: 'string', | ||
| updatedAt: 'string', | ||
| author: { | ||
| username: 'string', | ||
| 'bio?': 'string | null', | ||
| 'image?': 'string | null', | ||
| following: 'boolean', | ||
| }, | ||
| }, | ||
| }); | ||
|
|
||
| export type CommentResponseDto = typeof CommentResponseDto.static; | ||
| export type CommentResponseDto = typeof CommentResponseDto.infer; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,8 @@ | ||
| import { t } from 'elysia'; | ||
| import { type } from 'arktype'; | ||
| import { CommentResponseDto } from './comment-response.dto'; | ||
|
|
||
| export const CommentsResponseDto = t.Object({ | ||
| comments: t.Array(CommentResponseDto.properties.comment), | ||
| export const CommentsResponseDto = type({ | ||
| comments: CommentResponseDto.get('comment').array(), | ||
| }); | ||
| export type CommentsResponseDto = typeof CommentsResponseDto.static; | ||
|
|
||
| export type CommentsResponseDto = typeof CommentsResponseDto.infer; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,9 @@ | ||
| import { t } from 'elysia'; | ||
| import { type } from 'arktype'; | ||
|
|
||
| export const CreateCommentDto = t.Object({ | ||
| comment: t.Object({ | ||
| body: t.String({ minLength: 1 }), | ||
| }), | ||
| export const CreateCommentDto = type({ | ||
| comment: { | ||
| body: 'string > 0', | ||
| }, | ||
| }); | ||
| export type CreateCommentDto = typeof CreateCommentDto.static; | ||
|
|
||
| export type CreateCommentDto = typeof CreateCommentDto.infer; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,12 @@ | ||
| import { t } from 'elysia'; | ||
| import { type } from 'arktype'; | ||
|
|
||
| export const profileResponseSchema = t.Object({ | ||
| profile: t.Object({ | ||
| username: t.String(), | ||
| bio: t.Union([t.String(), t.Null()]), | ||
| image: t.Union([t.String(), t.Null()]), | ||
| following: t.Boolean(), | ||
| }), | ||
| export const profileResponseSchema = type({ | ||
| profile: { | ||
| username: 'string', | ||
| 'bio?': 'string | null', | ||
| 'image?': 'string | null', | ||
| following: 'boolean', | ||
| }, | ||
| }); | ||
|
|
||
| export type ProfileResponseDto = typeof profileResponseSchema.static; | ||
| export type ProfileResponseDto = typeof profileResponseSchema.infer; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.