@casual-simulation/aux-common 3.0.9-alpha.2235281564 → 3.0.10

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.
@@ -1,5 +1,5 @@
1
1
  import { AuxGlobalContext, DEBUG_STRING } from './AuxGlobalContext';
2
- import { BotTags, Bot, ShowChatOptions, BotAction, BotsState, CameraType, BarcodeFormat, PortalType, ShowInputOptions, StartCheckoutOptions, LocalFormAnimationAction, ShareOptions, Easing, BotAnchorPoint, RuntimeBot, BotSpace, EaseType, RegisterPrefixOptions, OpenCircleWipeOptions, SuperShoutAction, ShowToastAction, ShowJoinCodeAction, RequestFullscreenAction, ExitFullscreenAction, ShowHtmlAction, HideHtmlAction, SetClipboardAction, FocusOnBotAction, ShowChatBarAction, EnableARAction, EnableVRAction, DownloadAction, ShowUploadAuxFileAction, OpenQRCodeScannerAction, ShowQRCodeAction, OpenBarcodeScannerAction, ShowBarcodeAction, LoadServerAction, UnloadServerAction, ImportAUXAction, ReplaceDragBotAction, ShowInputForTagAction, GoToDimensionAction, GoToURLAction, OpenURLAction, OpenConsoleAction, StartCheckoutAction, FinishCheckoutAction, ApplyStateAction, RejectAction, FocusOnOptions, SnapTarget, AddDropSnapTargetsAction, RecordingOptions, Recording, SyntheticVoice, EnablePOVAction, EnableCustomDraggingAction, SetAppOutputAction, Record, RecordReference, PartialBotsState, ParsedBotLink, ConvertGeolocationToWhat3WordsOptions, BeginAudioRecordingAction, MeetCommandAction, MediaPermssionOptions, ImageClassifierOptions, AddDropGridTargetsAction } from '../bots';
2
+ import { BotTags, Bot, ShowChatOptions, BotAction, BotsState, CameraType, BarcodeFormat, PortalType, ShowInputOptions, StartCheckoutOptions, LocalFormAnimationAction, ShareOptions, Easing, BotAnchorPoint, RuntimeBot, BotSpace, EaseType, RegisterPrefixOptions, OpenCircleWipeOptions, SuperShoutAction, ShowToastAction, ShowJoinCodeAction, RequestFullscreenAction, ExitFullscreenAction, ShowHtmlAction, HideHtmlAction, SetClipboardAction, FocusOnBotAction, ShowChatBarAction, EnableARAction, EnableVRAction, DownloadAction, ShowUploadAuxFileAction, OpenQRCodeScannerAction, ShowQRCodeAction, OpenBarcodeScannerAction, ShowBarcodeAction, LoadServerAction, UnloadServerAction, ImportAUXAction, ReplaceDragBotAction, ShowInputForTagAction, GoToDimensionAction, GoToURLAction, OpenURLAction, OpenConsoleAction, StartCheckoutAction, FinishCheckoutAction, ApplyStateAction, RejectAction, FocusOnOptions, SnapTarget, AddDropSnapTargetsAction, RecordingOptions, Recording, SyntheticVoice, EnablePOVAction, EnableCustomDraggingAction, SetAppOutputAction, Record, RecordReference, PartialBotsState, ParsedBotLink, ConvertGeolocationToWhat3WordsOptions, BeginAudioRecordingAction, MediaPermssionOptions, ImageClassifierOptions, AddDropGridTargetsAction, DataRecordOptions } from '../bots';
3
3
  import { RemoteAction } from '@casual-simulation/causal-trees';
4
4
  import '../polyfill/Array.first.polyfill';
5
5
  import '../polyfill/Array.last.polyfill';
@@ -529,6 +529,8 @@ export declare function createDefaultLibrary(context: AuxGlobalContext): {
529
529
  os: {
530
530
  sleep: (time: number) => Promise<void>;
531
531
  toast: (message: string | number | boolean | object | Array<any> | null, duration?: number) => ShowToastAction;
532
+ tip: (message: string | number | boolean | object | Array<any> | null, pixelX?: number, pixelY?: number, duration?: number) => Promise<number>;
533
+ hideTips: (tipIds?: number | number[]) => Promise<void>;
532
534
  showJoinCode: (inst?: string, dimension?: string) => ShowJoinCodeAction;
533
535
  requestFullscreenMode: () => RequestFullscreenAction;
534
536
  exitFullscreenMode: () => ExitFullscreenAction;
@@ -682,8 +684,8 @@ export declare function createDefaultLibrary(context: AuxGlobalContext): {
682
684
  getPublicRecordKey: (name: string) => Promise<CreatePublicRecordKeyResult>;
683
685
  getSubjectlessPublicRecordKey: (name: string) => Promise<CreatePublicRecordKeyResult>;
684
686
  isRecordKey: (key: unknown) => boolean;
685
- recordData: (recordKey: string, address: string, data: any, endpoint?: string) => Promise<RecordDataResult>;
686
- recordManualApprovalData: (recordKey: string, address: string, data: any, endpoint?: string) => Promise<RecordDataResult>;
687
+ recordData: (recordKey: string, address: string, data: any, endpointOrOptions?: string | DataRecordOptions) => Promise<RecordDataResult>;
688
+ recordManualApprovalData: (recordKey: string, address: string, data: any, endpointOrOptions?: string | DataRecordOptions) => Promise<RecordDataResult>;
687
689
  getData: (recordKeyOrName: string, address: string, endpoint?: string) => Promise<GetDataResult>;
688
690
  getManualApprovalData: (recordKeyOrName: string, address: string, endpoint?: string) => Promise<GetDataResult>;
689
691
  listData: (recordKeyOrName: string, startingAddress?: string, endpoint?: string) => Promise<ListDataResult>;
@@ -712,7 +714,7 @@ export declare function createDefaultLibrary(context: AuxGlobalContext): {
712
714
  }[]>;
713
715
  beginAudioRecording: (options?: Omit<BeginAudioRecordingAction, 'type' | 'taskId'>) => Promise<void>;
714
716
  endAudioRecording: () => Promise<Blob>;
715
- meetCommand: (command: string, ...args: any) => MeetCommandAction;
717
+ meetCommand: (command: string, ...args: any) => Promise<void>;
716
718
  meetFunction: (functionName: string, ...args: any[]) => Promise<any>;
717
719
  readonly vars: any;
718
720
  };
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { DEBUG_STRING, debugStringifyFunction, } from './AuxGlobalContext';
11
- import { hasValue, trimTag, isBot, BOT_SPACE_TAG, toast as toastMessage, showJoinCode as calcShowJoinCode, requestFullscreen, exitFullscreen, html as htmlMessage, hideHtml as hideHtmlMessage, setClipboard as calcSetClipboard, tweenTo as calcTweenTo, showChat as calcShowChat, hideChat as calcHideChat, runScript, getMediaPermission as calcGetMediaPermission, getAverageFrameRate as calcGetAverageFrameRate, enableAR as calcEnableAR, disableAR as calcDisableAR, enableVR as calcEnableVR, disableVR as calcDisableVR, arSupported as calcARSupported, vrSupported as calcVRSupported, showUploadAuxFile as calcShowUploadAuxFile, openQRCodeScanner as calcOpenQRCodeScanner, showQRCode as calcShowQRCode, openBarcodeScanner as calcOpenBarcodeScanner, showBarcode as calcShowBarcode, importAUX as calcImportAUX, showInputForTag as calcShowInputForTag, showInput as calcShowInput, replaceDragBot as calcReplaceDragBot, goToDimension as calcGoToDimension, goToURL as calcGoToURL, openURL as calcOpenURL, checkout as calcCheckout, playSound as calcPlaySound, bufferSound as calcBufferSound, cancelSound as calcCancelSound, setupServer as calcSetupServer, shell as calcShell, backupToGithub as calcBackupToGithub, backupAsDownload as calcBackupAsDownload, finishCheckout as calcFinishCheckout, markHistory as calcMarkHistory, browseHistory as calcBrowseHistory, restoreHistoryMark as calcRestoreHistoryMark, loadFile as calcLoadFile, saveFile as calcSaveFile, reject as calcReject, localFormAnimation as calcLocalFormAnimation, webhook as calcWebhook, superShout as calcSuperShout, share as calcShare, registerPrefix as calcRegisterPrefix, createCertificate as calcCreateCertificate, signTag as calcSignTag, revokeCertificate as calcRevokeCertificate, localPositionTween as calcLocalPositionTween, localRotationTween as calcLocalRotationTween, showUploadFiles as calcShowUploadFiles, download, loadSimulation, unloadSimulation, getUploadState, addState, getPortalTag, KNOWN_PORTALS, openConsole, tagsOnBot, getOriginalObject, getBotSpace, trimEvent, CREATE_ACTION_NAME, CREATE_ANY_ACTION_NAME, DESTROY_ACTION_NAME, ORIGINAL_OBJECT, unlockSpace, getRemoteCount, getServers, getRemotes, action, getServerStatuses, setSpacePassword, rpioInitPin, rpioExitPin, rpioOpenPin, rpioModePin, rpioReadPin, rpioReadSequencePin, rpioWritePin, rpioWriteSequencePin, rpioReadpadPin, rpioWritepadPin, rpioPudPin, rpioPollPin, rpioClosePin, rpioI2CBeginPin, rpioI2CSetSlaveAddressPin, rpioI2CSetBaudRatePin, rpioI2CSetClockDividerPin, rpioI2CReadPin, rpioI2CWritePin,
11
+ import { hasValue, trimTag, isBot, BOT_SPACE_TAG, toast as toastMessage, tip as tipMessage, hideTips as hideTipMessages, showJoinCode as calcShowJoinCode, requestFullscreen, exitFullscreen, html as htmlMessage, hideHtml as hideHtmlMessage, setClipboard as calcSetClipboard, tweenTo as calcTweenTo, showChat as calcShowChat, hideChat as calcHideChat, runScript, getMediaPermission as calcGetMediaPermission, getAverageFrameRate as calcGetAverageFrameRate, enableAR as calcEnableAR, disableAR as calcDisableAR, enableVR as calcEnableVR, disableVR as calcDisableVR, arSupported as calcARSupported, vrSupported as calcVRSupported, showUploadAuxFile as calcShowUploadAuxFile, openQRCodeScanner as calcOpenQRCodeScanner, showQRCode as calcShowQRCode, openBarcodeScanner as calcOpenBarcodeScanner, showBarcode as calcShowBarcode, importAUX as calcImportAUX, showInputForTag as calcShowInputForTag, showInput as calcShowInput, replaceDragBot as calcReplaceDragBot, goToDimension as calcGoToDimension, goToURL as calcGoToURL, openURL as calcOpenURL, checkout as calcCheckout, playSound as calcPlaySound, bufferSound as calcBufferSound, cancelSound as calcCancelSound, setupServer as calcSetupServer, shell as calcShell, backupToGithub as calcBackupToGithub, backupAsDownload as calcBackupAsDownload, finishCheckout as calcFinishCheckout, markHistory as calcMarkHistory, browseHistory as calcBrowseHistory, restoreHistoryMark as calcRestoreHistoryMark, loadFile as calcLoadFile, saveFile as calcSaveFile, reject as calcReject, localFormAnimation as calcLocalFormAnimation, webhook as calcWebhook, superShout as calcSuperShout, share as calcShare, registerPrefix as calcRegisterPrefix, createCertificate as calcCreateCertificate, signTag as calcSignTag, revokeCertificate as calcRevokeCertificate, localPositionTween as calcLocalPositionTween, localRotationTween as calcLocalRotationTween, showUploadFiles as calcShowUploadFiles, download, loadSimulation, unloadSimulation, getUploadState, addState, getPortalTag, KNOWN_PORTALS, openConsole, tagsOnBot, getOriginalObject, getBotSpace, trimEvent, CREATE_ACTION_NAME, CREATE_ANY_ACTION_NAME, DESTROY_ACTION_NAME, ORIGINAL_OBJECT, unlockSpace, getRemoteCount, getServers, getRemotes, action, getServerStatuses, setSpacePassword, rpioInitPin, rpioExitPin, rpioOpenPin, rpioModePin, rpioReadPin, rpioReadSequencePin, rpioWritePin, rpioWriteSequencePin, rpioReadpadPin, rpioWritepadPin, rpioPudPin, rpioPollPin, rpioClosePin, rpioI2CBeginPin, rpioI2CSetSlaveAddressPin, rpioI2CSetBaudRatePin, rpioI2CSetClockDividerPin, rpioI2CReadPin, rpioI2CWritePin,
12
12
  // rpioI2CReadRegisterRestartPin,
13
13
  // rpioI2CWriteReadRestartPin,
14
14
  rpioI2CEndPin, rpioPWMSetClockDividerPin, rpioPWMSetRangePin, rpioPWMSetDataPin, rpioSPIBeginPin, rpioSPIChipSelectPin, rpioSPISetCSPolarityPin, rpioSPISetClockDividerPin, rpioSPISetDataModePin, rpioSPITransferPin, rpioSPIWritePin, rpioSPIEndPin, serialConnectPin, serialOpenPin, serialStreamPin, serialUpdatePin, serialWritePin, serialReadPin, serialClosePin, serialFlushPin, serialDrainPin, serialPausePin, serialResumePin, calculateAnchorPoint, calculateAnchorPointOffset, getBotPosition as calcGetBotPosition, isRuntimeBot, SET_TAG_MASK_SYMBOL, CLEAR_TAG_MASKS_SYMBOL, getBotScale, EDIT_TAG_SYMBOL, EDIT_TAG_MASK_SYMBOL, circleWipe, addDropSnap as calcAddDropSnap, addDropGrid as calcAddDropGrid, animateToPosition, beginAudioRecording as calcBeginAudioRecording, endAudioRecording as calcEndAudioRecording, beginRecording as calcBeginRecording, endRecording as calcEndRecording, speakText as calcSpeakText, getVoices as calcGetVoices, getGeolocation as calcGetGeolocation, cancelAnimation, disablePOV, enablePOV, enableCustomDragging as calcEnableCustomDragging, MINI_PORTAL, registerCustomApp, setAppOutput, unregisterCustomApp, requestAuthData as calcRequestAuthData, createBot, defineGlobalBot as calcDefineGlobalBot, TEMPORARY_BOT_PARTITION_ID, convertToString, GET_TAG_MASKS_SYMBOL, isBotLink, parseBotLink, createBotLink, convertGeolocationToWhat3Words as calcConvertGeolocationToWhat3Words, getPublicRecordKey as calcGetPublicRecordKey, recordData as calcRecordData, getRecordData, eraseRecordData, recordFile as calcRecordFile, eraseFile as calcEraseFile, meetCommand as calcMeetCommand, meetFunction as calcMeetFunction, listDataRecord, recordEvent as calcRecordEvent, getEventCount as calcGetEventCount, openImageClassifier as calcOpenImageClassifier, isBotDate, DATE_TAG_PREFIX, parseBotDate, } from '../bots';
@@ -18,7 +18,7 @@ import { RanOutOfEnergyError } from './AuxResults';
18
18
  import '../polyfill/Array.first.polyfill';
19
19
  import '../polyfill/Array.last.polyfill';
20
20
  import { convertToCopiableValue, embedBase64InPdf, getEasing, getEmbeddedBase64FromPdf, toHexString as utilToHexString, fromHexString as utilFromHexString, } from './Utils';
21
- import { sha256 as hashSha256, sha512 as hashSha512, hmac as calcHmac, sha1 as hashSha1 } from 'hash.js';
21
+ import { sha256 as hashSha256, sha512 as hashSha512, hmac as calcHmac, sha1 as hashSha1, } from 'hash.js';
22
22
  import stableStringify from '@casual-simulation/fast-json-stable-stringify';
23
23
  import { encrypt as realEncrypt, decrypt as realDecrypt, keypair as realKeypair, sign as realSign, verify as realVerify, asymmetricKeypair as realAsymmetricKeypair, asymmetricEncrypt as realAsymmetricEncrypt, asymmetricDecrypt as realAsymmetricDecrypt, isAsymmetricKeypair, isAsymmetricEncrypted, isEncrypted, } from '@casual-simulation/crypto';
24
24
  import { tagValueHash } from '../aux-format-2/AuxOpTypes';
@@ -211,6 +211,8 @@ export function createDefaultLibrary(context) {
211
211
  os: {
212
212
  sleep,
213
213
  toast,
214
+ tip,
215
+ hideTips,
214
216
  showJoinCode,
215
217
  requestFullscreenMode,
216
218
  exitFullscreenMode,
@@ -289,7 +291,9 @@ export function createDefaultLibrary(context) {
289
291
  * changes/events will have been synchronized between all connected devices by the moment that this time occurrs.
290
292
  */
291
293
  get deadReckoningTime() {
292
- return (Date.now() + context.instTimeOffset) + DEAD_RECKONING_OFFSET;
294
+ return (Date.now() +
295
+ context.instTimeOffset +
296
+ DEAD_RECKONING_OFFSET);
293
297
  },
294
298
  loadServer,
295
299
  unloadServer,
@@ -1233,6 +1237,34 @@ export function createDefaultLibrary(context) {
1233
1237
  function toast(message, duration = 2) {
1234
1238
  return addAction(toastMessage(convertToCopiableValue(message), duration));
1235
1239
  }
1240
+ /**
1241
+ * Shows a tooltip message to the user.
1242
+ * @param message The message to show.
1243
+ * @param pixelX The X coordinate that the tooltip should be shown at. If null, then the current pointer position will be used.
1244
+ * @param pixelY The Y coordinate that the tooltip should be shown at. If null, then the current pointer position will be used.
1245
+ * @param duration The duration that the tooltip should be shown in seconds.
1246
+ */
1247
+ function tip(message, pixelX, pixelY, duration) {
1248
+ const task = context.createTask();
1249
+ const action = tipMessage(convertToCopiableValue(message), pixelX !== null && pixelX !== void 0 ? pixelX : null, pixelY !== null && pixelY !== void 0 ? pixelY : null, (duration !== null && duration !== void 0 ? duration : 2) * 1000, task.taskId);
1250
+ return addAsyncAction(task, action);
1251
+ }
1252
+ /**
1253
+ * Hides the given list of tips.
1254
+ * If no tip IDs are provided, then all tips will be hidden.
1255
+ * @param tipIds
1256
+ * @returns
1257
+ */
1258
+ function hideTips(tipIds) {
1259
+ const ids = arguments.length <= 0
1260
+ ? null
1261
+ : typeof tipIds === 'number'
1262
+ ? [tipIds]
1263
+ : tipIds;
1264
+ const task = context.createTask();
1265
+ const action = hideTipMessages(ids, task.taskId);
1266
+ return addAsyncAction(task, action);
1267
+ }
1236
1268
  /**
1237
1269
  * Shows a QR Code that contains a link to a inst and dimension.
1238
1270
  * @param inst The inst that should be joined. Defaults to the current inst.
@@ -2024,7 +2056,7 @@ export function createDefaultLibrary(context) {
2024
2056
  return addAction(calcAddDropGrid(getID(bot), mapSnapGridTargets(targets)));
2025
2057
  }
2026
2058
  function mapSnapGridTargets(targets) {
2027
- return targets.map(t => ({
2059
+ return targets.map((t) => ({
2028
2060
  position: t.position,
2029
2061
  rotation: t.rotation,
2030
2062
  bounds: t.bounds,
@@ -2162,10 +2194,10 @@ export function createDefaultLibrary(context) {
2162
2194
  * @param recordKey The key that should be used to access the record.
2163
2195
  * @param address The address that the data should be stored at inside the record.
2164
2196
  * @param data The data that should be stored.
2165
- * @param endpoint The records endpoint that should be queried. Optional.
2197
+ * @param endpointOrOptions The options that should be used. Optional.
2166
2198
  */
2167
- function recordData(recordKey, address, data, endpoint = null) {
2168
- return baseRecordData(recordKey, address, data, false, endpoint);
2199
+ function recordData(recordKey, address, data, endpointOrOptions) {
2200
+ return baseRecordData(recordKey, address, data, false, endpointOrOptions);
2169
2201
  }
2170
2202
  /**
2171
2203
  * Records the given data to the given address inside the record for the given record key.
@@ -2174,21 +2206,30 @@ export function createDefaultLibrary(context) {
2174
2206
  * @param recordKey The key that should be used to access the record.
2175
2207
  * @param address The address that the data should be stored at inside the record.
2176
2208
  * @param data The data that should be stored.
2177
- * @param endpoint The records endpoint that should be queried. Optional.
2209
+ * @param endpointOrOptions The options that should be used. Optional.
2178
2210
  */
2179
- function recordManualApprovalData(recordKey, address, data, endpoint = null) {
2180
- return baseRecordData(recordKey, address, data, true, endpoint);
2211
+ function recordManualApprovalData(recordKey, address, data, endpointOrOptions) {
2212
+ return baseRecordData(recordKey, address, data, true, endpointOrOptions);
2181
2213
  }
2182
2214
  /**
2183
2215
  * Records the given data to the given address inside the record for the given record key.
2184
2216
  * @param recordKey The key that should be used to access the record.
2185
2217
  * @param address The address that the data should be stored at inside the record.
2186
2218
  * @param data The data that should be stored.
2187
- * @param endpoint The records endpoint that should be queried. Optional.
2219
+ * @param endpointOrOptions The options that should be used. Optional.
2188
2220
  */
2189
- function baseRecordData(recordKey, address, data, requiresApproval, endpoint = null) {
2221
+ function baseRecordData(recordKey, address, data, requiresApproval, endpointOrOptions = null) {
2190
2222
  const task = context.createTask();
2191
- const event = calcRecordData(recordKey, address, convertToCopiableValue(data), requiresApproval, endpoint, task.taskId);
2223
+ let options = {};
2224
+ if (hasValue(endpointOrOptions)) {
2225
+ if (typeof endpointOrOptions === 'string') {
2226
+ options.endpoint = endpointOrOptions;
2227
+ }
2228
+ else {
2229
+ options = endpointOrOptions;
2230
+ }
2231
+ }
2232
+ const event = calcRecordData(recordKey, address, convertToCopiableValue(data), requiresApproval, options, task.taskId);
2192
2233
  return addAsyncAction(task, event);
2193
2234
  }
2194
2235
  /**
@@ -2219,8 +2260,12 @@ export function createDefaultLibrary(context) {
2219
2260
  let recordName = isRecordKey(recordKeyOrName)
2220
2261
  ? parseRecordKey(recordKeyOrName)[0]
2221
2262
  : recordKeyOrName;
2263
+ let options = {};
2264
+ if (hasValue(endpoint)) {
2265
+ options.endpoint = endpoint;
2266
+ }
2222
2267
  const task = context.createTask();
2223
- const event = getRecordData(recordName, address, requiresApproval, endpoint, task.taskId);
2268
+ const event = getRecordData(recordName, address, requiresApproval, options, task.taskId);
2224
2269
  return addAsyncAction(task, event);
2225
2270
  }
2226
2271
  /**
@@ -2233,8 +2278,12 @@ export function createDefaultLibrary(context) {
2233
2278
  let recordName = isRecordKey(recordKeyOrName)
2234
2279
  ? parseRecordKey(recordKeyOrName)[0]
2235
2280
  : recordKeyOrName;
2281
+ let options = {};
2282
+ if (hasValue(endpoint)) {
2283
+ options.endpoint = endpoint;
2284
+ }
2236
2285
  const task = context.createTask();
2237
- const event = listDataRecord(recordName, startingAddress, endpoint, task.taskId);
2286
+ const event = listDataRecord(recordName, startingAddress, options, task.taskId);
2238
2287
  return addAsyncAction(task, event);
2239
2288
  }
2240
2289
  /**
@@ -2275,8 +2324,12 @@ export function createDefaultLibrary(context) {
2275
2324
  else if (typeof address !== 'string') {
2276
2325
  throw new Error('address must be a string.');
2277
2326
  }
2327
+ let options = {};
2328
+ if (hasValue(endpoint)) {
2329
+ options.endpoint = endpoint;
2330
+ }
2278
2331
  const task = context.createTask();
2279
- const event = eraseRecordData(recordKey, address, requiresApproval, endpoint, task.taskId);
2332
+ const event = eraseRecordData(recordKey, address, requiresApproval, options, task.taskId);
2280
2333
  return addAsyncAction(task, event);
2281
2334
  }
2282
2335
  /**
@@ -2296,8 +2349,12 @@ export function createDefaultLibrary(context) {
2296
2349
  if (!hasValue(data)) {
2297
2350
  throw new Error('data must be provided.');
2298
2351
  }
2352
+ let recordOptions = {};
2353
+ if (hasValue(endpoint)) {
2354
+ recordOptions.endpoint = endpoint;
2355
+ }
2299
2356
  const task = context.createTask();
2300
- const event = calcRecordFile(recordKey, convertToCopiableValue(data), options === null || options === void 0 ? void 0 : options.description, options === null || options === void 0 ? void 0 : options.mimeType, endpoint, task.taskId);
2357
+ const event = calcRecordFile(recordKey, convertToCopiableValue(data), options === null || options === void 0 ? void 0 : options.description, options === null || options === void 0 ? void 0 : options.mimeType, recordOptions, task.taskId);
2301
2358
  return addAsyncAction(task, event);
2302
2359
  }
2303
2360
  /**
@@ -2352,8 +2409,12 @@ export function createDefaultLibrary(context) {
2352
2409
  }
2353
2410
  url = fileUrlOrRecordFileResult.url;
2354
2411
  }
2412
+ let options = {};
2413
+ if (hasValue(endpoint)) {
2414
+ options.endpoint = endpoint;
2415
+ }
2355
2416
  const task = context.createTask();
2356
- const event = calcEraseFile(recordKey, url, endpoint, task.taskId);
2417
+ const event = calcEraseFile(recordKey, url, options, task.taskId);
2357
2418
  return addAsyncAction(task, event);
2358
2419
  }
2359
2420
  /**
@@ -2375,8 +2436,12 @@ export function createDefaultLibrary(context) {
2375
2436
  else if (typeof eventName !== 'string') {
2376
2437
  throw new Error('eventName must be a string.');
2377
2438
  }
2439
+ let options = {};
2440
+ if (hasValue(endpoint)) {
2441
+ options.endpoint = endpoint;
2442
+ }
2378
2443
  const task = context.createTask();
2379
- const event = calcRecordEvent(recordKey, eventName, 1, endpoint, task.taskId);
2444
+ const event = calcRecordEvent(recordKey, eventName, 1, options, task.taskId);
2380
2445
  return addAsyncAction(task, event);
2381
2446
  }
2382
2447
  /**
@@ -2401,8 +2466,12 @@ export function createDefaultLibrary(context) {
2401
2466
  let recordName = isRecordKey(recordNameOrKey)
2402
2467
  ? parseRecordKey(recordNameOrKey)[0]
2403
2468
  : recordNameOrKey;
2469
+ let options = {};
2470
+ if (hasValue(endpoint)) {
2471
+ options.endpoint = endpoint;
2472
+ }
2404
2473
  const task = context.createTask();
2405
- const event = calcGetEventCount(recordName, eventName, endpoint, task.taskId);
2474
+ const event = calcGetEventCount(recordName, eventName, options, task.taskId);
2406
2475
  return addAsyncAction(task, event);
2407
2476
  }
2408
2477
  /**
@@ -3303,7 +3372,9 @@ export function createDefaultLibrary(context) {
3303
3372
  : bot.tags[tag],
3304
3373
  };
3305
3374
  const easing = getEasing(options.easing);
3306
- const startTime = hasValue(options.startTime) ? options.startTime - context.startTime : context.localTime;
3375
+ const startTime = hasValue(options.startTime)
3376
+ ? options.startTime - context.startTime
3377
+ : context.localTime;
3307
3378
  const tween = new TWEEN.Tween(valueHolder)
3308
3379
  .to({
3309
3380
  [tag]: options.toValue,
@@ -3569,11 +3640,14 @@ export function createDefaultLibrary(context) {
3569
3640
  /**
3570
3641
  * Sends commands to the Jitsi Meet API.
3571
3642
  * See https://jitsi.github.io/handbook/docs/dev-guide/dev-guide-iframe/#commands for a list of commands.
3643
+ * Returns a promise that resolves when the command has been executed.
3572
3644
  * @param command The command to execute.
3573
3645
  * @param args The args for the command (if any).
3574
3646
  */
3575
3647
  function meetCommand(command, ...args) {
3576
- return addAction(calcMeetCommand(command, ...args));
3648
+ const task = context.createTask();
3649
+ const action = calcMeetCommand(command, args, task.taskId);
3650
+ return addAsyncAction(task, action);
3577
3651
  }
3578
3652
  /**
3579
3653
  * Executes the given function from the Jitsi Meet API and returns a promise with the result.
@@ -3975,9 +4049,12 @@ export function createDefaultLibrary(context) {
3975
4049
  * @param data The data that should be hashed.
3976
4050
  */
3977
4051
  function hash(algorithm, format, ...data) {
3978
- let h = algorithm === 'sha256' ? hashSha256()
3979
- : algorithm === 'sha512' ? hashSha512()
3980
- : algorithm === 'sha1' ? hashSha1()
4052
+ let h = algorithm === 'sha256'
4053
+ ? hashSha256()
4054
+ : algorithm === 'sha512'
4055
+ ? hashSha512()
4056
+ : algorithm === 'sha1'
4057
+ ? hashSha1()
3981
4058
  : null;
3982
4059
  if (!h) {
3983
4060
  throw new Error('Not supported algorithm: ' + algorithm);
@@ -3996,9 +4073,12 @@ export function createDefaultLibrary(context) {
3996
4073
  * @param data The data that should be hashed.
3997
4074
  */
3998
4075
  function hmac(algorithm, format, key, ...data) {
3999
- let h = algorithm === 'hmac-sha256' ? hashSha256
4000
- : algorithm === 'hmac-sha512' ? hashSha512
4001
- : algorithm === 'hmac-sha1' ? hashSha1
4076
+ let h = algorithm === 'hmac-sha256'
4077
+ ? hashSha256
4078
+ : algorithm === 'hmac-sha512'
4079
+ ? hashSha512
4080
+ : algorithm === 'hmac-sha1'
4081
+ ? hashSha1
4002
4082
  : null;
4003
4083
  if (!h) {
4004
4084
  throw new Error('Not supported algorithm: ' + algorithm);
@@ -4978,6 +5058,9 @@ export function createDefaultLibrary(context) {
4978
5058
  * shout("sayHi()", "My Name");
4979
5059
  */
4980
5060
  function shout(name, arg) {
5061
+ if (!hasValue(name) || typeof name !== 'string') {
5062
+ throw new Error('shout() name must be a string.');
5063
+ }
4981
5064
  return event(name, null, arg);
4982
5065
  }
4983
5066
  /**
@@ -5002,6 +5085,9 @@ export function createDefaultLibrary(context) {
5002
5085
  * whisper(getBots("friendly", true), "sayHi()", "My Name");
5003
5086
  */
5004
5087
  function whisper(bot, eventName, arg) {
5088
+ if (!hasValue(eventName) || typeof eventName !== 'string') {
5089
+ throw new Error('whisper() eventName must be a string.');
5090
+ }
5005
5091
  let bots;
5006
5092
  if (Array.isArray(bot)) {
5007
5093
  bots = bot;