@casual-simulation/aux-common 3.0.3 → 3.0.5-alpha.2105062406

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.
@@ -126,7 +126,7 @@ export class AuxCompiler {
126
126
  */
127
127
  calculateOriginalLineLocation(func, location) {
128
128
  // Line numbers should be one based
129
- if (location.lineNumber < func.metadata.scriptLineOffset) {
129
+ if (location.lineNumber < (func.metadata.scriptLineOffset + func.metadata.transpilerLineOffset)) {
130
130
  return {
131
131
  lineNumber: 0,
132
132
  column: 0,
@@ -136,7 +136,11 @@ export class AuxCompiler {
136
136
  lineNumber: location.lineNumber - func.metadata.scriptLineOffset - 1,
137
137
  column: location.column - 1,
138
138
  };
139
- return calculateOriginalLineLocation(func.metadata.transpilerResult, transpiledLocation);
139
+ let result = calculateOriginalLineLocation(func.metadata.transpilerResult, transpiledLocation);
140
+ return {
141
+ lineNumber: result.lineNumber - func.metadata.transpilerLineOffset,
142
+ column: result.column
143
+ };
140
144
  }
141
145
  /**
142
146
  * Compiles the given script into a function.
@@ -144,11 +148,12 @@ export class AuxCompiler {
144
148
  * @param options The options that should be used to compile the script.
145
149
  */
146
150
  compile(script, options) {
147
- let { func, scriptLineOffset, async, transpilerResult, } = this._compileFunction(script, options || {});
151
+ let { func, scriptLineOffset, transpilerLineOffset, async, transpilerResult, } = this._compileFunction(script, options || {});
148
152
  const scriptFunction = func;
149
153
  const meta = {
150
154
  scriptFunction,
151
155
  scriptLineOffset,
156
+ transpilerLineOffset,
152
157
  transpilerResult,
153
158
  fileName: options === null || options === void 0 ? void 0 : options.fileName,
154
159
  diagnosticFunctionName: options === null || options === void 0 ? void 0 : options.diagnosticFunctionName,
@@ -259,8 +264,8 @@ export class AuxCompiler {
259
264
  async = true;
260
265
  }
261
266
  script = this._parseScript(script);
267
+ let transpilerLineOffset = 0;
262
268
  let scriptLineOffset = 0;
263
- let constantsLineOffset = 0;
264
269
  let customGlobalThis = false;
265
270
  let constantsCode = '';
266
271
  if (options.constants) {
@@ -269,7 +274,7 @@ export class AuxCompiler {
269
274
  .map((v) => `const ${v} = constants["${v}"];`);
270
275
  customGlobalThis = 'globalThis' in options.constants;
271
276
  constantsCode = lines.join('\n') + '\n';
272
- constantsLineOffset += 1 + Math.max(lines.length - 1, 0);
277
+ scriptLineOffset += 1 + Math.max(lines.length - 1, 0);
273
278
  }
274
279
  let variablesCode = '';
275
280
  if (options.variables) {
@@ -277,7 +282,7 @@ export class AuxCompiler {
277
282
  .filter((v) => v !== 'this')
278
283
  .map((v) => `const ${v} = variables["${v}"](context);`);
279
284
  variablesCode = '\n' + lines.join('\n');
280
- scriptLineOffset += 1 + Math.max(lines.length - 1, 0);
285
+ transpilerLineOffset += 1 + Math.max(lines.length - 1, 0);
281
286
  }
282
287
  let argumentsCode = '';
283
288
  if (options.arguments) {
@@ -287,11 +292,11 @@ export class AuxCompiler {
287
292
  ? [v, i]
288
293
  : [[v], i]), ([v, i]) => v.map((name) => `const ${name} = args[${i}];`));
289
294
  argumentsCode = '\n' + lines.join('\n');
290
- scriptLineOffset += 1 + Math.max(lines.length - 1, 0);
295
+ transpilerLineOffset += 1 + Math.max(lines.length - 1, 0);
291
296
  }
292
297
  let scriptCode;
293
298
  scriptCode = `\n { \n${script}\n }`;
294
- scriptLineOffset += 2;
299
+ transpilerLineOffset += 2;
295
300
  let withCodeStart = '';
296
301
  let withCodeEnd = '';
297
302
  if (customGlobalThis) {
@@ -311,7 +316,6 @@ export class AuxCompiler {
311
316
  }
312
317
  this._transpiler.forceSync = (_b = options.forceSync) !== null && _b !== void 0 ? _b : false;
313
318
  const transpiled = this._transpiler.transpileWithMetadata(functionCode);
314
- scriptLineOffset += constantsLineOffset;
315
319
  const finalCode = `${withCodeStart}return function(constants, variables, context) { ${constantsCode}return ${transpiled.code}; }${withCodeEnd}`;
316
320
  let func = this._buildFunction(finalCode, options);
317
321
  func[COMPILED_SCRIPT_SYMBOL] = true;
@@ -327,7 +331,8 @@ export class AuxCompiler {
327
331
  }
328
332
  return {
329
333
  func,
330
- scriptLineOffset,
334
+ scriptLineOffset: scriptLineOffset,
335
+ transpilerLineOffset: transpilerLineOffset,
331
336
  async,
332
337
  transpilerResult: transpiled,
333
338
  };
@@ -335,7 +340,7 @@ export class AuxCompiler {
335
340
  catch (err) {
336
341
  if (err instanceof SyntaxError) {
337
342
  const replaced = replaceSyntaxErrorLineNumber(err, (location) => ({
338
- lineNumber: location.lineNumber - scriptLineOffset,
343
+ lineNumber: location.lineNumber - transpilerLineOffset,
339
344
  column: location.column,
340
345
  }));
341
346
  if (replaced) {
@@ -1 +1 @@
1
- {"version":3,"file":"AuxCompiler.js","sourceRoot":"","sources":["AuxCompiler.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,6BAA6B,EAE7B,UAAU,GAEb,MAAM,cAAc,CAAC;AACtB,OAAO,EAAa,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACjC,OAAO,gBAAgB,MAAM,uCAAuC,CAAC;AACrE,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAC;AAEhE,MAAM,WAAW,GAAG,QAAQ,CAAC;AAC7B,MAAM,oBAAoB,GAAG,QAAQ,CAAC;AAEtC;;;GAGG;AACH,MAAM,OAAO,WAAW;IAAxB;QACY,gBAAW,GAAG,IAAI,UAAU,CAAC;YACjC,UAAU,EAAE,WAAW;YACvB,WAAW,EAAE,oBAAoB;SACpC,CAAC,CAAC;QACK,mBAAc,GAAG,IAAI,GAAG,EAAoB,CAAC;QAErD;;;;;;WAMG;QACH,4BAAuB,GAAW,CAAC,CAAC;IAsbxC,CAAC;IApbG;;;;;;OAMG;IACH,2BAA2B,CACvB,eAA+C,EAC/C,KAAY;;QAEZ,MAAM,MAAM,GAAG,gBAAgB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AQ,CAAC;QACzD,IAAI,CAAC,QAAQ,EAAE;YACX,QAAQ,GAAG,QAAQ,CAAC,aAAa,EAAE,SAAS,CAAQ,CAAC;YAErD,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;SAChD;QACD,OAAO,QAAQ,CAAC;IACpB,CAAC;CACJ;AAED,MAAM,8BAA8B,GAAG,kBAAkB,CAAC;AAE1D;;;;;;GAMG;AACH,MAAM,UAAU,4BAA4B,CACxC,KAAkB,EAClB,SAAmD;IAEnD,MAAM,OAAO,GAAG,8BAA8B,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAEnE,IAAI,OAAO,EAAE;QACT,MAAM,CAAC,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC;QAEpC,MAAM,UAAU,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;QAClC,MAAM,YAAY,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;QAEtC,MAAM,QAAQ,GAAG,SAAS,CAAC;YACvB,UAAU;YACV,MAAM,EAAE,YAAY;SACvB,CAAC,CAAC;QAEH,OAAO,IAAI,WAAW,CAClB,KAAK,CAAC,OAAO,CAAC,OAAO,CACjB,GAAG,EACH,IAAI,QAAQ,CAAC,UAAU,IAAI,QAAQ,CAAC,MAAM,GAAG,CAChD,CACJ,CAAC;KACL;SAAM;QACH,OAAO,IAAI,CAAC;KACf;AACL,CAAC;AAiJD,mDAAmD;AACnD,UAAU;AACV,0BAA0B;AAC1B,UAAU;AACV,oBAAoB;AAEpB,kCAAkC;AAClC,gCAAgC;AAChC,8BAA8B;AAC9B,QAAQ;AACR,IAAI"}
@@ -1,5 +1,5 @@
1
1
  import { AuxGlobalContext, DEBUG_STRING } from './AuxGlobalContext';
2
- import { BotTags, Bot, ShowChatOptions, BotAction, BotsState, CameraType, BarcodeFormat, PortalType, ShowInputOptions, StartCheckoutOptions, LocalFormAnimationAction, ShareOptions, Easing, BotAnchorPoint, RuntimeBot, BotSpace, EaseType, RegisterPrefixOptions, OpenCircleWipeOptions, SuperShoutAction, ShowToastAction, ShowJoinCodeAction, RequestFullscreenAction, ExitFullscreenAction, ShowHtmlAction, HideHtmlAction, SetClipboardAction, FocusOnBotAction, ShowChatBarAction, EnableARAction, EnableVRAction, DownloadAction, ShowUploadAuxFileAction, OpenQRCodeScannerAction, ShowQRCodeAction, OpenBarcodeScannerAction, ShowBarcodeAction, LoadServerAction, UnloadServerAction, ImportAUXAction, ReplaceDragBotAction, ShowInputForTagAction, GoToDimensionAction, GoToURLAction, OpenURLAction, OpenConsoleAction, StartCheckoutAction, FinishCheckoutAction, ApplyStateAction, RejectAction, FocusOnOptions, SnapTarget, AddDropSnapTargetsAction, RecordingOptions, Recording, SyntheticVoice, EnablePOVAction, EnableCustomDraggingAction, SetAppOutputAction, Record, RecordReference, PartialBotsState, ParsedBotLink, ConvertGeolocationToWhat3WordsOptions, BeginAudioRecordingAction, MeetCommandAction, MediaPermssionOptions, ImageClassifierOptions } from '../bots';
2
+ import { BotTags, Bot, ShowChatOptions, BotAction, BotsState, CameraType, BarcodeFormat, PortalType, ShowInputOptions, StartCheckoutOptions, LocalFormAnimationAction, ShareOptions, Easing, BotAnchorPoint, RuntimeBot, BotSpace, EaseType, RegisterPrefixOptions, OpenCircleWipeOptions, SuperShoutAction, ShowToastAction, ShowJoinCodeAction, RequestFullscreenAction, ExitFullscreenAction, ShowHtmlAction, HideHtmlAction, SetClipboardAction, FocusOnBotAction, ShowChatBarAction, EnableARAction, EnableVRAction, DownloadAction, ShowUploadAuxFileAction, OpenQRCodeScannerAction, ShowQRCodeAction, OpenBarcodeScannerAction, ShowBarcodeAction, LoadServerAction, UnloadServerAction, ImportAUXAction, ReplaceDragBotAction, ShowInputForTagAction, GoToDimensionAction, GoToURLAction, OpenURLAction, OpenConsoleAction, StartCheckoutAction, FinishCheckoutAction, ApplyStateAction, RejectAction, FocusOnOptions, SnapTarget, AddDropSnapTargetsAction, RecordingOptions, Recording, SyntheticVoice, EnablePOVAction, EnableCustomDraggingAction, SetAppOutputAction, Record, RecordReference, PartialBotsState, ParsedBotLink, ConvertGeolocationToWhat3WordsOptions, BeginAudioRecordingAction, MeetCommandAction, MediaPermssionOptions, ImageClassifierOptions, AddDropGridTargetsAction } from '../bots';
3
3
  import { RemoteAction } from '@casual-simulation/causal-trees';
4
4
  import '../polyfill/Array.first.polyfill';
5
5
  import '../polyfill/Array.last.polyfill';
@@ -385,6 +385,52 @@ export interface RecordFileApiFailure {
385
385
  errorCode: RecordFileFailure['errorCode'] | 'file_already_exists' | 'invalid_file_data';
386
386
  errorMessage: string;
387
387
  }
388
+ export interface SnapGridTarget {
389
+ /**
390
+ * The 3D position that the grid should appear at.
391
+ */
392
+ position?: {
393
+ x: number;
394
+ y: number;
395
+ z: number;
396
+ };
397
+ /**
398
+ * The 3D rotation that the grid should appear at.
399
+ */
400
+ rotation?: {
401
+ x: number;
402
+ y: number;
403
+ z: number;
404
+ w?: number;
405
+ };
406
+ /**
407
+ * The bot that defines the portal that the grid should exist in.
408
+ * If null, then this defaults to the configBot.
409
+ */
410
+ portalBot?: Bot | string;
411
+ /**
412
+ * The tag that the portal uses to determine which dimension to show. Defaults to formAddress.
413
+ */
414
+ portalTag?: string;
415
+ /**
416
+ * The bounds of the grid.
417
+ * Defaults to 10 x 10.
418
+ */
419
+ bounds?: {
420
+ x: number;
421
+ y: number;
422
+ };
423
+ /**
424
+ * The priority that this grid should be evaluated in over other grids.
425
+ * Higher priorities will be evaluated before lower priorities.
426
+ */
427
+ priority?: number;
428
+ /**
429
+ * Whether to visualize the grid while a bot is being dragged.
430
+ * Defaults to false.
431
+ */
432
+ showGrid?: boolean;
433
+ }
388
434
  /**
389
435
  * Defines an interface that represents the set of additional options that can be provided when recording a file.
390
436
  */
@@ -494,6 +540,7 @@ export declare function createDefaultLibrary(context: AuxGlobalContext): {
494
540
  focusOn: (botOrPosition: Bot | string | {
495
541
  x: number;
496
542
  y: number;
543
+ z?: number;
497
544
  }, options?: FocusOnOptions) => Promise<void>;
498
545
  showChat: (placeholderOrOptions?: string | ShowChatOptions) => ShowChatBarAction;
499
546
  hideChat: () => ShowChatBarAction;
@@ -589,6 +636,8 @@ export declare function createDefaultLibrary(context: AuxGlobalContext): {
589
636
  openCircleWipe: (options?: Partial<OpenCircleWipeOptions>) => Promise<void>;
590
637
  addDropSnap: (...targets: SnapTarget[]) => AddDropSnapTargetsAction;
591
638
  addBotDropSnap: (bot: RuntimeBot | string, ...targets: SnapTarget[]) => AddDropSnapTargetsAction;
639
+ addDropGrid: (...targets: SnapGridTarget[]) => AddDropGridTargetsAction;
640
+ addBotDropGrid: (bot: Bot | string, ...targets: SnapGridTarget[]) => AddDropGridTargetsAction;
592
641
  enableCustomDragging: () => EnableCustomDraggingAction;
593
642
  log: (...args: any[]) => void;
594
643
  getGeolocation: () => Promise<Geolocation>;
@@ -632,24 +681,24 @@ export declare function createDefaultLibrary(context: AuxGlobalContext): {
632
681
  requestAuthBot: () => Promise<Bot>;
633
682
  getPublicRecordKey: (name: string) => Promise<CreatePublicRecordKeyResult>;
634
683
  isRecordKey: (key: unknown) => boolean;
635
- recordData: (recordKey: string, address: string, data: any) => Promise<RecordDataResult>;
636
- recordManualApprovalData: (recordKey: string, address: string, data: any) => Promise<RecordDataResult>;
637
- getData: (recordKeyOrName: string, address: string) => Promise<GetDataResult>;
638
- getManualApprovalData: (recordKeyOrName: string, address: string) => Promise<GetDataResult>;
639
- listData: (recordKeyOrName: string, startingAddress?: string) => Promise<ListDataResult>;
640
- eraseData: (recordKey: string, address: string) => Promise<EraseDataResult>;
641
- eraseManualApprovalData: (recordKey: string, address: string) => Promise<EraseDataResult>;
642
- recordFile: (recordKey: string, data: any, options?: RecordFileOptions) => Promise<RecordFileApiResult>;
684
+ recordData: (recordKey: string, address: string, data: any, endpoint?: string) => Promise<RecordDataResult>;
685
+ recordManualApprovalData: (recordKey: string, address: string, data: any, endpoint?: string) => Promise<RecordDataResult>;
686
+ getData: (recordKeyOrName: string, address: string, endpoint?: string) => Promise<GetDataResult>;
687
+ getManualApprovalData: (recordKeyOrName: string, address: string, endpoint?: string) => Promise<GetDataResult>;
688
+ listData: (recordKeyOrName: string, startingAddress?: string, endpoint?: string) => Promise<ListDataResult>;
689
+ eraseData: (recordKey: string, address: string, endpoint?: string) => Promise<EraseDataResult>;
690
+ eraseManualApprovalData: (recordKey: string, address: string, endpoint?: string) => Promise<EraseDataResult>;
691
+ recordFile: (recordKey: string, data: any, options?: RecordFileOptions, endpoint?: string) => Promise<RecordFileApiResult>;
643
692
  getFile: {
644
693
  (result: RecordFileApiSuccess): Promise<any>;
645
694
  (url: string): Promise<any>;
646
695
  };
647
696
  eraseFile: {
648
- (recordKey: string, result: RecordFileApiSuccess): Promise<EraseFileResult>;
649
- (recordKey: string, url: string): Promise<EraseFileResult>;
697
+ (recordKey: string, result: RecordFileApiSuccess, endpoint?: string): Promise<EraseFileResult>;
698
+ (recordKey: string, url: string, endpoint?: string): Promise<EraseFileResult>;
650
699
  };
651
- recordEvent: (recordKey: string, eventName: string) => Promise<AddCountResult>;
652
- countEvents: (recordNameOrKey: string, eventName: string) => Promise<GetCountResult>;
700
+ recordEvent: (recordKey: string, eventName: string, endpoint?: string) => Promise<AddCountResult>;
701
+ countEvents: (recordNameOrKey: string, eventName: string, endpoint?: string) => Promise<GetCountResult>;
653
702
  convertGeolocationToWhat3Words: (location: ConvertGeolocationToWhat3WordsOptions) => Promise<string>;
654
703
  setupInst: (inst: string, botOrMod?: Mod) => Promise<any>;
655
704
  remotes: () => Promise<string[]>;
@@ -11,7 +11,7 @@ import { DEBUG_STRING, debugStringifyFunction, } from './AuxGlobalContext';
11
11
  import { hasValue, trimTag, isBot, BOT_SPACE_TAG, toast as toastMessage, showJoinCode as calcShowJoinCode, requestFullscreen, exitFullscreen, html as htmlMessage, hideHtml as hideHtmlMessage, setClipboard as calcSetClipboard, tweenTo as calcTweenTo, showChat as calcShowChat, hideChat as calcHideChat, runScript, getMediaPermission as calcGetMediaPermission, getAverageFrameRate as calcGetAverageFrameRate, enableAR as calcEnableAR, disableAR as calcDisableAR, enableVR as calcEnableVR, disableVR as calcDisableVR, arSupported as calcARSupported, vrSupported as calcVRSupported, showUploadAuxFile as calcShowUploadAuxFile, openQRCodeScanner as calcOpenQRCodeScanner, showQRCode as calcShowQRCode, openBarcodeScanner as calcOpenBarcodeScanner, showBarcode as calcShowBarcode, importAUX as calcImportAUX, showInputForTag as calcShowInputForTag, showInput as calcShowInput, replaceDragBot as calcReplaceDragBot, goToDimension as calcGoToDimension, goToURL as calcGoToURL, openURL as calcOpenURL, checkout as calcCheckout, playSound as calcPlaySound, bufferSound as calcBufferSound, cancelSound as calcCancelSound, setupServer as calcSetupServer, shell as calcShell, backupToGithub as calcBackupToGithub, backupAsDownload as calcBackupAsDownload, finishCheckout as calcFinishCheckout, markHistory as calcMarkHistory, browseHistory as calcBrowseHistory, restoreHistoryMark as calcRestoreHistoryMark, loadFile as calcLoadFile, saveFile as calcSaveFile, reject as calcReject, localFormAnimation as calcLocalFormAnimation, webhook as calcWebhook, superShout as calcSuperShout, share as calcShare, registerPrefix as calcRegisterPrefix, createCertificate as calcCreateCertificate, signTag as calcSignTag, revokeCertificate as calcRevokeCertificate, localPositionTween as calcLocalPositionTween, localRotationTween as calcLocalRotationTween, showUploadFiles as calcShowUploadFiles, download, loadSimulation, unloadSimulation, getUploadState, addState, getPortalTag, KNOWN_PORTALS, openConsole, tagsOnBot, getOriginalObject, getBotSpace, trimEvent, CREATE_ACTION_NAME, CREATE_ANY_ACTION_NAME, DESTROY_ACTION_NAME, ORIGINAL_OBJECT, unlockSpace, getRemoteCount, getServers, getRemotes, action, getServerStatuses, setSpacePassword, rpioInitPin, rpioExitPin, rpioOpenPin, rpioModePin, rpioReadPin, rpioReadSequencePin, rpioWritePin, rpioWriteSequencePin, rpioReadpadPin, rpioWritepadPin, rpioPudPin, rpioPollPin, rpioClosePin, rpioI2CBeginPin, rpioI2CSetSlaveAddressPin, rpioI2CSetBaudRatePin, rpioI2CSetClockDividerPin, rpioI2CReadPin, rpioI2CWritePin,
12
12
  // rpioI2CReadRegisterRestartPin,
13
13
  // rpioI2CWriteReadRestartPin,
14
- rpioI2CEndPin, rpioPWMSetClockDividerPin, rpioPWMSetRangePin, rpioPWMSetDataPin, rpioSPIBeginPin, rpioSPIChipSelectPin, rpioSPISetCSPolarityPin, rpioSPISetClockDividerPin, rpioSPISetDataModePin, rpioSPITransferPin, rpioSPIWritePin, rpioSPIEndPin, serialConnectPin, serialOpenPin, serialStreamPin, serialUpdatePin, serialWritePin, serialReadPin, serialClosePin, serialFlushPin, serialDrainPin, serialPausePin, serialResumePin, calculateAnchorPoint, calculateAnchorPointOffset, getBotPosition as calcGetBotPosition, isRuntimeBot, SET_TAG_MASK_SYMBOL, CLEAR_TAG_MASKS_SYMBOL, getBotScale, EDIT_TAG_SYMBOL, EDIT_TAG_MASK_SYMBOL, circleWipe, addDropSnap as calcAddDropSnap, animateToPosition, beginAudioRecording as calcBeginAudioRecording, endAudioRecording as calcEndAudioRecording, beginRecording as calcBeginRecording, endRecording as calcEndRecording, speakText as calcSpeakText, getVoices as calcGetVoices, getGeolocation as calcGetGeolocation, cancelAnimation, disablePOV, enablePOV, enableCustomDragging as calcEnableCustomDragging, MINI_PORTAL, registerCustomApp, setAppOutput, unregisterCustomApp, requestAuthData as calcRequestAuthData, createBot, defineGlobalBot as calcDefineGlobalBot, TEMPORARY_BOT_PARTITION_ID, convertToString, GET_TAG_MASKS_SYMBOL, isBotLink, parseBotLink, createBotLink, convertGeolocationToWhat3Words as calcConvertGeolocationToWhat3Words, getPublicRecordKey as calcGetPublicRecordKey, recordData as calcRecordData, getRecordData, eraseRecordData, recordFile as calcRecordFile, eraseFile as calcEraseFile, meetCommand as calcMeetCommand, listDataRecord, recordEvent as calcRecordEvent, getEventCount as calcGetEventCount, openImageClassifier as calcOpenImageClassifier, isBotDate, DATE_TAG_PREFIX, parseBotDate, } from '../bots';
14
+ rpioI2CEndPin, rpioPWMSetClockDividerPin, rpioPWMSetRangePin, rpioPWMSetDataPin, rpioSPIBeginPin, rpioSPIChipSelectPin, rpioSPISetCSPolarityPin, rpioSPISetClockDividerPin, rpioSPISetDataModePin, rpioSPITransferPin, rpioSPIWritePin, rpioSPIEndPin, serialConnectPin, serialOpenPin, serialStreamPin, serialUpdatePin, serialWritePin, serialReadPin, serialClosePin, serialFlushPin, serialDrainPin, serialPausePin, serialResumePin, calculateAnchorPoint, calculateAnchorPointOffset, getBotPosition as calcGetBotPosition, isRuntimeBot, SET_TAG_MASK_SYMBOL, CLEAR_TAG_MASKS_SYMBOL, getBotScale, EDIT_TAG_SYMBOL, EDIT_TAG_MASK_SYMBOL, circleWipe, addDropSnap as calcAddDropSnap, addDropGrid as calcAddDropGrid, animateToPosition, beginAudioRecording as calcBeginAudioRecording, endAudioRecording as calcEndAudioRecording, beginRecording as calcBeginRecording, endRecording as calcEndRecording, speakText as calcSpeakText, getVoices as calcGetVoices, getGeolocation as calcGetGeolocation, cancelAnimation, disablePOV, enablePOV, enableCustomDragging as calcEnableCustomDragging, MINI_PORTAL, registerCustomApp, setAppOutput, unregisterCustomApp, requestAuthData as calcRequestAuthData, createBot, defineGlobalBot as calcDefineGlobalBot, TEMPORARY_BOT_PARTITION_ID, convertToString, GET_TAG_MASKS_SYMBOL, isBotLink, parseBotLink, createBotLink, convertGeolocationToWhat3Words as calcConvertGeolocationToWhat3Words, getPublicRecordKey as calcGetPublicRecordKey, recordData as calcRecordData, getRecordData, eraseRecordData, recordFile as calcRecordFile, eraseFile as calcEraseFile, meetCommand as calcMeetCommand, listDataRecord, recordEvent as calcRecordEvent, getEventCount as calcGetEventCount, openImageClassifier as calcOpenImageClassifier, isBotDate, DATE_TAG_PREFIX, parseBotDate, } from '../bots';
15
15
  import { sortBy, every, cloneDeep, union, isEqual, flatMap } from 'lodash';
16
16
  import { remote as calcRemote, } from '@casual-simulation/causal-trees';
17
17
  import { RanOutOfEnergyError } from './AuxResults';
@@ -322,6 +322,8 @@ export function createDefaultLibrary(context) {
322
322
  openCircleWipe,
323
323
  addDropSnap,
324
324
  addBotDropSnap,
325
+ addDropGrid,
326
+ addBotDropGrid,
325
327
  enableCustomDragging,
326
328
  log,
327
329
  getGeolocation,
@@ -1968,6 +1970,32 @@ export function createDefaultLibrary(context) {
1968
1970
  function addBotDropSnap(bot, ...targets) {
1969
1971
  return addAction(calcAddDropSnap(getID(bot), targets));
1970
1972
  }
1973
+ /**
1974
+ * Adds the given list of grids to the current drag operation.
1975
+ * @param targets The list of grids to add.
1976
+ */
1977
+ function addDropGrid(...targets) {
1978
+ return addAction(calcAddDropGrid(null, mapSnapGridTargets(targets)));
1979
+ }
1980
+ /**
1981
+ * Adds the given list of grids to the current drag operation for when the specified bot is being dropped on.
1982
+ * @param bot The bot.
1983
+ * @param targets The list of grids to add.
1984
+ */
1985
+ function addBotDropGrid(bot, ...targets) {
1986
+ return addAction(calcAddDropGrid(getID(bot), mapSnapGridTargets(targets)));
1987
+ }
1988
+ function mapSnapGridTargets(targets) {
1989
+ return targets.map(t => ({
1990
+ position: t.position,
1991
+ rotation: t.rotation,
1992
+ bounds: t.bounds,
1993
+ portalBotId: hasValue(t.portalBot) ? getID(t.portalBot) : undefined,
1994
+ portalTag: t.portalTag,
1995
+ priority: t.priority,
1996
+ showGrid: t.showGrid,
1997
+ }));
1998
+ }
1971
1999
  /**
1972
2000
  * Enables custom dragging for the current drag operation.
1973
2001
  * This will disable the built-in logic that moves the bot(s) and
@@ -2087,9 +2115,10 @@ export function createDefaultLibrary(context) {
2087
2115
  * @param recordKey The key that should be used to access the record.
2088
2116
  * @param address The address that the data should be stored at inside the record.
2089
2117
  * @param data The data that should be stored.
2118
+ * @param endpoint The records endpoint that should be queried. Optional.
2090
2119
  */
2091
- function recordData(recordKey, address, data) {
2092
- return baseRecordData(recordKey, address, data, false);
2120
+ function recordData(recordKey, address, data, endpoint = null) {
2121
+ return baseRecordData(recordKey, address, data, false, endpoint);
2093
2122
  }
2094
2123
  /**
2095
2124
  * Records the given data to the given address inside the record for the given record key.
@@ -2098,86 +2127,95 @@ export function createDefaultLibrary(context) {
2098
2127
  * @param recordKey The key that should be used to access the record.
2099
2128
  * @param address The address that the data should be stored at inside the record.
2100
2129
  * @param data The data that should be stored.
2130
+ * @param endpoint The records endpoint that should be queried. Optional.
2101
2131
  */
2102
- function recordManualApprovalData(recordKey, address, data) {
2103
- return baseRecordData(recordKey, address, data, true);
2132
+ function recordManualApprovalData(recordKey, address, data, endpoint = null) {
2133
+ return baseRecordData(recordKey, address, data, true, endpoint);
2104
2134
  }
2105
2135
  /**
2106
2136
  * Records the given data to the given address inside the record for the given record key.
2107
2137
  * @param recordKey The key that should be used to access the record.
2108
2138
  * @param address The address that the data should be stored at inside the record.
2109
2139
  * @param data The data that should be stored.
2140
+ * @param endpoint The records endpoint that should be queried. Optional.
2110
2141
  */
2111
- function baseRecordData(recordKey, address, data, requiresApproval) {
2142
+ function baseRecordData(recordKey, address, data, requiresApproval, endpoint = null) {
2112
2143
  const task = context.createTask();
2113
- const event = calcRecordData(recordKey, address, convertToCopiableValue(data), requiresApproval, task.taskId);
2144
+ const event = calcRecordData(recordKey, address, convertToCopiableValue(data), requiresApproval, endpoint, task.taskId);
2114
2145
  return addAsyncAction(task, event);
2115
2146
  }
2116
2147
  /**
2117
2148
  * Gets the data stored in the given record at the given address.
2118
2149
  * @param recordKeyOrName The record that the data should be retrieved from.
2119
2150
  * @param address The address that the data is stored at.
2151
+ * @param endpoint The records endpoint that should be queried. Optional.
2120
2152
  */
2121
- function getData(recordKeyOrName, address) {
2122
- return baseGetData(recordKeyOrName, address, false);
2153
+ function getData(recordKeyOrName, address, endpoint = null) {
2154
+ return baseGetData(recordKeyOrName, address, false, endpoint);
2123
2155
  }
2124
2156
  /**
2125
2157
  * Gets the data stored in the given record at the given address.
2126
2158
  * @param recordKeyOrName The record that the data should be retrieved from.
2127
2159
  * @param address The address that the data is stored at.
2160
+ * @param endpoint The records endpoint that should be queried. Optional.
2128
2161
  */
2129
- function getManualApprovalData(recordKeyOrName, address) {
2130
- return baseGetData(recordKeyOrName, address, true);
2162
+ function getManualApprovalData(recordKeyOrName, address, endpoint = null) {
2163
+ return baseGetData(recordKeyOrName, address, true, endpoint);
2131
2164
  }
2132
2165
  /**
2133
2166
  * Gets the data stored in the given record at the given address.
2134
2167
  * @param recordKeyOrName The record that the data should be retrieved from.
2135
2168
  * @param address The address that the data is stored at.
2169
+ * @param endpoint The records endpoint that should be queried. Optional.
2136
2170
  */
2137
- function baseGetData(recordKeyOrName, address, requiresApproval) {
2171
+ function baseGetData(recordKeyOrName, address, requiresApproval, endpoint) {
2138
2172
  let recordName = isRecordKey(recordKeyOrName)
2139
2173
  ? parseRecordKey(recordKeyOrName)[0]
2140
2174
  : recordKeyOrName;
2141
2175
  const task = context.createTask();
2142
- const event = getRecordData(recordName, address, requiresApproval, task.taskId);
2176
+ const event = getRecordData(recordName, address, requiresApproval, endpoint, task.taskId);
2143
2177
  return addAsyncAction(task, event);
2144
2178
  }
2145
2179
  /**
2146
2180
  * Lists the data stored in the given record starting with the given address.
2147
2181
  * @param recordKeyOrName The record that the data should be retrieved from.
2148
2182
  * @param startingAddress The address that the list should start with.
2183
+ * @param endpoint The records endpoint that should be queried. Optional.
2149
2184
  */
2150
- function listData(recordKeyOrName, startingAddress = null) {
2185
+ function listData(recordKeyOrName, startingAddress = null, endpoint = null) {
2151
2186
  let recordName = isRecordKey(recordKeyOrName)
2152
2187
  ? parseRecordKey(recordKeyOrName)[0]
2153
2188
  : recordKeyOrName;
2154
2189
  const task = context.createTask();
2155
- const event = listDataRecord(recordName, startingAddress, task.taskId);
2190
+ const event = listDataRecord(recordName, startingAddress, endpoint, task.taskId);
2156
2191
  return addAsyncAction(task, event);
2157
2192
  }
2158
2193
  /**
2159
2194
  * Erases the data stored in the given record at the given address.
2160
2195
  * @param recordKey The key that should be used to access the record.
2161
2196
  * @param address The address that the data should be erased from.
2197
+ * @param endpoint The records endpoint that should be queried. Optional.
2162
2198
  */
2163
- function eraseData(recordKey, address) {
2164
- return baseEraseData(recordKey, address, false);
2199
+ function eraseData(recordKey, address, endpoint = null) {
2200
+ return baseEraseData(recordKey, address, false, endpoint);
2165
2201
  }
2166
2202
  /**
2167
2203
  * Erases the data stored in the given record at the given address.
2168
2204
  *
2169
2205
  * @param recordKey The key that should be used to access the record.
2170
2206
  * @param address The address that the data should be erased from.
2207
+ * @param endpoint The records endpoint that should be queried. Optional.
2171
2208
  */
2172
- function eraseManualApprovalData(recordKey, address) {
2173
- return baseEraseData(recordKey, address, true);
2209
+ function eraseManualApprovalData(recordKey, address, endpoint = null) {
2210
+ return baseEraseData(recordKey, address, true, endpoint);
2174
2211
  }
2175
2212
  /**
2176
2213
  * Erases the data stored in the given record at the given address.
2177
2214
  * @param recordKey The key that should be used to access the record.
2178
2215
  * @param address The address that the data should be erased from.
2216
+ * @param endpoint The records endpoint that should be queried. Optional.
2179
2217
  */
2180
- function baseEraseData(recordKey, address, requiresApproval) {
2218
+ function baseEraseData(recordKey, address, requiresApproval, endpoint = null) {
2181
2219
  if (!hasValue(recordKey)) {
2182
2220
  throw new Error('A recordKey must be provided.');
2183
2221
  }
@@ -2191,7 +2229,7 @@ export function createDefaultLibrary(context) {
2191
2229
  throw new Error('address must be a string.');
2192
2230
  }
2193
2231
  const task = context.createTask();
2194
- const event = eraseRecordData(recordKey, address, requiresApproval, task.taskId);
2232
+ const event = eraseRecordData(recordKey, address, requiresApproval, endpoint, task.taskId);
2195
2233
  return addAsyncAction(task, event);
2196
2234
  }
2197
2235
  /**
@@ -2199,8 +2237,9 @@ export function createDefaultLibrary(context) {
2199
2237
  * @param recordKey The record that the file should be recorded in.
2200
2238
  * @param data The data that should be recorded.
2201
2239
  * @param options The options that should be used to record the file.
2240
+ * @param endpoint The records endpoint that should be queried. Optional.
2202
2241
  */
2203
- function recordFile(recordKey, data, options) {
2242
+ function recordFile(recordKey, data, options, endpoint = null) {
2204
2243
  if (!hasValue(recordKey)) {
2205
2244
  throw new Error('A recordKey must be provided.');
2206
2245
  }
@@ -2211,7 +2250,7 @@ export function createDefaultLibrary(context) {
2211
2250
  throw new Error('data must be provided.');
2212
2251
  }
2213
2252
  const task = context.createTask();
2214
- const event = calcRecordFile(recordKey, convertToCopiableValue(data), options === null || options === void 0 ? void 0 : options.description, options === null || options === void 0 ? void 0 : options.mimeType, task.taskId);
2253
+ const event = calcRecordFile(recordKey, convertToCopiableValue(data), options === null || options === void 0 ? void 0 : options.description, options === null || options === void 0 ? void 0 : options.mimeType, endpoint, task.taskId);
2215
2254
  return addAsyncAction(task, event);
2216
2255
  }
2217
2256
  /**
@@ -2244,8 +2283,9 @@ export function createDefaultLibrary(context) {
2244
2283
  * Deletes the specified file using the given record key.
2245
2284
  * @param recordKey The key that should be used to delete the file.
2246
2285
  * @param urlOrRecordFileResult The URL or the successful result of the record file operation.
2286
+ * @param endpoint The records endpoint that should be queried. Optional.
2247
2287
  */
2248
- function eraseFile(recordKey, fileUrlOrRecordFileResult) {
2288
+ function eraseFile(recordKey, fileUrlOrRecordFileResult, endpoint = null) {
2249
2289
  if (!hasValue(recordKey)) {
2250
2290
  throw new Error('A recordKey must be provided.');
2251
2291
  }
@@ -2266,15 +2306,16 @@ export function createDefaultLibrary(context) {
2266
2306
  url = fileUrlOrRecordFileResult.url;
2267
2307
  }
2268
2308
  const task = context.createTask();
2269
- const event = calcEraseFile(recordKey, url, task.taskId);
2309
+ const event = calcEraseFile(recordKey, url, endpoint, task.taskId);
2270
2310
  return addAsyncAction(task, event);
2271
2311
  }
2272
2312
  /**
2273
2313
  * Records that the given event occurred.
2274
2314
  * @param recordKey The key that should be used to record the event.
2275
2315
  * @param eventName The name of the event.
2316
+ * @param endpoint The records endpoint that should be queried. Optional.
2276
2317
  */
2277
- function recordEvent(recordKey, eventName) {
2318
+ function recordEvent(recordKey, eventName, endpoint = null) {
2278
2319
  if (!hasValue(recordKey)) {
2279
2320
  throw new Error('A recordKey must be provided.');
2280
2321
  }
@@ -2288,15 +2329,16 @@ export function createDefaultLibrary(context) {
2288
2329
  throw new Error('eventName must be a string.');
2289
2330
  }
2290
2331
  const task = context.createTask();
2291
- const event = calcRecordEvent(recordKey, eventName, 1, task.taskId);
2332
+ const event = calcRecordEvent(recordKey, eventName, 1, endpoint, task.taskId);
2292
2333
  return addAsyncAction(task, event);
2293
2334
  }
2294
2335
  /**
2295
2336
  * Gets the number of times that the given event has been recorded.
2296
2337
  * @param recordNameOrKey The name of the record.
2297
2338
  * @param eventName The name of the event.
2339
+ * @param endpoint The records endpoint that should be queried. Optional.
2298
2340
  */
2299
- function countEvents(recordNameOrKey, eventName) {
2341
+ function countEvents(recordNameOrKey, eventName, endpoint = null) {
2300
2342
  if (!hasValue(recordNameOrKey)) {
2301
2343
  throw new Error('A recordNameOrKey must be provided.');
2302
2344
  }
@@ -2313,7 +2355,7 @@ export function createDefaultLibrary(context) {
2313
2355
  ? parseRecordKey(recordNameOrKey)[0]
2314
2356
  : recordNameOrKey;
2315
2357
  const task = context.createTask();
2316
- const event = calcGetEventCount(recordName, eventName, task.taskId);
2358
+ const event = calcGetEventCount(recordName, eventName, endpoint, task.taskId);
2317
2359
  return addAsyncAction(task, event);
2318
2360
  }
2319
2361
  /**
@@ -3173,6 +3215,9 @@ export function createDefaultLibrary(context) {
3173
3215
  }
3174
3216
  }
3175
3217
  function animateBotTag(bot, tagOrOptions, options) {
3218
+ if (!hasValue(bot)) {
3219
+ return Promise.reject(new Error('animateTag() cannot accept null bots'));
3220
+ }
3176
3221
  if (typeof tagOrOptions === 'string') {
3177
3222
  return animateSingleTag(bot, tagOrOptions, options);
3178
3223
  }