@abloatai/ablo 0.22.0 → 0.22.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.22.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Expose the functional `update(id, current => next)` overload on the stateless
8
+ HTTP client type (`HttpModelClient` / `AbloHttpClient`).
9
+
10
+ 0.22.0 wired the functional update at runtime on every transport and added the
11
+ overload to `ModelOperations` (WebSocket) and `ModelClient`, but the
12
+ `Ablo({ transport: 'http' })` client resolves its models to `HttpModelClient`,
13
+ whose `update` type still declared only the `update({ id, data })` form. So
14
+ server-side agents — the primary callers — saw a type error on
15
+ `update(id, fn)` even though it worked. Add the overload to that type.
16
+
3
17
  ## 0.22.0
4
18
 
5
19
  ### Minor Changes
@@ -26,6 +26,7 @@ import { type AbloApiClientOptions } from './ApiClient.js';
26
26
  import type { CommitReceipt, CommitResource, HttpClaimApi, ModelRead, ModelReadOptions, CreateSessionParams, AbloSession } from './Ablo.js';
27
27
  import type { ModelCreateParams, ModelDeleteParams, ServerReadOptions, ModelRetrieveParams, ModelUpdateParams } from './createModelProxy.js';
28
28
  import type { Schema, SchemaRecord, InferModel, InferCreate } from '../schema/schema.js';
29
+ import type { ModelUpdater, ContentionOptions } from './functionalUpdate.js';
29
30
  export interface AbloHttpClientOptions<S extends SchemaRecord> extends Omit<AbloApiClientOptions, 'schema'> {
30
31
  /** The schema — used for TYPING only (typed model proxies); never sent or used at runtime. */
31
32
  readonly schema: Schema<S>;
@@ -48,6 +49,14 @@ export interface HttpModelClient<T, C = T> {
48
49
  list(options?: ServerReadOptions<T>): Promise<T[]>;
49
50
  create(params: ModelCreateParams<T, C>): Promise<CommitReceipt>;
50
51
  update(params: ModelUpdateParams<C>): Promise<CommitReceipt>;
52
+ /**
53
+ * Functional update under contention — `update(id, current => next)`, the
54
+ * `setState(prev => next)` of the data layer. The SDK reads the freshest row,
55
+ * runs your updater, writes it as a compare-and-swap, and re-reads + re-runs on
56
+ * any concurrent write. No claim, no identity, no conflict codes: the write
57
+ * lands or throws `AbloContentionError`. Return `null`/`undefined` to skip.
58
+ */
59
+ update(id: string, updater: ModelUpdater<T>, options?: ContentionOptions): Promise<CommitReceipt | undefined>;
51
60
  delete(params: ModelDeleteParams<T>): Promise<CommitReceipt>;
52
61
  claim: HttpClaimApi<T>;
53
62
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abloatai/ablo",
3
- "version": "0.22.0",
3
+ "version": "0.22.1",
4
4
  "description": "The Collaboration Layer For AI Agents",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",