@scm-js/plugin-api 1.10.0 → 1.11.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 (2) hide show
  1. package/index.d.ts +13 -4
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -1840,8 +1840,9 @@ export interface Disposable {
1840
1840
  * builders (`document.edit` and `document.update`) are the exception, and deliberately
1841
1841
  * so: their operations apply as they are called and one commit closes the transaction
1842
1842
  * when the builder returns, so an `async` builder would commit the part of its work that
1843
- * ran before the first `await` and leave the rest to land outside the entry, breaking
1844
- * undo without an error. Do the awaiting *before* the call:
1843
+ * ran before the first `await` and leave the rest with nowhere to land: the transaction
1844
+ * is closed once the builder returns, and every call on it throws from then on. Do the
1845
+ * awaiting *before* the call:
1845
1846
  *
1846
1847
  * ```ts
1847
1848
  * await api.tileset.load(); // the async part, first
@@ -2091,7 +2092,11 @@ export interface DocumentApi {
2091
2092
  * Returns an all-zero result with `changed: false` when no map is open.
2092
2093
  *
2093
2094
  * `build` is synchronous — see `Sync`. Await what you need (graphics, a pick, a
2094
- * fetch) before the call, then write in one go.
2095
+ * fetch) before the call, then write in one go. The transaction is closed when
2096
+ * `build` returns; a call on it after that throws.
2097
+ *
2098
+ * A builder that throws is rolled back: what it had applied is taken off the map
2099
+ * again, nothing reaches the history or the modified flag, and the error reaches you.
2095
2100
  *
2096
2101
  * @example
2097
2102
  * // One undo entry called "Fill", however many operations it takes.
@@ -2108,7 +2113,11 @@ export interface DocumentApi {
2108
2113
  * transaction, the way a settings dialog's OK applies its whole form at once.
2109
2114
  * Operations apply as they are called; the commit marks the map modified and bumps
2110
2115
  * what the chrome reads. There is no undo entry: keep your own if you need one.
2111
- * `build` is synchronous, as `edit`'s is.
2116
+ * `build` is synchronous, as `edit`'s is, and closed when it returns.
2117
+ *
2118
+ * There is nothing to roll an update back with, so a builder that throws leaves what
2119
+ * it wrote: the sections it touched are committed — the map is modified and the
2120
+ * chrome re-reads — and the error reaches you.
2112
2121
  *
2113
2122
  * @example
2114
2123
  * api.document.update("Rename", (tx) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scm-js/plugin-api",
3
- "version": "1.10.0",
3
+ "version": "1.11.0",
4
4
  "description": "Type declarations for the scmJS plugin API",
5
5
  "license": "MIT",
6
6
  "types": "index.d.ts",