@ldsg/database 0.3.31 → 0.3.33

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.
@@ -1,20 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const resource_1 = require("../resource");
4
- test('database', async () => {
4
+ test("database", async () => {
5
5
  const { MONGODB_URI } = process.env;
6
6
  if (!MONGODB_URI) {
7
- throw new Error('invalid env MONGODB_URI');
7
+ throw new Error("invalid env MONGODB_URI");
8
8
  }
9
9
  const databaseResource = new resource_1.DatabaseResource({
10
- id: 'test-database',
11
- kind: 'database',
12
- parentId: 'test-application',
10
+ id: "test-database",
11
+ kind: "database",
12
+ parentId: "test-application",
13
13
  settings: {
14
- title: '测试表格',
15
- description: '',
16
- uri: MONGODB_URI
17
- }
14
+ title: "测试表格",
15
+ description: "",
16
+ uri: MONGODB_URI,
17
+ },
18
18
  });
19
19
  const connectRes = await databaseResource.connect();
20
20
  expect(connectRes).toBeDefined();
@@ -1,6 +1,6 @@
1
- import { HandlerSpecificResourceSettings } from '@ldsg/handler';
2
- import { ResourceDefinitionSpecificResourceSettings } from '@ldsg/resource-definition';
3
- import { GeneralResourceSettings } from '@ldsg/types';
1
+ import { HandlerSpecificResourceSettings } from "@ldsg/handler";
2
+ import { ResourceDefinitionSpecificResourceSettings } from "@ldsg/resource-definition";
3
+ import { GeneralResourceSettings } from "@ldsg/types";
4
4
  /**
5
5
  * Instantiate Resource Handler General Resource Settings
6
6
  * 实例化资源处理程序普通资源配置
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,0CAA0C,EAAE,MAAM,2BAA2B,CAAC;AACvF,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAEtD;;;GAGG;AACH,eAAO,MAAM,sDAAsD,EAAE,uBAGpE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,uDAAuD,EAAE,+BAOrE,CAAC;AAEF,eAAO,MAAM,6CAA6C,EAAE,uBAG3D,CAAC;AAEF,eAAO,MAAM,8CAA8C,EAAE,0CAE5D,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,0CAA0C,EAAE,MAAM,2BAA2B,CAAC;AACvF,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAEtD;;;GAGG;AACH,eAAO,MAAM,sDAAsD,EAAE,uBAGpE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,uDAAuD,EAAE,+BAQnE,CAAC;AAEJ,eAAO,MAAM,6CAA6C,EAAE,uBAG3D,CAAC;AAEF,eAAO,MAAM,8CAA8C,EAAE,0CAG1D,CAAC"}
package/dist/constants.js CHANGED
@@ -6,8 +6,8 @@ exports.RESOURCE_DEFINITION_SPECIFIC_RESOURCE_SETTINGS = exports.RESOURCE_DEFINI
6
6
  * 实例化资源处理程序普通资源配置
7
7
  */
8
8
  exports.INSTANTIATE_RESOURCE_HANDLER_GENERAL_RESOURCE_SETTINGS = {
9
- title: '数据库实例化资源处理程序',
10
- description: ''
9
+ title: "数据库实例化资源处理程序",
10
+ description: "",
11
11
  };
12
12
  /**
13
13
  * Instantiate Resource Handler Specific Resource Settings
@@ -18,14 +18,14 @@ exports.INSTANTIATE_RESOURCE_HANDLER_SPECIFIC_RESOURCE_SETTINGS = {
18
18
  code: `export * from "@ldsg/database";`,
19
19
  dependencies: [
20
20
  {
21
- name: '@ldsg/database'
22
- }
23
- ]
21
+ name: "@ldsg/database",
22
+ },
23
+ ],
24
24
  };
25
25
  exports.RESOURCE_DEFINITION_GENERAL_RESOURCE_SETTINGS = {
26
- title: '数据库资源定义',
27
- description: ''
26
+ title: "数据库资源定义",
27
+ description: "",
28
28
  };
29
29
  exports.RESOURCE_DEFINITION_SPECIFIC_RESOURCE_SETTINGS = {
30
- kind: 'database'
30
+ kind: "database",
31
31
  };
package/dist/handler.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { Handler } from '@ldsg/handler';
2
- import { InstantiateResourceParams, InstantiateResourceRes } from '@ldsg/resource';
3
- import { DatabaseResource } from './resource';
4
- import { DatabaseSpecificResourceSettings } from './types';
1
+ import { Handler } from "@ldsg/handler";
2
+ import { InstantiateResourceParams, InstantiateResourceRes } from "@ldsg/resource";
3
+ import { DatabaseResource } from "./resource";
4
+ import { DatabaseSpecificResourceSettings } from "./types";
5
5
  export declare const handler: Handler<InstantiateResourceParams<DatabaseSpecificResourceSettings>, InstantiateResourceRes<DatabaseResource>>;
6
6
  //# sourceMappingURL=handler.d.ts.map
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- export * from './constants';
2
- export * from './handler';
3
- export * from './instantiate-resource';
4
- export * from './resource';
5
- export * from './types';
1
+ export * from "./constants";
2
+ export * from "./handler";
3
+ export * from "./instantiate-resource";
4
+ export * from "./resource";
5
+ export * from "./types";
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1,5 +1,5 @@
1
- import { InstantiateResource } from '@ldsg/resource';
2
- import { DatabaseResource } from './resource';
3
- import { DatabaseSpecificResourceSettings } from './types';
1
+ import { InstantiateResource } from "@ldsg/resource";
2
+ import { DatabaseResource } from "./resource";
3
+ import { DatabaseSpecificResourceSettings } from "./types";
4
4
  export declare const instantiateResource: InstantiateResource<DatabaseSpecificResourceSettings, DatabaseResource>;
5
5
  //# sourceMappingURL=instantiate-resource.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"instantiate-resource.d.ts","sourceRoot":"","sources":["../src/instantiate-resource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,gCAAgC,EAAE,MAAM,SAAS,CAAC;AAE3D,eAAO,MAAM,mBAAmB,EAAE,mBAAmB,CAAC,gCAAgC,EAAE,gBAAgB,CAYvG,CAAC"}
1
+ {"version":3,"file":"instantiate-resource.d.ts","sourceRoot":"","sources":["../src/instantiate-resource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,gCAAgC,EAAE,MAAM,SAAS,CAAC;AAE3D,eAAO,MAAM,mBAAmB,EAAE,mBAAmB,CACnD,gCAAgC,EAChC,gBAAgB,CAWjB,CAAC"}
@@ -6,7 +6,7 @@ const instantiateResource = (params) => {
6
6
  const { resourceConstructorParams } = params;
7
7
  const resource = new resource_1.DatabaseResource(resourceConstructorParams);
8
8
  const res = {
9
- resource
9
+ resource,
10
10
  };
11
11
  return res;
12
12
  };
@@ -1,6 +1,6 @@
1
- import { Resource, ResourceConstructorParams } from '@ldsg/resource';
2
- import mongoose from 'mongoose';
3
- import { DatabaseSpecificResourceSettings } from './types';
1
+ import { Resource, ResourceConstructorParams } from "@ldsg/resource";
2
+ import mongoose from "mongoose";
3
+ import { DatabaseSpecificResourceSettings } from "./types";
4
4
  export declare class DatabaseResource extends Resource<DatabaseSpecificResourceSettings> {
5
5
  constructor(params: ResourceConstructorParams<DatabaseSpecificResourceSettings>);
6
6
  getDatabaseInfo: () => {
package/dist/resource.js CHANGED
@@ -10,10 +10,10 @@ class DatabaseResource extends resource_1.Resource {
10
10
  constructor(params) {
11
11
  super(params);
12
12
  this.getDatabaseInfo = () => {
13
- const { settings: { uri: settingsUri, connectOptions = {} } } = this;
13
+ const { settings: { uri: settingsUri, connectOptions = {} }, } = this;
14
14
  const uri = settingsUri || process.env.MONGODB_URI;
15
15
  if (!uri) {
16
- throw new Error('the uri in the database resource is not defined');
16
+ throw new Error("the uri in the database resource is not defined");
17
17
  }
18
18
  return { uri, connectOptions };
19
19
  };
@@ -1,2 +1,2 @@
1
- export * from './specific-resource-settings';
1
+ export * from "./specific-resource-settings";
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1,5 +1,5 @@
1
- import { z } from 'zod';
2
- import { ConnectOptions } from 'mongoose';
1
+ import { z } from "zod";
2
+ import { ConnectOptions } from "mongoose";
3
3
  export declare const DatabaseSpecificResourceSettingsSchema: z.ZodObject<{
4
4
  uri: z.ZodString;
5
5
  connectOptions: z.ZodOptional<z.ZodCustom<ConnectOptions, ConnectOptions>>;
@@ -1 +1 @@
1
- {"version":3,"file":"specific-resource-settings.d.ts","sourceRoot":"","sources":["../../src/types/specific-resource-settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,eAAO,MAAM,sCAAsC;;;8BAY/B,CAAC;AAErB,eAAO,MAAM,8BAA8B;;;8BAAyC,CAAC;AACrF,MAAM,MAAM,gCAAgC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sCAAsC,CAAC,CAAC"}
1
+ {"version":3,"file":"specific-resource-settings.d.ts","sourceRoot":"","sources":["../../src/types/specific-resource-settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,eAAO,MAAM,sCAAsC;;;8BAY/B,CAAC;AAErB,eAAO,MAAM,8BAA8B;;;8BAAyC,CAAC;AACrF,MAAM,MAAM,gCAAgC,GAAG,CAAC,CAAC,KAAK,CACpD,OAAO,sCAAsC,CAC9C,CAAC"}
@@ -11,7 +11,7 @@ exports.DatabaseSpecificResourceSettingsSchema = zod_1.z
11
11
  /**
12
12
  * Connect Options
13
13
  */
14
- connectOptions: zod_1.z.custom().optional()
14
+ connectOptions: zod_1.z.custom().optional(),
15
15
  })
16
16
  .catchall(zod_1.z.any());
17
17
  exports.SpecificResourceSettingsSchema = exports.DatabaseSpecificResourceSettingsSchema;
package/package.json CHANGED
@@ -1,40 +1,44 @@
1
1
  {
2
2
  "name": "@ldsg/database",
3
- "version": "0.3.31",
3
+ "version": "0.3.33",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "license": "MIT",
7
7
  "author": "wanxger",
8
- "main": "dist/index.js",
9
- "types": "dist",
10
8
  "files": [
11
9
  "dist/"
12
10
  ],
11
+ "main": "dist/index.js",
12
+ "types": "dist",
13
+ "publishConfig": {
14
+ "access": "public"
15
+ },
13
16
  "dependencies": {
14
17
  "mongoose": "^8.14.3",
15
18
  "zod": "^4.1.11",
16
- "@ldsg/constants": "0.3.31",
17
- "@ldsg/handler": "0.3.31",
18
- "@ldsg/resource-definition": "0.3.31",
19
- "@ldsg/types": "0.3.31",
20
- "@ldsg/resource": "0.3.31"
19
+ "@ldsg/constants": "0.3.33",
20
+ "@ldsg/handler": "0.3.33",
21
+ "@ldsg/types": "0.3.33",
22
+ "@ldsg/resource": "0.3.33",
23
+ "@ldsg/resource-definition": "0.3.33"
21
24
  },
22
25
  "devDependencies": {
23
26
  "@types/jest": "^29.5.2",
24
27
  "@types/node": "^20.13.0",
25
28
  "@types/supertest": "^6.0.0",
26
29
  "jest": "^29.5.0",
30
+ "oxfmt": "latest",
31
+ "oxlint": "latest",
27
32
  "supertest": "^6.3.4",
28
33
  "ts-jest": "^29.1.5",
29
34
  "ts-node": "^10.9.2",
30
35
  "typescript": "^5.8.3"
31
36
  },
32
- "publishConfig": {
33
- "access": "public"
34
- },
35
37
  "scripts": {
36
38
  "build": "tsc --project tsconfig.build.json",
37
39
  "clean": "rm -rf dist",
40
+ "format": "oxfmt --write src/",
41
+ "lint": "oxlint src/",
38
42
  "test": "jest"
39
43
  }
40
44
  }