@tstdl/base 0.92.85 → 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.
Files changed (79) hide show
  1. package/ai/ai.service.d.ts +1 -1
  2. package/ai/ai.service.js +3 -3
  3. package/ai/types.d.ts +1 -1
  4. package/authentication/authentication.api.d.ts +9 -9
  5. package/authentication/models/schemas.d.ts +2 -2
  6. package/cancellation/token.d.ts +1 -1
  7. package/document-management/api/document-management.api.d.ts +94 -94
  8. package/document-management/models/document-category.model.d.ts +1 -0
  9. package/document-management/models/document-index.model.d.ts +7 -0
  10. package/document-management/models/document-index.model.js +32 -0
  11. package/document-management/models/document-request-file.model.d.ts +1 -1
  12. package/document-management/models/document-request-file.model.js +2 -2
  13. package/document-management/models/document-type.model.d.ts +1 -0
  14. package/document-management/models/document.model.d.ts +1 -1
  15. package/document-management/models/document.model.js +2 -2
  16. package/document-management/models/service-models/document.service-model.d.ts +51 -51
  17. package/document-management/models/service-models/document.service-model.js +2 -2
  18. package/document-management/server/drizzle/{0000_sloppy_fenris.sql → 0000_useful_overlord.sql} +2 -2
  19. package/document-management/server/drizzle/meta/0000_snapshot.json +5 -5
  20. package/document-management/server/drizzle/meta/_journal.json +2 -2
  21. package/document-management/server/drizzle.config.js +1 -1
  22. package/document-management/server/module.d.ts +1 -1
  23. package/document-management/server/module.js +1 -1
  24. package/document-management/server/schemas.d.ts +33 -0
  25. package/document-management/{models → server}/schemas.js +14 -14
  26. package/document-management/server/services/document-management.service.d.ts +17 -3
  27. package/document-management/server/services/document-management.service.js +65 -17
  28. package/examples/orm/schemas.d.ts +1 -1
  29. package/mail/drizzle.config.js +1 -1
  30. package/mail/models/schemas.d.ts +1 -1
  31. package/orm/decorators.d.ts +4 -4
  32. package/orm/entity.d.ts +5 -7
  33. package/orm/entity.js +9 -1
  34. package/orm/index.d.ts +1 -0
  35. package/orm/index.js +1 -0
  36. package/orm/query.d.ts +1 -3
  37. package/orm/query.js +0 -1
  38. package/orm/repository.types.d.ts +32 -0
  39. package/orm/repository.types.js +1 -0
  40. package/orm/server/database-schema.d.ts +4 -4
  41. package/orm/server/drizzle/schema-converter.d.ts +1 -1
  42. package/orm/server/index.d.ts +1 -0
  43. package/orm/server/index.js +1 -0
  44. package/orm/server/query-converter.d.ts +1 -2
  45. package/orm/server/query-converter.js +66 -61
  46. package/orm/server/repository.d.ts +78 -42
  47. package/orm/server/repository.js +202 -106
  48. package/orm/server/sqls.d.ts +7 -0
  49. package/orm/server/sqls.js +6 -0
  50. package/orm/server/types.d.ts +3 -3
  51. package/orm/types.d.ts +1 -1
  52. package/package.json +11 -9
  53. package/queue/enqueue-batch.d.ts +1 -0
  54. package/queue/enqueue-batch.js +1 -1
  55. package/queue/mongo/queue.d.ts +9 -4
  56. package/queue/mongo/queue.js +5 -6
  57. package/queue/postgres/drizzle/0000_zippy_moondragon.sql +11 -0
  58. package/queue/postgres/drizzle/meta/0000_snapshot.json +90 -0
  59. package/queue/postgres/drizzle/meta/_journal.json +13 -0
  60. package/queue/postgres/drizzle.config.d.ts +2 -0
  61. package/queue/postgres/drizzle.config.js +11 -0
  62. package/queue/postgres/index.d.ts +4 -0
  63. package/queue/postgres/index.js +4 -0
  64. package/queue/postgres/job.model.d.ts +13 -0
  65. package/queue/postgres/job.model.js +55 -0
  66. package/queue/postgres/module.d.ts +9 -0
  67. package/queue/postgres/module.js +29 -0
  68. package/queue/postgres/queue.d.ts +28 -0
  69. package/queue/postgres/queue.js +149 -0
  70. package/queue/postgres/queue.provider.d.ts +7 -0
  71. package/queue/postgres/queue.provider.js +21 -0
  72. package/queue/postgres/schemas.d.ts +3 -0
  73. package/queue/postgres/schemas.js +4 -0
  74. package/queue/provider.d.ts +2 -1
  75. package/queue/queue.d.ts +18 -6
  76. package/schema/schemas/object.d.ts +1 -1
  77. package/utils/timing.d.ts +4 -3
  78. package/utils/timing.js +3 -1
  79. package/document-management/models/schemas.d.ts +0 -33
@@ -1,44 +1,31 @@
1
- import { type SQL } from 'drizzle-orm';
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, TypedOmit } from '../../types.js';
4
+ import type { DeepPartial, OneOrMany, Paths, Record, Type } from '../../types.js';
6
5
  import type { UntaggedDeep } from '../../types/index.js';
7
- import type { Entity, EntityMetadata, EntityMetadataAttributes, EntityType, NewEntity } from '../entity.js';
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 { ColumnDefinition, PgTableFromType, TransformContext } from './types.js';
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 Entity, R> = (repository: EntityRepository<T>, transaction: Transaction) => Promise<R>;
33
- export declare class EntityRepository<T extends Entity = Entity> implements Resolvable<EntityType<T>> {
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 table: PgTableFromType<string, EntityType>;
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<void>;
86
- tryHardDelete(id: string): Promise<boolean>;
87
- hardDeleteByQuery(query: Query<T>): Promise<void>;
88
- tryHardDeleteByQuery(query: Query<T>): Promise<boolean>;
89
- hardDeleteMany(ids: string[]): Promise<number>;
90
- hardDeleteManyByQuery(query: Query<T>): Promise<number>;
91
- protected convertQuery(query: Query<T>): SQL;
92
- protected mapManyToEntity(columns: this['table']['$inferSelect'][], transformContext: TransformContext): Promise<T[]>;
93
- protected mapToEntity(columns: this['table']['$inferSelect'], transformContext: TransformContext): Promise<T>;
94
- protected mapManyToColumns(objects: (DeepPartial<T> | NewEntity<T>)[], transformContext: TransformContext): Promise<PgInsertValue<PgTableFromType<string, EntityType>>[]>;
95
- protected mapToColumns(obj: DeepPartial<T> | NewEntity<T>, transformContext: TransformContext): Promise<PgInsertValue<PgTableFromType<string, EntityType>>>;
96
- protected mapManyToInsertColumns(objects: (DeepPartial<T> | NewEntity<T>)[], transformContext: TransformContext): Promise<PgInsertValue<PgTableFromType<string, EntityType>>[]>;
97
- protected mapToInsertColumns(obj: DeepPartial<T> | NewEntity<T>, transformContext: TransformContext): Promise<PgInsertValue<PgTableFromType<string, EntityType>>>;
98
- protected mapUpdate(update: EntityUpdate<T>, transformContext: TransformContext): Promise<PgUpdateSetSource<PgTableFromType<string, EntityType>>>;
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 {};