ableton-js
Advanced tools
Comparing version 3.5.0 to 3.6.0
@@ -7,4 +7,11 @@ ### Changelog | ||
#### [v3.6.0](https://github.com/leolabs/ableton.js/compare/v3.5.0...v3.6.0) | ||
- :label: Mark all raw object state as readonly [`ace0efd`](https://github.com/leolabs/ableton.js/commit/ace0efde39e5b598dd0a2878e0e29ecffedd495a) | ||
- :sparkles: Add options to override the caching mechanism [`85405d4`](https://github.com/leolabs/ableton.js/commit/85405d4be89bdc052f53bb862c5fe904620c554a) | ||
#### [v3.5.0](https://github.com/leolabs/ableton.js/compare/v3.4.6...v3.5.0) | ||
> 10 November 2024 | ||
- Feature: session highlighting with red ring [`#123`](https://github.com/leolabs/ableton.js/pull/123) | ||
@@ -11,0 +18,0 @@ - Update README to have correct start scripts [`#124`](https://github.com/leolabs/ableton.js/pull/124) |
@@ -86,2 +86,6 @@ import { EventEmitter } from "events"; | ||
/** | ||
* Completely disables the cache. | ||
*/ | ||
disableCache?: boolean; | ||
/** | ||
* Set this to allow ableton-js to log messages. If you set this to | ||
@@ -102,3 +106,3 @@ * `console`, log messages are printed to the standard output. | ||
private serverPort; | ||
cache: Cache; | ||
cache?: Cache; | ||
song: Song; | ||
@@ -105,0 +109,0 @@ session: Session; |
18
index.js
@@ -72,7 +72,9 @@ "use strict"; | ||
this.logger = options?.logger; | ||
this.cache = new lru_cache_1.default({ | ||
max: 500, | ||
ttl: 1000 * 60 * 10, | ||
...options?.cacheOptions, | ||
}); | ||
if (!options?.disableCache) { | ||
this.cache = new lru_cache_1.default({ | ||
max: 500, | ||
ttl: 1000 * 60 * 10, | ||
...options?.cacheOptions, | ||
}); | ||
} | ||
this.clientPortFile = path_1.default.join(os_1.default.tmpdir(), this.options?.clientPortFile ?? CLIENT_PORT_FILE); | ||
@@ -369,3 +371,3 @@ this.serverPortFile = path_1.default.join(os_1.default.tmpdir(), this.options?.serverPortFile ?? SERVER_PORT_FILE); | ||
const cacheKey = [command.ns, command.nsid, args].filter(Boolean).join("/"); | ||
const cached = this.cache.get(cacheKey); | ||
const cached = this.cache?.get(cacheKey); | ||
const result = await this.sendCommand({ | ||
@@ -386,3 +388,3 @@ ...command, | ||
if (result.etag) { | ||
this.cache.set(cacheKey, result); | ||
this.cache?.set(cacheKey, result); | ||
} | ||
@@ -394,3 +396,3 @@ return result.data; | ||
const params = { ns, nsid, name: "get_prop", args: { prop } }; | ||
if (cache) { | ||
if (cache && this.cache) { | ||
return this.sendCachedCommand(params); | ||
@@ -397,0 +399,0 @@ } |
import { Ableton } from ".."; | ||
import { Namespace } from "."; | ||
export interface RawBrowserItem { | ||
id: string; | ||
children: RawBrowserItem[]; | ||
name: string; | ||
is_loadable: boolean; | ||
is_selected: boolean; | ||
is_device: boolean; | ||
is_folder: boolean; | ||
source: string; | ||
uri: string; | ||
} | ||
export interface GettableProperties { | ||
@@ -31,2 +20,13 @@ children: RawBrowserItem[]; | ||
} | ||
export interface RawBrowserItem { | ||
readonly id: string; | ||
readonly children: RawBrowserItem[]; | ||
readonly name: string; | ||
readonly is_loadable: boolean; | ||
readonly is_selected: boolean; | ||
readonly is_device: boolean; | ||
readonly is_folder: boolean; | ||
readonly source: string; | ||
readonly uri: string; | ||
} | ||
export declare class BrowserItem extends Namespace<GettableProperties, TransformedProperties, SettableProperties, ObservableProperties> { | ||
@@ -33,0 +33,0 @@ raw: RawBrowserItem; |
@@ -45,3 +45,3 @@ import { Ableton } from ".."; | ||
export interface RawBrowser { | ||
id: string; | ||
readonly id: string; | ||
} | ||
@@ -48,0 +48,0 @@ export declare class Browser extends Namespace<GettableProperties, TransformedProperties, SettableProperties, ObservableProperties> { |
@@ -42,8 +42,8 @@ import { Ableton } from ".."; | ||
export interface RawClipSlot { | ||
id: string; | ||
color: number; | ||
has_clip: boolean; | ||
is_playing: boolean; | ||
is_recording: boolean; | ||
is_triggered: boolean; | ||
readonly id: string; | ||
readonly color: number; | ||
readonly has_clip: boolean; | ||
readonly is_playing: boolean; | ||
readonly is_recording: boolean; | ||
readonly is_triggered: boolean; | ||
} | ||
@@ -50,0 +50,0 @@ /** |
@@ -138,11 +138,11 @@ import { Ableton } from ".."; | ||
export interface RawClip { | ||
id: string; | ||
name: string; | ||
color: number; | ||
color_index: number; | ||
is_audio_clip: boolean; | ||
is_midi_clip: boolean; | ||
start_time: number; | ||
end_time: number; | ||
muted: boolean; | ||
readonly id: string; | ||
readonly name: string; | ||
readonly color: number; | ||
readonly color_index: number; | ||
readonly is_audio_clip: boolean; | ||
readonly is_midi_clip: boolean; | ||
readonly start_time: number; | ||
readonly end_time: number; | ||
readonly muted: boolean; | ||
} | ||
@@ -149,0 +149,0 @@ /** |
@@ -16,5 +16,5 @@ import { Ableton } from ".."; | ||
export interface RawCuePoint { | ||
id: string; | ||
name: string; | ||
time: number; | ||
readonly id: string; | ||
readonly name: string; | ||
readonly time: number; | ||
} | ||
@@ -21,0 +21,0 @@ export declare class CuePoint extends Namespace<GettableProperties, TransformedProperties, SettableProperties, ObservableProperties> { |
@@ -28,6 +28,6 @@ import { Ableton } from ".."; | ||
export interface RawDeviceParameter { | ||
id: string; | ||
name: string; | ||
value: number; | ||
is_quantized: boolean; | ||
readonly id: string; | ||
readonly name: string; | ||
readonly value: number; | ||
readonly is_quantized: boolean; | ||
} | ||
@@ -34,0 +34,0 @@ export declare enum AutomationState { |
@@ -26,6 +26,6 @@ import { Ableton } from ".."; | ||
export interface RawDevice { | ||
id: string; | ||
name: string; | ||
type: DeviceType; | ||
class_name: string; | ||
readonly id: string; | ||
readonly name: string; | ||
readonly type: DeviceType; | ||
readonly class_name: string; | ||
} | ||
@@ -32,0 +32,0 @@ export declare enum DeviceType { |
@@ -13,3 +13,3 @@ import { Ableton } from ".."; | ||
constructor(ableton: Ableton, ns: string, nsid?: string | undefined); | ||
get<T extends keyof GP>(prop: T): Promise<T extends keyof TP ? TP[T] : GP[T]>; | ||
get<T extends keyof GP>(prop: T, useCache?: boolean): Promise<T extends keyof TP ? TP[T] : GP[T]>; | ||
set<T extends keyof SP>(prop: T, value: SP[T]): Promise<null>; | ||
@@ -16,0 +16,0 @@ addListener<T extends keyof OP>(prop: T, listener: (data: T extends keyof TP ? TP[T] : OP[T]) => any): Promise<() => Promise<boolean | undefined>>; |
@@ -15,4 +15,4 @@ "use strict"; | ||
} | ||
async get(prop) { | ||
const cache = !!this.cachedProps[prop]; | ||
async get(prop, useCache) { | ||
const cache = useCache ?? !!this.cachedProps[prop]; | ||
const res = await this.ableton.getProp(this.ns, this.nsid, String(prop), cache); | ||
@@ -19,0 +19,0 @@ const transformer = this.transformers[prop]; |
@@ -33,5 +33,5 @@ import { Ableton } from ".."; | ||
export interface RawScene { | ||
color: number; | ||
id: string; | ||
name: string; | ||
readonly color: number; | ||
readonly id: string; | ||
readonly name: string; | ||
} | ||
@@ -38,0 +38,0 @@ export declare class Scene extends Namespace<GettableProperties, TransformedProperties, SettableProperties, ObservableProperties> { |
@@ -144,10 +144,10 @@ import { Ableton } from ".."; | ||
export interface RawTrack { | ||
id: string; | ||
name: string; | ||
color: number; | ||
color_index: number; | ||
is_foldable: boolean; | ||
is_grouped: boolean; | ||
mute: boolean; | ||
solo: boolean; | ||
readonly id: string; | ||
readonly name: string; | ||
readonly color: number; | ||
readonly color_index: number; | ||
readonly is_foldable: boolean; | ||
readonly is_grouped: boolean; | ||
readonly mute: boolean; | ||
readonly solo: boolean; | ||
} | ||
@@ -154,0 +154,0 @@ export declare class Track extends Namespace<GettableProperties, TransformedProperties, SettableProperties, ObservableProperties> { |
{ | ||
"name": "ableton-js", | ||
"version": "3.5.0", | ||
"version": "3.6.0", | ||
"description": "Control Ableton Live from Node", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is not supported yet
206868
4122