@entifix/react-integration 0.16.0 → 0.18.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.
@@ -9,7 +9,7 @@ import type { UseDataLoadingOptions } from './use-data-loading.types.js';
9
9
  * `uc`/`ctx` come in the same way and the Effect runs against the same provided
10
10
  * Tags, so callers and organisms are untouched.
11
11
  */
12
- export declare function useDataLoading<TEntity extends Entity, TContext>({ uc, ctx, initialPageSize, queryKey, enabled, baseFiltering, }: UseDataLoadingOptions<TEntity, TContext>): {
12
+ export declare function useDataLoading<TEntity extends Entity, TContext>({ uc, ctx, initialPageSize, queryKey, enabled, baseFiltering, initialFiltering, }: UseDataLoadingOptions<TEntity, TContext>): {
13
13
  isLoading: boolean;
14
14
  items: TEntity[];
15
15
  totalItems: number;
@@ -1 +1 @@
1
- {"version":3,"file":"use-data-loading.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-data-loading/use-data-loading.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,MAAM,EAGX,KAAK,aAAa,EAClB,KAAK,WAAW,EAGjB,MAAM,eAAe,CAAC;AAavB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAiCzE;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,OAAO,SAAS,MAAM,EAAE,QAAQ,EAAE,EAC/D,EAAE,EACF,GAAG,EACH,eAAmC,EACnC,QAAQ,EACR,OAAc,EACd,aAAa,GACd,EAAE,qBAAqB,CAAC,OAAO,EAAE,QAAQ,CAAC;;;;;;;;;4BA0GE,MAAM;oCAIE,MAAM;mCAMP,WAAW,CAAC,OAAO,CAAC;+BAIxB,aAAa,CAAC,OAAO,CAAC;EAkBrE"}
1
+ {"version":3,"file":"use-data-loading.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-data-loading/use-data-loading.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,MAAM,EAGX,KAAK,aAAa,EAClB,KAAK,WAAW,EAGjB,MAAM,eAAe,CAAC;AAavB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAoCzE;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,OAAO,SAAS,MAAM,EAAE,QAAQ,EAAE,EAC/D,EAAE,EACF,GAAG,EACH,eAAmC,EACnC,QAAQ,EACR,OAAc,EACd,aAAa,EACb,gBAAgB,GACjB,EAAE,qBAAqB,CAAC,OAAO,EAAE,QAAQ,CAAC;;;;;;;;;4BA0GE,MAAM;oCAIE,MAAM;mCAMP,WAAW,CAAC,OAAO,CAAC;+BAIxB,aAAa,CAAC,OAAO,CAAC;EAkBrE"}
@@ -9,11 +9,11 @@ const DEFAULT_PAGE_SIZE = 10;
9
9
  function requestReducer(state, action) {
10
10
  return _extends({}, state, action.set);
11
11
  }
12
- function initialRequest(pageSize) {
12
+ function initialRequest(seed) {
13
13
  return {
14
14
  currentPage: 1,
15
- pageSize,
16
- filtering: undefined,
15
+ pageSize: seed.pageSize,
16
+ filtering: seed.filtering,
17
17
  sorting: undefined
18
18
  };
19
19
  }
@@ -25,10 +25,13 @@ function initialRequest(pageSize) {
25
25
  * and reactive events invalidate the list. The public shape is unchanged: the
26
26
  * `uc`/`ctx` come in the same way and the Effect runs against the same provided
27
27
  * Tags, so callers and organisms are untouched.
28
- */ export function useDataLoading({ uc, ctx, initialPageSize = DEFAULT_PAGE_SIZE, queryKey, enabled = true, baseFiltering }) {
28
+ */ export function useDataLoading({ uc, ctx, initialPageSize = DEFAULT_PAGE_SIZE, queryKey, enabled = true, baseFiltering, initialFiltering }) {
29
29
  var _ref, _ref1, _query_error;
30
30
  var _query_data, _query_data1;
31
- const [request, dispatch] = useReducer(requestReducer, initialPageSize, initialRequest);
31
+ const [request, dispatch] = useReducer(requestReducer, {
32
+ pageSize: initialPageSize,
33
+ filtering: initialFiltering
34
+ }, initialRequest);
32
35
  // Callers rebuild `uc`/`ctx` inline every render, so hold the latest in refs
33
36
  // and keep them out of the query key — keying on their identity would refetch
34
37
  // on every render. Written in an effect (refs may not be set during render);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/hooks/use-data-loading/use-data-loading.ts"],"sourcesContent":["import { EntityLoadRequestTag } from '@entifix/business';\nimport {\n type EntifixFailure,\n type Entity,\n type EntityLoadRequest,\n type EntityPage,\n type EntitySorting,\n type FilterGroup,\n serializeRsql,\n serializeSort,\n} from '@entifix/core';\nimport { keepPreviousData, useQuery } from '@tanstack/react-query';\nimport { Context, Effect } from 'effect';\nimport {\n useCallback,\n useEffect,\n useId,\n useMemo,\n useReducer,\n useRef,\n} from 'react';\n\nimport { combineFilterGroups } from '../../query/combine-filtering.js';\nimport type { UseDataLoadingOptions } from './use-data-loading.types.js';\n\nconst DEFAULT_PAGE_SIZE = 10;\n\n/**\n * The request the caller controls — page, size, and the *applied* filter/sort.\n * The response (items, loading, error) is owned by the query cache, not here.\n */\ninterface RequestState<T extends Entity> {\n currentPage: number;\n pageSize: number;\n filtering: FilterGroup<T> | undefined;\n sorting: EntitySorting<T> | undefined;\n}\n\ntype RequestAction<T extends Entity> = { set: Partial<RequestState<T>> };\n\nfunction requestReducer<T extends Entity>(\n state: RequestState<T>,\n action: RequestAction<T>,\n): RequestState<T> {\n return { ...state, ...action.set };\n}\n\nfunction initialRequest<T extends Entity>(pageSize: number): RequestState<T> {\n return {\n currentPage: 1,\n pageSize,\n filtering: undefined,\n sorting: undefined,\n };\n}\n\n/**\n * Runs an entity list use-case and caches the result through TanStack Query.\n *\n * The reducer owns the *request* (page/size/filter/sort); `useQuery` owns the\n * *fetch* — deduping, caching, and (with a shared `queryKey`) letting mutations\n * and reactive events invalidate the list. The public shape is unchanged: the\n * `uc`/`ctx` come in the same way and the Effect runs against the same provided\n * Tags, so callers and organisms are untouched.\n */\nexport function useDataLoading<TEntity extends Entity, TContext>({\n uc,\n ctx,\n initialPageSize = DEFAULT_PAGE_SIZE,\n queryKey,\n enabled = true,\n baseFiltering,\n}: UseDataLoadingOptions<TEntity, TContext>) {\n const [request, dispatch] = useReducer(\n requestReducer as (\n state: RequestState<TEntity>,\n action: RequestAction<TEntity>,\n ) => RequestState<TEntity>,\n initialPageSize,\n initialRequest<TEntity>,\n );\n\n // Callers rebuild `uc`/`ctx` inline every render, so hold the latest in refs\n // and keep them out of the query key — keying on their identity would refetch\n // on every render. Written in an effect (refs may not be set during render);\n // effects fire in order, so the query below always reads the latest.\n const ucRef = useRef(uc);\n const ctxRef = useRef(ctx);\n useEffect(() => {\n ucRef.current = uc;\n ctxRef.current = ctx;\n });\n\n // What actually goes on the wire: the caller's standing restriction ANDed with\n // whatever the user applied. Kept separate from `request.filtering` because the\n // restriction is not the user's filter — the panel must keep showing only what\n // they set, while the request keeps carrying both.\n const effectiveFiltering = useMemo(\n () => combineFilterGroups<TEntity>(baseFiltering, request.filtering),\n [baseFiltering, request.filtering],\n );\n\n // The applied filter/sort are rebuilt each render, so their *serialized* form\n // — the same codec the request needs anyway — is what keys the query: a stable\n // string that changes exactly when the query does.\n const rsql = useMemo(\n () => serializeRsql(effectiveFiltering ? [effectiveFiltering] : undefined),\n [effectiveFiltering],\n );\n const sort = useMemo(\n () => serializeSort(request.sorting ? [request.sorting] : undefined),\n [request.sorting],\n );\n\n const loadRequest = useMemo<EntityLoadRequest<TEntity>>(() => {\n const built: EntityLoadRequest<TEntity> = {\n page: request.currentPage,\n pageSize: request.pageSize,\n };\n // An empty group serializes to nothing; omit it rather than send a filter\n // that matches everything.\n if (rsql !== '' && effectiveFiltering) {\n built.filtering = [effectiveFiltering];\n }\n if (sort !== '' && request.sorting) {\n built.sorting = [request.sorting];\n }\n return built;\n }, [\n request.currentPage,\n request.pageSize,\n effectiveFiltering,\n request.sorting,\n rsql,\n sort,\n ]);\n\n // Falls back to a per-instance id so an un-scoped list never collides with\n // another in the shared cache — correct, just unshared (see the type doc).\n const instanceId = useId();\n const scope = queryKey ?? [instanceId];\n\n const query = useQuery<EntityPage<TEntity>, EntifixFailure>({\n enabled,\n /**\n * Page, size, filter and sort are all part of the key, so every one of them\n * is a *different* query — and without this, `data` goes undefined the\n * instant any of them changes. The table would then see `items.length === 0`\n * with `isFetching` true, read it as a first load, and blank populated rows\n * to skeleton on every pagination click: the grey flash the loading contract\n * exists to prevent. Keeping the previous page is what makes \"skeleton only\n * on first load\" true rather than merely intended.\n */\n placeholderData: keepPreviousData,\n queryKey: [\n ...scope,\n 'load',\n request.currentPage,\n request.pageSize,\n rsql,\n sort,\n ],\n queryFn: () =>\n Effect.runPromise(\n Effect.provide(\n ucRef.current,\n ctxRef.current.pipe(\n Context.add(\n EntityLoadRequestTag,\n // The tag carries no generic, so the entity-typed request crosses\n // it — the same cast `loadUCFactory` makes reading it back.\n loadRequest as unknown as EntityLoadRequest,\n ),\n ),\n ),\n ),\n });\n\n const onPageChange = useCallback((newPage: number) => {\n dispatch({ set: { currentPage: newPage } });\n }, []);\n\n const onPageSizeChange = useCallback((newPageSize: number) => {\n dispatch({ set: { pageSize: newPageSize, currentPage: 1 } });\n }, []);\n\n // Narrowing the result set invalidates the page number: page 4 of the old\n // result is very likely past the end of the new one.\n const onFilteringChange = useCallback((filtering: FilterGroup<TEntity>) => {\n dispatch({ set: { filtering, currentPage: 1 } });\n }, []);\n\n const onSortingChange = useCallback((sorting: EntitySorting<TEntity>) => {\n dispatch({ set: { sorting, currentPage: 1 } });\n }, []);\n\n return {\n isLoading: query.isFetching,\n items: query.data?.items ?? ([] as Array<TEntity>),\n totalItems: query.data?.total ?? 0,\n currentPage: request.currentPage,\n pageSize: request.pageSize,\n error: query.error ?? undefined,\n filtering: request.filtering,\n sorting: request.sorting,\n onPageChange,\n onPageSizeChange,\n onFilteringChange,\n onSortingChange,\n };\n}\n"],"names":["EntityLoadRequestTag","serializeRsql","serializeSort","keepPreviousData","useQuery","Context","Effect","useCallback","useEffect","useId","useMemo","useReducer","useRef","combineFilterGroups","DEFAULT_PAGE_SIZE","requestReducer","state","action","set","initialRequest","pageSize","currentPage","filtering","undefined","sorting","useDataLoading","uc","ctx","initialPageSize","queryKey","enabled","baseFiltering","query","request","dispatch","ucRef","ctxRef","current","effectiveFiltering","rsql","sort","loadRequest","built","page","instanceId","scope","placeholderData","queryFn","runPromise","provide","pipe","add","onPageChange","newPage","onPageSizeChange","newPageSize","onFilteringChange","onSortingChange","isLoading","isFetching","items","data","totalItems","total","error"],"mappings":";AAAA,SAASA,oBAAoB,QAAQ,oBAAoB;AACzD,SAOEC,aAAa,EACbC,aAAa,QACR,gBAAgB;AACvB,SAASC,gBAAgB,EAAEC,QAAQ,QAAQ,wBAAwB;AACnE,SAASC,OAAO,EAAEC,MAAM,QAAQ,SAAS;AACzC,SACEC,WAAW,EACXC,SAAS,EACTC,KAAK,EACLC,OAAO,EACPC,UAAU,EACVC,MAAM,QACD,QAAQ;AAEf,SAASC,mBAAmB,QAAQ,mCAAmC;AAGvE,MAAMC,oBAAoB;AAe1B,SAASC,eACPC,KAAsB,EACtBC,MAAwB;IAExB,OAAO,aAAKD,OAAUC,OAAOC,GAAG;AAClC;AAEA,SAASC,eAAiCC,QAAgB;IACxD,OAAO;QACLC,aAAa;QACbD;QACAE,WAAWC;QACXC,SAASD;IACX;AACF;AAEA;;;;;;;;CAQC,GACD,OAAO,SAASE,eAAiD,EAC/DC,EAAE,EACFC,GAAG,EACHC,kBAAkBd,iBAAiB,EACnCe,QAAQ,EACRC,UAAU,IAAI,EACdC,aAAa,EAC4B;qBAkIhCC;QAJAA,aACKA;IA9Hd,MAAM,CAACC,SAASC,SAAS,GAAGvB,WAC1BI,gBAIAa,iBACAT;IAGF,6EAA6E;IAC7E,8EAA8E;IAC9E,6EAA6E;IAC7E,qEAAqE;IACrE,MAAMgB,QAAQvB,OAAOc;IACrB,MAAMU,SAASxB,OAAOe;IACtBnB,UAAU;QACR2B,MAAME,OAAO,GAAGX;QAChBU,OAAOC,OAAO,GAAGV;IACnB;IAEA,+EAA+E;IAC/E,gFAAgF;IA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AQ8C,GAAG,CACTnD,sBACA,kEAAkE;YAClE,4DAA4D;YAC5DyC;IAKZ;IAEA,MAAMW,eAAe7C,YAAY,CAAC8C;QAChCnB,SAAS;YAAEhB,KAAK;gBAAEG,aAAagC;YAAQ;QAAE;IAC3C,GAAG,EAAE;IAEL,MAAMC,mBAAmB/C,YAAY,CAACgD;QACpCrB,SAAS;YAAEhB,KAAK;gBAAEE,UAAUmC;gBAAalC,aAAa;YAAE;QAAE;IAC5D,GAAG,EAAE;IAEL,0EAA0E;IAC1E,qDAAqD;IACrD,MAAMmC,oBAAoBjD,YAAY,CAACe;QACrCY,SAAS;YAAEhB,KAAK;gBAAEI;gBAAWD,aAAa;YAAE;QAAE;IAChD,GAAG,EAAE;IAEL,MAAMoC,kBAAkBlD,YAAY,CAACiB;QACnCU,SAAS;YAAEhB,KAAK;gBAAEM;gBAASH,aAAa;YAAE;QAAE;IAC9C,GAAG,EAAE;IAEL,OAAO;QACLqC,WAAW1B,MAAM2B,UAAU;QAC3BC,KAAK,WAAE5B,cAAAA,MAAM6B,IAAI,qBAAV7B,YAAY4B,KAAK,mBAAK,EAAE;QAC/BE,UAAU,YAAE9B,eAAAA,MAAM6B,IAAI,qBAAV7B,aAAY+B,KAAK,oBAAI;QACjC1C,aAAaY,QAAQZ,WAAW;QAChCD,UAAUa,QAAQb,QAAQ;QAC1B4C,KAAK,GAAEhC,eAAAA,MAAMgC,KAAK,YAAXhC,eAAeT;QACtBD,WAAWW,QAAQX,SAAS;QAC5BE,SAASS,QAAQT,OAAO;QACxB4B;QACAE;QACAE;QACAC;IACF;AACF"}
1
+ {"version":3,"sources":["../../../src/hooks/use-data-loading/use-data-loading.ts"],"sourcesContent":["import { EntityLoadRequestTag } from '@entifix/business';\nimport {\n type EntifixFailure,\n type Entity,\n type EntityLoadRequest,\n type EntityPage,\n type EntitySorting,\n type FilterGroup,\n serializeRsql,\n serializeSort,\n} from '@entifix/core';\nimport { keepPreviousData, useQuery } from '@tanstack/react-query';\nimport { Context, Effect } from 'effect';\nimport {\n useCallback,\n useEffect,\n useId,\n useMemo,\n useReducer,\n useRef,\n} from 'react';\n\nimport { combineFilterGroups } from '../../query/combine-filtering.js';\nimport type { UseDataLoadingOptions } from './use-data-loading.types.js';\n\nconst DEFAULT_PAGE_SIZE = 10;\n\n/**\n * The request the caller controls — page, size, and the *applied* filter/sort.\n * The response (items, loading, error) is owned by the query cache, not here.\n */\ninterface RequestState<T extends Entity> {\n currentPage: number;\n pageSize: number;\n filtering: FilterGroup<T> | undefined;\n sorting: EntitySorting<T> | undefined;\n}\n\ntype RequestAction<T extends Entity> = { set: Partial<RequestState<T>> };\n\nfunction requestReducer<T extends Entity>(\n state: RequestState<T>,\n action: RequestAction<T>,\n): RequestState<T> {\n return { ...state, ...action.set };\n}\n\nfunction initialRequest<T extends Entity>(seed: {\n pageSize: number;\n filtering: FilterGroup<T> | undefined;\n}): RequestState<T> {\n return {\n currentPage: 1,\n pageSize: seed.pageSize,\n filtering: seed.filtering,\n sorting: undefined,\n };\n}\n\n/**\n * Runs an entity list use-case and caches the result through TanStack Query.\n *\n * The reducer owns the *request* (page/size/filter/sort); `useQuery` owns the\n * *fetch* — deduping, caching, and (with a shared `queryKey`) letting mutations\n * and reactive events invalidate the list. The public shape is unchanged: the\n * `uc`/`ctx` come in the same way and the Effect runs against the same provided\n * Tags, so callers and organisms are untouched.\n */\nexport function useDataLoading<TEntity extends Entity, TContext>({\n uc,\n ctx,\n initialPageSize = DEFAULT_PAGE_SIZE,\n queryKey,\n enabled = true,\n baseFiltering,\n initialFiltering,\n}: UseDataLoadingOptions<TEntity, TContext>) {\n const [request, dispatch] = useReducer(\n requestReducer as (\n state: RequestState<TEntity>,\n action: RequestAction<TEntity>,\n ) => RequestState<TEntity>,\n { pageSize: initialPageSize, filtering: initialFiltering },\n initialRequest<TEntity>,\n );\n\n // Callers rebuild `uc`/`ctx` inline every render, so hold the latest in refs\n // and keep them out of the query key — keying on their identity would refetch\n // on every render. Written in an effect (refs may not be set during render);\n // effects fire in order, so the query below always reads the latest.\n const ucRef = useRef(uc);\n const ctxRef = useRef(ctx);\n useEffect(() => {\n ucRef.current = uc;\n ctxRef.current = ctx;\n });\n\n // What actually goes on the wire: the caller's standing restriction ANDed with\n // whatever the user applied. Kept separate from `request.filtering` because the\n // restriction is not the user's filter — the panel must keep showing only what\n // they set, while the request keeps carrying both.\n const effectiveFiltering = useMemo(\n () => combineFilterGroups<TEntity>(baseFiltering, request.filtering),\n [baseFiltering, request.filtering],\n );\n\n // The applied filter/sort are rebuilt each render, so their *serialized* form\n // — the same codec the request needs anyway — is what keys the query: a stable\n // string that changes exactly when the query does.\n const rsql = useMemo(\n () => serializeRsql(effectiveFiltering ? [effectiveFiltering] : undefined),\n [effectiveFiltering],\n );\n const sort = useMemo(\n () => serializeSort(request.sorting ? [request.sorting] : undefined),\n [request.sorting],\n );\n\n const loadRequest = useMemo<EntityLoadRequest<TEntity>>(() => {\n const built: EntityLoadRequest<TEntity> = {\n page: request.currentPage,\n pageSize: request.pageSize,\n };\n // An empty group serializes to nothing; omit it rather than send a filter\n // that matches everything.\n if (rsql !== '' && effectiveFiltering) {\n built.filtering = [effectiveFiltering];\n }\n if (sort !== '' && request.sorting) {\n built.sorting = [request.sorting];\n }\n return built;\n }, [\n request.currentPage,\n request.pageSize,\n effectiveFiltering,\n request.sorting,\n rsql,\n sort,\n ]);\n\n // Falls back to a per-instance id so an un-scoped list never collides with\n // another in the shared cache — correct, just unshared (see the type doc).\n const instanceId = useId();\n const scope = queryKey ?? [instanceId];\n\n const query = useQuery<EntityPage<TEntity>, EntifixFailure>({\n enabled,\n /**\n * Page, size, filter and sort are all part of the key, so every one of them\n * is a *different* query — and without this, `data` goes undefined the\n * instant any of them changes. The table would then see `items.length === 0`\n * with `isFetching` true, read it as a first load, and blank populated rows\n * to skeleton on every pagination click: the grey flash the loading contract\n * exists to prevent. Keeping the previous page is what makes \"skeleton only\n * on first load\" true rather than merely intended.\n */\n placeholderData: keepPreviousData,\n queryKey: [\n ...scope,\n 'load',\n request.currentPage,\n request.pageSize,\n rsql,\n sort,\n ],\n queryFn: () =>\n Effect.runPromise(\n Effect.provide(\n ucRef.current,\n ctxRef.current.pipe(\n Context.add(\n EntityLoadRequestTag,\n // The tag carries no generic, so the entity-typed request crosses\n // it — the same cast `loadUCFactory` makes reading it back.\n loadRequest as unknown as EntityLoadRequest,\n ),\n ),\n ),\n ),\n });\n\n const onPageChange = useCallback((newPage: number) => {\n dispatch({ set: { currentPage: newPage } });\n }, []);\n\n const onPageSizeChange = useCallback((newPageSize: number) => {\n dispatch({ set: { pageSize: newPageSize, currentPage: 1 } });\n }, []);\n\n // Narrowing the result set invalidates the page number: page 4 of the old\n // result is very likely past the end of the new one.\n const onFilteringChange = useCallback((filtering: FilterGroup<TEntity>) => {\n dispatch({ set: { filtering, currentPage: 1 } });\n }, []);\n\n const onSortingChange = useCallback((sorting: EntitySorting<TEntity>) => {\n dispatch({ set: { sorting, currentPage: 1 } });\n }, []);\n\n return {\n isLoading: query.isFetching,\n items: query.data?.items ?? ([] as Array<TEntity>),\n totalItems: query.data?.total ?? 0,\n currentPage: request.currentPage,\n pageSize: request.pageSize,\n error: query.error ?? undefined,\n filtering: request.filtering,\n sorting: request.sorting,\n onPageChange,\n onPageSizeChange,\n onFilteringChange,\n onSortingChange,\n };\n}\n"],"names":["EntityLoadRequestTag","serializeRsql","serializeSort","keepPreviousData","useQuery","Context","Effect","useCallback","useEffect","useId","useMemo","useReducer","useRef","combineFilterGroups","DEFAULT_PAGE_SIZE","requestReducer","state","action","set","initialRequest","seed","currentPage","pageSize","filtering","sorting","undefined","useDataLoading","uc","ctx","initialPageSize","queryKey","enabled","baseFiltering","initialFiltering","query","request","dispatch","ucRef","ctxRef","current","effectiveFiltering","rsql","sort","loadRequest","built","page","instanceId","scope","placeholderData","queryFn","runPromise","provide","pipe","add","onPageChange","newPage","onPageSizeChange","newPageSize","onFilteringChange","onSortingChange","isLoading","isFetching","items","data","totalItems","total","error"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G,EAAE;IAEL,MAAMC,mBAAmBjD,YAAY,CAACkD;QACpCrB,SAAS;YAAElB,KAAK;gBAAEI,UAAUmC;gBAAapC,aAAa;YAAE;QAAE;IAC5D,GAAG,EAAE;IAEL,0EAA0E;IAC1E,qDAAqD;IACrD,MAAMqC,oBAAoBnD,YAAY,CAACgB;QACrCa,SAAS;YAAElB,KAAK;gBAAEK;gBAAWF,aAAa;YAAE;QAAE;IAChD,GAAG,EAAE;IAEL,MAAMsC,kBAAkBpD,YAAY,CAACiB;QACnCY,SAAS;YAAElB,KAAK;gBAAEM;gBAASH,aAAa;YAAE;QAAE;IAC9C,GAAG,EAAE;IAEL,OAAO;QACLuC,WAAW1B,MAAM2B,UAAU;QAC3BC,KAAK,WAAE5B,cAAAA,MAAM6B,IAAI,qBAAV7B,YAAY4B,KAAK,mBAAK,EAAE;QAC/BE,UAAU,YAAE9B,eAAAA,MAAM6B,IAAI,qBAAV7B,aAAY+B,KAAK,oBAAI;QACjC5C,aAAac,QAAQd,WAAW;QAChCC,UAAUa,QAAQb,QAAQ;QAC1B4C,KAAK,GAAEhC,eAAAA,MAAMgC,KAAK,YAAXhC,eAAeT;QACtBF,WAAWY,QAAQZ,SAAS;QAC5BC,SAASW,QAAQX,OAAO;QACxB8B;QACAE;QACAE;QACAC;IACF;AACF"}
@@ -49,5 +49,16 @@ export interface UseDataLoadingOptions<TEntity extends Entity, TContext> {
49
49
  * it; so would a listing scoped to one tenant.
50
50
  */
51
51
  baseFiltering?: FilterGroup<TEntity>;
52
+ /**
53
+ * The filter the list *opens* with: applied to the first load and handed back
54
+ * as `filtering`, so the filter panel shows it exactly as if the user had set
55
+ * it — and the user can change or clear it. The opposite of
56
+ * {@link baseFiltering}, a restriction the user never sees and cannot lift.
57
+ * A worklist is this: "orders awaiting dispatch" is the default view of the
58
+ * orders, not the only one.
59
+ *
60
+ * Read once, on mount, like {@link initialPageSize}; a later value is ignored.
61
+ */
62
+ initialFiltering?: FilterGroup<TEntity>;
52
63
  }
53
64
  //# sourceMappingURL=use-data-loading.types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-data-loading.types.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-data-loading/use-data-loading.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EACL,KAAK,cAAc,EACnB,MAAM,EACN,UAAU,EACV,aAAa,EACb,WAAW,EACZ,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEzC,MAAM,WAAW,mBAAmB,CAAC,CAAC,SAAS,MAAM;IACnD,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,cAAc,GAAG,SAAS,CAAC;IAClC;;;;OAIG;IACH,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;IACtC,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;CACvC;AAED,MAAM,MAAM,oBAAoB,CAAC,CAAC,SAAS,MAAM,IAAI;IACnD,GAAG,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC;CACtC,CAAC;AAEF,MAAM,WAAW,qBAAqB,CAAC,OAAO,SAAS,MAAM,EAAE,QAAQ;IACrE,EAAE,EAAE,MAAM,CAAC,MAAM,CACf,UAAU,CAAC,OAAO,CAAC,EACnB,cAAc,EACd,oBAAoB,GAAG,QAAQ,CAChC,CAAC;IACF,GAAG,EAAE,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC/B;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;IAClC;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CACtC"}
1
+ {"version":3,"file":"use-data-loading.types.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-data-loading/use-data-loading.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EACL,KAAK,cAAc,EACnB,MAAM,EACN,UAAU,EACV,aAAa,EACb,WAAW,EACZ,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEzC,MAAM,WAAW,mBAAmB,CAAC,CAAC,SAAS,MAAM;IACnD,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,cAAc,GAAG,SAAS,CAAC;IAClC;;;;OAIG;IACH,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;IACtC,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;CACvC;AAED,MAAM,MAAM,oBAAoB,CAAC,CAAC,SAAS,MAAM,IAAI;IACnD,GAAG,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC;CACtC,CAAC;AAEF,MAAM,WAAW,qBAAqB,CAAC,OAAO,SAAS,MAAM,EAAE,QAAQ;IACrE,EAAE,EAAE,MAAM,CAAC,MAAM,CACf,UAAU,CAAC,OAAO,CAAC,EACnB,cAAc,EACd,oBAAoB,GAAG,QAAQ,CAChC,CAAC;IACF,GAAG,EAAE,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC/B;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;IAClC;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IACrC;;;;;;;;;OASG;IACH,gBAAgB,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CACzC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/hooks/use-data-loading/use-data-loading.types.ts"],"sourcesContent":["import { EntityLoadRequestTag } from '@entifix/business';\nimport {\n type EntifixFailure,\n Entity,\n EntityPage,\n EntitySorting,\n FilterGroup,\n} from '@entifix/core';\nimport { Context, Effect } from 'effect';\n\nexport interface UseDataLoadingState<T extends Entity> {\n isLoading: boolean;\n items: Array<T>;\n totalItems: number;\n currentPage: number;\n pageSize: number;\n error: EntifixFailure | undefined;\n /**\n * The filtering and sorting currently *applied* — not a draft. The controls\n * commit through `onFilteringChange`/`onSortingChange`, so every value here\n * has already been requested from the server.\n */\n filtering: FilterGroup<T> | undefined;\n sorting: EntitySorting<T> | undefined;\n}\n\nexport type UseDataLoadingAction<T extends Entity> = {\n set: Partial<UseDataLoadingState<T>>;\n};\n\nexport interface UseDataLoadingOptions<TEntity extends Entity, TContext> {\n uc: Effect.Effect<\n EntityPage<TEntity>,\n EntifixFailure,\n EntityLoadRequestTag | TContext\n >;\n ctx: Context.Context<TContext>;\n /**\n * Page size for the first load; defaults to 10. Callers that need the whole\n * set rather than a page — a relation picker, say — raise this.\n */\n initialPageSize?: number;\n /**\n * The stable prefix that scopes this list in the shared query cache — pass\n * {@link entityQueryScope}`(Ctor)` so refetches, optimistic writes, and\n * reactive invalidation of the same entity all address one cache entry.\n * Omit it and the hook falls back to a per-instance id: correct in isolation\n * (no cross-list collisions) but unshared, so nothing outside this hook can\n * invalidate it.\n */\n queryKey?: ReadonlyArray<unknown>;\n /**\n * `false` holds the request back without unmounting the hook — what a picker's\n * browse dialog needs, since a list nobody has opened yet must not be fetched.\n * Defaults to `true`, so every existing caller loads on mount as before.\n */\n enabled?: boolean;\n /**\n * A standing restriction ANDed into every request and never shown in the filter\n * panel — \"these are the rows this caller may see at all\", as opposed to the\n * filter the user is editing. A link picker narrowing what may be assigned uses\n * it; so would a listing scoped to one tenant.\n */\n baseFiltering?: FilterGroup<TEntity>;\n}\n"],"names":[],"mappings":"AA8BA,WAkCC"}
1
+ {"version":3,"sources":["../../../src/hooks/use-data-loading/use-data-loading.types.ts"],"sourcesContent":["import { EntityLoadRequestTag } from '@entifix/business';\nimport {\n type EntifixFailure,\n Entity,\n EntityPage,\n EntitySorting,\n FilterGroup,\n} from '@entifix/core';\nimport { Context, Effect } from 'effect';\n\nexport interface UseDataLoadingState<T extends Entity> {\n isLoading: boolean;\n items: Array<T>;\n totalItems: number;\n currentPage: number;\n pageSize: number;\n error: EntifixFailure | undefined;\n /**\n * The filtering and sorting currently *applied* — not a draft. The controls\n * commit through `onFilteringChange`/`onSortingChange`, so every value here\n * has already been requested from the server.\n */\n filtering: FilterGroup<T> | undefined;\n sorting: EntitySorting<T> | undefined;\n}\n\nexport type UseDataLoadingAction<T extends Entity> = {\n set: Partial<UseDataLoadingState<T>>;\n};\n\nexport interface UseDataLoadingOptions<TEntity extends Entity, TContext> {\n uc: Effect.Effect<\n EntityPage<TEntity>,\n EntifixFailure,\n EntityLoadRequestTag | TContext\n >;\n ctx: Context.Context<TContext>;\n /**\n * Page size for the first load; defaults to 10. Callers that need the whole\n * set rather than a page — a relation picker, say — raise this.\n */\n initialPageSize?: number;\n /**\n * The stable prefix that scopes this list in the shared query cache — pass\n * {@link entityQueryScope}`(Ctor)` so refetches, optimistic writes, and\n * reactive invalidation of the same entity all address one cache entry.\n * Omit it and the hook falls back to a per-instance id: correct in isolation\n * (no cross-list collisions) but unshared, so nothing outside this hook can\n * invalidate it.\n */\n queryKey?: ReadonlyArray<unknown>;\n /**\n * `false` holds the request back without unmounting the hook — what a picker's\n * browse dialog needs, since a list nobody has opened yet must not be fetched.\n * Defaults to `true`, so every existing caller loads on mount as before.\n */\n enabled?: boolean;\n /**\n * A standing restriction ANDed into every request and never shown in the filter\n * panel — \"these are the rows this caller may see at all\", as opposed to the\n * filter the user is editing. A link picker narrowing what may be assigned uses\n * it; so would a listing scoped to one tenant.\n */\n baseFiltering?: FilterGroup<TEntity>;\n /**\n * The filter the list *opens* with: applied to the first load and handed back\n * as `filtering`, so the filter panel shows it exactly as if the user had set\n * it — and the user can change or clear it. The opposite of\n * {@link baseFiltering}, a restriction the user never sees and cannot lift.\n * A worklist is this: \"orders awaiting dispatch\" is the default view of the\n * orders, not the only one.\n *\n * Read once, on mount, like {@link initialPageSize}; a later value is ignored.\n */\n initialFiltering?: FilterGroup<TEntity>;\n}\n"],"names":[],"mappings":"AA8BA,WA6CC"}
@@ -32,8 +32,9 @@ export interface UsePendingFlowSettlementOptions {
32
32
  * Settles every pending flow in `store`
33
33
  * ([ADR 0022](../../../../../docs/adr/0022-two-settle-modes-and-the-pending-flow-store.md)).
34
34
  *
35
- * Each pending flow's topic is subscribed: `flow.completed` confirms it and
36
- * `flow.failed` fails it. A push may have been missed while the stream was
35
+ * Each pending flow's topic is subscribed: `flow.completed` confirms it, and so
36
+ * does `flow.waiting` — a flow parked past its commit point has landed the
37
+ * caller's write and waits on someone else — and `flow.failed` fails it. A push may have been missed while the stream was
37
38
  * down or before the topic was subscribed, so each (re)connection and each
38
39
  * resync re-reads the status of the flows it touches. A status read that
39
40
  * answers `404` means not projected yet, never failed. Mount it once, where
@@ -1 +1 @@
1
- {"version":3,"file":"use-pending-flow-settlement.d.ts","sourceRoot":"","sources":["../../src/pending/use-pending-flow-settlement.tsx"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,cAAc,EAEpB,MAAM,eAAe,CAAC;AACvB,OAAO,E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AAc,EAAE,MAAM,uBAAuB,CAAC;AAC3E,OAAO,EAAE,MAAM,EAAU,MAAM,QAAQ,CAAC;AAGxC,OAAO,EAAa,KAAK,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,KAAK,EAEV,WAAW,EACX,gBAAgB,EACjB,MAAM,yBAAyB,CAAC;AAEjC,6EAA6E;AAC7E,MAAM,MAAM,cAAc,GAAG,CAC3B,IAAI,EAAE,MAAM,KACT,MAAM,CAAC,MAAM,CAAC,cAAc,GAAG,SAAS,EAAE,OAAO,CAAC,CAAC;AAExD,MAAM,WAAW,+BAA+B;IAC9C,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,gBAAgB,CAAC;IACjC;;;OAGG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,cAAc,CAAC;IACrC;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IAC5B;;;OAGG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,WAAW,KAAK,IAAI,CAAC;IAC1E,8CAA8C;IAC9C,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI,CAAC;CACpD;AAWD;;;;;;;;;;;GAWG;AACH,wBAAgB,wBAAwB,CAAC,EACvC,OAAO,EACP,KAAK,EACL,UAAU,EACV,QAAQ,EACR,GAAc,EACd,SAAS,EACT,WAAW,GACZ,EAAE,+BAA+B,GAAG,IAAI,CA+FxC"}
@@ -12,8 +12,9 @@ const failureOf = (named)=>named === undefined ? new Internal() : decodeProblem(
12
12
  * Settles every pending flow in `store`
13
13
  * ([ADR 0022](../../../../../docs/adr/0022-two-settle-modes-and-the-pending-flow-store.md)).
14
14
  *
15
- * Each pending flow's topic is subscribed: `flow.completed` confirms it and
16
- * `flow.failed` fails it. A push may have been missed while the stream was
15
+ * Each pending flow's topic is subscribed: `flow.completed` confirms it, and so
16
+ * does `flow.waiting` — a flow parked past its commit point has landed the
17
+ * caller's write and waits on someone else — and `flow.failed` fails it. A push may have been missed while the stream was
17
18
  * down or before the topic was subscribed, so each (re)connection and each
18
19
  * resync re-reads the status of the flows it touches. A status read that
19
20
  * answers `404` means not projected yet, never failed. Mount it once, where
@@ -48,7 +49,7 @@ const failureOf = (named)=>named === undefined ? new Internal() : decodeProblem(
48
49
  useEffect(()=>{
49
50
  const settle = settleRef.current(store);
50
51
  const onEvent = (flow)=>(event)=>{
51
- if (event.name === 'flow.completed') settle(flow, {
52
+ if (event.name === 'flow.completed' || event.name === 'flow.waiting') settle(flow, {
52
53
  kind: 'confirmed',
53
54
  event
54
55
  });
@@ -93,6 +94,12 @@ const failureOf = (named)=>named === undefined ? new Internal() : decodeProblem(
93
94
  return settle(flow, {
94
95
  kind: 'confirmed'
95
96
  });
97
+ // Parked past its commit point, the write has landed; parked
98
+ // before it, nothing has, and the flow stays pending.
99
+ case 'waiting':
100
+ return status.committed === true ? settle(flow, {
101
+ kind: 'confirmed'
102
+ }) : undefined;
96
103
  case 'failed':
97
104
  case 'compensated':
98
105
  case 'interrupted':
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/pending/use-pending-flow-settlement.tsx"],"sourcesContent":["'use client';\n\nimport {\n decodeProblem,\n type DomainEvent,\n type EntifixFailure,\n Internal,\n} from '@entifix/core';\nimport { FlowEventData, type FlowStatusBody } from '@entifix/transactions';\nimport { Effect, Schema } from 'effect';\nimport { useEffect, useRef, useSyncExternalStore } from 'react';\n\nimport { flowTopic, type PushChannel } from '../reactive/push-channel.js';\nimport type {\n FlowOutcome,\n PendingFlow,\n PendingFlowStore,\n} from './pending-flow-store.js';\n\n/** Reads a flow's `status` link; `undefined` is a flow not projected yet. */\nexport type FlowStatusRead = (\n href: string,\n) => Effect.Effect<FlowStatusBody | undefined, unknown>;\n\nexport interface UsePendingFlowSettlementOptions {\n readonly channel: PushChannel;\n readonly store: PendingFlowStore;\n /**\n * Reads a flow's status when its push may have been missed: on every\n * (re)connection and on a resync. Omitted, a flow settles by push alone.\n */\n readonly readStatus?: FlowStatusRead;\n /**\n * How long a flow nobody can account for stays pending, in milliseconds.\n * Past it, a flow whose status read still answers `404` — or that has no\n * status link — is dropped as failed, with nothing to tell the user why.\n */\n readonly maxAgeMs: number;\n readonly now?: () => number;\n /**\n * The toast event: runs exactly once for each flow that failed with a\n * reason, carrying the decoded failure.\n */\n readonly onFailure?: (failure: EntifixFailure, flow: PendingFlow) => void;\n /** Runs once for each flow that completed. */\n readonly onConfirmed?: (flow: PendingFlow) => void;\n}\n\nconst isFlowEvent = Schema.is(FlowEventData);\n\n// A failure the flow named, decoded into its registered class; a flow that\n// ended badly without naming one is an internal failure.\nconst failureOf = (\n named: FlowStatusBody['failure'] | undefined,\n): EntifixFailure =>\n named === undefined ? new Internal() : decodeProblem(named);\n\n/**\n * Settles every pending flow in `store`\n * ([ADR 0022](../../../../../docs/adr/0022-two-settle-modes-and-the-pending-flow-store.md)).\n *\n * Each pending flow's topic is subscribed: `flow.completed` confirms it and\n * `flow.failed` fails it. A push may have been missed while the stream was\n * down or before the topic was subscribed, so each (re)connection and each\n * resync re-reads the status of the flows it touches. A status read that\n * answers `404` means not projected yet, never failed. Mount it once, where\n * the host mounts its toast region.\n */\nexport function usePendingFlowSettlement({\n channel,\n store,\n readStatus,\n maxAgeMs,\n now = Date.now,\n onFailure,\n onConfirmed,\n}: UsePendingFlowSettlementOptions): void {\n const flows = useSyncExternalStore(store.subscribe, store.list, store.list);\n const latest = useRef({ readStatus, maxAgeMs, now, onFailure, onConfirmed });\n useEffect(() => {\n latest.current = { readStatus, maxAgeMs, now, onFailure, onConfirmed };\n });\n\n // Settles one flow, telling the host only if this call is what settled it:\n // a redelivered outcome, or a push racing a status read, settles nothing.\n const settleIn =\n (held: PendingFlowStore) => (flow: PendingFlow, outcome: FlowOutcome) => {\n if (!held.settle(flow.flowId, outcome)) return;\n if (outcome.kind === 'confirmed') latest.current.onConfirmed?.(flow);\n else if (outcome.failure !== undefined)\n latest.current.onFailure?.(outcome.failure, flow);\n };\n const settleRef = useRef(settleIn);\n\n const key = flows.map(flow => flow.flowId).join(' ');\n useEffect(() => {\n const settle = settleRef.current(store);\n const onEvent = (flow: PendingFlow) => (event: DomainEvent) => {\n if (event.name === 'flow.completed')\n settle(flow, { kind: 'confirmed', event });\n else if (event.name === 'flow.failed' && isFlowEvent(event.data))\n settle(flow, {\n kind: 'failed',\n failure: failureOf(event.data.failure),\n });\n };\n const unsubscribes = store\n .list()\n .map(flow => channel.subscribe(flowTopic(flow.flowId), onEvent(flow)));\n return () => {\n for (const unsubscribe of unsubscribes) unsubscribe();\n };\n }, [channel, key, store]);\n\n useEffect(() => {\n const settle = settleRef.current(store);\n const expire = (flow: PendingFlow) => {\n const { now: clock, maxAgeMs: bound } = latest.current;\n if (clock() - Date.parse(flow.createdAt) > bound)\n settle(flow, { kind: 'failed' });\n };\n const reconcile = (pending: readonly PendingFlow[]) => {\n const read = latest.current.readStatus;\n for (const flow of pending) {\n if (read === undefined || flow.status === undefined) {\n expire(flow);\n continue;\n }\n void Effect.runPromise(\n Effect.match(read(flow.status), {\n // An unreachable status read is not an answer: the flow waits for\n // the next connection.\n onFailure: () => undefined,\n onSuccess: status => {\n switch (status?.state) {\n case undefined:\n return expire(flow);\n case 'completed':\n return settle(flow, { kind: 'confirmed' });\n case 'failed':\n case 'compensated':\n case 'interrupted':\n return settle(flow, {\n kind: 'failed',\n failure: failureOf(status.failure),\n });\n default:\n return undefined;\n }\n },\n }),\n );\n }\n };\n const stopConnect = channel.onConnect(() => {\n void store.ready.then(() => reconcile(store.list()));\n });\n const stopResync = channel.onResync(topics => {\n reconcile(store.list().filter(flow => topics.includes(flow.topic)));\n });\n return () => {\n stopConnect();\n stopResync();\n };\n }, [channel, store]);\n}\n"],"names":["decodeProblem","Internal","FlowEventData","Effect","Schema","useEffect","useRef","useSyncExternalStore","flowTopic","isFlowEvent","is","failureOf","named","undefined","usePendingFlowSettlement","channel","store","readStatus","maxAgeMs","now","Date","onFailure","onConfirmed","flows","subscribe","list","latest","current","settleIn","held","flow","outcome","settle","flowId","kind","failure","settleRef","key","map","join","onEvent","event","name","data","unsubscribes","unsubscribe","expire","clock","bound","parse","createdAt","reconcile","pending","read","status","runPromise","match","onSuccess","state","stopConnect","onConnect","ready","then","stopResync","onResync","topics","filter","includes","topic"],"mappings":"AAAA;AAEA,SACEA,aAAa,EAGbC,QAAQ,QACH,gBAAgB;AACvB,SAASC,aAAa,QAA6B,wBAAwB;AAC3E,SAASC,MAAM,EAAEC,MAAM,QAAQ,SAAS;AACxC,SAASC,SAAS,EAAEC,MAAM,EAAEC,oBAAoB,QAAQ,QAAQ;AAEhE,SAASC,SAAS,QAA0B,8BAA8B;AAoC1E,MAAMC,cAAcL,OAAOM,EAAE,CAACR;AAE9B,2EAA2E;AAC3E,yDAAyD;AACzD,MAAMS,YAAY,CAChBC,QAEAA,UAAUC,YAAY,IAAIZ,aAAaD,cAAcY;AAEvD;;;;;;;;;;CAUC,GACD,OAAO,SAASE,yBAAyB,EACvCC,OAAO,EACPC,KAAK,EACLC,UAAU,EACVC,QAAQ,EACRC,MAAMC,KAAKD,GAAG,EACdE,SAAS,EACTC,WAAW,EACqB;IAChC,MAAMC,QAAQhB,qBAAqBS,MAAMQ,SAAS,EAAER,MAAMS,IAAI,EAAET,MAAMS,IAAI;IAC1E,MAAMC,SAASpB,OAAO;QAAEW;QAAYC;QAAUC;QAAKE;QAAWC;IAAY;IAC1EjB,UAAU;QACRqB,OAAOC,OAAO,GAAG;YAAEV;YAAYC;YAAUC;YAAKE;YAAWC;QAAY;IACvE;IAEA,2EAA2E;IAC3E,0EAA0E;IAC1E,MAAMM,WACJ,CAACC,OAA2B,CAACC,MAAmBC;YAC9C,IAAI,CAACF,KAAKG,MAAM,CAACF,KAAKG,MAAM,EAAEF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YAAS;QAClC;QACA,MAAMiB,YAAY,CAACC;YACjB,MAAMC,OAAO3B,OAAOC,OAAO,CAACV,UAAU;YACtC,KAAK,MAAMa,QAAQsB,QAAS;gBAC1B,IAAIC,SAASxC,aAAaiB,KAAKwB,MAAM,KAAKzC,WAAW;oBACnDiC,OAAOhB;oBACP;gBACF;gBACA,KAAK3B,OAAOoD,UAAU,CACpBpD,OAAOqD,KAAK,CAACH,KAAKvB,KAAKwB,MAAM,GAAG;oBAC9B,kEAAkE;oBAClE,uBAAuB;oBACvBjC,WAAW,IAAMR;oBACjB4C,WAAWH,CAAAA;wBACT,OAAQA,0BAAAA,OAAQI,KAAK;4BACnB,KAAK7C;gCACH,OAAOiC,OAAOhB;4BAChB,KAAK;gCACH,OAAOE,OAAOF,MAAM;oCAAEI,MAAM;gCAAY;4BAC1C,KAAK;4BACL,KAAK;4BACL,KAAK;gCACH,OAAOF,OAAOF,MAAM;oCAClBI,MAAM;oCACNC,SAASxB,UAAU2C,OAAOnB,OAAO;gCACnC;4BACF;gCACE,OAAOtB;wBACX;oBACF;gBACF;YAEJ;QACF;QACA,MAAM8C,cAAc5C,QAAQ6C,SAAS,CAAC;YACpC,KAAK5C,MAAM6C,KAAK,CAACC,IAAI,CAAC,IAAMX,UAAUnC,MAAMS,IAAI;QAClD;QACA,MAAMsC,aAAahD,QAAQiD,QAAQ,CAACC,CAAAA;YAClCd,UAAUnC,MAAMS,IAAI,GAAGyC,MAAM,CAACpC,CAAAA,OAAQmC,OAAOE,QAAQ,CAACrC,KAAKsC,KAAK;QAClE;QACA,OAAO;YACLT;YACAI;QACF;IACF,GAAG;QAAChD;QAASC;KAAM;AACrB"}
1
+ {"version":3,"sources":["../../src/pending/use-pending-flow-settlement.tsx"],"sourcesContent":["'use client';\n\nimport {\n decodeProblem,\n type DomainEvent,\n type EntifixFailure,\n Internal,\n} from '@entifix/core';\nimport { FlowEventData, type FlowStatusBody } from '@entifix/transactions';\nimport { Effect, Schema } from 'effect';\nimport { useEffect, useRef, useSyncExternalStore } from 'react';\n\nimport { flowTopic, type PushChannel } from '../reactive/push-channel.js';\nimport type {\n FlowOutcome,\n PendingFlow,\n PendingFlowStore,\n} from './pending-flow-store.js';\n\n/** Reads a flow's `status` link; `undefined` is a flow not projected yet. */\nexport type FlowStatusRead = (\n href: string,\n) => Effect.Effect<FlowStatusBody | undefined, unknown>;\n\nexport interface UsePendingFlowSettlementOptions {\n readonly channel: PushChannel;\n readonly store: PendingFlowStore;\n /**\n * Reads a flow's status when its push may have been missed: on every\n * (re)connection and on a resync. Omitted, a flow settles by push alone.\n */\n readonly readStatus?: FlowStatusRead;\n /**\n * How long a flow nobody can account for stays pending, in milliseconds.\n * Past it, a flow whose status read still answers `404` — or that has no\n * status link — is dropped as failed, with nothing to tell the user why.\n */\n readonly maxAgeMs: number;\n readonly now?: () => number;\n /**\n * The toast event: runs exactly once for each flow that failed with a\n * reason, carrying the decoded failure.\n */\n readonly onFailure?: (failure: EntifixFailure, flow: PendingFlow) => void;\n /** Runs once for each flow that completed. */\n readonly onConfirmed?: (flow: PendingFlow) => void;\n}\n\nconst isFlowEvent = Schema.is(FlowEventData);\n\n// A failure the flow named, decoded into its registered class; a flow that\n// ended badly without naming one is an internal failure.\nconst failureOf = (\n named: FlowStatusBody['failure'] | undefined,\n): EntifixFailure =>\n named === undefined ? new Internal() : decodeProblem(named);\n\n/**\n * Settles every pending flow in `store`\n * ([ADR 0022](../../../../../docs/adr/0022-two-settle-modes-and-the-pending-flow-store.md)).\n *\n * Each pending flow's topic is subscribed: `flow.completed` confirms it, and so\n * does `flow.waiting` — a flow parked past its commit point has landed the\n * caller's write and waits on someone else — and `flow.failed` fails it. A push may have been missed while the stream was\n * down or before the topic was subscribed, so each (re)connection and each\n * resync re-reads the status of the flows it touches. A status read that\n * answers `404` means not projected yet, never failed. Mount it once, where\n * the host mounts its toast region.\n */\nexport function usePendingFlowSettlement({\n channel,\n store,\n readStatus,\n maxAgeMs,\n now = Date.now,\n onFailure,\n onConfirmed,\n}: UsePendingFlowSettlementOptions): void {\n const flows = useSyncExternalStore(store.subscribe, store.list, store.list);\n const latest = useRef({ readStatus, maxAgeMs, now, onFailure, onConfirmed });\n useEffect(() => {\n latest.current = { readStatus, maxAgeMs, now, onFailure, onConfirmed };\n });\n\n // Settles one flow, telling the host only if this call is what settled it:\n // a redelivered outcome, or a push racing a status read, settles nothing.\n const settleIn =\n (held: PendingFlowStore) => (flow: PendingFlow, outcome: FlowOutcome) => {\n if (!held.settle(flow.flowId, outcome)) return;\n if (outcome.kind === 'confirmed') latest.current.onConfirmed?.(flow);\n else if (outcome.failure !== undefined)\n latest.current.onFailure?.(outcome.failure, flow);\n };\n const settleRef = useRef(settleIn);\n\n const key = flows.map(flow => flow.flowId).join(' ');\n useEffect(() => {\n const settle = settleRef.current(store);\n const onEvent = (flow: PendingFlow) => (event: DomainEvent) => {\n if (event.name === 'flow.completed' || event.name === 'flow.waiting')\n settle(flow, { kind: 'confirmed', event });\n else if (event.name === 'flow.failed' && isFlowEvent(event.data))\n settle(flow, {\n kind: 'failed',\n failure: failureOf(event.data.failure),\n });\n };\n const unsubscribes = store\n .list()\n .map(flow => channel.subscribe(flowTopic(flow.flowId), onEvent(flow)));\n return () => {\n for (const unsubscribe of unsubscribes) unsubscribe();\n };\n }, [channel, key, store]);\n\n useEffect(() => {\n const settle = settleRef.current(store);\n const expire = (flow: PendingFlow) => {\n const { now: clock, maxAgeMs: bound } = latest.current;\n if (clock() - Date.parse(flow.createdAt) > bound)\n settle(flow, { kind: 'failed' });\n };\n const reconcile = (pending: readonly PendingFlow[]) => {\n const read = latest.current.readStatus;\n for (const flow of pending) {\n if (read === undefined || flow.status === undefined) {\n expire(flow);\n continue;\n }\n void Effect.runPromise(\n Effect.match(read(flow.status), {\n // An unreachable status read is not an answer: the flow waits for\n // the next connection.\n onFailure: () => undefined,\n onSuccess: status => {\n switch (status?.state) {\n case undefined:\n return expire(flow);\n case 'completed':\n return settle(flow, { kind: 'confirmed' });\n // Parked past its commit point, the write has landed; parked\n // before it, nothing has, and the flow stays pending.\n case 'waiting':\n return status.committed === true\n ? settle(flow, { kind: 'confirmed' })\n : undefined;\n case 'failed':\n case 'compensated':\n case 'interrupted':\n return settle(flow, {\n kind: 'failed',\n failure: failureOf(status.failure),\n });\n default:\n return undefined;\n }\n },\n }),\n );\n }\n };\n const stopConnect = channel.onConnect(() => {\n void store.ready.then(() => reconcile(store.list()));\n });\n const stopResync = channel.onResync(topics => {\n reconcile(store.list().filter(flow => topics.includes(flow.topic)));\n });\n return () => {\n stopConnect();\n stopResync();\n };\n }, [channel, store]);\n}\n"],"names":["decodeProblem","Internal","FlowEventData","Effect","Schema","useEffect","useRef","useSyncExternalStore","flowTopic","isFlowEvent","is","failureOf","named","undefined","usePendingFlowSettlement","channel","store","readStatus","maxAgeMs","now","Date","onFailure","onConfirmed","flows","subscribe","list","latest","current","settleIn","held","flow","outcome","settle","flowId","kind","failure","settleRef","key","map","join","onEvent","event","name","data","unsubscribes","unsubscribe","expire","clock","bound","parse","createdAt","reconcile","pending","read","status","runPromise","match","onSuccess","state","committed","stopConnect","onConnect","ready","then","stopResync","onResync","topics","filter","includes","topic"],"mappings":"AAAA;AAEA,SACEA,aAAa,EAGbC,QAAQ,QACH,gBAAgB;AACvB,SAASC,aAAa,QAA6B,wBAAwB;AAC3E,SAASC,MAAM,EAAEC,MAAM,QAAQ,SAAS;AACxC,SAASC,SAAS,EAAEC,MAAM,EAAEC,oBAAoB,QAAQ,QAAQ;AAEhE,SAASC,SAAS,QAA0B,8BAA8B;AAoC1E,MAAMC,cAAcL,OAAOM,EAAE,CAACR;AAE9B,2EAA2E;AAC3E,yDAAyD;AACzD,MAAMS,YAAY,CAChBC,QAEAA,UAAUC,YAAY,IAAIZ,aAAaD,cAAcY;AAEvD;;;;;;;;;;;CAWC,GACD,OAAO,SAASE,yBAAyB,EACvCC,OAAO,EACPC,KAAK,EACLC,UAAU,EACVC,QAAQ,EACRC,MAAMC,KAAKD,GAAG,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ACF;gBACF;YAEJ;QACF;QACA,MAAM+C,cAAc7C,QAAQ8C,SAAS,CAAC;YACpC,KAAK7C,MAAM8C,KAAK,CAACC,IAAI,CAAC,IAAMZ,UAAUnC,MAAMS,IAAI;QAClD;QACA,MAAMuC,aAAajD,QAAQkD,QAAQ,CAACC,CAAAA;YAClCf,UAAUnC,MAAMS,IAAI,GAAG0C,MAAM,CAACrC,CAAAA,OAAQoC,OAAOE,QAAQ,CAACtC,KAAKuC,KAAK;QAClE;QACA,OAAO;YACLT;YACAI;QACF;IACF,GAAG;QAACjD;QAASC;KAAM;AACrB"}
package/package.json CHANGED
@@ -21,7 +21,7 @@
21
21
  }
22
22
  }
23
23
  },
24
- "version": "0.16.0",
24
+ "version": "0.18.0",
25
25
  "description": "React hooks that bind entities to data: TanStack Query and Form over the entity adapters, drafts, mutations and live invalidation.",
26
26
  "license": "MIT",
27
27
  "repository": {
@@ -65,16 +65,16 @@
65
65
  "LICENSE"
66
66
  ],
67
67
  "dependencies": {
68
- "@entifix/business": "0.16.0",
69
- "@entifix/core": "0.16.0",
70
- "@entifix/transactions": "0.16.0"
68
+ "@entifix/business": "0.18.0",
69
+ "@entifix/core": "0.18.0",
70
+ "@entifix/transactions": "0.18.0"
71
71
  },
72
72
  "devDependencies": {
73
73
  "@tanstack/react-form": "1.33.5",
74
74
  "@tanstack/react-query": "^5.105.1",
75
75
  "effect": "4.0.7",
76
76
  "react": "19.3.1",
77
- "@entifix/testing-unit": "0.16.0"
77
+ "@entifix/testing-unit": "0.18.0"
78
78
  },
79
79
  "peerDependencies": {
80
80
  "@tanstack/react-form": ">=1.33 <2",