@tstdl/base 0.93.2 → 0.93.3
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/api/server/api-request-token.provider.d.ts +5 -3
- package/api/server/api-request-token.provider.js +12 -4
- package/api/server/gateway.d.ts +1 -9
- package/api/server/gateway.js +67 -36
- package/api/types.d.ts +5 -1
- package/application/application.d.ts +2 -0
- package/application/application.js +3 -1
- package/application/providers.d.ts +1 -1
- package/application/providers.js +1 -1
- package/audit/audit.model.d.ts +14 -9
- package/audit/audit.model.js +36 -27
- package/audit/auditor.d.ts +32 -23
- package/audit/auditor.js +84 -21
- package/audit/drizzle/{0000_tiny_the_captain.sql → 0000_bored_stick.sql} +5 -4
- package/audit/drizzle/meta/0000_snapshot.json +22 -15
- package/audit/drizzle/meta/_journal.json +2 -2
- package/audit/index.d.ts +3 -1
- package/audit/index.js +3 -1
- package/audit/module.d.ts +1 -1
- package/audit/module.js +1 -2
- package/audit/schemas.d.ts +2 -2
- package/audit/schemas.js +1 -1
- package/audit/types.d.ts +2 -1
- package/audit/types.js +2 -1
- package/authentication/models/authentication-credentials.model.js +1 -2
- package/authentication/models/authentication-session.model.d.ts +2 -2
- package/authentication/models/authentication-session.model.js +3 -5
- package/authentication/server/authentication-api-request-token.provider.d.ts +2 -2
- package/authentication/server/authentication-api-request-token.provider.js +8 -5
- package/authentication/server/authentication.api-controller.d.ts +8 -8
- package/authentication/server/authentication.api-controller.js +16 -16
- package/authentication/server/authentication.audit.d.ts +34 -0
- package/authentication/server/authentication.audit.js +1 -0
- package/authentication/server/authentication.service.d.ts +19 -10
- package/authentication/server/authentication.service.js +158 -43
- package/authentication/server/module.d.ts +1 -1
- package/authentication/server/schemas.d.ts +2 -3
- package/authentication/server/schemas.js +2 -3
- package/constants.d.ts +1 -0
- package/constants.js +1 -0
- package/document-management/api/document-management.api.d.ts +74 -74
- package/document-management/models/document-assignment-scope.model.d.ts +1 -2
- package/document-management/models/document-assignment-scope.model.js +4 -6
- package/document-management/models/document-assignment-task.model.d.ts +1 -2
- package/document-management/models/document-assignment-task.model.js +3 -5
- package/document-management/models/document-category.model.d.ts +1 -2
- package/document-management/models/document-category.model.js +3 -4
- package/document-management/models/document-collection-assignment.model.d.ts +1 -2
- package/document-management/models/document-collection-assignment.model.js +5 -7
- package/document-management/models/document-collection.model.d.ts +1 -2
- package/document-management/models/document-collection.model.js +3 -4
- package/document-management/models/document-management-table.d.ts +1 -1
- package/document-management/models/document-management-table.js +1 -1
- package/document-management/models/document-property-value.model.d.ts +1 -2
- package/document-management/models/document-property-value.model.js +5 -8
- package/document-management/models/document-property.model.d.ts +1 -2
- package/document-management/models/document-property.model.js +2 -3
- package/document-management/models/document-request-collection-assignment.model.d.ts +1 -2
- package/document-management/models/document-request-collection-assignment.model.js +4 -6
- package/document-management/models/document-request-template.d.ts +1 -2
- package/document-management/models/document-request-template.js +4 -6
- package/document-management/models/document-request.model.d.ts +1 -1
- package/document-management/models/document-request.model.js +4 -5
- package/document-management/models/document-requests-template.d.ts +1 -1
- package/document-management/models/document-requests-template.js +2 -3
- package/document-management/models/document-tag-assignment.model.d.ts +1 -2
- package/document-management/models/document-tag-assignment.model.js +4 -6
- package/document-management/models/document-tag.model.d.ts +1 -1
- package/document-management/models/document-tag.model.js +2 -3
- package/document-management/models/document-type-property.model.d.ts +1 -2
- package/document-management/models/document-type-property.model.js +4 -6
- package/document-management/models/document-type-validation.model.d.ts +1 -2
- package/document-management/models/document-type-validation.model.js +4 -6
- package/document-management/models/document-type.model.d.ts +1 -2
- package/document-management/models/document-type.model.js +3 -5
- package/document-management/models/document-validation-definition.model.d.ts +1 -2
- package/document-management/models/document-validation-definition.model.js +3 -4
- package/document-management/models/document-validation-execution-related-document.model.d.ts +1 -2
- package/document-management/models/document-validation-execution-related-document.model.js +4 -6
- package/document-management/models/document-validation-execution.model.d.ts +1 -2
- package/document-management/models/document-validation-execution.model.js +6 -8
- package/document-management/models/document-workflow.model.d.ts +1 -2
- package/document-management/models/document-workflow.model.js +5 -7
- package/document-management/models/document.model.d.ts +1 -2
- package/document-management/models/document.model.js +5 -7
- package/document-management/server/api/document-management.api.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 +1 -1
- package/document-management/server/schemas.js +1 -1
- package/document-management/server/services/document-category-type.service.d.ts +2 -2
- package/document-management/server/services/document-category-type.service.js +1 -2
- package/document-management/server/services/document-collection.service.d.ts +1 -1
- package/document-management/server/services/document-collection.service.js +1 -2
- package/document-management/server/services/document-management.service.js +6 -6
- package/document-management/server/services/document-property.service.d.ts +1 -1
- package/document-management/server/services/document-property.service.js +1 -2
- package/document-management/server/services/document-validation.service.js +2 -2
- package/document-management/server/services/document-workflow.service.d.ts +2 -2
- package/document-management/server/services/document-workflow.service.js +1 -2
- package/document-management/server/services/document.service.d.ts +1 -1
- package/document-management/server/services/document.service.js +1 -2
- package/document-management/server/services/singleton.js +1 -1
- package/document-management/service-models/document.service-model.d.ts +62 -62
- package/document-management/service-models/document.service-model.js +1 -1
- package/document-management/service-models/enriched/enriched-document-management-data.view.js +1 -1
- package/document-management/service-models/enriched/enriched-document.view.d.ts +1 -1
- package/examples/api/authentication.js +2 -2
- package/examples/api/basic-overview.js +2 -2
- package/examples/api/custom-authentication.js +2 -2
- package/examples/api/streaming.js +2 -2
- package/examples/browser/basic.js +2 -2
- package/examples/document-management/main.js +2 -2
- package/examples/http/client.js +2 -2
- package/examples/mail/basic.js +2 -2
- package/examples/pdf/basic.js +2 -2
- package/examples/template/basic.js +2 -2
- package/http/server/http-server-request.d.ts +3 -3
- package/key-value-store/postgres/key-value-store.service.js +1 -2
- package/key-value-store/postgres/models/key-value.model.d.ts +1 -2
- package/key-value-store/postgres/models/key-value.model.js +2 -4
- package/key-value-store/postgres/models/schemas.d.ts +1 -1
- package/key-value-store/postgres/models/schemas.js +1 -1
- package/lock/postgres/lock.js +1 -1
- package/lock/postgres/models/lock.model.d.ts +1 -2
- package/lock/postgres/models/lock.model.js +3 -5
- package/lock/postgres/models/schemas.d.ts +1 -1
- package/lock/postgres/models/schemas.js +1 -1
- package/lock/postgres/provider.js +1 -2
- package/mail/models/mail-log.model.d.ts +1 -1
- package/mail/models/mail-log.model.js +4 -5
- package/mail/models/schemas.d.ts +1 -1
- package/mail/models/schemas.js +1 -1
- package/openid-connect/oidc-state.model.d.ts +1 -1
- package/openid-connect/oidc-state.model.js +2 -3
- package/openid-connect/oidc.service.js +1 -1
- package/orm/data-types/bytea.js +1 -1
- package/orm/data-types/numeric-date.js +1 -1
- package/orm/decorators.d.ts +65 -72
- package/orm/decorators.js +42 -40
- package/orm/entity.d.ts +1 -1
- package/orm/entity.js +13 -13
- package/orm/index.d.ts +2 -1
- package/orm/index.js +2 -1
- package/orm/schemas/json.d.ts +1 -1
- package/orm/schemas/json.js +1 -1
- package/orm/schemas/numeric-date.d.ts +1 -1
- package/orm/schemas/numeric-date.js +1 -1
- package/orm/schemas/timestamp.d.ts +1 -1
- package/orm/schemas/timestamp.js +1 -1
- package/orm/schemas/uuid.d.ts +2 -2
- package/orm/schemas/uuid.js +1 -1
- package/orm/server/repository.d.ts +1 -1
- package/orm/server/repository.js +12 -9
- package/orm/sqls.d.ts +1 -1
- package/orm/sqls.js +1 -1
- package/orm/types.d.ts +2 -6
- package/orm/types.js +1 -4
- package/package.json +11 -9
- package/queue/postgres/job.model.d.ts +3 -3
- package/queue/postgres/job.model.js +5 -6
- package/queue/postgres/queue.js +2 -2
- package/queue/postgres/schemas.d.ts +1 -1
- package/queue/postgres/schemas.js +1 -1
- package/supports.d.ts +1 -0
- package/supports.js +2 -1
- package/types/types.d.ts +12 -1
- package/utils/object/object.d.ts +3 -1
- package/utils/object/object.js +7 -1
package/orm/index.js
CHANGED
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module ORM
|
|
5
5
|
*/
|
|
6
|
-
export * from './
|
|
6
|
+
export * from './decorators.js';
|
|
7
7
|
export * from './entity.js';
|
|
8
8
|
export * from './query.js';
|
|
9
9
|
export * from './repository.types.js';
|
|
10
|
+
export * from './schemas/index.js';
|
|
10
11
|
export * from './sqls.js';
|
|
11
12
|
export * from './types.js';
|
|
12
13
|
export * from './utils.js';
|
package/orm/schemas/json.d.ts
CHANGED
|
@@ -12,4 +12,4 @@ export declare class JsonSchema<T> extends Schema<T> {
|
|
|
12
12
|
_test(value: any, path: JsonPath, options: SchemaTestOptions): SchemaTestResult<T>;
|
|
13
13
|
}
|
|
14
14
|
export declare function json<T>(options?: JsonSchemaOptions<T>): JsonSchema<T>;
|
|
15
|
-
export declare function
|
|
15
|
+
export declare function JsonProperty(options?: JsonSchemaOptions<any> & TypedOmit<SchemaDecoratorOptions, 'schema'>): Decorator<'class' | 'property' | 'accessor'>;
|
package/orm/schemas/json.js
CHANGED
|
@@ -15,7 +15,7 @@ export class JsonSchema extends Schema {
|
|
|
15
15
|
export function json(options) {
|
|
16
16
|
return new JsonSchema(options);
|
|
17
17
|
}
|
|
18
|
-
export function
|
|
18
|
+
export function JsonProperty(options) {
|
|
19
19
|
const { schema, ...optionsRest } = options ?? {};
|
|
20
20
|
return createDecorator({ class: true, property: true, accessor: true }, (data, metadata, args) => {
|
|
21
21
|
if (data.type == 'class') {
|
|
@@ -5,4 +5,4 @@ export declare class NumericDateSchema extends NumberSchema {
|
|
|
5
5
|
constructor(options?: NumericDateSchemaOptions);
|
|
6
6
|
}
|
|
7
7
|
export declare function numericDate(options?: NumericDateSchemaOptions): NumericDateSchema;
|
|
8
|
-
export declare function
|
|
8
|
+
export declare function NumericDateProperty(options?: NumericDateSchemaOptions & SchemaDecoratorOptions): SchemaPropertyDecorator;
|
|
@@ -8,6 +8,6 @@ export class NumericDateSchema extends NumberSchema {
|
|
|
8
8
|
export function numericDate(options) {
|
|
9
9
|
return new NumericDateSchema(options);
|
|
10
10
|
}
|
|
11
|
-
export function
|
|
11
|
+
export function NumericDateProperty(options) {
|
|
12
12
|
return Property(numericDate(options), options);
|
|
13
13
|
}
|
|
@@ -7,4 +7,4 @@ export declare class TimestampSchema extends NumberSchema {
|
|
|
7
7
|
_test(value: any, path: JsonPath, options: SchemaTestOptions): SchemaTestResult<number>;
|
|
8
8
|
}
|
|
9
9
|
export declare function timestamp(options?: TimestampSchemaOptions): TimestampSchema;
|
|
10
|
-
export declare function
|
|
10
|
+
export declare function TimestampProperty(options?: TimestampSchemaOptions & SchemaDecoratorOptions): SchemaPropertyDecorator;
|
package/orm/schemas/timestamp.js
CHANGED
|
@@ -15,6 +15,6 @@ export class TimestampSchema extends NumberSchema {
|
|
|
15
15
|
export function timestamp(options) {
|
|
16
16
|
return new TimestampSchema(options);
|
|
17
17
|
}
|
|
18
|
-
export function
|
|
18
|
+
export function TimestampProperty(options) {
|
|
19
19
|
return Property(timestamp(options), options);
|
|
20
20
|
}
|
package/orm/schemas/uuid.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { StringSchema, type
|
|
1
|
+
import { StringSchema, type SchemaDecoratorOptions, type SchemaPropertyDecorator } from '../../schema/index.js';
|
|
2
2
|
export type UuidSchemaOptions = {
|
|
3
3
|
defaultRandom?: boolean;
|
|
4
4
|
};
|
|
@@ -8,4 +8,4 @@ export declare class UuidSchema extends StringSchema {
|
|
|
8
8
|
constructor(options?: UuidSchemaOptions);
|
|
9
9
|
}
|
|
10
10
|
export declare function uuid(options?: UuidSchemaOptions): UuidSchema;
|
|
11
|
-
export declare function
|
|
11
|
+
export declare function UuidProperty(options?: UuidSchemaOptions & SchemaDecoratorOptions): SchemaPropertyDecorator;
|
package/orm/schemas/uuid.js
CHANGED
|
@@ -279,7 +279,7 @@ export declare class EntityRepository<T extends Entity | EntityWithoutMetadata =
|
|
|
279
279
|
*/
|
|
280
280
|
deleteMany(ids: string[], metadataUpdate?: EntityMetadataUpdate): Promise<T[]>;
|
|
281
281
|
/**
|
|
282
|
-
* Deletes multiple entities matching a query (soft delete if metadata is available).
|
|
282
|
+
* Deletes multiple entities matching a query (soft delete if metadata is available). Already deleted entities are ignored.
|
|
283
283
|
* @param query The query to filter entities.
|
|
284
284
|
* @param metadataUpdate Optional metadata update to apply during soft delete.
|
|
285
285
|
* @returns A promise that resolves to an array of the deleted entities.
|
package/orm/server/repository.js
CHANGED
|
@@ -62,13 +62,14 @@ let EntityRepository = class EntityRepository extends Transactional {
|
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
async expirationLoop() {
|
|
65
|
-
const
|
|
66
|
-
const
|
|
65
|
+
const expirationColumns = this.#columnDefinitions.filter((column) => isDefined(column.reflectionData?.expirationField));
|
|
66
|
+
const softExpirationColumns = expirationColumns.filter((column) => column.reflectionData.expirationField.mode == 'soft');
|
|
67
|
+
const hardExpirationColumns = expirationColumns.filter((column) => column.reflectionData.expirationField.mode == 'hard');
|
|
67
68
|
if ((softExpirationColumns.length + hardExpirationColumns.length) == 0) {
|
|
68
69
|
return;
|
|
69
70
|
}
|
|
70
|
-
const softDeletionQuery = or(...softExpirationColumns.map((column) => lte(this.getColumn(column)
|
|
71
|
-
const hardDeletionQuery = or(...hardExpirationColumns.map((column) => lte(this.getColumn(column)
|
|
71
|
+
const softDeletionQuery = or(...softExpirationColumns.map((column) => lte(sql `${this.getColumn(column)} + INTERVAL '${sql.raw(String(column.reflectionData.expirationField.after))} ms'`, TRANSACTION_TIMESTAMP)));
|
|
72
|
+
const hardDeletionQuery = or(...hardExpirationColumns.map((column) => lte(sql `${this.getColumn(column)} + INTERVAL '${sql.raw(String(column.reflectionData.expirationField.after))} ms'`, TRANSACTION_TIMESTAMP)));
|
|
72
73
|
assertDefined(this.#cancellationSignal);
|
|
73
74
|
while (this.#cancellationSignal.isUnset) {
|
|
74
75
|
if (isDefined(softDeletionQuery)) {
|
|
@@ -550,7 +551,7 @@ let EntityRepository = class EntityRepository extends Transactional {
|
|
|
550
551
|
if (!this.hasMetadata) {
|
|
551
552
|
return await this.tryHardDelete(id);
|
|
552
553
|
}
|
|
553
|
-
const sqlQuery = this.convertQuery(eq(this.#table.id, id));
|
|
554
|
+
const sqlQuery = and(isNull(this.#tableWithMetadata.deleteTimestamp), this.convertQuery(eq(this.#table.id, id)));
|
|
554
555
|
const [row] = await this.session
|
|
555
556
|
.update(this.#tableWithMetadata)
|
|
556
557
|
.set({
|
|
@@ -591,13 +592,14 @@ let EntityRepository = class EntityRepository extends Transactional {
|
|
|
591
592
|
return await this.tryHardDeleteByQuery(query);
|
|
592
593
|
}
|
|
593
594
|
const idQuery = this.getIdLimitQuery(query).for('update');
|
|
595
|
+
const sqlQuery = and(isNull(this.#tableWithMetadata.deleteTimestamp), inArray(this.#table.id, idQuery));
|
|
594
596
|
const [row] = await this.session
|
|
595
597
|
.update(this.#tableWithMetadata)
|
|
596
598
|
.set({
|
|
597
599
|
deleteTimestamp: TRANSACTION_TIMESTAMP,
|
|
598
600
|
attributes: this.getAttributesUpdate(metadataUpdate?.attributes),
|
|
599
601
|
})
|
|
600
|
-
.where(
|
|
602
|
+
.where(sqlQuery)
|
|
601
603
|
.returning();
|
|
602
604
|
if (isUndefined(row)) {
|
|
603
605
|
return undefined;
|
|
@@ -617,7 +619,7 @@ let EntityRepository = class EntityRepository extends Transactional {
|
|
|
617
619
|
return await this.deleteManyByQuery(inArray(this.#table.id, ids), metadataUpdate);
|
|
618
620
|
}
|
|
619
621
|
/**
|
|
620
|
-
* Deletes multiple entities matching a query (soft delete if metadata is available).
|
|
622
|
+
* Deletes multiple entities matching a query (soft delete if metadata is available). Already deleted entities are ignored.
|
|
621
623
|
* @param query The query to filter entities.
|
|
622
624
|
* @param metadataUpdate Optional metadata update to apply during soft delete.
|
|
623
625
|
* @returns A promise that resolves to an array of the deleted entities.
|
|
@@ -626,7 +628,7 @@ let EntityRepository = class EntityRepository extends Transactional {
|
|
|
626
628
|
if (!this.hasMetadata) {
|
|
627
629
|
return await this.hardDeleteManyByQuery(query);
|
|
628
630
|
}
|
|
629
|
-
const sqlQuery = this.convertQuery(query);
|
|
631
|
+
const sqlQuery = and(isNull(this.#tableWithMetadata.deleteTimestamp), this.convertQuery(query));
|
|
630
632
|
const rows = await this.session
|
|
631
633
|
.update(this.#tableWithMetadata)
|
|
632
634
|
.set({
|
|
@@ -690,9 +692,10 @@ let EntityRepository = class EntityRepository extends Transactional {
|
|
|
690
692
|
*/
|
|
691
693
|
async tryHardDeleteByQuery(query) {
|
|
692
694
|
const idQuery = this.getIdLimitQuery(query).for('update');
|
|
695
|
+
const sqlQuery = inArray(this.#table.id, idQuery);
|
|
693
696
|
const [row] = await this.session
|
|
694
697
|
.delete(this.#table)
|
|
695
|
-
.where(
|
|
698
|
+
.where(sqlQuery)
|
|
696
699
|
.returning();
|
|
697
700
|
if (isUndefined(row)) {
|
|
698
701
|
return undefined;
|
package/orm/sqls.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type { Uuid } from './types.js';
|
|
|
4
4
|
/** Drizzle SQL helper for getting the current transaction's timestamp. Returns a Date object. */
|
|
5
5
|
export declare const TRANSACTION_TIMESTAMP: SQL<Date>;
|
|
6
6
|
/** Drizzle SQL helper for generating a random UUID (v4). Returns a Uuid string. */
|
|
7
|
-
export declare const
|
|
7
|
+
export declare const RANDOM_UUID_V4: SQL<Uuid>;
|
|
8
8
|
/** Represents valid units for PostgreSQL interval values. */
|
|
9
9
|
export type IntervalUnit = 'millennium' | 'millenniums' | 'millennia' | 'century' | 'centuries' | 'decade' | 'decades' | 'year' | 'years' | 'day' | 'days' | 'hour' | 'hours' | 'minute' | 'minutes' | 'second' | 'seconds' | 'millisecond' | 'milliseconds' | 'microsecond' | 'microseconds';
|
|
10
10
|
export declare function autoAlias<T>(column: AnyColumn<{
|
package/orm/sqls.js
CHANGED
|
@@ -9,7 +9,7 @@ import { sql, Table } from 'drizzle-orm';
|
|
|
9
9
|
/** Drizzle SQL helper for getting the current transaction's timestamp. Returns a Date object. */
|
|
10
10
|
export const TRANSACTION_TIMESTAMP = sql `transaction_timestamp()`;
|
|
11
11
|
/** Drizzle SQL helper for generating a random UUID (v4). Returns a Uuid string. */
|
|
12
|
-
export const
|
|
12
|
+
export const RANDOM_UUID_V4 = sql `gen_random_uuid()`;
|
|
13
13
|
export function autoAlias(column) {
|
|
14
14
|
return sql `${column}`.as(`${column.table[Table['Symbol']['Name']]}_${column.name}`);
|
|
15
15
|
}
|
package/orm/types.d.ts
CHANGED
|
@@ -6,12 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import type { $Type, HasDefault as DrizzleHasDefault, IsPrimaryKey as DrizzleIsPrimaryKey } from 'drizzle-orm';
|
|
8
8
|
import type { boolean, doublePrecision, integer, jsonb, PgColumnBuilder, PgColumnBuilderBase, PgEnumColumnBuilderInitial, text, uuid } from 'drizzle-orm/pg-core';
|
|
9
|
-
import {
|
|
10
|
-
import type { AbstractConstructor, EnumerationObject, EnumerationValue, ObjectLiteral, UnionToTuple } from '../types/index.js';
|
|
11
|
-
import type { GetTagMetadata, HasTag, Tagged, UnwrapTagged } from '../types/index.js';
|
|
9
|
+
import type { AbstractConstructor, EnumerationObject, EnumerationValue, GetTagMetadata, HasTag, ObjectLiteral, Tagged, UnionToTuple, UnwrapTagged } from '../types/index.js';
|
|
12
10
|
import type { bytea, numericDate, timestamp } from './data-types/index.js';
|
|
13
|
-
import { Check, Column, Embedded, Encrypted, Index, PrimaryKey, References, Table, Unique } from './decorators.js';
|
|
14
|
-
import { Json, NumericDate, Timestamp, Uuid } from './schemas/index.js';
|
|
15
11
|
/** Tag identifier for column type information. */
|
|
16
12
|
export type ColumnTypeTag = 'column';
|
|
17
13
|
/** Tag identifier for embedded type configuration. */
|
|
@@ -90,4 +86,4 @@ export type Bytea = Tagged<Uint8Array, ColumnTypeTag, ReturnType<typeof bytea>>;
|
|
|
90
86
|
* @template T - The original (unencrypted) type of the data.
|
|
91
87
|
*/
|
|
92
88
|
export type Encrypted<T> = Tagged<T, ColumnTypeTag, ReturnType<typeof bytea>>;
|
|
93
|
-
export {
|
|
89
|
+
export {};
|
package/orm/types.js
CHANGED
|
@@ -1,4 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { Check, Column, Embedded, Encrypted, Index, PrimaryKey, References, Table, Unique } from './decorators.js';
|
|
3
|
-
import { Json, NumericDate, Timestamp, Uuid } from './schemas/index.js';
|
|
4
|
-
export { Array, Check, Column, Embedded, Encrypted, Index, Integer, Json, NumericDate, PrimaryKey, References, Table, Timestamp, Unique, Uuid };
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tstdl/base",
|
|
3
|
-
"version": "0.93.
|
|
3
|
+
"version": "0.93.3",
|
|
4
4
|
"author": "Patrick Hein",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"./tsconfig.json": "./tsconfig.json",
|
|
31
31
|
"./eslint.config.js": "./eslint.config.js",
|
|
32
32
|
".": "./index.js",
|
|
33
|
+
"./constants": "./constants.js",
|
|
33
34
|
"./environment": "./environment.js",
|
|
34
35
|
"./interfaces": "./interfaces.js",
|
|
35
36
|
"./polyfills": "./polyfills.js",
|
|
@@ -83,6 +84,8 @@
|
|
|
83
84
|
"./object-storage": "./object-storage/index.js",
|
|
84
85
|
"./openid-connect": "./openid-connect/index.js",
|
|
85
86
|
"./orm": "./orm/index.js",
|
|
87
|
+
"./orm/schemas": "./orm/schemas/index.js",
|
|
88
|
+
"./orm/data-types": "./orm/data-types/index.js",
|
|
86
89
|
"./orm/server": "./orm/server/index.js",
|
|
87
90
|
"./password": "./password/index.js",
|
|
88
91
|
"./pdf": "./pdf/index.js",
|
|
@@ -129,11 +132,11 @@
|
|
|
129
132
|
"reflect-metadata": "^0.2",
|
|
130
133
|
"rxjs": "^7.8",
|
|
131
134
|
"ts-pattern": "^5.8",
|
|
132
|
-
"type-fest": "
|
|
135
|
+
"type-fest": "^5.0"
|
|
133
136
|
},
|
|
134
137
|
"peerDependencies": {
|
|
135
138
|
"@google-cloud/storage": "^7.17",
|
|
136
|
-
"@google/genai": "^1.
|
|
139
|
+
"@google/genai": "^1.22",
|
|
137
140
|
"@tstdl/angular": "^0.93",
|
|
138
141
|
"@zxcvbn-ts/core": "^3.0",
|
|
139
142
|
"@zxcvbn-ts/language-common": "^3.0",
|
|
@@ -143,7 +146,7 @@
|
|
|
143
146
|
"file-type": "^21.0",
|
|
144
147
|
"handlebars": "^4.7",
|
|
145
148
|
"minio": "^8.0",
|
|
146
|
-
"mjml": "^4.
|
|
149
|
+
"mjml": "^4.16",
|
|
147
150
|
"nodemailer": "^7.0",
|
|
148
151
|
"pg": "^8.16",
|
|
149
152
|
"playwright": "^1.55",
|
|
@@ -159,24 +162,23 @@
|
|
|
159
162
|
}
|
|
160
163
|
},
|
|
161
164
|
"devDependencies": {
|
|
162
|
-
"@stylistic/eslint-plugin": "5.
|
|
165
|
+
"@stylistic/eslint-plugin": "5.4",
|
|
163
166
|
"@types/koa__router": "12.0",
|
|
164
167
|
"@types/luxon": "3.7",
|
|
165
|
-
"@types/minio": "7.1",
|
|
166
168
|
"@types/mjml": "4.7",
|
|
167
169
|
"@types/node": "24",
|
|
168
170
|
"@types/nodemailer": "7.0",
|
|
169
171
|
"@types/pg": "8.15",
|
|
170
172
|
"concurrently": "9.2",
|
|
171
173
|
"drizzle-kit": "0.31",
|
|
172
|
-
"eslint": "9.
|
|
174
|
+
"eslint": "9.37",
|
|
173
175
|
"globals": "16.4",
|
|
174
176
|
"tsc-alias": "1.8",
|
|
175
177
|
"typedoc-github-wiki-theme": "2.1",
|
|
176
|
-
"typedoc-plugin-markdown": "4.
|
|
178
|
+
"typedoc-plugin-markdown": "4.9",
|
|
177
179
|
"typedoc-plugin-missing-exports": "4.1",
|
|
178
180
|
"typescript": "5.9",
|
|
179
|
-
"typescript-eslint": "8.
|
|
181
|
+
"typescript-eslint": "8.45"
|
|
180
182
|
},
|
|
181
183
|
"overrides": {
|
|
182
184
|
"drizzle-kit": {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { EntityWithoutMetadata,
|
|
1
|
+
import { EntityWithoutMetadata, type Json, type Timestamp } from '../../orm/index.js';
|
|
2
2
|
import type { ObjectLiteral } from '../../types/index.js';
|
|
3
3
|
import type { Job } from '../queue.js';
|
|
4
4
|
export declare class PostgresJob<T extends ObjectLiteral = ObjectLiteral> extends EntityWithoutMetadata implements Job<T> {
|
|
5
5
|
queue: string;
|
|
6
6
|
tag: string | null;
|
|
7
|
-
priority:
|
|
7
|
+
priority: number;
|
|
8
8
|
enqueueTimestamp: Timestamp;
|
|
9
|
-
tries:
|
|
9
|
+
tries: number;
|
|
10
10
|
lastDequeueTimestamp: Timestamp | null;
|
|
11
11
|
data: Json<T>;
|
|
12
12
|
}
|
|
@@ -7,9 +7,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
9
|
};
|
|
10
|
-
import { Index, Table } from '../../orm/
|
|
11
|
-
import {
|
|
12
|
-
import { StringProperty } from '../../schema/index.js';
|
|
10
|
+
import { EntityWithoutMetadata, Index, JsonProperty, Table, TimestampProperty } from '../../orm/index.js';
|
|
11
|
+
import { Integer, StringProperty } from '../../schema/index.js';
|
|
13
12
|
let PostgresJob = class PostgresJob extends EntityWithoutMetadata {
|
|
14
13
|
queue;
|
|
15
14
|
tag;
|
|
@@ -32,7 +31,7 @@ __decorate([
|
|
|
32
31
|
__metadata("design:type", Number)
|
|
33
32
|
], PostgresJob.prototype, "priority", void 0);
|
|
34
33
|
__decorate([
|
|
35
|
-
|
|
34
|
+
TimestampProperty(),
|
|
36
35
|
__metadata("design:type", Number)
|
|
37
36
|
], PostgresJob.prototype, "enqueueTimestamp", void 0);
|
|
38
37
|
__decorate([
|
|
@@ -40,11 +39,11 @@ __decorate([
|
|
|
40
39
|
__metadata("design:type", Number)
|
|
41
40
|
], PostgresJob.prototype, "tries", void 0);
|
|
42
41
|
__decorate([
|
|
43
|
-
|
|
42
|
+
TimestampProperty({ nullable: true }),
|
|
44
43
|
__metadata("design:type", Object)
|
|
45
44
|
], PostgresJob.prototype, "lastDequeueTimestamp", void 0);
|
|
46
45
|
__decorate([
|
|
47
|
-
|
|
46
|
+
JsonProperty(),
|
|
48
47
|
__metadata("design:type", Object)
|
|
49
48
|
], PostgresJob.prototype, "data", void 0);
|
|
50
49
|
PostgresJob = __decorate([
|
package/queue/postgres/queue.js
CHANGED
|
@@ -9,7 +9,7 @@ import { merge } from 'rxjs';
|
|
|
9
9
|
import { CancellationSignal } from '../../cancellation/index.js';
|
|
10
10
|
import { inject, injectArgument, provide, Singleton } from '../../injector/index.js';
|
|
11
11
|
import { MessageBus } from '../../message-bus/index.js';
|
|
12
|
-
import { interval,
|
|
12
|
+
import { interval, RANDOM_UUID_V4, TRANSACTION_TIMESTAMP } from '../../orm/index.js';
|
|
13
13
|
import { DatabaseConfig, EntityRepositoryConfig, injectRepository } from '../../orm/server/index.js';
|
|
14
14
|
import { cancelableTimeout } from '../../utils/timing.js';
|
|
15
15
|
import { isDefined, isString, isUndefined } from '../../utils/type-guards.js';
|
|
@@ -27,7 +27,7 @@ let PostgresQueue = class PostgresQueue extends Queue {
|
|
|
27
27
|
processTimeout = (isString(this.#config) ? undefined : this.#config.processTimeout) ?? defaultQueueConfig.processTimeout;
|
|
28
28
|
maxTries = (isString(this.#config) ? undefined : this.#config.maxTries) ?? defaultQueueConfig.maxTries;
|
|
29
29
|
#takeNewUpdate = {
|
|
30
|
-
id:
|
|
30
|
+
id: RANDOM_UUID_V4,
|
|
31
31
|
queue: this.#queueName,
|
|
32
32
|
priority: sql `excluded.priority`,
|
|
33
33
|
tag: sql `excluded.tag`,
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { PostgresJob } from './job.model.js';
|
|
2
|
-
export declare const queueSchema: import("../../orm/server/
|
|
2
|
+
export declare const queueSchema: import("../../orm/server/index.js").DatabaseSchema<"queue">;
|
|
3
3
|
export declare const job: import("../../orm/server/types.js").PgTableFromType<typeof PostgresJob, "queue">;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { databaseSchema } from '../../orm/server/
|
|
1
|
+
import { databaseSchema } from '../../orm/server/index.js';
|
|
2
2
|
import { PostgresJob } from './job.model.js';
|
|
3
3
|
export const queueSchema = databaseSchema('queue');
|
|
4
4
|
export const job = queueSchema.getTable(PostgresJob);
|
package/supports.d.ts
CHANGED
package/supports.js
CHANGED
|
@@ -3,4 +3,5 @@ export const supportsBlob = (typeof Blob == 'function');
|
|
|
3
3
|
export const supportsBuffer = (typeof Buffer == 'function');
|
|
4
4
|
export const supportsStructuredClone = (typeof structuredClone == 'function');
|
|
5
5
|
export const supportsNotification = (typeof Notification == 'function');
|
|
6
|
-
export const supportsColoredStdout = (typeof process == 'object' && process.stdout.hasColors());
|
|
6
|
+
export const supportsColoredStdout = (typeof process == 'object' && (process.stdout.hasColors?.() ?? false));
|
|
7
|
+
export const supportsColoredStderr = (typeof process == 'object' && (process.stderr.hasColors?.() ?? false));
|
package/types/types.d.ts
CHANGED
|
@@ -117,7 +117,18 @@ export type OmitBy<T, V> = Omit<T, {
|
|
|
117
117
|
/**
|
|
118
118
|
* Normalize properties of a type that allow `undefined` to make them optional.
|
|
119
119
|
*/
|
|
120
|
-
export type Optionalize<T extends object> = OmitBy<T, undefined> & Partial<PickBy<T, undefined
|
|
120
|
+
export type Optionalize<T extends object> = SimplifyObject<OmitBy<T, undefined> & Partial<PickBy<T, undefined>>>;
|
|
121
|
+
export type OptionalizeDeep<T> = T extends BuiltIn ? T : T extends (infer U)[] ? OptionalizeDeep<U>[] : T extends readonly (infer U)[] ? readonly OptionalizeDeep<U>[] : Optionalize<{
|
|
122
|
+
[P in keyof T]: OptionalizeDeep<T[P]>;
|
|
123
|
+
}>;
|
|
124
|
+
export type OptionalizeNull<T extends object> = SimplifyObject<OmitBy<T, null> & Partial<PickBy<T, null>>>;
|
|
125
|
+
export type OptionalizeNullDeep<T> = T extends BuiltIn ? T : T extends (infer U)[] ? OptionalizeNullDeep<U>[] : T extends readonly (infer U)[] ? readonly OptionalizeNullDeep<U>[] : OptionalizeNull<{
|
|
126
|
+
[P in keyof T]: OptionalizeNullDeep<T[P]>;
|
|
127
|
+
}>;
|
|
128
|
+
export type OptionalizeNullable<T extends object> = SimplifyObject<OmitBy<T, null | undefined> & Partial<PickBy<T, null | undefined>>>;
|
|
129
|
+
export type OptionalizeNullableDeep<T> = T extends BuiltIn ? T : T extends readonly (infer U)[] ? OptionalizeNullableDeep<U>[] : T extends (infer U)[] ? OptionalizeNullableDeep<U>[] : OptionalizeNullable<{
|
|
130
|
+
[P in keyof T]: OptionalizeNullableDeep<T[P]>;
|
|
131
|
+
}>;
|
|
121
132
|
export type Unoptionalize<T extends object> = SimplifyObject<OmitBy<T, undefined> & {
|
|
122
133
|
[P in PropertiesOfType<T, undefined>]: T[P] | undefined;
|
|
123
134
|
}>;
|
package/utils/object/object.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type JsonPathInput } from '../../json-path/json-path.js';
|
|
2
|
-
import type { BaseType, FromEntries, ObjectLiteral, Optionalize, PickBy, Record, SimplifyObject, UnionToIntersection } from '../../types/index.js';
|
|
2
|
+
import type { BaseType, FromEntries, ObjectLiteral, Optionalize, OptionalizeNull, PickBy, Record, SimplifyObject, UnionToIntersection } from '../../types/index.js';
|
|
3
3
|
export declare function hasOwnProperty<T extends Record, K extends keyof UnionToIntersection<T>>(obj: T, key: K): obj is Extract<T, Partial<Record<K>>>;
|
|
4
4
|
export declare function hasOwnProperty<T extends Record>(obj: T, key: keyof T): boolean;
|
|
5
5
|
/**
|
|
@@ -22,7 +22,9 @@ export declare function filterObject<T extends ObjectLiteral, U extends T[keyof
|
|
|
22
22
|
export declare function filterObject<T extends ObjectLiteral>(object: T, predicate: (value: T[keyof T], key: keyof T) => boolean): Partial<T>;
|
|
23
23
|
export declare function filterObjectAsync<T extends ObjectLiteral>(object: T, predicate: (value: T[keyof T], key: keyof T) => Promise<boolean>): Promise<Partial<T>>;
|
|
24
24
|
export declare function filterUndefinedFromRecord<K extends PropertyKey, V>(record: Record<K, V>): Record<BaseType<K>, Exclude<V, undefined>>;
|
|
25
|
+
export declare function filterNullishFromRecord<K extends PropertyKey, V>(record: Record<K, V>): Record<BaseType<K>, Exclude<V, null | undefined>>;
|
|
25
26
|
export declare function filterUndefinedObjectProperties<T extends ObjectLiteral>(object: T): SimplifyObject<Optionalize<T>>;
|
|
27
|
+
export declare function filterNullishObjectProperties<T extends ObjectLiteral>(object: T): SimplifyObject<OptionalizeNull<Optionalize<T>>>;
|
|
26
28
|
export declare function copyObjectProperties<T extends ObjectLiteral>(source: T, target: T): void;
|
|
27
29
|
export declare function getGetter<T extends ObjectLiteral, U extends keyof T>(obj: T, property: U, bind: boolean): () => T[U];
|
|
28
30
|
export declare function deepObjectEntries(object: ObjectLiteral, keepInnerObjects?: boolean, prefix?: string): [string, any][];
|
package/utils/object/object.js
CHANGED
|
@@ -2,7 +2,7 @@ import { JsonPath } from '../../json-path/json-path.js';
|
|
|
2
2
|
import { filterAsync } from '../async-iterable-helpers/filter.js';
|
|
3
3
|
import { mapAsync } from '../async-iterable-helpers/map.js';
|
|
4
4
|
import { toArrayAsync } from '../async-iterable-helpers/to-array.js';
|
|
5
|
-
import { isArray, isDefined, isObject, isSymbol, isUndefined } from '../type-guards.js';
|
|
5
|
+
import { isArray, isDefined, isNotNullOrUndefined, isObject, isSymbol, isUndefined } from '../type-guards.js';
|
|
6
6
|
export function hasOwnProperty(obj, key) {
|
|
7
7
|
return Object.hasOwn(obj, key);
|
|
8
8
|
}
|
|
@@ -55,9 +55,15 @@ export async function filterObjectAsync(object, predicate) {
|
|
|
55
55
|
export function filterUndefinedFromRecord(record) {
|
|
56
56
|
return filterObject(record, isDefined);
|
|
57
57
|
}
|
|
58
|
+
export function filterNullishFromRecord(record) {
|
|
59
|
+
return filterObject(record, isNotNullOrUndefined);
|
|
60
|
+
}
|
|
58
61
|
export function filterUndefinedObjectProperties(object) {
|
|
59
62
|
return filterObject(object, isDefined);
|
|
60
63
|
}
|
|
64
|
+
export function filterNullishObjectProperties(object) {
|
|
65
|
+
return filterObject(object, isNotNullOrUndefined);
|
|
66
|
+
}
|
|
61
67
|
export function copyObjectProperties(source, target) {
|
|
62
68
|
for (const key of objectKeys(source)) {
|
|
63
69
|
target[key] = source[key];
|