couchdb-web-node-plugin 1.0.799 → 1.0.800
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/databaseHelper.d.ts +3 -7
- package/databaseHelper.js +1 -1
- package/helper.d.ts +49 -10
- package/helper.js +1 -1
- package/index.d.ts +2 -1
- package/index.js +1 -1
- package/loadExpress.d.ts +24 -0
- package/loadExpress.js +1 -0
- package/package.json +80 -49
- package/type.d.ts +20 -5
package/helper.d.ts
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
import { Logger, Mapping, ValueOf } from 'clientnode';
|
|
2
|
-
import {
|
|
2
|
+
import { Express } from 'express-serve-static-core';
|
|
3
|
+
import { AllowedModelRolesMapping, AllowedRoles, Configuration, Connection, Connector, ConnectorConfiguration, CoreConfiguration, DatabaseConnectorConfiguration, Model, ModelConfiguration, Models, NormalizedAllowedRoles, PropertySpecification, State, Services, SpecialPropertyNames } from './type';
|
|
3
4
|
export declare const TOGGLE_LATEST_REVISION_DETERMINING: unique symbol;
|
|
4
5
|
export declare const log: Logger;
|
|
6
|
+
/**
|
|
7
|
+
* Determines plugin to hook into any write operations.
|
|
8
|
+
* @param configuration - This's plugin configuration object.
|
|
9
|
+
* @returns A pouchdb plugin in object style.
|
|
10
|
+
*/
|
|
11
|
+
export declare const getPouchDBPlugin: (configuration: CoreConfiguration) => {
|
|
12
|
+
installCouchDBWebNodePlugin: (this: Connection, description: string) => void;
|
|
13
|
+
};
|
|
5
14
|
export declare const removeDeprecatedIndexes: (connection: Connection<object>, models: Models, modelConfiguration: ModelConfiguration) => Promise<void>;
|
|
6
15
|
/**
|
|
7
16
|
* Converts internal declarative database connector configuration object
|
|
@@ -39,21 +48,51 @@ export declare const mayStripRepresentation: (object: unknown, maximumRepresenta
|
|
|
39
48
|
* successfully.
|
|
40
49
|
*/
|
|
41
50
|
export declare const ensureValidationDocumentPresence: (databaseConnection: Connection, documentName: string, documentData: Mapping, description: string, doLogging?: boolean, idName?: SpecialPropertyNames["id"], revisionName?: SpecialPropertyNames["revision"], designDocumentNamePrefix?: string) => Promise<void>;
|
|
42
|
-
/**
|
|
43
|
-
* Generates function to apply "latest/upsert" and ignore "NoChange" error
|
|
44
|
-
* plugin for couchdb "bulkDocs" operations.
|
|
45
|
-
* @param nativeBulkDocs - Original bulkDocs function to wrap.
|
|
46
|
-
* @param configuration - Couchdb configuration object.
|
|
47
|
-
* @returns Whatever bulkDocs returns.
|
|
48
|
-
*/
|
|
49
|
-
export declare const bulkDocsFactory: (nativeBulkDocs: Connection["bulkDocs"], configuration: CoreConfiguration) => DatabasePlugin;
|
|
50
51
|
/**
|
|
51
52
|
* Initializes a database connection instance.
|
|
52
53
|
* @param services - An object with stored service instances.
|
|
53
54
|
* @param configuration - Mutable by plugins extended configuration object.
|
|
55
|
+
* @param createRemoteDatabaseIfNotExists - Indicates whether database should
|
|
56
|
+
* be created if it does not exist yet. This is only relevant for remote
|
|
57
|
+
* databases, because local ones get created automatically by pouchdb.
|
|
54
58
|
* @returns Given and extended object of services.
|
|
55
59
|
*/
|
|
56
|
-
export declare const initializeConnection: (services: Services, configuration: Configuration) => Promise<Services>;
|
|
60
|
+
export declare const initializeConnection: (services: Services, configuration: Configuration, createRemoteDatabaseIfNotExists?: boolean) => Promise<Services>;
|
|
61
|
+
/**
|
|
62
|
+
* Determines the effective database URL to connect to based on given
|
|
63
|
+
* configuration.
|
|
64
|
+
* @param configuration - Couchdb configuration object.
|
|
65
|
+
* @param withDatabase - Indicates whether the URL should contain the database
|
|
66
|
+
* name or not.
|
|
67
|
+
* @param withCredentials - Indicates whether the URL should contain the
|
|
68
|
+
* credentials or not.
|
|
69
|
+
* @returns The effective URL.
|
|
70
|
+
*/
|
|
71
|
+
export declare const getEffectiveURL: (configuration: CoreConfiguration, withDatabase?: boolean, withCredentials?: boolean) => string;
|
|
72
|
+
/**
|
|
73
|
+
* Initializes an express instance connected with pouchdb.
|
|
74
|
+
* @param name - Instance name.
|
|
75
|
+
* @param state - Application state.
|
|
76
|
+
* @param connector - Database connector instance.
|
|
77
|
+
* @param configuration - Couchdb configuration object.
|
|
78
|
+
* @param pluginAPI - Plugin API to call plugin hooks.
|
|
79
|
+
* @param expressUtilities - Optional express related utilities.
|
|
80
|
+
* @returns A promise resolving to the wrapping express instance and pouchdb's
|
|
81
|
+
* express instance.
|
|
82
|
+
*/
|
|
83
|
+
export declare const initializeExpress: (name: string, state: State, connector: Connector, configuration: CoreConfiguration, pluginAPI: State["pluginAPI"], expressUtilities?: (typeof import("./loadExpress"))["default"]) => Promise<{
|
|
84
|
+
expressInstance: Express;
|
|
85
|
+
expressPouchDBInstance: Express;
|
|
86
|
+
}>;
|
|
87
|
+
/**
|
|
88
|
+
* Waits for given promise to be resolved or given timeout has been exceeded.
|
|
89
|
+
* @param promise - Promise to wait for.
|
|
90
|
+
* @param timeoutInSeconds - Timeout in seconds.
|
|
91
|
+
* @param description - Used to produce semantic logging messages.
|
|
92
|
+
* @returns A promise which will be resolved after given promise is resolved or
|
|
93
|
+
* given timeout has been exceeded.
|
|
94
|
+
*/
|
|
95
|
+
export declare const waitWithTimeout: (promise: Promise<unknown>, timeoutInSeconds: number, description: string) => Promise<void>;
|
|
57
96
|
/**
|
|
58
97
|
* Determines a mapping of all models to roles who are allowed to edit
|
|
59
98
|
* corresponding model instances.
|