UNPKG

@mseep/ableton-copilot-mcp

Version:
69 lines 1.84 kB
import { Track } from 'ableton-js/ns/track.js'; import { Clip } from 'ableton-js/ns/clip.js'; import { ableton } from '../ableton.js'; export function modifyObjProps(obj, property, zodSchema) { const promiseArray = []; const schema = zodSchema.shape; for (const key of Object.keys(property)) { const typedKey = key; if (!Object.keys(schema).includes(typedKey)) { continue; } const value = property[typedKey]; if (value !== undefined) { promiseArray.push(obj.set(typedKey, value)); } } return Promise.allSettled(promiseArray); } export function getObjProps(obj, zodSchema) { const promiseArray = []; const result = {}; for (const key of Object.keys(zodSchema.shape)) { promiseArray.push(obj.get(key).then((value) => { result[key] = value; })); } return Promise.allSettled(promiseArray).then(() => { return result; }); } export function getRawTrackById(trackId) { return { id: trackId, name: '', color: 0, color_index: 0, is_foldable: false, is_grouped: false, mute: false, solo: false, }; } export function getTrackById(trackId) { const rawTrack = getRawTrackById(trackId); return new Track(ableton, rawTrack); } export function getRawClipById(clipId) { return { id: clipId, name: '', color: 0, color_index: 0, is_audio_clip: false, is_midi_clip: false, start_time: 0, end_time: 0, muted: false, }; } export function getClipById(clipId) { const rawClip = getRawClipById(clipId); return new Clip(ableton, rawClip); } export class Result { static ok() { return 'ok'; } } //# sourceMappingURL=common.js.map