- 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>
40 lines
1.4 KiB
TypeScript
40 lines
1.4 KiB
TypeScript
import { ElevenLabsClient } from '@elevenlabs/elevenlabs-js';
|
|
import { ElevenLabsEnvironment } from '@elevenlabs/elevenlabs-js/environments';
|
|
import { AppConnectionValueForAuthProperty } from '@activepieces/pieces-framework';
|
|
import { elevenlabsAuth } from '..';
|
|
|
|
export type ElevenResidency = 'default' | 'us' | 'eu';
|
|
|
|
export interface ExtendedReadableStream<R> extends ReadableStream {
|
|
[Symbol.asyncIterator](): AsyncIterableIterator<R>;
|
|
}
|
|
|
|
|
|
|
|
export const ELEVEN_RESIDENCY: Record<ElevenResidency, ElevenLabsEnvironment> = {
|
|
default: ElevenLabsEnvironment.Production,
|
|
us: ElevenLabsEnvironment.ProductionUs,
|
|
eu: ElevenLabsEnvironment.ProductionEu,
|
|
};
|
|
|
|
// get API key with backward compatibility:
|
|
// new format is object { apiKey: '', region: '' }
|
|
// old format is a secret that is deserealised as an object
|
|
export const getApiKey = (auth: AppConnectionValueForAuthProperty<typeof elevenlabsAuth> | string): string => {
|
|
if (typeof auth === 'string') {
|
|
return auth;
|
|
}
|
|
return auth?.props.apiKey ?? Object.values(auth.props).join('');
|
|
}
|
|
|
|
export const getRegionApiUrl = (region?: ElevenResidency) => {
|
|
return ELEVEN_RESIDENCY[region ?? 'default'].base;
|
|
}
|
|
|
|
export const createClient = (auth: AppConnectionValueForAuthProperty<typeof elevenlabsAuth>) => {
|
|
return new ElevenLabsClient({
|
|
apiKey: `${getApiKey(auth)}`,
|
|
environment: ELEVEN_RESIDENCY[auth.props.region ?? 'default'],
|
|
});
|
|
}
|