@casual-simulation/aux-records 3.2.19 → 3.3.0-alpha.8545776335
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/AuthController.d.ts +48 -2
- package/AuthController.js +92 -11
- package/AuthController.js.map +1 -1
- package/AuthStore.d.ts +9 -0
- package/RecordsClient.d.ts +1 -0
- package/RecordsClient.js +17 -2
- package/RecordsClient.js.map +1 -1
- package/RecordsServer.d.ts +9 -0
- package/RecordsServer.js +30 -8
- package/RecordsServer.js.map +1 -1
- package/package.json +3 -3
package/RecordsServer.js
CHANGED
|
@@ -22,7 +22,7 @@ import { parseInstancesList, tryDecodeUriComponent, tryParseJson, } from './Util
|
|
|
22
22
|
import { INVALID_REQUEST_ERROR_MESSAGE, MAX_EMAIL_ADDRESS_LENGTH, MAX_SMS_ADDRESS_LENGTH, PRIVO_OPEN_ID_PROVIDER, } from './AuthController';
|
|
23
23
|
import { parseSessionKey } from './AuthUtils';
|
|
24
24
|
import { z } from 'zod';
|
|
25
|
-
import { AVAILABLE_PERMISSIONS_VALIDATION, RESOURCE_KIND_VALIDATION, procedure, } from '@casual-simulation/aux-common';
|
|
25
|
+
import { AVAILABLE_PERMISSIONS_VALIDATION, RESOURCE_KIND_VALIDATION, getProcedureMetadata, procedure, } from '@casual-simulation/aux-common';
|
|
26
26
|
import { AI_CHAT_MESSAGE_SCHEMA } from './AIChatInterface';
|
|
27
27
|
import { WebsocketEventTypes, websocketEventSchema, websocketRequestMessageSchema, } from '@casual-simulation/aux-common/websockets/WebsocketEvents';
|
|
28
28
|
import { DEFAULT_BRANCH_NAME } from '@casual-simulation/aux-common';
|
|
@@ -364,6 +364,24 @@ export class RecordsServer {
|
|
|
364
364
|
.handler(({ displayName, name }) => __awaiter(this, void 0, void 0, function* () {
|
|
365
365
|
return yield this._auth.isValidDisplayName(displayName, name);
|
|
366
366
|
})),
|
|
367
|
+
createAccount: procedure()
|
|
368
|
+
.origins('account')
|
|
369
|
+
.http('POST', '/api/v2/createAccount')
|
|
370
|
+
.inputs(z.object({}))
|
|
371
|
+
.handler(({}, context) => __awaiter(this, void 0, void 0, function* () {
|
|
372
|
+
const validation = yield this._validateSessionKey(context.sessionKey);
|
|
373
|
+
if (validation.success === false) {
|
|
374
|
+
if (validation.errorCode === 'no_session_key') {
|
|
375
|
+
return NOT_LOGGED_IN_RESULT;
|
|
376
|
+
}
|
|
377
|
+
return validation;
|
|
378
|
+
}
|
|
379
|
+
const result = yield this._auth.createAccount({
|
|
380
|
+
userId: validation.userId,
|
|
381
|
+
ipAddress: context.ipAddress,
|
|
382
|
+
});
|
|
383
|
+
return result;
|
|
384
|
+
})),
|
|
367
385
|
listSessions: procedure()
|
|
368
386
|
.origins('account')
|
|
369
387
|
.http('GET', '/api/v2/sessions')
|
|
@@ -911,12 +929,7 @@ export class RecordsServer {
|
|
|
911
929
|
recordName: RECORD_NAME_VALIDATION,
|
|
912
930
|
address: ADDRESS_VALIDATION.nullable().optional(),
|
|
913
931
|
marker: MARKER_VALIDATION.optional(),
|
|
914
|
-
sort: z
|
|
915
|
-
.union([
|
|
916
|
-
z.literal('ascending'),
|
|
917
|
-
z.literal('descending'),
|
|
918
|
-
])
|
|
919
|
-
.optional(),
|
|
932
|
+
sort: z.enum(['ascending', 'descending']).optional(),
|
|
920
933
|
instances: INSTANCES_ARRAY_VALIDATION.optional(),
|
|
921
934
|
}))
|
|
922
935
|
.handler(({ recordName, address, instances, marker, sort }, context) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -1573,7 +1586,7 @@ export class RecordsServer {
|
|
|
1573
1586
|
.origins('api')
|
|
1574
1587
|
.http('GET', '/api/v2/studios/list')
|
|
1575
1588
|
.inputs(z.object({
|
|
1576
|
-
comId: z.string().nonempty().optional(),
|
|
1589
|
+
comId: z.string().nonempty().nullable().optional(),
|
|
1577
1590
|
}))
|
|
1578
1591
|
.handler(({ comId }, context) => __awaiter(this, void 0, void 0, function* () {
|
|
1579
1592
|
const sessionKeyValidation = yield this._validateSessionKey(context.sessionKey);
|
|
@@ -1934,6 +1947,15 @@ export class RecordsServer {
|
|
|
1934
1947
|
const data = yield this._websocketController.getBranchData(userId, recordName !== null && recordName !== void 0 ? recordName : null, inst, branch);
|
|
1935
1948
|
return Object.assign({ success: true }, data);
|
|
1936
1949
|
})),
|
|
1950
|
+
listProcedures: procedure()
|
|
1951
|
+
.origins(true)
|
|
1952
|
+
.http('GET', '/api/v2/procedures')
|
|
1953
|
+
.inputs(z.object({}))
|
|
1954
|
+
.handler(({}, context) => __awaiter(this, void 0, void 0, function* () {
|
|
1955
|
+
const procedures = this._procedures;
|
|
1956
|
+
const metadata = getProcedureMetadata(procedures);
|
|
1957
|
+
return Object.assign({ success: true }, metadata);
|
|
1958
|
+
})),
|
|
1937
1959
|
};
|
|
1938
1960
|
}
|
|
1939
1961
|
_setupRoutes() {
|