callman-mcp 0.7.1 → 0.8.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.
Files changed (67) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +22 -5
  3. package/dist/client/api.d.ts +59 -1
  4. package/dist/client/api.d.ts.map +1 -1
  5. package/dist/client/api.js +67 -0
  6. package/dist/client/api.js.map +1 -1
  7. package/dist/client/errors.d.ts.map +1 -1
  8. package/dist/client/errors.js +18 -11
  9. package/dist/client/errors.js.map +1 -1
  10. package/dist/client/types.d.ts +105 -0
  11. package/dist/client/types.d.ts.map +1 -1
  12. package/dist/context.d.ts +8 -0
  13. package/dist/context.d.ts.map +1 -1
  14. package/dist/context.js +1 -0
  15. package/dist/context.js.map +1 -1
  16. package/dist/domain/requestShape.d.ts +4 -4
  17. package/dist/resources/docs/mocks.d.ts +2 -0
  18. package/dist/resources/docs/mocks.d.ts.map +1 -0
  19. package/dist/resources/docs/mocks.js +210 -0
  20. package/dist/resources/docs/mocks.js.map +1 -0
  21. package/dist/resources/docs/overview.d.ts +1 -1
  22. package/dist/resources/docs/overview.d.ts.map +1 -1
  23. package/dist/resources/docs/overview.js +7 -1
  24. package/dist/resources/docs/overview.js.map +1 -1
  25. package/dist/resources/index.d.ts.map +1 -1
  26. package/dist/resources/index.js +2 -0
  27. package/dist/resources/index.js.map +1 -1
  28. package/dist/server.d.ts +5 -1
  29. package/dist/server.d.ts.map +1 -1
  30. package/dist/server.js +3 -2
  31. package/dist/server.js.map +1 -1
  32. package/dist/tools/catalog.d.ts +1 -1
  33. package/dist/tools/catalog.d.ts.map +1 -1
  34. package/dist/tools/catalog.js +18 -0
  35. package/dist/tools/catalog.js.map +1 -1
  36. package/dist/tools/index.d.ts.map +1 -1
  37. package/dist/tools/index.js +2 -0
  38. package/dist/tools/index.js.map +1 -1
  39. package/dist/tools/meta.d.ts.map +1 -1
  40. package/dist/tools/meta.js +29 -2
  41. package/dist/tools/meta.js.map +1 -1
  42. package/dist/tools/mockShared.d.ts +983 -0
  43. package/dist/tools/mockShared.d.ts.map +1 -0
  44. package/dist/tools/mockShared.js +387 -0
  45. package/dist/tools/mockShared.js.map +1 -0
  46. package/dist/tools/mocks.d.ts +4 -0
  47. package/dist/tools/mocks.d.ts.map +1 -0
  48. package/dist/tools/mocks.js +331 -0
  49. package/dist/tools/mocks.js.map +1 -0
  50. package/dist/tools/mocksLocal.d.ts +24 -0
  51. package/dist/tools/mocksLocal.d.ts.map +1 -0
  52. package/dist/tools/mocksLocal.js +169 -0
  53. package/dist/tools/mocksLocal.js.map +1 -0
  54. package/dist-cjs/client/api.js +67 -0
  55. package/dist-cjs/client/errors.js +18 -11
  56. package/dist-cjs/context.js +1 -0
  57. package/dist-cjs/resources/docs/mocks.js +212 -0
  58. package/dist-cjs/resources/docs/overview.js +7 -1
  59. package/dist-cjs/resources/index.js +2 -0
  60. package/dist-cjs/server.js +3 -2
  61. package/dist-cjs/tools/catalog.js +18 -0
  62. package/dist-cjs/tools/index.js +2 -0
  63. package/dist-cjs/tools/meta.js +28 -1
  64. package/dist-cjs/tools/mockShared.js +414 -0
  65. package/dist-cjs/tools/mocks.js +334 -0
  66. package/dist-cjs/tools/mocksLocal.js +179 -0
  67. package/package.json +1 -1
@@ -0,0 +1,983 @@
1
+ import { z } from "zod";
2
+ import type { LocalMockRecord, LocalMockRouteRecord, MockApiDetail, MockApiRoute, MockApiSummary } from "../client/types.js";
3
+ import type { ToolContext } from "../context.js";
4
+ import { type Named, type Resolved } from "../domain/resolve.js";
5
+ export declare const MOCK_METHODS: readonly ["GET", "POST", "PUT", "DELETE", "PATCH", "ANY"];
6
+ export declare const mockResponseSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
7
+ type: z.ZodLiteral<"static" | "template">;
8
+ statusCode: z.ZodNumber;
9
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
10
+ body: z.ZodOptional<z.ZodUnknown>;
11
+ }, "strict", z.ZodTypeAny, {
12
+ type: "static" | "template";
13
+ statusCode: number;
14
+ headers?: Record<string, string> | undefined;
15
+ body?: unknown;
16
+ }, {
17
+ type: "static" | "template";
18
+ statusCode: number;
19
+ headers?: Record<string, string> | undefined;
20
+ body?: unknown;
21
+ }>, z.ZodObject<{
22
+ type: z.ZodLiteral<"static" | "template">;
23
+ statusCode: z.ZodNumber;
24
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
25
+ body: z.ZodOptional<z.ZodUnknown>;
26
+ }, "strict", z.ZodTypeAny, {
27
+ type: "static" | "template";
28
+ statusCode: number;
29
+ headers?: Record<string, string> | undefined;
30
+ body?: unknown;
31
+ }, {
32
+ type: "static" | "template";
33
+ statusCode: number;
34
+ headers?: Record<string, string> | undefined;
35
+ body?: unknown;
36
+ }>, z.ZodObject<{
37
+ type: z.ZodLiteral<"builder">;
38
+ preset: z.ZodEnum<["list", "detail", "create", "update", "delete", "echo", "custom"]>;
39
+ config: z.ZodRecord<z.ZodString, z.ZodUnknown>;
40
+ }, "strict", z.ZodTypeAny, {
41
+ type: "builder";
42
+ config: Record<string, unknown>;
43
+ preset: "list" | "create" | "update" | "delete" | "custom" | "detail" | "echo";
44
+ }, {
45
+ type: "builder";
46
+ config: Record<string, unknown>;
47
+ preset: "list" | "create" | "update" | "delete" | "custom" | "detail" | "echo";
48
+ }>]>;
49
+ export declare const mockRouteInputSchema: z.ZodObject<{
50
+ method: z.ZodEnum<["GET", "POST", "PUT", "DELETE", "PATCH", "ANY"]>;
51
+ path: z.ZodString;
52
+ name: z.ZodOptional<z.ZodString>;
53
+ response: z.ZodOptional<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
54
+ type: z.ZodLiteral<"static" | "template">;
55
+ statusCode: z.ZodNumber;
56
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
57
+ body: z.ZodOptional<z.ZodUnknown>;
58
+ }, "strict", z.ZodTypeAny, {
59
+ type: "static" | "template";
60
+ statusCode: number;
61
+ headers?: Record<string, string> | undefined;
62
+ body?: unknown;
63
+ }, {
64
+ type: "static" | "template";
65
+ statusCode: number;
66
+ headers?: Record<string, string> | undefined;
67
+ body?: unknown;
68
+ }>, z.ZodObject<{
69
+ type: z.ZodLiteral<"static" | "template">;
70
+ statusCode: z.ZodNumber;
71
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
72
+ body: z.ZodOptional<z.ZodUnknown>;
73
+ }, "strict", z.ZodTypeAny, {
74
+ type: "static" | "template";
75
+ statusCode: number;
76
+ headers?: Record<string, string> | undefined;
77
+ body?: unknown;
78
+ }, {
79
+ type: "static" | "template";
80
+ statusCode: number;
81
+ headers?: Record<string, string> | undefined;
82
+ body?: unknown;
83
+ }>, z.ZodObject<{
84
+ type: z.ZodLiteral<"builder">;
85
+ preset: z.ZodEnum<["list", "detail", "create", "update", "delete", "echo", "custom"]>;
86
+ config: z.ZodRecord<z.ZodString, z.ZodUnknown>;
87
+ }, "strict", z.ZodTypeAny, {
88
+ type: "builder";
89
+ config: Record<string, unknown>;
90
+ preset: "list" | "create" | "update" | "delete" | "custom" | "detail" | "echo";
91
+ }, {
92
+ type: "builder";
93
+ config: Record<string, unknown>;
94
+ preset: "list" | "create" | "update" | "delete" | "custom" | "detail" | "echo";
95
+ }>]>>;
96
+ statusCode: z.ZodOptional<z.ZodNumber>;
97
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
98
+ body: z.ZodOptional<z.ZodUnknown>;
99
+ variants: z.ZodOptional<z.ZodArray<z.ZodObject<{
100
+ variantId: z.ZodOptional<z.ZodString>;
101
+ priority: z.ZodNumber;
102
+ condition: z.ZodObject<{
103
+ type: z.ZodEnum<["all", "any"]>;
104
+ rules: z.ZodArray<z.ZodObject<{
105
+ field: z.ZodString;
106
+ operator: z.ZodEnum<["exists", "not-exists", "equals", "not-equals", "contains", "starts-with", "matches"]>;
107
+ value: z.ZodOptional<z.ZodString>;
108
+ }, "strict", z.ZodTypeAny, {
109
+ operator: "equals" | "exists" | "contains" | "not-exists" | "not-equals" | "starts-with" | "matches";
110
+ field: string;
111
+ value?: string | undefined;
112
+ }, {
113
+ operator: "equals" | "exists" | "contains" | "not-exists" | "not-equals" | "starts-with" | "matches";
114
+ field: string;
115
+ value?: string | undefined;
116
+ }>, "many">;
117
+ }, "strict", z.ZodTypeAny, {
118
+ type: "any" | "all";
119
+ rules: {
120
+ operator: "equals" | "exists" | "contains" | "not-exists" | "not-equals" | "starts-with" | "matches";
121
+ field: string;
122
+ value?: string | undefined;
123
+ }[];
124
+ }, {
125
+ type: "any" | "all";
126
+ rules: {
127
+ operator: "equals" | "exists" | "contains" | "not-exists" | "not-equals" | "starts-with" | "matches";
128
+ field: string;
129
+ value?: string | undefined;
130
+ }[];
131
+ }>;
132
+ response: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
133
+ type: z.ZodLiteral<"static" | "template">;
134
+ statusCode: z.ZodNumber;
135
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
136
+ body: z.ZodOptional<z.ZodUnknown>;
137
+ }, "strict", z.ZodTypeAny, {
138
+ type: "static" | "template";
139
+ statusCode: number;
140
+ headers?: Record<string, string> | undefined;
141
+ body?: unknown;
142
+ }, {
143
+ type: "static" | "template";
144
+ statusCode: number;
145
+ headers?: Record<string, string> | undefined;
146
+ body?: unknown;
147
+ }>, z.ZodObject<{
148
+ type: z.ZodLiteral<"static" | "template">;
149
+ statusCode: z.ZodNumber;
150
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
151
+ body: z.ZodOptional<z.ZodUnknown>;
152
+ }, "strict", z.ZodTypeAny, {
153
+ type: "static" | "template";
154
+ statusCode: number;
155
+ headers?: Record<string, string> | undefined;
156
+ body?: unknown;
157
+ }, {
158
+ type: "static" | "template";
159
+ statusCode: number;
160
+ headers?: Record<string, string> | undefined;
161
+ body?: unknown;
162
+ }>, z.ZodObject<{
163
+ type: z.ZodLiteral<"builder">;
164
+ preset: z.ZodEnum<["list", "detail", "create", "update", "delete", "echo", "custom"]>;
165
+ config: z.ZodRecord<z.ZodString, z.ZodUnknown>;
166
+ }, "strict", z.ZodTypeAny, {
167
+ type: "builder";
168
+ config: Record<string, unknown>;
169
+ preset: "list" | "create" | "update" | "delete" | "custom" | "detail" | "echo";
170
+ }, {
171
+ type: "builder";
172
+ config: Record<string, unknown>;
173
+ preset: "list" | "create" | "update" | "delete" | "custom" | "detail" | "echo";
174
+ }>]>;
175
+ }, "strict", z.ZodTypeAny, {
176
+ priority: number;
177
+ response: {
178
+ type: "builder";
179
+ config: Record<string, unknown>;
180
+ preset: "list" | "create" | "update" | "delete" | "custom" | "detail" | "echo";
181
+ } | {
182
+ type: "static" | "template";
183
+ statusCode: number;
184
+ headers?: Record<string, string> | undefined;
185
+ body?: unknown;
186
+ };
187
+ condition: {
188
+ type: "any" | "all";
189
+ rules: {
190
+ operator: "equals" | "exists" | "contains" | "not-exists" | "not-equals" | "starts-with" | "matches";
191
+ field: string;
192
+ value?: string | undefined;
193
+ }[];
194
+ };
195
+ variantId?: string | undefined;
196
+ }, {
197
+ priority: number;
198
+ response: {
199
+ type: "builder";
200
+ config: Record<string, unknown>;
201
+ preset: "list" | "create" | "update" | "delete" | "custom" | "detail" | "echo";
202
+ } | {
203
+ type: "static" | "template";
204
+ statusCode: number;
205
+ headers?: Record<string, string> | undefined;
206
+ body?: unknown;
207
+ };
208
+ condition: {
209
+ type: "any" | "all";
210
+ rules: {
211
+ operator: "equals" | "exists" | "contains" | "not-exists" | "not-equals" | "starts-with" | "matches";
212
+ field: string;
213
+ value?: string | undefined;
214
+ }[];
215
+ };
216
+ variantId?: string | undefined;
217
+ }>, "many">>;
218
+ delay: z.ZodOptional<z.ZodDiscriminatedUnion<"mode", [z.ZodObject<{
219
+ mode: z.ZodLiteral<"none">;
220
+ }, "strict", z.ZodTypeAny, {
221
+ mode: "none";
222
+ }, {
223
+ mode: "none";
224
+ }>, z.ZodObject<{
225
+ mode: z.ZodLiteral<"fixed">;
226
+ ms: z.ZodNumber;
227
+ }, "strict", z.ZodTypeAny, {
228
+ mode: "fixed";
229
+ ms: number;
230
+ }, {
231
+ mode: "fixed";
232
+ ms: number;
233
+ }>, z.ZodObject<{
234
+ mode: z.ZodLiteral<"random">;
235
+ minMs: z.ZodNumber;
236
+ maxMs: z.ZodNumber;
237
+ }, "strict", z.ZodTypeAny, {
238
+ mode: "random";
239
+ minMs: number;
240
+ maxMs: number;
241
+ }, {
242
+ mode: "random";
243
+ minMs: number;
244
+ maxMs: number;
245
+ }>]>>;
246
+ requestValidation: z.ZodOptional<z.ZodNullable<z.ZodObject<{
247
+ mode: z.ZodEnum<["any", "schema"]>;
248
+ schema: z.ZodOptional<z.ZodUnknown>;
249
+ }, "strict", z.ZodTypeAny, {
250
+ mode: "any" | "schema";
251
+ schema?: unknown;
252
+ }, {
253
+ mode: "any" | "schema";
254
+ schema?: unknown;
255
+ }>>>;
256
+ }, "strict", z.ZodTypeAny, {
257
+ method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "ANY";
258
+ path: string;
259
+ headers?: Record<string, string> | undefined;
260
+ name?: string | undefined;
261
+ body?: unknown;
262
+ statusCode?: number | undefined;
263
+ response?: {
264
+ type: "builder";
265
+ config: Record<string, unknown>;
266
+ preset: "list" | "create" | "update" | "delete" | "custom" | "detail" | "echo";
267
+ } | {
268
+ type: "static" | "template";
269
+ statusCode: number;
270
+ headers?: Record<string, string> | undefined;
271
+ body?: unknown;
272
+ } | undefined;
273
+ delay?: {
274
+ mode: "none";
275
+ } | {
276
+ mode: "fixed";
277
+ ms: number;
278
+ } | {
279
+ mode: "random";
280
+ minMs: number;
281
+ maxMs: number;
282
+ } | undefined;
283
+ requestValidation?: {
284
+ mode: "any" | "schema";
285
+ schema?: unknown;
286
+ } | null | undefined;
287
+ variants?: {
288
+ priority: number;
289
+ response: {
290
+ type: "builder";
291
+ config: Record<string, unknown>;
292
+ preset: "list" | "create" | "update" | "delete" | "custom" | "detail" | "echo";
293
+ } | {
294
+ type: "static" | "template";
295
+ statusCode: number;
296
+ headers?: Record<string, string> | undefined;
297
+ body?: unknown;
298
+ };
299
+ condition: {
300
+ type: "any" | "all";
301
+ rules: {
302
+ operator: "equals" | "exists" | "contains" | "not-exists" | "not-equals" | "starts-with" | "matches";
303
+ field: string;
304
+ value?: string | undefined;
305
+ }[];
306
+ };
307
+ variantId?: string | undefined;
308
+ }[] | undefined;
309
+ }, {
310
+ method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "ANY";
311
+ path: string;
312
+ headers?: Record<string, string> | undefined;
313
+ name?: string | undefined;
314
+ body?: unknown;
315
+ statusCode?: number | undefined;
316
+ response?: {
317
+ type: "builder";
318
+ config: Record<string, unknown>;
319
+ preset: "list" | "create" | "update" | "delete" | "custom" | "detail" | "echo";
320
+ } | {
321
+ type: "static" | "template";
322
+ statusCode: number;
323
+ headers?: Record<string, string> | undefined;
324
+ body?: unknown;
325
+ } | undefined;
326
+ delay?: {
327
+ mode: "none";
328
+ } | {
329
+ mode: "fixed";
330
+ ms: number;
331
+ } | {
332
+ mode: "random";
333
+ minMs: number;
334
+ maxMs: number;
335
+ } | undefined;
336
+ requestValidation?: {
337
+ mode: "any" | "schema";
338
+ schema?: unknown;
339
+ } | null | undefined;
340
+ variants?: {
341
+ priority: number;
342
+ response: {
343
+ type: "builder";
344
+ config: Record<string, unknown>;
345
+ preset: "list" | "create" | "update" | "delete" | "custom" | "detail" | "echo";
346
+ } | {
347
+ type: "static" | "template";
348
+ statusCode: number;
349
+ headers?: Record<string, string> | undefined;
350
+ body?: unknown;
351
+ };
352
+ condition: {
353
+ type: "any" | "all";
354
+ rules: {
355
+ operator: "equals" | "exists" | "contains" | "not-exists" | "not-equals" | "starts-with" | "matches";
356
+ field: string;
357
+ value?: string | undefined;
358
+ }[];
359
+ };
360
+ variantId?: string | undefined;
361
+ }[] | undefined;
362
+ }>;
363
+ export declare const mockRoutePatchSchema: z.ZodObject<{
364
+ method: z.ZodOptional<z.ZodEnum<["GET", "POST", "PUT", "DELETE", "PATCH", "ANY"]>>;
365
+ path: z.ZodOptional<z.ZodString>;
366
+ name: z.ZodOptional<z.ZodOptional<z.ZodString>>;
367
+ response: z.ZodOptional<z.ZodOptional<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
368
+ type: z.ZodLiteral<"static" | "template">;
369
+ statusCode: z.ZodNumber;
370
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
371
+ body: z.ZodOptional<z.ZodUnknown>;
372
+ }, "strict", z.ZodTypeAny, {
373
+ type: "static" | "template";
374
+ statusCode: number;
375
+ headers?: Record<string, string> | undefined;
376
+ body?: unknown;
377
+ }, {
378
+ type: "static" | "template";
379
+ statusCode: number;
380
+ headers?: Record<string, string> | undefined;
381
+ body?: unknown;
382
+ }>, z.ZodObject<{
383
+ type: z.ZodLiteral<"static" | "template">;
384
+ statusCode: z.ZodNumber;
385
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
386
+ body: z.ZodOptional<z.ZodUnknown>;
387
+ }, "strict", z.ZodTypeAny, {
388
+ type: "static" | "template";
389
+ statusCode: number;
390
+ headers?: Record<string, string> | undefined;
391
+ body?: unknown;
392
+ }, {
393
+ type: "static" | "template";
394
+ statusCode: number;
395
+ headers?: Record<string, string> | undefined;
396
+ body?: unknown;
397
+ }>, z.ZodObject<{
398
+ type: z.ZodLiteral<"builder">;
399
+ preset: z.ZodEnum<["list", "detail", "create", "update", "delete", "echo", "custom"]>;
400
+ config: z.ZodRecord<z.ZodString, z.ZodUnknown>;
401
+ }, "strict", z.ZodTypeAny, {
402
+ type: "builder";
403
+ config: Record<string, unknown>;
404
+ preset: "list" | "create" | "update" | "delete" | "custom" | "detail" | "echo";
405
+ }, {
406
+ type: "builder";
407
+ config: Record<string, unknown>;
408
+ preset: "list" | "create" | "update" | "delete" | "custom" | "detail" | "echo";
409
+ }>]>>>;
410
+ statusCode: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
411
+ headers: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
412
+ body: z.ZodOptional<z.ZodOptional<z.ZodUnknown>>;
413
+ variants: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodObject<{
414
+ variantId: z.ZodOptional<z.ZodString>;
415
+ priority: z.ZodNumber;
416
+ condition: z.ZodObject<{
417
+ type: z.ZodEnum<["all", "any"]>;
418
+ rules: z.ZodArray<z.ZodObject<{
419
+ field: z.ZodString;
420
+ operator: z.ZodEnum<["exists", "not-exists", "equals", "not-equals", "contains", "starts-with", "matches"]>;
421
+ value: z.ZodOptional<z.ZodString>;
422
+ }, "strict", z.ZodTypeAny, {
423
+ operator: "equals" | "exists" | "contains" | "not-exists" | "not-equals" | "starts-with" | "matches";
424
+ field: string;
425
+ value?: string | undefined;
426
+ }, {
427
+ operator: "equals" | "exists" | "contains" | "not-exists" | "not-equals" | "starts-with" | "matches";
428
+ field: string;
429
+ value?: string | undefined;
430
+ }>, "many">;
431
+ }, "strict", z.ZodTypeAny, {
432
+ type: "any" | "all";
433
+ rules: {
434
+ operator: "equals" | "exists" | "contains" | "not-exists" | "not-equals" | "starts-with" | "matches";
435
+ field: string;
436
+ value?: string | undefined;
437
+ }[];
438
+ }, {
439
+ type: "any" | "all";
440
+ rules: {
441
+ operator: "equals" | "exists" | "contains" | "not-exists" | "not-equals" | "starts-with" | "matches";
442
+ field: string;
443
+ value?: string | undefined;
444
+ }[];
445
+ }>;
446
+ response: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
447
+ type: z.ZodLiteral<"static" | "template">;
448
+ statusCode: z.ZodNumber;
449
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
450
+ body: z.ZodOptional<z.ZodUnknown>;
451
+ }, "strict", z.ZodTypeAny, {
452
+ type: "static" | "template";
453
+ statusCode: number;
454
+ headers?: Record<string, string> | undefined;
455
+ body?: unknown;
456
+ }, {
457
+ type: "static" | "template";
458
+ statusCode: number;
459
+ headers?: Record<string, string> | undefined;
460
+ body?: unknown;
461
+ }>, z.ZodObject<{
462
+ type: z.ZodLiteral<"static" | "template">;
463
+ statusCode: z.ZodNumber;
464
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
465
+ body: z.ZodOptional<z.ZodUnknown>;
466
+ }, "strict", z.ZodTypeAny, {
467
+ type: "static" | "template";
468
+ statusCode: number;
469
+ headers?: Record<string, string> | undefined;
470
+ body?: unknown;
471
+ }, {
472
+ type: "static" | "template";
473
+ statusCode: number;
474
+ headers?: Record<string, string> | undefined;
475
+ body?: unknown;
476
+ }>, z.ZodObject<{
477
+ type: z.ZodLiteral<"builder">;
478
+ preset: z.ZodEnum<["list", "detail", "create", "update", "delete", "echo", "custom"]>;
479
+ config: z.ZodRecord<z.ZodString, z.ZodUnknown>;
480
+ }, "strict", z.ZodTypeAny, {
481
+ type: "builder";
482
+ config: Record<string, unknown>;
483
+ preset: "list" | "create" | "update" | "delete" | "custom" | "detail" | "echo";
484
+ }, {
485
+ type: "builder";
486
+ config: Record<string, unknown>;
487
+ preset: "list" | "create" | "update" | "delete" | "custom" | "detail" | "echo";
488
+ }>]>;
489
+ }, "strict", z.ZodTypeAny, {
490
+ priority: number;
491
+ response: {
492
+ type: "builder";
493
+ config: Record<string, unknown>;
494
+ preset: "list" | "create" | "update" | "delete" | "custom" | "detail" | "echo";
495
+ } | {
496
+ type: "static" | "template";
497
+ statusCode: number;
498
+ headers?: Record<string, string> | undefined;
499
+ body?: unknown;
500
+ };
501
+ condition: {
502
+ type: "any" | "all";
503
+ rules: {
504
+ operator: "equals" | "exists" | "contains" | "not-exists" | "not-equals" | "starts-with" | "matches";
505
+ field: string;
506
+ value?: string | undefined;
507
+ }[];
508
+ };
509
+ variantId?: string | undefined;
510
+ }, {
511
+ priority: number;
512
+ response: {
513
+ type: "builder";
514
+ config: Record<string, unknown>;
515
+ preset: "list" | "create" | "update" | "delete" | "custom" | "detail" | "echo";
516
+ } | {
517
+ type: "static" | "template";
518
+ statusCode: number;
519
+ headers?: Record<string, string> | undefined;
520
+ body?: unknown;
521
+ };
522
+ condition: {
523
+ type: "any" | "all";
524
+ rules: {
525
+ operator: "equals" | "exists" | "contains" | "not-exists" | "not-equals" | "starts-with" | "matches";
526
+ field: string;
527
+ value?: string | undefined;
528
+ }[];
529
+ };
530
+ variantId?: string | undefined;
531
+ }>, "many">>>;
532
+ delay: z.ZodOptional<z.ZodOptional<z.ZodDiscriminatedUnion<"mode", [z.ZodObject<{
533
+ mode: z.ZodLiteral<"none">;
534
+ }, "strict", z.ZodTypeAny, {
535
+ mode: "none";
536
+ }, {
537
+ mode: "none";
538
+ }>, z.ZodObject<{
539
+ mode: z.ZodLiteral<"fixed">;
540
+ ms: z.ZodNumber;
541
+ }, "strict", z.ZodTypeAny, {
542
+ mode: "fixed";
543
+ ms: number;
544
+ }, {
545
+ mode: "fixed";
546
+ ms: number;
547
+ }>, z.ZodObject<{
548
+ mode: z.ZodLiteral<"random">;
549
+ minMs: z.ZodNumber;
550
+ maxMs: z.ZodNumber;
551
+ }, "strict", z.ZodTypeAny, {
552
+ mode: "random";
553
+ minMs: number;
554
+ maxMs: number;
555
+ }, {
556
+ mode: "random";
557
+ minMs: number;
558
+ maxMs: number;
559
+ }>]>>>;
560
+ requestValidation: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodObject<{
561
+ mode: z.ZodEnum<["any", "schema"]>;
562
+ schema: z.ZodOptional<z.ZodUnknown>;
563
+ }, "strict", z.ZodTypeAny, {
564
+ mode: "any" | "schema";
565
+ schema?: unknown;
566
+ }, {
567
+ mode: "any" | "schema";
568
+ schema?: unknown;
569
+ }>>>>;
570
+ }, "strict", z.ZodTypeAny, {
571
+ method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "ANY" | undefined;
572
+ headers?: Record<string, string> | undefined;
573
+ name?: string | undefined;
574
+ body?: unknown;
575
+ statusCode?: number | undefined;
576
+ path?: string | undefined;
577
+ response?: {
578
+ type: "builder";
579
+ config: Record<string, unknown>;
580
+ preset: "list" | "create" | "update" | "delete" | "custom" | "detail" | "echo";
581
+ } | {
582
+ type: "static" | "template";
583
+ statusCode: number;
584
+ headers?: Record<string, string> | undefined;
585
+ body?: unknown;
586
+ } | undefined;
587
+ delay?: {
588
+ mode: "none";
589
+ } | {
590
+ mode: "fixed";
591
+ ms: number;
592
+ } | {
593
+ mode: "random";
594
+ minMs: number;
595
+ maxMs: number;
596
+ } | undefined;
597
+ requestValidation?: {
598
+ mode: "any" | "schema";
599
+ schema?: unknown;
600
+ } | null | undefined;
601
+ variants?: {
602
+ priority: number;
603
+ response: {
604
+ type: "builder";
605
+ config: Record<string, unknown>;
606
+ preset: "list" | "create" | "update" | "delete" | "custom" | "detail" | "echo";
607
+ } | {
608
+ type: "static" | "template";
609
+ statusCode: number;
610
+ headers?: Record<string, string> | undefined;
611
+ body?: unknown;
612
+ };
613
+ condition: {
614
+ type: "any" | "all";
615
+ rules: {
616
+ operator: "equals" | "exists" | "contains" | "not-exists" | "not-equals" | "starts-with" | "matches";
617
+ field: string;
618
+ value?: string | undefined;
619
+ }[];
620
+ };
621
+ variantId?: string | undefined;
622
+ }[] | undefined;
623
+ }, {
624
+ method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "ANY" | undefined;
625
+ headers?: Record<string, string> | undefined;
626
+ name?: string | undefined;
627
+ body?: unknown;
628
+ statusCode?: number | undefined;
629
+ path?: string | undefined;
630
+ response?: {
631
+ type: "builder";
632
+ config: Record<string, unknown>;
633
+ preset: "list" | "create" | "update" | "delete" | "custom" | "detail" | "echo";
634
+ } | {
635
+ type: "static" | "template";
636
+ statusCode: number;
637
+ headers?: Record<string, string> | undefined;
638
+ body?: unknown;
639
+ } | undefined;
640
+ delay?: {
641
+ mode: "none";
642
+ } | {
643
+ mode: "fixed";
644
+ ms: number;
645
+ } | {
646
+ mode: "random";
647
+ minMs: number;
648
+ maxMs: number;
649
+ } | undefined;
650
+ requestValidation?: {
651
+ mode: "any" | "schema";
652
+ schema?: unknown;
653
+ } | null | undefined;
654
+ variants?: {
655
+ priority: number;
656
+ response: {
657
+ type: "builder";
658
+ config: Record<string, unknown>;
659
+ preset: "list" | "create" | "update" | "delete" | "custom" | "detail" | "echo";
660
+ } | {
661
+ type: "static" | "template";
662
+ statusCode: number;
663
+ headers?: Record<string, string> | undefined;
664
+ body?: unknown;
665
+ };
666
+ condition: {
667
+ type: "any" | "all";
668
+ rules: {
669
+ operator: "equals" | "exists" | "contains" | "not-exists" | "not-equals" | "starts-with" | "matches";
670
+ field: string;
671
+ value?: string | undefined;
672
+ }[];
673
+ };
674
+ variantId?: string | undefined;
675
+ }[] | undefined;
676
+ }>;
677
+ export type MockRouteInput = z.infer<typeof mockRouteInputSchema>;
678
+ export type MockRoutePatch = z.infer<typeof mockRoutePatchSchema>;
679
+ export declare const assertRoutePath: (path: string, where: string) => void;
680
+ export declare const toServerRoute: (input: MockRouteInput, where: string) => Record<string, unknown>;
681
+ export declare const toServerRoutePatch: (patch: MockRoutePatch, current: MockApiRoute, where: string) => Record<string, unknown>;
682
+ export declare const duplicateRoutes: (routes: Array<{
683
+ method: string;
684
+ path: string;
685
+ }>) => string[];
686
+ export declare const mockListView: (mock: MockApiSummary) => {
687
+ auth: "token" | "public";
688
+ publicUrl: string;
689
+ requestCount: number;
690
+ expiresAt: string;
691
+ expired: boolean;
692
+ createdAt: string;
693
+ description?: string | undefined;
694
+ mockId: string;
695
+ id: string;
696
+ name: string;
697
+ };
698
+ export declare const mockSummaryView: (mock: MockApiSummary) => {
699
+ routeCount: number;
700
+ stateSizeBytes: number;
701
+ auth: "token" | "public";
702
+ publicUrl: string;
703
+ requestCount: number;
704
+ expiresAt: string;
705
+ expired: boolean;
706
+ createdAt: string;
707
+ description?: string | undefined;
708
+ mockId: string;
709
+ id: string;
710
+ name: string;
711
+ };
712
+ export declare const alternativeUrl: (apiUrl: string, mock: Pick<MockApiSummary, "mockId" | "publicUrl">) => Record<string, string>;
713
+ export declare const routeView: (route: MockApiRoute) => {
714
+ requestValidation?: {
715
+ mode: "any" | "schema";
716
+ schema?: unknown;
717
+ } | undefined;
718
+ delay: Record<string, unknown>;
719
+ variants?: Record<string, unknown>[] | undefined;
720
+ response: Record<string, unknown>;
721
+ name?: string | undefined;
722
+ routeId: string;
723
+ method: import("../client/types.js").MockHttpMethod;
724
+ path: string;
725
+ };
726
+ export declare const routesView: (routes: MockApiRoute[]) => {
727
+ routes: {
728
+ requestValidation?: {
729
+ mode: "any" | "schema";
730
+ schema?: unknown;
731
+ } | undefined;
732
+ delay: Record<string, unknown>;
733
+ variants?: Record<string, unknown>[] | undefined;
734
+ response: Record<string, unknown>;
735
+ name?: string | undefined;
736
+ routeId: string;
737
+ method: import("../client/types.js").MockHttpMethod;
738
+ path: string;
739
+ }[];
740
+ routesTruncated?: undefined;
741
+ routesNote?: undefined;
742
+ } | {
743
+ routes: {
744
+ variants?: number | undefined;
745
+ statusCode?: number | undefined;
746
+ responseType: unknown;
747
+ name?: string | undefined;
748
+ routeId: string;
749
+ method: import("../client/types.js").MockHttpMethod;
750
+ path: string;
751
+ }[];
752
+ routesTruncated: boolean;
753
+ routesNote: string;
754
+ };
755
+ export declare const mockDetailView: (mock: MockApiDetail, apiUrl: string, auth: Record<string, unknown>) => {
756
+ routes: {
757
+ requestValidation?: {
758
+ mode: "any" | "schema";
759
+ schema?: unknown;
760
+ } | undefined;
761
+ delay: Record<string, unknown>;
762
+ variants?: Record<string, unknown>[] | undefined;
763
+ response: Record<string, unknown>;
764
+ name?: string | undefined;
765
+ routeId: string;
766
+ method: import("../client/types.js").MockHttpMethod;
767
+ path: string;
768
+ }[];
769
+ routesTruncated?: undefined;
770
+ routesNote?: undefined;
771
+ auth: Record<string, unknown>;
772
+ limits: {
773
+ totalRequests: number;
774
+ rateLimitPerSecond: number;
775
+ };
776
+ routeCount: number;
777
+ stateSizeBytes: number;
778
+ publicUrl: string;
779
+ requestCount: number;
780
+ expiresAt: string;
781
+ expired: boolean;
782
+ createdAt: string;
783
+ description?: string | undefined;
784
+ mockId: string;
785
+ id: string;
786
+ name: string;
787
+ } | {
788
+ routes: {
789
+ variants?: number | undefined;
790
+ statusCode?: number | undefined;
791
+ responseType: unknown;
792
+ name?: string | undefined;
793
+ routeId: string;
794
+ method: import("../client/types.js").MockHttpMethod;
795
+ path: string;
796
+ }[];
797
+ routesTruncated: boolean;
798
+ routesNote: string;
799
+ auth: Record<string, unknown>;
800
+ limits: {
801
+ totalRequests: number;
802
+ rateLimitPerSecond: number;
803
+ };
804
+ routeCount: number;
805
+ stateSizeBytes: number;
806
+ publicUrl: string;
807
+ requestCount: number;
808
+ expiresAt: string;
809
+ expired: boolean;
810
+ createdAt: string;
811
+ description?: string | undefined;
812
+ mockId: string;
813
+ id: string;
814
+ name: string;
815
+ };
816
+ export declare const sampleRoutePath: (path: string) => string;
817
+ export interface CurlRoute {
818
+ method: string;
819
+ path: string;
820
+ response?: Record<string, unknown>;
821
+ requestValidation?: {
822
+ mode?: string;
823
+ schema?: unknown;
824
+ } | null;
825
+ }
826
+ export declare const curlLine: (baseUrl: string, route: CurlRoute, token: string | null | undefined) => string;
827
+ export declare const mockRefArg: (what: string) => z.ZodString;
828
+ export declare const targetArg: z.ZodOptional<z.ZodEnum<["server", "desktop"]>>;
829
+ export declare const requireTarget: (target: "server" | "desktop", args: Record<string, unknown>, only: "server" | "desktop", hint: string) => void;
830
+ interface MockRef extends Named {
831
+ summary: MockApiSummary;
832
+ }
833
+ export declare const loadMocks: (ctx: ToolContext, ws: string) => Promise<MockApiSummary[]>;
834
+ export declare const resolveMock: (ctx: ToolContext, ws: string, ref: string, options?: {
835
+ exact?: boolean;
836
+ }) => Promise<Resolved<MockRef>>;
837
+ export declare const findMock: (ctx: ToolContext, workspace: string | null | undefined, ref: string, options?: {
838
+ exact?: boolean;
839
+ }) => Promise<import("./lookups.js").Found<Resolved<MockRef>>>;
840
+ export declare const resolveRoute: (mock: MockApiDetail, ref: string) => MockApiRoute;
841
+ export declare const LOCAL_BODY_MAX_BYTES: number;
842
+ export declare const LOCAL_DELAY_MAX_MS = 30000;
843
+ export declare const toLocalRoute: (input: MockRouteInput, where: string) => LocalMockRouteRecord;
844
+ export declare const localBaseUrl: (mock: Pick<LocalMockRecord, "port">) => string;
845
+ export declare const localRouteView: (route: LocalMockRouteRecord) => {
846
+ statusCode: number;
847
+ headers: Record<string, string>;
848
+ body: string;
849
+ delay: {
850
+ mode: "none";
851
+ } | {
852
+ mode: "fixed";
853
+ ms: number;
854
+ } | {
855
+ mode: "random";
856
+ minMs: number;
857
+ maxMs: number;
858
+ };
859
+ name?: string | undefined;
860
+ method: import("../client/types.js").MockHttpMethod;
861
+ path: string;
862
+ routeId?: string | undefined;
863
+ };
864
+ export declare const localMockView: (mock: LocalMockRecord, options?: {
865
+ routes: boolean;
866
+ }) => {
867
+ routes: {
868
+ statusCode: number;
869
+ headers: Record<string, string>;
870
+ body: string;
871
+ delay: {
872
+ mode: "none";
873
+ } | {
874
+ mode: "fixed";
875
+ ms: number;
876
+ } | {
877
+ mode: "random";
878
+ minMs: number;
879
+ maxMs: number;
880
+ };
881
+ name?: string | undefined;
882
+ method: import("../client/types.js").MockHttpMethod;
883
+ path: string;
884
+ routeId?: string | undefined;
885
+ }[];
886
+ requestCount: number;
887
+ routeCount: number;
888
+ lastError?: string | undefined;
889
+ source?: string | undefined;
890
+ id: string;
891
+ name: string;
892
+ port: number;
893
+ running: boolean;
894
+ baseUrl: string;
895
+ autoStart: boolean;
896
+ } | {
897
+ routes: {
898
+ statusCode: number;
899
+ delay: {
900
+ mode: "none";
901
+ } | {
902
+ mode: "fixed";
903
+ ms: number;
904
+ } | {
905
+ mode: "random";
906
+ minMs: number;
907
+ maxMs: number;
908
+ };
909
+ name?: string | undefined;
910
+ method: import("../client/types.js").MockHttpMethod;
911
+ path: string;
912
+ routeId?: string | undefined;
913
+ }[];
914
+ routesTruncated: boolean;
915
+ requestCount: number;
916
+ routeCount: number;
917
+ lastError?: string | undefined;
918
+ source?: string | undefined;
919
+ id: string;
920
+ name: string;
921
+ port: number;
922
+ running: boolean;
923
+ baseUrl: string;
924
+ autoStart: boolean;
925
+ } | {
926
+ requestCount: number;
927
+ routeCount: number;
928
+ lastError?: string | undefined;
929
+ source?: string | undefined;
930
+ id: string;
931
+ name: string;
932
+ port: number;
933
+ running: boolean;
934
+ baseUrl: string;
935
+ autoStart: boolean;
936
+ };
937
+ export declare const localCalls: (mock: LocalMockRecord) => {
938
+ route: string;
939
+ curl: string;
940
+ }[];
941
+ export declare const resolveLocalMock: (mocks: LocalMockRecord[], ref: string, options?: {
942
+ exact?: boolean;
943
+ }) => Resolved<Named & {
944
+ record: LocalMockRecord;
945
+ }>;
946
+ interface LogEntry {
947
+ _id?: unknown;
948
+ createdAt?: unknown;
949
+ request?: {
950
+ method?: string;
951
+ path?: string;
952
+ query?: Record<string, unknown>;
953
+ body?: unknown;
954
+ };
955
+ response?: {
956
+ statusCode?: number;
957
+ durationMs?: number;
958
+ body?: unknown;
959
+ };
960
+ matchInfo?: {
961
+ matched?: boolean;
962
+ matchedRouteId?: string;
963
+ matchedVariantId?: string;
964
+ failureReason?: string;
965
+ };
966
+ }
967
+ export declare const logView: (entry: LogEntry) => {
968
+ failureReason?: string | undefined;
969
+ variantId?: string | undefined;
970
+ routeId?: string | undefined;
971
+ matched: boolean;
972
+ responseBody?: string | null | undefined;
973
+ statusCode: number | undefined;
974
+ durationMs: number | undefined;
975
+ requestBody?: string | null | undefined;
976
+ query?: Record<string, unknown> | undefined;
977
+ id: string;
978
+ at: unknown;
979
+ method: string | undefined;
980
+ path: string | undefined;
981
+ };
982
+ export {};
983
+ //# sourceMappingURL=mockShared.d.ts.map