@tstdl/base 0.92.123 → 0.92.125
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/ai/ai-file.service.js +23 -18
- package/ai/ai.service.d.ts +4 -12
- package/ai/ai.service.js +79 -147
- package/ai/functions.d.ts +1 -1
- package/ai/types.d.ts +3 -1
- package/api/server/gateway.js +6 -6
- package/authentication/authentication.api.js +24 -24
- package/authentication/server/authentication.service.js +20 -20
- package/browser/page-controller.js +1 -1
- package/context/context.js +5 -5
- package/document-management/api/document-management.api.d.ts +60 -215
- package/document-management/api/document-management.api.js +32 -68
- package/document-management/models/document-assignment-scope.model.d.ts +11 -0
- package/document-management/models/{document-request-assignment-task-collection.model.js → document-assignment-scope.model.js} +14 -10
- package/document-management/models/document-assignment-task.model.d.ts +13 -0
- package/document-management/models/document-assignment-task.model.js +38 -0
- package/document-management/models/document-category.model.d.ts +2 -0
- package/document-management/models/document-category.model.js +7 -1
- package/document-management/models/{document-collection-document.model.d.ts → document-collection-assignment.model.d.ts} +1 -1
- package/document-management/models/{document-collection-document.model.js → document-collection-assignment.model.js} +7 -7
- package/document-management/models/document-collection.model.d.ts +2 -0
- package/document-management/models/document-collection.model.js +10 -0
- package/document-management/models/document-property-value.model.d.ts +3 -11
- package/document-management/models/document-property-value.model.js +15 -46
- package/document-management/models/document-property.model.d.ts +2 -1
- package/document-management/models/document-property.model.js +2 -2
- package/document-management/models/document-request-submission.model.d.ts +7 -0
- package/document-management/models/document-request-submission.model.js +34 -0
- package/document-management/models/document-request-template.d.ts +2 -4
- package/document-management/models/document-request-template.js +3 -8
- package/document-management/models/document-request.model.d.ts +14 -6
- package/document-management/models/document-request.model.js +22 -12
- package/document-management/models/document-type-validation.model.d.ts +6 -0
- package/document-management/models/document-type-validation.model.js +34 -0
- package/document-management/models/document-type.model.d.ts +0 -1
- package/document-management/models/document-type.model.js +0 -5
- package/document-management/models/document-validation-definition.model.d.ts +10 -0
- package/document-management/models/document-validation-definition.model.js +39 -0
- package/document-management/models/document-validation-execution-related-document.model.d.ts +7 -0
- package/document-management/models/document-validation-execution-related-document.model.js +34 -0
- package/document-management/models/document-validation-execution.model.d.ts +26 -0
- package/document-management/models/document-validation-execution.model.js +72 -0
- package/document-management/models/document-workflow.model.d.ts +35 -0
- package/document-management/models/document-workflow.model.js +70 -0
- package/document-management/models/document.model.d.ts +12 -1
- package/document-management/models/document.model.js +21 -5
- package/document-management/models/index.d.ts +10 -5
- package/document-management/models/index.js +10 -5
- package/document-management/models/service-models/categories-and-types.view-model.d.ts +3 -3
- package/document-management/models/service-models/categories-and-types.view-model.js +2 -21
- package/document-management/models/service-models/document-folders.view-model.d.ts +7 -14
- package/document-management/models/service-models/document-folders.view-model.js +20 -44
- package/document-management/models/service-models/document-management.view-model.d.ts +41 -0
- package/document-management/models/service-models/{document.view-model.js → document-management.view-model.js} +43 -26
- package/document-management/models/service-models/document.service-model.d.ts +51 -81
- package/document-management/models/service-models/document.service-model.js +30 -28
- package/document-management/models/service-models/enriched/enriched-document-assignment.view.d.ts +11 -0
- package/document-management/models/service-models/enriched/enriched-document-assignment.view.js +12 -0
- package/document-management/models/service-models/enriched/enriched-document-category.view.d.ts +13 -0
- package/document-management/models/service-models/enriched/enriched-document-category.view.js +47 -0
- package/document-management/models/service-models/enriched/enriched-document-collection.view.d.ts +22 -0
- package/document-management/models/service-models/enriched/enriched-document-collection.view.js +89 -0
- package/document-management/models/service-models/enriched/enriched-document-file.view.d.ts +12 -0
- package/document-management/models/service-models/enriched/enriched-document-file.view.js +16 -0
- package/document-management/models/service-models/enriched/enriched-document-management-data.view.d.ts +41 -0
- package/document-management/models/service-models/enriched/enriched-document-management-data.view.js +130 -0
- package/document-management/models/service-models/enriched/enriched-document-request.view.d.ts +17 -0
- package/document-management/models/service-models/enriched/enriched-document-request.view.js +52 -0
- package/document-management/models/service-models/enriched/enriched-document-type.view.d.ts +9 -0
- package/document-management/models/service-models/enriched/enriched-document-type.view.js +10 -0
- package/document-management/models/service-models/enriched/enriched-document.view.d.ts +28 -0
- package/document-management/models/service-models/enriched/enriched-document.view.js +77 -0
- package/document-management/models/service-models/enriched/enriched.d.ts +18 -0
- package/document-management/models/service-models/enriched/enriched.js +39 -0
- package/document-management/models/service-models/enriched/index.d.ts +9 -0
- package/document-management/models/service-models/enriched/index.js +9 -0
- package/document-management/models/service-models/index.d.ts +2 -2
- package/document-management/models/service-models/index.js +2 -2
- package/document-management/models/service-models/normalized-requests-template-data.model.d.ts +12 -10
- package/document-management/models/service-models/normalized-requests-template-data.model.js +5 -4
- package/document-management/models/service-models/stats.view-model.d.ts +7 -5
- package/document-management/models/service-models/stats.view-model.js +19 -9
- package/document-management/server/module.d.ts +2 -2
- package/document-management/server/module.js +3 -7
- package/document-management/server/schemas.d.ts +18 -23
- package/document-management/server/schemas.js +18 -23
- package/document-management/server/services/document-category-type.service.d.ts +25 -0
- package/document-management/server/services/document-category-type.service.js +66 -0
- package/document-management/server/services/document-collection.service.d.ts +13 -0
- package/document-management/server/services/document-collection.service.js +41 -0
- package/document-management/server/services/document-file.service.d.ts +17 -0
- package/document-management/server/services/document-file.service.js +204 -0
- package/document-management/server/services/document-management-ai.service.d.ts +22 -0
- package/document-management/server/services/document-management-ai.service.js +340 -0
- package/document-management/server/services/document-management-ancillary.service.d.ts +127 -3
- package/document-management/server/services/document-management-ancillary.service.js +24 -0
- package/document-management/server/services/document-management.service.d.ts +10 -122
- package/document-management/server/services/document-management.service.js +106 -888
- package/document-management/server/services/document-property.service.d.ts +84 -0
- package/document-management/server/services/document-property.service.js +87 -0
- package/document-management/server/services/document-request.service.d.ts +30 -0
- package/document-management/server/services/document-request.service.js +138 -0
- package/document-management/server/services/document-validation.service.d.ts +20 -0
- package/document-management/server/services/document-validation.service.js +145 -0
- package/document-management/server/services/document-workflow.service.d.ts +20 -0
- package/document-management/server/services/document-workflow.service.js +132 -0
- package/document-management/server/services/document.service.d.ts +16 -0
- package/document-management/server/services/document.service.js +81 -0
- package/document-management/server/services/index.d.ts +9 -0
- package/document-management/server/services/index.js +9 -0
- package/document-management/server/validators/ai-validation-executor.d.ts +19 -0
- package/document-management/server/validators/ai-validation-executor.js +51 -0
- package/document-management/server/validators/index.d.ts +2 -0
- package/document-management/server/validators/index.js +2 -0
- package/document-management/server/validators/single-document-validation-executor.d.ts +16 -0
- package/document-management/server/validators/single-document-validation-executor.js +20 -0
- package/document-management/server/validators/validator.d.ts +21 -0
- package/document-management/server/validators/validator.js +2 -0
- package/eslint.config.js +31 -17
- package/examples/document-management/main.d.ts +18 -3
- package/examples/document-management/main.js +28 -12
- package/file/mime-type.js +2 -9
- package/formats.d.ts +5 -2
- package/formats.js +32 -23
- package/http/client/http-client.js +1 -1
- package/injector/injector.js +2 -2
- package/object-storage/s3/s3.object-storage.js +1 -1
- package/orm/data-types/bytea.d.ts +8 -0
- package/orm/data-types/bytea.js +8 -0
- package/orm/data-types/index.d.ts +4 -0
- package/orm/data-types/index.js +4 -0
- package/orm/data-types/numeric-date.d.ts +9 -0
- package/orm/data-types/numeric-date.js +9 -0
- package/orm/data-types/timestamp.d.ts +9 -0
- package/orm/data-types/timestamp.js +9 -0
- package/orm/decorators.d.ts +139 -5
- package/orm/decorators.js +50 -0
- package/orm/entity.d.ts +19 -0
- package/orm/entity.js +19 -0
- package/orm/index.d.ts +5 -0
- package/orm/index.js +5 -0
- package/orm/query.d.ts +51 -0
- package/orm/query.js +6 -0
- package/orm/repository.types.d.ts +54 -2
- package/orm/server/database-schema.d.ts +34 -0
- package/orm/server/database-schema.js +29 -0
- package/orm/server/database.d.ts +19 -1
- package/orm/server/database.js +17 -3
- package/orm/server/drizzle/schema-converter.d.ts +2 -1
- package/orm/server/drizzle/schema-converter.js +12 -1
- package/orm/server/encryption.d.ts +16 -0
- package/orm/server/encryption.js +29 -4
- package/orm/server/index.d.ts +7 -0
- package/orm/server/index.js +7 -0
- package/orm/server/module.d.ts +20 -0
- package/orm/server/module.js +9 -0
- package/orm/server/query-converter.d.ts +17 -0
- package/orm/server/query-converter.js +66 -11
- package/orm/server/repository.d.ts +324 -18
- package/orm/server/repository.js +344 -73
- package/orm/server/transaction.d.ts +5 -5
- package/orm/server/transaction.js +5 -5
- package/orm/server/transactional.d.ts +75 -0
- package/orm/server/transactional.js +134 -0
- package/orm/server/types.d.ts +1 -0
- package/orm/sqls.d.ts +55 -0
- package/orm/sqls.js +60 -0
- package/orm/types.d.ts +67 -4
- package/orm/utils.d.ts +19 -3
- package/orm/utils.js +12 -0
- package/package.json +32 -31
- package/password/password-check-result.model.d.ts +9 -7
- package/password/password-check-result.model.js +8 -8
- package/password/password-check.js +5 -7
- package/password/password-check.localization.js +12 -12
- package/pdf/pdf.service.js +1 -1
- package/pdf/utils.d.ts +9 -0
- package/pdf/utils.js +19 -2
- package/process/spawn.d.ts +11 -4
- package/process/spawn.js +42 -5
- package/queue/postgres/queue.js +5 -5
- package/queue/queue.d.ts +6 -4
- package/queue/queue.js +6 -6
- package/schema/schemas/one-or-many.d.ts +2 -1
- package/schema/schemas/one-or-many.js +1 -1
- package/search-index/elastic/model/index-mapping.d.ts +1 -1
- package/search-index/elastic/model/index-mapping.js +0 -1
- package/search-index/elastic/search-index.d.ts +1 -2
- package/search-index/elastic/search-index.js +3 -3
- package/types.d.ts +1 -0
- package/utils/async-hook/async-hook.d.ts +9 -0
- package/utils/async-hook/async-hook.js +21 -0
- package/utils/async-hook/index.d.ts +1 -0
- package/utils/async-hook/index.js +1 -0
- package/utils/compression.js +1 -1
- package/utils/function/class.d.ts +6 -0
- package/utils/function/class.js +9 -0
- package/utils/function/index.d.ts +1 -0
- package/utils/function/index.js +1 -0
- package/utils/function/memoize.d.ts +18 -0
- package/utils/function/memoize.js +41 -2
- package/utils/jwt.d.ts +1 -1
- package/utils/jwt.js +5 -5
- package/utils/object/forward-ref.d.ts +3 -2
- package/utils/object/forward-ref.js +12 -12
- package/utils/object/lazy-property.js +2 -2
- package/utils/proxy.js +1 -1
- package/utils/stream/{readable-stream-from-promise.d.ts → from-promise.d.ts} +1 -0
- package/utils/stream/from-promise.js +27 -0
- package/utils/stream/index.d.ts +1 -1
- package/utils/stream/index.js +1 -1
- package/utils/stream/stream-reader.js +71 -31
- package/document-management/models/document-request-assignment-task-collection.model.d.ts +0 -7
- package/document-management/models/document-request-assignment-task.model.d.ts +0 -14
- package/document-management/models/document-request-assignment-task.model.js +0 -77
- package/document-management/models/document-request-file.model.d.ts +0 -16
- package/document-management/models/document-request-file.model.js +0 -86
- package/document-management/models/service-models/document.view-model.d.ts +0 -41
- package/document-management/models/service-models/normalized-document-collection-view.model.d.ts +0 -73
- package/document-management/models/service-models/normalized-document-collection-view.model.js +0 -110
- package/utils/stream/readable-stream-from-promise.js +0 -8
package/formats.js
CHANGED
|
@@ -7,35 +7,35 @@ export function configureFormats(options) {
|
|
|
7
7
|
}
|
|
8
8
|
export const integerFormat = {
|
|
9
9
|
useGrouping: true,
|
|
10
|
-
maximumFractionDigits: 0
|
|
10
|
+
maximumFractionDigits: 0,
|
|
11
11
|
};
|
|
12
12
|
export const decimalFormat = {
|
|
13
13
|
useGrouping: true,
|
|
14
14
|
minimumFractionDigits: 2,
|
|
15
|
-
maximumFractionDigits: 2
|
|
15
|
+
maximumFractionDigits: 2,
|
|
16
16
|
};
|
|
17
17
|
export const decimal1Format = {
|
|
18
18
|
useGrouping: true,
|
|
19
19
|
minimumFractionDigits: 0,
|
|
20
|
-
maximumFractionDigits: 1
|
|
20
|
+
maximumFractionDigits: 1,
|
|
21
21
|
};
|
|
22
22
|
export const yearFormat = {
|
|
23
23
|
useGrouping: false,
|
|
24
|
-
maximumFractionDigits: 0
|
|
24
|
+
maximumFractionDigits: 0,
|
|
25
25
|
};
|
|
26
26
|
export const dateTimeNumeric = {
|
|
27
27
|
year: 'numeric',
|
|
28
28
|
month: '2-digit',
|
|
29
29
|
day: '2-digit',
|
|
30
30
|
hour: '2-digit',
|
|
31
|
-
minute: '2-digit'
|
|
31
|
+
minute: '2-digit',
|
|
32
32
|
};
|
|
33
33
|
export const dateTimeShort = {
|
|
34
34
|
year: 'numeric',
|
|
35
35
|
month: 'short',
|
|
36
36
|
day: '2-digit',
|
|
37
37
|
hour: '2-digit',
|
|
38
|
-
minute: '2-digit'
|
|
38
|
+
minute: '2-digit',
|
|
39
39
|
};
|
|
40
40
|
export const dateTimeLong = {
|
|
41
41
|
year: 'numeric',
|
|
@@ -43,48 +43,48 @@ export const dateTimeLong = {
|
|
|
43
43
|
month: 'long',
|
|
44
44
|
day: '2-digit',
|
|
45
45
|
hour: '2-digit',
|
|
46
|
-
minute: '2-digit'
|
|
46
|
+
minute: '2-digit',
|
|
47
47
|
};
|
|
48
48
|
export const dateShort = {
|
|
49
49
|
year: 'numeric',
|
|
50
50
|
month: '2-digit',
|
|
51
|
-
day: '2-digit'
|
|
51
|
+
day: '2-digit',
|
|
52
52
|
};
|
|
53
53
|
export const dateMedium = {
|
|
54
54
|
year: 'numeric',
|
|
55
55
|
month: 'long',
|
|
56
|
-
day: '2-digit'
|
|
56
|
+
day: '2-digit',
|
|
57
57
|
};
|
|
58
58
|
export const dateLong = {
|
|
59
59
|
year: 'numeric',
|
|
60
60
|
weekday: 'long',
|
|
61
61
|
month: 'long',
|
|
62
|
-
day: '2-digit'
|
|
62
|
+
day: '2-digit',
|
|
63
63
|
};
|
|
64
64
|
export const timeShort = {
|
|
65
65
|
hour: '2-digit',
|
|
66
|
-
minute: '2-digit'
|
|
66
|
+
minute: '2-digit',
|
|
67
67
|
};
|
|
68
|
-
export const
|
|
68
|
+
export const currencyFormat = {
|
|
69
69
|
style: 'currency',
|
|
70
|
-
currency: 'EUR'
|
|
71
70
|
};
|
|
72
|
-
export const
|
|
73
|
-
...
|
|
74
|
-
minimumFractionDigits: 0
|
|
71
|
+
export const currencyFormatWithoutCents = {
|
|
72
|
+
...currencyFormat,
|
|
73
|
+
minimumFractionDigits: 0,
|
|
75
74
|
};
|
|
76
75
|
export const percentFormat = {
|
|
77
76
|
style: 'percent',
|
|
78
77
|
minimumFractionDigits: 2,
|
|
79
|
-
maximumFractionDigits: 2
|
|
78
|
+
maximumFractionDigits: 2,
|
|
80
79
|
};
|
|
81
80
|
const getDecimalFormatter = memoize(_getDecimalFormatter);
|
|
82
|
-
const dateFormatter = memoizeSingle((loc) => Intl.DateTimeFormat(loc, dateShort));
|
|
83
81
|
const integerFormatter = memoizeSingle((loc) => Intl.NumberFormat(loc, integerFormat));
|
|
84
82
|
const decimalFormatter = memoizeSingle((loc) => Intl.NumberFormat(loc, decimalFormat));
|
|
85
83
|
const yearFormatter = memoizeSingle((loc) => Intl.NumberFormat(loc, yearFormat));
|
|
86
|
-
const euroFormatter = memoizeSingle((loc) => Intl.NumberFormat(loc, euroFormat));
|
|
87
84
|
const percentFormatter = memoizeSingle((loc) => Intl.NumberFormat(loc, percentFormat));
|
|
85
|
+
const dateFormatter = memoizeSingle((loc) => Intl.DateTimeFormat(loc, dateShort));
|
|
86
|
+
const currencyFormatter = memoize((currency, loc) => Intl.NumberFormat(loc, { ...currencyFormat, currency }));
|
|
87
|
+
const currencyFormatterWithoutCents = memoize((currency, loc) => Intl.NumberFormat(loc, { ...currencyFormatWithoutCents, currency }));
|
|
88
88
|
const timeShortFormatter = memoizeSingle((loc) => Intl.DateTimeFormat(loc, timeShort));
|
|
89
89
|
const dateShortFormatter = memoizeSingle((loc) => Intl.DateTimeFormat(loc, dateShort));
|
|
90
90
|
export function formatNumber(value, format) {
|
|
@@ -97,7 +97,7 @@ export function formatDecimal(value, minimumFractionDigits, maximumFractionDigit
|
|
|
97
97
|
if (isUndefined(minimumFractionDigits) && isUndefined(maximumFractionDigits)) {
|
|
98
98
|
return decimalFormatter(locale).format(value);
|
|
99
99
|
}
|
|
100
|
-
return getDecimalFormatter(minimumFractionDigits ?? 2, maximumFractionDigits ?? 2).format(value);
|
|
100
|
+
return getDecimalFormatter(locale, minimumFractionDigits ?? 2, maximumFractionDigits ?? 2).format(value);
|
|
101
101
|
}
|
|
102
102
|
export function formatYear(value) {
|
|
103
103
|
return yearFormatter(locale).format(value);
|
|
@@ -114,8 +114,17 @@ export function formatDate(dateOrTimestamp) {
|
|
|
114
114
|
export function formatNumericDate(numericDate) {
|
|
115
115
|
return formatDate(numericDateToTimestamp(numericDate));
|
|
116
116
|
}
|
|
117
|
+
export function formatCurrency(value, currency) {
|
|
118
|
+
return currencyFormatter(currency, locale).format(value);
|
|
119
|
+
}
|
|
120
|
+
export function formatCurrencyWithoutCents(value, currency) {
|
|
121
|
+
return currencyFormatterWithoutCents(currency, locale).format(value);
|
|
122
|
+
}
|
|
117
123
|
export function formatEuro(value) {
|
|
118
|
-
return
|
|
124
|
+
return currencyFormatter('EUR', locale).format(value);
|
|
125
|
+
}
|
|
126
|
+
export function formatEuroWithoutCents(value) {
|
|
127
|
+
return currencyFormatterWithoutCents('EUR', locale).format(value);
|
|
119
128
|
}
|
|
120
129
|
export function formatPercent(value) {
|
|
121
130
|
return percentFormatter(locale).format(value);
|
|
@@ -133,10 +142,10 @@ export function formatPersonName(person, { lastNameFirst = false, fallback } = {
|
|
|
133
142
|
* @deprecated use {@link formatPersonName} instead
|
|
134
143
|
*/
|
|
135
144
|
export const formatUserName = formatPersonName;
|
|
136
|
-
function _getDecimalFormatter(minimumFractionDigits = 2, maximumFractionDigits = 2) {
|
|
145
|
+
function _getDecimalFormatter(locale, minimumFractionDigits = 2, maximumFractionDigits = 2) {
|
|
137
146
|
return Intl.NumberFormat(locale, {
|
|
138
147
|
useGrouping: true,
|
|
139
148
|
minimumFractionDigits,
|
|
140
|
-
maximumFractionDigits
|
|
149
|
+
maximumFractionDigits,
|
|
141
150
|
});
|
|
142
151
|
}
|
|
@@ -14,7 +14,7 @@ import { encodeBase64 } from '../../utils/base64.js';
|
|
|
14
14
|
import { encodeUtf8 } from '../../utils/encoding.js';
|
|
15
15
|
import { composeAsyncMiddleware } from '../../utils/middleware.js';
|
|
16
16
|
import { objectEntries } from '../../utils/object/object.js';
|
|
17
|
-
import { readableStreamFromPromise } from '../../utils/stream/
|
|
17
|
+
import { readableStreamFromPromise } from '../../utils/stream/from-promise.js';
|
|
18
18
|
import { assertDefined, isArray, isBlob, isDefined, isObject, isUndefined } from '../../utils/type-guards.js';
|
|
19
19
|
import { buildUrl } from '../../utils/url-builder.js';
|
|
20
20
|
import { HttpHeaders } from '../http-headers.js';
|
package/injector/injector.js
CHANGED
|
@@ -209,8 +209,8 @@ export class Injector {
|
|
|
209
209
|
this.assertNotDisposed();
|
|
210
210
|
if (isDefined(options.forwardRef) && (options.forwardRef != false)) {
|
|
211
211
|
assert(options.optional != true, 'ForwardRef does not support optional without resolveAll/injectAll as undefined is not forwardable.');
|
|
212
|
-
const forwardRef = ForwardRef.create();
|
|
213
212
|
const forwardToken = isFunction(options.forwardRef) ? options.forwardRef() : token;
|
|
213
|
+
const forwardRef = ForwardRef.create({ typeHint: (options.forwardRefTypeHint ?? isFunction(forwardToken)) ? forwardToken : undefined });
|
|
214
214
|
context.forwardRefQueue.add(() => ForwardRef.setRef(forwardRef, this._resolve(forwardToken, argument, { ...options, forwardRef: false }, context, chain.markAsForwardRef(forwardToken))));
|
|
215
215
|
context.forwardRefs.add(forwardRef);
|
|
216
216
|
return forwardRef;
|
|
@@ -234,8 +234,8 @@ export class Injector {
|
|
|
234
234
|
_resolveAll(token, argument, options, context, chain) {
|
|
235
235
|
this.assertNotDisposed();
|
|
236
236
|
if (isDefined(options.forwardRef) && (options.forwardRef != false)) {
|
|
237
|
-
const forwardRef = ForwardRef.create({ typeHint: options.forwardRefTypeHint });
|
|
238
237
|
const forwardToken = isFunction(options.forwardRef) ? options.forwardRef() : token;
|
|
238
|
+
const forwardRef = ForwardRef.create({ typeHint: (options.forwardRefTypeHint ?? isFunction(forwardToken)) ? forwardToken : undefined });
|
|
239
239
|
context.forwardRefQueue.add(() => ForwardRef.setRef(forwardRef, this._resolveAll(forwardToken, argument, { ...options, forwardRef: false }, context, chain.markAsForwardRef(forwardToken))));
|
|
240
240
|
context.forwardRefs.add(forwardRef);
|
|
241
241
|
return forwardRef;
|
|
@@ -62,7 +62,7 @@ let S3ObjectStorage = class S3ObjectStorage extends ObjectStorage {
|
|
|
62
62
|
const errorPromise = new Promise((_, reject) => readable.on('error', reject));
|
|
63
63
|
await Promise.race([
|
|
64
64
|
this.client.putObject(this.bucket, bucketKey, readable, options?.contentLength, options?.metadata),
|
|
65
|
-
errorPromise
|
|
65
|
+
errorPromise,
|
|
66
66
|
]);
|
|
67
67
|
}
|
|
68
68
|
}
|
|
@@ -1,8 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module
|
|
3
|
+
* Defines a custom Drizzle type for handling PostgreSQL `bytea` columns.
|
|
4
|
+
*/
|
|
1
5
|
import { type ConvertCustomConfig, type PgCustomColumnBuilder } from 'drizzle-orm/pg-core';
|
|
2
6
|
type Config = {
|
|
3
7
|
data: Uint8Array;
|
|
4
8
|
driverData: Uint8Array;
|
|
5
9
|
};
|
|
10
|
+
/**
|
|
11
|
+
* Custom Drizzle type for PostgreSQL `bytea` columns.
|
|
12
|
+
* Maps between `Uint8Array` in JavaScript and `bytea` in the database.
|
|
13
|
+
*/
|
|
6
14
|
export declare const bytea: {
|
|
7
15
|
(): PgCustomColumnBuilder<ConvertCustomConfig<"", Config>>;
|
|
8
16
|
<TName extends string>(dbName: TName): PgCustomColumnBuilder<ConvertCustomConfig<TName, Config>>;
|
package/orm/data-types/bytea.js
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module
|
|
3
|
+
* Defines a custom Drizzle type for handling PostgreSQL `bytea` columns.
|
|
4
|
+
*/
|
|
1
5
|
import { customType } from 'drizzle-orm/pg-core';
|
|
6
|
+
/**
|
|
7
|
+
* Custom Drizzle type for PostgreSQL `bytea` columns.
|
|
8
|
+
* Maps between `Uint8Array` in JavaScript and `bytea` in the database.
|
|
9
|
+
*/
|
|
2
10
|
export const bytea = customType({
|
|
3
11
|
dataType() {
|
|
4
12
|
return 'bytea';
|
package/orm/data-types/index.js
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module
|
|
3
|
+
* Defines a custom Drizzle type for handling PostgreSQL `date` columns
|
|
4
|
+
* using numeric representation (YYYYMMDD).
|
|
5
|
+
*/
|
|
1
6
|
import { type ConvertCustomConfig, type PgCustomColumnBuilder } from 'drizzle-orm/pg-core';
|
|
2
7
|
type Config = {
|
|
3
8
|
data: number;
|
|
4
9
|
driverData: string;
|
|
5
10
|
};
|
|
11
|
+
/**
|
|
12
|
+
* Custom Drizzle type for PostgreSQL `date` columns, storing dates as numeric values (YYYYMMDD).
|
|
13
|
+
* Converts between JavaScript `number` (YYYYMMDD) and database `date` (ISO string).
|
|
14
|
+
*/
|
|
6
15
|
export declare const numericDate: {
|
|
7
16
|
(): PgCustomColumnBuilder<ConvertCustomConfig<"", Config>>;
|
|
8
17
|
<TName extends string>(dbName: TName): PgCustomColumnBuilder<ConvertCustomConfig<TName, Config>>;
|
|
@@ -1,5 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module
|
|
3
|
+
* Defines a custom Drizzle type for handling PostgreSQL `date` columns
|
|
4
|
+
* using numeric representation (YYYYMMDD).
|
|
5
|
+
*/
|
|
1
6
|
import { customType } from 'drizzle-orm/pg-core';
|
|
2
7
|
import { dateToNumericDate, numericDateToDate } from '../../utils/date-time.js';
|
|
8
|
+
/**
|
|
9
|
+
* Custom Drizzle type for PostgreSQL `date` columns, storing dates as numeric values (YYYYMMDD).
|
|
10
|
+
* Converts between JavaScript `number` (YYYYMMDD) and database `date` (ISO string).
|
|
11
|
+
*/
|
|
3
12
|
export const numericDate = customType({
|
|
4
13
|
dataType() {
|
|
5
14
|
return 'date';
|
|
@@ -1,8 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module
|
|
3
|
+
* Defines a custom Drizzle type for handling PostgreSQL `timestamp with time zone` columns
|
|
4
|
+
* using numeric representation (Unix timestamp in milliseconds).
|
|
5
|
+
*/
|
|
1
6
|
import { type ConvertCustomConfig, type PgCustomColumnBuilder } from 'drizzle-orm/pg-core';
|
|
2
7
|
type Config = {
|
|
3
8
|
data: number;
|
|
4
9
|
driverData: string;
|
|
5
10
|
};
|
|
11
|
+
/**
|
|
12
|
+
* Custom Drizzle type for PostgreSQL `timestamp with time zone` columns, storing timestamps as numeric values (Unix timestamp in milliseconds).
|
|
13
|
+
* Converts between JavaScript `number` (milliseconds since epoch) and database `timestamp with time zone` (ISO string).
|
|
14
|
+
*/
|
|
6
15
|
export declare const timestamp: {
|
|
7
16
|
(): PgCustomColumnBuilder<ConvertCustomConfig<"", Config>>;
|
|
8
17
|
<TName extends string>(dbName: TName): PgCustomColumnBuilder<ConvertCustomConfig<TName, Config>>;
|
|
@@ -1,4 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module
|
|
3
|
+
* Defines a custom Drizzle type for handling PostgreSQL `timestamp with time zone` columns
|
|
4
|
+
* using numeric representation (Unix timestamp in milliseconds).
|
|
5
|
+
*/
|
|
1
6
|
import { customType } from 'drizzle-orm/pg-core';
|
|
7
|
+
/**
|
|
8
|
+
* Custom Drizzle type for PostgreSQL `timestamp with time zone` columns, storing timestamps as numeric values (Unix timestamp in milliseconds).
|
|
9
|
+
* Converts between JavaScript `number` (milliseconds since epoch) and database `timestamp with time zone` (ISO string).
|
|
10
|
+
*/
|
|
2
11
|
export const timestamp = customType({
|
|
3
12
|
dataType() {
|
|
4
13
|
return 'timestamp with time zone';
|
package/orm/decorators.d.ts
CHANGED
|
@@ -1,12 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module
|
|
3
|
+
* Defines decorators for ORM entities and columns, used to configure database schema mapping.
|
|
4
|
+
*/
|
|
1
5
|
import type { SQL } from 'drizzle-orm';
|
|
2
6
|
import type { LiteralUnion } from 'type-fest';
|
|
3
7
|
import type { AbstractConstructor, TypedOmit } from '../types.js';
|
|
4
|
-
import type { Entity, EntityType } from './entity.js';
|
|
8
|
+
import type { Entity, EntityType, EntityWithoutMetadata } from './entity.js';
|
|
9
|
+
import type { Query } from './query.js';
|
|
5
10
|
import type { PgTableFromType } from './server/types.js';
|
|
6
11
|
type IndexMethod = LiteralUnion<'hash' | 'btree' | 'gist' | 'spgist' | 'gin' | 'brin' | 'hnsw' | 'ivfflat', string>;
|
|
7
12
|
type NamingStrategy = 'abbreviated-table';
|
|
8
13
|
type Columns<T> = [Extract<keyof T, string>, ...Extract<keyof T, string>[]];
|
|
14
|
+
/**
|
|
15
|
+
* Builder function type for creating SQL check constraints.
|
|
16
|
+
* @param table - The Drizzle table object.
|
|
17
|
+
* @returns The SQL check constraint expression.
|
|
18
|
+
*/
|
|
9
19
|
export type CheckBuilder<T extends Entity = any> = (table: PgTableFromType<EntityType<T>>) => SQL;
|
|
20
|
+
/**
|
|
21
|
+
* Builder function type for creating partial index WHERE clauses.
|
|
22
|
+
* @param table - The Drizzle table object.
|
|
23
|
+
* @returns The query object representing the WHERE clause.
|
|
24
|
+
*/
|
|
25
|
+
export type WhereBuilder<T extends Entity | EntityWithoutMetadata = any> = (table: PgTableFromType<EntityType<T>>) => Query<T>;
|
|
26
|
+
/**
|
|
27
|
+
* Reflection data stored for ORM table decorators.
|
|
28
|
+
*/
|
|
10
29
|
export type OrmTableReflectionData = {
|
|
11
30
|
name?: string;
|
|
12
31
|
schema?: string;
|
|
@@ -16,6 +35,9 @@ export type OrmTableReflectionData = {
|
|
|
16
35
|
index?: IndexReflectionData[];
|
|
17
36
|
checks?: CheckReflectionData[];
|
|
18
37
|
};
|
|
38
|
+
/**
|
|
39
|
+
* Reflection data stored for ORM column decorators.
|
|
40
|
+
*/
|
|
19
41
|
export type OrmColumnReflectionData = {
|
|
20
42
|
name?: string;
|
|
21
43
|
primaryKey?: boolean;
|
|
@@ -31,6 +53,9 @@ export type OrmColumnReflectionData = {
|
|
|
31
53
|
references?: () => EntityType;
|
|
32
54
|
encrypted?: boolean;
|
|
33
55
|
};
|
|
56
|
+
/**
|
|
57
|
+
* Reflection data for unique constraints.
|
|
58
|
+
*/
|
|
34
59
|
export type UniqueReflectionData = {
|
|
35
60
|
name?: string;
|
|
36
61
|
columns?: string[];
|
|
@@ -39,13 +64,18 @@ export type UniqueReflectionData = {
|
|
|
39
64
|
naming?: NamingStrategy;
|
|
40
65
|
};
|
|
41
66
|
};
|
|
42
|
-
|
|
67
|
+
/**
|
|
68
|
+
* Reflection data for index definitions.
|
|
69
|
+
* @template T - The entity type.
|
|
70
|
+
*/
|
|
71
|
+
export type IndexReflectionData<T extends Entity | EntityWithoutMetadata = any> = {
|
|
43
72
|
name?: string;
|
|
44
73
|
columns?: (string | [string, 'asc' | 'desc'])[];
|
|
45
74
|
order?: 'asc' | 'desc';
|
|
46
75
|
options?: {
|
|
47
76
|
using?: IndexMethod;
|
|
48
77
|
unique?: boolean;
|
|
78
|
+
where?: WhereBuilder<T>;
|
|
49
79
|
nulls?: 'first' | 'last';
|
|
50
80
|
naming?: NamingStrategy;
|
|
51
81
|
};
|
|
@@ -57,22 +87,126 @@ type CheckReflectionData = {
|
|
|
57
87
|
naming?: NamingStrategy;
|
|
58
88
|
};
|
|
59
89
|
};
|
|
90
|
+
/**
|
|
91
|
+
* Factory function to create a class decorator for ORM table configuration.
|
|
92
|
+
* Merges provided data with existing ORM reflection data on the class metadata.
|
|
93
|
+
* @param data - The ORM table reflection data to add.
|
|
94
|
+
* @returns A class decorator.
|
|
95
|
+
*/
|
|
60
96
|
export declare function createTableDecorator(data?: OrmTableReflectionData): ClassDecorator;
|
|
97
|
+
/**
|
|
98
|
+
* Factory function to create a property decorator for ORM column configuration.
|
|
99
|
+
* Merges provided data with existing ORM reflection data on the property metadata.
|
|
100
|
+
* @param data - The ORM column reflection data to add.
|
|
101
|
+
* @returns A property decorator.
|
|
102
|
+
*/
|
|
61
103
|
export declare function createColumnDecorator(data?: OrmColumnReflectionData): PropertyDecorator;
|
|
104
|
+
/**
|
|
105
|
+
* Factory function to create a decorator applicable to both classes and properties for ORM configuration.
|
|
106
|
+
* Merges provided data with existing ORM reflection data on the target's metadata.
|
|
107
|
+
* @param data - The ORM reflection data to add.
|
|
108
|
+
* @returns A class or property decorator.
|
|
109
|
+
*/
|
|
62
110
|
export declare function createTableAndColumnDecorator(data?: OrmColumnReflectionData): ClassDecorator & PropertyDecorator;
|
|
111
|
+
/**
|
|
112
|
+
* Decorator to specify ORM column options.
|
|
113
|
+
* @param options - Column configuration options.
|
|
114
|
+
* @returns A property decorator.
|
|
115
|
+
*/
|
|
63
116
|
export declare function Column(options: OrmColumnReflectionData): PropertyDecorator;
|
|
117
|
+
/**
|
|
118
|
+
* Decorator to mark a property as the primary key column.
|
|
119
|
+
* @returns A property decorator.
|
|
120
|
+
*/
|
|
64
121
|
export declare function PrimaryKey(): PropertyDecorator;
|
|
122
|
+
/**
|
|
123
|
+
* Decorator to define a foreign key relationship.
|
|
124
|
+
* @param type - A function returning the referenced entity type.
|
|
125
|
+
* @returns A property decorator.
|
|
126
|
+
*/
|
|
65
127
|
export declare function References(type: () => EntityType): PropertyDecorator;
|
|
128
|
+
/**
|
|
129
|
+
* Decorator to define a table check constraint.
|
|
130
|
+
* @template T - The entity type.
|
|
131
|
+
* @param name - The name of the check constraint.
|
|
132
|
+
* @param builder - A function to build the SQL check expression.
|
|
133
|
+
* @returns A class decorator.
|
|
134
|
+
*/
|
|
66
135
|
export declare function Check<T extends Entity>(name: string, builder: CheckBuilder<T>): ClassDecorator;
|
|
136
|
+
/**
|
|
137
|
+
* Decorator to mark a column for encryption.
|
|
138
|
+
* The underlying database type will typically be `bytea`.
|
|
139
|
+
* @returns A property decorator.
|
|
140
|
+
*/
|
|
67
141
|
export declare function Encrypted(): PropertyDecorator;
|
|
142
|
+
/**
|
|
143
|
+
* Decorator to embed another class's properties into the current entity's table.
|
|
144
|
+
* @param type - The constructor of the class to embed.
|
|
145
|
+
* @param options - Embedding options, like prefixing column names.
|
|
146
|
+
* @returns A property decorator.
|
|
147
|
+
*/
|
|
68
148
|
export declare function Embedded(type: AbstractConstructor, options?: TypedOmit<NonNullable<OrmColumnReflectionData['embedded']>, 'type'>): PropertyDecorator;
|
|
69
149
|
type TableOptions = Partial<Pick<OrmTableReflectionData, 'name' | 'schema'>>;
|
|
150
|
+
/**
|
|
151
|
+
* Decorator to specify the database table name and optionally the schema.
|
|
152
|
+
* @param name - The table name.
|
|
153
|
+
* @param options - Additional table options (currently only schema).
|
|
154
|
+
* @returns A class decorator.
|
|
155
|
+
*/
|
|
70
156
|
export declare function Table(name?: string, options?: TypedOmit<TableOptions, 'schema'>): ClassDecorator;
|
|
157
|
+
/**
|
|
158
|
+
* Decorator to specify database table options like name and schema.
|
|
159
|
+
* @param options - Table options including name and schema.
|
|
160
|
+
* @returns A class decorator.
|
|
161
|
+
*/
|
|
71
162
|
export declare function Table(options?: TableOptions): ClassDecorator;
|
|
163
|
+
/**
|
|
164
|
+
* Decorator to define a unique constraint on a single column.
|
|
165
|
+
* @param name - Optional name for the unique constraint.
|
|
166
|
+
* @param options - Additional unique constraint options.
|
|
167
|
+
* @returns A property decorator.
|
|
168
|
+
*/
|
|
72
169
|
export declare function Unique(name?: string, options?: UniqueReflectionData['options']): PropertyDecorator;
|
|
170
|
+
/**
|
|
171
|
+
* Decorator to define a composite unique constraint on multiple columns.
|
|
172
|
+
* @template T - The entity type.
|
|
173
|
+
* @param name - The name of the unique constraint.
|
|
174
|
+
* @param columns - An array of property names included in the constraint.
|
|
175
|
+
* @param options - Additional unique constraint options.
|
|
176
|
+
* @returns A class decorator.
|
|
177
|
+
*/
|
|
73
178
|
export declare function Unique<T>(name: string | undefined, columns: Columns<T>, options?: UniqueReflectionData['options']): ClassDecorator;
|
|
179
|
+
/**
|
|
180
|
+
* Decorator to define a composite unique constraint on multiple columns.
|
|
181
|
+
* @template T - The entity type.
|
|
182
|
+
* @param columns - An array of property names included in the constraint.
|
|
183
|
+
* @param options - Additional unique constraint options.
|
|
184
|
+
* @returns A class decorator.
|
|
185
|
+
*/
|
|
74
186
|
export declare function Unique<T>(columns: Columns<T>, options?: UniqueReflectionData['options']): ClassDecorator;
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
187
|
+
/**
|
|
188
|
+
* Decorator to define an index on a single column.
|
|
189
|
+
* @template T - The entity type.
|
|
190
|
+
* @param name - Optional name for the index.
|
|
191
|
+
* @param options - Additional index options (e.g., method, uniqueness, conditions).
|
|
192
|
+
* @returns A property decorator.
|
|
193
|
+
*/
|
|
194
|
+
export declare function Index<T extends Entity | EntityWithoutMetadata = any>(name?: string, options?: IndexReflectionData<T>['options']): PropertyDecorator;
|
|
195
|
+
/**
|
|
196
|
+
* Decorator to define a composite index on multiple columns.
|
|
197
|
+
* @template T - The entity type.
|
|
198
|
+
* @param name - The name of the index.
|
|
199
|
+
* @param columns - An array of property names (or tuples with direction) included in the index.
|
|
200
|
+
* @param options - Additional index options.
|
|
201
|
+
* @returns A class decorator.
|
|
202
|
+
*/
|
|
203
|
+
export declare function Index<T extends Entity | EntityWithoutMetadata = any>(name: string, columns: Columns<T>, options?: IndexReflectionData<T>['options']): ClassDecorator;
|
|
204
|
+
/**
|
|
205
|
+
* Decorator to define a composite index on multiple columns.
|
|
206
|
+
* @template T - The entity type.
|
|
207
|
+
* @param columns - An array of property names (or tuples with direction) included in the index.
|
|
208
|
+
* @param options - Additional index options.
|
|
209
|
+
* @returns A class decorator.
|
|
210
|
+
*/
|
|
211
|
+
export declare function Index<T extends Entity | EntityWithoutMetadata = any>(columns: Columns<T>, options?: IndexReflectionData<T>['options']): ClassDecorator;
|
|
78
212
|
export {};
|
package/orm/decorators.js
CHANGED
|
@@ -2,6 +2,12 @@ import { createClassDecorator, createDecorator, createPropertyDecorator } from '
|
|
|
2
2
|
import { Property } from '../schema/index.js';
|
|
3
3
|
import { filterUndefinedObjectProperties, objectEntries } from '../utils/object/object.js';
|
|
4
4
|
import { assertNotArrayPass, isArray, isString, isUndefined } from '../utils/type-guards.js';
|
|
5
|
+
/**
|
|
6
|
+
* Factory function to create a class decorator for ORM table configuration.
|
|
7
|
+
* Merges provided data with existing ORM reflection data on the class metadata.
|
|
8
|
+
* @param data - The ORM table reflection data to add.
|
|
9
|
+
* @returns A class decorator.
|
|
10
|
+
*/
|
|
5
11
|
export function createTableDecorator(data = {}) {
|
|
6
12
|
return createClassDecorator({
|
|
7
13
|
handler: (_, metadata) => {
|
|
@@ -23,27 +29,71 @@ export function createTableDecorator(data = {}) {
|
|
|
23
29
|
}
|
|
24
30
|
});
|
|
25
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Factory function to create a property decorator for ORM column configuration.
|
|
34
|
+
* Merges provided data with existing ORM reflection data on the property metadata.
|
|
35
|
+
* @param data - The ORM column reflection data to add.
|
|
36
|
+
* @returns A property decorator.
|
|
37
|
+
*/
|
|
26
38
|
export function createColumnDecorator(data) {
|
|
27
39
|
return createPropertyDecorator({ data: { orm: data }, mergeData: true });
|
|
28
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* Factory function to create a decorator applicable to both classes and properties for ORM configuration.
|
|
43
|
+
* Merges provided data with existing ORM reflection data on the target's metadata.
|
|
44
|
+
* @param data - The ORM reflection data to add.
|
|
45
|
+
* @returns A class or property decorator.
|
|
46
|
+
*/
|
|
29
47
|
export function createTableAndColumnDecorator(data) {
|
|
30
48
|
return createDecorator({ class: true, property: true, data: { orm: data }, mergeData: true });
|
|
31
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* Decorator to specify ORM column options.
|
|
52
|
+
* @param options - Column configuration options.
|
|
53
|
+
* @returns A property decorator.
|
|
54
|
+
*/
|
|
32
55
|
export function Column(options) {
|
|
33
56
|
return createColumnDecorator({ ...options });
|
|
34
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* Decorator to mark a property as the primary key column.
|
|
60
|
+
* @returns A property decorator.
|
|
61
|
+
*/
|
|
35
62
|
export function PrimaryKey() {
|
|
36
63
|
return createColumnDecorator({ primaryKey: true });
|
|
37
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* Decorator to define a foreign key relationship.
|
|
67
|
+
* @param type - A function returning the referenced entity type.
|
|
68
|
+
* @returns A property decorator.
|
|
69
|
+
*/
|
|
38
70
|
export function References(type) {
|
|
39
71
|
return createColumnDecorator({ references: type });
|
|
40
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* Decorator to define a table check constraint.
|
|
75
|
+
* @template T - The entity type.
|
|
76
|
+
* @param name - The name of the check constraint.
|
|
77
|
+
* @param builder - A function to build the SQL check expression.
|
|
78
|
+
* @returns A class decorator.
|
|
79
|
+
*/
|
|
41
80
|
export function Check(name, builder) {
|
|
42
81
|
return createTableDecorator({ checks: [{ name, builder }] });
|
|
43
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* Decorator to mark a column for encryption.
|
|
85
|
+
* The underlying database type will typically be `bytea`.
|
|
86
|
+
* @returns A property decorator.
|
|
87
|
+
*/
|
|
44
88
|
export function Encrypted() {
|
|
45
89
|
return createColumnDecorator({ encrypted: true });
|
|
46
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* Decorator to embed another class's properties into the current entity's table.
|
|
93
|
+
* @param type - The constructor of the class to embed.
|
|
94
|
+
* @param options - Embedding options, like prefixing column names.
|
|
95
|
+
* @returns A property decorator.
|
|
96
|
+
*/
|
|
47
97
|
export function Embedded(type, options) {
|
|
48
98
|
return createPropertyDecorator({
|
|
49
99
|
include: [Property(type), createColumnDecorator({ embedded: { type, ...options } })]
|
package/orm/entity.d.ts
CHANGED
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
import type { Type } from '../types.js';
|
|
2
2
|
import { Embedded, type HasDefault, type IsPrimaryKey, Json, Timestamp, Uuid } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Represents the type (constructor) of an entity, potentially holding an entity name.
|
|
5
|
+
* @template T - The entity class type.
|
|
6
|
+
*/
|
|
3
7
|
export interface EntityType<T extends Entity | EntityWithoutMetadata = Entity | EntityWithoutMetadata> extends Type<T> {
|
|
4
8
|
readonly entityName?: string;
|
|
5
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* Base class for extensible metadata attributes associated with an entity.
|
|
12
|
+
* Allows storing arbitrary key-value pairs.
|
|
13
|
+
*/
|
|
6
14
|
export declare abstract class EntityMetadataAttributes {
|
|
7
15
|
[key: string]: unknown;
|
|
8
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Base class defining common metadata fields for entities, such as revision tracking and timestamps.
|
|
19
|
+
*/
|
|
9
20
|
export declare abstract class EntityMetadata {
|
|
10
21
|
revision: number;
|
|
11
22
|
revisionTimestamp: Timestamp;
|
|
@@ -13,10 +24,18 @@ export declare abstract class EntityMetadata {
|
|
|
13
24
|
deleteTimestamp: Timestamp | null;
|
|
14
25
|
attributes: HasDefault<Json<EntityMetadataAttributes>>;
|
|
15
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Abstract base class for entities that include standard metadata.
|
|
29
|
+
* Provides a default `id` (UUID primary key) and an `metadata` field.
|
|
30
|
+
*/
|
|
16
31
|
export declare abstract class Entity {
|
|
17
32
|
id: IsPrimaryKey<HasDefault<Uuid>>;
|
|
18
33
|
metadata: Embedded<EntityMetadata>;
|
|
19
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* Abstract base class for entities that do *not* include the standard metadata fields.
|
|
37
|
+
* Provides only a default `id` (UUID primary key). Useful for simpler tables or join tables.
|
|
38
|
+
*/
|
|
20
39
|
export declare abstract class EntityWithoutMetadata {
|
|
21
40
|
id: IsPrimaryKey<HasDefault<Uuid>>;
|
|
22
41
|
}
|