@casual-simulation/aux-common 3.0.12 → 3.0.14-alpha.2499890262
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/bots/Bot.d.ts +40 -0
- package/bots/Bot.js +51 -0
- package/bots/Bot.js.map +1 -1
- package/bots/BotEvents.d.ts +267 -2
- package/bots/BotEvents.js +102 -4
- package/bots/BotEvents.js.map +1 -1
- package/package.json +6 -7
- package/partitions/RemoteYjsPartition.d.ts +2 -0
- package/partitions/RemoteYjsPartition.js +3 -0
- package/partitions/RemoteYjsPartition.js.map +1 -1
- package/runtime/AuxGlobalContext.d.ts +8 -0
- package/runtime/AuxGlobalContext.js +1 -1
- package/runtime/AuxGlobalContext.js.map +1 -1
- package/runtime/AuxLibrary.d.ts +98 -3
- package/runtime/AuxLibrary.js +100 -3
- package/runtime/AuxLibrary.js.map +1 -1
- package/runtime/AuxLibraryDefinitions.def +325 -0
- package/runtime/AuxRuntime.js +1 -0
- package/runtime/AuxRuntime.js.map +1 -1
package/runtime/AuxLibrary.js
CHANGED
|
@@ -11,7 +11,7 @@ import { DEBUG_STRING, debugStringifyFunction, } from './AuxGlobalContext';
|
|
|
11
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
|
-
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, getBotRotation as calcGetBotRotation, 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, realNumberOrDefault, } from '../bots';
|
|
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, getBotRotation as calcGetBotRotation, 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, realNumberOrDefault, joinRoom as calcJoinRoom, leaveRoom as calcLeaveRoom, setRoomOptions as calcSetRoomOptions, getRoomOptions as calcGetRoomOptions, getRoomTrackOptions as calcGetRoomTrackOptions, setRoomTrackOptions as calcSetRoomTrackOptions, getRoomRemoteOptions as calcGetRoomRemoteOptions, } from '../bots';
|
|
15
15
|
import { sortBy, every, cloneDeep, union, isEqual, flatMap } from 'lodash';
|
|
16
16
|
import { remote as calcRemote, } from '@casual-simulation/causal-trees';
|
|
17
17
|
import { RanOutOfEnergyError } from './AuxResults';
|
|
@@ -124,6 +124,8 @@ function getBotSnapshot(bot) {
|
|
|
124
124
|
return b;
|
|
125
125
|
}
|
|
126
126
|
const DEAD_RECKONING_OFFSET = 50;
|
|
127
|
+
const DEG_TO_RAD = Math.PI / 180;
|
|
128
|
+
const RAD_TO_DEG = 180 / Math.PI;
|
|
127
129
|
/**
|
|
128
130
|
* Creates a library that includes the default functions and APIs.
|
|
129
131
|
* @param context The global context that should be used.
|
|
@@ -235,8 +237,6 @@ export function createDefaultLibrary(context) {
|
|
|
235
237
|
device,
|
|
236
238
|
isCollaborative,
|
|
237
239
|
getAB1BootstrapURL,
|
|
238
|
-
getMediaPermission,
|
|
239
|
-
getAverageFrameRate,
|
|
240
240
|
enableAR,
|
|
241
241
|
disableAR,
|
|
242
242
|
enableVR,
|
|
@@ -346,6 +346,15 @@ export function createDefaultLibrary(context) {
|
|
|
346
346
|
getPointerDirection,
|
|
347
347
|
getInputState,
|
|
348
348
|
getInputList,
|
|
349
|
+
getMediaPermission,
|
|
350
|
+
getAverageFrameRate,
|
|
351
|
+
joinRoom,
|
|
352
|
+
leaveRoom,
|
|
353
|
+
setRoomOptions,
|
|
354
|
+
getRoomOptions,
|
|
355
|
+
getRoomTrackOptions,
|
|
356
|
+
setRoomTrackOptions,
|
|
357
|
+
getRoomRemoteOptions,
|
|
349
358
|
registerTagPrefix: registerPrefix,
|
|
350
359
|
registerApp: registerApp,
|
|
351
360
|
unregisterApp,
|
|
@@ -482,6 +491,8 @@ export function createDefaultLibrary(context) {
|
|
|
482
491
|
setRandomSeed,
|
|
483
492
|
randomInt,
|
|
484
493
|
random,
|
|
494
|
+
degreesToRadians,
|
|
495
|
+
radiansToDegrees,
|
|
485
496
|
getForwardDirection,
|
|
486
497
|
intersectPlane,
|
|
487
498
|
getAnchorPointOffset,
|
|
@@ -3892,6 +3903,20 @@ export function createDefaultLibrary(context) {
|
|
|
3892
3903
|
}
|
|
3893
3904
|
return Math.random();
|
|
3894
3905
|
}
|
|
3906
|
+
/**
|
|
3907
|
+
* Converts the given number of degrees to radians and returns the result.
|
|
3908
|
+
* @param degrees The number of degrees.
|
|
3909
|
+
*/
|
|
3910
|
+
function degreesToRadians(degrees) {
|
|
3911
|
+
return degrees * DEG_TO_RAD;
|
|
3912
|
+
}
|
|
3913
|
+
/**
|
|
3914
|
+
* Converts the given number of radians to degrees and returns the result.
|
|
3915
|
+
* @param radians The number of radians.
|
|
3916
|
+
*/
|
|
3917
|
+
function radiansToDegrees(radians) {
|
|
3918
|
+
return radians * RAD_TO_DEG;
|
|
3919
|
+
}
|
|
3895
3920
|
/**
|
|
3896
3921
|
* Gets the forward direction for the given rotation.
|
|
3897
3922
|
* @param pointerRotation The rotation that the pointer has represented in radians.
|
|
@@ -5353,6 +5378,78 @@ export function createDefaultLibrary(context) {
|
|
|
5353
5378
|
const event = calcGetAverageFrameRate(task.taskId);
|
|
5354
5379
|
return addAsyncAction(task, event);
|
|
5355
5380
|
}
|
|
5381
|
+
/**
|
|
5382
|
+
* Attempts to join the given meeting room.
|
|
5383
|
+
* @param roomName The name of the meeting room to join.
|
|
5384
|
+
* @param options The options for the meeting.
|
|
5385
|
+
*/
|
|
5386
|
+
function joinRoom(roomName, options = {}) {
|
|
5387
|
+
const task = context.createTask();
|
|
5388
|
+
const event = calcJoinRoom(roomName, options, task.taskId);
|
|
5389
|
+
return addAsyncAction(task, event);
|
|
5390
|
+
}
|
|
5391
|
+
/**
|
|
5392
|
+
* Attempts to leave the given meeting room.
|
|
5393
|
+
* @param roomName THe name of the meeting room to leave.
|
|
5394
|
+
* @param options The options.
|
|
5395
|
+
*/
|
|
5396
|
+
function leaveRoom(roomName, options = {}) {
|
|
5397
|
+
const task = context.createTask();
|
|
5398
|
+
const event = calcLeaveRoom(roomName, options, task.taskId);
|
|
5399
|
+
return addAsyncAction(task, event);
|
|
5400
|
+
}
|
|
5401
|
+
/**
|
|
5402
|
+
* Attempts to set the options for the given meeting room.
|
|
5403
|
+
* Useful for enabling/disabling video, audio, and screensharing.
|
|
5404
|
+
* @param roomName The name of the room.
|
|
5405
|
+
* @param options The options to set. Omitted properties remain unchanged.
|
|
5406
|
+
*/
|
|
5407
|
+
function setRoomOptions(roomName, options) {
|
|
5408
|
+
const task = context.createTask();
|
|
5409
|
+
const event = calcSetRoomOptions(roomName, options, task.taskId);
|
|
5410
|
+
return addAsyncAction(task, event);
|
|
5411
|
+
}
|
|
5412
|
+
/**
|
|
5413
|
+
* Gets the options for the given meeting room.
|
|
5414
|
+
* Returns a promise that resolves with the options.
|
|
5415
|
+
* @param roomName The name of the room that the options should be retrieved for.
|
|
5416
|
+
*/
|
|
5417
|
+
function getRoomOptions(roomName) {
|
|
5418
|
+
const task = context.createTask();
|
|
5419
|
+
const event = calcGetRoomOptions(roomName, task.taskId);
|
|
5420
|
+
return addAsyncAction(task, event);
|
|
5421
|
+
}
|
|
5422
|
+
/**
|
|
5423
|
+
* Gets the options for the track with the given address in the given room.
|
|
5424
|
+
* @param roomName The name of the room.
|
|
5425
|
+
* @param address The address of the track that the options should be retrieved for.
|
|
5426
|
+
*/
|
|
5427
|
+
function getRoomTrackOptions(roomName, address) {
|
|
5428
|
+
const task = context.createTask();
|
|
5429
|
+
const event = calcGetRoomTrackOptions(roomName, address, task.taskId);
|
|
5430
|
+
return addAsyncAction(task, event);
|
|
5431
|
+
}
|
|
5432
|
+
/**
|
|
5433
|
+
* Sets the options for the track with the given address in the given room.
|
|
5434
|
+
* @param roomName The name of the room.
|
|
5435
|
+
* @param address The address of the track that the options should be retrieved for.
|
|
5436
|
+
* @param options The options that should be set for the track.
|
|
5437
|
+
*/
|
|
5438
|
+
function setRoomTrackOptions(roomName, address, options) {
|
|
5439
|
+
const task = context.createTask();
|
|
5440
|
+
const event = calcSetRoomTrackOptions(roomName, address, options, task.taskId);
|
|
5441
|
+
return addAsyncAction(task, event);
|
|
5442
|
+
}
|
|
5443
|
+
/**
|
|
5444
|
+
* Gets the options for the specified remote user in the specified room.
|
|
5445
|
+
* @param roomName The name of the room.
|
|
5446
|
+
* @param remoteId The ID of the remote user.
|
|
5447
|
+
*/
|
|
5448
|
+
function getRoomRemoteOptions(roomName, remoteId) {
|
|
5449
|
+
const task = context.createTask();
|
|
5450
|
+
const event = calcGetRoomRemoteOptions(roomName, remoteId, task.taskId);
|
|
5451
|
+
return addAsyncAction(task, event);
|
|
5452
|
+
}
|
|
5356
5453
|
/**
|
|
5357
5454
|
* Runs an event on the given bots.
|
|
5358
5455
|
* @param name The name of the event to run.
|