-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(schema): enable shape upsert operation
- Loading branch information
Showing
5 changed files
with
22 additions
and
59 deletions.
There are no files selected for viewing
This file contains 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 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 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,28 +1,17 @@ | ||
import { z } from 'zod'; | ||
import { | ||
CreateDocumentShapeInputSchema, | ||
CreateFolderShapeInputSchema, | ||
CreateProductShapeInputSchema, | ||
UpdateShapeInputSchema, | ||
} from '../pim/shape/index.js'; | ||
import { CreateShapeInputSchema, UpdateShapeInputSchema } from '../pim/shape/index.js'; | ||
|
||
export const CreateDocumentShapeOperationSchema = CreateDocumentShapeInputSchema.extend({ | ||
intent: z.literal('shape/create/document'), | ||
export const CreateShapeOperationSchema = CreateShapeInputSchema.extend({ | ||
intent: z.literal('shape/create'), | ||
}); | ||
export type CreateDocumentShapeOperation = z.infer<typeof CreateDocumentShapeOperationSchema>; | ||
|
||
export const CreateFolderShapeOperationSchema = CreateFolderShapeInputSchema.extend({ | ||
intent: z.literal('shape/create/folder'), | ||
}); | ||
export type CreateFolderShapeOperation = z.infer<typeof CreateDocumentShapeOperationSchema>; | ||
|
||
export const CreateProductShapeOperationSchema = CreateProductShapeInputSchema.extend({ | ||
intent: z.literal('shape/create/product'), | ||
}); | ||
export type CreateProductShapeOperation = z.infer<typeof CreateProductShapeOperationSchema>; | ||
export type CreateShapeOperation = z.infer<typeof CreateShapeOperationSchema>; | ||
|
||
export const UpdateShapeOperationSchema = UpdateShapeInputSchema.extend({ | ||
intent: z.literal('shape/update'), | ||
identifier: z.string().min(1), | ||
}); | ||
export type UpdateShapeOperation = z.infer<typeof UpdateShapeOperationSchema>; | ||
|
||
export const UpsertShapeOperationSchema = CreateShapeOperationSchema.extend({ | ||
intent: z.literal('shape/upsert'), | ||
}); | ||
export type UpsertShapeOperation = z.infer<typeof UpsertShapeOperationSchema>; |
This file contains 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 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