@plyaz/types 1.22.7 → 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?: unknown;
131
+ cache?: TCache;
113
132
  /** Database service instance */
114
- db?: unknown;
115
- /** API client instance */
116
- api?: unknown;
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
- error: unknown;
209
+ /** Array of serialized errors */
210
+ errors: SerializedError[];
211
+ /** Error context description */
210
212
  context?: string;
211
- recoverable: boolean;
213
+ /** Whether the error is recoverable */
214
+ recoverable?: boolean;
212
215
  }
213
216
  /**
214
217
  * Payload for system:warning events
@@ -837,18 +837,6 @@ export interface CoreFeatureFlagStoreInitConfig {
837
837
  * Base service config for frontend services (constructor config)
838
838
  */
839
839
  export interface CoreBaseFrontendServiceConstructorConfig<TConfig extends CoreBaseFrontendServiceConfig<TData, TStore>, TStore extends CoreBaseFrontendStore<TData>, TData = Record<string, unknown>, TMapper extends CoreBaseMapperInstance = CoreBaseMapperInstance, TValidator extends CoreBaseValidatorInstance = CoreBaseValidatorInstance> extends CoreBaseServiceConfig<TConfig, TMapper, TValidator> {
840
- /**
841
- * Data key used for store sync - indicates which property in the store contains the primary data.
842
- *
843
- * Examples:
844
- * - For feature flags: 'flags' (store has flags property)
845
- * - For items/entities: 'items' (store has items property)
846
- * - For nested data: 'nested.items' (store has nested.items)
847
- *
848
- * This is used as metadata and for potential helper methods.
849
- * For custom sync behavior, use `storeHandlers` in serviceConfig instead.
850
- */
851
- storeDataKey?: string;
852
840
  }
853
841
  /**
854
842
  * Props for initialization error component
@@ -9,6 +9,7 @@ import type { CreateExampleSchema, UpdateExampleSchema, PatchExampleSchema, Quer
9
9
  import type { CoreEntityCreatedPayload, CoreEntityUpdatedPayload, CoreEntityDeletedPayload, CoreValidationFailedPayload } from '../core/events';
10
10
  import type { CoreBaseFrontendStore, CoreBaseFrontendServiceConfig } from '../core/frontend';
11
11
  import type { CoreServiceInitConfig } from '../core/init';
12
+ import type { CoreInjectedServices } from '../core/domain';
12
13
  /**
13
14
  * Create request DTO (POST body)
14
15
  */
@@ -144,6 +145,8 @@ export interface ExampleFrontendServiceConfig extends CoreBaseFrontendServiceCon
144
145
  autoFetch?: boolean;
145
146
  /** Polling interval in ms (0 = disabled) */
146
147
  pollingInterval?: number;
148
+ /** Injected services (for testing/manual store injection) */
149
+ injected?: CoreInjectedServices;
147
150
  }
148
151
  /**
149
152
  * Example frontend event types
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plyaz/types",
3
- "version": "1.22.7",
3
+ "version": "1.22.9",
4
4
  "author": "Redeemer Pace",
5
5
  "license": "ISC",
6
6
  "description": "Provides shared TypeScript types and schema utilities for validation and parsing in the @playz ecosystem.",