@yuhere/js-jsonrpc2 2.1.2 → 2.1.4

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.
Files changed (84) hide show
  1. package/dist/cli/cli.js +4 -4
  2. package/dist/cli/demo-methods.d.ts +1 -1
  3. package/dist/cli/demo-methods.js +1 -1
  4. package/dist/cli/express.js +2 -2
  5. package/dist/cli/stdio.js +1 -1
  6. package/dist/core/Repository.d.ts +2 -2
  7. package/dist/core/Repository.js +9 -9
  8. package/dist/core/convert.d.ts +2 -2
  9. package/dist/core/convert.js +2 -2
  10. package/dist/core/descriptor.d.ts +3 -3
  11. package/dist/core/descriptor.js +3 -3
  12. package/dist/core/index.d.ts +3 -3
  13. package/dist/core/index.js +2 -2
  14. package/dist/core/permission.d.ts +2 -2
  15. package/dist/core/permission.js +2 -2
  16. package/dist/core/spec-check.d.ts +1 -1
  17. package/dist/core/spec-check.js +3 -3
  18. package/dist/core/system-methods.d.ts +1 -1
  19. package/dist/core/system-methods.js +4 -4
  20. package/dist/errors/{RpcError.d.ts → RPCError.d.ts} +1 -1
  21. package/dist/errors/index.d.ts +2 -2
  22. package/dist/errors/index.js +2 -2
  23. package/dist/index.d.ts +11 -11
  24. package/dist/index.js +8 -8
  25. package/dist/schema/json/index.d.ts +16 -16
  26. package/dist/schema/json/index.js +4 -4
  27. package/dist/schema/json/marker.d.ts +1 -1
  28. package/dist/schema/z/protocol.d.ts +5 -5
  29. package/dist/schema/z/protocol.js +1 -1
  30. package/dist/schema/z/register.d.ts +1 -1
  31. package/dist/schema/z/register.js +1 -1
  32. package/dist/transport/express/body.js +2 -2
  33. package/dist/transport/express/index.d.ts +2 -2
  34. package/dist/transport/express/index.js +1 -1
  35. package/dist/transport/express/middleware.d.ts +2 -2
  36. package/dist/transport/express/middleware.js +5 -5
  37. package/dist/transport/express/respond.d.ts +1 -1
  38. package/dist/transport/express/respond.js +1 -1
  39. package/dist/transport/stdio/index.d.ts +1 -1
  40. package/dist/transport/stdio/index.js +1 -1
  41. package/dist/transport/stdio/middleware.d.ts +2 -2
  42. package/dist/transport/stdio/middleware.js +4 -4
  43. package/dist/transport/ws/index.d.ts +2 -2
  44. package/dist/transport/ws/index.js +2 -2
  45. package/dist/transport/ws/middleware.d.ts +2 -2
  46. package/dist/transport/ws/middleware.js +3 -3
  47. package/dist/transport/ws/standalone.d.ts +1 -1
  48. package/dist/transport/ws/standalone.js +2 -2
  49. package/dist/types.d.ts +4 -4
  50. package/htdoc/assets/{index-hcP2-9jw.css → index-BAZmvr5x.css} +13 -0
  51. package/htdoc/assets/{index-CQr-lnlD.js → index-sVQlhxjI.js} +223 -32
  52. package/htdoc/assets/index-sVQlhxjI.js.map +1 -0
  53. package/htdoc/index.html +2 -2
  54. package/package.json +5 -4
  55. package/webui/src/App.tsx +30 -3
  56. package/webui/src/api/docGen.ts +188 -0
  57. package/webui/src/components/SchemaForm.tsx +0 -1
  58. package/webui/src/components/TestPanel.tsx +53 -10
  59. package/webui/src/components/Toolbar.tsx +13 -1
  60. package/webui/src/styles/geek.css +13 -0
  61. package/dist/schema/index.d.ts +0 -4
  62. package/dist/schema/index.d.ts.map +0 -1
  63. package/dist/schema/index.js +0 -4
  64. package/dist/schema/index.js.map +0 -1
  65. package/dist/schema/primitives.d.ts +0 -25
  66. package/dist/schema/primitives.d.ts.map +0 -1
  67. package/dist/schema/primitives.js +0 -153
  68. package/dist/schema/primitives.js.map +0 -1
  69. package/dist/schema/rpc.d.ts +0 -21
  70. package/dist/schema/rpc.d.ts.map +0 -1
  71. package/dist/schema/rpc.js +0 -17
  72. package/dist/schema/rpc.js.map +0 -1
  73. package/dist/stream/index.d.ts +0 -3
  74. package/dist/stream/index.d.ts.map +0 -1
  75. package/dist/stream/index.js +0 -2
  76. package/dist/stream/index.js.map +0 -1
  77. package/dist/stream/stringify.d.ts +0 -19
  78. package/dist/stream/stringify.d.ts.map +0 -1
  79. package/dist/stream/stringify.js +0 -217
  80. package/dist/stream/stringify.js.map +0 -1
  81. package/htdoc/assets/index-CQr-lnlD.js.map +0 -1
  82. /package/dist/errors/{RpcError.d.ts.map → RPCError.d.ts.map} +0 -0
  83. /package/dist/errors/{RpcError.js → RPCError.js} +0 -0
  84. /package/dist/errors/{RpcError.js.map → RPCError.js.map} +0 -0
package/dist/cli/cli.js CHANGED
@@ -14,10 +14,10 @@ import { existsSync } from 'node:fs';
14
14
  import path from 'node:path';
15
15
  import { fileURLToPath } from 'node:url';
16
16
  import express from 'express';
17
- import { createRepository } from '../core/Repository';
18
- import { installDemoMethods } from './demo-methods';
19
- import { createExpressRouter } from '../transport/express';
20
- import { attachWebSocket } from '../transport/ws';
17
+ import { createRepository } from '../core/Repository.js';
18
+ import { installDemoMethods } from './demo-methods.js';
19
+ import { createExpressRouter } from '../transport/express/index.js';
20
+ import { attachWebSocket } from '../transport/ws/index.js';
21
21
  const here = path.dirname(fileURLToPath(import.meta.url));
22
22
  function htdocDir() {
23
23
  // dist/cli.js → 包根/htdoc
@@ -1,4 +1,4 @@
1
- import type { Repository } from '../core/Repository';
1
+ import type { Repository } from '../core/Repository.js';
2
2
  /**
3
3
  * 注册一整套用于演示/调试的 RPC 方法。
4
4
  * 覆盖:基础类型、字面量/枚举、数组/元组、对象、Record、联合、
@@ -1,4 +1,4 @@
1
- import { s } from '../schema/json';
1
+ import { s } from '../schema/json/index.js';
2
2
  /**
3
3
  * 注册一整套用于演示/调试的 RPC 方法。
4
4
  * 覆盖:基础类型、字面量/枚举、数组/元组、对象、Record、联合、
@@ -1,7 +1,7 @@
1
1
  import { createServer } from 'node:http';
2
2
  import express from 'express';
3
- import { attachWebSocket, createRepository, createExpressRouter } from '..';
4
- import { installDemoMethods } from './demo-methods';
3
+ import { attachWebSocket, createRepository, createExpressRouter } from '../index.js';
4
+ import { installDemoMethods } from './demo-methods.js';
5
5
  const app = express();
6
6
  const repository = createRepository({ withSystemMethods: true });
7
7
  installDemoMethods(repository);
package/dist/cli/stdio.js CHANGED
@@ -1,4 +1,4 @@
1
- import { createRepository, serveStdio, s } from '..';
1
+ import { createRepository, serveStdio, s } from '../index.js';
2
2
  const repository = createRepository();
3
3
  repository.register({ namespace: 'echo', signature: [s.string(), s.string()] }, (v) => v);
4
4
  await serveStdio({ repository, framing: 'lines' });
@@ -1,5 +1,5 @@
1
- import type { MethodDescriptor } from './descriptor';
2
- import type { RPCDescriptor, RPCHandler, RPCResponse, InvokeOptions, RepositoryOptions } from '../types';
1
+ import type { MethodDescriptor } from './descriptor.js';
2
+ import type { RPCDescriptor, RPCHandler, RPCResponse, InvokeOptions, RepositoryOptions } from '../types.js';
3
3
  export declare class Repository {
4
4
  private readonly methods;
5
5
  constructor(options?: RepositoryOptions);
@@ -1,12 +1,12 @@
1
- import { RPCError } from '../errors/RPCError';
2
- import { INTERNAL_ERROR, INVALID_REQUEST } from '../errors/codes';
3
- import { buildDescriptor, lookup, signatureOf } from './descriptor';
4
- import { convertParams } from './convert';
5
- import { checkPermission } from './permission';
6
- import { validateRequest } from './spec-check';
7
- import { registerSystemMethods } from './system-methods';
8
- import { registerSchema } from '../schema/z/register';
9
- import { RPCVersion } from "../schema/z/protocol";
1
+ import { RPCError } from '../errors/RPCError.js';
2
+ import { INTERNAL_ERROR, INVALID_REQUEST } from '../errors/codes.js';
3
+ import { buildDescriptor, lookup, signatureOf } from './descriptor.js';
4
+ import { convertParams } from './convert.js';
5
+ import { checkPermission } from './permission.js';
6
+ import { validateRequest } from './spec-check.js';
7
+ import { registerSystemMethods } from './system-methods.js';
8
+ import { registerSchema } from '../schema/z/register.js';
9
+ import { RPCVersion } from "../schema/z/protocol.js";
10
10
  function formatRegisterIssues(error) {
11
11
  return error.issues
12
12
  .map((issue) => {
@@ -1,4 +1,4 @@
1
- import type { MethodDescriptor } from './descriptor';
2
- import type { Injectables } from '../types';
1
+ import type { MethodDescriptor } from './descriptor.js';
2
+ import type { Injectables } from '../types.js';
3
3
  export declare function convertParams(descriptor: MethodDescriptor, params: unknown, injections: Injectables): Promise<unknown[]>;
4
4
  //# sourceMappingURL=convert.d.ts.map
@@ -1,5 +1,5 @@
1
- import { RPCError } from '../errors/RPCError';
2
- import { INVALID_PARAMS } from '../errors/codes';
1
+ import { RPCError } from '../errors/RPCError.js';
2
+ import { INVALID_PARAMS } from '../errors/codes.js';
3
3
  export async function convertParams(descriptor, params, injections) {
4
4
  let raw = params;
5
5
  if (raw === undefined || raw === null)
@@ -1,6 +1,6 @@
1
- import { RPCError } from '../errors/RPCError';
2
- import { Schema } from '../schema/json';
3
- import type { RPCDescriptor, RPCHandler, RPCSignature } from '../types';
1
+ import { RPCError } from '../errors/RPCError.js';
2
+ import { Schema } from '../schema/json/index.js';
3
+ import type { RPCDescriptor, RPCHandler, RPCSignature } from '../types.js';
4
4
  export interface IndexedParam {
5
5
  schema: Schema<unknown>;
6
6
  originalIndex: number;
@@ -1,6 +1,6 @@
1
- import { METHOD_NOT_FOUND, INVALID_PARAMS } from '../errors/codes';
2
- import { RPCError } from '../errors/RPCError';
3
- import { InjectableMarker, VoidMarker, StreamMarker, Schema } from '../schema/json';
1
+ import { METHOD_NOT_FOUND, INVALID_PARAMS } from '../errors/codes.js';
2
+ import { RPCError } from '../errors/RPCError.js';
3
+ import { InjectableMarker, VoidMarker, StreamMarker, Schema } from '../schema/json/index.js';
4
4
  function normalizeGrantTo(grantTo) {
5
5
  if (grantTo === undefined)
6
6
  return undefined;
@@ -1,4 +1,4 @@
1
- export { Repository, createRepository } from './Repository';
2
- export type { MethodDescriptor } from './descriptor';
3
- export { validateRequest } from './spec-check';
1
+ export { Repository, createRepository } from './Repository.js';
2
+ export type { MethodDescriptor } from './descriptor.js';
3
+ export { validateRequest } from './spec-check.js';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1,3 +1,3 @@
1
- export { Repository, createRepository } from './Repository';
2
- export { validateRequest } from './spec-check';
1
+ export { Repository, createRepository } from './Repository.js';
2
+ export { validateRequest } from './spec-check.js';
3
3
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- import type { MethodDescriptor } from './descriptor';
2
- import type { Injectables } from '../types';
1
+ import type { MethodDescriptor } from './descriptor.js';
2
+ import type { Injectables } from '../types.js';
3
3
  export declare function checkPermission(descriptor: MethodDescriptor, injections: Injectables): Promise<void>;
4
4
  //# sourceMappingURL=permission.d.ts.map
@@ -1,5 +1,5 @@
1
- import { RPCError } from '../errors/RPCError';
2
- import { PERMISSION_DENIED } from '../errors/codes';
1
+ import { RPCError } from '../errors/RPCError.js';
2
+ import { PERMISSION_DENIED } from '../errors/codes.js';
3
3
  export async function checkPermission(descriptor, injections) {
4
4
  const grantTo = descriptor.grantTo;
5
5
  if (!grantTo || grantTo.length === 0)
@@ -1,3 +1,3 @@
1
- import type { RPCRequestInput } from '../types';
1
+ import type { RPCRequestInput } from '../types.js';
2
2
  export declare function validateRequest(input: unknown): RPCRequestInput;
3
3
  //# sourceMappingURL=spec-check.d.ts.map
@@ -1,6 +1,6 @@
1
- import { RPCRequestSchema } from '../schema/z/protocol';
2
- import { RPCError } from '../errors/RPCError';
3
- import { INVALID_REQUEST } from '../errors/codes';
1
+ import { RPCRequestSchema } from '../schema/z/protocol.js';
2
+ import { RPCError } from '../errors/RPCError.js';
3
+ import { INVALID_REQUEST } from '../errors/codes.js';
4
4
  export function validateRequest(input) {
5
5
  const result = RPCRequestSchema.safeParse(input);
6
6
  if (!result.success) {
@@ -1,3 +1,3 @@
1
- import type { Repository } from './Repository';
1
+ import type { Repository } from './Repository.js';
2
2
  export declare function registerSystemMethods(repository: Repository): void;
3
3
  //# sourceMappingURL=system-methods.d.ts.map
@@ -1,8 +1,8 @@
1
1
  // src/core/system-methods.ts
2
- import { RPCError } from '../errors/RPCError';
3
- import { METHOD_NOT_FOUND, PERMISSION_DENIED } from '../errors/codes';
4
- import { checkPermission } from './permission';
5
- import { s } from '../schema/json';
2
+ import { RPCError } from '../errors/RPCError.js';
3
+ import { METHOD_NOT_FOUND, PERMISSION_DENIED } from '../errors/codes.js';
4
+ import { checkPermission } from './permission.js';
5
+ import { s } from '../schema/json/index.js';
6
6
  function notFound(namespace) {
7
7
  return new RPCError(METHOD_NOT_FOUND, 'Method not found', `Method not found.[${namespace}]`);
8
8
  }
@@ -1,4 +1,4 @@
1
- import type { RPCErrorPayload } from '../types';
1
+ import type { RPCErrorPayload } from '../types.js';
2
2
  export declare class RPCError extends Error {
3
3
  readonly code: number;
4
4
  readonly data?: unknown;
@@ -1,3 +1,3 @@
1
- export { RPCError } from './RPCError';
2
- export * from './codes';
1
+ export { RPCError } from './RPCError.js';
2
+ export * from './codes.js';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1,3 +1,3 @@
1
- export { RPCError } from './RPCError';
2
- export * from './codes';
1
+ export { RPCError } from './RPCError.js';
2
+ export * from './codes.js';
3
3
  //# sourceMappingURL=index.js.map
package/dist/index.d.ts CHANGED
@@ -1,18 +1,18 @@
1
- import { Repository, createRepository } from './core/Repository';
2
- import { RPCError } from './errors/RPCError';
3
- import * as codes from './errors/codes';
4
- import { s } from './schema/json';
1
+ import { Repository, createRepository } from './core/Repository.js';
2
+ import { RPCError } from './errors/RPCError.js';
3
+ import * as codes from './errors/codes.js';
4
+ import { s } from './schema/json/index.js';
5
5
  export { Repository, createRepository };
6
6
  export { RPCError };
7
7
  export { codes };
8
8
  export { s };
9
- export * from './types';
10
- import { createExpressRouter } from './transport/express';
9
+ export * from './types.js';
10
+ import { createExpressRouter } from './transport/express/index.js';
11
11
  export { createExpressRouter };
12
- import { attachWebSocket, createWebSocketServer } from './transport/ws';
13
- import { serveStdio } from './transport/stdio';
12
+ import { attachWebSocket, createWebSocketServer } from './transport/ws/index.js';
13
+ import { serveStdio } from './transport/stdio/index.js';
14
14
  export { attachWebSocket, createWebSocketServer, serveStdio };
15
- export type { WSOptions, StandaloneWsOptions, StandaloneWsHandle } from './transport/ws';
16
- export type { StdioOptions } from './transport/stdio';
17
- export type { ExpressOptions } from './transport/express';
15
+ export type { WSOptions, StandaloneWsOptions, StandaloneWsHandle } from './transport/ws/index.js';
16
+ export type { StdioOptions } from './transport/stdio/index.js';
17
+ export type { ExpressOptions } from './transport/express/index.js';
18
18
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,17 +1,17 @@
1
- import { Repository, createRepository } from './core/Repository';
2
- import { RPCError } from './errors/RPCError';
3
- import * as codes from './errors/codes';
4
- import { s } from './schema/json';
1
+ import { Repository, createRepository } from './core/Repository.js';
2
+ import { RPCError } from './errors/RPCError.js';
3
+ import * as codes from './errors/codes.js';
4
+ import { s } from './schema/json/index.js';
5
5
  export { Repository, createRepository };
6
6
  export { RPCError };
7
7
  export { codes };
8
8
  export { s };
9
- export * from './types';
9
+ export * from './types.js';
10
10
  // ################
11
- import { createExpressRouter } from './transport/express';
11
+ import { createExpressRouter } from './transport/express/index.js';
12
12
  export { createExpressRouter };
13
13
  // ################
14
- import { attachWebSocket, createWebSocketServer } from './transport/ws';
15
- import { serveStdio } from './transport/stdio';
14
+ import { attachWebSocket, createWebSocketServer } from './transport/ws/index.js';
15
+ import { serveStdio } from './transport/stdio/index.js';
16
16
  export { attachWebSocket, createWebSocketServer, serveStdio };
17
17
  //# sourceMappingURL=index.js.map
@@ -1,19 +1,19 @@
1
- export * from "./primitives";
2
- export * from "./marker";
1
+ export * from "./primitives.js";
2
+ export * from "./marker.js";
3
3
  export declare const s: {
4
- string: () => import("./primitives").StringSchema<"string">;
5
- number: () => import("./primitives").NumberSchema;
6
- boolean: () => import("./primitives").BooleanSchema;
7
- literal: <const T extends import("./primitives").LiteralValue>(value: T) => import("./primitives").LiteralSchema<T>;
8
- array: <T>(item: import("./primitives").Schema<T>) => import("./primitives").ArraySchema<T>;
9
- object: <S extends import("./primitives").ObjectShape>(shape: S) => import("./primitives").ObjectSchema<S, false>;
10
- record: <T>(value: import("./primitives").Schema<T>) => import("./primitives").RecordSchema<T>;
11
- union: <const S extends readonly [import("./primitives").Schema<unknown>, ...import("./primitives").Schema<unknown>[]]>(schemas: S) => import("./primitives").UnionSchema<S>;
12
- tuple: <const S extends readonly [import("./primitives").Schema<unknown>, ...import("./primitives").Schema<unknown>[]]>(schemas: S) => import("./primitives").TupleSchema<S>;
13
- enum: <const T extends readonly [string, ...string[]]>(values: T) => import("./primitives").EnumSchema<T>;
14
- unknown: () => import("./primitives").UnknownSchema;
15
- void: () => import("./marker").VoidMarker;
16
- injectable: <const K extends string>(key: K) => import("./marker").InjectableMarker<K>;
17
- stream: <T>(inner: import("./primitives").Schema<T>) => import("./marker").StreamMarker<T>;
4
+ string: () => import("./primitives.js").StringSchema<"string">;
5
+ number: () => import("./primitives.js").NumberSchema;
6
+ boolean: () => import("./primitives.js").BooleanSchema;
7
+ literal: <const T extends import("./primitives.js").LiteralValue>(value: T) => import("./primitives.js").LiteralSchema<T>;
8
+ array: <T>(item: import("./primitives.js").Schema<T>) => import("./primitives.js").ArraySchema<T>;
9
+ object: <S extends import("./primitives.js").ObjectShape>(shape: S) => import("./primitives.js").ObjectSchema<S, false>;
10
+ record: <T>(value: import("./primitives.js").Schema<T>) => import("./primitives.js").RecordSchema<T>;
11
+ union: <const S extends readonly [import("./primitives.js").Schema<unknown>, ...import("./primitives.js").Schema<unknown>[]]>(schemas: S) => import("./primitives.js").UnionSchema<S>;
12
+ tuple: <const S extends readonly [import("./primitives.js").Schema<unknown>, ...import("./primitives.js").Schema<unknown>[]]>(schemas: S) => import("./primitives.js").TupleSchema<S>;
13
+ enum: <const T extends readonly [string, ...string[]]>(values: T) => import("./primitives.js").EnumSchema<T>;
14
+ unknown: () => import("./primitives.js").UnknownSchema;
15
+ void: () => import("./marker.js").VoidMarker;
16
+ injectable: <const K extends string>(key: K) => import("./marker.js").InjectableMarker<K>;
17
+ stream: <T>(inner: import("./primitives.js").Schema<T>) => import("./marker.js").StreamMarker<T>;
18
18
  };
19
19
  //# sourceMappingURL=index.d.ts.map
@@ -1,6 +1,6 @@
1
- import { primitives } from "./primitives";
2
- import { markers } from "./marker";
3
- export * from "./primitives";
4
- export * from "./marker";
1
+ import { primitives } from "./primitives.js";
2
+ import { markers } from "./marker.js";
3
+ export * from "./primitives.js";
4
+ export * from "./marker.js";
5
5
  export const s = { ...primitives, ...markers };
6
6
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- import type { Schema } from "./primitives";
1
+ import type { Schema } from "./primitives.js";
2
2
  export declare abstract class Marker {
3
3
  abstract readonly kind: string;
4
4
  }
@@ -1,9 +1,9 @@
1
1
  export declare const RPCVersion = "2.0";
2
2
  export type RPCVersion = '2.0';
3
- export declare const RPCRequestSchema: import("../json").ObjectSchema<{
4
- jsonrpc: import("../json").LiteralSchema<"2.0">;
5
- method: import("../json").StringSchema<"string">;
6
- params: import("../json").NullableSchema<import("../json").JSONValue[]>;
7
- id: import("../json").UnionSchema<readonly [import("../json").StringSchema<"string">, import("../json").NumberSchema]>;
3
+ export declare const RPCRequestSchema: import("../json/index.js").ObjectSchema<{
4
+ jsonrpc: import("../json/index.js").LiteralSchema<"2.0">;
5
+ method: import("../json/index.js").StringSchema<"string">;
6
+ params: import("../json/index.js").NullableSchema<import("../json/index.js").JSONValue[]>;
7
+ id: import("../json/index.js").UnionSchema<readonly [import("../json/index.js").StringSchema<"string">, import("../json/index.js").NumberSchema]>;
8
8
  }, true>;
9
9
  //# sourceMappingURL=protocol.d.ts.map
@@ -1,4 +1,4 @@
1
- import { s } from "../json";
1
+ import { s } from "../json/index.js";
2
2
  export const RPCVersion = '2.0';
3
3
  export const RPCRequestSchema = s.object({
4
4
  jsonrpc: s.literal(RPCVersion),
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import { Schema, VoidMarker, InjectableMarker, StreamMarker } from "../json";
2
+ import { Schema, VoidMarker, InjectableMarker, StreamMarker } from "../json/index.js";
3
3
  export declare const registerSchema: z.ZodTuple<[z.ZodObject<{
4
4
  namespace: z.ZodString;
5
5
  document: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>]>>;
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import { Schema, VoidMarker, InjectableMarker, StreamMarker, } from "../json";
2
+ import { Schema, VoidMarker, InjectableMarker, StreamMarker, } from "../json/index.js";
3
3
  const schemaInstance = z.instanceof(Schema);
4
4
  const voidMarker = z.instanceof(VoidMarker);
5
5
  const injectableMarker = z.instanceof(InjectableMarker);
@@ -1,6 +1,6 @@
1
1
  import bodyParser from 'body-parser';
2
- import { RPCError } from '../../errors/RPCError';
3
- import { PARSE_ERROR } from '../../errors/codes';
2
+ import { RPCError } from '../../errors/RPCError.js';
3
+ import { PARSE_ERROR } from '../../errors/codes.js';
4
4
  export function createJsonParser(options = {}) {
5
5
  return bodyParser.json({
6
6
  limit: options.limit ?? '1mb',
@@ -1,3 +1,3 @@
1
- export { createExpressRouter } from './middleware';
2
- export type { ExpressOptions } from './middleware';
1
+ export { createExpressRouter } from './middleware.js';
2
+ export type { ExpressOptions } from './middleware.js';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1,2 +1,2 @@
1
- export { createExpressRouter } from './middleware';
1
+ export { createExpressRouter } from './middleware.js';
2
2
  //# sourceMappingURL=index.js.map
@@ -1,6 +1,6 @@
1
1
  import type { Router } from 'express';
2
- import { Repository } from '../../core/Repository';
3
- import type { InjectableFactory, RPCResponse, RPCErrorTransform } from '../../types';
2
+ import { Repository } from '../../core/Repository.js';
3
+ import type { InjectableFactory, RPCResponse, RPCErrorTransform } from '../../types.js';
4
4
  export interface ExpressOptions {
5
5
  mkInjectable?: InjectableFactory;
6
6
  errorTransform?: RPCErrorTransform;
@@ -2,11 +2,11 @@ import path from 'node:path';
2
2
  import { fileURLToPath } from 'node:url';
3
3
  import express from 'express';
4
4
  import typeIs from 'type-is';
5
- import { RPCError } from '../../errors/RPCError';
6
- import { INTERNAL_ERROR } from '../../errors/codes';
7
- import { createJsonParser, readJson } from './body';
8
- import { respond } from './respond';
9
- import { RPCVersion } from "../../schema/z/protocol";
5
+ import { RPCError } from '../../errors/RPCError.js';
6
+ import { INTERNAL_ERROR } from '../../errors/codes.js';
7
+ import { createJsonParser, readJson } from './body.js';
8
+ import { respond } from './respond.js';
9
+ import { RPCVersion } from "../../schema/z/protocol.js";
10
10
  const here = path.dirname(fileURLToPath(import.meta.url));
11
11
  const defaultStaticDir = path.resolve(here, '..', '..', '..', 'htdoc');
12
12
  export function createExpressRouter(repository, { mkInjectable = undefined, errorTransform = undefined, bodyLimit = '1mb', useHtdoc = process.env['NODE_ENV'] !== 'production', } = {}) {
@@ -1,4 +1,4 @@
1
1
  import type { Response } from 'express';
2
- import type { RPCResponse } from '../../types';
2
+ import type { RPCResponse } from '../../types.js';
3
3
  export declare function respond(res: Response, payload: RPCResponse | undefined): Promise<void>;
4
4
  //# sourceMappingURL=respond.d.ts.map
@@ -1,4 +1,4 @@
1
- import { stringifyStream } from '../../stream/stringify-stream';
1
+ import { stringifyStream } from '../../stream/stringify-stream.js';
2
2
  function isStreamSuccess(payload) {
3
3
  return (!!payload &&
4
4
  typeof payload === 'object' &&
@@ -1,2 +1,2 @@
1
- export { serveStdio, type StdioOptions } from './middleware';
1
+ export { serveStdio, type StdioOptions } from './middleware.js';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1,2 +1,2 @@
1
- export { serveStdio } from './middleware';
1
+ export { serveStdio } from './middleware.js';
2
2
  //# sourceMappingURL=index.js.map
@@ -1,6 +1,6 @@
1
1
  import type { Readable, Writable } from 'node:stream';
2
- import { Repository } from '../../core/Repository';
3
- import type { InjectableFactory, RPCErrorTransform, RPCResponse } from '../../types';
2
+ import { Repository } from '../../core/Repository.js';
3
+ import type { InjectableFactory, RPCErrorTransform, RPCResponse } from '../../types.js';
4
4
  export interface StdioOptions {
5
5
  repository?: Repository;
6
6
  /** Input stream (default: `process.stdin`). */
@@ -1,8 +1,8 @@
1
1
  import { StringDecoder } from 'node:string_decoder';
2
- import { Repository } from '../../core/Repository';
3
- import { INTERNAL_ERROR, PARSE_ERROR } from '../../errors/codes';
4
- import { RPCVersion } from '../../schema/z/protocol';
5
- import { stringify } from '../../stream/stringify-stream';
2
+ import { Repository } from '../../core/Repository.js';
3
+ import { INTERNAL_ERROR, PARSE_ERROR } from '../../errors/codes.js';
4
+ import { RPCVersion } from '../../schema/z/protocol.js';
5
+ import { stringify } from '../../stream/stringify-stream.js';
6
6
  function isStreamSuccess(payload) {
7
7
  return (!!payload &&
8
8
  typeof payload === 'object' &&
@@ -1,3 +1,3 @@
1
- export { attachWebSocket, type WSOptions } from './middleware';
2
- export { createWebSocketServer, type StandaloneWsOptions, type StandaloneWsHandle, } from './standalone';
1
+ export { attachWebSocket, type WSOptions } from './middleware.js';
2
+ export { createWebSocketServer, type StandaloneWsOptions, type StandaloneWsHandle, } from './standalone.js';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1,3 +1,3 @@
1
- export { attachWebSocket } from './middleware';
2
- export { createWebSocketServer, } from './standalone';
1
+ export { attachWebSocket } from './middleware.js';
2
+ export { createWebSocketServer, } from './standalone.js';
3
3
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  import type { IncomingMessage, Server } from 'node:http';
2
2
  import { WebSocketServer, WebSocket } from 'ws';
3
- import { Repository } from '../../core/Repository';
4
- import type { InjectableFactory, RPCErrorTransform } from '../../types';
3
+ import { Repository } from '../../core/Repository.js';
4
+ import type { InjectableFactory, RPCErrorTransform } from '../../types.js';
5
5
  export interface WSOptions {
6
6
  /** Build injectables for a WS connection. */
7
7
  mkInjectable?: InjectableFactory;
@@ -1,7 +1,7 @@
1
1
  import { WebSocketServer, WebSocket } from 'ws';
2
- import { INTERNAL_ERROR, PARSE_ERROR } from '../../errors/codes';
3
- import { stringify } from "../../stream/stringify-stream";
4
- import { RPCVersion } from '../../schema/z/protocol';
2
+ import { INTERNAL_ERROR, PARSE_ERROR } from '../../errors/codes.js';
3
+ import { stringify } from "../../stream/stringify-stream.js";
4
+ import { RPCVersion } from '../../schema/z/protocol.js';
5
5
  function isStreamSuccess(payload) {
6
6
  return (!!payload &&
7
7
  typeof payload === 'object' &&
@@ -1,6 +1,6 @@
1
1
  import { type Server } from 'node:http';
2
2
  import { WebSocketServer } from 'ws';
3
- import { type WSOptions } from './middleware';
3
+ import { type WSOptions } from './middleware.js';
4
4
  export interface StandaloneWsOptions extends WSOptions {
5
5
  /** Existing HTTP server to attach to. If omitted, one is created. */
6
6
  server?: Server;
@@ -1,6 +1,6 @@
1
1
  import { createServer } from 'node:http';
2
- import { Repository } from '../../core/Repository';
3
- import { attachWebSocket } from './middleware';
2
+ import { Repository } from '../../core/Repository.js';
3
+ import { attachWebSocket } from './middleware.js';
4
4
  /**
5
5
  * Create a standalone HTTP server (unless one is provided) and attach the
6
6
  * JSON-RPC WebSocket endpoint. Returns a handle for clean shutdown.
package/dist/types.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { RPCError } from './errors/RPCError';
2
- import * as s from "./schema/json";
3
- import type { RPCVersion } from "./schema/z/protocol";
1
+ import { RPCError } from './errors/RPCError.js';
2
+ import * as s from "./schema/json/index.js";
3
+ import type { RPCVersion } from "./schema/z/protocol.js";
4
4
  export type RPCReturnSlot = s.Schema<unknown> | s.VoidMarker | s.StreamMarker<unknown>;
5
5
  export type RPCParamSlot = s.Schema<unknown> | s.InjectableMarker;
6
6
  export type RPCSignature = [RPCReturnSlot, ...RPCParamSlot[]];
@@ -11,7 +11,7 @@ export type RPCDescriptor = {
11
11
  grantTo?: string[];
12
12
  signature: RPCSignature;
13
13
  };
14
- import { Repository } from "./core/Repository";
14
+ import { Repository } from "./core/Repository.js";
15
15
  export type RPCHandler = (...args: any[]) => unknown;
16
16
  export type RPCRegisterArgs = [RPCDescriptor, RPCHandler];
17
17
  export type RPCReqId = string | number;
@@ -726,4 +726,17 @@ textarea:focus {
726
726
  .split-button {
727
727
  display: inline-flex;
728
728
  }
729
+ }
730
+
731
+ /* ---- 耗时徽章(TestPanel 结果区) ---- */
732
+ .elapsed-badge {
733
+ color: var(--syn-number);
734
+ font-size: 12px;
735
+ font-weight: normal;
736
+ letter-spacing: 0;
737
+ text-transform: none;
738
+ }
739
+
740
+ .elapsed-badge .hint {
741
+ font-size: 11px;
729
742
  }