@tsed/adapters 8.33.0 → 8.35.0
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/lib/esm/adapters/FileSyncAdapter.js +5 -5
- package/lib/esm/adapters/LowDbAdapter.js +2 -2
- package/lib/esm/adapters/MemoryAdapter.js +1 -1
- package/lib/esm/decorators/injectAdapter.js +2 -2
- package/lib/esm/domain/Adapter.js +3 -3
- package/lib/types/adapters/FileSyncAdapter.d.ts +1 -1
- package/lib/types/decorators/injectAdapter.d.ts +1 -1
- package/lib/types/domain/Adapter.d.ts +2 -2
- package/lib/types/domain/AdaptersSettings.d.ts +1 -1
- package/lib/types/services/Adapters.d.ts +1 -1
- package/package.json +10 -11
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { __decorate, __metadata, __param } from "tslib";
|
|
2
|
-
import {
|
|
3
|
-
import { nameOf } from "@tsed/core";
|
|
2
|
+
import { LowDbAdapter } from "./LowDbAdapter.js";
|
|
4
3
|
import { Injectable, Opts, ProviderScope, Scope } from "@tsed/di";
|
|
5
|
-
import fs from "fs-extra";
|
|
6
|
-
import { LowSync } from "lowdb";
|
|
7
4
|
import { JSONFileSync } from "lowdb/node";
|
|
8
|
-
import {
|
|
5
|
+
import { LowSync } from "lowdb";
|
|
6
|
+
import { dirname } from "node:path";
|
|
7
|
+
import fs from "fs-extra";
|
|
8
|
+
import { nameOf } from "@tsed/core";
|
|
9
9
|
let FileSyncAdapter = class FileSyncAdapter extends LowDbAdapter {
|
|
10
10
|
constructor(options) {
|
|
11
11
|
super(options);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { Adapter } from "../domain/Adapter.js";
|
|
2
|
+
import _ from "lodash";
|
|
1
3
|
import { cleanObject } from "@tsed/core";
|
|
2
4
|
import { constant } from "@tsed/di";
|
|
3
|
-
import _ from "lodash";
|
|
4
5
|
import isMatch from "lodash/isMatch.js";
|
|
5
6
|
import { v4 as uuid } from "uuid";
|
|
6
|
-
import { Adapter } from "../domain/Adapter.js";
|
|
7
7
|
export class LowDbAdapter extends Adapter {
|
|
8
8
|
get collection() {
|
|
9
9
|
return this.db.data.collection;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __decorate, __metadata, __param } from "tslib";
|
|
2
|
+
import { LowDbAdapter } from "./LowDbAdapter.js";
|
|
2
3
|
import { Injectable, Opts, ProviderScope, Scope } from "@tsed/di";
|
|
3
4
|
import { Low, Memory } from "lowdb";
|
|
4
|
-
import { LowDbAdapter } from "./LowDbAdapter.js";
|
|
5
5
|
let MemoryAdapter = class MemoryAdapter extends LowDbAdapter {
|
|
6
6
|
constructor(options) {
|
|
7
7
|
super(options);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { classOf, isClass, isString } from "@tsed/core";
|
|
2
|
-
import { Inject, inject } from "@tsed/di";
|
|
3
1
|
import { Adapters } from "../services/Adapters.js";
|
|
2
|
+
import { Inject, inject } from "@tsed/di";
|
|
3
|
+
import { classOf, isClass, isString } from "@tsed/core";
|
|
4
4
|
function mapOptions(args) {
|
|
5
5
|
return args.reduce((options, item, index) => {
|
|
6
6
|
if (isString(item)) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { __decorate, __metadata, __param } from "tslib";
|
|
2
|
-
import { AjvService } from "@tsed/ajv";
|
|
3
|
-
import { classOf, isArray, isPlainObject, nameOf } from "@tsed/core";
|
|
4
|
-
import { constant, inject, Opts } from "@tsed/di";
|
|
5
2
|
import { deserialize, serialize } from "@tsed/json-mapper";
|
|
3
|
+
import { Opts, constant, inject } from "@tsed/di";
|
|
4
|
+
import { classOf, isArray, isPlainObject, nameOf } from "@tsed/core";
|
|
5
|
+
import { AjvService } from "@tsed/ajv";
|
|
6
6
|
import { getPropertiesStores } from "@tsed/schema";
|
|
7
7
|
function getIndexes(model) {
|
|
8
8
|
return [...getPropertiesStores(model).entries()]
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AdapterConstructorOptions } from "../domain/Adapter.js";
|
|
2
1
|
import { AdapterModel, LowDbAdapter } from "./LowDbAdapter.js";
|
|
2
|
+
import { AdapterConstructorOptions } from "../domain/Adapter.js";
|
|
3
3
|
export interface FileSyncAdapterConstructorOptions extends AdapterConstructorOptions {
|
|
4
4
|
readOnly: true;
|
|
5
5
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { AdapterInvokeOptions } from "../services/Adapters.js";
|
|
1
2
|
import { Type } from "@tsed/core";
|
|
2
3
|
import type { Adapter } from "../domain/Adapter.js";
|
|
3
|
-
import { AdapterInvokeOptions } from "../services/Adapters.js";
|
|
4
4
|
export declare function adapter<Model>(options: AdapterInvokeOptions<Model>): Adapter<Model>;
|
|
5
5
|
export declare function adapter<Model>(model: Type<Model>, options?: Partial<Omit<AdapterInvokeOptions, "client">>): Adapter<Model>;
|
|
6
6
|
export declare function adapter<Model>(collectionName: string, model: Type<Model>, options?: Partial<Omit<AdapterInvokeOptions, "collectionName" | "client">>): Adapter<Model>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AjvService } from "@tsed/ajv";
|
|
2
|
-
import { Type } from "@tsed/core";
|
|
3
1
|
import { JsonDeserializerOptions, JsonSerializerOptions } from "@tsed/json-mapper";
|
|
2
|
+
import { Type } from "@tsed/core";
|
|
3
|
+
import { AjvService } from "@tsed/ajv";
|
|
4
4
|
export interface AdapterConstructorOptions<T = any> extends Record<string, any> {
|
|
5
5
|
model: Type<T> | Object;
|
|
6
6
|
collectionName?: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Type } from "@tsed/core";
|
|
2
1
|
import { Adapter, AdapterConstructorOptions } from "../domain/Adapter.js";
|
|
2
|
+
import { Type } from "@tsed/core";
|
|
3
3
|
export interface AdapterInvokeOptions<Model = any> extends AdapterConstructorOptions<Model> {
|
|
4
4
|
adapter?: Type<Adapter<Model>>;
|
|
5
5
|
}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/adapters",
|
|
3
|
+
"version": "8.35.0",
|
|
3
4
|
"description": "Database adapters for Ts.ED",
|
|
4
|
-
"type": "module",
|
|
5
|
-
"version": "8.33.0",
|
|
6
5
|
"source": "./src/index.ts",
|
|
6
|
+
"type": "module",
|
|
7
7
|
"main": "./lib/esm/index.js",
|
|
8
8
|
"module": "./lib/esm/index.js",
|
|
9
9
|
"typings": "./lib/types/index.d.ts",
|
|
@@ -33,16 +33,15 @@
|
|
|
33
33
|
"uuid": "^14.0.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@tsed/ajv": "8.
|
|
37
|
-
"@tsed/barrels": "8.
|
|
38
|
-
"@tsed/core": "8.
|
|
39
|
-
"@tsed/di": "8.
|
|
40
|
-
"@tsed/json-mapper": "8.
|
|
41
|
-
"@tsed/platform-http": "8.
|
|
42
|
-
"@tsed/schema": "8.
|
|
43
|
-
"@tsed/typescript": "8.
|
|
36
|
+
"@tsed/ajv": "8.35.0",
|
|
37
|
+
"@tsed/barrels": "8.35.0",
|
|
38
|
+
"@tsed/core": "8.35.0",
|
|
39
|
+
"@tsed/di": "8.35.0",
|
|
40
|
+
"@tsed/json-mapper": "8.35.0",
|
|
41
|
+
"@tsed/platform-http": "8.35.0",
|
|
42
|
+
"@tsed/schema": "8.35.0",
|
|
43
|
+
"@tsed/typescript": "8.35.0",
|
|
44
44
|
"@types/fs-extra": "11.0.4",
|
|
45
|
-
"eslint": "9.12.0",
|
|
46
45
|
"typescript": "6.0.2",
|
|
47
46
|
"vitest": "4.1.4"
|
|
48
47
|
},
|