@tstdl/base 0.92.144 → 0.92.147

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 (269) hide show
  1. package/ai/ai-file.service.d.ts +29 -1
  2. package/ai/ai-file.service.js +66 -23
  3. package/ai/ai-session.d.ts +28 -1
  4. package/ai/ai-session.js +27 -0
  5. package/ai/ai.service.d.ts +89 -5
  6. package/ai/ai.service.js +130 -27
  7. package/ai/functions.d.ts +7 -1
  8. package/ai/functions.js +7 -1
  9. package/ai/module.d.ts +8 -0
  10. package/ai/module.js +4 -0
  11. package/ai/types.d.ts +115 -2
  12. package/ai/types.js +16 -0
  13. package/api/client/client.d.ts +1 -1
  14. package/api/client/client.js +1 -1
  15. package/api/default-error-handlers.d.ts +1 -1
  16. package/api/index.d.ts +1 -9
  17. package/api/index.js +1 -9
  18. package/api/response.d.ts +1 -1
  19. package/api/server/api-controller.d.ts +1 -1
  20. package/api/server/error-handler.d.ts +1 -1
  21. package/api/server/gateway.d.ts +1 -5
  22. package/api/server/gateway.js +0 -4
  23. package/api/server/middlewares/catch-error.middleware.d.ts +1 -1
  24. package/api/server/module.d.ts +1 -1
  25. package/api/types.d.ts +1 -1
  26. package/application/application.d.ts +1 -1
  27. package/authentication/authentication.api.d.ts +36 -1
  28. package/authentication/authentication.api.js +28 -0
  29. package/authentication/client/api.client.d.ts +14 -1
  30. package/authentication/client/api.client.js +13 -0
  31. package/authentication/client/authentication.service.d.ts +104 -1
  32. package/authentication/client/authentication.service.js +103 -0
  33. package/authentication/client/http-client.middleware.d.ts +5 -0
  34. package/authentication/client/http-client.middleware.js +6 -2
  35. package/authentication/client/module.d.ts +20 -1
  36. package/authentication/client/module.js +6 -1
  37. package/authentication/client/tokens.d.ts +6 -0
  38. package/authentication/client/tokens.js +6 -0
  39. package/authentication/models/authentication-credentials.model.d.ts +6 -0
  40. package/authentication/models/authentication-credentials.model.js +6 -0
  41. package/authentication/models/authentication-session.model.d.ts +6 -0
  42. package/authentication/models/authentication-session.model.js +6 -0
  43. package/authentication/models/init-secret-reset-data.model.d.ts +10 -1
  44. package/authentication/models/init-secret-reset-data.model.js +10 -1
  45. package/authentication/models/token-payload-base.model.d.ts +24 -4
  46. package/authentication/models/token-payload-base.model.js +24 -4
  47. package/authentication/models/token.model.d.ts +33 -2
  48. package/authentication/server/authentication-ancillary.service.d.ts +27 -4
  49. package/authentication/server/authentication-ancillary.service.js +7 -0
  50. package/authentication/server/authentication-api-request-token.provider.d.ts +3 -0
  51. package/authentication/server/authentication-api-request-token.provider.js +3 -0
  52. package/authentication/server/authentication-secret-requirements.validator.d.ts +37 -0
  53. package/authentication/server/authentication-secret-requirements.validator.js +22 -0
  54. package/authentication/server/authentication.api-controller.d.ts +66 -1
  55. package/authentication/server/authentication.api-controller.js +65 -0
  56. package/authentication/server/authentication.service.d.ts +191 -11
  57. package/authentication/server/authentication.service.js +157 -8
  58. package/authentication/server/helper.d.ts +44 -5
  59. package/authentication/server/helper.js +43 -4
  60. package/authentication/server/module.d.ts +23 -1
  61. package/authentication/server/module.js +23 -1
  62. package/browser/browser-context-controller.d.ts +1 -1
  63. package/browser/browser-controller.d.ts +1 -1
  64. package/browser/browser-controller.js +1 -1
  65. package/browser/element-controller.d.ts +1 -1
  66. package/browser/locator-controller.d.ts +1 -1
  67. package/context/context.d.ts +1 -1
  68. package/data-structures/context-data-map.d.ts +1 -1
  69. package/database/mongo/mongo-base.repository.d.ts +1 -1
  70. package/database/mongo/types.d.ts +1 -1
  71. package/database/query.d.ts +1 -1
  72. package/document-management/models/document-assignment-task.model.js +1 -0
  73. package/document-management/models/document-management-table.d.ts +1 -1
  74. package/document-management/models/document-validation-definition.model.d.ts +1 -1
  75. package/document-management/models/document-validation-execution.model.js +1 -0
  76. package/document-management/models/document-workflow.model.js +3 -2
  77. package/document-management/server/api/document-management.api.d.ts +1 -1
  78. package/document-management/server/api/document-management.api.js +3 -3
  79. package/document-management/server/drizzle/{0000_parallel_mantis.sql → 0000_ordinary_pretty_boy.sql} +6 -3
  80. package/document-management/server/drizzle/meta/0000_snapshot.json +27 -2
  81. package/document-management/server/drizzle/meta/_journal.json +2 -2
  82. package/document-management/server/schemas.d.ts +1 -1
  83. package/document-management/server/services/document-collection.service.d.ts +2 -2
  84. package/document-management/server/services/document-management-ai.service.js +7 -5
  85. package/document-management/server/services/document-management-ancillary.service.d.ts +1 -1
  86. package/document-management/server/services/document-management-observation.service.d.ts +1 -1
  87. package/document-management/server/services/document-management.service.d.ts +1 -1
  88. package/document-management/server/services/document-management.service.js +1 -1
  89. package/document-management/server/services/document-property.service.d.ts +3 -3
  90. package/document-management/server/services/document-request.service.d.ts +2 -2
  91. package/document-management/server/services/document-request.service.js +1 -1
  92. package/document-management/server/services/document-tag.service.js +1 -1
  93. package/document-management/server/services/document-validation.service.d.ts +2 -2
  94. package/document-management/server/services/document-validation.service.js +2 -2
  95. package/document-management/server/services/document-workflow.service.d.ts +2 -2
  96. package/document-management/server/services/document-workflow.service.js +4 -4
  97. package/document-management/server/services/document.service.d.ts +1 -1
  98. package/document-management/server/services/singleton.d.ts +1 -1
  99. package/document-management/server/validators/ai-validation-executor.js +4 -4
  100. package/document-management/server/validators/single-document-validation-executor.js +1 -1
  101. package/document-management/server/validators/validator.d.ts +1 -1
  102. package/document-management/service-models/document-management.view-model.d.ts +1 -1
  103. package/document-management/service-models/enriched/enriched-document-assignment.view.d.ts +1 -1
  104. package/document-management/service-models/enriched/enriched-document-category.view.d.ts +1 -1
  105. package/document-management/service-models/enriched/enriched-document-collection.view.d.ts +1 -1
  106. package/document-management/service-models/enriched/enriched-document-request.view.d.ts +1 -1
  107. package/document-management/service-models/enriched/enriched-document-type.view.d.ts +1 -1
  108. package/document-management/service-models/enriched/enriched-document.view.d.ts +1 -1
  109. package/document-management/service-models/enriched/enriched-requests-template-data.model.d.ts +1 -1
  110. package/dom/file-select-dialog.d.ts +1 -1
  111. package/enumeration/enumeration.d.ts +1 -1
  112. package/errors/custom.error.d.ts +3 -0
  113. package/errors/custom.error.js +0 -1
  114. package/errors/errors.localization.d.ts +1 -1
  115. package/errors/not-supported.error.d.ts +1 -1
  116. package/{formats.js → formats/formats.js} +3 -3
  117. package/formats/index.d.ts +1 -0
  118. package/formats/index.js +1 -0
  119. package/http/client/http-client-request.d.ts +1 -1
  120. package/http/client/http-client-response.d.ts +1 -1
  121. package/http/client/http-client.d.ts +1 -1
  122. package/http/client/module.d.ts +1 -1
  123. package/http/http-body.d.ts +1 -1
  124. package/http/http-value-map.d.ts +1 -1
  125. package/http/http.error.d.ts +1 -1
  126. package/http/server/http-server-request.d.ts +1 -1
  127. package/http/server/http-server-response.d.ts +1 -1
  128. package/http/types.d.ts +1 -1
  129. package/http/utils.d.ts +1 -1
  130. package/injector/decorators.d.ts +4 -4
  131. package/injector/index.d.ts +1 -1
  132. package/injector/index.js +1 -1
  133. package/injector/injector.d.ts +10 -1
  134. package/injector/injector.js +6 -0
  135. package/injector/interfaces.d.ts +1 -1
  136. package/injector/provider.d.ts +1 -1
  137. package/injector/resolution.d.ts +10 -5
  138. package/injector/resolve-chain.d.ts +2 -2
  139. package/injector/resolve-chain.js +1 -1
  140. package/injector/resolve.error.js +1 -1
  141. package/injector/token.d.ts +8 -1
  142. package/injector/token.js +7 -0
  143. package/injector/types.d.ts +1 -1
  144. package/key-value-store/key-value-store.provider.d.ts +2 -2
  145. package/key-value-store/key-value.store.d.ts +2 -2
  146. package/key-value-store/mongo/mongo-key-value-store.provider.d.ts +1 -1
  147. package/key-value-store/mongo/mongo-key-value.store.d.ts +1 -1
  148. package/key-value-store/postgres/key-value-store.service.d.ts +1 -1
  149. package/mail/mail.service.d.ts +1 -1
  150. package/mail/models/mail-data.model.d.ts +1 -1
  151. package/mail/models/mail-template.model.d.ts +1 -1
  152. package/mail/module.d.ts +1 -1
  153. package/module/index.d.ts +0 -1
  154. package/module/index.js +0 -1
  155. package/module/module-base.d.ts +1 -1
  156. package/module/module-metric-reporter.js +1 -1
  157. package/module/module.d.ts +1 -1
  158. package/module/modules/function.module.js +1 -1
  159. package/object-storage/object.d.ts +1 -1
  160. package/openid-connect/mongo-oidc-state.repository.d.ts +1 -1
  161. package/openid-connect/oidc.service.d.ts +1 -1
  162. package/orm/decorators.d.ts +2 -2
  163. package/orm/entity.d.ts +1 -1
  164. package/orm/index.d.ts +3 -3
  165. package/orm/index.js +3 -3
  166. package/orm/query.d.ts +1 -1
  167. package/orm/repository.types.d.ts +1 -1
  168. package/orm/schemas/json.d.ts +1 -1
  169. package/orm/server/database-schema.d.ts +1 -1
  170. package/orm/server/drizzle/schema-converter.d.ts +1 -1
  171. package/orm/server/repository.d.ts +1 -1
  172. package/orm/server/transaction.d.ts +1 -1
  173. package/orm/server/transactional.d.ts +3 -3
  174. package/orm/server/types.d.ts +1 -1
  175. package/orm/types.d.ts +1 -1
  176. package/package.json +24 -21
  177. package/queue/mongo/job.d.ts +1 -1
  178. package/queue/mongo/queue.js +31 -31
  179. package/queue/postgres/job.model.d.ts +1 -1
  180. package/queue/postgres/queue.d.ts +1 -1
  181. package/queue/postgres/queue.provider.d.ts +1 -1
  182. package/queue/provider.d.ts +1 -1
  183. package/reflection/decorators.d.ts +1 -1
  184. package/reflection/registry.d.ts +1 -1
  185. package/reflection/types.d.ts +1 -1
  186. package/reflection/utils.d.ts +1 -1
  187. package/rpc/model.d.ts +1 -1
  188. package/rxjs-utils/retry-backoff.js +2 -2
  189. package/schema/converters/openapi-converter.d.ts +1 -1
  190. package/schema/decorators/schema.d.ts +1 -1
  191. package/schema/decorators/utils.d.ts +1 -1
  192. package/schema/schema.d.ts +1 -1
  193. package/schema/schema.error.d.ts +1 -1
  194. package/schema/schemas/array.d.ts +1 -1
  195. package/schema/schemas/enumeration.d.ts +1 -1
  196. package/schema/schemas/function.d.ts +1 -1
  197. package/schema/schemas/instance.d.ts +1 -1
  198. package/schema/schemas/nullable.d.ts +1 -1
  199. package/schema/schemas/number.d.ts +1 -1
  200. package/schema/schemas/object.d.ts +1 -1
  201. package/schema/schemas/one-or-many.d.ts +1 -1
  202. package/schema/schemas/optional.d.ts +1 -1
  203. package/schema/schemas/simple.d.ts +1 -1
  204. package/search-index/elastic/model/index-mapping.d.ts +1 -1
  205. package/search-index/elastic/search-index.js +3 -4
  206. package/search-index/memory/memory-search-index.d.ts +1 -1
  207. package/search-index/memory/memory-search-index.js +1 -1
  208. package/serializer/handlers/binary.d.ts +1 -1
  209. package/serializer/serializable.d.ts +1 -1
  210. package/serializer/types.d.ts +1 -1
  211. package/templates/module.d.ts +1 -1
  212. package/templates/renderers/handlebars.template-renderer.d.ts +1 -1
  213. package/templates/renderers/jsx.template-renderer.d.ts +1 -1
  214. package/templates/renderers/mjml.template-renderer.d.ts +1 -1
  215. package/templates/renderers/string.template-renderer.d.ts +1 -1
  216. package/templates/resolvers/file.template-resolver.d.ts +1 -1
  217. package/templates/resolvers/jsx.template-resolver.d.ts +1 -1
  218. package/templates/resolvers/string.template-resolver.d.ts +1 -1
  219. package/templates/template.model.d.ts +1 -1
  220. package/templates/template.renderer.d.ts +1 -1
  221. package/templates/template.service.d.ts +1 -1
  222. package/text/dynamic-text.model.d.ts +1 -1
  223. package/text/localization.service.d.ts +1 -1
  224. package/types/geo-json.d.ts +1 -1
  225. package/types/index.d.ts +2 -0
  226. package/types/tagged.d.ts +1 -1
  227. package/{types.d.ts → types/types.d.ts} +2 -1
  228. package/utils/async-hook/async-hook.d.ts +109 -0
  229. package/utils/async-hook/async-hook.js +77 -3
  230. package/utils/backoff.d.ts +125 -43
  231. package/utils/backoff.js +140 -65
  232. package/utils/base64.d.ts +1 -1
  233. package/utils/base64.js +1 -2
  234. package/utils/binary.d.ts +1 -1
  235. package/utils/comparison.d.ts +5 -5
  236. package/utils/comparison.js +5 -3
  237. package/utils/cryptography.d.ts +1 -1
  238. package/utils/encoding.d.ts +1 -1
  239. package/utils/enum.d.ts +1 -1
  240. package/utils/equals.d.ts +1 -1
  241. package/utils/format-error.d.ts +1 -1
  242. package/utils/function/class.d.ts +1 -1
  243. package/utils/function/memoize.d.ts +1 -1
  244. package/utils/helpers.d.ts +1 -1
  245. package/utils/helpers.js +2 -2
  246. package/utils/jwt.d.ts +3 -3
  247. package/utils/merge.d.ts +1 -1
  248. package/utils/middleware.js +3 -3
  249. package/utils/object/decycle.d.ts +1 -1
  250. package/utils/object/forward-ref.d.ts +1 -1
  251. package/utils/object/lazy-property.d.ts +1 -1
  252. package/utils/object/object.d.ts +1 -1
  253. package/utils/object/property-name.d.ts +1 -1
  254. package/utils/patch-worker.d.ts +1 -1
  255. package/utils/reactive-value-to-signal.d.ts +1 -1
  256. package/utils/reflection.d.ts +1 -1
  257. package/utils/repl.d.ts +1 -1
  258. package/utils/singleton.d.ts +1 -1
  259. package/utils/stream/size-limited-stream.d.ts +1 -1
  260. package/utils/type/extends.d.ts +1 -1
  261. package/utils/type-guards.d.ts +1 -1
  262. package/utils/url-builder.d.ts +1 -1
  263. package/utils/z-base32.d.ts +1 -1
  264. package/module/utils.d.ts +0 -4
  265. package/module/utils.js +0 -21
  266. /package/{formats.d.ts → formats/formats.d.ts} +0 -0
  267. /package/{types.js → types/types.js} +0 -0
  268. /package/{web-types.d.ts → types/web-types.d.ts} +0 -0
  269. /package/{web-types.js → types/web-types.js} +0 -0
@@ -1,4 +1,4 @@
1
- import type { ObjectLiteral } from '../types.js';
1
+ import type { ObjectLiteral } from '../types/index.js';
2
2
  import type { Queue, QueueConfig } from './queue.js';
3
3
  export declare abstract class QueueProvider {
4
4
  abstract get<T extends ObjectLiteral>(key: string, config?: QueueConfig): Queue<T>;
@@ -1,5 +1,5 @@
1
1
  import 'reflect-metadata/lite';
2
- import type { ConstructorParameterDecorator } from '../types.js';
2
+ import type { ConstructorParameterDecorator } from '../types/index.js';
3
3
  import type { Decorator, DecoratorHandler } from './types.js';
4
4
  import { type CreateDecoratorOptions, type SpecificCreateDecoratorOptions } from './utils.js';
5
5
  export declare function Decorate({ handler, ...options }?: CreateDecoratorOptions & {
@@ -1,4 +1,4 @@
1
- import type { AbstractConstructor } from '../types.js';
1
+ import type { AbstractConstructor } from '../types/index.js';
2
2
  import { ContextDataMap } from '../data-structures/context-data-map.js';
3
3
  import type { DecoratorData } from './types.js';
4
4
  export type ReflectionMetadata = TypeMetadata | PropertyMetadata | MethodMetadata | ConstructorParameterMetadata | MethodParameterMetadata;
@@ -1,4 +1,4 @@
1
- import type { AbstractConstructor, Constructor, ConstructorParameterDecorator, Record } from '../types.js';
1
+ import type { AbstractConstructor, Constructor, ConstructorParameterDecorator, Record } from '../types/index.js';
2
2
  import type { UnionToIntersection } from 'type-fest';
3
3
  import type { ConstructorParameterMetadata, MethodMetadata, MethodParameterMetadata, ParameterMetadata, PropertyMetadata, TypeMetadata } from './registry.js';
4
4
  export type DecoratorType = 'class' | 'property' | 'accessor' | 'method' | 'parameter' | 'methodParameter' | 'constructorParameter';
@@ -1,4 +1,4 @@
1
- import type { AbstractConstructor, Constructor, ConstructorParameterDecorator, OneOrMany, PropertiesOfType, Record, TypedOmit } from '../types.js';
1
+ import type { AbstractConstructor, Constructor, ConstructorParameterDecorator, OneOrMany, PropertiesOfType, Record, TypedOmit } from '../types/index.js';
2
2
  import type { CombinedDecoratorParameters, Decorator, DecoratorData, DecoratorHandler, DecoratorMetadata, DecoratorType, DecoratorUnion } from './types.js';
3
3
  export type CreateDecoratorTypeOptions = Partial<Record<DecoratorType, boolean>>;
4
4
  export type CreateDecoratorOptions = {
package/rpc/model.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { SerializationOptions } from '../serializer/types.js';
2
- import type { Constructor, Record } from '../types.js';
2
+ import type { Constructor, Record } from '../types/index.js';
3
3
  export type RpcConstructor<T extends Constructor> = T extends Constructor<any, infer R> ? Constructor<Promise<RpcRemote<InstanceType<T>>>, R> : never;
4
4
  export type RpcFunction<T extends (...args: any) => any> = T extends (...args: infer Args) => infer R ? (...args: Args) => Promise<Awaited<R>> : never;
5
5
  export type RpcObject<T extends Record> = {
@@ -7,7 +7,7 @@ export function retryBackoff(count, options) {
7
7
  throw error;
8
8
  }
9
9
  return counter + 1;
10
- }, 0), delayWhen(() => timer(helper.backoff()))));
10
+ }, 0), delayWhen(() => timer(helper.getNextDelay()))));
11
11
  }
12
12
  export function retryBackoffHandled(count, options, handler) {
13
13
  return (source) => {
@@ -19,7 +19,7 @@ export function retryBackoffHandled(count, options, handler) {
19
19
  return (returnValue != undefined) ? from(returnValue) : of(undefined);
20
20
  }
21
21
  return of(undefined);
22
- }), delayWhen(() => timer(helper.backoff())))));
22
+ }), delayWhen(() => timer(helper.getNextDelay())))));
23
23
  return observable;
24
24
  };
25
25
  }
@@ -1,3 +1,3 @@
1
- import type { UndefinableJsonObject } from '../../types.js';
1
+ import type { UndefinableJsonObject } from '../../types/index.js';
2
2
  import type { SchemaTestable } from '../schema.js';
3
3
  export declare function convertToOpenApiSchema(testable: SchemaTestable): UndefinableJsonObject;
@@ -1,6 +1,6 @@
1
1
  import type { SetRequired } from 'type-fest';
2
2
  import { type Decorator } from '../../reflection/index.js';
3
- import type { TypedOmit } from '../../types.js';
3
+ import type { TypedOmit } from '../../types/index.js';
4
4
  import type { SchemaTestable } from '../schema.js';
5
5
  import type { CombinedSchemaDecorator, SchemaReflectionData, SchemaTestableProvider } from './types.js';
6
6
  export type SchemaDecoratorOptions = SchemaReflectionData;
@@ -1,4 +1,4 @@
1
- import type { AbstractConstructor } from '../../types.js';
1
+ import type { AbstractConstructor } from '../../types/index.js';
2
2
  import type { SchemaTestable } from '../schema.js';
3
3
  import type { SchemaReflectionData } from './types.js';
4
4
  export declare function schemaReflectionDataToSchema(reflectionData: SchemaReflectionData | undefined, fallbackType: AbstractConstructor | null, source: {
@@ -1,6 +1,6 @@
1
1
  import type { IsEqual, Or } from 'type-fest';
2
2
  import { JsonPath } from '../json-path/json-path.js';
3
- import type { AbstractConstructor } from '../types.js';
3
+ import type { AbstractConstructor } from '../types/index.js';
4
4
  import type { SchemaError } from './schema.error.js';
5
5
  import type { Coercible, Maskable } from './types.js';
6
6
  export type SchemaTestOptions = Coercible & Maskable & {
@@ -1,6 +1,6 @@
1
1
  import { CustomError, type CustomErrorOptions } from '../errors/custom.error.js';
2
2
  import type { JsonPath } from '../json-path/index.js';
3
- import type { AbstractConstructor, OneOrMany, TypedOmit, UndefinableJson } from '../types.js';
3
+ import type { AbstractConstructor, OneOrMany, TypedOmit, UndefinableJson } from '../types/index.js';
4
4
  import type { ErrorExtraInfo } from '../utils/format-error.js';
5
5
  export type SchemaErrorOptions = Pick<CustomErrorOptions, 'fast'> & {
6
6
  path: string | JsonPath;
@@ -1,5 +1,5 @@
1
1
  import type { JsonPath } from '../../json-path/json-path.js';
2
- import type { TypedOmit } from '../../types.js';
2
+ import type { TypedOmit } from '../../types/index.js';
3
3
  import { type SchemaDecoratorOptions, type SchemaPropertyDecorator } from '../decorators/index.js';
4
4
  import { Schema, type SchemaOptions, type SchemaTestable, type SchemaTestOptions, type SchemaTestResult } from '../schema.js';
5
5
  import type { Coercible } from '../types.js';
@@ -1,4 +1,4 @@
1
- import type { Enumeration as EnumerationType, EnumerationValue } from '../../types.js';
1
+ import type { Enumeration as EnumerationType, EnumerationValue } from '../../types/index.js';
2
2
  import { type SchemaPropertyDecorator, type SchemaDecoratorOptions } from '../decorators/index.js';
3
3
  import { SimpleSchema, type SimpleSchemaOptions } from './simple.js';
4
4
  export type EnumerationSchemaOptions<T extends EnumerationType> = SimpleSchemaOptions<EnumerationValue<T>>;
@@ -1,4 +1,4 @@
1
- import type { AbstractConstructor, Function } from '../../types.js';
1
+ import type { AbstractConstructor, Function } from '../../types/index.js';
2
2
  import { type CombinedSchemaDecorator, type SchemaDecoratorOptions } from '../decorators/index.js';
3
3
  import type { Schema, SchemaTestable } from '../schema.js';
4
4
  import { SimpleSchema, type SimpleSchemaOptions } from './simple.js';
@@ -1,5 +1,5 @@
1
1
  import type { JsonPath } from '../../json-path/json-path.js';
2
- import type { AbstractConstructor } from '../../types.js';
2
+ import type { AbstractConstructor } from '../../types/index.js';
3
3
  import { type SchemaPropertyDecorator, type SchemaDecoratorOptions } from '../decorators/index.js';
4
4
  import { Schema, type SchemaOptions, type SchemaTestOptions, type SchemaTestResult } from '../schema.js';
5
5
  export type InstanceSchemaOptions<T extends AbstractConstructor> = SchemaOptions<InstanceType<T>>;
@@ -1,5 +1,5 @@
1
1
  import type { JsonPath } from '../../json-path/json-path.js';
2
- import type { TypedOmit } from '../../types.js';
2
+ import type { TypedOmit } from '../../types/index.js';
3
3
  import { type SchemaDecoratorOptions, type SchemaPropertyDecorator } from '../decorators/index.js';
4
4
  import { Schema, type SchemaTestable, type SchemaTestOptions, type SchemaTestResult } from '../schema.js';
5
5
  export declare class NullableSchema<T> extends Schema<T | null> {
@@ -1,4 +1,4 @@
1
- import type { TypedOmit } from '../../types.js';
1
+ import type { TypedOmit } from '../../types/index.js';
2
2
  import { type SchemaDecoratorOptions, type SchemaPropertyDecorator } from '../decorators/index.js';
3
3
  import { SimpleSchema, type SimpleSchemaOptions } from './simple.js';
4
4
  export type NumberSchemaOptions = SimpleSchemaOptions<number> & {
@@ -1,7 +1,7 @@
1
1
  import type { EmptyObject, Merge } from 'type-fest';
2
2
  import type { JsonPath } from '../../json-path/json-path.js';
3
3
  import { type Decorator } from '../../reflection/index.js';
4
- import type { AbstractConstructor, OneOrMany, PartialProperty, Record as RecordType, SimplifyObject, Type, TypedOmit } from '../../types.js';
4
+ import type { AbstractConstructor, OneOrMany, PartialProperty, Record as RecordType, SimplifyObject, Type, TypedOmit } from '../../types/index.js';
5
5
  import { type SchemaDecoratorOptions } from '../decorators/index.js';
6
6
  import { type OPTIONAL, Schema, type SchemaOptions, type SchemaOutput, type SchemaTestable, type SchemaTestOptions, type SchemaTestResult } from '../schema.js';
7
7
  export type Record<K extends PropertyKey = PropertyKey, V = any> = RecordType<K, V>;
@@ -1,5 +1,5 @@
1
1
  import type { JsonPath } from '../../json-path/json-path.js';
2
- import type { OneOrMany as OneOrManyType } from '../../types.js';
2
+ import type { OneOrMany as OneOrManyType } from '../../types/index.js';
3
3
  import { type SchemaDecoratorOptions, type SchemaPropertyDecorator } from '../decorators/index.js';
4
4
  import { Schema, type SchemaOptions, type SchemaTestable, type SchemaTestOptions, type SchemaTestResult } from '../schema.js';
5
5
  import { type ArraySchemaOptions } from './array.js';
@@ -1,5 +1,5 @@
1
1
  import type { JsonPath } from '../../json-path/json-path.js';
2
- import type { TypedOmit } from '../../types.js';
2
+ import type { TypedOmit } from '../../types/index.js';
3
3
  import { type SchemaDecoratorOptions, type SchemaPropertyDecorator } from '../decorators/index.js';
4
4
  import { type OPTIONAL, Schema, type SchemaTestable, type SchemaTestOptions, type SchemaTestResult } from '../schema.js';
5
5
  export declare class OptionalSchema<T> extends Schema<T | undefined> {
@@ -1,5 +1,5 @@
1
1
  import type { JsonPath } from '../../json-path/json-path.js';
2
- import type { AbstractConstructor, OneOrMany } from '../../types.js';
2
+ import type { AbstractConstructor, OneOrMany } from '../../types/index.js';
3
3
  import { Schema, type SchemaOptions, type SchemaTestOptions, type SchemaTestResult } from '../schema.js';
4
4
  import type { CoerceResult, Coercible, ConstraintResult } from '../types.js';
5
5
  export type SimpleSchemaOptions<T> = SchemaOptions<T> & Coercible;
@@ -1,6 +1,6 @@
1
1
  import type { estypes } from '@elastic/elasticsearch';
2
2
  import type { Entity } from '../../../database/index.js';
3
- import type { DeepFlatten, StringMap, TypedOmit } from '../../../types.js';
3
+ import type { DeepFlatten, StringMap, TypedOmit } from '../../../types/index.js';
4
4
  export type ElasticIndexMapping<T extends Entity = Entity> = TypedOmit<estypes.MappingTypeMapping, 'properties'> & ElasticNestedIndexMapping<TypedOmit<T, 'id'>>;
5
5
  export type ElasticNestedIndexMapping<T> = {
6
6
  properties: {
@@ -62,7 +62,7 @@ export class ElasticSearchIndex extends SearchIndex {
62
62
  operations: entities.flatMap((entity) => {
63
63
  const { id: _, ...entityWithoutId } = entity;
64
64
  return [{ index: { _id: entity.id } }, entityWithoutId];
65
- })
65
+ }),
66
66
  };
67
67
  const result = await this.client.bulk(request);
68
68
  if (result.errors) {
@@ -84,7 +84,6 @@ export class ElasticSearchIndex extends SearchIndex {
84
84
  const queryBody = convertQuery(query);
85
85
  await this.client.deleteByQuery({ index: this.indexName, query: queryBody });
86
86
  }
87
- // eslint-disable-next-line max-statements
88
87
  async search(searchQueryOrCursor, options) {
89
88
  const cursorData = isString(searchQueryOrCursor) ? deserializeCursor(searchQueryOrCursor) : undefined;
90
89
  const queryBody = isDefined(cursorData) ? cursorData.query : convertQuery(searchQueryOrCursor);
@@ -116,7 +115,7 @@ export class ElasticSearchIndex extends SearchIndex {
116
115
  }
117
116
  const result = await this.client.count({
118
117
  index: this.indexName,
119
- query: convertQuery(query ?? {})
118
+ query: convertQuery(query ?? {}),
120
119
  });
121
120
  return result.count;
122
121
  }
@@ -128,7 +127,7 @@ export class ElasticSearchIndex extends SearchIndex {
128
127
  await this.client.indices.delete({ index: this.indexName });
129
128
  }
130
129
  async exists() {
131
- return this.client.indices.exists({ index: this.indexName });
130
+ return await this.client.indices.exists({ index: this.indexName });
132
131
  }
133
132
  }
134
133
  function serializeCursor(query, sort, options, searchAfter) {
@@ -11,7 +11,7 @@ export declare class MemorySearchIndex<T extends Entity> extends SearchIndex<T>
11
11
  delete(id: string): Promise<void>;
12
12
  deleteByQuery(query: Query<T>): Promise<void>;
13
13
  search(queryOrCursor: string | Query<T>, options?: QueryOptions<T>): Promise<SearchResult<T>>;
14
- count(query?: Query<T>, options?: QueryOptions<T> | undefined): Promise<number>;
14
+ count(query?: Query<T>, options?: QueryOptions<T>): Promise<number>;
15
15
  drop(): Promise<void>;
16
16
  private _delete;
17
17
  private indexEntity;
@@ -81,7 +81,7 @@ export class MemorySearchIndex extends SearchIndex {
81
81
  total: resultItems.length,
82
82
  totalIsLowerBound: false,
83
83
  milliseconds: timer.milliseconds,
84
- items: resultItems
84
+ items: resultItems,
85
85
  };
86
86
  return result;
87
87
  }
@@ -1,4 +1,4 @@
1
- import type { TypedArray } from '../../types.js';
1
+ import type { TypedArray } from '../../types/index.js';
2
2
  interface TypedArrayConstructor {
3
3
  readonly BYTES_PER_ELEMENT: number;
4
4
  new (buffer: ArrayBufferLike, byteOffset?: number, length?: number): TypedArray;
@@ -1,4 +1,4 @@
1
- import type { AbstractConstructor, Record, Type, TypedOmit } from '../types.js';
1
+ import type { AbstractConstructor, Record, Type, TypedOmit } from '../types/index.js';
2
2
  export declare const Serializable: {
3
3
  readonly serialize: unique symbol;
4
4
  readonly deserialize: unique symbol;
@@ -1,4 +1,4 @@
1
- import type { AbstractConstructor, JsonPrimitive, Nested, Record } from '../types.js';
1
+ import type { AbstractConstructor, JsonPrimitive, Nested, Record } from '../types/index.js';
2
2
  declare const serializedSymbol: unique symbol;
3
3
  declare const stringSerializedSymbol: unique symbol;
4
4
  declare const decycledSymbol: unique symbol;
@@ -1,4 +1,4 @@
1
- import type { Type } from '../types.js';
1
+ import type { Type } from '../types/index.js';
2
2
  import { TemplateProvider } from './template.provider.js';
3
3
  import { TemplateRenderer } from './template.renderer.js';
4
4
  import { TemplateResolver } from './template.resolver.js';
@@ -1,4 +1,4 @@
1
- import type { ObjectLiteral, Record } from '../../types.js';
1
+ import type { ObjectLiteral, Record } from '../../types/index.js';
2
2
  import type * as Handlebars from 'handlebars';
3
3
  import { TemplateResolverProvider } from '../template-resolver.provider.js';
4
4
  import type { TemplateField } from '../template.model.js';
@@ -1,4 +1,4 @@
1
- import type { Record } from '../../types.js';
1
+ import type { Record } from '../../types/index.js';
2
2
  import type { JsxTemplate } from '../resolvers/jsx.template-resolver.js';
3
3
  import type { TemplateRenderObject, TemplateRenderResult } from '../template.renderer.js';
4
4
  import { TemplateRenderer } from '../template.renderer.js';
@@ -1,4 +1,4 @@
1
- import type { Record } from '../../types.js';
1
+ import type { Record } from '../../types/index.js';
2
2
  import type { MJMLParsingOptions } from 'mjml-core';
3
3
  import { TemplateRendererProvider } from '../template-renderer.provider.js';
4
4
  import type { TemplateRenderObject, TemplateRenderResult } from '../template.renderer.js';
@@ -1,4 +1,4 @@
1
- import type { Record } from '../../types.js';
1
+ import type { Record } from '../../types/index.js';
2
2
  import type { StringTemplate } from '../resolvers/string.template-resolver.js';
3
3
  import type { TemplateRenderObject, TemplateRenderResult } from '../template.renderer.js';
4
4
  import { TemplateRenderer } from '../template.renderer.js';
@@ -1,5 +1,5 @@
1
1
  import { type Resolvable, resolveArgumentType } from '../../injector/interfaces.js';
2
- import type { TypedOmit } from '../../types.js';
2
+ import type { TypedOmit } from '../../types/index.js';
3
3
  import { TemplateField } from '../template.model.js';
4
4
  import type { TemplateRenderer, TemplateRendererOptions, TemplateRendererString } from '../template.renderer.js';
5
5
  import { TemplateResolver } from '../template.resolver.js';
@@ -1,4 +1,4 @@
1
- import type { PartialProperty, Record, TypedOmit } from '../../types.js';
1
+ import type { PartialProperty, Record, TypedOmit } from '../../types/index.js';
2
2
  import type { ComponentClass, FunctionComponent } from 'preact';
3
3
  import { type Template, TemplateField } from '../template.model.js';
4
4
  import type { TemplateRenderer, TemplateRendererOptions, TemplateRendererString } from '../template.renderer.js';
@@ -1,4 +1,4 @@
1
- import type { Record, TypedOmit } from '../../types.js';
1
+ import type { Record, TypedOmit } from '../../types/index.js';
2
2
  import { TemplateField } from '../template.model.js';
3
3
  import type { TemplateRenderer, TemplateRendererOptions, TemplateRendererString } from '../template.renderer.js';
4
4
  import { TemplateResolver } from '../template.resolver.js';
@@ -1,4 +1,4 @@
1
- import type { PickBy, Record, SimplifyObject } from '../types.js';
1
+ import type { PickBy, Record, SimplifyObject } from '../types/index.js';
2
2
  export type TemplateContext<T extends Template> = Parameters<NonNullable<T[typeof templateContext]>>[0];
3
3
  declare const templateContext: unique symbol;
4
4
  export declare class TemplateField<Resolver extends string = string, Renderer extends string = string, Options = any, Context extends Record = any> {
@@ -1,5 +1,5 @@
1
1
  import type { SchemaTestable } from '../schema/index.js';
2
- import type { Record } from '../types.js';
2
+ import type { Record } from '../types/index.js';
3
3
  export type TemplateRenderResult = string;
4
4
  export type TemplateRenderObject<Renderer extends string = string, Options = any, V = unknown> = {
5
5
  renderer: Renderer;
@@ -1,4 +1,4 @@
1
- import type { Record } from '../types.js';
1
+ import type { Record } from '../types/index.js';
2
2
  import { TemplateRendererProvider } from './template-renderer.provider.js';
3
3
  import { TemplateResolverProvider } from './template-resolver.provider.js';
4
4
  import type { Template, TemplateContext } from './template.model.js';
@@ -1,6 +1,6 @@
1
1
  import { type Observable } from 'rxjs';
2
2
  import { type Signal } from '../signals/api.js';
3
- import type { PickBy, ReactiveValue, ReplaceKey } from '../types.js';
3
+ import type { PickBy, ReactiveValue, ReplaceKey } from '../types/index.js';
4
4
  import type { LocalizableText } from './localizable-text.model.js';
5
5
  import { LocalizationService } from './localization.service.js';
6
6
  export type DynamicText = ReactiveValue<LocalizableText>;
@@ -1,7 +1,7 @@
1
1
  import type { Observable } from 'rxjs';
2
2
  import { Logger } from '../logger/index.js';
3
3
  import type { Signal } from '../signals/api.js';
4
- import type { Enumeration, EnumerationValue, Record } from '../types.js';
4
+ import type { Enumeration, EnumerationValue, Record } from '../types/index.js';
5
5
  import type { PropertyName } from '../utils/object/property-name.js';
6
6
  export type Language = {
7
7
  code: string;
@@ -1,4 +1,4 @@
1
- import type { JsonObject } from '../types.js';
1
+ import type { JsonObject } from './types.js';
2
2
  export type Position = [longitude: number, latitude: number, elevation?: number];
3
3
  export type GeoJsonObject<Type extends string> = {
4
4
  type: Type;
package/types/index.d.ts CHANGED
@@ -1,2 +1,4 @@
1
1
  export type * from './geo-json.js';
2
2
  export type * from './tagged.js';
3
+ export type * from './types.js';
4
+ export type * from './web-types.js';
package/types/tagged.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Record } from '../types.js';
1
+ import type { Record } from './types.js';
2
2
  export declare const tag: unique symbol;
3
3
  export declare const type: unique symbol;
4
4
  export type TagContainer<Type, Token> = {
@@ -1,6 +1,6 @@
1
1
  import type { Observable } from 'rxjs';
2
2
  import type { CamelCase, Except, IsEqual, LiteralUnion } from 'type-fest';
3
- import type { Signal } from './signals/api.js';
3
+ import type { Signal } from '../signals/api.js';
4
4
  export type ObjectLiteral = {};
5
5
  export type Function<P extends any[] = any[], R = any> = (...params: P) => R;
6
6
  export type PrimitiveTypeMap = {
@@ -149,6 +149,7 @@ export type PickBy<T, V> = Pick<T, {
149
149
  export type NonNullable<T> = T extends null ? never : T;
150
150
  export type NonUndefinable<T> = T extends undefined ? never : T;
151
151
  export type NonNullOrUndefinable<T> = T extends null | undefined ? never : T;
152
+ export type NoUnion<T> = [T] extends [boolean] ? boolean : [T] extends [UnionToIntersection<T>] ? T : never;
152
153
  /**
153
154
  * Makes optional properties required and removes null and undefined
154
155
  */
@@ -1,9 +1,118 @@
1
+ /**
2
+ * Represents the public interface for an asynchronous hook.
3
+ *
4
+ * @template T The type of the value that the hook is triggered with.
5
+ * @template C The type of the optional context object passed to the hook's trigger and handlers. Defaults to `never`.
6
+ * @template R The return type of an individual handler. Defaults to `unknown`.
7
+ */
1
8
  export type AsyncHook<T, C = never, R = unknown> = {
9
+ /**
10
+ * Registers a handler function to be called when the hook is triggered.
11
+ * @param handler The async handler function to register.
12
+ * @returns A registration object with an `unregister` method to remove the handler.
13
+ */
2
14
  register: (handler: AsyncHookHandler<T, C, R>) => AsyncHookHandlerRegistration;
15
+ /**
16
+ * Triggers the hook, executing all registered handlers in sequence.
17
+ *
18
+ * The signature of this function is conditional:
19
+ * - If the context type `C` is `never` (the default), it accepts only the `value` argument.
20
+ * - If `C` is any other type, it requires both `value` and `context` arguments.
21
+ *
22
+ * @param value The value to pass to all handlers.
23
+ * @param context The context object to pass to all handlers (only required if `C` is not `never`).
24
+ * @returns A promise that resolves to an array of results from all handlers.
25
+ */
3
26
  trigger: [C] extends [never] ? ((value: T) => Promise<R[]>) : ((value: T, context: C) => Promise<R[]>);
4
27
  };
28
+ /**
29
+ * Defines the signature for a handler function that can be registered with an `AsyncHook`.
30
+ * The function can be synchronous (returning `R`) or asynchronous (returning `Promise<R>`).
31
+ *
32
+ * The signature is conditional based on the context type `C`:
33
+ * - If `C` is `never`, the handler receives only the `value` argument.
34
+ * - If `C` is any other type, the handler receives both `value` and `context`.
35
+ *
36
+ * @template T The type of the value passed to the handler.
37
+ * @template C The type of the optional context object.
38
+ * @template R The expected return type of the handler.
39
+ */
5
40
  export type AsyncHookHandler<T, C, R> = [C] extends [never] ? ((value: T) => R | Promise<R>) : ((value: T, context: C) => R | Promise<R>);
41
+ /**
42
+ * Represents the object returned when a handler is registered,
43
+ * allowing for its subsequent unregistration.
44
+ */
6
45
  export type AsyncHookHandlerRegistration = {
46
+ /**
47
+ * Unregisters the handler, preventing it from being called in future triggers.
48
+ */
7
49
  unregister: () => void;
8
50
  };
51
+ /**
52
+ * Creates a new asynchronous hook.
53
+ *
54
+ * An async hook is a system that allows you to register multiple "handler" functions
55
+ * that will be executed in sequence when a "trigger" event occurs. This is useful
56
+ * for creating extensible, plugin-like architectures. Handlers can be synchronous
57
+ * or asynchronous.
58
+ *
59
+ * @template T The type of the primary value that the hook is triggered with.
60
+ * @template C The type of the optional context object passed to the hook's trigger and handlers. Defaults to `never`.
61
+ * @template R The return type of an individual handler. The `trigger` method will resolve with an array of these values (`R[]`). Defaults to `unknown`.
62
+ * @returns {AsyncHook<T, C, R>} An object with `register` and `trigger` methods.
63
+ *
64
+ * @example
65
+ * ```ts
66
+ * // Simple hook without context
67
+ * async function runSimpleExample() {
68
+ * const onTaskStart = asyncHook<string>();
69
+ *
70
+ * onTaskStart.register(taskName => {
71
+ * console.log(`[Logger] Task started: ${taskName}`);
72
+ * });
73
+ *
74
+ * const registration = onTaskStart.register(async taskName => {
75
+ * await new Promise(resolve => setTimeout(resolve, 50));
76
+ * console.log(`[Notifier] Notifying that task started: ${taskName}`);
77
+ * });
78
+ *
79
+ * await onTaskStart.trigger('Process Data');
80
+ * // [Logger] Task started: Process Data
81
+ * // [Notifier] Notifying that task started: Process Data
82
+ *
83
+ * registration.unregister();
84
+ * console.log('Notifier unregistered.');
85
+ *
86
+ * await onTaskStart.trigger('Finalize Report');
87
+ * // [Logger] Task started: Finalize Report
88
+ * }
89
+ * ```
90
+ *
91
+ * @example
92
+ * ```ts
93
+ * // Hook with a context object
94
+ * async function runContextExample() {
95
+ * type TaskContext = { userId: number; transactionId: string };
96
+ *
97
+ * const onTaskComplete = asyncHook<string, TaskContext, boolean>();
98
+ *
99
+ * onTaskComplete.register((taskName, context) => {
100
+ * console.log(`[Audit] Task '${taskName}' completed by user ${context.userId}.`);
101
+ * return true; // Audit successful
102
+ * });
103
+ *
104
+ * onTaskComplete.register(async (taskName, context) => {
105
+ * console.log(`[DB] Logging completion of '${taskName}' for transaction ${context.transactionId}.`);
106
+ * return true; // DB update successful
107
+ * });
108
+ *
109
+ * const results = await onTaskComplete.trigger(
110
+ * 'SubmitOrder',
111
+ * { userId: 123, transactionId: 'abc-456' }
112
+ * );
113
+ *
114
+ * console.log('Handler results:', results); // [true, true]
115
+ * }
116
+ * ```
117
+ */
9
118
  export declare function asyncHook<T, C = never, R = unknown>(): AsyncHook<T, C, R>;