@tstdl/base 0.93.21 → 0.93.23

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 (61) hide show
  1. package/application/application.js +3 -3
  2. package/authentication/server/module.d.ts +1 -1
  3. package/authentication/server/module.js +1 -6
  4. package/document-management/api/document-management.api.d.ts +0 -4
  5. package/document-management/service-models/document.service-model.d.ts +0 -2
  6. package/injector/injector.js +22 -22
  7. package/injector/resolve-chain.d.ts +7 -5
  8. package/injector/resolve-chain.js +16 -14
  9. package/logger/manager.js +3 -3
  10. package/orm/data-types/bytea.d.ts +4 -14
  11. package/orm/data-types/bytea.js +2 -2
  12. package/orm/data-types/common.d.ts +18 -0
  13. package/orm/data-types/common.js +11 -0
  14. package/orm/data-types/index.d.ts +1 -0
  15. package/orm/data-types/index.js +1 -0
  16. package/orm/data-types/numeric-date.d.ts +4 -15
  17. package/orm/data-types/numeric-date.js +2 -2
  18. package/orm/data-types/timestamp.d.ts +4 -15
  19. package/orm/data-types/timestamp.js +2 -2
  20. package/orm/data-types/tsvector.d.ts +3 -13
  21. package/orm/data-types/tsvector.js +2 -2
  22. package/orm/decorators.d.ts +16 -54
  23. package/orm/decorators.js +24 -37
  24. package/orm/entity.d.ts +6 -9
  25. package/orm/entity.js +1 -2
  26. package/orm/query.d.ts +199 -61
  27. package/orm/query.js +2 -2
  28. package/orm/repository.types.d.ts +38 -9
  29. package/orm/server/drizzle/schema-converter.js +40 -118
  30. package/orm/server/query-converter.d.ts +21 -7
  31. package/orm/server/query-converter.js +194 -38
  32. package/orm/server/repository.d.ts +39 -22
  33. package/orm/server/repository.js +141 -71
  34. package/orm/server/types.d.ts +10 -2
  35. package/orm/sqls.d.ts +14 -16
  36. package/orm/sqls.js +34 -17
  37. package/package.json +2 -2
  38. package/test/drizzle/0000_nervous_iron_monger.sql +9 -0
  39. package/test/drizzle/meta/0000_snapshot.json +27 -7
  40. package/test/drizzle/meta/_journal.json +2 -44
  41. package/test/test.model.js +2 -6
  42. package/test1.js +18 -5
  43. package/test6.js +23 -35
  44. package/types/types.d.ts +8 -5
  45. package/utils/equals.js +2 -2
  46. package/utils/format-error.js +2 -2
  47. package/utils/helpers.js +3 -2
  48. package/utils/object/object.d.ts +4 -4
  49. package/test/drizzle/0000_sudden_sphinx.sql +0 -9
  50. package/test/drizzle/0001_organic_rhodey.sql +0 -2
  51. package/test/drizzle/0002_nice_squadron_supreme.sql +0 -1
  52. package/test/drizzle/0003_serious_mockingbird.sql +0 -1
  53. package/test/drizzle/0004_complete_pixie.sql +0 -1
  54. package/test/drizzle/0005_bumpy_sabra.sql +0 -1
  55. package/test/drizzle/0006_overrated_post.sql +0 -6
  56. package/test/drizzle/meta/0001_snapshot.json +0 -79
  57. package/test/drizzle/meta/0002_snapshot.json +0 -63
  58. package/test/drizzle/meta/0003_snapshot.json +0 -73
  59. package/test/drizzle/meta/0004_snapshot.json +0 -89
  60. package/test/drizzle/meta/0005_snapshot.json +0 -104
  61. package/test/drizzle/meta/0006_snapshot.json +0 -104
@@ -29,7 +29,7 @@ let Application = Application_1 = class Application {
29
29
  #shutdownPromise = new DeferredPromise();
30
30
  #shutdownToken = inject(CancellationSignal, undefined, { optional: true })?.createChild() ?? new CancellationToken();
31
31
  static create(name, providers = []) {
32
- const injector = new Injector(`${name}Injector`);
32
+ const injector = new Injector(`${name}ApplicationInjector`);
33
33
  injector.register(APPLICATION_INSTANCE_ID, { useValue: crypto.randomUUID() });
34
34
  injector.register(APPLICATION_NAME, { useValue: name });
35
35
  for (const providersItem of providers.flat()) {
@@ -110,7 +110,7 @@ let Application = Application_1 = class Application {
110
110
  async runModules(modules) {
111
111
  const promises = modules.map(async (module) => {
112
112
  try {
113
- this.#logger.info(`Starting module ${module.name}`);
113
+ this.#logger.info(`Starting module ${module.name}.`);
114
114
  await runInInjectionContext(this.#injector, async () => await module.run());
115
115
  this.#logger.info(`Module ${module.name} stopped.`);
116
116
  }
@@ -126,7 +126,7 @@ let Application = Application_1 = class Application {
126
126
  if (module.state == ModuleState.Stopped) {
127
127
  return;
128
128
  }
129
- this.#logger.info(`Stopping module ${module.name}`);
129
+ this.#logger.info(`Stopping module ${module.name}.`);
130
130
  try {
131
131
  await module.stop();
132
132
  }
@@ -15,7 +15,7 @@ export declare class AuthenticationModuleConfig {
15
15
  /**
16
16
  * Options for {@link AuthenticationService}.
17
17
  */
18
- serviceOptions?: AuthenticationServiceOptions | Provider<AuthenticationServiceOptions>;
18
+ serviceOptions: AuthenticationServiceOptions | Provider<AuthenticationServiceOptions>;
19
19
  /**
20
20
  * Override default {@link AuthenticationService}.
21
21
  */
@@ -33,12 +33,7 @@ export class AuthenticationModuleConfig {
33
33
  */
34
34
  export function configureAuthenticationServer(config) {
35
35
  Injector.register(AuthenticationModuleConfig, { useValue: config });
36
- if (isDefined(config.serviceOptions)) {
37
- Injector.register(AuthenticationServiceOptions, isProvider(config.serviceOptions) ? config.serviceOptions : { useValue: config.serviceOptions });
38
- }
39
- else {
40
- throw new Error('Either serviceOptions or serviceOptionsToken must be provided.');
41
- }
36
+ Injector.register(AuthenticationServiceOptions, isProvider(config.serviceOptions) ? config.serviceOptions : { useValue: config.serviceOptions });
42
37
  if (isDefined(config.authenticationService)) {
43
38
  Injector.registerSingleton(AuthenticationService, { useToken: config.authenticationService });
44
39
  }
@@ -179,7 +179,6 @@ export declare const documentManagementApiDefinition: {
179
179
  parameters: import("../../schema/index.js").ObjectSchema<{
180
180
  id: import("../../orm/types.js").IsPrimaryKey<import("../../orm/types.js").HasDefault<import("../../orm/types.js").Uuid>>;
181
181
  description?: string | null | undefined;
182
- readonly __entityMeta__?: import("../../orm/entity.js").EntityMeta | undefined;
183
182
  tenantId?: string | null | undefined;
184
183
  label?: string | undefined;
185
184
  metadata?: Partial<{
@@ -233,7 +232,6 @@ export declare const documentManagementApiDefinition: {
233
232
  method: "PATCH";
234
233
  parameters: import("../../schema/index.js").ObjectSchema<{
235
234
  id: import("../../orm/types.js").IsPrimaryKey<import("../../orm/types.js").HasDefault<import("../../orm/types.js").Uuid>>;
236
- readonly __entityMeta__?: import("../../orm/entity.js").EntityMeta | undefined;
237
235
  tenantId?: string | null | undefined;
238
236
  typeId?: import("../../orm/types.js").Uuid | undefined;
239
237
  comment?: string | null | undefined;
@@ -581,7 +579,6 @@ declare const _DocumentManagementApi: import("../../api/client/index.js").ApiCli
581
579
  parameters: import("../../schema/index.js").ObjectSchema<{
582
580
  id: import("../../orm/types.js").IsPrimaryKey<import("../../orm/types.js").HasDefault<import("../../orm/types.js").Uuid>>;
583
581
  description?: string | null | undefined;
584
- readonly __entityMeta__?: import("../../orm/entity.js").EntityMeta | undefined;
585
582
  tenantId?: string | null | undefined;
586
583
  label?: string | undefined;
587
584
  metadata?: Partial<{
@@ -635,7 +632,6 @@ declare const _DocumentManagementApi: import("../../api/client/index.js").ApiCli
635
632
  method: "PATCH";
636
633
  parameters: import("../../schema/index.js").ObjectSchema<{
637
634
  id: import("../../orm/types.js").IsPrimaryKey<import("../../orm/types.js").HasDefault<import("../../orm/types.js").Uuid>>;
638
- readonly __entityMeta__?: import("../../orm/entity.js").EntityMeta | undefined;
639
635
  tenantId?: string | null | undefined;
640
636
  typeId?: import("../../orm/types.js").Uuid | undefined;
641
637
  comment?: string | null | undefined;
@@ -97,7 +97,6 @@ export declare const createDocumentRequestsTemplateParametersSchema: import("../
97
97
  export declare const updateDocumentRequestsTemplateParametersSchema: import("../../schema/index.js").ObjectSchema<{
98
98
  id: import("../../orm/index.js").IsPrimaryKey<import("../../orm/index.js").HasDefault<import("../../orm/index.js").Uuid>>;
99
99
  description?: string | null | undefined;
100
- readonly __entityMeta__?: import("../../orm/index.js").EntityMeta | undefined;
101
100
  tenantId?: string | null | undefined;
102
101
  label?: string | undefined;
103
102
  metadata?: Partial<{
@@ -127,7 +126,6 @@ export declare const createDocumentRequestTemplateParametersSchema: import("../.
127
126
  }>;
128
127
  export declare const updateDocumentRequestTemplateParametersSchema: import("../../schema/index.js").ObjectSchema<{
129
128
  id: import("../../orm/index.js").IsPrimaryKey<import("../../orm/index.js").HasDefault<import("../../orm/index.js").Uuid>>;
130
- readonly __entityMeta__?: import("../../orm/index.js").EntityMeta | undefined;
131
129
  tenantId?: string | null | undefined;
132
130
  typeId?: import("../../orm/index.js").Uuid | undefined;
133
131
  comment?: string | null | undefined;
@@ -171,7 +171,7 @@ export class Injector {
171
171
  }
172
172
  resolve(token, argument, options = {}) {
173
173
  const context = newInternalResolveContext();
174
- const value = this._resolve(token, argument, options, context, ResolveChain.startWith(token));
174
+ const value = this._resolve(token, argument, options, context, ResolveChain.startWith(this, token));
175
175
  try {
176
176
  postProcess(context);
177
177
  context.$done.resolve();
@@ -187,7 +187,7 @@ export class Injector {
187
187
  }
188
188
  resolveAll(token, argument, options = {}) {
189
189
  const context = newInternalResolveContext();
190
- const values = this._resolveAll(token, argument, options, context, ResolveChain.startWith(token));
190
+ const values = this._resolveAll(token, argument, options, context, ResolveChain.startWith(this, token));
191
191
  try {
192
192
  postProcess(context);
193
193
  context.$done.resolve();
@@ -218,7 +218,7 @@ export class Injector {
218
218
  }
219
219
  async resolveAsync(token, argument, options = {}) {
220
220
  const context = newInternalResolveContext();
221
- const value = this._resolve(token, argument, options, context, ResolveChain.startWith(token));
221
+ const value = this._resolve(token, argument, options, context, ResolveChain.startWith(this, token));
222
222
  try {
223
223
  await postProcessAsync(context);
224
224
  context.$done.resolve();
@@ -234,7 +234,7 @@ export class Injector {
234
234
  }
235
235
  async resolveAllAsync(token, argument, options = {}) {
236
236
  const context = newInternalResolveContext();
237
- const values = this._resolveAll(token, argument, options, context, ResolveChain.startWith(token));
237
+ const values = this._resolveAll(token, argument, options, context, ResolveChain.startWith(this, token));
238
238
  try {
239
239
  await postProcessAsync(context);
240
240
  context.$done.resolve();
@@ -265,8 +265,8 @@ export class Injector {
265
265
  }
266
266
  _resolveManyTokens(tokens, context) {
267
267
  return tokens.map((token) => (isArray(token)
268
- ? this._resolve(token[0], token[1], token[2] ?? {}, context, ResolveChain.startWith(token[0]))
269
- : this._resolve(token, undefined, {}, context, ResolveChain.startWith(token))));
268
+ ? this._resolve(token[0], token[1], token[2] ?? {}, context, ResolveChain.startWith(this, token[0]))
269
+ : this._resolve(token, undefined, {}, context, ResolveChain.startWith(this, token))));
270
270
  }
271
271
  _resolve(token, argument, options, context, chain) {
272
272
  this.assertNotDisposed();
@@ -287,13 +287,13 @@ export class Injector {
287
287
  if (isUndefined(token)) {
288
288
  throw new ResolveError('Token is undefined. This might be due to a circular dependency. Consider using an alias or forwardRef.', chain);
289
289
  }
290
- const ownRegistration = this.tryGetRegistration(token, { ...options, skipSelf: false, onlySelf: true });
291
- if (isDefined(ownRegistration)) {
292
- const singleRegistration = isArray(ownRegistration) ? ownRegistration[0] : ownRegistration;
290
+ const registration = this.tryGetRegistration(token, options);
291
+ if (isDefined(registration)) {
292
+ const singleRegistration = isArray(registration) ? registration[0] : registration;
293
293
  return this._resolveRegistration(singleRegistration, argument, options, context, chain);
294
294
  }
295
295
  if ((options.onlySelf != true) && isNotNull(this.#parent)) {
296
- return this.#parent._resolve(token, argument, { ...options, skipSelf: false }, context, chain);
296
+ return this.#parent._resolve(token, argument, options, context, chain);
297
297
  }
298
298
  if (options.optional == true) {
299
299
  return undefined;
@@ -320,14 +320,14 @@ export class Injector {
320
320
  }
321
321
  const ownValues = [];
322
322
  const parentValues = [];
323
- const ownRegistration = this.tryGetRegistration(token, { ...options, skipSelf: false, onlySelf: true });
324
- if (isDefined(ownRegistration)) {
325
- const registrations = isArray(ownRegistration) ? ownRegistration : [ownRegistration];
323
+ const registration = this.tryGetRegistration(token, options);
324
+ if (isDefined(registration)) {
325
+ const registrations = isArray(registration) ? registration : [registration];
326
326
  const resolved = registrations.map((reg) => this._resolveRegistration(reg, argument, options, context, chain));
327
327
  ownValues.push(...resolved);
328
328
  }
329
329
  if ((options.onlySelf != true) && isNotNull(this.#parent)) {
330
- parentValues.push(...this.#parent._resolveAll(token, argument, { ...options, skipSelf: false }, context, chain));
330
+ parentValues.push(...this.#parent._resolveAll(token, argument, options, context, chain));
331
331
  }
332
332
  const allValues = [...ownValues, ...parentValues];
333
333
  if ((allValues.length == 0) && (options.optional != true)) {
@@ -358,7 +358,7 @@ export class Injector {
358
358
  }
359
359
  // A new scope is only needed if we are instantiating a class, running a factory, or if the registration explicitly defines scoped providers.
360
360
  const needsNewScope = isClassProvider(provider) || isFactoryProvider(provider) || (providers.length > 0);
361
- const injector = needsNewScope ? this.fork('ResolutionInjector') : this;
361
+ const injector = needsNewScope ? this.fork(`[${getTokenName(token)}]ResolutionInjector`) : this;
362
362
  for (const nestedProvider of providers) {
363
363
  injector.registerSingleton(nestedProvider.provide, nestedProvider, { multi: nestedProvider.multi });
364
364
  }
@@ -416,9 +416,9 @@ export class Injector {
416
416
  const arg = resolveArgument ?? provider.defaultArgument ?? provider.defaultArgumentProvider?.();
417
417
  injectionContext.argument = arg;
418
418
  if (provider.resolveAll == true) {
419
- return this._resolveAll(innerToken, arg, options, context, chain.addToken(innerToken));
419
+ return this._resolveAll(innerToken, arg, options, context, chain.addToken(this, innerToken));
420
420
  }
421
- result = { value: this._resolve(innerToken, arg, options, context, chain.addToken(innerToken)) };
421
+ result = { value: this._resolve(innerToken, arg, options, context, chain.addToken(this, innerToken)) };
422
422
  }
423
423
  else if (isFactoryProvider(provider)) {
424
424
  const arg = resolveArgument ?? provider.defaultArgument ?? provider.defaultArgumentProvider?.();
@@ -440,7 +440,7 @@ export class Injector {
440
440
  }
441
441
  }
442
442
  resolveClassInjection(resolutionTag, context, constructor, metadata, resolveArgument, chain) {
443
- const getChain = (injectToken) => chain.addParameter(constructor, metadata.index, injectToken);
443
+ const getChain = (injectToken) => chain.addParameter(this, constructor, metadata.index, injectToken);
444
444
  const injectMetadata = metadata.data.tryGet(injectMetadataSymbol) ?? {};
445
445
  const injectToken = (injectMetadata.injectToken ?? metadata.type);
446
446
  if (isDefined(injectMetadata.injectArgumentMapper) && (!this.hasRegistration(injectToken) || isDefined(resolveArgument) || isUndefined(injectToken))) {
@@ -460,7 +460,7 @@ export class Injector {
460
460
  return resolved;
461
461
  }
462
462
  resolveInjection(token, argument, options, context, injectIndex, chain) {
463
- return this._resolve(token, argument, options, context, chain.addInject(token, injectIndex));
463
+ return this._resolve(token, argument, options, context, chain.addInject(this, token, injectIndex));
464
464
  }
465
465
  async resolveInjectionAsync(token, argument, options, context, injectIndex, chain) {
466
466
  const value = this.resolveInjection(token, argument, options, context, injectIndex, chain);
@@ -468,7 +468,7 @@ export class Injector {
468
468
  return value;
469
469
  }
470
470
  resolveInjectionAll(token, argument, options, context, injectIndex, chain) {
471
- return this._resolveAll(token, argument, options, context, chain.addInject(token, injectIndex));
471
+ return this._resolveAll(token, argument, options, context, chain.addInject(this, token, injectIndex));
472
472
  }
473
473
  async resolveInjectionAllAsync(token, argument, options, context, injectIndex, chain) {
474
474
  const values = this.resolveInjectionAll(token, argument, options, context, injectIndex, chain);
@@ -477,8 +477,8 @@ export class Injector {
477
477
  }
478
478
  getResolveContext(resolutionTag, resolveContext, chain) {
479
479
  return {
480
- resolve: (token, argument, options) => this._resolve(token, argument, options ?? {}, resolveContext, chain.addToken(token)),
481
- resolveAll: (token, argument, options) => this._resolveAll(token, argument, options ?? {}, resolveContext, chain.addToken(token)),
480
+ resolve: (token, argument, options) => this._resolve(token, argument, options ?? {}, resolveContext, chain.addToken(this, token)),
481
+ resolveAll: (token, argument, options) => this._resolveAll(token, argument, options ?? {}, resolveContext, chain.addToken(this, token)),
482
482
  cancellationSignal: this.#disposeToken,
483
483
  addDisposeHandler: this.#addDisposeHandler,
484
484
  get data() {
@@ -1,6 +1,8 @@
1
1
  import type { AbstractConstructor } from '../types/index.js';
2
+ import type { Injector } from './injector.js';
2
3
  import type { InjectionToken } from './token.js';
3
4
  export type ResolveChainNodeBase<Type extends string> = {
5
+ injector: Injector;
4
6
  type: Type;
5
7
  forwardRef?: true;
6
8
  };
@@ -23,11 +25,11 @@ export declare class ResolveChain {
23
25
  get length(): number;
24
26
  /** @deprecated for internal use only */
25
27
  constructor(nodes: ResolveChainNode[]);
26
- static startWith(token: InjectionToken): ResolveChain;
27
- addToken(token: InjectionToken): ResolveChain;
28
- addInject(token: InjectionToken, index: number): ResolveChain;
29
- addParameter(constructor: AbstractConstructor, index: number, token: InjectionToken): ResolveChain;
30
- addProperty(constructor: AbstractConstructor, property: PropertyKey, token: InjectionToken): ResolveChain;
28
+ static startWith(injector: Injector, token: InjectionToken): ResolveChain;
29
+ addToken(injector: Injector, token: InjectionToken): ResolveChain;
30
+ addInject(injector: Injector, token: InjectionToken, index: number): ResolveChain;
31
+ addParameter(injector: Injector, constructor: AbstractConstructor, index: number, token: InjectionToken): ResolveChain;
32
+ addProperty(injector: Injector, constructor: AbstractConstructor, property: PropertyKey, token: InjectionToken): ResolveChain;
31
33
  markAsForwardRef(forwardToken: InjectionToken): ResolveChain;
32
34
  format(truncate?: number): string;
33
35
  truncate(tokenCount: number): ResolveChain;
@@ -10,24 +10,24 @@ export class ResolveChain {
10
10
  constructor(nodes) {
11
11
  this.nodes = nodes;
12
12
  }
13
- static startWith(token) {
13
+ static startWith(injector, token) {
14
14
  const chain = new ResolveChain([]);
15
- return chain.addToken(token);
15
+ return chain.addToken(injector, token);
16
16
  }
17
- addToken(token) {
18
- const node = { type: 'token', token };
17
+ addToken(injector, token) {
18
+ const node = { injector, type: 'token', token };
19
19
  return new ResolveChain([...this.nodes, node]);
20
20
  }
21
- addInject(token, index) {
22
- const node = { type: 'inject', token, index };
21
+ addInject(injector, token, index) {
22
+ const node = { injector, type: 'inject', token, index };
23
23
  return new ResolveChain([...this.nodes, node]);
24
24
  }
25
- addParameter(constructor, index, token) {
26
- const node = { type: 'parameter', constructor, index, token };
25
+ addParameter(injector, constructor, index, token) {
26
+ const node = { injector, type: 'parameter', constructor, index, token };
27
27
  return new ResolveChain([...this.nodes, node]);
28
28
  }
29
- addProperty(constructor, property, token) {
30
- const node = { type: 'property', constructor, property, token };
29
+ addProperty(injector, constructor, property, token) {
30
+ const node = { injector, type: 'property', constructor, property, token };
31
31
  return new ResolveChain([...this.nodes, node]);
32
32
  }
33
33
  markAsForwardRef(forwardToken) {
@@ -41,16 +41,18 @@ export class ResolveChain {
41
41
  if (chain.length < this.length) {
42
42
  chainString += '\n [...]';
43
43
  }
44
+ const longestInjectorName = Math.max(...chain.nodes.map((node) => node.injector.name.length));
44
45
  for (const node of chain.nodes) {
46
+ const paddedInjectorName = node.injector.name.padStart(longestInjectorName);
45
47
  const tokenName = getTokenName(node.token);
46
48
  const forwardRefPrefix = node.forwardRef ? 'ForwardRef::' : '';
47
49
  switch (node.type) {
48
50
  case 'token':
49
- chainString += `\n -> ${forwardRefPrefix}${tokenName}`;
51
+ chainString += `\n ${paddedInjectorName} -> ${forwardRefPrefix}${tokenName}`;
50
52
  break;
51
53
  case 'inject':
52
54
  chainString += ` => inject(${forwardRefPrefix}${tokenName}) [${node.index + 1}]`;
53
- chainString += `\n -> ${tokenName}`;
55
+ chainString += `\n ${paddedInjectorName} -> ${tokenName}`;
54
56
  break;
55
57
  case 'parameter':
56
58
  const metadata = reflectionRegistry.getMetadata(node.constructor);
@@ -58,12 +60,12 @@ export class ResolveChain {
58
60
  const suffix = ', _'.repeat(assertDefinedPass(metadata?.parameters, `missing parameters metadata for ${node.constructor.name}`).length - node.index - 1);
59
61
  chainString += `(${prefix}${forwardRefPrefix}${tokenName}${suffix})`;
60
62
  // chainString += `\n ${' '.repeat(1 + node.constructor.name.length + forwardRefPrefix.length + prefix.length + (tokenName.length / 2))}↓`;
61
- chainString += `\n -> ${tokenName}`;
63
+ chainString += `\n ${paddedInjectorName} -> ${tokenName}`;
62
64
  break;
63
65
  case 'property':
64
66
  const constructorName = getTokenName(node.constructor);
65
67
  const key = getPropertyKeyString(node.property);
66
- chainString += `\n -> ${constructorName}[${key}]: ${forwardRefPrefix}${tokenName}`;
68
+ chainString += `\n ${paddedInjectorName} -> ${constructorName}[${key}]: ${forwardRefPrefix}${tokenName}`;
67
69
  break;
68
70
  default:
69
71
  throw new Error(`unknown chain node type ${node.type}`);
package/logger/manager.js CHANGED
@@ -6,7 +6,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
6
6
  };
7
7
  import { Singleton } from '../injector/decorators.js';
8
8
  import { inject, injectAll } from '../injector/inject.js';
9
- import { isDefined } from '../utils/type-guards.js';
9
+ import { isArray, isDefined } from '../utils/type-guards.js';
10
10
  import { LogLevel } from './level.js';
11
11
  import { DEFAULT_LOG_LEVEL } from './tokens.js';
12
12
  import { LogTransport } from './transport.js';
@@ -41,7 +41,7 @@ let LogManager = class LogManager {
41
41
  * @param level The log level to set
42
42
  */
43
43
  setModuleLevel(module, level) {
44
- const moduleString = Array.isArray(module) ? module.join('.') : module;
44
+ const moduleString = isArray(module) ? module.join('.') : module;
45
45
  if (this.#moduleLevelRules.get(moduleString) === level) {
46
46
  return;
47
47
  }
@@ -58,7 +58,7 @@ let LogManager = class LogManager {
58
58
  if (!isDefined(module) || (module.length == 0)) {
59
59
  return this.#defaultLevel;
60
60
  }
61
- const path = Array.isArray(module) ? module.join('.') : module;
61
+ const path = isArray(module) ? module.join('.') : module;
62
62
  const cachedLevel = this.#moduleLevelCache.get(path);
63
63
  if (isDefined(cachedLevel)) {
64
64
  return cachedLevel;
@@ -1,18 +1,8 @@
1
- /**
2
- * @module
3
- * Defines a custom Drizzle type for handling PostgreSQL `bytea` columns.
4
- */
5
- import { type ConvertCustomConfig, type PgCustomColumnBuilder } from 'drizzle-orm/pg-core';
6
- type Config = {
7
- data: Uint8Array;
8
- driverData: Uint8Array;
9
- };
10
1
  /**
11
2
  * Custom Drizzle type for PostgreSQL `bytea` columns.
12
3
  * Maps between `Uint8Array` in JavaScript and `bytea` in the database.
13
4
  */
14
- export declare const bytea: {
15
- (): PgCustomColumnBuilder<ConvertCustomConfig<"", Config>>;
16
- <TName extends string>(dbName: TName): PgCustomColumnBuilder<ConvertCustomConfig<TName, Config>>;
17
- };
18
- export {};
5
+ export declare const bytea: import("./common.js").CustomTypeBuilder<{
6
+ data: Uint8Array;
7
+ driverData: Uint8Array;
8
+ }>;
@@ -2,12 +2,12 @@
2
2
  * @module
3
3
  * Defines a custom Drizzle type for handling PostgreSQL `bytea` columns.
4
4
  */
5
- import { customType } from 'drizzle-orm/pg-core';
5
+ import { createCustomType } from './common.js';
6
6
  /**
7
7
  * Custom Drizzle type for PostgreSQL `bytea` columns.
8
8
  * Maps between `Uint8Array` in JavaScript and `bytea` in the database.
9
9
  */
10
- export const bytea = customType({
10
+ export const bytea = createCustomType({
11
11
  dataType() {
12
12
  return 'bytea';
13
13
  },
@@ -0,0 +1,18 @@
1
+ import { type ConvertCustomConfig, type CustomTypeParams, type CustomTypeValues, type PgCustomColumnBuilder } from 'drizzle-orm/pg-core';
2
+ /**
3
+ * A generic type for a custom Drizzle column builder function.
4
+ * This provides the overloads for creating a column with or without a specific database name.
5
+ * @template TConfig The configuration object for the custom type, containing `data` and `driverData` types.
6
+ */
7
+ export type CustomTypeBuilder<TConfig extends Partial<CustomTypeValues>> = {
8
+ (): PgCustomColumnBuilder<ConvertCustomConfig<'', TConfig>>;
9
+ <TName extends string>(dbName: TName): PgCustomColumnBuilder<ConvertCustomConfig<TName, TConfig>>;
10
+ };
11
+ /**
12
+ * Factory function to create a custom Drizzle type with the standard builder overloads.
13
+ * This reduces boilerplate by wrapping `drizzle-orm/pg-core#customType` and applying a common type cast.
14
+ * @template TConfig The configuration object for the custom type.
15
+ * @param params The parameters for the custom type, including `dataType`, `toDriver`, and `fromDriver`.
16
+ * @returns A custom type builder function.
17
+ */
18
+ export declare function createCustomType<TConfig extends CustomTypeValues>(params: CustomTypeParams<TConfig>): CustomTypeBuilder<TConfig>;
@@ -0,0 +1,11 @@
1
+ import { customType, } from 'drizzle-orm/pg-core';
2
+ /**
3
+ * Factory function to create a custom Drizzle type with the standard builder overloads.
4
+ * This reduces boilerplate by wrapping `drizzle-orm/pg-core#customType` and applying a common type cast.
5
+ * @template TConfig The configuration object for the custom type.
6
+ * @param params The parameters for the custom type, including `dataType`, `toDriver`, and `fromDriver`.
7
+ * @returns A custom type builder function.
8
+ */
9
+ export function createCustomType(params) {
10
+ return customType(params);
11
+ }
@@ -3,6 +3,7 @@
3
3
  * Exports custom Drizzle data types for PostgreSQL.
4
4
  */
5
5
  export * from './bytea.js';
6
+ export * from './common.js';
6
7
  export * from './numeric-date.js';
7
8
  export * from './timestamp.js';
8
9
  export * from './tsvector.js';
@@ -3,6 +3,7 @@
3
3
  * Exports custom Drizzle data types for PostgreSQL.
4
4
  */
5
5
  export * from './bytea.js';
6
+ export * from './common.js';
6
7
  export * from './numeric-date.js';
7
8
  export * from './timestamp.js';
8
9
  export * from './tsvector.js';
@@ -1,19 +1,8 @@
1
- /**
2
- * @module
3
- * Defines a custom Drizzle type for handling PostgreSQL `date` columns
4
- * using numeric representation (YYYYMMDD).
5
- */
6
- import { type ConvertCustomConfig, type PgCustomColumnBuilder } from 'drizzle-orm/pg-core';
7
- type Config = {
8
- data: number;
9
- driverData: string;
10
- };
11
1
  /**
12
2
  * Custom Drizzle type for PostgreSQL `date` columns, storing dates as numeric values (YYYYMMDD).
13
3
  * Converts between JavaScript `number` (YYYYMMDD) and database `date` (ISO string).
14
4
  */
15
- export declare const numericDate: {
16
- (): PgCustomColumnBuilder<ConvertCustomConfig<"", Config>>;
17
- <TName extends string>(dbName: TName): PgCustomColumnBuilder<ConvertCustomConfig<TName, Config>>;
18
- };
19
- export {};
5
+ export declare const numericDate: import("./common.js").CustomTypeBuilder<{
6
+ data: number;
7
+ driverData: string;
8
+ }>;
@@ -3,13 +3,13 @@
3
3
  * Defines a custom Drizzle type for handling PostgreSQL `date` columns
4
4
  * using numeric representation (YYYYMMDD).
5
5
  */
6
- import { customType } from 'drizzle-orm/pg-core';
7
6
  import { dateToNumericDate, numericDateToDateObject } from '../../utils/date-time.js';
7
+ import { createCustomType } from './common.js';
8
8
  /**
9
9
  * Custom Drizzle type for PostgreSQL `date` columns, storing dates as numeric values (YYYYMMDD).
10
10
  * Converts between JavaScript `number` (YYYYMMDD) and database `date` (ISO string).
11
11
  */
12
- export const numericDate = customType({
12
+ export const numericDate = createCustomType({
13
13
  dataType() {
14
14
  return 'date';
15
15
  },
@@ -1,19 +1,8 @@
1
- /**
2
- * @module
3
- * Defines a custom Drizzle type for handling PostgreSQL `timestamp with time zone` columns
4
- * using numeric representation (Unix timestamp in milliseconds).
5
- */
6
- import { type ConvertCustomConfig, type PgCustomColumnBuilder } from 'drizzle-orm/pg-core';
7
- type Config = {
8
- data: number;
9
- driverData: string;
10
- };
11
1
  /**
12
2
  * Custom Drizzle type for PostgreSQL `timestamp with time zone` columns, storing timestamps as numeric values (Unix timestamp in milliseconds).
13
3
  * Converts between JavaScript `number` (milliseconds since epoch) and database `timestamp with time zone` (ISO string).
14
4
  */
15
- export declare const timestamp: {
16
- (): PgCustomColumnBuilder<ConvertCustomConfig<"", Config>>;
17
- <TName extends string>(dbName: TName): PgCustomColumnBuilder<ConvertCustomConfig<TName, Config>>;
18
- };
19
- export {};
5
+ export declare const timestamp: import("./common.js").CustomTypeBuilder<{
6
+ data: number;
7
+ driverData: string;
8
+ }>;
@@ -3,12 +3,12 @@
3
3
  * Defines a custom Drizzle type for handling PostgreSQL `timestamp with time zone` columns
4
4
  * using numeric representation (Unix timestamp in milliseconds).
5
5
  */
6
- import { customType } from 'drizzle-orm/pg-core';
6
+ import { createCustomType } from './common.js';
7
7
  /**
8
8
  * Custom Drizzle type for PostgreSQL `timestamp with time zone` columns, storing timestamps as numeric values (Unix timestamp in milliseconds).
9
9
  * Converts between JavaScript `number` (milliseconds since epoch) and database `timestamp with time zone` (ISO string).
10
10
  */
11
- export const timestamp = customType({
11
+ export const timestamp = createCustomType({
12
12
  dataType() {
13
13
  return 'timestamp with time zone';
14
14
  },
@@ -1,16 +1,6 @@
1
- /**
2
- * @module
3
- * Defines a custom Drizzle type for handling PostgreSQL `tsvector` columns.
4
- */
5
- import { type ConvertCustomConfig, type PgCustomColumnBuilder } from 'drizzle-orm/pg-core';
6
- type Config = {
7
- data: unknown;
8
- };
9
1
  /**
10
2
  * Custom Drizzle type for PostgreSQL `tsvector` columns.
11
3
  */
12
- export declare const tsvector: {
13
- (): PgCustomColumnBuilder<ConvertCustomConfig<"", Config>>;
14
- <TName extends string>(dbName: TName): PgCustomColumnBuilder<ConvertCustomConfig<TName, Config>>;
15
- };
16
- export {};
4
+ export declare const tsvector: import("./common.js").CustomTypeBuilder<{
5
+ data: unknown;
6
+ }>;
@@ -2,11 +2,11 @@
2
2
  * @module
3
3
  * Defines a custom Drizzle type for handling PostgreSQL `tsvector` columns.
4
4
  */
5
- import { customType } from 'drizzle-orm/pg-core';
5
+ import { createCustomType } from './common.js';
6
6
  /**
7
7
  * Custom Drizzle type for PostgreSQL `tsvector` columns.
8
8
  */
9
- export const tsvector = customType({
9
+ export const tsvector = createCustomType({
10
10
  dataType() {
11
11
  return 'tsvector';
12
12
  },