The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/apps/meteor/app/integrations/server/lib/definition.ts

24 lines
870 B

import type { IIntegration, IOutgoingIntegration } from '@rocket.chat/core-typings';
export interface IScriptClass {
prepare_outgoing_request?: (params: Record<string, any>) => any;
process_outgoing_response?: (params: Record<string, any>) => any;
process_incoming_request?: (params: Record<string, any>) => any;
}
export type FullScriptClass = Required<IScriptClass>;
export type CompiledScript = {
script: Partial<IScriptClass>;
store: Record<string, any>;
_updatedAt: IIntegration['_updatedAt'];
};
export type CompatibilityScriptResult = IScriptClass & {
availableFunctions: (keyof IScriptClass)[];
};
export const isOutgoingIntegration = (
integration: Partial<IIntegration>,
): integration is IOutgoingIntegration & { type: 'webhook-outgoing' } =>
integration.type === 'webhook-outgoing' && 'event' in integration && integration.event !== undefined;