@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/action.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
|
}
|
|
@@ -258629,6 +258629,9 @@ function normalizeGitRepoUrl(url) {
|
|
|
258629
258629
|
// src/lib/postman/internal-integration-adapter.ts
|
|
258630
258630
|
var BifrostInternalIntegrationAdapter = class _BifrostInternalIntegrationAdapter {
|
|
258631
258631
|
static MINIMUM_POSTMAN_APP_VERSION = "12.0.0";
|
|
258632
|
+
/** Per-request wall-clock deadline (ms) so a hung Bifrost proxy or app-version
|
|
258633
|
+
* endpoint aborts rather than blocking the run forever. */
|
|
258634
|
+
static REQUEST_TIMEOUT_MS = 3e4;
|
|
258632
258635
|
static POSTMAN_APP_VERSION_URL = `https://dl.pstmn.io/update/status?currentVersion=${_BifrostInternalIntegrationAdapter.MINIMUM_POSTMAN_APP_VERSION}&platform=osx_arm64`;
|
|
258633
258636
|
accessToken;
|
|
258634
258637
|
tokenProvider;
|
|
@@ -258673,6 +258676,23 @@ var BifrostInternalIntegrationAdapter = class _BifrostInternalIntegrationAdapter
|
|
|
258673
258676
|
mask: this.secretMasker
|
|
258674
258677
|
};
|
|
258675
258678
|
}
|
|
258679
|
+
/**
|
|
258680
|
+
* fetch with a wall-clock deadline. A slow/hung proxy aborts instead of
|
|
258681
|
+
* blocking the run forever; callers surface the abort like any other transport
|
|
258682
|
+
* rejection.
|
|
258683
|
+
*/
|
|
258684
|
+
async fetchWithDeadline(input, init = {}) {
|
|
258685
|
+
const controller = new AbortController();
|
|
258686
|
+
const timer = setTimeout(
|
|
258687
|
+
() => controller.abort(),
|
|
258688
|
+
_BifrostInternalIntegrationAdapter.REQUEST_TIMEOUT_MS
|
|
258689
|
+
);
|
|
258690
|
+
try {
|
|
258691
|
+
return await this.fetchImpl(input, { ...init, signal: controller.signal });
|
|
258692
|
+
} finally {
|
|
258693
|
+
clearTimeout(timer);
|
|
258694
|
+
}
|
|
258695
|
+
}
|
|
258676
258696
|
async proxyRequest(service, method, requestPath2, body2, options = {}) {
|
|
258677
258697
|
const url = `${this.bifrostBaseUrl}/ws/proxy`;
|
|
258678
258698
|
const headers = {
|
|
@@ -258685,7 +258705,7 @@ var BifrostInternalIntegrationAdapter = class _BifrostInternalIntegrationAdapter
|
|
|
258685
258705
|
if (this.teamId && this.orgMode) {
|
|
258686
258706
|
headers["x-entity-team-id"] = this.teamId;
|
|
258687
258707
|
}
|
|
258688
|
-
return this.
|
|
258708
|
+
return this.fetchWithDeadline(url, {
|
|
258689
258709
|
method: "POST",
|
|
258690
258710
|
headers,
|
|
258691
258711
|
body: JSON.stringify({
|
|
@@ -258700,7 +258720,7 @@ var BifrostInternalIntegrationAdapter = class _BifrostInternalIntegrationAdapter
|
|
|
258700
258720
|
resolvePostmanAppVersion() {
|
|
258701
258721
|
this.appVersionPromise ??= (async () => {
|
|
258702
258722
|
try {
|
|
258703
|
-
const response = await this.
|
|
258723
|
+
const response = await this.fetchWithDeadline(
|
|
258704
258724
|
_BifrostInternalIntegrationAdapter.POSTMAN_APP_VERSION_URL,
|
|
258705
258725
|
{ method: "GET" }
|
|
258706
258726
|
);
|
|
@@ -263902,6 +263922,25 @@ function asRecord8(value) {
|
|
|
263902
263922
|
}
|
|
263903
263923
|
return value;
|
|
263904
263924
|
}
|
|
263925
|
+
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}$/;
|
|
263926
|
+
function isMissingPatchValueError(error2) {
|
|
263927
|
+
return error2 instanceof HttpError && error2.status === 400 && error2.responseBody.includes("Remove operation must point to an existing value");
|
|
263928
|
+
}
|
|
263929
|
+
function canonicalize(value) {
|
|
263930
|
+
if (Array.isArray(value)) return value.map(canonicalize);
|
|
263931
|
+
if (value && typeof value === "object") {
|
|
263932
|
+
const record = value;
|
|
263933
|
+
const out = {};
|
|
263934
|
+
for (const key of Object.keys(record).sort()) {
|
|
263935
|
+
out[key] = canonicalize(record[key]);
|
|
263936
|
+
}
|
|
263937
|
+
return out;
|
|
263938
|
+
}
|
|
263939
|
+
return value;
|
|
263940
|
+
}
|
|
263941
|
+
function deepEqual(a, b) {
|
|
263942
|
+
return JSON.stringify(canonicalize(a)) === JSON.stringify(canonicalize(b));
|
|
263943
|
+
}
|
|
263905
263944
|
function resolvePollBudget(explicit, envValue, fallback, min) {
|
|
263906
263945
|
if (typeof explicit === "number" && Number.isFinite(explicit) && explicit >= min) return explicit;
|
|
263907
263946
|
if (envValue !== void 0) {
|
|
@@ -264082,6 +264121,9 @@ var PostmanGatewayAssetsClient = class _PostmanGatewayAssetsClient {
|
|
|
264082
264121
|
service: "specification",
|
|
264083
264122
|
method: "patch",
|
|
264084
264123
|
path: `/specifications/${specId}/files/${fileId}`,
|
|
264124
|
+
// Replacing the ROOT file content with the same value is idempotent, so a
|
|
264125
|
+
// transient downstream timeout (ESOCKETTIMEDOUT) is safe to retry.
|
|
264126
|
+
retry: "safe",
|
|
264085
264127
|
body: [{ op: "replace", path: "/content", value: specContent }]
|
|
264086
264128
|
});
|
|
264087
264129
|
}
|
|
@@ -264257,7 +264299,8 @@ var PostmanGatewayAssetsClient = class _PostmanGatewayAssetsClient {
|
|
|
264257
264299
|
service: "collection",
|
|
264258
264300
|
method: "patch",
|
|
264259
264301
|
path: `/v3/collections/${this.bareModelId(collectionId)}`,
|
|
264260
|
-
|
|
264302
|
+
// Replacing a generated collection's name with the same value is idempotent.
|
|
264303
|
+
retry: "safe",
|
|
264261
264304
|
body: [{ op: "replace", path: "/name", value: name }]
|
|
264262
264305
|
});
|
|
264263
264306
|
}
|
|
@@ -264456,15 +264499,32 @@ var PostmanGatewayAssetsClient = class _PostmanGatewayAssetsClient {
|
|
|
264456
264499
|
}
|
|
264457
264500
|
// --- collection v3 mutation + tagging (live-proven 2026-06-30; see docs/REST-to-gateway.md) ---
|
|
264458
264501
|
//
|
|
264459
|
-
// These retire bootstrap's last asset-op PMAK dependencies.
|
|
264460
|
-
//
|
|
264461
|
-
//
|
|
264462
|
-
//
|
|
264463
|
-
|
|
264502
|
+
// These retire bootstrap's last asset-op PMAK dependencies. Collection ROOT
|
|
264503
|
+
// routes (GET/PATCH/DELETE `/v3/collections/:id`) accept the bare model id.
|
|
264504
|
+
// Collection ITEMS routes (`/v3/collections/:id/items/...`) must use the FULL
|
|
264505
|
+
// public uid (`<owner>-<uuid>`): bare model ids are flaky on org-mode squads
|
|
264506
|
+
// (live-proven 2026-07-14 on team 172912 / Northwind — immediate post-generation
|
|
264507
|
+
// `GET .../items/` returns 403 FORBIDDEN with bare id, 200 with full uid).
|
|
264508
|
+
// The tagging service is distinct and takes the FULL uid.
|
|
264509
|
+
/**
|
|
264510
|
+
* `<owner>-<uuid>` public uid -> bare `<uuid>` model id (collection ROOT routes
|
|
264511
|
+
* only). Strip ONLY the numeric owner prefix of a full public uid; a bare UUID
|
|
264512
|
+
* (which itself contains hyphens) must pass through unchanged, so a naive
|
|
264513
|
+
* split on the first hyphen — which would lop off a UUID's first segment — is
|
|
264514
|
+
* rejected here in favour of an anchored `<digits>-<uuid>` match.
|
|
264515
|
+
*/
|
|
264464
264516
|
bareModelId(uid) {
|
|
264465
264517
|
const u = String(uid ?? "").trim();
|
|
264518
|
+
if (BOOTSTRAP_BARE_UUID_RE.test(u)) return u;
|
|
264466
264519
|
return u.includes("-") ? u.slice(u.indexOf("-") + 1) : u;
|
|
264467
264520
|
}
|
|
264521
|
+
/**
|
|
264522
|
+
* Collection id for ITEMS routes. Prefer the full public uid; fall back to the
|
|
264523
|
+
* trimmed input when the caller already has a bare/model id.
|
|
264524
|
+
*/
|
|
264525
|
+
collectionItemsId(uid) {
|
|
264526
|
+
return String(uid ?? "").trim();
|
|
264527
|
+
}
|
|
264468
264528
|
/**
|
|
264469
264529
|
* PATCH a freshly-created item's `/scripts`, tolerating the two transient
|
|
264470
264530
|
* failures this immediate-after-create write is prone to on the shared gateway:
|
|
@@ -264523,9 +264583,9 @@ var PostmanGatewayAssetsClient = class _PostmanGatewayAssetsClient {
|
|
|
264523
264583
|
/**
|
|
264524
264584
|
* Inject smoke-test assertions into every leaf request of a spec-generated
|
|
264525
264585
|
* collection, over the v3 collection-items surface (no PMAK):
|
|
264526
|
-
* 1. `GET /v3/collections/:cid/items/` (
|
|
264586
|
+
* 1. `GET /v3/collections/:cid/items/` (FULL public uid, trailing slash) — flat list.
|
|
264527
264587
|
* 2. for each `http-request` leaf, `PATCH /v3/collections/:cid/items/:itemId`
|
|
264528
|
-
* (full uid for `:itemId`, `X-Entity-Type: http-request` header) with a
|
|
264588
|
+
* (full uid for `:cid` and `:itemId`, `X-Entity-Type: http-request` header) with a
|
|
264529
264589
|
* JSON-Patch that sets `/scripts` to the canonical v3 shape
|
|
264530
264590
|
* (`[{type:'afterResponse', code, language}]`). The v3 surface persists test
|
|
264531
264591
|
* scripts under `scripts`, NOT `events`: a `/events` patch returns 200 but is
|
|
@@ -264538,7 +264598,7 @@ var PostmanGatewayAssetsClient = class _PostmanGatewayAssetsClient {
|
|
|
264538
264598
|
*/
|
|
264539
264599
|
async injectTests(collectionUid, type) {
|
|
264540
264600
|
void type;
|
|
264541
|
-
const cid = this.
|
|
264601
|
+
const cid = this.collectionItemsId(collectionUid);
|
|
264542
264602
|
const listed = await this.gateway.requestJson({
|
|
264543
264603
|
service: "collection",
|
|
264544
264604
|
method: "get",
|
|
@@ -264709,7 +264769,7 @@ var PostmanGatewayAssetsClient = class _PostmanGatewayAssetsClient {
|
|
|
264709
264769
|
* Inject the deterministic OpenAPI contract assertions into every generated
|
|
264710
264770
|
* request of a spec-generated collection, entirely over the v3 collection
|
|
264711
264771
|
* surface (no PMAK, no v2.1.0 read/PUT):
|
|
264712
|
-
* 1. `GET /v3/collections/:cid/items/` — flat item list (
|
|
264772
|
+
* 1. `GET /v3/collections/:cid/items/` — flat item list (FULL public uid for `:cid`).
|
|
264713
264773
|
* 2. `GET /v3/collections/:cid/items/:itemId` (`X-Entity-Type: http-request`)
|
|
264714
264774
|
* — the full v3 IR record (method/url/headers/body) the matcher needs.
|
|
264715
264775
|
* 3. `planContractItemScripts` matches each request to its OpenAPI operation
|
|
@@ -264720,7 +264780,7 @@ var PostmanGatewayAssetsClient = class _PostmanGatewayAssetsClient {
|
|
|
264720
264780
|
* Returns the non-fatal instrumentation warnings for the caller to surface.
|
|
264721
264781
|
*/
|
|
264722
264782
|
async injectContractTests(collectionUid, index) {
|
|
264723
|
-
const cid = this.
|
|
264783
|
+
const cid = this.collectionItemsId(collectionUid);
|
|
264724
264784
|
const listed = await this.gateway.requestJson({
|
|
264725
264785
|
service: "collection",
|
|
264726
264786
|
method: "get",
|
|
@@ -265066,12 +265126,61 @@ var PostmanGatewayAssetsClient = class _PostmanGatewayAssetsClient {
|
|
|
265066
265126
|
ops.push({ op: "remove", path: "/scripts" });
|
|
265067
265127
|
}
|
|
265068
265128
|
if (ops.length === 0) return;
|
|
265069
|
-
|
|
265070
|
-
|
|
265071
|
-
|
|
265072
|
-
|
|
265073
|
-
|
|
265074
|
-
|
|
265129
|
+
try {
|
|
265130
|
+
await this.gateway.requestJson({
|
|
265131
|
+
service: "collection",
|
|
265132
|
+
method: "patch",
|
|
265133
|
+
path: `/v3/collections/${cid}`,
|
|
265134
|
+
// Fixed-path add/replace ops are idempotent, and a remove that already
|
|
265135
|
+
// committed is reconciled below, so transient downstream timeouts
|
|
265136
|
+
// (ESOCKETTIMEDOUT) are safe to retry.
|
|
265137
|
+
retry: "safe",
|
|
265138
|
+
body: ops
|
|
265139
|
+
});
|
|
265140
|
+
} catch (error2) {
|
|
265141
|
+
if (isMissingPatchValueError(error2) && ops.some((op) => op.op === "remove") && await this.verifyRootSettingsApplied(cid, ops)) {
|
|
265142
|
+
return;
|
|
265143
|
+
}
|
|
265144
|
+
throw error2;
|
|
265145
|
+
}
|
|
265146
|
+
}
|
|
265147
|
+
/**
|
|
265148
|
+
* Read the collection root and check that every JSON-Patch op's intended end
|
|
265149
|
+
* state holds. add/replace targets must be structurally equal to the exact
|
|
265150
|
+
* requested value (a stale pre-PATCH description/auth/variables/scripts is
|
|
265151
|
+
* non-null but not equal, so it can never falsely verify); remove targets must
|
|
265152
|
+
* be absent (description clears to "" rather than disappearing).
|
|
265153
|
+
*/
|
|
265154
|
+
async verifyRootSettingsApplied(cid, ops) {
|
|
265155
|
+
let current;
|
|
265156
|
+
try {
|
|
265157
|
+
const got = await this.gateway.requestJson({
|
|
265158
|
+
service: "collection",
|
|
265159
|
+
method: "get",
|
|
265160
|
+
path: `/v3/collections/${cid}`
|
|
265161
|
+
});
|
|
265162
|
+
current = asRecord8(got?.data);
|
|
265163
|
+
} catch {
|
|
265164
|
+
return false;
|
|
265165
|
+
}
|
|
265166
|
+
if (!current) return false;
|
|
265167
|
+
for (const op of ops) {
|
|
265168
|
+
const rawPath = String(op.path ?? "");
|
|
265169
|
+
const field = rawPath.startsWith("/") ? rawPath.slice(1) : rawPath;
|
|
265170
|
+
if (!field) return false;
|
|
265171
|
+
const value = current[field];
|
|
265172
|
+
if (op.op === "remove") {
|
|
265173
|
+
if (field === "description") {
|
|
265174
|
+
if (typeof value === "string" && value.length > 0) return false;
|
|
265175
|
+
} else if (!(value === void 0 || value === null || Array.isArray(value) && value.length === 0)) {
|
|
265176
|
+
return false;
|
|
265177
|
+
}
|
|
265178
|
+
} else {
|
|
265179
|
+
if (value === void 0 || value === null) return false;
|
|
265180
|
+
if (!deepEqual(value, op.value)) return false;
|
|
265181
|
+
}
|
|
265182
|
+
}
|
|
265183
|
+
return true;
|
|
265075
265184
|
}
|
|
265076
265185
|
/**
|
|
265077
265186
|
* Create a curated local v2.1.0 or collection v3 payload through the gateway v3 write
|
|
@@ -265120,11 +265229,12 @@ var PostmanGatewayAssetsClient = class _PostmanGatewayAssetsClient {
|
|
|
265120
265229
|
if (!rawId) {
|
|
265121
265230
|
throw new Error("Collection create did not return an id");
|
|
265122
265231
|
}
|
|
265123
|
-
const
|
|
265232
|
+
const itemsCid = this.collectionItemsId(rawId);
|
|
265233
|
+
const rootCid = this.bareModelId(rawId);
|
|
265124
265234
|
await options.onRootCreated?.(rawId);
|
|
265125
265235
|
try {
|
|
265126
|
-
await this.createItemTree(
|
|
265127
|
-
await this.applyCollectionLevelSettings(
|
|
265236
|
+
await this.createItemTree(itemsCid, asItemArray(v3.items), itemsCid);
|
|
265237
|
+
await this.applyCollectionLevelSettings(rootCid, v3, { rename: true });
|
|
265128
265238
|
} catch (error2) {
|
|
265129
265239
|
if (options.onRootCreated) throw error2;
|
|
265130
265240
|
let cleanupError;
|
|
@@ -265151,22 +265261,23 @@ var PostmanGatewayAssetsClient = class _PostmanGatewayAssetsClient {
|
|
|
265151
265261
|
* from the converted v3 IR and reapply name/auth/variables.
|
|
265152
265262
|
*/
|
|
265153
265263
|
async updateCollection(collectionUid, collection) {
|
|
265154
|
-
const
|
|
265264
|
+
const itemsCid = this.collectionItemsId(collectionUid);
|
|
265265
|
+
const rootCid = this.bareModelId(collectionUid);
|
|
265155
265266
|
const v3 = this.normalizeCollectionForWrite(collection);
|
|
265156
|
-
const existingItems = await this.listCollectionItems(
|
|
265267
|
+
const existingItems = await this.listCollectionItems(itemsCid);
|
|
265157
265268
|
for (const item of existingItems) {
|
|
265158
265269
|
const itemId = String(item.id).trim();
|
|
265159
265270
|
try {
|
|
265160
265271
|
await this.gateway.requestJson({
|
|
265161
265272
|
service: "collection",
|
|
265162
265273
|
method: "delete",
|
|
265163
|
-
path: `/v3/collections/${
|
|
265274
|
+
path: `/v3/collections/${itemsCid}/items/${itemId}`,
|
|
265164
265275
|
retry: "none",
|
|
265165
265276
|
headers: { "X-Entity-Type": String(item.$kind ?? "http-request") }
|
|
265166
265277
|
});
|
|
265167
265278
|
} catch (error2) {
|
|
265168
265279
|
if (isAmbiguousTransportError(error2)) {
|
|
265169
|
-
const stillPresent = (await this.listCollectionItems(
|
|
265280
|
+
const stillPresent = (await this.listCollectionItems(itemsCid)).some(
|
|
265170
265281
|
(candidate) => String(candidate.id ?? "").trim() === itemId
|
|
265171
265282
|
);
|
|
265172
265283
|
if (!stillPresent) continue;
|
|
@@ -265177,14 +265288,14 @@ var PostmanGatewayAssetsClient = class _PostmanGatewayAssetsClient {
|
|
|
265177
265288
|
}
|
|
265178
265289
|
}
|
|
265179
265290
|
}
|
|
265180
|
-
const remainingItems = await this.listCollectionItems(
|
|
265291
|
+
const remainingItems = await this.listCollectionItems(itemsCid);
|
|
265181
265292
|
if (remainingItems.length > 0) {
|
|
265182
265293
|
throw new Error(
|
|
265183
265294
|
`Collection delete verification failed: ${remainingItems.length} old items remain`
|
|
265184
265295
|
);
|
|
265185
265296
|
}
|
|
265186
|
-
await this.createItemTree(
|
|
265187
|
-
await this.applyCollectionLevelSettings(
|
|
265297
|
+
await this.createItemTree(itemsCid, asItemArray(v3.items), itemsCid);
|
|
265298
|
+
await this.applyCollectionLevelSettings(rootCid, v3, { rename: true, reconcileRemovals: true });
|
|
265188
265299
|
}
|
|
265189
265300
|
};
|
|
265190
265301
|
|
|
@@ -265192,6 +265303,36 @@ var PostmanGatewayAssetsClient = class _PostmanGatewayAssetsClient {
|
|
|
265192
265303
|
function isExpiredAuthError(status, body2) {
|
|
265193
265304
|
return status === 401 || body2.includes("UNAUTHENTICATED") || body2.includes("authenticationError");
|
|
265194
265305
|
}
|
|
265306
|
+
var DEFAULT_REQUEST_TIMEOUT_MS = 3e4;
|
|
265307
|
+
function asRecord9(value) {
|
|
265308
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
265309
|
+
}
|
|
265310
|
+
function innerEnvelopeStatus(envelope) {
|
|
265311
|
+
for (const key of ["status", "statusCode"]) {
|
|
265312
|
+
const value = envelope[key];
|
|
265313
|
+
if (typeof value === "number") return value;
|
|
265314
|
+
if (typeof value === "string" && /^\d+$/.test(value)) return Number(value);
|
|
265315
|
+
}
|
|
265316
|
+
return void 0;
|
|
265317
|
+
}
|
|
265318
|
+
function detectInnerError(body2) {
|
|
265319
|
+
const trimmed = body2.trim();
|
|
265320
|
+
if (!trimmed) return null;
|
|
265321
|
+
let parsed;
|
|
265322
|
+
try {
|
|
265323
|
+
parsed = JSON.parse(trimmed);
|
|
265324
|
+
} catch {
|
|
265325
|
+
return null;
|
|
265326
|
+
}
|
|
265327
|
+
const envelope = asRecord9(parsed);
|
|
265328
|
+
if (!envelope) return null;
|
|
265329
|
+
const innerStatus = innerEnvelopeStatus(envelope);
|
|
265330
|
+
const error2 = envelope.error;
|
|
265331
|
+
const errorRecord = asRecord9(error2);
|
|
265332
|
+
const hasError = error2 !== void 0 && error2 !== null && !(errorRecord !== null && Object.keys(errorRecord).length === 0) || envelope.success === false || typeof innerStatus === "number" && innerStatus >= 400;
|
|
265333
|
+
if (!hasError) return null;
|
|
265334
|
+
return typeof innerStatus === "number" && innerStatus >= 400 ? innerStatus : 502;
|
|
265335
|
+
}
|
|
265195
265336
|
function isTransientGatewayError(status, body2) {
|
|
265196
265337
|
if (status === 502 || status === 503 || status === 504) return true;
|
|
265197
265338
|
if (status >= 500 && (body2.includes("ESOCKETTIMEDOUT") || body2.includes("ETIMEDOUT") || body2.includes("ECONNRESET") || body2.includes("serverError") || body2.includes("downstream"))) {
|
|
@@ -265211,6 +265352,7 @@ var AccessTokenGatewayClient = class {
|
|
|
265211
265352
|
secretMasker;
|
|
265212
265353
|
maxRetries;
|
|
265213
265354
|
retryBaseDelayMs;
|
|
265355
|
+
requestTimeoutMs;
|
|
265214
265356
|
sleepImpl;
|
|
265215
265357
|
constructor(options) {
|
|
265216
265358
|
this.tokenProvider = options.tokenProvider;
|
|
@@ -265223,6 +265365,7 @@ var AccessTokenGatewayClient = class {
|
|
|
265223
265365
|
this.secretMasker = options.secretMasker ?? createSecretMasker([this.tokenProvider.current()]);
|
|
265224
265366
|
this.maxRetries = options.maxRetries ?? 3;
|
|
265225
265367
|
this.retryBaseDelayMs = options.retryBaseDelayMs ?? 400;
|
|
265368
|
+
this.requestTimeoutMs = options.requestTimeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;
|
|
265226
265369
|
this.sleepImpl = options.sleepImpl ?? defaultSleep;
|
|
265227
265370
|
}
|
|
265228
265371
|
configureTeamContext(teamId, orgMode) {
|
|
@@ -265242,45 +265385,83 @@ var AccessTokenGatewayClient = class {
|
|
|
265242
265385
|
}
|
|
265243
265386
|
async send(request) {
|
|
265244
265387
|
const url = `${this.bifrostBaseUrl}/ws/proxy`;
|
|
265245
|
-
|
|
265246
|
-
|
|
265247
|
-
|
|
265248
|
-
|
|
265249
|
-
|
|
265250
|
-
|
|
265251
|
-
|
|
265252
|
-
|
|
265253
|
-
|
|
265254
|
-
|
|
265255
|
-
|
|
265388
|
+
const controller = new AbortController();
|
|
265389
|
+
const timer = setTimeout(() => controller.abort(), this.requestTimeoutMs);
|
|
265390
|
+
try {
|
|
265391
|
+
return await this.fetchImpl(url, {
|
|
265392
|
+
method: "POST",
|
|
265393
|
+
headers: this.buildHeaders(request.headers),
|
|
265394
|
+
signal: controller.signal,
|
|
265395
|
+
body: JSON.stringify({
|
|
265396
|
+
service: request.service,
|
|
265397
|
+
method: request.method,
|
|
265398
|
+
path: request.path,
|
|
265399
|
+
...request.query !== void 0 ? { query: request.query } : {},
|
|
265400
|
+
...request.body !== void 0 ? { body: request.body } : {}
|
|
265401
|
+
})
|
|
265402
|
+
});
|
|
265403
|
+
} finally {
|
|
265404
|
+
clearTimeout(timer);
|
|
265405
|
+
}
|
|
265256
265406
|
}
|
|
265257
265407
|
/**
|
|
265258
265408
|
* Send a gateway request, refreshing the token once on an auth failure and
|
|
265259
|
-
* retrying transient
|
|
265260
|
-
*
|
|
265261
|
-
*
|
|
265409
|
+
* retrying transient failures with exponential backoff. Transient covers both
|
|
265410
|
+
* HTTP 5xx / Bifrost read timeouts AND transport-level rejections (fetch
|
|
265411
|
+
* throwing on a socket hangup or the per-request deadline aborting) — a
|
|
265412
|
+
* `retry: 'safe'` request retries either; a `retry: 'none'` mutation surfaces
|
|
265413
|
+
* the failure so the caller reconciles instead of blindly resending. An HTTP
|
|
265414
|
+
* 200 envelope carrying an inner collection-service error is treated as that
|
|
265415
|
+
* inner status. The auth-refresh-once path is independent of the retry budget.
|
|
265262
265416
|
*/
|
|
265263
265417
|
async request(request) {
|
|
265264
265418
|
if (!this.tokenProvider.current() && this.tokenProvider.canRefresh()) {
|
|
265265
265419
|
await this.tokenProvider.refresh();
|
|
265266
265420
|
}
|
|
265421
|
+
const retryMode = request.retry ?? (request.method === "get" ? "safe" : "none");
|
|
265267
265422
|
let attempt = 0;
|
|
265268
265423
|
for (; ; ) {
|
|
265269
|
-
let response
|
|
265424
|
+
let response;
|
|
265425
|
+
try {
|
|
265426
|
+
response = await this.send(request);
|
|
265427
|
+
} catch (error2) {
|
|
265428
|
+
if (retryMode === "safe" && attempt < this.maxRetries) {
|
|
265429
|
+
const delay = this.retryBaseDelayMs * 2 ** attempt;
|
|
265430
|
+
attempt += 1;
|
|
265431
|
+
await this.sleepImpl(delay);
|
|
265432
|
+
continue;
|
|
265433
|
+
}
|
|
265434
|
+
throw error2;
|
|
265435
|
+
}
|
|
265270
265436
|
if (response.ok) {
|
|
265271
|
-
|
|
265437
|
+
const okBody = await response.text().catch(() => "");
|
|
265438
|
+
const innerStatus = detectInnerError(okBody);
|
|
265439
|
+
if (innerStatus !== null) {
|
|
265440
|
+
if (retryMode === "safe" && isTransientGatewayError(innerStatus, okBody) && attempt < this.maxRetries) {
|
|
265441
|
+
const delay = this.retryBaseDelayMs * 2 ** attempt;
|
|
265442
|
+
attempt += 1;
|
|
265443
|
+
await this.sleepImpl(delay);
|
|
265444
|
+
continue;
|
|
265445
|
+
}
|
|
265446
|
+
throw this.toInnerHttpError(request, innerStatus, okBody);
|
|
265447
|
+
}
|
|
265448
|
+
return this.rebuildResponse(response, okBody);
|
|
265272
265449
|
}
|
|
265273
265450
|
const body2 = await response.text().catch(() => "");
|
|
265274
265451
|
if (isExpiredAuthError(response.status, body2) && this.tokenProvider.canRefresh()) {
|
|
265275
265452
|
await this.tokenProvider.refresh();
|
|
265276
265453
|
response = await this.send(request);
|
|
265277
265454
|
if (response.ok) {
|
|
265278
|
-
|
|
265455
|
+
const refreshedBody = await response.text().catch(() => "");
|
|
265456
|
+
const innerStatus = detectInnerError(refreshedBody);
|
|
265457
|
+
if (innerStatus !== null) {
|
|
265458
|
+
throw this.toInnerHttpError(request, innerStatus, refreshedBody);
|
|
265459
|
+
}
|
|
265460
|
+
return this.rebuildResponse(response, refreshedBody);
|
|
265279
265461
|
}
|
|
265280
265462
|
const retryBody = await response.text().catch(() => "");
|
|
265281
265463
|
throw this.toHttpError(request, response, retryBody);
|
|
265282
265464
|
}
|
|
265283
|
-
const retryMode = request.retry ?? (request.method === "get" ? "safe" : "none");
|
|
265284
265465
|
if (retryMode === "safe" && isTransientGatewayError(response.status, body2) && attempt < this.maxRetries) {
|
|
265285
265466
|
const delay = this.retryBaseDelayMs * 2 ** attempt;
|
|
265286
265467
|
attempt += 1;
|
|
@@ -265290,6 +265471,18 @@ var AccessTokenGatewayClient = class {
|
|
|
265290
265471
|
throw this.toHttpError(request, response, body2);
|
|
265291
265472
|
}
|
|
265292
265473
|
}
|
|
265474
|
+
/**
|
|
265475
|
+
* The success path reads the body to inspect for an inner error, which
|
|
265476
|
+
* consumes the stream. Hand callers a fresh Response over the buffered text so
|
|
265477
|
+
* `requestJson` can still parse it.
|
|
265478
|
+
*/
|
|
265479
|
+
rebuildResponse(response, body2) {
|
|
265480
|
+
return new Response(body2, {
|
|
265481
|
+
status: response.status,
|
|
265482
|
+
statusText: response.statusText,
|
|
265483
|
+
headers: response.headers
|
|
265484
|
+
});
|
|
265485
|
+
}
|
|
265293
265486
|
/** Send a gateway request and parse the JSON body, or null when empty. */
|
|
265294
265487
|
async requestJson(request) {
|
|
265295
265488
|
const response = await this.request(request);
|
|
@@ -265314,6 +265507,17 @@ var AccessTokenGatewayClient = class {
|
|
|
265314
265507
|
secretValues: [this.tokenProvider.current()]
|
|
265315
265508
|
});
|
|
265316
265509
|
}
|
|
265510
|
+
toInnerHttpError(request, status, body2) {
|
|
265511
|
+
return new HttpError({
|
|
265512
|
+
method: request.method.toUpperCase(),
|
|
265513
|
+
url: `${this.bifrostBaseUrl}/ws/proxy (${request.service}: ${request.method} ${request.path}) [inner]`,
|
|
265514
|
+
status,
|
|
265515
|
+
statusText: "Inner Error",
|
|
265516
|
+
requestHeaders: this.buildHeaders(request.headers),
|
|
265517
|
+
responseBody: this.secretMasker(body2),
|
|
265518
|
+
secretValues: [this.tokenProvider.current()]
|
|
265519
|
+
});
|
|
265520
|
+
}
|
|
265317
265521
|
};
|
|
265318
265522
|
|
|
265319
265523
|
// src/lib/postman/token-provider.ts
|
|
@@ -281631,7 +281835,7 @@ function compileErrors(result) {
|
|
|
281631
281835
|
|
|
281632
281836
|
// src/lib/spec/openapi-loader.ts
|
|
281633
281837
|
var import_yaml3 = __toESM(require_dist(), 1);
|
|
281634
|
-
function
|
|
281838
|
+
function asRecord10(value) {
|
|
281635
281839
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
281636
281840
|
return value;
|
|
281637
281841
|
}
|
|
@@ -281646,7 +281850,7 @@ function parseOpenApiDocument(content) {
|
|
|
281646
281850
|
throw new Error("CONTRACT_SPEC_PARSE_FAILED: Spec content is not valid JSON or YAML");
|
|
281647
281851
|
}
|
|
281648
281852
|
}
|
|
281649
|
-
const doc =
|
|
281853
|
+
const doc = asRecord10(parsed);
|
|
281650
281854
|
if (!doc) throw new Error("CONTRACT_SPEC_PARSE_FAILED: Spec content must be a JSON or YAML object");
|
|
281651
281855
|
return doc;
|
|
281652
281856
|
}
|
|
@@ -281674,7 +281878,7 @@ function collectExternalRefs(node, baseUrl, refs) {
|
|
|
281674
281878
|
node.forEach((entry) => collectExternalRefs(entry, baseUrl, refs));
|
|
281675
281879
|
return;
|
|
281676
281880
|
}
|
|
281677
|
-
const record =
|
|
281881
|
+
const record = asRecord10(node);
|
|
281678
281882
|
if (!record) return;
|
|
281679
281883
|
const ref = typeof record.$ref === "string" ? record.$ref : "";
|
|
281680
281884
|
if (ref && !ref.startsWith("#")) {
|
|
@@ -294270,7 +294474,7 @@ function buildGraphQLCollection(index, opts = {}) {
|
|
|
294270
294474
|
}
|
|
294271
294475
|
|
|
294272
294476
|
// src/lib/protocols/graphql/schema-lints.ts
|
|
294273
|
-
function
|
|
294477
|
+
function asRecord11(value) {
|
|
294274
294478
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
294275
294479
|
return value;
|
|
294276
294480
|
}
|
|
@@ -294281,7 +294485,7 @@ var BUILT_IN_SCALAR_NAMES = new Set(specifiedScalarTypes.map((scalar) => scalar.
|
|
|
294281
294485
|
var VALID_TYPE_KINDS = /* @__PURE__ */ new Set(["SCALAR", "OBJECT", "INTERFACE", "UNION", "ENUM", "INPUT_OBJECT", "LIST", "NON_NULL"]);
|
|
294282
294486
|
var VALID_DIRECTIVE_LOCATIONS = new Set(Object.values(DirectiveLocation));
|
|
294283
294487
|
function renderIntrospectionTypeRef(ref, depth = 0) {
|
|
294284
|
-
const current =
|
|
294488
|
+
const current = asRecord11(ref);
|
|
294285
294489
|
if (!current || depth > 32 || typeof current.kind !== "string") return null;
|
|
294286
294490
|
if (current.kind === "NON_NULL") {
|
|
294287
294491
|
const inner = renderIntrospectionTypeRef(current.ofType, depth + 1);
|
|
@@ -294294,12 +294498,12 @@ function renderIntrospectionTypeRef(ref, depth = 0) {
|
|
|
294294
294498
|
return typeof current.name === "string" && current.name.length > 0 ? current.name : null;
|
|
294295
294499
|
}
|
|
294296
294500
|
function readIntrospectionDirectiveShape(value) {
|
|
294297
|
-
const directive =
|
|
294501
|
+
const directive = asRecord11(value);
|
|
294298
294502
|
if (!directive || typeof directive.isRepeatable !== "boolean") return null;
|
|
294299
294503
|
return {
|
|
294300
294504
|
isRepeatable: directive.isRepeatable,
|
|
294301
294505
|
locations: asArray5(directive.locations).filter((entry) => typeof entry === "string"),
|
|
294302
|
-
args: asArray5(directive.args).map(
|
|
294506
|
+
args: asArray5(directive.args).map(asRecord11).filter((entry) => entry !== null && typeof entry.name === "string").map((arg) => ({
|
|
294303
294507
|
name: arg.name,
|
|
294304
294508
|
type: renderIntrospectionTypeRef(arg.type),
|
|
294305
294509
|
defaultValue: Object.prototype.hasOwnProperty.call(arg, "defaultValue") ? arg.defaultValue : void 0
|
|
@@ -294309,10 +294513,10 @@ function readIntrospectionDirectiveShape(value) {
|
|
|
294309
294513
|
var BUILT_IN_INTROSPECTION_DIRECTIVE_SHAPES = (() => {
|
|
294310
294514
|
const shapes = /* @__PURE__ */ new Map();
|
|
294311
294515
|
const reference = introspectionFromSchema(buildSchema("type Query { _: Boolean }"));
|
|
294312
|
-
const schemaRecord =
|
|
294516
|
+
const schemaRecord = asRecord11(asRecord11(reference)?.__schema);
|
|
294313
294517
|
if (!schemaRecord) return shapes;
|
|
294314
294518
|
for (const entry of asArray5(schemaRecord.directives)) {
|
|
294315
|
-
const directive =
|
|
294519
|
+
const directive = asRecord11(entry);
|
|
294316
294520
|
if (!directive || typeof directive.name !== "string") continue;
|
|
294317
294521
|
const shape = readIntrospectionDirectiveShape(directive);
|
|
294318
294522
|
if (shape) shapes.set(directive.name, shape);
|
|
@@ -294408,11 +294612,11 @@ function lintDirectiveDefinitions(schema) {
|
|
|
294408
294612
|
const warnings = [];
|
|
294409
294613
|
const builtIn = new Set(specifiedDirectives.map((directive) => directive.name));
|
|
294410
294614
|
const usesDirective = (astNode, name) => {
|
|
294411
|
-
const record =
|
|
294615
|
+
const record = asRecord11(astNode);
|
|
294412
294616
|
if (!record) return false;
|
|
294413
294617
|
return asArray5(record.directives).some((entry) => {
|
|
294414
|
-
const applied =
|
|
294415
|
-
const appliedName = applied ?
|
|
294618
|
+
const applied = asRecord11(entry);
|
|
294619
|
+
const appliedName = applied ? asRecord11(applied.name) : null;
|
|
294416
294620
|
return Boolean(appliedName && appliedName.value === name);
|
|
294417
294621
|
});
|
|
294418
294622
|
};
|
|
@@ -294422,7 +294626,7 @@ function lintDirectiveDefinitions(schema) {
|
|
|
294422
294626
|
warnings.push("GQL_DIRECTIVE_NAME_RESERVED: directive @" + directive.name + ' must not begin with "__" (GraphQL spec 3.13)');
|
|
294423
294627
|
}
|
|
294424
294628
|
let selfReferenced = false;
|
|
294425
|
-
const ownAst =
|
|
294629
|
+
const ownAst = asRecord11(directive.astNode);
|
|
294426
294630
|
if (ownAst) {
|
|
294427
294631
|
for (const argNode of asArray5(ownAst.arguments)) {
|
|
294428
294632
|
if (usesDirective(argNode, directive.name)) selfReferenced = true;
|
|
@@ -294566,10 +294770,10 @@ function lintSdlDocument(sdl) {
|
|
|
294566
294770
|
return warnings;
|
|
294567
294771
|
}
|
|
294568
294772
|
function lintTypeRefChain(ref, context, warnings) {
|
|
294569
|
-
let current =
|
|
294773
|
+
let current = asRecord11(ref);
|
|
294570
294774
|
let depth = 0;
|
|
294571
294775
|
while (current && depth < 32) {
|
|
294572
|
-
const ofType =
|
|
294776
|
+
const ofType = asRecord11(current.ofType);
|
|
294573
294777
|
if (current.kind === "NON_NULL" && ofType && ofType.kind === "NON_NULL") {
|
|
294574
294778
|
warnings.push("GQL_INTROSPECTION_NONNULL_NESTED: " + context + " wraps NON_NULL directly inside NON_NULL, which the type system forbids (GraphQL spec 3.12)");
|
|
294575
294779
|
return;
|
|
@@ -294580,7 +294784,7 @@ function lintTypeRefChain(ref, context, warnings) {
|
|
|
294580
294784
|
}
|
|
294581
294785
|
function lintDeprecationFlags(entries, context, warnings) {
|
|
294582
294786
|
for (const entry of entries) {
|
|
294583
|
-
const record =
|
|
294787
|
+
const record = asRecord11(entry);
|
|
294584
294788
|
if (!record) continue;
|
|
294585
294789
|
const label = context + "." + (typeof record.name === "string" ? record.name : "<unnamed>");
|
|
294586
294790
|
if (record.isDeprecated !== void 0 && typeof record.isDeprecated !== "boolean") {
|
|
@@ -294601,7 +294805,7 @@ function lintIntrospectionBuiltInDirectiveShapes(schemaRecord) {
|
|
|
294601
294805
|
const warnings = [];
|
|
294602
294806
|
const directives = /* @__PURE__ */ new Map();
|
|
294603
294807
|
for (const entry of asArray5(schemaRecord.directives)) {
|
|
294604
|
-
const directive =
|
|
294808
|
+
const directive = asRecord11(entry);
|
|
294605
294809
|
if (directive && typeof directive.name === "string" && !directives.has(directive.name)) {
|
|
294606
294810
|
directives.set(directive.name, directive);
|
|
294607
294811
|
}
|
|
@@ -294655,13 +294859,13 @@ function lintIntrospectionBuiltInDirectiveShapes(schemaRecord) {
|
|
|
294655
294859
|
}
|
|
294656
294860
|
function lintIntrospectionJson(introspection) {
|
|
294657
294861
|
const warnings = [];
|
|
294658
|
-
const root =
|
|
294659
|
-
const dataRecord = root ?
|
|
294660
|
-
const schemaRecord = root ?
|
|
294862
|
+
const root = asRecord11(introspection);
|
|
294863
|
+
const dataRecord = root ? asRecord11(root.data) : null;
|
|
294864
|
+
const schemaRecord = root ? asRecord11(root.__schema) ?? (dataRecord ? asRecord11(dataRecord.__schema) : null) : null;
|
|
294661
294865
|
if (!schemaRecord) return warnings;
|
|
294662
294866
|
const typeCounts = /* @__PURE__ */ new Map();
|
|
294663
294867
|
for (const entry of asArray5(schemaRecord.types)) {
|
|
294664
|
-
const type =
|
|
294868
|
+
const type = asRecord11(entry);
|
|
294665
294869
|
if (!type) continue;
|
|
294666
294870
|
const name = typeof type.name === "string" ? type.name : "<unnamed>";
|
|
294667
294871
|
typeCounts.set(name, (typeCounts.get(name) ?? 0) + 1);
|
|
@@ -294669,7 +294873,7 @@ function lintIntrospectionJson(introspection) {
|
|
|
294669
294873
|
warnings.push("GQL_INTROSPECTION_KIND_INVALID: type " + name + " declares unknown __TypeKind '" + type.kind + "'");
|
|
294670
294874
|
}
|
|
294671
294875
|
for (const memberEntry of asArray5(type.possibleTypes)) {
|
|
294672
|
-
const member =
|
|
294876
|
+
const member = asRecord11(memberEntry);
|
|
294673
294877
|
if (member && member.kind !== void 0 && member.kind !== "OBJECT") {
|
|
294674
294878
|
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)");
|
|
294675
294879
|
}
|
|
@@ -294677,18 +294881,18 @@ function lintIntrospectionJson(introspection) {
|
|
|
294677
294881
|
lintDeprecationFlags(asArray5(type.fields), name + ".fields", warnings);
|
|
294678
294882
|
lintDeprecationFlags(asArray5(type.enumValues), name + ".enumValues", warnings);
|
|
294679
294883
|
for (const fieldEntry of asArray5(type.fields)) {
|
|
294680
|
-
const field =
|
|
294884
|
+
const field = asRecord11(fieldEntry);
|
|
294681
294885
|
if (!field) continue;
|
|
294682
294886
|
const fieldLabel = name + "." + String(field.name ?? "<unnamed>");
|
|
294683
294887
|
lintTypeRefChain(field.type, fieldLabel, warnings);
|
|
294684
294888
|
for (const argEntry of asArray5(field.args)) {
|
|
294685
|
-
const arg =
|
|
294889
|
+
const arg = asRecord11(argEntry);
|
|
294686
294890
|
if (arg) lintTypeRefChain(arg.type, fieldLabel + "(" + String(arg.name ?? "<unnamed>") + ":)", warnings);
|
|
294687
294891
|
}
|
|
294688
294892
|
lintDeprecationFlags(asArray5(field.args), fieldLabel + ".args", warnings);
|
|
294689
294893
|
}
|
|
294690
294894
|
for (const inputEntry of asArray5(type.inputFields)) {
|
|
294691
|
-
const input =
|
|
294895
|
+
const input = asRecord11(inputEntry);
|
|
294692
294896
|
if (input) lintTypeRefChain(input.type, name + "." + String(input.name ?? "<unnamed>"), warnings);
|
|
294693
294897
|
}
|
|
294694
294898
|
lintDeprecationFlags(asArray5(type.inputFields), name + ".inputFields", warnings);
|
|
@@ -294700,7 +294904,7 @@ function lintIntrospectionJson(introspection) {
|
|
|
294700
294904
|
}
|
|
294701
294905
|
const directiveNameCounts = /* @__PURE__ */ new Map();
|
|
294702
294906
|
for (const directiveEntry of asArray5(schemaRecord.directives)) {
|
|
294703
|
-
const directive =
|
|
294907
|
+
const directive = asRecord11(directiveEntry);
|
|
294704
294908
|
if (!directive) continue;
|
|
294705
294909
|
if (typeof directive.name !== "string" || directive.name.length === 0) {
|
|
294706
294910
|
warnings.push("GQL_INTROSPECTION_DIRECTIVE_INVALID: a __schema.directives entry is missing its name");
|
|
@@ -294716,7 +294920,7 @@ function lintIntrospectionJson(introspection) {
|
|
|
294716
294920
|
warnings.push("GQL_INTROSPECTION_DIRECTIVE_INVALID: directive @" + directive.name + " isRepeatable must be a boolean (__Directive contract)");
|
|
294717
294921
|
}
|
|
294718
294922
|
for (const argEntry of asArray5(directive.args)) {
|
|
294719
|
-
const arg =
|
|
294923
|
+
const arg = asRecord11(argEntry);
|
|
294720
294924
|
if (arg) lintTypeRefChain(arg.type, "@" + directive.name + "(" + String(arg.name ?? "<unnamed>") + ":)", warnings);
|
|
294721
294925
|
}
|
|
294722
294926
|
lintDeprecationFlags(asArray5(directive.args), "@" + directive.name + ".args", warnings);
|
|
@@ -294735,7 +294939,7 @@ function lintIntrospectionJson(introspection) {
|
|
|
294735
294939
|
return warnings;
|
|
294736
294940
|
}
|
|
294737
294941
|
function introspectionTypeEntries(schemaRecord) {
|
|
294738
|
-
return asArray5(schemaRecord.types).map(
|
|
294942
|
+
return asArray5(schemaRecord.types).map(asRecord11).filter((entry) => entry !== null);
|
|
294739
294943
|
}
|
|
294740
294944
|
function introspectionTypesByName(entries) {
|
|
294741
294945
|
const byName = /* @__PURE__ */ new Map();
|
|
@@ -294746,7 +294950,7 @@ function introspectionTypesByName(entries) {
|
|
|
294746
294950
|
}
|
|
294747
294951
|
function describeIntrospectionRootRecord(value) {
|
|
294748
294952
|
if (value === void 0 || value === null) return "<missing>";
|
|
294749
|
-
const record =
|
|
294953
|
+
const record = asRecord11(value);
|
|
294750
294954
|
if (!record) return "<invalid>";
|
|
294751
294955
|
return typeof record.name === "string" && record.name.length > 0 ? record.name : "<unnamed>";
|
|
294752
294956
|
}
|
|
@@ -294766,7 +294970,7 @@ function lintIntrospectionRootMap(schemaRecord) {
|
|
|
294766
294970
|
}
|
|
294767
294971
|
continue;
|
|
294768
294972
|
}
|
|
294769
|
-
const record =
|
|
294973
|
+
const record = asRecord11(value);
|
|
294770
294974
|
if (!record || typeof record.name !== "string" || record.name.length === 0) {
|
|
294771
294975
|
warnings.push("GQL_INTROSPECTION_ROOT_INVALID: __schema." + rootKind + "Type must name the " + rootKind + " root operation type (GraphQL spec 3.3). Root map: " + rootMap);
|
|
294772
294976
|
continue;
|
|
@@ -294826,13 +295030,13 @@ function lintIntrospectionTypeMatrix(schemaRecord) {
|
|
|
294826
295030
|
return warnings;
|
|
294827
295031
|
}
|
|
294828
295032
|
function namedTypeRefName(ref) {
|
|
294829
|
-
let current =
|
|
295033
|
+
let current = asRecord11(ref);
|
|
294830
295034
|
let depth = 0;
|
|
294831
295035
|
while (current && depth < 32) {
|
|
294832
295036
|
if (current.kind !== "LIST" && current.kind !== "NON_NULL") {
|
|
294833
295037
|
return typeof current.name === "string" ? current.name : null;
|
|
294834
295038
|
}
|
|
294835
|
-
current =
|
|
295039
|
+
current = asRecord11(current.ofType);
|
|
294836
295040
|
depth += 1;
|
|
294837
295041
|
}
|
|
294838
295042
|
return null;
|
|
@@ -294846,31 +295050,31 @@ function lintIntrospectionReferenceGraph(schemaRecord) {
|
|
|
294846
295050
|
if (name) referenced.add(name);
|
|
294847
295051
|
};
|
|
294848
295052
|
for (const rootKind of ["query", "mutation", "subscription"]) {
|
|
294849
|
-
const record =
|
|
295053
|
+
const record = asRecord11(schemaRecord[rootKind + "Type"]);
|
|
294850
295054
|
if (record && typeof record.name === "string") referenced.add(record.name);
|
|
294851
295055
|
}
|
|
294852
295056
|
for (const type of entries) {
|
|
294853
295057
|
for (const entry of asArray5(type.interfaces)) addRef(namedTypeRefName(entry));
|
|
294854
295058
|
for (const entry of asArray5(type.possibleTypes)) addRef(namedTypeRefName(entry));
|
|
294855
295059
|
for (const fieldEntry of asArray5(type.fields)) {
|
|
294856
|
-
const field =
|
|
295060
|
+
const field = asRecord11(fieldEntry);
|
|
294857
295061
|
if (!field) continue;
|
|
294858
295062
|
addRef(namedTypeRefName(field.type));
|
|
294859
295063
|
for (const argEntry of asArray5(field.args)) {
|
|
294860
|
-
const arg =
|
|
295064
|
+
const arg = asRecord11(argEntry);
|
|
294861
295065
|
if (arg) addRef(namedTypeRefName(arg.type));
|
|
294862
295066
|
}
|
|
294863
295067
|
}
|
|
294864
295068
|
for (const inputEntry of asArray5(type.inputFields)) {
|
|
294865
|
-
const input =
|
|
295069
|
+
const input = asRecord11(inputEntry);
|
|
294866
295070
|
if (input) addRef(namedTypeRefName(input.type));
|
|
294867
295071
|
}
|
|
294868
295072
|
}
|
|
294869
295073
|
for (const directiveEntry of asArray5(schemaRecord.directives)) {
|
|
294870
|
-
const directive =
|
|
295074
|
+
const directive = asRecord11(directiveEntry);
|
|
294871
295075
|
if (!directive) continue;
|
|
294872
295076
|
for (const argEntry of asArray5(directive.args)) {
|
|
294873
|
-
const arg =
|
|
295077
|
+
const arg = asRecord11(argEntry);
|
|
294874
295078
|
if (arg) addRef(namedTypeRefName(arg.type));
|
|
294875
295079
|
}
|
|
294876
295080
|
}
|
|
@@ -294891,7 +295095,7 @@ function lintIntrospectionAbstractConsistency(schemaRecord) {
|
|
|
294891
295095
|
const entries = introspectionTypeEntries(schemaRecord);
|
|
294892
295096
|
const byName = introspectionTypesByName(entries);
|
|
294893
295097
|
const names = (value) => asArray5(value).map((entry) => {
|
|
294894
|
-
const record =
|
|
295098
|
+
const record = asRecord11(entry);
|
|
294895
295099
|
return record && typeof record.name === "string" ? record.name : "";
|
|
294896
295100
|
}).filter((name) => name.length > 0);
|
|
294897
295101
|
for (const type of entries) {
|
|
@@ -294920,7 +295124,7 @@ function lintIntrospectionDeprecationProvenance(schemaRecord) {
|
|
|
294920
295124
|
let flagged = 0;
|
|
294921
295125
|
for (const type of introspectionTypeEntries(schemaRecord)) {
|
|
294922
295126
|
for (const entry of [...asArray5(type.fields), ...asArray5(type.enumValues)]) {
|
|
294923
|
-
const record =
|
|
295127
|
+
const record = asRecord11(entry);
|
|
294924
295128
|
if (!record) continue;
|
|
294925
295129
|
entries += 1;
|
|
294926
295130
|
if (record.isDeprecated !== void 0) flagged += 1;
|
|
@@ -294946,7 +295150,7 @@ function lintGeneratedDocument(schema, operationId, documentText) {
|
|
|
294946
295150
|
}
|
|
294947
295151
|
|
|
294948
295152
|
// src/lib/protocols/graphql/parser.ts
|
|
294949
|
-
function
|
|
295153
|
+
function asRecord12(value) {
|
|
294950
295154
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
294951
295155
|
return value;
|
|
294952
295156
|
}
|
|
@@ -295064,14 +295268,14 @@ function collectRootOperations(rootType, kind, schema, shapes) {
|
|
|
295064
295268
|
});
|
|
295065
295269
|
}
|
|
295066
295270
|
function looksLikeIntrospection2(value) {
|
|
295067
|
-
const record =
|
|
295271
|
+
const record = asRecord12(value);
|
|
295068
295272
|
if (!record) return false;
|
|
295069
|
-
if (
|
|
295070
|
-
const data =
|
|
295071
|
-
return Boolean(data &&
|
|
295273
|
+
if (asRecord12(record.__schema)) return true;
|
|
295274
|
+
const data = asRecord12(record.data);
|
|
295275
|
+
return Boolean(data && asRecord12(data.__schema));
|
|
295072
295276
|
}
|
|
295073
295277
|
function buildSchemaFromIntrospection(value) {
|
|
295074
|
-
const introspection =
|
|
295278
|
+
const introspection = asRecord12(value.__schema) ? value : asRecord12(value.data);
|
|
295075
295279
|
return buildClientSchema(introspection);
|
|
295076
295280
|
}
|
|
295077
295281
|
function selectIntrospectionRootWarnings(warnings) {
|
|
@@ -295094,7 +295298,7 @@ function parseGraphQLSchema(content, opts = {}) {
|
|
|
295094
295298
|
if (parsedJson !== void 0 && looksLikeIntrospection2(parsedJson)) {
|
|
295095
295299
|
introspectionWarnings = lintIntrospectionJson(parsedJson);
|
|
295096
295300
|
try {
|
|
295097
|
-
schema = buildSchemaFromIntrospection(
|
|
295301
|
+
schema = buildSchemaFromIntrospection(asRecord12(parsedJson));
|
|
295098
295302
|
} catch (error2) {
|
|
295099
295303
|
const rootWarnings = selectIntrospectionRootWarnings(introspectionWarnings);
|
|
295100
295304
|
const rootDiagnostics = rootWarnings.length > 0 ? " " + rootWarnings.join(" ") : "";
|
|
@@ -295211,7 +295415,7 @@ function collectDeprecatedSelectionWarnings(schema, operation, index) {
|
|
|
295211
295415
|
}
|
|
295212
295416
|
|
|
295213
295417
|
// src/lib/protocols/graphql/instrumenter.ts
|
|
295214
|
-
function
|
|
295418
|
+
function asRecord13(value) {
|
|
295215
295419
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
295216
295420
|
return value;
|
|
295217
295421
|
}
|
|
@@ -295721,24 +295925,24 @@ function buildProbeScript(probeId, index, warnings) {
|
|
|
295721
295925
|
];
|
|
295722
295926
|
}
|
|
295723
295927
|
function isGraphQLHttpRequest(item) {
|
|
295724
|
-
const request =
|
|
295928
|
+
const request = asRecord13(item.request);
|
|
295725
295929
|
if (!request) return false;
|
|
295726
|
-
const body2 =
|
|
295930
|
+
const body2 = asRecord13(request.body);
|
|
295727
295931
|
return body2?.mode === "graphql";
|
|
295728
295932
|
}
|
|
295729
295933
|
function injectItem(item, index, covered, warnings) {
|
|
295730
295934
|
const children4 = asArray6(item.item);
|
|
295731
295935
|
if (children4.length > 0) {
|
|
295732
295936
|
for (const child4 of children4) {
|
|
295733
|
-
const childRecord =
|
|
295937
|
+
const childRecord = asRecord13(child4);
|
|
295734
295938
|
if (childRecord) injectItem(childRecord, index, covered, warnings);
|
|
295735
295939
|
}
|
|
295736
295940
|
return;
|
|
295737
295941
|
}
|
|
295738
295942
|
const itemId = String(item.id ?? "");
|
|
295739
|
-
if (itemId.startsWith("__gql_probe_") &&
|
|
295943
|
+
if (itemId.startsWith("__gql_probe_") && asRecord13(item.request)) {
|
|
295740
295944
|
const exec2 = buildProbeScript(itemId, index, warnings);
|
|
295741
|
-
const priorEvents = asArray6(item.event).filter((entry) =>
|
|
295945
|
+
const priorEvents = asArray6(item.event).filter((entry) => asRecord13(entry)?.listen !== "test");
|
|
295742
295946
|
item.event = [...priorEvents, { listen: "test", script: { type: "text/javascript", exec: exec2 } }];
|
|
295743
295947
|
return;
|
|
295744
295948
|
}
|
|
@@ -295754,7 +295958,7 @@ function injectItem(item, index, covered, warnings) {
|
|
|
295754
295958
|
" pm.expect.fail(contractMappingError);",
|
|
295755
295959
|
"});"
|
|
295756
295960
|
];
|
|
295757
|
-
const priorEvents = asArray6(item.event).filter((entry) =>
|
|
295961
|
+
const priorEvents = asArray6(item.event).filter((entry) => asRecord13(entry)?.listen !== "test");
|
|
295758
295962
|
item.event = [...priorEvents, { listen: "test", script: { type: "text/javascript", exec: failExec } }];
|
|
295759
295963
|
return;
|
|
295760
295964
|
}
|
|
@@ -295770,7 +295974,7 @@ function injectItem(item, index, covered, warnings) {
|
|
|
295770
295974
|
`GQL_SCRIPT_SIZE_EXCEEDED: generated test script for '${operation.id}' exceeded ${GRAPHQL_INSTRUMENT_LIMITS.maxTestScriptBytes} bytes`
|
|
295771
295975
|
);
|
|
295772
295976
|
}
|
|
295773
|
-
const events2 = asArray6(item.event).filter((entry) =>
|
|
295977
|
+
const events2 = asArray6(item.event).filter((entry) => asRecord13(entry)?.listen !== "test");
|
|
295774
295978
|
item.event = [
|
|
295775
295979
|
...events2,
|
|
295776
295980
|
{ listen: "test", script: { type: "text/javascript", exec: exec2 } }
|
|
@@ -295781,7 +295985,7 @@ function instrumentGraphQLCollection(collection, index) {
|
|
|
295781
295985
|
const warnings = [...index.warnings];
|
|
295782
295986
|
const covered = /* @__PURE__ */ new Set();
|
|
295783
295987
|
for (const child4 of asArray6(collection.item)) {
|
|
295784
|
-
const childRecord =
|
|
295988
|
+
const childRecord = asRecord13(child4);
|
|
295785
295989
|
if (childRecord) injectItem(childRecord, index, covered, warnings);
|
|
295786
295990
|
}
|
|
295787
295991
|
const missing = index.operations.filter((operation) => !covered.has(operation.id));
|
|
@@ -295795,7 +295999,7 @@ function instrumentGraphQLCollection(collection, index) {
|
|
|
295795
295999
|
|
|
295796
296000
|
// src/lib/protocols/grpc/proto-parser.ts
|
|
295797
296001
|
var protobufjs = __toESM(require_protobufjs(), 1);
|
|
295798
|
-
function
|
|
296002
|
+
function asRecord14(value) {
|
|
295799
296003
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
295800
296004
|
return value;
|
|
295801
296005
|
}
|
|
@@ -296095,7 +296299,7 @@ function upperCamelCase(name) {
|
|
|
296095
296299
|
function lintMessage(message, warnings, proto3) {
|
|
296096
296300
|
const fullName = stripLeadingDot(message.fullName);
|
|
296097
296301
|
const { ranges: reservedRanges } = lintReserved(message.reserved, `message ${fullName}`, { lo: 1, hi: FIELD_NUMBER_MAX, label: "field-number" }, warnings);
|
|
296098
|
-
lintOptionSet(
|
|
296302
|
+
lintOptionSet(asRecord14(message.options), "message", fullName, warnings);
|
|
296099
296303
|
const jsonNames = /* @__PURE__ */ new Map();
|
|
296100
296304
|
for (const field of asArray7(message.fieldsArray)) {
|
|
296101
296305
|
const id = field.id;
|
|
@@ -296116,7 +296320,7 @@ function lintMessage(message, warnings, proto3) {
|
|
|
296116
296320
|
}
|
|
296117
296321
|
jsonNames.set(jsonName, String(field.name));
|
|
296118
296322
|
}
|
|
296119
|
-
if (
|
|
296323
|
+
if (asRecord14(message.options)?.deprecated === true) {
|
|
296120
296324
|
warnings.push(`GRPC_DEPRECATED: message ${fullName} is marked deprecated`);
|
|
296121
296325
|
}
|
|
296122
296326
|
const nestedNames = new Set(asArray7(message.nestedArray).map((child4) => child4.name));
|
|
@@ -296145,13 +296349,13 @@ function lintMessage(message, warnings, proto3) {
|
|
|
296145
296349
|
for (const child4 of asArray7(message.nestedArray)) {
|
|
296146
296350
|
declare(child4.name, isEnum(child4) ? "nested enum" : "nested type");
|
|
296147
296351
|
if (isEnum(child4)) {
|
|
296148
|
-
for (const valueName of Object.keys(
|
|
296352
|
+
for (const valueName of Object.keys(asRecord14(child4.values) ?? {})) declare(valueName, `enum value of ${child4.name}`);
|
|
296149
296353
|
}
|
|
296150
296354
|
}
|
|
296151
296355
|
}
|
|
296152
296356
|
function lintEnum(enumObj, warnings, proto3, conventions) {
|
|
296153
296357
|
const fullName = stripLeadingDot(enumObj.fullName);
|
|
296154
|
-
const entries = Object.entries(
|
|
296358
|
+
const entries = Object.entries(asRecord14(enumObj.values) ?? {});
|
|
296155
296359
|
const { ranges: reservedRanges, names: reservedNames } = lintReserved(
|
|
296156
296360
|
enumObj.reserved,
|
|
296157
296361
|
`enum ${fullName}`,
|
|
@@ -296179,7 +296383,7 @@ function lintEnum(enumObj, warnings, proto3, conventions) {
|
|
|
296179
296383
|
warnings.push(`GRPC_ENUM_ZERO_NAME_CONVENTION: enum ${fullName} zero value ${zero[0]} is conventionally named *_UNSPECIFIED (buf/AIP enum conventions)`);
|
|
296180
296384
|
}
|
|
296181
296385
|
}
|
|
296182
|
-
if (
|
|
296386
|
+
if (asRecord14(enumObj.options)?.deprecated === true) {
|
|
296183
296387
|
warnings.push(`GRPC_DEPRECATED: enum ${fullName} is marked deprecated`);
|
|
296184
296388
|
}
|
|
296185
296389
|
}
|
|
@@ -296264,7 +296468,7 @@ function lintHttpRule(rule, requestFields, responseFieldNames, warnings, operati
|
|
|
296264
296468
|
for (const verb of HTTP_RULE_VERBS) {
|
|
296265
296469
|
if (typeof rule[verb] === "string") patterns.push({ verb, path: rule[verb] });
|
|
296266
296470
|
}
|
|
296267
|
-
const custom =
|
|
296471
|
+
const custom = asRecord14(rule.custom);
|
|
296268
296472
|
if (custom && typeof custom.path === "string") patterns.push({ verb: String(custom.kind ?? "custom"), path: custom.path });
|
|
296269
296473
|
if (patterns.length === 0) {
|
|
296270
296474
|
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)`);
|
|
@@ -296326,7 +296530,7 @@ function lintHttpRule(rule, requestFields, responseFieldNames, warnings, operati
|
|
|
296326
296530
|
return;
|
|
296327
296531
|
}
|
|
296328
296532
|
for (const binding of bindingList) {
|
|
296329
|
-
const record =
|
|
296533
|
+
const record = asRecord14(binding);
|
|
296330
296534
|
if (record) lintHttpRule(record, requestFields, responseFieldNames, warnings, operationId, true);
|
|
296331
296535
|
}
|
|
296332
296536
|
}
|
|
@@ -296354,10 +296558,10 @@ function lintMethodOptions(method, operationId, warnings) {
|
|
|
296354
296558
|
const requestFields = httpFieldInfo(method.resolvedRequestType);
|
|
296355
296559
|
const responseFieldNames = method.resolvedResponseType ? new Set(asArray7(method.resolvedResponseType.fieldsArray).map((field) => String(field.name))) : null;
|
|
296356
296560
|
for (const entry of asArray7(method.parsedOptions)) {
|
|
296357
|
-
const http2 =
|
|
296561
|
+
const http2 = asRecord14(asRecord14(entry)?.["(google.api.http)"]);
|
|
296358
296562
|
if (http2) lintHttpRule(http2, requestFields, responseFieldNames, warnings, operationId, false);
|
|
296359
296563
|
}
|
|
296360
|
-
if (
|
|
296564
|
+
if (asRecord14(method.options)?.deprecated === true) {
|
|
296361
296565
|
warnings.push(`GRPC_DEPRECATED: rpc ${operationId} is marked deprecated`);
|
|
296362
296566
|
}
|
|
296363
296567
|
}
|
|
@@ -296462,7 +296666,7 @@ function parseProtoSchema(content, deps) {
|
|
|
296462
296666
|
}
|
|
296463
296667
|
const enumIndex = {};
|
|
296464
296668
|
for (const enumObj of enums) {
|
|
296465
|
-
const values = Object.keys(
|
|
296669
|
+
const values = Object.keys(asRecord14(enumObj.values) ?? {}).sort();
|
|
296466
296670
|
enumIndex[stripLeadingDot(enumObj.fullName)] = values;
|
|
296467
296671
|
lintEnum(enumObj, warnings, proto3, conventions);
|
|
296468
296672
|
}
|
|
@@ -296591,7 +296795,7 @@ var GRPC_INSTRUMENT_LIMITS = {
|
|
|
296591
296795
|
maxTestScriptBytes: 9e5,
|
|
296592
296796
|
maxCollectionUpdateBytes: 4e6
|
|
296593
296797
|
};
|
|
296594
|
-
function
|
|
296798
|
+
function asRecord15(value) {
|
|
296595
296799
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
296596
296800
|
return value;
|
|
296597
296801
|
}
|
|
@@ -297188,7 +297392,7 @@ function createMappingFailureScript2(message) {
|
|
|
297188
297392
|
];
|
|
297189
297393
|
}
|
|
297190
297394
|
function methodPathOf(item) {
|
|
297191
|
-
const payload =
|
|
297395
|
+
const payload = asRecord15(item.payload);
|
|
297192
297396
|
const value = payload?.methodPath;
|
|
297193
297397
|
return typeof value === "string" ? value : "";
|
|
297194
297398
|
}
|
|
@@ -297403,7 +297607,7 @@ function matchesFormatValue(format3, value) {
|
|
|
297403
297607
|
}
|
|
297404
297608
|
function staticRequestCheck(item, shape, methodPath2, warnings) {
|
|
297405
297609
|
if (!shape) return;
|
|
297406
|
-
const message =
|
|
297610
|
+
const message = asRecord15(asRecord15(item.payload)?.message);
|
|
297407
297611
|
const raw = typeof message?.content === "string" ? message.content : "";
|
|
297408
297612
|
if (!raw.trim()) return;
|
|
297409
297613
|
if (/\{\{[^}]+\}\}|<[a-zA-Z]/.test(raw)) return;
|
|
@@ -297414,7 +297618,7 @@ function staticRequestCheck(item, shape, methodPath2, warnings) {
|
|
|
297414
297618
|
warnings.push(`PROTO_REQUEST_BODY_INVALID_JSON: ${methodPath2} generated request message content is not valid JSON and is not validated`);
|
|
297415
297619
|
return;
|
|
297416
297620
|
}
|
|
297417
|
-
const record =
|
|
297621
|
+
const record = asRecord15(body2);
|
|
297418
297622
|
if (!record) return;
|
|
297419
297623
|
for (const field of shape.fields) {
|
|
297420
297624
|
const key = Object.prototype.hasOwnProperty.call(record, field.jsonName) ? field.jsonName : Object.prototype.hasOwnProperty.call(record, field.name) ? field.name : void 0;
|
|
@@ -297474,16 +297678,16 @@ function instrumentGrpcCollection(collection, index) {
|
|
|
297474
297678
|
if (scriptBytes > GRPC_INSTRUMENT_LIMITS.maxTestScriptBytes) {
|
|
297475
297679
|
throw new Error(`PROTO_SCRIPT_SIZE_EXCEEDED: generated test script for ${methodPath2} exceeded ${GRPC_INSTRUMENT_LIMITS.maxTestScriptBytes} bytes`);
|
|
297476
297680
|
}
|
|
297477
|
-
const events2 = asArray8(item.event).filter((entry) =>
|
|
297681
|
+
const events2 = asArray8(item.event).filter((entry) => asRecord15(entry)?.listen !== "test");
|
|
297478
297682
|
item.event = [...events2, { listen: "test", script: { type: "text/javascript", exec: script } }];
|
|
297479
297683
|
}
|
|
297480
297684
|
for (const child4 of asArray8(item.item)) {
|
|
297481
|
-
const childRecord =
|
|
297685
|
+
const childRecord = asRecord15(child4);
|
|
297482
297686
|
if (childRecord) inject(childRecord);
|
|
297483
297687
|
}
|
|
297484
297688
|
};
|
|
297485
297689
|
for (const entry of asArray8(collection.item)) {
|
|
297486
|
-
const item =
|
|
297690
|
+
const item = asRecord15(entry);
|
|
297487
297691
|
if (item) inject(item);
|
|
297488
297692
|
}
|
|
297489
297693
|
const missing = index.operations.filter((operation) => !covered.has(operation.methodPath));
|
|
@@ -297498,7 +297702,7 @@ function instrumentGrpcCollection(collection, index) {
|
|
|
297498
297702
|
}
|
|
297499
297703
|
|
|
297500
297704
|
// src/lib/protocols/grpc/service-config.ts
|
|
297501
|
-
function
|
|
297705
|
+
function asRecord16(value) {
|
|
297502
297706
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
297503
297707
|
return value;
|
|
297504
297708
|
}
|
|
@@ -297657,7 +297861,7 @@ function lintLoadBalancingEntries(entries, label, warnings, depth) {
|
|
|
297657
297861
|
return;
|
|
297658
297862
|
}
|
|
297659
297863
|
for (const entry of entries) {
|
|
297660
|
-
const record =
|
|
297864
|
+
const record = asRecord16(entry);
|
|
297661
297865
|
const keys = record ? Object.keys(record) : [];
|
|
297662
297866
|
if (!record || keys.length !== 1) {
|
|
297663
297867
|
warnings.push(`GRPC_SERVICE_CONFIG_LB_INVALID: each ${label} entry must be an object with exactly one policy key (service_config.proto)`);
|
|
@@ -297668,7 +297872,7 @@ function lintLoadBalancingEntries(entries, label, warnings, depth) {
|
|
|
297668
297872
|
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)`);
|
|
297669
297873
|
continue;
|
|
297670
297874
|
}
|
|
297671
|
-
const config =
|
|
297875
|
+
const config = asRecord16(record[policy]);
|
|
297672
297876
|
if (!config) {
|
|
297673
297877
|
warnings.push(`GRPC_SERVICE_CONFIG_LB_INVALID: ${label} policy "${policy}" config must be a JSON object (service_config.proto)`);
|
|
297674
297878
|
continue;
|
|
@@ -297793,7 +297997,7 @@ function lintGoogleApiServiceConfig(config, index, warnings) {
|
|
|
297793
297997
|
const declaredServices = new Set(index.operations.map((operation) => operation.serviceFullName));
|
|
297794
297998
|
const seenApis = /* @__PURE__ */ new Set();
|
|
297795
297999
|
asArray9(config.apis).forEach((entry, i) => {
|
|
297796
|
-
const record =
|
|
298000
|
+
const record = asRecord16(entry);
|
|
297797
298001
|
const name = record && typeof record.name === "string" ? record.name : null;
|
|
297798
298002
|
if (!name) {
|
|
297799
298003
|
warnings.push(`GRPC_GOOGLE_API_CONFIG_INVALID: apis[${i}] must be an object with a string name (google.api.Service)`);
|
|
@@ -297810,7 +298014,7 @@ function lintGoogleApiServiceConfig(config, index, warnings) {
|
|
|
297810
298014
|
const lintTypeList = (listKey, resolves, kind) => {
|
|
297811
298015
|
const seen = /* @__PURE__ */ new Set();
|
|
297812
298016
|
asArray9(config[listKey]).forEach((entry, i) => {
|
|
297813
|
-
const record =
|
|
298017
|
+
const record = asRecord16(entry);
|
|
297814
298018
|
const name = record && typeof record.name === "string" ? record.name : null;
|
|
297815
298019
|
if (!name) {
|
|
297816
298020
|
warnings.push(`GRPC_GOOGLE_API_CONFIG_INVALID: ${listKey}[${i}] must be an object with a string name (google.api.Service)`);
|
|
@@ -297838,7 +298042,7 @@ function lintGoogleApiServiceConfig(config, index, warnings) {
|
|
|
297838
298042
|
};
|
|
297839
298043
|
lintTypeList("types", (name) => index.messages[name] !== void 0, "message");
|
|
297840
298044
|
lintTypeList("enums", (name) => index.enums[name] !== void 0, "enum");
|
|
297841
|
-
const declaredDetails = asArray9(config.types).map((entry) =>
|
|
298045
|
+
const declaredDetails = asArray9(config.types).map((entry) => asRecord16(entry)?.name).filter((name) => typeof name === "string" && GOOGLE_RPC_ERROR_DETAIL_TYPES.has(name));
|
|
297842
298046
|
if (declaredDetails.length > 0 && !declaredDetails.includes("google.rpc.ErrorInfo")) {
|
|
297843
298047
|
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");
|
|
297844
298048
|
}
|
|
@@ -297866,7 +298070,7 @@ function lintServiceConfigObject(config, index, warnings) {
|
|
|
297866
298070
|
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");
|
|
297867
298071
|
}
|
|
297868
298072
|
if (config.healthCheckConfig !== void 0) {
|
|
297869
|
-
const health =
|
|
298073
|
+
const health = asRecord16(config.healthCheckConfig);
|
|
297870
298074
|
if (!health) {
|
|
297871
298075
|
warnings.push("GRPC_SERVICE_CONFIG_INVALID: healthCheckConfig must be an object (service_config.proto)");
|
|
297872
298076
|
} else {
|
|
@@ -297880,7 +298084,7 @@ function lintServiceConfigObject(config, index, warnings) {
|
|
|
297880
298084
|
}
|
|
297881
298085
|
}
|
|
297882
298086
|
}
|
|
297883
|
-
const throttling =
|
|
298087
|
+
const throttling = asRecord16(config.retryThrottling);
|
|
297884
298088
|
if (config.retryThrottling !== void 0) {
|
|
297885
298089
|
const maxTokens = throttling?.maxTokens;
|
|
297886
298090
|
const tokenRatio = throttling?.tokenRatio;
|
|
@@ -297917,7 +298121,7 @@ function lintServiceConfigObject(config, index, warnings) {
|
|
|
297917
298121
|
const where = `methodConfig[${i}]`;
|
|
297918
298122
|
const meta = { targets: /* @__PURE__ */ new Set(), unresolved: false, retry: false, hedge: false, selectorCount: 0 };
|
|
297919
298123
|
entryMeta.push(meta);
|
|
297920
|
-
const methodConfig =
|
|
298124
|
+
const methodConfig = asRecord16(entry);
|
|
297921
298125
|
if (!methodConfig) {
|
|
297922
298126
|
warnings.push(`GRPC_SERVICE_CONFIG_INVALID: ${where} must be an object (service_config.proto)`);
|
|
297923
298127
|
return;
|
|
@@ -297935,7 +298139,7 @@ function lintServiceConfigObject(config, index, warnings) {
|
|
|
297935
298139
|
warnings.push(`GRPC_SERVICE_CONFIG_NAME_INVALID: ${where}.name must be a non-empty list of {service, method} selectors (service_config.proto)`);
|
|
297936
298140
|
} else {
|
|
297937
298141
|
names.forEach((nameEntry, j) => {
|
|
297938
|
-
const selector =
|
|
298142
|
+
const selector = asRecord16(nameEntry);
|
|
297939
298143
|
if (!selector) {
|
|
297940
298144
|
warnings.push(`GRPC_SERVICE_CONFIG_NAME_INVALID: ${where}.name[${j}] must be an object (service_config.proto)`);
|
|
297941
298145
|
return;
|
|
@@ -297978,8 +298182,8 @@ function lintServiceConfigObject(config, index, warnings) {
|
|
|
297978
298182
|
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])}`);
|
|
297979
298183
|
}
|
|
297980
298184
|
}
|
|
297981
|
-
const retryPolicy =
|
|
297982
|
-
const hedgingPolicy =
|
|
298185
|
+
const retryPolicy = asRecord16(methodConfig.retryPolicy);
|
|
298186
|
+
const hedgingPolicy = asRecord16(methodConfig.hedgingPolicy);
|
|
297983
298187
|
meta.retry = methodConfig.retryPolicy !== void 0;
|
|
297984
298188
|
meta.hedge = methodConfig.hedgingPolicy !== void 0;
|
|
297985
298189
|
if (methodConfig.retryPolicy !== void 0 && methodConfig.hedgingPolicy !== void 0) {
|
|
@@ -298047,7 +298251,7 @@ ${warnings.join("\n")}`);
|
|
|
298047
298251
|
if (Array.isArray(parsed)) {
|
|
298048
298252
|
parsed.forEach((entry, i) => {
|
|
298049
298253
|
const where = `grpc_config[${i}]`;
|
|
298050
|
-
const choice =
|
|
298254
|
+
const choice = asRecord16(entry);
|
|
298051
298255
|
if (!choice) {
|
|
298052
298256
|
warnings.push(`GRPC_SERVICE_CONFIG_CHOICE_INVALID: ${where} must be an object (gRFC A2 choice list)`);
|
|
298053
298257
|
return;
|
|
@@ -298066,7 +298270,7 @@ ${warnings.join("\n")}`);
|
|
|
298066
298270
|
if (choice.percentage !== void 0 && !(typeof choice.percentage === "number" && choice.percentage >= 0 && choice.percentage <= 100)) {
|
|
298067
298271
|
warnings.push(`GRPC_SERVICE_CONFIG_CHOICE_INVALID: ${where}.percentage must be a number in [0, 100] (gRFC A2)`);
|
|
298068
298272
|
}
|
|
298069
|
-
const embedded =
|
|
298273
|
+
const embedded = asRecord16(choice.serviceConfig);
|
|
298070
298274
|
if (!embedded) {
|
|
298071
298275
|
warnings.push(`GRPC_SERVICE_CONFIG_CHOICE_INVALID: ${where}.serviceConfig must be a JSON object (gRFC A2)`);
|
|
298072
298276
|
return;
|
|
@@ -298075,7 +298279,7 @@ ${warnings.join("\n")}`);
|
|
|
298075
298279
|
});
|
|
298076
298280
|
return finish();
|
|
298077
298281
|
}
|
|
298078
|
-
const config =
|
|
298282
|
+
const config = asRecord16(parsed);
|
|
298079
298283
|
if (!config) {
|
|
298080
298284
|
warnings.push("GRPC_SERVICE_CONFIG_INVALID: service config must be a JSON object (service_config.proto)");
|
|
298081
298285
|
return finish();
|
|
@@ -304333,7 +304537,7 @@ function lintWsdl20Services(services, interfaces, bindings, warnings) {
|
|
|
304333
304537
|
|
|
304334
304538
|
// src/lib/protocols/soap/xsd-index.ts
|
|
304335
304539
|
var XSD_NS = "http://www.w3.org/2001/XMLSchema";
|
|
304336
|
-
function
|
|
304540
|
+
function asRecord17(value) {
|
|
304337
304541
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
304338
304542
|
return value;
|
|
304339
304543
|
}
|
|
@@ -304369,7 +304573,7 @@ function children2(record, local2) {
|
|
|
304369
304573
|
if (key.startsWith("@_") || key === "#text") continue;
|
|
304370
304574
|
if (localName(key) !== local2) continue;
|
|
304371
304575
|
for (const entry of asArray10(record[key])) {
|
|
304372
|
-
const rec =
|
|
304576
|
+
const rec = asRecord17(entry);
|
|
304373
304577
|
if (rec) out.push(rec);
|
|
304374
304578
|
}
|
|
304375
304579
|
}
|
|
@@ -304405,7 +304609,7 @@ function parseOccursMax(raw) {
|
|
|
304405
304609
|
return Number.isNaN(value) ? 1 : value;
|
|
304406
304610
|
}
|
|
304407
304611
|
function simpleTypeFacets(simpleType, scopes) {
|
|
304408
|
-
const restriction =
|
|
304612
|
+
const restriction = asRecord17(child2(simpleType, "restriction"));
|
|
304409
304613
|
if (!restriction) return {};
|
|
304410
304614
|
const baseQName = attr2(restriction, "base");
|
|
304411
304615
|
const baseNs = baseQName ? namespaceForPrefix([...scopes, restriction], prefixOf(baseQName)) : "";
|
|
@@ -304432,7 +304636,7 @@ function sequenceChildren(complexType, scopes, tns, simpleTypes) {
|
|
|
304432
304636
|
if (!complexType) return void 0;
|
|
304433
304637
|
if (child2(complexType, "complexContent") !== void 0 || child2(complexType, "simpleContent") !== void 0) return void 0;
|
|
304434
304638
|
if (child2(complexType, "choice") !== void 0 || child2(complexType, "all") !== void 0 || child2(complexType, "group") !== void 0) return void 0;
|
|
304435
|
-
const sequence =
|
|
304639
|
+
const sequence = asRecord17(child2(complexType, "sequence"));
|
|
304436
304640
|
if (!sequence) return [];
|
|
304437
304641
|
if (child2(sequence, "choice") !== void 0 || child2(sequence, "sequence") !== void 0 || child2(sequence, "any") !== void 0 || child2(sequence, "group") !== void 0) return void 0;
|
|
304438
304642
|
const out = [];
|
|
@@ -304451,7 +304655,7 @@ function sequenceChildren(complexType, scopes, tns, simpleTypes) {
|
|
|
304451
304655
|
enumeration = sameSchema.enums;
|
|
304452
304656
|
}
|
|
304453
304657
|
}
|
|
304454
|
-
const inlineSimple =
|
|
304658
|
+
const inlineSimple = asRecord17(child2(el, "simpleType"));
|
|
304455
304659
|
if (inlineSimple) {
|
|
304456
304660
|
const facets = simpleTypeFacets(inlineSimple, [...scopes, el]);
|
|
304457
304661
|
builtinType = facets.base ?? builtinType;
|
|
@@ -304496,7 +304700,7 @@ function buildXsdIndex(docNode) {
|
|
|
304496
304700
|
for (const el of children2(schema, "element")) {
|
|
304497
304701
|
const name = attr2(el, "name");
|
|
304498
304702
|
if (!name) continue;
|
|
304499
|
-
const inline =
|
|
304703
|
+
const inline = asRecord17(child2(el, "complexType"));
|
|
304500
304704
|
const typeQName = attr2(el, "type");
|
|
304501
304705
|
const named = typeQName && namespaceForPrefix([...scopes, el], prefixOf(typeQName)) !== XSD_NS ? complexTypes.get(localName(typeQName)) ?? null : null;
|
|
304502
304706
|
index.elements.set(tns + "|" + name, {
|
|
@@ -304523,7 +304727,7 @@ function lookupXsdElement(index, namespace, name) {
|
|
|
304523
304727
|
}
|
|
304524
304728
|
|
|
304525
304729
|
// src/lib/protocols/soap/parser.ts
|
|
304526
|
-
function
|
|
304730
|
+
function asRecord18(value) {
|
|
304527
304731
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
304528
304732
|
return value;
|
|
304529
304733
|
}
|
|
@@ -304570,7 +304774,7 @@ function children3(record, local2) {
|
|
|
304570
304774
|
if (key.startsWith("@_") || key === "#text") continue;
|
|
304571
304775
|
if (localName2(key) !== local2) continue;
|
|
304572
304776
|
for (const entry of asArray11(record[key])) {
|
|
304573
|
-
const rec =
|
|
304777
|
+
const rec = asRecord18(entry);
|
|
304574
304778
|
if (rec) out.push(rec);
|
|
304575
304779
|
}
|
|
304576
304780
|
}
|
|
@@ -304674,7 +304878,7 @@ function parseSoapBindings11(definitions, messages, warnings) {
|
|
|
304674
304878
|
else if (ns === SOAP11_BINDING_NS) soapVersion = "1.1";
|
|
304675
304879
|
else continue;
|
|
304676
304880
|
for (const marker of asArray11(binding[key])) {
|
|
304677
|
-
const style = attr3(
|
|
304881
|
+
const style = attr3(asRecord18(marker), "style");
|
|
304678
304882
|
if (style) bindingStyle = style;
|
|
304679
304883
|
}
|
|
304680
304884
|
}
|
|
@@ -304687,7 +304891,7 @@ function parseSoapBindings11(definitions, messages, warnings) {
|
|
|
304687
304891
|
for (const key of Object.keys(operation)) {
|
|
304688
304892
|
if (localName2(key) !== "operation") continue;
|
|
304689
304893
|
for (const marker of asArray11(operation[key])) {
|
|
304690
|
-
const rec =
|
|
304894
|
+
const rec = asRecord18(marker);
|
|
304691
304895
|
const action = attr3(rec, "soapAction");
|
|
304692
304896
|
if (action) soapAction = action;
|
|
304693
304897
|
const style2 = attr3(rec, "style");
|
|
@@ -304700,8 +304904,8 @@ function parseSoapBindings11(definitions, messages, warnings) {
|
|
|
304700
304904
|
warnings.push(`SOAP_BINDING_STYLE_UNPARSEABLE: binding ${bindingName} operation ${opName} declares style "${styleRaw}" (expected document|rpc); style-specific assertions are skipped`);
|
|
304701
304905
|
style = void 0;
|
|
304702
304906
|
}
|
|
304703
|
-
const inputDirection =
|
|
304704
|
-
const outputDirection =
|
|
304907
|
+
const inputDirection = asRecord18(child3(operation, "input"));
|
|
304908
|
+
const outputDirection = asRecord18(child3(operation, "output"));
|
|
304705
304909
|
const inputBody = bodyMarker(inputDirection);
|
|
304706
304910
|
const outputBody = bodyMarker(outputDirection);
|
|
304707
304911
|
const useRaw = attr3(outputBody, "use") || attr3(inputBody, "use");
|
|
@@ -304781,8 +304985,8 @@ function parseServices11(definitions, messages, bindings, warnings) {
|
|
|
304781
304985
|
return children3(portType, "operation").map((operation) => {
|
|
304782
304986
|
const name = attr3(operation, "name");
|
|
304783
304987
|
const opWarnings = [];
|
|
304784
|
-
const inputRecord =
|
|
304785
|
-
const outputRecord =
|
|
304988
|
+
const inputRecord = asRecord18(child3(operation, "input"));
|
|
304989
|
+
const outputRecord = asRecord18(child3(operation, "output"));
|
|
304786
304990
|
const inputRef = localName2(attr3(inputRecord, "message"));
|
|
304787
304991
|
const outputRef = localName2(attr3(outputRecord, "message"));
|
|
304788
304992
|
const input = inputRef ? messages.get(inputRef) : void 0;
|
|
@@ -304836,7 +305040,7 @@ function parseServices11(definitions, messages, bindings, warnings) {
|
|
|
304836
305040
|
const seenPortTypes = /* @__PURE__ */ new Set();
|
|
304837
305041
|
for (const port of ports) {
|
|
304838
305042
|
const bindingName = localName2(attr3(port, "binding"));
|
|
304839
|
-
const address =
|
|
305043
|
+
const address = asRecord18(child3(port, "address"));
|
|
304840
305044
|
const location2 = attr3(address, "location");
|
|
304841
305045
|
if (location2 && !endpoint) endpoint = location2;
|
|
304842
305046
|
const portTypeName = bindingToPortType.get(bindingName);
|
|
@@ -304925,8 +305129,8 @@ function parseServices20(description, warnings) {
|
|
|
304925
305129
|
const buildOperations = (iface, binding) => children3(iface, "operation").map((operation) => {
|
|
304926
305130
|
const name = attr3(operation, "name");
|
|
304927
305131
|
const opWarnings = [];
|
|
304928
|
-
const inputRecord =
|
|
304929
|
-
const outputRecord =
|
|
305132
|
+
const inputRecord = asRecord18(child3(operation, "input"));
|
|
305133
|
+
const outputRecord = asRecord18(child3(operation, "output"));
|
|
304930
305134
|
const inputElement = attr3(inputRecord, "element");
|
|
304931
305135
|
const outputElement = attr3(outputRecord, "element");
|
|
304932
305136
|
const outLocal = outputElement.startsWith("#") ? "" : localName2(outputElement);
|
|
@@ -304974,9 +305178,9 @@ function parseServices20(description, warnings) {
|
|
|
304974
305178
|
for (const ep of children3(service, "endpoint")) {
|
|
304975
305179
|
let address = attr3(ep, "address");
|
|
304976
305180
|
if (!address) {
|
|
304977
|
-
const epr =
|
|
305181
|
+
const epr = asRecord18(child3(ep, "EndpointReference"));
|
|
304978
305182
|
const addressNode = child3(epr, "Address");
|
|
304979
|
-
const addressRecord =
|
|
305183
|
+
const addressRecord = asRecord18(addressNode);
|
|
304980
305184
|
address = addressRecord ? asString2(addressRecord["#text"]) : asString2(addressNode);
|
|
304981
305185
|
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`);
|
|
304982
305186
|
}
|
|
@@ -304997,7 +305201,7 @@ function parseServices20(description, warnings) {
|
|
|
304997
305201
|
return services;
|
|
304998
305202
|
}
|
|
304999
305203
|
function detectAddressing(node) {
|
|
305000
|
-
const record =
|
|
305204
|
+
const record = asRecord18(node);
|
|
305001
305205
|
if (!record) return false;
|
|
305002
305206
|
for (const key of Object.keys(record)) {
|
|
305003
305207
|
if (key.startsWith("@_") || key === "#text") continue;
|
|
@@ -305064,7 +305268,7 @@ function lintWsdl112(definitions, messages, warnings) {
|
|
|
305064
305268
|
const ns = namespaceForPrefix2([definitions, binding], prefixOf2(key));
|
|
305065
305269
|
if (ns !== SOAP11_BINDING_NS && ns !== SOAP12_BINDING_NS) continue;
|
|
305066
305270
|
for (const entry of asArray11(binding[key])) {
|
|
305067
|
-
const marker =
|
|
305271
|
+
const marker = asRecord18(entry);
|
|
305068
305272
|
if (!marker) continue;
|
|
305069
305273
|
const style = attr3(marker, "style");
|
|
305070
305274
|
if (style) bindingStyle = style;
|
|
@@ -305092,14 +305296,14 @@ function lintWsdl112(definitions, messages, warnings) {
|
|
|
305092
305296
|
for (const key of Object.keys(operation)) {
|
|
305093
305297
|
if (localName2(key) !== "operation") continue;
|
|
305094
305298
|
for (const entry of asArray11(operation[key])) {
|
|
305095
|
-
const style = attr3(
|
|
305299
|
+
const style = attr3(asRecord18(entry), "style");
|
|
305096
305300
|
if (style) styleRaw = style;
|
|
305097
305301
|
}
|
|
305098
305302
|
}
|
|
305099
305303
|
const effStyle = styleRaw === "rpc" ? "rpc" : "document";
|
|
305100
305304
|
styles.add(effStyle);
|
|
305101
|
-
const inputDirection =
|
|
305102
|
-
const outputDirection =
|
|
305305
|
+
const inputDirection = asRecord18(child3(operation, "input"));
|
|
305306
|
+
const outputDirection = asRecord18(child3(operation, "output"));
|
|
305103
305307
|
const inputBody = bodyMarker(inputDirection);
|
|
305104
305308
|
const outputBody = bodyMarker(outputDirection);
|
|
305105
305309
|
for (const [direction, body2] of [["input", inputBody], ["output", outputBody]]) {
|
|
@@ -305124,8 +305328,8 @@ function lintWsdl112(definitions, messages, warnings) {
|
|
|
305124
305328
|
}
|
|
305125
305329
|
}
|
|
305126
305330
|
const portTypeOp = portTypeOps.get(opName);
|
|
305127
|
-
const inputMessage = portTypeOp ? messages.get(localName2(attr3(
|
|
305128
|
-
const outputMessage = portTypeOp ? messages.get(localName2(attr3(
|
|
305331
|
+
const inputMessage = portTypeOp ? messages.get(localName2(attr3(asRecord18(child3(portTypeOp, "input")), "message"))) : void 0;
|
|
305332
|
+
const outputMessage = portTypeOp ? messages.get(localName2(attr3(asRecord18(child3(portTypeOp, "output")), "message"))) : void 0;
|
|
305129
305333
|
if (portTypeOp) {
|
|
305130
305334
|
const bindingHasOutput = child3(operation, "output") !== void 0;
|
|
305131
305335
|
const portTypeHasOutput = child3(portTypeOp, "output") !== void 0;
|
|
@@ -305185,7 +305389,7 @@ function lintWsdl112(definitions, messages, warnings) {
|
|
|
305185
305389
|
for (const service of children3(definitions, "service")) {
|
|
305186
305390
|
for (const port of children3(service, "port")) {
|
|
305187
305391
|
const portName = attr3(port, "name");
|
|
305188
|
-
const location2 = attr3(
|
|
305392
|
+
const location2 = attr3(asRecord18(child3(port, "address")), "location");
|
|
305189
305393
|
if (!location2) continue;
|
|
305190
305394
|
if (!/^https?:\/\//i.test(location2)) warnings.push(`SOAP_LINT_ADDRESS_NOT_HTTP: port ${portName} soap:address location "${location2}" is not an http(s) URL`);
|
|
305191
305395
|
const prior = addressLocations.get(location2);
|
|
@@ -305204,13 +305408,13 @@ function parseWsdl(content, opts) {
|
|
|
305204
305408
|
const parser = createParser();
|
|
305205
305409
|
let root;
|
|
305206
305410
|
try {
|
|
305207
|
-
root =
|
|
305411
|
+
root = asRecord18(parser.parse(text));
|
|
305208
305412
|
} catch (error2) {
|
|
305209
305413
|
throw new Error(`SOAP_WSDL_PARSE_ERROR: ${error2.message}`, { cause: error2 });
|
|
305210
305414
|
}
|
|
305211
305415
|
if (!root) throw new Error("SOAP_WSDL_PARSE_ERROR: document did not parse to an element");
|
|
305212
|
-
const definitions =
|
|
305213
|
-
const description =
|
|
305416
|
+
const definitions = asRecord18(child3(root, "definitions"));
|
|
305417
|
+
const description = asRecord18(child3(root, "description"));
|
|
305214
305418
|
if (!definitions && !description) {
|
|
305215
305419
|
throw new Error("SOAP_WSDL_ROOT_INVALID: expected a WSDL <definitions> (1.1) or <description> (2.0) root element");
|
|
305216
305420
|
}
|
|
@@ -305670,7 +305874,7 @@ function xsdPayloadLines(operation, index) {
|
|
|
305670
305874
|
}
|
|
305671
305875
|
|
|
305672
305876
|
// src/lib/protocols/soap/instrumenter.ts
|
|
305673
|
-
function
|
|
305877
|
+
function asRecord19(value) {
|
|
305674
305878
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
305675
305879
|
return value;
|
|
305676
305880
|
}
|
|
@@ -306352,12 +306556,12 @@ function forEachHttpRequest(node, visit4) {
|
|
|
306352
306556
|
const children4 = asArray12(node.item);
|
|
306353
306557
|
if (children4.length > 0) {
|
|
306354
306558
|
for (const child4 of children4) {
|
|
306355
|
-
const record =
|
|
306559
|
+
const record = asRecord19(child4);
|
|
306356
306560
|
if (record) forEachHttpRequest(record, visit4);
|
|
306357
306561
|
}
|
|
306358
306562
|
return;
|
|
306359
306563
|
}
|
|
306360
|
-
if (
|
|
306564
|
+
if (asRecord19(node.request)) visit4(node);
|
|
306361
306565
|
}
|
|
306362
306566
|
function instrumentSoapCollection(collection, index) {
|
|
306363
306567
|
const warnings = [...index.warnings];
|
|
@@ -306382,7 +306586,7 @@ function instrumentSoapCollection(collection, index) {
|
|
|
306382
306586
|
' pm.expect(code, "unsupported media types map to HTTP 415 (SOAP 1.2 Part 2 section 7)").to.eql(415);',
|
|
306383
306587
|
"});"
|
|
306384
306588
|
];
|
|
306385
|
-
const existingEvents = asArray12(item.event).map((entry) =>
|
|
306589
|
+
const existingEvents = asArray12(item.event).map((entry) => asRecord19(entry)).filter((entry) => Boolean(entry) && entry.listen !== "test");
|
|
306386
306590
|
item.event = [...existingEvents, { listen: "test", script: { type: "text/javascript", exec: probeExec } }];
|
|
306387
306591
|
return;
|
|
306388
306592
|
}
|
|
@@ -306396,13 +306600,13 @@ function instrumentSoapCollection(collection, index) {
|
|
|
306396
306600
|
" pm.expect.fail(contractMappingError);",
|
|
306397
306601
|
"});"
|
|
306398
306602
|
];
|
|
306399
|
-
const existing2 = asArray12(item.event).map((entry) =>
|
|
306603
|
+
const existing2 = asArray12(item.event).map((entry) => asRecord19(entry)).filter((entry) => Boolean(entry) && entry.listen !== "test");
|
|
306400
306604
|
item.event = [...existing2, { listen: "test", script: { type: "text/javascript", exec: failExec } }];
|
|
306401
306605
|
return;
|
|
306402
306606
|
}
|
|
306403
306607
|
covered.add(operation.name);
|
|
306404
306608
|
const exec2 = createSoapScript(operation, warnings, { declaresAddressing: index.declaresAddressing, targetNamespace: index.targetNamespace, schemaIndex: index.schemaIndex }).split("\n");
|
|
306405
|
-
const existing = asArray12(item.event).map((entry) =>
|
|
306609
|
+
const existing = asArray12(item.event).map((entry) => asRecord19(entry)).filter((entry) => Boolean(entry) && entry.listen !== "test");
|
|
306406
306610
|
item.event = [
|
|
306407
306611
|
...existing,
|
|
306408
306612
|
{ listen: "test", script: { type: "text/javascript", exec: exec2 } }
|
|
@@ -306421,7 +306625,7 @@ var SOCKETIO_PROTOCOLS = /* @__PURE__ */ new Set(["socketio", "socket.io", "sio"
|
|
|
306421
306625
|
var MQTT_PROTOCOLS = /* @__PURE__ */ new Set(["mqtt", "mqtts", "secure-mqtt", "mqtt5"]);
|
|
306422
306626
|
var DEFAULT_SOCKETIO_PATH = "/socket.io";
|
|
306423
306627
|
var SAMPLE_MAX_DEPTH = 5;
|
|
306424
|
-
function
|
|
306628
|
+
function asRecord20(value) {
|
|
306425
306629
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
306426
306630
|
return value;
|
|
306427
306631
|
}
|
|
@@ -306444,7 +306648,7 @@ function contentKindFor(contentType2) {
|
|
|
306444
306648
|
return "binary";
|
|
306445
306649
|
}
|
|
306446
306650
|
function sampleFromSchema(schema, depth) {
|
|
306447
|
-
const record =
|
|
306651
|
+
const record = asRecord20(schema);
|
|
306448
306652
|
if (!record) return record === null ? null : {};
|
|
306449
306653
|
if (record.example !== void 0) return record.example;
|
|
306450
306654
|
if (record.default !== void 0) return record.default;
|
|
@@ -306460,7 +306664,7 @@ function sampleFromSchema(schema, depth) {
|
|
|
306460
306664
|
switch (type) {
|
|
306461
306665
|
case "object":
|
|
306462
306666
|
case void 0: {
|
|
306463
|
-
const properties =
|
|
306667
|
+
const properties = asRecord20(record.properties);
|
|
306464
306668
|
if (!properties) return {};
|
|
306465
306669
|
const required = new Set(asArray13(record.required));
|
|
306466
306670
|
const out = {};
|
|
@@ -306489,7 +306693,7 @@ function sampleFromSchema(schema, depth) {
|
|
|
306489
306693
|
}
|
|
306490
306694
|
}
|
|
306491
306695
|
function bindingKeyValues(bindingSchema) {
|
|
306492
|
-
const properties =
|
|
306696
|
+
const properties = asRecord20(asRecord20(bindingSchema)?.properties);
|
|
306493
306697
|
if (!properties) return [];
|
|
306494
306698
|
return Object.keys(properties).sort().map((key) => ({ key, value: "" }));
|
|
306495
306699
|
}
|
|
@@ -306503,8 +306707,8 @@ function detectTransport(channel, servers, messagesRaw, documentJson, warnings)
|
|
|
306503
306707
|
const protocolSocketio = servers.some((server) => SOCKETIO_PROTOCOLS.has(server.protocol().toLowerCase()));
|
|
306504
306708
|
if (protocolSocketio) return "socketio";
|
|
306505
306709
|
const channelJson = channel.json();
|
|
306506
|
-
const hasAck = messagesRaw.some((message) =>
|
|
306507
|
-
const hasSocketioExt = channelJson["x-socketio"] !== void 0 || documentJson["x-socketio"] !== void 0 ||
|
|
306710
|
+
const hasAck = messagesRaw.some((message) => asRecord20(message.json())?.["x-ack"] !== void 0);
|
|
306711
|
+
const hasSocketioExt = channelJson["x-socketio"] !== void 0 || documentJson["x-socketio"] !== void 0 || asRecord20(channelJson.bindings)?.socketio !== void 0;
|
|
306508
306712
|
if (hasAck || hasSocketioExt) {
|
|
306509
306713
|
warnings.push(
|
|
306510
306714
|
`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`
|
|
@@ -306519,7 +306723,7 @@ function wsBindingKeyValues(channel) {
|
|
|
306519
306723
|
return protocol === "ws" || protocol === "wss" || protocol === "websockets";
|
|
306520
306724
|
});
|
|
306521
306725
|
if (!wsBinding) return { headers: [], queryParams: [] };
|
|
306522
|
-
const value =
|
|
306726
|
+
const value = asRecord20(wsBinding.value()) ?? {};
|
|
306523
306727
|
return {
|
|
306524
306728
|
headers: bindingKeyValues(value.headers),
|
|
306525
306729
|
queryParams: bindingKeyValues(value.query),
|
|
@@ -306530,33 +306734,33 @@ function collectMqttInfo(channel, servers, messagesRaw, documentJson) {
|
|
|
306530
306734
|
const channelJson = channel.json();
|
|
306531
306735
|
const operationBindings = [];
|
|
306532
306736
|
for (const operationKey of ["publish", "subscribe"]) {
|
|
306533
|
-
const binding =
|
|
306737
|
+
const binding = asRecord20(asRecord20(asRecord20(channelJson[operationKey])?.bindings)?.mqtt);
|
|
306534
306738
|
if (binding) operationBindings.push(binding);
|
|
306535
306739
|
}
|
|
306536
306740
|
const unescapePointer = (segment) => segment.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
306537
|
-
const operations =
|
|
306741
|
+
const operations = asRecord20(documentJson.operations) ?? {};
|
|
306538
306742
|
for (const operation of Object.values(operations)) {
|
|
306539
|
-
const operationRecord =
|
|
306743
|
+
const operationRecord = asRecord20(operation);
|
|
306540
306744
|
if (!operationRecord) continue;
|
|
306541
|
-
const ref = String(
|
|
306745
|
+
const ref = String(asRecord20(operationRecord.channel)?.$ref ?? "");
|
|
306542
306746
|
const lastSegment = ref.includes("/") ? unescapePointer(ref.slice(ref.lastIndexOf("/") + 1)) : "";
|
|
306543
306747
|
if (lastSegment !== channel.id()) continue;
|
|
306544
|
-
const binding =
|
|
306748
|
+
const binding = asRecord20(asRecord20(operationRecord.bindings)?.mqtt);
|
|
306545
306749
|
if (binding) operationBindings.push(binding);
|
|
306546
306750
|
}
|
|
306547
306751
|
const serverBindings = [];
|
|
306548
306752
|
let protocolVersion = 4;
|
|
306549
306753
|
for (const server of servers) {
|
|
306550
|
-
const serverJson =
|
|
306754
|
+
const serverJson = asRecord20(server.json()) ?? {};
|
|
306551
306755
|
if (String(serverJson.protocolVersion ?? "") === "5" || server.protocol().toLowerCase() === "mqtt5") {
|
|
306552
306756
|
protocolVersion = 5;
|
|
306553
306757
|
}
|
|
306554
|
-
const binding =
|
|
306758
|
+
const binding = asRecord20(asRecord20(serverJson.bindings)?.mqtt);
|
|
306555
306759
|
if (binding) serverBindings.push(binding);
|
|
306556
306760
|
}
|
|
306557
306761
|
const messageBindings = [];
|
|
306558
306762
|
for (const message of messagesRaw) {
|
|
306559
|
-
const binding =
|
|
306763
|
+
const binding = asRecord20(asRecord20(asRecord20(message.json())?.bindings)?.mqtt);
|
|
306560
306764
|
if (binding) messageBindings.push({ messageId: message.id() || message.name() || "message", binding });
|
|
306561
306765
|
}
|
|
306562
306766
|
return { operationBindings, serverBindings, messageBindings, protocolVersion };
|
|
@@ -306573,7 +306777,7 @@ function buildReplySchemaByMessageId(document2) {
|
|
|
306573
306777
|
}
|
|
306574
306778
|
if (!reply) continue;
|
|
306575
306779
|
const replyMessage = reply.messages().all().find((message) => message.hasPayload());
|
|
306576
|
-
const replySchema = replyMessage ?
|
|
306780
|
+
const replySchema = replyMessage ? asRecord20(replyMessage.payload()?.json()) ?? void 0 : void 0;
|
|
306577
306781
|
if (!replySchema) continue;
|
|
306578
306782
|
for (const requestMessage of operation.messages().all()) {
|
|
306579
306783
|
const id = requestMessage.id();
|
|
@@ -306588,16 +306792,16 @@ function messageDescriptor2(message, warnings, channelId, defaultContentType, re
|
|
|
306588
306792
|
const title = message.title() || message.name() || id;
|
|
306589
306793
|
const contentType2 = message.contentType() || defaultContentType || "application/json";
|
|
306590
306794
|
const contentKind = contentKindFor(contentType2);
|
|
306591
|
-
const payloadSchema = message.hasPayload() ?
|
|
306795
|
+
const payloadSchema = message.hasPayload() ? asRecord20(message.payload()?.json()) ?? void 0 : void 0;
|
|
306592
306796
|
if (!payloadSchema) {
|
|
306593
306797
|
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`);
|
|
306594
306798
|
}
|
|
306595
|
-
const rawMessage =
|
|
306596
|
-
const xAckSchema =
|
|
306799
|
+
const rawMessage = asRecord20(message.json()) ?? {};
|
|
306800
|
+
const xAckSchema = asRecord20(rawMessage["x-ack"]) ?? void 0;
|
|
306597
306801
|
const replySchema = replyByMessageId.get(message.id());
|
|
306598
306802
|
const ackSchema = xAckSchema ?? replySchema;
|
|
306599
306803
|
const ackSource = xAckSchema ? "x-ack" : replySchema ? "reply" : void 0;
|
|
306600
|
-
const correlationRaw =
|
|
306804
|
+
const correlationRaw = asRecord20(rawMessage.correlationId)?.location;
|
|
306601
306805
|
const correlationLocation = typeof correlationRaw === "string" ? correlationRaw : void 0;
|
|
306602
306806
|
const examples = message.examples().all().filter((example) => example.hasPayload());
|
|
306603
306807
|
const hasExample = examples.length > 0;
|
|
@@ -306633,7 +306837,7 @@ function channelDescriptor(channel, document2, documentJson, defaultContentType,
|
|
|
306633
306837
|
const servers = resolveServers(channel, document2);
|
|
306634
306838
|
const messagesRaw = channel.messages().all();
|
|
306635
306839
|
const transport = detectTransport(channel, servers, messagesRaw, documentJson, warnings);
|
|
306636
|
-
const parameterNames = Object.keys(
|
|
306840
|
+
const parameterNames = Object.keys(asRecord20(channel.json().parameters) ?? {}).sort();
|
|
306637
306841
|
const serverUrl = servers.find((server) => server.url())?.url() || options.endpointUrl?.trim() || "";
|
|
306638
306842
|
if (!serverUrl) {
|
|
306639
306843
|
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`);
|
|
@@ -307075,7 +307279,7 @@ var SCHEMES_BY_FAMILY = {
|
|
|
307075
307279
|
http: /* @__PURE__ */ new Set(["http", "https"]),
|
|
307076
307280
|
amqp: /* @__PURE__ */ new Set(["amqp", "amqps"])
|
|
307077
307281
|
};
|
|
307078
|
-
function
|
|
307282
|
+
function asRecord21(value) {
|
|
307079
307283
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
307080
307284
|
return value;
|
|
307081
307285
|
}
|
|
@@ -307094,7 +307298,7 @@ function parsesAsUrl(value) {
|
|
|
307094
307298
|
}
|
|
307095
307299
|
}
|
|
307096
307300
|
function checkExternalDocs(label, raw, warnings) {
|
|
307097
|
-
const externalDocs =
|
|
307301
|
+
const externalDocs = asRecord21(raw);
|
|
307098
307302
|
if (!externalDocs) return;
|
|
307099
307303
|
const url = externalDocs.url;
|
|
307100
307304
|
if (typeof url !== "string" || !parsesAsUrl(url)) {
|
|
@@ -307108,7 +307312,7 @@ function lintTagsAndExternalDocs(label, node, warnings) {
|
|
|
307108
307312
|
const seen = /* @__PURE__ */ new Set();
|
|
307109
307313
|
const reported = /* @__PURE__ */ new Set();
|
|
307110
307314
|
tags.forEach((entry, i) => {
|
|
307111
|
-
const tag =
|
|
307315
|
+
const tag = asRecord21(entry);
|
|
307112
307316
|
const name = typeof tag?.name === "string" ? tag.name : void 0;
|
|
307113
307317
|
if (name !== void 0) {
|
|
307114
307318
|
if (seen.has(name) && !reported.has(name)) {
|
|
@@ -307144,7 +307348,7 @@ function lintSchemaFormat(label, value, warnings) {
|
|
|
307144
307348
|
}
|
|
307145
307349
|
function lintTraits(label, traitsRaw, warnings) {
|
|
307146
307350
|
asArray14(traitsRaw).forEach((entry, i) => {
|
|
307147
|
-
const trait =
|
|
307351
|
+
const trait = asRecord21(entry);
|
|
307148
307352
|
if (trait && trait.payload !== void 0) {
|
|
307149
307353
|
warnings.push(
|
|
307150
307354
|
`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`
|
|
@@ -307153,7 +307357,7 @@ function lintTraits(label, traitsRaw, warnings) {
|
|
|
307153
307357
|
});
|
|
307154
307358
|
}
|
|
307155
307359
|
function lintParameter(label, raw, warnings) {
|
|
307156
|
-
const parameter =
|
|
307360
|
+
const parameter = asRecord21(raw);
|
|
307157
307361
|
if (!parameter) return;
|
|
307158
307362
|
const enumValues = asArray14(parameter.enum);
|
|
307159
307363
|
if (enumValues.length > 0) {
|
|
@@ -307173,9 +307377,9 @@ function lintParameter(label, raw, warnings) {
|
|
|
307173
307377
|
}
|
|
307174
307378
|
}
|
|
307175
307379
|
function lintSecurityRequirements(documentJson, is3, label, securityRaw, warnings) {
|
|
307176
|
-
const declared =
|
|
307380
|
+
const declared = asRecord21(asRecord21(documentJson.components)?.securitySchemes) ?? {};
|
|
307177
307381
|
for (const entry of asArray14(securityRaw)) {
|
|
307178
|
-
const requirement =
|
|
307382
|
+
const requirement = asRecord21(entry);
|
|
307179
307383
|
if (!requirement) continue;
|
|
307180
307384
|
if (is3) {
|
|
307181
307385
|
const type = String(requirement.type ?? "");
|
|
@@ -307188,7 +307392,7 @@ function lintSecurityRequirements(documentJson, is3, label, securityRaw, warning
|
|
|
307188
307392
|
continue;
|
|
307189
307393
|
}
|
|
307190
307394
|
for (const [schemeName, scopesRaw] of Object.entries(requirement)) {
|
|
307191
|
-
const scheme =
|
|
307395
|
+
const scheme = asRecord21(declared[schemeName]);
|
|
307192
307396
|
if (!scheme) {
|
|
307193
307397
|
warnings.push(
|
|
307194
307398
|
`ASYNCAPI_SECURITY_REQUIREMENT_UNDECLARED: ${label} security requirement references scheme ${JSON.stringify(schemeName)}, which is not declared in components.securitySchemes`
|
|
@@ -307205,9 +307409,9 @@ function lintSecurityRequirements(documentJson, is3, label, securityRaw, warning
|
|
|
307205
307409
|
}
|
|
307206
307410
|
}
|
|
307207
307411
|
function lintSecuritySchemes(documentJson, warnings) {
|
|
307208
|
-
const schemes =
|
|
307412
|
+
const schemes = asRecord21(asRecord21(documentJson.components)?.securitySchemes) ?? {};
|
|
307209
307413
|
for (const [name, raw] of Object.entries(schemes)) {
|
|
307210
|
-
const scheme =
|
|
307414
|
+
const scheme = asRecord21(raw);
|
|
307211
307415
|
if (!scheme) continue;
|
|
307212
307416
|
const type = scheme.type;
|
|
307213
307417
|
if (typeof type !== "string" || !ASYNCAPI_SECURITY_SCHEME_TYPES.has(type)) {
|
|
@@ -307229,9 +307433,9 @@ function lintSecuritySchemes(documentJson, warnings) {
|
|
|
307229
307433
|
}
|
|
307230
307434
|
}
|
|
307231
307435
|
function lintComponentKeys(documentJson, warnings) {
|
|
307232
|
-
const components =
|
|
307436
|
+
const components = asRecord21(documentJson.components) ?? {};
|
|
307233
307437
|
for (const [sectionName, sectionRaw] of Object.entries(components)) {
|
|
307234
|
-
const section =
|
|
307438
|
+
const section = asRecord21(sectionRaw);
|
|
307235
307439
|
if (!section) continue;
|
|
307236
307440
|
for (const key of Object.keys(section)) {
|
|
307237
307441
|
if (!COMPONENT_KEY_RE.test(key)) {
|
|
@@ -307243,7 +307447,7 @@ function lintComponentKeys(documentJson, warnings) {
|
|
|
307243
307447
|
}
|
|
307244
307448
|
}
|
|
307245
307449
|
function lintServerVariables(serverLabel, template, variablesRaw, warnings) {
|
|
307246
|
-
const variables =
|
|
307450
|
+
const variables = asRecord21(variablesRaw) ?? {};
|
|
307247
307451
|
const used = /* @__PURE__ */ new Set();
|
|
307248
307452
|
for (const match of template.matchAll(/\{([^{}]+)\}/g)) {
|
|
307249
307453
|
used.add(match[1]);
|
|
@@ -307257,7 +307461,7 @@ function lintServerVariables(serverLabel, template, variablesRaw, warnings) {
|
|
|
307257
307461
|
if (!used.has(name)) {
|
|
307258
307462
|
warnings.push(`ASYNCAPI_SERVER_VARIABLE_UNUSED: ${serverLabel} declares variable ${name} that never appears in the server url/host/pathname`);
|
|
307259
307463
|
}
|
|
307260
|
-
const variable =
|
|
307464
|
+
const variable = asRecord21(raw);
|
|
307261
307465
|
if (!variable) continue;
|
|
307262
307466
|
if (variable.default === void 0) {
|
|
307263
307467
|
warnings.push(
|
|
@@ -307278,10 +307482,10 @@ function lintServerVariables(serverLabel, template, variablesRaw, warnings) {
|
|
|
307278
307482
|
}
|
|
307279
307483
|
}
|
|
307280
307484
|
function lintServers(documentJson, is3, warnings) {
|
|
307281
|
-
const servers =
|
|
307485
|
+
const servers = asRecord21(documentJson.servers) ?? {};
|
|
307282
307486
|
let httpProtocolSeen = false;
|
|
307283
307487
|
for (const [name, raw] of Object.entries(servers)) {
|
|
307284
|
-
const server =
|
|
307488
|
+
const server = asRecord21(raw);
|
|
307285
307489
|
if (!server) continue;
|
|
307286
307490
|
const label = `server ${name}`;
|
|
307287
307491
|
const protocol = typeof server.protocol === "string" ? server.protocol.toLowerCase() : void 0;
|
|
@@ -307324,9 +307528,9 @@ function lintServers(documentJson, is3, warnings) {
|
|
|
307324
307528
|
}
|
|
307325
307529
|
}
|
|
307326
307530
|
function lintBindings(label, bindingsRaw, warnings) {
|
|
307327
|
-
const bindings =
|
|
307531
|
+
const bindings = asRecord21(bindingsRaw);
|
|
307328
307532
|
if (!bindings) return;
|
|
307329
|
-
const kafka =
|
|
307533
|
+
const kafka = asRecord21(bindings.kafka);
|
|
307330
307534
|
if (kafka) {
|
|
307331
307535
|
if (typeof kafka.topic === "string" && (kafka.topic === "." || kafka.topic === ".." || !KAFKA_TOPIC_NAME_RE.test(kafka.topic))) {
|
|
307332
307536
|
warnings.push(
|
|
@@ -307341,15 +307545,15 @@ function lintBindings(label, bindingsRaw, warnings) {
|
|
|
307341
307545
|
}
|
|
307342
307546
|
}
|
|
307343
307547
|
}
|
|
307344
|
-
const amqp =
|
|
307548
|
+
const amqp = asRecord21(bindings.amqp);
|
|
307345
307549
|
if (amqp) {
|
|
307346
|
-
const queue =
|
|
307550
|
+
const queue = asRecord21(amqp.queue);
|
|
307347
307551
|
if (queue && typeof queue.name === "string" && queue.name.length > 255) {
|
|
307348
307552
|
warnings.push(
|
|
307349
307553
|
`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)`
|
|
307350
307554
|
);
|
|
307351
307555
|
}
|
|
307352
|
-
const exchange =
|
|
307556
|
+
const exchange = asRecord21(amqp.exchange);
|
|
307353
307557
|
if (exchange && exchange.type !== void 0 && !AMQP_EXCHANGE_TYPES.has(String(exchange.type))) {
|
|
307354
307558
|
warnings.push(
|
|
307355
307559
|
`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)`
|
|
@@ -307366,7 +307570,7 @@ function lintBindings(label, bindingsRaw, warnings) {
|
|
|
307366
307570
|
);
|
|
307367
307571
|
}
|
|
307368
307572
|
}
|
|
307369
|
-
const http2 =
|
|
307573
|
+
const http2 = asRecord21(bindings.http);
|
|
307370
307574
|
if (http2) {
|
|
307371
307575
|
if (http2.method !== void 0 && (typeof http2.method !== "string" || !HTTP_BINDING_METHODS.has(http2.method))) {
|
|
307372
307576
|
warnings.push(
|
|
@@ -307379,7 +307583,7 @@ function lintBindings(label, bindingsRaw, warnings) {
|
|
|
307379
307583
|
);
|
|
307380
307584
|
}
|
|
307381
307585
|
}
|
|
307382
|
-
const ws =
|
|
307586
|
+
const ws = asRecord21(bindings.ws) ?? asRecord21(bindings.websockets);
|
|
307383
307587
|
if (ws && typeof ws.subprotocol === "string" && !IANA_WEBSOCKET_SUBPROTOCOLS.has(ws.subprotocol)) {
|
|
307384
307588
|
warnings.push(
|
|
307385
307589
|
`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)`
|
|
@@ -307387,11 +307591,11 @@ function lintBindings(label, bindingsRaw, warnings) {
|
|
|
307387
307591
|
}
|
|
307388
307592
|
}
|
|
307389
307593
|
function effectiveSchema(label, slot, raw, warnings) {
|
|
307390
|
-
const node =
|
|
307594
|
+
const node = asRecord21(raw);
|
|
307391
307595
|
if (!node) return void 0;
|
|
307392
307596
|
if (typeof node.schemaFormat === "string" && node.schema !== void 0) {
|
|
307393
307597
|
lintSchemaFormat(`${label} ${slot}`, node.schemaFormat, warnings);
|
|
307394
|
-
return
|
|
307598
|
+
return asRecord21(node.schema) ?? void 0;
|
|
307395
307599
|
}
|
|
307396
307600
|
return node;
|
|
307397
307601
|
}
|
|
@@ -307422,7 +307626,7 @@ function lintMessage2(documentJson, label, message, is3, minor, state, warnings)
|
|
|
307422
307626
|
const examples = asArray14(message.examples);
|
|
307423
307627
|
if (!is3) {
|
|
307424
307628
|
examples.forEach((entry, i) => {
|
|
307425
|
-
const example =
|
|
307629
|
+
const example = asRecord21(entry);
|
|
307426
307630
|
if (!example) return;
|
|
307427
307631
|
for (const key of Object.keys(example)) {
|
|
307428
307632
|
if (!MESSAGE_EXAMPLE_KEYS.has(key) && !key.startsWith("x-")) {
|
|
@@ -307433,7 +307637,7 @@ function lintMessage2(documentJson, label, message, is3, minor, state, warnings)
|
|
|
307433
307637
|
}
|
|
307434
307638
|
});
|
|
307435
307639
|
}
|
|
307436
|
-
if (headersSchema && examples.some((entry) =>
|
|
307640
|
+
if (headersSchema && examples.some((entry) => asRecord21(entry)?.headers !== void 0)) {
|
|
307437
307641
|
const packed = packSchema(documentJson, headersSchema, "3.0", "response");
|
|
307438
307642
|
const validate4 = packed.unsupported ? null : compileSchemaValidator(packed.schema);
|
|
307439
307643
|
if (!validate4) {
|
|
@@ -307442,7 +307646,7 @@ function lintMessage2(documentJson, label, message, is3, minor, state, warnings)
|
|
|
307442
307646
|
);
|
|
307443
307647
|
} else {
|
|
307444
307648
|
examples.forEach((entry, i) => {
|
|
307445
|
-
const example =
|
|
307649
|
+
const example = asRecord21(entry);
|
|
307446
307650
|
if (!example || example.headers === void 0) return;
|
|
307447
307651
|
if (!validate4(example.headers)) {
|
|
307448
307652
|
warnings.push(
|
|
@@ -307457,23 +307661,23 @@ function lintMessage2(documentJson, label, message, is3, minor, state, warnings)
|
|
|
307457
307661
|
lintTagsAndExternalDocs(label, message, warnings);
|
|
307458
307662
|
}
|
|
307459
307663
|
function messagesOfOperation2x(op) {
|
|
307460
|
-
const root =
|
|
307664
|
+
const root = asRecord21(op.message);
|
|
307461
307665
|
if (!root) return [];
|
|
307462
|
-
const oneOf = asArray14(root.oneOf).map((entry) =>
|
|
307666
|
+
const oneOf = asArray14(root.oneOf).map((entry) => asRecord21(entry)).filter((entry) => entry !== null);
|
|
307463
307667
|
return oneOf.length > 0 ? oneOf : [root];
|
|
307464
307668
|
}
|
|
307465
307669
|
function lintChannels(documentJson, is3, minor, warnings) {
|
|
307466
|
-
const channels =
|
|
307670
|
+
const channels = asRecord21(documentJson.channels) ?? {};
|
|
307467
307671
|
const state = { seen: /* @__PURE__ */ new WeakSet(), messageIds: /* @__PURE__ */ new Map() };
|
|
307468
307672
|
const operationIds = /* @__PURE__ */ new Map();
|
|
307469
307673
|
const addresses = /* @__PURE__ */ new Map();
|
|
307470
307674
|
for (const [channelKey, channelRaw] of Object.entries(channels)) {
|
|
307471
|
-
const channel =
|
|
307675
|
+
const channel = asRecord21(channelRaw);
|
|
307472
307676
|
if (!channel) continue;
|
|
307473
307677
|
const channelLabel = `channel ${channelKey}`;
|
|
307474
307678
|
lintBindings(channelLabel, channel.bindings, warnings);
|
|
307475
307679
|
lintTagsAndExternalDocs(channelLabel, channel, warnings);
|
|
307476
|
-
const parameters =
|
|
307680
|
+
const parameters = asRecord21(channel.parameters) ?? {};
|
|
307477
307681
|
for (const [parameterName, parameterRaw] of Object.entries(parameters)) {
|
|
307478
307682
|
lintParameter(`${channelLabel} parameter ${parameterName}`, parameterRaw, warnings);
|
|
307479
307683
|
}
|
|
@@ -307486,15 +307690,15 @@ function lintChannels(documentJson, is3, minor, warnings) {
|
|
|
307486
307690
|
addresses.set(channel.address, channelKey);
|
|
307487
307691
|
}
|
|
307488
307692
|
}
|
|
307489
|
-
const messages =
|
|
307693
|
+
const messages = asRecord21(channel.messages) ?? {};
|
|
307490
307694
|
for (const [messageKey, messageRaw] of Object.entries(messages)) {
|
|
307491
|
-
const message =
|
|
307695
|
+
const message = asRecord21(messageRaw);
|
|
307492
307696
|
if (message) lintMessage2(documentJson, `message ${messageKey} on channel ${channelKey}`, message, is3, minor, state, warnings);
|
|
307493
307697
|
}
|
|
307494
307698
|
continue;
|
|
307495
307699
|
}
|
|
307496
307700
|
for (const opKey of ["publish", "subscribe"]) {
|
|
307497
|
-
const op =
|
|
307701
|
+
const op = asRecord21(channel[opKey]);
|
|
307498
307702
|
if (!op) continue;
|
|
307499
307703
|
const opLabel = `${opKey} operation on channel ${channelKey}`;
|
|
307500
307704
|
if (typeof op.operationId === "string") {
|
|
@@ -307517,15 +307721,15 @@ function lintChannels(documentJson, is3, minor, warnings) {
|
|
|
307517
307721
|
}
|
|
307518
307722
|
}
|
|
307519
307723
|
function lintOperations3(documentJson, warnings) {
|
|
307520
|
-
const operations =
|
|
307724
|
+
const operations = asRecord21(documentJson.operations) ?? {};
|
|
307521
307725
|
for (const [operationKey, operationRaw] of Object.entries(operations)) {
|
|
307522
|
-
const operation =
|
|
307726
|
+
const operation = asRecord21(operationRaw);
|
|
307523
307727
|
if (!operation) continue;
|
|
307524
307728
|
const label = `operation ${operationKey}`;
|
|
307525
307729
|
if (operation.action !== "send" && operation.action !== "receive") {
|
|
307526
307730
|
warnings.push(`ASYNCAPI_OPERATION_ACTION_INVALID: ${label} action ${JSON.stringify(operation.action)} must be "send" or "receive" (AsyncAPI 3.0 Operation Object)`);
|
|
307527
307731
|
}
|
|
307528
|
-
const replyAddress =
|
|
307732
|
+
const replyAddress = asRecord21(asRecord21(operation.reply)?.address);
|
|
307529
307733
|
if (replyAddress && typeof replyAddress.location === "string" && !isAsyncApiRuntimeExpression(replyAddress.location)) {
|
|
307530
307734
|
warnings.push(
|
|
307531
307735
|
`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>)`
|
|
@@ -307549,7 +307753,7 @@ function resolveLocalPointer(root, ref) {
|
|
|
307549
307753
|
if (!Number.isInteger(idx) || idx < 0 || idx >= node.length) return false;
|
|
307550
307754
|
node = node[idx];
|
|
307551
307755
|
} else {
|
|
307552
|
-
const record =
|
|
307756
|
+
const record = asRecord21(node);
|
|
307553
307757
|
if (!record || !(key in record)) return false;
|
|
307554
307758
|
node = record[key];
|
|
307555
307759
|
}
|
|
@@ -307593,13 +307797,13 @@ function lintAsyncApiDocument(index) {
|
|
|
307593
307797
|
lintChannels(documentJson, is3, minor, warnings);
|
|
307594
307798
|
if (is3) lintOperations3(documentJson, warnings);
|
|
307595
307799
|
lintTagsAndExternalDocs("document", documentJson, warnings);
|
|
307596
|
-
const info2 =
|
|
307800
|
+
const info2 = asRecord21(documentJson.info);
|
|
307597
307801
|
if (info2) lintTagsAndExternalDocs("info", info2, warnings);
|
|
307598
307802
|
return warnings;
|
|
307599
307803
|
}
|
|
307600
307804
|
|
|
307601
307805
|
// src/lib/protocols/asyncapi/asyncapi-binding-lints.ts
|
|
307602
|
-
function
|
|
307806
|
+
function asRecord22(value) {
|
|
307603
307807
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
307604
307808
|
return value;
|
|
307605
307809
|
}
|
|
@@ -307694,46 +307898,46 @@ function pushSite(ctx, site) {
|
|
|
307694
307898
|
if (site) ctx.sites.push(site);
|
|
307695
307899
|
}
|
|
307696
307900
|
function siteOf(scope, label, raw, direction) {
|
|
307697
|
-
const bindings =
|
|
307901
|
+
const bindings = asRecord22(raw);
|
|
307698
307902
|
if (!bindings) return null;
|
|
307699
307903
|
return { scope, label, bindings, direction };
|
|
307700
307904
|
}
|
|
307701
307905
|
function collectSites(ctx) {
|
|
307702
307906
|
const { doc } = ctx;
|
|
307703
|
-
const servers =
|
|
307907
|
+
const servers = asRecord22(doc.servers) ?? {};
|
|
307704
307908
|
for (const [name, raw] of Object.entries(servers)) {
|
|
307705
|
-
const server =
|
|
307909
|
+
const server = asRecord22(raw);
|
|
307706
307910
|
if (server) pushSite(ctx, siteOf("server", "server " + name, server.bindings));
|
|
307707
307911
|
}
|
|
307708
|
-
const channels =
|
|
307912
|
+
const channels = asRecord22(doc.channels) ?? {};
|
|
307709
307913
|
for (const [chName, rawCh] of Object.entries(channels)) {
|
|
307710
|
-
const channel =
|
|
307914
|
+
const channel = asRecord22(rawCh);
|
|
307711
307915
|
if (!channel) continue;
|
|
307712
307916
|
pushSite(ctx, siteOf("channel", "channel " + chName, channel.bindings));
|
|
307713
307917
|
for (const opKeyword of ["publish", "subscribe"]) {
|
|
307714
|
-
const op =
|
|
307918
|
+
const op = asRecord22(channel[opKeyword]);
|
|
307715
307919
|
if (!op) continue;
|
|
307716
307920
|
const direction = opKeyword === "publish" ? "send" : "receive";
|
|
307717
307921
|
pushSite(ctx, siteOf("operation", "channel " + chName + " " + opKeyword, op.bindings, direction));
|
|
307718
|
-
const message =
|
|
307922
|
+
const message = asRecord22(op.message);
|
|
307719
307923
|
if (message) collectMessageSites(ctx, "channel " + chName + " " + opKeyword + " message", message, direction);
|
|
307720
307924
|
}
|
|
307721
|
-
const chMessages =
|
|
307925
|
+
const chMessages = asRecord22(channel.messages);
|
|
307722
307926
|
if (chMessages) {
|
|
307723
307927
|
for (const [msgName, rawMsg] of Object.entries(chMessages)) {
|
|
307724
|
-
const message =
|
|
307928
|
+
const message = asRecord22(rawMsg);
|
|
307725
307929
|
if (message) collectMessageSites(ctx, "channel " + chName + " message " + msgName, message, void 0);
|
|
307726
307930
|
}
|
|
307727
307931
|
}
|
|
307728
307932
|
}
|
|
307729
|
-
const operations =
|
|
307933
|
+
const operations = asRecord22(doc.operations) ?? {};
|
|
307730
307934
|
for (const [opName, rawOp] of Object.entries(operations)) {
|
|
307731
|
-
const op =
|
|
307935
|
+
const op = asRecord22(rawOp);
|
|
307732
307936
|
if (!op) continue;
|
|
307733
307937
|
const direction = op.action === "send" ? "send" : op.action === "receive" ? "receive" : void 0;
|
|
307734
307938
|
pushSite(ctx, siteOf("operation", "operation " + opName, op.bindings, direction));
|
|
307735
307939
|
}
|
|
307736
|
-
const components =
|
|
307940
|
+
const components = asRecord22(doc.components) ?? {};
|
|
307737
307941
|
const componentScopes = [
|
|
307738
307942
|
["serverBindings", "server"],
|
|
307739
307943
|
["channelBindings", "channel"],
|
|
@@ -307741,21 +307945,21 @@ function collectSites(ctx) {
|
|
|
307741
307945
|
["messageBindings", "message"]
|
|
307742
307946
|
];
|
|
307743
307947
|
for (const [key, scope] of componentScopes) {
|
|
307744
|
-
const group2 =
|
|
307948
|
+
const group2 = asRecord22(components[key]) ?? {};
|
|
307745
307949
|
for (const [name, raw] of Object.entries(group2)) {
|
|
307746
307950
|
pushSite(ctx, siteOf(scope, "components." + key + " " + name, raw));
|
|
307747
307951
|
}
|
|
307748
307952
|
}
|
|
307749
|
-
const compMessages =
|
|
307953
|
+
const compMessages = asRecord22(components.messages) ?? {};
|
|
307750
307954
|
for (const [name, raw] of Object.entries(compMessages)) {
|
|
307751
|
-
const message =
|
|
307955
|
+
const message = asRecord22(raw);
|
|
307752
307956
|
if (message) collectMessageSites(ctx, "components.messages " + name, message, void 0);
|
|
307753
307957
|
}
|
|
307754
307958
|
}
|
|
307755
307959
|
function collectMessageSites(ctx, label, message, direction) {
|
|
307756
307960
|
pushSite(ctx, siteOf("message", label, message.bindings, direction));
|
|
307757
307961
|
for (const entry of asArray15(message.oneOf)) {
|
|
307758
|
-
const alt =
|
|
307962
|
+
const alt = asRecord22(entry);
|
|
307759
307963
|
if (alt) pushSite(ctx, siteOf("message", label + " oneOf alternative", alt.bindings, direction));
|
|
307760
307964
|
}
|
|
307761
307965
|
}
|
|
@@ -307780,7 +307984,7 @@ function lintBindingSites(ctx) {
|
|
|
307780
307984
|
}
|
|
307781
307985
|
const family = BINDING_KEY_FAMILY[key];
|
|
307782
307986
|
if (family) familiesSeen.set(family, site.label + " bindings." + key);
|
|
307783
|
-
const binding =
|
|
307987
|
+
const binding = asRecord22(site.bindings[key]);
|
|
307784
307988
|
if (!binding) continue;
|
|
307785
307989
|
if (key === "mqtt5") {
|
|
307786
307990
|
warnings.push(
|
|
@@ -307823,8 +308027,8 @@ function lintBindingSites(ctx) {
|
|
|
307823
308027
|
}
|
|
307824
308028
|
}
|
|
307825
308029
|
const serverFamilies = /* @__PURE__ */ new Set();
|
|
307826
|
-
for (const raw of Object.values(
|
|
307827
|
-
const server =
|
|
308030
|
+
for (const raw of Object.values(asRecord22(ctx.doc.servers) ?? {})) {
|
|
308031
|
+
const server = asRecord22(raw);
|
|
307828
308032
|
const protocol = typeof server?.protocol === "string" ? server.protocol.toLowerCase() : "";
|
|
307829
308033
|
const family = SERVER_PROTOCOL_FAMILY[protocol];
|
|
307830
308034
|
if (family) serverFamilies.add(family);
|
|
@@ -307840,7 +308044,7 @@ function lintBindingSites(ctx) {
|
|
|
307840
308044
|
}
|
|
307841
308045
|
}
|
|
307842
308046
|
function compileBindingSchema(ctx, label, schema) {
|
|
307843
|
-
const record =
|
|
308047
|
+
const record = asRecord22(schema);
|
|
307844
308048
|
if (!record) return null;
|
|
307845
308049
|
const packed = packSchema(ctx.doc, record, "3.0", "response");
|
|
307846
308050
|
if (packed.unsupported) {
|
|
@@ -307874,9 +308078,9 @@ function lintWsChannelBinding(ctx, label, binding) {
|
|
|
307874
308078
|
for (const part of ["query", "headers"]) {
|
|
307875
308079
|
const schemaRaw = binding[part];
|
|
307876
308080
|
if (schemaRaw === void 0) continue;
|
|
307877
|
-
const schema =
|
|
308081
|
+
const schema = asRecord22(schemaRaw);
|
|
307878
308082
|
if (!schema) continue;
|
|
307879
|
-
const properties =
|
|
308083
|
+
const properties = asRecord22(schema.properties);
|
|
307880
308084
|
if (!properties || Object.keys(properties).length === 0) {
|
|
307881
308085
|
warnings.push(
|
|
307882
308086
|
"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)"
|
|
@@ -307893,7 +308097,7 @@ function lintWsChannelBinding(ctx, label, binding) {
|
|
|
307893
308097
|
}
|
|
307894
308098
|
if (part !== "headers") continue;
|
|
307895
308099
|
const lower = name.toLowerCase();
|
|
307896
|
-
const prop =
|
|
308100
|
+
const prop = asRecord22(rawProp) ?? {};
|
|
307897
308101
|
if (WS_RUNTIME_OWNED_HEADERS.has(lower)) {
|
|
307898
308102
|
const detail = required.has(lower) ? "is required by the binding but" : "";
|
|
307899
308103
|
warnings.push(
|
|
@@ -307944,10 +308148,10 @@ function substituteTemplates(value) {
|
|
|
307944
308148
|
}
|
|
307945
308149
|
function lintChannelAddresses(ctx) {
|
|
307946
308150
|
const { doc, warnings } = ctx;
|
|
307947
|
-
const channels =
|
|
308151
|
+
const channels = asRecord22(doc.channels) ?? {};
|
|
307948
308152
|
const wsServers = [];
|
|
307949
|
-
for (const [name, raw] of Object.entries(
|
|
307950
|
-
const server =
|
|
308153
|
+
for (const [name, raw] of Object.entries(asRecord22(doc.servers) ?? {})) {
|
|
308154
|
+
const server = asRecord22(raw);
|
|
307951
308155
|
if (!server) continue;
|
|
307952
308156
|
const protocol = typeof server.protocol === "string" ? server.protocol.toLowerCase() : "";
|
|
307953
308157
|
if (SERVER_PROTOCOL_FAMILY[protocol] !== "ws") continue;
|
|
@@ -307955,7 +308159,7 @@ function lintChannelAddresses(ctx) {
|
|
|
307955
308159
|
if (url) wsServers.push({ name, base: url });
|
|
307956
308160
|
}
|
|
307957
308161
|
for (const [chName, rawCh] of Object.entries(channels)) {
|
|
307958
|
-
const channel =
|
|
308162
|
+
const channel = asRecord22(rawCh);
|
|
307959
308163
|
if (!channel) continue;
|
|
307960
308164
|
const address = ctx.isV3 ? channel.address : chName;
|
|
307961
308165
|
if (typeof address !== "string" || address.length === 0) continue;
|
|
@@ -307992,8 +308196,8 @@ function lintChannelAddresses(ctx) {
|
|
|
307992
308196
|
}
|
|
307993
308197
|
}
|
|
307994
308198
|
function collectMqttServerVersions(ctx) {
|
|
307995
|
-
for (const raw of Object.values(
|
|
307996
|
-
const server =
|
|
308199
|
+
for (const raw of Object.values(asRecord22(ctx.doc.servers) ?? {})) {
|
|
308200
|
+
const server = asRecord22(raw);
|
|
307997
308201
|
if (!server) continue;
|
|
307998
308202
|
const protocol = typeof server.protocol === "string" ? server.protocol.toLowerCase() : "";
|
|
307999
308203
|
if (SERVER_PROTOCOL_FAMILY[protocol] !== "mqtt") continue;
|
|
@@ -308014,7 +308218,7 @@ function lintMqttBindings(ctx) {
|
|
|
308014
308218
|
const { warnings } = ctx;
|
|
308015
308219
|
const only3x = ctx.mqttVersions.size > 0 && !ctx.mqttVersions.has(5) && !ctx.mqttVersions.has(0);
|
|
308016
308220
|
for (const site of ctx.sites) {
|
|
308017
|
-
const binding =
|
|
308221
|
+
const binding = asRecord22(site.bindings.mqtt);
|
|
308018
308222
|
if (!binding) continue;
|
|
308019
308223
|
if (only3x) {
|
|
308020
308224
|
const gated = MQTT5_ONLY_FIELDS[site.scope];
|
|
@@ -308030,7 +308234,7 @@ function lintMqttBindings(ctx) {
|
|
|
308030
308234
|
}
|
|
308031
308235
|
if (site.scope === "server") {
|
|
308032
308236
|
const clientId = binding.clientId;
|
|
308033
|
-
if (clientId !== void 0 && typeof clientId !== "string" && !
|
|
308237
|
+
if (clientId !== void 0 && typeof clientId !== "string" && !asRecord22(clientId)) {
|
|
308034
308238
|
warnings.push("ASYNCAPI_MQTT_CLIENT_ID_INVALID: " + site.label + " mqtt binding clientId must be a string or schema object (mqtt binding README)");
|
|
308035
308239
|
}
|
|
308036
308240
|
if (typeof clientId === "string") {
|
|
@@ -308043,12 +308247,12 @@ function lintMqttBindings(ctx) {
|
|
|
308043
308247
|
if (clientId === "" && only3x && binding.cleanSession !== true) {
|
|
308044
308248
|
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)");
|
|
308045
308249
|
}
|
|
308046
|
-
} else if (
|
|
308250
|
+
} else if (asRecord22(clientId)) {
|
|
308047
308251
|
compileBindingSchema(ctx, site.label + " mqtt binding clientId", clientId);
|
|
308048
308252
|
}
|
|
308049
308253
|
const lastWill = binding.lastWill;
|
|
308050
308254
|
if (lastWill !== void 0) {
|
|
308051
|
-
const will =
|
|
308255
|
+
const will = asRecord22(lastWill);
|
|
308052
308256
|
if (!will) {
|
|
308053
308257
|
warnings.push("ASYNCAPI_MQTT_LAST_WILL_INVALID: " + site.label + " mqtt binding lastWill must be an object (mqtt binding README)");
|
|
308054
308258
|
} else {
|
|
@@ -308065,7 +308269,7 @@ function lintMqttBindings(ctx) {
|
|
|
308065
308269
|
}
|
|
308066
308270
|
for (const [field, max] of [["sessionExpiryInterval", 4294967295], ["maximumPacketSize", 268435455]]) {
|
|
308067
308271
|
const value = binding[field];
|
|
308068
|
-
if (
|
|
308272
|
+
if (asRecord22(value)) compileBindingSchema(ctx, site.label + " mqtt binding " + field, value);
|
|
308069
308273
|
else if (typeof value === "number" && value > max) {
|
|
308070
308274
|
warnings.push("ASYNCAPI_MQTT_VALUE_OUT_OF_RANGE: " + site.label + " mqtt binding " + field + " " + value + " exceeds the MQTT wire ceiling " + max);
|
|
308071
308275
|
}
|
|
@@ -308073,7 +308277,7 @@ function lintMqttBindings(ctx) {
|
|
|
308073
308277
|
}
|
|
308074
308278
|
if (site.scope === "operation") {
|
|
308075
308279
|
const expiry = binding.messageExpiryInterval;
|
|
308076
|
-
if (
|
|
308280
|
+
if (asRecord22(expiry)) compileBindingSchema(ctx, site.label + " mqtt binding messageExpiryInterval", expiry);
|
|
308077
308281
|
else if (typeof expiry === "number" && expiry > 4294967295) {
|
|
308078
308282
|
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)");
|
|
308079
308283
|
}
|
|
@@ -308093,15 +308297,15 @@ function lintMqttBindings(ctx) {
|
|
|
308093
308297
|
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)");
|
|
308094
308298
|
}
|
|
308095
308299
|
const correlationData = binding.correlationData;
|
|
308096
|
-
if (
|
|
308300
|
+
if (asRecord22(correlationData)) {
|
|
308097
308301
|
compileBindingSchema(ctx, site.label + " mqtt binding correlationData", correlationData);
|
|
308098
|
-
const maxLength =
|
|
308302
|
+
const maxLength = asRecord22(correlationData)?.maxLength;
|
|
308099
308303
|
if (typeof maxLength === "number" && maxLength > 65535) {
|
|
308100
308304
|
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)");
|
|
308101
308305
|
}
|
|
308102
308306
|
}
|
|
308103
308307
|
const responseTopic = binding.responseTopic;
|
|
308104
|
-
if (
|
|
308308
|
+
if (asRecord22(responseTopic)) compileBindingSchema(ctx, site.label + " mqtt binding responseTopic", responseTopic);
|
|
308105
308309
|
const pfi = binding.payloadFormatIndicator;
|
|
308106
308310
|
if (pfi === 1) {
|
|
308107
308311
|
const message = siteMessageRecord(ctx, site);
|
|
@@ -308131,38 +308335,38 @@ function normalizeMediaType(value) {
|
|
|
308131
308335
|
function siteMessageRecord(ctx, site) {
|
|
308132
308336
|
const doc = ctx.doc;
|
|
308133
308337
|
const matches = (message) => {
|
|
308134
|
-
return message !== null &&
|
|
308338
|
+
return message !== null && asRecord22(message.bindings)?.mqtt === site.bindings.mqtt;
|
|
308135
308339
|
};
|
|
308136
|
-
for (const rawCh of Object.values(
|
|
308137
|
-
const channel =
|
|
308340
|
+
for (const rawCh of Object.values(asRecord22(doc.channels) ?? {})) {
|
|
308341
|
+
const channel = asRecord22(rawCh);
|
|
308138
308342
|
if (!channel) continue;
|
|
308139
308343
|
for (const opKeyword of ["publish", "subscribe"]) {
|
|
308140
|
-
const op =
|
|
308141
|
-
const message =
|
|
308344
|
+
const op = asRecord22(channel[opKeyword]);
|
|
308345
|
+
const message = asRecord22(op?.message);
|
|
308142
308346
|
if (matches(message)) return message;
|
|
308143
308347
|
for (const entry of asArray15(message?.oneOf)) {
|
|
308144
|
-
const alt =
|
|
308348
|
+
const alt = asRecord22(entry);
|
|
308145
308349
|
if (matches(alt)) return alt;
|
|
308146
308350
|
}
|
|
308147
308351
|
}
|
|
308148
|
-
for (const rawMsg of Object.values(
|
|
308149
|
-
const message =
|
|
308352
|
+
for (const rawMsg of Object.values(asRecord22(channel.messages) ?? {})) {
|
|
308353
|
+
const message = asRecord22(rawMsg);
|
|
308150
308354
|
if (matches(message)) return message;
|
|
308151
308355
|
}
|
|
308152
308356
|
}
|
|
308153
|
-
for (const rawMsg of Object.values(
|
|
308154
|
-
const message =
|
|
308357
|
+
for (const rawMsg of Object.values(asRecord22(asRecord22(doc.components)?.messages) ?? {})) {
|
|
308358
|
+
const message = asRecord22(rawMsg);
|
|
308155
308359
|
if (matches(message)) return message;
|
|
308156
308360
|
}
|
|
308157
308361
|
return null;
|
|
308158
308362
|
}
|
|
308159
308363
|
function lintHttpBindings(ctx) {
|
|
308160
308364
|
for (const site of ctx.sites) {
|
|
308161
|
-
const binding =
|
|
308365
|
+
const binding = asRecord22(site.bindings.http);
|
|
308162
308366
|
if (!binding) continue;
|
|
308163
308367
|
if (site.scope === "operation" && binding.query !== void 0) {
|
|
308164
|
-
const schema =
|
|
308165
|
-
const properties =
|
|
308368
|
+
const schema = asRecord22(binding.query);
|
|
308369
|
+
const properties = asRecord22(schema?.properties);
|
|
308166
308370
|
if (!schema || !properties || Object.keys(properties).length === 0) {
|
|
308167
308371
|
ctx.warnings.push(
|
|
308168
308372
|
"ASYNCAPI_HTTP_BINDING_SCHEMA_NO_PROPERTIES: " + site.label + " http binding query must be an object schema with properties (http binding README)"
|
|
@@ -308177,8 +308381,8 @@ function lintHttpBindings(ctx) {
|
|
|
308177
308381
|
}
|
|
308178
308382
|
}
|
|
308179
308383
|
if (site.scope === "message" && binding.headers !== void 0) {
|
|
308180
|
-
const schema =
|
|
308181
|
-
const properties =
|
|
308384
|
+
const schema = asRecord22(binding.headers);
|
|
308385
|
+
const properties = asRecord22(schema?.properties);
|
|
308182
308386
|
if (!schema || !properties || Object.keys(properties).length === 0) {
|
|
308183
308387
|
ctx.warnings.push(
|
|
308184
308388
|
"ASYNCAPI_HTTP_BINDING_SCHEMA_NO_PROPERTIES: " + site.label + " http binding headers must be an object schema with properties (http binding README)"
|
|
@@ -308214,19 +308418,19 @@ var HTTP_PROTOCOL_HEADER_DENYLIST = /* @__PURE__ */ new Set([
|
|
|
308214
308418
|
function collectMessages2(ctx) {
|
|
308215
308419
|
const out = [];
|
|
308216
308420
|
const doc = ctx.doc;
|
|
308217
|
-
for (const [chName, rawCh] of Object.entries(
|
|
308218
|
-
const channel =
|
|
308421
|
+
for (const [chName, rawCh] of Object.entries(asRecord22(doc.channels) ?? {})) {
|
|
308422
|
+
const channel = asRecord22(rawCh);
|
|
308219
308423
|
if (!channel) continue;
|
|
308220
308424
|
const siblingList = [];
|
|
308221
308425
|
const push = (label, raw) => {
|
|
308222
|
-
const message =
|
|
308426
|
+
const message = asRecord22(raw);
|
|
308223
308427
|
if (!message) return;
|
|
308224
308428
|
siblingList.push(message);
|
|
308225
308429
|
out.push({ label, message, channelMessages: siblingList });
|
|
308226
308430
|
};
|
|
308227
308431
|
for (const opKeyword of ["publish", "subscribe"]) {
|
|
308228
|
-
const op =
|
|
308229
|
-
const message =
|
|
308432
|
+
const op = asRecord22(channel[opKeyword]);
|
|
308433
|
+
const message = asRecord22(op?.message);
|
|
308230
308434
|
if (!message) continue;
|
|
308231
308435
|
const alternatives = asArray15(message.oneOf);
|
|
308232
308436
|
if (alternatives.length > 0) {
|
|
@@ -308235,12 +308439,12 @@ function collectMessages2(ctx) {
|
|
|
308235
308439
|
push("channel " + chName + " " + opKeyword + " message", message);
|
|
308236
308440
|
}
|
|
308237
308441
|
}
|
|
308238
|
-
for (const [msgName, rawMsg] of Object.entries(
|
|
308442
|
+
for (const [msgName, rawMsg] of Object.entries(asRecord22(channel.messages) ?? {})) {
|
|
308239
308443
|
push("channel " + chName + " message " + msgName, rawMsg);
|
|
308240
308444
|
}
|
|
308241
308445
|
}
|
|
308242
|
-
for (const [name, raw] of Object.entries(
|
|
308243
|
-
const message =
|
|
308446
|
+
for (const [name, raw] of Object.entries(asRecord22(asRecord22(doc.components)?.messages) ?? {})) {
|
|
308447
|
+
const message = asRecord22(raw);
|
|
308244
308448
|
if (message) out.push({ label: "components.messages " + name, message, channelMessages: null });
|
|
308245
308449
|
}
|
|
308246
308450
|
return out;
|
|
@@ -308249,7 +308453,7 @@ function effectiveMessageId(message) {
|
|
|
308249
308453
|
if (typeof message.messageId === "string") return message.messageId;
|
|
308250
308454
|
let fromTraits;
|
|
308251
308455
|
for (const entry of asArray15(message.traits)) {
|
|
308252
|
-
const trait =
|
|
308456
|
+
const trait = asRecord22(entry);
|
|
308253
308457
|
if (trait && typeof trait.messageId === "string") fromTraits = trait.messageId;
|
|
308254
308458
|
}
|
|
308255
308459
|
return fromTraits;
|
|
@@ -308263,7 +308467,7 @@ function lintMessages(ctx) {
|
|
|
308263
308467
|
const validatorFor = (message) => {
|
|
308264
308468
|
if (validatorCache.has(message)) return validatorCache.get(message) ?? null;
|
|
308265
308469
|
let validate4 = null;
|
|
308266
|
-
const payload =
|
|
308470
|
+
const payload = asRecord22(message.payload);
|
|
308267
308471
|
if (payload) {
|
|
308268
308472
|
const packed = packSchema(ctx.doc, payload, "3.0", "response");
|
|
308269
308473
|
if (!packed.unsupported) {
|
|
@@ -308283,10 +308487,10 @@ function lintMessages(ctx) {
|
|
|
308283
308487
|
}
|
|
308284
308488
|
if (owner === void 0) idOwners.set(id, label);
|
|
308285
308489
|
}
|
|
308286
|
-
const headers =
|
|
308490
|
+
const headers = asRecord22(message.headers);
|
|
308287
308491
|
if (headers) {
|
|
308288
308492
|
compileBindingSchema(ctx, label + " headers", headers);
|
|
308289
|
-
const properties =
|
|
308493
|
+
const properties = asRecord22(headers.properties) ?? {};
|
|
308290
308494
|
for (const name of Object.keys(properties)) {
|
|
308291
308495
|
if (!HTTP_TOKEN_RE.test(name)) {
|
|
308292
308496
|
warnings.push("ASYNCAPI_BINDING_HEADER_NAME_INVALID: " + label + " headers property " + JSON.stringify(name) + " is not a valid RFC 9110 token");
|
|
@@ -308308,7 +308512,7 @@ function lintMessages(ctx) {
|
|
|
308308
308512
|
return compileSchemaValidator(packed.schema);
|
|
308309
308513
|
})() : null;
|
|
308310
308514
|
asArray15(message.examples).forEach((entry, i) => {
|
|
308311
|
-
const example =
|
|
308515
|
+
const example = asRecord22(entry);
|
|
308312
308516
|
if (!example) return;
|
|
308313
308517
|
if (example.payload === void 0 && example.headers !== void 0) {
|
|
308314
308518
|
if (headerValidate) {
|
|
@@ -308335,7 +308539,7 @@ function lintMessages(ctx) {
|
|
|
308335
308539
|
const traits = asArray15(message.traits);
|
|
308336
308540
|
const traitKeyValues = /* @__PURE__ */ new Map();
|
|
308337
308541
|
traits.forEach((entry, i) => {
|
|
308338
|
-
const trait =
|
|
308542
|
+
const trait = asRecord22(entry);
|
|
308339
308543
|
if (!trait) return;
|
|
308340
308544
|
if (trait.traits !== void 0) {
|
|
308341
308545
|
warnings.push("ASYNCAPI_TRAIT_FORBIDDEN_FIELD: " + label + " trait #" + i + ' declares "traits"; a Message Trait Object cannot itself carry traits (AsyncAPI Message Trait Object)');
|
|
@@ -308352,14 +308556,14 @@ function lintMessages(ctx) {
|
|
|
308352
308556
|
}
|
|
308353
308557
|
});
|
|
308354
308558
|
}
|
|
308355
|
-
for (const [chName, rawCh] of Object.entries(
|
|
308356
|
-
const channel =
|
|
308559
|
+
for (const [chName, rawCh] of Object.entries(asRecord22(ctx.doc.channels) ?? {})) {
|
|
308560
|
+
const channel = asRecord22(rawCh);
|
|
308357
308561
|
if (!channel) continue;
|
|
308358
308562
|
for (const opKeyword of ["publish", "subscribe"]) {
|
|
308359
|
-
const op =
|
|
308563
|
+
const op = asRecord22(channel[opKeyword]);
|
|
308360
308564
|
if (!op) continue;
|
|
308361
308565
|
asArray15(op.traits).forEach((entry, i) => {
|
|
308362
|
-
const trait =
|
|
308566
|
+
const trait = asRecord22(entry);
|
|
308363
308567
|
if (!trait) return;
|
|
308364
308568
|
for (const forbidden of ["message", "traits"]) {
|
|
308365
308569
|
if (trait[forbidden] !== void 0) {
|
|
@@ -308369,13 +308573,13 @@ function lintMessages(ctx) {
|
|
|
308369
308573
|
});
|
|
308370
308574
|
}
|
|
308371
308575
|
}
|
|
308372
|
-
const channelsRecord =
|
|
308373
|
-
const channelValues = Object.values(channelsRecord).map(
|
|
308374
|
-
for (const [opName, rawOp] of Object.entries(
|
|
308375
|
-
const op =
|
|
308576
|
+
const channelsRecord = asRecord22(ctx.doc.channels) ?? {};
|
|
308577
|
+
const channelValues = Object.values(channelsRecord).map(asRecord22).filter((c) => c !== null);
|
|
308578
|
+
for (const [opName, rawOp] of Object.entries(asRecord22(ctx.doc.operations) ?? {})) {
|
|
308579
|
+
const op = asRecord22(rawOp);
|
|
308376
308580
|
if (!op) continue;
|
|
308377
308581
|
asArray15(op.traits).forEach((entry, i) => {
|
|
308378
|
-
const trait =
|
|
308582
|
+
const trait = asRecord22(entry);
|
|
308379
308583
|
if (!trait) return;
|
|
308380
308584
|
for (const forbidden of ["action", "channel", "traits"]) {
|
|
308381
308585
|
if (trait[forbidden] !== void 0) {
|
|
@@ -308383,13 +308587,13 @@ function lintMessages(ctx) {
|
|
|
308383
308587
|
}
|
|
308384
308588
|
}
|
|
308385
308589
|
});
|
|
308386
|
-
const opChannel =
|
|
308590
|
+
const opChannel = asRecord22(op.channel);
|
|
308387
308591
|
if (opChannel && channelValues.length > 0 && !channelValues.includes(opChannel)) {
|
|
308388
308592
|
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)");
|
|
308389
308593
|
}
|
|
308390
308594
|
if (opChannel) {
|
|
308391
|
-
const channelMessages = Object.values(
|
|
308392
|
-
const opMessages = asArray15(op.messages).map(
|
|
308595
|
+
const channelMessages = Object.values(asRecord22(opChannel.messages) ?? {}).map(asRecord22).filter((m) => m !== null);
|
|
308596
|
+
const opMessages = asArray15(op.messages).map(asRecord22).filter((m) => m !== null);
|
|
308393
308597
|
for (const opMessage of opMessages) {
|
|
308394
308598
|
const inChannel = channelMessages.some((cm) => cm === opMessage || JSON.stringify(cm) === JSON.stringify(opMessage));
|
|
308395
308599
|
if (!inChannel) {
|
|
@@ -308397,16 +308601,16 @@ function lintMessages(ctx) {
|
|
|
308397
308601
|
}
|
|
308398
308602
|
}
|
|
308399
308603
|
}
|
|
308400
|
-
const reply =
|
|
308604
|
+
const reply = asRecord22(op.reply);
|
|
308401
308605
|
if (reply) {
|
|
308402
|
-
const replyChannel =
|
|
308403
|
-
const replyAddress =
|
|
308606
|
+
const replyChannel = asRecord22(reply.channel);
|
|
308607
|
+
const replyAddress = asRecord22(reply.address);
|
|
308404
308608
|
if (replyAddress && replyChannel && typeof replyChannel.address === "string" && replyChannel.address.length > 0) {
|
|
308405
308609
|
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)");
|
|
308406
308610
|
}
|
|
308407
308611
|
if (replyChannel) {
|
|
308408
|
-
const replyChannelMessages = Object.values(
|
|
308409
|
-
const replyMessages = asArray15(reply.messages).map(
|
|
308612
|
+
const replyChannelMessages = Object.values(asRecord22(replyChannel.messages) ?? {}).map(asRecord22).filter((m) => m !== null);
|
|
308613
|
+
const replyMessages = asArray15(reply.messages).map(asRecord22).filter((m) => m !== null);
|
|
308410
308614
|
for (const replyMessage of replyMessages) {
|
|
308411
308615
|
const inChannel = replyChannelMessages.some((cm) => cm === replyMessage || JSON.stringify(cm) === JSON.stringify(replyMessage));
|
|
308412
308616
|
if (!inChannel) {
|
|
@@ -308418,8 +308622,8 @@ function lintMessages(ctx) {
|
|
|
308418
308622
|
}
|
|
308419
308623
|
}
|
|
308420
308624
|
function hasWsSurface(ctx) {
|
|
308421
|
-
for (const raw of Object.values(
|
|
308422
|
-
const server =
|
|
308625
|
+
for (const raw of Object.values(asRecord22(ctx.doc.servers) ?? {})) {
|
|
308626
|
+
const server = asRecord22(raw);
|
|
308423
308627
|
const protocol = typeof server?.protocol === "string" ? server.protocol.toLowerCase() : "";
|
|
308424
308628
|
if (SERVER_PROTOCOL_FAMILY[protocol] === "ws") return true;
|
|
308425
308629
|
}
|
|
@@ -308430,11 +308634,11 @@ var API_KEY_LOCATIONS_V2 = /* @__PURE__ */ new Set(["user", "password"]);
|
|
|
308430
308634
|
var SYNTHESIZABLE_SCHEME_TYPES = /* @__PURE__ */ new Set(["http", "httpApiKey", "apiKey", "userPassword"]);
|
|
308431
308635
|
function lintSecuritySchemes2(ctx) {
|
|
308432
308636
|
const { warnings } = ctx;
|
|
308433
|
-
const schemes =
|
|
308637
|
+
const schemes = asRecord22(asRecord22(ctx.doc.components)?.securitySchemes) ?? {};
|
|
308434
308638
|
const oauthLikeNames = /* @__PURE__ */ new Set();
|
|
308435
308639
|
const unsatisfiable = [];
|
|
308436
308640
|
for (const [name, raw] of Object.entries(schemes)) {
|
|
308437
|
-
const scheme =
|
|
308641
|
+
const scheme = asRecord22(raw);
|
|
308438
308642
|
if (!scheme) continue;
|
|
308439
308643
|
const type = typeof scheme.type === "string" ? scheme.type : "";
|
|
308440
308644
|
if (type === "oauth2" || type === "openIdConnect") oauthLikeNames.add(name);
|
|
@@ -308454,9 +308658,9 @@ function lintSecuritySchemes2(ctx) {
|
|
|
308454
308658
|
}
|
|
308455
308659
|
}
|
|
308456
308660
|
if (type === "oauth2") {
|
|
308457
|
-
const flows =
|
|
308661
|
+
const flows = asRecord22(scheme.flows) ?? {};
|
|
308458
308662
|
for (const [flowName, rawFlow] of Object.entries(flows)) {
|
|
308459
|
-
const flow =
|
|
308663
|
+
const flow = asRecord22(rawFlow);
|
|
308460
308664
|
if (!flow) continue;
|
|
308461
308665
|
for (const field of ["authorizationUrl", "tokenUrl", "refreshUrl"]) {
|
|
308462
308666
|
const url = flow[field];
|
|
@@ -308473,11 +308677,11 @@ function lintSecuritySchemes2(ctx) {
|
|
|
308473
308677
|
if (unsatisfiable.length > 0) {
|
|
308474
308678
|
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");
|
|
308475
308679
|
}
|
|
308476
|
-
for (const [serverName, raw] of Object.entries(
|
|
308477
|
-
const server =
|
|
308680
|
+
for (const [serverName, raw] of Object.entries(asRecord22(ctx.doc.servers) ?? {})) {
|
|
308681
|
+
const server = asRecord22(raw);
|
|
308478
308682
|
if (!server) continue;
|
|
308479
308683
|
asArray15(server.security).forEach((entry, i) => {
|
|
308480
|
-
const requirement =
|
|
308684
|
+
const requirement = asRecord22(entry);
|
|
308481
308685
|
if (!requirement) return;
|
|
308482
308686
|
for (const [schemeName, value] of Object.entries(requirement)) {
|
|
308483
308687
|
if (!Array.isArray(value)) {
|
|
@@ -308487,7 +308691,7 @@ function lintSecuritySchemes2(ctx) {
|
|
|
308487
308691
|
if (value.some((scope) => typeof scope !== "string")) {
|
|
308488
308692
|
warnings.push("ASYNCAPI_SECURITY_REQUIREMENT_INVALID: server " + serverName + " security requirement #" + i + " scopes for " + schemeName + " must be strings (AsyncAPI Security Requirement Object)");
|
|
308489
308693
|
}
|
|
308490
|
-
if (value.length > 0 && !oauthLikeNames.has(schemeName) &&
|
|
308694
|
+
if (value.length > 0 && !oauthLikeNames.has(schemeName) && asRecord22(schemes[schemeName])) {
|
|
308491
308695
|
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)");
|
|
308492
308696
|
}
|
|
308493
308697
|
}
|
|
@@ -308497,7 +308701,7 @@ function lintSecuritySchemes2(ctx) {
|
|
|
308497
308701
|
function lintSocketIo(ctx) {
|
|
308498
308702
|
if (!ctx.socketIo) return;
|
|
308499
308703
|
const { warnings, doc } = ctx;
|
|
308500
|
-
const xSocketIo =
|
|
308704
|
+
const xSocketIo = asRecord22(doc["x-socketio"]) ?? {};
|
|
308501
308705
|
const declaredVersion = xSocketIo.version ?? xSocketIo.eio ?? xSocketIo.EIO;
|
|
308502
308706
|
if (declaredVersion !== void 0 && String(declaredVersion) !== "4") {
|
|
308503
308707
|
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");
|
|
@@ -308506,8 +308710,8 @@ function lintSocketIo(ctx) {
|
|
|
308506
308710
|
if (typeof path10 === "string" && path10 !== "/socket.io/" && path10 !== "/socket.io") {
|
|
308507
308711
|
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");
|
|
308508
308712
|
}
|
|
308509
|
-
for (const [chName, rawCh] of Object.entries(
|
|
308510
|
-
const channel =
|
|
308713
|
+
for (const [chName, rawCh] of Object.entries(asRecord22(doc.channels) ?? {})) {
|
|
308714
|
+
const channel = asRecord22(rawCh);
|
|
308511
308715
|
if (!channel) continue;
|
|
308512
308716
|
const address = ctx.isV3 ? typeof channel.address === "string" ? channel.address : "" : chName;
|
|
308513
308717
|
if (address && address !== "/" && !address.startsWith("/")) {
|
|
@@ -308515,10 +308719,10 @@ function lintSocketIo(ctx) {
|
|
|
308515
308719
|
} else if (address && address !== "/") {
|
|
308516
308720
|
warnings.push("ASYNCAPI_SOCKETIO_NAMESPACE_NOT_ROUTED: channel " + chName + " implies Socket.IO namespace " + JSON.stringify(address) + " but generated items connect to the root namespace");
|
|
308517
308721
|
}
|
|
308518
|
-
const wsBinding =
|
|
308519
|
-
const queryProps =
|
|
308722
|
+
const wsBinding = asRecord22(asRecord22(channel.bindings)?.ws);
|
|
308723
|
+
const queryProps = asRecord22(asRecord22(wsBinding?.query)?.properties) ?? {};
|
|
308520
308724
|
for (const [propName2, rawProp] of Object.entries(queryProps)) {
|
|
308521
|
-
const prop =
|
|
308725
|
+
const prop = asRecord22(rawProp);
|
|
308522
308726
|
if (!prop) continue;
|
|
308523
308727
|
const declared = schemaDeclaredValues(prop).map(String);
|
|
308524
308728
|
if (propName2 === "EIO" && declared.some((v) => v !== "4")) {
|
|
@@ -308538,7 +308742,7 @@ function lintSocketIo(ctx) {
|
|
|
308538
308742
|
if (message.contentKind === "binary") {
|
|
308539
308743
|
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");
|
|
308540
308744
|
}
|
|
308541
|
-
const ack =
|
|
308745
|
+
const ack = asRecord22(message.ackSchema);
|
|
308542
308746
|
if (ack) {
|
|
308543
308747
|
const declaredType = Array.isArray(ack.type) ? ack.type.map(String) : ack.type !== void 0 ? [String(ack.type)] : [];
|
|
308544
308748
|
if (declaredType.length > 0 && !declaredType.includes("array")) {
|
|
@@ -308549,7 +308753,7 @@ function lintSocketIo(ctx) {
|
|
|
308549
308753
|
}
|
|
308550
308754
|
}
|
|
308551
308755
|
function lintAsyncApiBindingSurfaces(index) {
|
|
308552
|
-
const doc =
|
|
308756
|
+
const doc = asRecord22(index.documentJson);
|
|
308553
308757
|
if (!doc) return [];
|
|
308554
308758
|
const ctx = {
|
|
308555
308759
|
index,
|
|
@@ -308571,7 +308775,7 @@ function lintAsyncApiBindingSurfaces(index) {
|
|
|
308571
308775
|
lintSocketIo(ctx);
|
|
308572
308776
|
for (const site of ctx.sites) {
|
|
308573
308777
|
if (site.scope !== "channel") continue;
|
|
308574
|
-
const wsBinding =
|
|
308778
|
+
const wsBinding = asRecord22(site.bindings.ws);
|
|
308575
308779
|
if (wsBinding) lintWsChannelBinding(ctx, site.label, wsBinding);
|
|
308576
308780
|
}
|
|
308577
308781
|
return ctx.warnings;
|
|
@@ -308583,7 +308787,7 @@ var ASYNCAPI_INSTRUMENT_LIMITS = {
|
|
|
308583
308787
|
};
|
|
308584
308788
|
var MESSAGE_NODE_TYPES = /* @__PURE__ */ new Set(["ws-raw-message", "ws-socketio-message", "mqtt-message"]);
|
|
308585
308789
|
var BASE64_RE = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/;
|
|
308586
|
-
function
|
|
308790
|
+
function asRecord23(value) {
|
|
308587
308791
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
308588
308792
|
return value;
|
|
308589
308793
|
}
|
|
@@ -308591,7 +308795,7 @@ function asArray16(value) {
|
|
|
308591
308795
|
return Array.isArray(value) ? value : [];
|
|
308592
308796
|
}
|
|
308593
308797
|
function schemaAllowsStringInstance(schema) {
|
|
308594
|
-
const record =
|
|
308798
|
+
const record = asRecord23(schema);
|
|
308595
308799
|
if (!record) return false;
|
|
308596
308800
|
const declared = record.type;
|
|
308597
308801
|
const types2 = Array.isArray(declared) ? declared.map(String) : declared !== void 0 ? [String(declared)] : [];
|
|
@@ -308684,18 +308888,18 @@ function checkMqttBindingValues(binding, scope, channelId, warnings) {
|
|
|
308684
308888
|
if (binding.messageExpiryInterval !== void 0 && !isNonNegativeInteger(binding.messageExpiryInterval)) bad("messageExpiryInterval", "must be a non-negative integer (seconds)");
|
|
308685
308889
|
if (binding.cleanSession !== void 0 && typeof binding.cleanSession !== "boolean") bad("cleanSession", "must be a boolean");
|
|
308686
308890
|
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)");
|
|
308687
|
-
if (binding.sessionExpiryInterval !== void 0 && !isIntegerInRange(binding.sessionExpiryInterval, 0, 4294967295) &&
|
|
308688
|
-
if (binding.maximumPacketSize !== void 0 && !isIntegerInRange(binding.maximumPacketSize, 1, 268435455) &&
|
|
308891
|
+
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");
|
|
308892
|
+
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");
|
|
308689
308893
|
if (binding.payloadFormatIndicator !== void 0 && binding.payloadFormatIndicator !== 0 && binding.payloadFormatIndicator !== 1) bad("payloadFormatIndicator", "must be 0 (unspecified bytes) or 1 (UTF-8)");
|
|
308690
308894
|
if (binding.contentType !== void 0 && typeof binding.contentType !== "string") bad("contentType", "must be a string");
|
|
308691
308895
|
if (typeof binding.responseTopic === "string") {
|
|
308692
308896
|
const violation = mqttTopicViolation(binding.responseTopic, false);
|
|
308693
308897
|
if (violation) warnings.push(`ASYNCAPI_MQTT_TOPIC_INVALID: channel ${channelId} ${scope} binding responseTopic "${binding.responseTopic}" ${violation}`);
|
|
308694
|
-
} else if (binding.responseTopic !== void 0 &&
|
|
308898
|
+
} else if (binding.responseTopic !== void 0 && asRecord23(binding.responseTopic) === null) {
|
|
308695
308899
|
bad("responseTopic", "must be a string or a schema object");
|
|
308696
308900
|
}
|
|
308697
308901
|
if (binding.correlationData !== void 0) {
|
|
308698
|
-
const correlationData =
|
|
308902
|
+
const correlationData = asRecord23(binding.correlationData);
|
|
308699
308903
|
if (!correlationData) {
|
|
308700
308904
|
bad("correlationData", "must be a Schema Object describing the binary correlation data");
|
|
308701
308905
|
} else if (correlationData.type !== "string" || correlationData.format !== "byte" && correlationData.format !== "binary") {
|
|
@@ -308704,7 +308908,7 @@ function checkMqttBindingValues(binding, scope, channelId, warnings) {
|
|
|
308704
308908
|
);
|
|
308705
308909
|
}
|
|
308706
308910
|
}
|
|
308707
|
-
const lastWill =
|
|
308911
|
+
const lastWill = asRecord23(binding.lastWill);
|
|
308708
308912
|
if (lastWill) {
|
|
308709
308913
|
if (typeof lastWill.topic === "string") {
|
|
308710
308914
|
const violation = mqttTopicViolation(lastWill.topic, false);
|
|
@@ -308719,14 +308923,14 @@ function checkMqttBindingValues(binding, scope, channelId, warnings) {
|
|
|
308719
308923
|
}
|
|
308720
308924
|
}
|
|
308721
308925
|
function channelHasPublishDirection(documentJson, channelId) {
|
|
308722
|
-
const channel =
|
|
308926
|
+
const channel = asRecord23(asRecord23(documentJson.channels)?.[channelId]);
|
|
308723
308927
|
if (channel?.publish !== void 0) return true;
|
|
308724
308928
|
const unescapePointer = (segment) => segment.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
308725
|
-
const operations =
|
|
308929
|
+
const operations = asRecord23(documentJson.operations) ?? {};
|
|
308726
308930
|
for (const operationRaw of Object.values(operations)) {
|
|
308727
|
-
const operation =
|
|
308931
|
+
const operation = asRecord23(operationRaw);
|
|
308728
308932
|
if (!operation || operation.action !== "send") continue;
|
|
308729
|
-
const opChannel =
|
|
308933
|
+
const opChannel = asRecord23(operation.channel);
|
|
308730
308934
|
if (!opChannel) continue;
|
|
308731
308935
|
if (channel && opChannel === channel) return true;
|
|
308732
308936
|
const uid = opChannel["x-parser-unique-object-id"];
|
|
@@ -308779,7 +308983,7 @@ function collectMessageNodeIds(node, ids, path10) {
|
|
|
308779
308983
|
}
|
|
308780
308984
|
const children4 = node.children !== void 0 ? asArray16(node.children) : asArray16(node.item);
|
|
308781
308985
|
children4.forEach((child4, i) => {
|
|
308782
|
-
const record =
|
|
308986
|
+
const record = asRecord23(child4);
|
|
308783
308987
|
if (record) collectMessageNodeIds(record, ids, `${path10}/${i}`);
|
|
308784
308988
|
});
|
|
308785
308989
|
}
|
|
@@ -308822,7 +309026,7 @@ function validateWsBinding(channel, warnings) {
|
|
|
308822
309026
|
for (const key of ["query", "headers"]) {
|
|
308823
309027
|
const schema = binding[key];
|
|
308824
309028
|
if (schema === void 0) continue;
|
|
308825
|
-
const record =
|
|
309029
|
+
const record = asRecord23(schema);
|
|
308826
309030
|
if (!record || record.type !== void 0 && record.type !== "object") {
|
|
308827
309031
|
warnings.push(`ASYNCAPI_WS_BINDING_INVALID: channel ${channel.id} ws binding ${key} must be a Schema Object of type object`);
|
|
308828
309032
|
}
|
|
@@ -308858,7 +309062,7 @@ function instrumentAsyncApiCollection(collection, index) {
|
|
|
308858
309062
|
const expected = index.channels.reduce((sum, channel) => sum + channel.messages.length, 0);
|
|
308859
309063
|
const ids = [];
|
|
308860
309064
|
asArray16(collection.item).forEach((entry, i) => {
|
|
308861
|
-
const record =
|
|
309065
|
+
const record = asRecord23(entry);
|
|
308862
309066
|
if (record) collectMessageNodeIds(record, ids, `item/${i}`);
|
|
308863
309067
|
});
|
|
308864
309068
|
const unique = new Set(ids).size;
|
|
@@ -309634,7 +309838,7 @@ var validateRegistryServerSchema = (() => {
|
|
|
309634
309838
|
}
|
|
309635
309839
|
}
|
|
309636
309840
|
})();
|
|
309637
|
-
function
|
|
309841
|
+
function asRecord24(value) {
|
|
309638
309842
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
309639
309843
|
return value;
|
|
309640
309844
|
}
|
|
@@ -309649,7 +309853,7 @@ function registrySchemaKey(key) {
|
|
|
309649
309853
|
}
|
|
309650
309854
|
function normalizeRegistrySchemaValue(value) {
|
|
309651
309855
|
if (Array.isArray(value)) return value.map((entry) => normalizeRegistrySchemaValue(entry));
|
|
309652
|
-
const record =
|
|
309856
|
+
const record = asRecord24(value);
|
|
309653
309857
|
if (!record) return value;
|
|
309654
309858
|
const out = {};
|
|
309655
309859
|
for (const [key, entry] of Object.entries(record)) {
|
|
@@ -309665,7 +309869,7 @@ function normalizeRegistryPackageForSchema(pkg) {
|
|
|
309665
309869
|
}
|
|
309666
309870
|
function normalizeRegistryManifestForSchema(record) {
|
|
309667
309871
|
const out = normalizeRegistrySchemaValue(record);
|
|
309668
|
-
if (Array.isArray(record.packages)) out.packages = record.packages.map((entry) => normalizeRegistryPackageForSchema(
|
|
309872
|
+
if (Array.isArray(record.packages)) out.packages = record.packages.map((entry) => normalizeRegistryPackageForSchema(asRecord24(entry) ?? {}));
|
|
309669
309873
|
return out;
|
|
309670
309874
|
}
|
|
309671
309875
|
function isRegistrySchemaDocument(record) {
|
|
@@ -309727,7 +309931,7 @@ function validateUriTemplate(value) {
|
|
|
309727
309931
|
return { variables: [...variables] };
|
|
309728
309932
|
}
|
|
309729
309933
|
function sampleFromSchema2(schema, depth) {
|
|
309730
|
-
const record =
|
|
309934
|
+
const record = asRecord24(schema);
|
|
309731
309935
|
if (!record) return record === null ? null : {};
|
|
309732
309936
|
if (record.example !== void 0) return record.example;
|
|
309733
309937
|
if (record.default !== void 0) return record.default;
|
|
@@ -309743,7 +309947,7 @@ function sampleFromSchema2(schema, depth) {
|
|
|
309743
309947
|
switch (type) {
|
|
309744
309948
|
case "object":
|
|
309745
309949
|
case void 0: {
|
|
309746
|
-
const properties =
|
|
309950
|
+
const properties = asRecord24(record.properties);
|
|
309747
309951
|
if (!properties) return {};
|
|
309748
309952
|
const required = new Set(asArray17(record.required));
|
|
309749
309953
|
const out = {};
|
|
@@ -309783,10 +309987,10 @@ function registryInputValue(name, input) {
|
|
|
309783
309987
|
}
|
|
309784
309988
|
function registryVariableValues(variables) {
|
|
309785
309989
|
const out = {};
|
|
309786
|
-
const record =
|
|
309990
|
+
const record = asRecord24(variables);
|
|
309787
309991
|
if (!record) return out;
|
|
309788
309992
|
for (const [name, input] of Object.entries(record)) {
|
|
309789
|
-
const value =
|
|
309993
|
+
const value = asRecord24(input);
|
|
309790
309994
|
if (value) out[name] = registryInputValue(name, value);
|
|
309791
309995
|
}
|
|
309792
309996
|
return out;
|
|
@@ -309799,7 +310003,7 @@ function resolveRegistryVariables(value, variables, context, warnings) {
|
|
|
309799
310003
|
});
|
|
309800
310004
|
}
|
|
309801
310005
|
function registryHeaderKeyValues(headers, variables = {}, warnings = [], context = "remote header") {
|
|
309802
|
-
return asArray17(headers).map((entry) =>
|
|
310006
|
+
return asArray17(headers).map((entry) => asRecord24(entry)).filter((entry) => entry !== null && typeof entry.name === "string" && entry.name !== "").map((entry) => {
|
|
309803
310007
|
const name = String(entry.name);
|
|
309804
310008
|
const value = registryInputValue(name, entry);
|
|
309805
310009
|
const resolvedValue = resolveRegistryVariables(value, variables, `${context} ${name}`, warnings);
|
|
@@ -309807,7 +310011,7 @@ function registryHeaderKeyValues(headers, variables = {}, warnings = [], context
|
|
|
309807
310011
|
});
|
|
309808
310012
|
}
|
|
309809
310013
|
function registryEnvKeyValues(variables) {
|
|
309810
|
-
return asArray17(variables).map((entry) =>
|
|
310014
|
+
return asArray17(variables).map((entry) => asRecord24(entry)).filter((entry) => entry !== null && typeof entry.name === "string" && entry.name !== "").map((entry) => {
|
|
309811
310015
|
const name = String(entry.name);
|
|
309812
310016
|
const secret = pickValue(entry, "isSecret", "is_secret") === true;
|
|
309813
310017
|
const value = typeof entry.value === "string" && entry.value && !secret ? entry.value : `{{${name}}}`;
|
|
@@ -309817,7 +310021,7 @@ function registryEnvKeyValues(variables) {
|
|
|
309817
310021
|
function stringArguments(values) {
|
|
309818
310022
|
return asArray17(values).map((entry) => {
|
|
309819
310023
|
if (typeof entry === "string") return entry;
|
|
309820
|
-
const record =
|
|
310024
|
+
const record = asRecord24(entry);
|
|
309821
310025
|
if (!record) return "";
|
|
309822
310026
|
if (typeof record.name === "string" && record.name) {
|
|
309823
310027
|
return typeof record.value === "string" && record.value ? `${record.name}=${record.value}` : String(record.name);
|
|
@@ -309854,11 +310058,11 @@ function hasModernPackageShape(pkg) {
|
|
|
309854
310058
|
return ["registryType", "runtimeHint", "runtimeArguments", "packageArguments", "environmentVariables"].some((key) => hasOwn(pkg, key));
|
|
309855
310059
|
}
|
|
309856
310060
|
function packageDescriptor(pkg, id, warnings) {
|
|
309857
|
-
if (pkg.transport !== void 0 &&
|
|
310061
|
+
if (pkg.transport !== void 0 && asRecord24(pkg.transport) === null) {
|
|
309858
310062
|
warnings.push(`MCP_PACKAGE_TRANSPORT_INVALID: server ${id} package transport must be an object when present; the package is skipped`);
|
|
309859
310063
|
return null;
|
|
309860
310064
|
}
|
|
309861
|
-
const transport =
|
|
310065
|
+
const transport = asRecord24(pkg.transport);
|
|
309862
310066
|
const transportType = typeof transport?.type === "string" ? String(transport.type).toLowerCase() : "";
|
|
309863
310067
|
if (transport) {
|
|
309864
310068
|
if (!transportType) {
|
|
@@ -309904,11 +310108,11 @@ function clientConfigDescriptor(id, entry) {
|
|
|
309904
310108
|
`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`
|
|
309905
310109
|
);
|
|
309906
310110
|
}
|
|
309907
|
-
const headers = Object.entries(
|
|
310111
|
+
const headers = Object.entries(asRecord24(entry.headers) ?? {}).filter(([, value]) => typeof value === "string").map(([key, value]) => ({ key, value: String(value) }));
|
|
309908
310112
|
return { id, transport: "sse", url, headers, env: [], warnings };
|
|
309909
310113
|
}
|
|
309910
310114
|
const command = [typeof entry.command === "string" ? entry.command : "", ...stringArguments(entry.args)].filter(Boolean).join(" ");
|
|
309911
|
-
const env = Object.entries(
|
|
310115
|
+
const env = Object.entries(asRecord24(entry.env) ?? {}).filter(([, value]) => typeof value === "string").map(([key, value]) => ({ key, value: String(value) }));
|
|
309912
310116
|
return { id, transport: "stdio", headers: [], command, env, warnings: [] };
|
|
309913
310117
|
}
|
|
309914
310118
|
function toolDescriptor(tool, warnings) {
|
|
@@ -309917,7 +310121,7 @@ function toolDescriptor(tool, warnings) {
|
|
|
309917
310121
|
warnings.push("MCP_TOOL_NAME_MISSING: a tools[] entry has no name; it is skipped and generates no tools/call template");
|
|
309918
310122
|
return null;
|
|
309919
310123
|
}
|
|
309920
|
-
const inputSchema =
|
|
310124
|
+
const inputSchema = asRecord24(tool.inputSchema) ?? void 0;
|
|
309921
310125
|
const toolWarnings = [];
|
|
309922
310126
|
if (!inputSchema) {
|
|
309923
310127
|
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`);
|
|
@@ -309926,8 +310130,8 @@ function toolDescriptor(tool, warnings) {
|
|
|
309926
310130
|
name,
|
|
309927
310131
|
description: typeof tool.description === "string" ? tool.description : void 0,
|
|
309928
310132
|
inputSchema,
|
|
309929
|
-
outputSchema:
|
|
309930
|
-
annotations:
|
|
310133
|
+
outputSchema: asRecord24(tool.outputSchema) ?? void 0,
|
|
310134
|
+
annotations: asRecord24(tool.annotations) ?? void 0,
|
|
309931
310135
|
sampleArguments: inputSchema ? sampleFromSchema2(inputSchema, 0) : {},
|
|
309932
310136
|
warnings: toolWarnings
|
|
309933
310137
|
};
|
|
@@ -309956,7 +310160,7 @@ function resourceDescriptor(resource, warnings) {
|
|
|
309956
310160
|
if (resource.mimeType !== void 0 && typeof resource.mimeType !== "string") {
|
|
309957
310161
|
resourceWarnings.push(`MCP_RESOURCE_FIELD_INVALID: resource ${name} mimeType must be a string when present`);
|
|
309958
310162
|
}
|
|
309959
|
-
if (resource.annotations !== void 0 && !
|
|
310163
|
+
if (resource.annotations !== void 0 && !asRecord24(resource.annotations)) {
|
|
309960
310164
|
resourceWarnings.push(`MCP_RESOURCE_ANNOTATIONS_INVALID: resource ${name} annotations must be an object when present`);
|
|
309961
310165
|
}
|
|
309962
310166
|
return {
|
|
@@ -309965,8 +310169,8 @@ function resourceDescriptor(resource, warnings) {
|
|
|
309965
310169
|
description: asOptionalString(resource.description),
|
|
309966
310170
|
uri,
|
|
309967
310171
|
mimeType: asOptionalString(resource.mimeType),
|
|
309968
|
-
meta:
|
|
309969
|
-
annotations:
|
|
310172
|
+
meta: asRecord24(resource._meta) ?? void 0,
|
|
310173
|
+
annotations: asRecord24(resource.annotations) ?? void 0,
|
|
309970
310174
|
warnings: resourceWarnings
|
|
309971
310175
|
};
|
|
309972
310176
|
}
|
|
@@ -309995,7 +310199,7 @@ function resourceTemplateDescriptor(template, warnings) {
|
|
|
309995
310199
|
if (template.mimeType !== void 0 && typeof template.mimeType !== "string") {
|
|
309996
310200
|
templateWarnings.push(`MCP_RESOURCE_TEMPLATE_FIELD_INVALID: resource template ${name} mimeType must be a string when present`);
|
|
309997
310201
|
}
|
|
309998
|
-
if (template.annotations !== void 0 && !
|
|
310202
|
+
if (template.annotations !== void 0 && !asRecord24(template.annotations)) {
|
|
309999
310203
|
templateWarnings.push(`MCP_RESOURCE_TEMPLATE_ANNOTATIONS_INVALID: resource template ${name} annotations must be an object when present`);
|
|
310000
310204
|
}
|
|
310001
310205
|
return {
|
|
@@ -310004,14 +310208,14 @@ function resourceTemplateDescriptor(template, warnings) {
|
|
|
310004
310208
|
description: asOptionalString(template.description),
|
|
310005
310209
|
uriTemplate,
|
|
310006
310210
|
mimeType: asOptionalString(template.mimeType),
|
|
310007
|
-
meta:
|
|
310008
|
-
annotations:
|
|
310211
|
+
meta: asRecord24(template._meta) ?? void 0,
|
|
310212
|
+
annotations: asRecord24(template.annotations) ?? void 0,
|
|
310009
310213
|
variables: inspectedTemplate.variables,
|
|
310010
310214
|
warnings: templateWarnings
|
|
310011
310215
|
};
|
|
310012
310216
|
}
|
|
310013
310217
|
function promptArgumentDescriptor(promptName, argument, warnings, index) {
|
|
310014
|
-
const record =
|
|
310218
|
+
const record = asRecord24(argument);
|
|
310015
310219
|
if (!record) {
|
|
310016
310220
|
warnings.push(`MCP_PROMPT_ARGUMENT_INVALID: prompt ${promptName} argument[${index}] must be an object`);
|
|
310017
310221
|
return null;
|
|
@@ -310050,7 +310254,7 @@ function promptDescriptor(prompt, warnings) {
|
|
|
310050
310254
|
if (prompt.arguments !== void 0 && !Array.isArray(prompt.arguments)) {
|
|
310051
310255
|
promptWarnings.push(`MCP_PROMPT_ARGUMENTS_INVALID: prompt ${name} arguments must be an array when present`);
|
|
310052
310256
|
}
|
|
310053
|
-
if (prompt.annotations !== void 0 && !
|
|
310257
|
+
if (prompt.annotations !== void 0 && !asRecord24(prompt.annotations)) {
|
|
310054
310258
|
promptWarnings.push(`MCP_PROMPT_ANNOTATIONS_INVALID: prompt ${name} annotations must be an object when present`);
|
|
310055
310259
|
}
|
|
310056
310260
|
const seenArgumentNames = /* @__PURE__ */ new Set();
|
|
@@ -310069,8 +310273,8 @@ function promptDescriptor(prompt, warnings) {
|
|
|
310069
310273
|
name,
|
|
310070
310274
|
title: asOptionalString(prompt.title),
|
|
310071
310275
|
description: asOptionalString(prompt.description),
|
|
310072
|
-
meta:
|
|
310073
|
-
annotations:
|
|
310276
|
+
meta: asRecord24(prompt._meta) ?? void 0,
|
|
310277
|
+
annotations: asRecord24(prompt.annotations) ?? void 0,
|
|
310074
310278
|
arguments: argumentsList,
|
|
310075
310279
|
warnings: promptWarnings
|
|
310076
310280
|
};
|
|
@@ -310085,17 +310289,17 @@ function parseMcpServerSpec(content) {
|
|
|
310085
310289
|
} catch (error2) {
|
|
310086
310290
|
throw new Error(`MCP_PARSE_FAILED: MCP server description is not valid JSON: ${error2 instanceof Error ? error2.message : String(error2)}`, { cause: error2 });
|
|
310087
310291
|
}
|
|
310088
|
-
const documentJson =
|
|
310292
|
+
const documentJson = asRecord24(parsed);
|
|
310089
310293
|
if (!documentJson) {
|
|
310090
310294
|
throw new Error("MCP_PARSE_FAILED: MCP server description must be a JSON object");
|
|
310091
310295
|
}
|
|
310092
310296
|
const warnings = [];
|
|
310093
310297
|
const servers = [];
|
|
310094
310298
|
if (isRegistrySchemaDocument(documentJson)) warnings.push(...registrySchemaWarnings(documentJson));
|
|
310095
|
-
const mcpServers =
|
|
310299
|
+
const mcpServers = asRecord24(documentJson.mcpServers);
|
|
310096
310300
|
if (mcpServers) {
|
|
310097
310301
|
for (const [id, entry] of Object.entries(mcpServers)) {
|
|
310098
|
-
const record =
|
|
310302
|
+
const record = asRecord24(entry);
|
|
310099
310303
|
if (!record) {
|
|
310100
310304
|
warnings.push(`MCP_SERVER_ENTRY_INVALID: mcpServers.${id} is not an object; it is skipped`);
|
|
310101
310305
|
continue;
|
|
@@ -310104,8 +310308,8 @@ function parseMcpServerSpec(content) {
|
|
|
310104
310308
|
}
|
|
310105
310309
|
}
|
|
310106
310310
|
const registryName = typeof documentJson.name === "string" ? documentJson.name : "";
|
|
310107
|
-
const remotes = asArray17(documentJson.remotes).map((entry) =>
|
|
310108
|
-
const packages = asArray17(documentJson.packages).map((entry) =>
|
|
310311
|
+
const remotes = asArray17(documentJson.remotes).map((entry) => asRecord24(entry)).filter((entry) => entry !== null);
|
|
310312
|
+
const packages = asArray17(documentJson.packages).map((entry) => asRecord24(entry)).filter((entry) => entry !== null);
|
|
310109
310313
|
if (!mcpServers && (remotes.length > 0 || packages.length > 0)) {
|
|
310110
310314
|
const multi = remotes.length + packages.length > 1;
|
|
310111
310315
|
remotes.forEach((remote, i) => {
|
|
@@ -310120,7 +310324,7 @@ function parseMcpServerSpec(content) {
|
|
|
310120
310324
|
if (servers.length === 0) {
|
|
310121
310325
|
throw new Error("MCP_NO_SERVERS: MCP description defines no servers (no mcpServers entries, remotes, or packages); contract generation requires at least one server");
|
|
310122
310326
|
}
|
|
310123
|
-
const toolsRaw = asArray17(documentJson.tools).map((entry) =>
|
|
310327
|
+
const toolsRaw = asArray17(documentJson.tools).map((entry) => asRecord24(entry)).filter((entry) => entry !== null).map((tool) => toolDescriptor(tool, warnings)).filter((tool) => tool !== null);
|
|
310124
310328
|
const seenToolNames = /* @__PURE__ */ new Set();
|
|
310125
310329
|
const tools = [];
|
|
310126
310330
|
for (const tool of toolsRaw) {
|
|
@@ -310132,7 +310336,7 @@ function parseMcpServerSpec(content) {
|
|
|
310132
310336
|
tools.push(tool);
|
|
310133
310337
|
}
|
|
310134
310338
|
tools.sort((a, b) => a.name.localeCompare(b.name));
|
|
310135
|
-
const resourcesRaw = asArray17(documentJson.resources).map((entry) =>
|
|
310339
|
+
const resourcesRaw = asArray17(documentJson.resources).map((entry) => asRecord24(entry)).filter((entry) => entry !== null).map((resource) => resourceDescriptor(resource, warnings)).filter((resource) => resource !== null);
|
|
310136
310340
|
const seenResourceNames = /* @__PURE__ */ new Set();
|
|
310137
310341
|
const resources = [];
|
|
310138
310342
|
for (const resource of resourcesRaw) {
|
|
@@ -310144,7 +310348,7 @@ function parseMcpServerSpec(content) {
|
|
|
310144
310348
|
resources.push(resource);
|
|
310145
310349
|
}
|
|
310146
310350
|
resources.sort((a, b) => a.name.localeCompare(b.name));
|
|
310147
|
-
const resourceTemplatesRaw = asArray17(documentJson.resourceTemplates).map((entry) =>
|
|
310351
|
+
const resourceTemplatesRaw = asArray17(documentJson.resourceTemplates).map((entry) => asRecord24(entry)).filter((entry) => entry !== null).map((template) => resourceTemplateDescriptor(template, warnings)).filter((template) => template !== null);
|
|
310148
310352
|
const seenTemplateNames = /* @__PURE__ */ new Set();
|
|
310149
310353
|
const resourceTemplates = [];
|
|
310150
310354
|
for (const template of resourceTemplatesRaw) {
|
|
@@ -310156,7 +310360,7 @@ function parseMcpServerSpec(content) {
|
|
|
310156
310360
|
resourceTemplates.push(template);
|
|
310157
310361
|
}
|
|
310158
310362
|
resourceTemplates.sort((a, b) => a.name.localeCompare(b.name));
|
|
310159
|
-
const promptsRaw = asArray17(documentJson.prompts).map((entry) =>
|
|
310363
|
+
const promptsRaw = asArray17(documentJson.prompts).map((entry) => asRecord24(entry)).filter((entry) => entry !== null).map((prompt) => promptDescriptor(prompt, warnings)).filter((prompt) => prompt !== null);
|
|
310160
310364
|
const seenPromptNames = /* @__PURE__ */ new Set();
|
|
310161
310365
|
const prompts = [];
|
|
310162
310366
|
for (const prompt of promptsRaw) {
|
|
@@ -310168,10 +310372,10 @@ function parseMcpServerSpec(content) {
|
|
|
310168
310372
|
prompts.push(prompt);
|
|
310169
310373
|
}
|
|
310170
310374
|
prompts.sort((a, b) => a.name.localeCompare(b.name));
|
|
310171
|
-
const versionDetail =
|
|
310375
|
+
const versionDetail = asRecord24(documentJson.version_detail);
|
|
310172
310376
|
const version = typeof documentJson.version === "string" ? documentJson.version : typeof versionDetail?.version === "string" ? String(versionDetail.version) : void 0;
|
|
310173
310377
|
servers.sort((a, b) => a.id.localeCompare(b.id));
|
|
310174
|
-
const capabilities =
|
|
310378
|
+
const capabilities = asRecord24(documentJson.capabilities);
|
|
310175
310379
|
if (documentJson.capabilities !== void 0 && !capabilities) {
|
|
310176
310380
|
warnings.push(`MCP_CAPABILITIES_INVALID: top-level capabilities must be an object when present; got ${JSON.stringify(documentJson.capabilities)}`);
|
|
310177
310381
|
}
|
|
@@ -310908,7 +311112,7 @@ function oldSessionPingScript() {
|
|
|
310908
311112
|
|
|
310909
311113
|
// src/lib/protocols/mcp/mcp-collection-builder.ts
|
|
310910
311114
|
var MCP_TOOLS_LIST_PAGINATION_PROBE_COUNT = 5;
|
|
310911
|
-
function
|
|
311115
|
+
function asRecord25(value) {
|
|
310912
311116
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
310913
311117
|
return value;
|
|
310914
311118
|
}
|
|
@@ -310963,7 +311167,7 @@ function promptsListMessage() {
|
|
|
310963
311167
|
return jsonRpc(9, "prompts/list", {});
|
|
310964
311168
|
}
|
|
310965
311169
|
function toolArguments(tool) {
|
|
310966
|
-
return
|
|
311170
|
+
return asRecord25(tool.sampleArguments) ?? {};
|
|
310967
311171
|
}
|
|
310968
311172
|
function promptArguments(prompt) {
|
|
310969
311173
|
const out = {};
|
|
@@ -311267,7 +311471,7 @@ var MIME_TYPE_RE = /^[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]*\/[A-Za-z0-9][A-Za-z0-9!#$&
|
|
|
311267
311471
|
var TOOL_FIELDS_2025_06_18 = /* @__PURE__ */ new Set(["name", "title", "description", "inputSchema", "outputSchema", "annotations", "_meta"]);
|
|
311268
311472
|
var JSON_RPC_STANDARD_ERROR_CODES = /* @__PURE__ */ new Set([-32700, -32600, -32601, -32602, -32603]);
|
|
311269
311473
|
var MCP_PROTOCOL_VERSIONS = /* @__PURE__ */ new Set(["2024-11-05", "2025-03-26", "2025-06-18", "2025-11-25"]);
|
|
311270
|
-
function
|
|
311474
|
+
function asRecord26(value) {
|
|
311271
311475
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
311272
311476
|
return value;
|
|
311273
311477
|
}
|
|
@@ -311283,7 +311487,7 @@ function isStrictBase64(value) {
|
|
|
311283
311487
|
}
|
|
311284
311488
|
}
|
|
311285
311489
|
function walkDocument(value, path10, visit4) {
|
|
311286
|
-
const record =
|
|
311490
|
+
const record = asRecord26(value);
|
|
311287
311491
|
if (record) {
|
|
311288
311492
|
visit4(record, path10);
|
|
311289
311493
|
for (const [key, child4] of Object.entries(record)) walkDocument(child4, `${path10}.${key}`, visit4);
|
|
@@ -311296,10 +311500,10 @@ function validateStaticContentBlock(block2, label, warnings) {
|
|
|
311296
311500
|
warnings.push(`MCP_STATIC_CONTENT_BLOCK_INVALID: ${label} content block type must be a string`);
|
|
311297
311501
|
return;
|
|
311298
311502
|
}
|
|
311299
|
-
if (block2.annotations !== void 0 &&
|
|
311503
|
+
if (block2.annotations !== void 0 && asRecord26(block2.annotations) === null) {
|
|
311300
311504
|
warnings.push(`MCP_STATIC_CONTENT_BLOCK_INVALID: ${label} annotations must be an object when present`);
|
|
311301
311505
|
}
|
|
311302
|
-
if (block2._meta !== void 0 &&
|
|
311506
|
+
if (block2._meta !== void 0 && asRecord26(block2._meta) === null) {
|
|
311303
311507
|
warnings.push(`MCP_STATIC_CONTENT_BLOCK_INVALID: ${label} _meta must be an object when present`);
|
|
311304
311508
|
}
|
|
311305
311509
|
if (block2.type === "text") {
|
|
@@ -311312,7 +311516,7 @@ function validateStaticContentBlock(block2, label, warnings) {
|
|
|
311312
311516
|
return;
|
|
311313
311517
|
}
|
|
311314
311518
|
if (block2.type === "resource") {
|
|
311315
|
-
const resource =
|
|
311519
|
+
const resource = asRecord26(block2.resource);
|
|
311316
311520
|
if (!resource) {
|
|
311317
311521
|
warnings.push(`MCP_STATIC_CONTENT_BLOCK_INVALID: ${label} resource content block must carry a resource object`);
|
|
311318
311522
|
return;
|
|
@@ -311326,7 +311530,7 @@ function validateStaticContentBlock(block2, label, warnings) {
|
|
|
311326
311530
|
warnings.push(`MCP_STATIC_CONTENT_BLOCK_INVALID: ${label} content block type "${block2.type}" is not a known MCP 2025-06-18 content discriminator`);
|
|
311327
311531
|
}
|
|
311328
311532
|
function validateStaticResultFixture(record, path10, warnings) {
|
|
311329
|
-
const result =
|
|
311533
|
+
const result = asRecord26(record.result);
|
|
311330
311534
|
if (!result) return;
|
|
311331
311535
|
for (const key of ["tools", "resources", "prompts"]) {
|
|
311332
311536
|
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`);
|
|
@@ -311336,8 +311540,8 @@ function validateStaticResultFixture(record, path10, warnings) {
|
|
|
311336
311540
|
}
|
|
311337
311541
|
if (result.protocolVersion !== void 0 || result.capabilities !== void 0 || result.serverInfo !== void 0) {
|
|
311338
311542
|
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`);
|
|
311339
|
-
if (
|
|
311340
|
-
const serverInfo =
|
|
311543
|
+
if (asRecord26(result.capabilities) === null) warnings.push(`MCP_STATIC_INITIALIZE_RESULT_INVALID: ${path10}.capabilities must be an object`);
|
|
311544
|
+
const serverInfo = asRecord26(result.serverInfo);
|
|
311341
311545
|
if (!serverInfo) warnings.push(`MCP_STATIC_INITIALIZE_RESULT_INVALID: ${path10}.serverInfo must be an object`);
|
|
311342
311546
|
else {
|
|
311343
311547
|
if (typeof serverInfo.name !== "string" || !serverInfo.name) warnings.push(`MCP_STATIC_INITIALIZE_RESULT_INVALID: ${path10}.serverInfo.name must be a non-empty string`);
|
|
@@ -311347,7 +311551,7 @@ function validateStaticResultFixture(record, path10, warnings) {
|
|
|
311347
311551
|
}
|
|
311348
311552
|
function validateStaticJsonRpcFixtures(index, warnings) {
|
|
311349
311553
|
walkDocument(index.documentJson, "$", (record, path10) => {
|
|
311350
|
-
const error2 =
|
|
311554
|
+
const error2 = asRecord26(record.error);
|
|
311351
311555
|
if (record.jsonrpc === "2.0" && error2) {
|
|
311352
311556
|
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`);
|
|
311353
311557
|
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`);
|
|
@@ -311356,19 +311560,19 @@ function validateStaticJsonRpcFixtures(index, warnings) {
|
|
|
311356
311560
|
validateStaticResultFixture(record, path10, warnings);
|
|
311357
311561
|
if (Array.isArray(record.content)) {
|
|
311358
311562
|
record.content.forEach((entry, i) => {
|
|
311359
|
-
const block2 =
|
|
311563
|
+
const block2 = asRecord26(entry);
|
|
311360
311564
|
if (block2) validateStaticContentBlock(block2, `${path10}.content[${i}]`, warnings);
|
|
311361
311565
|
});
|
|
311362
311566
|
}
|
|
311363
311567
|
if (Array.isArray(record.messages)) {
|
|
311364
311568
|
record.messages.forEach((entry, i) => {
|
|
311365
|
-
const message =
|
|
311569
|
+
const message = asRecord26(entry);
|
|
311366
311570
|
if (!message) {
|
|
311367
311571
|
warnings.push(`MCP_STATIC_PROMPT_MESSAGE_INVALID: ${path10}.messages[${i}] must be an object`);
|
|
311368
311572
|
return;
|
|
311369
311573
|
}
|
|
311370
311574
|
if (message.role !== "user" && message.role !== "assistant") warnings.push(`MCP_STATIC_PROMPT_MESSAGE_INVALID: ${path10}.messages[${i}].role must be user or assistant`);
|
|
311371
|
-
const content =
|
|
311575
|
+
const content = asRecord26(message.content);
|
|
311372
311576
|
if (!content) warnings.push(`MCP_STATIC_PROMPT_MESSAGE_INVALID: ${path10}.messages[${i}].content must be a content block object`);
|
|
311373
311577
|
else validateStaticContentBlock(content, `${path10}.messages[${i}].content`, warnings);
|
|
311374
311578
|
});
|
|
@@ -311382,10 +311586,10 @@ function walkManifest(value, path10, warnings) {
|
|
|
311382
311586
|
return;
|
|
311383
311587
|
}
|
|
311384
311588
|
const record = value;
|
|
311385
|
-
if (Object.prototype.hasOwnProperty.call(record, "_meta") &&
|
|
311589
|
+
if (Object.prototype.hasOwnProperty.call(record, "_meta") && asRecord26(record._meta) === null) {
|
|
311386
311590
|
warnings.push(`MCP_META_OBJECT_INVALID: ${path10}._meta must be an object when present (MCP 2025-06-18 BaseMetadata)`);
|
|
311387
311591
|
}
|
|
311388
|
-
const meta =
|
|
311592
|
+
const meta = asRecord26(record._meta);
|
|
311389
311593
|
if (meta) {
|
|
311390
311594
|
for (const key of Object.keys(meta)) {
|
|
311391
311595
|
if (!META_KEY_RE.test(key)) {
|
|
@@ -311404,7 +311608,7 @@ function walkManifest(value, path10, warnings) {
|
|
|
311404
311608
|
}
|
|
311405
311609
|
function validateManifestDocument(index, warnings) {
|
|
311406
311610
|
walkManifest(index.documentJson, "$", warnings);
|
|
311407
|
-
const tools = asArray18(index.documentJson.tools).map((entry) =>
|
|
311611
|
+
const tools = asArray18(index.documentJson.tools).map((entry) => asRecord26(entry)).filter((entry) => entry !== null);
|
|
311408
311612
|
const seen = /* @__PURE__ */ new Set();
|
|
311409
311613
|
for (const tool of tools) {
|
|
311410
311614
|
const name = typeof tool.name === "string" ? tool.name : "<unnamed>";
|
|
@@ -311423,7 +311627,7 @@ function validateManifestDocument(index, warnings) {
|
|
|
311423
311627
|
warnings.push(`MCP_TOOL_FIELD_UNKNOWN_2025_06_18: tool ${name} field "${field}" is not part of the MCP 2025-06-18 Tool object`);
|
|
311424
311628
|
}
|
|
311425
311629
|
}
|
|
311426
|
-
const annotations =
|
|
311630
|
+
const annotations = asRecord26(tool.annotations);
|
|
311427
311631
|
if (typeof tool.title === "string" && typeof annotations?.title === "string") {
|
|
311428
311632
|
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`);
|
|
311429
311633
|
}
|
|
@@ -311444,7 +311648,7 @@ function validateCapabilities(index, warnings) {
|
|
|
311444
311648
|
shaped[name] = null;
|
|
311445
311649
|
continue;
|
|
311446
311650
|
}
|
|
311447
|
-
const record =
|
|
311651
|
+
const record = asRecord26(value);
|
|
311448
311652
|
if (!record) {
|
|
311449
311653
|
warnings.push(`MCP_CAPABILITY_SHAPE_INVALID: capabilities.${name} must be an object when present; got ${JSON.stringify(value)}`);
|
|
311450
311654
|
shaped[name] = null;
|
|
@@ -311500,7 +311704,7 @@ function itemServerScope(itemTitle) {
|
|
|
311500
311704
|
return separator === -1 ? itemTitle : itemTitle.slice(0, separator);
|
|
311501
311705
|
}
|
|
311502
311706
|
function assertRecordValue(value, reason, fail2) {
|
|
311503
|
-
const record =
|
|
311707
|
+
const record = asRecord26(value);
|
|
311504
311708
|
if (!record) fail2(reason);
|
|
311505
311709
|
return record;
|
|
311506
311710
|
}
|
|
@@ -311522,7 +311726,7 @@ function assertJsonRpcRequest(message, itemTitle) {
|
|
|
311522
311726
|
} catch {
|
|
311523
311727
|
return fail2("message is not valid JSON");
|
|
311524
311728
|
}
|
|
311525
|
-
const record =
|
|
311729
|
+
const record = asRecord26(parsed);
|
|
311526
311730
|
if (!record) return fail2("message is not a JSON object");
|
|
311527
311731
|
if (record.jsonrpc !== "2.0") return fail2('jsonrpc must be the string "2.0"');
|
|
311528
311732
|
if (typeof record.method !== "string" || !record.method) return fail2("method must be a non-empty string");
|
|
@@ -311534,7 +311738,7 @@ function assertJsonRpcRequest(message, itemTitle) {
|
|
|
311534
311738
|
} else {
|
|
311535
311739
|
return fail2("id must be a string or number");
|
|
311536
311740
|
}
|
|
311537
|
-
if (record.params !== void 0 &&
|
|
311741
|
+
if (record.params !== void 0 && asRecord26(record.params) === null) return fail2("params must be an object when present");
|
|
311538
311742
|
switch (record.method) {
|
|
311539
311743
|
case "notifications/initialized":
|
|
311540
311744
|
assertOptionalObjectParams(record, "notifications/initialized", fail2);
|
|
@@ -311567,14 +311771,14 @@ function assertJsonRpcRequest(message, itemTitle) {
|
|
|
311567
311771
|
case "prompts/get": {
|
|
311568
311772
|
const params = assertObjectParams(record, "prompts/get", fail2);
|
|
311569
311773
|
if (typeof params.name !== "string" || !params.name) fail2("prompts/get params.name must be a non-empty string");
|
|
311570
|
-
if (params.arguments !== void 0 &&
|
|
311774
|
+
if (params.arguments !== void 0 && asRecord26(params.arguments) === null) fail2("prompts/get params.arguments must be an object when present");
|
|
311571
311775
|
break;
|
|
311572
311776
|
}
|
|
311573
311777
|
case "tools/call": {
|
|
311574
311778
|
const params = assertObjectParams(record, "tools/call", fail2);
|
|
311575
311779
|
if (typeof params.name !== "string" || !params.name) fail2("tools/call params.name must be a non-empty string");
|
|
311576
|
-
if (params.arguments !== void 0 &&
|
|
311577
|
-
if (params._meta !== void 0 &&
|
|
311780
|
+
if (params.arguments !== void 0 && asRecord26(params.arguments) === null) fail2("tools/call params.arguments must be an object when present");
|
|
311781
|
+
if (params._meta !== void 0 && asRecord26(params._meta) === null) fail2("tools/call params._meta must be an object when present");
|
|
311578
311782
|
break;
|
|
311579
311783
|
}
|
|
311580
311784
|
case "ping":
|
|
@@ -311675,7 +311879,7 @@ function instrumentMcpCollection(collection, index) {
|
|
|
311675
311879
|
validateAnnotatedDeclarations(index, warnings);
|
|
311676
311880
|
validateStaticJsonRpcFixtures(index, warnings);
|
|
311677
311881
|
for (const tool of index.tools) warnings.push(...toolsCallScript(index, tool).warnings);
|
|
311678
|
-
const items = asArray18(collection.item).map((entry) =>
|
|
311882
|
+
const items = asArray18(collection.item).map((entry) => asRecord26(entry)).filter((entry) => entry !== null);
|
|
311679
311883
|
const ids = [];
|
|
311680
311884
|
const httpIds = [];
|
|
311681
311885
|
const requestIdsByServer = /* @__PURE__ */ new Set();
|
|
@@ -311683,7 +311887,7 @@ function instrumentMcpCollection(collection, index) {
|
|
|
311683
311887
|
if (String(item.type) === "mcp-request") {
|
|
311684
311888
|
ids.push(typeof item.id === "string" && item.id ? item.id : `#${ids.length}`);
|
|
311685
311889
|
const itemTitle = String(item.title ?? item.id ?? "mcp-request");
|
|
311686
|
-
const request = assertJsonRpcRequest(
|
|
311890
|
+
const request = assertJsonRpcRequest(asRecord26(item.payload)?.message, itemTitle);
|
|
311687
311891
|
if (request.id !== void 0) {
|
|
311688
311892
|
const scopedId = `${itemServerScope(itemTitle)}\0${typeof request.id === "number" ? `n:${request.id}` : `s:${request.id}`}`;
|
|
311689
311893
|
if (requestIdsByServer.has(scopedId)) {
|