@tstdl/base 0.93.20 → 0.93.21
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/auditor.js +1 -1
- package/authentication/server/authentication.service.js +1 -1
- package/document-management/server/services/singleton.js +1 -1
- package/injector/injector.d.ts +1 -1
- package/injector/injector.js +26 -14
- package/injector/types.d.ts +1 -1
- package/key-value-store/postgres/key-value-store.service.js +1 -1
- package/lock/postgres/provider.js +1 -1
- package/mail/mail.service.js +1 -1
- package/package.json +1 -1
- package/queue/postgres/queue.js +1 -1
package/audit/auditor.js
CHANGED
|
@@ -233,7 +233,7 @@ Auditor = Auditor_1 = __decorate([
|
|
|
233
233
|
Injectable({
|
|
234
234
|
providers: [
|
|
235
235
|
provide(EntityRepositoryConfig, { useValue: { schema: 'audit' } }),
|
|
236
|
-
{ provide: DatabaseConfig, useFactory: (_, context) => context.resolve(AuditModuleConfig).database ?? context.resolve(DatabaseConfig, undefined, { skipSelf:
|
|
236
|
+
{ provide: DatabaseConfig, useFactory: (_, context) => context.resolve(AuditModuleConfig).database ?? context.resolve(DatabaseConfig, undefined, { skipSelf: true }) },
|
|
237
237
|
],
|
|
238
238
|
})
|
|
239
239
|
], Auditor);
|
|
@@ -630,7 +630,7 @@ AuthenticationService = AuthenticationService_1 = __decorate([
|
|
|
630
630
|
Singleton({
|
|
631
631
|
providers: [
|
|
632
632
|
provide(EntityRepositoryConfig, { useValue: { schema: 'authentication' } }),
|
|
633
|
-
provide(DatabaseConfig, { useFactory: (_, context) => context.resolve(AuthenticationModuleConfig).database ?? context.resolve(DatabaseConfig, undefined, { skipSelf:
|
|
633
|
+
provide(DatabaseConfig, { useFactory: (_, context) => context.resolve(AuthenticationModuleConfig).database ?? context.resolve(DatabaseConfig, undefined, { skipSelf: true }) }),
|
|
634
634
|
],
|
|
635
635
|
})
|
|
636
636
|
], AuthenticationService);
|
|
@@ -3,7 +3,7 @@ import { provide } from '../../../injector/injector.js';
|
|
|
3
3
|
import { factoryProvider } from '../../../injector/provider.js';
|
|
4
4
|
import { DatabaseConfig } from '../../../orm/server/index.js';
|
|
5
5
|
import { DocumentManagementConfiguration } from '../module.js';
|
|
6
|
-
export const documentManagementDatabaseConfigFactoryProvider = factoryProvider((_, context) => context.resolve(DocumentManagementConfiguration).database ?? context.resolve(DatabaseConfig, undefined, { skipSelf:
|
|
6
|
+
export const documentManagementDatabaseConfigFactoryProvider = factoryProvider((_, context) => context.resolve(DocumentManagementConfiguration).database ?? context.resolve(DatabaseConfig, undefined, { skipSelf: true }));
|
|
7
7
|
export const documentManagementDatabaseConfigProvider = provide(DatabaseConfig, documentManagementDatabaseConfigFactoryProvider);
|
|
8
8
|
export function DocumentManagementSingleton() {
|
|
9
9
|
return Singleton({ providers: [documentManagementDatabaseConfigProvider] });
|
package/injector/injector.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export type Registration<T = any, A = any> = GlobalRegistration<T, A> & {
|
|
|
22
22
|
resolutions: Map<any, T>;
|
|
23
23
|
};
|
|
24
24
|
export type GetRegistrationOptions = {
|
|
25
|
-
skipSelf?: boolean
|
|
25
|
+
skipSelf?: boolean;
|
|
26
26
|
onlySelf?: boolean;
|
|
27
27
|
};
|
|
28
28
|
export type ResolveManyArrayItem<T, A> = [token: InjectionToken<T, A>, argument?: ResolveArgument<T, A>, options?: InjectOptions<T, A>];
|
package/injector/injector.js
CHANGED
|
@@ -145,9 +145,8 @@ export class Injector {
|
|
|
145
145
|
this.register(globalRegistration.token, globalRegistration.provider, globalRegistration.options);
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
return this.#parent?.tryGetRegistration(token, { ...options, skipSelf: skipLevels - 1 });
|
|
148
|
+
if (options?.skipSelf == true) {
|
|
149
|
+
return this.#parent?.tryGetRegistration(token, { ...options, skipSelf: false });
|
|
151
150
|
}
|
|
152
151
|
const ownRegistration = this.#registrations.get(token);
|
|
153
152
|
if (isDefined(ownRegistration)) {
|
|
@@ -271,6 +270,12 @@ export class Injector {
|
|
|
271
270
|
}
|
|
272
271
|
_resolve(token, argument, options, context, chain) {
|
|
273
272
|
this.assertNotDisposed();
|
|
273
|
+
if (options.skipSelf == true) {
|
|
274
|
+
if (isNull(this.#parent) && (options.optional != true)) {
|
|
275
|
+
throw new ResolveError(`No parent injector available.`, chain);
|
|
276
|
+
}
|
|
277
|
+
return this.#parent?._resolve(token, argument, { ...options, skipSelf: false }, context, chain);
|
|
278
|
+
}
|
|
274
279
|
if (isDefined(options.forwardRef) && (options.forwardRef != false)) {
|
|
275
280
|
assert(options.optional != true, 'ForwardRef does not support optional without resolveAll/injectAll as undefined is not forwardable.');
|
|
276
281
|
const forwardToken = isFunction(options.forwardRef) ? options.forwardRef() : token;
|
|
@@ -282,11 +287,14 @@ export class Injector {
|
|
|
282
287
|
if (isUndefined(token)) {
|
|
283
288
|
throw new ResolveError('Token is undefined. This might be due to a circular dependency. Consider using an alias or forwardRef.', chain);
|
|
284
289
|
}
|
|
285
|
-
const
|
|
286
|
-
if (isDefined(
|
|
287
|
-
const singleRegistration = isArray(
|
|
290
|
+
const ownRegistration = this.tryGetRegistration(token, { ...options, skipSelf: false, onlySelf: true });
|
|
291
|
+
if (isDefined(ownRegistration)) {
|
|
292
|
+
const singleRegistration = isArray(ownRegistration) ? ownRegistration[0] : ownRegistration;
|
|
288
293
|
return this._resolveRegistration(singleRegistration, argument, options, context, chain);
|
|
289
294
|
}
|
|
295
|
+
if ((options.onlySelf != true) && isNotNull(this.#parent)) {
|
|
296
|
+
return this.#parent._resolve(token, argument, { ...options, skipSelf: false }, context, chain);
|
|
297
|
+
}
|
|
290
298
|
if (options.optional == true) {
|
|
291
299
|
return undefined;
|
|
292
300
|
}
|
|
@@ -294,6 +302,12 @@ export class Injector {
|
|
|
294
302
|
}
|
|
295
303
|
_resolveAll(token, argument, options, context, chain) {
|
|
296
304
|
this.assertNotDisposed();
|
|
305
|
+
if (options.skipSelf == true) {
|
|
306
|
+
if (isNull(this.#parent) && (options.optional != true)) {
|
|
307
|
+
throw new ResolveError(`No parent injector available.`, chain);
|
|
308
|
+
}
|
|
309
|
+
return this.#parent?._resolveAll(token, argument, { ...options, skipSelf: false }, context, chain) ?? [];
|
|
310
|
+
}
|
|
297
311
|
if (isDefined(options.forwardRef) && (options.forwardRef != false)) {
|
|
298
312
|
const forwardToken = isFunction(options.forwardRef) ? options.forwardRef() : token;
|
|
299
313
|
const forwardRef = ForwardRef.create({ typeHint: options.forwardRefTypeHint ?? isFunction(forwardToken) ? forwardToken : undefined });
|
|
@@ -306,15 +320,13 @@ export class Injector {
|
|
|
306
320
|
}
|
|
307
321
|
const ownValues = [];
|
|
308
322
|
const parentValues = [];
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
ownValues.push(...resolved);
|
|
315
|
-
}
|
|
323
|
+
const ownRegistration = this.tryGetRegistration(token, { ...options, skipSelf: false, onlySelf: true });
|
|
324
|
+
if (isDefined(ownRegistration)) {
|
|
325
|
+
const registrations = isArray(ownRegistration) ? ownRegistration : [ownRegistration];
|
|
326
|
+
const resolved = registrations.map((reg) => this._resolveRegistration(reg, argument, options, context, chain));
|
|
327
|
+
ownValues.push(...resolved);
|
|
316
328
|
}
|
|
317
|
-
if (
|
|
329
|
+
if ((options.onlySelf != true) && isNotNull(this.#parent)) {
|
|
318
330
|
parentValues.push(...this.#parent._resolveAll(token, argument, { ...options, skipSelf: false }, context, chain));
|
|
319
331
|
}
|
|
320
332
|
const allValues = [...ownValues, ...parentValues];
|
package/injector/types.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ export type ArgumentProvider<T = unknown, D extends Record = Record> = (context:
|
|
|
26
26
|
export type ForwardRefInjectionToken<T = any, A = any> = Exclude<InjectionToken<T, A>, Function> | (() => InjectionToken<T, A>);
|
|
27
27
|
export type ResolveOptions<T, A> = {
|
|
28
28
|
optional?: boolean;
|
|
29
|
-
skipSelf?: boolean
|
|
29
|
+
skipSelf?: boolean;
|
|
30
30
|
onlySelf?: boolean;
|
|
31
31
|
/** If defined, resolve the token using ForwardRef strategy instead of resolving the token directly can be used to circumvent circular dependency problems */
|
|
32
32
|
forwardRef?: boolean | ForwardRefInjectionToken<T, A>;
|
|
@@ -57,7 +57,7 @@ PostgresKeyValueStore = __decorate([
|
|
|
57
57
|
Singleton({
|
|
58
58
|
providers: [
|
|
59
59
|
provide(EntityRepositoryConfig, { useValue: { schema: 'key_value_store' } }),
|
|
60
|
-
{ provide: DatabaseConfig, useFactory: (_, context) => context.resolve(PostgresKeyValueStoreModuleConfig).database ?? context.resolve(DatabaseConfig, undefined, { skipSelf:
|
|
60
|
+
{ provide: DatabaseConfig, useFactory: (_, context) => context.resolve(PostgresKeyValueStoreModuleConfig).database ?? context.resolve(DatabaseConfig, undefined, { skipSelf: true }) },
|
|
61
61
|
],
|
|
62
62
|
})
|
|
63
63
|
], PostgresKeyValueStore);
|
|
@@ -21,7 +21,7 @@ PostgresLockProvider = __decorate([
|
|
|
21
21
|
Singleton({
|
|
22
22
|
providers: [
|
|
23
23
|
provide(EntityRepositoryConfig, { useValue: { schema: 'lock' } }),
|
|
24
|
-
{ provide: DatabaseConfig, useFactory: (_, context) => context.resolve(PostgresLockModuleConfig).database ?? context.resolve(DatabaseConfig, undefined, { skipSelf:
|
|
24
|
+
{ provide: DatabaseConfig, useFactory: (_, context) => context.resolve(PostgresLockModuleConfig).database ?? context.resolve(DatabaseConfig, undefined, { skipSelf: true }) },
|
|
25
25
|
],
|
|
26
26
|
})
|
|
27
27
|
], PostgresLockProvider);
|
package/mail/mail.service.js
CHANGED
|
@@ -60,7 +60,7 @@ MailService = __decorate([
|
|
|
60
60
|
Singleton({
|
|
61
61
|
providers: [
|
|
62
62
|
provide(EntityRepositoryConfig, { useValue: { schema: 'mail' } }),
|
|
63
|
-
provide(DatabaseConfig, { useFactory: (_, context) => context.resolve(MailModuleConfig).database ?? context.resolve(DatabaseConfig, undefined, { skipSelf:
|
|
63
|
+
provide(DatabaseConfig, { useFactory: (_, context) => context.resolve(MailModuleConfig).database ?? context.resolve(DatabaseConfig, undefined, { skipSelf: true }) }),
|
|
64
64
|
],
|
|
65
65
|
})
|
|
66
66
|
], MailService);
|
package/package.json
CHANGED
package/queue/postgres/queue.js
CHANGED
|
@@ -157,7 +157,7 @@ PostgresQueue = __decorate([
|
|
|
157
157
|
argumentIdentityProvider: JSON.stringify,
|
|
158
158
|
providers: [
|
|
159
159
|
provide(EntityRepositoryConfig, { useValue: { schema: 'queue' } }),
|
|
160
|
-
provide(DatabaseConfig, { useFactory: (_, context) => context.resolve(PostgresQueueModuleConfig).database ?? context.resolve(DatabaseConfig, undefined, { skipSelf:
|
|
160
|
+
provide(DatabaseConfig, { useFactory: (_, context) => context.resolve(PostgresQueueModuleConfig).database ?? context.resolve(DatabaseConfig, undefined, { skipSelf: true }) }),
|
|
161
161
|
],
|
|
162
162
|
})
|
|
163
163
|
], PostgresQueue);
|