feat: Добавил разметку для экстрактора апи и команду для сборника типов

This commit is contained in:
Nikita Dezzpil Orlov committed 2021-09-29 19:21:53 +03:00
1 parent 14f35b351c
commit 7f25b665f4
12 files changed
+984 -65

No files matched your search

+3 -1
View File
@@ -1,7 +1,9 @@
import rfdc from 'rfdc'
type ValuesObject = Record<string, any>
/** @public */
export type ValuesObject = Record<string, any>
/** @public */
export abstract class Data {
[key: string]: any
+3
View File
@@ -2,10 +2,13 @@ import { Data } from './data'
import { Repo } from './repo'
import { Storage } from './storage'
/** @public */
export type EntityConstructor<T extends Data> = new (data?: T) => Entity<T>
/** @public */
export class ErrEntityHasNoUniqKeyValue extends Error {}
/** @public */
export abstract class Entity<T extends Data> {
abstract _getRepo(storage: Storage): Repo<Entity<T>>
abstract _getVO(): T
+4
View File
@@ -1,9 +1,13 @@
import { Entity } from './entity'
import { Storage } from './storage'
/** @public */
export class ErrFoundNotUniqEntity extends Error {}
/** @public */
export class ErrEntityNotFound extends Error {}
/** @public */
export abstract class Repo<T extends Entity<any>> {
protected _storage: Storage
protected _entity: T
+6
View File
@@ -1,3 +1,4 @@
/** @public */
export interface StorageCursor {
limit(number_: number): StorageCursor
sort(parameters: Record<string, any>): StorageCursor
@@ -5,9 +6,13 @@ export interface StorageCursor {
toArray(): Promise<any[]>
}
/** @public */
export class ErrStorage extends Error {}
/** @public */
export class ErrNoSession extends ErrStorage {}
/** @public */
export abstract class Storage {
protected _dsn: string
@@ -26,6 +31,7 @@ export abstract class Storage {
abstract remove(collectionName: string, uniqKeyName: string, uniqKey: string): Promise<boolean>
}
/** @public */
export abstract class StorageSession {
abstract start(options?: Record<string, unknown>): Promise<void>
abstract commit(fn: () => any, options?: Record<string, unknown>): Promise<void>
+1
View File
@@ -2,6 +2,7 @@ import { ClientSession, MongoClient, TransactionOptions } from 'mongodb'
import { Storage, StorageCursor, StorageSession } from '../storage'
import { ErrEntityHasNoUniqKeyValue } from '../entity'
/** @public */
export class MongoStorage extends Storage {
private readonly _client: MongoClient
_session: ClientSession
+1 -1
View File
@@ -2,7 +2,7 @@ import { EntityConstructor, ErrEntityHasNoUniqKeyValue } from './app/entity'
import { ErrEntityNotFound, ErrFoundNotUniqEntity } from './app/repo'
import { ErrNoSession, ErrStorage, StorageCursor, StorageSession } from './app/storage'
export { Data } from './app/data'
export { Data, ValuesObject } from './app/data'
export { Entity, EntityConstructor, ErrEntityHasNoUniqKeyValue } from './app/entity'
export { Repo, ErrFoundNotUniqEntity, ErrEntityNotFound } from './app/repo'
export { Storage, StorageCursor, ErrStorage, ErrNoSession, StorageSession } from './app/storage'