@vexcms/core 0.0.19 → 0.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3451,6 +3451,7 @@ function buildApiCreateDocument(_props) {
|
|
|
3451
3451
|
userRoles: roles,
|
|
3452
3452
|
resource: SLUG,
|
|
3453
3453
|
action: "create",
|
|
3454
|
+
data: (args.fields as Record<string, unknown>) ?? {},
|
|
3454
3455
|
throwOnDenied: true,
|
|
3455
3456
|
})
|
|
3456
3457
|
const collection = findCollectionBySlug({ slug: SLUG, config: vexConfig })
|
|
@@ -3470,12 +3471,14 @@ function buildApiUpdateDocument(props) {
|
|
|
3470
3471
|
args: { id: v.id("${tableName}"), fields: v.any() },
|
|
3471
3472
|
handler: async (ctx, args) => {
|
|
3472
3473
|
const { user, roles } = await requireAuth(ctx)
|
|
3474
|
+
const existingDoc = await ctx.db.get(args.id)
|
|
3473
3475
|
hasPermission({
|
|
3474
3476
|
access: vexConfig.access,
|
|
3475
3477
|
user,
|
|
3476
3478
|
userRoles: roles,
|
|
3477
3479
|
resource: SLUG,
|
|
3478
3480
|
action: "update",
|
|
3481
|
+
data: (existingDoc as Record<string, unknown>) ?? {},
|
|
3479
3482
|
throwOnDenied: true,
|
|
3480
3483
|
})
|
|
3481
3484
|
const collection = findCollectionBySlug({ slug: SLUG, config: vexConfig })
|
|
@@ -3495,12 +3498,14 @@ function buildApiDeleteDocument(props) {
|
|
|
3495
3498
|
args: { id: v.id("${tableName}") },
|
|
3496
3499
|
handler: async (ctx, args) => {
|
|
3497
3500
|
const { user, roles } = await requireAuth(ctx)
|
|
3501
|
+
const doc = await ctx.db.get(args.id)
|
|
3498
3502
|
hasPermission({
|
|
3499
3503
|
access: vexConfig.access,
|
|
3500
3504
|
user,
|
|
3501
3505
|
userRoles: roles,
|
|
3502
3506
|
resource: SLUG,
|
|
3503
3507
|
action: "delete",
|
|
3508
|
+
data: (doc as Record<string, unknown>) ?? {},
|
|
3504
3509
|
throwOnDenied: true,
|
|
3505
3510
|
})
|
|
3506
3511
|
await deleteDocument({
|