@plyaz/core 1.7.1 → 1.7.2

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/index.mjs CHANGED
@@ -5072,7 +5072,34 @@ var BaseFrontendDomainService = class extends BaseDomainService {
5072
5072
  );
5073
5073
  }
5074
5074
  const rawData = this.unwrapResponseData(response.data);
5075
- const entities = (rawData ?? []).map((dto) => this.mapper.toDomain(dto));
5075
+ this.logDebug("fetchAll: checking config keys", {
5076
+ responseSuccessKey: this.config.responseSuccessKey,
5077
+ responseErrorKey: this.config.responseErrorKey,
5078
+ responseDataKey: this.config.responseDataKey,
5079
+ configKeys: Object.keys(this.config)
5080
+ });
5081
+ this.logDebug("fetchAll: response structure", {
5082
+ responseType: typeof response,
5083
+ responseKeys: response ? Object.keys(response) : [],
5084
+ responseDataType: typeof response.data,
5085
+ hasOk: "ok" in response,
5086
+ hasData: "data" in response
5087
+ });
5088
+ this.logDebug("fetchAll: after unwrap", {
5089
+ rawDataType: typeof rawData,
5090
+ isArray: Array.isArray(rawData),
5091
+ rawDataKeys: rawData && typeof rawData === "object" ? Object.keys(rawData) : []
5092
+ });
5093
+ if (!Array.isArray(rawData)) {
5094
+ this.logWarn("fetchAll: unwrapped data is not an array, check responseDataKey config", {
5095
+ responseDataKey: this.config.responseDataKey,
5096
+ actualType: typeof rawData,
5097
+ // Help debug by showing what we got
5098
+ receivedData: rawData
5099
+ });
5100
+ return [];
5101
+ }
5102
+ const entities = rawData.map((dto) => this.mapper.toDomain(dto));
5076
5103
  this.syncEntitiesToStore(entities);
5077
5104
  await this.afterFetchAll?.(entities, query);
5078
5105
  this.emitEvent("fetched", {