@tsed/adapters 6.95.8 → 6.96.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsed/adapters",
3
- "version": "6.95.8",
3
+ "version": "6.96.1",
4
4
  "description": "Database adapters for Ts.ED",
5
5
  "private": false,
6
6
  "source": "./src/index.ts",
@@ -27,21 +27,21 @@
27
27
  "uuid": "8.3.2"
28
28
  },
29
29
  "devDependencies": {
30
- "@tsed/ajv": "6.95.8",
31
- "@tsed/common": "6.95.8",
32
- "@tsed/core": "6.95.8",
33
- "@tsed/di": "6.95.8",
34
- "@tsed/json-mapper": "6.95.8",
35
- "@tsed/schema": "6.95.8",
30
+ "@tsed/ajv": "6.96.1",
31
+ "@tsed/common": "6.96.1",
32
+ "@tsed/core": "6.96.1",
33
+ "@tsed/di": "6.96.1",
34
+ "@tsed/json-mapper": "6.96.1",
35
+ "@tsed/schema": "6.96.1",
36
36
  "@types/fs-extra": "9.0.6"
37
37
  },
38
38
  "peerDependencies": {
39
- "@tsed/ajv": "^6.95.8",
40
- "@tsed/common": "^6.95.8",
41
- "@tsed/core": "^6.95.8",
42
- "@tsed/di": "^6.95.8",
43
- "@tsed/json-mapper": "^6.95.8",
44
- "@tsed/schema": "^6.95.8",
39
+ "@tsed/ajv": "^6.96.1",
40
+ "@tsed/common": "^6.96.1",
41
+ "@tsed/core": "^6.96.1",
42
+ "@tsed/di": "^6.96.1",
43
+ "@tsed/json-mapper": "^6.96.1",
44
+ "@tsed/schema": "^6.96.1",
45
45
  "change-case": "^4.1.2",
46
46
  "lodash": "^4.17.21"
47
47
  },
@@ -1,9 +0,0 @@
1
- import { Configuration } from "@tsed/di";
2
- import { AdapterConstructorOptions } from "../domain/Adapter";
3
- import { AdapterModel, LowDbAdapter } from "./LowDbAdapter";
4
- export interface FileSyncAdapterConstructorOptions extends AdapterConstructorOptions {
5
- readOnly: true;
6
- }
7
- export declare class FileSyncAdapter<T extends AdapterModel> extends LowDbAdapter<T> {
8
- constructor(options: FileSyncAdapterConstructorOptions, configuration: Configuration);
9
- }
@@ -1,25 +0,0 @@
1
- /// <reference types="lodash" />
2
- import low from "lowdb";
3
- import { Adapter } from "../domain/Adapter";
4
- export interface AdapterModel {
5
- _id: string;
6
- expires_at?: Date;
7
- [key: string]: any;
8
- }
9
- export declare class LowDbAdapter<T extends AdapterModel> extends Adapter<T> {
10
- protected db: low.LowdbSync<{
11
- collection: T[];
12
- }>;
13
- get collection(): import("lodash").CollectionChain<T>;
14
- protected get dbFilePath(): string;
15
- create(payload: Partial<T>, expiresAt?: Date): Promise<T>;
16
- upsert(id: string, payload: T, expiresAt?: Date): Promise<T>;
17
- update(id: string, payload: T, expiresAt?: Date): Promise<T | undefined>;
18
- updateOne(predicate: Partial<T & any>, payload: T, expiresAt?: Date): Promise<T | undefined>;
19
- findOne(predicate: Partial<T & any>): Promise<T | undefined>;
20
- findById(_id: string): Promise<T | undefined>;
21
- findAll(predicate?: Partial<T & any>): Promise<T[]>;
22
- deleteOne(predicate: Partial<T & any>): Promise<T | undefined>;
23
- deleteById(_id: string): Promise<T | undefined>;
24
- deleteMany(predicate: Partial<T>): Promise<T[]>;
25
- }
@@ -1,5 +0,0 @@
1
- import { Configuration } from "@tsed/di";
2
- import { AdapterModel, LowDbAdapter } from "./LowDbAdapter";
3
- export declare class MemoryAdapter<T extends AdapterModel> extends LowDbAdapter<T> {
4
- constructor(options: any, configuration: Configuration);
5
- }
@@ -1 +0,0 @@
1
- export declare function Indexed(): PropertyDecorator;
@@ -1,5 +0,0 @@
1
- import { Type } from "@tsed/core";
2
- import { AdapterInvokeOptions } from "../services/Adapters";
3
- export declare function InjectAdapter(options: AdapterInvokeOptions): PropertyDecorator;
4
- export declare function InjectAdapter(model: Type<any>, options?: Partial<AdapterInvokeOptions>): PropertyDecorator;
5
- export declare function InjectAdapter(collectionName: string, model: Type<any>, options?: Partial<AdapterInvokeOptions>): PropertyDecorator;
@@ -1,35 +0,0 @@
1
- import { Type } from "@tsed/core";
2
- import { Configuration } from "@tsed/di";
3
- export interface AdapterConstructorOptions<T = any> {
4
- model: Type<T> | Object;
5
- collectionName?: string;
6
- indexes?: {
7
- [propertyKey: string]: Record<string, any>;
8
- };
9
- }
10
- export declare abstract class Adapter<T = any> {
11
- protected configuration: Configuration;
12
- readonly model: Type<T> | Object;
13
- readonly collectionName: string;
14
- readonly indexes: {
15
- propertyKey: string;
16
- options: any;
17
- }[];
18
- private ajvService;
19
- constructor(options: AdapterConstructorOptions, configuration: Configuration);
20
- validate(value: T): Promise<void>;
21
- abstract create(value: Partial<Omit<T, "_id">>, expiresAt?: Date): Promise<T>;
22
- abstract update(id: string, value: T, expiresAt?: Date): Promise<T | undefined>;
23
- abstract updateOne(predicate: Partial<T>, value: Partial<T>, expiresAt?: Date): Promise<T | undefined>;
24
- abstract upsert(id: string, value: T, expiresAt?: Date): Promise<T>;
25
- abstract findOne(predicate: Partial<T>): Promise<T | undefined>;
26
- abstract findById(id: string): Promise<T | undefined>;
27
- abstract findAll(predicate?: Partial<T>): Promise<T[]>;
28
- abstract deleteOne(predicate: Partial<T>): Promise<T | undefined>;
29
- abstract deleteMany(predicate: Partial<T>): Promise<T[]>;
30
- abstract deleteById(id: string): Promise<T | undefined>;
31
- getModel(): Object | undefined;
32
- protected updateInstance(src: any, payload: any): any;
33
- protected deserialize(obj: any): any;
34
- protected serialize(obj: any): any;
35
- }
@@ -1,22 +0,0 @@
1
- import { Type } from "@tsed/core";
2
- import { Adapter } from "./Adapter";
3
- export interface AdaptersSettings {
4
- /**
5
- * Injectable service to manage database connexion
6
- */
7
- Adapter?: Type<Adapter>;
8
- /**
9
- *
10
- */
11
- lowdbDir?: string;
12
- [key: string]: any;
13
- }
14
- declare global {
15
- namespace TsED {
16
- interface AdaptersOptions extends AdaptersSettings {
17
- }
18
- interface Configuration {
19
- adapters: AdaptersSettings;
20
- }
21
- }
22
- }
@@ -1,8 +0,0 @@
1
- export * from "./adapters/FileSyncAdapter";
2
- export * from "./adapters/LowDbAdapter";
3
- export * from "./adapters/MemoryAdapter";
4
- export * from "./domain/Adapter";
5
- export * from "./domain/AdaptersSettings";
6
- export * from "./decorators/injectAdapter";
7
- export * from "./decorators/indexed";
8
- export * from "./services/Adapters";
@@ -1,12 +0,0 @@
1
- import { Type } from "@tsed/core";
2
- import { InjectorService } from "@tsed/di";
3
- import { Adapter, AdapterConstructorOptions } from "../domain/Adapter";
4
- export interface AdapterInvokeOptions<T = any> extends AdapterConstructorOptions<T> {
5
- adapter?: Type<Adapter<T>>;
6
- [key: string]: any;
7
- }
8
- export declare class Adapters {
9
- injector: InjectorService;
10
- protected adapter: Type<Adapter>;
11
- invokeAdapter<T = any>(options: AdapterInvokeOptions): Adapter<T>;
12
- }