stitchkit 0.40.0 → 0.41.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/dist/browser/client.d.ts.map +1 -1
- package/dist/browser/http.d.ts +1 -1
- package/dist/browser/http.d.ts.map +1 -1
- package/dist/cli.js +2 -2
- package/dist/{index-7rbzbnnf.js → index-4e1c0hsw.js} +10 -15
- package/dist/{index-92gs1m5b.js → index-dnkefke9.js} +1 -1
- package/dist/{index-p1x65gk7.js → index-ncqqn1bc.js} +10 -12
- package/dist/{index-fyfk537k.js → index-sc67e454.js} +18 -1
- package/dist/index.js +35 -11
- package/dist/internal/errors.d.ts +13 -0
- package/dist/internal/errors.d.ts.map +1 -1
- package/dist/node.js +2 -2
- package/dist/observability/index.js +1 -1
- package/dist/server/create.d.ts.map +1 -1
- package/dist/server/index.js +3 -3
- package/dist/tools/runtime-tool.d.ts +2 -2
- package/dist/tools/runtime-tool.d.ts.map +1 -1
- package/dist/tools.js +31 -13
- package/llms-full.txt +46 -6
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/browser/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAGjB,MAAM,aAAa,CAAC;AAIrB,OAAO,EAEL,KAAK,UAAU,IAAI,WAAW,EAG9B,KAAK,mBAAmB,EACzB,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/browser/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAGjB,MAAM,aAAa,CAAC;AAIrB,OAAO,EAEL,KAAK,UAAU,IAAI,WAAW,EAG9B,KAAK,mBAAmB,EACzB,MAAM,QAAQ,CAAC;AA4ChB,kFAAkF;AAClF,MAAM,W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BpC;AAED,wBAAgB,iBAAiB,CAC/B,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,CAAC,CAAC,EAC1E,KAAK,CAAC,CAAC,SAAS,MAAM,GAAG,KAAK,EAE9B,SAAS,EAAE,CAAC,EACZ,MAAM,EAAE,gBAAgB,EACxB,cAAc,CAAC,EAAE,oBAAoB,CAAC,CAAC,CAAC,GACvC;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;CAAE,CAOxE;AAED,mFAAmF;AACnF,wBAAgB,uBAAuB,CACrC,KAAK,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,EACnD,KAAK,CAAC,OAAO,SAAS,kBAAkB,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAEnE,SAAS,EAAE,CAAC,EACZ,MAAM,EAAE,gBAAgB,EACxB,YAAY,EAAE,OAAO,GACpB,wBAAwB,CAAC,CAAC,EAAE,OAAO,CAAC,CAOtC"}
|
package/dist/browser/http.d.ts
CHANGED
|
@@ -69,7 +69,7 @@ export interface RequestOptions {
|
|
|
69
69
|
* caller still gets `.blob()` / `.body`, plus the headers where
|
|
70
70
|
* `Content-Disposition` (the download filename) lives.
|
|
71
71
|
*/
|
|
72
|
-
responseType?: 'json' | 'blob' | 'response';
|
|
72
|
+
responseType?: 'json' | 'blob' | 'response' | 'void';
|
|
73
73
|
}
|
|
74
74
|
/** The HTTP transport adapter `createClient` builds typed methods on. */
|
|
75
75
|
export interface HttpClient {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/browser/http.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,M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BAAgB,GAAG,MAAM,IAAI,CAAC;IAClD,gFAAgF;IAChF,MAAM,IAAI,IAAI,CAAC;IACf,oEAAoE;IACpE,gBAAgB,IAAI,IAAI,CAAC;CAC1B;AAED,gFAAgF;AAChF,MAAM,WAAW,oBAAqB,SAAQ,UAAU;IACtD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,GAAG,oBAAoB,CAmL/E"}
|
package/dist/cli.js
CHANGED
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
emitResult,
|
|
5
5
|
parseCliArgs,
|
|
6
6
|
pollUntilDone
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-ncqqn1bc.js";
|
|
8
8
|
import"./index-frfyw9fa.js";
|
|
9
9
|
import"./index-x3fcszf8.js";
|
|
10
|
-
import"./index-
|
|
10
|
+
import"./index-sc67e454.js";
|
|
11
11
|
export {
|
|
12
12
|
pollUntilDone,
|
|
13
13
|
parseCliArgs,
|
|
@@ -27,8 +27,8 @@ import {
|
|
|
27
27
|
setRequestEndpoint,
|
|
28
28
|
setRequestError,
|
|
29
29
|
typedEntries,
|
|
30
|
-
|
|
31
|
-
} from "./index-
|
|
30
|
+
validateDeclaredOutput
|
|
31
|
+
} from "./index-sc67e454.js";
|
|
32
32
|
|
|
33
33
|
// src/server/multipart.ts
|
|
34
34
|
var DEFAULT_MAX_UPLOAD_BYTES = 25 * 1024 * 1024;
|
|
@@ -879,25 +879,20 @@ function createHandler(config) {
|
|
|
879
879
|
if (result instanceof Response) {
|
|
880
880
|
throw new AppError("INTERNAL_SERVER_ERROR", `${method.serviceName}.${method.key} produced a Response on the data path — only a \`rawResponse: true\` endpoint may return one (an afterHandle hook must return data)`, 500);
|
|
881
881
|
}
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
throw new AppError("INTERNAL_SERVER_ERROR", checked.message, 500);
|
|
888
|
-
}
|
|
889
|
-
result = checked.data;
|
|
882
|
+
const checked = validateDeclaredOutput(method.outputSchema, result, config.warnOnOutputStrip && method.outputSchema ? (paths) => {
|
|
883
|
+
warn(`[stitchkit] output strip ${method.serviceName}.${method.key}: ${paths.join(", ")}`);
|
|
884
|
+
} : undefined);
|
|
885
|
+
if (!checked.ok) {
|
|
886
|
+
throw new AppError("INTERNAL_SERVER_ERROR", checked.message, 500);
|
|
890
887
|
}
|
|
891
|
-
|
|
888
|
+
result = checked.data;
|
|
889
|
+
const responseStatus = method.responseMeta?.status ?? (method.outputSchema ? 200 : 204);
|
|
892
890
|
if (method.outputSchema && (responseStatus === 204 || responseStatus === 205)) {
|
|
893
891
|
throw new AppError("INTERNAL_SERVER_ERROR", `${method.serviceName}.${method.key} cannot combine output with bodyless status ${responseStatus}`, 500);
|
|
894
892
|
}
|
|
895
|
-
if (result !== undefined && result !== null && (responseStatus === 204 || responseStatus === 205)) {
|
|
896
|
-
throw new AppError("INTERNAL_SERVER_ERROR", `${method.serviceName}.${method.key} produced data for bodyless status ${responseStatus}`, 500);
|
|
897
|
-
}
|
|
898
893
|
const responseHeaders = new Headers(corsHeaders2(cors, req));
|
|
899
894
|
applyResponseMetadata(responseHeaders, responseMetadata, `${method.serviceName}.${method.key}`);
|
|
900
|
-
if (
|
|
895
|
+
if (!method.outputSchema) {
|
|
901
896
|
const empty = new Response(null, { status: responseStatus, headers: responseHeaders });
|
|
902
897
|
logDone(responseStatus);
|
|
903
898
|
return empty;
|
|
@@ -16,8 +16,8 @@ import {
|
|
|
16
16
|
normalizeError,
|
|
17
17
|
runWithRequestContext,
|
|
18
18
|
safeJsonParse,
|
|
19
|
-
|
|
20
|
-
} from "./index-
|
|
19
|
+
validateDeclaredOutput
|
|
20
|
+
} from "./index-sc67e454.js";
|
|
21
21
|
|
|
22
22
|
// src/tools/coerce.ts
|
|
23
23
|
import { z } from "zod";
|
|
@@ -640,17 +640,15 @@ async function runToolMethod(method, toolName, rawArgs, context, hooks, lifecycl
|
|
|
640
640
|
if (transformed !== undefined)
|
|
641
641
|
data = transformed;
|
|
642
642
|
}
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
});
|
|
651
|
-
}
|
|
652
|
-
data = checked.data;
|
|
643
|
+
const checked = validateDeclaredOutput(method.outputSchema, data, onOutputStrip);
|
|
644
|
+
if (!checked.ok) {
|
|
645
|
+
return finish({
|
|
646
|
+
ok: false,
|
|
647
|
+
code: "INTERNAL_SERVER_ERROR",
|
|
648
|
+
details: { message: checked.message }
|
|
649
|
+
});
|
|
653
650
|
}
|
|
651
|
+
data = checked.data;
|
|
654
652
|
const output = (data === undefined || data === null) && !method.outputSchema ? { status: "ok" } : data;
|
|
655
653
|
return finish({ ok: true, data: output });
|
|
656
654
|
} catch (err) {
|
|
@@ -228,6 +228,23 @@ function validateHandlerOutput(schema, data, onStripped) {
|
|
|
228
228
|
message: `Handler output does not match the contract: ${formatZodError(parsed.error)}`
|
|
229
229
|
};
|
|
230
230
|
}
|
|
231
|
+
function validateDeclaredOutput(schema, data, onStripped) {
|
|
232
|
+
if (!schema) {
|
|
233
|
+
if (data === undefined || data === null)
|
|
234
|
+
return { ok: true, data };
|
|
235
|
+
return {
|
|
236
|
+
ok: false,
|
|
237
|
+
message: "Handler returned data but the contract declares no output"
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
if (data === undefined) {
|
|
241
|
+
return {
|
|
242
|
+
ok: false,
|
|
243
|
+
message: "Handler returned undefined but the contract declares an output"
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
return validateHandlerOutput(schema, data, onStripped);
|
|
247
|
+
}
|
|
231
248
|
|
|
232
249
|
// src/internal/safe-json.ts
|
|
233
250
|
function isUnsafeKey(key) {
|
|
@@ -382,4 +399,4 @@ function wrapInRequestContext(handler, options = {}) {
|
|
|
382
399
|
};
|
|
383
400
|
}
|
|
384
401
|
|
|
385
|
-
export { __require, parseTrailingWildcard, mergeMeta, AppError, notFound, badRequest, unauthorized, forbidden, conflict, rateLimited, STITCH_ERROR_STATUS, isStitchErrorCode, appError, typedEntries, isRecord, bytesToBase64Url, base64UrlToBytes, formatZodError, zodIssues, errorCode, recordedErrorMessage, normalizeError,
|
|
402
|
+
export { __require, parseTrailingWildcard, mergeMeta, AppError, notFound, badRequest, unauthorized, forbidden, conflict, rateLimited, STITCH_ERROR_STATUS, isStitchErrorCode, appError, typedEntries, isRecord, bytesToBase64Url, base64UrlToBytes, formatZodError, zodIssues, errorCode, recordedErrorMessage, normalizeError, validateDeclaredOutput, isUnsafeKey, safeJsonParse, generateTraceId, resolveTraceId, resolveSocketIp, extractIp, getClientInfo, parseQueryParams, createTraceContext, parseTraceparent, formatTraceparent, resolveTraceContext, childSpan, runWithRequestContext, getRequestContext, getTraceId, getUserId, setRequestUser, setRequestEndpoint, setRequestDimensions, setRequestError, wrapInRequestContext };
|
package/dist/index.js
CHANGED
|
@@ -371,7 +371,13 @@ function createHttpClient(config) {
|
|
|
371
371
|
return await client[method](url, kyOptions);
|
|
372
372
|
}
|
|
373
373
|
const response = await client[method](url, kyOptions);
|
|
374
|
-
if (
|
|
374
|
+
if (options.responseType === "void") {
|
|
375
|
+
const text = await response.text();
|
|
376
|
+
if (text.length > 0) {
|
|
377
|
+
throw new Error("Server returned data for an endpoint with no output contract");
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
if (options.responseType === "void" || response.status === 204 || response.headers.get("content-length") === "0") {
|
|
375
381
|
return;
|
|
376
382
|
}
|
|
377
383
|
return response.json();
|
|
@@ -414,7 +420,7 @@ function createHttpClient(config) {
|
|
|
414
420
|
|
|
415
421
|
// src/browser/client.ts
|
|
416
422
|
function withTimeout(options, endpoint) {
|
|
417
|
-
const responseType = endpoint.rawResponse ? "response" : undefined;
|
|
423
|
+
const responseType = endpoint.rawResponse ? "response" : endpoint.output ? undefined : "void";
|
|
418
424
|
if (endpoint.timeout === undefined && responseType === undefined)
|
|
419
425
|
return options;
|
|
420
426
|
return {
|
|
@@ -424,10 +430,20 @@ function withTimeout(options, endpoint) {
|
|
|
424
430
|
};
|
|
425
431
|
}
|
|
426
432
|
function withOutput(endpoint, result) {
|
|
427
|
-
|
|
428
|
-
if (!schema)
|
|
433
|
+
if (endpoint.rawResponse)
|
|
429
434
|
return result;
|
|
430
|
-
|
|
435
|
+
const schema = endpoint.output;
|
|
436
|
+
return result.then((value) => {
|
|
437
|
+
if (!schema) {
|
|
438
|
+
if (value === undefined || value === null)
|
|
439
|
+
return;
|
|
440
|
+
throw new Error("Server returned data for an endpoint with no output contract");
|
|
441
|
+
}
|
|
442
|
+
if (value === undefined) {
|
|
443
|
+
throw new Error("Server returned no body for an endpoint with an output contract");
|
|
444
|
+
}
|
|
445
|
+
return schema.parse(value);
|
|
446
|
+
});
|
|
431
447
|
}
|
|
432
448
|
function contractEndpointMatchers(contract, endpointNames, contractConfig) {
|
|
433
449
|
const selected = endpointNames ? new Set(endpointNames) : null;
|
|
@@ -554,10 +570,14 @@ function createFetchMethod(endpoint, prefix, config, contractConfig) {
|
|
|
554
570
|
}
|
|
555
571
|
if (endpoint.rawResponse)
|
|
556
572
|
return res2;
|
|
557
|
-
if (
|
|
573
|
+
if (!endpoint.output) {
|
|
574
|
+
const text = await res2.text();
|
|
575
|
+
if (text.length > 0) {
|
|
576
|
+
throw new Error("Server returned data for an endpoint with no output contract");
|
|
577
|
+
}
|
|
558
578
|
return;
|
|
559
|
-
|
|
560
|
-
return endpoint.output
|
|
579
|
+
}
|
|
580
|
+
return endpoint.output.parse(await res2.json());
|
|
561
581
|
}
|
|
562
582
|
const res = await fetch(url, {
|
|
563
583
|
method: endpoint.method,
|
|
@@ -573,10 +593,14 @@ function createFetchMethod(endpoint, prefix, config, contractConfig) {
|
|
|
573
593
|
}
|
|
574
594
|
if (endpoint.rawResponse)
|
|
575
595
|
return res;
|
|
576
|
-
if (
|
|
596
|
+
if (!endpoint.output) {
|
|
597
|
+
const text = await res.text();
|
|
598
|
+
if (text.length > 0) {
|
|
599
|
+
throw new Error("Server returned data for an endpoint with no output contract");
|
|
600
|
+
}
|
|
577
601
|
return;
|
|
578
|
-
|
|
579
|
-
return endpoint.output
|
|
602
|
+
}
|
|
603
|
+
return endpoint.output.parse(await res.json());
|
|
580
604
|
};
|
|
581
605
|
}
|
|
582
606
|
async function throwForErrorResponse(res, config, fallbackBody) {
|
|
@@ -57,4 +57,17 @@ export declare function validateHandlerOutput(schema: ZodType, data: unknown, on
|
|
|
57
57
|
ok: false;
|
|
58
58
|
message: string;
|
|
59
59
|
};
|
|
60
|
+
/**
|
|
61
|
+
* Enforce the presence or absence of a contract output before a transport
|
|
62
|
+
* presents it. `null` is JSON data when a schema accepts it; `undefined` never
|
|
63
|
+
* is. Without a schema, nullish returns mean "no result" and any other value is
|
|
64
|
+
* an undeclared response.
|
|
65
|
+
*/
|
|
66
|
+
export declare function validateDeclaredOutput(schema: ZodType | undefined, data: unknown, onStripped?: (paths: string[]) => void): {
|
|
67
|
+
ok: true;
|
|
68
|
+
data: unknown;
|
|
69
|
+
} | {
|
|
70
|
+
ok: false;
|
|
71
|
+
message: string;
|
|
72
|
+
};
|
|
60
73
|
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/internal/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAQvC,wBAAgB,cAAc,CAAC,KAAK,EAAE,CAAC,CAAC,QAAQ,GAAG,MAAM,CAMxD;AAED,qFAAqF;AACrF,MAAM,WAAW,eAAe;IAC9B,2EAA2E;IAC3E,IAAI,EAAE,MAAM,CAAC;IACb,yDAAyD;IACzD,IAAI,EAAE,MAAM,CA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ED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,CAAC,CAAC,QAAQ,GAAG,eAAe,EAAE,CAM9D;AAKD;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAI1D;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,EACZ,eAAe,EAAE,MAAM,GAAG,SAAS,EACnC,MAAM,EAAE,OAAO,GACd,MAAM,GAAG,SAAS,CAMpB;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,GAAG,QAAQ,CAgBrD;AA4BD;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,OAAO,EACf,IAAI,EAAE,OAAO,EACb,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,GACrC;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAe9D;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,OAAO,GAAG,SAAS,EAC3B,IAAI,EAAE,OAAO,EACb,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,GACrC;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAe9D"}
|
package/dist/node.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
createImplement,
|
|
4
4
|
createSocketIOServer,
|
|
5
5
|
implement
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-4e1c0hsw.js";
|
|
7
7
|
import"./index-6jypn22c.js";
|
|
8
8
|
import"./index-x3fcszf8.js";
|
|
9
9
|
import {
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
notFound,
|
|
16
16
|
rateLimited,
|
|
17
17
|
unauthorized
|
|
18
|
-
} from "./index-
|
|
18
|
+
} from "./index-sc67e454.js";
|
|
19
19
|
// src/server/node.ts
|
|
20
20
|
import { serve } from "srvx";
|
|
21
21
|
async function serveNode(config) {
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
setRequestError,
|
|
17
17
|
setRequestUser,
|
|
18
18
|
wrapInRequestContext
|
|
19
|
-
} from "../index-
|
|
19
|
+
} from "../index-sc67e454.js";
|
|
20
20
|
|
|
21
21
|
// src/observability/sanitize.ts
|
|
22
22
|
var DEFAULT_SENSITIVE_KEYS = /(password|passwd|pwd|secret|token|apikey|api[-_ ]?key|auth|authorization|bearer|session|cookie|init[-_ ]?data|credential|private[-_ ]?key)/i;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/server/create.ts"],"names":[],"mappings":"AA8CA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAA2B,MAAM,SAAS,CAAC;AAEpF,wBAAgB,aAAa,CAAC,OAAO,GAAG,OAAO,EAC7C,MAAM,EAAE,aAAa,CAAC,OAAO,CAAC,GAC7B,YAAY,CAAC,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/server/create.ts"],"names":[],"mappings":"AA8CA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAA2B,MAAM,SAAS,CAAC;AAEpF,wBAAgB,aAAa,CAAC,OAAO,GAAG,OAAO,EAC7C,MAAM,EAAE,aAAa,CAAC,OAAO,CAAC,GAC7B,YAAY,CAAC,OAAO,CAAC,CAocvB"}
|
package/dist/server/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
socketIoLane,
|
|
10
10
|
staticRoute,
|
|
11
11
|
webSocketLane
|
|
12
|
-
} from "../index-
|
|
12
|
+
} from "../index-4e1c0hsw.js";
|
|
13
13
|
import {
|
|
14
14
|
createAuthHook,
|
|
15
15
|
createBearerResolver,
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
signJwt,
|
|
23
23
|
verifyJwt,
|
|
24
24
|
verifyPkce
|
|
25
|
-
} from "../index-
|
|
25
|
+
} from "../index-dnkefke9.js";
|
|
26
26
|
import {
|
|
27
27
|
DEFAULT_CORS_ALLOW_HEADERS,
|
|
28
28
|
DEFAULT_CORS_EXPOSE_HEADERS,
|
|
@@ -59,7 +59,7 @@ import {
|
|
|
59
59
|
resolveTraceId,
|
|
60
60
|
unauthorized,
|
|
61
61
|
zodIssues
|
|
62
|
-
} from "../index-
|
|
62
|
+
} from "../index-sc67e454.js";
|
|
63
63
|
// src/server/bun.ts
|
|
64
64
|
function createServer(config) {
|
|
65
65
|
const { routes, websocket, development, bun: bunExtra, port = 3000, hostname } = config;
|
|
@@ -17,7 +17,7 @@ export type RuntimeToolHandlerContext<TInput extends ZodObject> = RuntimeContext
|
|
|
17
17
|
params: undefined;
|
|
18
18
|
input: z.output<TInput>;
|
|
19
19
|
};
|
|
20
|
-
export type RuntimeToolOutput<TOutput extends ZodType | undefined> = TOutput extends ZodType ? z.output<TOutput> :
|
|
20
|
+
export type RuntimeToolOutput<TOutput extends ZodType | undefined> = TOutput extends ZodType ? z.output<TOutput> : undefined;
|
|
21
21
|
/** MCP-owned fields; validation and error state are always supplied by Stitchkit. */
|
|
22
22
|
export type RuntimeMcpPresentation = Omit<CallToolResult, 'structuredContent' | 'isError'> & {
|
|
23
23
|
structuredContent?: never;
|
|
@@ -45,7 +45,7 @@ export interface RuntimeToolDefinitionWithOutput<TInput extends ZodObject, TOutp
|
|
|
45
45
|
}
|
|
46
46
|
export interface RuntimeToolDefinitionWithoutOutput<TInput extends ZodObject> extends RuntimeToolDefinitionBase<TInput> {
|
|
47
47
|
output?: never;
|
|
48
|
-
handler: (context: RuntimeToolHandlerContext<TInput>) =>
|
|
48
|
+
handler: (context: RuntimeToolHandlerContext<TInput>) => void | Promise<void>;
|
|
49
49
|
present?: never;
|
|
50
50
|
}
|
|
51
51
|
export type RuntimeToolDefinition = RuntimeToolDefinitionWithOutput<ZodObject, ZodType> | RuntimeToolDefinitionWithoutOutput<ZodObject>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-tool.d.ts","sourceRoot":"","sources":["../../src/tools/runtime-tool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC/B,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACjD,OAAO,KAAK,EACV,uBAAuB,EACvB,cAAc,EACd,UAAU,EACV,cAAc,EACf,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAI7C,MAAM,MAAM,oBAAoB,GAAG,KAAK,GAAG,OAAO,CAAC;AAEnD,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0EAA0E;IAC1E,MAAM,EAAE,UAAU,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC;AAED,MAAM,MAAM,yBAAyB,CAAC,MAAM,SAAS,SAAS,IAAI,cAAc,GAAG;IACjF,MAAM,EAAE,SAAS,CAAC;IAClB,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,iBAAiB,CAAC,OAA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./index-6jypn22c.js";
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
toolErrorFromResult,
|
|
26
26
|
toolResultFromError,
|
|
27
27
|
writeDownload
|
|
28
|
-
} from "./index-
|
|
28
|
+
} from "./index-ncqqn1bc.js";
|
|
29
29
|
import {
|
|
30
30
|
toJsonSchema
|
|
31
31
|
} from "./index-frfyw9fa.js";
|
|
@@ -39,7 +39,7 @@ import {
|
|
|
39
39
|
mergeMeta,
|
|
40
40
|
parseTrailingWildcard,
|
|
41
41
|
typedEntries
|
|
42
|
-
} from "./index-
|
|
42
|
+
} from "./index-sc67e454.js";
|
|
43
43
|
|
|
44
44
|
// src/tools/agent.ts
|
|
45
45
|
import { jsonSchema, tool } from "ai";
|
|
@@ -1490,7 +1490,7 @@ function parseApiErrorBody(body) {
|
|
|
1490
1490
|
|
|
1491
1491
|
// src/browser/client.ts
|
|
1492
1492
|
function withTimeout(options, endpoint) {
|
|
1493
|
-
const responseType = endpoint.rawResponse ? "response" : undefined;
|
|
1493
|
+
const responseType = endpoint.rawResponse ? "response" : endpoint.output ? undefined : "void";
|
|
1494
1494
|
if (endpoint.timeout === undefined && responseType === undefined)
|
|
1495
1495
|
return options;
|
|
1496
1496
|
return {
|
|
@@ -1500,10 +1500,20 @@ function withTimeout(options, endpoint) {
|
|
|
1500
1500
|
};
|
|
1501
1501
|
}
|
|
1502
1502
|
function withOutput(endpoint, result) {
|
|
1503
|
-
|
|
1504
|
-
if (!schema)
|
|
1503
|
+
if (endpoint.rawResponse)
|
|
1505
1504
|
return result;
|
|
1506
|
-
|
|
1505
|
+
const schema = endpoint.output;
|
|
1506
|
+
return result.then((value) => {
|
|
1507
|
+
if (!schema) {
|
|
1508
|
+
if (value === undefined || value === null)
|
|
1509
|
+
return;
|
|
1510
|
+
throw new Error("Server returned data for an endpoint with no output contract");
|
|
1511
|
+
}
|
|
1512
|
+
if (value === undefined) {
|
|
1513
|
+
throw new Error("Server returned no body for an endpoint with an output contract");
|
|
1514
|
+
}
|
|
1515
|
+
return schema.parse(value);
|
|
1516
|
+
});
|
|
1507
1517
|
}
|
|
1508
1518
|
function createClient(contract, configOrClient, contractConfig) {
|
|
1509
1519
|
const client = {};
|
|
@@ -1580,10 +1590,14 @@ function createFetchMethod(endpoint, prefix, config, contractConfig) {
|
|
|
1580
1590
|
}
|
|
1581
1591
|
if (endpoint.rawResponse)
|
|
1582
1592
|
return res2;
|
|
1583
|
-
if (
|
|
1593
|
+
if (!endpoint.output) {
|
|
1594
|
+
const text = await res2.text();
|
|
1595
|
+
if (text.length > 0) {
|
|
1596
|
+
throw new Error("Server returned data for an endpoint with no output contract");
|
|
1597
|
+
}
|
|
1584
1598
|
return;
|
|
1585
|
-
|
|
1586
|
-
return endpoint.output
|
|
1599
|
+
}
|
|
1600
|
+
return endpoint.output.parse(await res2.json());
|
|
1587
1601
|
}
|
|
1588
1602
|
const res = await fetch(url, {
|
|
1589
1603
|
method: endpoint.method,
|
|
@@ -1599,10 +1613,14 @@ function createFetchMethod(endpoint, prefix, config, contractConfig) {
|
|
|
1599
1613
|
}
|
|
1600
1614
|
if (endpoint.rawResponse)
|
|
1601
1615
|
return res;
|
|
1602
|
-
if (
|
|
1616
|
+
if (!endpoint.output) {
|
|
1617
|
+
const text = await res.text();
|
|
1618
|
+
if (text.length > 0) {
|
|
1619
|
+
throw new Error("Server returned data for an endpoint with no output contract");
|
|
1620
|
+
}
|
|
1603
1621
|
return;
|
|
1604
|
-
|
|
1605
|
-
return endpoint.output
|
|
1622
|
+
}
|
|
1623
|
+
return endpoint.output.parse(await res.json());
|
|
1606
1624
|
};
|
|
1607
1625
|
}
|
|
1608
1626
|
async function throwForErrorResponse(res, config, fallbackBody) {
|
package/llms-full.txt
CHANGED
|
@@ -234,7 +234,7 @@ export const users = defineContract({ prefix: 'users' }, {
|
|
|
234
234
|
| `desc` | yes | human description — also the MCP / agent tool description |
|
|
235
235
|
| `params` | no | Zod schema for **path params** (`:id`, …) |
|
|
236
236
|
| `input` | no | Zod schema for the **request body** (or query, for GET/DELETE) |
|
|
237
|
-
| `output` | no | Zod schema for the **response body
|
|
237
|
+
| `output` | no | Zod schema for the **response body**; its presence declares a JSON result (`null` is data, `undefined` is not) |
|
|
238
238
|
| `scope` | no | access scope for this endpoint — see [Auth & errors](./auth-and-errors.md) |
|
|
239
239
|
| `expose` | no | which transports carry this endpoint — see [below](#transports) |
|
|
240
240
|
| `toolName` | no | explicit MCP / agent tool name (default: a verb-aware derivation, see below — not a literal `prefix_key`) |
|
|
@@ -256,6 +256,13 @@ headers, while Stitchkit guarantees an empty wire body even if the returned
|
|
|
256
256
|
|
|
257
257
|
## `params` vs `input` vs `output`
|
|
258
258
|
|
|
259
|
+
`output` owns response presence across HTTP and tool transports. With a schema,
|
|
260
|
+
the handler must return a value that validates and can be represented as JSON;
|
|
261
|
+
a nullable schema may return `null`, but `undefined` is always a contract
|
|
262
|
+
violation. Without `output`, the handler is empty (`undefined`/`null`) and may
|
|
263
|
+
not return undeclared data. On HTTP this means a default `200` JSON response
|
|
264
|
+
with output and a default bodyless `204` without it.
|
|
265
|
+
|
|
259
266
|
The three schemas are distinct on purpose:
|
|
260
267
|
|
|
261
268
|
- **`params`** — values in the URL path. `path: '/:id'` ⇒
|
|
@@ -910,9 +917,13 @@ HTTP-only, but its typed client method still resolves to `AuthUser` — not
|
|
|
910
917
|
declared `output` schema exactly once.
|
|
911
918
|
|
|
912
919
|
`responseMeta.status` is static contract metadata and OpenAPI publishes the same
|
|
913
|
-
2xx code. Without it,
|
|
914
|
-
`
|
|
915
|
-
|
|
920
|
+
2xx code. Without it, an endpoint with `output` uses `200`; an endpoint without
|
|
921
|
+
`output` uses `204`. A nullable output returns JSON `null` with status `200` —
|
|
922
|
+
the runtime value never turns a declared response body into no content.
|
|
923
|
+
`undefined` violates a declared output, while returning non-null data without an
|
|
924
|
+
output schema is also a server fault. Bodyless `204`/`205` cannot be combined
|
|
925
|
+
with `output`. Redirects, streams, files and handler-owned status/body logic
|
|
926
|
+
remain [`rawResponse: true`](#raw-response-endpoints).
|
|
916
927
|
|
|
917
928
|
Collected headers are merged only after the complete success pipeline. A
|
|
918
929
|
handler, hook or output-validation failure discards them. `Content-Type`,
|
|
@@ -1352,6 +1363,13 @@ await api.update({ id: '1', name: 'M' }) // PUT /users/1 body: { name }
|
|
|
1352
1363
|
await api.delete({ id: '1' }) // DELETE /users/1
|
|
1353
1364
|
```
|
|
1354
1365
|
|
|
1366
|
+
The client follows response presence from the contract, not from the HTTP
|
|
1367
|
+
status or a truthy runtime value. An endpoint with nullable `output` resolves
|
|
1368
|
+
JSON `null` as `null`; an endpoint without `output` resolves `undefined`,
|
|
1369
|
+
including an explicitly declared empty `200` or `205`. A missing body for a
|
|
1370
|
+
declared output, or a body for an endpoint with no output, fails loudly instead
|
|
1371
|
+
of changing the typed result.
|
|
1372
|
+
|
|
1355
1373
|
An explicit contract `HEAD` operation is exposed like any other typed method.
|
|
1356
1374
|
Because HEAD endpoints are `rawResponse`, it resolves to the untouched
|
|
1357
1375
|
`Response`, giving the caller direct access to status and headers without JSON
|
|
@@ -4101,6 +4119,28 @@ current one *up to* your target, and apply each snippet.
|
|
|
4101
4119
|
|
|
4102
4120
|
## Unreleased breaking migrations
|
|
4103
4121
|
|
|
4122
|
+
Contract success bodies are now determined by the presence of `output`, not by
|
|
4123
|
+
the handler's runtime value. A nullable output returns JSON `null` with status
|
|
4124
|
+
`200`; `undefined` with a declared output and non-null data without an output
|
|
4125
|
+
schema are contract violations:
|
|
4126
|
+
|
|
4127
|
+
```ts
|
|
4128
|
+
// nullable JSON data: 200 with body `null`
|
|
4129
|
+
session: {
|
|
4130
|
+
method: 'GET', path: '/session', desc: 'Current session',
|
|
4131
|
+
output: SessionSchema.nullable(),
|
|
4132
|
+
}
|
|
4133
|
+
|
|
4134
|
+
// bodyless operation: 204 with no body
|
|
4135
|
+
logout: {
|
|
4136
|
+
method: 'POST', path: '/logout', desc: 'End the session',
|
|
4137
|
+
}
|
|
4138
|
+
```
|
|
4139
|
+
|
|
4140
|
+
Add an output schema to every handler that returns data. Omit `output` and
|
|
4141
|
+
return nothing for bodyless operations; runtime tools follow the same rule and
|
|
4142
|
+
type no-output handlers as `void`.
|
|
4143
|
+
|
|
4104
4144
|
`createToolInvoker` now separates immutable registry preparation from per-call
|
|
4105
4145
|
runtime state. Move source/context/lifecycle/hooks/output-strip reporting from
|
|
4106
4146
|
the factory config to the third invocation argument. Use `invokeOrThrow` when a
|
|
@@ -4493,7 +4533,7 @@ from the root `stitchkit`.
|
|
|
4493
4533
|
| `ALL_TRANSPORTS` | constant | `['HTTP', 'MCP', 'AGENT', 'CLI']` |
|
|
4494
4534
|
| `ContractDef` | _type_ | a defined contract |
|
|
4495
4535
|
| `ContractMeta` | _type_ | a contract's `prefix` + optional `scope` and `meta` (a default every endpoint shallow-merges over) |
|
|
4496
|
-
| `EndpointDef` | _type_ | a single endpoint definition |
|
|
4536
|
+
| `EndpointDef` | _type_ | a single endpoint definition; `output` declares JSON response presence (`null` is data, `undefined` is invalid) |
|
|
4497
4537
|
| `HeadEndpointDef` | _type_ | explicit HTTP-only, bodyless `HEAD` endpoint definition |
|
|
4498
4538
|
| `EndpointResponseMeta` | _type_ | static success metadata declared by an HTTP-only typed-data endpoint |
|
|
4499
4539
|
| `ResponseMetadata` | _type_ | per-request outbound collector exposed as `ctx.response` only for a `responseMeta` endpoint |
|
|
@@ -4774,7 +4814,7 @@ Server-only. Turns contracts into MCP and AI-agent tools. Needs the
|
|
|
4774
4814
|
| `RuntimeToolDefinition` | _type_ | transport-neutral pathless operation with identity, schemas, handler and optional presenters |
|
|
4775
4815
|
| `RuntimeToolDefinitionBase` | _type_ | common name, identity, input, exposure and MCP metadata fields |
|
|
4776
4816
|
| `RuntimeToolDefinitionWithOutput` | _type_ | runtime definition whose handler and presenters share a validated output type |
|
|
4777
|
-
| `RuntimeToolDefinitionWithoutOutput` | _type_ | runtime definition
|
|
4817
|
+
| `RuntimeToolDefinitionWithoutOutput` | _type_ | runtime definition with a void handler and no presentation callbacks |
|
|
4778
4818
|
| `RuntimeToolIdentity` | _type_ | `{ serviceName, action, scope?, method, meta? }` for runtime lifecycle/audit |
|
|
4779
4819
|
| `RuntimeToolHandlerContext` | _type_ | runtime context with the definition's parsed input |
|
|
4780
4820
|
| `RuntimeToolOutput` | _type_ | output inferred from a runtime tool's optional Zod schema |
|
package/package.json
CHANGED