chore: import upstream snapshot with attribution

This commit is contained in:
wehub-resource-sync
2026-07-13 13:34:48 +08:00
commit 77bb5bf71f
3762 changed files with 353249 additions and 0 deletions
@@ -0,0 +1,23 @@
import { z } from '@botpress/sdk'
export const webhookEvent = z.object({
type: z.string().title('Type').describe('The type of event'),
organizationId: z.string().title('Organization Id').describe('Organization associated with the event'),
id: z.string().title('Id').describe('ID of the event'),
webhookId: z.string().title('Webhook Id').describe('The ID of the webhook').optional(),
createdAt: z.string().title('Created At').describe('Date when the event was created').optional(),
deliveryStatus: z.string().title('Delivery Status').describe('The status of the event').optional(),
firstSentAt: z.string().title('First Sent At').describe('First delivery time').optional(),
deliveryAttempts: z
.number()
.title('Delivery Attempts')
.describe('The number of times the event tried to be delivered')
.optional(),
})
export const userSchema = z.object({
id: z.string(),
email: z.string().optional(),
name: z.string().optional(),
profilePicture: z.string().optional(),
})
@@ -0,0 +1 @@
export * from './posts'
@@ -0,0 +1,96 @@
import { z, EventDefinition } from '@botpress/sdk'
import { webhookEvent, userSchema } from './common'
const postSchema = z.object({
id: z.string().title('Id').optional(),
type: z.string().title('Type').optional(),
title: z.string().title('Title').optional(),
content: z.string().title('Content').optional(),
user: userSchema.title('User').optional(),
postStatus: z
.object({
name: z.string().optional(),
type: z.string().optional(),
id: z.string().optional(),
})
.title('Post Status')
.optional(),
postCategory: z
.object({
category: z.string().optional(),
id: z.string().optional(),
})
.title('Post Category')
.optional(),
date: z.string().title('Date').optional(),
slug: z.string().title('Slug').optional(),
categoryId: z.string().title('Category Id').optional(),
})
export const postCreated = {
title: 'Post Created',
description: 'A post was created on a board.',
schema: webhookEvent.extend({
topic: z.literal('post.created').title('Topic').describe('The topic of the event'),
data: z
.object({
item: postSchema,
})
.title('Data')
.describe('Event data'),
}),
} satisfies EventDefinition
export const postUpdated = {
title: 'Post Updated',
description: 'A post was updated on a board.',
schema: webhookEvent.extend({
topic: z.literal('post.updated').title('Topic').describe('The topic of the event'),
data: z
.object({
item: postSchema,
changes: z.array(
z.object({
field: z.string(),
oldValue: z.any(),
newValue: z.any(),
})
),
})
.title('Data')
.describe('Event data'),
}),
} satisfies EventDefinition
export const postDeleted = {
title: 'Post Deleted',
description: 'A post was deleted on a board.',
schema: webhookEvent.extend({
topic: z.literal('post.deleted').title('Topic').describe('The topic of the event'),
data: z
.object({
item: postSchema,
})
.title('Data')
.describe('Event data'),
}),
} satisfies EventDefinition
export const postVoted = {
title: 'Post voted',
description: 'A post was voted on a board.',
schema: webhookEvent.extend({
topic: z.literal('post.voted').title('Topic').describe('The topic of the event'),
data: z
.object({
item: z.object({
type: z.string().optional(),
action: z.string().optional(),
submissionId: z.string().optional(),
user: userSchema.optional(),
}),
})
.title('Data')
.describe('Event data'),
}),
} satisfies EventDefinition