@plyaz/core 1.9.3 → 1.9.4
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.
- package/dist/domain/base/BaseFrontendDomainService.d.ts +55 -0
- package/dist/domain/base/BaseFrontendDomainService.d.ts.map +1 -1
- package/dist/domain/example/FrontendExampleDomainService.d.ts +0 -12
- package/dist/domain/example/FrontendExampleDomainService.d.ts.map +1 -1
- package/dist/entry-backend.js +97 -49
- package/dist/entry-backend.js.map +1 -1
- package/dist/entry-backend.mjs +97 -49
- package/dist/entry-backend.mjs.map +1 -1
- package/dist/entry-frontend-browser.js +95 -47
- package/dist/entry-frontend-browser.js.map +1 -1
- package/dist/entry-frontend-browser.mjs +95 -47
- package/dist/entry-frontend-browser.mjs.map +1 -1
- package/dist/entry-frontend.js +95 -47
- package/dist/entry-frontend.js.map +1 -1
- package/dist/entry-frontend.mjs +95 -47
- package/dist/entry-frontend.mjs.map +1 -1
- package/dist/index.js +95 -47
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +95 -47
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/entry-backend.mjs
CHANGED
|
@@ -4533,12 +4533,13 @@ var init_BaseDomainService = __esm({
|
|
|
4533
4533
|
};
|
|
4534
4534
|
}
|
|
4535
4535
|
});
|
|
4536
|
-
var BaseFrontendDomainService;
|
|
4536
|
+
var DEFAULT_POLLING_INTERVAL_MS, BaseFrontendDomainService;
|
|
4537
4537
|
var init_BaseFrontendDomainService = __esm({
|
|
4538
4538
|
"src/domain/base/BaseFrontendDomainService.ts"() {
|
|
4539
4539
|
init_BaseDomainService();
|
|
4540
4540
|
init_CoreEventManager();
|
|
4541
4541
|
init_CoreInitializer();
|
|
4542
|
+
DEFAULT_POLLING_INTERVAL_MS = 3e4;
|
|
4542
4543
|
BaseFrontendDomainService = class _BaseFrontendDomainService extends BaseDomainService {
|
|
4543
4544
|
// ─────────────────────────────────────────────────────────────────────────
|
|
4544
4545
|
// Constructor
|
|
@@ -4564,6 +4565,11 @@ var init_BaseFrontendDomainService = __esm({
|
|
|
4564
4565
|
this._rollbackStack = [];
|
|
4565
4566
|
/** Maximum rollback stack size */
|
|
4566
4567
|
this._maxRollbackStackSize = 10;
|
|
4568
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
4569
|
+
// Polling Properties
|
|
4570
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
4571
|
+
/** Polling timer reference */
|
|
4572
|
+
this._pollingTimer = null;
|
|
4567
4573
|
this.storeHandlers = config.serviceConfig.storeHandlers;
|
|
4568
4574
|
this.optimisticConfig = config.serviceConfig.optimisticUpdates;
|
|
4569
4575
|
if (config.mapperClass) {
|
|
@@ -5590,6 +5596,87 @@ var init_BaseFrontendDomainService = __esm({
|
|
|
5590
5596
|
this.logDebug(`Event emitted: ${eventName}`, payload);
|
|
5591
5597
|
}
|
|
5592
5598
|
// ─────────────────────────────────────────────────────────────────────────
|
|
5599
|
+
// Polling (Generic Feature)
|
|
5600
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
5601
|
+
/**
|
|
5602
|
+
* Check if polling is currently active.
|
|
5603
|
+
*/
|
|
5604
|
+
get isPolling() {
|
|
5605
|
+
return this._pollingTimer !== null;
|
|
5606
|
+
}
|
|
5607
|
+
/**
|
|
5608
|
+
* Start polling for updates.
|
|
5609
|
+
* Uses `config.pollingInterval` if set, otherwise uses DEFAULT_POLLING_INTERVAL_MS (30s).
|
|
5610
|
+
* Polling calls fetchAll() at the configured interval.
|
|
5611
|
+
*
|
|
5612
|
+
* Override in subclass for custom polling behavior.
|
|
5613
|
+
*
|
|
5614
|
+
* @example
|
|
5615
|
+
* ```typescript
|
|
5616
|
+
* // Start polling with config interval
|
|
5617
|
+
* service.startPolling();
|
|
5618
|
+
*
|
|
5619
|
+
* // Or override in subclass for custom behavior
|
|
5620
|
+
* startPolling(): void {
|
|
5621
|
+
* super.startPolling();
|
|
5622
|
+
* // Custom polling logic
|
|
5623
|
+
* }
|
|
5624
|
+
* ```
|
|
5625
|
+
*/
|
|
5626
|
+
startPolling() {
|
|
5627
|
+
if (this._pollingTimer) return;
|
|
5628
|
+
const interval = this.config.pollingInterval || DEFAULT_POLLING_INTERVAL_MS;
|
|
5629
|
+
this._pollingTimer = setInterval(() => {
|
|
5630
|
+
this.fetchAll().catch((error) => {
|
|
5631
|
+
this.logError("Polling fetch failed", { error });
|
|
5632
|
+
});
|
|
5633
|
+
}, interval);
|
|
5634
|
+
this.logDebug("Polling started", { interval });
|
|
5635
|
+
}
|
|
5636
|
+
/**
|
|
5637
|
+
* Stop polling.
|
|
5638
|
+
* Safe to call even if polling is not active.
|
|
5639
|
+
*/
|
|
5640
|
+
stopPolling() {
|
|
5641
|
+
if (this._pollingTimer) {
|
|
5642
|
+
clearInterval(this._pollingTimer);
|
|
5643
|
+
this._pollingTimer = null;
|
|
5644
|
+
this.logDebug("Polling stopped");
|
|
5645
|
+
}
|
|
5646
|
+
}
|
|
5647
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
5648
|
+
// Lifecycle Management
|
|
5649
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
5650
|
+
/**
|
|
5651
|
+
* Dispose service and cleanup resources.
|
|
5652
|
+
* Stops polling and performs base cleanup.
|
|
5653
|
+
*
|
|
5654
|
+
* Subclasses should override and call super.dispose() to ensure cleanup.
|
|
5655
|
+
*
|
|
5656
|
+
* @example
|
|
5657
|
+
* ```typescript
|
|
5658
|
+
* dispose(): void {
|
|
5659
|
+
* // Custom cleanup
|
|
5660
|
+
* this.customCleanup();
|
|
5661
|
+
* // Always call super
|
|
5662
|
+
* super.dispose();
|
|
5663
|
+
* }
|
|
5664
|
+
* ```
|
|
5665
|
+
*/
|
|
5666
|
+
dispose() {
|
|
5667
|
+
this.stopPolling();
|
|
5668
|
+
this.logInfo("Service disposed");
|
|
5669
|
+
}
|
|
5670
|
+
/**
|
|
5671
|
+
* Check if service is available.
|
|
5672
|
+
* Override in subclass for custom availability checks.
|
|
5673
|
+
*
|
|
5674
|
+
* @returns true if service is enabled and in a browser environment
|
|
5675
|
+
*/
|
|
5676
|
+
isAvailable() {
|
|
5677
|
+
return this.isServiceEnabled && typeof window !== "undefined";
|
|
5678
|
+
}
|
|
5679
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
5593
5680
|
// Error Handling Helpers
|
|
5594
5681
|
// ─────────────────────────────────────────────────────────────────────────
|
|
5595
5682
|
/**
|
|
@@ -7916,13 +8003,12 @@ var FrontendExampleDomainService_exports = {};
|
|
|
7916
8003
|
__export(FrontendExampleDomainService_exports, {
|
|
7917
8004
|
FrontendExampleDomainService: () => FrontendExampleDomainService
|
|
7918
8005
|
});
|
|
7919
|
-
var
|
|
8006
|
+
var FrontendExampleDomainService;
|
|
7920
8007
|
var init_FrontendExampleDomainService = __esm({
|
|
7921
8008
|
"src/domain/example/FrontendExampleDomainService.ts"() {
|
|
7922
8009
|
init_BaseFrontendDomainService();
|
|
7923
8010
|
init_CoreEventManager();
|
|
7924
8011
|
init_ExampleMapper();
|
|
7925
|
-
DEFAULT_POLLING_INTERVAL_MS = 3e4;
|
|
7926
8012
|
FrontendExampleDomainService = class _FrontendExampleDomainService extends BaseFrontendDomainService {
|
|
7927
8013
|
// ─────────────────────────────────────────────────────────────────────────
|
|
7928
8014
|
// Constructor
|
|
@@ -7997,15 +8083,6 @@ var init_FrontendExampleDomainService = __esm({
|
|
|
7997
8083
|
* Required by BaseFrontendDomainService
|
|
7998
8084
|
*/
|
|
7999
8085
|
this.eventPrefix = "example";
|
|
8000
|
-
/**
|
|
8001
|
-
* Read-only store keys - inherits error and featureFlags from base
|
|
8002
|
-
* No need to redeclare them - they're always included by default
|
|
8003
|
-
*/
|
|
8004
|
-
// protected readStoreKeys = [...super.readStoreKeys]; // Already includes ERROR, FEATURE_FLAGS
|
|
8005
|
-
// ─────────────────────────────────────────────────────────────────────────
|
|
8006
|
-
// Domain-Specific Properties
|
|
8007
|
-
// ─────────────────────────────────────────────────────────────────────────
|
|
8008
|
-
this.pollingTimer = null;
|
|
8009
8086
|
if (this.config.pollingInterval && this.config.pollingInterval > 0) {
|
|
8010
8087
|
this.startPolling();
|
|
8011
8088
|
}
|
|
@@ -8014,6 +8091,11 @@ var init_FrontendExampleDomainService = __esm({
|
|
|
8014
8091
|
__name(this, "FrontendExampleDomainService");
|
|
8015
8092
|
}
|
|
8016
8093
|
static {
|
|
8094
|
+
/**
|
|
8095
|
+
* Read-only store keys - inherits error and featureFlags from base
|
|
8096
|
+
* No need to redeclare them - they're always included by default
|
|
8097
|
+
*/
|
|
8098
|
+
// protected readStoreKeys = [...super.readStoreKeys]; // Already includes ERROR, FEATURE_FLAGS
|
|
8017
8099
|
// ─────────────────────────────────────────────────────────────────────────
|
|
8018
8100
|
// Static: Service Registry Interface
|
|
8019
8101
|
// ─────────────────────────────────────────────────────────────────────────
|
|
@@ -8047,18 +8129,10 @@ var init_FrontendExampleDomainService = __esm({
|
|
|
8047
8129
|
return service;
|
|
8048
8130
|
}
|
|
8049
8131
|
// ─────────────────────────────────────────────────────────────────────────
|
|
8050
|
-
// Abstract Implementations (Required by BaseDomainService)
|
|
8051
|
-
// ─────────────────────────────────────────────────────────────────────────
|
|
8052
|
-
isAvailable() {
|
|
8053
|
-
return this.isServiceEnabled && typeof window !== "undefined";
|
|
8054
|
-
}
|
|
8055
|
-
dispose() {
|
|
8056
|
-
this.stopPolling();
|
|
8057
|
-
this.logInfo("Service disposed");
|
|
8058
|
-
}
|
|
8059
|
-
// ─────────────────────────────────────────────────────────────────────────
|
|
8060
8132
|
// Lifecycle Hooks (Optional Override Examples)
|
|
8061
8133
|
// ─────────────────────────────────────────────────────────────────────────
|
|
8134
|
+
// Note: isAvailable(), dispose(), startPolling(), stopPolling() are inherited
|
|
8135
|
+
// from BaseFrontendDomainService. Override here only if custom behavior needed.
|
|
8062
8136
|
/**
|
|
8063
8137
|
* After fetchAll - emit event (store sync handled automatically)
|
|
8064
8138
|
* Note: Base class automatically calls syncToStores() which uses storeHandlers
|
|
@@ -8106,35 +8180,9 @@ var init_FrontendExampleDomainService = __esm({
|
|
|
8106
8180
|
return CoreEventManager.on(event, handler);
|
|
8107
8181
|
}
|
|
8108
8182
|
// ─────────────────────────────────────────────────────────────────────────
|
|
8109
|
-
// Polling (Domain-Specific Feature)
|
|
8110
|
-
// ─────────────────────────────────────────────────────────────────────────
|
|
8111
|
-
/**
|
|
8112
|
-
* Start polling for updates
|
|
8113
|
-
* Domain-specific feature - not part of base class
|
|
8114
|
-
*/
|
|
8115
|
-
startPolling() {
|
|
8116
|
-
if (this.pollingTimer) return;
|
|
8117
|
-
const interval = this.config.pollingInterval ?? DEFAULT_POLLING_INTERVAL_MS;
|
|
8118
|
-
this.pollingTimer = setInterval(() => {
|
|
8119
|
-
this.fetchAll().catch((error) => {
|
|
8120
|
-
this.logError("Polling fetch failed", { error });
|
|
8121
|
-
});
|
|
8122
|
-
}, interval);
|
|
8123
|
-
this.logDebug("Polling started", { interval });
|
|
8124
|
-
}
|
|
8125
|
-
/**
|
|
8126
|
-
* Stop polling
|
|
8127
|
-
*/
|
|
8128
|
-
stopPolling() {
|
|
8129
|
-
if (this.pollingTimer) {
|
|
8130
|
-
clearInterval(this.pollingTimer);
|
|
8131
|
-
this.pollingTimer = null;
|
|
8132
|
-
this.logDebug("Polling stopped");
|
|
8133
|
-
}
|
|
8134
|
-
}
|
|
8135
|
-
// ─────────────────────────────────────────────────────────────────────────
|
|
8136
8183
|
// Demo Methods - fetchAll() with Query Examples
|
|
8137
8184
|
// ─────────────────────────────────────────────────────────────────────────
|
|
8185
|
+
// Note: startPolling() and stopPolling() are inherited from BaseFrontendDomainService
|
|
8138
8186
|
/**
|
|
8139
8187
|
* Demo: Fetch all examples with optional filters
|
|
8140
8188
|
* Demonstrates the fetchAll() method with typed query parameters
|