couchdb-web-node-plugin 1.0.824 → 2.0.824
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 +1 -1
- package/databaseHelper.js +1 -1
- package/helper.d.ts +2 -2
- package/helper.js +1 -1
- package/index.js +1 -1
- package/package.json +3 -3
- package/type.d.ts +35 -35
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "couchdb-web-node-plugin",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.824",
|
|
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",
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
"rimraf": "^6.1.3",
|
|
97
97
|
"typescript-eslint": "^8.56.1",
|
|
98
98
|
"web-node": "^1.0.571",
|
|
99
|
-
"weboptimizer": "^2.0.
|
|
99
|
+
"weboptimizer": "^2.0.1651"
|
|
100
100
|
},
|
|
101
101
|
"peerDependencies": {
|
|
102
102
|
"@babel/runtime": "*",
|
|
@@ -420,7 +420,7 @@
|
|
|
420
420
|
}
|
|
421
421
|
},
|
|
422
422
|
"property": {
|
|
423
|
-
"
|
|
423
|
+
"defaultDefinition": {
|
|
424
424
|
"emptyEqualsNull": true,
|
|
425
425
|
"maximumAggregatedSize": 100000000,
|
|
426
426
|
"minimumAggregatedSize": 0,
|
package/type.d.ts
CHANGED
|
@@ -74,7 +74,7 @@ export interface Constraint {
|
|
|
74
74
|
export declare const PrimitiveTypes: readonly ["boolean", "DateTime", "integer", "number", "string"];
|
|
75
75
|
export type PrimitiveType = typeof PrimitiveTypes[number];
|
|
76
76
|
export type Type = boolean | number | string | Model;
|
|
77
|
-
export type
|
|
77
|
+
export type TypeDefinition = Array<Type> | Array<Array<Type>> | Type;
|
|
78
78
|
export type ConstraintKey = 'arrayConstraintExecution' | 'arrayConstraintExpression' | 'conflictingConstraintExecution' | 'conflictingConstraintExpression' | 'constraintExecution' | 'constraintExpression';
|
|
79
79
|
export interface SelectionOption {
|
|
80
80
|
label: string;
|
|
@@ -83,7 +83,7 @@ export interface SelectionOption {
|
|
|
83
83
|
export type NormalizedSelection = Array<SelectionOption>;
|
|
84
84
|
export type Selection = Array<SelectionOption> | Array<Primitive> | Mapping;
|
|
85
85
|
export type Pattern = Array<RegExp | string> | RegExp | string;
|
|
86
|
-
export interface
|
|
86
|
+
export interface BasePropertyDefinition<Type, AdditionalDefinition extends object> {
|
|
87
87
|
roles?: Roles;
|
|
88
88
|
updateStrategy?: UpdateStrategy;
|
|
89
89
|
preventVersionCreation?: boolean;
|
|
@@ -116,7 +116,7 @@ export interface BasePropertySpecification<Type, AdditionalSpecifications extend
|
|
|
116
116
|
nullable?: boolean;
|
|
117
117
|
writable?: boolean;
|
|
118
118
|
selection?: Selection;
|
|
119
|
-
type?:
|
|
119
|
+
type?: TypeDefinition;
|
|
120
120
|
emptyEqualsNull?: boolean;
|
|
121
121
|
trim?: boolean;
|
|
122
122
|
name?: string;
|
|
@@ -125,19 +125,19 @@ export interface BasePropertySpecification<Type, AdditionalSpecifications extend
|
|
|
125
125
|
index?: boolean;
|
|
126
126
|
oldName?: Array<string> | string;
|
|
127
127
|
value?: Type;
|
|
128
|
-
|
|
128
|
+
additionalDefinition?: AdditionalDefinition;
|
|
129
129
|
}
|
|
130
|
-
export interface
|
|
130
|
+
export interface PropertyDefinition<Type = unknown, AdditionalDefinition extends object = object> extends BasePropertyDefinition<Type, AdditionalDefinition> {
|
|
131
131
|
default?: Type;
|
|
132
132
|
}
|
|
133
|
-
export interface
|
|
133
|
+
export interface FileDefinition<Type extends Attachment = Attachment, AdditionalDefinition extends object = object> extends BasePropertyDefinition<Type, AdditionalDefinition> {
|
|
134
134
|
default?: Mapping<Type>;
|
|
135
|
-
fileName?:
|
|
135
|
+
fileName?: PropertyDefinition<string, AdditionalDefinition>;
|
|
136
136
|
}
|
|
137
|
-
export interface BaseModel<AttachmentType extends Attachment = Attachment,
|
|
138
|
-
_additional?:
|
|
137
|
+
export interface BaseModel<AttachmentType extends Attachment = Attachment, AdditionalDefinition extends object = object, AdditionalPropertiesType = unknown> {
|
|
138
|
+
_additional?: PropertyDefinition<AdditionalPropertiesType, AdditionalDefinition>;
|
|
139
139
|
_roles?: Roles;
|
|
140
|
-
_attachments?: Mapping<
|
|
140
|
+
_attachments?: Mapping<FileDefinition<AttachmentType, AdditionalDefinition>> | null;
|
|
141
141
|
_constraintExecutions?: Array<Constraint> | Constraint;
|
|
142
142
|
_constraintExpressions?: Array<Constraint> | Constraint;
|
|
143
143
|
_createExecution?: string;
|
|
@@ -149,14 +149,14 @@ export interface BaseModel<AttachmentType extends Attachment = Attachment, Addit
|
|
|
149
149
|
_type?: Array<string> | string;
|
|
150
150
|
_updateExecution?: string;
|
|
151
151
|
_updateExpression?: string;
|
|
152
|
-
_id?:
|
|
153
|
-
_rev?:
|
|
152
|
+
_id?: PropertyDefinition<string, AdditionalDefinition>;
|
|
153
|
+
_rev?: PropertyDefinition<string, AdditionalDefinition>;
|
|
154
154
|
_updateStrategy?: UpdateStrategy;
|
|
155
155
|
}
|
|
156
|
-
export type Model<Type extends object | undefined = object, AttachmentType extends Attachment = Attachment,
|
|
157
|
-
[Property in keyof Type]:
|
|
156
|
+
export type Model<Type extends object | undefined = object, AttachmentType extends Attachment = Attachment, AdditionalDefinition extends object = object, AdditionalPropertiesType = unknown> = BaseModel<AttachmentType, AdditionalDefinition, AdditionalPropertiesType> & {
|
|
157
|
+
[Property in keyof Type]: PropertyDefinition<Type[Property] extends Array<unknown> ? (Type[Property][number] extends object | undefined ? Array<Model<Type[Property][number], AttachmentType, AdditionalDefinition, AdditionalPropertiesType>> : Type[Property]) : Type[Property] extends object | undefined ? (Type[Property] extends Date | undefined ? Type[Property] : Model<Type[Property], AttachmentType, AdditionalDefinition, AdditionalPropertiesType>) : Type[Property], AdditionalDefinition>;
|
|
158
158
|
};
|
|
159
|
-
export type Models<Type extends object = object, AttachmentType extends Attachment = Attachment,
|
|
159
|
+
export type Models<Type extends object = object, AttachmentType extends Attachment = Attachment, AdditionalDefinition extends object = object, AdditionalPropertiesType = unknown> = Mapping<Model<Type, AttachmentType, AdditionalDefinition, AdditionalPropertiesType>>;
|
|
160
160
|
export type UpdateStrategy = 'fillUp' | 'incremental' | 'migrate' | 'replace';
|
|
161
161
|
export type DocumentContent = Array<DocumentContent> | PlainObject | Primitive;
|
|
162
162
|
export interface DocumentStrategyMeta {
|
|
@@ -211,17 +211,17 @@ export interface PropertyNameConfiguration {
|
|
|
211
211
|
};
|
|
212
212
|
validatedDocumentsCache: string;
|
|
213
213
|
}
|
|
214
|
-
export interface BaseModelConfiguration<Type,
|
|
214
|
+
export interface BaseModelConfiguration<Type, AdditionalDefinition extends object> {
|
|
215
215
|
dateTimeFormat: 'iso' | 'iso8601' | 'number';
|
|
216
216
|
property: {
|
|
217
|
-
|
|
217
|
+
defaultDefinition: PropertyDefinition<Type, AdditionalDefinition>;
|
|
218
218
|
name: PropertyNameConfiguration;
|
|
219
219
|
};
|
|
220
220
|
updateStrategy: UpdateStrategy;
|
|
221
221
|
}
|
|
222
|
-
export interface ModelConfiguration<Type extends object = object, AttachmentType extends Attachment = Attachment,
|
|
222
|
+
export interface ModelConfiguration<Type extends object = object, AttachmentType extends Attachment = Attachment, AdditionalDefinition extends object = object, AdditionalPropertiesType = unknown> extends BaseModelConfiguration<Type, AdditionalDefinition> {
|
|
223
223
|
autoMigrationPath: string;
|
|
224
|
-
entities: Models<Type, AttachmentType,
|
|
224
|
+
entities: Models<Type, AttachmentType, AdditionalDefinition, AdditionalPropertiesType>;
|
|
225
225
|
triggerInitialCompaction: boolean;
|
|
226
226
|
updateConfiguration: boolean;
|
|
227
227
|
updateValidation: boolean;
|
|
@@ -274,7 +274,7 @@ export type ConnectorConfiguration = DatabaseConnectorConfiguration & {
|
|
|
274
274
|
maximumRetryIntervallInSeconds: number;
|
|
275
275
|
};
|
|
276
276
|
};
|
|
277
|
-
export interface CoreConfiguration<Type extends object = Mapping<unknown>, AttachmentType extends Attachment = Attachment,
|
|
277
|
+
export interface CoreConfiguration<Type extends object = Mapping<unknown>, AttachmentType extends Attachment = Attachment, AdditionalDefinition extends object = object, AdditionalPropertiesType = unknown> {
|
|
278
278
|
attachAutoRestarter: boolean;
|
|
279
279
|
closeTimeoutInSeconds: number;
|
|
280
280
|
runner: {
|
|
@@ -309,7 +309,7 @@ export interface CoreConfiguration<Type extends object = Mapping<unknown>, Attac
|
|
|
309
309
|
maximumNumberOfEntitiesInBulkOperation: number;
|
|
310
310
|
maximumRepresentationLength: number;
|
|
311
311
|
maximumRepresentationTryLength: number;
|
|
312
|
-
model: ModelConfiguration<Type, AttachmentType,
|
|
312
|
+
model: ModelConfiguration<Type, AttachmentType, AdditionalDefinition, AdditionalPropertiesType>;
|
|
313
313
|
path: string;
|
|
314
314
|
skipLatestRevisionDetermining: boolean;
|
|
315
315
|
url: string;
|
|
@@ -422,9 +422,9 @@ export interface CompilationErrorData<S = Mapping<unknown>> extends EvaluationEr
|
|
|
422
422
|
export interface RuntimeErrorData<S = Mapping<unknown>> extends EvaluationErrorData<S> {
|
|
423
423
|
runtime: string;
|
|
424
424
|
}
|
|
425
|
-
export interface BasicScope<Type extends object, AttachmentType extends Attachment,
|
|
425
|
+
export interface BasicScope<Type extends object, AttachmentType extends Attachment, AdditionalDefinition extends object, AdditionalPropertiesType> {
|
|
426
426
|
attachmentWithPrefixExists: (namePrefix: string) => boolean;
|
|
427
|
-
checkDocument: (newDocument: PartialFullDocument<Type, AdditionalPropertiesType>, oldDocument: PartialFullDocument<Type, AdditionalPropertiesType> | null, modelName: string, model: Model<Type, AttachmentType,
|
|
427
|
+
checkDocument: (newDocument: PartialFullDocument<Type, AdditionalPropertiesType>, oldDocument: PartialFullDocument<Type, AdditionalPropertiesType> | null, modelName: string, model: Model<Type, AttachmentType, AdditionalDefinition, AdditionalPropertiesType>, parentNames: Array<string>) => CheckedDocumentResult<Type, AdditionalPropertiesType>;
|
|
428
428
|
deepCopy: <T>(data: T) => T;
|
|
429
429
|
getDateTime: (value: number | string) => Date;
|
|
430
430
|
getEffectiveValue: (name: string, newDocument: PartialFullDocument<Type, AdditionalPropertiesType>, oldDocument: (null | PartialFullDocument<Type, AdditionalPropertiesType>)) => unknown;
|
|
@@ -438,17 +438,17 @@ export interface BasicScope<Type extends object, AttachmentType extends Attachme
|
|
|
438
438
|
revisionName: string;
|
|
439
439
|
specialNames: SpecialPropertyNames;
|
|
440
440
|
typeName: string;
|
|
441
|
-
modelConfiguration: BaseModelConfiguration<Type,
|
|
442
|
-
models: Models<Type, AttachmentType,
|
|
441
|
+
modelConfiguration: BaseModelConfiguration<Type, AdditionalDefinition>;
|
|
442
|
+
models: Models<Type, AttachmentType, AdditionalDefinition, AdditionalPropertiesType>;
|
|
443
443
|
now: Date;
|
|
444
444
|
nowUTCTimestamp: number;
|
|
445
445
|
securitySettings: Partial<SecuritySettings>;
|
|
446
446
|
userContext: Partial<UserContext>;
|
|
447
447
|
originalNewDocument?: PartialFullDocument<Type, AdditionalPropertiesType>;
|
|
448
448
|
}
|
|
449
|
-
export interface CommonScope<ObjectType extends object, Type, AttachmentType extends Attachment,
|
|
450
|
-
checkPropertyContent: (newValue: Type, name: string,
|
|
451
|
-
model: Model<ObjectType, AttachmentType,
|
|
449
|
+
export interface CommonScope<ObjectType extends object, Type, AttachmentType extends Attachment, AdditionalDefinition extends object, AdditionalPropertiesType> {
|
|
450
|
+
checkPropertyContent: (newValue: Type, name: string, propertyDefinition: PropertyDefinition<Type, AdditionalDefinition>, oldValue: Type) => CheckedPropertyResult<Type>;
|
|
451
|
+
model: Model<ObjectType, AttachmentType, AdditionalDefinition, AdditionalPropertiesType>;
|
|
452
452
|
modelName: string;
|
|
453
453
|
type: Array<string> | string;
|
|
454
454
|
newDocument: PartialFullDocument<ObjectType, AdditionalPropertiesType>;
|
|
@@ -457,14 +457,14 @@ export interface CommonScope<ObjectType extends object, Type, AttachmentType ext
|
|
|
457
457
|
pathDescription: string;
|
|
458
458
|
updateStrategy: UpdateStrategy;
|
|
459
459
|
}
|
|
460
|
-
export interface PropertyScope<ObjectType extends object, Type, PropertyType, AttachmentType extends Attachment,
|
|
460
|
+
export interface PropertyScope<ObjectType extends object, Type, PropertyType, AttachmentType extends Attachment, AdditionalDefinition extends object, AdditionalPropertiesType> extends CommonScope<ObjectType, PropertyType, AttachmentType, AdditionalDefinition, AdditionalPropertiesType> {
|
|
461
461
|
name: string;
|
|
462
462
|
newValue: Type;
|
|
463
463
|
oldValue?: Type;
|
|
464
|
-
|
|
464
|
+
propertyDefinition: PropertyDefinition<Type, AdditionalDefinition>;
|
|
465
465
|
attachmentsTarget?: Mapping<AttachmentType | null>;
|
|
466
466
|
}
|
|
467
|
-
export interface EvaluationResult<ObjectType extends object, Type, PropertyType, AttachmentType extends Attachment,
|
|
467
|
+
export interface EvaluationResult<ObjectType extends object, Type, PropertyType, AttachmentType extends Attachment, AdditionalDefinition extends object, AdditionalPropertiesType, Scope = (BasicScope<ObjectType, AttachmentType, AdditionalDefinition, AdditionalPropertiesType> & CommonScope<ObjectType, PropertyType, AttachmentType, AdditionalDefinition, AdditionalPropertiesType>)> {
|
|
468
468
|
code: string;
|
|
469
469
|
result: Type;
|
|
470
470
|
scope: Scope;
|
|
@@ -488,14 +488,14 @@ export interface InitializeExpressPouchDBStateData {
|
|
|
488
488
|
expressInstance: Express;
|
|
489
489
|
expressPouchDBInstance: Express;
|
|
490
490
|
}
|
|
491
|
-
export type Migrator<Type extends object = object, AttachmentType extends Attachment = Attachment,
|
|
491
|
+
export type Migrator<Type extends object = object, AttachmentType extends Attachment = Attachment, AdditionalDefinition extends object = object, AdditionalPropertiesType = unknown> = (document: Document, scope: (typeof UTILITY_SCOPE & {
|
|
492
492
|
configuration: Configuration;
|
|
493
493
|
databaseHelper: Mapping<unknown>;
|
|
494
494
|
idName: string;
|
|
495
495
|
typeName: string;
|
|
496
|
-
migrators: Mapping<Migrator<Type, AttachmentType,
|
|
497
|
-
models: Models<Type, AttachmentType,
|
|
498
|
-
modelConfiguration: ModelConfiguration<Type, AttachmentType,
|
|
496
|
+
migrators: Mapping<Migrator<Type, AttachmentType, AdditionalDefinition, AdditionalPropertiesType>>;
|
|
497
|
+
models: Models<Type, AttachmentType, AdditionalDefinition, AdditionalPropertiesType>;
|
|
498
|
+
modelConfiguration: ModelConfiguration<Type, AttachmentType, AdditionalDefinition, AdditionalPropertiesType>;
|
|
499
499
|
selfFilePath: string;
|
|
500
500
|
services: Services;
|
|
501
501
|
})) => Document | null;
|