UNPKG

couchdb-web-node-plugin

Version:

A couchdb server, model instance conflict handler, rest api, authentication, session management, schema validator and model relation guarantee for webNode.

640 lines 21.1 kB
{ "name": "couchdb-web-node-plugin", "version": "2.0.839", "description": "A couchdb server, model instance conflict handler, rest api, authentication, session management, schema validator and model relation guarantee for webNode.", "keywords": [ "api", "authentication", "authorisation", "backend", "database", "model", "rest", "roles", "session", "schema", "user", "validation", "web" ], "homepage": "https://torben.website/couchdb-web-node-plugin", "bugs": { "email": "info@torben.website", "url": "https://github.com/thaibault/couchdb-web-node-plugin/issues" }, "license": "CC-BY-3.0", "author": { "name": "Torben Sickert", "email": "info@torben.website", "url": "https://torben.website" }, "files": [ "databaseHelper.d.ts", "databaseHelper.js", "helper.d.ts", "index.d.ts", "index.js", "loadExpress.d.ts", "loadExpress.js", "helper.js", "type.d.ts", "type.js" ], "repository": { "type": "git", "url": "https://github.com/thaibault/couchdb-web-node-plugin.git" }, "scripts": { "build": "weboptimizer build:types && yarn build:databaseHelper && weboptimizer build", "build:databaseHelper": "weboptimizer build '{__reference__: \"target:databaseHelper\"}'", "check:types": "weboptimizer check:types", "clear": "weboptimizer clear && rimraf log.txt", "document": "weboptimizer document", "lint": "weboptimizer lint", "prepare": "yarn build", "report:coverage": "nyc report --reporter=text-lcov | coveralls", "serve": "yarn build && yarn start", "start": "web-node '{plugin: {hotReloading: true}}'", "test": "yarn build:databaseHelper && weboptimizer test", "test:coverage": "weboptimizer test:coverage", "test:coverage:report": "weboptimizer test:coverage:report", "update:documentation": "web-documentation", "watch": "weboptimizer build --watch" }, "dependencies": { "pouchdb-adapter-http": "^9.0.0", "pouchdb-authentication": "^1.1.3", "pouchdb-find": "^9.0.0", "pouchdb-node": "^9.0.0", "pouchdb-validation": "^4.2.0", "rxjs": "^7.8.2" }, "devDependencies": { "@babel/eslint-parser": "^7.28.6", "@babel/runtime": "^7.29.2", "@eslint/js": "^10.0.1", "@stylistic/eslint-plugin": "^5.10.0", "@types/ejs": "^3.1.5", "@types/express": "^5.0.6", "@types/node": "^25.6.0", "@types/pouchdb-adapter-memory": "^6.1.6", "@types/pouchdb-node": "^6.1.7", "@types/webpack-env": "^1.18.8", "@typescript-eslint/eslint-plugin": "^8.59.0", "@typescript-eslint/parser": "^8.59.0", "clientnode": "^4.0.1388", "eslint": "^10.2.1", "eslint-config-google": "^0.14.0", "eslint-plugin-jsdoc": "^62.9.0", "express": "^5.2.1", "express-pouchdb": "^4.2.0", "jest": "^30.3.0", "jsdoc": "^4.0.5", "mkdirp": "^3.0.1", "node-fetch": "^3.3.2", "pouchdb-adapter-memory": "^9.0.0", "rimraf": "^6.1.3", "typescript-eslint": "^8.59.0", "web-documentation": "^1.0.2", "web-node": "^1.0.581", "weboptimizer": "^3.0.22" }, "peerDependencies": { "@babel/runtime": "*", "clientnode": "*", "express": "*", "express-pouchdb": "*", "mkdirp": "*", "node-fetch": "*", "request": "*", "web-node": "*" }, "peerDependenciesMeta": { "@babel/runtime": { "optional": true }, "express": { "optional": true }, "express-pouchdb": { "optional": true }, "pouchdb-server": { "optional": true } }, "engines": { "node": ">=24", "npm": ">=11", "yarn": ">=4" }, "resolutions": { "colors": "1.4.0", "globals@npm:^9.18.0": "patch:globals@npm%3A11.12.0#~/.yarn/patches/globals-npm-11.12.0-1fa7f41a6c.patch", "globals@npm:^11.1.0": "patch:globals@npm%3A11.12.0#~/.yarn/patches/globals-npm-11.12.0-1fa7f41a6c.patch", "globals@npm:^14.0.0": "patch:globals@npm%3A11.12.0#~/.yarn/patches/globals-npm-11.12.0-1fa7f41a6c.patch", "pouchdb-system-db@npm:4.2.0": "patch:pouchdb-system-db@npm%3A4.2.0#~/.yarn/patches/pouchdb-system-db-npm-4.2.0-317901bdb4.patch" }, "sideEffects": false, "documentationWebsite": { "name": "couchdb-web-node-plugin", "trackingCode": "UA-40192634-21" }, "webNode": { "couchdb": { "attachAutoRestarter": true, "closeTimeoutInSeconds": 30, "runner": { "memoryInMegaByte": "default", "nodePath": "/usr/bin/node", "host": "0.0.0.0", "port": 5984, "variants": [ { "adminUserConfigurationPath": "_node/couchdb@127.0.0.1/_config/admins", "configuration": { "values": { "couchdb/database_dir": { "__evaluate__": "path.resolve(self.couchdb.path)" }, "couchdb/max_attachment_chunk_size": "4294967296", "couchdb/os_process_timeout": "25000", "couchdb/view_index_dir": { "__evaluate__": "path.resolve(self.couchdb.path)" }, "couch_httpd_auth/timeout": { "__evaluate__": "60 ** 2 * 24 * 14" }, "chttpd/require_valid_user": true, "httpd/allow_jsonp": false, "httpd/bind_address": { "__evaluate__": "self.couchdb.runner.host" }, "httpd/enable_cors": false, "httpd/host": { "__evaluate__": "self.couchdb.runner.host" }, "httpd/port": { "__evaluate__": "self.couchdb.runner.port" }, "log/file": "/dev/stdout", "log/level": "warning" }, "prefixes": [ "_node/_local/_config", "_config" ] }, "configurationFile": { "content": { "__evaluate__": "`[couchdb]\\ndatabase_dir = ${path.resolve(self.couchdb.path)}\\nview_index_dir = ${path.resolve(self.couchdb.path)}`" }, "path": { "__evaluate__": "path.resolve(self.couchdb.path, 'local.ini')" } }, "environment": { "ERL_FLAGS": { "__evaluate__": "`-couch_ini /usr/lib/couchdb/etc/default.ini /usr/lib/couchdb/etc/datadirs.ini /etc/couchdb/local.ini ${path.resolve(self.couchdb.path, 'local.ini')}`" } }, "locations": "/usr/lib/couchdb/bin/", "names": "couchdb" }, { "adminUserConfigurationPath": "_config/admins", "configuration": { "__evaluate__": "self.couchdb.runner.variants[0].configuration" }, "arguments": [ "--config", { "__evaluate__": "`./${self.couchdb.path}/database.json`" }, "--dir", { "__evaluate__": "self.couchdb.runner.variants[0].configuration.values['couchdb/database_dir']" }, "#: NOTE: This redundancy seems to be needed to forward ports in docker containers.", "--host", { "__evaluate__": "self.couchdb.runner.host" }, "--port", { "__evaluate__": "`${self.couchdb.runner.port}`" } ], "locations": [ "node_modules/.bin/", "../.bin/" ], "names": "pouchdb-server" }, { "adminUserConfigurationPath": "_config/admins", "configuration": { "configPath": { "__evaluate__": "path.resolve(self.couchdb.path, 'configuration.json')" }, "logPath": "/dev/stdout", "prefix": { "__evaluate__": "path.resolve(self.couchdb.path) + '/'" }, "skip_setup": false }, "packages": [ "express", "express-pouchdb" ], "names": "express-pouchdb" } ] }, "changesStream": { "include_docs": false, "live": true, "return_docs": false, "since": "now", "timeout": false }, "updateForeignKeysChangesStream": { "include_docs": false, "live": true, "return_docs": false, "since": "now", "style": "all_docs", "timeout": false }, "removeDanglingForeignKeysChangesStream": { "include_docs": false, "live": true, "return_docs": false, "since": "now", "style": "all_docs", "timeout": false }, "updateMaterializedViewsChangesStream": { "include_docs": false, "live": true, "return_docs": false, "since": "now", "style": "all_docs", "timeout": false }, "changesStreamReinitializer": { "retries": 5, "retryWaitingFactorInSeconds": 3, "maxmumRetryWaitingTimeInSeconds": 120 }, "numberOfParallelChangesRunner": 1, "connector": { "fetch": { "credentials": "include", "timeout": { "__evaluate__": "5 * 60 * 1000" } }, "fetchInterceptor": { "numberOfRetries": 5, "retryIntervalInSeconds": 0.2, "exponentialBackoff": true, "maximumRetryIntervallInSeconds": 30 }, "skip_setup": false }, "createGenericFlatIndex": true, "databaseName": "main", "debug": false, "ensureAdminPresence": true, "ensureSecuritySettingsPresence": true, "ensureUserPresence": true, "ignoreNoChangeError": true, "local": false, "maximumNumberOfEntitiesInBulkOperation": 10, "maximumRepresentationLength": 1000, "maximumRepresentationTryLength": 1000000, "model": { "autoMigrationPath": "migration", "dateTimeFormat": "iso", "entities": { "_base": { "_attachments": {}, "_deleted": { "type": "boolean" }, "_id": { "mutable": false }, "_maximumAggregatedSize": 100000000, "_minimumAggregatedSize": 0, "_rev": { "mutable": false, "preventVersionCreation": true }, "-type": { "maximumLength": 999, "minimumLength": 1, "nullable": false, "mutable": false, "pattern": { "__evaluate__": "`(?:${self.couchdb.model.property.name.typePattern.public}|${self.couchdb.model.property.name.typePattern.private})`" } } }, "_expressionMapping": { "_additional": { "updateStrategy": "replace", "constraintExecution": { "description": "`Given value \"${newValue}\" should be able to be compiled as template string: ${(() => { try { new Function(`return \\`${newValue}\\``) } catch (error) { return `${error}` } })()}`", "evaluation": "try { new Function(`return \\`${newValue}\\``) } catch (error) { return false }; return true" } }, "_extends": "_stringMapping" }, "_interval": { "_constraintExpressions": { "description": "`You have to ensure that start time is before or equal to end time for models with an ${modelName.replace(/^_+/, '')} specification${pathDescription}.`", "evaluation": "newDocument.start <= newDocument.end" }, "end": { "declaration": "Ende des Intervals", "description": "Ende", "nullable": false, "type": "DateTime" }, "start": { "declaration": "Start des Intervals", "description": "Start", "nullable": false, "type": "DateTime" } }, "_location": { "latitude": { "declaration": "Latitude degree of the represented position.", "description": "Latitude", "maximum": 90, "minimum": -90, "nullable": false, "type": "number" }, "longitude": { "declaration": "Longitude degree of the represented position.", "description": "Longitude", "maximum": 180, "minimum": -180, "nullable": false, "type": "number" } }, "_materializedView": { "_roles": [] }, "_stringMapping": { "_additional": { "updateStrategy": "replace", "declaration": "Templatedata", "description": "String mapped values.", "emptyEqualsNull": false, "type": "string" } }, "_timeTrackable": { "creationDateTime": { "createExpression": "nowUTCTimestamp", "minimum": 1, "mutable": false, "nullable": false, "preventVersionCreation": true, "type": "DateTime" }, "updateDateTime": { "type": "DateTime", "minimum": 0, "nullable": false, "updateExpression": { "__evaluate__": "`(['${self.couchdb.admin.name}', null].includes(userContext.name) || updateStrategy === 'migrate') && oldDocument && oldDocument[name] ? oldDocument[name] : nowUTCTimestamp`" }, "preventVersionCreation": true, "runUpdateHookAlways": true, "constraintExpression": { "evaluate": { "__evaluate__": "`userContext.name === '${self.couchdb.admin.name}' && oldDocument ? true : newValue > ${nowUTCTimestamp}`" } } } }, "_userTrackable": { "lastUser": { "nullable": false, "updateExpression": { "__evaluate__": "`(((['${self.couchdb.admin.name}', null].includes(userContext.name) || updateStrategy === 'migrate') && oldDocument) ? oldDocument[name] : userContext.name) || 'unknown'`" }, "preventVersionCreation": true, "runUpdateHookAlways": true } } }, "property": { "defaultDefinition": { "emptyEqualsNull": true, "maximumAggregatedSize": 100000000, "minimumAggregatedSize": 0, "minimumLength": 0, "minimumNumber": 0, "maximumSize": 10000000, "minimumSize": 0, "mutable": true, "nullable": true, "trim": true, "type": "string", "writable": true }, "name": { "reserved": [], "special": { "additional": "_additional", "role": "_roles", "attachment": "_attachments", "conflict": "_conflicts", "constraint": { "execution": "_constraintExecutions", "expression": "_constraintExpressions" }, "create": { "execution": "_createExecution", "expression": "_createExecution" }, "deleted": "_deleted", "deletedConflict": "_deleted_conflicts", "designDocumentNamePrefix": "_design/", "extend": "_extends", "id": "_id", "localSequence": "_local_seq", "maximumAggregatedSize": "_maximumAggregatedSize", "minimumAggregatedSize": "_minimumAggregatedSize", "oldType": "_oldType", "revision": "_rev", "revisions": "_revisions", "revisionsInformation": "_revs_info", "updateStrategy": "_updateStrategy", "ignoreIfNoOldDocument": "_ignoreIfNoOldDocument", "type": "-type", "update": { "execution": "_updateExecution", "expression": "_updateExpression" } }, "typePattern": { "private": "^_[a-z][A-Za-z0-9]+$", "public": "^[A-Z][A-Za-z0-9]+$" }, "validatedDocumentsCache": "_validatedDocuments" } }, "triggerInitialCompaction": true, "updateConfiguration": true, "updateStrategy": "fillUp", "updateValidation": true }, "path": "database", "security": { "_default": { "admins": { "names": [], "roles": [ "admin" ] }, "members": { "names": [], "roles": [] } }, "_users": { "admins": { "names": [ "admin" ], "roles": [ "admin" ] }, "members": { "names": [ "admin" ], "roles": [ "admin" ] } } }, "skipLatestRevisionDetermining": true, "url": { "__evaluate__": "`http://{1}${self.couchdb.runner.host}:${self.couchdb.runner.port}`" }, "admin": { "name": "admin", "password": "admin" }, "users": [], "materializedViews": {} } }, "webOptimizer": { "assetPattern": { "javaScript": { "excludeFilePathRegularExpression": { "__evaluate__": "2 < self.givenCommandLineArguments.length && self.givenCommandLineArguments[2].startsWith('test') ? '^$' : '.+'" } } }, "exportFormat": { "external": "commonjs2", "self": "commonjs2" }, "generic": { "testCommandLine": "NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules\" jest --config node_modules/weboptimizer/jest.json --noStackTrace --runInBand --test-regex" }, "injection": { "entry": { "__evaluate__": "2 < self.givenCommandLineArguments.length && self.givenCommandLineArguments[2].startsWith('test') ? {testBundle: 'test'} : {helper: './helper', index: './index', loadExpress: './loadExpress', type: './type'}" } }, "module": { "aliases": { "#": "Share same library version.", "node-fetch$": "pouchdb-node/node_modules/node-fetch/lib/index.js" }, "optimizer": { "babelMinify": { "bundle": { "transform": { "#": "To provide a logging output we need to exclude this feature.", "removeConsole": false } }, "#": "Avoids \"Couldn't find intersection\" build error.", "module": false } }, "skipParseRegularExpressions": { "__evaluate__": "/(?:(?:bindings\\/bindings)|(?:colors\\/lib\\/(?:colors)|(?:extendStringPrototype))|(?:encoding\\/lib\\/iconv-loader)|(?:global)|(?:module))\\.js(?:\\?.+|$)/" } }, "targetTechnology": { "boilerplate": "node", "payload": "node" }, "target:databaseHelper": { "injection": { "entry": { "__evaluate__": "{databaseHelper: './databaseHelper'}" } }, "inPlace": { "externalLibrary": { "normal": true } }, "module": { "preprocessor": { "javaScript": { "options": { "plugins": { "__remove__": "@babel/plugin-transform-runtime" } } } } } }, "test": { "injection": { "external": { "implicit": { "pattern": { "exclude": { "#": "NOTE: Theses files are ECMAscript file so have to be processed to work with test-runner.", "__append__": [ { "__evaluate__": "/^(.+\\/)?data-uri-to-buffer(\\/.+)?$/" }, { "__evaluate__": "/^(.+\\/)?fetch-blob(\\/.+)?$/" }, { "__evaluate__": "/^(.+\\/)?node-fetch(\\/.+)?$/" } ] } } } } } } }, "packageManager": "yarn@4.14.1+sha512.64df448055b2d37ba269d7db535a469b8da93f8ef1140c25fd7a83c00a8fbaacb214ca0e02553b92a2c54cef78bb67d0b4817fab02001df0e24fac0faccc3b42" }