@tstdl/base 0.92.53 → 0.92.54
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/document-management/models/document-property.model.d.ts +8 -6
- package/document-management/models/document-property.model.js +8 -8
- package/document-management/models/schemas.d.ts +1 -1
- package/document-management/server/services/document-management.service.js +1 -1
- package/orm/server/database-schema.d.ts +2 -2
- package/orm/server/database-schema.js +2 -1
- package/orm/server/repository.d.ts +0 -1
- package/orm/server/repository.js +0 -3
- package/package.json +1 -1
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { type EnumType } from '../../enumeration/enumeration.js';
|
|
1
2
|
import { Entity } from '../../orm/entity.js';
|
|
2
|
-
export declare
|
|
3
|
-
Text
|
|
4
|
-
Integer
|
|
5
|
-
Decimal
|
|
6
|
-
Boolean
|
|
7
|
-
}
|
|
3
|
+
export declare const DocumentPropertyDataType: {
|
|
4
|
+
readonly Text: "text";
|
|
5
|
+
readonly Integer: "integer";
|
|
6
|
+
readonly Decimal: "decimal";
|
|
7
|
+
readonly Boolean: "boolean";
|
|
8
|
+
};
|
|
9
|
+
export type DocumentPropertyDataType = EnumType<typeof DocumentPropertyDataType>;
|
|
8
10
|
export declare class DocumentProperty extends Entity {
|
|
9
11
|
label: string;
|
|
10
12
|
dataType: DocumentPropertyDataType;
|
|
@@ -7,15 +7,15 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
9
|
};
|
|
10
|
+
import { defineEnum } from '../../enumeration/enumeration.js';
|
|
10
11
|
import { Entity } from '../../orm/entity.js';
|
|
11
12
|
import { Enumeration, StringProperty } from '../../schema/index.js';
|
|
12
|
-
export
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
})(DocumentPropertyDataType || (DocumentPropertyDataType = {}));
|
|
13
|
+
export const DocumentPropertyDataType = defineEnum('DocumentPropertyDataType', {
|
|
14
|
+
Text: 'text',
|
|
15
|
+
Integer: 'integer',
|
|
16
|
+
Decimal: 'decimal',
|
|
17
|
+
Boolean: 'boolean'
|
|
18
|
+
});
|
|
19
19
|
export class DocumentProperty extends Entity {
|
|
20
20
|
label;
|
|
21
21
|
dataType;
|
|
@@ -26,5 +26,5 @@ __decorate([
|
|
|
26
26
|
], DocumentProperty.prototype, "label", void 0);
|
|
27
27
|
__decorate([
|
|
28
28
|
Enumeration(DocumentPropertyDataType),
|
|
29
|
-
__metadata("design:type",
|
|
29
|
+
__metadata("design:type", String)
|
|
30
30
|
], DocumentProperty.prototype, "dataType", void 0);
|
|
@@ -13,7 +13,7 @@ import { DocumentTypeProperty } from './document-type-property.model.js';
|
|
|
13
13
|
import { DocumentType } from './document-type.model.js';
|
|
14
14
|
import { Document } from './document.model.js';
|
|
15
15
|
export declare const documentManagementSchema: import("../../orm/server/database-schema.js").DatabaseSchema<"document_management">;
|
|
16
|
-
export declare const dataType: import("drizzle-orm/pg-core").PgEnum<["
|
|
16
|
+
export declare const dataType: import("drizzle-orm/pg-core").PgEnum<["boolean", "decimal", "text", "integer"]>;
|
|
17
17
|
export declare const documentCategory: import("../../orm/server/drizzle/schema-converter.js").PgTableFromType<"document_management", typeof DocumentCategory>;
|
|
18
18
|
export declare const documentCollectionDocument: import("../../orm/server/drizzle/schema-converter.js").PgTableFromType<"document_management", typeof DocumentCollectionDocument>;
|
|
19
19
|
export declare const documentCollection: import("../../orm/server/drizzle/schema-converter.js").PgTableFromType<"document_management", typeof DocumentCollection>;
|
|
@@ -371,6 +371,6 @@ const validators = {
|
|
|
371
371
|
function validatePropertyValue(propertyId, dataType, value) {
|
|
372
372
|
const valid = validators[dataType](value);
|
|
373
373
|
if (!valid) {
|
|
374
|
-
throw new BadRequestError(`Invalid value for data type ${
|
|
374
|
+
throw new BadRequestError(`Invalid value for data type ${dataType} for property ${propertyId}.`);
|
|
375
375
|
}
|
|
376
376
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { PgEnum } from 'drizzle-orm/pg-core';
|
|
2
2
|
import type { Enumeration, EnumerationValue, UnionToTuple } from '../../types.js';
|
|
3
|
-
import { type PgTableFromType } from './drizzle/schema-converter.js';
|
|
4
3
|
import type { EntityType } from '../entity.js';
|
|
4
|
+
import { type PgTableFromType } from './drizzle/schema-converter.js';
|
|
5
5
|
export declare class DatabaseSchema<Name extends string> {
|
|
6
6
|
readonly name: Name;
|
|
7
7
|
constructor(name: Name);
|
|
8
8
|
getTable<T extends EntityType>(type: T): PgTableFromType<Name, T>;
|
|
9
|
-
getEnum<T extends Enumeration>(enumeration: T, name
|
|
9
|
+
getEnum<T extends Enumeration>(enumeration: T, name?: string): PgEnum<UnionToTuple<`${EnumerationValue<T>}`> extends [string, ...string[]] ? UnionToTuple<`${EnumerationValue<T>}`> : never>;
|
|
10
10
|
}
|
|
11
11
|
export declare function databaseSchema<Name extends string>(name: Name): DatabaseSchema<Name>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getEnumName } from '../../enumeration/enumeration.js';
|
|
1
2
|
import { getDrizzleTableFromType, getPgEnum, registerEnum } from './drizzle/schema-converter.js';
|
|
2
3
|
export class DatabaseSchema {
|
|
3
4
|
name;
|
|
@@ -7,7 +8,7 @@ export class DatabaseSchema {
|
|
|
7
8
|
getTable(type) {
|
|
8
9
|
return getDrizzleTableFromType(type, this.name);
|
|
9
10
|
}
|
|
10
|
-
getEnum(enumeration, name) {
|
|
11
|
+
getEnum(enumeration, name = getEnumName(enumeration)) {
|
|
11
12
|
registerEnum(enumeration, name);
|
|
12
13
|
return getPgEnum(this.name, enumeration); // eslint-disable-line @typescript-eslint/no-unsafe-return
|
|
13
14
|
}
|
|
@@ -39,7 +39,6 @@ export declare class EntityRepository<T extends Entity = Entity> implements Reso
|
|
|
39
39
|
readonly columnDefinitionsMap: Map<string, ColumnDefinition>;
|
|
40
40
|
readonly session: Database | PgTransaction;
|
|
41
41
|
readonly isInTransaction: boolean;
|
|
42
|
-
get tx(): PgTransaction;
|
|
43
42
|
readonly [resolveArgumentType]: EntityType<T>;
|
|
44
43
|
constructor(type?: EntityType<T>, table?: PgTableFromType<string, EntityType>, columnDefinitions?: ColumnDefinition[], columnDefinitionsMap?: Map<string, ColumnDefinition>, session?: Database | PgTransaction);
|
|
45
44
|
withOptionalTransaction(transaction: Transaction | undefined): EntityRepository<T>;
|
package/orm/server/repository.js
CHANGED
|
@@ -38,9 +38,6 @@ let EntityRepository = class EntityRepository {
|
|
|
38
38
|
columnDefinitionsMap;
|
|
39
39
|
session;
|
|
40
40
|
isInTransaction;
|
|
41
|
-
get tx() {
|
|
42
|
-
return this.session;
|
|
43
|
-
}
|
|
44
41
|
constructor(type, table, columnDefinitions, columnDefinitionsMap, session) {
|
|
45
42
|
this.#repositoryConstructor = new.target;
|
|
46
43
|
this.type = type ?? injectArgument(this, { optional: true }) ?? inject(ENTITY_TYPE);
|