ts-procedures 5.10.0 → 5.10.2
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/agent_config/bin/postinstall.mjs +3 -3
- package/agent_config/bin/setup.mjs +22 -11
- package/agent_config/claude-code/agents/ts-procedures-architect.md +2 -2
- package/agent_config/claude-code/skills/{guide → ts-procedures}/SKILL.md +1 -1
- package/agent_config/claude-code/skills/{review → ts-procedures-review}/SKILL.md +3 -3
- package/agent_config/claude-code/skills/{scaffold → ts-procedures-scaffold}/SKILL.md +2 -2
- package/agent_config/lib/install-claude.mjs +35 -87
- package/build/src/client/call.d.ts +14 -0
- package/build/src/client/call.js +47 -0
- package/build/src/client/call.js.map +1 -0
- package/build/src/client/call.test.d.ts +1 -0
- package/build/src/client/call.test.js +124 -0
- package/build/src/client/call.test.js.map +1 -0
- package/build/src/client/errors.d.ts +25 -0
- package/build/src/client/errors.js +33 -0
- package/build/src/client/errors.js.map +1 -0
- package/build/src/client/errors.test.d.ts +1 -0
- package/build/src/client/errors.test.js +41 -0
- package/build/src/client/errors.test.js.map +1 -0
- package/build/src/client/fetch-adapter.d.ts +12 -0
- package/build/src/client/fetch-adapter.js +156 -0
- package/build/src/client/fetch-adapter.js.map +1 -0
- package/build/src/client/fetch-adapter.test.d.ts +1 -0
- package/build/src/client/fetch-adapter.test.js +271 -0
- package/build/src/client/fetch-adapter.test.js.map +1 -0
- package/build/src/client/hooks.d.ts +17 -0
- package/build/src/client/hooks.js +40 -0
- package/build/src/client/hooks.js.map +1 -0
- package/build/src/client/hooks.test.d.ts +1 -0
- package/build/src/client/hooks.test.js +163 -0
- package/build/src/client/hooks.test.js.map +1 -0
- package/build/src/client/index.d.ts +22 -0
- package/build/src/client/index.js +67 -0
- package/build/src/client/index.js.map +1 -0
- package/build/src/client/index.test.d.ts +1 -0
- package/build/src/client/index.test.js +231 -0
- package/build/src/client/index.test.js.map +1 -0
- package/build/src/client/request-builder.d.ts +13 -0
- package/build/src/client/request-builder.js +53 -0
- package/build/src/client/request-builder.js.map +1 -0
- package/build/src/client/request-builder.test.d.ts +1 -0
- package/build/src/client/request-builder.test.js +160 -0
- package/build/src/client/request-builder.test.js.map +1 -0
- package/build/src/client/stream.d.ts +27 -0
- package/build/src/client/stream.js +118 -0
- package/build/src/client/stream.js.map +1 -0
- package/build/src/client/stream.test.d.ts +1 -0
- package/build/src/client/stream.test.js +228 -0
- package/build/src/client/stream.test.js.map +1 -0
- package/build/src/client/types.d.ts +78 -0
- package/build/src/client/types.js +3 -0
- package/build/src/client/types.js.map +1 -0
- package/build/src/codegen/bin/cli.d.ts +45 -0
- package/build/src/codegen/bin/cli.js +246 -0
- package/build/src/codegen/bin/cli.js.map +1 -0
- package/build/src/codegen/bin/cli.test.d.ts +1 -0
- package/build/src/codegen/bin/cli.test.js +220 -0
- package/build/src/codegen/bin/cli.test.js.map +1 -0
- package/build/src/codegen/constants.d.ts +1 -0
- package/build/src/codegen/constants.js +2 -0
- package/build/src/codegen/constants.js.map +1 -0
- package/build/src/codegen/e2e.test.d.ts +1 -0
- package/build/src/codegen/e2e.test.js +464 -0
- package/build/src/codegen/e2e.test.js.map +1 -0
- package/build/src/codegen/emit-client-runtime.d.ts +9 -0
- package/build/src/codegen/emit-client-runtime.js +99 -0
- package/build/src/codegen/emit-client-runtime.js.map +1 -0
- package/build/src/codegen/emit-client-runtime.test.d.ts +1 -0
- package/build/src/codegen/emit-client-runtime.test.js +78 -0
- package/build/src/codegen/emit-client-runtime.test.js.map +1 -0
- package/build/src/codegen/emit-client-types.d.ts +8 -0
- package/build/src/codegen/emit-client-types.js +25 -0
- package/build/src/codegen/emit-client-types.js.map +1 -0
- package/build/src/codegen/emit-client-types.test.d.ts +1 -0
- package/build/src/codegen/emit-client-types.test.js +33 -0
- package/build/src/codegen/emit-client-types.test.js.map +1 -0
- package/build/src/codegen/emit-errors.d.ts +19 -0
- package/build/src/codegen/emit-errors.js +59 -0
- package/build/src/codegen/emit-errors.js.map +1 -0
- package/build/src/codegen/emit-errors.test.d.ts +1 -0
- package/build/src/codegen/emit-errors.test.js +175 -0
- package/build/src/codegen/emit-errors.test.js.map +1 -0
- package/build/src/codegen/emit-index.d.ts +12 -0
- package/build/src/codegen/emit-index.js +41 -0
- package/build/src/codegen/emit-index.js.map +1 -0
- package/build/src/codegen/emit-index.test.d.ts +1 -0
- package/build/src/codegen/emit-index.test.js +106 -0
- package/build/src/codegen/emit-index.test.js.map +1 -0
- package/build/src/codegen/emit-scope.d.ts +15 -0
- package/build/src/codegen/emit-scope.js +299 -0
- package/build/src/codegen/emit-scope.js.map +1 -0
- package/build/src/codegen/emit-scope.test.d.ts +1 -0
- package/build/src/codegen/emit-scope.test.js +559 -0
- package/build/src/codegen/emit-scope.test.js.map +1 -0
- package/build/src/codegen/emit-types.d.ts +43 -0
- package/build/src/codegen/emit-types.js +111 -0
- package/build/src/codegen/emit-types.js.map +1 -0
- package/build/src/codegen/emit-types.test.d.ts +1 -0
- package/build/src/codegen/emit-types.test.js +184 -0
- package/build/src/codegen/emit-types.test.js.map +1 -0
- package/build/src/codegen/group-routes.d.ts +23 -0
- package/build/src/codegen/group-routes.js +46 -0
- package/build/src/codegen/group-routes.js.map +1 -0
- package/build/src/codegen/group-routes.test.d.ts +1 -0
- package/build/src/codegen/group-routes.test.js +131 -0
- package/build/src/codegen/group-routes.test.js.map +1 -0
- package/build/src/codegen/index.d.ts +15 -0
- package/build/src/codegen/index.js +16 -0
- package/build/src/codegen/index.js.map +1 -0
- package/build/src/codegen/naming.d.ts +7 -0
- package/build/src/codegen/naming.js +21 -0
- package/build/src/codegen/naming.js.map +1 -0
- package/build/src/codegen/naming.test.d.ts +1 -0
- package/build/src/codegen/naming.test.js +40 -0
- package/build/src/codegen/naming.test.js.map +1 -0
- package/build/src/codegen/pipeline.d.ts +17 -0
- package/build/src/codegen/pipeline.js +78 -0
- package/build/src/codegen/pipeline.js.map +1 -0
- package/build/src/codegen/pipeline.test.d.ts +1 -0
- package/build/src/codegen/pipeline.test.js +269 -0
- package/build/src/codegen/pipeline.test.js.map +1 -0
- package/build/src/codegen/resolve-envelope.d.ts +7 -0
- package/build/src/codegen/resolve-envelope.js +46 -0
- package/build/src/codegen/resolve-envelope.js.map +1 -0
- package/build/src/codegen/resolve-envelope.test.d.ts +1 -0
- package/build/src/codegen/resolve-envelope.test.js +69 -0
- package/build/src/codegen/resolve-envelope.test.js.map +1 -0
- package/build/src/errors.d.ts +33 -0
- package/build/src/errors.js +91 -0
- package/build/src/errors.js.map +1 -0
- package/build/src/errors.test.d.ts +1 -0
- package/build/src/errors.test.js +122 -0
- package/build/src/errors.test.js.map +1 -0
- package/build/src/exports.d.ts +7 -0
- package/build/src/exports.js +8 -0
- package/build/src/exports.js.map +1 -0
- package/build/src/implementations/http/doc-registry.d.ts +12 -0
- package/build/src/implementations/http/doc-registry.js +114 -0
- package/build/src/implementations/http/doc-registry.js.map +1 -0
- package/build/src/implementations/http/doc-registry.test.d.ts +1 -0
- package/build/src/implementations/http/doc-registry.test.js +347 -0
- package/build/src/implementations/http/doc-registry.test.js.map +1 -0
- package/build/src/implementations/http/express-rpc/index.d.ts +94 -0
- package/build/src/implementations/http/express-rpc/index.js +185 -0
- package/build/src/implementations/http/express-rpc/index.js.map +1 -0
- package/build/src/implementations/http/express-rpc/index.test.d.ts +1 -0
- package/build/src/implementations/http/express-rpc/index.test.js +684 -0
- package/build/src/implementations/http/express-rpc/index.test.js.map +1 -0
- package/build/src/implementations/http/express-rpc/types.d.ts +11 -0
- package/build/src/implementations/http/express-rpc/types.js +2 -0
- package/build/src/implementations/http/express-rpc/types.js.map +1 -0
- package/build/src/implementations/http/hono-api/index.d.ts +102 -0
- package/build/src/implementations/http/hono-api/index.js +341 -0
- package/build/src/implementations/http/hono-api/index.js.map +1 -0
- package/build/src/implementations/http/hono-api/index.test.d.ts +1 -0
- package/build/src/implementations/http/hono-api/index.test.js +992 -0
- package/build/src/implementations/http/hono-api/index.test.js.map +1 -0
- package/build/src/implementations/http/hono-api/types.d.ts +13 -0
- package/build/src/implementations/http/hono-api/types.js +2 -0
- package/build/src/implementations/http/hono-api/types.js.map +1 -0
- package/build/src/implementations/http/hono-rpc/index.d.ts +92 -0
- package/build/src/implementations/http/hono-rpc/index.js +161 -0
- package/build/src/implementations/http/hono-rpc/index.js.map +1 -0
- package/build/src/implementations/http/hono-rpc/index.test.d.ts +1 -0
- package/build/src/implementations/http/hono-rpc/index.test.js +803 -0
- package/build/src/implementations/http/hono-rpc/index.test.js.map +1 -0
- package/build/src/implementations/http/hono-rpc/types.d.ts +11 -0
- package/build/src/implementations/http/hono-rpc/types.js +2 -0
- package/build/src/implementations/http/hono-rpc/types.js.map +1 -0
- package/build/src/implementations/http/hono-stream/index.d.ts +120 -0
- package/build/src/implementations/http/hono-stream/index.js +309 -0
- package/build/src/implementations/http/hono-stream/index.js.map +1 -0
- package/build/src/implementations/http/hono-stream/index.test.d.ts +1 -0
- package/build/src/implementations/http/hono-stream/index.test.js +1356 -0
- package/build/src/implementations/http/hono-stream/index.test.js.map +1 -0
- package/build/src/implementations/http/hono-stream/types.d.ts +15 -0
- package/build/src/implementations/http/hono-stream/types.js +2 -0
- package/build/src/implementations/http/hono-stream/types.js.map +1 -0
- package/build/src/implementations/types.d.ts +142 -0
- package/build/src/implementations/types.js +2 -0
- package/build/src/implementations/types.js.map +1 -0
- package/build/src/index.d.ts +165 -0
- package/build/src/index.js +253 -0
- package/build/src/index.js.map +1 -0
- package/build/src/index.test.d.ts +1 -0
- package/build/src/index.test.js +890 -0
- package/build/src/index.test.js.map +1 -0
- package/build/src/schema/compute-schema.d.ts +35 -0
- package/build/src/schema/compute-schema.js +41 -0
- package/build/src/schema/compute-schema.js.map +1 -0
- package/build/src/schema/compute-schema.test.d.ts +1 -0
- package/build/src/schema/compute-schema.test.js +107 -0
- package/build/src/schema/compute-schema.test.js.map +1 -0
- package/build/src/schema/extract-json-schema.d.ts +2 -0
- package/build/src/schema/extract-json-schema.js +12 -0
- package/build/src/schema/extract-json-schema.js.map +1 -0
- package/build/src/schema/extract-json-schema.test.d.ts +1 -0
- package/build/src/schema/extract-json-schema.test.js +23 -0
- package/build/src/schema/extract-json-schema.test.js.map +1 -0
- package/build/src/schema/parser.d.ts +28 -0
- package/build/src/schema/parser.js +170 -0
- package/build/src/schema/parser.js.map +1 -0
- package/build/src/schema/parser.test.d.ts +1 -0
- package/build/src/schema/parser.test.js +120 -0
- package/build/src/schema/parser.test.js.map +1 -0
- package/build/src/schema/resolve-schema-lib.d.ts +12 -0
- package/build/src/schema/resolve-schema-lib.js +11 -0
- package/build/src/schema/resolve-schema-lib.js.map +1 -0
- package/build/src/schema/resolve-schema-lib.test.d.ts +1 -0
- package/build/src/schema/resolve-schema-lib.test.js +17 -0
- package/build/src/schema/resolve-schema-lib.test.js.map +1 -0
- package/build/src/schema/types.d.ts +8 -0
- package/build/src/schema/types.js +2 -0
- package/build/src/schema/types.js.map +1 -0
- package/build/src/stack-utils.d.ts +25 -0
- package/build/src/stack-utils.js +95 -0
- package/build/src/stack-utils.js.map +1 -0
- package/build/src/stack-utils.test.d.ts +1 -0
- package/build/src/stack-utils.test.js +80 -0
- package/build/src/stack-utils.test.js.map +1 -0
- package/docs/ai-agent-setup.md +7 -6
- package/package.json +1 -1
- /package/agent_config/claude-code/skills/{guide → ts-procedures}/anti-patterns.md +0 -0
- /package/agent_config/claude-code/skills/{guide → ts-procedures}/api-reference.md +0 -0
- /package/agent_config/claude-code/skills/{guide → ts-procedures}/patterns.md +0 -0
- /package/agent_config/claude-code/skills/{review → ts-procedures-review}/checklist.md +0 -0
- /package/agent_config/claude-code/skills/{scaffold → ts-procedures-scaffold}/templates/client.md +0 -0
- /package/agent_config/claude-code/skills/{scaffold → ts-procedures-scaffold}/templates/express-rpc.md +0 -0
- /package/agent_config/claude-code/skills/{scaffold → ts-procedures-scaffold}/templates/hono-api.md +0 -0
- /package/agent_config/claude-code/skills/{scaffold → ts-procedures-scaffold}/templates/hono-rpc.md +0 -0
- /package/agent_config/claude-code/skills/{scaffold → ts-procedures-scaffold}/templates/hono-stream.md +0 -0
- /package/agent_config/claude-code/skills/{scaffold → ts-procedures-scaffold}/templates/procedure.md +0 -0
- /package/agent_config/claude-code/skills/{scaffold → ts-procedures-scaffold}/templates/stream-procedure.md +0 -0
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
import { describe, expect, it, test } from 'vitest';
|
|
2
|
+
import { v } from 'suretype';
|
|
3
|
+
import { Procedures } from '../../index.js';
|
|
4
|
+
import { HonoRPCAppBuilder } from './hono-rpc/index.js';
|
|
5
|
+
import { DocRegistry } from './doc-registry.js';
|
|
6
|
+
// ---------------------------------------------------------------------------
|
|
7
|
+
// Helpers — minimal doc fixtures
|
|
8
|
+
// ---------------------------------------------------------------------------
|
|
9
|
+
const rpcDoc = {
|
|
10
|
+
kind: 'rpc',
|
|
11
|
+
name: 'Echo',
|
|
12
|
+
path: '/echo/1',
|
|
13
|
+
method: 'post',
|
|
14
|
+
scope: 'echo',
|
|
15
|
+
version: 1,
|
|
16
|
+
jsonSchema: { body: { type: 'object' } },
|
|
17
|
+
};
|
|
18
|
+
const apiDoc = {
|
|
19
|
+
kind: 'api',
|
|
20
|
+
name: 'GetUser',
|
|
21
|
+
path: '/users/:id',
|
|
22
|
+
method: 'get',
|
|
23
|
+
fullPath: '/api/users/:id',
|
|
24
|
+
jsonSchema: { pathParams: { type: 'object' } },
|
|
25
|
+
};
|
|
26
|
+
const streamDoc = {
|
|
27
|
+
kind: 'stream',
|
|
28
|
+
name: 'Feed',
|
|
29
|
+
path: '/feed/1',
|
|
30
|
+
methods: ['get'],
|
|
31
|
+
streamMode: 'sse',
|
|
32
|
+
scope: 'feed',
|
|
33
|
+
version: 1,
|
|
34
|
+
jsonSchema: { yieldType: { type: 'object' } },
|
|
35
|
+
};
|
|
36
|
+
function makeSource(docs) {
|
|
37
|
+
return { docs };
|
|
38
|
+
}
|
|
39
|
+
// ---------------------------------------------------------------------------
|
|
40
|
+
// Tests
|
|
41
|
+
// ---------------------------------------------------------------------------
|
|
42
|
+
describe('DocRegistry', () => {
|
|
43
|
+
// --------------------------------------------------------------------------
|
|
44
|
+
// Constructor
|
|
45
|
+
// --------------------------------------------------------------------------
|
|
46
|
+
describe('constructor', () => {
|
|
47
|
+
test('uses defaults when no config provided', () => {
|
|
48
|
+
const registry = new DocRegistry();
|
|
49
|
+
const out = registry.toJSON();
|
|
50
|
+
expect(out.basePath).toBe('');
|
|
51
|
+
expect(out.headers).toEqual([]);
|
|
52
|
+
expect(out.errors).toEqual([]);
|
|
53
|
+
});
|
|
54
|
+
test('accepts partial config', () => {
|
|
55
|
+
const registry = new DocRegistry({ basePath: '/v1' });
|
|
56
|
+
const out = registry.toJSON();
|
|
57
|
+
expect(out.basePath).toBe('/v1');
|
|
58
|
+
expect(out.headers).toEqual([]);
|
|
59
|
+
expect(out.errors).toEqual([]);
|
|
60
|
+
});
|
|
61
|
+
test('accepts full config', () => {
|
|
62
|
+
const headers = [{ name: 'Authorization', description: 'Bearer token', required: true }];
|
|
63
|
+
const errors = [{ name: 'Unauthorized', statusCode: 401, description: 'Missing token' }];
|
|
64
|
+
const registry = new DocRegistry({ basePath: '/api', headers, errors });
|
|
65
|
+
const out = registry.toJSON();
|
|
66
|
+
expect(out.basePath).toBe('/api');
|
|
67
|
+
expect(out.headers).toEqual(headers);
|
|
68
|
+
expect(out.errors).toEqual(errors);
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
// --------------------------------------------------------------------------
|
|
72
|
+
// from()
|
|
73
|
+
// --------------------------------------------------------------------------
|
|
74
|
+
describe('from()', () => {
|
|
75
|
+
test('returns this for chaining', () => {
|
|
76
|
+
const registry = new DocRegistry();
|
|
77
|
+
const result = registry.from(makeSource([rpcDoc]));
|
|
78
|
+
expect(result).toBe(registry);
|
|
79
|
+
});
|
|
80
|
+
test('accepts RPC builder source', () => {
|
|
81
|
+
const registry = new DocRegistry().from(makeSource([rpcDoc]));
|
|
82
|
+
expect(registry.toJSON().routes).toEqual([rpcDoc]);
|
|
83
|
+
});
|
|
84
|
+
test('accepts API builder source', () => {
|
|
85
|
+
const registry = new DocRegistry().from(makeSource([apiDoc]));
|
|
86
|
+
expect(registry.toJSON().routes).toEqual([apiDoc]);
|
|
87
|
+
});
|
|
88
|
+
test('accepts Stream builder source', () => {
|
|
89
|
+
const registry = new DocRegistry().from(makeSource([streamDoc]));
|
|
90
|
+
expect(registry.toJSON().routes).toEqual([streamDoc]);
|
|
91
|
+
});
|
|
92
|
+
test('accepts plain { docs } object', () => {
|
|
93
|
+
const plain = { docs: [rpcDoc, apiDoc] };
|
|
94
|
+
const registry = new DocRegistry().from(plain);
|
|
95
|
+
expect(registry.toJSON().routes).toHaveLength(2);
|
|
96
|
+
});
|
|
97
|
+
test('builder not yet built returns empty routes', () => {
|
|
98
|
+
const emptySource = makeSource([]);
|
|
99
|
+
const registry = new DocRegistry().from(emptySource);
|
|
100
|
+
expect(registry.toJSON().routes).toEqual([]);
|
|
101
|
+
});
|
|
102
|
+
test('same builder twice duplicates routes', () => {
|
|
103
|
+
const source = makeSource([rpcDoc]);
|
|
104
|
+
const registry = new DocRegistry().from(source).from(source);
|
|
105
|
+
expect(registry.toJSON().routes).toHaveLength(2);
|
|
106
|
+
expect(registry.toJSON().routes[0]).toEqual(registry.toJSON().routes[1]);
|
|
107
|
+
});
|
|
108
|
+
test('reads docs lazily at toJSON() time', () => {
|
|
109
|
+
const mutableDocs = [];
|
|
110
|
+
const source = { get docs() { return mutableDocs; } };
|
|
111
|
+
const registry = new DocRegistry().from(source);
|
|
112
|
+
expect(registry.toJSON().routes).toHaveLength(0);
|
|
113
|
+
mutableDocs.push(rpcDoc);
|
|
114
|
+
expect(registry.toJSON().routes).toHaveLength(1);
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
// --------------------------------------------------------------------------
|
|
118
|
+
// toJSON()
|
|
119
|
+
// --------------------------------------------------------------------------
|
|
120
|
+
describe('toJSON()', () => {
|
|
121
|
+
test('returns correct DocEnvelope shape', () => {
|
|
122
|
+
const registry = new DocRegistry({ basePath: '/api' });
|
|
123
|
+
const out = registry.toJSON();
|
|
124
|
+
expect(out).toHaveProperty('basePath');
|
|
125
|
+
expect(out).toHaveProperty('headers');
|
|
126
|
+
expect(out).toHaveProperty('errors');
|
|
127
|
+
expect(out).toHaveProperty('routes');
|
|
128
|
+
});
|
|
129
|
+
test('collects routes from all sources', () => {
|
|
130
|
+
const registry = new DocRegistry()
|
|
131
|
+
.from(makeSource([rpcDoc]))
|
|
132
|
+
.from(makeSource([apiDoc]))
|
|
133
|
+
.from(makeSource([streamDoc]));
|
|
134
|
+
const out = registry.toJSON();
|
|
135
|
+
expect(out.routes).toHaveLength(3);
|
|
136
|
+
expect(out.routes).toEqual([rpcDoc, apiDoc, streamDoc]);
|
|
137
|
+
});
|
|
138
|
+
test('empty when no sources', () => {
|
|
139
|
+
const out = new DocRegistry().toJSON();
|
|
140
|
+
expect(out.routes).toEqual([]);
|
|
141
|
+
});
|
|
142
|
+
test('headers and errors are copies', () => {
|
|
143
|
+
const headers = [{ name: 'X-Custom' }];
|
|
144
|
+
const errors = [{ name: 'E', statusCode: 500, description: 'd' }];
|
|
145
|
+
const registry = new DocRegistry({ headers, errors });
|
|
146
|
+
const out = registry.toJSON();
|
|
147
|
+
expect(out.headers).toEqual(headers);
|
|
148
|
+
expect(out.headers).not.toBe(headers);
|
|
149
|
+
expect(out.errors).toEqual(errors);
|
|
150
|
+
expect(out.errors).not.toBe(errors);
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
// --------------------------------------------------------------------------
|
|
154
|
+
// toJSON() filter
|
|
155
|
+
// --------------------------------------------------------------------------
|
|
156
|
+
describe('toJSON() filter', () => {
|
|
157
|
+
test('excludes routes by name', () => {
|
|
158
|
+
const registry = new DocRegistry()
|
|
159
|
+
.from(makeSource([rpcDoc]))
|
|
160
|
+
.from(makeSource([apiDoc]));
|
|
161
|
+
const out = registry.toJSON({ filter: (r) => r.name !== 'Echo' });
|
|
162
|
+
expect(out.routes).toHaveLength(1);
|
|
163
|
+
expect(out.routes[0].name).toBe('GetUser');
|
|
164
|
+
});
|
|
165
|
+
test('excludes routes by type field', () => {
|
|
166
|
+
const registry = new DocRegistry()
|
|
167
|
+
.from(makeSource([rpcDoc]))
|
|
168
|
+
.from(makeSource([apiDoc]));
|
|
169
|
+
const out = registry.toJSON({
|
|
170
|
+
filter: (r) => 'method' in r && r.method === 'post' && 'scope' in r,
|
|
171
|
+
});
|
|
172
|
+
expect(out.routes).toHaveLength(1);
|
|
173
|
+
expect(out.routes[0].name).toBe('Echo');
|
|
174
|
+
});
|
|
175
|
+
test('all filtered returns empty routes array', () => {
|
|
176
|
+
const registry = new DocRegistry().from(makeSource([rpcDoc]));
|
|
177
|
+
const out = registry.toJSON({ filter: () => false });
|
|
178
|
+
expect(out.routes).toEqual([]);
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
// --------------------------------------------------------------------------
|
|
182
|
+
// toJSON() transform
|
|
183
|
+
// --------------------------------------------------------------------------
|
|
184
|
+
describe('toJSON() transform', () => {
|
|
185
|
+
test('adds fields', () => {
|
|
186
|
+
const registry = new DocRegistry({ basePath: '/api' }).from(makeSource([rpcDoc]));
|
|
187
|
+
const out = registry.toJSON({
|
|
188
|
+
transform: (envelope) => ({ ...envelope, version: '2.0' }),
|
|
189
|
+
});
|
|
190
|
+
expect(out.version).toBe('2.0');
|
|
191
|
+
expect(out.basePath).toBe('/api');
|
|
192
|
+
});
|
|
193
|
+
test('reshapes envelope', () => {
|
|
194
|
+
const registry = new DocRegistry().from(makeSource([rpcDoc]));
|
|
195
|
+
const out = registry.toJSON({
|
|
196
|
+
transform: (envelope) => ({ count: envelope.routes.length }),
|
|
197
|
+
});
|
|
198
|
+
expect(out).toEqual({ count: 1 });
|
|
199
|
+
});
|
|
200
|
+
test('runs after filter', () => {
|
|
201
|
+
const registry = new DocRegistry()
|
|
202
|
+
.from(makeSource([rpcDoc]))
|
|
203
|
+
.from(makeSource([apiDoc]));
|
|
204
|
+
const out = registry.toJSON({
|
|
205
|
+
filter: (r) => r.name === 'Echo',
|
|
206
|
+
transform: (envelope) => ({ ...envelope, filteredCount: envelope.routes.length }),
|
|
207
|
+
});
|
|
208
|
+
expect(out.filteredCount).toBe(1);
|
|
209
|
+
expect(out.routes).toHaveLength(1);
|
|
210
|
+
});
|
|
211
|
+
});
|
|
212
|
+
// --------------------------------------------------------------------------
|
|
213
|
+
// defaultErrors()
|
|
214
|
+
// --------------------------------------------------------------------------
|
|
215
|
+
describe('defaultErrors()', () => {
|
|
216
|
+
test('returns 4 entries', () => {
|
|
217
|
+
const errors = DocRegistry.defaultErrors();
|
|
218
|
+
expect(errors).toHaveLength(4);
|
|
219
|
+
});
|
|
220
|
+
test('has correct error names', () => {
|
|
221
|
+
const names = DocRegistry.defaultErrors().map((e) => e.name);
|
|
222
|
+
expect(names).toEqual([
|
|
223
|
+
'ProcedureError',
|
|
224
|
+
'ProcedureValidationError',
|
|
225
|
+
'ProcedureYieldValidationError',
|
|
226
|
+
'ProcedureRegistrationError',
|
|
227
|
+
]);
|
|
228
|
+
});
|
|
229
|
+
test('has correct status codes', () => {
|
|
230
|
+
const errors = DocRegistry.defaultErrors();
|
|
231
|
+
expect(errors[0].statusCode).toBe(500); // ProcedureError
|
|
232
|
+
expect(errors[1].statusCode).toBe(400); // ProcedureValidationError
|
|
233
|
+
expect(errors[2].statusCode).toBe(500); // ProcedureYieldValidationError
|
|
234
|
+
expect(errors[3].statusCode).toBe(500); // ProcedureRegistrationError
|
|
235
|
+
});
|
|
236
|
+
test('each entry has schema', () => {
|
|
237
|
+
for (const err of DocRegistry.defaultErrors()) {
|
|
238
|
+
expect(err.schema).toBeDefined();
|
|
239
|
+
expect(err.schema.type).toBe('object');
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
test('returns a new array each call', () => {
|
|
243
|
+
const a = DocRegistry.defaultErrors();
|
|
244
|
+
const b = DocRegistry.defaultErrors();
|
|
245
|
+
expect(a).not.toBe(b);
|
|
246
|
+
expect(a).toEqual(b);
|
|
247
|
+
});
|
|
248
|
+
});
|
|
249
|
+
// --------------------------------------------------------------------------
|
|
250
|
+
// kind discriminant
|
|
251
|
+
// --------------------------------------------------------------------------
|
|
252
|
+
describe('kind discriminant', () => {
|
|
253
|
+
it('rpcDoc fixture requires kind field', () => {
|
|
254
|
+
const doc = rpcDoc;
|
|
255
|
+
expect(doc.kind).toBe('rpc');
|
|
256
|
+
});
|
|
257
|
+
it('apiDoc fixture requires kind field', () => {
|
|
258
|
+
const doc = apiDoc;
|
|
259
|
+
expect(doc.kind).toBe('api');
|
|
260
|
+
});
|
|
261
|
+
it('streamDoc fixture requires kind field', () => {
|
|
262
|
+
const doc = streamDoc;
|
|
263
|
+
expect(doc.kind).toBe('stream');
|
|
264
|
+
});
|
|
265
|
+
it('narrows AnyHttpRouteDoc union via kind', () => {
|
|
266
|
+
const routes = [rpcDoc, apiDoc, streamDoc];
|
|
267
|
+
for (const route of routes) {
|
|
268
|
+
expect(route.kind).toBeDefined();
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
});
|
|
272
|
+
// --------------------------------------------------------------------------
|
|
273
|
+
// Integration
|
|
274
|
+
// --------------------------------------------------------------------------
|
|
275
|
+
describe('integration', () => {
|
|
276
|
+
test('multiple builder types composed', () => {
|
|
277
|
+
const registry = new DocRegistry({
|
|
278
|
+
basePath: '/api',
|
|
279
|
+
headers: [{ name: 'Authorization', description: 'Bearer token', required: false }],
|
|
280
|
+
errors: DocRegistry.defaultErrors(),
|
|
281
|
+
})
|
|
282
|
+
.from(makeSource([rpcDoc]))
|
|
283
|
+
.from(makeSource([apiDoc]))
|
|
284
|
+
.from(makeSource([streamDoc]));
|
|
285
|
+
const out = registry.toJSON();
|
|
286
|
+
expect(out.basePath).toBe('/api');
|
|
287
|
+
expect(out.headers).toHaveLength(1);
|
|
288
|
+
expect(out.errors).toHaveLength(4);
|
|
289
|
+
expect(out.routes).toHaveLength(3);
|
|
290
|
+
});
|
|
291
|
+
test('filter + transform combined', () => {
|
|
292
|
+
const registry = new DocRegistry({
|
|
293
|
+
basePath: '/api',
|
|
294
|
+
errors: DocRegistry.defaultErrors(),
|
|
295
|
+
})
|
|
296
|
+
.from(makeSource([rpcDoc]))
|
|
297
|
+
.from(makeSource([apiDoc]))
|
|
298
|
+
.from(makeSource([streamDoc]));
|
|
299
|
+
const out = registry.toJSON({
|
|
300
|
+
filter: (r) => r.name !== 'Feed',
|
|
301
|
+
transform: (envelope) => ({
|
|
302
|
+
...envelope,
|
|
303
|
+
generatedAt: '2026-01-01',
|
|
304
|
+
}),
|
|
305
|
+
});
|
|
306
|
+
expect(out.routes).toHaveLength(2);
|
|
307
|
+
expect(out.routes.map((r) => r.name)).toEqual(['Echo', 'GetUser']);
|
|
308
|
+
expect(out.generatedAt).toBe('2026-01-01');
|
|
309
|
+
});
|
|
310
|
+
test('output is JSON.stringify-safe', () => {
|
|
311
|
+
const registry = new DocRegistry({
|
|
312
|
+
basePath: '/api',
|
|
313
|
+
headers: [{ name: 'X-Request-Id', example: 'abc-123' }],
|
|
314
|
+
errors: DocRegistry.defaultErrors(),
|
|
315
|
+
})
|
|
316
|
+
.from(makeSource([rpcDoc]))
|
|
317
|
+
.from(makeSource([apiDoc]));
|
|
318
|
+
const out = registry.toJSON();
|
|
319
|
+
const str = JSON.stringify(out);
|
|
320
|
+
expect(() => JSON.parse(str)).not.toThrow();
|
|
321
|
+
expect(JSON.parse(str)).toEqual(out);
|
|
322
|
+
});
|
|
323
|
+
test('JSON.stringify(registry) produces default envelope', () => {
|
|
324
|
+
const registry = new DocRegistry({ basePath: '/api' })
|
|
325
|
+
.from(makeSource([rpcDoc]));
|
|
326
|
+
const str = JSON.stringify(registry);
|
|
327
|
+
const parsed = JSON.parse(str);
|
|
328
|
+
expect(parsed.basePath).toBe('/api');
|
|
329
|
+
expect(parsed.routes).toHaveLength(1);
|
|
330
|
+
expect(parsed.routes[0].name).toBe('Echo');
|
|
331
|
+
});
|
|
332
|
+
test('accepts a real HonoRPCAppBuilder as source', () => {
|
|
333
|
+
const RPC = Procedures();
|
|
334
|
+
RPC.Create('Ping', { scope: 'ping', version: 1, schema: { params: v.object({ msg: v.string() }) } }, async (_ctx, params) => params);
|
|
335
|
+
const builder = new HonoRPCAppBuilder();
|
|
336
|
+
builder.register(RPC, () => ({ userId: '123' }));
|
|
337
|
+
builder.build();
|
|
338
|
+
const registry = new DocRegistry({ basePath: '/rpc' }).from(builder);
|
|
339
|
+
const out = registry.toJSON();
|
|
340
|
+
expect(out.basePath).toBe('/rpc');
|
|
341
|
+
expect(out.routes).toHaveLength(1);
|
|
342
|
+
expect(out.routes[0].name).toBe('Ping');
|
|
343
|
+
expect(out.routes[0]).toHaveProperty('jsonSchema');
|
|
344
|
+
});
|
|
345
|
+
});
|
|
346
|
+
});
|
|
347
|
+
//# sourceMappingURL=doc-registry.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doc-registry.test.js","sourceRoot":"","sources":["../../../../src/implementations/http/doc-registry.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AACnD,OAAO,EAAE,CAAC,EAAE,MAAM,UAAU,CAAA;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAW/C,8EAA8E;AAC9E,iCAAiC;AACjC,8EAA8E;AAE9E,MAAM,MAAM,GAAoB;IAC9B,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,SAAS;IACf,MAAM,EAAE,MAAM;IACd,KAAK,EAAE,MAAM;IACb,OAAO,EAAE,CAAC;IACV,UAAU,EAAE,EAAE,IAA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CAAC,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,EAAE,EAChF,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC,MAAM,CAC/B,CAAA;YAED,MAAM,OAAO,GAAG,IAAI,iBAAiB,EAAE,CAAA;YACvC,OAAO,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,CAAA;YAChD,OAAO,CAAC,KAAK,EAAE,CAAA;YAEf,MAAM,QAAQ,GAAG,IAAI,WAAW,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;YACpE,MAAM,GAAG,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAA;YAE7B,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;YACjC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAA;YAClC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAE,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;YACxC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAE,CAAC,CAAC,cAAc,CAAC,YAAY,CAAC,CAAA;QACrD,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import express from 'express';
|
|
2
|
+
import { TProcedureRegistration } from '../../../index.js';
|
|
3
|
+
import { ExtractConfig, ExtractContext, ProceduresFactory, RPCConfig, RPCHttpRouteDoc } from '../../types.js';
|
|
4
|
+
export type { RPCConfig, RPCHttpRouteDoc };
|
|
5
|
+
export type ExpressRPCAppBuilderConfig = {
|
|
6
|
+
/**
|
|
7
|
+
* An existing Express application instance to use.
|
|
8
|
+
* When provided, ensure to set up necessary middleware (e.g., json/body parser) beforehand.
|
|
9
|
+
* If not provided, a new instance will be created.
|
|
10
|
+
*/
|
|
11
|
+
app?: express.Express;
|
|
12
|
+
/** Optional path prefix for all RPC routes. */
|
|
13
|
+
pathPrefix?: string;
|
|
14
|
+
onRequestStart?: (req: express.Request) => void;
|
|
15
|
+
onRequestEnd?: (req: express.Request, res: express.Response) => void;
|
|
16
|
+
onSuccess?: (procedure: TProcedureRegistration, req: express.Request, res: express.Response) => void;
|
|
17
|
+
/**
|
|
18
|
+
* Error handler called when a procedure throws an error.
|
|
19
|
+
* @param procedure
|
|
20
|
+
* @param req
|
|
21
|
+
* @param res
|
|
22
|
+
* @param error
|
|
23
|
+
*/
|
|
24
|
+
onError?: (procedure: TProcedureRegistration, req: express.Request, res: express.Response, error: Error) => void;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Builder class for creating an Express application with RPC routes.
|
|
28
|
+
*
|
|
29
|
+
* Usage:
|
|
30
|
+
* const PublicRPC = Procedures<PublicRPCContext, RPCConfig>()
|
|
31
|
+
* const ProtectedRPC = Procedures<ProtectedRPCContext, RPCConfig>()
|
|
32
|
+
*
|
|
33
|
+
* const rpcApp = new ExpressRPCAppBuilder()
|
|
34
|
+
* .register(PublicRPC, (req): Promise<PublicRPCContext> => { /* context resolution logic * / })
|
|
35
|
+
* .register(ProtectedRPC, (req): Promise<ProtectedRPCContext> => { /* context resolution logic * / })
|
|
36
|
+
* .build();
|
|
37
|
+
*
|
|
38
|
+
* const app = rpcApp.app; // Express application
|
|
39
|
+
* const docs = rpcApp.docs; // RPC route documentation
|
|
40
|
+
*/
|
|
41
|
+
export declare class ExpressRPCAppBuilder {
|
|
42
|
+
readonly config?: ExpressRPCAppBuilderConfig | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Constructor for ExpressRPCAppBuilder.
|
|
45
|
+
*
|
|
46
|
+
* @param config
|
|
47
|
+
*/
|
|
48
|
+
constructor(config?: ExpressRPCAppBuilderConfig | undefined);
|
|
49
|
+
/**
|
|
50
|
+
* Generates the RPC route path based on the RPC configuration.
|
|
51
|
+
* The RPCConfig name can be a string or an array of strings to form nested paths.
|
|
52
|
+
*
|
|
53
|
+
* Example
|
|
54
|
+
* name: ['string', 'string-string', 'string']
|
|
55
|
+
* path: /string/string-string/string/version
|
|
56
|
+
* @param config
|
|
57
|
+
*/
|
|
58
|
+
static makeRPCHttpRoutePath({ name, config, prefix, }: {
|
|
59
|
+
name: string;
|
|
60
|
+
prefix?: string;
|
|
61
|
+
config: RPCConfig;
|
|
62
|
+
}): string;
|
|
63
|
+
/**
|
|
64
|
+
* Instance method wrapper for makeRPCHttpRoutePath that uses the builder's pathPrefix.
|
|
65
|
+
* @param config - The RPC configuration
|
|
66
|
+
*/
|
|
67
|
+
makeRPCHttpRoutePath(name: string, config: RPCConfig): string;
|
|
68
|
+
private factories;
|
|
69
|
+
private _app;
|
|
70
|
+
private _docs;
|
|
71
|
+
get app(): express.Express;
|
|
72
|
+
get docs(): RPCHttpRouteDoc[];
|
|
73
|
+
/**
|
|
74
|
+
* Registers a procedure factory with its context.
|
|
75
|
+
* @param factory - The procedure factory created by Procedures<Context, RPCConfig>()
|
|
76
|
+
* @param factoryContext - The context for procedure handlers. Can be a direct value,
|
|
77
|
+
* a sync function (req) => Context, or an async function (req) => Promise<Context>
|
|
78
|
+
* @param extendProcedureDoc - A custom function to extend the generated RPC route documentation for each procedure.
|
|
79
|
+
*/
|
|
80
|
+
register<TFactory extends ProceduresFactory>(factory: TFactory, factoryContext: ExtractContext<TFactory> | ((req: express.Request) => ExtractContext<TFactory> | Promise<ExtractContext<TFactory>>), extendProcedureDoc?: (params: {
|
|
81
|
+
base: RPCHttpRouteDoc;
|
|
82
|
+
procedure: TProcedureRegistration<any, ExtractConfig<TFactory>>;
|
|
83
|
+
}) => Record<string, any>): this;
|
|
84
|
+
/**
|
|
85
|
+
* Builds and returns the Express application with registered RPC routes.
|
|
86
|
+
* @return express.Application
|
|
87
|
+
*/
|
|
88
|
+
build(): express.Application;
|
|
89
|
+
/**
|
|
90
|
+
* Generates the RPC HTTP route for the given procedure.
|
|
91
|
+
* @param procedure
|
|
92
|
+
*/
|
|
93
|
+
private buildRpcHttpRouteDoc;
|
|
94
|
+
}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import express from 'express';
|
|
2
|
+
import { kebabCase } from 'es-toolkit/string';
|
|
3
|
+
import { castArray } from 'es-toolkit/compat';
|
|
4
|
+
/**
|
|
5
|
+
* Builder class for creating an Express application with RPC routes.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* const PublicRPC = Procedures<PublicRPCContext, RPCConfig>()
|
|
9
|
+
* const ProtectedRPC = Procedures<ProtectedRPCContext, RPCConfig>()
|
|
10
|
+
*
|
|
11
|
+
* const rpcApp = new ExpressRPCAppBuilder()
|
|
12
|
+
* .register(PublicRPC, (req): Promise<PublicRPCContext> => { /* context resolution logic * / })
|
|
13
|
+
* .register(ProtectedRPC, (req): Promise<ProtectedRPCContext> => { /* context resolution logic * / })
|
|
14
|
+
* .build();
|
|
15
|
+
*
|
|
16
|
+
* const app = rpcApp.app; // Express application
|
|
17
|
+
* const docs = rpcApp.docs; // RPC route documentation
|
|
18
|
+
*/
|
|
19
|
+
export class ExpressRPCAppBuilder {
|
|
20
|
+
config;
|
|
21
|
+
/**
|
|
22
|
+
* Constructor for ExpressRPCAppBuilder.
|
|
23
|
+
*
|
|
24
|
+
* @param config
|
|
25
|
+
*/
|
|
26
|
+
constructor(config) {
|
|
27
|
+
this.config = config;
|
|
28
|
+
if (config?.app) {
|
|
29
|
+
this._app = config.app;
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
// Default middleware if no app is provided
|
|
33
|
+
this._app.use(express.json());
|
|
34
|
+
}
|
|
35
|
+
if (config?.onRequestStart) {
|
|
36
|
+
this._app.use((req, res, next) => {
|
|
37
|
+
config.onRequestStart(req);
|
|
38
|
+
next();
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
if (config?.onRequestEnd) {
|
|
42
|
+
this._app.use((req, res, next) => {
|
|
43
|
+
res.on('finish', () => {
|
|
44
|
+
config.onRequestEnd(req, res);
|
|
45
|
+
});
|
|
46
|
+
next();
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Generates the RPC route path based on the RPC configuration.
|
|
52
|
+
* The RPCConfig name can be a string or an array of strings to form nested paths.
|
|
53
|
+
*
|
|
54
|
+
* Example
|
|
55
|
+
* name: ['string', 'string-string', 'string']
|
|
56
|
+
* path: /string/string-string/string/version
|
|
57
|
+
* @param config
|
|
58
|
+
*/
|
|
59
|
+
static makeRPCHttpRoutePath({ name, config, prefix, }) {
|
|
60
|
+
const normalizedPrefix = prefix ? (prefix.startsWith('/') ? prefix : `/${prefix}`) : '';
|
|
61
|
+
return `${normalizedPrefix}/${castArray(config.scope).map(kebabCase).join('/')}/${kebabCase(name)}/${String(config.version).trim()}`;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Instance method wrapper for makeRPCHttpRoutePath that uses the builder's pathPrefix.
|
|
65
|
+
* @param config - The RPC configuration
|
|
66
|
+
*/
|
|
67
|
+
makeRPCHttpRoutePath(name, config) {
|
|
68
|
+
return ExpressRPCAppBuilder.makeRPCHttpRoutePath({
|
|
69
|
+
name,
|
|
70
|
+
config,
|
|
71
|
+
prefix: this.config?.pathPrefix,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
factories = [];
|
|
75
|
+
_app = express();
|
|
76
|
+
_docs = [];
|
|
77
|
+
get app() {
|
|
78
|
+
return this._app;
|
|
79
|
+
}
|
|
80
|
+
get docs() {
|
|
81
|
+
return this._docs;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Registers a procedure factory with its context.
|
|
85
|
+
* @param factory - The procedure factory created by Procedures<Context, RPCConfig>()
|
|
86
|
+
* @param factoryContext - The context for procedure handlers. Can be a direct value,
|
|
87
|
+
* a sync function (req) => Context, or an async function (req) => Promise<Context>
|
|
88
|
+
* @param extendProcedureDoc - A custom function to extend the generated RPC route documentation for each procedure.
|
|
89
|
+
*/
|
|
90
|
+
register(factory, factoryContext, extendProcedureDoc) {
|
|
91
|
+
this.factories.push({ factory, factoryContext, extendProcedureDoc });
|
|
92
|
+
return this;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Builds and returns the Express application with registered RPC routes.
|
|
96
|
+
* @return express.Application
|
|
97
|
+
*/
|
|
98
|
+
build() {
|
|
99
|
+
this.factories.forEach(({ factory, factoryContext, extendProcedureDoc }) => {
|
|
100
|
+
factory.getProcedures().map((procedure) => {
|
|
101
|
+
const route = this.buildRpcHttpRouteDoc(procedure, extendProcedureDoc);
|
|
102
|
+
this._docs.push(route);
|
|
103
|
+
this._app[route.method](route.path, async (req, res) => {
|
|
104
|
+
try {
|
|
105
|
+
const context = typeof factoryContext === 'function'
|
|
106
|
+
? await factoryContext(req)
|
|
107
|
+
: factoryContext;
|
|
108
|
+
let ac;
|
|
109
|
+
const ctxWithSignal = Object.defineProperty({ ...context }, 'signal', {
|
|
110
|
+
get() {
|
|
111
|
+
if (!ac) {
|
|
112
|
+
ac = new AbortController();
|
|
113
|
+
req.on('close', () => { if (!res.writableFinished)
|
|
114
|
+
ac.abort(); });
|
|
115
|
+
}
|
|
116
|
+
return ac.signal;
|
|
117
|
+
},
|
|
118
|
+
enumerable: true,
|
|
119
|
+
});
|
|
120
|
+
res.json(await procedure.handler(ctxWithSignal, req.body));
|
|
121
|
+
if (this.config?.onSuccess) {
|
|
122
|
+
this.config.onSuccess(procedure, req, res);
|
|
123
|
+
}
|
|
124
|
+
// if status not set, set to 200
|
|
125
|
+
if (!res.status) {
|
|
126
|
+
res.status(200);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
catch (error) {
|
|
130
|
+
if (this.config?.onError) {
|
|
131
|
+
this.config.onError(procedure, req, res, error);
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
if (!res.status) {
|
|
135
|
+
res.status(500);
|
|
136
|
+
}
|
|
137
|
+
// if no res.json set, set default error message
|
|
138
|
+
if (!res.headersSent) {
|
|
139
|
+
res.json({ error: error.message });
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
return this._app;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Generates the RPC HTTP route for the given procedure.
|
|
149
|
+
* @param procedure
|
|
150
|
+
*/
|
|
151
|
+
buildRpcHttpRouteDoc(procedure, extendProcedureDoc) {
|
|
152
|
+
const { config } = procedure;
|
|
153
|
+
const path = ExpressRPCAppBuilder.makeRPCHttpRoutePath({
|
|
154
|
+
name: procedure.name,
|
|
155
|
+
config,
|
|
156
|
+
prefix: this.config?.pathPrefix,
|
|
157
|
+
});
|
|
158
|
+
const method = 'post'; // RPCs use POST method
|
|
159
|
+
const jsonSchema = {};
|
|
160
|
+
if (config.schema?.params) {
|
|
161
|
+
jsonSchema.body = config.schema.params;
|
|
162
|
+
}
|
|
163
|
+
if (config.schema?.returnType) {
|
|
164
|
+
jsonSchema.response = config.schema.returnType;
|
|
165
|
+
}
|
|
166
|
+
const base = {
|
|
167
|
+
kind: 'rpc',
|
|
168
|
+
name: procedure.name,
|
|
169
|
+
version: config.version,
|
|
170
|
+
scope: config.scope,
|
|
171
|
+
path,
|
|
172
|
+
method,
|
|
173
|
+
jsonSchema,
|
|
174
|
+
};
|
|
175
|
+
let extendedDoc = {};
|
|
176
|
+
if (extendProcedureDoc) {
|
|
177
|
+
extendedDoc = extendProcedureDoc({ base, procedure });
|
|
178
|
+
}
|
|
179
|
+
return {
|
|
180
|
+
...extendedDoc,
|
|
181
|
+
...base,
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/implementations/http/express-rpc/index.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAA;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAS7C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAoC7C;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,oBAAoB;IAMV;IALrB;;;;OAIG;IACH,YAAqB,MAAmC;QAAnC,WAAM,GAAN,MAAM,CAA6B;QACtD,IAAI,MAAM,EAAE,GAAG,EAAE,CAAC;YAChB,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,GAAG,CAAA;QACxB,CAAC;aAAM,CAAC;YACN,2CAA2C;YAC3C,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAA;QAC/B,CAAC;QAED,IAAI,MAAM,EAAE,cAAc,EAAE,CAAC;YAC3B,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;gBAC/B,MAAM,CAAC,cAAe,CAAC,GAAG,CAAC,CAAA;gBAC3B,IAAI,EAAE,CAAA;YACR,CAAC,CAAC,CAAA;QACJ,CAAC;QAED,IAAI,MAAM,EAAE,YAAY,EAAE,CAAC;YACzB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;gBAC/B,GAAG,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;oBACpB,MAAM,CAAC,YAAa,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;gBAChC,CAAC,CAAC,CAAA;gBACF,IAAI,EAAE,CAAA;YACR,CAAC,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;IAED;;;;;;;;OAQG;IACH,M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