@hydranium/data-server 1.0.0-next.10 → 1.0.0-next.104
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/README.md +5 -1
- package/lib/data-server.d.ts +171 -22
- package/lib/data-server.d.ts.map +1 -1
- package/lib/data-server.js +253 -44
- package/lib/data-server.js.map +1 -1
- package/lib/messages/index.d.ts +18 -0
- package/lib/messages/index.d.ts.map +1 -0
- package/lib/messages/index.js +18 -0
- package/lib/messages/index.js.map +1 -0
- package/lib/testing/data-server-harness.d.ts +5 -1
- package/lib/testing/data-server-harness.d.ts.map +1 -1
- package/lib/testing/data-server-harness.js +4 -2
- package/lib/testing/data-server-harness.js.map +1 -1
- package/package.json +17 -8
- package/src/data-server.ts +308 -56
- package/src/messages/index.ts +19 -0
- package/src/testing/data-server-harness.ts +11 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2026 CrossBreeze, EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the MIT License which is available in the project root.
|
|
6
|
+
*
|
|
7
|
+
* SPDX-License-Identifier: MIT
|
|
8
|
+
********************************************************************************/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Every user-facing message `@hydranium/data-server` raises.
|
|
12
|
+
*
|
|
13
|
+
* Declarations stay beside their call sites and are re-exported here, so this is
|
|
14
|
+
* enumeration rather than centralization: a code's package segment has to name
|
|
15
|
+
* the package that raises it. The English is a fallback, not a contract; the
|
|
16
|
+
* code is the contract, and renaming one is a breaking change.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
export { NO_ACTIVE_PROFILE, NO_ACTIVE_PROFILE_CODE, noActiveProfileError } from '../data-server.js';
|
|
@@ -14,7 +14,9 @@ import {
|
|
|
14
14
|
type DataClientProtocol,
|
|
15
15
|
type DataServerProtocol,
|
|
16
16
|
type ProjectsChangedEvent,
|
|
17
|
+
type TransferDocumentDeletedEvent,
|
|
17
18
|
type TransferDocumentSavedEvent,
|
|
19
|
+
type TransferDocumentsBuiltEvent,
|
|
18
20
|
type TransferDocumentUpdatedEvent
|
|
19
21
|
} from '@hydranium/protocol/data';
|
|
20
22
|
import { type Harness, makeCapturingDataClient } from '@hydranium/protocol/testing';
|
|
@@ -87,6 +89,10 @@ export interface DataServerHarness<
|
|
|
87
89
|
readonly events: ReadonlyArray<TransferDocumentUpdatedEvent<TTransfer, TDiagnostic>>;
|
|
88
90
|
/** Captured `onDocumentSaved` events. */
|
|
89
91
|
readonly saves: ReadonlyArray<TransferDocumentSavedEvent<TTransfer, TDiagnostic>>;
|
|
92
|
+
/** Captured `onDocumentDeleted` events. */
|
|
93
|
+
readonly deletions: ReadonlyArray<TransferDocumentDeletedEvent>;
|
|
94
|
+
/** Captured `onDocumentsBuilt` events, one per build that had unwatched documents. */
|
|
95
|
+
readonly builds: ReadonlyArray<TransferDocumentsBuiltEvent>;
|
|
90
96
|
/** Captured `onProjectsChanged` events. */
|
|
91
97
|
readonly projectsChanges: ReadonlyArray<ProjectsChangedEvent<TProject>>;
|
|
92
98
|
/** Dispose the underlying duplex pair. Idempotent. */
|
|
@@ -115,7 +121,7 @@ export function makeDataServerHarness<
|
|
|
115
121
|
const server = options.server(pair.left);
|
|
116
122
|
|
|
117
123
|
// The capture half is the shared client double, not a local copy: the same
|
|
118
|
-
// recording semantics (
|
|
124
|
+
// recording semantics (every channel, an override replacing rather than
|
|
119
125
|
// supplementing) then hold for a client-side suite that stands the double up
|
|
120
126
|
// without a server, so an assertion learnt against one reads the same in the
|
|
121
127
|
// other.
|
|
@@ -123,6 +129,8 @@ export function makeDataServerHarness<
|
|
|
123
129
|
client: localClient,
|
|
124
130
|
updates: events,
|
|
125
131
|
saves,
|
|
132
|
+
deletions,
|
|
133
|
+
builds,
|
|
126
134
|
projectsChanges
|
|
127
135
|
} = makeCapturingDataClient<TTransfer, TDiagnostic, TProject>(options.client);
|
|
128
136
|
|
|
@@ -141,6 +149,8 @@ export function makeDataServerHarness<
|
|
|
141
149
|
pair,
|
|
142
150
|
events,
|
|
143
151
|
saves,
|
|
152
|
+
deletions,
|
|
153
|
+
builds,
|
|
144
154
|
projectsChanges,
|
|
145
155
|
dispose: () => pair.dispose()
|
|
146
156
|
};
|