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(cloudinary): add AI actions and output schemas (#16077)
Kishan Parmar621fb0cfa4ab
diff --git a/bun.lock b/bun.lockindex db3fabecc8b..a4162aa4329 100644--- a/bun.lock+++ b/bun.lock@@ -2043,7 +2043,7 @@},"packages/pieces/community/cloudinary": {"name": "@activepieces/piece-cloudinary",- "version": "0.1.7",+ "version": "0.2.0","dependencies": {"@activepieces/core-piece-types": "workspace:*","@activepieces/core-utils": "workspace:*",diff --git a/packages/pieces/community/cloudinary/package.json b/packages/pieces/community/cloudinary/package.jsonindex 785f5d65cd7..e14f4ac93d9 100644--- a/packages/pieces/community/cloudinary/package.json+++ b/packages/pieces/community/cloudinary/package.json@@ -1,6 +1,6 @@{"name": "@activepieces/piece-cloudinary",- "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/cloudinary/src/index.ts b/packages/pieces/community/cloudinary/src/index.tsindex b8e86b6bbc0..b9d782af3c9 100644--- a/packages/pieces/community/cloudinary/src/index.ts+++ b/packages/pieces/community/cloudinary/src/index.ts@@ -8,6 +8,72 @@ import { findResourceByPublicId } from "./lib/actions/find-resource-by-public-idimport { transformResource } from "./lib/actions/transform-resource";import { newResourceInFolder } from "./lib/triggers/new-resource";import { newTagAddedToAsset } from "./lib/triggers/new-tag-added-to-asset";+import { cloudinaryAddRelatedAssetsByAssetId } from "./lib/actions/ai/add-related-assets-by-asset-id";+import { cloudinaryAddRelatedAssets } from "./lib/actions/ai/add-related-assets";+import { cloudinaryConcatenateVideos } from "./lib/actions/ai/concatenate-videos";+import { cloudinaryCreateFolder } from "./lib/actions/ai/create-folder";+import { cloudinaryCreateImageFromText } from "./lib/actions/ai/create-image-from-text";+import { cloudinaryCreateMetadataField } from "./lib/actions/ai/create-metadata-field";+import { cloudinaryCreateMultiResource } from "./lib/actions/ai/create-multi-resource";+import { cloudinaryCreateTransformation } from "./lib/actions/ai/create-transformation";+import { cloudinaryDeleteDerivedResources } from "./lib/actions/ai/delete-derived-resources";+import { cloudinaryDeleteFolder } from "./lib/actions/ai/delete-folder";+import { cloudinaryDeleteMetadataDatasourceEntries } from "./lib/actions/ai/delete-metadata-datasource-entries";+import { cloudinaryDeleteMetadataField } from "./lib/actions/ai/delete-metadata-field";+import { cloudinaryDeleteRelatedAssetsByAssetId } from "./lib/actions/ai/delete-related-assets-by-asset-id";+import { cloudinaryDeleteRelatedAssets } from "./lib/actions/ai/delete-related-assets";+import { cloudinaryDeleteResourcesByTag } from "./lib/actions/ai/delete-resources-by-tag";+import { cloudinaryDeleteResources } from "./lib/actions/ai/delete-resources";+import { cloudinaryDeleteTransformation } from "./lib/actions/ai/delete-transformation";+import { cloudinaryDestroyAssetById } from "./lib/actions/ai/destroy-asset-by-id";+import { cloudinaryExplicitResource } from "./lib/actions/ai/explicit-resource";+import { cloudinaryExplodeResource } from "./lib/actions/ai/explode-resource";+import { cloudinaryGenerateArchive } from "./lib/actions/ai/generate-archive";+import { cloudinaryGenerateDownloadUrl } from "./lib/actions/ai/generate-download-url";+import { cloudinaryGetConfig } from "./lib/actions/ai/get-config";+import { cloudinaryGetFolder } from "./lib/actions/ai/get-folder";+import { cloudinaryGetMetadataField } from "./lib/actions/ai/get-metadata-field";+import { cloudinaryGetResourceByAssetId } from "./lib/actions/ai/get-resource-by-asset-id";+import { cloudinaryGetResource } from "./lib/actions/ai/get-resource";+import { cloudinaryGetTransformation } from "./lib/actions/ai/get-transformation";+import { cloudinaryGetUploadPreset } from "./lib/actions/ai/get-upload-preset";+import { cloudinaryGetUsage } from "./lib/actions/ai/get-usage";+import { cloudinaryGetVideoViews } from "./lib/actions/ai/get-video-views";+import { cloudinaryListMetadataFields } from "./lib/actions/ai/list-metadata-fields";+import { cloudinaryListResourceTypes } from "./lib/actions/ai/list-resource-types";+import { cloudinaryListResourcesByAssetFolder } from "./lib/actions/ai/list-resources-by-asset-folder";+import { cloudinaryListResourcesByAssetIds } from "./lib/actions/ai/list-resources-by-asset-ids";+import { cloudinaryListResourcesByContext } from "./lib/actions/ai/list-resources-by-context";+import { cloudinaryListResourcesByExternalIds } from "./lib/actions/ai/list-resources-by-external-ids";+import { cloudinaryListResourcesByTag } from "./lib/actions/ai/list-resources-by-tag";+import { cloudinaryListResourcesInModeration } from "./lib/actions/ai/list-resources-in-moderation";+import { cloudinaryListResources } from "./lib/actions/ai/list-resources";+import { cloudinaryListRootFolders } from "./lib/actions/ai/list-root-folders";+import { cloudinaryListSubfolders } from "./lib/actions/ai/list-subfolders";+import { cloudinaryListTags } from "./lib/actions/ai/list-tags";+import { cloudinaryListTransformations } from "./lib/actions/ai/list-transformations";+import { cloudinaryListUploadPresets } from "./lib/actions/ai/list-upload-presets";+import { cloudinaryOrderMetadataDatasource } from "./lib/actions/ai/order-metadata-datasource";+import { cloudinaryRenameFolder } from "./lib/actions/ai/rename-folder";+import { cloudinaryRenameResource } from "./lib/actions/ai/rename-resource";+import { cloudinaryReorderMetadataField } from "./lib/actions/ai/reorder-metadata-field";+import { cloudinaryReorderMetadataFields } from "./lib/actions/ai/reorder-metadata-fields";+import { cloudinaryRestoreMetadataDatasourceEntries } from "./lib/actions/ai/restore-metadata-datasource-entries";+import { cloudinarySearchAllMetadataDatasources } from "./lib/actions/ai/search-all-metadata-datasources";+import { cloudinarySearchAssets } from "./lib/actions/ai/search-assets";+import { cloudinarySearchFolders } from "./lib/actions/ai/search-folders";+import { cloudinarySearchMetadataFieldDatasource } from "./lib/actions/ai/search-metadata-field-datasource";+import { cloudinaryUpdateMetadataFieldDatasource } from "./lib/actions/ai/update-metadata-field-datasource";+import { cloudinaryUpdateMetadataField } from "./lib/actions/ai/update-metadata-field";+import { cloudinaryUpdateResourceByAssetId } from "./lib/actions/ai/update-resource-by-asset-id";+import { cloudinaryUpdateResourceContext } from "./lib/actions/ai/update-resource-context";+import { cloudinaryUpdateResourceMetadata } from "./lib/actions/ai/update-resource-metadata";+import { cloudinaryUpdateResourceTags } from "./lib/actions/ai/update-resource-tags";+import { cloudinaryUpdateResource } from "./lib/actions/ai/update-resource";+import { cloudinaryUpdateTransformation } from "./lib/actions/ai/update-transformation";+import { cloudinaryUploadAsset } from "./lib/actions/ai/upload-asset";+import { createCustomApiCallAction } from "@activepieces/pieces-common";+import { BASE_URL } from "./lib/common/client";import { PieceCategory } from '@activepieces/pieces-framework';export const cloudinary = createPiece({@@ -15,9 +81,86 @@ export const cloudinary = createPiece({auth: cloudinaryAuth,description: "Cloudinary is a cloud-based image and video management platform that allows you to upload, store, manage, and deliver your media assets. It provides a range of features for image and video optimization, transformation, and delivery.",categories: [PieceCategory.CONTENT_AND_FILES],- minimumSupportedRelease: '0.36.1',+ minimumSupportedRelease: '0.88.2',logoUrl: "https://cdn.activepieces.com/pieces/cloudinary.png",authors: ['Sanket6652','onyedikachi-david'],- actions: [uploadResource, deleteResource, createUsageReport, findResourceByPublicId, transformResource],+ actions: [+ uploadResource,+ deleteResource,+ createUsageReport,+ findResourceByPublicId,+ transformResource,+ cloudinaryAddRelatedAssetsByAssetId,+ cloudinaryAddRelatedAssets,+ cloudinaryConcatenateVideos,+ cloudinaryCreateFolder,+ cloudinaryCreateImageFromText,+ cloudinaryCreateMetadataField,+ cloudinaryCreateMultiResource,+ cloudinaryCreateTransformation,+ cloudinaryDeleteDerivedResources,+ cloudinaryDeleteFolder,+ cloudinaryDeleteMetadataDatasourceEntries,+ cloudinaryDeleteMetadataField,+ cloudinaryDeleteRelatedAssetsByAssetId,+ cloudinaryDeleteRelatedAssets,+ cloudinaryDeleteResourcesByTag,+ cloudinaryDeleteResources,+ cloudinaryDeleteTransformation,+ cloudinaryDestroyAssetById,+ cloudinaryExplicitResource,+ cloudinaryExplodeResource,+ cloudinaryGenerateArchive,+ cloudinaryGenerateDownloadUrl,+ cloudinaryGetConfig,+ cloudinaryGetFolder,+ cloudinaryGetMetadataField,+ cloudinaryGetResourceByAssetId,+ cloudinaryGetResource,+ cloudinaryGetTransformation,+ cloudinaryGetUploadPreset,+ cloudinaryGetUsage,+ cloudinaryGetVideoViews,+ cloudinaryListMetadataFields,+ cloudinaryListResourceTypes,+ cloudinaryListResourcesByAssetFolder,+ cloudinaryListResourcesByAssetIds,+ cloudinaryListResourcesByContext,+ cloudinaryListResourcesByExternalIds,+ cloudinaryListResourcesByTag,+ cloudinaryListResourcesInModeration,+ cloudinaryListResources,+ cloudinaryListRootFolders,+ cloudinaryListSubfolders,+ cloudinaryListTags,+ cloudinaryListTransformations,+ cloudinaryListUploadPresets,+ cloudinaryOrderMetadataDatasource,+ cloudinaryRenameFolder,+ cloudinaryRenameResource,+ cloudinaryReorderMetadataField,+ cloudinaryReorderMetadataFields,+ cloudinaryRestoreMetadataDatasourceEntries,+ cloudinarySearchAllMetadataDatasources,+ cloudinarySearchAssets,+ cloudinarySearchFolders,+ cloudinarySearchMetadataFieldDatasource,+ cloudinaryUpdateMetadataFieldDatasource,+ cloudinaryUpdateMetadataField,+ cloudinaryUpdateResourceByAssetId,+ cloudinaryUpdateResourceContext,+ cloudinaryUpdateResourceMetadata,+ cloudinaryUpdateResourceTags,+ cloudinaryUpdateResource,+ cloudinaryUpdateTransformation,+ cloudinaryUploadAsset,+ createCustomApiCallAction({+ auth: cloudinaryAuth,+ baseUrl: (auth) => (auth ? `${BASE_URL}/${auth.props.cloud_name.trim()}` : ''),+ authMapping: async (auth) => ({+ Authorization: `Basic ${Buffer.from(`${auth.props.api_key.trim()}:${auth.props.api_secret.trim()}`).toString('base64')}`,+ }),+ }),+ ],triggers: [newResourceInFolder, newTagAddedToAsset],});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/add-related-assets-by-asset-id.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/add-related-assets-by-asset-id.tsnew file mode 100644index 00000000000..aa06d017501--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/add-related-assets-by-asset-id.ts@@ -0,0 +1,33 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest } from '../../common/client';+import { aiResults } from '../../common/ai-props';+import { cloudinaryAddRelatedAssetsOutputSchema } from '../../output-schemas';++export const cloudinaryAddRelatedAssetsByAssetId = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_add_related_assets_by_asset_id',+ outputSchema: cloudinaryAddRelatedAssetsOutputSchema,+ displayName: 'Add Related Assets by Asset ID',+ description: 'Links up to 10 assets to a source asset, all identified by asset ID.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Creates two-way relations between a source asset and up to 10 other assets, all identified by their immutable asset_id. Use Add Related Assets when you have public IDs. Returns success and failed lists.',+ idempotent: true,+ },+ props: {+ asset_id: Property.ShortText({ displayName: 'Asset ID', description: 'asset_id of the source asset.', required: true }),+ assets_to_relate: Property.Array({+ displayName: 'Asset IDs to Relate',+ description: 'Up to 10 asset_ids.',+ required: true,+ }),+ },+ async run({ auth, propsValue }) {+ const items = aiResults.requireItems({ values: propsValue.assets_to_relate, label: 'related assets', max: 10 });+ return makeRequest(auth, HttpMethod.POST, `/resources/related_assets/${encodeURIComponent(propsValue.asset_id.trim())}`, { assets_to_relate: items });+ },+});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/add-related-assets.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/add-related-assets.tsnew file mode 100644index 00000000000..baecb93d1c6--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/add-related-assets.ts@@ -0,0 +1,35 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest } from '../../common/client';+import { aiProps, aiResults } from '../../common/ai-props';+import { cloudinaryAddRelatedAssetsOutputSchema } from '../../output-schemas';++export const cloudinaryAddRelatedAssets = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_add_related_assets',+ outputSchema: cloudinaryAddRelatedAssetsOutputSchema,+ displayName: 'Add Related Assets',+ description: 'Links up to 10 assets to a source asset by public ID.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Creates two-way relations between a source asset (by public ID) and up to 10 other assets, given as "resource_type/type/public_id" paths (e.g. "image/upload/shoe-side"). Relations show in Get Resource as related_assets. Returns success and failed lists; re-adding an existing relation is reported, not duplicated.',+ idempotent: true,+ },+ props: {+ resource_type: aiProps.resourceType({ required: true }),+ type: aiProps.deliveryType(),+ public_id: Property.ShortText({ displayName: 'Public ID', description: 'Public ID of the source asset.', required: true }),+ assets_to_relate: Property.Array({+ displayName: 'Assets to Relate',+ description: 'Up to 10 asset paths as resource_type/type/public_id (e.g. "image/upload/shoe-side").',+ required: true,+ }),+ },+ async run({ auth, propsValue }) {+ const items = aiResults.requireItems({ values: propsValue.assets_to_relate, label: 'related assets', max: 10 });+ return makeRequest(auth, HttpMethod.POST, `/resources/related_assets/${propsValue.resource_type}/${propsValue.type ?? 'upload'}/${aiResults.encodePath({ value: propsValue.public_id })}`, { assets_to_relate: items });+ },+});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/concatenate-videos.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/concatenate-videos.tsnew file mode 100644index 00000000000..cb8732fb835--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/concatenate-videos.ts@@ -0,0 +1,39 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest } from '../../common/client';+import { aiResults } from '../../common/ai-props';+import { cloudinaryConcatenateVideosOutputSchema } from '../../output-schemas';++export const cloudinaryConcatenateVideos = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_concatenate_videos',+ outputSchema: cloudinaryConcatenateVideosOutputSchema,+ displayName: 'Concatenate Videos',+ description: 'Joins video segments, in order, into a single MP4 asset.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Concatenates two or more videos, given as ordered URLs, into one new MP4 video asset. Processing is asynchronous: the response has status and public_id; call Get Resource (resource type video) on the public_id to check when it is ready. Not idempotent.',+ idempotent: false,+ },+ props: {+ urls: Property.Array({ displayName: 'Video URLs', description: 'At least two video URLs, in playback order.', required: true }),+ public_id: Property.ShortText({ displayName: 'Public ID', description: 'Public ID for the combined video. Leave empty for a random ID.', required: false }),+ asset_folder: Property.ShortText({ displayName: 'Asset Folder', description: 'Folder for the combined video.', required: false }),+ notification_url: Property.ShortText({ displayName: 'Notification URL', description: 'Webhook URL called when processing finishes.', required: false }),+ },+ async run({ auth, propsValue }) {+ const urls = aiResults.requireItems({ values: propsValue.urls, label: 'video URLs', max: 100 });+ if (urls.length < 2) {+ throw new Error('Provide at least two video URLs.');+ }+ return makeRequest(auth, HttpMethod.POST, '/video/concat', {+ urls,+ ...(propsValue.public_id ? { public_id: propsValue.public_id.trim() } : {}),+ ...(propsValue.asset_folder ? { asset_folder: propsValue.asset_folder.trim() } : {}),+ ...(propsValue.notification_url ? { notification_url: propsValue.notification_url.trim() } : {}),+ });+ },+});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/create-folder.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/create-folder.tsnew file mode 100644index 00000000000..80efdfa3142--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/create-folder.ts@@ -0,0 +1,31 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest } from '../../common/client';+import { aiResults } from '../../common/ai-props';+import { cloudinaryCreateFolderOutputSchema } from '../../output-schemas';++export const cloudinaryCreateFolder = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_create_folder',+ outputSchema: cloudinaryCreateFolderOutputSchema,+ displayName: 'Create Folder',+ description: 'Creates an empty folder, including any missing parent folders.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Creates an empty folder at the given path, creating missing parents too. Succeeds without change if the folder already exists. Returns name, path and the folder external_id.',+ idempotent: true,+ },+ props: {+ folder: Property.ShortText({+ displayName: 'Folder Path',+ description: 'Full folder path (e.g. "marketing/banners").',+ required: true,+ }),+ },+ async run({ auth, propsValue }) {+ return makeRequest(auth, HttpMethod.POST, `/folders/${aiResults.encodePath({ value: propsValue.folder })}`);+ },+});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/create-image-from-text.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/create-image-from-text.tsnew file mode 100644index 00000000000..7873fea339d--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/create-image-from-text.ts@@ -0,0 +1,60 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest } from '../../common/client';+import { cloudinaryCreateImageFromTextOutputSchema } from '../../output-schemas';++export const cloudinaryCreateImageFromText = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_create_image_from_text',+ outputSchema: cloudinaryCreateImageFromTextOutputSchema,+ displayName: 'Create Image from Text',+ description: 'Renders text as a new PNG image asset.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Creates a new image asset that renders the given text with optional font, size, color, weight, style, alignment and background. Returns the asset with its public_id and URLs. Not idempotent: each call creates an asset unless the same Public ID is reused.',+ idempotent: false,+ },+ props: {+ text: Property.LongText({ displayName: 'Text', description: 'The text to render.', required: true }),+ public_id: Property.ShortText({ displayName: 'Public ID', description: 'Public ID for the new image. Leave empty for a random ID.', required: false }),+ font_family: Property.ShortText({ displayName: 'Font Family', description: 'Font name (e.g. "Arial"). Defaults to Arial.', required: false }),+ font_size: Property.Number({ displayName: 'Font Size', description: 'Font size in points. Defaults to 12.', required: false }),+ font_color: Property.ShortText({ displayName: 'Font Color', description: 'Color name or hex (e.g. "red", "#FF0000"). Defaults to black.', required: false }),+ font_weight: Property.StaticDropdown({+ displayName: 'Font Weight',+ description: 'Normal or bold.',+ required: false,+ options: { options: [{ label: 'Normal', value: 'normal' }, { label: 'Bold', value: 'bold' }] },+ }),+ font_style: Property.StaticDropdown({+ displayName: 'Font Style',+ description: 'Normal or italic.',+ required: false,+ options: { options: [{ label: 'Normal', value: 'normal' }, { label: 'Italic', value: 'italic' }] },+ }),+ text_align: Property.StaticDropdown({+ displayName: 'Text Align',+ description: 'Alignment for multi-line text.',+ required: false,+ options: { options: ['left', 'center', 'right', 'justify'].map((value) => ({ label: value, value })) },+ }),+ background: Property.ShortText({ displayName: 'Background', description: 'Background color name or hex. Defaults to transparent.', required: false }),+ },+ async run({ auth, propsValue }) {+ const body = {+ text: propsValue.text,+ ...(propsValue.public_id ? { public_id: propsValue.public_id.trim() } : {}),+ ...(propsValue.font_family ? { font_family: propsValue.font_family } : {}),+ ...(propsValue.font_size !== undefined && propsValue.font_size !== null ? { font_size: propsValue.font_size } : {}),+ ...(propsValue.font_color ? { font_color: propsValue.font_color } : {}),+ ...(propsValue.font_weight ? { font_weight: propsValue.font_weight } : {}),+ ...(propsValue.font_style ? { font_style: propsValue.font_style } : {}),+ ...(propsValue.text_align ? { text_align: propsValue.text_align } : {}),+ ...(propsValue.background ? { background: propsValue.background } : {}),+ };+ return makeRequest(auth, HttpMethod.POST, '/image/text', body);+ },+});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/create-metadata-field.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/create-metadata-field.tsnew file mode 100644index 00000000000..133e5f5c59d--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/create-metadata-field.ts@@ -0,0 +1,53 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest } from '../../common/client';+import { aiProps, aiResults } from '../../common/ai-props';+import { cloudinaryCreateMetadataFieldOutputSchema } from '../../output-schemas';++export const cloudinaryCreateMetadataField = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_create_metadata_field',+ outputSchema: cloudinaryCreateMetadataFieldOutputSchema,+ displayName: 'Create Metadata Field',+ description: 'Creates a structured metadata field.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Creates a structured metadata field of type string, integer, date, enum (single choice) or set (multiple choice). Enum and set fields need Allowed Values. A mandatory field needs a Default Value. Fails if the external_id already exists. Returns the field definition, including its datasource values with their external_ids.',+ idempotent: false,+ },+ props: {+ type: Property.StaticDropdown({+ displayName: 'Field Type',+ description: 'The value type.',+ required: true,+ options: { options: ['string', 'integer', 'date', 'enum', 'set'].map((value) => ({ label: value, value })) },+ }),+ label: Property.ShortText({ displayName: 'Label', description: 'Display label of the field.', required: true }),+ external_id: Property.ShortText({ displayName: 'External ID', description: 'Unique ID for the field. Generated when empty.', required: false }),+ datasource_values: Property.Array({ displayName: 'Allowed Values', description: 'Allowed values for enum or set fields.', required: false }),+ mandatory: aiProps.includeFlag({ displayName: 'Mandatory', description: 'Every asset must have a value (requires Default Value).' }),+ default_value: Property.ShortText({ displayName: 'Default Value', description: 'Default value. For integer fields a number; for enum/set the external_id of a datasource value.', required: false }),+ },+ async run({ auth, propsValue }) {+ const values = aiResults.cleanArray({ values: propsValue.datasource_values });+ const isList = propsValue.type === 'enum' || propsValue.type === 'set';+ if (isList && values.length === 0) {+ throw new Error('Enum and set fields need at least one allowed value.');+ }+ if (propsValue.mandatory && !propsValue.default_value) {+ throw new Error('A mandatory field needs a default value.');+ }+ const body = {+ type: propsValue.type,+ label: propsValue.label,+ ...(propsValue.external_id ? { external_id: propsValue.external_id.trim() } : {}),+ ...(isList ? { datasource: { values: values.map((value) => ({ value, external_id: value })) } } : {}),+ ...(propsValue.mandatory ? { mandatory: true } : {}),+ ...(propsValue.default_value ? { default_value: aiResults.toMetadataDefault({ type: propsValue.type, value: propsValue.default_value }) } : {}),+ };+ return makeRequest(auth, HttpMethod.POST, '/metadata_fields', body);+ },+});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/create-multi-resource.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/create-multi-resource.tsnew file mode 100644index 00000000000..1945dfee23e--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/create-multi-resource.ts@@ -0,0 +1,48 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest } from '../../common/client';+import { aiProps, aiResults } from '../../common/ai-props';+import { cloudinaryCreateMultiResourceOutputSchema } from '../../output-schemas';++export const cloudinaryCreateMultiResource = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_create_multi_resource',+ outputSchema: cloudinaryCreateMultiResourceOutputSchema,+ displayName: 'Create Animation from Images',+ description: 'Combines images into an animated GIF, a video or a multi-page PDF.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Combines all images carrying a tag (in public ID order), or an ordered list of image URLs, into one animated image, video or PDF. Set Format to gif, webp, mp4 or pdf, and optionally a transformation such as "dl_200" for frame delay. Returns the new asset\'s URL. Not idempotent.',+ idempotent: false,+ },+ props: {+ tag: Property.ShortText({ displayName: 'Tag', description: 'Combine all images with this tag. Use either this or URLs.', required: false }),+ urls: Property.Array({ displayName: 'Image URLs', description: 'Ordered Cloudinary delivery URLs of the images. Use either this or Tag.', required: false }),+ format: Property.StaticDropdown({+ displayName: 'Output Format',+ description: 'The output file type. Defaults to gif.',+ required: false,+ defaultValue: 'gif',+ options: { options: ['gif', 'webp', 'png', 'mp4', 'webm', 'pdf'].map((value) => ({ label: value, value })) },+ }),+ transformation: Property.ShortText({ displayName: 'Transformation', description: 'Transformation applied to each frame (e.g. "c_fill,w_400,h_400/dl_200").', required: false }),+ async: aiProps.includeFlag({ displayName: 'Process Asynchronously', description: 'Return immediately and generate in the background.' }),+ },+ async run({ auth, propsValue }) {+ const tag = propsValue.tag?.trim();+ const urls = aiResults.cleanArray({ values: propsValue.urls });+ if (Boolean(tag) === urls.length > 0) {+ throw new Error('Provide either Tag or Image URLs, not both.');+ }+ const formatSegment = `f_${propsValue.format ?? 'gif'}`;+ const body = {+ ...(tag ? { tag } : { urls }),+ transformation: propsValue.transformation ? `${propsValue.transformation.trim()}/${formatSegment}` : formatSegment,+ ...(propsValue.async ? { async: true } : {}),+ };+ return makeRequest(auth, HttpMethod.POST, '/image/multi', body);+ },+});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/create-transformation.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/create-transformation.tsnew file mode 100644index 00000000000..cd7664a11ae--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/create-transformation.ts@@ -0,0 +1,36 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest } from '../../common/client';+import { aiProps } from '../../common/ai-props';+import { cloudinaryDeleteMetadataFieldOutputSchema } from '../../output-schemas';++export const cloudinaryCreateTransformation = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_create_transformation',+ outputSchema: cloudinaryDeleteMetadataFieldOutputSchema,+ displayName: 'Create Named Transformation',+ description: 'Saves a transformation under a reusable name.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Creates a named transformation, so delivery URLs can use t_<name> instead of the full parameter string (e.g. name "thumb" for "c_fill,w_200,h_200/f_auto,q_auto"). Fails if the name exists; use Update Named Transformation to change it.',+ idempotent: false,+ },+ props: {+ name: Property.ShortText({+ displayName: 'Transformation Name',+ description: 'Named transformation name, without the t_ prefix.',+ required: true,+ }),+ transformation: Property.ShortText({ displayName: 'Transformation', description: 'Transformation string (e.g. "c_fill,w_200,h_200/f_auto,q_auto").', required: true }),+ allowed_for_strict: aiProps.includeFlag({ displayName: 'Allowed for Strict Mode', description: 'Allow this transformation when strict transformations are enabled.' }),+ },+ async run({ auth, propsValue }) {+ return makeRequest(auth, HttpMethod.POST, `/transformations/${encodeURIComponent(propsValue.name.trim())}`, {+ transformation: propsValue.transformation.trim(),+ ...(propsValue.allowed_for_strict ? { allowed_for_strict: true } : {}),+ });+ },+});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/delete-derived-resources.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/delete-derived-resources.tsnew file mode 100644index 00000000000..44c00164feb--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/delete-derived-resources.ts@@ -0,0 +1,36 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest } from '../../common/client';+import { aiProps, aiResults } from '../../common/ai-props';+import { cloudinaryDeleteDerivedResourcesOutputSchema } from '../../output-schemas';++export const cloudinaryDeleteDerivedResources = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_delete_derived_resources',+ outputSchema: cloudinaryDeleteDerivedResourcesOutputSchema,+ displayName: 'Delete Derived Resources',+ description: 'Deletes generated (derived) versions of assets by their derived resource IDs.',+ audience: 'ai',+ classification: 'DESTRUCTIVE',+ aiMetadata: {+ description:+ 'Deletes up to 100 derived versions (transformed copies) by derived resource ID, keeping the originals. The IDs are the "id" values in the derived array returned by Get Resource. Cloudinary regenerates a derived version on its next request.',+ idempotent: false,+ },+ props: {+ derived_resource_ids: Property.Array({+ displayName: 'Derived Resource IDs',+ description: 'Up to 100 derived resource IDs, from the derived array of Get Resource.',+ required: true,+ }),+ invalidate: aiProps.invalidate(),+ },+ async run({ auth, propsValue }) {+ const ids = aiResults.requireItems({ values: propsValue.derived_resource_ids, label: 'derived resource IDs', max: 100 });+ return makeRequest(auth, HttpMethod.DELETE, '/derived_resources', undefined, {+ derived_resource_ids: ids,+ invalidate: propsValue.invalidate || undefined,+ });+ },+});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/delete-folder.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/delete-folder.tsnew file mode 100644index 00000000000..c0ba2373911--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/delete-folder.ts@@ -0,0 +1,31 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest } from '../../common/client';+import { aiResults } from '../../common/ai-props';+import { cloudinaryDeleteFolderOutputSchema } from '../../output-schemas';++export const cloudinaryDeleteFolder = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_delete_folder',+ outputSchema: cloudinaryDeleteFolderOutputSchema,+ displayName: 'Delete Folder',+ description: 'Deletes an empty folder.',+ audience: 'ai',+ classification: 'DESTRUCTIVE',+ aiMetadata: {+ description:+ 'Deletes a folder and its empty subfolders. Fails if the folder still contains assets (including backed-up ones); delete or move those first. Returns the deleted folder paths.',+ idempotent: false,+ },+ props: {+ folder: Property.ShortText({+ displayName: 'Folder Path',+ description: 'Full folder path (e.g. "marketing/banners").',+ required: true,+ }),+ },+ async run({ auth, propsValue }) {+ return makeRequest(auth, HttpMethod.DELETE, `/folders/${aiResults.encodePath({ value: propsValue.folder })}`);+ },+});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/delete-metadata-datasource-entries.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/delete-metadata-datasource-entries.tsnew file mode 100644index 00000000000..1d40d8bd152--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/delete-metadata-datasource-entries.ts@@ -0,0 +1,37 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest } from '../../common/client';+import { aiResults } from '../../common/ai-props';+import { cloudinaryDeleteMetadataDatasourceEntriesOutputSchema } from '../../output-schemas';++export const cloudinaryDeleteMetadataDatasourceEntries = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_delete_metadata_datasource_entries',+ outputSchema: cloudinaryDeleteMetadataDatasourceEntriesOutputSchema,+ displayName: 'Delete Metadata Datasource Values',+ description: 'Disables allowed values of an enum or set metadata field.',+ audience: 'ai',+ classification: 'DESTRUCTIVE',+ aiMetadata: {+ description:+ 'Soft-deletes allowed values of an enum or set metadata field by value external_id; they disappear from the field and can be brought back with Restore Metadata Datasource Values. Returns the remaining values.',+ idempotent: false,+ },+ props: {+ external_id: Property.ShortText({+ displayName: 'Field External ID',+ description: 'The metadata field external_id, from List Metadata Fields.',+ required: true,+ }),+ value_external_ids: Property.Array({+ displayName: 'Value External IDs',+ description: 'external_ids of the datasource values, from Get Metadata Field.',+ required: true,+ }),+ },+ async run({ auth, propsValue }) {+ const externalIds = aiResults.requireItems({ values: propsValue.value_external_ids, label: 'value external IDs', max: 1000 });+ return makeRequest(auth, HttpMethod.DELETE, `/metadata_fields/${encodeURIComponent(propsValue.external_id.trim())}/datasource`, { external_ids: externalIds });+ },+});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/delete-metadata-field.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/delete-metadata-field.tsnew file mode 100644index 00000000000..0aa6fb141f2--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/delete-metadata-field.ts@@ -0,0 +1,29 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest } from '../../common/client';+import { cloudinaryDeleteMetadataFieldOutputSchema } from '../../output-schemas';++export const cloudinaryDeleteMetadataField = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_delete_metadata_field',+ outputSchema: cloudinaryDeleteMetadataFieldOutputSchema,+ displayName: 'Delete Metadata Field',+ description: 'Deletes a structured metadata field and its values on all assets.',+ audience: 'ai',+ classification: 'DESTRUCTIVE',+ aiMetadata: {+ description: 'Permanently deletes a structured metadata field definition by external_id, removing its values from every asset. Irreversible.',+ idempotent: false,+ },+ props: {+ external_id: Property.ShortText({+ displayName: 'Field External ID',+ description: 'The metadata field external_id, from List Metadata Fields.',+ required: true,+ }),+ },+ async run({ auth, propsValue }) {+ return makeRequest(auth, HttpMethod.DELETE, `/metadata_fields/${encodeURIComponent(propsValue.external_id.trim())}`);+ },+});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/delete-related-assets-by-asset-id.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/delete-related-assets-by-asset-id.tsnew file mode 100644index 00000000000..c4eb393fc55--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/delete-related-assets-by-asset-id.ts@@ -0,0 +1,33 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest } from '../../common/client';+import { aiResults } from '../../common/ai-props';+import { cloudinaryAddRelatedAssetsOutputSchema } from '../../output-schemas';++export const cloudinaryDeleteRelatedAssetsByAssetId = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_delete_related_assets_by_asset_id',+ outputSchema: cloudinaryAddRelatedAssetsOutputSchema,+ displayName: 'Remove Related Assets by Asset ID',+ description: 'Removes relations between a source asset and up to 10 assets, by asset ID.',+ audience: 'ai',+ classification: 'DESTRUCTIVE',+ aiMetadata: {+ description:+ 'Removes the relations between a source asset and up to 10 related assets, all identified by asset_id. The assets themselves are not deleted. Returns success and failed lists.',+ idempotent: false,+ },+ props: {+ asset_id: Property.ShortText({ displayName: 'Asset ID', description: 'asset_id of the source asset.', required: true }),+ assets_to_unrelate: Property.Array({+ displayName: 'Asset IDs to Unrelate',+ description: 'Up to 10 asset_ids.',+ required: true,+ }),+ },+ async run({ auth, propsValue }) {+ const items = aiResults.requireItems({ values: propsValue.assets_to_unrelate, label: 'related assets', max: 10 });+ return makeRequest(auth, HttpMethod.DELETE, `/resources/related_assets/${encodeURIComponent(propsValue.asset_id.trim())}`, { assets_to_unrelate: items });+ },+});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/delete-related-assets.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/delete-related-assets.tsnew file mode 100644index 00000000000..45869d273b4--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/delete-related-assets.ts@@ -0,0 +1,35 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest } from '../../common/client';+import { aiProps, aiResults } from '../../common/ai-props';+import { cloudinaryAddRelatedAssetsOutputSchema } from '../../output-schemas';++export const cloudinaryDeleteRelatedAssets = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_delete_related_assets',+ outputSchema: cloudinaryAddRelatedAssetsOutputSchema,+ displayName: 'Remove Related Assets',+ description: 'Removes relations between a source asset and up to 10 assets, by public ID.',+ audience: 'ai',+ classification: 'DESTRUCTIVE',+ aiMetadata: {+ description:+ 'Removes the relations between a source asset (by public ID) and up to 10 related assets, given as "resource_type/type/public_id" paths. The assets themselves are not deleted. Returns success and failed lists.',+ idempotent: false,+ },+ props: {+ resource_type: aiProps.resourceType({ required: true }),+ type: aiProps.deliveryType(),+ public_id: Property.ShortText({ displayName: 'Public ID', description: 'Public ID of the source asset.', required: true }),+ assets_to_unrelate: Property.Array({+ displayName: 'Assets to Unrelate',+ description: 'Up to 10 asset paths as resource_type/type/public_id.',+ required: true,+ }),+ },+ async run({ auth, propsValue }) {+ const items = aiResults.requireItems({ values: propsValue.assets_to_unrelate, label: 'related assets', max: 10 });+ return makeRequest(auth, HttpMethod.DELETE, `/resources/related_assets/${propsValue.resource_type}/${propsValue.type ?? 'upload'}/${aiResults.encodePath({ value: propsValue.public_id })}`, { assets_to_unrelate: items });+ },+});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/delete-resources-by-tag.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/delete-resources-by-tag.tsnew file mode 100644index 00000000000..e05b4d88889--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/delete-resources-by-tag.ts@@ -0,0 +1,43 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest } from '../../common/client';+import { aiProps, aiResults } from '../../common/ai-props';+import { cloudinaryDeleteResourcesByTagOutputSchema } from '../../output-schemas';++export const cloudinaryDeleteResourcesByTag = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_delete_resources_by_tag',+ outputSchema: cloudinaryDeleteResourcesByTagOutputSchema,+ displayName: 'Delete Resources by Tag',+ description: 'Permanently deletes all assets of one resource type that carry a tag.',+ audience: 'ai',+ classification: 'DESTRUCTIVE',+ aiMetadata: {+ description:+ 'Permanently deletes every asset of one resource type carrying the given tag, up to 1000 per call; partial=true in the result means more remain, so call again. Irreversible unless backups are enabled. Check what matches first with List Resources by Tag.',+ idempotent: false,+ },+ props: {+ resource_type: aiProps.resourceType({ required: true }),+ tag: Property.ShortText({+ displayName: 'Tag',+ description: 'The exact tag whose assets will be deleted.',+ required: true,+ }),+ keep_original: aiProps.includeFlag({ displayName: 'Keep Original', description: 'Delete only derived versions and keep the original files.' }),+ invalidate: aiProps.invalidate(),+ },+ async run({ auth, propsValue }) {+ return makeRequest(+ auth,+ HttpMethod.DELETE,+ `/resources/${propsValue.resource_type}/tags/${encodeURIComponent(propsValue.tag.trim())}`,+ undefined,+ {+ keep_original: propsValue.keep_original || undefined,+ invalidate: propsValue.invalidate || undefined,+ },+ );+ },+});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/delete-resources.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/delete-resources.tsnew file mode 100644index 00000000000..ce9b2c96f19--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/delete-resources.ts@@ -0,0 +1,52 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest } from '../../common/client';+import { aiProps, aiResults } from '../../common/ai-props';+import { cloudinaryDeleteResourcesOutputSchema } from '../../output-schemas';++export const cloudinaryDeleteResources = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_delete_resources',+ outputSchema: cloudinaryDeleteResourcesOutputSchema,+ displayName: 'Delete Resources',+ description: 'Permanently deletes assets by public IDs or by public ID prefix.',+ audience: 'ai',+ classification: 'DESTRUCTIVE',+ aiMetadata: {+ description:+ 'Permanently deletes up to 100 assets of one resource type and delivery type, given either a list of public IDs or a public ID prefix (not both). Irreversible unless backups are enabled. Returns a deleted map of public_id to "deleted" or "not_found", and partial=true when more remain for a prefix (call again). To delete by tag use Delete Resources by Tag.',+ idempotent: false,+ },+ props: {+ resource_type: aiProps.resourceType({ required: true }),+ type: aiProps.deliveryType(),+ public_ids: Property.Array({+ displayName: 'Public IDs',+ description: 'Up to 100 public IDs to delete. Use either this or Prefix.',+ required: false,+ }),+ prefix: Property.ShortText({+ displayName: 'Prefix',+ description: 'Delete every asset whose public ID starts with this value. Use either this or Public IDs.',+ required: false,+ }),+ keep_original: aiProps.includeFlag({ displayName: 'Keep Original', description: 'Delete only derived versions and keep the original files.' }),+ invalidate: aiProps.invalidate(),+ },+ async run({ auth, propsValue }) {+ const publicIds = aiResults.cleanArray({ values: propsValue.public_ids });+ const prefix = propsValue.prefix?.trim();+ if ((publicIds.length > 0) === Boolean(prefix)) {+ throw new Error('Provide either Public IDs or Prefix, not both.');+ }+ if (publicIds.length > 100) {+ throw new Error('Provide at most 100 public IDs per call.');+ }+ return makeRequest(auth, HttpMethod.DELETE, `/resources/${propsValue.resource_type}/${propsValue.type ?? 'upload'}`, undefined, {+ ...(publicIds.length > 0 ? { public_ids: publicIds } : { prefix }),+ keep_original: propsValue.keep_original || undefined,+ invalidate: propsValue.invalidate || undefined,+ });+ },+});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/delete-transformation.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/delete-transformation.tsnew file mode 100644index 00000000000..464ee28f095--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/delete-transformation.ts@@ -0,0 +1,31 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest } from '../../common/client';+import { aiProps } from '../../common/ai-props';+import { cloudinaryDeleteMetadataFieldOutputSchema } from '../../output-schemas';++export const cloudinaryDeleteTransformation = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_delete_transformation',+ outputSchema: cloudinaryDeleteMetadataFieldOutputSchema,+ displayName: 'Delete Named Transformation',+ description: 'Deletes a named transformation.',+ audience: 'ai',+ classification: 'DESTRUCTIVE',+ aiMetadata: {+ description: 'Deletes a named transformation; URLs using t_<name> stop generating new derived assets. Optionally invalidates already-derived copies on the CDN.',+ idempotent: false,+ },+ props: {+ name: Property.ShortText({+ displayName: 'Transformation Name',+ description: 'Named transformation name, without the t_ prefix.',+ required: true,+ }),+ invalidate: aiProps.invalidate(),+ },+ async run({ auth, propsValue }) {+ return makeRequest(auth, HttpMethod.DELETE, `/transformations/${encodeURIComponent(propsValue.name.trim())}`, undefined, { invalidate: propsValue.invalidate || undefined });+ },+});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/destroy-asset-by-id.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/destroy-asset-by-id.tsnew file mode 100644index 00000000000..7dac2953250--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/destroy-asset-by-id.ts@@ -0,0 +1,35 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest } from '../../common/client';+import { aiProps, aiResults } from '../../common/ai-props';+import { cloudinaryDestroyAssetByIdOutputSchema } from '../../output-schemas';++export const cloudinaryDestroyAssetById = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_destroy_asset_by_id',+ outputSchema: cloudinaryDestroyAssetByIdOutputSchema,+ displayName: 'Destroy Asset by Asset ID',+ description: 'Permanently deletes one asset by its immutable asset ID.',+ audience: 'ai',+ classification: 'DESTRUCTIVE',+ aiMetadata: {+ description:+ 'Permanently deletes a single asset identified by its asset_id, regardless of resource type or delivery type. Returns result "ok", or "not found" when nothing matched. For several assets by public ID use Delete Resources.',+ idempotent: false,+ },+ props: {+ asset_id: Property.ShortText({+ displayName: 'Asset ID',+ description: 'The asset\'s immutable asset_id.',+ required: true,+ }),+ invalidate: aiProps.invalidate(),+ },+ async run({ auth, propsValue }) {+ return makeRequest(auth, HttpMethod.POST, '/asset/destroy', {+ asset_id: propsValue.asset_id.trim(),+ ...(propsValue.invalidate ? { invalidate: true } : {}),+ });+ },+});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/explicit-resource.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/explicit-resource.tsnew file mode 100644index 00000000000..15d0863b568--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/explicit-resource.ts@@ -0,0 +1,60 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest } from '../../common/client';+import { aiProps, aiResults } from '../../common/ai-props';+import { cloudinaryExplicitResourceOutputSchema } from '../../output-schemas';++export const cloudinaryExplicitResource = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_explicit_resource',+ outputSchema: cloudinaryExplicitResourceOutputSchema,+ displayName: 'Apply Operations to Resource',+ description: 'Runs upload-time operations (eager transformations, tags, context, metadata) on an existing asset.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Applies upload-style operations to an existing asset without re-uploading it, most often to pre-generate derived versions with eager transformations (e.g. "c_fill,w_400,h_400|f_webp,q_auto"). Can also set tags, context or structured metadata. Use eager async for videos. Returns the asset with an eager array of the generated URLs.',+ idempotent: true,+ },+ props: {+ resource_type: aiProps.resourceType({ required: true }),+ type: aiProps.deliveryType(),+ public_id: Property.ShortText({+ displayName: 'Public ID',+ description: 'The asset\'s public ID.',+ required: true,+ }),+ eager: Property.ShortText({+ displayName: 'Eager Transformations',+ description: 'Transformations to generate now, pipe-separated (e.g. "c_fill,w_400,h_400|f_webp,q_auto").',+ required: false,+ }),+ eager_async: aiProps.includeFlag({ displayName: 'Generate Asynchronously', description: 'Generate eager transformations in the background (recommended for videos).' }),+ tags: Property.Array({+ displayName: 'Tags',+ description: 'Replaces the asset\'s tags with this list.',+ required: false,+ }),+ context: Property.ShortText({+ displayName: 'Context',+ description: 'Contextual metadata as pipe-separated key=value pairs.',+ required: false,+ }),+ invalidate: aiProps.invalidate(),+ },+ async run({ auth, propsValue }) {+ const tags = aiResults.cleanArray({ values: propsValue.tags });+ const body = {+ public_id: propsValue.public_id.trim(),+ type: propsValue.type ?? 'upload',+ ...(propsValue.eager ? { eager: propsValue.eager.trim() } : {}),+ ...(propsValue.eager_async ? { eager_async: true } : {}),+ ...(tags.length > 0 ? { tags } : {}),+ ...(propsValue.context ? { context: propsValue.context } : {}),+ ...(propsValue.invalidate ? { invalidate: true } : {}),+ };+ return makeRequest(auth, HttpMethod.POST, `/${propsValue.resource_type}/explicit`, body);+ },+});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/explode-resource.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/explode-resource.tsnew file mode 100644index 00000000000..890b7f2261c--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/explode-resource.ts@@ -0,0 +1,41 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest } from '../../common/client';+import { aiProps } from '../../common/ai-props';+import { cloudinaryExplodeResourceOutputSchema } from '../../output-schemas';++export const cloudinaryExplodeResource = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_explode_resource',+ outputSchema: cloudinaryExplodeResourceOutputSchema,+ displayName: 'Explode Multi-Page Resource',+ description: 'Creates one derived image per page of a PDF or frame of an animated image.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Asynchronously generates a separate derived image for every page of a multi-page PDF or every frame of an animated GIF/WebP. The transformation must contain "pg_all" (default). Returns status "processing" and a batch_id; the derived images then appear in Get Resource\'s derived list.',+ idempotent: true,+ },+ props: {+ public_id: Property.ShortText({ displayName: 'Public ID', description: 'Public ID of the PDF or animated image.', required: true }),+ type: aiProps.deliveryType(),+ transformation: Property.ShortText({ displayName: 'Transformation', description: 'Must include pg_all. Defaults to "pg_all".', required: false }),+ format: Property.ShortText({ displayName: 'Format', description: 'Output format of each page (e.g. "png", "jpg").', required: false }),+ notification_url: Property.ShortText({ displayName: 'Notification URL', description: 'Webhook URL called when done.', required: false }),+ },+ async run({ auth, propsValue }) {+ const transformation = propsValue.transformation?.trim() || 'pg_all';+ if (!transformation.includes('pg_all')) {+ throw new Error('The transformation must include pg_all.');+ }+ return makeRequest(auth, HttpMethod.POST, '/image/explode', {+ public_id: propsValue.public_id.trim(),+ type: propsValue.type ?? 'upload',+ transformation,+ ...(propsValue.format ? { format: propsValue.format.trim() } : {}),+ ...(propsValue.notification_url ? { notification_url: propsValue.notification_url.trim() } : {}),+ });+ },+});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/generate-archive.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/generate-archive.tsnew file mode 100644index 00000000000..a37d8f752f8--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/generate-archive.ts@@ -0,0 +1,70 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest } from '../../common/client';+import { aiProps, aiResults } from '../../common/ai-props';+import { cloudinaryGenerateArchiveOutputSchema } from '../../output-schemas';++export const cloudinaryGenerateArchive = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_generate_archive',+ outputSchema: cloudinaryGenerateArchiveOutputSchema,+ displayName: 'Generate Archive',+ description: 'Creates a ZIP or TGZ archive of assets and stores it as a raw asset.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Bundles assets selected by public IDs, tags and/or public ID prefixes into a ZIP or TGZ file, stored in Cloudinary as a new raw asset; returns its secure_url, resource_count and any missing IDs. Use to hand off many files as one download. Not idempotent: each call creates a new archive asset unless Target Public ID is reused.',+ idempotent: false,+ },+ props: {+ resource_type: Property.StaticDropdown({+ displayName: 'Resource Type',+ description: 'Which asset type to include. Defaults to image.',+ required: false,+ defaultValue: 'image',+ options: {+ options: [+ { label: 'Image', value: 'image' },+ { label: 'Video', value: 'video' },+ { label: 'Raw', value: 'raw' },+ { label: 'All', value: 'all' },+ ],+ },+ }),+ type: aiProps.deliveryType(),+ public_ids: Property.Array({ displayName: 'Public IDs', description: 'Assets to include.', required: false }),+ tags: Property.Array({ displayName: 'Tags', description: 'Include all assets with any of these tags.', required: false }),+ prefixes: Property.Array({ displayName: 'Prefixes', description: 'Include all assets whose public ID starts with any of these.', required: false }),+ target_format: Property.StaticDropdown({+ displayName: 'Archive Format',+ description: 'Defaults to zip.',+ required: false,+ options: { options: [{ label: 'ZIP', value: 'zip' }, { label: 'TGZ', value: 'tgz' }] },+ }),+ target_public_id: Property.ShortText({ displayName: 'Target Public ID', description: 'Public ID for the archive file.', required: false }),+ flatten_folders: aiProps.includeFlag({ displayName: 'Flatten Folders', description: 'Put all files at the archive root.' }),+ allow_missing: aiProps.includeFlag({ displayName: 'Allow Missing', description: 'Create the archive even if some requested assets do not exist.' }),+ },+ async run({ auth, propsValue }) {+ const publicIds = aiResults.cleanArray({ values: propsValue.public_ids });+ const tags = aiResults.cleanArray({ values: propsValue.tags });+ const prefixes = aiResults.cleanArray({ values: propsValue.prefixes });+ if (publicIds.length + tags.length + prefixes.length === 0) {+ throw new Error('Provide at least one of Public IDs, Tags or Prefixes.');+ }+ const body = {+ mode: 'create',+ type: propsValue.type ?? 'upload',+ ...(publicIds.length > 0 ? { public_ids: publicIds } : {}),+ ...(tags.length > 0 ? { tags } : {}),+ ...(prefixes.length > 0 ? { prefixes } : {}),+ ...(propsValue.target_format ? { target_format: propsValue.target_format } : {}),+ ...(propsValue.target_public_id ? { target_public_id: propsValue.target_public_id.trim() } : {}),+ ...(propsValue.flatten_folders ? { flatten_folders: true } : {}),+ ...(propsValue.allow_missing ? { allow_missing: true } : {}),+ };+ return makeRequest(auth, HttpMethod.POST, `/${propsValue.resource_type ?? 'image'}/generate_archive`, body);+ },+});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/generate-download-url.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/generate-download-url.tsnew file mode 100644index 00000000000..e39779a8e75--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/generate-download-url.ts@@ -0,0 +1,81 @@+import { createAction, Property } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { buildSignedUrl } from '../../common/client';+import { aiProps } from '../../common/ai-props';+import { cloudinaryGenerateDownloadUrlOutputSchema } from '../../output-schemas';++export const cloudinaryGenerateDownloadUrl = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_generate_download_url',+ outputSchema: cloudinaryGenerateDownloadUrlOutputSchema,+ displayName: 'Generate Download URL',+ description: 'Creates a signed, expiring URL that downloads an asset, including private and authenticated ones.',+ audience: 'ai',+ classification: 'READ',+ aiMetadata: {+ description:+ 'Builds a signed URL that downloads the original file of an asset, which works for private and authenticated assets that have no public delivery URL. Identify the asset by Public ID (with resource type, delivery type and file format) or by Asset ID, not both. The URL is signed locally and expires after the given number of seconds (default 1 hour); nothing is changed in Cloudinary. For a transformed public delivery URL use Transform Resource.',+ idempotent: true,+ },+ props: {+ public_id: Property.ShortText({+ displayName: 'Public ID',+ description: 'The asset\'s public ID. Use either this or Asset ID.',+ required: false,+ }),+ asset_id: Property.ShortText({+ displayName: 'Asset ID',+ description: 'The asset\'s immutable asset_id. Use either this or Public ID.',+ required: false,+ }),+ resource_type: aiProps.resourceType({ required: false }),+ type: aiProps.deliveryType(),+ format: Property.ShortText({+ displayName: 'Format',+ description: 'File format/extension of the download (e.g. "jpg", "pdf"). Required with Public ID for images and videos.',+ required: false,+ }),+ expires_in_seconds: Property.Number({+ displayName: 'Expires In (Seconds)',+ description: 'How long the URL stays valid. Defaults to 3600.',+ required: false,+ }),+ attachment: aiProps.includeFlag({ displayName: 'Force Download', description: 'Make browsers save the file instead of displaying it.' }),+ target_filename: Property.ShortText({+ displayName: 'Target Filename',+ description: 'File name to suggest when the file is saved.',+ required: false,+ }),+ },+ async run({ auth, propsValue }) {+ const publicId = propsValue.public_id?.trim();+ const assetId = propsValue.asset_id?.trim();+ if (Boolean(publicId) === Boolean(assetId)) {+ throw new Error('Provide exactly one of Public ID or Asset ID.');+ }+ const expiresAt = Math.floor(Date.now() / 1000) + (propsValue.expires_in_seconds ?? 3600);+ const shared = {+ format: propsValue.format?.trim(),+ expires_at: expiresAt,+ attachment: propsValue.attachment ? true : undefined,+ target_filename: propsValue.target_filename?.trim(),+ };+ const downloadUrl = publicId+ ? buildSignedUrl({+ auth,+ path: `/${propsValue.resource_type ?? 'image'}/download`,+ params: { ...shared, public_id: publicId, type: propsValue.type ?? 'upload' },+ })+ : buildSignedUrl({+ auth,+ path: '/asset/download',+ params: { ...shared, asset_id: assetId },+ });+ return {+ download_url: downloadUrl,+ expires_at: new Date(expiresAt * 1000).toISOString(),+ public_id: publicId ?? null,+ asset_id: assetId ?? null,+ };+ },+});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/get-config.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/get-config.tsnew file mode 100644index 00000000000..114f0d12428--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/get-config.ts@@ -0,0 +1,24 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest } from '../../common/client';+import { cloudinaryGetConfigOutputSchema } from '../../output-schemas';++export const cloudinaryGetConfig = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_get_config',+ outputSchema: cloudinaryGetConfigOutputSchema,+ displayName: 'Get Environment Config',+ description: 'Gets the product environment configuration, such as the folder mode.',+ audience: 'ai',+ classification: 'READ',+ aiMetadata: {+ description:+ 'Returns the cloud name and environment settings, notably folder_mode ("dynamic" or "fixed"). Check it before folder operations: asset folders, Rename Folder and List Resources by Asset Folder need dynamic mode; on fixed mode, folders are public ID prefixes.',+ idempotent: true,+ },+ props: {},+ async run({ auth }) {+ return makeRequest(auth, HttpMethod.GET, '/config', undefined, { settings: true });+ },+});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/get-folder.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/get-folder.tsnew file mode 100644index 00000000000..4817f80c2a5--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/get-folder.ts@@ -0,0 +1,48 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest } from '../../common/client';+import { aiProps } from '../../common/ai-props';+import { cloudinaryGetFolderOutputSchema } from '../../output-schemas';++export const cloudinaryGetFolder = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_get_folder',+ outputSchema: cloudinaryGetFolderOutputSchema,+ displayName: 'Get Folder',+ description: 'Gets one folder\'s details by path or by folder ID.',+ audience: 'ai',+ classification: 'READ',+ aiMetadata: {+ description:+ 'Returns one folder\'s name, path, external_id, created_at, resource_count, total_bytes, last_uploaded_at and ancestors, looked up by path or by folder external_id (not both). Folder IDs come from List Root Folders, List Subfolders or Search Folders.',+ idempotent: true,+ },+ props: {+ path: Property.ShortText({+ displayName: 'Folder Path',+ description: 'Full folder path. Use either this or Folder ID.',+ required: false,+ }),+ folder_id: Property.ShortText({+ displayName: 'Folder ID',+ description: 'The folder external_id. Use either this or Folder Path.',+ required: false,+ }),+ case_sensitive: aiProps.includeFlag({ displayName: 'Case Sensitive', description: 'Match the path case-sensitively.' }),+ },+ async run({ auth, propsValue }) {+ const path = propsValue.path?.trim();+ const folderId = propsValue.folder_id?.trim();+ if (Boolean(path) === Boolean(folderId)) {+ throw new Error('Provide either Folder Path or Folder ID, not both.');+ }+ if (path) {+ return makeRequest(auth, HttpMethod.PUT, '/folders/by_path', {+ path,+ ...(propsValue.case_sensitive ? { case_sensitive: true } : {}),+ });+ }+ return makeRequest(auth, HttpMethod.PUT, '/folders/by_id', { id: folderId });+ },+});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/get-metadata-field.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/get-metadata-field.tsnew file mode 100644index 00000000000..ef3a60da800--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/get-metadata-field.ts@@ -0,0 +1,29 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest } from '../../common/client';+import { cloudinaryGetMetadataFieldOutputSchema } from '../../output-schemas';++export const cloudinaryGetMetadataField = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_get_metadata_field',+ outputSchema: cloudinaryGetMetadataFieldOutputSchema,+ displayName: 'Get Metadata Field',+ description: 'Gets one structured metadata field definition.',+ audience: 'ai',+ classification: 'READ',+ aiMetadata: {+ description: 'Returns one structured metadata field definition by external_id, including its datasource values for enum and set fields.',+ idempotent: true,+ },+ props: {+ external_id: Property.ShortText({+ displayName: 'Field External ID',+ description: 'The metadata field external_id, from List Metadata Fields.',+ required: true,+ }),+ },+ async run({ auth, propsValue }) {+ return makeRequest(auth, HttpMethod.GET, `/metadata_fields/${encodeURIComponent(propsValue.external_id.trim())}`);+ },+});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/get-resource-by-asset-id.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/get-resource-by-asset-id.tsnew file mode 100644index 00000000000..8776026d695--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/get-resource-by-asset-id.ts@@ -0,0 +1,42 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest } from '../../common/client';+import { aiProps } from '../../common/ai-props';+import { cloudinaryGetResourceByAssetIdOutputSchema } from '../../output-schemas';++export const cloudinaryGetResourceByAssetId = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_get_resource_by_asset_id',+ outputSchema: cloudinaryGetResourceByAssetIdOutputSchema,+ displayName: 'Get Resource by Asset ID',+ description: 'Gets the full details of one asset by its immutable asset ID.',+ audience: 'ai',+ classification: 'READ',+ aiMetadata: {+ description:+ 'Returns the full details of one asset by its asset_id, the immutable 32-character ID returned by upload, list and search that survives renames and moves. Use Get Resource when you only have the public ID. Fails with Not found when the asset does not exist.',+ idempotent: true,+ },+ props: {+ asset_id: Property.ShortText({+ displayName: 'Asset ID',+ description: 'The asset\'s immutable asset_id.',+ required: true,+ }),+ include_colors: aiProps.includeFlag({ displayName: 'Include Colors', description: 'Include the predominant colors and color histogram (images only).' }),+ include_media_metadata: aiProps.includeFlag({ displayName: 'Include Media Metadata', description: 'Include IPTC, XMP and detailed Exif metadata.' }),+ include_faces: aiProps.includeFlag({ displayName: 'Include Faces', description: 'Include detected face coordinates (images only).' }),+ include_quality_analysis: aiProps.includeFlag({ displayName: 'Include Quality Analysis', description: 'Include the quality analysis score (images only).' }),+ include_versions: aiProps.includeFlag({ displayName: 'Include Versions', description: 'Include backed-up versions of the asset, when backups are enabled.' }),+ },+ async run({ auth, propsValue }) {+ return makeRequest(auth, HttpMethod.GET, `/resources/${encodeURIComponent(propsValue.asset_id.trim())}`, undefined, {+ colors: propsValue.include_colors || undefined,+ media_metadata: propsValue.include_media_metadata || undefined,+ faces: propsValue.include_faces || undefined,+ quality_analysis: propsValue.include_quality_analysis || undefined,+ versions: propsValue.include_versions || undefined,+ });+ },+});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/get-resource.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/get-resource.tsnew file mode 100644index 00000000000..ba6a7e09bf7--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/get-resource.ts@@ -0,0 +1,46 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest } from '../../common/client';+import { aiProps } from '../../common/ai-props';+import { cloudinaryGetResourceOutputSchema } from '../../output-schemas';++export const cloudinaryGetResource = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_get_resource',+ outputSchema: cloudinaryGetResourceOutputSchema,+ displayName: 'Get Resource',+ description: 'Gets the full details of one asset by its public ID.',+ audience: 'ai',+ classification: 'READ',+ aiMetadata: {+ description:+ 'Returns the full details of one asset (URLs, format, size, dimensions, tags, context, structured metadata, derived versions) by resource type, delivery type and public ID. Use Get Resource by Asset ID when you hold the immutable asset_id instead. Fails with Not found when the asset does not exist.',+ idempotent: true,+ },+ props: {+ resource_type: aiProps.resourceType({ required: true }),+ type: aiProps.deliveryType(),+ public_id: Property.ShortText({+ displayName: 'Public ID',+ description: 'The asset\'s public ID, without file extension for images and videos (e.g. "products/shoe").',+ required: true,+ }),+ include_colors: aiProps.includeFlag({ displayName: 'Include Colors', description: 'Include the predominant colors and color histogram (images only).' }),+ include_media_metadata: aiProps.includeFlag({ displayName: 'Include Media Metadata', description: 'Include IPTC, XMP and detailed Exif metadata.' }),+ include_faces: aiProps.includeFlag({ displayName: 'Include Faces', description: 'Include detected face coordinates (images only).' }),+ include_quality_analysis: aiProps.includeFlag({ displayName: 'Include Quality Analysis', description: 'Include the quality analysis score (images only).' }),+ include_versions: aiProps.includeFlag({ displayName: 'Include Versions', description: 'Include backed-up versions of the asset, when backups are enabled.' }),+ },+ async run({ auth, propsValue }) {+ const type = propsValue.type ?? 'upload';+ const publicId = propsValue.public_id.trim();+ return makeRequest(auth, HttpMethod.GET, `/resources/${propsValue.resource_type}/${type}/${publicId.split('/').map(encodeURIComponent).join('/')}`, undefined, {+ colors: propsValue.include_colors || undefined,+ media_metadata: propsValue.include_media_metadata || undefined,+ faces: propsValue.include_faces || undefined,+ quality_analysis: propsValue.include_quality_analysis || undefined,+ versions: propsValue.include_versions || undefined,+ });+ },+});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/get-transformation.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/get-transformation.tsnew file mode 100644index 00000000000..107a277321d--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/get-transformation.ts@@ -0,0 +1,29 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest } from '../../common/client';+import { cloudinaryGetTransformationOutputSchema } from '../../output-schemas';++export const cloudinaryGetTransformation = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_get_transformation',+ outputSchema: cloudinaryGetTransformationOutputSchema,+ displayName: 'Get Transformation',+ description: 'Gets a transformation\'s definition and the assets derived with it.',+ audience: 'ai',+ classification: 'READ',+ aiMetadata: {+ description: 'Returns one transformation (by name, or by its transformation string such as "c_fill,w_200"), including whether it is named, allowed in strict mode, its parameters, and derived assets that use it.',+ idempotent: true,+ },+ props: {+ name: Property.ShortText({+ displayName: 'Transformation',+ description: 'A named transformation name, or a transformation string (e.g. "c_fill,w_200").',+ required: true,+ }),+ },+ async run({ auth, propsValue }) {+ return makeRequest(auth, HttpMethod.GET, `/transformations/${encodeURIComponent(propsValue.name.trim())}`);+ },+});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/get-upload-preset.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/get-upload-preset.tsnew file mode 100644index 00000000000..5286884f456--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/get-upload-preset.ts@@ -0,0 +1,30 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest } from '../../common/client';+import { cloudinaryGetUploadPresetOutputSchema } from '../../output-schemas';++export const cloudinaryGetUploadPreset = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_get_upload_preset',+ displayName: 'Get Upload Preset',+ description: 'Gets one upload preset\'s settings by name.',+ audience: 'ai',+ outputSchema: cloudinaryGetUploadPresetOutputSchema,+ classification: 'READ',+ aiMetadata: {+ description:+ 'Returns one upload preset\'s name, unsigned flag and settings (folder, tags, transformations, moderation, etc.). Names come from List Upload Presets.',+ idempotent: true,+ },+ props: {+ name: Property.ShortText({+ displayName: 'Preset Name',+ description: 'The upload preset name.',+ required: true,+ }),+ },+ async run({ auth, propsValue }) {+ return makeRequest(auth, HttpMethod.GET, `/upload_presets/${encodeURIComponent(propsValue.name.trim())}`);+ },+});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/get-usage.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/get-usage.tsnew file mode 100644index 00000000000..f068a447fae--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/get-usage.ts@@ -0,0 +1,30 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest } from '../../common/client';+import { cloudinaryGetUsageOutputSchema } from '../../output-schemas';++export const cloudinaryGetUsage = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_get_usage',+ outputSchema: cloudinaryGetUsageOutputSchema,+ displayName: 'Get Usage',+ description: 'Gets account usage and plan limits: storage, bandwidth, transformations, requests and credits.',+ audience: 'ai',+ classification: 'READ',+ aiMetadata: {+ description:+ 'Returns the plan name and usage against limits for storage, bandwidth, transformations, objects, requests and credits, for today or a given date within the last 3 months. Use to check remaining quota before heavy uploads or transformations.',+ idempotent: true,+ },+ props: {+ date: Property.ShortText({+ displayName: 'Date',+ description: 'Day to report, as YYYY-MM-DD, within the last 3 months. Leave empty for the latest figures.',+ required: false,+ }),+ },+ async run({ auth, propsValue }) {+ return makeRequest(auth, HttpMethod.GET, '/usage', undefined, { date: propsValue.date?.trim() });+ },+});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/get-video-views.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/get-video-views.tsnew file mode 100644index 00000000000..959620233de--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/get-video-views.ts@@ -0,0 +1,54 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest } from '../../common/client';+import { aiProps, aiResults } from '../../common/ai-props';+import { cloudinaryGetVideoViewsOutputSchema } from '../../output-schemas';++export const cloudinaryGetVideoViews = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_get_video_views',+ outputSchema: cloudinaryGetVideoViewsOutputSchema,+ displayName: 'Get Video Views',+ description: 'Gets video view analytics from the Cloudinary Video Player.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Returns individual video view events tracked by the Cloudinary Video Player (public ID, watch time, duration, country, OS, app, end time), optionally filtered with an expression such as `video_public_id=my_video` or `view_ended_at>2026-01-01`. Empty when no views were tracked. Pages with next_cursor.',+ idempotent: true,+ },+ props: {+ expression: Property.ShortText({+ displayName: 'Expression',+ description: 'Filter expression (e.g. "video_public_id=my_video").',+ required: false,+ }),+ sort_by: Property.StaticDropdown({+ displayName: 'Sort By',+ description: 'Sort order. Defaults to most recent view first.',+ required: false,+ options: {+ options: [+ { label: 'Most recent first', value: '-view_ended_at' },+ { label: 'Oldest first', value: 'view_ended_at' },+ { label: 'Longest watch time first', value: '-view_watch_time' },+ { label: 'Longest video first', value: '-video_duration' },+ ],+ },+ }),+ max_results: aiProps.maxResults(),+ next_cursor: aiProps.nextCursor(),+ },+ async run({ auth, propsValue }) {+ const response: ViewList = await makeRequest(auth, HttpMethod.GET, '/video/analytics/views', undefined, {+ expression: propsValue.expression,+ sort_by: propsValue.sort_by,+ max_results: aiResults.clampMaxResults({ value: propsValue.max_results }),+ next_cursor: propsValue.next_cursor,+ });+ return { views: response.data, count: response.data.length, next_cursor: response.next_cursor ?? null };+ },+});++type ViewList = { data: Record<string, unknown>[]; next_cursor?: string };diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/list-metadata-fields.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/list-metadata-fields.tsnew file mode 100644index 00000000000..b438259f13d--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/list-metadata-fields.ts@@ -0,0 +1,31 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest } from '../../common/client';+import { aiResults } from '../../common/ai-props';+import { cloudinaryListMetadataFieldsOutputSchema } from '../../output-schemas';++export const cloudinaryListMetadataFields = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_list_metadata_fields',+ outputSchema: cloudinaryListMetadataFieldsOutputSchema,+ displayName: 'List Metadata Fields',+ description: 'Lists the structured metadata field definitions.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Lists all structured metadata fields (type, external_id, label, mandatory, default, validation, datasource values), or only the given external_ids. Use to find the field and value external_ids that Update Resource Metadata and Search Assets (metadata.<id>) need.',+ idempotent: true,+ },+ props: {+ external_ids: Property.Array({ displayName: 'External IDs', description: 'Only return these fields. Leave empty for all.', required: false }),+ },+ async run({ auth, propsValue }) {+ const externalIds = aiResults.cleanArray({ values: propsValue.external_ids });+ const response: { metadata_fields: Record<string, unknown>[] } = await makeRequest(auth, HttpMethod.GET, '/metadata_fields', undefined, {+ external_ids: externalIds.length > 0 ? externalIds : undefined,+ });+ return { metadata_fields: response.metadata_fields, count: response.metadata_fields.length };+ },+});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/list-resource-types.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/list-resource-types.tsnew file mode 100644index 00000000000..99b395d8da6--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/list-resource-types.ts@@ -0,0 +1,25 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest } from '../../common/client';+import { cloudinaryListResourceTypesOutputSchema } from '../../output-schemas';++export const cloudinaryListResourceTypes = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_list_resource_types',+ outputSchema: cloudinaryListResourceTypesOutputSchema,+ displayName: 'List Resource Types',+ description: 'Lists the resource types (image, video, raw) that exist in the product environment.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Returns which resource types (image, video, raw) currently hold assets in this Cloudinary product environment. Use before listing or searching to know which resource_type values are worth querying.',+ idempotent: true,+ },+ props: {},+ async run({ auth }) {+ const response: { resource_types: string[] } = await makeRequest(auth, HttpMethod.GET, '/resources');+ return { resource_types: response.resource_types, count: response.resource_types.length };+ },+});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/list-resources-by-asset-folder.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/list-resources-by-asset-folder.tsnew file mode 100644index 00000000000..8c52816fec6--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/list-resources-by-asset-folder.ts@@ -0,0 +1,42 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest, ResourceList } from '../../common/client';+import { aiProps, aiResults } from '../../common/ai-props';+import { cloudinaryListResourcesByAssetFolderOutputSchema } from '../../output-schemas';++export const cloudinaryListResourcesByAssetFolder = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_list_resources_by_asset_folder',+ outputSchema: cloudinaryListResourcesByAssetFolderOutputSchema,+ displayName: 'List Resources by Asset Folder',+ description: 'Lists the assets stored in an asset folder.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Lists the assets placed directly in an asset folder (dynamic folder mode), across all resource types unless one is given. Folder paths come from List Root Folders or List Subfolders. On fixed-folder accounts, use List Resources with a public ID prefix instead. Pages with next_cursor.',+ idempotent: true,+ },+ props: {+ asset_folder: Property.ShortText({+ displayName: 'Asset Folder',+ description: 'Full folder path (e.g. "marketing/banners").',+ required: true,+ }),+ resource_type: aiProps.resourceType({ required: false }),+ direction: aiProps.direction(),+ max_results: aiProps.maxResults(),+ next_cursor: aiProps.nextCursor(),+ },+ async run({ auth, propsValue }) {+ const response: ResourceList = await makeRequest(auth, HttpMethod.GET, '/resources/by_asset_folder', undefined, {+ asset_folder: propsValue.asset_folder.trim(),+ resource_type: propsValue.resource_type,+ direction: propsValue.direction,+ max_results: aiResults.clampMaxResults({ value: propsValue.max_results }),+ next_cursor: propsValue.next_cursor,+ });+ return aiResults.toResourceList({ response });+ },+});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/list-resources-by-asset-ids.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/list-resources-by-asset-ids.tsnew file mode 100644index 00000000000..2e745c6208d--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/list-resources-by-asset-ids.ts@@ -0,0 +1,37 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest, ResourceList } from '../../common/client';+import { aiProps, aiResults } from '../../common/ai-props';+import { cloudinaryListResourcesByAssetIdsOutputSchema } from '../../output-schemas';++export const cloudinaryListResourcesByAssetIds = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_list_resources_by_asset_ids',+ outputSchema: cloudinaryListResourcesByAssetIdsOutputSchema,+ displayName: 'List Resources by Asset IDs',+ description: 'Fetches several assets at once by their immutable asset IDs.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Fetches up to 100 assets in one call by their asset IDs (the immutable 32-character asset_id returned by upload, list and search). Use for a known set of IDs; for a single asset with full details use Get Resource by Asset ID.',+ idempotent: true,+ },+ props: {+ asset_ids: Property.Array({+ displayName: 'Asset IDs',+ description: 'Up to 100 asset IDs.',+ required: true,+ }),+ resource_type: aiProps.resourceType({ required: false }),+ },+ async run({ auth, propsValue }) {+ const assetIds = aiResults.cleanArray({ values: propsValue.asset_ids });+ if (assetIds.length === 0 || assetIds.length > 100) {+ throw new Error('Provide between 1 and 100 asset IDs.');+ }+ const response: ResourceList = await makeRequest(auth, HttpMethod.GET, '/resources/by_asset_ids', undefined, { asset_ids: assetIds, resource_type: propsValue.resource_type });+ return aiResults.toResourceList({ response });+ },+});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/list-resources-by-context.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/list-resources-by-context.tsnew file mode 100644index 00000000000..13bc58046f3--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/list-resources-by-context.ts@@ -0,0 +1,47 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest, ResourceList } from '../../common/client';+import { aiProps, aiResults } from '../../common/ai-props';+import { cloudinaryListResourcesByAssetIdsOutputSchema } from '../../output-schemas';++export const cloudinaryListResourcesByContext = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_list_resources_by_context',+ outputSchema: cloudinaryListResourcesByAssetIdsOutputSchema,+ displayName: 'List Resources by Context',+ description: 'Lists assets that have a contextual metadata key, optionally with a specific value.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Lists assets of one resource type whose contextual metadata (free-form key=value pairs such as alt or caption) contains the given key, optionally matching an exact value. For structured metadata fields use Search Assets instead. Pages with next_cursor.',+ idempotent: true,+ },+ props: {+ resource_type: aiProps.resourceType({ required: true }),+ key: Property.ShortText({+ displayName: 'Context Key',+ description: 'The contextual metadata key to match (e.g. "alt", "caption").',+ required: true,+ }),+ value: Property.ShortText({+ displayName: 'Context Value',+ description: 'Only return assets where the key has exactly this value. Leave empty to match any value.',+ required: false,+ }),+ direction: aiProps.direction(),+ max_results: aiProps.maxResults(),+ next_cursor: aiProps.nextCursor(),+ },+ async run({ auth, propsValue }) {+ const response: ResourceList = await makeRequest(auth, HttpMethod.GET, `/resources/${propsValue.resource_type}/context`, undefined, {+ key: propsValue.key.trim(),+ value: propsValue.value,+ direction: propsValue.direction,+ max_results: aiResults.clampMaxResults({ value: propsValue.max_results }),+ next_cursor: propsValue.next_cursor,+ });+ return aiResults.toResourceList({ response });+ },+});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/list-resources-by-external-ids.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/list-resources-by-external-ids.tsnew file mode 100644index 00000000000..9b9c2a7a46a--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/list-resources-by-external-ids.ts@@ -0,0 +1,46 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest, ResourceList } from '../../common/client';+import { aiProps, aiResults } from '../../common/ai-props';+import { cloudinaryListResourcesByAssetIdsOutputSchema } from '../../output-schemas';++export const cloudinaryListResourcesByExternalIds = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_list_resources_by_external_ids',+ outputSchema: cloudinaryListResourcesByAssetIdsOutputSchema,+ displayName: 'List Resources by External IDs',+ description: 'Fetches assets by the external IDs assigned to them.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Fetches up to 100 assets by external ID, the caller-assigned identifier set on an asset (for example by a DAM or PIM sync). Use when the caller only knows its own IDs, not Cloudinary public IDs or asset IDs.',+ idempotent: true,+ },+ props: {+ external_ids: Property.Array({+ displayName: 'External IDs',+ description: 'Up to 100 external IDs.',+ required: true,+ }),+ resource_type: aiProps.resourceType({ required: false }),+ include_tags: aiProps.includeFlag({ displayName: 'Include Tags', description: 'Include each asset\'s tags.' }),+ include_context: aiProps.includeFlag({ displayName: 'Include Context', description: 'Include each asset\'s contextual metadata.' }),+ include_metadata: aiProps.includeFlag({ displayName: 'Include Structured Metadata', description: 'Include each asset\'s structured metadata values.' }),+ },+ async run({ auth, propsValue }) {+ const externalIds = aiResults.cleanArray({ values: propsValue.external_ids });+ if (externalIds.length === 0 || externalIds.length > 100) {+ throw new Error('Provide between 1 and 100 external IDs.');+ }+ const response: ResourceList = await makeRequest(auth, HttpMethod.GET, '/resources/by_external_ids', undefined, {+ external_ids: externalIds,+ resource_type: propsValue.resource_type,+ tags: propsValue.include_tags || undefined,+ context: propsValue.include_context || undefined,+ metadata: propsValue.include_metadata || undefined,+ });+ return aiResults.toResourceList({ response });+ },+});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/list-resources-by-tag.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/list-resources-by-tag.tsnew file mode 100644index 00000000000..e8774904393--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/list-resources-by-tag.ts@@ -0,0 +1,46 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest, ResourceList } from '../../common/client';+import { aiProps, aiResults } from '../../common/ai-props';+import { cloudinaryListResourcesOutputSchema } from '../../output-schemas';++export const cloudinaryListResourcesByTag = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_list_resources_by_tag',+ outputSchema: cloudinaryListResourcesOutputSchema,+ displayName: 'List Resources by Tag',+ description: 'Lists assets of one resource type that carry a given tag.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Lists assets of one resource type that carry an exact tag. Use when you know the tag; List Tags returns the available tag names. Pages with next_cursor (max 500 per page).',+ idempotent: true,+ },+ props: {+ resource_type: aiProps.resourceType({ required: true }),+ tag: Property.ShortText({+ displayName: 'Tag',+ description: 'The exact tag to match. Use List Tags to find existing tags.',+ required: true,+ }),+ direction: aiProps.direction(),+ include_tags: aiProps.includeFlag({ displayName: 'Include Tags', description: 'Include each asset\'s tags.' }),+ include_context: aiProps.includeFlag({ displayName: 'Include Context', description: 'Include each asset\'s contextual metadata.' }),+ include_metadata: aiProps.includeFlag({ displayName: 'Include Structured Metadata', description: 'Include each asset\'s structured metadata values.' }),+ max_results: aiProps.maxResults(),+ next_cursor: aiProps.nextCursor(),+ },+ async run({ auth, propsValue }) {+ const response: ResourceList = await makeRequest(auth, HttpMethod.GET, `/resources/${propsValue.resource_type}/tags/${encodeURIComponent(propsValue.tag.trim())}`, undefined, {+ direction: propsValue.direction,+ tags: propsValue.include_tags || undefined,+ context: propsValue.include_context || undefined,+ metadata: propsValue.include_metadata || undefined,+ max_results: aiResults.clampMaxResults({ value: propsValue.max_results }),+ next_cursor: propsValue.next_cursor,+ });+ return aiResults.toResourceList({ response });+ },+});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/list-resources-in-moderation.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/list-resources-in-moderation.tsnew file mode 100644index 00000000000..5af09d6ee05--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/list-resources-in-moderation.ts@@ -0,0 +1,53 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest, ResourceList } from '../../common/client';+import { aiProps, aiResults } from '../../common/ai-props';+import { cloudinaryListResourcesInModerationOutputSchema } from '../../output-schemas';++export const cloudinaryListResourcesInModeration = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_list_resources_in_moderation',+ outputSchema: cloudinaryListResourcesInModerationOutputSchema,+ displayName: 'List Resources in Moderation',+ description: 'Lists assets by moderation type and status.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Lists assets of one resource type that are in a moderation queue with a given status, for example manual moderation pending review. Add-on moderation kinds (webpurify, aws_rek, perception_point, etc.) only return results when that add-on is enabled. Pages with next_cursor.',+ idempotent: true,+ },+ props: {+ resource_type: aiProps.resourceType({ required: true }),+ moderation_kind: Property.StaticDropdown({+ displayName: 'Moderation Kind',+ description: 'The moderation type.',+ required: true,+ defaultValue: 'manual',+ options: {+ options: ['manual', 'webpurify', 'aws_rek', 'aws_rek_video', 'perception_point', 'google_video_moderation', 'duplicate'].map((value) => ({ label: value, value })),+ },+ }),+ moderation_status: Property.StaticDropdown({+ displayName: 'Moderation Status',+ description: 'The moderation status to match.',+ required: true,+ defaultValue: 'pending',+ options: {+ options: ['pending', 'approved', 'rejected', 'queued', 'aborted'].map((value) => ({ label: value, value })),+ },+ }),+ direction: aiProps.direction(),+ max_results: aiProps.maxResults(),+ next_cursor: aiProps.nextCursor(),+ },+ async run({ auth, propsValue }) {+ const response: ResourceList = await makeRequest(auth, HttpMethod.GET, `/resources/${propsValue.resource_type}/moderations/${propsValue.moderation_kind}/${propsValue.moderation_status}`, undefined, {+ direction: propsValue.direction,+ max_results: aiResults.clampMaxResults({ value: propsValue.max_results }),+ next_cursor: propsValue.next_cursor,+ });+ return aiResults.toResourceList({ response });+ },+});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/list-resources.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/list-resources.tsnew file mode 100644index 00000000000..43c61dfddd2--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/list-resources.ts@@ -0,0 +1,55 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest, ResourceList } from '../../common/client';+import { aiProps, aiResults } from '../../common/ai-props';+import { cloudinaryListResourcesOutputSchema } from '../../output-schemas';++export const cloudinaryListResources = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_list_resources',+ outputSchema: cloudinaryListResourcesOutputSchema,+ displayName: 'List Resources',+ description: 'Lists assets of one resource type and delivery type, optionally filtered by public ID prefix.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Lists assets of one resource type (image, video or raw) and delivery type, newest first, optionally narrowed by a public ID prefix or start date. Use for browsing; prefer Search Assets for filtering by tags, format, size or other attributes. Pages with next_cursor (max 500 per page).',+ idempotent: true,+ },+ props: {+ resource_type: aiProps.resourceType({ required: true }),+ type: aiProps.deliveryType(),+ prefix: Property.ShortText({+ displayName: 'Public ID Prefix',+ description: 'Only return assets whose public ID starts with this value (e.g. "products/").',+ required: false,+ }),+ start_at: Property.ShortText({+ displayName: 'Start At',+ description: 'Only return assets created after this ISO 8601 date-time. Cannot be combined with Next Cursor.',+ required: false,+ }),+ direction: aiProps.direction(),+ include_tags: aiProps.includeFlag({ displayName: 'Include Tags', description: 'Include each asset\'s tags.' }),+ include_context: aiProps.includeFlag({ displayName: 'Include Context', description: 'Include each asset\'s contextual metadata.' }),+ include_metadata: aiProps.includeFlag({ displayName: 'Include Structured Metadata', description: 'Include each asset\'s structured metadata values.' }),+ max_results: aiProps.maxResults(),+ next_cursor: aiProps.nextCursor(),+ },+ async run({ auth, propsValue }) {+ const type = propsValue.type ?? 'upload';+ const response: ResourceList = await makeRequest(auth, HttpMethod.GET, `/resources/${propsValue.resource_type}/${type}`, undefined, {+ prefix: propsValue.prefix,+ start_at: propsValue.start_at,+ direction: propsValue.direction,+ tags: propsValue.include_tags || undefined,+ context: propsValue.include_context || undefined,+ metadata: propsValue.include_metadata || undefined,+ max_results: aiResults.clampMaxResults({ value: propsValue.max_results }),+ next_cursor: propsValue.next_cursor,+ });+ return aiResults.toResourceList({ response });+ },+});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/list-root-folders.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/list-root-folders.tsnew file mode 100644index 00000000000..b01b56a3aaa--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/list-root-folders.ts@@ -0,0 +1,39 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest } from '../../common/client';+import { aiProps, aiResults } from '../../common/ai-props';+import { cloudinaryListRootFoldersOutputSchema } from '../../output-schemas';++export const cloudinaryListRootFolders = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_list_root_folders',+ outputSchema: cloudinaryListRootFoldersOutputSchema,+ displayName: 'List Root Folders',+ description: 'Lists the top-level folders of the media library.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Lists the top-level folders (name, path, external_id). Use List Subfolders to go deeper, or Search Folders to find folders by name or path anywhere. Pages with next_cursor (max 500).',+ idempotent: true,+ },+ props: {+ max_results: aiProps.maxResults(),+ next_cursor: aiProps.nextCursor(),+ },+ async run({ auth, propsValue }) {+ const response: FolderList = await makeRequest(auth, HttpMethod.GET, '/folders', undefined, {+ max_results: aiResults.clampMaxResults({ value: propsValue.max_results }),+ next_cursor: propsValue.next_cursor,+ });+ return {+ folders: response.folders,+ count: response.folders.length,+ total_count: response.total_count ?? null,+ next_cursor: response.next_cursor ?? null,+ };+ },+});++type FolderList = { folders: Record<string, unknown>[]; next_cursor?: string; total_count?: number };diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/list-subfolders.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/list-subfolders.tsnew file mode 100644index 00000000000..e29c7203632--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/list-subfolders.ts@@ -0,0 +1,44 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest } from '../../common/client';+import { aiProps, aiResults } from '../../common/ai-props';+import { cloudinaryListRootFoldersOutputSchema } from '../../output-schemas';++export const cloudinaryListSubfolders = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_list_subfolders',+ outputSchema: cloudinaryListRootFoldersOutputSchema,+ displayName: 'List Subfolders',+ description: 'Lists the direct subfolders of a folder.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Lists the direct subfolders of a folder path (name, path, external_id). Root folders come from List Root Folders. Fails with Not found if the folder does not exist. Pages with next_cursor.',+ idempotent: true,+ },+ props: {+ folder: Property.ShortText({+ displayName: 'Folder Path',+ description: 'Full folder path (e.g. "marketing/banners").',+ required: true,+ }),+ max_results: aiProps.maxResults(),+ next_cursor: aiProps.nextCursor(),+ },+ async run({ auth, propsValue }) {+ const response: FolderList = await makeRequest(auth, HttpMethod.GET, `/folders/${aiResults.encodePath({ value: propsValue.folder })}`, undefined, {+ max_results: aiResults.clampMaxResults({ value: propsValue.max_results }),+ next_cursor: propsValue.next_cursor,+ });+ return {+ folders: response.folders,+ count: response.folders.length,+ total_count: response.total_count ?? null,+ next_cursor: response.next_cursor ?? null,+ };+ },+});++type FolderList = { folders: Record<string, unknown>[]; next_cursor?: string; total_count?: number };diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/list-tags.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/list-tags.tsnew file mode 100644index 00000000000..92921911e55--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/list-tags.ts@@ -0,0 +1,39 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest } from '../../common/client';+import { aiProps, aiResults } from '../../common/ai-props';+import { cloudinaryListTagsOutputSchema } from '../../output-schemas';++export const cloudinaryListTags = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_list_tags',+ outputSchema: cloudinaryListTagsOutputSchema,+ displayName: 'List Tags',+ description: 'Lists the tags used on assets of one resource type.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Lists the tag names in use on assets of one resource type, optionally only those starting with a prefix. Use to discover tags before List Resources by Tag or Delete Resources by Tag. Pages with next_cursor (max 500).',+ idempotent: true,+ },+ props: {+ resource_type: aiProps.resourceType({ required: true }),+ prefix: Property.ShortText({+ displayName: 'Prefix',+ description: 'Only return tags starting with this value.',+ required: false,+ }),+ max_results: aiProps.maxResults(),+ next_cursor: aiProps.nextCursor(),+ },+ async run({ auth, propsValue }) {+ const response: { tags: string[]; next_cursor?: string } = await makeRequest(auth, HttpMethod.GET, `/tags/${propsValue.resource_type}`, undefined, {+ prefix: propsValue.prefix,+ max_results: aiResults.clampMaxResults({ value: propsValue.max_results }),+ next_cursor: propsValue.next_cursor,+ });+ return { tags: response.tags, count: response.tags.length, next_cursor: response.next_cursor ?? null };+ },+});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/list-transformations.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/list-transformations.tsnew file mode 100644index 00000000000..dbc101812e2--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/list-transformations.ts@@ -0,0 +1,34 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest } from '../../common/client';+import { aiProps, aiResults } from '../../common/ai-props';+import { cloudinaryListTransformationsOutputSchema } from '../../output-schemas';++export const cloudinaryListTransformations = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_list_transformations',+ outputSchema: cloudinaryListTransformationsOutputSchema,+ displayName: 'List Transformations',+ description: 'Lists transformations used in the account, optionally only named ones.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Lists transformations (name, named flag, used flag, allowed_for_strict) generated or defined in the account. Set Named Only to list reusable named transformations, which deliver as t_<name> in URLs. Pages with next_cursor.',+ idempotent: true,+ },+ props: {+ named: aiProps.optionalBoolean({ displayName: 'Named Only', description: 'Yes for named transformations only, No for unnamed only.' }),+ max_results: aiProps.maxResults(),+ next_cursor: aiProps.nextCursor(),+ },+ async run({ auth, propsValue }) {+ const response: { transformations: Record<string, unknown>[]; next_cursor?: string } = await makeRequest(auth, HttpMethod.GET, '/transformations', undefined, {+ named: aiResults.toBoolean({ value: propsValue.named }),+ max_results: aiResults.clampMaxResults({ value: propsValue.max_results }),+ next_cursor: propsValue.next_cursor,+ });+ return { transformations: response.transformations, count: response.transformations.length, next_cursor: response.next_cursor ?? null };+ },+});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/list-upload-presets.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/list-upload-presets.tsnew file mode 100644index 00000000000..ee6446cfb36--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/list-upload-presets.ts@@ -0,0 +1,34 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest } from '../../common/client';+import { aiProps, aiResults } from '../../common/ai-props';+import { cloudinaryListUploadPresetsOutputSchema } from '../../output-schemas';++export const cloudinaryListUploadPresets = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_list_upload_presets',+ outputSchema: cloudinaryListUploadPresetsOutputSchema,+ displayName: 'List Upload Presets',+ description: 'Lists the upload presets defined in the account.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Lists upload presets (name, unsigned flag and settings). Pass a preset name to Upload Asset to apply its folder, tags, transformations and other upload settings. Pages with next_cursor.',+ idempotent: true,+ },+ props: {+ max_results: aiProps.maxResults(),+ next_cursor: aiProps.nextCursor(),+ },+ async run({ auth, propsValue }) {+ const response: PresetList = await makeRequest(auth, HttpMethod.GET, '/upload_presets', undefined, {+ max_results: aiResults.clampMaxResults({ value: propsValue.max_results }),+ next_cursor: propsValue.next_cursor,+ });+ return { presets: response.presets, count: response.presets.length, next_cursor: response.next_cursor ?? null };+ },+});++type PresetList = { presets: Record<string, unknown>[]; next_cursor?: string };diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/order-metadata-datasource.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/order-metadata-datasource.tsnew file mode 100644index 00000000000..45fc6f39f22--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/order-metadata-datasource.ts@@ -0,0 +1,36 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest } from '../../common/client';+import { cloudinaryDeleteMetadataDatasourceEntriesOutputSchema } from '../../output-schemas';++export const cloudinaryOrderMetadataDatasource = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_order_metadata_datasource',+ outputSchema: cloudinaryDeleteMetadataDatasourceEntriesOutputSchema,+ displayName: 'Sort Metadata Field Values',+ description: 'Sorts the allowed values of an enum or set metadata field.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description: 'Sorts the allowed values of an enum or set metadata field alphabetically by value, ascending or descending. Returns the reordered values.',+ idempotent: true,+ },+ props: {+ external_id: Property.ShortText({+ displayName: 'Field External ID',+ description: 'The metadata field external_id, from List Metadata Fields.',+ required: true,+ }),+ direction: Property.StaticDropdown({+ displayName: 'Direction',+ description: 'Sort direction.',+ required: true,+ defaultValue: 'asc',+ options: { options: [{ label: 'A to Z', value: 'asc' }, { label: 'Z to A', value: 'desc' }] },+ }),+ },+ async run({ auth, propsValue }) {+ return makeRequest(auth, HttpMethod.POST, `/metadata_fields/${encodeURIComponent(propsValue.external_id.trim())}/datasource/order`, { order_by: 'value', direction: propsValue.direction });+ },+});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/rename-folder.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/rename-folder.tsnew file mode 100644index 00000000000..143a8be0c6f--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/rename-folder.ts@@ -0,0 +1,38 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest } from '../../common/client';+import { aiResults } from '../../common/ai-props';+import { cloudinaryRenameFolderOutputSchema } from '../../output-schemas';++export const cloudinaryRenameFolder = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_rename_folder',+ outputSchema: cloudinaryRenameFolderOutputSchema,+ displayName: 'Rename Folder',+ description: 'Renames or moves a folder, together with all its assets and subfolders.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Renames or moves a folder and everything in it to a new path (dynamic folder mode). Public IDs and delivery URLs of the assets do not change. Not idempotent: a second call fails because the source path no longer exists.',+ idempotent: false,+ },+ props: {+ folder: Property.ShortText({+ displayName: 'Folder Path',+ description: 'Full folder path (e.g. "marketing/banners").',+ required: true,+ }),+ to_folder: Property.ShortText({+ displayName: 'New Folder Path',+ description: 'The new full path (e.g. "marketing/archive/banners").',+ required: true,+ }),+ },+ async run({ auth, propsValue }) {+ return makeRequest(auth, HttpMethod.PUT, `/folders/${aiResults.encodePath({ value: propsValue.folder })}`, {+ to_folder: propsValue.to_folder.trim(),+ });+ },+});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/rename-resource.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/rename-resource.tsnew file mode 100644index 00000000000..cf18432e6f3--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/rename-resource.ts@@ -0,0 +1,60 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest } from '../../common/client';+import { aiProps, aiResults } from '../../common/ai-props';+import { cloudinaryRenameResourceOutputSchema } from '../../output-schemas';++export const cloudinaryRenameResource = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_rename_resource',+ outputSchema: cloudinaryRenameResourceOutputSchema,+ displayName: 'Rename Resource',+ description: 'Changes an asset\'s public ID, optionally moving it to another delivery type.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Renames an asset by changing its public ID (which also changes its delivery URL), and can move it between upload, private and authenticated delivery types. Fails if the target public ID exists unless Overwrite is set. The asset_id stays the same. Not idempotent: a second call fails because the source ID no longer exists.',+ idempotent: false,+ },+ props: {+ resource_type: aiProps.resourceType({ required: true }),+ from_public_id: Property.ShortText({+ displayName: 'Current Public ID',+ description: 'The asset\'s current public ID.',+ required: true,+ }),+ to_public_id: Property.ShortText({+ displayName: 'New Public ID',+ description: 'The new public ID.',+ required: true,+ }),+ type: aiProps.deliveryType(),+ to_type: Property.StaticDropdown({+ displayName: 'New Delivery Type',+ description: 'Move the asset to this delivery type. Leave empty to keep it.',+ required: false,+ options: {+ options: [+ { label: 'Upload', value: 'upload' },+ { label: 'Private', value: 'private' },+ { label: 'Authenticated', value: 'authenticated' },+ ],+ },+ }),+ overwrite: aiProps.includeFlag({ displayName: 'Overwrite', description: 'Replace an existing asset that already has the new public ID.' }),+ invalidate: aiProps.invalidate(),+ },+ async run({ auth, propsValue }) {+ const body = {+ from_public_id: propsValue.from_public_id.trim(),+ to_public_id: propsValue.to_public_id.trim(),+ type: propsValue.type ?? 'upload',+ ...(propsValue.to_type ? { to_type: propsValue.to_type } : {}),+ ...(propsValue.overwrite ? { overwrite: true } : {}),+ ...(propsValue.invalidate ? { invalidate: true } : {}),+ };+ return makeRequest(auth, HttpMethod.POST, `/${propsValue.resource_type}/rename`, body);+ },+});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/reorder-metadata-field.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/reorder-metadata-field.tsnew file mode 100644index 00000000000..290e5755ba2--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/reorder-metadata-field.ts@@ -0,0 +1,30 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest } from '../../common/client';+import { cloudinaryReorderMetadataFieldOutputSchema } from '../../output-schemas';++export const cloudinaryReorderMetadataField = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_reorder_metadata_field',+ outputSchema: cloudinaryReorderMetadataFieldOutputSchema,+ displayName: 'Move Metadata Field',+ description: 'Moves one metadata field to a position in the field list.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description: 'Moves one metadata field to a 1-based position in the field order shown in the Media Library. To sort all fields at once use Sort Metadata Fields. Returns the full ordered list.',+ idempotent: true,+ },+ props: {+ external_id: Property.ShortText({+ displayName: 'Field External ID',+ description: 'The metadata field external_id, from List Metadata Fields.',+ required: true,+ }),+ position: Property.Number({ displayName: 'Position', description: 'New 1-based position.', required: true }),+ },+ async run({ auth, propsValue }) {+ return makeRequest(auth, HttpMethod.PUT, `/metadata_fields/${encodeURIComponent(propsValue.external_id.trim())}/reorder`, { position: propsValue.position });+ },+});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/reorder-metadata-fields.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/reorder-metadata-fields.tsnew file mode 100644index 00000000000..179958de9c2--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/reorder-metadata-fields.ts@@ -0,0 +1,40 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest } from '../../common/client';+import { cloudinaryReorderMetadataFieldOutputSchema } from '../../output-schemas';++export const cloudinaryReorderMetadataFields = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_reorder_metadata_fields',+ outputSchema: cloudinaryReorderMetadataFieldOutputSchema,+ displayName: 'Sort Metadata Fields',+ description: 'Sorts all metadata fields by label, creation date or external ID.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description: 'Sorts the whole metadata field list by label, created_at or external_id. Returns the ordered list. To move a single field use Move Metadata Field.',+ idempotent: true,+ },+ props: {+ order_by: Property.StaticDropdown({+ displayName: 'Order By',+ description: 'Sort key.',+ required: true,+ defaultValue: 'label',+ options: { options: ['label', 'created_at', 'external_id'].map((value) => ({ label: value, value })) },+ }),+ direction: Property.StaticDropdown({+ displayName: 'Direction',+ description: 'Defaults to ascending.',+ required: false,+ options: { options: [{ label: 'Ascending', value: 'asc' }, { label: 'Descending', value: 'desc' }] },+ }),+ },+ async run({ auth, propsValue }) {+ return makeRequest(auth, HttpMethod.PUT, '/metadata_fields/order', {+ order_by: propsValue.order_by,+ ...(propsValue.direction ? { direction: propsValue.direction } : {}),+ });+ },+});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/restore-metadata-datasource-entries.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/restore-metadata-datasource-entries.tsnew file mode 100644index 00000000000..83fd5e4c4c8--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/restore-metadata-datasource-entries.ts@@ -0,0 +1,37 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest } from '../../common/client';+import { aiResults } from '../../common/ai-props';+import { cloudinaryDeleteMetadataDatasourceEntriesOutputSchema } from '../../output-schemas';++export const cloudinaryRestoreMetadataDatasourceEntries = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_restore_metadata_datasource_entries',+ outputSchema: cloudinaryDeleteMetadataDatasourceEntriesOutputSchema,+ displayName: 'Restore Metadata Datasource Values',+ description: 'Restores previously deleted allowed values of a metadata field.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Restores allowed values of an enum or set metadata field that were removed with Delete Metadata Datasource Values, by value external_id. Returns the active values.',+ idempotent: true,+ },+ props: {+ external_id: Property.ShortText({+ displayName: 'Field External ID',+ description: 'The metadata field external_id, from List Metadata Fields.',+ required: true,+ }),+ value_external_ids: Property.Array({+ displayName: 'Value External IDs',+ description: 'external_ids of the datasource values, from Get Metadata Field.',+ required: true,+ }),+ },+ async run({ auth, propsValue }) {+ const externalIds = aiResults.requireItems({ values: propsValue.value_external_ids, label: 'value external IDs', max: 1000 });+ return makeRequest(auth, HttpMethod.POST, `/metadata_fields/${encodeURIComponent(propsValue.external_id.trim())}/datasource_restore`, { external_ids: externalIds });+ },+});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/search-all-metadata-datasources.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/search-all-metadata-datasources.tsnew file mode 100644index 00000000000..4cfcb5a937c--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/search-all-metadata-datasources.ts@@ -0,0 +1,33 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest } from '../../common/client';+import { aiResults } from '../../common/ai-props';+import { cloudinarySearchAllMetadataDatasourcesOutputSchema } from '../../output-schemas';++export const cloudinarySearchAllMetadataDatasources = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_search_all_metadata_datasources',+ outputSchema: cloudinarySearchAllMetadataDatasourcesOutputSchema,+ displayName: 'Search All Metadata Values',+ description: 'Searches allowed values across every enum and set metadata field.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Searches allowed values across all enum and set metadata fields, returning field_id, value id and value for each match. Use when you know a value (e.g. a color) but not which field holds it.',+ idempotent: true,+ },+ props: {+ term: Property.ShortText({ displayName: 'Search Term', description: 'Text to match in the values.', required: true }),+ max_results: Property.Number({ displayName: 'Max Results', description: 'Maximum values to return.', required: false }),+ },+ async run({ auth, propsValue }) {+ const max = aiResults.clampMaxResults({ value: propsValue.max_results });+ const response: Record<string, unknown>[] = await makeRequest(auth, HttpMethod.POST, '/metadata_fields/datasource/search', {+ term: propsValue.term,+ ...(max !== undefined ? { max_results: max } : {}),+ });+ return { values: response, count: response.length };+ },+});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/search-assets.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/search-assets.tsnew file mode 100644index 00000000000..fd6dd3bdf6d--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/search-assets.ts@@ -0,0 +1,56 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest, ResourceList } from '../../common/client';+import { aiProps, aiResults } from '../../common/ai-props';+import { cloudinarySearchAssetsOutputSchema } from '../../output-schemas';++export const cloudinarySearchAssets = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_search_assets',+ outputSchema: cloudinarySearchAssetsOutputSchema,+ displayName: 'Search Assets',+ description: 'Searches assets with a Cloudinary search expression.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Searches all assets with a Lucene-like expression, e.g. `resource_type:image AND tags:sale AND uploaded_at>1d`, `folder:products/*`, `format:png AND bytes>1mb`, or `metadata.sku=123`. Use this for any attribute filter; simple browsing by type or tag can use List Resources or List Resources by Tag. Newly uploaded assets can take a few seconds to become searchable. Pages with next_cursor (max 500).',+ idempotent: true,+ },+ props: {+ expression: Property.LongText({+ displayName: 'Expression',+ description: 'Search expression (e.g. "resource_type:image AND tags:sale"). Leave empty to match all assets.',+ required: false,+ }),+ sort_by: Property.ShortText({+ displayName: 'Sort By Field',+ description: 'Field to sort by (e.g. "created_at", "public_id", "bytes"). Defaults to relevance, then created_at.',+ required: false,+ }),+ sort_direction: aiProps.direction(),+ with_field: Property.StaticMultiSelectDropdown({+ displayName: 'Include Fields',+ description: 'Extra data to return for each asset.',+ required: false,+ options: {+ options: ['tags', 'context', 'metadata', 'image_metadata', 'image_analysis', 'quality_analysis', 'accessibility_analysis'].map((value) => ({ label: value, value })),+ },+ }),+ max_results: aiProps.maxResults(),+ next_cursor: aiProps.nextCursor(),+ },+ async run({ auth, propsValue }) {+ const sortBy = propsValue.sort_by?.trim();+ const body = {+ ...(propsValue.expression ? { expression: propsValue.expression } : {}),+ ...(sortBy ? { sort_by: [{ [sortBy]: propsValue.sort_direction ?? 'desc' }] } : {}),+ ...(propsValue.with_field && propsValue.with_field.length > 0 ? { with_field: propsValue.with_field } : {}),+ ...(propsValue.max_results !== undefined && propsValue.max_results !== null ? { max_results: aiResults.clampMaxResults({ value: propsValue.max_results }) } : {}),+ ...(propsValue.next_cursor ? { next_cursor: propsValue.next_cursor } : {}),+ };+ const response: ResourceList = await makeRequest(auth, HttpMethod.POST, '/resources/search', body);+ return aiResults.toResourceList({ response });+ },+});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/search-folders.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/search-folders.tsnew file mode 100644index 00000000000..60c3175f4c6--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/search-folders.ts@@ -0,0 +1,53 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest } from '../../common/client';+import { aiProps, aiResults } from '../../common/ai-props';+import { cloudinarySearchFoldersOutputSchema } from '../../output-schemas';++export const cloudinarySearchFolders = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_search_folders',+ outputSchema: cloudinarySearchFoldersOutputSchema,+ displayName: 'Search Folders',+ description: 'Searches folders by name, path or creation date.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Finds folders anywhere in the tree with an expression on name, path, id or created_at, e.g. `name:banners`, `path:marketing/*`, `created_at>1w`. Returns name, path, external_id and created_at for each. Pages with next_cursor (max 500).',+ idempotent: true,+ },+ props: {+ expression: Property.ShortText({+ displayName: 'Expression',+ description: 'Search expression (e.g. "name:banners"). Leave empty to list all folders.',+ required: false,+ }),+ sort_by: Property.ShortText({+ displayName: 'Sort By Field',+ description: 'Field to sort by (e.g. "name", "created_at").',+ required: false,+ }),+ sort_direction: aiProps.direction(),+ max_results: aiProps.maxResults(),+ next_cursor: aiProps.nextCursor(),+ },+ async run({ auth, propsValue }) {+ const sortBy = propsValue.sort_by?.trim();+ const response: FolderSearch = await makeRequest(auth, HttpMethod.POST, '/folders/search', {+ ...(propsValue.expression ? { expression: propsValue.expression } : {}),+ ...(sortBy ? { sort_by: [{ [sortBy]: propsValue.sort_direction ?? 'desc' }] } : {}),+ ...(propsValue.max_results !== undefined && propsValue.max_results !== null ? { max_results: aiResults.clampMaxResults({ value: propsValue.max_results }) } : {}),+ ...(propsValue.next_cursor ? { next_cursor: propsValue.next_cursor } : {}),+ });+ return {+ folders: response.folders,+ count: response.folders.length,+ total_count: response.total_count ?? null,+ next_cursor: response.next_cursor ?? null,+ };+ },+});++type FolderSearch = { folders: Record<string, unknown>[]; next_cursor?: string; total_count?: number };diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/search-metadata-field-datasource.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/search-metadata-field-datasource.tsnew file mode 100644index 00000000000..b994d9f89cb--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/search-metadata-field-datasource.ts@@ -0,0 +1,38 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest } from '../../common/client';+import { aiResults } from '../../common/ai-props';+import { cloudinaryDeleteMetadataDatasourceEntriesOutputSchema } from '../../output-schemas';++export const cloudinarySearchMetadataFieldDatasource = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_search_metadata_field_datasource',+ outputSchema: cloudinaryDeleteMetadataDatasourceEntriesOutputSchema,+ displayName: 'Search Metadata Field Values',+ description: 'Searches the allowed values of one enum or set metadata field.',+ audience: 'ai',+ classification: 'SEARCH',+ aiMetadata: {+ description:+ 'Searches the allowed values of one enum or set metadata field by text, returning matching values with their external_ids (needed to set the field on assets). To search across every field use Search All Metadata Values.',+ idempotent: true,+ },+ props: {+ external_id: Property.ShortText({+ displayName: 'Field External ID',+ description: 'The metadata field external_id, from List Metadata Fields.',+ required: true,+ }),+ term: Property.ShortText({ displayName: 'Search Term', description: 'Text to match in the values.', required: true }),+ exact_match: Property.Checkbox({ displayName: 'Exact Match', description: 'Only return values equal to the term.', required: false, defaultValue: false }),+ max_results: Property.Number({ displayName: 'Max Results', description: 'Maximum values to return.', required: false }),+ },+ async run({ auth, propsValue }) {+ return makeRequest(auth, HttpMethod.POST, `/metadata_fields/${encodeURIComponent(propsValue.external_id.trim())}/datasource/search`, {}, {+ term: propsValue.term,+ exact_match: propsValue.exact_match || undefined,+ max_results: aiResults.clampMaxResults({ value: propsValue.max_results }),+ });+ },+});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/update-metadata-field-datasource.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/update-metadata-field-datasource.tsnew file mode 100644index 00000000000..2a8cc875fd2--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/update-metadata-field-datasource.ts@@ -0,0 +1,49 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest } from '../../common/client';+import { cloudinaryDeleteMetadataDatasourceEntriesOutputSchema } from '../../output-schemas';++export const cloudinaryUpdateMetadataFieldDatasource = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_update_metadata_field_datasource',+ outputSchema: cloudinaryDeleteMetadataDatasourceEntriesOutputSchema,+ displayName: 'Update Metadata Field Datasource',+ description: 'Adds or renames allowed values of an enum or set metadata field.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Upserts allowed values of an enum or set metadata field: a value with an existing external_id is renamed, a value with a new external_id is added; an empty external_id defaults to the value itself, so repeating the call does not create duplicates. Existing values not listed are kept. Returns the full value list.',+ idempotent: true,+ },+ props: {+ external_id: Property.ShortText({+ displayName: 'Field External ID',+ description: 'The metadata field external_id, from List Metadata Fields.',+ required: true,+ }),+ values: Property.Array({+ displayName: 'Values',+ description: 'Values to add or update.',+ required: true,+ properties: {+ value: Property.ShortText({ displayName: 'Value', description: 'The display value.', required: true }),+ external_id: Property.ShortText({ displayName: 'Value External ID', description: 'Existing external_id to rename, or a new ID. Defaults to the value itself when empty.', required: false }),+ },+ }),+ },+ async run({ auth, propsValue }) {+ const values = (propsValue.values ?? []).flatMap((item) => {+ if (typeof item !== 'object' || item === null || !('value' in item) || typeof item.value !== 'string' || item.value.trim() === '') {+ return [];+ }+ const externalId = 'external_id' in item && typeof item.external_id === 'string' ? item.external_id.trim() : '';+ return [{ value: item.value, external_id: externalId || item.value }];+ });+ if (values.length === 0) {+ throw new Error('Provide at least one value.');+ }+ return makeRequest(auth, HttpMethod.PUT, `/metadata_fields/${encodeURIComponent(propsValue.external_id.trim())}/datasource`, { values });+ },+});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/update-metadata-field.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/update-metadata-field.tsnew file mode 100644index 00000000000..0ecaa35e5cd--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/update-metadata-field.ts@@ -0,0 +1,49 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest } from '../../common/client';+import { aiProps, aiResults } from '../../common/ai-props';+import { cloudinaryGetMetadataFieldOutputSchema } from '../../output-schemas';++export const cloudinaryUpdateMetadataField = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_update_metadata_field',+ outputSchema: cloudinaryGetMetadataFieldOutputSchema,+ displayName: 'Update Metadata Field',+ description: 'Updates a structured metadata field\'s label, mandatory flag or default value.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Updates the label, mandatory flag, default value or disabled-default flag of a metadata field; omitted settings stay unchanged. The field type cannot change. To change allowed values use Update Metadata Field Datasource.',+ idempotent: true,+ },+ props: {+ external_id: Property.ShortText({+ displayName: 'Field External ID',+ description: 'The metadata field external_id, from List Metadata Fields.',+ required: true,+ }),+ label: Property.ShortText({ displayName: 'Label', description: 'New display label.', required: false }),+ mandatory: aiProps.optionalBoolean({ displayName: 'Mandatory', description: 'Whether every asset must have a value.' }),+ default_value: Property.ShortText({ displayName: 'Default Value', description: 'New default value.', required: false }),+ default_disabled: aiProps.optionalBoolean({ displayName: 'Default Disabled', description: 'Stop applying the default value to new assets.' }),+ },+ async run({ auth, propsValue }) {+ const mandatory = aiResults.toBoolean({ value: propsValue.mandatory });+ const defaultDisabled = aiResults.toBoolean({ value: propsValue.default_disabled });+ const field = propsValue.default_value !== undefined+ ? await makeRequest(auth, HttpMethod.GET, `/metadata_fields/${encodeURIComponent(propsValue.external_id.trim())}`)+ : undefined;+ const body = {+ ...(propsValue.label !== undefined ? { label: propsValue.label } : {}),+ ...(mandatory !== undefined ? { mandatory } : {}),+ ...(propsValue.default_value !== undefined ? { default_value: aiResults.toMetadataDefault({ type: typeof field?.type === 'string' ? field.type : 'string', value: propsValue.default_value }) } : {}),+ ...(defaultDisabled !== undefined ? { default_disabled: defaultDisabled } : {}),+ };+ if (Object.keys(body).length === 0) {+ throw new Error('Provide at least one setting to update.');+ }+ return makeRequest(auth, HttpMethod.PUT, `/metadata_fields/${encodeURIComponent(propsValue.external_id.trim())}`, body);+ },+});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/update-resource-by-asset-id.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/update-resource-by-asset-id.tsnew file mode 100644index 00000000000..d687c3dab52--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/update-resource-by-asset-id.ts@@ -0,0 +1,79 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest } from '../../common/client';+import { aiProps, aiResults } from '../../common/ai-props';+import { cloudinaryUpdateResourceOutputSchema } from '../../output-schemas';++export const cloudinaryUpdateResourceByAssetId = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_update_resource_by_asset_id',+ outputSchema: cloudinaryUpdateResourceOutputSchema,+ displayName: 'Update Resource by Asset ID',+ description: 'Updates an asset\'s display name, folder, tags, context, structured metadata or moderation status by asset ID.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Same as Update Resource but targets the asset by its immutable asset_id; omitted fields stay unchanged. Tags and Context replace the existing values.',+ idempotent: true,+ },+ props: {+ asset_id: Property.ShortText({+ displayName: 'Asset ID',+ description: 'The asset\'s immutable asset_id.',+ required: true,+ }),+ display_name: Property.ShortText({+ displayName: 'Display Name',+ description: 'New display name.',+ required: false,+ }),+ asset_folder: Property.ShortText({+ displayName: 'Asset Folder',+ description: 'Move the asset to this folder (dynamic folder mode).',+ required: false,+ }),+ tags: Property.Array({+ displayName: 'Tags',+ description: 'Replaces ALL existing tags with this list. To add or remove single tags use Update Resource Tags.',+ required: false,+ }),+ context: Property.ShortText({+ displayName: 'Context',+ description: 'Replaces contextual metadata, as pipe-separated key=value pairs (e.g. "alt=Red shoe|caption=Summer").',+ required: false,+ }),+ metadata: Property.Object({+ displayName: 'Structured Metadata',+ description: 'Structured metadata values keyed by field external_id. Only the given fields change.',+ required: false,+ }),+ moderation_status: Property.StaticDropdown({+ displayName: 'Moderation Status',+ description: 'Approve or reject an asset in manual moderation.',+ required: false,+ options: {+ options: [+ { label: 'Approved', value: 'approved' },+ { label: 'Rejected', value: 'rejected' },+ ],+ },+ }),+ },+ async run({ auth, propsValue }) {+ const tags = propsValue.tags === undefined ? undefined : aiResults.cleanArray({ values: propsValue.tags });+ const body = {+ ...(propsValue.display_name !== undefined ? { display_name: propsValue.display_name } : {}),+ ...(propsValue.asset_folder !== undefined ? { asset_folder: propsValue.asset_folder.trim() } : {}),+ ...(tags !== undefined ? { tags } : {}),+ ...(propsValue.context !== undefined ? { context: propsValue.context } : {}),+ ...(propsValue.metadata !== undefined && Object.keys(propsValue.metadata).length > 0 ? { metadata: propsValue.metadata } : {}),+ ...(propsValue.moderation_status !== undefined ? { moderation_status: propsValue.moderation_status } : {}),+ };+ if (Object.keys(body).length === 0) {+ throw new Error('Provide at least one field to update.');+ }+ return makeRequest(auth, HttpMethod.PUT, `/resources/${encodeURIComponent(propsValue.asset_id.trim())}`, body);+ },+});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/update-resource-context.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/update-resource-context.tsnew file mode 100644index 00000000000..998957e915e--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/update-resource-context.ts@@ -0,0 +1,59 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest } from '../../common/client';+import { aiProps, aiResults } from '../../common/ai-props';+import { cloudinaryUpdateResourceContextOutputSchema } from '../../output-schemas';++export const cloudinaryUpdateResourceContext = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_update_resource_context',+ outputSchema: cloudinaryUpdateResourceContextOutputSchema,+ displayName: 'Update Resource Context',+ description: 'Adds contextual metadata to, or clears it from, multiple assets.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Adds or updates contextual metadata keys (free-form key=value pairs such as alt or caption) on up to 1000 assets, or removes all context from them. Existing keys not mentioned stay. For typed structured metadata fields use Update Resource Metadata.',+ idempotent: true,+ },+ props: {+ resource_type: aiProps.resourceType({ required: true }),+ type: aiProps.deliveryType(),+ public_ids: Property.Array({+ displayName: 'Public IDs',+ description: 'Public IDs of the assets to update (up to 1000).',+ required: true,+ }),+ command: Property.StaticDropdown({+ displayName: 'Command',+ description: 'Add/update keys, or remove all context.',+ required: true,+ defaultValue: 'add',+ options: {+ options: [+ { label: 'Add or update keys', value: 'add' },+ { label: 'Remove all context', value: 'remove_all' },+ ],+ },+ }),+ context: Property.ShortText({+ displayName: 'Context',+ description: 'Pipe-separated key=value pairs (e.g. "alt=Red shoe|caption=Summer"). Required for Add.',+ required: false,+ }),+ },+ async run({ auth, propsValue }) {+ const publicIds = aiResults.requireItems({ values: propsValue.public_ids, label: 'public IDs', max: 1000 });+ if (propsValue.command === 'add' && !propsValue.context) {+ throw new Error('Provide the context to add.');+ }+ return makeRequest(auth, HttpMethod.POST, `/${propsValue.resource_type}/context`, {+ public_ids: publicIds,+ type: propsValue.type ?? 'upload',+ command: propsValue.command,+ ...(propsValue.command === 'add' ? { context: propsValue.context } : {}),+ });+ },+});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/update-resource-metadata.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/update-resource-metadata.tsnew file mode 100644index 00000000000..9a733b2e564--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/update-resource-metadata.ts@@ -0,0 +1,48 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest } from '../../common/client';+import { aiProps, aiResults } from '../../common/ai-props';+import { cloudinaryUpdateResourceContextOutputSchema } from '../../output-schemas';++export const cloudinaryUpdateResourceMetadata = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_update_resource_metadata',+ outputSchema: cloudinaryUpdateResourceContextOutputSchema,+ displayName: 'Update Resource Metadata',+ description: 'Sets structured metadata field values on multiple assets.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Sets structured metadata values on up to 100 assets, keyed by metadata field external_id (List Metadata Fields returns them). Enum and set fields take datasource value external_ids, set fields an array of them. Fields not given are unchanged; an empty string clears a field.',+ idempotent: true,+ },+ props: {+ resource_type: aiProps.resourceType({ required: true }),+ type: aiProps.deliveryType(),+ public_ids: Property.Array({+ displayName: 'Public IDs',+ description: 'Public IDs of the assets to update (up to 100).',+ required: true,+ }),+ metadata: Property.Object({+ displayName: 'Metadata',+ description: 'Field external_id to value, e.g. {"sku": "A-100", "color": ["red_id"]}.',+ required: true,+ }),+ clear_invalid: aiProps.includeFlag({ displayName: 'Clear Invalid Values', description: 'Drop existing values that no longer pass field validation instead of failing.' }),+ },+ async run({ auth, propsValue }) {+ const publicIds = aiResults.requireItems({ values: propsValue.public_ids, label: 'public IDs', max: 100 });+ if (Object.keys(propsValue.metadata).length === 0) {+ throw new Error('Provide at least one metadata field value.');+ }+ return makeRequest(auth, HttpMethod.POST, `/${propsValue.resource_type}/metadata`, {+ public_ids: publicIds,+ type: propsValue.type ?? 'upload',+ metadata: propsValue.metadata,+ ...(propsValue.clear_invalid ? { clear_invalid: true } : {}),+ });+ },+});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/update-resource-tags.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/update-resource-tags.tsnew file mode 100644index 00000000000..2065f174c0d--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/update-resource-tags.ts@@ -0,0 +1,62 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest } from '../../common/client';+import { aiProps, aiResults } from '../../common/ai-props';+import { cloudinaryUpdateResourceContextOutputSchema } from '../../output-schemas';++export const cloudinaryUpdateResourceTags = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_update_resource_tags',+ outputSchema: cloudinaryUpdateResourceContextOutputSchema,+ displayName: 'Update Resource Tags',+ description: 'Adds, removes or replaces tags on up to 1000 assets at once.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Changes tags on many assets of one resource type in one call: add tags, remove tags, replace all tags with the given ones, or remove all tags. Public IDs times tags must not exceed 1000. Returns the public_ids that were updated.',+ idempotent: true,+ },+ props: {+ resource_type: aiProps.resourceType({ required: true }),+ type: aiProps.deliveryType(),+ public_ids: Property.Array({+ displayName: 'Public IDs',+ description: 'Public IDs of the assets to update (up to 1000).',+ required: true,+ }),+ command: Property.StaticDropdown({+ displayName: 'Command',+ description: 'What to do with the tags.',+ required: true,+ defaultValue: 'add',+ options: {+ options: [+ { label: 'Add tags', value: 'add' },+ { label: 'Remove tags', value: 'remove' },+ { label: 'Replace all tags', value: 'replace' },+ { label: 'Remove all tags', value: 'remove_all' },+ ],+ },+ }),+ tags: Property.Array({+ displayName: 'Tags',+ description: 'Tags to add, remove or set. Not used with Remove all tags.',+ required: false,+ }),+ },+ async run({ auth, propsValue }) {+ const publicIds = aiResults.requireItems({ values: propsValue.public_ids, label: 'public IDs', max: 1000 });+ const tags = aiResults.cleanArray({ values: propsValue.tags });+ if (propsValue.command !== 'remove_all' && tags.length === 0) {+ throw new Error('Provide at least one tag for this command.');+ }+ return makeRequest(auth, HttpMethod.POST, `/${propsValue.resource_type}/tags`, {+ public_ids: publicIds,+ type: propsValue.type ?? 'upload',+ command: propsValue.command,+ ...(propsValue.command !== 'remove_all' ? { tags } : {}),+ });+ },+});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/update-resource.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/update-resource.tsnew file mode 100644index 00000000000..de83e1ea4d3--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/update-resource.ts@@ -0,0 +1,86 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest } from '../../common/client';+import { aiProps, aiResults } from '../../common/ai-props';+import { cloudinaryUpdateResourceOutputSchema } from '../../output-schemas';++export const cloudinaryUpdateResource = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_update_resource',+ outputSchema: cloudinaryUpdateResourceOutputSchema,+ displayName: 'Update Resource',+ description: 'Updates an asset\'s display name, folder, tags, context, structured metadata or moderation status by public ID.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Updates attributes of one asset identified by resource type, delivery type and public ID; omitted fields stay unchanged. Tags and Context replace the existing values, so use Update Resource Tags / Update Resource Context to add or remove single entries. To change the public ID itself use Rename Resource; with only an asset_id use Update Resource by Asset ID.',+ idempotent: true,+ },+ props: {+ resource_type: aiProps.resourceType({ required: true }),+ type: aiProps.deliveryType(),+ public_id: Property.ShortText({+ displayName: 'Public ID',+ description: 'The asset\'s public ID.',+ required: true,+ }),+ display_name: Property.ShortText({+ displayName: 'Display Name',+ description: 'New display name.',+ required: false,+ }),+ asset_folder: Property.ShortText({+ displayName: 'Asset Folder',+ description: 'Move the asset to this folder (dynamic folder mode).',+ required: false,+ }),+ tags: Property.Array({+ displayName: 'Tags',+ description: 'Replaces ALL existing tags with this list. To add or remove single tags use Update Resource Tags.',+ required: false,+ }),+ context: Property.ShortText({+ displayName: 'Context',+ description: 'Replaces contextual metadata, as pipe-separated key=value pairs (e.g. "alt=Red shoe|caption=Summer").',+ required: false,+ }),+ metadata: Property.Object({+ displayName: 'Structured Metadata',+ description: 'Structured metadata values keyed by field external_id. Only the given fields change.',+ required: false,+ }),+ moderation_status: Property.StaticDropdown({+ displayName: 'Moderation Status',+ description: 'Approve or reject an asset in manual moderation.',+ required: false,+ options: {+ options: [+ { label: 'Approved', value: 'approved' },+ { label: 'Rejected', value: 'rejected' },+ ],+ },+ }),+ },+ async run({ auth, propsValue }) {+ const tags = propsValue.tags === undefined ? undefined : aiResults.cleanArray({ values: propsValue.tags });+ const body = {+ ...(propsValue.display_name !== undefined ? { display_name: propsValue.display_name } : {}),+ ...(propsValue.asset_folder !== undefined ? { asset_folder: propsValue.asset_folder.trim() } : {}),+ ...(tags !== undefined ? { tags } : {}),+ ...(propsValue.context !== undefined ? { context: propsValue.context } : {}),+ ...(propsValue.metadata !== undefined && Object.keys(propsValue.metadata).length > 0 ? { metadata: propsValue.metadata } : {}),+ ...(propsValue.moderation_status !== undefined ? { moderation_status: propsValue.moderation_status } : {}),+ };+ if (Object.keys(body).length === 0) {+ throw new Error('Provide at least one field to update.');+ }+ return makeRequest(+ auth,+ HttpMethod.POST,+ `/resources/${propsValue.resource_type}/${propsValue.type ?? 'upload'}/${aiResults.encodePath({ value: propsValue.public_id })}`,+ body,+ );+ },+});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/update-transformation.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/update-transformation.tsnew file mode 100644index 00000000000..71dd65021e8--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/update-transformation.ts@@ -0,0 +1,41 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest } from '../../common/client';+import { aiProps, aiResults } from '../../common/ai-props';+import { cloudinaryDeleteMetadataFieldOutputSchema } from '../../output-schemas';++export const cloudinaryUpdateTransformation = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_update_transformation',+ outputSchema: cloudinaryDeleteMetadataFieldOutputSchema,+ displayName: 'Update Named Transformation',+ description: 'Changes a named transformation\'s definition or strict-mode flag.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Replaces the definition of an existing named transformation and/or its allowed-for-strict flag; omitted settings stay unchanged. Already-generated derived assets keep the old result until invalidated.',+ idempotent: true,+ },+ props: {+ name: Property.ShortText({+ displayName: 'Transformation Name',+ description: 'Named transformation name, without the t_ prefix.',+ required: true,+ }),+ transformation: Property.ShortText({ displayName: 'New Transformation', description: 'New transformation string.', required: false }),+ allowed_for_strict: aiProps.optionalBoolean({ displayName: 'Allowed for Strict Mode', description: 'Allow this transformation when strict transformations are enabled.' }),+ },+ async run({ auth, propsValue }) {+ const allowedForStrict = aiResults.toBoolean({ value: propsValue.allowed_for_strict });+ const body = {+ ...(propsValue.transformation ? { unsafe_update: propsValue.transformation.trim() } : {}),+ ...(allowedForStrict !== undefined ? { allowed_for_strict: allowedForStrict } : {}),+ };+ if (Object.keys(body).length === 0) {+ throw new Error('Provide a new transformation or strict-mode setting.');+ }+ return makeRequest(auth, HttpMethod.PUT, `/transformations/${encodeURIComponent(propsValue.name.trim())}`, body);+ },+});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/ai/upload-asset.ts b/packages/pieces/community/cloudinary/src/lib/actions/ai/upload-asset.tsnew file mode 100644index 00000000000..9ff108bb5de--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/actions/ai/upload-asset.ts@@ -0,0 +1,90 @@+import { HttpMethod } from '@activepieces/pieces-common';+import { createAction, Property } from '@activepieces/pieces-framework';+import { cloudinaryAuth } from '../../common/auth';+import { makeRequest } from '../../common/client';+import { aiProps, aiResults } from '../../common/ai-props';+import { cloudinaryUploadAssetOutputSchema } from '../../output-schemas';++export const cloudinaryUploadAsset = createAction({+ auth: cloudinaryAuth,+ name: 'cloudinary_upload_asset',+ outputSchema: cloudinaryUploadAssetOutputSchema,+ displayName: 'Upload Asset',+ description: 'Uploads a file to Cloudinary from a public URL or a data URI.',+ audience: 'ai',+ classification: 'WRITE',+ aiMetadata: {+ description:+ 'Uploads one file from a remote URL (http/https/s3/gs) or a base64 data URI, with resource type auto-detected by default. Optionally sets the public ID, asset folder, tags, contextual metadata, display name or an upload preset. Returns the new asset_id, public_id and delivery URLs. Not idempotent: each call creates a new asset unless a fixed Public ID is given with Overwrite.',+ idempotent: false,+ },+ props: {+ file: Property.LongText({+ displayName: 'File URL or Data URI',+ description: 'A publicly reachable URL of the file, or a data URI (data:image/png;base64,...).',+ required: true,+ }),+ resource_type: Property.StaticDropdown({+ displayName: 'Resource Type',+ description: 'Asset type. Defaults to auto-detect.',+ required: false,+ defaultValue: 'auto',+ options: {+ options: [+ { label: 'Auto-detect', value: 'auto' },+ { label: 'Image', value: 'image' },+ { label: 'Video', value: 'video' },+ { label: 'Raw', value: 'raw' },+ ],+ },+ }),+ public_id: Property.ShortText({+ displayName: 'Public ID',+ description: 'Public ID to assign (without extension). Leave empty for a random ID.',+ required: false,+ }),+ asset_folder: Property.ShortText({+ displayName: 'Asset Folder',+ description: 'Folder to place the asset in (e.g. "marketing/banners").',+ required: false,+ }),+ display_name: Property.ShortText({+ displayName: 'Display Name',+ description: 'Human-readable name shown in the Media Library.',+ required: false,+ }),+ tags: Property.Array({+ displayName: 'Tags',+ description: 'Tags to add to the asset.',+ required: false,+ }),+ context: Property.ShortText({+ displayName: 'Context',+ description: 'Contextual metadata as pipe-separated key=value pairs (e.g. "alt=Red shoe|caption=Summer").',+ required: false,+ }),+ upload_preset: Property.ShortText({+ displayName: 'Upload Preset',+ description: 'Name of an upload preset to apply. List Upload Presets returns the names.',+ required: false,+ }),+ overwrite: aiProps.optionalBoolean({ displayName: 'Overwrite', description: 'Replace an existing asset with the same Public ID.' }),+ use_filename: aiProps.includeFlag({ displayName: 'Use Original Filename', description: 'Use the source file name as the public ID (when Public ID is empty).' }),+ },+ async run({ auth, propsValue }) {+ const tags = aiResults.cleanArray({ values: propsValue.tags });+ const overwrite = aiResults.toBoolean({ value: propsValue.overwrite });+ const body = {+ file: propsValue.file.trim(),+ ...(propsValue.public_id ? { public_id: propsValue.public_id.trim() } : {}),+ ...(propsValue.asset_folder ? { asset_folder: propsValue.asset_folder.trim() } : {}),+ ...(propsValue.display_name ? { display_name: propsValue.display_name } : {}),+ ...(tags.length > 0 ? { tags } : {}),+ ...(propsValue.context ? { context: propsValue.context } : {}),+ ...(propsValue.upload_preset ? { upload_preset: propsValue.upload_preset.trim() } : {}),+ ...(overwrite !== undefined ? { overwrite } : {}),+ ...(propsValue.use_filename ? { use_filename: true } : {}),+ };+ return makeRequest(auth, HttpMethod.POST, `/${propsValue.resource_type ?? 'auto'}/upload`, body);+ },+});diff --git a/packages/pieces/community/cloudinary/src/lib/actions/create-usage-report.ts b/packages/pieces/community/cloudinary/src/lib/actions/create-usage-report.tsindex 8af9fc90f97..ae9497a191e 100644--- a/packages/pieces/community/cloudinary/src/lib/actions/create-usage-report.ts+++ b/packages/pieces/community/cloudinary/src/lib/actions/create-usage-report.ts@@ -10,7 +10,7 @@ export const createUsageReport = createAction({classification: 'READ',displayName: 'Create Usage Report',description: 'Generate a comprehensive report of account usage and quotas including storage, bandwidth, transformations, requests, and add-on usage.',- audience: 'both',+ audience: 'human',aiMetadata: { description: 'Reads the Cloudinary account usage and quota figures (storage, bandwidth, transformations, requests, add-ons) for an optional date within the last three months. Use to check current consumption against plan limits. Read-only and idempotent; despite the name it creates nothing.', idempotent: true },props: {date: Property.DateTime({diff --git a/packages/pieces/community/cloudinary/src/lib/actions/delete-resource.ts b/packages/pieces/community/cloudinary/src/lib/actions/delete-resource.tsindex ee7c9637907..dfdb688e76a 100644--- a/packages/pieces/community/cloudinary/src/lib/actions/delete-resource.ts+++ b/packages/pieces/community/cloudinary/src/lib/actions/delete-resource.ts@@ -10,7 +10,7 @@ export const deleteResource = createAction({classification: 'DESTRUCTIVE',displayName: 'Delete Resource',description: 'Permanently delete images, videos, or files from Cloudinary.',- audience: 'both',+ audience: 'human',aiMetadata: { description: 'Permanently deletes Cloudinary assets, selected either by a list of public IDs, by a tag, or by a public-ID prefix. Use to remove media from the account; this is a destructive bulk operation, so confirm the selection before calling. Not idempotent: it mutates account state and can also strip derived assets or invalidate the CDN cache.', idempotent: false },props: {deletion_mode: Property.StaticDropdown({diff --git a/packages/pieces/community/cloudinary/src/lib/actions/find-resource-by-public-id.ts b/packages/pieces/community/cloudinary/src/lib/actions/find-resource-by-public-id.tsindex 9f457dfc101..57319897ab7 100644--- a/packages/pieces/community/cloudinary/src/lib/actions/find-resource-by-public-id.ts+++ b/packages/pieces/community/cloudinary/src/lib/actions/find-resource-by-public-id.ts@@ -10,7 +10,7 @@ export const findResourceByPublicId = createAction({classification: 'READ',displayName: 'Find Resource by Public ID',description: 'Retrieve details of an asset using its unique public ID.',- audience: 'both',+ audience: 'human',aiMetadata: { description: 'Looks up a single Cloudinary asset by its public ID, resource type, and delivery type, returning its metadata. Use to confirm an asset exists or fetch its details before transforming or deleting it; a missing asset returns a not-found result rather than erroring. Read-only and idempotent.', idempotent: true },props: {resource_type: resourceTypeDropdown,diff --git a/packages/pieces/community/cloudinary/src/lib/actions/transform-resource.ts b/packages/pieces/community/cloudinary/src/lib/actions/transform-resource.tsindex b5df127485d..3dad882db6f 100644--- a/packages/pieces/community/cloudinary/src/lib/actions/transform-resource.ts+++ b/packages/pieces/community/cloudinary/src/lib/actions/transform-resource.ts@@ -2,10 +2,12 @@ import { createAction, Property } from '@activepieces/pieces-framework';import { cloudinaryAuth } from '../common/auth';import { resourceTypeDropdown, publicIdsDropdown } from '../common/props';import { httpClient, HttpMethod } from '@activepieces/pieces-common';+import { transformresourceOutputSchema } from '../output-schemas';export const transformResource = createAction({auth: cloudinaryAuth,name: 'transformResource',+ outputSchema: transformresourceOutputSchema,classification: 'READ',displayName: 'Transform Resource',description: 'Apply transformations (resize, crop, watermark, etc.) to an asset and generate a new URL.',diff --git a/packages/pieces/community/cloudinary/src/lib/actions/upload-resource.ts b/packages/pieces/community/cloudinary/src/lib/actions/upload-resource.tsindex 85192f518e8..bf6c54e61ef 100644--- a/packages/pieces/community/cloudinary/src/lib/actions/upload-resource.ts+++ b/packages/pieces/community/cloudinary/src/lib/actions/upload-resource.ts@@ -26,7 +26,7 @@ export const uploadResource = createAction({classification: 'WRITE',displayName: 'Upload Resource',description: 'Upload a new image, video, or file to Cloudinary.',- audience: 'both',+ audience: 'human',aiMetadata: { description: 'Uploads a file (image, video, or raw) to Cloudinary, optionally placing it in a folder, tagging it, and assigning a public ID. Use to ingest media into the account before transforming, delivering, or referencing it. Not idempotent: each call uploads the file and, unless overwrite is enabled with a fixed public_id, creates a distinct asset.', idempotent: false },props: {file: Property.File({diff --git a/packages/pieces/community/cloudinary/src/lib/common/ai-props.ts b/packages/pieces/community/cloudinary/src/lib/common/ai-props.tsnew file mode 100644index 00000000000..868661c8f74--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/common/ai-props.ts@@ -0,0 +1,155 @@+import { Property } from '@activepieces/pieces-framework';+import { ResourceList } from './client';++function resourceType({ required }: { required: boolean }) {+ return Property.StaticDropdown({+ displayName: 'Resource Type',+ description: required ? 'The asset type.' : 'The asset type. Leave empty to include all types.',+ required,+ defaultValue: required ? 'image' : undefined,+ options: { options: RESOURCE_TYPE_OPTIONS },+ });+}++function deliveryType() {+ return Property.StaticDropdown({+ displayName: 'Delivery Type',+ description: 'The storage/delivery type of the asset. Defaults to upload.',+ required: false,+ defaultValue: 'upload',+ options: { options: DELIVERY_TYPE_OPTIONS },+ });+}++function maxResults() {+ return Property.Number({+ displayName: 'Max Results',+ description: 'Maximum number of items to return (1-500). Defaults to 10.',+ required: false,+ });+}++function nextCursor() {+ return Property.ShortText({+ displayName: 'Next Cursor',+ description: 'The next_cursor value from a previous call, to fetch the next page.',+ required: false,+ });+}++function direction() {+ return Property.StaticDropdown({+ displayName: 'Sort Direction',+ description: 'Sort by creation time. Defaults to newest first.',+ required: false,+ options: {+ options: [+ { label: 'Newest first', value: 'desc' },+ { label: 'Oldest first', value: 'asc' },+ ],+ },+ });+}++function includeFlag({ displayName, description }: { displayName: string; description: string }) {+ return Property.Checkbox({ displayName, description, required: false, defaultValue: false });+}++function optionalBoolean({ displayName, description }: { displayName: string; description: string }) {+ return Property.StaticDropdown({+ displayName,+ description: `${description} Leave empty to keep the default.`,+ required: false,+ options: {+ options: [+ { label: 'Yes', value: 'true' },+ { label: 'No', value: 'false' },+ ],+ },+ });+}++function invalidate() {+ return Property.Checkbox({+ displayName: 'Invalidate CDN Cache',+ description: 'Also invalidate cached copies on the CDN (takes a few minutes to propagate).',+ required: false,+ defaultValue: false,+ });+}++function toBoolean({ value }: { value: string | undefined }): boolean | undefined {+ if (value === 'true') {+ return true;+ }+ if (value === 'false') {+ return false;+ }+ return undefined;+}++function encodePath({ value }: { value: string }): string {+ return value+ .trim()+ .split('/')+ .map(encodeURIComponent)+ .join('/');+}++function requireItems({ values, label, max }: { values: unknown[] | undefined; label: string; max: number }): string[] {+ const items = cleanArray({ values });+ if (items.length === 0 || items.length > max) {+ throw new Error(`Provide between 1 and ${max} ${label}.`);+ }+ return items;+}++function clampMaxResults({ value }: { value: number | undefined }): number | undefined {+ if (value === undefined || value === null) {+ return undefined;+ }+ return Math.min(Math.max(Math.trunc(value), 1), 500);+}++function toResourceList({ response }: { response: ResourceList }) {+ return {+ resources: response.resources,+ count: response.resources.length,+ total_count: response.total_count ?? null,+ next_cursor: response.next_cursor ?? null,+ };+}++function cleanArray({ values }: { values: unknown[] | undefined }): string[] {+ return (values ?? [])+ .filter((value): value is string => typeof value === 'string')+ .map((value) => value.trim())+ .filter((value) => value.length > 0);+}++const RESOURCE_TYPE_OPTIONS = [+ { label: 'Image', value: 'image' },+ { label: 'Video', value: 'video' },+ { label: 'Raw', value: 'raw' },+];++const DELIVERY_TYPE_OPTIONS = [+ { label: 'Upload', value: 'upload' },+ { label: 'Private', value: 'private' },+ { label: 'Authenticated', value: 'authenticated' },+ { label: 'Fetch', value: 'fetch' },+];++function toMetadataDefault({ type, value }: { type: string; value: string }): string | number | string[] {+ if (type === 'integer') {+ return Number(value);+ }+ if (type === 'set') {+ return value.split(',').map((item) => item.trim());+ }+ return value;+}++export const aiProps = { resourceType, deliveryType, maxResults, nextCursor, direction, includeFlag, optionalBoolean, invalidate };++export const aiResults = { clampMaxResults, toResourceList, cleanArray, toBoolean, encodePath, requireItems, toMetadataDefault };diff --git a/packages/pieces/community/cloudinary/src/lib/common/client.ts b/packages/pieces/community/cloudinary/src/lib/common/client.tsindex 1acfc1df841..e8f34265203 100644--- a/packages/pieces/community/cloudinary/src/lib/common/client.ts+++ b/packages/pieces/community/cloudinary/src/lib/common/client.ts@@ -1,3 +1,4 @@+import crypto from 'crypto';import { HttpMethod, httpClient } from '@activepieces/pieces-common';import { AppConnectionValueForAuthProperty } from '@activepieces/pieces-framework';import { BasicAuthConnectionValue, CustomAuthConnectionValue } from '@activepieces/pieces-framework';@@ -34,10 +35,9 @@ export async function makeRequest(const response = await httpClient.sendRequest({method,- url: `${BASE_URL}/${cloud_name}${path}`,+ url: `${BASE_URL}/${cloud_name}${path}${toQueryString({ query: queryParams })}`,headers,body,- queryParams,});return response.body;@@ -63,4 +63,53 @@ export async function makeRequest(}throw new Error(`Request failed: ${error.message || 'Unknown error'}`);}-}\ No newline at end of file+}++export function buildSignedUrl({ auth, path, params }: SignedUrlParams): string {+ const api_key = auth.props.api_key.trim();+ const api_secret = auth.props.api_secret.trim();+ const cloud_name = auth.props.cloud_name.trim();+ const withTimestamp: SignedUrlParams['params'] = { ...params, timestamp: Math.floor(Date.now() / 1000) };+ const signable = Object.fromEntries(+ Object.entries(withTimestamp).filter(+ (entry): entry is [string, string | number | boolean] => entry[1] !== undefined && entry[1] !== '',+ ),+ );+ const toSign = Object.keys(signable)+ .sort()+ .map((key) => `${key}=${signable[key]}`)+ .join('&');+ const signature = crypto.createHash('sha1').update(toSign + api_secret).digest('hex');+ const search = new URLSearchParams(+ Object.entries({ ...signable, api_key, signature }).map(([key, value]) => [key, String(value)]),+ );+ return `${BASE_URL}/${cloud_name}${path}?${search.toString()}`;+}++function toQueryString({ query }: { query?: Record<string, unknown> }): string {+ const params = new URLSearchParams();+ for (const [key, value] of Object.entries(query ?? {})) {+ if (value === undefined || value === null || value === '') {+ continue;+ }+ if (Array.isArray(value)) {+ value.forEach((item) => params.append(`${key}[]`, String(item)));+ } else {+ params.append(key, String(value));+ }+ }+ const search = params.toString();+ return search ? `?${search}` : '';+}++export type ResourceList = {+ resources: Record<string, unknown>[];+ next_cursor?: string;+ total_count?: number;+};++type SignedUrlParams = {+ auth: AppConnectionValueForAuthProperty<typeof cloudinaryAuth>;+ path: string;+ params: Record<string, string | number | boolean | undefined>;+};diff --git a/packages/pieces/community/cloudinary/src/lib/output-schemas.ts b/packages/pieces/community/cloudinary/src/lib/output-schemas.tsnew file mode 100644index 00000000000..22f1270765a--- /dev/null+++ b/packages/pieces/community/cloudinary/src/lib/output-schemas.ts@@ -0,0 +1,1089 @@+import { OutputSchema } from '@activepieces/pieces-framework';++export const cloudinaryGenerateArchiveOutputSchema: OutputSchema = {+ fields: [+ { key: 'asset_id', label: 'Asset ID' },+ { key: 'public_id', label: 'Public ID' },+ { key: 'version', label: 'Version', format: 'number' },+ { key: 'version_id', label: 'Version ID' },+ { key: 'signature', label: 'Signature' },+ { key: 'resource_type', label: 'Resource Type' },+ { key: 'created_at', label: 'Created At', format: 'datetime' },+ { key: 'tags', label: 'Tags' },+ { key: 'bytes', label: 'Bytes', format: 'number' },+ { key: 'type', label: 'Type' },+ { key: 'etag', label: 'Etag' },+ { key: 'placeholder', label: 'Placeholder', format: 'boolean' },+ { key: 'url', label: 'URL', format: 'url' },+ { key: 'secure_url', label: 'Secure URL', format: 'url' },+ { key: 'asset_folder', label: 'Asset Folder' },+ { key: 'display_name', label: 'Display Name' },+ { key: 'resource_count', label: 'Resource Count', format: 'number' },+ { key: 'file_count', label: 'File Count', format: 'number' },+ ],+};++export const cloudinaryDeleteResourcesOutputSchema: OutputSchema = {+ fields: [+ { key: 'deleted', label: 'Deleted', dynamicKey: true },+ {+ key: 'deleted_counts',+ label: 'Deleted Counts',+ dynamicKey: true,+ children: [+ { key: 'original', label: 'Original', format: 'number' },+ { key: 'derived', label: 'Derived', format: 'number' },+ ],+ },+ { key: 'partial', label: 'Partial', format: 'boolean' },+ ],+};++export const cloudinaryDeleteFolderOutputSchema: OutputSchema = {+ fields: [+ { key: 'deleted', label: 'Deleted' },+ ],+};++export const cloudinaryDeleteMetadataFieldOutputSchema: OutputSchema = {+ fields: [+ { key: 'message', label: 'Message' },+ ],+};++export const cloudinaryConcatenateVideosOutputSchema: OutputSchema = {+ fields: [+ { key: 'status', label: 'Status' },+ { key: 'unique_upload_id', label: 'Unique Upload ID' },+ { key: 'public_id', label: 'Public ID' },+ { key: 'resource_type', label: 'Resource Type' },+ ],+};++export const cloudinaryGetConfigOutputSchema: OutputSchema = {+ fields: [+ { key: 'cloud_name', label: 'Cloud Name' },+ { key: 'created_at', label: 'Created At', format: 'datetime' },+ { key: 'id', label: 'ID' },+ {+ key: 'settings',+ label: 'Settings',+ children: [+ { key: 'folder_mode', label: 'Folder Mode' },+ ],+ },+ ],+};++export const cloudinaryUpdateResourceContextOutputSchema: OutputSchema = {+ fields: [+ { key: 'public_ids', label: 'Public IDs' },+ ],+};++export const cloudinaryDeleteResourcesByTagOutputSchema: OutputSchema = {+ fields: [+ { key: 'deleted', label: 'Deleted', dynamicKey: true },+ {+ key: 'deleted_counts',+ label: 'Deleted Counts',+ dynamicKey: true,+ children: [+ { key: 'original', label: 'Original', format: 'number' },+ { key: 'derived', label: 'Derived', format: 'number' },+ ],+ },+ { key: 'partial', label: 'Partial', format: 'boolean' },+ ],+};++export const cloudinaryDeleteDerivedResourcesOutputSchema: OutputSchema = {+ fields: [+ { key: 'deleted', label: 'Deleted', dynamicKey: true },+ ],+};++export const cloudinaryDestroyAssetByIdOutputSchema: OutputSchema = {+ fields: [+ { key: 'result', label: 'Result' },+ ],+};++export const cloudinaryGenerateDownloadUrlOutputSchema: OutputSchema = {+ fields: [+ { key: 'download_url', label: 'Download URL', format: 'url' },+ { key: 'expires_at', label: 'Expires At', format: 'datetime' },+ { key: 'public_id', label: 'Public ID' },+ { key: 'asset_id', label: 'Asset ID' },+ ],+};++export const cloudinaryDeleteMetadataDatasourceEntriesOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'values',+ label: 'Values',+ listItems: [+ { key: 'external_id', label: 'External ID' },+ { key: 'value', label: 'Value' },+ ],+ },+ ],+};++export const cloudinarySearchAllMetadataDatasourcesOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'values',+ label: 'Values',+ labelKey: 'id',+ listItems: [+ { key: 'field_id', label: 'Field ID' },+ { key: 'id', label: 'ID' },+ { key: 'value', label: 'Value' },+ ],+ },+ { key: 'count', label: 'Count', format: 'number' },+ ],+};++export const cloudinaryExplicitResourceOutputSchema: OutputSchema = {+ fields: [+ { key: 'asset_id', label: 'Asset ID' },+ { key: 'public_id', label: 'Public ID' },+ { key: 'version', label: 'Version', format: 'number' },+ { key: 'version_id', label: 'Version ID' },+ { key: 'signature', label: 'Signature' },+ { key: 'width', label: 'Width', format: 'number' },+ { key: 'height', label: 'Height', format: 'number' },+ { key: 'format', label: 'Format' },+ { key: 'resource_type', label: 'Resource Type' },+ { key: 'created_at', label: 'Created At', format: 'datetime' },+ { key: 'tags', label: 'Tags' },+ { key: 'bytes', label: 'Bytes', format: 'number' },+ { key: 'type', label: 'Type' },+ { key: 'placeholder', label: 'Placeholder', format: 'boolean' },+ { key: 'url', label: 'URL', format: 'image' },+ { key: 'secure_url', label: 'Secure URL', format: 'image' },+ { key: 'asset_folder', label: 'Asset Folder' },+ { key: 'display_name', label: 'Display Name' },+ {+ key: 'eager',+ label: 'Eager',+ listItems: [+ { key: 'transformation', label: 'Transformation' },+ { key: 'width', label: 'Width', format: 'number' },+ { key: 'height', label: 'Height', format: 'number' },+ { key: 'bytes', label: 'Bytes', format: 'number' },+ { key: 'format', label: 'Format' },+ { key: 'url', label: 'URL', format: 'image' },+ { key: 'secure_url', label: 'Secure URL', format: 'image' },+ ],+ },+ ],+};++export const cloudinaryExplodeResourceOutputSchema: OutputSchema = {+ fields: [+ { key: 'status', label: 'Status' },+ { key: 'batch_id', label: 'Batch ID' },+ ],+};++export const cloudinaryCreateFolderOutputSchema: OutputSchema = {+ fields: [+ { key: 'success', label: 'Success', format: 'boolean' },+ { key: 'path', label: 'Path' },+ { key: 'name', label: 'Name' },+ { key: 'external_id', label: 'External ID' },+ ],+};++export const cloudinaryGetFolderOutputSchema: OutputSchema = {+ fields: [+ { key: 'name', label: 'Name' },+ { key: 'path', label: 'Path' },+ { key: 'external_id', label: 'External ID' },+ ],+};++export const cloudinaryRenameFolderOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'from',+ label: 'From',+ children: [+ { key: 'name', label: 'Name' },+ { key: 'path', label: 'Path' },+ ],+ },+ {+ key: 'to',+ label: 'To',+ children: [+ { key: 'name', label: 'Name' },+ { key: 'path', label: 'Path' },+ ],+ },+ ],+};++export const cloudinaryListRootFoldersOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'folders',+ label: 'Folders',+ labelKey: 'name',+ listItems: [+ { key: 'name', label: 'Name' },+ { key: 'path', label: 'Path' },+ { key: 'external_id', label: 'External ID' },+ ],+ },+ { key: 'count', label: 'Count', format: 'number' },+ { key: 'total_count', label: 'Total Count', format: 'number' },+ { key: 'next_cursor', label: 'Next Cursor' },+ ],+};++export const cloudinarySearchFoldersOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'folders',+ label: 'Folders',+ labelKey: 'name',+ listItems: [+ { key: 'name', label: 'Name' },+ { key: 'path', label: 'Path' },+ { key: 'created_at', label: 'Created At', format: 'datetime' },+ { key: 'external_id', label: 'External ID' },+ ],+ },+ { key: 'count', label: 'Count', format: 'number' },+ { key: 'total_count', label: 'Total Count', format: 'number' },+ { key: 'next_cursor', label: 'Next Cursor' },+ ],+};++export const cloudinaryGetResourceOutputSchema: OutputSchema = {+ fields: [+ { key: 'asset_id', label: 'Asset ID' },+ { key: 'public_id', label: 'Public ID' },+ { key: 'format', label: 'Format' },+ { key: 'version', label: 'Version', format: 'number' },+ { key: 'resource_type', label: 'Resource Type' },+ { key: 'type', label: 'Type' },+ { key: 'created_at', label: 'Created At', format: 'datetime' },+ { key: 'bytes', label: 'Bytes', format: 'number' },+ { key: 'width', label: 'Width', format: 'number' },+ { key: 'height', label: 'Height', format: 'number' },+ { key: 'asset_folder', label: 'Asset Folder' },+ { key: 'display_name', label: 'Display Name' },+ { key: 'url', label: 'URL', format: 'image' },+ { key: 'secure_url', label: 'Secure URL', format: 'image' },+ {+ key: 'context',+ label: 'Context',+ children: [+ {+ key: 'custom',+ label: 'Custom',+ dynamicKey: true,+ },+ ],+ },+ { key: 'last_updated', label: 'Last Updated' },+ { key: 'tags', label: 'Tags' },+ { key: 'next_cursor', label: 'Next Cursor' },+ { key: 'derived', label: 'Derived' },+ { key: 'colors', label: 'Colors' },+ {+ key: 'predominant',+ label: 'Predominant',+ children: [+ { key: 'google', label: 'Google' },+ { key: 'cloudinary', label: 'Cloudinary' },+ ],+ },+ { key: 'pages', label: 'Pages', format: 'number' },+ { key: 'usage', label: 'Usage' },+ { key: 'etag', label: 'Etag' },+ ],+};++export const cloudinaryGetResourceByAssetIdOutputSchema: OutputSchema = {+ fields: [+ { key: 'asset_id', label: 'Asset ID' },+ { key: 'public_id', label: 'Public ID' },+ { key: 'format', label: 'Format' },+ { key: 'version', label: 'Version', format: 'number' },+ { key: 'resource_type', label: 'Resource Type' },+ { key: 'type', label: 'Type' },+ { key: 'created_at', label: 'Created At', format: 'datetime' },+ { key: 'bytes', label: 'Bytes', format: 'number' },+ { key: 'width', label: 'Width', format: 'number' },+ { key: 'height', label: 'Height', format: 'number' },+ { key: 'asset_folder', label: 'Asset Folder' },+ { key: 'display_name', label: 'Display Name' },+ { key: 'url', label: 'URL', format: 'image' },+ { key: 'secure_url', label: 'Secure URL', format: 'image' },+ {+ key: 'context',+ label: 'Context',+ children: [+ {+ key: 'custom',+ label: 'Custom',+ dynamicKey: true,+ },+ ],+ },+ { key: 'last_updated', label: 'Last Updated' },+ { key: 'tags', label: 'Tags' },+ { key: 'next_cursor', label: 'Next Cursor' },+ { key: 'derived', label: 'Derived' },+ ],+};++export const cloudinaryListResourcesOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'resources',+ label: 'Resources',+ labelKey: 'display_name',+ listItems: [+ { key: 'asset_id', label: 'Asset ID' },+ { key: 'public_id', label: 'Public ID' },+ { key: 'format', label: 'Format' },+ { key: 'version', label: 'Version', format: 'number' },+ { key: 'resource_type', label: 'Resource Type' },+ { key: 'type', label: 'Type' },+ { key: 'created_at', label: 'Created At', format: 'datetime' },+ { key: 'bytes', label: 'Bytes', format: 'number' },+ { key: 'width', label: 'Width', format: 'number' },+ { key: 'height', label: 'Height', format: 'number' },+ { key: 'asset_folder', label: 'Asset Folder' },+ { key: 'display_name', label: 'Display Name' },+ { key: 'url', label: 'URL', format: 'image' },+ { key: 'secure_url', label: 'Secure URL', format: 'image' },+ { key: 'tags', label: 'Tags' },+ ],+ },+ { key: 'count', label: 'Count', format: 'number' },+ { key: 'total_count', label: 'Total Count' },+ { key: 'next_cursor', label: 'Next Cursor' },+ ],+};++export const cloudinaryListResourcesByAssetIdsOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'resources',+ label: 'Resources',+ labelKey: 'display_name',+ listItems: [+ { key: 'asset_id', label: 'Asset ID' },+ { key: 'public_id', label: 'Public ID' },+ { key: 'format', label: 'Format' },+ { key: 'version', label: 'Version', format: 'number' },+ { key: 'resource_type', label: 'Resource Type' },+ { key: 'type', label: 'Type' },+ { key: 'created_at', label: 'Created At', format: 'datetime' },+ { key: 'bytes', label: 'Bytes', format: 'number' },+ { key: 'width', label: 'Width', format: 'number' },+ { key: 'height', label: 'Height', format: 'number' },+ { key: 'asset_folder', label: 'Asset Folder' },+ { key: 'display_name', label: 'Display Name' },+ { key: 'url', label: 'URL', format: 'image' },+ { key: 'secure_url', label: 'Secure URL', format: 'image' },+ {+ key: 'context',+ label: 'Context',+ children: [+ {+ key: 'custom',+ label: 'Custom',+ dynamicKey: true,+ },+ ],+ },+ { key: 'last_updated', label: 'Last Updated' },+ ],+ },+ { key: 'count', label: 'Count', format: 'number' },+ { key: 'total_count', label: 'Total Count' },+ { key: 'next_cursor', label: 'Next Cursor' },+ ],+};++export const cloudinaryListResourcesByAssetFolderOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'resources',+ label: 'Resources',+ labelKey: 'display_name',+ listItems: [+ { key: 'asset_id', label: 'Asset ID' },+ { key: 'public_id', label: 'Public ID' },+ { key: 'format', label: 'Format' },+ { key: 'version', label: 'Version', format: 'number' },+ { key: 'resource_type', label: 'Resource Type' },+ { key: 'type', label: 'Type' },+ { key: 'created_at', label: 'Created At', format: 'datetime' },+ { key: 'bytes', label: 'Bytes', format: 'number' },+ { key: 'width', label: 'Width', format: 'number' },+ { key: 'height', label: 'Height', format: 'number' },+ { key: 'asset_folder', label: 'Asset Folder' },+ { key: 'display_name', label: 'Display Name' },+ { key: 'url', label: 'URL', format: 'image' },+ { key: 'secure_url', label: 'Secure URL', format: 'image' },+ {+ key: 'context',+ label: 'Context',+ children: [+ {+ key: 'custom',+ label: 'Custom',+ dynamicKey: true,+ },+ ],+ },+ { key: 'last_updated', label: 'Last Updated' },+ ],+ },+ { key: 'count', label: 'Count', format: 'number' },+ { key: 'total_count', label: 'Total Count', format: 'number' },+ { key: 'next_cursor', label: 'Next Cursor' },+ ],+};++export const cloudinaryListResourcesInModerationOutputSchema: OutputSchema = {+ fields: [+ { key: 'resources', label: 'Resources' },+ { key: 'count', label: 'Count', format: 'number' },+ { key: 'total_count', label: 'Total Count' },+ { key: 'next_cursor', label: 'Next Cursor' },+ ],+};++export const cloudinaryCreateMetadataFieldOutputSchema: OutputSchema = {+ fields: [+ { key: 'type', label: 'Type' },+ { key: 'external_id', label: 'External ID' },+ { key: 'label', label: 'Label' },+ { key: 'mandatory', label: 'Mandatory', format: 'boolean' },+ { key: 'default_value', label: 'Default Value' },+ { key: 'validation', label: 'Validation' },+ { key: 'default_disabled', label: 'Default Disabled', format: 'boolean' },+ {+ key: 'restrictions',+ label: 'Restrictions',+ children: [+ { key: 'readonly_ui', label: 'Readonly Ui', format: 'boolean' },+ { key: 'hidden_ui', label: 'Hidden Ui', format: 'boolean' },+ { key: 'excluded_from_search', label: 'Excluded From Search', format: 'boolean' },+ ],+ },+ { key: 'group', label: 'Group' },+ {+ key: 'datasource',+ label: 'Datasource',+ children: [+ {+ key: 'values',+ label: 'Values',+ listItems: [+ { key: 'external_id', label: 'External ID' },+ { key: 'value', label: 'Value' },+ { key: 'state', label: 'State' },+ ],+ },+ ],+ },+ { key: 'lazy_datasource_update', label: 'Lazy Datasource Update', format: 'boolean' },+ { key: 'allow_dynamic_list_values', label: 'Allow Dynamic List Values', format: 'boolean' },+ { key: 'alphabetically_sorted', label: 'Alphabetically Sorted', format: 'boolean' },+ ],+};++export const cloudinaryGetMetadataFieldOutputSchema: OutputSchema = cloudinaryCreateMetadataFieldOutputSchema;++export const cloudinaryListMetadataFieldsOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'metadata_fields',+ label: 'Metadata Fields',+ labelKey: 'label',+ listItems: [+ { key: 'type', label: 'Type' },+ { key: 'external_id', label: 'External ID' },+ { key: 'label', label: 'Label' },+ { key: 'mandatory', label: 'Mandatory', format: 'boolean' },+ { key: 'default_value', label: 'Default Value' },+ { key: 'validation', label: 'Validation' },+ { key: 'default_disabled', label: 'Default Disabled', format: 'boolean' },+ {+ key: 'restrictions',+ label: 'Restrictions',+ children: [+ { key: 'readonly_ui', label: 'Readonly Ui', format: 'boolean' },+ { key: 'hidden_ui', label: 'Hidden Ui', format: 'boolean' },+ { key: 'excluded_from_search', label: 'Excluded From Search', format: 'boolean' },+ ],+ },+ { key: 'group', label: 'Group' },+ {+ key: 'datasource',+ label: 'Datasource',+ children: [+ {+ key: 'values',+ label: 'Values',+ listItems: [+ { key: 'external_id', label: 'External ID' },+ { key: 'value', label: 'Value' },+ { key: 'state', label: 'State' },+ ],+ },+ ],+ },+ { key: 'lazy_datasource_update', label: 'Lazy Datasource Update', format: 'boolean' },+ { key: 'allow_dynamic_list_values', label: 'Allow Dynamic List Values', format: 'boolean' },+ { key: 'alphabetically_sorted', label: 'Alphabetically Sorted', format: 'boolean' },+ ],+ },+ { key: 'count', label: 'Count', format: 'number' },+ ],+};++export const cloudinaryReorderMetadataFieldOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'metadata_fields',+ label: 'Metadata Fields',+ labelKey: 'label',+ listItems: [+ { key: 'type', label: 'Type' },+ { key: 'external_id', label: 'External ID' },+ { key: 'label', label: 'Label' },+ { key: 'mandatory', label: 'Mandatory', format: 'boolean' },+ { key: 'default_value', label: 'Default Value' },+ { key: 'validation', label: 'Validation' },+ { key: 'default_disabled', label: 'Default Disabled', format: 'boolean' },+ {+ key: 'restrictions',+ label: 'Restrictions',+ children: [+ { key: 'readonly_ui', label: 'Readonly Ui', format: 'boolean' },+ { key: 'hidden_ui', label: 'Hidden Ui', format: 'boolean' },+ { key: 'excluded_from_search', label: 'Excluded From Search', format: 'boolean' },+ ],+ },+ { key: 'group', label: 'Group' },+ {+ key: 'datasource',+ label: 'Datasource',+ children: [+ {+ key: 'values',+ label: 'Values',+ listItems: [+ { key: 'external_id', label: 'External ID' },+ { key: 'value', label: 'Value' },+ { key: 'state', label: 'State' },+ ],+ },+ ],+ },+ { key: 'lazy_datasource_update', label: 'Lazy Datasource Update', format: 'boolean' },+ { key: 'allow_dynamic_list_values', label: 'Allow Dynamic List Values', format: 'boolean' },+ { key: 'alphabetically_sorted', label: 'Alphabetically Sorted', format: 'boolean' },+ ],+ },+ ],+};++export const cloudinaryCreateMultiResourceOutputSchema: OutputSchema = {+ fields: [+ { key: 'url', label: 'URL', format: 'image' },+ { key: 'secure_url', label: 'Secure URL', format: 'image' },+ { key: 'asset_id', label: 'Asset ID' },+ { key: 'public_id', label: 'Public ID' },+ { key: 'version', label: 'Version', format: 'number' },+ ],+};++export const cloudinaryListUploadPresetsOutputSchema: OutputSchema = {+ fields: [+ { key: 'presets', label: 'Presets' },+ { key: 'count', label: 'Count', format: 'number' },+ { key: 'next_cursor', label: 'Next Cursor' },+ ],+};++export const cloudinaryAddRelatedAssetsOutputSchema: OutputSchema = {+ fields: [+ { key: 'failed', label: 'Failed' },+ {+ key: 'success',+ label: 'Success',+ listItems: [+ { key: 'message', label: 'Message' },+ { key: 'code', label: 'Code' },+ { key: 'asset', label: 'Asset' },+ { key: 'status', label: 'Status', format: 'number' },+ ],+ },+ ],+};++export const cloudinaryRenameResourceOutputSchema: OutputSchema = {+ fields: [+ { key: 'asset_id', label: 'Asset ID' },+ { key: 'public_id', label: 'Public ID' },+ { key: 'version', label: 'Version', format: 'number' },+ { key: 'version_id', label: 'Version ID' },+ { key: 'signature', label: 'Signature' },+ { key: 'width', label: 'Width', format: 'number' },+ { key: 'height', label: 'Height', format: 'number' },+ { key: 'format', label: 'Format' },+ { key: 'resource_type', label: 'Resource Type' },+ { key: 'created_at', label: 'Created At', format: 'datetime' },+ { key: 'tags', label: 'Tags' },+ { key: 'bytes', label: 'Bytes', format: 'number' },+ { key: 'type', label: 'Type' },+ { key: 'placeholder', label: 'Placeholder', format: 'boolean' },+ { key: 'url', label: 'URL', format: 'image' },+ { key: 'secure_url', label: 'Secure URL', format: 'image' },+ { key: 'asset_folder', label: 'Asset Folder' },+ { key: 'display_name', label: 'Display Name' },+ ],+};++export const cloudinarySearchAssetsOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'resources',+ label: 'Resources',+ labelKey: 'display_name',+ listItems: [+ { key: 'asset_id', label: 'Asset ID' },+ { key: 'public_id', label: 'Public ID' },+ { key: 'asset_folder', label: 'Asset Folder' },+ { key: 'filename', label: 'Filename' },+ { key: 'display_name', label: 'Display Name' },+ { key: 'format', label: 'Format' },+ { key: 'version', label: 'Version', format: 'number' },+ { key: 'resource_type', label: 'Resource Type' },+ { key: 'type', label: 'Type' },+ { key: 'created_at', label: 'Created At', format: 'datetime' },+ { key: 'uploaded_at', label: 'Uploaded At', format: 'datetime' },+ { key: 'bytes', label: 'Bytes', format: 'number' },+ { key: 'backup_bytes', label: 'Backup Bytes', format: 'number' },+ { key: 'width', label: 'Width', format: 'number' },+ { key: 'height', label: 'Height', format: 'number' },+ { key: 'aspect_ratio', label: 'Aspect Ratio', format: 'number' },+ { key: 'pixels', label: 'Pixels', format: 'number' },+ { key: 'tags', label: 'Tags' },+ { key: 'url', label: 'URL', format: 'image' },+ { key: 'secure_url', label: 'Secure URL', format: 'image' },+ { key: 'status', label: 'Status' },+ { key: 'access_mode', label: 'Access Mode' },+ { key: 'access_control', label: 'Access Control' },+ { key: 'etag', label: 'Etag' },+ {+ key: 'created_by',+ label: 'Created By',+ children: [+ { key: 'access_key', label: 'Access Key' },+ ],+ },+ {+ key: 'uploaded_by',+ label: 'Uploaded By',+ children: [+ { key: 'access_key', label: 'Access Key' },+ ],+ },+ ],+ },+ { key: 'count', label: 'Count', format: 'number' },+ { key: 'total_count', label: 'Total Count', format: 'number' },+ { key: 'next_cursor', label: 'Next Cursor' },+ ],+};++export const newResourceOutputSchema: OutputSchema = {+ fields: [+ { key: 'asset_id', label: 'Asset ID' },+ { key: 'public_id', label: 'Public ID' },+ { key: 'format', label: 'Format' },+ { key: 'version', label: 'Version', format: 'number' },+ { key: 'resource_type', label: 'Resource Type' },+ { key: 'type', label: 'Type' },+ { key: 'created_at', label: 'Created At', format: 'datetime' },+ { key: 'bytes', label: 'Bytes', format: 'number' },+ { key: 'width', label: 'Width', format: 'number' },+ { key: 'height', label: 'Height', format: 'number' },+ { key: 'asset_folder', label: 'Asset Folder' },+ { key: 'display_name', label: 'Display Name' },+ { key: 'url', label: 'URL', format: 'image' },+ { key: 'secure_url', label: 'Secure URL', format: 'image' },+ {+ key: 'context',+ label: 'Context',+ children: [+ {+ key: 'custom',+ label: 'Custom',+ dynamicKey: true,+ },+ ],+ },+ {+ key: 'last_updated',+ label: 'Last Updated',+ children: [+ { key: 'context_updated_at', label: 'Context Updated At', format: 'datetime' },+ { key: 'tags_updated_at', label: 'Tags Updated At', format: 'datetime' },+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },+ ],+ },+ ],+};++export const newTagAddedToAssetOutputSchema: OutputSchema = {+ fields: [+ { key: 'asset_id', label: 'Asset ID' },+ { key: 'public_id', label: 'Public ID' },+ { key: 'format', label: 'Format' },+ { key: 'version', label: 'Version', format: 'number' },+ { key: 'resource_type', label: 'Resource Type' },+ { key: 'type', label: 'Type' },+ { key: 'created_at', label: 'Created At', format: 'datetime' },+ { key: 'bytes', label: 'Bytes', format: 'number' },+ { key: 'width', label: 'Width', format: 'number' },+ { key: 'height', label: 'Height', format: 'number' },+ { key: 'asset_folder', label: 'Asset Folder' },+ { key: 'display_name', label: 'Display Name' },+ { key: 'url', label: 'URL', format: 'image' },+ { key: 'secure_url', label: 'Secure URL', format: 'image' },+ {+ key: 'last_updated',+ label: 'Last Updated',+ children: [+ { key: 'context_updated_at', label: 'Context Updated At', format: 'datetime' },+ { key: 'tags_updated_at', label: 'Tags Updated At', format: 'datetime' },+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },+ ],+ },+ { key: 'trigger_type', label: 'Trigger Type' },+ { key: 'tags_updated_at', label: 'Tags Updated At', format: 'datetime' },+ ],+};++export const cloudinaryListTagsOutputSchema: OutputSchema = {+ fields: [+ { key: 'tags', label: 'Tags' },+ { key: 'count', label: 'Count', format: 'number' },+ { key: 'next_cursor', label: 'Next Cursor' },+ ],+};++export const cloudinaryCreateImageFromTextOutputSchema: OutputSchema = {+ fields: [+ { key: 'asset_id', label: 'Asset ID' },+ { key: 'public_id', label: 'Public ID' },+ { key: 'version', label: 'Version', format: 'number' },+ { key: 'version_id', label: 'Version ID' },+ { key: 'signature', label: 'Signature' },+ { key: 'width', label: 'Width', format: 'number' },+ { key: 'height', label: 'Height', format: 'number' },+ { key: 'format', label: 'Format' },+ { key: 'resource_type', label: 'Resource Type' },+ { key: 'created_at', label: 'Created At', format: 'datetime' },+ { key: 'tags', label: 'Tags' },+ { key: 'bytes', label: 'Bytes', format: 'number' },+ { key: 'type', label: 'Type' },+ { key: 'etag', label: 'Etag' },+ { key: 'placeholder', label: 'Placeholder', format: 'boolean' },+ { key: 'url', label: 'URL', format: 'image' },+ { key: 'secure_url', label: 'Secure URL', format: 'image' },+ { key: 'asset_folder', label: 'Asset Folder' },+ { key: 'display_name', label: 'Display Name' },+ ],+};++export const cloudinaryGetTransformationOutputSchema: OutputSchema = {+ fields: [+ { key: 'name', label: 'Name' },+ { key: 'allowed_for_strict', label: 'Allowed For Strict', format: 'boolean' },+ { key: 'used', label: 'Used', format: 'boolean' },+ { key: 'named', label: 'Named', format: 'boolean' },+ {+ key: 'info',+ label: 'Info',+ listItems: [+ { key: 'width', label: 'Width', format: 'number' },+ { key: 'height', label: 'Height', format: 'number' },+ { key: 'crop', label: 'Crop' },+ ],+ },+ { key: 'derived', label: 'Derived' },+ ],+};++export const cloudinaryListTransformationsOutputSchema: OutputSchema = {+ fields: [+ {+ key: 'transformations',+ label: 'Transformations',+ labelKey: 'name',+ listItems: [+ { key: 'name', label: 'Name' },+ { key: 'allowed_for_strict', label: 'Allowed For Strict', format: 'boolean' },+ { key: 'used', label: 'Used', format: 'boolean' },+ { key: 'named', label: 'Named', format: 'boolean' },+ ],+ },+ { key: 'count', label: 'Count', format: 'number' },+ { key: 'next_cursor', label: 'Next Cursor' },+ ],+};++export const transformresourceOutputSchema: OutputSchema = {+ fields: [+ { key: 'transformation_url', label: 'Transformation URL', format: 'url' },+ { key: 'public_id', label: 'Public ID' },+ { key: 'resource_type', label: 'Resource Type' },+ { key: 'applied_transformations', label: 'Applied Transformations' },+ { key: 'cloud_name', label: 'Cloud Name' },+ ],+};++export const cloudinaryListResourceTypesOutputSchema: OutputSchema = {+ fields: [+ { key: 'resource_types', label: 'Resource Types' },+ { key: 'count', label: 'Count', format: 'number' },+ ],+};++export const cloudinaryUploadAssetOutputSchema: OutputSchema = {+ fields: [+ { key: 'asset_id', label: 'Asset ID' },+ { key: 'public_id', label: 'Public ID' },+ { key: 'version', label: 'Version', format: 'number' },+ { key: 'version_id', label: 'Version ID' },+ { key: 'signature', label: 'Signature' },+ { key: 'width', label: 'Width', format: 'number' },+ { key: 'height', label: 'Height', format: 'number' },+ { key: 'format', label: 'Format' },+ { key: 'resource_type', label: 'Resource Type' },+ { key: 'created_at', label: 'Created At', format: 'datetime' },+ { key: 'tags', label: 'Tags' },+ { key: 'bytes', label: 'Bytes', format: 'number' },+ { key: 'type', label: 'Type' },+ { key: 'etag', label: 'Etag' },+ { key: 'placeholder', label: 'Placeholder', format: 'boolean' },+ { key: 'url', label: 'URL', format: 'image' },+ { key: 'secure_url', label: 'Secure URL', format: 'image' },+ { key: 'asset_folder', label: 'Asset Folder' },+ { key: 'display_name', label: 'Display Name' },+ {+ key: 'context',+ label: 'Context',+ children: [+ {+ key: 'custom',+ label: 'Custom',+ dynamicKey: true,+ },+ ],+ },+ { key: 'pages', label: 'Pages', format: 'number' },+ { key: 'playback_url', label: 'Playback URL', format: 'url' },+ {+ key: 'audio',+ label: 'Audio',+ children: [+ { key: 'codec', label: 'Codec' },+ { key: 'bit_rate', label: 'Bit Rate' },+ { key: 'frequency', label: 'Frequency', format: 'number' },+ { key: 'channels', label: 'Channels', format: 'number' },+ { key: 'channel_layout', label: 'Channel Layout' },+ ],+ },+ {+ key: 'video',+ label: 'Video',+ children: [+ { key: 'pix_format', label: 'Pix Format' },+ { key: 'codec', label: 'Codec' },+ { key: 'level', label: 'Level', format: 'number' },+ { key: 'profile', label: 'Profile' },+ { key: 'bit_rate', label: 'Bit Rate' },+ { key: 'dar', label: 'Dar' },+ { key: 'time_base', label: 'Time Base' },+ ],+ },+ { key: 'is_audio', label: 'Is Audio', format: 'boolean' },+ { key: 'frame_rate', label: 'Frame Rate', format: 'number' },+ { key: 'bit_rate', label: 'Bit Rate', format: 'number' },+ { key: 'duration', label: 'Duration', format: 'number' },+ { key: 'rotation', label: 'Rotation', format: 'number' },+ { key: 'nb_frames', label: 'Nb Frames', format: 'number' },+ { key: 'original_filename', label: 'Original Filename' },+ ],+};++export const cloudinaryUpdateResourceOutputSchema: OutputSchema = {+ fields: [+ { key: 'asset_id', label: 'Asset ID' },+ { key: 'public_id', label: 'Public ID' },+ { key: 'format', label: 'Format' },+ { key: 'version', label: 'Version', format: 'number' },+ { key: 'resource_type', label: 'Resource Type' },+ { key: 'type', label: 'Type' },+ { key: 'created_at', label: 'Created At', format: 'datetime' },+ { key: 'bytes', label: 'Bytes', format: 'number' },+ { key: 'width', label: 'Width', format: 'number' },+ { key: 'height', label: 'Height', format: 'number' },+ { key: 'asset_folder', label: 'Asset Folder' },+ { key: 'display_name', label: 'Display Name' },+ { key: 'url', label: 'URL', format: 'image' },+ { key: 'secure_url', label: 'Secure URL', format: 'image' },+ {+ key: 'context',+ label: 'Context',+ children: [+ {+ key: 'custom',+ label: 'Custom',+ dynamicKey: true,+ },+ ],+ },+ { key: 'last_updated', label: 'Last Updated' },+ { key: 'tags', label: 'Tags' },+ ],+};++export const cloudinaryGetUsageOutputSchema: OutputSchema = {+ fields: [+ { key: 'plan', label: 'Plan' },+ { key: 'last_updated', label: 'Last Updated', format: 'date' },+ { key: 'date_requested', label: 'Date Requested', format: 'datetime' },+ {+ key: 'transformations',+ label: 'Transformations',+ children: [+ { key: 'usage', label: 'Usage', format: 'number' },+ { key: 'credits_usage', label: 'Credits Usage', format: 'number' },+ {+ key: 'breakdown',+ label: 'Breakdown',+ children: [+ { key: 'transformation', label: 'Transformation', format: 'number' },+ ],+ },+ ],+ },+ {+ key: 'objects',+ label: 'Objects',+ children: [+ { key: 'usage', label: 'Usage', format: 'number' },+ ],+ },+ {+ key: 'bandwidth',+ label: 'Bandwidth',+ children: [+ { key: 'usage', label: 'Usage', format: 'number' },+ { key: 'credits_usage', label: 'Credits Usage', format: 'number' },+ ],+ },+ {+ key: 'storage',+ label: 'Storage',+ children: [+ { key: 'usage', label: 'Usage', format: 'number' },+ { key: 'credits_usage', label: 'Credits Usage', format: 'number' },+ ],+ },+ {+ key: 'impressions',+ label: 'Impressions',+ children: [+ { key: 'usage', label: 'Usage', format: 'number' },+ { key: 'credits_usage', label: 'Credits Usage', format: 'number' },+ ],+ },+ {+ key: 'seconds_delivered',+ label: 'Seconds Delivered',+ children: [+ { key: 'usage', label: 'Usage', format: 'number' },+ { key: 'credits_usage', label: 'Credits Usage', format: 'number' },+ ],+ },+ {+ key: 'credits',+ label: 'Credits',+ children: [+ { key: 'usage', label: 'Usage', format: 'number' },+ { key: 'limit', label: 'Limit', format: 'number' },+ { key: 'used_percent', label: 'Used Percent', format: 'number' },+ ],+ },+ { key: 'resources', label: 'Resources', format: 'number' },+ { key: 'derived_resources', label: 'Derived Resources', format: 'number' },+ { key: 'requests', label: 'Requests', format: 'number' },+ {+ key: 'media_limits',+ label: 'Media Limits',+ children: [+ { key: 'image_max_size_bytes', label: 'Image Max Size Bytes', format: 'number' },+ { key: 'video_max_size_bytes', label: 'Video Max Size Bytes', format: 'number' },+ { key: 'raw_max_size_bytes', label: 'Raw Max Size Bytes', format: 'number' },+ { key: 'image_max_px', label: 'Image Max Px', format: 'number' },+ { key: 'asset_max_total_px', label: 'Asset Max Total Px', format: 'number' },+ ],+ },+ ],+};++export const cloudinaryGetVideoViewsOutputSchema: OutputSchema = {+ fields: [+ { key: 'views', label: 'Views' },+ { key: 'count', label: 'Count', format: 'number' },+ { key: 'next_cursor', label: 'Next Cursor' },+ ],+};++export const cloudinaryGetUploadPresetOutputSchema: OutputSchema = {+ fields: [+ { key: 'name', label: 'Name' },+ { key: 'unsigned', label: 'Unsigned', format: 'boolean' },+ {+ key: 'settings',+ label: 'Settings',+ children: [+ { key: 'asset_folder', label: 'Asset Folder' },+ { key: 'folder', label: 'Folder' },+ { key: 'tags', label: 'Tags' },+ { key: 'resource_type', label: 'Resource Type' },+ { key: 'type', label: 'Type' },+ { key: 'use_filename', label: 'Use Filename', format: 'boolean' },+ { key: 'unique_filename', label: 'Unique Filename', format: 'boolean' },+ { key: 'overwrite', label: 'Overwrite', format: 'boolean' },+ { key: 'invalidate', label: 'Invalidate', format: 'boolean' },+ { key: 'allowed_formats', label: 'Allowed Formats' },+ { key: 'moderation', label: 'Moderation' },+ { key: 'notification_url', label: 'Notification URL', format: 'url' },+ { key: 'eager', label: 'Eager Transformations' },+ { key: 'transformation', label: 'Transformation' },+ ],+ },+ ],+};diff --git a/packages/pieces/community/cloudinary/src/lib/triggers/new-resource.ts b/packages/pieces/community/cloudinary/src/lib/triggers/new-resource.tsindex f4241d00d03..cc2b64fd3d5 100644--- a/packages/pieces/community/cloudinary/src/lib/triggers/new-resource.ts+++ b/packages/pieces/community/cloudinary/src/lib/triggers/new-resource.ts@@ -16,6 +16,7 @@ import {import { cloudinaryAuth } from '../common/auth';import { makeRequest } from '../common/client';import dayjs from 'dayjs';+import { newResourceOutputSchema } from '../output-schemas';const props = {asset_folder: Property.ShortText({@@ -46,6 +47,7 @@ const polling: Polling<AppConnectionValueForAuthProperty<typeof cloudinaryAuth>,export const newResourceInFolder = createTrigger({auth: cloudinaryAuth,name: 'new_resource',+ outputSchema: newResourceOutputSchema,classification: 'READ',displayName: 'New Resource',description: 'Triggers when a new image, video, or file is uploaded to a specific folder or account in Cloudinary.',diff --git a/packages/pieces/community/cloudinary/src/lib/triggers/new-tag-added-to-asset.ts b/packages/pieces/community/cloudinary/src/lib/triggers/new-tag-added-to-asset.tsindex 829bba4c5fc..bbbf8d277c8 100644--- a/packages/pieces/community/cloudinary/src/lib/triggers/new-tag-added-to-asset.ts+++ b/packages/pieces/community/cloudinary/src/lib/triggers/new-tag-added-to-asset.ts@@ -16,6 +16,7 @@ import {import { cloudinaryAuth } from '../common/auth';import { makeRequest } from '../common/client';import dayjs from 'dayjs';+import { newTagAddedToAssetOutputSchema } from '../output-schemas';const props = {resource_type: Property.StaticDropdown({@@ -77,6 +78,7 @@ const polling: Polling<AppConnectionValueForAuthProperty<typeof cloudinaryAuth>,export const newTagAddedToAsset = createTrigger({auth: cloudinaryAuth,name: 'new_tag_added_to_asset',+ outputSchema: newTagAddedToAssetOutputSchema,classification: 'READ',displayName: 'New Tag Added to Asset',description: 'Triggers when a tag is added to an asset in Cloudinary.',