@zeniai/client-epic-state 5.2.7-betaRD1 → 5.2.7-betaRD2

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.
@@ -10,7 +10,25 @@ import { createOneTimeAccrual, createOneTimeAccrualFailure, createOneTimeAccrual
10
10
  export const createOneTimeAccrualEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(createOneTimeAccrual.match), mergeMap((action) => {
11
11
  const state = state$.value;
12
12
  const { localData } = action.payload;
13
- const payload = { ...prepareCreateOneTimeAccrualPayload(state, localData) };
13
+ /*
14
+ * Idempotency for the create. agent-je dedupes on this: the same key again returns the
15
+ * existing accrual rather than posting a second JE to QBO.
16
+ *
17
+ * Body `request_id` rather than the `Idempotency-Key` header the API doc prefers, on Mohit's
18
+ * call (2026-08-24). The header cannot reach the service from a browser -- common's
19
+ * Access-Control-Allow-Headers does not list it, so cross-origin preflight rejects the
20
+ * request. Same meaning either way; the header simply wins when both are sent.
21
+ *
22
+ * Minted here, per create action, and deliberately not held in local data or the form: a new
23
+ * Save must produce a new key, and only a retry of *this* request may reuse one. Nothing
24
+ * retries today -- if a retry operator is ever added below, it has to sit inside this
25
+ * mergeMap so the key is not re-minted, or the guarantee is silently lost.
26
+ */
27
+ const requestId = crypto.randomUUID();
28
+ const payload = {
29
+ ...prepareCreateOneTimeAccrualPayload(state, localData),
30
+ request_id: requestId,
31
+ };
14
32
  // convertToPeriod destructures, so an unset period would throw here and take the epic
15
33
  // subscription down for the whole session — a missed refresh is the cheaper failure.
16
34
  const selectedMonthYear = state.expenseAutomationViewState.selectedPeriodByTenantId[getCurrentTenant(state).tenantId];
@@ -13,7 +13,25 @@ const jeSchedulesViewReducer_1 = require("../../../reducers/jeSchedulesViewReduc
13
13
  const createOneTimeAccrualEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(jeSchedulesViewReducer_1.createOneTimeAccrual.match), (0, operators_1.mergeMap)((action) => {
14
14
  const state = state$.value;
15
15
  const { localData } = action.payload;
16
- const payload = { ...(0, jeSchedulesPayload_1.prepareCreateOneTimeAccrualPayload)(state, localData) };
16
+ /*
17
+ * Idempotency for the create. agent-je dedupes on this: the same key again returns the
18
+ * existing accrual rather than posting a second JE to QBO.
19
+ *
20
+ * Body `request_id` rather than the `Idempotency-Key` header the API doc prefers, on Mohit's
21
+ * call (2026-08-24). The header cannot reach the service from a browser -- common's
22
+ * Access-Control-Allow-Headers does not list it, so cross-origin preflight rejects the
23
+ * request. Same meaning either way; the header simply wins when both are sent.
24
+ *
25
+ * Minted here, per create action, and deliberately not held in local data or the form: a new
26
+ * Save must produce a new key, and only a retry of *this* request may reuse one. Nothing
27
+ * retries today -- if a retry operator is ever added below, it has to sit inside this
28
+ * mergeMap so the key is not re-minted, or the guarantee is silently lost.
29
+ */
30
+ const requestId = crypto.randomUUID();
31
+ const payload = {
32
+ ...(0, jeSchedulesPayload_1.prepareCreateOneTimeAccrualPayload)(state, localData),
33
+ request_id: requestId,
34
+ };
17
35
  // convertToPeriod destructures, so an unset period would throw here and take the epic
18
36
  // subscription down for the whole session — a missed refresh is the cheaper failure.
19
37
  const selectedMonthYear = state.expenseAutomationViewState.selectedPeriodByTenantId[(0, tenantSelector_1.getCurrentTenant)(state).tenantId];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.2.7-betaRD1",
3
+ "version": "5.2.7-betaRD2",
4
4
  "description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/esm/index.js",