@casual-simulation/aux-records 3.8.1 → 3.10.2
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/AIChatInterface.d.ts +7 -43
- package/AIChatInterface.js +8 -6
- package/AIChatInterface.js.map +1 -1
- package/AIController.js +44 -49
- package/AIController.js.map +1 -1
- package/AIOpenAIRealtimeInterface.d.ts +1 -1
- package/AnthropicAIChatInterface.js +4 -4
- package/AnthropicAIChatInterface.js.map +1 -1
- package/AuthController.d.ts +78 -10
- package/AuthController.js +230 -166
- package/AuthController.js.map +1 -1
- package/AuthStore.d.ts +317 -4
- package/BigIntPatch.d.ts +1 -0
- package/BigIntPatch.js +24 -0
- package/BigIntPatch.js.map +1 -0
- package/BlockadeLabsGenerateSkyboxInterface.js +4 -4
- package/BlockadeLabsGenerateSkyboxInterface.js.map +1 -1
- package/CachingConfigStore.d.ts +8 -1
- package/CachingConfigStore.js +50 -0
- package/CachingConfigStore.js.map +1 -1
- package/ComIdConfig.d.ts +132 -86
- package/ComIdConfig.js +5 -5
- package/ComIdConfig.js.map +1 -1
- package/ConfigurationStore.d.ts +1393 -3
- package/ConfigurationStore.js +49 -0
- package/ConfigurationStore.js.map +1 -1
- package/DataRecordsController.js +28 -28
- package/DataRecordsController.js.map +1 -1
- package/EventRecordsController.js +9 -9
- package/EventRecordsController.js.map +1 -1
- package/FileRecordsController.js +18 -17
- package/FileRecordsController.js.map +1 -1
- package/GoogleAIChatInterface.js +4 -4
- package/GoogleAIChatInterface.js.map +1 -1
- package/HttpTestUtils.d.ts +48 -0
- package/HttpTestUtils.js +256 -0
- package/HttpTestUtils.js.map +1 -0
- package/LivekitController.js +2 -2
- package/LivekitController.js.map +1 -1
- package/LoomController.js +3 -4
- package/LoomController.js.map +1 -1
- package/MemoryStore.d.ts +60 -7
- package/MemoryStore.js +427 -59
- package/MemoryStore.js.map +1 -1
- package/MetricsStore.d.ts +11 -0
- package/ModerationConfiguration.d.ts +11 -85
- package/ModerationConfiguration.js +17 -17
- package/ModerationConfiguration.js.map +1 -1
- package/ModerationController.js +9 -11
- package/ModerationController.js.map +1 -1
- package/OpenAIChatInterface.js +8 -13
- package/OpenAIChatInterface.js.map +1 -1
- package/OpenAIImageInterface.js +4 -5
- package/OpenAIImageInterface.js.map +1 -1
- package/PolicyController.js +66 -73
- package/PolicyController.js.map +1 -1
- package/PolicyStore.d.ts +59 -33
- package/PolicyStore.js +35 -1
- package/PolicyStore.js.map +1 -1
- package/PrivoClient.d.ts +3 -1
- package/PrivoClient.js +2 -4
- package/PrivoClient.js.map +1 -1
- package/PrivoConfiguration.d.ts +6 -72
- package/PrivoConfiguration.js +30 -31
- package/PrivoConfiguration.js.map +1 -1
- package/README.md +276 -2
- package/RateLimitController.js +2 -2
- package/RateLimitController.js.map +1 -1
- package/RecordsClient.d.ts +3 -1
- package/RecordsClient.js +6 -6
- package/RecordsClient.js.map +1 -1
- package/RecordsController.d.ts +145 -3
- package/RecordsController.js +399 -61
- package/RecordsController.js.map +1 -1
- package/RecordsServer.d.ts +1932 -1109
- package/RecordsStore.d.ts +99 -14
- package/RecordsStore.js +8 -10
- package/RecordsStore.js.map +1 -1
- package/ServerConfig.d.ts +698 -9867
- package/ServerConfig.js +457 -377
- package/ServerConfig.js.map +1 -1
- package/SloydInterface.js +1 -1
- package/SloydInterface.js.map +1 -1
- package/StabilityAIImageInterface.js +6 -9
- package/StabilityAIImageInterface.js.map +1 -1
- package/StripeInterface.d.ts +431 -287
- package/StripeInterface.js +21 -1
- package/StripeInterface.js.map +1 -1
- package/SubscriptionConfigBuilder.d.ts +10 -1
- package/SubscriptionConfigBuilder.js +72 -41
- package/SubscriptionConfigBuilder.js.map +1 -1
- package/SubscriptionConfiguration.d.ts +606 -6334
- package/SubscriptionConfiguration.js +460 -277
- package/SubscriptionConfiguration.js.map +1 -1
- package/SubscriptionController.d.ts +677 -4
- package/SubscriptionController.js +2986 -186
- package/SubscriptionController.js.map +1 -1
- package/SystemNotificationMessenger.d.ts +14 -70
- package/SystemNotificationMessenger.js +17 -20
- package/SystemNotificationMessenger.js.map +1 -1
- package/TestUtils.d.ts +18 -3
- package/TestUtils.js +84 -8
- package/TestUtils.js.map +1 -1
- package/TypeUtils.d.ts +991 -0
- package/TypeUtils.js +2 -0
- package/TypeUtils.js.map +1 -0
- package/Utils.d.ts +59 -0
- package/Utils.js +507 -3
- package/Utils.js.map +1 -1
- package/Validations.d.ts +24 -108
- package/Validations.js +62 -45
- package/Validations.js.map +1 -1
- package/ViewTemplateRenderer.d.ts +39 -0
- package/ViewTemplateRenderer.js +19 -0
- package/ViewTemplateRenderer.js.map +1 -0
- package/contracts/ContractRecordsController.d.ts +58 -0
- package/contracts/ContractRecordsController.js +144 -0
- package/contracts/ContractRecordsController.js.map +1 -0
- package/contracts/ContractRecordsStore.d.ts +285 -0
- package/contracts/ContractRecordsStore.js +19 -0
- package/contracts/ContractRecordsStore.js.map +1 -0
- package/contracts/MemoryContractRecordsStore.d.ts +27 -0
- package/contracts/MemoryContractRecordsStore.js +124 -0
- package/contracts/MemoryContractRecordsStore.js.map +1 -0
- package/contracts/index.d.ts +4 -0
- package/contracts/index.js +21 -0
- package/contracts/index.js.map +1 -0
- package/crud/CrudHelpers.d.ts +25 -26
- package/crud/CrudHelpers.js +1 -1
- package/crud/CrudHelpers.js.map +1 -1
- package/crud/CrudRecordsController.js +13 -16
- package/crud/CrudRecordsController.js.map +1 -1
- package/crud/CrudRecordsControllerTests.d.ts +2 -2
- package/crud/CrudRecordsControllerTests.js +605 -580
- package/crud/CrudRecordsControllerTests.js.map +1 -1
- package/crud/MemoryCrudRecordsStore.js +1 -2
- package/crud/MemoryCrudRecordsStore.js.map +1 -1
- package/crud/sub/MemorySubCrudRecordsStore.js +4 -6
- package/crud/sub/MemorySubCrudRecordsStore.js.map +1 -1
- package/crud/sub/SubCrudRecordsController.js +8 -8
- package/crud/sub/SubCrudRecordsController.js.map +1 -1
- package/database/DatabaseRecordsController.js +1 -2
- package/database/DatabaseRecordsController.js.map +1 -1
- package/database/SqliteDatabaseInterface.js +1 -2
- package/database/SqliteDatabaseInterface.js.map +1 -1
- package/dns/DNSDomainNameValidator.d.ts +11 -0
- package/dns/DNSDomainNameValidator.js +59 -0
- package/dns/DNSDomainNameValidator.js.map +1 -0
- package/dns/DomainNameValidator.d.ts +36 -0
- package/dns/DomainNameValidator.js +19 -0
- package/dns/DomainNameValidator.js.map +1 -0
- package/dns/index.d.ts +3 -0
- package/dns/index.js +20 -0
- package/dns/index.js.map +1 -0
- package/financial/FinancialController.d.ts +272 -0
- package/financial/FinancialController.js +762 -0
- package/financial/FinancialController.js.map +1 -0
- package/financial/FinancialInterface.d.ts +352 -0
- package/financial/FinancialInterface.js +642 -0
- package/financial/FinancialInterface.js.map +1 -0
- package/financial/FinancialStore.d.ts +186 -0
- package/financial/FinancialStore.js +19 -0
- package/financial/FinancialStore.js.map +1 -0
- package/financial/MemoryFinancialInterface.d.ts +23 -0
- package/financial/MemoryFinancialInterface.js +592 -0
- package/financial/MemoryFinancialInterface.js.map +1 -0
- package/financial/TigerBeetleFinancialInterface.d.ts +46 -0
- package/financial/TigerBeetleFinancialInterface.js +109 -0
- package/financial/TigerBeetleFinancialInterface.js.map +1 -0
- package/financial/TigerBeetleTestUtils.d.ts +40 -0
- package/financial/TigerBeetleTestUtils.js +185 -0
- package/financial/TigerBeetleTestUtils.js.map +1 -0
- package/financial/Types.d.ts +1 -0
- package/financial/Types.js +801 -0
- package/financial/Types.js.map +1 -0
- package/financial/index.d.ts +6 -0
- package/financial/index.js +24 -0
- package/financial/index.js.map +1 -0
- package/index.d.ts +4 -0
- package/index.js +3 -0
- package/index.js.map +1 -1
- package/notifications/NotificationRecordsController.js +14 -14
- package/notifications/NotificationRecordsController.js.map +1 -1
- package/notifications/WebPushInterface.d.ts +24 -155
- package/notifications/WebPushInterface.js +2 -2
- package/notifications/WebPushInterface.js.map +1 -1
- package/package.json +72 -70
- package/packages/version/MemoryPackageVersionRecordsStore.js +12 -15
- package/packages/version/MemoryPackageVersionRecordsStore.js.map +1 -1
- package/packages/version/PackageVersionRecordsController.d.ts +19 -0
- package/packages/version/PackageVersionRecordsController.js +102 -22
- package/packages/version/PackageVersionRecordsController.js.map +1 -1
- package/packages/version/PackageVersionRecordsStore.js +6 -8
- package/packages/version/PackageVersionRecordsStore.js.map +1 -1
- package/purchasable-items/MemoryPurchasableItemRecordsStore.d.ts +7 -0
- package/purchasable-items/MemoryPurchasableItemRecordsStore.js +33 -0
- package/purchasable-items/MemoryPurchasableItemRecordsStore.js.map +1 -0
- package/purchasable-items/PurchasableItemRecordsController.d.ts +16 -0
- package/purchasable-items/PurchasableItemRecordsController.js +72 -0
- package/purchasable-items/PurchasableItemRecordsController.js.map +1 -0
- package/purchasable-items/PurchasableItemRecordsStore.d.ts +66 -0
- package/purchasable-items/PurchasableItemRecordsStore.js +2 -0
- package/purchasable-items/PurchasableItemRecordsStore.js.map +1 -0
- package/purchasable-items/index.d.ts +4 -0
- package/purchasable-items/index.js +21 -0
- package/purchasable-items/index.js.map +1 -0
- package/queue/MemoryQueue.js +1 -1
- package/queue/MemoryQueue.js.map +1 -1
- package/search/MemorySearchInterface.js +1 -2
- package/search/MemorySearchInterface.js.map +1 -1
- package/search/SearchRecordsController.d.ts +66 -244
- package/search/SearchRecordsController.js +35 -36
- package/search/SearchRecordsController.js.map +1 -1
- package/search/SearchSyncProcessor.d.ts +7 -83
- package/search/TypesenseSearchInterface.js +8 -11
- package/search/TypesenseSearchInterface.js.map +1 -1
- package/tracing/TracingDecorators.js +5 -8
- package/tracing/TracingDecorators.js.map +1 -1
- package/webhooks/WebhookEnvironment.d.ts +36 -560
- package/webhooks/WebhookEnvironment.js +1 -1
- package/webhooks/WebhookEnvironment.js.map +1 -1
- package/webhooks/WebhookRecordsController.js +14 -16
- package/webhooks/WebhookRecordsController.js.map +1 -1
- package/websockets/MemoryLockStore.d.ts +18 -0
- package/websockets/MemoryLockStore.js +2 -0
- package/websockets/MemoryLockStore.js.map +1 -0
- package/websockets/MemoryTempInstRecordsStore.js +15 -27
- package/websockets/MemoryTempInstRecordsStore.js.map +1 -1
- package/websockets/MemoryWebsocketConnectionStore.js +6 -8
- package/websockets/MemoryWebsocketConnectionStore.js.map +1 -1
- package/websockets/MemoryWebsocketMessenger.js +1 -2
- package/websockets/MemoryWebsocketMessenger.js.map +1 -1
- package/websockets/SplitInstRecordsStore.js +2 -2
- package/websockets/SplitInstRecordsStore.js.map +1 -1
- package/websockets/WebsocketController.d.ts +5 -0
- package/websockets/WebsocketController.js +122 -83
- package/websockets/WebsocketController.js.map +1 -1
- package/RecordsServer.js +0 -6435
- package/RecordsServer.js.map +0 -1
package/RecordsController.js
CHANGED
|
@@ -7,13 +7,16 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
import { hashHighEntropyPasswordWithSalt, hashLowEntropyPasswordWithSalt, } from './InstrumentedHashHelpers';
|
|
8
8
|
import { randomBytes } from 'tweetnacl';
|
|
9
9
|
import { fromByteArray } from 'base64-js';
|
|
10
|
-
import { v4 as uuid } from 'uuid';
|
|
11
|
-
import {
|
|
10
|
+
import { v4 as uuid, v7 as uuidv7 } from 'uuid';
|
|
11
|
+
import { AB1_BOOTSTRAP_KEY, } from './ConfigurationStore';
|
|
12
|
+
import { getComIdFeatures, getHumeAiFeatures, getLoomFeatures, getPurchasableItemsFeatures, getSubscriptionFeatures, getSubscriptionTier, storeFeaturesSchema, } from './SubscriptionConfiguration';
|
|
12
13
|
import { isActiveSubscription } from './Utils';
|
|
13
|
-
import { isSuperUserRole } from '@casual-simulation/aux-common';
|
|
14
|
+
import { failure, isFailure, isSuperUserRole, success, tryParseJson, } from '@casual-simulation/aux-common';
|
|
14
15
|
import { traced } from './tracing/TracingDecorators';
|
|
15
16
|
import { SpanStatusCode, trace } from '@opentelemetry/api';
|
|
16
17
|
import { DEFAULT_RECORD_KEY_POLICY, formatV2RecordKey, parseRecordKey, } from '@casual-simulation/aux-common/records/RecordKeys';
|
|
18
|
+
import axios from 'axios';
|
|
19
|
+
import { STORED_AUX_SCHEMA } from './webhooks';
|
|
17
20
|
const TRACE_NAME = 'RecordsController';
|
|
18
21
|
/**
|
|
19
22
|
* Defines a class that manages records and their keys.
|
|
@@ -26,6 +29,7 @@ export class RecordsController {
|
|
|
26
29
|
this._config = config.config;
|
|
27
30
|
this._messenger = config.messenger;
|
|
28
31
|
this._privo = config.privo;
|
|
32
|
+
this._domainNameValidator = config.domainNameValidator;
|
|
29
33
|
}
|
|
30
34
|
/**
|
|
31
35
|
* Creates a new record.
|
|
@@ -167,8 +171,8 @@ export class RecordsController {
|
|
|
167
171
|
}
|
|
168
172
|
catch (err) {
|
|
169
173
|
const span = trace.getActiveSpan();
|
|
170
|
-
span
|
|
171
|
-
span
|
|
174
|
+
span?.recordException(err);
|
|
175
|
+
span?.setStatus({ code: SpanStatusCode.ERROR });
|
|
172
176
|
console.error('[RecordsController] [createRecord] An error occurred while creating a record:', err);
|
|
173
177
|
return {
|
|
174
178
|
success: false,
|
|
@@ -185,7 +189,6 @@ export class RecordsController {
|
|
|
185
189
|
* @returns
|
|
186
190
|
*/
|
|
187
191
|
async createPublicRecordKey(name, policy, userId) {
|
|
188
|
-
var _a;
|
|
189
192
|
try {
|
|
190
193
|
if (!userId) {
|
|
191
194
|
return {
|
|
@@ -290,8 +293,8 @@ export class RecordsController {
|
|
|
290
293
|
await this._store.addRecordKey({
|
|
291
294
|
recordName: name,
|
|
292
295
|
secretHash: passwordHash,
|
|
293
|
-
policy: policy
|
|
294
|
-
creatorId:
|
|
296
|
+
policy: policy ?? DEFAULT_RECORD_KEY_POLICY,
|
|
297
|
+
creatorId: record.ownerId ?? userId,
|
|
295
298
|
});
|
|
296
299
|
return {
|
|
297
300
|
success: true,
|
|
@@ -301,8 +304,8 @@ export class RecordsController {
|
|
|
301
304
|
}
|
|
302
305
|
catch (err) {
|
|
303
306
|
const span = trace.getActiveSpan();
|
|
304
|
-
span
|
|
305
|
-
span
|
|
307
|
+
span?.recordException(err);
|
|
308
|
+
span?.setStatus({ code: SpanStatusCode.ERROR });
|
|
306
309
|
console.error('[RecordsController] [createPublicRecordKey] An error occurred while creating a public record key:', err);
|
|
307
310
|
return {
|
|
308
311
|
success: false,
|
|
@@ -404,7 +407,7 @@ export class RecordsController {
|
|
|
404
407
|
recordName: name,
|
|
405
408
|
policy: policy,
|
|
406
409
|
ownerId: record.ownerId,
|
|
407
|
-
keyCreatorId: creatorId
|
|
410
|
+
keyCreatorId: creatorId ?? record.ownerId,
|
|
408
411
|
};
|
|
409
412
|
}
|
|
410
413
|
else {
|
|
@@ -417,8 +420,8 @@ export class RecordsController {
|
|
|
417
420
|
}
|
|
418
421
|
catch (err) {
|
|
419
422
|
const span = trace.getActiveSpan();
|
|
420
|
-
span
|
|
421
|
-
span
|
|
423
|
+
span?.recordException(err);
|
|
424
|
+
span?.setStatus({ code: SpanStatusCode.ERROR });
|
|
422
425
|
console.error('[RecordsController] [validatePublicRecordKey] An error occurred while creating a public record key:', err);
|
|
423
426
|
return {
|
|
424
427
|
success: false,
|
|
@@ -544,8 +547,8 @@ export class RecordsController {
|
|
|
544
547
|
}
|
|
545
548
|
catch (err) {
|
|
546
549
|
const span = trace.getActiveSpan();
|
|
547
|
-
span
|
|
548
|
-
span
|
|
550
|
+
span?.recordException(err);
|
|
551
|
+
span?.setStatus({ code: SpanStatusCode.ERROR });
|
|
549
552
|
console.error('[RecordsController] [validateRecordName] An error occurred while creating a validating a record name:', err);
|
|
550
553
|
return {
|
|
551
554
|
success: false,
|
|
@@ -555,16 +558,15 @@ export class RecordsController {
|
|
|
555
558
|
}
|
|
556
559
|
}
|
|
557
560
|
async _doesSubscriptionAllowToCreateRecord(filter) {
|
|
558
|
-
var _a, _b;
|
|
559
561
|
const { features, metrics } = await this._getSubscriptionFeatures(filter);
|
|
560
|
-
if (!
|
|
562
|
+
if (!features.records?.allowed) {
|
|
561
563
|
return {
|
|
562
564
|
success: false,
|
|
563
565
|
errorCode: 'not_authorized',
|
|
564
566
|
errorMessage: 'Records are not allowed for this subscription.',
|
|
565
567
|
};
|
|
566
568
|
}
|
|
567
|
-
else if (
|
|
569
|
+
else if (features.records?.maxRecords >= 0) {
|
|
568
570
|
if (features.records.maxRecords <= metrics.totalRecords + 1) {
|
|
569
571
|
return {
|
|
570
572
|
success: false,
|
|
@@ -607,8 +609,8 @@ export class RecordsController {
|
|
|
607
609
|
}
|
|
608
610
|
catch (err) {
|
|
609
611
|
const span = trace.getActiveSpan();
|
|
610
|
-
span
|
|
611
|
-
span
|
|
612
|
+
span?.recordException(err);
|
|
613
|
+
span?.setStatus({ code: SpanStatusCode.ERROR });
|
|
612
614
|
console.error('[RecordsController] [listRecords] Error listing records: ', err);
|
|
613
615
|
return {
|
|
614
616
|
success: false,
|
|
@@ -632,7 +634,7 @@ export class RecordsController {
|
|
|
632
634
|
};
|
|
633
635
|
}
|
|
634
636
|
const user = await this._auth.findUser(userId);
|
|
635
|
-
if (isSuperUserRole(user
|
|
637
|
+
if (isSuperUserRole(user?.role)) {
|
|
636
638
|
const records = await this._store.listRecordsByStudioId(studioId);
|
|
637
639
|
return {
|
|
638
640
|
success: true,
|
|
@@ -647,8 +649,8 @@ export class RecordsController {
|
|
|
647
649
|
}
|
|
648
650
|
catch (err) {
|
|
649
651
|
const span = trace.getActiveSpan();
|
|
650
|
-
span
|
|
651
|
-
span
|
|
652
|
+
span?.recordException(err);
|
|
653
|
+
span?.setStatus({ code: SpanStatusCode.ERROR });
|
|
652
654
|
console.error('[RecordsController] [listStudioRecords] Error listing records: ', err);
|
|
653
655
|
return {
|
|
654
656
|
success: false,
|
|
@@ -676,8 +678,8 @@ export class RecordsController {
|
|
|
676
678
|
}
|
|
677
679
|
catch (err) {
|
|
678
680
|
const span = trace.getActiveSpan();
|
|
679
|
-
span
|
|
680
|
-
span
|
|
681
|
+
span?.recordException(err);
|
|
682
|
+
span?.setStatus({ code: SpanStatusCode.ERROR });
|
|
681
683
|
console.error('[RecordsController] [createStudio] An error occurred while creating a studio:', err);
|
|
682
684
|
return {
|
|
683
685
|
success: false,
|
|
@@ -693,7 +695,6 @@ export class RecordsController {
|
|
|
693
695
|
* @param comId The comId of the studio that this studio should belong to.
|
|
694
696
|
*/
|
|
695
697
|
async createStudioInComId(studioName, userId, comId) {
|
|
696
|
-
var _a;
|
|
697
698
|
try {
|
|
698
699
|
const studioId = uuid();
|
|
699
700
|
const existingStudio = await this._store.getStudioByComId(comId);
|
|
@@ -723,7 +724,7 @@ export class RecordsController {
|
|
|
723
724
|
};
|
|
724
725
|
}
|
|
725
726
|
}
|
|
726
|
-
const comIdConfig =
|
|
727
|
+
const comIdConfig = existingStudio.comIdConfig ?? {
|
|
727
728
|
allowedStudioCreators: 'only-members',
|
|
728
729
|
};
|
|
729
730
|
if (comIdConfig.allowedStudioCreators === 'only-members') {
|
|
@@ -750,8 +751,8 @@ export class RecordsController {
|
|
|
750
751
|
}
|
|
751
752
|
catch (err) {
|
|
752
753
|
const span = trace.getActiveSpan();
|
|
753
|
-
span
|
|
754
|
-
span
|
|
754
|
+
span?.recordException(err);
|
|
755
|
+
span?.setStatus({ code: SpanStatusCode.ERROR });
|
|
755
756
|
console.error('[RecordsController] [createStudio] An error occurred while creating a studio in a comId:', err);
|
|
756
757
|
return {
|
|
757
758
|
success: false,
|
|
@@ -802,8 +803,8 @@ export class RecordsController {
|
|
|
802
803
|
}
|
|
803
804
|
catch (err) {
|
|
804
805
|
const span = trace.getActiveSpan();
|
|
805
|
-
span
|
|
806
|
-
span
|
|
806
|
+
span?.recordException(err);
|
|
807
|
+
span?.setStatus({ code: SpanStatusCode.ERROR });
|
|
807
808
|
console.error('[RecordsController] [updateStudio] An error occurred while updating a studio:', err);
|
|
808
809
|
return {
|
|
809
810
|
success: false,
|
|
@@ -837,9 +838,10 @@ export class RecordsController {
|
|
|
837
838
|
errorMessage: 'You are not authorized to access this studio.',
|
|
838
839
|
};
|
|
839
840
|
}
|
|
840
|
-
let
|
|
841
|
+
let comIdFeatures = {
|
|
841
842
|
allowed: false,
|
|
842
843
|
};
|
|
844
|
+
let storeFeatures;
|
|
843
845
|
let loomFeatures = {
|
|
844
846
|
allowed: false,
|
|
845
847
|
};
|
|
@@ -851,15 +853,21 @@ export class RecordsController {
|
|
|
851
853
|
if (studio.subscriptionId &&
|
|
852
854
|
isActiveSubscription(studio.subscriptionStatus)) {
|
|
853
855
|
const config = await this._config.getSubscriptionConfiguration();
|
|
854
|
-
|
|
855
|
-
loomFeatures = getLoomFeatures(config, studio.subscriptionStatus, studio.subscriptionId);
|
|
856
|
+
comIdFeatures = getComIdFeatures(config, studio.subscriptionStatus, studio.subscriptionId, studio.subscriptionPeriodStartMs, studio.subscriptionPeriodEndMs);
|
|
857
|
+
loomFeatures = getLoomFeatures(config, studio.subscriptionStatus, studio.subscriptionId, studio.subscriptionPeriodStartMs, studio.subscriptionPeriodEndMs);
|
|
856
858
|
if (loomFeatures.allowed) {
|
|
857
859
|
loomConfig = await this._store.getStudioLoomConfig(studio.id);
|
|
858
860
|
}
|
|
859
|
-
humeFeatures = getHumeAiFeatures(config, studio.subscriptionStatus, studio.subscriptionId, 'studio');
|
|
861
|
+
humeFeatures = getHumeAiFeatures(config, studio.subscriptionStatus, studio.subscriptionId, 'studio', studio.subscriptionPeriodStartMs, studio.subscriptionPeriodEndMs);
|
|
860
862
|
if (humeFeatures.allowed) {
|
|
861
863
|
humeConfig = await this._store.getStudioHumeConfig(studio.id);
|
|
862
864
|
}
|
|
865
|
+
storeFeatures = getPurchasableItemsFeatures(config, studio.subscriptionStatus, studio.subscriptionId, 'studio', studio.subscriptionPeriodStartMs, studio.subscriptionPeriodEndMs);
|
|
866
|
+
}
|
|
867
|
+
else {
|
|
868
|
+
storeFeatures = storeFeaturesSchema.parse({
|
|
869
|
+
allowed: false,
|
|
870
|
+
});
|
|
863
871
|
}
|
|
864
872
|
return {
|
|
865
873
|
success: true,
|
|
@@ -881,7 +889,10 @@ export class RecordsController {
|
|
|
881
889
|
apiKey: humeConfig.apiKey,
|
|
882
890
|
}
|
|
883
891
|
: undefined,
|
|
884
|
-
comIdFeatures:
|
|
892
|
+
comIdFeatures: comIdFeatures,
|
|
893
|
+
storeFeatures: storeFeatures,
|
|
894
|
+
stripeAccountStatus: studio.stripeAccountStatus ?? null,
|
|
895
|
+
stripeRequirementsStatus: studio.stripeAccountRequirementsStatus ?? null,
|
|
885
896
|
loomFeatures,
|
|
886
897
|
humeFeatures,
|
|
887
898
|
},
|
|
@@ -889,8 +900,8 @@ export class RecordsController {
|
|
|
889
900
|
}
|
|
890
901
|
catch (err) {
|
|
891
902
|
const span = trace.getActiveSpan();
|
|
892
|
-
span
|
|
893
|
-
span
|
|
903
|
+
span?.recordException(err);
|
|
904
|
+
span?.setStatus({ code: SpanStatusCode.ERROR });
|
|
894
905
|
console.error('[RecordsController] [getStudio] An error occurred while getting a studio:', err);
|
|
895
906
|
return {
|
|
896
907
|
success: false,
|
|
@@ -899,12 +910,174 @@ export class RecordsController {
|
|
|
899
910
|
};
|
|
900
911
|
}
|
|
901
912
|
}
|
|
913
|
+
/**
|
|
914
|
+
* Attempts to add a custom domain to a studio.
|
|
915
|
+
* @param request The request to add the custom domain.
|
|
916
|
+
* @returns A result containing the verification DNS record or an error.
|
|
917
|
+
*/
|
|
918
|
+
async addCustomDomain(request) {
|
|
919
|
+
if (!this._domainNameValidator) {
|
|
920
|
+
return failure({
|
|
921
|
+
errorCode: 'not_supported',
|
|
922
|
+
errorMessage: 'Custom domains are not supported on this server.',
|
|
923
|
+
});
|
|
924
|
+
}
|
|
925
|
+
const studio = await this._store.getStudioById(request.studioId);
|
|
926
|
+
if (!studio) {
|
|
927
|
+
return failure({
|
|
928
|
+
errorCode: 'studio_not_found',
|
|
929
|
+
errorMessage: 'The given studio was not found.',
|
|
930
|
+
});
|
|
931
|
+
}
|
|
932
|
+
const list = await this._store.listStudioAssignments(request.studioId, {
|
|
933
|
+
userId: request.userId,
|
|
934
|
+
role: 'admin',
|
|
935
|
+
});
|
|
936
|
+
if (list.length <= 0) {
|
|
937
|
+
return failure({
|
|
938
|
+
errorCode: 'not_authorized',
|
|
939
|
+
errorMessage: 'You are not authorized to perform this operation.',
|
|
940
|
+
});
|
|
941
|
+
}
|
|
942
|
+
const config = await this._config.getSubscriptionConfiguration();
|
|
943
|
+
const features = getComIdFeatures(config, studio.subscriptionStatus, studio.subscriptionId, studio.subscriptionPeriodStartMs, studio.subscriptionPeriodEndMs);
|
|
944
|
+
if (!features.allowed) {
|
|
945
|
+
return failure({
|
|
946
|
+
errorCode: 'not_authorized',
|
|
947
|
+
errorMessage: 'comId features are not allowed for this comId. Make sure you have an active subscription that provides comId features.',
|
|
948
|
+
});
|
|
949
|
+
}
|
|
950
|
+
if (typeof features.maxDomains === 'number') {
|
|
951
|
+
const domainCount = (await this._store.listCustomDomainsByStudioId(request.studioId)).length;
|
|
952
|
+
if (domainCount >= features.maxDomains) {
|
|
953
|
+
return failure({
|
|
954
|
+
errorCode: 'subscription_limit_reached',
|
|
955
|
+
errorMessage: 'The maximum number of custom domains allowed for your comId subscription has been reached.',
|
|
956
|
+
});
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
const verificationKey = fromByteArray(randomBytes(16));
|
|
960
|
+
const customDomain = {
|
|
961
|
+
id: uuidv7(),
|
|
962
|
+
domainName: request.domain,
|
|
963
|
+
studioId: request.studioId,
|
|
964
|
+
verificationKey,
|
|
965
|
+
verified: null,
|
|
966
|
+
};
|
|
967
|
+
await this._store.saveCustomDomain(customDomain);
|
|
968
|
+
const verificationDnsRecord = await this._domainNameValidator.getVerificationDNSRecord(customDomain.domainName, customDomain.verificationKey);
|
|
969
|
+
return verificationDnsRecord;
|
|
970
|
+
}
|
|
971
|
+
/**
|
|
972
|
+
* Attempts to delete a custom domain.
|
|
973
|
+
* @param request The request to delete the custom domain.
|
|
974
|
+
* @returns A result indicating success or failure.
|
|
975
|
+
*/
|
|
976
|
+
async deleteCustomDomain(request) {
|
|
977
|
+
if (!this._domainNameValidator) {
|
|
978
|
+
return failure({
|
|
979
|
+
errorCode: 'not_supported',
|
|
980
|
+
errorMessage: 'Custom domains are not supported on this server.',
|
|
981
|
+
});
|
|
982
|
+
}
|
|
983
|
+
const customDomain = await this._store.getCustomDomainById(request.customDomainId);
|
|
984
|
+
if (!customDomain) {
|
|
985
|
+
return failure({
|
|
986
|
+
errorCode: 'not_found',
|
|
987
|
+
errorMessage: 'The given custom domain was not found.',
|
|
988
|
+
});
|
|
989
|
+
}
|
|
990
|
+
const list = await this._store.listStudioAssignments(customDomain.studioId, {
|
|
991
|
+
userId: request.userId,
|
|
992
|
+
role: 'admin',
|
|
993
|
+
});
|
|
994
|
+
if (list.length <= 0) {
|
|
995
|
+
return failure({
|
|
996
|
+
errorCode: 'not_authorized',
|
|
997
|
+
errorMessage: 'You are not authorized to perform this operation.',
|
|
998
|
+
});
|
|
999
|
+
}
|
|
1000
|
+
await this._store.deleteCustomDomain(customDomain.id);
|
|
1001
|
+
return success(undefined);
|
|
1002
|
+
}
|
|
1003
|
+
/**
|
|
1004
|
+
* Lists all custom domains for a given studio.
|
|
1005
|
+
* @param request The request to list custom domains.
|
|
1006
|
+
* @returns A result containing the list of custom domains or an error.
|
|
1007
|
+
*/
|
|
1008
|
+
async listCustomDomains(request) {
|
|
1009
|
+
if (!this._domainNameValidator) {
|
|
1010
|
+
return failure({
|
|
1011
|
+
errorCode: 'not_supported',
|
|
1012
|
+
errorMessage: 'Custom domains are not supported on this server.',
|
|
1013
|
+
});
|
|
1014
|
+
}
|
|
1015
|
+
const studio = await this._store.getStudioById(request.studioId);
|
|
1016
|
+
if (!studio) {
|
|
1017
|
+
return failure({
|
|
1018
|
+
errorCode: 'studio_not_found',
|
|
1019
|
+
errorMessage: 'The given studio was not found.',
|
|
1020
|
+
});
|
|
1021
|
+
}
|
|
1022
|
+
const list = await this._store.listStudioAssignments(request.studioId, {
|
|
1023
|
+
userId: request.userId,
|
|
1024
|
+
role: 'admin',
|
|
1025
|
+
});
|
|
1026
|
+
if (list.length <= 0) {
|
|
1027
|
+
return failure({
|
|
1028
|
+
errorCode: 'not_authorized',
|
|
1029
|
+
errorMessage: 'You are not authorized to perform this operation.',
|
|
1030
|
+
});
|
|
1031
|
+
}
|
|
1032
|
+
const domains = await this._store.listCustomDomainsByStudioId(request.studioId);
|
|
1033
|
+
return success({
|
|
1034
|
+
domains: domains.map((d) => ({
|
|
1035
|
+
id: d.id,
|
|
1036
|
+
domainName: d.domainName,
|
|
1037
|
+
verified: d.verified,
|
|
1038
|
+
})),
|
|
1039
|
+
});
|
|
1040
|
+
}
|
|
1041
|
+
/**
|
|
1042
|
+
* Attempts to verify a custom domain.
|
|
1043
|
+
* @param request The request to verify the custom domain.
|
|
1044
|
+
*/
|
|
1045
|
+
async verifyCustomDomain(request) {
|
|
1046
|
+
if (!this._domainNameValidator) {
|
|
1047
|
+
return failure({
|
|
1048
|
+
errorCode: 'not_supported',
|
|
1049
|
+
errorMessage: 'Custom domains are not supported on this server.',
|
|
1050
|
+
});
|
|
1051
|
+
}
|
|
1052
|
+
const customDomain = await this._store.getCustomDomainById(request.customDomainId);
|
|
1053
|
+
if (!customDomain) {
|
|
1054
|
+
return failure({
|
|
1055
|
+
errorCode: 'not_found',
|
|
1056
|
+
errorMessage: 'The given custom domain was not found.',
|
|
1057
|
+
});
|
|
1058
|
+
}
|
|
1059
|
+
const list = await this._store.listStudioAssignments(customDomain.studioId, {
|
|
1060
|
+
userId: request.userId,
|
|
1061
|
+
role: 'admin',
|
|
1062
|
+
});
|
|
1063
|
+
if (list.length <= 0) {
|
|
1064
|
+
return failure({
|
|
1065
|
+
errorCode: 'not_authorized',
|
|
1066
|
+
errorMessage: 'You are not authorized to perform this operation.',
|
|
1067
|
+
});
|
|
1068
|
+
}
|
|
1069
|
+
const result = await this._domainNameValidator.validateDomainName(customDomain.domainName, customDomain.verificationKey);
|
|
1070
|
+
if (isFailure(result)) {
|
|
1071
|
+
return result;
|
|
1072
|
+
}
|
|
1073
|
+
await this._store.markCustomDomainAsVerified(customDomain.id);
|
|
1074
|
+
return success();
|
|
1075
|
+
}
|
|
902
1076
|
/**
|
|
903
1077
|
* Attempts to get the player config for the given comId.
|
|
904
1078
|
* @param comId The comId.
|
|
905
1079
|
*/
|
|
906
1080
|
async getPlayerConfig(comId) {
|
|
907
|
-
var _a, _b;
|
|
908
1081
|
try {
|
|
909
1082
|
const studio = await this._store.getStudioByComId(comId);
|
|
910
1083
|
if (!studio) {
|
|
@@ -918,14 +1091,14 @@ export class RecordsController {
|
|
|
918
1091
|
success: true,
|
|
919
1092
|
comId: studio.comId,
|
|
920
1093
|
displayName: studio.displayName,
|
|
921
|
-
logoUrl:
|
|
922
|
-
playerConfig:
|
|
1094
|
+
logoUrl: studio.logoUrl ?? null,
|
|
1095
|
+
playerConfig: studio.playerConfig ?? null,
|
|
923
1096
|
};
|
|
924
1097
|
}
|
|
925
1098
|
catch (err) {
|
|
926
1099
|
const span = trace.getActiveSpan();
|
|
927
|
-
span
|
|
928
|
-
span
|
|
1100
|
+
span?.recordException(err);
|
|
1101
|
+
span?.setStatus({ code: SpanStatusCode.ERROR });
|
|
929
1102
|
console.error('[RecordsController] [getPlayerConfig] An error occurred while getting the player config:', err);
|
|
930
1103
|
return {
|
|
931
1104
|
success: false,
|
|
@@ -934,6 +1107,142 @@ export class RecordsController {
|
|
|
934
1107
|
};
|
|
935
1108
|
}
|
|
936
1109
|
}
|
|
1110
|
+
/**
|
|
1111
|
+
* Gets the AB1 bootstrap script that should be injected into the web player.
|
|
1112
|
+
* @param config The config for the web player.
|
|
1113
|
+
* @returns
|
|
1114
|
+
*/
|
|
1115
|
+
async getAb1Bootstrap(config) {
|
|
1116
|
+
const bootstrap = await this._config.getConfiguration(AB1_BOOTSTRAP_KEY, null);
|
|
1117
|
+
if (bootstrap) {
|
|
1118
|
+
return success(JSON.stringify(bootstrap));
|
|
1119
|
+
}
|
|
1120
|
+
if (config.ab1BootstrapURL) {
|
|
1121
|
+
// inject the AB1 bootstrap script
|
|
1122
|
+
const result = await axios.get(config.ab1BootstrapURL, {
|
|
1123
|
+
validateStatus: () => true,
|
|
1124
|
+
});
|
|
1125
|
+
if (result.status === 200) {
|
|
1126
|
+
let json = null;
|
|
1127
|
+
if (typeof result.data === 'string') {
|
|
1128
|
+
const parsed = tryParseJson(result.data);
|
|
1129
|
+
if (parsed.success) {
|
|
1130
|
+
json = parsed.value;
|
|
1131
|
+
}
|
|
1132
|
+
else {
|
|
1133
|
+
console.error(`[RecordsController] [getAb1Bootstrap] Failed to parse AB1 bootstrap script from URL as JSON: ${config.ab1BootstrapURL}`);
|
|
1134
|
+
}
|
|
1135
|
+
}
|
|
1136
|
+
else if (typeof result.data === 'object') {
|
|
1137
|
+
json = result.data;
|
|
1138
|
+
}
|
|
1139
|
+
else {
|
|
1140
|
+
console.error(`[RecordsController] [getAb1Bootstrap] Unexpected AB1 bootstrap script format from URL: ${config.ab1BootstrapURL}`);
|
|
1141
|
+
}
|
|
1142
|
+
let aux;
|
|
1143
|
+
if (json) {
|
|
1144
|
+
const auxParse = STORED_AUX_SCHEMA.safeParse(json);
|
|
1145
|
+
if (auxParse.success) {
|
|
1146
|
+
aux = auxParse.data;
|
|
1147
|
+
}
|
|
1148
|
+
else {
|
|
1149
|
+
console.error(`[RecordsController] [getAb1Bootstrap] Failed to parse AB1 bootstrap script from URL: ${config.ab1BootstrapURL}`, auxParse.error);
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1152
|
+
if (aux) {
|
|
1153
|
+
await this._config.setConfiguration(AB1_BOOTSTRAP_KEY, aux);
|
|
1154
|
+
return success(JSON.stringify(aux));
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1157
|
+
else {
|
|
1158
|
+
console.error(`[RecordsController] [getAb1Bootstrap] Failed to fetch AB1 bootstrap script from URL: ${config.ab1BootstrapURL}, status code: ${result.status}`, result.data);
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
return failure({
|
|
1162
|
+
errorCode: 'not_found',
|
|
1163
|
+
errorMessage: 'No AB1 bootstrap script found.',
|
|
1164
|
+
});
|
|
1165
|
+
}
|
|
1166
|
+
/**
|
|
1167
|
+
* Attempts to get the web config.
|
|
1168
|
+
*
|
|
1169
|
+
* @param hostname The hostname that the request was made to.
|
|
1170
|
+
*/
|
|
1171
|
+
async getWebConfig(hostname) {
|
|
1172
|
+
// TODO: Merge into a single call to get all the configurations at once efficiently.
|
|
1173
|
+
const [config, subscriptions, privo, customDomain] = await Promise.all([
|
|
1174
|
+
this._config.getWebConfig(),
|
|
1175
|
+
this._config.getSubscriptionConfiguration(),
|
|
1176
|
+
this._config.getPrivoConfiguration(),
|
|
1177
|
+
this._store.getVerifiedCustomDomainByName(hostname),
|
|
1178
|
+
]);
|
|
1179
|
+
const webConfig = {
|
|
1180
|
+
...(config ?? {
|
|
1181
|
+
version: 2,
|
|
1182
|
+
causalRepoConnectionProtocol: 'websocket',
|
|
1183
|
+
}),
|
|
1184
|
+
...(customDomain?.studio.playerConfig ?? {}),
|
|
1185
|
+
studiosSupported: !!subscriptions,
|
|
1186
|
+
subscriptionsSupported: !!subscriptions,
|
|
1187
|
+
requirePrivoLogin: !!privo,
|
|
1188
|
+
comId: customDomain?.studio.comId,
|
|
1189
|
+
};
|
|
1190
|
+
if (customDomain) {
|
|
1191
|
+
webConfig.logoUrl =
|
|
1192
|
+
customDomain.studio.logoUrl ?? webConfig.logoUrl;
|
|
1193
|
+
webConfig.logoTitle =
|
|
1194
|
+
customDomain.studio.displayName ??
|
|
1195
|
+
customDomain.studio.comId ??
|
|
1196
|
+
webConfig.logoTitle;
|
|
1197
|
+
}
|
|
1198
|
+
return success(webConfig);
|
|
1199
|
+
}
|
|
1200
|
+
/**
|
|
1201
|
+
* Attempts to get the web manifest for the player.
|
|
1202
|
+
* @param hostname The hostname that the request was made to.
|
|
1203
|
+
*/
|
|
1204
|
+
async getPlayerWebManifest(hostname) {
|
|
1205
|
+
const customDomain = await this._store.getVerifiedCustomDomainByName(hostname);
|
|
1206
|
+
if (customDomain?.studio.playerWebManifest) {
|
|
1207
|
+
return success(customDomain.studio.playerWebManifest);
|
|
1208
|
+
}
|
|
1209
|
+
const manifest = await this._config.getPlayerWebManifest();
|
|
1210
|
+
if (!manifest) {
|
|
1211
|
+
return failure({
|
|
1212
|
+
errorCode: 'not_found',
|
|
1213
|
+
errorMessage: 'No web manifest found.',
|
|
1214
|
+
});
|
|
1215
|
+
}
|
|
1216
|
+
return success(manifest);
|
|
1217
|
+
}
|
|
1218
|
+
/**
|
|
1219
|
+
* Attempts to get a verified custom domain by its name.
|
|
1220
|
+
* @param hostname The hostname of the custom domain.
|
|
1221
|
+
*/
|
|
1222
|
+
async getVerifiedCustomDomainByName(hostname) {
|
|
1223
|
+
const customDomain = await this._store.getVerifiedCustomDomainByName(hostname);
|
|
1224
|
+
return success(customDomain);
|
|
1225
|
+
}
|
|
1226
|
+
async getConfigurationValue(request) {
|
|
1227
|
+
if (!isSuperUserRole(request.userRole)) {
|
|
1228
|
+
return failure({
|
|
1229
|
+
errorCode: 'not_authorized',
|
|
1230
|
+
errorMessage: 'You are not authorized to perform this operation.',
|
|
1231
|
+
});
|
|
1232
|
+
}
|
|
1233
|
+
const value = await this._config.getConfiguration(request.key);
|
|
1234
|
+
return success(value);
|
|
1235
|
+
}
|
|
1236
|
+
async setConfigurationValue(request) {
|
|
1237
|
+
if (!isSuperUserRole(request.userRole)) {
|
|
1238
|
+
return failure({
|
|
1239
|
+
errorCode: 'not_authorized',
|
|
1240
|
+
errorMessage: 'You are not authorized to perform this operation.',
|
|
1241
|
+
});
|
|
1242
|
+
}
|
|
1243
|
+
await this._config.setConfiguration(request.key, request.value);
|
|
1244
|
+
return success();
|
|
1245
|
+
}
|
|
937
1246
|
/**
|
|
938
1247
|
* Gets the list of studios that the user with the given ID has access to.
|
|
939
1248
|
* @param userId The ID of the user.
|
|
@@ -959,8 +1268,8 @@ export class RecordsController {
|
|
|
959
1268
|
}
|
|
960
1269
|
catch (err) {
|
|
961
1270
|
const span = trace.getActiveSpan();
|
|
962
|
-
span
|
|
963
|
-
span
|
|
1271
|
+
span?.recordException(err);
|
|
1272
|
+
span?.setStatus({ code: SpanStatusCode.ERROR });
|
|
964
1273
|
console.error('[RecordsController] [listStudios] An error occurred while listing studios:', err);
|
|
965
1274
|
return {
|
|
966
1275
|
success: false,
|
|
@@ -995,8 +1304,8 @@ export class RecordsController {
|
|
|
995
1304
|
}
|
|
996
1305
|
catch (err) {
|
|
997
1306
|
const span = trace.getActiveSpan();
|
|
998
|
-
span
|
|
999
|
-
span
|
|
1307
|
+
span?.recordException(err);
|
|
1308
|
+
span?.setStatus({ code: SpanStatusCode.ERROR });
|
|
1000
1309
|
console.error('[RecordsController] [listStudios] An error occurred while listing studios:', err);
|
|
1001
1310
|
return {
|
|
1002
1311
|
success: false,
|
|
@@ -1017,7 +1326,7 @@ export class RecordsController {
|
|
|
1017
1326
|
let role;
|
|
1018
1327
|
if (!userAssignment) {
|
|
1019
1328
|
const user = await this._auth.findUser(userId);
|
|
1020
|
-
if (!isSuperUserRole(user
|
|
1329
|
+
if (!isSuperUserRole(user?.role)) {
|
|
1021
1330
|
return {
|
|
1022
1331
|
success: false,
|
|
1023
1332
|
errorCode: 'not_authorized',
|
|
@@ -1096,8 +1405,8 @@ export class RecordsController {
|
|
|
1096
1405
|
}
|
|
1097
1406
|
catch (err) {
|
|
1098
1407
|
const span = trace.getActiveSpan();
|
|
1099
|
-
span
|
|
1100
|
-
span
|
|
1408
|
+
span?.recordException(err);
|
|
1409
|
+
span?.setStatus({ code: SpanStatusCode.ERROR });
|
|
1101
1410
|
console.error('[RecordsController] [listStudioMembers] An error occurred while listing studio members:', err);
|
|
1102
1411
|
return {
|
|
1103
1412
|
success: false,
|
|
@@ -1107,7 +1416,6 @@ export class RecordsController {
|
|
|
1107
1416
|
}
|
|
1108
1417
|
}
|
|
1109
1418
|
async addStudioMember(request) {
|
|
1110
|
-
var _a, _b, _c, _d;
|
|
1111
1419
|
try {
|
|
1112
1420
|
if (!request.userId) {
|
|
1113
1421
|
return {
|
|
@@ -1132,7 +1440,7 @@ export class RecordsController {
|
|
|
1132
1440
|
addedUserId = request.addedUserId;
|
|
1133
1441
|
}
|
|
1134
1442
|
else if (request.addedEmail || request.addedPhoneNumber) {
|
|
1135
|
-
const addedUser = await this._auth.findUserByAddress(
|
|
1443
|
+
const addedUser = await this._auth.findUserByAddress(request.addedEmail ?? request.addedPhoneNumber, request.addedEmail ? 'email' : 'phone');
|
|
1136
1444
|
if (addedUser) {
|
|
1137
1445
|
addedUserId = addedUser.id;
|
|
1138
1446
|
}
|
|
@@ -1143,9 +1451,9 @@ export class RecordsController {
|
|
|
1143
1451
|
request.addedPhoneNumber ||
|
|
1144
1452
|
request.addedDisplayName)) {
|
|
1145
1453
|
const privoServiceId = await this._privo.lookupServiceId({
|
|
1146
|
-
displayName:
|
|
1147
|
-
email:
|
|
1148
|
-
phoneNumber:
|
|
1454
|
+
displayName: request.addedDisplayName ?? undefined,
|
|
1455
|
+
email: request.addedEmail ?? undefined,
|
|
1456
|
+
phoneNumber: request.addedPhoneNumber ?? undefined,
|
|
1149
1457
|
});
|
|
1150
1458
|
if (privoServiceId) {
|
|
1151
1459
|
const user = await this._auth.findUserByPrivoServiceId(privoServiceId);
|
|
@@ -1194,8 +1502,8 @@ export class RecordsController {
|
|
|
1194
1502
|
}
|
|
1195
1503
|
catch (err) {
|
|
1196
1504
|
const span = trace.getActiveSpan();
|
|
1197
|
-
span
|
|
1198
|
-
span
|
|
1505
|
+
span?.recordException(err);
|
|
1506
|
+
span?.setStatus({ code: SpanStatusCode.ERROR });
|
|
1199
1507
|
console.error('[RecordsController] [addStudioMember] An error occurred while adding a studio member:', err);
|
|
1200
1508
|
return {
|
|
1201
1509
|
success: false,
|
|
@@ -1238,8 +1546,8 @@ export class RecordsController {
|
|
|
1238
1546
|
}
|
|
1239
1547
|
catch (err) {
|
|
1240
1548
|
const span = trace.getActiveSpan();
|
|
1241
|
-
span
|
|
1242
|
-
span
|
|
1549
|
+
span?.recordException(err);
|
|
1550
|
+
span?.setStatus({ code: SpanStatusCode.ERROR });
|
|
1243
1551
|
console.error('[RecordsController] [removeStudioMember] An error occurred while removing a studio member:', err);
|
|
1244
1552
|
return {
|
|
1245
1553
|
success: false,
|
|
@@ -1305,8 +1613,8 @@ export class RecordsController {
|
|
|
1305
1613
|
}
|
|
1306
1614
|
catch (err) {
|
|
1307
1615
|
const span = trace.getActiveSpan();
|
|
1308
|
-
span
|
|
1309
|
-
span
|
|
1616
|
+
span?.recordException(err);
|
|
1617
|
+
span?.setStatus({ code: SpanStatusCode.ERROR });
|
|
1310
1618
|
console.error('[RecordsController] [requestComId] An error occurred while requesting a comId:', err);
|
|
1311
1619
|
return {
|
|
1312
1620
|
success: false,
|
|
@@ -1352,9 +1660,39 @@ __decorate([
|
|
|
1352
1660
|
__decorate([
|
|
1353
1661
|
traced(TRACE_NAME)
|
|
1354
1662
|
], RecordsController.prototype, "getStudio", null);
|
|
1663
|
+
__decorate([
|
|
1664
|
+
traced(TRACE_NAME)
|
|
1665
|
+
], RecordsController.prototype, "addCustomDomain", null);
|
|
1666
|
+
__decorate([
|
|
1667
|
+
traced(TRACE_NAME)
|
|
1668
|
+
], RecordsController.prototype, "deleteCustomDomain", null);
|
|
1669
|
+
__decorate([
|
|
1670
|
+
traced(TRACE_NAME)
|
|
1671
|
+
], RecordsController.prototype, "listCustomDomains", null);
|
|
1672
|
+
__decorate([
|
|
1673
|
+
traced(TRACE_NAME)
|
|
1674
|
+
], RecordsController.prototype, "verifyCustomDomain", null);
|
|
1355
1675
|
__decorate([
|
|
1356
1676
|
traced(TRACE_NAME)
|
|
1357
1677
|
], RecordsController.prototype, "getPlayerConfig", null);
|
|
1678
|
+
__decorate([
|
|
1679
|
+
traced(TRACE_NAME)
|
|
1680
|
+
], RecordsController.prototype, "getAb1Bootstrap", null);
|
|
1681
|
+
__decorate([
|
|
1682
|
+
traced(TRACE_NAME)
|
|
1683
|
+
], RecordsController.prototype, "getWebConfig", null);
|
|
1684
|
+
__decorate([
|
|
1685
|
+
traced(TRACE_NAME)
|
|
1686
|
+
], RecordsController.prototype, "getPlayerWebManifest", null);
|
|
1687
|
+
__decorate([
|
|
1688
|
+
traced(TRACE_NAME)
|
|
1689
|
+
], RecordsController.prototype, "getVerifiedCustomDomainByName", null);
|
|
1690
|
+
__decorate([
|
|
1691
|
+
traced(TRACE_NAME)
|
|
1692
|
+
], RecordsController.prototype, "getConfigurationValue", null);
|
|
1693
|
+
__decorate([
|
|
1694
|
+
traced(TRACE_NAME)
|
|
1695
|
+
], RecordsController.prototype, "setConfigurationValue", null);
|
|
1358
1696
|
__decorate([
|
|
1359
1697
|
traced(TRACE_NAME)
|
|
1360
1698
|
], RecordsController.prototype, "listStudios", null);
|