@agentshouse/mdruntime 0.1.0-alpha.9 → 0.1.0-c009335e08279
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 +208 -0
- package/README.md +44 -0
- package/dist/adapter.d.ts +147 -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 +28 -27
- package/dist/change-set.d.ts +33 -0
- package/dist/change-set.d.ts.map +1 -0
- package/dist/change-set.js +83 -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 +38 -32
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +115 -177
- package/dist/collection.d.ts +13 -16
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +45 -88
- package/dist/connection.d.ts +46 -39
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +1376 -975
- 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 +6 -2
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +83 -108
- 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 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -3
- 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 +205 -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 +10 -29
- 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 +228 -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 +264 -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 +59 -31
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +338 -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 +47 -68
- 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/durability.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
const
|
|
1
|
+
const STORAGE_LOSS_CODE = 'storage-loss';
|
|
2
2
|
export function detectStorageLoss(stored, reported) {
|
|
3
|
-
if (reported === null || reported === stored)
|
|
4
|
-
|
|
3
|
+
if (reported === null || reported === stored)
|
|
4
|
+
return null;
|
|
5
|
+
return STORAGE_LOSS_CODE;
|
|
5
6
|
}
|
|
6
7
|
export function nextGeneration(stored, reported) {
|
|
7
|
-
if (stored !== null && (reported === null || reported === stored))
|
|
8
|
+
if (stored !== null && (reported === null || reported === stored))
|
|
9
|
+
return stored;
|
|
8
10
|
return crypto.randomUUID();
|
|
9
11
|
}
|
|
10
|
-
|
|
11
|
-
//# sourceMappingURL=durability.js.map
|
package/dist/file.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type
|
|
1
|
+
export type ChatDraftFile = {
|
|
2
2
|
name: string;
|
|
3
3
|
blob: Blob;
|
|
4
4
|
};
|
|
@@ -16,5 +16,5 @@ export type Extent = {
|
|
|
16
16
|
};
|
|
17
17
|
export declare function extentOf(bytes: Uint8Array): Extent | null;
|
|
18
18
|
export declare function hexDigest(digest: ArrayBuffer): string;
|
|
19
|
-
export declare function declaredFile(file:
|
|
19
|
+
export declare function declaredFile(file: ChatDraftFile): Promise<FileDeclaration>;
|
|
20
20
|
//# sourceMappingURL=file.d.ts.map
|
package/dist/file.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../src/file.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../src/file.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,IAAI,CAAC;CACZ,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,MAAM,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AA2GvD,wBAAgB,QAAQ,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,GAAG,IAAI,CAQzD;AAED,wBAAgB,SAAS,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAErD;AAED,wBAAsB,YAAY,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,eAAe,CAAC,CAUhF"}
|
package/dist/file.js
CHANGED
|
@@ -1,138 +1,117 @@
|
|
|
1
|
-
const PNG_SIGNATURE = [
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
0x47,
|
|
6
|
-
0x0d,
|
|
7
|
-
0x0a,
|
|
8
|
-
0x1a,
|
|
9
|
-
0x0a
|
|
10
|
-
];
|
|
11
|
-
const WEBP_SYNC = [
|
|
12
|
-
0x9d,
|
|
13
|
-
0x01,
|
|
14
|
-
0x2a
|
|
15
|
-
];
|
|
16
|
-
const SHAPELESS_JPEG_MARKERS = new Set([
|
|
17
|
-
0xc4,
|
|
18
|
-
0xc8,
|
|
19
|
-
0xcc
|
|
20
|
-
]);
|
|
21
|
-
const BMFF_CONTAINERS = new Set([
|
|
22
|
-
'meta',
|
|
23
|
-
'iprp',
|
|
24
|
-
'ipco'
|
|
25
|
-
]);
|
|
1
|
+
const PNG_SIGNATURE = [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a];
|
|
2
|
+
const WEBP_SYNC = [0x9d, 0x01, 0x2a];
|
|
3
|
+
const SHAPELESS_JPEG_MARKERS = new Set([0xc4, 0xc8, 0xcc]);
|
|
4
|
+
const BMFF_CONTAINERS = new Set(['meta', 'iprp', 'ipco']);
|
|
26
5
|
function starts(bytes, signature, at = 0) {
|
|
27
|
-
return signature.every((value, index)=>bytes[at + index] === value);
|
|
6
|
+
return signature.every((value, index) => bytes[at + index] === value);
|
|
28
7
|
}
|
|
29
8
|
function text(bytes, at, length) {
|
|
30
9
|
return String.fromCharCode(...bytes.subarray(at, at + length));
|
|
31
10
|
}
|
|
32
11
|
function bigEndian(bytes, at, length) {
|
|
33
12
|
let value = 0;
|
|
34
|
-
for(let index = 0; index < length; index += 1)
|
|
13
|
+
for (let index = 0; index < length; index += 1)
|
|
14
|
+
value = value * 256 + (bytes[at + index] ?? 0);
|
|
35
15
|
return value;
|
|
36
16
|
}
|
|
37
17
|
function littleEndian(bytes, at, length) {
|
|
38
18
|
let value = 0;
|
|
39
|
-
for(let index = length - 1; index >= 0; index -= 1)
|
|
19
|
+
for (let index = length - 1; index >= 0; index -= 1)
|
|
20
|
+
value = value * 256 + (bytes[at + index] ?? 0);
|
|
40
21
|
return value;
|
|
41
22
|
}
|
|
42
23
|
function pngExtent(bytes) {
|
|
43
|
-
if (bytes.length < 24 || !starts(bytes, PNG_SIGNATURE))
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
};
|
|
24
|
+
if (bytes.length < 24 || !starts(bytes, PNG_SIGNATURE))
|
|
25
|
+
return null;
|
|
26
|
+
if (text(bytes, 12, 4) !== 'IHDR')
|
|
27
|
+
return null;
|
|
28
|
+
return { width: bigEndian(bytes, 16, 4), height: bigEndian(bytes, 20, 4) };
|
|
49
29
|
}
|
|
50
30
|
function gifExtent(bytes) {
|
|
51
|
-
if (bytes.length < 10 || text(bytes, 0, 3) !== 'GIF')
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
height: littleEndian(bytes, 8, 2)
|
|
55
|
-
};
|
|
31
|
+
if (bytes.length < 10 || text(bytes, 0, 3) !== 'GIF')
|
|
32
|
+
return null;
|
|
33
|
+
return { width: littleEndian(bytes, 6, 2), height: littleEndian(bytes, 8, 2) };
|
|
56
34
|
}
|
|
57
35
|
function jpegExtent(bytes) {
|
|
58
|
-
if (bytes.length < 4 || bytes[0] !== 0xff || bytes[1] !== 0xd8)
|
|
36
|
+
if (bytes.length < 4 || bytes[0] !== 0xff || bytes[1] !== 0xd8)
|
|
37
|
+
return null;
|
|
59
38
|
let at = 2;
|
|
60
|
-
while(at + 9 < bytes.length){
|
|
61
|
-
if (bytes[at] !== 0xff)
|
|
39
|
+
while (at + 9 < bytes.length) {
|
|
40
|
+
if (bytes[at] !== 0xff)
|
|
41
|
+
return null;
|
|
62
42
|
const marker = bytes[at + 1] ?? 0;
|
|
63
|
-
if (marker === 0xd8 || marker === 0x01 || marker >= 0xd0 && marker <= 0xd7) {
|
|
43
|
+
if (marker === 0xd8 || marker === 0x01 || (marker >= 0xd0 && marker <= 0xd7)) {
|
|
64
44
|
at += 2;
|
|
65
45
|
continue;
|
|
66
46
|
}
|
|
67
47
|
const length = bigEndian(bytes, at + 2, 2);
|
|
68
48
|
if (marker >= 0xc0 && marker <= 0xcf && !SHAPELESS_JPEG_MARKERS.has(marker)) {
|
|
69
|
-
return {
|
|
70
|
-
width: bigEndian(bytes, at + 7, 2),
|
|
71
|
-
height: bigEndian(bytes, at + 5, 2)
|
|
72
|
-
};
|
|
49
|
+
return { width: bigEndian(bytes, at + 7, 2), height: bigEndian(bytes, at + 5, 2) };
|
|
73
50
|
}
|
|
74
|
-
if (length < 2)
|
|
51
|
+
if (length < 2)
|
|
52
|
+
return null;
|
|
75
53
|
at += 2 + length;
|
|
76
54
|
}
|
|
77
55
|
return null;
|
|
78
56
|
}
|
|
79
57
|
function webpExtent(bytes) {
|
|
80
|
-
if (bytes.length < 30 || text(bytes, 0, 4) !== 'RIFF' || text(bytes, 8, 4) !== 'WEBP')
|
|
58
|
+
if (bytes.length < 30 || text(bytes, 0, 4) !== 'RIFF' || text(bytes, 8, 4) !== 'WEBP')
|
|
59
|
+
return null;
|
|
81
60
|
const chunk = text(bytes, 12, 4);
|
|
82
61
|
if (chunk === 'VP8X') {
|
|
83
62
|
return {
|
|
84
63
|
width: littleEndian(bytes, 24, 3) + 1,
|
|
85
|
-
height: littleEndian(bytes, 27, 3) + 1
|
|
64
|
+
height: littleEndian(bytes, 27, 3) + 1,
|
|
86
65
|
};
|
|
87
66
|
}
|
|
88
67
|
if (chunk === 'VP8 ' && starts(bytes, WEBP_SYNC, 23)) {
|
|
89
68
|
return {
|
|
90
69
|
width: littleEndian(bytes, 26, 2) & 0x3fff,
|
|
91
|
-
height: littleEndian(bytes, 28, 2) & 0x3fff
|
|
70
|
+
height: littleEndian(bytes, 28, 2) & 0x3fff,
|
|
92
71
|
};
|
|
93
72
|
}
|
|
94
73
|
if (chunk === 'VP8L' && bytes[20] === 0x2f) {
|
|
95
74
|
const packed = littleEndian(bytes, 21, 4);
|
|
96
|
-
return {
|
|
97
|
-
width: (packed & 0x3fff) + 1,
|
|
98
|
-
height: (packed >>> 14 & 0x3fff) + 1
|
|
99
|
-
};
|
|
75
|
+
return { width: (packed & 0x3fff) + 1, height: ((packed >>> 14) & 0x3fff) + 1 };
|
|
100
76
|
}
|
|
101
77
|
return null;
|
|
102
78
|
}
|
|
103
79
|
function spatialExtent(bytes, from, to) {
|
|
104
80
|
let at = from;
|
|
105
|
-
while(at + 8 <= to){
|
|
81
|
+
while (at + 8 <= to) {
|
|
106
82
|
const size = bigEndian(bytes, at, 4);
|
|
107
83
|
const name = text(bytes, at + 4, 4);
|
|
108
84
|
const end = size === 0 ? to : at + size;
|
|
109
|
-
if (size === 1 || end <= at || end > to)
|
|
85
|
+
if (size === 1 || end <= at || end > to)
|
|
86
|
+
return null;
|
|
110
87
|
if (name === 'ispe') {
|
|
111
|
-
if (end < at + 20)
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
height: bigEndian(bytes, at + 16, 4)
|
|
115
|
-
};
|
|
88
|
+
if (end < at + 20)
|
|
89
|
+
return null;
|
|
90
|
+
return { width: bigEndian(bytes, at + 12, 4), height: bigEndian(bytes, at + 16, 4) };
|
|
116
91
|
}
|
|
117
92
|
if (BMFF_CONTAINERS.has(name)) {
|
|
118
93
|
const inner = spatialExtent(bytes, at + (name === 'meta' ? 12 : 8), end);
|
|
119
|
-
if (inner !== null)
|
|
94
|
+
if (inner !== null)
|
|
95
|
+
return inner;
|
|
120
96
|
}
|
|
121
97
|
at = end;
|
|
122
98
|
}
|
|
123
99
|
return null;
|
|
124
100
|
}
|
|
125
101
|
function bmffExtent(bytes) {
|
|
126
|
-
if (bytes.length < 16 || text(bytes, 4, 4) !== 'ftyp')
|
|
102
|
+
if (bytes.length < 16 || text(bytes, 4, 4) !== 'ftyp')
|
|
103
|
+
return null;
|
|
127
104
|
return spatialExtent(bytes, 0, bytes.length);
|
|
128
105
|
}
|
|
129
106
|
export function extentOf(bytes) {
|
|
130
|
-
return pngExtent(bytes) ??
|
|
107
|
+
return (pngExtent(bytes) ??
|
|
108
|
+
jpegExtent(bytes) ??
|
|
109
|
+
gifExtent(bytes) ??
|
|
110
|
+
webpExtent(bytes) ??
|
|
111
|
+
bmffExtent(bytes));
|
|
131
112
|
}
|
|
132
113
|
export function hexDigest(digest) {
|
|
133
|
-
return [
|
|
134
|
-
...new Uint8Array(digest)
|
|
135
|
-
].map((value)=>value.toString(16).padStart(2, '0')).join('');
|
|
114
|
+
return [...new Uint8Array(digest)].map((value) => value.toString(16).padStart(2, '0')).join('');
|
|
136
115
|
}
|
|
137
116
|
export async function declaredFile(file) {
|
|
138
117
|
const bytes = new Uint8Array(await file.blob.arrayBuffer());
|
|
@@ -142,8 +121,6 @@ export async function declaredFile(file) {
|
|
|
142
121
|
mediaType: file.blob.type,
|
|
143
122
|
byteLength: bytes.byteLength,
|
|
144
123
|
contentHash: hexDigest(await crypto.subtle.digest('SHA-256', bytes)),
|
|
145
|
-
...extent === null ? {} : extent
|
|
124
|
+
...(extent === null ? {} : extent),
|
|
146
125
|
};
|
|
147
126
|
}
|
|
148
|
-
|
|
149
|
-
//# sourceMappingURL=file.js.map
|
package/dist/host.d.ts
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { type MdRuntimeOptions } from './connection.js';
|
|
2
2
|
import { type RuntimePort } from './wire.js';
|
|
3
|
+
export type MdRuntimeHostOptions = MdRuntimeOptions & {
|
|
4
|
+
deploymentFacts?: unknown;
|
|
5
|
+
};
|
|
3
6
|
export type MdRuntimeHost = {
|
|
4
|
-
attach(port: RuntimePort, app: string): () => void;
|
|
7
|
+
attach(port: RuntimePort, app: string, release?: string): () => void;
|
|
5
8
|
endAuthorization(): Promise<void>;
|
|
9
|
+
stop(): Promise<void>;
|
|
6
10
|
};
|
|
7
|
-
export declare function serveMdRuntime(options:
|
|
11
|
+
export declare function serveMdRuntime(options: MdRuntimeHostOptions): MdRuntimeHost;
|
|
8
12
|
export type { RuntimePort } from './wire.js';
|
|
9
13
|
//# sourceMappingURL=host.d.ts.map
|
package/dist/host.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,gBAAgB,EAEtB,MAAM,iBAAiB,CAAC;AAKzB,OAAO,EAML,KAAK,WAAW,EAIjB,MAAM,WAAW,CAAC;AAEnB,MAAM,MAAM,oBAAoB,GAAG,gBAAgB,GAAG;IAAE,eAAe,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAEpF,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,CAAC,IAAI,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,IAAI,CAAC;IACrE,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAClC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB,CAAC;AA0EF,wBAAgB,cAAc,CAAC,OAAO,EAAE,oBAAoB,GAAG,aAAa,CAwG3E;AAED,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/host.js
CHANGED
|
@@ -1,42 +1,38 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { composeRuntime, } from './connection.js';
|
|
2
2
|
import { removeRuntimeStore } from './store.js';
|
|
3
|
-
import { AUTHORIZATION_ENDED, carried, envelope, PROTOCOL_MISMATCH, request } from './wire.js';
|
|
4
|
-
function answered(md, app, member, input) {
|
|
5
|
-
switch(member){
|
|
3
|
+
import { AUTHORIZATION_ENDED, carried, envelope, PROTOCOL_MISMATCH, request, } from './wire.js';
|
|
4
|
+
function answered(md, app, writtenBy, member, input) {
|
|
5
|
+
switch (member) {
|
|
6
6
|
case 'rooms':
|
|
7
7
|
return md.rooms();
|
|
8
8
|
case 'query':
|
|
9
9
|
return md.query(input[0]);
|
|
10
|
+
case 'search':
|
|
11
|
+
return md.search(input[0]);
|
|
10
12
|
case 'types':
|
|
11
13
|
return md.types(input[0]);
|
|
12
|
-
case 'syncStatus':
|
|
13
|
-
return md.syncStatus();
|
|
14
14
|
case 'save':
|
|
15
|
-
return md.save(input[0], input[1],
|
|
16
|
-
case 'outcome':
|
|
17
|
-
return md.outcome(input[0]);
|
|
15
|
+
return md.save(input[0], input[1], writtenBy);
|
|
18
16
|
case 'history':
|
|
19
17
|
return md.history(input[0], input[1], input[2]);
|
|
20
18
|
case 'call':
|
|
21
19
|
return md.call(input[0], input[1]);
|
|
20
|
+
case 'reached':
|
|
21
|
+
return md.reached(input[0], input[1], input[2]);
|
|
22
22
|
case 'log':
|
|
23
23
|
return md.log();
|
|
24
|
-
case 'storageLoss':
|
|
25
|
-
return md.storageLoss();
|
|
26
24
|
case 'persistence':
|
|
27
25
|
return md.persistence();
|
|
28
26
|
case 'reauthorize':
|
|
29
27
|
return md.reauthorize();
|
|
30
|
-
case '
|
|
31
|
-
return md.
|
|
32
|
-
case '
|
|
33
|
-
return md.
|
|
34
|
-
case '
|
|
35
|
-
return md.
|
|
36
|
-
case '
|
|
37
|
-
return md.
|
|
38
|
-
case 'queue.discard':
|
|
39
|
-
return md.queue.discard(input[0], input[1]);
|
|
28
|
+
case 'roomDraft.list':
|
|
29
|
+
return md.roomDraft.list();
|
|
30
|
+
case 'roomDraft.read':
|
|
31
|
+
return md.roomDraft.read(input[0], input[1]);
|
|
32
|
+
case 'roomDraft.write':
|
|
33
|
+
return md.roomDraft.write(input[0], input[1], input[2], input[3]);
|
|
34
|
+
case 'roomDraft.discard':
|
|
35
|
+
return md.roomDraft.discard(input[0], input[1], input[2]);
|
|
40
36
|
case 'presentation.read':
|
|
41
37
|
return md.presentation.read(app);
|
|
42
38
|
case 'presentation.write':
|
|
@@ -44,13 +40,7 @@ function answered(md, app, member, input) {
|
|
|
44
40
|
case 'conversation.list':
|
|
45
41
|
return md.conversation.list();
|
|
46
42
|
case 'conversation.read':
|
|
47
|
-
return md.conversation.read(input[0]);
|
|
48
|
-
case 'conversation.older':
|
|
49
|
-
return md.conversation.older(input[0]);
|
|
50
|
-
case 'conversation.compose':
|
|
51
|
-
return md.conversation.compose(input[0], input[1]);
|
|
52
|
-
case 'conversation.discard':
|
|
53
|
-
return md.conversation.discard(input[0]);
|
|
43
|
+
return md.conversation.read(input[0], input[1]);
|
|
54
44
|
case 'conversation.create':
|
|
55
45
|
return md.conversation.create(input[0]);
|
|
56
46
|
case 'conversation.send':
|
|
@@ -65,112 +55,100 @@ function answered(md, app, member, input) {
|
|
|
65
55
|
return md.conversation.cancel(input[0], input[1]);
|
|
66
56
|
case 'conversation.delete':
|
|
67
57
|
return md.conversation.delete(input[0]);
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
case 'rooms':
|
|
73
|
-
return md.observe('rooms', deliver);
|
|
74
|
-
case 'connection-refusal':
|
|
75
|
-
return md.observe('connection-refusal', deliver);
|
|
76
|
-
case 'storage-loss':
|
|
77
|
-
return md.observe('storage-loss', deliver);
|
|
78
|
-
case 'sync-status':
|
|
79
|
-
return md.observe('sync-status', deliver);
|
|
80
|
-
case 'drafts':
|
|
81
|
-
return md.observe('drafts', deliver);
|
|
82
|
-
case 'queue':
|
|
83
|
-
return md.observe('queue', input[0], deliver);
|
|
84
|
-
case 'query':
|
|
85
|
-
return md.observe('query', input[0], deliver);
|
|
86
|
-
case 'presentation':
|
|
87
|
-
return md.observe('presentation', app, deliver);
|
|
88
|
-
case 'conversation':
|
|
89
|
-
return md.observe('conversation', input[0], deliver);
|
|
58
|
+
case 'chatDraft.write':
|
|
59
|
+
return md.chatDraft.write(input[0], input[1]);
|
|
60
|
+
case 'chatDraft.discard':
|
|
61
|
+
return md.chatDraft.discard(input[0]);
|
|
90
62
|
}
|
|
91
63
|
}
|
|
92
64
|
export function serveMdRuntime(options) {
|
|
93
|
-
const
|
|
94
|
-
const
|
|
95
|
-
|
|
65
|
+
const deploymentFacts = structuredClone(options.deploymentFacts);
|
|
66
|
+
const closing = new AbortController();
|
|
67
|
+
const close = () => {
|
|
68
|
+
closing.abort();
|
|
96
69
|
};
|
|
97
|
-
options.signal?.addEventListener('abort',
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
const md =
|
|
102
|
-
...options,
|
|
103
|
-
signal: stopping.signal
|
|
104
|
-
});
|
|
70
|
+
options.signal?.addEventListener('abort', close, { once: true });
|
|
71
|
+
if (options.signal?.aborted === true)
|
|
72
|
+
close();
|
|
73
|
+
const runtime = composeRuntime({ ...options, signal: closing.signal });
|
|
74
|
+
const { md, watch } = runtime;
|
|
105
75
|
const attachments = new Map();
|
|
106
76
|
let authorized = true;
|
|
107
|
-
|
|
108
|
-
|
|
77
|
+
const watchFacts = (deliver) => {
|
|
78
|
+
deliver(structuredClone(deploymentFacts));
|
|
79
|
+
return () => { };
|
|
80
|
+
};
|
|
81
|
+
function attach(port, app, release) {
|
|
82
|
+
if (!authorized)
|
|
83
|
+
throw new Error(AUTHORIZATION_ENDED);
|
|
84
|
+
const writtenBy = release === undefined ? undefined : { app, release };
|
|
109
85
|
const subscriptions = new Map();
|
|
110
86
|
let serving = true;
|
|
111
|
-
const send = (message)=>{
|
|
87
|
+
const send = (message) => {
|
|
112
88
|
port.postMessage(envelope(message));
|
|
113
89
|
};
|
|
114
|
-
const detach = ()=>{
|
|
115
|
-
if (!serving)
|
|
90
|
+
const detach = () => {
|
|
91
|
+
if (!serving)
|
|
92
|
+
return;
|
|
116
93
|
serving = false;
|
|
117
|
-
for (const end of subscriptions.values())
|
|
94
|
+
for (const end of subscriptions.values())
|
|
95
|
+
end();
|
|
118
96
|
subscriptions.clear();
|
|
119
97
|
attachments.delete(detach);
|
|
120
98
|
};
|
|
121
|
-
const serve = async (message)=>{
|
|
122
|
-
if (message.kind === 'hello')
|
|
99
|
+
const serve = async (message) => {
|
|
100
|
+
if (message.kind === 'hello')
|
|
101
|
+
return;
|
|
123
102
|
if (message.kind === 'stop') {
|
|
124
103
|
subscriptions.get(message.id)?.();
|
|
125
104
|
subscriptions.delete(message.id);
|
|
126
105
|
return;
|
|
127
106
|
}
|
|
128
107
|
try {
|
|
108
|
+
if (message.kind !== 'observe' || message.topic !== 'room-drafts')
|
|
109
|
+
await md.loaded();
|
|
129
110
|
if (message.kind === 'observe') {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
});
|
|
111
|
+
const { id, topic } = message;
|
|
112
|
+
let resolved = false;
|
|
113
|
+
const deliver = (value) => {
|
|
114
|
+
if (!serving)
|
|
115
|
+
return;
|
|
116
|
+
send(resolved ? { kind: 'event', id, value } : { kind: 'result', id, value });
|
|
117
|
+
resolved = true;
|
|
118
|
+
};
|
|
119
|
+
subscriptions.set(id, topic === 'deployment-facts'
|
|
120
|
+
? watchFacts(deliver)
|
|
121
|
+
: watch(topic, topic === 'presentation' ? [app] : message.input, deliver));
|
|
142
122
|
return;
|
|
143
123
|
}
|
|
144
|
-
const value = await answered(md, app, message.member, message.input);
|
|
145
|
-
if (serving)
|
|
146
|
-
kind: 'result',
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
});
|
|
150
|
-
} catch (error) {
|
|
124
|
+
const value = await answered(md, app, writtenBy, message.member, message.input);
|
|
125
|
+
if (serving)
|
|
126
|
+
send({ kind: 'result', id: message.id, value });
|
|
127
|
+
}
|
|
128
|
+
catch (error) {
|
|
151
129
|
if (serving) {
|
|
152
130
|
send({
|
|
153
131
|
kind: 'failure',
|
|
154
132
|
id: message.id,
|
|
155
|
-
message: error instanceof Error ? error.message : String(error)
|
|
133
|
+
message: error instanceof Error ? error.message : String(error),
|
|
156
134
|
});
|
|
157
135
|
}
|
|
158
136
|
}
|
|
159
137
|
};
|
|
160
|
-
port.addEventListener('message', (event)=>{
|
|
161
|
-
if (!serving)
|
|
138
|
+
port.addEventListener('message', (event) => {
|
|
139
|
+
if (!serving)
|
|
140
|
+
return;
|
|
162
141
|
const wire = carried(event.data);
|
|
163
|
-
if (wire === null)
|
|
142
|
+
if (wire === null)
|
|
143
|
+
return;
|
|
164
144
|
if (!wire.matching) {
|
|
165
|
-
send({
|
|
166
|
-
kind: 'refusal',
|
|
167
|
-
refusal: PROTOCOL_MISMATCH
|
|
168
|
-
});
|
|
145
|
+
send({ kind: 'refusal', refusal: PROTOCOL_MISMATCH });
|
|
169
146
|
detach();
|
|
170
147
|
return;
|
|
171
148
|
}
|
|
172
149
|
const message = request(wire.message);
|
|
173
|
-
if (message === null)
|
|
150
|
+
if (message === null)
|
|
151
|
+
return;
|
|
174
152
|
void serve(message);
|
|
175
153
|
});
|
|
176
154
|
port.addEventListener('close', detach);
|
|
@@ -180,21 +158,18 @@ export function serveMdRuntime(options) {
|
|
|
180
158
|
}
|
|
181
159
|
return {
|
|
182
160
|
attach,
|
|
183
|
-
async endAuthorization
|
|
161
|
+
async endAuthorization() {
|
|
184
162
|
authorized = false;
|
|
185
|
-
for (const [detach, send] of [
|
|
186
|
-
|
|
187
|
-
]){
|
|
188
|
-
send({
|
|
189
|
-
kind: 'ended'
|
|
190
|
-
});
|
|
163
|
+
for (const [detach, send] of [...attachments]) {
|
|
164
|
+
send({ kind: 'ended' });
|
|
191
165
|
detach();
|
|
192
166
|
}
|
|
193
|
-
|
|
167
|
+
close();
|
|
194
168
|
await removeRuntimeStore();
|
|
195
169
|
await options.shell.dropGeneration();
|
|
196
|
-
}
|
|
170
|
+
},
|
|
171
|
+
stop() {
|
|
172
|
+
return runtime.stop();
|
|
173
|
+
},
|
|
197
174
|
};
|
|
198
175
|
}
|
|
199
|
-
|
|
200
|
-
//# sourceMappingURL=host.js.map
|
package/dist/identity.d.ts
CHANGED
package/dist/identity.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../src/identity.ts"],"names":[],"mappings":"AAAA,wBAAgB,mBAAmB,CAAC,EAAE,GAAE,MAAmB,GAAG,MAAM,CAWnE"}
|
|
1
|
+
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../src/identity.ts"],"names":[],"mappings":"AAAA,wBAAgB,mBAAmB,CAAC,EAAE,GAAE,MAAmB,GAAG,MAAM,CAWnE;AAED,wBAAgB,iBAAiB,IAAI,MAAM,CAI1C"}
|
package/dist/identity.js
CHANGED
|
@@ -2,15 +2,16 @@ export function changeBatchIdentity(at = Date.now()) {
|
|
|
2
2
|
const bytes = new Uint8Array(16);
|
|
3
3
|
crypto.getRandomValues(bytes);
|
|
4
4
|
const time = BigInt(at);
|
|
5
|
-
for(let index = 0; index < 6; index += 1){
|
|
6
|
-
bytes[index] = Number(time >> BigInt(8 * (5 - index)) & 0xffn);
|
|
5
|
+
for (let index = 0; index < 6; index += 1) {
|
|
6
|
+
bytes[index] = Number((time >> BigInt(8 * (5 - index))) & 0xffn);
|
|
7
7
|
}
|
|
8
|
-
bytes[6] = bytes[6] & 0x0f | 0x70;
|
|
9
|
-
bytes[8] = bytes[8] & 0x3f | 0x80;
|
|
10
|
-
const hex = [
|
|
11
|
-
...bytes
|
|
12
|
-
].map((byte)=>byte.toString(16).padStart(2, '0')).join('');
|
|
8
|
+
bytes[6] = (bytes[6] & 0x0f) | 0x70;
|
|
9
|
+
bytes[8] = (bytes[8] & 0x3f) | 0x80;
|
|
10
|
+
const hex = [...bytes].map((byte) => byte.toString(16).padStart(2, '0')).join('');
|
|
13
11
|
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
|
14
12
|
}
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
export function roomDraftRevision() {
|
|
14
|
+
const bytes = new Uint8Array(16);
|
|
15
|
+
crypto.getRandomValues(bytes);
|
|
16
|
+
return [...bytes].map((byte) => byte.toString(16).padStart(2, '0')).join('');
|
|
17
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
export type { ActionDeclaration, ActionRequest, ActionResult, Adapter, AdapterFailure, Authorization, BootstrapPage, BootstrapRequest, BootstrapResult, Capability, ContractUnavailable, ConversationAction, ConversationCards, ConversationEvent, ConversationMessage, DiscoverResult, DiscoveredRoom, Discovery, HistoryRequest, HistoryResult, HistoryRetention, HistoryRevision, MdModelIdentity, ModelRequest, MutationRequest, MutationResult, PageToken, ProviderLimit, ProviderRefusal, RefreshPage, RefreshRequest, RefreshResult, Retention, RetryableRefusal, RevokedAuthorization, RoomNotReadable, RoomVersionNotification, SelectedRooms, TransportUncertainty, TypedSelection,
|
|
2
|
-
export type { Change, ChangeBatch, Precondition } from './change.js';
|
|
3
|
-
export type { ConversationEntry, ConversationSurface, ConversationView, GrowingText,
|
|
4
|
-
export type {
|
|
5
|
-
export type {
|
|
6
|
-
export type {
|
|
7
|
-
export type {
|
|
1
|
+
export type { AcceptedMessage, ActionDeclaration, ActionRequest, ActionResult, Adapter, AdapterFailure, Authorization, BootstrapPage, BootstrapRequest, BootstrapResult, Capability, ChangeAuthor, ContractUnavailable, ConversationAction, ConversationCards, ConversationEvent, ConversationHistories, ConversationHistoryPage, ConversationHistoryRequest, ConversationMessage, ConversationStream, DiscoverResult, DiscoveredRoom, Discovery, HistoryAuthor, HistoryRequest, HistoryResult, HistoryRetention, HistoryRevision, MdModelIdentity, ModelRequest, MutationRequest, MutationResult, PageToken, ProviderLimit, ProviderRefusal, RefreshPage, RefreshRequest, RefreshResult, Retention, RetryableRefusal, RevokedAuthorization, RoomAttachment, RoomNotReadable, RoomVersionAt, RoomVersionNotification, SelectedRooms, ServiceMode, ServiceModeSignal, TransportUncertainty, TypedSelection, WorkingNote, } from './adapter.js';
|
|
2
|
+
export type { Change, ChangeBatch, Precondition, WrittenBy } from './change.js';
|
|
3
|
+
export type { ChatDraft, ChatDraftSurface, ConversationEntry, ConversationOptions, ConversationSurface, ConversationView, GrowingText, } from './conversation.js';
|
|
4
|
+
export type { ChatDraftFile, FileDeclaration } from './file.js';
|
|
5
|
+
export type { AppRoom, AppTypedSelection, ConnectionRefusal, ConnectionRefusalReason, HistoryQuery, MdRuntime, MdRuntimeOptions, PresentationSurface, RoomDraftSurface, RoomTypes, SavedRoomDraft, SaveResult, } from './connection.js';
|
|
6
|
+
export type { Observation } from './observation.js';
|
|
7
|
+
export type { CallResult, QueueEntry, Submission } from './outcome.js';
|
|
8
|
+
export type { ChangedPart, FieldValue, ReturnReason, RoomDraft, RoomDraftCreation, RoomDraftParts, RoomDraftWrite, } from './room-draft.js';
|
|
8
9
|
export type { SaveRefusal } from './save.js';
|
|
9
|
-
export {
|
|
10
|
+
export type { DocumentHit, DocumentPart, MessageHit, SearchRequest, SearchResult, } from './search.js';
|
|
11
|
+
export { changeBatchIdentity } from './identity.js';
|
|
10
12
|
export type { RuntimeShell } from './durability.js';
|
|
11
13
|
export type { AttentionEntry, SyncStatus } from './status.js';
|
|
12
|
-
export type { Backlink, QueryDocument, QueryGroup,
|
|
13
|
-
export type {
|
|
14
|
+
export type { Backlink, Direction, DocumentQuery, DocumentResult, Filter, GroupQuery, GroupResult, Key, LocalQuery, OrderOptions, Predicate, QueryDocument, QueryGroup, QueryResult, Related, Select, Value, Where, } from './query.js';
|
|
15
|
+
export type { MdType, ModelIdentity, ModelSnapshot, ModelState, ModelResult, TypesResult, ValidationReceipt, } from './model.js';
|
|
14
16
|
export type { OperationScopes, ReplicaAdmission, ScopedRefusal } from './adapter.js';
|
|
15
|
-
export type { QueryBinding, QueryInput } from './query.js';
|
|
16
17
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,OAAO,EACP,cAAc,EACd,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,UAAU,EACV,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,SAAS,EACT,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,YAAY,EACZ,eAAe,EACf,cAAc,EACd,SAAS,EACT,aAAa,EACb,eAAe,EACf,WAAW,EACX,cAAc,EACd,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,EACf,uBAAuB,EACvB,aAAa,EACb,oBAAoB,EACpB,cAAc,EACd,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,OAAO,EACP,cAAc,EACd,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,uBAAuB,EACvB,0BAA0B,EAC1B,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,SAAS,EACT,aAAa,EACb,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,YAAY,EACZ,eAAe,EACf,cAAc,EACd,SAAS,EACT,aAAa,EACb,eAAe,EACf,WAAW,EACX,cAAc,EACd,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,oBAAoB,EACpB,cAAc,EACd,eAAe,EACf,aAAa,EACb,uBAAuB,EACvB,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,oBAAoB,EACpB,cAAc,EACd,WAAW,GACZ,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAChF,YAAY,EACV,SAAS,EACT,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,GACZ,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAChE,YAAY,EACV,OAAO,EACP,iBAAiB,EACjB,iBAAiB,EACjB,uBAAuB,EACvB,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EAChB,SAAS,EACT,cAAc,EACd,UAAU,GACX,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACvE,YAAY,EACV,WAAW,EACX,UAAU,EACV,YAAY,EACZ,SAAS,EACT,iBAAiB,EACjB,cAAc,EACd,cAAc,GACf,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,YAAY,EACV,WAAW,EACX,YAAY,EACZ,UAAU,EACV,aAAa,EACb,YAAY,GACb,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9D,YAAY,EACV,QAAQ,EACR,SAAS,EACT,aAAa,EACb,cAAc,EACd,MAAM,EACN,UAAU,EACV,WAAW,EACX,GAAG,EACH,UAAU,EACV,YAAY,EACZ,SAAS,EACT,aAAa,EACb,UAAU,EACV,WAAW,EACX,OAAO,EACP,MAAM,EACN,KAAK,EACL,KAAK,GACN,MAAM,YAAY,CAAC;AAEpB,YAAY,EACV,MAAM,EACN,aAAa,EACb,aAAa,EACb,UAAU,EACV,WAAW,EACX,WAAW,EACX,iBAAiB,GAClB,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/log.js
CHANGED
|
@@ -2,14 +2,13 @@ const BOUND = 256;
|
|
|
2
2
|
export function createLog() {
|
|
3
3
|
const events = [];
|
|
4
4
|
return {
|
|
5
|
-
record
|
|
5
|
+
record(event) {
|
|
6
6
|
events.push(event);
|
|
7
|
-
if (events.length > BOUND)
|
|
7
|
+
if (events.length > BOUND)
|
|
8
|
+
events.splice(0, events.length - BOUND);
|
|
8
9
|
},
|
|
9
|
-
export
|
|
10
|
+
export() {
|
|
10
11
|
return events.join('\n');
|
|
11
|
-
}
|
|
12
|
+
},
|
|
12
13
|
};
|
|
13
14
|
}
|
|
14
|
-
|
|
15
|
-
//# sourceMappingURL=log.js.map
|