@covenant-rpc/server 0.2.0 → 0.3.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/{lib/index.ts → index.ts} +0 -1
- package/{lib/interfaces → interfaces}/mock.ts +12 -11
- package/package.json +4 -8
- package/{lib/server.ts → server.ts} +2 -1
- package/tests/channel-http.test.ts +4 -2
- package/tests/channel.test.ts +3 -3
- package/tests/procedure.test.ts +3 -3
- package/tests/sidekick.test.ts +2 -2
- package/CHANGELOG.md +0 -17
- /package/{lib/adapters → adapters}/vanilla.ts +0 -0
- /package/{lib/interfaces → interfaces}/direct.ts +0 -0
- /package/{lib/interfaces → interfaces}/empty.ts +0 -0
- /package/{lib/interfaces → interfaces}/http.ts +0 -0
- /package/{lib/logger.ts → logger.ts} +0 -0
- /package/{lib/sidekick → sidekick}/handlers.ts +0 -0
- /package/{lib/sidekick → sidekick}/index.ts +0 -0
- /package/{lib/sidekick → sidekick}/socket.ts +0 -0
|
@@ -5,7 +5,6 @@ export { Sidekick, type SidekickClient } from "./sidekick";
|
|
|
5
5
|
export { httpServerToSidekick, httpSidekickToServer } from "./interfaces/http";
|
|
6
6
|
export { emptyServerToSidekick } from "./interfaces/empty";
|
|
7
7
|
export { directClientToServer } from "./interfaces/direct";
|
|
8
|
-
export { mockClientToSidekick } from "./interfaces/mock";
|
|
9
8
|
|
|
10
9
|
// Re-export types from core for convenience
|
|
11
10
|
export type { LoggerLevel, Prefix } from "@covenant-rpc/core/logger";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ClientToSidekickConnection, ServerToSidekickConnection } from "@covenant-rpc/core/interfaces";
|
|
2
2
|
import type { Sidekick, SidekickClient } from "../sidekick";
|
|
3
|
-
import type { SidekickIncomingMessage
|
|
3
|
+
import type { SidekickIncomingMessage } from "@covenant-rpc/core/sidekick/protocol";
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
export function mockServerToSidekick(sidekick: Sidekick): ServerToSidekickConnection {
|
|
@@ -20,13 +20,14 @@ export function mockServerToSidekick(sidekick: Sidekick): ServerToSidekickConnec
|
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
23
|
+
// TODO - I never finished this
|
|
24
|
+
// export function mockClientToSidekick(sidekick: Sidekick, client: SidekickClient): ClientToSidekickConnection {
|
|
25
|
+
// return {
|
|
26
|
+
// sendMessage(message: SidekickIncomingMessage) {
|
|
27
|
+
// sidekick.handleClientMessage(client, message);
|
|
28
|
+
// },
|
|
29
|
+
// onMessage(v) {
|
|
30
|
+
//
|
|
31
|
+
// }
|
|
32
|
+
// }
|
|
33
|
+
// }
|
package/package.json
CHANGED
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@covenant-rpc/server",
|
|
3
3
|
"module": "lib/index.ts",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.3.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
8
8
|
},
|
|
9
|
-
"exports": {
|
|
10
|
-
".": "./lib/index.ts",
|
|
11
|
-
"./*": "./lib/*.ts"
|
|
12
|
-
},
|
|
13
9
|
"peerDependencies": {
|
|
14
10
|
"typescript": "^5"
|
|
15
11
|
},
|
|
16
12
|
"dependencies": {
|
|
17
|
-
"@covenant-rpc/core": "^0.
|
|
18
|
-
"@covenant-rpc/ion": "^1.0
|
|
19
|
-
"@covenant-rpc/request-serializer": "^1.0
|
|
13
|
+
"@covenant-rpc/core": "^0.3.0",
|
|
14
|
+
"@covenant-rpc/ion": "^1.1.0",
|
|
15
|
+
"@covenant-rpc/request-serializer": "^1.1.0"
|
|
20
16
|
}
|
|
21
17
|
}
|
|
@@ -6,8 +6,9 @@ import type { ServerToSidekickConnection } from "@covenant-rpc/core/interfaces";
|
|
|
6
6
|
import { channelConnectionRequestSchema, serverMessageWithContext, type ChannelConnectionResponse, type ChannelDefinition } from "@covenant-rpc/core/channel";
|
|
7
7
|
import { v } from "@covenant-rpc/core/validation";
|
|
8
8
|
import { procedureErrorFromUnknown, ThrowableProcedureError, ThrowableChannelError, channelErrorFromUnknown } from "@covenant-rpc/core/errors";
|
|
9
|
-
import { Logger
|
|
9
|
+
import { Logger } from "./logger";
|
|
10
10
|
import ION from "@covenant-rpc/ion";
|
|
11
|
+
import type { LoggerLevel } from "@covenant-rpc/core/logger";
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
export type ProcedureDefinitionMap<T extends ProcedureMap, Context, Derivation> = {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { test, expect } from "bun:test";
|
|
3
3
|
import { declareCovenant, channel } from "@covenant-rpc/core";
|
|
4
|
-
import { CovenantServer } from "../
|
|
4
|
+
import { CovenantServer } from "../server";
|
|
5
5
|
import { CovenantClient } from "@covenant-rpc/client";
|
|
6
6
|
import { httpClientToServer } from "@covenant-rpc/client/interfaces/http";
|
|
7
|
-
import { httpServerToSidekick } from "../
|
|
7
|
+
import { httpServerToSidekick } from "../interfaces/http";
|
|
8
8
|
import { InternalSidekick } from "@covenant-rpc/sidekick/internal";
|
|
9
9
|
|
|
10
10
|
// Helper to create a mock HTTP server
|
|
@@ -370,7 +370,9 @@ test("HTTP channel message error handling", async () => {
|
|
|
370
370
|
|
|
371
371
|
expect(response.status).toBe(400);
|
|
372
372
|
const errorBody = await response.json();
|
|
373
|
+
//@ts-expect-error we are doing the validation
|
|
373
374
|
expect(errorBody.fault).toBe("client");
|
|
375
|
+
//@ts-expect-error we are doing the validation
|
|
374
376
|
expect(errorBody.message).toContain("spam");
|
|
375
377
|
|
|
376
378
|
mock.cleanup();
|
package/tests/channel.test.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { test, expect } from "bun:test";
|
|
3
3
|
import { declareCovenant, channel } from "@covenant-rpc/core";
|
|
4
|
-
import { CovenantServer } from "../
|
|
4
|
+
import { CovenantServer } from "../server";
|
|
5
5
|
import { CovenantClient } from "@covenant-rpc/client";
|
|
6
|
-
import { directClientToServer } from "../
|
|
7
|
-
import { InternalSidekick } from "
|
|
6
|
+
import { directClientToServer } from "../interfaces/direct";
|
|
7
|
+
import { InternalSidekick } from "@covenant-rpc/sidekick/internal";
|
|
8
8
|
|
|
9
9
|
test("basic channel connection", async () => {
|
|
10
10
|
const sidekick = new InternalSidekick();
|
package/tests/procedure.test.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { test, expect } from "bun:test";
|
|
3
3
|
import { declareCovenant, query, mutation } from "@covenant-rpc/core";
|
|
4
|
-
import { CovenantServer } from "../
|
|
5
|
-
import { emptyServerToSidekick } from "../
|
|
4
|
+
import { CovenantServer } from "../server";
|
|
5
|
+
import { emptyServerToSidekick } from "../interfaces/empty";
|
|
6
6
|
import { emptyClientToSidekick } from "@covenant-rpc/client";
|
|
7
7
|
import { CovenantClient } from "@covenant-rpc/client";
|
|
8
|
-
import { directClientToServer } from "../
|
|
8
|
+
import { directClientToServer } from "../interfaces/direct";
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
test("simple procedure", async () => {
|
package/tests/sidekick.test.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Sidekick } from "../
|
|
1
|
+
import { Sidekick } from "../sidekick";
|
|
2
2
|
import { test, expect, mock } from "bun:test";
|
|
3
|
-
import type { SidekickOutgoingMessage } from "
|
|
3
|
+
import type { SidekickOutgoingMessage } from "@covenant-rpc/core/sidekick/protocol";
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
test("resource updating", () => {
|
package/CHANGELOG.md
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
# @covenant-rpc/server
|
|
2
|
-
|
|
3
|
-
## 0.1.3
|
|
4
|
-
|
|
5
|
-
### Patch Changes
|
|
6
|
-
|
|
7
|
-
- 8061179: Initial publish
|
|
8
|
-
- Updated dependencies [8061179]
|
|
9
|
-
- @covenant-rpc/request-serializer@1.0.3
|
|
10
|
-
- @covenant-rpc/core@0.1.3
|
|
11
|
-
- @covenant-rpc/ion@1.0.3
|
|
12
|
-
|
|
13
|
-
## 0.1.2
|
|
14
|
-
|
|
15
|
-
### Patch Changes
|
|
16
|
-
|
|
17
|
-
- Fix all packages
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|