insite-config 2.2.2 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/index.js.map +4 -4
- package/package.json +32 -32
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function
|
|
1
|
+
function g(){}var O=new WeakMap,S=class r extends Promise{constructor(n,t){let i,f;if(super((s,a)=>{i=s,f=a}),O.set(this,{resolve:i,reject:f}),t?.signal)if(t.signal.aborted)this.reject(new DOMException("Aborted","AbortError"));else{let s=()=>this.reject(new DOMException("Aborted","AbortError"));t.signal.addEventListener("abort",s),this.finally(()=>t.signal?.removeEventListener("abort",s))}if(typeof t?.timeout=="number"&&Number.isFinite(t.timeout)){let s=setTimeout(()=>this.reject(new DOMException("Timeout exceeded","TimeoutError")),t.timeout);this.finally(()=>clearTimeout(s))}n?.(this.resolve,this.reject)}isPending=!0;isFulfilled=!1;isRejected=!1;state="pending";result;resolve=n=>{if(this.isPending){this.isPending=!1,this.isFulfilled=!0,this.state="fulfilled",this.result=n;let t=O.get(this);t&&(t.resolve.call(this,n),O.delete(this))}};reject=n=>{if(this.isPending){this.isPending=!1,this.isRejected=!0,this.state="rejected",this.result=n;let t=O.get(this);t&&(t.reject.call(this,n),O.delete(this))}};static resolved(n){return new r(t=>t(n))}static rejected(n){return new r((t,i)=>i(n))}};function A(r,n=0,t={}){let{leading:i=!1,trailing:f=!0}=t,{maxWait:s=1/0}=t,a,m,I,e,u,c,o,l,p=async()=>{let x=Date.now();x>=I?(a=void 0,I=void 0,clearTimeout(m),m=void 0,typeof o=="function"&&await o(),d.resolve(l),c=i):(clearTimeout(a),a=setTimeout(p,I-x))},h=Number.isFinite(s)?()=>{o===w&&(o=!1),w(),m=setTimeout(h,s)}:null;async function w(){try{return l=await r.apply(e,u),l}catch(x){throw d.reject(x),x}}i&&typeof i=="boolean"&&(i=w),c=i,f&&typeof f=="boolean"&&(f=w),o=f;let d=Object.assign(function(...x){return u=x,e=this,I=Date.now()+n,o=f,d.promise.isPending||(d.promise=new S((E,D)=>{d.resolve=E,d.reject=D,typeof c=="function"&&(c(),c=!1,o===w&&(o=!1)),a||(a=setTimeout(p,n),h&&(m=setTimeout(h,s)))})),d.promise},{callback:r,promise:S.resolved(void 0),resolve:g,reject:g,run:w,clear:async x=>{clearTimeout(a),a=void 0,clearTimeout(m),m=void 0,d.resolve(x?await w():l)}});return d}A.noop=Object.assign(()=>{},{callback:g,promise:S.resolved(void 0),resolve:g,reject:g,run:g,clear:g});function j(r){for(let n in r)return!1;return!0}function C(r,n,t,i,f=!0){return Array.isArray(r)&&(r=r.length),typeof i!="string"&&(f=i??!0,i=t),(f?`${r}\xA0`:"")+C.raw(r,n,t,i)}C.raw=(r,n,t,i=t)=>{r=Math.abs(r);let f=r%10,s=r%100;return f===1&&s!==11?n:f>=2&&f<=4&&!(s>=12&&s<=15)?t:i};function T(r,n){let t={};for(let i of n)i in r&&(t[i]=r[i]);return t}function k(r){return Object.entries(r)}function M(r){return Object.fromEntries(r)}var y="_u",v=Symbol("updatedAt");var b=class extends Error{constructor(n){super(`Unknown Config item "${n}"`)}name="UnknownConfigItemError"},$;async function jo(r,n,t){if(!$){let i=new Map,f=await r.ensure("config",t),s={addListener(e,u,c){let o=this[e];if(o)c&&u.call(o,o,{...o}),i.get(o)?.add(u)??i.set(o,new Set([u]));else throw new b(e)},removeListener(e,u){let c=this[e];if(c)i.get(c)?.delete(u);else throw new b(e)},async update(e,{[v]:u,...c}){let o=this[e];if(y in c&&delete c[y],o){if(!j(c)&&(!u||o[y]<u)){let l={};for(let[p,h]of Object.entries(c))p in o&&o[p]!==h&&(l[p]=h);if(!j(l)){u||(Object.assign(l,{[y]:Date.now()}),f.updateOne({_id:e},{$set:l}));let p=T(o,Object.keys(l));Object.assign(o,l);for(let h of i.get(o)??[])await h.call(o,l,p)}}return o}throw new b(e)}};s.on=s.addListener,s.off=s.removeListener,$=s;let a=new Map((await f.find().toArray()).map(({_id:e,...u})=>[e,u])),m=new Map,I=Date.now();for(let[e,u]of Object.entries(n)){let c=a.get(e),o={...M(k(u).map(([l,p])=>[l,c?.[l]??p])),[y]:c?.[y]??I};s[e]=o,m.set(e,o)}await f.bulkWrite([...[...m].map(([e,u])=>({replaceOne:{filter:{_id:e},replacement:{_id:e,...u},upsert:!0}})),...[...a.keys()].filter(e=>!n[e]).map(e=>({deleteOne:{filter:{_id:e}}}))]),f.onChange(e=>{switch(e.operationType){case"update":case"replace":{let{_id:u,[y]:c=Date.now(),...o}=e.operationType==="replace"?e.fullDocument:e.updateDescription.updatedFields;s.update(e.documentKey._id,{...o,[v]:c})}}})}return $}export{b as UnknownConfigItemError,jo as init};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../../@nesvet/npm/n/src/noop.ts", "../../../../@nesvet/npm/n/src/debounce.ts", "../../../../@nesvet/npm/n/src/isEmpty.ts", "../../../../@nesvet/npm/n/src/howmuch.ts", "../../../../@nesvet/npm/n/src/pick.ts", "../../../../@nesvet/npm/n/src/typeSafeObjectEntries.ts", "../../../../@nesvet/npm/n/src/typeSafeObjectFromEntries.ts", "../src/symbols.ts", "../src/init.ts"],
|
|
4
|
-
"sourcesContent": ["export function noop() { /**/ }\n", "import { noop } from \"./noop.js\";\n\n\ntype Callback<Result> = (...args: unknown[]) => Result;\ntype FunctionOrBoolean = (() => unknown) | boolean;\ntype Options = { leading?: FunctionOrBoolean; maxWait?: number; trailing?: FunctionOrBoolean };\ntype NumberOrUndefined = number | undefined;\n\ntype DebouncedFunction<Result> = {\n\t(this: unknown, ..._args: unknown[]): Promise<Result>;\n};\n\nexport type Debounced<Result> = {\n\tcallback: Callback<Result>;\n\tpromise: {\n\t\tisResolved: boolean;\n\t} & Promise<unknown>;\n\tresolve: (value: Result) => void;\n\trun(): Promise<Result>;\n\tclear(shouldRun?: boolean): Promise<void>;\n} & DebouncedFunction<Result>;\n\n\nexport function debounce<Result>(callback: Callback<Result>, limit = 0, options: Options = {}) {\n\tlet { leading = false, trailing = true } = options;\n\tconst { maxWait = Infinity } = options;\n\t\n\tlet timeout: NumberOrUndefined;\n\tlet maxWaitTimeout: NumberOrUndefined;\n\tlet end: NumberOrUndefined;\n\tlet context: unknown;\n\tlet args: unknown[];\n\tlet initial: FunctionOrBoolean;\n\tlet final: FunctionOrBoolean;\n\tlet result: Result;\n\t\n\tconst expired = async () => {\n\t\t\n\t\tconst n = Date.now();\n\t\t\n\t\tif (n >= end!) {\n\t\t\ttimeout = undefined;\n\t\t\tend = undefined;\n\t\t\tclearTimeout(maxWaitTimeout);\n\t\t\tif (typeof final == \"function\")\n\t\t\t\tawait final();\n\t\t\tdebounced.resolve(result);\n\t\t\tdebounced.promise.isResolved = true;\n\t\t\tinitial = leading;\n\t\t} else {\n\t\t\tclearTimeout(timeout);\n\t\t\ttimeout = setTimeout(expired, end! - n);\n\t\t}\n\t\t\n\t};\n\t\n\tconst maxWaitExpired = Number.isFinite(maxWait) ? () => {\n\t\t\n\t\tif (final === run)\n\t\t\tfinal = false;\n\t\trun();\n\t\tmaxWaitTimeout = setTimeout(maxWaitExpired as TimerHandler, maxWait);\n\t\t\n\t} : null;\n\t\n\tasync function run() {\n\t\treturn (result = await callback.apply(context, args));\n\t}\n\t\n\tif (leading && typeof leading == \"boolean\")\n\t\tleading = run;\n\tinitial = leading;\n\t\n\tif (trailing && typeof trailing == \"boolean\")\n\t\ttrailing = run;\n\tfinal = trailing;\n\t\n\tconst debounced: Debounced<Result> = Object.assign(function (..._args) {\n\t\targs = _args;\n\t\tcontext = this;// eslint-disable-line no-invalid-this\n\t\t\n\t\tend = Date.now() + limit;\n\t\tfinal = trailing;\n\t\t\n\t\tif (debounced.promise.isResolved)\n\t\t\tdebounced.promise = Object.assign(new Promise(resolve => {\n\t\t\t\tdebounced.resolve = resolve;\n\t\t\t\t\n\t\t\t\tif (typeof initial == \"function\") {\n\t\t\t\t\tinitial();\n\t\t\t\t\tinitial = false;\n\t\t\t\t\tif (final === run)\n\t\t\t\t\t\tfinal = false;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (!timeout) {\n\t\t\t\t\ttimeout = setTimeout(expired, limit);\n\t\t\t\t\tif (maxWaitExpired)\n\t\t\t\t\t\tmaxWaitTimeout = setTimeout(maxWaitExpired, maxWait);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}), {\n\t\t\t\tisResolved: false\n\t\t\t});\n\t\t\n\t\treturn debounced.promise;\n\t} as DebouncedFunction<Result>, {\n\t\tcallback,\n\t\tpromise: Object.assign(Promise.resolve(), {\n\t\t\tisResolved: true\n\t\t}),\n\t\tresolve: noop,\n\t\trun,\n\t\tclear: async (shouldRun?: boolean) => {\n\t\t\t\n\t\t\tclearTimeout(timeout);\n\t\t\ttimeout = undefined;\n\t\t\t\n\t\t\tclearTimeout(maxWaitTimeout);\n\t\t\t\n\t\t\tdebounced.promise.isResolved = true;\n\t\t\tdebounced.resolve(shouldRun ? await run() : result);\n\t\t\t\n\t\t}\n\t});\n\t\n\treturn debounced;\n}\n\n\ndebounce.noop = Object.assign(() => { /**/ }, {\n\tcallback: noop,\n\tpromise: Object.assign(Promise.resolve(), {\n\t\tisResolved: true\n\t}),\n\tresolve: noop,\n\trun: noop,\n\tclear: noop\n}) as unknown as Debounced<void>;\n\n\nexport function throttle<Result>(callback: Callback<Result>, limit?: number, options?: Options) {\n\treturn debounce(callback, limit, {\n\t\tmaxWait: limit,\n\t\tleading: true,\n\t\ttrailing: true,\n\t\t...options\n\t});\n}\n", "export function isEmpty(object: object) {\n\tfor (const _ in object)// eslint-disable-line guard-for-in, no-unreachable-loop\n\t\treturn false;\n\t\n\treturn true;\n}\n", "export function howmuch(number: [] | number, one: string, two: string, five: boolean | string, shouldPrintNumber = true) {\n\tif (Array.isArray(number))\n\t\tnumber = number.length;\n\t\n\tif (typeof five != \"string\") {\n\t\tshouldPrintNumber = five ?? true;\n\t\tfive = two;\n\t}\n\t\n\t\n\treturn (shouldPrintNumber ? `${number}\u00A0` : \"\") + howmuch.raw(number, one, two, five);\n}\n\nhowmuch.raw = (number: number, one: string, two: string, five = two) => {\n\tnumber = Math.abs(number);\n\tconst u = number % 10;\n\tconst d = number % 100;\n\t\n\treturn (\n\t\t(u === 1 && d !== 11) ?\n\t\t\tone :\n\t\t\t((u >= 2 && u <= 4) && !(d >= 12 && d <= 15)) ?\n\t\t\t\ttwo :\n\t\t\t\tfive\n\t);\n};\n", "export function pick<O extends object, K extends keyof O>(object: O, keys: K[]) {\n\t\n\tconst picked: Partial<Pick<O, K>> = {};\n\t\n\tfor (const key of keys)\n\t\tif (key in object)\n\t\t\tpicked[key] = object[key];\n\t\n\treturn picked as Pick<O, K>;\n}\n", "export function typeSafeObjectEntries<T extends Record<PropertyKey, unknown>>(obj: T) {\n\treturn Object.entries(obj) as { [K in keyof T]: [K, T[K]] }[keyof T][];\n}\n", "export function typeSafeObjectFromEntries<const T extends ReadonlyArray<readonly [PropertyKey, unknown]>>(entries: T) {\n\treturn Object.fromEntries(entries) as { [K in T[number] as K[0]]: K[1] };\n}\n", "export const updatedAtKey = \"_u\";\nexport const updatedAtSymbol = Symbol(\"updatedAt\");\n", "import {\n\tisEmpty,\n\tpick,\n\ttypeSafeObjectEntries,\n\ttypeSafeObjectFromEntries\n} from \"@nesvet/n\";\nimport type { Collections } from \"insite-db\";\nimport { updatedAtKey, updatedAtSymbol } from \"./symbols\";\nimport type {\n\tCollectionOptions,\n\tConfig,\n\tConfigItemID,\n\tListener,\n\tSchema,\n\tUpdates\n} from \"./types\";\n\n\nexport class UnknownConfigItemError extends Error {\n\tconstructor(_id: string) {\n\t\tsuper(`Unknown Config item \"${_id}\"`);\n\t\t\n\t}\n\t\n\tname = \"UnknownConfigItemError\";\n\t\n}\n\n\nlet initedConfig: Config<Schema>;\n\nexport async function init<S extends Schema>(collections: Collections, schema: S, collectionOptions?: CollectionOptions) {\n\t\n\tif (!initedConfig) {\n\t\ttype ID = ConfigItemID<S>;\n\t\ttype CI = Config<S>[ID];\n\t\t\n\t\tconst updateListeners = new Map<CI, Set<Listener<CI>>>();\n\t\t\n\t\ttype CIDoc = CI & { _id: ID };\n\t\tconst collection = await collections.ensure<CIDoc>(\"config\", collectionOptions);\n\t\t\n\t\tconst config: Config<S> = {\n\t\t\t\n\t\t\taddListener(_id, listener: Listener<CI>, immediately) {\n\t\t\t\tconst item = this[_id];\n\t\t\t\t\n\t\t\t\tif (item) {\n\t\t\t\t\tif (immediately)\n\t\t\t\t\t\tlistener.call(item, item, { ...item });\n\t\t\t\t\t\n\t\t\t\t\tupdateListeners.get(item)?.add(listener) ??\n\t\t\t\t\tupdateListeners.set(item, new Set([ listener ]));\n\t\t\t\t} else\n\t\t\t\t\tthrow new UnknownConfigItemError(_id);\n\t\t\t},\n\t\t\t\n\t\t\tremoveListener(_id, listener: Listener<CI>) {\n\t\t\t\tconst item = this[_id];\n\t\t\t\t\n\t\t\t\tif (item)\n\t\t\t\t\tupdateListeners.get(item)?.delete(listener);\n\t\t\t\telse\n\t\t\t\t\tthrow new UnknownConfigItemError(_id);\n\t\t\t},\n\t\t\t\n\t\t\tasync update(_id, { [updatedAtSymbol]: updatedAt, ...updates }) {\n\t\t\t\tconst item = this[_id] as CI;\n\t\t\t\t\n\t\t\t\tif (updatedAtKey in updates)\n\t\t\t\t\tdelete updates[updatedAtKey];\n\t\t\t\t\n\t\t\t\tif (item) {\n\t\t\t\t\tif (!isEmpty(updates) && (!updatedAt || item[updatedAtKey] < updatedAt)) {\n\t\t\t\t\t\tconst updatedFields: Partial<CI> = {};\n\t\t\t\t\t\t\n\t\t\t\t\t\tfor (const [ key, value ] of Object.entries(updates) as [ keyof CI, CI[keyof CI] ][])\n\t\t\t\t\t\t\tif (key in item && item[key] !== value)\n\t\t\t\t\t\t\t\tupdatedFields[key] = value;\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (!isEmpty(updatedFields)) {\n\t\t\t\t\t\t\tif (!updatedAt) {\n\t\t\t\t\t\t\t\tObject.assign(updatedFields, { [updatedAtKey]: Date.now() });\n\t\t\t\t\t\t\t\tcollection.updateOne({ _id }, { $set: updatedFields as Partial<CIDoc> });\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tconst prevFields = pick(item, Object.keys(updatedFields)) as Partial<CI>;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tObject.assign(item, updatedFields);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tfor (const listener of updateListeners.get(item) ?? [])\n\t\t\t\t\t\t\t\tawait listener.call(item, updatedFields, prevFields);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\treturn item;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tthrow new UnknownConfigItemError(_id);\n\t\t\t}\n\t\t\t\n\t\t} as Config<S>;\n\t\t\n\t\tconfig.on = config.addListener;\n\t\tconfig.off = config.removeListener;\n\t\t\n\t\tinitedConfig = config;// eslint-disable-line require-atomic-updates\n\t\t\n\t\t\n\t\tconst collectionMap = new Map((await collection.find().toArray()).map(({ _id, ...props }) => [ _id as ID, props as CI ]));\n\t\t\n\t\tconst itemsMap = new Map<ID, CI>();\n\t\t\n\t\tconst initialUpdatedAt = Date.now();\n\t\t\n\t\tfor (const [ _id, props ] of Object.entries(schema) as [ID, S[keyof S]][]) {\n\t\t\tconst collectionItem = collectionMap.get(_id);\n\t\t\t\n\t\t\tconst item = {\n\t\t\t\t...typeSafeObjectFromEntries(\n\t\t\t\t\ttypeSafeObjectEntries(props).map(([ key, value ]) =>\n\t\t\t\t\t\t[ key, collectionItem?.[key] ?? value ]\n\t\t\t\t\t)\n\t\t\t\t),\n\t\t\t\t[updatedAtKey]: collectionItem?.[updatedAtKey] ?? initialUpdatedAt\n\t\t\t} as CI;\n\t\t\t\n\t\t\tconfig[_id] = item;\n\t\t\t\n\t\t\titemsMap.set(_id, item);\n\t\t}\n\t\t\n\t\t\n\t\tawait collection.bulkWrite([\n\t\t\t...[ ...itemsMap ].map(([ _id, item ]) => ({ replaceOne: { filter: { _id }, replacement: { _id, ...item }, upsert: true } })),\n\t\t\t...[ ...collectionMap.keys() ].filter(_id => !schema[_id]).map(_id => ({ deleteOne: { filter: { _id } } }))\n\t\t]);\n\t\t\n\t\tcollection.onChange(next => {\n\t\t\tswitch (next.operationType) {\n\t\t\t\tcase \"update\":\n\t\t\t\tcase \"replace\": {\n\t\t\t\t\tconst {\n\t\t\t\t\t\t_id: _,\n\t\t\t\t\t\t[updatedAtKey]: updatedAt = Date.now(),\n\t\t\t\t\t\t...restProps\n\t\t\t\t\t} = next.operationType === \"replace\" ? next.fullDocument : next.updateDescription.updatedFields!;\n\t\t\t\t\t\n\t\t\t\t\tconfig.update(next.documentKey._id as unknown as ID, {\n\t\t\t\t\t\t...restProps,\n\t\t\t\t\t\t[updatedAtSymbol]: updatedAt\n\t\t\t\t\t} as Updates<CI>);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t});\n\t\t\n\t}\n\t\n\treturn initedConfig as Config<S>;\n}\n"],
|
|
5
|
-
"mappings": "AAAM,SAAUA,GAAI,CAAU,
|
|
6
|
-
"names": ["noop", "debounce", "callback", "limit", "options", "leading", "trailing", "maxWait", "timeout", "maxWaitTimeout", "end", "context", "args", "initial", "final", "result", "expired", "n", "debounced", "maxWaitExpired", "run", "_args", "resolve", "noop", "shouldRun", "isEmpty", "object", "_", "howmuch", "number", "one", "two", "five", "shouldPrintNumber", "u", "d", "pick", "object", "keys", "picked", "key", "typeSafeObjectEntries", "obj", "typeSafeObjectFromEntries", "entries", "updatedAtKey", "updatedAtSymbol", "UnknownConfigItemError", "_id", "initedConfig", "init", "collections", "schema", "collectionOptions", "updateListeners", "collection", "config", "listener", "immediately", "item", "updatedAtSymbol", "updatedAt", "updates", "updatedAtKey", "isEmpty", "updatedFields", "key", "value", "prevFields", "pick", "collectionMap", "props", "itemsMap", "initialUpdatedAt", "collectionItem", "typeSafeObjectFromEntries", "typeSafeObjectEntries", "next", "_", "restProps"]
|
|
3
|
+
"sources": ["../../../../@nesvet/npm/n/src/noop.ts", "../../../../@nesvet/npm/n/src/StatefulPromise.ts", "../../../../@nesvet/npm/n/src/debounce.ts", "../../../../@nesvet/npm/n/src/isEmpty.ts", "../../../../@nesvet/npm/n/src/howmuch.ts", "../../../../@nesvet/npm/n/src/pick.ts", "../../../../@nesvet/npm/n/src/typeSafeObjectEntries.ts", "../../../../@nesvet/npm/n/src/typeSafeObjectFromEntries.ts", "../src/symbols.ts", "../src/init.ts"],
|
|
4
|
+
"sourcesContent": ["export function noop() { /**/ }\n", "/* eslint-disable @typescript-eslint/no-explicit-any */\n\ntype Value<T> = PromiseLike<T> | T;\ntype Resolve<T> = (value: Value<T>) => void;\ntype Reject = (reason?: any) => void;\n\ntype Options = {\n\tsignal?: AbortSignal;\n\ttimeout?: number;\n};\n\nconst nativesMap = new WeakMap<StatefulPromise<any>, { resolve: Resolve<any>; reject: Reject }>();\n\n\nexport class StatefulPromise<T> extends Promise<T> {\n\tconstructor(\n\t\texecutor?: (resolve: Resolve<T>, reject: Reject) => void,\n\t\toptions?: Options\n\t) {\n\t\tlet nativeResolve: Resolve<T>;\n\t\tlet nativeReject: Reject;\n\t\t\n\t\tsuper((resolve, reject) => {\n\t\t\tnativeResolve = resolve;\n\t\t\tnativeReject = reject;\n\t\t\t\n\t\t});\n\t\t\n\t\tnativesMap.set(this, { resolve: nativeResolve!, reject: nativeReject! });\n\t\t\n\t\tif (options?.signal)\n\t\t\tif (options.signal.aborted)\n\t\t\t\tthis.reject(new DOMException(\"Aborted\", \"AbortError\"));\n\t\t\telse {\n\t\t\t\tconst abortListener = () => this.reject(new DOMException(\"Aborted\", \"AbortError\"));\n\t\t\t\t\n\t\t\t\toptions.signal.addEventListener(\"abort\", abortListener);\n\t\t\t\t\n\t\t\t\tthis.finally(() => options.signal?.removeEventListener(\"abort\", abortListener));\n\t\t\t}\n\t\t\n\t\tif (typeof options?.timeout === \"number\" && Number.isFinite(options.timeout)) {\n\t\t\tconst timeout = setTimeout(() => this.reject(new DOMException(\"Timeout exceeded\", \"TimeoutError\")), options.timeout);\n\t\t\t\n\t\t\tthis.finally(() => clearTimeout(timeout));\n\t\t}\n\t\t\n\t\texecutor?.(this.resolve, this.reject);\n\t\t\n\t}\n\t\n\tisPending = true;\n\tisFulfilled = false;\n\tisRejected = false;\n\t\n\tstate: \"fulfilled\" | \"pending\" | \"rejected\" = \"pending\";\n\t\n\tresult?: T | unknown;\n\t\n\treadonly resolve = (value: Value<T>) => {\n\t\t\n\t\tif (this.isPending) {\n\t\t\tthis.isPending = false;\n\t\t\tthis.isFulfilled = true;\n\t\t\tthis.state = \"fulfilled\";\n\t\t\tthis.result = value;\n\t\t\t\n\t\t\tconst native = nativesMap.get(this);\n\t\t\t\n\t\t\tif (native) {\n\t\t\t\tnative.resolve.call(this, value);\n\t\t\t\tnativesMap.delete(this);\n\t\t\t}\n\t\t}\n\t\t\n\t};\n\t\n\treadonly reject = (reason?: any) => {\n\t\t\n\t\tif (this.isPending) {\n\t\t\tthis.isPending = false;\n\t\t\tthis.isRejected = true;\n\t\t\tthis.state = \"rejected\";\n\t\t\tthis.result = reason;\n\t\t\t\n\t\t\tconst native = nativesMap.get(this);\n\t\t\t\n\t\t\tif (native) {\n\t\t\t\tnative.reject.call(this, reason);\n\t\t\t\tnativesMap.delete(this);\n\t\t\t}\n\t\t}\n\t\t\n\t};\n\t\n\t\n\tstatic resolved<U>(value: U): StatefulPromise<U> {\n\t\treturn new StatefulPromise<U>(resolve => resolve(value));\n\t}\n\t\n\tstatic rejected(reason: unknown): StatefulPromise<never> {\n\t\treturn new StatefulPromise((_, reject) => reject(reason));\n\t}\n\t\n}\n", "import { noop } from \"./noop.js\";\nimport { StatefulPromise } from \"./StatefulPromise.js\";\n\n\ntype Callback = (...args: any[]) => unknown;// eslint-disable-line @typescript-eslint/no-explicit-any\ntype FunctionOrBoolean = (() => unknown) | boolean;\ntype Options = { leading?: FunctionOrBoolean; maxWait?: number; trailing?: FunctionOrBoolean };\n\ntype DebouncedFunction<C extends Callback> = {\n\t(this: ThisParameterType<C>, ...args: Parameters<C>): Promise<Awaited<ReturnType<C>>>;\n};\n\nexport type Debounced<C extends Callback, R extends ReturnType<C>> = DebouncedFunction<C> & {\n\tcallback: C;\n\tpromise: StatefulPromise<R>;\n\tresolve: (value: R) => void;\n\treject: (reason?: unknown) => void;\n\trun(): Promise<R>;\n\tclear(shouldRun?: boolean): Promise<void>;\n};\n\n\nexport function debounce<C extends Callback, R extends ReturnType<C>>(callback: C, limit = 0, options: Options = {}) {\n\tlet { leading = false, trailing = true } = options;\n\tconst { maxWait = Infinity } = options;\n\t\n\tlet timeout: ReturnType<typeof setTimeout> | undefined;\n\tlet maxWaitTimeout: ReturnType<typeof setTimeout> | undefined;\n\tlet end: number | undefined;\n\tlet context: ThisParameterType<C>;\n\tlet args: unknown[];\n\tlet initial: FunctionOrBoolean;\n\tlet final: FunctionOrBoolean;\n\tlet result: R;\n\t\n\tconst expired = async () => {\n\t\t\n\t\tconst n = Date.now();\n\t\t\n\t\tif (n >= end!) {\n\t\t\ttimeout = undefined;\n\t\t\tend = undefined;\n\t\t\t\n\t\t\tclearTimeout(maxWaitTimeout);\n\t\t\tmaxWaitTimeout = undefined;\n\t\t\t\n\t\t\tif (typeof final == \"function\")\n\t\t\t\tawait final();\n\t\t\t\n\t\t\tdebounced.resolve(result);\n\t\t\t\n\t\t\tinitial = leading;\n\t\t} else {\n\t\t\tclearTimeout(timeout);\n\t\t\ttimeout = setTimeout(expired, end! - n);\n\t\t}\n\t\t\n\t};\n\t\n\tconst maxWaitExpired = Number.isFinite(maxWait) ? () => {\n\t\t\n\t\tif (final === run)\n\t\t\tfinal = false;\n\t\t\n\t\trun();\n\t\t\n\t\tmaxWaitTimeout = setTimeout(maxWaitExpired as TimerHandler, maxWait);\n\t\t\n\t} : null;\n\t\n\tasync function run() {\n\t\ttry {\n\t\t\tresult = await callback.apply(context, args) as R;\n\t\t\t\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\tdebounced.reject(error);\n\t\t\t\n\t\t\tthrow error;\n\t\t}\n\t}\n\t\n\tif (leading && typeof leading == \"boolean\")\n\t\tleading = run;\n\tinitial = leading;\n\t\n\tif (trailing && typeof trailing == \"boolean\")\n\t\ttrailing = run;\n\tfinal = trailing;\n\t\n\tconst debounced: Debounced<C, R> = Object.assign(function (..._args) {\n\t\targs = _args;\n\t\tcontext = this;// eslint-disable-line no-invalid-this\n\t\t\n\t\tend = Date.now() + limit;\n\t\tfinal = trailing;\n\t\t\n\t\tif (!debounced.promise.isPending)\n\t\t\tdebounced.promise = new StatefulPromise<R>((resolve, reject) => {\n\t\t\t\tdebounced.resolve = resolve;\n\t\t\t\tdebounced.reject = reject;\n\t\t\t\t\n\t\t\t\tif (typeof initial == \"function\") {\n\t\t\t\t\tinitial();\n\t\t\t\t\t\n\t\t\t\t\tinitial = false;\n\t\t\t\t\t\n\t\t\t\t\tif (final === run)\n\t\t\t\t\t\tfinal = false;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (!timeout) {\n\t\t\t\t\ttimeout = setTimeout(expired, limit);\n\t\t\t\t\t\n\t\t\t\t\tif (maxWaitExpired)\n\t\t\t\t\t\tmaxWaitTimeout = setTimeout(maxWaitExpired, maxWait);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t});\n\t\t\n\t\treturn debounced.promise;\n\t} as DebouncedFunction<C>, {\n\t\tcallback,\n\t\tpromise: StatefulPromise.resolved(undefined as unknown as R),\n\t\tresolve: noop,\n\t\treject: noop,\n\t\trun,\n\t\tclear: async (shouldRun?: boolean) => {\n\t\t\t\n\t\t\tclearTimeout(timeout);\n\t\t\ttimeout = undefined;\n\t\t\t\n\t\t\tclearTimeout(maxWaitTimeout);\n\t\t\tmaxWaitTimeout = undefined;\n\t\t\t\n\t\t\tdebounced.resolve(shouldRun ? await run() : result);\n\t\t\t\n\t\t}\n\t});\n\t\n\treturn debounced;\n}\n\n\ndebounce.noop = Object.assign(() => { /**/ }, {\n\tcallback: noop,\n\tpromise: StatefulPromise.resolved(undefined), // eslint-disable-line unicorn/no-useless-undefined\n\tresolve: noop,\n\treject: noop,\n\trun: noop,\n\tclear: noop\n}) as Debounced<() => void, void>;\n\n\nexport function throttle(callback: Callback, limit?: number, options?: Options) {\n\treturn debounce(callback, limit, {\n\t\tmaxWait: limit,\n\t\tleading: true,\n\t\ttrailing: true,\n\t\t...options\n\t});\n}\n", "export function isEmpty(object: object) {\n\tfor (const _ in object)// eslint-disable-line guard-for-in, no-unreachable-loop\n\t\treturn false;\n\t\n\treturn true;\n}\n", "export function howmuch(number: [] | number, one: string, two: string, five: boolean | string, shouldPrintNumber = true) {\n\tif (Array.isArray(number))\n\t\tnumber = number.length;\n\t\n\tif (typeof five != \"string\") {\n\t\tshouldPrintNumber = five ?? true;\n\t\tfive = two;\n\t}\n\t\n\t\n\treturn (shouldPrintNumber ? `${number}\u00A0` : \"\") + howmuch.raw(number, one, two, five);\n}\n\nhowmuch.raw = (number: number, one: string, two: string, five = two) => {\n\tnumber = Math.abs(number);\n\tconst u = number % 10;\n\tconst d = number % 100;\n\t\n\treturn (\n\t\t(u === 1 && d !== 11) ?\n\t\t\tone :\n\t\t\t((u >= 2 && u <= 4) && !(d >= 12 && d <= 15)) ?\n\t\t\t\ttwo :\n\t\t\t\tfive\n\t);\n};\n", "export function pick<O extends object, K extends keyof O>(object: O, keys: K[]) {\n\t\n\tconst picked: Partial<Pick<O, K>> = {};\n\t\n\tfor (const key of keys)\n\t\tif (key in object)\n\t\t\tpicked[key] = object[key];\n\t\n\treturn picked as Pick<O, K>;\n}\n", "export function typeSafeObjectEntries<T extends Record<PropertyKey, unknown>>(obj: T) {\n\treturn Object.entries(obj) as { [K in keyof T]: [K, T[K]] }[keyof T][];\n}\n", "export function typeSafeObjectFromEntries<const T extends ReadonlyArray<readonly [PropertyKey, unknown]>>(entries: T) {\n\treturn Object.fromEntries(entries) as { [K in T[number] as K[0]]: K[1] };\n}\n", "export const updatedAtKey = \"_u\";\nexport const updatedAtSymbol = Symbol(\"updatedAt\");\n", "import {\n\tisEmpty,\n\tpick,\n\ttypeSafeObjectEntries,\n\ttypeSafeObjectFromEntries\n} from \"@nesvet/n\";\nimport type { Collections } from \"insite-db\";\nimport { updatedAtKey, updatedAtSymbol } from \"./symbols\";\nimport type {\n\tCollectionOptions,\n\tConfig,\n\tConfigItemID,\n\tListener,\n\tSchema,\n\tUpdates\n} from \"./types\";\n\n\nexport class UnknownConfigItemError extends Error {\n\tconstructor(_id: string) {\n\t\tsuper(`Unknown Config item \"${_id}\"`);\n\t\t\n\t}\n\t\n\tname = \"UnknownConfigItemError\";\n\t\n}\n\n\nlet initedConfig: Config<Schema>;\n\nexport async function init<S extends Schema>(collections: Collections, schema: S, collectionOptions?: CollectionOptions) {\n\t\n\tif (!initedConfig) {\n\t\ttype ID = ConfigItemID<S>;\n\t\ttype CI = Config<S>[ID];\n\t\t\n\t\tconst updateListeners = new Map<CI, Set<Listener<CI>>>();\n\t\t\n\t\ttype CIDoc = CI & { _id: ID };\n\t\tconst collection = await collections.ensure<CIDoc>(\"config\", collectionOptions);\n\t\t\n\t\tconst config: Config<S> = {\n\t\t\t\n\t\t\taddListener(_id, listener: Listener<CI>, immediately) {\n\t\t\t\tconst item = this[_id];\n\t\t\t\t\n\t\t\t\tif (item) {\n\t\t\t\t\tif (immediately)\n\t\t\t\t\t\tlistener.call(item, item, { ...item });\n\t\t\t\t\t\n\t\t\t\t\tupdateListeners.get(item)?.add(listener) ??\n\t\t\t\t\tupdateListeners.set(item, new Set([ listener ]));\n\t\t\t\t} else\n\t\t\t\t\tthrow new UnknownConfigItemError(_id);\n\t\t\t},\n\t\t\t\n\t\t\tremoveListener(_id, listener: Listener<CI>) {\n\t\t\t\tconst item = this[_id];\n\t\t\t\t\n\t\t\t\tif (item)\n\t\t\t\t\tupdateListeners.get(item)?.delete(listener);\n\t\t\t\telse\n\t\t\t\t\tthrow new UnknownConfigItemError(_id);\n\t\t\t},\n\t\t\t\n\t\t\tasync update(_id, { [updatedAtSymbol]: updatedAt, ...updates }) {\n\t\t\t\tconst item = this[_id] as CI;\n\t\t\t\t\n\t\t\t\tif (updatedAtKey in updates)\n\t\t\t\t\tdelete updates[updatedAtKey];\n\t\t\t\t\n\t\t\t\tif (item) {\n\t\t\t\t\tif (!isEmpty(updates) && (!updatedAt || item[updatedAtKey] < updatedAt)) {\n\t\t\t\t\t\tconst updatedFields: Partial<CI> = {};\n\t\t\t\t\t\t\n\t\t\t\t\t\tfor (const [ key, value ] of Object.entries(updates) as [ keyof CI, CI[keyof CI] ][])\n\t\t\t\t\t\t\tif (key in item && item[key] !== value)\n\t\t\t\t\t\t\t\tupdatedFields[key] = value;\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (!isEmpty(updatedFields)) {\n\t\t\t\t\t\t\tif (!updatedAt) {\n\t\t\t\t\t\t\t\tObject.assign(updatedFields, { [updatedAtKey]: Date.now() });\n\t\t\t\t\t\t\t\tcollection.updateOne({ _id }, { $set: updatedFields as Partial<CIDoc> });\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tconst prevFields = pick(item, Object.keys(updatedFields)) as Partial<CI>;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tObject.assign(item, updatedFields);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tfor (const listener of updateListeners.get(item) ?? [])\n\t\t\t\t\t\t\t\tawait listener.call(item, updatedFields, prevFields);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\treturn item;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tthrow new UnknownConfigItemError(_id);\n\t\t\t}\n\t\t\t\n\t\t} as Config<S>;\n\t\t\n\t\tconfig.on = config.addListener;\n\t\tconfig.off = config.removeListener;\n\t\t\n\t\tinitedConfig = config;// eslint-disable-line require-atomic-updates\n\t\t\n\t\t\n\t\tconst collectionMap = new Map((await collection.find().toArray()).map(({ _id, ...props }) => [ _id as ID, props as CI ]));\n\t\t\n\t\tconst itemsMap = new Map<ID, CI>();\n\t\t\n\t\tconst initialUpdatedAt = Date.now();\n\t\t\n\t\tfor (const [ _id, props ] of Object.entries(schema) as [ID, S[keyof S]][]) {\n\t\t\tconst collectionItem = collectionMap.get(_id);\n\t\t\t\n\t\t\tconst item = {\n\t\t\t\t...typeSafeObjectFromEntries(\n\t\t\t\t\ttypeSafeObjectEntries(props).map(([ key, value ]) =>\n\t\t\t\t\t\t[ key, collectionItem?.[key] ?? value ]\n\t\t\t\t\t)\n\t\t\t\t),\n\t\t\t\t[updatedAtKey]: collectionItem?.[updatedAtKey] ?? initialUpdatedAt\n\t\t\t} as CI;\n\t\t\t\n\t\t\tconfig[_id] = item;\n\t\t\t\n\t\t\titemsMap.set(_id, item);\n\t\t}\n\t\t\n\t\t\n\t\tawait collection.bulkWrite([\n\t\t\t...[ ...itemsMap ].map(([ _id, item ]) => ({ replaceOne: { filter: { _id }, replacement: { _id, ...item }, upsert: true } })),\n\t\t\t...[ ...collectionMap.keys() ].filter(_id => !schema[_id]).map(_id => ({ deleteOne: { filter: { _id } } }))\n\t\t]);\n\t\t\n\t\tcollection.onChange(next => {\n\t\t\tswitch (next.operationType) {\n\t\t\t\tcase \"update\":\n\t\t\t\tcase \"replace\": {\n\t\t\t\t\tconst {\n\t\t\t\t\t\t_id: _,\n\t\t\t\t\t\t[updatedAtKey]: updatedAt = Date.now(),\n\t\t\t\t\t\t...restProps\n\t\t\t\t\t} = next.operationType === \"replace\" ? next.fullDocument : next.updateDescription.updatedFields!;\n\t\t\t\t\t\n\t\t\t\t\tconfig.update(next.documentKey._id as unknown as ID, {\n\t\t\t\t\t\t...restProps,\n\t\t\t\t\t\t[updatedAtSymbol]: updatedAt\n\t\t\t\t\t} as Updates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", "nativesMap", "StatefulPromise", "_StatefulPromise", "executor", "options", "nativeResolve", "nativeReject", "resolve", "reject", "abortListener", "timeout", "value", "native", "reason", "_", "debounce", "callback", "limit", "options", "leading", "trailing", "maxWait", "timeout", "maxWaitTimeout", "end", "context", "args", "initial", "final", "result", "expired", "n", "debounced", "maxWaitExpired", "run", "error", "_args", "StatefulPromise", "resolve", "reject", "noop", "shouldRun", "isEmpty", "object", "_", "howmuch", "number", "one", "two", "five", "shouldPrintNumber", "u", "d", "pick", "object", "keys", "picked", "key", "typeSafeObjectEntries", "obj", "typeSafeObjectFromEntries", "entries", "updatedAtKey", "updatedAtSymbol", "UnknownConfigItemError", "_id", "initedConfig", "init", "collections", "schema", "collectionOptions", "updateListeners", "collection", "config", "listener", "immediately", "item", "updatedAtSymbol", "updatedAt", "updates", "updatedAtKey", "isEmpty", "updatedFields", "key", "value", "prevFields", "pick", "collectionMap", "props", "itemsMap", "initialUpdatedAt", "collectionItem", "typeSafeObjectFromEntries", "typeSafeObjectEntries", "next", "_", "restProps"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
2
|
+
"name": "insite-config",
|
|
3
|
+
"version": "2.3.0",
|
|
4
|
+
"description": "inSite config",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"packageManager": "bun@1.2.11",
|
|
9
|
+
"scripts": {
|
|
10
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
11
|
+
"build": "bun .conveyer.js",
|
|
12
|
+
"postbuild": "tsc -p ."
|
|
13
|
+
},
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/nesvet/insite-config.git"
|
|
17
|
+
},
|
|
18
|
+
"keywords": [
|
|
19
|
+
"insite",
|
|
20
|
+
"config"
|
|
21
|
+
],
|
|
22
|
+
"author": "Eugene Nesvetaev <dev@nesvet.dev> (https://nesvet.dev/)",
|
|
23
|
+
"license": "MIT",
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@nesvet/n": "^1.2.0",
|
|
26
|
+
"insite-db": "^2.3.0"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@nesvet/conveyer": "^2.5.2",
|
|
30
|
+
"@nesvet/eslint-config": "^2.1.1",
|
|
31
|
+
"@types/node": "^22.15.3",
|
|
32
|
+
"typescript": "^5.8.3"
|
|
33
|
+
}
|
|
34
34
|
}
|