bruce-models 5.4.5 → 5.4.7

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.
@@ -0,0 +1,55 @@
1
+ import { Api } from "../api/api";
2
+ import { GuardianApi } from "../api/guardian-api";
3
+ /**
4
+ * Account templates are templates for sending emails to users.
5
+ * In the future it might also be tied to other communication, eg: SMS.
6
+ * When a template is not found then our hypeportal ones will be used as a fallback.
7
+ */
8
+ export declare namespace AccountTemplate {
9
+ interface ITemplate {
10
+ Key: string;
11
+ ID?: string;
12
+ Subject?: string;
13
+ Body?: string;
14
+ "ClientAccount.ID"?: string;
15
+ }
16
+ /**
17
+ * Known keywords that will be substituted in the template.
18
+ * A keyword must be surrounded by ${blah} in the template.
19
+ */
20
+ enum EKeyword {
21
+ AccountName = "ClientAccount.Name",
22
+ InvitedByUserName = "InvitedBy.User.FullName",
23
+ InvitedUserName = "Invited.User.FullName",
24
+ URL = "URL",
25
+ ActivationCode = "ActivationCode"
26
+ }
27
+ function GetList(params: {
28
+ accountId: string;
29
+ api?: GuardianApi.Api;
30
+ req?: Api.IReqParams;
31
+ }): Promise<{
32
+ templates: ITemplate[];
33
+ }>;
34
+ function Get(params: {
35
+ key: string;
36
+ accountId: string;
37
+ api?: GuardianApi.Api;
38
+ req?: Api.IReqParams;
39
+ }): Promise<{
40
+ template: ITemplate;
41
+ }>;
42
+ function Update(params: {
43
+ template: ITemplate;
44
+ api?: GuardianApi.Api;
45
+ req?: Api.IReqParams;
46
+ }): Promise<{
47
+ template: ITemplate;
48
+ }>;
49
+ function Delete(params: {
50
+ key: string;
51
+ accountId: string;
52
+ api?: GuardianApi.Api;
53
+ req?: Api.IReqParams;
54
+ }): Promise<void>;
55
+ }
@@ -0,0 +1,18 @@
1
+ import { Api } from "../api/api";
2
+ import { GuardianApi } from "../api/guardian-api";
3
+ /**
4
+ * An account type dictates limitations and available features.
5
+ * Eg: how many Entities an account can have.
6
+ */
7
+ export declare namespace AccountType {
8
+ interface IType {
9
+ ID: string;
10
+ Description: string;
11
+ }
12
+ function GetList(params: {
13
+ api?: GuardianApi.Api;
14
+ req?: Api.IReqParams;
15
+ }): Promise<{
16
+ types: IType[];
17
+ }>;
18
+ }
@@ -44,7 +44,8 @@ export declare namespace Account {
44
44
  enum EAppId {
45
45
  BruceApi = "BruceAPI",
46
46
  Navigator = "Navigator",
47
- Operator = "BruceClientAdmin"
47
+ Operator = "BruceClientAdmin",
48
+ UI = "UI"
48
49
  }
49
50
  type AppId = EAppId | string;
50
51
  /**
@@ -85,6 +86,7 @@ export declare namespace Account {
85
86
  * @returns
86
87
  */
87
88
  function GetRelatedList(params: {
89
+ owned?: boolean;
88
90
  api?: GuardianApi.Api;
89
91
  req?: Api.IReqParams;
90
92
  }): Promise<{
@@ -170,7 +172,7 @@ export declare namespace Account {
170
172
  * @param ssid
171
173
  * @returns
172
174
  */
173
- function GetListCacheKey(ssid: string): string;
175
+ function GetListCacheKey(ssid: string, owned?: boolean): string;
174
176
  /**
175
177
  * Returns cache identifier for a list of database regions.
176
178
  * Example: {
@@ -69,6 +69,8 @@ export * from "./account/account-settings";
69
69
  export * from "./account/account-invite";
70
70
  export * from "./account/account-features";
71
71
  export * from "./account/account-limits";
72
+ export * from "./account/account-template";
73
+ export * from "./account/account-type";
72
74
  export * from "./util/encrypt-utils";
73
75
  export * from "./util/math-utils";
74
76
  export * from "./util/object-utils";
@@ -90,4 +92,4 @@ export * from "./internal/uploader";
90
92
  export * from "./plugin/plugin";
91
93
  export * from "./environment";
92
94
  export * from "./data-source/data-source";
93
- export declare const VERSION = "5.4.5";
95
+ export declare const VERSION = "5.4.7";
@@ -90,4 +90,27 @@ export declare namespace UserGroup {
90
90
  }): Promise<{
91
91
  group: IGroup;
92
92
  }>;
93
+ /**
94
+ * Adds a user to specified groups.
95
+ * @param params
96
+ * @returns
97
+ */
98
+ function AddUser(params: {
99
+ userId: string;
100
+ groupIds: string[];
101
+ accountId: string;
102
+ api?: GuardianApi.Api;
103
+ req?: Api.IReqParams;
104
+ }): Promise<void>;
105
+ /**
106
+ * Removes a user from specified groups.
107
+ * @param params
108
+ */
109
+ function RemoveUser(params: {
110
+ userId: string;
111
+ groupIds: string[];
112
+ accountId: string;
113
+ api?: GuardianApi.Api;
114
+ req?: Api.IReqParams;
115
+ }): Promise<void>;
93
116
  }
@@ -66,6 +66,19 @@ export declare namespace User {
66
66
  }): Promise<{
67
67
  user: IUser;
68
68
  }>;
69
+ /**
70
+ * Creates a user record.
71
+ * This is not a user invitation, this creates a new user which you can then manage or invite yourself.
72
+ * TODO: The user should be tied to the client account's client and not the global list.
73
+ * @param params
74
+ */
75
+ function Create(params: {
76
+ api?: GuardianApi.Api;
77
+ user: IUser;
78
+ req?: Api.IReqParams;
79
+ }): Promise<{
80
+ user: IUser;
81
+ }>;
69
82
  /**
70
83
  * Loads settings for a given user + app.
71
84
  * The session's account id is used to separate settings between accounts.
@@ -116,9 +129,11 @@ export declare namespace User {
116
129
  * api.Cache.Remove(key);
117
130
  * }
118
131
  * @param accountId
132
+ * @param exclusive
133
+ * @param search
119
134
  * @returns
120
135
  */
121
- function GetListCacheKey(accountId: string): string;
136
+ function GetListCacheKey(accountId: string, exclusive?: boolean, search?: string): string;
122
137
  /**
123
138
  * Returns a user by their email address.
124
139
  * @param params
@@ -139,8 +154,9 @@ export declare namespace User {
139
154
  */
140
155
  function GetList(params: {
141
156
  api?: GuardianApi.Api;
142
- accountId: string;
157
+ accountId?: string;
143
158
  exclusive?: boolean;
159
+ search?: string;
144
160
  req?: Api.IReqParams;
145
161
  }): Promise<{
146
162
  users: IUser[];
@@ -253,6 +269,17 @@ export declare namespace User {
253
269
  user: IUser;
254
270
  }>;
255
271
  }
272
+ /**
273
+ * Updates the password for a user by supplying the existing and new password.
274
+ * @param params
275
+ */
276
+ function UpdatePassword(params: {
277
+ userId: string;
278
+ passwordCurrent: string;
279
+ passwordNew: string;
280
+ api?: GuardianApi.Api;
281
+ req?: Api.IReqParams;
282
+ }): Promise<void>;
256
283
  /**
257
284
  * Returns cache identifier for a user.
258
285
  * Example: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bruce-models",
3
- "version": "5.4.5",
3
+ "version": "5.4.7",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "main": "dist/bruce-models.umd.js",