@tstdl/base 0.92.130 → 0.92.131
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.service.js +4 -4
- package/api/server/api-controller.js +1 -2
- package/document-management/api/document-management.api.d.ts +9 -37
- package/document-management/api/document-management.api.js +9 -18
- package/document-management/models/document-request-collection-assignment.model.d.ts +7 -0
- package/document-management/models/{document-request-collection.model.js → document-request-collection-assignment.model.js} +6 -6
- package/document-management/models/index.d.ts +1 -1
- package/document-management/models/index.js +1 -1
- package/document-management/server/api/document-management.api.d.ts +26 -0
- package/document-management/server/api/document-management.api.js +169 -0
- package/document-management/server/api/index.d.ts +1 -0
- package/document-management/server/api/index.js +1 -0
- package/document-management/server/drizzle/{0000_cool_victor_mancha.sql → 0000_magical_madame_hydra.sql} +128 -96
- package/document-management/server/drizzle/meta/0000_snapshot.json +768 -492
- package/document-management/server/drizzle/meta/_journal.json +2 -9
- package/document-management/server/index.d.ts +1 -0
- package/document-management/server/index.js +1 -0
- package/document-management/server/schemas.d.ts +3 -2
- package/document-management/server/schemas.js +3 -2
- package/document-management/server/services/document-category-type.service.d.ts +2 -0
- package/document-management/server/services/document-category-type.service.js +26 -15
- package/document-management/server/services/document-collection.service.js +13 -2
- package/document-management/server/services/document-file.service.js +15 -4
- package/document-management/server/services/document-management-ai.service.js +19 -8
- package/document-management/server/services/document-management-ancillary.service.d.ts +21 -40
- package/document-management/server/services/document-management-ancillary.service.js +25 -14
- package/document-management/server/services/document-management.service.d.ts +1 -1
- package/document-management/server/services/document-management.service.js +53 -34
- package/document-management/server/services/document-property.service.d.ts +2 -34
- package/document-management/server/services/document-property.service.js +20 -8
- package/document-management/server/services/document-request.service.js +11 -11
- package/document-management/server/services/document-validation.service.js +15 -4
- package/document-management/server/services/document-workflow.service.js +27 -16
- package/document-management/server/services/document.service.d.ts +8 -2
- package/document-management/server/services/document.service.js +47 -7
- package/document-management/server/services/index.d.ts +1 -0
- package/document-management/server/services/index.js +1 -0
- package/document-management/server/services/singleton.d.ts +4 -0
- package/document-management/server/services/singleton.js +12 -0
- package/eslint.config.js +1 -0
- package/examples/document-management/categories-and-types.d.ts +324 -0
- package/examples/document-management/categories-and-types.js +363 -0
- package/examples/document-management/main.d.ts +7 -8
- package/examples/document-management/main.js +86 -27
- package/injector/decorators.d.ts +1 -0
- package/injector/decorators.js +41 -12
- package/injector/inject.d.ts +12 -2
- package/injector/injector.d.ts +3 -2
- package/injector/injector.js +87 -36
- package/injector/symbols.d.ts +1 -0
- package/injector/symbols.js +1 -0
- package/module/modules/web-server.module.js +4 -4
- package/orm/server/database.d.ts +0 -4
- package/orm/server/database.js +0 -4
- package/orm/server/drizzle/schema-converter.js +5 -4
- package/orm/server/module.d.ts +0 -4
- package/orm/server/module.js +0 -2
- package/orm/server/query-converter.js +11 -38
- package/orm/server/repository.d.ts +3 -2
- package/orm/server/repository.js +2 -2
- package/orm/server/transaction.d.ts +5 -4
- package/orm/server/transaction.js +8 -3
- package/orm/server/transactional.js +3 -3
- package/orm/sqls.d.ts +4 -1
- package/orm/sqls.js +4 -1
- package/package.json +4 -4
- package/reflection/registry.js +6 -6
- package/document-management/models/document-request-collection.model.d.ts +0 -7
- package/document-management/server/drizzle/0001_concerned_quentin_quire.sql +0 -2
- package/document-management/server/drizzle/meta/0001_snapshot.json +0 -1932
|
@@ -6,6 +6,11 @@ export class Transaction {
|
|
|
6
6
|
#done = false;
|
|
7
7
|
afterCommit$ = this.#afterCommitSubject.asObservable();
|
|
8
8
|
manualCommit = false;
|
|
9
|
+
async [Symbol.asyncDispose]() {
|
|
10
|
+
if (!this.#done) {
|
|
11
|
+
await this.rollback();
|
|
12
|
+
}
|
|
13
|
+
}
|
|
9
14
|
withManualCommit() {
|
|
10
15
|
this.manualCommit = true;
|
|
11
16
|
}
|
|
@@ -30,9 +35,9 @@ export class Transaction {
|
|
|
30
35
|
this.#afterCommitSubject.next();
|
|
31
36
|
this.#afterCommitSubject.complete();
|
|
32
37
|
}
|
|
33
|
-
rollback() {
|
|
38
|
+
async rollback() {
|
|
34
39
|
this.#done = true;
|
|
35
|
-
this._rollback();
|
|
40
|
+
await this._rollback();
|
|
36
41
|
}
|
|
37
42
|
}
|
|
38
43
|
export class DrizzleTransaction extends Transaction {
|
|
@@ -56,7 +61,7 @@ export class DrizzleTransaction extends Transaction {
|
|
|
56
61
|
transactionPromise.reject(error);
|
|
57
62
|
}
|
|
58
63
|
});
|
|
59
|
-
return transactionPromise;
|
|
64
|
+
return await transactionPromise;
|
|
60
65
|
}
|
|
61
66
|
async _commit() {
|
|
62
67
|
this.deferPromise.resolve();
|
|
@@ -106,9 +106,9 @@ export class Transactional {
|
|
|
106
106
|
*/
|
|
107
107
|
async useTransaction(existingTransaction, handler) {
|
|
108
108
|
if (isUndefined(existingTransaction)) {
|
|
109
|
-
return this.transaction(handler);
|
|
109
|
+
return await this.transaction(handler);
|
|
110
110
|
}
|
|
111
|
-
return existingTransaction.use(async () => handler(existingTransaction));
|
|
111
|
+
return await existingTransaction.use(async () => await handler(existingTransaction));
|
|
112
112
|
}
|
|
113
113
|
/**
|
|
114
114
|
* Starts a new transaction, executes the provided handler function within it,
|
|
@@ -120,7 +120,7 @@ export class Transactional {
|
|
|
120
120
|
*/
|
|
121
121
|
async transaction(handler, config) {
|
|
122
122
|
const transaction = await this.startTransaction(config);
|
|
123
|
-
return transaction.use(async () => handler(transaction));
|
|
123
|
+
return await transaction.use(async () => await handler(transaction));
|
|
124
124
|
}
|
|
125
125
|
getTransactionalContextData() {
|
|
126
126
|
return transactionalContextDataGuard; // eslint-disable-line @typescript-eslint/no-unsafe-return
|
package/orm/sqls.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* simplifying common SQL operations like generating UUIDs, working with intervals,
|
|
5
5
|
* and aggregating data.
|
|
6
6
|
*/
|
|
7
|
-
import { type Column, type SQL } from 'drizzle-orm';
|
|
7
|
+
import { type AnyColumn, type Column, type SQL } from 'drizzle-orm';
|
|
8
8
|
import type { GetSelectTableSelection, SelectResultField, TableLike } from 'drizzle-orm/query-builders/select.types';
|
|
9
9
|
import type { Uuid } from './types.js';
|
|
10
10
|
/** Drizzle SQL helper for getting the current transaction's timestamp. Returns a Date object. */
|
|
@@ -13,6 +13,9 @@ export declare const TRANSACTION_TIMESTAMP: SQL<Date>;
|
|
|
13
13
|
export declare const RANDOM_UUID: SQL<Uuid>;
|
|
14
14
|
/** Represents valid units for PostgreSQL interval values. */
|
|
15
15
|
export type IntervalUnit = 'millennium' | 'millenniums' | 'millennia' | 'century' | 'centuries' | 'decade' | 'decades' | 'year' | 'years' | 'day' | 'days' | 'hour' | 'hours' | 'minute' | 'minutes' | 'second' | 'seconds' | 'millisecond' | 'milliseconds' | 'microsecond' | 'microseconds';
|
|
16
|
+
export declare function autoAlias<T>(column: AnyColumn<{
|
|
17
|
+
data: T;
|
|
18
|
+
}>): SQL.Aliased<T>;
|
|
16
19
|
/**
|
|
17
20
|
* Creates a Drizzle SQL interval expression.
|
|
18
21
|
* @param value - The numeric value of the interval.
|
package/orm/sqls.js
CHANGED
|
@@ -4,11 +4,14 @@
|
|
|
4
4
|
* simplifying common SQL operations like generating UUIDs, working with intervals,
|
|
5
5
|
* and aggregating data.
|
|
6
6
|
*/
|
|
7
|
-
import { sql } from 'drizzle-orm';
|
|
7
|
+
import { sql, Table } from 'drizzle-orm';
|
|
8
8
|
/** Drizzle SQL helper for getting the current transaction's timestamp. Returns a Date object. */
|
|
9
9
|
export const TRANSACTION_TIMESTAMP = sql `transaction_timestamp()`;
|
|
10
10
|
/** Drizzle SQL helper for generating a random UUID (v4). Returns a Uuid string. */
|
|
11
11
|
export const RANDOM_UUID = sql `gen_random_uuid()`;
|
|
12
|
+
export function autoAlias(column) {
|
|
13
|
+
return sql `${column}`.as(`${column.table[Table['Symbol']['Name']]}_${column.name}`);
|
|
14
|
+
}
|
|
12
15
|
/**
|
|
13
16
|
* Creates a Drizzle SQL interval expression.
|
|
14
17
|
* @param value - The numeric value of the interval.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tstdl/base",
|
|
3
|
-
"version": "0.92.
|
|
3
|
+
"version": "0.92.131",
|
|
4
4
|
"author": "Patrick Hein",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -180,19 +180,19 @@
|
|
|
180
180
|
"@types/node": "22",
|
|
181
181
|
"@types/nodemailer": "6.4",
|
|
182
182
|
"@types/pg": "8.15",
|
|
183
|
-
"@typescript-eslint/eslint-plugin": "8.32",
|
|
184
183
|
"concurrently": "9.1",
|
|
185
184
|
"drizzle-kit": "0.31",
|
|
186
185
|
"eslint": "9.27",
|
|
187
186
|
"globals": "16.1",
|
|
188
187
|
"tsc-alias": "1.8",
|
|
189
188
|
"typedoc-plugin-missing-exports": "4.0",
|
|
190
|
-
"typescript": "5.8"
|
|
189
|
+
"typescript": "5.8",
|
|
190
|
+
"typescript-eslint": "8.32"
|
|
191
191
|
},
|
|
192
192
|
"overrides": {
|
|
193
193
|
"drizzle-kit": {
|
|
194
194
|
"@esbuild-kit/esm-loader": "^2.6",
|
|
195
|
-
"esbuild": "^0.
|
|
195
|
+
"esbuild": "^0.25",
|
|
196
196
|
"esbuild-register": "^3.6"
|
|
197
197
|
}
|
|
198
198
|
}
|
package/reflection/registry.js
CHANGED
|
@@ -94,13 +94,13 @@ function initializeType(type) {
|
|
|
94
94
|
initializer() {
|
|
95
95
|
const parametersTypes = getParameterTypes(type);
|
|
96
96
|
return parametersTypes?.map((parameterType, index) => ({ metadataType: 'constructor-parameter', index, type: parameterType, data: new ContextDataMap() }));
|
|
97
|
-
}
|
|
97
|
+
},
|
|
98
98
|
},
|
|
99
99
|
properties: {
|
|
100
|
-
initializer: () => new FactoryMap((key) => ({ metadataType: 'property', key, type: getDesignType(type.prototype, key), isAccessor: false, data: new ContextDataMap(), inherited: false }))
|
|
100
|
+
initializer: () => new FactoryMap((key) => ({ metadataType: 'property', key, type: getDesignType(type.prototype, key), isAccessor: false, data: new ContextDataMap(), inherited: false })),
|
|
101
101
|
},
|
|
102
102
|
staticProperties: {
|
|
103
|
-
initializer: () => new FactoryMap((key) => ({ metadataType: 'property', key, type: getDesignType(type, key), isAccessor: false, data: new ContextDataMap(), inherited: false }))
|
|
103
|
+
initializer: () => new FactoryMap((key) => ({ metadataType: 'property', key, type: getDesignType(type, key), isAccessor: false, data: new ContextDataMap(), inherited: false })),
|
|
104
104
|
},
|
|
105
105
|
methods: {
|
|
106
106
|
initializer: () => new FactoryMap((key) => {
|
|
@@ -110,7 +110,7 @@ function initializeType(type) {
|
|
|
110
110
|
throw new Error(`Could not get parameters for method ${key.toString()} of type ${type.name}`);
|
|
111
111
|
}
|
|
112
112
|
return { metadataType: 'method', parameters: parameters.map((parameter, index) => ({ metadataType: 'method-parameter', index, type: parameter, data: new ContextDataMap() })), returnType, data: new ContextDataMap(), inherited: false };
|
|
113
|
-
})
|
|
113
|
+
}),
|
|
114
114
|
},
|
|
115
115
|
staticMethods: {
|
|
116
116
|
initializer: () => new FactoryMap((key) => {
|
|
@@ -120,9 +120,9 @@ function initializeType(type) {
|
|
|
120
120
|
throw new Error(`Could not get parameters for static method ${key.toString()} of type ${type.name}`);
|
|
121
121
|
}
|
|
122
122
|
return { metadataType: 'method', parameters: parameters.map((parameter, index) => ({ metadataType: 'method-parameter', index, type: parameter, data: new ContextDataMap() })), returnType, data: new ContextDataMap(), inherited: false };
|
|
123
|
-
})
|
|
123
|
+
}),
|
|
124
124
|
},
|
|
125
|
-
data: { initializer: () => new ContextDataMap() }
|
|
125
|
+
data: { initializer: () => new ContextDataMap() },
|
|
126
126
|
});
|
|
127
127
|
}
|
|
128
128
|
export const reflectionRegistry = new ReflectionRegistry();
|