@memberjunction/graphql-dataprovider 6.1.0-edge.0 → 6.1.0-edge.2
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/README.md +16 -0
- package/dist/index.cjs +59 -66
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +216 -11
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +216 -11
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +129 -136
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -226,6 +226,22 @@ async function runAdhocQuery(sql: string) {
|
|
|
226
226
|
}
|
|
227
227
|
```
|
|
228
228
|
|
|
229
|
+
### Atomicity on the client — what this provider can and cannot do
|
|
230
|
+
|
|
231
|
+
`GraphQLDataProvider` reports **`SupportsEntityTransactions === false`** and does not implement
|
|
232
|
+
`BeginEntityTransaction()`. There is no local transaction to open, and a server transaction cannot be
|
|
233
|
+
held open across round trips. Two supported ways to get atomicity from the browser:
|
|
234
|
+
|
|
235
|
+
| Need | Use |
|
|
236
|
+
|---|---|
|
|
237
|
+
| Several **unrelated** records in one atomic round trip | **Transaction Group** (below) — batched into a single `ExecuteTransactionGroup` mutation that runs in one server-side SQL transaction |
|
|
238
|
+
| A **parent and its children** saved together | **Entity graph** — declare a `RelatedRecordCollection` on a shared client+server subclass and call `entity.Save()`. `BaseEntity` detects that this provider cannot transact and routes the whole unit of work to the server via the `MJ.SaveEntityGraph` remote operation, which rebuilds the records as their **server-side** subclasses and executes the cascade there, inside a real transaction. |
|
|
239
|
+
|
|
240
|
+
Do **not** reach for a Transaction Group to save a parent and its children: saves are deferred, so
|
|
241
|
+
the parent's primary key is unavailable afterwards, there is no read-your-writes, and `Save()`
|
|
242
|
+
returns `true` before anything has persisted. See
|
|
243
|
+
[Transactions, Batching & Entity Graphs](../../guides/TRANSACTIONS_AND_BATCHING_GUIDE.md).
|
|
244
|
+
|
|
229
245
|
### Using Transaction Groups
|
|
230
246
|
|
|
231
247
|
```typescript
|