@tstdl/base 0.92.80 → 0.92.82
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/application/application.js +17 -14
- package/orm/types.d.ts +2 -2
- package/orm/types.js +2 -2
- package/package.json +1 -1
|
@@ -89,21 +89,22 @@ let Application = class Application {
|
|
|
89
89
|
return this.#shutdownPromise;
|
|
90
90
|
}
|
|
91
91
|
async _run(functionsAndModules, options = {}) {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
92
|
+
let modules;
|
|
93
|
+
try {
|
|
94
|
+
for (const fnOrModule of functionsAndModules.flatMap((fns) => fns)) {
|
|
95
|
+
if (fnOrModule.prototype instanceof ModuleBase) {
|
|
96
|
+
this.registerModule(fnOrModule);
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
this.registerModuleFunction(fnOrModule);
|
|
100
|
+
}
|
|
98
101
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
102
|
+
if (isDefined(options.bootstrap)) {
|
|
103
|
+
for (const fn of toArray(options.bootstrap)) {
|
|
104
|
+
await runInInjectionContext(this.#injector, fn);
|
|
105
|
+
}
|
|
103
106
|
}
|
|
104
|
-
|
|
105
|
-
const modules = await toArrayAsync(mapAsync(this.#moduleTypesAndInstances, async (instanceOrType) => (isFunction(instanceOrType) ? this.#injector.resolveAsync(instanceOrType) : instanceOrType)));
|
|
106
|
-
try {
|
|
107
|
+
modules = await toArrayAsync(mapAsync(this.#moduleTypesAndInstances, async (instanceOrType) => (isFunction(instanceOrType) ? this.#injector.resolveAsync(instanceOrType) : instanceOrType)));
|
|
107
108
|
await Promise.race([
|
|
108
109
|
this.runModules(modules),
|
|
109
110
|
this.shutdownSignal
|
|
@@ -115,7 +116,9 @@ let Application = class Application {
|
|
|
115
116
|
finally {
|
|
116
117
|
this.requestShutdown();
|
|
117
118
|
this.#logger.info('Shutting down');
|
|
118
|
-
|
|
119
|
+
if (isDefined(modules)) {
|
|
120
|
+
await this.stopModules(modules);
|
|
121
|
+
}
|
|
119
122
|
await this.#injector.dispose();
|
|
120
123
|
this.#logger.info('Bye');
|
|
121
124
|
}
|
package/orm/types.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { boolean, date, doublePrecision, integer, jsonb, PgColumnBuilder, P
|
|
|
3
3
|
import { Array, Integer } from '../schema/index.js';
|
|
4
4
|
import type { AbstractConstructor, EnumerationObject, EnumerationValue, ObjectLiteral, UnionToTuple } from '../types.js';
|
|
5
5
|
import type { GetTagMetadata, HasTag, Tagged, UnwrapTagged } from '../types/index.js';
|
|
6
|
-
import { Column, Embedded, Encrypted, Index, PrimaryKey, References, Unique } from './decorators.js';
|
|
6
|
+
import { Check, Column, Embedded, Encrypted, Index, PrimaryKey, References, Unique } from './decorators.js';
|
|
7
7
|
import { Json, NumericDate, Timestamp, Uuid } from './schemas/index.js';
|
|
8
8
|
import type { bytea } from './server/data-types/index.js';
|
|
9
9
|
export type ColumnTypeTag = 'column';
|
|
@@ -27,4 +27,4 @@ export type NumericDate = Tagged<number, ColumnTypeTag, ReturnType<typeof date>>
|
|
|
27
27
|
export type Timestamp = Tagged<number, ColumnTypeTag, ReturnType<typeof timestamp>>;
|
|
28
28
|
export type Bytea = Tagged<Uint8Array, ColumnTypeTag, ReturnType<typeof bytea>>;
|
|
29
29
|
export type Encrypted<T> = Tagged<T, ColumnTypeTag, ReturnType<typeof bytea>>;
|
|
30
|
-
export { Array, Column, Embedded, Encrypted, Index, Integer, Json, NumericDate, PrimaryKey, References, Timestamp, Unique, Uuid };
|
|
30
|
+
export { Array, Check, Column, Embedded, Encrypted, Index, Integer, Json, NumericDate, PrimaryKey, References, Timestamp, Unique, Uuid };
|
package/orm/types.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Array, Integer } from '../schema/index.js';
|
|
2
|
-
import { Column, Embedded, Encrypted, Index, PrimaryKey, References, Unique } from './decorators.js';
|
|
2
|
+
import { Check, Column, Embedded, Encrypted, Index, PrimaryKey, References, Unique } from './decorators.js';
|
|
3
3
|
import { Json, NumericDate, Timestamp, Uuid } from './schemas/index.js';
|
|
4
|
-
export { Array, Column, Embedded, Encrypted, Index, Integer, Json, NumericDate, PrimaryKey, References, Timestamp, Unique, Uuid };
|
|
4
|
+
export { Array, Check, Column, Embedded, Encrypted, Index, Integer, Json, NumericDate, PrimaryKey, References, Timestamp, Unique, Uuid };
|