@ifc-lite/collab 0.2.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/LICENSE +373 -0
- package/README.md +92 -0
- package/dist/awareness/agent.d.ts +36 -0
- package/dist/awareness/agent.d.ts.map +1 -0
- package/dist/awareness/agent.js +39 -0
- package/dist/awareness/agent.js.map +1 -0
- package/dist/awareness/color.d.ts +31 -0
- package/dist/awareness/color.d.ts.map +1 -0
- package/dist/awareness/color.js +61 -0
- package/dist/awareness/color.js.map +1 -0
- package/dist/awareness/index.d.ts +6 -0
- package/dist/awareness/index.d.ts.map +1 -0
- package/dist/awareness/index.js +9 -0
- package/dist/awareness/index.js.map +1 -0
- package/dist/awareness/overlay.d.ts +59 -0
- package/dist/awareness/overlay.d.ts.map +1 -0
- package/dist/awareness/overlay.js +110 -0
- package/dist/awareness/overlay.js.map +1 -0
- package/dist/awareness/presence.d.ts +95 -0
- package/dist/awareness/presence.d.ts.map +1 -0
- package/dist/awareness/presence.js +114 -0
- package/dist/awareness/presence.js.map +1 -0
- package/dist/awareness/render.d.ts +58 -0
- package/dist/awareness/render.d.ts.map +1 -0
- package/dist/awareness/render.js +66 -0
- package/dist/awareness/render.js.map +1 -0
- package/dist/branch/branch-tree.d.ts +40 -0
- package/dist/branch/branch-tree.d.ts.map +1 -0
- package/dist/branch/branch-tree.js +66 -0
- package/dist/branch/branch-tree.js.map +1 -0
- package/dist/branch/branch.d.ts +44 -0
- package/dist/branch/branch.d.ts.map +1 -0
- package/dist/branch/branch.js +109 -0
- package/dist/branch/branch.js.map +1 -0
- package/dist/branch/history-automerge.d.ts +31 -0
- package/dist/branch/history-automerge.d.ts.map +1 -0
- package/dist/branch/history-automerge.js +237 -0
- package/dist/branch/history-automerge.js.map +1 -0
- package/dist/branch/history.d.ts +147 -0
- package/dist/branch/history.d.ts.map +1 -0
- package/dist/branch/history.js +223 -0
- package/dist/branch/history.js.map +1 -0
- package/dist/branch/index.d.ts +5 -0
- package/dist/branch/index.d.ts.map +1 -0
- package/dist/branch/index.js +8 -0
- package/dist/branch/index.js.map +1 -0
- package/dist/conflicts/detector.d.ts +52 -0
- package/dist/conflicts/detector.d.ts.map +1 -0
- package/dist/conflicts/detector.js +226 -0
- package/dist/conflicts/detector.js.map +1 -0
- package/dist/conflicts/index.d.ts +3 -0
- package/dist/conflicts/index.d.ts.map +1 -0
- package/dist/conflicts/index.js +6 -0
- package/dist/conflicts/index.js.map +1 -0
- package/dist/conflicts/ui-bridge.d.ts +80 -0
- package/dist/conflicts/ui-bridge.d.ts.map +1 -0
- package/dist/conflicts/ui-bridge.js +126 -0
- package/dist/conflicts/ui-bridge.js.map +1 -0
- package/dist/doc/entity.d.ts +84 -0
- package/dist/doc/entity.d.ts.map +1 -0
- package/dist/doc/entity.js +345 -0
- package/dist/doc/entity.js.map +1 -0
- package/dist/doc/geometry.d.ts +39 -0
- package/dist/doc/geometry.d.ts.map +1 -0
- package/dist/doc/geometry.js +99 -0
- package/dist/doc/geometry.js.map +1 -0
- package/dist/doc/index.d.ts +8 -0
- package/dist/doc/index.d.ts.map +1 -0
- package/dist/doc/index.js +11 -0
- package/dist/doc/index.js.map +1 -0
- package/dist/doc/migration-ifc4-to-ifc4x3.d.ts +21 -0
- package/dist/doc/migration-ifc4-to-ifc4x3.d.ts.map +1 -0
- package/dist/doc/migration-ifc4-to-ifc4x3.js +55 -0
- package/dist/doc/migration-ifc4-to-ifc4x3.js.map +1 -0
- package/dist/doc/relationship.d.ts +27 -0
- package/dist/doc/relationship.d.ts.map +1 -0
- package/dist/doc/relationship.js +110 -0
- package/dist/doc/relationship.js.map +1 -0
- package/dist/doc/schema-version.d.ts +47 -0
- package/dist/doc/schema-version.d.ts.map +1 -0
- package/dist/doc/schema-version.js +41 -0
- package/dist/doc/schema-version.js.map +1 -0
- package/dist/doc/schema.d.ts +131 -0
- package/dist/doc/schema.d.ts.map +1 -0
- package/dist/doc/schema.js +117 -0
- package/dist/doc/schema.js.map +1 -0
- package/dist/doc/units.d.ts +45 -0
- package/dist/doc/units.d.ts.map +1 -0
- package/dist/doc/units.js +120 -0
- package/dist/doc/units.js.map +1 -0
- package/dist/federation/bridge.d.ts +34 -0
- package/dist/federation/bridge.d.ts.map +1 -0
- package/dist/federation/bridge.js +52 -0
- package/dist/federation/bridge.js.map +1 -0
- package/dist/federation/index.d.ts +4 -0
- package/dist/federation/index.d.ts.map +1 -0
- package/dist/federation/index.js +7 -0
- package/dist/federation/index.js.map +1 -0
- package/dist/federation/resolver.d.ts +58 -0
- package/dist/federation/resolver.d.ts.map +1 -0
- package/dist/federation/resolver.js +43 -0
- package/dist/federation/resolver.js.map +1 -0
- package/dist/federation/session.d.ts +79 -0
- package/dist/federation/session.d.ts.map +1 -0
- package/dist/federation/session.js +126 -0
- package/dist/federation/session.js.map +1 -0
- package/dist/geometry/blob-store.d.ts +106 -0
- package/dist/geometry/blob-store.d.ts.map +1 -0
- package/dist/geometry/blob-store.js +266 -0
- package/dist/geometry/blob-store.js.map +1 -0
- package/dist/geometry/csg.d.ts +63 -0
- package/dist/geometry/csg.d.ts.map +1 -0
- package/dist/geometry/csg.js +101 -0
- package/dist/geometry/csg.js.map +1 -0
- package/dist/geometry/determinism.d.ts +45 -0
- package/dist/geometry/determinism.d.ts.map +1 -0
- package/dist/geometry/determinism.js +92 -0
- package/dist/geometry/determinism.js.map +1 -0
- package/dist/geometry/gc.d.ts +63 -0
- package/dist/geometry/gc.d.ts.map +1 -0
- package/dist/geometry/gc.js +109 -0
- package/dist/geometry/gc.js.map +1 -0
- package/dist/geometry/index.d.ts +6 -0
- package/dist/geometry/index.d.ts.map +1 -0
- package/dist/geometry/index.js +9 -0
- package/dist/geometry/index.js.map +1 -0
- package/dist/geometry/parametric.d.ts +92 -0
- package/dist/geometry/parametric.d.ts.map +1 -0
- package/dist/geometry/parametric.js +200 -0
- package/dist/geometry/parametric.js.map +1 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +46 -0
- package/dist/index.js.map +1 -0
- package/dist/mutations/bind.d.ts +56 -0
- package/dist/mutations/bind.d.ts.map +1 -0
- package/dist/mutations/bind.js +68 -0
- package/dist/mutations/bind.js.map +1 -0
- package/dist/mutations/index.d.ts +2 -0
- package/dist/mutations/index.d.ts.map +1 -0
- package/dist/mutations/index.js +5 -0
- package/dist/mutations/index.js.map +1 -0
- package/dist/perf/benchmark.d.ts +25 -0
- package/dist/perf/benchmark.d.ts.map +1 -0
- package/dist/perf/benchmark.js +97 -0
- package/dist/perf/benchmark.js.map +1 -0
- package/dist/perf/index.d.ts +3 -0
- package/dist/perf/index.d.ts.map +1 -0
- package/dist/perf/index.js +6 -0
- package/dist/perf/index.js.map +1 -0
- package/dist/perf/latency.d.ts +39 -0
- package/dist/perf/latency.d.ts.map +1 -0
- package/dist/perf/latency.js +79 -0
- package/dist/perf/latency.js.map +1 -0
- package/dist/privacy.d.ts +45 -0
- package/dist/privacy.d.ts.map +1 -0
- package/dist/privacy.js +66 -0
- package/dist/privacy.js.map +1 -0
- package/dist/providers/indexeddb.d.ts +37 -0
- package/dist/providers/indexeddb.d.ts.map +1 -0
- package/dist/providers/indexeddb.js +45 -0
- package/dist/providers/indexeddb.js.map +1 -0
- package/dist/providers/webrtc.d.ts +40 -0
- package/dist/providers/webrtc.d.ts.map +1 -0
- package/dist/providers/webrtc.js +81 -0
- package/dist/providers/webrtc.js.map +1 -0
- package/dist/providers/websocket.d.ts +45 -0
- package/dist/providers/websocket.d.ts.map +1 -0
- package/dist/providers/websocket.js +56 -0
- package/dist/providers/websocket.js.map +1 -0
- package/dist/security/e2e.d.ts +54 -0
- package/dist/security/e2e.d.ts.map +1 -0
- package/dist/security/e2e.js +147 -0
- package/dist/security/e2e.js.map +1 -0
- package/dist/security/index.d.ts +2 -0
- package/dist/security/index.d.ts.map +1 -0
- package/dist/security/index.js +5 -0
- package/dist/security/index.js.map +1 -0
- package/dist/session.d.ts +79 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +112 -0
- package/dist/session.js.map +1 -0
- package/dist/snapshot/from-ifcx.d.ts +24 -0
- package/dist/snapshot/from-ifcx.d.ts.map +1 -0
- package/dist/snapshot/from-ifcx.js +93 -0
- package/dist/snapshot/from-ifcx.js.map +1 -0
- package/dist/snapshot/index.d.ts +6 -0
- package/dist/snapshot/index.d.ts.map +1 -0
- package/dist/snapshot/index.js +9 -0
- package/dist/snapshot/index.js.map +1 -0
- package/dist/snapshot/layers.d.ts +56 -0
- package/dist/snapshot/layers.d.ts.map +1 -0
- package/dist/snapshot/layers.js +82 -0
- package/dist/snapshot/layers.js.map +1 -0
- package/dist/snapshot/minimal-layer.d.ts +40 -0
- package/dist/snapshot/minimal-layer.d.ts.map +1 -0
- package/dist/snapshot/minimal-layer.js +123 -0
- package/dist/snapshot/minimal-layer.js.map +1 -0
- package/dist/snapshot/to-ifcx.d.ts +26 -0
- package/dist/snapshot/to-ifcx.d.ts.map +1 -0
- package/dist/snapshot/to-ifcx.js +54 -0
- package/dist/snapshot/to-ifcx.js.map +1 -0
- package/dist/snapshot/worker.d.ts +45 -0
- package/dist/snapshot/worker.d.ts.map +1 -0
- package/dist/snapshot/worker.js +73 -0
- package/dist/snapshot/worker.js.map +1 -0
- package/dist/sync/room.d.ts +15 -0
- package/dist/sync/room.d.ts.map +1 -0
- package/dist/sync/room.js +20 -0
- package/dist/sync/room.js.map +1 -0
- package/dist/undo.d.ts +25 -0
- package/dist/undo.d.ts.map +1 -0
- package/dist/undo.js +37 -0
- package/dist/undo.js.map +1 -0
- package/dist/viewer-bridge.d.ts +27 -0
- package/dist/viewer-bridge.d.ts.map +1 -0
- package/dist/viewer-bridge.js +82 -0
- package/dist/viewer-bridge.js.map +1 -0
- package/package.json +83 -0
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
/**
|
|
5
|
+
* Build a mesh from `(source, params)`. Throws if the source is not
|
|
6
|
+
* recognized — the conflict detector / kernel hookup should fall back
|
|
7
|
+
* to mesh-blob upload in that case.
|
|
8
|
+
*/
|
|
9
|
+
export function paramsToMesh(source, params) {
|
|
10
|
+
switch (source) {
|
|
11
|
+
case 'extruded-area-solid':
|
|
12
|
+
return extrudedAreaSolid(params);
|
|
13
|
+
case 'box':
|
|
14
|
+
return box(params);
|
|
15
|
+
case 'cylinder':
|
|
16
|
+
return cylinder(params);
|
|
17
|
+
case 'revolved-area-solid':
|
|
18
|
+
return revolvedAreaSolid(params);
|
|
19
|
+
default:
|
|
20
|
+
throw new Error(`@ifc-lite/collab: unknown parametric source "${source}"`);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/* ------------------------------------------------------------------ */
|
|
24
|
+
/* extruded-area-solid */
|
|
25
|
+
/* ------------------------------------------------------------------ */
|
|
26
|
+
export function extrudedAreaSolid(params) {
|
|
27
|
+
const dir = params.direction ?? [0, 0, 1];
|
|
28
|
+
const depth = params.depth;
|
|
29
|
+
const profilePts = profilePoints(params.profile);
|
|
30
|
+
const N = profilePts.length;
|
|
31
|
+
const positions = new Float32Array(N * 2 * 3);
|
|
32
|
+
for (let i = 0; i < N; i++) {
|
|
33
|
+
positions[i * 3 + 0] = profilePts[i][0];
|
|
34
|
+
positions[i * 3 + 1] = profilePts[i][1];
|
|
35
|
+
positions[i * 3 + 2] = 0;
|
|
36
|
+
}
|
|
37
|
+
for (let i = 0; i < N; i++) {
|
|
38
|
+
positions[(N + i) * 3 + 0] = profilePts[i][0] + dir[0] * depth;
|
|
39
|
+
positions[(N + i) * 3 + 1] = profilePts[i][1] + dir[1] * depth;
|
|
40
|
+
positions[(N + i) * 3 + 2] = profilePts[i][2] + dir[2] * depth;
|
|
41
|
+
}
|
|
42
|
+
// Triangulate as (bottom-fan, top-fan, side strip).
|
|
43
|
+
const indices = [];
|
|
44
|
+
// Bottom fan (CW so normal faces -Z).
|
|
45
|
+
for (let i = 1; i < N - 1; i++) {
|
|
46
|
+
indices.push(0, i + 1, i);
|
|
47
|
+
}
|
|
48
|
+
// Top fan (CCW).
|
|
49
|
+
for (let i = 1; i < N - 1; i++) {
|
|
50
|
+
indices.push(N, N + i, N + i + 1);
|
|
51
|
+
}
|
|
52
|
+
// Side strip.
|
|
53
|
+
for (let i = 0; i < N; i++) {
|
|
54
|
+
const a = i;
|
|
55
|
+
const b = (i + 1) % N;
|
|
56
|
+
const aTop = N + a;
|
|
57
|
+
const bTop = N + b;
|
|
58
|
+
indices.push(a, b, bTop);
|
|
59
|
+
indices.push(a, bTop, aTop);
|
|
60
|
+
}
|
|
61
|
+
return { positions, indices: new Uint32Array(indices) };
|
|
62
|
+
}
|
|
63
|
+
function profilePoints(profile) {
|
|
64
|
+
if (profile.type === 'rectangle') {
|
|
65
|
+
const w = profile.width / 2;
|
|
66
|
+
const h = profile.height / 2;
|
|
67
|
+
return [
|
|
68
|
+
[-w, -h, 0],
|
|
69
|
+
[w, -h, 0],
|
|
70
|
+
[w, h, 0],
|
|
71
|
+
[-w, h, 0],
|
|
72
|
+
];
|
|
73
|
+
}
|
|
74
|
+
const segments = profile.segments ?? 16;
|
|
75
|
+
const pts = [];
|
|
76
|
+
for (let i = 0; i < segments; i++) {
|
|
77
|
+
const t = (i / segments) * Math.PI * 2;
|
|
78
|
+
pts.push([Math.cos(t) * profile.radius, Math.sin(t) * profile.radius, 0]);
|
|
79
|
+
}
|
|
80
|
+
return pts;
|
|
81
|
+
}
|
|
82
|
+
/* ------------------------------------------------------------------ */
|
|
83
|
+
/* box */
|
|
84
|
+
/* ------------------------------------------------------------------ */
|
|
85
|
+
export function box(params) {
|
|
86
|
+
return extrudedAreaSolid({
|
|
87
|
+
profile: { type: 'rectangle', width: params.length, height: params.width },
|
|
88
|
+
direction: [0, 0, 1],
|
|
89
|
+
depth: params.height,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
/* ------------------------------------------------------------------ */
|
|
93
|
+
/* cylinder */
|
|
94
|
+
/* ------------------------------------------------------------------ */
|
|
95
|
+
export function cylinder(params) {
|
|
96
|
+
return extrudedAreaSolid({
|
|
97
|
+
profile: { type: 'circle', radius: params.radius, segments: params.segments },
|
|
98
|
+
direction: [0, 0, 1],
|
|
99
|
+
depth: params.height,
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
/* ------------------------------------------------------------------ */
|
|
103
|
+
/* revolved-area-solid */
|
|
104
|
+
/* ------------------------------------------------------------------ */
|
|
105
|
+
export function revolvedAreaSolid(params) {
|
|
106
|
+
// The current implementation only revolves around the Z axis. Accepting
|
|
107
|
+
// a non-default `axis` and silently still using Z produces geometry the
|
|
108
|
+
// caller didn't ask for. Reject explicitly so misuse fails loudly until
|
|
109
|
+
// a general axis path is implemented.
|
|
110
|
+
if (params.axis) {
|
|
111
|
+
const [ax, ay, az] = params.axis;
|
|
112
|
+
const isZ = Math.abs(ax) < 1e-9 && Math.abs(ay) < 1e-9 && Math.abs(az - 1) < 1e-9;
|
|
113
|
+
if (!isZ) {
|
|
114
|
+
throw new Error(`@ifc-lite/collab: revolvedAreaSolid currently only supports axis [0, 0, 1], got [${ax}, ${ay}, ${az}]`);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
const angle = params.angle ?? Math.PI * 2;
|
|
118
|
+
const segments = params.segments ?? 16;
|
|
119
|
+
const r = params.profile.radius;
|
|
120
|
+
// We sweep a profile circle (in the YZ plane) around the Z axis.
|
|
121
|
+
const profileSegments = params.profile.segments ?? 16;
|
|
122
|
+
const profilePts = []; // (radius offset, height)
|
|
123
|
+
for (let i = 0; i < profileSegments; i++) {
|
|
124
|
+
const t = (i / profileSegments) * Math.PI * 2;
|
|
125
|
+
profilePts.push([Math.cos(t) * r + r * 1.5, Math.sin(t) * r]); // torus-ish
|
|
126
|
+
}
|
|
127
|
+
const ringCount = profilePts.length;
|
|
128
|
+
const sweepCount = segments + 1;
|
|
129
|
+
const positions = new Float32Array(ringCount * sweepCount * 3);
|
|
130
|
+
for (let s = 0; s < sweepCount; s++) {
|
|
131
|
+
const a = (s / segments) * angle;
|
|
132
|
+
const cos = Math.cos(a);
|
|
133
|
+
const sin = Math.sin(a);
|
|
134
|
+
for (let i = 0; i < ringCount; i++) {
|
|
135
|
+
const [pr, ph] = profilePts[i];
|
|
136
|
+
const idx = (s * ringCount + i) * 3;
|
|
137
|
+
positions[idx + 0] = cos * pr;
|
|
138
|
+
positions[idx + 1] = sin * pr;
|
|
139
|
+
positions[idx + 2] = ph;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
const indices = [];
|
|
143
|
+
for (let s = 0; s < segments; s++) {
|
|
144
|
+
for (let i = 0; i < ringCount; i++) {
|
|
145
|
+
const i2 = (i + 1) % ringCount;
|
|
146
|
+
const a = s * ringCount + i;
|
|
147
|
+
const b = s * ringCount + i2;
|
|
148
|
+
const c = (s + 1) * ringCount + i2;
|
|
149
|
+
const d = (s + 1) * ringCount + i;
|
|
150
|
+
indices.push(a, b, c);
|
|
151
|
+
indices.push(a, c, d);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return { positions, indices: new Uint32Array(indices) };
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Hash a mesh for determinism / cache-key purposes.
|
|
158
|
+
*
|
|
159
|
+
* 128-bit digest built by running FNV-1a four times in parallel with
|
|
160
|
+
* different IVs over a stable byte ordering of positions+indices.
|
|
161
|
+
* Returned as 32 hex chars. Position floats are quantized to 8 decimal
|
|
162
|
+
* places before hashing so trivial floating-point drift doesn't break
|
|
163
|
+
* cache lookups.
|
|
164
|
+
*
|
|
165
|
+
* Note: this is not a cryptographic hash — collision-resistance is
|
|
166
|
+
* "good enough for cache keys and drift detection," not "good enough
|
|
167
|
+
* for security." The previous implementation returned `.repeat(4)` of
|
|
168
|
+
* a single 32-bit digest, which looked 128-bit but had only 32 bits of
|
|
169
|
+
* entropy; the four-IV variant restores real width.
|
|
170
|
+
*/
|
|
171
|
+
export function hashMesh(mesh) {
|
|
172
|
+
const enc = new TextEncoder();
|
|
173
|
+
const buf = [];
|
|
174
|
+
buf.push(`p:${mesh.positions.length}`);
|
|
175
|
+
for (let i = 0; i < mesh.positions.length; i++) {
|
|
176
|
+
buf.push(mesh.positions[i].toFixed(8));
|
|
177
|
+
}
|
|
178
|
+
buf.push(`i:${mesh.indices.length}`);
|
|
179
|
+
for (let i = 0; i < mesh.indices.length; i++) {
|
|
180
|
+
buf.push(String(mesh.indices[i]));
|
|
181
|
+
}
|
|
182
|
+
const bytes = enc.encode(buf.join(','));
|
|
183
|
+
// Four 32-bit FNV-1a lanes with independent IVs derived from the
|
|
184
|
+
// canonical FNV offset basis. Each lane sees the same byte stream;
|
|
185
|
+
// their concatenated outputs give 128 bits of independent state.
|
|
186
|
+
const ivs = [0x811c9dc5, 0x84222325, 0xcbf29ce4, 0x100000001];
|
|
187
|
+
const lanes = ivs.map((iv) => iv >>> 0);
|
|
188
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
189
|
+
for (let l = 0; l < 4; l++) {
|
|
190
|
+
let h = lanes[l];
|
|
191
|
+
h ^= bytes[i];
|
|
192
|
+
h = (h + ((h << 1) + (h << 4) + (h << 7) + (h << 8) + (h << 24))) >>> 0;
|
|
193
|
+
lanes[l] = h;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
return lanes
|
|
197
|
+
.map((h) => (h >>> 0).toString(16).padStart(8, '0'))
|
|
198
|
+
.join('');
|
|
199
|
+
}
|
|
200
|
+
//# sourceMappingURL=parametric.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parametric.js","sourceRoot":"","sources":["../../src/geometry/parametric.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AA+E/D;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,MAAwB,EAAE,MAAe;IACpE,QAAQ,MAAM,EAAE,CAAC;QAC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*/
|
|
6
|
+
export * from './doc/schema.js';
|
|
7
|
+
export * from './doc/entity.js';
|
|
8
|
+
export * from './doc/relationship.js';
|
|
9
|
+
export * from './doc/geometry.js';
|
|
10
|
+
export * from './snapshot/index.js';
|
|
11
|
+
export { createIndexedDbProvider, createMemoryProvider, type IndexedDbProvider, type IndexedDbOptions, } from './providers/indexeddb.js';
|
|
12
|
+
export { createWebSocketProvider, type WebSocketProvider, type WebSocketProviderOptions, type WebSocketStatus, } from './providers/websocket.js';
|
|
13
|
+
export { createWebRtcProvider, type WebRtcProvider, type WebRtcProviderOptions, type WebRtcStatus, } from './providers/webrtc.js';
|
|
14
|
+
export * from './sync/room.js';
|
|
15
|
+
export * from './awareness/index.js';
|
|
16
|
+
export { createUndoManager, UNDO_ORIGIN, type UndoOptions, type UndoController } from './undo.js';
|
|
17
|
+
export * from './conflicts/index.js';
|
|
18
|
+
export * from './geometry/index.js';
|
|
19
|
+
export * from './federation/index.js';
|
|
20
|
+
export * from './branch/index.js';
|
|
21
|
+
export * from './mutations/index.js';
|
|
22
|
+
export * from './viewer-bridge.js';
|
|
23
|
+
export * from './privacy.js';
|
|
24
|
+
export * from './security/index.js';
|
|
25
|
+
export * from './perf/index.js';
|
|
26
|
+
export { createCollabSession, type CollabSession, type CollabSessionOptions, type ProviderKind, } from './session.js';
|
|
27
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AAGH,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAGlC,cAAc,qBAAqB,CAAC;AAGpC,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,GACtB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,uBAAuB,EACvB,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAC7B,KAAK,eAAe,GACrB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,oBAAoB,EACpB,KAAK,cAAc,EACnB,KAAK,qBAAqB,EAC1B,KAAK,YAAY,GAClB,MAAM,uBAAuB,CAAC;AAG/B,cAAc,gBAAgB,CAAC;AAG/B,cAAc,sBAAsB,CAAC;AAGrC,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,KAAK,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AAGlG,cAAc,sBAAsB,CAAC;AAGrC,cAAc,qBAAqB,CAAC;AAGpC,cAAc,uBAAuB,CAAC;AAGtC,cAAc,mBAAmB,CAAC;AAGlC,cAAc,sBAAsB,CAAC;AAGrC,cAAc,oBAAoB,CAAC;AAGnC,cAAc,cAAc,CAAC;AAG7B,cAAc,qBAAqB,CAAC;AAGpC,cAAc,iBAAiB,CAAC;AAGhC,OAAO,EACL,mBAAmB,EACnB,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,KAAK,YAAY,GAClB,MAAM,cAAc,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
/**
|
|
5
|
+
* @ifc-lite/collab — Real-time collaborative BIM via CRDT on IFCX.
|
|
6
|
+
*
|
|
7
|
+
* See `docs/architecture/collab-plan.md` for the v0.1 → v1.0 roadmap.
|
|
8
|
+
*/
|
|
9
|
+
// Doc model
|
|
10
|
+
export * from './doc/schema.js';
|
|
11
|
+
export * from './doc/entity.js';
|
|
12
|
+
export * from './doc/relationship.js';
|
|
13
|
+
export * from './doc/geometry.js';
|
|
14
|
+
// Snapshot / IFCX bridge
|
|
15
|
+
export * from './snapshot/index.js';
|
|
16
|
+
// Providers
|
|
17
|
+
export { createIndexedDbProvider, createMemoryProvider, } from './providers/indexeddb.js';
|
|
18
|
+
export { createWebSocketProvider, } from './providers/websocket.js';
|
|
19
|
+
export { createWebRtcProvider, } from './providers/webrtc.js';
|
|
20
|
+
// Sync helpers
|
|
21
|
+
export * from './sync/room.js';
|
|
22
|
+
// Awareness / presence
|
|
23
|
+
export * from './awareness/index.js';
|
|
24
|
+
// Undo / redo
|
|
25
|
+
export { createUndoManager, UNDO_ORIGIN } from './undo.js';
|
|
26
|
+
// Conflict detection
|
|
27
|
+
export * from './conflicts/index.js';
|
|
28
|
+
// Geometry: blob store + CSG-tree CRDT
|
|
29
|
+
export * from './geometry/index.js';
|
|
30
|
+
// Federation
|
|
31
|
+
export * from './federation/index.js';
|
|
32
|
+
// Branching (v0.7 starter)
|
|
33
|
+
export * from './branch/index.js';
|
|
34
|
+
// Mutations bridge (spec §16.3)
|
|
35
|
+
export * from './mutations/index.js';
|
|
36
|
+
// Viewer bridge (spec §7 viewer mounting)
|
|
37
|
+
export * from './viewer-bridge.js';
|
|
38
|
+
// Privacy / GDPR helpers (v1.0)
|
|
39
|
+
export * from './privacy.js';
|
|
40
|
+
// Security: E2E encryption helpers (v1.0)
|
|
41
|
+
export * from './security/index.js';
|
|
42
|
+
// Perf / benchmark helpers (v0.2)
|
|
43
|
+
export * from './perf/index.js';
|
|
44
|
+
// Top-level session façade
|
|
45
|
+
export { createCollabSession, } from './session.js';
|
|
46
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;GAIG;AAEH,YAAY;AACZ,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAElC,yBAAyB;AACzB,cAAc,qBAAqB,CAAC;AAEpC,YAAY;AACZ,OAAO,EACL,uBAAuB,EACvB,oBAAoB,GAGrB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,uBAAuB,GAIxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,oBAAoB,GAIrB,MAAM,uBAAuB,CAAC;AAE/B,eAAe;AACf,cAAc,gBAAgB,CAAC;AAE/B,uBAAuB;AACvB,cAAc,sBAAsB,CAAC;AAErC,cAAc;AACd,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAyC,MAAM,WAAW,CAAC;AAElG,qBAAqB;AACrB,cAAc,sBAAsB,CAAC;AAErC,uCAAuC;AACvC,cAAc,qBAAqB,CAAC;AAEpC,aAAa;AACb,cAAc,uBAAuB,CAAC;AAEtC,2BAA2B;AAC3B,cAAc,mBAAmB,CAAC;AAElC,gCAAgC;AAChC,cAAc,sBAAsB,CAAC;AAErC,0CAA0C;AAC1C,cAAc,oBAAoB,CAAC;AAEnC,gCAAgC;AAChC,cAAc,cAAc,CAAC;AAE7B,0CAA0C;AAC1C,cAAc,qBAAqB,CAAC;AAEpC,kCAAkC;AAClC,cAAc,iBAAiB,CAAC;AAEhC,2BAA2B;AAC3B,OAAO,EACL,mBAAmB,GAIpB,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mutations integration (spec §16.3).
|
|
3
|
+
*
|
|
4
|
+
* `@ifc-lite/mutations` ships `MutablePropertyView` for property-level
|
|
5
|
+
* editing in legacy STEP IFC code paths. The spec promises that when
|
|
6
|
+
* a collab session is bound, those mutations also broadcast through
|
|
7
|
+
* the Y.Doc — and when no session is bound, behaviour is unchanged.
|
|
8
|
+
*
|
|
9
|
+
* `bindMutationsToCollab(view, session, opts)` returns a thin wrapper
|
|
10
|
+
* around the view that calls the original method first (so all
|
|
11
|
+
* existing observers / change-set tracking still fire), then mirrors
|
|
12
|
+
* the same write to the bound `CollabSession`.
|
|
13
|
+
*
|
|
14
|
+
* The bridge needs a way to translate the numeric `entityId` used by
|
|
15
|
+
* the legacy view into the path-shaped identifier used by IFCX. Apps
|
|
16
|
+
* provide a `resolveEntity(id)` callback (typically backed by their
|
|
17
|
+
* `pathToId` / `idToPath` map from `@ifc-lite/ifcx`).
|
|
18
|
+
*/
|
|
19
|
+
import type { MutablePropertyView } from '@ifc-lite/mutations';
|
|
20
|
+
import { PropertyValueType } from '@ifc-lite/data';
|
|
21
|
+
import type { CollabSession } from '../session.js';
|
|
22
|
+
export interface BindMutationsOptions {
|
|
23
|
+
/**
|
|
24
|
+
* Translate a numeric `entityId` into the corresponding IFCX path.
|
|
25
|
+
* Returning `null` skips the CRDT mirror for this mutation (the
|
|
26
|
+
* local view still updates).
|
|
27
|
+
*/
|
|
28
|
+
resolveEntity: (entityId: number) => string | null;
|
|
29
|
+
/**
|
|
30
|
+
* Optional translation between the legacy `PropertyValueType` enum
|
|
31
|
+
* and the IFCX-shaped string we store in the Y.Doc. Defaults to
|
|
32
|
+
* `PROPERTY_TYPE_NAMES`.
|
|
33
|
+
*/
|
|
34
|
+
typeNameFor?: (vt: PropertyValueType) => string;
|
|
35
|
+
/**
|
|
36
|
+
* If true, only mirror writes when `session.provider !== 'memory'`.
|
|
37
|
+
* Useful when consumers want to share-bind only after the websocket
|
|
38
|
+
* upgrade has happened. Default false.
|
|
39
|
+
*/
|
|
40
|
+
onlyWhenConnected?: boolean;
|
|
41
|
+
}
|
|
42
|
+
export declare const PROPERTY_TYPE_NAMES: Record<PropertyValueType, string>;
|
|
43
|
+
export interface BoundPropertyView {
|
|
44
|
+
setProperty(entityId: number, psetName: string, propName: string, value: string | number | boolean, valueType?: PropertyValueType, unit?: string): unknown;
|
|
45
|
+
deleteProperty(entityId: number, psetName: string, propName: string): unknown;
|
|
46
|
+
/** Pass-through to the underlying view's read API. */
|
|
47
|
+
getPropertyValue(entityId: number, psetName: string, propName: string): unknown;
|
|
48
|
+
/** The wrapped MutablePropertyView for advanced use. */
|
|
49
|
+
readonly view: MutablePropertyView;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Wrap a `MutablePropertyView` so writes mirror to a bound
|
|
53
|
+
* `CollabSession`. Reads pass through.
|
|
54
|
+
*/
|
|
55
|
+
export declare function bindMutationsToCollab(view: MutablePropertyView, session: CollabSession, options: BindMutationsOptions): BoundPropertyView;
|
|
56
|
+
//# sourceMappingURL=bind.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bind.d.ts","sourceRoot":"","sources":["../../src/mutations/bind.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAA2C,MAAM,gBAAgB,CAAC;AAC5F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAOnD,MAAM,WAAW,oBAAoB;IACnC;;;;OAIG;IACH,aAAa,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;IACnD;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,EAAE,EAAE,iBAAiB,KAAK,MAAM,CAAC;IAChD;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,iBAAiB,EAAE,MAAM,CAYjE,CAAC;AAEF,MAAM,WAAW,iBAAiB;IAChC,WAAW,CACT,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,EAChC,SAAS,CAAC,EAAE,iBAAiB,EAC7B,IAAI,CAAC,EAAE,MAAM,GACZ,OAAO,CAAC;IACX,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;IAC9E,sDAAsD;IACtD,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;IAChF,wDAAwD;IACxD,QAAQ,CAAC,IAAI,EAAE,mBAAmB,CAAC;CACpC;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,mBAAmB,EACzB,OAAO,EAAE,aAAa,EACtB,OAAO,EAAE,oBAAoB,GAC5B,iBAAiB,CAoDnB"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
import { PropertyValueType } from '@ifc-lite/data';
|
|
5
|
+
import { deletePropertyValue, setPropertyValue, } from '../doc/entity.js';
|
|
6
|
+
export const PROPERTY_TYPE_NAMES = {
|
|
7
|
+
[PropertyValueType.String]: 'IfcText',
|
|
8
|
+
[PropertyValueType.Real]: 'IfcReal',
|
|
9
|
+
[PropertyValueType.Integer]: 'IfcInteger',
|
|
10
|
+
[PropertyValueType.Boolean]: 'IfcBoolean',
|
|
11
|
+
[PropertyValueType.Logical]: 'IfcLogical',
|
|
12
|
+
[PropertyValueType.Label]: 'IfcLabel',
|
|
13
|
+
[PropertyValueType.Identifier]: 'IfcIdentifier',
|
|
14
|
+
[PropertyValueType.Text]: 'IfcText',
|
|
15
|
+
[PropertyValueType.Enum]: 'IfcLabel',
|
|
16
|
+
[PropertyValueType.Reference]: 'IfcLabel',
|
|
17
|
+
[PropertyValueType.List]: 'IfcText',
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Wrap a `MutablePropertyView` so writes mirror to a bound
|
|
21
|
+
* `CollabSession`. Reads pass through.
|
|
22
|
+
*/
|
|
23
|
+
export function bindMutationsToCollab(view, session, options) {
|
|
24
|
+
const typeNameFor = options.typeNameFor ?? ((vt) => PROPERTY_TYPE_NAMES[vt] ?? 'IfcLabel');
|
|
25
|
+
const shouldMirror = () => {
|
|
26
|
+
if (!options.onlyWhenConnected)
|
|
27
|
+
return true;
|
|
28
|
+
return session.provider !== 'memory';
|
|
29
|
+
};
|
|
30
|
+
return {
|
|
31
|
+
view,
|
|
32
|
+
setProperty(entityId, psetName, propName, value, valueType = PropertyValueType.Label, unit) {
|
|
33
|
+
// `BoundPropertyView.setProperty` only exposes scalar values
|
|
34
|
+
// (string | number | boolean), which is a subset of
|
|
35
|
+
// `@ifc-lite/data`'s PropertyValue (which also allows null and
|
|
36
|
+
// recursive arrays). Widen explicitly to the upstream type
|
|
37
|
+
// rather than silencing the type checker with `as never`.
|
|
38
|
+
const result = view.setProperty(entityId, psetName, propName, value, valueType, unit);
|
|
39
|
+
if (shouldMirror()) {
|
|
40
|
+
const path = options.resolveEntity(entityId);
|
|
41
|
+
if (path) {
|
|
42
|
+
const pv = {
|
|
43
|
+
type: typeNameFor(valueType),
|
|
44
|
+
value: value,
|
|
45
|
+
unit,
|
|
46
|
+
source: 'mutation',
|
|
47
|
+
};
|
|
48
|
+
session.transact(() => setPropertyValue(session.doc, path, psetName, propName, pv));
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return result;
|
|
52
|
+
},
|
|
53
|
+
deleteProperty(entityId, psetName, propName) {
|
|
54
|
+
const result = view.deleteProperty(entityId, psetName, propName);
|
|
55
|
+
if (shouldMirror()) {
|
|
56
|
+
const path = options.resolveEntity(entityId);
|
|
57
|
+
if (path) {
|
|
58
|
+
session.transact(() => deletePropertyValue(session.doc, path, psetName, propName));
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return result;
|
|
62
|
+
},
|
|
63
|
+
getPropertyValue(entityId, psetName, propName) {
|
|
64
|
+
return view.getPropertyValue(entityId, psetName, propName);
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68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,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;gBACrF,CAAC;YACH,CAAC;YACD,OAAO,MAAM,CAAC;QAChB,CAAC;QACD,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ;YAC3C,OAAO,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAC7D,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mutations/index.ts"],"names":[],"mappings":"AAIA,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
export * from './bind.js';
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mutations/index.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface BenchmarkBudget {
|
|
2
|
+
/** Maximum Y.Doc state-vector size for 100k entities, bytes. */
|
|
3
|
+
maxStateBytes100k?: number;
|
|
4
|
+
/** Maximum single-attr update size, bytes. */
|
|
5
|
+
maxSingleAttrUpdateBytes?: number;
|
|
6
|
+
/** Maximum cold-load time for an N-entity IFCX, ms. */
|
|
7
|
+
maxColdLoadMs?: number;
|
|
8
|
+
/** Number of entities to use for the cold-load benchmark. */
|
|
9
|
+
coldLoadEntities?: number;
|
|
10
|
+
}
|
|
11
|
+
export declare const DEFAULT_BUDGET: Required<BenchmarkBudget>;
|
|
12
|
+
export interface BenchmarkResult {
|
|
13
|
+
name: string;
|
|
14
|
+
/** Measured value in the unit indicated by `unit`. */
|
|
15
|
+
value: number;
|
|
16
|
+
unit: 'bytes' | 'ms' | 'ops';
|
|
17
|
+
budget?: number;
|
|
18
|
+
ok: boolean;
|
|
19
|
+
}
|
|
20
|
+
/** Run all benchmarks and report each against the configured budget. */
|
|
21
|
+
export declare function runPerfBenchmarks(budget?: BenchmarkBudget): BenchmarkResult[];
|
|
22
|
+
export declare function measureSingleAttrUpdateBytes(budget: number): BenchmarkResult;
|
|
23
|
+
export declare function measureColdLoad(entityCount: number, budget: number): BenchmarkResult;
|
|
24
|
+
export declare function measureStateBytes(entityCount: number, budget: number): BenchmarkResult;
|
|
25
|
+
//# sourceMappingURL=benchmark.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"benchmark.d.ts","sourceRoot":"","sources":["../../src/perf/benchmark.ts"],"names":[],"mappings":"AA2BA,MAAM,WAAW,eAAe;IAC9B,gEAAgE;IAChE,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,8CAA8C;IAC9C,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,uDAAuD;IACvD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,6DAA6D;IAC7D,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,eAAe,CAKpD,CAAC;AAEF,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,sDAAsD;IACtD,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,OAAO,GAAG,IAAI,GAAG,KAAK,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,EAAE,EAAE,OAAO,CAAC;CACb;AAED,wEAAwE;AACxE,wBAAgB,iBAAiB,CAAC,MAAM,GAAE,eAAoB,GAAG,eAAe,EAAE,CAgBjF;AAED,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,MAAM,GAAG,eAAe,CAa5E;AAED,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,eAAe,CAsBpF;AAED,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,eAAe,CAetF"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
/**
|
|
5
|
+
* Performance benchmarks (spec §15).
|
|
6
|
+
*
|
|
7
|
+
* Self-contained Node-runnable benchmarks that produce numbers we
|
|
8
|
+
* compare against the §15 budget:
|
|
9
|
+
*
|
|
10
|
+
* - Y.Doc memory @100k entities < 200 MB
|
|
11
|
+
* - Single-attr update size < 200 B
|
|
12
|
+
* - Sync latency LAN < 50 ms
|
|
13
|
+
* - Cold load @100k < 3 s
|
|
14
|
+
* - Awareness update rate 30 Hz
|
|
15
|
+
*
|
|
16
|
+
* These are pure-JS estimates — they don't measure the real
|
|
17
|
+
* websocket or the disk subsystem; consumers wire those in via the
|
|
18
|
+
* `createLatencyChannel` simulator + their own perf harness.
|
|
19
|
+
*/
|
|
20
|
+
import * as Y from 'yjs';
|
|
21
|
+
import { createCollabDoc } from '../doc/schema.js';
|
|
22
|
+
import { createEntity, setAttribute } from '../doc/entity.js';
|
|
23
|
+
import { snapshotToIfcx } from '../snapshot/to-ifcx.js';
|
|
24
|
+
import { seedFromIfcx } from '../snapshot/from-ifcx.js';
|
|
25
|
+
export const DEFAULT_BUDGET = {
|
|
26
|
+
maxStateBytes100k: 200 * 1024 * 1024,
|
|
27
|
+
maxSingleAttrUpdateBytes: 200,
|
|
28
|
+
maxColdLoadMs: 3000,
|
|
29
|
+
coldLoadEntities: 1000,
|
|
30
|
+
};
|
|
31
|
+
/** Run all benchmarks and report each against the configured budget. */
|
|
32
|
+
export function runPerfBenchmarks(budget = {}) {
|
|
33
|
+
const cfg = { ...DEFAULT_BUDGET, ...budget };
|
|
34
|
+
const results = [];
|
|
35
|
+
// 1. Single-attr update size.
|
|
36
|
+
results.push(measureSingleAttrUpdateBytes(cfg.maxSingleAttrUpdateBytes));
|
|
37
|
+
// 2. Cold-load time for cfg.coldLoadEntities entities.
|
|
38
|
+
results.push(measureColdLoad(cfg.coldLoadEntities, cfg.maxColdLoadMs));
|
|
39
|
+
// 3. State-vector size at 100k entities — heavy, gated by env.
|
|
40
|
+
if (process.env.COLLAB_BENCH_HEAVY) {
|
|
41
|
+
results.push(measureStateBytes(100_000, cfg.maxStateBytes100k));
|
|
42
|
+
}
|
|
43
|
+
return results;
|
|
44
|
+
}
|
|
45
|
+
export function measureSingleAttrUpdateBytes(budget) {
|
|
46
|
+
const doc = createCollabDoc();
|
|
47
|
+
doc.transact(() => createEntity(doc, 'wall'));
|
|
48
|
+
const sv = Y.encodeStateVector(doc);
|
|
49
|
+
doc.transact(() => setAttribute(doc, 'wall', 'Name', 'Wall-A'));
|
|
50
|
+
const update = Y.encodeStateAsUpdate(doc, sv);
|
|
51
|
+
return {
|
|
52
|
+
name: 'single-attr-update-bytes',
|
|
53
|
+
value: update.byteLength,
|
|
54
|
+
unit: 'bytes',
|
|
55
|
+
budget,
|
|
56
|
+
ok: update.byteLength <= budget,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
export function measureColdLoad(entityCount, budget) {
|
|
60
|
+
// Build the IFCX in memory, then re-seed and time it.
|
|
61
|
+
const doc = createCollabDoc();
|
|
62
|
+
doc.transact(() => {
|
|
63
|
+
for (let i = 0; i < entityCount; i++) {
|
|
64
|
+
createEntity(doc, `e${i}`, { ifcClass: 'IfcWall' });
|
|
65
|
+
setAttribute(doc, `e${i}`, 'Name', `Wall-${i}`);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
const ifcx = snapshotToIfcx(doc);
|
|
69
|
+
const fresh = createCollabDoc();
|
|
70
|
+
const start = performance.now();
|
|
71
|
+
seedFromIfcx(fresh, ifcx);
|
|
72
|
+
const elapsed = performance.now() - start;
|
|
73
|
+
return {
|
|
74
|
+
name: `cold-load-${entityCount}`,
|
|
75
|
+
value: elapsed,
|
|
76
|
+
unit: 'ms',
|
|
77
|
+
budget,
|
|
78
|
+
ok: elapsed <= budget,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
export function measureStateBytes(entityCount, budget) {
|
|
82
|
+
const doc = createCollabDoc();
|
|
83
|
+
doc.transact(() => {
|
|
84
|
+
for (let i = 0; i < entityCount; i++) {
|
|
85
|
+
createEntity(doc, `e${i}`, { ifcClass: 'IfcWall' });
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
const update = Y.encodeStateAsUpdate(doc);
|
|
89
|
+
return {
|
|
90
|
+
name: `state-bytes-${entityCount}`,
|
|
91
|
+
value: update.byteLength,
|
|
92
|
+
unit: 'bytes',
|
|
93
|
+
budget,
|
|
94
|
+
ok: update.byteLength <= budget,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=benchmark.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"benchmark.js","sourceRoot":"","sources":["../../src/perf/benchmark.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAaxD,MAAM,CAAC,MAAM,cAAc,GAA8B;IACvD,iBAAiB,EAAE,GAAG,GAAG,IAAI,GAAG,IAAI;IACpC,wBAAwB,EAA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AAE,IAAI,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,CAAC;QACtD,CAAC;IACH,CAAC,CAAC,CAAC;IACH,MAAM,MAAM,GAAG,CAAC,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC;IAC1C,OAAO;QACL,IAAI,EAAE,eAAe,WAAW,EAAE;QAClC,KAAK,EAAE,MAAM,CAAC,UAAU;QACxB,IAAI,EAAE,OAAO;QACb,MAAM;QACN,EAAE,EAAE,MAAM,CAAC,UAAU,IAAI,MAAM;KAChC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/perf/index.ts"],"names":[],"mappings":"AAIA,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
export * from './latency.js';
|
|
5
|
+
export * from './benchmark.js';
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/perf/index.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC"}
|