@kedaruma/revlm-client 1.0.30 → 1.0.35
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/dist/index.d.mts +18 -11
- package/dist/index.d.ts +18 -11
- package/dist/index.js +4 -4
- package/dist/index.mjs +3 -3
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
import { User as User$1 } from '@kedaruma/revlm-shared/models/user-types';
|
|
1
|
+
import { User as User$1, UserBase as UserBase$1 } from '@kedaruma/revlm-shared/models/user-types';
|
|
2
2
|
import * as bson from 'bson';
|
|
3
3
|
import { Timestamp, Long } from 'bson';
|
|
4
4
|
|
|
5
|
+
type ReadonlyExcept<T, K extends keyof T> = {
|
|
6
|
+
readonly [P in Exclude<keyof T, K>]: T[P];
|
|
7
|
+
} & {
|
|
8
|
+
[P in K]: T[P];
|
|
9
|
+
};
|
|
10
|
+
type UserBase = ReadonlyExcept<UserBase$1, "userType" | "roles">;
|
|
11
|
+
type User = ReadonlyExcept<User$1, "userType" | "roles">;
|
|
5
12
|
type RevlmErrorResponse = {
|
|
6
13
|
ok: false;
|
|
7
14
|
error: string;
|
|
@@ -12,7 +19,7 @@ type RevlmErrorResponse = {
|
|
|
12
19
|
type LoginSuccess = {
|
|
13
20
|
ok: true;
|
|
14
21
|
token: string;
|
|
15
|
-
user: User
|
|
22
|
+
user: User;
|
|
16
23
|
};
|
|
17
24
|
type LoginResponse = LoginSuccess | RevlmErrorResponse;
|
|
18
25
|
type ProvisionalLoginSuccess = {
|
|
@@ -23,7 +30,7 @@ type ProvisionalLoginSuccess = {
|
|
|
23
30
|
type ProvisionalLoginResponse = ProvisionalLoginSuccess | RevlmErrorResponse;
|
|
24
31
|
type RegisterUserSuccess = {
|
|
25
32
|
ok: true;
|
|
26
|
-
user: User
|
|
33
|
+
user: User;
|
|
27
34
|
};
|
|
28
35
|
type RegisterUserResponse = RegisterUserSuccess | RevlmErrorResponse;
|
|
29
36
|
type DeleteUserSuccess = {
|
|
@@ -228,7 +235,7 @@ declare class MongoDBService {
|
|
|
228
235
|
declare class Credentials {
|
|
229
236
|
static emailPassword(email: string, password: string): EmailPasswordCredential;
|
|
230
237
|
}
|
|
231
|
-
declare class
|
|
238
|
+
declare class RevlmUser {
|
|
232
239
|
private _app;
|
|
233
240
|
private _token;
|
|
234
241
|
private _profile;
|
|
@@ -253,13 +260,13 @@ declare class App {
|
|
|
253
260
|
constructor(baseUrl: string, opts?: RevlmOptions & {
|
|
254
261
|
id?: string;
|
|
255
262
|
});
|
|
256
|
-
get currentUser():
|
|
257
|
-
get allUsers(): Record<string,
|
|
258
|
-
logIn(cred: EmailPasswordCredential): Promise<
|
|
259
|
-
switchUser(user:
|
|
260
|
-
removeUser(user:
|
|
263
|
+
get currentUser(): RevlmUser | null;
|
|
264
|
+
get allUsers(): Record<string, RevlmUser>;
|
|
265
|
+
logIn(cred: EmailPasswordCredential): Promise<RevlmUser>;
|
|
266
|
+
switchUser(user: RevlmUser): RevlmUser;
|
|
267
|
+
removeUser(user: RevlmUser): Promise<void>;
|
|
261
268
|
logOut(): Promise<void>;
|
|
262
|
-
deleteUser(user:
|
|
269
|
+
deleteUser(user: RevlmUser): Promise<void>;
|
|
263
270
|
}
|
|
264
271
|
|
|
265
272
|
declare const ObjectId: typeof bson.ObjectId;
|
|
@@ -268,4 +275,4 @@ declare const BSON: typeof bson & {
|
|
|
268
275
|
ObjectID: typeof bson.ObjectId;
|
|
269
276
|
};
|
|
270
277
|
|
|
271
|
-
export { type AggregatePipelineStage, App, BSON, type BaseChangeEvent, type ChangeEvent, type ChangeEventId, type CountOptions, Credentials, type DeleteEvent, type DeleteResult, type DeleteUserResponse, type DeleteUserSuccess, type Document, type DocumentKey, type DocumentNamespace, type DropDatabaseEvent, type DropEvent, type Filter, type FindOneAndModifyOptions, type FindOneOptions, type FindOptions, type InsertEvent, type InsertManyResult, type InsertOneResult, type InvalidateEvent, type LoginResponse, type LoginSuccess, MdbCollection, MongoDBService, type NewDocument, ObjectID, ObjectId, type OperationType, type ProvisionalLoginResponse, type ProvisionalLoginSuccess, type RegisterUserResponse, type RegisterUserSuccess, type RenameEvent, type ReplaceEvent, Revlm, RevlmDBDatabase, type RevlmErrorResponse, type RevlmOptions, type RevlmResponse, type Update, type UpdateDescription, type UpdateEvent, type UpdateOptions, type UpdateResult, User, type WatchOptionsFilter, type WatchOptionsIds };
|
|
278
|
+
export { type AggregatePipelineStage, App, BSON, type BaseChangeEvent, type ChangeEvent, type ChangeEventId, type CountOptions, Credentials, type DeleteEvent, type DeleteResult, type DeleteUserResponse, type DeleteUserSuccess, type Document, type DocumentKey, type DocumentNamespace, type DropDatabaseEvent, type DropEvent, type Filter, type FindOneAndModifyOptions, type FindOneOptions, type FindOptions, type InsertEvent, type InsertManyResult, type InsertOneResult, type InvalidateEvent, type LoginResponse, type LoginSuccess, MdbCollection, MongoDBService, type NewDocument, ObjectID, ObjectId, type OperationType, type ProvisionalLoginResponse, type ProvisionalLoginSuccess, type RegisterUserResponse, type RegisterUserSuccess, type RenameEvent, type ReplaceEvent, Revlm, RevlmDBDatabase, type RevlmErrorResponse, type RevlmOptions, type RevlmResponse, RevlmUser, type Update, type UpdateDescription, type UpdateEvent, type UpdateOptions, type UpdateResult, type User, type UserBase, type WatchOptionsFilter, type WatchOptionsIds };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
import { User as User$1 } from '@kedaruma/revlm-shared/models/user-types';
|
|
1
|
+
import { User as User$1, UserBase as UserBase$1 } from '@kedaruma/revlm-shared/models/user-types';
|
|
2
2
|
import * as bson from 'bson';
|
|
3
3
|
import { Timestamp, Long } from 'bson';
|
|
4
4
|
|
|
5
|
+
type ReadonlyExcept<T, K extends keyof T> = {
|
|
6
|
+
readonly [P in Exclude<keyof T, K>]: T[P];
|
|
7
|
+
} & {
|
|
8
|
+
[P in K]: T[P];
|
|
9
|
+
};
|
|
10
|
+
type UserBase = ReadonlyExcept<UserBase$1, "userType" | "roles">;
|
|
11
|
+
type User = ReadonlyExcept<User$1, "userType" | "roles">;
|
|
5
12
|
type RevlmErrorResponse = {
|
|
6
13
|
ok: false;
|
|
7
14
|
error: string;
|
|
@@ -12,7 +19,7 @@ type RevlmErrorResponse = {
|
|
|
12
19
|
type LoginSuccess = {
|
|
13
20
|
ok: true;
|
|
14
21
|
token: string;
|
|
15
|
-
user: User
|
|
22
|
+
user: User;
|
|
16
23
|
};
|
|
17
24
|
type LoginResponse = LoginSuccess | RevlmErrorResponse;
|
|
18
25
|
type ProvisionalLoginSuccess = {
|
|
@@ -23,7 +30,7 @@ type ProvisionalLoginSuccess = {
|
|
|
23
30
|
type ProvisionalLoginResponse = ProvisionalLoginSuccess | RevlmErrorResponse;
|
|
24
31
|
type RegisterUserSuccess = {
|
|
25
32
|
ok: true;
|
|
26
|
-
user: User
|
|
33
|
+
user: User;
|
|
27
34
|
};
|
|
28
35
|
type RegisterUserResponse = RegisterUserSuccess | RevlmErrorResponse;
|
|
29
36
|
type DeleteUserSuccess = {
|
|
@@ -228,7 +235,7 @@ declare class MongoDBService {
|
|
|
228
235
|
declare class Credentials {
|
|
229
236
|
static emailPassword(email: string, password: string): EmailPasswordCredential;
|
|
230
237
|
}
|
|
231
|
-
declare class
|
|
238
|
+
declare class RevlmUser {
|
|
232
239
|
private _app;
|
|
233
240
|
private _token;
|
|
234
241
|
private _profile;
|
|
@@ -253,13 +260,13 @@ declare class App {
|
|
|
253
260
|
constructor(baseUrl: string, opts?: RevlmOptions & {
|
|
254
261
|
id?: string;
|
|
255
262
|
});
|
|
256
|
-
get currentUser():
|
|
257
|
-
get allUsers(): Record<string,
|
|
258
|
-
logIn(cred: EmailPasswordCredential): Promise<
|
|
259
|
-
switchUser(user:
|
|
260
|
-
removeUser(user:
|
|
263
|
+
get currentUser(): RevlmUser | null;
|
|
264
|
+
get allUsers(): Record<string, RevlmUser>;
|
|
265
|
+
logIn(cred: EmailPasswordCredential): Promise<RevlmUser>;
|
|
266
|
+
switchUser(user: RevlmUser): RevlmUser;
|
|
267
|
+
removeUser(user: RevlmUser): Promise<void>;
|
|
261
268
|
logOut(): Promise<void>;
|
|
262
|
-
deleteUser(user:
|
|
269
|
+
deleteUser(user: RevlmUser): Promise<void>;
|
|
263
270
|
}
|
|
264
271
|
|
|
265
272
|
declare const ObjectId: typeof bson.ObjectId;
|
|
@@ -268,4 +275,4 @@ declare const BSON: typeof bson & {
|
|
|
268
275
|
ObjectID: typeof bson.ObjectId;
|
|
269
276
|
};
|
|
270
277
|
|
|
271
|
-
export { type AggregatePipelineStage, App, BSON, type BaseChangeEvent, type ChangeEvent, type ChangeEventId, type CountOptions, Credentials, type DeleteEvent, type DeleteResult, type DeleteUserResponse, type DeleteUserSuccess, type Document, type DocumentKey, type DocumentNamespace, type DropDatabaseEvent, type DropEvent, type Filter, type FindOneAndModifyOptions, type FindOneOptions, type FindOptions, type InsertEvent, type InsertManyResult, type InsertOneResult, type InvalidateEvent, type LoginResponse, type LoginSuccess, MdbCollection, MongoDBService, type NewDocument, ObjectID, ObjectId, type OperationType, type ProvisionalLoginResponse, type ProvisionalLoginSuccess, type RegisterUserResponse, type RegisterUserSuccess, type RenameEvent, type ReplaceEvent, Revlm, RevlmDBDatabase, type RevlmErrorResponse, type RevlmOptions, type RevlmResponse, type Update, type UpdateDescription, type UpdateEvent, type UpdateOptions, type UpdateResult, User, type WatchOptionsFilter, type WatchOptionsIds };
|
|
278
|
+
export { type AggregatePipelineStage, App, BSON, type BaseChangeEvent, type ChangeEvent, type ChangeEventId, type CountOptions, Credentials, type DeleteEvent, type DeleteResult, type DeleteUserResponse, type DeleteUserSuccess, type Document, type DocumentKey, type DocumentNamespace, type DropDatabaseEvent, type DropEvent, type Filter, type FindOneAndModifyOptions, type FindOneOptions, type FindOptions, type InsertEvent, type InsertManyResult, type InsertOneResult, type InvalidateEvent, type LoginResponse, type LoginSuccess, MdbCollection, MongoDBService, type NewDocument, ObjectID, ObjectId, type OperationType, type ProvisionalLoginResponse, type ProvisionalLoginSuccess, type RegisterUserResponse, type RegisterUserSuccess, type RenameEvent, type ReplaceEvent, Revlm, RevlmDBDatabase, type RevlmErrorResponse, type RevlmOptions, type RevlmResponse, RevlmUser, type Update, type UpdateDescription, type UpdateEvent, type UpdateOptions, type UpdateResult, type User, type UserBase, type WatchOptionsFilter, type WatchOptionsIds };
|
package/dist/index.js
CHANGED
|
@@ -39,7 +39,7 @@ __export(index_exports, {
|
|
|
39
39
|
ObjectId: () => ObjectId2,
|
|
40
40
|
Revlm: () => Revlm,
|
|
41
41
|
RevlmDBDatabase: () => RevlmDBDatabase,
|
|
42
|
-
|
|
42
|
+
RevlmUser: () => RevlmUser
|
|
43
43
|
});
|
|
44
44
|
module.exports = __toCommonJS(index_exports);
|
|
45
45
|
|
|
@@ -327,7 +327,7 @@ var Credentials = class {
|
|
|
327
327
|
return { type: "emailPassword", email, password };
|
|
328
328
|
}
|
|
329
329
|
};
|
|
330
|
-
var
|
|
330
|
+
var RevlmUser = class {
|
|
331
331
|
_app;
|
|
332
332
|
_token;
|
|
333
333
|
_profile;
|
|
@@ -400,7 +400,7 @@ var App = class {
|
|
|
400
400
|
throw err;
|
|
401
401
|
}
|
|
402
402
|
this.__revlm.setToken(res.token);
|
|
403
|
-
const user = new
|
|
403
|
+
const user = new RevlmUser(this, res.token, res.user);
|
|
404
404
|
const userId = user.id || "current";
|
|
405
405
|
this._users[userId] = user;
|
|
406
406
|
this._currentUser = user;
|
|
@@ -449,5 +449,5 @@ var BSON = Object.assign({}, bson, { ObjectID: bson.ObjectId });
|
|
|
449
449
|
ObjectId,
|
|
450
450
|
Revlm,
|
|
451
451
|
RevlmDBDatabase,
|
|
452
|
-
|
|
452
|
+
RevlmUser
|
|
453
453
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -284,7 +284,7 @@ var Credentials = class {
|
|
|
284
284
|
return { type: "emailPassword", email, password };
|
|
285
285
|
}
|
|
286
286
|
};
|
|
287
|
-
var
|
|
287
|
+
var RevlmUser = class {
|
|
288
288
|
_app;
|
|
289
289
|
_token;
|
|
290
290
|
_profile;
|
|
@@ -357,7 +357,7 @@ var App = class {
|
|
|
357
357
|
throw err;
|
|
358
358
|
}
|
|
359
359
|
this.__revlm.setToken(res.token);
|
|
360
|
-
const user = new
|
|
360
|
+
const user = new RevlmUser(this, res.token, res.user);
|
|
361
361
|
const userId = user.id || "current";
|
|
362
362
|
this._users[userId] = user;
|
|
363
363
|
this._currentUser = user;
|
|
@@ -405,5 +405,5 @@ export {
|
|
|
405
405
|
ObjectId2 as ObjectId,
|
|
406
406
|
Revlm,
|
|
407
407
|
RevlmDBDatabase,
|
|
408
|
-
|
|
408
|
+
RevlmUser
|
|
409
409
|
};
|