@postman-cse/onboarding-bootstrap 2.9.1 → 2.9.4
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/action.cjs +671 -467
- package/dist/cli.cjs +722 -468
- package/dist/index.cjs +671 -467
- package/package.json +5 -3
package/dist/index.cjs
CHANGED
|
@@ -12234,7 +12234,7 @@ var require_response = __commonJS({
|
|
|
12234
12234
|
var assert = require("node:assert");
|
|
12235
12235
|
var { types: types2 } = require("node:util");
|
|
12236
12236
|
var textEncoder = new TextEncoder("utf-8");
|
|
12237
|
-
var
|
|
12237
|
+
var Response2 = class _Response {
|
|
12238
12238
|
// Creates network error Response.
|
|
12239
12239
|
static error() {
|
|
12240
12240
|
const responseObject = fromInnerResponse(makeNetworkError(), "immutable");
|
|
@@ -12377,8 +12377,8 @@ var require_response = __commonJS({
|
|
|
12377
12377
|
return `Response ${nodeUtil.formatWithOptions(options, properties)}`;
|
|
12378
12378
|
}
|
|
12379
12379
|
};
|
|
12380
|
-
mixinBody(
|
|
12381
|
-
Object.defineProperties(
|
|
12380
|
+
mixinBody(Response2);
|
|
12381
|
+
Object.defineProperties(Response2.prototype, {
|
|
12382
12382
|
type: kEnumerableProperty,
|
|
12383
12383
|
url: kEnumerableProperty,
|
|
12384
12384
|
status: kEnumerableProperty,
|
|
@@ -12394,7 +12394,7 @@ var require_response = __commonJS({
|
|
|
12394
12394
|
configurable: true
|
|
12395
12395
|
}
|
|
12396
12396
|
});
|
|
12397
|
-
Object.defineProperties(
|
|
12397
|
+
Object.defineProperties(Response2, {
|
|
12398
12398
|
json: kEnumerableProperty,
|
|
12399
12399
|
redirect: kEnumerableProperty,
|
|
12400
12400
|
error: kEnumerableProperty
|
|
@@ -12527,7 +12527,7 @@ var require_response = __commonJS({
|
|
|
12527
12527
|
}
|
|
12528
12528
|
}
|
|
12529
12529
|
function fromInnerResponse(innerResponse, guard) {
|
|
12530
|
-
const response = new
|
|
12530
|
+
const response = new Response2(kConstruct);
|
|
12531
12531
|
response[kState] = innerResponse;
|
|
12532
12532
|
response[kHeaders] = new Headers3(kConstruct);
|
|
12533
12533
|
setHeadersList(response[kHeaders], innerResponse.headersList);
|
|
@@ -12595,7 +12595,7 @@ var require_response = __commonJS({
|
|
|
12595
12595
|
makeResponse,
|
|
12596
12596
|
makeAppropriateNetworkError,
|
|
12597
12597
|
filterResponse,
|
|
12598
|
-
Response,
|
|
12598
|
+
Response: Response2,
|
|
12599
12599
|
cloneResponse,
|
|
12600
12600
|
fromInnerResponse
|
|
12601
12601
|
};
|
|
@@ -15267,7 +15267,7 @@ var require_cache = __commonJS({
|
|
|
15267
15267
|
var { urlEquals, getFieldValues } = require_util5();
|
|
15268
15268
|
var { kEnumerableProperty, isDisturbed } = require_util();
|
|
15269
15269
|
var { webidl } = require_webidl();
|
|
15270
|
-
var { Response, cloneResponse, fromInnerResponse } = require_response();
|
|
15270
|
+
var { Response: Response2, cloneResponse, fromInnerResponse } = require_response();
|
|
15271
15271
|
var { Request, fromInnerRequest } = require_request2();
|
|
15272
15272
|
var { kState } = require_symbols2();
|
|
15273
15273
|
var { fetching } = require_fetch();
|
|
@@ -15794,7 +15794,7 @@ var require_cache = __commonJS({
|
|
|
15794
15794
|
converter: webidl.converters.DOMString
|
|
15795
15795
|
}
|
|
15796
15796
|
]);
|
|
15797
|
-
webidl.converters.Response = webidl.interfaceConverter(
|
|
15797
|
+
webidl.converters.Response = webidl.interfaceConverter(Response2);
|
|
15798
15798
|
webidl.converters["sequence<RequestInfo>"] = webidl.sequenceConverter(
|
|
15799
15799
|
webidl.converters.RequestInfo
|
|
15800
15800
|
);
|
|
@@ -98551,7 +98551,7 @@ var require_response2 = __commonJS({
|
|
|
98551
98551
|
}
|
|
98552
98552
|
return stream;
|
|
98553
98553
|
};
|
|
98554
|
-
var
|
|
98554
|
+
var Response2;
|
|
98555
98555
|
_.inherit(
|
|
98556
98556
|
/**
|
|
98557
98557
|
* Response holds data related to the request body. By default, it provides a nice wrapper for url-encoded,
|
|
@@ -98562,14 +98562,14 @@ var require_response2 = __commonJS({
|
|
|
98562
98562
|
*
|
|
98563
98563
|
* @param {Response.definition} options -
|
|
98564
98564
|
*/
|
|
98565
|
-
|
|
98566
|
-
|
|
98565
|
+
Response2 = function PostmanResponse(options) {
|
|
98566
|
+
Response2.super_.apply(this, arguments);
|
|
98567
98567
|
this.update(options || {});
|
|
98568
98568
|
},
|
|
98569
98569
|
Property
|
|
98570
98570
|
);
|
|
98571
98571
|
_.assign(
|
|
98572
|
-
|
|
98572
|
+
Response2.prototype,
|
|
98573
98573
|
/** @lends Response.prototype */
|
|
98574
98574
|
{
|
|
98575
98575
|
update(options) {
|
|
@@ -98635,7 +98635,7 @@ var require_response2 = __commonJS({
|
|
|
98635
98635
|
}
|
|
98636
98636
|
);
|
|
98637
98637
|
_.assign(
|
|
98638
|
-
|
|
98638
|
+
Response2.prototype,
|
|
98639
98639
|
/** @lends Response.prototype */
|
|
98640
98640
|
{
|
|
98641
98641
|
/**
|
|
@@ -98813,7 +98813,7 @@ var require_response2 = __commonJS({
|
|
|
98813
98813
|
}
|
|
98814
98814
|
);
|
|
98815
98815
|
_.assign(
|
|
98816
|
-
|
|
98816
|
+
Response2,
|
|
98817
98817
|
/** @lends Response */
|
|
98818
98818
|
{
|
|
98819
98819
|
/**
|
|
@@ -98831,7 +98831,7 @@ var require_response2 = __commonJS({
|
|
|
98831
98831
|
* @returns {Boolean}
|
|
98832
98832
|
*/
|
|
98833
98833
|
isResponse: function(obj) {
|
|
98834
|
-
return Boolean(obj) && (obj instanceof
|
|
98834
|
+
return Boolean(obj) && (obj instanceof Response2 || _.inSuperChain(obj.constructor, "_postman_propertyName", Response2._postman_propertyName));
|
|
98835
98835
|
},
|
|
98836
98836
|
/**
|
|
98837
98837
|
* Converts the response object from the request module to the postman responseBody format
|
|
@@ -98842,7 +98842,7 @@ var require_response2 = __commonJS({
|
|
|
98842
98842
|
* @todo Add a key: `originalRequest` to the returned object as well, referring to response.request
|
|
98843
98843
|
*/
|
|
98844
98844
|
createFromNode: function(response, cookies) {
|
|
98845
|
-
return new
|
|
98845
|
+
return new Response2({
|
|
98846
98846
|
cookie: cookies,
|
|
98847
98847
|
body: response.body.toString(),
|
|
98848
98848
|
stream: response.body,
|
|
@@ -98921,7 +98921,7 @@ var require_response2 = __commonJS({
|
|
|
98921
98921
|
}
|
|
98922
98922
|
);
|
|
98923
98923
|
module2.exports = {
|
|
98924
|
-
Response
|
|
98924
|
+
Response: Response2
|
|
98925
98925
|
};
|
|
98926
98926
|
}
|
|
98927
98927
|
});
|
|
@@ -98935,7 +98935,7 @@ var require_item = __commonJS({
|
|
|
98935
98935
|
var EventList = require_event_list().EventList;
|
|
98936
98936
|
var Request = require_request12().Request;
|
|
98937
98937
|
var RequestAuth = require_request_auth().RequestAuth;
|
|
98938
|
-
var
|
|
98938
|
+
var Response2 = require_response2().Response;
|
|
98939
98939
|
var Item;
|
|
98940
98940
|
var OBJECT2 = "object";
|
|
98941
98941
|
var STRING2 = "string";
|
|
@@ -99002,7 +99002,7 @@ var require_item = __commonJS({
|
|
|
99002
99002
|
*
|
|
99003
99003
|
* @type {PropertyList<Response>}
|
|
99004
99004
|
*/
|
|
99005
|
-
responses: new PropertyList(
|
|
99005
|
+
responses: new PropertyList(Response2, this, definition && definition.response),
|
|
99006
99006
|
/**
|
|
99007
99007
|
* Events are a set of of {@link Script}s that are executed when certain activities are triggered on an
|
|
99008
99008
|
* Item. For example, on defining an event that listens to the "test" event, would cause the associated
|
|
@@ -105143,7 +105143,7 @@ var require_scope_functions = __commonJS({
|
|
|
105143
105143
|
const normal = Math.floor(multiple + 0.5);
|
|
105144
105144
|
return normal / factor === value && normal % factorMultiple === 0;
|
|
105145
105145
|
};
|
|
105146
|
-
var
|
|
105146
|
+
var deepEqual2 = (obj, obj2) => {
|
|
105147
105147
|
if (obj === obj2) return true;
|
|
105148
105148
|
if (!obj || !obj2 || typeof obj !== typeof obj2) return false;
|
|
105149
105149
|
if (obj !== obj2 && typeof obj !== "object") return false;
|
|
@@ -105152,18 +105152,18 @@ var require_scope_functions = __commonJS({
|
|
|
105152
105152
|
if (proto === Array.prototype) {
|
|
105153
105153
|
if (!Array.isArray(obj) || !Array.isArray(obj2)) return false;
|
|
105154
105154
|
if (obj.length !== obj2.length) return false;
|
|
105155
|
-
return obj.every((x, i) =>
|
|
105155
|
+
return obj.every((x, i) => deepEqual2(x, obj2[i]));
|
|
105156
105156
|
} else if (proto === Object.prototype) {
|
|
105157
105157
|
const [keys, keys2] = [Object.keys(obj), Object.keys(obj2)];
|
|
105158
105158
|
if (keys.length !== keys2.length) return false;
|
|
105159
105159
|
const keyset2 = /* @__PURE__ */ new Set([...keys, ...keys2]);
|
|
105160
|
-
return keyset2.size === keys.length && keys.every((key) =>
|
|
105160
|
+
return keyset2.size === keys.length && keys.every((key) => deepEqual2(obj[key], obj2[key]));
|
|
105161
105161
|
}
|
|
105162
105162
|
return false;
|
|
105163
105163
|
};
|
|
105164
105164
|
var unique = (array) => {
|
|
105165
105165
|
if (array.length < 2) return true;
|
|
105166
|
-
if (array.length === 2) return !
|
|
105166
|
+
if (array.length === 2) return !deepEqual2(array[0], array[1]);
|
|
105167
105167
|
const objects = [];
|
|
105168
105168
|
const primitives = array.length > 20 ? /* @__PURE__ */ new Set() : null;
|
|
105169
105169
|
let primitivesCount = 0;
|
|
@@ -105180,7 +105180,7 @@ var require_scope_functions = __commonJS({
|
|
|
105180
105180
|
pos++;
|
|
105181
105181
|
}
|
|
105182
105182
|
for (let i = 1; i < objects.length; i++)
|
|
105183
|
-
for (let j = 0; j < i; j++) if (
|
|
105183
|
+
for (let j = 0; j < i; j++) if (deepEqual2(objects[i], objects[j])) return false;
|
|
105184
105184
|
return true;
|
|
105185
105185
|
};
|
|
105186
105186
|
var deBase64 = (string) => {
|
|
@@ -105199,7 +105199,7 @@ var require_scope_functions = __commonJS({
|
|
|
105199
105199
|
var propertyIn = (key, [properties, patterns]) => properties.includes(true) || properties.some((prop) => prop === key) || patterns.some((pattern) => new RegExp(pattern, "u").test(key));
|
|
105200
105200
|
var dynamicResolve = (anchors, id) => (anchors.filter((x) => x[id])[0] || {})[id];
|
|
105201
105201
|
var extraUtils = { toPointer, pointerPart, errorMerge, propertyIn, dynamicResolve };
|
|
105202
|
-
module2.exports = { stringLength, isMultipleOf, deepEqual, unique, deBase64, hasOwn: hasOwn2, ...extraUtils };
|
|
105202
|
+
module2.exports = { stringLength, isMultipleOf, deepEqual: deepEqual2, unique, deBase64, hasOwn: hasOwn2, ...extraUtils };
|
|
105203
105203
|
}
|
|
105204
105204
|
});
|
|
105205
105205
|
|
|
@@ -107130,9 +107130,9 @@ var require_src = __commonJS({
|
|
|
107130
107130
|
var genfun = require_generate_function();
|
|
107131
107131
|
var { buildSchemas } = require_pointer();
|
|
107132
107132
|
var { compile } = require_compile();
|
|
107133
|
-
var { deepEqual } = require_scope_functions();
|
|
107133
|
+
var { deepEqual: deepEqual2 } = require_scope_functions();
|
|
107134
107134
|
var jsonCheckWithErrors = (validate4) => function validateIsJSON(data) {
|
|
107135
|
-
if (!
|
|
107135
|
+
if (!deepEqual2(data, JSON.parse(JSON.stringify(data)))) {
|
|
107136
107136
|
validateIsJSON.errors = [{ instanceLocation: "#", error: "not JSON compatible" }];
|
|
107137
107137
|
return false;
|
|
107138
107138
|
}
|
|
@@ -107140,7 +107140,7 @@ var require_src = __commonJS({
|
|
|
107140
107140
|
validateIsJSON.errors = validate4.errors;
|
|
107141
107141
|
return res;
|
|
107142
107142
|
};
|
|
107143
|
-
var jsonCheckWithoutErrors = (validate4) => (data) =>
|
|
107143
|
+
var jsonCheckWithoutErrors = (validate4) => (data) => deepEqual2(data, JSON.parse(JSON.stringify(data))) && validate4(data);
|
|
107144
107144
|
var validator3 = (schema, { parse: parse10 = false, multi = false, jsonCheck = false, isJSON = false, schemas = [], ...opts } = {}) => {
|
|
107145
107145
|
if (jsonCheck && isJSON) throw new Error("Can not specify both isJSON and jsonCheck options");
|
|
107146
107146
|
if (parse10 && (jsonCheck || isJSON))
|
|
@@ -107156,7 +107156,7 @@ var require_src = __commonJS({
|
|
|
107156
107156
|
if (parse10) {
|
|
107157
107157
|
scope.parseWrap = opts.includeErrors ? parseWithErrors : parseWithoutErrors;
|
|
107158
107158
|
} else if (jsonCheck) {
|
|
107159
|
-
scope.deepEqual =
|
|
107159
|
+
scope.deepEqual = deepEqual2;
|
|
107160
107160
|
scope.jsonCheckWrap = opts.includeErrors ? jsonCheckWithErrors : jsonCheckWithoutErrors;
|
|
107161
107161
|
}
|
|
107162
107162
|
if (multi) {
|
|
@@ -140244,7 +140244,7 @@ var require_lib10 = __commonJS({
|
|
|
140244
140244
|
}
|
|
140245
140245
|
var INTERNALS$1 = /* @__PURE__ */ Symbol("Response internals");
|
|
140246
140246
|
var STATUS_CODES = http2.STATUS_CODES;
|
|
140247
|
-
var
|
|
140247
|
+
var Response2 = class _Response {
|
|
140248
140248
|
constructor() {
|
|
140249
140249
|
let body2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : null;
|
|
140250
140250
|
let opts = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
@@ -140302,8 +140302,8 @@ var require_lib10 = __commonJS({
|
|
|
140302
140302
|
});
|
|
140303
140303
|
}
|
|
140304
140304
|
};
|
|
140305
|
-
Body.mixIn(
|
|
140306
|
-
Object.defineProperties(
|
|
140305
|
+
Body.mixIn(Response2.prototype);
|
|
140306
|
+
Object.defineProperties(Response2.prototype, {
|
|
140307
140307
|
url: { enumerable: true },
|
|
140308
140308
|
status: { enumerable: true },
|
|
140309
140309
|
ok: { enumerable: true },
|
|
@@ -140312,7 +140312,7 @@ var require_lib10 = __commonJS({
|
|
|
140312
140312
|
headers: { enumerable: true },
|
|
140313
140313
|
clone: { enumerable: true }
|
|
140314
140314
|
});
|
|
140315
|
-
Object.defineProperty(
|
|
140315
|
+
Object.defineProperty(Response2.prototype, Symbol.toStringTag, {
|
|
140316
140316
|
value: "Response",
|
|
140317
140317
|
writable: false,
|
|
140318
140318
|
enumerable: false,
|
|
@@ -140621,7 +140621,7 @@ var require_lib10 = __commonJS({
|
|
|
140621
140621
|
};
|
|
140622
140622
|
const codings = headers.get("Content-Encoding");
|
|
140623
140623
|
if (!request.compress || request.method === "HEAD" || codings === null || res.statusCode === 204 || res.statusCode === 304) {
|
|
140624
|
-
response = new
|
|
140624
|
+
response = new Response2(body2, response_options);
|
|
140625
140625
|
resolve5(response);
|
|
140626
140626
|
return;
|
|
140627
140627
|
}
|
|
@@ -140631,7 +140631,7 @@ var require_lib10 = __commonJS({
|
|
|
140631
140631
|
};
|
|
140632
140632
|
if (codings == "gzip" || codings == "x-gzip") {
|
|
140633
140633
|
body2 = body2.pipe(zlib.createGunzip(zlibOptions));
|
|
140634
|
-
response = new
|
|
140634
|
+
response = new Response2(body2, response_options);
|
|
140635
140635
|
resolve5(response);
|
|
140636
140636
|
return;
|
|
140637
140637
|
}
|
|
@@ -140643,18 +140643,18 @@ var require_lib10 = __commonJS({
|
|
|
140643
140643
|
} else {
|
|
140644
140644
|
body2 = body2.pipe(zlib.createInflateRaw());
|
|
140645
140645
|
}
|
|
140646
|
-
response = new
|
|
140646
|
+
response = new Response2(body2, response_options);
|
|
140647
140647
|
resolve5(response);
|
|
140648
140648
|
});
|
|
140649
140649
|
return;
|
|
140650
140650
|
}
|
|
140651
140651
|
if (codings == "br" && typeof zlib.createBrotliDecompress === "function") {
|
|
140652
140652
|
body2 = body2.pipe(zlib.createBrotliDecompress());
|
|
140653
|
-
response = new
|
|
140653
|
+
response = new Response2(body2, response_options);
|
|
140654
140654
|
resolve5(response);
|
|
140655
140655
|
return;
|
|
140656
140656
|
}
|
|
140657
|
-
response = new
|
|
140657
|
+
response = new Response2(body2, response_options);
|
|
140658
140658
|
resolve5(response);
|
|
140659
140659
|
});
|
|
140660
140660
|
writeToStream(req, request);
|
|
@@ -140669,7 +140669,7 @@ var require_lib10 = __commonJS({
|
|
|
140669
140669
|
exports2.default = exports2;
|
|
140670
140670
|
exports2.Headers = Headers3;
|
|
140671
140671
|
exports2.Request = Request;
|
|
140672
|
-
exports2.Response =
|
|
140672
|
+
exports2.Response = Response2;
|
|
140673
140673
|
exports2.FetchError = FetchError;
|
|
140674
140674
|
}
|
|
140675
140675
|
});
|
|
@@ -148290,7 +148290,7 @@ var require_lib11 = __commonJS({
|
|
|
148290
148290
|
}
|
|
148291
148291
|
var INTERNALS$1 = /* @__PURE__ */ Symbol("Response internals");
|
|
148292
148292
|
var STATUS_CODES = http2.STATUS_CODES;
|
|
148293
|
-
var
|
|
148293
|
+
var Response2 = class _Response {
|
|
148294
148294
|
constructor() {
|
|
148295
148295
|
let body2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : null;
|
|
148296
148296
|
let opts = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
@@ -148348,8 +148348,8 @@ var require_lib11 = __commonJS({
|
|
|
148348
148348
|
});
|
|
148349
148349
|
}
|
|
148350
148350
|
};
|
|
148351
|
-
Body.mixIn(
|
|
148352
|
-
Object.defineProperties(
|
|
148351
|
+
Body.mixIn(Response2.prototype);
|
|
148352
|
+
Object.defineProperties(Response2.prototype, {
|
|
148353
148353
|
url: { enumerable: true },
|
|
148354
148354
|
status: { enumerable: true },
|
|
148355
148355
|
ok: { enumerable: true },
|
|
@@ -148358,7 +148358,7 @@ var require_lib11 = __commonJS({
|
|
|
148358
148358
|
headers: { enumerable: true },
|
|
148359
148359
|
clone: { enumerable: true }
|
|
148360
148360
|
});
|
|
148361
|
-
Object.defineProperty(
|
|
148361
|
+
Object.defineProperty(Response2.prototype, Symbol.toStringTag, {
|
|
148362
148362
|
value: "Response",
|
|
148363
148363
|
writable: false,
|
|
148364
148364
|
enumerable: false,
|
|
@@ -148692,7 +148692,7 @@ var require_lib11 = __commonJS({
|
|
|
148692
148692
|
};
|
|
148693
148693
|
const codings = headers.get("Content-Encoding");
|
|
148694
148694
|
if (!request.compress || request.method === "HEAD" || codings === null || res.statusCode === 204 || res.statusCode === 304) {
|
|
148695
|
-
response = new
|
|
148695
|
+
response = new Response2(body2, response_options);
|
|
148696
148696
|
resolve5(response);
|
|
148697
148697
|
return;
|
|
148698
148698
|
}
|
|
@@ -148702,7 +148702,7 @@ var require_lib11 = __commonJS({
|
|
|
148702
148702
|
};
|
|
148703
148703
|
if (codings == "gzip" || codings == "x-gzip") {
|
|
148704
148704
|
body2 = body2.pipe(zlib.createGunzip(zlibOptions));
|
|
148705
|
-
response = new
|
|
148705
|
+
response = new Response2(body2, response_options);
|
|
148706
148706
|
resolve5(response);
|
|
148707
148707
|
return;
|
|
148708
148708
|
}
|
|
@@ -148714,12 +148714,12 @@ var require_lib11 = __commonJS({
|
|
|
148714
148714
|
} else {
|
|
148715
148715
|
body2 = body2.pipe(zlib.createInflateRaw());
|
|
148716
148716
|
}
|
|
148717
|
-
response = new
|
|
148717
|
+
response = new Response2(body2, response_options);
|
|
148718
148718
|
resolve5(response);
|
|
148719
148719
|
});
|
|
148720
148720
|
raw.on("end", function() {
|
|
148721
148721
|
if (!response) {
|
|
148722
|
-
response = new
|
|
148722
|
+
response = new Response2(body2, response_options);
|
|
148723
148723
|
resolve5(response);
|
|
148724
148724
|
}
|
|
148725
148725
|
});
|
|
@@ -148727,11 +148727,11 @@ var require_lib11 = __commonJS({
|
|
|
148727
148727
|
}
|
|
148728
148728
|
if (codings == "br" && typeof zlib.createBrotliDecompress === "function") {
|
|
148729
148729
|
body2 = body2.pipe(zlib.createBrotliDecompress());
|
|
148730
|
-
response = new
|
|
148730
|
+
response = new Response2(body2, response_options);
|
|
148731
148731
|
resolve5(response);
|
|
148732
148732
|
return;
|
|
148733
148733
|
}
|
|
148734
|
-
response = new
|
|
148734
|
+
response = new Response2(body2, response_options);
|
|
148735
148735
|
resolve5(response);
|
|
148736
148736
|
});
|
|
148737
148737
|
writeToStream(req, request);
|
|
@@ -148773,7 +148773,7 @@ var require_lib11 = __commonJS({
|
|
|
148773
148773
|
exports2.default = exports2;
|
|
148774
148774
|
exports2.Headers = Headers3;
|
|
148775
148775
|
exports2.Request = Request;
|
|
148776
|
-
exports2.Response =
|
|
148776
|
+
exports2.Response = Response2;
|
|
148777
148777
|
exports2.FetchError = FetchError;
|
|
148778
148778
|
exports2.AbortError = AbortError;
|
|
148779
148779
|
}
|
|
@@ -258648,6 +258648,9 @@ function normalizeGitRepoUrl(url) {
|
|
|
258648
258648
|
// src/lib/postman/internal-integration-adapter.ts
|
|
258649
258649
|
var BifrostInternalIntegrationAdapter = class _BifrostInternalIntegrationAdapter {
|
|
258650
258650
|
static MINIMUM_POSTMAN_APP_VERSION = "12.0.0";
|
|
258651
|
+
/** Per-request wall-clock deadline (ms) so a hung Bifrost proxy or app-version
|
|
258652
|
+
* endpoint aborts rather than blocking the run forever. */
|
|
258653
|
+
static REQUEST_TIMEOUT_MS = 3e4;
|
|
258651
258654
|
static POSTMAN_APP_VERSION_URL = `https://dl.pstmn.io/update/status?currentVersion=${_BifrostInternalIntegrationAdapter.MINIMUM_POSTMAN_APP_VERSION}&platform=osx_arm64`;
|
|
258652
258655
|
accessToken;
|
|
258653
258656
|
tokenProvider;
|
|
@@ -258692,6 +258695,23 @@ var BifrostInternalIntegrationAdapter = class _BifrostInternalIntegrationAdapter
|
|
|
258692
258695
|
mask: this.secretMasker
|
|
258693
258696
|
};
|
|
258694
258697
|
}
|
|
258698
|
+
/**
|
|
258699
|
+
* fetch with a wall-clock deadline. A slow/hung proxy aborts instead of
|
|
258700
|
+
* blocking the run forever; callers surface the abort like any other transport
|
|
258701
|
+
* rejection.
|
|
258702
|
+
*/
|
|
258703
|
+
async fetchWithDeadline(input, init = {}) {
|
|
258704
|
+
const controller = new AbortController();
|
|
258705
|
+
const timer = setTimeout(
|
|
258706
|
+
() => controller.abort(),
|
|
258707
|
+
_BifrostInternalIntegrationAdapter.REQUEST_TIMEOUT_MS
|
|
258708
|
+
);
|
|
258709
|
+
try {
|
|
258710
|
+
return await this.fetchImpl(input, { ...init, signal: controller.signal });
|
|
258711
|
+
} finally {
|
|
258712
|
+
clearTimeout(timer);
|
|
258713
|
+
}
|
|
258714
|
+
}
|
|
258695
258715
|
async proxyRequest(service, method, requestPath2, body2, options = {}) {
|
|
258696
258716
|
const url = `${this.bifrostBaseUrl}/ws/proxy`;
|
|
258697
258717
|
const headers = {
|
|
@@ -258704,7 +258724,7 @@ var BifrostInternalIntegrationAdapter = class _BifrostInternalIntegrationAdapter
|
|
|
258704
258724
|
if (this.teamId && this.orgMode) {
|
|
258705
258725
|
headers["x-entity-team-id"] = this.teamId;
|
|
258706
258726
|
}
|
|
258707
|
-
return this.
|
|
258727
|
+
return this.fetchWithDeadline(url, {
|
|
258708
258728
|
method: "POST",
|
|
258709
258729
|
headers,
|
|
258710
258730
|
body: JSON.stringify({
|
|
@@ -258719,7 +258739,7 @@ var BifrostInternalIntegrationAdapter = class _BifrostInternalIntegrationAdapter
|
|
|
258719
258739
|
resolvePostmanAppVersion() {
|
|
258720
258740
|
this.appVersionPromise ??= (async () => {
|
|
258721
258741
|
try {
|
|
258722
|
-
const response = await this.
|
|
258742
|
+
const response = await this.fetchWithDeadline(
|
|
258723
258743
|
_BifrostInternalIntegrationAdapter.POSTMAN_APP_VERSION_URL,
|
|
258724
258744
|
{ method: "GET" }
|
|
258725
258745
|
);
|
|
@@ -263921,6 +263941,25 @@ function asRecord8(value) {
|
|
|
263921
263941
|
}
|
|
263922
263942
|
return value;
|
|
263923
263943
|
}
|
|
263944
|
+
var BOOTSTRAP_BARE_UUID_RE = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;
|
|
263945
|
+
function isMissingPatchValueError(error2) {
|
|
263946
|
+
return error2 instanceof HttpError && error2.status === 400 && error2.responseBody.includes("Remove operation must point to an existing value");
|
|
263947
|
+
}
|
|
263948
|
+
function canonicalize(value) {
|
|
263949
|
+
if (Array.isArray(value)) return value.map(canonicalize);
|
|
263950
|
+
if (value && typeof value === "object") {
|
|
263951
|
+
const record = value;
|
|
263952
|
+
const out = {};
|
|
263953
|
+
for (const key of Object.keys(record).sort()) {
|
|
263954
|
+
out[key] = canonicalize(record[key]);
|
|
263955
|
+
}
|
|
263956
|
+
return out;
|
|
263957
|
+
}
|
|
263958
|
+
return value;
|
|
263959
|
+
}
|
|
263960
|
+
function deepEqual(a, b) {
|
|
263961
|
+
return JSON.stringify(canonicalize(a)) === JSON.stringify(canonicalize(b));
|
|
263962
|
+
}
|
|
263924
263963
|
function resolvePollBudget(explicit, envValue, fallback, min) {
|
|
263925
263964
|
if (typeof explicit === "number" && Number.isFinite(explicit) && explicit >= min) return explicit;
|
|
263926
263965
|
if (envValue !== void 0) {
|
|
@@ -264101,6 +264140,9 @@ var PostmanGatewayAssetsClient = class _PostmanGatewayAssetsClient {
|
|
|
264101
264140
|
service: "specification",
|
|
264102
264141
|
method: "patch",
|
|
264103
264142
|
path: `/specifications/${specId}/files/${fileId}`,
|
|
264143
|
+
// Replacing the ROOT file content with the same value is idempotent, so a
|
|
264144
|
+
// transient downstream timeout (ESOCKETTIMEDOUT) is safe to retry.
|
|
264145
|
+
retry: "safe",
|
|
264104
264146
|
body: [{ op: "replace", path: "/content", value: specContent }]
|
|
264105
264147
|
});
|
|
264106
264148
|
}
|
|
@@ -264276,7 +264318,8 @@ var PostmanGatewayAssetsClient = class _PostmanGatewayAssetsClient {
|
|
|
264276
264318
|
service: "collection",
|
|
264277
264319
|
method: "patch",
|
|
264278
264320
|
path: `/v3/collections/${this.bareModelId(collectionId)}`,
|
|
264279
|
-
|
|
264321
|
+
// Replacing a generated collection's name with the same value is idempotent.
|
|
264322
|
+
retry: "safe",
|
|
264280
264323
|
body: [{ op: "replace", path: "/name", value: name }]
|
|
264281
264324
|
});
|
|
264282
264325
|
}
|
|
@@ -264475,15 +264518,32 @@ var PostmanGatewayAssetsClient = class _PostmanGatewayAssetsClient {
|
|
|
264475
264518
|
}
|
|
264476
264519
|
// --- collection v3 mutation + tagging (live-proven 2026-06-30; see docs/REST-to-gateway.md) ---
|
|
264477
264520
|
//
|
|
264478
|
-
// These retire bootstrap's last asset-op PMAK dependencies.
|
|
264479
|
-
//
|
|
264480
|
-
//
|
|
264481
|
-
//
|
|
264482
|
-
|
|
264521
|
+
// These retire bootstrap's last asset-op PMAK dependencies. Collection ROOT
|
|
264522
|
+
// routes (GET/PATCH/DELETE `/v3/collections/:id`) accept the bare model id.
|
|
264523
|
+
// Collection ITEMS routes (`/v3/collections/:id/items/...`) must use the FULL
|
|
264524
|
+
// public uid (`<owner>-<uuid>`): bare model ids are flaky on org-mode squads
|
|
264525
|
+
// (live-proven 2026-07-14 on team 172912 / Northwind — immediate post-generation
|
|
264526
|
+
// `GET .../items/` returns 403 FORBIDDEN with bare id, 200 with full uid).
|
|
264527
|
+
// The tagging service is distinct and takes the FULL uid.
|
|
264528
|
+
/**
|
|
264529
|
+
* `<owner>-<uuid>` public uid -> bare `<uuid>` model id (collection ROOT routes
|
|
264530
|
+
* only). Strip ONLY the numeric owner prefix of a full public uid; a bare UUID
|
|
264531
|
+
* (which itself contains hyphens) must pass through unchanged, so a naive
|
|
264532
|
+
* split on the first hyphen — which would lop off a UUID's first segment — is
|
|
264533
|
+
* rejected here in favour of an anchored `<digits>-<uuid>` match.
|
|
264534
|
+
*/
|
|
264483
264535
|
bareModelId(uid) {
|
|
264484
264536
|
const u = String(uid ?? "").trim();
|
|
264537
|
+
if (BOOTSTRAP_BARE_UUID_RE.test(u)) return u;
|
|
264485
264538
|
return u.includes("-") ? u.slice(u.indexOf("-") + 1) : u;
|
|
264486
264539
|
}
|
|
264540
|
+
/**
|
|
264541
|
+
* Collection id for ITEMS routes. Prefer the full public uid; fall back to the
|
|
264542
|
+
* trimmed input when the caller already has a bare/model id.
|
|
264543
|
+
*/
|
|
264544
|
+
collectionItemsId(uid) {
|
|
264545
|
+
return String(uid ?? "").trim();
|
|
264546
|
+
}
|
|
264487
264547
|
/**
|
|
264488
264548
|
* PATCH a freshly-created item's `/scripts`, tolerating the two transient
|
|
264489
264549
|
* failures this immediate-after-create write is prone to on the shared gateway:
|
|
@@ -264542,9 +264602,9 @@ var PostmanGatewayAssetsClient = class _PostmanGatewayAssetsClient {
|
|
|
264542
264602
|
/**
|
|
264543
264603
|
* Inject smoke-test assertions into every leaf request of a spec-generated
|
|
264544
264604
|
* collection, over the v3 collection-items surface (no PMAK):
|
|
264545
|
-
* 1. `GET /v3/collections/:cid/items/` (
|
|
264605
|
+
* 1. `GET /v3/collections/:cid/items/` (FULL public uid, trailing slash) — flat list.
|
|
264546
264606
|
* 2. for each `http-request` leaf, `PATCH /v3/collections/:cid/items/:itemId`
|
|
264547
|
-
* (full uid for `:itemId`, `X-Entity-Type: http-request` header) with a
|
|
264607
|
+
* (full uid for `:cid` and `:itemId`, `X-Entity-Type: http-request` header) with a
|
|
264548
264608
|
* JSON-Patch that sets `/scripts` to the canonical v3 shape
|
|
264549
264609
|
* (`[{type:'afterResponse', code, language}]`). The v3 surface persists test
|
|
264550
264610
|
* scripts under `scripts`, NOT `events`: a `/events` patch returns 200 but is
|
|
@@ -264557,7 +264617,7 @@ var PostmanGatewayAssetsClient = class _PostmanGatewayAssetsClient {
|
|
|
264557
264617
|
*/
|
|
264558
264618
|
async injectTests(collectionUid, type) {
|
|
264559
264619
|
void type;
|
|
264560
|
-
const cid = this.
|
|
264620
|
+
const cid = this.collectionItemsId(collectionUid);
|
|
264561
264621
|
const listed = await this.gateway.requestJson({
|
|
264562
264622
|
service: "collection",
|
|
264563
264623
|
method: "get",
|
|
@@ -264728,7 +264788,7 @@ var PostmanGatewayAssetsClient = class _PostmanGatewayAssetsClient {
|
|
|
264728
264788
|
* Inject the deterministic OpenAPI contract assertions into every generated
|
|
264729
264789
|
* request of a spec-generated collection, entirely over the v3 collection
|
|
264730
264790
|
* surface (no PMAK, no v2.1.0 read/PUT):
|
|
264731
|
-
* 1. `GET /v3/collections/:cid/items/` — flat item list (
|
|
264791
|
+
* 1. `GET /v3/collections/:cid/items/` — flat item list (FULL public uid for `:cid`).
|
|
264732
264792
|
* 2. `GET /v3/collections/:cid/items/:itemId` (`X-Entity-Type: http-request`)
|
|
264733
264793
|
* — the full v3 IR record (method/url/headers/body) the matcher needs.
|
|
264734
264794
|
* 3. `planContractItemScripts` matches each request to its OpenAPI operation
|
|
@@ -264739,7 +264799,7 @@ var PostmanGatewayAssetsClient = class _PostmanGatewayAssetsClient {
|
|
|
264739
264799
|
* Returns the non-fatal instrumentation warnings for the caller to surface.
|
|
264740
264800
|
*/
|
|
264741
264801
|
async injectContractTests(collectionUid, index) {
|
|
264742
|
-
const cid = this.
|
|
264802
|
+
const cid = this.collectionItemsId(collectionUid);
|
|
264743
264803
|
const listed = await this.gateway.requestJson({
|
|
264744
264804
|
service: "collection",
|
|
264745
264805
|
method: "get",
|
|
@@ -265085,12 +265145,61 @@ var PostmanGatewayAssetsClient = class _PostmanGatewayAssetsClient {
|
|
|
265085
265145
|
ops.push({ op: "remove", path: "/scripts" });
|
|
265086
265146
|
}
|
|
265087
265147
|
if (ops.length === 0) return;
|
|
265088
|
-
|
|
265089
|
-
|
|
265090
|
-
|
|
265091
|
-
|
|
265092
|
-
|
|
265093
|
-
|
|
265148
|
+
try {
|
|
265149
|
+
await this.gateway.requestJson({
|
|
265150
|
+
service: "collection",
|
|
265151
|
+
method: "patch",
|
|
265152
|
+
path: `/v3/collections/${cid}`,
|
|
265153
|
+
// Fixed-path add/replace ops are idempotent, and a remove that already
|
|
265154
|
+
// committed is reconciled below, so transient downstream timeouts
|
|
265155
|
+
// (ESOCKETTIMEDOUT) are safe to retry.
|
|
265156
|
+
retry: "safe",
|
|
265157
|
+
body: ops
|
|
265158
|
+
});
|
|
265159
|
+
} catch (error2) {
|
|
265160
|
+
if (isMissingPatchValueError(error2) && ops.some((op) => op.op === "remove") && await this.verifyRootSettingsApplied(cid, ops)) {
|
|
265161
|
+
return;
|
|
265162
|
+
}
|
|
265163
|
+
throw error2;
|
|
265164
|
+
}
|
|
265165
|
+
}
|
|
265166
|
+
/**
|
|
265167
|
+
* Read the collection root and check that every JSON-Patch op's intended end
|
|
265168
|
+
* state holds. add/replace targets must be structurally equal to the exact
|
|
265169
|
+
* requested value (a stale pre-PATCH description/auth/variables/scripts is
|
|
265170
|
+
* non-null but not equal, so it can never falsely verify); remove targets must
|
|
265171
|
+
* be absent (description clears to "" rather than disappearing).
|
|
265172
|
+
*/
|
|
265173
|
+
async verifyRootSettingsApplied(cid, ops) {
|
|
265174
|
+
let current;
|
|
265175
|
+
try {
|
|
265176
|
+
const got = await this.gateway.requestJson({
|
|
265177
|
+
service: "collection",
|
|
265178
|
+
method: "get",
|
|
265179
|
+
path: `/v3/collections/${cid}`
|
|
265180
|
+
});
|
|
265181
|
+
current = asRecord8(got?.data);
|
|
265182
|
+
} catch {
|
|
265183
|
+
return false;
|
|
265184
|
+
}
|
|
265185
|
+
if (!current) return false;
|
|
265186
|
+
for (const op of ops) {
|
|
265187
|
+
const rawPath = String(op.path ?? "");
|
|
265188
|
+
const field = rawPath.startsWith("/") ? rawPath.slice(1) : rawPath;
|
|
265189
|
+
if (!field) return false;
|
|
265190
|
+
const value = current[field];
|
|
265191
|
+
if (op.op === "remove") {
|
|
265192
|
+
if (field === "description") {
|
|
265193
|
+
if (typeof value === "string" && value.length > 0) return false;
|
|
265194
|
+
} else if (!(value === void 0 || value === null || Array.isArray(value) && value.length === 0)) {
|
|
265195
|
+
return false;
|
|
265196
|
+
}
|
|
265197
|
+
} else {
|
|
265198
|
+
if (value === void 0 || value === null) return false;
|
|
265199
|
+
if (!deepEqual(value, op.value)) return false;
|
|
265200
|
+
}
|
|
265201
|
+
}
|
|
265202
|
+
return true;
|
|
265094
265203
|
}
|
|
265095
265204
|
/**
|
|
265096
265205
|
* Create a curated local v2.1.0 or collection v3 payload through the gateway v3 write
|
|
@@ -265139,11 +265248,12 @@ var PostmanGatewayAssetsClient = class _PostmanGatewayAssetsClient {
|
|
|
265139
265248
|
if (!rawId) {
|
|
265140
265249
|
throw new Error("Collection create did not return an id");
|
|
265141
265250
|
}
|
|
265142
|
-
const
|
|
265251
|
+
const itemsCid = this.collectionItemsId(rawId);
|
|
265252
|
+
const rootCid = this.bareModelId(rawId);
|
|
265143
265253
|
await options.onRootCreated?.(rawId);
|
|
265144
265254
|
try {
|
|
265145
|
-
await this.createItemTree(
|
|
265146
|
-
await this.applyCollectionLevelSettings(
|
|
265255
|
+
await this.createItemTree(itemsCid, asItemArray(v3.items), itemsCid);
|
|
265256
|
+
await this.applyCollectionLevelSettings(rootCid, v3, { rename: true });
|
|
265147
265257
|
} catch (error2) {
|
|
265148
265258
|
if (options.onRootCreated) throw error2;
|
|
265149
265259
|
let cleanupError;
|
|
@@ -265170,22 +265280,23 @@ var PostmanGatewayAssetsClient = class _PostmanGatewayAssetsClient {
|
|
|
265170
265280
|
* from the converted v3 IR and reapply name/auth/variables.
|
|
265171
265281
|
*/
|
|
265172
265282
|
async updateCollection(collectionUid, collection) {
|
|
265173
|
-
const
|
|
265283
|
+
const itemsCid = this.collectionItemsId(collectionUid);
|
|
265284
|
+
const rootCid = this.bareModelId(collectionUid);
|
|
265174
265285
|
const v3 = this.normalizeCollectionForWrite(collection);
|
|
265175
|
-
const existingItems = await this.listCollectionItems(
|
|
265286
|
+
const existingItems = await this.listCollectionItems(itemsCid);
|
|
265176
265287
|
for (const item of existingItems) {
|
|
265177
265288
|
const itemId = String(item.id).trim();
|
|
265178
265289
|
try {
|
|
265179
265290
|
await this.gateway.requestJson({
|
|
265180
265291
|
service: "collection",
|
|
265181
265292
|
method: "delete",
|
|
265182
|
-
path: `/v3/collections/${
|
|
265293
|
+
path: `/v3/collections/${itemsCid}/items/${itemId}`,
|
|
265183
265294
|
retry: "none",
|
|
265184
265295
|
headers: { "X-Entity-Type": String(item.$kind ?? "http-request") }
|
|
265185
265296
|
});
|
|
265186
265297
|
} catch (error2) {
|
|
265187
265298
|
if (isAmbiguousTransportError(error2)) {
|
|
265188
|
-
const stillPresent = (await this.listCollectionItems(
|
|
265299
|
+
const stillPresent = (await this.listCollectionItems(itemsCid)).some(
|
|
265189
265300
|
(candidate) => String(candidate.id ?? "").trim() === itemId
|
|
265190
265301
|
);
|
|
265191
265302
|
if (!stillPresent) continue;
|
|
@@ -265196,14 +265307,14 @@ var PostmanGatewayAssetsClient = class _PostmanGatewayAssetsClient {
|
|
|
265196
265307
|
}
|
|
265197
265308
|
}
|
|
265198
265309
|
}
|
|
265199
|
-
const remainingItems = await this.listCollectionItems(
|
|
265310
|
+
const remainingItems = await this.listCollectionItems(itemsCid);
|
|
265200
265311
|
if (remainingItems.length > 0) {
|
|
265201
265312
|
throw new Error(
|
|
265202
265313
|
`Collection delete verification failed: ${remainingItems.length} old items remain`
|
|
265203
265314
|
);
|
|
265204
265315
|
}
|
|
265205
|
-
await this.createItemTree(
|
|
265206
|
-
await this.applyCollectionLevelSettings(
|
|
265316
|
+
await this.createItemTree(itemsCid, asItemArray(v3.items), itemsCid);
|
|
265317
|
+
await this.applyCollectionLevelSettings(rootCid, v3, { rename: true, reconcileRemovals: true });
|
|
265207
265318
|
}
|
|
265208
265319
|
};
|
|
265209
265320
|
|
|
@@ -265211,6 +265322,36 @@ var PostmanGatewayAssetsClient = class _PostmanGatewayAssetsClient {
|
|
|
265211
265322
|
function isExpiredAuthError(status, body2) {
|
|
265212
265323
|
return status === 401 || body2.includes("UNAUTHENTICATED") || body2.includes("authenticationError");
|
|
265213
265324
|
}
|
|
265325
|
+
var DEFAULT_REQUEST_TIMEOUT_MS = 3e4;
|
|
265326
|
+
function asRecord9(value) {
|
|
265327
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
265328
|
+
}
|
|
265329
|
+
function innerEnvelopeStatus(envelope) {
|
|
265330
|
+
for (const key of ["status", "statusCode"]) {
|
|
265331
|
+
const value = envelope[key];
|
|
265332
|
+
if (typeof value === "number") return value;
|
|
265333
|
+
if (typeof value === "string" && /^\d+$/.test(value)) return Number(value);
|
|
265334
|
+
}
|
|
265335
|
+
return void 0;
|
|
265336
|
+
}
|
|
265337
|
+
function detectInnerError(body2) {
|
|
265338
|
+
const trimmed = body2.trim();
|
|
265339
|
+
if (!trimmed) return null;
|
|
265340
|
+
let parsed;
|
|
265341
|
+
try {
|
|
265342
|
+
parsed = JSON.parse(trimmed);
|
|
265343
|
+
} catch {
|
|
265344
|
+
return null;
|
|
265345
|
+
}
|
|
265346
|
+
const envelope = asRecord9(parsed);
|
|
265347
|
+
if (!envelope) return null;
|
|
265348
|
+
const innerStatus = innerEnvelopeStatus(envelope);
|
|
265349
|
+
const error2 = envelope.error;
|
|
265350
|
+
const errorRecord = asRecord9(error2);
|
|
265351
|
+
const hasError = error2 !== void 0 && error2 !== null && !(errorRecord !== null && Object.keys(errorRecord).length === 0) || envelope.success === false || typeof innerStatus === "number" && innerStatus >= 400;
|
|
265352
|
+
if (!hasError) return null;
|
|
265353
|
+
return typeof innerStatus === "number" && innerStatus >= 400 ? innerStatus : 502;
|
|
265354
|
+
}
|
|
265214
265355
|
function isTransientGatewayError(status, body2) {
|
|
265215
265356
|
if (status === 502 || status === 503 || status === 504) return true;
|
|
265216
265357
|
if (status >= 500 && (body2.includes("ESOCKETTIMEDOUT") || body2.includes("ETIMEDOUT") || body2.includes("ECONNRESET") || body2.includes("serverError") || body2.includes("downstream"))) {
|
|
@@ -265230,6 +265371,7 @@ var AccessTokenGatewayClient = class {
|
|
|
265230
265371
|
secretMasker;
|
|
265231
265372
|
maxRetries;
|
|
265232
265373
|
retryBaseDelayMs;
|
|
265374
|
+
requestTimeoutMs;
|
|
265233
265375
|
sleepImpl;
|
|
265234
265376
|
constructor(options) {
|
|
265235
265377
|
this.tokenProvider = options.tokenProvider;
|
|
@@ -265242,6 +265384,7 @@ var AccessTokenGatewayClient = class {
|
|
|
265242
265384
|
this.secretMasker = options.secretMasker ?? createSecretMasker([this.tokenProvider.current()]);
|
|
265243
265385
|
this.maxRetries = options.maxRetries ?? 3;
|
|
265244
265386
|
this.retryBaseDelayMs = options.retryBaseDelayMs ?? 400;
|
|
265387
|
+
this.requestTimeoutMs = options.requestTimeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;
|
|
265245
265388
|
this.sleepImpl = options.sleepImpl ?? defaultSleep;
|
|
265246
265389
|
}
|
|
265247
265390
|
configureTeamContext(teamId, orgMode) {
|
|
@@ -265261,45 +265404,83 @@ var AccessTokenGatewayClient = class {
|
|
|
265261
265404
|
}
|
|
265262
265405
|
async send(request) {
|
|
265263
265406
|
const url = `${this.bifrostBaseUrl}/ws/proxy`;
|
|
265264
|
-
|
|
265265
|
-
|
|
265266
|
-
|
|
265267
|
-
|
|
265268
|
-
|
|
265269
|
-
|
|
265270
|
-
|
|
265271
|
-
|
|
265272
|
-
|
|
265273
|
-
|
|
265274
|
-
|
|
265407
|
+
const controller = new AbortController();
|
|
265408
|
+
const timer = setTimeout(() => controller.abort(), this.requestTimeoutMs);
|
|
265409
|
+
try {
|
|
265410
|
+
return await this.fetchImpl(url, {
|
|
265411
|
+
method: "POST",
|
|
265412
|
+
headers: this.buildHeaders(request.headers),
|
|
265413
|
+
signal: controller.signal,
|
|
265414
|
+
body: JSON.stringify({
|
|
265415
|
+
service: request.service,
|
|
265416
|
+
method: request.method,
|
|
265417
|
+
path: request.path,
|
|
265418
|
+
...request.query !== void 0 ? { query: request.query } : {},
|
|
265419
|
+
...request.body !== void 0 ? { body: request.body } : {}
|
|
265420
|
+
})
|
|
265421
|
+
});
|
|
265422
|
+
} finally {
|
|
265423
|
+
clearTimeout(timer);
|
|
265424
|
+
}
|
|
265275
265425
|
}
|
|
265276
265426
|
/**
|
|
265277
265427
|
* Send a gateway request, refreshing the token once on an auth failure and
|
|
265278
|
-
* retrying transient
|
|
265279
|
-
*
|
|
265280
|
-
*
|
|
265428
|
+
* retrying transient failures with exponential backoff. Transient covers both
|
|
265429
|
+
* HTTP 5xx / Bifrost read timeouts AND transport-level rejections (fetch
|
|
265430
|
+
* throwing on a socket hangup or the per-request deadline aborting) — a
|
|
265431
|
+
* `retry: 'safe'` request retries either; a `retry: 'none'` mutation surfaces
|
|
265432
|
+
* the failure so the caller reconciles instead of blindly resending. An HTTP
|
|
265433
|
+
* 200 envelope carrying an inner collection-service error is treated as that
|
|
265434
|
+
* inner status. The auth-refresh-once path is independent of the retry budget.
|
|
265281
265435
|
*/
|
|
265282
265436
|
async request(request) {
|
|
265283
265437
|
if (!this.tokenProvider.current() && this.tokenProvider.canRefresh()) {
|
|
265284
265438
|
await this.tokenProvider.refresh();
|
|
265285
265439
|
}
|
|
265440
|
+
const retryMode = request.retry ?? (request.method === "get" ? "safe" : "none");
|
|
265286
265441
|
let attempt = 0;
|
|
265287
265442
|
for (; ; ) {
|
|
265288
|
-
let response
|
|
265443
|
+
let response;
|
|
265444
|
+
try {
|
|
265445
|
+
response = await this.send(request);
|
|
265446
|
+
} catch (error2) {
|
|
265447
|
+
if (retryMode === "safe" && attempt < this.maxRetries) {
|
|
265448
|
+
const delay = this.retryBaseDelayMs * 2 ** attempt;
|
|
265449
|
+
attempt += 1;
|
|
265450
|
+
await this.sleepImpl(delay);
|
|
265451
|
+
continue;
|
|
265452
|
+
}
|
|
265453
|
+
throw error2;
|
|
265454
|
+
}
|
|
265289
265455
|
if (response.ok) {
|
|
265290
|
-
|
|
265456
|
+
const okBody = await response.text().catch(() => "");
|
|
265457
|
+
const innerStatus = detectInnerError(okBody);
|
|
265458
|
+
if (innerStatus !== null) {
|
|
265459
|
+
if (retryMode === "safe" && isTransientGatewayError(innerStatus, okBody) && attempt < this.maxRetries) {
|
|
265460
|
+
const delay = this.retryBaseDelayMs * 2 ** attempt;
|
|
265461
|
+
attempt += 1;
|
|
265462
|
+
await this.sleepImpl(delay);
|
|
265463
|
+
continue;
|
|
265464
|
+
}
|
|
265465
|
+
throw this.toInnerHttpError(request, innerStatus, okBody);
|
|
265466
|
+
}
|
|
265467
|
+
return this.rebuildResponse(response, okBody);
|
|
265291
265468
|
}
|
|
265292
265469
|
const body2 = await response.text().catch(() => "");
|
|
265293
265470
|
if (isExpiredAuthError(response.status, body2) && this.tokenProvider.canRefresh()) {
|
|
265294
265471
|
await this.tokenProvider.refresh();
|
|
265295
265472
|
response = await this.send(request);
|
|
265296
265473
|
if (response.ok) {
|
|
265297
|
-
|
|
265474
|
+
const refreshedBody = await response.text().catch(() => "");
|
|
265475
|
+
const innerStatus = detectInnerError(refreshedBody);
|
|
265476
|
+
if (innerStatus !== null) {
|
|
265477
|
+
throw this.toInnerHttpError(request, innerStatus, refreshedBody);
|
|
265478
|
+
}
|
|
265479
|
+
return this.rebuildResponse(response, refreshedBody);
|
|
265298
265480
|
}
|
|
265299
265481
|
const retryBody = await response.text().catch(() => "");
|
|
265300
265482
|
throw this.toHttpError(request, response, retryBody);
|
|
265301
265483
|
}
|
|
265302
|
-
const retryMode = request.retry ?? (request.method === "get" ? "safe" : "none");
|
|
265303
265484
|
if (retryMode === "safe" && isTransientGatewayError(response.status, body2) && attempt < this.maxRetries) {
|
|
265304
265485
|
const delay = this.retryBaseDelayMs * 2 ** attempt;
|
|
265305
265486
|
attempt += 1;
|
|
@@ -265309,6 +265490,18 @@ var AccessTokenGatewayClient = class {
|
|
|
265309
265490
|
throw this.toHttpError(request, response, body2);
|
|
265310
265491
|
}
|
|
265311
265492
|
}
|
|
265493
|
+
/**
|
|
265494
|
+
* The success path reads the body to inspect for an inner error, which
|
|
265495
|
+
* consumes the stream. Hand callers a fresh Response over the buffered text so
|
|
265496
|
+
* `requestJson` can still parse it.
|
|
265497
|
+
*/
|
|
265498
|
+
rebuildResponse(response, body2) {
|
|
265499
|
+
return new Response(body2, {
|
|
265500
|
+
status: response.status,
|
|
265501
|
+
statusText: response.statusText,
|
|
265502
|
+
headers: response.headers
|
|
265503
|
+
});
|
|
265504
|
+
}
|
|
265312
265505
|
/** Send a gateway request and parse the JSON body, or null when empty. */
|
|
265313
265506
|
async requestJson(request) {
|
|
265314
265507
|
const response = await this.request(request);
|
|
@@ -265333,6 +265526,17 @@ var AccessTokenGatewayClient = class {
|
|
|
265333
265526
|
secretValues: [this.tokenProvider.current()]
|
|
265334
265527
|
});
|
|
265335
265528
|
}
|
|
265529
|
+
toInnerHttpError(request, status, body2) {
|
|
265530
|
+
return new HttpError({
|
|
265531
|
+
method: request.method.toUpperCase(),
|
|
265532
|
+
url: `${this.bifrostBaseUrl}/ws/proxy (${request.service}: ${request.method} ${request.path}) [inner]`,
|
|
265533
|
+
status,
|
|
265534
|
+
statusText: "Inner Error",
|
|
265535
|
+
requestHeaders: this.buildHeaders(request.headers),
|
|
265536
|
+
responseBody: this.secretMasker(body2),
|
|
265537
|
+
secretValues: [this.tokenProvider.current()]
|
|
265538
|
+
});
|
|
265539
|
+
}
|
|
265336
265540
|
};
|
|
265337
265541
|
|
|
265338
265542
|
// src/lib/postman/token-provider.ts
|
|
@@ -281650,7 +281854,7 @@ function compileErrors(result) {
|
|
|
281650
281854
|
|
|
281651
281855
|
// src/lib/spec/openapi-loader.ts
|
|
281652
281856
|
var import_yaml3 = __toESM(require_dist(), 1);
|
|
281653
|
-
function
|
|
281857
|
+
function asRecord10(value) {
|
|
281654
281858
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
281655
281859
|
return value;
|
|
281656
281860
|
}
|
|
@@ -281665,7 +281869,7 @@ function parseOpenApiDocument(content) {
|
|
|
281665
281869
|
throw new Error("CONTRACT_SPEC_PARSE_FAILED: Spec content is not valid JSON or YAML");
|
|
281666
281870
|
}
|
|
281667
281871
|
}
|
|
281668
|
-
const doc =
|
|
281872
|
+
const doc = asRecord10(parsed);
|
|
281669
281873
|
if (!doc) throw new Error("CONTRACT_SPEC_PARSE_FAILED: Spec content must be a JSON or YAML object");
|
|
281670
281874
|
return doc;
|
|
281671
281875
|
}
|
|
@@ -281693,7 +281897,7 @@ function collectExternalRefs(node, baseUrl, refs) {
|
|
|
281693
281897
|
node.forEach((entry) => collectExternalRefs(entry, baseUrl, refs));
|
|
281694
281898
|
return;
|
|
281695
281899
|
}
|
|
281696
|
-
const record =
|
|
281900
|
+
const record = asRecord10(node);
|
|
281697
281901
|
if (!record) return;
|
|
281698
281902
|
const ref = typeof record.$ref === "string" ? record.$ref : "";
|
|
281699
281903
|
if (ref && !ref.startsWith("#")) {
|
|
@@ -294289,7 +294493,7 @@ function buildGraphQLCollection(index, opts = {}) {
|
|
|
294289
294493
|
}
|
|
294290
294494
|
|
|
294291
294495
|
// src/lib/protocols/graphql/schema-lints.ts
|
|
294292
|
-
function
|
|
294496
|
+
function asRecord11(value) {
|
|
294293
294497
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
294294
294498
|
return value;
|
|
294295
294499
|
}
|
|
@@ -294300,7 +294504,7 @@ var BUILT_IN_SCALAR_NAMES = new Set(specifiedScalarTypes.map((scalar) => scalar.
|
|
|
294300
294504
|
var VALID_TYPE_KINDS = /* @__PURE__ */ new Set(["SCALAR", "OBJECT", "INTERFACE", "UNION", "ENUM", "INPUT_OBJECT", "LIST", "NON_NULL"]);
|
|
294301
294505
|
var VALID_DIRECTIVE_LOCATIONS = new Set(Object.values(DirectiveLocation));
|
|
294302
294506
|
function renderIntrospectionTypeRef(ref, depth = 0) {
|
|
294303
|
-
const current =
|
|
294507
|
+
const current = asRecord11(ref);
|
|
294304
294508
|
if (!current || depth > 32 || typeof current.kind !== "string") return null;
|
|
294305
294509
|
if (current.kind === "NON_NULL") {
|
|
294306
294510
|
const inner = renderIntrospectionTypeRef(current.ofType, depth + 1);
|
|
@@ -294313,12 +294517,12 @@ function renderIntrospectionTypeRef(ref, depth = 0) {
|
|
|
294313
294517
|
return typeof current.name === "string" && current.name.length > 0 ? current.name : null;
|
|
294314
294518
|
}
|
|
294315
294519
|
function readIntrospectionDirectiveShape(value) {
|
|
294316
|
-
const directive =
|
|
294520
|
+
const directive = asRecord11(value);
|
|
294317
294521
|
if (!directive || typeof directive.isRepeatable !== "boolean") return null;
|
|
294318
294522
|
return {
|
|
294319
294523
|
isRepeatable: directive.isRepeatable,
|
|
294320
294524
|
locations: asArray5(directive.locations).filter((entry) => typeof entry === "string"),
|
|
294321
|
-
args: asArray5(directive.args).map(
|
|
294525
|
+
args: asArray5(directive.args).map(asRecord11).filter((entry) => entry !== null && typeof entry.name === "string").map((arg) => ({
|
|
294322
294526
|
name: arg.name,
|
|
294323
294527
|
type: renderIntrospectionTypeRef(arg.type),
|
|
294324
294528
|
defaultValue: Object.prototype.hasOwnProperty.call(arg, "defaultValue") ? arg.defaultValue : void 0
|
|
@@ -294328,10 +294532,10 @@ function readIntrospectionDirectiveShape(value) {
|
|
|
294328
294532
|
var BUILT_IN_INTROSPECTION_DIRECTIVE_SHAPES = (() => {
|
|
294329
294533
|
const shapes = /* @__PURE__ */ new Map();
|
|
294330
294534
|
const reference = introspectionFromSchema(buildSchema("type Query { _: Boolean }"));
|
|
294331
|
-
const schemaRecord =
|
|
294535
|
+
const schemaRecord = asRecord11(asRecord11(reference)?.__schema);
|
|
294332
294536
|
if (!schemaRecord) return shapes;
|
|
294333
294537
|
for (const entry of asArray5(schemaRecord.directives)) {
|
|
294334
|
-
const directive =
|
|
294538
|
+
const directive = asRecord11(entry);
|
|
294335
294539
|
if (!directive || typeof directive.name !== "string") continue;
|
|
294336
294540
|
const shape = readIntrospectionDirectiveShape(directive);
|
|
294337
294541
|
if (shape) shapes.set(directive.name, shape);
|
|
@@ -294427,11 +294631,11 @@ function lintDirectiveDefinitions(schema) {
|
|
|
294427
294631
|
const warnings = [];
|
|
294428
294632
|
const builtIn = new Set(specifiedDirectives.map((directive) => directive.name));
|
|
294429
294633
|
const usesDirective = (astNode, name) => {
|
|
294430
|
-
const record =
|
|
294634
|
+
const record = asRecord11(astNode);
|
|
294431
294635
|
if (!record) return false;
|
|
294432
294636
|
return asArray5(record.directives).some((entry) => {
|
|
294433
|
-
const applied =
|
|
294434
|
-
const appliedName = applied ?
|
|
294637
|
+
const applied = asRecord11(entry);
|
|
294638
|
+
const appliedName = applied ? asRecord11(applied.name) : null;
|
|
294435
294639
|
return Boolean(appliedName && appliedName.value === name);
|
|
294436
294640
|
});
|
|
294437
294641
|
};
|
|
@@ -294441,7 +294645,7 @@ function lintDirectiveDefinitions(schema) {
|
|
|
294441
294645
|
warnings.push("GQL_DIRECTIVE_NAME_RESERVED: directive @" + directive.name + ' must not begin with "__" (GraphQL spec 3.13)');
|
|
294442
294646
|
}
|
|
294443
294647
|
let selfReferenced = false;
|
|
294444
|
-
const ownAst =
|
|
294648
|
+
const ownAst = asRecord11(directive.astNode);
|
|
294445
294649
|
if (ownAst) {
|
|
294446
294650
|
for (const argNode of asArray5(ownAst.arguments)) {
|
|
294447
294651
|
if (usesDirective(argNode, directive.name)) selfReferenced = true;
|
|
@@ -294585,10 +294789,10 @@ function lintSdlDocument(sdl) {
|
|
|
294585
294789
|
return warnings;
|
|
294586
294790
|
}
|
|
294587
294791
|
function lintTypeRefChain(ref, context, warnings) {
|
|
294588
|
-
let current =
|
|
294792
|
+
let current = asRecord11(ref);
|
|
294589
294793
|
let depth = 0;
|
|
294590
294794
|
while (current && depth < 32) {
|
|
294591
|
-
const ofType =
|
|
294795
|
+
const ofType = asRecord11(current.ofType);
|
|
294592
294796
|
if (current.kind === "NON_NULL" && ofType && ofType.kind === "NON_NULL") {
|
|
294593
294797
|
warnings.push("GQL_INTROSPECTION_NONNULL_NESTED: " + context + " wraps NON_NULL directly inside NON_NULL, which the type system forbids (GraphQL spec 3.12)");
|
|
294594
294798
|
return;
|
|
@@ -294599,7 +294803,7 @@ function lintTypeRefChain(ref, context, warnings) {
|
|
|
294599
294803
|
}
|
|
294600
294804
|
function lintDeprecationFlags(entries, context, warnings) {
|
|
294601
294805
|
for (const entry of entries) {
|
|
294602
|
-
const record =
|
|
294806
|
+
const record = asRecord11(entry);
|
|
294603
294807
|
if (!record) continue;
|
|
294604
294808
|
const label = context + "." + (typeof record.name === "string" ? record.name : "<unnamed>");
|
|
294605
294809
|
if (record.isDeprecated !== void 0 && typeof record.isDeprecated !== "boolean") {
|
|
@@ -294620,7 +294824,7 @@ function lintIntrospectionBuiltInDirectiveShapes(schemaRecord) {
|
|
|
294620
294824
|
const warnings = [];
|
|
294621
294825
|
const directives = /* @__PURE__ */ new Map();
|
|
294622
294826
|
for (const entry of asArray5(schemaRecord.directives)) {
|
|
294623
|
-
const directive =
|
|
294827
|
+
const directive = asRecord11(entry);
|
|
294624
294828
|
if (directive && typeof directive.name === "string" && !directives.has(directive.name)) {
|
|
294625
294829
|
directives.set(directive.name, directive);
|
|
294626
294830
|
}
|
|
@@ -294674,13 +294878,13 @@ function lintIntrospectionBuiltInDirectiveShapes(schemaRecord) {
|
|
|
294674
294878
|
}
|
|
294675
294879
|
function lintIntrospectionJson(introspection) {
|
|
294676
294880
|
const warnings = [];
|
|
294677
|
-
const root =
|
|
294678
|
-
const dataRecord = root ?
|
|
294679
|
-
const schemaRecord = root ?
|
|
294881
|
+
const root = asRecord11(introspection);
|
|
294882
|
+
const dataRecord = root ? asRecord11(root.data) : null;
|
|
294883
|
+
const schemaRecord = root ? asRecord11(root.__schema) ?? (dataRecord ? asRecord11(dataRecord.__schema) : null) : null;
|
|
294680
294884
|
if (!schemaRecord) return warnings;
|
|
294681
294885
|
const typeCounts = /* @__PURE__ */ new Map();
|
|
294682
294886
|
for (const entry of asArray5(schemaRecord.types)) {
|
|
294683
|
-
const type =
|
|
294887
|
+
const type = asRecord11(entry);
|
|
294684
294888
|
if (!type) continue;
|
|
294685
294889
|
const name = typeof type.name === "string" ? type.name : "<unnamed>";
|
|
294686
294890
|
typeCounts.set(name, (typeCounts.get(name) ?? 0) + 1);
|
|
@@ -294688,7 +294892,7 @@ function lintIntrospectionJson(introspection) {
|
|
|
294688
294892
|
warnings.push("GQL_INTROSPECTION_KIND_INVALID: type " + name + " declares unknown __TypeKind '" + type.kind + "'");
|
|
294689
294893
|
}
|
|
294690
294894
|
for (const memberEntry of asArray5(type.possibleTypes)) {
|
|
294691
|
-
const member =
|
|
294895
|
+
const member = asRecord11(memberEntry);
|
|
294692
294896
|
if (member && member.kind !== void 0 && member.kind !== "OBJECT") {
|
|
294693
294897
|
warnings.push("GQL_INTROSPECTION_POSSIBLE_TYPE_NOT_OBJECT: " + name + ".possibleTypes entry " + String(member.name ?? "<unnamed>") + " has kind " + String(member.kind) + "; union/interface possible types must be OBJECT types (GraphQL spec 3.7/3.8)");
|
|
294694
294898
|
}
|
|
@@ -294696,18 +294900,18 @@ function lintIntrospectionJson(introspection) {
|
|
|
294696
294900
|
lintDeprecationFlags(asArray5(type.fields), name + ".fields", warnings);
|
|
294697
294901
|
lintDeprecationFlags(asArray5(type.enumValues), name + ".enumValues", warnings);
|
|
294698
294902
|
for (const fieldEntry of asArray5(type.fields)) {
|
|
294699
|
-
const field =
|
|
294903
|
+
const field = asRecord11(fieldEntry);
|
|
294700
294904
|
if (!field) continue;
|
|
294701
294905
|
const fieldLabel = name + "." + String(field.name ?? "<unnamed>");
|
|
294702
294906
|
lintTypeRefChain(field.type, fieldLabel, warnings);
|
|
294703
294907
|
for (const argEntry of asArray5(field.args)) {
|
|
294704
|
-
const arg =
|
|
294908
|
+
const arg = asRecord11(argEntry);
|
|
294705
294909
|
if (arg) lintTypeRefChain(arg.type, fieldLabel + "(" + String(arg.name ?? "<unnamed>") + ":)", warnings);
|
|
294706
294910
|
}
|
|
294707
294911
|
lintDeprecationFlags(asArray5(field.args), fieldLabel + ".args", warnings);
|
|
294708
294912
|
}
|
|
294709
294913
|
for (const inputEntry of asArray5(type.inputFields)) {
|
|
294710
|
-
const input =
|
|
294914
|
+
const input = asRecord11(inputEntry);
|
|
294711
294915
|
if (input) lintTypeRefChain(input.type, name + "." + String(input.name ?? "<unnamed>"), warnings);
|
|
294712
294916
|
}
|
|
294713
294917
|
lintDeprecationFlags(asArray5(type.inputFields), name + ".inputFields", warnings);
|
|
@@ -294719,7 +294923,7 @@ function lintIntrospectionJson(introspection) {
|
|
|
294719
294923
|
}
|
|
294720
294924
|
const directiveNameCounts = /* @__PURE__ */ new Map();
|
|
294721
294925
|
for (const directiveEntry of asArray5(schemaRecord.directives)) {
|
|
294722
|
-
const directive =
|
|
294926
|
+
const directive = asRecord11(directiveEntry);
|
|
294723
294927
|
if (!directive) continue;
|
|
294724
294928
|
if (typeof directive.name !== "string" || directive.name.length === 0) {
|
|
294725
294929
|
warnings.push("GQL_INTROSPECTION_DIRECTIVE_INVALID: a __schema.directives entry is missing its name");
|
|
@@ -294735,7 +294939,7 @@ function lintIntrospectionJson(introspection) {
|
|
|
294735
294939
|
warnings.push("GQL_INTROSPECTION_DIRECTIVE_INVALID: directive @" + directive.name + " isRepeatable must be a boolean (__Directive contract)");
|
|
294736
294940
|
}
|
|
294737
294941
|
for (const argEntry of asArray5(directive.args)) {
|
|
294738
|
-
const arg =
|
|
294942
|
+
const arg = asRecord11(argEntry);
|
|
294739
294943
|
if (arg) lintTypeRefChain(arg.type, "@" + directive.name + "(" + String(arg.name ?? "<unnamed>") + ":)", warnings);
|
|
294740
294944
|
}
|
|
294741
294945
|
lintDeprecationFlags(asArray5(directive.args), "@" + directive.name + ".args", warnings);
|
|
@@ -294754,7 +294958,7 @@ function lintIntrospectionJson(introspection) {
|
|
|
294754
294958
|
return warnings;
|
|
294755
294959
|
}
|
|
294756
294960
|
function introspectionTypeEntries(schemaRecord) {
|
|
294757
|
-
return asArray5(schemaRecord.types).map(
|
|
294961
|
+
return asArray5(schemaRecord.types).map(asRecord11).filter((entry) => entry !== null);
|
|
294758
294962
|
}
|
|
294759
294963
|
function introspectionTypesByName(entries) {
|
|
294760
294964
|
const byName = /* @__PURE__ */ new Map();
|
|
@@ -294765,7 +294969,7 @@ function introspectionTypesByName(entries) {
|
|
|
294765
294969
|
}
|
|
294766
294970
|
function describeIntrospectionRootRecord(value) {
|
|
294767
294971
|
if (value === void 0 || value === null) return "<missing>";
|
|
294768
|
-
const record =
|
|
294972
|
+
const record = asRecord11(value);
|
|
294769
294973
|
if (!record) return "<invalid>";
|
|
294770
294974
|
return typeof record.name === "string" && record.name.length > 0 ? record.name : "<unnamed>";
|
|
294771
294975
|
}
|
|
@@ -294785,7 +294989,7 @@ function lintIntrospectionRootMap(schemaRecord) {
|
|
|
294785
294989
|
}
|
|
294786
294990
|
continue;
|
|
294787
294991
|
}
|
|
294788
|
-
const record =
|
|
294992
|
+
const record = asRecord11(value);
|
|
294789
294993
|
if (!record || typeof record.name !== "string" || record.name.length === 0) {
|
|
294790
294994
|
warnings.push("GQL_INTROSPECTION_ROOT_INVALID: __schema." + rootKind + "Type must name the " + rootKind + " root operation type (GraphQL spec 3.3). Root map: " + rootMap);
|
|
294791
294995
|
continue;
|
|
@@ -294845,13 +295049,13 @@ function lintIntrospectionTypeMatrix(schemaRecord) {
|
|
|
294845
295049
|
return warnings;
|
|
294846
295050
|
}
|
|
294847
295051
|
function namedTypeRefName(ref) {
|
|
294848
|
-
let current =
|
|
295052
|
+
let current = asRecord11(ref);
|
|
294849
295053
|
let depth = 0;
|
|
294850
295054
|
while (current && depth < 32) {
|
|
294851
295055
|
if (current.kind !== "LIST" && current.kind !== "NON_NULL") {
|
|
294852
295056
|
return typeof current.name === "string" ? current.name : null;
|
|
294853
295057
|
}
|
|
294854
|
-
current =
|
|
295058
|
+
current = asRecord11(current.ofType);
|
|
294855
295059
|
depth += 1;
|
|
294856
295060
|
}
|
|
294857
295061
|
return null;
|
|
@@ -294865,31 +295069,31 @@ function lintIntrospectionReferenceGraph(schemaRecord) {
|
|
|
294865
295069
|
if (name) referenced.add(name);
|
|
294866
295070
|
};
|
|
294867
295071
|
for (const rootKind of ["query", "mutation", "subscription"]) {
|
|
294868
|
-
const record =
|
|
295072
|
+
const record = asRecord11(schemaRecord[rootKind + "Type"]);
|
|
294869
295073
|
if (record && typeof record.name === "string") referenced.add(record.name);
|
|
294870
295074
|
}
|
|
294871
295075
|
for (const type of entries) {
|
|
294872
295076
|
for (const entry of asArray5(type.interfaces)) addRef(namedTypeRefName(entry));
|
|
294873
295077
|
for (const entry of asArray5(type.possibleTypes)) addRef(namedTypeRefName(entry));
|
|
294874
295078
|
for (const fieldEntry of asArray5(type.fields)) {
|
|
294875
|
-
const field =
|
|
295079
|
+
const field = asRecord11(fieldEntry);
|
|
294876
295080
|
if (!field) continue;
|
|
294877
295081
|
addRef(namedTypeRefName(field.type));
|
|
294878
295082
|
for (const argEntry of asArray5(field.args)) {
|
|
294879
|
-
const arg =
|
|
295083
|
+
const arg = asRecord11(argEntry);
|
|
294880
295084
|
if (arg) addRef(namedTypeRefName(arg.type));
|
|
294881
295085
|
}
|
|
294882
295086
|
}
|
|
294883
295087
|
for (const inputEntry of asArray5(type.inputFields)) {
|
|
294884
|
-
const input =
|
|
295088
|
+
const input = asRecord11(inputEntry);
|
|
294885
295089
|
if (input) addRef(namedTypeRefName(input.type));
|
|
294886
295090
|
}
|
|
294887
295091
|
}
|
|
294888
295092
|
for (const directiveEntry of asArray5(schemaRecord.directives)) {
|
|
294889
|
-
const directive =
|
|
295093
|
+
const directive = asRecord11(directiveEntry);
|
|
294890
295094
|
if (!directive) continue;
|
|
294891
295095
|
for (const argEntry of asArray5(directive.args)) {
|
|
294892
|
-
const arg =
|
|
295096
|
+
const arg = asRecord11(argEntry);
|
|
294893
295097
|
if (arg) addRef(namedTypeRefName(arg.type));
|
|
294894
295098
|
}
|
|
294895
295099
|
}
|
|
@@ -294910,7 +295114,7 @@ function lintIntrospectionAbstractConsistency(schemaRecord) {
|
|
|
294910
295114
|
const entries = introspectionTypeEntries(schemaRecord);
|
|
294911
295115
|
const byName = introspectionTypesByName(entries);
|
|
294912
295116
|
const names = (value) => asArray5(value).map((entry) => {
|
|
294913
|
-
const record =
|
|
295117
|
+
const record = asRecord11(entry);
|
|
294914
295118
|
return record && typeof record.name === "string" ? record.name : "";
|
|
294915
295119
|
}).filter((name) => name.length > 0);
|
|
294916
295120
|
for (const type of entries) {
|
|
@@ -294939,7 +295143,7 @@ function lintIntrospectionDeprecationProvenance(schemaRecord) {
|
|
|
294939
295143
|
let flagged = 0;
|
|
294940
295144
|
for (const type of introspectionTypeEntries(schemaRecord)) {
|
|
294941
295145
|
for (const entry of [...asArray5(type.fields), ...asArray5(type.enumValues)]) {
|
|
294942
|
-
const record =
|
|
295146
|
+
const record = asRecord11(entry);
|
|
294943
295147
|
if (!record) continue;
|
|
294944
295148
|
entries += 1;
|
|
294945
295149
|
if (record.isDeprecated !== void 0) flagged += 1;
|
|
@@ -294965,7 +295169,7 @@ function lintGeneratedDocument(schema, operationId, documentText) {
|
|
|
294965
295169
|
}
|
|
294966
295170
|
|
|
294967
295171
|
// src/lib/protocols/graphql/parser.ts
|
|
294968
|
-
function
|
|
295172
|
+
function asRecord12(value) {
|
|
294969
295173
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
294970
295174
|
return value;
|
|
294971
295175
|
}
|
|
@@ -295083,14 +295287,14 @@ function collectRootOperations(rootType, kind, schema, shapes) {
|
|
|
295083
295287
|
});
|
|
295084
295288
|
}
|
|
295085
295289
|
function looksLikeIntrospection2(value) {
|
|
295086
|
-
const record =
|
|
295290
|
+
const record = asRecord12(value);
|
|
295087
295291
|
if (!record) return false;
|
|
295088
|
-
if (
|
|
295089
|
-
const data =
|
|
295090
|
-
return Boolean(data &&
|
|
295292
|
+
if (asRecord12(record.__schema)) return true;
|
|
295293
|
+
const data = asRecord12(record.data);
|
|
295294
|
+
return Boolean(data && asRecord12(data.__schema));
|
|
295091
295295
|
}
|
|
295092
295296
|
function buildSchemaFromIntrospection(value) {
|
|
295093
|
-
const introspection =
|
|
295297
|
+
const introspection = asRecord12(value.__schema) ? value : asRecord12(value.data);
|
|
295094
295298
|
return buildClientSchema(introspection);
|
|
295095
295299
|
}
|
|
295096
295300
|
function selectIntrospectionRootWarnings(warnings) {
|
|
@@ -295113,7 +295317,7 @@ function parseGraphQLSchema(content, opts = {}) {
|
|
|
295113
295317
|
if (parsedJson !== void 0 && looksLikeIntrospection2(parsedJson)) {
|
|
295114
295318
|
introspectionWarnings = lintIntrospectionJson(parsedJson);
|
|
295115
295319
|
try {
|
|
295116
|
-
schema = buildSchemaFromIntrospection(
|
|
295320
|
+
schema = buildSchemaFromIntrospection(asRecord12(parsedJson));
|
|
295117
295321
|
} catch (error2) {
|
|
295118
295322
|
const rootWarnings = selectIntrospectionRootWarnings(introspectionWarnings);
|
|
295119
295323
|
const rootDiagnostics = rootWarnings.length > 0 ? " " + rootWarnings.join(" ") : "";
|
|
@@ -295230,7 +295434,7 @@ function collectDeprecatedSelectionWarnings(schema, operation, index) {
|
|
|
295230
295434
|
}
|
|
295231
295435
|
|
|
295232
295436
|
// src/lib/protocols/graphql/instrumenter.ts
|
|
295233
|
-
function
|
|
295437
|
+
function asRecord13(value) {
|
|
295234
295438
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
295235
295439
|
return value;
|
|
295236
295440
|
}
|
|
@@ -295740,24 +295944,24 @@ function buildProbeScript(probeId, index, warnings) {
|
|
|
295740
295944
|
];
|
|
295741
295945
|
}
|
|
295742
295946
|
function isGraphQLHttpRequest(item) {
|
|
295743
|
-
const request =
|
|
295947
|
+
const request = asRecord13(item.request);
|
|
295744
295948
|
if (!request) return false;
|
|
295745
|
-
const body2 =
|
|
295949
|
+
const body2 = asRecord13(request.body);
|
|
295746
295950
|
return body2?.mode === "graphql";
|
|
295747
295951
|
}
|
|
295748
295952
|
function injectItem(item, index, covered, warnings) {
|
|
295749
295953
|
const children4 = asArray6(item.item);
|
|
295750
295954
|
if (children4.length > 0) {
|
|
295751
295955
|
for (const child4 of children4) {
|
|
295752
|
-
const childRecord =
|
|
295956
|
+
const childRecord = asRecord13(child4);
|
|
295753
295957
|
if (childRecord) injectItem(childRecord, index, covered, warnings);
|
|
295754
295958
|
}
|
|
295755
295959
|
return;
|
|
295756
295960
|
}
|
|
295757
295961
|
const itemId = String(item.id ?? "");
|
|
295758
|
-
if (itemId.startsWith("__gql_probe_") &&
|
|
295962
|
+
if (itemId.startsWith("__gql_probe_") && asRecord13(item.request)) {
|
|
295759
295963
|
const exec2 = buildProbeScript(itemId, index, warnings);
|
|
295760
|
-
const priorEvents = asArray6(item.event).filter((entry) =>
|
|
295964
|
+
const priorEvents = asArray6(item.event).filter((entry) => asRecord13(entry)?.listen !== "test");
|
|
295761
295965
|
item.event = [...priorEvents, { listen: "test", script: { type: "text/javascript", exec: exec2 } }];
|
|
295762
295966
|
return;
|
|
295763
295967
|
}
|
|
@@ -295773,7 +295977,7 @@ function injectItem(item, index, covered, warnings) {
|
|
|
295773
295977
|
" pm.expect.fail(contractMappingError);",
|
|
295774
295978
|
"});"
|
|
295775
295979
|
];
|
|
295776
|
-
const priorEvents = asArray6(item.event).filter((entry) =>
|
|
295980
|
+
const priorEvents = asArray6(item.event).filter((entry) => asRecord13(entry)?.listen !== "test");
|
|
295777
295981
|
item.event = [...priorEvents, { listen: "test", script: { type: "text/javascript", exec: failExec } }];
|
|
295778
295982
|
return;
|
|
295779
295983
|
}
|
|
@@ -295789,7 +295993,7 @@ function injectItem(item, index, covered, warnings) {
|
|
|
295789
295993
|
`GQL_SCRIPT_SIZE_EXCEEDED: generated test script for '${operation.id}' exceeded ${GRAPHQL_INSTRUMENT_LIMITS.maxTestScriptBytes} bytes`
|
|
295790
295994
|
);
|
|
295791
295995
|
}
|
|
295792
|
-
const events2 = asArray6(item.event).filter((entry) =>
|
|
295996
|
+
const events2 = asArray6(item.event).filter((entry) => asRecord13(entry)?.listen !== "test");
|
|
295793
295997
|
item.event = [
|
|
295794
295998
|
...events2,
|
|
295795
295999
|
{ listen: "test", script: { type: "text/javascript", exec: exec2 } }
|
|
@@ -295800,7 +296004,7 @@ function instrumentGraphQLCollection(collection, index) {
|
|
|
295800
296004
|
const warnings = [...index.warnings];
|
|
295801
296005
|
const covered = /* @__PURE__ */ new Set();
|
|
295802
296006
|
for (const child4 of asArray6(collection.item)) {
|
|
295803
|
-
const childRecord =
|
|
296007
|
+
const childRecord = asRecord13(child4);
|
|
295804
296008
|
if (childRecord) injectItem(childRecord, index, covered, warnings);
|
|
295805
296009
|
}
|
|
295806
296010
|
const missing = index.operations.filter((operation) => !covered.has(operation.id));
|
|
@@ -295814,7 +296018,7 @@ function instrumentGraphQLCollection(collection, index) {
|
|
|
295814
296018
|
|
|
295815
296019
|
// src/lib/protocols/grpc/proto-parser.ts
|
|
295816
296020
|
var protobufjs = __toESM(require_protobufjs(), 1);
|
|
295817
|
-
function
|
|
296021
|
+
function asRecord14(value) {
|
|
295818
296022
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
295819
296023
|
return value;
|
|
295820
296024
|
}
|
|
@@ -296114,7 +296318,7 @@ function upperCamelCase(name) {
|
|
|
296114
296318
|
function lintMessage(message, warnings, proto3) {
|
|
296115
296319
|
const fullName = stripLeadingDot(message.fullName);
|
|
296116
296320
|
const { ranges: reservedRanges } = lintReserved(message.reserved, `message ${fullName}`, { lo: 1, hi: FIELD_NUMBER_MAX, label: "field-number" }, warnings);
|
|
296117
|
-
lintOptionSet(
|
|
296321
|
+
lintOptionSet(asRecord14(message.options), "message", fullName, warnings);
|
|
296118
296322
|
const jsonNames = /* @__PURE__ */ new Map();
|
|
296119
296323
|
for (const field of asArray7(message.fieldsArray)) {
|
|
296120
296324
|
const id = field.id;
|
|
@@ -296135,7 +296339,7 @@ function lintMessage(message, warnings, proto3) {
|
|
|
296135
296339
|
}
|
|
296136
296340
|
jsonNames.set(jsonName, String(field.name));
|
|
296137
296341
|
}
|
|
296138
|
-
if (
|
|
296342
|
+
if (asRecord14(message.options)?.deprecated === true) {
|
|
296139
296343
|
warnings.push(`GRPC_DEPRECATED: message ${fullName} is marked deprecated`);
|
|
296140
296344
|
}
|
|
296141
296345
|
const nestedNames = new Set(asArray7(message.nestedArray).map((child4) => child4.name));
|
|
@@ -296164,13 +296368,13 @@ function lintMessage(message, warnings, proto3) {
|
|
|
296164
296368
|
for (const child4 of asArray7(message.nestedArray)) {
|
|
296165
296369
|
declare(child4.name, isEnum(child4) ? "nested enum" : "nested type");
|
|
296166
296370
|
if (isEnum(child4)) {
|
|
296167
|
-
for (const valueName of Object.keys(
|
|
296371
|
+
for (const valueName of Object.keys(asRecord14(child4.values) ?? {})) declare(valueName, `enum value of ${child4.name}`);
|
|
296168
296372
|
}
|
|
296169
296373
|
}
|
|
296170
296374
|
}
|
|
296171
296375
|
function lintEnum(enumObj, warnings, proto3, conventions) {
|
|
296172
296376
|
const fullName = stripLeadingDot(enumObj.fullName);
|
|
296173
|
-
const entries = Object.entries(
|
|
296377
|
+
const entries = Object.entries(asRecord14(enumObj.values) ?? {});
|
|
296174
296378
|
const { ranges: reservedRanges, names: reservedNames } = lintReserved(
|
|
296175
296379
|
enumObj.reserved,
|
|
296176
296380
|
`enum ${fullName}`,
|
|
@@ -296198,7 +296402,7 @@ function lintEnum(enumObj, warnings, proto3, conventions) {
|
|
|
296198
296402
|
warnings.push(`GRPC_ENUM_ZERO_NAME_CONVENTION: enum ${fullName} zero value ${zero[0]} is conventionally named *_UNSPECIFIED (buf/AIP enum conventions)`);
|
|
296199
296403
|
}
|
|
296200
296404
|
}
|
|
296201
|
-
if (
|
|
296405
|
+
if (asRecord14(enumObj.options)?.deprecated === true) {
|
|
296202
296406
|
warnings.push(`GRPC_DEPRECATED: enum ${fullName} is marked deprecated`);
|
|
296203
296407
|
}
|
|
296204
296408
|
}
|
|
@@ -296283,7 +296487,7 @@ function lintHttpRule(rule, requestFields, responseFieldNames, warnings, operati
|
|
|
296283
296487
|
for (const verb of HTTP_RULE_VERBS) {
|
|
296284
296488
|
if (typeof rule[verb] === "string") patterns.push({ verb, path: rule[verb] });
|
|
296285
296489
|
}
|
|
296286
|
-
const custom =
|
|
296490
|
+
const custom = asRecord14(rule.custom);
|
|
296287
296491
|
if (custom && typeof custom.path === "string") patterns.push({ verb: String(custom.kind ?? "custom"), path: custom.path });
|
|
296288
296492
|
if (patterns.length === 0) {
|
|
296289
296493
|
warnings.push(`GRPC_HTTP_RULE_PATTERN_MISSING: ${operationId} google.api.http ${nested ? "additional binding" : "rule"} declares no URL pattern (get/put/post/delete/patch/custom); transcoding requires exactly one (google.api.http pattern oneof)`);
|
|
@@ -296345,7 +296549,7 @@ function lintHttpRule(rule, requestFields, responseFieldNames, warnings, operati
|
|
|
296345
296549
|
return;
|
|
296346
296550
|
}
|
|
296347
296551
|
for (const binding of bindingList) {
|
|
296348
|
-
const record =
|
|
296552
|
+
const record = asRecord14(binding);
|
|
296349
296553
|
if (record) lintHttpRule(record, requestFields, responseFieldNames, warnings, operationId, true);
|
|
296350
296554
|
}
|
|
296351
296555
|
}
|
|
@@ -296373,10 +296577,10 @@ function lintMethodOptions(method, operationId, warnings) {
|
|
|
296373
296577
|
const requestFields = httpFieldInfo(method.resolvedRequestType);
|
|
296374
296578
|
const responseFieldNames = method.resolvedResponseType ? new Set(asArray7(method.resolvedResponseType.fieldsArray).map((field) => String(field.name))) : null;
|
|
296375
296579
|
for (const entry of asArray7(method.parsedOptions)) {
|
|
296376
|
-
const http2 =
|
|
296580
|
+
const http2 = asRecord14(asRecord14(entry)?.["(google.api.http)"]);
|
|
296377
296581
|
if (http2) lintHttpRule(http2, requestFields, responseFieldNames, warnings, operationId, false);
|
|
296378
296582
|
}
|
|
296379
|
-
if (
|
|
296583
|
+
if (asRecord14(method.options)?.deprecated === true) {
|
|
296380
296584
|
warnings.push(`GRPC_DEPRECATED: rpc ${operationId} is marked deprecated`);
|
|
296381
296585
|
}
|
|
296382
296586
|
}
|
|
@@ -296481,7 +296685,7 @@ function parseProtoSchema(content, deps) {
|
|
|
296481
296685
|
}
|
|
296482
296686
|
const enumIndex = {};
|
|
296483
296687
|
for (const enumObj of enums) {
|
|
296484
|
-
const values = Object.keys(
|
|
296688
|
+
const values = Object.keys(asRecord14(enumObj.values) ?? {}).sort();
|
|
296485
296689
|
enumIndex[stripLeadingDot(enumObj.fullName)] = values;
|
|
296486
296690
|
lintEnum(enumObj, warnings, proto3, conventions);
|
|
296487
296691
|
}
|
|
@@ -296610,7 +296814,7 @@ var GRPC_INSTRUMENT_LIMITS = {
|
|
|
296610
296814
|
maxTestScriptBytes: 9e5,
|
|
296611
296815
|
maxCollectionUpdateBytes: 4e6
|
|
296612
296816
|
};
|
|
296613
|
-
function
|
|
296817
|
+
function asRecord15(value) {
|
|
296614
296818
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
296615
296819
|
return value;
|
|
296616
296820
|
}
|
|
@@ -297207,7 +297411,7 @@ function createMappingFailureScript2(message) {
|
|
|
297207
297411
|
];
|
|
297208
297412
|
}
|
|
297209
297413
|
function methodPathOf(item) {
|
|
297210
|
-
const payload =
|
|
297414
|
+
const payload = asRecord15(item.payload);
|
|
297211
297415
|
const value = payload?.methodPath;
|
|
297212
297416
|
return typeof value === "string" ? value : "";
|
|
297213
297417
|
}
|
|
@@ -297422,7 +297626,7 @@ function matchesFormatValue(format3, value) {
|
|
|
297422
297626
|
}
|
|
297423
297627
|
function staticRequestCheck(item, shape, methodPath2, warnings) {
|
|
297424
297628
|
if (!shape) return;
|
|
297425
|
-
const message =
|
|
297629
|
+
const message = asRecord15(asRecord15(item.payload)?.message);
|
|
297426
297630
|
const raw = typeof message?.content === "string" ? message.content : "";
|
|
297427
297631
|
if (!raw.trim()) return;
|
|
297428
297632
|
if (/\{\{[^}]+\}\}|<[a-zA-Z]/.test(raw)) return;
|
|
@@ -297433,7 +297637,7 @@ function staticRequestCheck(item, shape, methodPath2, warnings) {
|
|
|
297433
297637
|
warnings.push(`PROTO_REQUEST_BODY_INVALID_JSON: ${methodPath2} generated request message content is not valid JSON and is not validated`);
|
|
297434
297638
|
return;
|
|
297435
297639
|
}
|
|
297436
|
-
const record =
|
|
297640
|
+
const record = asRecord15(body2);
|
|
297437
297641
|
if (!record) return;
|
|
297438
297642
|
for (const field of shape.fields) {
|
|
297439
297643
|
const key = Object.prototype.hasOwnProperty.call(record, field.jsonName) ? field.jsonName : Object.prototype.hasOwnProperty.call(record, field.name) ? field.name : void 0;
|
|
@@ -297493,16 +297697,16 @@ function instrumentGrpcCollection(collection, index) {
|
|
|
297493
297697
|
if (scriptBytes > GRPC_INSTRUMENT_LIMITS.maxTestScriptBytes) {
|
|
297494
297698
|
throw new Error(`PROTO_SCRIPT_SIZE_EXCEEDED: generated test script for ${methodPath2} exceeded ${GRPC_INSTRUMENT_LIMITS.maxTestScriptBytes} bytes`);
|
|
297495
297699
|
}
|
|
297496
|
-
const events2 = asArray8(item.event).filter((entry) =>
|
|
297700
|
+
const events2 = asArray8(item.event).filter((entry) => asRecord15(entry)?.listen !== "test");
|
|
297497
297701
|
item.event = [...events2, { listen: "test", script: { type: "text/javascript", exec: script } }];
|
|
297498
297702
|
}
|
|
297499
297703
|
for (const child4 of asArray8(item.item)) {
|
|
297500
|
-
const childRecord =
|
|
297704
|
+
const childRecord = asRecord15(child4);
|
|
297501
297705
|
if (childRecord) inject(childRecord);
|
|
297502
297706
|
}
|
|
297503
297707
|
};
|
|
297504
297708
|
for (const entry of asArray8(collection.item)) {
|
|
297505
|
-
const item =
|
|
297709
|
+
const item = asRecord15(entry);
|
|
297506
297710
|
if (item) inject(item);
|
|
297507
297711
|
}
|
|
297508
297712
|
const missing = index.operations.filter((operation) => !covered.has(operation.methodPath));
|
|
@@ -297517,7 +297721,7 @@ function instrumentGrpcCollection(collection, index) {
|
|
|
297517
297721
|
}
|
|
297518
297722
|
|
|
297519
297723
|
// src/lib/protocols/grpc/service-config.ts
|
|
297520
|
-
function
|
|
297724
|
+
function asRecord16(value) {
|
|
297521
297725
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
297522
297726
|
return value;
|
|
297523
297727
|
}
|
|
@@ -297676,7 +297880,7 @@ function lintLoadBalancingEntries(entries, label, warnings, depth) {
|
|
|
297676
297880
|
return;
|
|
297677
297881
|
}
|
|
297678
297882
|
for (const entry of entries) {
|
|
297679
|
-
const record =
|
|
297883
|
+
const record = asRecord16(entry);
|
|
297680
297884
|
const keys = record ? Object.keys(record) : [];
|
|
297681
297885
|
if (!record || keys.length !== 1) {
|
|
297682
297886
|
warnings.push(`GRPC_SERVICE_CONFIG_LB_INVALID: each ${label} entry must be an object with exactly one policy key (service_config.proto)`);
|
|
@@ -297687,7 +297891,7 @@ function lintLoadBalancingEntries(entries, label, warnings, depth) {
|
|
|
297687
297891
|
warnings.push(`GRPC_SERVICE_CONFIG_LB_POLICY_UNKNOWN: ${label} policy "${policy}" is not a registered gRPC LB policy; clients skip unknown policies (service_config.proto)`);
|
|
297688
297892
|
continue;
|
|
297689
297893
|
}
|
|
297690
|
-
const config =
|
|
297894
|
+
const config = asRecord16(record[policy]);
|
|
297691
297895
|
if (!config) {
|
|
297692
297896
|
warnings.push(`GRPC_SERVICE_CONFIG_LB_INVALID: ${label} policy "${policy}" config must be a JSON object (service_config.proto)`);
|
|
297693
297897
|
continue;
|
|
@@ -297812,7 +298016,7 @@ function lintGoogleApiServiceConfig(config, index, warnings) {
|
|
|
297812
298016
|
const declaredServices = new Set(index.operations.map((operation) => operation.serviceFullName));
|
|
297813
298017
|
const seenApis = /* @__PURE__ */ new Set();
|
|
297814
298018
|
asArray9(config.apis).forEach((entry, i) => {
|
|
297815
|
-
const record =
|
|
298019
|
+
const record = asRecord16(entry);
|
|
297816
298020
|
const name = record && typeof record.name === "string" ? record.name : null;
|
|
297817
298021
|
if (!name) {
|
|
297818
298022
|
warnings.push(`GRPC_GOOGLE_API_CONFIG_INVALID: apis[${i}] must be an object with a string name (google.api.Service)`);
|
|
@@ -297829,7 +298033,7 @@ function lintGoogleApiServiceConfig(config, index, warnings) {
|
|
|
297829
298033
|
const lintTypeList = (listKey, resolves, kind) => {
|
|
297830
298034
|
const seen = /* @__PURE__ */ new Set();
|
|
297831
298035
|
asArray9(config[listKey]).forEach((entry, i) => {
|
|
297832
|
-
const record =
|
|
298036
|
+
const record = asRecord16(entry);
|
|
297833
298037
|
const name = record && typeof record.name === "string" ? record.name : null;
|
|
297834
298038
|
if (!name) {
|
|
297835
298039
|
warnings.push(`GRPC_GOOGLE_API_CONFIG_INVALID: ${listKey}[${i}] must be an object with a string name (google.api.Service)`);
|
|
@@ -297857,7 +298061,7 @@ function lintGoogleApiServiceConfig(config, index, warnings) {
|
|
|
297857
298061
|
};
|
|
297858
298062
|
lintTypeList("types", (name) => index.messages[name] !== void 0, "message");
|
|
297859
298063
|
lintTypeList("enums", (name) => index.enums[name] !== void 0, "enum");
|
|
297860
|
-
const declaredDetails = asArray9(config.types).map((entry) =>
|
|
298064
|
+
const declaredDetails = asArray9(config.types).map((entry) => asRecord16(entry)?.name).filter((name) => typeof name === "string" && GOOGLE_RPC_ERROR_DETAIL_TYPES.has(name));
|
|
297861
298065
|
if (declaredDetails.length > 0 && !declaredDetails.includes("google.rpc.ErrorInfo")) {
|
|
297862
298066
|
warnings.push("GRPC_GOOGLE_API_CONFIG_ERRORINFO_MISSING: types[] declares google.rpc error-detail payloads but omits google.rpc.ErrorInfo; AIP-193 requires ErrorInfo in service errors");
|
|
297863
298067
|
}
|
|
@@ -297885,7 +298089,7 @@ function lintServiceConfigObject(config, index, warnings) {
|
|
|
297885
298089
|
warnings.push("GRPC_SERVICE_CONFIG_LB_RUNTIME_UNSUPPORTED: the generated Postman grpc-request items expose no load-balancing settings, so LB policy selection is not applied when the collection runs in Postman");
|
|
297886
298090
|
}
|
|
297887
298091
|
if (config.healthCheckConfig !== void 0) {
|
|
297888
|
-
const health =
|
|
298092
|
+
const health = asRecord16(config.healthCheckConfig);
|
|
297889
298093
|
if (!health) {
|
|
297890
298094
|
warnings.push("GRPC_SERVICE_CONFIG_INVALID: healthCheckConfig must be an object (service_config.proto)");
|
|
297891
298095
|
} else {
|
|
@@ -297899,7 +298103,7 @@ function lintServiceConfigObject(config, index, warnings) {
|
|
|
297899
298103
|
}
|
|
297900
298104
|
}
|
|
297901
298105
|
}
|
|
297902
|
-
const throttling =
|
|
298106
|
+
const throttling = asRecord16(config.retryThrottling);
|
|
297903
298107
|
if (config.retryThrottling !== void 0) {
|
|
297904
298108
|
const maxTokens = throttling?.maxTokens;
|
|
297905
298109
|
const tokenRatio = throttling?.tokenRatio;
|
|
@@ -297936,7 +298140,7 @@ function lintServiceConfigObject(config, index, warnings) {
|
|
|
297936
298140
|
const where = `methodConfig[${i}]`;
|
|
297937
298141
|
const meta = { targets: /* @__PURE__ */ new Set(), unresolved: false, retry: false, hedge: false, selectorCount: 0 };
|
|
297938
298142
|
entryMeta.push(meta);
|
|
297939
|
-
const methodConfig =
|
|
298143
|
+
const methodConfig = asRecord16(entry);
|
|
297940
298144
|
if (!methodConfig) {
|
|
297941
298145
|
warnings.push(`GRPC_SERVICE_CONFIG_INVALID: ${where} must be an object (service_config.proto)`);
|
|
297942
298146
|
return;
|
|
@@ -297954,7 +298158,7 @@ function lintServiceConfigObject(config, index, warnings) {
|
|
|
297954
298158
|
warnings.push(`GRPC_SERVICE_CONFIG_NAME_INVALID: ${where}.name must be a non-empty list of {service, method} selectors (service_config.proto)`);
|
|
297955
298159
|
} else {
|
|
297956
298160
|
names.forEach((nameEntry, j) => {
|
|
297957
|
-
const selector =
|
|
298161
|
+
const selector = asRecord16(nameEntry);
|
|
297958
298162
|
if (!selector) {
|
|
297959
298163
|
warnings.push(`GRPC_SERVICE_CONFIG_NAME_INVALID: ${where}.name[${j}] must be an object (service_config.proto)`);
|
|
297960
298164
|
return;
|
|
@@ -297997,8 +298201,8 @@ function lintServiceConfigObject(config, index, warnings) {
|
|
|
297997
298201
|
warnings.push(`GRPC_SERVICE_CONFIG_INVALID: ${where}.${key} must be a non-negative integer within uint32 range [0, ${UINT32_MAX}] (service_config.proto google.protobuf.UInt32Value); got ${JSON.stringify(methodConfig[key])}`);
|
|
297998
298202
|
}
|
|
297999
298203
|
}
|
|
298000
|
-
const retryPolicy =
|
|
298001
|
-
const hedgingPolicy =
|
|
298204
|
+
const retryPolicy = asRecord16(methodConfig.retryPolicy);
|
|
298205
|
+
const hedgingPolicy = asRecord16(methodConfig.hedgingPolicy);
|
|
298002
298206
|
meta.retry = methodConfig.retryPolicy !== void 0;
|
|
298003
298207
|
meta.hedge = methodConfig.hedgingPolicy !== void 0;
|
|
298004
298208
|
if (methodConfig.retryPolicy !== void 0 && methodConfig.hedgingPolicy !== void 0) {
|
|
@@ -298066,7 +298270,7 @@ ${warnings.join("\n")}`);
|
|
|
298066
298270
|
if (Array.isArray(parsed)) {
|
|
298067
298271
|
parsed.forEach((entry, i) => {
|
|
298068
298272
|
const where = `grpc_config[${i}]`;
|
|
298069
|
-
const choice =
|
|
298273
|
+
const choice = asRecord16(entry);
|
|
298070
298274
|
if (!choice) {
|
|
298071
298275
|
warnings.push(`GRPC_SERVICE_CONFIG_CHOICE_INVALID: ${where} must be an object (gRFC A2 choice list)`);
|
|
298072
298276
|
return;
|
|
@@ -298085,7 +298289,7 @@ ${warnings.join("\n")}`);
|
|
|
298085
298289
|
if (choice.percentage !== void 0 && !(typeof choice.percentage === "number" && choice.percentage >= 0 && choice.percentage <= 100)) {
|
|
298086
298290
|
warnings.push(`GRPC_SERVICE_CONFIG_CHOICE_INVALID: ${where}.percentage must be a number in [0, 100] (gRFC A2)`);
|
|
298087
298291
|
}
|
|
298088
|
-
const embedded =
|
|
298292
|
+
const embedded = asRecord16(choice.serviceConfig);
|
|
298089
298293
|
if (!embedded) {
|
|
298090
298294
|
warnings.push(`GRPC_SERVICE_CONFIG_CHOICE_INVALID: ${where}.serviceConfig must be a JSON object (gRFC A2)`);
|
|
298091
298295
|
return;
|
|
@@ -298094,7 +298298,7 @@ ${warnings.join("\n")}`);
|
|
|
298094
298298
|
});
|
|
298095
298299
|
return finish();
|
|
298096
298300
|
}
|
|
298097
|
-
const config =
|
|
298301
|
+
const config = asRecord16(parsed);
|
|
298098
298302
|
if (!config) {
|
|
298099
298303
|
warnings.push("GRPC_SERVICE_CONFIG_INVALID: service config must be a JSON object (service_config.proto)");
|
|
298100
298304
|
return finish();
|
|
@@ -304352,7 +304556,7 @@ function lintWsdl20Services(services, interfaces, bindings, warnings) {
|
|
|
304352
304556
|
|
|
304353
304557
|
// src/lib/protocols/soap/xsd-index.ts
|
|
304354
304558
|
var XSD_NS = "http://www.w3.org/2001/XMLSchema";
|
|
304355
|
-
function
|
|
304559
|
+
function asRecord17(value) {
|
|
304356
304560
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
304357
304561
|
return value;
|
|
304358
304562
|
}
|
|
@@ -304388,7 +304592,7 @@ function children2(record, local2) {
|
|
|
304388
304592
|
if (key.startsWith("@_") || key === "#text") continue;
|
|
304389
304593
|
if (localName(key) !== local2) continue;
|
|
304390
304594
|
for (const entry of asArray10(record[key])) {
|
|
304391
|
-
const rec =
|
|
304595
|
+
const rec = asRecord17(entry);
|
|
304392
304596
|
if (rec) out.push(rec);
|
|
304393
304597
|
}
|
|
304394
304598
|
}
|
|
@@ -304424,7 +304628,7 @@ function parseOccursMax(raw) {
|
|
|
304424
304628
|
return Number.isNaN(value) ? 1 : value;
|
|
304425
304629
|
}
|
|
304426
304630
|
function simpleTypeFacets(simpleType, scopes) {
|
|
304427
|
-
const restriction =
|
|
304631
|
+
const restriction = asRecord17(child2(simpleType, "restriction"));
|
|
304428
304632
|
if (!restriction) return {};
|
|
304429
304633
|
const baseQName = attr2(restriction, "base");
|
|
304430
304634
|
const baseNs = baseQName ? namespaceForPrefix([...scopes, restriction], prefixOf(baseQName)) : "";
|
|
@@ -304451,7 +304655,7 @@ function sequenceChildren(complexType, scopes, tns, simpleTypes) {
|
|
|
304451
304655
|
if (!complexType) return void 0;
|
|
304452
304656
|
if (child2(complexType, "complexContent") !== void 0 || child2(complexType, "simpleContent") !== void 0) return void 0;
|
|
304453
304657
|
if (child2(complexType, "choice") !== void 0 || child2(complexType, "all") !== void 0 || child2(complexType, "group") !== void 0) return void 0;
|
|
304454
|
-
const sequence =
|
|
304658
|
+
const sequence = asRecord17(child2(complexType, "sequence"));
|
|
304455
304659
|
if (!sequence) return [];
|
|
304456
304660
|
if (child2(sequence, "choice") !== void 0 || child2(sequence, "sequence") !== void 0 || child2(sequence, "any") !== void 0 || child2(sequence, "group") !== void 0) return void 0;
|
|
304457
304661
|
const out = [];
|
|
@@ -304470,7 +304674,7 @@ function sequenceChildren(complexType, scopes, tns, simpleTypes) {
|
|
|
304470
304674
|
enumeration = sameSchema.enums;
|
|
304471
304675
|
}
|
|
304472
304676
|
}
|
|
304473
|
-
const inlineSimple =
|
|
304677
|
+
const inlineSimple = asRecord17(child2(el, "simpleType"));
|
|
304474
304678
|
if (inlineSimple) {
|
|
304475
304679
|
const facets = simpleTypeFacets(inlineSimple, [...scopes, el]);
|
|
304476
304680
|
builtinType = facets.base ?? builtinType;
|
|
@@ -304515,7 +304719,7 @@ function buildXsdIndex(docNode) {
|
|
|
304515
304719
|
for (const el of children2(schema, "element")) {
|
|
304516
304720
|
const name = attr2(el, "name");
|
|
304517
304721
|
if (!name) continue;
|
|
304518
|
-
const inline =
|
|
304722
|
+
const inline = asRecord17(child2(el, "complexType"));
|
|
304519
304723
|
const typeQName = attr2(el, "type");
|
|
304520
304724
|
const named = typeQName && namespaceForPrefix([...scopes, el], prefixOf(typeQName)) !== XSD_NS ? complexTypes.get(localName(typeQName)) ?? null : null;
|
|
304521
304725
|
index.elements.set(tns + "|" + name, {
|
|
@@ -304542,7 +304746,7 @@ function lookupXsdElement(index, namespace, name) {
|
|
|
304542
304746
|
}
|
|
304543
304747
|
|
|
304544
304748
|
// src/lib/protocols/soap/parser.ts
|
|
304545
|
-
function
|
|
304749
|
+
function asRecord18(value) {
|
|
304546
304750
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
304547
304751
|
return value;
|
|
304548
304752
|
}
|
|
@@ -304589,7 +304793,7 @@ function children3(record, local2) {
|
|
|
304589
304793
|
if (key.startsWith("@_") || key === "#text") continue;
|
|
304590
304794
|
if (localName2(key) !== local2) continue;
|
|
304591
304795
|
for (const entry of asArray11(record[key])) {
|
|
304592
|
-
const rec =
|
|
304796
|
+
const rec = asRecord18(entry);
|
|
304593
304797
|
if (rec) out.push(rec);
|
|
304594
304798
|
}
|
|
304595
304799
|
}
|
|
@@ -304693,7 +304897,7 @@ function parseSoapBindings11(definitions, messages, warnings) {
|
|
|
304693
304897
|
else if (ns === SOAP11_BINDING_NS) soapVersion = "1.1";
|
|
304694
304898
|
else continue;
|
|
304695
304899
|
for (const marker of asArray11(binding[key])) {
|
|
304696
|
-
const style = attr3(
|
|
304900
|
+
const style = attr3(asRecord18(marker), "style");
|
|
304697
304901
|
if (style) bindingStyle = style;
|
|
304698
304902
|
}
|
|
304699
304903
|
}
|
|
@@ -304706,7 +304910,7 @@ function parseSoapBindings11(definitions, messages, warnings) {
|
|
|
304706
304910
|
for (const key of Object.keys(operation)) {
|
|
304707
304911
|
if (localName2(key) !== "operation") continue;
|
|
304708
304912
|
for (const marker of asArray11(operation[key])) {
|
|
304709
|
-
const rec =
|
|
304913
|
+
const rec = asRecord18(marker);
|
|
304710
304914
|
const action = attr3(rec, "soapAction");
|
|
304711
304915
|
if (action) soapAction = action;
|
|
304712
304916
|
const style2 = attr3(rec, "style");
|
|
@@ -304719,8 +304923,8 @@ function parseSoapBindings11(definitions, messages, warnings) {
|
|
|
304719
304923
|
warnings.push(`SOAP_BINDING_STYLE_UNPARSEABLE: binding ${bindingName} operation ${opName} declares style "${styleRaw}" (expected document|rpc); style-specific assertions are skipped`);
|
|
304720
304924
|
style = void 0;
|
|
304721
304925
|
}
|
|
304722
|
-
const inputDirection =
|
|
304723
|
-
const outputDirection =
|
|
304926
|
+
const inputDirection = asRecord18(child3(operation, "input"));
|
|
304927
|
+
const outputDirection = asRecord18(child3(operation, "output"));
|
|
304724
304928
|
const inputBody = bodyMarker(inputDirection);
|
|
304725
304929
|
const outputBody = bodyMarker(outputDirection);
|
|
304726
304930
|
const useRaw = attr3(outputBody, "use") || attr3(inputBody, "use");
|
|
@@ -304800,8 +305004,8 @@ function parseServices11(definitions, messages, bindings, warnings) {
|
|
|
304800
305004
|
return children3(portType, "operation").map((operation) => {
|
|
304801
305005
|
const name = attr3(operation, "name");
|
|
304802
305006
|
const opWarnings = [];
|
|
304803
|
-
const inputRecord =
|
|
304804
|
-
const outputRecord =
|
|
305007
|
+
const inputRecord = asRecord18(child3(operation, "input"));
|
|
305008
|
+
const outputRecord = asRecord18(child3(operation, "output"));
|
|
304805
305009
|
const inputRef = localName2(attr3(inputRecord, "message"));
|
|
304806
305010
|
const outputRef = localName2(attr3(outputRecord, "message"));
|
|
304807
305011
|
const input = inputRef ? messages.get(inputRef) : void 0;
|
|
@@ -304855,7 +305059,7 @@ function parseServices11(definitions, messages, bindings, warnings) {
|
|
|
304855
305059
|
const seenPortTypes = /* @__PURE__ */ new Set();
|
|
304856
305060
|
for (const port of ports) {
|
|
304857
305061
|
const bindingName = localName2(attr3(port, "binding"));
|
|
304858
|
-
const address =
|
|
305062
|
+
const address = asRecord18(child3(port, "address"));
|
|
304859
305063
|
const location2 = attr3(address, "location");
|
|
304860
305064
|
if (location2 && !endpoint) endpoint = location2;
|
|
304861
305065
|
const portTypeName = bindingToPortType.get(bindingName);
|
|
@@ -304944,8 +305148,8 @@ function parseServices20(description, warnings) {
|
|
|
304944
305148
|
const buildOperations = (iface, binding) => children3(iface, "operation").map((operation) => {
|
|
304945
305149
|
const name = attr3(operation, "name");
|
|
304946
305150
|
const opWarnings = [];
|
|
304947
|
-
const inputRecord =
|
|
304948
|
-
const outputRecord =
|
|
305151
|
+
const inputRecord = asRecord18(child3(operation, "input"));
|
|
305152
|
+
const outputRecord = asRecord18(child3(operation, "output"));
|
|
304949
305153
|
const inputElement = attr3(inputRecord, "element");
|
|
304950
305154
|
const outputElement = attr3(outputRecord, "element");
|
|
304951
305155
|
const outLocal = outputElement.startsWith("#") ? "" : localName2(outputElement);
|
|
@@ -304993,9 +305197,9 @@ function parseServices20(description, warnings) {
|
|
|
304993
305197
|
for (const ep of children3(service, "endpoint")) {
|
|
304994
305198
|
let address = attr3(ep, "address");
|
|
304995
305199
|
if (!address) {
|
|
304996
|
-
const epr =
|
|
305200
|
+
const epr = asRecord18(child3(ep, "EndpointReference"));
|
|
304997
305201
|
const addressNode = child3(epr, "Address");
|
|
304998
|
-
const addressRecord =
|
|
305202
|
+
const addressRecord = asRecord18(addressNode);
|
|
304999
305203
|
address = addressRecord ? asString2(addressRecord["#text"]) : asString2(addressNode);
|
|
305000
305204
|
if (address) warnings.push(`SOAP_WSDL20_ENDPOINT_EPR: endpoint ${attr3(ep, "name")} address taken from its child wsa:EndpointReference/Address; reference parameters are not propagated`);
|
|
305001
305205
|
}
|
|
@@ -305016,7 +305220,7 @@ function parseServices20(description, warnings) {
|
|
|
305016
305220
|
return services;
|
|
305017
305221
|
}
|
|
305018
305222
|
function detectAddressing(node) {
|
|
305019
|
-
const record =
|
|
305223
|
+
const record = asRecord18(node);
|
|
305020
305224
|
if (!record) return false;
|
|
305021
305225
|
for (const key of Object.keys(record)) {
|
|
305022
305226
|
if (key.startsWith("@_") || key === "#text") continue;
|
|
@@ -305083,7 +305287,7 @@ function lintWsdl112(definitions, messages, warnings) {
|
|
|
305083
305287
|
const ns = namespaceForPrefix2([definitions, binding], prefixOf2(key));
|
|
305084
305288
|
if (ns !== SOAP11_BINDING_NS && ns !== SOAP12_BINDING_NS) continue;
|
|
305085
305289
|
for (const entry of asArray11(binding[key])) {
|
|
305086
|
-
const marker =
|
|
305290
|
+
const marker = asRecord18(entry);
|
|
305087
305291
|
if (!marker) continue;
|
|
305088
305292
|
const style = attr3(marker, "style");
|
|
305089
305293
|
if (style) bindingStyle = style;
|
|
@@ -305111,14 +305315,14 @@ function lintWsdl112(definitions, messages, warnings) {
|
|
|
305111
305315
|
for (const key of Object.keys(operation)) {
|
|
305112
305316
|
if (localName2(key) !== "operation") continue;
|
|
305113
305317
|
for (const entry of asArray11(operation[key])) {
|
|
305114
|
-
const style = attr3(
|
|
305318
|
+
const style = attr3(asRecord18(entry), "style");
|
|
305115
305319
|
if (style) styleRaw = style;
|
|
305116
305320
|
}
|
|
305117
305321
|
}
|
|
305118
305322
|
const effStyle = styleRaw === "rpc" ? "rpc" : "document";
|
|
305119
305323
|
styles.add(effStyle);
|
|
305120
|
-
const inputDirection =
|
|
305121
|
-
const outputDirection =
|
|
305324
|
+
const inputDirection = asRecord18(child3(operation, "input"));
|
|
305325
|
+
const outputDirection = asRecord18(child3(operation, "output"));
|
|
305122
305326
|
const inputBody = bodyMarker(inputDirection);
|
|
305123
305327
|
const outputBody = bodyMarker(outputDirection);
|
|
305124
305328
|
for (const [direction, body2] of [["input", inputBody], ["output", outputBody]]) {
|
|
@@ -305143,8 +305347,8 @@ function lintWsdl112(definitions, messages, warnings) {
|
|
|
305143
305347
|
}
|
|
305144
305348
|
}
|
|
305145
305349
|
const portTypeOp = portTypeOps.get(opName);
|
|
305146
|
-
const inputMessage = portTypeOp ? messages.get(localName2(attr3(
|
|
305147
|
-
const outputMessage = portTypeOp ? messages.get(localName2(attr3(
|
|
305350
|
+
const inputMessage = portTypeOp ? messages.get(localName2(attr3(asRecord18(child3(portTypeOp, "input")), "message"))) : void 0;
|
|
305351
|
+
const outputMessage = portTypeOp ? messages.get(localName2(attr3(asRecord18(child3(portTypeOp, "output")), "message"))) : void 0;
|
|
305148
305352
|
if (portTypeOp) {
|
|
305149
305353
|
const bindingHasOutput = child3(operation, "output") !== void 0;
|
|
305150
305354
|
const portTypeHasOutput = child3(portTypeOp, "output") !== void 0;
|
|
@@ -305204,7 +305408,7 @@ function lintWsdl112(definitions, messages, warnings) {
|
|
|
305204
305408
|
for (const service of children3(definitions, "service")) {
|
|
305205
305409
|
for (const port of children3(service, "port")) {
|
|
305206
305410
|
const portName = attr3(port, "name");
|
|
305207
|
-
const location2 = attr3(
|
|
305411
|
+
const location2 = attr3(asRecord18(child3(port, "address")), "location");
|
|
305208
305412
|
if (!location2) continue;
|
|
305209
305413
|
if (!/^https?:\/\//i.test(location2)) warnings.push(`SOAP_LINT_ADDRESS_NOT_HTTP: port ${portName} soap:address location "${location2}" is not an http(s) URL`);
|
|
305210
305414
|
const prior = addressLocations.get(location2);
|
|
@@ -305223,13 +305427,13 @@ function parseWsdl(content, opts) {
|
|
|
305223
305427
|
const parser = createParser();
|
|
305224
305428
|
let root;
|
|
305225
305429
|
try {
|
|
305226
|
-
root =
|
|
305430
|
+
root = asRecord18(parser.parse(text));
|
|
305227
305431
|
} catch (error2) {
|
|
305228
305432
|
throw new Error(`SOAP_WSDL_PARSE_ERROR: ${error2.message}`, { cause: error2 });
|
|
305229
305433
|
}
|
|
305230
305434
|
if (!root) throw new Error("SOAP_WSDL_PARSE_ERROR: document did not parse to an element");
|
|
305231
|
-
const definitions =
|
|
305232
|
-
const description =
|
|
305435
|
+
const definitions = asRecord18(child3(root, "definitions"));
|
|
305436
|
+
const description = asRecord18(child3(root, "description"));
|
|
305233
305437
|
if (!definitions && !description) {
|
|
305234
305438
|
throw new Error("SOAP_WSDL_ROOT_INVALID: expected a WSDL <definitions> (1.1) or <description> (2.0) root element");
|
|
305235
305439
|
}
|
|
@@ -305689,7 +305893,7 @@ function xsdPayloadLines(operation, index) {
|
|
|
305689
305893
|
}
|
|
305690
305894
|
|
|
305691
305895
|
// src/lib/protocols/soap/instrumenter.ts
|
|
305692
|
-
function
|
|
305896
|
+
function asRecord19(value) {
|
|
305693
305897
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
305694
305898
|
return value;
|
|
305695
305899
|
}
|
|
@@ -306371,12 +306575,12 @@ function forEachHttpRequest(node, visit4) {
|
|
|
306371
306575
|
const children4 = asArray12(node.item);
|
|
306372
306576
|
if (children4.length > 0) {
|
|
306373
306577
|
for (const child4 of children4) {
|
|
306374
|
-
const record =
|
|
306578
|
+
const record = asRecord19(child4);
|
|
306375
306579
|
if (record) forEachHttpRequest(record, visit4);
|
|
306376
306580
|
}
|
|
306377
306581
|
return;
|
|
306378
306582
|
}
|
|
306379
|
-
if (
|
|
306583
|
+
if (asRecord19(node.request)) visit4(node);
|
|
306380
306584
|
}
|
|
306381
306585
|
function instrumentSoapCollection(collection, index) {
|
|
306382
306586
|
const warnings = [...index.warnings];
|
|
@@ -306401,7 +306605,7 @@ function instrumentSoapCollection(collection, index) {
|
|
|
306401
306605
|
' pm.expect(code, "unsupported media types map to HTTP 415 (SOAP 1.2 Part 2 section 7)").to.eql(415);',
|
|
306402
306606
|
"});"
|
|
306403
306607
|
];
|
|
306404
|
-
const existingEvents = asArray12(item.event).map((entry) =>
|
|
306608
|
+
const existingEvents = asArray12(item.event).map((entry) => asRecord19(entry)).filter((entry) => Boolean(entry) && entry.listen !== "test");
|
|
306405
306609
|
item.event = [...existingEvents, { listen: "test", script: { type: "text/javascript", exec: probeExec } }];
|
|
306406
306610
|
return;
|
|
306407
306611
|
}
|
|
@@ -306415,13 +306619,13 @@ function instrumentSoapCollection(collection, index) {
|
|
|
306415
306619
|
" pm.expect.fail(contractMappingError);",
|
|
306416
306620
|
"});"
|
|
306417
306621
|
];
|
|
306418
|
-
const existing2 = asArray12(item.event).map((entry) =>
|
|
306622
|
+
const existing2 = asArray12(item.event).map((entry) => asRecord19(entry)).filter((entry) => Boolean(entry) && entry.listen !== "test");
|
|
306419
306623
|
item.event = [...existing2, { listen: "test", script: { type: "text/javascript", exec: failExec } }];
|
|
306420
306624
|
return;
|
|
306421
306625
|
}
|
|
306422
306626
|
covered.add(operation.name);
|
|
306423
306627
|
const exec2 = createSoapScript(operation, warnings, { declaresAddressing: index.declaresAddressing, targetNamespace: index.targetNamespace, schemaIndex: index.schemaIndex }).split("\n");
|
|
306424
|
-
const existing = asArray12(item.event).map((entry) =>
|
|
306628
|
+
const existing = asArray12(item.event).map((entry) => asRecord19(entry)).filter((entry) => Boolean(entry) && entry.listen !== "test");
|
|
306425
306629
|
item.event = [
|
|
306426
306630
|
...existing,
|
|
306427
306631
|
{ listen: "test", script: { type: "text/javascript", exec: exec2 } }
|
|
@@ -306440,7 +306644,7 @@ var SOCKETIO_PROTOCOLS = /* @__PURE__ */ new Set(["socketio", "socket.io", "sio"
|
|
|
306440
306644
|
var MQTT_PROTOCOLS = /* @__PURE__ */ new Set(["mqtt", "mqtts", "secure-mqtt", "mqtt5"]);
|
|
306441
306645
|
var DEFAULT_SOCKETIO_PATH = "/socket.io";
|
|
306442
306646
|
var SAMPLE_MAX_DEPTH = 5;
|
|
306443
|
-
function
|
|
306647
|
+
function asRecord20(value) {
|
|
306444
306648
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
306445
306649
|
return value;
|
|
306446
306650
|
}
|
|
@@ -306463,7 +306667,7 @@ function contentKindFor(contentType2) {
|
|
|
306463
306667
|
return "binary";
|
|
306464
306668
|
}
|
|
306465
306669
|
function sampleFromSchema(schema, depth) {
|
|
306466
|
-
const record =
|
|
306670
|
+
const record = asRecord20(schema);
|
|
306467
306671
|
if (!record) return record === null ? null : {};
|
|
306468
306672
|
if (record.example !== void 0) return record.example;
|
|
306469
306673
|
if (record.default !== void 0) return record.default;
|
|
@@ -306479,7 +306683,7 @@ function sampleFromSchema(schema, depth) {
|
|
|
306479
306683
|
switch (type) {
|
|
306480
306684
|
case "object":
|
|
306481
306685
|
case void 0: {
|
|
306482
|
-
const properties =
|
|
306686
|
+
const properties = asRecord20(record.properties);
|
|
306483
306687
|
if (!properties) return {};
|
|
306484
306688
|
const required = new Set(asArray13(record.required));
|
|
306485
306689
|
const out = {};
|
|
@@ -306508,7 +306712,7 @@ function sampleFromSchema(schema, depth) {
|
|
|
306508
306712
|
}
|
|
306509
306713
|
}
|
|
306510
306714
|
function bindingKeyValues(bindingSchema) {
|
|
306511
|
-
const properties =
|
|
306715
|
+
const properties = asRecord20(asRecord20(bindingSchema)?.properties);
|
|
306512
306716
|
if (!properties) return [];
|
|
306513
306717
|
return Object.keys(properties).sort().map((key) => ({ key, value: "" }));
|
|
306514
306718
|
}
|
|
@@ -306522,8 +306726,8 @@ function detectTransport(channel, servers, messagesRaw, documentJson, warnings)
|
|
|
306522
306726
|
const protocolSocketio = servers.some((server) => SOCKETIO_PROTOCOLS.has(server.protocol().toLowerCase()));
|
|
306523
306727
|
if (protocolSocketio) return "socketio";
|
|
306524
306728
|
const channelJson = channel.json();
|
|
306525
|
-
const hasAck = messagesRaw.some((message) =>
|
|
306526
|
-
const hasSocketioExt = channelJson["x-socketio"] !== void 0 || documentJson["x-socketio"] !== void 0 ||
|
|
306729
|
+
const hasAck = messagesRaw.some((message) => asRecord20(message.json())?.["x-ack"] !== void 0);
|
|
306730
|
+
const hasSocketioExt = channelJson["x-socketio"] !== void 0 || documentJson["x-socketio"] !== void 0 || asRecord20(channelJson.bindings)?.socketio !== void 0;
|
|
306527
306731
|
if (hasAck || hasSocketioExt) {
|
|
306528
306732
|
warnings.push(
|
|
306529
306733
|
`ASYNCAPI_SOCKETIO_CONVENTION: channel ${channel.id()} is treated as Socket.IO from convention (x-ack / x-socketio / protocol), not a normative AsyncAPI binding; event=message name, namespace=channel address, acknowledgement=x-ack`
|
|
@@ -306538,7 +306742,7 @@ function wsBindingKeyValues(channel) {
|
|
|
306538
306742
|
return protocol === "ws" || protocol === "wss" || protocol === "websockets";
|
|
306539
306743
|
});
|
|
306540
306744
|
if (!wsBinding) return { headers: [], queryParams: [] };
|
|
306541
|
-
const value =
|
|
306745
|
+
const value = asRecord20(wsBinding.value()) ?? {};
|
|
306542
306746
|
return {
|
|
306543
306747
|
headers: bindingKeyValues(value.headers),
|
|
306544
306748
|
queryParams: bindingKeyValues(value.query),
|
|
@@ -306549,33 +306753,33 @@ function collectMqttInfo(channel, servers, messagesRaw, documentJson) {
|
|
|
306549
306753
|
const channelJson = channel.json();
|
|
306550
306754
|
const operationBindings = [];
|
|
306551
306755
|
for (const operationKey of ["publish", "subscribe"]) {
|
|
306552
|
-
const binding =
|
|
306756
|
+
const binding = asRecord20(asRecord20(asRecord20(channelJson[operationKey])?.bindings)?.mqtt);
|
|
306553
306757
|
if (binding) operationBindings.push(binding);
|
|
306554
306758
|
}
|
|
306555
306759
|
const unescapePointer = (segment) => segment.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
306556
|
-
const operations =
|
|
306760
|
+
const operations = asRecord20(documentJson.operations) ?? {};
|
|
306557
306761
|
for (const operation of Object.values(operations)) {
|
|
306558
|
-
const operationRecord =
|
|
306762
|
+
const operationRecord = asRecord20(operation);
|
|
306559
306763
|
if (!operationRecord) continue;
|
|
306560
|
-
const ref = String(
|
|
306764
|
+
const ref = String(asRecord20(operationRecord.channel)?.$ref ?? "");
|
|
306561
306765
|
const lastSegment = ref.includes("/") ? unescapePointer(ref.slice(ref.lastIndexOf("/") + 1)) : "";
|
|
306562
306766
|
if (lastSegment !== channel.id()) continue;
|
|
306563
|
-
const binding =
|
|
306767
|
+
const binding = asRecord20(asRecord20(operationRecord.bindings)?.mqtt);
|
|
306564
306768
|
if (binding) operationBindings.push(binding);
|
|
306565
306769
|
}
|
|
306566
306770
|
const serverBindings = [];
|
|
306567
306771
|
let protocolVersion = 4;
|
|
306568
306772
|
for (const server of servers) {
|
|
306569
|
-
const serverJson =
|
|
306773
|
+
const serverJson = asRecord20(server.json()) ?? {};
|
|
306570
306774
|
if (String(serverJson.protocolVersion ?? "") === "5" || server.protocol().toLowerCase() === "mqtt5") {
|
|
306571
306775
|
protocolVersion = 5;
|
|
306572
306776
|
}
|
|
306573
|
-
const binding =
|
|
306777
|
+
const binding = asRecord20(asRecord20(serverJson.bindings)?.mqtt);
|
|
306574
306778
|
if (binding) serverBindings.push(binding);
|
|
306575
306779
|
}
|
|
306576
306780
|
const messageBindings = [];
|
|
306577
306781
|
for (const message of messagesRaw) {
|
|
306578
|
-
const binding =
|
|
306782
|
+
const binding = asRecord20(asRecord20(asRecord20(message.json())?.bindings)?.mqtt);
|
|
306579
306783
|
if (binding) messageBindings.push({ messageId: message.id() || message.name() || "message", binding });
|
|
306580
306784
|
}
|
|
306581
306785
|
return { operationBindings, serverBindings, messageBindings, protocolVersion };
|
|
@@ -306592,7 +306796,7 @@ function buildReplySchemaByMessageId(document2) {
|
|
|
306592
306796
|
}
|
|
306593
306797
|
if (!reply) continue;
|
|
306594
306798
|
const replyMessage = reply.messages().all().find((message) => message.hasPayload());
|
|
306595
|
-
const replySchema = replyMessage ?
|
|
306799
|
+
const replySchema = replyMessage ? asRecord20(replyMessage.payload()?.json()) ?? void 0 : void 0;
|
|
306596
306800
|
if (!replySchema) continue;
|
|
306597
306801
|
for (const requestMessage of operation.messages().all()) {
|
|
306598
306802
|
const id = requestMessage.id();
|
|
@@ -306607,16 +306811,16 @@ function messageDescriptor2(message, warnings, channelId, defaultContentType, re
|
|
|
306607
306811
|
const title = message.title() || message.name() || id;
|
|
306608
306812
|
const contentType2 = message.contentType() || defaultContentType || "application/json";
|
|
306609
306813
|
const contentKind = contentKindFor(contentType2);
|
|
306610
|
-
const payloadSchema = message.hasPayload() ?
|
|
306814
|
+
const payloadSchema = message.hasPayload() ? asRecord20(message.payload()?.json()) ?? void 0 : void 0;
|
|
306611
306815
|
if (!payloadSchema) {
|
|
306612
306816
|
warnings.push(`ASYNCAPI_MESSAGE_NO_PAYLOAD: message ${id} on channel ${channelId} declares no payload schema; its content is an empty sample and is not schema-validated`);
|
|
306613
306817
|
}
|
|
306614
|
-
const rawMessage =
|
|
306615
|
-
const xAckSchema =
|
|
306818
|
+
const rawMessage = asRecord20(message.json()) ?? {};
|
|
306819
|
+
const xAckSchema = asRecord20(rawMessage["x-ack"]) ?? void 0;
|
|
306616
306820
|
const replySchema = replyByMessageId.get(message.id());
|
|
306617
306821
|
const ackSchema = xAckSchema ?? replySchema;
|
|
306618
306822
|
const ackSource = xAckSchema ? "x-ack" : replySchema ? "reply" : void 0;
|
|
306619
|
-
const correlationRaw =
|
|
306823
|
+
const correlationRaw = asRecord20(rawMessage.correlationId)?.location;
|
|
306620
306824
|
const correlationLocation = typeof correlationRaw === "string" ? correlationRaw : void 0;
|
|
306621
306825
|
const examples = message.examples().all().filter((example) => example.hasPayload());
|
|
306622
306826
|
const hasExample = examples.length > 0;
|
|
@@ -306652,7 +306856,7 @@ function channelDescriptor(channel, document2, documentJson, defaultContentType,
|
|
|
306652
306856
|
const servers = resolveServers(channel, document2);
|
|
306653
306857
|
const messagesRaw = channel.messages().all();
|
|
306654
306858
|
const transport = detectTransport(channel, servers, messagesRaw, documentJson, warnings);
|
|
306655
|
-
const parameterNames = Object.keys(
|
|
306859
|
+
const parameterNames = Object.keys(asRecord20(channel.json().parameters) ?? {}).sort();
|
|
306656
306860
|
const serverUrl = servers.find((server) => server.url())?.url() || options.endpointUrl?.trim() || "";
|
|
306657
306861
|
if (!serverUrl) {
|
|
306658
306862
|
warnings.push(`ASYNCAPI_NO_SERVER_URL: channel ${channel.id()} has no resolvable server url; the generated request url is derived from the channel address only and must be completed before use`);
|
|
@@ -307094,7 +307298,7 @@ var SCHEMES_BY_FAMILY = {
|
|
|
307094
307298
|
http: /* @__PURE__ */ new Set(["http", "https"]),
|
|
307095
307299
|
amqp: /* @__PURE__ */ new Set(["amqp", "amqps"])
|
|
307096
307300
|
};
|
|
307097
|
-
function
|
|
307301
|
+
function asRecord21(value) {
|
|
307098
307302
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
307099
307303
|
return value;
|
|
307100
307304
|
}
|
|
@@ -307113,7 +307317,7 @@ function parsesAsUrl(value) {
|
|
|
307113
307317
|
}
|
|
307114
307318
|
}
|
|
307115
307319
|
function checkExternalDocs(label, raw, warnings) {
|
|
307116
|
-
const externalDocs =
|
|
307320
|
+
const externalDocs = asRecord21(raw);
|
|
307117
307321
|
if (!externalDocs) return;
|
|
307118
307322
|
const url = externalDocs.url;
|
|
307119
307323
|
if (typeof url !== "string" || !parsesAsUrl(url)) {
|
|
@@ -307127,7 +307331,7 @@ function lintTagsAndExternalDocs(label, node, warnings) {
|
|
|
307127
307331
|
const seen = /* @__PURE__ */ new Set();
|
|
307128
307332
|
const reported = /* @__PURE__ */ new Set();
|
|
307129
307333
|
tags.forEach((entry, i) => {
|
|
307130
|
-
const tag =
|
|
307334
|
+
const tag = asRecord21(entry);
|
|
307131
307335
|
const name = typeof tag?.name === "string" ? tag.name : void 0;
|
|
307132
307336
|
if (name !== void 0) {
|
|
307133
307337
|
if (seen.has(name) && !reported.has(name)) {
|
|
@@ -307163,7 +307367,7 @@ function lintSchemaFormat(label, value, warnings) {
|
|
|
307163
307367
|
}
|
|
307164
307368
|
function lintTraits(label, traitsRaw, warnings) {
|
|
307165
307369
|
asArray14(traitsRaw).forEach((entry, i) => {
|
|
307166
|
-
const trait =
|
|
307370
|
+
const trait = asRecord21(entry);
|
|
307167
307371
|
if (trait && trait.payload !== void 0) {
|
|
307168
307372
|
warnings.push(
|
|
307169
307373
|
`ASYNCAPI_TRAIT_PAYLOAD_FORBIDDEN: ${label} trait #${i} defines payload; the Message/Operation Trait Object is the message/operation definition minus payload, so a trait MUST NOT carry one`
|
|
@@ -307172,7 +307376,7 @@ function lintTraits(label, traitsRaw, warnings) {
|
|
|
307172
307376
|
});
|
|
307173
307377
|
}
|
|
307174
307378
|
function lintParameter(label, raw, warnings) {
|
|
307175
|
-
const parameter =
|
|
307379
|
+
const parameter = asRecord21(raw);
|
|
307176
307380
|
if (!parameter) return;
|
|
307177
307381
|
const enumValues = asArray14(parameter.enum);
|
|
307178
307382
|
if (enumValues.length > 0) {
|
|
@@ -307192,9 +307396,9 @@ function lintParameter(label, raw, warnings) {
|
|
|
307192
307396
|
}
|
|
307193
307397
|
}
|
|
307194
307398
|
function lintSecurityRequirements(documentJson, is3, label, securityRaw, warnings) {
|
|
307195
|
-
const declared =
|
|
307399
|
+
const declared = asRecord21(asRecord21(documentJson.components)?.securitySchemes) ?? {};
|
|
307196
307400
|
for (const entry of asArray14(securityRaw)) {
|
|
307197
|
-
const requirement =
|
|
307401
|
+
const requirement = asRecord21(entry);
|
|
307198
307402
|
if (!requirement) continue;
|
|
307199
307403
|
if (is3) {
|
|
307200
307404
|
const type = String(requirement.type ?? "");
|
|
@@ -307207,7 +307411,7 @@ function lintSecurityRequirements(documentJson, is3, label, securityRaw, warning
|
|
|
307207
307411
|
continue;
|
|
307208
307412
|
}
|
|
307209
307413
|
for (const [schemeName, scopesRaw] of Object.entries(requirement)) {
|
|
307210
|
-
const scheme =
|
|
307414
|
+
const scheme = asRecord21(declared[schemeName]);
|
|
307211
307415
|
if (!scheme) {
|
|
307212
307416
|
warnings.push(
|
|
307213
307417
|
`ASYNCAPI_SECURITY_REQUIREMENT_UNDECLARED: ${label} security requirement references scheme ${JSON.stringify(schemeName)}, which is not declared in components.securitySchemes`
|
|
@@ -307224,9 +307428,9 @@ function lintSecurityRequirements(documentJson, is3, label, securityRaw, warning
|
|
|
307224
307428
|
}
|
|
307225
307429
|
}
|
|
307226
307430
|
function lintSecuritySchemes(documentJson, warnings) {
|
|
307227
|
-
const schemes =
|
|
307431
|
+
const schemes = asRecord21(asRecord21(documentJson.components)?.securitySchemes) ?? {};
|
|
307228
307432
|
for (const [name, raw] of Object.entries(schemes)) {
|
|
307229
|
-
const scheme =
|
|
307433
|
+
const scheme = asRecord21(raw);
|
|
307230
307434
|
if (!scheme) continue;
|
|
307231
307435
|
const type = scheme.type;
|
|
307232
307436
|
if (typeof type !== "string" || !ASYNCAPI_SECURITY_SCHEME_TYPES.has(type)) {
|
|
@@ -307248,9 +307452,9 @@ function lintSecuritySchemes(documentJson, warnings) {
|
|
|
307248
307452
|
}
|
|
307249
307453
|
}
|
|
307250
307454
|
function lintComponentKeys(documentJson, warnings) {
|
|
307251
|
-
const components =
|
|
307455
|
+
const components = asRecord21(documentJson.components) ?? {};
|
|
307252
307456
|
for (const [sectionName, sectionRaw] of Object.entries(components)) {
|
|
307253
|
-
const section =
|
|
307457
|
+
const section = asRecord21(sectionRaw);
|
|
307254
307458
|
if (!section) continue;
|
|
307255
307459
|
for (const key of Object.keys(section)) {
|
|
307256
307460
|
if (!COMPONENT_KEY_RE.test(key)) {
|
|
@@ -307262,7 +307466,7 @@ function lintComponentKeys(documentJson, warnings) {
|
|
|
307262
307466
|
}
|
|
307263
307467
|
}
|
|
307264
307468
|
function lintServerVariables(serverLabel, template, variablesRaw, warnings) {
|
|
307265
|
-
const variables =
|
|
307469
|
+
const variables = asRecord21(variablesRaw) ?? {};
|
|
307266
307470
|
const used = /* @__PURE__ */ new Set();
|
|
307267
307471
|
for (const match of template.matchAll(/\{([^{}]+)\}/g)) {
|
|
307268
307472
|
used.add(match[1]);
|
|
@@ -307276,7 +307480,7 @@ function lintServerVariables(serverLabel, template, variablesRaw, warnings) {
|
|
|
307276
307480
|
if (!used.has(name)) {
|
|
307277
307481
|
warnings.push(`ASYNCAPI_SERVER_VARIABLE_UNUSED: ${serverLabel} declares variable ${name} that never appears in the server url/host/pathname`);
|
|
307278
307482
|
}
|
|
307279
|
-
const variable =
|
|
307483
|
+
const variable = asRecord21(raw);
|
|
307280
307484
|
if (!variable) continue;
|
|
307281
307485
|
if (variable.default === void 0) {
|
|
307282
307486
|
warnings.push(
|
|
@@ -307297,10 +307501,10 @@ function lintServerVariables(serverLabel, template, variablesRaw, warnings) {
|
|
|
307297
307501
|
}
|
|
307298
307502
|
}
|
|
307299
307503
|
function lintServers(documentJson, is3, warnings) {
|
|
307300
|
-
const servers =
|
|
307504
|
+
const servers = asRecord21(documentJson.servers) ?? {};
|
|
307301
307505
|
let httpProtocolSeen = false;
|
|
307302
307506
|
for (const [name, raw] of Object.entries(servers)) {
|
|
307303
|
-
const server =
|
|
307507
|
+
const server = asRecord21(raw);
|
|
307304
307508
|
if (!server) continue;
|
|
307305
307509
|
const label = `server ${name}`;
|
|
307306
307510
|
const protocol = typeof server.protocol === "string" ? server.protocol.toLowerCase() : void 0;
|
|
@@ -307343,9 +307547,9 @@ function lintServers(documentJson, is3, warnings) {
|
|
|
307343
307547
|
}
|
|
307344
307548
|
}
|
|
307345
307549
|
function lintBindings(label, bindingsRaw, warnings) {
|
|
307346
|
-
const bindings =
|
|
307550
|
+
const bindings = asRecord21(bindingsRaw);
|
|
307347
307551
|
if (!bindings) return;
|
|
307348
|
-
const kafka =
|
|
307552
|
+
const kafka = asRecord21(bindings.kafka);
|
|
307349
307553
|
if (kafka) {
|
|
307350
307554
|
if (typeof kafka.topic === "string" && (kafka.topic === "." || kafka.topic === ".." || !KAFKA_TOPIC_NAME_RE.test(kafka.topic))) {
|
|
307351
307555
|
warnings.push(
|
|
@@ -307360,15 +307564,15 @@ function lintBindings(label, bindingsRaw, warnings) {
|
|
|
307360
307564
|
}
|
|
307361
307565
|
}
|
|
307362
307566
|
}
|
|
307363
|
-
const amqp =
|
|
307567
|
+
const amqp = asRecord21(bindings.amqp);
|
|
307364
307568
|
if (amqp) {
|
|
307365
|
-
const queue =
|
|
307569
|
+
const queue = asRecord21(amqp.queue);
|
|
307366
307570
|
if (queue && typeof queue.name === "string" && queue.name.length > 255) {
|
|
307367
307571
|
warnings.push(
|
|
307368
307572
|
`ASYNCAPI_AMQP_BINDING_INVALID: ${label} amqp binding queue name exceeds 255 characters (AMQP 0-9-1 short-string limit; amqp binding README, bindingVersion-scoped, non-normative source)`
|
|
307369
307573
|
);
|
|
307370
307574
|
}
|
|
307371
|
-
const exchange =
|
|
307575
|
+
const exchange = asRecord21(amqp.exchange);
|
|
307372
307576
|
if (exchange && exchange.type !== void 0 && !AMQP_EXCHANGE_TYPES.has(String(exchange.type))) {
|
|
307373
307577
|
warnings.push(
|
|
307374
307578
|
`ASYNCAPI_AMQP_BINDING_INVALID: ${label} amqp binding exchange type ${JSON.stringify(exchange.type)} must be one of default, direct, topic, fanout, headers (amqp binding README, bindingVersion-scoped, non-normative source)`
|
|
@@ -307385,7 +307589,7 @@ function lintBindings(label, bindingsRaw, warnings) {
|
|
|
307385
307589
|
);
|
|
307386
307590
|
}
|
|
307387
307591
|
}
|
|
307388
|
-
const http2 =
|
|
307592
|
+
const http2 = asRecord21(bindings.http);
|
|
307389
307593
|
if (http2) {
|
|
307390
307594
|
if (http2.method !== void 0 && (typeof http2.method !== "string" || !HTTP_BINDING_METHODS.has(http2.method))) {
|
|
307391
307595
|
warnings.push(
|
|
@@ -307398,7 +307602,7 @@ function lintBindings(label, bindingsRaw, warnings) {
|
|
|
307398
307602
|
);
|
|
307399
307603
|
}
|
|
307400
307604
|
}
|
|
307401
|
-
const ws =
|
|
307605
|
+
const ws = asRecord21(bindings.ws) ?? asRecord21(bindings.websockets);
|
|
307402
307606
|
if (ws && typeof ws.subprotocol === "string" && !IANA_WEBSOCKET_SUBPROTOCOLS.has(ws.subprotocol)) {
|
|
307403
307607
|
warnings.push(
|
|
307404
307608
|
`ASYNCAPI_WS_SUBPROTOCOL_UNREGISTERED: ${label} ws binding declares subprotocol ${JSON.stringify(ws.subprotocol)}, which is not in the IANA WebSocket Subprotocol Name Registry (vendored snapshot 2026-07)`
|
|
@@ -307406,11 +307610,11 @@ function lintBindings(label, bindingsRaw, warnings) {
|
|
|
307406
307610
|
}
|
|
307407
307611
|
}
|
|
307408
307612
|
function effectiveSchema(label, slot, raw, warnings) {
|
|
307409
|
-
const node =
|
|
307613
|
+
const node = asRecord21(raw);
|
|
307410
307614
|
if (!node) return void 0;
|
|
307411
307615
|
if (typeof node.schemaFormat === "string" && node.schema !== void 0) {
|
|
307412
307616
|
lintSchemaFormat(`${label} ${slot}`, node.schemaFormat, warnings);
|
|
307413
|
-
return
|
|
307617
|
+
return asRecord21(node.schema) ?? void 0;
|
|
307414
307618
|
}
|
|
307415
307619
|
return node;
|
|
307416
307620
|
}
|
|
@@ -307441,7 +307645,7 @@ function lintMessage2(documentJson, label, message, is3, minor, state, warnings)
|
|
|
307441
307645
|
const examples = asArray14(message.examples);
|
|
307442
307646
|
if (!is3) {
|
|
307443
307647
|
examples.forEach((entry, i) => {
|
|
307444
|
-
const example =
|
|
307648
|
+
const example = asRecord21(entry);
|
|
307445
307649
|
if (!example) return;
|
|
307446
307650
|
for (const key of Object.keys(example)) {
|
|
307447
307651
|
if (!MESSAGE_EXAMPLE_KEYS.has(key) && !key.startsWith("x-")) {
|
|
@@ -307452,7 +307656,7 @@ function lintMessage2(documentJson, label, message, is3, minor, state, warnings)
|
|
|
307452
307656
|
}
|
|
307453
307657
|
});
|
|
307454
307658
|
}
|
|
307455
|
-
if (headersSchema && examples.some((entry) =>
|
|
307659
|
+
if (headersSchema && examples.some((entry) => asRecord21(entry)?.headers !== void 0)) {
|
|
307456
307660
|
const packed = packSchema(documentJson, headersSchema, "3.0", "response");
|
|
307457
307661
|
const validate4 = packed.unsupported ? null : compileSchemaValidator(packed.schema);
|
|
307458
307662
|
if (!validate4) {
|
|
@@ -307461,7 +307665,7 @@ function lintMessage2(documentJson, label, message, is3, minor, state, warnings)
|
|
|
307461
307665
|
);
|
|
307462
307666
|
} else {
|
|
307463
307667
|
examples.forEach((entry, i) => {
|
|
307464
|
-
const example =
|
|
307668
|
+
const example = asRecord21(entry);
|
|
307465
307669
|
if (!example || example.headers === void 0) return;
|
|
307466
307670
|
if (!validate4(example.headers)) {
|
|
307467
307671
|
warnings.push(
|
|
@@ -307476,23 +307680,23 @@ function lintMessage2(documentJson, label, message, is3, minor, state, warnings)
|
|
|
307476
307680
|
lintTagsAndExternalDocs(label, message, warnings);
|
|
307477
307681
|
}
|
|
307478
307682
|
function messagesOfOperation2x(op) {
|
|
307479
|
-
const root =
|
|
307683
|
+
const root = asRecord21(op.message);
|
|
307480
307684
|
if (!root) return [];
|
|
307481
|
-
const oneOf = asArray14(root.oneOf).map((entry) =>
|
|
307685
|
+
const oneOf = asArray14(root.oneOf).map((entry) => asRecord21(entry)).filter((entry) => entry !== null);
|
|
307482
307686
|
return oneOf.length > 0 ? oneOf : [root];
|
|
307483
307687
|
}
|
|
307484
307688
|
function lintChannels(documentJson, is3, minor, warnings) {
|
|
307485
|
-
const channels =
|
|
307689
|
+
const channels = asRecord21(documentJson.channels) ?? {};
|
|
307486
307690
|
const state = { seen: /* @__PURE__ */ new WeakSet(), messageIds: /* @__PURE__ */ new Map() };
|
|
307487
307691
|
const operationIds = /* @__PURE__ */ new Map();
|
|
307488
307692
|
const addresses = /* @__PURE__ */ new Map();
|
|
307489
307693
|
for (const [channelKey, channelRaw] of Object.entries(channels)) {
|
|
307490
|
-
const channel =
|
|
307694
|
+
const channel = asRecord21(channelRaw);
|
|
307491
307695
|
if (!channel) continue;
|
|
307492
307696
|
const channelLabel = `channel ${channelKey}`;
|
|
307493
307697
|
lintBindings(channelLabel, channel.bindings, warnings);
|
|
307494
307698
|
lintTagsAndExternalDocs(channelLabel, channel, warnings);
|
|
307495
|
-
const parameters =
|
|
307699
|
+
const parameters = asRecord21(channel.parameters) ?? {};
|
|
307496
307700
|
for (const [parameterName, parameterRaw] of Object.entries(parameters)) {
|
|
307497
307701
|
lintParameter(`${channelLabel} parameter ${parameterName}`, parameterRaw, warnings);
|
|
307498
307702
|
}
|
|
@@ -307505,15 +307709,15 @@ function lintChannels(documentJson, is3, minor, warnings) {
|
|
|
307505
307709
|
addresses.set(channel.address, channelKey);
|
|
307506
307710
|
}
|
|
307507
307711
|
}
|
|
307508
|
-
const messages =
|
|
307712
|
+
const messages = asRecord21(channel.messages) ?? {};
|
|
307509
307713
|
for (const [messageKey, messageRaw] of Object.entries(messages)) {
|
|
307510
|
-
const message =
|
|
307714
|
+
const message = asRecord21(messageRaw);
|
|
307511
307715
|
if (message) lintMessage2(documentJson, `message ${messageKey} on channel ${channelKey}`, message, is3, minor, state, warnings);
|
|
307512
307716
|
}
|
|
307513
307717
|
continue;
|
|
307514
307718
|
}
|
|
307515
307719
|
for (const opKey of ["publish", "subscribe"]) {
|
|
307516
|
-
const op =
|
|
307720
|
+
const op = asRecord21(channel[opKey]);
|
|
307517
307721
|
if (!op) continue;
|
|
307518
307722
|
const opLabel = `${opKey} operation on channel ${channelKey}`;
|
|
307519
307723
|
if (typeof op.operationId === "string") {
|
|
@@ -307536,15 +307740,15 @@ function lintChannels(documentJson, is3, minor, warnings) {
|
|
|
307536
307740
|
}
|
|
307537
307741
|
}
|
|
307538
307742
|
function lintOperations3(documentJson, warnings) {
|
|
307539
|
-
const operations =
|
|
307743
|
+
const operations = asRecord21(documentJson.operations) ?? {};
|
|
307540
307744
|
for (const [operationKey, operationRaw] of Object.entries(operations)) {
|
|
307541
|
-
const operation =
|
|
307745
|
+
const operation = asRecord21(operationRaw);
|
|
307542
307746
|
if (!operation) continue;
|
|
307543
307747
|
const label = `operation ${operationKey}`;
|
|
307544
307748
|
if (operation.action !== "send" && operation.action !== "receive") {
|
|
307545
307749
|
warnings.push(`ASYNCAPI_OPERATION_ACTION_INVALID: ${label} action ${JSON.stringify(operation.action)} must be "send" or "receive" (AsyncAPI 3.0 Operation Object)`);
|
|
307546
307750
|
}
|
|
307547
|
-
const replyAddress =
|
|
307751
|
+
const replyAddress = asRecord21(asRecord21(operation.reply)?.address);
|
|
307548
307752
|
if (replyAddress && typeof replyAddress.location === "string" && !isAsyncApiRuntimeExpression(replyAddress.location)) {
|
|
307549
307753
|
warnings.push(
|
|
307550
307754
|
`ASYNCAPI_RUNTIME_EXPRESSION_INVALID: ${label} reply.address location ${JSON.stringify(replyAddress.location)} is not a valid AsyncAPI runtime expression ($message.header#/<pointer> or $message.payload#/<pointer>)`
|
|
@@ -307568,7 +307772,7 @@ function resolveLocalPointer(root, ref) {
|
|
|
307568
307772
|
if (!Number.isInteger(idx) || idx < 0 || idx >= node.length) return false;
|
|
307569
307773
|
node = node[idx];
|
|
307570
307774
|
} else {
|
|
307571
|
-
const record =
|
|
307775
|
+
const record = asRecord21(node);
|
|
307572
307776
|
if (!record || !(key in record)) return false;
|
|
307573
307777
|
node = record[key];
|
|
307574
307778
|
}
|
|
@@ -307612,13 +307816,13 @@ function lintAsyncApiDocument(index) {
|
|
|
307612
307816
|
lintChannels(documentJson, is3, minor, warnings);
|
|
307613
307817
|
if (is3) lintOperations3(documentJson, warnings);
|
|
307614
307818
|
lintTagsAndExternalDocs("document", documentJson, warnings);
|
|
307615
|
-
const info2 =
|
|
307819
|
+
const info2 = asRecord21(documentJson.info);
|
|
307616
307820
|
if (info2) lintTagsAndExternalDocs("info", info2, warnings);
|
|
307617
307821
|
return warnings;
|
|
307618
307822
|
}
|
|
307619
307823
|
|
|
307620
307824
|
// src/lib/protocols/asyncapi/asyncapi-binding-lints.ts
|
|
307621
|
-
function
|
|
307825
|
+
function asRecord22(value) {
|
|
307622
307826
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
307623
307827
|
return value;
|
|
307624
307828
|
}
|
|
@@ -307713,46 +307917,46 @@ function pushSite(ctx, site) {
|
|
|
307713
307917
|
if (site) ctx.sites.push(site);
|
|
307714
307918
|
}
|
|
307715
307919
|
function siteOf(scope, label, raw, direction) {
|
|
307716
|
-
const bindings =
|
|
307920
|
+
const bindings = asRecord22(raw);
|
|
307717
307921
|
if (!bindings) return null;
|
|
307718
307922
|
return { scope, label, bindings, direction };
|
|
307719
307923
|
}
|
|
307720
307924
|
function collectSites(ctx) {
|
|
307721
307925
|
const { doc } = ctx;
|
|
307722
|
-
const servers =
|
|
307926
|
+
const servers = asRecord22(doc.servers) ?? {};
|
|
307723
307927
|
for (const [name, raw] of Object.entries(servers)) {
|
|
307724
|
-
const server =
|
|
307928
|
+
const server = asRecord22(raw);
|
|
307725
307929
|
if (server) pushSite(ctx, siteOf("server", "server " + name, server.bindings));
|
|
307726
307930
|
}
|
|
307727
|
-
const channels =
|
|
307931
|
+
const channels = asRecord22(doc.channels) ?? {};
|
|
307728
307932
|
for (const [chName, rawCh] of Object.entries(channels)) {
|
|
307729
|
-
const channel =
|
|
307933
|
+
const channel = asRecord22(rawCh);
|
|
307730
307934
|
if (!channel) continue;
|
|
307731
307935
|
pushSite(ctx, siteOf("channel", "channel " + chName, channel.bindings));
|
|
307732
307936
|
for (const opKeyword of ["publish", "subscribe"]) {
|
|
307733
|
-
const op =
|
|
307937
|
+
const op = asRecord22(channel[opKeyword]);
|
|
307734
307938
|
if (!op) continue;
|
|
307735
307939
|
const direction = opKeyword === "publish" ? "send" : "receive";
|
|
307736
307940
|
pushSite(ctx, siteOf("operation", "channel " + chName + " " + opKeyword, op.bindings, direction));
|
|
307737
|
-
const message =
|
|
307941
|
+
const message = asRecord22(op.message);
|
|
307738
307942
|
if (message) collectMessageSites(ctx, "channel " + chName + " " + opKeyword + " message", message, direction);
|
|
307739
307943
|
}
|
|
307740
|
-
const chMessages =
|
|
307944
|
+
const chMessages = asRecord22(channel.messages);
|
|
307741
307945
|
if (chMessages) {
|
|
307742
307946
|
for (const [msgName, rawMsg] of Object.entries(chMessages)) {
|
|
307743
|
-
const message =
|
|
307947
|
+
const message = asRecord22(rawMsg);
|
|
307744
307948
|
if (message) collectMessageSites(ctx, "channel " + chName + " message " + msgName, message, void 0);
|
|
307745
307949
|
}
|
|
307746
307950
|
}
|
|
307747
307951
|
}
|
|
307748
|
-
const operations =
|
|
307952
|
+
const operations = asRecord22(doc.operations) ?? {};
|
|
307749
307953
|
for (const [opName, rawOp] of Object.entries(operations)) {
|
|
307750
|
-
const op =
|
|
307954
|
+
const op = asRecord22(rawOp);
|
|
307751
307955
|
if (!op) continue;
|
|
307752
307956
|
const direction = op.action === "send" ? "send" : op.action === "receive" ? "receive" : void 0;
|
|
307753
307957
|
pushSite(ctx, siteOf("operation", "operation " + opName, op.bindings, direction));
|
|
307754
307958
|
}
|
|
307755
|
-
const components =
|
|
307959
|
+
const components = asRecord22(doc.components) ?? {};
|
|
307756
307960
|
const componentScopes = [
|
|
307757
307961
|
["serverBindings", "server"],
|
|
307758
307962
|
["channelBindings", "channel"],
|
|
@@ -307760,21 +307964,21 @@ function collectSites(ctx) {
|
|
|
307760
307964
|
["messageBindings", "message"]
|
|
307761
307965
|
];
|
|
307762
307966
|
for (const [key, scope] of componentScopes) {
|
|
307763
|
-
const group2 =
|
|
307967
|
+
const group2 = asRecord22(components[key]) ?? {};
|
|
307764
307968
|
for (const [name, raw] of Object.entries(group2)) {
|
|
307765
307969
|
pushSite(ctx, siteOf(scope, "components." + key + " " + name, raw));
|
|
307766
307970
|
}
|
|
307767
307971
|
}
|
|
307768
|
-
const compMessages =
|
|
307972
|
+
const compMessages = asRecord22(components.messages) ?? {};
|
|
307769
307973
|
for (const [name, raw] of Object.entries(compMessages)) {
|
|
307770
|
-
const message =
|
|
307974
|
+
const message = asRecord22(raw);
|
|
307771
307975
|
if (message) collectMessageSites(ctx, "components.messages " + name, message, void 0);
|
|
307772
307976
|
}
|
|
307773
307977
|
}
|
|
307774
307978
|
function collectMessageSites(ctx, label, message, direction) {
|
|
307775
307979
|
pushSite(ctx, siteOf("message", label, message.bindings, direction));
|
|
307776
307980
|
for (const entry of asArray15(message.oneOf)) {
|
|
307777
|
-
const alt =
|
|
307981
|
+
const alt = asRecord22(entry);
|
|
307778
307982
|
if (alt) pushSite(ctx, siteOf("message", label + " oneOf alternative", alt.bindings, direction));
|
|
307779
307983
|
}
|
|
307780
307984
|
}
|
|
@@ -307799,7 +308003,7 @@ function lintBindingSites(ctx) {
|
|
|
307799
308003
|
}
|
|
307800
308004
|
const family = BINDING_KEY_FAMILY[key];
|
|
307801
308005
|
if (family) familiesSeen.set(family, site.label + " bindings." + key);
|
|
307802
|
-
const binding =
|
|
308006
|
+
const binding = asRecord22(site.bindings[key]);
|
|
307803
308007
|
if (!binding) continue;
|
|
307804
308008
|
if (key === "mqtt5") {
|
|
307805
308009
|
warnings.push(
|
|
@@ -307842,8 +308046,8 @@ function lintBindingSites(ctx) {
|
|
|
307842
308046
|
}
|
|
307843
308047
|
}
|
|
307844
308048
|
const serverFamilies = /* @__PURE__ */ new Set();
|
|
307845
|
-
for (const raw of Object.values(
|
|
307846
|
-
const server =
|
|
308049
|
+
for (const raw of Object.values(asRecord22(ctx.doc.servers) ?? {})) {
|
|
308050
|
+
const server = asRecord22(raw);
|
|
307847
308051
|
const protocol = typeof server?.protocol === "string" ? server.protocol.toLowerCase() : "";
|
|
307848
308052
|
const family = SERVER_PROTOCOL_FAMILY[protocol];
|
|
307849
308053
|
if (family) serverFamilies.add(family);
|
|
@@ -307859,7 +308063,7 @@ function lintBindingSites(ctx) {
|
|
|
307859
308063
|
}
|
|
307860
308064
|
}
|
|
307861
308065
|
function compileBindingSchema(ctx, label, schema) {
|
|
307862
|
-
const record =
|
|
308066
|
+
const record = asRecord22(schema);
|
|
307863
308067
|
if (!record) return null;
|
|
307864
308068
|
const packed = packSchema(ctx.doc, record, "3.0", "response");
|
|
307865
308069
|
if (packed.unsupported) {
|
|
@@ -307893,9 +308097,9 @@ function lintWsChannelBinding(ctx, label, binding) {
|
|
|
307893
308097
|
for (const part of ["query", "headers"]) {
|
|
307894
308098
|
const schemaRaw = binding[part];
|
|
307895
308099
|
if (schemaRaw === void 0) continue;
|
|
307896
|
-
const schema =
|
|
308100
|
+
const schema = asRecord22(schemaRaw);
|
|
307897
308101
|
if (!schema) continue;
|
|
307898
|
-
const properties =
|
|
308102
|
+
const properties = asRecord22(schema.properties);
|
|
307899
308103
|
if (!properties || Object.keys(properties).length === 0) {
|
|
307900
308104
|
warnings.push(
|
|
307901
308105
|
"ASYNCAPI_WS_BINDING_SCHEMA_NO_PROPERTIES: " + label + " ws binding " + part + " schema declares no properties; the generated handshake carries nothing from it (ws binding README: object schema with properties)"
|
|
@@ -307912,7 +308116,7 @@ function lintWsChannelBinding(ctx, label, binding) {
|
|
|
307912
308116
|
}
|
|
307913
308117
|
if (part !== "headers") continue;
|
|
307914
308118
|
const lower = name.toLowerCase();
|
|
307915
|
-
const prop =
|
|
308119
|
+
const prop = asRecord22(rawProp) ?? {};
|
|
307916
308120
|
if (WS_RUNTIME_OWNED_HEADERS.has(lower)) {
|
|
307917
308121
|
const detail = required.has(lower) ? "is required by the binding but" : "";
|
|
307918
308122
|
warnings.push(
|
|
@@ -307963,10 +308167,10 @@ function substituteTemplates(value) {
|
|
|
307963
308167
|
}
|
|
307964
308168
|
function lintChannelAddresses(ctx) {
|
|
307965
308169
|
const { doc, warnings } = ctx;
|
|
307966
|
-
const channels =
|
|
308170
|
+
const channels = asRecord22(doc.channels) ?? {};
|
|
307967
308171
|
const wsServers = [];
|
|
307968
|
-
for (const [name, raw] of Object.entries(
|
|
307969
|
-
const server =
|
|
308172
|
+
for (const [name, raw] of Object.entries(asRecord22(doc.servers) ?? {})) {
|
|
308173
|
+
const server = asRecord22(raw);
|
|
307970
308174
|
if (!server) continue;
|
|
307971
308175
|
const protocol = typeof server.protocol === "string" ? server.protocol.toLowerCase() : "";
|
|
307972
308176
|
if (SERVER_PROTOCOL_FAMILY[protocol] !== "ws") continue;
|
|
@@ -307974,7 +308178,7 @@ function lintChannelAddresses(ctx) {
|
|
|
307974
308178
|
if (url) wsServers.push({ name, base: url });
|
|
307975
308179
|
}
|
|
307976
308180
|
for (const [chName, rawCh] of Object.entries(channels)) {
|
|
307977
|
-
const channel =
|
|
308181
|
+
const channel = asRecord22(rawCh);
|
|
307978
308182
|
if (!channel) continue;
|
|
307979
308183
|
const address = ctx.isV3 ? channel.address : chName;
|
|
307980
308184
|
if (typeof address !== "string" || address.length === 0) continue;
|
|
@@ -308011,8 +308215,8 @@ function lintChannelAddresses(ctx) {
|
|
|
308011
308215
|
}
|
|
308012
308216
|
}
|
|
308013
308217
|
function collectMqttServerVersions(ctx) {
|
|
308014
|
-
for (const raw of Object.values(
|
|
308015
|
-
const server =
|
|
308218
|
+
for (const raw of Object.values(asRecord22(ctx.doc.servers) ?? {})) {
|
|
308219
|
+
const server = asRecord22(raw);
|
|
308016
308220
|
if (!server) continue;
|
|
308017
308221
|
const protocol = typeof server.protocol === "string" ? server.protocol.toLowerCase() : "";
|
|
308018
308222
|
if (SERVER_PROTOCOL_FAMILY[protocol] !== "mqtt") continue;
|
|
@@ -308033,7 +308237,7 @@ function lintMqttBindings(ctx) {
|
|
|
308033
308237
|
const { warnings } = ctx;
|
|
308034
308238
|
const only3x = ctx.mqttVersions.size > 0 && !ctx.mqttVersions.has(5) && !ctx.mqttVersions.has(0);
|
|
308035
308239
|
for (const site of ctx.sites) {
|
|
308036
|
-
const binding =
|
|
308240
|
+
const binding = asRecord22(site.bindings.mqtt);
|
|
308037
308241
|
if (!binding) continue;
|
|
308038
308242
|
if (only3x) {
|
|
308039
308243
|
const gated = MQTT5_ONLY_FIELDS[site.scope];
|
|
@@ -308049,7 +308253,7 @@ function lintMqttBindings(ctx) {
|
|
|
308049
308253
|
}
|
|
308050
308254
|
if (site.scope === "server") {
|
|
308051
308255
|
const clientId = binding.clientId;
|
|
308052
|
-
if (clientId !== void 0 && typeof clientId !== "string" && !
|
|
308256
|
+
if (clientId !== void 0 && typeof clientId !== "string" && !asRecord22(clientId)) {
|
|
308053
308257
|
warnings.push("ASYNCAPI_MQTT_CLIENT_ID_INVALID: " + site.label + " mqtt binding clientId must be a string or schema object (mqtt binding README)");
|
|
308054
308258
|
}
|
|
308055
308259
|
if (typeof clientId === "string") {
|
|
@@ -308062,12 +308266,12 @@ function lintMqttBindings(ctx) {
|
|
|
308062
308266
|
if (clientId === "" && only3x && binding.cleanSession !== true) {
|
|
308063
308267
|
warnings.push("ASYNCAPI_MQTT_CLIENT_ID_EMPTY_REQUIRES_CLEAN_SESSION: " + site.label + " mqtt binding declares an empty clientId without cleanSession true; MQTT 3.1.1 requires CleanSession 1 for zero-byte ClientIds (MQTT 3.1.1 section 3.1.3.1)");
|
|
308064
308268
|
}
|
|
308065
|
-
} else if (
|
|
308269
|
+
} else if (asRecord22(clientId)) {
|
|
308066
308270
|
compileBindingSchema(ctx, site.label + " mqtt binding clientId", clientId);
|
|
308067
308271
|
}
|
|
308068
308272
|
const lastWill = binding.lastWill;
|
|
308069
308273
|
if (lastWill !== void 0) {
|
|
308070
|
-
const will =
|
|
308274
|
+
const will = asRecord22(lastWill);
|
|
308071
308275
|
if (!will) {
|
|
308072
308276
|
warnings.push("ASYNCAPI_MQTT_LAST_WILL_INVALID: " + site.label + " mqtt binding lastWill must be an object (mqtt binding README)");
|
|
308073
308277
|
} else {
|
|
@@ -308084,7 +308288,7 @@ function lintMqttBindings(ctx) {
|
|
|
308084
308288
|
}
|
|
308085
308289
|
for (const [field, max] of [["sessionExpiryInterval", 4294967295], ["maximumPacketSize", 268435455]]) {
|
|
308086
308290
|
const value = binding[field];
|
|
308087
|
-
if (
|
|
308291
|
+
if (asRecord22(value)) compileBindingSchema(ctx, site.label + " mqtt binding " + field, value);
|
|
308088
308292
|
else if (typeof value === "number" && value > max) {
|
|
308089
308293
|
warnings.push("ASYNCAPI_MQTT_VALUE_OUT_OF_RANGE: " + site.label + " mqtt binding " + field + " " + value + " exceeds the MQTT wire ceiling " + max);
|
|
308090
308294
|
}
|
|
@@ -308092,7 +308296,7 @@ function lintMqttBindings(ctx) {
|
|
|
308092
308296
|
}
|
|
308093
308297
|
if (site.scope === "operation") {
|
|
308094
308298
|
const expiry = binding.messageExpiryInterval;
|
|
308095
|
-
if (
|
|
308299
|
+
if (asRecord22(expiry)) compileBindingSchema(ctx, site.label + " mqtt binding messageExpiryInterval", expiry);
|
|
308096
308300
|
else if (typeof expiry === "number" && expiry > 4294967295) {
|
|
308097
308301
|
warnings.push("ASYNCAPI_MQTT_VALUE_OUT_OF_RANGE: " + site.label + " mqtt binding messageExpiryInterval " + expiry + " exceeds the four-byte-integer ceiling 4294967295 (MQTT 5.0 section 3.3.2.3.3)");
|
|
308098
308302
|
}
|
|
@@ -308112,15 +308316,15 @@ function lintMqttBindings(ctx) {
|
|
|
308112
308316
|
warnings.push("ASYNCAPI_MQTT_CONTENT_TYPE_INVALID: " + site.label + " mqtt binding contentType " + JSON.stringify(contentType2) + " is not RFC 6838 type/subtype syntax (MQTT 5.0 section 3.3.2.3.9)");
|
|
308113
308317
|
}
|
|
308114
308318
|
const correlationData = binding.correlationData;
|
|
308115
|
-
if (
|
|
308319
|
+
if (asRecord22(correlationData)) {
|
|
308116
308320
|
compileBindingSchema(ctx, site.label + " mqtt binding correlationData", correlationData);
|
|
308117
|
-
const maxLength =
|
|
308321
|
+
const maxLength = asRecord22(correlationData)?.maxLength;
|
|
308118
308322
|
if (typeof maxLength === "number" && maxLength > 65535) {
|
|
308119
308323
|
warnings.push("ASYNCAPI_MQTT_CORRELATION_DATA_TOO_LONG: " + site.label + " mqtt binding correlationData maxLength " + maxLength + " exceeds the 65535-byte binary-data ceiling (MQTT 5.0 section 1.5.6)");
|
|
308120
308324
|
}
|
|
308121
308325
|
}
|
|
308122
308326
|
const responseTopic = binding.responseTopic;
|
|
308123
|
-
if (
|
|
308327
|
+
if (asRecord22(responseTopic)) compileBindingSchema(ctx, site.label + " mqtt binding responseTopic", responseTopic);
|
|
308124
308328
|
const pfi = binding.payloadFormatIndicator;
|
|
308125
308329
|
if (pfi === 1) {
|
|
308126
308330
|
const message = siteMessageRecord(ctx, site);
|
|
@@ -308150,38 +308354,38 @@ function normalizeMediaType(value) {
|
|
|
308150
308354
|
function siteMessageRecord(ctx, site) {
|
|
308151
308355
|
const doc = ctx.doc;
|
|
308152
308356
|
const matches = (message) => {
|
|
308153
|
-
return message !== null &&
|
|
308357
|
+
return message !== null && asRecord22(message.bindings)?.mqtt === site.bindings.mqtt;
|
|
308154
308358
|
};
|
|
308155
|
-
for (const rawCh of Object.values(
|
|
308156
|
-
const channel =
|
|
308359
|
+
for (const rawCh of Object.values(asRecord22(doc.channels) ?? {})) {
|
|
308360
|
+
const channel = asRecord22(rawCh);
|
|
308157
308361
|
if (!channel) continue;
|
|
308158
308362
|
for (const opKeyword of ["publish", "subscribe"]) {
|
|
308159
|
-
const op =
|
|
308160
|
-
const message =
|
|
308363
|
+
const op = asRecord22(channel[opKeyword]);
|
|
308364
|
+
const message = asRecord22(op?.message);
|
|
308161
308365
|
if (matches(message)) return message;
|
|
308162
308366
|
for (const entry of asArray15(message?.oneOf)) {
|
|
308163
|
-
const alt =
|
|
308367
|
+
const alt = asRecord22(entry);
|
|
308164
308368
|
if (matches(alt)) return alt;
|
|
308165
308369
|
}
|
|
308166
308370
|
}
|
|
308167
|
-
for (const rawMsg of Object.values(
|
|
308168
|
-
const message =
|
|
308371
|
+
for (const rawMsg of Object.values(asRecord22(channel.messages) ?? {})) {
|
|
308372
|
+
const message = asRecord22(rawMsg);
|
|
308169
308373
|
if (matches(message)) return message;
|
|
308170
308374
|
}
|
|
308171
308375
|
}
|
|
308172
|
-
for (const rawMsg of Object.values(
|
|
308173
|
-
const message =
|
|
308376
|
+
for (const rawMsg of Object.values(asRecord22(asRecord22(doc.components)?.messages) ?? {})) {
|
|
308377
|
+
const message = asRecord22(rawMsg);
|
|
308174
308378
|
if (matches(message)) return message;
|
|
308175
308379
|
}
|
|
308176
308380
|
return null;
|
|
308177
308381
|
}
|
|
308178
308382
|
function lintHttpBindings(ctx) {
|
|
308179
308383
|
for (const site of ctx.sites) {
|
|
308180
|
-
const binding =
|
|
308384
|
+
const binding = asRecord22(site.bindings.http);
|
|
308181
308385
|
if (!binding) continue;
|
|
308182
308386
|
if (site.scope === "operation" && binding.query !== void 0) {
|
|
308183
|
-
const schema =
|
|
308184
|
-
const properties =
|
|
308387
|
+
const schema = asRecord22(binding.query);
|
|
308388
|
+
const properties = asRecord22(schema?.properties);
|
|
308185
308389
|
if (!schema || !properties || Object.keys(properties).length === 0) {
|
|
308186
308390
|
ctx.warnings.push(
|
|
308187
308391
|
"ASYNCAPI_HTTP_BINDING_SCHEMA_NO_PROPERTIES: " + site.label + " http binding query must be an object schema with properties (http binding README)"
|
|
@@ -308196,8 +308400,8 @@ function lintHttpBindings(ctx) {
|
|
|
308196
308400
|
}
|
|
308197
308401
|
}
|
|
308198
308402
|
if (site.scope === "message" && binding.headers !== void 0) {
|
|
308199
|
-
const schema =
|
|
308200
|
-
const properties =
|
|
308403
|
+
const schema = asRecord22(binding.headers);
|
|
308404
|
+
const properties = asRecord22(schema?.properties);
|
|
308201
308405
|
if (!schema || !properties || Object.keys(properties).length === 0) {
|
|
308202
308406
|
ctx.warnings.push(
|
|
308203
308407
|
"ASYNCAPI_HTTP_BINDING_SCHEMA_NO_PROPERTIES: " + site.label + " http binding headers must be an object schema with properties (http binding README)"
|
|
@@ -308233,19 +308437,19 @@ var HTTP_PROTOCOL_HEADER_DENYLIST = /* @__PURE__ */ new Set([
|
|
|
308233
308437
|
function collectMessages2(ctx) {
|
|
308234
308438
|
const out = [];
|
|
308235
308439
|
const doc = ctx.doc;
|
|
308236
|
-
for (const [chName, rawCh] of Object.entries(
|
|
308237
|
-
const channel =
|
|
308440
|
+
for (const [chName, rawCh] of Object.entries(asRecord22(doc.channels) ?? {})) {
|
|
308441
|
+
const channel = asRecord22(rawCh);
|
|
308238
308442
|
if (!channel) continue;
|
|
308239
308443
|
const siblingList = [];
|
|
308240
308444
|
const push = (label, raw) => {
|
|
308241
|
-
const message =
|
|
308445
|
+
const message = asRecord22(raw);
|
|
308242
308446
|
if (!message) return;
|
|
308243
308447
|
siblingList.push(message);
|
|
308244
308448
|
out.push({ label, message, channelMessages: siblingList });
|
|
308245
308449
|
};
|
|
308246
308450
|
for (const opKeyword of ["publish", "subscribe"]) {
|
|
308247
|
-
const op =
|
|
308248
|
-
const message =
|
|
308451
|
+
const op = asRecord22(channel[opKeyword]);
|
|
308452
|
+
const message = asRecord22(op?.message);
|
|
308249
308453
|
if (!message) continue;
|
|
308250
308454
|
const alternatives = asArray15(message.oneOf);
|
|
308251
308455
|
if (alternatives.length > 0) {
|
|
@@ -308254,12 +308458,12 @@ function collectMessages2(ctx) {
|
|
|
308254
308458
|
push("channel " + chName + " " + opKeyword + " message", message);
|
|
308255
308459
|
}
|
|
308256
308460
|
}
|
|
308257
|
-
for (const [msgName, rawMsg] of Object.entries(
|
|
308461
|
+
for (const [msgName, rawMsg] of Object.entries(asRecord22(channel.messages) ?? {})) {
|
|
308258
308462
|
push("channel " + chName + " message " + msgName, rawMsg);
|
|
308259
308463
|
}
|
|
308260
308464
|
}
|
|
308261
|
-
for (const [name, raw] of Object.entries(
|
|
308262
|
-
const message =
|
|
308465
|
+
for (const [name, raw] of Object.entries(asRecord22(asRecord22(doc.components)?.messages) ?? {})) {
|
|
308466
|
+
const message = asRecord22(raw);
|
|
308263
308467
|
if (message) out.push({ label: "components.messages " + name, message, channelMessages: null });
|
|
308264
308468
|
}
|
|
308265
308469
|
return out;
|
|
@@ -308268,7 +308472,7 @@ function effectiveMessageId(message) {
|
|
|
308268
308472
|
if (typeof message.messageId === "string") return message.messageId;
|
|
308269
308473
|
let fromTraits;
|
|
308270
308474
|
for (const entry of asArray15(message.traits)) {
|
|
308271
|
-
const trait =
|
|
308475
|
+
const trait = asRecord22(entry);
|
|
308272
308476
|
if (trait && typeof trait.messageId === "string") fromTraits = trait.messageId;
|
|
308273
308477
|
}
|
|
308274
308478
|
return fromTraits;
|
|
@@ -308282,7 +308486,7 @@ function lintMessages(ctx) {
|
|
|
308282
308486
|
const validatorFor = (message) => {
|
|
308283
308487
|
if (validatorCache.has(message)) return validatorCache.get(message) ?? null;
|
|
308284
308488
|
let validate4 = null;
|
|
308285
|
-
const payload =
|
|
308489
|
+
const payload = asRecord22(message.payload);
|
|
308286
308490
|
if (payload) {
|
|
308287
308491
|
const packed = packSchema(ctx.doc, payload, "3.0", "response");
|
|
308288
308492
|
if (!packed.unsupported) {
|
|
@@ -308302,10 +308506,10 @@ function lintMessages(ctx) {
|
|
|
308302
308506
|
}
|
|
308303
308507
|
if (owner === void 0) idOwners.set(id, label);
|
|
308304
308508
|
}
|
|
308305
|
-
const headers =
|
|
308509
|
+
const headers = asRecord22(message.headers);
|
|
308306
308510
|
if (headers) {
|
|
308307
308511
|
compileBindingSchema(ctx, label + " headers", headers);
|
|
308308
|
-
const properties =
|
|
308512
|
+
const properties = asRecord22(headers.properties) ?? {};
|
|
308309
308513
|
for (const name of Object.keys(properties)) {
|
|
308310
308514
|
if (!HTTP_TOKEN_RE.test(name)) {
|
|
308311
308515
|
warnings.push("ASYNCAPI_BINDING_HEADER_NAME_INVALID: " + label + " headers property " + JSON.stringify(name) + " is not a valid RFC 9110 token");
|
|
@@ -308327,7 +308531,7 @@ function lintMessages(ctx) {
|
|
|
308327
308531
|
return compileSchemaValidator(packed.schema);
|
|
308328
308532
|
})() : null;
|
|
308329
308533
|
asArray15(message.examples).forEach((entry, i) => {
|
|
308330
|
-
const example =
|
|
308534
|
+
const example = asRecord22(entry);
|
|
308331
308535
|
if (!example) return;
|
|
308332
308536
|
if (example.payload === void 0 && example.headers !== void 0) {
|
|
308333
308537
|
if (headerValidate) {
|
|
@@ -308354,7 +308558,7 @@ function lintMessages(ctx) {
|
|
|
308354
308558
|
const traits = asArray15(message.traits);
|
|
308355
308559
|
const traitKeyValues = /* @__PURE__ */ new Map();
|
|
308356
308560
|
traits.forEach((entry, i) => {
|
|
308357
|
-
const trait =
|
|
308561
|
+
const trait = asRecord22(entry);
|
|
308358
308562
|
if (!trait) return;
|
|
308359
308563
|
if (trait.traits !== void 0) {
|
|
308360
308564
|
warnings.push("ASYNCAPI_TRAIT_FORBIDDEN_FIELD: " + label + " trait #" + i + ' declares "traits"; a Message Trait Object cannot itself carry traits (AsyncAPI Message Trait Object)');
|
|
@@ -308371,14 +308575,14 @@ function lintMessages(ctx) {
|
|
|
308371
308575
|
}
|
|
308372
308576
|
});
|
|
308373
308577
|
}
|
|
308374
|
-
for (const [chName, rawCh] of Object.entries(
|
|
308375
|
-
const channel =
|
|
308578
|
+
for (const [chName, rawCh] of Object.entries(asRecord22(ctx.doc.channels) ?? {})) {
|
|
308579
|
+
const channel = asRecord22(rawCh);
|
|
308376
308580
|
if (!channel) continue;
|
|
308377
308581
|
for (const opKeyword of ["publish", "subscribe"]) {
|
|
308378
|
-
const op =
|
|
308582
|
+
const op = asRecord22(channel[opKeyword]);
|
|
308379
308583
|
if (!op) continue;
|
|
308380
308584
|
asArray15(op.traits).forEach((entry, i) => {
|
|
308381
|
-
const trait =
|
|
308585
|
+
const trait = asRecord22(entry);
|
|
308382
308586
|
if (!trait) return;
|
|
308383
308587
|
for (const forbidden of ["message", "traits"]) {
|
|
308384
308588
|
if (trait[forbidden] !== void 0) {
|
|
@@ -308388,13 +308592,13 @@ function lintMessages(ctx) {
|
|
|
308388
308592
|
});
|
|
308389
308593
|
}
|
|
308390
308594
|
}
|
|
308391
|
-
const channelsRecord =
|
|
308392
|
-
const channelValues = Object.values(channelsRecord).map(
|
|
308393
|
-
for (const [opName, rawOp] of Object.entries(
|
|
308394
|
-
const op =
|
|
308595
|
+
const channelsRecord = asRecord22(ctx.doc.channels) ?? {};
|
|
308596
|
+
const channelValues = Object.values(channelsRecord).map(asRecord22).filter((c) => c !== null);
|
|
308597
|
+
for (const [opName, rawOp] of Object.entries(asRecord22(ctx.doc.operations) ?? {})) {
|
|
308598
|
+
const op = asRecord22(rawOp);
|
|
308395
308599
|
if (!op) continue;
|
|
308396
308600
|
asArray15(op.traits).forEach((entry, i) => {
|
|
308397
|
-
const trait =
|
|
308601
|
+
const trait = asRecord22(entry);
|
|
308398
308602
|
if (!trait) return;
|
|
308399
308603
|
for (const forbidden of ["action", "channel", "traits"]) {
|
|
308400
308604
|
if (trait[forbidden] !== void 0) {
|
|
@@ -308402,13 +308606,13 @@ function lintMessages(ctx) {
|
|
|
308402
308606
|
}
|
|
308403
308607
|
}
|
|
308404
308608
|
});
|
|
308405
|
-
const opChannel =
|
|
308609
|
+
const opChannel = asRecord22(op.channel);
|
|
308406
308610
|
if (opChannel && channelValues.length > 0 && !channelValues.includes(opChannel)) {
|
|
308407
308611
|
warnings.push("ASYNCAPI_OPERATION_CHANNEL_UNRESOLVED: operation " + opName + " channel does not resolve to a declared channel of this document (AsyncAPI 3.0 Operation Object channel)");
|
|
308408
308612
|
}
|
|
308409
308613
|
if (opChannel) {
|
|
308410
|
-
const channelMessages = Object.values(
|
|
308411
|
-
const opMessages = asArray15(op.messages).map(
|
|
308614
|
+
const channelMessages = Object.values(asRecord22(opChannel.messages) ?? {}).map(asRecord22).filter((m) => m !== null);
|
|
308615
|
+
const opMessages = asArray15(op.messages).map(asRecord22).filter((m) => m !== null);
|
|
308412
308616
|
for (const opMessage of opMessages) {
|
|
308413
308617
|
const inChannel = channelMessages.some((cm) => cm === opMessage || JSON.stringify(cm) === JSON.stringify(opMessage));
|
|
308414
308618
|
if (!inChannel) {
|
|
@@ -308416,16 +308620,16 @@ function lintMessages(ctx) {
|
|
|
308416
308620
|
}
|
|
308417
308621
|
}
|
|
308418
308622
|
}
|
|
308419
|
-
const reply =
|
|
308623
|
+
const reply = asRecord22(op.reply);
|
|
308420
308624
|
if (reply) {
|
|
308421
|
-
const replyChannel =
|
|
308422
|
-
const replyAddress =
|
|
308625
|
+
const replyChannel = asRecord22(reply.channel);
|
|
308626
|
+
const replyAddress = asRecord22(reply.address);
|
|
308423
308627
|
if (replyAddress && replyChannel && typeof replyChannel.address === "string" && replyChannel.address.length > 0) {
|
|
308424
308628
|
warnings.push("ASYNCAPI_REPLY_ADDRESS_CONFLICT: operation " + opName + " reply declares a dynamic reply address while its reply channel pins address " + JSON.stringify(replyChannel.address) + "; a dynamic reply channel address SHOULD be null (AsyncAPI 3.0 Operation Reply Object)");
|
|
308425
308629
|
}
|
|
308426
308630
|
if (replyChannel) {
|
|
308427
|
-
const replyChannelMessages = Object.values(
|
|
308428
|
-
const replyMessages = asArray15(reply.messages).map(
|
|
308631
|
+
const replyChannelMessages = Object.values(asRecord22(replyChannel.messages) ?? {}).map(asRecord22).filter((m) => m !== null);
|
|
308632
|
+
const replyMessages = asArray15(reply.messages).map(asRecord22).filter((m) => m !== null);
|
|
308429
308633
|
for (const replyMessage of replyMessages) {
|
|
308430
308634
|
const inChannel = replyChannelMessages.some((cm) => cm === replyMessage || JSON.stringify(cm) === JSON.stringify(replyMessage));
|
|
308431
308635
|
if (!inChannel) {
|
|
@@ -308437,8 +308641,8 @@ function lintMessages(ctx) {
|
|
|
308437
308641
|
}
|
|
308438
308642
|
}
|
|
308439
308643
|
function hasWsSurface(ctx) {
|
|
308440
|
-
for (const raw of Object.values(
|
|
308441
|
-
const server =
|
|
308644
|
+
for (const raw of Object.values(asRecord22(ctx.doc.servers) ?? {})) {
|
|
308645
|
+
const server = asRecord22(raw);
|
|
308442
308646
|
const protocol = typeof server?.protocol === "string" ? server.protocol.toLowerCase() : "";
|
|
308443
308647
|
if (SERVER_PROTOCOL_FAMILY[protocol] === "ws") return true;
|
|
308444
308648
|
}
|
|
@@ -308449,11 +308653,11 @@ var API_KEY_LOCATIONS_V2 = /* @__PURE__ */ new Set(["user", "password"]);
|
|
|
308449
308653
|
var SYNTHESIZABLE_SCHEME_TYPES = /* @__PURE__ */ new Set(["http", "httpApiKey", "apiKey", "userPassword"]);
|
|
308450
308654
|
function lintSecuritySchemes2(ctx) {
|
|
308451
308655
|
const { warnings } = ctx;
|
|
308452
|
-
const schemes =
|
|
308656
|
+
const schemes = asRecord22(asRecord22(ctx.doc.components)?.securitySchemes) ?? {};
|
|
308453
308657
|
const oauthLikeNames = /* @__PURE__ */ new Set();
|
|
308454
308658
|
const unsatisfiable = [];
|
|
308455
308659
|
for (const [name, raw] of Object.entries(schemes)) {
|
|
308456
|
-
const scheme =
|
|
308660
|
+
const scheme = asRecord22(raw);
|
|
308457
308661
|
if (!scheme) continue;
|
|
308458
308662
|
const type = typeof scheme.type === "string" ? scheme.type : "";
|
|
308459
308663
|
if (type === "oauth2" || type === "openIdConnect") oauthLikeNames.add(name);
|
|
@@ -308473,9 +308677,9 @@ function lintSecuritySchemes2(ctx) {
|
|
|
308473
308677
|
}
|
|
308474
308678
|
}
|
|
308475
308679
|
if (type === "oauth2") {
|
|
308476
|
-
const flows =
|
|
308680
|
+
const flows = asRecord22(scheme.flows) ?? {};
|
|
308477
308681
|
for (const [flowName, rawFlow] of Object.entries(flows)) {
|
|
308478
|
-
const flow =
|
|
308682
|
+
const flow = asRecord22(rawFlow);
|
|
308479
308683
|
if (!flow) continue;
|
|
308480
308684
|
for (const field of ["authorizationUrl", "tokenUrl", "refreshUrl"]) {
|
|
308481
308685
|
const url = flow[field];
|
|
@@ -308492,11 +308696,11 @@ function lintSecuritySchemes2(ctx) {
|
|
|
308492
308696
|
if (unsatisfiable.length > 0) {
|
|
308493
308697
|
warnings.push("ASYNCAPI_SECURITY_NOT_SYNTHESIZED: generated collection items carry no credential material for security scheme(s) " + unsatisfiable.join(", ") + "; connections that enforce them must be configured manually");
|
|
308494
308698
|
}
|
|
308495
|
-
for (const [serverName, raw] of Object.entries(
|
|
308496
|
-
const server =
|
|
308699
|
+
for (const [serverName, raw] of Object.entries(asRecord22(ctx.doc.servers) ?? {})) {
|
|
308700
|
+
const server = asRecord22(raw);
|
|
308497
308701
|
if (!server) continue;
|
|
308498
308702
|
asArray15(server.security).forEach((entry, i) => {
|
|
308499
|
-
const requirement =
|
|
308703
|
+
const requirement = asRecord22(entry);
|
|
308500
308704
|
if (!requirement) return;
|
|
308501
308705
|
for (const [schemeName, value] of Object.entries(requirement)) {
|
|
308502
308706
|
if (!Array.isArray(value)) {
|
|
@@ -308506,7 +308710,7 @@ function lintSecuritySchemes2(ctx) {
|
|
|
308506
308710
|
if (value.some((scope) => typeof scope !== "string")) {
|
|
308507
308711
|
warnings.push("ASYNCAPI_SECURITY_REQUIREMENT_INVALID: server " + serverName + " security requirement #" + i + " scopes for " + schemeName + " must be strings (AsyncAPI Security Requirement Object)");
|
|
308508
308712
|
}
|
|
308509
|
-
if (value.length > 0 && !oauthLikeNames.has(schemeName) &&
|
|
308713
|
+
if (value.length > 0 && !oauthLikeNames.has(schemeName) && asRecord22(schemes[schemeName])) {
|
|
308510
308714
|
warnings.push("ASYNCAPI_SECURITY_REQUIREMENT_INVALID: server " + serverName + " security requirement #" + i + " lists scopes for non-OAuth scheme " + schemeName + "; the array MUST be empty for such schemes (AsyncAPI Security Requirement Object)");
|
|
308511
308715
|
}
|
|
308512
308716
|
}
|
|
@@ -308516,7 +308720,7 @@ function lintSecuritySchemes2(ctx) {
|
|
|
308516
308720
|
function lintSocketIo(ctx) {
|
|
308517
308721
|
if (!ctx.socketIo) return;
|
|
308518
308722
|
const { warnings, doc } = ctx;
|
|
308519
|
-
const xSocketIo =
|
|
308723
|
+
const xSocketIo = asRecord22(doc["x-socketio"]) ?? {};
|
|
308520
308724
|
const declaredVersion = xSocketIo.version ?? xSocketIo.eio ?? xSocketIo.EIO;
|
|
308521
308725
|
if (declaredVersion !== void 0 && String(declaredVersion) !== "4") {
|
|
308522
308726
|
warnings.push("ASYNCAPI_SOCKETIO_VERSION_UNSUPPORTED: x-socketio declares version " + JSON.stringify(declaredVersion) + " but generated Socket.IO items target Socket.IO v4 / Engine.IO 4");
|
|
@@ -308525,8 +308729,8 @@ function lintSocketIo(ctx) {
|
|
|
308525
308729
|
if (typeof path10 === "string" && path10 !== "/socket.io/" && path10 !== "/socket.io") {
|
|
308526
308730
|
warnings.push("ASYNCAPI_SOCKETIO_PATH_UNSUPPORTED: x-socketio declares path " + JSON.stringify(path10) + " but generated Socket.IO items connect on the default /socket.io/ path");
|
|
308527
308731
|
}
|
|
308528
|
-
for (const [chName, rawCh] of Object.entries(
|
|
308529
|
-
const channel =
|
|
308732
|
+
for (const [chName, rawCh] of Object.entries(asRecord22(doc.channels) ?? {})) {
|
|
308733
|
+
const channel = asRecord22(rawCh);
|
|
308530
308734
|
if (!channel) continue;
|
|
308531
308735
|
const address = ctx.isV3 ? typeof channel.address === "string" ? channel.address : "" : chName;
|
|
308532
308736
|
if (address && address !== "/" && !address.startsWith("/")) {
|
|
@@ -308534,10 +308738,10 @@ function lintSocketIo(ctx) {
|
|
|
308534
308738
|
} else if (address && address !== "/") {
|
|
308535
308739
|
warnings.push("ASYNCAPI_SOCKETIO_NAMESPACE_NOT_ROUTED: channel " + chName + " implies Socket.IO namespace " + JSON.stringify(address) + " but generated items connect to the root namespace");
|
|
308536
308740
|
}
|
|
308537
|
-
const wsBinding =
|
|
308538
|
-
const queryProps =
|
|
308741
|
+
const wsBinding = asRecord22(asRecord22(channel.bindings)?.ws);
|
|
308742
|
+
const queryProps = asRecord22(asRecord22(wsBinding?.query)?.properties) ?? {};
|
|
308539
308743
|
for (const [propName2, rawProp] of Object.entries(queryProps)) {
|
|
308540
|
-
const prop =
|
|
308744
|
+
const prop = asRecord22(rawProp);
|
|
308541
308745
|
if (!prop) continue;
|
|
308542
308746
|
const declared = schemaDeclaredValues(prop).map(String);
|
|
308543
308747
|
if (propName2 === "EIO" && declared.some((v) => v !== "4")) {
|
|
@@ -308557,7 +308761,7 @@ function lintSocketIo(ctx) {
|
|
|
308557
308761
|
if (message.contentKind === "binary") {
|
|
308558
308762
|
warnings.push("ASYNCAPI_SOCKETIO_BINARY_NOT_SYNTHESIZED: channel " + channel.id + " message " + message.id + " is binary; generated Socket.IO events carry placeholder text arguments, not binary attachments");
|
|
308559
308763
|
}
|
|
308560
|
-
const ack =
|
|
308764
|
+
const ack = asRecord22(message.ackSchema);
|
|
308561
308765
|
if (ack) {
|
|
308562
308766
|
const declaredType = Array.isArray(ack.type) ? ack.type.map(String) : ack.type !== void 0 ? [String(ack.type)] : [];
|
|
308563
308767
|
if (declaredType.length > 0 && !declaredType.includes("array")) {
|
|
@@ -308568,7 +308772,7 @@ function lintSocketIo(ctx) {
|
|
|
308568
308772
|
}
|
|
308569
308773
|
}
|
|
308570
308774
|
function lintAsyncApiBindingSurfaces(index) {
|
|
308571
|
-
const doc =
|
|
308775
|
+
const doc = asRecord22(index.documentJson);
|
|
308572
308776
|
if (!doc) return [];
|
|
308573
308777
|
const ctx = {
|
|
308574
308778
|
index,
|
|
@@ -308590,7 +308794,7 @@ function lintAsyncApiBindingSurfaces(index) {
|
|
|
308590
308794
|
lintSocketIo(ctx);
|
|
308591
308795
|
for (const site of ctx.sites) {
|
|
308592
308796
|
if (site.scope !== "channel") continue;
|
|
308593
|
-
const wsBinding =
|
|
308797
|
+
const wsBinding = asRecord22(site.bindings.ws);
|
|
308594
308798
|
if (wsBinding) lintWsChannelBinding(ctx, site.label, wsBinding);
|
|
308595
308799
|
}
|
|
308596
308800
|
return ctx.warnings;
|
|
@@ -308602,7 +308806,7 @@ var ASYNCAPI_INSTRUMENT_LIMITS = {
|
|
|
308602
308806
|
};
|
|
308603
308807
|
var MESSAGE_NODE_TYPES = /* @__PURE__ */ new Set(["ws-raw-message", "ws-socketio-message", "mqtt-message"]);
|
|
308604
308808
|
var BASE64_RE = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/;
|
|
308605
|
-
function
|
|
308809
|
+
function asRecord23(value) {
|
|
308606
308810
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
308607
308811
|
return value;
|
|
308608
308812
|
}
|
|
@@ -308610,7 +308814,7 @@ function asArray16(value) {
|
|
|
308610
308814
|
return Array.isArray(value) ? value : [];
|
|
308611
308815
|
}
|
|
308612
308816
|
function schemaAllowsStringInstance(schema) {
|
|
308613
|
-
const record =
|
|
308817
|
+
const record = asRecord23(schema);
|
|
308614
308818
|
if (!record) return false;
|
|
308615
308819
|
const declared = record.type;
|
|
308616
308820
|
const types2 = Array.isArray(declared) ? declared.map(String) : declared !== void 0 ? [String(declared)] : [];
|
|
@@ -308703,18 +308907,18 @@ function checkMqttBindingValues(binding, scope, channelId, warnings) {
|
|
|
308703
308907
|
if (binding.messageExpiryInterval !== void 0 && !isNonNegativeInteger(binding.messageExpiryInterval)) bad("messageExpiryInterval", "must be a non-negative integer (seconds)");
|
|
308704
308908
|
if (binding.cleanSession !== void 0 && typeof binding.cleanSession !== "boolean") bad("cleanSession", "must be a boolean");
|
|
308705
308909
|
if (binding.keepAlive !== void 0 && !isIntegerInRange(binding.keepAlive, 0, 65535)) bad("keepAlive", "must be an integer in 0-65535 (seconds, MQTT two-byte Keep Alive)");
|
|
308706
|
-
if (binding.sessionExpiryInterval !== void 0 && !isIntegerInRange(binding.sessionExpiryInterval, 0, 4294967295) &&
|
|
308707
|
-
if (binding.maximumPacketSize !== void 0 && !isIntegerInRange(binding.maximumPacketSize, 1, 268435455) &&
|
|
308910
|
+
if (binding.sessionExpiryInterval !== void 0 && !isIntegerInRange(binding.sessionExpiryInterval, 0, 4294967295) && asRecord23(binding.sessionExpiryInterval) === null) bad("sessionExpiryInterval", "must be an integer in 0-4294967295 (seconds, MQTT 5.0 four-byte property) or a schema object");
|
|
308911
|
+
if (binding.maximumPacketSize !== void 0 && !isIntegerInRange(binding.maximumPacketSize, 1, 268435455) && asRecord23(binding.maximumPacketSize) === null) bad("maximumPacketSize", "must be an integer in 1-268435455 (bytes, MQTT 5.0 packet size limit) or a schema object");
|
|
308708
308912
|
if (binding.payloadFormatIndicator !== void 0 && binding.payloadFormatIndicator !== 0 && binding.payloadFormatIndicator !== 1) bad("payloadFormatIndicator", "must be 0 (unspecified bytes) or 1 (UTF-8)");
|
|
308709
308913
|
if (binding.contentType !== void 0 && typeof binding.contentType !== "string") bad("contentType", "must be a string");
|
|
308710
308914
|
if (typeof binding.responseTopic === "string") {
|
|
308711
308915
|
const violation = mqttTopicViolation(binding.responseTopic, false);
|
|
308712
308916
|
if (violation) warnings.push(`ASYNCAPI_MQTT_TOPIC_INVALID: channel ${channelId} ${scope} binding responseTopic "${binding.responseTopic}" ${violation}`);
|
|
308713
|
-
} else if (binding.responseTopic !== void 0 &&
|
|
308917
|
+
} else if (binding.responseTopic !== void 0 && asRecord23(binding.responseTopic) === null) {
|
|
308714
308918
|
bad("responseTopic", "must be a string or a schema object");
|
|
308715
308919
|
}
|
|
308716
308920
|
if (binding.correlationData !== void 0) {
|
|
308717
|
-
const correlationData =
|
|
308921
|
+
const correlationData = asRecord23(binding.correlationData);
|
|
308718
308922
|
if (!correlationData) {
|
|
308719
308923
|
bad("correlationData", "must be a Schema Object describing the binary correlation data");
|
|
308720
308924
|
} else if (correlationData.type !== "string" || correlationData.format !== "byte" && correlationData.format !== "binary") {
|
|
@@ -308723,7 +308927,7 @@ function checkMqttBindingValues(binding, scope, channelId, warnings) {
|
|
|
308723
308927
|
);
|
|
308724
308928
|
}
|
|
308725
308929
|
}
|
|
308726
|
-
const lastWill =
|
|
308930
|
+
const lastWill = asRecord23(binding.lastWill);
|
|
308727
308931
|
if (lastWill) {
|
|
308728
308932
|
if (typeof lastWill.topic === "string") {
|
|
308729
308933
|
const violation = mqttTopicViolation(lastWill.topic, false);
|
|
@@ -308738,14 +308942,14 @@ function checkMqttBindingValues(binding, scope, channelId, warnings) {
|
|
|
308738
308942
|
}
|
|
308739
308943
|
}
|
|
308740
308944
|
function channelHasPublishDirection(documentJson, channelId) {
|
|
308741
|
-
const channel =
|
|
308945
|
+
const channel = asRecord23(asRecord23(documentJson.channels)?.[channelId]);
|
|
308742
308946
|
if (channel?.publish !== void 0) return true;
|
|
308743
308947
|
const unescapePointer = (segment) => segment.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
308744
|
-
const operations =
|
|
308948
|
+
const operations = asRecord23(documentJson.operations) ?? {};
|
|
308745
308949
|
for (const operationRaw of Object.values(operations)) {
|
|
308746
|
-
const operation =
|
|
308950
|
+
const operation = asRecord23(operationRaw);
|
|
308747
308951
|
if (!operation || operation.action !== "send") continue;
|
|
308748
|
-
const opChannel =
|
|
308952
|
+
const opChannel = asRecord23(operation.channel);
|
|
308749
308953
|
if (!opChannel) continue;
|
|
308750
308954
|
if (channel && opChannel === channel) return true;
|
|
308751
308955
|
const uid = opChannel["x-parser-unique-object-id"];
|
|
@@ -308798,7 +309002,7 @@ function collectMessageNodeIds(node, ids, path10) {
|
|
|
308798
309002
|
}
|
|
308799
309003
|
const children4 = node.children !== void 0 ? asArray16(node.children) : asArray16(node.item);
|
|
308800
309004
|
children4.forEach((child4, i) => {
|
|
308801
|
-
const record =
|
|
309005
|
+
const record = asRecord23(child4);
|
|
308802
309006
|
if (record) collectMessageNodeIds(record, ids, `${path10}/${i}`);
|
|
308803
309007
|
});
|
|
308804
309008
|
}
|
|
@@ -308841,7 +309045,7 @@ function validateWsBinding(channel, warnings) {
|
|
|
308841
309045
|
for (const key of ["query", "headers"]) {
|
|
308842
309046
|
const schema = binding[key];
|
|
308843
309047
|
if (schema === void 0) continue;
|
|
308844
|
-
const record =
|
|
309048
|
+
const record = asRecord23(schema);
|
|
308845
309049
|
if (!record || record.type !== void 0 && record.type !== "object") {
|
|
308846
309050
|
warnings.push(`ASYNCAPI_WS_BINDING_INVALID: channel ${channel.id} ws binding ${key} must be a Schema Object of type object`);
|
|
308847
309051
|
}
|
|
@@ -308877,7 +309081,7 @@ function instrumentAsyncApiCollection(collection, index) {
|
|
|
308877
309081
|
const expected = index.channels.reduce((sum, channel) => sum + channel.messages.length, 0);
|
|
308878
309082
|
const ids = [];
|
|
308879
309083
|
asArray16(collection.item).forEach((entry, i) => {
|
|
308880
|
-
const record =
|
|
309084
|
+
const record = asRecord23(entry);
|
|
308881
309085
|
if (record) collectMessageNodeIds(record, ids, `item/${i}`);
|
|
308882
309086
|
});
|
|
308883
309087
|
const unique = new Set(ids).size;
|
|
@@ -309653,7 +309857,7 @@ var validateRegistryServerSchema = (() => {
|
|
|
309653
309857
|
}
|
|
309654
309858
|
}
|
|
309655
309859
|
})();
|
|
309656
|
-
function
|
|
309860
|
+
function asRecord24(value) {
|
|
309657
309861
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
309658
309862
|
return value;
|
|
309659
309863
|
}
|
|
@@ -309668,7 +309872,7 @@ function registrySchemaKey(key) {
|
|
|
309668
309872
|
}
|
|
309669
309873
|
function normalizeRegistrySchemaValue(value) {
|
|
309670
309874
|
if (Array.isArray(value)) return value.map((entry) => normalizeRegistrySchemaValue(entry));
|
|
309671
|
-
const record =
|
|
309875
|
+
const record = asRecord24(value);
|
|
309672
309876
|
if (!record) return value;
|
|
309673
309877
|
const out = {};
|
|
309674
309878
|
for (const [key, entry] of Object.entries(record)) {
|
|
@@ -309684,7 +309888,7 @@ function normalizeRegistryPackageForSchema(pkg) {
|
|
|
309684
309888
|
}
|
|
309685
309889
|
function normalizeRegistryManifestForSchema(record) {
|
|
309686
309890
|
const out = normalizeRegistrySchemaValue(record);
|
|
309687
|
-
if (Array.isArray(record.packages)) out.packages = record.packages.map((entry) => normalizeRegistryPackageForSchema(
|
|
309891
|
+
if (Array.isArray(record.packages)) out.packages = record.packages.map((entry) => normalizeRegistryPackageForSchema(asRecord24(entry) ?? {}));
|
|
309688
309892
|
return out;
|
|
309689
309893
|
}
|
|
309690
309894
|
function isRegistrySchemaDocument(record) {
|
|
@@ -309746,7 +309950,7 @@ function validateUriTemplate(value) {
|
|
|
309746
309950
|
return { variables: [...variables] };
|
|
309747
309951
|
}
|
|
309748
309952
|
function sampleFromSchema2(schema, depth) {
|
|
309749
|
-
const record =
|
|
309953
|
+
const record = asRecord24(schema);
|
|
309750
309954
|
if (!record) return record === null ? null : {};
|
|
309751
309955
|
if (record.example !== void 0) return record.example;
|
|
309752
309956
|
if (record.default !== void 0) return record.default;
|
|
@@ -309762,7 +309966,7 @@ function sampleFromSchema2(schema, depth) {
|
|
|
309762
309966
|
switch (type) {
|
|
309763
309967
|
case "object":
|
|
309764
309968
|
case void 0: {
|
|
309765
|
-
const properties =
|
|
309969
|
+
const properties = asRecord24(record.properties);
|
|
309766
309970
|
if (!properties) return {};
|
|
309767
309971
|
const required = new Set(asArray17(record.required));
|
|
309768
309972
|
const out = {};
|
|
@@ -309802,10 +310006,10 @@ function registryInputValue(name, input) {
|
|
|
309802
310006
|
}
|
|
309803
310007
|
function registryVariableValues(variables) {
|
|
309804
310008
|
const out = {};
|
|
309805
|
-
const record =
|
|
310009
|
+
const record = asRecord24(variables);
|
|
309806
310010
|
if (!record) return out;
|
|
309807
310011
|
for (const [name, input] of Object.entries(record)) {
|
|
309808
|
-
const value =
|
|
310012
|
+
const value = asRecord24(input);
|
|
309809
310013
|
if (value) out[name] = registryInputValue(name, value);
|
|
309810
310014
|
}
|
|
309811
310015
|
return out;
|
|
@@ -309818,7 +310022,7 @@ function resolveRegistryVariables(value, variables, context, warnings) {
|
|
|
309818
310022
|
});
|
|
309819
310023
|
}
|
|
309820
310024
|
function registryHeaderKeyValues(headers, variables = {}, warnings = [], context = "remote header") {
|
|
309821
|
-
return asArray17(headers).map((entry) =>
|
|
310025
|
+
return asArray17(headers).map((entry) => asRecord24(entry)).filter((entry) => entry !== null && typeof entry.name === "string" && entry.name !== "").map((entry) => {
|
|
309822
310026
|
const name = String(entry.name);
|
|
309823
310027
|
const value = registryInputValue(name, entry);
|
|
309824
310028
|
const resolvedValue = resolveRegistryVariables(value, variables, `${context} ${name}`, warnings);
|
|
@@ -309826,7 +310030,7 @@ function registryHeaderKeyValues(headers, variables = {}, warnings = [], context
|
|
|
309826
310030
|
});
|
|
309827
310031
|
}
|
|
309828
310032
|
function registryEnvKeyValues(variables) {
|
|
309829
|
-
return asArray17(variables).map((entry) =>
|
|
310033
|
+
return asArray17(variables).map((entry) => asRecord24(entry)).filter((entry) => entry !== null && typeof entry.name === "string" && entry.name !== "").map((entry) => {
|
|
309830
310034
|
const name = String(entry.name);
|
|
309831
310035
|
const secret = pickValue(entry, "isSecret", "is_secret") === true;
|
|
309832
310036
|
const value = typeof entry.value === "string" && entry.value && !secret ? entry.value : `{{${name}}}`;
|
|
@@ -309836,7 +310040,7 @@ function registryEnvKeyValues(variables) {
|
|
|
309836
310040
|
function stringArguments(values) {
|
|
309837
310041
|
return asArray17(values).map((entry) => {
|
|
309838
310042
|
if (typeof entry === "string") return entry;
|
|
309839
|
-
const record =
|
|
310043
|
+
const record = asRecord24(entry);
|
|
309840
310044
|
if (!record) return "";
|
|
309841
310045
|
if (typeof record.name === "string" && record.name) {
|
|
309842
310046
|
return typeof record.value === "string" && record.value ? `${record.name}=${record.value}` : String(record.name);
|
|
@@ -309873,11 +310077,11 @@ function hasModernPackageShape(pkg) {
|
|
|
309873
310077
|
return ["registryType", "runtimeHint", "runtimeArguments", "packageArguments", "environmentVariables"].some((key) => hasOwn(pkg, key));
|
|
309874
310078
|
}
|
|
309875
310079
|
function packageDescriptor(pkg, id, warnings) {
|
|
309876
|
-
if (pkg.transport !== void 0 &&
|
|
310080
|
+
if (pkg.transport !== void 0 && asRecord24(pkg.transport) === null) {
|
|
309877
310081
|
warnings.push(`MCP_PACKAGE_TRANSPORT_INVALID: server ${id} package transport must be an object when present; the package is skipped`);
|
|
309878
310082
|
return null;
|
|
309879
310083
|
}
|
|
309880
|
-
const transport =
|
|
310084
|
+
const transport = asRecord24(pkg.transport);
|
|
309881
310085
|
const transportType = typeof transport?.type === "string" ? String(transport.type).toLowerCase() : "";
|
|
309882
310086
|
if (transport) {
|
|
309883
310087
|
if (!transportType) {
|
|
@@ -309923,11 +310127,11 @@ function clientConfigDescriptor(id, entry) {
|
|
|
309923
310127
|
`MCP_STREAMABLE_HTTP_AS_SSE: server ${id} declares a ${type || "http"} remote; the Postman mcp-request item models only sse/stdio transports, so it is emitted as sse and the endpoint must speak SSE or be adjusted in-app`
|
|
309924
310128
|
);
|
|
309925
310129
|
}
|
|
309926
|
-
const headers = Object.entries(
|
|
310130
|
+
const headers = Object.entries(asRecord24(entry.headers) ?? {}).filter(([, value]) => typeof value === "string").map(([key, value]) => ({ key, value: String(value) }));
|
|
309927
310131
|
return { id, transport: "sse", url, headers, env: [], warnings };
|
|
309928
310132
|
}
|
|
309929
310133
|
const command = [typeof entry.command === "string" ? entry.command : "", ...stringArguments(entry.args)].filter(Boolean).join(" ");
|
|
309930
|
-
const env = Object.entries(
|
|
310134
|
+
const env = Object.entries(asRecord24(entry.env) ?? {}).filter(([, value]) => typeof value === "string").map(([key, value]) => ({ key, value: String(value) }));
|
|
309931
310135
|
return { id, transport: "stdio", headers: [], command, env, warnings: [] };
|
|
309932
310136
|
}
|
|
309933
310137
|
function toolDescriptor(tool, warnings) {
|
|
@@ -309936,7 +310140,7 @@ function toolDescriptor(tool, warnings) {
|
|
|
309936
310140
|
warnings.push("MCP_TOOL_NAME_MISSING: a tools[] entry has no name; it is skipped and generates no tools/call template");
|
|
309937
310141
|
return null;
|
|
309938
310142
|
}
|
|
309939
|
-
const inputSchema =
|
|
310143
|
+
const inputSchema = asRecord24(tool.inputSchema) ?? void 0;
|
|
309940
310144
|
const toolWarnings = [];
|
|
309941
310145
|
if (!inputSchema) {
|
|
309942
310146
|
toolWarnings.push(`MCP_TOOL_NO_INPUT_SCHEMA: tool ${name} declares no inputSchema; its tools/call arguments are an empty object and are not schema-validated`);
|
|
@@ -309945,8 +310149,8 @@ function toolDescriptor(tool, warnings) {
|
|
|
309945
310149
|
name,
|
|
309946
310150
|
description: typeof tool.description === "string" ? tool.description : void 0,
|
|
309947
310151
|
inputSchema,
|
|
309948
|
-
outputSchema:
|
|
309949
|
-
annotations:
|
|
310152
|
+
outputSchema: asRecord24(tool.outputSchema) ?? void 0,
|
|
310153
|
+
annotations: asRecord24(tool.annotations) ?? void 0,
|
|
309950
310154
|
sampleArguments: inputSchema ? sampleFromSchema2(inputSchema, 0) : {},
|
|
309951
310155
|
warnings: toolWarnings
|
|
309952
310156
|
};
|
|
@@ -309975,7 +310179,7 @@ function resourceDescriptor(resource, warnings) {
|
|
|
309975
310179
|
if (resource.mimeType !== void 0 && typeof resource.mimeType !== "string") {
|
|
309976
310180
|
resourceWarnings.push(`MCP_RESOURCE_FIELD_INVALID: resource ${name} mimeType must be a string when present`);
|
|
309977
310181
|
}
|
|
309978
|
-
if (resource.annotations !== void 0 && !
|
|
310182
|
+
if (resource.annotations !== void 0 && !asRecord24(resource.annotations)) {
|
|
309979
310183
|
resourceWarnings.push(`MCP_RESOURCE_ANNOTATIONS_INVALID: resource ${name} annotations must be an object when present`);
|
|
309980
310184
|
}
|
|
309981
310185
|
return {
|
|
@@ -309984,8 +310188,8 @@ function resourceDescriptor(resource, warnings) {
|
|
|
309984
310188
|
description: asOptionalString(resource.description),
|
|
309985
310189
|
uri,
|
|
309986
310190
|
mimeType: asOptionalString(resource.mimeType),
|
|
309987
|
-
meta:
|
|
309988
|
-
annotations:
|
|
310191
|
+
meta: asRecord24(resource._meta) ?? void 0,
|
|
310192
|
+
annotations: asRecord24(resource.annotations) ?? void 0,
|
|
309989
310193
|
warnings: resourceWarnings
|
|
309990
310194
|
};
|
|
309991
310195
|
}
|
|
@@ -310014,7 +310218,7 @@ function resourceTemplateDescriptor(template, warnings) {
|
|
|
310014
310218
|
if (template.mimeType !== void 0 && typeof template.mimeType !== "string") {
|
|
310015
310219
|
templateWarnings.push(`MCP_RESOURCE_TEMPLATE_FIELD_INVALID: resource template ${name} mimeType must be a string when present`);
|
|
310016
310220
|
}
|
|
310017
|
-
if (template.annotations !== void 0 && !
|
|
310221
|
+
if (template.annotations !== void 0 && !asRecord24(template.annotations)) {
|
|
310018
310222
|
templateWarnings.push(`MCP_RESOURCE_TEMPLATE_ANNOTATIONS_INVALID: resource template ${name} annotations must be an object when present`);
|
|
310019
310223
|
}
|
|
310020
310224
|
return {
|
|
@@ -310023,14 +310227,14 @@ function resourceTemplateDescriptor(template, warnings) {
|
|
|
310023
310227
|
description: asOptionalString(template.description),
|
|
310024
310228
|
uriTemplate,
|
|
310025
310229
|
mimeType: asOptionalString(template.mimeType),
|
|
310026
|
-
meta:
|
|
310027
|
-
annotations:
|
|
310230
|
+
meta: asRecord24(template._meta) ?? void 0,
|
|
310231
|
+
annotations: asRecord24(template.annotations) ?? void 0,
|
|
310028
310232
|
variables: inspectedTemplate.variables,
|
|
310029
310233
|
warnings: templateWarnings
|
|
310030
310234
|
};
|
|
310031
310235
|
}
|
|
310032
310236
|
function promptArgumentDescriptor(promptName, argument, warnings, index) {
|
|
310033
|
-
const record =
|
|
310237
|
+
const record = asRecord24(argument);
|
|
310034
310238
|
if (!record) {
|
|
310035
310239
|
warnings.push(`MCP_PROMPT_ARGUMENT_INVALID: prompt ${promptName} argument[${index}] must be an object`);
|
|
310036
310240
|
return null;
|
|
@@ -310069,7 +310273,7 @@ function promptDescriptor(prompt, warnings) {
|
|
|
310069
310273
|
if (prompt.arguments !== void 0 && !Array.isArray(prompt.arguments)) {
|
|
310070
310274
|
promptWarnings.push(`MCP_PROMPT_ARGUMENTS_INVALID: prompt ${name} arguments must be an array when present`);
|
|
310071
310275
|
}
|
|
310072
|
-
if (prompt.annotations !== void 0 && !
|
|
310276
|
+
if (prompt.annotations !== void 0 && !asRecord24(prompt.annotations)) {
|
|
310073
310277
|
promptWarnings.push(`MCP_PROMPT_ANNOTATIONS_INVALID: prompt ${name} annotations must be an object when present`);
|
|
310074
310278
|
}
|
|
310075
310279
|
const seenArgumentNames = /* @__PURE__ */ new Set();
|
|
@@ -310088,8 +310292,8 @@ function promptDescriptor(prompt, warnings) {
|
|
|
310088
310292
|
name,
|
|
310089
310293
|
title: asOptionalString(prompt.title),
|
|
310090
310294
|
description: asOptionalString(prompt.description),
|
|
310091
|
-
meta:
|
|
310092
|
-
annotations:
|
|
310295
|
+
meta: asRecord24(prompt._meta) ?? void 0,
|
|
310296
|
+
annotations: asRecord24(prompt.annotations) ?? void 0,
|
|
310093
310297
|
arguments: argumentsList,
|
|
310094
310298
|
warnings: promptWarnings
|
|
310095
310299
|
};
|
|
@@ -310104,17 +310308,17 @@ function parseMcpServerSpec(content) {
|
|
|
310104
310308
|
} catch (error2) {
|
|
310105
310309
|
throw new Error(`MCP_PARSE_FAILED: MCP server description is not valid JSON: ${error2 instanceof Error ? error2.message : String(error2)}`, { cause: error2 });
|
|
310106
310310
|
}
|
|
310107
|
-
const documentJson =
|
|
310311
|
+
const documentJson = asRecord24(parsed);
|
|
310108
310312
|
if (!documentJson) {
|
|
310109
310313
|
throw new Error("MCP_PARSE_FAILED: MCP server description must be a JSON object");
|
|
310110
310314
|
}
|
|
310111
310315
|
const warnings = [];
|
|
310112
310316
|
const servers = [];
|
|
310113
310317
|
if (isRegistrySchemaDocument(documentJson)) warnings.push(...registrySchemaWarnings(documentJson));
|
|
310114
|
-
const mcpServers =
|
|
310318
|
+
const mcpServers = asRecord24(documentJson.mcpServers);
|
|
310115
310319
|
if (mcpServers) {
|
|
310116
310320
|
for (const [id, entry] of Object.entries(mcpServers)) {
|
|
310117
|
-
const record =
|
|
310321
|
+
const record = asRecord24(entry);
|
|
310118
310322
|
if (!record) {
|
|
310119
310323
|
warnings.push(`MCP_SERVER_ENTRY_INVALID: mcpServers.${id} is not an object; it is skipped`);
|
|
310120
310324
|
continue;
|
|
@@ -310123,8 +310327,8 @@ function parseMcpServerSpec(content) {
|
|
|
310123
310327
|
}
|
|
310124
310328
|
}
|
|
310125
310329
|
const registryName = typeof documentJson.name === "string" ? documentJson.name : "";
|
|
310126
|
-
const remotes = asArray17(documentJson.remotes).map((entry) =>
|
|
310127
|
-
const packages = asArray17(documentJson.packages).map((entry) =>
|
|
310330
|
+
const remotes = asArray17(documentJson.remotes).map((entry) => asRecord24(entry)).filter((entry) => entry !== null);
|
|
310331
|
+
const packages = asArray17(documentJson.packages).map((entry) => asRecord24(entry)).filter((entry) => entry !== null);
|
|
310128
310332
|
if (!mcpServers && (remotes.length > 0 || packages.length > 0)) {
|
|
310129
310333
|
const multi = remotes.length + packages.length > 1;
|
|
310130
310334
|
remotes.forEach((remote, i) => {
|
|
@@ -310139,7 +310343,7 @@ function parseMcpServerSpec(content) {
|
|
|
310139
310343
|
if (servers.length === 0) {
|
|
310140
310344
|
throw new Error("MCP_NO_SERVERS: MCP description defines no servers (no mcpServers entries, remotes, or packages); contract generation requires at least one server");
|
|
310141
310345
|
}
|
|
310142
|
-
const toolsRaw = asArray17(documentJson.tools).map((entry) =>
|
|
310346
|
+
const toolsRaw = asArray17(documentJson.tools).map((entry) => asRecord24(entry)).filter((entry) => entry !== null).map((tool) => toolDescriptor(tool, warnings)).filter((tool) => tool !== null);
|
|
310143
310347
|
const seenToolNames = /* @__PURE__ */ new Set();
|
|
310144
310348
|
const tools = [];
|
|
310145
310349
|
for (const tool of toolsRaw) {
|
|
@@ -310151,7 +310355,7 @@ function parseMcpServerSpec(content) {
|
|
|
310151
310355
|
tools.push(tool);
|
|
310152
310356
|
}
|
|
310153
310357
|
tools.sort((a, b) => a.name.localeCompare(b.name));
|
|
310154
|
-
const resourcesRaw = asArray17(documentJson.resources).map((entry) =>
|
|
310358
|
+
const resourcesRaw = asArray17(documentJson.resources).map((entry) => asRecord24(entry)).filter((entry) => entry !== null).map((resource) => resourceDescriptor(resource, warnings)).filter((resource) => resource !== null);
|
|
310155
310359
|
const seenResourceNames = /* @__PURE__ */ new Set();
|
|
310156
310360
|
const resources = [];
|
|
310157
310361
|
for (const resource of resourcesRaw) {
|
|
@@ -310163,7 +310367,7 @@ function parseMcpServerSpec(content) {
|
|
|
310163
310367
|
resources.push(resource);
|
|
310164
310368
|
}
|
|
310165
310369
|
resources.sort((a, b) => a.name.localeCompare(b.name));
|
|
310166
|
-
const resourceTemplatesRaw = asArray17(documentJson.resourceTemplates).map((entry) =>
|
|
310370
|
+
const resourceTemplatesRaw = asArray17(documentJson.resourceTemplates).map((entry) => asRecord24(entry)).filter((entry) => entry !== null).map((template) => resourceTemplateDescriptor(template, warnings)).filter((template) => template !== null);
|
|
310167
310371
|
const seenTemplateNames = /* @__PURE__ */ new Set();
|
|
310168
310372
|
const resourceTemplates = [];
|
|
310169
310373
|
for (const template of resourceTemplatesRaw) {
|
|
@@ -310175,7 +310379,7 @@ function parseMcpServerSpec(content) {
|
|
|
310175
310379
|
resourceTemplates.push(template);
|
|
310176
310380
|
}
|
|
310177
310381
|
resourceTemplates.sort((a, b) => a.name.localeCompare(b.name));
|
|
310178
|
-
const promptsRaw = asArray17(documentJson.prompts).map((entry) =>
|
|
310382
|
+
const promptsRaw = asArray17(documentJson.prompts).map((entry) => asRecord24(entry)).filter((entry) => entry !== null).map((prompt) => promptDescriptor(prompt, warnings)).filter((prompt) => prompt !== null);
|
|
310179
310383
|
const seenPromptNames = /* @__PURE__ */ new Set();
|
|
310180
310384
|
const prompts = [];
|
|
310181
310385
|
for (const prompt of promptsRaw) {
|
|
@@ -310187,10 +310391,10 @@ function parseMcpServerSpec(content) {
|
|
|
310187
310391
|
prompts.push(prompt);
|
|
310188
310392
|
}
|
|
310189
310393
|
prompts.sort((a, b) => a.name.localeCompare(b.name));
|
|
310190
|
-
const versionDetail =
|
|
310394
|
+
const versionDetail = asRecord24(documentJson.version_detail);
|
|
310191
310395
|
const version = typeof documentJson.version === "string" ? documentJson.version : typeof versionDetail?.version === "string" ? String(versionDetail.version) : void 0;
|
|
310192
310396
|
servers.sort((a, b) => a.id.localeCompare(b.id));
|
|
310193
|
-
const capabilities =
|
|
310397
|
+
const capabilities = asRecord24(documentJson.capabilities);
|
|
310194
310398
|
if (documentJson.capabilities !== void 0 && !capabilities) {
|
|
310195
310399
|
warnings.push(`MCP_CAPABILITIES_INVALID: top-level capabilities must be an object when present; got ${JSON.stringify(documentJson.capabilities)}`);
|
|
310196
310400
|
}
|
|
@@ -310927,7 +311131,7 @@ function oldSessionPingScript() {
|
|
|
310927
311131
|
|
|
310928
311132
|
// src/lib/protocols/mcp/mcp-collection-builder.ts
|
|
310929
311133
|
var MCP_TOOLS_LIST_PAGINATION_PROBE_COUNT = 5;
|
|
310930
|
-
function
|
|
311134
|
+
function asRecord25(value) {
|
|
310931
311135
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
310932
311136
|
return value;
|
|
310933
311137
|
}
|
|
@@ -310982,7 +311186,7 @@ function promptsListMessage() {
|
|
|
310982
311186
|
return jsonRpc(9, "prompts/list", {});
|
|
310983
311187
|
}
|
|
310984
311188
|
function toolArguments(tool) {
|
|
310985
|
-
return
|
|
311189
|
+
return asRecord25(tool.sampleArguments) ?? {};
|
|
310986
311190
|
}
|
|
310987
311191
|
function promptArguments(prompt) {
|
|
310988
311192
|
const out = {};
|
|
@@ -311286,7 +311490,7 @@ var MIME_TYPE_RE = /^[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]*\/[A-Za-z0-9][A-Za-z0-9!#$&
|
|
|
311286
311490
|
var TOOL_FIELDS_2025_06_18 = /* @__PURE__ */ new Set(["name", "title", "description", "inputSchema", "outputSchema", "annotations", "_meta"]);
|
|
311287
311491
|
var JSON_RPC_STANDARD_ERROR_CODES = /* @__PURE__ */ new Set([-32700, -32600, -32601, -32602, -32603]);
|
|
311288
311492
|
var MCP_PROTOCOL_VERSIONS = /* @__PURE__ */ new Set(["2024-11-05", "2025-03-26", "2025-06-18", "2025-11-25"]);
|
|
311289
|
-
function
|
|
311493
|
+
function asRecord26(value) {
|
|
311290
311494
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
311291
311495
|
return value;
|
|
311292
311496
|
}
|
|
@@ -311302,7 +311506,7 @@ function isStrictBase64(value) {
|
|
|
311302
311506
|
}
|
|
311303
311507
|
}
|
|
311304
311508
|
function walkDocument(value, path10, visit4) {
|
|
311305
|
-
const record =
|
|
311509
|
+
const record = asRecord26(value);
|
|
311306
311510
|
if (record) {
|
|
311307
311511
|
visit4(record, path10);
|
|
311308
311512
|
for (const [key, child4] of Object.entries(record)) walkDocument(child4, `${path10}.${key}`, visit4);
|
|
@@ -311315,10 +311519,10 @@ function validateStaticContentBlock(block2, label, warnings) {
|
|
|
311315
311519
|
warnings.push(`MCP_STATIC_CONTENT_BLOCK_INVALID: ${label} content block type must be a string`);
|
|
311316
311520
|
return;
|
|
311317
311521
|
}
|
|
311318
|
-
if (block2.annotations !== void 0 &&
|
|
311522
|
+
if (block2.annotations !== void 0 && asRecord26(block2.annotations) === null) {
|
|
311319
311523
|
warnings.push(`MCP_STATIC_CONTENT_BLOCK_INVALID: ${label} annotations must be an object when present`);
|
|
311320
311524
|
}
|
|
311321
|
-
if (block2._meta !== void 0 &&
|
|
311525
|
+
if (block2._meta !== void 0 && asRecord26(block2._meta) === null) {
|
|
311322
311526
|
warnings.push(`MCP_STATIC_CONTENT_BLOCK_INVALID: ${label} _meta must be an object when present`);
|
|
311323
311527
|
}
|
|
311324
311528
|
if (block2.type === "text") {
|
|
@@ -311331,7 +311535,7 @@ function validateStaticContentBlock(block2, label, warnings) {
|
|
|
311331
311535
|
return;
|
|
311332
311536
|
}
|
|
311333
311537
|
if (block2.type === "resource") {
|
|
311334
|
-
const resource =
|
|
311538
|
+
const resource = asRecord26(block2.resource);
|
|
311335
311539
|
if (!resource) {
|
|
311336
311540
|
warnings.push(`MCP_STATIC_CONTENT_BLOCK_INVALID: ${label} resource content block must carry a resource object`);
|
|
311337
311541
|
return;
|
|
@@ -311345,7 +311549,7 @@ function validateStaticContentBlock(block2, label, warnings) {
|
|
|
311345
311549
|
warnings.push(`MCP_STATIC_CONTENT_BLOCK_INVALID: ${label} content block type "${block2.type}" is not a known MCP 2025-06-18 content discriminator`);
|
|
311346
311550
|
}
|
|
311347
311551
|
function validateStaticResultFixture(record, path10, warnings) {
|
|
311348
|
-
const result =
|
|
311552
|
+
const result = asRecord26(record.result);
|
|
311349
311553
|
if (!result) return;
|
|
311350
311554
|
for (const key of ["tools", "resources", "prompts"]) {
|
|
311351
311555
|
if (result[key] !== void 0 && !Array.isArray(result[key])) warnings.push(`MCP_STATIC_PAGINATION_RESULT_INVALID: ${path10}.${key} must be an array in static list-result fixtures`);
|
|
@@ -311355,8 +311559,8 @@ function validateStaticResultFixture(record, path10, warnings) {
|
|
|
311355
311559
|
}
|
|
311356
311560
|
if (result.protocolVersion !== void 0 || result.capabilities !== void 0 || result.serverInfo !== void 0) {
|
|
311357
311561
|
if (typeof result.protocolVersion !== "string" || !MCP_PROTOCOL_VERSIONS.has(result.protocolVersion)) warnings.push(`MCP_STATIC_INITIALIZE_RESULT_INVALID: ${path10}.protocolVersion must be a supported MCP protocol version`);
|
|
311358
|
-
if (
|
|
311359
|
-
const serverInfo =
|
|
311562
|
+
if (asRecord26(result.capabilities) === null) warnings.push(`MCP_STATIC_INITIALIZE_RESULT_INVALID: ${path10}.capabilities must be an object`);
|
|
311563
|
+
const serverInfo = asRecord26(result.serverInfo);
|
|
311360
311564
|
if (!serverInfo) warnings.push(`MCP_STATIC_INITIALIZE_RESULT_INVALID: ${path10}.serverInfo must be an object`);
|
|
311361
311565
|
else {
|
|
311362
311566
|
if (typeof serverInfo.name !== "string" || !serverInfo.name) warnings.push(`MCP_STATIC_INITIALIZE_RESULT_INVALID: ${path10}.serverInfo.name must be a non-empty string`);
|
|
@@ -311366,7 +311570,7 @@ function validateStaticResultFixture(record, path10, warnings) {
|
|
|
311366
311570
|
}
|
|
311367
311571
|
function validateStaticJsonRpcFixtures(index, warnings) {
|
|
311368
311572
|
walkDocument(index.documentJson, "$", (record, path10) => {
|
|
311369
|
-
const error2 =
|
|
311573
|
+
const error2 = asRecord26(record.error);
|
|
311370
311574
|
if (record.jsonrpc === "2.0" && error2) {
|
|
311371
311575
|
if (typeof error2.code !== "number" || Math.floor(error2.code) !== error2.code) warnings.push(`MCP_STATIC_ERROR_CODE_INVALID: ${path10}.error.code must be an integer JSON-RPC error code`);
|
|
311372
311576
|
else if (error2.code >= -32768 && error2.code <= -32e3 && !JSON_RPC_STANDARD_ERROR_CODES.has(error2.code) && !(error2.code >= -32099 && error2.code <= -32e3)) warnings.push(`MCP_STATIC_ERROR_CODE_INVALID: ${path10}.error.code ${error2.code} is inside the reserved JSON-RPC range but is not a standard or server-error code`);
|
|
@@ -311375,19 +311579,19 @@ function validateStaticJsonRpcFixtures(index, warnings) {
|
|
|
311375
311579
|
validateStaticResultFixture(record, path10, warnings);
|
|
311376
311580
|
if (Array.isArray(record.content)) {
|
|
311377
311581
|
record.content.forEach((entry, i) => {
|
|
311378
|
-
const block2 =
|
|
311582
|
+
const block2 = asRecord26(entry);
|
|
311379
311583
|
if (block2) validateStaticContentBlock(block2, `${path10}.content[${i}]`, warnings);
|
|
311380
311584
|
});
|
|
311381
311585
|
}
|
|
311382
311586
|
if (Array.isArray(record.messages)) {
|
|
311383
311587
|
record.messages.forEach((entry, i) => {
|
|
311384
|
-
const message =
|
|
311588
|
+
const message = asRecord26(entry);
|
|
311385
311589
|
if (!message) {
|
|
311386
311590
|
warnings.push(`MCP_STATIC_PROMPT_MESSAGE_INVALID: ${path10}.messages[${i}] must be an object`);
|
|
311387
311591
|
return;
|
|
311388
311592
|
}
|
|
311389
311593
|
if (message.role !== "user" && message.role !== "assistant") warnings.push(`MCP_STATIC_PROMPT_MESSAGE_INVALID: ${path10}.messages[${i}].role must be user or assistant`);
|
|
311390
|
-
const content =
|
|
311594
|
+
const content = asRecord26(message.content);
|
|
311391
311595
|
if (!content) warnings.push(`MCP_STATIC_PROMPT_MESSAGE_INVALID: ${path10}.messages[${i}].content must be a content block object`);
|
|
311392
311596
|
else validateStaticContentBlock(content, `${path10}.messages[${i}].content`, warnings);
|
|
311393
311597
|
});
|
|
@@ -311401,10 +311605,10 @@ function walkManifest(value, path10, warnings) {
|
|
|
311401
311605
|
return;
|
|
311402
311606
|
}
|
|
311403
311607
|
const record = value;
|
|
311404
|
-
if (Object.prototype.hasOwnProperty.call(record, "_meta") &&
|
|
311608
|
+
if (Object.prototype.hasOwnProperty.call(record, "_meta") && asRecord26(record._meta) === null) {
|
|
311405
311609
|
warnings.push(`MCP_META_OBJECT_INVALID: ${path10}._meta must be an object when present (MCP 2025-06-18 BaseMetadata)`);
|
|
311406
311610
|
}
|
|
311407
|
-
const meta =
|
|
311611
|
+
const meta = asRecord26(record._meta);
|
|
311408
311612
|
if (meta) {
|
|
311409
311613
|
for (const key of Object.keys(meta)) {
|
|
311410
311614
|
if (!META_KEY_RE.test(key)) {
|
|
@@ -311423,7 +311627,7 @@ function walkManifest(value, path10, warnings) {
|
|
|
311423
311627
|
}
|
|
311424
311628
|
function validateManifestDocument(index, warnings) {
|
|
311425
311629
|
walkManifest(index.documentJson, "$", warnings);
|
|
311426
|
-
const tools = asArray18(index.documentJson.tools).map((entry) =>
|
|
311630
|
+
const tools = asArray18(index.documentJson.tools).map((entry) => asRecord26(entry)).filter((entry) => entry !== null);
|
|
311427
311631
|
const seen = /* @__PURE__ */ new Set();
|
|
311428
311632
|
for (const tool of tools) {
|
|
311429
311633
|
const name = typeof tool.name === "string" ? tool.name : "<unnamed>";
|
|
@@ -311442,7 +311646,7 @@ function validateManifestDocument(index, warnings) {
|
|
|
311442
311646
|
warnings.push(`MCP_TOOL_FIELD_UNKNOWN_2025_06_18: tool ${name} field "${field}" is not part of the MCP 2025-06-18 Tool object`);
|
|
311443
311647
|
}
|
|
311444
311648
|
}
|
|
311445
|
-
const annotations =
|
|
311649
|
+
const annotations = asRecord26(tool.annotations);
|
|
311446
311650
|
if (typeof tool.title === "string" && typeof annotations?.title === "string") {
|
|
311447
311651
|
warnings.push(`MCP_TOOL_TITLE_PRECEDENCE: tool ${name} declares both title and annotations.title; clients should prefer title for MCP 2025-06-18 display metadata`);
|
|
311448
311652
|
}
|
|
@@ -311463,7 +311667,7 @@ function validateCapabilities(index, warnings) {
|
|
|
311463
311667
|
shaped[name] = null;
|
|
311464
311668
|
continue;
|
|
311465
311669
|
}
|
|
311466
|
-
const record =
|
|
311670
|
+
const record = asRecord26(value);
|
|
311467
311671
|
if (!record) {
|
|
311468
311672
|
warnings.push(`MCP_CAPABILITY_SHAPE_INVALID: capabilities.${name} must be an object when present; got ${JSON.stringify(value)}`);
|
|
311469
311673
|
shaped[name] = null;
|
|
@@ -311519,7 +311723,7 @@ function itemServerScope(itemTitle) {
|
|
|
311519
311723
|
return separator === -1 ? itemTitle : itemTitle.slice(0, separator);
|
|
311520
311724
|
}
|
|
311521
311725
|
function assertRecordValue(value, reason, fail2) {
|
|
311522
|
-
const record =
|
|
311726
|
+
const record = asRecord26(value);
|
|
311523
311727
|
if (!record) fail2(reason);
|
|
311524
311728
|
return record;
|
|
311525
311729
|
}
|
|
@@ -311541,7 +311745,7 @@ function assertJsonRpcRequest(message, itemTitle) {
|
|
|
311541
311745
|
} catch {
|
|
311542
311746
|
return fail2("message is not valid JSON");
|
|
311543
311747
|
}
|
|
311544
|
-
const record =
|
|
311748
|
+
const record = asRecord26(parsed);
|
|
311545
311749
|
if (!record) return fail2("message is not a JSON object");
|
|
311546
311750
|
if (record.jsonrpc !== "2.0") return fail2('jsonrpc must be the string "2.0"');
|
|
311547
311751
|
if (typeof record.method !== "string" || !record.method) return fail2("method must be a non-empty string");
|
|
@@ -311553,7 +311757,7 @@ function assertJsonRpcRequest(message, itemTitle) {
|
|
|
311553
311757
|
} else {
|
|
311554
311758
|
return fail2("id must be a string or number");
|
|
311555
311759
|
}
|
|
311556
|
-
if (record.params !== void 0 &&
|
|
311760
|
+
if (record.params !== void 0 && asRecord26(record.params) === null) return fail2("params must be an object when present");
|
|
311557
311761
|
switch (record.method) {
|
|
311558
311762
|
case "notifications/initialized":
|
|
311559
311763
|
assertOptionalObjectParams(record, "notifications/initialized", fail2);
|
|
@@ -311586,14 +311790,14 @@ function assertJsonRpcRequest(message, itemTitle) {
|
|
|
311586
311790
|
case "prompts/get": {
|
|
311587
311791
|
const params = assertObjectParams(record, "prompts/get", fail2);
|
|
311588
311792
|
if (typeof params.name !== "string" || !params.name) fail2("prompts/get params.name must be a non-empty string");
|
|
311589
|
-
if (params.arguments !== void 0 &&
|
|
311793
|
+
if (params.arguments !== void 0 && asRecord26(params.arguments) === null) fail2("prompts/get params.arguments must be an object when present");
|
|
311590
311794
|
break;
|
|
311591
311795
|
}
|
|
311592
311796
|
case "tools/call": {
|
|
311593
311797
|
const params = assertObjectParams(record, "tools/call", fail2);
|
|
311594
311798
|
if (typeof params.name !== "string" || !params.name) fail2("tools/call params.name must be a non-empty string");
|
|
311595
|
-
if (params.arguments !== void 0 &&
|
|
311596
|
-
if (params._meta !== void 0 &&
|
|
311799
|
+
if (params.arguments !== void 0 && asRecord26(params.arguments) === null) fail2("tools/call params.arguments must be an object when present");
|
|
311800
|
+
if (params._meta !== void 0 && asRecord26(params._meta) === null) fail2("tools/call params._meta must be an object when present");
|
|
311597
311801
|
break;
|
|
311598
311802
|
}
|
|
311599
311803
|
case "ping":
|
|
@@ -311694,7 +311898,7 @@ function instrumentMcpCollection(collection, index) {
|
|
|
311694
311898
|
validateAnnotatedDeclarations(index, warnings);
|
|
311695
311899
|
validateStaticJsonRpcFixtures(index, warnings);
|
|
311696
311900
|
for (const tool of index.tools) warnings.push(...toolsCallScript(index, tool).warnings);
|
|
311697
|
-
const items = asArray18(collection.item).map((entry) =>
|
|
311901
|
+
const items = asArray18(collection.item).map((entry) => asRecord26(entry)).filter((entry) => entry !== null);
|
|
311698
311902
|
const ids = [];
|
|
311699
311903
|
const httpIds = [];
|
|
311700
311904
|
const requestIdsByServer = /* @__PURE__ */ new Set();
|
|
@@ -311702,7 +311906,7 @@ function instrumentMcpCollection(collection, index) {
|
|
|
311702
311906
|
if (String(item.type) === "mcp-request") {
|
|
311703
311907
|
ids.push(typeof item.id === "string" && item.id ? item.id : `#${ids.length}`);
|
|
311704
311908
|
const itemTitle = String(item.title ?? item.id ?? "mcp-request");
|
|
311705
|
-
const request = assertJsonRpcRequest(
|
|
311909
|
+
const request = assertJsonRpcRequest(asRecord26(item.payload)?.message, itemTitle);
|
|
311706
311910
|
if (request.id !== void 0) {
|
|
311707
311911
|
const scopedId = `${itemServerScope(itemTitle)}\0${typeof request.id === "number" ? `n:${request.id}` : `s:${request.id}`}`;
|
|
311708
311912
|
if (requestIdsByServer.has(scopedId)) {
|