ableton-js 3.7.2 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/hooks/prepublish.js +13 -5
  3. package/index.d.ts +16 -15
  4. package/index.js +52 -58
  5. package/midi-script/AbletonJS.py +1 -1
  6. package/midi-script/Socket.py +20 -7
  7. package/midi-script/version.py +1 -1
  8. package/ns/application-view.d.ts +2 -2
  9. package/ns/application-view.js +4 -8
  10. package/ns/application.d.ts +4 -4
  11. package/ns/application.js +6 -10
  12. package/ns/browser-item.d.ts +2 -2
  13. package/ns/browser-item.js +2 -6
  14. package/ns/browser.d.ts +3 -3
  15. package/ns/browser.js +5 -9
  16. package/ns/clip-slot.d.ts +4 -4
  17. package/ns/clip-slot.js +8 -12
  18. package/ns/clip.d.ts +5 -5
  19. package/ns/clip.js +16 -20
  20. package/ns/cue-point.d.ts +2 -2
  21. package/ns/cue-point.js +2 -6
  22. package/ns/device-parameter.d.ts +2 -2
  23. package/ns/device-parameter.js +6 -10
  24. package/ns/device.d.ts +3 -3
  25. package/ns/device.js +6 -10
  26. package/ns/index.d.ts +1 -1
  27. package/ns/index.js +1 -5
  28. package/ns/internal.d.ts +2 -2
  29. package/ns/internal.js +5 -12
  30. package/ns/midi.d.ts +2 -2
  31. package/ns/midi.js +5 -10
  32. package/ns/mixer-device.d.ts +3 -3
  33. package/ns/mixer-device.js +16 -20
  34. package/ns/scene.d.ts +4 -4
  35. package/ns/scene.js +6 -10
  36. package/ns/session.d.ts +2 -2
  37. package/ns/session.js +2 -6
  38. package/ns/song-view.d.ts +8 -8
  39. package/ns/song-view.js +12 -16
  40. package/ns/song.d.ts +7 -7
  41. package/ns/song.js +23 -27
  42. package/ns/track-view.d.ts +3 -3
  43. package/ns/track-view.js +6 -10
  44. package/ns/track.d.ts +8 -8
  45. package/ns/track.js +19 -23
  46. package/package.json +12 -4
  47. package/util/cache.js +1 -5
  48. package/util/color.js +1 -5
  49. package/util/logger.js +1 -2
  50. package/util/note.js +2 -7
  51. package/util/package-version.d.ts +1 -1
  52. package/util/package-version.js +1 -20
  53. package/util/tests.d.ts +1 -1
  54. package/util/tests.js +3 -7
package/ns/track-view.js CHANGED
@@ -1,19 +1,16 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TrackView = exports.DeviceInsertMode = void 0;
4
- const _1 = require(".");
5
- const device_1 = require("./device");
6
- var DeviceInsertMode;
1
+ import { Namespace } from "./index.js";
2
+ import { Device } from "./device.js";
3
+ export var DeviceInsertMode;
7
4
  (function (DeviceInsertMode) {
8
5
  DeviceInsertMode["Default"] = "default";
9
6
  DeviceInsertMode["Left"] = "left";
10
7
  DeviceInsertMode["Right"] = "right";
11
- })(DeviceInsertMode || (exports.DeviceInsertMode = DeviceInsertMode = {}));
12
- class TrackView extends _1.Namespace {
8
+ })(DeviceInsertMode || (DeviceInsertMode = {}));
9
+ export class TrackView extends Namespace {
13
10
  constructor(ableton, nsid) {
14
11
  super(ableton, "track-view", nsid);
15
12
  this.transformers = {
16
- selected_device: (device) => new device_1.Device(ableton, device),
13
+ selected_device: (device) => new Device(ableton, device),
17
14
  };
18
15
  this.cachedProps = {
19
16
  selected_device: true,
@@ -26,4 +23,3 @@ class TrackView extends _1.Namespace {
26
23
  return this.sendCommand("select_instrument");
27
24
  }
28
25
  }
29
- exports.TrackView = TrackView;
package/ns/track.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- import { Ableton } from "..";
2
- import { Namespace } from ".";
3
- import { Device, RawDevice } from "./device";
4
- import { ClipSlot, RawClipSlot } from "./clip-slot";
5
- import { MixerDevice, RawMixerDevice } from "./mixer-device";
6
- import { Clip, RawClip } from "./clip";
7
- import { Color } from "../util/color";
8
- import { TrackView } from "./track-view";
1
+ import { Ableton } from "../index.js";
2
+ import { Namespace } from "./index.js";
3
+ import { Device, RawDevice } from "./device.js";
4
+ import { ClipSlot, RawClipSlot } from "./clip-slot.js";
5
+ import { MixerDevice, RawMixerDevice } from "./mixer-device.js";
6
+ import { Clip, RawClip } from "./clip.js";
7
+ import { Color } from "../util/color.js";
8
+ import { TrackView } from "./track-view.js";
9
9
  export declare enum RoutingLayout {
10
10
  Mono = 1,
11
11
  Stereo = 2
package/ns/track.js CHANGED
@@ -1,19 +1,16 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Track = exports.RoutingCategory = exports.RoutingLayout = void 0;
4
- const _1 = require(".");
5
- const device_1 = require("./device");
6
- const clip_slot_1 = require("./clip-slot");
7
- const mixer_device_1 = require("./mixer-device");
8
- const clip_1 = require("./clip");
9
- const color_1 = require("../util/color");
10
- const track_view_1 = require("./track-view");
11
- var RoutingLayout;
1
+ import { Namespace } from "./index.js";
2
+ import { Device } from "./device.js";
3
+ import { ClipSlot } from "./clip-slot.js";
4
+ import { MixerDevice } from "./mixer-device.js";
5
+ import { Clip } from "./clip.js";
6
+ import { Color } from "../util/color.js";
7
+ import { TrackView } from "./track-view.js";
8
+ export var RoutingLayout;
12
9
  (function (RoutingLayout) {
13
10
  RoutingLayout[RoutingLayout["Mono"] = 1] = "Mono";
14
11
  RoutingLayout[RoutingLayout["Stereo"] = 2] = "Stereo";
15
- })(RoutingLayout || (exports.RoutingLayout = RoutingLayout = {}));
16
- var RoutingCategory;
12
+ })(RoutingLayout || (RoutingLayout = {}));
13
+ export var RoutingCategory;
17
14
  (function (RoutingCategory) {
18
15
  RoutingCategory[RoutingCategory["External"] = 0] = "External";
19
16
  RoutingCategory[RoutingCategory["Rewire"] = 1] = "Rewire";
@@ -23,20 +20,20 @@ var RoutingCategory;
23
20
  RoutingCategory[RoutingCategory["ParentGroupTrack"] = 5] = "ParentGroupTrack";
24
21
  RoutingCategory[RoutingCategory["None"] = 6] = "None";
25
22
  RoutingCategory[RoutingCategory["Invalid"] = 7] = "Invalid";
26
- })(RoutingCategory || (exports.RoutingCategory = RoutingCategory = {}));
27
- class Track extends _1.Namespace {
23
+ })(RoutingCategory || (RoutingCategory = {}));
24
+ export class Track extends Namespace {
28
25
  raw;
29
26
  view;
30
27
  constructor(ableton, raw) {
31
28
  super(ableton, "track", raw.id);
32
29
  this.raw = raw;
33
- this.view = new track_view_1.TrackView(this.ableton, raw.id);
30
+ this.view = new TrackView(this.ableton, raw.id);
34
31
  this.transformers = {
35
- arrangement_clips: (clips) => clips.map((clip) => new clip_1.Clip(ableton, clip)),
36
- color: (c) => new color_1.Color(c),
37
- devices: (devices) => devices.map((d) => new device_1.Device(ableton, d)),
38
- clip_slots: (clip_slots) => clip_slots.map((c) => new clip_slot_1.ClipSlot(ableton, c)),
39
- mixer_device: (mixer_device) => new mixer_device_1.MixerDevice(ableton, mixer_device),
32
+ arrangement_clips: (clips) => clips.map((clip) => new Clip(ableton, clip)),
33
+ color: (c) => new Color(c),
34
+ devices: (devices) => devices.map((d) => new Device(ableton, d)),
35
+ clip_slots: (clip_slots) => clip_slots.map((c) => new ClipSlot(ableton, c)),
36
+ mixer_device: (mixer_device) => new MixerDevice(ableton, mixer_device),
40
37
  };
41
38
  this.cachedProps = {
42
39
  arrangement_clips: true,
@@ -53,7 +50,7 @@ class Track extends _1.Namespace {
53
50
  clip_id: typeof clipOrId === "string" ? clipOrId : clipOrId.raw.id,
54
51
  time: time,
55
52
  });
56
- return new clip_1.Clip(this.ableton, rawClip);
53
+ return new Clip(this.ableton, rawClip);
57
54
  }
58
55
  /**
59
56
  * Deletes the given clip from the arrangement of this track.
@@ -78,4 +75,3 @@ class Track extends _1.Namespace {
78
75
  return this.sendCommand("create_audio_clip", [filePath, position]);
79
76
  }
80
77
  }
81
- exports.Track = Track;
package/package.json CHANGED
@@ -1,14 +1,21 @@
1
1
  {
2
2
  "name": "ableton-js",
3
- "version": "3.7.2",
3
+ "version": "4.0.0",
4
4
  "description": "Control Ableton Live from Node",
5
- "main": "index.js",
5
+ "type": "module",
6
+ "exports": {
7
+ "types": "./index.d.ts",
8
+ "default": "./index.js"
9
+ },
6
10
  "author": "Leo Bernard <admin@leolabs.org>",
7
11
  "license": "MIT",
8
12
  "repository": {
9
13
  "type": "git",
10
14
  "url": "https://github.com/leolabs/ableton-js.git"
11
15
  },
16
+ "engines": {
17
+ "node": ">=20"
18
+ },
12
19
  "files": [
13
20
  "**/*.js",
14
21
  "**/*.d.ts",
@@ -29,7 +36,7 @@
29
36
  "build:doc": "jsdoc2md --files src/**/*.ts --configure ./jsdoc2md.json > ./API.md",
30
37
  "version": "node hooks/prepublish.js && git add midi-script/version.py && auto-changelog -p -l 100 && git add CHANGELOG.md",
31
38
  "build": "tsc",
32
- "test": "vitest --run --no-threads",
39
+ "test": "vitest --run",
33
40
  "format": "prettier -w src/"
34
41
  },
35
42
  "devDependencies": {
@@ -43,11 +50,12 @@
43
50
  "prettier": "^3.3.3",
44
51
  "tsx": "^3.12.7",
45
52
  "typescript": "^5.1.3",
46
- "vitest": "^0.32.4"
53
+ "vitest": "^4.0.15"
47
54
  },
48
55
  "dependencies": {
49
56
  "lodash": "^4.17.21",
50
57
  "lru-cache": "^7.14.0",
58
+ "p-limit": "^7.2.0",
51
59
  "semver": "^7.3.5",
52
60
  "uuid": "^8.3.2"
53
61
  }
package/util/cache.js CHANGED
@@ -1,5 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isCached = void 0;
4
- const isCached = (obj) => obj && "__cached" in obj;
5
- exports.isCached = isCached;
1
+ export const isCached = (obj) => obj && "__cached" in obj;
package/util/color.js CHANGED
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Color = void 0;
4
1
  /** Represents a color in Ableton */
5
- class Color {
2
+ export class Color {
6
3
  color;
7
4
  constructor(color) {
8
5
  if (typeof color === "number") {
@@ -35,4 +32,3 @@ class Color {
35
32
  return this.numberRepresentation;
36
33
  }
37
34
  }
38
- exports.Color = Color;
package/util/logger.js CHANGED
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
package/util/note.js CHANGED
@@ -1,19 +1,14 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.noteToTuple = exports.tupleToNote = void 0;
4
- const tupleToNote = (tuple) => ({
1
+ export const tupleToNote = (tuple) => ({
5
2
  pitch: tuple[0],
6
3
  time: tuple[1],
7
4
  duration: tuple[2],
8
5
  velocity: tuple[3],
9
6
  muted: tuple[4],
10
7
  });
11
- exports.tupleToNote = tupleToNote;
12
- const noteToTuple = (note) => [
8
+ export const noteToTuple = (note) => [
13
9
  note.pitch,
14
10
  note.time,
15
11
  note.duration,
16
12
  note.velocity,
17
13
  note.muted,
18
14
  ];
19
- exports.noteToTuple = noteToTuple;
@@ -1 +1 @@
1
- export declare const getPackageVersion: () => any;
1
+ export declare const packageVersion = "0.0.0";
@@ -1,20 +1 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getPackageVersion = void 0;
7
- const fs_1 = __importDefault(require("fs"));
8
- const path_1 = __importDefault(require("path"));
9
- const getPackageVersion = () => {
10
- const parentPath = path_1.default.join(__dirname, "..", "package.json");
11
- const parent2Path = path_1.default.join(__dirname, "..", "..", "package.json");
12
- if (fs_1.default.existsSync(parentPath)) {
13
- return require(parentPath).version;
14
- }
15
- if (fs_1.default.existsSync(parent2Path)) {
16
- return require(parent2Path).version;
17
- }
18
- throw new Error("Could not find package.json");
19
- };
20
- exports.getPackageVersion = getPackageVersion;
1
+ export const packageVersion = "0.0.0";
package/util/tests.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { Ableton } from "..";
1
+ import { Ableton } from "../index.js";
2
2
  export declare const withAbleton: (callback: (ab: Ableton) => Promise<void>) => Promise<void>;
package/util/tests.js CHANGED
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.withAbleton = void 0;
4
- const __1 = require("..");
5
- const withAbleton = async (callback) => {
6
- const ab = new __1.Ableton();
1
+ import { Ableton } from "../index.js";
2
+ export const withAbleton = async (callback) => {
3
+ const ab = new Ableton();
7
4
  ab.on("error", console.error);
8
5
  await ab.start(2000);
9
6
  try {
@@ -13,4 +10,3 @@ const withAbleton = async (callback) => {
13
10
  await ab.close();
14
11
  }
15
12
  };
16
- exports.withAbleton = withAbleton;