@freedome/client 1.0.0 → 1.2.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.
package/dist/node.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { F as FormatInput } from './input-CxW5zgc-.cjs';
2
- import { C as ContentSource, t as Discovery, s as DiscoveredDome } from './discovery-BsEQfHam.cjs';
2
+ import { C as ContentSource, t as Discovery, s as DiscoveredDome } from './discovery-Do_9mAzB.cjs';
3
3
  import { a as FreedomeTransportFactory } from './transport-dvmDQyvB.cjs';
4
4
  import '@freedome/protocol';
5
5
  import './errors-L_bIF-OR.cjs';
package/dist/node.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { F as FormatInput } from './input-CxW5zgc-.js';
2
- import { C as ContentSource, t as Discovery, s as DiscoveredDome } from './discovery-DTV9yp9S.js';
2
+ import { C as ContentSource, t as Discovery, s as DiscoveredDome } from './discovery-BkrBFXwA.js';
3
3
  import { a as FreedomeTransportFactory } from './transport-dvmDQyvB.js';
4
4
  import '@freedome/protocol';
5
5
  import './errors-L_bIF-OR.js';
package/dist/testing.cjs CHANGED
@@ -388,10 +388,13 @@ var FreedomeResponse = class _FreedomeResponse {
388
388
 
389
389
  // src/testing/fake-audio.ts
390
390
  var ENDED = /* @__PURE__ */ new Set(["finished", "stopped", "failed"]);
391
+ var JOB_ENDED = /* @__PURE__ */ new Set(["succeeded", "failed", "cancelled"]);
391
392
  var FakeAudio = class {
392
- constructor(publish, problem2) {
393
+ constructor(publish, problem2, jobs = /* @__PURE__ */ new Map(), audioControl = () => true) {
393
394
  this.publish = publish;
394
395
  this.problem = problem2;
396
+ this.jobs = jobs;
397
+ this.audioControl = audioControl;
395
398
  this.zones.set("front", {
396
399
  id: "front",
397
400
  name: "Front",
@@ -431,6 +434,8 @@ var FakeAudio = class {
431
434
  }
432
435
  publish;
433
436
  problem;
437
+ jobs;
438
+ audioControl;
434
439
  state = {
435
440
  venueId: "default",
436
441
  mode: "combined",
@@ -458,6 +463,12 @@ var FakeAudio = class {
458
463
  generator = { running: false };
459
464
  /** Last position per source id. */
460
465
  sources = /* @__PURE__ */ new Map();
466
+ /** Devices in emergency stop: a sweep answers 409. */
467
+ estopped = /* @__PURE__ */ new Set();
468
+ /** What a sweep of a device finds (`{hz, db, q?}`); without an entry, the model's partials. */
469
+ sweepPeaks = /* @__PURE__ */ new Map();
470
+ /** Milliseconds between the steps of a sweep. */
471
+ sweepStepMs = 1;
461
472
  /** Test hook: publishes `audio.levels` (`{meter id: dBFS}`) on `venues/{v}/audio/levels`. */
462
473
  emitLevels(levels) {
463
474
  this.publish("audio/levels", "audio.levels", { resource: { levels } });
@@ -484,6 +495,143 @@ var FakeAudio = class {
484
495
  publishSession(s) {
485
496
  this.publish(`audio/sessions/${s.id}`, "audioSession.state", { resource: s });
486
497
  }
498
+ /** 422 for a `roleZones` a 1.0 server would refuse, a role not of class `speakers` or an unknown zone; 409 without speakers. */
499
+ checkRoleZones(body) {
500
+ const roleZones = body?.roleZones;
501
+ if (roleZones === void 0) return void 0;
502
+ if (!this.audioControl())
503
+ return this.problem(422, "validation-failed", "unknown member roleZones");
504
+ if (!this.layout.body.speakers?.length)
505
+ return this.problem(409, "conflict", "the venue has no speakers");
506
+ const roles = this.presets.get(body.presetId)?.document?.roles;
507
+ for (const [role, zones] of Object.entries(roleZones)) {
508
+ if (roles && !roles[role]) return this.problem(422, "validation-failed", `no role ${role}`);
509
+ if (roles && roles[role].class !== "speakers")
510
+ return this.problem(422, "validation-failed", `role ${role} is not of class speakers`);
511
+ for (const z of zones)
512
+ if (!this.zones.has(z)) return this.problem(422, "validation-failed", `no zone ${z}`);
513
+ }
514
+ return void 0;
515
+ }
516
+ /** 422 for a `multi` block a 1.0 server would refuse, next to anything but `signal: multi`, or with `frequencies`. */
517
+ checkGeneratorMulti(body) {
518
+ if (body?.multi === void 0) return void 0;
519
+ if (!this.audioControl()) return this.problem(422, "validation-failed", "unknown member multi");
520
+ if (body.signal !== "multi")
521
+ return this.problem(422, "validation-failed", "multi needs signal: multi");
522
+ if (body.frequencies !== void 0)
523
+ return this.problem(422, "validation-failed", "multi excludes frequencies");
524
+ return void 0;
525
+ }
526
+ /** The state table of `docs/audio-control.md`. */
527
+ sessionControl(sessionId, pause) {
528
+ const s = this.sessions.get(sessionId);
529
+ if (!this.audioControl() || !s) return this.problem(404, "not-found", "session");
530
+ const [from, to] = pause ? ["running", "paused"] : ["paused", "running"];
531
+ if (s.status === from) {
532
+ s.status = to;
533
+ this.publishSession(s);
534
+ } else if (s.status !== to) {
535
+ return this.problem(409, "conflict", `session is ${s.status}`);
536
+ }
537
+ return FreedomeResponse.json(200, s);
538
+ }
539
+ startSweep(p, body) {
540
+ if (!this.audioControl()) return this.problem(404, "not-found", "no such route");
541
+ const deviceId = p.deviceId;
542
+ const d = this.devices.get(deviceId);
543
+ if (!d) return this.problem(404, "not-found", "device");
544
+ const from = body?.fromHz ?? 20;
545
+ const to = body?.toHz ?? 2e3;
546
+ const actuators = d.config?.actuators;
547
+ if (d.kind !== "resonator" || body?.actuator && actuators?.includes(body.actuator) === false)
548
+ return this.problem(422, "validation-failed", `no resonator channel on ${deviceId}`);
549
+ if (to <= from) return this.problem(422, "validation-failed", "toHz not above fromHz");
550
+ if (this.estopped.has(deviceId))
551
+ return this.problem(409, "conflict", `${deviceId} is in emergency stop`);
552
+ for (const s of this.sessions.values())
553
+ if (!ENDED.has(s.status) && s.targets?.devices?.includes(deviceId))
554
+ return this.problem(409, "conflict", `a session uses ${deviceId}`);
555
+ for (const j2 of this.jobs.values())
556
+ if (j2.kind === "audio-device-sweep" && !JOB_ENDED.has(j2.status))
557
+ return this.problem(409, "conflict", "another sweep runs");
558
+ const id = uuidV7();
559
+ const now = (0, import_protocol.rfc3339Millis)();
560
+ const j = {
561
+ id,
562
+ venueId: p.venueId,
563
+ kind: "audio-device-sweep",
564
+ status: "queued",
565
+ progress: 0,
566
+ steps: [{ id: "sweep", status: "pending" }],
567
+ currentStep: null,
568
+ awaiting: null,
569
+ result: null,
570
+ sweep: {
571
+ deviceId,
572
+ ...body?.actuator ? { actuator: body.actuator } : {},
573
+ fromHz: from,
574
+ toHz: to,
575
+ durationS: body?.durationS ?? 5,
576
+ level: body?.level ?? 0.3
577
+ },
578
+ createdAt: now,
579
+ updatedAt: now
580
+ };
581
+ this.jobs.set(id, j);
582
+ const answer = FreedomeResponse.json(202, structuredClone(j), {
583
+ location: `/api/v1/venues/${p.venueId}/calibration/jobs/${id}`
584
+ });
585
+ this.runSweep(j, body?.modelHz ?? [], body?.tolerance ?? 0.01, 0);
586
+ return answer;
587
+ }
588
+ /** queued → running, progress in steps of a third (time in the real server), then the result. */
589
+ runSweep(j, modelHz, tolerance, tick) {
590
+ const timer = setTimeout(() => {
591
+ if (JOB_ENDED.has(j.status)) return;
592
+ const step = j.steps[0];
593
+ j.updatedAt = (0, import_protocol.rfc3339Millis)();
594
+ const topic = `calibration/jobs/${j.id}`;
595
+ if (tick === 0) {
596
+ step.status = "running";
597
+ j.status = "running";
598
+ j.currentStep = "sweep";
599
+ this.publish(topic, "calibrationJob.state", { resource: j });
600
+ } else if (tick < 3) {
601
+ j.progress = tick / 3;
602
+ this.publish(topic, "calibrationJob.progress", { patch: { progress: j.progress } });
603
+ } else {
604
+ step.status = "done";
605
+ this.finishSweep(j, modelHz, tolerance);
606
+ j.status = "succeeded";
607
+ j.progress = 1;
608
+ j.currentStep = null;
609
+ this.publish(topic, "calibrationJob.state", { resource: j });
610
+ return;
611
+ }
612
+ this.runSweep(j, modelHz, tolerance, tick + 1);
613
+ }, this.sweepStepMs);
614
+ timer.unref?.();
615
+ }
616
+ /** `detuned`: a partial further than `tolerance` from its model. `cracked`: no peak within four times `tolerance`. */
617
+ finishSweep(j, modelHz, tolerance) {
618
+ const found = this.sweepPeaks.get(j.sweep.deviceId) ?? (modelHz.length ? modelHz : [440]).map((hz) => ({ hz, db: -6, q: 40 }));
619
+ const peaks = [...found].sort((a, b) => b.db - a.db);
620
+ j.sweep.peaks = peaks;
621
+ if (!modelHz.length) return;
622
+ const warnings = /* @__PURE__ */ new Set();
623
+ j.sweep.partials = modelHz.map((modelHz2) => {
624
+ const off = (hz) => Math.abs(hz - modelHz2) / modelHz2;
625
+ const near = peaks.map((x) => x.hz).sort((a, b) => off(a) - off(b))[0];
626
+ if (near === void 0 || off(near) > 4 * tolerance) {
627
+ warnings.add("cracked");
628
+ return { modelHz: modelHz2 };
629
+ }
630
+ if (off(near) > tolerance) warnings.add("detuned");
631
+ return { modelHz: modelHz2, measuredHz: near };
632
+ });
633
+ j.sweep.warnings = [...warnings];
634
+ }
487
635
  publishGenerator() {
488
636
  this.publish("audio/generator", "generator.state", { resource: this.generator });
489
637
  }
@@ -632,6 +780,8 @@ var FakeAudio = class {
632
780
  case "startAudioSession": {
633
781
  if (!this.presets.has(body?.presetId))
634
782
  return this.problem(404, "not-found", `preset ${body?.presetId}`);
783
+ const bad = this.checkRoleZones(body);
784
+ if (bad) return bad;
635
785
  const s = {
636
786
  id: uuidV7(),
637
787
  venueId: p.venueId,
@@ -641,6 +791,7 @@ var FakeAudio = class {
641
791
  position: 0,
642
792
  itemIndex: 0,
643
793
  ...body.targets ? { targets: body.targets } : {},
794
+ ...body.roleZones ? { roleZones: body.roleZones } : {},
644
795
  startedAt: body.at ?? (0, import_protocol.rfc3339Millis)()
645
796
  };
646
797
  this.sessions.set(s.id, s);
@@ -661,10 +812,18 @@ var FakeAudio = class {
661
812
  }
662
813
  return noContent();
663
814
  }
815
+ case "pauseAudioSession":
816
+ return this.sessionControl(p.sessionId, true);
817
+ case "resumeAudioSession":
818
+ return this.sessionControl(p.sessionId, false);
819
+ case "startAudioDeviceSweep":
820
+ return this.startSweep(p, body);
664
821
  case "getGenerator":
665
822
  return json(200, this.generator);
666
- case "setGenerator":
823
+ case "setGenerator": {
667
824
  if (!body?.signal) return this.problem(422, "validation", "signal is required");
825
+ const bad = this.checkGeneratorMulti(body);
826
+ if (bad) return bad;
668
827
  this.generator = {
669
828
  running: true,
670
829
  settings: body,
@@ -672,6 +831,7 @@ var FakeAudio = class {
672
831
  };
673
832
  this.publishGenerator();
674
833
  return json(200, this.generator);
834
+ }
675
835
  case "stopGenerator":
676
836
  this.generator = { running: false };
677
837
  this.publishGenerator();
@@ -917,6 +1077,11 @@ var FakeDomeServer = class {
917
1077
  ]);
918
1078
  /** Accepted API keys → role. */
919
1079
  apiKeys = /* @__PURE__ */ new Map();
1080
+ /** Pending physical actions (`listAssistantConfirmations`). */
1081
+ confirmations = [];
1082
+ linkSessions = [];
1083
+ /** The code `approveAssistantLink` accepts. */
1084
+ linkCode = "7KQM-2XVB";
920
1085
  networkDown = false;
921
1086
  realtimeAvailable = true;
922
1087
  accessTtlSec = 900;
@@ -950,6 +1115,11 @@ var FakeDomeServer = class {
950
1115
  pairings = /* @__PURE__ */ new Map();
951
1116
  /** Approve every pairing request at once (role = requested role or operator). */
952
1117
  autoApprovePairings = false;
1118
+ /**
1119
+ * Contract version the fake reports in `getInfo` and behaves as: below 1.1.0 the operations of 1.1.0 answer 404 and
1120
+ * its members 422, as a 1.0 server does.
1121
+ */
1122
+ contractVersion = "1.2.0";
953
1123
  /** Calibration jobs by id. */
954
1124
  calibrationJobs = /* @__PURE__ */ new Map();
955
1125
  /** Audio model + hooks (`emitLevels`, `advanceSession`). */
@@ -958,7 +1128,12 @@ var FakeDomeServer = class {
958
1128
  for (const v of /* @__PURE__ */ new Set(["default", this.activeVenue]))
959
1129
  this.publish(`venues/${v}/${t}`, kind, data);
960
1130
  },
961
- (status, code, detail) => problem(status, code, detail)
1131
+ (status, code, detail) => problem(status, code, detail),
1132
+ this.calibrationJobs,
1133
+ () => {
1134
+ const v = import_protocol3.SemVer.tryParse(this.contractVersion);
1135
+ return v !== null && v.compareTo(import_protocol3.ProtocolVersions.audioControl) >= 0;
1136
+ }
962
1137
  );
963
1138
  /** Live analysis, AudioReactive scenes, texture sources and gateways (`seed`, `publishFrame`). */
964
1139
  audioReactive = new FakeAudioReactive(
@@ -1137,9 +1312,42 @@ var FakeDomeServer = class {
1137
1312
  instanceId: this.instanceId,
1138
1313
  apiVersions: ["v1"],
1139
1314
  version: "1.0.0-rc.1",
1315
+ contractVersion: this.contractVersion,
1140
1316
  capabilities: { realtime: ["ws"], audio: true },
1141
1317
  transports: { ws: true, graphql: false, socketIo: false }
1142
1318
  });
1319
+ case "listAssistantConfirmations":
1320
+ return json(200, { items: this.confirmations, nextCursor: null });
1321
+ case "refuseAssistantConfirmation": {
1322
+ const c = this.confirmations.find((x) => x.id === p.confirmationId);
1323
+ if (!c) return problem(404, "not-found", "no such confirmation");
1324
+ c.status = "refused";
1325
+ delete c.code;
1326
+ return json(200, c);
1327
+ }
1328
+ case "getAssistantLink":
1329
+ return json(200, { enabled: true, state: "online", sessions: this.linkSessions });
1330
+ case "approveAssistantLink": {
1331
+ if (body?.code !== this.linkCode) return problem(422, "validation-failed", "wrong code");
1332
+ const session = {
1333
+ id: uuidV7(),
1334
+ approver: "user:admin",
1335
+ role: "operator",
1336
+ scopes: ["playback:control"],
1337
+ createdAt: (/* @__PURE__ */ new Date(0)).toISOString(),
1338
+ expiresAt: new Date(8 * 36e5).toISOString(),
1339
+ status: "active",
1340
+ calls: 0
1341
+ };
1342
+ this.linkSessions.push(session);
1343
+ return json(201, session);
1344
+ }
1345
+ case "endAssistantLink": {
1346
+ const x = this.linkSessions.find((v) => v.id === p.sessionId);
1347
+ if (!x) return problem(404, "not-found", "no such approval");
1348
+ x.status = "ended";
1349
+ return new FreedomeResponse(204);
1350
+ }
1143
1351
  case "createSession": {
1144
1352
  if (this.users.get(body?.username) !== body?.password)
1145
1353
  return problem(401, "unauthenticated", "wrong username or password");
@@ -1301,6 +1509,8 @@ var FakeDomeServer = class {
1301
1509
  return json(200, x);
1302
1510
  }
1303
1511
  case "startCalibrationJob": {
1512
+ if (body?.kind === "audio-device-sweep")
1513
+ return problem(422, "validation-failed", "a sweep starts with startAudioDeviceSweep");
1304
1514
  const id = uuidV7();
1305
1515
  const now = (0, import_protocol3.rfc3339Millis)();
1306
1516
  const j = {
@@ -1323,6 +1533,24 @@ var FakeDomeServer = class {
1323
1533
  const j = this.calibrationJobs.get(p.jobId);
1324
1534
  return j ? json(200, j) : problem(404, "not-found", "calibration job");
1325
1535
  }
1536
+ case "cancelCalibrationJob": {
1537
+ const j = this.calibrationJobs.get(p.jobId);
1538
+ if (!j) return problem(404, "not-found", "calibration job");
1539
+ if (!["succeeded", "failed", "cancelled"].includes(j.status)) {
1540
+ j.status = "cancelled";
1541
+ this.publish(`venues/${p.venueId}/calibration/jobs/${j.id}`, "calibrationJob.state", {
1542
+ resource: j
1543
+ });
1544
+ }
1545
+ return json(200, j);
1546
+ }
1547
+ case "applyCalibrationJob": {
1548
+ const j = this.calibrationJobs.get(p.jobId);
1549
+ if (!j) return problem(404, "not-found", "calibration job");
1550
+ if (j.status !== "succeeded" || !j.result)
1551
+ return problem(409, "conflict", `job ${j.id} has nothing to apply`);
1552
+ return json(200, j.result);
1553
+ }
1326
1554
  case "listShows":
1327
1555
  return json(200, {
1328
1556
  items: [...this.shows.entries()].map(([id, s]) => ({
@@ -1448,8 +1676,19 @@ var FakeDomeServer = class {
1448
1676
  const a = this.assets.get(p.assetId);
1449
1677
  return a ? json(200, a, this.etag(a.revision)) : problem(404, "not-found", "asset");
1450
1678
  }
1451
- case "listAssets":
1452
- return json(200, { items: [...this.assets.values()], nextCursor: null });
1679
+ case "listAssets": {
1680
+ const f2 = r.query ?? {};
1681
+ const q = f2.q?.toLowerCase();
1682
+ const all = [...this.assets.values()].filter(
1683
+ (a) => (f2.type === void 0 || a.type === f2.type) && (f2.tag === void 0 || (a.tags ?? []).includes(f2.tag)) && (f2.status === void 0 || a.status === f2.status) && (q === void 0 || String(a.name).toLowerCase().includes(q))
1684
+ );
1685
+ const start = Number(f2.cursor ?? 0) || 0;
1686
+ const end = f2.limit === void 0 ? all.length : Math.min(all.length, start + Number(f2.limit));
1687
+ return json(200, {
1688
+ items: all.slice(start, end),
1689
+ nextCursor: end < all.length ? String(end) : null
1690
+ });
1691
+ }
1453
1692
  case "getJob": {
1454
1693
  const j = this.jobs.get(p.jobId);
1455
1694
  return j ? json(200, j) : problem(404, "not-found", "job");
@@ -8,6 +8,10 @@ type Problem$1 = (status: number, code: string, detail: string) => FreedomeRespo
8
8
  declare class FakeAudio {
9
9
  private readonly publish;
10
10
  private readonly problem;
11
+ /** Calibration jobs of the fake, which a sweep joins. */
12
+ private readonly jobs;
13
+ /** False: behaves as a 1.0 server (404 for the 1.1 operations, 422 for their members). */
14
+ private readonly audioControl;
11
15
  state: Json$2;
12
16
  layout: {
13
17
  body: Json$2;
@@ -20,7 +24,17 @@ declare class FakeAudio {
20
24
  generator: Json$2;
21
25
  /** Last position per source id. */
22
26
  readonly sources: Map<string, any>;
23
- constructor(publish: Publish$1, problem: Problem$1);
27
+ /** Devices in emergency stop: a sweep answers 409. */
28
+ readonly estopped: Set<string>;
29
+ /** What a sweep of a device finds (`{hz, db, q?}`); without an entry, the model's partials. */
30
+ readonly sweepPeaks: Map<string, any[]>;
31
+ /** Milliseconds between the steps of a sweep. */
32
+ sweepStepMs: number;
33
+ constructor(publish: Publish$1, problem: Problem$1,
34
+ /** Calibration jobs of the fake, which a sweep joins. */
35
+ jobs?: Map<string, Json$2>,
36
+ /** False: behaves as a 1.0 server (404 for the 1.1 operations, 422 for their members). */
37
+ audioControl?: () => boolean);
24
38
  /** Test hook: publishes `audio.levels` (`{meter id: dBFS}`) on `venues/{v}/audio/levels`. */
25
39
  emitLevels(levels: Record<string, number>): void;
26
40
  /** Test hook: advances session [id] to [positionSec] (and optionally a new [status]); publishes the state. */
@@ -28,6 +42,17 @@ declare class FakeAudio {
28
42
  private bumpState;
29
43
  private publishZone;
30
44
  private publishSession;
45
+ /** 422 for a `roleZones` a 1.0 server would refuse, a role not of class `speakers` or an unknown zone; 409 without speakers. */
46
+ private checkRoleZones;
47
+ /** 422 for a `multi` block a 1.0 server would refuse, next to anything but `signal: multi`, or with `frequencies`. */
48
+ private checkGeneratorMulti;
49
+ /** The state table of `docs/audio-control.md`. */
50
+ private sessionControl;
51
+ private startSweep;
52
+ /** queued → running, progress in steps of a third (time in the real server), then the result. */
53
+ private runSweep;
54
+ /** `detuned`: a partial further than `tolerance` from its model. `cracked`: no peak within four times `tolerance`. */
55
+ private finishSweep;
31
56
  private publishGenerator;
32
57
  private page;
33
58
  /** Serves audio operation [op]; undefined = not an audio operation. */
@@ -85,6 +110,11 @@ declare class FakeDomeServer {
85
110
  readonly users: Map<string, string>;
86
111
  /** Accepted API keys → role. */
87
112
  readonly apiKeys: Map<string, string>;
113
+ /** Pending physical actions (`listAssistantConfirmations`). */
114
+ confirmations: Json[];
115
+ readonly linkSessions: Json[];
116
+ /** The code `approveAssistantLink` accepts. */
117
+ linkCode: string;
88
118
  networkDown: boolean;
89
119
  realtimeAvailable: boolean;
90
120
  accessTtlSec: number;
@@ -121,6 +151,11 @@ declare class FakeDomeServer {
121
151
  readonly pairings: Map<string, any>;
122
152
  /** Approve every pairing request at once (role = requested role or operator). */
123
153
  autoApprovePairings: boolean;
154
+ /**
155
+ * Contract version the fake reports in `getInfo` and behaves as: below 1.1.0 the operations of 1.1.0 answer 404 and
156
+ * its members 422, as a 1.0 server does.
157
+ */
158
+ contractVersion: string;
124
159
  /** Calibration jobs by id. */
125
160
  readonly calibrationJobs: Map<string, any>;
126
161
  /** Audio model + hooks (`emitLevels`, `advanceSession`). */
package/dist/testing.d.ts CHANGED
@@ -8,6 +8,10 @@ type Problem$1 = (status: number, code: string, detail: string) => FreedomeRespo
8
8
  declare class FakeAudio {
9
9
  private readonly publish;
10
10
  private readonly problem;
11
+ /** Calibration jobs of the fake, which a sweep joins. */
12
+ private readonly jobs;
13
+ /** False: behaves as a 1.0 server (404 for the 1.1 operations, 422 for their members). */
14
+ private readonly audioControl;
11
15
  state: Json$2;
12
16
  layout: {
13
17
  body: Json$2;
@@ -20,7 +24,17 @@ declare class FakeAudio {
20
24
  generator: Json$2;
21
25
  /** Last position per source id. */
22
26
  readonly sources: Map<string, any>;
23
- constructor(publish: Publish$1, problem: Problem$1);
27
+ /** Devices in emergency stop: a sweep answers 409. */
28
+ readonly estopped: Set<string>;
29
+ /** What a sweep of a device finds (`{hz, db, q?}`); without an entry, the model's partials. */
30
+ readonly sweepPeaks: Map<string, any[]>;
31
+ /** Milliseconds between the steps of a sweep. */
32
+ sweepStepMs: number;
33
+ constructor(publish: Publish$1, problem: Problem$1,
34
+ /** Calibration jobs of the fake, which a sweep joins. */
35
+ jobs?: Map<string, Json$2>,
36
+ /** False: behaves as a 1.0 server (404 for the 1.1 operations, 422 for their members). */
37
+ audioControl?: () => boolean);
24
38
  /** Test hook: publishes `audio.levels` (`{meter id: dBFS}`) on `venues/{v}/audio/levels`. */
25
39
  emitLevels(levels: Record<string, number>): void;
26
40
  /** Test hook: advances session [id] to [positionSec] (and optionally a new [status]); publishes the state. */
@@ -28,6 +42,17 @@ declare class FakeAudio {
28
42
  private bumpState;
29
43
  private publishZone;
30
44
  private publishSession;
45
+ /** 422 for a `roleZones` a 1.0 server would refuse, a role not of class `speakers` or an unknown zone; 409 without speakers. */
46
+ private checkRoleZones;
47
+ /** 422 for a `multi` block a 1.0 server would refuse, next to anything but `signal: multi`, or with `frequencies`. */
48
+ private checkGeneratorMulti;
49
+ /** The state table of `docs/audio-control.md`. */
50
+ private sessionControl;
51
+ private startSweep;
52
+ /** queued → running, progress in steps of a third (time in the real server), then the result. */
53
+ private runSweep;
54
+ /** `detuned`: a partial further than `tolerance` from its model. `cracked`: no peak within four times `tolerance`. */
55
+ private finishSweep;
31
56
  private publishGenerator;
32
57
  private page;
33
58
  /** Serves audio operation [op]; undefined = not an audio operation. */
@@ -85,6 +110,11 @@ declare class FakeDomeServer {
85
110
  readonly users: Map<string, string>;
86
111
  /** Accepted API keys → role. */
87
112
  readonly apiKeys: Map<string, string>;
113
+ /** Pending physical actions (`listAssistantConfirmations`). */
114
+ confirmations: Json[];
115
+ readonly linkSessions: Json[];
116
+ /** The code `approveAssistantLink` accepts. */
117
+ linkCode: string;
88
118
  networkDown: boolean;
89
119
  realtimeAvailable: boolean;
90
120
  accessTtlSec: number;
@@ -121,6 +151,11 @@ declare class FakeDomeServer {
121
151
  readonly pairings: Map<string, any>;
122
152
  /** Approve every pairing request at once (role = requested role or operator). */
123
153
  autoApprovePairings: boolean;
154
+ /**
155
+ * Contract version the fake reports in `getInfo` and behaves as: below 1.1.0 the operations of 1.1.0 answer 404 and
156
+ * its members 422, as a 1.0 server does.
157
+ */
158
+ contractVersion: string;
124
159
  /** Calibration jobs by id. */
125
160
  readonly calibrationJobs: Map<string, any>;
126
161
  /** Audio model + hooks (`emitLevels`, `advanceSession`). */