Files
smoothschedule/activepieces-fork/packages/pieces/community/totalcms/src/lib/auth.ts
poduck 3aa7199503 Add Activepieces integration for workflow automation
- Add Activepieces fork with SmoothSchedule custom piece
- Create integrations app with Activepieces service layer
- Add embed token endpoint for iframe integration
- Create Automations page with embedded workflow builder
- Add sidebar visibility fix for embed mode
- Add list inactive customers endpoint to Public API
- Include SmoothSchedule triggers: event created/updated/cancelled
- Include SmoothSchedule actions: create/update/cancel events, list resources/services/customers

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 22:59:37 -05:00

46 lines
1.3 KiB
TypeScript

import { AppConnectionValueForAuthProperty, PieceAuth, Property } from '@activepieces/pieces-framework';
import { z } from 'zod';
import { propsValidation } from '@activepieces/pieces-common';
import { saveContent } from './api';
import { AppConnectionType } from '@activepieces/shared';
export type TotalCMSAuthType = AppConnectionValueForAuthProperty<typeof cmsAuth>;
export const cmsAuth = PieceAuth.CustomAuth({
description: 'Setup your Total CMS connection',
props: {
domain: Property.ShortText({
displayName: 'Total CMS Domain',
description: 'The domain of your Total CMS website',
required: true,
}),
license: PieceAuth.SecretText({
displayName: 'License Key',
description: 'The License key for your Total CMS domain',
required: true,
}),
},
required: true,
async validate({ auth }) {
await propsValidation.validateZod(auth, {
domain: z.string().url(),
license: z.string(),
});
const response = await saveContent({
type: AppConnectionType.CUSTOM_AUTH,
props: auth,
}, 'text', 'activepieces', {
text: 'verified',
});
if (response.success !== true) {
throw new Error(
'Authentication failed. Please check your domain and license key and try again.'
);
}
return {
valid: true,
};
},
});