@plyaz/core 1.9.1 → 1.9.3
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 +8 -2
- package/dist/domain/base/BaseFrontendDomainService.d.ts.map +1 -1
- package/dist/domain/example/FrontendExampleDomainService.d.ts.map +1 -1
- package/dist/entry-backend.js +23 -4
- package/dist/entry-backend.js.map +1 -1
- package/dist/entry-backend.mjs +23 -4
- package/dist/entry-backend.mjs.map +1 -1
- package/dist/entry-frontend-browser.js +27 -4
- package/dist/entry-frontend-browser.js.map +1 -1
- package/dist/entry-frontend-browser.mjs +24 -4
- package/dist/entry-frontend-browser.mjs.map +1 -1
- package/dist/entry-frontend.js +27 -4
- package/dist/entry-frontend.js.map +1 -1
- package/dist/entry-frontend.mjs +24 -4
- package/dist/entry-frontend.mjs.map +1 -1
- package/dist/frontend/providers/PlyazProvider.d.ts +3 -0
- package/dist/frontend/providers/PlyazProvider.d.ts.map +1 -1
- package/dist/index.js +25 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/entry-backend.mjs
CHANGED
|
@@ -4864,20 +4864,37 @@ var init_BaseFrontendDomainService = __esm({
|
|
|
4864
4864
|
return storeState;
|
|
4865
4865
|
}
|
|
4866
4866
|
/**
|
|
4867
|
-
* Sync multiple entities to store
|
|
4868
|
-
*
|
|
4867
|
+
* Sync multiple entities to store.
|
|
4868
|
+
* Uses storeDataKey config to wrap entities in the correct structure.
|
|
4869
4869
|
*
|
|
4870
4870
|
* @param entities - Entities to sync
|
|
4871
4871
|
* @returns Array of converted store states
|
|
4872
4872
|
*/
|
|
4873
4873
|
syncEntitiesToStore(entities) {
|
|
4874
4874
|
const storeStates = entities.map((entity) => this.mapper.toStoreState(entity));
|
|
4875
|
-
if (this._primaryStore && !this.storeHandlers?.disabled
|
|
4876
|
-
const
|
|
4875
|
+
if (this._primaryStore && !this.storeHandlers?.disabled) {
|
|
4876
|
+
const storeDataKey = this.config.storeDataKey ?? "items";
|
|
4877
|
+
const storeData = this.buildNestedObject(storeDataKey, entities);
|
|
4877
4878
|
this.syncToStores(storeData, true);
|
|
4878
4879
|
}
|
|
4879
4880
|
return storeStates;
|
|
4880
4881
|
}
|
|
4882
|
+
/**
|
|
4883
|
+
* Build a nested object from a dot-notation key path.
|
|
4884
|
+
* @example buildNestedObject('items', data) => { items: data }
|
|
4885
|
+
* @example buildNestedObject('nested.items', data) => { nested: { items: data } }
|
|
4886
|
+
*/
|
|
4887
|
+
buildNestedObject(keyPath, value) {
|
|
4888
|
+
const keys = keyPath.split(".");
|
|
4889
|
+
const result = {};
|
|
4890
|
+
let current = result;
|
|
4891
|
+
for (let i = 0; i < keys.length - 1; i++) {
|
|
4892
|
+
current[keys[i]] = {};
|
|
4893
|
+
current = current[keys[i]];
|
|
4894
|
+
}
|
|
4895
|
+
current[keys[keys.length - 1]] = value;
|
|
4896
|
+
return result;
|
|
4897
|
+
}
|
|
4881
4898
|
/**
|
|
4882
4899
|
* Remove entity from store by ID.
|
|
4883
4900
|
* Priority: storeHandlers.removeData > store.removeData
|
|
@@ -7928,6 +7945,8 @@ var init_FrontendExampleDomainService = __esm({
|
|
|
7928
7945
|
responseErrorKey: "error",
|
|
7929
7946
|
// Unwrap SuccessResponseStandard: extract 'data' from response.data
|
|
7930
7947
|
responseDataKey: "data",
|
|
7948
|
+
// Store data key: wrap entities as { items: [...] } for store.setData()
|
|
7949
|
+
storeDataKey: "items",
|
|
7931
7950
|
// Fetchers - using apiClient directly for testing/example purposes
|
|
7932
7951
|
// In production, these would be imported from @plyaz/api services
|
|
7933
7952
|
// Note: Validation is handled by validator class, mapping by mapper class
|