@webiny/handler-db 0.0.0-unstable.79032b23a5 β 0.0.0-unstable.7be00a75a9
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 +8 -17
- package/index.d.ts +3 -6
- package/index.js +14 -19
- package/index.js.map +1 -1
- package/package.json +16 -19
- package/types.d.ts +3 -3
- package/types.js +0 -5
- package/types.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,20 +1,11 @@
|
|
|
1
|
-
# @webiny/handler-db
|
|
1
|
+
# @webiny/handler-db
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> [!NOTE]
|
|
4
|
+
> This package is part of the [Webiny](https://www.webiny.com) monorepo.
|
|
5
|
+
> Itβs **included in every Webiny project by default** and is not meant to be used as a standalone package.
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
Add the plugin to the `plugins` section of your service:
|
|
7
|
+
π **Documentation:** [https://www.webiny.com/docs](https://www.webiny.com/docs)
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
inputs:
|
|
12
|
-
# ... other inputs ...
|
|
13
|
-
plugins:
|
|
14
|
-
# ... other plugins ...
|
|
15
|
-
- factory: "@webiny/handler-db-nedb"
|
|
16
|
-
options:
|
|
17
|
-
database:
|
|
18
|
-
server: NEDB_SERVER_URI
|
|
19
|
-
name: NEDB_DATABASE_NAME
|
|
20
|
-
```
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
_This README file is automatically generated during the publish process._
|
package/index.d.ts
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { DbContext } from "./types";
|
|
3
|
-
|
|
4
|
-
* TODO: remove this package.
|
|
5
|
-
*/
|
|
6
|
-
declare const _default: (args: any) => ContextPlugin<DbContext>[];
|
|
1
|
+
import type { ConstructorArgs } from "@webiny/db";
|
|
2
|
+
import type { DbContext } from "./types.js";
|
|
3
|
+
declare const _default: <T = unknown>(args: ConstructorArgs<T>) => import("@webiny/handler").RegisterExtensionPlugin<DbContext>[];
|
|
7
4
|
export default _default;
|
package/index.js
CHANGED
|
@@ -1,20 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var _default = args => {
|
|
13
|
-
return [new _api.ContextPlugin(context => {
|
|
14
|
-
if (context.db) {
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
context.db = new _db.Db(args);
|
|
18
|
-
})];
|
|
1
|
+
import { Db } from "@webiny/db";
|
|
2
|
+
import { createRegisterExtensionPlugin } from "@webiny/handler";
|
|
3
|
+
const src = (args)=>{
|
|
4
|
+
const plugin = createRegisterExtensionPlugin(async (context)=>{
|
|
5
|
+
if (context.db) return;
|
|
6
|
+
context.db = new Db(args);
|
|
7
|
+
});
|
|
8
|
+
plugin.name = "handler-db/extension/db";
|
|
9
|
+
return [
|
|
10
|
+
plugin
|
|
11
|
+
];
|
|
19
12
|
};
|
|
20
|
-
|
|
13
|
+
export default src;
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import type { ConstructorArgs } from \"@webiny/db\";\nimport { Db } from \"@webiny/db\";\nimport { createRegisterExtensionPlugin } from \"@webiny/handler\";\nimport type { DbContext } from \"./types.js\";\n\nexport default <T = unknown>(args: ConstructorArgs<T>) => {\n const plugin = createRegisterExtensionPlugin<DbContext>(async context => {\n if (context.db) {\n return;\n }\n context.db = new Db<T>(args);\n });\n plugin.name = \"handler-db/extension/db\";\n return [plugin];\n};\n"],"names":["args","plugin","createRegisterExtensionPlugin","context","Db"],"mappings":";;AAKA,YAAe,CAAcA;IACzB,MAAMC,SAASC,8BAAyC,OAAMC;QAC1D,IAAIA,QAAQ,EAAE,EACV;QAEJA,QAAQ,EAAE,GAAG,IAAIC,GAAMJ;IAC3B;IACAC,OAAO,IAAI,GAAG;IACd,OAAO;QAACA;KAAO;AACnB"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/handler-db",
|
|
3
|
-
"version": "0.0.0-unstable.
|
|
4
|
-
"
|
|
3
|
+
"version": "0.0.0-unstable.7be00a75a9",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"exports": {
|
|
6
|
+
".": "./index.js",
|
|
7
|
+
"./*": "./*"
|
|
8
|
+
},
|
|
5
9
|
"license": "MIT",
|
|
6
10
|
"repository": {
|
|
7
11
|
"type": "git",
|
|
@@ -10,26 +14,19 @@
|
|
|
10
14
|
"description": "Webiny API plugin that provides a db driver for DynamoDB.",
|
|
11
15
|
"author": "Webiny Ltd.",
|
|
12
16
|
"dependencies": {
|
|
13
|
-
"@
|
|
14
|
-
"@webiny/
|
|
15
|
-
"@webiny/db": "0.0.0-unstable.79032b23a5"
|
|
17
|
+
"@webiny/db": "0.0.0-unstable.7be00a75a9",
|
|
18
|
+
"@webiny/handler": "0.0.0-unstable.7be00a75a9"
|
|
16
19
|
},
|
|
17
20
|
"devDependencies": {
|
|
18
|
-
"@
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"@webiny/cli": "^0.0.0-unstable.79032b23a5",
|
|
22
|
-
"@webiny/project-utils": "^0.0.0-unstable.79032b23a5",
|
|
23
|
-
"rimraf": "^3.0.2",
|
|
24
|
-
"typescript": "4.7.4"
|
|
21
|
+
"@webiny/build-tools": "0.0.0-unstable.7be00a75a9",
|
|
22
|
+
"rimraf": "6.1.3",
|
|
23
|
+
"typescript": "6.0.3"
|
|
25
24
|
},
|
|
26
25
|
"publishConfig": {
|
|
27
|
-
"access": "public"
|
|
28
|
-
"directory": "dist"
|
|
29
|
-
},
|
|
30
|
-
"scripts": {
|
|
31
|
-
"build": "yarn webiny run build",
|
|
32
|
-
"watch": "yarn webiny run watch"
|
|
26
|
+
"access": "public"
|
|
33
27
|
},
|
|
34
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "8476da73b653c89cc1474d968baf55c1b0ae0e5f",
|
|
29
|
+
"webiny": {
|
|
30
|
+
"publishFrom": "dist"
|
|
31
|
+
}
|
|
35
32
|
}
|
package/types.d.ts
CHANGED
package/types.js
CHANGED
package/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import { Db } from \"@webiny/db\";\nimport { Context } from \"@webiny/api/types\";\n\nexport interface DbContext extends Context {\n db: Db;\n}\n"],"mappings":""}
|