@decaf-ts/db-decorators 0.16.0 → 0.17.1

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 (99) hide show
  1. package/dist/db-decorators.cjs +1 -1
  2. package/dist/db-decorators.cjs.map +1 -1
  3. package/dist/db-decorators.js +1 -1
  4. package/dist/db-decorators.js.map +1 -1
  5. package/lib/cjs/index.cjs +2 -1
  6. package/lib/cjs/index.cjs.map +1 -1
  7. package/lib/esm/index.js +2 -1
  8. package/lib/esm/index.js.map +1 -1
  9. package/lib/types/identity/index.d.cts +1 -1
  10. package/lib/types/identity/index.d.mts +1 -1
  11. package/lib/types/index.d.cts +9 -8
  12. package/lib/types/index.d.mts +9 -8
  13. package/lib/types/interfaces/BulkCrudOperator.d.cts +2 -2
  14. package/lib/types/interfaces/BulkCrudOperator.d.mts +2 -2
  15. package/lib/types/interfaces/Contextual.d.cts +2 -2
  16. package/lib/types/interfaces/Contextual.d.mts +2 -2
  17. package/lib/types/interfaces/CrudOperator.d.cts +1 -1
  18. package/lib/types/interfaces/CrudOperator.d.mts +1 -1
  19. package/lib/types/interfaces/IRepository.d.cts +2 -2
  20. package/lib/types/interfaces/IRepository.d.mts +2 -2
  21. package/lib/types/interfaces/index.d.cts +4 -4
  22. package/lib/types/interfaces/index.d.mts +4 -4
  23. package/lib/types/model/decorators.d.cts +3 -3
  24. package/lib/types/model/decorators.d.mts +3 -3
  25. package/lib/types/model/index.d.cts +4 -4
  26. package/lib/types/model/index.d.mts +4 -4
  27. package/lib/types/operations/Operations.d.cts +3 -3
  28. package/lib/types/operations/Operations.d.mts +3 -3
  29. package/lib/types/operations/OperationsRegistry.d.cts +3 -3
  30. package/lib/types/operations/OperationsRegistry.d.mts +3 -3
  31. package/lib/types/operations/decorators.d.cts +3 -3
  32. package/lib/types/operations/decorators.d.mts +3 -3
  33. package/lib/types/operations/index.d.cts +5 -5
  34. package/lib/types/operations/index.d.mts +5 -5
  35. package/lib/types/operations/types.d.cts +3 -3
  36. package/lib/types/operations/types.d.mts +3 -3
  37. package/lib/types/overrides/Model.d.cts +2 -2
  38. package/lib/types/overrides/Model.d.mts +2 -2
  39. package/lib/types/overrides/index.d.cts +4 -4
  40. package/lib/types/overrides/index.d.mts +4 -4
  41. package/lib/types/repository/Context.d.cts +4 -4
  42. package/lib/types/repository/Context.d.mts +4 -4
  43. package/lib/types/repository/Repository.d.cts +3 -3
  44. package/lib/types/repository/Repository.d.mts +3 -3
  45. package/lib/types/repository/constants.d.cts +1 -1
  46. package/lib/types/repository/constants.d.mts +1 -1
  47. package/lib/types/repository/index.d.cts +7 -7
  48. package/lib/types/repository/index.d.mts +7 -7
  49. package/lib/types/repository/types.d.cts +3 -3
  50. package/lib/types/repository/types.d.mts +3 -3
  51. package/lib/types/repository/utils.d.cts +3 -3
  52. package/lib/types/repository/utils.d.mts +3 -3
  53. package/lib/types/validation/decorators.d.cts +3 -3
  54. package/lib/types/validation/decorators.d.mts +3 -3
  55. package/lib/types/validation/index.d.cts +4 -4
  56. package/lib/types/validation/index.d.mts +4 -4
  57. package/lib/types/validation/validators/index.d.cts +3 -3
  58. package/lib/types/validation/validators/index.d.mts +3 -3
  59. package/package.json +13 -1
  60. package/lib/types/identity/decorators.d.ts +0 -8
  61. package/lib/types/identity/index.d.ts +0 -6
  62. package/lib/types/index.d.ts +0 -15
  63. package/lib/types/interfaces/BulkCrudOperator.d.ts +0 -47
  64. package/lib/types/interfaces/Contextual.d.ts +0 -23
  65. package/lib/types/interfaces/CrudOperator.d.ts +0 -46
  66. package/lib/types/interfaces/IRepository.d.ts +0 -19
  67. package/lib/types/interfaces/index.d.ts +0 -9
  68. package/lib/types/model/constants.d.ts +0 -37
  69. package/lib/types/model/decorators.d.ts +0 -145
  70. package/lib/types/model/index.d.ts +0 -9
  71. package/lib/types/model/model.d.ts +0 -6
  72. package/lib/types/model/validation.d.ts +0 -57
  73. package/lib/types/operations/Operations.d.ts +0 -80
  74. package/lib/types/operations/OperationsRegistry.d.ts +0 -72
  75. package/lib/types/operations/constants.d.ts +0 -106
  76. package/lib/types/operations/decorators.d.ts +0 -348
  77. package/lib/types/operations/index.d.ts +0 -10
  78. package/lib/types/operations/types.d.ts +0 -60
  79. package/lib/types/overrides/Metadata.d.ts +0 -54
  80. package/lib/types/overrides/Model.d.ts +0 -84
  81. package/lib/types/overrides/ModelBuilderExtensions.d.ts +0 -15
  82. package/lib/types/overrides/index.d.ts +0 -10
  83. package/lib/types/overrides/overrides.d.ts +0 -1
  84. package/lib/types/repository/Context.d.ts +0 -112
  85. package/lib/types/repository/Repository.d.ts +0 -352
  86. package/lib/types/repository/constants.d.ts +0 -9
  87. package/lib/types/repository/errors.d.ts +0 -126
  88. package/lib/types/repository/index.d.ts +0 -12
  89. package/lib/types/repository/types.d.ts +0 -62
  90. package/lib/types/repository/utils.d.ts +0 -34
  91. package/lib/types/repository/wrappers.d.ts +0 -39
  92. package/lib/types/validation/constants.d.ts +0 -45
  93. package/lib/types/validation/decorators.d.ts +0 -143
  94. package/lib/types/validation/index.d.ts +0 -4
  95. package/lib/types/validation/validation.d.ts +0 -41
  96. package/lib/types/validation/validators/ReadOnlyValidator.d.ts +0 -47
  97. package/lib/types/validation/validators/TimestampValidator.d.ts +0 -48
  98. package/lib/types/validation/validators/UpdateValidator.d.ts +0 -40
  99. package/lib/types/validation/validators/index.d.ts +0 -3
@@ -1,7 +1,7 @@
1
- import { OperationKeys } from "./constants.js";
2
- import { IRepository } from "../interfaces/IRepository.js";
1
+ import { OperationKeys } from "./constants.d.mts";
2
+ import { IRepository } from "../interfaces/IRepository.d.mts";
3
3
  import { Model } from "@decaf-ts/decorator-validation";
4
- import { ContextOfRepository } from "../repository/index.js";
4
+ import { ContextOfRepository } from "../repository/index.d.mts";
5
5
  /**
6
6
  * @description Metadata for database operations
7
7
  * @summary Contains information about an operation, its handler, and associated metadata
@@ -1,7 +1,7 @@
1
1
  import { Constructor } from "@decaf-ts/decoration";
2
2
  import "@decaf-ts/decorator-validation";
3
- import { ComposedFromMetadata } from "../model/index.cjs";
4
- import { Context } from "../repository/index.cjs";
3
+ import { ComposedFromMetadata } from "../model/index.d.cts";
4
+ import { Context } from "../repository/index.d.cts";
5
5
  declare module "@decaf-ts/decorator-validation" {
6
6
  interface Model {
7
7
  isTransient(): boolean;
@@ -1,7 +1,7 @@
1
1
  import { Constructor } from "@decaf-ts/decoration";
2
2
  import "@decaf-ts/decorator-validation";
3
- import { ComposedFromMetadata } from "../model/index.js";
4
- import { Context } from "../repository/index.js";
3
+ import { ComposedFromMetadata } from "../model/index.d.mts";
4
+ import { Context } from "../repository/index.d.mts";
5
5
  declare module "@decaf-ts/decorator-validation" {
6
6
  interface Model {
7
7
  isTransient(): boolean;
@@ -4,7 +4,7 @@
4
4
  * @module db-decorators/overrides
5
5
  */
6
6
  import "./overrides";
7
- export * from "./Model.cjs";
8
- export * from "./overrides.cjs";
9
- export * from "./Metadata.cjs";
10
- export * from "./ModelBuilderExtensions.cjs";
7
+ export * from "./Model.d.cts";
8
+ export * from "./overrides.d.cts";
9
+ export * from "./Metadata.d.cts";
10
+ export * from "./ModelBuilderExtensions.d.cts";
@@ -4,7 +4,7 @@
4
4
  * @module db-decorators/overrides
5
5
  */
6
6
  import "./overrides";
7
- export * from "./Model.js";
8
- export * from "./overrides.js";
9
- export * from "./Metadata.js";
10
- export * from "./ModelBuilderExtensions.js";
7
+ export * from "./Model.d.mts";
8
+ export * from "./overrides.d.mts";
9
+ export * from "./Metadata.d.mts";
10
+ export * from "./ModelBuilderExtensions.d.mts";
@@ -1,9 +1,9 @@
1
- import { ContextArgs } from "./utils.cjs";
2
- import { Contextual, FlagsOf } from "../interfaces/Contextual.cjs";
3
- import { OperationKeys } from "../operations/constants.cjs";
1
+ import { ContextArgs } from "./utils.d.cts";
2
+ import { Contextual, FlagsOf } from "../interfaces/Contextual.d.cts";
3
+ import { OperationKeys } from "../operations/constants.d.cts";
4
4
  import { Model } from "@decaf-ts/decorator-validation";
5
5
  import { ObjectAccumulator } from "typed-object-accumulator";
6
- import { ContextFlags, FlagsOfContext, LoggerOfFlags, RepositoryFlags } from "./types.cjs";
6
+ import { ContextFlags, FlagsOfContext, LoggerOfFlags, RepositoryFlags } from "./types.d.cts";
7
7
  import { Constructor } from "@decaf-ts/decoration";
8
8
  /**
9
9
  * @description Factory type for creating context instances.
@@ -1,9 +1,9 @@
1
- import { ContextArgs } from "./utils.js";
2
- import { Contextual, FlagsOf } from "../interfaces/Contextual.js";
3
- import { OperationKeys } from "../operations/constants.js";
1
+ import { ContextArgs } from "./utils.d.mts";
2
+ import { Contextual, FlagsOf } from "../interfaces/Contextual.d.mts";
3
+ import { OperationKeys } from "../operations/constants.d.mts";
4
4
  import { Model } from "@decaf-ts/decorator-validation";
5
5
  import { ObjectAccumulator } from "typed-object-accumulator";
6
- import { ContextFlags, FlagsOfContext, LoggerOfFlags, RepositoryFlags } from "./types.js";
6
+ import { ContextFlags, FlagsOfContext, LoggerOfFlags, RepositoryFlags } from "./types.d.mts";
7
7
  import { Constructor } from "@decaf-ts/decoration";
8
8
  /**
9
9
  * @description Factory type for creating context instances.
@@ -1,8 +1,8 @@
1
1
  import "../overrides";
2
- import { IRepository } from "../interfaces/IRepository.cjs";
2
+ import { IRepository } from "../interfaces/IRepository.d.cts";
3
3
  import { Model } from "@decaf-ts/decorator-validation";
4
- import { Context } from "./Context.cjs";
5
- import { PrimaryKeyType, RepositoryFlags } from "./types.cjs";
4
+ import { Context } from "./Context.d.cts";
5
+ import { PrimaryKeyType, RepositoryFlags } from "./types.d.cts";
6
6
  import { Constructor } from "@decaf-ts/decoration";
7
7
  /**
8
8
  * @description Base repository implementation providing CRUD operations for models.
@@ -1,8 +1,8 @@
1
1
  import "../overrides";
2
- import { IRepository } from "../interfaces/IRepository.js";
2
+ import { IRepository } from "../interfaces/IRepository.d.mts";
3
3
  import { Model } from "@decaf-ts/decorator-validation";
4
- import { Context } from "./Context.js";
5
- import { PrimaryKeyType, RepositoryFlags } from "./types.js";
4
+ import { Context } from "./Context.d.mts";
5
+ import { PrimaryKeyType, RepositoryFlags } from "./types.d.mts";
6
6
  import { Constructor } from "@decaf-ts/decoration";
7
7
  /**
8
8
  * @description Base repository implementation providing CRUD operations for models.
@@ -1,4 +1,4 @@
1
- import { RepositoryFlags } from "./types.cjs";
1
+ import { RepositoryFlags } from "./types.d.cts";
2
2
  /**
3
3
  * @description Default configuration flags for repository operations.
4
4
  * @summary Provides default values for repository operation flags, excluding the timestamp property.
@@ -1,4 +1,4 @@
1
- import { RepositoryFlags } from "./types.js";
1
+ import { RepositoryFlags } from "./types.d.mts";
2
2
  /**
3
3
  * @description Default configuration flags for repository operations.
4
4
  * @summary Provides default values for repository operation flags, excluding the timestamp property.
@@ -3,10 +3,10 @@
3
3
  * @summary This file exports all the necessary components for the repository functionality, including the Repository class, constants, context, errors, types, and utils.
4
4
  * @module db-decorators/repository
5
5
  */
6
- export * from "./Repository.cjs";
7
- export * from "./constants.cjs";
8
- export * from "./Context.cjs";
9
- export * from "./errors.cjs";
10
- export * from "./types.cjs";
11
- export * from "./utils.cjs";
12
- export * from "./wrappers.cjs";
6
+ export * from "./Repository.d.cts";
7
+ export * from "./constants.d.cts";
8
+ export * from "./Context.d.cts";
9
+ export * from "./errors.d.cts";
10
+ export * from "./types.d.cts";
11
+ export * from "./utils.d.cts";
12
+ export * from "./wrappers.d.cts";
@@ -3,10 +3,10 @@
3
3
  * @summary This file exports all the necessary components for the repository functionality, including the Repository class, constants, context, errors, types, and utils.
4
4
  * @module db-decorators/repository
5
5
  */
6
- export * from "./Repository.js";
7
- export * from "./constants.js";
8
- export * from "./Context.js";
9
- export * from "./errors.js";
10
- export * from "./types.js";
11
- export * from "./utils.js";
12
- export * from "./wrappers.js";
6
+ export * from "./Repository.d.mts";
7
+ export * from "./constants.d.mts";
8
+ export * from "./Context.d.mts";
9
+ export * from "./errors.d.mts";
10
+ export * from "./types.d.mts";
11
+ export * from "./utils.d.mts";
12
+ export * from "./wrappers.d.mts";
@@ -1,9 +1,9 @@
1
- import { Context } from "./Context.cjs";
1
+ import { Context } from "./Context.d.cts";
2
2
  import { ExtendedMetadata, Model } from "@decaf-ts/decorator-validation";
3
- import { OperationKeys } from "../operations/index.cjs";
3
+ import { OperationKeys } from "../operations/index.d.cts";
4
4
  import { Constructor } from "@decaf-ts/decoration";
5
5
  import { Logger } from "@decaf-ts/logging";
6
- import { IRepository } from "../interfaces/index.cjs";
6
+ import { IRepository } from "../interfaces/index.d.cts";
7
7
  /**
8
8
  * @description Type utility for ensuring model extension.
9
9
  * @summary A conditional type that ensures a type extends the Model class.
@@ -1,9 +1,9 @@
1
- import { Context } from "./Context.js";
1
+ import { Context } from "./Context.d.mts";
2
2
  import { ExtendedMetadata, Model } from "@decaf-ts/decorator-validation";
3
- import { OperationKeys } from "../operations/index.js";
3
+ import { OperationKeys } from "../operations/index.d.mts";
4
4
  import { Constructor } from "@decaf-ts/decoration";
5
5
  import { Logger } from "@decaf-ts/logging";
6
- import { IRepository } from "../interfaces/index.js";
6
+ import { IRepository } from "../interfaces/index.d.mts";
7
7
  /**
8
8
  * @description Type utility for ensuring model extension.
9
9
  * @summary A conditional type that ensures a type extends the Model class.
@@ -1,7 +1,7 @@
1
- import { IRepository } from "../interfaces/IRepository.cjs";
1
+ import { IRepository } from "../interfaces/IRepository.d.cts";
2
2
  import { Model, ModelErrorDefinition } from "@decaf-ts/decorator-validation";
3
- import { Context } from "./Context.cjs";
4
- import { ContextOfRepository } from "./types.cjs";
3
+ import { Context } from "./Context.d.cts";
4
+ import { ContextOfRepository } from "./types.d.cts";
5
5
  export type ContextArgs<C extends Context<any>> = {
6
6
  context: C;
7
7
  args: [...any[], C];
@@ -1,7 +1,7 @@
1
- import { IRepository } from "../interfaces/IRepository.js";
1
+ import { IRepository } from "../interfaces/IRepository.d.mts";
2
2
  import { Model, ModelErrorDefinition } from "@decaf-ts/decorator-validation";
3
- import { Context } from "./Context.js";
4
- import { ContextOfRepository } from "./types.js";
3
+ import { Context } from "./Context.d.mts";
4
+ import { ContextOfRepository } from "./types.d.mts";
5
5
  export type ContextArgs<C extends Context<any>> = {
6
6
  context: C;
7
7
  args: [...any[], C];
@@ -1,9 +1,9 @@
1
1
  import "./validation";
2
2
  import { Model, Serializer } from "@decaf-ts/decorator-validation";
3
- import { OperationKeys } from "../operations/constants.cjs";
4
- import { IRepository } from "../interfaces/IRepository.cjs";
3
+ import { OperationKeys } from "../operations/constants.d.cts";
4
+ import { IRepository } from "../interfaces/IRepository.d.cts";
5
5
  import { Constructor } from "@decaf-ts/decoration";
6
- import { ContextOfRepository } from "../repository/index.cjs";
6
+ import { ContextOfRepository } from "../repository/index.d.cts";
7
7
  /**
8
8
  * @description Prevents a property from being modified after initial creation.
9
9
  * @summary Marks the property as readonly, causing validation errors if attempts are made to modify it during updates.
@@ -1,9 +1,9 @@
1
1
  import "./validation";
2
2
  import { Model, Serializer } from "@decaf-ts/decorator-validation";
3
- import { OperationKeys } from "../operations/constants.js";
4
- import { IRepository } from "../interfaces/IRepository.js";
3
+ import { OperationKeys } from "../operations/constants.d.mts";
4
+ import { IRepository } from "../interfaces/IRepository.d.mts";
5
5
  import { Constructor } from "@decaf-ts/decoration";
6
- import { ContextOfRepository } from "../repository/index.js";
6
+ import { ContextOfRepository } from "../repository/index.d.mts";
7
7
  /**
8
8
  * @description Prevents a property from being modified after initial creation.
9
9
  * @summary Marks the property as readonly, causing validation errors if attempts are made to modify it during updates.
@@ -1,4 +1,4 @@
1
- export * from "./validators/index.cjs";
2
- export * from "./constants.cjs";
3
- export * from "./decorators.cjs";
4
- export * from "./validation.cjs";
1
+ export * from "./validators/index.d.cts";
2
+ export * from "./constants.d.cts";
3
+ export * from "./decorators.d.cts";
4
+ export * from "./validation.d.cts";
@@ -1,4 +1,4 @@
1
- export * from "./validators/index.js";
2
- export * from "./constants.js";
3
- export * from "./decorators.js";
4
- export * from "./validation.js";
1
+ export * from "./validators/index.d.mts";
2
+ export * from "./constants.d.mts";
3
+ export * from "./decorators.d.mts";
4
+ export * from "./validation.d.mts";
@@ -1,3 +1,3 @@
1
- export * from "./ReadOnlyValidator.cjs";
2
- export * from "./TimestampValidator.cjs";
3
- export * from "./UpdateValidator.cjs";
1
+ export * from "./ReadOnlyValidator.d.cts";
2
+ export * from "./TimestampValidator.d.cts";
3
+ export * from "./UpdateValidator.d.cts";
@@ -1,3 +1,3 @@
1
- export * from "./ReadOnlyValidator.js";
2
- export * from "./TimestampValidator.js";
3
- export * from "./UpdateValidator.js";
1
+ export * from "./ReadOnlyValidator.d.mts";
2
+ export * from "./TimestampValidator.d.mts";
3
+ export * from "./UpdateValidator.d.mts";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decaf-ts/db-decorators",
3
- "version": "0.16.0",
3
+ "version": "0.17.1",
4
4
  "description": "Agnostic database decorators and repository",
5
5
  "type": "module",
6
6
  "exports": {
@@ -97,6 +97,18 @@
97
97
  "main": "./lib/cjs/index.cjs",
98
98
  "module": "./lib/esm/index.js",
99
99
  "sideEffects": [
100
+ "./lib/esm/index.js",
101
+ "./lib/cjs/index.cjs",
102
+ "./lib/esm/validation/index.js",
103
+ "./lib/esm/validation/validators/index.js",
104
+ "./lib/esm/validation/validators/ReadOnlyValidator.js",
105
+ "./lib/esm/validation/validators/TimestampValidator.js",
106
+ "./lib/esm/validation/validators/UpdateValidator.js",
107
+ "./lib/cjs/validation/index.cjs",
108
+ "./lib/cjs/validation/validators/index.cjs",
109
+ "./lib/cjs/validation/validators/ReadOnlyValidator.cjs",
110
+ "./lib/cjs/validation/validators/TimestampValidator.cjs",
111
+ "./lib/cjs/validation/validators/UpdateValidator.cjs",
100
112
  "./lib/esm/overrides/index.js",
101
113
  "./lib/esm/overrides/overrides.js",
102
114
  "./lib/esm/validation/validation.js",
@@ -1,8 +0,0 @@
1
- /**
2
- * @description Decorator that marks a property as an ID field
3
- * @summary Creates a composite decorator that marks a property as required, readonly, and as the ID field for database operations
4
- * @return {PropertyDecorator} A decorator that can be applied to class properties
5
- * @function id
6
- * @category Property Decorators
7
- */
8
- export declare function id(): (target: object, propertyKey?: string | symbol | unknown, descriptor?: PropertyDescriptor | number) => void;
@@ -1,6 +0,0 @@
1
- /**
2
- * @description Exports for the identity module.
3
- * @summary This file exports all the necessary components for the identity functionality, including decorators.
4
- * @module db-decorators/identity
5
- */
6
- export * from "./decorators";
@@ -1,15 +0,0 @@
1
- export * from "./identity";
2
- export * from "./interfaces";
3
- export * from "./model";
4
- export * from "./operations";
5
- export * from "./overrides";
6
- export * from "./repository";
7
- export * from "./validation";
8
- /**
9
- * @description Current version of the reflection package
10
- * @summary Stores the semantic version number of the package
11
- * @const VERSION
12
- * @memberOf module:db-decorators
13
- */
14
- export declare const VERSION = "0.15.0";
15
- export declare const PACKAGE_NAME = "@decaf-ts/db-decorators";
@@ -1,47 +0,0 @@
1
- import { CrudOperator } from "./CrudOperator";
2
- import { PrimaryKeyType } from "../repository/index";
3
- /**
4
- * @description Interface for bulk CRUD operations
5
- * @summary Extends the basic CRUD operations to support bulk operations on multiple models at once
6
- * @template M - The model type
7
- * @interface BulkCrudOperator
8
- * @memberOf module:db-decorators
9
- */
10
- export interface BulkCrudOperator<M> extends CrudOperator<M> {
11
- /**
12
- * @description Creates multiple model instances in the database
13
- * @summary Bulk operation to create multiple models at once
14
- * @template M - The model type
15
- * @param {M[]} models - Array of model instances to create
16
- * @param {...any[]} args - Additional arguments
17
- * @return {Promise<M[]>} Promise resolving to the created model instances
18
- */
19
- createAll(models: M[], ...args: any[]): Promise<M[]>;
20
- /**
21
- * @description Retrieves multiple model instances from the database by their keys
22
- * @summary Bulk operation to read multiple models at once
23
- * @template M - The model type
24
- * @param {(PrimaryKeyType[])} keys - Array of primary keys to retrieve
25
- * @param {...any[]} args - Additional arguments
26
- * @return {Promise<M[]>} Promise resolving to the retrieved model instances
27
- */
28
- readAll(keys: PrimaryKeyType[], ...args: any[]): Promise<M[]>;
29
- /**
30
- * @description Updates multiple model instances in the database
31
- * @summary Bulk operation to update multiple models at once
32
- * @template M - The model type
33
- * @param {M[]} models - Array of model instances to update
34
- * @param {...any[]} args - Additional arguments
35
- * @return {Promise<M[]>} Promise resolving to the updated model instances
36
- */
37
- updateAll(models: M[], ...args: any[]): Promise<M[]>;
38
- /**
39
- * @description Deletes multiple model instances from the database by their keys
40
- * @summary Bulk operation to delete multiple models at once
41
- * @template M - The model type
42
- * @param {(PrimaryKeyType[])} keys - Array of primary keys to delete
43
- * @param {...any[]} args - Additional arguments
44
- * @return {Promise<M[]>} Promise resolving to the deleted model instances
45
- */
46
- deleteAll(keys: PrimaryKeyType[], ...args: any[]): Promise<M[]>;
47
- }
@@ -1,23 +0,0 @@
1
- import { OperationKeys } from "../operations";
2
- import { Context } from "../repository";
3
- export type FlagsOf<C extends Context<any>> = C extends Context<infer T> ? T : never;
4
- /**
5
- * @description Interface for context-aware operations
6
- * @summary Provides context management for database operations
7
- * @template F - Type extending RepositoryFlags, defaults to RepositoryFlags
8
- * @template C - Type extending Context<F>, defaults to Context<F>
9
- * @interface Contextual
10
- * @memberOf module:db-decorators
11
- */
12
- export interface Contextual<C extends Context<any> = Context<any>> {
13
- /**
14
- * @description Creates a context for a specific operation
15
- * @summary Generates an operation-specific context with custom flags
16
- * @param {(OperationKeys.CREATE|OperationKeys.READ|OperationKeys.UPDATE|OperationKeys.DELETE)} operation - The operation type
17
- * @template F - Type extending RepositoryFlags, defaults to RepositoryFlags
18
- * @param {Partial<F>} overrides - Custom flag overrides for this context
19
- * @param {...any[]} args - Additional arguments
20
- * @return {Promise<C>} Promise resolving to the created context
21
- */
22
- context(operation: ((...args: any[]) => any) | OperationKeys.CREATE | OperationKeys.READ | OperationKeys.UPDATE | OperationKeys.DELETE | string, overrides: Partial<FlagsOf<C>>, ...args: any[]): Promise<C>;
23
- }
@@ -1,46 +0,0 @@
1
- import { PrimaryKeyType } from "../repository/index";
2
- /**
3
- * @description Basic CRUD operations interface
4
- * @summary Exposes a standard Create, Read, Update, Delete API for database operations
5
- * @template M - The model type
6
- * @interface CrudOperator
7
- * @memberOf module:db-decorators
8
- */
9
- export interface CrudOperator<M> {
10
- /**
11
- * @description Creates a new model instance in the database
12
- * @summary Create a new model
13
- * @template M - The model type
14
- * @param {M} model - The model instance to create
15
- * @param {...any[]} args - Additional arguments
16
- * @return {Promise<M>} Promise resolving to the created model instance
17
- */
18
- create(model: M, ...args: any[]): Promise<M>;
19
- /**
20
- * @description Retrieves a model instance from the database by its key
21
- * @summary Read a model
22
- * @template M - The model type
23
- * @param {PrimaryKeyType} key - The primary key of the model to retrieve
24
- * @param {...any[]} args - Additional arguments
25
- * @return {Promise<M>} Promise resolving to the retrieved model instance
26
- */
27
- read(key: PrimaryKeyType, ...args: any[]): Promise<M>;
28
- /**
29
- * @description Updates a model instance in the database
30
- * @summary Update a model
31
- * @template M - The model type
32
- * @param {M} model - The model instance to update
33
- * @param {...any[]} args - Additional arguments
34
- * @return {Promise<M>} Promise resolving to the updated model instance
35
- */
36
- update(model: M, ...args: any[]): Promise<M>;
37
- /**
38
- * @description Deletes a model instance from the database by its key
39
- * @summary Delete a model
40
- * @template M - The model type
41
- * @param {PrimaryKeyType} key - The primary key of the model to delete
42
- * @param {...any[]} args - Additional arguments
43
- * @return {Promise<M>} Promise resolving to the deleted model instance
44
- */
45
- delete(key: PrimaryKeyType, ...args: any[]): Promise<M>;
46
- }
@@ -1,19 +0,0 @@
1
- import { Model, ModelConstructor } from "@decaf-ts/decorator-validation";
2
- import { BulkCrudOperator } from "./BulkCrudOperator";
3
- import { Context, RepositoryFlags } from "../repository";
4
- /**
5
- * @description Repository interface for database operations
6
- * @summary Interface holding basic CRUD APIs for database models, providing standard operations and metadata
7
- * @template M - Type extending Model
8
- * @template F - Type extending RepositoryFlags, defaults to RepositoryFlags
9
- * @template C - Type extending Context<F>, defaults to Context<F>
10
- * @interface IRepository
11
- * @memberOf module:db-decorators
12
- */
13
- export interface IRepository<M extends Model<boolean>, C extends Context<any> = Context<RepositoryFlags>> extends BulkCrudOperator<M> {
14
- /**
15
- * @description The constructor of the model class
16
- * @summary Reference to the model class constructor used to create new instances
17
- */
18
- readonly class: ModelConstructor<M>;
19
- }
@@ -1,9 +0,0 @@
1
- /**
2
- * @description Exports for the interfaces module.
3
- * @summary This file exports all the necessary components for the interfaces functionality, including BulkCrudOperator, Contextual, CrudOperator, and IRepository.
4
- * @module db-decorators/interfaces
5
- */
6
- export * from "./BulkCrudOperator";
7
- export * from "./Contextual";
8
- export * from "./CrudOperator";
9
- export * from "./IRepository";
@@ -1,37 +0,0 @@
1
- /**
2
- * @description Database reflection keys
3
- * @summary Collection of keys used for reflection metadata in database operations
4
- * @const DBKeys
5
- * @memberOf module:db-decorators
6
- */
7
- export declare const DBKeys: {
8
- REFLECT: string;
9
- REPOSITORY: string;
10
- CLASS: string;
11
- ID: string;
12
- INDEX: string;
13
- UNIQUE: string;
14
- SERIALIZE: string;
15
- READONLY: string;
16
- TIMESTAMP: string;
17
- TRANSIENT: string;
18
- HASH: string;
19
- COMPOSED: string;
20
- GENERATED: string;
21
- VERSION: string;
22
- ORIGINAL: string;
23
- };
24
- /**
25
- * @description Default separator character for composite indexes
26
- * @summary The default separator character used when concatenating multiple fields into a single index
27
- * @const DefaultSeparator
28
- * @memberOf module:db-decorators
29
- */
30
- export declare const DefaultSeparator = "_";
31
- /**
32
- * @description Default format for timestamp fields
33
- * @summary Standard date format string used for timestamp fields in database models
34
- * @const DEFAULT_TIMESTAMP_FORMAT
35
- * @memberOf module:db-decorators
36
- */
37
- export declare const DEFAULT_TIMESTAMP_FORMAT = "dd/MM/yyyy HH:mm:ss:S";