@platformatic/db-core 3.4.1 → 3.5.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/README.md +1 -1
- package/eslint.config.js +2 -6
- package/index.js +24 -19
- package/package.json +13 -9
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ This modules wraps [`@platformatic/sql-mapper`](https://www.npmjs.com/package/@p
|
|
|
5
5
|
[`@platformatic/sql-openapi`](https://www.npmjs.com/package/@platformatic/sql-openapi) in a convenient [Fastify](https://www.fastify.io/)
|
|
6
6
|
plugin.
|
|
7
7
|
|
|
8
|
-
Check out the full documentation for Platformatic DB on [our website](https://docs.platformatic.dev/docs/getting-started/quick-start
|
|
8
|
+
Check out the full documentation for Platformatic DB on [our website](https://docs.platformatic.dev/docs/getting-started/quick-start).
|
|
9
9
|
|
|
10
10
|
## Install
|
|
11
11
|
|
package/eslint.config.js
CHANGED
package/index.js
CHANGED
|
@@ -1,26 +1,31 @@
|
|
|
1
|
-
|
|
1
|
+
import sqlMapper from '@platformatic/sql-mapper'
|
|
2
|
+
import fp from 'fastify-plugin'
|
|
3
|
+
import { createRequire } from 'node:module'
|
|
2
4
|
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
+
const defaults = [
|
|
6
|
+
{
|
|
7
|
+
module: '@platformatic/sql-events',
|
|
8
|
+
configKey: 'events'
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
module: '@platformatic/sql-graphql',
|
|
12
|
+
configKey: 'graphql'
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
module: '@platformatic/sql-openapi',
|
|
16
|
+
configKey: 'openapi'
|
|
17
|
+
}
|
|
18
|
+
]
|
|
5
19
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
configKey: 'events',
|
|
9
|
-
}, {
|
|
10
|
-
module: '@platformatic/sql-graphql',
|
|
11
|
-
configKey: 'graphql',
|
|
12
|
-
}, {
|
|
13
|
-
module: '@platformatic/sql-openapi',
|
|
14
|
-
configKey: 'openapi',
|
|
15
|
-
}]
|
|
20
|
+
export default fp(async function (app, opts) {
|
|
21
|
+
const require = createRequire(import.meta.url)
|
|
16
22
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
...opts,
|
|
23
|
+
await app.register(sqlMapper, {
|
|
24
|
+
...opts
|
|
20
25
|
})
|
|
21
26
|
|
|
22
27
|
for (const obj of defaults) {
|
|
23
|
-
registerAndConfig(obj)
|
|
28
|
+
await registerAndConfig(obj)
|
|
24
29
|
}
|
|
25
30
|
|
|
26
31
|
function registerAndConfig ({ module, configKey }) {
|
|
@@ -28,7 +33,7 @@ module.exports = fp(async function (app, opts) {
|
|
|
28
33
|
const sqlModule = require(module)
|
|
29
34
|
const config = typeof opts[configKey] === 'object' ? opts[configKey] : {}
|
|
30
35
|
return app.register(sqlModule, {
|
|
31
|
-
...config
|
|
36
|
+
...config
|
|
32
37
|
})
|
|
33
38
|
}
|
|
34
39
|
}
|
|
@@ -80,4 +85,4 @@ function shouldRegister (opts, configKey) {
|
|
|
80
85
|
return true
|
|
81
86
|
}
|
|
82
87
|
|
|
83
|
-
|
|
88
|
+
export { connect } from '@platformatic/sql-mapper'
|
package/package.json
CHANGED
|
@@ -1,35 +1,39 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platformatic/db-core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
|
+
"type": "module",
|
|
6
7
|
"repository": {
|
|
7
8
|
"type": "git",
|
|
8
9
|
"url": "git+https://github.com/platformatic/platformatic.git"
|
|
9
10
|
},
|
|
10
|
-
"author": "
|
|
11
|
+
"author": "Platformatic Inc. <oss@platformatic.dev> (https://platformatic.dev)",
|
|
11
12
|
"license": "Apache-2.0",
|
|
12
13
|
"bugs": {
|
|
13
14
|
"url": "https://github.com/platformatic/platformatic/issues"
|
|
14
15
|
},
|
|
15
16
|
"homepage": "https://github.com/platformatic/platformatic#readme",
|
|
16
17
|
"devDependencies": {
|
|
17
|
-
"
|
|
18
|
+
"cleaner-spec-reporter": "^0.5.0",
|
|
18
19
|
"eslint": "9",
|
|
19
20
|
"fastify": "^5.0.0",
|
|
20
|
-
"neostandard": "^0.
|
|
21
|
+
"neostandard": "^0.12.0",
|
|
21
22
|
"typescript": "^5.5.4",
|
|
22
23
|
"why-is-node-running": "^2.2.2"
|
|
23
24
|
},
|
|
24
25
|
"dependencies": {
|
|
25
26
|
"fastify-plugin": "^5.0.0",
|
|
26
|
-
"@platformatic/sql-events": "3.
|
|
27
|
-
"@platformatic/sql-
|
|
28
|
-
"@platformatic/sql-
|
|
29
|
-
"@platformatic/sql-
|
|
27
|
+
"@platformatic/sql-events": "3.5.1",
|
|
28
|
+
"@platformatic/sql-mapper": "3.5.1",
|
|
29
|
+
"@platformatic/sql-openapi": "3.5.1",
|
|
30
|
+
"@platformatic/sql-graphql": "3.5.1"
|
|
31
|
+
},
|
|
32
|
+
"engines": {
|
|
33
|
+
"node": ">=22.19.0"
|
|
30
34
|
},
|
|
31
35
|
"scripts": {
|
|
32
|
-
"test": "
|
|
36
|
+
"test": "node --test --test-reporter=cleaner-spec-reporter --test-concurrency=1 --test-timeout=2000000 test/*.test.js",
|
|
33
37
|
"lint": "eslint"
|
|
34
38
|
}
|
|
35
39
|
}
|