couchdb-web-node-plugin 1.0.593 → 1.0.595
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/package.json +1 -1
- package/type.d.ts +21 -20
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "couchdb-web-node-plugin",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.595",
|
|
4
4
|
"description": "A couchdb server, model instance conflict handler, rest api, authentication, session management, schema validator and model relation guarantee for webNode.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"api",
|
package/type.d.ts
CHANGED
|
@@ -61,7 +61,7 @@ export interface SelectionMapping {
|
|
|
61
61
|
label: string;
|
|
62
62
|
value: unknown;
|
|
63
63
|
}
|
|
64
|
-
export interface PropertySpecification<Type = unknown> {
|
|
64
|
+
export interface PropertySpecification<Type = unknown, AdditionalSpecifications extends Mapping<unknown> = Mapping<unknown>> {
|
|
65
65
|
allowedRoles?: AllowedRoles | null;
|
|
66
66
|
computed?: boolean;
|
|
67
67
|
arrayConstraintExecution?: Constraint | null;
|
|
@@ -102,9 +102,10 @@ export interface PropertySpecification<Type = unknown> {
|
|
|
102
102
|
index?: boolean | null;
|
|
103
103
|
oldName?: Array<string> | null | string;
|
|
104
104
|
value?: null | Type;
|
|
105
|
+
additionalSpecifications?: AdditionalSpecifications;
|
|
105
106
|
}
|
|
106
|
-
export interface FileSpecification<Type = Attachment> extends PropertySpecification<Type> {
|
|
107
|
-
fileName?: PropertySpecification<string>;
|
|
107
|
+
export interface FileSpecification<Type = Attachment, AdditionalSpecifications extends Mapping<unknown> = Mapping<unknown>> extends PropertySpecification<Type, AdditionalSpecifications> {
|
|
108
|
+
fileName?: PropertySpecification<string, AdditionalSpecifications>;
|
|
108
109
|
}
|
|
109
110
|
export interface BaseModel {
|
|
110
111
|
_allowedRoles?: AllowedRoles | null;
|
|
@@ -120,8 +121,8 @@ export interface BaseModel {
|
|
|
120
121
|
_onUpdateExecution?: null | string;
|
|
121
122
|
_onUpdateExpression?: null | string;
|
|
122
123
|
}
|
|
123
|
-
export type Model<Type = unknown> = BaseModel & Mapping<PropertySpecification<Type>>;
|
|
124
|
-
export type Models = Mapping<Model
|
|
124
|
+
export type Model<Type = unknown, AdditionalSpecifications extends Mapping<unknown> = Mapping<unknown>> = BaseModel & Mapping<PropertySpecification<Type, AdditionalSpecifications>>;
|
|
125
|
+
export type Models<Type = unknown, AdditionalSpecifications extends Mapping<unknown> = Mapping<unknown>> = Mapping<Model<Type, AdditionalSpecifications>>;
|
|
125
126
|
export type UpdateStrategy = '' | 'fillUp' | 'incremental' | 'migrate';
|
|
126
127
|
export type DocumentContent = Array<DocumentContent> | PlainObject | Primitive;
|
|
127
128
|
export type DocumentStrategyMeta = {
|
|
@@ -174,17 +175,17 @@ export interface PropertyNameConfiguration {
|
|
|
174
175
|
};
|
|
175
176
|
validatedDocumentsCache: string;
|
|
176
177
|
}
|
|
177
|
-
export interface BaseModelConfiguration<Type = unknown> {
|
|
178
|
+
export interface BaseModelConfiguration<Type = unknown, AdditionalSpecifications extends Mapping<unknown> = Mapping<unknown>> {
|
|
178
179
|
dateTimeFormat: 'iso' | 'iso8601' | 'number';
|
|
179
180
|
property: {
|
|
180
|
-
defaultSpecification: PropertySpecification<Type>;
|
|
181
|
+
defaultSpecification: PropertySpecification<Type, AdditionalSpecifications>;
|
|
181
182
|
name: PropertyNameConfiguration;
|
|
182
183
|
};
|
|
183
184
|
updateStrategy: UpdateStrategy;
|
|
184
185
|
}
|
|
185
|
-
export interface ModelConfiguration<Type = unknown> extends BaseModelConfiguration<Type> {
|
|
186
|
+
export interface ModelConfiguration<Type = unknown, AdditionalSpecifications extends Mapping<unknown> = Mapping<unknown>> extends BaseModelConfiguration<Type, AdditionalSpecifications> {
|
|
186
187
|
autoMigrationPath: string;
|
|
187
|
-
entities: Models
|
|
188
|
+
entities: Models<Type, AdditionalSpecifications>;
|
|
188
189
|
triggerInitialCompaction: boolean;
|
|
189
190
|
updateConfiguration: boolean;
|
|
190
191
|
updateValidation: boolean;
|
|
@@ -310,7 +311,7 @@ export interface CompilationErrorData<S = Mapping<unknown>> extends EvaluationEr
|
|
|
310
311
|
export interface RuntimeErrorData<S = Mapping<unknown>> extends EvaluationErrorData<S> {
|
|
311
312
|
runtime: string;
|
|
312
313
|
}
|
|
313
|
-
export interface BasicScope<Type = unknown> {
|
|
314
|
+
export interface BasicScope<Type = unknown, AdditionalSpecifications extends Mapping<unknown> = Mapping<unknown>> {
|
|
314
315
|
attachmentWithPrefixExists: (namePrefix: string) => boolean;
|
|
315
316
|
checkDocument: (newDocument: PartialFullDocument, oldDocument: PartialFullDocument | null, parentNames: Array<string>) => CheckedDocumentResult;
|
|
316
317
|
getFileNameByPrefix: (prefix?: string, attachments?: Attachments) => null | string;
|
|
@@ -321,16 +322,16 @@ export interface BasicScope<Type = unknown> {
|
|
|
321
322
|
revisionName: string;
|
|
322
323
|
specialNames: SpecialPropertyNames;
|
|
323
324
|
typeName: string;
|
|
324
|
-
modelConfiguration: BaseModelConfiguration<Type>;
|
|
325
|
-
models: Models
|
|
325
|
+
modelConfiguration: BaseModelConfiguration<Type, AdditionalSpecifications>;
|
|
326
|
+
models: Models<Type, AdditionalSpecifications>;
|
|
326
327
|
now: Date;
|
|
327
328
|
nowUTCTimestamp: number;
|
|
328
329
|
securitySettings: Partial<SecuritySettings>;
|
|
329
330
|
userContext: Partial<UserContext>;
|
|
330
331
|
}
|
|
331
|
-
export interface CommonScope<Type> {
|
|
332
|
-
checkPropertyContent: (newValue: unknown, name: string, propertySpecification: PropertySpecification<Type>, oldValue: unknown) => CheckedPropertyResult;
|
|
333
|
-
model: Model<Type>;
|
|
332
|
+
export interface CommonScope<Type, AdditionalSpecifications extends Mapping<unknown> = Mapping<unknown>> {
|
|
333
|
+
checkPropertyContent: (newValue: unknown, name: string, propertySpecification: PropertySpecification<Type, AdditionalSpecifications>, oldValue: unknown) => CheckedPropertyResult;
|
|
334
|
+
model: Model<Type, AdditionalSpecifications>;
|
|
334
335
|
modelName: string;
|
|
335
336
|
type: Array<string> | string;
|
|
336
337
|
newDocument: Attachments | PartialFullDocument;
|
|
@@ -338,11 +339,11 @@ export interface CommonScope<Type> {
|
|
|
338
339
|
parentNames: Array<string>;
|
|
339
340
|
pathDescription: string;
|
|
340
341
|
}
|
|
341
|
-
export interface PropertyScope<Type = unknown> extends CommonScope<Type> {
|
|
342
|
+
export interface PropertyScope<Type = unknown, AdditionalSpecifications extends Mapping<unknown> = Mapping<unknown>> extends CommonScope<Type, AdditionalSpecifications> {
|
|
342
343
|
name: string;
|
|
343
344
|
newValue: Type;
|
|
344
345
|
oldValue: Type;
|
|
345
|
-
propertySpecification: PropertySpecification<Type>;
|
|
346
|
+
propertySpecification: PropertySpecification<Type, AdditionalSpecifications>;
|
|
346
347
|
}
|
|
347
348
|
export interface EvaluationResult<T = unknown, S = BasicScope<T> & CommonScope<T>> {
|
|
348
349
|
code: string;
|
|
@@ -359,15 +360,15 @@ export interface CheckedPropertyResult extends CheckedResult {
|
|
|
359
360
|
export interface CheckedDocumentResult extends CheckedResult {
|
|
360
361
|
newDocument: PartialFullDocument;
|
|
361
362
|
}
|
|
362
|
-
export type Migrator<Type = unknown> = (document: Document, scope: {
|
|
363
|
+
export type Migrator<Type = unknown, AdditionalSpecifications extends Mapping<unknown> = Mapping<unknown>> = (document: Document, scope: {
|
|
363
364
|
configuration: Configuration;
|
|
364
365
|
databaseHelper: DatabaseHelper;
|
|
365
366
|
Tools: typeof Tools;
|
|
366
367
|
idName: string;
|
|
367
368
|
typeName: string;
|
|
368
369
|
migrater: Mapping<Migrator<Type>>;
|
|
369
|
-
models: Models
|
|
370
|
-
modelConfiguration: ModelConfiguration<Type>;
|
|
370
|
+
models: Models<Type, AdditionalSpecifications>;
|
|
371
|
+
modelConfiguration: ModelConfiguration<Type, AdditionalSpecifications>;
|
|
371
372
|
selfFilePath: string;
|
|
372
373
|
services: Services;
|
|
373
374
|
}) => Document | null;
|