Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reflect user.data to currentUser.value.data #1956

Merged
merged 3 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion addons/dexie-cloud/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dexie-cloud-addon",
"version": "4.0.2",
"version": "4.0.3",
"description": "Dexie addon that syncs with to Dexie Cloud",
"main": "dist/umd/dexie-cloud-addon.js",
"type": "module",
Expand Down
4 changes: 4 additions & 0 deletions addons/dexie-cloud/src/authentication/authenticate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ export async function refreshAccessToken(
if (response.userValidUntil != null) {
login.license.validUntil = new Date(response.userValidUntil);
}
if (response.data) {
login.data = response.data;
}
return login;
}

Expand Down Expand Up @@ -208,6 +211,7 @@ async function userAuthenticate(
type: response2.userType,
status: response2.claims.license || 'ok',
}
context.data = response2.data;
if (response2.evalDaysLeft != null) {
context.license.evalDaysLeft = response2.evalDaysLeft;
}
Expand Down
1 change: 1 addition & 0 deletions addons/dexie-cloud/src/db/entities/UserLogin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ export interface UserLogin {
nonExportablePrivateKey?: CryptoKey;
publicKey?: CryptoKey;
isLoggedIn?: boolean;
data?: any; // From user data
}
1 change: 1 addition & 0 deletions addons/dexie-cloud/src/sync/connectWebSocket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ export function connectWebSocket(db: DexieCloudDB) {
accessTokenExpiration: refreshedLogin.accessTokenExpiration,
claims: refreshedLogin.claims,
license: refreshedLogin.license,
data: refreshedLogin.data
});
}),
switchMap(() => createObservable())
Expand Down
1 change: 1 addition & 0 deletions addons/dexie-cloud/src/sync/messagesFromServerQueue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ export function MessagesFromServerConsumer(db: DexieCloudDB) {
accessTokenExpiration: refreshedLogin.accessTokenExpiration,
claims: refreshedLogin.claims,
license: refreshedLogin.license,
data: refreshedLogin.data,
});
// Updating $logins will trigger emission of db.cloud.currentUser observable, which
// in turn will lead to that connectWebSocket.ts will reconnect the socket with the
Expand Down
2 changes: 1 addition & 1 deletion libs/dexie-cloud-common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dexie-cloud-common",
"version": "1.0.32",
"version": "1.0.33",
"description": "Library for shared code between dexie-cloud-addon, dexie-cloud (CLI) and dexie-cloud-server",
"type": "module",
"module": "dist/index.js",
Expand Down
1 change: 1 addition & 0 deletions libs/dexie-cloud-common/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export interface TokenFinalResponse {
message: string;
messageParams?: { [param: string]: string };
}[];
data?: any;
}

export interface TokenOtpSentResponse {
Expand Down