@entifix/react-integration 0.13.0 → 0.15.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.
Files changed (64) hide show
  1. package/dist/event-source.d.ts +5 -4
  2. package/dist/event-source.d.ts.map +1 -1
  3. package/dist/event-source.js +5 -4
  4. package/dist/event-source.js.map +1 -1
  5. package/dist/hooks/use-data-loading/use-data-loading.d.ts +2 -2
  6. package/dist/hooks/use-data-loading/use-data-loading.d.ts.map +1 -1
  7. package/dist/hooks/use-data-loading/use-data-loading.js.map +1 -1
  8. package/dist/hooks/use-data-loading/use-data-loading.types.d.ts +3 -3
  9. package/dist/hooks/use-data-loading/use-data-loading.types.d.ts.map +1 -1
  10. package/dist/hooks/use-data-loading/use-data-loading.types.js.map +1 -1
  11. package/dist/hooks/use-entity-link-source/use-entity-link-source.d.ts.map +1 -1
  12. package/dist/hooks/use-entity-link-source/use-entity-link-source.js.map +1 -1
  13. package/dist/hooks/use-entity-link-source/use-entity-link-source.types.d.ts +3 -3
  14. package/dist/hooks/use-entity-link-source/use-entity-link-source.types.d.ts.map +1 -1
  15. package/dist/hooks/use-entity-link-source/use-entity-link-source.types.js.map +1 -1
  16. package/dist/hooks/use-entity-mutation/use-entity-mutation.d.ts +2 -2
  17. package/dist/hooks/use-entity-mutation/use-entity-mutation.d.ts.map +1 -1
  18. package/dist/hooks/use-entity-mutation/use-entity-mutation.js.map +1 -1
  19. package/dist/hooks/use-entity-mutation/use-entity-mutation.types.d.ts +4 -4
  20. package/dist/hooks/use-entity-mutation/use-entity-mutation.types.d.ts.map +1 -1
  21. package/dist/hooks/use-entity-mutation/use-entity-mutation.types.js.map +1 -1
  22. package/dist/hooks/use-entity-record/use-entity-record.d.ts +2 -2
  23. package/dist/hooks/use-entity-record/use-entity-record.d.ts.map +1 -1
  24. package/dist/hooks/use-entity-record/use-entity-record.js.map +1 -1
  25. package/dist/hooks/use-entity-record/use-entity-record.types.d.ts +3 -3
  26. package/dist/hooks/use-entity-record/use-entity-record.types.d.ts.map +1 -1
  27. package/dist/hooks/use-entity-record/use-entity-record.types.js.map +1 -1
  28. package/dist/index.d.ts +5 -1
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.js +5 -1
  31. package/dist/index.js.map +1 -1
  32. package/dist/pending/pending-flow-store.d.ts +86 -0
  33. package/dist/pending/pending-flow-store.d.ts.map +1 -0
  34. package/dist/pending/pending-flow-store.js +124 -0
  35. package/dist/pending/pending-flow-store.js.map +1 -0
  36. package/dist/pending/use-optimistic-mutation.d.ts +61 -0
  37. package/dist/pending/use-optimistic-mutation.d.ts.map +1 -0
  38. package/dist/pending/use-optimistic-mutation.js +88 -0
  39. package/dist/pending/use-optimistic-mutation.js.map +1 -0
  40. package/dist/pending/use-pending-flow-settlement.d.ts +43 -0
  41. package/dist/pending/use-pending-flow-settlement.d.ts.map +1 -0
  42. package/dist/pending/use-pending-flow-settlement.js +126 -0
  43. package/dist/pending/use-pending-flow-settlement.js.map +1 -0
  44. package/dist/reactive/event-source-push-channel.d.ts +56 -0
  45. package/dist/reactive/event-source-push-channel.d.ts.map +1 -0
  46. package/dist/reactive/event-source-push-channel.js +118 -0
  47. package/dist/reactive/event-source-push-channel.js.map +1 -0
  48. package/dist/reactive/push-channel.d.ts +69 -0
  49. package/dist/reactive/push-channel.d.ts.map +1 -0
  50. package/dist/reactive/push-channel.js +33 -0
  51. package/dist/reactive/push-channel.js.map +1 -0
  52. package/dist/reactive/push-router.d.ts +26 -0
  53. package/dist/reactive/push-router.d.ts.map +1 -0
  54. package/dist/reactive/push-router.js +64 -0
  55. package/dist/reactive/push-router.js.map +1 -0
  56. package/dist/reactive/use-reactive-cache.d.ts +49 -0
  57. package/dist/reactive/use-reactive-cache.d.ts.map +1 -0
  58. package/dist/reactive/use-reactive-cache.js +106 -0
  59. package/dist/reactive/use-reactive-cache.js.map +1 -0
  60. package/package.json +7 -7
  61. package/dist/reactive/use-transaction-settlement.d.ts +0 -57
  62. package/dist/reactive/use-transaction-settlement.d.ts.map +0 -1
  63. package/dist/reactive/use-transaction-settlement.js +0 -137
  64. package/dist/reactive/use-transaction-settlement.js.map +0 -1
package/package.json CHANGED
@@ -21,7 +21,7 @@
21
21
  }
22
22
  }
23
23
  },
24
- "version": "0.13.0",
24
+ "version": "0.15.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,21 +65,21 @@
65
65
  "LICENSE"
66
66
  ],
67
67
  "dependencies": {
68
- "@entifix/business": "0.13.0",
69
- "@entifix/core": "0.13.0",
70
- "@entifix/transactions": "0.13.0"
68
+ "@entifix/business": "0.15.0",
69
+ "@entifix/core": "0.15.0",
70
+ "@entifix/transactions": "0.15.0"
71
71
  },
72
72
  "devDependencies": {
73
73
  "@tanstack/react-form": "1.33.5",
74
74
  "@tanstack/react-query": "^5.105.1",
75
- "effect": "4.0.6",
75
+ "effect": "4.0.7",
76
76
  "react": "19.3.1",
77
- "@entifix/testing-unit": "0.13.0"
77
+ "@entifix/testing-unit": "0.15.0"
78
78
  },
79
79
  "peerDependencies": {
80
80
  "@tanstack/react-form": ">=1.33 <2",
81
81
  "@tanstack/react-query": ">=5.101 <6",
82
- "effect": "^4.0.6",
82
+ "effect": "^4.0.7",
83
83
  "react": ">=19 <20"
84
84
  }
85
85
  }
@@ -1,57 +0,0 @@
1
- import type { PendingTransactionStore, TransactionRecord, TransactionStatusReader } from '@entifix/transactions';
2
- import type { ReactiveChannel } from './reactive-channel.js';
3
- interface SettlementBase {
4
- /** The stream outcomes arrive on, and whose reconnects trigger a re-query. */
5
- channel: ReactiveChannel;
6
- /**
7
- * The writes being watched.
8
- *
9
- * Passed in rather than imported: the store is a shell concern
10
- * (`@entifix/next-shell`, T4) and this hook is T3, which may not depend
11
- * upward. Same seam, and the same reason, as `EntityDraftStore` for autosave.
12
- */
13
- pending: PendingTransactionStore;
14
- pollIntervalMs?: number;
15
- }
16
- /**
17
- * How a record is read, and exactly one way.
18
- *
19
- * `reader` is the port, built once where the host composes its adapters, so the
20
- * component calling this hook imports no transport. `read` is the same thing as
21
- * a bare function, for a caller that already holds one.
22
- */
23
- type RecordSource = {
24
- /** Reads one record. `undefined` means *not tracked yet* — never *failed*. */
25
- reader: TransactionStatusReader;
26
- read?: never;
27
- } | {
28
- /** Reads one record. `undefined` means *not tracked yet* — never *failed*. */
29
- read: (transactionId: string) => Promise<TransactionRecord | undefined>;
30
- reader?: never;
31
- };
32
- export type UseTransactionSettlementOptions = SettlementBase & RecordSource;
33
- /**
34
- * Settles the optimistic writes this browser started.
35
- *
36
- * Three things drive it, and they exist for three different failures:
37
- *
38
- * - **The stream**, the fast path: `transaction.completed` and
39
- * `transaction.failed` carry the correlation id, so an outcome lands in the
40
- * moment it happens.
41
- * - **`onConnect`**, because the stream does not replay. It fires on
42
- * every open *including for a listener registered while already connected*, so
43
- * a page load holding a restored pending set and an in-session reconnect take
44
- * one path rather than two.
45
- * - **An interval**, because `STALE` is written by the recovery sweep and emits
46
- * no event at all — it is reachable only by asking. It runs only while
47
- * something is pending, so an idle workspace polls nothing.
48
- *
49
- * ⚠️ **A missing record keeps the entry pending.** `accepted` reaches the
50
- * tracker over the bus, so with the broker down the entity write commits while
51
- * no event is ever published and the tracker holds nothing. Rolling back there
52
- * un-renders a healthy write at exactly the moment nobody can tell a UI bug from
53
- * an outage. Only `FAILED` and `STALE` are terminal.
54
- */
55
- export declare function useTransactionSettlement({ channel, pending, pollIntervalMs, ...source }: UseTransactionSettlementOptions): void;
56
- export {};
57
- //# sourceMappingURL=use-transaction-settlement.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-transaction-settlement.d.ts","sourceRoot":"","sources":["../../src/reactive/use-transaction-settlement.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEV,uBAAuB,EACvB,iBAAiB,EACjB,uBAAuB,EACxB,MAAM,uBAAuB,CAAC;AAM/B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAK7D,UAAU,cAAc;IACtB,8EAA8E;IAC9E,OAAO,EAAE,eAAe,CAAC;IACzB;;;;;;OAMG;IACH,OAAO,EAAE,uBAAuB,CAAC;IACjC,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;GAMG;AACH,KAAK,YAAY,GACb;IACE,8EAA8E;IAC9E,MAAM,EAAE,uBAAuB,CAAC;IAChC,IAAI,CAAC,EAAE,KAAK,CAAC;CACd,GACD;IACE,8EAA8E;IAC9E,IAAI,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC,CAAC;IACxE,MAAM,CAAC,EAAE,KAAK,CAAC;CAChB,CAAC;AAEN,MAAM,MAAM,+BAA+B,GAAG,cAAc,GAAG,YAAY,CAAC;AAU5E;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,wBAAwB,CAAC,EACvC,OAAO,EACP,OAAO,EACP,cAAgC,EAChC,GAAG,MAAM,EACV,EAAE,+BAA+B,GAAG,IAAI,CA6GxC"}
@@ -1,137 +0,0 @@
1
- 'use client';
2
- import { _ as _object_without_properties_loose } from "@swc/helpers/_/_object_without_properties_loose";
3
- import { useQueryClient } from '@tanstack/react-query';
4
- import { Effect } from 'effect';
5
- import { useCallback, useEffect, useRef } from 'react';
6
- import { entityQueryScopeFor } from '../query/entity-query-key.js';
7
- /** How often to re-ask while anything is pending. */ const DEFAULT_POLL_MS = 30000;
8
- const readerOf = (source)=>{
9
- if (source.reader === undefined) return source.read;
10
- const { reader } = source;
11
- return (transactionId)=>Effect.runPromise(reader.read(transactionId));
12
- };
13
- /**
14
- * Settles the optimistic writes this browser started.
15
- *
16
- * Three things drive it, and they exist for three different failures:
17
- *
18
- * - **The stream**, the fast path: `transaction.completed` and
19
- * `transaction.failed` carry the correlation id, so an outcome lands in the
20
- * moment it happens.
21
- * - **`onConnect`**, because the stream does not replay. It fires on
22
- * every open *including for a listener registered while already connected*, so
23
- * a page load holding a restored pending set and an in-session reconnect take
24
- * one path rather than two.
25
- * - **An interval**, because `STALE` is written by the recovery sweep and emits
26
- * no event at all — it is reachable only by asking. It runs only while
27
- * something is pending, so an idle workspace polls nothing.
28
- *
29
- * ⚠️ **A missing record keeps the entry pending.** `accepted` reaches the
30
- * tracker over the bus, so with the broker down the entity write commits while
31
- * no event is ever published and the tracker holds nothing. Rolling back there
32
- * un-renders a healthy write at exactly the moment nobody can tell a UI bug from
33
- * an outage. Only `FAILED` and `STALE` are terminal.
34
- */ export function useTransactionSettlement(_0) {
35
- let { channel, pending, pollIntervalMs = DEFAULT_POLL_MS } = _0, source = _object_without_properties_loose(_0, [
36
- "channel",
37
- "pending",
38
- "pollIntervalMs"
39
- ]);
40
- const read = readerOf(source);
41
- const queryClient = useQueryClient();
42
- // The store is rebuilt whenever an entry changes and `read` is typically
43
- // inline, so both are held in refs: keying the subscription on their identity
44
- // would tear down and re-open the stream every time a write settled.
45
- const pendingRef = useRef(pending);
46
- const readRef = useRef(read);
47
- // Refs may not be written during render. This runs before the effects below,
48
- // since effects fire in declaration order, so they always see the latest.
49
- useEffect(()=>{
50
- pendingRef.current = pending;
51
- readRef.current = read;
52
- });
53
- const invalidate = useCallback((entity)=>void queryClient.invalidateQueries({
54
- queryKey: entityQueryScopeFor(entity)
55
- }), [
56
- queryClient
57
- ]);
58
- /**
59
- * Applies whatever the tracker currently says about one entry.
60
- *
61
- * The single place the terminal-state rule lives — the stream path, the
62
- * reconnect path and the interval all come through here, so there is one
63
- * answer to "what does this state mean" rather than three that can drift.
64
- */ const reconcile = useCallback(async (entry)=>{
65
- const record = await readRef.current(entry.transactionId).catch(// The tracker being unreachable says nothing about the write. Keeping
66
- // the entry is what makes a service restart converge instead of dropping
67
- // every optimistic row on the floor.
68
- ()=>undefined);
69
- // ⚠️ Not tracked yet, or still running. Either way it is not over, and
70
- // this is the branch that must not be turned into a rollback.
71
- if (record === undefined || record.state === 'PENDING') return;
72
- if (record.state === 'COMPLETED') {
73
- pendingRef.current.settle(entry.transactionId);
74
- } else {
75
- // `record.error` is free text from whatever threw — diagnostic detail
76
- // beside a translated headline, never the message itself.
77
- pendingRef.current.fail(entry.transactionId, record.error);
78
- }
79
- invalidate(entry.entity);
80
- }, [
81
- invalidate
82
- ]);
83
- const reconcileAll = useCallback(()=>{
84
- for (const entry of pendingRef.current.entries){
85
- if (entry.state === 'pending') void reconcile(entry);
86
- }
87
- }, [
88
- reconcile
89
- ]);
90
- useEffect(()=>{
91
- const stopListening = channel.subscribe((event)=>{
92
- const transactionId = event.correlationId;
93
- if (transactionId === undefined) return;
94
- const entry = pendingRef.current.entries.find((candidate)=>candidate.transactionId === transactionId);
95
- // An id this browser never started belongs to another tab or another
96
- // session — the stream is organization-scoped, not connection-scoped.
97
- if (entry === undefined) return;
98
- if (event.name === 'transaction.completed') {
99
- pendingRef.current.settle(transactionId);
100
- invalidate(event.data.entity);
101
- return;
102
- }
103
- if (event.name === 'transaction.failed') {
104
- // The frame carries no reason: `EntityChangeEvent` collapses four states
105
- // into created/deleted and holds no `error`. So the record is re-read
106
- // rather than the payload widened: a stream frame is a hint, and the
107
- // record is the truth.
108
- void reconcile(entry);
109
- }
110
- });
111
- const stopWatchingConnections = channel.onConnect(reconcileAll);
112
- return ()=>{
113
- stopListening();
114
- stopWatchingConnections();
115
- };
116
- }, [
117
- channel,
118
- invalidate,
119
- reconcile,
120
- reconcileAll
121
- ]);
122
- // Keyed on whether anything is watched at all, not on the entries: that flips
123
- // once per transition rather than on every settle, so the timer is not torn
124
- // down and rebuilt each time a write lands.
125
- const watching = pending.entries.length > 0;
126
- useEffect(()=>{
127
- if (!watching) return;
128
- const timer = setInterval(reconcileAll, pollIntervalMs);
129
- return ()=>clearInterval(timer);
130
- }, [
131
- watching,
132
- pollIntervalMs,
133
- reconcileAll
134
- ]);
135
- }
136
-
137
- //# sourceMappingURL=use-transaction-settlement.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/reactive/use-transaction-settlement.tsx"],"sourcesContent":["'use client';\n\nimport type {\n PendingEntry,\n PendingTransactionStore,\n TransactionRecord,\n TransactionStatusReader,\n} from '@entifix/transactions';\nimport { useQueryClient } from '@tanstack/react-query';\nimport { Effect } from 'effect';\nimport { useCallback, useEffect, useRef } from 'react';\n\nimport { entityQueryScopeFor } from '../query/entity-query-key.js';\nimport type { ReactiveChannel } from './reactive-channel.js';\n\n/** How often to re-ask while anything is pending. */\nconst DEFAULT_POLL_MS = 30_000;\n\ninterface SettlementBase {\n /** The stream outcomes arrive on, and whose reconnects trigger a re-query. */\n channel: ReactiveChannel;\n /**\n * The writes being watched.\n *\n * Passed in rather than imported: the store is a shell concern\n * (`@entifix/next-shell`, T4) and this hook is T3, which may not depend\n * upward. Same seam, and the same reason, as `EntityDraftStore` for autosave.\n */\n pending: PendingTransactionStore;\n pollIntervalMs?: number;\n}\n\n/**\n * How a record is read, and exactly one way.\n *\n * `reader` is the port, built once where the host composes its adapters, so the\n * component calling this hook imports no transport. `read` is the same thing as\n * a bare function, for a caller that already holds one.\n */\ntype RecordSource =\n | {\n /** Reads one record. `undefined` means *not tracked yet* — never *failed*. */\n reader: TransactionStatusReader;\n read?: never;\n }\n | {\n /** Reads one record. `undefined` means *not tracked yet* — never *failed*. */\n read: (transactionId: string) => Promise<TransactionRecord | undefined>;\n reader?: never;\n };\n\nexport type UseTransactionSettlementOptions = SettlementBase & RecordSource;\n\nconst readerOf = (\n source: RecordSource,\n): ((transactionId: string) => Promise<TransactionRecord | undefined>) => {\n if (source.reader === undefined) return source.read;\n const { reader } = source;\n return transactionId => Effect.runPromise(reader.read(transactionId));\n};\n\n/**\n * Settles the optimistic writes this browser started.\n *\n * Three things drive it, and they exist for three different failures:\n *\n * - **The stream**, the fast path: `transaction.completed` and\n * `transaction.failed` carry the correlation id, so an outcome lands in the\n * moment it happens.\n * - **`onConnect`**, because the stream does not replay. It fires on\n * every open *including for a listener registered while already connected*, so\n * a page load holding a restored pending set and an in-session reconnect take\n * one path rather than two.\n * - **An interval**, because `STALE` is written by the recovery sweep and emits\n * no event at all — it is reachable only by asking. It runs only while\n * something is pending, so an idle workspace polls nothing.\n *\n * ⚠️ **A missing record keeps the entry pending.** `accepted` reaches the\n * tracker over the bus, so with the broker down the entity write commits while\n * no event is ever published and the tracker holds nothing. Rolling back there\n * un-renders a healthy write at exactly the moment nobody can tell a UI bug from\n * an outage. Only `FAILED` and `STALE` are terminal.\n */\nexport function useTransactionSettlement({\n channel,\n pending,\n pollIntervalMs = DEFAULT_POLL_MS,\n ...source\n}: UseTransactionSettlementOptions): void {\n const read = readerOf(source);\n const queryClient = useQueryClient();\n\n // The store is rebuilt whenever an entry changes and `read` is typically\n // inline, so both are held in refs: keying the subscription on their identity\n // would tear down and re-open the stream every time a write settled.\n const pendingRef = useRef(pending);\n const readRef = useRef(read);\n\n // Refs may not be written during render. This runs before the effects below,\n // since effects fire in declaration order, so they always see the latest.\n useEffect(() => {\n pendingRef.current = pending;\n readRef.current = read;\n });\n\n const invalidate = useCallback(\n (entity: string) =>\n void queryClient.invalidateQueries({\n queryKey: entityQueryScopeFor(entity),\n }),\n [queryClient],\n );\n\n /**\n * Applies whatever the tracker currently says about one entry.\n *\n * The single place the terminal-state rule lives — the stream path, the\n * reconnect path and the interval all come through here, so there is one\n * answer to \"what does this state mean\" rather than three that can drift.\n */\n const reconcile = useCallback(\n async (entry: PendingEntry): Promise<void> => {\n const record = await readRef.current(entry.transactionId).catch(\n // The tracker being unreachable says nothing about the write. Keeping\n // the entry is what makes a service restart converge instead of dropping\n // every optimistic row on the floor.\n () => undefined,\n );\n\n // ⚠️ Not tracked yet, or still running. Either way it is not over, and\n // this is the branch that must not be turned into a rollback.\n if (record === undefined || record.state === 'PENDING') return;\n\n if (record.state === 'COMPLETED') {\n pendingRef.current.settle(entry.transactionId);\n } else {\n // `record.error` is free text from whatever threw — diagnostic detail\n // beside a translated headline, never the message itself.\n pendingRef.current.fail(entry.transactionId, record.error);\n }\n invalidate(entry.entity);\n },\n [invalidate],\n );\n\n const reconcileAll = useCallback(() => {\n for (const entry of pendingRef.current.entries) {\n if (entry.state === 'pending') void reconcile(entry);\n }\n }, [reconcile]);\n\n useEffect(() => {\n const stopListening = channel.subscribe(event => {\n const transactionId = event.correlationId;\n if (transactionId === undefined) return;\n\n const entry = pendingRef.current.entries.find(\n candidate => candidate.transactionId === transactionId,\n );\n // An id this browser never started belongs to another tab or another\n // session — the stream is organization-scoped, not connection-scoped.\n if (entry === undefined) return;\n\n if (event.name === 'transaction.completed') {\n pendingRef.current.settle(transactionId);\n invalidate(event.data.entity);\n return;\n }\n\n if (event.name === 'transaction.failed') {\n // The frame carries no reason: `EntityChangeEvent` collapses four states\n // into created/deleted and holds no `error`. So the record is re-read\n // rather than the payload widened: a stream frame is a hint, and the\n // record is the truth.\n void reconcile(entry);\n }\n });\n\n const stopWatchingConnections = channel.onConnect(reconcileAll);\n\n return () => {\n stopListening();\n stopWatchingConnections();\n };\n }, [channel, invalidate, reconcile, reconcileAll]);\n\n // Keyed on whether anything is watched at all, not on the entries: that flips\n // once per transition rather than on every settle, so the timer is not torn\n // down and rebuilt each time a write lands.\n const watching = pending.entries.length > 0;\n\n useEffect(() => {\n if (!watching) return;\n\n const timer = setInterval(reconcileAll, pollIntervalMs);\n return () => clearInterval(timer);\n }, [watching, pollIntervalMs, reconcileAll]);\n}\n"],"names":["useQueryClient","Effect","useCallback","useEffect","useRef","entityQueryScopeFor","DEFAULT_POLL_MS","readerOf","source","reader","undefined","read","transactionId","runPromise","useTransactionSettlement","channel","pending","pollIntervalMs","queryClient","pendingRef","readRef","current","invalidate","entity","invalidateQueries","queryKey","reconcile","entry","record","catch","state","settle","fail","error","reconcileAll","entries","stopListening","subscribe","event","correlationId","find","candidate","name","data","stopWatchingConnections","onConnect","watching","length","timer","setInterval","clearInterval"],"mappings":"AAAA;;AAQA,SAASA,cAAc,QAAQ,wBAAwB;AACvD,SAASC,MAAM,QAAQ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