@casual-simulation/aux-runtime 3.3.11-alpha.11349749950 → 3.3.12
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 +4 -4
- package/runtime/AuxLibrary.d.ts +12 -2
- package/runtime/AuxLibrary.js +231 -1
- package/runtime/AuxLibrary.js.map +1 -1
- package/runtime/AuxLibraryDefinitions.def +428 -0
- package/runtime/RecordsEvents.d.ts +125 -4
- package/runtime/RecordsEvents.js +173 -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.12",
|
|
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.12",
|
|
36
|
+
"@casual-simulation/aux-records": "^3.3.12",
|
|
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",
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
"**/*.d.ts",
|
|
82
82
|
"**/*.def"
|
|
83
83
|
],
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "5507724657ea76238f342fdb898380e3f6cc29ad"
|
|
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, ListWebhooksOptions } from './RecordsEvents';
|
|
3
|
+
import { AIChatOptions, AIGenerateSkyboxOptions, AIGenerateImageOptions, JoinRoomActionOptions, RoomOptions, RoomTrackOptions, SetRoomTrackOptions, RoomRemoteOptions, DataRecordOptions, RecordActionOptions, ListDataOptions, AISloydGenerateModelOptions, ListWebhooksOptions, ListNotificationsOptions, SendNotificationOptions } 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, WebhookRecord } from '@casual-simulation/aux-records';
|
|
14
|
+
import type { AIChatMessage, GrantResourcePermissionResult, ListStudiosResult, ListSubscriptionsResult, NotificationRecord, PushNotificationPayload, RevokePermissionResult, SendNotificationResult, SubscribeToNotificationResult, UnsubscribeToNotificationResult, 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';
|
|
@@ -2412,6 +2412,16 @@ export declare function createDefaultLibrary(context: AuxGlobalContext): {
|
|
|
2412
2412
|
eraseWebhook: (recordName: string, address: string, options?: RecordActionOptions) => Promise<CrudEraseItemResult>;
|
|
2413
2413
|
listWebhooks: (recordName: string, startingAddress?: string, options?: ListWebhooksOptions) => Promise<CrudListItemsResult<WebhookRecord>>;
|
|
2414
2414
|
listWebhooksByMarker: (recordName: string, marker: string, startingAddress?: string, options?: ListWebhooksOptions) => Promise<CrudListItemsResult<WebhookRecord>>;
|
|
2415
|
+
recordNotification: (recordName: string, notification: NotificationRecord, options?: RecordActionOptions) => Promise<CrudRecordItemResult>;
|
|
2416
|
+
getNotification: (recordName: string, address: string, options?: RecordActionOptions) => Promise<CrudGetItemResult<NotificationRecord>>;
|
|
2417
|
+
eraseNotification: (recordName: string, address: string, options?: RecordActionOptions) => Promise<CrudEraseItemResult>;
|
|
2418
|
+
listNotifications: (recordName: string, startingAddress?: string, options?: ListNotificationsOptions) => Promise<CrudListItemsResult<NotificationRecord>>;
|
|
2419
|
+
listNotificationsByMarker: (recordName: string, marker: string, startingAddress?: string, options?: ListNotificationsOptions) => Promise<CrudListItemsResult<NotificationRecord>>;
|
|
2420
|
+
subscribeToNotification: (recordName: string, address: string, options?: RecordActionOptions) => Promise<SubscribeToNotificationResult>;
|
|
2421
|
+
unsubscribeFromNotification: (subscriptionId: string, options?: RecordActionOptions) => Promise<UnsubscribeToNotificationResult>;
|
|
2422
|
+
sendNotification: (recordName: string, address: string, payload: PushNotificationPayload, options?: SendNotificationOptions) => Promise<SendNotificationResult>;
|
|
2423
|
+
listNotificationSubscriptions: (recordName: string, address: string, options?: RecordActionOptions) => Promise<ListSubscriptionsResult>;
|
|
2424
|
+
listUserNotificationSubscriptions: (options?: RecordActionOptions) => Promise<ListSubscriptionsResult>;
|
|
2415
2425
|
recordFile: (recordKeyOrName: string, data: any, options?: RecordFileOptions, endpoint?: string) => Promise<RecordFileApiResult>;
|
|
2416
2426
|
getFile: {
|
|
2417
2427
|
(result: RecordFileApiSuccess, endpoint?: string): Promise<any>;
|
package/runtime/AuxLibrary.js
CHANGED
|
@@ -40,7 +40,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
40
40
|
};
|
|
41
41
|
import { DEBUG_STRING, debugStringifyFunction, } from './AuxGlobalContext';
|
|
42
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';
|
|
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, } 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';
|
|
@@ -589,6 +589,16 @@ export function createDefaultLibrary(context) {
|
|
|
589
589
|
eraseWebhook,
|
|
590
590
|
listWebhooks,
|
|
591
591
|
listWebhooksByMarker,
|
|
592
|
+
recordNotification,
|
|
593
|
+
getNotification,
|
|
594
|
+
eraseNotification,
|
|
595
|
+
listNotifications,
|
|
596
|
+
listNotificationsByMarker,
|
|
597
|
+
subscribeToNotification,
|
|
598
|
+
unsubscribeFromNotification,
|
|
599
|
+
sendNotification,
|
|
600
|
+
listNotificationSubscriptions,
|
|
601
|
+
listUserNotificationSubscriptions,
|
|
592
602
|
recordFile,
|
|
593
603
|
getFile,
|
|
594
604
|
getPublicFile,
|
|
@@ -5588,6 +5598,226 @@ export function createDefaultLibrary(context) {
|
|
|
5588
5598
|
final[ORIGINAL_OBJECT] = event;
|
|
5589
5599
|
return final;
|
|
5590
5600
|
}
|
|
5601
|
+
/**
|
|
5602
|
+
* Creates or updates a [notification](glossary:notification-record) in the given record using the given options.
|
|
5603
|
+
*
|
|
5604
|
+
* Returns a promise that resolves with an object that contains whether the operation succeeded.
|
|
5605
|
+
*
|
|
5606
|
+
* @param recordName the name of the record.
|
|
5607
|
+
* @param notification the notification that should be created or updated.
|
|
5608
|
+
* @param options the options that should be used.
|
|
5609
|
+
*
|
|
5610
|
+
* @example Create a notification that anyone can subscribe to.
|
|
5611
|
+
* await os.recordNotification('myRecord', {
|
|
5612
|
+
* address: 'notificationAddress',
|
|
5613
|
+
* description: 'my notification',
|
|
5614
|
+
* markers: ['publicRead']
|
|
5615
|
+
* });
|
|
5616
|
+
*
|
|
5617
|
+
* @example Create a private notification.
|
|
5618
|
+
* await os.recordNotification('myRecord', {
|
|
5619
|
+
* address: 'notificationAddress',
|
|
5620
|
+
* description: 'my notification',
|
|
5621
|
+
* markers: ['private']
|
|
5622
|
+
* });
|
|
5623
|
+
*
|
|
5624
|
+
* @dochash actions/os/records
|
|
5625
|
+
* @docgroup 06-records
|
|
5626
|
+
* @docname os.recordNotification
|
|
5627
|
+
*/
|
|
5628
|
+
function recordNotification(recordName, notification, options) {
|
|
5629
|
+
const task = context.createTask();
|
|
5630
|
+
const event = calcRecordNotification(recordName, notification, options !== null && options !== void 0 ? options : {}, task.taskId);
|
|
5631
|
+
const final = addAsyncResultAction(task, event);
|
|
5632
|
+
final[ORIGINAL_OBJECT] = event;
|
|
5633
|
+
return final;
|
|
5634
|
+
}
|
|
5635
|
+
/**
|
|
5636
|
+
* Gets the [notification](glossary:notification-record) from the given record.
|
|
5637
|
+
*
|
|
5638
|
+
* Returns a promise that resolves with the notification data.
|
|
5639
|
+
*
|
|
5640
|
+
* @param recordName the name of the record.
|
|
5641
|
+
* @param address the address of the notification.
|
|
5642
|
+
* @param options the options to use.
|
|
5643
|
+
*
|
|
5644
|
+
* @dochash actions/os/records
|
|
5645
|
+
* @docgroup 06-records
|
|
5646
|
+
* @docname os.getWebhook
|
|
5647
|
+
*/
|
|
5648
|
+
function getNotification(recordName, address, options) {
|
|
5649
|
+
const task = context.createTask();
|
|
5650
|
+
const event = calcGetNotification(recordName, address, options !== null && options !== void 0 ? options : {}, task.taskId);
|
|
5651
|
+
const final = addAsyncResultAction(task, event);
|
|
5652
|
+
final[ORIGINAL_OBJECT] = event;
|
|
5653
|
+
return final;
|
|
5654
|
+
}
|
|
5655
|
+
/**
|
|
5656
|
+
* Deletes the [notification](glossary:notification-record) from the given record.
|
|
5657
|
+
* @param recordName the name of the record.
|
|
5658
|
+
* @param address the address of the notification.
|
|
5659
|
+
* @param options the options to use.
|
|
5660
|
+
*
|
|
5661
|
+
* @dochash actions/os/records
|
|
5662
|
+
* @docgroup 06-records
|
|
5663
|
+
* @docname os.eraseNotification
|
|
5664
|
+
*/
|
|
5665
|
+
function eraseNotification(recordName, address, options) {
|
|
5666
|
+
const task = context.createTask();
|
|
5667
|
+
const event = calcEraseNotification(recordName, address, options !== null && options !== void 0 ? options : {}, task.taskId);
|
|
5668
|
+
const final = addAsyncResultAction(task, event);
|
|
5669
|
+
final[ORIGINAL_OBJECT] = event;
|
|
5670
|
+
return final;
|
|
5671
|
+
}
|
|
5672
|
+
/**
|
|
5673
|
+
* Lists the notifications that are in the given record.
|
|
5674
|
+
* @param recordName the name of the record.
|
|
5675
|
+
* @param startingAddress the address after which items will be included in the list.
|
|
5676
|
+
* 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.
|
|
5677
|
+
* If omitted, then the list will start with the first item.
|
|
5678
|
+
* @param options the options to use.
|
|
5679
|
+
*
|
|
5680
|
+
* @dochash actions/os/records
|
|
5681
|
+
* @docgroup 06-records
|
|
5682
|
+
* @docname os.listNotifications
|
|
5683
|
+
*/
|
|
5684
|
+
function listNotifications(recordName, startingAddress = null, options) {
|
|
5685
|
+
const task = context.createTask();
|
|
5686
|
+
const event = calcListNotifications(recordName, startingAddress, options !== null && options !== void 0 ? options : {}, task.taskId);
|
|
5687
|
+
const final = addAsyncResultAction(task, event);
|
|
5688
|
+
final[ORIGINAL_OBJECT] = event;
|
|
5689
|
+
return final;
|
|
5690
|
+
}
|
|
5691
|
+
/**
|
|
5692
|
+
* Lists the webhooks that are in the given record.
|
|
5693
|
+
* @param recordName the name of the record.
|
|
5694
|
+
* @param marker The marker that needs to be assigned to the data items that should be included in the list.
|
|
5695
|
+
* e.g. Using "publicRead" will return all data items with the "publicRead" marker.
|
|
5696
|
+
* @param startingAddress the address after which items will be included in the list.
|
|
5697
|
+
* 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.
|
|
5698
|
+
* If omitted, then the list will start with the first item.
|
|
5699
|
+
* @param options the options to use.
|
|
5700
|
+
*
|
|
5701
|
+
* @dochash actions/os/records
|
|
5702
|
+
* @docgroup 06-records
|
|
5703
|
+
* @docname os.listNotificationsByMarker
|
|
5704
|
+
*/
|
|
5705
|
+
function listNotificationsByMarker(recordName, marker, startingAddress = null, options) {
|
|
5706
|
+
const task = context.createTask();
|
|
5707
|
+
const event = calcListNotificationsByMarker(recordName, marker, startingAddress, options !== null && options !== void 0 ? options : {}, task.taskId);
|
|
5708
|
+
const final = addAsyncResultAction(task, event);
|
|
5709
|
+
final[ORIGINAL_OBJECT] = event;
|
|
5710
|
+
return final;
|
|
5711
|
+
}
|
|
5712
|
+
/**
|
|
5713
|
+
* Subscribes to the given notification in the given record.
|
|
5714
|
+
*
|
|
5715
|
+
* Returns a promise that resolves when the operation is complete.
|
|
5716
|
+
*
|
|
5717
|
+
* @param recordName the name of the record.
|
|
5718
|
+
* @param address the address of the notification that should be subscribed to.
|
|
5719
|
+
* @param options the options to use.
|
|
5720
|
+
*
|
|
5721
|
+
* @example Subscribe to a notification.
|
|
5722
|
+
* await os.subscribeToNotification('myRecord', 'myNotificationAddress');
|
|
5723
|
+
*
|
|
5724
|
+
* @dochash actions/os/records
|
|
5725
|
+
* @docgroup 06-records
|
|
5726
|
+
* @docname os.subscribeToNotification
|
|
5727
|
+
*/
|
|
5728
|
+
function subscribeToNotification(recordName, address, options) {
|
|
5729
|
+
const task = context.createTask();
|
|
5730
|
+
const event = calcSubscribeToNotification(recordName, address, options !== null && options !== void 0 ? options : {}, task.taskId);
|
|
5731
|
+
const final = addAsyncResultAction(task, event);
|
|
5732
|
+
final[ORIGINAL_OBJECT] = event;
|
|
5733
|
+
return final;
|
|
5734
|
+
}
|
|
5735
|
+
/**
|
|
5736
|
+
* Unsubscribes from the given notification subscription.
|
|
5737
|
+
*
|
|
5738
|
+
* Returns a promise that resolves when the operation is complete.
|
|
5739
|
+
*
|
|
5740
|
+
* @param subscriptionId the ID of the subscription.
|
|
5741
|
+
* @param options the options to use.
|
|
5742
|
+
*
|
|
5743
|
+
* @dochash actions/os/records
|
|
5744
|
+
* @docgroup 06-records
|
|
5745
|
+
* @docname os.unsubscribeFromNotification
|
|
5746
|
+
*/
|
|
5747
|
+
function unsubscribeFromNotification(subscriptionId, options) {
|
|
5748
|
+
const task = context.createTask();
|
|
5749
|
+
const event = calcUnsubscribeFromNotification(subscriptionId, options !== null && options !== void 0 ? options : {}, task.taskId);
|
|
5750
|
+
const final = addAsyncResultAction(task, event);
|
|
5751
|
+
final[ORIGINAL_OBJECT] = event;
|
|
5752
|
+
return final;
|
|
5753
|
+
}
|
|
5754
|
+
/**
|
|
5755
|
+
* Sends a notification to all subscribers of the given notification in the given record.
|
|
5756
|
+
*
|
|
5757
|
+
* Returns a promise that resolves with the result of the operation.
|
|
5758
|
+
*
|
|
5759
|
+
* @param recordName the name of the record.
|
|
5760
|
+
* @param address the address of the notification.
|
|
5761
|
+
* @param payload the payload to send.
|
|
5762
|
+
* @param options the options to use.
|
|
5763
|
+
*
|
|
5764
|
+
* @example Send a notification.
|
|
5765
|
+
* await os.sendNotification('myRecord', 'myNotificationAddress', {
|
|
5766
|
+
* title: 'Hello',
|
|
5767
|
+
* body: 'This is your first notification!',
|
|
5768
|
+
* });
|
|
5769
|
+
*
|
|
5770
|
+
* @dochash actions/os/records
|
|
5771
|
+
* @docgroup 06-records
|
|
5772
|
+
* @docname os.sendNotification
|
|
5773
|
+
*/
|
|
5774
|
+
function sendNotification(recordName, address, payload, options) {
|
|
5775
|
+
const task = context.createTask();
|
|
5776
|
+
const event = calcSendNotification(recordName, address, payload, options !== null && options !== void 0 ? options : {}, task.taskId);
|
|
5777
|
+
const final = addAsyncResultAction(task, event);
|
|
5778
|
+
final[ORIGINAL_OBJECT] = event;
|
|
5779
|
+
return final;
|
|
5780
|
+
}
|
|
5781
|
+
/**
|
|
5782
|
+
* Gets the list of subscriptions for the given notification in the given record.
|
|
5783
|
+
*
|
|
5784
|
+
* @param recordName the name of the record.
|
|
5785
|
+
* @param address the address of the notification.
|
|
5786
|
+
* @param options the options to use.
|
|
5787
|
+
*
|
|
5788
|
+
* @example List notification subscriptions.
|
|
5789
|
+
* const result = await os.listNotificationSubscriptions('myRecord', 'myNotificationAddress');
|
|
5790
|
+
*
|
|
5791
|
+
* @dochash actions/os/records
|
|
5792
|
+
* @docgroup 06-records
|
|
5793
|
+
* @docname os.listNotificationSubscriptions
|
|
5794
|
+
*/
|
|
5795
|
+
function listNotificationSubscriptions(recordName, address, options) {
|
|
5796
|
+
const task = context.createTask();
|
|
5797
|
+
const event = calcListNotificationSubscriptions(recordName, address, options !== null && options !== void 0 ? options : {}, task.taskId);
|
|
5798
|
+
const final = addAsyncResultAction(task, event);
|
|
5799
|
+
final[ORIGINAL_OBJECT] = event;
|
|
5800
|
+
return final;
|
|
5801
|
+
}
|
|
5802
|
+
/**
|
|
5803
|
+
* Gets the list of notification subscriptions for the current user.
|
|
5804
|
+
*
|
|
5805
|
+
* @param options the options to use.
|
|
5806
|
+
*
|
|
5807
|
+
* @example List the current user's notification subscriptions.
|
|
5808
|
+
* const result = await os.listUserNotificationSubscriptions();
|
|
5809
|
+
*
|
|
5810
|
+
* @dochash actions/os/records
|
|
5811
|
+
* @docgroup 06-records
|
|
5812
|
+
* @docname os.listUserNotificationSubscriptions
|
|
5813
|
+
*/
|
|
5814
|
+
function listUserNotificationSubscriptions(options) {
|
|
5815
|
+
const task = context.createTask();
|
|
5816
|
+
const event = calcListUserNotificationSubscriptions(options !== null && options !== void 0 ? options : {}, task.taskId);
|
|
5817
|
+
const final = addAsyncResultAction(task, event);
|
|
5818
|
+
final[ORIGINAL_OBJECT] = event;
|
|
5819
|
+
return final;
|
|
5820
|
+
}
|
|
5591
5821
|
/**
|
|
5592
5822
|
* 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).
|
|
5593
5823
|
*
|