@casual-simulation/aux-runtime 3.3.9 → 3.3.11-alpha.11019730384
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 +6 -6
- package/runtime/AuxLibrary.d.ts +11 -2
- package/runtime/AuxLibrary.js +174 -2
- package/runtime/AuxLibrary.js.map +1 -1
- package/runtime/AuxLibraryDefinitions.def +425 -0
- package/runtime/RecordsEvents.d.ts +86 -2
- package/runtime/RecordsEvents.js +128 -0
- package/runtime/RecordsEvents.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@casual-simulation/aux-runtime",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.11-alpha.11019730384",
|
|
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.3.
|
|
36
|
-
"@casual-simulation/aux-records": "^3.3.
|
|
35
|
+
"@casual-simulation/aux-common": "^3.3.11-alpha.11019730384",
|
|
36
|
+
"@casual-simulation/aux-records": "^3.3.11-alpha.11019730384",
|
|
37
37
|
"@casual-simulation/crypto": "^3.3.8",
|
|
38
38
|
"@casual-simulation/engine262": "0.0.1-4de2170374e22761996e46eb1362f4496ee57f8f",
|
|
39
39
|
"@casual-simulation/error-stack-parser": "^2.0.7",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@tweenjs/tween.js": "18.6.0",
|
|
46
46
|
"@types/estraverse": "5.1.7",
|
|
47
47
|
"@types/seedrandom": "3.0.8",
|
|
48
|
-
"@types/uuid": "
|
|
48
|
+
"@types/uuid": "10.0.0",
|
|
49
49
|
"acorn": "8.11.3",
|
|
50
50
|
"acorn-jsx": "5.3.2",
|
|
51
51
|
"acorn-typescript": "1.4.13",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"rxjs": "8.0.0-alpha.14",
|
|
65
65
|
"seedrandom": "3.0.5",
|
|
66
66
|
"stackframe": "^1.2.0",
|
|
67
|
-
"uuid": "
|
|
67
|
+
"uuid": "10.0.0",
|
|
68
68
|
"yjs": "13.6.8"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
"**/*.d.ts",
|
|
82
82
|
"**/*.def"
|
|
83
83
|
],
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "5dbf06024eac57e36002aef26735fa94420d643d"
|
|
85
85
|
}
|
package/runtime/AuxLibrary.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AuxGlobalContext, DEBUG_STRING } from './AuxGlobalContext';
|
|
2
2
|
import { 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, Geolocation, OpenPhotoCameraOptions, Photo, Point2D, RecordLoomOptions, LoomVideo, LoomVideoEmbedMetadata } from '@casual-simulation/aux-common/bots';
|
|
3
|
-
import { AIChatOptions, AIGenerateSkyboxOptions, AIGenerateImageOptions, JoinRoomActionOptions, RoomOptions, RoomTrackOptions, SetRoomTrackOptions, RoomRemoteOptions, DataRecordOptions, RecordActionOptions, ListDataOptions, AISloydGenerateModelOptions } from './RecordsEvents';
|
|
3
|
+
import { AIChatOptions, AIGenerateSkyboxOptions, AIGenerateImageOptions, JoinRoomActionOptions, RoomOptions, RoomTrackOptions, SetRoomTrackOptions, RoomRemoteOptions, DataRecordOptions, RecordActionOptions, ListDataOptions, AISloydGenerateModelOptions, ListWebhooksOptions } from './RecordsEvents';
|
|
4
4
|
import { RemoteAction, AvailablePermissions } from '@casual-simulation/aux-common';
|
|
5
5
|
import '@casual-simulation/aux-common/polyfill/Array.first.polyfill';
|
|
6
6
|
import '@casual-simulation/aux-common/polyfill/Array.last.polyfill';
|
|
@@ -11,7 +11,7 @@ import { AuxDevice } from './AuxDevice';
|
|
|
11
11
|
import { AuxVersion } from './AuxVersion';
|
|
12
12
|
import { Vector3, Vector2, Quaternion, Rotation } from '@casual-simulation/aux-common/math';
|
|
13
13
|
import { CreatePublicRecordKeyResult, GetDataResult, RecordDataResult, RecordFileFailure, EraseDataResult, EraseFileResult, ListDataResult, AddCountResult, GetCountResult, GrantMarkerPermissionResult, GrantRoleResult, RevokeRoleResult } from '@casual-simulation/aux-records';
|
|
14
|
-
import type { AIChatMessage, GrantResourcePermissionResult, ListStudiosResult, RevokePermissionResult } from '@casual-simulation/aux-records';
|
|
14
|
+
import type { AIChatMessage, GrantResourcePermissionResult, ListStudiosResult, RevokePermissionResult, WebhookRecord } from '@casual-simulation/aux-records';
|
|
15
15
|
import { DateTime } from 'luxon';
|
|
16
16
|
import * as hooks from 'preact/hooks';
|
|
17
17
|
import { render, createRef, createContext } from 'preact';
|
|
@@ -21,6 +21,8 @@ import { INTERPRETABLE_FUNCTION } from './AuxCompiler';
|
|
|
21
21
|
import type { AuxRuntime } from './AuxRuntime';
|
|
22
22
|
import { AIHumeGetAccessTokenResult, AISloydGenerateModelResponse } from '@casual-simulation/aux-records/AIController';
|
|
23
23
|
import { TagMapper } from './RuntimeEvents';
|
|
24
|
+
import type { CrudEraseItemResult, CrudGetItemResult, CrudListItemsResult, CrudRecordItemResult } from '@casual-simulation/aux-records/crud/CrudRecordsController';
|
|
25
|
+
import type { HandleWebhookResult } from '@casual-simulation/aux-records/webhooks/WebhookRecordsController';
|
|
24
26
|
/**
|
|
25
27
|
* Defines an interface for a function that provides HTML VDOM capabilities to bots.
|
|
26
28
|
*/
|
|
@@ -2095,6 +2097,7 @@ export declare function createDefaultLibrary(context: AuxGlobalContext): {
|
|
|
2095
2097
|
[x: symbol]: boolean;
|
|
2096
2098
|
sleep: (time: number) => Promise<void>;
|
|
2097
2099
|
toast: (message: string | number | boolean | object | Array<any> | null, duration?: number) => ShowToastAction;
|
|
2100
|
+
getScriptIssues: (bot: Bot | string, tag: string) => Promise<string[]>;
|
|
2098
2101
|
tip: (message: string | number | boolean | object | Array<any> | null, pixelX?: number, pixelY?: number, duration?: number) => Promise<number>;
|
|
2099
2102
|
hideTips: (tipIds?: number | number[]) => Promise<void>;
|
|
2100
2103
|
showJoinCode: (inst?: string, dimension?: string) => ShowJoinCodeAction;
|
|
@@ -2403,6 +2406,12 @@ export declare function createDefaultLibrary(context: AuxGlobalContext): {
|
|
|
2403
2406
|
listDataByMarker: (recordKeyOrName: string, marker: string, startingAddress?: string, options?: ListDataOptions) => Promise<ListDataResult>;
|
|
2404
2407
|
eraseData: (recordKeyOrName: string, address: string, endpoint?: string) => Promise<EraseDataResult>;
|
|
2405
2408
|
eraseManualApprovalData: (recordKeyOrName: string, address: string, endpoint?: string) => Promise<EraseDataResult>;
|
|
2409
|
+
recordWebhook: (recordName: string, webhook: WebhookRecord, options?: RecordActionOptions) => Promise<CrudRecordItemResult>;
|
|
2410
|
+
runWebhook: (recordName: string, address: string, input: any, options?: RecordActionOptions) => Promise<HandleWebhookResult>;
|
|
2411
|
+
getWebhook: (recordName: string, address: string, options?: RecordActionOptions) => Promise<CrudGetItemResult<WebhookRecord>>;
|
|
2412
|
+
eraseWebhook: (recordName: string, address: string, options?: RecordActionOptions) => Promise<CrudEraseItemResult>;
|
|
2413
|
+
listWebhooks: (recordName: string, startingAddress?: string, options?: ListWebhooksOptions) => Promise<CrudListItemsResult<WebhookRecord>>;
|
|
2414
|
+
listWebhooksByMarker: (recordName: string, marker: string, startingAddress?: string, options?: ListWebhooksOptions) => Promise<CrudListItemsResult<WebhookRecord>>;
|
|
2406
2415
|
recordFile: (recordKeyOrName: string, data: any, options?: RecordFileOptions, endpoint?: string) => Promise<RecordFileApiResult>;
|
|
2407
2416
|
getFile: {
|
|
2408
2417
|
(result: RecordFileApiSuccess, endpoint?: string): Promise<any>;
|
package/runtime/AuxLibrary.js
CHANGED
|
@@ -39,8 +39,8 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
39
39
|
return t;
|
|
40
40
|
};
|
|
41
41
|
import { DEBUG_STRING, debugStringifyFunction, } from './AuxGlobalContext';
|
|
42
|
-
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, 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, } 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, } from './RecordsEvents';
|
|
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, } 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, } from './RecordsEvents';
|
|
44
44
|
import { sortBy, every, cloneDeep, union, isEqual, flatMap, } from 'lodash';
|
|
45
45
|
import { remote as calcRemote, DEFAULT_BRANCH_NAME, } from '@casual-simulation/aux-common';
|
|
46
46
|
import { RanOutOfEnergyError } from './AuxResults';
|
|
@@ -359,6 +359,7 @@ export function createDefaultLibrary(context) {
|
|
|
359
359
|
[UNCOPIABLE]: true,
|
|
360
360
|
sleep,
|
|
361
361
|
toast,
|
|
362
|
+
getScriptIssues,
|
|
362
363
|
tip,
|
|
363
364
|
hideTips,
|
|
364
365
|
showJoinCode,
|
|
@@ -582,6 +583,12 @@ export function createDefaultLibrary(context) {
|
|
|
582
583
|
listDataByMarker,
|
|
583
584
|
eraseData,
|
|
584
585
|
eraseManualApprovalData,
|
|
586
|
+
recordWebhook,
|
|
587
|
+
runWebhook,
|
|
588
|
+
getWebhook,
|
|
589
|
+
eraseWebhook,
|
|
590
|
+
listWebhooks,
|
|
591
|
+
listWebhooksByMarker,
|
|
585
592
|
recordFile,
|
|
586
593
|
getFile,
|
|
587
594
|
getPublicFile,
|
|
@@ -2096,6 +2103,28 @@ export function createDefaultLibrary(context) {
|
|
|
2096
2103
|
function toast(message, duration = 2) {
|
|
2097
2104
|
return addAction(toastMessage(convertToCopiableValue(message), duration));
|
|
2098
2105
|
}
|
|
2106
|
+
/**
|
|
2107
|
+
*Retrieves a list of issues for the script stored under the specified tag.
|
|
2108
|
+
*
|
|
2109
|
+
*The getScriptIssues function takes in a bot instance and a tag of that bot, then analyzes
|
|
2110
|
+
*the script associated with the given tag. It gathers all issues that have been
|
|
2111
|
+
*raised, including syntax errors, semantic inconsistencies, and suggestions for
|
|
2112
|
+
*improvement. This function helps in identifying and addressing potential problems
|
|
2113
|
+
*in the script.
|
|
2114
|
+
*
|
|
2115
|
+
* @param bot the bot to get the script issues for.
|
|
2116
|
+
* @param tag the tag of the bot to get the script issues for.
|
|
2117
|
+
*
|
|
2118
|
+
* @example Get the script issues for a bot.
|
|
2119
|
+
* const issues = await os.getScriptIssues(bot, 'tag');
|
|
2120
|
+
* console.log(issues);
|
|
2121
|
+
*/
|
|
2122
|
+
function getScriptIssues(bot, tag) {
|
|
2123
|
+
const botId = typeof bot === 'string' ? bot : bot.id;
|
|
2124
|
+
const task = context.createTask();
|
|
2125
|
+
const action = scriptIssues(botId, tag, task.taskId);
|
|
2126
|
+
return addAsyncAction(task, action);
|
|
2127
|
+
}
|
|
2099
2128
|
/**
|
|
2100
2129
|
* Shows a temporary "tooltip" message on the screen. Optionally placed at the specified position and shown for the given duration.
|
|
2101
2130
|
* Returns a promise that resolves with the ID of the new tooltip.
|
|
@@ -5416,6 +5445,149 @@ export function createDefaultLibrary(context) {
|
|
|
5416
5445
|
const event = eraseRecordData(recordKeyOrName, address, requiresApproval, options, task.taskId);
|
|
5417
5446
|
return addAsyncAction(task, event);
|
|
5418
5447
|
}
|
|
5448
|
+
/**
|
|
5449
|
+
* Creates or updates a [webhook](glossary:webhook-record) in the given record using the given options.
|
|
5450
|
+
*
|
|
5451
|
+
* Returns a promise that resolves with an object that contains whether the operation succeeded.
|
|
5452
|
+
*
|
|
5453
|
+
* @param recordName the name of the record.
|
|
5454
|
+
* @param webhook the webhook that should be created or updated.
|
|
5455
|
+
* @param options the options that should be used.
|
|
5456
|
+
*
|
|
5457
|
+
* @example Create a publically-runnable webhook that runs from an inst.
|
|
5458
|
+
* await os.recordWebhook('myRecord', {
|
|
5459
|
+
* address: 'webhookAddress',
|
|
5460
|
+
* targetResourceKind: 'inst',
|
|
5461
|
+
* targetRecordName: 'myRecord',
|
|
5462
|
+
* targetAddress: 'myInst',
|
|
5463
|
+
* markers: ['publicRead']
|
|
5464
|
+
* });
|
|
5465
|
+
*
|
|
5466
|
+
* @example Create a private webhook that runs from a data record.
|
|
5467
|
+
* await os.recordWebhook('myRecord', {
|
|
5468
|
+
* address: 'webhookAddress',
|
|
5469
|
+
* targetResourceKind: 'data',
|
|
5470
|
+
* targetRecordName: 'myRecord',
|
|
5471
|
+
* targetAddress: 'myDataAddress',
|
|
5472
|
+
* });
|
|
5473
|
+
*
|
|
5474
|
+
* @example Create a private webhook that runs from a file record.
|
|
5475
|
+
* await os.recordWebhook('myRecord', {
|
|
5476
|
+
* address: 'webhookAddress',
|
|
5477
|
+
* targetResourceKind: 'file',
|
|
5478
|
+
* targetRecordName: 'myRecord',
|
|
5479
|
+
* targetAddress: 'myFileName',
|
|
5480
|
+
* });
|
|
5481
|
+
*
|
|
5482
|
+
* @dochash actions/os/records
|
|
5483
|
+
* @docgroup 05-records
|
|
5484
|
+
* @docname os.recordWebhook
|
|
5485
|
+
*/
|
|
5486
|
+
function recordWebhook(recordName, webhook, options) {
|
|
5487
|
+
const task = context.createTask();
|
|
5488
|
+
const event = calcRecordWebhook(recordName, webhook, options !== null && options !== void 0 ? options : {}, task.taskId);
|
|
5489
|
+
const final = addAsyncResultAction(task, event);
|
|
5490
|
+
final[ORIGINAL_OBJECT] = event;
|
|
5491
|
+
return final;
|
|
5492
|
+
}
|
|
5493
|
+
/**
|
|
5494
|
+
* Runs the webhook in the given record with the provided input.
|
|
5495
|
+
* @param recordName the name of the record.
|
|
5496
|
+
* @param address the address of the webhook.
|
|
5497
|
+
* @param input the input to provide to the webhook.
|
|
5498
|
+
* @param options the options to use.
|
|
5499
|
+
*
|
|
5500
|
+
* @example Run a webhook with some input.
|
|
5501
|
+
* const result = await os.runWebhook('myRecord', 'myWebhookAddress', { myInput: 'myValue' });
|
|
5502
|
+
*
|
|
5503
|
+
* @dochash actions/os/records
|
|
5504
|
+
* @docgroup 05-records
|
|
5505
|
+
* @docname os.runWebhook
|
|
5506
|
+
*/
|
|
5507
|
+
function runWebhook(recordName, address, input, options) {
|
|
5508
|
+
const task = context.createTask();
|
|
5509
|
+
const event = calcRunWebhook(recordName, address, input, options !== null && options !== void 0 ? options : {}, task.taskId);
|
|
5510
|
+
const final = addAsyncResultAction(task, event);
|
|
5511
|
+
final[ORIGINAL_OBJECT] = event;
|
|
5512
|
+
return final;
|
|
5513
|
+
}
|
|
5514
|
+
/**
|
|
5515
|
+
* Gets the [webhook](glossary:webhook-record) from the given record.
|
|
5516
|
+
*
|
|
5517
|
+
* Returns a promise that resolves with the webhook data.
|
|
5518
|
+
*
|
|
5519
|
+
* @param recordName the name of the record.
|
|
5520
|
+
* @param address the address of the webhook.
|
|
5521
|
+
* @param options the options to use.
|
|
5522
|
+
*
|
|
5523
|
+
* @dochash actions/os/records
|
|
5524
|
+
* @docgroup 05-records
|
|
5525
|
+
* @docname os.getWebhook
|
|
5526
|
+
*/
|
|
5527
|
+
function getWebhook(recordName, address, options) {
|
|
5528
|
+
const task = context.createTask();
|
|
5529
|
+
const event = calcGetWebhook(recordName, address, options !== null && options !== void 0 ? options : {}, task.taskId);
|
|
5530
|
+
const final = addAsyncResultAction(task, event);
|
|
5531
|
+
final[ORIGINAL_OBJECT] = event;
|
|
5532
|
+
return final;
|
|
5533
|
+
}
|
|
5534
|
+
/**
|
|
5535
|
+
* Deletes the [webhook](glossary:webhook-record) from the given record.
|
|
5536
|
+
* @param recordName the name of the record.
|
|
5537
|
+
* @param address the address of the webhook.
|
|
5538
|
+
* @param options the options to use.
|
|
5539
|
+
*
|
|
5540
|
+
* @dochash actions/os/records
|
|
5541
|
+
* @docgroup 05-records
|
|
5542
|
+
* @docname os.eraseWebhook
|
|
5543
|
+
*/
|
|
5544
|
+
function eraseWebhook(recordName, address, options) {
|
|
5545
|
+
const task = context.createTask();
|
|
5546
|
+
const event = calcEraseWebhook(recordName, address, options !== null && options !== void 0 ? options : {}, task.taskId);
|
|
5547
|
+
const final = addAsyncResultAction(task, event);
|
|
5548
|
+
final[ORIGINAL_OBJECT] = event;
|
|
5549
|
+
return final;
|
|
5550
|
+
}
|
|
5551
|
+
/**
|
|
5552
|
+
* Lists the webhooks that are in the given record.
|
|
5553
|
+
* @param recordName the name of the record.
|
|
5554
|
+
* @param startingAddress the address after which items will be included in the list.
|
|
5555
|
+
* Since items are ordered within the record by address, this can be used as way to iterate through all the webhooks items in a record.
|
|
5556
|
+
* If omitted, then the list will start with the first item.
|
|
5557
|
+
* @param options the options to use.
|
|
5558
|
+
*
|
|
5559
|
+
* @dochash actions/os/records
|
|
5560
|
+
* @docgroup 05-records
|
|
5561
|
+
* @docname os.listWebhooks
|
|
5562
|
+
*/
|
|
5563
|
+
function listWebhooks(recordName, startingAddress = null, options) {
|
|
5564
|
+
const task = context.createTask();
|
|
5565
|
+
const event = calcListWebhooks(recordName, startingAddress, options !== null && options !== void 0 ? options : {}, task.taskId);
|
|
5566
|
+
const final = addAsyncResultAction(task, event);
|
|
5567
|
+
final[ORIGINAL_OBJECT] = event;
|
|
5568
|
+
return final;
|
|
5569
|
+
}
|
|
5570
|
+
/**
|
|
5571
|
+
* Lists the webhooks that are in the given record.
|
|
5572
|
+
* @param recordName the name of the record.
|
|
5573
|
+
* @param marker The marker that needs to be assigned to the data items that should be included in the list.
|
|
5574
|
+
* e.g. Using "publicRead" will return all data items with the "publicRead" marker.
|
|
5575
|
+
* @param startingAddress the address after which items will be included in the list.
|
|
5576
|
+
* Since items are ordered within the record by address, this can be used as way to iterate through all the webhooks items in a record.
|
|
5577
|
+
* If omitted, then the list will start with the first item.
|
|
5578
|
+
* @param options the options to use.
|
|
5579
|
+
*
|
|
5580
|
+
* @dochash actions/os/records
|
|
5581
|
+
* @docgroup 05-records
|
|
5582
|
+
* @docname os.listWebhooksByMarker
|
|
5583
|
+
*/
|
|
5584
|
+
function listWebhooksByMarker(recordName, marker, startingAddress = null, options) {
|
|
5585
|
+
const task = context.createTask();
|
|
5586
|
+
const event = calcListWebhooksByMarker(recordName, marker, startingAddress, options !== null && options !== void 0 ? options : {}, task.taskId);
|
|
5587
|
+
const final = addAsyncResultAction(task, event);
|
|
5588
|
+
final[ORIGINAL_OBJECT] = event;
|
|
5589
|
+
return final;
|
|
5590
|
+
}
|
|
5419
5591
|
/**
|
|
5420
5592
|
* Stores the given [file data](glossary:file-record) in the given record using the given options for the file. The file can later be retrieved by using os.getFile(urlOrRecordFileResult).
|
|
5421
5593
|
*
|