@tstdl/base 0.93.58 → 0.93.59
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/audit/audit.model.d.ts +2 -2
- package/audit/audit.model.js +3 -3
- package/audit/auditor.js +2 -3
- package/authentication/models/authentication-credentials.model.js +1 -1
- package/authentication/models/authentication-session.model.js +1 -1
- package/authentication/server/authentication.service.js +1 -2
- package/key-value-store/postgres/key-value-store.service.js +2 -3
- package/key-value-store/postgres/models/key-value.model.js +1 -1
- package/lock/postgres/models/lock.model.d.ts +2 -2
- package/lock/postgres/models/lock.model.js +3 -3
- package/lock/postgres/provider.js +2 -3
- package/mail/drizzle.config.js +2 -2
- package/mail/mail.service.js +1 -2
- package/mail/models/mail-log.model.d.ts +2 -2
- package/mail/models/mail-log.model.js +3 -3
- package/mail/models/mail-template.model.js +1 -1
- package/openid-connect/cached-oidc-configuration.service.js +2 -2
- package/openid-connect/oidc-configuration.service.js +3 -5
- package/openid-connect/oidc-state.model.d.ts +2 -2
- package/openid-connect/oidc-state.model.js +7 -3
- package/openid-connect/oidc.service.js +0 -4
- package/orm/decorators.d.ts +1 -1
- package/orm/entity.d.ts +0 -5
- package/orm/entity.js +0 -5
- package/orm/utils.d.ts +3 -3
- package/package.json +1 -1
- package/queue/postgres/job.model.d.ts +2 -2
- package/queue/postgres/job.model.js +3 -3
- package/queue/postgres/queue.js +1 -2
- package/schema/converters/zod-v3-converter.d.ts +3 -0
- package/schema/converters/zod-v3-converter.js +0 -1
package/audit/audit.model.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Embedded,
|
|
1
|
+
import { BaseEntity, type Embedded, type Json, type Timestamp, type Uuid } from '../orm/index.js';
|
|
2
2
|
import type { UndefinableJsonObject } from '../types/index.js';
|
|
3
3
|
import { ActorType, AuditOutcome, AuditSeverity } from './types.js';
|
|
4
4
|
/**
|
|
@@ -44,7 +44,7 @@ export declare class ChangeDetails {
|
|
|
44
44
|
*
|
|
45
45
|
* @template Details The type of the `details` JSON object, allowing for custom, action-specific data.
|
|
46
46
|
*/
|
|
47
|
-
export declare class AuditEvent<Details extends UndefinableJsonObject = UndefinableJsonObject> extends
|
|
47
|
+
export declare class AuditEvent<Details extends UndefinableJsonObject = UndefinableJsonObject> extends BaseEntity {
|
|
48
48
|
/**
|
|
49
49
|
* The timestamp when the event occurred.
|
|
50
50
|
*/
|
package/audit/audit.model.js
CHANGED
|
@@ -7,7 +7,7 @@ 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 {
|
|
10
|
+
import { BaseEntity, EmbeddedProperty, JsonProperty, Table, TimestampProperty, UuidProperty } from '../orm/index.js';
|
|
11
11
|
import { Enumeration, StringProperty } from '../schema/index.js';
|
|
12
12
|
import { ActorType, AuditOutcome, AuditSeverity } from './types.js';
|
|
13
13
|
/**
|
|
@@ -77,7 +77,7 @@ __decorate([
|
|
|
77
77
|
*
|
|
78
78
|
* @template Details The type of the `details` JSON object, allowing for custom, action-specific data.
|
|
79
79
|
*/
|
|
80
|
-
let AuditEvent = class AuditEvent extends
|
|
80
|
+
let AuditEvent = class AuditEvent extends BaseEntity {
|
|
81
81
|
/**
|
|
82
82
|
* The timestamp when the event occurred.
|
|
83
83
|
*/
|
|
@@ -211,6 +211,6 @@ __decorate([
|
|
|
211
211
|
__metadata("design:type", Object)
|
|
212
212
|
], AuditEvent.prototype, "details", void 0);
|
|
213
213
|
AuditEvent = __decorate([
|
|
214
|
-
Table({ name: 'event' })
|
|
214
|
+
Table({ name: 'event', schema: 'audit' })
|
|
215
215
|
], AuditEvent);
|
|
216
216
|
export { AuditEvent };
|
package/audit/auditor.js
CHANGED
|
@@ -9,10 +9,10 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
};
|
|
10
10
|
var Auditor_1;
|
|
11
11
|
import { createContextProvider } from '../context/index.js';
|
|
12
|
-
import { inject, Injectable, injectArgument
|
|
12
|
+
import { inject, Injectable, injectArgument } from '../injector/index.js';
|
|
13
13
|
import { Logger, LogLevel } from '../logger/index.js';
|
|
14
14
|
import { TRANSACTION_TIMESTAMP } from '../orm/index.js';
|
|
15
|
-
import { DatabaseConfig,
|
|
15
|
+
import { DatabaseConfig, injectRepository, isInTransactionalContext } from '../orm/server/index.js';
|
|
16
16
|
import { toArray } from '../utils/array/index.js';
|
|
17
17
|
import { Memoize } from '../utils/function/memoize.js';
|
|
18
18
|
import { filterNullishFromRecord, filterUndefinedFromRecord, objectKeys } from '../utils/object/object.js';
|
|
@@ -235,7 +235,6 @@ __decorate([
|
|
|
235
235
|
Auditor = Auditor_1 = __decorate([
|
|
236
236
|
Injectable({
|
|
237
237
|
providers: [
|
|
238
|
-
provide(EntityRepositoryConfig, { useValue: { schema: 'audit' } }),
|
|
239
238
|
{ provide: DatabaseConfig, useFactory: (_, context) => context.resolve(AuditModuleConfig).database ?? context.resolve(DatabaseConfig, undefined, { skipSelf: 2 }) },
|
|
240
239
|
],
|
|
241
240
|
})
|
|
@@ -39,6 +39,6 @@ __decorate([
|
|
|
39
39
|
__metadata("design:type", Uint8Array)
|
|
40
40
|
], AuthenticationCredentials.prototype, "hash", void 0);
|
|
41
41
|
AuthenticationCredentials = __decorate([
|
|
42
|
-
Table('credentials')
|
|
42
|
+
Table('credentials', { schema: 'authentication' })
|
|
43
43
|
], AuthenticationCredentials);
|
|
44
44
|
export { AuthenticationCredentials };
|
|
@@ -48,6 +48,6 @@ __decorate([
|
|
|
48
48
|
__metadata("design:type", Uint8Array)
|
|
49
49
|
], AuthenticationSession.prototype, "refreshTokenHash", void 0);
|
|
50
50
|
AuthenticationSession = __decorate([
|
|
51
|
-
Table('session')
|
|
51
|
+
Table('session', { schema: 'authentication' })
|
|
52
52
|
], AuthenticationSession);
|
|
53
53
|
export { AuthenticationSession };
|
|
@@ -15,7 +15,7 @@ import { NotImplementedError } from '../../errors/not-implemented.error.js';
|
|
|
15
15
|
import { afterResolve, inject, provide, Singleton } from '../../injector/index.js';
|
|
16
16
|
import { KeyValueStore } from '../../key-value-store/key-value.store.js';
|
|
17
17
|
import { Logger } from '../../logger/logger.js';
|
|
18
|
-
import { DatabaseConfig,
|
|
18
|
+
import { DatabaseConfig, injectRepository } from '../../orm/server/index.js';
|
|
19
19
|
import { Alphabet } from '../../utils/alphabet.js';
|
|
20
20
|
import { asyncHook } from '../../utils/async-hook/async-hook.js';
|
|
21
21
|
import { decodeBase64, encodeBase64 } from '../../utils/base64.js';
|
|
@@ -629,7 +629,6 @@ let AuthenticationService = AuthenticationService_1 = class AuthenticationServic
|
|
|
629
629
|
AuthenticationService = AuthenticationService_1 = __decorate([
|
|
630
630
|
Singleton({
|
|
631
631
|
providers: [
|
|
632
|
-
provide(EntityRepositoryConfig, { useValue: { schema: 'authentication' } }),
|
|
633
632
|
provide(DatabaseConfig, { useFactory: (_, context) => context.resolve(AuthenticationModuleConfig).database ?? context.resolve(DatabaseConfig, undefined, { skipSelf: 2 }) }),
|
|
634
633
|
],
|
|
635
634
|
})
|
|
@@ -4,8 +4,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { Singleton, injectArgument
|
|
8
|
-
import { DatabaseConfig,
|
|
7
|
+
import { Singleton, injectArgument } from '../../injector/index.js';
|
|
8
|
+
import { DatabaseConfig, Transactional, injectRepository } from '../../orm/server/index.js';
|
|
9
9
|
import { objectEntries } from '../../utils/object/object.js';
|
|
10
10
|
import { assertDefinedPass, isDefined, isUndefined } from '../../utils/type-guards.js';
|
|
11
11
|
import { KeyValueStore } from '../key-value.store.js';
|
|
@@ -56,7 +56,6 @@ let PostgresKeyValueStore = class PostgresKeyValueStore extends Transactional {
|
|
|
56
56
|
PostgresKeyValueStore = __decorate([
|
|
57
57
|
Singleton({
|
|
58
58
|
providers: [
|
|
59
|
-
provide(EntityRepositoryConfig, { useValue: { schema: 'key_value_store' } }),
|
|
60
59
|
{ provide: DatabaseConfig, useFactory: (_, context) => context.resolve(PostgresKeyValueStoreModuleConfig).database ?? context.resolve(DatabaseConfig, undefined, { skipSelf: 2 }) },
|
|
61
60
|
],
|
|
62
61
|
})
|
|
@@ -27,7 +27,7 @@ __decorate([
|
|
|
27
27
|
__metadata("design:type", Object)
|
|
28
28
|
], KeyValue.prototype, "value", void 0);
|
|
29
29
|
KeyValue = __decorate([
|
|
30
|
-
Table('key_value'),
|
|
30
|
+
Table('key_value', { schema: 'key_value_store' }),
|
|
31
31
|
Unique(['module', 'key'])
|
|
32
32
|
], KeyValue);
|
|
33
33
|
export { KeyValue };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare class PostgresLock extends
|
|
1
|
+
import { BaseEntity, type Timestamp } from '../../../orm/index.js';
|
|
2
|
+
export declare class PostgresLock extends BaseEntity {
|
|
3
3
|
resource: string;
|
|
4
4
|
key: string;
|
|
5
5
|
expiration: Timestamp;
|
|
@@ -7,9 +7,9 @@ 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 {
|
|
10
|
+
import { BaseEntity, Expires, Table, TimestampProperty, Unique } from '../../../orm/index.js';
|
|
11
11
|
import { StringProperty } from '../../../schema/index.js';
|
|
12
|
-
let PostgresLock = class PostgresLock extends
|
|
12
|
+
let PostgresLock = class PostgresLock extends BaseEntity {
|
|
13
13
|
resource;
|
|
14
14
|
key;
|
|
15
15
|
expiration;
|
|
@@ -29,6 +29,6 @@ __decorate([
|
|
|
29
29
|
__metadata("design:type", Number)
|
|
30
30
|
], PostgresLock.prototype, "expiration", void 0);
|
|
31
31
|
PostgresLock = __decorate([
|
|
32
|
-
Table('lock')
|
|
32
|
+
Table('lock', { schema: 'lock' })
|
|
33
33
|
], PostgresLock);
|
|
34
34
|
export { PostgresLock };
|
|
@@ -4,8 +4,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { Singleton
|
|
8
|
-
import { DatabaseConfig,
|
|
7
|
+
import { Singleton } from '../../injector/index.js';
|
|
8
|
+
import { DatabaseConfig, injectRepository } from '../../orm/server/index.js';
|
|
9
9
|
import { LockProvider } from '../provider.js';
|
|
10
10
|
import { PostgresLockAdapter } from './lock.js';
|
|
11
11
|
import { PostgresLock } from './models/lock.model.js';
|
|
@@ -20,7 +20,6 @@ let PostgresLockProvider = class PostgresLockProvider extends LockProvider {
|
|
|
20
20
|
PostgresLockProvider = __decorate([
|
|
21
21
|
Singleton({
|
|
22
22
|
providers: [
|
|
23
|
-
provide(EntityRepositoryConfig, { useValue: { schema: 'lock' } }),
|
|
24
23
|
{ provide: DatabaseConfig, useFactory: (_, context) => context.resolve(PostgresLockModuleConfig).database ?? context.resolve(DatabaseConfig, undefined, { skipSelf: 2 }) },
|
|
25
24
|
],
|
|
26
25
|
})
|
package/mail/drizzle.config.js
CHANGED
package/mail/mail.service.js
CHANGED
|
@@ -6,7 +6,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
import { Singleton, inject, provide } from '../injector/index.js';
|
|
8
8
|
import { Logger } from '../logger/index.js';
|
|
9
|
-
import { DatabaseConfig,
|
|
9
|
+
import { DatabaseConfig, injectRepository } from '../orm/server/index.js';
|
|
10
10
|
import { TemplateService } from '../templates/template.service.js';
|
|
11
11
|
import { currentTimestamp } from '../utils/date-time.js';
|
|
12
12
|
import { formatError } from '../utils/format-error.js';
|
|
@@ -59,7 +59,6 @@ let MailService = class MailService {
|
|
|
59
59
|
MailService = __decorate([
|
|
60
60
|
Singleton({
|
|
61
61
|
providers: [
|
|
62
|
-
provide(EntityRepositoryConfig, { useValue: { schema: 'mail' } }),
|
|
63
62
|
provide(DatabaseConfig, { useFactory: (_, context) => context.resolve(MailModuleConfig).database ?? context.resolve(DatabaseConfig, undefined, { skipSelf: 2 }) }),
|
|
64
63
|
],
|
|
65
64
|
})
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BaseEntity, type Json, type Timestamp } from '../../orm/index.js';
|
|
2
2
|
import type { MailData } from './mail-data.model.js';
|
|
3
3
|
import type { MailSendResult } from './mail-send-result.model.js';
|
|
4
|
-
export declare class MailLog extends
|
|
4
|
+
export declare class MailLog extends BaseEntity {
|
|
5
5
|
timestamp: Timestamp;
|
|
6
6
|
template: string | null;
|
|
7
7
|
data: Json<MailData>;
|
|
@@ -7,9 +7,9 @@ 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 {
|
|
10
|
+
import { BaseEntity, JsonProperty, Table, TimestampProperty } from '../../orm/index.js';
|
|
11
11
|
import { StringProperty } from '../../schema/index.js';
|
|
12
|
-
let MailLog = class MailLog extends
|
|
12
|
+
let MailLog = class MailLog extends BaseEntity {
|
|
13
13
|
timestamp;
|
|
14
14
|
template;
|
|
15
15
|
data;
|
|
@@ -37,6 +37,6 @@ __decorate([
|
|
|
37
37
|
__metadata("design:type", Object)
|
|
38
38
|
], MailLog.prototype, "errors", void 0);
|
|
39
39
|
MailLog = __decorate([
|
|
40
|
-
Table('log')
|
|
40
|
+
Table('log', { schema: 'mail' })
|
|
41
41
|
], MailLog);
|
|
42
42
|
export { MailLog };
|
|
@@ -28,11 +28,11 @@ let CachedOidcConfigurationService = class CachedOidcConfigurationService extend
|
|
|
28
28
|
const cached = this.cache.get(endpoint);
|
|
29
29
|
const now = currentTimestamp();
|
|
30
30
|
if (isDefined(cached) && cached.expiration > now) {
|
|
31
|
-
return cached.configuration;
|
|
31
|
+
return await cached.configuration;
|
|
32
32
|
}
|
|
33
33
|
const configuration = super.getConfiguration(endpoint);
|
|
34
34
|
this.cache.set(endpoint, { expiration: now + this.cacheDuration, configuration });
|
|
35
|
-
return configuration;
|
|
35
|
+
return await configuration;
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
CachedOidcConfigurationService = __decorate([
|
|
@@ -7,17 +7,15 @@ 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 { Singleton } from '../injector/decorators.js';
|
|
11
10
|
import { HttpClient } from '../http/client/index.js';
|
|
11
|
+
import { Singleton } from '../injector/decorators.js';
|
|
12
12
|
import { object, optional, Schema, string } from '../schema/index.js';
|
|
13
13
|
const oidcConfigurationSchema = object({
|
|
14
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
15
14
|
authorization_endpoint: string(),
|
|
16
15
|
token_endpoint: string(),
|
|
17
16
|
revocation_endpoint: optional(string()),
|
|
18
17
|
userinfo_endpoint: optional(string()),
|
|
19
|
-
end_session_endpoint: optional(string())
|
|
20
|
-
/* eslint-enable @typescript-eslint/naming-convention */
|
|
18
|
+
end_session_endpoint: optional(string()),
|
|
21
19
|
});
|
|
22
20
|
let OidcConfigurationService = class OidcConfigurationService {
|
|
23
21
|
httpClient;
|
|
@@ -33,7 +31,7 @@ let OidcConfigurationService = class OidcConfigurationService {
|
|
|
33
31
|
tokenEndpoint: token_endpoint,
|
|
34
32
|
revocationEndpoint: revocation_endpoint,
|
|
35
33
|
userInfoEndpoint: userinfo_endpoint,
|
|
36
|
-
endSessionEndpoint: end_session_endpoint
|
|
34
|
+
endSessionEndpoint: end_session_endpoint,
|
|
37
35
|
};
|
|
38
36
|
return oidcConfiguration;
|
|
39
37
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare class OidcState<Data> extends
|
|
1
|
+
import { BaseEntity, type Json } from '../orm/index.js';
|
|
2
|
+
export declare class OidcState<Data> extends BaseEntity {
|
|
3
3
|
value: string;
|
|
4
4
|
codeVerifier: string;
|
|
5
5
|
endpoint: string;
|
|
@@ -7,9 +7,9 @@ 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 {
|
|
10
|
+
import { BaseEntity, Expires, JsonProperty, Table, Unique } from '../orm/index.js';
|
|
11
11
|
import { any, NumberProperty, StringProperty } from '../schema/index.js';
|
|
12
|
-
|
|
12
|
+
let OidcState = class OidcState extends BaseEntity {
|
|
13
13
|
value;
|
|
14
14
|
codeVerifier;
|
|
15
15
|
endpoint;
|
|
@@ -17,7 +17,7 @@ export class OidcState extends EntityWithoutMetadata {
|
|
|
17
17
|
clientSecret;
|
|
18
18
|
expiration;
|
|
19
19
|
data;
|
|
20
|
-
}
|
|
20
|
+
};
|
|
21
21
|
__decorate([
|
|
22
22
|
Unique(),
|
|
23
23
|
StringProperty(),
|
|
@@ -48,3 +48,7 @@ __decorate([
|
|
|
48
48
|
JsonProperty({ schema: any() }),
|
|
49
49
|
__metadata("design:type", Object)
|
|
50
50
|
], OidcState.prototype, "data", void 0);
|
|
51
|
+
OidcState = __decorate([
|
|
52
|
+
Table('state', { schema: 'oidc' })
|
|
53
|
+
], OidcState);
|
|
54
|
+
export { OidcState };
|
|
@@ -19,12 +19,10 @@ import { assertDefinedPass, isUndefined } from '../utils/type-guards.js';
|
|
|
19
19
|
import { OidcConfigurationService } from './oidc-configuration.service.js';
|
|
20
20
|
import { OidcState } from './oidc-state.model.js';
|
|
21
21
|
const tokenResponseSchema = object({
|
|
22
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
23
22
|
access_token: string(),
|
|
24
23
|
id_token: optional(string()),
|
|
25
24
|
token_type: string(),
|
|
26
25
|
refresh_token: optional(string()),
|
|
27
|
-
/* eslint-enable @typescript-eslint/naming-convention */
|
|
28
26
|
});
|
|
29
27
|
let OidcService = class OidcService {
|
|
30
28
|
oidcConfigurationService = inject(OidcConfigurationService);
|
|
@@ -125,12 +123,10 @@ let OidcService = class OidcService {
|
|
|
125
123
|
async refreshToken({ endpoint, clientId, clientSecret, refreshToken }) {
|
|
126
124
|
const oidcConfiguration = await this.oidcConfigurationService.getConfiguration(endpoint);
|
|
127
125
|
const formData = {
|
|
128
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
129
126
|
client_id: clientId,
|
|
130
127
|
client_secret: clientSecret,
|
|
131
128
|
grant_type: 'refresh_token',
|
|
132
129
|
refresh_token: refreshToken,
|
|
133
|
-
/* eslint-enable @typescript-eslint/naming-convention */
|
|
134
130
|
};
|
|
135
131
|
const tokenResponse = await this.httpClient.postJson(oidcConfiguration.tokenEndpoint, { headers: { authorization: `Bearer ${refreshToken}` }, body: { form: formData } });
|
|
136
132
|
return parseTokenResponse(tokenResponse);
|
package/orm/decorators.d.ts
CHANGED
|
@@ -262,7 +262,7 @@ export type TableOptions = Partial<Pick<OrmTableReflectionData, 'name' | 'schema
|
|
|
262
262
|
* @param name The table name.
|
|
263
263
|
* @param options Additional table options (currently only schema).
|
|
264
264
|
*/
|
|
265
|
-
export declare function Table(name?: string, options?:
|
|
265
|
+
export declare function Table(name?: string, options?: TableOptions): ClassDecorator;
|
|
266
266
|
/**
|
|
267
267
|
* Specify database table options like name and schema.
|
|
268
268
|
* @param options Table options including name and schema.
|
package/orm/entity.d.ts
CHANGED
package/orm/entity.js
CHANGED
package/orm/utils.d.ts
CHANGED
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
* @module
|
|
3
3
|
* Provides utility functions for working with ORM entities.
|
|
4
4
|
*/
|
|
5
|
-
import type {
|
|
5
|
+
import type { BaseEntity, Entity } from './entity.js';
|
|
6
6
|
/**
|
|
7
7
|
* Converts an array of entities into a Map keyed by entity ID.
|
|
8
8
|
* @template T - The entity type, must extend `Entity` (i.e., have an `id` property).
|
|
9
9
|
* @param entities - An array of entities.
|
|
10
10
|
* @returns A Map where keys are entity IDs and values are the corresponding entities.
|
|
11
11
|
*/
|
|
12
|
-
export declare function getEntityMap<T extends Entity |
|
|
12
|
+
export declare function getEntityMap<T extends Entity | BaseEntity>(entities: T[]): Map<string, T>;
|
|
13
13
|
/**
|
|
14
14
|
* Extracts the IDs from an array of entities.
|
|
15
15
|
* @template T - The entity type, must extend `Entity` (i.e., have an `id` property).
|
|
16
16
|
* @param entities - An array of entities.
|
|
17
17
|
* @returns An array containing the IDs of the entities.
|
|
18
18
|
*/
|
|
19
|
-
export declare function getEntityIds(entities: (Entity |
|
|
19
|
+
export declare function getEntityIds(entities: (Entity | BaseEntity)[]): string[];
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BaseEntity, 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
|
-
export declare class PostgresJob<T extends ObjectLiteral = ObjectLiteral> extends
|
|
4
|
+
export declare class PostgresJob<T extends ObjectLiteral = ObjectLiteral> extends BaseEntity implements Job<T> {
|
|
5
5
|
queue: string;
|
|
6
6
|
tag: string | null;
|
|
7
7
|
priority: number;
|
|
@@ -7,9 +7,9 @@ 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 {
|
|
10
|
+
import { BaseEntity, JsonProperty, Table, TimestampProperty, Unique } from '../../orm/index.js';
|
|
11
11
|
import { Integer, StringProperty } from '../../schema/index.js';
|
|
12
|
-
let PostgresJob = class PostgresJob extends
|
|
12
|
+
let PostgresJob = class PostgresJob extends BaseEntity {
|
|
13
13
|
queue;
|
|
14
14
|
tag;
|
|
15
15
|
priority;
|
|
@@ -47,7 +47,7 @@ __decorate([
|
|
|
47
47
|
__metadata("design:type", Object)
|
|
48
48
|
], PostgresJob.prototype, "data", void 0);
|
|
49
49
|
PostgresJob = __decorate([
|
|
50
|
-
Table('job'),
|
|
50
|
+
Table('job', { schema: 'queue' }),
|
|
51
51
|
Unique(['queue', 'tag'])
|
|
52
52
|
], PostgresJob);
|
|
53
53
|
export { PostgresJob };
|
package/queue/postgres/queue.js
CHANGED
|
@@ -10,7 +10,7 @@ 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
12
|
import { interval, RANDOM_UUID_V4, TRANSACTION_TIMESTAMP } from '../../orm/index.js';
|
|
13
|
-
import { DatabaseConfig,
|
|
13
|
+
import { DatabaseConfig, 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';
|
|
16
16
|
import { millisecondsPerSecond } from '../../utils/units.js';
|
|
@@ -156,7 +156,6 @@ PostgresQueue = __decorate([
|
|
|
156
156
|
Singleton({
|
|
157
157
|
argumentIdentityProvider: JSON.stringify,
|
|
158
158
|
providers: [
|
|
159
|
-
provide(EntityRepositoryConfig, { useValue: { schema: 'queue' } }),
|
|
160
159
|
provide(DatabaseConfig, { useFactory: (_, context) => context.resolve(PostgresQueueModuleConfig).database ?? context.resolve(DatabaseConfig, undefined, { skipSelf: 2 }) }),
|
|
161
160
|
],
|
|
162
161
|
})
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { z, type ZodTypeDef } from 'zod/v3';
|
|
2
|
+
import type { Record } from '../../types/types.js';
|
|
2
3
|
import type { SchemaTestable } from '../schema.js';
|
|
4
|
+
import { ObjectSchema } from '../schemas/index.js';
|
|
3
5
|
export type SchemaConversionOptions = {
|
|
4
6
|
/** Default coerce option if not specified in schema */
|
|
5
7
|
coerce?: boolean;
|
|
@@ -7,4 +9,5 @@ export type SchemaConversionOptions = {
|
|
|
7
9
|
mask?: boolean;
|
|
8
10
|
};
|
|
9
11
|
/** WARNING: *DOES NOT* cover all schemas and options. Meant for usage in schema generators like genkit, not for full schema testing in APIs etc. */
|
|
12
|
+
export declare function convertToZodV3Schema<T extends Record>(testable: ObjectSchema<T>, options?: SchemaConversionOptions): z.ZodObject<any, any, any, T>;
|
|
10
13
|
export declare function convertToZodV3Schema<O, I = unknown>(testable: SchemaTestable<O>, options?: SchemaConversionOptions): z.ZodType<O, ZodTypeDef, I>;
|
|
@@ -5,7 +5,6 @@ import { objectEntries } from '../../utils/object/object.js';
|
|
|
5
5
|
import { isArray, isNotNull, isNumber } from '../../utils/type-guards.js';
|
|
6
6
|
import { any, AnySchema, ArraySchema, BigIntSchema, BooleanSchema, DateSchema, DefaultSchema, DeferredSchema, EnumerationSchema, InstanceSchema, LiteralSchema, NeverSchema, NullableSchema, NumberSchema, ObjectSchema, OneOrManySchema, OptionalSchema, ReadableStreamSchema, StringSchema, SymbolSchema, TransformSchema, UnionSchema, UnknownSchema } from '../schemas/index.js';
|
|
7
7
|
import { schemaTestableToSchema } from '../testable.js';
|
|
8
|
-
/** WARNING: *DOES NOT* cover all schemas and options. Meant for usage in schema generators like genkit, not for full schema testing in APIs etc. */
|
|
9
8
|
export function convertToZodV3Schema(testable, options) {
|
|
10
9
|
const schema = schemaTestableToSchema(testable);
|
|
11
10
|
return convertToZodSchemaBase(schema, options);
|