stitchkit 0.60.0 → 0.61.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/agent-runtime/coordinator.d.ts +10 -0
- package/dist/agent-runtime/coordinator.d.ts.map +1 -1
- package/dist/agent-runtime/run-execution.d.ts.map +1 -1
- package/dist/agent-runtime/runtime.d.ts.map +1 -1
- package/dist/agent-runtime/schemas.d.ts.map +1 -1
- package/dist/agent-runtime/store-driver.d.ts.map +1 -1
- package/dist/agent-runtime.js +97 -12
- package/dist/application/grammy.d.ts +12 -6
- package/dist/application/grammy.d.ts.map +1 -1
- package/dist/application/kernel.d.ts +35 -2
- package/dist/application/kernel.d.ts.map +1 -1
- package/dist/application/server-resource.d.ts.map +1 -1
- package/dist/application-grammy.js +5 -3
- package/dist/application.d.ts +1 -1
- package/dist/application.d.ts.map +1 -1
- package/dist/application.js +12 -6
- package/dist/browser/socket-io.d.ts +47 -0
- package/dist/browser/socket-io.d.ts.map +1 -1
- package/dist/browser/stream.d.ts +23 -0
- package/dist/browser/stream.d.ts.map +1 -1
- package/dist/cli.js +5 -4
- package/dist/contract/errors.d.ts +1 -0
- package/dist/contract/errors.d.ts.map +1 -1
- package/dist/contract/index.js +1 -1
- package/dist/{index-8pc5s3pz.js → index-1pgeyyee.js} +3 -3
- package/dist/{index-9h1vba8n.js → index-413xk7ga.js} +2 -1
- package/dist/{index-8es1hrv4.js → index-6taryy00.js} +1 -1
- package/dist/{index-1zencgcb.js → index-eabpd4tb.js} +61 -10
- package/dist/{index-3w74r08v.js → index-mfw1pec7.js} +7 -5
- package/dist/{index-f7521k0x.js → index-s1tywej8.js} +95 -24
- package/dist/{index-6fbp58g8.js → index-tvwcrx2d.js} +4 -2
- package/dist/{index-v6e8hnkx.js → index-wd8g8z6e.js} +1 -84
- package/dist/{index-2akar0rq.js → index-wrhf06ak.js} +7 -5
- package/dist/index-xxye8j3k.js +85 -0
- package/dist/{index-3hn10n4c.js → index-y91zd0ch.js} +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +213 -17
- package/dist/internal/optional-peer.d.ts +14 -0
- package/dist/internal/optional-peer.d.ts.map +1 -0
- package/dist/node.js +8 -7
- package/dist/observability/index.js +4 -3
- package/dist/realtime/contract.d.ts +7 -1
- package/dist/realtime/contract.d.ts.map +1 -1
- package/dist/realtime/index.d.ts +2 -1
- package/dist/realtime/index.d.ts.map +1 -1
- package/dist/realtime/rejected-frame.d.ts +86 -0
- package/dist/realtime/rejected-frame.d.ts.map +1 -0
- package/dist/realtime/request.d.ts +24 -0
- package/dist/realtime/request.d.ts.map +1 -1
- package/dist/realtime/socket.d.ts.map +1 -1
- package/dist/remote.js +4 -2
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +209 -15
- package/dist/server/socket-io.d.ts.map +1 -1
- package/dist/server/stream.d.ts.map +1 -1
- package/dist/server/streaming-route.d.ts +130 -0
- package/dist/server/streaming-route.d.ts.map +1 -0
- package/dist/testing.js +2 -1
- package/dist/tools.js +11 -9
- package/llms-full.txt +422 -79
- package/package.json +5 -5
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// src/contract/errors.ts
|
|
2
|
+
var APP_ERROR_BRAND = Symbol.for("stitchkit.AppError");
|
|
3
|
+
|
|
4
|
+
class AppError extends Error {
|
|
5
|
+
code;
|
|
6
|
+
status;
|
|
7
|
+
details;
|
|
8
|
+
hint;
|
|
9
|
+
traceId;
|
|
10
|
+
constructor(code, message, status = 500, details, hint, traceId) {
|
|
11
|
+
super(message ?? code);
|
|
12
|
+
this.code = code;
|
|
13
|
+
this.status = status;
|
|
14
|
+
this.details = details;
|
|
15
|
+
this.hint = hint;
|
|
16
|
+
this.traceId = traceId;
|
|
17
|
+
this.name = "AppError";
|
|
18
|
+
Object.defineProperty(this, APP_ERROR_BRAND, { value: true });
|
|
19
|
+
}
|
|
20
|
+
static is(err) {
|
|
21
|
+
return typeof err === "object" && err !== null && APP_ERROR_BRAND in err;
|
|
22
|
+
}
|
|
23
|
+
toJSON() {
|
|
24
|
+
return {
|
|
25
|
+
error: {
|
|
26
|
+
code: this.code,
|
|
27
|
+
message: this.message,
|
|
28
|
+
...this.details && { details: this.details },
|
|
29
|
+
...this.hint && { hint: this.hint }
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function notFound(message = "Not found") {
|
|
35
|
+
throw new AppError("NOT_FOUND", message, 404);
|
|
36
|
+
}
|
|
37
|
+
function badRequest(message, details) {
|
|
38
|
+
throw new AppError("BAD_REQUEST", message, 400, details);
|
|
39
|
+
}
|
|
40
|
+
function unauthorized(message = "Unauthorized") {
|
|
41
|
+
throw new AppError("UNAUTHORIZED", message, 401);
|
|
42
|
+
}
|
|
43
|
+
function forbidden(message = "Forbidden") {
|
|
44
|
+
throw new AppError("FORBIDDEN", message, 403);
|
|
45
|
+
}
|
|
46
|
+
function conflict(message = "Conflict", details) {
|
|
47
|
+
throw new AppError("CONFLICT", message, 409, details);
|
|
48
|
+
}
|
|
49
|
+
function rateLimited(message = "Too many requests") {
|
|
50
|
+
throw new AppError("RATE_LIMITED", message, 429);
|
|
51
|
+
}
|
|
52
|
+
var STITCH_ERROR_STATUS = {
|
|
53
|
+
BAD_REQUEST: 400,
|
|
54
|
+
UNAUTHORIZED: 401,
|
|
55
|
+
FORBIDDEN: 403,
|
|
56
|
+
NOT_FOUND: 404,
|
|
57
|
+
METHOD_NOT_ALLOWED: 405,
|
|
58
|
+
CONFLICT: 409,
|
|
59
|
+
RATE_LIMITED: 429,
|
|
60
|
+
VALIDATION_ERROR: 400,
|
|
61
|
+
FILE_INVALID_PATH: 400,
|
|
62
|
+
FILE_OUTSIDE_ROOT: 400,
|
|
63
|
+
FILE_NOT_FOUND: 404,
|
|
64
|
+
FILE_NOT_REGULAR: 422,
|
|
65
|
+
FILE_INSPECTION_REJECTED: 422,
|
|
66
|
+
FILE_TOO_LARGE: 413,
|
|
67
|
+
FILE_EXISTS: 409,
|
|
68
|
+
REALTIME_CONTRACT_VIOLATION: 500,
|
|
69
|
+
APPLICATION_NOT_ACCEPTING: 503,
|
|
70
|
+
GRAMMY_WEBHOOK_NOT_ACCEPTING: 503,
|
|
71
|
+
WAIT_TIMEOUT: 408,
|
|
72
|
+
WAIT_FAILED: 409,
|
|
73
|
+
DOWNLOAD_NOT_FOUND: 404,
|
|
74
|
+
VIEW_HTTP_ERROR: 502,
|
|
75
|
+
OPERATION_NOT_SUCCEEDED: 409,
|
|
76
|
+
INTERNAL_SERVER_ERROR: 500
|
|
77
|
+
};
|
|
78
|
+
function isStitchErrorCode(code) {
|
|
79
|
+
return Object.hasOwn(STITCH_ERROR_STATUS, code);
|
|
80
|
+
}
|
|
81
|
+
function appError(code, message, details) {
|
|
82
|
+
throw new AppError(code, message, isStitchErrorCode(code) ? STITCH_ERROR_STATUS[code] : 500, details);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export { AppError, notFound, badRequest, unauthorized, forbidden, conflict, rateLimited, STITCH_ERROR_STATUS, isStitchErrorCode, appError };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { type ClientConfig, type ClientContract, type ClientFetch, type ClientRegistryValue, type ContractClientConfig, contractEndpointMatchers, createClient, createClients, createScopedClients, createScopedUrlBuilders, createUrlBuilder, createUrlBuilders, type PathPrefixArgs, type RegistryScope, type ScopeClientConfigs, type ScopedClientRegistry, type ScopedUrlBuilderRegistry, type UrlBuilderConfig, } from './browser/client';
|
|
2
2
|
export { ApiError, type ApiEvent, type ApiEventListener, type ConfiguredHttpClient, createHttpClient, type HeaderProvider, type HttpClient, type HttpClientConfig, type RequestOptions, type UnauthorizedMatcher, } from './browser/http';
|
|
3
|
-
export type { BindRealtimeClientOptions, BoundRealtimeClient, RealtimeClient, RealtimeClientOptions, RealtimeClientTransport, SocketEventMap, SocketIOClient, SocketIOClientConfig, } from './browser/socket-io';
|
|
3
|
+
export type { BindRealtimeClientOptions, BoundRealtimeClient, RealtimeClient, RealtimeClientOptions, RealtimeClientTransport, SocketEventMap, SocketIOClient, SocketIOClientConfig, SocketIOClientPeerLoaders, } from './browser/socket-io';
|
|
4
4
|
export { bindRealtimeClient, createRealtimeClient, createSocketIOClient, } from './browser/socket-io';
|
|
5
|
-
export { type ParseSSEOptions, parseSSE } from './browser/stream';
|
|
5
|
+
export { type ParseNDJSONOptions, type ParseSSEOptions, parseNDJSON, parseSSE, } from './browser/stream';
|
|
6
6
|
export * from './contract';
|
|
7
7
|
export type { StitchLogger } from './logger';
|
|
8
8
|
export { childSpan, createTraceContext, formatTraceparent, parseTraceparent, type TraceContext, } from './observability/trace';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,wBAAwB,EACxB,YAAY,EACZ,aAAa,EACb,mBAAmB,EACnB,uBAAuB,EACvB,gBAAgB,EAChB,iBAAiB,EACjB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,gBAAgB,GACtB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,QAAQ,EACR,KAAK,QAAQ,EACb,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,gBAAgB,EAChB,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,mBAAmB,GACzB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,yBAAyB,EACzB,mBAAmB,EACnB,cAAc,EACd,qBAAqB,EACrB,uBAAuB,EACvB,cAAc,EACd,cAAc,EACd,oBAAoB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,wBAAwB,EACxB,YAAY,EACZ,aAAa,EACb,mBAAmB,EACnB,uBAAuB,EACvB,gBAAgB,EAChB,iBAAiB,EACjB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,gBAAgB,GACtB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,QAAQ,EACR,KAAK,QAAQ,EACb,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,gBAAgB,EAChB,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,mBAAmB,GACzB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,yBAAyB,EACzB,mBAAmB,EACnB,cAAc,EACd,qBAAqB,EACrB,uBAAuB,EACvB,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,yBAAyB,GAC1B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,WAAW,EACX,QAAQ,GACT,MAAM,kBAAkB,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,YAAY,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAG7C,OAAO,EACL,SAAS,EACT,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,KAAK,YAAY,GAClB,MAAM,uBAAuB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,oBAAoB,EAAE,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
parseTrailingWildcard,
|
|
20
20
|
rateLimited,
|
|
21
21
|
unauthorized
|
|
22
|
-
} from "./index-
|
|
22
|
+
} from "./index-413xk7ga.js";
|
|
23
23
|
import {
|
|
24
24
|
isRecord,
|
|
25
25
|
mapObject,
|
|
@@ -808,6 +808,15 @@ function createUrlBuilders(contracts, source, contractConfig) {
|
|
|
808
808
|
function createScopedUrlBuilders(contracts, source, scopeConfigs) {
|
|
809
809
|
return buildScopedRegistry(contracts, scopeConfigs, "URL builder", (contract, config) => createUrlBuilder(contract, source, config));
|
|
810
810
|
}
|
|
811
|
+
// src/internal/optional-peer.ts
|
|
812
|
+
function isModuleNotFound(error) {
|
|
813
|
+
if (typeof error !== "object" || error === null)
|
|
814
|
+
return false;
|
|
815
|
+
const code = "code" in error ? error.code : undefined;
|
|
816
|
+
const message = "message" in error && typeof error.message === "string" ? error.message : "";
|
|
817
|
+
return code === "ERR_MODULE_NOT_FOUND" || code === "MODULE_NOT_FOUND" || message.includes("Cannot find module") || message.includes("Cannot find package");
|
|
818
|
+
}
|
|
819
|
+
|
|
811
820
|
// src/realtime/request.ts
|
|
812
821
|
class RealtimeRequestTimeoutError extends Error {
|
|
813
822
|
code = "REALTIME_REQUEST_TIMEOUT";
|
|
@@ -841,8 +850,19 @@ class RealtimeRequestInvalidAcknowledgementError extends Error {
|
|
|
841
850
|
}
|
|
842
851
|
}
|
|
843
852
|
|
|
844
|
-
|
|
845
|
-
|
|
853
|
+
class RealtimeRequestRejectedError extends Error {
|
|
854
|
+
code = "REALTIME_REQUEST_REJECTED";
|
|
855
|
+
event;
|
|
856
|
+
reason;
|
|
857
|
+
issues;
|
|
858
|
+
constructor(event, reason, detail, issues) {
|
|
859
|
+
super(`Realtime request "${event}" was rejected by the peer (${reason}): ${detail}`);
|
|
860
|
+
this.name = "RealtimeRequestRejectedError";
|
|
861
|
+
this.event = event;
|
|
862
|
+
this.reason = reason;
|
|
863
|
+
this.issues = issues;
|
|
864
|
+
}
|
|
865
|
+
}
|
|
846
866
|
|
|
847
867
|
// src/internal/errors.ts
|
|
848
868
|
import { z } from "zod";
|
|
@@ -857,7 +877,48 @@ function zodIssues(error) {
|
|
|
857
877
|
}));
|
|
858
878
|
}
|
|
859
879
|
|
|
880
|
+
// src/realtime/rejected-frame.ts
|
|
881
|
+
var REALTIME_REJECTION_KEY = "@stitchkit/realtime-rejected";
|
|
882
|
+
var MAX_REJECTION_ISSUES = 20;
|
|
883
|
+
function realtimeRejectionEnvelope(report) {
|
|
884
|
+
return { [REALTIME_REJECTION_KEY]: report };
|
|
885
|
+
}
|
|
886
|
+
function asRealtimeRejection(value) {
|
|
887
|
+
if (typeof value !== "object" || value === null)
|
|
888
|
+
return null;
|
|
889
|
+
const report = Reflect.get(value, REALTIME_REJECTION_KEY);
|
|
890
|
+
if (typeof report !== "object" || report === null)
|
|
891
|
+
return null;
|
|
892
|
+
const event = Reflect.get(report, "event");
|
|
893
|
+
const reason = Reflect.get(report, "reason");
|
|
894
|
+
const message = Reflect.get(report, "message");
|
|
895
|
+
if (typeof event !== "string" || typeof reason !== "string" || typeof message !== "string") {
|
|
896
|
+
return null;
|
|
897
|
+
}
|
|
898
|
+
if (reason.length === 0)
|
|
899
|
+
return null;
|
|
900
|
+
const issues = parseIssues(Reflect.get(report, "issues"));
|
|
901
|
+
return { event, reason, message, ...issues !== undefined && { issues } };
|
|
902
|
+
}
|
|
903
|
+
function parseIssues(value) {
|
|
904
|
+
if (!Array.isArray(value))
|
|
905
|
+
return;
|
|
906
|
+
const issues = [];
|
|
907
|
+
for (const entry of value.slice(0, MAX_REJECTION_ISSUES)) {
|
|
908
|
+
if (typeof entry !== "object" || entry === null)
|
|
909
|
+
continue;
|
|
910
|
+
const path = Reflect.get(entry, "path");
|
|
911
|
+
const code = Reflect.get(entry, "code");
|
|
912
|
+
const message = Reflect.get(entry, "message");
|
|
913
|
+
if (typeof path === "string" && typeof code === "string" && typeof message === "string") {
|
|
914
|
+
issues.push({ path, code, message });
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
return issues.length > 0 ? issues : undefined;
|
|
918
|
+
}
|
|
919
|
+
|
|
860
920
|
// src/realtime/rejection.ts
|
|
921
|
+
import { z as z2 } from "zod";
|
|
861
922
|
function realtimeContractViolation(options) {
|
|
862
923
|
const issues = options.cause instanceof z2.ZodError ? zodIssues(options.cause) : undefined;
|
|
863
924
|
const reason = options.reason.replaceAll("-", " ");
|
|
@@ -883,15 +944,11 @@ function method(target, name) {
|
|
|
883
944
|
return (...args) => Reflect.apply(value, target, args);
|
|
884
945
|
}
|
|
885
946
|
function splitWireArguments(definition, args) {
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
return {
|
|
892
|
-
values: args.slice(0, -1),
|
|
893
|
-
acknowledgement: (...callbackArgs) => Reflect.apply(acknowledgement, undefined, callbackArgs)
|
|
894
|
-
};
|
|
947
|
+
const trailing = args.at(-1);
|
|
948
|
+
const replyTo = typeof trailing === "function" ? (...callbackArgs) => Reflect.apply(trailing, undefined, callbackArgs) : undefined;
|
|
949
|
+
if (!definition.ack || !replyTo)
|
|
950
|
+
return { values: args, ...replyTo && { replyTo } };
|
|
951
|
+
return { values: args.slice(0, -1), acknowledgement: replyTo, replyTo };
|
|
895
952
|
}
|
|
896
953
|
function eventDefinition(registry, event, direction) {
|
|
897
954
|
const definition = registry[event];
|
|
@@ -919,6 +976,19 @@ function reportRejected(rejected, hook, logger) {
|
|
|
919
976
|
console.error("[stitchkit] realtime rejection hook failed", error);
|
|
920
977
|
});
|
|
921
978
|
}
|
|
979
|
+
function answerWithRejection(acknowledgement, report, logger) {
|
|
980
|
+
if (!acknowledgement)
|
|
981
|
+
return;
|
|
982
|
+
try {
|
|
983
|
+
acknowledgement(realtimeRejectionEnvelope(report));
|
|
984
|
+
} catch (error) {
|
|
985
|
+
const message = "[stitchkit] could not answer a rejected realtime frame";
|
|
986
|
+
if (logger)
|
|
987
|
+
logger.warn(message, { error });
|
|
988
|
+
else
|
|
989
|
+
console.warn(message, error);
|
|
990
|
+
}
|
|
991
|
+
}
|
|
922
992
|
function parseRealtimeRequestArguments(registry, event, direction, args) {
|
|
923
993
|
const definition = eventDefinition(registry, event, direction);
|
|
924
994
|
const parsed = definition.args.safeParse(args);
|
|
@@ -944,6 +1014,17 @@ function parseRealtimeRequestArguments(registry, event, direction, args) {
|
|
|
944
1014
|
return parsed.data;
|
|
945
1015
|
}
|
|
946
1016
|
function parseRealtimeRequestAcknowledgement(schema, event, direction, value, hook, logger) {
|
|
1017
|
+
const refusal = asRealtimeRejection(value);
|
|
1018
|
+
if (refusal) {
|
|
1019
|
+
reportRejected(realtimeContractViolation({
|
|
1020
|
+
event,
|
|
1021
|
+
direction,
|
|
1022
|
+
phase: "arguments",
|
|
1023
|
+
reason: "rejected-by-peer",
|
|
1024
|
+
fault: "local"
|
|
1025
|
+
}), hook, logger);
|
|
1026
|
+
throw new RealtimeRequestRejectedError(event, refusal.reason, refusal.message, refusal.issues);
|
|
1027
|
+
}
|
|
947
1028
|
const parsed = schema.safeParse(value);
|
|
948
1029
|
if (parsed.success)
|
|
949
1030
|
return parsed.data;
|
|
@@ -973,17 +1054,24 @@ function createValidatedRealtimeSocket({
|
|
|
973
1054
|
on: (event, handler) => {
|
|
974
1055
|
const definition = eventDefinition(inbound, event, inboundDirection);
|
|
975
1056
|
const wrapped = (...wireArgs) => {
|
|
976
|
-
const { values, acknowledgement } = splitWireArguments(definition, wireArgs);
|
|
1057
|
+
const { values, acknowledgement, replyTo } = splitWireArguments(definition, wireArgs);
|
|
977
1058
|
const parsed = definition.args.safeParse(values);
|
|
978
1059
|
if (!parsed.success) {
|
|
979
|
-
|
|
1060
|
+
const rejected = realtimeContractViolation({
|
|
980
1061
|
event,
|
|
981
1062
|
direction: inboundDirection,
|
|
982
1063
|
phase: "arguments",
|
|
983
1064
|
reason: "invalid-arguments",
|
|
984
1065
|
fault: "peer",
|
|
985
1066
|
cause: parsed.error
|
|
986
|
-
})
|
|
1067
|
+
});
|
|
1068
|
+
reportRejected(rejected, onRejected, logger);
|
|
1069
|
+
answerWithRejection(replyTo, {
|
|
1070
|
+
event,
|
|
1071
|
+
reason: "invalid-arguments",
|
|
1072
|
+
message: rejected.error.message,
|
|
1073
|
+
issues: zodIssues(parsed.error).slice(0, MAX_REJECTION_ISSUES)
|
|
1074
|
+
}, logger);
|
|
987
1075
|
return;
|
|
988
1076
|
}
|
|
989
1077
|
if (definition.ack && !acknowledgement) {
|
|
@@ -1053,6 +1141,17 @@ function createValidatedRealtimeSocket({
|
|
|
1053
1141
|
const wireArgs = [...parsed.data];
|
|
1054
1142
|
if (definition.ack && acknowledgement) {
|
|
1055
1143
|
wireArgs.push((value) => {
|
|
1144
|
+
const refusal = asRealtimeRejection(value);
|
|
1145
|
+
if (refusal) {
|
|
1146
|
+
reportRejected(realtimeContractViolation({
|
|
1147
|
+
event,
|
|
1148
|
+
direction: outboundDirection,
|
|
1149
|
+
phase: "arguments",
|
|
1150
|
+
reason: "rejected-by-peer",
|
|
1151
|
+
fault: "local"
|
|
1152
|
+
}), onRejected, logger);
|
|
1153
|
+
return;
|
|
1154
|
+
}
|
|
1056
1155
|
const ack = definition.ack?.safeParse(value);
|
|
1057
1156
|
if (!ack?.success) {
|
|
1058
1157
|
if (ack) {
|
|
@@ -1108,11 +1207,39 @@ function loadIo() {
|
|
|
1108
1207
|
if (!ioLoader) {
|
|
1109
1208
|
ioLoader = import(SOCKET_IO_CLIENT).then((mod) => mod.io, (cause) => {
|
|
1110
1209
|
ioLoader = null;
|
|
1111
|
-
throw new Error(
|
|
1210
|
+
throw new Error("stitchkit: createSocketIOClient needs the \"socket.io-client\" peer — install it (e.g. `bun add socket.io-client`). Shipping one self-contained artifact instead? Pass `peers: { client: () => import('socket.io-client') }` so your bundler puts it inside.", { cause });
|
|
1112
1211
|
});
|
|
1113
1212
|
}
|
|
1114
1213
|
return ioLoader;
|
|
1115
1214
|
}
|
|
1215
|
+
function isIoModule(module) {
|
|
1216
|
+
if (typeof module !== "object" || module === null)
|
|
1217
|
+
return false;
|
|
1218
|
+
return typeof Reflect.get(module, "io") === "function";
|
|
1219
|
+
}
|
|
1220
|
+
function createIoResolver(injected) {
|
|
1221
|
+
if (!injected)
|
|
1222
|
+
return loadIo;
|
|
1223
|
+
let pending = null;
|
|
1224
|
+
return () => {
|
|
1225
|
+
if (!pending) {
|
|
1226
|
+
pending = injected().then((module) => {
|
|
1227
|
+
const io = isIoModule(module) ? module.io : null;
|
|
1228
|
+
if (!io) {
|
|
1229
|
+
pending = null;
|
|
1230
|
+
throw new Error("stitchkit: the loader passed in `peers.client` did not return the \"socket.io-client\" module — it must resolve to the module itself, as `() => import('socket.io-client')`.");
|
|
1231
|
+
}
|
|
1232
|
+
return io;
|
|
1233
|
+
}, (cause) => {
|
|
1234
|
+
pending = null;
|
|
1235
|
+
if (!isModuleNotFound(cause))
|
|
1236
|
+
throw cause;
|
|
1237
|
+
throw new Error('stitchkit: createSocketIOClient could not load "socket.io-client" through the loader passed in `peers` — the artifact does not contain it. Check that the loader is a literal `import(\'socket.io-client\')` your bundler can follow, and that "socket.io-client" is a dependency of the package being bundled.', { cause });
|
|
1238
|
+
});
|
|
1239
|
+
}
|
|
1240
|
+
return pending;
|
|
1241
|
+
};
|
|
1242
|
+
}
|
|
1116
1243
|
function toIoAuth(auth) {
|
|
1117
1244
|
if (typeof auth !== "function")
|
|
1118
1245
|
return auth;
|
|
@@ -1196,7 +1323,9 @@ function createRealtimeClient(contract, { onRejected, logger, ...config }) {
|
|
|
1196
1323
|
}
|
|
1197
1324
|
function createSocketIOClient(config) {
|
|
1198
1325
|
let socket = null;
|
|
1326
|
+
const resolveIo = createIoResolver(config.peers?.client);
|
|
1199
1327
|
let desiredConnected = false;
|
|
1328
|
+
let loadingPeer = false;
|
|
1200
1329
|
let reconnectTimer = null;
|
|
1201
1330
|
const pendingRequestDisconnects = new Set;
|
|
1202
1331
|
const serverDisconnectDelay = config.reconnectOnServerDisconnect ?? 1000;
|
|
@@ -1267,6 +1396,16 @@ function createSocketIOClient(config) {
|
|
|
1267
1396
|
attach(socket);
|
|
1268
1397
|
socket.connect();
|
|
1269
1398
|
}
|
|
1399
|
+
function reportPeerFailure(error) {
|
|
1400
|
+
desiredConnected = false;
|
|
1401
|
+
if (!config.onConnectError)
|
|
1402
|
+
throw error;
|
|
1403
|
+
config.onConnectError({
|
|
1404
|
+
message: error instanceof Error ? error.message : String(error),
|
|
1405
|
+
data: error,
|
|
1406
|
+
terminal: true
|
|
1407
|
+
});
|
|
1408
|
+
}
|
|
1270
1409
|
return {
|
|
1271
1410
|
get connected() {
|
|
1272
1411
|
return socket?.connected ?? false;
|
|
@@ -1279,7 +1418,16 @@ function createSocketIOClient(config) {
|
|
|
1279
1418
|
socket.connect();
|
|
1280
1419
|
return;
|
|
1281
1420
|
}
|
|
1282
|
-
|
|
1421
|
+
if (loadingPeer)
|
|
1422
|
+
return;
|
|
1423
|
+
loadingPeer = true;
|
|
1424
|
+
resolveIo().then((io) => {
|
|
1425
|
+
loadingPeer = false;
|
|
1426
|
+
openSocket(io);
|
|
1427
|
+
}, (error) => {
|
|
1428
|
+
loadingPeer = false;
|
|
1429
|
+
reportPeerFailure(error);
|
|
1430
|
+
});
|
|
1283
1431
|
},
|
|
1284
1432
|
disconnect() {
|
|
1285
1433
|
desiredConnected = false;
|
|
@@ -1386,6 +1534,50 @@ async function* parseSSE(response, options) {
|
|
|
1386
1534
|
reader.releaseLock();
|
|
1387
1535
|
}
|
|
1388
1536
|
}
|
|
1537
|
+
|
|
1538
|
+
// src/browser/stream.ts
|
|
1539
|
+
async function* parseNDJSON(response, options) {
|
|
1540
|
+
const reader = response.body?.getReader();
|
|
1541
|
+
if (!reader)
|
|
1542
|
+
return;
|
|
1543
|
+
const decoder = new TextDecoder;
|
|
1544
|
+
let buffer = "";
|
|
1545
|
+
try {
|
|
1546
|
+
for (;; ) {
|
|
1547
|
+
const { done, value } = await reader.read();
|
|
1548
|
+
if (done)
|
|
1549
|
+
break;
|
|
1550
|
+
buffer += decoder.decode(value, { stream: true });
|
|
1551
|
+
const lines = buffer.split(`
|
|
1552
|
+
`);
|
|
1553
|
+
buffer = lines.pop() ?? "";
|
|
1554
|
+
for (const rawLine of lines) {
|
|
1555
|
+
const line = (rawLine.endsWith("\r") ? rawLine.slice(0, -1) : rawLine).trim();
|
|
1556
|
+
if (line === "")
|
|
1557
|
+
continue;
|
|
1558
|
+
try {
|
|
1559
|
+
yield JSON.parse(line);
|
|
1560
|
+
} catch (err) {
|
|
1561
|
+
options?.onParseError?.(line, err instanceof Error ? err : new Error(String(err)));
|
|
1562
|
+
}
|
|
1563
|
+
}
|
|
1564
|
+
}
|
|
1565
|
+
buffer += decoder.decode();
|
|
1566
|
+
const tail = buffer.trim();
|
|
1567
|
+
if (tail !== "") {
|
|
1568
|
+
try {
|
|
1569
|
+
yield JSON.parse(tail);
|
|
1570
|
+
} catch (err) {
|
|
1571
|
+
options?.onParseError?.(tail, err instanceof Error ? err : new Error(String(err)));
|
|
1572
|
+
}
|
|
1573
|
+
}
|
|
1574
|
+
} finally {
|
|
1575
|
+
await reader.cancel().catch(() => {
|
|
1576
|
+
return;
|
|
1577
|
+
});
|
|
1578
|
+
reader.releaseLock();
|
|
1579
|
+
}
|
|
1580
|
+
}
|
|
1389
1581
|
// src/realtime/contract.ts
|
|
1390
1582
|
function defineRealtimeContract(contract) {
|
|
1391
1583
|
return contract;
|
|
@@ -1396,11 +1588,14 @@ export {
|
|
|
1396
1588
|
AppError,
|
|
1397
1589
|
ManagedFilePathSchema,
|
|
1398
1590
|
ManagedFileRefSchema,
|
|
1591
|
+
REALTIME_REJECTION_KEY,
|
|
1399
1592
|
RealtimeRequestDisconnectedError,
|
|
1400
1593
|
RealtimeRequestInvalidAcknowledgementError,
|
|
1594
|
+
RealtimeRequestRejectedError,
|
|
1401
1595
|
RealtimeRequestTimeoutError,
|
|
1402
1596
|
STITCH_ERROR_STATUS,
|
|
1403
1597
|
appError,
|
|
1598
|
+
asRealtimeRejection,
|
|
1404
1599
|
badRequest,
|
|
1405
1600
|
bindRealtimeClient,
|
|
1406
1601
|
childSpan,
|
|
@@ -1428,6 +1623,7 @@ export {
|
|
|
1428
1623
|
isStitchErrorCode,
|
|
1429
1624
|
notFound,
|
|
1430
1625
|
paginatedSchema,
|
|
1626
|
+
parseNDJSON,
|
|
1431
1627
|
parseSSE,
|
|
1432
1628
|
parseTraceparent,
|
|
1433
1629
|
rateLimited,
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Telling "the package is not there" apart from "the loader itself threw".
|
|
3
|
+
*
|
|
4
|
+
* Both halves of the Socket.IO adapter resolve their optional peers through a
|
|
5
|
+
* variable specifier and both accept an injected loader, so both face the same
|
|
6
|
+
* question when a load fails — and both must answer it the same way. A loader
|
|
7
|
+
* that throws for its own reasons is not a packaging problem, and reporting it
|
|
8
|
+
* as one sends the reader after the wrong thing.
|
|
9
|
+
*
|
|
10
|
+
* Pure and dependency-free, so the browser half can share it without dragging
|
|
11
|
+
* anything from the server into a browser graph.
|
|
12
|
+
*/
|
|
13
|
+
export declare function isModuleNotFound(error: unknown): boolean;
|
|
14
|
+
//# sourceMappingURL=optional-peer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"optional-peer.d.ts","sourceRoot":"","sources":["../../src/internal/optional-peer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAUxD"}
|
package/dist/node.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
bindRealtimeServer,
|
|
4
4
|
createHandler,
|
|
5
5
|
createSocketIOServer
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-s1tywej8.js";
|
|
7
7
|
import {
|
|
8
8
|
createImplement,
|
|
9
9
|
createImplementRegistry,
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
createScopedImplementRegistry,
|
|
13
13
|
implement,
|
|
14
14
|
implementRegistry
|
|
15
|
-
} from "./index-
|
|
15
|
+
} from "./index-y91zd0ch.js";
|
|
16
16
|
import"./index-557by2db.js";
|
|
17
17
|
import {
|
|
18
18
|
ShutdownOptionsSchema,
|
|
@@ -21,7 +21,11 @@ import {
|
|
|
21
21
|
ShutdownStatusSchema,
|
|
22
22
|
createServerLifecycle
|
|
23
23
|
} from "./index-dk6e56g0.js";
|
|
24
|
-
import"./index-
|
|
24
|
+
import"./index-tvwcrx2d.js";
|
|
25
|
+
import"./index-wd8g8z6e.js";
|
|
26
|
+
import"./index-6k1937bx.js";
|
|
27
|
+
import"./index-pzyt11ch.js";
|
|
28
|
+
import"./index-smpbdg6k.js";
|
|
25
29
|
import {
|
|
26
30
|
AppError,
|
|
27
31
|
appError,
|
|
@@ -31,10 +35,7 @@ import {
|
|
|
31
35
|
notFound,
|
|
32
36
|
rateLimited,
|
|
33
37
|
unauthorized
|
|
34
|
-
} from "./index-
|
|
35
|
-
import"./index-6k1937bx.js";
|
|
36
|
-
import"./index-pzyt11ch.js";
|
|
37
|
-
import"./index-smpbdg6k.js";
|
|
38
|
+
} from "./index-xxye8j3k.js";
|
|
38
39
|
// src/server/node.ts
|
|
39
40
|
import { serve } from "srvx/node";
|
|
40
41
|
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
redact,
|
|
11
11
|
sanitizePayload,
|
|
12
12
|
truncatePreview
|
|
13
|
-
} from "../index-
|
|
13
|
+
} from "../index-6taryy00.js";
|
|
14
14
|
import {
|
|
15
15
|
getRequestContext,
|
|
16
16
|
getTraceId,
|
|
@@ -22,8 +22,8 @@ import {
|
|
|
22
22
|
setRequestError,
|
|
23
23
|
setRequestUser,
|
|
24
24
|
wrapInRequestContext
|
|
25
|
-
} from "../index-
|
|
26
|
-
import"../index-
|
|
25
|
+
} from "../index-tvwcrx2d.js";
|
|
26
|
+
import"../index-wd8g8z6e.js";
|
|
27
27
|
import"../index-6k1937bx.js";
|
|
28
28
|
import {
|
|
29
29
|
childSpan,
|
|
@@ -36,6 +36,7 @@ import {
|
|
|
36
36
|
import {
|
|
37
37
|
isRecord
|
|
38
38
|
} from "../index-smpbdg6k.js";
|
|
39
|
+
import"../index-xxye8j3k.js";
|
|
39
40
|
|
|
40
41
|
// src/observability/audit.ts
|
|
41
42
|
function toolErrorMessage(result) {
|
|
@@ -40,7 +40,13 @@ export interface RealtimeRejectedEvent {
|
|
|
40
40
|
event: string;
|
|
41
41
|
direction: RealtimeRejectDirection;
|
|
42
42
|
phase: 'arguments' | 'acknowledgement';
|
|
43
|
-
reason: 'unknown-event' | 'invalid-arguments' | 'invalid-acknowledgement-value' | 'missing-acknowledgement'
|
|
43
|
+
reason: 'unknown-event' | 'invalid-arguments' | 'invalid-acknowledgement-value' | 'missing-acknowledgement'
|
|
44
|
+
/**
|
|
45
|
+
* The PEER refused our frame against its own copy of the contract, and
|
|
46
|
+
* said so. Reported on the sender, where a silent drop used to leave
|
|
47
|
+
* nothing but an expiring deadline.
|
|
48
|
+
*/
|
|
49
|
+
| 'rejected-by-peer';
|
|
44
50
|
fault: 'peer' | 'local';
|
|
45
51
|
error: AppError<'REALTIME_CONTRACT_VIOLATION'>;
|
|
46
52
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../src/realtime/contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEnD,MAAM,WAAW,uBAAuB,CACtC,KAAK,SAAS,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,GAAG,CAA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IAAI,SAAS,CAAC,CAAC,OAAO,CAAA;CAAE,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;AAErF,MAAM,MAAM,qBAAqB,CAAC,SAAS,SAAS,qBAAqB,IAAI;KAC1E,MAAM,IAAI,MAAM,SAAS,GAAG,oBAAoB,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;CACrE,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAC/B,gBAAgB,GAChB,iBAAiB,GACjB,gBAAgB,GAChB,iBAAiB,CAAC;AAEtB,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,uBAAuB,CAAC;IACnC,KAAK,EAAE,WAAW,GAAG,iBAAiB,CAAC;IACvC,MAAM,EACF,eAAe,GACf,mBAAmB,GACnB,+BAA+B,GAC/B,yBAAyB;IAC3B;;;;OAIG;OACD,kBAAkB,CAAC;IACvB,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;IACxB,KAAK,EAAE,QAAQ,CAAC,6BAA6B,CAAC,CAAC;CAChD;AAED,MAAM,MAAM,yBAAyB,GAAG,CACtC,QAAQ,EAAE,qBAAqB,KAC5B,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC"}
|
package/dist/realtime/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { defineRealtimeContract, type InferRealtimeEventMap, type RealtimeAcknowledgedEvent, type RealtimeAcknowledgement, type RealtimeContract, type RealtimeEmitArguments, type RealtimeEventArguments, type RealtimeEventDefinition, type RealtimeEventHandler, type RealtimeEventRegistry, type RealtimeRejectDirection, type RealtimeRejectedEvent, type RealtimeRejectedEventHook, type RealtimeRequestArguments, } from './contract';
|
|
2
|
-
export {
|
|
2
|
+
export { asRealtimeRejection, REALTIME_REJECTION_KEY, type RealtimeRejectionEnvelope, type RealtimeRejectionIssue, type RealtimeRejectionReport, } from './rejected-frame';
|
|
3
|
+
export { RealtimeRequestDisconnectedError, RealtimeRequestInvalidAcknowledgementError, type RealtimeRequestOptions, RealtimeRequestRejectedError, RealtimeRequestTimeoutError, } from './request';
|
|
3
4
|
export type { ValidatedRealtimeSocket } from './socket';
|
|
4
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/realtime/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,GAC9B,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,gCAAgC,EAChC,0CAA0C,EAC1C,KAAK,sBAAsB,EAC3B,2BAA2B,GAC5B,MAAM,WAAW,CAAC;AACnB,YAAY,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/realtime/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,GAC9B,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,KAAK,yBAAyB,EAC9B,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,GAC7B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,gCAAgC,EAChC,0CAA0C,EAC1C,KAAK,sBAAsB,EAC3B,4BAA4B,EAC5B,2BAA2B,GAC5B,MAAM,WAAW,CAAC;AACnB,YAAY,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC"}
|