@tstdl/base 0.92.84 → 0.92.86
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.d.ts +1 -1
- package/ai/ai.service.js +34 -16
- package/ai/types.d.ts +1 -1
- package/authentication/authentication.api.d.ts +9 -9
- package/authentication/models/schemas.d.ts +2 -2
- package/cancellation/token.d.ts +1 -1
- package/document-management/api/document-management.api.d.ts +94 -94
- package/document-management/models/document-category.model.d.ts +1 -0
- package/document-management/models/document-index.model.d.ts +7 -0
- package/document-management/models/document-index.model.js +32 -0
- package/document-management/models/document-request-file.model.d.ts +1 -1
- package/document-management/models/document-request-file.model.js +2 -2
- package/document-management/models/document-type.model.d.ts +1 -0
- package/document-management/models/document.model.d.ts +1 -1
- package/document-management/models/document.model.js +2 -2
- package/document-management/models/service-models/document.service-model.d.ts +51 -51
- package/document-management/models/service-models/document.service-model.js +2 -2
- package/document-management/server/drizzle/{0000_sloppy_fenris.sql → 0000_useful_overlord.sql} +2 -2
- package/document-management/server/drizzle/meta/0000_snapshot.json +5 -5
- package/document-management/server/drizzle/meta/_journal.json +2 -2
- package/document-management/server/drizzle.config.js +1 -1
- package/document-management/server/module.d.ts +1 -1
- package/document-management/server/module.js +1 -1
- package/document-management/server/schemas.d.ts +33 -0
- package/document-management/{models → server}/schemas.js +14 -14
- package/document-management/server/services/document-management.service.d.ts +17 -3
- package/document-management/server/services/document-management.service.js +65 -17
- package/examples/orm/schemas.d.ts +1 -1
- package/mail/drizzle.config.js +1 -1
- package/mail/models/schemas.d.ts +1 -1
- package/orm/decorators.d.ts +4 -4
- package/orm/entity.d.ts +5 -7
- package/orm/entity.js +9 -1
- package/orm/index.d.ts +1 -0
- package/orm/index.js +1 -0
- package/orm/query.d.ts +1 -3
- package/orm/query.js +0 -1
- package/orm/repository.types.d.ts +32 -0
- package/orm/repository.types.js +1 -0
- package/orm/server/database-schema.d.ts +4 -4
- package/orm/server/drizzle/schema-converter.d.ts +1 -1
- package/orm/server/index.d.ts +1 -0
- package/orm/server/index.js +1 -0
- package/orm/server/query-converter.d.ts +1 -2
- package/orm/server/query-converter.js +66 -61
- package/orm/server/repository.d.ts +78 -42
- package/orm/server/repository.js +202 -106
- package/orm/server/sqls.d.ts +7 -0
- package/orm/server/sqls.js +6 -0
- package/orm/server/types.d.ts +3 -3
- package/orm/types.d.ts +1 -1
- package/package.json +13 -11
- package/process-shutdown.js +0 -3
- package/queue/enqueue-batch.d.ts +1 -0
- package/queue/enqueue-batch.js +1 -1
- package/queue/mongo/queue.d.ts +9 -4
- package/queue/mongo/queue.js +5 -6
- package/queue/postgres/drizzle/0000_zippy_moondragon.sql +11 -0
- package/queue/postgres/drizzle/meta/0000_snapshot.json +90 -0
- package/queue/postgres/drizzle/meta/_journal.json +13 -0
- package/queue/postgres/drizzle.config.d.ts +2 -0
- package/queue/postgres/drizzle.config.js +11 -0
- package/queue/postgres/index.d.ts +4 -0
- package/queue/postgres/index.js +4 -0
- package/queue/postgres/job.model.d.ts +13 -0
- package/queue/postgres/job.model.js +55 -0
- package/queue/postgres/module.d.ts +9 -0
- package/queue/postgres/module.js +29 -0
- package/queue/postgres/queue.d.ts +28 -0
- package/queue/postgres/queue.js +149 -0
- package/queue/postgres/queue.provider.d.ts +7 -0
- package/queue/postgres/queue.provider.js +21 -0
- package/queue/postgres/schemas.d.ts +3 -0
- package/queue/postgres/schemas.js +4 -0
- package/queue/provider.d.ts +2 -1
- package/queue/queue.d.ts +18 -6
- package/schema/schemas/object.d.ts +1 -1
- package/utils/timing.d.ts +4 -3
- package/utils/timing.js +3 -1
- package/document-management/models/schemas.d.ts +0 -33
|
@@ -1,44 +1,31 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SQL } from 'drizzle-orm';
|
|
2
2
|
import { PgTransaction as DrizzlePgTransaction, type PgColumn, type PgInsertValue, type PgQueryResultHKT, type PgUpdateSetSource } from 'drizzle-orm/pg-core';
|
|
3
|
-
import type { PartialDeep } from 'type-fest';
|
|
4
3
|
import { type Resolvable, resolveArgumentType } from '../../injector/interfaces.js';
|
|
5
|
-
import type { DeepPartial, OneOrMany, Paths, Record, Type
|
|
4
|
+
import type { DeepPartial, OneOrMany, Paths, Record, Type } from '../../types.js';
|
|
6
5
|
import type { UntaggedDeep } from '../../types/index.js';
|
|
7
|
-
import
|
|
6
|
+
import { Entity, type EntityMetadataAttributes, type EntityType, type EntityWithoutMetadata } from '../entity.js';
|
|
8
7
|
import type { Query } from '../query.js';
|
|
8
|
+
import type { EntityMetadataUpdate, EntityUpdate, LoadManyOptions, LoadOptions, NewEntity, Order } from '../repository.types.js';
|
|
9
9
|
import { Database } from './database.js';
|
|
10
10
|
import { type Transaction, type TransactionConfig } from './transaction.js';
|
|
11
|
-
import type {
|
|
11
|
+
import type { PgTableFromType, TransformContext } from './types.js';
|
|
12
12
|
type PgTransaction = DrizzlePgTransaction<PgQueryResultHKT, Record, Record>;
|
|
13
13
|
export declare const repositoryType: unique symbol;
|
|
14
|
-
export type OrderOptions<T extends Entity> = {
|
|
15
|
-
order?: Partial<Record<Paths<UntaggedDeep<T>>, 1 | -1 | 'asc' | 'desc'>>;
|
|
16
|
-
};
|
|
17
|
-
export type LoadOptions<T extends Entity> = OrderOptions<T> & {
|
|
18
|
-
offset?: number;
|
|
19
|
-
withDeleted?: boolean;
|
|
20
|
-
};
|
|
21
|
-
export type LoadManyOptions<T extends Entity> = LoadOptions<T> & {
|
|
22
|
-
limit?: number;
|
|
23
|
-
};
|
|
24
|
-
export type UpdateOptions<T extends Entity> = LoadOptions<T>;
|
|
25
|
-
export type EntityMetadataUpdate = Partial<UntaggedDeep<Pick<EntityMetadata, 'attributes'>>>;
|
|
26
|
-
export type EntityUpdate<T extends Entity> = PartialDeep<UntaggedDeep<TypedOmit<T, 'metadata'> & {
|
|
27
|
-
metadata: EntityMetadataUpdate;
|
|
28
|
-
}>>;
|
|
29
14
|
export declare class EntityRepositoryConfig {
|
|
30
15
|
schema: string;
|
|
31
16
|
}
|
|
32
|
-
export type TransactionHandler<T extends
|
|
33
|
-
export declare class EntityRepository<T extends Entity =
|
|
17
|
+
export type TransactionHandler<T extends EntityWithoutMetadata, R> = (repository: EntityRepository<T>, transaction: Transaction) => Promise<R>;
|
|
18
|
+
export declare class EntityRepository<T extends Entity | EntityWithoutMetadata = EntityWithoutMetadata> implements Resolvable<EntityType<T>> {
|
|
34
19
|
#private;
|
|
35
20
|
readonly type: EntityType<T>;
|
|
36
|
-
readonly
|
|
37
|
-
readonly columnDefinitions: ColumnDefinition[];
|
|
38
|
-
readonly columnDefinitionsMap: Map<string, ColumnDefinition>;
|
|
21
|
+
readonly typeName: string;
|
|
39
22
|
readonly session: Database | PgTransaction;
|
|
40
23
|
readonly isInTransaction: boolean;
|
|
24
|
+
readonly hasMetadata: boolean;
|
|
25
|
+
get table(): PgTableFromType<EntityType<T>>;
|
|
41
26
|
readonly [resolveArgumentType]: EntityType<T>;
|
|
27
|
+
readonly _anyInferSelect: PgTableFromType<EntityType<Entity>>['$inferSelect'];
|
|
28
|
+
readonly _inferSelect: PgTableFromType<EntityType<T>>['$inferSelect'];
|
|
42
29
|
constructor();
|
|
43
30
|
withOptionalTransaction(transaction: Transaction | undefined): EntityRepository<T>;
|
|
44
31
|
withTransaction(transaction: Transaction): EntityRepository<T>;
|
|
@@ -82,20 +69,69 @@ export declare class EntityRepository<T extends Entity = Entity> implements Reso
|
|
|
82
69
|
tryDeleteByQuery(query: Query<T>, metadataUpdate?: EntityMetadataUpdate): Promise<T | undefined>;
|
|
83
70
|
deleteMany(ids: string[], metadataUpdate?: EntityMetadataUpdate): Promise<T[]>;
|
|
84
71
|
deleteManyByQuery(query: Query<T>, metadataUpdate?: EntityMetadataUpdate): Promise<T[]>;
|
|
85
|
-
hardDelete(id: string): Promise<
|
|
86
|
-
tryHardDelete(id: string): Promise<
|
|
87
|
-
hardDeleteByQuery(query: Query<T>): Promise<
|
|
88
|
-
tryHardDeleteByQuery(query: Query<T>): Promise<
|
|
89
|
-
hardDeleteMany(ids: string[]): Promise<
|
|
90
|
-
hardDeleteManyByQuery(query: Query<T>): Promise<
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
72
|
+
hardDelete(id: string): Promise<T>;
|
|
73
|
+
tryHardDelete(id: string): Promise<T | undefined>;
|
|
74
|
+
hardDeleteByQuery(query: Query<T>): Promise<T>;
|
|
75
|
+
tryHardDeleteByQuery(query: Query<T>): Promise<T | undefined>;
|
|
76
|
+
hardDeleteMany(ids: string[]): Promise<T[]>;
|
|
77
|
+
hardDeleteManyByQuery(query: Query<T>): Promise<T[]>;
|
|
78
|
+
$getColumn(path: Paths<UntaggedDeep<T>>): PgColumn;
|
|
79
|
+
$convertOrderBy(orderBy: Order<T>): SQL<unknown>[];
|
|
80
|
+
$convertQuery(query: Query<T>): SQL;
|
|
81
|
+
$mapManyToEntity(columns: this['_inferSelect'][]): Promise<T[]>;
|
|
82
|
+
$mapToEntity(columns: this['_inferSelect']): Promise<T>;
|
|
83
|
+
$mapManyToColumns(objects: (DeepPartial<T> | NewEntity<T>)[]): Promise<PgInsertValue<PgTableFromType>[]>;
|
|
84
|
+
$mapToColumns(obj: DeepPartial<T> | NewEntity<T>): Promise<PgInsertValue<PgTableFromType>>;
|
|
85
|
+
$mapManyToInsertColumns(objects: (DeepPartial<T> | NewEntity<T>)[]): Promise<PgInsertValue<PgTableFromType>[]>;
|
|
86
|
+
$mapToInsertColumns(obj: DeepPartial<T> | NewEntity<T>): Promise<PgInsertValue<PgTableFromType>>;
|
|
87
|
+
$mapUpdate(update: EntityUpdate<T>): Promise<PgUpdateSetSource<PgTableFromType>>;
|
|
88
|
+
$getIdLimitQuery(query: Query<T>): Omit<import("drizzle-orm/pg-core").PgSelectBase<string, {
|
|
89
|
+
id: PgColumn<{
|
|
90
|
+
name: string;
|
|
91
|
+
tableName: string;
|
|
92
|
+
dataType: "string";
|
|
93
|
+
columnType: "PgUUID";
|
|
94
|
+
data: string;
|
|
95
|
+
driverParam: string;
|
|
96
|
+
notNull: true;
|
|
97
|
+
hasDefault: true;
|
|
98
|
+
isPrimaryKey: true;
|
|
99
|
+
isAutoincrement: false;
|
|
100
|
+
hasRuntimeDefault: false;
|
|
101
|
+
enumValues: undefined;
|
|
102
|
+
baseColumn: never;
|
|
103
|
+
identity: undefined;
|
|
104
|
+
generated: undefined;
|
|
105
|
+
}, {}, {}>;
|
|
106
|
+
}, "partial", globalThis.Record<string, "not-null">, false, "where" | "limit", {
|
|
107
|
+
id: string;
|
|
108
|
+
}[], {
|
|
109
|
+
id: PgColumn<{
|
|
110
|
+
name: string;
|
|
111
|
+
tableName: string;
|
|
112
|
+
dataType: "string";
|
|
113
|
+
columnType: "PgUUID";
|
|
114
|
+
data: string;
|
|
115
|
+
driverParam: string;
|
|
116
|
+
notNull: true;
|
|
117
|
+
hasDefault: true;
|
|
118
|
+
isPrimaryKey: true;
|
|
119
|
+
isAutoincrement: false;
|
|
120
|
+
hasRuntimeDefault: false;
|
|
121
|
+
enumValues: undefined;
|
|
122
|
+
baseColumn: never;
|
|
123
|
+
identity: undefined;
|
|
124
|
+
generated: undefined;
|
|
125
|
+
}, {}, {}>;
|
|
126
|
+
}>, "where" | "limit">;
|
|
127
|
+
$getAttributesUpdate(attributes: SQL | EntityMetadataAttributes | undefined): SQL<unknown> | undefined;
|
|
128
|
+
protected mapManyToEntity(columns: this['_anyInferSelect'][], transformContext: TransformContext): Promise<T[]>;
|
|
129
|
+
protected mapToEntity(columns: this['_anyInferSelect'], transformContext: TransformContext): Promise<T>;
|
|
130
|
+
protected mapManyToColumns(objects: (DeepPartial<T> | NewEntity<T>)[], transformContext: TransformContext): Promise<PgInsertValue<PgTableFromType>[]>;
|
|
131
|
+
protected mapToColumns(obj: DeepPartial<T> | NewEntity<T>, transformContext: TransformContext): Promise<PgInsertValue<PgTableFromType>>;
|
|
132
|
+
protected mapManyToInsertColumns(objects: (DeepPartial<T> | NewEntity<T>)[], transformContext: TransformContext): Promise<PgInsertValue<PgTableFromType>[]>;
|
|
133
|
+
protected mapToInsertColumns(obj: DeepPartial<T> | NewEntity<T>, transformContext: TransformContext): Promise<PgInsertValue<PgTableFromType>>;
|
|
134
|
+
protected mapUpdate(update: EntityUpdate<T>, transformContext: TransformContext): Promise<PgUpdateSetSource<PgTableFromType>>;
|
|
99
135
|
protected getIdLimitQuery(query: Query<T>): Omit<import("drizzle-orm/pg-core").PgSelectBase<string, {
|
|
100
136
|
id: PgColumn<{
|
|
101
137
|
name: string;
|
|
@@ -135,9 +171,9 @@ export declare class EntityRepository<T extends Entity = Entity> implements Reso
|
|
|
135
171
|
generated: undefined;
|
|
136
172
|
}, {}, {}>;
|
|
137
173
|
}>, "where" | "limit">;
|
|
138
|
-
protected getAttributesUpdate(attributes: EntityMetadataAttributes | undefined): SQL<unknown> | undefined;
|
|
174
|
+
protected getAttributesUpdate(attributes: SQL | EntityMetadataAttributes | undefined): SQL<unknown> | undefined;
|
|
139
175
|
protected getTransformContext(): Promise<TransformContext>;
|
|
140
176
|
}
|
|
141
|
-
export declare function injectRepository<T extends Entity>(type: EntityType<T>): EntityRepository<T>;
|
|
142
|
-
export declare function getRepository<T extends Entity>(type: EntityType<T>): Type<EntityRepository<T>>;
|
|
177
|
+
export declare function injectRepository<T extends Entity | EntityWithoutMetadata>(type: EntityType<T>): EntityRepository<T>;
|
|
178
|
+
export declare function getRepository<T extends Entity | EntityWithoutMetadata>(type: EntityType<T>): Type<EntityRepository<T>>;
|
|
143
179
|
export {};
|