@tstdl/base 0.92.149 → 0.92.150

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.
@@ -3,19 +3,88 @@ import { Transactional } from '../../../orm/server/index.js';
3
3
  import type { Record } from '../../../types/index.js';
4
4
  import { DocumentCategory, DocumentType, type DocumentProperty, type DocumentPropertyDataType } from '../../models/index.js';
5
5
  import type { DocumentManagementData, DocumentRequestsTemplateData } from '../../service-models/index.js';
6
- export type CategoryLabels<CategoryKey extends string> = Record<CategoryKey, string>;
7
- export type CategoryParents<CategoryKey extends string> = Record<CategoryKey, CategoryKey | null>;
8
- export type TypeLabels<TypeKey extends string> = Record<TypeKey, string>;
9
- export type TypeCategories<TypeKey extends string, CategoryKey extends string> = Record<TypeKey, CategoryKey>;
10
- export type PropertyConfigurations<DocumentPropertyKey extends string> = Record<DocumentPropertyKey, [DocumentPropertyDataType, label: string]>;
11
- export type TypeProperties<TypeKey extends string, DocumentPropertyKey extends string> = Record<TypeKey, DocumentPropertyKey[]>;
6
+ export type DocumentCategoryLabels<CategoryKey extends string> = Record<CategoryKey, string>;
7
+ export type DocumentCategoryParents<CategoryKey extends string> = Record<CategoryKey, CategoryKey | null>;
8
+ export type DocumentTypeLabels<TypeKey extends string> = Record<TypeKey, string>;
9
+ export type DocumentTypeCategories<TypeKey extends string, CategoryKey extends string> = Record<TypeKey, CategoryKey>;
10
+ export type DocumentPropertyConfigurations<DocumentPropertyKey extends string> = Record<DocumentPropertyKey, [DocumentPropertyDataType, label: string]>;
11
+ export type DocumentTypeProperties<TypeKey extends string, DocumentPropertyKey extends string> = Record<TypeKey, DocumentPropertyKey[]>;
12
+ /**
13
+ * @example
14
+ * ```ts
15
+ * import { DocumentPropertyDataType } from '../../../document-management/index.js';
16
+ * import type { DocumentCategoryLabels, DocumentCategoryParents, DocumentPropertyConfigurations, DocumentTypeCategories, DocumentTypeLabels, DocumentTypeProperties } from '../../../document-management/server/index.js';
17
+ * import { defineEnum, type EnumType } from '../../../enumeration/index.js';
18
+ *
19
+ * export const MyDocumentCategory = defineEnum('MyDocumentCategory', {
20
+ * Administration: 'administration',
21
+ * Finance: 'finance',
22
+ * });
23
+ *
24
+ * type MyDocumentCategory = EnumType<typeof MyDocumentCategory>;
25
+ *
26
+ * export const MyCategoryParents = {
27
+ * [MyDocumentCategory.Administration]: null,
28
+ * [MyDocumentCategory.Finance]: MyDocumentCategory.Administration,
29
+ * } as const satisfies DocumentCategoryParents<MyDocumentCategory>;
30
+ *
31
+ * export const MyDocumentCategoryLabels = {
32
+ * [MyDocumentCategory.Administration]: 'Allgemeine Verwaltung',
33
+ * [MyDocumentCategory.Finance]: 'Finanzen',
34
+ * } as const satisfies DocumentCategoryLabels<MyDocumentCategory>;
35
+ *
36
+ * export const MyDocumentType = defineEnum('MyDocumentType', {
37
+ * TerminationNotice: 'termination-notice',
38
+ * ComplaintLetter: 'complaint-letter',
39
+ * IncomingInvoice: 'incoming-invoice',
40
+ * OutgoingInvoice: 'outgoing-invoice',
41
+ * });
42
+ *
43
+ * type MyDocumentType = EnumType<typeof MyDocumentType>;
44
+ *
45
+ * export const MyDocumentTypeLabels = {
46
+ * [MyDocumentType.TerminationNotice]: 'Kündigungsschreiben',
47
+ * [MyDocumentType.ComplaintLetter]: 'Beschwerdeschreiben',
48
+ * [MyDocumentType.IncomingInvoice]: 'Eingangsrechnung',
49
+ * [MyDocumentType.OutgoingInvoice]: 'Ausgangsrechnung',
50
+ * } as const satisfies DocumentTypeLabels<MyDocumentType>;
51
+ *
52
+ * export const MyDocumentTypeCategories = {
53
+ * [MyDocumentType.TerminationNotice]: MyDocumentCategory.Administration,
54
+ * [MyDocumentType.ComplaintLetter]: MyDocumentCategory.Administration,
55
+ * [MyDocumentType.IncomingInvoice]: MyDocumentCategory.Finance,
56
+ * [MyDocumentType.OutgoingInvoice]: MyDocumentCategory.Finance,
57
+ * } as const satisfies DocumentTypeCategories<MyDocumentType, MyDocumentCategory>;
58
+ *
59
+ * export const MyDocumentProperty = defineEnum('MyDocumentProperty', {
60
+ * Correspondent: 'correspondent',
61
+ * ContractNumber: 'contract-number',
62
+ * Amount: 'amount',
63
+ * });
64
+ *
65
+ * export type MyDocumentProperty = EnumType<typeof MyDocumentProperty>;
66
+ *
67
+ * export const MyDocumentPropertyConfiguration = {
68
+ * [MyDocumentProperty.Correspondent]: [DocumentPropertyDataType.Text, 'Korrespondent'],
69
+ * [MyDocumentProperty.ContractNumber]: [DocumentPropertyDataType.Text, 'Vertragsnummer'],
70
+ * [MyDocumentProperty.Amount]: [DocumentPropertyDataType.Decimal, 'Betrag'],
71
+ * } as const satisfies DocumentPropertyConfigurations<MyDocumentProperty>;
72
+ *
73
+ * export const MyDocumentTypeProperties = {
74
+ * [MyDocumentType.TerminationNotice]: [MyDocumentProperty.Correspondent, MyDocumentProperty.ContractNumber],
75
+ * [MyDocumentType.ComplaintLetter]: [MyDocumentProperty.Correspondent],
76
+ * [MyDocumentType.IncomingInvoice]: [MyDocumentProperty.Correspondent, MyDocumentProperty.Amount],
77
+ * [MyDocumentType.OutgoingInvoice]: [MyDocumentProperty.Correspondent, MyDocumentProperty.Amount],
78
+ * } as const satisfies DocumentTypeProperties<MyDocumentType, MyDocumentProperty>;
79
+ * ```
80
+ */
12
81
  export type CategoriesAndTypesInitializationData<CategoryKey extends string, TypeKey extends string, DocumentPropertyKey extends string> = {
13
- categoryLabels: CategoryLabels<CategoryKey>;
14
- categoryParents: CategoryParents<NoInfer<CategoryKey>>;
15
- typeLabels: TypeLabels<TypeKey>;
16
- typeCategories: TypeCategories<NoInfer<TypeKey>, NoInfer<CategoryKey>>;
17
- propertyConfigurations: PropertyConfigurations<DocumentPropertyKey>;
18
- typeProperties: TypeProperties<NoInfer<TypeKey>, NoInfer<DocumentPropertyKey>>;
82
+ categoryLabels: DocumentCategoryLabels<CategoryKey>;
83
+ categoryParents: DocumentCategoryParents<NoInfer<CategoryKey>>;
84
+ typeLabels: DocumentTypeLabels<TypeKey>;
85
+ typeCategories: DocumentTypeCategories<NoInfer<TypeKey>, NoInfer<CategoryKey>>;
86
+ propertyConfigurations: DocumentPropertyConfigurations<DocumentPropertyKey>;
87
+ typeProperties: DocumentTypeProperties<NoInfer<TypeKey>, NoInfer<DocumentPropertyKey>>;
19
88
  };
20
89
  export declare class DocumentManagementService extends Transactional {
21
90
  #private;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tstdl/base",
3
- "version": "0.92.149",
3
+ "version": "0.92.150",
4
4
  "author": "Patrick Hein",
5
5
  "publishConfig": {
6
6
  "access": "public"