Skip to content

Commit 4a32656

Browse files
committed
Update PersistentConfigBacker implementation for changes in MPS.
1 parent 7641aba commit 4a32656

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

src/Interface/MatrixData.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ import {
2121
resultifyBotSDKRequestErrorWith404AsUndefined,
2222
} from '../Client/BotSDKBaseClient';
2323

24-
export class BotSDKAccountDataConfigBackend<T>
25-
implements PersistentConfigBackend<T>
24+
export class BotSDKAccountDataConfigBackend<
25+
TEncodedShape extends Record<string, unknown> = Record<string, unknown>
26+
> implements PersistentConfigBackend<TEncodedShape>
2627
{
2728
constructor(
2829
private readonly client: MatrixSendClient,
29-
private readonly eventType: string,
30-
private readonly eventSchema: Parameters<(typeof Value)['Decode']>[0]
30+
private readonly eventType: string
3131
) {
3232
// nothing to do.
3333
}
@@ -42,13 +42,11 @@ export class BotSDKAccountDataConfigBackend<T>
4242
resultifyBotSDKRequestErrorWith404AsUndefined
4343
);
4444
}
45-
public async saveConfig(data: T): Promise<ActionResult<void>> {
46-
const encodeData = Value.Encode(this.eventSchema, data);
47-
if (isError(encodeData)) {
48-
return encodeData;
49-
}
45+
public async saveEncodedConfig(
46+
data: TEncodedShape
47+
): Promise<ActionResult<void>> {
5048
return await this.client
51-
.setAccountData(this.eventType, encodeData.ok)
49+
.setAccountData(this.eventType, data)
5250
.then((_) => Ok(undefined), resultifyBotSDKRequestError);
5351
}
5452
public async saveUnparsedConfig(

0 commit comments

Comments
 (0)