Skip to content

Commit

Permalink
refactor(db-proxy): refactor accessor constructor in database-proxy, …
Browse files Browse the repository at this point in the history
…add objectid type as global in runtime; (#1738)

* refactor(db-proxy): refact constructor of accessor
* add ObjectId to global in runtime
  • Loading branch information
maslow authored Dec 14, 2023
1 parent 74db912 commit 3ee12db
Show file tree
Hide file tree
Showing 23 changed files with 1,322 additions and 716 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"strings": true
},
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
"source.fixAll.eslint": "explicit"
},
// eslint
"eslint.alwaysShowStatus": true,
Expand Down Expand Up @@ -78,6 +78,7 @@
"millicores",
"MINIO",
"moby",
"mongorestore",
"MONOG",
"nestjs",
"objs",
Expand Down
316 changes: 246 additions & 70 deletions packages/cloud-sdk/package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions packages/cloud-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lafjs/cloud",
"version": "1.0.0-beta.13-storage-pr5",
"version": "1.0.0-beta.13-storage-pr6",
"description": "The cloud sdk for laf cloud function",
"main": "dist/index.js",
"scripts": {
Expand Down Expand Up @@ -33,8 +33,8 @@
"@types/express": "^4.17.15",
"@types/ws": "^8.5.3",
"axios": "^1.2.1",
"database-proxy": "^1.0.0-beta.12",
"mongodb": "^4.12.1",
"database-proxy": "^1.0.0-beta.12-pr0",
"mongodb": "^5.9.2",
"ws": "^8.11.0"
},
"lint-staged": {
Expand Down
8 changes: 6 additions & 2 deletions packages/database-proxy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
```js
const app = require('express')()
const { Proxy, MongoAccessor, Policy } = require('database-proxy')
const { MongoClient } = require('mongodb')

app.use(express.json())

Expand All @@ -31,9 +32,12 @@ const rules = {
}
}

const client = new MongoClient('mongodb://localhost:27017')
client.connect()

// create an accessor
const accessor = new MongoAccessor('mydb', 'mongodb://localhost:27017', { directConnection: true })
accessor.init()
const accessor = new MongoAccessor(client)


// create a policy
const policy = new Policy(accessor)
Expand Down
Loading

0 comments on commit 3ee12db

Please sign in to comment.