export type CreateApiTransformGroupTransformGroupIdTransformArgs = {transform_group_id: string, body: {type: 'filter' | 'sample' | 'drop-fields' | 'parse' | 'parse-sequentially' | 'route' | 'stringify' | 'compact-fields' | 'flatten-fields' | 'dedupe' | 'encrypt-fields' | 'decrypt-fields' | 'js-script' | 'unroll' | 'vrl' | 'reduce' | 'map-fields' | 'metrics-tag-cardinality-limit' | 'aggregate' | 'event-to-metric' | 'clustering' | 'redact' | 'throttle' | 'set-timestamp' | 'data-profiler' | 'replace' | 'trace-sampling', deploy_type?: ('saas' | 'local') | undefined, title: string, description?: (string | null) | undefined, user_config: Record, inputs?: Array | undefined}}; export type CreateApiTransformGroupTransformGroupIdTransformOptions = {baseUrl?: string | undefined, PipelineServiceKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create a Processor in a Processor Group * * POST /transform-group/{transform_group_id}/transform */ export const createApiTransformGroupTransformGroupIdTransform = async (args: CreateApiTransformGroupTransformGroupIdTransformArgs, options?: CreateApiTransformGroupTransformGroupIdTransformOptions) => { const {baseUrl = "https://api.mezmo.com/v3", fetch: fetchFn = fetch, PipelineServiceKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (PipelineServiceKey !== undefined) headers.set("Authorization", PipelineServiceKey) const url = `${baseUrl.replace(/\/+$/, '')}/transform-group/${encodeURIComponent(String(args.transform_group_id))}/transform${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };