@casual-simulation/aux-runtime 3.6.0 → 3.7.0-alpha.17049743052
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@casual-simulation/aux-runtime",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.7.0-alpha.17049743052",
|
|
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.
|
|
36
|
-
"@casual-simulation/aux-records": "^3.
|
|
35
|
+
"@casual-simulation/aux-common": "^3.7.0-alpha.17049743052",
|
|
36
|
+
"@casual-simulation/aux-records": "^3.7.0-alpha.17049743052",
|
|
37
37
|
"@casual-simulation/crypto": "^3.5.0",
|
|
38
38
|
"@casual-simulation/engine262": "0.0.1-4de2170374e22761996e46eb1362f4496ee57f8f",
|
|
39
39
|
"@casual-simulation/error-stack-parser": "^2.0.7",
|
|
@@ -64,6 +64,7 @@
|
|
|
64
64
|
"rxjs": "8.0.0-alpha.14",
|
|
65
65
|
"seedrandom": "3.0.5",
|
|
66
66
|
"stackframe": "^1.2.0",
|
|
67
|
+
"typesense": "2.0.3",
|
|
67
68
|
"uuid": "10.0.0",
|
|
68
69
|
"yjs": "13.6.8"
|
|
69
70
|
},
|
|
@@ -81,5 +82,5 @@
|
|
|
81
82
|
"**/*.d.ts",
|
|
82
83
|
"**/*.def"
|
|
83
84
|
],
|
|
84
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "6b04efe09edd321556d2dfcc7d56a8f7d25336c1"
|
|
85
86
|
}
|
package/runtime/AuxLibrary.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ import type { HandleWebhookResult } from '@casual-simulation/aux-records/webhook
|
|
|
27
27
|
import type { SharedDocument } from '@casual-simulation/aux-common/documents/SharedDocument';
|
|
28
28
|
import type { CreateRealtimeSessionTokenRequest } from '@casual-simulation/aux-records/AIOpenAIRealtimeInterface';
|
|
29
29
|
import type { PackageRecordVersion, PackageRecordVersionKey, PackageRecordVersionKeySpecifier, RecordPackageVersionResult } from '@casual-simulation/aux-records/packages/version';
|
|
30
|
+
import type { EraseDocumentResult, SearchCollectionSchema, SearchDocument, SearchRecord, SearchRecordOutput, StoreDocumentResult } from '@casual-simulation/aux-records/search';
|
|
30
31
|
/**
|
|
31
32
|
* Defines an interface for a function that provides HTML VDOM capabilities to bots.
|
|
32
33
|
*/
|
|
@@ -251,6 +252,41 @@ export interface RecordPackageVersionApiRequest {
|
|
|
251
252
|
*/
|
|
252
253
|
markers?: string[];
|
|
253
254
|
}
|
|
255
|
+
/**
|
|
256
|
+
* Defines an interface that represents a request for {@link recordSearchCollection}.
|
|
257
|
+
*
|
|
258
|
+
* @dochash types/records/search
|
|
259
|
+
* @docname RecordSearchCollectionRequest
|
|
260
|
+
*/
|
|
261
|
+
export interface RecordSearchCollectionApiRequest {
|
|
262
|
+
/**
|
|
263
|
+
* The name of the record that the package version should be recorded to.
|
|
264
|
+
*/
|
|
265
|
+
recordName: string;
|
|
266
|
+
/**
|
|
267
|
+
* The address that the package version should be recorded to.
|
|
268
|
+
*/
|
|
269
|
+
address: string;
|
|
270
|
+
/**
|
|
271
|
+
* The schema that should be used for the collection.
|
|
272
|
+
*/
|
|
273
|
+
schema: SearchCollectionSchema;
|
|
274
|
+
/**
|
|
275
|
+
* The markers that should be applied to the package version.
|
|
276
|
+
*/
|
|
277
|
+
markers?: string[];
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Defines an interface that represents a request for {@link recordSearchDocument}.
|
|
281
|
+
*
|
|
282
|
+
* @dochash types/records/search
|
|
283
|
+
* @docname RecordSearchDocumentRequest
|
|
284
|
+
*/
|
|
285
|
+
export interface RecordSearchDocumentApiRequest {
|
|
286
|
+
recordName: string;
|
|
287
|
+
address: string;
|
|
288
|
+
document: SearchDocument;
|
|
289
|
+
}
|
|
254
290
|
/**
|
|
255
291
|
* Defines a set of options for {@link animateTag-byTag}.
|
|
256
292
|
*
|
|
@@ -2522,6 +2558,13 @@ export declare function createDefaultLibrary(context: AuxGlobalContext): {
|
|
|
2522
2558
|
getPackageContainer: (recordName: string, address: string, options?: RecordActionOptions) => Promise<CrudGetItemResult<PackageRecord>>;
|
|
2523
2559
|
installPackage: (recordName: string, address: string, key?: string | PackageRecordVersionKeySpecifier, options?: RecordActionOptions) => Promise<InstallPackageResult>;
|
|
2524
2560
|
listInstalledPackages: (options?: RecordActionOptions) => Promise<ListInstalledPackagesResult>;
|
|
2561
|
+
recordSearchCollection: (request: RecordSearchCollectionApiRequest, options?: RecordActionOptions) => Promise<CrudRecordItemResult>;
|
|
2562
|
+
getSearchCollection: (recordName: string, address: string, options?: RecordActionOptions) => Promise<CrudGetItemResult<SearchRecordOutput>>;
|
|
2563
|
+
eraseSearchCollection: (recordName: string, address: string, options?: RecordActionOptions) => Promise<CrudRecordItemResult>;
|
|
2564
|
+
listSearchCollections: (recordName: string, startingAddress?: string, options?: ListDataOptions) => Promise<CrudRecordItemResult>;
|
|
2565
|
+
listSearchCollectionsByMarker: (recordName: string, marker: string, startingAddress?: string, options?: ListDataOptions) => Promise<CrudListItemsResult<SearchRecord>>;
|
|
2566
|
+
recordSearchDocument: (request: RecordSearchDocumentApiRequest, options?: RecordActionOptions) => Promise<StoreDocumentResult>;
|
|
2567
|
+
eraseSearchDocument: (recordName: string, address: string, documentId: string, options?: RecordActionOptions) => Promise<EraseDocumentResult>;
|
|
2525
2568
|
listUserStudios: (endpoint?: string) => Promise<ListStudiosResult>;
|
|
2526
2569
|
getRecordsEndpoint: () => Promise<string>;
|
|
2527
2570
|
convertGeolocationToWhat3Words: (location: ConvertGeolocationToWhat3WordsOptions) => Promise<string>;
|
package/runtime/AuxLibrary.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DEBUG_STRING, debugStringifyFunction } from './AuxGlobalContext';
|
|
2
2
|
import { hasValue, trimTag, isBot, BOT_SPACE_TAG, toast as toastMessage, getScriptIssues as scriptIssues, tip as tipMessage, hideTips as hideTipMessages, showJoinCode as calcShowJoinCode, requestFullscreen, exitFullscreen, html as htmlMessage, hideHtml as hideHtmlMessage, setClipboard as calcSetClipboard, tweenTo as calcTweenTo, showChat as calcShowChat, hideChat as calcHideChat, runScript, getMediaPermission as calcGetMediaPermission, getAverageFrameRate as calcGetAverageFrameRate, enableAR as calcEnableAR, disableAR as calcDisableAR, enableVR as calcEnableVR, disableVR as calcDisableVR, arSupported as calcARSupported, vrSupported as calcVRSupported, showUploadAuxFile as calcShowUploadAuxFile, openQRCodeScanner as calcOpenQRCodeScanner, showQRCode as calcShowQRCode, openBarcodeScanner as calcOpenBarcodeScanner, showBarcode as calcShowBarcode, importAUX as calcImportAUX, showInputForTag as calcShowInputForTag, showInput as calcShowInput, showConfirm as calcShowConfirm, replaceDragBot as calcReplaceDragBot, goToDimension as calcGoToDimension, goToURL as calcGoToURL, openURL as calcOpenURL, playSound as calcPlaySound, bufferSound as calcBufferSound, cancelSound as calcCancelSound, shell as calcShell, reject as calcReject, localFormAnimation as calcLocalFormAnimation, webhook as calcWebhook, superShout as calcSuperShout, share as calcShare, registerPrefix as calcRegisterPrefix, localPositionTween as calcLocalPositionTween, localRotationTween as calcLocalRotationTween, showUploadFiles as calcShowUploadFiles, download, loadSimulation, unloadSimulation, getUploadState, addState, getPortalTag, KNOWN_PORTALS, openConsole, tagsOnBot, getOriginalObject, getBotSpace, trimEvent, CREATE_ACTION_NAME, CREATE_ANY_ACTION_NAME, DESTROY_ACTION_NAME, ORIGINAL_OBJECT, getRemoteCount, getRemotes, listInstUpdates as calcListInstUpdates, getInstStateFromUpdates as calcGetInstStateFromUpdates, action, calculateAnchorPoint, calculateAnchorPointOffset, getBotPosition as calcGetBotPosition, getBotRotation as calcGetBotRotation, isRuntimeBot, SET_TAG_MASK_SYMBOL, CLEAR_TAG_MASKS_SYMBOL, getBotScale, EDIT_TAG_SYMBOL, EDIT_TAG_MASK_SYMBOL, circleWipe, addDropSnap as calcAddDropSnap, addDropGrid as calcAddDropGrid, animateToPosition, beginAudioRecording as calcBeginAudioRecording, endAudioRecording as calcEndAudioRecording, beginRecording as calcBeginRecording, endRecording as calcEndRecording, speakText as calcSpeakText, getVoices as calcGetVoices, getGeolocation as calcGetGeolocation, cancelAnimation, disablePOV, enablePOV, enableCustomDragging as calcEnableCustomDragging, MINI_PORTAL, registerCustomApp, setAppOutput, unregisterCustomApp, requestAuthData as calcRequestAuthData, createBot, defineGlobalBot as calcDefineGlobalBot, TEMPORARY_BOT_PARTITION_ID, convertToString, GET_TAG_MASKS_SYMBOL, isBotLink, parseBotLink, createBotLink, convertGeolocationToWhat3Words as calcConvertGeolocationToWhat3Words, meetCommand as calcMeetCommand, meetFunction as calcMeetFunction, openImageClassifier as calcOpenImageClassifier, classifyImages as calcOpenClassifyImages, isBotDate, DATE_TAG_PREFIX, parseBotDate, realNumberOrDefault, raycastFromCamera as calcRaycastFromCamera, raycastInPortal as calcRaycastInPortal, calculateRayFromCamera as calcCalculateRayFromCamera, bufferFormAddressGltf, startFormAnimation as calcStartFormAnimation, stopFormAnimation as calcStopFormAnimation, listFormAnimations as calcListFormAnimations, calculateStringTagValue, createInitializationUpdate as calcCreateInitalizationUpdate, applyUpdatesToInst as calcApplyUpdatesToInst, configureWakeLock, getWakeLockConfiguration as calcGetWakeLockConfiguration, analyticsRecordEvent as calcAnalyticsRecordEvent, KNOWN_TAGS, isStoredVersion2, getCurrentInstUpdate as calcGetCurrentInstUpdate, openPhotoCamera as calcOpenPhotoCamera, getEasing, enableCollaboration as calcEnableCollaboration, showAccountInfo as calcShowAccountInfo, reportInst as calcReportInst, getRecordsEndpoint as calcGetRecordsEndpoint, ldrawCountAddressBuildSteps as calcLdrawCountAddressBuildSteps, ldrawCountTextBuildSteps as calcLdrawCountTextBuildSteps, calculateViewportCoordinatesFromPosition as calcCalculateViewportCoordinatesFromPosition, calculateScreenCoordinatesFromViewportCoordinates as calcCalculateScreenCoordinatesFromViewportCoordinates, calculateViewportCoordinatesFromScreenCoordinates as calcCalculateViewportCoordinatesFromScreenCoordinates, capturePortalScreenshot as calcCapturePortalScreenshot, createStaticHtml as calcCreateStaticHtmlFromBots, recordLoom, watchLoom, getLoomMetadata, loadSharedDocument, installAuxFile as calcInstallAuxFile, calculateStringListTagValue, calculateScreenCoordinatesFromPosition as calcCalculateScreenCoordinatesFromPosition, addMapLayer as calcAddMapLayer, removeMapLayer as calcRemoveMapLayer, GET_DYNAMIC_LISTENERS_SYMBOL, ADD_BOT_LISTENER_SYMBOL, REMOVE_BOT_LISTENER_SYMBOL, } from '@casual-simulation/aux-common/bots';
|
|
3
|
-
import { aiChat, aiChatStream, aiGenerateSkybox, aiGenerateImage, grantRecordPermission as calcGrantRecordPermission, revokeRecordPermission as calcRevokeRecordPermission, grantInstAdminPermission as calcGrantInstAdminPermission, grantUserRole as calcGrantUserRole, revokeUserRole as calcRevokeUserRole, grantInstRole as calcGrantInstRole, revokeInstRole as calcRevokeInstRole, listUserStudios as calcListUserStudios, joinRoom as calcJoinRoom, leaveRoom as calcLeaveRoom, setRoomOptions as calcSetRoomOptions, getRoomOptions as calcGetRoomOptions, getRoomTrackOptions as calcGetRoomTrackOptions, setRoomTrackOptions as calcSetRoomTrackOptions, getRoomRemoteOptions as calcGetRoomRemoteOptions, listDataRecord, recordEvent as calcRecordEvent, getEventCount as calcGetEventCount, getFile as calcGetFile, eraseFile as calcEraseFile, getPublicRecordKey as calcGetPublicRecordKey, recordData as calcRecordData, getRecordData, eraseRecordData, recordFile as calcRecordFile, listDataRecordByMarker, aiHumeGetAccessToken, aiSloydGenerateModel, recordWebhook as calcRecordWebhook, getWebhook as calcGetWebhook, listWebhooks as calcListWebhooks, listWebhooksByMarker as calcListWebhooksByMarker, eraseWebhook as calcEraseWebhook, runWebhook as calcRunWebhook, recordNotification as calcRecordNotification, getNotification as calcGetNotification, listNotifications as calcListNotifications, listNotificationsByMarker as calcListNotificationsByMarker, eraseNotification as calcEraseNotification, subscribeToNotification as calcSubscribeToNotification, unsubscribeFromNotification as calcUnsubscribeFromNotification, sendNotification as calcSendNotification, listNotificationSubscriptions as calcListNotificationSubscriptions, listUserNotificationSubscriptions as calcListUserNotificationSubscriptions, aiOpenAICreateRealtimeSession, grantEntitlements as calcGrantEntitlements, recordPackageVersion as calcRecordPackageVersion, erasePackageVersion as calcErasePackageVersion, listPackageVersions as calcListPackageVersions, getPackageVersion as calcGetPackageVersion, recordPackageContainer as calcRecordPackageContainer, erasePackageContaienr as calcErasePackageContainer, listPackageContainers as calcListPackageContainers, listPackageContainersByMarker as calcListPackageContainersByMarker, getPackageContainer as calcGetPackageContainer, installPackage as calcInstallPackage, listInstalledPackages as calcListInstalledPackages, } from './RecordsEvents';
|
|
3
|
+
import { aiChat, aiChatStream, aiGenerateSkybox, aiGenerateImage, grantRecordPermission as calcGrantRecordPermission, revokeRecordPermission as calcRevokeRecordPermission, grantInstAdminPermission as calcGrantInstAdminPermission, grantUserRole as calcGrantUserRole, revokeUserRole as calcRevokeUserRole, grantInstRole as calcGrantInstRole, revokeInstRole as calcRevokeInstRole, listUserStudios as calcListUserStudios, joinRoom as calcJoinRoom, leaveRoom as calcLeaveRoom, setRoomOptions as calcSetRoomOptions, getRoomOptions as calcGetRoomOptions, getRoomTrackOptions as calcGetRoomTrackOptions, setRoomTrackOptions as calcSetRoomTrackOptions, getRoomRemoteOptions as calcGetRoomRemoteOptions, listDataRecord, recordEvent as calcRecordEvent, getEventCount as calcGetEventCount, getFile as calcGetFile, eraseFile as calcEraseFile, getPublicRecordKey as calcGetPublicRecordKey, recordData as calcRecordData, getRecordData, eraseRecordData, recordFile as calcRecordFile, listDataRecordByMarker, aiHumeGetAccessToken, aiSloydGenerateModel, recordWebhook as calcRecordWebhook, getWebhook as calcGetWebhook, listWebhooks as calcListWebhooks, listWebhooksByMarker as calcListWebhooksByMarker, eraseWebhook as calcEraseWebhook, runWebhook as calcRunWebhook, recordNotification as calcRecordNotification, getNotification as calcGetNotification, listNotifications as calcListNotifications, listNotificationsByMarker as calcListNotificationsByMarker, eraseNotification as calcEraseNotification, subscribeToNotification as calcSubscribeToNotification, unsubscribeFromNotification as calcUnsubscribeFromNotification, sendNotification as calcSendNotification, listNotificationSubscriptions as calcListNotificationSubscriptions, listUserNotificationSubscriptions as calcListUserNotificationSubscriptions, aiOpenAICreateRealtimeSession, grantEntitlements as calcGrantEntitlements, recordPackageVersion as calcRecordPackageVersion, erasePackageVersion as calcErasePackageVersion, listPackageVersions as calcListPackageVersions, getPackageVersion as calcGetPackageVersion, recordPackageContainer as calcRecordPackageContainer, erasePackageContaienr as calcErasePackageContainer, listPackageContainers as calcListPackageContainers, listPackageContainersByMarker as calcListPackageContainersByMarker, getPackageContainer as calcGetPackageContainer, installPackage as calcInstallPackage, listInstalledPackages as calcListInstalledPackages, recordsCallProcedure, } from './RecordsEvents';
|
|
4
4
|
import { sortBy, every, cloneDeep, union, isEqual, flatMap } from 'lodash';
|
|
5
5
|
import { remote as calcRemote, DEFAULT_BRANCH_NAME, formatVersionNumber, parseVersionNumber, PRIVATE_MARKER, } from '@casual-simulation/aux-common';
|
|
6
6
|
import { RanOutOfEnergyError } from './AuxResults';
|
|
@@ -594,6 +594,13 @@ export function createDefaultLibrary(context) {
|
|
|
594
594
|
getPackageContainer,
|
|
595
595
|
installPackage,
|
|
596
596
|
listInstalledPackages,
|
|
597
|
+
recordSearchCollection,
|
|
598
|
+
getSearchCollection,
|
|
599
|
+
eraseSearchCollection,
|
|
600
|
+
listSearchCollections,
|
|
601
|
+
listSearchCollectionsByMarker,
|
|
602
|
+
recordSearchDocument,
|
|
603
|
+
eraseSearchDocument,
|
|
597
604
|
listUserStudios,
|
|
598
605
|
getRecordsEndpoint,
|
|
599
606
|
convertGeolocationToWhat3Words,
|
|
@@ -6669,6 +6676,317 @@ export function createDefaultLibrary(context) {
|
|
|
6669
6676
|
const event = calcListInstalledPackages(options, task.taskId);
|
|
6670
6677
|
return addAsyncAction(task, event);
|
|
6671
6678
|
}
|
|
6679
|
+
/**
|
|
6680
|
+
* Creates or updates a search collection in the given record.
|
|
6681
|
+
*
|
|
6682
|
+
* Returns a promise that resolves with the result of the operation.
|
|
6683
|
+
*
|
|
6684
|
+
* @param request The request to create or update the search collection.
|
|
6685
|
+
* @param options the options for the request.
|
|
6686
|
+
* @returns A promise that resolves with the result of the operation.
|
|
6687
|
+
*
|
|
6688
|
+
* @example Record a search collection with an automatic schema
|
|
6689
|
+
* const result = await os.recordSearchCollection({
|
|
6690
|
+
* recordName: 'myRecord',
|
|
6691
|
+
* address: 'mySearchCollection',
|
|
6692
|
+
* schema: {
|
|
6693
|
+
* '.*': {
|
|
6694
|
+
* type: 'auto'
|
|
6695
|
+
* }
|
|
6696
|
+
* }
|
|
6697
|
+
* });
|
|
6698
|
+
*
|
|
6699
|
+
* @example Record a search collection with a custom schema
|
|
6700
|
+
* const result = await os.recordSearchCollection({
|
|
6701
|
+
* recordName: 'myRecord',
|
|
6702
|
+
* address: 'mySearchCollection',
|
|
6703
|
+
* schema: {
|
|
6704
|
+
title: {
|
|
6705
|
+
type: 'string',
|
|
6706
|
+
},
|
|
6707
|
+
description: {
|
|
6708
|
+
type: 'string',
|
|
6709
|
+
},
|
|
6710
|
+
price: {
|
|
6711
|
+
type: 'int32',
|
|
6712
|
+
}
|
|
6713
|
+
* }
|
|
6714
|
+
* });
|
|
6715
|
+
*
|
|
6716
|
+
* @example Record a private search collection
|
|
6717
|
+
* const result = await os.recordSearchCollection({
|
|
6718
|
+
* recordName: 'myRecord',
|
|
6719
|
+
* address: 'mySearchCollection',
|
|
6720
|
+
* schema: {
|
|
6721
|
+
'.*': {
|
|
6722
|
+
* type: 'auto'
|
|
6723
|
+
* }
|
|
6724
|
+
* },
|
|
6725
|
+
* markers: ['private']
|
|
6726
|
+
* });
|
|
6727
|
+
*
|
|
6728
|
+
* @example Record and search through a search collection
|
|
6729
|
+
* import Typesense from 'typesense';
|
|
6730
|
+
* const result = await os.recordSearchCollection({
|
|
6731
|
+
* recordName: 'myRecord',
|
|
6732
|
+
* address: 'mySearchCollection',
|
|
6733
|
+
* schema: {
|
|
6734
|
+
* '.*': {
|
|
6735
|
+
* type: 'auto'
|
|
6736
|
+
* }
|
|
6737
|
+
* }
|
|
6738
|
+
* });
|
|
6739
|
+
*
|
|
6740
|
+
* if (!result.success) {
|
|
6741
|
+
* os.toast('Failed to record search collection: ' + result.errorMessage);
|
|
6742
|
+
* return;
|
|
6743
|
+
* }
|
|
6744
|
+
*
|
|
6745
|
+
* const collection = await os.getSearchCollection('myRecord', 'mySearchCollection');
|
|
6746
|
+
*
|
|
6747
|
+
* if (!collection.success) {
|
|
6748
|
+
* os.toast('Failed to get search collection: ' + collection.errorMessage);
|
|
6749
|
+
* return;
|
|
6750
|
+
* }
|
|
6751
|
+
*
|
|
6752
|
+
* const client = new Typesense.Client({
|
|
6753
|
+
* nodes: collection.item.nodes,
|
|
6754
|
+
* apiKey: collection.item.searchApiKey,
|
|
6755
|
+
* });
|
|
6756
|
+
*
|
|
6757
|
+
* const searchResults = await client.collections(collection.item.collectionName).documents().search({
|
|
6758
|
+
* q: 'search term',
|
|
6759
|
+
* query_by: 'title,description',
|
|
6760
|
+
* sort_by: 'price:asc',
|
|
6761
|
+
* });
|
|
6762
|
+
*
|
|
6763
|
+
* console.log('search results', searchResults);
|
|
6764
|
+
*
|
|
6765
|
+
*
|
|
6766
|
+
* @doctitle Search Actions
|
|
6767
|
+
* @docsidebar Search
|
|
6768
|
+
* @docdescription Search actions allow you to create and manage search collections in your records. Search collections enable efficient searching and indexing of data within your records, making it easier to retrieve relevant information quickly.
|
|
6769
|
+
* @dochash actions/os/records/search
|
|
6770
|
+
* @docgroup 02-search
|
|
6771
|
+
* @docname os.recordSearchCollection
|
|
6772
|
+
*/
|
|
6773
|
+
function recordSearchCollection(request, options = {}) {
|
|
6774
|
+
const task = context.createTask();
|
|
6775
|
+
const event = recordsCallProcedure({
|
|
6776
|
+
recordSearchCollection: {
|
|
6777
|
+
input: {
|
|
6778
|
+
recordName: request.recordName,
|
|
6779
|
+
item: {
|
|
6780
|
+
address: request.address,
|
|
6781
|
+
schema: request.schema,
|
|
6782
|
+
markers: request.markers,
|
|
6783
|
+
},
|
|
6784
|
+
},
|
|
6785
|
+
},
|
|
6786
|
+
}, options, task.taskId);
|
|
6787
|
+
return addAsyncAction(task, event);
|
|
6788
|
+
}
|
|
6789
|
+
/**
|
|
6790
|
+
* Deletes a search collection along with all the documents in it.
|
|
6791
|
+
*
|
|
6792
|
+
* Returns a promise that resolves with the result of the operation.
|
|
6793
|
+
*
|
|
6794
|
+
* @param recordName The name of the record to delete the search collection from.
|
|
6795
|
+
* @param address The address of the search collection to delete.
|
|
6796
|
+
* @param options the options for the request.
|
|
6797
|
+
* @returns A promise that resolves with the result of the operation.
|
|
6798
|
+
*
|
|
6799
|
+
* @example Erase a search collection
|
|
6800
|
+
* const result = await os.eraseSearchCollection('recordName', 'mySearchCollection');
|
|
6801
|
+
*
|
|
6802
|
+
* @dochash actions/os/records/search
|
|
6803
|
+
* @docgroup 02-search
|
|
6804
|
+
* @docname os.eraseSearchCollection
|
|
6805
|
+
*/
|
|
6806
|
+
function eraseSearchCollection(recordName, address, options = {}) {
|
|
6807
|
+
const task = context.createTask();
|
|
6808
|
+
const event = recordsCallProcedure({
|
|
6809
|
+
eraseSearchCollection: {
|
|
6810
|
+
input: {
|
|
6811
|
+
recordName,
|
|
6812
|
+
address,
|
|
6813
|
+
},
|
|
6814
|
+
},
|
|
6815
|
+
}, options, task.taskId);
|
|
6816
|
+
return addAsyncAction(task, event);
|
|
6817
|
+
}
|
|
6818
|
+
/**
|
|
6819
|
+
* Lists the search collections in a record.
|
|
6820
|
+
*
|
|
6821
|
+
* Returns a promise that resolves with the result of the operation.
|
|
6822
|
+
*
|
|
6823
|
+
* @param recordName The name of the record to delete the search collection from.
|
|
6824
|
+
* @param startingAddress the address that the listing should start after.
|
|
6825
|
+
* @param options the options for the request.
|
|
6826
|
+
* @returns A promise that resolves with the result of the operation.
|
|
6827
|
+
*
|
|
6828
|
+
* @example List search collections
|
|
6829
|
+
* const result = await os.listSearchCollections('recordName', 'mySearchCollection');
|
|
6830
|
+
*
|
|
6831
|
+
* @dochash actions/os/records/search
|
|
6832
|
+
* @docgroup 02-search
|
|
6833
|
+
* @docname os.listSearchCollections
|
|
6834
|
+
*/
|
|
6835
|
+
function listSearchCollections(recordName, startingAddress, options = {}) {
|
|
6836
|
+
const task = context.createTask();
|
|
6837
|
+
const event = recordsCallProcedure({
|
|
6838
|
+
listSearchCollections: {
|
|
6839
|
+
input: {
|
|
6840
|
+
recordName,
|
|
6841
|
+
address: startingAddress,
|
|
6842
|
+
},
|
|
6843
|
+
},
|
|
6844
|
+
}, options, task.taskId);
|
|
6845
|
+
return addAsyncAction(task, event);
|
|
6846
|
+
}
|
|
6847
|
+
/**
|
|
6848
|
+
* Lists the search collections in a record by a specific marker.
|
|
6849
|
+
* @param recordName The name of the record to list the search collections from.
|
|
6850
|
+
* @param marker The marker to filter the list by.
|
|
6851
|
+
* @param startingAddress The address that the listing should start after.
|
|
6852
|
+
* @param options The options for the request.
|
|
6853
|
+
* @returns A promise that resolves with the result of the operation.
|
|
6854
|
+
*
|
|
6855
|
+
* @example List public read search collections
|
|
6856
|
+
* const result = await os.listSearchCollectionsByMarker('recordName', 'publicRead');
|
|
6857
|
+
*
|
|
6858
|
+
* @example List private search collections
|
|
6859
|
+
* const result = await os.listSearchCollectionsByMarker('recordName', 'private');
|
|
6860
|
+
*
|
|
6861
|
+
* @dochash actions/os/records/search
|
|
6862
|
+
* @docgroup 02-search
|
|
6863
|
+
* @docname os.listSearchCollectionsByMarker
|
|
6864
|
+
*/
|
|
6865
|
+
function listSearchCollectionsByMarker(recordName, marker, startingAddress, options = {}) {
|
|
6866
|
+
const task = context.createTask();
|
|
6867
|
+
const event = recordsCallProcedure({
|
|
6868
|
+
listSearchCollections: {
|
|
6869
|
+
input: {
|
|
6870
|
+
recordName,
|
|
6871
|
+
marker,
|
|
6872
|
+
address: startingAddress,
|
|
6873
|
+
sort: options === null || options === void 0 ? void 0 : options.sort,
|
|
6874
|
+
},
|
|
6875
|
+
},
|
|
6876
|
+
}, options, task.taskId);
|
|
6877
|
+
return addAsyncAction(task, event);
|
|
6878
|
+
}
|
|
6879
|
+
/**
|
|
6880
|
+
* Gets a search collection from the specified record.
|
|
6881
|
+
* @param recordName The name of the record to retrieve the search collection from.
|
|
6882
|
+
* @param address The address of the search collection to retrieve.
|
|
6883
|
+
* @param options The options for the request.
|
|
6884
|
+
* @returns A promise that resolves with the result of the operation.
|
|
6885
|
+
*
|
|
6886
|
+
* @example Get a search collection
|
|
6887
|
+
* const result = await os.getSearchCollection('myRecord', 'mySearchCollection');
|
|
6888
|
+
*
|
|
6889
|
+
* @example Search through a search collection
|
|
6890
|
+
* import Typesense from 'typesense';
|
|
6891
|
+
* const collection = await os.getSearchCollection('myRecord', 'mySearchCollection');
|
|
6892
|
+
*
|
|
6893
|
+
* if (!collection.success) {
|
|
6894
|
+
* os.toast('Failed to get search collection: ' + collection.errorMessage);
|
|
6895
|
+
* return;
|
|
6896
|
+
* }
|
|
6897
|
+
*
|
|
6898
|
+
* const client = new Typesense.Client({
|
|
6899
|
+
* nodes: collection.item.nodes,
|
|
6900
|
+
* apiKey: collection.item.searchApiKey,
|
|
6901
|
+
* });
|
|
6902
|
+
*
|
|
6903
|
+
* const searchResults = await client.collections(collection.item.collectionName).documents().search({
|
|
6904
|
+
* q: 'search term',
|
|
6905
|
+
* query_by: 'title,description',
|
|
6906
|
+
* sort_by: 'price:asc',
|
|
6907
|
+
* });
|
|
6908
|
+
*
|
|
6909
|
+
* console.log('search results', searchResults);
|
|
6910
|
+
*
|
|
6911
|
+
* @dochash actions/os/records/search
|
|
6912
|
+
* @docgroup 02-search
|
|
6913
|
+
* @docname os.getSearchCollection
|
|
6914
|
+
*/
|
|
6915
|
+
function getSearchCollection(recordName, address, options = {}) {
|
|
6916
|
+
const task = context.createTask();
|
|
6917
|
+
const event = recordsCallProcedure({
|
|
6918
|
+
getSearchCollection: {
|
|
6919
|
+
input: {
|
|
6920
|
+
recordName,
|
|
6921
|
+
address,
|
|
6922
|
+
},
|
|
6923
|
+
},
|
|
6924
|
+
}, options, task.taskId);
|
|
6925
|
+
return addAsyncAction(task, event);
|
|
6926
|
+
}
|
|
6927
|
+
/**
|
|
6928
|
+
* Records a search document to the specified search collection in the given record.
|
|
6929
|
+
* @param request The request to record the search document.
|
|
6930
|
+
* @param options The options for the request.
|
|
6931
|
+
* @returns A promise that resolves with the result of the operation.
|
|
6932
|
+
*
|
|
6933
|
+
* @example Record a search document
|
|
6934
|
+
* const result = await os.recordSearchDocument({
|
|
6935
|
+
* recordName: 'myRecord',
|
|
6936
|
+
* address: 'mySearchCollection',
|
|
6937
|
+
* document: {
|
|
6938
|
+
* // ensure that the document matches the schema of the search collection
|
|
6939
|
+
* title: 'My Document',
|
|
6940
|
+
* description: 'This is the content of my document.'
|
|
6941
|
+
* price: 10,
|
|
6942
|
+
* }
|
|
6943
|
+
* });
|
|
6944
|
+
*
|
|
6945
|
+
* @dochash actions/os/records/search
|
|
6946
|
+
* @docgroup 02-search
|
|
6947
|
+
* @docname os.recordSearchDocument
|
|
6948
|
+
*/
|
|
6949
|
+
function recordSearchDocument(request, options = {}) {
|
|
6950
|
+
const task = context.createTask();
|
|
6951
|
+
const event = recordsCallProcedure({
|
|
6952
|
+
recordSearchDocument: {
|
|
6953
|
+
input: {
|
|
6954
|
+
recordName: request.recordName,
|
|
6955
|
+
address: request.address,
|
|
6956
|
+
document: request.document,
|
|
6957
|
+
},
|
|
6958
|
+
},
|
|
6959
|
+
}, options, task.taskId);
|
|
6960
|
+
return addAsyncAction(task, event);
|
|
6961
|
+
}
|
|
6962
|
+
/**
|
|
6963
|
+
* Erases a search document from the specified search collection in the given record.
|
|
6964
|
+
* @param recordName The name of the record that the search document is in.
|
|
6965
|
+
* @param address The address of the search collection that the document is in.
|
|
6966
|
+
* @param documentId The ID of the document that should be erased.
|
|
6967
|
+
* @param options The options for the request.
|
|
6968
|
+
* @returns A promise that resolves with the result of the operation.
|
|
6969
|
+
*
|
|
6970
|
+
* @example Erase a search document
|
|
6971
|
+
* const result = await os.eraseSearchDocument('myRecord', 'mySearchCollection', 'documentId');
|
|
6972
|
+
*
|
|
6973
|
+
* @dochash actions/os/records/search
|
|
6974
|
+
* @docgroup 02-search
|
|
6975
|
+
* @docname os.eraseSearchDocument
|
|
6976
|
+
*/
|
|
6977
|
+
function eraseSearchDocument(recordName, address, documentId, options = {}) {
|
|
6978
|
+
const task = context.createTask();
|
|
6979
|
+
const event = recordsCallProcedure({
|
|
6980
|
+
eraseSearchDocument: {
|
|
6981
|
+
input: {
|
|
6982
|
+
recordName: recordName,
|
|
6983
|
+
address: address,
|
|
6984
|
+
documentId: documentId,
|
|
6985
|
+
},
|
|
6986
|
+
},
|
|
6987
|
+
}, options, task.taskId);
|
|
6988
|
+
return addAsyncAction(task, event);
|
|
6989
|
+
}
|
|
6672
6990
|
/**
|
|
6673
6991
|
* Gets the list of studios that the currently logged in user has access to.
|
|
6674
6992
|
*
|