@casual-simulation/aux-runtime 3.7.0 → 3.7.1-alpha.17809973136
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 +204 -8
- package/runtime/AuxLibrary.js +638 -4
- package/runtime/AuxLibrary.js.map +1 -1
- package/runtime/AuxLibraryDefinitions.def +505 -0
- package/runtime/RecordsEvents.d.ts +55 -1
- package/runtime/RecordsEvents.js +68 -0
- package/runtime/RecordsEvents.js.map +1 -1
- package/runtime/database/DatabaseUtils.d.ts +12 -0
- package/runtime/database/DatabaseUtils.js +33 -0
- package/runtime/database/DatabaseUtils.js.map +1 -0
|
@@ -3597,6 +3597,84 @@ export interface RevokePermissionFailure {
|
|
|
3597
3597
|
errorMessage: string;
|
|
3598
3598
|
}
|
|
3599
3599
|
|
|
3600
|
+
/**
|
|
3601
|
+
* Represents a request to list permissions for a record.
|
|
3602
|
+
*
|
|
3603
|
+
* @dochash types/permissions
|
|
3604
|
+
* @docname ListPermissionsRequest
|
|
3605
|
+
*/
|
|
3606
|
+
export interface ListPermissionsRequest extends RecordActionOptions {
|
|
3607
|
+
/**
|
|
3608
|
+
* The name of the record to list permissions for.
|
|
3609
|
+
*/
|
|
3610
|
+
recordName: string;
|
|
3611
|
+
|
|
3612
|
+
/**
|
|
3613
|
+
* The marker to list permissions for.
|
|
3614
|
+
*/
|
|
3615
|
+
marker?: string;
|
|
3616
|
+
|
|
3617
|
+
/**
|
|
3618
|
+
* The kind of resource to list permissions for.
|
|
3619
|
+
*/
|
|
3620
|
+
resourceKind?: string;
|
|
3621
|
+
|
|
3622
|
+
/**
|
|
3623
|
+
* The ID of the resource to list permissions for.
|
|
3624
|
+
*/
|
|
3625
|
+
resourceId?: string;
|
|
3626
|
+
}
|
|
3627
|
+
|
|
3628
|
+
/**
|
|
3629
|
+
* Represents the result of a request to list permissions for a record.
|
|
3630
|
+
*
|
|
3631
|
+
* @dochash types/permissions
|
|
3632
|
+
* @docname ListPermissionsResult
|
|
3633
|
+
*/
|
|
3634
|
+
export type ListPermissionsResult =
|
|
3635
|
+
| ListPermissionsSuccess
|
|
3636
|
+
| ListPermissionsFailure;
|
|
3637
|
+
|
|
3638
|
+
/**
|
|
3639
|
+
* Represents a successful response to a request to list permissions for a record.
|
|
3640
|
+
*
|
|
3641
|
+
* @dochash types/permissions
|
|
3642
|
+
* @docname ListPermissionsSuccess
|
|
3643
|
+
*/
|
|
3644
|
+
export interface ListPermissionsSuccess {
|
|
3645
|
+
success: true;
|
|
3646
|
+
|
|
3647
|
+
/**
|
|
3648
|
+
* The name of the record.
|
|
3649
|
+
*/
|
|
3650
|
+
recordName: string;
|
|
3651
|
+
|
|
3652
|
+
/**
|
|
3653
|
+
* The list of permissions that apply directly to a resource.
|
|
3654
|
+
*/
|
|
3655
|
+
resourcePermissions: ListedResourcePermission[];
|
|
3656
|
+
|
|
3657
|
+
/**
|
|
3658
|
+
* The list of permissions that apply to markers.
|
|
3659
|
+
*/
|
|
3660
|
+
markerPermissions: ListedMarkerPermission[];
|
|
3661
|
+
}
|
|
3662
|
+
|
|
3663
|
+
/**
|
|
3664
|
+
* Represents a failed response to a request to list permissions for a record.
|
|
3665
|
+
*
|
|
3666
|
+
* @dochash types/permissions
|
|
3667
|
+
* @docname ListPermissionsFailure
|
|
3668
|
+
*/
|
|
3669
|
+
export interface ListPermissionsFailure {
|
|
3670
|
+
success: false;
|
|
3671
|
+
errorCode:
|
|
3672
|
+
| ServerError
|
|
3673
|
+
| ValidatePublicRecordKeyFailure['errorCode']
|
|
3674
|
+
| AuthorizeSubjectFailure['errorCode'];
|
|
3675
|
+
errorMessage: string;
|
|
3676
|
+
}
|
|
3677
|
+
|
|
3600
3678
|
/**
|
|
3601
3679
|
* Defines the possible results of revoking a role.
|
|
3602
3680
|
*
|
|
@@ -11158,6 +11236,227 @@ export interface CrudListItemsFailure {
|
|
|
11158
11236
|
errorMessage: string;
|
|
11159
11237
|
}
|
|
11160
11238
|
|
|
11239
|
+
/**
|
|
11240
|
+
* Defines a record that represents a database that can be queried using SQL.
|
|
11241
|
+
*/
|
|
11242
|
+
export interface DatabaseRecord extends CrudRecord {}
|
|
11243
|
+
|
|
11244
|
+
/**
|
|
11245
|
+
* Defines a statement that can be sent to the database.
|
|
11246
|
+
*
|
|
11247
|
+
* @dochash types/records/database
|
|
11248
|
+
* @docname DatabaseStatement
|
|
11249
|
+
*/
|
|
11250
|
+
export interface DatabaseStatement {
|
|
11251
|
+
/**
|
|
11252
|
+
* The query text of the statement.
|
|
11253
|
+
*/
|
|
11254
|
+
query: string;
|
|
11255
|
+
|
|
11256
|
+
/**
|
|
11257
|
+
* The parameters for the query.
|
|
11258
|
+
*/
|
|
11259
|
+
params?: unknown[];
|
|
11260
|
+
}
|
|
11261
|
+
|
|
11262
|
+
|
|
11263
|
+
export type ErrorType = {
|
|
11264
|
+
errorCode: string;
|
|
11265
|
+
errorMessage: string;
|
|
11266
|
+
[key: string]: any;
|
|
11267
|
+
};
|
|
11268
|
+
|
|
11269
|
+
export type GenericSuccess<T> = T extends Array<any>
|
|
11270
|
+
? { success: true; items: T }
|
|
11271
|
+
: T extends object
|
|
11272
|
+
? {
|
|
11273
|
+
success: true;
|
|
11274
|
+
} & T
|
|
11275
|
+
: {
|
|
11276
|
+
success: true;
|
|
11277
|
+
value: T;
|
|
11278
|
+
};
|
|
11279
|
+
|
|
11280
|
+
export type GenericFailure<E extends ErrorType> = {
|
|
11281
|
+
success: false;
|
|
11282
|
+
} & E;
|
|
11283
|
+
|
|
11284
|
+
export type GenericResult<T, E extends ErrorType> =
|
|
11285
|
+
| GenericSuccess<T>
|
|
11286
|
+
| GenericFailure<E>;
|
|
11287
|
+
|
|
11288
|
+
export type SimpleError = {
|
|
11289
|
+
errorCode: KnownErrorCodes;
|
|
11290
|
+
errorMessage: string;
|
|
11291
|
+
|
|
11292
|
+
reason?: any;
|
|
11293
|
+
issues?: Zod.ZodIssue[];
|
|
11294
|
+
};
|
|
11295
|
+
|
|
11296
|
+
/**
|
|
11297
|
+
* Defines the result of an API query.
|
|
11298
|
+
*
|
|
11299
|
+
* @dochash types/records/database
|
|
11300
|
+
* @docname QueryResult
|
|
11301
|
+
*/
|
|
11302
|
+
export interface ApiQueryResult {
|
|
11303
|
+
/**
|
|
11304
|
+
* The rows that were returned from the query.
|
|
11305
|
+
*/
|
|
11306
|
+
rows: Record<string, any>[];
|
|
11307
|
+
|
|
11308
|
+
/**
|
|
11309
|
+
* The number of rows that were modified by the query.
|
|
11310
|
+
*/
|
|
11311
|
+
affectedRowCount: number;
|
|
11312
|
+
|
|
11313
|
+
/**
|
|
11314
|
+
* The ID of the last row that was inserted by the query.
|
|
11315
|
+
*/
|
|
11316
|
+
lastInsertId?: number | string;
|
|
11317
|
+
}
|
|
11318
|
+
|
|
11319
|
+
/**
|
|
11320
|
+
* Defines the result of a batch query.
|
|
11321
|
+
*
|
|
11322
|
+
* @dochash types/records/database
|
|
11323
|
+
* @docname BatchResult
|
|
11324
|
+
*/
|
|
11325
|
+
export interface BatchResult {
|
|
11326
|
+
/**
|
|
11327
|
+
* The results of the individual statements.
|
|
11328
|
+
*/
|
|
11329
|
+
results: ApiQueryResult[];
|
|
11330
|
+
}
|
|
11331
|
+
|
|
11332
|
+
/**
|
|
11333
|
+
* Represents a connection to a database record.
|
|
11334
|
+
*
|
|
11335
|
+
* @dochash types/records/database
|
|
11336
|
+
* @docname Database
|
|
11337
|
+
*
|
|
11338
|
+
* @example Get a database connection.
|
|
11339
|
+
* const database = os.getDatabase('myRecord', 'myDatabase');
|
|
11340
|
+
*/
|
|
11341
|
+
export interface ApiDatabase {
|
|
11342
|
+
/**
|
|
11343
|
+
* Constructs a database statement from the given [template string literal](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals).
|
|
11344
|
+
*
|
|
11345
|
+
* Once constructed, the returned statement can be used with `run()` or `batch()`.
|
|
11346
|
+
*
|
|
11347
|
+
* @param templates The string templates.
|
|
11348
|
+
* @param params The parameters to interpolate into the templates.
|
|
11349
|
+
* @returns A database statement.
|
|
11350
|
+
*
|
|
11351
|
+
* @example Create a database statement from a SQL query
|
|
11352
|
+
* const statement = database.sql`SELECT * FROM items`;
|
|
11353
|
+
*
|
|
11354
|
+
* @example Use a parameter in a database statement
|
|
11355
|
+
* const itemId = 'abc';
|
|
11356
|
+
* const statement = database.sql`SELECT * FROM items WHERE id = ${itemId}`;
|
|
11357
|
+
*/
|
|
11358
|
+
sql(
|
|
11359
|
+
templates: TemplateStringsArray,
|
|
11360
|
+
...params: unknown[]
|
|
11361
|
+
): DatabaseStatement;
|
|
11362
|
+
|
|
11363
|
+
/**
|
|
11364
|
+
* Creates a new database statement from the given SQL and parameters.
|
|
11365
|
+
* @param sql The SQL query string.
|
|
11366
|
+
* @param params The parameters to include in the query.
|
|
11367
|
+
* @returns A new database statement.
|
|
11368
|
+
*/
|
|
11369
|
+
statement(sql: string, ...params: unknown[]): DatabaseStatement;
|
|
11370
|
+
|
|
11371
|
+
/**
|
|
11372
|
+
* Runs the given readonly query against the database.
|
|
11373
|
+
* This method requires queries to be read-only. This means that queries can only select data, they cannot insert, update, or delete data.
|
|
11374
|
+
*
|
|
11375
|
+
* Supports [template string literals](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals) for parameterized queries.
|
|
11376
|
+
*
|
|
11377
|
+
* **Warning:** To avoid [SQL Injection attacks](https://en.wikipedia.org/wiki/SQL_injection), always use template literals with expressions. Never use the `+` operator to concatenate strings containing SQL code.
|
|
11378
|
+
*
|
|
11379
|
+
* @param templates The string templates.
|
|
11380
|
+
* @param params The parameters that should be used.
|
|
11381
|
+
* @returns A promise that resolves when the query has completed.
|
|
11382
|
+
*
|
|
11383
|
+
* @example Select all items from a table
|
|
11384
|
+
* const result = await database.query`SELECT * FROM items`;
|
|
11385
|
+
*
|
|
11386
|
+
* @example Use a parameter in a query
|
|
11387
|
+
* const itemId = 'abc';
|
|
11388
|
+
* const result = await database.query`SELECT * FROM items WHERE id = ${itemId}`;
|
|
11389
|
+
*/
|
|
11390
|
+
query(
|
|
11391
|
+
templates: TemplateStringsArray,
|
|
11392
|
+
...params: unknown[]
|
|
11393
|
+
): Promise<GenericResult<ApiQueryResult, SimpleError>>;
|
|
11394
|
+
|
|
11395
|
+
/**
|
|
11396
|
+
* Runs the given SQL on the database and returns the result.
|
|
11397
|
+
* This method supports read-write queries. This means that queries can be used to select, insert, update, and delete data.
|
|
11398
|
+
*
|
|
11399
|
+
* Supports [template string literals](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals) for parameterized queries.
|
|
11400
|
+
*
|
|
11401
|
+
* **Warning:** To avoid [SQL Injection attacks](https://en.wikipedia.org/wiki/SQL_injection), always use template literals with expressions. Never use the `+` operator to concatenate strings containing SQL code.
|
|
11402
|
+
*
|
|
11403
|
+
* @param templates The string templates.
|
|
11404
|
+
* @param params The parameters that should be used.
|
|
11405
|
+
* @returns A promise that resolves when the SQL has completed.
|
|
11406
|
+
*
|
|
11407
|
+
* @example Insert a new item into a table
|
|
11408
|
+
* const name = "New Item";
|
|
11409
|
+
* const value = 100;
|
|
11410
|
+
* const result = await database.execute`INSERT INTO items (name, value) VALUES (${name}, ${value})`;
|
|
11411
|
+
*
|
|
11412
|
+
*/
|
|
11413
|
+
execute(
|
|
11414
|
+
templates: TemplateStringsArray,
|
|
11415
|
+
...params: unknown[]
|
|
11416
|
+
): Promise<GenericResult<ApiQueryResult, SimpleError>>;
|
|
11417
|
+
/**
|
|
11418
|
+
* Runs the given statements in a single transaction. Transactions can be used to group multiple statements together.
|
|
11419
|
+
* If one statement fails, then none of the statements will have any effect.
|
|
11420
|
+
*
|
|
11421
|
+
* @param func The function that should be used to build the statements.
|
|
11422
|
+
* @param readonly Whether the statements are read-only. If true, then the statements cannot modify data. Defaults to true.
|
|
11423
|
+
*
|
|
11424
|
+
* @example Run multiple select queries at once
|
|
11425
|
+
* const results = await database.batch([
|
|
11426
|
+
* database.sql`SELECT * FROM items WHERE id = 'abc'`,
|
|
11427
|
+
* database.sql`SELECT * FROM items WHERE id = 'def'`,
|
|
11428
|
+
* database.sql`SELECT * FROM items WHERE id = 'ghi'`,
|
|
11429
|
+
* ]);
|
|
11430
|
+
*
|
|
11431
|
+
* @example Insert multiple items at once
|
|
11432
|
+
* const results = await database.batch([
|
|
11433
|
+
* database.sql`INSERT INTO items (name, value) VALUES ('Item 1', 100)`,
|
|
11434
|
+
* database.sql`INSERT INTO items (name, value) VALUES ('Item 2', 200)`,
|
|
11435
|
+
* database.sql`INSERT INTO items (name, value) VALUES ('Item 3', 300)`,
|
|
11436
|
+
* ], false);
|
|
11437
|
+
*/
|
|
11438
|
+
batch(
|
|
11439
|
+
statements: DatabaseStatement[],
|
|
11440
|
+
readonly?: boolean
|
|
11441
|
+
): Promise<GenericResult<BatchResult, SimpleError>>;
|
|
11442
|
+
|
|
11443
|
+
/**
|
|
11444
|
+
* Runs the given database statement.
|
|
11445
|
+
*
|
|
11446
|
+
* @param statement The statement to run.
|
|
11447
|
+
* @param readonly Whether the statement is read-only. If true, then the statement cannot modify data. Defaults to true.
|
|
11448
|
+
*/
|
|
11449
|
+
run(
|
|
11450
|
+
statement: DatabaseStatement,
|
|
11451
|
+
readonly?: boolean
|
|
11452
|
+
): Promise<GenericResult<ApiQueryResult, SimpleError>>;
|
|
11453
|
+
|
|
11454
|
+
/**
|
|
11455
|
+
* Gets an interface to the database that returns unmodified query results.
|
|
11456
|
+
*/
|
|
11457
|
+
get raw(): Omit<ApiDatabase, 'raw'>;
|
|
11458
|
+
}
|
|
11459
|
+
|
|
11161
11460
|
|
|
11162
11461
|
export type HandleWebhookResult = HandleWebhookSuccess | HandleWebhookFailure;
|
|
11163
11462
|
|
|
@@ -14453,6 +14752,39 @@ interface Os {
|
|
|
14453
14752
|
options?: RecordActionOptions
|
|
14454
14753
|
): Promise<RevokePermissionResult>;
|
|
14455
14754
|
|
|
14755
|
+
/**
|
|
14756
|
+
* Gets the list of permissions that have been assigned in the given record.
|
|
14757
|
+
*
|
|
14758
|
+
* @param request the request containing the record name and optional filters.
|
|
14759
|
+
* @param options the options for the operation.
|
|
14760
|
+
*
|
|
14761
|
+
* @example List all permissions in a record.
|
|
14762
|
+
* const result = await os.listPermissions({
|
|
14763
|
+
* recordName: 'myRecord'
|
|
14764
|
+
* });
|
|
14765
|
+
*
|
|
14766
|
+
* @example List permissions for a specific marker.
|
|
14767
|
+
* const result = await os.listPermissions({
|
|
14768
|
+
* recordName: 'myRecord',
|
|
14769
|
+
* marker: 'secret'
|
|
14770
|
+
* });
|
|
14771
|
+
*
|
|
14772
|
+
* @example List permissions for a specific resource.
|
|
14773
|
+
* const result = await os.listPermissions({
|
|
14774
|
+
* recordName: 'myRecord',
|
|
14775
|
+
* resourceKind: 'data',
|
|
14776
|
+
* resourceId: 'address'
|
|
14777
|
+
* });
|
|
14778
|
+
*
|
|
14779
|
+
* @dochash actions/os/records
|
|
14780
|
+
* @docgroup 01-records
|
|
14781
|
+
* @docid os.listPermissions
|
|
14782
|
+
* @docname os.listPermissions
|
|
14783
|
+
*/
|
|
14784
|
+
listPermissions(
|
|
14785
|
+
request: ListPermissionsRequest
|
|
14786
|
+
): Promise<ListPermissionsResult>;
|
|
14787
|
+
|
|
14456
14788
|
/**
|
|
14457
14789
|
* Grants the current inst admin permissions in the given record for the rest of the day.
|
|
14458
14790
|
* @param recordName The name of the record.
|
|
@@ -15603,6 +15935,158 @@ interface Os {
|
|
|
15603
15935
|
options?: RecordActionOptions
|
|
15604
15936
|
): Promise<EraseSearchDocumentResult>;
|
|
15605
15937
|
|
|
15938
|
+
/**
|
|
15939
|
+
* Creates or updates a database in the given record.
|
|
15940
|
+
*
|
|
15941
|
+
* Databases are used to store and manage structured data within a record.
|
|
15942
|
+
* They use the [SQL programming language](https://www.sqlite.org/lang.html), which is a powerful programming language designed to manage relational databases.
|
|
15943
|
+
*
|
|
15944
|
+
* Returns a promise that resolves with the result of the operation.
|
|
15945
|
+
*
|
|
15946
|
+
* @param request The request to create or update the database.
|
|
15947
|
+
* @param options the options for the request.
|
|
15948
|
+
* @returns A promise that resolves with the result of the operation.
|
|
15949
|
+
*
|
|
15950
|
+
* @example Record a database.
|
|
15951
|
+
* const result = await os.recordDatabase({
|
|
15952
|
+
* recordName: 'myRecord',
|
|
15953
|
+
* address: 'myDatabase',
|
|
15954
|
+
* });
|
|
15955
|
+
*
|
|
15956
|
+
* @example Record a private database
|
|
15957
|
+
* const result = await os.recordDatabase({
|
|
15958
|
+
* recordName: 'myRecord',
|
|
15959
|
+
* address: 'myDatabase',
|
|
15960
|
+
* markers: ['private']
|
|
15961
|
+
* });
|
|
15962
|
+
*
|
|
15963
|
+
*
|
|
15964
|
+
* @doctitle Database Actions
|
|
15965
|
+
* @docsidebar Database
|
|
15966
|
+
* @docdescription Database actions allow you to create and manage databases in your records. Databases enable efficient storage and retrieval of structured data within your records, making it easier to manage and query information.
|
|
15967
|
+
* @dochash actions/os/records/database
|
|
15968
|
+
* @docgroup 02-database
|
|
15969
|
+
* @docname os.recordDatabase
|
|
15970
|
+
* @docid recordDatabase
|
|
15971
|
+
*/
|
|
15972
|
+
recordDatabase(
|
|
15973
|
+
request: RecordSearchCollectionApiRequest,
|
|
15974
|
+
options?: RecordActionOptions
|
|
15975
|
+
): Promise<CrudRecordItemResult>;
|
|
15976
|
+
|
|
15977
|
+
/**
|
|
15978
|
+
* Deletes a database along with all the data in it.
|
|
15979
|
+
*
|
|
15980
|
+
* Returns a promise that resolves with the result of the operation.
|
|
15981
|
+
*
|
|
15982
|
+
* @param recordName The name of the record to delete the database from.
|
|
15983
|
+
* @param address The address of the database to delete.
|
|
15984
|
+
* @param options the options for the request.
|
|
15985
|
+
* @returns A promise that resolves with the result of the operation.
|
|
15986
|
+
*
|
|
15987
|
+
* @example Erase a database
|
|
15988
|
+
* const result = await os.eraseDatabase('recordName', 'myDatabase');
|
|
15989
|
+
*
|
|
15990
|
+
* @dochash actions/os/records/database
|
|
15991
|
+
* @docgroup 02-database
|
|
15992
|
+
* @docname os.eraseDatabase
|
|
15993
|
+
* @docid eraseDatabase
|
|
15994
|
+
*/
|
|
15995
|
+
eraseDatabase(
|
|
15996
|
+
recordName: string,
|
|
15997
|
+
address: string,
|
|
15998
|
+
options?: RecordActionOptions
|
|
15999
|
+
): Promise<CrudRecordItemResult>;
|
|
16000
|
+
|
|
16001
|
+
/**
|
|
16002
|
+
* Lists the databases in a record.
|
|
16003
|
+
*
|
|
16004
|
+
* Returns a promise that resolves with the result of the operation.
|
|
16005
|
+
*
|
|
16006
|
+
* @param recordName The name of the record to delete the search collection from.
|
|
16007
|
+
* @param startingAddress the address that the listing should start after.
|
|
16008
|
+
* @param options the options for the request.
|
|
16009
|
+
* @returns A promise that resolves with the result of the operation.
|
|
16010
|
+
*
|
|
16011
|
+
* @example List databases
|
|
16012
|
+
* const result = await os.listDatabases('recordName', 'myDatabase');
|
|
16013
|
+
*
|
|
16014
|
+
* @dochash actions/os/records/database
|
|
16015
|
+
* @docgroup 02-database
|
|
16016
|
+
* @docname os.listDatabases
|
|
16017
|
+
* @docid listDatabases
|
|
16018
|
+
*/
|
|
16019
|
+
listDatabases(
|
|
16020
|
+
recordName: string,
|
|
16021
|
+
startingAddress?: string,
|
|
16022
|
+
options?: ListDataOptions
|
|
16023
|
+
): Promise<CrudListItemsResult<DatabaseRecord>>;
|
|
16024
|
+
|
|
16025
|
+
/**
|
|
16026
|
+
* Lists the databases in a record by a specific marker.
|
|
16027
|
+
* @param recordName The name of the record to list the databases from.
|
|
16028
|
+
* @param marker The marker to filter the list by.
|
|
16029
|
+
* @param startingAddress The address that the listing should start after.
|
|
16030
|
+
* @param options The options for the request.
|
|
16031
|
+
* @returns A promise that resolves with the result of the operation.
|
|
16032
|
+
*
|
|
16033
|
+
* @example List public read databases
|
|
16034
|
+
* const result = await os.listDatabasesByMarker('recordName', 'publicRead');
|
|
16035
|
+
*
|
|
16036
|
+
* @example List private databases
|
|
16037
|
+
* const result = await os.listDatabasesByMarker('recordName', 'private');
|
|
16038
|
+
*
|
|
16039
|
+
* @dochash actions/os/records/database
|
|
16040
|
+
* @docgroup 02-database
|
|
16041
|
+
* @docname os.listDatabasesByMarker
|
|
16042
|
+
*/
|
|
16043
|
+
listDatabasesByMarker(
|
|
16044
|
+
recordName: string,
|
|
16045
|
+
marker: string,
|
|
16046
|
+
startingAddress?: string,
|
|
16047
|
+
options?: ListDataOptions
|
|
16048
|
+
): Promise<CrudListItemsResult<DatabaseRecord>>;
|
|
16049
|
+
|
|
16050
|
+
/**
|
|
16051
|
+
* Gets basic info about a database from the specified record.
|
|
16052
|
+
*
|
|
16053
|
+
* @param recordName The name of the record to retrieve the database from.
|
|
16054
|
+
* @param address The address of the database to retrieve.
|
|
16055
|
+
* @param options The options for the request.
|
|
16056
|
+
*
|
|
16057
|
+
* @returns A promise that resolves with the result of the operation.
|
|
16058
|
+
*
|
|
16059
|
+
* @example Get a database and query a table
|
|
16060
|
+
* const db = os.getDatabase('myRecord', 'myDatabase');
|
|
16061
|
+
* const result = await db.query`SELECT * FROM myTable`;
|
|
16062
|
+
*
|
|
16063
|
+
* @example Insert a new row
|
|
16064
|
+
* const value1 = 'abc';
|
|
16065
|
+
* const value2 = 123;
|
|
16066
|
+
* const result = await db.execute`INSERT INTO myTable (column1, column2) VALUES (${value1}, ${value2})`;
|
|
16067
|
+
*
|
|
16068
|
+
* @example Run multiple queries in a transaction
|
|
16069
|
+
* const values = [
|
|
16070
|
+
* ['apple', 10],
|
|
16071
|
+
* ['car', 25000],
|
|
16072
|
+
* ['strawberry', 1],
|
|
16073
|
+
* ['lego', 5]
|
|
16074
|
+
* ];
|
|
16075
|
+
*
|
|
16076
|
+
* const result = await db.batch(
|
|
16077
|
+
* values.map(([name, value]) => db.sql`INSERT INTO data (name, value) VALUES (${name}, ${value})`)
|
|
16078
|
+
* );
|
|
16079
|
+
*
|
|
16080
|
+
* @dochash actions/os/records/database
|
|
16081
|
+
* @docgroup 02-database
|
|
16082
|
+
* @docname os.getDatabase
|
|
16083
|
+
*/
|
|
16084
|
+
getDatabase(
|
|
16085
|
+
recordName: string,
|
|
16086
|
+
address: string,
|
|
16087
|
+
options?: RecordActionOptions
|
|
16088
|
+
): ApiDatabase;
|
|
16089
|
+
|
|
15606
16090
|
/**
|
|
15607
16091
|
* Gets the list of studios that the currently logged in user has access to.
|
|
15608
16092
|
*
|
|
@@ -16823,6 +17307,27 @@ interface Experiment {
|
|
|
16823
17307
|
* Returns a promise that resolves with the voices.
|
|
16824
17308
|
*/
|
|
16825
17309
|
getVoices(): Promise<SyntheticVoice[]>;
|
|
17310
|
+
|
|
17311
|
+
/**
|
|
17312
|
+
* Adds a map overlay to the given bot's map form.
|
|
17313
|
+
* @param bot The bot that the overlay should be added to.
|
|
17314
|
+
* @param overlayLayer Configuration for the overlay layer to add.
|
|
17315
|
+
*/
|
|
17316
|
+
addBotMapLayer(
|
|
17317
|
+
bot: Bot,
|
|
17318
|
+
overlay: {
|
|
17319
|
+
overlayType: 'geojson';
|
|
17320
|
+
data: any;
|
|
17321
|
+
overlayId?: string;
|
|
17322
|
+
}
|
|
17323
|
+
): Promise<{ success: boolean, data?: { overlayId: string }, message?: string }>;
|
|
17324
|
+
|
|
17325
|
+
/**
|
|
17326
|
+
* Removes a map overlay from the given bot's map form.
|
|
17327
|
+
* @param bot The bot that the overlay should be removed from.
|
|
17328
|
+
* @param overlayId Id of the overlay to remove.
|
|
17329
|
+
*/
|
|
17330
|
+
removeBotMapLayer(bot: Bot, overlayId: string): Promise<{ success: boolean, data?: { overlayId: string }, message?: string }>;
|
|
16826
17331
|
};
|
|
16827
17332
|
|
|
16828
17333
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AIChatMessage, RecordFileFailure, WebhookRecord, NotificationRecord, PushNotificationPayload, GrantEntitlementFailure } from '@casual-simulation/aux-records';
|
|
2
2
|
import type { RecordsClientActions } from '@casual-simulation/aux-records/RecordsClient';
|
|
3
|
-
import type { APPROVED_SYMBOL, AsyncAction, AvailablePermissions, Entitlement, EntitlementFeature, GrantedEntitlementScope, KnownErrorCodes, PublicRecordKeyPolicy, StoredAux } from '@casual-simulation/aux-common';
|
|
3
|
+
import type { APPROVED_SYMBOL, AsyncAction, AvailablePermissions, Entitlement, EntitlementFeature, GrantedEntitlementScope, KnownErrorCodes, PublicRecordKeyPolicy, ResourceKinds, StoredAux } from '@casual-simulation/aux-common';
|
|
4
4
|
import type { CreateRealtimeSessionTokenRequest } from '@casual-simulation/aux-records/AIOpenAIRealtimeInterface';
|
|
5
5
|
import type { PackageRecordVersionKey, PackageRecordVersionKeySpecifier, PackageRecordVersionWithMetadata } from '@casual-simulation/aux-records/packages/version';
|
|
6
6
|
export type RecordsActions = RecordsAsyncActions;
|
|
@@ -1175,6 +1175,36 @@ export declare function grantRecordPermission(recordName: string, permission: Av
|
|
|
1175
1175
|
* @param taskId The ID of the task.
|
|
1176
1176
|
*/
|
|
1177
1177
|
export declare function revokeRecordPermission(recordName: string, permissionId: string, options: RecordActionOptions, taskId: number | string): RevokeRecordPermissionAction;
|
|
1178
|
+
/**
|
|
1179
|
+
* Represents a request to list permissions for a record.
|
|
1180
|
+
*
|
|
1181
|
+
* @dochash types/permissions
|
|
1182
|
+
* @docname ListPermissionsRequest
|
|
1183
|
+
*/
|
|
1184
|
+
export interface ListPermissionsRequest extends RecordActionOptions {
|
|
1185
|
+
/**
|
|
1186
|
+
* The name of the record to list permissions for.
|
|
1187
|
+
*/
|
|
1188
|
+
recordName: string;
|
|
1189
|
+
/**
|
|
1190
|
+
* The marker to list permissions for.
|
|
1191
|
+
*/
|
|
1192
|
+
marker?: string;
|
|
1193
|
+
/**
|
|
1194
|
+
* The kind of resource to list permissions for.
|
|
1195
|
+
*/
|
|
1196
|
+
resourceKind?: ResourceKinds;
|
|
1197
|
+
/**
|
|
1198
|
+
* The ID of the resource to list permissions for.
|
|
1199
|
+
*/
|
|
1200
|
+
resourceId?: string;
|
|
1201
|
+
}
|
|
1202
|
+
/**
|
|
1203
|
+
* Creates a RecordsCallProcedureAction to list permissions for a record.
|
|
1204
|
+
* @param request The request options.
|
|
1205
|
+
* @param taskId The ID of the task.
|
|
1206
|
+
*/
|
|
1207
|
+
export declare function listPermissions(request: ListPermissionsRequest, taskId: number | string): RecordsCallProcedureAction;
|
|
1178
1208
|
/**
|
|
1179
1209
|
* Creates a GrantRoleAction for a user.
|
|
1180
1210
|
* @param recordName The name of the record.
|
|
@@ -1476,6 +1506,13 @@ export declare function listInstalledPackages(options: RecordActionOptions, task
|
|
|
1476
1506
|
* @param taskId The ID of the task.
|
|
1477
1507
|
*/
|
|
1478
1508
|
export declare function listUserStudios(options: RecordActionOptions, taskId?: number | string): ListUserStudiosAction;
|
|
1509
|
+
/**
|
|
1510
|
+
* Creates a RecordsCallProcedureAction to list the records in a studio.
|
|
1511
|
+
* @param studioId The ID of the studio.
|
|
1512
|
+
* @param options The options that should be used for the action.
|
|
1513
|
+
* @param taskId The ID of the task.
|
|
1514
|
+
*/
|
|
1515
|
+
export declare function listStudioRecords(studioId: string, options: RecordActionOptions, taskId?: number | string): RecordsCallProcedureAction;
|
|
1479
1516
|
/**
|
|
1480
1517
|
* Creates a new JoinRoomAction.
|
|
1481
1518
|
* @param roomName The name of the room.
|
|
@@ -1518,6 +1555,23 @@ export declare function getRoomTrackOptions(roomName: string, address: string, t
|
|
|
1518
1555
|
* @param taskId The ID of the task.
|
|
1519
1556
|
*/
|
|
1520
1557
|
export declare function setRoomTrackOptions(roomName: string, address: string, options: SetRoomTrackOptions, taskId?: number | string): SetRoomTrackOptionsAction;
|
|
1558
|
+
/**
|
|
1559
|
+
* Creates an action that is able to list the insts in a record.
|
|
1560
|
+
* @param recordName The name of the record.
|
|
1561
|
+
* @param startingInst The inst that the list should start with.
|
|
1562
|
+
* @param options The options.
|
|
1563
|
+
* @param taskId The ID of the async task.
|
|
1564
|
+
*/
|
|
1565
|
+
export declare function listInsts(recordName: string, startingInst?: string | null, options?: RecordActionOptions, taskId?: number | string): RecordsCallProcedureAction;
|
|
1566
|
+
/**
|
|
1567
|
+
* Creates an action that is able to list the insts in a record with the given marker.
|
|
1568
|
+
* @param recordName The name of the record.
|
|
1569
|
+
* @param marker The marker.
|
|
1570
|
+
* @param startingInst The inst that the list should start with.
|
|
1571
|
+
* @param options The options.
|
|
1572
|
+
* @param taskId The ID of the async task.
|
|
1573
|
+
*/
|
|
1574
|
+
export declare function listInstsByMarker(recordName: string, marker: string, startingInst?: string | null, options?: RecordActionOptions, taskId?: number | string): RecordsCallProcedureAction;
|
|
1521
1575
|
/**
|
|
1522
1576
|
* Creates a new GetRoomRemoteOptionsAction.
|
|
1523
1577
|
* @param roomName The name of the room.
|
package/runtime/RecordsEvents.js
CHANGED
|
@@ -153,6 +153,23 @@ export function revokeRecordPermission(recordName, permissionId, options, taskId
|
|
|
153
153
|
taskId,
|
|
154
154
|
};
|
|
155
155
|
}
|
|
156
|
+
/**
|
|
157
|
+
* Creates a RecordsCallProcedureAction to list permissions for a record.
|
|
158
|
+
* @param request The request options.
|
|
159
|
+
* @param taskId The ID of the task.
|
|
160
|
+
*/
|
|
161
|
+
export function listPermissions(request, taskId) {
|
|
162
|
+
return recordsCallProcedure({
|
|
163
|
+
listPermissions: {
|
|
164
|
+
input: {
|
|
165
|
+
recordName: request.recordName,
|
|
166
|
+
marker: request.marker,
|
|
167
|
+
resourceKind: request.resourceKind,
|
|
168
|
+
resourceId: request.resourceId,
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
}, request, taskId);
|
|
172
|
+
}
|
|
156
173
|
/**
|
|
157
174
|
* Creates a GrantRoleAction for a user.
|
|
158
175
|
* @param recordName The name of the record.
|
|
@@ -883,6 +900,21 @@ export function listUserStudios(options, taskId) {
|
|
|
883
900
|
taskId,
|
|
884
901
|
};
|
|
885
902
|
}
|
|
903
|
+
/**
|
|
904
|
+
* Creates a RecordsCallProcedureAction to list the records in a studio.
|
|
905
|
+
* @param studioId The ID of the studio.
|
|
906
|
+
* @param options The options that should be used for the action.
|
|
907
|
+
* @param taskId The ID of the task.
|
|
908
|
+
*/
|
|
909
|
+
export function listStudioRecords(studioId, options, taskId) {
|
|
910
|
+
return recordsCallProcedure({
|
|
911
|
+
listRecords: {
|
|
912
|
+
input: {
|
|
913
|
+
studioId,
|
|
914
|
+
},
|
|
915
|
+
},
|
|
916
|
+
}, options, taskId);
|
|
917
|
+
}
|
|
886
918
|
/**
|
|
887
919
|
* Creates a new JoinRoomAction.
|
|
888
920
|
* @param roomName The name of the room.
|
|
@@ -967,6 +999,42 @@ export function setRoomTrackOptions(roomName, address, options, taskId) {
|
|
|
967
999
|
taskId,
|
|
968
1000
|
};
|
|
969
1001
|
}
|
|
1002
|
+
/**
|
|
1003
|
+
* Creates an action that is able to list the insts in a record.
|
|
1004
|
+
* @param recordName The name of the record.
|
|
1005
|
+
* @param startingInst The inst that the list should start with.
|
|
1006
|
+
* @param options The options.
|
|
1007
|
+
* @param taskId The ID of the async task.
|
|
1008
|
+
*/
|
|
1009
|
+
export function listInsts(recordName, startingInst, options = {}, taskId) {
|
|
1010
|
+
return recordsCallProcedure({
|
|
1011
|
+
listInsts: {
|
|
1012
|
+
input: {
|
|
1013
|
+
recordName,
|
|
1014
|
+
inst: startingInst,
|
|
1015
|
+
},
|
|
1016
|
+
},
|
|
1017
|
+
}, options, taskId);
|
|
1018
|
+
}
|
|
1019
|
+
/**
|
|
1020
|
+
* Creates an action that is able to list the insts in a record with the given marker.
|
|
1021
|
+
* @param recordName The name of the record.
|
|
1022
|
+
* @param marker The marker.
|
|
1023
|
+
* @param startingInst The inst that the list should start with.
|
|
1024
|
+
* @param options The options.
|
|
1025
|
+
* @param taskId The ID of the async task.
|
|
1026
|
+
*/
|
|
1027
|
+
export function listInstsByMarker(recordName, marker, startingInst, options = {}, taskId) {
|
|
1028
|
+
return recordsCallProcedure({
|
|
1029
|
+
listInsts: {
|
|
1030
|
+
input: {
|
|
1031
|
+
recordName,
|
|
1032
|
+
inst: startingInst,
|
|
1033
|
+
marker,
|
|
1034
|
+
},
|
|
1035
|
+
},
|
|
1036
|
+
}, options, taskId);
|
|
1037
|
+
}
|
|
970
1038
|
/**
|
|
971
1039
|
* Creates a new GetRoomRemoteOptionsAction.
|
|
972
1040
|
* @param roomName The name of the room.
|