@webiny/handler-db
+3
-6
@@ -1,7 +0,4 @@ | ||
| import { ContextPlugin } from "@webiny/api"; | ||
| import { DbContext } from "./types"; | ||
| /** | ||
| * TODO: remove this package. | ||
| */ | ||
| declare const _default: (args: any) => ContextPlugin<DbContext>[]; | ||
| import type { ConstructorArgs } from "@webiny/db"; | ||
| import type { DbContext } from "./types.js"; | ||
| export default _default; | ||
| declare function _default<T = unknown>(args: ConstructorArgs<T>): import("@webiny/handler").RegisterExtensionPlugin<DbContext>[]; |
+15
-23
@@ -1,25 +0,17 @@ | ||
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { | ||
| value: true | ||
| }); | ||
| exports.default = void 0; | ||
| var _db = require("@webiny/db"); | ||
| var _api = require("@webiny/api"); | ||
| /** | ||
| * TODO: remove this package. | ||
| */ | ||
| var _default = args => { | ||
| return [new _api.ContextPlugin(context => { | ||
| if (context.db) { | ||
| return; | ||
| } | ||
| context.db = new _db.Db(args); | ||
| })]; | ||
| import { Db } from "@webiny/db"; | ||
| import { createRegisterExtensionPlugin } from "@webiny/handler"; | ||
| import { DbRegistryFeature } from "@webiny/db/exports/api/db.js"; | ||
| const src = (args)=>{ | ||
| const plugin = createRegisterExtensionPlugin(async (context)=>{ | ||
| if (context.db) return; | ||
| DbRegistryFeature.register(context.container); | ||
| context.db = new Db(args); | ||
| }); | ||
| plugin.name = "handler-db/extension/db"; | ||
| return [ | ||
| plugin | ||
| ]; | ||
| }; | ||
| export default src; | ||
| exports.default = _default; | ||
| //# sourceMappingURL=index.js.map |
+1
-1
@@ -1,1 +0,1 @@ | ||
| {"version":3,"names":["args","ContextPlugin","context","db","Db"],"sources":["index.ts"],"sourcesContent":["import { Db } from \"@webiny/db\";\nimport { ContextPlugin } from \"@webiny/api\";\nimport { DbContext } from \"./types\";\n\n/**\n * TODO: remove this package.\n */\nexport default (args: any) => {\n return [\n new ContextPlugin<DbContext>(context => {\n if (context.db) {\n return;\n }\n context.db = new Db(args);\n })\n ];\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AAGA;AACA;AACA;eACgBA,IAAD,IAAe;EAC1B,OAAO,CACH,IAAIC,kBAAJ,CAA6BC,OAAO,IAAI;IACpC,IAAIA,OAAO,CAACC,EAAZ,EAAgB;MACZ;IACH;;IACDD,OAAO,CAACC,EAAR,GAAa,IAAIC,MAAJ,CAAOJ,IAAP,CAAb;EACH,CALD,CADG,CAAP;AAQH,C"} | ||
| {"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\";\nimport { DbRegistryFeature } from \"@webiny/db/exports/api/db.js\";\n\nexport default <T = unknown>(args: ConstructorArgs<T>) => {\n const plugin = createRegisterExtensionPlugin<DbContext>(async context => {\n if (context.db) {\n return;\n }\n\n DbRegistryFeature.register(context.container);\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","DbRegistryFeature","Db"],"mappings":";;;AAMA,YAAe,CAAcA;IACzB,MAAMC,SAASC,8BAAyC,OAAMC;QAC1D,IAAIA,QAAQ,EAAE,EACV;QAGJC,kBAAkB,QAAQ,CAACD,QAAQ,SAAS;QAE5CA,QAAQ,EAAE,GAAG,IAAIE,GAAML;IAC3B;IACAC,OAAO,IAAI,GAAG;IACd,OAAO;QAACA;KAAO;AACnB"} |
+16
-19
| { | ||
| "name": "@webiny/handler-db", | ||
| "version": "0.0.0-unstable.b6408e0dea", | ||
| "main": "index.js", | ||
| "version": "0.0.0-unstable.b6d7105cee", | ||
| "type": "module", | ||
| "exports": { | ||
| ".": "./index.js", | ||
| "./*": "./*" | ||
| }, | ||
| "license": "MIT", | ||
@@ -13,24 +17,17 @@ "repository": { | ||
| "dependencies": { | ||
| "@babel/runtime": "7.20.13", | ||
| "@webiny/api": "0.0.0-unstable.b6408e0dea", | ||
| "@webiny/db": "0.0.0-unstable.b6408e0dea" | ||
| "@webiny/db": "0.0.0-unstable.b6d7105cee", | ||
| "@webiny/handler": "0.0.0-unstable.b6d7105cee" | ||
| }, | ||
| "devDependencies": { | ||
| "@babel/cli": "^7.19.3", | ||
| "@babel/core": "^7.19.3", | ||
| "@babel/preset-env": "^7.19.4", | ||
| "@webiny/cli": "^0.0.0-unstable.b6408e0dea", | ||
| "@webiny/project-utils": "^0.0.0-unstable.b6408e0dea", | ||
| "rimraf": "^3.0.2", | ||
| "typescript": "4.7.4" | ||
| "@webiny/build-tools": "0.0.0-unstable.b6d7105cee", | ||
| "rimraf": "6.1.3", | ||
| "typescript": "7.0.2" | ||
| }, | ||
| "publishConfig": { | ||
| "access": "public", | ||
| "directory": "dist" | ||
| "access": "public" | ||
| }, | ||
| "scripts": { | ||
| "build": "yarn webiny run build", | ||
| "watch": "yarn webiny run watch" | ||
| }, | ||
| "gitHead": "b6408e0deaa6ea55327b8bb35391d9ea71afee65" | ||
| "gitHead": "8476da73b653c89cc1474d968baf55c1b0ae0e5f", | ||
| "webiny": { | ||
| "publishFrom": "dist" | ||
| } | ||
| } |
+8
-17
@@ -1,20 +0,11 @@ | ||
| # @webiny/handler-db-nedb | ||
| # @webiny/handler-db | ||
| This Webiny API plugin provides a db driver for Nedb. It sets an instance of the Nedb driver to `context.db.driver`. | ||
| > [!NOTE] | ||
| > This package is part of the [Webiny](https://www.webiny.com) monorepo. | ||
| > It’s **included in every Webiny project by default** and is not meant to be used as a standalone package. | ||
| ## How to use | ||
| Add the plugin to the `plugins` section of your service: | ||
| 📘 **Documentation:** [https://www.webiny.com/docs](https://www.webiny.com/docs) | ||
| ```yaml | ||
| myService: | ||
| component: "@webiny/serverless-apollo-service" | ||
| inputs: | ||
| # ... other inputs ... | ||
| plugins: | ||
| # ... other plugins ... | ||
| - factory: "@webiny/handler-db-nedb" | ||
| options: | ||
| database: | ||
| server: NEDB_SERVER_URI | ||
| name: NEDB_DATABASE_NAME | ||
| ``` | ||
| --- | ||
| _This README file is automatically generated during the publish process._ |
+3
-3
@@ -1,5 +0,5 @@ | ||
| import { Db } from "@webiny/db"; | ||
| import { Context } from "@webiny/api/types"; | ||
| import type { Db } from "@webiny/db"; | ||
| import type { Context } from "@webiny/handler/types.js"; | ||
| export interface DbContext extends Context { | ||
| db: Db; | ||
| db: Db<unknown>; | ||
| } |
| {"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":""} |
2
-33.33%3
-57.14%Yes
NaN4161
-3.99%8
-11.11%24
-27.27%11
-47.62%- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed