@casual-simulation/aux-records 4.1.3 → 4.1.5
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/CachingConfigStore.d.ts +2 -1
- package/CachingConfigStore.js +48 -50
- package/CachingConfigStore.js.map +1 -1
- package/ComIdConfig.d.ts +4 -0
- package/ComIdConfig.js +2 -0
- package/ComIdConfig.js.map +1 -1
- package/ConfigurationStore.d.ts +53 -1
- package/ConfigurationStore.js +25 -0
- package/ConfigurationStore.js.map +1 -1
- package/MemoryStore.d.ts +1 -0
- package/MemoryStore.js +11 -0
- package/MemoryStore.js.map +1 -1
- package/RecordsController.d.ts +2 -2
- package/RecordsController.js +26 -4
- package/RecordsController.js.map +1 -1
- package/RecordsServer.d.ts +9 -3
- package/RecordsStore.d.ts +4 -0
- package/ServerConfig.d.ts +14 -6
- package/ServerConfig.js +5 -18
- package/ServerConfig.js.map +1 -1
- package/dns/DNSDomainNameValidator.d.ts +2 -2
- package/dns/DNSDomainNameValidator.js +24 -4
- package/dns/DNSDomainNameValidator.js.map +1 -1
- package/dns/DomainNameValidator.d.ts +8 -6
- package/package.json +2 -2
package/CachingConfigStore.d.ts
CHANGED
|
@@ -22,9 +22,10 @@ export declare class CachingConfigStore implements ConfigurationStore {
|
|
|
22
22
|
constructor(store: ConfigurationStore, cache: Cache, cacheSeconds: number);
|
|
23
23
|
setConfiguration<TKey extends ConfigurationKey>(key: TKey, value: ConfigurationInput<TKey>): Promise<void>;
|
|
24
24
|
getConfiguration<TKey extends ConfigurationKey>(key: TKey, defaultValue?: ConfigurationInput<TKey>): Promise<ConfigurationOutput<TKey> | null>;
|
|
25
|
+
private _getConfiguration;
|
|
25
26
|
getWebConfig(): Promise<WebConfig | null>;
|
|
26
27
|
getPlayerWebManifest(): Promise<WebManifest | null>;
|
|
27
|
-
getSubscriptionConfiguration(): Promise<SubscriptionConfiguration>;
|
|
28
|
+
getSubscriptionConfiguration(): Promise<SubscriptionConfiguration | null>;
|
|
28
29
|
getPrivoConfiguration(): Promise<PrivoConfiguration>;
|
|
29
30
|
getModerationConfig(): Promise<ModerationConfiguration>;
|
|
30
31
|
}
|
package/CachingConfigStore.js
CHANGED
|
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { PLAYER_WEB_MANIFEST_KEY, WEB_CONFIG_KEY, } from './ConfigurationStore';
|
|
7
|
+
import { CONFIGURATION_SCHEMAS_MAP, MODERATION_CONFIG_KEY, PLAYER_WEB_MANIFEST_KEY, PRIVO_CONFIG_KEY, SUBSCRIPTIONS_CONFIG_KEY, WEB_CONFIG_KEY, } from './ConfigurationStore';
|
|
8
8
|
import { traced } from './tracing/TracingDecorators';
|
|
9
9
|
const TRACE_NAME = 'CachingConfigStore';
|
|
10
10
|
/**
|
|
@@ -28,69 +28,64 @@ export class CachingConfigStore {
|
|
|
28
28
|
}
|
|
29
29
|
async getConfiguration(key, defaultValue) {
|
|
30
30
|
const cached = await this._cache.retrieve(key);
|
|
31
|
-
if (cached) {
|
|
32
|
-
|
|
31
|
+
if (typeof cached !== 'undefined') {
|
|
32
|
+
if (cached) {
|
|
33
|
+
const schema = CONFIGURATION_SCHEMAS_MAP[key];
|
|
34
|
+
const parsed = schema.safeParse(cached);
|
|
35
|
+
if (!parsed.success) {
|
|
36
|
+
console.warn(`Cached configuration for key "${key}" is invalid:`, parsed.error);
|
|
37
|
+
await this._cache.remove(key);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
return parsed.data;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
// If null is cached, return that instead of hitting the store again.
|
|
45
|
+
return cached;
|
|
46
|
+
}
|
|
33
47
|
}
|
|
34
48
|
const result = await this._store.getConfiguration(key, defaultValue);
|
|
35
|
-
|
|
36
|
-
await this._cache.store(key, result, this._cacheSeconds);
|
|
37
|
-
}
|
|
49
|
+
await this._cache.store(key, result, this._cacheSeconds);
|
|
38
50
|
return result;
|
|
39
51
|
}
|
|
40
|
-
async
|
|
41
|
-
const cached = await this._cache.retrieve(
|
|
42
|
-
if (cached) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
52
|
+
async _getConfiguration(key, retrieve) {
|
|
53
|
+
const cached = await this._cache.retrieve(key);
|
|
54
|
+
if (typeof cached !== 'undefined') {
|
|
55
|
+
if (cached) {
|
|
56
|
+
const schema = CONFIGURATION_SCHEMAS_MAP[key];
|
|
57
|
+
const parsed = schema.safeParse(cached);
|
|
58
|
+
if (!parsed.success) {
|
|
59
|
+
console.warn(`Cached configuration for key "${key}" is invalid:`, parsed.error);
|
|
60
|
+
await this._cache.remove(key);
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
return parsed.data;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
// If null is cached, return that instead of hitting the store again.
|
|
68
|
+
return cached;
|
|
69
|
+
}
|
|
48
70
|
}
|
|
71
|
+
const result = await retrieve();
|
|
72
|
+
await this._cache.store(key, result, this._cacheSeconds);
|
|
49
73
|
return result;
|
|
50
74
|
}
|
|
75
|
+
async getWebConfig() {
|
|
76
|
+
return (await this._getConfiguration(WEB_CONFIG_KEY, async () => (await this._store.getWebConfig())));
|
|
77
|
+
}
|
|
51
78
|
async getPlayerWebManifest() {
|
|
52
|
-
|
|
53
|
-
if (cached) {
|
|
54
|
-
return cached;
|
|
55
|
-
}
|
|
56
|
-
const result = await this._store.getPlayerWebManifest();
|
|
57
|
-
if (result) {
|
|
58
|
-
await this._cache.store(PLAYER_WEB_MANIFEST_KEY, result, this._cacheSeconds);
|
|
59
|
-
}
|
|
60
|
-
return result;
|
|
79
|
+
return (await this._getConfiguration(PLAYER_WEB_MANIFEST_KEY, async () => (await this._store.getPlayerWebManifest())));
|
|
61
80
|
}
|
|
62
81
|
async getSubscriptionConfiguration() {
|
|
63
|
-
|
|
64
|
-
if (cached) {
|
|
65
|
-
return cached;
|
|
66
|
-
}
|
|
67
|
-
const result = await this._store.getSubscriptionConfiguration();
|
|
68
|
-
if (result) {
|
|
69
|
-
await this._cache.store('subscriptions', result, this._cacheSeconds);
|
|
70
|
-
}
|
|
71
|
-
return result;
|
|
82
|
+
return (await this._getConfiguration(SUBSCRIPTIONS_CONFIG_KEY, async () => (await this._store.getSubscriptionConfiguration())));
|
|
72
83
|
}
|
|
73
84
|
async getPrivoConfiguration() {
|
|
74
|
-
|
|
75
|
-
if (cached) {
|
|
76
|
-
return cached;
|
|
77
|
-
}
|
|
78
|
-
const result = await this._store.getPrivoConfiguration();
|
|
79
|
-
if (result) {
|
|
80
|
-
await this._cache.store('privo', result, this._cacheSeconds);
|
|
81
|
-
}
|
|
82
|
-
return result;
|
|
85
|
+
return (await this._getConfiguration(PRIVO_CONFIG_KEY, async () => (await this._store.getPrivoConfiguration())));
|
|
83
86
|
}
|
|
84
87
|
async getModerationConfig() {
|
|
85
|
-
|
|
86
|
-
if (cached) {
|
|
87
|
-
return cached;
|
|
88
|
-
}
|
|
89
|
-
const result = await this._store.getModerationConfig();
|
|
90
|
-
if (result) {
|
|
91
|
-
await this._cache.store('moderation', result, this._cacheSeconds);
|
|
92
|
-
}
|
|
93
|
-
return result;
|
|
88
|
+
return (await this._getConfiguration(MODERATION_CONFIG_KEY, async () => (await this._store.getModerationConfig())));
|
|
94
89
|
}
|
|
95
90
|
}
|
|
96
91
|
__decorate([
|
|
@@ -99,6 +94,9 @@ __decorate([
|
|
|
99
94
|
__decorate([
|
|
100
95
|
traced(TRACE_NAME)
|
|
101
96
|
], CachingConfigStore.prototype, "getConfiguration", null);
|
|
97
|
+
__decorate([
|
|
98
|
+
traced(TRACE_NAME)
|
|
99
|
+
], CachingConfigStore.prototype, "_getConfiguration", null);
|
|
102
100
|
__decorate([
|
|
103
101
|
traced(TRACE_NAME)
|
|
104
102
|
], CachingConfigStore.prototype, "getWebConfig", null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CachingConfigStore.js","sourceRoot":"","sources":["CachingConfigStore.ts"],"names":[],"mappings":";;;;;;AAwBA,OAAO,EACH,uBAAuB,EACvB,cAAc,GAEjB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAIrD,MAAM,UAAU,GAAG,oBAAoB,CAAC;AAExC;;GAEG;AACH,MAAM,OAAO,kBAAkB;IAK3B;;;;;OAKG;IACH,YAAY,KAAyB,EAAE,KAAY,EAAE,YAAoB;QACrE,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;IACtC,CAAC;IAGK,AAAN,KAAK,CAAC,gBAAgB,CAClB,GAAS,EACT,KAA+B;QAE/B,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC9B,MAAM,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACnD,CAAC;IAGK,AAAN,KAAK,CAAC,gBAAgB,CAClB,GAAS,EACT,YAAuC;QAEvC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CACrC,GAAG,CACN,CAAC;QAEF,IAAI,MAAM,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"CachingConfigStore.js","sourceRoot":"","sources":["CachingConfigStore.ts"],"names":[],"mappings":";;;;;;AAwBA,OAAO,EACH,yBAAyB,EACzB,qBAAqB,EACrB,uBAAuB,EACvB,gBAAgB,EAChB,wBAAwB,EACxB,cAAc,GAEjB,MA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AAU,CAAC;sEASlB;AAGK;IADL,MAAM,CAAC,UAAU,CAAC;+DASlB;AAGK;IADL,MAAM,CAAC,UAAU,CAAC;6DASlB"}
|
package/ComIdConfig.d.ts
CHANGED
|
@@ -70,6 +70,8 @@ export declare const COM_ID_PLAYER_CONFIG: z.ZodObject<{
|
|
|
70
70
|
}>>>>;
|
|
71
71
|
automaticBiosOptionInst: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
72
72
|
logoBackgroundColor: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
73
|
+
postHogApiKey: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
74
|
+
postHogApiHost: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
73
75
|
}, z.core.$strip>;
|
|
74
76
|
export type ComIdPlayerConfig = z.infer<typeof COM_ID_PLAYER_CONFIG>;
|
|
75
77
|
export declare const COM_ID_WEB_CONFIG_SCHEMA: z.ZodObject<{
|
|
@@ -138,6 +140,8 @@ export declare const COM_ID_WEB_CONFIG_SCHEMA: z.ZodObject<{
|
|
|
138
140
|
}>>>>;
|
|
139
141
|
automaticBiosOptionInst: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
140
142
|
logoBackgroundColor: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
143
|
+
postHogApiKey: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
144
|
+
postHogApiHost: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
141
145
|
}, z.core.$strip>;
|
|
142
146
|
name: z.ZodString;
|
|
143
147
|
logoUrl: z.ZodNullable<z.ZodString>;
|
package/ComIdConfig.js
CHANGED
|
@@ -35,6 +35,8 @@ export const COM_ID_PLAYER_CONFIG = WEB_CONFIG_SCHEMA.pick({
|
|
|
35
35
|
what3WordsApiKey: true,
|
|
36
36
|
logoBackgroundColor: true,
|
|
37
37
|
disableVM: true,
|
|
38
|
+
postHogApiKey: true,
|
|
39
|
+
postHogApiHost: true,
|
|
38
40
|
}).partial();
|
|
39
41
|
export const COM_ID_WEB_CONFIG_SCHEMA = z.object({
|
|
40
42
|
playerConfig: COM_ID_PLAYER_CONFIG,
|
package/ComIdConfig.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComIdConfig.js","sourceRoot":"","sources":["ComIdConfig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC;IAC3C,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC;IACnB,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC;CAC5B,CAAC,CAAC;AAMH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,qBAAqB,EAAE,8BAA8B,CAAC,QAAQ,CAC1D,iDAAiD,CACpD;CACJ,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,oBAAoB,GAAG,iBAAiB,CAAC,IAAI,CAAC;IACvD,eAAe,EAAE,IAAI;IACrB,kBAAkB,EAAE,IAAI;IACxB,YAAY,EAAE,IAAI;IAClB,mBAAmB,EAAE,IAAI;IACzB,uBAAuB,EAAE,IAAI;IAC7B,iBAAiB,EAAE,IAAI;IACvB,YAAY,EAAE,IAAI;IAClB,gBAAgB,EAAE,IAAI;IACtB,mBAAmB,EAAE,IAAI;IACzB,SAAS,EAAE,IAAI;
|
|
1
|
+
{"version":3,"file":"ComIdConfig.js","sourceRoot":"","sources":["ComIdConfig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC;IAC3C,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC;IACnB,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC;CAC5B,CAAC,CAAC;AAMH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,qBAAqB,EAAE,8BAA8B,CAAC,QAAQ,CAC1D,iDAAiD,CACpD;CACJ,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,oBAAoB,GAAG,iBAAiB,CAAC,IAAI,CAAC;IACvD,eAAe,EAAE,IAAI;IACrB,kBAAkB,EAAE,IAAI;IACxB,YAAY,EAAE,IAAI;IAClB,mBAAmB,EAAE,IAAI;IACzB,uBAAuB,EAAE,IAAI;IAC7B,iBAAiB,EAAE,IAAI;IACvB,YAAY,EAAE,IAAI;IAClB,gBAAgB,EAAE,IAAI;IACtB,mBAAmB,EAAE,IAAI;IACzB,SAAS,EAAE,IAAI;IACf,aAAa,EAAE,IAAI;IACnB,cAAc,EAAE,IAAI;CACvB,CAAC,CAAC,OAAO,EAAE,CAAC;AAIb,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,YAAY,EAAE,oBAAoB;IAClC,IAAI,EAAE,CAAC;SACF,MAAM,EAAE;SACR,QAAQ,CAAC,oDAAoD,CAAC;IACnE,OAAO,EAAE,CAAC;SACL,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CACL,+FAA+F,CAClG;CACR,CAAC,CAAC"}
|
package/ConfigurationStore.d.ts
CHANGED
|
@@ -3,13 +3,35 @@ import { type PrivoConfiguration } from './PrivoConfiguration';
|
|
|
3
3
|
import { type ModerationConfiguration } from './ModerationConfiguration';
|
|
4
4
|
import { type WebConfig } from '@casual-simulation/aux-common';
|
|
5
5
|
import { type WebManifest } from '@casual-simulation/aux-common/common/WebManifest';
|
|
6
|
-
import
|
|
6
|
+
import z from 'zod';
|
|
7
7
|
export declare const SUBSCRIPTIONS_CONFIG_KEY = "subscriptions";
|
|
8
8
|
export declare const PRIVO_CONFIG_KEY = "privo";
|
|
9
9
|
export declare const MODERATION_CONFIG_KEY = "moderation";
|
|
10
10
|
export declare const WEB_CONFIG_KEY = "web";
|
|
11
11
|
export declare const PLAYER_WEB_MANIFEST_KEY = "playerWebManifest";
|
|
12
12
|
export declare const AB1_BOOTSTRAP_KEY = "ab1Bootstrap";
|
|
13
|
+
export declare const METADATA_KEY = "metadata";
|
|
14
|
+
export declare const serverMetadataSchema: (() => z.ZodObject<{
|
|
15
|
+
frontendOrigin: z.ZodNullable<z.ZodOptional<z.ZodURL>>;
|
|
16
|
+
apiOrigin: z.ZodString;
|
|
17
|
+
websocketOrigin: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
18
|
+
websocketProtocol: z.ZodNullable<z.ZodOptional<z.ZodEnum<{
|
|
19
|
+
"apiary-aws": "apiary-aws";
|
|
20
|
+
websocket: "websocket";
|
|
21
|
+
}>>>;
|
|
22
|
+
}, z.core.$strip>) & {
|
|
23
|
+
cache: import("es-toolkit").MemoizeCache<any, z.ZodObject<{
|
|
24
|
+
frontendOrigin: z.ZodNullable<z.ZodOptional<z.ZodURL>>;
|
|
25
|
+
apiOrigin: z.ZodString;
|
|
26
|
+
websocketOrigin: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
27
|
+
websocketProtocol: z.ZodNullable<z.ZodOptional<z.ZodEnum<{
|
|
28
|
+
"apiary-aws": "apiary-aws";
|
|
29
|
+
websocket: "websocket";
|
|
30
|
+
}>>>;
|
|
31
|
+
}, z.core.$strip>>;
|
|
32
|
+
};
|
|
33
|
+
export type ServerMetadataSchema = ReturnType<typeof serverMetadataSchema>;
|
|
34
|
+
export type ServerMetadata = z.infer<ServerMetadataSchema>;
|
|
13
35
|
/**
|
|
14
36
|
* The default configuration values used when no configuration is found in the store.
|
|
15
37
|
*/
|
|
@@ -34,6 +56,10 @@ export interface DefaultConfiguration {
|
|
|
34
56
|
* The default player web manifest.
|
|
35
57
|
*/
|
|
36
58
|
playerWebManifest: WebManifest | null;
|
|
59
|
+
/**
|
|
60
|
+
* The metadata about the server deployment.
|
|
61
|
+
*/
|
|
62
|
+
meta: ServerMetadata | null;
|
|
37
63
|
}
|
|
38
64
|
export declare const CONFIGURATION_SCHEMAS: ({
|
|
39
65
|
readonly key: "subscriptions";
|
|
@@ -680,6 +706,9 @@ export declare const CONFIGURATION_SCHEMAS: ({
|
|
|
680
706
|
appleTouchIcon: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
681
707
|
}, z.core.$strip>>>;
|
|
682
708
|
supportUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
709
|
+
postHogApiKey: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
710
|
+
postHogApiHost: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
711
|
+
enableSimpleAnalytics: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
683
712
|
}, z.core.$strip>;
|
|
684
713
|
} | {
|
|
685
714
|
readonly key: "playerWebManifest";
|
|
@@ -721,6 +750,17 @@ export declare const CONFIGURATION_SCHEMAS: ({
|
|
|
721
750
|
timestamp: z.ZodNumber;
|
|
722
751
|
}, z.core.$strip>>;
|
|
723
752
|
}, z.core.$strip>], "version">;
|
|
753
|
+
} | {
|
|
754
|
+
readonly key: "metadata";
|
|
755
|
+
readonly schema: z.ZodObject<{
|
|
756
|
+
frontendOrigin: z.ZodNullable<z.ZodOptional<z.ZodURL>>;
|
|
757
|
+
apiOrigin: z.ZodString;
|
|
758
|
+
websocketOrigin: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
759
|
+
websocketProtocol: z.ZodNullable<z.ZodOptional<z.ZodEnum<{
|
|
760
|
+
"apiary-aws": "apiary-aws";
|
|
761
|
+
websocket: "websocket";
|
|
762
|
+
}>>>;
|
|
763
|
+
}, z.core.$strip>;
|
|
724
764
|
})[];
|
|
725
765
|
/**
|
|
726
766
|
* The schemas for the different configuration values.
|
|
@@ -1363,6 +1403,9 @@ export declare const CONFIGURATION_SCHEMAS_MAP: {
|
|
|
1363
1403
|
appleTouchIcon: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1364
1404
|
}, z.core.$strip>>>;
|
|
1365
1405
|
supportUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1406
|
+
postHogApiKey: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1407
|
+
postHogApiHost: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1408
|
+
enableSimpleAnalytics: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
1366
1409
|
}, z.core.$strip>;
|
|
1367
1410
|
playerWebManifest: z.ZodOptional<z.ZodObject<{
|
|
1368
1411
|
name: z.ZodString;
|
|
@@ -1400,6 +1443,15 @@ export declare const CONFIGURATION_SCHEMAS_MAP: {
|
|
|
1400
1443
|
timestamp: z.ZodNumber;
|
|
1401
1444
|
}, z.core.$strip>>;
|
|
1402
1445
|
}, z.core.$strip>], "version">;
|
|
1446
|
+
metadata: z.ZodObject<{
|
|
1447
|
+
frontendOrigin: z.ZodNullable<z.ZodOptional<z.ZodURL>>;
|
|
1448
|
+
apiOrigin: z.ZodString;
|
|
1449
|
+
websocketOrigin: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
1450
|
+
websocketProtocol: z.ZodNullable<z.ZodOptional<z.ZodEnum<{
|
|
1451
|
+
"apiary-aws": "apiary-aws";
|
|
1452
|
+
websocket: "websocket";
|
|
1453
|
+
}>>>;
|
|
1454
|
+
}, z.core.$strip>;
|
|
1403
1455
|
};
|
|
1404
1456
|
export declare const CONFIGURATION_KEYS: ConfigurationKey[];
|
|
1405
1457
|
export type ConfigurationKey = (typeof CONFIGURATION_SCHEMAS)[number]['key'];
|
package/ConfigurationStore.js
CHANGED
|
@@ -20,13 +20,36 @@ import { privoSchema } from './PrivoConfiguration';
|
|
|
20
20
|
import { moderationSchema, } from './ModerationConfiguration';
|
|
21
21
|
import { WEB_CONFIG_SCHEMA, } from '@casual-simulation/aux-common';
|
|
22
22
|
import { WEB_MANIFEST_SCHEMA, } from '@casual-simulation/aux-common/common/WebManifest';
|
|
23
|
+
import z from 'zod';
|
|
23
24
|
import { STORED_AUX_SCHEMA } from './webhooks';
|
|
25
|
+
import { memoize } from 'es-toolkit';
|
|
24
26
|
export const SUBSCRIPTIONS_CONFIG_KEY = 'subscriptions';
|
|
25
27
|
export const PRIVO_CONFIG_KEY = 'privo';
|
|
26
28
|
export const MODERATION_CONFIG_KEY = 'moderation';
|
|
27
29
|
export const WEB_CONFIG_KEY = 'web';
|
|
28
30
|
export const PLAYER_WEB_MANIFEST_KEY = 'playerWebManifest';
|
|
29
31
|
export const AB1_BOOTSTRAP_KEY = 'ab1Bootstrap';
|
|
32
|
+
export const METADATA_KEY = 'metadata';
|
|
33
|
+
export const serverMetadataSchema = memoize(() => z.object({
|
|
34
|
+
frontendOrigin: z
|
|
35
|
+
.url()
|
|
36
|
+
.optional()
|
|
37
|
+
.nullable()
|
|
38
|
+
.describe('The HTTP origin that the CasualOS frontend (player) is available at.'),
|
|
39
|
+
apiOrigin: z
|
|
40
|
+
.string()
|
|
41
|
+
.describe('The HTTP origin that the API is available at.'),
|
|
42
|
+
websocketOrigin: z
|
|
43
|
+
.string()
|
|
44
|
+
.optional()
|
|
45
|
+
.nullable()
|
|
46
|
+
.describe('The HTTP origin that the Websocket API is available at.'),
|
|
47
|
+
websocketProtocol: z
|
|
48
|
+
.enum(['websocket', 'apiary-aws'])
|
|
49
|
+
.optional()
|
|
50
|
+
.nullable()
|
|
51
|
+
.describe('The protocol that should be used to connect to the websocket origin.'),
|
|
52
|
+
}));
|
|
30
53
|
export const CONFIGURATION_SCHEMAS = [
|
|
31
54
|
{
|
|
32
55
|
key: SUBSCRIPTIONS_CONFIG_KEY,
|
|
@@ -37,6 +60,7 @@ export const CONFIGURATION_SCHEMAS = [
|
|
|
37
60
|
{ key: WEB_CONFIG_KEY, schema: WEB_CONFIG_SCHEMA },
|
|
38
61
|
{ key: PLAYER_WEB_MANIFEST_KEY, schema: WEB_MANIFEST_SCHEMA },
|
|
39
62
|
{ key: AB1_BOOTSTRAP_KEY, schema: STORED_AUX_SCHEMA },
|
|
63
|
+
{ key: METADATA_KEY, schema: serverMetadataSchema() },
|
|
40
64
|
];
|
|
41
65
|
/**
|
|
42
66
|
* The schemas for the different configuration values.
|
|
@@ -48,6 +72,7 @@ export const CONFIGURATION_SCHEMAS_MAP = {
|
|
|
48
72
|
[WEB_CONFIG_KEY]: WEB_CONFIG_SCHEMA,
|
|
49
73
|
[PLAYER_WEB_MANIFEST_KEY]: WEB_MANIFEST_SCHEMA,
|
|
50
74
|
[AB1_BOOTSTRAP_KEY]: STORED_AUX_SCHEMA,
|
|
75
|
+
[METADATA_KEY]: serverMetadataSchema(),
|
|
51
76
|
};
|
|
52
77
|
export const CONFIGURATION_KEYS = CONFIGURATION_SCHEMAS.map((c) => c.key);
|
|
53
78
|
//# sourceMappingURL=ConfigurationStore.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigurationStore.js","sourceRoot":"","sources":["ConfigurationStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EACH,2BAA2B,GAE9B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,WAAW,EAA2B,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EACH,gBAAgB,GAEnB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACH,iBAAiB,GAEpB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACH,mBAAmB,GAEtB,MAAM,kDAAkD,CAAC;
|
|
1
|
+
{"version":3,"file":"ConfigurationStore.js","sourceRoot":"","sources":["ConfigurationStore.ts"],"names":[],"mappings":"A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YAAY,CAAC,CAAC;SACjC,QAAQ,EAAE;SACV,QAAQ,EAAE;SACV,QAAQ,CACL,sEAAsE,CACzE;CACR,CAAC,CACL,CAAC;AAwCF,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACjC;QACI,GAAG,EAAE,wBAAwB;QAC7B,MAAM,EAAE,2BAA2B,EAAE;KAC/B;IACV,EAAE,GAAG,EAAE,gBAAgB,EAAE,MAAM,EAAE,WAAW,EAAW;IACvD,EAAE,GAAG,EAAE,qBAAqB,EAAE,MAAM,EAAE,gBAAgB,EAAW;IACjE,EAAE,GAAG,EAAE,cAAc,EAAE,MAAM,EAAE,iBAAiB,EAAW;IAC3D,EAAE,GAAG,EAAE,uBAAuB,EAAE,MAAM,EAAE,mBAAmB,EAAW;IACtE,EAAE,GAAG,EAAE,iBAAiB,EAAE,MAAM,EAAE,iBAAiB,EAAW;IAC9D,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,EAAE,oBAAoB,EAAE,EAAW;CACjE,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACrC,CAAC,wBAAwB,CAAC,EAAE,2BAA2B,EAAE;IACzD,CAAC,gBAAgB,CAAC,EAAE,WAAW;IAC/B,CAAC,qBAAqB,CAAC,EAAE,gBAAgB;IACzC,CAAC,cAAc,CAAC,EAAE,iBAAiB;IACnC,CAAC,uBAAuB,CAAC,EAAE,mBAAmB;IAC9C,CAAC,iBAAiB,CAAC,EAAE,iBAAiB;IACtC,CAAC,YAAY,CAAC,EAAE,oBAAoB,EAAE;CACzC,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAuB,qBAAqB,CAAC,GAAG,CAC3E,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CACf,CAAC"}
|
package/MemoryStore.d.ts
CHANGED
|
@@ -67,6 +67,7 @@ export declare class MemoryStore implements AuthStore, RecordsStore, DataRecords
|
|
|
67
67
|
private _loadedPackages;
|
|
68
68
|
private _financialAccounts;
|
|
69
69
|
private _customDomains;
|
|
70
|
+
private _serverMetadata;
|
|
70
71
|
get aiOpenAIRealtimeMetrics(): AIOpenAIRealtimeMetrics[];
|
|
71
72
|
private _purchasedItems;
|
|
72
73
|
private _activationKeys;
|
package/MemoryStore.js
CHANGED
|
@@ -244,6 +244,9 @@ export class MemoryStore {
|
|
|
244
244
|
else if (key === 'ab1Bootstrap') {
|
|
245
245
|
this._ab1Bootstrap = finalValue;
|
|
246
246
|
}
|
|
247
|
+
else if (key === 'metadata') {
|
|
248
|
+
this._serverMetadata = finalValue;
|
|
249
|
+
}
|
|
247
250
|
else {
|
|
248
251
|
throw new Error('Unsupported configuration key: ' + key);
|
|
249
252
|
}
|
|
@@ -282,6 +285,12 @@ export class MemoryStore {
|
|
|
282
285
|
else if (key === 'ab1Bootstrap') {
|
|
283
286
|
return (this._ab1Bootstrap ?? null);
|
|
284
287
|
}
|
|
288
|
+
else if (key === 'metadata') {
|
|
289
|
+
return (this._serverMetadata ??
|
|
290
|
+
CONFIGURATION_SCHEMAS_MAP[key]
|
|
291
|
+
.nullable()
|
|
292
|
+
.parse(defaultValue ?? null));
|
|
293
|
+
}
|
|
285
294
|
else {
|
|
286
295
|
throw new Error('Unsupported configuration key: ' + key);
|
|
287
296
|
}
|
|
@@ -316,6 +325,7 @@ export class MemoryStore {
|
|
|
316
325
|
studioId: domain.studioId,
|
|
317
326
|
verificationKey: domain.verificationKey,
|
|
318
327
|
verified: domain.verified,
|
|
328
|
+
expectedHostName: domain.expectedHostName,
|
|
319
329
|
studio,
|
|
320
330
|
};
|
|
321
331
|
}
|
|
@@ -334,6 +344,7 @@ export class MemoryStore {
|
|
|
334
344
|
studioId: domain.studioId,
|
|
335
345
|
verificationKey: domain.verificationKey,
|
|
336
346
|
verified: domain.verified,
|
|
347
|
+
expectedHostName: domain.expectedHostName,
|
|
337
348
|
studio,
|
|
338
349
|
};
|
|
339
350
|
}
|