@agentshouse/mdruntime 0.1.0-alpha.9 → 0.1.0-c3903a68dcbbf
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/AGENTS.md +210 -0
- package/README.md +44 -0
- package/dist/adapter.d.ts +155 -12
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js +2 -3
- package/dist/attachment.d.ts +3 -0
- package/dist/attachment.d.ts.map +1 -0
- package/dist/attachment.js +8 -0
- package/dist/bootstrap.d.ts +3 -7
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +29 -27
- package/dist/change-set.d.ts +33 -0
- package/dist/change-set.d.ts.map +1 -0
- package/dist/change-set.js +87 -0
- package/dist/change.d.ts +9 -0
- package/dist/change.d.ts.map +1 -1
- package/dist/change.js +6 -5
- package/dist/client.d.ts +40 -28
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +121 -177
- package/dist/collection.d.ts +15 -16
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +54 -87
- package/dist/connection.d.ts +57 -35
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +1475 -964
- package/dist/conversation.d.ts +41 -19
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +483 -327
- package/dist/durability.js +6 -6
- package/dist/file.d.ts +2 -2
- package/dist/file.d.ts.map +1 -1
- package/dist/file.js +48 -71
- package/dist/host.d.ts +7 -2
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +100 -102
- package/dist/identity.d.ts +1 -0
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +10 -9
- package/dist/index.d.ts +12 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -2
- package/dist/log.js +5 -6
- package/dist/memory.d.ts +6 -3
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +206 -210
- package/dist/model.d.ts +10 -25
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +18 -21
- package/dist/observation.d.ts +25 -0
- package/dist/observation.d.ts.map +1 -0
- package/dist/observation.js +85 -0
- package/dist/outcome.d.ts +17 -20
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +1 -23
- package/dist/overlay.d.ts +9 -2
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +187 -43
- package/dist/paths.d.ts +0 -1
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +12 -19
- package/dist/query.d.ts +210 -10
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +420 -15
- package/dist/read-side.d.ts +14 -0
- package/dist/read-side.d.ts.map +1 -0
- package/dist/read-side.js +371 -0
- package/dist/refresh.d.ts +4 -5
- package/dist/refresh.d.ts.map +1 -1
- package/dist/refresh.js +45 -30
- package/dist/replica.d.ts +25 -5
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +232 -38
- package/dist/room-draft.d.ts +124 -0
- package/dist/room-draft.d.ts.map +1 -0
- package/dist/room-draft.js +327 -0
- package/dist/rows.d.ts +41 -0
- package/dist/rows.d.ts.map +1 -0
- package/dist/rows.js +100 -0
- package/dist/save.d.ts +8 -4
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +265 -350
- package/dist/search.d.ts +61 -0
- package/dist/search.d.ts.map +1 -0
- package/dist/search.js +125 -0
- package/dist/status.d.ts +4 -6
- package/dist/status.d.ts.map +1 -1
- package/dist/status.js +9 -13
- package/dist/store.d.ts +68 -30
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +360 -134
- package/dist/transfer.d.ts +5 -0
- package/dist/transfer.d.ts.map +1 -1
- package/dist/transfer.js +1 -5
- package/dist/wire.d.ts +4 -3
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +50 -65
- package/package.json +6 -12
- package/dist/adapter.js.map +0 -1
- package/dist/bootstrap.js.map +0 -1
- package/dist/change.js.map +0 -1
- package/dist/client.js.map +0 -1
- package/dist/collection.js.map +0 -1
- package/dist/connection.js.map +0 -1
- package/dist/conversation.js.map +0 -1
- package/dist/durability.js.map +0 -1
- package/dist/file.js.map +0 -1
- package/dist/host.js.map +0 -1
- package/dist/identity.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/log.js.map +0 -1
- package/dist/memory.js.map +0 -1
- package/dist/model.js.map +0 -1
- package/dist/outcome.js.map +0 -1
- package/dist/overlay.js.map +0 -1
- package/dist/paths.js.map +0 -1
- package/dist/query.js.map +0 -1
- package/dist/refresh.js.map +0 -1
- package/dist/replica.js.map +0 -1
- package/dist/save.js.map +0 -1
- package/dist/status.js.map +0 -1
- package/dist/store.js.map +0 -1
- package/dist/transfer.js.map +0 -1
- package/dist/wire.js.map +0 -1
package/dist/model.d.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { MdType } from './collection.js';
|
|
1
|
+
import type { Definition, FieldSpec, SectionSpec, VerifiedModel } from '@agentshouse/mdmodel';
|
|
3
2
|
export type ModelIdentity = {
|
|
4
3
|
identity: string;
|
|
5
4
|
version: string;
|
|
6
5
|
};
|
|
7
6
|
export type ModelSnapshot = ModelIdentity & {
|
|
8
|
-
|
|
7
|
+
schema: string | null;
|
|
9
8
|
};
|
|
10
|
-
export type ModelUnavailableReason = 'not-readable' | 'revoked' | 'not-acquired' | 'version-changed' | 'invalid'
|
|
9
|
+
export type ModelUnavailableReason = 'not-readable' | 'revoked' | 'not-acquired' | 'version-changed' | 'invalid';
|
|
11
10
|
export type ModelResult = {
|
|
12
11
|
kind: 'model';
|
|
13
12
|
snapshot: ModelSnapshot;
|
|
@@ -19,6 +18,11 @@ export type ModelResult = {
|
|
|
19
18
|
} | {
|
|
20
19
|
kind: 'revoked-authorization';
|
|
21
20
|
};
|
|
21
|
+
export type MdType = {
|
|
22
|
+
name: string;
|
|
23
|
+
fields: Readonly<Record<string, FieldSpec>>;
|
|
24
|
+
sections: Readonly<Record<string, SectionSpec>>;
|
|
25
|
+
};
|
|
22
26
|
export type ModelState = {
|
|
23
27
|
status: 'unavailable';
|
|
24
28
|
reason: ModelUnavailableReason;
|
|
@@ -26,7 +30,7 @@ export type ModelState = {
|
|
|
26
30
|
status: 'current' | 'cached';
|
|
27
31
|
snapshot: ModelSnapshot;
|
|
28
32
|
verifiedWith: ModelIdentity;
|
|
29
|
-
types:
|
|
33
|
+
types: VerifiedModel['types'];
|
|
30
34
|
};
|
|
31
35
|
export type TypesResult = {
|
|
32
36
|
status: 'unavailable';
|
|
@@ -38,32 +42,13 @@ export type TypesResult = {
|
|
|
38
42
|
verifiedWith: ModelIdentity;
|
|
39
43
|
types: readonly MdType[];
|
|
40
44
|
};
|
|
41
|
-
export type ModelValidation = {
|
|
42
|
-
verdict: 'accept';
|
|
43
|
-
} | (Extract<Validation, {
|
|
44
|
-
verdict: 'refuse';
|
|
45
|
-
}> & {
|
|
46
|
-
source: 'content' | 'model';
|
|
47
|
-
});
|
|
48
|
-
export type AttachedModelBinding = {
|
|
49
|
-
verify(snapshot: ModelSnapshot): {
|
|
50
|
-
kind: 'verified';
|
|
51
|
-
types: readonly MdType[];
|
|
52
|
-
} | {
|
|
53
|
-
kind: 'invalid';
|
|
54
|
-
};
|
|
55
|
-
validate(input: {
|
|
56
|
-
model: ModelSnapshot;
|
|
57
|
-
documents: Readonly<Record<string, string>>;
|
|
58
|
-
binaryTargets: readonly string[];
|
|
59
|
-
}): ModelValidation;
|
|
60
|
-
};
|
|
61
45
|
export type ValidationReceipt = {
|
|
62
46
|
identity: string;
|
|
63
47
|
version: string;
|
|
64
48
|
source: 'current' | 'cached';
|
|
65
49
|
};
|
|
66
50
|
export declare const NO_MODEL: ModelState;
|
|
51
|
+
export declare function definitionOf(state: ModelState, type: string | undefined): Definition | undefined;
|
|
67
52
|
export declare function modelTypes(state: ModelState): TypesResult;
|
|
68
53
|
export declare function cached(state: ModelState): ModelState;
|
|
69
54
|
export declare function sameModel(left: ModelIdentity, right: ModelIdentity): boolean;
|
package/dist/model.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE9F,MAAM,MAAM,aAAa,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAClE,MAAM,MAAM,aAAa,GAAG,aAAa,GAAG;IAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC;AACtE,MAAM,MAAM,sBAAsB,GAC9B,cAAc,GACd,SAAS,GACT,cAAc,GACd,iBAAiB,GACjB,SAAS,CAAC;AACd,MAAM,MAAM,WAAW,GACnB;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,aAAa,CAAA;CAAE,GAC1C;IAAE,IAAI,EAAE,mBAAmB,CAAC;IAAC,MAAM,EAAE,sBAAsB,CAAA;CAAE,GAC7D;IAAE,IAAI,EAAE,uBAAuB,CAAA;CAAE,GACjC;IAAE,IAAI,EAAE,uBAAuB,CAAA;CAAE,CAAC;AACtC,MAAM,MAAM,MAAM,GAAG;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;IAC5C,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC;CACjD,CAAC;AACF,MAAM,MAAM,UAAU,GAClB;IAAE,MAAM,EAAE,aAAa,CAAC;IAAC,MAAM,EAAE,sBAAsB,CAAA;CAAE,GACzD;IACE,MAAM,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC7B,QAAQ,EAAE,aAAa,CAAC;IACxB,YAAY,EAAE,aAAa,CAAC;IAC5B,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;CAC/B,CAAC;AACN,MAAM,MAAM,WAAW,GACnB;IAAE,MAAM,EAAE,aAAa,CAAC;IAAC,MAAM,EAAE,sBAAsB,CAAA;CAAE,GACzD;IACE,MAAM,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,aAAa,CAAC;IAC5B,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1B,CAAC;AACN,MAAM,MAAM,iBAAiB,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,SAAS,GAAG,QAAQ,CAAA;CAAE,CAAC;AACpG,eAAO,MAAM,QAAQ,EAAE,UAA8D,CAAC;AACtF,wBAAgB,YAAY,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,CAGhG;AACD,wBAAgB,UAAU,CAAC,KAAK,EAAE,UAAU,GAAG,WAAW,CAczD;AACD,wBAAgB,MAAM,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU,CAEpD;AACD,wBAAgB,SAAS,CAAC,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,GAAG,OAAO,CAE5E"}
|
package/dist/model.js
CHANGED
|
@@ -1,28 +1,25 @@
|
|
|
1
|
-
export const NO_MODEL = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
export const NO_MODEL = { status: 'unavailable', reason: 'not-acquired' };
|
|
2
|
+
export function definitionOf(state, type) {
|
|
3
|
+
if (state.status === 'unavailable' || type === undefined)
|
|
4
|
+
return undefined;
|
|
5
|
+
return Object.hasOwn(state.types, type) ? state.types[type] : undefined;
|
|
6
|
+
}
|
|
5
7
|
export function modelTypes(state) {
|
|
6
|
-
return state.status === 'unavailable'
|
|
7
|
-
...state
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
8
|
+
return state.status === 'unavailable'
|
|
9
|
+
? { ...state }
|
|
10
|
+
: {
|
|
11
|
+
status: state.status,
|
|
12
|
+
identity: state.snapshot.identity,
|
|
13
|
+
version: state.snapshot.version,
|
|
14
|
+
verifiedWith: { ...state.verifiedWith },
|
|
15
|
+
types: structuredClone(Object.values(state.types)
|
|
16
|
+
.sort((left, right) => (left.name < right.name ? -1 : left.name > right.name ? 1 : 0))
|
|
17
|
+
.map(({ name, fields, sections }) => ({ name, fields, sections }))),
|
|
18
|
+
};
|
|
17
19
|
}
|
|
18
20
|
export function cached(state) {
|
|
19
|
-
return state.status === 'unavailable' ? state : {
|
|
20
|
-
...state,
|
|
21
|
-
status: 'cached'
|
|
22
|
-
};
|
|
21
|
+
return state.status === 'unavailable' ? state : { ...state, status: 'cached' };
|
|
23
22
|
}
|
|
24
23
|
export function sameModel(left, right) {
|
|
25
24
|
return left.identity === right.identity && left.version === right.version;
|
|
26
25
|
}
|
|
27
|
-
|
|
28
|
-
//# sourceMappingURL=model.js.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { QueryDocument, QueryGroup, QueryResult } from './query.js';
|
|
2
|
+
export type Observation<T> = {
|
|
3
|
+
current(): T;
|
|
4
|
+
subscribe(listener: (value: T) => void): () => void;
|
|
5
|
+
close(): void;
|
|
6
|
+
};
|
|
7
|
+
export type RowKey = string | number;
|
|
8
|
+
export type KeyedResult = {
|
|
9
|
+
result: QueryResult;
|
|
10
|
+
keys: readonly RowKey[];
|
|
11
|
+
};
|
|
12
|
+
export type QueryChange = {
|
|
13
|
+
changed: readonly (readonly [RowKey, QueryDocument | QueryGroup])[];
|
|
14
|
+
removed: readonly RowKey[];
|
|
15
|
+
order: readonly RowKey[] | null;
|
|
16
|
+
};
|
|
17
|
+
export type Observed = {
|
|
18
|
+
observation: Observation<unknown>;
|
|
19
|
+
receive(message: unknown): void;
|
|
20
|
+
end(): void;
|
|
21
|
+
};
|
|
22
|
+
export declare function rowsOf(result: QueryResult): readonly (QueryDocument | QueryGroup)[];
|
|
23
|
+
export declare function observed(first: unknown, stop: () => void, keyed: boolean): Observed;
|
|
24
|
+
export declare function opened(watch: (deliver: (message: unknown) => void) => () => void, keyed: boolean): Promise<Observation<unknown>>;
|
|
25
|
+
//# sourceMappingURL=observation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"observation.d.ts","sourceRoot":"","sources":["../src/observation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzE,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI;IAC3B,OAAO,IAAI,CAAC,CAAC;IACb,SAAS,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IACpD,KAAK,IAAI,IAAI,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAErC,MAAM,MAAM,WAAW,GAAG;IAAE,MAAM,EAAE,WAAW,CAAC;IAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,CAAC;AAE3E,MAAM,MAAM,WAAW,GAAG;IACxB,OAAO,EAAE,SAAS,CAAC,SAAS,CAAC,MAAM,EAAE,aAAa,GAAG,UAAU,CAAC,CAAC,EAAE,CAAC;IACpE,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IACrB,WAAW,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAClC,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IAChC,GAAG,IAAI,IAAI,CAAC;CACb,CAAC;AAEF,wBAAgB,MAAM,CAAC,MAAM,EAAE,WAAW,GAAG,SAAS,CAAC,aAAa,GAAG,UAAU,CAAC,EAAE,CAEnF;AA0BD,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,EAAE,KAAK,EAAE,OAAO,GAAG,QAAQ,CAkCnF;AAED,wBAAgB,MAAM,CACpB,KAAK,EAAE,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,KAAK,MAAM,IAAI,EAC1D,KAAK,EAAE,OAAO,GACb,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAiB/B"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
export function rowsOf(result) {
|
|
2
|
+
return 'groups' in result ? result.groups : result.documents;
|
|
3
|
+
}
|
|
4
|
+
function keyedResult(first) {
|
|
5
|
+
const grouped = 'groups' in first.result;
|
|
6
|
+
const rows = rowsOf(first.result);
|
|
7
|
+
const byKey = new Map(first.keys.map((key, index) => [key, rows[index]]));
|
|
8
|
+
let keys = first.keys;
|
|
9
|
+
return {
|
|
10
|
+
value: first.result,
|
|
11
|
+
next(message) {
|
|
12
|
+
const change = message;
|
|
13
|
+
for (const key of change.removed)
|
|
14
|
+
byKey.delete(key);
|
|
15
|
+
for (const [key, row] of change.changed)
|
|
16
|
+
byKey.set(key, row);
|
|
17
|
+
keys = change.order ?? keys.filter((key) => byKey.has(key));
|
|
18
|
+
const next = keys.map((key) => byKey.get(key));
|
|
19
|
+
return grouped
|
|
20
|
+
? { groups: next }
|
|
21
|
+
: { documents: next };
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function whole(first) {
|
|
26
|
+
return { value: first, next: (message) => message };
|
|
27
|
+
}
|
|
28
|
+
export function observed(first, stop, keyed) {
|
|
29
|
+
const reducer = keyed ? keyedResult(first) : whole(first);
|
|
30
|
+
let value = reducer.value;
|
|
31
|
+
let open = true;
|
|
32
|
+
const listeners = new Set();
|
|
33
|
+
const end = () => {
|
|
34
|
+
open = false;
|
|
35
|
+
listeners.clear();
|
|
36
|
+
};
|
|
37
|
+
return {
|
|
38
|
+
observation: {
|
|
39
|
+
current: () => value,
|
|
40
|
+
subscribe(listener) {
|
|
41
|
+
const entry = { hear: listener };
|
|
42
|
+
if (open)
|
|
43
|
+
listeners.add(entry);
|
|
44
|
+
return () => {
|
|
45
|
+
listeners.delete(entry);
|
|
46
|
+
};
|
|
47
|
+
},
|
|
48
|
+
close() {
|
|
49
|
+
if (!open)
|
|
50
|
+
return;
|
|
51
|
+
end();
|
|
52
|
+
stop();
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
receive(message) {
|
|
56
|
+
if (!open)
|
|
57
|
+
return;
|
|
58
|
+
value = reducer.next(message);
|
|
59
|
+
for (const entry of [...listeners]) {
|
|
60
|
+
if (listeners.has(entry))
|
|
61
|
+
entry.hear(value);
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
end,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
export function opened(watch, keyed) {
|
|
68
|
+
return new Promise((resolve, reject) => {
|
|
69
|
+
let handle;
|
|
70
|
+
let stop = () => { };
|
|
71
|
+
try {
|
|
72
|
+
stop = watch((message) => {
|
|
73
|
+
if (handle !== undefined) {
|
|
74
|
+
handle.receive(message);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
handle = observed(message, () => stop(), keyed);
|
|
78
|
+
resolve(handle.observation);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
reject(error);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
package/dist/outcome.d.ts
CHANGED
|
@@ -1,37 +1,34 @@
|
|
|
1
|
-
import type { ActionResult, ProviderRefusal
|
|
1
|
+
import type { ActionResult, ProviderRefusal } from './adapter.js';
|
|
2
2
|
import type { ChangeBatch } from './change.js';
|
|
3
3
|
export type AffectedState = Readonly<Record<string, string>>;
|
|
4
4
|
export type CallResult = ActionResult | {
|
|
5
5
|
kind: 'undeclared';
|
|
6
6
|
};
|
|
7
|
-
export type
|
|
8
|
-
kind: '
|
|
9
|
-
|
|
7
|
+
export type AcceptedOutcome = {
|
|
8
|
+
kind: 'accepted';
|
|
9
|
+
roomVersion: string;
|
|
10
|
+
author?: string;
|
|
11
|
+
time?: string;
|
|
12
|
+
};
|
|
13
|
+
export type SubmissionOutcome = AcceptedOutcome | (ProviderRefusal & {
|
|
10
14
|
kind: 'conflicted';
|
|
11
15
|
roomVersion?: string;
|
|
12
16
|
affected: AffectedState;
|
|
13
17
|
}) | (ProviderRefusal & {
|
|
14
18
|
kind: 'rejected';
|
|
15
19
|
affected: AffectedState;
|
|
16
|
-
}) |
|
|
20
|
+
}) | {
|
|
17
21
|
kind: 'expired';
|
|
22
|
+
} | {
|
|
23
|
+
kind: 'withdrawn';
|
|
18
24
|
};
|
|
19
|
-
export type
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
25
|
+
export type Submission = {
|
|
26
|
+
readonly state: 'waiting' | 'submitted';
|
|
27
|
+
} | {
|
|
28
|
+
readonly state: 'reset';
|
|
29
|
+
readonly reset: string;
|
|
24
30
|
};
|
|
25
|
-
export type SubmissionOutcome = QueueOutcome | AcceptedOutcome;
|
|
26
31
|
export type QueueEntry = {
|
|
27
32
|
readonly batch: ChangeBatch;
|
|
28
|
-
|
|
29
|
-
};
|
|
30
|
-
export type RefusedOutcome = Extract<QueueOutcome, {
|
|
31
|
-
kind: 'conflicted' | 'rejected' | 'expired';
|
|
32
|
-
}>;
|
|
33
|
-
export declare function refused(outcome: SubmissionOutcome | undefined): outcome is RefusedOutcome;
|
|
34
|
-
export declare function withheldUntilReset(outcome: SubmissionOutcome | undefined, at: number): boolean;
|
|
35
|
-
export declare function refusalOf(outcome: RefusedOutcome): ProviderRefusal | null;
|
|
36
|
-
export declare function queuedOutcome(outcome: SubmissionOutcome | undefined): QueueOutcome;
|
|
33
|
+
} & Submission;
|
|
37
34
|
//# sourceMappingURL=outcome.d.ts.map
|
package/dist/outcome.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outcome.d.ts","sourceRoot":"","sources":["../src/outcome.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"outcome.d.ts","sourceRoot":"","sources":["../src/outcome.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,MAAM,aAAa,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAE7D,MAAM,MAAM,UAAU,GAAG,YAAY,GAAG;IAAE,IAAI,EAAE,YAAY,CAAA;CAAE,CAAC;AAE/D,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,UAAU,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,iBAAiB,GACzB,eAAe,GACf,CAAC,eAAe,GAAG;IACjB,IAAI,EAAE,YAAY,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,aAAa,CAAC;CACzB,CAAC,GACF,CAAC,eAAe,GAAG;IACjB,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE,aAAa,CAAC;CACzB,CAAC,GACF;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,GACnB;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,CAAC;AAE1B,MAAM,MAAM,UAAU,GAClB;IAAE,QAAQ,CAAC,KAAK,EAAE,SAAS,GAAG,WAAW,CAAA;CAAE,GAC3C;IAAE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAExD,MAAM,MAAM,UAAU,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAA;CAAE,GAAG,UAAU,CAAC"}
|
package/dist/outcome.js
CHANGED
|
@@ -1,23 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
return outcome?.kind === 'conflicted' || outcome?.kind === 'rejected' || outcome?.kind === 'expired';
|
|
3
|
-
}
|
|
4
|
-
export function withheldUntilReset(outcome, at) {
|
|
5
|
-
return outcome?.kind === 'retryable-refusal' && outcome.reset !== undefined && at < Date.parse(outcome.reset);
|
|
6
|
-
}
|
|
7
|
-
export function refusalOf(outcome) {
|
|
8
|
-
if (outcome.kind === 'expired') return null;
|
|
9
|
-
return {
|
|
10
|
-
code: outcome.code,
|
|
11
|
-
fields: outcome.fields
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
export function queuedOutcome(outcome) {
|
|
15
|
-
if (outcome === undefined || outcome.kind === 'accepted' || outcome.kind === 'pending') {
|
|
16
|
-
return {
|
|
17
|
-
kind: 'pending'
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
return outcome;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
//# sourceMappingURL=outcome.js.map
|
|
1
|
+
export {};
|
package/dist/overlay.d.ts
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
|
+
import type { HeadChange } from './adapter.js';
|
|
1
2
|
import type { ChangeBatch } from './change.js';
|
|
2
|
-
export type
|
|
3
|
+
export type Heads = {
|
|
4
|
+
revisions: Readonly<Record<string, string>>;
|
|
5
|
+
changes: Readonly<Record<string, HeadChange>>;
|
|
6
|
+
};
|
|
7
|
+
export type Layer = Heads & {
|
|
3
8
|
documents: Readonly<Record<string, string>>;
|
|
4
9
|
binaryTargets: readonly string[];
|
|
5
|
-
revisions: Readonly<Record<string, string>>;
|
|
6
10
|
};
|
|
11
|
+
export declare function sameChange(left: HeadChange | undefined, right: HeadChange | undefined): boolean;
|
|
7
12
|
export declare function overlay(base: Layer, queue: readonly ChangeBatch[]): Layer;
|
|
13
|
+
export declare function sameLayerText(left: Layer, right: Layer): boolean;
|
|
14
|
+
export declare function overlayChanged(base: Layer, queue: readonly ChangeBatch[], previousBase: Layer, previousQueue: readonly ChangeBatch[], previousVisible: Layer): Layer;
|
|
8
15
|
//# sourceMappingURL=overlay.d.ts.map
|
package/dist/overlay.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overlay.d.ts","sourceRoot":"","sources":["../src/overlay.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAU,WAAW,EAAgB,MAAM,aAAa,CAAC;AAErE,MAAM,MAAM,KAAK,GAAG;IAClB,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC5C,
|
|
1
|
+
{"version":3,"file":"overlay.d.ts","sourceRoot":"","sources":["../src/overlay.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAU,WAAW,EAAgB,MAAM,aAAa,CAAC;AAErE,MAAM,MAAM,KAAK,GAAG;IAClB,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC5C,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;CAC/C,CAAC;AAEF,MAAM,MAAM,KAAK,GAAG,KAAK,GAAG;IAC1B,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC5C,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;CAClC,CAAC;AAEF,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,SAAS,EAAE,KAAK,EAAE,UAAU,GAAG,SAAS,GAAG,OAAO,CAQ/F;AAoJD,wBAAgB,OAAO,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,WAAW,EAAE,GAAG,KAAK,CAiBzE;AAQD,wBAAgB,aAAa,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,GAAG,OAAO,CAQhE;AAmBD,wBAAgB,cAAc,CAC5B,IAAI,EAAE,KAAK,EACX,KAAK,EAAE,SAAS,WAAW,EAAE,EAC7B,YAAY,EAAE,KAAK,EACnB,aAAa,EAAE,SAAS,WAAW,EAAE,EACrC,eAAe,EAAE,KAAK,GACrB,KAAK,CA4FP"}
|