insite-db 2.2.0 → 2.2.2
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 +6 -5
- package/dist/index.js.map +3 -3
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import{MongoClient as
|
|
1
|
+
import{MongoClient as B}from"mongodb";function p(e=1,t=4){let r=" ".repeat(t),o={};Error.captureStackTrace(o,p);let n=o.stack.replace(/^Error\W+/m,"").replaceAll(/^\s+/gm,"").split(`
|
|
2
2
|
`).slice(e).join(`
|
|
3
|
-
${
|
|
4
|
-
`,e.
|
|
3
|
+
${r}`);return`${r}${n}`}function m(){}function M(e,t=0,r={}){let{leading:o=!1,trailing:n=!0}=r,{maxWait:s=1/0}=r,i,c,x,C,w,d,f,y,$=async()=>{let u=Date.now();u>=x?(i=void 0,x=void 0,clearTimeout(c),typeof f=="function"&&await f(),l.resolve(y),l.promise.isResolved=!0,d=o):(clearTimeout(i),i=setTimeout($,x-u))},S=Number.isFinite(s)?()=>{f===a&&(f=!1),a(),c=setTimeout(S,s)}:null;async function a(){return y=await e.apply(C,w)}o&&typeof o=="boolean"&&(o=a),d=o,n&&typeof n=="boolean"&&(n=a),f=n;let l=Object.assign(function(...u){return w=u,C=this,x=Date.now()+t,f=n,l.promise.isResolved&&(l.promise=Object.assign(new Promise(k=>{l.resolve=k,typeof d=="function"&&(d(),d=!1,f===a&&(f=!1)),i||(i=setTimeout($,t),S&&(c=setTimeout(S,s)))}),{isResolved:!1})),l.promise},{callback:e,promise:Object.assign(Promise.resolve(),{isResolved:!0}),resolve:m,run:a,clear:async u=>{clearTimeout(i),i=void 0,clearTimeout(c),l.promise.isResolved=!0,l.resolve(u?await a():y)}});return l}M.noop=Object.assign(()=>{},{callback:m,promise:Object.assign(Promise.resolve(),{isResolved:!0}),resolve:m,run:m,clear:m});function v(e,t,r,o,n=!0){return Array.isArray(e)&&(e=e.length),typeof o!="string"&&(n=o??!0,o=r),(n?`${e}\xA0`:"")+v.raw(e,t,r,o)}v.raw=(e,t,r,o=r)=>{e=Math.abs(e);let n=e%10,s=e%100;return n===1&&s!==11?t:n>=2&&n<=4&&!(s>=12&&s<=15)?r:o};function O(e,t){let r={...e};for(let o of t)delete r[o];return r}import{ObjectId as j}from"mongodb";function Co(){return new j().toString()}function T(e){let t=[];switch(e.operationType){case"insert":case"replace":t.push("fullDocument:",e.fullDocument);break;case"update":t.push("_id:",e.documentKey._id,`
|
|
4
|
+
`,"updateDescription:",e.updateDescription);break;case"delete":t.push("_id:",e.documentKey._id);break;default:t.push(e)}console.info("\u{1F33F}\u{1F38F}",`\x1B[1m${this.parent.collectionName}\x1B[0m`,`\x1B[3m${e.operationType}\x1B[0m`,...t)}function b(e){console.error(`\u{1F33F}\u2757\uFE0F MongoDB ${this.parent.collectionName} Change Stream:
|
|
5
|
+
`,e.stack)}var g=class extends Map{constructor(t){super(),this.db=t}db;#e=new Map;#t=new Map;#o=new Map;async ensure(t,r={}){let{db:o}=this,n=this.get(t)??await this.#e.get(t);if(!n){let{promise:s,resolve:i}=Promise.withResolvers();if(this.#e.set(t,s),(await o.listCollections({name:t},{nameOnly:!0}).toArray()).length?n=o.collection(t):(n=await o.createCollection(t,{...r.schema&&{validator:{$jsonSchema:r.schema}},...r.blockCompressor&&{storageEngine:{wiredTiger:{configString:`block_compressor=${r.blockCompressor}`}}}}),delete r.schema,delete r.blockCompressor),r.watch!==!1){let c=n.watch(void 0,{fullDocument:r.fullDocument===!1?void 0:"updateLookup"});(process.env.NODE_ENV==="development"?r.quiet!==!0:!r.quiet)&&c.on("change",T),c.on("error",b),n.changeStream=c}this.set(t,n),this[t]=n,i(n),this.#e.delete(t)}return r.schema&&(this.#t.has(t)?console.warn(`\u{1F33F}\u26A0\uFE0F Attempt to set schema for the \x1B[1m${t}\x1B[22m collection at
|
|
5
6
|
${p()}
|
|
6
7
|
|
|
7
8
|
Which has already been set at
|
|
8
9
|
${this.#t.get(t)}
|
|
9
10
|
|
|
10
|
-
Skipping`):(this.#t.set(t,p()),await
|
|
11
|
+
Skipping`):(this.#t.set(t,p()),await o.command({collMod:t,validator:{$jsonSchema:r.schema}}))),r.indexes&&(this.#o.has(t)?console.warn(`\u{1F33F}\u26A0\uFE0F Attempt to set indexes for the \x1B[1m${t}\x1B[22m collection at
|
|
11
12
|
${p()}
|
|
12
13
|
|
|
13
14
|
Which have already been set at
|
|
14
15
|
${this.#o.get(t)}
|
|
15
16
|
|
|
16
|
-
Skipping`):(this.#o.set(t,p()),await n.ensureIndexes(
|
|
17
|
+
Skipping`):(this.#o.set(t,p()),await n.ensureIndexes(r.indexes))),n}};async function Do({url:e,name:t,...r}){/localhost/.test(e)&&(e=e.replace(/localhost/,"127.0.0.1"));let o=new B(e,{maxPoolSize:100,...r});try{await o.connect(),console.info("\u{1F33F} MongoDB Client connected to",e.replace(/(?<=\/\/)[^:]+?:[^@]+@/,"").replace(/[/?][^/]*$/,""))}catch(i){console.error("\u{1F33F}\u2757\uFE0F MongoDB Client connection: ",i)}o.on("close",()=>console.error("\u{1F33F}\u2757\uFE0F MongoDB socket closed")).on("error",i=>console.error("\u{1F33F}\u2757\uFE0F MongoDB:",i)).on("parseError",i=>console.error("\u{1F33F}\u2757\uFE0F MongoDB parse:",i)).on("reconnect",()=>console.info("\u{1F33F} MongoDB reconnected")).on("timeout",()=>console.error("\u{1F33F}\u2757\uFE0F MongoDB timeout"));let n=o.db(t),s=new g(n);return{client:o,db:n,collections:s}}import{isDeepStrictEqual as D}from"node:util";import{Collection as h}from"mongodb";var I=2;h.prototype.ensureIndexes=async function(e,t=!1){if(t){let r=await this.indexes();for(let o=0;o<e.length;o++){let[n,s={}]=e[o];for(let i=0;i<r.length;i++){let c=r[i];if(D(n,c.key)&&D(s,O(c,["v","key","name"]))){e.splice(o--,1),r.splice(i,1);break}}}await Promise.all([...e.map(o=>this.createIndex(...o)),...r.filter(({name:o,v:n})=>o&&o!=="_id_"&&(!n||n<=I)).map(({name:o})=>this.dropIndex(o))])}else await Promise.all(e.map(r=>this.createIndex(...r)))};h.prototype.onChange=function(e){return this.changeStream.on("change",e),this};h.prototype.prependChange=function(e){return this.changeStream.prependListener("change",e),this};h.prototype.onceChange=function(e){return this.changeStream.once("change",e),this};h.prototype.prependOnceChange=function(e){return this.changeStream.prependOnceListener("change",e),this};h.prototype.removeChangeListener=function(e){return this.changeStream.removeListener("change",e),this};export*from"mongodb";export{Do as connect,Co as newObjectIdString,T as printChangeStreamChangeDetails,b as printChangeStreamError};
|
|
17
18
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/connect.ts", "../../../../@nesvet/npm/n/src/captureStackTrace.ts", "../../../../@nesvet/npm/n/src/noop.ts", "../../../../@nesvet/npm/n/src/debounce.ts", "../../../../@nesvet/npm/n/src/howmuch.ts", "../../../../@nesvet/npm/n/src/omit.ts", "../src/utils.ts", "../src/Collections.ts", "../src/extensions/Collection.ts", "../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["import { MongoClient } from \"mongodb\";\nimport { Collections } from \"./Collections\";\nimport type { DB, Options } from \"./types\";\n\n\nexport async function connect({ url, name, ...mongoClientOptions }: Options) {\n\t\n\tif (/localhost/.test(url))\n\t\turl = url.replace(/localhost/, \"127.0.0.1\");\n\t\n\tconst client = new MongoClient(url, {\n\t\tmaxPoolSize: 100,\n\t\t...mongoClientOptions\n\t});\n\t\n\ttry {\n\t\tawait client.connect();\n\t\tconsole.info(\"\uD83C\uDF3F MongoDB Client connected to\", url.replace(/(?<=\\/\\/)[^:]+?:[^@]+@/, \"\").replace(/[/?][^/]*$/, \"\"));\n\t} catch (error) {\n\t\tconsole.error(\"\uD83C\uDF3F\u2757\uFE0F MongoDB Client connection: \", error);\n\t}\n\t\n\tclient\n\t\t.on(\"close\", () => console.error(\"\uD83C\uDF3F\u2757\uFE0F MongoDB socket closed\"))\n\t\t.on(\"error\", error => console.error(\"\uD83C\uDF3F\u2757\uFE0F MongoDB:\", error))\n\t\t.on(\"parseError\", error => console.error(\"\uD83C\uDF3F\u2757\uFE0F MongoDB parse:\", error))\n\t\t.on(\"reconnect\", () => console.info(\"\uD83C\uDF3F MongoDB reconnected\"))\n\t\t.on(\"timeout\", () => console.error(\"\uD83C\uDF3F\u2757\uFE0F MongoDB timeout\"));\n\t\n\tconst db = client.db(name) as DB;\n\t\n\tconst collections = new Collections(db);\n\t\n\treturn {\n\t\tclient,\n\t\tdb,\n\t\tcollections\n\t};\n}\n", "declare global {\n\tinterface ErrorConstructor {\n\t\tcaptureStackTrace(targetObject: object, constructorOpt?: Function): void;// eslint-disable-line @typescript-eslint/no-unsafe-function-type\n\t}\n}\n\n\nexport function captureStackTrace(depth = 1, indent = 4) {\n\t\n\tconst indentString = \" \".repeat(indent);\n\t\n\tconst object = {} as { stack: string };\n\t\n\tError.captureStackTrace(object, captureStackTrace);\n\t\n\tconst stackTrace =\n\t\tobject.stack\n\t\t\t.replace(/^Error\\W+/m, \"\")\n\t\t\t.replaceAll(/^\\s+/gm, \"\")\n\t\t\t.split(\"\\n\")\n\t\t\t.slice(depth)\n\t\t\t.join(`\\n${indentString}`);\n\t\n\treturn `${indentString}${stackTrace}`;\n}\n", "export function noop() { /**/ }\n", "import { noop } from \"./noop.js\";\n\n\ntype Callback<Result> = (...args: unknown[]) => Result;\ntype FunctionOrBoolean = (() => unknown) | boolean;\ntype Options = { leading?: FunctionOrBoolean; maxWait?: number; trailing?: FunctionOrBoolean };\ntype NumberOrUndefined = number | undefined;\n\ntype DebouncedFunction<Result> = {\n\t(this: unknown, ..._args: unknown[]): Promise<Result>;\n};\n\nexport type Debounced<Result> = {\n\tcallback: Callback<Result>;\n\tpromise: {\n\t\tisResolved: boolean;\n\t} & Promise<unknown>;\n\tresolve: (value: Result) => void;\n\trun(): Promise<Result>;\n\tclear(shouldRun?: boolean): Promise<void>;\n} & DebouncedFunction<Result>;\n\n\nexport function debounce<Result>(callback: Callback<Result>, limit = 0, options: Options = {}) {\n\tlet { leading = false, trailing = true } = options;\n\tconst { maxWait = Infinity } = options;\n\t\n\tlet timeout: NumberOrUndefined;\n\tlet maxWaitTimeout: NumberOrUndefined;\n\tlet end: NumberOrUndefined;\n\tlet context: unknown;\n\tlet args: unknown[];\n\tlet initial: FunctionOrBoolean;\n\tlet final: FunctionOrBoolean;\n\tlet result: Result;\n\t\n\tconst expired = async () => {\n\t\t\n\t\tconst n = Date.now();\n\t\t\n\t\tif (n >= end!) {\n\t\t\ttimeout = undefined;\n\t\t\tend = undefined;\n\t\t\tclearTimeout(maxWaitTimeout);\n\t\t\tif (typeof final == \"function\")\n\t\t\t\tawait final();\n\t\t\tdebounced.resolve(result);\n\t\t\tdebounced.promise.isResolved = true;\n\t\t\tinitial = leading;\n\t\t} else {\n\t\t\tclearTimeout(timeout);\n\t\t\ttimeout = setTimeout(expired, end! - n);\n\t\t}\n\t\t\n\t};\n\t\n\tconst maxWaitExpired = Number.isFinite(maxWait) ? () => {\n\t\t\n\t\tif (final === run)\n\t\t\tfinal = false;\n\t\trun();\n\t\tmaxWaitTimeout = setTimeout(maxWaitExpired as TimerHandler, maxWait);\n\t\t\n\t} : null;\n\t\n\tasync function run() {\n\t\treturn (result = await callback.apply(context, args));\n\t}\n\t\n\tif (leading && typeof leading == \"boolean\")\n\t\tleading = run;\n\tinitial = leading;\n\t\n\tif (trailing && typeof trailing == \"boolean\")\n\t\ttrailing = run;\n\tfinal = trailing;\n\t\n\tconst debounced: Debounced<Result> = Object.assign(function (..._args) {\n\t\targs = _args;\n\t\tcontext = this;// eslint-disable-line no-invalid-this\n\t\t\n\t\tend = Date.now() + limit;\n\t\tfinal = trailing;\n\t\t\n\t\tif (debounced.promise.isResolved)\n\t\t\tdebounced.promise = Object.assign(new Promise(resolve => {\n\t\t\t\tdebounced.resolve = resolve;\n\t\t\t\t\n\t\t\t\tif (typeof initial == \"function\") {\n\t\t\t\t\tinitial();\n\t\t\t\t\tinitial = false;\n\t\t\t\t\tif (final === run)\n\t\t\t\t\t\tfinal = false;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (!timeout) {\n\t\t\t\t\ttimeout = setTimeout(expired, limit);\n\t\t\t\t\tif (maxWaitExpired)\n\t\t\t\t\t\tmaxWaitTimeout = setTimeout(maxWaitExpired, maxWait);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}), {\n\t\t\t\tisResolved: false\n\t\t\t});\n\t\t\n\t\treturn debounced.promise;\n\t} as DebouncedFunction<Result>, {\n\t\tcallback,\n\t\tpromise: Object.assign(Promise.resolve(), {\n\t\t\tisResolved: true\n\t\t}),\n\t\tresolve: noop,\n\t\trun,\n\t\tclear: async (shouldRun?: boolean) => {\n\t\t\t\n\t\t\tclearTimeout(timeout);\n\t\t\ttimeout = undefined;\n\t\t\t\n\t\t\tclearTimeout(maxWaitTimeout);\n\t\t\t\n\t\t\tdebounced.promise.isResolved = true;\n\t\t\tdebounced.resolve(shouldRun ? await run() : result);\n\t\t\t\n\t\t}\n\t});\n\t\n\treturn debounced;\n}\n\n\ndebounce.noop = Object.assign(() => { /**/ }, {\n\tcallback: noop,\n\tpromise: Object.assign(Promise.resolve(), {\n\t\tisResolved: true\n\t}),\n\tresolve: noop,\n\trun: noop,\n\tclear: noop\n}) as unknown as Debounced<void>;\n\n\nexport function throttle<Result>(callback: Callback<Result>, limit?: number, options?: Options) {\n\treturn debounce(callback, limit, {\n\t\tmaxWait: limit,\n\t\tleading: true,\n\t\ttrailing: true,\n\t\t...options\n\t});\n}\n", "export function 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 omit<O extends object, K extends keyof O>(object: O, keys: K[]) {\n\tconst result = { ...object };\n\t\n\tfor (const key of keys)\n\t\tdelete result[key];\n\t\n\treturn result as Omit<O, K>;\n}\n", "import { ObjectId, type ChangeStream, type ChangeStreamDocument } from \"mongodb\";\nimport type { WatchedCollection } from \"./types\";\n\n\nexport function newObjectIdString() {\n\treturn (new ObjectId()).toString();\n}\n\n/** @this ChangeStream */\nexport function printChangeStreamChangeDetails(this: ChangeStream, next: ChangeStreamDocument) {\n\t\n\tconst messages = [];\n\t\n\tswitch (next.operationType) {\n\t\tcase \"insert\":\n\t\tcase \"replace\":\n\t\t\tmessages.push(\"fullDocument:\", next.fullDocument);\n\t\t\tbreak;\n\t\t\n\t\tcase \"update\":\n\t\t\tmessages.push(\"updateDescription:\", next.updateDescription);\n\t\t\tbreak;\n\t\t\n\t\tcase \"delete\":\n\t\t\tmessages.push(\"_id:\", next.documentKey._id);\n\t\t\tbreak;\n\t\t\n\t\tdefault:\n\t\t\tmessages.push(next);\n\t}\n\t\n\tconsole.info(\"\uD83C\uDF3F\uD83C\uDF8F\", `\\x1B[1m${(this.parent as WatchedCollection).collectionName}\\x1B[0m`, `\\x1B[3m${next.operationType}\\x1B[0m`, ...messages);\n\t\n}\n\n/** @this ChangeStream */\nexport function printChangeStreamError(this: ChangeStream, error: Error) {\n\tconsole.error(`\uD83C\uDF3F\u2757\uFE0F MongoDB ${(this.parent as WatchedCollection).collectionName} Change Stream:\\n`, error.stack);\n\t\n}\n", "import type { Collection, Document } from \"mongodb\";\nimport { captureStackTrace } from \"@nesvet/n\";\nimport { printChangeStreamChangeDetails, printChangeStreamError } from \"./utils\";\nimport type { CollectionOptions, DB, WatchedCollection } from \"./types\";\n\n\nexport class Collections extends Map<string, Collection> {\n\tconstructor(db: DB) {\n\t\tsuper();\n\t\t\n\t\tthis.db = db;\n\t\t\n\t}\n\t\n\tdb: DB;\n\t\n\t#awaiting = new Map<string, Promise<Collection>>();\n\t\n\t#schemaSet = new Map<string, string>();\n\t#indexesSet = new Map<string, string>();\n\t\n\t[key: string]: Collection | unknown;\n\t\n\tasync ensure<Doc extends Document>(name: string, options: CollectionOptions & { watch: false }): Promise<Collection<Doc>>;\n\tasync ensure<Doc extends Document>(name: string, options?: CollectionOptions): Promise<WatchedCollection<Doc>>;\n\tasync ensure(name: string, options: CollectionOptions = {}) {\n\t\t\n\t\tconst { db } = this;\n\t\t\n\t\tlet collection = this.get(name) ?? await this.#awaiting.get(name);\n\t\t\n\t\tif (!collection) {\n\t\t\tconst { promise, resolve } = Promise.withResolvers<Collection>();\n\t\t\tthis.#awaiting.set(name, promise);\n\t\t\t\n\t\t\tif ((await db.listCollections({ name }, { nameOnly: true }).toArray()).length)\n\t\t\t\tcollection = db.collection(name);\n\t\t\telse {\n\t\t\t\tcollection = await db.createCollection(name, {\n\t\t\t\t\t...options.schema && { validator: { $jsonSchema: options.schema } },\n\t\t\t\t\t...options.blockCompressor && { storageEngine: { wiredTiger: { configString: `block_compressor=${options.blockCompressor}` } } }\n\t\t\t\t});\n\t\t\t\t\n\t\t\t\tdelete options.schema;\n\t\t\t\tdelete options.blockCompressor;\n\t\t\t}\n\t\t\t\n\t\t\tif (options.watch !== false) {\n\t\t\t\tconst changeStream = collection.watch(undefined, { fullDocument: options.fullDocument === false ? undefined : \"updateLookup\" });\n\t\t\t\t\n\t\t\t\tif (process.env.NODE_ENV === \"development\" ? options.quiet !== true : !options.quiet)\n\t\t\t\t\tchangeStream.on(\"change\", printChangeStreamChangeDetails);\n\t\t\t\t\n\t\t\t\tchangeStream.on(\"error\", printChangeStreamError);\n\t\t\t\t\n\t\t\t\tcollection.changeStream = changeStream;\n\t\t\t}\n\t\t\t\n\t\t\tthis.set(name, collection);\n\t\t\tthis[name] = collection;\n\t\t\t\n\t\t\tresolve(collection);\n\t\t\tthis.#awaiting.delete(name);\n\t\t}\n\t\t\n\t\tif (options.schema)\n\t\t\tif (this.#schemaSet.has(name))\n\t\t\t\tconsole.warn(\n\t\t\t\t\t`\uD83C\uDF3F\u26A0\uFE0F Attempt to set schema for the \\x1B[1m${name}\\x1B[22m collection at\\n` +\n\t\t\t\t\t`${captureStackTrace()}\\n` +\n\t\t\t\t\t\"\\n\" +\n\t\t\t\t\t\" Which has already been set at\\n\" +\n\t\t\t\t\t`${this.#schemaSet.get(name)}\\n` +\n\t\t\t\t\t\"\\n\" +\n\t\t\t\t\t\" Skipping\"\n\t\t\t\t);\n\t\t\telse {\n\t\t\t\tthis.#schemaSet.set(name, captureStackTrace());\n\t\t\t\t\n\t\t\t\tawait db.command({ collMod: name, validator: { $jsonSchema: options.schema } });\n\t\t\t}\n\t\t\n\t\tif (options.indexes)\n\t\t\tif (this.#indexesSet.has(name))\n\t\t\t\tconsole.warn(\n\t\t\t\t\t`\uD83C\uDF3F\u26A0\uFE0F Attempt to set indexes for the \\x1B[1m${name}\\x1B[22m collection at\\n` +\n\t\t\t\t\t`${captureStackTrace()}\\n` +\n\t\t\t\t\t\"\\n\" +\n\t\t\t\t\t\" Which have already been set at\\n\" +\n\t\t\t\t\t`${this.#indexesSet.get(name)}\\n` +\n\t\t\t\t\t\"\\n\" +\n\t\t\t\t\t\" Skipping\"\n\t\t\t\t);\n\t\t\telse {\n\t\t\t\tthis.#indexesSet.set(name, captureStackTrace());\n\t\t\t\t\n\t\t\t\tawait collection.ensureIndexes(options.indexes);\n\t\t\t}\n\t\t\n\t\treturn collection;\n\t}\n\t\n}\n", "import { isDeepStrictEqual } from \"node:util\";\nimport { Collection } from \"mongodb\";\nimport { omit } from \"@nesvet/n\";\nimport type { ChangeStreamListener, CollectionIndexes, WatchedCollection } from \"../types\";\n\n\nconst ACTUAL_INDEX_VERSION = 2;\n\n\ndeclare module \"mongodb\" {\n\texport interface Collection<TSchema> { // eslint-disable-line no-shadow\n\t\t\n\t\t/** Ensures the presence of `indexes`. */\n\t\tensureIndexes(indexes: CollectionIndexes): Promise<void>;\n\t\t\n\t\t/** Change Stream, watching for new changes in this collection. */\n\t\tchangeStream?: ChangeStream<TSchema>;\n\t\t\n\t\t/** Adds the `listener` function to the end of the listeners array for the event `change`. */\n\t\tonChange?(listener: ChangeStreamListener<TSchema>): this;\n\t\t\n\t\t/** Adds the `listener` function to the *beginning* of the listeners array for the event `change`. */\n\t\tprependChange?(listener: ChangeStreamListener<TSchema>): this;\n\t\t\n\t\t/** Adds the **one-time** `listener` function to the end of the listeners array for the event `change`. */\n\t\tonceChange?(listener: ChangeStreamListener<TSchema>): this;\n\t\t\n\t\t/** Adds the **one-time** function to the *beginning* of the listeners array for the event `change`. */\n\t\tprependOnceChange?(listener: ChangeStreamListener<TSchema>): this;\n\t\t\n\t\t/** Removes the `listener` from the listener array for the event `change`. */\n\t\tremoveChangeListener?(listener: ChangeStreamListener<TSchema>): this;\n\t\t\n\t}\n}\n\n\nCollection.prototype.ensureIndexes = async function (indexes) {\n\t\n\tconst existingIndexes = await this.indexes();\n\t\n\tfor (let i = 0; i < indexes.length; i++) {\n\t\tconst [ specification, options = {} ] = indexes[i];\n\t\t\n\t\tfor (let j = 0; j < existingIndexes.length; j++) {\n\t\t\tconst existingIndex = existingIndexes[j];\n\t\t\t\n\t\t\tif (\n\t\t\t\tisDeepStrictEqual(specification, existingIndex.key) &&\n\t\t\t\tisDeepStrictEqual(options, omit(existingIndex, [ \"v\", \"key\", \"name\" ]))\n\t\t\t) {\n\t\t\t\tindexes.splice(i--, 1);\n\t\t\t\texistingIndexes.splice(j, 1);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tawait Promise.all([\n\t\t...indexes.map(index => this.createIndex(...index)),\n\t\t...existingIndexes.filter(({ name, v }) => name && name !== \"_id_\" && (!v || v <= ACTUAL_INDEX_VERSION)).map(({ name }) => this.dropIndex(name!))\n\t]);\n\t\n};\n\nCollection.prototype.onChange = function (this: WatchedCollection, listener) {\n\tthis.changeStream.on(\"change\", listener);\n\t\n\treturn this;\n};\n\nCollection.prototype.prependChange = function (this: WatchedCollection, listener) {\n\tthis.changeStream.prependListener(\"change\", listener);\n\t\n\treturn this;\n};\n\nCollection.prototype.onceChange = function (this: WatchedCollection, listener) {\n\tthis.changeStream.once(\"change\", listener);\n\t\n\treturn this;\n};\n\nCollection.prototype.prependOnceChange = function (this: WatchedCollection, listener) {\n\tthis.changeStream.prependOnceListener(\"change\", listener);\n\t\n\treturn this;\n};\n\nCollection.prototype.removeChangeListener = function (this: WatchedCollection, listener) {\n\tthis.changeStream.removeListener(\"change\", listener);\n\t\n\treturn this;\n};\n", "export type { Collections } from \"./Collections\";\nexport * from \"./connect\";\nexport * from \"./extensions\";\nexport * from \"./types\";\nexport { CollectionOptions } from \"./types\";\nexport * from \"./utils\";\nexport * from \"mongodb\";\n"],
|
|
5
|
-
"mappings": "AAAA,OAAS,eAAAA,MAAmB,UCOtB,SAAUC,EAAkBC,EAAQ,EAAGC,EAAS,EAAC,CAEtD,IAAMC,EAAe,IAAI,OAAOD,CAAM,EAEhCE,EAAS,CAAA,EAEf,MAAM,kBAAkBA,EAAQJ,CAAiB,EAEjD,IAAMK,EACLD,EAAO,MACL,QAAQ,aAAc,EAAE,EACxB,WAAW,SAAU,EAAE,EACvB,MAAM;CAAI,EACV,MAAMH,CAAK,EACX,KAAK;EAAKE,CAAY,EAAE,EAE3B,MAAO,GAAGA,CAAY,GAAGE,CAAU,EACpC,CCxBM,SAAUC,GAAI,CAAU,CCuBxB,SAAUC,EAAiBC,EAA4BC,EAAQ,EAAGC,EAAmB,CAAA,EAAE,CAC5F,GAAI,CAAE,QAAAC,EAAU,GAAO,SAAAC,EAAW,EAAI,EAAKF,EACrC,CAAE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EAAK,YAAY,EAChD,MAED,IAAK,SACJC,EAAS,KAAK,
|
|
6
|
-
"names": ["MongoClient", "captureStackTrace", "depth", "indent", "indentString", "object", "stackTrace", "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", "howmuch", "number", "one", "two", "five", "shouldPrintNumber", "u", "d", "omit", "object", "keys", "result", "key", "ObjectId", "newObjectIdString", "printChangeStreamChangeDetails", "next", "messages", "printChangeStreamError", "error", "Collections", "db", "#awaiting", "#schemaSet", "#indexesSet", "name", "options", "collection", "promise", "resolve", "changeStream", "printChangeStreamChangeDetails", "printChangeStreamError", "captureStackTrace", "connect", "url", "name", "mongoClientOptions", "client", "MongoClient", "error", "db", "collections", "Collections", "isDeepStrictEqual", "Collection", "ACTUAL_INDEX_VERSION", "Collection", "indexes", "existingIndexes", "i", "specification", "options", "j", "existingIndex", "isDeepStrictEqual", "omit", "index", "name", "v", "listener"]
|
|
4
|
+
"sourcesContent": ["import { MongoClient } from \"mongodb\";\nimport { Collections } from \"./Collections\";\nimport type { DB, Options } from \"./types\";\n\n\nexport async function connect({ url, name, ...mongoClientOptions }: Options) {\n\t\n\tif (/localhost/.test(url))\n\t\turl = url.replace(/localhost/, \"127.0.0.1\");\n\t\n\tconst client = new MongoClient(url, {\n\t\tmaxPoolSize: 100,\n\t\t...mongoClientOptions\n\t});\n\t\n\ttry {\n\t\tawait client.connect();\n\t\tconsole.info(\"\uD83C\uDF3F MongoDB Client connected to\", url.replace(/(?<=\\/\\/)[^:]+?:[^@]+@/, \"\").replace(/[/?][^/]*$/, \"\"));\n\t} catch (error) {\n\t\tconsole.error(\"\uD83C\uDF3F\u2757\uFE0F MongoDB Client connection: \", error);\n\t}\n\t\n\tclient\n\t\t.on(\"close\", () => console.error(\"\uD83C\uDF3F\u2757\uFE0F MongoDB socket closed\"))\n\t\t.on(\"error\", error => console.error(\"\uD83C\uDF3F\u2757\uFE0F MongoDB:\", error))\n\t\t.on(\"parseError\", error => console.error(\"\uD83C\uDF3F\u2757\uFE0F MongoDB parse:\", error))\n\t\t.on(\"reconnect\", () => console.info(\"\uD83C\uDF3F MongoDB reconnected\"))\n\t\t.on(\"timeout\", () => console.error(\"\uD83C\uDF3F\u2757\uFE0F MongoDB timeout\"));\n\t\n\tconst db = client.db(name) as DB;\n\t\n\tconst collections = new Collections(db);\n\t\n\treturn {\n\t\tclient,\n\t\tdb,\n\t\tcollections\n\t};\n}\n", "declare global {\n\tinterface ErrorConstructor {\n\t\tcaptureStackTrace(targetObject: object, constructorOpt?: Function): void;// eslint-disable-line @typescript-eslint/no-unsafe-function-type\n\t}\n}\n\n\nexport function captureStackTrace(depth = 1, indent = 4) {\n\t\n\tconst indentString = \" \".repeat(indent);\n\t\n\tconst object = {} as { stack: string };\n\t\n\tError.captureStackTrace(object, captureStackTrace);\n\t\n\tconst stackTrace =\n\t\tobject.stack\n\t\t\t.replace(/^Error\\W+/m, \"\")\n\t\t\t.replaceAll(/^\\s+/gm, \"\")\n\t\t\t.split(\"\\n\")\n\t\t\t.slice(depth)\n\t\t\t.join(`\\n${indentString}`);\n\t\n\treturn `${indentString}${stackTrace}`;\n}\n", "export function noop() { /**/ }\n", "import { noop } from \"./noop.js\";\n\n\ntype Callback<Result> = (...args: unknown[]) => Result;\ntype FunctionOrBoolean = (() => unknown) | boolean;\ntype Options = { leading?: FunctionOrBoolean; maxWait?: number; trailing?: FunctionOrBoolean };\ntype NumberOrUndefined = number | undefined;\n\ntype DebouncedFunction<Result> = {\n\t(this: unknown, ..._args: unknown[]): Promise<Result>;\n};\n\nexport type Debounced<Result> = {\n\tcallback: Callback<Result>;\n\tpromise: {\n\t\tisResolved: boolean;\n\t} & Promise<unknown>;\n\tresolve: (value: Result) => void;\n\trun(): Promise<Result>;\n\tclear(shouldRun?: boolean): Promise<void>;\n} & DebouncedFunction<Result>;\n\n\nexport function debounce<Result>(callback: Callback<Result>, limit = 0, options: Options = {}) {\n\tlet { leading = false, trailing = true } = options;\n\tconst { maxWait = Infinity } = options;\n\t\n\tlet timeout: NumberOrUndefined;\n\tlet maxWaitTimeout: NumberOrUndefined;\n\tlet end: NumberOrUndefined;\n\tlet context: unknown;\n\tlet args: unknown[];\n\tlet initial: FunctionOrBoolean;\n\tlet final: FunctionOrBoolean;\n\tlet result: Result;\n\t\n\tconst expired = async () => {\n\t\t\n\t\tconst n = Date.now();\n\t\t\n\t\tif (n >= end!) {\n\t\t\ttimeout = undefined;\n\t\t\tend = undefined;\n\t\t\tclearTimeout(maxWaitTimeout);\n\t\t\tif (typeof final == \"function\")\n\t\t\t\tawait final();\n\t\t\tdebounced.resolve(result);\n\t\t\tdebounced.promise.isResolved = true;\n\t\t\tinitial = leading;\n\t\t} else {\n\t\t\tclearTimeout(timeout);\n\t\t\ttimeout = setTimeout(expired, end! - n);\n\t\t}\n\t\t\n\t};\n\t\n\tconst maxWaitExpired = Number.isFinite(maxWait) ? () => {\n\t\t\n\t\tif (final === run)\n\t\t\tfinal = false;\n\t\trun();\n\t\tmaxWaitTimeout = setTimeout(maxWaitExpired as TimerHandler, maxWait);\n\t\t\n\t} : null;\n\t\n\tasync function run() {\n\t\treturn (result = await callback.apply(context, args));\n\t}\n\t\n\tif (leading && typeof leading == \"boolean\")\n\t\tleading = run;\n\tinitial = leading;\n\t\n\tif (trailing && typeof trailing == \"boolean\")\n\t\ttrailing = run;\n\tfinal = trailing;\n\t\n\tconst debounced: Debounced<Result> = Object.assign(function (..._args) {\n\t\targs = _args;\n\t\tcontext = this;// eslint-disable-line no-invalid-this\n\t\t\n\t\tend = Date.now() + limit;\n\t\tfinal = trailing;\n\t\t\n\t\tif (debounced.promise.isResolved)\n\t\t\tdebounced.promise = Object.assign(new Promise(resolve => {\n\t\t\t\tdebounced.resolve = resolve;\n\t\t\t\t\n\t\t\t\tif (typeof initial == \"function\") {\n\t\t\t\t\tinitial();\n\t\t\t\t\tinitial = false;\n\t\t\t\t\tif (final === run)\n\t\t\t\t\t\tfinal = false;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (!timeout) {\n\t\t\t\t\ttimeout = setTimeout(expired, limit);\n\t\t\t\t\tif (maxWaitExpired)\n\t\t\t\t\t\tmaxWaitTimeout = setTimeout(maxWaitExpired, maxWait);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}), {\n\t\t\t\tisResolved: false\n\t\t\t});\n\t\t\n\t\treturn debounced.promise;\n\t} as DebouncedFunction<Result>, {\n\t\tcallback,\n\t\tpromise: Object.assign(Promise.resolve(), {\n\t\t\tisResolved: true\n\t\t}),\n\t\tresolve: noop,\n\t\trun,\n\t\tclear: async (shouldRun?: boolean) => {\n\t\t\t\n\t\t\tclearTimeout(timeout);\n\t\t\ttimeout = undefined;\n\t\t\t\n\t\t\tclearTimeout(maxWaitTimeout);\n\t\t\t\n\t\t\tdebounced.promise.isResolved = true;\n\t\t\tdebounced.resolve(shouldRun ? await run() : result);\n\t\t\t\n\t\t}\n\t});\n\t\n\treturn debounced;\n}\n\n\ndebounce.noop = Object.assign(() => { /**/ }, {\n\tcallback: noop,\n\tpromise: Object.assign(Promise.resolve(), {\n\t\tisResolved: true\n\t}),\n\tresolve: noop,\n\trun: noop,\n\tclear: noop\n}) as unknown as Debounced<void>;\n\n\nexport function throttle<Result>(callback: Callback<Result>, limit?: number, options?: Options) {\n\treturn debounce(callback, limit, {\n\t\tmaxWait: limit,\n\t\tleading: true,\n\t\ttrailing: true,\n\t\t...options\n\t});\n}\n", "export function 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 omit<O extends object, K extends keyof O>(object: O, keys: K[]) {\n\tconst result = { ...object };\n\t\n\tfor (const key of keys)\n\t\tdelete result[key];\n\t\n\treturn result as Omit<O, K>;\n}\n", "import { ObjectId, type ChangeStream, type ChangeStreamDocument } from \"mongodb\";\nimport type { WatchedCollection } from \"./types\";\n\n\nexport function newObjectIdString() {\n\treturn (new ObjectId()).toString();\n}\n\n/** @this ChangeStream */\nexport function printChangeStreamChangeDetails(this: ChangeStream, next: ChangeStreamDocument) {\n\t\n\tconst messages = [];\n\t\n\tswitch (next.operationType) {\n\t\tcase \"insert\":\n\t\tcase \"replace\":\n\t\t\tmessages.push(\"fullDocument:\", next.fullDocument);\n\t\t\tbreak;\n\t\t\n\t\tcase \"update\":\n\t\t\tmessages.push(\"_id:\", next.documentKey._id, \"\\n\", \"updateDescription:\", next.updateDescription);\n\t\t\tbreak;\n\t\t\n\t\tcase \"delete\":\n\t\t\tmessages.push(\"_id:\", next.documentKey._id);\n\t\t\tbreak;\n\t\t\n\t\tdefault:\n\t\t\tmessages.push(next);\n\t}\n\t\n\tconsole.info(\"\uD83C\uDF3F\uD83C\uDF8F\", `\\x1B[1m${(this.parent as WatchedCollection).collectionName}\\x1B[0m`, `\\x1B[3m${next.operationType}\\x1B[0m`, ...messages);\n\t\n}\n\n/** @this ChangeStream */\nexport function printChangeStreamError(this: ChangeStream, error: Error) {\n\tconsole.error(`\uD83C\uDF3F\u2757\uFE0F MongoDB ${(this.parent as WatchedCollection).collectionName} Change Stream:\\n`, error.stack);\n\t\n}\n", "import type { Collection, Document } from \"mongodb\";\nimport { captureStackTrace } from \"@nesvet/n\";\nimport { printChangeStreamChangeDetails, printChangeStreamError } from \"./utils\";\nimport type { CollectionOptions, DB, WatchedCollection } from \"./types\";\n\n\nexport class Collections extends Map<string, Collection> {\n\tconstructor(db: DB) {\n\t\tsuper();\n\t\t\n\t\tthis.db = db;\n\t\t\n\t}\n\t\n\tdb: DB;\n\t\n\t#awaiting = new Map<string, Promise<Collection>>();\n\t\n\t#schemaSet = new Map<string, string>();\n\t#indexesSet = new Map<string, string>();\n\t\n\t[key: string]: Collection | unknown;\n\t\n\tasync ensure<Doc extends Document>(name: string, options: CollectionOptions & { watch: false }): Promise<Collection<Doc>>;\n\tasync ensure<Doc extends Document>(name: string, options?: CollectionOptions): Promise<WatchedCollection<Doc>>;\n\tasync ensure(name: string, options: CollectionOptions = {}) {\n\t\t\n\t\tconst { db } = this;\n\t\t\n\t\tlet collection = this.get(name) ?? await this.#awaiting.get(name);\n\t\t\n\t\tif (!collection) {\n\t\t\tconst { promise, resolve } = Promise.withResolvers<Collection>();\n\t\t\tthis.#awaiting.set(name, promise);\n\t\t\t\n\t\t\tif ((await db.listCollections({ name }, { nameOnly: true }).toArray()).length)\n\t\t\t\tcollection = db.collection(name);\n\t\t\telse {\n\t\t\t\tcollection = await db.createCollection(name, {\n\t\t\t\t\t...options.schema && { validator: { $jsonSchema: options.schema } },\n\t\t\t\t\t...options.blockCompressor && { storageEngine: { wiredTiger: { configString: `block_compressor=${options.blockCompressor}` } } }\n\t\t\t\t});\n\t\t\t\t\n\t\t\t\tdelete options.schema;\n\t\t\t\tdelete options.blockCompressor;\n\t\t\t}\n\t\t\t\n\t\t\tif (options.watch !== false) {\n\t\t\t\tconst changeStream = collection.watch(undefined, { fullDocument: options.fullDocument === false ? undefined : \"updateLookup\" });\n\t\t\t\t\n\t\t\t\tif (process.env.NODE_ENV === \"development\" ? options.quiet !== true : !options.quiet)\n\t\t\t\t\tchangeStream.on(\"change\", printChangeStreamChangeDetails);\n\t\t\t\t\n\t\t\t\tchangeStream.on(\"error\", printChangeStreamError);\n\t\t\t\t\n\t\t\t\tcollection.changeStream = changeStream;\n\t\t\t}\n\t\t\t\n\t\t\tthis.set(name, collection);\n\t\t\tthis[name] = collection;\n\t\t\t\n\t\t\tresolve(collection);\n\t\t\tthis.#awaiting.delete(name);\n\t\t}\n\t\t\n\t\tif (options.schema)\n\t\t\tif (this.#schemaSet.has(name))\n\t\t\t\tconsole.warn(\n\t\t\t\t\t`\uD83C\uDF3F\u26A0\uFE0F Attempt to set schema for the \\x1B[1m${name}\\x1B[22m collection at\\n` +\n\t\t\t\t\t`${captureStackTrace()}\\n` +\n\t\t\t\t\t\"\\n\" +\n\t\t\t\t\t\" Which has already been set at\\n\" +\n\t\t\t\t\t`${this.#schemaSet.get(name)}\\n` +\n\t\t\t\t\t\"\\n\" +\n\t\t\t\t\t\" Skipping\"\n\t\t\t\t);\n\t\t\telse {\n\t\t\t\tthis.#schemaSet.set(name, captureStackTrace());\n\t\t\t\t\n\t\t\t\tawait db.command({ collMod: name, validator: { $jsonSchema: options.schema } });\n\t\t\t}\n\t\t\n\t\tif (options.indexes)\n\t\t\tif (this.#indexesSet.has(name))\n\t\t\t\tconsole.warn(\n\t\t\t\t\t`\uD83C\uDF3F\u26A0\uFE0F Attempt to set indexes for the \\x1B[1m${name}\\x1B[22m collection at\\n` +\n\t\t\t\t\t`${captureStackTrace()}\\n` +\n\t\t\t\t\t\"\\n\" +\n\t\t\t\t\t\" Which have already been set at\\n\" +\n\t\t\t\t\t`${this.#indexesSet.get(name)}\\n` +\n\t\t\t\t\t\"\\n\" +\n\t\t\t\t\t\" Skipping\"\n\t\t\t\t);\n\t\t\telse {\n\t\t\t\tthis.#indexesSet.set(name, captureStackTrace());\n\t\t\t\t\n\t\t\t\tawait collection.ensureIndexes(options.indexes);\n\t\t\t}\n\t\t\n\t\treturn collection;\n\t}\n\t\n}\n", "import { isDeepStrictEqual } from \"node:util\";\nimport { Collection } from \"mongodb\";\nimport { omit } from \"@nesvet/n\";\nimport type { ChangeStreamListener, CollectionIndexes, WatchedCollection } from \"../types\";\n\n\nconst ACTUAL_INDEX_VERSION = 2;\n\n\ndeclare module \"mongodb\" {\n\texport interface Collection<TSchema> { // eslint-disable-line no-shadow\n\t\t\n\t\t/** Ensures the presence of `indexes`. */\n\t\tensureIndexes(indexes: CollectionIndexes): Promise<void>;\n\t\t\n\t\t/** Change Stream, watching for new changes in this collection. */\n\t\tchangeStream?: ChangeStream<TSchema>;\n\t\t\n\t\t/** Adds the `listener` function to the end of the listeners array for the event `change`. */\n\t\tonChange?(listener: ChangeStreamListener<TSchema>): this;\n\t\t\n\t\t/** Adds the `listener` function to the *beginning* of the listeners array for the event `change`. */\n\t\tprependChange?(listener: ChangeStreamListener<TSchema>): this;\n\t\t\n\t\t/** Adds the **one-time** `listener` function to the end of the listeners array for the event `change`. */\n\t\tonceChange?(listener: ChangeStreamListener<TSchema>): this;\n\t\t\n\t\t/** Adds the **one-time** function to the *beginning* of the listeners array for the event `change`. */\n\t\tprependOnceChange?(listener: ChangeStreamListener<TSchema>): this;\n\t\t\n\t\t/** Removes the `listener` from the listener array for the event `change`. */\n\t\tremoveChangeListener?(listener: ChangeStreamListener<TSchema>): this;\n\t\t\n\t}\n}\n\n\nCollection.prototype.ensureIndexes = async function (indexes, dropOther = false) {\n\tif (dropOther) {\n\t\tconst existingIndexes = await this.indexes();\n\t\t\n\t\tfor (let i = 0; i < indexes.length; i++) {\n\t\t\tconst [ specification, options = {} ] = indexes[i];\n\t\t\t\n\t\t\tfor (let j = 0; j < existingIndexes.length; j++) {\n\t\t\t\tconst existingIndex = existingIndexes[j];\n\t\t\t\t\n\t\t\t\tif (\n\t\t\t\t\tisDeepStrictEqual(specification, existingIndex.key) &&\n\t\t\t\t\tisDeepStrictEqual(options, omit(existingIndex, [ \"v\", \"key\", \"name\" ]))\n\t\t\t\t) {\n\t\t\t\t\tindexes.splice(i--, 1);\n\t\t\t\t\texistingIndexes.splice(j, 1);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tawait Promise.all([\n\t\t\t...indexes.map(index => this.createIndex(...index)),\n\t\t\t...existingIndexes.filter(({ name, v }) => name && name !== \"_id_\" && (!v || v <= ACTUAL_INDEX_VERSION)).map(({ name }) => this.dropIndex(name!))\n\t\t]);\n\t} else\n\t\tawait Promise.all(indexes.map(index => this.createIndex(...index)));\n\t\n};\n\nCollection.prototype.onChange = function (this: WatchedCollection, listener) {\n\tthis.changeStream.on(\"change\", listener);\n\t\n\treturn this;\n};\n\nCollection.prototype.prependChange = function (this: WatchedCollection, listener) {\n\tthis.changeStream.prependListener(\"change\", listener);\n\t\n\treturn this;\n};\n\nCollection.prototype.onceChange = function (this: WatchedCollection, listener) {\n\tthis.changeStream.once(\"change\", listener);\n\t\n\treturn this;\n};\n\nCollection.prototype.prependOnceChange = function (this: WatchedCollection, listener) {\n\tthis.changeStream.prependOnceListener(\"change\", listener);\n\t\n\treturn this;\n};\n\nCollection.prototype.removeChangeListener = function (this: WatchedCollection, listener) {\n\tthis.changeStream.removeListener(\"change\", listener);\n\t\n\treturn this;\n};\n", "export type { Collections } from \"./Collections\";\nexport * from \"./connect\";\nexport * from \"./extensions\";\nexport * from \"./types\";\nexport { CollectionOptions } from \"./types\";\nexport * from \"./utils\";\nexport * from \"mongodb\";\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,eAAAA,MAAmB,UCOtB,SAAUC,EAAkBC,EAAQ,EAAGC,EAAS,EAAC,CAEtD,IAAMC,EAAe,IAAI,OAAOD,CAAM,EAEhCE,EAAS,CAAA,EAEf,MAAM,kBAAkBA,EAAQJ,CAAiB,EAEjD,IAAMK,EACLD,EAAO,MACL,QAAQ,aAAc,EAAE,EACxB,WAAW,SAAU,EAAE,EACvB,MAAM;CAAI,EACV,MAAMH,CAAK,EACX,KAAK;EAAKE,CAAY,EAAE,EAE3B,MAAO,GAAGA,CAAY,GAAGE,CAAU,EACpC,CCxBM,SAAUC,GAAI,CAAU,CCuBxB,SAAUC,EAAiBC,EAA4BC,E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EAASI,EAAKF,EAAe,CAAE,IAAK,MAAO,MAAO,CAAC,CAAC,EACrE,CACDP,EAAQ,OAAOG,IAAK,CAAC,EACrBD,EAAgB,OAAOI,EAAG,CAAC,EAC3B,KACD,CACD,CACD,CAEA,MAAM,QAAQ,IAAI,CACjB,GAAGN,EAAQ,IAAIU,GAAS,KAAK,YAAY,GAAGA,CAAK,CAAC,EAClD,GAAGR,EAAgB,OAAO,CAAC,CAAE,KAAAS,EAAM,EAAAC,CAAE,IAAMD,GAAQA,IAAS,SAAW,CAACC,GAAKA,GAAKd,EAAqB,EAAE,IAAI,CAAC,CAAE,KAAAa,CAAK,IAAM,KAAK,UAAUA,CAAK,CAAC,CACjJ,CAAC,CACF,MACC,MAAM,QAAQ,IAAIX,EAAQ,IAAIU,GAAS,KAAK,YAAY,GAAGA,CAAK,CAAC,CAAC,CAEpE,EAEAX,EAAW,UAAU,SAAW,SAAmCc,EAAU,CAC5E,YAAK,aAAa,GAAG,SAAUA,CAAQ,EAEhC,IACR,EAEAd,EAAW,UAAU,cAAgB,SAAmCc,EAAU,CACjF,YAAK,aAAa,gBAAgB,SAAUA,CAAQ,EAE7C,IACR,EAEAd,EAAW,UAAU,WAAa,SAAmCc,EAAU,CAC9E,YAAK,aAAa,KAAK,SAAUA,CAAQ,EAElC,IACR,EAEAd,EAAW,UAAU,kBAAoB,SAAmCc,EAAU,CACrF,YAAK,aAAa,oBAAoB,SAAUA,CAAQ,EAEjD,IACR,EAEAd,EAAW,UAAU,qBAAuB,SAAmCc,EAAU,CACxF,YAAK,aAAa,eAAe,SAAUA,CAAQ,EAE5C,IACR,ECzFA,WAAc",
|
|
6
|
+
"names": ["MongoClient", "captureStackTrace", "depth", "indent", "indentString", "object", "stackTrace", "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", "howmuch", "number", "one", "two", "five", "shouldPrintNumber", "u", "d", "omit", "object", "keys", "result", "key", "ObjectId", "newObjectIdString", "printChangeStreamChangeDetails", "next", "messages", "printChangeStreamError", "error", "Collections", "db", "#awaiting", "#schemaSet", "#indexesSet", "name", "options", "collection", "promise", "resolve", "changeStream", "printChangeStreamChangeDetails", "printChangeStreamError", "captureStackTrace", "connect", "url", "name", "mongoClientOptions", "client", "MongoClient", "error", "db", "collections", "Collections", "isDeepStrictEqual", "Collection", "ACTUAL_INDEX_VERSION", "Collection", "indexes", "dropOther", "existingIndexes", "i", "specification", "options", "j", "existingIndex", "isDeepStrictEqual", "omit", "index", "name", "v", "listener"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "insite-db",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.2",
|
|
4
4
|
"description": "MongoDB for inSite",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"module": "./dist/index.js",
|
|
8
|
-
"packageManager": "bun@1.2.
|
|
8
|
+
"packageManager": "bun@1.2.7",
|
|
9
9
|
"scripts": {
|
|
10
10
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
11
11
|
"build": "bun .conveyer.js",
|
|
@@ -23,14 +23,14 @@
|
|
|
23
23
|
"author": "Eugene Nesvetaev <dev@nesvet.dev> (https://nesvet.dev/)",
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@nesvet/n": "^1.1.
|
|
27
|
-
"mongodb": "^6.
|
|
26
|
+
"@nesvet/n": "^1.1.28",
|
|
27
|
+
"mongodb": "^6.15.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@nesvet/conveyer": "^2.
|
|
31
|
-
"@nesvet/eslint-config": "^2.0.
|
|
30
|
+
"@nesvet/conveyer": "^2.5.1",
|
|
31
|
+
"@nesvet/eslint-config": "^2.0.51",
|
|
32
32
|
"@types/json-schema": "^7.0.15",
|
|
33
|
-
"@types/node": "^22.13.
|
|
34
|
-
"typescript": "^5.
|
|
33
|
+
"@types/node": "^22.13.14",
|
|
34
|
+
"typescript": "^5.8.2"
|
|
35
35
|
}
|
|
36
36
|
}
|