@plyaz/core 1.7.1 → 1.8.0

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.
@@ -3739,10 +3739,8 @@ var init_CoreInitializer = __esm({
3739
3739
  });
3740
3740
  const backendFlagStore = createStandaloneFeatureFlagStore();
3741
3741
  const compositeStore = {
3742
- // Error store methods
3743
- ...backendErrorStore,
3744
- // Feature flag store methods
3745
- ...backendFlagStore
3742
+ errors: backendErrorStore,
3743
+ featureFlags: backendFlagStore
3746
3744
  };
3747
3745
  _Core._rootStore = {
3748
3746
  getState: /* @__PURE__ */ __name(() => compositeStore, "getState"),
@@ -5016,7 +5014,34 @@ var init_BaseFrontendDomainService = __esm({
5016
5014
  );
5017
5015
  }
5018
5016
  const rawData = this.unwrapResponseData(response.data);
5019
- const entities = (rawData ?? []).map((dto) => this.mapper.toDomain(dto));
5017
+ this.logDebug("fetchAll: checking config keys", {
5018
+ responseSuccessKey: this.config.responseSuccessKey,
5019
+ responseErrorKey: this.config.responseErrorKey,
5020
+ responseDataKey: this.config.responseDataKey,
5021
+ configKeys: Object.keys(this.config)
5022
+ });
5023
+ this.logDebug("fetchAll: response structure", {
5024
+ responseType: typeof response,
5025
+ responseKeys: response ? Object.keys(response) : [],
5026
+ responseDataType: typeof response.data,
5027
+ hasOk: "ok" in response,
5028
+ hasData: "data" in response
5029
+ });
5030
+ this.logDebug("fetchAll: after unwrap", {
5031
+ rawDataType: typeof rawData,
5032
+ isArray: Array.isArray(rawData),
5033
+ rawDataKeys: rawData && typeof rawData === "object" ? Object.keys(rawData) : []
5034
+ });
5035
+ if (!Array.isArray(rawData)) {
5036
+ this.logWarn("fetchAll: unwrapped data is not an array, check responseDataKey config", {
5037
+ responseDataKey: this.config.responseDataKey,
5038
+ actualType: typeof rawData,
5039
+ // Help debug by showing what we got
5040
+ receivedData: rawData
5041
+ });
5042
+ return [];
5043
+ }
5044
+ const entities = rawData.map((dto) => this.mapper.toDomain(dto));
5020
5045
  this.syncEntitiesToStore(entities);
5021
5046
  await this.afterFetchAll?.(entities, query);
5022
5047
  this.emitEvent("fetched", {
@@ -7740,22 +7765,23 @@ var init_FrontendExampleDomainService = __esm({
7740
7765
  // Fetchers - using apiClient directly for testing/example purposes
7741
7766
  // In production, these would be imported from @plyaz/api services
7742
7767
  // Note: Validation is handled by validator class, mapping by mapper class
7768
+ // Note: Use relative paths since apiClient.baseURL is already set to apiBasePath
7743
7769
  fetchers: {
7744
7770
  fetchAll: /* @__PURE__ */ __name(async (query) => {
7745
- return this.apiClient.get(apiBasePath, { params: query });
7771
+ return this.apiClient.get("", { params: query });
7746
7772
  }, "fetchAll"),
7747
7773
  fetchById: /* @__PURE__ */ __name(async (id) => {
7748
- return this.apiClient.get(`${apiBasePath}/${id}`);
7774
+ return this.apiClient.get(`/${id}`);
7749
7775
  }, "fetchById"),
7750
7776
  create: /* @__PURE__ */ __name(async (data) => {
7751
- return this.apiClient.post(apiBasePath, data);
7777
+ return this.apiClient.post("", data);
7752
7778
  }, "create"),
7753
7779
  update: /* @__PURE__ */ __name(async (payload) => {
7754
7780
  const { id, data } = payload;
7755
- return this.apiClient.patch(`${apiBasePath}/${id}`, data);
7781
+ return this.apiClient.patch(`/${id}`, data);
7756
7782
  }, "update"),
7757
7783
  delete: /* @__PURE__ */ __name(async (id) => {
7758
- return this.apiClient.delete(`${apiBasePath}/${id}`);
7784
+ return this.apiClient.delete(`/${id}`);
7759
7785
  }, "delete")
7760
7786
  }
7761
7787
  // Store handlers - customize how data syncs to store