@optimystic/db-core 1.4.0 → 1.5.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.
@@ -100,7 +100,9 @@ export type TreeReplaceAction<TKey, TEntry> = (TreeUpsertElement<TKey, TEntry> |
100
100
  *
101
101
  * Subclasses split by WHAT was refused, because consumers map them differently: a
102
102
  * {@link TreeKeyTakenError} is a uniqueness violation (the Quereus bridge renders it as
103
- * `UNIQUE constraint failed`), while a {@link TreeEntryChangedError} is a lost update. Catch
103
+ * `UNIQUE constraint failed` and raises the engine's `ConstraintError`), while a
104
+ * {@link TreeEntryChangedError} is a lost update (the bridge raises its
105
+ * `ConcurrentModificationError`, status code BUSY, which is not a constraint error). Catch
104
106
  * this base to treat any guard refusal uniformly; catch a subclass to say which happened.
105
107
  */
106
108
  export declare class TreeGuardRefusedError<TKey = unknown> extends Error {
@@ -132,8 +134,9 @@ export declare class TreeKeyTakenError<TKey = unknown> extends TreeGuardRefusedE
132
134
  * index tree, a rival's row carrying the same unique value under a different primary
133
135
  * key. A subclass of {@link TreeKeyTakenError} on purpose: every consumer that treats a
134
136
  * key refusal as a non-retryable uniqueness failure (the sync/commit retry loops let it
135
- * escape; the Quereus bridge maps it by `collectionId` to a `UNIQUE constraint failed`
136
- * message) handles this one identically without a second arm. `collectionId` is the
137
+ * escape; the Quereus bridge maps it by `collectionId` to a `ConstraintError` carrying the
138
+ * `UNIQUE constraint failed` message) handles this one identically without a second arm.
139
+ * `collectionId` is the
137
140
  * discriminator that names WHICH constraint fired — each unique index is its own
138
141
  * collection — so the bridge needs nothing beyond it.
139
142
  */
@@ -155,9 +158,11 @@ export declare class TreeRangeTakenError<TKey = unknown> extends TreeKeyTakenErr
155
158
  * write read — a rival committed a different entry there, or removed it (`actual` is
156
159
  * `undefined`). A lost update, NOT a uniqueness violation, which is why this deliberately does
157
160
  * NOT subclass {@link TreeKeyTakenError}: the Quereus bridge renders every `TreeKeyTakenError`
158
- * as that collection's registered `UNIQUE constraint failed` message (`mapCommitRefusal` in
161
+ * as that collection's registered `UNIQUE constraint failed` message and raises the engine's
162
+ * `ConstraintError` for it (`mapCommitRefusal` in
159
163
  * `packages/quereus-plugin-optimystic/src/optimystic-adapter/txn-bridge.ts`), and reporting a
160
164
  * concurrent-update refusal as a uniqueness failure would mislead every client that reads it.
165
+ * The bridge raises its own `ConcurrentModificationError` (status code BUSY) for this one instead.
161
166
  * The shared contract lives on {@link TreeGuardRefusedError}.
162
167
  */
163
168
  export declare class TreeEntryChangedError<TKey = unknown, TEntry = unknown> extends TreeGuardRefusedError<TKey> {
@@ -1 +1 @@
1
- {"version":3,"file":"struct.d.ts","sourceRoot":"","sources":["../../../../src/collections/tree/struct.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAKrD,eAAO,MAAM,mBAAmB,QAA8C,CAAC;AAO/E,MAAM,MAAM,yBAAyB,GAAG,qBAAqB,GAAG;IAC/D,MAAM,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,OAAO,QAA8C,CAAC;AAEnE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,MAAM,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,IAC9C;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,GAClB;IAAE,IAAI,EAAE,cAAc,CAAA;CAAE,GACxB;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAA;CAAE,GAC9C,kBAAkB,CAAC,MAAM,CAAC,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,MAAM,kBAAkB,CAAC,MAAM,GAAG,OAAO,IAAI;IAClD,IAAI,EAAE,WAAW,CAAC;I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AO3C;AAED;;;;;;;GAOG;AACH,qBAAa,wBAAwB,CAAC,IAAI,GAAG,OAAO,CAAE,SAAQ,KAAK;IAEjE,sDAAsD;aACtC,YAAY,EAAE,YAAY;IAC1C,0CAA0C;aAC1B,GAAG,EAAE,IAAI;IACzB,iFAAiF;aACjE,SAAS,EAAE,MAAM;;IALjC,sDAAsD;IACtC,YAAY,EAAE,YAAY;IAC1C,0CAA0C;IAC1B,GAAG,EAAE,IAAI;IACzB,iFAAiF;IACjE,SAAS,EAAE,MAAM;CAMlC"}
@@ -20,7 +20,9 @@ export const rootId$ = nameof("rootId");
20
20
  *
21
21
  * Subclasses split by WHAT was refused, because consumers map them differently: a
22
22
  * {@link TreeKeyTakenError} is a uniqueness violation (the Quereus bridge renders it as
23
- * `UNIQUE constraint failed`), while a {@link TreeEntryChangedError} is a lost update. Catch
23
+ * `UNIQUE constraint failed` and raises the engine's `ConstraintError`), while a
24
+ * {@link TreeEntryChangedError} is a lost update (the bridge raises its
25
+ * `ConcurrentModificationError`, status code BUSY, which is not a constraint error). Catch
24
26
  * this base to treat any guard refusal uniformly; catch a subclass to say which happened.
25
27
  */
26
28
  export class TreeGuardRefusedError extends Error {
@@ -58,8 +60,9 @@ export class TreeKeyTakenError extends TreeGuardRefusedError {
58
60
  * index tree, a rival's row carrying the same unique value under a different primary
59
61
  * key. A subclass of {@link TreeKeyTakenError} on purpose: every consumer that treats a
60
62
  * key refusal as a non-retryable uniqueness failure (the sync/commit retry loops let it
61
- * escape; the Quereus bridge maps it by `collectionId` to a `UNIQUE constraint failed`
62
- * message) handles this one identically without a second arm. `collectionId` is the
63
+ * escape; the Quereus bridge maps it by `collectionId` to a `ConstraintError` carrying the
64
+ * `UNIQUE constraint failed` message) handles this one identically without a second arm.
65
+ * `collectionId` is the
63
66
  * discriminator that names WHICH constraint fired — each unique index is its own
64
67
  * collection — so the bridge needs nothing beyond it.
65
68
  */
@@ -85,9 +88,11 @@ export class TreeRangeTakenError extends TreeKeyTakenError {
85
88
  * write read — a rival committed a different entry there, or removed it (`actual` is
86
89
  * `undefined`). A lost update, NOT a uniqueness violation, which is why this deliberately does
87
90
  * NOT subclass {@link TreeKeyTakenError}: the Quereus bridge renders every `TreeKeyTakenError`
88
- * as that collection's registered `UNIQUE constraint failed` message (`mapCommitRefusal` in
91
+ * as that collection's registered `UNIQUE constraint failed` message and raises the engine's
92
+ * `ConstraintError` for it (`mapCommitRefusal` in
89
93
  * `packages/quereus-plugin-optimystic/src/optimystic-adapter/txn-bridge.ts`), and reporting a
90
94
  * concurrent-update refusal as a uniqueness failure would mislead every client that reads it.
95
+ * The bridge raises its own `ConcurrentModificationError` (status code BUSY) for this one instead.
91
96
  * The shared contract lives on {@link TreeGuardRefusedError}.
92
97
  */
93
98
  export class TreeEntryChangedError extends TreeGuardRefusedError {
@@ -1 +1 @@
1
- {"version":3,"file":"struct.js","sourceRoot":"","sources":["../../../../src/collections/tree/struct.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEjD,MAAM,CAAC,MAAM,mBAAmB,GAAG,iBAAiB,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC;AAE/E,sBAAsB,CAAC;IACtB,SAAS,EAAE,mBAAmB;IAC9B,IAAI,EAAE,MAAM;CACZ,CAAC,CAAC;AAMH,MAAM,CAAC,MAAM,OAAO,GAAG,MAAM,CAA4B,QAAQ,CAAC,CAAC;AAiGnE;;;;;;;;;;;;;;;GAeG;AACH,MAAM,OAAO,qBAAsC,SAAQ,KAAK;IAG9C;IAEA;IAJjB;IACC,mDAAmD;IACnC,YAA0B;IAC1C,8CAA8C;IAC9B,GAAS,EACzB,OAAe;QAEf,KAAK,CAAC,OAAO,CAAC,CAAC;QALC,iBAAY,GAAZ,YAAY,CAAc;QAE1B,QAAG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AgB;IAChC,mFAAmF;IACnE,MAA0B;QAE1C,KAAK,CAAC,YAAY,EAAE,GAAG,EACtB,mBAAmB,YAAY,sBAAsB,SAAS,CAAC,GAAG,CAAC,OAAO;cACxE,GAAG,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,8CAA8C,CAAC,CAAC;QANlF,aAAQ,GAAR,QAAQ,CAAQ;QAEhB,WAAM,GAAN,MAAM,CAAoB;QAK1C,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;IACrC,CAAC;CACD;AAED;;;;;;;GAOG;AACH,MAAM,OAAO,wBAAyC,SAAQ,KAAK;IAGjD;IAEA;IAEA;IANjB;IACC,sDAAsD;IACtC,YAA0B;IAC1C,0CAA0C;IAC1B,GAAS;IACzB,iFAAiF;IACjE,SAAiB;QAEjC,KAAK,CAAC,mBAAmB,YAAY,uBAAuB,SAAS,CAAC,GAAG,CAAC,aAAa;cACpF,IAAI,SAAS,qDAAqD,CAAC,CAAC;QAPvD,iBAAY,GAAZ,YAAY,CAAc;QAE1B,QAAG,GAAH,GAAG,CAAM;QAET,cAAS,GAAT,SAAS,CAAQ;QAIjC,IAAI,CAAC,IAAI,GAAG,0BAA0B,CAAC;IACxC,CAAC;CACD;AAED;;;uFAGuF;AACvF,SAAS,SAAS,CAAC,GAAY;IAC9B,OAAO,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AACpE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optimystic/db-core",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "type": "module",
5
5
  "description": "Core database functionality for Optimystic",
6
6
  "main": "dist/src/index.js",
@@ -125,7 +125,9 @@ export type TreeReplaceAction<TKey, TEntry> = (
125
125
  *
126
126
  * Subclasses split by WHAT was refused, because consumers map them differently: a
127
127
  * {@link TreeKeyTakenError} is a uniqueness violation (the Quereus bridge renders it as
128
- * `UNIQUE constraint failed`), while a {@link TreeEntryChangedError} is a lost update. Catch
128
+ * `UNIQUE constraint failed` and raises the engine's `ConstraintError`), while a
129
+ * {@link TreeEntryChangedError} is a lost update (the bridge raises its
130
+ * `ConcurrentModificationError`, status code BUSY, which is not a constraint error). Catch
129
131
  * this base to treat any guard refusal uniformly; catch a subclass to say which happened.
130
132
  */
131
133
  export class TreeGuardRefusedError<TKey = unknown> extends Error {
@@ -166,8 +168,9 @@ export class TreeKeyTakenError<TKey = unknown> extends TreeGuardRefusedError<TKe
166
168
  * index tree, a rival's row carrying the same unique value under a different primary
167
169
  * key. A subclass of {@link TreeKeyTakenError} on purpose: every consumer that treats a
168
170
  * key refusal as a non-retryable uniqueness failure (the sync/commit retry loops let it
169
- * escape; the Quereus bridge maps it by `collectionId` to a `UNIQUE constraint failed`
170
- * message) handles this one identically without a second arm. `collectionId` is the
171
+ * escape; the Quereus bridge maps it by `collectionId` to a `ConstraintError` carrying the
172
+ * `UNIQUE constraint failed` message) handles this one identically without a second arm.
173
+ * `collectionId` is the
171
174
  * discriminator that names WHICH constraint fired — each unique index is its own
172
175
  * collection — so the bridge needs nothing beyond it.
173
176
  */
@@ -193,9 +196,11 @@ export class TreeRangeTakenError<TKey = unknown> extends TreeKeyTakenError<TKey>
193
196
  * write read — a rival committed a different entry there, or removed it (`actual` is
194
197
  * `undefined`). A lost update, NOT a uniqueness violation, which is why this deliberately does
195
198
  * NOT subclass {@link TreeKeyTakenError}: the Quereus bridge renders every `TreeKeyTakenError`
196
- * as that collection's registered `UNIQUE constraint failed` message (`mapCommitRefusal` in
199
+ * as that collection's registered `UNIQUE constraint failed` message and raises the engine's
200
+ * `ConstraintError` for it (`mapCommitRefusal` in
197
201
  * `packages/quereus-plugin-optimystic/src/optimystic-adapter/txn-bridge.ts`), and reporting a
198
202
  * concurrent-update refusal as a uniqueness failure would mislead every client that reads it.
203
+ * The bridge raises its own `ConcurrentModificationError` (status code BUSY) for this one instead.
199
204
  * The shared contract lives on {@link TreeGuardRefusedError}.
200
205
  */
201
206
  export class TreeEntryChangedError<TKey = unknown, TEntry = unknown> extends TreeGuardRefusedError<TKey> {