Compare commits

..

No commits in common. "ab5c1f70c4a5685890deca16849af9d5b98494ce" and "b865f50084822ba4a7c9c0aa69a6bd029b47bda5" have entirely different histories.

7 changed files with 23 additions and 30 deletions

View File

@ -2,13 +2,6 @@
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
### [1.1.2](https://git.archive.systems/Dezzpil/ivanovna.orm/compare/v1.1.1...v1.1.2) (2021-09-30)
### Bug Fixes
* заменил все unknow на any ([20a969c](https://git.archive.systems/Dezzpil/ivanovna.orm/commit/20a969c829d5d4d9ec5b4f001f6d13be3570a97d))
### [1.1.1](https://git.archive.systems/Dezzpil/ivanovna.orm/compare/v1.1.0...v1.1.1) (2021-09-29) ### [1.1.1](https://git.archive.systems/Dezzpil/ivanovna.orm/compare/v1.1.0...v1.1.1) (2021-09-29)
## [1.1.0](https://git.archive.systems/Dezzpil/ivanovna.orm/compare/v1.0.2...v1.1.0) (2021-09-29) ## [1.1.0](https://git.archive.systems/Dezzpil/ivanovna.orm/compare/v1.0.2...v1.1.0) (2021-09-29)

16
orm.d.ts vendored
View File

@ -70,10 +70,10 @@ export declare abstract class Repo<T extends Entity<any>> {
* *
* @protected * @protected
*/ */
_findByParams(parameters: Record<string, any>, limit?: number, order?: Record<string, any>): Promise<T[]>; _findByParams(parameters: Record<string, unknown>, limit?: number, order?: Record<string, unknown>): Promise<T[]>;
findMany(parameters: Record<string, any>, order?: Record<string, any>): Promise<T[]>; findMany(parameters: Record<string, unknown>, order?: Record<string, unknown>): Promise<T[]>;
shift(limit?: number, offset?: number): this; shift(limit?: number, offset?: number): this;
count(query?: Record<string, any>): Promise<number>; count(query?: Record<string, unknown>): Promise<number>;
remove(entity: T, silent?: boolean): Promise<this>; remove(entity: T, silent?: boolean): Promise<this>;
} }
@ -81,10 +81,10 @@ export declare abstract class Repo<T extends Entity<any>> {
declare abstract class Storage_2 { declare abstract class Storage_2 {
protected _dsn: string; protected _dsn: string;
constructor(dsn: string); constructor(dsn: string);
abstract find(name: string, query: Record<string, any>): Promise<StorageCursor>; abstract find(name: string, query: Record<string, unknown>): Promise<StorageCursor>;
abstract save(name: string, uniqKey: string, data: Record<string, any>): Promise<string>; abstract save(name: string, uniqKey: string, data: Record<string, unknown>): Promise<string>;
abstract createSession(): StorageSession; abstract createSession(): StorageSession;
abstract count(name: string, query?: Record<string, any>): Promise<number>; abstract count(name: string, query?: Record<string, unknown>): Promise<number>;
abstract remove(collectionName: string, uniqKeyName: string, uniqKey: string): Promise<boolean>; abstract remove(collectionName: string, uniqKeyName: string, uniqKey: string): Promise<boolean>;
} }
export { Storage_2 as Storage } export { Storage_2 as Storage }
@ -99,8 +99,8 @@ export declare interface StorageCursor {
/** @public */ /** @public */
export declare abstract class StorageSession { export declare abstract class StorageSession {
abstract start(options?: Record<string, any>): Promise<void>; abstract start(options?: Record<string, unknown>): Promise<void>;
abstract commit(fn: () => any, options?: Record<string, any>): Promise<void>; abstract commit(fn: () => any, options?: Record<string, unknown>): Promise<void>;
} }
/** @public */ /** @public */

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "ivna-orm", "name": "ivna-orm",
"version": "1.1.2", "version": "1.1.1",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "ivna-orm", "name": "ivna-orm",
"version": "1.1.2", "version": "1.1.1",
"license": "ISC", "license": "ISC",
"devDependencies": { "devDependencies": {
"@jest/test-sequencer": "^27.2.3", "@jest/test-sequencer": "^27.2.3",

View File

@ -1,6 +1,6 @@
{ {
"name": "ivna-orm", "name": "ivna-orm",
"version": "1.1.2", "version": "1.1.1",
"description": "Mini ORM for convenience", "description": "Mini ORM for convenience",
"main": "dist/index.js", "main": "dist/index.js",
"files": [ "files": [

View File

@ -74,9 +74,9 @@ export abstract class Repo<T extends Entity<any>> {
* @protected * @protected
*/ */
async _findByParams( async _findByParams(
parameters: Record<string, any>, parameters: Record<string, unknown>,
limit?: number, limit?: number,
order?: Record<string, any> order?: Record<string, unknown>
): Promise<T[]> { ): Promise<T[]> {
const cursor = await this._storage.find(this.Name(), parameters) const cursor = await this._storage.find(this.Name(), parameters)
if (limit && limit > 0) await cursor.limit(limit) if (limit && limit > 0) await cursor.limit(limit)
@ -90,7 +90,7 @@ export abstract class Repo<T extends Entity<any>> {
return list return list
} }
async findMany(parameters: Record<string, any>, order?: Record<string, any>): Promise<T[]> { async findMany(parameters: Record<string, unknown>, order?: Record<string, unknown>): Promise<T[]> {
const cursor = await this._storage.find(this.Name(), parameters) const cursor = await this._storage.find(this.Name(), parameters)
if (this._offset > 0) await cursor.skip(this._offset) if (this._offset > 0) await cursor.skip(this._offset)
if (this._limit > 0) await cursor.limit(this._limit) if (this._limit > 0) await cursor.limit(this._limit)
@ -110,7 +110,7 @@ export abstract class Repo<T extends Entity<any>> {
return this return this
} }
async count(query?: Record<string, any>): Promise<number> { async count(query?: Record<string, unknown>): Promise<number> {
return this._storage.count(this.Name(), query) return this._storage.count(this.Name(), query)
} }

View File

@ -20,19 +20,19 @@ export abstract class Storage {
this._dsn = dsn this._dsn = dsn
} }
abstract find(name: string, query: Record<string, any>): Promise<StorageCursor> abstract find(name: string, query: Record<string, unknown>): Promise<StorageCursor>
abstract save(name: string, uniqKey: string, data: Record<string, any>): Promise<string> abstract save(name: string, uniqKey: string, data: Record<string, unknown>): Promise<string>
abstract createSession(): StorageSession abstract createSession(): StorageSession
abstract count(name: string, query?: Record<string, any>): Promise<number> abstract count(name: string, query?: Record<string, unknown>): Promise<number>
abstract remove(collectionName: string, uniqKeyName: string, uniqKey: string): Promise<boolean> abstract remove(collectionName: string, uniqKeyName: string, uniqKey: string): Promise<boolean>
} }
/** @public */ /** @public */
export abstract class StorageSession { export abstract class StorageSession {
abstract start(options?: Record<string, any>): Promise<void> abstract start(options?: Record<string, unknown>): Promise<void>
abstract commit(fn: () => any, options?: Record<string, any>): Promise<void> abstract commit(fn: () => any, options?: Record<string, unknown>): Promise<void>
} }

View File

@ -21,19 +21,19 @@ export class MongoStorage extends Storage {
await this._client.connect() await this._client.connect()
} }
async find(collectionName: string, query: Record<string, any>): Promise<StorageCursor> { async find(collectionName: string, query: Record<string, unknown>): Promise<StorageCursor> {
await this._connect() await this._connect()
const coll = await this._client.db().collection(collectionName) const coll = await this._client.db().collection(collectionName)
return coll.find(query) return coll.find(query)
} }
async count(collectionName: string, query: Record<string, any>): Promise<number> { async count(collectionName: string, query: Record<string, unknown>): Promise<number> {
await this._connect() await this._connect()
const coll = await this._client.db().collection(collectionName) const coll = await this._client.db().collection(collectionName)
return coll.countDocuments(query) return coll.countDocuments(query)
} }
async save(collectionName: string, uniqKey: string, data: Record<string, any>): Promise<string> { async save(collectionName: string, uniqKey: string, data: Record<string, unknown>): Promise<string> {
await this._connect() await this._connect()
const id = data[uniqKey] const id = data[uniqKey]
const coll = await this._client.db().collection(collectionName) const coll = await this._client.db().collection(collectionName)