@casual-simulation/aux-runtime 3.5.3-alpha.15977308937 → 3.5.3-alpha.16326443512

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@casual-simulation/aux-runtime",
3
- "version": "3.5.3-alpha.15977308937",
3
+ "version": "3.5.3-alpha.16326443512",
4
4
  "description": "Runtime for AUX projects",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -32,8 +32,8 @@
32
32
  "access": "public"
33
33
  },
34
34
  "dependencies": {
35
- "@casual-simulation/aux-common": "^3.5.3-alpha.15977308937",
36
- "@casual-simulation/aux-records": "^3.5.3-alpha.15977308937",
35
+ "@casual-simulation/aux-common": "^3.5.3-alpha.16326443512",
36
+ "@casual-simulation/aux-records": "^3.5.3-alpha.16326443512",
37
37
  "@casual-simulation/crypto": "^3.5.0",
38
38
  "@casual-simulation/engine262": "0.0.1-4de2170374e22761996e46eb1362f4496ee57f8f",
39
39
  "@casual-simulation/error-stack-parser": "^2.0.7",
@@ -81,5 +81,5 @@
81
81
  "**/*.d.ts",
82
82
  "**/*.def"
83
83
  ],
84
- "gitHead": "03de4e213ff2898f75b87704629779ae2ee7028a"
84
+ "gitHead": "a2f91bd2715625eb0bf3febfa4a2380f0f868dd5"
85
85
  }
@@ -1,6 +1,6 @@
1
1
  import type { AuxGlobalContext } from './AuxGlobalContext';
2
2
  import { DEBUG_STRING } from './AuxGlobalContext';
3
- import type { BotTags, Bot, ShowChatOptions, BotAction, BotsState, CameraType, BarcodeFormat, PortalType, ShowInputOptions, 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, ReplaceDragBotAction, ShowInputForTagAction, GoToDimensionAction, GoToURLAction, OpenURLAction, OpenConsoleAction, RejectAction, FocusOnOptions, SnapTarget, AddDropSnapTargetsAction, RecordingOptions, Recording, SyntheticVoice, EnablePOVAction, EnableCustomDraggingAction, SetAppOutputAction, PartialBotsState, ParsedBotLink, ConvertGeolocationToWhat3WordsOptions, BeginAudioRecordingAction, MediaPermssionOptions, ImageClassifierOptions, ClassifyImagesOptions, ClassifyImagesResult, AddDropGridTargetsAction, InstUpdate, StartFormAnimationOptions, StopFormAnimationOptions, FormAnimationData, WakeLockConfiguration, EnableXROptions, ShowConfirmOptions, StoredAux, Geolocation, OpenPhotoCameraOptions, Photo, Point2D, RecordLoomOptions, LoomVideo, LoomVideoEmbedMetadata, InstallAuxFileMode, LoadServerConfigAction, InstConfig, UnloadServerConfigAction } from '@casual-simulation/aux-common/bots';
3
+ import type { BotTags, Bot, ShowChatOptions, BotAction, BotsState, CameraType, BarcodeFormat, PortalType, ShowInputOptions, 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, ReplaceDragBotAction, ShowInputForTagAction, GoToDimensionAction, GoToURLAction, OpenURLAction, OpenConsoleAction, RejectAction, FocusOnOptions, SnapTarget, AddDropSnapTargetsAction, RecordingOptions, Recording, SyntheticVoice, EnablePOVAction, EnableCustomDraggingAction, SetAppOutputAction, PartialBotsState, ParsedBotLink, ConvertGeolocationToWhat3WordsOptions, BeginAudioRecordingAction, MediaPermssionOptions, ImageClassifierOptions, ClassifyImagesOptions, ClassifyImagesResult, AddDropGridTargetsAction, InstUpdate, StartFormAnimationOptions, StopFormAnimationOptions, FormAnimationData, WakeLockConfiguration, EnableXROptions, ShowConfirmOptions, StoredAux, Geolocation, OpenPhotoCameraOptions, Photo, Point2D, RecordLoomOptions, LoomVideo, LoomVideoEmbedMetadata, InstallAuxFileMode, LoadServerConfigAction, InstConfig, UnloadServerConfigAction, Point3D, MapLayer } from '@casual-simulation/aux-common/bots';
4
4
  import type { AIChatOptions, AIGenerateSkyboxOptions, AIGenerateImageOptions, JoinRoomActionOptions, RoomOptions, RoomTrackOptions, SetRoomTrackOptions, RoomRemoteOptions, DataRecordOptions, RecordActionOptions, ListDataOptions, AISloydGenerateModelOptions, ListWebhooksOptions, ListNotificationsOptions, SendNotificationOptions, GrantEntitlementsRequest, GrantEntitlementsResult, InstallPackageResult } from './RecordsEvents';
5
5
  import type { RemoteAction, AvailablePermissions, Entitlement, VersionNumber } from '@casual-simulation/aux-common';
6
6
  import '@casual-simulation/aux-common/polyfill/Array.first.polyfill';
@@ -2527,6 +2527,10 @@ export declare function createDefaultLibrary(context: AuxGlobalContext): {
2527
2527
  calculateRayFromCamera: (portal: "grid" | "miniGrid" | "map" | "miniMap", viewportCoordinates: Vector2) => Promise<RaycastRay>;
2528
2528
  calculateViewportCoordinatesFromPosition: (portal: "grid" | "miniGrid" | "map" | "miniMap", position: Vector3) => Promise<Vector2>;
2529
2529
  calculateScreenCoordinatesFromViewportCoordinates: (portal: "grid" | "miniGrid" | "map" | "miniMap", coordinates: Point2D) => Promise<Vector2>;
2530
+ calculateScreenCoordinatesFromPosition: {
2531
+ (portal: "grid" | "miniGrid" | "map" | "miniMap", coordinate: Point3D): Promise<Vector2>;
2532
+ (portal: "grid" | "miniGrid" | "map" | "miniMap", coordinates: Point3D[]): Promise<Vector2[]>;
2533
+ };
2530
2534
  calculateViewportCoordinatesFromScreenCoordinates: (portal: "grid" | "miniGrid" | "map" | "miniMap", coordinates: Point2D) => Promise<Vector2>;
2531
2535
  bufferFormAddressGLTF: (address: string) => Promise<void>;
2532
2536
  startFormAnimation: (botOrBots: Bot | string | (Bot | string)[], nameOrIndex: string | number, options?: StartFormAnimationOptions) => Promise<void>;
@@ -2536,6 +2540,8 @@ export declare function createDefaultLibrary(context: AuxGlobalContext): {
2536
2540
  ldrawCountTextBuildSteps: (text: string) => Promise<number>;
2537
2541
  attachDebugger: (debug: DebuggerInterface, options?: AttachDebuggerOptions) => Promise<void>;
2538
2542
  detachDebugger: (debug: DebuggerInterface) => Promise<void>;
2543
+ addMapLayer: (portal: "map" | "miniMap", layer: MapLayer) => Promise<string>;
2544
+ removeMapLayer: (layerId: string) => Promise<void>;
2539
2545
  remotes: () => Promise<string[]>;
2540
2546
  listInstUpdates: () => Promise<InstUpdate[]>;
2541
2547
  getInstStateFromUpdates: (updates: InstUpdate[]) => Promise<BotsState>;
@@ -1,5 +1,5 @@
1
1
  import { DEBUG_STRING, debugStringifyFunction } from './AuxGlobalContext';
2
- import { hasValue, trimTag, isBot, BOT_SPACE_TAG, toast as toastMessage, getScriptIssues as scriptIssues, 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, showConfirm as calcShowConfirm, replaceDragBot as calcReplaceDragBot, goToDimension as calcGoToDimension, goToURL as calcGoToURL, openURL as calcOpenURL, playSound as calcPlaySound, bufferSound as calcBufferSound, cancelSound as calcCancelSound, shell as calcShell, reject as calcReject, localFormAnimation as calcLocalFormAnimation, webhook as calcWebhook, superShout as calcSuperShout, share as calcShare, registerPrefix as calcRegisterPrefix, 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, getRemoteCount, getRemotes, listInstUpdates as calcListInstUpdates, getInstStateFromUpdates as calcGetInstStateFromUpdates, action, 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, meetCommand as calcMeetCommand, meetFunction as calcMeetFunction, openImageClassifier as calcOpenImageClassifier, classifyImages as calcOpenClassifyImages, isBotDate, DATE_TAG_PREFIX, parseBotDate, realNumberOrDefault, raycastFromCamera as calcRaycastFromCamera, raycastInPortal as calcRaycastInPortal, calculateRayFromCamera as calcCalculateRayFromCamera, bufferFormAddressGltf, startFormAnimation as calcStartFormAnimation, stopFormAnimation as calcStopFormAnimation, listFormAnimations as calcListFormAnimations, calculateStringTagValue, createInitializationUpdate as calcCreateInitalizationUpdate, applyUpdatesToInst as calcApplyUpdatesToInst, configureWakeLock, getWakeLockConfiguration as calcGetWakeLockConfiguration, analyticsRecordEvent as calcAnalyticsRecordEvent, KNOWN_TAGS, isStoredVersion2, getCurrentInstUpdate as calcGetCurrentInstUpdate, openPhotoCamera as calcOpenPhotoCamera, getEasing, enableCollaboration as calcEnableCollaboration, showAccountInfo as calcShowAccountInfo, reportInst as calcReportInst, getRecordsEndpoint as calcGetRecordsEndpoint, ldrawCountAddressBuildSteps as calcLdrawCountAddressBuildSteps, ldrawCountTextBuildSteps as calcLdrawCountTextBuildSteps, calculateViewportCoordinatesFromPosition as calcCalculateViewportCoordinatesFromPosition, calculateScreenCoordinatesFromViewportCoordinates as calcCalculateScreenCoordinatesFromViewportCoordinates, calculateViewportCoordinatesFromScreenCoordinates as calcCalculateViewportCoordinatesFromScreenCoordinates, capturePortalScreenshot as calcCapturePortalScreenshot, createStaticHtml as calcCreateStaticHtmlFromBots, recordLoom, watchLoom, getLoomMetadata, loadSharedDocument, installAuxFile as calcInstallAuxFile, calculateStringListTagValue, } from '@casual-simulation/aux-common/bots';
2
+ import { hasValue, trimTag, isBot, BOT_SPACE_TAG, toast as toastMessage, getScriptIssues as scriptIssues, 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, showConfirm as calcShowConfirm, replaceDragBot as calcReplaceDragBot, goToDimension as calcGoToDimension, goToURL as calcGoToURL, openURL as calcOpenURL, playSound as calcPlaySound, bufferSound as calcBufferSound, cancelSound as calcCancelSound, shell as calcShell, reject as calcReject, localFormAnimation as calcLocalFormAnimation, webhook as calcWebhook, superShout as calcSuperShout, share as calcShare, registerPrefix as calcRegisterPrefix, 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, getRemoteCount, getRemotes, listInstUpdates as calcListInstUpdates, getInstStateFromUpdates as calcGetInstStateFromUpdates, action, 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, meetCommand as calcMeetCommand, meetFunction as calcMeetFunction, openImageClassifier as calcOpenImageClassifier, classifyImages as calcOpenClassifyImages, isBotDate, DATE_TAG_PREFIX, parseBotDate, realNumberOrDefault, raycastFromCamera as calcRaycastFromCamera, raycastInPortal as calcRaycastInPortal, calculateRayFromCamera as calcCalculateRayFromCamera, bufferFormAddressGltf, startFormAnimation as calcStartFormAnimation, stopFormAnimation as calcStopFormAnimation, listFormAnimations as calcListFormAnimations, calculateStringTagValue, createInitializationUpdate as calcCreateInitalizationUpdate, applyUpdatesToInst as calcApplyUpdatesToInst, configureWakeLock, getWakeLockConfiguration as calcGetWakeLockConfiguration, analyticsRecordEvent as calcAnalyticsRecordEvent, KNOWN_TAGS, isStoredVersion2, getCurrentInstUpdate as calcGetCurrentInstUpdate, openPhotoCamera as calcOpenPhotoCamera, getEasing, enableCollaboration as calcEnableCollaboration, showAccountInfo as calcShowAccountInfo, reportInst as calcReportInst, getRecordsEndpoint as calcGetRecordsEndpoint, ldrawCountAddressBuildSteps as calcLdrawCountAddressBuildSteps, ldrawCountTextBuildSteps as calcLdrawCountTextBuildSteps, calculateViewportCoordinatesFromPosition as calcCalculateViewportCoordinatesFromPosition, calculateScreenCoordinatesFromViewportCoordinates as calcCalculateScreenCoordinatesFromViewportCoordinates, calculateViewportCoordinatesFromScreenCoordinates as calcCalculateViewportCoordinatesFromScreenCoordinates, capturePortalScreenshot as calcCapturePortalScreenshot, createStaticHtml as calcCreateStaticHtmlFromBots, recordLoom, watchLoom, getLoomMetadata, loadSharedDocument, installAuxFile as calcInstallAuxFile, calculateStringListTagValue, calculateScreenCoordinatesFromPosition as calcCalculateScreenCoordinatesFromPosition, addMapLayer as calcAddMapLayer, removeMapLayer as calcRemoveMapLayer, } from '@casual-simulation/aux-common/bots';
3
3
  import { aiChat, aiChatStream, aiGenerateSkybox, aiGenerateImage, grantRecordPermission as calcGrantRecordPermission, revokeRecordPermission as calcRevokeRecordPermission, grantInstAdminPermission as calcGrantInstAdminPermission, grantUserRole as calcGrantUserRole, revokeUserRole as calcRevokeUserRole, grantInstRole as calcGrantInstRole, revokeInstRole as calcRevokeInstRole, listUserStudios as calcListUserStudios, joinRoom as calcJoinRoom, leaveRoom as calcLeaveRoom, setRoomOptions as calcSetRoomOptions, getRoomOptions as calcGetRoomOptions, getRoomTrackOptions as calcGetRoomTrackOptions, setRoomTrackOptions as calcSetRoomTrackOptions, getRoomRemoteOptions as calcGetRoomRemoteOptions, listDataRecord, recordEvent as calcRecordEvent, getEventCount as calcGetEventCount, getFile as calcGetFile, eraseFile as calcEraseFile, getPublicRecordKey as calcGetPublicRecordKey, recordData as calcRecordData, getRecordData, eraseRecordData, recordFile as calcRecordFile, listDataRecordByMarker, aiHumeGetAccessToken, aiSloydGenerateModel, recordWebhook as calcRecordWebhook, getWebhook as calcGetWebhook, listWebhooks as calcListWebhooks, listWebhooksByMarker as calcListWebhooksByMarker, eraseWebhook as calcEraseWebhook, runWebhook as calcRunWebhook, recordNotification as calcRecordNotification, getNotification as calcGetNotification, listNotifications as calcListNotifications, listNotificationsByMarker as calcListNotificationsByMarker, eraseNotification as calcEraseNotification, subscribeToNotification as calcSubscribeToNotification, unsubscribeFromNotification as calcUnsubscribeFromNotification, sendNotification as calcSendNotification, listNotificationSubscriptions as calcListNotificationSubscriptions, listUserNotificationSubscriptions as calcListUserNotificationSubscriptions, aiOpenAICreateRealtimeSession, grantEntitlements as calcGrantEntitlements, recordPackageVersion as calcRecordPackageVersion, erasePackageVersion as calcErasePackageVersion, listPackageVersions as calcListPackageVersions, getPackageVersion as calcGetPackageVersion, recordPackageContainer as calcRecordPackageContainer, erasePackageContaienr as calcErasePackageContainer, listPackageContainers as calcListPackageContainers, listPackageContainersByMarker as calcListPackageContainersByMarker, getPackageContainer as calcGetPackageContainer, installPackage as calcInstallPackage, listInstalledPackages as calcListInstalledPackages, } from './RecordsEvents';
4
4
  import { sortBy, every, cloneDeep, union, isEqual, flatMap } from 'lodash';
5
5
  import { remote as calcRemote, DEFAULT_BRANCH_NAME, formatVersionNumber, parseVersionNumber, PRIVATE_MARKER, } from '@casual-simulation/aux-common';
@@ -599,6 +599,7 @@ export function createDefaultLibrary(context) {
599
599
  calculateRayFromCamera,
600
600
  calculateViewportCoordinatesFromPosition,
601
601
  calculateScreenCoordinatesFromViewportCoordinates,
602
+ calculateScreenCoordinatesFromPosition,
602
603
  calculateViewportCoordinatesFromScreenCoordinates,
603
604
  bufferFormAddressGLTF,
604
605
  startFormAnimation,
@@ -608,6 +609,8 @@ export function createDefaultLibrary(context) {
608
609
  ldrawCountTextBuildSteps,
609
610
  attachDebugger,
610
611
  detachDebugger,
612
+ addMapLayer,
613
+ removeMapLayer,
611
614
  remotes,
612
615
  listInstUpdates,
613
616
  getInstStateFromUpdates,
@@ -6860,6 +6863,37 @@ export function createDefaultLibrary(context) {
6860
6863
  }, task.taskId);
6861
6864
  return addAsyncAction(task, event);
6862
6865
  }
6866
+ /**
6867
+ * Calculates the screen coordinates that the given 3D position map to on the screen.
6868
+ * Returns a promise that resolves with the calculated screen coordinates.
6869
+ *
6870
+ * Screen coordinates are in pixels and are relative to the top-left corner of the screen.
6871
+ *
6872
+ * @param portal the name of the portal that should be tested.
6873
+ * @param coordinates the 3D positions that should be converted to screen coordinates.
6874
+ *
6875
+ * @example Calculate the screen coordinates of the bots in the home dimension in the grid portal
6876
+ * const botPositions = getBots(inDimension('home')).map(bot => new Vector3(bot.tags.homeX, bot.tags.homeY, bot.tags.homeZ));
6877
+ * const coordinates = await os.calculateScreenCoordinatesFromPosition('grid', botPositions);
6878
+ */
6879
+ function calculateScreenCoordinatesFromPosition(portal, coordinates) {
6880
+ const task = context.createTask();
6881
+ const event = calcCalculateScreenCoordinatesFromPosition(portal, Array.isArray(coordinates) ? coordinates : [coordinates], task.taskId);
6882
+ const promise = addAsyncAction(task, event);
6883
+ if (Array.isArray(coordinates)) {
6884
+ return promise;
6885
+ }
6886
+ else {
6887
+ const final = promise.then((r) => {
6888
+ if (Array.isArray(r) && r.length === 1) {
6889
+ return r[0];
6890
+ }
6891
+ return r;
6892
+ });
6893
+ final[ORIGINAL_OBJECT] = event;
6894
+ return final;
6895
+ }
6896
+ }
6863
6897
  /**
6864
6898
  * Calculates the viewport coordinates that the given screen coordinates map to on the camera.
6865
6899
  * Returns a promise that resolves with the calculated viewport coordinates.
@@ -7093,6 +7127,88 @@ export function createDefaultLibrary(context) {
7093
7127
  const event = detachRuntime(runtime, task.taskId);
7094
7128
  return addAsyncAction(task, event);
7095
7129
  }
7130
+ /**
7131
+ * Adds a map layer to the map or miniMap portal.
7132
+ *
7133
+ * Returns a promise that resolves with the ID of the layer that was added.
7134
+ *
7135
+ * @param portal The portal that the layer should be added to. Either 'map' or 'miniMap'.
7136
+ * @param layer The layer that should be added.
7137
+ *
7138
+ * @example Add a GeoJSON layer to the map portal
7139
+ * const layerId = await os.addMapLayer('map', {
7140
+ * type: 'geojson',
7141
+ * data: {
7142
+ * type: "FeatureCollection",
7143
+ * features: [
7144
+ * {
7145
+ * type: "Feature",
7146
+ * geometry: { type: "Point", coordinates: [102.0, 0.5] },
7147
+ * properties: { prop0: "value0" }
7148
+ * },
7149
+ * {
7150
+ * type: "Feature",
7151
+ * geometry: {
7152
+ * type: "LineString",
7153
+ * coordinates: [
7154
+ * [102.0, 0.0], [103.0, 1.0], [104.0, 0.0], [105.0, 1.0]
7155
+ * ]
7156
+ * },
7157
+ * properties: {
7158
+ * prop0: "value0",
7159
+ * prop1: 0.0
7160
+ * }
7161
+ * },
7162
+ * {
7163
+ * type: "Feature",
7164
+ * geometry: {
7165
+ * type: "Polygon",
7166
+ * coordinates: [
7167
+ * [[100.0, 0.0], [101.0, 0.0], [101.0, 1.0],
7168
+ * [100.0, 1.0], [100.0, 0.0]]
7169
+ * ]
7170
+ * },
7171
+ * properties: {
7172
+ * prop0: "value0",
7173
+ * prop1: { "this": "that" }
7174
+ * }
7175
+ * }
7176
+ * ]
7177
+ * }
7178
+ * });
7179
+ *
7180
+ * @dochash actions/os/maps
7181
+ * @doctitle Map Actions
7182
+ * @docsidebar Maps
7183
+ * @docdescription Actions for working with maps and map layers.
7184
+ * @docid os.addMapLayer
7185
+ * @docname os.addMapLayer
7186
+ */
7187
+ function addMapLayer(portal, layer) {
7188
+ const task = context.createTask();
7189
+ const event = calcAddMapLayer(portal, layer, task.taskId);
7190
+ return addAsyncAction(task, event);
7191
+ }
7192
+ /**
7193
+ * Removes a layer from the map or miniMap portal.
7194
+ *
7195
+ * Returns a promise that resolves when the layer has been removed.
7196
+ *
7197
+ * @param layerId The ID of the layer to remove.
7198
+ * @returns A promise that resolves when the layer has been removed.
7199
+ *
7200
+ * @example Remove a layer from the map portal
7201
+ * await os.removeMapLayer('my-layer-id');
7202
+ *
7203
+ * @dochash actions/os/maps
7204
+ * @docid os.removeMapLayer
7205
+ * @docname os.removeMapLayer
7206
+ */
7207
+ function removeMapLayer(layerId) {
7208
+ const task = context.createTask();
7209
+ const event = calcRemoveMapLayer(layerId, task.taskId);
7210
+ return addAsyncAction(task, event);
7211
+ }
7096
7212
  /**
7097
7213
  * Executes the given shell script on the server.
7098
7214
  * @param script The shell script that should be executed.
@@ -10011,6 +10127,9 @@ export function createDefaultLibrary(context) {
10011
10127
  * @example Decrypt the given data and toast it.
10012
10128
  * const decrypted = crypto.decrypt("key", "v1.vWUhsdfiKkxXi9Rt+BBNbcP/TiHZpxUL.iikPvWN6rNncY3j045gM0268MoRi0NNf.IpWYgzXQmjRea4MNLDXB1GmrinWLSSOMw+NfqeE=");
10013
10129
  * os.toast(decrypted);
10130
+ *
10131
+ * @dochash actions/crypto
10132
+ * @docname crypto.decrypt
10014
10133
  */
10015
10134
  function decrypt(secret, data) {
10016
10135
  if (typeof data === 'string') {