AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents
TypeScript ai-agentai-agent-toolsai-agentsai-agents-frameworkmcpmcp-servermcp-toolsmcpsn8n-alternativeno-code-automationworkflowworkflow-automationworkflows
feat(gravityforms): let AI agents manage forms, entries, submissions and feeds (#17046)
Kishan Parmardc992f0ada7c
diff --git a/bun.lock b/bun.lockindex 700d0fd7d83..f1d59d02339 100644--- a/bun.lock+++ b/bun.lock@@ -4224,7 +4224,7 @@},"packages/pieces/community/gravityforms": {"name": "@activepieces/piece-gravityforms",- "version": "0.1.7",+ "version": "0.2.0","dependencies": {"@activepieces/core-piece-types": "workspace:*","@activepieces/core-utils": "workspace:*",diff --git a/packages/pieces/community/gravityforms/package.json b/packages/pieces/community/gravityforms/package.jsonindex fdf055af62f..be5e11c454c 100644--- a/packages/pieces/community/gravityforms/package.json+++ b/packages/pieces/community/gravityforms/package.json@@ -1,6 +1,6 @@{"name": "@activepieces/piece-gravityforms",- "version": "0.1.7",+ "version": "0.2.0","main": "./dist/src/index.js","types": "./dist/src/index.d.ts","scripts": {diff --git a/packages/pieces/community/gravityforms/src/index.ts b/packages/pieces/community/gravityforms/src/index.tsindex 4aca1eff446..b63c9d0677a 100644--- a/packages/pieces/community/gravityforms/src/index.ts+++ b/packages/pieces/community/gravityforms/src/index.ts@@ -1,16 +1,28 @@-import { PieceAuth, createPiece } from '@activepieces/pieces-framework';-import { PieceCategory } from '@activepieces/pieces-framework';-import { gravityFormsNewSubmission } from './lib/triggers/new-submission';+import { createCustomApiCallAction } from '@activepieces/pieces-common';+import { createPiece, PieceCategory } from '@activepieces/pieces-framework';+import { gravityFormsAiActions } from './lib/actions/ai';+import { gravityFormsAuth } from './lib/auth';+import { gravityFormsClient } from './lib/common/client';+import { newSubmissionTrigger } from './lib/triggers/new-submission';export const gravityforms = createPiece({displayName: 'Gravity Forms',description: 'Build and publish your WordPress forms',- auth: PieceAuth.None(),- minimumSupportedRelease: '0.27.1',+ auth: gravityFormsAuth,+ minimumSupportedRelease: '0.88.2',logoUrl: 'https://cdn.activepieces.com/pieces/gravityforms.svg',authors: ["Abdallah-Alwarawreh","kishanprmr","MoShizzle","abuaboud"],categories: [PieceCategory.FORMS_AND_SURVEYS],- actions: [],- triggers: [gravityFormsNewSubmission],+ actions: [+ ...gravityFormsAiActions,+ createCustomApiCallAction({+ auth: gravityFormsAuth,+ baseUrl: (auth) => (auth ? gravityFormsClient.baseUrl({ auth }) : ''),+ authMapping: async (auth) => ({+ Authorization: `Basic ${Buffer.from(`${auth.props.consumerKey}:${auth.props.consumerSecret}`).toString('base64')}`,+ }),+ }),+ ],+ triggers: [newSubmissionTrigger],});diff --git a/packages/pieces/community/gravityforms/src/lib/actions/ai/create-entry.ts b/packages/pieces/community/gravityforms/src/lib/actions/ai/create-entry.tsnew file mode 100644index 00000000000..440dfb2029a--- /dev/null+++ b/packages/pieces/community/gravityforms/src/lib/actions/ai/create-entry.ts@@ -0,0 +1,36 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction } from '@activepieces/pieces-framework';+import { gravityFormsAuth } from '../../auth';+import { gravityFormsAiProps } from '../../common/ai-props';+import { gravityFormsClient } from '../../common/client';+import type { GravityFormsEntry } from '../../common/types';+import { gravityformsCreateEntryOutputSchema } from '../../output-schemas';++export const createEntryAction = createAction({+ auth: gravityFormsAuth,+ name: 'gravityforms_create_entry',+ outputSchema: gravityformsCreateEntryOutputSchema,+ displayName: 'Create Entry',+ description: 'Saves an entry directly, without validation, feeds or notifications.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Saves an entry on a form exactly as given: no validation, add-on feeds, notification emails or confirmations run. Use Submit Form to go through the normal submission process instead. Form ids come from List Forms, field ids from Get Form.',+ idempotent: false,+ },+ props: {+ formId: gravityFormsAiProps.formId({ required: true }),+ fieldValues: gravityFormsAiProps.fieldValues({ required: true }),+ entryProperties: gravityFormsAiProps.entryProperties({ required: false }),+ },+ async run(context) {+ const { formId, fieldValues, entryProperties } = context.propsValue;+ return await gravityFormsClient.request<GravityFormsEntry>({+ auth: context.auth,+ method: HttpMethod.POST,+ path: '/entries',+ body: { ...entryProperties, ...fieldValues, form_id: formId },+ });+ },+});diff --git a/packages/pieces/community/gravityforms/src/lib/actions/ai/create-feed.ts b/packages/pieces/community/gravityforms/src/lib/actions/ai/create-feed.tsnew file mode 100644index 00000000000..d8a0acb340b--- /dev/null+++ b/packages/pieces/community/gravityforms/src/lib/actions/ai/create-feed.ts@@ -0,0 +1,44 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { gravityFormsAuth } from '../../auth';+import { gravityFormsAiProps } from '../../common/ai-props';+import { gravityFormsClient } from '../../common/client';+import type { GravityFormsFeed } from '../../common/types';+import { gravityformsCreateFeedOutputSchema } from '../../output-schemas';++export const createFeedAction = createAction({+ auth: gravityFormsAuth,+ name: 'gravityforms_create_feed',+ outputSchema: gravityformsCreateFeedOutputSchema,+ displayName: 'Create Feed',+ description: 'Creates an add-on feed on a form.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Creates an add-on feed that runs on a form\'s submissions. Meta holds the add-on\'s own settings and differs per add-on; copy its shape from Get Feed on an existing feed of the same add-on. The add-on must be installed. Form ids come from List Forms.',+ idempotent: false,+ },+ props: {+ formId: gravityFormsAiProps.formId({ required: true }),+ addonSlug: Property.ShortText({+ displayName: 'Add-on Slug',+ description: 'The add-on that owns the feed, e.g. "gravityformsmailchimp" or "gravityformswebhooks".',+ required: true,+ }),+ meta: Property.Json({+ displayName: 'Meta',+ description: 'The add-on\'s feed settings, e.g. {"feedName":"Send to CRM","requestURL":"https://example.com/hook"} for Webhooks.',+ required: true,+ }),+ },+ async run(context) {+ const { formId, addonSlug, meta } = context.propsValue;+ return await gravityFormsClient.request<GravityFormsFeed>({+ auth: context.auth,+ method: HttpMethod.POST,+ path: '/feeds',+ body: { form_id: formId, addon_slug: addonSlug, meta },+ });+ },+});diff --git a/packages/pieces/community/gravityforms/src/lib/actions/ai/create-form.ts b/packages/pieces/community/gravityforms/src/lib/actions/ai/create-form.tsnew file mode 100644index 00000000000..4ea588096ee--- /dev/null+++ b/packages/pieces/community/gravityforms/src/lib/actions/ai/create-form.ts@@ -0,0 +1,52 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { gravityFormsAuth } from '../../auth';+import { gravityFormsClient } from '../../common/client';+import type { GravityFormsForm } from '../../common/types';+import { gravityformsCreateFormOutputSchema } from '../../output-schemas';++export const createFormAction = createAction({+ auth: gravityFormsAuth,+ name: 'gravityforms_create_form',+ outputSchema: gravityformsCreateFormOutputSchema,+ displayName: 'Create Form',+ description: 'Creates a form with the given title and fields.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Creates a new form. Fields are Gravity Forms Field Objects, e.g. [{"id":1,"type":"text","label":"Name"}]; copy the shape from Get Form on an existing form. Not idempotent: each call creates another form.',+ idempotent: false,+ },+ props: {+ title: Property.ShortText({+ displayName: 'Title',+ description: 'Form title, unique on the site.',+ required: true,+ }),+ description: Property.LongText({+ displayName: 'Description',+ description: 'Form description shown under the title.',+ required: false,+ }),+ fields: Property.Json({+ displayName: 'Fields',+ description: 'Array of Field Objects, e.g. [{"id":1,"type":"text","label":"Name","isRequired":true}]. Each field needs a unique numeric id.',+ required: true,+ }),+ additionalProperties: Property.Json({+ displayName: 'Additional Properties',+ description: 'Other Form Object properties to set, e.g. {"labelPlacement":"top_label","button":{"type":"text","text":"Send"}}. Defaults to none.',+ required: false,+ }),+ },+ async run(context) {+ const { title, description, fields, additionalProperties } = context.propsValue;+ return await gravityFormsClient.request<GravityFormsForm>({+ auth: context.auth,+ method: HttpMethod.POST,+ path: '/forms',+ body: { ...additionalProperties, title, description, fields },+ });+ },+});diff --git a/packages/pieces/community/gravityforms/src/lib/actions/ai/delete-entry.ts b/packages/pieces/community/gravityforms/src/lib/actions/ai/delete-entry.tsnew file mode 100644index 00000000000..56420fff856--- /dev/null+++ b/packages/pieces/community/gravityforms/src/lib/actions/ai/delete-entry.ts@@ -0,0 +1,43 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction } from '@activepieces/pieces-framework';+import { gravityFormsAuth } from '../../auth';+import { gravityFormsAiProps } from '../../common/ai-props';+import { gravityFormsClient } from '../../common/client';+import type { GravityFormsDeleted, GravityFormsEntry } from '../../common/types';+import { gravityformsDeleteEntryOutputSchema } from '../../output-schemas';++export const deleteEntryAction = createAction({+ auth: gravityFormsAuth,+ name: 'gravityforms_delete_entry',+ outputSchema: gravityformsDeleteEntryOutputSchema,+ displayName: 'Delete Entry',+ description: 'Moves an entry to the trash, or deletes it permanently.',+ audience: 'ai',+ classification: 'DESTRUCTIVE',+ aiMetadata: {+ description:+ 'Moves an entry to the trash by default (status "trash"), which can be restored in WordPress; Delete Permanently "true" removes it for good. Trashing an already trashed entry fails. Entry ids come from List Entries.',+ idempotent: false,+ },+ props: {+ entryId: gravityFormsAiProps.entryId({ required: true }),+ force: gravityFormsAiProps.force({ required: false }),+ },+ async run(context) {+ const { entryId, force } = context.propsValue;+ if (force === 'true') {+ return await gravityFormsClient.request<GravityFormsDeleted<GravityFormsEntry>>({+ auth: context.auth,+ method: HttpMethod.DELETE,+ path: `/entries/${encodeURIComponent(entryId)}`,+ query: { force: '1' },+ });+ }+ const previous = await gravityFormsClient.request<GravityFormsEntry>({+ auth: context.auth,+ method: HttpMethod.DELETE,+ path: `/entries/${encodeURIComponent(entryId)}`,+ });+ return { deleted: false, previous };+ },+});diff --git a/packages/pieces/community/gravityforms/src/lib/actions/ai/delete-feed.ts b/packages/pieces/community/gravityforms/src/lib/actions/ai/delete-feed.tsnew file mode 100644index 00000000000..3eb2d5c3f94--- /dev/null+++ b/packages/pieces/community/gravityforms/src/lib/actions/ai/delete-feed.ts@@ -0,0 +1,32 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction } from '@activepieces/pieces-framework';+import { gravityFormsAuth } from '../../auth';+import { gravityFormsAiProps } from '../../common/ai-props';+import { gravityFormsClient } from '../../common/client';+import type { GravityFormsDeleted, GravityFormsFeed } from '../../common/types';+import { gravityformsDeleteFeedOutputSchema } from '../../output-schemas';++export const deleteFeedAction = createAction({+ auth: gravityFormsAuth,+ name: 'gravityforms_delete_feed',+ outputSchema: gravityformsDeleteFeedOutputSchema,+ displayName: 'Delete Feed',+ description: 'Permanently deletes an add-on feed.',+ audience: 'ai',+ classification: 'DESTRUCTIVE',+ aiMetadata: {+ description:+ 'Permanently deletes an add-on feed; there is no trash. To stop a feed without losing it, use Update Feed with Active "false". Feed ids come from List Feeds.',+ idempotent: false,+ },+ props: {+ feedId: gravityFormsAiProps.feedId({ required: true }),+ },+ async run(context) {+ return await gravityFormsClient.request<GravityFormsDeleted<GravityFormsFeed>>({+ auth: context.auth,+ method: HttpMethod.DELETE,+ path: `/feeds/${encodeURIComponent(context.propsValue.feedId)}`,+ });+ },+});diff --git a/packages/pieces/community/gravityforms/src/lib/actions/ai/delete-form.ts b/packages/pieces/community/gravityforms/src/lib/actions/ai/delete-form.tsnew file mode 100644index 00000000000..7af5eed5763--- /dev/null+++ b/packages/pieces/community/gravityforms/src/lib/actions/ai/delete-form.ts@@ -0,0 +1,43 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction } from '@activepieces/pieces-framework';+import { gravityFormsAuth } from '../../auth';+import { gravityFormsAiProps } from '../../common/ai-props';+import { gravityFormsClient } from '../../common/client';+import type { GravityFormsDeleted, GravityFormsForm } from '../../common/types';+import { gravityformsDeleteFormOutputSchema } from '../../output-schemas';++export const deleteFormAction = createAction({+ auth: gravityFormsAuth,+ name: 'gravityforms_delete_form',+ outputSchema: gravityformsDeleteFormOutputSchema,+ displayName: 'Delete Form',+ description: 'Moves a form to the trash, or deletes it permanently.',+ audience: 'ai',+ classification: 'DESTRUCTIVE',+ aiMetadata: {+ description:+ 'Moves a form to the trash by default, which can be restored in WordPress; Delete Permanently "true" removes it and all its entries for good. Trashing an already trashed form fails. Form ids come from List Forms.',+ idempotent: false,+ },+ props: {+ formId: gravityFormsAiProps.formId({ required: true }),+ force: gravityFormsAiProps.force({ required: false }),+ },+ async run(context) {+ const { formId, force } = context.propsValue;+ if (force === 'true') {+ return await gravityFormsClient.request<GravityFormsDeleted<GravityFormsForm>>({+ auth: context.auth,+ method: HttpMethod.DELETE,+ path: `/forms/${encodeURIComponent(formId)}`,+ query: { force: '1' },+ });+ }+ const previous = await gravityFormsClient.request<GravityFormsForm>({+ auth: context.auth,+ method: HttpMethod.DELETE,+ path: `/forms/${encodeURIComponent(formId)}`,+ });+ return { deleted: false, previous };+ },+});diff --git a/packages/pieces/community/gravityforms/src/lib/actions/ai/get-entry.ts b/packages/pieces/community/gravityforms/src/lib/actions/ai/get-entry.tsnew file mode 100644index 00000000000..c41a0cf6482--- /dev/null+++ b/packages/pieces/community/gravityforms/src/lib/actions/ai/get-entry.ts@@ -0,0 +1,26 @@+import { createAction } from '@activepieces/pieces-framework';+import { gravityFormsAuth } from '../../auth';+import { gravityFormsAiProps } from '../../common/ai-props';+import { gravityFormsApi } from '../../common/api';+import { gravityformsGetEntryOutputSchema } from '../../output-schemas';++export const getEntryAction = createAction({+ auth: gravityFormsAuth,+ name: 'gravityforms_get_entry',+ outputSchema: gravityformsGetEntryOutputSchema,+ displayName: 'Get Entry',+ description: 'Gets one entry with its field values.',+ audience: 'ai',+ classification: 'READ',+ aiMetadata: {+ description:+ 'Gets one entry by id: its properties (form_id, status, date_created, payment fields) and field values keyed by field id. Entry ids come from List Entries or Create Entry.',+ idempotent: true,+ },+ props: {+ entryId: gravityFormsAiProps.entryId({ required: true }),+ },+ async run(context) {+ return await gravityFormsApi.getEntry({ auth: context.auth, entryId: context.propsValue.entryId });+ },+});diff --git a/packages/pieces/community/gravityforms/src/lib/actions/ai/get-feed.ts b/packages/pieces/community/gravityforms/src/lib/actions/ai/get-feed.tsnew file mode 100644index 00000000000..8090a7f3314--- /dev/null+++ b/packages/pieces/community/gravityforms/src/lib/actions/ai/get-feed.ts@@ -0,0 +1,31 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction } from '@activepieces/pieces-framework';+import { gravityFormsAuth } from '../../auth';+import { gravityFormsAiProps } from '../../common/ai-props';+import { gravityFormsClient } from '../../common/client';+import type { GravityFormsFeed } from '../../common/types';+import { gravityformsGetFeedOutputSchema } from '../../output-schemas';++export const getFeedAction = createAction({+ auth: gravityFormsAuth,+ name: 'gravityforms_get_feed',+ outputSchema: gravityformsGetFeedOutputSchema,+ displayName: 'Get Feed',+ description: 'Gets one add-on feed with its settings.',+ audience: 'ai',+ classification: 'READ',+ aiMetadata: {+ description: 'Gets one add-on feed by id with its form_id, addon_slug, is_active and meta settings. Feed ids come from List Feeds.',+ idempotent: true,+ },+ props: {+ feedId: gravityFormsAiProps.feedId({ required: true }),+ },+ async run(context) {+ return await gravityFormsClient.request<GravityFormsFeed>({+ auth: context.auth,+ method: HttpMethod.GET,+ path: `/feeds/${encodeURIComponent(context.propsValue.feedId)}`,+ });+ },+});diff --git a/packages/pieces/community/gravityforms/src/lib/actions/ai/get-form-results.ts b/packages/pieces/community/gravityforms/src/lib/actions/ai/get-form-results.tsnew file mode 100644index 00000000000..fafeb7abead--- /dev/null+++ b/packages/pieces/community/gravityforms/src/lib/actions/ai/get-form-results.ts@@ -0,0 +1,37 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction } from '@activepieces/pieces-framework';+import { gravityFormsAuth } from '../../auth';+import { gravityFormsAiProps } from '../../common/ai-props';+import { gravityFormsClient } from '../../common/client';+import { gravityFormsUtils } from '../../common/utils';+import { gravityformsGetFormResultsOutputSchema } from '../../output-schemas';++export const getFormResultsAction = createAction({+ auth: gravityFormsAuth,+ name: 'gravityforms_get_form_results',+ outputSchema: gravityformsGetFormResultsOutputSchema,+ displayName: 'Get Form Results',+ description: 'Gets aggregated Quiz, Poll or Survey results for a form.',+ audience: 'ai',+ classification: 'READ',+ aiMetadata: {+ description:+ 'Gets aggregated results of a Quiz, Polls or Survey form: per-field choice totals with their labels, over all entries or the ones matching Field Filters. Needs the Quiz, Polls or Survey add-on. Form ids come from List Forms.',+ idempotent: true,+ },+ props: {+ formId: gravityFormsAiProps.formId({ required: true }),+ status: gravityFormsAiProps.status({ required: false }),+ fieldFilters: gravityFormsAiProps.fieldFilters({ required: false }),+ filterMode: gravityFormsAiProps.filterMode({ required: false }),+ },+ async run(context) {+ const { formId, status, fieldFilters, filterMode } = context.propsValue;+ return await gravityFormsClient.request<Record<string, unknown>>({+ auth: context.auth,+ method: HttpMethod.GET,+ path: `/forms/${encodeURIComponent(formId)}/results`,+ query: gravityFormsUtils.searchQuery({ status, fieldFilters, filterMode }),+ });+ },+});diff --git a/packages/pieces/community/gravityforms/src/lib/actions/ai/get-form.ts b/packages/pieces/community/gravityforms/src/lib/actions/ai/get-form.tsnew file mode 100644index 00000000000..24919fb9639--- /dev/null+++ b/packages/pieces/community/gravityforms/src/lib/actions/ai/get-form.ts@@ -0,0 +1,26 @@+import { createAction } from '@activepieces/pieces-framework';+import { gravityFormsAuth } from '../../auth';+import { gravityFormsAiProps } from '../../common/ai-props';+import { gravityFormsApi } from '../../common/api';+import { gravityformsGetFormOutputSchema } from '../../output-schemas';++export const getFormAction = createAction({+ auth: gravityFormsAuth,+ name: 'gravityforms_get_form',+ outputSchema: gravityformsGetFormOutputSchema,+ displayName: 'Get Form',+ description: 'Gets a form with its fields, notifications and confirmations.',+ audience: 'ai',+ classification: 'READ',+ aiMetadata: {+ description:+ 'Gets one form by id with its fields, notifications and confirmations. Field ids from here are the keys used by Submit Form (input_<id>), Create Entry and List Entries filters. Form ids come from List Forms.',+ idempotent: true,+ },+ props: {+ formId: gravityFormsAiProps.formId({ required: true }),+ },+ async run(context) {+ return await gravityFormsApi.getForm({ auth: context.auth, formId: context.propsValue.formId });+ },+});diff --git a/packages/pieces/community/gravityforms/src/lib/actions/ai/index.ts b/packages/pieces/community/gravityforms/src/lib/actions/ai/index.tsnew file mode 100644index 00000000000..073551869ab--- /dev/null+++ b/packages/pieces/community/gravityforms/src/lib/actions/ai/index.ts@@ -0,0 +1,43 @@+import { createEntryAction } from './create-entry';+import { createFeedAction } from './create-feed';+import { createFormAction } from './create-form';+import { deleteEntryAction } from './delete-entry';+import { deleteFeedAction } from './delete-feed';+import { deleteFormAction } from './delete-form';+import { getEntryAction } from './get-entry';+import { getFeedAction } from './get-feed';+import { getFormAction } from './get-form';+import { getFormResultsAction } from './get-form-results';+import { listEntriesAction } from './list-entries';+import { listFeedsAction } from './list-feeds';+import { listFieldFiltersAction } from './list-field-filters';+import { listFormsAction } from './list-forms';+import { sendNotificationsAction } from './send-notifications';+import { submitFormAction } from './submit-form';+import { updateEntryAction } from './update-entry';+import { updateFeedAction } from './update-feed';+import { updateFormAction } from './update-form';+import { validateSubmissionAction } from './validate-submission';++export const gravityFormsAiActions = [+ listFormsAction,+ getFormAction,+ createFormAction,+ updateFormAction,+ deleteFormAction,+ submitFormAction,+ validateSubmissionAction,+ listFieldFiltersAction,+ listEntriesAction,+ getEntryAction,+ createEntryAction,+ updateEntryAction,+ deleteEntryAction,+ sendNotificationsAction,+ listFeedsAction,+ getFeedAction,+ createFeedAction,+ updateFeedAction,+ deleteFeedAction,+ getFormResultsAction,+];diff --git a/packages/pieces/community/gravityforms/src/lib/actions/ai/list-entries.ts b/packages/pieces/community/gravityforms/src/lib/actions/ai/list-entries.tsnew file mode 100644index 00000000000..3728b02a707--- /dev/null+++ b/packages/pieces/community/gravityforms/src/lib/actions/ai/list-entries.ts@@ -0,0 +1,76 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { gravityFormsAuth } from '../../auth';+import { gravityFormsAiProps } from '../../common/ai-props';+import { gravityFormsClient } from '../../common/client';+import type { GravityFormsEntryList } from '../../common/types';+import { gravityFormsUtils } from '../../common/utils';+import { gravityformsListEntriesOutputSchema } from '../../output-schemas';++const SORT_DIRECTIONS = ['ASC', 'DESC', 'RAND'];+const MAX_PAGE_SIZE = 200;++export const listEntriesAction = createAction({+ auth: gravityFormsAuth,+ name: 'gravityforms_list_entries',+ outputSchema: gravityformsListEntriesOutputSchema,+ displayName: 'List Entries',+ description: 'Searches form entries with filters, sorting and paging.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Searches entries across all forms, or one form when Form ID is set, newest first by default. Returns total_count for the whole search and one page of entries; use Page to read further. Field values are keyed by field id; use Get Form for labels and List Field Filters for filter keys.',+ idempotent: true,+ },+ props: {+ formId: gravityFormsAiProps.formId({+ required: false,+ description: 'Only return entries of this form, e.g. "14". Use List Forms to find it. Defaults to all forms.',+ }),+ status: gravityFormsAiProps.status({ required: false }),+ fieldFilters: gravityFormsAiProps.fieldFilters({ required: false }),+ filterMode: gravityFormsAiProps.filterMode({ required: false }),+ sortKey: Property.ShortText({+ displayName: 'Sort By',+ description: 'Field id or entry property to sort by, e.g. "date_created" or "3". Defaults to "id".',+ required: false,+ }),+ sortDirection: Property.StaticDropdown({+ displayName: 'Sort Direction',+ description: '"ASC", "DESC" or "RAND". Defaults to "DESC".',+ required: false,+ options: {+ options: SORT_DIRECTIONS.map((direction) => ({ label: direction, value: direction })),+ },+ }),+ limit: Property.Number({+ displayName: 'Limit',+ description: `Entries per page (1-${MAX_PAGE_SIZE}). Defaults to 20.`,+ required: false,+ }),+ page: Property.Number({+ displayName: 'Page',+ description: 'Page number, starting at 1. Defaults to 1.',+ required: false,+ }),+ },+ async run(context) {+ const { formId, status, fieldFilters, filterMode, sortKey, sortDirection, limit, page } = context.propsValue;+ if (sortDirection !== undefined && !SORT_DIRECTIONS.includes(sortDirection)) {+ throw new Error(`Sort Direction must be one of ${SORT_DIRECTIONS.join(', ')}.`);+ }+ return await gravityFormsClient.request<GravityFormsEntryList>({+ auth: context.auth,+ method: HttpMethod.GET,+ path: formId ? `/forms/${encodeURIComponent(formId)}/entries` : '/entries',+ query: {+ ...gravityFormsUtils.searchQuery({ status, fieldFilters, filterMode }),+ ...(sortKey ? { 'sorting[key]': sortKey } : {}),+ ...(sortDirection ? { 'sorting[direction]': sortDirection } : {}),+ 'paging[page_size]': String(Math.min(Math.max(limit ?? 20, 1), MAX_PAGE_SIZE)),+ 'paging[current_page]': String(Math.max(page ?? 1, 1)),+ },+ });+ },+});diff --git a/packages/pieces/community/gravityforms/src/lib/actions/ai/list-feeds.ts b/packages/pieces/community/gravityforms/src/lib/actions/ai/list-feeds.tsnew file mode 100644index 00000000000..389866f526c--- /dev/null+++ b/packages/pieces/community/gravityforms/src/lib/actions/ai/list-feeds.ts@@ -0,0 +1,43 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { gravityFormsAuth } from '../../auth';+import { gravityFormsAiProps } from '../../common/ai-props';+import { gravityFormsClient } from '../../common/client';+import type { GravityFormsFeed } from '../../common/types';+import { gravityformsListFeedsOutputSchema } from '../../output-schemas';++export const listFeedsAction = createAction({+ auth: gravityFormsAuth,+ name: 'gravityforms_list_feeds',+ outputSchema: gravityformsListFeedsOutputSchema,+ displayName: 'List Feeds',+ description: 'Lists add-on feeds, optionally for one form or one add-on.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Lists add-on feeds (e.g. Mailchimp, HubSpot, Webhooks), each with its form_id, addon_slug, is_active and meta settings. Filter by Form ID and/or Add-on Slug. Feed ids from here are used by Get Feed, Update Feed and Delete Feed.',+ idempotent: true,+ },+ props: {+ formId: gravityFormsAiProps.formId({+ required: false,+ description: 'Only return feeds of this form, e.g. "14". Use List Forms to find it. Defaults to all forms.',+ }),+ addonSlug: Property.ShortText({+ displayName: 'Add-on Slug',+ description: 'Only return feeds of this add-on, e.g. "gravityformsmailchimp" or "gravityformswebhooks". Defaults to all add-ons.',+ required: false,+ }),+ },+ async run(context) {+ const { formId, addonSlug } = context.propsValue;+ const feeds = await gravityFormsClient.request<GravityFormsFeed[]>({+ auth: context.auth,+ method: HttpMethod.GET,+ path: formId ? `/forms/${encodeURIComponent(formId)}/feeds` : '/feeds',+ query: addonSlug ? { addon: addonSlug } : undefined,+ });+ return { feeds, count: feeds.length };+ },+});diff --git a/packages/pieces/community/gravityforms/src/lib/actions/ai/list-field-filters.ts b/packages/pieces/community/gravityforms/src/lib/actions/ai/list-field-filters.tsnew file mode 100644index 00000000000..42b1802a0ca--- /dev/null+++ b/packages/pieces/community/gravityforms/src/lib/actions/ai/list-field-filters.ts@@ -0,0 +1,33 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction } from '@activepieces/pieces-framework';+import { gravityFormsAuth } from '../../auth';+import { gravityFormsAiProps } from '../../common/ai-props';+import { gravityFormsClient } from '../../common/client';+import { gravityformsListFieldFiltersOutputSchema } from '../../output-schemas';++export const listFieldFiltersAction = createAction({+ auth: gravityFormsAuth,+ name: 'gravityforms_list_field_filters',+ outputSchema: gravityformsListFieldFiltersOutputSchema,+ displayName: 'List Field Filters',+ description: 'Lists the keys, operators and values a form\'s entries can be filtered by.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Lists every filter key a form supports (field ids, entry properties and meta), with the operators and choice values each accepts. Use it to build Field Filters for List Entries and Get Form Results. Form ids come from List Forms.',+ idempotent: true,+ },+ props: {+ formId: gravityFormsAiProps.formId({ required: true }),+ },+ async run(context) {+ const fieldFilters = await gravityFormsClient.request<unknown[]>({+ auth: context.auth,+ method: HttpMethod.GET,+ path: `/forms/${encodeURIComponent(context.propsValue.formId)}/field-filters`,+ query: { _admin_labels: '1' },+ });+ return { field_filters: fieldFilters, count: fieldFilters.length };+ },+});diff --git a/packages/pieces/community/gravityforms/src/lib/actions/ai/list-forms.ts b/packages/pieces/community/gravityforms/src/lib/actions/ai/list-forms.tsnew file mode 100644index 00000000000..3ca742b72df--- /dev/null+++ b/packages/pieces/community/gravityforms/src/lib/actions/ai/list-forms.ts@@ -0,0 +1,24 @@+import { createAction } from '@activepieces/pieces-framework';+import { gravityFormsAuth } from '../../auth';+import { gravityFormsApi } from '../../common/api';+import { gravityformsListFormsOutputSchema } from '../../output-schemas';++export const listFormsAction = createAction({+ auth: gravityFormsAuth,+ name: 'gravityforms_list_forms',+ outputSchema: gravityformsListFormsOutputSchema,+ displayName: 'List Forms',+ description: 'Lists every form on the site with its id, title and entry count.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Lists all Gravity Forms forms with their id, title and entry count. Use it to find the form id that other actions take; use Get Form for a form\'s fields.',+ idempotent: true,+ },+ props: {},+ async run(context) {+ const forms = Object.values(await gravityFormsApi.listForms({ auth: context.auth }));+ return { forms, count: forms.length };+ },+});diff --git a/packages/pieces/community/gravityforms/src/lib/actions/ai/send-notifications.ts b/packages/pieces/community/gravityforms/src/lib/actions/ai/send-notifications.tsnew file mode 100644index 00000000000..68f548e65c4--- /dev/null+++ b/packages/pieces/community/gravityforms/src/lib/actions/ai/send-notifications.ts@@ -0,0 +1,48 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { gravityFormsAuth } from '../../auth';+import { gravityFormsAiProps } from '../../common/ai-props';+import { gravityFormsClient } from '../../common/client';+import { gravityformsSendNotificationsOutputSchema } from '../../output-schemas';++export const sendNotificationsAction = createAction({+ auth: gravityFormsAuth,+ name: 'gravityforms_send_notifications',+ outputSchema: gravityformsSendNotificationsOutputSchema,+ displayName: 'Send Notifications',+ description: 'Sends an entry\'s form notifications (emails) again.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Sends the notifications configured on the entry\'s form for one entry, e.g. to resend a confirmation email. Sends every notification for the event unless Notification IDs is set; notification ids are the keys of "notifications" in Get Form. Each call sends the emails again.',+ idempotent: false,+ },+ props: {+ entryId: gravityFormsAiProps.entryId({ required: true }),+ notificationIds: Property.Array({+ displayName: 'Notification IDs',+ description: 'Only send these notifications, e.g. ["64f23a145de7b"]. Defaults to all notifications for the event.',+ required: false,+ }),+ event: Property.ShortText({+ displayName: 'Event',+ description: 'Notification event to send for, e.g. "form_submission". Defaults to "form_submission".',+ required: false,+ }),+ },+ async run(context) {+ const { entryId, notificationIds, event } = context.propsValue;+ const ids = (notificationIds ?? []).map(String);+ const sent = await gravityFormsClient.request<string[]>({+ auth: context.auth,+ method: HttpMethod.POST,+ path: `/entries/${encodeURIComponent(entryId)}/notifications`,+ body: {+ ...(ids.length > 0 ? { _notifications: ids.join(',') } : {}),+ ...(event ? { _event: event } : {}),+ },+ });+ return { notification_ids: sent, count: sent.length };+ },+});diff --git a/packages/pieces/community/gravityforms/src/lib/actions/ai/submit-form.ts b/packages/pieces/community/gravityforms/src/lib/actions/ai/submit-form.tsnew file mode 100644index 00000000000..4ae50b2e618--- /dev/null+++ b/packages/pieces/community/gravityforms/src/lib/actions/ai/submit-form.ts@@ -0,0 +1,38 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction } from '@activepieces/pieces-framework';+import { gravityFormsAuth } from '../../auth';+import { gravityFormsAiProps } from '../../common/ai-props';+import { gravityFormsClient } from '../../common/client';+import type { GravityFormsSubmissionResult } from '../../common/types';+import { gravityformsSubmitFormOutputSchema } from '../../output-schemas';++export const submitFormAction = createAction({+ auth: gravityFormsAuth,+ name: 'gravityforms_submit_form',+ outputSchema: gravityformsSubmitFormOutputSchema,+ displayName: 'Submit Form',+ description: 'Submits a form the way a site visitor would.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Submits values to a form through the full submission process: validation, spam checks, saving the entry, add-on feeds, notification emails and confirmations. Invalid values fail the action. Use Validate Submission to check values and get field validation messages without saving, or Create Entry to save an entry without feeds or emails.',+ idempotent: false,+ },+ props: {+ formId: gravityFormsAiProps.formId({ required: true }),+ inputValues: gravityFormsAiProps.inputValues({ required: true }),+ populationValues: gravityFormsAiProps.populationValues({ required: false }),+ sourcePage: gravityFormsAiProps.sourcePage({ required: false }),+ targetPage: gravityFormsAiProps.targetPage({ required: false }),+ },+ async run(context) {+ const { formId, inputValues, populationValues, sourcePage, targetPage } = context.propsValue;+ return await gravityFormsClient.request<GravityFormsSubmissionResult>({+ auth: context.auth,+ method: HttpMethod.POST,+ path: `/forms/${encodeURIComponent(formId)}/submissions`,+ body: { ...inputValues, field_values: populationValues, source_page: sourcePage, target_page: targetPage },+ });+ },+});diff --git a/packages/pieces/community/gravityforms/src/lib/actions/ai/update-entry.ts b/packages/pieces/community/gravityforms/src/lib/actions/ai/update-entry.tsnew file mode 100644index 00000000000..fed727685f0--- /dev/null+++ b/packages/pieces/community/gravityforms/src/lib/actions/ai/update-entry.ts@@ -0,0 +1,41 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction } from '@activepieces/pieces-framework';+import { gravityFormsAuth } from '../../auth';+import { gravityFormsAiProps } from '../../common/ai-props';+import { gravityFormsApi } from '../../common/api';+import { gravityFormsClient } from '../../common/client';+import type { GravityFormsEntry } from '../../common/types';+import { gravityformsGetEntryOutputSchema } from '../../output-schemas';++export const updateEntryAction = createAction({+ auth: gravityFormsAuth,+ name: 'gravityforms_update_entry',+ outputSchema: gravityformsGetEntryOutputSchema,+ displayName: 'Update Entry',+ description: 'Changes some of an entry\'s field values or properties.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Updates an entry by id. Reads the current entry, applies only the field values and properties you set, and saves the whole entry, so other values are kept. Entry ids come from List Entries, field ids from Get Form.',+ idempotent: true,+ },+ props: {+ entryId: gravityFormsAiProps.entryId({ required: true }),+ fieldValues: gravityFormsAiProps.fieldValues({+ required: false,+ description: 'Object of field ids to new values, e.g. {"1":"Jane","2.3":"Doe"}. Fields not listed keep their value. Defaults to none.',+ }),+ entryProperties: gravityFormsAiProps.entryProperties({ required: false }),+ },+ async run(context) {+ const { entryId, fieldValues, entryProperties } = context.propsValue;+ const current = await gravityFormsApi.getEntry({ auth: context.auth, entryId });+ return await gravityFormsClient.request<GravityFormsEntry>({+ auth: context.auth,+ method: HttpMethod.PUT,+ path: `/entries/${encodeURIComponent(entryId)}`,+ body: { ...current, ...entryProperties, ...fieldValues },+ });+ },+});diff --git a/packages/pieces/community/gravityforms/src/lib/actions/ai/update-feed.ts b/packages/pieces/community/gravityforms/src/lib/actions/ai/update-feed.tsnew file mode 100644index 00000000000..1bb66625ecc--- /dev/null+++ b/packages/pieces/community/gravityforms/src/lib/actions/ai/update-feed.ts@@ -0,0 +1,59 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { gravityFormsAuth } from '../../auth';+import { gravityFormsAiProps } from '../../common/ai-props';+import { gravityFormsClient } from '../../common/client';+import type { GravityFormsFeed } from '../../common/types';+import { gravityformsGetFeedOutputSchema } from '../../output-schemas';++export const updateFeedAction = createAction({+ auth: gravityFormsAuth,+ name: 'gravityforms_update_feed',+ outputSchema: gravityformsGetFeedOutputSchema,+ displayName: 'Update Feed',+ description: 'Changes some of an add-on feed\'s settings, or turns it on or off.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Updates an add-on feed by id, changing only what you set: Meta keys you send replace those keys and other meta is kept; Active turns the feed on or off. Feed ids come from List Feeds.',+ idempotent: true,+ },+ props: {+ feedId: gravityFormsAiProps.feedId({ required: true }),+ meta: Property.Json({+ displayName: 'Meta',+ description: 'Feed settings to change, e.g. {"feedName":"Send to CRM v2"}. Keys not sent keep their value. Defaults to none.',+ required: false,+ }),+ isActive: Property.StaticDropdown({+ displayName: 'Active',+ description: '"true" turns the feed on, "false" turns it off. Defaults to unchanged.',+ required: false,+ options: {+ options: [+ { label: 'Yes', value: 'true' },+ { label: 'No', value: 'false' },+ ],+ },+ }),+ feedOrder: Property.Number({+ displayName: 'Order',+ description: 'Position of the feed among the form\'s feeds of the same add-on, starting at 0. Defaults to unchanged.',+ required: false,+ }),+ },+ async run(context) {+ const { feedId, meta, isActive, feedOrder } = context.propsValue;+ return await gravityFormsClient.request<GravityFormsFeed>({+ auth: context.auth,+ method: HttpMethod.PATCH,+ path: `/feeds/${encodeURIComponent(feedId)}`,+ body: {+ ...(meta !== undefined && Object.keys(meta).length > 0 ? { meta } : {}),+ ...(isActive !== undefined ? { is_active: isActive === 'true' } : {}),+ ...(feedOrder !== undefined ? { feed_order: feedOrder } : {}),+ },+ });+ },+});diff --git a/packages/pieces/community/gravityforms/src/lib/actions/ai/update-form.ts b/packages/pieces/community/gravityforms/src/lib/actions/ai/update-form.tsnew file mode 100644index 00000000000..806feda9819--- /dev/null+++ b/packages/pieces/community/gravityforms/src/lib/actions/ai/update-form.ts@@ -0,0 +1,62 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { gravityFormsAuth } from '../../auth';+import { gravityFormsAiProps } from '../../common/ai-props';+import { gravityFormsApi } from '../../common/api';+import { gravityFormsClient } from '../../common/client';+import type { GravityFormsForm } from '../../common/types';+import { gravityformsUpdateFormOutputSchema } from '../../output-schemas';++export const updateFormAction = createAction({+ auth: gravityFormsAuth,+ name: 'gravityforms_update_form',+ outputSchema: gravityformsUpdateFormOutputSchema,+ displayName: 'Update Form',+ description: 'Changes a form\'s title, description, fields or other properties.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Updates a form by id. Reads the current form, applies only the properties you set, and saves the whole form; Fields, when given, replaces the full field list. Form ids come from List Forms.',+ idempotent: true,+ },+ props: {+ formId: gravityFormsAiProps.formId({ required: true }),+ title: Property.ShortText({+ displayName: 'Title',+ description: 'New form title. Leave empty to keep it.',+ required: false,+ }),+ description: Property.LongText({+ displayName: 'Description',+ description: 'New form description. Leave empty to keep it.',+ required: false,+ }),+ fields: Property.Json({+ displayName: 'Fields',+ description: 'Full array of Field Objects that replaces the current fields. Get it from Get Form, edit it, and send it back. Leave empty to keep the fields.',+ required: false,+ }),+ additionalProperties: Property.Json({+ displayName: 'Additional Properties',+ description: 'Other Form Object properties to change, e.g. {"labelPlacement":"left_label"}. Defaults to none.',+ required: false,+ }),+ },+ async run(context) {+ const { formId, title, description, fields, additionalProperties } = context.propsValue;+ const current = await gravityFormsApi.getForm({ auth: context.auth, formId });+ return await gravityFormsClient.request<GravityFormsForm>({+ auth: context.auth,+ method: HttpMethod.PUT,+ path: `/forms/${encodeURIComponent(formId)}`,+ body: {+ ...current,+ ...additionalProperties,+ ...(title !== undefined ? { title } : {}),+ ...(description !== undefined ? { description } : {}),+ ...(fields !== undefined ? { fields } : {}),+ },+ });+ },+});diff --git a/packages/pieces/community/gravityforms/src/lib/actions/ai/validate-submission.ts b/packages/pieces/community/gravityforms/src/lib/actions/ai/validate-submission.tsnew file mode 100644index 00000000000..b41079b0363--- /dev/null+++ b/packages/pieces/community/gravityforms/src/lib/actions/ai/validate-submission.ts@@ -0,0 +1,46 @@+import { HttpError, HttpMethod } from '@activepieces/pieces-common';+import { createAction } from '@activepieces/pieces-framework';+import { gravityFormsAuth } from '../../auth';+import { gravityFormsAiProps } from '../../common/ai-props';+import { gravityFormsClient } from '../../common/client';+import type { GravityFormsSubmissionResult } from '../../common/types';+import { gravityformsValidateSubmissionOutputSchema } from '../../output-schemas';++export const validateSubmissionAction = createAction({+ auth: gravityFormsAuth,+ name: 'gravityforms_validate_submission',+ outputSchema: gravityformsValidateSubmissionOutputSchema,+ displayName: 'Validate Submission',+ description: 'Checks form values against the form\'s validation rules without saving anything.',+ audience: 'ai',+ classification: 'READ',+ aiMetadata: {+ description:+ 'Runs a form\'s validation and spam checks on the given values and returns is_valid, validation_messages keyed by field id, and is_spam. Saves no entry and sends no email or feed. Use Submit Form to actually submit.',+ idempotent: true,+ },+ props: {+ formId: gravityFormsAiProps.formId({ required: true }),+ inputValues: gravityFormsAiProps.inputValues({ required: true }),+ populationValues: gravityFormsAiProps.populationValues({ required: false }),+ sourcePage: gravityFormsAiProps.sourcePage({ required: false }),+ targetPage: gravityFormsAiProps.targetPage({ required: false }),+ },+ async run(context) {+ const { formId, inputValues, populationValues, sourcePage, targetPage } = context.propsValue;+ try {+ return await gravityFormsClient.request<GravityFormsSubmissionResult>({+ auth: context.auth,+ method: HttpMethod.POST,+ path: `/forms/${encodeURIComponent(formId)}/submissions/validation`,+ body: { ...inputValues, field_values: populationValues, source_page: sourcePage, target_page: targetPage },+ });+ } catch (error: unknown) {+ const body = error instanceof HttpError && error.response.status === 400 ? error.response.body : undefined;+ if (typeof body === 'object' && body !== null && 'is_valid' in body) {+ return body;+ }+ throw error;+ }+ },+});diff --git a/packages/pieces/community/gravityforms/src/lib/auth.ts b/packages/pieces/community/gravityforms/src/lib/auth.tsnew file mode 100644index 00000000000..285ac8394bc--- /dev/null+++ b/packages/pieces/community/gravityforms/src/lib/auth.ts@@ -0,0 +1,41 @@+import { AppConnectionType, PieceAuth, Property, tryCatch } from '@activepieces/pieces-framework';+import { gravityFormsApi } from './common/api';++const authGuide = `+1. In WordPress, go to **Forms > Settings > REST API** and tick **Enabled** under "Enable access to the API".+2. Under **Authentication (API version 2)**, click **Add Key**, pick an administrator user and set **Permissions** to **Read/Write**.+3. Copy the **Consumer Key** and **Consumer Secret**; they are shown only once.+4. **Site URL** is your WordPress home address. It must start with https.+`;++export const gravityFormsAuth = PieceAuth.CustomAuth({+ description: authGuide,+ required: true,+ props: {+ siteUrl: Property.ShortText({+ displayName: 'Site URL',+ description: 'Your WordPress site address, e.g. https://example.com',+ required: true,+ }),+ consumerKey: Property.ShortText({+ displayName: 'Consumer Key',+ required: true,+ }),+ consumerSecret: PieceAuth.SecretText({+ displayName: 'Consumer Secret',+ required: true,+ }),+ },+ validate: async ({ auth }) => {+ const { error } = await tryCatch(() =>+ gravityFormsApi.listForms({ auth: { type: AppConnectionType.CUSTOM_AUTH, props: auth } }),+ );+ if (error) {+ return {+ valid: false,+ error: 'Could not connect to Gravity Forms. Check the site URL (HTTPS), that the REST API is enabled, and the consumer key and secret.',+ };+ }+ return { valid: true };+ },+});diff --git a/packages/pieces/community/gravityforms/src/lib/common/ai-props.ts b/packages/pieces/community/gravityforms/src/lib/common/ai-props.tsnew file mode 100644index 00000000000..a8fefa33872--- /dev/null+++ b/packages/pieces/community/gravityforms/src/lib/common/ai-props.ts@@ -0,0 +1,154 @@+import { Property } from '@activepieces/pieces-framework';++function formId<R extends boolean>({+ required,+ displayName = 'Form ID',+ description = 'Numeric form id, e.g. "14". Use List Forms to find it.',+}: PropParams<R>) {+ return Property.ShortText({ displayName, description, required });+}++function entryId<R extends boolean>({+ required,+ displayName = 'Entry ID',+ description = 'Numeric entry id, e.g. "159". Use List Entries to find it.',+}: PropParams<R>) {+ return Property.ShortText({ displayName, description, required });+}++function inputValues<R extends boolean>({+ required,+ displayName = 'Input Values',+ description = 'Object of input names to values, e.g. {"input_1":"Jane","input_2_3":"Doe","input_5":"[email protected]"}. Names are input_<field id>, with _<sub id> for sub-inputs like name parts; get field ids from Get Form.',+}: PropParams<R>) {+ return Property.Json({ displayName, description, required });+}++function populationValues<R extends boolean>({+ required,+ displayName = 'Dynamic Population Values',+ description = 'Object of dynamic population parameter names to values, used to evaluate conditional logic, e.g. {"source":"agent"}. Defaults to none.',+}: PropParams<R>) {+ return Property.Json({ displayName, description, required });+}++function sourcePage<R extends boolean>({+ required,+ displayName = 'Source Page',+ description = 'Multi-page forms only: the page the values were submitted from. Defaults to 1.',+}: PropParams<R>) {+ return Property.Number({ displayName, description, required });+}++function targetPage<R extends boolean>({+ required,+ displayName = 'Target Page',+ description = 'Multi-page forms only: the page to go to next if this page is valid; 0 submits the form. Defaults to 0.',+}: PropParams<R>) {+ return Property.Number({ displayName, description, required });+}++function status<R extends boolean>({+ required,+ displayName = 'Entry Status',+ description = 'Which entries to include: "active", "spam" or "trash". Defaults to "active".',+}: PropParams<R>) {+ return Property.StaticDropdown({+ displayName,+ description,+ required,+ options: {+ options: [+ { label: 'Active', value: 'active' },+ { label: 'Spam', value: 'spam' },+ { label: 'Trash', value: 'trash' },+ ],+ },+ });+}++function fieldFilters<R extends boolean>({+ required,+ displayName = 'Field Filters',+ description = 'Array of filters, e.g. [{"key":"1","value":"Jane","operator":"contains"}]. key is a field id, entry property (e.g. "date_created", "is_starred") or meta key; operator is one of =, is, isnot, <>, contains, like, in, notin and defaults to "=". Use List Field Filters to see valid keys. Defaults to no filter.',+}: PropParams<R>) {+ return Property.Json({ displayName, description, required });+}++function filterMode<R extends boolean>({+ required,+ displayName = 'Filter Mode',+ description = '"all" matches entries that pass every filter, "any" entries that pass at least one. Defaults to "all".',+}: PropParams<R>) {+ return Property.StaticDropdown({+ displayName,+ description,+ required,+ options: {+ options: [+ { label: 'All', value: 'all' },+ { label: 'Any', value: 'any' },+ ],+ },+ });+}++function fieldValues<R extends boolean>({+ required,+ displayName = 'Field Values',+ description = 'Object of field ids to values, e.g. {"1":"Jane","2.3":"Doe","5":"[email protected]"}. Sub-inputs like name parts use <field id>.<sub id>; get ids from Get Form.',+}: PropParams<R>) {+ return Property.Json({ displayName, description, required });+}++function entryProperties<R extends boolean>({+ required,+ displayName = 'Entry Properties',+ description = 'Other Entry Object properties, e.g. {"is_starred":1,"is_read":1,"status":"active","created_by":1,"source_url":"https://example.com/contact"}. Defaults to none.',+}: PropParams<R>) {+ return Property.Json({ displayName, description, required });+}++function feedId<R extends boolean>({+ required,+ displayName = 'Feed ID',+ description = 'Numeric add-on feed id, e.g. "3". Use List Feeds to find it.',+}: PropParams<R>) {+ return Property.ShortText({ displayName, description, required });+}++function force<R extends boolean>({+ required,+ displayName = 'Delete Permanently',+ description = '"true" deletes permanently and cannot be undone. Defaults to "false", which moves it to the trash.',+}: PropParams<R>) {+ return Property.StaticDropdown({+ displayName,+ description,+ required,+ options: {+ options: [+ { label: 'Yes', value: 'true' },+ { label: 'No', value: 'false' },+ ],+ },+ });+}++export const gravityFormsAiProps = {+ formId,+ entryId,+ feedId,+ inputValues,+ populationValues,+ sourcePage,+ targetPage,+ status,+ fieldFilters,+ filterMode,+ fieldValues,+ entryProperties,+ force,+};++export type PropParams<R extends boolean> = { required: R; displayName?: string; description?: string };diff --git a/packages/pieces/community/gravityforms/src/lib/common/api.ts b/packages/pieces/community/gravityforms/src/lib/common/api.tsnew file mode 100644index 00000000000..6da1abdf75a--- /dev/null+++ b/packages/pieces/community/gravityforms/src/lib/common/api.ts@@ -0,0 +1,29 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { gravityFormsClient } from './client';+import type { GravityFormsAuthValue, GravityFormsEntry, GravityFormsForm, GravityFormsFormSummary } from './types';++async function listForms({ auth }: { auth: GravityFormsAuthValue }): Promise<Record<string, GravityFormsFormSummary>> {+ return await gravityFormsClient.request<Record<string, GravityFormsFormSummary>>({+ auth,+ method: HttpMethod.GET,+ path: '/forms',+ });+}++async function getForm({ auth, formId }: { auth: GravityFormsAuthValue; formId: string }): Promise<GravityFormsForm> {+ return await gravityFormsClient.request<GravityFormsForm>({+ auth,+ method: HttpMethod.GET,+ path: `/forms/${encodeURIComponent(formId)}`,+ });+}++async function getEntry({ auth, entryId }: { auth: GravityFormsAuthValue; entryId: string }): Promise<GravityFormsEntry> {+ return await gravityFormsClient.request<GravityFormsEntry>({+ auth,+ method: HttpMethod.GET,+ path: `/entries/${encodeURIComponent(entryId)}`,+ });+}++export const gravityFormsApi = { listForms, getForm, getEntry };diff --git a/packages/pieces/community/gravityforms/src/lib/common/client.ts b/packages/pieces/community/gravityforms/src/lib/common/client.tsnew file mode 100644index 00000000000..3b6420ba72e--- /dev/null+++ b/packages/pieces/community/gravityforms/src/lib/common/client.ts@@ -0,0 +1,29 @@+import { AuthenticationType, HttpMethod, httpClient, QueryParams } from '@activepieces/pieces-common';+import type { GravityFormsAuthValue } from './types';++function baseUrl({ auth }: { auth: GravityFormsAuthValue }): string {+ const siteUrl = auth.props.siteUrl.trim().replace(/\/+$/, '');+ if (!siteUrl.toLowerCase().startsWith('https://')) {+ throw new Error('The Gravity Forms site URL must start with https://.');+ }+ return `${siteUrl}/wp-json/gf/v2`;+}++async function request<T>({ auth, method, path, query, body }: RequestParams & { auth: GravityFormsAuthValue }): Promise<T> {+ const response = await httpClient.sendRequest<T>({+ method,+ url: `${baseUrl({ auth })}${path}`,+ authentication: {+ type: AuthenticationType.BASIC,+ username: auth.props.consumerKey,+ password: auth.props.consumerSecret,+ },+ queryParams: query,+ body,+ });+ return response.body;+}++export const gravityFormsClient = { baseUrl, request };++type RequestParams = { method: HttpMethod; path: string; query?: QueryParams; body?: unknown };diff --git a/packages/pieces/community/gravityforms/src/lib/common/types.ts b/packages/pieces/community/gravityforms/src/lib/common/types.tsnew file mode 100644index 00000000000..ea8e35e4eec--- /dev/null+++ b/packages/pieces/community/gravityforms/src/lib/common/types.ts@@ -0,0 +1,53 @@+import type { AppConnectionType } from '@activepieces/pieces-framework';++export type GravityFormsAuthValue = {+ type: AppConnectionType.CUSTOM_AUTH;+ props: { siteUrl: string; consumerKey: string; consumerSecret: string };+};++export type GravityFormsFormSummary = { id: string; title: string; entries?: string };++export type GravityFormsForm = {+ id?: string;+ title?: string;+ description?: string;+ fields?: unknown[];+ [key: string]: unknown;+};++export type GravityFormsEntry = {+ id?: string;+ form_id?: string;+ [key: string]: unknown;+};++export type GravityFormsDeleted<T> = { deleted: boolean; previous: T };++export type GravityFormsSubmissionResult = {+ is_valid: boolean;+ validation_messages?: Record<string, string> | string[];+ page_number?: number;+ source_page_number?: number;+ confirmation_message?: string;+ confirmation_type?: string;+ confirmation_redirect?: string;+ entry_id?: number;+ resume_token?: string;+ is_spam?: boolean;+};++export type GravityFormsFeed = {+ id?: number | string;+ form_id?: number | string;+ addon_slug?: string;+ is_active?: boolean | string;+ feed_order?: number | string;+ meta?: Record<string, unknown>;+};++export type GravityFormsEntryList = { total_count: number; entries: GravityFormsEntry[] };++export type GravityFormsSearch = {+ status?: string;+ field_filters?: Record<string, unknown>;+};diff --git a/packages/pieces/community/gravityforms/src/lib/common/utils.ts b/packages/pieces/community/gravityforms/src/lib/common/utils.tsnew file mode 100644index 00000000000..34447339bb4--- /dev/null+++ b/packages/pieces/community/gravityforms/src/lib/common/utils.ts@@ -0,0 +1,20 @@+import type { GravityFormsSearch } from './types';++function searchQuery({+ status,+ fieldFilters,+ filterMode,+}: {+ status?: string;+ fieldFilters?: unknown;+ filterMode?: string;+}): Record<string, string> {+ const filters = Array.isArray(fieldFilters) ? fieldFilters : [];+ const search: GravityFormsSearch = {+ ...(status ? { status } : {}),+ ...(filters.length > 0 ? { field_filters: { ...filters, mode: filterMode ?? 'all' } } : {}),+ };+ return Object.keys(search).length > 0 ? { search: JSON.stringify(search) } : {};+}++export const gravityFormsUtils = { searchQuery };diff --git a/packages/pieces/community/gravityforms/src/lib/output-schemas.ts b/packages/pieces/community/gravityforms/src/lib/output-schemas.tsnew file mode 100644index 00000000000..084cbe00e60--- /dev/null+++ b/packages/pieces/community/gravityforms/src/lib/output-schemas.ts@@ -0,0 +1,242 @@+import { OutputSchema } from '@activepieces/pieces-framework';++const formFieldFields: OutputSchema['fields'] = [+ { key: 'id', label: 'Field ID', format: 'number' },+ { key: 'type', label: 'Type' },+ { key: 'label', label: 'Label' },+ { key: 'adminLabel', label: 'Admin Label' },+ { key: 'description', label: 'Description' },+ { key: 'isRequired', label: 'Required', format: 'boolean' },+ { key: 'placeholder', label: 'Placeholder' },+ { key: 'defaultValue', label: 'Default Value' },+ { key: 'inputName', label: 'Parameter Name' },+ { key: 'inputType', label: 'Input Type' },+ { key: 'visibility', label: 'Visibility' },+ { key: 'pageNumber', label: 'Page Number', format: 'number' },+ { key: 'formId', label: 'Form ID', format: 'number' },+ { key: 'cssClass', label: 'CSS Class' },+ { key: 'maxLength', label: 'Max Length' },+ { key: 'noDuplicates', label: 'No Duplicates', format: 'boolean' },+ { key: 'allowsPrepopulate', label: 'Allows Prepopulate', format: 'boolean' },+ { key: 'errorMessage', label: 'Error Message' },+ { key: 'inputs', label: 'Inputs' },+ { key: 'choices', label: 'Choices' },+ { key: 'conditionalLogic', label: 'Conditional Logic' },+];++const formFields: OutputSchema['fields'] = [+ { key: 'id', label: 'Form ID', format: 'number' },+ { key: 'title', label: 'Title' },+ { key: 'description', label: 'Description' },+ { key: 'fields', label: 'Fields', labelKey: 'label', listItems: formFieldFields },+ { key: 'notifications', label: 'Notifications', dynamicKey: true, labelKey: 'name' },+ {+ key: 'confirmations',+ label: 'Confirmations',+ dynamicKey: true,+ labelKey: 'name',+ children: [+ { key: 'id', label: 'Confirmation ID' },+ { key: 'name', label: 'Name' },+ { key: 'isDefault', label: 'Default', format: 'boolean' },+ { key: 'type', label: 'Type' },+ { key: 'message', label: 'Message', format: 'html' },+ { key: 'url', label: 'Redirect URL' },+ { key: 'pageId', label: 'Page ID' },+ { key: 'queryString', label: 'Query String' },+ ],+ },+ {+ key: 'button',+ label: 'Submit Button',+ children: [+ { key: 'type', label: 'Type' },+ { key: 'text', label: 'Text' },+ ],+ },+ { key: 'labelPlacement', label: 'Label Placement' },+ { key: 'descriptionPlacement', label: 'Description Placement' },+ { key: 'validationPlacement', label: 'Validation Placement' },+ { key: 'subLabelPlacement', label: 'Sub-Label Placement' },+ { key: 'requiredIndicator', label: 'Required Indicator' },+ { key: 'validationSummary', label: 'Validation Summary', format: 'boolean' },+ { key: 'columnLayout', label: 'Column Layout' },+ { key: 'nextFieldId', label: 'Next Field ID', format: 'number' },+ { key: 'is_active', label: 'Active' },+ { key: 'is_trash', label: 'In Trash' },+ { key: 'date_created', label: 'Created At', format: 'datetime' },+ { key: 'version', label: 'Gravity Forms Version' },+ { key: 'markupVersion', label: 'Markup Version', format: 'number' },+];++const entryFields: OutputSchema['fields'] = [+ { key: 'id', label: 'Entry ID' },+ { key: 'form_id', label: 'Form ID' },+ { key: 'status', label: 'Status' },+ { key: 'date_created', label: 'Created At', format: 'datetime' },+ { key: 'date_updated', label: 'Updated At', format: 'datetime' },+ { key: 'created_by', label: 'Created By User ID' },+ { key: 'is_starred', label: 'Starred' },+ { key: 'is_read', label: 'Read' },+ { key: 'ip', label: 'IP Address' },+ { key: 'source_url', label: 'Source URL', format: 'url' },+ { key: 'user_agent', label: 'User Agent' },+ { key: 'post_id', label: 'Post ID' },+ { key: 'currency', label: 'Currency' },+ { key: 'payment_status', label: 'Payment Status' },+ { key: 'payment_date', label: 'Payment Date', format: 'datetime' },+ { key: 'payment_amount', label: 'Payment Amount' },+ { key: 'payment_method', label: 'Payment Method' },+ { key: 'transaction_id', label: 'Transaction ID' },+ { key: 'transaction_type', label: 'Transaction Type' },+ { key: 'is_fulfilled', label: 'Fulfilled' },+];++const feedFields: OutputSchema['fields'] = [+ { key: 'id', label: 'Feed ID' },+ { key: 'form_id', label: 'Form ID' },+ { key: 'addon_slug', label: 'Add-on Slug' },+ { key: 'is_active', label: 'Active' },+ { key: 'feed_order', label: 'Order' },+ { key: 'event_type', label: 'Event Type' },+ { key: 'meta', label: 'Settings', children: [{ key: 'feedName', label: 'Feed Name' }] },+];++const submissionFields: OutputSchema['fields'] = [+ { key: 'is_valid', label: 'Valid', format: 'boolean' },+ { key: 'validation_messages', label: 'Validation Messages', dynamicKey: true },+ { key: 'page_number', label: 'Page Number', format: 'number' },+ { key: 'source_page_number', label: 'Source Page Number', format: 'number' },+ { key: 'is_spam', label: 'Spam', format: 'boolean' },+];++export const gravityformsListFormsOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'forms',+ label: 'Forms',+ labelKey: 'title',+ listItems: [+ { key: 'id', label: 'Form ID' },+ { key: 'title', label: 'Title' },+ { key: 'entries', label: 'Entry Count' },+ ],+ },+ { key: 'count', label: 'Count', format: 'number' },+ ],+};++export const gravityformsGetFormOutputSchema: OutputSchema = { fields: formFields };++export const gravityformsCreateFormOutputSchema: OutputSchema = { fields: formFields };++export const gravityformsUpdateFormOutputSchema: OutputSchema = { fields: formFields };++export const gravityformsDeleteFormOutputSchema: OutputSchema = {+ fields: [+ { key: 'deleted', label: 'Permanently Deleted', format: 'boolean' },+ { key: 'previous', label: 'Form', children: formFields },+ ],+};++export const gravityformsSubmitFormOutputSchema: OutputSchema = {+ fields: [+ ...submissionFields.filter((field) => field.key !== 'validation_messages'),+ { key: 'confirmation_type', label: 'Confirmation Type' },+ { key: 'confirmation_message', label: 'Confirmation Message', format: 'html' },+ ],+};++export const gravityformsValidateSubmissionOutputSchema: OutputSchema = { fields: submissionFields };++export const gravityformsListFieldFiltersOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'field_filters',+ label: 'Field Filters',+ labelKey: 'text',+ listItems: [+ { key: 'key', label: 'Filter Key' },+ { key: 'text', label: 'Label' },+ { key: 'operators', label: 'Operators' },+ { key: 'preventMultiple', label: 'Prevent Multiple', format: 'boolean' },+ { key: 'placeholder', label: 'Placeholder' },+ { key: 'cssClass', label: 'CSS Class' },+ {+ key: 'values',+ label: 'Values',+ labelKey: 'text',+ listItems: [+ { key: 'text', label: 'Label' },+ { key: 'value', label: 'Value' },+ ],+ },+ ],+ },+ { key: 'count', label: 'Count', format: 'number' },+ ],+};++export const gravityformsListEntriesOutputSchema: OutputSchema = {+ fields: [+ { key: 'total_count', label: 'Total Matching Entries', format: 'number' },+ { key: 'entries', label: 'Entries', labelKey: 'id', listItems: entryFields },+ ],+};++export const gravityformsGetEntryOutputSchema: OutputSchema = { fields: entryFields };++export const gravityformsCreateEntryOutputSchema: OutputSchema = {+ fields: [+ { key: 'id', label: 'Entry ID', format: 'number' },+ { key: 'form_id', label: 'Form ID', format: 'number' },+ { key: 'is_starred', label: 'Starred', format: 'number' },+ ],+};++export const gravityformsDeleteEntryOutputSchema: OutputSchema = {+ fields: [+ { key: 'deleted', label: 'Permanently Deleted', format: 'boolean' },+ { key: 'previous', label: 'Entry', children: entryFields },+ ],+};++export const gravityformsSendNotificationsOutputSchema: OutputSchema = {+ fields: [+ { key: 'notification_ids', label: 'Sent Notification IDs' },+ { key: 'count', label: 'Count', format: 'number' },+ ],+};++export const gravityformsListFeedsOutputSchema: OutputSchema = {+ fields: [+ { key: 'feeds', label: 'Feeds', labelKey: 'addon_slug', listItems: feedFields },+ { key: 'count', label: 'Count', format: 'number' },+ ],+};++export const gravityformsGetFeedOutputSchema: OutputSchema = { fields: feedFields };++export const gravityformsCreateFeedOutputSchema: OutputSchema = {+ fields: [+ { key: 'id', label: 'Feed ID', format: 'number' },+ { key: 'form_id', label: 'Form ID', format: 'number' },+ { key: 'addon_slug', label: 'Add-on Slug' },+ { key: 'meta', label: 'Settings', children: [{ key: 'feedName', label: 'Feed Name' }] },+ ],+};++export const gravityformsDeleteFeedOutputSchema: OutputSchema = {+ fields: [+ { key: 'deleted', label: 'Deleted', format: 'boolean' },+ { key: 'previous', label: 'Feed', children: feedFields },+ ],+};++export const gravityformsGetFormResultsOutputSchema: OutputSchema = {+ fields: [+ { key: 'entry_count', label: 'Entry Count', format: 'number' },+ { key: 'status', label: 'Calculation Status' },+ { key: 'timestamp', label: 'Calculated At (Unix Seconds)', format: 'number' },+ ],+};diff --git a/packages/pieces/community/gravityforms/src/lib/triggers/new-submission.ts b/packages/pieces/community/gravityforms/src/lib/triggers/new-submission.tsindex 190b6bb3eda..da4d45896e4 100644--- a/packages/pieces/community/gravityforms/src/lib/triggers/new-submission.ts+++ b/packages/pieces/community/gravityforms/src/lib/triggers/new-submission.ts@@ -18,11 +18,12 @@ const markdown = `- Keep the other settings unchanged (default).`;-export const gravityFormsNewSubmission = createTrigger({+export const newSubmissionTrigger = createTrigger({name: 'new-submission',classification: 'READ',displayName: 'New Submission',auth: PieceAuth.None(),+ requireAuth: false,description: 'Triggers when form receives a new submission',aiMetadata: {description:@@ -35,11 +36,11 @@ export const gravityFormsNewSubmission = createTrigger({},type: TriggerStrategy.WEBHOOK,sampleData: {},- async onEnable(context) {- // Empty+ async onEnable() {+ return;},- async onDisable(context) {- // Empty+ async onDisable() {+ return;},async run(context) {return [context.payload];