insite-db 2.0.4 → 2.1.1
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/Collections.d.ts +10 -10
- package/dist/Collections.d.ts.map +1 -1
- package/dist/connect.d.ts +2 -2
- package/dist/connect.d.ts.map +1 -1
- package/dist/extensions/Collection.d.ts +2 -2
- package/dist/extensions/Collection.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +3 -3
- package/dist/types.d.ts +9 -10
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/Collections.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import type { Document } from "mongodb";
|
|
2
|
-
import type {
|
|
3
|
-
export declare class
|
|
4
|
-
constructor(db:
|
|
5
|
-
db:
|
|
6
|
-
[key: string]:
|
|
7
|
-
ensure<Doc extends Document>(name: string, options:
|
|
1
|
+
import type { Collection, Document } from "mongodb";
|
|
2
|
+
import type { DB, EnsureOptions, WatchedCollection } from "./types";
|
|
3
|
+
export declare class Collections extends Map<string, Collection> {
|
|
4
|
+
constructor(db: DB);
|
|
5
|
+
db: DB;
|
|
6
|
+
[key: string]: Collection | unknown;
|
|
7
|
+
ensure<Doc extends Document>(name: string, options: EnsureOptions & {
|
|
8
8
|
watch: false;
|
|
9
|
-
}): Promise<
|
|
10
|
-
ensure<Doc extends Document>(name: string, options?:
|
|
9
|
+
}): Promise<Collection<Doc>>;
|
|
10
|
+
ensure<Doc extends Document>(name: string, options?: EnsureOptions & {
|
|
11
11
|
watch?: true;
|
|
12
|
-
}): Promise<
|
|
12
|
+
}): Promise<WatchedCollection<Doc>>;
|
|
13
13
|
}
|
|
14
14
|
//# sourceMappingURL=Collections.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Collections.d.ts","sourceRoot":"","sources":["../src/Collections.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"Collections.d.ts","sourceRoot":"","sources":["../src/Collections.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGX,UAAU,EACV,QAAQ,EACR,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,EAAE,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAqBpE,qBAAa,WAAY,SAAQ,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC;gBAC3C,EAAE,EAAE,EAAE;IAOlB,EAAE,EAAE,EAAE,CAAC;IAEP,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,GAAG,OAAO,CAAC;IAE9B,MAAM,CAAC,GAAG,SAAS,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG;QAAE,KAAK,EAAE,KAAK,CAAA;KAAE,GAAG,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;IAC/G,MAAM,CAAC,GAAG,SAAS,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG;QAAE,KAAK,CAAC,EAAE,IAAI,CAAA;KAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC;CA4C7H"}
|
package/dist/connect.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { MongoClient } from "mongodb";
|
|
2
|
-
import {
|
|
2
|
+
import { Collections } from "./Collections";
|
|
3
3
|
import type { Options } from "./types";
|
|
4
4
|
export declare function connect({ url, name, ...mongoClientOptions }: Options): Promise<{
|
|
5
5
|
client: MongoClient;
|
|
6
6
|
db: import("mongodb").Db;
|
|
7
|
-
collections:
|
|
7
|
+
collections: Collections;
|
|
8
8
|
}>;
|
|
9
9
|
//# sourceMappingURL=connect.d.ts.map
|
package/dist/connect.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect.d.ts","sourceRoot":"","sources":["../src/connect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"connect.d.ts","sourceRoot":"","sources":["../src/connect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,EAAM,OAAO,EAAE,MAAM,SAAS,CAAC;AAG3C,wBAAsB,OAAO,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,kBAAkB,EAAE,EAAE,OAAO;;;;GAiC1E"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { CollectionIndexes } from "../types";
|
|
2
2
|
declare module "mongodb" {
|
|
3
3
|
interface Collection<TSchema> {
|
|
4
4
|
changeListeners?: Set<(listener: ChangeStreamDocument<TSchema>) => void>;
|
|
5
5
|
changeStream?: ChangeStream<TSchema>;
|
|
6
|
-
ensureIndexes(indexesToEnsure:
|
|
6
|
+
ensureIndexes(indexesToEnsure: CollectionIndexes): Promise<void>;
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
9
|
//# sourceMappingURL=Collection.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Collection.d.ts","sourceRoot":"","sources":["../../src/extensions/Collection.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Collection.d.ts","sourceRoot":"","sources":["../../src/extensions/Collection.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAGlD,OAAO,QAAQ,SAAS,CAAC;IACxB,UAAiB,UAAU,CAAC,OAAO;QAClC,eAAe,CAAC,EAAE,GAAG,CAAC,CAAC,QAAQ,EAAE,oBAAoB,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC,CAAC;QACzE,YAAY,CAAC,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC;QACrC,aAAa,CAAC,eAAe,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;KACjE;CACD"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{MongoClient as m}from"mongodb";function
|
|
2
|
-
`,n.stack)}var
|
|
1
|
+
import{MongoClient as m}from"mongodb";function i(n){process.env.NODE_ENV==="development"&&console.info("\u{1F38F} Change stream change",this.parent.collectionName,n);for(let e of this.parent.changeListeners)e(n)}function l(n){console.error(`\u{1F33F}\u2757\uFE0F Mongo ${this.parent.collectionName} Change Stream:
|
|
2
|
+
`,n.stack)}var s=class extends Map{constructor(e){super(),this.db=e}db;async ensure(e,o={}){let{db:r}=this,t=this.get(e);return t||((await r.listCollections({name:e},{nameOnly:!0}).toArray()).length?t=r.collection(e):(t=await r.createCollection(e,{...o.jsonSchema&&{validator:{$jsonSchema:o.jsonSchema}},...o.blockCompressor&&{storageEngine:{wiredTiger:{configString:`block_compressor=${o.blockCompressor}`}}}}),delete o.jsonSchema,delete o.blockCompressor),this.set(e,t),this[e]=t,o.watch!==!1&&(t.changeListeners=new Set,t.changeStream=t.watch(void 0,{fullDocument:o.fullDocument===!1?void 0:"updateLookup"}).on("change",i).on("error",l))),o.jsonSchema&&await r.command({collMod:e,...o.jsonSchema&&{validator:{$jsonSchema:o.jsonSchema}}}),o.indexes&&await t.ensureIndexes(o.indexes),t}};async function u({url:n,name:e,...o}){/localhost/.test(n)&&(n=n.replace(/localhost/,"127.0.0.1"));let r=new m(n,{maxPoolSize:100,...o});try{await r.connect(),console.info("\u{1F33F} Mongo Client connected to",n.replace(/(?<=\/\/)[^:]+?:[^@]+@/,"").replace(/[/?][^/]*$/,""))}catch(c){console.error("\u{1F33F}\u2757\uFE0F Mongo Client connection: ",c)}r.on("close",()=>console.error("\u{1F33F}\u2757\uFE0F Mongo DB socket closed")).on("error",c=>console.error("\u{1F33F}\u2757\uFE0F Mongo DB:",c)).on("parseError",c=>console.error("\u{1F33F}\u2757\uFE0F Mongo DB parse:",c)).on("reconnect",()=>console.info("\u{1F33F} Mongo DB reconnected")).on("timeout",()=>console.error("\u{1F33F}\u2757\uFE0F Mongo DB timeout"));let t=r.db(e),a=new s(t);return{client:r,db:t,collections:a}}import{Collection as h}from"mongodb";h.prototype.ensureIndexes=async function(n){try{for(let e of n)await this.createIndex(...e)}catch{}};import{ObjectId as d}from"mongodb";function y(){return new d().toString()}export*from"mongodb";export{u as connect,y as newObjectIdString};
|
|
3
3
|
//# 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", "../src/Collections.ts", "../src/extensions/Collection.ts", "../src/utils.ts", "../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["import { MongoClient } from \"mongodb\";\nimport {
|
|
5
|
-
"mappings": "AAAA,OAAS,eAAAA,MAAmB,UCU5B,SAASC,EAA6CC,EAA4B,CAE7E,QAAQ,IAAI,WAAa,eAC5B,QAAQ,KAAK,iCAA4B,KAAK,
|
|
6
|
-
"names": ["MongoClient", "handleChangeStreamChange", "next", "listener", "handleChangeStreamError", "error", "
|
|
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 Mongo Client connected to\", url.replace(/(?<=\\/\\/)[^:]+?:[^@]+@/, \"\").replace(/[/?][^/]*$/, \"\"));\n\t} catch (error) {\n\t\tconsole.error(\"\uD83C\uDF3F\u2757\uFE0F Mongo Client connection: \", error);\n\t}\n\t\n\tclient\n\t\t.on(\"close\", () => console.error(\"\uD83C\uDF3F\u2757\uFE0F Mongo DB socket closed\"))\n\t\t.on(\"error\", error => console.error(\"\uD83C\uDF3F\u2757\uFE0F Mongo DB:\", error))\n\t\t.on(\"parseError\", error => console.error(\"\uD83C\uDF3F\u2757\uFE0F Mongo DB parse:\", error))\n\t\t.on(\"reconnect\", () => console.info(\"\uD83C\uDF3F Mongo DB reconnected\"))\n\t\t.on(\"timeout\", () => console.error(\"\uD83C\uDF3F\u2757\uFE0F Mongo DB 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", "import type {\n\tChangeStream,\n\tChangeStreamDocument,\n\tCollection,\n\tDocument\n} from \"mongodb\";\nimport type { DB, EnsureOptions, WatchedCollection } from \"./types\";\n\n\n/** @this ChangeStream */\nfunction handleChangeStreamChange(this: ChangeStream, next: ChangeStreamDocument) {\n\t\n\tif (process.env.NODE_ENV === \"development\")\n\t\tconsole.info(\"\uD83C\uDF8F Change stream change\", (this.parent as WatchedCollection).collectionName, next);\n\t\n\tfor (const listener of (this.parent as WatchedCollection).changeListeners!)\n\t\tlistener(next);\n\t\n}\n\n/** @this ChangeStream */\nfunction handleChangeStreamError(this: ChangeStream, error: Error) {\n\tconsole.error(`\uD83C\uDF3F\u2757\uFE0F Mongo ${(this.parent as WatchedCollection).collectionName} Change Stream:\\n`, error.stack);\n\t\n}\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[key: string]: Collection | unknown;\n\t\n\tasync ensure<Doc extends Document>(name: string, options: EnsureOptions & { watch: false }): Promise<Collection<Doc>>;\n\tasync ensure<Doc extends Document>(name: string, options?: EnsureOptions & { watch?: true }): Promise<WatchedCollection<Doc>>;\n\tasync ensure(name: string, options: EnsureOptions = {}) {\n\t\t\n\t\tconst { db } = this;\n\t\t\n\t\tlet collection = this.get(name);\n\t\t\n\t\tif (!collection) {\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.jsonSchema && { validator: { $jsonSchema: options.jsonSchema } },\n\t\t\t\t\t...options.blockCompressor && { storageEngine: { wiredTiger: { configString: `block_compressor=${options.blockCompressor}` } } }\n\t\t\t\t});\n\t\t\t\tdelete options.jsonSchema;\n\t\t\t\tdelete options.blockCompressor;\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\tif (options.watch !== false) {\n\t\t\t\tcollection.changeListeners = new Set();\n\t\t\t\t\n\t\t\t\tcollection.changeStream =\n\t\t\t\t\tcollection.watch(undefined, { fullDocument: options.fullDocument === false ? undefined : \"updateLookup\" })\n\t\t\t\t\t\t.on(\"change\", handleChangeStreamChange)\n\t\t\t\t\t\t.on(\"error\", handleChangeStreamError);\n\t\t\t}\n\t\t}\n\t\t\n\t\tif (options.jsonSchema)\n\t\t\tawait db.command({\n\t\t\t\tcollMod: name,\n\t\t\t\t...options.jsonSchema && { validator: { $jsonSchema: options.jsonSchema } }\n\t\t\t});\n\t\t\n\t\tif (options.indexes)\n\t\t\tawait collection.ensureIndexes(options.indexes);\n\t\t\n\t\treturn collection;\n\t}\n\t\n}\n", "import { Collection, type ChangeStreamDocument } from \"mongodb\";\nimport type { CollectionIndexes } from \"../types\";\n\n\ndeclare module \"mongodb\" {\n\texport interface Collection<TSchema> { // eslint-disable-line no-shadow\n\t\tchangeListeners?: Set<(listener: ChangeStreamDocument<TSchema>) => void>;\n\t\tchangeStream?: ChangeStream<TSchema>;\n\t\tensureIndexes(indexesToEnsure: CollectionIndexes): Promise<void>;\n\t}\n}\n\n\nCollection.prototype.ensureIndexes = async function (indexesToEnsure) {\n\t\n\t// const existingIndexes = await this.indexes();\n\t\n\t// TODO:\n\t\n\ttry {\n\t\tfor (const indexToEnsure of indexesToEnsure)\n\t\t\tawait this.createIndex(...indexToEnsure);\n\t} catch {}\n\t\n};\n", "import { ObjectId } from \"mongodb\";\n\n\nexport function newObjectIdString() {\n\treturn (new ObjectId()).toString();\n}\n", "export type { Collections } from \"./Collections\";\nexport * from \"./connect\";\nexport * from \"./extensions\";\nexport * from \"./types\";\nexport * from \"./utils\";\nexport * from \"mongodb\";\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["MongoClient", "handleChangeStreamChange", "next", "listener", "handleChangeStreamError", "error", "Collections", "db", "name", "options", "collection", "connect", "url", "name", "mongoClientOptions", "client", "MongoClient", "error", "db", "collections", "Collections", "Collection", "indexesToEnsure", "indexToEnsure", "ObjectId", "newObjectIdString"]
|
|
7
7
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import type { JSONSchema4 } from "json-schema";
|
|
2
2
|
import type { Collection, CreateIndexesOptions, Db, Document, IndexSpecification, MongoClientOptions } from "mongodb";
|
|
3
|
-
export type Options = {
|
|
3
|
+
export type Options = MongoClientOptions & {
|
|
4
4
|
url: string;
|
|
5
5
|
name: string;
|
|
6
|
-
}
|
|
7
|
-
export type
|
|
8
|
-
export type
|
|
9
|
-
export type
|
|
6
|
+
};
|
|
7
|
+
export type DB = Db;
|
|
8
|
+
export type CollectionSchema = JSONSchema4;
|
|
9
|
+
export type EnsureOptions = {
|
|
10
10
|
fullDocument?: boolean;
|
|
11
|
-
jsonSchema?:
|
|
12
|
-
indexes?:
|
|
11
|
+
jsonSchema?: CollectionSchema;
|
|
12
|
+
indexes?: CollectionIndexes;
|
|
13
13
|
blockCompressor?: "none" | "snappy" | "zlib" | "zstd";
|
|
14
14
|
watch?: boolean;
|
|
15
15
|
};
|
|
16
|
-
export type
|
|
17
|
-
export type
|
|
18
|
-
export type InSiteWatchedCollection<Doc extends Document = Document> = Collection<Doc> & Required<Pick<Collection<Doc>, "changeListeners" | "changeStream">>;
|
|
16
|
+
export type CollectionIndexes = [IndexSpecification, CreateIndexesOptions?][];
|
|
17
|
+
export type WatchedCollection<Doc extends Document = Document> = Collection<Doc> & Required<Pick<Collection<Doc>, "changeListeners" | "changeStream">>;
|
|
19
18
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EACX,UAAU,EACV,oBAAoB,EACpB,EAAE,EACF,QAAQ,EACR,kBAAkB,EAClB,kBAAkB,EAClB,MAAM,SAAS,CAAC;AAGjB,MAAM,MAAM,OAAO,GAAG;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EACX,UAAU,EACV,oBAAoB,EACpB,EAAE,EACF,QAAQ,EACR,kBAAkB,EAClB,kBAAkB,EAClB,MAAM,SAAS,CAAC;AAGjB,MAAM,MAAM,OAAO,GAAG,kBAAkB,GAAG;IAC1C,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,EAAE,GAAG,EAAE,CAAC;AAEpB,MAAM,MAAM,gBAAgB,GAAG,WAAW,CAAC;AAE3C,MAAM,MAAM,aAAa,GAAG;IAC3B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,eAAe,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;IACtD,KAAK,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,CAAE,kBAAkB,EAAE,oBAAoB,CAAC,CAAE,EAAE,CAAC;AAEhF,MAAM,MAAM,iBAAiB,CAAC,GAAG,SAAS,QAAQ,GAAG,QAAQ,IAAI,UAAU,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,iBAAiB,GAAG,cAAc,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "insite-db",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "MongoDB for inSite",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"mongodb": "^6.13.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@nesvet/conveyer": "^2.2
|
|
30
|
-
"@nesvet/eslint-config": "^2.0.
|
|
29
|
+
"@nesvet/conveyer": "^2.4.2",
|
|
30
|
+
"@nesvet/eslint-config": "^2.0.47",
|
|
31
31
|
"@types/json-schema": "^7.0.15",
|
|
32
32
|
"@types/node": "^22.13.1",
|
|
33
33
|
"typescript": "^5.7.3"
|