@casual-simulation/aux-records 3.3.5 → 3.3.6-alpha.9504269855
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/LoomController.d.ts +69 -0
- package/LoomController.js +99 -0
- package/LoomController.js.map +1 -0
- package/MemoryStore.d.ts +4 -1
- package/MemoryStore.js +12 -0
- package/MemoryStore.js.map +1 -1
- package/PolicyController.js +1 -0
- package/PolicyController.js.map +1 -1
- package/RecordsController.d.ts +15 -2
- package/RecordsController.js +19 -2
- package/RecordsController.js.map +1 -1
- package/RecordsServer.d.ts +32 -2
- package/RecordsServer.js +34 -2
- package/RecordsServer.js.map +1 -1
- package/RecordsStore.d.ts +24 -0
- package/RecordsStore.js +7 -1
- package/RecordsStore.js.map +1 -1
- package/SubscriptionConfiguration.d.ts +170 -0
- package/SubscriptionConfiguration.js +22 -0
- package/SubscriptionConfiguration.js.map +1 -1
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/index.js.map +1 -1
- package/package.json +5 -4
package/RecordsServer.js
CHANGED
|
@@ -35,6 +35,7 @@ import { parseInstancesList, tryDecodeUriComponent, tryParseJson, } from './Util
|
|
|
35
35
|
import { INVALID_REQUEST_ERROR_MESSAGE, MAX_EMAIL_ADDRESS_LENGTH, MAX_SMS_ADDRESS_LENGTH, PRIVO_OPEN_ID_PROVIDER, } from './AuthController';
|
|
36
36
|
import { isSuperUserRole, parseSessionKey } from './AuthUtils';
|
|
37
37
|
import { z } from 'zod';
|
|
38
|
+
import { LOOM_CONFIG } from './RecordsStore';
|
|
38
39
|
import { AVAILABLE_PERMISSIONS_VALIDATION, RESOURCE_KIND_VALIDATION, getProcedureMetadata, procedure, } from '@casual-simulation/aux-common';
|
|
39
40
|
import { AI_CHAT_MESSAGE_SCHEMA } from './AIChatInterface';
|
|
40
41
|
import { WebsocketEventTypes, websocketEventSchema, websocketRequestMessageSchema, } from '@casual-simulation/aux-common/websockets/WebsocketEvents';
|
|
@@ -81,6 +82,11 @@ export const AI_NOT_SUPPORTED_RESULT = {
|
|
|
81
82
|
errorCode: 'not_supported',
|
|
82
83
|
errorMessage: 'AI features are not supported by this server.',
|
|
83
84
|
};
|
|
85
|
+
export const LOOM_NOT_SUPPORTED_RESULT = {
|
|
86
|
+
success: false,
|
|
87
|
+
errorCode: 'not_supported',
|
|
88
|
+
errorMessage: 'Loom features are not supported by this server.',
|
|
89
|
+
};
|
|
84
90
|
export const INSTS_NOT_SUPPORTED_RESULT = {
|
|
85
91
|
success: false,
|
|
86
92
|
errorCode: 'not_supported',
|
|
@@ -333,7 +339,7 @@ export class RecordsServer {
|
|
|
333
339
|
get procedures() {
|
|
334
340
|
return this._procedures;
|
|
335
341
|
}
|
|
336
|
-
constructor(allowedAccountOrigins, allowedApiOrigins, authController, livekitController, recordsController, eventsController, dataController, manualDataController, filesController, subscriptionController, rateLimitController, policyController, aiController, websocketController, moderationController, websocketRateLimitController = null) {
|
|
342
|
+
constructor(allowedAccountOrigins, allowedApiOrigins, authController, livekitController, recordsController, eventsController, dataController, manualDataController, filesController, subscriptionController, rateLimitController, policyController, aiController, websocketController, moderationController, loomController, websocketRateLimitController = null) {
|
|
337
343
|
/**
|
|
338
344
|
* The map of paths to routes that they match.
|
|
339
345
|
*/
|
|
@@ -355,6 +361,7 @@ export class RecordsServer {
|
|
|
355
361
|
this._aiController = aiController;
|
|
356
362
|
this._websocketController = websocketController;
|
|
357
363
|
this._moderationController = moderationController;
|
|
364
|
+
this._loomController = loomController;
|
|
358
365
|
this._procedures = this._createProcedures();
|
|
359
366
|
this._setupRoutes();
|
|
360
367
|
}
|
|
@@ -1576,6 +1583,29 @@ export class RecordsServer {
|
|
|
1576
1583
|
});
|
|
1577
1584
|
return result;
|
|
1578
1585
|
})),
|
|
1586
|
+
getLoomAccessToken: procedure()
|
|
1587
|
+
.origins('api')
|
|
1588
|
+
.http('GET', '/api/v2/loom/token')
|
|
1589
|
+
.inputs(z.object({
|
|
1590
|
+
recordName: RECORD_NAME_VALIDATION,
|
|
1591
|
+
}))
|
|
1592
|
+
.handler(({ recordName }, context) => __awaiter(this, void 0, void 0, function* () {
|
|
1593
|
+
if (!this._loomController) {
|
|
1594
|
+
return LOOM_NOT_SUPPORTED_RESULT;
|
|
1595
|
+
}
|
|
1596
|
+
const sessionKeyValidation = yield this._validateSessionKey(context.sessionKey);
|
|
1597
|
+
if (sessionKeyValidation.success === false) {
|
|
1598
|
+
if (sessionKeyValidation.errorCode === 'no_session_key') {
|
|
1599
|
+
return NOT_LOGGED_IN_RESULT;
|
|
1600
|
+
}
|
|
1601
|
+
return sessionKeyValidation;
|
|
1602
|
+
}
|
|
1603
|
+
const result = yield this._loomController.getToken({
|
|
1604
|
+
userId: sessionKeyValidation.userId,
|
|
1605
|
+
recordName: recordName,
|
|
1606
|
+
});
|
|
1607
|
+
return result;
|
|
1608
|
+
})),
|
|
1579
1609
|
getStudio: procedure()
|
|
1580
1610
|
.origins('account')
|
|
1581
1611
|
.http('GET', '/api/v2/studios')
|
|
@@ -1642,8 +1672,9 @@ export class RecordsServer {
|
|
|
1642
1672
|
.optional(),
|
|
1643
1673
|
comIdConfig: COM_ID_CONFIG_SCHEMA.optional(),
|
|
1644
1674
|
playerConfig: COM_ID_PLAYER_CONFIG.optional(),
|
|
1675
|
+
loomConfig: LOOM_CONFIG.optional(),
|
|
1645
1676
|
}))
|
|
1646
|
-
.handler(({ id, displayName, logoUrl, comIdConfig, playerConfig }, context) => __awaiter(this, void 0, void 0, function* () {
|
|
1677
|
+
.handler(({ id, displayName, logoUrl, comIdConfig, playerConfig, loomConfig, }, context) => __awaiter(this, void 0, void 0, function* () {
|
|
1647
1678
|
const sessionKeyValidation = yield this._validateSessionKey(context.sessionKey);
|
|
1648
1679
|
if (sessionKeyValidation.success === false) {
|
|
1649
1680
|
if (sessionKeyValidation.errorCode ===
|
|
@@ -1660,6 +1691,7 @@ export class RecordsServer {
|
|
|
1660
1691
|
logoUrl,
|
|
1661
1692
|
comIdConfig,
|
|
1662
1693
|
playerConfig,
|
|
1694
|
+
loomConfig,
|
|
1663
1695
|
},
|
|
1664
1696
|
});
|
|
1665
1697
|
return result;
|