@webiny/handler-db 0.0.0-mt-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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) Webiny
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,20 @@
1
+ # @webiny/handler-db-nedb
2
+
3
+ This Webiny API plugin provides a db driver for Nedb. It sets an instance of the Nedb driver to `context.db.driver`.
4
+
5
+ ## How to use
6
+ Add the plugin to the `plugins` section of your service:
7
+
8
+ ```yaml
9
+ myService:
10
+ component: "@webiny/serverless-apollo-service"
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
+ ```
package/index.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ import { ContextPlugin } from "@webiny/handler/plugins/ContextPlugin";
2
+ import { DbContext } from "./types";
3
+ declare const _default: (args: any) => ContextPlugin<DbContext>[];
4
+ export default _default;
package/index.js ADDED
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _db = require("@webiny/db");
9
+
10
+ var _ContextPlugin = require("@webiny/handler/plugins/ContextPlugin");
11
+
12
+ var _default = args => {
13
+ return [new _ContextPlugin.ContextPlugin(context => {
14
+ if (context.db) {
15
+ return;
16
+ }
17
+
18
+ context.db = new _db.Db(args);
19
+ })];
20
+ };
21
+
22
+ exports.default = _default;
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@webiny/handler-db",
3
+ "version": "0.0.0-mt-1",
4
+ "main": "index.js",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/webiny/webiny-js.git"
9
+ },
10
+ "description": "Webiny API plugin that provides a db driver for DynamoDB.",
11
+ "author": "Webiny Ltd.",
12
+ "dependencies": {
13
+ "@babel/runtime": "7.15.4",
14
+ "@webiny/db": "0.0.0-mt-1",
15
+ "@webiny/handler": "0.0.0-mt-1"
16
+ },
17
+ "devDependencies": {
18
+ "@babel/cli": "^7.5.5",
19
+ "@babel/core": "^7.5.5",
20
+ "@babel/preset-env": "^7.5.5",
21
+ "@webiny/cli": "^0.0.0-mt-1",
22
+ "@webiny/project-utils": "^0.0.0-mt-1",
23
+ "rimraf": "^3.0.2",
24
+ "typescript": "^4.1.3"
25
+ },
26
+ "publishConfig": {
27
+ "access": "public",
28
+ "directory": "dist"
29
+ },
30
+ "scripts": {
31
+ "build": "yarn webiny run build",
32
+ "watch": "yarn webiny run watch"
33
+ },
34
+ "gitHead": "37736d8456a6ecb342a6c3645060bd9a3f2d4bb0"
35
+ }
package/types.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ import { Db } from "@webiny/db";
2
+ export declare type DbContext = {
3
+ db: Db;
4
+ };
package/types.js ADDED
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });