insite-users-client 2.1.1 → 2.1.3

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.js CHANGED
@@ -1,2 +1,2 @@
1
- var W=Object.defineProperty;var P=(e,r,t)=>r in e?W(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t;var h=(e,r,t)=>P(e,typeof r!="symbol"?r+"":r,t);import{SubscriptionGroup as R}from"insite-subscriptions-client";function x(){}function G(e,r=0,t={}){let{leading:s=!1,trailing:n=!0}=t,{maxWait:l=1/0}=t,i,u,o,p,w,m,c,O,M=async()=>{let d=Date.now();d>=o?(i=void 0,o=void 0,clearTimeout(u),typeof c=="function"&&await c(),f.resolve(O),f.promise.isResolved=!0,m=s):(clearTimeout(i),i=setTimeout(M,o-d))},b=Number.isFinite(l)?()=>{c===a&&(c=!1),a(),u=setTimeout(b,l)}:null;async function a(){return O=await e.apply(p,w)}s&&typeof s=="boolean"&&(s=a),m=s,n&&typeof n=="boolean"&&(n=a),c=n;let f=Object.assign(function(...d){return w=d,p=this,o=Date.now()+r,c=n,f.promise.isResolved&&(f.promise=Object.assign(new Promise(T=>{f.resolve=T,typeof m=="function"&&(m(),m=!1,c===a&&(c=!1)),i||(i=setTimeout(M,r),b&&(u=setTimeout(b,l)))}),{isResolved:!1})),f.promise},{callback:e,promise:Object.assign(Promise.resolve(),{isResolved:!0}),resolve:x,run:a,clear:async d=>{clearTimeout(i),i=void 0,clearTimeout(u),f.promise.isResolved=!0,f.resolve(d?await a():O)}});return f}G.noop=Object.assign(()=>{},{callback:x,promise:Object.assign(Promise.resolve(),{isResolved:!0}),resolve:x,run:x,clear:x});function g(e,r,t=!1){return t&&(r=r.filter(s=>e.has(s))),r.map(s=>e.get(s))}function _(e,r,t,s,n=!0){return Array.isArray(e)&&(e=e.length),typeof s!="string"&&(n=s??!0,s=t),(n?`${e}\xA0`:"")+_.raw(e,r,t,s)}_.raw=(e,r,t,s=t)=>{e=Math.abs(e);let n=e%10,l=e%100;return n===1&&l!==11?r:n>=2&&n<=4&&!(l>=12&&l<=15)?t:s};function v(e,r){let t=e.indexOf(r);return t>-1?(e.splice(t,1),!0):!1}function S(e){e.null={_id:null,title:"",isOrg:!0,users:Object.assign(new Set,{sorted:[]})}}function U(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 j(e){let r=this.values.orgs;if(e){let{users:t,extendedOrgs:s}=this.values;for(let l of e){let i=r.get(l._id);i.owners=l.owners.map(u=>t.get(u)||r.get(u)),i.slaveOrgs=g(r,l.slaveOrgs,!0),i.note=l.note,i._l=0}let n=[];for(let l of s.sorted){let i=r.get(l._id);for(let u of i.slaveOrgs)u._l=i._l+1;n.push(i)}r.sortedHierarchically=n,this.isLoaded&&(this.items.users.emitUpdate(),this.items.orgs.emitUpdate(e))}else{for(let t of r.sorted)delete t.owners,delete t.slaveOrgs,delete t.note,delete t._l;delete r.sortedHierarchically}}function $(e){if(e){let r=this.values.roles;for(let t of e)t.ownInvolves=g(r,t.ownInvolves,!0),t.involves=g(r,t.involves,!0),t._l=0;for(let t of r.sorted)for(let s of t.ownInvolves)s._l=t._l+1;this.isLoaded&&this.items.users.emitUpdate(e)}}function y(e){if(e){let r=e.slaveIds.join(",");if(e.slavesSnapshot!==r){e.slavesSnapshot=r;let t=[],s=[],n=[],{users:l,orgs:i}=this.values;for(let u of e.slaveIds){let o=l.get(u);o?(t.push(o),s.push(o)):(o=i.get(u),o&&(t.push(o),n.push(o)))}e.slaves=t,e.slaveUsers=s,e.slaveOrgs=n}}}function E(e){if(e){let r=this.values.users,t=this.values.user,s=this.values.orgs;r.get(t._id)!==t&&(r.set(t._id,t),r.sorted[r.sorted.findIndex(o=>o._id===t._id)]=t);let n=e.findIndex(o=>o._id===t._id);~n&&(e[n]=t),~e.added.findIndex(o=>o._id===t._id)&&(e.added[n]=t);for(let o of e.added)o.isUser=!0;let i,u=new Set;for(let o of e){let p=s.get(o.orgId)??s.null;o.org!==p&&(o.org&&(o.org.users.delete(o),v(o.org.users.sorted,o)),o.org=p,o.org.users.add(o),o.org.users.sorted.push(o),u.add(o.org)),o===t&&(i=!0)}for(let o of u)o.users.sorted.sort(r.sortCompareFunction);if(e.deleted.length)for(let o of[...s.sorted,s.null])for(let p of o.users)r.has(p._id)||(o.users.delete(p),v(o.users.sorted,p));this.isLoaded&&(i&&this.items.user.emitUpdate(),this.items.orgs.emitUpdate())}}function I(e){let r=this.values.users;if(e){let{roles:t}=this.values;for(let s of e){let n=r.get(s._id);n.roles=t.getAll(s.roleIds)}}else for(let t of r.sorted)delete t.roles}var k=[["orgs","map",U,S],["users","map",E],["user",[!0],y]],B=[["roles","map",$],["extendedUsers","map","users.extended",I,!0],["extendedOrgs","map","orgs.extended",j,!0]],A=class extends R{constructor(t){super(k,t);h(this,"isExtended",!1)}extend(){return this.isExtended===!1?(this.isExtended=null,this.attach(B).then(()=>{this.isExtended=!0})):null}unextend(){this.isExtended&&(this.isExtended=!1,this.detach(["roles","extendedUsers","extendedOrgs"]))}static handleValues({orgs:t,users:s,user:n},l){return new R([["orgs",t,U,S],["users",s,E],["user",n,y]],l)}};export{A as UsersSubscriptionGroup};
1
+ var W=Object.defineProperty;var P=(e,r,t)=>r in e?W(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t;var h=(e,r,t)=>P(e,typeof r!="symbol"?r+"":r,t);import{SubscriptionGroup as R}from"insite-subscriptions-client";function x(){}function G(e,r=0,t={}){let{leading:s=!1,trailing:n=!0}=t,{maxWait:l=1/0}=t,i,u,o,f,w,m,c,O,M=async()=>{let d=Date.now();d>=o?(i=void 0,o=void 0,clearTimeout(u),typeof c=="function"&&await c(),p.resolve(O),p.promise.isResolved=!0,m=s):(clearTimeout(i),i=setTimeout(M,o-d))},b=Number.isFinite(l)?()=>{c===a&&(c=!1),a(),u=setTimeout(b,l)}:null;async function a(){return O=await e.apply(f,w)}s&&typeof s=="boolean"&&(s=a),m=s,n&&typeof n=="boolean"&&(n=a),c=n;let p=Object.assign(function(...d){return w=d,f=this,o=Date.now()+r,c=n,p.promise.isResolved&&(p.promise=Object.assign(new Promise(T=>{p.resolve=T,typeof m=="function"&&(m(),m=!1,c===a&&(c=!1)),i||(i=setTimeout(M,r),b&&(u=setTimeout(b,l)))}),{isResolved:!1})),p.promise},{callback:e,promise:Object.assign(Promise.resolve(),{isResolved:!0}),resolve:x,run:a,clear:async d=>{clearTimeout(i),i=void 0,clearTimeout(u),p.promise.isResolved=!0,p.resolve(d?await a():O)}});return p}G.noop=Object.assign(()=>{},{callback:x,promise:Object.assign(Promise.resolve(),{isResolved:!0}),resolve:x,run:x,clear:x});function g(e,r,t=!1){return t&&(r=r.filter(s=>e.has(s))),r.map(s=>e.get(s))}function _(e,r,t,s,n=!0){return Array.isArray(e)&&(e=e.length),typeof s!="string"&&(n=s??!0,s=t),(n?`${e}\xA0`:"")+_.raw(e,r,t,s)}_.raw=(e,r,t,s=t)=>{e=Math.abs(e);let n=e%10,l=e%100;return n===1&&l!==11?r:n>=2&&n<=4&&!(l>=12&&l<=15)?t:s};function v(e,r){let t=e.indexOf(r);return t>-1?(e.splice(t,1),!0):!1}function S(e){e.null={_id:null,title:"",isOrg:!0,users:Object.assign(new Set,{sorted:[]})}}function U(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 $(e){let r=this.values.orgs;if(e){let{users:t,extendedOrgs:s}=this.values;for(let l of e){let i=r.get(l._id);i.owners=l.owners.map(u=>t.get(u)||r.get(u)),i.slaveOrgs=g(r,l.slaveOrgs,!0),i.note=l.note,i._l=0}let n=[];for(let l of s.sorted){let i=r.get(l._id);for(let u of i.slaveOrgs)u._l=i._l+1;n.push(i)}r.sortedHierarchically=n,this.isLoaded&&(this.items.users.emitUpdate(),this.items.orgs.emitUpdate(e))}else{for(let t of r.sorted)delete t.owners,delete t.slaveOrgs,delete t.note,delete t._l;delete r.sortedHierarchically}}function j(e){if(e){let r=this.values.roles;for(let t of e)t.ownInvolves=g(r,t.ownInvolves,!0),t.involves=g(r,t.involves,!0),t._l=0;for(let t of r.sorted)for(let s of t.ownInvolves)s._l=t._l+1;this.isLoaded&&this.items.users.emitUpdate(e)}}function y(e){if(e){let r=e.slaveIds.join(",");if(e.slavesSnapshot!==r){e.slavesSnapshot=r;let t=[],s=[],n=[],{users:l,orgs:i}=this.values;for(let u of e.slaveIds){let o=l.get(u);o?(t.push(o),s.push(o)):(o=i.get(u),o&&(t.push(o),n.push(o)))}e.slaves=t,e.slaveUsers=s,e.slaveOrgs=n}}}function E(e){if(e){let r=this.values.users,t=this.values.user,s=this.values.orgs;r.get(t._id)!==t&&(r.set(t._id,t),r.sorted[r.sorted.findIndex(o=>o._id===t._id)]=t);let n=e.findIndex(o=>o._id===t._id);~n&&(e[n]=t),~e.added.findIndex(o=>o._id===t._id)&&(e.added[n]=t);for(let o of e.added)o.isUser=!0;let i,u=new Set;for(let o of e){let f=s.get(o.orgId)??s.null;o.org!==f&&(o.org&&(o.org.users.delete(o),v(o.org.users.sorted,o)),o.org=f,o.org.users.add(o),o.org.users.sorted.push(o),u.add(o.org)),o===t&&(i=!0)}for(let o of u)o.users.sorted.sort(r.sortCompareFunction);if(e.deleted.length)for(let o of[...s.sorted,s.null])for(let f of o.users)r.has(f._id)||(o.users.delete(f),v(o.users.sorted,f));this.isLoaded&&(i&&this.items.user.emitUpdate(),this.items.orgs.emitUpdate())}}function I(e){let r=this.values.users;if(e){let{roles:t}=this.values;for(let s of e){let n=r.get(s._id);n.roles=t.getAll(s.roleIds)}}else for(let t of r.sorted)delete t.roles}var k=[["orgs","map",U,S],["users","map",E],["user",[!0],y]],B=[["roles","map",j],["extendedUsers","map","users.extended",I,!0],["extendedOrgs","map","orgs.extended",$,!0]],A=class extends R{constructor(t){super(k,t);h(this,"isExtended",!1)}extend(){return this.isExtended===!1?(this.isExtended=null,this.attach(B).then(()=>{this.isExtended=!0})):null}unextend(){this.isExtended&&(this.isExtended=!1,this.detach(["roles","extendedUsers","extendedOrgs"]))}static handleValues({orgs:t,users:s,user:n},l){return new R([["orgs",t,U,S],["users",s,E],["user",n,y]],l)}};export{A 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", "../../../../@nesvet/npm/n/src/noop.ts", "../../../../@nesvet/npm/n/src/debounce.ts", "../../../../@nesvet/npm/n/src/getAll.ts", "../../../../@nesvet/npm/n/src/howmuch.ts", "../../../../@nesvet/npm/n/src/removeOne.ts", "../src/orgs.ts", "../src/roles.ts", "../src/user.ts", "../src/users.ts"],
4
- "sourcesContent": ["import {\n\tSubscriptionGroup,\n\ttype SubscriptionGroupOptions,\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\";\n\n\nconst basisDefinitions = [\n\t[ \"orgs\", \"map\", handleOrgs, handleOrgsBeforeSubscribe ],\n\t[ \"users\", \"map\", handleUsers ],\n\t[ \"user\", [ true ], handleUser ]\n];\n\nconst extendedDefinitions = [\n\t[ \"roles\", \"map\", handleRoles ],\n\t[ \"extendedUsers\", \"map\", \"users.extended\", handleExtendedUsers, true ],\n\t[ \"extendedOrgs\", \"map\", \"orgs.extended\", handleExtendedOrgs, true ]\n];\n\nexport class UsersSubscriptionGroup extends SubscriptionGroup<typeof basisDefinitions | typeof extendedDefinitions> {\n\tconstructor(options: SubscriptionGroupOptions) {\n\t\tsuper(basisDefinitions, options);\n\t\t\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(extendedDefinitions).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\t\n\t\treturn null;\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\t\n\tstatic handleValues({\n\t\torgs,\n\t\tusers,\n\t\tuser\n\t}: {\n\t\torgs: SubscriptionMapWithSubscription;\n\t\tusers: SubscriptionMapWithSubscription;\n\t\tuser: SubscriptionObjectWithSubscription;\n\t}, options: SubscriptionGroupOptions) {\n\t\treturn new SubscriptionGroup([\n\t\t\t[ \"orgs\", orgs, handleOrgs, handleOrgsBeforeSubscribe ],\n\t\t\t[ \"users\", users, handleUsers ],\n\t\t\t[ \"user\", user, handleUser ]\n\t\t], options);\n\t}\n\t\n}\n", "export function noop() { /**/ }\n", "import { noop } from \"./noop.js\";\n\n\ntype Callback<Result> = (...args: unknown[]) => Result;\ntype FunctionOrBoolean = (() => unknown) | boolean;\ntype Options = { leading?: FunctionOrBoolean; maxWait?: number; trailing?: FunctionOrBoolean };\ntype NumberOrUndefined = number | undefined;\n\ntype DebouncedFunction<Result> = {\n\t(this: unknown, ..._args: unknown[]): Promise<Result>;\n};\n\nexport type Debounced<Result> = {\n\tcallback: Callback<Result>;\n\tpromise: {\n\t\tisResolved: boolean;\n\t} & Promise<unknown>;\n\tresolve: (value: Result) => void;\n\trun(): Promise<Result>;\n\tclear(shouldRun?: boolean): Promise<void>;\n} & DebouncedFunction<Result>;\n\n\nexport function debounce<Result>(callback: Callback<Result>, limit = 0, options: Options = {}) {\n\tlet { leading = false, trailing = true } = options;\n\tconst { maxWait = Infinity } = options;\n\t\n\tlet timeout: NumberOrUndefined;\n\tlet maxWaitTimeout: NumberOrUndefined;\n\tlet end: NumberOrUndefined;\n\tlet context: unknown;\n\tlet args: unknown[];\n\tlet initial: FunctionOrBoolean;\n\tlet final: FunctionOrBoolean;\n\tlet result: Result;\n\t\n\tconst expired = async () => {\n\t\t\n\t\tconst n = Date.now();\n\t\t\n\t\tif (n >= end!) {\n\t\t\ttimeout = undefined;\n\t\t\tend = undefined;\n\t\t\tclearTimeout(maxWaitTimeout);\n\t\t\tif (typeof final == \"function\")\n\t\t\t\tawait final();\n\t\t\tdebounced.resolve(result);\n\t\t\tdebounced.promise.isResolved = true;\n\t\t\tinitial = leading;\n\t\t} else {\n\t\t\tclearTimeout(timeout);\n\t\t\ttimeout = setTimeout(expired, end! - n);\n\t\t}\n\t\t\n\t};\n\t\n\tconst maxWaitExpired = Number.isFinite(maxWait) ? () => {\n\t\t\n\t\tif (final === run)\n\t\t\tfinal = false;\n\t\trun();\n\t\tmaxWaitTimeout = setTimeout(maxWaitExpired as TimerHandler, maxWait);\n\t\t\n\t} : null;\n\t\n\tasync function run() {\n\t\treturn (result = await callback.apply(context, args));\n\t}\n\t\n\tif (leading && typeof leading == \"boolean\")\n\t\tleading = run;\n\tinitial = leading;\n\t\n\tif (trailing && typeof trailing == \"boolean\")\n\t\ttrailing = run;\n\tfinal = trailing;\n\t\n\tconst debounced: Debounced<Result> = Object.assign(function (..._args) {\n\t\targs = _args;\n\t\tcontext = this;// eslint-disable-line no-invalid-this\n\t\t\n\t\tend = Date.now() + limit;\n\t\tfinal = trailing;\n\t\t\n\t\tif (debounced.promise.isResolved)\n\t\t\tdebounced.promise = Object.assign(new Promise(resolve => {\n\t\t\t\tdebounced.resolve = resolve;\n\t\t\t\t\n\t\t\t\tif (typeof initial == \"function\") {\n\t\t\t\t\tinitial();\n\t\t\t\t\tinitial = false;\n\t\t\t\t\tif (final === run)\n\t\t\t\t\t\tfinal = false;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (!timeout) {\n\t\t\t\t\ttimeout = setTimeout(expired, limit);\n\t\t\t\t\tif (maxWaitExpired)\n\t\t\t\t\t\tmaxWaitTimeout = setTimeout(maxWaitExpired, maxWait);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}), {\n\t\t\t\tisResolved: false\n\t\t\t});\n\t\t\n\t\treturn debounced.promise;\n\t} as DebouncedFunction<Result>, {\n\t\tcallback,\n\t\tpromise: Object.assign(Promise.resolve(), {\n\t\t\tisResolved: true\n\t\t}),\n\t\tresolve: noop,\n\t\trun,\n\t\tclear: async (shouldRun?: boolean) => {\n\t\t\t\n\t\t\tclearTimeout(timeout);\n\t\t\ttimeout = undefined;\n\t\t\t\n\t\t\tclearTimeout(maxWaitTimeout);\n\t\t\t\n\t\t\tdebounced.promise.isResolved = true;\n\t\t\tdebounced.resolve(shouldRun ? await run() : result);\n\t\t\t\n\t\t}\n\t});\n\t\n\treturn debounced;\n}\n\n\ndebounce.noop = Object.assign(() => { /**/ }, {\n\tcallback: noop,\n\tpromise: Object.assign(Promise.resolve(), {\n\t\tisResolved: true\n\t}),\n\tresolve: noop,\n\trun: noop,\n\tclear: noop\n}) as unknown as Debounced<void>;\n\n\nexport function throttle<Result>(callback: Callback<Result>, limit?: number, options?: Options) {\n\treturn debounce(callback, limit, {\n\t\tmaxWait: limit,\n\t\tleading: true,\n\t\ttrailing: true,\n\t\t...options\n\t});\n}\n", "export function getAll<K, V>(map: Map<K, V>, keys: K[], onlyExisting?: false): (undefined | V)[];\nexport function getAll<K, V>(map: Map<K, V>, keys: K[], onlyExisting: true): V[];\nexport function getAll<K, V>(map: Map<K, V>, keys: K[], onlyExisting = false) {\n\tif (onlyExisting)\n\t\tkeys = keys.filter(key => map.has(key));\n\t\n\treturn keys.map(key => map.get(key));\n}\n", "export function howmuch(number: [] | number, one: string, two: string, five: boolean | string, shouldPrintNumber = true) {\n\tif (Array.isArray(number))\n\t\tnumber = number.length;\n\t\n\tif (typeof five != \"string\") {\n\t\tshouldPrintNumber = five ?? true;\n\t\tfive = two;\n\t}\n\t\n\t\n\treturn (shouldPrintNumber ? `${number}\u00A0` : \"\") + howmuch.raw(number, one, two, five);\n}\n\nhowmuch.raw = (number: number, one: string, two: string, five = two) => {\n\tnumber = Math.abs(number);\n\tconst u = number % 10;\n\tconst d = number % 100;\n\t\n\treturn (\n\t\t(u === 1 && d !== 11) ?\n\t\t\tone :\n\t\t\t((u >= 2 && u <= 4) && !(d >= 12 && d <= 15)) ?\n\t\t\t\ttwo :\n\t\t\t\tfive\n\t);\n};\n", "export function removeOne<T>(array: T[], item: T): boolean {\n\tconst i = array.indexOf(item);\n\tif (i > -1) {\n\t\tarray.splice(i, 1);\n\t\t\n\t\treturn true;\n\t}\n\t\n\treturn false;\n}\n", "import { getAll } from \"@nesvet/n\";\nimport type { SubscriptionMapUpdated, SubscriptionMapWithSubscription } from \"insite-subscriptions-client\";\nimport type { User } from \"./users\";\nimport type { UsersSubscriptionGroup } from \"./UsersSubscriptionGroup\";\n\n\nexport type Org = {\n\t_id: string;\n\ttitle: string;\n\tisOrg: true;\n\tusers: { sorted: User[] } & Set<User>;\n};\n\nexport type NullOrg = { _id: null } & Omit<Org, \"_id\">;\n\ntype OrgExtension = {\n\t_id: string;\n\towners: string[];\n\tslaveOrgs: string[];\n\tnote: string;\n};\n\nexport type OrgExtended = {\n\towners?: (OrgExtended | User)[];\n\tslaveOrgs?: OrgExtended[];\n\tnote?: string;\n\t_l?: number;\n} & Org;\n\ntype OrgsExtra = {\n\tnull: NullOrg;\n};\n\nexport type Orgs = OrgsExtra & SubscriptionMapWithSubscription<Org>;\n\nexport type OrgsExtended = {\n\tsortedHierarchically?: OrgExtended[];\n} & OrgsExtra & SubscriptionMapWithSubscription<OrgExtended>;\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: null | SubscriptionMapUpdated<Org>) {\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: null | SubscriptionMapUpdated<OrgExtension>) {\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, SubscriptionMapWithSubscription } from \"insite-subscriptions-client\";\nimport type { UsersSubscriptionGroup } from \"./UsersSubscriptionGroup\";\n\n\nexport type Role = {\n\t_id: string;\n\townInvolves: Role[];\n\tinvolves: Role[];\n\t_l: number;\n};\n\nexport type Roles = SubscriptionMapWithSubscription<Role>;\n\n\n/** @this UsersSubscriptionGroup */\nexport function handleRoles(this: UsersSubscriptionGroup, updated: null | SubscriptionMapUpdated<Role>) {\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 { Abilities, AbilitiesSchema } from \"insite-common\";\nimport type { Org } from \"./orgs\";\nimport type { User, UserExtended } from \"./users\";\nimport type { UsersSubscriptionGroup } from \"./UsersSubscriptionGroup\";\n\n\nexport type CurrentUser<AS extends AbilitiesSchema = AbilitiesSchema> = {\n\tabilities: Abilities<AS>;\n\tsessionId?: string;\n\tslaveIds: string[];\n\tslavesSnapshot: string;\n\tslaves: (Org | User)[];\n\tslaveUsers: User[];\n\tslaveOrgs: Org[];\n} & UserExtended;\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 { removeOne } from \"@nesvet/n\";\nimport type { SubscriptionMapUpdated, SubscriptionMapWithSubscription } from \"insite-subscriptions-client\";\nimport type { NullOrg, Org, Orgs } from \"./orgs\";\nimport type { Role } from \"./roles\";\nimport type { CurrentUser } from \"./user\";\nimport type { UsersSubscriptionGroup } from \"./UsersSubscriptionGroup\";\n\n\nexport type User = {\n\t_id: string;\n\tisUser: true;\n\temail: string;\n\tname: {\n\t\tfirst: string;\n\t\tmiddle: string;\n\t\tlast: string;\n\t};\n\torgId: string;\n\tjob: string;\n\tinitials: string;\n\tdisplayLabel: string;\n\tavatarUrl: string;\n\tisOnline: boolean;\n\torg: NullOrg | Org;\n};\n\ntype UserExtension = {\n\t_id: string;\n\troleIds: string[];\n};\n\nexport type UserExtended = {\n\troles?: Role;\n} & User;\n\nexport type Users = SubscriptionMapWithSubscription<User>;\n\nexport type UsersExtended = SubscriptionMapWithSubscription<UserExtended>;\n\n\n/** @this UsersSubscriptionGroup */\nexport function handleUsers(this: UsersSubscriptionGroup, updated: null | SubscriptionMapUpdated<User>) {\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\t\n\t\t\t\torgsToSortUsers.add(user.org);\n\t\t\t}\n\t\t\t\n\t\t\tif (user === currentUser)\n\t\t\t\tshouldUpdateUser = true;\n\t\t\t\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: null | SubscriptionMapUpdated<UserExtension>) {\n\t\n\tconst users = this.values.users as UsersExtended;\n\t\n\tif (updated) {\n\t\tconst { roles } = this.values;\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 = roles.getAll(userExtension.roleIds);\n\t\t}\n\t} else\n\t\tfor (const user of users.sorted)\n\t\t\tdelete user.roles;\n\t\n}\n"],
4
+ "sourcesContent": ["import {\n\tSubscriptionGroup,\n\ttype SubscriptionGroupOptions,\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\";\n\n\nconst basisDefinitions = [\n\t[ \"orgs\", \"map\", handleOrgs, handleOrgsBeforeSubscribe ],\n\t[ \"users\", \"map\", handleUsers ],\n\t[ \"user\", [ true ], handleUser ]\n];\n\nconst extendedDefinitions = [\n\t[ \"roles\", \"map\", handleRoles ],\n\t[ \"extendedUsers\", \"map\", \"users.extended\", handleExtendedUsers, true ],\n\t[ \"extendedOrgs\", \"map\", \"orgs.extended\", handleExtendedOrgs, true ]\n];\n\nexport class UsersSubscriptionGroup extends SubscriptionGroup<typeof basisDefinitions | typeof extendedDefinitions> {\n\tconstructor(options: SubscriptionGroupOptions) {\n\t\tsuper(basisDefinitions, options);\n\t\t\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(extendedDefinitions).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\t\n\t\treturn null;\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\t\n\tstatic handleValues({\n\t\torgs,\n\t\tusers,\n\t\tuser\n\t}: {\n\t\torgs: SubscriptionMapWithSubscription;\n\t\tusers: SubscriptionMapWithSubscription;\n\t\tuser: SubscriptionObjectWithSubscription;\n\t}, options: SubscriptionGroupOptions) {\n\t\treturn new SubscriptionGroup([\n\t\t\t[ \"orgs\", orgs, handleOrgs, handleOrgsBeforeSubscribe ],\n\t\t\t[ \"users\", users, handleUsers ],\n\t\t\t[ \"user\", user, handleUser ]\n\t\t], options);\n\t}\n\t\n}\n", "export function noop() { /**/ }\n", "import { noop } from \"./noop.js\";\n\n\ntype Callback<Result> = (...args: unknown[]) => Result;\ntype FunctionOrBoolean = (() => unknown) | boolean;\ntype Options = { leading?: FunctionOrBoolean; maxWait?: number; trailing?: FunctionOrBoolean };\ntype NumberOrUndefined = number | undefined;\n\ntype DebouncedFunction<Result> = {\n\t(this: unknown, ..._args: unknown[]): Promise<Result>;\n};\n\nexport type Debounced<Result> = {\n\tcallback: Callback<Result>;\n\tpromise: {\n\t\tisResolved: boolean;\n\t} & Promise<unknown>;\n\tresolve: (value: Result) => void;\n\trun(): Promise<Result>;\n\tclear(shouldRun?: boolean): Promise<void>;\n} & DebouncedFunction<Result>;\n\n\nexport function debounce<Result>(callback: Callback<Result>, limit = 0, options: Options = {}) {\n\tlet { leading = false, trailing = true } = options;\n\tconst { maxWait = Infinity } = options;\n\t\n\tlet timeout: NumberOrUndefined;\n\tlet maxWaitTimeout: NumberOrUndefined;\n\tlet end: NumberOrUndefined;\n\tlet context: unknown;\n\tlet args: unknown[];\n\tlet initial: FunctionOrBoolean;\n\tlet final: FunctionOrBoolean;\n\tlet result: Result;\n\t\n\tconst expired = async () => {\n\t\t\n\t\tconst n = Date.now();\n\t\t\n\t\tif (n >= end!) {\n\t\t\ttimeout = undefined;\n\t\t\tend = undefined;\n\t\t\tclearTimeout(maxWaitTimeout);\n\t\t\tif (typeof final == \"function\")\n\t\t\t\tawait final();\n\t\t\tdebounced.resolve(result);\n\t\t\tdebounced.promise.isResolved = true;\n\t\t\tinitial = leading;\n\t\t} else {\n\t\t\tclearTimeout(timeout);\n\t\t\ttimeout = setTimeout(expired, end! - n);\n\t\t}\n\t\t\n\t};\n\t\n\tconst maxWaitExpired = Number.isFinite(maxWait) ? () => {\n\t\t\n\t\tif (final === run)\n\t\t\tfinal = false;\n\t\trun();\n\t\tmaxWaitTimeout = setTimeout(maxWaitExpired as TimerHandler, maxWait);\n\t\t\n\t} : null;\n\t\n\tasync function run() {\n\t\treturn (result = await callback.apply(context, args));\n\t}\n\t\n\tif (leading && typeof leading == \"boolean\")\n\t\tleading = run;\n\tinitial = leading;\n\t\n\tif (trailing && typeof trailing == \"boolean\")\n\t\ttrailing = run;\n\tfinal = trailing;\n\t\n\tconst debounced: Debounced<Result> = Object.assign(function (..._args) {\n\t\targs = _args;\n\t\tcontext = this;// eslint-disable-line no-invalid-this\n\t\t\n\t\tend = Date.now() + limit;\n\t\tfinal = trailing;\n\t\t\n\t\tif (debounced.promise.isResolved)\n\t\t\tdebounced.promise = Object.assign(new Promise(resolve => {\n\t\t\t\tdebounced.resolve = resolve;\n\t\t\t\t\n\t\t\t\tif (typeof initial == \"function\") {\n\t\t\t\t\tinitial();\n\t\t\t\t\tinitial = false;\n\t\t\t\t\tif (final === run)\n\t\t\t\t\t\tfinal = false;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (!timeout) {\n\t\t\t\t\ttimeout = setTimeout(expired, limit);\n\t\t\t\t\tif (maxWaitExpired)\n\t\t\t\t\t\tmaxWaitTimeout = setTimeout(maxWaitExpired, maxWait);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}), {\n\t\t\t\tisResolved: false\n\t\t\t});\n\t\t\n\t\treturn debounced.promise;\n\t} as DebouncedFunction<Result>, {\n\t\tcallback,\n\t\tpromise: Object.assign(Promise.resolve(), {\n\t\t\tisResolved: true\n\t\t}),\n\t\tresolve: noop,\n\t\trun,\n\t\tclear: async (shouldRun?: boolean) => {\n\t\t\t\n\t\t\tclearTimeout(timeout);\n\t\t\ttimeout = undefined;\n\t\t\t\n\t\t\tclearTimeout(maxWaitTimeout);\n\t\t\t\n\t\t\tdebounced.promise.isResolved = true;\n\t\t\tdebounced.resolve(shouldRun ? await run() : result);\n\t\t\t\n\t\t}\n\t});\n\t\n\treturn debounced;\n}\n\n\ndebounce.noop = Object.assign(() => { /**/ }, {\n\tcallback: noop,\n\tpromise: Object.assign(Promise.resolve(), {\n\t\tisResolved: true\n\t}),\n\tresolve: noop,\n\trun: noop,\n\tclear: noop\n}) as unknown as Debounced<void>;\n\n\nexport function throttle<Result>(callback: Callback<Result>, limit?: number, options?: Options) {\n\treturn debounce(callback, limit, {\n\t\tmaxWait: limit,\n\t\tleading: true,\n\t\ttrailing: true,\n\t\t...options\n\t});\n}\n", "export function getAll<K, V>(map: Map<K, V>, keys: K[], onlyExisting?: false): (undefined | V)[];\nexport function getAll<K, V>(map: Map<K, V>, keys: K[], onlyExisting: true): V[];\nexport function getAll<K, V>(map: Map<K, V>, keys: K[], onlyExisting = false) {\n\tif (onlyExisting)\n\t\tkeys = keys.filter(key => map.has(key));\n\t\n\treturn keys.map(key => map.get(key));\n}\n", "export function howmuch(number: [] | number, one: string, two: string, five: boolean | string, shouldPrintNumber = true) {\n\tif (Array.isArray(number))\n\t\tnumber = number.length;\n\t\n\tif (typeof five != \"string\") {\n\t\tshouldPrintNumber = five ?? true;\n\t\tfive = two;\n\t}\n\t\n\t\n\treturn (shouldPrintNumber ? `${number}\u00A0` : \"\") + howmuch.raw(number, one, two, five);\n}\n\nhowmuch.raw = (number: number, one: string, two: string, five = two) => {\n\tnumber = Math.abs(number);\n\tconst u = number % 10;\n\tconst d = number % 100;\n\t\n\treturn (\n\t\t(u === 1 && d !== 11) ?\n\t\t\tone :\n\t\t\t((u >= 2 && u <= 4) && !(d >= 12 && d <= 15)) ?\n\t\t\t\ttwo :\n\t\t\t\tfive\n\t);\n};\n", "export function removeOne<T>(array: T[], item: T): boolean {\n\tconst i = array.indexOf(item);\n\tif (i > -1) {\n\t\tarray.splice(i, 1);\n\t\t\n\t\treturn true;\n\t}\n\t\n\treturn false;\n}\n", "import { getAll } from \"@nesvet/n\";\nimport type { SubscriptionMapUpdated, SubscriptionMapWithSubscription } from \"insite-subscriptions-client\";\nimport type { User } from \"./users\";\nimport type { UsersSubscriptionGroup } from \"./UsersSubscriptionGroup\";\n\n\nexport type Org = {\n\t_id: string;\n\ttitle: string;\n\tisOrg: true;\n\tusers: { sorted: User[] } & Set<User>;\n};\n\nexport type NullOrg = { _id: null } & Omit<Org, \"_id\">;\n\ntype OrgExtension = {\n\t_id: string;\n\towners: string[];\n\tslaveOrgs: string[];\n\tnote: string;\n};\n\nexport type OrgExtended = {\n\towners?: (OrgExtended | User)[];\n\tslaveOrgs?: OrgExtended[];\n\tnote?: string;\n\t_l?: number;\n} & Org;\n\ntype OrgsExtra = {\n\tnull: NullOrg;\n};\n\nexport type Orgs = OrgsExtra & SubscriptionMapWithSubscription<Org>;\n\nexport type OrgsExtended = {\n\tsortedHierarchically?: OrgExtended[];\n} & OrgsExtra & SubscriptionMapWithSubscription<OrgExtended>;\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: null | SubscriptionMapUpdated<Org>) {\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: null | SubscriptionMapUpdated<OrgExtension>) {\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, SubscriptionMapWithSubscription } from \"insite-subscriptions-client\";\nimport type { UsersSubscriptionGroup } from \"./UsersSubscriptionGroup\";\n\n\nexport type Role = {\n\t_id: string;\n\townInvolves: Role[];\n\tinvolves: Role[];\n\t_l: number;\n};\n\nexport type Roles = SubscriptionMapWithSubscription<Role>;\n\n\n/** @this UsersSubscriptionGroup */\nexport function handleRoles(this: UsersSubscriptionGroup, updated: null | SubscriptionMapUpdated<Role>) {\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 { Abilities, AbilitiesSchema } from \"insite-common\";\nimport type { Org } from \"./orgs\";\nimport type { User, UserExtended } from \"./users\";\nimport type { UsersSubscriptionGroup } from \"./UsersSubscriptionGroup\";\n\n\nexport type CurrentUser<AS extends AbilitiesSchema = AbilitiesSchema> = {\n\tabilities: Abilities<AS>;\n\tsessionId?: string;\n\tslaveIds: string[];\n\tslavesSnapshot: string;\n\tslaves: (Org | User)[];\n\tslaveUsers: User[];\n\tslaveOrgs: Org[];\n} & UserExtended;\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 { removeOne } from \"@nesvet/n\";\nimport type { SubscriptionMapUpdated, SubscriptionMapWithSubscription } from \"insite-subscriptions-client\";\nimport type { NullOrg, Org, Orgs } from \"./orgs\";\nimport type { Role } from \"./roles\";\nimport type { CurrentUser } from \"./user\";\nimport type { UsersSubscriptionGroup } from \"./UsersSubscriptionGroup\";\n\n\nexport type User = {\n\t_id: string;\n\tisUser: true;\n\temail: string;\n\tname: {\n\t\tfirst: string;\n\t\tmiddle: string;\n\t\tlast: string;\n\t};\n\torgId: string;\n\tjob: string;\n\tinitials: string;\n\tdisplayLabel: string;\n\tavatarUrl: string;\n\tisOnline: boolean;\n\torg: NullOrg | Org;\n};\n\ntype UserExtension = {\n\t_id: string;\n\troleIds: string[];\n};\n\nexport type UserExtended = User & {\n\troles?: Role;\n};\n\nexport type Users = SubscriptionMapWithSubscription<User>;\n\nexport type UsersExtended = SubscriptionMapWithSubscription<UserExtended>;\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\t\n\t\t\t\torgsToSortUsers.add(user.org);\n\t\t\t}\n\t\t\t\n\t\t\tif (user === currentUser)\n\t\t\t\tshouldUpdateUser = true;\n\t\t\t\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;\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 = roles.getAll(userExtension.roleIds);\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
5
  "mappings": "oKAAA,OACC,qBAAAA,MAIM,8BCLD,SAAUC,GAAI,CAAU,CCuBxB,SAAUC,EAAiBC,EAA4BC,EAAQ,EAAGC,EAAmB,CAAA,EAAE,CAC5F,GAAI,CAAE,QAAAC,EAAU,GAAO,SAAAC,EAAW,EAAI,EAAKF,EACrC,CAAE,QAAAG,EAAU,GAAQ,EAAKH,EAE3BI,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAEEC,EAAU,SAAW,CAE1B,IAAMC,EAAI,KAAK,IAAG,EAEdA,GAAKP,GACRF,EAAU,OACVE,EAAM,OACN,aAAaD,CAAc,EACvB,OAAOK,GAAS,YACnB,MAAMA,EAAK,EACZI,EAAU,QAAQH,CAAM,EACxBG,EAAU,QAAQ,WAAa,GAC/BL,EAAUR,IAEV,aAAaG,CAAO,EACpBA,EAAU,WAAWQ,EAASN,EAAOO,CAAC,EAGxC,EAEME,EAAiB,OAAO,SAASZ,CAAO,EAAI,IAAK,CAElDO,IAAUM,IACbN,EAAQ,IACTM,EAAG,EACHX,EAAiB,WAAWU,EAAgCZ,CAAO,CAEpE,EAAI,KAEJ,eAAea,GAAG,CACjB,OAAQL,EAAS,MAAMb,EAAS,MAAMS,EAASC,CAAI,CACpD,CAEIP,GAAW,OAAOA,GAAW,YAChCA,EAAUe,GACXP,EAAUR,EAENC,GAAY,OAAOA,GAAY,YAClCA,EAAWc,GACZN,EAAQR,EAER,IAAMY,EAA+B,OAAO,OAAO,YAAaG,EAAK,CACpE,OAAAT,EAAOS,EACPV,EAAU,KAEVD,EAAM,KAAK,IA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E,QAAS,gBAAiB,cAAe,CAAC,EAG1D,CAGA,OAAO,aAAa,CACnB,KAAAQ,EACA,MAAAC,EACA,KAAAC,CACD,EAIGJ,EAAmC,CACrC,OAAO,IAAID,EAAkB,CAC5B,CAAE,OAAQG,EAAMZ,EAAYC,CAA0B,EACtD,CAAE,QAASY,EAAOX,CAAY,EAC9B,CAAE,OAAQY,EAAMX,CAAW,CAC5B,EAAGO,CAAO,CACX,CAED",
6
6
  "names": ["SubscriptionGroup", "noop", "debounce", "callback", "limit", "options", "leading", "trailing", "maxWait", "timeout", "maxWaitTimeout", "end", "context", "args", "initial", "final", "result", "expired", "n", "debounced", "maxWaitExpired", "run", "_args", "resolve", "noop", "shouldRun", "getAll", "map", "keys", "onlyExisting", "key", "howmuch", "number", "one", "two", "five", "shouldPrintNumber", "u", "d", "removeOne", "array", "item", "i", "handleOrgsBeforeSubscribe", "orgs", "handleOrgs", "updated", "org", "handleExtendedOrgs", "users", "extendedOrgs", "orgExtension", "_id", "getAll", "sortedHierarchically", "slaveOrg", "handleRoles", "updated", "roles", "role", "getAll", "involvedRole", "handleUser", "user", "slavesSnapshot", "slaves", "slaveUsers", "slaveOrgs", "users", "orgs", "_id", "slave", "handleUsers", "updated", "users", "currentUser", "orgs", "user", "updatedUserIndex", "shouldUpdateUser", "orgsToSortUsers", "org", "removeOne", "handleExtendedUsers", "roles", "userExtension", "basisDefinitions", "handleOrgs", "handleOrgsBeforeSubscribe", "handleUsers", "handleUser", "extendedDefinitions", "handleRoles", "handleExtendedUsers", "handleExtendedOrgs", "UsersSubscriptionGroup", "SubscriptionGroup", "options", "__publicField", "orgs", "users", "user"]
7
7
  }
package/dist/users.d.ts CHANGED
@@ -23,14 +23,14 @@ type UserExtension = {
23
23
  _id: string;
24
24
  roleIds: string[];
25
25
  };
26
- export type UserExtended = {
26
+ export type UserExtended = User & {
27
27
  roles?: Role;
28
- } & User;
28
+ };
29
29
  export type Users = SubscriptionMapWithSubscription<User>;
30
30
  export type UsersExtended = SubscriptionMapWithSubscription<UserExtended>;
31
31
  /** @this UsersSubscriptionGroup */
32
- export declare function handleUsers(this: UsersSubscriptionGroup, updated: null | SubscriptionMapUpdated<User>): void;
32
+ export declare function handleUsers(this: UsersSubscriptionGroup, updated: SubscriptionMapUpdated<User> | null): void;
33
33
  /** @this UsersSubscriptionGroup */
34
- export declare function handleExtendedUsers(this: UsersSubscriptionGroup, updated: null | SubscriptionMapUpdated<UserExtension>): void;
34
+ export declare function handleExtendedUsers(this: UsersSubscriptionGroup, updated: SubscriptionMapUpdated<UserExtension> | null): void;
35
35
  export {};
36
36
  //# sourceMappingURL=users.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"users.d.ts","sourceRoot":"","sources":["../src/users.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,+BAA+B,EAAE,MAAM,6BAA6B,CAAC;AAC3G,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAQ,MAAM,QAAQ,CAAC;AACjD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAEpC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAGvE,MAAM,MAAM,IAAI,GAAG;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,IAAI,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE;QACL,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;KACb,CAAC;IACF,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,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,KAAK,aAAa,GAAG;IACpB,G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AE,MAAM,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,GAAG,EAAE,OAAO,GAAG,GAAG,CAAC;CACnB,CAAC;AAEF,KAAK,aAAa,GAAG;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG;IACjC,KAAK,CAAC,EAAE,IAAI,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,KAAK,GAAG,+BAA+B,CAAC,IAAI,CAAC,CAAC;AAE1D,MAAM,MAAM,aAAa,GAAG,+BAA+B,CAAC,YAAY,CAAC,CAAC;AAG1E,mCAAmC;AACnC,wBAAgB,WAAW,CAAC,IAAI,EAAE,sBAAsB,EAAE,OAAO,EAAE,sBAAsB,CAAC,IAAI,CAAC,GAAG,IAAI,QAgErG;AAED,mCAAmC;AACnC,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,sBAAsB,EAAE,OAAO,EAAE,sBAAsB,CAAC,aAAa,CAAC,GAAG,IAAI,QAgBtH"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "insite-users-client",
3
- "version": "2.1.1",
3
+ "version": "2.1.3",
4
4
  "description": "inSite users client side",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -23,13 +23,13 @@
23
23
  "author": "Eugene Nesvetaev <dev@nesvet.dev> (https://nesvet.dev/)",
24
24
  "license": "MIT",
25
25
  "dependencies": {
26
- "@nesvet/n": "^1.1.22",
27
- "insite-subscriptions-client": "^2.1.1"
26
+ "@nesvet/n": "^1.1.23",
27
+ "insite-common": "^2.1.2",
28
+ "insite-subscriptions-client": "^2.1.3"
28
29
  },
29
30
  "devDependencies": {
30
- "@nesvet/conveyer": "^2.4.2",
31
+ "@nesvet/conveyer": "^2.4.3",
31
32
  "@nesvet/eslint-config": "^2.0.47",
32
- "insite-common": "^2.1.1",
33
33
  "typescript": "^5.7.3"
34
34
  }
35
35
  }