@itrocks/sync 0.0.0-stage → 0.1.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 +165 -0
- package/README.md +249 -2
- package/config.yaml +2 -0
- package/demo/src/demo.css +458 -0
- package/dist/client/author-background.d.ts +2 -0
- package/dist/client/author-background.js +28 -0
- package/dist/client/clock.d.ts +10 -0
- package/dist/client/clock.js +30 -0
- package/dist/client/collections/order.d.ts +10 -0
- package/dist/client/collections/order.js +77 -0
- package/dist/client/collections/reorder-nodes.d.ts +2 -0
- package/dist/client/collections/reorder-nodes.js +67 -0
- package/dist/client/collections/row-changes.d.ts +12 -0
- package/dist/client/collections/row-changes.js +26 -0
- package/dist/client/collections/row-history.d.ts +16 -0
- package/dist/client/collections/row-history.js +61 -0
- package/dist/client/collections/table-columns.d.ts +19 -0
- package/dist/client/collections/table-columns.js +200 -0
- package/dist/client/collections.d.ts +54 -0
- package/dist/client/collections.js +262 -0
- package/dist/client/discovery.d.ts +1 -0
- package/dist/client/discovery.js +57 -0
- package/dist/client/field-address.d.ts +38 -0
- package/dist/client/field-address.js +225 -0
- package/dist/client/field-value.d.ts +7 -0
- package/dist/client/field-value.js +105 -0
- package/dist/client/form-identity.d.ts +1 -0
- package/dist/client/form-identity.js +43 -0
- package/dist/client/form-session.d.ts +53 -0
- package/dist/client/form-session.js +218 -0
- package/dist/client/identity.d.ts +3 -0
- package/dist/client/identity.js +27 -0
- package/dist/client/index.d.ts +43 -0
- package/dist/client/index.js +109 -0
- package/dist/client/journal.d.ts +13 -0
- package/dist/client/journal.js +59 -0
- package/dist/client/lifecycle.d.ts +26 -0
- package/dist/client/lifecycle.js +112 -0
- package/dist/client/observation.d.ts +11 -0
- package/dist/client/observation.js +46 -0
- package/dist/client/outbox.d.ts +15 -0
- package/dist/client/outbox.js +71 -0
- package/dist/client/plugin.d.ts +42 -0
- package/dist/client/plugin.js +1 -0
- package/dist/client/plugins/column-order/apply.d.ts +2 -0
- package/dist/client/plugins/column-order/apply.js +30 -0
- package/dist/client/plugins/column-order/colgroups.d.ts +2 -0
- package/dist/client/plugins/column-order/colgroups.js +78 -0
- package/dist/client/plugins/column-order/index.d.ts +2 -0
- package/dist/client/plugins/column-order/index.js +98 -0
- package/dist/client/plugins/cursor/editable.d.ts +16 -0
- package/dist/client/plugins/cursor/editable.js +67 -0
- package/dist/client/plugins/cursor/geometry.d.ts +16 -0
- package/dist/client/plugins/cursor/geometry.js +122 -0
- package/dist/client/plugins/cursor/index.d.ts +4 -0
- package/dist/client/plugins/cursor/index.js +13 -0
- package/dist/client/plugins/cursor/indicators.d.ts +31 -0
- package/dist/client/plugins/cursor/indicators.js +144 -0
- package/dist/client/plugins/cursor/local-selection.d.ts +19 -0
- package/dist/client/plugins/cursor/local-selection.js +234 -0
- package/dist/client/plugins/cursor/selection.d.ts +9 -0
- package/dist/client/plugins/cursor/selection.js +49 -0
- package/dist/client/plugins/cursor/text-presence.d.ts +15 -0
- package/dist/client/plugins/cursor/text-presence.js +95 -0
- package/dist/client/plugins/fields/author.d.ts +7 -0
- package/dist/client/plugins/fields/author.js +22 -0
- package/dist/client/plugins/fields/index.d.ts +4 -0
- package/dist/client/plugins/fields/index.js +192 -0
- package/dist/client/plugins/fields/writes.d.ts +19 -0
- package/dist/client/plugins/fields/writes.js +51 -0
- package/dist/client/plugins/focus/index.d.ts +9 -0
- package/dist/client/plugins/focus/index.js +92 -0
- package/dist/client/plugins/focus/indicators.d.ts +19 -0
- package/dist/client/plugins/focus/indicators.js +163 -0
- package/dist/client/plugins/naming/algorithm.d.ts +7 -0
- package/dist/client/plugins/naming/algorithm.js +65 -0
- package/dist/client/plugins/naming/attributes.d.ts +16 -0
- package/dist/client/plugins/naming/attributes.js +195 -0
- package/dist/client/plugins/naming/index.d.ts +5 -0
- package/dist/client/plugins/naming/index.js +185 -0
- package/dist/client/plugins/range/index.d.ts +4 -0
- package/dist/client/plugins/range/index.js +15 -0
- package/dist/client/plugins/reconciliation/index.d.ts +6 -0
- package/dist/client/plugins/reconciliation/index.js +282 -0
- package/dist/client/plugins/reconciliation/matching.d.ts +12 -0
- package/dist/client/plugins/reconciliation/matching.js +37 -0
- package/dist/client/plugins/reconciliation/proposals.d.ts +11 -0
- package/dist/client/plugins/reconciliation/proposals.js +32 -0
- package/dist/client/plugins/row-order/index.d.ts +2 -0
- package/dist/client/plugins/row-order/index.js +99 -0
- package/dist/client/plugins/rows/clone.d.ts +2 -0
- package/dist/client/plugins/rows/clone.js +123 -0
- package/dist/client/plugins/rows/index.d.ts +2 -0
- package/dist/client/plugins/rows/index.js +191 -0
- package/dist/client/plugins/rows/materialize.d.ts +4 -0
- package/dist/client/plugins/rows/materialize.js +43 -0
- package/dist/client/plugins/rows/remove.d.ts +1 -0
- package/dist/client/plugins/rows/remove.js +13 -0
- package/dist/client/plugins/rows/template.d.ts +2 -0
- package/dist/client/plugins/rows/template.js +21 -0
- package/dist/client/transport.d.ts +23 -0
- package/dist/client/transport.js +128 -0
- package/dist/client/user-colour.d.ts +3 -0
- package/dist/client/user-colour.js +11 -0
- package/dist/server/acknowledgments.d.ts +3 -0
- package/dist/server/acknowledgments.js +8 -0
- package/dist/server/broadcast.d.ts +3 -0
- package/dist/server/broadcast.js +7 -0
- package/dist/server/cli.d.ts +2 -0
- package/dist/server/cli.js +44 -0
- package/dist/server/clock.d.ts +2 -0
- package/dist/server/clock.js +3 -0
- package/dist/server/configuration.d.ts +3 -0
- package/dist/server/configuration.js +7 -0
- package/dist/server/connection.d.ts +13 -0
- package/dist/server/connection.js +1 -0
- package/dist/server/express.d.ts +2 -0
- package/dist/server/express.js +1 -0
- package/dist/server/fastify.d.ts +10 -0
- package/dist/server/fastify.js +15 -0
- package/dist/server/index.d.ts +7 -0
- package/dist/server/index.js +1 -0
- package/dist/server/journal.d.ts +7 -0
- package/dist/server/journal.js +16 -0
- package/dist/server/messages.d.ts +4 -0
- package/dist/server/messages.js +106 -0
- package/dist/server/participants.d.ts +9 -0
- package/dist/server/participants.js +7 -0
- package/dist/server/receipts.d.ts +13 -0
- package/dist/server/receipts.js +28 -0
- package/dist/server/recovery.d.ts +3 -0
- package/dist/server/recovery.js +9 -0
- package/dist/server/server.d.ts +34 -0
- package/dist/server/server.js +189 -0
- package/dist/server/sessions.d.ts +16 -0
- package/dist/server/sessions.js +37 -0
- package/dist/server/standalone.d.ts +9 -0
- package/dist/server/standalone.js +12 -0
- package/dist/server/transactions.d.ts +15 -0
- package/dist/server/transactions.js +50 -0
- package/dist/server/websocket-connection.d.ts +3 -0
- package/dist/server/websocket-connection.js +38 -0
- package/dist/server/websocket.d.ts +11 -0
- package/dist/server/websocket.js +26 -0
- package/dist/shared/field-update.d.ts +12 -0
- package/dist/shared/field-update.js +18 -0
- package/dist/shared/journal-entries.d.ts +9 -0
- package/dist/shared/journal-entries.js +33 -0
- package/dist/shared/protocol.d.ts +105 -0
- package/dist/shared/protocol.js +15 -0
- package/docs/dependencies.md +130 -0
- package/docs/spec-addendum-dependencies.md +10 -0
- package/docs/spec-addendum.md +717 -0
- package/docs/spec.md +1165 -0
- package/docs/testing.md +39 -0
- package/package.json +96 -5
package/docs/testing.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Test suites
|
|
2
|
+
|
|
3
|
+
*This documentation was written by an artificial intelligence and may contain errors or approximations.
|
|
4
|
+
It has not yet been fully reviewed by a human. If anything seems unclear or incomplete,
|
|
5
|
+
please feel free to contact the author of this package.*
|
|
6
|
+
|
|
7
|
+
Use Node.js 24 or later. From the source checkout, run `npm install`. For browser suites, install the Playwright
|
|
8
|
+
browser once with `npx playwright install chromium`. The test servers listen on ephemeral loopback ports.
|
|
9
|
+
|
|
10
|
+
| Command | Coverage |
|
|
11
|
+
| ---------------------------- | ----------------------------------------------------------------------------- |
|
|
12
|
+
| `npm test` | Unit and functional suites without a browser. |
|
|
13
|
+
| `npm run test:quick` | Unit and functional suites plus the demo smoke scenarios. |
|
|
14
|
+
| `npm run test:unit` | Clock, journals, debounce, order, naming and reconciliation algorithms. |
|
|
15
|
+
| `npm run test:functional` | WebSocket, Fastify, Express, access, acknowledgements, presence and recovery. |
|
|
16
|
+
| `npm run test:e2e` | Demo workflows, including standby takeover through the local launcher. |
|
|
17
|
+
| `npm run test:browser` | Browser client and plugin scenarios, including recovery and multi-user focus. |
|
|
18
|
+
| `npm run test:matrix` | 512 plugin subsets with two clients and applicable saved-copy replay. |
|
|
19
|
+
| `npm run test:cross-browser` | Chromium and Firefox editing the same form, with DOM comparison. |
|
|
20
|
+
| `npm run test:visual` | DOM and captures on mobile and desktop, plus remote focus rendering. |
|
|
21
|
+
| `npm run test:all` | All suites, including the mixed-engine session. |
|
|
22
|
+
|
|
23
|
+
For `test:all` and `test:cross-browser`, also install Firefox with `npx playwright install firefox`.
|
|
24
|
+
Use `SYNC_BROWSER=firefox` to run the same-browser suites in Firefox. Set `SYNC_BROWSER_EXECUTABLE` to use a
|
|
25
|
+
compatible system browser for a same-browser suite.
|
|
26
|
+
Set `SYNC_SCREENSHOTS=/path/to/output` with the visual suite to keep the paired PNG captures and full
|
|
27
|
+
demo screenshots.
|
|
28
|
+
|
|
29
|
+
Visual checks compare field values, IDs, names, label associations, author colours and structural order.
|
|
30
|
+
The screenshots show the same viewport and scroll position, with local pointer and focus state cleared.
|
|
31
|
+
A capture comparison accepts minor antialiasing differences (up to eight levels per channel on 0.5% of pixels).
|
|
32
|
+
The presence suite separately checks the participant-specific badges and striped border, including their
|
|
33
|
+
removal on blur or disconnect.
|
|
34
|
+
|
|
35
|
+
## it.rocks integration
|
|
36
|
+
|
|
37
|
+
In an it.rocks application with the Sync, framework, Fastify, Compose and edit-components checkouts installed
|
|
38
|
+
under `node_modules`, build the framework packages and run `npm run test:itrocks` from the Sync checkout.
|
|
39
|
+
The browser suite starts an isolated framework server with its own sessions and fixture records.
|
package/package.json
CHANGED
|
@@ -1,6 +1,97 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
"author": {
|
|
3
|
+
"name": "Baptiste Pillot",
|
|
4
|
+
"email": "baptiste@pillot.fr"
|
|
5
|
+
},
|
|
6
|
+
"bin": {
|
|
7
|
+
"sync-server": "./dist/server/cli.js"
|
|
8
|
+
},
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"ws": "^8.23.1"
|
|
11
|
+
},
|
|
12
|
+
"description": "Lets people on different devices edit the same HTML form together in real time",
|
|
13
|
+
"devDependencies": {
|
|
14
|
+
"@itrocks/edit-components": "^0.7.0",
|
|
15
|
+
"@itrocks/table": "^0.14.1",
|
|
16
|
+
"@types/node": "^24.10.0",
|
|
17
|
+
"@types/ws": "^8.18.2",
|
|
18
|
+
"express": "^5.3.0",
|
|
19
|
+
"fastify": "^5.12.8",
|
|
20
|
+
"playwright": "^1.65.1",
|
|
21
|
+
"prismjs": "^1.30.0",
|
|
22
|
+
"tsx": "^4.23",
|
|
23
|
+
"typescript": "^7.0.2"
|
|
24
|
+
},
|
|
25
|
+
"engines": {
|
|
26
|
+
"node": ">=24"
|
|
27
|
+
},
|
|
28
|
+
"exports": {
|
|
29
|
+
".": "./dist/client/index.js",
|
|
30
|
+
"./client": "./dist/client/index.js",
|
|
31
|
+
"./demo.css": "./demo/src/demo.css",
|
|
32
|
+
"./express": "./dist/server/express.js",
|
|
33
|
+
"./fastify": "./dist/server/fastify.js",
|
|
34
|
+
"./server": "./dist/server/index.js",
|
|
35
|
+
"./standalone": "./dist/server/standalone.js",
|
|
36
|
+
"./websocket": "./dist/server/websocket.js"
|
|
37
|
+
},
|
|
38
|
+
"files": [
|
|
39
|
+
"config.yaml",
|
|
40
|
+
"demo/src/demo.css",
|
|
41
|
+
"dist",
|
|
42
|
+
"docs",
|
|
43
|
+
"LICENSE",
|
|
44
|
+
"README.md"
|
|
45
|
+
],
|
|
46
|
+
"homepage": "https://it.rocks",
|
|
47
|
+
"keywords": [
|
|
48
|
+
"backend",
|
|
49
|
+
"collaborative editing",
|
|
50
|
+
"collaborative presence",
|
|
51
|
+
"DOM",
|
|
52
|
+
"form synchronisation",
|
|
53
|
+
"front-end",
|
|
54
|
+
"HTML forms",
|
|
55
|
+
"it.rocks",
|
|
56
|
+
"real-time",
|
|
57
|
+
"websocket"
|
|
58
|
+
],
|
|
59
|
+
"license": "LGPL-3.0-or-later",
|
|
60
|
+
"name": "@itrocks/sync",
|
|
61
|
+
"optionalDependencies": {
|
|
62
|
+
"@fastify/websocket": "^11.3.7"
|
|
63
|
+
},
|
|
64
|
+
"peerDependencies": {
|
|
65
|
+
"fastify": "^5.0.0"
|
|
66
|
+
},
|
|
67
|
+
"peerDependenciesMeta": {
|
|
68
|
+
"fastify": {
|
|
69
|
+
"optional": true
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
"repository": {
|
|
73
|
+
"type": "git",
|
|
74
|
+
"url": "git+https://github.com/itrocks-ts/sync.git"
|
|
75
|
+
},
|
|
76
|
+
"scripts": {
|
|
77
|
+
"build": "tsc",
|
|
78
|
+
"build:demo": "npm --prefix demo run build",
|
|
79
|
+
"dev": "tsx watch src/server/cli.ts",
|
|
80
|
+
"prepack": "npm run build",
|
|
81
|
+
"start": "node dist/server/cli.js",
|
|
82
|
+
"start:demo": "npm --prefix demo start",
|
|
83
|
+
"test": "npm run build && node --test --test-isolation=none test/*.test.js",
|
|
84
|
+
"test:all": "npm run build:demo && node --test --test-isolation=none test/*.test.js test/*.e2e.js test/*.front.js test/*.browser.js test/*.matrix.js test/*.visual.js test/*.cross-browser.js",
|
|
85
|
+
"test:browser": "npm run build:demo && node --test --test-isolation=none test/*.front.js test/*.browser.js",
|
|
86
|
+
"test:cross-browser": "npm run build:demo && node --test --test-isolation=none test/*.cross-browser.js",
|
|
87
|
+
"test:e2e": "npm run build:demo && node --test --test-isolation=none test/*.e2e.js",
|
|
88
|
+
"test:functional": "npm run build && node --test --test-isolation=none test/server*.test.js",
|
|
89
|
+
"test:itrocks": "npm run build:demo && node --test --test-isolation=none test/itrocks.integration.mjs",
|
|
90
|
+
"test:matrix": "npm run build:demo && node --test --test-isolation=none test/*.matrix.js",
|
|
91
|
+
"test:quick": "npm run build:demo && node --test --test-isolation=none test/*.test.js test/*.e2e.js",
|
|
92
|
+
"test:unit": "npm run build && node --test --test-isolation=none test/client-core.test.js test/collection-order.test.js test/identity-plugins.test.js",
|
|
93
|
+
"test:visual": "npm run build:demo && node --test --test-isolation=none test/*.visual.js"
|
|
94
|
+
},
|
|
95
|
+
"type": "module",
|
|
96
|
+
"version": "0.1.0"
|
|
97
|
+
}
|