chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,345 @@
|
||||
import { IntegrationDefinitionProps, z } from '@botpress/sdk'
|
||||
|
||||
const fieldTypeSchema = z.enum([
|
||||
'Color',
|
||||
'DateTime',
|
||||
'Email',
|
||||
'ExtFileRef',
|
||||
'File',
|
||||
'Image',
|
||||
'Link',
|
||||
'Multimage',
|
||||
'MultiReference',
|
||||
'Number',
|
||||
'Option',
|
||||
'Phone',
|
||||
'PlainText',
|
||||
'Reference',
|
||||
'RichText',
|
||||
'Switch',
|
||||
'VideoLink',
|
||||
])
|
||||
|
||||
const collectionSchema = z.object({
|
||||
id: z.string().optional().describe('Unique identifier for a Collection').title('Collection ID'),
|
||||
displayName: z.string().describe('Name given to the Collection').title('Collection Name'),
|
||||
singularName: z
|
||||
.string()
|
||||
.describe('The name of one Item in Collection (e.g. "Blog Post" if the Collection is called "Blog Posts")')
|
||||
.title('Collection Singular Name'),
|
||||
slug: z.string().optional().describe('Slug of Collection in Site URL structure').title('Collection Slug'),
|
||||
createdOn: z.string().optional().describe('The date the collection was created').title('Collection Created On'),
|
||||
lastUpdated: z
|
||||
.string()
|
||||
.optional()
|
||||
.describe('The date the collection was last updated')
|
||||
.title('Collection Last Updated'),
|
||||
})
|
||||
|
||||
const collectionDetailsSchema = collectionSchema.extend({
|
||||
fields: z
|
||||
.array(
|
||||
z.object({
|
||||
id: z.string().describe('Unique identifier for a Field').title('Field ID'),
|
||||
isRequired: z.boolean().describe('define whether a field is required in a collection').title('Is Required'),
|
||||
type: fieldTypeSchema
|
||||
.describe('Choose these appropriate field type for your collection data')
|
||||
.title('Field Type'),
|
||||
displayName: z.string().describe('The name of the Field').title('Field Name'),
|
||||
isEditable: z.boolean().nullable().describe('Define whether the field is editable').title('Is Editable'),
|
||||
slug: z
|
||||
.string()
|
||||
.nullable()
|
||||
.describe(
|
||||
'Slug of Field in Site URL structure. Slugs should be all lowercase with no spaces. Any spaces will be converted to "-".'
|
||||
)
|
||||
.title('Field Slug'),
|
||||
helpText: z
|
||||
.string()
|
||||
.nullable()
|
||||
.describe('Additional text to help anyone filling out this field')
|
||||
.title('Field Help Text'),
|
||||
validation: z.any().describe('The validation for the field').title('Field Validation'),
|
||||
})
|
||||
)
|
||||
.title('Fields')
|
||||
.describe('Array of fields in the collection'),
|
||||
})
|
||||
|
||||
const itemSchemaInput = z.object({
|
||||
id: z.string().optional().describe('Unique identifier for the Item').title('Item ID'),
|
||||
fieldData: z
|
||||
.object({
|
||||
name: z.string().min(1, 'Field name is required').describe('Name of the Item').title('Item Name'),
|
||||
slug: z
|
||||
.string()
|
||||
.describe(
|
||||
'URL structure of the Item in your site. Note: Updates to an item slug will break all links referencing the old slug.'
|
||||
)
|
||||
.title('Item Slug'),
|
||||
})
|
||||
.describe('The field data of your Webflow item')
|
||||
.title('Field Data'),
|
||||
cmsLocaleId: z.string().optional().describe('Identifier for the locale of the CMS item').title('CMS Locale ID'),
|
||||
isArchived: z
|
||||
.boolean()
|
||||
.optional()
|
||||
.describe('Boolean determining if the Item is set to archived')
|
||||
.title('Is Archived'),
|
||||
isDraft: z.boolean().optional().describe('Boolean determining if the Item is set to draft').title('Is Draft'),
|
||||
})
|
||||
|
||||
const itemSchemaOutput = itemSchemaInput.extend({
|
||||
lastPublished: z.string().nullable().describe('The date the item was last published').title('Last Published'),
|
||||
lastUpdated: z.string().optional().describe('The date the item was last updated').title('Last Updated'),
|
||||
createdOn: z.string().optional().describe('The date the item was created').title('Created On'),
|
||||
})
|
||||
|
||||
const paginationSchema = z.object({
|
||||
limit: z.number().default(100).optional().describe('The number of items to return').title('Limit'),
|
||||
offset: z.number().default(0).optional().describe('The number of items to skip').title('Offset'),
|
||||
})
|
||||
|
||||
export const actions = {
|
||||
listCollections: {
|
||||
title: 'List Collections',
|
||||
description: 'Retrieve a list of all collections in your Webflow site.',
|
||||
input: {
|
||||
schema: z.object({}),
|
||||
},
|
||||
output: {
|
||||
schema: z.object({
|
||||
collections: z.array(collectionSchema).describe('Array of collections').title('Collections'),
|
||||
}),
|
||||
},
|
||||
},
|
||||
getCollectionDetails: {
|
||||
title: 'Get Collection Details',
|
||||
description: 'Retrieve detailed information about a specific collection in your Webflow site.',
|
||||
input: {
|
||||
schema: z.object({
|
||||
collectionID: z
|
||||
.string()
|
||||
.min(1, 'Collection ID is required')
|
||||
.describe('The ID of your Webflow collection')
|
||||
.title('Collection ID'),
|
||||
}),
|
||||
},
|
||||
output: {
|
||||
schema: z.object({
|
||||
collectionDetails: collectionDetailsSchema.describe('Details of the collection').title('Collection Details'),
|
||||
}),
|
||||
},
|
||||
},
|
||||
createCollection: {
|
||||
title: 'Create Collection',
|
||||
description: 'Create a new collection in your Webflow site.',
|
||||
input: {
|
||||
schema: z.object({
|
||||
collectionInfo: collectionSchema.describe('Informations of the collection to create.').title('Collection Info'),
|
||||
}),
|
||||
},
|
||||
output: {
|
||||
schema: z.object({
|
||||
collectionDetails: collectionDetailsSchema
|
||||
.describe('Details of the new collection')
|
||||
.title('Collection Details'),
|
||||
}),
|
||||
},
|
||||
},
|
||||
deleteCollection: {
|
||||
title: 'Delete Collection',
|
||||
description: 'Delete a specific collection from your Webflow site.',
|
||||
input: {
|
||||
schema: z.object({
|
||||
collectionID: z
|
||||
.string()
|
||||
.min(1, 'Collection ID is required')
|
||||
.describe('The ID of your Webflow collection')
|
||||
.title('Collection ID'),
|
||||
}),
|
||||
},
|
||||
output: {
|
||||
schema: z.object({}),
|
||||
},
|
||||
},
|
||||
listItems: {
|
||||
title: 'List Collection Items',
|
||||
description:
|
||||
'List items in a Webflow collection. By default, this lists draft items. To list live items, set the "Is Live Items" parameter to true.',
|
||||
input: {
|
||||
schema: z.object({
|
||||
collectionID: z
|
||||
.string()
|
||||
.min(1, 'Collection ID is required')
|
||||
.describe('The ID of your Webflow collection')
|
||||
.title('Collection ID'),
|
||||
pagination: paginationSchema.optional().describe('Pagination parameters').title('Pagination'),
|
||||
isLiveItems: z
|
||||
.boolean()
|
||||
.default(false)
|
||||
.describe('checkbox to decide if the list is for live items or not')
|
||||
.title('Is Live Items'),
|
||||
}),
|
||||
},
|
||||
output: {
|
||||
schema: z.object({
|
||||
items: z.array(itemSchemaOutput).describe('Array of items').title('Items'),
|
||||
pagination: paginationSchema
|
||||
.extend({
|
||||
total: z.number().min(0).optional().describe('Total number of items in the collection').title('Total'),
|
||||
})
|
||||
.describe('Pagination details')
|
||||
.title('Pagination'),
|
||||
}),
|
||||
},
|
||||
},
|
||||
getItem: {
|
||||
title: 'Get Collection Item',
|
||||
description: 'Retrieve a specific item from a Webflow collection using its unique ID.',
|
||||
input: {
|
||||
schema: z.object({
|
||||
collectionID: z
|
||||
.string()
|
||||
.min(1, 'Collection ID is required')
|
||||
.describe('The ID of your Webflow collection')
|
||||
.title('Collection ID'),
|
||||
isLiveItems: z
|
||||
.boolean()
|
||||
.default(false)
|
||||
.describe('checkbox to decide if the list is for live items or not')
|
||||
.title('Is Live Items'),
|
||||
itemID: z.string().min(1, 'Item ID is required').describe('The ID of your Webflow item').title('Item ID'),
|
||||
}),
|
||||
},
|
||||
output: {
|
||||
schema: z.object({
|
||||
itemDetails: itemSchemaOutput.describe('Details of the item').title('Item Details'),
|
||||
}),
|
||||
},
|
||||
},
|
||||
createItems: {
|
||||
title: 'Create Collection item(s)',
|
||||
description: 'Create one or multiple items in a Webflow collection',
|
||||
input: {
|
||||
schema: z.object({
|
||||
collectionID: z
|
||||
.string()
|
||||
.min(1, 'Collection ID is required')
|
||||
.describe('The ID of your Webflow collection')
|
||||
.title('Collection ID'),
|
||||
isLiveItems: z
|
||||
.boolean()
|
||||
.default(false)
|
||||
.describe('checkbox to decide if the list is for live items or not')
|
||||
.title('Is Live Items'),
|
||||
items: z.array(itemSchemaInput).describe('Items to add to the collection').title('Items'),
|
||||
}),
|
||||
},
|
||||
output: {
|
||||
schema: z.object({
|
||||
items: z.array(itemSchemaOutput).describe('Details of the items created').title('Items'),
|
||||
}),
|
||||
},
|
||||
},
|
||||
updateItems: {
|
||||
title: 'Update Item(s)',
|
||||
description: 'Update one or more items in a collection',
|
||||
input: {
|
||||
schema: z.object({
|
||||
collectionID: z
|
||||
.string()
|
||||
.min(1, 'Collection ID is required')
|
||||
.describe('The ID of your Webflow collection')
|
||||
.title('Collection ID'),
|
||||
items: z.array(itemSchemaInput).describe('Array of items to update').title('Items'),
|
||||
isLiveItems: z
|
||||
.boolean()
|
||||
.default(false)
|
||||
.describe('checkbox to decide if the list is for live items or not')
|
||||
.title('Is Live Items'),
|
||||
}),
|
||||
},
|
||||
output: {
|
||||
schema: z.object({
|
||||
items: z.array(itemSchemaOutput).describe('Array of updated collection items').title('Items'),
|
||||
}),
|
||||
},
|
||||
},
|
||||
deleteItems: {
|
||||
title: 'Delete Item(s)',
|
||||
description: 'Delete one or more items from a collection',
|
||||
input: {
|
||||
schema: z.object({
|
||||
collectionID: z
|
||||
.string()
|
||||
.min(1, 'Collection ID is required')
|
||||
.describe('The ID of your Webflow collection')
|
||||
.title('Collection ID'),
|
||||
itemIDs: z
|
||||
.object({
|
||||
items: z
|
||||
.array(
|
||||
z.object({
|
||||
id: z
|
||||
.string()
|
||||
.min(1, 'Item ID is required')
|
||||
.describe('Unique identifier for the Item')
|
||||
.title('Item ID'),
|
||||
})
|
||||
)
|
||||
.title('Items')
|
||||
.describe('Array of items to delete'),
|
||||
})
|
||||
.describe('Array of item IDs to delete')
|
||||
.title('Item IDs'),
|
||||
}),
|
||||
},
|
||||
output: {
|
||||
schema: z.object({}),
|
||||
},
|
||||
},
|
||||
publishItems: {
|
||||
title: 'Publish Item(s)',
|
||||
description: 'Publish one or more items in a collection',
|
||||
input: {
|
||||
schema: z.object({
|
||||
collectionID: z
|
||||
.string()
|
||||
.min(1, 'Collection ID is required')
|
||||
.describe('The ID of your Webflow collection')
|
||||
.title('Collection ID'),
|
||||
itemIds: z
|
||||
.array(z.string().min(1, 'Item ID is required').describe('Unique identifier for the Item').title('Item ID'))
|
||||
.describe('Array of item IDs to publish')
|
||||
.title('Item IDs'),
|
||||
}),
|
||||
},
|
||||
output: {
|
||||
schema: z.object({
|
||||
publishedItemIds: z.array(z.string()).describe('Array of published item IDs').title('Published Item IDs'),
|
||||
errors: z.array(z.string()).describe('Array of errors encountered during publishing').title('Errors'),
|
||||
}),
|
||||
},
|
||||
},
|
||||
unpublishLiveItems: {
|
||||
title: 'Unpublish Live Item(s)',
|
||||
description: 'Unpublish one or more live items in a collection',
|
||||
input: {
|
||||
schema: z.object({
|
||||
collectionID: z
|
||||
.string()
|
||||
.min(1, 'Collection ID is required')
|
||||
.describe('The ID of your Webflow collection')
|
||||
.title('Collection ID'),
|
||||
itemIds: z
|
||||
.array(z.string().min(1, 'Item ID is required').describe('Unique identifier for the Item').title('Item ID'))
|
||||
.describe('Array of item IDs to unpublish')
|
||||
.title('Item IDs'),
|
||||
}),
|
||||
},
|
||||
output: {
|
||||
schema: z.object({}),
|
||||
},
|
||||
},
|
||||
} satisfies IntegrationDefinitionProps['actions']
|
||||
@@ -0,0 +1,62 @@
|
||||
import { IntegrationDefinitionProps } from '@botpress/sdk'
|
||||
import { formSchema, siteSchema, pageSchema, itemSchema, commentSchema } from './sub-schemas'
|
||||
|
||||
export const events = {
|
||||
formSubmission: {
|
||||
title: 'Form Submission',
|
||||
description: 'Information about a form that was submitted',
|
||||
schema: formSchema,
|
||||
},
|
||||
sitePublish: {
|
||||
title: 'Site Publish',
|
||||
description: 'Information about a site that was published',
|
||||
schema: siteSchema,
|
||||
},
|
||||
pageCreated: {
|
||||
title: 'Page Created',
|
||||
description: 'Information about a new pages',
|
||||
schema: pageSchema,
|
||||
},
|
||||
pageMetadataUpdated: {
|
||||
title: 'Page Metadata Updated',
|
||||
description: "Information about a page's updated metadata and/or settings",
|
||||
schema: pageSchema,
|
||||
},
|
||||
pageDeleted: {
|
||||
title: 'Page Deleted',
|
||||
description: 'Information about a page that was deleted',
|
||||
schema: pageSchema,
|
||||
},
|
||||
collectionItemCreated: {
|
||||
title: 'Collection Item Created',
|
||||
description: 'Information about a new collection item',
|
||||
schema: itemSchema,
|
||||
},
|
||||
collectionItemDeleted: {
|
||||
title: 'Collection Item Deleted',
|
||||
description: 'Information about a deleted collection item',
|
||||
schema: itemSchema,
|
||||
},
|
||||
collectionItemUpdated: {
|
||||
title: 'Collection Item Updated',
|
||||
description: 'Information about an updated collection item',
|
||||
schema: itemSchema,
|
||||
},
|
||||
collectionItemPublished: {
|
||||
title: 'Collection Item Published',
|
||||
description: 'Information about a collection item that was published',
|
||||
schema: itemSchema,
|
||||
},
|
||||
collectionItemUnpublished: {
|
||||
title: 'Collection Item Unpublished',
|
||||
description: 'Information about a collection item that was removed from the live site',
|
||||
schema: itemSchema,
|
||||
},
|
||||
// user not supported
|
||||
// ecomm not supported
|
||||
commentCreated: {
|
||||
title: 'New Comment Thread',
|
||||
description: 'Information about a new comment thread or reply',
|
||||
schema: commentSchema,
|
||||
},
|
||||
} satisfies IntegrationDefinitionProps['events']
|
||||
@@ -0,0 +1,113 @@
|
||||
import { z } from '@botpress/sdk'
|
||||
|
||||
export const formSchema = z.object({
|
||||
name: z.string().optional().describe('The name of the form').title('Form Name'),
|
||||
siteId: z.string().describe('The ID of the site that the form was submitted from').title('Site ID'),
|
||||
data: z.record(z.string()).optional().describe('The data submitted in the form').title('Form Data'),
|
||||
schema: z
|
||||
.array(
|
||||
z.object({
|
||||
fieldName: z.string().optional().describe('Form field name').title('Field Name'),
|
||||
fieldType: z
|
||||
.enum(['FormTextInput', 'FormTextarea', 'FormCheckboxInput', 'FormRadioInput', 'FormFileUploadInput'])
|
||||
.optional()
|
||||
.describe('Form field type')
|
||||
.title('Field Type'),
|
||||
fieldElementId: z.string().describe('Element ID of the Form Field').title('Field Element ID'),
|
||||
})
|
||||
)
|
||||
.optional()
|
||||
.describe('A list of fields from the submitted form')
|
||||
.title('Form Schema'),
|
||||
submittedAt: z.string().optional().describe('The timestamp the form was submitted').title('Submitted At'),
|
||||
id: z.string().describe('the ID of the event').title('Form Submission ID'),
|
||||
formId: z.string().describe('The ID of the form submission').title('Form ID'),
|
||||
formElementId: z.string().describe('The uniqueID of the Form element').title('Form Element ID'),
|
||||
})
|
||||
|
||||
export const siteSchema = z.object({
|
||||
domain: z.array(z.string()).optional().describe('The domains that were published').title('Site Domain'),
|
||||
site: z.string().optional().describe('The ID of the site that was published').title('Site Name'),
|
||||
publishedOn: z.string().describe('Timestamp when the site was published').title('Published On'),
|
||||
publishedBy: z
|
||||
.object({
|
||||
displayName: z.string().describe('The name andID of the user who published the site').title('Published By'),
|
||||
})
|
||||
.describe('Information about the user who published the site')
|
||||
.title('Published By'),
|
||||
})
|
||||
|
||||
export const pageSchema = z.object({
|
||||
siteId: z.string().describe('ID of the site').title('Site ID'),
|
||||
pageId: z.string().describe('ID of the page').title('Page ID'),
|
||||
pageTitle: z.string().optional().describe('Title of the page').title('Page Title'),
|
||||
createdOn: z.string().optional().describe('Timestamp when the page was created').title('Created On'),
|
||||
lastUpdated: z.string().optional().describe('Timestamp when the page was last updated').title('Last Updated'),
|
||||
deletedOn: z.string().optional().describe('Timestamp when the page was deleted').title('Deleted On'),
|
||||
publishedPath: z.string().optional().describe('Published path of the page').title('Published Path'),
|
||||
})
|
||||
|
||||
export const itemSchema = z.object({
|
||||
id: z.string().describe('Unique identifier for the Item').title('Item ID'),
|
||||
workspaceId: z.string().describe('Unique identifier of the workspace').title('Workspace ID'),
|
||||
siteId: z.string().describe('Unique identifier of the site').title('Site ID'),
|
||||
collectionId: z.string().describe('Unique identifier of the collection').title('Collection ID'),
|
||||
fieldData: z
|
||||
.object({
|
||||
name: z.string().describe('Name of the item').title('Item Name'),
|
||||
slug: z.string().describe('Slug of the item').title('Item Slug'),
|
||||
})
|
||||
.describe('Field data of the item')
|
||||
.title('Field Data'),
|
||||
lastPublished: z
|
||||
.string()
|
||||
.nullable()
|
||||
.optional()
|
||||
.describe('Timestamp when the item was last published')
|
||||
.title('Last Published'),
|
||||
lastUpdated: z.string().optional().describe('Timestamp when the item was last updated').title('Last Updated'),
|
||||
createdOn: z.string().optional().describe('Timestamp when the item was created').title('Created On'),
|
||||
isArchived: z.boolean().optional().describe('Whether the item is archived').title('Is Archived'),
|
||||
isDraft: z.boolean().optional().describe('Whether the item is a draft').title('Is Draft'),
|
||||
cmsLocaleId: z
|
||||
.string()
|
||||
.nullable()
|
||||
.optional()
|
||||
.describe('Unique identifier of the CMS locale for this item')
|
||||
.title('CMS Locale ID'),
|
||||
})
|
||||
|
||||
export const commentSchema = z.object({
|
||||
threadId: z.string().describe('Unique identifier for the comment thread').title('Thread ID'),
|
||||
commentId: z.string().describe('Unique identifier for the comment reply').title('Comment ID'),
|
||||
type: z.string().describe('The type of comment payload').title('Comment Type'),
|
||||
siteId: z.string().describe('The site unique identifier').title('Site ID'),
|
||||
pageId: z.string().describe('The page unique identifier').title('Page ID'),
|
||||
localeId: z.string().describe('The locale unique identifier').title('Locale ID'),
|
||||
breakpoint: z.string().describe('The breakpoint the comment was left on').title('Breakpoint'),
|
||||
url: z.string().describe('The URL of the page the comment was left on').title('Comment URL'),
|
||||
content: z.string().describe('The content of the comment reply').title('Comment Content'),
|
||||
isResolved: z.boolean().describe('Boolean determining if the comment thread is resolved').title('Is Resolved'),
|
||||
author: z
|
||||
.object({
|
||||
userId: z.string().describe('The unique identifier of the author').title('Author ID'),
|
||||
email: z.string().describe('Email of the author').title('Author Email'),
|
||||
name: z.string().describe('Name of the author').title('Author Name'),
|
||||
})
|
||||
.describe('Information about the author of the comment')
|
||||
.title('Author'),
|
||||
mentionedUsers: z
|
||||
.array(
|
||||
z.object({
|
||||
userId: z.string().describe('The unique identifier of the mentioned user').title('Mentioned User ID'),
|
||||
email: z.string().describe('Email of the user').title('Mentioned User Email'),
|
||||
name: z.string().describe('Name of the user').title('Mentioned User Name'),
|
||||
})
|
||||
)
|
||||
.describe(
|
||||
'List of mentioned users. This is an empty array until email notifications are sent, which can take up to 5 minutes after the comment is created.'
|
||||
)
|
||||
.title('Mentioned Users'),
|
||||
createdOn: z.string().describe('The date the item was created').title('Created On'),
|
||||
lastUpdated: z.string().describe('The date the item was last updated').title('Last Updated'),
|
||||
})
|
||||
Reference in New Issue
Block a user