@tstdl/base 0.92.92 → 0.92.94

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.
@@ -10,11 +10,16 @@ var __metadata = (this && this.__metadata) || function (k, v) {
10
10
  import { Entity } from '../../orm/entity.js';
11
11
  import { Unique } from '../../orm/types.js';
12
12
  import { StringProperty } from '../../schema/index.js';
13
- export class DocumentCategory extends Entity {
13
+ import { DocumentManagementTable } from './document-management-table.js';
14
+ let DocumentCategory = class DocumentCategory extends Entity {
14
15
  label;
15
- }
16
+ };
16
17
  __decorate([
17
18
  StringProperty(),
18
19
  Unique(),
19
20
  __metadata("design:type", String)
20
21
  ], DocumentCategory.prototype, "label", void 0);
22
+ DocumentCategory = __decorate([
23
+ DocumentManagementTable()
24
+ ], DocumentCategory);
25
+ export { DocumentCategory };
@@ -11,6 +11,7 @@ import { References } from '../../orm/decorators.js';
11
11
  import { Entity } from '../../orm/entity.js';
12
12
  import { Timestamp, Unique, Uuid } from '../../orm/types.js';
13
13
  import { DocumentCollection } from './document-collection.model.js';
14
+ import { DocumentManagementTable } from './document-management-table.js';
14
15
  import { Document } from './document.model.js';
15
16
  let DocumentCollectionDocument = class DocumentCollectionDocument extends Entity {
16
17
  collectionId;
@@ -32,6 +33,7 @@ __decorate([
32
33
  __metadata("design:type", Object)
33
34
  ], DocumentCollectionDocument.prototype, "archiveTimestamp", void 0);
34
35
  DocumentCollectionDocument = __decorate([
36
+ DocumentManagementTable(),
35
37
  Unique(['collectionId', 'documentId'])
36
38
  ], DocumentCollectionDocument);
37
39
  export { DocumentCollectionDocument };
@@ -4,11 +4,11 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
- import { Table } from '../../orm/decorators.js';
8
7
  import { Entity } from '../../orm/entity.js';
8
+ import { DocumentManagementTable } from './document-management-table.js';
9
9
  let DocumentCollection = class DocumentCollection extends Entity {
10
10
  };
11
11
  DocumentCollection = __decorate([
12
- Table()
12
+ DocumentManagementTable()
13
13
  ], DocumentCollection);
14
14
  export { DocumentCollection };
@@ -9,12 +9,13 @@ var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  };
10
10
  import { Entity } from '../../orm/entity.js';
11
11
  import { Integer, StringProperty } from '../../schema/index.js';
12
- export class DocumentFile extends Entity {
12
+ import { DocumentManagementTable } from './document-management-table.js';
13
+ let DocumentFile = class DocumentFile extends Entity {
13
14
  originalFileName;
14
15
  mimeType;
15
16
  hash;
16
17
  size;
17
- }
18
+ };
18
19
  __decorate([
19
20
  StringProperty({ nullable: true }),
20
21
  __metadata("design:type", Object)
@@ -31,3 +32,7 @@ __decorate([
31
32
  Integer(),
32
33
  __metadata("design:type", Number)
33
34
  ], DocumentFile.prototype, "size", void 0);
35
+ DocumentFile = __decorate([
36
+ DocumentManagementTable()
37
+ ], DocumentFile);
38
+ export { DocumentFile };
@@ -0,0 +1 @@
1
+ export declare function DocumentManagementTable(): ClassDecorator;
@@ -0,0 +1,4 @@
1
+ import { Table } from '../../orm/decorators.js';
2
+ export function DocumentManagementTable() {
3
+ return Table({ schema: 'document_management' });
4
+ }
@@ -7,12 +7,13 @@ 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 { eq } from 'drizzle-orm';
10
+ import { eq, sql } from 'drizzle-orm';
11
11
  import { References } from '../../orm/decorators.js';
12
12
  import { Entity } from '../../orm/entity.js';
13
13
  import { numNonNulls } from '../../orm/sqls.js';
14
14
  import { Check, NumericDate, Unique, Uuid } from '../../orm/types.js';
15
15
  import { BooleanProperty, Integer, NumberProperty, StringProperty } from '../../schema/index.js';
16
+ import { DocumentManagementTable } from './document-management-table.js';
16
17
  import { DocumentProperty } from './document-property.model.js';
17
18
  import { DocumentRequestAssignmentTask } from './document-request-assignment-task.model.js';
18
19
  import { DocumentRequestFile } from './document-request-file.model.js';
@@ -51,7 +52,8 @@ __decorate([
51
52
  __metadata("design:type", Object)
52
53
  ], DocumentPropertyValueBase.prototype, "date", void 0);
53
54
  DocumentPropertyValueBase = __decorate([
54
- Check('only_one_value', (table) => eq(numNonNulls(table.text, table.integer, table.decimal, table.boolean, table.date), 1))
55
+ DocumentManagementTable(),
56
+ Check('only_one_value', (table) => eq(numNonNulls(table.text, table.integer, table.decimal, table.boolean, table.date), sql.raw('1')))
55
57
  ], DocumentPropertyValueBase);
56
58
  export { DocumentPropertyValueBase };
57
59
  let DocumentPropertyValue = class DocumentPropertyValue extends DocumentPropertyValueBase {
@@ -11,6 +11,7 @@ import { defineEnum } from '../../enumeration/enumeration.js';
11
11
  import { Entity } from '../../orm/entity.js';
12
12
  import { Unique } from '../../orm/types.js';
13
13
  import { Enumeration, StringProperty } from '../../schema/index.js';
14
+ import { DocumentManagementTable } from './document-management-table.js';
14
15
  export const DocumentPropertyDataType = defineEnum('DocumentPropertyDataType', {
15
16
  Text: 'text',
16
17
  Integer: 'integer',
@@ -18,10 +19,10 @@ export const DocumentPropertyDataType = defineEnum('DocumentPropertyDataType', {
18
19
  Boolean: 'boolean',
19
20
  Date: 'date'
20
21
  });
21
- export class DocumentProperty extends Entity {
22
+ let DocumentProperty = class DocumentProperty extends Entity {
22
23
  label;
23
24
  dataType;
24
- }
25
+ };
25
26
  __decorate([
26
27
  StringProperty(),
27
28
  Unique(),
@@ -31,3 +32,7 @@ __decorate([
31
32
  Enumeration(DocumentPropertyDataType),
32
33
  __metadata("design:type", String)
33
34
  ], DocumentProperty.prototype, "dataType", void 0);
35
+ DocumentProperty = __decorate([
36
+ DocumentManagementTable()
37
+ ], DocumentProperty);
38
+ export { DocumentProperty };
@@ -11,6 +11,7 @@ import { References } from '../../orm/decorators.js';
11
11
  import { Entity } from '../../orm/entity.js';
12
12
  import { Unique, Uuid } from '../../orm/types.js';
13
13
  import { DocumentCollection } from './document-collection.model.js';
14
+ import { DocumentManagementTable } from './document-management-table.js';
14
15
  import { DocumentRequestAssignmentTask } from './document-request-assignment-task.model.js';
15
16
  let DocumentRequestAssignmentTaskCollection = class DocumentRequestAssignmentTaskCollection extends Entity {
16
17
  requestAssignmentTaskId;
@@ -27,6 +28,7 @@ __decorate([
27
28
  __metadata("design:type", String)
28
29
  ], DocumentRequestAssignmentTaskCollection.prototype, "collectionId", void 0);
29
30
  DocumentRequestAssignmentTaskCollection = __decorate([
31
+ DocumentManagementTable(),
30
32
  Unique(['requestAssignmentTaskId', 'collectionId'], { naming: 'abbreviated-table' })
31
33
  ], DocumentRequestAssignmentTaskCollection);
32
34
  export { DocumentRequestAssignmentTaskCollection };
@@ -12,9 +12,10 @@ import { Entity } from '../../orm/entity.js';
12
12
  import { NumericDate, Unique, Uuid } from '../../orm/types.js';
13
13
  import { Array, Integer, string, StringProperty } from '../../schema/index.js';
14
14
  import { DocumentFile } from './document-file.model.js';
15
+ import { DocumentManagementTable } from './document-management-table.js';
15
16
  import { DocumentRequestFile } from './document-request-file.model.js';
16
17
  import { DocumentType } from './document-type.model.js';
17
- export class DocumentRequestAssignmentTask extends Entity {
18
+ let DocumentRequestAssignmentTask = class DocumentRequestAssignmentTask extends Entity {
18
19
  fileId;
19
20
  assignedRequestFileId;
20
21
  typeId;
@@ -25,7 +26,7 @@ export class DocumentRequestAssignmentTask extends Entity {
25
26
  summary;
26
27
  tags;
27
28
  assignmentTries;
28
- }
29
+ };
29
30
  __decorate([
30
31
  Uuid(),
31
32
  References(() => DocumentFile),
@@ -70,3 +71,7 @@ __decorate([
70
71
  Integer(),
71
72
  __metadata("design:type", Number)
72
73
  ], DocumentRequestAssignmentTask.prototype, "assignmentTries", void 0);
74
+ DocumentRequestAssignmentTask = __decorate([
75
+ DocumentManagementTable()
76
+ ], DocumentRequestAssignmentTask);
77
+ export { DocumentRequestAssignmentTask };
@@ -11,6 +11,7 @@ import { References } from '../../orm/decorators.js';
11
11
  import { Entity } from '../../orm/entity.js';
12
12
  import { Unique, Uuid } from '../../orm/types.js';
13
13
  import { DocumentCollection } from './document-collection.model.js';
14
+ import { DocumentManagementTable } from './document-management-table.js';
14
15
  import { DocumentRequest } from './document-request.model.js';
15
16
  let DocumentRequestCollection = class DocumentRequestCollection extends Entity {
16
17
  requestId;
@@ -27,6 +28,7 @@ __decorate([
27
28
  __metadata("design:type", String)
28
29
  ], DocumentRequestCollection.prototype, "collectionId", void 0);
29
30
  DocumentRequestCollection = __decorate([
31
+ DocumentManagementTable(),
30
32
  Unique(['requestId', 'collectionId'])
31
33
  ], DocumentRequestCollection);
32
34
  export { DocumentRequestCollection };
@@ -12,9 +12,10 @@ import { Entity } from '../../orm/entity.js';
12
12
  import { NumericDate, Timestamp, Uuid } from '../../orm/types.js';
13
13
  import { Array, BooleanProperty, Integer, string, StringProperty } from '../../schema/index.js';
14
14
  import { DocumentFile } from './document-file.model.js';
15
+ import { DocumentManagementTable } from './document-management-table.js';
15
16
  import { DocumentRequest } from './document-request.model.js';
16
17
  import { Document } from './document.model.js';
17
- export class DocumentRequestFile extends Entity {
18
+ let DocumentRequestFile = class DocumentRequestFile extends Entity {
18
19
  requestId;
19
20
  fileId;
20
21
  title;
@@ -27,7 +28,7 @@ export class DocumentRequestFile extends Entity {
27
28
  approval;
28
29
  approvalComment;
29
30
  approvalTimestamp;
30
- }
31
+ };
31
32
  __decorate([
32
33
  Uuid(),
33
34
  References(() => DocumentRequest),
@@ -79,3 +80,7 @@ __decorate([
79
80
  Timestamp({ nullable: true }),
80
81
  __metadata("design:type", Object)
81
82
  ], DocumentRequestFile.prototype, "approvalTimestamp", void 0);
83
+ DocumentRequestFile = __decorate([
84
+ DocumentManagementTable()
85
+ ], DocumentRequestFile);
86
+ export { DocumentRequestFile };
@@ -11,14 +11,15 @@ import { References } from '../../orm/decorators.js';
11
11
  import { Entity } from '../../orm/entity.js';
12
12
  import { Uuid } from '../../orm/types.js';
13
13
  import { Integer, StringProperty } from '../../schema/index.js';
14
+ import { DocumentManagementTable } from './document-management-table.js';
14
15
  import { DocumentRequestsTemplate } from './document-requests-template.js';
15
16
  import { DocumentType } from './document-type.model.js';
16
- export class DocumentRequestTemplate extends Entity {
17
+ let DocumentRequestTemplate = class DocumentRequestTemplate extends Entity {
17
18
  requestsTemplateId;
18
19
  typeId;
19
20
  requiredFilesCount;
20
21
  comment;
21
- }
22
+ };
22
23
  __decorate([
23
24
  Uuid(),
24
25
  References(() => DocumentRequestsTemplate),
@@ -37,3 +38,7 @@ __decorate([
37
38
  StringProperty({ nullable: true }),
38
39
  __metadata("design:type", Object)
39
40
  ], DocumentRequestTemplate.prototype, "comment", void 0);
41
+ DocumentRequestTemplate = __decorate([
42
+ DocumentManagementTable()
43
+ ], DocumentRequestTemplate);
44
+ export { DocumentRequestTemplate };
@@ -11,14 +11,15 @@ import { References } from '../../orm/decorators.js';
11
11
  import { Entity } from '../../orm/entity.js';
12
12
  import { Uuid } from '../../orm/types.js';
13
13
  import { BooleanProperty, Integer, StringProperty } from '../../schema/index.js';
14
+ import { DocumentManagementTable } from './document-management-table.js';
14
15
  import { DocumentType } from './document-type.model.js';
15
16
  import { Document } from './document.model.js';
16
- export class DocumentRequest extends Entity {
17
+ let DocumentRequest = class DocumentRequest extends Entity {
17
18
  typeId;
18
19
  requiredFilesCount;
19
20
  comment;
20
21
  completed;
21
- }
22
+ };
22
23
  __decorate([
23
24
  Uuid({ nullable: true }),
24
25
  References(() => DocumentType),
@@ -36,3 +37,7 @@ __decorate([
36
37
  BooleanProperty(),
37
38
  __metadata("design:type", Boolean)
38
39
  ], DocumentRequest.prototype, "completed", void 0);
40
+ DocumentRequest = __decorate([
41
+ DocumentManagementTable()
42
+ ], DocumentRequest);
43
+ export { DocumentRequest };
@@ -10,10 +10,11 @@ var __metadata = (this && this.__metadata) || function (k, v) {
10
10
  import { Entity } from '../../orm/entity.js';
11
11
  import { Unique } from '../../orm/types.js';
12
12
  import { StringProperty } from '../../schema/index.js';
13
- export class DocumentRequestsTemplate extends Entity {
13
+ import { DocumentManagementTable } from './document-management-table.js';
14
+ let DocumentRequestsTemplate = class DocumentRequestsTemplate extends Entity {
14
15
  label;
15
16
  description;
16
- }
17
+ };
17
18
  __decorate([
18
19
  StringProperty(),
19
20
  Unique(),
@@ -23,3 +24,7 @@ __decorate([
23
24
  StringProperty({ nullable: true }),
24
25
  __metadata("design:type", Object)
25
26
  ], DocumentRequestsTemplate.prototype, "description", void 0);
27
+ DocumentRequestsTemplate = __decorate([
28
+ DocumentManagementTable()
29
+ ], DocumentRequestsTemplate);
30
+ export { DocumentRequestsTemplate };
@@ -10,6 +10,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
10
10
  import { References } from '../../orm/decorators.js';
11
11
  import { Entity } from '../../orm/entity.js';
12
12
  import { Unique, Uuid } from '../../orm/types.js';
13
+ import { DocumentManagementTable } from './document-management-table.js';
13
14
  import { DocumentProperty } from './document-property.model.js';
14
15
  import { DocumentType } from './document-type.model.js';
15
16
  let DocumentTypeProperty = class DocumentTypeProperty extends Entity {
@@ -27,6 +28,7 @@ __decorate([
27
28
  __metadata("design:type", String)
28
29
  ], DocumentTypeProperty.prototype, "propertyId", void 0);
29
30
  DocumentTypeProperty = __decorate([
31
+ DocumentManagementTable(),
30
32
  Unique(['typeId', 'propertyId'])
31
33
  ], DocumentTypeProperty);
32
34
  export { DocumentTypeProperty };
@@ -12,6 +12,7 @@ import { Entity } from '../../orm/entity.js';
12
12
  import { Unique, Uuid } from '../../orm/types.js';
13
13
  import { StringProperty } from '../../schema/index.js';
14
14
  import { DocumentCategory } from './document-category.model.js';
15
+ import { DocumentManagementTable } from './document-management-table.js';
15
16
  let DocumentType = class DocumentType extends Entity {
16
17
  categoryId;
17
18
  group;
@@ -31,6 +32,7 @@ __decorate([
31
32
  __metadata("design:type", String)
32
33
  ], DocumentType.prototype, "label", void 0);
33
34
  DocumentType = __decorate([
35
+ DocumentManagementTable(),
34
36
  Unique(['categoryId', 'label'])
35
37
  ], DocumentType);
36
38
  export { DocumentType };
@@ -12,8 +12,9 @@ import { Entity } from '../../orm/entity.js';
12
12
  import { NumericDate, Uuid } from '../../orm/types.js';
13
13
  import { Array, Integer, string, StringProperty } from '../../schema/index.js';
14
14
  import { DocumentFile } from './document-file.model.js';
15
+ import { DocumentManagementTable } from './document-management-table.js';
15
16
  import { DocumentType } from './document-type.model.js';
16
- export class Document extends Entity {
17
+ let Document = class Document extends Entity {
17
18
  fileId;
18
19
  typeId;
19
20
  title;
@@ -22,7 +23,7 @@ export class Document extends Entity {
22
23
  date;
23
24
  summary;
24
25
  tags;
25
- }
26
+ };
26
27
  __decorate([
27
28
  Uuid(),
28
29
  References(() => DocumentFile),
@@ -57,3 +58,7 @@ __decorate([
57
58
  Array(string(), { nullable: true }),
58
59
  __metadata("design:type", Object)
59
60
  ], Document.prototype, "tags", void 0);
61
+ Document = __decorate([
62
+ DocumentManagementTable()
63
+ ], Document);
64
+ export { Document };
@@ -168,7 +168,7 @@ function getPostgresColumn(tableName, columnName, dbSchema, propertySchema, refl
168
168
  column = column.primaryKey();
169
169
  }
170
170
  if (isDefined(reflectionData.references)) {
171
- column = column.references(() => getDrizzleTableFromType(reflectionData.references(), dbSchema.schemaName).id);
171
+ column = column.references(() => getDrizzleTableFromType(reflectionData.references()).id);
172
172
  }
173
173
  return column;
174
174
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tstdl/base",
3
- "version": "0.92.92",
3
+ "version": "0.92.94",
4
4
  "author": "Patrick Hein",
5
5
  "publishConfig": {
6
6
  "access": "public"