@plyaz/types 1.22.8 → 1.22.9
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.
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* CRUD Operation Types
|
|
3
3
|
* Type definitions for CRUD operations in @plyaz/core domain services
|
|
4
4
|
*/
|
|
5
|
+
import type { TransactionOptions } from '../../db/Transaction';
|
|
5
6
|
/**
|
|
6
7
|
* Cache-specific options for CRUD operations
|
|
7
8
|
*/
|
|
@@ -15,6 +16,16 @@ export interface CrudCacheOptions {
|
|
|
15
16
|
/** Custom cache key (will still be prefixed with cachePrefix) */
|
|
16
17
|
customKey?: string;
|
|
17
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Transaction-specific options for CRUD operations
|
|
21
|
+
*/
|
|
22
|
+
export interface CrudTransactionOptions extends TransactionOptions {
|
|
23
|
+
/**
|
|
24
|
+
* Enable transaction for bulk operations (default: false for backwards compatibility)
|
|
25
|
+
* When true, all operations in bulkCreate/bulkDelete will be atomic
|
|
26
|
+
*/
|
|
27
|
+
useTransaction?: boolean;
|
|
28
|
+
}
|
|
18
29
|
/**
|
|
19
30
|
* Options for CRUD operations (create, getById, patch, delete, getAll)
|
|
20
31
|
*
|
|
@@ -24,4 +35,6 @@ export interface CrudCacheOptions {
|
|
|
24
35
|
export interface CrudOperationOptions {
|
|
25
36
|
/** Cache-related options */
|
|
26
37
|
cache?: CrudCacheOptions;
|
|
38
|
+
/** Transaction-related options (for bulk operations) */
|
|
39
|
+
transaction?: CrudTransactionOptions;
|
|
27
40
|
}
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* Type definitions for @plyaz/core domain services
|
|
4
4
|
*/
|
|
5
5
|
export type { CoreBaseDomainServiceInterface, CoreEventSubscribable, CoreProviderSubscribable, CoreValidationResult, CoreValidatorConfig, CoreBaseValidatorInstance, CoreBaseMapperInstance, CoreBaseDomainServiceConfig, CoreBaseBackendServiceConfig, CoreMapperClass, CoreValidatorClass, CoreBaseServiceConfig, CoreInjectedServices, } from './types';
|
|
6
|
-
export type { CrudCacheOptions, CrudOperationOptions, } from './crud';
|
|
6
|
+
export type { CrudCacheOptions, CrudTransactionOptions, CrudOperationOptions, } from './crud';
|
|
@@ -106,14 +106,33 @@ export type CoreValidatorClass<T extends CoreBaseValidatorInstance = CoreBaseVal
|
|
|
106
106
|
/**
|
|
107
107
|
* Injected services/dependencies for domain services.
|
|
108
108
|
* These are created/managed by ServiceRegistry and injected into services.
|
|
109
|
+
*
|
|
110
|
+
* @typeParam TCache - Cache manager type (defaults to unknown for flexibility)
|
|
111
|
+
* @typeParam TDb - Database service type (defaults to unknown for flexibility)
|
|
112
|
+
* @typeParam TApi - API client type (defaults to unknown for flexibility)
|
|
113
|
+
* @typeParam TStores - Store types map (defaults to unknown)
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* ```typescript
|
|
117
|
+
* // With specific types
|
|
118
|
+
* interface MyInjectedServices extends CoreInjectedServices<
|
|
119
|
+
* CacheManager,
|
|
120
|
+
* DatabaseServiceInterface,
|
|
121
|
+
* ApiClient,
|
|
122
|
+
* { users: UserStoreSlice }
|
|
123
|
+
* > {}
|
|
124
|
+
*
|
|
125
|
+
* // With defaults (unknown types)
|
|
126
|
+
* interface BasicInjectedServices extends CoreInjectedServices {}
|
|
127
|
+
* ```
|
|
109
128
|
*/
|
|
110
|
-
export interface CoreInjectedServices<TStores = unknown> {
|
|
129
|
+
export interface CoreInjectedServices<TCache = unknown, TDb = unknown, TApi = unknown, TStores = unknown> {
|
|
111
130
|
/** Cache manager instance */
|
|
112
|
-
cache?:
|
|
131
|
+
cache?: TCache;
|
|
113
132
|
/** Database service instance */
|
|
114
|
-
db?:
|
|
115
|
-
/** API client instance */
|
|
116
|
-
api?:
|
|
133
|
+
db?: TDb;
|
|
134
|
+
/** API client instance (supports multiple API clients via generics) */
|
|
135
|
+
api?: TApi;
|
|
117
136
|
/**
|
|
118
137
|
* Store instances (from root store) keyed by store key.
|
|
119
138
|
* Type-safe: each key maps to its specific slice type.
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* ```
|
|
14
14
|
*/
|
|
15
15
|
import type { CORE_EVENTS } from './enums';
|
|
16
|
-
import type { PackageErrorLike } from '../../errors';
|
|
16
|
+
import type { PackageErrorLike, SerializedError } from '../../errors';
|
|
17
17
|
/**
|
|
18
18
|
* Core event structure
|
|
19
19
|
*
|
|
@@ -206,9 +206,12 @@ export interface CoreSystemShutdownPayload {
|
|
|
206
206
|
* Payload for system:error events
|
|
207
207
|
*/
|
|
208
208
|
export interface CoreSystemErrorPayload {
|
|
209
|
-
|
|
209
|
+
/** Array of serialized errors */
|
|
210
|
+
errors: SerializedError[];
|
|
211
|
+
/** Error context description */
|
|
210
212
|
context?: string;
|
|
211
|
-
recoverable
|
|
213
|
+
/** Whether the error is recoverable */
|
|
214
|
+
recoverable?: boolean;
|
|
212
215
|
}
|
|
213
216
|
/**
|
|
214
217
|
* Payload for system:warning events
|
package/package.json
CHANGED