@abloatai/humans 0.57.0 → 0.58.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.
- package/dist/Ablo.d.ts +8 -18
- package/dist/client.d.ts +6 -19
- package/dist/core.d.ts +1 -1
- package/dist/core.js +1 -1
- package/dist/local/Database.d.ts +1 -1
- package/dist/local/SyncClient.js +5 -0
- package/dist/local/client/createInternalComponents.d.ts +1 -1
- package/dist/local/client/createInternalComponents.js +1 -1
- package/dist/local/client/{createModelProxy.d.ts → createModelOperations.d.ts} +11 -10
- package/dist/local/client/{createModelProxy.js → createModelOperations.js} +240 -313
- package/dist/local/client/options.d.ts +2 -2
- package/dist/local/client/reactiveEngine.js +34 -45
- package/dist/local/client/resourceTypes.d.ts +3 -3
- package/dist/local/client/resourceTypes.js +1 -1
- package/dist/local/client/wsMutationExecutor.d.ts +4 -4
- package/dist/local/client/wsMutationExecutor.js +3 -5
- package/dist/local/coordination/ClaimLog.d.ts +3 -3
- package/dist/local/coordination/ClaimLog.js +2 -2
- package/dist/local/interfaces/index.d.ts +5 -7
- package/dist/local/mutators/mutateActions.d.ts +3 -2
- package/dist/local/query/types.d.ts +2 -2
- package/dist/local/stores/syncAction.d.ts +1 -1
- package/dist/local/stores/syncAction.js +1 -1
- package/dist/local/sync/ConnectionManager.d.ts +1 -1
- package/dist/local/sync/ConnectionManager.js +1 -1
- package/dist/local/sync/OnDemandLoader.d.ts +1 -1
- package/dist/local/sync/OnDemandLoader.js +1 -1
- package/dist/local/sync/SyncWebSocket.d.ts +3 -3
- package/dist/local/sync/SyncWebSocket.js +2 -2
- package/dist/local/sync/commitFrames.d.ts +1 -1
- package/dist/local/sync/commitFrames.js +1 -1
- package/dist/local/sync/contextOnChange.d.ts +8 -0
- package/dist/local/sync/contextOnChange.js +65 -0
- package/dist/local/sync/createClaimStream.d.ts +1 -1
- package/dist/local/sync/createClaimStream.js +47 -28
- package/dist/local/sync/credentialLifecycle.d.ts +1 -1
- package/dist/local/sync/credentialLifecycle.js +1 -1
- package/dist/local/sync/participants.d.ts +1 -1
- package/dist/local/sync/schemas.d.ts +2 -2
- package/dist/local/sync/schemas.js +1 -1
- package/dist/local/sync/wsFrameHandlers.d.ts +1 -1
- package/dist/local/sync/wsFrameHandlers.js +1 -1
- package/dist/local/transactions/databaseCommitOutbox.d.ts +2 -2
- package/dist/local/transactions/mutations/MutationQueue.d.ts +4 -19
- package/dist/local/transactions/mutations/MutationQueue.js +5 -70
- package/dist/local/transactions/mutations/batchProcessing.d.ts +2 -13
- package/dist/local/transactions/mutations/batchProcessing.js +0 -20
- package/dist/local/transactions/mutations/commitApi.d.ts +2 -3
- package/dist/local/transactions/mutations/commitApi.js +0 -4
- package/dist/local/transactions/mutations/commitLane.d.ts +3 -8
- package/dist/local/transactions/mutations/commitLane.js +0 -11
- package/dist/local/transactions/mutations/commitPayload.d.ts +2 -4
- package/dist/local/transactions/mutations/commitPayload.js +2 -6
- package/dist/local/transactions/mutations/commitTransport.d.ts +3 -4
- package/dist/local/transactions/mutations/commitTransport.js +2 -5
- package/dist/local/transactions/mutations/durableCommitRestore.d.ts +1 -1
- package/dist/local/transactions/mutations/durableCommitRestore.js +1 -4
- package/dist/local/transactions/mutations/durableWriteStore.d.ts +5 -5
- package/dist/local/transactions/mutations/durableWriteStore.js +3 -3
- package/dist/local/transactions/mutations/failurePolicy.d.ts +2 -2
- package/dist/local/transactions/mutations/mutationPersistence.d.ts +1 -1
- package/dist/local/transactions/mutations/pendingDrain.d.ts +2 -2
- package/dist/local/transactions/mutations/replayValidation.d.ts +0 -20
- package/dist/local/transactions/mutations/replayValidation.js +1 -3
- package/dist/local/transactions/persistedTransaction.d.ts +0 -2
- package/dist/plugin.d.ts +2 -2
- package/dist/presenceStream.d.ts +1 -1
- package/dist/react/createAbloReact.d.ts +1 -1
- package/dist/react/useAblo.d.ts +2 -2
- package/dist/react/useAblo.js +1 -1
- package/dist/surface.d.ts +1 -1
- package/dist/surface.js +1 -2
- package/package.json +2 -2
- package/src/Ablo.ts +9 -27
- package/src/client.ts +6 -22
- package/src/core.ts +1 -1
- package/src/local/Database.ts +1 -1
- package/src/local/SyncClient.ts +5 -0
- package/src/local/client/createInternalComponents.ts +2 -2
- package/src/local/client/{createModelProxy.ts → createModelOperations.ts} +292 -367
- package/src/local/client/options.ts +2 -2
- package/src/local/client/reactiveEngine.ts +63 -55
- package/src/local/client/resourceTypes.ts +4 -4
- package/src/local/client/wsMutationExecutor.ts +3 -9
- package/src/local/coordination/ClaimLog.ts +3 -3
- package/src/local/interfaces/index.ts +5 -7
- package/src/local/mutators/mutateActions.ts +3 -2
- package/src/local/query/types.ts +2 -2
- package/src/local/stores/syncAction.ts +1 -1
- package/src/local/sync/ConnectionManager.ts +1 -1
- package/src/local/sync/OnDemandLoader.ts +1 -1
- package/src/local/sync/SyncWebSocket.ts +3 -3
- package/src/local/sync/commitFrames.ts +1 -2
- package/src/local/sync/contextOnChange.ts +92 -0
- package/src/local/sync/createClaimStream.ts +77 -39
- package/src/local/sync/credentialLifecycle.ts +1 -1
- package/src/local/sync/participants.ts +1 -1
- package/src/local/sync/schemas.ts +1 -1
- package/src/local/sync/wsFrameHandlers.ts +1 -1
- package/src/local/transactions/databaseCommitOutbox.ts +2 -2
- package/src/local/transactions/mutations/MutationQueue.ts +8 -95
- package/src/local/transactions/mutations/batchProcessing.ts +2 -38
- package/src/local/transactions/mutations/commitApi.ts +3 -7
- package/src/local/transactions/mutations/commitLane.ts +3 -17
- package/src/local/transactions/mutations/commitPayload.ts +3 -11
- package/src/local/transactions/mutations/commitTransport.ts +3 -7
- package/src/local/transactions/mutations/durableCommitRestore.ts +2 -5
- package/src/local/transactions/mutations/durableWriteStore.ts +5 -5
- package/src/local/transactions/mutations/failurePolicy.ts +2 -2
- package/src/local/transactions/mutations/mutationPersistence.ts +1 -1
- package/src/local/transactions/mutations/pendingDrain.ts +2 -2
- package/src/local/transactions/mutations/replayValidation.ts +1 -3
- package/src/local/transactions/persistedTransaction.ts +0 -3
- package/src/plugin.ts +2 -2
- package/src/presenceStream.ts +2 -2
- package/src/react/createAbloReact.ts +1 -1
- package/src/react/useAblo.ts +2 -2
- package/src/surface.ts +2 -3
- package/dist/local/sync/createSnapshot.d.ts +0 -29
- package/dist/local/sync/createSnapshot.js +0 -116
- package/src/local/sync/createSnapshot.ts +0 -160
package/dist/Ablo.d.ts
CHANGED
|
@@ -65,7 +65,6 @@ export declare function Ablo<const S extends SchemaRecord, const P extends reado
|
|
|
65
65
|
export declare function Ablo<const S extends SchemaRecord>(options: AbloOptions<S>): Ablo<S>;
|
|
66
66
|
import type * as _Streams from '@abloatai/transaction/types/streams';
|
|
67
67
|
import type * as _Participants from './local/sync/participants.js';
|
|
68
|
-
import type * as _Policy from '@abloatai/transaction/policy/types';
|
|
69
68
|
import type * as _Mutators from './local/mutators/defineMutators.js';
|
|
70
69
|
import type * as _Tx from './local/mutators/Transaction.js';
|
|
71
70
|
import type * as _Undo from './local/mutators/UndoManager.js';
|
|
@@ -108,7 +107,6 @@ export declare namespace Ablo {
|
|
|
108
107
|
type ClaimLost = _Streams.ClaimLost;
|
|
109
108
|
type ClaimHeartbeat = _Streams.ClaimHeartbeat;
|
|
110
109
|
type ClaimHeartbeatOptions = _Streams.ClaimHeartbeatOptions;
|
|
111
|
-
type Snapshot<TSchema extends _SchemaTypes.Schema = _SchemaTypes.Schema, K extends keyof TSchema['models'] = keyof TSchema['models']> = _Streams.Snapshot<TSchema, K>;
|
|
112
110
|
namespace Auth {
|
|
113
111
|
type Actor = _Streams.ParticipantRef;
|
|
114
112
|
}
|
|
@@ -150,14 +148,6 @@ export declare namespace Ablo {
|
|
|
150
148
|
type InferRow<S extends _SchemaTypes.Schema, K extends keyof S['models']> = _SchemaTypes.InferRow<S, K>;
|
|
151
149
|
type InferModelNames<S extends _SchemaTypes.Schema> = _SchemaTypes.InferModelNames<S>;
|
|
152
150
|
}
|
|
153
|
-
type Conflict = _Policy.Conflict;
|
|
154
|
-
namespace Conflict {
|
|
155
|
-
type Kind = _Policy.ConflictKind;
|
|
156
|
-
type Operation = _Policy.ConflictOperation;
|
|
157
|
-
type Decision = _Policy.ConflictDecision;
|
|
158
|
-
type Policy = _Policy.ConflictPolicy;
|
|
159
|
-
type Axis = _Policy.ConflictAxis;
|
|
160
|
-
}
|
|
161
151
|
namespace Commit {
|
|
162
152
|
type Wait = import('./local/client/resourceTypes.js').CommitWait;
|
|
163
153
|
type OperationAction = import('./local/client/resourceTypes.js').ModelOperationAction;
|
|
@@ -171,19 +161,19 @@ export declare namespace Ablo {
|
|
|
171
161
|
type Held<T = Record<string, unknown>> = import('@abloatai/transaction/types/streams').HeldClaim<T>;
|
|
172
162
|
type CreateOptions = import('./local/client/resourceTypes.js').ClaimCreateOptions;
|
|
173
163
|
type WaitOptions = import('./local/client/resourceTypes.js').ClaimWaitOptions;
|
|
174
|
-
type ContentionOptions = import('@abloatai/transaction/resources/modelOperations').ClaimContentionOptions;
|
|
175
|
-
type AttemptEvent = import('@abloatai/transaction/resources/modelOperations').ClaimAttemptEvent;
|
|
176
|
-
type QueueView = import('@abloatai/transaction/resources/modelOperations').ClaimQueueView;
|
|
164
|
+
type ContentionOptions = import('@abloatai/transaction/client/resources/modelOperations').ClaimContentionOptions;
|
|
165
|
+
type AttemptEvent = import('@abloatai/transaction/client/resources/modelOperations').ClaimAttemptEvent;
|
|
166
|
+
type QueueView = import('@abloatai/transaction/client/resources/modelOperations').ClaimQueueView;
|
|
177
167
|
type Client = import('./local/client/resourceTypes.js').ClaimResource;
|
|
178
168
|
}
|
|
179
169
|
namespace Model {
|
|
180
170
|
type Target = import('./local/client/resourceTypes.js').ModelTarget;
|
|
181
171
|
type Claim = import('./local/client/resourceTypes.js').ModelClaim;
|
|
182
|
-
type Operations<T, CreateInput = T> = import('./local/client/
|
|
183
|
-
type ClaimOptions<T = Record<string, unknown>> = import('./local/client/
|
|
184
|
-
type ClaimParams<T = Record<string, unknown>> = import('./local/client/
|
|
185
|
-
type ClaimLookupParams<T = Record<string, unknown>> = import('./local/client/
|
|
186
|
-
type ClaimReorderParams<T = Record<string, unknown>> = import('./local/client/
|
|
172
|
+
type Operations<T, CreateInput = T> = import('./local/client/createModelOperations.js').ModelOperations<T, CreateInput>;
|
|
173
|
+
type ClaimOptions<T = Record<string, unknown>> = import('./local/client/createModelOperations.js').ClaimOptions<T>;
|
|
174
|
+
type ClaimParams<T = Record<string, unknown>> = import('./local/client/createModelOperations.js').ClaimParams<T>;
|
|
175
|
+
type ClaimLookupParams<T = Record<string, unknown>> = import('./local/client/createModelOperations.js').ClaimLookupParams<T>;
|
|
176
|
+
type ClaimReorderParams<T = Record<string, unknown>> = import('./local/client/createModelOperations.js').ClaimReorderParams<T>;
|
|
187
177
|
type MutationOptions = import('./local/client/resourceTypes.js').ModelMutationOptions;
|
|
188
178
|
}
|
|
189
179
|
namespace Source {
|
package/dist/client.d.ts
CHANGED
|
@@ -11,14 +11,16 @@
|
|
|
11
11
|
* the factory back and creating a cycle.
|
|
12
12
|
*/
|
|
13
13
|
import type { Schema, SchemaRecord, Model, InferCreate, InferRow } from '@abloatai/transaction/schema/schema';
|
|
14
|
-
import type { PresenceStream
|
|
14
|
+
import type { PresenceStream } from '@abloatai/transaction/types/streams';
|
|
15
15
|
import type { InstanceCache } from './local/InstanceCache.js';
|
|
16
16
|
import type { SyncStoreContract } from './react/context.js';
|
|
17
17
|
import type { SyncWebSocket, CoreSyncEventMap } from './local/sync/SyncWebSocket.js';
|
|
18
18
|
import type { SyncStatus } from './local/BaseSyncedStore.js';
|
|
19
|
-
import type { ModelOperations } from './local/client/
|
|
20
|
-
import type { ClaimResource, CommitResource, CreateAgentClientParams, SessionResource } from '@abloatai/transaction/resources/httpResources';
|
|
19
|
+
import type { ModelOperations } from './local/client/createModelOperations.js';
|
|
20
|
+
import type { ClaimResource, CommitResource, CreateAgentClientParams, SessionResource } from '@abloatai/transaction/client/resources/httpResources';
|
|
21
21
|
import type { EffectiveAuthority } from '@abloatai/transaction/auth';
|
|
22
|
+
import type { ReadDependency } from '@abloatai/transaction/coordination';
|
|
23
|
+
import type { CapturedRow } from '@abloatai/transaction/transport/http';
|
|
22
24
|
export type { LocalReadOptions } from './local/client/resourceTypes.js';
|
|
23
25
|
/** The typed sync engine client — one property per model in the schema */
|
|
24
26
|
export type AbloClient<S extends SchemaRecord> = {
|
|
@@ -268,22 +270,7 @@ export type AbloClient<S extends SchemaRecord> = {
|
|
|
268
270
|
* Canonical low-level mutation API. Every untyped model write compiles
|
|
269
271
|
* down to `commits.create(...)`.
|
|
270
272
|
*/
|
|
271
|
-
readonly commits: CommitResource
|
|
272
|
-
/**
|
|
273
|
-
* Capture a context-staleness watermark over a set of entities.
|
|
274
|
-
* Returns a flat snapshot with `stamp` (thread into writes as
|
|
275
|
-
* `readAt`), `signal` (aborts on any captured-entity delta), and
|
|
276
|
-
* `onChange` (callback form). Reads from the engine's InstanceCache;
|
|
277
|
-
* subscription is on the engine's existing transport.
|
|
278
|
-
*
|
|
279
|
-
* Use before an LLM call to prevent the model from completing
|
|
280
|
-
* against now-stale data:
|
|
281
|
-
* ```ts
|
|
282
|
-
* const snap = engine.snapshot({ sections: report.sectionIds });
|
|
283
|
-
* await streamText({ messages, signal: snap.signal });
|
|
284
|
-
* ```
|
|
285
|
-
*/
|
|
286
|
-
snapshot<ModelName extends keyof S & string>(entities: Readonly<Record<ModelName, string | readonly string[]>>): Snapshot<Schema<S>, ModelName>;
|
|
273
|
+
readonly commits: CommitResource<ReadDependency | CapturedRow>;
|
|
287
274
|
/**
|
|
288
275
|
* Subscribe to pushed frames — deltas, presence updates, claim grants and
|
|
289
276
|
* losses, connection changes. Durable: the subscription survives the
|
package/dist/core.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ export { BootstrapFetcher } from './local/sync/BootstrapFetcher.js';
|
|
|
30
30
|
* existing imports working and will be removed in a future major version. */
|
|
31
31
|
export { BootstrapFetcher as BootstrapHelper } from './local/sync/BootstrapFetcher.js';
|
|
32
32
|
export { createClaimStream, type AttachableClaimStream, type ClaimStreamConfig, } from './local/sync/createClaimStream.js';
|
|
33
|
-
export { awaitClaimGrant, type GrantTransport, } from '@abloatai/transaction/
|
|
33
|
+
export { awaitClaimGrant, type GrantTransport, } from '@abloatai/transaction/claims';
|
|
34
34
|
export { LoadStrategy } from '@abloatai/transaction/types';
|
|
35
35
|
export type { InternalAbloOptions } from './local/client/options.js';
|
|
36
36
|
export { drainProfileSnapshot, resetDrainProfile, drainProfilingEnabled, drainAcknowledgeStamps, type AcknowledgeStamp, type DrainProfile, type DrainBatchRow, type DrainStage, type DrainStageTotals, } from './local/sync/drainProfile.js';
|
package/dist/core.js
CHANGED
|
@@ -42,7 +42,7 @@ export { BootstrapFetcher as BootstrapHelper } from './local/sync/BootstrapFetch
|
|
|
42
42
|
// grants. These are for extension code and test harnesses; ordinary
|
|
43
43
|
// application code should use `ablo.<model>.claim`.
|
|
44
44
|
export { createClaimStream, } from './local/sync/createClaimStream.js';
|
|
45
|
-
export { awaitClaimGrant, } from '@abloatai/transaction/
|
|
45
|
+
export { awaitClaimGrant, } from '@abloatai/transaction/claims';
|
|
46
46
|
// An enum naming the strategies for loading a model's data. Referenced when
|
|
47
47
|
// registering models in extension code.
|
|
48
48
|
export { LoadStrategy } from '@abloatai/transaction/types';
|
package/dist/local/Database.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ import type { RuntimeContext } from './RuntimeContext.js';
|
|
|
13
13
|
import type { AppliedChange } from '../plugin.js';
|
|
14
14
|
import type { BootstrapFetcher, BootstrapData } from './sync/BootstrapFetcher.js';
|
|
15
15
|
import { InMemoryObjectStore } from './adapters/inMemoryStorage.js';
|
|
16
|
-
import type { SyncDeltaAction } from '@abloatai/transaction/
|
|
16
|
+
import type { SyncDeltaAction } from '@abloatai/transaction/observation';
|
|
17
17
|
import type { BootstrapType } from '@abloatai/transaction/types';
|
|
18
18
|
import { type PersistedTransaction } from './transactions/persistedTransaction.js';
|
|
19
19
|
/** Generic record type for model data */
|
package/dist/local/SyncClient.js
CHANGED
|
@@ -1229,6 +1229,11 @@ export class SyncClient extends EventEmitter {
|
|
|
1229
1229
|
dispose() {
|
|
1230
1230
|
this.isDisposed = true;
|
|
1231
1231
|
this.disconnect();
|
|
1232
|
+
// The queue owns commit retry, replication-lag, offline-grace, and
|
|
1233
|
+
// per-mutation timers. A disposed client must release those resources too;
|
|
1234
|
+
// otherwise an atomic commit can keep a worker process alive after the
|
|
1235
|
+
// public client has been disposed.
|
|
1236
|
+
this.mutationQueue.dispose();
|
|
1232
1237
|
this.networkMonitor.dispose();
|
|
1233
1238
|
this.observers.clear();
|
|
1234
1239
|
this.pendingStages.clear();
|
|
@@ -16,7 +16,7 @@ import { BootstrapFetcher } from '../sync/BootstrapFetcher.js';
|
|
|
16
16
|
import type { AuthCredentialSource } from '@abloatai/transaction/auth/credentialSource';
|
|
17
17
|
import type { Schema, SchemaRecord } from '@abloatai/transaction/schema/schema';
|
|
18
18
|
import { type AbloPersistence } from '../persistence.js';
|
|
19
|
-
import type { DurableWriteStore, DurableWritesConfig } from '@abloatai/transaction/
|
|
19
|
+
import type { DurableWriteStore, DurableWritesConfig } from '@abloatai/transaction/commit';
|
|
20
20
|
import type { RuntimeContext } from '../RuntimeContext.js';
|
|
21
21
|
export interface InternalComponentsInput<S extends SchemaRecord> {
|
|
22
22
|
readonly schema: Schema<S>;
|
|
@@ -17,7 +17,7 @@ import { loadsAtBootstrap } from '@abloatai/transaction/schema/loadStrategy';
|
|
|
17
17
|
import { resolveBootstrapBaseUrl } from '@abloatai/transaction/auth/apiKey';
|
|
18
18
|
import { shouldUseInMemoryPersistence, } from '../persistence.js';
|
|
19
19
|
import { globalRuntime } from '../context.js';
|
|
20
|
-
import { resolveDurableWrites } from '@abloatai/transaction/
|
|
20
|
+
import { resolveDurableWrites } from '@abloatai/transaction/commit';
|
|
21
21
|
export function createInternalComponents(input) {
|
|
22
22
|
const { schema, url, options, auth } = input;
|
|
23
23
|
const runtime = input.runtime ?? globalRuntime;
|
|
@@ -3,25 +3,25 @@
|
|
|
3
3
|
* `ablo.<model>`.
|
|
4
4
|
*
|
|
5
5
|
* Each schema model gets one {@link ModelOperations}: the async server reads
|
|
6
|
-
* `
|
|
6
|
+
* `read` and `list`, with the same point lookup restricted to the local graph under
|
|
7
7
|
* `local`, the writes `create`, `update`, and `delete`, the coordination
|
|
8
8
|
* namespace `claim` (callable as `claim({ id })`, plus `claim.state`,
|
|
9
9
|
* `claim.queue`, `claim.release`, and `claim.reorder`), `join`, and `onChange`.
|
|
10
10
|
* The factory returns a plain object; the client assembles the `ablo.<model>`
|
|
11
11
|
* lookup table from one of these per model.
|
|
12
12
|
*/
|
|
13
|
-
import type { CommitCreateOptions, CommitReceipt } from '@abloatai/transaction/resources/httpResources';
|
|
13
|
+
import type { CommitCreateOptions, CommitReceipt } from '@abloatai/transaction/client/resources/httpResources';
|
|
14
14
|
import type { ModelTarget } from '@abloatai/transaction/coordination/schema';
|
|
15
15
|
import type { ModelRegistry } from '../ModelRegistry.js';
|
|
16
16
|
import type { InstanceCache } from '../InstanceCache.js';
|
|
17
17
|
import type { SyncClient } from '../SyncClient.js';
|
|
18
18
|
import type { OnDemandLoader } from '../sync/OnDemandLoader.js';
|
|
19
19
|
import type { JoinedParticipant } from '../sync/participants.js';
|
|
20
|
-
import type { Duration, Claim, ClaimHeartbeat, ClaimHeartbeatOptions, HeldClaim, HeldLease, ClaimWaitOptions
|
|
21
|
-
export type { ModelListScope,
|
|
20
|
+
import type { Duration, Claim, ClaimHeartbeat, ClaimHeartbeatOptions, HeldClaim, HeldLease, ClaimWaitOptions } from '@abloatai/transaction/types/streams';
|
|
21
|
+
export type { ModelListScope, LocalReadOptions, LocalCountOptions, ServerReadOptions, ListAllOptions, ServerPointReadOptions, ClaimTargetOptions, ClaimParams, ClaimContentionOptions, ClaimAttemptEvent, ClaimQueueView, ClaimSkipOptions, ClaimSkipParams, ClaimLookupParams, ClaimReorderParams, ClaimOptions, ClaimReadApi, AwaitedClaimMethod, ClaimApi, ModelReadParams, ModelCreateParams, ModelUpdateParams, ModelDeleteParams, JoinOptions, } from '@abloatai/transaction/client/resources/modelOperations';
|
|
22
22
|
export type { Claim, ClaimHeartbeat, ClaimHeartbeatOptions, HeldClaim, HeldLease };
|
|
23
|
-
import type { ClaimApi, ClaimAttemptEvent, JoinOptions, LocalCountOptions, LocalReadOptions } from '@abloatai/transaction/resources/modelOperations';
|
|
24
|
-
import type { HttpModelClient } from '@abloatai/transaction/transport/
|
|
23
|
+
import type { ClaimApi, ClaimAttemptEvent, JoinOptions, LocalCountOptions, LocalReadOptions } from '@abloatai/transaction/client/resources/modelOperations';
|
|
24
|
+
import type { HttpModelClient } from '@abloatai/transaction/transport/http';
|
|
25
25
|
import type { ParticipantKind } from '@abloatai/transaction/types/participant';
|
|
26
26
|
import { type ReadSetContext } from '@abloatai/transaction/internal/read-set';
|
|
27
27
|
export interface ModelClientMeta {
|
|
@@ -77,7 +77,8 @@ export interface ModelCollaboration {
|
|
|
77
77
|
/** Request-scoped queued / granted / skipped / failed status events. */
|
|
78
78
|
onStatus?: (event: ClaimAttemptEvent) => void;
|
|
79
79
|
}): Promise<Claim>;
|
|
80
|
-
|
|
80
|
+
/** Current applied/acked watermark, captured after a claim's fresh read. */
|
|
81
|
+
currentReadAt(): number;
|
|
81
82
|
/**
|
|
82
83
|
* Current coordination state on a target — who (if anyone) holds it.
|
|
83
84
|
* Synchronous reactive snapshot read off the presence/claim stream;
|
|
@@ -145,7 +146,7 @@ export interface ModelCollaboration {
|
|
|
145
146
|
* Opens a presence and claim subscription on this model's sync group(s) and
|
|
146
147
|
* returns the live participant handle. Backs `ablo.<model>.join(ids)`.
|
|
147
148
|
* WebSocket only, since presence needs a live socket; it is absent on other
|
|
148
|
-
* client constructions, where the
|
|
149
|
+
* client constructions, where the surface throws a clear error.
|
|
149
150
|
*/
|
|
150
151
|
createJoin?(modelKey: string, ids: string | readonly string[], options?: JoinOptions): Promise<JoinedParticipant>;
|
|
151
152
|
}
|
|
@@ -154,7 +155,7 @@ export interface ModelCollaboration {
|
|
|
154
155
|
*
|
|
155
156
|
* Every verb mirrors its asynchronous sibling on the base surface, and the one
|
|
156
157
|
* word in front is the whole difference. It is a narrowing, not a claim about
|
|
157
|
-
* the other side: `
|
|
158
|
+
* the other side: `read` consults the local graph and then the network,
|
|
158
159
|
* while `local.get` is restricted to what is already resident — which is
|
|
159
160
|
* also why it can return a value instead of a promise. There is nothing to
|
|
160
161
|
* await.
|
|
@@ -253,7 +254,7 @@ interface ReactiveModelSurface<T, Fields = T> {
|
|
|
253
254
|
* See {@link ReactiveModelSurface}.
|
|
254
255
|
*/
|
|
255
256
|
export type ModelOperations<T, CreateInput> = Omit<HttpModelClient<T, CreateInput>, 'claim'> & ReactiveModelSurface<T, CreateInput>;
|
|
256
|
-
export declare function
|
|
257
|
+
export declare function createModelOperations<T, C>(schemaKey: string, registeredModelName: string, objectPool: Pick<InstanceCache, 'get' | 'getByType' | 'getOfType'>, syncClient: Pick<SyncClient, 'add' | 'delete' | 'getOrganizationId' | 'syncNow' | 'update' | 'waitForConfirmation'>, registry: Pick<ModelRegistry, 'getModelByName'>,
|
|
257
258
|
/**
|
|
258
259
|
* The one thing this factory asks of the loader: fetch rows for a model.
|
|
259
260
|
*
|