Files
smoothschedule/activepieces-fork/packages/shared/src/lib/common/utils/assertions.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

55 lines
1.3 KiB
TypeScript

export function assertEqual<T>(
actual: T,
expected: T,
fieldName1: string,
fieldName2: string,
): asserts actual is T {
if (actual !== expected) {
throw new Error(`${fieldName1} and ${fieldName2} should be equal`)
}
}
export function assertNotNullOrUndefined<T>(
value: T | null | undefined,
fieldName: string,
): asserts value is T {
if (value === null || value === undefined) {
throw new Error(`${fieldName} is null or undefined`)
}
}
export function assertNotEqual<T>(
value1: T,
value2: T,
fieldName1: string,
fieldName2: string,
): void {
if (value1 === value2) {
throw new Error(`${fieldName1} and ${fieldName2} should not be equal`)
}
}
export const isNotUndefined = <T>(value: T | undefined): value is T => {
return value !== undefined
}
export function assertNull<T>(
value: T | null,
fieldName: string,
): asserts value is T {
if (value !== null) {
throw new Error(`${fieldName} should be null`)
}
}
export function asserNotEmpty<T>(
value: T[] | null | undefined,
fieldName: string,
): asserts value is T[] {
assertNotNullOrUndefined(value, fieldName)
if (value.length === 0) {
throw new Error(`${fieldName} should be not empty`)
}
}