@bwi-mentorspaces/application-utils-npm 0.0.12 → 0.0.13
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.
|
@@ -38,6 +38,23 @@ export declare class StreamUser extends StreamBase implements IStreamUser {
|
|
|
38
38
|
* @returns {Promise<boolean>} promise of the type boolean
|
|
39
39
|
*/
|
|
40
40
|
partialUpdateUsers(usersUpdate: PartialUserUpdate[]): Promise<boolean>;
|
|
41
|
+
/**
|
|
42
|
+
* Create GetStream user
|
|
43
|
+
*
|
|
44
|
+
* @param {userRef} userRef the MS userRef
|
|
45
|
+
* @param {info} userInfo user info object
|
|
46
|
+
* @returns {Promise<boolean>} promise of the type boolean
|
|
47
|
+
*/
|
|
48
|
+
createUser(userRef: string, userInfo: User): Promise<boolean>;
|
|
49
|
+
/**
|
|
50
|
+
* Delete stream user
|
|
51
|
+
* https://getstream.io/chat/docs/node/update_users/?language=javascript#delete-a-user
|
|
52
|
+
*
|
|
53
|
+
* @param {User} user user id (uuid) to be deleted
|
|
54
|
+
* @param {boolean} isHard Boolean to make operator a hard delete or not
|
|
55
|
+
* @returns {Promise<boolean>} promise of the type boolean
|
|
56
|
+
*/
|
|
57
|
+
deleteUser(user: User, isHard?: boolean): Promise<boolean>;
|
|
41
58
|
/**
|
|
42
59
|
* Query stream users.
|
|
43
60
|
*
|
|
@@ -70,6 +70,58 @@ class StreamUser extends stream_base_1.StreamBase {
|
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* Create GetStream user
|
|
75
|
+
*
|
|
76
|
+
* @param {userRef} userRef the MS userRef
|
|
77
|
+
* @param {info} userInfo user info object
|
|
78
|
+
* @returns {Promise<boolean>} promise of the type boolean
|
|
79
|
+
*/
|
|
80
|
+
createUser(userRef, userInfo) {
|
|
81
|
+
const _super = Object.create(null, {
|
|
82
|
+
server: { get: () => super.server }
|
|
83
|
+
});
|
|
84
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
85
|
+
const payload = userInfo;
|
|
86
|
+
payload.id = userRef;
|
|
87
|
+
payload.role = "user";
|
|
88
|
+
const r = yield _super.server.upsertUser(payload);
|
|
89
|
+
//check the result
|
|
90
|
+
if (r) {
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Delete stream user
|
|
100
|
+
* https://getstream.io/chat/docs/node/update_users/?language=javascript#delete-a-user
|
|
101
|
+
*
|
|
102
|
+
* @param {User} user user id (uuid) to be deleted
|
|
103
|
+
* @param {boolean} isHard Boolean to make operator a hard delete or not
|
|
104
|
+
* @returns {Promise<boolean>} promise of the type boolean
|
|
105
|
+
*/
|
|
106
|
+
deleteUser(user, isHard) {
|
|
107
|
+
const _super = Object.create(null, {
|
|
108
|
+
server: { get: () => super.server }
|
|
109
|
+
});
|
|
110
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
111
|
+
//Execute the sync
|
|
112
|
+
const r = yield _super.server.deleteUser(user.id, {
|
|
113
|
+
hard_delete: isHard,
|
|
114
|
+
delete_conversation_channels: true
|
|
115
|
+
});
|
|
116
|
+
//check the result
|
|
117
|
+
if (r) {
|
|
118
|
+
return true;
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
return false;
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
}
|
|
73
125
|
/**
|
|
74
126
|
* Query stream users.
|
|
75
127
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream.user.js","sourceRoot":"","sources":["../../../chat/stream/stream.user.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,+CAA2C;AAiB3C;;GAEG;AACH,MAAa,UAAW,SAAQ,wBAAU;IACtC,aAAa;IAEb;;;;OAIG;IACH,YAAY,MAAkB;QAC1B,KAAK,EAAE,CAAC;QACR,KAA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AAC;YAE9C,OAAO,CAAC,CAAC,KAAK,CAAC;QACnB,CAAC;KAAA;CACJ;AAxGD,gCAwGC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bwi-mentorspaces/application-utils-npm",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.13",
|
|
4
4
|
"description": "Mentor Spaces npm packages for reusable models, utils, and abstracted, commonly used processes for DB Repo, Logging, etc.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Mentor Spaces",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"compile": "tsc --build",
|
|
14
14
|
"test": "jest",
|
|
15
15
|
"build:local": "npm-run-all clean lint compile",
|
|
16
|
-
"build": "npm-run-all clean
|
|
16
|
+
"build": "npm-run-all clean patch compile",
|
|
17
17
|
"deploy": "npm publish .dist --access public"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|