ts-procedures 10.1.1 → 10.2.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/CHANGELOG.md +26 -65
- package/README.md +2 -0
- package/agent_config/claude-code/skills/ts-procedures/anti-patterns.md +8 -0
- package/agent_config/claude-code/skills/ts-procedures/api-reference.md +25 -22
- package/agent_config/claude-code/skills/ts-procedures/patterns.md +24 -13
- package/agent_config/copilot/copilot-instructions.md +1 -1
- package/agent_config/cursor/cursorrules +1 -1
- package/build/adapters/hono/envelope-parity.test.js +6 -17
- package/build/adapters/hono/envelope-parity.test.js.map +1 -1
- package/build/adapters/hono/handlers/http-stream.d.ts +2 -1
- package/build/adapters/hono/handlers/http-stream.js +9 -2
- package/build/adapters/hono/handlers/http-stream.js.map +1 -1
- package/build/adapters/hono/handlers/http.d.ts +2 -1
- package/build/adapters/hono/handlers/http.js +9 -2
- package/build/adapters/hono/handlers/http.js.map +1 -1
- package/build/adapters/hono/handlers/rpc.d.ts +2 -1
- package/build/adapters/hono/handlers/rpc.js +9 -2
- package/build/adapters/hono/handlers/rpc.js.map +1 -1
- package/build/adapters/hono/handlers/stream.d.ts +2 -1
- package/build/adapters/hono/handlers/stream.js +9 -2
- package/build/adapters/hono/handlers/stream.js.map +1 -1
- package/build/adapters/hono/index.d.ts +14 -7
- package/build/adapters/hono/index.js +45 -5
- package/build/adapters/hono/index.js.map +1 -1
- package/build/adapters/hono/index.test.js +55 -0
- package/build/adapters/hono/index.test.js.map +1 -1
- package/build/adapters/hono/request.d.ts +7 -0
- package/build/adapters/hono/request.js +15 -0
- package/build/adapters/hono/request.js.map +1 -1
- package/build/adapters/hono/types.d.ts +31 -0
- package/build/adapters/hono/types.js.map +1 -1
- package/build/codegen/bin/cli.js +1 -1
- package/build/codegen/bin/cli.js.map +1 -1
- package/build/codegen/constants.js +2 -2
- package/build/codegen/constants.js.map +1 -1
- package/build/codegen/emit/api-route.js +1 -1
- package/build/codegen/emit/api-route.js.map +1 -1
- package/build/codegen/emit/scope-file.js +1 -1
- package/build/codegen/emit/scope-file.js.map +1 -1
- package/build/codegen/emit-errors.integration.test.js +2 -2
- package/build/codegen/emit-errors.integration.test.js.map +1 -1
- package/build/codegen/resolve-envelope.js +1 -1
- package/build/codegen/resolve-envelope.js.map +1 -1
- package/build/codegen/test-helpers/run-tsc.js +1 -1
- package/build/codegen/test-helpers/run-tsc.js.map +1 -1
- package/build/core/create-http-stream.d.ts +3 -14
- package/build/core/create-http-stream.js +4 -2
- package/build/core/create-http-stream.js.map +1 -1
- package/build/core/create-http.d.ts +2 -9
- package/build/core/create-http.js +3 -2
- package/build/core/create-http.js.map +1 -1
- package/build/core/create-http.test-d.d.ts +1 -0
- package/build/core/create-http.test-d.js +104 -0
- package/build/core/create-http.test-d.js.map +1 -0
- package/build/core/create-stream.js +6 -2
- package/build/core/create-stream.js.map +1 -1
- package/build/core/create.js +5 -4
- package/build/core/create.js.map +1 -1
- package/build/core/create.test.js +63 -0
- package/build/core/create.test.js.map +1 -1
- package/build/core/internal.d.ts +16 -0
- package/build/core/internal.js +22 -0
- package/build/core/internal.js.map +1 -1
- package/build/core/procedures.d.ts +9 -16
- package/build/core/procedures.js +4 -0
- package/build/core/procedures.js.map +1 -1
- package/build/core/types.d.ts +85 -4
- package/build/errors.d.ts +33 -0
- package/build/errors.js +91 -0
- package/build/errors.js.map +1 -0
- package/build/errors.test.d.ts +1 -0
- package/build/errors.test.js +122 -0
- package/build/errors.test.js.map +1 -0
- package/build/exports.d.ts +1 -2
- package/build/exports.js +0 -4
- package/build/exports.js.map +1 -1
- package/build/implementations/http/doc-registry.d.ts +28 -0
- package/build/implementations/http/doc-registry.js +96 -0
- package/build/implementations/http/doc-registry.js.map +1 -0
- package/build/implementations/http/doc-registry.test.d.ts +1 -0
- package/build/implementations/http/doc-registry.test.js +516 -0
- package/build/implementations/http/doc-registry.test.js.map +1 -0
- package/build/implementations/http/error-taxonomy.d.ts +249 -0
- package/build/implementations/http/error-taxonomy.js +252 -0
- package/build/implementations/http/error-taxonomy.js.map +1 -0
- package/build/implementations/http/error-taxonomy.test.d.ts +1 -0
- package/build/implementations/http/error-taxonomy.test.js +399 -0
- package/build/implementations/http/error-taxonomy.test.js.map +1 -0
- package/build/implementations/http/express-rpc/error-taxonomy.test.d.ts +1 -0
- package/build/implementations/http/express-rpc/error-taxonomy.test.js +83 -0
- package/build/implementations/http/express-rpc/error-taxonomy.test.js.map +1 -0
- package/build/implementations/http/express-rpc/index.d.ts +125 -0
- package/build/implementations/http/express-rpc/index.js +216 -0
- package/build/implementations/http/express-rpc/index.js.map +1 -0
- package/build/implementations/http/express-rpc/index.test.d.ts +1 -0
- package/build/implementations/http/express-rpc/index.test.js +684 -0
- package/build/implementations/http/express-rpc/index.test.js.map +1 -0
- package/build/implementations/http/express-rpc/types.d.ts +11 -0
- package/build/implementations/http/express-rpc/types.js +2 -0
- package/build/implementations/http/express-rpc/types.js.map +1 -0
- package/build/implementations/http/hono-api/error-taxonomy.test.d.ts +1 -0
- package/build/implementations/http/hono-api/error-taxonomy.test.js +137 -0
- package/build/implementations/http/hono-api/error-taxonomy.test.js.map +1 -0
- package/build/implementations/http/hono-api/index.d.ts +151 -0
- package/build/implementations/http/hono-api/index.js +344 -0
- package/build/implementations/http/hono-api/index.js.map +1 -0
- package/build/implementations/http/hono-api/index.test.d.ts +1 -0
- package/build/implementations/http/hono-api/index.test.js +992 -0
- package/build/implementations/http/hono-api/index.test.js.map +1 -0
- package/build/implementations/http/hono-api/types.d.ts +13 -0
- package/build/implementations/http/hono-api/types.js +2 -0
- package/build/implementations/http/hono-api/types.js.map +1 -0
- package/build/implementations/http/hono-rpc/error-taxonomy.test.d.ts +1 -0
- package/build/implementations/http/hono-rpc/error-taxonomy.test.js +64 -0
- package/build/implementations/http/hono-rpc/error-taxonomy.test.js.map +1 -0
- package/build/implementations/http/hono-rpc/index.d.ts +130 -0
- package/build/implementations/http/hono-rpc/index.js +209 -0
- package/build/implementations/http/hono-rpc/index.js.map +1 -0
- package/build/implementations/http/hono-rpc/index.test.d.ts +1 -0
- package/build/implementations/http/hono-rpc/index.test.js +828 -0
- package/build/implementations/http/hono-rpc/index.test.js.map +1 -0
- package/build/implementations/http/hono-rpc/types.d.ts +11 -0
- package/build/implementations/http/hono-rpc/types.js +2 -0
- package/build/implementations/http/hono-rpc/types.js.map +1 -0
- package/build/implementations/http/hono-stream/error-taxonomy.test.d.ts +1 -0
- package/build/implementations/http/hono-stream/error-taxonomy.test.js +159 -0
- package/build/implementations/http/hono-stream/error-taxonomy.test.js.map +1 -0
- package/build/implementations/http/hono-stream/index.d.ts +171 -0
- package/build/implementations/http/hono-stream/index.js +415 -0
- package/build/implementations/http/hono-stream/index.js.map +1 -0
- package/build/implementations/http/hono-stream/index.test.d.ts +1 -0
- package/build/implementations/http/hono-stream/index.test.js +1383 -0
- package/build/implementations/http/hono-stream/index.test.js.map +1 -0
- package/build/implementations/http/hono-stream/types.d.ts +15 -0
- package/build/implementations/http/hono-stream/types.js +2 -0
- package/build/implementations/http/hono-stream/types.js.map +1 -0
- package/build/implementations/http/on-request-error.test.d.ts +1 -0
- package/build/implementations/http/on-request-error.test.js +173 -0
- package/build/implementations/http/on-request-error.test.js.map +1 -0
- package/build/implementations/http/route-errors.test.d.ts +1 -0
- package/build/implementations/http/route-errors.test.js +139 -0
- package/build/implementations/http/route-errors.test.js.map +1 -0
- package/build/implementations/types.d.ts +192 -0
- package/build/implementations/types.js +2 -0
- package/build/implementations/types.js.map +1 -0
- package/build/index.d.ts +165 -0
- package/build/index.js +258 -0
- package/build/index.js.map +1 -0
- package/build/index.test.d.ts +1 -0
- package/build/index.test.js +920 -0
- package/build/index.test.js.map +1 -0
- package/build/schema/extract-json-schema.d.ts +2 -0
- package/build/schema/extract-json-schema.js +12 -0
- package/build/schema/extract-json-schema.js.map +1 -0
- package/build/schema/extract-json-schema.test.d.ts +1 -0
- package/build/schema/extract-json-schema.test.js +23 -0
- package/build/schema/extract-json-schema.test.js.map +1 -0
- package/build/schema/parser.d.ts +28 -0
- package/build/schema/parser.js +170 -0
- package/build/schema/parser.js.map +1 -0
- package/build/schema/parser.test.d.ts +1 -0
- package/build/schema/parser.test.js +120 -0
- package/build/schema/parser.test.js.map +1 -0
- package/build/schema/resolve-schema-lib.d.ts +12 -0
- package/build/schema/resolve-schema-lib.js +11 -0
- package/build/schema/resolve-schema-lib.js.map +1 -0
- package/build/schema/resolve-schema-lib.test.d.ts +1 -0
- package/build/schema/resolve-schema-lib.test.js +17 -0
- package/build/schema/resolve-schema-lib.test.js.map +1 -0
- package/build/schema/typebox.d.ts +1 -1
- package/build/schema/typebox.js +2 -20
- package/build/schema/typebox.js.map +1 -1
- package/build/schema/typebox.test.js +0 -10
- package/build/schema/typebox.test.js.map +1 -1
- package/build/schema/types.d.ts +8 -0
- package/build/schema/types.js +2 -0
- package/build/schema/types.js.map +1 -0
- package/build/server/context.d.ts +12 -2
- package/build/server/context.js +49 -4
- package/build/server/context.js.map +1 -1
- package/build/server/context.test.js +32 -1
- package/build/server/context.test.js.map +1 -1
- package/build/server/doc-registry.js +0 -3
- package/build/server/doc-registry.js.map +1 -1
- package/build/server/doc-registry.test.js +0 -31
- package/build/server/doc-registry.test.js.map +1 -1
- package/build/server/index.d.ts +0 -1
- package/build/server/index.js +0 -1
- package/build/server/index.js.map +1 -1
- package/build/server/types.d.ts +6 -27
- package/build/stack-utils.d.ts +25 -0
- package/build/stack-utils.js +95 -0
- package/build/stack-utils.js.map +1 -0
- package/build/stack-utils.test.d.ts +1 -0
- package/build/stack-utils.test.js +80 -0
- package/build/stack-utils.test.js.map +1 -0
- package/docs/core.md +8 -0
- package/docs/http-integrations.md +41 -27
- package/package.json +8 -8
- package/src/adapters/astro/README.md +2 -0
- package/src/adapters/hono/envelope-parity.test.ts +6 -18
- package/src/adapters/hono/handlers/http-stream.ts +12 -3
- package/src/adapters/hono/handlers/http.ts +12 -3
- package/src/adapters/hono/handlers/rpc.ts +12 -3
- package/src/adapters/hono/handlers/stream.ts +12 -3
- package/src/adapters/hono/index.test.ts +70 -0
- package/src/adapters/hono/index.ts +53 -11
- package/src/adapters/hono/request.ts +18 -0
- package/src/adapters/hono/types.ts +37 -0
- package/src/codegen/bin/cli.ts +1 -1
- package/src/codegen/constants.ts +2 -2
- package/src/codegen/emit/api-route.ts +1 -1
- package/src/codegen/emit/scope-file.ts +1 -2
- package/src/codegen/emit-errors.integration.test.ts +2 -2
- package/src/codegen/resolve-envelope.ts +1 -1
- package/src/codegen/test-helpers/run-tsc.ts +0 -1
- package/src/core/create-http-stream.ts +20 -13
- package/src/core/create-http.test-d.ts +154 -0
- package/src/core/create-http.ts +19 -8
- package/src/core/create-stream.ts +12 -4
- package/src/core/create.test.ts +74 -0
- package/src/core/create.ts +10 -5
- package/src/core/internal.ts +35 -0
- package/src/core/procedures.ts +4 -0
- package/src/core/types.ts +99 -4
- package/src/exports.ts +6 -4
- package/src/schema/typebox.test.ts +0 -12
- package/src/schema/typebox.ts +2 -21
- package/src/server/context.test.ts +39 -1
- package/src/server/context.ts +54 -4
- package/src/server/doc-registry.test.ts +0 -34
- package/src/server/doc-registry.ts +0 -3
- package/src/server/index.ts +0 -1
- package/src/server/types.ts +8 -27
- package/build/server/spec-version.d.ts +0 -24
- package/build/server/spec-version.js +0 -26
- package/build/server/spec-version.js.map +0 -1
- package/build/version.d.ts +0 -9
- package/build/version.js +0 -11
- package/build/version.js.map +0 -1
- package/docs/doc-envelope-spec-v1.md +0 -296
- package/docs/doc-envelope-v1.schema.json +0 -253
- package/src/server/spec-version.ts +0 -27
- package/src/version.ts +0 -11
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import express from 'express';
|
|
2
|
+
import { kebabCase } from 'es-toolkit/string';
|
|
3
|
+
import { defineErrorTaxonomy, resolveErrorResponse, } from '../error-taxonomy.js';
|
|
4
|
+
import { castArray } from 'es-toolkit/compat';
|
|
5
|
+
export { defineErrorTaxonomy };
|
|
6
|
+
/**
|
|
7
|
+
* Builder class for creating an Express application with RPC routes.
|
|
8
|
+
*
|
|
9
|
+
* Usage:
|
|
10
|
+
* const PublicRPC = Procedures<PublicRPCContext, RPCConfig>()
|
|
11
|
+
* const ProtectedRPC = Procedures<ProtectedRPCContext, RPCConfig>()
|
|
12
|
+
*
|
|
13
|
+
* const rpcApp = new ExpressRPCAppBuilder()
|
|
14
|
+
* .register(PublicRPC, (req): Promise<PublicRPCContext> => { /* context resolution logic * / })
|
|
15
|
+
* .register(ProtectedRPC, (req): Promise<ProtectedRPCContext> => { /* context resolution logic * / })
|
|
16
|
+
* .build();
|
|
17
|
+
*
|
|
18
|
+
* const app = rpcApp.app; // Express application
|
|
19
|
+
* const docs = rpcApp.docs; // RPC route documentation
|
|
20
|
+
*/
|
|
21
|
+
export class ExpressRPCAppBuilder {
|
|
22
|
+
config;
|
|
23
|
+
/**
|
|
24
|
+
* Constructor for ExpressRPCAppBuilder.
|
|
25
|
+
*
|
|
26
|
+
* @param config
|
|
27
|
+
*/
|
|
28
|
+
constructor(config) {
|
|
29
|
+
this.config = config;
|
|
30
|
+
if (config?.app) {
|
|
31
|
+
this._app = config.app;
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
// Default middleware if no app is provided
|
|
35
|
+
this._app.use(express.json());
|
|
36
|
+
}
|
|
37
|
+
if (config?.onRequestStart) {
|
|
38
|
+
this._app.use((req, res, next) => {
|
|
39
|
+
config.onRequestStart(req);
|
|
40
|
+
next();
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
if (config?.onRequestEnd) {
|
|
44
|
+
this._app.use((req, res, next) => {
|
|
45
|
+
res.on('finish', () => {
|
|
46
|
+
config.onRequestEnd(req, res);
|
|
47
|
+
});
|
|
48
|
+
next();
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Generates the RPC route path based on the RPC configuration.
|
|
54
|
+
* `RPCConfig.scope` can be a string or an array of strings to form nested paths.
|
|
55
|
+
*
|
|
56
|
+
* Example
|
|
57
|
+
* name: 'GetUser'
|
|
58
|
+
* scope: ['users', 'profile']
|
|
59
|
+
* version: 1
|
|
60
|
+
* path: /users/profile/get-user/1
|
|
61
|
+
* @param config
|
|
62
|
+
*/
|
|
63
|
+
static makeRPCHttpRoutePath({ name, config, prefix, }) {
|
|
64
|
+
const normalizedPrefix = prefix ? (prefix.startsWith('/') ? prefix : `/${prefix}`) : '';
|
|
65
|
+
return `${normalizedPrefix}/${castArray(config.scope).map(kebabCase).join('/')}/${kebabCase(name)}/${String(config.version).trim()}`;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Instance method wrapper for makeRPCHttpRoutePath that uses the builder's pathPrefix.
|
|
69
|
+
* @param config - The RPC configuration
|
|
70
|
+
*/
|
|
71
|
+
makeRPCHttpRoutePath(name, config) {
|
|
72
|
+
return ExpressRPCAppBuilder.makeRPCHttpRoutePath({
|
|
73
|
+
name,
|
|
74
|
+
config,
|
|
75
|
+
prefix: this.config?.pathPrefix,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
factories = [];
|
|
79
|
+
_app = express();
|
|
80
|
+
_docs = [];
|
|
81
|
+
get app() {
|
|
82
|
+
return this._app;
|
|
83
|
+
}
|
|
84
|
+
get docs() {
|
|
85
|
+
return this._docs;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Registers a procedure factory with its context.
|
|
89
|
+
* @param factory - The procedure factory created by Procedures<Context, RPCConfig>()
|
|
90
|
+
* @param factoryContext - The context for procedure handlers. Can be a direct value,
|
|
91
|
+
* a sync function (req) => Context, or an async function (req) => Promise<Context>
|
|
92
|
+
* @param extendProcedureDoc - A custom function to extend the generated RPC route documentation for each procedure.
|
|
93
|
+
*/
|
|
94
|
+
register(factory, factoryContext, extendProcedureDoc) {
|
|
95
|
+
this.factories.push({ factory, factoryContext, extendProcedureDoc });
|
|
96
|
+
return this;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Builds and returns the Express application with registered RPC routes.
|
|
100
|
+
* @return express.Application
|
|
101
|
+
*/
|
|
102
|
+
build() {
|
|
103
|
+
this.factories.forEach(({ factory, factoryContext, extendProcedureDoc }) => {
|
|
104
|
+
factory.getProcedures().map((procedure) => {
|
|
105
|
+
const route = this.buildRpcHttpRouteDoc(procedure, extendProcedureDoc);
|
|
106
|
+
this._docs.push(route);
|
|
107
|
+
this._app[route.method](route.path, async (req, res) => {
|
|
108
|
+
try {
|
|
109
|
+
const context = typeof factoryContext === 'function'
|
|
110
|
+
? await factoryContext(req)
|
|
111
|
+
: factoryContext;
|
|
112
|
+
let ac;
|
|
113
|
+
const ctxWithSignal = Object.defineProperty({ ...context }, 'signal', {
|
|
114
|
+
get() {
|
|
115
|
+
if (!ac) {
|
|
116
|
+
ac = new AbortController();
|
|
117
|
+
req.on('close', () => { if (!res.writableFinished)
|
|
118
|
+
ac.abort(); });
|
|
119
|
+
}
|
|
120
|
+
return ac.signal;
|
|
121
|
+
},
|
|
122
|
+
enumerable: true,
|
|
123
|
+
});
|
|
124
|
+
res.json(await procedure.handler(ctxWithSignal, req.body));
|
|
125
|
+
if (this.config?.onSuccess) {
|
|
126
|
+
this.config.onSuccess(procedure, req, res);
|
|
127
|
+
}
|
|
128
|
+
// if status not set, set to 200
|
|
129
|
+
if (!res.status) {
|
|
130
|
+
res.status(200);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
catch (error) {
|
|
134
|
+
if (this.config?.onRequestError) {
|
|
135
|
+
try {
|
|
136
|
+
await this.config.onRequestError({ err: error, procedure, raw: { req, res } });
|
|
137
|
+
}
|
|
138
|
+
catch (observerErr) {
|
|
139
|
+
console.error('[ts-procedures express-rpc] onRequestError threw — swallowed:', observerErr);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
if (this.config?.errors || this.config?.unknownError) {
|
|
143
|
+
const resolved = resolveErrorResponse({
|
|
144
|
+
err: error,
|
|
145
|
+
userTaxonomy: this.config.errors,
|
|
146
|
+
unknownError: this.config.unknownError,
|
|
147
|
+
procedure,
|
|
148
|
+
raw: { req, res },
|
|
149
|
+
});
|
|
150
|
+
if (resolved) {
|
|
151
|
+
await resolved.runOnCatch();
|
|
152
|
+
if (!res.headersSent) {
|
|
153
|
+
res.status(resolved.statusCode).json(resolved.body);
|
|
154
|
+
}
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
if (this.config?.onError) {
|
|
159
|
+
this.config.onError(procedure, req, res, error);
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
// Hard default — `res.status` is always truthy (it's a method),
|
|
163
|
+
// so the previous `if (!res.status)` guard never ran. Set status
|
|
164
|
+
// and body together unconditionally, respecting an already-sent
|
|
165
|
+
// response.
|
|
166
|
+
if (!res.headersSent) {
|
|
167
|
+
res.status(500).json({ error: error.message });
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
return this._app;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Generates the RPC HTTP route for the given procedure.
|
|
177
|
+
* @param procedure
|
|
178
|
+
*/
|
|
179
|
+
buildRpcHttpRouteDoc(procedure, extendProcedureDoc) {
|
|
180
|
+
const { config } = procedure;
|
|
181
|
+
const path = ExpressRPCAppBuilder.makeRPCHttpRoutePath({
|
|
182
|
+
name: procedure.name,
|
|
183
|
+
config,
|
|
184
|
+
prefix: this.config?.pathPrefix,
|
|
185
|
+
});
|
|
186
|
+
const method = 'post'; // RPCs use POST method
|
|
187
|
+
const jsonSchema = {};
|
|
188
|
+
if (config.schema?.params) {
|
|
189
|
+
jsonSchema.body = config.schema.params;
|
|
190
|
+
}
|
|
191
|
+
if (config.schema?.returnType) {
|
|
192
|
+
jsonSchema.response = config.schema.returnType;
|
|
193
|
+
}
|
|
194
|
+
const base = {
|
|
195
|
+
kind: 'rpc',
|
|
196
|
+
name: procedure.name,
|
|
197
|
+
version: config.version,
|
|
198
|
+
scope: config.scope,
|
|
199
|
+
path,
|
|
200
|
+
method,
|
|
201
|
+
jsonSchema,
|
|
202
|
+
};
|
|
203
|
+
if (config.errors && config.errors.length > 0) {
|
|
204
|
+
base.errors = [...config.errors];
|
|
205
|
+
}
|
|
206
|
+
let extendedDoc = {};
|
|
207
|
+
if (extendProcedureDoc) {
|
|
208
|
+
extendedDoc = extendProcedureDoc({ base, procedure });
|
|
209
|
+
}
|
|
210
|
+
return {
|
|
211
|
+
...extendedDoc,
|
|
212
|
+
...base,
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
//# 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,EAIL,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAI7C,OAAO,EAAE,mBAAmB,EAAE,CAAA;AA0D9B;;;;;;;;;;;;;;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,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