@staticbackend/backend 1.5.0-alpha.0 → 1.5.0

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/backend.d.ts CHANGED
@@ -61,6 +61,18 @@ export declare class Backend {
61
61
  ok: boolean;
62
62
  content: any;
63
63
  }>;
64
+ addUser(token: string, email: string, password: string): Promise<{
65
+ ok: boolean;
66
+ content: any;
67
+ }>;
68
+ removeUser(token: string, userId: string): Promise<{
69
+ ok: boolean;
70
+ content: any;
71
+ }>;
72
+ users(token: string): Promise<{
73
+ ok: boolean;
74
+ content: any;
75
+ }>;
64
76
  cacheGet(rootToken: string, key: string): Promise<{
65
77
  ok: boolean;
66
78
  content: any;
@@ -157,6 +169,10 @@ export declare class Backend {
157
169
  ok: boolean;
158
170
  content: any;
159
171
  }>;
172
+ publish(token: string, channel: string, type: string, data: any): Promise<{
173
+ ok: boolean;
174
+ content: any;
175
+ }>;
160
176
  sudoSendSMS(rootToken: string, data: SMSData): Promise<{
161
177
  ok: boolean;
162
178
  content: any;
package/dist/backend.js CHANGED
@@ -108,6 +108,22 @@ class Backend {
108
108
  return yield this.req(token, "GET", "/me");
109
109
  });
110
110
  }
111
+ addUser(token, email, password) {
112
+ return __awaiter(this, void 0, void 0, function* () {
113
+ const body = { email: email, password: password };
114
+ return yield this.req(token, "POST", "/account/users", body);
115
+ });
116
+ }
117
+ removeUser(token, userId) {
118
+ return __awaiter(this, void 0, void 0, function* () {
119
+ return yield this.req(token, "DELETE", `/account/users/${userId}`);
120
+ });
121
+ }
122
+ users(token) {
123
+ return __awaiter(this, void 0, void 0, function* () {
124
+ return yield this.req(token, "GET", "/account/users");
125
+ });
126
+ }
111
127
  cacheGet(rootToken, key) {
112
128
  return __awaiter(this, void 0, void 0, function* () {
113
129
  return yield this.req(rootToken, "GET", `/sudo/cache?key=${key}`);
@@ -250,6 +266,16 @@ class Backend {
250
266
  return yield this.req(token, "POST", "/extra/htmltox", data);
251
267
  });
252
268
  }
269
+ publish(token, channel, type, data) {
270
+ return __awaiter(this, void 0, void 0, function* () {
271
+ const payload = {
272
+ channel: channel,
273
+ type: type,
274
+ data: data,
275
+ };
276
+ return yield this.req(token, "POST", "/publish", payload);
277
+ });
278
+ }
253
279
  sudoSendSMS(rootToken, data) {
254
280
  return __awaiter(this, void 0, void 0, function* () {
255
281
  return yield this.req(rootToken, "POST", "/extra/sms", data);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staticbackend/backend",
3
- "version": "1.5.0-alpha.0",
3
+ "version": "1.5.0",
4
4
  "description": "Client library for StaticBackend API",
5
5
  "main": "./dist/index.js",
6
6
  "scripts": {