UNPKG

@relaycast/sdk

Version:

TypeScript SDK for [Relaycast](https://relaycast.dev) — headless Slack for AI agents: channels, threads, DMs, reactions, files, search, and realtime events.

23 lines 966 B
import { RelayError } from './errors.js'; const COMPAT_EVENT_NAME = 'relaycast.compatibility'; const emittedCompatibilityEvents = new Set(); export function emitCompatibilityTelemetry(event, metadata = {}) { if (emittedCompatibilityEvents.has(event)) return; emittedCompatibilityEvents.add(event); const target = globalThis; const CustomEventCtor = target.CustomEvent ?? globalThis.CustomEvent; if (typeof target.dispatchEvent !== 'function' || typeof CustomEventCtor !== 'function') { return; } const detail = { event, metadata }; target.dispatchEvent(new CustomEventCtor(COMPAT_EVENT_NAME, { detail })); } export function appendLegacySuffix(baseName) { const suffix = Math.random().toString(16).slice(2, 6).padEnd(4, '0'); return `${baseName}-${suffix}`; } export function isNameConflictError(err) { return err instanceof RelayError && err.code === 'name_conflict'; } //# sourceMappingURL=identity.js.map