insite-subscriptions-client 2.0.2 → 2.0.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/Subscription.d.ts
CHANGED
|
@@ -3,12 +3,12 @@ declare global {
|
|
|
3
3
|
var __initials: undefined | unknown[];
|
|
4
4
|
}
|
|
5
5
|
export declare class Subscription {
|
|
6
|
-
constructor(type: "array" | "map" | "object", publicationName: string, args: unknown[] | undefined, handler: (updates:
|
|
6
|
+
constructor(type: "array" | "map" | "object", publicationName: string, args: unknown[] | undefined, handler: (updates: any) => void, immediately?: boolean);
|
|
7
7
|
i: number;
|
|
8
8
|
type: "object" | "array" | "map";
|
|
9
9
|
publicationName: string;
|
|
10
10
|
args: unknown[];
|
|
11
|
-
handler: (updates:
|
|
11
|
+
handler: (updates: any) => void;
|
|
12
12
|
immediately: boolean;
|
|
13
13
|
isActive: boolean;
|
|
14
14
|
start: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Subscription.d.ts","sourceRoot":"","sources":["../src/Subscription.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"Subscription.d.ts","sourceRoot":"","sources":["../src/Subscription.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAMxD,OAAO,CAAC,MAAM,CAAC;IACd,IAAI,UAAU,EAAE,SAAS,GAAG,OAAO,EAAE,CAAC;CACtC;AAQD,qBAAa,YAAY;gBACZ,IAAI,EAAE,OAAO,GAAG,KAAK,GAAG,QAAQ,EAAE,eAAe,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,YAAK,EAAE,OAAO,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,IAAI,EAAE,WAAW,UAAO;IA2BhJ,CAAC,SAAC;IACF,IAAI,6BAAC;IACL,eAAe,SAAC;IAChB,IAAI,YAAC;IACL,OAAO,YA/ByG,GAAG,KAAK,IAAI,CA+BpH;IACR,WAAW,UAAC;IACZ,QAAQ,UAAC;IAET,KAAK,aAMH;IAEF,MAAM;IAWN,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,eAAe;CAgClC"}
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/Subscription.ts", "../src/SubscriptionArray.ts", "../src/symbols.ts", "../src/SubscriptionGroup/SubscriptionGroup.ts", "../src/SubscriptionGroup/common.ts", "../src/SubscriptionGroup/SubscriptionGroupItem.ts", "../src/SubscriptionMap.ts", "../src/SubscriptionObject.ts"],
|
|
4
|
-
"sourcesContent": ["import type { InSiteWebSocket } from \"insite-ws/client\";\n\n\ndeclare global {\n\tvar __initials: undefined | unknown[];// eslint-disable-line no-var\n}\n\n\nlet i: number;\nlet subscriptions: Map<number, Subscription>;\nlet ws: InSiteWebSocket;\n\n\nexport class Subscription {\n\tconstructor(type: \"array\" | \"map\" | \"object\", publicationName: string, args: unknown[] = [], handler: (updates: unknown) => void, immediately = true) {\n\t\t\n\t\tif (!ws)\n\t\t\tthrow new Error(\"Subscription is not binded to WS. Do Subscription.bindTo(ws) first\");\n\t\t\n\t\tthis.i = i++;\n\t\tthis.type = type;\n\t\tthis.publicationName = publicationName;\n\t\tthis.args = args;\n\t\tthis.handler = handler;\n\t\tthis.immediately = immediately && !window.__initials;\n\t\t\n\t\tsubscriptions.set(this.i, this);\n\t\t\n\t\tws.on(\"open\", this.start);\n\t\t\n\t\tif (ws.isOpen)\n\t\t\tthis.start();\n\t\t\n\t\tif (window.__initials) {\n\t\t\tthis.isActive = true;\n\t\t\tthis.handler(window.__initials.splice(0, 1)[0]);\n\t\t} else\n\t\t\tthis.isActive = false;\n\t\t\n\t}\n\t\n\ti;\n\ttype;\n\tpublicationName;\n\targs;\n\thandler;\n\timmediately;\n\tisActive;\n\t\n\tstart = () => {\n\t\t\n\t\tws.sendMessage(\"s-s\"/* subscription subscribe */, this.type, this.publicationName, this.i, this.args, this.immediately);\n\t\t\n\t\tthis.immediately = true;\n\t\t\n\t};\n\t\n\tcancel() {\n\t\t\n\t\tsubscriptions.delete(this.i);\n\t\t\n\t\tws.off(\"open\", this.start);\n\t\t\n\t\tws.sendMessage(\"s-u\"/* subscription unsubscribe */, this.i);\n\t\t\n\t}\n\t\n\t\n\tstatic bindTo(_ws: InSiteWebSocket) {\n\t\tws = _ws;\n\t\t\n\t\ti = 0;\n\t\t\n\t\tsubscriptions = new Map();\n\t\t\n\t\tws.on(\"message:s-c\"/* subscription changed */, (si: number, updates: unknown) => {\n\t\t\tconst subscription = subscriptions.get(si);\n\t\t\tif (subscription) {\n\t\t\t\tsubscription.isActive = true;\n\t\t\t\tsubscription.handler(updates);\n\t\t\t}\n\t\t\t\n\t\t});\n\t\t\n\t\tws.on(\"close\", () => {\n\t\t\t\n\t\t\tfor (const subscription of subscriptions.values())\n\t\t\t\tsubscription.isActive = false;\n\t\t\t\n\t\t});\n\t\t\n\t\tws.on(\"server-change\", () => {\n\t\t\t\n\t\t\tfor (const subscription of subscriptions.values())\n\t\t\t\tsubscription.handler(null);\n\t\t\t\n\t\t});\n\t\t\n\t}\n\t\n}\n", "import { removeOne } from \"@nesvet/n\";\nimport { Subscription } from \"./Subscription\";\nimport {\n\tclearSymbol,\n\tgetAsInitialUpdatedSymbol,\n\tgetAsUpdatesSymbol,\n\tgetHandleUpdateSymbol,\n\tgetSubscriptionSymbol,\n\trenewSymbol,\n\tsetHandleUpdateSymbol,\n\tsubscribeSymbol,\n\tunsubscribeSymbol,\n\tupdateSymbol\n} from \"./symbols\";\n\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\n\ntype Item = unknown;\n\ntype Updated<I extends Item = Item> = {\n\tdeleted: I[];\n\tadded: I[];\n} & I[];\n\nexport type Updates<I extends Item = Item> =\n\t(\n\t\t[ \"a\"/* add */, newItem: I ] |\n\t\t[ \"d\"/* delete */, itemToDelete: I ] |\n\t\t[ \"i\"/* initial */, items: I[], sort?: -1 | 1 ] |\n\t\tnull\n\t)[] |\n\tnull;\n\ntype UpdateHandler<I extends Item = Item> = (array: SubscriptionArray<I>, updated: Updated<I>, updates: Updates<I>) => void;\n\nconst ascSort = (a: any, b: any) => a > b ? 1 : a < b ? -1 : 0;\nconst descSort = (a: any, b: any) => a > b ? -1 : a < b ? 1 : 0;\n\n\nexport class SubscriptionArray<I extends Item = Item> extends Array<I> {\n\tconstructor(updates?: Updates<I>, onUpdate?: UpdateHandler<I>) {\n\t\tsuper();\n\t\t\n\t\tif (onUpdate)\n\t\t\tthis.handleUpdate = onUpdate;\n\t\t\n\t\tif (Array.isArray(updates))\n\t\t\tthis.update(updates);\n\t\t\n\t}\n\t\n\tsorted: Item[] = [];\n\t\n\thandleUpdate;\n\t\n\tsortDirection: -1 | 0 | 1 = 0;\n\t\n\tsortCompareFunction: null | typeof ascSort | typeof descSort = null;\n\t\n\t[getHandleUpdateSymbol]() {\n\t\treturn this.handleUpdate;\n\t}\n\t\n\t[setHandleUpdateSymbol](handleUpdate: UpdateHandler<I>) {\n\t\treturn (this.handleUpdate = handleUpdate);\n\t}\n\t\n\tupdate(updates: Updates<I>) {\n\t\t\n\t\tconst updated: Updated<I> = Object.assign([], {\n\t\t\tdeleted: [],\n\t\t\tadded: []\n\t\t});\n\t\t\n\t\tif (updates) {\n\t\t\tlet shouldSort = false;\n\t\t\t\n\t\t\tfor (const update of updates)\n\t\t\t\tswitch (update?.[0]) {\n\t\t\t\t\tcase \"i\"/* initial */: {\n\t\t\t\t\t\tconst [ , array, sort ] = update;\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (sort) {\n\t\t\t\t\t\t\tthis.sortDirection = sort;\n\t\t\t\t\t\t\tthis.sortCompareFunction = sort > 0 ? ascSort : descSort;\n\t\t\t\t\t\t\tshouldSort = true;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthis.sortDirection = 0;\n\t\t\t\t\t\t\tthis.sortCompareFunction = null;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tthis.length = 0;\n\t\t\t\t\t\t\n\t\t\t\t\t\tfor (const newItem of array) {\n\t\t\t\t\t\t\tthis.push(newItem);\n\t\t\t\t\t\t\tupdated.push(newItem);\n\t\t\t\t\t\t\tupdated.added.push(newItem);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tcase \"a\"/* add */: {\n\t\t\t\t\t\tconst [ , newItem ] = update;\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (!this.includes(newItem)) {\n\t\t\t\t\t\t\tthis.push(newItem);\n\t\t\t\t\t\t\tif (this.sortDirection)\n\t\t\t\t\t\t\t\tshouldSort = true;\n\t\t\t\t\t\t\tupdated.push(newItem);\n\t\t\t\t\t\t\tupdated.added.push(newItem);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tcase \"d\"/* delete */: {\n\t\t\t\t\t\tconst [ , itemToDelete ] = update;\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (removeOne(this, itemToDelete))\n\t\t\t\t\t\t\tupdated.deleted.push(itemToDelete);\n\t\t\t\t\t\t\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tthis.clear();\n\t\t\t\t}\n\t\t\t\n\t\t\tif (shouldSort && this.sortCompareFunction)\n\t\t\t\tthis.sort(this.sortCompareFunction);\n\t\t\t\n\t\t} else\n\t\t\tthis.clear();\n\t\t\n\t\tthis.handleUpdate?.(this, updated, updates?.[0] ? updates : null);\n\t\t\n\t\treturn this;\n\t}\n\t\n\t[updateSymbol] = this.update;\n\t\n\tgetAsUpdates() {\n\t\treturn (\n\t\t\t(this.length || this.sortDirection) ?\n\t\t\t\t[ [ \"i\"/* initial */, [ ...this ], this.sortDirection ] ] :\n\t\t\t\tnull\n\t\t);\n\t}\n\t\n\t[getAsUpdatesSymbol] = this.getAsUpdates;\n\t\n\tgetAsInitialUpdated() {\n\t\treturn Object.assign([ ...this.sorted ], {\n\t\t\tadded: [ ...this.sorted ],\n\t\t\tdeleted: []\n\t\t});\n\t}\n\t\n\t[getAsInitialUpdatedSymbol] = this.getAsInitialUpdated;\n\t\n\tclear() {\n\t\t\n\t\tthis.length = 0;\n\t\tthis.sortDirection = 0;\n\t\tthis.sortCompareFunction = null;\n\t\t\n\t}\n\t\n\t[clearSymbol] = this.clear;\n\t\n\tvalueOf() {\n\t\treturn this;\n\t}\n\t\n\tget [Symbol.toStringTag]() {\n\t\treturn \"SubscriptionArray\";\n\t}\n\t\n\t\n\tstatic updateSymbol = updateSymbol;\n\tstatic getHandleUpdateSymbol = getHandleUpdateSymbol;\n\tstatic setHandleUpdateSymbol = setHandleUpdateSymbol;\n\tstatic getAsUpdatesSymbol = getAsUpdatesSymbol;\n\tstatic getAsInitialUpdatedSymbol = getAsInitialUpdatedSymbol;\n\tstatic clearSymbol = clearSymbol;\n\tstatic WithSubscription: typeof SubscriptionArrayWithSubscription;\n\t\n}\n\n\nexport class SubscriptionArrayWithSubscription<I extends Item = Item> extends SubscriptionArray<I> {\n\tconstructor(publicationName: string, params: unknown[], onUpdate: UpdateHandler<I>, immediately = true) {\n\t\tsuper(null, onUpdate);\n\t\t\n\t\tthis.publicationName = publicationName;\n\t\tthis.params = params;\n\t\t\n\t\tif (immediately)\n\t\t\tthis.subscribe();\n\t\t\n\t}\n\t\n\tpublicationName;\n\tparams;\n\tsubscription: null | Subscription = null;\n\t\n\tsubscribe() {\n\t\t\n\t\tif (!this.subscription)\n\t\t\tthis.subscription = new Subscription(\"array\", this.publicationName, this.params, updates => this.update(updates as Updates<I>));\n\t\t\n\t}\n\t\n\tget [subscribeSymbol]() {\n\t\treturn this.subscribe;\n\t}\n\t\n\tunsubscribe() {\n\t\t\n\t\tif (this.subscription) {\n\t\t\tthis.subscription.cancel();\n\t\t\tthis.subscription = null;\n\t\t}\n\t\t\n\t}\n\t\n\tget [unsubscribeSymbol]() {\n\t\treturn this.unsubscribe;\n\t}\n\t\n\trenew(publicationName?: string, params?: unknown[]) {\n\t\t\n\t\tif (this.subscription) {\n\t\t\tthis.unsubscribe();\n\t\t\t\n\t\t\tif (publicationName)\n\t\t\t\tif (Array.isArray(publicationName))\n\t\t\t\t\tparams = publicationName;\n\t\t\t\telse\n\t\t\t\t\tthis.publicationName = publicationName;\n\t\t\t\n\t\t\tif (params)\n\t\t\t\tthis.params = params;\n\t\t\t\n\t\t\tthis.subscribe();\n\t\t}\n\t\t\n\t}\n\t\n\tget [renewSymbol]() {\n\t\treturn this.renew;\n\t}\n\t\n\t[getSubscriptionSymbol]() {\n\t\treturn this.subscription;\n\t}\n\t\n\tget [Symbol.toStringTag]() {\n\t\treturn \"SubscriptionArrayWithSubscription\";\n\t}\n\t\n\t\n\tstatic subscribeSymbol = subscribeSymbol;\n\tstatic unsubscribeSymbol = unsubscribeSymbol;\n\tstatic renewSymbol = renewSymbol;\n\tstatic getSubscriptionSymbol = getSubscriptionSymbol;\n\t\n}\n\nSubscriptionArray.WithSubscription = SubscriptionArrayWithSubscription;\n\nexport { Updated as SubscriptionArrayUpdated };\n", "export const updateSymbol = Symbol(\"update\");\nexport const getHandleUpdateSymbol = Symbol(\"getHandleUpdate\");\nexport const setHandleUpdateSymbol = Symbol(\"setHandleUpdate\");\nexport const getAsUpdatesSymbol = Symbol(\"getAsUpdates\");\nexport const getAsInitialUpdatedSymbol = Symbol(\"getAsInitialUpdated\");\nexport const clearSymbol = Symbol(\"clear\");\nexport const subscribeSymbol = Symbol(\"subscribe\");\nexport const unsubscribeSymbol = Symbol(\"unsubscribe\");\nexport const renewSymbol = Symbol(\"renew\");\nexport const getSubscriptionSymbol = Symbol(\"getSubscription\");\nexport const getHandleSubscriptionSymbol = Symbol(\"getHandleSubscription\");\nexport const setHandleSubscriptionSymbol = Symbol(\"setHandleSubscription\");\n", "import EventEmitter from \"eventemitter3\";\nimport { debounce, StatefulPromise } from \"@nesvet/n\";\nimport { privates } from \"./common\";\nimport { SubscriptionGroupItem } from \"./SubscriptionGroupItem\";\nimport {\n\tDefinition,\n\tParseValues,\n\tSubscriptionHandle,\n\tSubscriptionOnBeforeInit,\n\tSubscriptionType,\n\tTupleDefinition,\n\tUnparsedDefinition\n} from \"./types\";\n\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\n\nfunction isTupleDefinition<T extends SubscriptionType>(definition: UnparsedDefinition<T>): definition is TupleDefinition {\n\treturn Array.isArray(definition);\n}\n\ntype Target = any;\n\ntype Options = {\n\ttarget?: Target;\n\tdebounce?: number;\n\timmediately?: boolean;\n};\n\n\nfunction parseDefinition<T extends SubscriptionType>(definition: UnparsedDefinition<T>) {\n\tif (isTupleDefinition(definition)) {\n\t\tconst args = definition.slice();\n\t\t\n\t\tconst parsed: Partial<Definition<T>> = {};\n\t\t\n\t\tparsed.name = args.shift() as Definition<T>[\"name\"];\n\t\tif (typeof args[0] == \"object\" && !Array.isArray(args[0])) {\n\t\t\tparsed.value = args.shift() as Definition<T>[\"value\"];\n\t\t\tparsed.type = parsed.value!.toString().match(/Subscription(Object|Array|Map)/)?.[1].toLowerCase() as Definition<T>[\"type\"];\n\t\t\tif (!parsed.type)\n\t\t\t\tthrow new Error(\"Unknown value type\");\n\t\t} else {\n\t\t\tif (typeof args[0] == \"string\")\n\t\t\t\tparsed.type = args.shift() as Definition<T>[\"type\"];\n\t\t\tif (typeof args[0] == \"string\")\n\t\t\t\tparsed.publicationName = args.shift() as Definition<T>[\"publicationName\"];\n\t\t\tif (Array.isArray(args[0]))\n\t\t\t\tparsed.params = args.shift() as Definition<T>[\"params\"];\n\t\t}\n\t\t\n\t\tif (typeof args[0] == \"function\")\n\t\t\tparsed.handle = args.shift() as SubscriptionHandle<T>;\n\t\tif (typeof args[0] == \"function\")\n\t\t\tparsed.onBeforeInit = args.shift() as SubscriptionOnBeforeInit<T>;\n\t\tif (typeof args[0] == \"number\")\n\t\t\tparsed.debounce = args.shift() as Definition<T>[\"debounce\"];\n\t\tif (typeof args[0] == \"boolean\")\n\t\t\tparsed.preventBind = args.shift() as Definition<T>[\"preventBind\"];\n\t\t\n\t\treturn parsed as Definition<T>;\n\t}\n\t\n\tdefinition.type ??= \"object\" as T;\n\t\n\treturn definition;\n}\n\nexport class SubscriptionGroup<DS extends UnparsedDefinition[] = any[]> extends EventEmitter {\n\tconstructor(\n\t\tdefinitions: DS,\n\t\t{\n\t\t\ttarget,\n\t\t\tdebounce: debounceLimit = SubscriptionGroup.debounceLimit,\n\t\t\timmediately\n\t\t}: Options = {}\n\t) {\n\t\tsuper();\n\t\t\n\t\tthis.applyOptions({ target, debounceLimit });\n\t\t\n\t\tthis.#initPromise = new StatefulPromise();\n\t\t\n\t\tthis.attach(definitions, false, immediately);\n\t\t\n\t}\n\t\n\ttarget?: Target;\n\temitUpdate!: () => void;\n\t\n\titems = [] as unknown as Record<string, SubscriptionGroupItem> & SubscriptionGroupItem[];\n\tvalues = [] as DS extends any ? (any[] & Record<string, any>) : ParseValues<DS>;\n\t\n\tisLoaded = false;\n\tisInited = false;\n\t\n\t#loadPromise!: StatefulPromise<SubscriptionGroup>;\n\t#initPromise: StatefulPromise<SubscriptionGroup>;\n\t#unloadPromise!: StatefulPromise<SubscriptionGroup>;\n\t\n\t#debounceLimit?: null | number = null;\n\t\n\tapplyOptions({ target, debounceLimit }: { target?: Target; debounceLimit?: number }) {\n\t\t\n\t\tif (this.target !== target) {\n\t\t\tif (this.target)\n\t\t\t\tfor (const item of this.items)\n\t\t\t\t\tif (item.isLoaded && !item.preventBind)\n\t\t\t\t\t\tdelete this.target[item.name];\n\t\t\t\n\t\t\tthis.target = target;\n\t\t\t\n\t\t\tif (this.target)\n\t\t\t\tfor (const item of this.items)\n\t\t\t\t\tif (item.isLoaded && !item.preventBind)\n\t\t\t\t\t\tthis.target[item.name] = item.value;\n\t\t}\n\t\t\n\t\tif (this.#debounceLimit !== debounceLimit) {\n\t\t\tthis.#debounceLimit = debounceLimit;\n\t\t\tif (typeof this.#debounceLimit == \"number\") {\n\t\t\t\tconst emitUpdateDebounced = debounce(() => this.emit(\"update\", this.values), this.#debounceLimit);\n\t\t\t\tthis.emitUpdate = () => emitUpdateDebounced();\n\t\t\t} else\n\t\t\t\tthis.emitUpdate = () => this.emit(\"update\", this.values);\n\t\t}\n\t\t\n\t}\n\t\n\tattach(definitions: DS, shouldReload = this.isLoaded, immediately = true) {\n\t\tif (shouldReload)\n\t\t\tthis.isLoaded = false;\n\t\t\n\t\tif (!this.#loadPromise || this.#loadPromise.isFulfilled)\n\t\t\tthis.#loadPromise = new StatefulPromise();\n\t\t\n\t\tif (!this.#unloadPromise || this.#unloadPromise.isFulfilled)\n\t\t\tthis.#unloadPromise = new StatefulPromise();\n\t\t\n\t\treturn Promise.all(definitions.map(definition =>\n\t\t\tnew SubscriptionGroupItem(parseDefinition(definition), this)\n\t\t).map(item => {\n\t\t\t\n\t\t\tif (immediately)\n\t\t\t\titem.subscribe();\n\t\t\t\n\t\t\treturn item.loaded();\n\t\t}));\n\t}\n\t\n\tdetach(names: string[], shouldUpdate = true) {\n\t\t\n\t\tfor (const name of names)\n\t\t\tthis.items[name]?.detach();\n\t\t\n\t\tif (shouldUpdate) {\n\t\t\tthis.#unload();\n\t\t\tthis.#load();\n\t\t}\n\t\t\n\t}\n\t\n\tredefine(definitions: DS) {\n\t\t\n\t\tconst itemsToDetach = new Map(this.items.map(item => [ item.name, item ]));\n\t\tconst definitionsToRedefine = [];\n\t\tconst definitionsToAttach = [] as unknown as DS;\n\t\t\n\t\tfor (let definition of definitions) {\n\t\t\tdefinition = parseDefinition(definition);\n\t\t\tif (itemsToDetach.delete(definition.name))\n\t\t\t\tdefinitionsToRedefine.push(definition);\n\t\t\telse\n\t\t\t\tdefinitionsToAttach.push(definition);\n\t\t}\n\t\t\n\t\tthis.isLoaded = false;\n\t\t\n\t\tthis.detach([ ...itemsToDetach.keys() ], false);\n\t\t\n\t\treturn Promise.all([\n\t\t\t...definitionsToRedefine.map(definition => {\n\t\t\t\tconst item = this.items[definition.name];\n\t\t\t\titem.define(definition);\n\t\t\t\t\n\t\t\t\titem.subscribe();\n\t\t\t\t\n\t\t\t\treturn item.loaded();\n\t\t\t}),\n\t\t\t...definitionsToAttach.length ? [ this.attach(definitionsToAttach, false) ] : []\n\t\t]);\n\t}\n\t\n\tsubscribe() {\n\t\treturn this.items.map(item => item.subscribe());\n\t}\n\t\n\tunsubscribe() {\n\t\treturn this.items.map(item => item.unsubscribe());\n\t}\n\t\n\t#load() {\n\t\t\n\t\tif (!this.isLoaded && this.items.every(item => item.isLoaded)) {\n\t\t\tif (this.target)\n\t\t\t\tfor (const item of this.items)\n\t\t\t\t\tif (!item.preventBind)\n\t\t\t\t\t\tthis.target[item.name] = item.value;\n\t\t\t\n\t\t\tthis.isLoaded = true;\n\t\t\t\n\t\t\tfor (const item of this.items)\n\t\t\t\tprivates.itemLoad!(item);\n\t\t\t\n\t\t\tthis.emit(\"load\", this.values);\n\t\t\t\n\t\t\tif (this.isInited)\n\t\t\t\tif (this.items.length)\n\t\t\t\t\tfor (const item of this.items)\n\t\t\t\t\t\titem.emitUpdate();\n\t\t\t\telse\n\t\t\t\t\tthis.emitUpdate();\n\t\t\t\n\t\t\t\n\t\t\tthis.#loadPromise.resolve(this);\n\t\t\t\n\t\t\tif (this.#unloadPromise.isFulfilled)\n\t\t\t\tthis.#unloadPromise = new StatefulPromise();\n\t\t}\n\t\t\n\t}\n\t\n\t#init() {\n\t\t\n\t\tif (!this.isInited && this.items.every(item => item.isInited)) {\n\t\t\tthis.isInited = true;\n\t\t\t\n\t\t\tif (this.isLoaded)\n\t\t\t\tif (this.items.length)\n\t\t\t\t\tfor (const item of this.items)\n\t\t\t\t\t\titem.emitUpdate();\n\t\t\t\telse\n\t\t\t\t\tthis.emitUpdate();\n\t\t\t\n\t\t\t\n\t\t\tfor (const item of this.items)\n\t\t\t\tprivates.itemInit!(item);\n\t\t\t\n\t\t\tthis.emit(\"init\", this.values);\n\t\t\t\n\t\t\tthis.#initPromise.resolve(this);\n\t\t}\n\t\t\n\t}\n\t\n\t#unload() {\n\t\t\n\t\tif (this.isLoaded && this.items.every(item => !item.isLoaded)) {\n\t\t\tif (this.target)\n\t\t\t\tfor (const item of this.items)\n\t\t\t\t\tif (!item.preventBind)\n\t\t\t\t\t\tdelete this.target[item.name];\n\t\t\t\n\t\t\tthis.isLoaded = false;\n\t\t\t\n\t\t\tfor (const item of this.items)\n\t\t\t\tprivates.itemUnload!(item);\n\t\t\t\n\t\t\tthis.emit(\"unload\", this.values);\n\t\t\t\n\t\t\tif (this.items.length)\n\t\t\t\tfor (const item of this.items)\n\t\t\t\t\titem.emitUpdate();\n\t\t\telse\n\t\t\t\tthis.emitUpdate();\n\t\t\t\n\t\t\tthis.#unloadPromise.resolve(this);\n\t\t\t\n\t\t\tif (this.#loadPromise.isFulfilled)\n\t\t\t\tthis.#loadPromise = new StatefulPromise();\n\t\t}\n\t\t\n\t}\n\t\n\tloaded() {\n\t\treturn this.#loadPromise;\n\t}\n\t\n\tinited() {\n\t\treturn this.#initPromise;\n\t}\n\t\n\tunloaded() {\n\t\treturn this.#unloadPromise;\n\t}\n\t\n\tvalueOf() {\n\t\treturn this.values;\n\t}\n\t\n\t[Symbol.iterator]() {\n\t\treturn this.values[Symbol.iterator]();\n\t}\n\t\n\t\n\tstatic debounceLimit = 8;\n\t\n\tstatic {\n\t\t\n\t\tprivates.groupLoad = (group: SubscriptionGroup) => group.#load();\n\t\tprivates.groupInit = (group: SubscriptionGroup) => group.#init();\n\t\tprivates.groupUnload = (group: SubscriptionGroup) => group.#unload();\n\t\t\n\t}\n\t\n}\n\nexport { Options as SubscriptionGroupOptions, Target as SubscriptionGroupTarget };\n", "import type { SubscriptionGroup } from \"./SubscriptionGroup\";\nimport type { SubscriptionGroupItem } from \"./SubscriptionGroupItem\";\nimport type { SubscriptionType } from \"./types\";\n\n\nexport const privates: {\n\tgroupLoad?: (group: SubscriptionGroup) => void;\n\tgroupInit?: (group: SubscriptionGroup) => void;\n\tgroupUnload?: (group: SubscriptionGroup) => void;\n\titemLoad?: <T extends SubscriptionType>(item: SubscriptionGroupItem<T>) => void;\n\titemInit?: <T extends SubscriptionType>(item: SubscriptionGroupItem<T>) => void;\n\titemUnload?: <T extends SubscriptionType>(item: SubscriptionGroupItem<T>) => void;\n} = {};\n", "import EventEmitter from \"eventemitter3\";\nimport { debounce, removeOne, StatefulPromise } from \"@nesvet/n\";\nimport { type SubscriptionArrayUpdated, SubscriptionArrayWithSubscription } from \"../SubscriptionArray\";\nimport { type SubscriptionMapUpdated, SubscriptionMapWithSubscription } from \"../SubscriptionMap\";\nimport { type Updated as SubscriptionObjectUpdated, SubscriptionObjectWithSubscription } from \"../SubscriptionObject\";\nimport {\n\trenewSymbol,\n\tsetHandleUpdateSymbol,\n\tsubscribeSymbol,\n\tunsubscribeSymbol\n} from \"../symbols\";\nimport { privates } from \"./common\";\nimport type { SubscriptionGroup } from \"./SubscriptionGroup\";\nimport type {\n\tDefinition,\n\tSubscriptionHandle,\n\tSubscriptionOnBeforeInit,\n\tSubscriptionType,\n\tSubscriptionUpdated,\n\tSubscriptionUpdates,\n\tSubscriptionValue\n} from \"./types\";\n\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\n\ntype HandleSubscription<T> = (_: any, updated: SubscriptionUpdated<T>, updates: SubscriptionUpdates<T>) => void;\n\nfunction isUpdatedMapOrArray(updated: SubscriptionUpdated<SubscriptionType>): updated is SubscriptionArrayUpdated | SubscriptionMapUpdated {\n\treturn Array.isArray(updated);\n}\n\n\nexport class SubscriptionGroupItem<T extends SubscriptionType = SubscriptionType, D extends Definition<T> = Definition<T>> extends EventEmitter {\n\tconstructor(definition: D, group: SubscriptionGroup) {\n\t\tsuper();\n\t\t\n\t\tthis.name = definition.name;\n\t\t\n\t\tthis.define(definition, group);\n\t\t\n\t}\n\t\n\tname;\n\tgroup?: SubscriptionGroup;\n\tvalue?: SubscriptionValue<T>;\n\ttype!: \"object\" | T;\n\tpublicationName!: Definition<T>[\"publicationName\"];\n\tparams!: Definition<T>[\"params\"];\n\thandle!: Definition<T>[\"handle\"];\n\tonBeforeInit!: Definition<T>[\"onBeforeInit\"];\n\tpreventBind!: Definition<T>[\"preventBind\"];\n\t\n\temitUpdate!: (updated?: SubscriptionUpdated<T>) => void;\n\t\n\tisLoaded = false;\n\tisInited = false;\n\t\n\t#loadPromise!: StatefulPromise<SubscriptionGroupItem<T, D>>;\n\t#initPromise!: StatefulPromise<SubscriptionGroupItem<T, D>>;\n\t#unloadPromise!: StatefulPromise<SubscriptionGroupItem<T, D>>;\n\t\n\tdefine(definition: Definition<T>, group: SubscriptionGroup | undefined = this.group) {\n\t\tif (!group)\n\t\t\tthrow new Error(\"group is undefined\");\n\t\t\n\t\tconst {\n\t\t\tvalue,\n\t\t\ttype = \"object\",\n\t\t\tpublicationName,\n\t\t\tparams,\n\t\t\thandle,\n\t\t\tonBeforeInit,\n\t\t\tdebounce: debounceLimit = SubscriptionGroupItem.debounceLimit,\n\t\t\tpreventBind\n\t\t} = definition;\n\t\t\n\t\tif (this.group) {\n\t\t\tif (\n\t\t\t\t(!value || this.value === value) &&\n\t\t\t\tthis.type === type &&\n\t\t\t\tthis.publicationName === publicationName &&\n\t\t\t\tJSON.stringify(this.params) === JSON.stringify(params) &&\n\t\t\t\tthis.handle === handle &&\n\t\t\t\tthis.onBeforeInit === onBeforeInit\n\t\t\t)\n\t\t\t\treturn this.#applyOptions({ debounceLimit, preventBind });\n\t\t\t\n\t\t\tthis.detach();\n\t\t\tdelete this.value;\n\t\t\tdelete this.publicationName;\n\t\t\tdelete this.params;\n\t\t}\n\t\t\n\t\tthis.type = type;\n\t\tthis.handle = handle;\n\t\tthis.onBeforeInit = onBeforeInit;\n\t\tif (value)\n\t\t\tthis.value = value;\n\t\telse {\n\t\t\tthis.publicationName = publicationName ?? this.name;\n\t\t\tthis.params = params ?? [];\n\t\t}\n\t\t\n\t\tthis.#applyOptions({ debounceLimit, preventBind });\n\t\t\n\t\tthis.#attachTo(group);\n\t\t\n\t\treturn null;\n\t}\n\t\n\t#applyOptions({ debounceLimit, preventBind }: { debounceLimit?: number; preventBind?: boolean }) {\n\t\t\n\t\tconst emitUpdate: typeof this.emitUpdate = updated => {\n\t\t\tthis.emit(\"update\", this.value, updated);\n\t\t\tthis.group?.emit(`update.${this.name}`, this.value, updated);\n\t\t\tthis.group?.emitUpdate();\n\t\t\t\n\t\t};\n\t\t\n\t\tif (typeof debounceLimit == \"number\") {\n\t\t\tlet debouncedUpdated: SubscriptionUpdated<T> | undefined;\n\t\t\tlet group: SubscriptionGroup;\n\t\t\t\n\t\t\tconst emitUpdateDebounced = debounce(() => {\n\t\t\t\t\n\t\t\t\tconst isDetached = !this.group;\n\t\t\t\t\n\t\t\t\tif (isDetached)\n\t\t\t\t\tthis.group = group;\n\t\t\t\t\n\t\t\t\temitUpdate(debouncedUpdated!);\n\t\t\t\t\n\t\t\t\tif (isDetached)\n\t\t\t\t\tdelete this.group;\n\t\t\t\t\n\t\t\t\tdebouncedUpdated = undefined;\n\t\t\t\t\n\t\t\t}, debounceLimit);\n\t\t\t\n\t\t\tthis.emitUpdate = updated => {\n\t\t\t\tif (updated !== undefined)\n\t\t\t\t\tif (isUpdatedMapOrArray(updated))\n\t\t\t\t\t\tif (isUpdatedMapOrArray(debouncedUpdated!))\n\t\t\t\t\t\t\tfor (const item of updated)\n\t\t\t\t\t\t\t\tdebouncedUpdated.push(item as any);\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tdebouncedUpdated = Object.assign([ ...updated ], {\n\t\t\t\t\t\t\t\tadded: [ ...updated.added ],\n\t\t\t\t\t\t\t\tdeleted: [ ...updated.deleted ]\n\t\t\t\t\t\t\t}) as SubscriptionUpdated<T>;\n\t\t\t\t\telse if (typeof updated == \"object\")\n\t\t\t\t\t\tif (debouncedUpdated)\n\t\t\t\t\t\t\tObject.assign(debouncedUpdated, updated);\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tdebouncedUpdated = { ...updated };\n\t\t\t\t\telse\n\t\t\t\t\t\tdebouncedUpdated = updated;\n\t\t\t\t\n\t\t\t\tgroup = this.group!;\n\t\t\t\t\n\t\t\t\treturn emitUpdateDebounced();\n\t\t\t};\n\t\t} else\n\t\t\tthis.emitUpdate = emitUpdate;\n\t\t\n\t\tif (this.preventBind === undefined)\n\t\t\tdelete this.preventBind;\n\t\telse\n\t\t\tthis.preventBind = preventBind;\n\t\t\n\t}\n\t\n\t#attachTo(group: SubscriptionGroup) {\n\t\tif (!this.group) {\n\t\t\tthis.group = group;\n\t\t\t\n\t\t\tthis.group.items.push(this);\n\t\t\tthis.group.items[this.name] = this;\n\t\t\t\n\t\t\tif (!this.#loadPromise || this.#loadPromise.isFulfilled)\n\t\t\t\tthis.#loadPromise = new StatefulPromise();\n\t\t\t\n\t\t\tif (!this.#initPromise || this.#initPromise.isFulfilled)\n\t\t\t\tthis.#initPromise = new StatefulPromise();\n\t\t\t\n\t\t\tif (!this.#unloadPromise || this.#unloadPromise.isFulfilled)\n\t\t\t\tthis.#unloadPromise = new StatefulPromise();\n\t\t\t\n\t\t\tswitch (this.type) {\n\t\t\t\tcase \"array\": {\n\t\t\t\t\tconst handleSubscription = this.#handleSubscription as HandleSubscription<\"array\">;\n\t\t\t\t\tif (this.value)\n\t\t\t\t\t\t(this.value as SubscriptionArrayWithSubscription)[setHandleUpdateSymbol](handleSubscription);\n\t\t\t\t\telse\n\t\t\t\t\t\tthis.value = new SubscriptionArrayWithSubscription(this.publicationName!, this.params!, handleSubscription, false) as SubscriptionValue<T>;\n\t\t\t\t\tbreak;\n\t\t\t\t} case \"map\": {\n\t\t\t\t\tconst handleSubscription = this.#handleSubscription as HandleSubscription<\"map\">;\n\t\t\t\t\tif (this.value)\n\t\t\t\t\t\t(this.value as SubscriptionMapWithSubscription)[setHandleUpdateSymbol](handleSubscription);\n\t\t\t\t\telse\n\t\t\t\t\t\tthis.value = new SubscriptionMapWithSubscription(this.publicationName!, this.params!, handleSubscription, false) as SubscriptionValue<T>;\n\t\t\t\t\tbreak;\n\t\t\t\t} default: {\n\t\t\t\t\tconst handleSubscription = this.#handleSubscription as HandleSubscription<\"object\">;\n\t\t\t\t\tif (this.value)\n\t\t\t\t\t\t(this.value as SubscriptionObjectWithSubscription)[setHandleUpdateSymbol](handleSubscription);\n\t\t\t\t\telse\n\t\t\t\t\t\tthis.value = new SubscriptionObjectWithSubscription(this.publicationName!, this.params!, handleSubscription, false) as SubscriptionValue<T>;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tthis.group.values.push(this.value);\n\t\t\tthis.group.values[this.name] = this.value;\n\t\t\t\n\t\t\tif (this.onBeforeInit)\n\t\t\t\tswitch (this.type) {\n\t\t\t\t\tcase \"array\":\n\t\t\t\t\t\t(this.onBeforeInit as SubscriptionOnBeforeInit<\"array\">).call(this.group, this.value as SubscriptionArrayWithSubscription);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"map\":\n\t\t\t\t\t\t(this.onBeforeInit as SubscriptionOnBeforeInit<\"map\">).call(this.group, this.value as SubscriptionMapWithSubscription);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\t(this.onBeforeInit as SubscriptionOnBeforeInit<\"object\">).call(this.group, this.value as SubscriptionObjectWithSubscription);\n\t\t\t\t}\n\t\t}\n\t\t\n\t}\n\t\n\tdetach() {\n\t\t\n\t\tif (this.group) {\n\t\t\tthis.value?.[unsubscribeSymbol]();\n\t\t\t\n\t\t\tthis.isLoaded = false;\n\t\t\tthis.#unload();\n\t\t\t\n\t\t\tdelete this.group.values[this.name];\n\t\t\tremoveOne(this.group.values, this.value);\n\t\t\tdelete this.group.items[this.name];\n\t\t\tremoveOne(this.group.items, this);\n\t\t\t\n\t\t\tdelete this.group;\n\t\t}\n\t\t\n\t}\n\t\n\t#loadUpdated: null | SubscriptionUpdated<T> = null;\n\t\n\t#handleSubscription: HandleSubscription<T> = (_, updated, updates) => {\n\t\tif (updates)\n\t\t\tif (this.group!.isLoaded) {\n\t\t\t\tif (this.handle)\n\t\t\t\t\tswitch (this.type) {\n\t\t\t\t\t\tcase \"array\":\n\t\t\t\t\t\t\t(this.handle as SubscriptionHandle<\"array\">).call(this.group!, updated as SubscriptionArrayUpdated, this.group!);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"map\":\n\t\t\t\t\t\t\t(this.handle as SubscriptionHandle<\"map\">).call(this.group!, updated as SubscriptionMapUpdated, this.group!);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t(this.handle as SubscriptionHandle<\"object\">).call(this.group!, updated as SubscriptionObjectUpdated, this.group!);\n\t\t\t\t\t}\n\t\t\t\tthis.emitUpdate(updated);\n\t\t\t} else {\n\t\t\t\tthis.#loadUpdated = updated;\n\t\t\t\tthis.isLoaded = true;\n\t\t\t\tprivates.groupLoad!(this.group!);\n\t\t\t}\n\t\telse if (this.isLoaded) {\n\t\t\tthis.isLoaded = false;\n\t\t\tprivates.groupUnload!(this.group!);\n\t\t}\n\t\t\n\t\tif (!this.isInited) {\n\t\t\tthis.isInited = true;\n\t\t\tprivates.groupInit!(this.group!);\n\t\t}\n\t\t\n\t};\n\t\n\t#load() {\n\t\t\n\t\tif (this.#loadUpdated) {\n\t\t\tif (this.handle)\n\t\t\t\tswitch (this.type) {\n\t\t\t\t\tcase \"array\":\n\t\t\t\t\t\t(this.handle as SubscriptionHandle<\"array\">).call(this.group!, this.#loadUpdated as SubscriptionArrayUpdated, this.group!);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"map\":\n\t\t\t\t\t\t(this.handle as SubscriptionHandle<\"map\">).call(this.group!, this.#loadUpdated as SubscriptionMapUpdated, this.group!);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\t(this.handle as SubscriptionHandle<\"object\">).call(this.group!, this.#loadUpdated as SubscriptionObjectUpdated, this.group!);\n\t\t\t\t}\n\t\t\t\n\t\t\tthis.#loadUpdated = null;\n\t\t\t\n\t\t\tthis.emit(\"load\", this.value);\n\t\t\t\n\t\t\tthis.#loadPromise.resolve(this);\n\t\t\t\n\t\t\tif (this.#unloadPromise.isFulfilled)\n\t\t\t\tthis.#unloadPromise = new StatefulPromise();\n\t\t}\n\t\t\n\t}\n\t\n\t#init() {\n\t\t\n\t\tthis.emit(\"init\", this.value);\n\t\t\n\t\tthis.#initPromise.resolve(this);\n\t\t\n\t}\n\t\n\t#unload() {\n\t\t\n\t\tif (this.handle)\n\t\t\tswitch (this.type) {\n\t\t\t\tcase \"array\":\n\t\t\t\t\t(this.handle as SubscriptionHandle<\"array\">).call(this.group!, null, this.group!);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"map\":\n\t\t\t\t\t(this.handle as SubscriptionHandle<\"map\">).call(this.group!, null, this.group!);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\t(this.handle as SubscriptionHandle<\"object\">).call(this.group!, null, this.group!);\n\t\t\t}\n\t\t\n\t\tthis.emit(\"unload\", this.value);\n\t\t\n\t\tthis.#unloadPromise.resolve(this);\n\t\t\n\t\tif (this.#loadPromise.isFulfilled)\n\t\t\tthis.#loadPromise = new StatefulPromise();\n\t\t\n\t}\n\t\n\tloaded() {\n\t\treturn this.#loadPromise;\n\t}\n\t\n\tinited() {\n\t\treturn this.#initPromise;\n\t}\n\t\n\tunloaded() {\n\t\treturn this.#unloadPromise;\n\t}\n\t\n\tsubscribe() {\n\t\treturn this.value?.[subscribeSymbol]();\n\t}\n\t\n\tunsubscribe() {\n\t\treturn this.value?.[unsubscribeSymbol]();\n\t}\n\t\n\trenew(publicationName: Definition<T>[\"publicationName\"], params: Definition<T>[\"params\"]) {\n\t\treturn this.value?.[renewSymbol](publicationName, params);\n\t}\n\t\n\tvalueOf() {\n\t\treturn this.value;\n\t}\n\t\n\t\n\tstatic debounceLimit = 4;\n\t\n\tstatic {\n\t\t\n\t\tprivates.itemLoad = <\n\t\t\tDP extends Definition<TP>,\n\t\t\tTP extends SubscriptionType\n\t\t>(item: SubscriptionGroupItem<TP, DP>) => item.#load();\n\t\tprivates.itemInit = <\n\t\t\tDP extends Definition<TP>,\n\t\t\tTP extends SubscriptionType\n\t\t>(item: SubscriptionGroupItem<TP, DP>) => item.#init();\n\t\tprivates.itemUnload = <\n\t\t\tDP extends Definition<TP>,\n\t\t\tTP extends SubscriptionType\n\t\t>(item: SubscriptionGroupItem<TP, DP>) => item.#unload();\n\t\t\n\t}\n\t\n}\n", "import { removeOne } from \"@nesvet/n\";\nimport { Subscription } from \"./Subscription\";\nimport {\n\tclearSymbol,\n\tgetAsInitialUpdatedSymbol,\n\tgetAsUpdatesSymbol,\n\tgetHandleUpdateSymbol,\n\tgetSubscriptionSymbol,\n\trenewSymbol,\n\tsetHandleUpdateSymbol,\n\tsubscribeSymbol,\n\tunsubscribeSymbol,\n\tupdateSymbol\n} from \"./symbols\";\n\n\ntype GenericItem = { _id: string } & Record<string, any>;// eslint-disable-line @typescript-eslint/no-explicit-any\n\ntype Item = GenericItem | SubscriptionMapItem;\n\ntype Updated<I extends Item = Item> = {\n\tdeleted: string[];\n\tadded: I[];\n} & I[];\n\ntype SortList = Record<string, -1 | 1>;\n\nexport type Updates<I extends Item = Item> =\n\t(\n\t\t[ \"c\"/* create */, item: I ] |\n\t\t[ \"d\"/* delete */, _id: string ] |\n\t\t[ \"i\"/* initial */, items: I[], sortList?: SortList ] |\n\t\t[ \"u\"/* update */, itemUpdates: { _id: string } & Partial<I>, isAtomicOrUpdatedFields: string[] | true ] |\n\t\tnull\n\t)[] |\n\tnull;\n\ntype UpdateHandler<I extends Item = Item> = (map: SubscriptionMap<I>, updated: Updated<I>, updates: Updates<I>) => void;\n\ndeclare global {\n\tvar __insite_subscription_map_sort_function: ((a: Item, b: Item) => -1 | 0 | 1) | undefined;// eslint-disable-line no-var\n}\n\nfunction createSortFunction(sortList: SortList) {\n\t\n\tconst tempScript = document.createElement(\"script\");\n\t\n\ttempScript.textContent = `window.__insite_subscription_map_sort_function = function sort(a, b) { return ${\n\t\tObject.entries(sortList)\n\t\t\t.map(([ key, value ]) => value > 0 ? `a.${key} > b.${key} ? 1 : a.${key} < b.${key} ? -1 :` : `a.${key} < b.${key} ? 1 : a.${key} > b.${key} ? -1 :`)\n\t\t\t.concat(\"0\")\n\t\t\t.join(\" \")\n\t};}`;\n\t\n\tdocument.head.append(tempScript);\n\t\n\tconst sortFunction = window.__insite_subscription_map_sort_function!;\n\t\n\ttempScript.remove();\n\tdelete window.__insite_subscription_map_sort_function;\n\t\n\treturn sortFunction;\n}\n\n// function createSortFunction(sortList: SortList) {\n// return new Function(// eslint-disable-line no-new-func\n// \t\t\"a\"/* Item */,\n// \t\t\"b\"/* Item */,\n// \t\t`return ${\n// \t\t\tObject.entries(sortList)\n// \t\t\t\t.map(([ key, value ]) => value > 0 ? `a.${key} > b.${key} ? 1 : a.${key} < b.${key} ? -1 :` : `a.${key} < b.${key} ? 1 : a.${key} > b.${key} ? -1 :`)\n// \t\t\t\t.concat(\"0\")\n// \t\t\t\t.join(\" \")\n// \t\t}`\n// \t) as (a: Item, b: Item) => -1 | 0 | 1;\n// }\n\n\nexport class SubscriptionMap<I extends Item = Item> extends Map<string, I> {\n\tconstructor(updates?: Updates<I>, onUpdate?: UpdateHandler<I>) {\n\t\tsuper();\n\t\t\n\t\tif (onUpdate)\n\t\t\tthis.handleUpdate = onUpdate;\n\t\t\n\t\tif (updates)\n\t\t\tthis.update(updates);\n\t\t\n\t}\n\t\n\thandleUpdate;\n\t\n\tprivate updates = new Map();\n\t\n\tsortList: null | SortList = null;\n\t\n\tsortCompareFunction: ((a: I, b: I) => number) | null = null;\n\t\n\tprivate fieldsToSort: string[] = [];\n\t\n\tsorted: I[] = [];\n\t\n\tsort() {\n\t\t\n\t\tif (this.sortCompareFunction)\n\t\t\tthis.sorted.sort(this.sortCompareFunction);\n\t\t\n\t}\n\t\n\t[getHandleUpdateSymbol]() {\n\t\treturn this.handleUpdate;\n\t}\n\t\n\t[setHandleUpdateSymbol](handleUpdate: UpdateHandler<I>) {\n\t\treturn (this.handleUpdate = handleUpdate);\n\t}\n\t\n\tprivate TheItem!: { new (map: SubscriptionMap<I>, updates: GenericItem): I };\n\t\n\tset Item(TheItem: { new (map: SubscriptionMap<I>, updates: GenericItem): I }) {\n\t\tthis.TheItem = TheItem;\n\t\t\n\t\tif (this.size)\n\t\t\tfor (const [ _id, item ] of this)\n\t\t\t\tthis.set(_id, new TheItem(this, item));\n\t\t\n\t}\n\t\n\tget Item() {\n\t\treturn this.TheItem;\n\t}\n\t\n\tupdate(updates: Updates<I>) {\n\t\t\n\t\tconst updated: Updated<I> = Object.assign([], {\n\t\t\tadded: [],\n\t\t\tdeleted: []\n\t\t});\n\t\t\n\t\tif (updates) {\n\t\t\tlet shouldSort = false;\n\t\t\t\n\t\t\tconst TheItem = this.TheItem;// eslint-disable-line prefer-destructuring\n\t\t\tconst prevUpdates = this.updates;\n\t\t\t\n\t\t\tfor (const update of updates)\n\t\t\t\tswitch (update?.[0]) {\n\t\t\t\t\tcase \"i\"/* initial */: {\n\t\t\t\t\t\tconst [ , array, sortList ] = update;\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (sortList) {\n\t\t\t\t\t\t\tthis.sortList = sortList;\n\t\t\t\t\t\t\tthis.sortCompareFunction = createSortFunction(sortList);\n\t\t\t\t\t\t\tthis.fieldsToSort = [ ...new Set(Object.keys(sortList).map(key => key.replace(/\\..+/, \"\"))) ];\n\t\t\t\t\t\t\tshouldSort = true;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthis.sortList = null;\n\t\t\t\t\t\t\tthis.sortCompareFunction = null;\n\t\t\t\t\t\t\tthis.fieldsToSort = [];\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (this.size) {\n\t\t\t\t\t\t\tconst updatesMap = new Map();\n\t\t\t\t\t\t\tfor (const itemUpdates of array)\n\t\t\t\t\t\t\t\tupdatesMap.set(itemUpdates._id, itemUpdates);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tfor (const [ _id, item ] of this) {\n\t\t\t\t\t\t\t\tconst itemUpdates = updatesMap.get(_id);\n\t\t\t\t\t\t\t\tif (itemUpdates) {\n\t\t\t\t\t\t\t\t\tconst prevItemUpdates = prevUpdates.get(_id);\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tif (TheItem)\n\t\t\t\t\t\t\t\t\t\titem.update(itemUpdates);\n\t\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\t\tfor (const key in prevItemUpdates)// eslint-disable-line guard-for-in\n\t\t\t\t\t\t\t\t\t\t\tdelete item[key as keyof typeof item];\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\tObject.assign(item, itemUpdates);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tprevUpdates.set(_id, itemUpdates);\n\t\t\t\t\t\t\t\t\tupdated.push(item);\n\t\t\t\t\t\t\t\t\tupdatesMap.delete(_id);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tif (TheItem)\n\t\t\t\t\t\t\t\t\t\titem.delete();\n\t\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t\tthis.delete(_id);\n\t\t\t\t\t\t\t\t\tprevUpdates.delete(_id);\n\t\t\t\t\t\t\t\t\tupdated.deleted.push(_id);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tfor (const [ _id, itemUpdates ] of updatesMap) {\n\t\t\t\t\t\t\t\tconst item = TheItem ? new TheItem(this, itemUpdates) : { ...itemUpdates };\n\t\t\t\t\t\t\t\tthis.set(_id, item);\n\t\t\t\t\t\t\t\tprevUpdates.set(_id, itemUpdates);\n\t\t\t\t\t\t\t\tupdated.push(item);\n\t\t\t\t\t\t\t\tupdated.added.push(item);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif (this.sortList)\n\t\t\t\t\t\t\t\tthis.sorted = array.map(newItem => this.get(newItem._id)!);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else\n\t\t\t\t\t\t\tfor (const itemUpdates of array) {\n\t\t\t\t\t\t\t\tconst item = (TheItem ? new TheItem(this, itemUpdates) : { ...itemUpdates }) as I;\n\t\t\t\t\t\t\t\tthis.set(item._id, item);\n\t\t\t\t\t\t\t\tthis.sorted.push(item);\n\t\t\t\t\t\t\t\tprevUpdates.set(item._id, itemUpdates);\n\t\t\t\t\t\t\t\tupdated.push(item);\n\t\t\t\t\t\t\t\tupdated.added.push(item);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tcase \"c\"/* create */:\n\t\t\t\t\tcase \"u\"/* update */: {\n\t\t\t\t\t\tlet [ , itemUpdates ] = update;\n\t\t\t\t\t\tlet item = this.get(itemUpdates._id);\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (item) {\n\t\t\t\t\t\t\tconst isAtomic = update[2] === true;\n\t\t\t\t\t\t\tconst updatedFields = isAtomic ? Object.keys(itemUpdates) : update[2] as string[];\n\t\t\t\t\t\t\tconst prevItemUpdates = prevUpdates.get(item._id);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif (TheItem)\n\t\t\t\t\t\t\t\titem.update(itemUpdates);\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tif (!isAtomic)\n\t\t\t\t\t\t\t\t\tfor (const key in prevItemUpdates)// eslint-disable-line guard-for-in\n\t\t\t\t\t\t\t\t\t\tdelete item[key as keyof typeof item];\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tObject.assign(item, itemUpdates);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif (isAtomic)\n\t\t\t\t\t\t\t\titemUpdates = Object.assign(prevItemUpdates, itemUpdates);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif (this.sortList && !shouldSort && (!updatedFields || updatedFields.some(fieldName => this.fieldsToSort.includes(fieldName))))\n\t\t\t\t\t\t\t\tshouldSort = true;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\titem = (TheItem ? new TheItem(this, itemUpdates) : { ...itemUpdates }) as I;\n\t\t\t\t\t\t\tthis.set(item._id, item);\n\t\t\t\t\t\t\tthis.sorted.push(item);\n\t\t\t\t\t\t\tif (this.sortList)\n\t\t\t\t\t\t\t\tshouldSort = true;\n\t\t\t\t\t\t\tupdated.added.push(item);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tprevUpdates.set(item._id, itemUpdates);\n\t\t\t\t\t\tupdated.push(item);\n\t\t\t\t\t\t\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tcase \"d\"/* delete */: {\n\t\t\t\t\t\tconst [ , _id ] = update;\n\t\t\t\t\t\tconst itemToDelete = this.get(_id);\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (itemToDelete) {\n\t\t\t\t\t\t\tif (TheItem)\n\t\t\t\t\t\t\t\titemToDelete.delete();\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tthis.delete(_id);\n\t\t\t\t\t\t\tprevUpdates.delete(_id);\n\t\t\t\t\t\t\tremoveOne(this.sorted, itemToDelete);\n\t\t\t\t\t\t\tupdated.deleted.push(_id);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tthis.clear();\n\t\t\t\t}\n\t\t\t\n\t\t\tif (shouldSort)\n\t\t\t\tthis.sort();\n\t\t\t\n\t\t} else\n\t\t\tthis.clear();\n\t\t\n\t\tthis.handleUpdate?.(this, updated, updates?.[0] ? updates : null);\n\t\t\n\t\treturn this;\n\t}\n\t\n\t[updateSymbol] = this.update;\n\t\n\tgetAsUpdates() {\n\t\treturn (\n\t\t\t(this.size || this.sortList) ?\n\t\t\t\t[ [ \"i\"/* initial */, [ ...this.updates.values() ], this.sortList ] ] :\n\t\t\t\tnull\n\t\t);\n\t}\n\t\n\t[getAsUpdatesSymbol] = this.getAsUpdates;\n\t\n\tgetAsInitialUpdated() {\n\t\treturn Object.assign([ ...this.sorted ], {\n\t\t\tadded: [ ...this.sorted ],\n\t\t\tdeleted: []\n\t\t});\n\t}\n\t\n\t[getAsInitialUpdatedSymbol] = this.getAsInitialUpdated;\n\t\n\tclear() {\n\t\t\n\t\tsuper.clear();\n\t\tthis.updates.clear();\n\t\tthis.sorted = [];\n\t\tthis.sortList = null;\n\t\tthis.sortCompareFunction = null;\n\t\tthis.fieldsToSort = [];\n\t\t\n\t}\n\t\n\t[clearSymbol] = this.clear;\n\t\n\tvalueOf() {\n\t\treturn this.sorted;\n\t}\n\t\n\tget [Symbol.toStringTag]() {\n\t\treturn \"SubscriptionMap\";\n\t}\n\t\n\t\n\tstatic updateSymbol = updateSymbol;\n\tstatic getHandleUpdateSymbol = getHandleUpdateSymbol;\n\tstatic setHandleUpdateSymbol = setHandleUpdateSymbol;\n\tstatic getAsUpdatesSymbol = getAsUpdatesSymbol;\n\tstatic getAsInitialUpdatedSymbol = getAsInitialUpdatedSymbol;\n\tstatic clearSymbol = clearSymbol;\n\tstatic WithSubscription: typeof SubscriptionMapWithSubscription;\n\tstatic Item: typeof SubscriptionMapItem;\n\t\n}\n\n\nexport class SubscriptionMapWithSubscription<I extends Item = Item> extends SubscriptionMap<I> {\n\tconstructor(publicationName: string, params: unknown[], onUpdate: UpdateHandler<I>, immediately = true) {\n\t\tsuper(null, onUpdate);\n\t\t\n\t\tthis.publicationName = publicationName;\n\t\tthis.params = params;\n\t\t\n\t\tif (immediately)\n\t\t\tthis.subscribe();\n\t\t\n\t}\n\t\n\tpublicationName;\n\tparams;\n\t\n\tsubscription: null | Subscription = null;\n\t\n\tsubscribe() {\n\t\t\n\t\tif (!this.subscription)\n\t\t\tthis.subscription = new Subscription(\"map\", this.publicationName, this.params, updates => this.update(updates as Updates<I>));\n\t\t\n\t}\n\t\n\tget [subscribeSymbol]() {\n\t\treturn this.subscribe;\n\t}\n\t\n\tunsubscribe() {\n\t\t\n\t\tif (this.subscription) {\n\t\t\tthis.subscription.cancel();\n\t\t\tthis.subscription = null;\n\t\t}\n\t\t\n\t}\n\t\n\tget [unsubscribeSymbol]() {\n\t\treturn this.unsubscribe;\n\t}\n\t\n\trenew(publicationName?: string, params?: unknown[]) {\n\t\t\n\t\tif (this.subscription) {\n\t\t\tthis.unsubscribe();\n\t\t\t\n\t\t\tif (publicationName)\n\t\t\t\tif (Array.isArray(publicationName))\n\t\t\t\t\tparams = publicationName;\n\t\t\t\telse\n\t\t\t\t\tthis.publicationName = publicationName;\n\t\t\t\n\t\t\tif (params)\n\t\t\t\tthis.params = params;\n\t\t\t\n\t\t\tthis.subscribe();\n\t\t}\n\t\t\n\t}\n\t\n\tget [renewSymbol]() {\n\t\treturn this.renew;\n\t}\n\t\n\t[getSubscriptionSymbol]() {\n\t\treturn this.subscription;\n\t}\n\t\n\tget [Symbol.toStringTag]() {\n\t\treturn \"SubscriptionMapWithSubscription\";\n\t}\n\t\n\t\n\tstatic subscribeSymbol = subscribeSymbol;\n\tstatic unsubscribeSymbol = unsubscribeSymbol;\n\tstatic renewSymbol = renewSymbol;\n\tstatic getSubscriptionSymbol = getSubscriptionSymbol;\n\t\n}\n\nSubscriptionMap.WithSubscription = SubscriptionMapWithSubscription;\n\n\nexport class SubscriptionMapItem {\n\tconstructor(map: SubscriptionMap, updates: GenericItem) {\n\t\tthis.map = map;\n\t\t\n\t\tthis.update(updates);\n\t\t\n\t}\n\t\n\t_id!: string;\n\t\n\tprivate map;\n\t\n\tupdate(updates: GenericItem) {\n\t\tObject.assign(this, updates);\n\t\t\n\t}\n\t\n\tdelete() {\n\t\t\n\t\tthis.map.delete(this._id);\n\t\t\n\t}\n\t\n}\n\nSubscriptionMap.Item = SubscriptionMapItem;\n\nexport { Updated as SubscriptionMapUpdated };\n", "import { Subscription } from \"./Subscription\";\nimport {\n\tclearSymbol,\n\tgetAsInitialUpdatedSymbol,\n\tgetAsUpdatesSymbol,\n\tgetHandleUpdateSymbol,\n\tgetSubscriptionSymbol,\n\trenewSymbol,\n\tsetHandleUpdateSymbol,\n\tsubscribeSymbol,\n\tunsubscribeSymbol,\n\tupdateSymbol\n} from \"./symbols\";\n\n\nconst handleUpdateSymbol = Symbol(\"handleUpdate\");\nconst updatesSymbol = Symbol(\"updates\");\n\nexport type Updated = Record<string, unknown>;\nexport type Updates = null | Record<string, unknown>;\ntype UpdateHandler = (object: SubscriptionObject, updated: Updated, updates: Updates) => void;\n\n\nexport class SubscriptionObject {\n\tconstructor(updates?: Updates, onUpdate?: UpdateHandler) {\n\t\tif (onUpdate)\n\t\t\tthis[handleUpdateSymbol] = onUpdate;\n\t\t\n\t\tif (updates)\n\t\t\tthis[updateSymbol](updates);\n\t\t\n\t}\n\t\n\t[handleUpdateSymbol]?: UpdateHandler;\n\t\n\t[updatesSymbol]: Updates = null;\n\t\n\t[getHandleUpdateSymbol]() {\n\t\treturn this[handleUpdateSymbol];\n\t}\n\t\n\t[setHandleUpdateSymbol](handleUpdate: UpdateHandler) {\n\t\treturn (this[handleUpdateSymbol] = handleUpdate);\n\t}\n\t\n\t[updateSymbol](updates: Updates) {\n\t\tif (updates) {\n\t\t\tfor (const key in this[updatesSymbol])// eslint-disable-line guard-for-in\n\t\t\t\tdelete this[key];\n\t\t\tfor (const key in updates)// eslint-disable-line guard-for-in\n\t\t\t\tthis[key] = updates[key];\n\t\t\tthis[updatesSymbol] = updates;\n\t\t} else\n\t\t\tthis[clearSymbol]();\n\t\t\n\t\tthis[handleUpdateSymbol]?.(this, this, this[updatesSymbol]);\n\t\t\n\t\treturn this;\n\t}\n\t\n\t[getAsUpdatesSymbol]() {\n\t\treturn this[updatesSymbol] && { ...this[updatesSymbol] };\n\t}\n\t\n\t[getAsInitialUpdatedSymbol]() {\n\t\treturn this.valueOf();\n\t}\n\t\n\t[clearSymbol]() {\n\t\t\n\t\tfor (const key in this)// eslint-disable-line guard-for-in\n\t\t\tdelete this[key];\n\t\tthis[updatesSymbol] = null;\n\t\t\n\t}\n\t\n\tvalueOf() {\n\t\treturn this[updatesSymbol] && this;\n\t}\n\t\n\tget [Symbol.toStringTag]() {\n\t\treturn \"SubscriptionObject\";\n\t}\n\t\n\t[key: string]: unknown;\n\t\n\t\n\tstatic updateSymbol = updateSymbol;\n\tstatic getHandleUpdateSymbol = getHandleUpdateSymbol;\n\tstatic setHandleUpdateSymbol = setHandleUpdateSymbol;\n\tstatic getAsUpdatesSymbol = getAsUpdatesSymbol;\n\tstatic getAsInitialUpdatedSymbol = getAsInitialUpdatedSymbol;\n\tstatic clearSymbol = clearSymbol;\n\tstatic WithSubscription: typeof SubscriptionObjectWithSubscription;\n\t\n}\n\n\nexport class SubscriptionObjectWithSubscription extends SubscriptionObject {\n\tconstructor(publicationName: string, params: unknown[], onUpdate: UpdateHandler, immediately = true) {\n\t\tsuper(null, onUpdate);\n\t\t\n\t\tthis.publicationName = publicationName;\n\t\tthis.params = params;\n\t\t\n\t\tif (immediately)\n\t\t\tthis[subscribeSymbol]();\n\t\t\n\t}\n\t\n\tprivate publicationName;\n\tprivate params;\n\tprivate subscription: null | Subscription = null;\n\t\n\t[subscribeSymbol]() {\n\t\t\n\t\tif (!this.subscription)\n\t\t\tthis.subscription = new Subscription(\"object\", this.publicationName, this.params, updates => this[updateSymbol](updates as Updates));\n\t\t\n\t}\n\t\n\t[unsubscribeSymbol]() {\n\t\t\n\t\tif (this.subscription) {\n\t\t\tthis.subscription.cancel();\n\t\t\tthis.subscription = null;\n\t\t}\n\t\t\n\t}\n\t\n\t[renewSymbol](publicationName?: string, params?: unknown[]) {\n\t\t\n\t\tif (this.subscription) {\n\t\t\tthis[unsubscribeSymbol]();\n\t\t\t\n\t\t\tif (publicationName)\n\t\t\t\tif (Array.isArray(publicationName))\n\t\t\t\t\tparams = publicationName;\n\t\t\t\telse\n\t\t\t\t\tthis.publicationName = publicationName;\n\t\t\t\n\t\t\tif (params)\n\t\t\t\tthis.params = params;\n\t\t\t\n\t\t\tthis[subscribeSymbol]();\n\t\t}\n\t\t\n\t}\n\t\n\t[getSubscriptionSymbol]() {\n\t\treturn this.subscription;\n\t}\n\t\n\tget [Symbol.toStringTag]() {\n\t\treturn \"SubscriptionObjectWithSubscription\";\n\t}\n\t\n\t\n\tstatic subscribeSymbol = subscribeSymbol;\n\tstatic unsubscribeSymbol = unsubscribeSymbol;\n\tstatic renewSymbol = renewSymbol;\n\tstatic getSubscriptionSymbol = getSubscriptionSymbol;\n\t\n}\n\nSubscriptionObject.WithSubscription = SubscriptionObjectWithSubscription;\n\nexport { Updated as SubscriptionObjectUpdated };\n"],
|
|
5
|
-
"mappings": "oiBAQA,IAAIA,GACAC,EACAC,EAGSC,EAAN,KAAmB,CACzB,YAAYC,EAAkCC,EAAyBC,EAAkB,CAAC,EAAGC,EAAqCC,EAAc,GAAM,CA2BtJC,EAAA,UACAA,EAAA,aACAA,EAAA,wBACAA,EAAA,aACAA,EAAA,gBACAA,EAAA,oBACAA,EAAA,iBAEAA,EAAA,aAAQ,IAAM,CAEbP,EAAG,YAAY,MAAmC,KAAK,KAAM,KAAK,gBAAiB,KAAK,EAAG,KAAK,KAAM,KAAK,WAAW,EAEtH,KAAK,YAAc,EAEpB,GAvCC,GAAI,CAACA,EACJ,MAAM,IAAI,MAAM,oEAAoE,EAErF,KAAK,EAAIF,KACT,KAAK,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AA0B,CAtTlD,IAAAC,EAsTqD,OAAAN,EAAAM,EAAAD,EAAM5B,EAAAC,IAAN,KAAA4B,IACnDF,EAAS,UAAaC,GAA0B,CAvTlD,IAAAC,EAuTqD,OAAAN,EAAAM,EAAAD,EAAM5B,EAAAE,IAAN,KAAA2B,IACnDF,EAAS,YAAeC,GAA0B,CAxTpD,IAAAC,EAwTuD,OAAAN,EAAAM,EAAAD,EAAM5B,EAAAG,IAAN,KAAA0B,IAnPhD,IAAMC,GAAN1B",
|
|
4
|
+
"sourcesContent": ["import type { InSiteWebSocket } from \"insite-ws/client\";\n\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\n\ndeclare global {\n\tvar __initials: undefined | unknown[];// eslint-disable-line no-var\n}\n\n\nlet i: number;\nlet subscriptions: Map<number, Subscription>;\nlet ws: InSiteWebSocket;\n\n\nexport class Subscription {\n\tconstructor(type: \"array\" | \"map\" | \"object\", publicationName: string, args: unknown[] = [], handler: (updates: any) => void, immediately = true) {\n\t\t\n\t\tif (!ws)\n\t\t\tthrow new Error(\"Subscription is not binded to WS. Do Subscription.bindTo(ws) first\");\n\t\t\n\t\tthis.i = i++;\n\t\tthis.type = type;\n\t\tthis.publicationName = publicationName;\n\t\tthis.args = args;\n\t\tthis.handler = handler;\n\t\tthis.immediately = immediately && !window.__initials;\n\t\t\n\t\tsubscriptions.set(this.i, this);\n\t\t\n\t\tws.on(\"open\", this.start);\n\t\t\n\t\tif (ws.isOpen)\n\t\t\tthis.start();\n\t\t\n\t\tif (window.__initials) {\n\t\t\tthis.isActive = true;\n\t\t\tthis.handler(window.__initials.splice(0, 1)[0]);\n\t\t} else\n\t\t\tthis.isActive = false;\n\t\t\n\t}\n\t\n\ti;\n\ttype;\n\tpublicationName;\n\targs;\n\thandler;\n\timmediately;\n\tisActive;\n\t\n\tstart = () => {\n\t\t\n\t\tws.sendMessage(\"s-s\"/* subscription subscribe */, this.type, this.publicationName, this.i, this.args, this.immediately);\n\t\t\n\t\tthis.immediately = true;\n\t\t\n\t};\n\t\n\tcancel() {\n\t\t\n\t\tsubscriptions.delete(this.i);\n\t\t\n\t\tws.off(\"open\", this.start);\n\t\t\n\t\tws.sendMessage(\"s-u\"/* subscription unsubscribe */, this.i);\n\t\t\n\t}\n\t\n\t\n\tstatic bindTo(_ws: InSiteWebSocket) {\n\t\tws = _ws;\n\t\t\n\t\ti = 0;\n\t\t\n\t\tsubscriptions = new Map();\n\t\t\n\t\tws.on(\"message:s-c\"/* subscription changed */, (si: number, updates: any) => {\n\t\t\tconst subscription = subscriptions.get(si);\n\t\t\tif (subscription) {\n\t\t\t\tsubscription.isActive = true;\n\t\t\t\tsubscription.handler(updates);\n\t\t\t}\n\t\t\t\n\t\t});\n\t\t\n\t\tws.on(\"close\", () => {\n\t\t\t\n\t\t\tfor (const subscription of subscriptions.values())\n\t\t\t\tsubscription.isActive = false;\n\t\t\t\n\t\t});\n\t\t\n\t\tws.on(\"server-change\", () => {\n\t\t\t\n\t\t\tfor (const subscription of subscriptions.values())\n\t\t\t\tsubscription.handler(null);\n\t\t\t\n\t\t});\n\t\t\n\t}\n\t\n}\n", "import { removeOne } from \"@nesvet/n\";\nimport { Subscription } from \"./Subscription\";\nimport {\n\tclearSymbol,\n\tgetAsInitialUpdatedSymbol,\n\tgetAsUpdatesSymbol,\n\tgetHandleUpdateSymbol,\n\tgetSubscriptionSymbol,\n\trenewSymbol,\n\tsetHandleUpdateSymbol,\n\tsubscribeSymbol,\n\tunsubscribeSymbol,\n\tupdateSymbol\n} from \"./symbols\";\n\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\n\ntype Item = unknown;\n\ntype Updated<I extends Item = Item> = {\n\tdeleted: I[];\n\tadded: I[];\n} & I[];\n\nexport type Updates<I extends Item = Item> =\n\t(\n\t\t[ \"a\"/* add */, newItem: I ] |\n\t\t[ \"d\"/* delete */, itemToDelete: I ] |\n\t\t[ \"i\"/* initial */, items: I[], sort?: -1 | 1 ] |\n\t\tnull\n\t)[] |\n\tnull;\n\ntype UpdateHandler<I extends Item = Item> = (array: SubscriptionArray<I>, updated: Updated<I>, updates: Updates<I>) => void;\n\nconst ascSort = (a: any, b: any) => a > b ? 1 : a < b ? -1 : 0;\nconst descSort = (a: any, b: any) => a > b ? -1 : a < b ? 1 : 0;\n\n\nexport class SubscriptionArray<I extends Item = Item> extends Array<I> {\n\tconstructor(updates?: Updates<I>, onUpdate?: UpdateHandler<I>) {\n\t\tsuper();\n\t\t\n\t\tif (onUpdate)\n\t\t\tthis.handleUpdate = onUpdate;\n\t\t\n\t\tif (Array.isArray(updates))\n\t\t\tthis.update(updates);\n\t\t\n\t}\n\t\n\tsorted: Item[] = [];\n\t\n\thandleUpdate;\n\t\n\tsortDirection: -1 | 0 | 1 = 0;\n\t\n\tsortCompareFunction: null | typeof ascSort | typeof descSort = null;\n\t\n\t[getHandleUpdateSymbol]() {\n\t\treturn this.handleUpdate;\n\t}\n\t\n\t[setHandleUpdateSymbol](handleUpdate: UpdateHandler<I>) {\n\t\treturn (this.handleUpdate = handleUpdate);\n\t}\n\t\n\tupdate(updates: Updates<I>) {\n\t\t\n\t\tconst updated: Updated<I> = Object.assign([], {\n\t\t\tdeleted: [],\n\t\t\tadded: []\n\t\t});\n\t\t\n\t\tif (updates) {\n\t\t\tlet shouldSort = false;\n\t\t\t\n\t\t\tfor (const update of updates)\n\t\t\t\tswitch (update?.[0]) {\n\t\t\t\t\tcase \"i\"/* initial */: {\n\t\t\t\t\t\tconst [ , array, sort ] = update;\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (sort) {\n\t\t\t\t\t\t\tthis.sortDirection = sort;\n\t\t\t\t\t\t\tthis.sortCompareFunction = sort > 0 ? ascSort : descSort;\n\t\t\t\t\t\t\tshouldSort = true;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthis.sortDirection = 0;\n\t\t\t\t\t\t\tthis.sortCompareFunction = null;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tthis.length = 0;\n\t\t\t\t\t\t\n\t\t\t\t\t\tfor (const newItem of array) {\n\t\t\t\t\t\t\tthis.push(newItem);\n\t\t\t\t\t\t\tupdated.push(newItem);\n\t\t\t\t\t\t\tupdated.added.push(newItem);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tcase \"a\"/* add */: {\n\t\t\t\t\t\tconst [ , newItem ] = update;\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (!this.includes(newItem)) {\n\t\t\t\t\t\t\tthis.push(newItem);\n\t\t\t\t\t\t\tif (this.sortDirection)\n\t\t\t\t\t\t\t\tshouldSort = true;\n\t\t\t\t\t\t\tupdated.push(newItem);\n\t\t\t\t\t\t\tupdated.added.push(newItem);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tcase \"d\"/* delete */: {\n\t\t\t\t\t\tconst [ , itemToDelete ] = update;\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (removeOne(this, itemToDelete))\n\t\t\t\t\t\t\tupdated.deleted.push(itemToDelete);\n\t\t\t\t\t\t\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tthis.clear();\n\t\t\t\t}\n\t\t\t\n\t\t\tif (shouldSort && this.sortCompareFunction)\n\t\t\t\tthis.sort(this.sortCompareFunction);\n\t\t\t\n\t\t} else\n\t\t\tthis.clear();\n\t\t\n\t\tthis.handleUpdate?.(this, updated, updates?.[0] ? updates : null);\n\t\t\n\t\treturn this;\n\t}\n\t\n\t[updateSymbol] = this.update;\n\t\n\tgetAsUpdates() {\n\t\treturn (\n\t\t\t(this.length || this.sortDirection) ?\n\t\t\t\t[ [ \"i\"/* initial */, [ ...this ], this.sortDirection ] ] :\n\t\t\t\tnull\n\t\t);\n\t}\n\t\n\t[getAsUpdatesSymbol] = this.getAsUpdates;\n\t\n\tgetAsInitialUpdated() {\n\t\treturn Object.assign([ ...this.sorted ], {\n\t\t\tadded: [ ...this.sorted ],\n\t\t\tdeleted: []\n\t\t});\n\t}\n\t\n\t[getAsInitialUpdatedSymbol] = this.getAsInitialUpdated;\n\t\n\tclear() {\n\t\t\n\t\tthis.length = 0;\n\t\tthis.sortDirection = 0;\n\t\tthis.sortCompareFunction = null;\n\t\t\n\t}\n\t\n\t[clearSymbol] = this.clear;\n\t\n\tvalueOf() {\n\t\treturn this;\n\t}\n\t\n\tget [Symbol.toStringTag]() {\n\t\treturn \"SubscriptionArray\";\n\t}\n\t\n\t\n\tstatic updateSymbol = updateSymbol;\n\tstatic getHandleUpdateSymbol = getHandleUpdateSymbol;\n\tstatic setHandleUpdateSymbol = setHandleUpdateSymbol;\n\tstatic getAsUpdatesSymbol = getAsUpdatesSymbol;\n\tstatic getAsInitialUpdatedSymbol = getAsInitialUpdatedSymbol;\n\tstatic clearSymbol = clearSymbol;\n\tstatic WithSubscription: typeof SubscriptionArrayWithSubscription;\n\t\n}\n\n\nexport class SubscriptionArrayWithSubscription<I extends Item = Item> extends SubscriptionArray<I> {\n\tconstructor(publicationName: string, params: unknown[], onUpdate: UpdateHandler<I>, immediately = true) {\n\t\tsuper(null, onUpdate);\n\t\t\n\t\tthis.publicationName = publicationName;\n\t\tthis.params = params;\n\t\t\n\t\tif (immediately)\n\t\t\tthis.subscribe();\n\t\t\n\t}\n\t\n\tpublicationName;\n\tparams;\n\tsubscription: null | Subscription = null;\n\t\n\tsubscribe() {\n\t\t\n\t\tif (!this.subscription)\n\t\t\tthis.subscription = new Subscription(\"array\", this.publicationName, this.params, updates => this.update(updates as Updates<I>));\n\t\t\n\t}\n\t\n\tget [subscribeSymbol]() {\n\t\treturn this.subscribe;\n\t}\n\t\n\tunsubscribe() {\n\t\t\n\t\tif (this.subscription) {\n\t\t\tthis.subscription.cancel();\n\t\t\tthis.subscription = null;\n\t\t}\n\t\t\n\t}\n\t\n\tget [unsubscribeSymbol]() {\n\t\treturn this.unsubscribe;\n\t}\n\t\n\trenew(publicationName?: string, params?: unknown[]) {\n\t\t\n\t\tif (this.subscription) {\n\t\t\tthis.unsubscribe();\n\t\t\t\n\t\t\tif (publicationName)\n\t\t\t\tif (Array.isArray(publicationName))\n\t\t\t\t\tparams = publicationName;\n\t\t\t\telse\n\t\t\t\t\tthis.publicationName = publicationName;\n\t\t\t\n\t\t\tif (params)\n\t\t\t\tthis.params = params;\n\t\t\t\n\t\t\tthis.subscribe();\n\t\t}\n\t\t\n\t}\n\t\n\tget [renewSymbol]() {\n\t\treturn this.renew;\n\t}\n\t\n\t[getSubscriptionSymbol]() {\n\t\treturn this.subscription;\n\t}\n\t\n\tget [Symbol.toStringTag]() {\n\t\treturn \"SubscriptionArrayWithSubscription\";\n\t}\n\t\n\t\n\tstatic subscribeSymbol = subscribeSymbol;\n\tstatic unsubscribeSymbol = unsubscribeSymbol;\n\tstatic renewSymbol = renewSymbol;\n\tstatic getSubscriptionSymbol = getSubscriptionSymbol;\n\t\n}\n\nSubscriptionArray.WithSubscription = SubscriptionArrayWithSubscription;\n\nexport { Updated as SubscriptionArrayUpdated };\n", "export const updateSymbol = Symbol(\"update\");\nexport const getHandleUpdateSymbol = Symbol(\"getHandleUpdate\");\nexport const setHandleUpdateSymbol = Symbol(\"setHandleUpdate\");\nexport const getAsUpdatesSymbol = Symbol(\"getAsUpdates\");\nexport const getAsInitialUpdatedSymbol = Symbol(\"getAsInitialUpdated\");\nexport const clearSymbol = Symbol(\"clear\");\nexport const subscribeSymbol = Symbol(\"subscribe\");\nexport const unsubscribeSymbol = Symbol(\"unsubscribe\");\nexport const renewSymbol = Symbol(\"renew\");\nexport const getSubscriptionSymbol = Symbol(\"getSubscription\");\nexport const getHandleSubscriptionSymbol = Symbol(\"getHandleSubscription\");\nexport const setHandleSubscriptionSymbol = Symbol(\"setHandleSubscription\");\n", "import EventEmitter from \"eventemitter3\";\nimport { debounce, StatefulPromise } from \"@nesvet/n\";\nimport { privates } from \"./common\";\nimport { SubscriptionGroupItem } from \"./SubscriptionGroupItem\";\nimport {\n\tDefinition,\n\tParseValues,\n\tSubscriptionHandle,\n\tSubscriptionOnBeforeInit,\n\tSubscriptionType,\n\tTupleDefinition,\n\tUnparsedDefinition\n} from \"./types\";\n\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\n\nfunction isTupleDefinition<T extends SubscriptionType>(definition: UnparsedDefinition<T>): definition is TupleDefinition {\n\treturn Array.isArray(definition);\n}\n\ntype Target = any;\n\ntype Options = {\n\ttarget?: Target;\n\tdebounce?: number;\n\timmediately?: boolean;\n};\n\n\nfunction parseDefinition<T extends SubscriptionType>(definition: UnparsedDefinition<T>) {\n\tif (isTupleDefinition(definition)) {\n\t\tconst args = definition.slice();\n\t\t\n\t\tconst parsed: Partial<Definition<T>> = {};\n\t\t\n\t\tparsed.name = args.shift() as Definition<T>[\"name\"];\n\t\tif (typeof args[0] == \"object\" && !Array.isArray(args[0])) {\n\t\t\tparsed.value = args.shift() as Definition<T>[\"value\"];\n\t\t\tparsed.type = parsed.value!.toString().match(/Subscription(Object|Array|Map)/)?.[1].toLowerCase() as Definition<T>[\"type\"];\n\t\t\tif (!parsed.type)\n\t\t\t\tthrow new Error(\"Unknown value type\");\n\t\t} else {\n\t\t\tif (typeof args[0] == \"string\")\n\t\t\t\tparsed.type = args.shift() as Definition<T>[\"type\"];\n\t\t\tif (typeof args[0] == \"string\")\n\t\t\t\tparsed.publicationName = args.shift() as Definition<T>[\"publicationName\"];\n\t\t\tif (Array.isArray(args[0]))\n\t\t\t\tparsed.params = args.shift() as Definition<T>[\"params\"];\n\t\t}\n\t\t\n\t\tif (typeof args[0] == \"function\")\n\t\t\tparsed.handle = args.shift() as SubscriptionHandle<T>;\n\t\tif (typeof args[0] == \"function\")\n\t\t\tparsed.onBeforeInit = args.shift() as SubscriptionOnBeforeInit<T>;\n\t\tif (typeof args[0] == \"number\")\n\t\t\tparsed.debounce = args.shift() as Definition<T>[\"debounce\"];\n\t\tif (typeof args[0] == \"boolean\")\n\t\t\tparsed.preventBind = args.shift() as Definition<T>[\"preventBind\"];\n\t\t\n\t\treturn parsed as Definition<T>;\n\t}\n\t\n\tdefinition.type ??= \"object\" as T;\n\t\n\treturn definition;\n}\n\nexport class SubscriptionGroup<DS extends UnparsedDefinition[] = any[]> extends EventEmitter {\n\tconstructor(\n\t\tdefinitions: DS,\n\t\t{\n\t\t\ttarget,\n\t\t\tdebounce: debounceLimit = SubscriptionGroup.debounceLimit,\n\t\t\timmediately\n\t\t}: Options = {}\n\t) {\n\t\tsuper();\n\t\t\n\t\tthis.applyOptions({ target, debounceLimit });\n\t\t\n\t\tthis.#initPromise = new StatefulPromise();\n\t\t\n\t\tthis.attach(definitions, false, immediately);\n\t\t\n\t}\n\t\n\ttarget?: Target;\n\temitUpdate!: () => void;\n\t\n\titems = [] as unknown as Record<string, SubscriptionGroupItem> & SubscriptionGroupItem[];\n\tvalues = [] as DS extends any ? (any[] & Record<string, any>) : ParseValues<DS>;\n\t\n\tisLoaded = false;\n\tisInited = false;\n\t\n\t#loadPromise!: StatefulPromise<SubscriptionGroup>;\n\t#initPromise: StatefulPromise<SubscriptionGroup>;\n\t#unloadPromise!: StatefulPromise<SubscriptionGroup>;\n\t\n\t#debounceLimit?: null | number = null;\n\t\n\tapplyOptions({ target, debounceLimit }: { target?: Target; debounceLimit?: number }) {\n\t\t\n\t\tif (this.target !== target) {\n\t\t\tif (this.target)\n\t\t\t\tfor (const item of this.items)\n\t\t\t\t\tif (item.isLoaded && !item.preventBind)\n\t\t\t\t\t\tdelete this.target[item.name];\n\t\t\t\n\t\t\tthis.target = target;\n\t\t\t\n\t\t\tif (this.target)\n\t\t\t\tfor (const item of this.items)\n\t\t\t\t\tif (item.isLoaded && !item.preventBind)\n\t\t\t\t\t\tthis.target[item.name] = item.value;\n\t\t}\n\t\t\n\t\tif (this.#debounceLimit !== debounceLimit) {\n\t\t\tthis.#debounceLimit = debounceLimit;\n\t\t\tif (typeof this.#debounceLimit == \"number\") {\n\t\t\t\tconst emitUpdateDebounced = debounce(() => this.emit(\"update\", this.values), this.#debounceLimit);\n\t\t\t\tthis.emitUpdate = () => emitUpdateDebounced();\n\t\t\t} else\n\t\t\t\tthis.emitUpdate = () => this.emit(\"update\", this.values);\n\t\t}\n\t\t\n\t}\n\t\n\tattach(definitions: DS, shouldReload = this.isLoaded, immediately = true) {\n\t\tif (shouldReload)\n\t\t\tthis.isLoaded = false;\n\t\t\n\t\tif (!this.#loadPromise || this.#loadPromise.isFulfilled)\n\t\t\tthis.#loadPromise = new StatefulPromise();\n\t\t\n\t\tif (!this.#unloadPromise || this.#unloadPromise.isFulfilled)\n\t\t\tthis.#unloadPromise = new StatefulPromise();\n\t\t\n\t\treturn Promise.all(definitions.map(definition =>\n\t\t\tnew SubscriptionGroupItem(parseDefinition(definition), this)\n\t\t).map(item => {\n\t\t\t\n\t\t\tif (immediately)\n\t\t\t\titem.subscribe();\n\t\t\t\n\t\t\treturn item.loaded();\n\t\t}));\n\t}\n\t\n\tdetach(names: string[], shouldUpdate = true) {\n\t\t\n\t\tfor (const name of names)\n\t\t\tthis.items[name]?.detach();\n\t\t\n\t\tif (shouldUpdate) {\n\t\t\tthis.#unload();\n\t\t\tthis.#load();\n\t\t}\n\t\t\n\t}\n\t\n\tredefine(definitions: DS) {\n\t\t\n\t\tconst itemsToDetach = new Map(this.items.map(item => [ item.name, item ]));\n\t\tconst definitionsToRedefine = [];\n\t\tconst definitionsToAttach = [] as unknown as DS;\n\t\t\n\t\tfor (let definition of definitions) {\n\t\t\tdefinition = parseDefinition(definition);\n\t\t\tif (itemsToDetach.delete(definition.name))\n\t\t\t\tdefinitionsToRedefine.push(definition);\n\t\t\telse\n\t\t\t\tdefinitionsToAttach.push(definition);\n\t\t}\n\t\t\n\t\tthis.isLoaded = false;\n\t\t\n\t\tthis.detach([ ...itemsToDetach.keys() ], false);\n\t\t\n\t\treturn Promise.all([\n\t\t\t...definitionsToRedefine.map(definition => {\n\t\t\t\tconst item = this.items[definition.name];\n\t\t\t\titem.define(definition);\n\t\t\t\t\n\t\t\t\titem.subscribe();\n\t\t\t\t\n\t\t\t\treturn item.loaded();\n\t\t\t}),\n\t\t\t...definitionsToAttach.length ? [ this.attach(definitionsToAttach, false) ] : []\n\t\t]);\n\t}\n\t\n\tsubscribe() {\n\t\treturn this.items.map(item => item.subscribe());\n\t}\n\t\n\tunsubscribe() {\n\t\treturn this.items.map(item => item.unsubscribe());\n\t}\n\t\n\t#load() {\n\t\t\n\t\tif (!this.isLoaded && this.items.every(item => item.isLoaded)) {\n\t\t\tif (this.target)\n\t\t\t\tfor (const item of this.items)\n\t\t\t\t\tif (!item.preventBind)\n\t\t\t\t\t\tthis.target[item.name] = item.value;\n\t\t\t\n\t\t\tthis.isLoaded = true;\n\t\t\t\n\t\t\tfor (const item of this.items)\n\t\t\t\tprivates.itemLoad!(item);\n\t\t\t\n\t\t\tthis.emit(\"load\", this.values);\n\t\t\t\n\t\t\tif (this.isInited)\n\t\t\t\tif (this.items.length)\n\t\t\t\t\tfor (const item of this.items)\n\t\t\t\t\t\titem.emitUpdate();\n\t\t\t\telse\n\t\t\t\t\tthis.emitUpdate();\n\t\t\t\n\t\t\t\n\t\t\tthis.#loadPromise.resolve(this);\n\t\t\t\n\t\t\tif (this.#unloadPromise.isFulfilled)\n\t\t\t\tthis.#unloadPromise = new StatefulPromise();\n\t\t}\n\t\t\n\t}\n\t\n\t#init() {\n\t\t\n\t\tif (!this.isInited && this.items.every(item => item.isInited)) {\n\t\t\tthis.isInited = true;\n\t\t\t\n\t\t\tif (this.isLoaded)\n\t\t\t\tif (this.items.length)\n\t\t\t\t\tfor (const item of this.items)\n\t\t\t\t\t\titem.emitUpdate();\n\t\t\t\telse\n\t\t\t\t\tthis.emitUpdate();\n\t\t\t\n\t\t\t\n\t\t\tfor (const item of this.items)\n\t\t\t\tprivates.itemInit!(item);\n\t\t\t\n\t\t\tthis.emit(\"init\", this.values);\n\t\t\t\n\t\t\tthis.#initPromise.resolve(this);\n\t\t}\n\t\t\n\t}\n\t\n\t#unload() {\n\t\t\n\t\tif (this.isLoaded && this.items.every(item => !item.isLoaded)) {\n\t\t\tif (this.target)\n\t\t\t\tfor (const item of this.items)\n\t\t\t\t\tif (!item.preventBind)\n\t\t\t\t\t\tdelete this.target[item.name];\n\t\t\t\n\t\t\tthis.isLoaded = false;\n\t\t\t\n\t\t\tfor (const item of this.items)\n\t\t\t\tprivates.itemUnload!(item);\n\t\t\t\n\t\t\tthis.emit(\"unload\", this.values);\n\t\t\t\n\t\t\tif (this.items.length)\n\t\t\t\tfor (const item of this.items)\n\t\t\t\t\titem.emitUpdate();\n\t\t\telse\n\t\t\t\tthis.emitUpdate();\n\t\t\t\n\t\t\tthis.#unloadPromise.resolve(this);\n\t\t\t\n\t\t\tif (this.#loadPromise.isFulfilled)\n\t\t\t\tthis.#loadPromise = new StatefulPromise();\n\t\t}\n\t\t\n\t}\n\t\n\tloaded() {\n\t\treturn this.#loadPromise;\n\t}\n\t\n\tinited() {\n\t\treturn this.#initPromise;\n\t}\n\t\n\tunloaded() {\n\t\treturn this.#unloadPromise;\n\t}\n\t\n\tvalueOf() {\n\t\treturn this.values;\n\t}\n\t\n\t[Symbol.iterator]() {\n\t\treturn this.values[Symbol.iterator]();\n\t}\n\t\n\t\n\tstatic debounceLimit = 8;\n\t\n\tstatic {\n\t\t\n\t\tprivates.groupLoad = (group: SubscriptionGroup) => group.#load();\n\t\tprivates.groupInit = (group: SubscriptionGroup) => group.#init();\n\t\tprivates.groupUnload = (group: SubscriptionGroup) => group.#unload();\n\t\t\n\t}\n\t\n}\n\nexport { Options as SubscriptionGroupOptions, Target as SubscriptionGroupTarget };\n", "import type { SubscriptionGroup } from \"./SubscriptionGroup\";\nimport type { SubscriptionGroupItem } from \"./SubscriptionGroupItem\";\nimport type { SubscriptionType } from \"./types\";\n\n\nexport const privates: {\n\tgroupLoad?: (group: SubscriptionGroup) => void;\n\tgroupInit?: (group: SubscriptionGroup) => void;\n\tgroupUnload?: (group: SubscriptionGroup) => void;\n\titemLoad?: <T extends SubscriptionType>(item: SubscriptionGroupItem<T>) => void;\n\titemInit?: <T extends SubscriptionType>(item: SubscriptionGroupItem<T>) => void;\n\titemUnload?: <T extends SubscriptionType>(item: SubscriptionGroupItem<T>) => void;\n} = {};\n", "import EventEmitter from \"eventemitter3\";\nimport { debounce, removeOne, StatefulPromise } from \"@nesvet/n\";\nimport { type SubscriptionArrayUpdated, SubscriptionArrayWithSubscription } from \"../SubscriptionArray\";\nimport { type SubscriptionMapUpdated, SubscriptionMapWithSubscription } from \"../SubscriptionMap\";\nimport { type Updated as SubscriptionObjectUpdated, SubscriptionObjectWithSubscription } from \"../SubscriptionObject\";\nimport {\n\trenewSymbol,\n\tsetHandleUpdateSymbol,\n\tsubscribeSymbol,\n\tunsubscribeSymbol\n} from \"../symbols\";\nimport { privates } from \"./common\";\nimport type { SubscriptionGroup } from \"./SubscriptionGroup\";\nimport type {\n\tDefinition,\n\tSubscriptionHandle,\n\tSubscriptionOnBeforeInit,\n\tSubscriptionType,\n\tSubscriptionUpdated,\n\tSubscriptionUpdates,\n\tSubscriptionValue\n} from \"./types\";\n\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\n\ntype HandleSubscription<T> = (_: any, updated: SubscriptionUpdated<T>, updates: SubscriptionUpdates<T>) => void;\n\nfunction isUpdatedMapOrArray(updated: SubscriptionUpdated<SubscriptionType>): updated is SubscriptionArrayUpdated | SubscriptionMapUpdated {\n\treturn Array.isArray(updated);\n}\n\n\nexport class SubscriptionGroupItem<T extends SubscriptionType = SubscriptionType, D extends Definition<T> = Definition<T>> extends EventEmitter {\n\tconstructor(definition: D, group: SubscriptionGroup) {\n\t\tsuper();\n\t\t\n\t\tthis.name = definition.name;\n\t\t\n\t\tthis.define(definition, group);\n\t\t\n\t}\n\t\n\tname;\n\tgroup?: SubscriptionGroup;\n\tvalue?: SubscriptionValue<T>;\n\ttype!: \"object\" | T;\n\tpublicationName!: Definition<T>[\"publicationName\"];\n\tparams!: Definition<T>[\"params\"];\n\thandle!: Definition<T>[\"handle\"];\n\tonBeforeInit!: Definition<T>[\"onBeforeInit\"];\n\tpreventBind!: Definition<T>[\"preventBind\"];\n\t\n\temitUpdate!: (updated?: SubscriptionUpdated<T>) => void;\n\t\n\tisLoaded = false;\n\tisInited = false;\n\t\n\t#loadPromise!: StatefulPromise<SubscriptionGroupItem<T, D>>;\n\t#initPromise!: StatefulPromise<SubscriptionGroupItem<T, D>>;\n\t#unloadPromise!: StatefulPromise<SubscriptionGroupItem<T, D>>;\n\t\n\tdefine(definition: Definition<T>, group: SubscriptionGroup | undefined = this.group) {\n\t\tif (!group)\n\t\t\tthrow new Error(\"group is undefined\");\n\t\t\n\t\tconst {\n\t\t\tvalue,\n\t\t\ttype = \"object\",\n\t\t\tpublicationName,\n\t\t\tparams,\n\t\t\thandle,\n\t\t\tonBeforeInit,\n\t\t\tdebounce: debounceLimit = SubscriptionGroupItem.debounceLimit,\n\t\t\tpreventBind\n\t\t} = definition;\n\t\t\n\t\tif (this.group) {\n\t\t\tif (\n\t\t\t\t(!value || this.value === value) &&\n\t\t\t\tthis.type === type &&\n\t\t\t\tthis.publicationName === publicationName &&\n\t\t\t\tJSON.stringify(this.params) === JSON.stringify(params) &&\n\t\t\t\tthis.handle === handle &&\n\t\t\t\tthis.onBeforeInit === onBeforeInit\n\t\t\t)\n\t\t\t\treturn this.#applyOptions({ debounceLimit, preventBind });\n\t\t\t\n\t\t\tthis.detach();\n\t\t\tdelete this.value;\n\t\t\tdelete this.publicationName;\n\t\t\tdelete this.params;\n\t\t}\n\t\t\n\t\tthis.type = type;\n\t\tthis.handle = handle;\n\t\tthis.onBeforeInit = onBeforeInit;\n\t\tif (value)\n\t\t\tthis.value = value;\n\t\telse {\n\t\t\tthis.publicationName = publicationName ?? this.name;\n\t\t\tthis.params = params ?? [];\n\t\t}\n\t\t\n\t\tthis.#applyOptions({ debounceLimit, preventBind });\n\t\t\n\t\tthis.#attachTo(group);\n\t\t\n\t\treturn null;\n\t}\n\t\n\t#applyOptions({ debounceLimit, preventBind }: { debounceLimit?: number; preventBind?: boolean }) {\n\t\t\n\t\tconst emitUpdate: typeof this.emitUpdate = updated => {\n\t\t\tthis.emit(\"update\", this.value, updated);\n\t\t\tthis.group?.emit(`update.${this.name}`, this.value, updated);\n\t\t\tthis.group?.emitUpdate();\n\t\t\t\n\t\t};\n\t\t\n\t\tif (typeof debounceLimit == \"number\") {\n\t\t\tlet debouncedUpdated: SubscriptionUpdated<T> | undefined;\n\t\t\tlet group: SubscriptionGroup;\n\t\t\t\n\t\t\tconst emitUpdateDebounced = debounce(() => {\n\t\t\t\t\n\t\t\t\tconst isDetached = !this.group;\n\t\t\t\t\n\t\t\t\tif (isDetached)\n\t\t\t\t\tthis.group = group;\n\t\t\t\t\n\t\t\t\temitUpdate(debouncedUpdated!);\n\t\t\t\t\n\t\t\t\tif (isDetached)\n\t\t\t\t\tdelete this.group;\n\t\t\t\t\n\t\t\t\tdebouncedUpdated = undefined;\n\t\t\t\t\n\t\t\t}, debounceLimit);\n\t\t\t\n\t\t\tthis.emitUpdate = updated => {\n\t\t\t\tif (updated !== undefined)\n\t\t\t\t\tif (isUpdatedMapOrArray(updated))\n\t\t\t\t\t\tif (isUpdatedMapOrArray(debouncedUpdated!))\n\t\t\t\t\t\t\tfor (const item of updated)\n\t\t\t\t\t\t\t\tdebouncedUpdated.push(item as any);\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tdebouncedUpdated = Object.assign([ ...updated ], {\n\t\t\t\t\t\t\t\tadded: [ ...updated.added ],\n\t\t\t\t\t\t\t\tdeleted: [ ...updated.deleted ]\n\t\t\t\t\t\t\t}) as SubscriptionUpdated<T>;\n\t\t\t\t\telse if (typeof updated == \"object\")\n\t\t\t\t\t\tif (debouncedUpdated)\n\t\t\t\t\t\t\tObject.assign(debouncedUpdated, updated);\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tdebouncedUpdated = { ...updated };\n\t\t\t\t\telse\n\t\t\t\t\t\tdebouncedUpdated = updated;\n\t\t\t\t\n\t\t\t\tgroup = this.group!;\n\t\t\t\t\n\t\t\t\treturn emitUpdateDebounced();\n\t\t\t};\n\t\t} else\n\t\t\tthis.emitUpdate = emitUpdate;\n\t\t\n\t\tif (this.preventBind === undefined)\n\t\t\tdelete this.preventBind;\n\t\telse\n\t\t\tthis.preventBind = preventBind;\n\t\t\n\t}\n\t\n\t#attachTo(group: SubscriptionGroup) {\n\t\tif (!this.group) {\n\t\t\tthis.group = group;\n\t\t\t\n\t\t\tthis.group.items.push(this);\n\t\t\tthis.group.items[this.name] = this;\n\t\t\t\n\t\t\tif (!this.#loadPromise || this.#loadPromise.isFulfilled)\n\t\t\t\tthis.#loadPromise = new StatefulPromise();\n\t\t\t\n\t\t\tif (!this.#initPromise || this.#initPromise.isFulfilled)\n\t\t\t\tthis.#initPromise = new StatefulPromise();\n\t\t\t\n\t\t\tif (!this.#unloadPromise || this.#unloadPromise.isFulfilled)\n\t\t\t\tthis.#unloadPromise = new StatefulPromise();\n\t\t\t\n\t\t\tswitch (this.type) {\n\t\t\t\tcase \"array\": {\n\t\t\t\t\tconst handleSubscription = this.#handleSubscription as HandleSubscription<\"array\">;\n\t\t\t\t\tif (this.value)\n\t\t\t\t\t\t(this.value as SubscriptionArrayWithSubscription)[setHandleUpdateSymbol](handleSubscription);\n\t\t\t\t\telse\n\t\t\t\t\t\tthis.value = new SubscriptionArrayWithSubscription(this.publicationName!, this.params!, handleSubscription, false) as SubscriptionValue<T>;\n\t\t\t\t\tbreak;\n\t\t\t\t} case \"map\": {\n\t\t\t\t\tconst handleSubscription = this.#handleSubscription as HandleSubscription<\"map\">;\n\t\t\t\t\tif (this.value)\n\t\t\t\t\t\t(this.value as SubscriptionMapWithSubscription)[setHandleUpdateSymbol](handleSubscription);\n\t\t\t\t\telse\n\t\t\t\t\t\tthis.value = new SubscriptionMapWithSubscription(this.publicationName!, this.params!, handleSubscription, false) as SubscriptionValue<T>;\n\t\t\t\t\tbreak;\n\t\t\t\t} default: {\n\t\t\t\t\tconst handleSubscription = this.#handleSubscription as HandleSubscription<\"object\">;\n\t\t\t\t\tif (this.value)\n\t\t\t\t\t\t(this.value as SubscriptionObjectWithSubscription)[setHandleUpdateSymbol](handleSubscription);\n\t\t\t\t\telse\n\t\t\t\t\t\tthis.value = new SubscriptionObjectWithSubscription(this.publicationName!, this.params!, handleSubscription, false) as SubscriptionValue<T>;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tthis.group.values.push(this.value);\n\t\t\tthis.group.values[this.name] = this.value;\n\t\t\t\n\t\t\tif (this.onBeforeInit)\n\t\t\t\tswitch (this.type) {\n\t\t\t\t\tcase \"array\":\n\t\t\t\t\t\t(this.onBeforeInit as SubscriptionOnBeforeInit<\"array\">).call(this.group, this.value as SubscriptionArrayWithSubscription);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"map\":\n\t\t\t\t\t\t(this.onBeforeInit as SubscriptionOnBeforeInit<\"map\">).call(this.group, this.value as SubscriptionMapWithSubscription);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\t(this.onBeforeInit as SubscriptionOnBeforeInit<\"object\">).call(this.group, this.value as SubscriptionObjectWithSubscription);\n\t\t\t\t}\n\t\t}\n\t\t\n\t}\n\t\n\tdetach() {\n\t\t\n\t\tif (this.group) {\n\t\t\tthis.value?.[unsubscribeSymbol]();\n\t\t\t\n\t\t\tthis.isLoaded = false;\n\t\t\tthis.#unload();\n\t\t\t\n\t\t\tdelete this.group.values[this.name];\n\t\t\tremoveOne(this.group.values, this.value);\n\t\t\tdelete this.group.items[this.name];\n\t\t\tremoveOne(this.group.items, this);\n\t\t\t\n\t\t\tdelete this.group;\n\t\t}\n\t\t\n\t}\n\t\n\t#loadUpdated: null | SubscriptionUpdated<T> = null;\n\t\n\t#handleSubscription: HandleSubscription<T> = (_, updated, updates) => {\n\t\tif (updates)\n\t\t\tif (this.group!.isLoaded) {\n\t\t\t\tif (this.handle)\n\t\t\t\t\tswitch (this.type) {\n\t\t\t\t\t\tcase \"array\":\n\t\t\t\t\t\t\t(this.handle as SubscriptionHandle<\"array\">).call(this.group!, updated as SubscriptionArrayUpdated, this.group!);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"map\":\n\t\t\t\t\t\t\t(this.handle as SubscriptionHandle<\"map\">).call(this.group!, updated as SubscriptionMapUpdated, this.group!);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t(this.handle as SubscriptionHandle<\"object\">).call(this.group!, updated as SubscriptionObjectUpdated, this.group!);\n\t\t\t\t\t}\n\t\t\t\tthis.emitUpdate(updated);\n\t\t\t} else {\n\t\t\t\tthis.#loadUpdated = updated;\n\t\t\t\tthis.isLoaded = true;\n\t\t\t\tprivates.groupLoad!(this.group!);\n\t\t\t}\n\t\telse if (this.isLoaded) {\n\t\t\tthis.isLoaded = false;\n\t\t\tprivates.groupUnload!(this.group!);\n\t\t}\n\t\t\n\t\tif (!this.isInited) {\n\t\t\tthis.isInited = true;\n\t\t\tprivates.groupInit!(this.group!);\n\t\t}\n\t\t\n\t};\n\t\n\t#load() {\n\t\t\n\t\tif (this.#loadUpdated) {\n\t\t\tif (this.handle)\n\t\t\t\tswitch (this.type) {\n\t\t\t\t\tcase \"array\":\n\t\t\t\t\t\t(this.handle as SubscriptionHandle<\"array\">).call(this.group!, this.#loadUpdated as SubscriptionArrayUpdated, this.group!);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"map\":\n\t\t\t\t\t\t(this.handle as SubscriptionHandle<\"map\">).call(this.group!, this.#loadUpdated as SubscriptionMapUpdated, this.group!);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\t(this.handle as SubscriptionHandle<\"object\">).call(this.group!, this.#loadUpdated as SubscriptionObjectUpdated, this.group!);\n\t\t\t\t}\n\t\t\t\n\t\t\tthis.#loadUpdated = null;\n\t\t\t\n\t\t\tthis.emit(\"load\", this.value);\n\t\t\t\n\t\t\tthis.#loadPromise.resolve(this);\n\t\t\t\n\t\t\tif (this.#unloadPromise.isFulfilled)\n\t\t\t\tthis.#unloadPromise = new StatefulPromise();\n\t\t}\n\t\t\n\t}\n\t\n\t#init() {\n\t\t\n\t\tthis.emit(\"init\", this.value);\n\t\t\n\t\tthis.#initPromise.resolve(this);\n\t\t\n\t}\n\t\n\t#unload() {\n\t\t\n\t\tif (this.handle)\n\t\t\tswitch (this.type) {\n\t\t\t\tcase \"array\":\n\t\t\t\t\t(this.handle as SubscriptionHandle<\"array\">).call(this.group!, null, this.group!);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"map\":\n\t\t\t\t\t(this.handle as SubscriptionHandle<\"map\">).call(this.group!, null, this.group!);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\t(this.handle as SubscriptionHandle<\"object\">).call(this.group!, null, this.group!);\n\t\t\t}\n\t\t\n\t\tthis.emit(\"unload\", this.value);\n\t\t\n\t\tthis.#unloadPromise.resolve(this);\n\t\t\n\t\tif (this.#loadPromise.isFulfilled)\n\t\t\tthis.#loadPromise = new StatefulPromise();\n\t\t\n\t}\n\t\n\tloaded() {\n\t\treturn this.#loadPromise;\n\t}\n\t\n\tinited() {\n\t\treturn this.#initPromise;\n\t}\n\t\n\tunloaded() {\n\t\treturn this.#unloadPromise;\n\t}\n\t\n\tsubscribe() {\n\t\treturn this.value?.[subscribeSymbol]();\n\t}\n\t\n\tunsubscribe() {\n\t\treturn this.value?.[unsubscribeSymbol]();\n\t}\n\t\n\trenew(publicationName: Definition<T>[\"publicationName\"], params: Definition<T>[\"params\"]) {\n\t\treturn this.value?.[renewSymbol](publicationName, params);\n\t}\n\t\n\tvalueOf() {\n\t\treturn this.value;\n\t}\n\t\n\t\n\tstatic debounceLimit = 4;\n\t\n\tstatic {\n\t\t\n\t\tprivates.itemLoad = <\n\t\t\tDP extends Definition<TP>,\n\t\t\tTP extends SubscriptionType\n\t\t>(item: SubscriptionGroupItem<TP, DP>) => item.#load();\n\t\tprivates.itemInit = <\n\t\t\tDP extends Definition<TP>,\n\t\t\tTP extends SubscriptionType\n\t\t>(item: SubscriptionGroupItem<TP, DP>) => item.#init();\n\t\tprivates.itemUnload = <\n\t\t\tDP extends Definition<TP>,\n\t\t\tTP extends SubscriptionType\n\t\t>(item: SubscriptionGroupItem<TP, DP>) => item.#unload();\n\t\t\n\t}\n\t\n}\n", "import { removeOne } from \"@nesvet/n\";\nimport { Subscription } from \"./Subscription\";\nimport {\n\tclearSymbol,\n\tgetAsInitialUpdatedSymbol,\n\tgetAsUpdatesSymbol,\n\tgetHandleUpdateSymbol,\n\tgetSubscriptionSymbol,\n\trenewSymbol,\n\tsetHandleUpdateSymbol,\n\tsubscribeSymbol,\n\tunsubscribeSymbol,\n\tupdateSymbol\n} from \"./symbols\";\n\n\ntype GenericItem = { _id: string } & Record<string, any>;// eslint-disable-line @typescript-eslint/no-explicit-any\n\ntype Item = GenericItem | SubscriptionMapItem;\n\ntype Updated<I extends Item = Item> = {\n\tdeleted: string[];\n\tadded: I[];\n} & I[];\n\ntype SortList = Record<string, -1 | 1>;\n\nexport type Updates<I extends Item = Item> =\n\t(\n\t\t[ \"c\"/* create */, item: I ] |\n\t\t[ \"d\"/* delete */, _id: string ] |\n\t\t[ \"i\"/* initial */, items: I[], sortList?: SortList ] |\n\t\t[ \"u\"/* update */, itemUpdates: { _id: string } & Partial<I>, isAtomicOrUpdatedFields: string[] | true ] |\n\t\tnull\n\t)[] |\n\tnull;\n\ntype UpdateHandler<I extends Item = Item> = (map: SubscriptionMap<I>, updated: Updated<I>, updates: Updates<I>) => void;\n\ndeclare global {\n\tvar __insite_subscription_map_sort_function: ((a: Item, b: Item) => -1 | 0 | 1) | undefined;// eslint-disable-line no-var\n}\n\nfunction createSortFunction(sortList: SortList) {\n\t\n\tconst tempScript = document.createElement(\"script\");\n\t\n\ttempScript.textContent = `window.__insite_subscription_map_sort_function = function sort(a, b) { return ${\n\t\tObject.entries(sortList)\n\t\t\t.map(([ key, value ]) => value > 0 ? `a.${key} > b.${key} ? 1 : a.${key} < b.${key} ? -1 :` : `a.${key} < b.${key} ? 1 : a.${key} > b.${key} ? -1 :`)\n\t\t\t.concat(\"0\")\n\t\t\t.join(\" \")\n\t};}`;\n\t\n\tdocument.head.append(tempScript);\n\t\n\tconst sortFunction = window.__insite_subscription_map_sort_function!;\n\t\n\ttempScript.remove();\n\tdelete window.__insite_subscription_map_sort_function;\n\t\n\treturn sortFunction;\n}\n\n// function createSortFunction(sortList: SortList) {\n// return new Function(// eslint-disable-line no-new-func\n// \t\t\"a\"/* Item */,\n// \t\t\"b\"/* Item */,\n// \t\t`return ${\n// \t\t\tObject.entries(sortList)\n// \t\t\t\t.map(([ key, value ]) => value > 0 ? `a.${key} > b.${key} ? 1 : a.${key} < b.${key} ? -1 :` : `a.${key} < b.${key} ? 1 : a.${key} > b.${key} ? -1 :`)\n// \t\t\t\t.concat(\"0\")\n// \t\t\t\t.join(\" \")\n// \t\t}`\n// \t) as (a: Item, b: Item) => -1 | 0 | 1;\n// }\n\n\nexport class SubscriptionMap<I extends Item = Item> extends Map<string, I> {\n\tconstructor(updates?: Updates<I>, onUpdate?: UpdateHandler<I>) {\n\t\tsuper();\n\t\t\n\t\tif (onUpdate)\n\t\t\tthis.handleUpdate = onUpdate;\n\t\t\n\t\tif (updates)\n\t\t\tthis.update(updates);\n\t\t\n\t}\n\t\n\thandleUpdate;\n\t\n\tprivate updates = new Map();\n\t\n\tsortList: null | SortList = null;\n\t\n\tsortCompareFunction: ((a: I, b: I) => number) | null = null;\n\t\n\tprivate fieldsToSort: string[] = [];\n\t\n\tsorted: I[] = [];\n\t\n\tsort() {\n\t\t\n\t\tif (this.sortCompareFunction)\n\t\t\tthis.sorted.sort(this.sortCompareFunction);\n\t\t\n\t}\n\t\n\t[getHandleUpdateSymbol]() {\n\t\treturn this.handleUpdate;\n\t}\n\t\n\t[setHandleUpdateSymbol](handleUpdate: UpdateHandler<I>) {\n\t\treturn (this.handleUpdate = handleUpdate);\n\t}\n\t\n\tprivate TheItem!: { new (map: SubscriptionMap<I>, updates: GenericItem): I };\n\t\n\tset Item(TheItem: { new (map: SubscriptionMap<I>, updates: GenericItem): I }) {\n\t\tthis.TheItem = TheItem;\n\t\t\n\t\tif (this.size)\n\t\t\tfor (const [ _id, item ] of this)\n\t\t\t\tthis.set(_id, new TheItem(this, item));\n\t\t\n\t}\n\t\n\tget Item() {\n\t\treturn this.TheItem;\n\t}\n\t\n\tupdate(updates: Updates<I>) {\n\t\t\n\t\tconst updated: Updated<I> = Object.assign([], {\n\t\t\tadded: [],\n\t\t\tdeleted: []\n\t\t});\n\t\t\n\t\tif (updates) {\n\t\t\tlet shouldSort = false;\n\t\t\t\n\t\t\tconst TheItem = this.TheItem;// eslint-disable-line prefer-destructuring\n\t\t\tconst prevUpdates = this.updates;\n\t\t\t\n\t\t\tfor (const update of updates)\n\t\t\t\tswitch (update?.[0]) {\n\t\t\t\t\tcase \"i\"/* initial */: {\n\t\t\t\t\t\tconst [ , array, sortList ] = update;\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (sortList) {\n\t\t\t\t\t\t\tthis.sortList = sortList;\n\t\t\t\t\t\t\tthis.sortCompareFunction = createSortFunction(sortList);\n\t\t\t\t\t\t\tthis.fieldsToSort = [ ...new Set(Object.keys(sortList).map(key => key.replace(/\\..+/, \"\"))) ];\n\t\t\t\t\t\t\tshouldSort = true;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthis.sortList = null;\n\t\t\t\t\t\t\tthis.sortCompareFunction = null;\n\t\t\t\t\t\t\tthis.fieldsToSort = [];\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (this.size) {\n\t\t\t\t\t\t\tconst updatesMap = new Map();\n\t\t\t\t\t\t\tfor (const itemUpdates of array)\n\t\t\t\t\t\t\t\tupdatesMap.set(itemUpdates._id, itemUpdates);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tfor (const [ _id, item ] of this) {\n\t\t\t\t\t\t\t\tconst itemUpdates = updatesMap.get(_id);\n\t\t\t\t\t\t\t\tif (itemUpdates) {\n\t\t\t\t\t\t\t\t\tconst prevItemUpdates = prevUpdates.get(_id);\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tif (TheItem)\n\t\t\t\t\t\t\t\t\t\titem.update(itemUpdates);\n\t\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\t\tfor (const key in prevItemUpdates)// eslint-disable-line guard-for-in\n\t\t\t\t\t\t\t\t\t\t\tdelete item[key as keyof typeof item];\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\tObject.assign(item, itemUpdates);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tprevUpdates.set(_id, itemUpdates);\n\t\t\t\t\t\t\t\t\tupdated.push(item);\n\t\t\t\t\t\t\t\t\tupdatesMap.delete(_id);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tif (TheItem)\n\t\t\t\t\t\t\t\t\t\titem.delete();\n\t\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t\tthis.delete(_id);\n\t\t\t\t\t\t\t\t\tprevUpdates.delete(_id);\n\t\t\t\t\t\t\t\t\tupdated.deleted.push(_id);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tfor (const [ _id, itemUpdates ] of updatesMap) {\n\t\t\t\t\t\t\t\tconst item = TheItem ? new TheItem(this, itemUpdates) : { ...itemUpdates };\n\t\t\t\t\t\t\t\tthis.set(_id, item);\n\t\t\t\t\t\t\t\tprevUpdates.set(_id, itemUpdates);\n\t\t\t\t\t\t\t\tupdated.push(item);\n\t\t\t\t\t\t\t\tupdated.added.push(item);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif (this.sortList)\n\t\t\t\t\t\t\t\tthis.sorted = array.map(newItem => this.get(newItem._id)!);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else\n\t\t\t\t\t\t\tfor (const itemUpdates of array) {\n\t\t\t\t\t\t\t\tconst item = (TheItem ? new TheItem(this, itemUpdates) : { ...itemUpdates }) as I;\n\t\t\t\t\t\t\t\tthis.set(item._id, item);\n\t\t\t\t\t\t\t\tthis.sorted.push(item);\n\t\t\t\t\t\t\t\tprevUpdates.set(item._id, itemUpdates);\n\t\t\t\t\t\t\t\tupdated.push(item);\n\t\t\t\t\t\t\t\tupdated.added.push(item);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tcase \"c\"/* create */:\n\t\t\t\t\tcase \"u\"/* update */: {\n\t\t\t\t\t\tlet [ , itemUpdates ] = update;\n\t\t\t\t\t\tlet item = this.get(itemUpdates._id);\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (item) {\n\t\t\t\t\t\t\tconst isAtomic = update[2] === true;\n\t\t\t\t\t\t\tconst updatedFields = isAtomic ? Object.keys(itemUpdates) : update[2] as string[];\n\t\t\t\t\t\t\tconst prevItemUpdates = prevUpdates.get(item._id);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif (TheItem)\n\t\t\t\t\t\t\t\titem.update(itemUpdates);\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tif (!isAtomic)\n\t\t\t\t\t\t\t\t\tfor (const key in prevItemUpdates)// eslint-disable-line guard-for-in\n\t\t\t\t\t\t\t\t\t\tdelete item[key as keyof typeof item];\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tObject.assign(item, itemUpdates);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif (isAtomic)\n\t\t\t\t\t\t\t\titemUpdates = Object.assign(prevItemUpdates, itemUpdates);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif (this.sortList && !shouldSort && (!updatedFields || updatedFields.some(fieldName => this.fieldsToSort.includes(fieldName))))\n\t\t\t\t\t\t\t\tshouldSort = true;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\titem = (TheItem ? new TheItem(this, itemUpdates) : { ...itemUpdates }) as I;\n\t\t\t\t\t\t\tthis.set(item._id, item);\n\t\t\t\t\t\t\tthis.sorted.push(item);\n\t\t\t\t\t\t\tif (this.sortList)\n\t\t\t\t\t\t\t\tshouldSort = true;\n\t\t\t\t\t\t\tupdated.added.push(item);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tprevUpdates.set(item._id, itemUpdates);\n\t\t\t\t\t\tupdated.push(item);\n\t\t\t\t\t\t\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tcase \"d\"/* delete */: {\n\t\t\t\t\t\tconst [ , _id ] = update;\n\t\t\t\t\t\tconst itemToDelete = this.get(_id);\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (itemToDelete) {\n\t\t\t\t\t\t\tif (TheItem)\n\t\t\t\t\t\t\t\titemToDelete.delete();\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tthis.delete(_id);\n\t\t\t\t\t\t\tprevUpdates.delete(_id);\n\t\t\t\t\t\t\tremoveOne(this.sorted, itemToDelete);\n\t\t\t\t\t\t\tupdated.deleted.push(_id);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tthis.clear();\n\t\t\t\t}\n\t\t\t\n\t\t\tif (shouldSort)\n\t\t\t\tthis.sort();\n\t\t\t\n\t\t} else\n\t\t\tthis.clear();\n\t\t\n\t\tthis.handleUpdate?.(this, updated, updates?.[0] ? updates : null);\n\t\t\n\t\treturn this;\n\t}\n\t\n\t[updateSymbol] = this.update;\n\t\n\tgetAsUpdates() {\n\t\treturn (\n\t\t\t(this.size || this.sortList) ?\n\t\t\t\t[ [ \"i\"/* initial */, [ ...this.updates.values() ], this.sortList ] ] :\n\t\t\t\tnull\n\t\t);\n\t}\n\t\n\t[getAsUpdatesSymbol] = this.getAsUpdates;\n\t\n\tgetAsInitialUpdated() {\n\t\treturn Object.assign([ ...this.sorted ], {\n\t\t\tadded: [ ...this.sorted ],\n\t\t\tdeleted: []\n\t\t});\n\t}\n\t\n\t[getAsInitialUpdatedSymbol] = this.getAsInitialUpdated;\n\t\n\tclear() {\n\t\t\n\t\tsuper.clear();\n\t\tthis.updates.clear();\n\t\tthis.sorted = [];\n\t\tthis.sortList = null;\n\t\tthis.sortCompareFunction = null;\n\t\tthis.fieldsToSort = [];\n\t\t\n\t}\n\t\n\t[clearSymbol] = this.clear;\n\t\n\tvalueOf() {\n\t\treturn this.sorted;\n\t}\n\t\n\tget [Symbol.toStringTag]() {\n\t\treturn \"SubscriptionMap\";\n\t}\n\t\n\t\n\tstatic updateSymbol = updateSymbol;\n\tstatic getHandleUpdateSymbol = getHandleUpdateSymbol;\n\tstatic setHandleUpdateSymbol = setHandleUpdateSymbol;\n\tstatic getAsUpdatesSymbol = getAsUpdatesSymbol;\n\tstatic getAsInitialUpdatedSymbol = getAsInitialUpdatedSymbol;\n\tstatic clearSymbol = clearSymbol;\n\tstatic WithSubscription: typeof SubscriptionMapWithSubscription;\n\tstatic Item: typeof SubscriptionMapItem;\n\t\n}\n\n\nexport class SubscriptionMapWithSubscription<I extends Item = Item> extends SubscriptionMap<I> {\n\tconstructor(publicationName: string, params: unknown[], onUpdate: UpdateHandler<I>, immediately = true) {\n\t\tsuper(null, onUpdate);\n\t\t\n\t\tthis.publicationName = publicationName;\n\t\tthis.params = params;\n\t\t\n\t\tif (immediately)\n\t\t\tthis.subscribe();\n\t\t\n\t}\n\t\n\tpublicationName;\n\tparams;\n\t\n\tsubscription: null | Subscription = null;\n\t\n\tsubscribe() {\n\t\t\n\t\tif (!this.subscription)\n\t\t\tthis.subscription = new Subscription(\"map\", this.publicationName, this.params, updates => this.update(updates as Updates<I>));\n\t\t\n\t}\n\t\n\tget [subscribeSymbol]() {\n\t\treturn this.subscribe;\n\t}\n\t\n\tunsubscribe() {\n\t\t\n\t\tif (this.subscription) {\n\t\t\tthis.subscription.cancel();\n\t\t\tthis.subscription = null;\n\t\t}\n\t\t\n\t}\n\t\n\tget [unsubscribeSymbol]() {\n\t\treturn this.unsubscribe;\n\t}\n\t\n\trenew(publicationName?: string, params?: unknown[]) {\n\t\t\n\t\tif (this.subscription) {\n\t\t\tthis.unsubscribe();\n\t\t\t\n\t\t\tif (publicationName)\n\t\t\t\tif (Array.isArray(publicationName))\n\t\t\t\t\tparams = publicationName;\n\t\t\t\telse\n\t\t\t\t\tthis.publicationName = publicationName;\n\t\t\t\n\t\t\tif (params)\n\t\t\t\tthis.params = params;\n\t\t\t\n\t\t\tthis.subscribe();\n\t\t}\n\t\t\n\t}\n\t\n\tget [renewSymbol]() {\n\t\treturn this.renew;\n\t}\n\t\n\t[getSubscriptionSymbol]() {\n\t\treturn this.subscription;\n\t}\n\t\n\tget [Symbol.toStringTag]() {\n\t\treturn \"SubscriptionMapWithSubscription\";\n\t}\n\t\n\t\n\tstatic subscribeSymbol = subscribeSymbol;\n\tstatic unsubscribeSymbol = unsubscribeSymbol;\n\tstatic renewSymbol = renewSymbol;\n\tstatic getSubscriptionSymbol = getSubscriptionSymbol;\n\t\n}\n\nSubscriptionMap.WithSubscription = SubscriptionMapWithSubscription;\n\n\nexport class SubscriptionMapItem {\n\tconstructor(map: SubscriptionMap, updates: GenericItem) {\n\t\tthis.map = map;\n\t\t\n\t\tthis.update(updates);\n\t\t\n\t}\n\t\n\t_id!: string;\n\t\n\tprivate map;\n\t\n\tupdate(updates: GenericItem) {\n\t\tObject.assign(this, updates);\n\t\t\n\t}\n\t\n\tdelete() {\n\t\t\n\t\tthis.map.delete(this._id);\n\t\t\n\t}\n\t\n}\n\nSubscriptionMap.Item = SubscriptionMapItem;\n\nexport { Updated as SubscriptionMapUpdated };\n", "import { Subscription } from \"./Subscription\";\nimport {\n\tclearSymbol,\n\tgetAsInitialUpdatedSymbol,\n\tgetAsUpdatesSymbol,\n\tgetHandleUpdateSymbol,\n\tgetSubscriptionSymbol,\n\trenewSymbol,\n\tsetHandleUpdateSymbol,\n\tsubscribeSymbol,\n\tunsubscribeSymbol,\n\tupdateSymbol\n} from \"./symbols\";\n\n\nconst handleUpdateSymbol = Symbol(\"handleUpdate\");\nconst updatesSymbol = Symbol(\"updates\");\n\nexport type Updated = Record<string, unknown>;\nexport type Updates = null | Record<string, unknown>;\ntype UpdateHandler = (object: SubscriptionObject, updated: Updated, updates: Updates) => void;\n\n\nexport class SubscriptionObject {\n\tconstructor(updates?: Updates, onUpdate?: UpdateHandler) {\n\t\tif (onUpdate)\n\t\t\tthis[handleUpdateSymbol] = onUpdate;\n\t\t\n\t\tif (updates)\n\t\t\tthis[updateSymbol](updates);\n\t\t\n\t}\n\t\n\t[handleUpdateSymbol]?: UpdateHandler;\n\t\n\t[updatesSymbol]: Updates = null;\n\t\n\t[getHandleUpdateSymbol]() {\n\t\treturn this[handleUpdateSymbol];\n\t}\n\t\n\t[setHandleUpdateSymbol](handleUpdate: UpdateHandler) {\n\t\treturn (this[handleUpdateSymbol] = handleUpdate);\n\t}\n\t\n\t[updateSymbol](updates: Updates) {\n\t\tif (updates) {\n\t\t\tfor (const key in this[updatesSymbol])// eslint-disable-line guard-for-in\n\t\t\t\tdelete this[key];\n\t\t\tfor (const key in updates)// eslint-disable-line guard-for-in\n\t\t\t\tthis[key] = updates[key];\n\t\t\tthis[updatesSymbol] = updates;\n\t\t} else\n\t\t\tthis[clearSymbol]();\n\t\t\n\t\tthis[handleUpdateSymbol]?.(this, this, this[updatesSymbol]);\n\t\t\n\t\treturn this;\n\t}\n\t\n\t[getAsUpdatesSymbol]() {\n\t\treturn this[updatesSymbol] && { ...this[updatesSymbol] };\n\t}\n\t\n\t[getAsInitialUpdatedSymbol]() {\n\t\treturn this.valueOf();\n\t}\n\t\n\t[clearSymbol]() {\n\t\t\n\t\tfor (const key in this)// eslint-disable-line guard-for-in\n\t\t\tdelete this[key];\n\t\tthis[updatesSymbol] = null;\n\t\t\n\t}\n\t\n\tvalueOf() {\n\t\treturn this[updatesSymbol] && this;\n\t}\n\t\n\tget [Symbol.toStringTag]() {\n\t\treturn \"SubscriptionObject\";\n\t}\n\t\n\t[key: string]: unknown;\n\t\n\t\n\tstatic updateSymbol = updateSymbol;\n\tstatic getHandleUpdateSymbol = getHandleUpdateSymbol;\n\tstatic setHandleUpdateSymbol = setHandleUpdateSymbol;\n\tstatic getAsUpdatesSymbol = getAsUpdatesSymbol;\n\tstatic getAsInitialUpdatedSymbol = getAsInitialUpdatedSymbol;\n\tstatic clearSymbol = clearSymbol;\n\tstatic WithSubscription: typeof SubscriptionObjectWithSubscription;\n\t\n}\n\n\nexport class SubscriptionObjectWithSubscription extends SubscriptionObject {\n\tconstructor(publicationName: string, params: unknown[], onUpdate: UpdateHandler, immediately = true) {\n\t\tsuper(null, onUpdate);\n\t\t\n\t\tthis.publicationName = publicationName;\n\t\tthis.params = params;\n\t\t\n\t\tif (immediately)\n\t\t\tthis[subscribeSymbol]();\n\t\t\n\t}\n\t\n\tprivate publicationName;\n\tprivate params;\n\tprivate subscription: null | Subscription = null;\n\t\n\t[subscribeSymbol]() {\n\t\t\n\t\tif (!this.subscription)\n\t\t\tthis.subscription = new Subscription(\"object\", this.publicationName, this.params, updates => this[updateSymbol](updates as Updates));\n\t\t\n\t}\n\t\n\t[unsubscribeSymbol]() {\n\t\t\n\t\tif (this.subscription) {\n\t\t\tthis.subscription.cancel();\n\t\t\tthis.subscription = null;\n\t\t}\n\t\t\n\t}\n\t\n\t[renewSymbol](publicationName?: string, params?: unknown[]) {\n\t\t\n\t\tif (this.subscription) {\n\t\t\tthis[unsubscribeSymbol]();\n\t\t\t\n\t\t\tif (publicationName)\n\t\t\t\tif (Array.isArray(publicationName))\n\t\t\t\t\tparams = publicationName;\n\t\t\t\telse\n\t\t\t\t\tthis.publicationName = publicationName;\n\t\t\t\n\t\t\tif (params)\n\t\t\t\tthis.params = params;\n\t\t\t\n\t\t\tthis[subscribeSymbol]();\n\t\t}\n\t\t\n\t}\n\t\n\t[getSubscriptionSymbol]() {\n\t\treturn this.subscription;\n\t}\n\t\n\tget [Symbol.toStringTag]() {\n\t\treturn \"SubscriptionObjectWithSubscription\";\n\t}\n\t\n\t\n\tstatic subscribeSymbol = subscribeSymbol;\n\tstatic unsubscribeSymbol = unsubscribeSymbol;\n\tstatic renewSymbol = renewSymbol;\n\tstatic getSubscriptionSymbol = getSubscriptionSymbol;\n\t\n}\n\nSubscriptionObject.WithSubscription = SubscriptionObjectWithSubscription;\n\nexport { Updated as SubscriptionObjectUpdated };\n"],
|
|
5
|
+
"mappings": "oiBAWA,IAAIA,GACAC,EACAC,EAGSC,EAAN,KAAmB,CACzB,YAAYC,EAAkCC,EAAyBC,EAAkB,CAAC,EAAGC,EAAiCC,EAAc,GAAM,CA2BlJC,EAAA,UACAA,EAAA,aACAA,EAAA,wBACAA,EAAA,aACAA,EAAA,gBACAA,EAAA,oBACAA,EAAA,iBAEAA,EAAA,aAAQ,IAAM,CAEbP,EAAG,YAAY,MAAmC,KAAK,KAAM,KAAK,gBAAiB,KAAK,EAAG,KAAK,KAAM,KAAK,WAAW,EAEtH,KAAK,YAAc,EAEpB,GAvCC,GAAI,CAACA,EACJ,MAAM,IAAI,MAAM,oEAAoE,EAErF,KAAK,EAAIF,KACT,KAAK,KAAOI,EACZ,KAAK,gBAAkBC,EACvB,KAAK,KAAOC,EACZ,KAAK,QAAUC,EACf,KAAK,YAAcC,GAAe,CAAC,OAAO,WAE1CP,EAAc,I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IAAAC,EAuTqD,OAAAN,EAAAM,EAAAD,EAAM5B,EAAAE,IAAN,KAAA2B,IACnDF,EAAS,YAAeC,GAA0B,CAxTpD,IAAAC,EAwTuD,OAAAN,EAAAM,EAAAD,EAAM5B,EAAAG,IAAN,KAAA0B,IAnPhD,IAAMC,GAAN1B",
|
|
6
6
|
"names": ["i", "subscriptions", "ws", "Subscription", "type", "publicationName", "args", "handler", "immediately", "__publicField", "_ws", "si", "updates", "subscription", "removeOne", "updateSymbol", "getHandleUpdateSymbol", "setHandleUpdateSymbol", "getAsUpdatesSymbol", "getAsInitialUpdatedSymbol", "clearSymbol", "subscribeSymbol", "unsubscribeSymbol", "renewSymbol", "getSubscriptionSymbol", "getHandleSubscriptionSymbol", "setHandleSubscriptionSymbol", "ascSort", "a", "b", "descSort", "_a", "_b", "_c", "_d", "SubscriptionArray", "updates", "onUpdate", "__publicField", "getHandleUpdateSymbol", "setHandleUpdateSymbol", "handleUpdate", "updated", "shouldSort", "update", "array", "sort", "newItem", "itemToDelete", "removeOne", "updateSymbol", "getAsUpdatesSymbol", "getAsInitialUpdatedSymbol", "clearSymbol", "SubscriptionArrayWithSubscription", "publicationName", "params", "immediately", "Subscription", "subscribeSymbol", "unsubscribeSymbol", "renewSymbol", "getSubscriptionSymbol", "EventEmitter", "debounce", "StatefulPromise", "privates", "EventEmitter", "debounce", "removeOne", "StatefulPromise", "removeOne", "createSortFunction", "sortList", "tempScript", "key", "value", "sortFunction", "_a", "_b", "_c", "_d", "SubscriptionMap", "updates", "onUpdate", "__publicField", "getHandleUpdateSymbol", "setHandleUpdateSymbol", "handleUpdate", "TheItem", "_id", "item", "updated", "shouldSort", "prevUpdates", "update", "array", "updatesMap", "itemUpdates", "prevItemUpdates", "newItem", "isAtomic", "updatedFields", "fieldName", "itemToDelete", "removeOne", "updateSymbol", "getAsUpdatesSymbol", "getAsInitialUpdatedSymbol", "clearSymbol", "SubscriptionMapWithSubscription", "publicationName", "params", "immediately", "Subscription", "subscribeSymbol", "unsubscribeSymbol", "renewSymbol", "getSubscriptionSymbol", "SubscriptionMapItem", "map", "handleUpdateSymbol", "updatesSymbol", "_a", "_b", "SubscriptionObject", "updates", "onUpdate", "__publicField", "updateSymbol", "getHandleUpdateSymbol", "setHandleUpdateSymbol", "handleUpdate", "key", "clearSymbol", "getAsUpdatesSymbol", "getAsInitialUpdatedSymbol", "SubscriptionObjectWithSubscription", "publicationName", "params", "immediately", "subscribeSymbol", "Subscription", "unsubscribeSymbol", "renewSymbol", "getSubscriptionSymbol", "isUpdatedMapOrArray", "updated", "_loadPromise", "_initPromise", "_unloadPromise", "_SubscriptionGroupItem_instances", "applyOptions_fn", "attachTo_fn", "_loadUpdated", "_handleSubscription", "load_fn", "init_fn", "unload_fn", "_SubscriptionGroupItem", "EventEmitter", "definition", "group", "__privateAdd", "__publicField", "_", "updates", "__privateSet", "privates", "value", "type", "publicationName", "params", "handle", "onBeforeInit", "debounceLimit", "preventBind", "__privateMethod", "unsubscribeSymbol", "removeOne", "__privateGet", "subscribeSymbol", "renewSymbol", "emitUpdate", "debouncedUpdated", "emitUpdateDebounced", "debounce", "isDetached", "item", "StatefulPromise", "handleSubscription", "setHandleUpdateSymbol", "SubscriptionArrayWithSubscription", "SubscriptionMapWithSubscription", "SubscriptionObjectWithSubscription", "_a", "SubscriptionGroupItem", "isTupleDefinition", "definition", "parseDefinition", "args", "parsed", "_loadPromise", "_initPromise", "_unloadPromise", "_debounceLimit", "_SubscriptionGroup_instances", "load_fn", "init_fn", "unload_fn", "_SubscriptionGroup", "EventEmitter", "definitions", "target", "debounceLimit", "immediately", "__privateAdd", "__publicField", "__privateSet", "StatefulPromise", "item", "__privateGet", "emitUpdateDebounced", "debounce", "shouldReload", "SubscriptionGroupItem", "names", "shouldUpdate", "name", "__privateMethod", "itemsToDetach", "definitionsToRedefine", "definitionsToAttach", "privates", "group", "_a", "SubscriptionGroup"]
|
|
7
7
|
}
|