insite-users-client 2.3.4 → 2.4.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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2024 Eugene Nesvetaev
3
+ Copyright (c) 2026 Eugene Nesvetaev
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,13 +1,259 @@
1
- # inSite users client side
1
+ # insite-users-client
2
+
3
+ Client-side library for users, organizations, and roles in inSite. Subscribes to publications over WebSocket and wires data into reactive structures (orgs, users, current user) with automatic cross-linking and sync.
4
+
5
+ Part of [inSite](../../README.md) — requires [insite-ws](../ws/README.md) and [insite-subscriptions-client](../subscriptions-client/README.md).
2
6
 
3
7
  ## Installation
4
8
 
5
9
  ```sh
6
- $ npm install insite-users-client
10
+ npm install insite-users-client
7
11
  ```
8
12
 
9
- Or
13
+ Or:
10
14
 
11
15
  ```sh
12
- $ bun add insite-users-client
16
+ bun add insite-users-client
17
+ ```
18
+
19
+ ## Setup
20
+
21
+ Before using this package, bind the subscription protocol to your WebSocket instance:
22
+
23
+ ```ts
24
+ import { WS } from "insite-ws/client";
25
+ import { Subscription } from "insite-subscriptions-client";
26
+
27
+ const ws = new WS({ url: "wss://example.com" });
28
+ Subscription.bindTo(ws);
29
+ ```
30
+
31
+ `Subscription.bindTo(ws)` wires subscriptions to the given `WS` instance. Without it, creating a `UsersSubscriptionGroup` will throw.
32
+
33
+ ## Overview
34
+
35
+ **UsersSubscriptionGroup** — Main class extending `SubscriptionGroup`. Manages three base subscriptions: `orgs`, `users`, and `user` (current user). Optionally extends to `roles`, `extendedUsers`, and `extendedOrgs` for role-based and hierarchical data.
36
+
37
+ **Types** — `User`, `Org`, `Role`, `CurrentUser`, `Orgs`, `Users`, `Roles` and their extended variants describe the data shapes.
38
+
39
+ ## Basic Usage
40
+
41
+ ```ts
42
+ import { UsersSubscriptionGroup } from "insite-users-client";
43
+
44
+ const target = { orgs: null, users: null, user: null };
45
+ const group = new UsersSubscriptionGroup({ target });
46
+
47
+ group.on("load", (values) => {
48
+ console.log("Loaded:", values.orgs, values.users, values.user);
49
+ });
50
+
51
+ // Optional: load roles and extended org/user data
52
+ group.extend().then(() => {
53
+ console.log("Extended:", target.orgs.sortedHierarchically, target.users);
54
+ });
55
+ ```
56
+
57
+ ## Public API
58
+
59
+ ### Exports
60
+
61
+ | Export | Description |
62
+ |--------|-------------|
63
+ | `UsersSubscriptionGroup` | Class for managing users-related subscriptions |
64
+ | `CurrentUser`, `NullOrg`, `Org`, `OrgExtended`, `Orgs`, `OrgsExtended` | Types |
65
+ | `Role`, `Roles` | Types |
66
+ | `User`, `UserExtended`, `Users`, `UsersExtended` | Types |
67
+ | `UsersSubscriptionGroupOptions` | Constructor options type |
68
+
69
+ ---
70
+
71
+ ### UsersSubscriptionGroup
72
+
73
+ Extends `SubscriptionGroup` from [insite-subscriptions-client](../subscriptions-client/README.md). Manages subscriptions to `orgs`, `users`, `user`, and optionally `roles`, `users.extended`, `orgs.extended`.
74
+
75
+ #### Constructor
76
+
77
+ ```ts
78
+ new UsersSubscriptionGroup(options: UsersSubscriptionGroupOptions)
79
+ ```
80
+
81
+ **Options:**
82
+
83
+ | Option | Type | Description |
84
+ |--------|------|-------------|
85
+ | `values` | `{ orgs?, users?, user? }` | Pre-created subscription containers (defaults to new maps/object) |
86
+ | `target` | `object` | Object to bind values to (`target.orgs`, `target.users`, `target.user`) |
87
+ | `debounce` | `number` | Debounce ms for `update` events (default: 8) |
88
+ | `immediately` | `boolean` | Subscribe immediately on attach (default `true`) |
89
+
90
+ #### Properties
91
+
92
+ | Property | Type | Description |
93
+ |----------|------|-------------|
94
+ | `values` | `{ orgs, users, user }` | Subscription values (maps/object) |
95
+ | `items` | `Record<string, SubscriptionGroupItem>` | Per-subscription items |
96
+ | `isLoaded` | `boolean` | `true` when all base subscriptions loaded |
97
+ | `isInited` | `boolean` | `true` when all subscriptions inited |
98
+ | `isExtended` | `boolean \| null` | `false` = base only, `null` = extending, `true` = extended |
99
+ | `target` | `object \| undefined` | Bound target object |
100
+ | `emitUpdate` | `() => void` | Emits debounced `update` event |
101
+
102
+ #### Methods
103
+
104
+ | Method | Description |
105
+ |--------|-------------|
106
+ | `extend()` | Attaches `roles`, `extendedUsers`, `extendedOrgs`. Returns `Promise<void>` or `undefined` if already extended/extending |
107
+ | `unextend()` | Detaches extended subscriptions |
108
+ | `loaded()` | Returns `StatefulPromise` resolving when all items loaded |
109
+ | `inited()` | Returns `StatefulPromise` resolving when all items inited |
110
+ | `unloaded()` | Returns `StatefulPromise` resolving when all items unloaded |
111
+ | `subscribe()` | Subscribes all items |
112
+ | `unsubscribe()` | Unsubscribes all items |
113
+ | `attach(definitions, shouldReload?, immediately?)` | Attach definitions (inherited) |
114
+ | `detach(names, shouldUpdate?)` | Detach subscriptions by name (inherited) |
115
+ | `redefine(definitions)` | Replace definitions (inherited) |
116
+ | `applyOptions({ target?, debounceLimit? })` | Update target or debounce (inherited) |
117
+
118
+ #### Events
119
+
120
+ | Event | Payload | Description |
121
+ |-------|---------|-------------|
122
+ | `load` | `values` | All base subscriptions loaded |
123
+ | `init` | `values` | All subscriptions inited |
124
+ | `unload` | `values` | All subscriptions unloaded |
125
+ | `update` | `values` | Data changed (debounced) |
126
+ | `update.{name}` | — | Specific subscription updated |
127
+
128
+ ---
129
+
130
+ ### Types
131
+
132
+ #### User
133
+
134
+ ```ts
135
+ type User = {
136
+ _id: string;
137
+ isUser: true;
138
+ email: string;
139
+ name: { first: string; middle: string; last: string };
140
+ orgId: string;
141
+ job: string;
142
+ initials: string;
143
+ displayLabel: string;
144
+ avatarUrl: string;
145
+ isOnline: boolean;
146
+ org: NullOrg | Org;
147
+ };
13
148
  ```
149
+
150
+ #### UserExtended
151
+
152
+ `User` with optional `roles?: Role[]`.
153
+
154
+ #### CurrentUser\<AS\>
155
+
156
+ `UserExtended` plus:
157
+
158
+ | Field | Type | Description |
159
+ |-------|------|-------------|
160
+ | `abilities` | `Abilities<AS>` | Typed abilities from schema (from `insite-common`) |
161
+ | `sessionId` | `string \| undefined` | Session identifier |
162
+ | `slaveIds` | `string[]` | IDs of subordinate orgs/users |
163
+ | `slavesSnapshot` | `string` | Cached join of `slaveIds` |
164
+ | `slaves` | `(Org \| User)[]` | Resolved slave entities |
165
+ | `slaveUsers` | `User[]` | Slaves that are users |
166
+ | `slaveOrgs` | `Org[]` | Slaves that are orgs |
167
+
168
+ `AS` extends `AbilitiesSchema` from [insite-common](../common/README.md); omit for default schema.
169
+
170
+ #### Org
171
+
172
+ ```ts
173
+ type Org = {
174
+ _id: string;
175
+ title: string;
176
+ initials: string;
177
+ displayLabel: string;
178
+ isOrg: true;
179
+ users: Set<User> & { sorted: User[] };
180
+ };
181
+ ```
182
+
183
+ #### NullOrg
184
+
185
+ `Org` with `_id: null`. Used for users without an organization (`orgs.null`).
186
+
187
+ #### OrgExtended
188
+
189
+ `Org` plus optional: `owners?: (OrgExtended | User)[]`, `slaveOrgs?: OrgExtended[]`, `note?: string`, `_l?: number`.
190
+
191
+ #### Role
192
+
193
+ ```ts
194
+ type Role = {
195
+ _id: string;
196
+ ownInvolves: Role[];
197
+ involves: Role[];
198
+ _l: number;
199
+ };
200
+ ```
201
+
202
+ #### Orgs
203
+
204
+ `SubscriptionMapWithSubscription<Org>` plus `null: NullOrg`. Keys are org IDs; `orgs.null` holds users without org.
205
+
206
+ #### OrgsExtended
207
+
208
+ `Orgs` with `OrgExtended` items, plus `sortedHierarchically?: OrgExtended[]`.
209
+
210
+ #### Users
211
+
212
+ `SubscriptionMapWithSubscription<User>`. Keys are user IDs.
213
+
214
+ #### UsersExtended
215
+
216
+ `SubscriptionMapWithSubscription<UserExtended>`.
217
+
218
+ #### Roles
219
+
220
+ `SubscriptionMapWithSubscription<Role>`.
221
+
222
+ #### UsersSubscriptionGroupOptions
223
+
224
+ ```ts
225
+ type UsersSubscriptionGroupOptions = SubscriptionGroupOptions & {
226
+ values?: {
227
+ orgs?: SubscriptionMapWithSubscription;
228
+ users?: SubscriptionMapWithSubscription;
229
+ user?: SubscriptionObjectWithSubscription;
230
+ };
231
+ };
232
+ ```
233
+
234
+ Extends `SubscriptionGroupOptions` (`target`, `debounce`, `immediately`) from [insite-subscriptions-client](../subscriptions-client/README.md).
235
+
236
+ ---
237
+
238
+ ## Subscriptions
239
+
240
+ | Name | Publication | Type | Description |
241
+ |------|--------------|------|-------------|
242
+ | `orgs` | `orgs` | map | Organizations |
243
+ | `users` | `users` | map | Users |
244
+ | `user` | `user` | object | Current user (params: `[true]`) |
245
+ | `roles` | `roles` | map | Roles (extended only) |
246
+ | `extendedUsers` | `users.extended` | map | User extensions with roles (extended only) |
247
+ | `extendedOrgs` | `orgs.extended` | map | Org extensions with owners, slaveOrgs (extended only) |
248
+
249
+ ---
250
+
251
+ ## Related
252
+
253
+ - [insite-ws](../ws/README.md), [insite-subscriptions-client](../subscriptions-client/README.md), [insite-common](../common/README.md)
254
+ - [insite-users-server-ws](../users-server-ws/README.md) — server counterpart
255
+ - [insite-client](../client/README.md) — includes UsersSubscriptionGroup
256
+
257
+ ## License
258
+
259
+ MIT
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- var S=Object.defineProperty;var v=(e,r,s)=>r in e?S(e,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[r]=s;var u=(e,r,s)=>v(e,typeof r!="symbol"?r+"":r,s);import{SubscriptionGroup as _}from"insite-subscriptions-client";import{getAll as y}from"@nesvet/n";function a(e){e.null={_id:null,title:"",isOrg:!0,users:Object.assign(new Set,{sorted:[]})}}function c(e){if(e)for(let r of e.added)r.isOrg=!0,r.users=Object.assign(new Set,{sorted:[]});else this.values.orgs.null.users.clear(),this.values.orgs.null.users.sorted.length=0}function f(e){let r=this.values.orgs;if(e){let{users:s,extendedOrgs:o}=this.values;for(let l of e){let i=r.get(l._id);i.owners=l.owners.map(d=>s.get(d)||r.get(d)),i.slaveOrgs=y(r,l.slaveOrgs,!0),i.note=l.note,i._l=0}let n=[];for(let l of o.sorted){let i=r.get(l._id);for(let d of i.slaveOrgs)d._l=i._l+1;n.push(i)}r.sortedHierarchically=n,this.isLoaded&&(this.items.users.emitUpdate(),this.items.orgs.emitUpdate(e))}else{for(let s of r.sorted)delete s.owners,delete s.slaveOrgs,delete s.note,delete s._l;delete r.sortedHierarchically}}import{getAll as g}from"@nesvet/n";function h(e){if(e){let r=this.values.roles;for(let s of e)s.ownInvolves=g(r,s.ownInvolves,!0),s.involves=g(r,s.involves,!0),s._l=0;for(let s of r.sorted)for(let o of s.ownInvolves)o._l=s._l+1;this.isLoaded&&this.items.users.emitUpdate(e)}}function U(e){if(e){let r=e.slaveIds.join(",");if(e.slavesSnapshot!==r){e.slavesSnapshot=r;let s=[],o=[],n=[],{users:l,orgs:i}=this.values;for(let d of e.slaveIds){let t=l.get(d);t?(s.push(t),o.push(t)):(t=i.get(d),t&&(s.push(t),n.push(t)))}e.slaves=s,e.slaveUsers=o,e.slaveOrgs=n}}}import{getAll as E,removeOne as m}from"@nesvet/n";function x(e){if(e){let r=this.values.users,s=this.values.user,o=this.values.orgs;r.get(s._id)!==s&&(r.set(s._id,s),r.sorted[r.sorted.findIndex(t=>t._id===s._id)]=s);let n=e.findIndex(t=>t._id===s._id);~n&&(e[n]=s),~e.added.findIndex(t=>t._id===s._id)&&(e.added[n]=s);for(let t of e.added)t.isUser=!0;let i,d=new Set;for(let t of e){let p=o.get(t.orgId)??o.null;t.org!==p&&(t.org&&(t.org.users.delete(t),m(t.org.users.sorted,t)),t.org=p,t.org.users.add(t),t.org.users.sorted.push(t)),d.add(t.org),t===s&&(i=!0)}for(let t of d)t.users.sorted.sort(r.sortCompareFunction);if(e.deleted.length)for(let t of[...o.sorted,o.null])for(let p of t.users)r.has(p._id)||(t.users.delete(p),m(t.users.sorted,p));this.isLoaded&&(i&&this.items.user.emitUpdate(),this.items.orgs.emitUpdate())}}function b(e){let r=this.values.users;if(e){let s=this.values.roles;for(let o of e){let n=r.get(o._id);n.roles=E(s,o.roleIds,!0)}}else for(let s of r.sorted)delete s.roles}var O=class extends _{constructor({values:s,...o}){super([["orgs",s?.orgs??"map",c,a],["users",s?.users??"map",x],["user",s?.user??[!0],U]],o);u(this,"isExtended",!1)}extend(){if(this.isExtended===!1)return this.isExtended=null,this.attach([["roles","map",h],["extendedUsers","map","users.extended",b,!0],["extendedOrgs","map","orgs.extended",f,!0]]).then(()=>{this.isExtended=!0})}unextend(){this.isExtended&&(this.isExtended=!1,this.detach(["roles","extendedUsers","extendedOrgs"]))}};export{O as UsersSubscriptionGroup};
1
+ var S=Object.defineProperty;var v=(e,r,s)=>r in e?S(e,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[r]=s;var u=(e,r,s)=>v(e,typeof r!="symbol"?r+"":r,s);import{SubscriptionGroup as _}from"insite-subscriptions-client";import{getAll as y}from"@nesvet/n";function a(e){e.null={_id:null,title:"",initials:"\u2014",displayLabel:"\u2014",isOrg:!0,users:Object.assign(new Set,{sorted:[]})}}function c(e){if(e)for(let r of e.added)r.isOrg=!0,r.users=Object.assign(new Set,{sorted:[]});else this.values.orgs.null.users.clear(),this.values.orgs.null.users.sorted.length=0}function f(e){let r=this.values.orgs;if(e){let{users:s,extendedOrgs:o}=this.values;for(let l of e){let i=r.get(l._id);i.owners=l.owners.map(d=>s.get(d)||r.get(d)),i.slaveOrgs=y(r,l.slaveOrgs,!0),i.note=l.note,i._l=0}let n=[];for(let l of o.sorted){let i=r.get(l._id);for(let d of i.slaveOrgs)d._l=i._l+1;n.push(i)}r.sortedHierarchically=n,this.isLoaded&&(this.items.users.emitUpdate(),this.items.orgs.emitUpdate(e))}else{for(let s of r.sorted)delete s.owners,delete s.slaveOrgs,delete s.note,delete s._l;delete r.sortedHierarchically}}import{getAll as g}from"@nesvet/n";function h(e){if(e){let r=this.values.roles;for(let s of e)s.ownInvolves=g(r,s.ownInvolves,!0),s.involves=g(r,s.involves,!0),s._l=0;for(let s of r.sorted)for(let o of s.ownInvolves)o._l=s._l+1;this.isLoaded&&this.items.users.emitUpdate(e)}}function U(e){if(e){let r=e.slaveIds.join(",");if(e.slavesSnapshot!==r){e.slavesSnapshot=r;let s=[],o=[],n=[],{users:l,orgs:i}=this.values;for(let d of e.slaveIds){let t=l.get(d);t?(s.push(t),o.push(t)):(t=i.get(d),t&&(s.push(t),n.push(t)))}e.slaves=s,e.slaveUsers=o,e.slaveOrgs=n}}}import{getAll as E,removeOne as m}from"@nesvet/n";function x(e){if(e){let r=this.values.users,s=this.values.user,o=this.values.orgs;r.get(s._id)!==s&&(r.set(s._id,s),r.sorted[r.sorted.findIndex(t=>t._id===s._id)]=s);let n=e.findIndex(t=>t._id===s._id);~n&&(e[n]=s),~e.added.findIndex(t=>t._id===s._id)&&(e.added[n]=s);for(let t of e.added)t.isUser=!0;let i,d=new Set;for(let t of e){let p=o.get(t.orgId)??o.null;t.org!==p&&(t.org&&(t.org.users.delete(t),m(t.org.users.sorted,t)),t.org=p,t.org.users.add(t),t.org.users.sorted.push(t)),d.add(t.org),t===s&&(i=!0)}for(let t of d)t.users.sorted.sort(r.sortCompareFunction);if(e.deleted.length)for(let t of[...o.sorted,o.null])for(let p of t.users)r.has(p._id)||(t.users.delete(p),m(t.users.sorted,p));this.isLoaded&&(i&&this.items.user.emitUpdate(),this.items.orgs.emitUpdate())}}function b(e){let r=this.values.users;if(e){let s=this.values.roles;for(let o of e){let n=r.get(o._id);n.roles=E(s,o.roleIds,!0)}}else for(let s of r.sorted)delete s.roles}var O=class extends _{constructor({values:s,...o}){super([["orgs",s?.orgs??"map",c,a],["users",s?.users??"map",x],["user",s?.user??[!0],U]],o);u(this,"isExtended",!1)}extend(){if(this.isExtended===!1)return this.isExtended=null,this.attach([["roles","map",h],["extendedUsers","map","users.extended",b,!0],["extendedOrgs","map","orgs.extended",f,!0]]).then(()=>{this.isExtended=!0})}unextend(){this.isExtended&&(this.isExtended=!1,this.detach(["roles","extendedUsers","extendedOrgs"]))}};export{O as UsersSubscriptionGroup};
2
2
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/UsersSubscriptionGroup.ts", "../src/orgs.ts", "../src/roles.ts", "../src/user.ts", "../src/users.ts"],
4
- "sourcesContent": ["import {\n\tSubscriptionGroup,\n\ttype SubscriptionMapWithSubscription,\n\ttype SubscriptionObjectWithSubscription\n} from \"insite-subscriptions-client\";\nimport { handleExtendedOrgs, handleOrgs, handleOrgsBeforeSubscribe } from \"./orgs\";\nimport { handleRoles } from \"./roles\";\nimport { handleUser } from \"./user\";\nimport { handleExtendedUsers, handleUsers } from \"./users\";\nimport type { UsersSubscriptionGroupOptions } from \"./types\";\n\n\nexport class UsersSubscriptionGroup extends SubscriptionGroup<[\n\t[ \"orgs\", SubscriptionMapWithSubscription | \"map\", typeof handleOrgs, typeof handleOrgsBeforeSubscribe ],\n\t[ \"users\", SubscriptionMapWithSubscription | \"map\", typeof handleUsers ],\n\t[ \"user\", SubscriptionObjectWithSubscription | [ true ], typeof handleUser ]\n] | [\n\t[ \"roles\", \"map\", typeof handleRoles ],\n\t[ \"extendedUsers\", \"map\", \"users.extended\", typeof handleExtendedUsers, true ],\n\t[ \"extendedOrgs\", \"map\", \"orgs.extended\", typeof handleExtendedOrgs, true ]\n]> {\n\tconstructor({ values, ...options }: UsersSubscriptionGroupOptions) {\n\t\tsuper([\n\t\t\t[ \"orgs\", values?.orgs ?? \"map\", handleOrgs, handleOrgsBeforeSubscribe ],\n\t\t\t[ \"users\", values?.users ?? \"map\", handleUsers ],\n\t\t\t[ \"user\", values?.user ?? [ true ], handleUser ]\n\t\t], options);\n\t}\n\t\n\tisExtended: boolean | null = false;\n\t\n\textend() {\n\t\t\n\t\tif (this.isExtended === false) {\n\t\t\tthis.isExtended = null;\n\t\t\t\n\t\t\treturn this.attach([\n\t\t\t\t[ \"roles\", \"map\", handleRoles ],\n\t\t\t\t[ \"extendedUsers\", \"map\", \"users.extended\", handleExtendedUsers, true ],\n\t\t\t\t[ \"extendedOrgs\", \"map\", \"orgs.extended\", handleExtendedOrgs, true ]\n\t\t\t]).then(() => {\n\t\t\t\t\n\t\t\t\tthis.isExtended = true;\n\t\t\t\t\n\t\t\t});\n\t\t}\n\t}\n\t\n\tunextend() {\n\t\t\n\t\tif (this.isExtended) {\n\t\t\tthis.isExtended = false;\n\t\t\t\n\t\t\tthis.detach([ \"roles\", \"extendedUsers\", \"extendedOrgs\" ]);\n\t\t}\n\t\t\n\t}\n\t\n}\n", "import { getAll } from \"@nesvet/n\";\nimport type { SubscriptionMapUpdated } from \"insite-subscriptions-client\";\nimport type {\n\tOrg,\n\tOrgExtension,\n\tOrgs,\n\tOrgsExtended,\n\tUser\n} from \"./types\";\nimport type { UsersSubscriptionGroup } from \"./UsersSubscriptionGroup\";\n\n\nexport function handleOrgsBeforeSubscribe(orgs: Orgs) {\n\torgs.null = {\n\t\t_id: null,\n\t\ttitle: \"\",\n\t\tisOrg: true,\n\t\tusers: Object.assign(new Set<User>(), { sorted: [] })\n\t};\n\t\n}\n\n/** @this UsersSubscriptionGroup */\nexport function handleOrgs(this: UsersSubscriptionGroup, updated: SubscriptionMapUpdated<Org> | null) {\n\tif (updated)\n\t\tfor (const org of updated.added) {\n\t\t\torg.isOrg = true;\n\t\t\t\n\t\t\torg.users = Object.assign(new Set<User>(), { sorted: [] });\n\t\t}\n\telse {\n\t\tthis.values.orgs.null.users.clear();\n\t\tthis.values.orgs.null.users.sorted.length = 0;\n\t}\n\t\n}\n\n/** @this UsersSubscriptionGroup */\nexport function handleExtendedOrgs(this: UsersSubscriptionGroup, updated: SubscriptionMapUpdated<OrgExtension> | null) {\n\t\n\tconst orgs = this.values.orgs as OrgsExtended;\n\t\n\tif (updated) {\n\t\tconst { users, extendedOrgs } = this.values;\n\t\t\n\t\tfor (const orgExtension of updated) {\n\t\t\tconst org = orgs.get(orgExtension._id)!;\n\t\t\t\n\t\t\torg.owners = orgExtension.owners.map(_id => users.get(_id) || orgs.get(_id));\n\t\t\torg.slaveOrgs = getAll(orgs, orgExtension.slaveOrgs, true);\n\t\t\torg.note = orgExtension.note;\n\t\t\torg._l = 0;\n\t\t}\n\t\t\n\t\tconst sortedHierarchically = [];\n\t\t\n\t\tfor (const orgExtension of extendedOrgs.sorted) {\n\t\t\tconst org = orgs.get(orgExtension._id)!;\n\t\t\t\n\t\t\tfor (const slaveOrg of org.slaveOrgs!)\n\t\t\t\tslaveOrg._l = org._l! + 1;\n\t\t\t\n\t\t\tsortedHierarchically.push(org);\n\t\t}\n\t\t\n\t\torgs.sortedHierarchically = sortedHierarchically;\n\t\t\n\t\tif (this.isLoaded) {\n\t\t\tthis.items.users.emitUpdate();\n\t\t\tthis.items.orgs.emitUpdate(updated);\n\t\t}\n\t} else {\n\t\tfor (const org of orgs.sorted) {\n\t\t\tdelete org.owners;\n\t\t\tdelete org.slaveOrgs;\n\t\t\tdelete org.note;\n\t\t\tdelete org._l;\n\t\t}\n\t\tdelete orgs.sortedHierarchically;\n\t}\n\t\n}\n", "import { getAll } from \"@nesvet/n\";\nimport type { SubscriptionMapUpdated } from \"insite-subscriptions-client\";\nimport type { Role, Roles } from \"./types\";\nimport type { UsersSubscriptionGroup } from \"./UsersSubscriptionGroup\";\n\n\n/** @this UsersSubscriptionGroup */\nexport function handleRoles(this: UsersSubscriptionGroup, updated: SubscriptionMapUpdated<Role> | null) {\n\tif (updated) {\n\t\tconst roles = this.values.roles as Roles;\n\t\t\n\t\tfor (const role of updated) {\n\t\t\trole.ownInvolves = getAll(roles, role.ownInvolves as unknown as string[], true);\n\t\t\trole.involves = getAll(roles, role.involves as unknown as string[], true);\n\t\t\trole._l = 0;\n\t\t}\n\t\t\n\t\tfor (const role of roles.sorted)\n\t\t\tfor (const involvedRole of role.ownInvolves)\n\t\t\t\tinvolvedRole._l = role._l + 1;\n\t\t\n\t\tif (this.isLoaded)\n\t\t\tthis.items.users.emitUpdate(updated);\n\t}\n\t\n}\n", "import type { CurrentUser } from \"./types\";\nimport type { UsersSubscriptionGroup } from \"./UsersSubscriptionGroup\";\n\n\n/** @this UsersSubscriptionGroup */\nexport function handleUser(this: UsersSubscriptionGroup, user: CurrentUser) {\n\tif (user) {\n\t\t\n\t\tconst slavesSnapshot = user.slaveIds.join(\",\");\n\t\t\n\t\tif (user.slavesSnapshot !== slavesSnapshot) {\n\t\t\tuser.slavesSnapshot = slavesSnapshot;\n\t\t\t\n\t\t\tconst slaves = [];\n\t\t\tconst slaveUsers = [];\n\t\t\tconst slaveOrgs = [];\n\t\t\t\n\t\t\tconst { users, orgs } = this.values;\n\t\t\t\n\t\t\tfor (const _id of user.slaveIds) {\n\t\t\t\tlet slave = users.get(_id);\n\t\t\t\tif (slave) {\n\t\t\t\t\tslaves.push(slave);\n\t\t\t\t\tslaveUsers.push(slave);\n\t\t\t\t} else {\n\t\t\t\t\tslave = orgs.get(_id);\n\t\t\t\t\tif (slave) {\n\t\t\t\t\t\tslaves.push(slave);\n\t\t\t\t\t\tslaveOrgs.push(slave);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tuser.slaves = slaves;\n\t\t\tuser.slaveUsers = slaveUsers;\n\t\t\tuser.slaveOrgs = slaveOrgs;\n\t\t}\n\t}\n\t\n}\n", "import { getAll, removeOne } from \"@nesvet/n\";\nimport type { SubscriptionMapUpdated } from \"insite-subscriptions-client\";\nimport type {\n\tCurrentUser,\n\tNullOrg,\n\tOrg,\n\tOrgs,\n\tRoles,\n\tUser,\n\tUserExtension,\n\tUsers,\n\tUsersExtended\n} from \"./types\";\nimport type { UsersSubscriptionGroup } from \"./UsersSubscriptionGroup\";\n\n\n/** @this UsersSubscriptionGroup */\nexport function handleUsers(this: UsersSubscriptionGroup, updated: SubscriptionMapUpdated<User> | null) {\n\tif (updated) {\n\t\tconst users = this.values.users as Users;\n\t\tconst currentUser = this.values.user as CurrentUser;\n\t\tconst orgs = this.values.orgs as Orgs;\n\t\t\n\t\tif (users.get(currentUser._id) !== currentUser) {\n\t\t\tusers.set(currentUser._id, currentUser);\n\t\t\tusers.sorted[users.sorted.findIndex(user => user._id === currentUser._id)] = currentUser;\n\t\t}\n\t\tconst updatedUserIndex = updated.findIndex(user => user._id === currentUser._id);\n\t\t\n\t\tif (~updatedUserIndex)\n\t\t\tupdated[updatedUserIndex] = currentUser;\n\t\t\n\t\tconst addedUserIndex = updated.added.findIndex(user => user._id === currentUser._id);\n\t\t\n\t\tif (~addedUserIndex)\n\t\t\tupdated.added[updatedUserIndex] = currentUser;\n\t\t\n\t\tfor (const user of updated.added)\n\t\t\tuser.isUser = true;\n\t\t\n\t\tlet shouldUpdateUser;\n\t\tconst orgsToSortUsers = new Set<NullOrg | Org>();\n\t\t\n\t\tfor (const user of updated) {\n\t\t\tconst org = orgs.get(user.orgId) ?? orgs.null;\n\t\t\t\n\t\t\tif (user.org !== org) {\n\t\t\t\tif (user.org) {\n\t\t\t\t\tuser.org.users.delete(user);\n\t\t\t\t\tremoveOne(user.org.users.sorted, user);\n\t\t\t\t}\n\t\t\t\tuser.org = org;\n\t\t\t\tuser.org.users.add(user);\n\t\t\t\tuser.org.users.sorted.push(user);\n\t\t\t}\n\t\t\t\n\t\t\torgsToSortUsers.add(user.org);\n\t\t\t\n\t\t\tif (user === currentUser)\n\t\t\t\tshouldUpdateUser = true;\n\t\t}\n\t\t\n\t\tfor (const org of orgsToSortUsers)\n\t\t\torg.users.sorted.sort(users.sortCompareFunction!);\n\t\t\n\t\tif (updated.deleted.length)\n\t\t\tfor (const org of [ ...orgs.sorted, orgs.null ])\n\t\t\t\tfor (const user of org.users)\n\t\t\t\t\tif (!users.has(user._id)) {\n\t\t\t\t\t\torg.users.delete(user);\n\t\t\t\t\t\tremoveOne(org.users.sorted, user);\n\t\t\t\t\t}\n\t\t\n\t\tif (this.isLoaded) {\n\t\t\tif (shouldUpdateUser)\n\t\t\t\tthis.items.user.emitUpdate();\n\t\t\tthis.items.orgs.emitUpdate();\n\t\t}\n\t}\n\t\n}\n\n/** @this UsersSubscriptionGroup */\nexport function handleExtendedUsers(this: UsersSubscriptionGroup, updated: SubscriptionMapUpdated<UserExtension> | null) {\n\t\n\tconst users = this.values.users as UsersExtended;\n\t\n\tif (updated) {\n\t\tconst roles = this.values.roles as Roles;\n\t\t\n\t\tfor (const userExtension of updated) {\n\t\t\tconst user = users.get(userExtension._id)!;\n\t\t\t\n\t\t\tuser.roles = getAll(roles, userExtension.roleIds, true);\n\t\t}\n\t} else\n\t\tfor (const user of users.sorted)\n\t\t\tdelete user.roles;\n\t\n}\n"],
5
- "mappings": "oKAAA,OACC,qBAAAA,MAGM,8BCJP,OAAS,UAAAC,MAAc,YAYhB,SAASC,EAA0BC,EAAY,CACrDA,EAAK,KAAO,CACX,IAAK,KACL,MAAO,GACP,MAAO,GACP,MAAO,OAAO,OAAO,IAAI,IAAa,CAAE,OAAQ,CAAC,CAAE,CAAC,CACrD,CAED,CAGO,SAASC,EAAyCC,EAA6C,CACrG,GAAIA,EACH,QAAWC,KAAOD,EAAQ,MACzBC,EAAI,MAAQ,GAEZA,EAAI,MAAQ,OAAO,OAAO,IAAI,IAAa,CAAE,OAAQ,CAAC,CAAE,CAAC,OAG1D,KAAK,OAAO,KAAK,KAAK,MAAM,MAAM,EAClC,KAAK,OAAO,KAAK,KAAK,MAAM,OAAO,OAAS,CAG9C,CAGO,SAASC,EAAiDF,EAAsD,CAEtH,IAAMF,EAAO,KAAK,OAAO,KAEzB,GAAIE,EAAS,CACZ,GAAM,CAAE,MAAAG,EAAO,aAAAC,CAAa,EAAI,KAAK,OAErC,QAAWC,KAAgBL,EAAS,CACnC,IAAMC,EAAMH,EAAK,IAAIO,EAAa,GAAG,EAErCJ,EAAI,OAASI,EAAa,OAAO,IAAIC,GAAOH,EAAM,IAAIG,CAAG,GAAKR,EAAK,IAAIQ,CAAG,CAAC,EAC3EL,EAAI,U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,CAAE,eAAgB,MAAO,gBAAiBC,EAAoB,EAAK,CACpE,CAAC,EAAE,KAAK,IAAM,CAEb,KAAK,WAAa,EAEnB,CAAC,CAEH,CAEA,UAAW,CAEN,KAAK,aACR,KAAK,WAAa,GAElB,KAAK,OAAO,CAAE,QAAS,gBAAiB,cAAe,CAAC,EAG1D,CAED",
4
+ "sourcesContent": ["import {\n\tSubscriptionGroup,\n\ttype SubscriptionMapWithSubscription,\n\ttype SubscriptionObjectWithSubscription\n} from \"insite-subscriptions-client\";\nimport { handleExtendedOrgs, handleOrgs, handleOrgsBeforeSubscribe } from \"./orgs\";\nimport { handleRoles } from \"./roles\";\nimport { handleUser } from \"./user\";\nimport { handleExtendedUsers, handleUsers } from \"./users\";\nimport type { UsersSubscriptionGroupOptions } from \"./types\";\n\n\nexport class UsersSubscriptionGroup extends SubscriptionGroup<[\n\t[ \"orgs\", SubscriptionMapWithSubscription | \"map\", typeof handleOrgs, typeof handleOrgsBeforeSubscribe ],\n\t[ \"users\", SubscriptionMapWithSubscription | \"map\", typeof handleUsers ],\n\t[ \"user\", SubscriptionObjectWithSubscription | [ true ], typeof handleUser ]\n] | [\n\t[ \"roles\", \"map\", typeof handleRoles ],\n\t[ \"extendedUsers\", \"map\", \"users.extended\", typeof handleExtendedUsers, true ],\n\t[ \"extendedOrgs\", \"map\", \"orgs.extended\", typeof handleExtendedOrgs, true ]\n]> {\n\tconstructor({ values, ...options }: UsersSubscriptionGroupOptions) {\n\t\tsuper([\n\t\t\t[ \"orgs\", values?.orgs ?? \"map\", handleOrgs, handleOrgsBeforeSubscribe ],\n\t\t\t[ \"users\", values?.users ?? \"map\", handleUsers ],\n\t\t\t[ \"user\", values?.user ?? [ true ], handleUser ]\n\t\t], options);\n\t}\n\t\n\tisExtended: boolean | null = false;\n\t\n\textend() {\n\t\t\n\t\tif (this.isExtended === false) {\n\t\t\tthis.isExtended = null;\n\t\t\t\n\t\t\treturn this.attach([\n\t\t\t\t[ \"roles\", \"map\", handleRoles ],\n\t\t\t\t[ \"extendedUsers\", \"map\", \"users.extended\", handleExtendedUsers, true ],\n\t\t\t\t[ \"extendedOrgs\", \"map\", \"orgs.extended\", handleExtendedOrgs, true ]\n\t\t\t]).then(() => {\n\t\t\t\t\n\t\t\t\tthis.isExtended = true;\n\t\t\t\t\n\t\t\t});\n\t\t}\n\t}\n\t\n\tunextend() {\n\t\t\n\t\tif (this.isExtended) {\n\t\t\tthis.isExtended = false;\n\t\t\t\n\t\t\tthis.detach([ \"roles\", \"extendedUsers\", \"extendedOrgs\" ]);\n\t\t}\n\t\t\n\t}\n\t\n}\n", "import { getAll } from \"@nesvet/n\";\nimport type { SubscriptionMapUpdated } from \"insite-subscriptions-client\";\nimport type {\n\tOrg,\n\tOrgExtension,\n\tOrgs,\n\tOrgsExtended,\n\tUser\n} from \"./types\";\nimport type { UsersSubscriptionGroup } from \"./UsersSubscriptionGroup\";\n\n\nexport function handleOrgsBeforeSubscribe(orgs: Orgs) {\n\torgs.null = {\n\t\t_id: null,\n\t\ttitle: \"\",\n\t\tinitials: \"\u2014\",\n\t\tdisplayLabel: \"\u2014\",\n\t\tisOrg: true,\n\t\tusers: Object.assign(new Set<User>(), { sorted: [] })\n\t};\n\t\n}\n\n/** @this UsersSubscriptionGroup */\nexport function handleOrgs(this: UsersSubscriptionGroup, updated: SubscriptionMapUpdated<Org> | null) {\n\tif (updated)\n\t\tfor (const org of updated.added) {\n\t\t\torg.isOrg = true;\n\t\t\t\n\t\t\torg.users = Object.assign(new Set<User>(), { sorted: [] });\n\t\t}\n\telse {\n\t\tthis.values.orgs.null.users.clear();\n\t\tthis.values.orgs.null.users.sorted.length = 0;\n\t}\n\t\n}\n\n/** @this UsersSubscriptionGroup */\nexport function handleExtendedOrgs(this: UsersSubscriptionGroup, updated: SubscriptionMapUpdated<OrgExtension> | null) {\n\t\n\tconst orgs = this.values.orgs as OrgsExtended;\n\t\n\tif (updated) {\n\t\tconst { users, extendedOrgs } = this.values;\n\t\t\n\t\tfor (const orgExtension of updated) {\n\t\t\tconst org = orgs.get(orgExtension._id)!;\n\t\t\t\n\t\t\torg.owners = orgExtension.owners.map(_id => users.get(_id) || orgs.get(_id));\n\t\t\torg.slaveOrgs = getAll(orgs, orgExtension.slaveOrgs, true);\n\t\t\torg.note = orgExtension.note;\n\t\t\torg._l = 0;\n\t\t}\n\t\t\n\t\tconst sortedHierarchically = [];\n\t\t\n\t\tfor (const orgExtension of extendedOrgs.sorted) {\n\t\t\tconst org = orgs.get(orgExtension._id)!;\n\t\t\t\n\t\t\tfor (const slaveOrg of org.slaveOrgs!)\n\t\t\t\tslaveOrg._l = org._l! + 1;\n\t\t\t\n\t\t\tsortedHierarchically.push(org);\n\t\t}\n\t\t\n\t\torgs.sortedHierarchically = sortedHierarchically;\n\t\t\n\t\tif (this.isLoaded) {\n\t\t\tthis.items.users.emitUpdate();\n\t\t\tthis.items.orgs.emitUpdate(updated);\n\t\t}\n\t} else {\n\t\tfor (const org of orgs.sorted) {\n\t\t\tdelete org.owners;\n\t\t\tdelete org.slaveOrgs;\n\t\t\tdelete org.note;\n\t\t\tdelete org._l;\n\t\t}\n\t\tdelete orgs.sortedHierarchically;\n\t}\n\t\n}\n", "import { getAll } from \"@nesvet/n\";\nimport type { SubscriptionMapUpdated } from \"insite-subscriptions-client\";\nimport type { Role, Roles } from \"./types\";\nimport type { UsersSubscriptionGroup } from \"./UsersSubscriptionGroup\";\n\n\n/** @this UsersSubscriptionGroup */\nexport function handleRoles(this: UsersSubscriptionGroup, updated: SubscriptionMapUpdated<Role> | null) {\n\tif (updated) {\n\t\tconst roles = this.values.roles as Roles;\n\t\t\n\t\tfor (const role of updated) {\n\t\t\trole.ownInvolves = getAll(roles, role.ownInvolves as unknown as string[], true);\n\t\t\trole.involves = getAll(roles, role.involves as unknown as string[], true);\n\t\t\trole._l = 0;\n\t\t}\n\t\t\n\t\tfor (const role of roles.sorted)\n\t\t\tfor (const involvedRole of role.ownInvolves)\n\t\t\t\tinvolvedRole._l = role._l + 1;\n\t\t\n\t\tif (this.isLoaded)\n\t\t\tthis.items.users.emitUpdate(updated);\n\t}\n\t\n}\n", "import type { CurrentUser } from \"./types\";\nimport type { UsersSubscriptionGroup } from \"./UsersSubscriptionGroup\";\n\n\n/** @this UsersSubscriptionGroup */\nexport function handleUser(this: UsersSubscriptionGroup, user: CurrentUser) {\n\tif (user) {\n\t\t\n\t\tconst slavesSnapshot = user.slaveIds.join(\",\");\n\t\t\n\t\tif (user.slavesSnapshot !== slavesSnapshot) {\n\t\t\tuser.slavesSnapshot = slavesSnapshot;\n\t\t\t\n\t\t\tconst slaves = [];\n\t\t\tconst slaveUsers = [];\n\t\t\tconst slaveOrgs = [];\n\t\t\t\n\t\t\tconst { users, orgs } = this.values;\n\t\t\t\n\t\t\tfor (const _id of user.slaveIds) {\n\t\t\t\tlet slave = users.get(_id);\n\t\t\t\tif (slave) {\n\t\t\t\t\tslaves.push(slave);\n\t\t\t\t\tslaveUsers.push(slave);\n\t\t\t\t} else {\n\t\t\t\t\tslave = orgs.get(_id);\n\t\t\t\t\tif (slave) {\n\t\t\t\t\t\tslaves.push(slave);\n\t\t\t\t\t\tslaveOrgs.push(slave);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tuser.slaves = slaves;\n\t\t\tuser.slaveUsers = slaveUsers;\n\t\t\tuser.slaveOrgs = slaveOrgs;\n\t\t}\n\t}\n\t\n}\n", "import { getAll, removeOne } from \"@nesvet/n\";\nimport type { SubscriptionMapUpdated } from \"insite-subscriptions-client\";\nimport type {\n\tCurrentUser,\n\tNullOrg,\n\tOrg,\n\tOrgs,\n\tRoles,\n\tUser,\n\tUserExtension,\n\tUsers,\n\tUsersExtended\n} from \"./types\";\nimport type { UsersSubscriptionGroup } from \"./UsersSubscriptionGroup\";\n\n\n/** @this UsersSubscriptionGroup */\nexport function handleUsers(this: UsersSubscriptionGroup, updated: SubscriptionMapUpdated<User> | null) {\n\tif (updated) {\n\t\tconst users = this.values.users as Users;\n\t\tconst currentUser = this.values.user as CurrentUser;\n\t\tconst orgs = this.values.orgs as Orgs;\n\t\t\n\t\tif (users.get(currentUser._id) !== currentUser) {\n\t\t\tusers.set(currentUser._id, currentUser);\n\t\t\tusers.sorted[users.sorted.findIndex(user => user._id === currentUser._id)] = currentUser;\n\t\t}\n\t\tconst updatedUserIndex = updated.findIndex(user => user._id === currentUser._id);\n\t\t\n\t\tif (~updatedUserIndex)\n\t\t\tupdated[updatedUserIndex] = currentUser;\n\t\t\n\t\tconst addedUserIndex = updated.added.findIndex(user => user._id === currentUser._id);\n\t\t\n\t\tif (~addedUserIndex)\n\t\t\tupdated.added[updatedUserIndex] = currentUser;\n\t\t\n\t\tfor (const user of updated.added)\n\t\t\tuser.isUser = true;\n\t\t\n\t\tlet shouldUpdateUser;\n\t\tconst orgsToSortUsers = new Set<NullOrg | Org>();\n\t\t\n\t\tfor (const user of updated) {\n\t\t\tconst org = orgs.get(user.orgId) ?? orgs.null;\n\t\t\t\n\t\t\tif (user.org !== org) {\n\t\t\t\tif (user.org) {\n\t\t\t\t\tuser.org.users.delete(user);\n\t\t\t\t\tremoveOne(user.org.users.sorted, user);\n\t\t\t\t}\n\t\t\t\tuser.org = org;\n\t\t\t\tuser.org.users.add(user);\n\t\t\t\tuser.org.users.sorted.push(user);\n\t\t\t}\n\t\t\t\n\t\t\torgsToSortUsers.add(user.org);\n\t\t\t\n\t\t\tif (user === currentUser)\n\t\t\t\tshouldUpdateUser = true;\n\t\t}\n\t\t\n\t\tfor (const org of orgsToSortUsers)\n\t\t\torg.users.sorted.sort(users.sortCompareFunction!);\n\t\t\n\t\tif (updated.deleted.length)\n\t\t\tfor (const org of [ ...orgs.sorted, orgs.null ])\n\t\t\t\tfor (const user of org.users)\n\t\t\t\t\tif (!users.has(user._id)) {\n\t\t\t\t\t\torg.users.delete(user);\n\t\t\t\t\t\tremoveOne(org.users.sorted, user);\n\t\t\t\t\t}\n\t\t\n\t\tif (this.isLoaded) {\n\t\t\tif (shouldUpdateUser)\n\t\t\t\tthis.items.user.emitUpdate();\n\t\t\tthis.items.orgs.emitUpdate();\n\t\t}\n\t}\n\t\n}\n\n/** @this UsersSubscriptionGroup */\nexport function handleExtendedUsers(this: UsersSubscriptionGroup, updated: SubscriptionMapUpdated<UserExtension> | null) {\n\t\n\tconst users = this.values.users as UsersExtended;\n\t\n\tif (updated) {\n\t\tconst roles = this.values.roles as Roles;\n\t\t\n\t\tfor (const userExtension of updated) {\n\t\t\tconst user = users.get(userExtension._id)!;\n\t\t\t\n\t\t\tuser.roles = getAll(roles, userExtension.roleIds, true);\n\t\t}\n\t} else\n\t\tfor (const user of users.sorted)\n\t\t\tdelete user.roles;\n\t\n}\n"],
5
+ "mappings": "oKAAA,OACC,qBAAAA,MAGM,8BCJP,OAAS,UAAAC,MAAc,YAYhB,SAASC,EAA0BC,EAAY,CACrDA,EAAK,KAAO,CACX,IAAK,KACL,MAAO,GACP,SAAU,SACV,aAAc,SACd,MAAO,GACP,MAAO,OAAO,OAAO,IAAI,IAAa,CAAE,OAAQ,CAAC,CAAE,CAAC,CACrD,CAED,CAGO,SAASC,EAAyCC,EAA6C,CACrG,GAAIA,EACH,QAAWC,KAAOD,EAAQ,MACzBC,EAAI,MAAQ,GAEZA,EAAI,MAAQ,OAAO,OAAO,IAAI,IAAa,CAAE,OAAQ,CAAC,CAAE,CAAC,OAG1D,KAAK,OAAO,KAAK,KAAK,MAAM,MAAM,EAClC,KAAK,OAAO,KAAK,KAAK,MAAM,OAAO,OAAS,CAG9C,CAGO,SAASC,EAAiDF,EAAsD,CAEtH,IAAMF,EAAO,KAAK,OAAO,KAEzB,GAAIE,EAAS,CACZ,GAAM,CAAE,MAAAG,EAAO,aAAAC,CAAa,EAAI,KAAK,OAErC,QAAWC,KAAgBL,EAAS,CACnC,IAAMC,EAAMH,EAAK,IAAIO,EAAa,GAAG,EAErCJ,EAAI,OAASI,EAAa,OAAO,IAAIC,GAAOH,EAAM,IAAIG,CAAG,GAAK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E,gBAAiB,MAAO,iBAAkBC,EAAqB,EAAK,EACtE,CAAE,eAAgB,MAAO,gBAAiBC,EAAoB,EAAK,CACpE,CAAC,EAAE,KAAK,IAAM,CAEb,KAAK,WAAa,EAEnB,CAAC,CAEH,CAEA,UAAW,CAEN,KAAK,aACR,KAAK,WAAa,GAElB,KAAK,OAAO,CAAE,QAAS,gBAAiB,cAAe,CAAC,EAG1D,CAED",
6
6
  "names": ["SubscriptionGroup", "getAll", "handleOrgsBeforeSubscribe", "orgs", "handleOrgs", "updated", "org", "handleExtendedOrgs", "users", "extendedOrgs", "orgExtension", "_id", "sortedHierarchically", "slaveOrg", "getAll", "handleRoles", "updated", "roles", "role", "involvedRole", "handleUser", "user", "slavesSnapshot", "slaves", "slaveUsers", "slaveOrgs", "users", "orgs", "_id", "slave", "getAll", "removeOne", "handleUsers", "updated", "users", "currentUser", "orgs", "user", "updatedUserIndex", "shouldUpdateUser", "orgsToSortUsers", "org", "handleExtendedUsers", "roles", "userExtension", "UsersSubscriptionGroup", "SubscriptionGroup", "values", "options", "handleOrgs", "handleOrgsBeforeSubscribe", "handleUsers", "handleUser", "__publicField", "handleRoles", "handleExtendedUsers", "handleExtendedOrgs"]
7
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"orgs.d.ts","sourceRoot":"","sources":["../src/orgs.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,KAAK,EACX,GAAG,EACH,YAAY,EACZ,IAAI,EAGJ,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAGvE,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,IAAI,QAQnD;AAED,mCAAmC;AACnC,wBAAgB,UAAU,CAAC,IAAI,EAAE,sBAAsB,EAAE,OAAO,EAAE,sBAAsB,CAAC,GAAG,CAAC,GAAG,IAAI,QAYnG;AAED,mCAAmC;AACnC,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,sBAAsB,EAAE,OAAO,EAAE,sBAAsB,CAAC,YAAY,CAAC,GAAG,IAAI,QA2CpH"}
1
+ {"version":3,"file":"orgs.d.ts","sourceRoot":"","sources":["../src/orgs.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,KAAK,EACX,GAAG,EACH,YAAY,EACZ,IAAI,EAGJ,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAGvE,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,IAAI,QAUnD;AAED,mCAAmC;AACnC,wBAAgB,UAAU,CAAC,IAAI,EAAE,sBAAsB,EAAE,OAAO,EAAE,sBAAsB,CAAC,GAAG,CAAC,GAAG,IAAI,QAYnG;AAED,mCAAmC;AACnC,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,sBAAsB,EAAE,OAAO,EAAE,sBAAsB,CAAC,YAAY,CAAC,GAAG,IAAI,QA2CpH"}
package/dist/types.d.ts CHANGED
@@ -10,6 +10,8 @@ export type UsersSubscriptionGroupOptions = SubscriptionGroupOptions & {
10
10
  export type Org = {
11
11
  _id: string;
12
12
  title: string;
13
+ initials: string;
14
+ displayLabel: string;
13
15
  isOrg: true;
14
16
  users: Set<User> & {
15
17
  sorted: User[];
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,KAAK,EACX,wBAAwB,EACxB,+BAA+B,EAC/B,kCAAkC,EAClC,MAAM,6BAA6B,CAAC;AAGrC,MAAM,MAAM,6BAA6B,GAAG,wBAAwB,GAAG;IACtE,MAAM,CAAC,EAAE;QACR,IAAI,EAAE,+BAA+B,CAAC;QACtC,KAAK,EAAE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,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,GAAG,EAAE,OAAO,GAAG,GAAG,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG;IACjC,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,KAAK,GAAG,+BAA+B,CAAC,IAAI,CAAC,CAAC;AAE1D,MAAM,MAAM,aAAa,GAAG,+BAA+B,CAAC,YAAY,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,35 +1,50 @@
1
1
  {
2
- "name": "insite-users-client",
3
- "version": "2.3.4",
4
- "description": "inSite users client side",
5
- "type": "module",
6
- "main": "./dist/index.js",
7
- "module": "./dist/index.js",
8
- "packageManager": "bun@1.2.18",
9
- "scripts": {
10
- "test": "echo \"Error: no test specified\" && exit 1",
11
- "build": "bun .conveyer.js",
12
- "postbuild": "tsc -p ."
13
- },
14
- "repository": {
15
- "type": "git",
16
- "url": "git+https://github.com/nesvet/insite-users-client.git"
17
- },
18
- "keywords": [
19
- "insite",
20
- "users",
21
- "client"
22
- ],
23
- "author": "Eugene Nesvetaev <dev@nesvet.dev> (https://nesvet.dev/)",
24
- "license": "MIT",
25
- "dependencies": {
26
- "@nesvet/n": "^1.2.1",
27
- "insite-common": "^2.3.3",
28
- "insite-subscriptions-client": "^2.3.3"
29
- },
30
- "devDependencies": {
31
- "@nesvet/conveyer": "^2.6.1",
32
- "@nesvet/eslint-config": "^2.1.2",
33
- "typescript": "^5.8.3"
34
- }
2
+ "name": "insite-users-client",
3
+ "version": "2.4.0",
4
+ "description": "Client-side users API for inSite",
5
+ "keywords": [
6
+ "insite",
7
+ "users",
8
+ "client",
9
+ "auth"
10
+ ],
11
+ "homepage": "https://github.com/nesvet/insite#readme",
12
+ "bugs": {
13
+ "url": "https://github.com/nesvet/insite/issues"
14
+ },
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/nesvet/insite.git",
18
+ "directory": "packages/users-client"
19
+ },
20
+ "funding": {
21
+ "type": "patreon",
22
+ "url": "https://www.patreon.com/nesvet"
23
+ },
24
+ "license": "MIT",
25
+ "author": "Eugene Nesvetaev <dev@nesvet.dev> (https://nesvet.dev/)",
26
+ "type": "module",
27
+ "main": "./dist/index.js",
28
+ "module": "./dist/index.js",
29
+ "files": [
30
+ "dist",
31
+ "README.md",
32
+ "LICENSE"
33
+ ],
34
+ "scripts": {
35
+ "build": "bun .conveyer.js",
36
+ "postbuild": "tsc -p .",
37
+ "clean": "rm -rf dist",
38
+ "test": "echo \"Error: no test specified\" && exit 1",
39
+ "typecheck": "tsc --noEmit"
40
+ },
41
+ "dependencies": {
42
+ "@nesvet/n": "^1.2.1",
43
+ "insite-common": "^2.4.0",
44
+ "insite-subscriptions-client": "^2.4.0"
45
+ },
46
+ "packageManager": "bun@1.3.9",
47
+ "engines": {
48
+ "node": ">=20.0.0"
49
+ }
35
50
  }