@casual-simulation/aux-runtime 3.4.6-alpha.14601027727 → 3.5.0-alpha.15117651144

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,48 +1,8 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- var __asyncValues = (this && this.__asyncValues) || function (o) {
11
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
12
- var m = o[Symbol.asyncIterator], i;
13
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
14
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
15
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
16
- };
17
- var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
18
- var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
19
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
20
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
21
- return i = {}, verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
22
- function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
23
- function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
24
- function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
25
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
26
- function fulfill(value) { resume("next", value); }
27
- function reject(value) { resume("throw", value); }
28
- function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
29
- };
30
- var __rest = (this && this.__rest) || function (s, e) {
31
- var t = {};
32
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
33
- t[p] = s[p];
34
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
35
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
36
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
37
- t[p[i]] = s[p[i]];
38
- }
39
- return t;
40
- };
41
- import { DEBUG_STRING, debugStringifyFunction, } from './AuxGlobalContext';
42
- 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, } from '@casual-simulation/aux-common/bots';
43
- 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, } from './RecordsEvents';
44
- import { sortBy, every, cloneDeep, union, isEqual, flatMap, } from 'lodash';
45
- import { remote as calcRemote, DEFAULT_BRANCH_NAME, } from '@casual-simulation/aux-common';
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, } from '@casual-simulation/aux-common/bots';
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
+ import { sortBy, every, cloneDeep, union, isEqual, flatMap } from 'lodash';
5
+ import { remote as calcRemote, DEFAULT_BRANCH_NAME, formatVersionNumber, parseVersionNumber, PRIVATE_MARKER, } from '@casual-simulation/aux-common';
46
6
  import { RanOutOfEnergyError } from './AuxResults';
47
7
  import '@casual-simulation/aux-common/polyfill/Array.first.polyfill';
48
8
  import '@casual-simulation/aux-common/polyfill/Array.last.polyfill';
@@ -52,7 +12,7 @@ import { sha256 as hashSha256, sha512 as hashSha512, hmac as calcHmac, sha1 as h
52
12
  import stableStringify from '@casual-simulation/fast-json-stable-stringify';
53
13
  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';
54
14
  import { apply, del, insert, isTagEdit, preserve, } from '@casual-simulation/aux-common/bots';
55
- import { Vector3 as ThreeVector3, Plane, Ray, } from '@casual-simulation/three';
15
+ import { Vector3 as ThreeVector3, Plane, Ray } from '@casual-simulation/three';
56
16
  import mime from 'mime';
57
17
  import TWEEN from '@tweenjs/tween.js';
58
18
  import './PerformanceNowPolyfill';
@@ -62,7 +22,7 @@ import { Fragment, h } from 'preact';
62
22
  import htm from 'htm';
63
23
  import { fromByteArray, toByteArray } from 'base64-js';
64
24
  import expect, { iterableEquality } from '@casual-simulation/expect';
65
- import { parseRecordKey, isRecordKey as calcIsRecordKey, } from '@casual-simulation/aux-records';
25
+ import { parseRecordKey, isRecordKey as calcIsRecordKey, } from '@casual-simulation/aux-common';
66
26
  import SeedRandom from 'seedrandom';
67
27
  import { DateTime } from 'luxon';
68
28
  import * as hooks from 'preact/hooks';
@@ -189,7 +149,12 @@ const RAD_TO_DEG = 180 / Math.PI;
189
149
  export function createDefaultLibrary(context) {
190
150
  // TODO: Remove deprecated functions
191
151
  webhook.post = function (url, data, options) {
192
- return webhook(Object.assign(Object.assign({}, options), { method: 'POST', url: url, data: data }));
152
+ return webhook({
153
+ ...options,
154
+ method: 'POST',
155
+ url: url,
156
+ data: data,
157
+ });
193
158
  };
194
159
  const webhookFunc = makeMockableFunction(webhook, 'webhook');
195
160
  webhookFunc.post = makeMockableFunction(webhook.post, 'webhook.post');
@@ -401,6 +366,8 @@ export function createDefaultLibrary(context) {
401
366
  download: downloadData,
402
367
  downloadBots,
403
368
  downloadBotsAsInitialzationUpdate,
369
+ getAuxFileForBots,
370
+ installAuxFile,
404
371
  downloadServer,
405
372
  downloadInst: downloadServer,
406
373
  showUploadAuxFile,
@@ -563,8 +530,8 @@ export function createDefaultLibrary(context) {
563
530
  registerApp: registerApp,
564
531
  unregisterApp,
565
532
  compileApp: setAppContent,
566
- appHooks: Object.assign(Object.assign({}, hooks), { render, createRef, createContext }),
567
- appCompat: Object.assign({}, compat),
533
+ appHooks: { ...hooks, render, createRef, createContext },
534
+ appCompat: { ...compat },
568
535
  listBuiltinTags,
569
536
  reportInst,
570
537
  requestAuthBot,
@@ -610,6 +577,20 @@ export function createDefaultLibrary(context) {
610
577
  eraseFile,
611
578
  recordEvent,
612
579
  countEvents,
580
+ parseVersionKey,
581
+ formatVersionKey,
582
+ grantEntitlements,
583
+ recordPackageVersion,
584
+ erasePackageVersion,
585
+ listPackageVersions,
586
+ getPackageVersion,
587
+ recordPackageContainer,
588
+ erasePackageContainer,
589
+ listPackageContainers,
590
+ listPackageContainersByMarker,
591
+ getPackageContainer,
592
+ installPackage,
593
+ listInstalledPackages,
613
594
  listUserStudios,
614
595
  getRecordsEndpoint,
615
596
  convertGeolocationToWhat3Words,
@@ -1667,9 +1648,11 @@ export function createDefaultLibrary(context) {
1667
1648
  for (let bot of bots) {
1668
1649
  let b = (state[bot.id] = {
1669
1650
  id: bot.id,
1670
- tags: Object.assign({}, (typeof bot.tags.toJSON === 'function'
1671
- ? bot.tags.toJSON()
1672
- : bot.tags)),
1651
+ tags: {
1652
+ ...(typeof bot.tags.toJSON === 'function'
1653
+ ? bot.tags.toJSON()
1654
+ : bot.tags),
1655
+ },
1673
1656
  });
1674
1657
  if (bot.space) {
1675
1658
  b.space = bot.space;
@@ -1946,41 +1929,26 @@ export function createDefaultLibrary(context) {
1946
1929
  }
1947
1930
  const action = aiChatStream(inputMessages, options, task.taskId);
1948
1931
  const promise = addAsyncResultIterableAction(task, action).then((iterable) => {
1949
- function generator() {
1950
- return __asyncGenerator(this, arguments, function* generator_1() {
1951
- var _a, e_1, _b, _c;
1952
- try {
1953
- for (var _d = true, iterable_1 = __asyncValues(iterable), iterable_1_1; iterable_1_1 = yield __await(iterable_1.next()), _a = iterable_1_1.done, !_a; _d = true) {
1954
- _c = iterable_1_1.value;
1955
- _d = false;
1956
- let result = _c;
1957
- if (result.choices.length <= 0) {
1958
- continue;
1959
- }
1960
- const choice = result.choices[0];
1961
- if (!hasValue(choice)) {
1962
- continue;
1963
- }
1964
- if (returnString) {
1965
- const content = choice === null || choice === void 0 ? void 0 : choice.content;
1966
- if (!hasValue(content)) {
1967
- continue;
1968
- }
1969
- yield yield __await(content);
1970
- }
1971
- else {
1972
- yield yield __await(choice);
1973
- }
1974
- }
1932
+ async function* generator() {
1933
+ for await (let result of iterable) {
1934
+ if (result.choices.length <= 0) {
1935
+ continue;
1975
1936
  }
1976
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
1977
- finally {
1978
- try {
1979
- if (!_d && !_a && (_b = iterable_1.return)) yield __await(_b.call(iterable_1));
1937
+ const choice = result.choices[0];
1938
+ if (!hasValue(choice)) {
1939
+ continue;
1940
+ }
1941
+ if (returnString) {
1942
+ const content = choice === null || choice === void 0 ? void 0 : choice.content;
1943
+ if (!hasValue(content)) {
1944
+ continue;
1980
1945
  }
1981
- finally { if (e_1) throw e_1.error; }
1946
+ yield content;
1982
1947
  }
1983
- });
1948
+ else {
1949
+ yield choice;
1950
+ }
1951
+ }
1984
1952
  }
1985
1953
  return generator();
1986
1954
  });
@@ -2033,18 +2001,28 @@ export function createDefaultLibrary(context) {
2033
2001
  action = aiGenerateImage(prompt, negativePrompt, task.taskId);
2034
2002
  }
2035
2003
  else {
2036
- let _a = options !== null && options !== void 0 ? options : {}, { endpoint } = _a, parameters = __rest(_a, ["endpoint"]);
2037
- action = aiGenerateImage(Object.assign(Object.assign({}, parameters), { prompt, negativePrompt: negativePrompt }), {
2004
+ let { endpoint, ...parameters } = options !== null && options !== void 0 ? options : {};
2005
+ action = aiGenerateImage({
2006
+ ...parameters,
2007
+ prompt,
2008
+ negativePrompt: negativePrompt,
2009
+ }, {
2038
2010
  endpoint,
2039
2011
  }, task.taskId);
2040
2012
  }
2041
2013
  const final = addAsyncResultAction(task, action).then((result) => {
2042
2014
  var _a;
2043
2015
  if (returnObject) {
2044
- return Object.assign(Object.assign({}, result), { images: result.images.map((image) => {
2016
+ return {
2017
+ ...result,
2018
+ images: result.images.map((image) => {
2045
2019
  var _a;
2046
- return (Object.assign(Object.assign({}, image), { url: toBase64Url(image.base64, (_a = image.mimeType) !== null && _a !== void 0 ? _a : 'image/png') }));
2047
- }) });
2020
+ return ({
2021
+ ...image,
2022
+ url: toBase64Url(image.base64, (_a = image.mimeType) !== null && _a !== void 0 ? _a : 'image/png'),
2023
+ });
2024
+ }),
2025
+ };
2048
2026
  }
2049
2027
  else {
2050
2028
  const image = result.images[0];
@@ -2523,7 +2501,11 @@ export function createDefaultLibrary(context) {
2523
2501
  }
2524
2502
  function focusOn(botOrPosition, options) {
2525
2503
  const task = context.createTask();
2526
- const finalOptions = Object.assign({ duration: 1, easing: 'quadratic' }, (options !== null && options !== void 0 ? options : {}));
2504
+ const finalOptions = {
2505
+ duration: 1,
2506
+ easing: 'quadratic',
2507
+ ...(options !== null && options !== void 0 ? options : {}),
2508
+ };
2527
2509
  let action;
2528
2510
  if (botOrPosition === null) {
2529
2511
  action = cancelAnimation(task.taskId);
@@ -3121,6 +3103,71 @@ export function createDefaultLibrary(context) {
3121
3103
  const downloadedFilename = formatAuxFilename(filename);
3122
3104
  return addAction(download(data, downloadedFilename, mime.getType(downloadedFilename) || 'application/json'));
3123
3105
  }
3106
+ /**
3107
+ * Gets the JSON representation of the given bots as an .aux file.
3108
+ *
3109
+ * This function is useful for getting the contents of an aux file without downloading it.
3110
+ *
3111
+ * @param bots The bots that should be converted to JSON.
3112
+ * @param options The options that should be used for the conversion.
3113
+ *
3114
+ * @example Get the current bot as an aux file.
3115
+ * const myAux = os.getAuxFileForBots([bot]);
3116
+ *
3117
+ * @example Download the current bot as an aux file.
3118
+ * const myAux = os.getAuxFileForBots([bot]);
3119
+ * os.download(myAux, "myAux.aux");
3120
+ *
3121
+ * @example Get the current bot as an aux file with version 1.
3122
+ * const myAux = os.getAuxFileForBots([bot], { version: 1 });
3123
+ *
3124
+ * @dochash actions/os/files
3125
+ * @docname os.getAuxFileForBots
3126
+ */
3127
+ function getAuxFileForBots(bots, options) {
3128
+ var _a;
3129
+ const version = (_a = options === null || options === void 0 ? void 0 : options.version) !== null && _a !== void 0 ? _a : 2;
3130
+ if (version === 1) {
3131
+ let state = {};
3132
+ for (let bot of bots) {
3133
+ if (isRuntimeBot(bot)) {
3134
+ state[bot.id] = createBot(bot.id, bot.tags.toJSON(), bot.space);
3135
+ }
3136
+ else {
3137
+ state[bot.id] = bot;
3138
+ }
3139
+ }
3140
+ return getVersion1DownloadState(state);
3141
+ }
3142
+ else {
3143
+ bots = bots.map((b) => isRuntimeBot(b) ? createBot(b.id, b.tags.toJSON(), b.space) : b);
3144
+ const update = constructInitializationUpdate(calcCreateInitalizationUpdate(bots));
3145
+ return getVersion2DownloadState(update);
3146
+ }
3147
+ }
3148
+ /**
3149
+ * Installs the given aux file into the inst.
3150
+ *
3151
+ * Depending on the version of the aux file, this may overwrite existing bots.
3152
+ *
3153
+ * @param aux The aux file that should be installed.
3154
+ * @param mode The mode that should be used to install the bots in the AUX file.
3155
+ * - `"default"` indicates that the aux file will be installed as-is.
3156
+ * If the file was already installed, then it will either overwrite bots or do nothing depending on the version of the aux.
3157
+ * Version 1 auxes will overwrite existing bots, while version 2 auxes will do nothing.
3158
+ * - `"copy"` indicates that all the bots in the aux file should be given new IDs. This is useful if you want to be able to install an AUX multiple times in the same inst.
3159
+ *
3160
+ * @example Install an aux file.
3161
+ * await os.installAuxFile(myAux);
3162
+ *
3163
+ * @dochash actions/os/files
3164
+ * @docname os.installAuxFile
3165
+ */
3166
+ function installAuxFile(aux, mode) {
3167
+ const task = context.createTask(true, true);
3168
+ const action = calcRemote(calcInstallAuxFile(aux, mode !== null && mode !== void 0 ? mode : 'default'), undefined, undefined, task.taskId);
3169
+ return addAsyncAction(task, action);
3170
+ }
3124
3171
  /**
3125
3172
  * Downloads all of the shared bots into a `.aux` file on the player's computer. The file will have the same name as the inst.
3126
3173
  *
@@ -4912,26 +4959,24 @@ export function createDefaultLibrary(context) {
4912
4959
  function requestAuthBotInBackground() {
4913
4960
  return _requestAuthBot(true);
4914
4961
  }
4915
- function _requestAuthBot(background) {
4916
- return __awaiter(this, void 0, void 0, function* () {
4917
- const data = yield requestAuthData(background);
4918
- if (!data) {
4919
- return null;
4920
- }
4921
- let bot = getBot('id', data.userId);
4922
- if (!bot) {
4923
- bot = context.createBot(createBot(data.userId, {
4924
- avatarAddress: data.avatarUrl,
4925
- avatarPortraitAddress: data.avatarPortraitUrl,
4926
- name: data.name,
4927
- hasActiveSubscription: data.hasActiveSubscription,
4928
- subscriptionTier: data.subscriptionTier,
4929
- privacyFeatures: data.privacyFeatures,
4930
- }, TEMPORARY_BOT_PARTITION_ID));
4931
- }
4932
- yield defineGlobalBot('auth', bot.id);
4933
- return bot;
4934
- });
4962
+ async function _requestAuthBot(background) {
4963
+ const data = await requestAuthData(background);
4964
+ if (!data) {
4965
+ return null;
4966
+ }
4967
+ let bot = getBot('id', data.userId);
4968
+ if (!bot) {
4969
+ bot = context.createBot(createBot(data.userId, {
4970
+ avatarAddress: data.avatarUrl,
4971
+ avatarPortraitAddress: data.avatarPortraitUrl,
4972
+ name: data.name,
4973
+ hasActiveSubscription: data.hasActiveSubscription,
4974
+ subscriptionTier: data.subscriptionTier,
4975
+ privacyFeatures: data.privacyFeatures,
4976
+ }, TEMPORARY_BOT_PARTITION_ID));
4977
+ }
4978
+ await defineGlobalBot('auth', bot.id);
4979
+ return bot;
4935
4980
  }
4936
4981
  function requestAuthData(background) {
4937
4982
  const task = context.createTask();
@@ -5289,7 +5334,7 @@ export function createDefaultLibrary(context) {
5289
5334
  options.endpoint = endpointOrOptions;
5290
5335
  }
5291
5336
  else {
5292
- let { marker } = endpointOrOptions, rest = __rest(endpointOrOptions, ["marker"]);
5337
+ let { marker, ...rest } = endpointOrOptions;
5293
5338
  options = rest;
5294
5339
  if (hasValue(marker)) {
5295
5340
  options.markers = [
@@ -6305,6 +6350,297 @@ export function createDefaultLibrary(context) {
6305
6350
  const event = calcGetEventCount(recordName, eventName, options, task.taskId);
6306
6351
  return addAsyncAction(task, event);
6307
6352
  }
6353
+ /**
6354
+ * Grants the given entitlements to a package.
6355
+ *
6356
+ * @param request The request to grant entitlements.
6357
+ * @param options the options for the request.
6358
+ *
6359
+ * @dochash actions/os/records
6360
+ * @docgroup 01-packages
6361
+ * @docname os.grantEntitlements
6362
+ */
6363
+ function grantEntitlements(request, options = {}) {
6364
+ const task = context.createTask();
6365
+ const event = calcGrantEntitlements(request, options, task.taskId);
6366
+ return addAsyncAction(task, event);
6367
+ }
6368
+ /**
6369
+ * Parses the given version number into a version key.
6370
+ * @param version The version number to parse.
6371
+ *
6372
+ * @example Parse a version number
6373
+ * const key = os.parseVersionKey('1.0.0');
6374
+ * os.toast(key.major); // 1
6375
+ * os.toast(key.minor); // 0
6376
+ * os.toast(key.patch); // 0
6377
+ * os.toast(key.tag); // null
6378
+ *
6379
+ * @dochash actions/os/records
6380
+ * @docname os.parseVersionKey
6381
+ */
6382
+ function parseVersionKey(version) {
6383
+ const key = parseVersionNumber(version);
6384
+ if (key.major === null) {
6385
+ return null;
6386
+ }
6387
+ return key;
6388
+ }
6389
+ /**
6390
+ * Formats the given version key into a string.
6391
+ *
6392
+ * @example Print the version key
6393
+ * os.toast(os.formatVersionKey({ major: 1, minor: 0, patch: 0, tag: 'alpha' }));
6394
+ *
6395
+ * @param key The key to format.
6396
+ *
6397
+ * @dochash actions/os/records
6398
+ * @docname os.formatVersionKey
6399
+ */
6400
+ function formatVersionKey(key) {
6401
+ return formatVersionNumber(key.major, key.minor, key.patch, key.tag);
6402
+ }
6403
+ /**
6404
+ * Records the given package version. Package versions are useful for storing multiple distinct versions of the same AUX.
6405
+ * Package versions live inside package containers (also known simply as packages) and are distinguished by `key`.
6406
+ *
6407
+ * If the package container does not exist, then it will be automatically created with the `private` marker.
6408
+ * If no markers are specified, then the markers from the package container are used.
6409
+ *
6410
+ * @example Record a v1.0.0 package version
6411
+ * const result = await os.recordPackageVersion({
6412
+ * recordName: 'myRecord',
6413
+ * address: 'myPackage',
6414
+ * key: os.parseVersionKey('1.0.0'),
6415
+ * description: 'description of the package',
6416
+ * bots: getBots('color', 'red'),
6417
+ * });
6418
+ *
6419
+ * @example Record a package version that can request access to the user's data
6420
+ * const result = await os.recordPackageVersion({
6421
+ * recordName: 'myRecord',
6422
+ * address: 'myPackage',
6423
+ * key: os.parseVersionKey('1.0.0'),
6424
+ * description: 'description of the package',
6425
+ * entitlements: [
6426
+ * {
6427
+ * feature: 'data',
6428
+ * scope: 'personal',
6429
+ * }
6430
+ * ],
6431
+ * bots: getBots('color', 'red),
6432
+ * });
6433
+ *
6434
+ * @param request the information about the package version that should be recorded.
6435
+ * @param options the options for the request.
6436
+ *
6437
+ * @dochash actions/os/records
6438
+ * @docgroup 01-packages
6439
+ * @docname os.recordPackageVersion
6440
+ */
6441
+ function recordPackageVersion(request, options = {}) {
6442
+ var _a;
6443
+ const task = context.createTask();
6444
+ const event = calcRecordPackageVersion({
6445
+ recordName: request.recordName,
6446
+ address: request.address,
6447
+ key: request.key,
6448
+ entitlements: (_a = request.entitlements) !== null && _a !== void 0 ? _a : [],
6449
+ description: request.description,
6450
+ markers: request.markers,
6451
+ state: {
6452
+ version: 2,
6453
+ updates: [
6454
+ constructInitializationUpdate(calcCreateInitalizationUpdate(request.bots)),
6455
+ ],
6456
+ },
6457
+ }, options, task.taskId);
6458
+ return addAsyncAction(task, event);
6459
+ }
6460
+ /**
6461
+ * Gets the list of versions for the given package.
6462
+ * @param recordName The name of the record that the package is stored in.
6463
+ * @param address The address of the package.
6464
+ *
6465
+ * @example List all the versions of a package
6466
+ * const result = await os.listPackageVersions('myRecord', 'myPackage');
6467
+ *
6468
+ * @dochash actions/os/records
6469
+ * @docgroup 01-packages
6470
+ * @docname os.listPackageVersions
6471
+ */
6472
+ function listPackageVersions(recordName, address, options = {}) {
6473
+ const task = context.createTask();
6474
+ const event = calcListPackageVersions(recordName, address, options, task.taskId);
6475
+ return addAsyncAction(task, event);
6476
+ }
6477
+ /**
6478
+ * Gets metadata about the given package version.
6479
+ * @param recordName The name of the record that the package version is stored in.
6480
+ * @param address The address of the package version.
6481
+ * @param key The key of the package version.
6482
+ * @param options The options for the package version.
6483
+ *
6484
+ * @example Get info about a package version
6485
+ * const result = await os.getPackageVersion('myRecord', 'myPackage', os.parseVersionKey('1.0.0'));
6486
+ *
6487
+ * @dochash actions/os/records
6488
+ * @docgroup 01-packages
6489
+ * @docname os.getPackageVersion
6490
+ */
6491
+ function getPackageVersion(recordName, address, key, options = {}) {
6492
+ const task = context.createTask();
6493
+ const event = calcGetPackageVersion(recordName, address, key, options, task.taskId);
6494
+ return addAsyncAction(task, event);
6495
+ }
6496
+ /**
6497
+ * Erases the given package version.
6498
+ * @param recordName the name of the record that the package version should be erased from.
6499
+ * @param address the address of the package version that should be erased.
6500
+ * @param key the key of the package version that should be erased.
6501
+ *
6502
+ * @example Erase a package version
6503
+ * const result = await os.erasePackageVersion('myRecord', 'myPackage', os.parseVersionKey('1.0.0'));
6504
+ *
6505
+ * @dochash actions/os/records
6506
+ * @docgroup 01-packages
6507
+ * @docname os.erasePackageVersion
6508
+ */
6509
+ function erasePackageVersion(recordName, address, key, options = {}) {
6510
+ const task = context.createTask();
6511
+ const event = calcErasePackageVersion(recordName, address, key, options, task.taskId);
6512
+ return addAsyncAction(task, event);
6513
+ }
6514
+ /**
6515
+ * Records the given package container.
6516
+ * Package containers (also known simply as packages) are ways to group multiple package versions together.
6517
+ *
6518
+ * Markers that are applied to the package container control whether all the package versions can be deleted and also will be used as the default markers for package versions if the version isn't created with a marker.
6519
+ *
6520
+ * @param recordName The name of the record that the package should be stored in.
6521
+ * @param address The address of the package.
6522
+ * @param markers The markers that should be applied to the package.
6523
+ * @param options The options.
6524
+ *
6525
+ * @dochash actions/os/records
6526
+ * @docgroup 01-packages
6527
+ * @docname os.recordPackageContainer
6528
+ */
6529
+ function recordPackageContainer(recordName, address, markers, options = {}) {
6530
+ const task = context.createTask();
6531
+ const event = calcRecordPackageContainer(recordName, address, typeof markers === 'string'
6532
+ ? [markers]
6533
+ : markers !== null && markers !== void 0 ? markers : [PRIVATE_MARKER], options, task.taskId);
6534
+ return addAsyncAction(task, event);
6535
+ }
6536
+ /**
6537
+ * Erases the given package container and any package versions that it contains.
6538
+ *
6539
+ * @param recordName the name of the record that the package container is in.
6540
+ * @param address the address of the package container.
6541
+ * @param options the options to use for the request.
6542
+ */
6543
+ function erasePackageContainer(recordName, address, options = {}) {
6544
+ const task = context.createTask();
6545
+ const event = calcErasePackageContainer(recordName, address, options, task.taskId);
6546
+ return addAsyncAction(task, event);
6547
+ }
6548
+ /**
6549
+ * Lists all the package containers that are in the given record.
6550
+ * You must have access to the `account` marker in order to list all package containers in a record.
6551
+ *
6552
+ * @param recordName the name of the record that the package containers should be listed from.
6553
+ * @param startingAddress the address that the listing should start after.
6554
+ * @param options the options for the request.
6555
+ *
6556
+ * @example List package containers in a record
6557
+ * const result = await os.listPackageContainers('myRecord');
6558
+ *
6559
+ * @dochash actions/os/records
6560
+ * @docgroup 01-packages
6561
+ * @docname os.listPackageContainers
6562
+ */
6563
+ function listPackageContainers(recordName, startingAddress, options = {}) {
6564
+ const task = context.createTask();
6565
+ const event = calcListPackageContainers(recordName, startingAddress, options, task.taskId);
6566
+ return addAsyncAction(task, event);
6567
+ }
6568
+ /**
6569
+ * Lists the package containers that have the given marker in the given record.
6570
+ * You must have access to the specified marker in order to list the package containers.
6571
+ *
6572
+ * @param recordName the name of the record that the package containers should be listed from.
6573
+ * @param marker the marker that the package containers should have.
6574
+ * @param startingAddress the address that the listing should start after.
6575
+ * @param options the options for the request.
6576
+ *
6577
+ * @example List public package containers in a record
6578
+ * const result = await os.listPackageContainersByMarker('myRecord', 'publicRead');
6579
+ *
6580
+ * @example List private package containers in a record
6581
+ * const result = await os.listPackageContainersByMarker('myRecord', 'private');
6582
+ *
6583
+ * @example List public package containers stored at "myNamespace"
6584
+ * const result = await os.listPackageContainersByMarker('myRecord', 'publicRead:myNamespace');
6585
+ *
6586
+ * @dochash actions/os/records
6587
+ * @docgroup 01-packages
6588
+ * @docname os.listPackageContainersByMarker
6589
+ */
6590
+ function listPackageContainersByMarker(recordName, marker, startingAddress, options = {}) {
6591
+ const task = context.createTask();
6592
+ const event = calcListPackageContainersByMarker(recordName, marker, startingAddress, options, task.taskId);
6593
+ return addAsyncAction(task, event);
6594
+ }
6595
+ /**
6596
+ * Gets the package container in the given record at the given address.
6597
+ *
6598
+ * @param recordName the name of the record that the package container is in.
6599
+ * @param address the address that the package container is stored at.
6600
+ * @param options the options for the request.
6601
+ *
6602
+ * @dochash actions/os/records
6603
+ * @docgroup 01-packages
6604
+ * @docname os.getPackageContainer
6605
+ */
6606
+ function getPackageContainer(recordName, address, options = {}) {
6607
+ const task = context.createTask();
6608
+ const event = calcGetPackageContainer(recordName, address, options, task.taskId);
6609
+ return addAsyncAction(task, event);
6610
+ }
6611
+ /**
6612
+ * Attempts to install the given package into the inst.
6613
+ *
6614
+ * @param recordName the name of the record that the package is in.
6615
+ * @param address the address of the package that should be loaded.
6616
+ * @param key the key that specifies the version of the package that should be loaded. If not specified, then the latest version will be loaded.
6617
+ * @param options the options for the request.
6618
+ *
6619
+ * @dochash actions/os/records
6620
+ * @docgroup 01-packages
6621
+ * @docname os.installPackage
6622
+ */
6623
+ function installPackage(recordName, address, key, options = {}) {
6624
+ const task = context.createTask();
6625
+ const event = calcInstallPackage(recordName, address, key !== null && key !== void 0 ? key : null, options, task.taskId);
6626
+ return addAsyncAction(task, event);
6627
+ }
6628
+ /**
6629
+ * Gets the list of packages that are installed in the inst.
6630
+ * @param options the options for the request.
6631
+ *
6632
+ * @example List all installed packages
6633
+ * const result = await os.listInstalledPackages();
6634
+ *
6635
+ * @dochash actions/os/records
6636
+ * @docgroup 01-packages
6637
+ * @docname os.listInstalledPackages
6638
+ */
6639
+ function listInstalledPackages(options = {}) {
6640
+ const task = context.createTask();
6641
+ const event = calcListInstalledPackages(options, task.taskId);
6642
+ return addAsyncAction(task, event);
6643
+ }
6308
6644
  /**
6309
6645
  * Gets the list of studios that the currently logged in user has access to.
6310
6646
  *
@@ -7158,7 +7494,11 @@ export function createDefaultLibrary(context) {
7158
7494
  * @param options The options to use.
7159
7495
  */
7160
7496
  function webGet(url, options = {}) {
7161
- return webhook(Object.assign(Object.assign({}, options), { method: 'GET', url }));
7497
+ return webhook({
7498
+ ...options,
7499
+ method: 'GET',
7500
+ url,
7501
+ });
7162
7502
  }
7163
7503
  /**
7164
7504
  * Sends a HTTP POST request to the URL with the given data and using the given options.
@@ -7187,8 +7527,12 @@ export function createDefaultLibrary(context) {
7187
7527
  * @param options The options to use.
7188
7528
  */
7189
7529
  function webPost(url, data, options) {
7190
- return webhook(Object.assign(Object.assign({}, options), { method: 'POST', url,
7191
- data }));
7530
+ return webhook({
7531
+ ...options,
7532
+ method: 'POST',
7533
+ url,
7534
+ data,
7535
+ });
7192
7536
  }
7193
7537
  /**
7194
7538
  * Creates a new function that is mockable based on if the context is currently mocking async actions.
@@ -7253,29 +7597,27 @@ export function createDefaultLibrary(context) {
7253
7597
  return _webhook(options);
7254
7598
  }
7255
7599
  }
7256
- function _retryWebhook(options) {
7600
+ async function _retryWebhook(options) {
7257
7601
  var _a, _b, _c, _d;
7258
- return __awaiter(this, void 0, void 0, function* () {
7259
- const retryCount = Math.min(options.retryCount, MAX_RETRY_COUNT);
7260
- const timeToWait = Math.max(0, Math.min((_a = options.retryAfterMs) !== null && _a !== void 0 ? _a : DEFAULT_RETRY_AFTER_MS, MAX_RETRY_AFTER_MS));
7261
- const statusCodes = (_b = options.retryStatusCodes) !== null && _b !== void 0 ? _b : DEFUALT_RETRY_STATUS_CODES;
7262
- let retries = 0;
7263
- while (true) {
7264
- try {
7265
- return yield _webhook(options);
7602
+ const retryCount = Math.min(options.retryCount, MAX_RETRY_COUNT);
7603
+ const timeToWait = Math.max(0, Math.min((_a = options.retryAfterMs) !== null && _a !== void 0 ? _a : DEFAULT_RETRY_AFTER_MS, MAX_RETRY_AFTER_MS));
7604
+ const statusCodes = (_b = options.retryStatusCodes) !== null && _b !== void 0 ? _b : DEFUALT_RETRY_STATUS_CODES;
7605
+ let retries = 0;
7606
+ while (true) {
7607
+ try {
7608
+ return await _webhook(options);
7609
+ }
7610
+ catch (err) {
7611
+ if (retries >= retryCount) {
7612
+ throw err;
7266
7613
  }
7267
- catch (err) {
7268
- if (retries >= retryCount) {
7269
- throw err;
7270
- }
7271
- else if (!statusCodes.includes((_d = (_c = err.response) === null || _c === void 0 ? void 0 : _c.status) !== null && _d !== void 0 ? _d : 0)) {
7272
- throw err;
7273
- }
7274
- yield sleep(timeToWait);
7275
- retries += 1;
7614
+ else if (!statusCodes.includes((_d = (_c = err.response) === null || _c === void 0 ? void 0 : _c.status) !== null && _d !== void 0 ? _d : 0)) {
7615
+ throw err;
7276
7616
  }
7617
+ await sleep(timeToWait);
7618
+ retries += 1;
7277
7619
  }
7278
- });
7620
+ }
7279
7621
  }
7280
7622
  function _webhook(options) {
7281
7623
  const task = context.createTask();
@@ -7515,21 +7857,23 @@ export function createDefaultLibrary(context) {
7515
7857
  return animateMultipleTags(bot, tagOrOptions);
7516
7858
  }
7517
7859
  }
7518
- function animateMultipleTags(bot, options) {
7519
- return __awaiter(this, void 0, void 0, function* () {
7520
- if (typeof options.fromValue !== 'object') {
7521
- throw new Error('You must provide an object as fromValue when not specifying a tag.');
7522
- }
7523
- if (typeof options.toValue !== 'object') {
7524
- throw new Error('You must provide an object as toValue when not specifying a tag.');
7525
- }
7526
- if (typeof options.duration !== 'number') {
7527
- throw new Error('You must provide a duration.');
7528
- }
7529
- const keys = Object.keys(options.fromValue);
7530
- const groupId = uuid();
7531
- yield Promise.all(keys.map((k) => animateSingleTag(bot, k, Object.assign(Object.assign({}, options), { fromValue: options.fromValue[k], toValue: options.toValue[k] }), groupId)));
7532
- });
7860
+ async function animateMultipleTags(bot, options) {
7861
+ if (typeof options.fromValue !== 'object') {
7862
+ throw new Error('You must provide an object as fromValue when not specifying a tag.');
7863
+ }
7864
+ if (typeof options.toValue !== 'object') {
7865
+ throw new Error('You must provide an object as toValue when not specifying a tag.');
7866
+ }
7867
+ if (typeof options.duration !== 'number') {
7868
+ throw new Error('You must provide a duration.');
7869
+ }
7870
+ const keys = Object.keys(options.fromValue);
7871
+ const groupId = uuid();
7872
+ await Promise.all(keys.map((k) => animateSingleTag(bot, k, {
7873
+ ...options,
7874
+ fromValue: options.fromValue[k],
7875
+ toValue: options.toValue[k],
7876
+ }, groupId)));
7533
7877
  }
7534
7878
  function animateSingleTag(bot, tag, options, groupId) {
7535
7879
  if (!options) {
@@ -8496,7 +8840,10 @@ export function createDefaultLibrary(context) {
8496
8840
  const voice = typeof options.voice === 'object'
8497
8841
  ? (_a = options.voice) === null || _a === void 0 ? void 0 : _a.name
8498
8842
  : options.voice;
8499
- const action = calcSpeakText(text, Object.assign(Object.assign({}, options), { voice }), task.taskId);
8843
+ const action = calcSpeakText(text, {
8844
+ ...options,
8845
+ voice,
8846
+ }, task.taskId);
8500
8847
  return addAsyncAction(task, action);
8501
8848
  }
8502
8849
  /**
@@ -11447,14 +11794,12 @@ export function createDefaultLibrary(context) {
11447
11794
  promise[ORIGINAL_OBJECT] = action;
11448
11795
  return promise;
11449
11796
  }
11450
- function addAsyncResultAction(task, action) {
11451
- return __awaiter(this, void 0, void 0, function* () {
11452
- const result = yield addAsyncAction(task, action);
11453
- if (!result.success) {
11454
- throw new CasualOSError(result);
11455
- }
11456
- return result;
11457
- });
11797
+ async function addAsyncResultAction(task, action) {
11798
+ const result = await addAsyncAction(task, action);
11799
+ if (!result.success) {
11800
+ throw new CasualOSError(result);
11801
+ }
11802
+ return result;
11458
11803
  }
11459
11804
  function addAsyncIterableAction(task, action) {
11460
11805
  addAction(action);
@@ -11462,15 +11807,13 @@ export function createDefaultLibrary(context) {
11462
11807
  iterable[ORIGINAL_OBJECT] = action;
11463
11808
  return iterable;
11464
11809
  }
11465
- function addAsyncResultIterableAction(task, action) {
11466
- return __awaiter(this, void 0, void 0, function* () {
11467
- addAsyncIterableAction(task, action);
11468
- const result = yield task.promise;
11469
- if (!result.result.success) {
11470
- throw new CasualOSError(result.result);
11471
- }
11472
- return result.iterable;
11473
- });
11810
+ async function addAsyncResultIterableAction(task, action) {
11811
+ addAsyncIterableAction(task, action);
11812
+ const result = await task.promise;
11813
+ if (!result.result.success) {
11814
+ throw new CasualOSError(result.result);
11815
+ }
11816
+ return result.iterable;
11474
11817
  }
11475
11818
  function getVersion1DownloadState(state) {
11476
11819
  return {