@freedome/client 0.0.0-stage → 1.1.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/CHANGELOG.md +16 -0
- package/LICENSE +289 -0
- package/README.md +20 -2
- package/dist/chunk-CAEBM4AN.js +180 -0
- package/dist/chunk-HYGH4JIY.js +30 -0
- package/dist/chunk-J7A5LF32.js +180 -0
- package/dist/chunk-K3G5AG65.js +211 -0
- package/dist/chunk-YB5V2MMF.js +81 -0
- package/dist/codecs.cjs +1608 -0
- package/dist/codecs.d.cts +204 -0
- package/dist/codecs.d.ts +204 -0
- package/dist/codecs.js +1364 -0
- package/dist/discovery-BkrBFXwA.d.ts +430 -0
- package/dist/discovery-Do_9mAzB.d.cts +430 -0
- package/dist/errors-L_bIF-OR.d.cts +108 -0
- package/dist/errors-L_bIF-OR.d.ts +108 -0
- package/dist/index.cjs +4854 -0
- package/dist/index.d.cts +1190 -0
- package/dist/index.d.ts +1190 -0
- package/dist/index.js +4185 -0
- package/dist/input-CxW5zgc-.d.cts +27 -0
- package/dist/input-CxW5zgc-.d.ts +27 -0
- package/dist/node.cjs +465 -0
- package/dist/node.d.cts +31 -0
- package/dist/node.d.ts +31 -0
- package/dist/node.js +136 -0
- package/dist/testing.cjs +1813 -0
- package/dist/testing.d.cts +214 -0
- package/dist/testing.d.ts +214 -0
- package/dist/testing.js +1448 -0
- package/dist/transport-dvmDQyvB.d.cts +130 -0
- package/dist/transport-dvmDQyvB.d.ts +130 -0
- package/package.json +78 -3
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1190 @@
|
|
|
1
|
+
import { A as ApiCaller, R as RepositoryContext, W as WatchObserver, U as Unsubscribe, V as Versioned, E as Emitter, P as Page, C as ContentSource, a as UploadTask, b as UploadPurpose, c as RealtimeTransport, O as OfflinePolicy, d as CacheStore, e as OutboxStore, F as FreedomeLogger, f as RealtimeConnector, g as OutboxOutcome, h as EventHub, i as CallOptions, j as RealtimeChannel, k as Resync, l as RealtimeClosed, m as RealtimeHello, n as RealtimeResult, o as ChannelWelcome } from './discovery-BkrBFXwA.js';
|
|
2
|
+
export { B as BlobContentSource, p as BytesContentSource, q as CachedValue, r as CompositeDiscovery, D as DEFAULT_OFFLINE_POLICY, s as DiscoveredDome, t as Discovery, I as InMemoryCacheStore, u as InMemoryOutboxStore, L as LogLevel, v as LogRecord, M as MAX_UPLOAD_CHUNK, w as OutboxEntry, S as StaticDiscovery, x as UploadProgress, y as UploadResult, z as UploadTaskState, G as isAuthFailure, H as nextValue, J as probe, K as readAllPages, N as readPage } from './discovery-BkrBFXwA.js';
|
|
3
|
+
import { Principal, TokenSet, ApiOperation, OperationBody, OperationResponse, CalibrationJob, CalibrationState, ClientRegistration, ClientDevice, ClientTelemetry, AssetResource, AssetCreateRequest, ImportRequest, Job, ShowResource, StorageStats, ShowSummary, ShowInput, UploadStatus, EngineStatus, DisplayResource, PlayerState, AppPayload, ActiveShowState, ParameterInfo, VenueOutput, Venue, VenueInput, ServerInfo, SemVer, FreedomeEvent } from '@freedome/protocol';
|
|
4
|
+
export { ApiOperation, DomeTopics, EventKinds, FreedomeEvent, Operations, ProtocolVersions, SemVer } from '@freedome/protocol';
|
|
5
|
+
import { F as FreedomeEndpoint, a as FreedomeTransportFactory, b as FreedomeResponse, M as MessageSocket } from './transport-dvmDQyvB.js';
|
|
6
|
+
export { c as FetchTransport, d as FreedomeRequest, e as FreedomeTransport, f as MessageSocketConnector, P as PairingLink, W as WebSocketCtor, g as WebSocketLike, r as requestUrl, w as webSocketConnector } from './transport-dvmDQyvB.js';
|
|
7
|
+
export { C as ConflictError, a as ForbiddenError, F as FreedomeError, b as FreedomeErrorOptions, I as IncompatibleServerError, N as NetworkError, c as NotFoundError, O as OfflineError, P as PayloadTooLargeError, Q as QueuedForReplayError, R as RateLimitedError, d as RequestTimeoutError, S as ServerError, T as TlsPinMismatchError, U as UnauthorizedError, e as UnsupportedCapabilityError, f as UnsupportedFormatError, V as ValidationError, g as ValidationIssue, h as errorFromProblem, i as isUnreachable } from './errors-L_bIF-OR.js';
|
|
8
|
+
|
|
9
|
+
/** How the client authenticates. */
|
|
10
|
+
type FreedomeCredentials = {
|
|
11
|
+
kind: 'guest';
|
|
12
|
+
} | {
|
|
13
|
+
kind: 'password';
|
|
14
|
+
username: string;
|
|
15
|
+
password: string;
|
|
16
|
+
} | {
|
|
17
|
+
kind: 'apiKey';
|
|
18
|
+
key: string;
|
|
19
|
+
} | {
|
|
20
|
+
kind: 'pairing';
|
|
21
|
+
app: string;
|
|
22
|
+
deviceName: string;
|
|
23
|
+
requestedRole?: string;
|
|
24
|
+
/** Code from a pairing link (the server issues its own; a mismatch is logged). */
|
|
25
|
+
code?: string;
|
|
26
|
+
/** Called with the code to show to the user (approve it on the dome). */
|
|
27
|
+
onCode?: (code: string) => void;
|
|
28
|
+
timeoutMs?: number;
|
|
29
|
+
} | {
|
|
30
|
+
kind: 'cloud';
|
|
31
|
+
token: () => Promise<string>;
|
|
32
|
+
};
|
|
33
|
+
/** Credential constructors. */
|
|
34
|
+
declare const Credentials: {
|
|
35
|
+
readonly guest: () => FreedomeCredentials;
|
|
36
|
+
readonly password: (username: string, password: string) => FreedomeCredentials;
|
|
37
|
+
readonly apiKey: (key: string) => FreedomeCredentials;
|
|
38
|
+
readonly pairing: (o: Omit<Extract<FreedomeCredentials, {
|
|
39
|
+
kind: "pairing";
|
|
40
|
+
}>, "kind">) => FreedomeCredentials;
|
|
41
|
+
readonly cloud: (token: string | (() => Promise<string>)) => FreedomeCredentials;
|
|
42
|
+
};
|
|
43
|
+
/** Tokens persisted per dome. */
|
|
44
|
+
interface StoredTokens {
|
|
45
|
+
accessToken: string;
|
|
46
|
+
refreshToken?: string;
|
|
47
|
+
expiresAt?: string;
|
|
48
|
+
}
|
|
49
|
+
/** Token storage port (secure storage in apps). */
|
|
50
|
+
interface TokenStore {
|
|
51
|
+
read(key: string): Promise<StoredTokens | undefined>;
|
|
52
|
+
write(key: string, tokens: StoredTokens): Promise<void>;
|
|
53
|
+
delete(key: string): Promise<void>;
|
|
54
|
+
}
|
|
55
|
+
/** Default in-memory store. */
|
|
56
|
+
declare class InMemoryTokenStore implements TokenStore {
|
|
57
|
+
private readonly m;
|
|
58
|
+
read(k: string): Promise<StoredTokens | undefined>;
|
|
59
|
+
write(k: string, t: StoredTokens): Promise<void>;
|
|
60
|
+
delete(k: string): Promise<void>;
|
|
61
|
+
}
|
|
62
|
+
/** The authenticated session. */
|
|
63
|
+
interface Session {
|
|
64
|
+
role: string;
|
|
65
|
+
scopes: ReadonlySet<string>;
|
|
66
|
+
expiresAt?: string;
|
|
67
|
+
user?: string;
|
|
68
|
+
}
|
|
69
|
+
/** No session. */
|
|
70
|
+
declare const NO_SESSION: Session;
|
|
71
|
+
/** Effective scopes of a role. */
|
|
72
|
+
declare const scopesOfRole: (role: string) => ReadonlySet<string>;
|
|
73
|
+
/** Whether [session] has [scope]. */
|
|
74
|
+
declare const can: (session: Session, scope: string) => boolean;
|
|
75
|
+
/** Session of a token set. */
|
|
76
|
+
declare function sessionFromTokens(t: TokenSet, user?: string): Session;
|
|
77
|
+
/** Session of `GET /auth/me`. */
|
|
78
|
+
declare function sessionFromPrincipal(p: Principal): Session;
|
|
79
|
+
/** Stored form of a token set. */
|
|
80
|
+
declare function storedTokensOf(t: TokenSet): StoredTokens;
|
|
81
|
+
|
|
82
|
+
/** Backoff parameters. */
|
|
83
|
+
declare class BackoffPolicy {
|
|
84
|
+
readonly initialMs: number;
|
|
85
|
+
readonly maxMs: number;
|
|
86
|
+
readonly factor: number;
|
|
87
|
+
readonly jitter: boolean;
|
|
88
|
+
constructor(initialMs?: number, maxMs?: number, factor?: number, jitter?: boolean);
|
|
89
|
+
/** Upper bound of attempt [n] (0-based). */
|
|
90
|
+
cap(n: number): number;
|
|
91
|
+
/** Delay of attempt [n]: uniform in [0, cap] with jitter, else cap. */
|
|
92
|
+
delay(n: number, random?: () => number): number;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** Pseudo operation of the GraphQL endpoint. */
|
|
96
|
+
declare const GRAPHQL_OPERATION: ApiOperation;
|
|
97
|
+
/** Queries / mutations. */
|
|
98
|
+
declare class GraphqlClient {
|
|
99
|
+
private readonly api;
|
|
100
|
+
constructor(api: ApiCaller);
|
|
101
|
+
query<T = Record<string, unknown>>(document: string, variables?: Record<string, unknown>, operationName?: string): Promise<T>;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** Analysed inputs and whether the audio engine runs them. */
|
|
105
|
+
type AudioAnalysisState = OperationResponse<'getAudioAnalysis'>;
|
|
106
|
+
/** Inputs to analyse and the on / off switch. */
|
|
107
|
+
type AudioAnalysisSettings = OperationBody<'setAudioAnalysis'>;
|
|
108
|
+
/** Active scene, master intensity, service status (and the Resolume links for `playback:read`). */
|
|
109
|
+
type AudioReactiveState = OperationResponse<'getAudioReactive'>;
|
|
110
|
+
/** A stored scene. */
|
|
111
|
+
type AudioReactiveScene = OperationResponse<'getAudioReactiveScene'>;
|
|
112
|
+
/** Scene create / replace body. */
|
|
113
|
+
type AudioReactiveSceneInput = OperationBody<'putAudioReactiveScene'>;
|
|
114
|
+
/** A sender the engines of the venue can see. */
|
|
115
|
+
type TextureSource = OperationResponse<'listTextureSources'>['items'][number];
|
|
116
|
+
/** An analysis frame (`audio.analysis`). */
|
|
117
|
+
type AudioAnalysisFrame = Record<string, unknown> & {
|
|
118
|
+
inputId: string;
|
|
119
|
+
};
|
|
120
|
+
/** A detected attack (`audio.onset`). */
|
|
121
|
+
type AudioOnset = Record<string, unknown> & {
|
|
122
|
+
inputId: string;
|
|
123
|
+
};
|
|
124
|
+
/** Analysis, scenes and texture sources of one venue (default `default`). */
|
|
125
|
+
declare class AudioReactiveRepository {
|
|
126
|
+
private readonly c;
|
|
127
|
+
readonly venueId: string;
|
|
128
|
+
private readonly venues;
|
|
129
|
+
constructor(c: RepositoryContext, venueId?: string);
|
|
130
|
+
private get v();
|
|
131
|
+
/** The same repository for another venue. */
|
|
132
|
+
venue(id: string): AudioReactiveRepository;
|
|
133
|
+
/** Analysed inputs and whether the audio engine runs them. */
|
|
134
|
+
analysis(): Promise<AudioAnalysisState>;
|
|
135
|
+
/**
|
|
136
|
+
* Replaces the inputs and starts or stops the analysis (scope `audio:control`; live control, never queued offline).
|
|
137
|
+
* 503 `engine-unavailable` when the audio engine cannot be reached.
|
|
138
|
+
*/
|
|
139
|
+
setAnalysis(settings: AudioAnalysisSettings): Promise<AudioAnalysisState>;
|
|
140
|
+
/** Follows the analysis state (polled every [intervalMs] only while realtime is down). */
|
|
141
|
+
analysisStates(obs: WatchObserver<AudioAnalysisState>, o?: {
|
|
142
|
+
intervalMs?: number;
|
|
143
|
+
}): Unsubscribe;
|
|
144
|
+
/**
|
|
145
|
+
* Analysis frames of [inputId], or of every input (server default 15 Hz). Events only: nothing arrives while realtime
|
|
146
|
+
* is down, and the ring buffer does not keep frames, so a gap is not replayed.
|
|
147
|
+
*/
|
|
148
|
+
frames(fn: (f: AudioAnalysisFrame) => void, o?: {
|
|
149
|
+
inputId?: string;
|
|
150
|
+
}): Unsubscribe;
|
|
151
|
+
/** Detected attacks of [inputId], or of every input. */
|
|
152
|
+
onsets(fn: (f: AudioOnset) => void, o?: {
|
|
153
|
+
inputId?: string;
|
|
154
|
+
}): Unsubscribe;
|
|
155
|
+
/** Active scene, master intensity, service status. */
|
|
156
|
+
get(): Promise<AudioReactiveState>;
|
|
157
|
+
/** Follows the state (polled every [intervalMs] only while realtime is down). */
|
|
158
|
+
states(obs: WatchObserver<AudioReactiveState>, o?: {
|
|
159
|
+
intervalMs?: number;
|
|
160
|
+
}): Unsubscribe;
|
|
161
|
+
/**
|
|
162
|
+
* Selects a scene, enables the service or sets the intensity (scope `playback:control`; next frame). `activeSceneId:
|
|
163
|
+
* null` stops the running scene. 422 for an unknown scene or one whose gateway or input does not exist.
|
|
164
|
+
*/
|
|
165
|
+
update(o: {
|
|
166
|
+
activeSceneId?: string | null;
|
|
167
|
+
enabled?: boolean;
|
|
168
|
+
intensity?: number;
|
|
169
|
+
}): Promise<AudioReactiveState>;
|
|
170
|
+
/** Scenes stored for this venue. */
|
|
171
|
+
scenes(): Promise<AudioReactiveScene[]>;
|
|
172
|
+
/** One scene with its ETag. */
|
|
173
|
+
scene(sceneId: string): Promise<Versioned<AudioReactiveScene>>;
|
|
174
|
+
/**
|
|
175
|
+
* Stores a scene (scope `content:write`): with [ifMatch] it replaces that revision, without it the scene must be
|
|
176
|
+
* new (`If-None-Match: *`).
|
|
177
|
+
*/
|
|
178
|
+
saveScene(sceneId: string, input: AudioReactiveSceneInput, o?: {
|
|
179
|
+
ifMatch?: string;
|
|
180
|
+
}): Promise<Versioned<AudioReactiveScene>>;
|
|
181
|
+
/** Removes a scene ([ifMatch] read when absent). 409 while it is active. */
|
|
182
|
+
deleteScene(sceneId: string, o?: {
|
|
183
|
+
ifMatch?: string;
|
|
184
|
+
}): Promise<void>;
|
|
185
|
+
/** Senders the engines of this venue can see. To show one, register a `stream` asset with the matching `src`. */
|
|
186
|
+
textureSources(): Promise<TextureSource[]>;
|
|
187
|
+
/** Changes of any texture source of this venue (events only). */
|
|
188
|
+
textureSourceChanges(fn: (s: TextureSource) => void): Unsubscribe;
|
|
189
|
+
/** `resource` of the [kind] events of [filter]; events without one are skipped. */
|
|
190
|
+
private decoded;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/** Mode, master gain / mute, engine status (`GET …/audio`). */
|
|
194
|
+
type AudioState = OperationResponse<'getAudio'>;
|
|
195
|
+
/** `digital` | `hybrid` | `combined` (or a vendor mode). */
|
|
196
|
+
type AudioMode = AudioState['mode'];
|
|
197
|
+
/** Speaker layout (the venue's `.dome` `audio` block). */
|
|
198
|
+
type AudioLayout = OperationResponse<'getSpeakerLayout'>;
|
|
199
|
+
/** A zone (group of speakers with gain / delay / EQ / mute). */
|
|
200
|
+
type AudioZone = OperationResponse<'getAudioZone'>;
|
|
201
|
+
/** Zone create / replace body. */
|
|
202
|
+
type AudioZoneInput = OperationBody<'putAudioZone'>;
|
|
203
|
+
/** Zone merge patch. */
|
|
204
|
+
type AudioZonePatch = OperationBody<'patchAudioZone'>;
|
|
205
|
+
/** Audio device (speaker, amp, microphone, QRD hub, Patefon …). */
|
|
206
|
+
type AudioDevice = OperationResponse<'getAudioDevice'>;
|
|
207
|
+
/** Device kind (`speaker`, `qrd`, `patefon`, … or a vendor kind). */
|
|
208
|
+
type AudioDeviceKind = AudioDevice['kind'];
|
|
209
|
+
/** Device merge patch (name / gain / mute / config). */
|
|
210
|
+
type AudioDevicePatch = OperationBody<'patchAudioDevice'>;
|
|
211
|
+
/** Device test request (ping / tone / selftest / strike). */
|
|
212
|
+
type AudioDeviceTest = OperationBody<'testAudioDevice'>;
|
|
213
|
+
/** Device test result. */
|
|
214
|
+
type AudioDeviceTestResult = OperationResponse<'testAudioDevice'>;
|
|
215
|
+
/** An installed ananta/1.0 programme, pattern or session preset. */
|
|
216
|
+
type AudioPreset = OperationResponse<'getAudioPreset'>;
|
|
217
|
+
/**
|
|
218
|
+
* Preset install body: `kind` + an ananta/1.0 programme / pattern / session `document` (validated by the server; the
|
|
219
|
+
* generated schema type of `document` is an empty object, so it is widened here).
|
|
220
|
+
*/
|
|
221
|
+
interface AudioPresetInput {
|
|
222
|
+
kind: OperationBody<'putAudioPreset'>['kind'];
|
|
223
|
+
document: Record<string, unknown>;
|
|
224
|
+
}
|
|
225
|
+
/** Preset summary of the list. */
|
|
226
|
+
type AudioPresetSummary = OperationResponse<'listAudioPresets'>['items'][number];
|
|
227
|
+
/** A running / finished preset session. */
|
|
228
|
+
type AudioSession = OperationResponse<'getAudioSession'>;
|
|
229
|
+
/** Generator settings (signal, frequencies, gain, duration, targets). */
|
|
230
|
+
type GeneratorSettings = OperationBody<'setGenerator'>;
|
|
231
|
+
/**
|
|
232
|
+
* NmSoundParams of a MULTI generator (`program`, `target`, `enviroment`, `modulation`, `multi`, `channel`, `audio`,
|
|
233
|
+
* `compatJava`), the object `multi` of an ananta/1.0 programme segment. Contract 1.1.0.
|
|
234
|
+
*/
|
|
235
|
+
type GeneratorMulti = Partial<NonNullable<GeneratorSettings['multi']>>;
|
|
236
|
+
/** Generator state (`running`, settings, startedAt). */
|
|
237
|
+
type GeneratorState = OperationResponse<'getGenerator'>;
|
|
238
|
+
/** Spherical source position (listener at the dome centre). */
|
|
239
|
+
type SourcePosition = OperationBody<'setSourcePosition'>;
|
|
240
|
+
/** Session targets (devices / zones / speakers). */
|
|
241
|
+
type AudioTargets = NonNullable<OperationBody<'startAudioSession'>['targets']>;
|
|
242
|
+
/** Preset role → the zones it plays in. Contract 1.1.0. */
|
|
243
|
+
type AudioRoleZones = NonNullable<OperationBody<'startAudioSession'>['roleZones']>;
|
|
244
|
+
/** Resonance sweep request (every member optional; the defaults are the engine's). Contract 1.1.0. */
|
|
245
|
+
type AudioDeviceSweep = Partial<NonNullable<OperationBody<'startAudioDeviceSweep'>>>;
|
|
246
|
+
/** Calibration job of kind `audio-device-sweep`; its member `sweep` holds the result. */
|
|
247
|
+
type AudioDeviceSweepJob = OperationResponse<'startAudioDeviceSweep'>;
|
|
248
|
+
/** Session start options. */
|
|
249
|
+
interface AudioSessionStart {
|
|
250
|
+
presetId: string;
|
|
251
|
+
gainDb?: number;
|
|
252
|
+
targets?: AudioTargets;
|
|
253
|
+
/** Zones per role; needs [AudioRepository.supportsAudioControl]. */
|
|
254
|
+
roleZones?: AudioRoleZones;
|
|
255
|
+
/** Server time to start at (multi-node sync). */
|
|
256
|
+
at?: Date | string;
|
|
257
|
+
loop?: boolean;
|
|
258
|
+
}
|
|
259
|
+
/** Meters `{meter id: dBFS}`. */
|
|
260
|
+
type AudioLevels = Record<string, number>;
|
|
261
|
+
/** Whether an audio session status is final (`finished` / `stopped` / `failed`). */
|
|
262
|
+
declare function audioSessionEnded(status: unknown): boolean;
|
|
263
|
+
/** Audio of one venue (`client.audio` = the active venue; `client.audio.venue(id)` for another). */
|
|
264
|
+
declare class AudioRepository {
|
|
265
|
+
private readonly c;
|
|
266
|
+
readonly venueId: string;
|
|
267
|
+
private readonly venues;
|
|
268
|
+
constructor(c: RepositoryContext, venueId?: string);
|
|
269
|
+
/** @internal */
|
|
270
|
+
get ctx(): RepositoryContext;
|
|
271
|
+
private get v();
|
|
272
|
+
/**
|
|
273
|
+
* Whether the server has the audio additions of contract 1.1.0: [pauseSession], [resumeSession], [startDeviceSweep],
|
|
274
|
+
* `roleZones` of [startSession] and the `multi` block of the generator. False against a 1.0 server and while its
|
|
275
|
+
* contract version is not known.
|
|
276
|
+
*/
|
|
277
|
+
get supportsAudioControl(): boolean;
|
|
278
|
+
/** @internal A 1.0 server would answer 404 or 422: says why instead. Sent as it is when the version is not known. */
|
|
279
|
+
requireAudioControl(what: string): void;
|
|
280
|
+
/** The same repository for another venue. */
|
|
281
|
+
venue(id: string): AudioRepository;
|
|
282
|
+
/** Mode, master gain / mute, engine status. */
|
|
283
|
+
get(): Promise<AudioState>;
|
|
284
|
+
/**
|
|
285
|
+
* Follows the audio state: `audio.state` events of `venues/{v}/audio`, re-read after resync, polled every
|
|
286
|
+
* [intervalMs] only while realtime is down. Returns the stop function.
|
|
287
|
+
*/
|
|
288
|
+
state(obs: WatchObserver<AudioState>, o?: {
|
|
289
|
+
intervalMs?: number;
|
|
290
|
+
}): Unsubscribe;
|
|
291
|
+
/** Changes mode / master gain / mute (live control, scope `audio:control`; never queued offline). */
|
|
292
|
+
setMaster(o: {
|
|
293
|
+
masterGainDb?: number;
|
|
294
|
+
mute?: boolean;
|
|
295
|
+
mode?: AudioMode;
|
|
296
|
+
}): Promise<AudioState>;
|
|
297
|
+
/**
|
|
298
|
+
* Meters (`audio.levels` of `venues/{v}/audio/levels`, server rate ≤ 10 Hz), decimated here to at most [maxHz]:
|
|
299
|
+
* intermediate values are dropped, the latest one is always delivered at the end of the window.
|
|
300
|
+
*/
|
|
301
|
+
levels(fn: (levels: AudioLevels) => void, o?: {
|
|
302
|
+
maxHz?: number;
|
|
303
|
+
}): Unsubscribe;
|
|
304
|
+
/** Speaker layout with its ETag. */
|
|
305
|
+
layout(): Promise<Versioned<AudioLayout>>;
|
|
306
|
+
/** Replaces the speaker layout (scope `venues:write`; [ifMatch] = ETag of [layout], read when absent). */
|
|
307
|
+
saveLayout(layout: AudioLayout, o?: {
|
|
308
|
+
ifMatch?: string;
|
|
309
|
+
}): Promise<Versioned<AudioLayout>>;
|
|
310
|
+
/** Zones of the venue. */
|
|
311
|
+
zones(): Promise<AudioZone[]>;
|
|
312
|
+
/** One zone. */
|
|
313
|
+
zone(zoneId: string): Promise<AudioZone>;
|
|
314
|
+
/** Zone gain in dB (live control). */
|
|
315
|
+
setZoneGain(zoneId: string, db: number): Promise<AudioZone>;
|
|
316
|
+
/** Mutes / unmutes a zone (live control). */
|
|
317
|
+
setMute(zoneId: string, muted: boolean): Promise<AudioZone>;
|
|
318
|
+
/** Merge-patches a zone (gain, delay, EQ, mute, speakers; live control). */
|
|
319
|
+
patchZone(zoneId: string, patch: AudioZonePatch): Promise<AudioZone>;
|
|
320
|
+
/** Creates ([ifMatch] absent → `If-None-Match: *`) or replaces a zone. */
|
|
321
|
+
saveZone(zoneId: string, body: AudioZoneInput, o?: {
|
|
322
|
+
ifMatch?: string;
|
|
323
|
+
}): Promise<AudioZone>;
|
|
324
|
+
/** Deletes a zone ([ifMatch] = `"r<revision>"`, read when absent). */
|
|
325
|
+
deleteZone(zoneId: string, o?: {
|
|
326
|
+
ifMatch?: string;
|
|
327
|
+
}): Promise<void>;
|
|
328
|
+
/** Follows a zone (`zone.state` merge patches applied); stops after `zone.deleted` (`obs.deleted` is called). */
|
|
329
|
+
zoneState(zoneId: string, obs: WatchObserver<AudioZone> & {
|
|
330
|
+
deleted?: () => void;
|
|
331
|
+
}, o?: {
|
|
332
|
+
intervalMs?: number;
|
|
333
|
+
}): Unsubscribe;
|
|
334
|
+
/** Audio devices (speakers, amps, microphones, QRD hubs, Patefon units …), optionally of one [kind]. */
|
|
335
|
+
devices(o?: {
|
|
336
|
+
kind?: AudioDeviceKind;
|
|
337
|
+
}): Promise<AudioDevice[]>;
|
|
338
|
+
/** One device. */
|
|
339
|
+
device(deviceId: string): Promise<AudioDevice>;
|
|
340
|
+
/** Operator gain / mute / name / config of a device. */
|
|
341
|
+
patchDevice(deviceId: string, patch: AudioDevicePatch): Promise<AudioDevice>;
|
|
342
|
+
/**
|
|
343
|
+
* Resonance sweep of one resonator channel of [deviceId] (scope `audio:calibrate`): answers a calibration job of kind
|
|
344
|
+
* `audio-device-sweep`. Follow it with `client.calibration.progress`; progress is elapsed time, not measurement, and
|
|
345
|
+
* the job's `sweep` member holds `peaks`, and with `modelHz` also `partials` and `warnings`, once it has succeeded.
|
|
346
|
+
* There is nothing to apply. 409 while a session uses the device, another sweep runs or the device is in emergency
|
|
347
|
+
* stop; 422 without such a resonator channel. Needs [supportsAudioControl].
|
|
348
|
+
*/
|
|
349
|
+
startDeviceSweep(deviceId: string, sweep?: AudioDeviceSweep): Promise<AudioDeviceSweepJob>;
|
|
350
|
+
/** Ping / tone / self-test / strike of a device. */
|
|
351
|
+
testDevice(deviceId: string, test?: AudioDeviceTest): Promise<AudioDeviceTestResult>;
|
|
352
|
+
/** Follows a device (`audioDevice.state`, telemetry patches ≤ 1 Hz). */
|
|
353
|
+
deviceState(deviceId: string, obs: WatchObserver<AudioDevice>, o?: {
|
|
354
|
+
intervalMs?: number;
|
|
355
|
+
}): Unsubscribe;
|
|
356
|
+
/** Installed presets (summaries). */
|
|
357
|
+
presets(): Promise<AudioPresetSummary[]>;
|
|
358
|
+
/** One preset with its document and ETag. */
|
|
359
|
+
preset(presetId: string): Promise<Versioned<AudioPreset>>;
|
|
360
|
+
/**
|
|
361
|
+
* Installs / replaces an ananta/1.0 programme, pattern or session document (scope `content:write`). Without
|
|
362
|
+
* [ifMatch] an existing preset is overwritten (last writer wins).
|
|
363
|
+
*/
|
|
364
|
+
savePreset(presetId: string, input: AudioPresetInput, o?: {
|
|
365
|
+
ifMatch?: string;
|
|
366
|
+
}): Promise<Versioned<AudioPreset>>;
|
|
367
|
+
/** Removes a preset ([ifMatch] read when absent). */
|
|
368
|
+
deletePreset(presetId: string, o?: {
|
|
369
|
+
ifMatch?: string;
|
|
370
|
+
}): Promise<void>;
|
|
371
|
+
/** Runs an installed preset (live control). */
|
|
372
|
+
startSession(s: AudioSessionStart): Promise<AudioSession>;
|
|
373
|
+
/** Sessions of the venue. */
|
|
374
|
+
sessions(): Promise<AudioSession[]>;
|
|
375
|
+
/** One session. */
|
|
376
|
+
session(sessionId: string): Promise<AudioSession>;
|
|
377
|
+
/** Follows a session until it ends (`finished` / `stopped` / `failed`), then stops by itself. */
|
|
378
|
+
sessionState(sessionId: string, obs: WatchObserver<AudioSession>, o?: {
|
|
379
|
+
intervalMs?: number;
|
|
380
|
+
}): Unsubscribe;
|
|
381
|
+
/**
|
|
382
|
+
* Pauses a session (live control, scope `audio:control`): every engine holds its position, `audioSession.state`
|
|
383
|
+
* follows. A paused session answers as it is; 409 for one that is starting or has ended. Needs
|
|
384
|
+
* [supportsAudioControl].
|
|
385
|
+
*/
|
|
386
|
+
pauseSession(sessionId: string): Promise<AudioSession>;
|
|
387
|
+
/**
|
|
388
|
+
* Resumes a paused session from its position (live control, scope `audio:control`). A running session answers as it
|
|
389
|
+
* is; 409 for one that is starting or has ended. Needs [supportsAudioControl].
|
|
390
|
+
*/
|
|
391
|
+
resumeSession(sessionId: string): Promise<AudioSession>;
|
|
392
|
+
/** Stops a session (live control). */
|
|
393
|
+
stopSession(sessionId: string): Promise<void>;
|
|
394
|
+
/** The venue's test / MULTI generator (backs the dome sound engine). Close it when done. */
|
|
395
|
+
generator(): GeneratorSession;
|
|
396
|
+
/** Moves interactive source [sourceId] (spherical, listener at the dome centre; live control). */
|
|
397
|
+
setSourcePosition(sourceId: string, position: SourcePosition): Promise<void>;
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* The venue generator (`…/audio/generator`): [start] / change, [stop], and its state from `generator.state` events —
|
|
401
|
+
* read over REST once and after a resync, never polled while realtime is up.
|
|
402
|
+
*/
|
|
403
|
+
declare class GeneratorSession {
|
|
404
|
+
private readonly r;
|
|
405
|
+
/** State changes. */
|
|
406
|
+
readonly states: Emitter<{
|
|
407
|
+
running: boolean;
|
|
408
|
+
settings?: {
|
|
409
|
+
signal: ("sine" | "pink" | "white" | "sweep" | "multi") | string;
|
|
410
|
+
frequencies?: number[];
|
|
411
|
+
gainDb?: number;
|
|
412
|
+
durationS?: number;
|
|
413
|
+
targets?: {
|
|
414
|
+
devices?: string[];
|
|
415
|
+
zones?: string[];
|
|
416
|
+
speakers?: string[];
|
|
417
|
+
};
|
|
418
|
+
multi?: {
|
|
419
|
+
program?: string;
|
|
420
|
+
target?: number;
|
|
421
|
+
enviroment?: number;
|
|
422
|
+
modulation?: number;
|
|
423
|
+
multi?: number;
|
|
424
|
+
channel?: number;
|
|
425
|
+
audio?: number;
|
|
426
|
+
compatJava: boolean;
|
|
427
|
+
} & {
|
|
428
|
+
[key: string]: unknown;
|
|
429
|
+
};
|
|
430
|
+
};
|
|
431
|
+
startedAt?: string;
|
|
432
|
+
}>;
|
|
433
|
+
private value;
|
|
434
|
+
private readonly offEvents;
|
|
435
|
+
private readonly offSnapshot;
|
|
436
|
+
private poll;
|
|
437
|
+
private closed;
|
|
438
|
+
constructor(r: AudioRepository);
|
|
439
|
+
private get v();
|
|
440
|
+
/** Latest known state (undefined before the first read / event). */
|
|
441
|
+
get last(): GeneratorState | undefined;
|
|
442
|
+
private push;
|
|
443
|
+
/**
|
|
444
|
+
* Watches the state (replays the latest; reads once when unknown). Polls every [pollMs] only while realtime is
|
|
445
|
+
* down. Returns the unsubscribe function.
|
|
446
|
+
*/
|
|
447
|
+
watch(fn: (s: GeneratorState) => void, o?: {
|
|
448
|
+
pollMs?: number;
|
|
449
|
+
}): Unsubscribe;
|
|
450
|
+
/** Reads the state over REST. */
|
|
451
|
+
get(): Promise<GeneratorState>;
|
|
452
|
+
/**
|
|
453
|
+
* Starts the generator or replaces its settings (live control, scope `audio:control`). The `multi` block needs
|
|
454
|
+
* [AudioRepository.supportsAudioControl].
|
|
455
|
+
*/
|
|
456
|
+
start(settings: GeneratorSettings): Promise<GeneratorState>;
|
|
457
|
+
/**
|
|
458
|
+
* Plays a MULTI programme: `signal: multi` with the block [multi], the same object a phone gives to `setParams`
|
|
459
|
+
* (contract 1.1.0, `docs/audio-control.md`).
|
|
460
|
+
*/
|
|
461
|
+
startMulti(multi: GeneratorMulti, o?: Pick<GeneratorSettings, 'gainDb' | 'durationS' | 'targets'>): Promise<GeneratorState>;
|
|
462
|
+
/** Stops the generator (live control). */
|
|
463
|
+
stop(): Promise<void>;
|
|
464
|
+
private refreshQuietly;
|
|
465
|
+
/** Stops following the generator (does not stop it). */
|
|
466
|
+
close(): void;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
/** A camera frame for a capture step. */
|
|
470
|
+
interface CaptureFrame {
|
|
471
|
+
bytes: Uint8Array;
|
|
472
|
+
contentType?: string;
|
|
473
|
+
stepId?: string;
|
|
474
|
+
fileName?: string;
|
|
475
|
+
}
|
|
476
|
+
/** multipart/form-data body. */
|
|
477
|
+
declare function multipart(parts: ({
|
|
478
|
+
name: string;
|
|
479
|
+
value: string;
|
|
480
|
+
} | {
|
|
481
|
+
name: string;
|
|
482
|
+
fileName: string;
|
|
483
|
+
contentType: string;
|
|
484
|
+
bytes: Uint8Array;
|
|
485
|
+
})[]): [string, Uint8Array];
|
|
486
|
+
/** Visual calibration jobs. */
|
|
487
|
+
declare class CalibrationRepository {
|
|
488
|
+
private readonly c;
|
|
489
|
+
constructor(c: RepositoryContext);
|
|
490
|
+
start(request: OperationBody<'startCalibrationJob'>, venueId?: string): Promise<CalibrationJob>;
|
|
491
|
+
/**
|
|
492
|
+
* Audio room calibration (speakers play → microphones capture → the solver proposes delay / gain / EQ per speaker):
|
|
493
|
+
* job kind `audio-room`, scope `audio:calibrate`.
|
|
494
|
+
*/
|
|
495
|
+
startAudioRoom(o?: {
|
|
496
|
+
speakers?: string[];
|
|
497
|
+
options?: Record<string, unknown>;
|
|
498
|
+
venueId?: string;
|
|
499
|
+
}): Promise<CalibrationJob>;
|
|
500
|
+
get(jobId: string, venueId?: string): Promise<CalibrationJob>;
|
|
501
|
+
/** Follows a job until it is terminal. */
|
|
502
|
+
progress(jobId: string, obs: WatchObserver<CalibrationJob>, venueId?: string, intervalMs?: number): Unsubscribe;
|
|
503
|
+
/** Submits a camera frame (≤ 32 MB, multipart). */
|
|
504
|
+
submitCapture(jobId: string, frame: CaptureFrame, venueId?: string): Promise<CalibrationJob>;
|
|
505
|
+
cancel(jobId: string, venueId?: string): Promise<CalibrationJob>;
|
|
506
|
+
/** Writes the job result into the venue calibration. */
|
|
507
|
+
apply(jobId: string, venueId?: string): Promise<CalibrationState>;
|
|
508
|
+
/** The venue's calibration block. */
|
|
509
|
+
results(venueId?: string): Promise<CalibrationState>;
|
|
510
|
+
/** Calibration jobs of the venue. */
|
|
511
|
+
jobs(venueId?: string): Promise<CalibrationJob[]>;
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
/** Registration of this app instance as a client device, telemetry, commands. */
|
|
515
|
+
declare class ClientsRepository {
|
|
516
|
+
private readonly c;
|
|
517
|
+
constructor(c: RepositoryContext);
|
|
518
|
+
register(registration: ClientRegistration): Promise<ClientDevice>;
|
|
519
|
+
list(): Promise<ClientDevice[]>;
|
|
520
|
+
telemetry(clientId: string, batch: ClientTelemetry): Promise<void>;
|
|
521
|
+
unregister(clientId: string): Promise<void>;
|
|
522
|
+
/** Commands the dome sends to this device (`clients/{id}/commands`). */
|
|
523
|
+
commands(clientId: string, fn: (command: string, args: unknown) => void): Unsubscribe;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
/** Filter of `list`. */
|
|
527
|
+
interface ContentQuery {
|
|
528
|
+
type?: string;
|
|
529
|
+
tag?: string;
|
|
530
|
+
q?: string;
|
|
531
|
+
status?: string;
|
|
532
|
+
limit?: number;
|
|
533
|
+
}
|
|
534
|
+
/** A change of the content store (`assets/{a}` events). */
|
|
535
|
+
interface ContentChange {
|
|
536
|
+
kind: string;
|
|
537
|
+
assetId: string;
|
|
538
|
+
asset?: AssetResource;
|
|
539
|
+
progress?: number;
|
|
540
|
+
}
|
|
541
|
+
/** tus capabilities (`OPTIONS /uploads`). */
|
|
542
|
+
interface UploadCapabilities {
|
|
543
|
+
version: string[];
|
|
544
|
+
extensions: string[];
|
|
545
|
+
maxSize?: number;
|
|
546
|
+
checksumAlgorithms?: string[];
|
|
547
|
+
}
|
|
548
|
+
/** Content of the media server. */
|
|
549
|
+
declare class ContentRepository {
|
|
550
|
+
private readonly c;
|
|
551
|
+
private readonly tasks;
|
|
552
|
+
readonly parts: ShowParts;
|
|
553
|
+
constructor(c: RepositoryContext);
|
|
554
|
+
/** One page of assets (first pages cache-backed). */
|
|
555
|
+
list(query?: ContentQuery, cursor?: string): Promise<Page<AssetResource>>;
|
|
556
|
+
get(assetId: string): Promise<AssetResource>;
|
|
557
|
+
/** Starts a resumable upload creating an asset (await `task.done`). */
|
|
558
|
+
upload(source: ContentSource | Uint8Array, o?: {
|
|
559
|
+
asset?: AssetCreateRequest;
|
|
560
|
+
chunkSize?: number;
|
|
561
|
+
name?: string;
|
|
562
|
+
}): UploadTask;
|
|
563
|
+
/** Continues a persisted upload (same [source]). */
|
|
564
|
+
resumeUpload(uploadId: string, source: ContentSource, o?: {
|
|
565
|
+
sha256?: string;
|
|
566
|
+
asset?: AssetCreateRequest;
|
|
567
|
+
purpose?: UploadPurpose;
|
|
568
|
+
}): UploadTask;
|
|
569
|
+
/** Uploads for another purpose (import / restore / capture), no asset. */
|
|
570
|
+
uploadFor(purpose: UploadPurpose, source: ContentSource): UploadTask;
|
|
571
|
+
private track;
|
|
572
|
+
/** Uploads in progress. */
|
|
573
|
+
get uploads(): UploadTask[];
|
|
574
|
+
/** Uploads [source] and runs an import job; returns the finished job (rejects when it failed). */
|
|
575
|
+
importFile(source: ContentSource, format: ImportRequest['format'], o?: {
|
|
576
|
+
target?: ImportRequest['target'];
|
|
577
|
+
timeoutMs?: number;
|
|
578
|
+
}): Promise<Job>;
|
|
579
|
+
/** Imports `.dome` bytes (kind show / bundle) and returns the created show. */
|
|
580
|
+
publishShow(dome: Uint8Array, name?: string): Promise<ShowResource>;
|
|
581
|
+
/** Polls a job until terminal; failed / cancelled reject. */
|
|
582
|
+
waitJob(job: Job, o?: {
|
|
583
|
+
timeoutMs?: number;
|
|
584
|
+
pollMs?: number;
|
|
585
|
+
}): Promise<Job>;
|
|
586
|
+
/** Merge-patches an asset (ETag read first when not given). */
|
|
587
|
+
patch(assetId: string, patch: Record<string, unknown>, ifMatch?: string): Promise<AssetResource>;
|
|
588
|
+
/** Deletes an asset (409 while referenced unless [force]). */
|
|
589
|
+
delete(assetId: string, o?: {
|
|
590
|
+
force?: boolean;
|
|
591
|
+
ifMatch?: string;
|
|
592
|
+
}): Promise<void>;
|
|
593
|
+
thumbnail(assetId: string, size?: number): Promise<Uint8Array>;
|
|
594
|
+
download(assetId: string): Promise<Uint8Array>;
|
|
595
|
+
storage(): Promise<StorageStats>;
|
|
596
|
+
/** Changes of the content store. */
|
|
597
|
+
changes(fn: (c: ContentChange) => void): Unsubscribe;
|
|
598
|
+
listShows(o?: {
|
|
599
|
+
q?: string;
|
|
600
|
+
cursor?: string;
|
|
601
|
+
limit?: number;
|
|
602
|
+
}): Promise<Page<ShowSummary>>;
|
|
603
|
+
getShow(showId: string): Promise<Versioned<ShowResource>>;
|
|
604
|
+
createShow(body: ShowInput): Promise<Versioned<ShowResource>>;
|
|
605
|
+
/** Replaces a show (`ifMatch`; without: create with If-None-Match: *). Queued in the outbox while offline. */
|
|
606
|
+
saveShow(showId: string, body: ShowInput, ifMatch?: string): Promise<Versioned<ShowResource>>;
|
|
607
|
+
patchShow(showId: string, patch: Record<string, unknown>, ifMatch?: string): Promise<Versioned<ShowResource>>;
|
|
608
|
+
deleteShow(showId: string, ifMatch: string): Promise<void>;
|
|
609
|
+
/** Exports a show as `.dome` bytes. */
|
|
610
|
+
exportShow(showId: string, embedAssets?: boolean): Promise<Uint8Array>;
|
|
611
|
+
/** tus capabilities. */
|
|
612
|
+
uploadCapabilities(): Promise<UploadCapabilities>;
|
|
613
|
+
uploadStatus(uploadId: string): Promise<UploadStatus>;
|
|
614
|
+
/** Watch hook used by apps showing one asset. */
|
|
615
|
+
watchAsset(assetId: string, fn: (a: AssetResource) => void): Unsubscribe;
|
|
616
|
+
}
|
|
617
|
+
type Part = 'Playlist' | 'Timeline' | 'Cue' | 'Trigger';
|
|
618
|
+
/** Single show parts (writes send the show ETag, read first when not given). */
|
|
619
|
+
declare class ShowParts {
|
|
620
|
+
private readonly c;
|
|
621
|
+
constructor(c: RepositoryContext);
|
|
622
|
+
private etag;
|
|
623
|
+
get<P extends Part>(part: P, showId: string, itemId: string): Promise<OperationResponse<`get${P}`>>;
|
|
624
|
+
put<P extends Part>(part: P, showId: string, item: {
|
|
625
|
+
id: string;
|
|
626
|
+
} & Record<string, unknown>, ifMatch?: string): Promise<OperationResponse<`put${P}`>>;
|
|
627
|
+
delete(part: Part, showId: string, itemId: string, ifMatch?: string): Promise<void>;
|
|
628
|
+
matrix(showId: string): Promise<OperationResponse<'getMatrix'>>;
|
|
629
|
+
putMatrix(showId: string, matrix: Record<string, unknown>, ifMatch?: string): Promise<OperationResponse<'putMatrix'>>;
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
/** Display state. */
|
|
633
|
+
type DisplayState = OperationResponse<'setTestPattern'>;
|
|
634
|
+
/** Engines, outputs, test patterns, identify, power. */
|
|
635
|
+
declare class EngineRepository {
|
|
636
|
+
private readonly c;
|
|
637
|
+
constructor(c: RepositoryContext);
|
|
638
|
+
/** Every engine (visual, audio, …; `name@node` on multi-node installations). */
|
|
639
|
+
engines(): Promise<EngineStatus[]>;
|
|
640
|
+
/** Displays of a venue. */
|
|
641
|
+
outputs(venueId?: string): Promise<DisplayResource[]>;
|
|
642
|
+
/** One display. */
|
|
643
|
+
display(displayId: string, venueId?: string): Promise<DisplayResource>;
|
|
644
|
+
/** Shows a test pattern on a display. */
|
|
645
|
+
showTestPattern(displayId: string, pattern: OperationBody<'setTestPattern'>, venueId?: string): Promise<DisplayState>;
|
|
646
|
+
/** Clears the test pattern. */
|
|
647
|
+
clearTestPattern(displayId: string, venueId?: string): Promise<DisplayState>;
|
|
648
|
+
/** Flashes the id overlay. */
|
|
649
|
+
identify(displayId: string, durationMs?: number, venueId?: string): Promise<void>;
|
|
650
|
+
/** Power / shutter (what `state.capabilities` lists). */
|
|
651
|
+
setPower(displayId: string, request: OperationBody<'setDisplayPower'>, venueId?: string): Promise<OperationResponse<'setDisplayPower'>>;
|
|
652
|
+
/** Status of engine [name]. */
|
|
653
|
+
engineStatus(name?: string): Promise<EngineStatus>;
|
|
654
|
+
/** Watches an engine (feeds the `degraded` state for the visual engine). */
|
|
655
|
+
status(obs: WatchObserver<EngineStatus>, name?: string, intervalMs?: number): Unsubscribe;
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
/** A gateway or driver of this server. */
|
|
659
|
+
type Gateway = OperationResponse<'getGateway'>;
|
|
660
|
+
/** Merge patch of `enabled`, `config` or `allowCidrs`. */
|
|
661
|
+
type GatewayPatch = OperationBody<'patchGateway'>;
|
|
662
|
+
/** Result of a connectivity test. */
|
|
663
|
+
type GatewayTestResult = OperationResponse<'testGateway'>;
|
|
664
|
+
/** Gateways of this server. */
|
|
665
|
+
declare class GatewaysRepository {
|
|
666
|
+
private readonly c;
|
|
667
|
+
constructor(c: RepositoryContext);
|
|
668
|
+
/** Every gateway. */
|
|
669
|
+
list(): Promise<Gateway[]>;
|
|
670
|
+
/** One gateway with its ETag. */
|
|
671
|
+
get(gatewayId: string): Promise<Versioned<Gateway>>;
|
|
672
|
+
/**
|
|
673
|
+
* Merge-patches a gateway ([ifMatch] read when absent). The server validates `config` for the gateway's protocol
|
|
674
|
+
* and answers 422 when it refuses it.
|
|
675
|
+
*/
|
|
676
|
+
patch(gatewayId: string, patch: GatewayPatch, o?: {
|
|
677
|
+
ifMatch?: string;
|
|
678
|
+
}): Promise<Versioned<Gateway>>;
|
|
679
|
+
/** Runs the gateway's connectivity test. */
|
|
680
|
+
test(gatewayId: string): Promise<GatewayTestResult>;
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
/** OSC argument with an explicit type tag. */
|
|
684
|
+
interface OscArg {
|
|
685
|
+
type: string;
|
|
686
|
+
value?: unknown;
|
|
687
|
+
}
|
|
688
|
+
/** One OSC message seen on a gateway. */
|
|
689
|
+
interface OscMessage {
|
|
690
|
+
address: string;
|
|
691
|
+
args: unknown[];
|
|
692
|
+
target?: string;
|
|
693
|
+
}
|
|
694
|
+
/** Maps a JS value to a contract OSC argument (`i` / `f` / `s` / `T` / `F` / `N` / `b` / `t`). */
|
|
695
|
+
declare function oscArg(a: unknown): OscArg;
|
|
696
|
+
/** OSC through the media server. */
|
|
697
|
+
declare class OscRepository {
|
|
698
|
+
private readonly c;
|
|
699
|
+
constructor(c: RepositoryContext);
|
|
700
|
+
/** Sends [address] [args] to the configured OSC [target] (gateway / target id). */
|
|
701
|
+
send(address: string, args: unknown[], target: string): Promise<void>;
|
|
702
|
+
/** OSC traffic of gateways (`gateway.message` events). */
|
|
703
|
+
messages(fn: (m: OscMessage) => void, gatewayId?: string): Unsubscribe;
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
/** What to play. */
|
|
707
|
+
type PlayTarget = {
|
|
708
|
+
kind: 'show';
|
|
709
|
+
showId: string;
|
|
710
|
+
playlistId?: string;
|
|
711
|
+
itemIndex?: number;
|
|
712
|
+
} | {
|
|
713
|
+
kind: 'playlist';
|
|
714
|
+
playlistId: string;
|
|
715
|
+
showId?: string;
|
|
716
|
+
itemIndex?: number;
|
|
717
|
+
} | {
|
|
718
|
+
kind: 'asset';
|
|
719
|
+
assetId: string;
|
|
720
|
+
} | {
|
|
721
|
+
kind: 'app';
|
|
722
|
+
app: string;
|
|
723
|
+
payload: AppPayload;
|
|
724
|
+
} | {
|
|
725
|
+
kind: 'current';
|
|
726
|
+
};
|
|
727
|
+
/** Play-target constructors. */
|
|
728
|
+
declare const PlayTargets: {
|
|
729
|
+
readonly show: (showId: string, o?: {
|
|
730
|
+
playlistId?: string;
|
|
731
|
+
itemIndex?: number;
|
|
732
|
+
}) => PlayTarget;
|
|
733
|
+
readonly playlist: (playlistId: string, o?: {
|
|
734
|
+
showId?: string;
|
|
735
|
+
itemIndex?: number;
|
|
736
|
+
}) => PlayTarget;
|
|
737
|
+
readonly asset: (assetId: string) => PlayTarget;
|
|
738
|
+
readonly app: (app: string, payload: AppPayload) => PlayTarget;
|
|
739
|
+
readonly current: () => PlayTarget;
|
|
740
|
+
};
|
|
741
|
+
/** Player state + freshness. */
|
|
742
|
+
interface PlaybackSnapshot {
|
|
743
|
+
state: PlayerState;
|
|
744
|
+
stale?: boolean;
|
|
745
|
+
asOf?: Date;
|
|
746
|
+
}
|
|
747
|
+
/** One player of one venue. */
|
|
748
|
+
declare class PlayerHandle {
|
|
749
|
+
private readonly c;
|
|
750
|
+
readonly venueId: string;
|
|
751
|
+
readonly playerId: string;
|
|
752
|
+
readonly states: Emitter<PlaybackSnapshot>;
|
|
753
|
+
private last;
|
|
754
|
+
private listeners;
|
|
755
|
+
private offEvents;
|
|
756
|
+
private offSnapshot;
|
|
757
|
+
private readonly faders;
|
|
758
|
+
constructor(c: RepositoryContext, venueId: string, playerId: string);
|
|
759
|
+
private get params();
|
|
760
|
+
/** Latest known state. */
|
|
761
|
+
get value(): PlaybackSnapshot | undefined;
|
|
762
|
+
private push;
|
|
763
|
+
/** Follows the player's state (subscribes while at least one watcher). */
|
|
764
|
+
watch(fn: (s: PlaybackSnapshot) => void): Unsubscribe;
|
|
765
|
+
/** Re-reads the state (cache-backed). */
|
|
766
|
+
refresh(): Promise<PlaybackSnapshot>;
|
|
767
|
+
private command;
|
|
768
|
+
private fader;
|
|
769
|
+
/** Plays [target] (optionally from [positionMs], at server time [at] for multi-node sync). */
|
|
770
|
+
play(target: PlayTarget, o?: {
|
|
771
|
+
positionMs?: number;
|
|
772
|
+
at?: Date;
|
|
773
|
+
}): Promise<PlayerState | undefined>;
|
|
774
|
+
pause(): Promise<PlayerState | undefined>;
|
|
775
|
+
resume(): Promise<PlayerState | undefined>;
|
|
776
|
+
stop(): Promise<PlayerState | undefined>;
|
|
777
|
+
next(): Promise<PlayerState | undefined>;
|
|
778
|
+
previous(): Promise<PlayerState | undefined>;
|
|
779
|
+
/** Seeks (coalesced while scrubbing). */
|
|
780
|
+
seek(positionMs: number): Promise<PlayerState | undefined>;
|
|
781
|
+
seekToMarker(marker: string): Promise<PlayerState | undefined>;
|
|
782
|
+
private patch;
|
|
783
|
+
/** Player volume 0..1 (fader). */
|
|
784
|
+
setVolume(v: number): Promise<PlayerState | undefined>;
|
|
785
|
+
setOpacity(v: number): Promise<PlayerState | undefined>;
|
|
786
|
+
setRate(rate: number): Promise<PlayerState | undefined>;
|
|
787
|
+
setLoop(loop: boolean): Promise<PlayerState | undefined>;
|
|
788
|
+
dispose(): void;
|
|
789
|
+
}
|
|
790
|
+
/** Players, output, cues, active show, parameters. */
|
|
791
|
+
declare class PlaybackRepository {
|
|
792
|
+
private readonly c;
|
|
793
|
+
private readonly players;
|
|
794
|
+
private readonly outputFaders;
|
|
795
|
+
constructor(c: RepositoryContext);
|
|
796
|
+
/** Handle of a player (`main` of the active venue by default). */
|
|
797
|
+
player(venueId?: string, playerId?: string): PlayerHandle;
|
|
798
|
+
private get main();
|
|
799
|
+
get value(): PlaybackSnapshot | undefined;
|
|
800
|
+
watch(fn: (s: PlaybackSnapshot) => void): Unsubscribe;
|
|
801
|
+
list(venueId?: string): Promise<PlayerState[]>;
|
|
802
|
+
play(target: PlayTarget, o?: {
|
|
803
|
+
positionMs?: number;
|
|
804
|
+
at?: Date;
|
|
805
|
+
}): Promise<PlayerState | undefined>;
|
|
806
|
+
pause(): Promise<PlayerState | undefined>;
|
|
807
|
+
resume(): Promise<PlayerState | undefined>;
|
|
808
|
+
stop(): Promise<PlayerState | undefined>;
|
|
809
|
+
seek(positionMs: number): Promise<PlayerState | undefined>;
|
|
810
|
+
next(): Promise<PlayerState | undefined>;
|
|
811
|
+
previous(): Promise<PlayerState | undefined>;
|
|
812
|
+
/** Fires cue [cueId] of the active show (or of [showId]). */
|
|
813
|
+
cue(cueId: string, o?: {
|
|
814
|
+
showId?: string;
|
|
815
|
+
venueId?: string;
|
|
816
|
+
}): Promise<void>;
|
|
817
|
+
/** Loads a show onto the venue. */
|
|
818
|
+
setActiveShow(showId: string, o?: {
|
|
819
|
+
autoplay?: boolean;
|
|
820
|
+
venueId?: string;
|
|
821
|
+
}): Promise<void>;
|
|
822
|
+
activeShow(venueId?: string): Promise<ActiveShowState>;
|
|
823
|
+
parameters(venueId?: string): Promise<ParameterInfo[]>;
|
|
824
|
+
parameter(path: string, venueId?: string): Promise<ParameterInfo>;
|
|
825
|
+
/** Sets a parameter (fader; coalesced). */
|
|
826
|
+
setParameter(path: string, value: unknown, venueId?: string): Promise<void>;
|
|
827
|
+
/** Removes every payload an app published. */
|
|
828
|
+
clearAppPayloads(app: string): Promise<void>;
|
|
829
|
+
/** Master output of a venue. */
|
|
830
|
+
readOutput(venueId?: string): Promise<VenueOutput>;
|
|
831
|
+
/** Follows the master output (`output.changed` events / patches). */
|
|
832
|
+
watchOutput(fn: (o: VenueOutput) => void, venueId?: string): Unsubscribe;
|
|
833
|
+
private patchOutput;
|
|
834
|
+
/** Master volume 0..1. */
|
|
835
|
+
setVolume(v: number, venueId?: string): Promise<VenueOutput | undefined>;
|
|
836
|
+
/** Master brightness 0..1. */
|
|
837
|
+
setBrightness(v: number, venueId?: string): Promise<VenueOutput | undefined>;
|
|
838
|
+
setBlackout(on: boolean, venueId?: string): Promise<VenueOutput | undefined>;
|
|
839
|
+
/** Dome rotation in degrees. */
|
|
840
|
+
setRotation(degrees: number, venueId?: string): Promise<VenueOutput | undefined>;
|
|
841
|
+
dispose(): void;
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
/** Calibration sidecar kinds and their media types. */
|
|
845
|
+
declare const CALIBRATION_FILE_TYPES: {
|
|
846
|
+
readonly warp: "application/vnd.nativemind.freedome.fdmesh";
|
|
847
|
+
readonly blend: "image/png";
|
|
848
|
+
readonly colour: "text/plain";
|
|
849
|
+
};
|
|
850
|
+
/** Venues of the media server (`.dome` kind venue). */
|
|
851
|
+
declare class VenuesRepository {
|
|
852
|
+
private readonly c;
|
|
853
|
+
constructor(c: RepositoryContext);
|
|
854
|
+
private get api();
|
|
855
|
+
/** All venues (cache-backed: `stale` while offline). */
|
|
856
|
+
list(): Promise<Versioned<Venue[]>>;
|
|
857
|
+
/** One venue with its ETag (`default` = the active venue). */
|
|
858
|
+
get(venueId?: string): Promise<Versioned<Venue>>;
|
|
859
|
+
/** The venue the server runs now. */
|
|
860
|
+
current(): Promise<Venue>;
|
|
861
|
+
/** Creates a venue (`POST /venues`; id = `meta.id`). */
|
|
862
|
+
create(body: VenueInput): Promise<Versioned<Venue>>;
|
|
863
|
+
/** Replaces a venue (`ifMatch` = ETag; without it: create with If-None-Match: *). 409 / 412 → ConflictError with `latest`. */
|
|
864
|
+
save(venueId: string, body: VenueInput, ifMatch?: string): Promise<Versioned<Venue>>;
|
|
865
|
+
/** Merge-patches a venue (reads the ETag when not given). */
|
|
866
|
+
patch(venueId: string, patch: Record<string, unknown>, ifMatch?: string): Promise<Versioned<Venue>>;
|
|
867
|
+
/** Watches a venue (events, resync re-read, polling while realtime is down). */
|
|
868
|
+
watch(venueId: string, obs: WatchObserver<Venue>, intervalMs?: number): Unsubscribe;
|
|
869
|
+
/** Exports the venue as `.dome` bytes. */
|
|
870
|
+
export(venueId?: string): Promise<Uint8Array>;
|
|
871
|
+
/** Calibration block with the venue ETag. */
|
|
872
|
+
calibration(venueId?: string): Promise<Versioned<CalibrationState>>;
|
|
873
|
+
/** Bytes of a calibration sidecar. */
|
|
874
|
+
calibrationFile(venueId: string, displayId: string, file: keyof typeof CALIBRATION_FILE_TYPES): Promise<Uint8Array>;
|
|
875
|
+
/** Uploads a calibration sidecar (If-Match = venue ETag, read when not given). */
|
|
876
|
+
putCalibrationFile(venueId: string, displayId: string, file: keyof typeof CALIBRATION_FILE_TYPES, bytes: Uint8Array, ifMatch?: string): Promise<Versioned<CalibrationState>>;
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
/** SDK version (User-Agent / hello). */
|
|
880
|
+
declare const FREEDOME_CLIENT_VERSION = "1.1.0";
|
|
881
|
+
/** Connection states (02f §7.1). */
|
|
882
|
+
type ConnectionState = 'idle' | 'negotiating' | 'incompatible' | 'authenticating' | 'unauthorized' | 'online' | 'degraded' | 'reconnecting' | 'resyncing' | 'offline' | 'closed';
|
|
883
|
+
/** Client options. */
|
|
884
|
+
interface FreedomeClientOptions {
|
|
885
|
+
realtime?: RealtimeTransport;
|
|
886
|
+
requestTimeoutMs?: number;
|
|
887
|
+
heartbeatMs?: number;
|
|
888
|
+
reconnect?: BackoffPolicy;
|
|
889
|
+
offline?: Partial<OfflinePolicy>;
|
|
890
|
+
appName?: string;
|
|
891
|
+
appVersion?: string;
|
|
892
|
+
pairingPollIntervalMs?: number;
|
|
893
|
+
backgroundGraceMs?: number;
|
|
894
|
+
positionHz?: number;
|
|
895
|
+
}
|
|
896
|
+
/** Constructor arguments. */
|
|
897
|
+
interface FreedomeClientInit {
|
|
898
|
+
endpoint: FreedomeEndpoint;
|
|
899
|
+
credentials?: FreedomeCredentials;
|
|
900
|
+
options?: FreedomeClientOptions;
|
|
901
|
+
tokenStore?: TokenStore;
|
|
902
|
+
cache?: CacheStore;
|
|
903
|
+
outbox?: OutboxStore;
|
|
904
|
+
logger?: FreedomeLogger;
|
|
905
|
+
/** REST + socket factory (default: fetch + global WebSocket; `createNodeTransports()` / `createFakeTransport()`). */
|
|
906
|
+
transports?: FreedomeTransportFactory;
|
|
907
|
+
/** Custom realtime connector (overrides the built-in ones). */
|
|
908
|
+
realtimeConnector?: RealtimeConnector;
|
|
909
|
+
random?: () => number;
|
|
910
|
+
}
|
|
911
|
+
/** Default factory: fetch + globalThis.WebSocket. */
|
|
912
|
+
declare function defaultTransports(): FreedomeTransportFactory;
|
|
913
|
+
/** Client of one dome's media server. */
|
|
914
|
+
declare class FreedomeClient {
|
|
915
|
+
readonly credentials: FreedomeCredentials;
|
|
916
|
+
readonly options: Required<Omit<FreedomeClientOptions, 'positionHz' | 'offline'>> & {
|
|
917
|
+
positionHz?: number;
|
|
918
|
+
offline: OfflinePolicy;
|
|
919
|
+
};
|
|
920
|
+
readonly tokenStore: TokenStore;
|
|
921
|
+
readonly cache: CacheStore;
|
|
922
|
+
readonly outbox: OutboxStore | undefined;
|
|
923
|
+
readonly logger: FreedomeLogger | undefined;
|
|
924
|
+
readonly venues: VenuesRepository;
|
|
925
|
+
readonly engine: EngineRepository;
|
|
926
|
+
readonly calibration: CalibrationRepository;
|
|
927
|
+
readonly playback: PlaybackRepository;
|
|
928
|
+
readonly content: ContentRepository;
|
|
929
|
+
readonly osc: OscRepository;
|
|
930
|
+
readonly clients: ClientsRepository;
|
|
931
|
+
readonly audio: AudioRepository;
|
|
932
|
+
readonly audioReactive: AudioReactiveRepository;
|
|
933
|
+
readonly gateways: GatewaysRepository;
|
|
934
|
+
readonly graphql: GraphqlClient;
|
|
935
|
+
/** Connection state changes. */
|
|
936
|
+
readonly states: Emitter<ConnectionState>;
|
|
937
|
+
/** Session changes. */
|
|
938
|
+
readonly sessions: Emitter<Session>;
|
|
939
|
+
private readonly transports;
|
|
940
|
+
private readonly api;
|
|
941
|
+
private readonly hub;
|
|
942
|
+
private readonly ctx;
|
|
943
|
+
private readonly random;
|
|
944
|
+
private readonly customConnector;
|
|
945
|
+
private endpointValue;
|
|
946
|
+
private serverInfo;
|
|
947
|
+
private sessionValue;
|
|
948
|
+
private stateValue;
|
|
949
|
+
private reason;
|
|
950
|
+
private refreshing;
|
|
951
|
+
private channel;
|
|
952
|
+
private offChannel;
|
|
953
|
+
private retry;
|
|
954
|
+
private background;
|
|
955
|
+
private attempt;
|
|
956
|
+
private suspended;
|
|
957
|
+
private engineDegraded;
|
|
958
|
+
private connecting;
|
|
959
|
+
constructor(init: FreedomeClientInit);
|
|
960
|
+
get userAgent(): string;
|
|
961
|
+
get endpoint(): FreedomeEndpoint;
|
|
962
|
+
get server(): ServerInfo | undefined;
|
|
963
|
+
/**
|
|
964
|
+
* Contract version the server reports (`contractVersion` of `GET /info`); undefined before [open], or when the server
|
|
965
|
+
* reports none or an unreadable one. This is how an app tells what a server offers: a 1.0 server has no audio control
|
|
966
|
+
* (`ProtocolVersions.audioControl`, `AudioRepository.supportsAudioControl`).
|
|
967
|
+
*/
|
|
968
|
+
get contractVersion(): SemVer | undefined;
|
|
969
|
+
get state(): ConnectionState;
|
|
970
|
+
/** Reason of `degraded` / `offline` / `reconnecting`. */
|
|
971
|
+
get stateReason(): string | undefined;
|
|
972
|
+
get session(): Session;
|
|
973
|
+
/** Transport of the open realtime channel. */
|
|
974
|
+
get realtimeTransport(): RealtimeTransport | undefined;
|
|
975
|
+
/** Replay results of queued writes. */
|
|
976
|
+
get outboxOutcomes(): Emitter<OutboxOutcome>;
|
|
977
|
+
/** Whether the server advertises [capability] (`transport.ws`, `audio`, dotted paths into `capabilities`). */
|
|
978
|
+
supports(capability: string): boolean;
|
|
979
|
+
/** Events matching [filters] (`+` / `#` wildcards); subscribes while listened to. */
|
|
980
|
+
on(filters: string | string[], fn: Parameters<EventHub['on']>[1]): Unsubscribe;
|
|
981
|
+
/** Raw contract call (escape hatch for operations without a repository method). */
|
|
982
|
+
send(op: ApiOperation, o?: CallOptions): Promise<FreedomeResponse>;
|
|
983
|
+
/** Raw call returning parsed JSON. */
|
|
984
|
+
request(op: ApiOperation, o?: CallOptions & {
|
|
985
|
+
ifMatch?: string;
|
|
986
|
+
}): Promise<unknown>;
|
|
987
|
+
private set;
|
|
988
|
+
private setSession;
|
|
989
|
+
private log;
|
|
990
|
+
/** Negotiates, authenticates and starts realtime. */
|
|
991
|
+
open(): Promise<void>;
|
|
992
|
+
private negotiate;
|
|
993
|
+
private authenticate;
|
|
994
|
+
private tryStored;
|
|
995
|
+
private adopt;
|
|
996
|
+
private pair;
|
|
997
|
+
private refresh;
|
|
998
|
+
private reauthenticate;
|
|
999
|
+
/** Ends the session on the server and locally. */
|
|
1000
|
+
logout(): Promise<void>;
|
|
1001
|
+
private get token();
|
|
1002
|
+
private connector;
|
|
1003
|
+
private startRealtime;
|
|
1004
|
+
private replayOutbox;
|
|
1005
|
+
private subscribeFilters;
|
|
1006
|
+
private seedSeq;
|
|
1007
|
+
private dropRealtime;
|
|
1008
|
+
private onRealtimeClosed;
|
|
1009
|
+
private onTransportFailure;
|
|
1010
|
+
private onEngineHealth;
|
|
1011
|
+
private scheduleReconnect;
|
|
1012
|
+
private reconnect;
|
|
1013
|
+
/** The OS reports connectivity: reconnect now. */
|
|
1014
|
+
networkAvailable(): void;
|
|
1015
|
+
/** The OS reports no network: go offline (reads served from cache). */
|
|
1016
|
+
networkLost(): void;
|
|
1017
|
+
/** App moved to the background: realtime is suspended after the grace period. */
|
|
1018
|
+
enterBackground(): void;
|
|
1019
|
+
/** App back in the foreground. */
|
|
1020
|
+
resume(): void;
|
|
1021
|
+
/** Closes everything (terminal). */
|
|
1022
|
+
close(): Promise<void>;
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
/** A new UUIDv7 (monotonic within one millisecond). */
|
|
1026
|
+
declare function uuidV7(now?: number): string;
|
|
1027
|
+
|
|
1028
|
+
/** Sub-protocol name. */
|
|
1029
|
+
declare const GRAPHQL_WS_SUBPROTOCOL = "graphql-transport-ws";
|
|
1030
|
+
/** The events subscription document. */
|
|
1031
|
+
declare const GRAPHQL_EVENTS_SUBSCRIPTION = "subscription Events($topics: [String!]!, $sinceSeq: Int) { events(topics: $topics, sinceSeq: $sinceSeq) { seq topic kind ts data } }";
|
|
1032
|
+
/** graphql-ws channel. */
|
|
1033
|
+
declare class GraphqlWsChannel implements RealtimeChannel {
|
|
1034
|
+
private readonly socket;
|
|
1035
|
+
private readonly heartbeatMs;
|
|
1036
|
+
private readonly logger?;
|
|
1037
|
+
readonly kind: "graphqlWs";
|
|
1038
|
+
readonly supportsCalls = false;
|
|
1039
|
+
readonly welcome: undefined;
|
|
1040
|
+
readonly events: Emitter<FreedomeEvent<unknown>>;
|
|
1041
|
+
readonly resyncs: Emitter<Resync>;
|
|
1042
|
+
readonly closed: Promise<RealtimeClosed>;
|
|
1043
|
+
private resolveClosed;
|
|
1044
|
+
private ackResolve;
|
|
1045
|
+
private ackReject;
|
|
1046
|
+
private readonly ack;
|
|
1047
|
+
private readonly ops;
|
|
1048
|
+
private hb;
|
|
1049
|
+
private lastSeen;
|
|
1050
|
+
private closing;
|
|
1051
|
+
private acked;
|
|
1052
|
+
private done;
|
|
1053
|
+
private constructor();
|
|
1054
|
+
static open(socket: MessageSocket, hello: RealtimeHello, opts?: {
|
|
1055
|
+
timeoutMs?: number;
|
|
1056
|
+
heartbeatMs?: number;
|
|
1057
|
+
logger?: FreedomeLogger;
|
|
1058
|
+
}): Promise<GraphqlWsChannel>;
|
|
1059
|
+
private send;
|
|
1060
|
+
private onFrame;
|
|
1061
|
+
private onErrors;
|
|
1062
|
+
private onDone;
|
|
1063
|
+
private startHeartbeat;
|
|
1064
|
+
subscribe(topics: string[], o?: {
|
|
1065
|
+
sinceSeq?: number;
|
|
1066
|
+
}): Promise<{
|
|
1067
|
+
topics: string[];
|
|
1068
|
+
}>;
|
|
1069
|
+
unsubscribe(topics: string[]): Promise<void>;
|
|
1070
|
+
call(op: string): Promise<RealtimeResult>;
|
|
1071
|
+
close(code?: number, reason?: string): Promise<void>;
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
/** socket.io channel. */
|
|
1075
|
+
declare class SocketIoChannel implements RealtimeChannel {
|
|
1076
|
+
private readonly socket;
|
|
1077
|
+
private readonly timeoutMs;
|
|
1078
|
+
private readonly logger?;
|
|
1079
|
+
readonly kind: "socketIo";
|
|
1080
|
+
readonly supportsCalls = true;
|
|
1081
|
+
readonly welcome: undefined;
|
|
1082
|
+
readonly events: Emitter<FreedomeEvent<unknown>>;
|
|
1083
|
+
readonly resyncs: Emitter<Resync>;
|
|
1084
|
+
readonly closed: Promise<RealtimeClosed>;
|
|
1085
|
+
private resolveClosed;
|
|
1086
|
+
private closing;
|
|
1087
|
+
private done;
|
|
1088
|
+
private constructor();
|
|
1089
|
+
static open(endpoint: FreedomeEndpoint, hello: RealtimeHello, opts?: {
|
|
1090
|
+
timeoutMs?: number;
|
|
1091
|
+
logger?: FreedomeLogger;
|
|
1092
|
+
}): Promise<SocketIoChannel>;
|
|
1093
|
+
private finish;
|
|
1094
|
+
private emitAck;
|
|
1095
|
+
subscribe(topics: string[], o?: {
|
|
1096
|
+
sinceSeq?: number;
|
|
1097
|
+
positionHz?: number;
|
|
1098
|
+
}): Promise<{
|
|
1099
|
+
topics: string[];
|
|
1100
|
+
denied?: string[];
|
|
1101
|
+
}>;
|
|
1102
|
+
unsubscribe(topics: string[]): Promise<void>;
|
|
1103
|
+
call(op: string, o: {
|
|
1104
|
+
params?: Record<string, string>;
|
|
1105
|
+
body?: unknown;
|
|
1106
|
+
ifMatch?: string;
|
|
1107
|
+
id?: string;
|
|
1108
|
+
timeoutMs?: number;
|
|
1109
|
+
}): Promise<RealtimeResult>;
|
|
1110
|
+
close(): Promise<void>;
|
|
1111
|
+
}
|
|
1112
|
+
|
|
1113
|
+
/** `freedome.v1` channel. */
|
|
1114
|
+
declare class WsChannel implements RealtimeChannel {
|
|
1115
|
+
private readonly socket;
|
|
1116
|
+
private readonly heartbeatMs;
|
|
1117
|
+
private readonly timeoutMs;
|
|
1118
|
+
private readonly logger?;
|
|
1119
|
+
readonly kind: "ws";
|
|
1120
|
+
readonly supportsCalls = true;
|
|
1121
|
+
readonly events: Emitter<FreedomeEvent<unknown>>;
|
|
1122
|
+
readonly resyncs: Emitter<Resync>;
|
|
1123
|
+
readonly closed: Promise<RealtimeClosed>;
|
|
1124
|
+
welcome: ChannelWelcome | undefined;
|
|
1125
|
+
private resolveClosed;
|
|
1126
|
+
private readonly pending;
|
|
1127
|
+
private hb;
|
|
1128
|
+
private lastSeen;
|
|
1129
|
+
private closing;
|
|
1130
|
+
private done;
|
|
1131
|
+
private bye;
|
|
1132
|
+
private constructor();
|
|
1133
|
+
/** Sends `hello`, waits for `welcome`, starts the heartbeat. */
|
|
1134
|
+
static open(socket: MessageSocket, hello: RealtimeHello, opts?: {
|
|
1135
|
+
timeoutMs?: number;
|
|
1136
|
+
heartbeatMs?: number;
|
|
1137
|
+
logger?: FreedomeLogger;
|
|
1138
|
+
}): Promise<WsChannel>;
|
|
1139
|
+
private log;
|
|
1140
|
+
private onFrame;
|
|
1141
|
+
private onDone;
|
|
1142
|
+
private startHeartbeat;
|
|
1143
|
+
private sendMsg;
|
|
1144
|
+
private expect;
|
|
1145
|
+
private request;
|
|
1146
|
+
subscribe(topics: string[], o?: {
|
|
1147
|
+
sinceSeq?: number;
|
|
1148
|
+
positionHz?: number;
|
|
1149
|
+
}): Promise<{
|
|
1150
|
+
topics: string[];
|
|
1151
|
+
denied?: string[];
|
|
1152
|
+
}>;
|
|
1153
|
+
unsubscribe(topics: string[]): Promise<void>;
|
|
1154
|
+
call(op: string, o: {
|
|
1155
|
+
params?: Record<string, string>;
|
|
1156
|
+
body?: unknown;
|
|
1157
|
+
ifMatch?: string;
|
|
1158
|
+
id?: string;
|
|
1159
|
+
timeoutMs?: number;
|
|
1160
|
+
}): Promise<RealtimeResult>;
|
|
1161
|
+
close(code?: number, reason?: string): Promise<void>;
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1164
|
+
/** Incremental hasher. */
|
|
1165
|
+
declare class Sha256 {
|
|
1166
|
+
private readonly h;
|
|
1167
|
+
private readonly buf;
|
|
1168
|
+
private readonly w;
|
|
1169
|
+
private bufLen;
|
|
1170
|
+
private total;
|
|
1171
|
+
private finished;
|
|
1172
|
+
update(data: Uint8Array): this;
|
|
1173
|
+
digest(): Uint8Array;
|
|
1174
|
+
hex(): string;
|
|
1175
|
+
private block;
|
|
1176
|
+
}
|
|
1177
|
+
/** One-shot hex digest. */
|
|
1178
|
+
declare const sha256Hex: (data: Uint8Array) => string;
|
|
1179
|
+
/** Base64 of bytes (no Buffer dependency). */
|
|
1180
|
+
declare function base64(bytes: Uint8Array): string;
|
|
1181
|
+
|
|
1182
|
+
/**
|
|
1183
|
+
* `@freedome/client` — isomorphic Freedome client (browsers, Node ≥ 20, React Native): REST (fetch), WebSocket
|
|
1184
|
+
* `freedome.v1`, graphql-ws, socket.io; connection state machine with resume / resync; repositories; offline cache
|
|
1185
|
+
* and outbox; codecs (.dome / .zelim / .boranko / .comics). Node-only parts (mDNS, `ws`, files): `@freedome/client/node`.
|
|
1186
|
+
* Test double: `@freedome/client/testing` (`createFakeTransport()`). NativeMindNONC.
|
|
1187
|
+
*/
|
|
1188
|
+
declare const PACKAGE_NAME = "@freedome/client";
|
|
1189
|
+
|
|
1190
|
+
export { ApiCaller, type AudioAnalysisFrame, type AudioAnalysisSettings, type AudioAnalysisState, type AudioDevice, type AudioDeviceKind, type AudioDevicePatch, type AudioDeviceSweep, type AudioDeviceSweepJob, type AudioDeviceTest, type AudioDeviceTestResult, type AudioLayout, type AudioLevels, type AudioMode, type AudioOnset, type AudioPreset, type AudioPresetInput, type AudioPresetSummary, AudioReactiveRepository, type AudioReactiveScene, type AudioReactiveSceneInput, type AudioReactiveState, AudioRepository, type AudioRoleZones, type AudioSession, type AudioSessionStart, type AudioState, type AudioTargets, type AudioZone, type AudioZoneInput, type AudioZonePatch, BackoffPolicy, CALIBRATION_FILE_TYPES, CacheStore, CalibrationRepository, CallOptions, type CaptureFrame, ChannelWelcome, ClientsRepository, type ConnectionState, type ContentChange, type ContentQuery, ContentRepository, ContentSource, Credentials, type DisplayState, Emitter, EngineRepository, EventHub, FREEDOME_CLIENT_VERSION, FreedomeClient, type FreedomeClientInit, type FreedomeClientOptions, type FreedomeCredentials, FreedomeEndpoint, FreedomeLogger, FreedomeResponse, FreedomeTransportFactory, GRAPHQL_EVENTS_SUBSCRIPTION, GRAPHQL_OPERATION, GRAPHQL_WS_SUBPROTOCOL, type Gateway, type GatewayPatch, type GatewayTestResult, GatewaysRepository, type GeneratorMulti, GeneratorSession, type GeneratorSettings, type GeneratorState, GraphqlClient, GraphqlWsChannel, InMemoryTokenStore, MessageSocket, NO_SESSION, OfflinePolicy, type OscArg, type OscMessage, OscRepository, OutboxOutcome, OutboxStore, PACKAGE_NAME, Page, type PlayTarget, PlayTargets, PlaybackRepository, type PlaybackSnapshot, PlayerHandle, RealtimeChannel, RealtimeClosed, RealtimeConnector, RealtimeHello, RealtimeResult, RealtimeTransport, RepositoryContext, Resync, type Session, Sha256, ShowParts, SocketIoChannel, type SourcePosition, type StoredTokens, type TextureSource, type TokenStore, Unsubscribe, type UploadCapabilities, UploadPurpose, UploadTask, VenuesRepository, Versioned, WatchObserver, WsChannel, audioSessionEnded, base64, can, defaultTransports, multipart, oscArg, scopesOfRole, sessionFromPrincipal, sessionFromTokens, sha256Hex, storedTokensOf, uuidV7 };
|