@pgxsinkit/contracts 0.1.49 → 0.1.51

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/runtime.d.ts CHANGED
@@ -33,7 +33,52 @@ export interface MutationDiagnostics {
33
33
  * ADR-0015). The optimistic Overlay is kept; the user resolves each as a new write or discards it.
34
34
  */
35
35
  conflictedCount: number;
36
+ /**
37
+ * Whole write-**units** the authoritative endpoint declined for a business reason (terminal, ADR-0022):
38
+ * the optimistic Overlay is auto-discarded for every member and the typed reason is surfaced via
39
+ * `onReject`. Never retried (the server's answer is authoritative).
40
+ */
41
+ rejectedCount: number;
36
42
  lastFlushAtUs?: string;
37
43
  lastAckAtUs?: string;
38
44
  }
45
+ /**
46
+ * A registry-wide mutation-journal summary (warm-persisted-store-startup slice 4 / proposal §5): the
47
+ * per-status counts across EVERY writable table's journal, folded from one aggregate query/subscription over
48
+ * the `pgxsinkit_all_mutations` view — so a consumer renders a global sync indicator with ONE subscription
49
+ * instead of one live query per writable journal. Cheap enough to mount permanently.
50
+ *
51
+ * `unsettledCount` and `settledCount` PARTITION the total — the user-facing "is any local edit still owed?"
52
+ * split, NOT the automatic state machine's terminal/non-terminal split:
53
+ *
54
+ * - `unsettledCount` = `pending` + `sending` + `failed` + `conflicted` + `quarantined` — every write still
55
+ * needing work or user action. `conflicted` and `quarantined` are journal-TERMINAL in the state machine (no
56
+ * auto-transition — see `MUTATION_TRANSITIONS`) yet BOTH count as unsettled: their optimistic Overlay is
57
+ * KEPT, later writes for the entity stay blocked, `destroy()` refuses them without `force`, and local-store
58
+ * reconciliation counts them owed. The user must act (`discardConflict` / `discardQuarantined`, then
59
+ * re-author) — so from the consumer's data-safety standpoint they are NOT done. This is exactly the
60
+ * restore case, where pgxsinkit deliberately quarantines recovered writes for the user to resolve, so a
61
+ * global "unsynced changes" indicator MUST include them.
62
+ * - `settledCount` = `acked` + `rejected` — the writes that are truly done from the user's standpoint (acked
63
+ * awaits only its synced echo to be reconciled away; rejected's Overlay was auto-discarded, nothing owed).
64
+ *
65
+ * The field is `settledCount` (not `terminalCount`): "terminal" is the state-machine word, and quarantine is
66
+ * legitimately terminal there while being unsettled here — the old name invited exactly that confusion.
67
+ */
68
+ export interface MutationSummary {
69
+ pendingCount: number;
70
+ sendingCount: number;
71
+ ackedCount: number;
72
+ failedCount: number;
73
+ rejectedCount: number;
74
+ conflictedCount: number;
75
+ quarantinedCount: number;
76
+ /**
77
+ * `pending` + `sending` + `failed` + `conflicted` + `quarantined` — every write still needing work or user
78
+ * action (see the interface JSDoc; quarantined + conflicted are owed local edits, not settled).
79
+ */
80
+ unsettledCount: number;
81
+ /** `acked` + `rejected` — settled writes; the complement of {@link unsettledCount}. */
82
+ settledCount: number;
83
+ }
39
84
  //# sourceMappingURL=runtime.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,UAAU,GAAG,aAAa,CAAC;AAE5F,MAAM,WAAW,iBAAiB;IAChC;;;;;OAKG;IACH,KAAK,EAAE,gBAAgB,CAAC;IACxB,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,mBAAmB;IAClC,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,gGAAgG;IAChG,gBAAgB,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,eAAe,EAAE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,EAAE,MAAM,CAAC;IACvB,uFAAuF;IACvF,YAAY,EAAE,MAAM,CAAC;CACtB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pgxsinkit/contracts",
3
- "version": "0.1.49",
3
+ "version": "0.1.51",
4
4
  "keywords": [
5
5
  "tanstack-intent"
6
6
  ],
@@ -15,7 +15,7 @@ description: >-
15
15
  metadata:
16
16
  type: core
17
17
  library: "@pgxsinkit/contracts"
18
- library_version: "0.1.49"
18
+ library_version: "0.1.51"
19
19
  source: https://pgxsinkit.github.io/start/getting-started/
20
20
  ---
21
21
 
package/src/runtime.ts CHANGED
@@ -36,6 +36,52 @@ export interface MutationDiagnostics {
36
36
  * ADR-0015). The optimistic Overlay is kept; the user resolves each as a new write or discards it.
37
37
  */
38
38
  conflictedCount: number;
39
+ /**
40
+ * Whole write-**units** the authoritative endpoint declined for a business reason (terminal, ADR-0022):
41
+ * the optimistic Overlay is auto-discarded for every member and the typed reason is surfaced via
42
+ * `onReject`. Never retried (the server's answer is authoritative).
43
+ */
44
+ rejectedCount: number;
39
45
  lastFlushAtUs?: string;
40
46
  lastAckAtUs?: string;
41
47
  }
48
+
49
+ /**
50
+ * A registry-wide mutation-journal summary (warm-persisted-store-startup slice 4 / proposal §5): the
51
+ * per-status counts across EVERY writable table's journal, folded from one aggregate query/subscription over
52
+ * the `pgxsinkit_all_mutations` view — so a consumer renders a global sync indicator with ONE subscription
53
+ * instead of one live query per writable journal. Cheap enough to mount permanently.
54
+ *
55
+ * `unsettledCount` and `settledCount` PARTITION the total — the user-facing "is any local edit still owed?"
56
+ * split, NOT the automatic state machine's terminal/non-terminal split:
57
+ *
58
+ * - `unsettledCount` = `pending` + `sending` + `failed` + `conflicted` + `quarantined` — every write still
59
+ * needing work or user action. `conflicted` and `quarantined` are journal-TERMINAL in the state machine (no
60
+ * auto-transition — see `MUTATION_TRANSITIONS`) yet BOTH count as unsettled: their optimistic Overlay is
61
+ * KEPT, later writes for the entity stay blocked, `destroy()` refuses them without `force`, and local-store
62
+ * reconciliation counts them owed. The user must act (`discardConflict` / `discardQuarantined`, then
63
+ * re-author) — so from the consumer's data-safety standpoint they are NOT done. This is exactly the
64
+ * restore case, where pgxsinkit deliberately quarantines recovered writes for the user to resolve, so a
65
+ * global "unsynced changes" indicator MUST include them.
66
+ * - `settledCount` = `acked` + `rejected` — the writes that are truly done from the user's standpoint (acked
67
+ * awaits only its synced echo to be reconciled away; rejected's Overlay was auto-discarded, nothing owed).
68
+ *
69
+ * The field is `settledCount` (not `terminalCount`): "terminal" is the state-machine word, and quarantine is
70
+ * legitimately terminal there while being unsettled here — the old name invited exactly that confusion.
71
+ */
72
+ export interface MutationSummary {
73
+ pendingCount: number;
74
+ sendingCount: number;
75
+ ackedCount: number;
76
+ failedCount: number;
77
+ rejectedCount: number;
78
+ conflictedCount: number;
79
+ quarantinedCount: number;
80
+ /**
81
+ * `pending` + `sending` + `failed` + `conflicted` + `quarantined` — every write still needing work or user
82
+ * action (see the interface JSDoc; quarantined + conflicted are owed local edits, not settled).
83
+ */
84
+ unsettledCount: number;
85
+ /** `acked` + `rejected` — settled writes; the complement of {@link unsettledCount}. */
86
+ settledCount: number;
87
+ }