@orpc/contract 0.0.0-next.7b4c812 → 0.0.0-next.7d3bd71
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/dist/index.js +223 -132
- package/dist/src/builder-variants.d.ts +38 -0
- package/dist/src/builder.d.ts +30 -11
- package/dist/src/config.d.ts +10 -0
- package/dist/src/error.d.ts +27 -0
- package/dist/src/event-iterator.d.ts +8 -0
- package/dist/src/index.d.ts +10 -5
- package/dist/src/meta.d.ts +3 -0
- package/dist/src/procedure-client.d.ts +5 -0
- package/dist/src/procedure.d.ts +15 -44
- package/dist/src/route.d.ts +79 -0
- package/dist/src/router-client.d.ts +8 -0
- package/dist/src/router.d.ts +25 -12
- package/dist/src/{types.d.ts → schema.d.ts} +4 -4
- package/package.json +10 -3
- package/dist/src/constants.d.ts +0 -3
- package/dist/src/router-builder.d.ts +0 -16
- package/dist/src/utils.d.ts +0 -4
package/dist/index.js
CHANGED
|
@@ -1,179 +1,270 @@
|
|
|
1
|
+
// src/error.ts
|
|
2
|
+
var ValidationError = class extends Error {
|
|
3
|
+
issues;
|
|
4
|
+
constructor(options) {
|
|
5
|
+
super(options.message, options);
|
|
6
|
+
this.issues = options.issues;
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
function mergeErrorMap(errorMap1, errorMap2) {
|
|
10
|
+
return { ...errorMap1, ...errorMap2 };
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// src/meta.ts
|
|
14
|
+
function mergeMeta(meta1, meta2) {
|
|
15
|
+
return { ...meta1, ...meta2 };
|
|
16
|
+
}
|
|
17
|
+
|
|
1
18
|
// src/procedure.ts
|
|
2
19
|
var ContractProcedure = class {
|
|
3
|
-
|
|
4
|
-
|
|
20
|
+
"~orpc";
|
|
21
|
+
constructor(def) {
|
|
22
|
+
if (def.route?.successStatus && (def.route.successStatus < 200 || def.route?.successStatus > 299)) {
|
|
23
|
+
throw new Error("[ContractProcedure] The successStatus must be between 200 and 299");
|
|
24
|
+
}
|
|
25
|
+
if (Object.values(def.errorMap).some((val) => val && val.status && (val.status < 400 || val.status > 599))) {
|
|
26
|
+
throw new Error("[ContractProcedure] The error status code must be in the 400-599 range.");
|
|
27
|
+
}
|
|
28
|
+
this["~orpc"] = def;
|
|
5
29
|
}
|
|
6
30
|
};
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return cp;
|
|
11
|
-
return new _DecoratedContractProcedure(cp.zz$cp);
|
|
12
|
-
}
|
|
13
|
-
route(opts) {
|
|
14
|
-
return new _DecoratedContractProcedure({
|
|
15
|
-
...this.zz$cp,
|
|
16
|
-
...opts,
|
|
17
|
-
method: opts.method,
|
|
18
|
-
path: opts.path
|
|
19
|
-
});
|
|
31
|
+
function isContractProcedure(item) {
|
|
32
|
+
if (item instanceof ContractProcedure) {
|
|
33
|
+
return true;
|
|
20
34
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
35
|
+
return (typeof item === "object" || typeof item === "function") && item !== null && "~orpc" in item && typeof item["~orpc"] === "object" && item["~orpc"] !== null && "inputSchema" in item["~orpc"] && "outputSchema" in item["~orpc"] && "errorMap" in item["~orpc"] && "route" in item["~orpc"] && "meta" in item["~orpc"];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// src/route.ts
|
|
39
|
+
function mergeRoute(a, b) {
|
|
40
|
+
return { ...a, ...b };
|
|
41
|
+
}
|
|
42
|
+
function prefixRoute(route, prefix) {
|
|
43
|
+
if (!route.path) {
|
|
44
|
+
return route;
|
|
28
45
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
46
|
+
return {
|
|
47
|
+
...route,
|
|
48
|
+
path: `${prefix}${route.path}`
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function unshiftTagRoute(route, tags) {
|
|
52
|
+
return {
|
|
53
|
+
...route,
|
|
54
|
+
tags: [...tags, ...route.tags ?? []]
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
function mergePrefix(a, b) {
|
|
58
|
+
return a ? `${a}${b}` : b;
|
|
59
|
+
}
|
|
60
|
+
function mergeTags(a, b) {
|
|
61
|
+
return a ? [...a, ...b] : b;
|
|
62
|
+
}
|
|
63
|
+
function adaptRoute(route, options) {
|
|
64
|
+
let router = route;
|
|
65
|
+
if (options.prefix) {
|
|
66
|
+
router = prefixRoute(router, options.prefix);
|
|
36
67
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
...this.zz$cp,
|
|
40
|
-
InputSchema: schema,
|
|
41
|
-
inputExample: example
|
|
42
|
-
});
|
|
68
|
+
if (options.tags) {
|
|
69
|
+
router = unshiftTagRoute(router, options.tags);
|
|
43
70
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
71
|
+
return router;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// src/router.ts
|
|
75
|
+
function adaptContractRouter(contract, options) {
|
|
76
|
+
if (isContractProcedure(contract)) {
|
|
77
|
+
const adapted2 = new ContractProcedure({
|
|
78
|
+
...contract["~orpc"],
|
|
79
|
+
errorMap: mergeErrorMap(options.errorMap, contract["~orpc"].errorMap),
|
|
80
|
+
route: adaptRoute(contract["~orpc"].route, options)
|
|
49
81
|
});
|
|
82
|
+
return adapted2;
|
|
50
83
|
}
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
return
|
|
84
|
+
const adapted = {};
|
|
85
|
+
for (const key in contract) {
|
|
86
|
+
adapted[key] = adaptContractRouter(contract[key], options);
|
|
87
|
+
}
|
|
88
|
+
return adapted;
|
|
56
89
|
}
|
|
57
90
|
|
|
58
|
-
// src/
|
|
59
|
-
var
|
|
60
|
-
constructor(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
91
|
+
// src/builder.ts
|
|
92
|
+
var ContractBuilder = class _ContractBuilder extends ContractProcedure {
|
|
93
|
+
constructor(def) {
|
|
94
|
+
super(def);
|
|
95
|
+
this["~orpc"].prefix = def.prefix;
|
|
96
|
+
this["~orpc"].tags = def.tags;
|
|
65
97
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
98
|
+
/**
|
|
99
|
+
* Reset initial meta
|
|
100
|
+
*/
|
|
101
|
+
$meta(initialMeta) {
|
|
102
|
+
return new _ContractBuilder({
|
|
103
|
+
...this["~orpc"],
|
|
104
|
+
meta: initialMeta
|
|
70
105
|
});
|
|
71
106
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
107
|
+
/**
|
|
108
|
+
* Reset initial route
|
|
109
|
+
*/
|
|
110
|
+
$route(initialRoute) {
|
|
111
|
+
return new _ContractBuilder({
|
|
112
|
+
...this["~orpc"],
|
|
113
|
+
route: initialRoute
|
|
78
114
|
});
|
|
79
115
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
const decorated = DecoratedContractProcedure.decorate(item).addTags(
|
|
86
|
-
...this.zz$crb.tags ?? []
|
|
87
|
-
);
|
|
88
|
-
handled[key] = this.zz$crb.prefix ? decorated.prefix(this.zz$crb.prefix) : decorated;
|
|
89
|
-
} else {
|
|
90
|
-
handled[key] = this.router(item);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
return handled;
|
|
116
|
+
errors(errors) {
|
|
117
|
+
return new _ContractBuilder({
|
|
118
|
+
...this["~orpc"],
|
|
119
|
+
errorMap: mergeErrorMap(this["~orpc"].errorMap, errors)
|
|
120
|
+
});
|
|
94
121
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
122
|
+
meta(meta) {
|
|
123
|
+
return new _ContractBuilder({
|
|
124
|
+
...this["~orpc"],
|
|
125
|
+
meta: mergeMeta(this["~orpc"].meta, meta)
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
route(route) {
|
|
129
|
+
return new _ContractBuilder({
|
|
130
|
+
...this["~orpc"],
|
|
131
|
+
route: mergeRoute(this["~orpc"].route, route)
|
|
102
132
|
});
|
|
103
133
|
}
|
|
104
|
-
|
|
105
|
-
return new
|
|
106
|
-
|
|
134
|
+
input(schema) {
|
|
135
|
+
return new _ContractBuilder({
|
|
136
|
+
...this["~orpc"],
|
|
137
|
+
inputSchema: schema
|
|
107
138
|
});
|
|
108
139
|
}
|
|
109
|
-
|
|
110
|
-
return new
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
...opts
|
|
140
|
+
output(schema) {
|
|
141
|
+
return new _ContractBuilder({
|
|
142
|
+
...this["~orpc"],
|
|
143
|
+
outputSchema: schema
|
|
114
144
|
});
|
|
115
145
|
}
|
|
116
|
-
|
|
117
|
-
return new
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
OutputSchema: void 0
|
|
146
|
+
prefix(prefix) {
|
|
147
|
+
return new _ContractBuilder({
|
|
148
|
+
...this["~orpc"],
|
|
149
|
+
prefix: mergePrefix(this["~orpc"].prefix, prefix)
|
|
121
150
|
});
|
|
122
151
|
}
|
|
123
|
-
|
|
124
|
-
return new
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
outputExample: example
|
|
152
|
+
tag(...tags) {
|
|
153
|
+
return new _ContractBuilder({
|
|
154
|
+
...this["~orpc"],
|
|
155
|
+
tags: mergeTags(this["~orpc"].tags, tags)
|
|
128
156
|
});
|
|
129
157
|
}
|
|
130
158
|
router(router) {
|
|
131
|
-
return router;
|
|
159
|
+
return adaptContractRouter(router, this["~orpc"]);
|
|
132
160
|
}
|
|
133
161
|
};
|
|
162
|
+
var oc = new ContractBuilder({
|
|
163
|
+
errorMap: {},
|
|
164
|
+
inputSchema: void 0,
|
|
165
|
+
outputSchema: void 0,
|
|
166
|
+
route: {},
|
|
167
|
+
meta: {}
|
|
168
|
+
});
|
|
134
169
|
|
|
135
|
-
// src/
|
|
136
|
-
var
|
|
137
|
-
|
|
170
|
+
// src/config.ts
|
|
171
|
+
var DEFAULT_CONFIG = {
|
|
172
|
+
defaultMethod: "POST",
|
|
173
|
+
defaultSuccessStatus: 200,
|
|
174
|
+
defaultSuccessDescription: "OK",
|
|
175
|
+
defaultInputStructure: "compact",
|
|
176
|
+
defaultOutputStructure: "compact"
|
|
177
|
+
};
|
|
178
|
+
function fallbackContractConfig(key, value) {
|
|
179
|
+
if (value === void 0) {
|
|
180
|
+
return DEFAULT_CONFIG[key];
|
|
181
|
+
}
|
|
182
|
+
return value;
|
|
183
|
+
}
|
|
138
184
|
|
|
139
|
-
// src/
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
185
|
+
// src/event-iterator.ts
|
|
186
|
+
import { mapEventIterator, ORPCError } from "@orpc/client";
|
|
187
|
+
import { isAsyncIteratorObject } from "@orpc/server-standard";
|
|
188
|
+
var EVENT_ITERATOR_SCHEMA_SYMBOL = Symbol("ORPC_EVENT_ITERATOR_SCHEMA");
|
|
189
|
+
function eventIterator(yields, returns) {
|
|
190
|
+
return {
|
|
191
|
+
"~standard": {
|
|
192
|
+
[EVENT_ITERATOR_SCHEMA_SYMBOL]: { yields, returns },
|
|
193
|
+
vendor: "orpc",
|
|
194
|
+
version: 1,
|
|
195
|
+
validate(iterator) {
|
|
196
|
+
if (!isAsyncIteratorObject(iterator)) {
|
|
197
|
+
return { issues: [{ message: "Expect event source iterator", path: [] }] };
|
|
198
|
+
}
|
|
199
|
+
const mapped = mapEventIterator(iterator, {
|
|
200
|
+
async value(value, done) {
|
|
201
|
+
const schema = done ? returns : yields;
|
|
202
|
+
if (!schema) {
|
|
203
|
+
return value;
|
|
204
|
+
}
|
|
205
|
+
const result = await schema["~standard"].validate(value);
|
|
206
|
+
if (result.issues) {
|
|
207
|
+
throw new ORPCError("EVENT_ITERATOR_VALIDATION_FAILED", {
|
|
208
|
+
message: "Event source iterator validation failed",
|
|
209
|
+
cause: new ValidationError({
|
|
210
|
+
issues: result.issues,
|
|
211
|
+
message: "Event source iterator validation failed"
|
|
212
|
+
})
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
return result.value;
|
|
216
|
+
},
|
|
217
|
+
error: async (error) => error
|
|
218
|
+
});
|
|
219
|
+
return { value: mapped };
|
|
220
|
+
}
|
|
147
221
|
}
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
function getEventIteratorSchemaDetails(schema) {
|
|
225
|
+
if (schema === void 0) {
|
|
226
|
+
return void 0;
|
|
148
227
|
}
|
|
228
|
+
return schema["~standard"][EVENT_ITERATOR_SCHEMA_SYMBOL];
|
|
149
229
|
}
|
|
150
230
|
|
|
151
|
-
// src/
|
|
152
|
-
function
|
|
153
|
-
return
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
231
|
+
// src/schema.ts
|
|
232
|
+
function type(...[map]) {
|
|
233
|
+
return {
|
|
234
|
+
"~standard": {
|
|
235
|
+
vendor: "custom",
|
|
236
|
+
version: 1,
|
|
237
|
+
async validate(value) {
|
|
238
|
+
if (map) {
|
|
239
|
+
return { value: await map(value) };
|
|
240
|
+
}
|
|
241
|
+
return { value };
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
};
|
|
163
245
|
}
|
|
164
246
|
|
|
165
247
|
// src/index.ts
|
|
166
|
-
|
|
248
|
+
import { ORPCError as ORPCError2 } from "@orpc/client";
|
|
167
249
|
export {
|
|
168
250
|
ContractBuilder,
|
|
169
251
|
ContractProcedure,
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
252
|
+
ORPCError2 as ORPCError,
|
|
253
|
+
ValidationError,
|
|
254
|
+
adaptContractRouter,
|
|
255
|
+
adaptRoute,
|
|
256
|
+
eventIterator,
|
|
257
|
+
fallbackContractConfig,
|
|
258
|
+
getEventIteratorSchemaDetails,
|
|
174
259
|
isContractProcedure,
|
|
260
|
+
mergeErrorMap,
|
|
261
|
+
mergeMeta,
|
|
262
|
+
mergePrefix,
|
|
263
|
+
mergeRoute,
|
|
264
|
+
mergeTags,
|
|
175
265
|
oc,
|
|
176
|
-
|
|
177
|
-
|
|
266
|
+
prefixRoute,
|
|
267
|
+
type,
|
|
268
|
+
unshiftTagRoute
|
|
178
269
|
};
|
|
179
270
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { ErrorMap, MergedErrorMap } from './error';
|
|
2
|
+
import type { Meta } from './meta';
|
|
3
|
+
import type { ContractProcedure } from './procedure';
|
|
4
|
+
import type { HTTPPath, Route } from './route';
|
|
5
|
+
import type { AdaptContractRouterOptions, AdaptedContractRouter, ContractRouter } from './router';
|
|
6
|
+
import type { Schema } from './schema';
|
|
7
|
+
export interface ContractProcedureBuilder<TInputSchema extends Schema, TOutputSchema extends Schema, TErrorMap extends ErrorMap, TMeta extends Meta> extends ContractProcedure<TInputSchema, TOutputSchema, TErrorMap, TMeta> {
|
|
8
|
+
errors<U extends ErrorMap>(errors: U): ContractProcedureBuilder<TInputSchema, TOutputSchema, MergedErrorMap<TErrorMap, U>, TMeta>;
|
|
9
|
+
meta(meta: TMeta): ContractProcedureBuilder<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
10
|
+
route(route: Route): ContractProcedureBuilder<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
11
|
+
input<U extends Schema>(schema: U): ContractProcedureBuilderWithInput<U, TOutputSchema, TErrorMap, TMeta>;
|
|
12
|
+
output<U extends Schema>(schema: U): ContractProcedureBuilderWithOutput<TInputSchema, U, TErrorMap, TMeta>;
|
|
13
|
+
}
|
|
14
|
+
export interface ContractProcedureBuilderWithInput<TInputSchema extends Schema, TOutputSchema extends Schema, TErrorMap extends ErrorMap, TMeta extends Meta> extends ContractProcedure<TInputSchema, TOutputSchema, TErrorMap, TMeta> {
|
|
15
|
+
errors<U extends ErrorMap>(errors: U): ContractProcedureBuilderWithInput<TInputSchema, TOutputSchema, MergedErrorMap<TErrorMap, U>, TMeta>;
|
|
16
|
+
meta(meta: TMeta): ContractProcedureBuilderWithInput<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
17
|
+
route(route: Route): ContractProcedureBuilderWithInput<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
18
|
+
output<U extends Schema>(schema: U): ContractProcedureBuilderWithInputOutput<TInputSchema, U, TErrorMap, TMeta>;
|
|
19
|
+
}
|
|
20
|
+
export interface ContractProcedureBuilderWithOutput<TInputSchema extends Schema, TOutputSchema extends Schema, TErrorMap extends ErrorMap, TMeta extends Meta> extends ContractProcedure<TInputSchema, TOutputSchema, TErrorMap, TMeta> {
|
|
21
|
+
errors<U extends ErrorMap>(errors: U): ContractProcedureBuilderWithOutput<TInputSchema, TOutputSchema, MergedErrorMap<TErrorMap, U>, TMeta>;
|
|
22
|
+
meta(meta: TMeta): ContractProcedureBuilderWithOutput<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
23
|
+
route(route: Route): ContractProcedureBuilderWithOutput<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
24
|
+
input<U extends Schema>(schema: U): ContractProcedureBuilderWithInputOutput<U, TOutputSchema, TErrorMap, TMeta>;
|
|
25
|
+
}
|
|
26
|
+
export interface ContractProcedureBuilderWithInputOutput<TInputSchema extends Schema, TOutputSchema extends Schema, TErrorMap extends ErrorMap, TMeta extends Meta> extends ContractProcedure<TInputSchema, TOutputSchema, TErrorMap, TMeta> {
|
|
27
|
+
errors<U extends ErrorMap>(errors: U): ContractProcedureBuilderWithInputOutput<TInputSchema, TOutputSchema, MergedErrorMap<TErrorMap, U>, TMeta>;
|
|
28
|
+
meta(meta: TMeta): ContractProcedureBuilderWithInputOutput<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
29
|
+
route(route: Route): ContractProcedureBuilderWithInputOutput<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
30
|
+
}
|
|
31
|
+
export interface ContractRouterBuilder<TErrorMap extends ErrorMap, TMeta extends Meta> {
|
|
32
|
+
'~orpc': AdaptContractRouterOptions<TErrorMap>;
|
|
33
|
+
'errors'<U extends ErrorMap>(errors: U): ContractRouterBuilder<MergedErrorMap<TErrorMap, U>, TMeta>;
|
|
34
|
+
'prefix'(prefix: HTTPPath): ContractRouterBuilder<TErrorMap, TMeta>;
|
|
35
|
+
'tag'(...tags: string[]): ContractRouterBuilder<TErrorMap, TMeta>;
|
|
36
|
+
'router'<T extends ContractRouter<TMeta>>(router: T): AdaptedContractRouter<T, TErrorMap>;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=builder-variants.d.ts.map
|
package/dist/src/builder.d.ts
CHANGED
|
@@ -1,13 +1,32 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
output<USchema extends Schema>(schema: USchema, example?: SchemaOutput<USchema>): DecoratedContractProcedure<undefined, USchema>;
|
|
11
|
-
router<T extends ContractRouter>(router: T): T;
|
|
1
|
+
import type { ContractProcedureBuilder, ContractProcedureBuilderWithInput, ContractProcedureBuilderWithOutput, ContractRouterBuilder } from './builder-variants';
|
|
2
|
+
import type { ContractProcedureDef } from './procedure';
|
|
3
|
+
import type { AdaptContractRouterOptions, AdaptedContractRouter, ContractRouter } from './router';
|
|
4
|
+
import type { Schema } from './schema';
|
|
5
|
+
import { type ErrorMap, type MergedErrorMap } from './error';
|
|
6
|
+
import { type Meta } from './meta';
|
|
7
|
+
import { ContractProcedure } from './procedure';
|
|
8
|
+
import { type HTTPPath, type Route } from './route';
|
|
9
|
+
export interface ContractBuilderDef<TInputSchema extends Schema, TOutputSchema extends Schema, TErrorMap extends ErrorMap, TMeta extends Meta> extends ContractProcedureDef<TInputSchema, TOutputSchema, TErrorMap, TMeta>, AdaptContractRouterOptions<TErrorMap> {
|
|
12
10
|
}
|
|
11
|
+
export declare class ContractBuilder<TInputSchema extends Schema, TOutputSchema extends Schema, TErrorMap extends ErrorMap, TMeta extends Meta> extends ContractProcedure<TInputSchema, TOutputSchema, TErrorMap, TMeta> {
|
|
12
|
+
'~orpc': ContractBuilderDef<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
13
|
+
constructor(def: ContractBuilderDef<TInputSchema, TOutputSchema, TErrorMap, TMeta>);
|
|
14
|
+
/**
|
|
15
|
+
* Reset initial meta
|
|
16
|
+
*/
|
|
17
|
+
$meta<U extends Meta>(initialMeta: U): ContractBuilder<TInputSchema, TOutputSchema, TErrorMap, U>;
|
|
18
|
+
/**
|
|
19
|
+
* Reset initial route
|
|
20
|
+
*/
|
|
21
|
+
$route(initialRoute: Route): ContractBuilder<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
22
|
+
errors<U extends ErrorMap>(errors: U): ContractBuilder<TInputSchema, TOutputSchema, MergedErrorMap<TErrorMap, U>, TMeta>;
|
|
23
|
+
meta(meta: TMeta): ContractProcedureBuilder<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
24
|
+
route(route: Route): ContractProcedureBuilder<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
25
|
+
input<U extends Schema>(schema: U): ContractProcedureBuilderWithInput<U, TOutputSchema, TErrorMap, TMeta>;
|
|
26
|
+
output<U extends Schema>(schema: U): ContractProcedureBuilderWithOutput<TInputSchema, U, TErrorMap, TMeta>;
|
|
27
|
+
prefix(prefix: HTTPPath): ContractRouterBuilder<TErrorMap, TMeta>;
|
|
28
|
+
tag(...tags: string[]): ContractRouterBuilder<TErrorMap, TMeta>;
|
|
29
|
+
router<T extends ContractRouter<TMeta>>(router: T): AdaptedContractRouter<T, TErrorMap>;
|
|
30
|
+
}
|
|
31
|
+
export declare const oc: ContractBuilder<undefined, undefined, {}, {}>;
|
|
13
32
|
//# sourceMappingURL=builder.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { HTTPMethod, InputStructure } from './route';
|
|
2
|
+
export interface ContractConfig {
|
|
3
|
+
defaultMethod: HTTPMethod;
|
|
4
|
+
defaultSuccessStatus: number;
|
|
5
|
+
defaultSuccessDescription: string;
|
|
6
|
+
defaultInputStructure: InputStructure;
|
|
7
|
+
defaultOutputStructure: InputStructure;
|
|
8
|
+
}
|
|
9
|
+
export declare function fallbackContractConfig<T extends keyof ContractConfig>(key: T, value: ContractConfig[T] | undefined): ContractConfig[T];
|
|
10
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ORPCError, ORPCErrorCode } from '@orpc/client';
|
|
2
|
+
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
3
|
+
import type { Schema, SchemaOutput } from './schema';
|
|
4
|
+
export interface ValidationErrorOptions extends ErrorOptions {
|
|
5
|
+
message: string;
|
|
6
|
+
issues: readonly StandardSchemaV1.Issue[];
|
|
7
|
+
}
|
|
8
|
+
export declare class ValidationError extends Error {
|
|
9
|
+
readonly issues: readonly StandardSchemaV1.Issue[];
|
|
10
|
+
constructor(options: ValidationErrorOptions);
|
|
11
|
+
}
|
|
12
|
+
export type ErrorMapItem<TDataSchema extends Schema> = {
|
|
13
|
+
status?: number;
|
|
14
|
+
message?: string;
|
|
15
|
+
description?: string;
|
|
16
|
+
data?: TDataSchema;
|
|
17
|
+
};
|
|
18
|
+
export type ErrorMap = {
|
|
19
|
+
[key in ORPCErrorCode]?: ErrorMapItem<Schema>;
|
|
20
|
+
};
|
|
21
|
+
export type MergedErrorMap<T1 extends ErrorMap, T2 extends ErrorMap> = Omit<T1, keyof T2> & T2;
|
|
22
|
+
export declare function mergeErrorMap<T1 extends ErrorMap, T2 extends ErrorMap>(errorMap1: T1, errorMap2: T2): MergedErrorMap<T1, T2>;
|
|
23
|
+
export type ORPCErrorFromErrorMap<TErrorMap extends ErrorMap> = {
|
|
24
|
+
[K in keyof TErrorMap]: K extends string ? TErrorMap[K] extends ErrorMapItem<infer TDataSchema> ? ORPCError<K, SchemaOutput<TDataSchema>> : never : never;
|
|
25
|
+
}[keyof TErrorMap];
|
|
26
|
+
export type ErrorFromErrorMap<TErrorMap extends ErrorMap> = Error | ORPCErrorFromErrorMap<TErrorMap>;
|
|
27
|
+
//# sourceMappingURL=error.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
2
|
+
import type { Schema } from './schema';
|
|
3
|
+
export declare function eventIterator<TYieldIn, TYieldOut, TReturnIn = unknown, TReturnOut = unknown>(yields: StandardSchemaV1<TYieldIn, TYieldOut>, returns?: StandardSchemaV1<TReturnIn, TReturnOut>): StandardSchemaV1<AsyncIteratorObject<TYieldIn, TReturnIn, void>, AsyncIteratorObject<TYieldOut, TReturnOut, void>>;
|
|
4
|
+
export declare function getEventIteratorSchemaDetails(schema: Schema): undefined | {
|
|
5
|
+
yields: Schema;
|
|
6
|
+
returns: Schema;
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=event-iterator.d.ts.map
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
/** unnoq */
|
|
2
|
-
import { ContractBuilder } from './builder';
|
|
3
2
|
export * from './builder';
|
|
4
|
-
export * from './
|
|
3
|
+
export * from './builder-variants';
|
|
4
|
+
export * from './config';
|
|
5
|
+
export * from './error';
|
|
6
|
+
export * from './event-iterator';
|
|
7
|
+
export * from './meta';
|
|
5
8
|
export * from './procedure';
|
|
9
|
+
export * from './procedure-client';
|
|
10
|
+
export * from './route';
|
|
6
11
|
export * from './router';
|
|
7
|
-
export * from './
|
|
8
|
-
export * from './
|
|
9
|
-
export
|
|
12
|
+
export * from './router-client';
|
|
13
|
+
export * from './schema';
|
|
14
|
+
export { ORPCError } from '@orpc/client';
|
|
10
15
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Client, ClientContext } from '@orpc/client';
|
|
2
|
+
import type { ErrorFromErrorMap, ErrorMap } from './error';
|
|
3
|
+
import type { Schema, SchemaInput, SchemaOutput } from './schema';
|
|
4
|
+
export type ContractProcedureClient<TClientContext extends ClientContext, TInputSchema extends Schema, TOutputSchema extends Schema, TErrorMap extends ErrorMap> = Client<TClientContext, SchemaInput<TInputSchema>, SchemaOutput<TOutputSchema>, ErrorFromErrorMap<TErrorMap>>;
|
|
5
|
+
//# sourceMappingURL=procedure-client.d.ts.map
|
package/dist/src/procedure.d.ts
CHANGED
|
@@ -1,47 +1,18 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import type { ErrorMap } from './error';
|
|
2
|
+
import type { Meta } from './meta';
|
|
3
|
+
import type { Route } from './route';
|
|
4
|
+
import type { Schema } from './schema';
|
|
5
|
+
export interface ContractProcedureDef<TInputSchema extends Schema, TOutputSchema extends Schema, TErrorMap extends ErrorMap, TMeta extends Meta> {
|
|
6
|
+
meta: TMeta;
|
|
7
|
+
route: Route;
|
|
8
|
+
inputSchema: TInputSchema;
|
|
9
|
+
outputSchema: TOutputSchema;
|
|
10
|
+
errorMap: TErrorMap;
|
|
9
11
|
}
|
|
10
|
-
export declare class ContractProcedure<TInputSchema extends Schema, TOutputSchema extends Schema> {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
method?: HTTPMethod;
|
|
14
|
-
summary?: string;
|
|
15
|
-
description?: string;
|
|
16
|
-
deprecated?: boolean;
|
|
17
|
-
tags?: string[];
|
|
18
|
-
InputSchema: TInputSchema;
|
|
19
|
-
inputExample?: SchemaOutput<TInputSchema>;
|
|
20
|
-
OutputSchema: TOutputSchema;
|
|
21
|
-
outputExample?: SchemaOutput<TOutputSchema>;
|
|
22
|
-
};
|
|
23
|
-
constructor(zz$cp: {
|
|
24
|
-
path?: HTTPPath;
|
|
25
|
-
method?: HTTPMethod;
|
|
26
|
-
summary?: string;
|
|
27
|
-
description?: string;
|
|
28
|
-
deprecated?: boolean;
|
|
29
|
-
tags?: string[];
|
|
30
|
-
InputSchema: TInputSchema;
|
|
31
|
-
inputExample?: SchemaOutput<TInputSchema>;
|
|
32
|
-
OutputSchema: TOutputSchema;
|
|
33
|
-
outputExample?: SchemaOutput<TOutputSchema>;
|
|
34
|
-
});
|
|
12
|
+
export declare class ContractProcedure<TInputSchema extends Schema, TOutputSchema extends Schema, TErrorMap extends ErrorMap, TMeta extends Meta> {
|
|
13
|
+
'~orpc': ContractProcedureDef<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
14
|
+
constructor(def: ContractProcedureDef<TInputSchema, TOutputSchema, TErrorMap, TMeta>);
|
|
35
15
|
}
|
|
36
|
-
export type
|
|
37
|
-
export declare
|
|
38
|
-
static decorate<TInputSchema extends Schema, TOutputSchema extends Schema>(cp: ContractProcedure<TInputSchema, TOutputSchema>): DecoratedContractProcedure<TInputSchema, TOutputSchema>;
|
|
39
|
-
route(opts: RouteOptions): DecoratedContractProcedure<TInputSchema, TOutputSchema>;
|
|
40
|
-
prefix(prefix: HTTPPath): DecoratedContractProcedure<TInputSchema, TOutputSchema>;
|
|
41
|
-
addTags(...tags: string[]): DecoratedContractProcedure<TInputSchema, TOutputSchema>;
|
|
42
|
-
input<USchema extends Schema>(schema: USchema, example?: SchemaInput<USchema>): DecoratedContractProcedure<USchema, TOutputSchema>;
|
|
43
|
-
output<USchema extends Schema>(schema: USchema, example?: SchemaOutput<USchema>): DecoratedContractProcedure<TInputSchema, USchema>;
|
|
44
|
-
}
|
|
45
|
-
export type WELL_DEFINED_CONTRACT_PROCEDURE = ContractProcedure<Schema, Schema>;
|
|
46
|
-
export declare function isContractProcedure(item: unknown): item is WELL_DEFINED_CONTRACT_PROCEDURE;
|
|
16
|
+
export type AnyContractProcedure = ContractProcedure<any, any, any, any>;
|
|
17
|
+
export declare function isContractProcedure(item: unknown): item is AnyContractProcedure;
|
|
47
18
|
//# sourceMappingURL=procedure.d.ts.map
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
export type HTTPPath = `/${string}`;
|
|
2
|
+
export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
|
|
3
|
+
export type InputStructure = 'compact' | 'detailed';
|
|
4
|
+
export type OutputStructure = 'compact' | 'detailed';
|
|
5
|
+
export interface Route {
|
|
6
|
+
method?: HTTPMethod;
|
|
7
|
+
path?: HTTPPath;
|
|
8
|
+
summary?: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
deprecated?: boolean;
|
|
11
|
+
tags?: readonly string[];
|
|
12
|
+
/**
|
|
13
|
+
* The status code of the response when the procedure is successful.
|
|
14
|
+
*
|
|
15
|
+
* @default 200
|
|
16
|
+
*/
|
|
17
|
+
successStatus?: number;
|
|
18
|
+
/**
|
|
19
|
+
* The description of the response when the procedure is successful.
|
|
20
|
+
*
|
|
21
|
+
* @default 'OK'
|
|
22
|
+
*/
|
|
23
|
+
successDescription?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Determines how the input should be structured based on `params`, `query`, `headers`, and `body`.
|
|
26
|
+
*
|
|
27
|
+
* @option 'compact'
|
|
28
|
+
* Combines `params` and either `query` or `body` (depending on the HTTP method) into a single object.
|
|
29
|
+
*
|
|
30
|
+
* @option 'detailed'
|
|
31
|
+
* Keeps each part of the request (`params`, `query`, `headers`, and `body`) as separate fields in the input object.
|
|
32
|
+
*
|
|
33
|
+
* Example:
|
|
34
|
+
* ```ts
|
|
35
|
+
* const input = {
|
|
36
|
+
* params: { id: 1 },
|
|
37
|
+
* query: { search: 'hello' },
|
|
38
|
+
* headers: { 'Content-Type': 'application/json' },
|
|
39
|
+
* body: { name: 'John' },
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* @default 'compact'
|
|
44
|
+
*/
|
|
45
|
+
inputStructure?: InputStructure;
|
|
46
|
+
/**
|
|
47
|
+
* Determines how the response should be structured based on the output.
|
|
48
|
+
*
|
|
49
|
+
* @option 'compact'
|
|
50
|
+
* Includes only the body data, encoded directly in the response.
|
|
51
|
+
*
|
|
52
|
+
* @option 'detailed'
|
|
53
|
+
* Separates the output into `headers` and `body` fields.
|
|
54
|
+
* - `headers`: Custom headers to merge with the response headers.
|
|
55
|
+
* - `body`: The response data.
|
|
56
|
+
*
|
|
57
|
+
* Example:
|
|
58
|
+
* ```ts
|
|
59
|
+
* const output = {
|
|
60
|
+
* headers: { 'x-custom-header': 'value' },
|
|
61
|
+
* body: { message: 'Hello, world!' },
|
|
62
|
+
* };
|
|
63
|
+
* ```
|
|
64
|
+
*
|
|
65
|
+
* @default 'compact'
|
|
66
|
+
*/
|
|
67
|
+
outputStructure?: OutputStructure;
|
|
68
|
+
}
|
|
69
|
+
export declare function mergeRoute(a: Route, b: Route): Route;
|
|
70
|
+
export declare function prefixRoute(route: Route, prefix: HTTPPath): Route;
|
|
71
|
+
export declare function unshiftTagRoute(route: Route, tags: readonly string[]): Route;
|
|
72
|
+
export declare function mergePrefix(a: HTTPPath | undefined, b: HTTPPath): HTTPPath;
|
|
73
|
+
export declare function mergeTags(a: readonly string[] | undefined, b: readonly string[]): readonly string[];
|
|
74
|
+
export interface AdaptRouteOptions {
|
|
75
|
+
prefix?: HTTPPath;
|
|
76
|
+
tags?: readonly string[];
|
|
77
|
+
}
|
|
78
|
+
export declare function adaptRoute(route: Route, options: AdaptRouteOptions): Route;
|
|
79
|
+
//# sourceMappingURL=route.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ClientContext } from '@orpc/client';
|
|
2
|
+
import type { ContractProcedure } from './procedure';
|
|
3
|
+
import type { ContractProcedureClient } from './procedure-client';
|
|
4
|
+
import type { AnyContractRouter } from './router';
|
|
5
|
+
export type ContractRouterClient<TRouter extends AnyContractRouter, TClientContext extends ClientContext = Record<never, never>> = TRouter extends ContractProcedure<infer UInputSchema, infer UOutputSchema, infer UErrorMap, any> ? ContractProcedureClient<TClientContext, UInputSchema, UOutputSchema, UErrorMap> : {
|
|
6
|
+
[K in keyof TRouter]: TRouter[K] extends AnyContractRouter ? ContractRouterClient<TRouter[K], TClientContext> : never;
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=router-client.d.ts.map
|
package/dist/src/router.d.ts
CHANGED
|
@@ -1,16 +1,29 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
export type
|
|
7
|
-
[
|
|
1
|
+
import type { Meta } from './meta';
|
|
2
|
+
import type { SchemaInput, SchemaOutput } from './schema';
|
|
3
|
+
import { type ErrorMap, type MergedErrorMap } from './error';
|
|
4
|
+
import { ContractProcedure } from './procedure';
|
|
5
|
+
import { type HTTPPath } from './route';
|
|
6
|
+
export type ContractRouter<TMeta extends Meta> = ContractProcedure<any, any, any, TMeta> | {
|
|
7
|
+
[k: string]: ContractRouter<TMeta>;
|
|
8
|
+
};
|
|
9
|
+
export type AnyContractRouter = ContractRouter<any>;
|
|
10
|
+
export type AdaptedContractRouter<TContract extends AnyContractRouter, TErrorMap extends ErrorMap> = {
|
|
11
|
+
[K in keyof TContract]: TContract[K] extends ContractProcedure<infer UInputSchema, infer UOutputSchema, infer UErrors, infer UMeta> ? ContractProcedure<UInputSchema, UOutputSchema, MergedErrorMap<TErrorMap, UErrors>, UMeta> : TContract[K] extends AnyContractRouter ? AdaptedContractRouter<TContract[K], TErrorMap> : never;
|
|
8
12
|
};
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
|
|
13
|
+
export interface AdaptContractRouterOptions<TErrorMap extends ErrorMap> {
|
|
14
|
+
errorMap: TErrorMap;
|
|
15
|
+
prefix?: HTTPPath;
|
|
16
|
+
tags?: readonly string[];
|
|
17
|
+
}
|
|
18
|
+
export declare function adaptContractRouter<TRouter extends ContractRouter<any>, TErrorMap extends ErrorMap>(contract: TRouter, options: AdaptContractRouterOptions<TErrorMap>): AdaptedContractRouter<TRouter, TErrorMap>;
|
|
19
|
+
export type InferContractRouterInputs<T extends AnyContractRouter> = T extends ContractProcedure<infer UInputSchema, any, any, any> ? SchemaInput<UInputSchema> : {
|
|
20
|
+
[K in keyof T]: T[K] extends AnyContractRouter ? InferContractRouterInputs<T[K]> : never;
|
|
12
21
|
};
|
|
13
|
-
export type InferContractRouterOutputs<T extends
|
|
14
|
-
[K in keyof T]: T[K] extends
|
|
22
|
+
export type InferContractRouterOutputs<T extends AnyContractRouter> = T extends ContractProcedure<any, infer UOutputSchema, any, any> ? SchemaOutput<UOutputSchema> : {
|
|
23
|
+
[K in keyof T]: T[K] extends AnyContractRouter ? InferContractRouterOutputs<T[K]> : never;
|
|
15
24
|
};
|
|
25
|
+
export type ContractRouterToErrorMap<T extends AnyContractRouter> = T extends ContractProcedure<any, any, infer UErrorMap, any> ? UErrorMap : {
|
|
26
|
+
[K in keyof T]: T[K] extends AnyContractRouter ? ContractRouterToErrorMap<T[K]> : never;
|
|
27
|
+
}[keyof T];
|
|
28
|
+
export type ContractRouterToMeta<T extends AnyContractRouter> = T extends ContractRouter<infer UMeta> ? UMeta : never;
|
|
16
29
|
//# sourceMappingURL=router.d.ts.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import type { IsEqual, Promisable } from '@orpc/shared';
|
|
1
2
|
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
2
|
-
export type HTTPPath = `/${string}`;
|
|
3
|
-
export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
|
|
4
|
-
export type HTTPStatus = number;
|
|
5
3
|
export type Schema = StandardSchemaV1 | undefined;
|
|
6
4
|
export type SchemaInput<TSchema extends Schema, TFallback = unknown> = TSchema extends undefined ? TFallback : TSchema extends StandardSchemaV1 ? StandardSchemaV1.InferInput<TSchema> : TFallback;
|
|
7
5
|
export type SchemaOutput<TSchema extends Schema, TFallback = unknown> = TSchema extends undefined ? TFallback : TSchema extends StandardSchemaV1 ? StandardSchemaV1.InferOutput<TSchema> : TFallback;
|
|
8
|
-
|
|
6
|
+
export type TypeRest<TInput, TOutput> = [map: (input: TInput) => Promisable<TOutput>] | (IsEqual<TInput, TOutput> extends true ? [] : never);
|
|
7
|
+
export declare function type<TInput, TOutput = TInput>(...[map]: TypeRest<TInput, TOutput>): StandardSchemaV1<TInput, TOutput>;
|
|
8
|
+
//# sourceMappingURL=schema.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orpc/contract",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.0-next.
|
|
4
|
+
"version": "0.0.0-next.7d3bd71",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://orpc.unnoq.com",
|
|
7
7
|
"repository": {
|
|
@@ -29,8 +29,15 @@
|
|
|
29
29
|
"dist"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@standard
|
|
33
|
-
"@
|
|
32
|
+
"@orpc/server-standard": "^0.4.0",
|
|
33
|
+
"@standard-schema/spec": "^1.0.0",
|
|
34
|
+
"@orpc/client": "0.0.0-next.7d3bd71",
|
|
35
|
+
"@orpc/shared": "0.0.0-next.7d3bd71"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"arktype": "2.0.0-rc.26",
|
|
39
|
+
"valibot": "1.0.0-beta.9",
|
|
40
|
+
"zod": "^3.24.1"
|
|
34
41
|
},
|
|
35
42
|
"scripts": {
|
|
36
43
|
"build": "tsup --clean --sourcemap --entry.index=src/index.ts --format=esm --onSuccess='tsc -b --noCheck'",
|
package/dist/src/constants.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { ContractRouter, HandledContractRouter } from './router';
|
|
2
|
-
import type { HTTPPath } from './types';
|
|
3
|
-
export declare class ContractRouterBuilder {
|
|
4
|
-
zz$crb: {
|
|
5
|
-
prefix?: HTTPPath;
|
|
6
|
-
tags?: string[];
|
|
7
|
-
};
|
|
8
|
-
constructor(zz$crb: {
|
|
9
|
-
prefix?: HTTPPath;
|
|
10
|
-
tags?: string[];
|
|
11
|
-
});
|
|
12
|
-
prefix(prefix: HTTPPath): ContractRouterBuilder;
|
|
13
|
-
tags(...tags: string[]): ContractRouterBuilder;
|
|
14
|
-
router<T extends ContractRouter>(router: T): HandledContractRouter<T>;
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=router-builder.d.ts.map
|
package/dist/src/utils.d.ts
DELETED